Skip to content

feat(hub): add hub namespace for agent/skill repos#98

Merged
Vishnu Suresh (vishnu-ssuresh) merged 19 commits into
mainfrom
vishnu/hub-cli
May 6, 2026
Merged

feat(hub): add hub namespace for agent/skill repos#98
Vishnu Suresh (vishnu-ssuresh) merged 19 commits into
mainfrom
vishnu/hub-cli

Conversation

@vishnu-ssuresh
Copy link
Copy Markdown
Contributor

@vishnu-ssuresh Vishnu Suresh (vishnu-ssuresh) commented May 4, 2026

Summary

Adds langsmith hub with six subcommands matching the Python/JS SDK hub methods. Coding agents can now pull and push agent/skill repos from the terminal instead of going through the web UI.

Six commands shipped:

  • hub init scaffolds a starter SKILL.md (skills) or AGENTS.md+tools.json+config.json (agents)
  • hub push [OWNER/]REPO walks a local dir, ensures the repo exists, posts a directory commit
  • hub pull [OWNER/]REPO[:REF] fetches a commit and writes files locally
  • hub list filters by type, query string, public/private, with pagination
  • hub get [OWNER/]REPO returns repo metadata
  • hub delete [OWNER/]REPO removes a repo and its owned child file repos

Identifiers use [OWNER/]REPO format. Omitting the owner defaults to - (the API "current tenant" wildcard).

Out of scope (tracked in docs/superpowers/specs/2026-04-29-context-hub-design.md):

  • hub exists and hub tag (small follow-up PRs to close SDK parity)
  • The langsmith skills namespace, lockfile, and onboarding (P1 work)

Safety properties

  • hub pull validates every API-supplied file path before any os.RemoveAll runs, so a malicious server response cannot trick the CLI into wiping the destination and then bailing
  • Belt-and-braces filepath.Rel re-check after Join in case validation has a gap
  • hub pull refuses to wipe non-empty directories that lack a SKILL.md or AGENTS.md marker, unless --yes is passed
  • hub push excludes secret patterns (.env*, *.pem, *.key, *.pfx, *.p12, *.crt) and build artifacts (node_modules/, target/, .next/, etc.)
  • hub push rejects binary files, rejects files larger than 1 MiB, caps at 500 entries
  • hub delete requires confirmation on stderr, skippable with --yes

Test plan

  • Unit tests for parser, regex, and HTTP error helpers
  • Per-command tests against httptest mock server (one test file per command)
  • Traversal protection tests cover ../escape.txt and absolute paths
  • Secret-exclusion test covers .env, .pem, .key, .crt, .p12, Thumbs.db
  • go test ./... -race passes across all packages
  • go vet and gofmt clean

- Added `hub.go` to define the `hub` command for managing agent and skill repos.
- Implemented helper functions for parsing repo identifiers and checking HTTP error statuses.
- Created `hub_test.go` with unit tests for the `hub` command and its functionalities, including command registration and error handling.
- Updated `root.go` to register the new `hub` command in the root command structure.
devin-ai-integration[bot]

This comment was marked as resolved.

Comment thread internal/cmd/hub.go Outdated
func ensureHubRepo(ctx context.Context, c *client.Client, owner, name, repoType string, meta hubRepoMeta) error {
getPath := fmt.Sprintf("/repos/%s/%s", owner, name)
var existing map[string]any
err := c.RawGet(ctx, getPath, &existing)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use go sdk methods? instead of rawget?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread internal/cmd/hub.go
Prompts are managed via "langsmith prompt" — they use a different endpoint.

Examples:
langsmith hub init --type skill --dir ./my-skill --name my-skill
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want this cmd group to be under hub?

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, there are a few files that seem pretty unit testable?

Comment thread internal/cmd/hub_parse.go
Comment thread internal/cmd/hub_repo_sdk.go
@vishnu-ssuresh Vishnu Suresh (vishnu-ssuresh) merged commit 99ad75e into main May 6, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants