feat(hub): add hub namespace for agent/skill repos#98
Merged
Conversation
5 tasks
- 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.
c86485d to
2609361
Compare
| 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) |
Contributor
There was a problem hiding this comment.
can we use go sdk methods? instead of rawget?
Contributor
Author
There was a problem hiding this comment.
| Prompts are managed via "langsmith prompt" — they use a different endpoint. | ||
|
|
||
| Examples: | ||
| langsmith hub init --type skill --dir ./my-skill --name my-skill |
Contributor
There was a problem hiding this comment.
do we want this cmd group to be under hub?
# Conflicts: # go.mod # go.sum # internal/cmd/sandbox_box.go
# Conflicts: # go.mod # go.sum # internal/cmd/sandbox_box.go
Mukil Loganathan (langchain-infra)
approved these changes
May 6, 2026
Contributor
Mukil Loganathan (langchain-infra)
left a comment
There was a problem hiding this comment.
lgtm, there are a few files that seem pretty unit testable?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
langsmith hubwith 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 initscaffolds a starter SKILL.md (skills) or AGENTS.md+tools.json+config.json (agents)hub push [OWNER/]REPOwalks a local dir, ensures the repo exists, posts a directory commithub pull [OWNER/]REPO[:REF]fetches a commit and writes files locallyhub listfilters by type, query string, public/private, with paginationhub get [OWNER/]REPOreturns repo metadatahub delete [OWNER/]REPOremoves a repo and its owned child file reposIdentifiers use
[OWNER/]REPOformat. 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 existsandhub tag(small follow-up PRs to close SDK parity)langsmith skillsnamespace, lockfile, and onboarding (P1 work)Safety properties
hub pullvalidates every API-supplied file path before anyos.RemoveAllruns, so a malicious server response cannot trick the CLI into wiping the destination and then bailingfilepath.Relre-check afterJoinin case validation has a gaphub pullrefuses to wipe non-empty directories that lack a SKILL.md or AGENTS.md marker, unless--yesis passedhub pushexcludes secret patterns (.env*,*.pem,*.key,*.pfx,*.p12,*.crt) and build artifacts (node_modules/,target/,.next/, etc.)hub pushrejects binary files, rejects files larger than 1 MiB, caps at 500 entrieshub deleterequires confirmation on stderr, skippable with--yesTest plan
httptestmock server (one test file per command)../escape.txtand absolute paths.env,.pem,.key,.crt,.p12,Thumbs.dbgo test ./... -racepasses across all packagesgo vetandgofmtclean