Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

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.
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.

## Architecture

Expand All @@ -13,6 +13,8 @@ The application follows a command-line interface pattern using the Cobra library
- **main.go**: Core CLI structure with command definitions and configuration management
- **auth.go**: OAuth2 device flow authentication with JWT token handling
- **datasets.go**: Dataset operations (list, download, upload, status) with REST API integration
- **registries.go**: Registry operations (list) with REST API integration
- **packages.go**: Package operations (search, info) with GraphQL API integration
- **projects.go**: Project management using GraphQL API with user filtering
- **user.go**: User information retrieval using GraphQL API
- **git.go**: Git integration (clone, push, fetch, pull) with JuliaHub authentication
Expand All @@ -29,14 +31,16 @@ The application follows a command-line interface pattern using the Cobra library
- Stores tokens securely in `~/.juliahub` with 0600 permissions

2. **API Integration**:
- **REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`)
- **REST API**: Used for dataset operations (`/api/v1/datasets`, `/datasets/{uuid}/url/{version}`) and registry operations (`/api/v1/ui/registries/descriptions`)
- **GraphQL API**: Used for projects and user info (`/v1/graphql`)
- **Headers**: All GraphQL requests require `X-Hasura-Role: jhuser` header
- **Authentication**: Uses ID tokens (`token.IDToken`) for API calls

3. **Command Structure**:
- `jh auth`: Authentication commands (login, refresh, status, env)
- `jh dataset`: Dataset operations (list, download, upload, status)
- `jh registry`: Registry operations (list with REST API, supports verbose mode)
- `jh package`: Package operations (search, info with GraphQL API, supports filtering by registry, installation status, and failures)
- `jh project`: Project management (list with GraphQL, supports user filtering)
- `jh user`: User information (info with GraphQL)
- `jh clone`: Git clone with JuliaHub authentication and project name resolution
Expand Down Expand Up @@ -84,6 +88,26 @@ go run . dataset download <dataset-name>
go run . dataset upload --new ./file.tar.gz
```

### Test registry operations
```bash
go run . registry list
go run . registry list --verbose
```

### Test package operations
```bash
# Search for packages
go run . package search dataframes
go run . package search --verbose plots
go run . package search --limit 20 ml
go run . package search --registries General optimization
go run . package search --installed

# Get package info
go run . package info DataFrames
go run . package info Plots --registries General
```

### Test project and user operations
```bash
go run . project list
Expand Down Expand Up @@ -273,6 +297,10 @@ jh run setup
- Clone command automatically resolves `username/project` format to project UUIDs
- Folder naming conflicts are resolved with automatic numbering (project-1, project-2, etc.)
- Credential helper follows Git protocol: responds only to JuliaHub URLs, ignores others
- Registry list output is concise by default (UUID and Name only); use `--verbose` flag for detailed information (owner, creation date, package count, description)
- Package search output shows column headers (NAME, OWNER, VERSION, DESCRIPTION) by default; use `--verbose` flag for detailed key-value format
- Package info command performs exact name match (case-insensitive) and displays detailed package information
- Package commands support registry filtering via `--registries` flag (comma-separated list)

## Implementation Details

Expand Down
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ A command-line interface for interacting with JuliaHub, a platform for Julia com

- **Authentication**: OAuth2 device flow authentication with JWT token handling
- **Dataset Management**: List, download, upload, and check status of datasets
- **Registry Management**: List and manage Julia package registries
- **Package Management**: Search and explore Julia packages with filtering and detailed information
- **Project Management**: List and filter projects using GraphQL API
- **Git Integration**: Clone, push, fetch, and pull with automatic JuliaHub authentication
- **Julia Integration**: Install Julia and run with JuliaHub package server configuration
Expand Down Expand Up @@ -148,6 +150,26 @@ go build -o jh .
- `jh dataset upload [dataset-id] <file-path>` - Upload a dataset
- `jh dataset status <dataset-id> [version]` - Show dataset status

### Registry Management (`jh registry`)

- `jh registry list` - List all package registries on JuliaHub
- Default: Shows only UUID and Name
- `jh registry list --verbose` - Show detailed registry information including owner, creation date, package count, and description

### Package Management (`jh package`)

- `jh package search [search-term]` - Search for Julia packages
- Default: Shows concise output with NAME, OWNER, VERSION, and DESCRIPTION columns
- `jh package search --verbose` - Show detailed package information
- `jh package search --limit 20` - Limit number of results
- `jh package search --offset 10` - Skip first N results
- `jh package search --registries General` - Filter by specific registries
- `jh package search --installed` - Show only installed packages
- `jh package search --not-installed` - Show only packages not installed
- `jh package search --has-failures` - Show only packages with download failures
- `jh package info <package-name>` - Get detailed information about a specific package by exact name match
- `jh package info --registries General` - Search in specific registries only

### Project Management (`jh project`)

- `jh project list` - List all accessible projects
Expand Down Expand Up @@ -214,6 +236,38 @@ jh dataset upload --new ./my-data.tar.gz
jh dataset upload my-dataset ./updated-data.tar.gz
```

### Registry Operations

```bash
# List all registries (UUID and Name only)
jh registry list

# List registries with detailed information
jh registry list --verbose

# List registries on custom server
jh registry list -s yourinstall
```

### Package Operations

```bash
# Search for packages (shows concise output with columns)
jh package search dataframes

# Search with detailed information
jh package search --verbose plots

# Search with filters
jh package search --installed
jh package search --limit 20 ml
jh package search --registries General optimization

# Get detailed info about a specific package
jh package info DataFrames
jh package info Plots --registries General
```

### Project Operations

```bash
Expand Down
Loading