You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+21-4Lines changed: 21 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,6 @@
3
3
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
5
5
## Project Overview
6
-
7
6
This is a Go-based CLI tool for interacting with JuliaHub, a platform for Julia computing. The CLI provides commands for authentication, dataset management, registry management, project management, user information, token management, Git integration, and Julia integration.
8
7
9
8
## Architecture
@@ -13,7 +12,8 @@ The application follows a command-line interface pattern using the Cobra library
13
12
-**main.go**: Core CLI structure with command definitions and configuration management
14
13
-**auth.go**: OAuth2 device flow authentication with JWT token handling
15
14
-**datasets.go**: Dataset operations (list, download, upload, status) with REST API integration
16
-
-**registries.go**: Registry operations (list) with REST API integration
15
+
-**registries.go**: Registry operations (list, fetch) with REST API integration
16
+
-**packages.go**: Package search with REST API primary path (`/packages/info`) and GraphQL fallback
17
17
-**projects.go**: Project management using GraphQL API with user filtering
18
18
-**user.go**: User information retrieval using GraphQL API and REST API for listing users
19
19
-**tokens.go**: Token management operations (list) with REST API integration
@@ -31,8 +31,8 @@ The application follows a command-line interface pattern using the Cobra library
31
31
- Stores tokens securely in `~/.juliahub` with 0600 permissions
32
32
33
33
2.**API Integration**:
34
-
-**REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`), registry operations (`/api/v1/ui/registries/descriptions`), token management (`/app/token/activelist`) and user management (`/app/config/features/manage`)
35
-
-**GraphQL API**: Used for projects and user info (`/v1/graphql`)
34
+
-**REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`), registry operations (`/api/v1/registry/registries/descriptions`), package search primary path (`/packages/info`), token management (`/app/token/activelist`) and user management (`/app/config/features/manage`)
35
+
-**GraphQL API**: Used for projects, user info, and package search fallback (`/v1/graphql`)
36
36
-**Headers**: All GraphQL requests require `X-Hasura-Role: jhuser` header
37
37
-**Authentication**: Uses ID tokens (`token.IDToken`) for API calls
38
38
@@ -41,6 +41,7 @@ The application follows a command-line interface pattern using the Cobra library
-**Upload workflow**: 3-step process (request presigned URL, upload to URL, close upload)
192
202
@@ -308,6 +318,13 @@ jh run setup
308
318
- Token list output is concise by default (Subject, Created By, and Expired status only); use `--verbose` flag for detailed information (signature, creation date, expiration date with estimate indicator)
309
319
- Token dates are formatted in human-readable format and converted to local timezone (respects system timezone or TZ environment variable)
310
320
- Token expiration estimate indicator only shown when `expires_at_is_estimate` is true in API response
321
+
- Package search (`jh package search`) tries REST API (`/packages/info`) first, then falls back to GraphQL (`FilteredPackagesWithCount` via `/v1/graphql`) on failure; a warning is printed to stderr when the fallback is used
322
+
- Package search GraphQL fallback passes `--registries` as registry IDs to the `registries` variable
323
+
-`fetchRegistries` in `registries.go` is used by both `listRegistries` (for display) and `packageSearchCmd` (to resolve registry names to IDs for GraphQL and names for REST fallback)
324
+
- Both REST and GraphQL package search paths produce identical output columns (Registry and Owner); GraphQL resolves registry names from the `registryIDs`/`registryNames` already in `PackageSearchParams` — no extra API call needed
325
+
- A package in multiple registries appears as multiple rows (one per registry) in both REST and GraphQL paths, since the GraphQL view (`package_rank_vw`) is already flattened per package-registry combination
326
+
- GraphQL fallback uses `package_search_with_count.gql` which fetches both the package list and aggregate count in a single request (`package_search` + `package_search_aggregate` root fields)
327
+
-`executeGraphQL(server, token, req)` in `packages.go` is a shared helper for GraphQL POST requests (sets Authorization, Content-Type, Accept, X-Hasura-Role headers)
jh package search --registries General optimization
258
+
259
+
# Limit and paginate results
260
+
jh package search --limit 20 --offset 0 ml
261
+
```
262
+
237
263
### Registry Operations
238
264
239
265
```bash
@@ -333,7 +359,7 @@ Note: Arguments after `--` are passed directly to Julia. The `jh run` command:
333
359
334
360
-**Built with Go** using the Cobra CLI framework
335
361
-**Authentication**: OAuth2 device flow with JWT token management
336
-
-**APIs**: REST API for datasets, GraphQL API for projects and user info
362
+
-**APIs**: REST API for datasets and package search (primary); GraphQL API for projects, user info, and package search fallback (single request returns results + total count)
337
363
-**Git Integration**: Seamless authentication via HTTP headers or credential helper
338
364
-**Cross-platform**: Supports Windows, macOS, and Linux
0 commit comments