argsbarg 6.2.0 → 6.2.2

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 CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.2.2] - 2026-08-07
11
+
12
+ ### Changed
13
+
14
+ - **Agent instructions (`AGENTS.md`)** — replace `.cursor/rules/*.mdc` with inlined `AGENTS.md` + `CLAUDE.md` (`@AGENTS.md`) in copy templates and consumer sync. `scripts/merge-agents-md.ts` replaces `merge-cli-program-rule.ts` and `merge-code-rule.ts`. Argsbarg maintainer repo uses root `AGENTS.md`.
15
+
16
+ ## [6.2.1] - 2026-08-07
17
+
18
+ Chore
19
+
10
20
  ## [6.2.0] - 2026-07-30
11
21
 
12
22
  ### Changed
@@ -893,7 +903,9 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
893
903
  - 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`).
894
904
  - Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
895
905
 
896
- [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v6.2.0...HEAD
906
+ [Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v6.2.2...HEAD
907
+ [6.2.2]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.2
908
+ [6.2.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.1
897
909
  [6.2.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.2.0
898
910
  [6.1.10]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.1.10
899
911
  [6.1.9]: https://github.com/bdombro/bun-argsbarg/releases/tag/v6.1.9
package/README.md CHANGED
@@ -133,7 +133,7 @@ Edit `scripts/create-identity.ts` in the new repository to set your description.
133
133
  | Package import | `from "argsbarg"` (not relative to argsbarg `src/`) |
134
134
  | Homebrew distribution | `scripts/formula-shared.ts`, `scripts/dev-formula.ts`, `Formula/`, `justfile` |
135
135
  | Dev tooling | Biome (`just format` / `just lint`), TypeScript, colocated tests |
136
- | Cursor rules | `.cursor/rules/cli-program.mdc`, `.cursor/rules/code.mdc` |
136
+ | Agent instructions | `AGENTS.md`, `CLAUDE.md` (`@AGENTS.md`) |
137
137
 
138
138
  *Tip: Verify an existing tree or template setup with `bunx argsbarg create --check .`*
139
139
 
@@ -321,17 +321,17 @@ bunx argsbarg create my-api \
321
321
 
322
322
  Edit `scripts/create-identity.ts` in the new repo to set `desc` (used by `program.description` and the Homebrew formula).
323
323
 
324
- `create` copies the template (including `.cursor/rules/cli-program.mdc`), substitutes `{key}` / `{tap}` / `{releaseRepo}` placeholders, runs `bun install`, `argsbarg schemagen` (json template only), `bun test`, and `git init` + Initial commit when appropriate.
324
+ `create` copies the template (including `AGENTS.md` and `CLAUDE.md`), substitutes `{key}` / `{tap}` / `{releaseRepo}` placeholders, runs `bun install`, `argsbarg schemagen` (json template only), `bun test`, and `git init` + Initial commit when appropriate.
325
325
 
326
326
  **Git bootstrap:** skipped when the target already has a `.git` directory, or when the target sits inside an existing git work tree (monorepo subfolder). Standalone new directories get an `Initial commit`.
327
327
 
328
328
  Verify an existing tree: `bunx argsbarg create --check .`
329
329
 
330
- To refresh Cursor rules in an existing consumer: `bun scripts/merge-cli-program-rule.ts .` and `bun scripts/merge-code-rule.ts .` from an argsbarg checkout (or pass the npm package path to the template).
330
+ To refresh agent instructions in an existing consumer: `bun scripts/merge-agents-md.ts .` from an argsbarg checkout (or pass the npm package path to the template).
331
331
 
332
332
  ### What the copy templates include
333
333
 
334
- Both templates ship all builtins (`completion`, `version`, `configure`, `docs`, `mcp`, `http`), Homebrew `justfile` + formula scripts, and `.cursor/rules/`.
334
+ Both templates ship all builtins (`completion`, `version`, `configure`, `docs`, `mcp`, `http`), Homebrew `justfile` + formula scripts, and `AGENTS.md` + `CLAUDE.md`.
335
335
 
336
336
  | Template | Path | Adds beyond builtins |
337
337
  | --- | --- | --- |
@@ -373,17 +373,15 @@ Opt in by setting `mcpServer: { enabled: true }` on your program root. Running `
373
373
 
374
374
  See **[docs/mcp.md](docs/mcp.md)** for configuration, env bootstrapping, custom resources, Cursor/Claude setup, and protocol details.
375
375
 
376
- ### 2. IDE Copilot Rules (Cursor / Claude Code)
376
+ ### 2. Agent instructions (`AGENTS.md`)
377
377
 
378
- ArgsBarg ships authoring docs under `node_modules/argsbarg/docs/`. Because AI agents do not automatically read inside `node_modules/`, you can copy a thin custom rule into your project:
378
+ ArgsBarg ships authoring docs under `node_modules/argsbarg/docs/`. Because AI agents do not automatically read inside `node_modules/`, each copy template includes an `AGENTS.md` with inlined argsbarg authoring rules and a `CLAUDE.md` bridge (`@AGENTS.md`).
379
379
 
380
380
  ```bash
381
- mkdir -p .cursor/rules
382
- bun scripts/merge-cli-program-rule.ts . \
383
- node_modules/argsbarg/examples/full-example/.cursor/rules/cli-program.mdc
381
+ bun scripts/merge-agents-md.ts .
384
382
  ```
385
383
 
386
- This acts as a "tripwire" that instructs AI agents in your workspace to read ArgsBarg's framework documentation before modifying your command definitions or schemas. See the **Cursor rule** section in [docs/cli-program.md](docs/cli-program.md).
384
+ This refreshes the argsbarg-managed section in `AGENTS.md` while preserving your app-specific prefix and `**<app> conventions:**` footer. See **Agent instructions** in [docs/cli-program.md](docs/cli-program.md).
387
385
 
388
386
  ### 3. Generated Skills & Workspace Configuration
389
387
 
package/docs/README.md CHANGED
@@ -17,7 +17,7 @@ Start here to pick the right guide.
17
17
  | **Bundling `myapp docs` topics** | [bundled-docs.md](bundled-docs.md) — consumer docgen vs framework docs |
18
18
  | **Agent skills** | [ai-skills.md](ai-skills.md) — `configure`, `docs skill` |
19
19
  | **Maintaining the argsbarg repo** | [developing.md](developing.md) — release, consumers, npm `files` |
20
- | **Cursor / IDE agents in a consumer app** | `bunx argsbarg create` (includes rule) or `bun scripts/merge-cli-program-rule.ts .` from argsbarg checkout |
20
+ | **IDE agents in a consumer app** | `bunx argsbarg create` (includes `AGENTS.md`) or `bun scripts/merge-agents-md.ts .` from argsbarg checkout |
21
21
  | **Runnable examples** (shipped in npm) | [examples/](examples/) — see table below |
22
22
 
23
23
  ## Examples (agents: read these)
@@ -36,6 +36,6 @@ Examples are included in the npm tarball (`package.json` `files`). After `bun ad
36
36
  | --- | --- | --- |
37
37
  | **Framework docs** | How argsbarg works; authoring conventions | This directory — shipped in `node_modules/argsbarg/docs/` after `bun add argsbarg` |
38
38
  | **Consumer docgen** | *Your* command tree, API, MCP guide for *your* app | `myapp docs cli`, `docs cli-schema`, `docs mcp` — written to `./docs/` with `--save` |
39
- | **Cursor rule** | Thin tripwire telling agents to read framework docs | `node_modules/argsbarg/examples/full-example-json/.cursor/rules/cli-program.mdc` — merge default for consumers; `create` includes a template copy |
39
+ | **Agent instructions** | Inlined argsbarg authoring rules in `AGENTS.md` | `node_modules/argsbarg/examples/full-example-json/AGENTS.md` — merge default for consumers; `create` includes a template copy |
40
40
 
41
- Agents do **not** load `node_modules/argsbarg/docs/` unless your repo references them (Cursor rule, `AGENTS.md`, or an `alwaysApply` project rule). Generated `./docs/cli.md` in a consumer repo describes **your** CLI, not argsbarg itself.
41
+ Agents do **not** load `node_modules/argsbarg/docs/` unless your repo references them (`AGENTS.md`, or an always-on project rule). Generated `./docs/cli.md` in a consumer repo describes **your** CLI, not argsbarg itself.
package/docs/ai-skills.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > This feature is experimental.
4
4
 
5
- ArgsBarg can generate agent skill directories (`skill.md` + `reference.md`) from your CLI schema and install them to `~/.agents/skills/<key>/` per the [.agents protocol](https://dotagentsprotocol.com/).
5
+ ArgsBarg can generate agent skill directories (`skill.md` + `reference.md`) from your CLI schema and install them to `~/.agents/skills/<key>/` per the open standard at https://dotagentsprotocol.com/.
6
6
 
7
7
  ## Enable on the program root
8
8
 
@@ -36,7 +36,7 @@ import { cliSkillInstall } from "argsbarg/skill/install"; // internal module
36
36
 
37
37
  ## Generated content
38
38
 
39
- - **`skill.md`** — [.agents protocol](https://dotagentsprotocol.com/) frontmatter (`id`, `name`, `description`, `enabled`), compact command index, pitfalls, client setup, and a pointer to `reference.md`
39
+ - **`skill.md`** — https://dotagentsprotocol.com frontmatter (`id`, `name`, `description`, `enabled`), compact command index, pitfalls, client setup, and a pointer to `reference.md`
40
40
  - **`SKILL.md`** — compatibility copy of `skill.md` for tools that expect uppercase filenames
41
41
  - **`reference.md`** — full `docs cli` markdown reference
42
42
 
@@ -8,7 +8,7 @@ Two documentation layers often coexist in a consumer repo:
8
8
 
9
9
  | Layer | Contents | How agents/humans get it |
10
10
  | --- | --- | --- |
11
- | **Argsbarg framework** | How to author `CliProgram`, MCP varargs policy, headless patterns | `node_modules/argsbarg/docs/` — wire via [full-example Cursor rule](../examples/full-example/.cursor/rules/cli-program.mdc) or `AGENTS.md` |
11
+ | **Argsbarg framework** | How to author `CliProgram`, MCP varargs policy, headless patterns | `node_modules/argsbarg/docs/` — wired via consumer [`AGENTS.md`](../examples/full-example-json/AGENTS.md) |
12
12
  | **Your CLI (docgen)** | Your command tree, options, MCP tool list, install notes | `myapp docs cli`, `docs cli-schema`, `docs mcp` — save with `--save` to `./docs/` |
13
13
 
14
14
  `docs cli` and `docs cli-schema` embed each leaf’s `outputSchema` when set — see [output-schema.md](output-schema.md) for how to generate and wire schemas.
@@ -541,7 +541,7 @@ await cli.run();
541
541
  - **Strict:** unknown keys rejected on load.
542
542
  - **CLI:** missing required config exits 1 before the leaf handler (TTY prompt when interactive). Built-in `docs` and `configure get`/`set` skip this exit.
543
543
  - **MCP:** server stays up; missing config returns `isError: true` at `tools/call`.
544
- - **Configure:** interactive `configure` runs the app config wizard; **`configure --sync`** refreshes agent artifacts to `~/.agents/` ([.agents protocol](https://dotagentsprotocol.com/)).
544
+ - **Configure:** interactive `configure` runs the app config wizard; **`configure --sync`** refreshes agent artifacts to `~/.agents/` (see https://dotagentsprotocol.com).
545
545
  - **Agent skill:** `program.skill: { enabled: true }` installs to `~/.agents/skills/<key>/` on `configure --sync`; see [configure.md](configure.md) and [ai-skills.md](ai-skills.md).
546
546
  - **MCP install:** `mcpServer: { enabled: true }` merges into `~/.agents/mcp.json` on `configure --sync`; manual Cursor/Claude setup in [mcp.md](mcp.md).
547
547
 
@@ -555,21 +555,19 @@ See [config-schema.md](config-schema.md) for codegen, [configure.md](configure.m
555
555
 
556
556
  Do not declare user commands named `completion`, `configure`, `mcp`, `version`, or `docs` at the root — ArgsBarg injects these when configured. App config uses `configure get` / `configure set` subcommands (not a top-level `config` command).
557
557
 
558
- ## Cursor rule for consumer repos
558
+ ## Agent instructions for consumer repos
559
559
 
560
- Argsbarg ships framework docs under `node_modules/argsbarg/docs/` (same files as this repo’s `docs/`). **This file is the authoritative guide** — the Cursor rule is a thin tripwire that tells agents to read it.
560
+ Argsbarg ships framework docs under `node_modules/argsbarg/docs/` (same files as this repo’s `docs/`). **This file is the authoritative guide** — `AGENTS.md` inlines the tripwire rules that tell agents when to read it.
561
561
 
562
562
  Agents do **not** discover package docs automatically. Wire them in after `bun add argsbarg`:
563
563
 
564
- 1. **Copy the Cursor rule** (recommended):
564
+ 1. **Use the copy template `AGENTS.md`** (recommended):
565
565
 
566
566
  ```bash
567
- mkdir -p .cursor/rules
568
- bun scripts/merge-cli-program-rule.ts . \
569
- node_modules/argsbarg/examples/full-example/.cursor/rules/cli-program.mdc
567
+ bun scripts/merge-agents-md.ts .
570
568
  ```
571
569
 
572
- The template is ~30 lines: when to read which doc, plus hard rules agents often get wrong. It does **not** duplicate this guide. `bunx argsbarg create` copies this file into new projects automatically.
570
+ `bunx argsbarg create` copies `AGENTS.md` and `CLAUDE.md` (`@AGENTS.md`) into new projects automatically.
573
571
 
574
572
  2. **Add an app-specific block at the bottom** (recommended). Replace the template placeholder with a heading like `**myapp conventions:**` and short bullets — shared flag modules, `read*Flags` / `resolve*` paths, Ink vs JSON-only, etc. Example:
575
573
 
@@ -580,11 +578,11 @@ The template is ~30 lines: when to read which doc, plus hard rules agents often
580
578
  - Per command: `read*Flags` + `resolve*Input` in `commands/<name>/resolve.ts`.
581
579
  ```
582
580
 
583
- If you maintain argsbarg from a sibling checkout, `just consumer-dev` / `just consumers-sync` refresh the shared template and **keep** this footer (matched by the `**… conventions:**` heading). Commit `.cursor/rules/cli-program.mdc` in your repo.
581
+ If you maintain argsbarg from a sibling checkout, `just consumers-dev` / `just consumers-sync` refresh the shared managed section and **keep** your prefix and conventions footer. Commit `AGENTS.md` in your repo.
584
582
 
585
- 3. **Optional:** a separate rule (e.g. `.cursor/argsbarg.mdc` or `AGENTS.md`) for broader package API notes.
583
+ 3. **Optional:** add consumer-specific sections above the `<!-- argsbarg:managed -->` marker in `AGENTS.md` (project context, Ink patterns, domain notes).
586
584
 
587
- - **Not this file:** `myapp configure --sync` writes the **app** skill (`SKILL.md` under `~/.agents/skills/<key>/`) from your command schema — how to *invoke* the CLI. The rule above is for *authoring* argsbarg schema.
585
+ - **Not this file:** `myapp configure --sync` writes the **app** skill (`SKILL.md` under `~/.agents/skills/<key>/`) from your command schema — how to *invoke* the CLI. `AGENTS.md` is for *authoring* argsbarg schema.
588
586
 
589
587
  ## See also
590
588
 
package/docs/configure.md CHANGED
@@ -69,7 +69,7 @@ Non-interactive / CI: pass **`--yes`** (or **`--json`**, **`--sync`**, **`--remo
69
69
  | Binary | skipped (read-only) | Homebrew formula `bin.install` |
70
70
  | Shell completions | skipped | Homebrew `generate_completions_from_executable` |
71
71
  | Agent skill | skipped (automatic) | `~/.agents/skills/<key>/` when `program.skill.enabled` |
72
- | MCP config | skipped (automatic) | `~/.agents/mcp.json` when `mcpServer.enabled` ([.agents protocol](https://dotagentsprotocol.com/)) |
72
+ | MCP config | skipped (automatic) | `~/.agents/mcp.json` when `mcpServer.enabled` (see https://dotagentsprotocol.com) |
73
73
  | App config | auto-runs wizard | Interactive wizard may update `~/.local/lib/<key>/config.json` when values change; `--sync` bootstraps an empty file on install |
74
74
 
75
75
  ### Externally managed binary (Homebrew)
@@ -32,15 +32,15 @@ Sibling consumer repos (machine-specific paths in the root `justfile` `consumer_
32
32
 
33
33
  | Recipe | When | Effect |
34
34
  | --- | --- | --- |
35
- | `just consumers-dev` | Before publish; hacking on argsbarg locally | `bun add argsbarg@file:<relative>`; refresh `.cursor/rules/cli-program.mdc` and `code.mdc` from template (keeps app-specific suffix) |
35
+ | `just consumers-dev` | Before publish; hacking on argsbarg locally | `bun add argsbarg@file:<relative>`; refresh `AGENTS.md` from template (keeps app-specific prefix and conventions footer) |
36
36
  | `just consumers-sync` | After release | Sets `"argsbarg": "^<this package.json version>"`, `bun install`, merge **cli-program** + **code** Cursor rules, `just build`, `just docgen`, `just install-local` (Homebrew dev formula + agent artifacts; `just install` is an alias) |
37
37
  | `just consumers-schemagen` | After `@sg` type changes in consumers | Runs `argsbarg schemagen` in each `consumer_apps` path (fails if missing) |
38
38
 
39
39
  `consumers-sync` reads the version from **this repo’s** `package.json` — not npm. Run it **after** `just release` so consumers pin a version that exists on the registry.
40
40
 
41
- **Argsbarg authoring rules** — `scripts/merge-cli-program-rule.ts` and `scripts/merge-code-rule.ts` copy templates from `examples/full-example-json/.cursor/rules/` into each consumer, preserving any existing `**… conventions:**` footer block.
41
+ **Argsbarg authoring rules** — `scripts/merge-agents-md.ts` copies the template from `examples/full-example-json/AGENTS.md` into each consumer, preserving any existing prefix and `**… conventions:**` footer block.
42
42
 
43
- **Recommended in each consumer:** replace template placeholders with `**<app> conventions:**` bullets. Commit those files; merges refresh the shared top, not your footer.
43
+ **Recommended in each consumer:** replace template placeholders with `**<app> conventions:**` bullets. Commit `AGENTS.md`; merges refresh the managed section, not your prefix or footer.
44
44
 
45
45
  ## Upgrading consumer apps to 7.0
46
46
 
@@ -52,7 +52,7 @@ Breaking changes (no backward compat). See [CHANGELOG.md](../CHANGELOG.md) `[Unr
52
52
  4. **HTTP:** use `/api/...` REST routes only (`POST /tools/*` removed).
53
53
  5. **Hooks:** remove manual `ctx.locals.requestId` in `beforeInvoke` — framework seeds it.
54
54
  6. **Exports:** stop importing `loadLeafInputs` / `CliHttpResponseConfig` from `argsbarg` (use `ctx.inputs`, leaf `http.successContentType`).
55
- 7. **Cursor rules:** `just consumers-dev` merges `cli-program.mdc` + `code.mdc` (includes **Abstractions** needless-extraction rule).
55
+ 7. **Agent instructions:** `just consumers-dev` merges `AGENTS.md` + `CLAUDE.md` (includes **Abstractions** needless-extraction rule).
56
56
  8. **Verify:** `just test` and `just docgen` in each consumer repo.
57
57
 
58
58
  **Consumer app skill** — `just install-local` in each consumer (part of `consumers-sync`) runs Homebrew dev install then `myapp configure --sync --yes`, which updates `~/.agents/skills/<app>/` when `program.skill.enabled` — not the argsbarg framework rule.
package/docs/mcp.md CHANGED
@@ -46,7 +46,7 @@ bun run examples/nested.ts mcp
46
46
 
47
47
  ### `.agents` auto-install
48
48
 
49
- When `mcpServer.enabled` is set, `configure --sync` merges a `mcpServers` entry into `~/.agents/mcp.json` per the [.agents protocol](https://dotagentsprotocol.com/):
49
+ When `mcpServer.enabled` is set, `configure --sync` merges a `mcpServers` entry into `~/.agents/mcp.json` per the https://dotagentsprotocol.com:
50
50
 
51
51
  ```bash
52
52
  myapp configure --sync --yes
@@ -212,7 +212,7 @@ Per consumer repo (optional):
212
212
  4. `just docgen` / `myapp docs cli --save` — refresh consumer docs.
213
213
  5. Document which commands use which roots in **your** `docs/architecture.md` (argsbarg does not maintain per-app tables).
214
214
 
215
- Add a bullet under your app’s `**… conventions:**` block in `.cursor/rules/cli-program.mdc` pointing at `node_modules/argsbarg/docs/output-schema.md`.
215
+ Add a bullet under your app’s `**… conventions:**` block in `AGENTS.md` pointing at `node_modules/argsbarg/docs/output-schema.md`.
216
216
 
217
217
  **Reference implementation:** [`examples/full-example-json/`](../examples/full-example-json/) in this repo — `@sg` on command types, `__generated__/`, and `status` leaf with `StatusJsonOutputSchema`.
218
218
 
@@ -0,0 +1,75 @@
1
+ # full-example
2
+
3
+ ## Tooling
4
+
5
+ - Bun only (`bun`, `bunx`, `bun test`). No Node/npm/pnpm.
6
+
7
+ ## Documentation
8
+
9
+ - `README.md` — user-facing install/commands
10
+ - `docs/architecture.md` — maintainer internals (create if missing)
11
+ - Generated: `just docgen` → `docs/cli.md`, `docs/cli-schema.json`, `docs/skill.md`
12
+
13
+ <!-- argsbarg:managed -->
14
+
15
+ ## Argsbarg schema
16
+
17
+ When adding or changing argsbarg schema, leaf handlers, or MCP exposure:
18
+
19
+ 1. **Read** `node_modules/argsbarg/docs/cli-program.md` (required — authoritative guide).
20
+ 2. MCP tools, varargs → `node_modules/argsbarg/docs/mcp.md`.
21
+ 3. JSON stdout / `outputSchema` and `@sg` schemagen → `node_modules/argsbarg/docs/output-schema.md` and `examples/full-example-json/`.
22
+ 4. App config / `program.appConfig` → `node_modules/argsbarg/docs/config-schema.md`.
23
+ 5. `configure`, Homebrew distribution → `node_modules/argsbarg/docs/configure.md` and `distribution-homebrew.md`.
24
+ 6. Bundled `docs` built-in → `node_modules/argsbarg/docs/bundled-docs.md`.
25
+ 7. **Examples** (shipped under `node_modules/argsbarg/examples/`):
26
+ - **CLI copy template** (this repo) — builtins only, no schemagen
27
+ - **Schema-first copy template** — `@sg`, `inputSchema`/`outputSchema`, REST CRUD → `examples/full-example-json/`
28
+
29
+ **Hard rules** (details and examples are in the docs above — do not contradict them):
30
+
31
+ - Reserved root commands: `completion`, `configure`, `mcp`, `version`, `docs`.
32
+ - `satisfies CliProgram` / `CliLeaf`; action-oriented `description` on root, commands, options, and positionals.
33
+ - Omit `mcpTool` unless genuinely CLI-only (`enabled: false`) or an irreducible wire limit — fix schema and headless handlers first.
34
+ - Interactive leaves: one headless path for MCP, non-TTY CLI, and `--yes` / `--dry-run` / `--json` (`shouldRunHeadless*`, `requireYesInNonTty`); not raw `isTTY`.
35
+ - String options: `format` / `default` / `pattern` per `cli-program.md`.
36
+ - Varargs (`argMax: 0`): CLI space-separated; MCP JSON array only — no comma-splitting positionals.
37
+
38
+ ## Code conventions
39
+
40
+ ### JSDoc
41
+
42
+ Add doc comments for exported surfaces that are not obvious from the name alone. Skip comments on short test callbacks and pure re-export files.
43
+
44
+ ### Names
45
+
46
+ Use names that describe the domain role, not generic placeholders like `data` or `handler`, except in very small scopes.
47
+
48
+ ### Structure
49
+
50
+ After imports, put **exported** symbols first (alphabetical within each kind), then **module-private** helpers at the bottom. Use `~/…` only where you would otherwise use `../` (or deeper) to reach another module under `src/`. Same-directory (`./`) and child (`./foo/…`) imports stay relative. Use `.ts` extensions.
51
+
52
+ ### Module boundaries
53
+
54
+ | Path | Owns | Must not |
55
+ | --- | --- | --- |
56
+ | `src/index.ts` | Thin entry: `new Cli(program).run()` | Inline leaf handlers, business logic |
57
+ | `src/types/` | Global type declarations (e.g. `md.d.ts`) | Runtime logic |
58
+ | `src/program.ts` | `CliProgram` assembly: `docs`, `commands: […]` | Inline leaf handlers, business logic |
59
+ | `src/commands/<name>/` | One user-facing command: `command.ts` | Shared helpers unrelated to the command |
60
+ | `scripts/` | Dev tooling (formula helpers) | Production command paths |
61
+
62
+ When adding commands: `src/commands/<name>/command.ts`; register in `program.ts` **alphabetically by command key**.
63
+
64
+ **Argsbarg schema:** see Argsbarg schema section above.
65
+
66
+ ### Execution
67
+
68
+ - **CLI:** `bun ./src/index.ts …` or `just run …`
69
+ - **Tests:** `just test` (after `just check`)
70
+
71
+ <!-- /argsbarg:managed -->
72
+
73
+ **full-example conventions:**
74
+
75
+ Replace with app-specific bullets.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -5,7 +5,7 @@ Reference template for argsbarg consumer docgen. Every builtin is enabled in `sr
5
5
  | If you are… | Read |
6
6
  | --- | --- |
7
7
  | **Using the CLI** | [../README.md](../README.md) |
8
- | **Authoring argsbarg schema** | `node_modules/argsbarg/docs/cli-program.md` — see `.cursor/rules/cli-program.mdc` |
8
+ | **Authoring argsbarg schema** | `node_modules/argsbarg/docs/cli-program.md` — see [`AGENTS.md`](../AGENTS.md) |
9
9
  | **HTTP API / curl** | [http.md](http.md) — generated; or run `full-example docs http` |
10
10
  | **MCP tools** | [mcp.md](mcp.md) — generated; or run `full-example docs mcp` |
11
11
  | **Full command tree (markdown)** | [cli.md](cli.md) — generated |
@@ -8,7 +8,7 @@ full-example exposes an MCP server with features similar to the CLI.
8
8
 
9
9
  ### `.agents` auto-install
10
10
 
11
- When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the [.agents protocol](https://dotagentsprotocol.com/).
11
+ When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the https://dotagentsprotocol.com.
12
12
 
13
13
  Install the CLI first so `full-example` is on your PATH (e.g. `brew install full-example`).
14
14
 
@@ -34,7 +34,7 @@ For full detail, open `reference.md` in this skill directory (same as `full-exam
34
34
 
35
35
  ## Install location
36
36
 
37
- Install follows the [.agents protocol](https://dotagentsprotocol.com/):
37
+ Install follows the https://dotagentsprotocol.com:
38
38
 
39
39
  - Auto-install: `full-example configure --sync --yes` when `skill.enabled` → `~/.agents/skills/full-example/`
40
40
  - Cursor and most coding agents read `~/.agents/skills/` natively
@@ -0,0 +1,86 @@
1
+ # full-example-json
2
+
3
+ ## Tooling
4
+
5
+ - Bun only (`bun`, `bunx`, `bun test`). No Node/npm/pnpm.
6
+
7
+ ## Documentation
8
+
9
+ - `README.md` — user-facing install/commands
10
+ - `docs/architecture.md` — maintainer internals (create if missing)
11
+ - Generated: `just docgen` → `docs/cli.md`, `docs/cli-schema.json`, `docs/skill.md`
12
+
13
+ <!-- argsbarg:managed -->
14
+
15
+ ## Argsbarg schema
16
+
17
+ When adding or changing argsbarg schema, leaf handlers, or MCP exposure:
18
+
19
+ 1. **Read** `node_modules/argsbarg/docs/cli-program.md` (required — authoritative guide).
20
+ 2. MCP tools, varargs, `inputSchema` → also `node_modules/argsbarg/docs/mcp.md`.
21
+ 3. JSON stdout / `outputSchema` guide and codegen → `node_modules/argsbarg/docs/output-schema.md`.
22
+ 4. App config / `program.appConfig` guide and codegen → `node_modules/argsbarg/docs/config-schema.md`.
23
+ 5. `configure`, `configure.targets`, Homebrew distribution → `node_modules/argsbarg/docs/configure.md` and `distribution-homebrew.md`.
24
+ 6. Bundled `docs` built-in → `node_modules/argsbarg/docs/bundled-docs.md`.
25
+ 7. **Examples** (shipped under `node_modules/argsbarg/examples/`):
26
+ - **Copy template** (all builtins, `@sg` schemagen, Homebrew justfile, `outputSchema`) → `examples/full-example/`
27
+
28
+ **Hard rules** (details and examples are in the docs above — do not contradict them):
29
+
30
+ - Reserved root commands: `completion`, `configure`, `mcp`, `version`, `docs`.
31
+ - `satisfies CliProgram` / `CliLeaf`; action-oriented `description` on root, commands, options, and positionals.
32
+ - Omit `mcpTool` unless genuinely CLI-only (`enabled: false`) or an irreducible wire limit — fix schema and headless handlers first.
33
+ - Interactive leaves: one headless path for MCP, non-TTY CLI, and `--yes` / `--dry-run` / `--json` (`shouldRunHeadless*`, `requireYesInNonTty`); not raw `isTTY`.
34
+ - String options: `format` / `default` / `pattern` per `cli-program.md`; `readLeafInputs()` for multi-flag leaves.
35
+ - Varargs (`argMax: 0`): CLI space-separated; MCP JSON array only — no comma-splitting positionals.
36
+ - Multi-surface leaves (Ink + headless + MCP): one **`read*Flags(ctx)`** per command (or shared family helper + extensions); one **`resolve*Input(flags)`** for cross-field rules — handler reads ctx once, all paths share the struct.
37
+ - JSON stdout: `import { StatusJsonOutputSchema } from "./__generated__"` — declare `/** @sg */` on the type in `types.ts`; handlers import types from the same module.
38
+ - App config (optional): `import { AppConfigSchema } from "./config/__generated__"` — `/** @sg */` on `AppConfig` in `src/config/types.ts`.
39
+
40
+ ## Code conventions
41
+
42
+ ### JSDoc
43
+
44
+ Add doc comments for exported surfaces that are not obvious from the name alone: JSON output schemas, public types, and non-trivial algorithms. Skip comments on short test callbacks and pure re-export files.
45
+
46
+ ### Names
47
+
48
+ Use names that describe the domain role, not generic placeholders like `data` or `handler`, except in very small scopes.
49
+
50
+ ### Structure
51
+
52
+ After imports, put **exported** symbols first (alphabetical within each kind), then **module-private** helpers at the bottom. Use `~/…` only where you would otherwise use `../` (or deeper) to reach another module under `src/`. Same-directory (`./`) and child (`./foo/…`) imports stay relative. Use `.ts` extensions.
53
+
54
+ ### Module boundaries
55
+
56
+ | Path | Owns | Must not |
57
+ | --- | --- | --- |
58
+ | `src/index.ts` | Thin entry: `new Cli(program).run()` | Inline leaf handlers, business logic |
59
+ | `src/types/` | Global type declarations and module augmentations (e.g. `argsbarg.d.ts`, `md.d.ts`) | Runtime logic, imports from outside `types/` |
60
+ | `src/program.ts` | `CliProgram` assembly: `docs`, `commands: […]` | Inline leaf handlers, business logic |
61
+ | `src/db/` | `AppDb` (SQLite connect, migrate, domain access), `migrate.ts`, `migrations/*.sql` | Command handlers |
62
+ | `src/commands/<name>/` | One user-facing command: `command.ts`, optional `types.ts` with `/** @sg */` | Shared helpers (lift to `src/db/`) |
63
+ | `src/**/__generated__/` | Generated JSON Schema + `index.ts` re-exports | Hand-edited generated files |
64
+ | `scripts/` | Dev tooling (formula helpers) | Production command paths |
65
+
66
+ When adding commands: `src/commands/<name>/command.ts` + `types.ts` when schemas are needed; register in `program.ts` **alphabetically by command key**.
67
+
68
+ **Argsbarg schema:** see Argsbarg schema section above.
69
+
70
+ ### Execution
71
+
72
+ - **Runtime:** Bun (`just test`, `just dev`).
73
+ - **Tests:** colocate `*.test.ts` next to the module.
74
+ - **Schemagen:** after changing `/** @sg */` types in `src/`, run `just schemagen` (`__generated__/` is gitignored).
75
+
76
+ ### Abstractions
77
+
78
+ Avoid needless extraction: keep single-use helpers in the calling file by default. Split only when reused elsewhere, the caller is large or hard to follow, or extraction clarifies a substantial unit. Do not create tiny one-off helpers.
79
+ - ❌ `utils/formatX.ts` — 60-line helper used by one command
80
+ - ✅ inline helper in that command file
81
+
82
+ <!-- /argsbarg:managed -->
83
+
84
+ **full-example-json conventions:**
85
+
86
+ Replace with app-specific bullets.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -5,7 +5,7 @@ Reference template for argsbarg consumer docgen. Every builtin is enabled in `sr
5
5
  | If you are… | Read |
6
6
  | --- | --- |
7
7
  | **Using the CLI** | [../README.md](../README.md) |
8
- | **Authoring argsbarg schema** | `node_modules/argsbarg/docs/cli-program.md` — see `.cursor/rules/cli-program.mdc` |
8
+ | **Authoring argsbarg schema** | `node_modules/argsbarg/docs/cli-program.md` — see [`AGENTS.md`](../AGENTS.md) |
9
9
  | **HTTP API / curl** | [http.md](http.md) — generated; or run `full-example docs http` |
10
10
  | **MCP tools** | [mcp.md](mcp.md) — generated; or run `full-example docs mcp` |
11
11
  | **Full command tree (markdown)** | [cli.md](cli.md) — generated |
@@ -8,7 +8,7 @@ full-example-json exposes an MCP server with features similar to the CLI.
8
8
 
9
9
  ### `.agents` auto-install
10
10
 
11
- When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the [.agents protocol](https://dotagentsprotocol.com/).
11
+ When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the https://dotagentsprotocol.com.
12
12
 
13
13
  Install the CLI first so `full-example-json` is on your PATH (e.g. `brew install full-example-json`).
14
14
 
@@ -41,7 +41,7 @@ For full detail, open `reference.md` in this skill directory (same as `full-exam
41
41
 
42
42
  ## Install location
43
43
 
44
- Install follows the [.agents protocol](https://dotagentsprotocol.com/):
44
+ Install follows the https://dotagentsprotocol.com:
45
45
 
46
46
  - Auto-install: `full-example-json configure --sync --yes` when `skill.enabled` → `~/.agents/skills/full-example-json/`
47
47
  - Cursor and most coding agents read `~/.agents/skills/` natively
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "argsbarg",
3
- "version": "6.2.0",
3
+ "version": "6.2.2",
4
4
  "main": "./src/index.ts",
5
5
  "module": "./src/index.ts",
6
6
  "dependencies": {
@@ -81,7 +81,7 @@ export function generateMcpGuide(root: CliProgram): string {
81
81
  "",
82
82
  "### `.agents` auto-install",
83
83
  "",
84
- "When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the [.agents protocol](https://dotagentsprotocol.com/).",
84
+ "When `mcpServer.enabled` is set, `configure --sync` merges this server into `~/.agents/mcp.json` per the https://dotagentsprotocol.com.",
85
85
  "",
86
86
  ];
87
87
 
@@ -152,7 +152,7 @@ function buildSkillMd(root: CliProgram, dirName: string): string {
152
152
  "",
153
153
  "## Install location",
154
154
  "",
155
- "Install follows the [.agents protocol](https://dotagentsprotocol.com/):",
155
+ "Install follows the https://dotagentsprotocol.com:",
156
156
  "",
157
157
  `- Auto-install: \`${root.key} configure --sync --yes\` when \`skill.enabled\` → \`~/.agents/skills/${dirName}/\``,
158
158
  `- Cursor and most coding agents read \`~/.agents/skills/\` natively`,