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
+28-7Lines changed: 28 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
This is a Go-based CLI tool for interacting with JuliaHub, a platform for Julia computing. The CLI provides commands for authentication, dataset management, project management, user information, Git integration, and Julia integration.
7
+
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, Git integration, and Julia integration.
8
8
9
9
## Architecture
10
10
@@ -13,6 +13,7 @@ The application follows a command-line interface pattern using the Cobra library
13
13
-**main.go**: Core CLI structure with command definitions and configuration management
14
14
-**auth.go**: OAuth2 device flow authentication with JWT token handling
15
15
-**datasets.go**: Dataset operations (list, download, upload, status) with REST API integration
16
+
-**registries.go**: Registry operations (list) with REST API integration
16
17
-**projects.go**: Project management using GraphQL API with user filtering
17
18
-**user.go**: User information retrieval using GraphQL API and REST API for listing users
18
19
-**git.go**: Git integration (clone, push, fetch, pull) with JuliaHub authentication
@@ -29,14 +30,19 @@ The application follows a command-line interface pattern using the Cobra library
29
30
- Stores tokens securely in `~/.juliahub` with 0600 permissions
30
31
31
32
2.**API Integration**:
33
+
<<<<<<< HEAD
32
34
-**REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`) and user management (`/app/config/features/manage`)
35
+
=======
36
+
-**REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`) and registry operations (`/api/v1/ui/registries/descriptions`)
37
+
>>>>>>> fadd2b0ea19a8b11eb903d5884ffa50371e337e4
33
38
-**GraphQL API**: Used for projects and user info (`/v1/graphql`)
34
39
-**Headers**: All GraphQL requests require `X-Hasura-Role: jhuser` header
35
40
-**Authentication**: Uses ID tokens (`token.IDToken`) for API calls
-**Authentication file**: Automatically creates `$JULIA_DEPOT_PATH/servers/<server>/auth.toml` (or `~/.julia/servers/<server>/auth.toml` if `JULIA_DEPOT_PATH` is not set)
247
+
-**Depot path detection**: Respects `JULIA_DEPOT_PATH` environment variable, uses first path if multiple are specified
-**Automatic updates**: Credentials are automatically refreshed when:
235
250
- User runs `jh auth login`
@@ -257,7 +272,7 @@ jh run -- --project=. --threads=4 script.jl # Run with flags
257
272
```bash
258
273
jh run setup
259
274
```
260
-
- Creates/updates `~/.julia/servers/<server>/auth.toml`with current credentials
275
+
- Creates/updates `$JULIA_DEPOT_PATH/servers/<server>/auth.toml` with current credentials (or `~/.julia/servers/<server>/auth.toml`if not set)
261
276
- Does not start Julia
262
277
- Useful for explicitly updating credentials
263
278
@@ -270,16 +285,19 @@ jh run setup
270
285
- File uploads use multipart form data with proper content types
271
286
- Julia auth files use TOML format with `preferred_username` from JWT claims
272
287
- Julia auth files use atomic writes (temp file + rename) to prevent corruption
288
+
- Julia credentials respect `JULIA_DEPOT_PATH` environment variable (uses first path if multiple are specified)
273
289
- Julia credentials are automatically updated after login and token refresh
274
290
- Git commands use `http.extraHeader` for authentication and pass through all arguments
275
291
- Git credential helper provides seamless authentication for standard Git commands
276
292
- Multi-server authentication handled automatically via credential helper
277
293
- Project filtering supports `--user` parameter for showing specific user's projects or own projects
278
294
- Clone command automatically resolves `username/project` format to project UUIDs
295
+
- Clone command supports `project` (without username) and defaults to the logged-in user's username
279
296
- Folder naming conflicts are resolved with automatic numbering (project-1, project-2, etc.)
280
297
- Credential helper follows Git protocol: responds only to JuliaHub URLs, ignores others
281
298
- Admin user list command (`jh admin user list`) uses REST API endpoint `/app/config/features/manage` which requires appropriate permissions
282
299
- User list output is concise by default (Name and Email only); use `--verbose` flag for detailed information (UUID, groups, features)
300
+
- Registry list output is concise by default (UUID and Name only); use `--verbose` flag for detailed information (owner, creation date, package count, description)
283
301
284
302
## Implementation Details
285
303
@@ -288,7 +306,9 @@ jh run setup
288
306
The Julia credentials system consists of three main functions:
289
307
290
308
1.**`createJuliaAuthFile(server, token)`**:
291
-
- Creates `~/.julia/servers/<server>/auth.toml` with TOML-formatted credentials
309
+
- Determines depot path from `JULIA_DEPOT_PATH` environment variable (uses first path if multiple)
310
+
- Falls back to `~/.julia` if `JULIA_DEPOT_PATH` is not set
311
+
- Creates `{depot}/servers/<server>/auth.toml` with TOML-formatted credentials
292
312
- Uses atomic writes: writes to temporary file, syncs, then renames
293
313
- Includes all necessary fields: tokens, expiration, refresh URL, user info
294
314
- Called by `setupJuliaCredentials()` and `updateJuliaCredentialsIfNeeded()`
@@ -313,7 +333,8 @@ The Julia credentials system consists of three main functions:
313
333
314
334
The `updateJuliaCredentialsIfNeeded(server, token)` function:
315
335
- Called automatically by `ensureValidToken()` after token refresh
316
-
- Checks if `~/.julia/servers/<server>/auth.toml` exists
336
+
- Determines depot path from `JULIA_DEPOT_PATH` (same logic as `createJuliaAuthFile`)
337
+
- Checks if `{depot}/servers/<server>/auth.toml` exists
317
338
- If exists, updates it with refreshed token
318
339
- If not exists, does nothing (user hasn't used Julia integration yet)
319
340
- Errors are silently ignored to avoid breaking token operations
@@ -277,7 +297,7 @@ jh run -- --project=. --threads=4 script.jl
277
297
```
278
298
279
299
Note: Arguments after `--` are passed directly to Julia. The `jh run` command:
280
-
1. Sets up JuliaHub credentials in `~/.julia/servers/<server>/auth.toml`
300
+
1. Sets up JuliaHub credentials in `$JULIA_DEPOT_PATH/servers/<server>/auth.toml` (or `~/.julia/servers/<server>/auth.toml` if `JULIA_DEPOT_PATH` is not set)
0 commit comments