-
Notifications
You must be signed in to change notification settings - Fork 8
feat(agent): add global and repo-local agent integrations #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package agent | ||
|
|
||
| import ( | ||
| agentinit "github.com/jaxxstorm/tscli/cmd/tscli/agent/init" | ||
| agentupdate "github.com/jaxxstorm/tscli/cmd/tscli/agent/update" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func Command(root *cobra.Command) *cobra.Command { | ||
| command := &cobra.Command{ | ||
| Use: "agent", | ||
| Short: "Manage AI agent integrations for tscli", | ||
| Long: "Generate and refresh tscli-backed AI agent instructions, skills, prompts, and commands for either a repo-local checkout or global user-level tooling.", | ||
| } | ||
|
|
||
| command.AddCommand(agentinit.Command(root)) | ||
| command.AddCommand(agentupdate.Command(root)) | ||
| return command | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package init | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
|
|
||
| pkgagent "github.com/jaxxstorm/tscli/pkg/agent" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func Command(root *cobra.Command) *cobra.Command { | ||
| var dir string | ||
| var tools []string | ||
| var force bool | ||
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "init", | ||
| Short: "Initialize AI agent integrations for tscli", | ||
| Long: "Generate tscli-backed AI agent instructions, command catalogs, and native prompt, skill, or command surfaces for supported tools.", | ||
| RunE: func(_ *cobra.Command, _ []string) error { | ||
| result, err := pkgagent.Init(root, pkgagent.InstallOptions{ | ||
| RootDir: dir, | ||
| Tools: tools, | ||
| Force: force, | ||
| }) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| fmt.Printf("tscli agent integrations initialized (%s) in %s\n", result.InstallScope, result.RootDir) | ||
| fmt.Printf("tools: %s\n", strings.Join(result.Tools, ", ")) | ||
| fmt.Printf("indexed leaf commands: %d\n", result.CommandCount) | ||
| fmt.Printf("manifest: %s\n", result.ManifestPath) | ||
| if result.InstallScope == pkgagent.ScopeLocal { | ||
| fmt.Printf("refresh with: tscli agent update --dir %s\n", result.RootDir) | ||
| } else { | ||
| fmt.Printf("refresh with: tscli agent update\n") | ||
| } | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| cmd.Flags().StringVar(&dir, "dir", "", "Optional repository root for a repo-local install; omit to install global user-level integrations") | ||
| cmd.Flags().StringSliceVar(&tools, "tool", nil, fmt.Sprintf("Tool integrations to install (supported: %s; availability depends on global vs local install target)", strings.Join(pkgagent.SupportedTools(), ", "))) | ||
| cmd.Flags().BoolVar(&force, "force", false, "Overwrite unmanaged files at generated target paths") | ||
| return cmd | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package update | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "strings" | ||
|
|
||
| pkgagent "github.com/jaxxstorm/tscli/pkg/agent" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func Command(root *cobra.Command) *cobra.Command { | ||
| var dir string | ||
| var force bool | ||
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "update", | ||
| Short: "Refresh AI agent integrations for tscli", | ||
| Long: "Refresh the generated tscli agent bundle using the tool selection recorded in the target manifest. Without --dir, update refreshes the global user-level install.", | ||
| RunE: func(_ *cobra.Command, _ []string) error { | ||
| result, err := pkgagent.Update(root, pkgagent.UpdateOptions{ | ||
| RootDir: dir, | ||
| Force: force, | ||
| }) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| fmt.Printf("tscli agent integrations updated (%s) in %s\n", result.InstallScope, result.RootDir) | ||
| fmt.Printf("tools: %s\n", strings.Join(result.Tools, ", ")) | ||
| fmt.Printf("indexed leaf commands: %d\n", result.CommandCount) | ||
| fmt.Printf("manifest: %s\n", result.ManifestPath) | ||
| return nil | ||
| }, | ||
| } | ||
|
|
||
| cmd.Flags().StringVar(&dir, "dir", "", "Optional repository root containing a repo-local tscli agent manifest; omit to update the global install") | ||
| cmd.Flags().BoolVar(&force, "force", false, "Overwrite unmanaged files at generated target paths") | ||
| return cmd | ||
| } |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| - [Home](/) | ||
| - [Getting Started](getting-started.md) | ||
| - [AI Agents](agents.md) | ||
| - [Command Reference](command-reference.md) | ||
| - [Configuration](configuration.md) | ||
| - [Authentication](authentication.md) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # AI Agent Integrations | ||
|
|
||
| `tscli agent init` bootstraps `tscli`-aware instructions, skills, prompts, and commands so AI agents can use `tscli` directly instead of ad hoc API calls. | ||
|
|
||
| ## What it generates | ||
|
|
||
| The command writes a versioned bundle into either your user-level config directories or a target repository. | ||
|
|
||
| Global install surfaces: | ||
|
|
||
| - `.config/tscli/agent/manifest.yaml`: versioned manifest used by `tscli agent update` | ||
| - `.config/tscli/agent/commands.md`: generated catalog of the current `tscli` leaf commands | ||
| - `.codex/skills/tscli/SKILL.md`: Codex skill surface | ||
| - `.claude/commands/tscli-inspect.md`: Claude Code read-only slash command | ||
| - `.claude/commands/tscli-operate.md`: Claude Code mutation slash command | ||
| - `.config/opencode/commands/tscli-inspect.md`: OpenCode read-only command | ||
| - `.config/opencode/commands/tscli-operate.md`: OpenCode mutation command | ||
|
|
||
| Repo-local install surfaces: | ||
|
|
||
| - `AGENTS.md`: global instructions for agent-aware tools | ||
| - `CLAUDE.md`: Claude Code project memory | ||
| - `.tscli/agent/manifest.yaml`: versioned manifest used by `tscli agent update` | ||
| - `.tscli/agent/commands.md`: generated catalog of the current `tscli` leaf commands | ||
| - `.codex/skills/tscli/SKILL.md`: Codex skill surface | ||
| - `.github/skills/tscli/SKILL.md`: GitHub Copilot skill surface | ||
| - `.github/prompts/tscli-inspect.prompt.md`: GitHub Copilot read-only prompt | ||
| - `.github/prompts/tscli-operate.prompt.md`: GitHub Copilot mutation prompt | ||
|
|
||
| ## Initialize | ||
|
|
||
| Install global user-level integrations: | ||
|
|
||
| ```bash | ||
| tscli agent init | ||
| ``` | ||
|
|
||
| Install repo-local integrations into another directory: | ||
|
|
||
| ```bash | ||
| tscli agent init --dir /path/to/repo | ||
| ``` | ||
|
|
||
| Restrict generation to selected tool surfaces: | ||
|
|
||
| ```bash | ||
| tscli agent init --dir /path/to/repo --tool codex --tool claude --tool opencode | ||
| ``` | ||
|
|
||
| Supported `--tool` values are `generic`, `codex`, `claude`, `opencode`, and `copilot`. | ||
|
|
||
| Global installs support `codex`, `claude`, and `opencode`. | ||
|
|
||
| Repo-local installs support `generic`, `codex`, `claude`, `opencode`, and `copilot`. | ||
|
|
||
| ## Update | ||
|
|
||
| Refresh the global generated bundle after upgrading `tscli` or adding new commands: | ||
|
|
||
| ```bash | ||
| tscli agent update | ||
| ``` | ||
|
|
||
| Refresh a repo-local bundle: | ||
|
|
||
| ```bash | ||
| tscli agent update --dir /path/to/repo | ||
| ``` | ||
|
|
||
| `update` reads the scope-appropriate manifest to preserve the original tool selection and rewrite the managed files in place. | ||
|
|
||
| ## Operating model | ||
|
|
||
| - Agents should prefer `tscli list ...`, `tscli get ...`, `tscli create ...`, `tscli set ...`, and `tscli delete ...` over raw API calls when a command exists. | ||
| - The generated command catalog is derived from the live Cobra command tree, so it stays aligned with the CLI surface. | ||
| - Global command surfaces are reusable user-level integrations; repo-local instruction files remain project-scoped. | ||
| - If a generated target path already contains an unmanaged file, rerun with `--force` only if you intend to replace it. |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <!-- Code generated by `make docs-generate`; DO NOT EDIT. --> | ||
|
|
||
| ## tscli agent | ||
|
|
||
| Manage AI agent integrations for tscli | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Generate and refresh tscli-backed AI agent instructions, skills, prompts, and commands for either a repo-local checkout or global user-level tooling. | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for agent | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| -k, --api-key string Tailscale API key | ||
| -d, --debug Dump HTTP requests/responses | ||
| -o, --output string Output: [human json pretty yaml] | ||
| -n, --tailnet string Tailscale tailnet (default "-") | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [tscli](tscli.md) - | ||
| * [tscli agent init](tscli_agent_init.md) - Initialize AI agent integrations for tscli | ||
| * [tscli agent update](tscli_agent_update.md) - Refresh AI agent integrations for tscli | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <!-- Code generated by `make docs-generate`; DO NOT EDIT. --> | ||
|
|
||
| ## tscli agent init | ||
|
|
||
| Initialize AI agent integrations for tscli | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Generate tscli-backed AI agent instructions, command catalogs, and native prompt, skill, or command surfaces for supported tools. | ||
|
|
||
| ``` | ||
| tscli agent init [flags] | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| --dir string Optional repository root for a repo-local install; omit to install global user-level integrations | ||
| --force Overwrite unmanaged files at generated target paths | ||
| -h, --help help for init | ||
| --tool strings Tool integrations to install (supported: generic, codex, claude, opencode, copilot; availability depends on global vs local install target) | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| -k, --api-key string Tailscale API key | ||
| -d, --debug Dump HTTP requests/responses | ||
| -o, --output string Output: [human json pretty yaml] | ||
| -n, --tailnet string Tailscale tailnet (default "-") | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [tscli agent](tscli_agent.md) - Manage AI agent integrations for tscli | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <!-- Code generated by `make docs-generate`; DO NOT EDIT. --> | ||
|
|
||
| ## tscli agent update | ||
|
|
||
| Refresh AI agent integrations for tscli | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Refresh the generated tscli agent bundle using the tool selection recorded in the target manifest. Without --dir, update refreshes the global user-level install. | ||
|
|
||
| ``` | ||
| tscli agent update [flags] | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| --dir string Optional repository root containing a repo-local tscli agent manifest; omit to update the global install | ||
| --force Overwrite unmanaged files at generated target paths | ||
| -h, --help help for update | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| -k, --api-key string Tailscale API key | ||
| -d, --debug Dump HTTP requests/responses | ||
| -o, --output string Output: [human json pretty yaml] | ||
| -n, --tailnet string Tailscale tailnet (default "-") | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [tscli agent](tscli_agent.md) - Manage AI agent integrations for tscli | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.