argsbarg 4.1.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -1
- package/README.md +5 -5
- package/docs/README.md +3 -3
- package/docs/ai-skills.md +9 -9
- package/docs/bundled-docs.md +4 -4
- package/docs/cli-program.md +8 -8
- package/docs/config-schema.md +2 -2
- package/docs/configure.md +177 -0
- package/docs/developing.md +1 -1
- package/docs/distribution-homebrew.md +10 -9
- package/docs/mcp.md +9 -9
- package/examples/full-example/README.md +3 -3
- package/examples/full-example/justfile +6 -6
- package/examples/full-example/scripts/formula-shared.ts +2 -2
- package/examples/full-example/src/program.ts +3 -3
- package/examples/nested.ts +1 -1
- package/index.d.ts +23 -16
- package/package.json +1 -1
- package/src/builtins/builtins.test.ts +82 -61
- package/src/builtins/completion-group.ts +4 -6
- package/src/builtins/configure-copy.ts +86 -0
- package/src/builtins/configure.ts +70 -0
- package/src/builtins/dispatch.ts +13 -33
- package/src/builtins/index.ts +1 -1
- package/src/builtins/mcp.ts +2 -2
- package/src/builtins/registry.ts +6 -6
- package/src/capabilities.ts +22 -13
- package/src/cli-tool/cli-smoke.test.ts +13 -3
- package/src/cli-tool/create.test.ts +23 -1
- package/src/cli-tool/create.ts +26 -4
- package/src/cli-tool/full-example-capabilities.test.ts +2 -2
- package/src/cli-tool/program.ts +20 -5
- package/src/cli-tool/run-create.ts +8 -19
- package/src/config/bootstrap.ts +11 -9
- package/src/config/file.test.ts +1 -1
- package/src/config/resolve.ts +2 -2
- package/src/configure/configure.test.ts +148 -0
- package/src/configure/index.ts +284 -0
- package/src/configure/prompt.ts +40 -0
- package/src/docs/builtin.ts +3 -5
- package/src/docs/docs.test.ts +5 -5
- package/src/docs/mcp-guide.ts +4 -4
- package/src/index.ts +2 -2
- package/src/install/install-validate.test.ts +5 -5
- package/src/install/opts.ts +17 -0
- package/src/install/target-effective.ts +8 -8
- package/src/install/target-scope.ts +11 -8
- package/src/install/targets/configure.ts +1 -1
- package/src/install/targets.test.ts +4 -4
- package/src/invoke.test.ts +1 -1
- package/src/mcp/tools.ts +1 -1
- package/src/mcp.integration.test.ts +4 -4
- package/src/parse.test.ts +11 -13
- package/src/schema.ts +1 -9
- package/src/skill/hint.ts +2 -2
- package/src/types.ts +22 -14
- package/src/validate.ts +17 -17
- package/docs/install.md +0 -206
- package/src/builtins/install.ts +0 -106
- package/src/builtins/uninstall.ts +0 -80
- package/src/install/index.ts +0 -409
- package/src/install/install.test.ts +0 -317
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [5.0.1] - 2026-07-04
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [5.0.0] - 2026-07-03
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Top-level `configure` built-in** — interactive per-target wizard (TTY required); non-interactive `--sync --yes` (replaces `install --reinstall`), `--remove-all --yes`, `--remove-config --yes`, and `--status`.
|
|
18
|
+
- **`configure --remove-config --yes`** — config-only removal without touching skills/MCP.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Breaking: `install` and `uninstall` removed** — use `configure` and its flags; no redirects or deprecated aliases.
|
|
23
|
+
- **Breaking: `program.install` → `program.configure`** — `CliConfigureConfig`, `CliConfigureTargets`, `caps.configure`.
|
|
24
|
+
- **Breaking: `completion` hidden** from help and exported schema; still callable for Homebrew `generate_completions_from_executable`.
|
|
25
|
+
- **Breaking: skill install hint** — `Generated by … configure` (was `install --skill`).
|
|
26
|
+
- **Formula `post_install`** — `configure --sync --yes` (was `install --reinstall --yes`).
|
|
27
|
+
- **Just recipes** — `sync-artifacts`, `configure --remove-all --yes`, `configure --remove-config --yes`.
|
|
28
|
+
- **Docs** — `docs/install.md` replaced by [docs/configure.md](docs/configure.md).
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- Top-level **`install`** and **`uninstall`** commands and all scoped install/uninstall flags (`--all`, `--skill`, `--mcp`, `--reinstall`, …).
|
|
33
|
+
|
|
10
34
|
## [4.1.1] - 2026-07-03
|
|
11
35
|
|
|
12
36
|
### Added
|
|
@@ -543,7 +567,9 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
|
|
|
543
567
|
- Migrate schemas: rename every `children` property to **`commands`**; move positional definitions to **`CliPositional`** objects on `positionals` and strip `positional` / `argMin` / `argMax` from flag definitions under `options` (flags only carry `name`, `description`, `kind`, and optional `shortName`).
|
|
544
568
|
- Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
|
|
545
569
|
|
|
546
|
-
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/
|
|
570
|
+
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v5.0.1...HEAD
|
|
571
|
+
[5.0.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.0.1
|
|
572
|
+
[5.0.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v5.0.0
|
|
547
573
|
[4.1.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v4.1.1
|
|
548
574
|
[4.1.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v4.1.0
|
|
549
575
|
[4.0.4]: https://github.com/bdombro/bun-argsbarg/releases/tag/v4.0.4
|
package/README.md
CHANGED
|
@@ -98,9 +98,9 @@ Every app gets:
|
|
|
98
98
|
- `version` — print `CliProgram.version` (`myapp version`).
|
|
99
99
|
- `mcp` — when `mcpServer.enabled` is `true`, run as an MCP stdio server (`myapp mcp`).
|
|
100
100
|
- `docs` — when `docs.enabled` is `true`, print bundled markdown topics, schema JSON, API markdown, and generated skill content (`myapp docs`, `myapp docs readme`, `myapp docs schema`, `myapp docs api`, `myapp docs skill`, …). See [docs/bundled-docs.md](docs/bundled-docs.md).
|
|
101
|
-
- `
|
|
101
|
+
- `configure` — manage agent skills, MCP config, and app config (`myapp configure --sync --yes` after Homebrew install). See [docs/configure.md](docs/configure.md).
|
|
102
102
|
|
|
103
|
-
Do not declare a top-level command named `completion`, `version`, or `
|
|
103
|
+
Do not declare a top-level command named `completion`, `version`, or `configure` — they are reserved.
|
|
104
104
|
When `mcpServer.enabled` is `true`, do not declare a top-level command named `mcp` — it is reserved for the MCP built-in.
|
|
105
105
|
When `docs.enabled` is `true`, do not declare a top-level command named `docs` — it is reserved for the docs built-in.
|
|
106
106
|
|
|
@@ -110,17 +110,17 @@ Opt in on the program root with `mcpServer: { enabled: true }`, then run `myapp
|
|
|
110
110
|
|
|
111
111
|
See **[docs/mcp.md](docs/mcp.md)** for configuration, env bootstrapping, custom resources, Cursor setup, and protocol details. See **[docs/cli-program.md](docs/cli-program.md)** for schema authoring (consumer apps: run `bunx argsbarg create` or refresh with `bun scripts/merge-cli-program-rule.ts .` from the argsbarg package).
|
|
112
112
|
|
|
113
|
-
###
|
|
113
|
+
### Configure CLI
|
|
114
114
|
|
|
115
115
|
Ship via **Homebrew** (tap-from-repo). The formula installs the binary and shell completions; `post_install` runs agent artifact refresh:
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
118
|
brew tap <org>/<repo>
|
|
119
119
|
brew install <tap>/myapp
|
|
120
|
-
myapp
|
|
120
|
+
myapp configure # interactive per-target setup; opt-in app config wizard
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
See **[docs/distribution-homebrew.md](docs/distribution-homebrew.md)** for formula patterns and `bunx argsbarg create`. See **[docs/
|
|
123
|
+
See **[docs/distribution-homebrew.md](docs/distribution-homebrew.md)** for formula patterns and `bunx argsbarg create`. See **[docs/configure.md](docs/configure.md)** for `configure`, `--sync`, `--remove-all`, and `--status`.
|
|
124
124
|
|
|
125
125
|
### Shell completions
|
|
126
126
|
|
package/docs/README.md
CHANGED
|
@@ -8,11 +8,11 @@ Start here to pick the right guide.
|
|
|
8
8
|
| **Authoring a `CliProgram`** (humans or agents) | [cli-program.md](cli-program.md) — schema, formats, headless, `read*Flags` |
|
|
9
9
|
| **JSON stdout / `outputSchema`** | [output-schema.md](output-schema.md) — codegen pipeline, JSDoc, narrowing |
|
|
10
10
|
| **App config / `program.appConfig`** | [config-schema.md](config-schema.md) — flat JSON file, `ctx.appConfig`, codegen |
|
|
11
|
-
| **Exposing MCP tools** | [mcp.md](mcp.md) — stdio server, `inputSchema`, varargs, `
|
|
12
|
-
| **Shipping
|
|
11
|
+
| **Exposing MCP tools** | [mcp.md](mcp.md) — stdio server, `inputSchema`, varargs, `configure --sync` |
|
|
12
|
+
| **Shipping configure / agent artifacts** | [configure.md](configure.md) — Homebrew + `myapp configure --sync` |
|
|
13
13
|
| **Homebrew tap-from-repo distribution** | [distribution-homebrew.md](distribution-homebrew.md) — formula pattern, `argsbarg create` |
|
|
14
14
|
| **Bundling `myapp docs` topics** | [bundled-docs.md](bundled-docs.md) — consumer docgen vs framework docs |
|
|
15
|
-
| **Agent skills** | [ai-skills.md](ai-skills.md) — `
|
|
15
|
+
| **Agent skills** | [ai-skills.md](ai-skills.md) — `configure`, `docs skill` |
|
|
16
16
|
| **Maintaining the argsbarg repo** | [developing.md](developing.md) — release, consumers, npm `files` |
|
|
17
17
|
| **Cursor / IDE agents in a consumer app** | `bunx argsbarg create` (includes rule) or `bun scripts/merge-cli-program-rule.ts .` from argsbarg checkout |
|
|
18
18
|
| **Runnable examples** (shipped in npm) | [examples/](examples/) — see table below |
|
package/docs/ai-skills.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
ArgsBarg can generate Cursor and Claude Code skill directories (`SKILL.md` + `reference.md`) from your CLI schema.
|
|
4
4
|
|
|
5
|
-
## Install via `
|
|
5
|
+
## Install via `configure` (recommended)
|
|
6
6
|
|
|
7
7
|
Install skills to the user environment:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
myapp
|
|
11
|
-
# or
|
|
12
|
-
myapp
|
|
10
|
+
myapp configure --sync --yes
|
|
11
|
+
# or interactive (accept skill targets when prompted):
|
|
12
|
+
myapp configure
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Skills are written when the agent home or CLI exists:
|
|
@@ -37,7 +37,7 @@ For library use, call `cliSkillInstall(root, "cursor" | "claude", { global: true
|
|
|
37
37
|
- **`SKILL.md`** — YAML frontmatter, compact command index, pitfalls, and a pointer to `reference.md`
|
|
38
38
|
- **`reference.md`** — full `docs api` markdown reference
|
|
39
39
|
|
|
40
|
-
Installed files include an HTML comment hint (`Generated by myapp
|
|
40
|
+
Installed files include an HTML comment hint (`Generated by myapp configure; do not edit.`) after SKILL.md frontmatter and at the top of `reference.md`.
|
|
41
41
|
|
|
42
42
|
Skills describe **shell invocation only** — no MCP setup, `mcp.json`, or `tools/call` guidance. Use **`myapp docs mcp`** (when `docs` and `mcpServer` are enabled) or connect the MCP server for agent execution.
|
|
43
43
|
|
|
@@ -46,15 +46,15 @@ Skills describe **shell invocation only** — no MCP setup, `mcp.json`, or `tool
|
|
|
46
46
|
| Mechanism | Role |
|
|
47
47
|
| --- | --- |
|
|
48
48
|
| **`myapp mcp`** (requires `mcpServer`) | Runtime tool execution over MCP |
|
|
49
|
-
| **`myapp
|
|
49
|
+
| **`myapp configure`** (skill targets) | Persists optimized skill bundle (`SKILL.md` index + `reference.md` full API) |
|
|
50
50
|
| **`myapp docs`** (requires `docs`) | Bundled markdown on stdout (`docs mcp` when MCP enabled) |
|
|
51
51
|
|
|
52
|
-
`SKILL.md` is the routing index; `reference.md` matches `docs api`. Prefer `
|
|
52
|
+
`SKILL.md` is the routing index; `reference.md` matches `docs api`. Prefer `configure` over `docs skill` for agents. See [cli-program.md](cli-program.md).
|
|
53
53
|
|
|
54
|
-
**Claude Code plugin** (`mcpServer.claudePlugin: true` → `mcp bundle` writes `dist/claude-plugin/<name>.zip`) ships a separate MCP pointer skill (`SKILL.md` only) that routes agents to the bundled MCP server. This is a **dist artifact**, not installed via `
|
|
54
|
+
**Claude Code plugin** (`mcpServer.claudePlugin: true` → `mcp bundle` writes `dist/claude-plugin/<name>.zip`) ships a separate MCP pointer skill (`SKILL.md` only) that routes agents to the bundled MCP server. This is a **dist artifact**, not installed via `configure`. Use **`configure`** for persisted shell-oriented skills.
|
|
55
55
|
|
|
56
56
|
See also:
|
|
57
57
|
|
|
58
58
|
- [Bundled docs](bundled-docs.md) — `docs` config and compile-time imports
|
|
59
59
|
- [MCP server](mcp.md) — `mcpServer` config and `mcp` protocol
|
|
60
|
-
- [
|
|
60
|
+
- [Configure](configure.md) — app, completions, skills, and MCP config
|
package/docs/bundled-docs.md
CHANGED
|
@@ -50,7 +50,7 @@ myapp docs readme --save # write ./docs/readme.md
|
|
|
50
50
|
myapp docs schema --save # write ./docs/schema.json
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
When `docs` is enabled, top-level `myapp --help` points agents at `myapp docs skill`. The `docs skill` subcommand description recommends `
|
|
53
|
+
When `docs` is enabled, top-level `myapp --help` points agents at `myapp docs skill`. The `docs skill` subcommand description recommends `configure` for a persisted bundle.
|
|
54
54
|
|
|
55
55
|
## Configuration
|
|
56
56
|
|
|
@@ -83,11 +83,11 @@ When `docs.enabled` is `true`:
|
|
|
83
83
|
|
|
84
84
|
- **`docs schema`** — same JSON as the former root `--schema` flag (handlers omitted; built-in subtrees included for leaf roots).
|
|
85
85
|
- **`docs api`** — markdown rendering of the same command tree (options, positionals, subcommands, fallback routing).
|
|
86
|
-
- **`docs skill`** — prints the compact `SKILL.md` index. Prefer `
|
|
86
|
+
- **`docs skill`** — prints the compact `SKILL.md` index. Prefer `configure --sync --yes` for agents (persists index + full API in `reference.md`).
|
|
87
87
|
|
|
88
88
|
## MCP guide (`docs mcp`)
|
|
89
89
|
|
|
90
|
-
When both `docs.enabled` and `mcpServer.enabled` are `true`, ArgsBarg injects a **`docs mcp`** topic with an auto-generated guide: tool list, `program.appConfig`, schema resource URI, `
|
|
90
|
+
When both `docs.enabled` and `mcpServer.enabled` are `true`, ArgsBarg injects a **`docs mcp`** topic with an auto-generated guide: tool list, `program.appConfig`, schema resource URI, `configure --sync`, and protocol notes.
|
|
91
91
|
|
|
92
92
|
There is no override API in v1 — customize behavior via `mcpTool.description` on leaf commands.
|
|
93
93
|
|
|
@@ -99,7 +99,7 @@ All `docs` subcommands are hidden from MCP `tools/list` (`mcpTool: { enabled: fa
|
|
|
99
99
|
|
|
100
100
|
| Channel | Role |
|
|
101
101
|
| --- | --- |
|
|
102
|
-
| `
|
|
102
|
+
| `configure` (skill targets) | Writes compact `SKILL.md` + full-API `reference.md` to disk |
|
|
103
103
|
| `docs skill` | Print generated `SKILL.md` to stdout |
|
|
104
104
|
| `docs api` | Print command tree markdown to stdout |
|
|
105
105
|
| `docs schema` | Print command tree JSON to stdout |
|
package/docs/cli-program.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
ArgsBarg turns your schema into help, shell completions, MCP tools, and agent skills. **The same `description` fields you write for humans are the agent contract** for basic apps.
|
|
4
4
|
|
|
5
|
-
**Documentation map:** [docs/README.md](README.md) — which guide to read for MCP,
|
|
5
|
+
**Documentation map:** [docs/README.md](README.md) — which guide to read for MCP, configure, consumer docgen, and Cursor setup.
|
|
6
6
|
|
|
7
7
|
## Minimal app (MCP is free)
|
|
8
8
|
|
|
@@ -413,7 +413,7 @@ await cli.run();
|
|
|
413
413
|
| Field | Default | Purpose |
|
|
414
414
|
| --- | --- | --- |
|
|
415
415
|
| `description` | *(required)* | Shown in prompts, `config get`, and bundle manifests |
|
|
416
|
-
| `title` | config key | Short label in `
|
|
416
|
+
| `title` | config key | Short label in interactive `configure` |
|
|
417
417
|
| `default` | — | Used when `jsonSchema` omitted (all-string mode) |
|
|
418
418
|
| `required` | `true` | When `false`, optional unless required by `jsonSchema` |
|
|
419
419
|
| `sensitive` | name heuristic (`token`, `secret`, …) | Redact in prompts, `config get`, and status |
|
|
@@ -427,16 +427,16 @@ await cli.run();
|
|
|
427
427
|
- **Strict:** unknown keys rejected on load.
|
|
428
428
|
- **CLI:** missing required config exits 1 before the leaf handler (TTY prompt when interactive). Built-in `docs` and `config get`/`set` skip this exit.
|
|
429
429
|
- **MCP:** server stays up; missing config returns `isError: true` at `tools/call`.
|
|
430
|
-
- **Configure:**
|
|
431
|
-
- **Agent integration:** `
|
|
430
|
+
- **Configure:** interactive `configure` runs the app config wizard; **`configure --sync`** refreshes agent artifacts.
|
|
431
|
+
- **Agent integration:** `configure.agentIntegration` (`mcp` | `skill` | `both`) sets default sync targets; see [configure.md](configure.md#configuretargets).
|
|
432
432
|
|
|
433
|
-
See [config-schema.md](config-schema.md) for codegen, [
|
|
433
|
+
See [config-schema.md](config-schema.md) for codegen, [configure.md](configure.md) (`configure.targets`), and [mcp.md](mcp.md).
|
|
434
434
|
|
|
435
435
|
**Handler access (`ctx.appConfig`):** `get`, `require`, `set`, `read`, `path`, `dir` — prefer over `process.env` in handlers; env export remains for subprocess inheritance. `path` is the resolved absolute config file path (`~/.local/lib/<key>/config`); `dir` is its parent directory.
|
|
436
436
|
|
|
437
437
|
## Reserved names
|
|
438
438
|
|
|
439
|
-
Do not declare user commands named `completion`, `
|
|
439
|
+
Do not declare user commands named `completion`, `configure`, `mcp`, `version`, `docs`, or `config` at the root — ArgsBarg injects these when configured.
|
|
440
440
|
|
|
441
441
|
## Cursor rule for consumer repos
|
|
442
442
|
|
|
@@ -467,7 +467,7 @@ If you maintain argsbarg from a sibling checkout, `just consumer-dev` / `just co
|
|
|
467
467
|
|
|
468
468
|
3. **Optional:** a separate rule (e.g. `.cursor/argsbarg.mdc` or `AGENTS.md`) for broader package API notes.
|
|
469
469
|
|
|
470
|
-
**Not this file:** `myapp
|
|
470
|
+
**Not this file:** `myapp configure` writes the **app** skill (`SKILL.md` under `~/.cursor/skills/`) from your command schema — how to *invoke* the CLI. The rule above is for *authoring* argsbarg schema.
|
|
471
471
|
|
|
472
472
|
## See also
|
|
473
473
|
|
|
@@ -475,5 +475,5 @@ If you maintain argsbarg from a sibling checkout, `just consumer-dev` / `just co
|
|
|
475
475
|
- [Output schemas](output-schema.md) — codegen pipeline for leaf `outputSchema`
|
|
476
476
|
- [Developing argsbarg](developing.md) — release, consumer sync, npm `files`
|
|
477
477
|
- [MCP server](mcp.md) — tools, schema resource, env bootstrapping
|
|
478
|
-
- [Agent skills](ai-skills.md) — `
|
|
478
|
+
- [Agent skills](ai-skills.md) — `configure`
|
|
479
479
|
- [Bundled docs](bundled-docs.md) — `docs` topics, consumer docgen vs framework docs
|
package/docs/config-schema.md
CHANGED
|
@@ -39,7 +39,7 @@ await cli.run();
|
|
|
39
39
|
| Where argsbarg uses it | Purpose |
|
|
40
40
|
| --- | --- |
|
|
41
41
|
| Config file | Flat JSON keyed by schema names; strict load (unknown keys rejected) |
|
|
42
|
-
| `
|
|
42
|
+
| Interactive `configure` / `--status` | Auto-runs config wizard when `entries` is non-empty; `--status` for read-only inventory |
|
|
43
43
|
| Built-in `config get` / `config set` | Read/write resolved values (opt-out via `commands: false`) |
|
|
44
44
|
| MCP bundle / Claude plugin | `userConfig` for entries with `env` set |
|
|
45
45
|
| `ctx.appConfig` in handlers | `get`, `require`, `set`, `read`, `path`, `dir` — prefer over `process.env` |
|
|
@@ -125,7 +125,7 @@ githubToken: {
|
|
|
125
125
|
},
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
`
|
|
128
|
+
Interactive `configure` does not persist values supplied only by env or `resolve` when you press Enter to accept the current value.
|
|
129
129
|
|
|
130
130
|
## Hand-written vs generated
|
|
131
131
|
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Configure command
|
|
2
|
+
|
|
3
|
+
The `configure` built-in manages **agent artifacts** (skills, MCP config, app config). The **binary and shell completions** ship via Homebrew — see [distribution-homebrew.md](distribution-homebrew.md).
|
|
4
|
+
|
|
5
|
+
Opt out with `configure: { enabled: false }` on the program root.
|
|
6
|
+
|
|
7
|
+
## End-user install (Homebrew)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
brew tap <org>/<repo>
|
|
11
|
+
brew install <tap>/<key>
|
|
12
|
+
<key> configure # interactive: per-target prompts; run when app config is required
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Upgrade with `brew upgrade <key>`. Shell completions are installed by Homebrew during `brew install`. Users must configure their shell per [Homebrew Shell Completion](https://docs.brew.sh/Shell-Completion).
|
|
16
|
+
|
|
17
|
+
**Uninstall the binary:** remove agent artifacts first (while the CLI is still on PATH), then `brew uninstall`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
<key> configure --remove-all --yes
|
|
21
|
+
brew uninstall <tap>/<key>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Developer install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
just build
|
|
28
|
+
just install-local # same formula as production; gen-dev-formula uses file:// URL (`just install` is an alias)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Dev flow matches release: formula `install` copies the binary and generates completions; `post_install` runs `<key> configure --sync --yes` for skills/MCP. Use `just reinstall-local` to swap the binary into Cellar during tight edit cycles (skips completions and `post_install`). Use `just sync-artifacts` to refresh agent artifacts without touching the binary.
|
|
32
|
+
|
|
33
|
+
## Quick reference
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Refresh skills/MCP after upgrade (Homebrew post_install runs this automatically)
|
|
37
|
+
<key> configure --sync --yes
|
|
38
|
+
|
|
39
|
+
# See what is installed
|
|
40
|
+
<key> configure --status
|
|
41
|
+
|
|
42
|
+
# Interactive per-target setup (default when run with a TTY)
|
|
43
|
+
<key> configure
|
|
44
|
+
|
|
45
|
+
# Remove all agent artifacts
|
|
46
|
+
<key> configure --remove-all --yes
|
|
47
|
+
|
|
48
|
+
# Remove app config only (not skills/MCP)
|
|
49
|
+
<key> configure --remove-config --yes
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Non-interactive / CI: pass **`--yes`** (or **`--json`**, **`--sync`**, **`--remove-all`**, **`--remove-config`**) — see [Confirmation](#confirmation).
|
|
53
|
+
|
|
54
|
+
## What gets configured
|
|
55
|
+
|
|
56
|
+
| Target | Interactive | Mechanism |
|
|
57
|
+
| --- | --- | --- |
|
|
58
|
+
| Binary | skipped (read-only) | Homebrew formula `bin.install` |
|
|
59
|
+
| Shell completions | skipped | Homebrew `generate_completions_from_executable` |
|
|
60
|
+
| Cursor skill | Y/n prompt | `~/.cursor/skills/<dir>/` when `~/.cursor` exists |
|
|
61
|
+
| Claude skill | Y/n prompt | `~/.claude/skills/<dir>/` when `~/.claude` exists |
|
|
62
|
+
| Codex / OpenCode / OpenClaw skills | Y/n prompt | Agent-specific dirs when available |
|
|
63
|
+
| MCP config | Y/n prompt | Cursor, Claude Code/Desktop, OpenCode, Codex, OpenClaw, ChatGPT desktop |
|
|
64
|
+
| App config | auto-runs wizard | Interactive wizard writes `~/.local/lib/<key>/config.json` |
|
|
65
|
+
|
|
66
|
+
### Externally managed binary (Homebrew)
|
|
67
|
+
|
|
68
|
+
When **`PATH`** resolves the program key to the **running executable** (e.g. after `brew install`):
|
|
69
|
+
|
|
70
|
+
- **`configure --status`** shows `app: system (PATH)`
|
|
71
|
+
- **`--sync`** refreshes skills and MCP only — not the binary or completions
|
|
72
|
+
|
|
73
|
+
MCP config uses the command name on **`PATH`**, not a Cellar path.
|
|
74
|
+
|
|
75
|
+
### Interactive default
|
|
76
|
+
|
|
77
|
+
Bare **`configure`** (TTY required) walks enabled install targets in order. For each target:
|
|
78
|
+
|
|
79
|
+
- **Not installed:** `[Y/n]` — default install; `n` skips.
|
|
80
|
+
- **Installed:** `[y/N]` — default keep; `n` uninstalls.
|
|
81
|
+
- **App config** (`program.appConfig` with entries): runs the config wizard automatically (no Y/n gate). Remove the config file with **`configure --remove-config --yes`**.
|
|
82
|
+
|
|
83
|
+
The **`app`** target (binary on PATH) is shown in `--status` only — never mutated by `configure`.
|
|
84
|
+
|
|
85
|
+
### `configure.targets`
|
|
86
|
+
|
|
87
|
+
Configure which artifacts participate in `--sync`:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
configure: {
|
|
91
|
+
agentIntegration: "mcp", // | "skill" | "both" — default from mcpServer.enabled
|
|
92
|
+
targets: {
|
|
93
|
+
chatgptMcp: false,
|
|
94
|
+
cursorSkill: { includedInAll: true },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`ConfigureTargetSpec` is `boolean` or `{ enabled?: boolean; includedInAll?: boolean }`.
|
|
100
|
+
|
|
101
|
+
Artifact keys: `chatgptMcp`, `claudeCodeMcp`, `claudeDesktopMcp`, `claudeSkill`, `codexMcp`, `codexSkill`, `configure`, `cursorMcp`, `cursorSkill`, `openclawMcp`, `openclawSkill`, `opencodeMcp`, `opencodeSkill`.
|
|
102
|
+
|
|
103
|
+
## App config (`program.appConfig`)
|
|
104
|
+
|
|
105
|
+
When `program.appConfig` is set, ArgsBarg manages a flat JSON config file at `~/.local/lib/<sanitized-key>/config.json`.
|
|
106
|
+
|
|
107
|
+
| Mode | Description |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| Interactive `configure` | Config wizard when you accept the configure target |
|
|
110
|
+
| `--status` | Shows config path and which required keys are set or missing |
|
|
111
|
+
| `--remove-config --yes` | Removes the config directory |
|
|
112
|
+
|
|
113
|
+
Export helpers from `argsbarg`: `resolveAppConfigPath`, `displayAppConfigPath`.
|
|
114
|
+
|
|
115
|
+
## Flags
|
|
116
|
+
|
|
117
|
+
### Operation flags
|
|
118
|
+
|
|
119
|
+
| Flag | Description |
|
|
120
|
+
| --- | --- |
|
|
121
|
+
| `--status` | Read-only inventory |
|
|
122
|
+
| `--sync` | Refresh installed agent artifacts (Homebrew `post_install`; greenfield → full sync plan) |
|
|
123
|
+
| `--remove-all` | Remove all detected agent artifacts |
|
|
124
|
+
| `--remove-config` | Remove app config directory only |
|
|
125
|
+
|
|
126
|
+
### Behavior flags
|
|
127
|
+
|
|
128
|
+
| Flag | Description |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| `--yes`, `-y` | Skip confirmation (required for non-interactive modes) |
|
|
131
|
+
| `--dry` | Preview changes |
|
|
132
|
+
| `--json` | Machine-readable output (implies `--yes`) |
|
|
133
|
+
|
|
134
|
+
## Confirmation
|
|
135
|
+
|
|
136
|
+
Interactive `configure` prints a **`{app} Setup`** banner and per-target prompts. Non-interactive modes (`--sync`, `--remove-all`, `--remove-config`) require **`--yes`** unless `--dry`.
|
|
137
|
+
|
|
138
|
+
## MCP merge behavior
|
|
139
|
+
|
|
140
|
+
When MCP targets are installed, entries are merged into host config with:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{ "command": "<root.key>", "args": ["mcp"] }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
If an existing entry differs, the command exits with an error unless `--yes` is passed.
|
|
147
|
+
|
|
148
|
+
## Formula `post_install`
|
|
149
|
+
|
|
150
|
+
Release formulae should run:
|
|
151
|
+
|
|
152
|
+
```ruby
|
|
153
|
+
def post_install
|
|
154
|
+
system bin/"myapp", "configure", "--sync", "--yes"
|
|
155
|
+
end
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This refreshes skills/MCP without running the configure wizard (app config is opt-in via interactive `configure`).
|
|
159
|
+
|
|
160
|
+
## Bootstrapping a new CLI
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
bunx argsbarg create my-cli --key my-cli --class-name MyCli --tap org/repo --yes
|
|
164
|
+
bunx argsbarg create --check .
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See [distribution-homebrew.md](distribution-homebrew.md) and [../examples/full-example/README.md](../examples/full-example/README.md).
|
|
168
|
+
|
|
169
|
+
## Opt out
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
configure: { enabled: false },
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Completion
|
|
176
|
+
|
|
177
|
+
The `completion` built-in remains callable for Homebrew `generate_completions_from_executable` but is **hidden** from help and exported schema.
|
package/docs/developing.md
CHANGED
|
@@ -41,7 +41,7 @@ Sibling repos under `../../ss/` (paths are machine-specific; adjust in `justfile
|
|
|
41
41
|
|
|
42
42
|
**Recommended in each consumer:** replace the template placeholder with `**<app> conventions:**` bullets (paths to `read*Flags`, shared flags, Ink vs JSON-only). Commit that file; merges refresh the shared top, not your footer.
|
|
43
43
|
|
|
44
|
-
**Consumer app skill** — `just install-local` in each consumer (part of `consumers-sync`) runs Homebrew dev install then `myapp
|
|
44
|
+
**Consumer app skill** — `just install-local` in each consumer (part of `consumers-sync`) runs Homebrew dev install then `myapp configure --sync --yes`, which updates `~/.cursor/skills/<app>/` from that app’s schema — not the argsbarg framework rule.
|
|
45
45
|
|
|
46
46
|
## npm package contents
|
|
47
47
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Shipping via Homebrew (tap-from-repo)
|
|
2
2
|
|
|
3
|
-
Argsbarg apps distribute the **binary and shell completions** through Homebrew, and **agent artifacts** (skills, MCP config) through `
|
|
3
|
+
Argsbarg apps distribute the **binary and shell completions** through Homebrew, and **agent artifacts** (skills, MCP config) through `configure --sync`.
|
|
4
4
|
|
|
5
5
|
## Distribution model
|
|
6
6
|
|
|
7
7
|
| Layer | Mechanism |
|
|
8
8
|
| --- | --- |
|
|
9
9
|
| Binary + completions | Formula `install` block |
|
|
10
|
-
| Skills + MCP | Formula `post_install` → `{key}
|
|
11
|
-
| App config | User opt-in: `{key}
|
|
10
|
+
| Skills + MCP | Formula `post_install` → `{key} configure --sync --yes` |
|
|
11
|
+
| App config | User opt-in: `{key} configure` (interactive; not run from formula `post_install`) |
|
|
12
12
|
|
|
13
13
|
**Only tap-from-repo** — in-repo `Formula/` or GitHub tap. Not Homebrew core.
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ Argsbarg apps distribute the **binary and shell completions** through Homebrew,
|
|
|
17
17
|
```bash
|
|
18
18
|
brew tap <org>/<repo>
|
|
19
19
|
brew install <tap>/{key}
|
|
20
|
-
{key}
|
|
20
|
+
{key} configure # when app config is required
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Developer install
|
|
@@ -36,12 +36,12 @@ Dev and release use the **same formula** (`Formula/{key}.rb`, class name, instal
|
|
|
36
36
|
| Recipe | Removes |
|
|
37
37
|
| --- | --- |
|
|
38
38
|
| `just uninstall` | Formula `{key}` + tap symlink + skills/MCP |
|
|
39
|
-
| `just uninstall-config` | App config file only (`
|
|
39
|
+
| `just uninstall-config` | App config file only (`configure --remove-config --yes`) |
|
|
40
40
|
| `just uninstall-release` | Release formula from `{tap}` (keeps tap) |
|
|
41
41
|
| `just uninstall-release-tap` | Release formula + `brew untap {tap}` |
|
|
42
42
|
| `just test-release` | Install release formula and run formula test |
|
|
43
43
|
|
|
44
|
-
End users: `<key>
|
|
44
|
+
End users: `<key> configure --remove-all --yes` then `brew uninstall <tap>/<key>`.
|
|
45
45
|
|
|
46
46
|
## Formula pattern
|
|
47
47
|
|
|
@@ -52,7 +52,7 @@ def install
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
def post_install
|
|
55
|
-
system bin/"{key}", "
|
|
55
|
+
system bin/"{key}", "configure", "--sync", "--yes"
|
|
56
56
|
end
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -90,10 +90,11 @@ Template source: [`examples/full-example/`](../examples/full-example/) in the ar
|
|
|
90
90
|
## Removed (breaking)
|
|
91
91
|
|
|
92
92
|
- Self-install to `~/.local/bin`
|
|
93
|
+
- Top-level `install` and `uninstall` commands (use `configure`)
|
|
93
94
|
- `install --update` / `updateGetLatest`
|
|
94
|
-
-
|
|
95
|
+
- Homebrew completion installer via CLI (Homebrew owns completions)
|
|
95
96
|
- Bare-argv install bootstrap
|
|
96
|
-
- Auto configure wizard after
|
|
97
|
+
- Auto configure wizard after sync
|
|
97
98
|
- Separate `{key}-local` formula and `{key}/dev` tap
|
|
98
99
|
|
|
99
100
|
## Config path
|
package/docs/mcp.md
CHANGED
|
@@ -61,11 +61,11 @@ Use your real binary or script path. For a compiled CLI, `command` can be the in
|
|
|
61
61
|
|
|
62
62
|
### Claude Code
|
|
63
63
|
|
|
64
|
-
`
|
|
64
|
+
`configure` (MCP targets) merges into `~/.claude.json` under `mcpServers`.
|
|
65
65
|
|
|
66
66
|
### Claude Desktop
|
|
67
67
|
|
|
68
|
-
`
|
|
68
|
+
`configure` (MCP targets) also merges into Claude Desktop config when app data is present:
|
|
69
69
|
|
|
70
70
|
| Platform | Path |
|
|
71
71
|
| --- | --- |
|
|
@@ -77,7 +77,7 @@ Restart Claude Desktop after config changes. You can also install a **`.mcpb`**
|
|
|
77
77
|
|
|
78
78
|
### OpenCode
|
|
79
79
|
|
|
80
|
-
When `~/.config/opencode` exists, **`
|
|
80
|
+
When `~/.config/opencode` exists, **`configure`** (MCP targets) merges a local server under the top-level **`mcp`** key (not `mcpServers`):
|
|
81
81
|
|
|
82
82
|
```json
|
|
83
83
|
{
|
|
@@ -96,7 +96,7 @@ OpenCode reads `opencode.jsonc`, `opencode.json`, or `config.json` in that direc
|
|
|
96
96
|
|
|
97
97
|
### OpenAI Codex
|
|
98
98
|
|
|
99
|
-
When **`codex`** is on PATH, **`
|
|
99
|
+
When **`codex`** is on PATH, **`configure`** (MCP targets) runs `codex mcp add <server> -- <binary> mcp`, which writes **`~/.codex/config.toml`**. Otherwise add manually:
|
|
100
100
|
|
|
101
101
|
```toml
|
|
102
102
|
[mcp_servers.myapp]
|
|
@@ -110,7 +110,7 @@ Use **`codex mcp`** to list/add/remove servers, or **Settings → MCP → Open c
|
|
|
110
110
|
|
|
111
111
|
**Web / Connectors (OpenAI’s documented path)** — **Settings → Connectors → Developer mode** with a **remote HTTPS MCP URL**. ChatGPT does not spawn local stdio binaries; bridge and tunnel local servers when needed.
|
|
112
112
|
|
|
113
|
-
**Desktop JSON (gated auto-install)** — when ChatGPT app data exists, **`
|
|
113
|
+
**Desktop JSON (gated auto-install)** — when ChatGPT app data exists, **`configure`** (MCP targets) also merges `mcpServers` into:
|
|
114
114
|
|
|
115
115
|
| Platform | Path |
|
|
116
116
|
| --- | --- |
|
|
@@ -254,7 +254,7 @@ When both **`docs.enabled`** and **`mcpServer.enabled`** are true, each user key
|
|
|
254
254
|
| MIME type | `text/markdown` |
|
|
255
255
|
| Contents | Same body as `myapp docs <topicKey>` |
|
|
256
256
|
|
|
257
|
-
Built-in docs subcommands (`schema`, `api`, `skill`, `mcp`) are **not** auto-exposed — use the schema resource, `
|
|
257
|
+
Built-in docs subcommands (`schema`, `api`, `skill`, `mcp`) are **not** auto-exposed — use the schema resource, `configure`, or CLI `docs` instead. `docs` subcommands remain hidden from MCP `tools/list`.
|
|
258
258
|
|
|
259
259
|
Custom `mcpServer.resources` URIs must not collide with the schema URI or any auto docs topic URI (validated at program compile time).
|
|
260
260
|
|
|
@@ -326,7 +326,7 @@ At server start (`Cli.serveMcp()`), before the NDJSON loop:
|
|
|
326
326
|
- JSON shape: flat object keyed by schema names — `{ "apiToken": "…" }`. Unknown keys rejected on load.
|
|
327
327
|
- Loaded at MCP startup; host `process.env` wins for mapped env vars already set.
|
|
328
328
|
- Missing required config does **not** exit the MCP server — enforced at `tools/call` with a helpful error.
|
|
329
|
-
- Configure interactively: `myapp
|
|
329
|
+
- Configure interactively: `myapp configure` (see [configure.md](configure.md)).
|
|
330
330
|
- Built-in `config get` / `config set` when `program.appConfig.commands` is enabled (default). Hosts inject `user_config` → env at spawn; they never write the argsbarg config file.
|
|
331
331
|
|
|
332
332
|
Example:
|
|
@@ -411,11 +411,11 @@ skills/<dirName>/SKILL.md
|
|
|
411
411
|
|
|
412
412
|
`plugin.json` references `.mcp.json` so Claude Desktop and Claude Code load the bundled MCP server when the plugin is enabled. The plugin zip preserves the executable bit on `bin/<key>`.
|
|
413
413
|
|
|
414
|
-
The bundled `SKILL.md` is an **MCP routing stub** — it tells Claude to use the plugin’s MCP toolset (server id, `tools/list`, schema resource). It is not a shell CLI catalog and does not include `reference.md`. Use **`
|
|
414
|
+
The bundled `SKILL.md` is an **MCP routing stub** — it tells Claude to use the plugin’s MCP toolset (server id, `tools/list`, schema resource). It is not a shell CLI catalog and does not include `reference.md`. Use **`configure`** for a persisted shell-oriented skill bundle.
|
|
415
415
|
|
|
416
416
|
Load locally with `claude --plugin-dir ./dist/claude-plugin/myapp.zip`.
|
|
417
417
|
|
|
418
|
-
Bare **`myapp mcp`** still runs the stdio MCP server (unchanged for `
|
|
418
|
+
Bare **`myapp mcp`** still runs the stdio MCP server (unchanged for `configure` MCP targets and MCP hosts). Use **`configure --sync --yes`** for Cursor, Claude Code, Claude Desktop, and OpenCode JSON config.
|
|
419
419
|
|
|
420
420
|
## Hidden commands and options
|
|
421
421
|
|
|
@@ -29,11 +29,11 @@ Non-interactive:
|
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
bunx argsbarg create my-cli \
|
|
32
|
-
--key my-cli --
|
|
33
|
-
--homepage https://github.com/org/my-cli --release-repo org/my-cli \
|
|
34
|
-
--yes
|
|
32
|
+
--key my-cli --release-repo org/my-cli --yes
|
|
35
33
|
```
|
|
36
34
|
|
|
35
|
+
Edit `scripts/create-identity.ts` to set `desc` (used by `program.description` and the Homebrew formula).
|
|
36
|
+
|
|
37
37
|
`create` copies this template (including `.cursor/rules/cli-program.mdc`), substitutes identity placeholders, runs `bun install`, schemagen, `bun test`, and `git init` + Initial commit when appropriate.
|
|
38
38
|
|
|
39
39
|
**Git bootstrap:** skipped when `{target}/.git` already exists, or when the target is inside an existing git work tree (monorepo subfolder). Standalone new directories get `Initial commit`.
|
|
@@ -46,8 +46,8 @@ format:
|
|
|
46
46
|
install: install-local
|
|
47
47
|
|
|
48
48
|
# Refresh skills and MCP without reinstalling the formula
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
sync-artifacts:
|
|
50
|
+
just run configure --sync --yes
|
|
51
51
|
|
|
52
52
|
# Dev install: build, write dev formula, symlink tap, brew install
|
|
53
53
|
install-local: build
|
|
@@ -57,14 +57,14 @@ install-local: build
|
|
|
57
57
|
ln -sfn '{{justfile_directory()}}' {{tap_path}}
|
|
58
58
|
brew install --formula {{tap}}/{{cli_key}}
|
|
59
59
|
@echo ""
|
|
60
|
-
@echo "Next: {{cli_key}}
|
|
60
|
+
@echo "Next: {{cli_key}} configure"
|
|
61
61
|
|
|
62
62
|
# Remove local dev install, then install from GitHub tap
|
|
63
63
|
install-production: uninstall
|
|
64
64
|
brew tap {{tap}}
|
|
65
65
|
brew install --formula {{tap}}/{{cli_key}}
|
|
66
66
|
@echo ""
|
|
67
|
-
@echo "Next: {{cli_key}}
|
|
67
|
+
@echo "Next: {{cli_key}} configure"
|
|
68
68
|
|
|
69
69
|
# Alias for backward compatibility
|
|
70
70
|
reinstall: reinstall-local
|
|
@@ -112,11 +112,11 @@ uninstall: uninstall-artifacts uninstall-formula
|
|
|
112
112
|
|
|
113
113
|
# Remove agent artifacts only (skills, MCP)
|
|
114
114
|
uninstall-artifacts:
|
|
115
|
-
|
|
115
|
+
just run configure --remove-all --yes
|
|
116
116
|
|
|
117
117
|
# Remove app config file only
|
|
118
118
|
uninstall-config:
|
|
119
|
-
|
|
119
|
+
just run configure --remove-config --yes
|
|
120
120
|
|
|
121
121
|
# Remove formula and untap
|
|
122
122
|
uninstall-formula:
|
|
@@ -11,12 +11,12 @@ export const formulaInstallRuby = `def install
|
|
|
11
11
|
end`;
|
|
12
12
|
|
|
13
13
|
export const formulaPostInstallRuby = `def post_install
|
|
14
|
-
system bin/"${key}", "
|
|
14
|
+
system bin/"${key}", "configure", "--sync", "--yes"
|
|
15
15
|
end`;
|
|
16
16
|
|
|
17
17
|
export const formulaCaveatsRuby = `def caveats
|
|
18
18
|
<<~EOS
|
|
19
|
-
Run \`${key}
|
|
19
|
+
Run \`${key} configure\` to set up agent artifacts and app config (interactive).
|
|
20
20
|
EOS
|
|
21
21
|
end`;
|
|
22
22
|
|