argsbarg 6.1.10 → 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 +22 -1
- package/README.md +49 -49
- package/docs/README.md +5 -4
- package/docs/ai-skills.md +36 -23
- package/docs/bundled-docs.md +1 -1
- package/docs/cli-program.md +19 -20
- package/docs/config-schema.md +3 -3
- package/docs/configure.md +12 -16
- package/docs/developing.md +9 -9
- package/docs/mcp.md +21 -57
- package/docs/output-schema.md +3 -3
- package/examples/formats.ts +5 -6
- package/examples/full-example/AGENTS.md +75 -0
- package/examples/full-example/CLAUDE.md +1 -0
- package/examples/full-example/README.md +7 -69
- package/examples/full-example/docs/README.md +1 -1
- package/examples/full-example/docs/cli-schema.json +1 -1659
- package/examples/full-example/docs/cli.md +2 -1538
- package/examples/full-example/docs/http.md +0 -7
- package/examples/full-example/docs/mcp.md +23 -59
- package/examples/full-example/docs/openapi.json +2 -782
- package/examples/full-example/docs/skill.md +18 -14
- package/examples/full-example/justfile +5 -17
- package/examples/full-example/scripts/create-identity.ts +2 -1
- package/examples/full-example/src/commands/status/command.test.ts +2 -2
- package/examples/full-example/src/commands/status/command.ts +7 -6
- package/examples/full-example/src/program.ts +4 -10
- package/examples/full-example-json/AGENTS.md +86 -0
- package/examples/full-example-json/CLAUDE.md +1 -0
- package/examples/full-example-json/Formula/.gitkeep +0 -0
- package/examples/full-example-json/Formula/full-example-json.rb +35 -0
- package/examples/full-example-json/README.md +27 -0
- package/examples/full-example-json/biome.json +22 -0
- package/examples/full-example-json/bun.lock +48 -0
- package/examples/full-example-json/docs/README.md +27 -0
- package/examples/full-example-json/docs/cli-schema.json +2145 -0
- package/examples/full-example-json/docs/cli.md +1990 -0
- package/examples/full-example-json/docs/http.md +92 -0
- package/examples/full-example-json/docs/mcp.md +116 -0
- package/examples/full-example-json/docs/openapi.json +1246 -0
- package/examples/full-example-json/docs/skill.md +57 -0
- package/examples/full-example-json/justfile +171 -0
- package/examples/full-example-json/package.json +22 -0
- package/examples/full-example-json/scripts/create-identity.ts +12 -0
- package/examples/full-example-json/scripts/dev-formula.ts +97 -0
- package/examples/full-example-json/scripts/formula-shared.test.ts +68 -0
- package/examples/full-example-json/scripts/formula-shared.ts +170 -0
- package/examples/full-example-json/scripts/print-identity.ts +28 -0
- package/examples/full-example-json/scripts/release.ts +212 -0
- package/examples/full-example-json/src/commands/echo/command.ts +26 -0
- package/examples/full-example-json/src/commands/status/command.test.ts +10 -0
- package/examples/full-example-json/src/commands/status/command.ts +28 -0
- package/examples/full-example-json/src/index.ts +10 -0
- package/examples/full-example-json/src/program.ts +33 -0
- package/examples/full-example-json/src/types/md.d.ts +4 -0
- package/examples/full-example-json/tsconfig.json +17 -0
- package/examples/minimal.ts +17 -17
- package/examples/nested.ts +10 -10
- package/examples/option-required.ts +13 -13
- package/examples/servers.ts +10 -10
- package/index.d.ts +17 -43
- package/package.json +1 -1
- package/src/cli-tool/create.test.ts +44 -68
- package/src/cli-tool/create.ts +81 -17
- package/src/cli-tool/full-example-capabilities.test.ts +33 -18
- package/src/cli-tool/post-create.ts +31 -17
- package/src/cli-tool/program.ts +16 -7
- package/src/cli-tool/prompt.ts +27 -0
- package/src/cli-tool/run-create.ts +19 -7
- package/src/cli-tool/schemagen/schemagen.test.ts +3 -3
- package/src/configure/artifacts/install-validate.test.ts +20 -33
- package/src/configure/artifacts/paths.ts +9 -53
- package/src/configure/artifacts/status.test.ts +13 -16
- package/src/configure/artifacts/status.ts +5 -22
- package/src/configure/artifacts/target-base.ts +6 -15
- package/src/configure/artifacts/target-effective.ts +16 -54
- package/src/configure/artifacts/target-mcp-json.ts +2 -5
- package/src/configure/artifacts/target-registry.ts +0 -7
- package/src/configure/artifacts/target-scope.ts +7 -17
- package/src/configure/artifacts/target-skill.ts +6 -15
- package/src/configure/artifacts/target-types.ts +6 -54
- package/src/configure/artifacts/targets/agents-mcp.ts +11 -0
- package/src/configure/artifacts/targets/configure.ts +1 -5
- package/src/configure/artifacts/targets/index.ts +4 -44
- package/src/configure/artifacts/targets/skill.ts +12 -0
- package/src/configure/artifacts/targets.test.ts +21 -59
- package/src/configure/configure.test.ts +35 -46
- package/src/configure/index.ts +19 -19
- package/src/configure/prompt.ts +2 -12
- package/src/core/parse.test.ts +21 -32
- package/src/core/types.ts +18 -44
- package/src/core/validate.ts +28 -45
- package/src/docs/docs.test.ts +4 -4
- package/src/docs/mcp-guide.ts +41 -71
- package/src/docs/resolve.ts +1 -1
- package/src/exports/cli.ts +1 -1
- package/src/index.ts +1 -1
- package/src/skill/generate.ts +26 -45
- package/src/skill/install.ts +18 -38
- package/src/skill/naming.ts +3 -27
- package/src/test/integration/config.test.ts +3 -3
- package/src/test/integration/mcp.test.ts +4 -4
- package/{examples/mcp-test.ts → src/test/mcp-integration-fixture.ts} +20 -22
- package/src/configure/artifacts/target-mcp-cli.ts +0 -127
- package/src/configure/artifacts/targets/chatgpt-mcp.ts +0 -12
- package/src/configure/artifacts/targets/claude-code-mcp.ts +0 -15
- package/src/configure/artifacts/targets/claude-desktop-mcp.ts +0 -12
- package/src/configure/artifacts/targets/claude-skill.ts +0 -16
- package/src/configure/artifacts/targets/codex-mcp.ts +0 -25
- package/src/configure/artifacts/targets/codex-skill.ts +0 -14
- package/src/configure/artifacts/targets/cursor-mcp.ts +0 -15
- package/src/configure/artifacts/targets/cursor-skill.ts +0 -16
- package/src/configure/artifacts/targets/openclaw-mcp.ts +0 -25
- package/src/configure/artifacts/targets/openclaw-skill.ts +0 -17
- package/src/configure/artifacts/targets/opencode-mcp.ts +0 -96
- package/src/configure/artifacts/targets/opencode-skill.ts +0 -15
- /package/examples/{full-example → full-example-json}/src/commands/render-json/__generated__/RenderJsonInputSchema.json +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/render-json/__generated__/index.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/render-json/command.test.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/render-json/command.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/render-json/types.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/status/__generated__/StatusJsonOutputSchema.json +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/status/__generated__/index.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/status/types.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/workspaces/__generated__/WorkspaceNameInputSchema.json +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/workspaces/__generated__/index.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/workspaces/command.test.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/workspaces/command.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/commands/workspaces/types.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/db/index.test.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/db/index.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/db/migrate.test.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/db/migrate.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/db/migrations/001_workspaces.sql +0 -0
- /package/examples/{full-example → full-example-json}/src/db/tables/workspaces.ts +0 -0
- /package/examples/{full-example → full-example-json}/src/types/argsbarg.d.ts +0 -0
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
id: full-example
|
|
3
|
+
name: full-example
|
|
4
|
+
description: Operates the full-example CLI (echo, status). Use when the user mentions full-example, echo, status, or related tasks.
|
|
5
|
+
enabled: true
|
|
4
6
|
---
|
|
5
7
|
<!-- Generated by full-example docs skill --save; do not edit. -->
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
# full-example
|
|
9
11
|
|
|
10
|
-
Argsbarg
|
|
12
|
+
Argsbarg CLI copy template (MCP, HTTP, configure, skills; no schemagen)
|
|
11
13
|
|
|
12
14
|
## Execution
|
|
13
15
|
|
|
@@ -20,14 +22,7 @@ full-example <subcommand> [options] [args]
|
|
|
20
22
|
## Commands
|
|
21
23
|
|
|
22
24
|
- **`full-example echo`** — Echo a message (MCP-friendly leaf).
|
|
23
|
-
- **`full-example render-json`** — Echo a JSON message (schema-first JSON leaf demo).
|
|
24
25
|
- **`full-example status`** — Show app version. (flags: --json)
|
|
25
|
-
- **`full-example workspaces get`** — List workspaces.
|
|
26
|
-
- **`full-example workspaces post`** — Create a workspace.
|
|
27
|
-
- **`full-example workspaces :id get`** — Get one workspace.
|
|
28
|
-
- **`full-example workspaces :id put`** — Replace a workspace.
|
|
29
|
-
- **`full-example workspaces :id patch`** — Patch a workspace name.
|
|
30
|
-
- **`full-example workspaces :id delete`** — Delete a workspace.
|
|
31
26
|
|
|
32
27
|
## Pitfalls
|
|
33
28
|
|
|
@@ -37,10 +32,19 @@ full-example <subcommand> [options] [args]
|
|
|
37
32
|
|
|
38
33
|
For full detail, open `reference.md` in this skill directory (same as `full-example docs cli`).
|
|
39
34
|
|
|
40
|
-
##
|
|
35
|
+
## Install location
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
- Global: `~/.cursor/skills/full_example/`
|
|
37
|
+
Install follows the https://dotagentsprotocol.com:
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
- Auto-install: `full-example configure --sync --yes` when `skill.enabled` → `~/.agents/skills/full-example/`
|
|
40
|
+
- Cursor and most coding agents read `~/.agents/skills/` natively
|
|
41
|
+
|
|
42
|
+
**Claude Code (manual):** symlink or copy into Claude's skill directory:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
mkdir -p ~/.claude/skills
|
|
46
|
+
ln -sf ~/.agents/skills/full-example ~/.claude/skills/full-example
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Project override (optional): `.agents/skills/full-example/`
|
|
46
50
|
|
|
@@ -21,18 +21,8 @@ build:
|
|
|
21
21
|
bun build ./src/index.ts --compile --outfile=dist/{{cli_key}}
|
|
22
22
|
@rm -f .*.bun-build
|
|
23
23
|
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
#!/usr/bin/env bash
|
|
27
|
-
set -euo pipefail
|
|
28
|
-
mkdir -p "$(dirname '{{DB}}')"
|
|
29
|
-
for f in $(ls src/db/migrations/*.sql | sort); do
|
|
30
|
-
echo "==> $f"
|
|
31
|
-
sqlite3 '{{DB}}' < "$f"
|
|
32
|
-
done
|
|
33
|
-
|
|
34
|
-
# Run schemagen, typecheck, and format
|
|
35
|
-
check: schemagen format typecheck
|
|
24
|
+
# Run typecheck and format
|
|
25
|
+
check: format typecheck
|
|
36
26
|
|
|
37
27
|
# demo the HTTP API
|
|
38
28
|
demo-http:
|
|
@@ -55,7 +45,7 @@ dev *ARGS:
|
|
|
55
45
|
bun --watch ./src/index.ts {{ARGS}}
|
|
56
46
|
|
|
57
47
|
# Regenerate consumer docs under ./docs/
|
|
58
|
-
docgen:
|
|
48
|
+
docgen:
|
|
59
49
|
@just run docs cli-schema --save
|
|
60
50
|
@just run docs cli --save
|
|
61
51
|
@just run docs skill --save
|
|
@@ -113,15 +103,13 @@ lint:
|
|
|
113
103
|
run *ARGS:
|
|
114
104
|
bun ./src/index.ts {{ARGS}}
|
|
115
105
|
|
|
116
|
-
# Generate JSON Schema artifacts from TypeScript types
|
|
106
|
+
# Generate JSON Schema artifacts from TypeScript types (not used in this template)
|
|
117
107
|
schemagen:
|
|
118
|
-
|
|
108
|
+
@echo "This CLI template has no @sg types. Use full-example-json or add /** @sg */ types first."
|
|
119
109
|
|
|
120
110
|
# Install bun/npm dependencies
|
|
121
|
-
# Install bun/npm dependencies and generate schemas
|
|
122
111
|
setup:
|
|
123
112
|
bun install
|
|
124
|
-
just schemagen
|
|
125
113
|
|
|
126
114
|
# Run unit tests (after check)
|
|
127
115
|
test: check
|
|
@@ -6,6 +6,7 @@ export const createIdentity = {
|
|
|
6
6
|
tap: "bdombro/bun-argsbarg",
|
|
7
7
|
homepage: "https://github.com/bdombro/bun-argsbarg",
|
|
8
8
|
releaseRepo: "bdombro/bun-argsbarg",
|
|
9
|
-
desc: "Argsbarg
|
|
9
|
+
desc: "Argsbarg CLI copy template (MCP, HTTP, configure, skills; no schemagen)",
|
|
10
10
|
envPrefix: "FULL_EXAMPLE",
|
|
11
|
+
template: "cli",
|
|
11
12
|
} as const;
|
|
@@ -2,9 +2,9 @@ import { describe, expect, test } from "bun:test";
|
|
|
2
2
|
import { statusCommand } from "./command.ts";
|
|
3
3
|
|
|
4
4
|
describe("status command", () => {
|
|
5
|
-
test("exports
|
|
5
|
+
test("exports json option without outputSchema", () => {
|
|
6
6
|
expect(statusCommand.key).toBe("status");
|
|
7
|
-
expect(statusCommand.outputSchema).
|
|
7
|
+
expect(statusCommand.outputSchema).toBeUndefined();
|
|
8
8
|
expect(statusCommand.options?.some((o) => o.name === "json")).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
});
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Status leaf —
|
|
2
|
+
Status leaf — version with optional JSON stdout (no schemagen).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { type CliLeaf, CliOptionKind } from "argsbarg";
|
|
6
|
-
import { StatusJsonOutputSchema } from "./__generated__";
|
|
7
|
-
import type { StatusJsonOutput } from "./types.ts";
|
|
8
6
|
|
|
9
7
|
export const statusCommand = {
|
|
10
8
|
key: "status",
|
|
@@ -16,13 +14,16 @@ export const statusCommand = {
|
|
|
16
14
|
kind: CliOptionKind.Presence,
|
|
17
15
|
},
|
|
18
16
|
],
|
|
19
|
-
outputSchema: StatusJsonOutputSchema,
|
|
20
17
|
handler: (ctx) => {
|
|
21
|
-
const out
|
|
18
|
+
const out = { version: ctx.program.version };
|
|
22
19
|
if (ctx.hasFlag("json")) {
|
|
23
20
|
console.log(JSON.stringify(out, null, 2));
|
|
24
|
-
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (ctx.invocation === "cli") {
|
|
25
24
|
console.log(`version=${out.version}`);
|
|
25
|
+
return;
|
|
26
26
|
}
|
|
27
|
+
return out;
|
|
27
28
|
},
|
|
28
29
|
} satisfies CliLeaf;
|
|
@@ -6,14 +6,10 @@ import type { CliProgram } from "argsbarg";
|
|
|
6
6
|
import readmeText from "../README.md" with { type: "text" };
|
|
7
7
|
import { createIdentity } from "../scripts/create-identity.ts";
|
|
8
8
|
import { echoCommand } from "./commands/echo/command.ts";
|
|
9
|
-
import { renderJsonCommand } from "./commands/render-json/command.ts";
|
|
10
9
|
import { statusCommand } from "./commands/status/command.ts";
|
|
11
|
-
import { workspacesCommand } from "./commands/workspaces/command.ts";
|
|
12
|
-
import { AppDb } from "./db";
|
|
13
10
|
|
|
14
11
|
export const program = {
|
|
15
|
-
|
|
16
|
-
version: "1.0.0",
|
|
12
|
+
commands: [echoCommand, statusCommand],
|
|
17
13
|
description: createIdentity.desc,
|
|
18
14
|
docs: {
|
|
19
15
|
topics: {
|
|
@@ -22,11 +18,9 @@ export const program = {
|
|
|
22
18
|
},
|
|
23
19
|
},
|
|
24
20
|
},
|
|
21
|
+
key: createIdentity.key,
|
|
25
22
|
mcpServer: { enabled: true },
|
|
26
23
|
httpServer: { enabled: true },
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
beforeInvoke: AppDb.attach,
|
|
30
|
-
},
|
|
31
|
-
commands: [echoCommand, renderJsonCommand, statusCommand, workspacesCommand],
|
|
24
|
+
skill: { enabled: true },
|
|
25
|
+
version: "1.0.0",
|
|
32
26
|
} satisfies CliProgram;
|
|
@@ -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
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class FullExampleJson < Formula
|
|
2
|
+
desc "Argsbarg schema-first copy template (@sg schemagen, JSON schemas, REST CRUD)"
|
|
3
|
+
homepage "https://github.com/bdombro/bun-argsbarg"
|
|
4
|
+
version "1.0.0"
|
|
5
|
+
sha256 "d6dbe3233152d2f51feca068b23e6fd133940232fb4bb7c3f08c2d1024c10c30"
|
|
6
|
+
|
|
7
|
+
def install
|
|
8
|
+
bin.install "full-example-json"
|
|
9
|
+
chmod 0755, bin/"full-example-json"
|
|
10
|
+
generate_completions_from_executable(bin/"full-example-json", "completion", base_name: "full-example-json")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def post_install
|
|
14
|
+
system bin/"full-example-json", "configure", "--sync", "--yes"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def uninstall
|
|
18
|
+
system bin/"full-example-json", "configure", "--remove-all", "--yes"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def caveats
|
|
22
|
+
<<~EOS
|
|
23
|
+
Run `full-example-json configure` to set up agent artifacts and app config (interactive).
|
|
24
|
+
Restart MCP chat apps (Cursor, Claude Desktop, etc.) after install or upgrade so they load the updated server.
|
|
25
|
+
EOS
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test do
|
|
29
|
+
assert_match version.to_s, shell_output("#{bin}/full-example-json version")
|
|
30
|
+
assert_predicate bash_completion/"full-example-json", :exist?
|
|
31
|
+
assert_predicate zsh_completion/"_full-example-json", :exist?
|
|
32
|
+
assert_predicate fish_completion/"full-example-json.fish", :exist?
|
|
33
|
+
end
|
|
34
|
+
url "file:///Users/briandombrowski/dev/bdombro/bun-argsbarg/examples/full-example-json/Formula/.staging/full-example-json"
|
|
35
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# full-example-json
|
|
2
|
+
|
|
3
|
+
Argsbarg **schema-first copy template** — `@sg` schemagen, JSON Schema validation, REST CRUD demo (not a kitchen-sink product).
|
|
4
|
+
|
|
5
|
+
For a CLI-only template without schemagen, use `examples/full-example/` or `argsbarg create --template cli`.
|
|
6
|
+
|
|
7
|
+
## What's in this app
|
|
8
|
+
|
|
9
|
+
- **Builtins enabled:** CLI, shell completion, `docs`, MCP, HTTP API, `configure`, agent skills
|
|
10
|
+
- **Commands:**
|
|
11
|
+
- `echo` — simple flags/positionals
|
|
12
|
+
- `render-json` — `kind: "json"` leaf, schemagen `inputSchema`, `ctx.inputsAs`
|
|
13
|
+
- `status` — schemagen `outputSchema`, `--json`
|
|
14
|
+
- `workspaces` — REST CRUD, `:id` param routers, verb leaves, schemagen input schemas
|
|
15
|
+
- **Tooling:** `@sg` schemagen, `just docgen`, Homebrew/just dev workflow, in-memory SQLite (`bun:sqlite`)
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
From a git checkout at this directory (requires [Homebrew](https://brew.sh), [just](https://just.systems), and [Bun](https://bun.sh)):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
brew install just bun
|
|
23
|
+
just setup
|
|
24
|
+
just schemagen # after changing @sg types in src/
|
|
25
|
+
just run status --json
|
|
26
|
+
just run docs readme
|
|
27
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.5.0/schema.json",
|
|
3
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
|
4
|
+
"linter": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"rules": {
|
|
7
|
+
"preset": "recommended"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"formatter": {
|
|
11
|
+
"enabled": true,
|
|
12
|
+
"indentStyle": "space",
|
|
13
|
+
"lineWidth": 120
|
|
14
|
+
},
|
|
15
|
+
"overrides": [
|
|
16
|
+
{
|
|
17
|
+
"includes": ["**/*.json"],
|
|
18
|
+
"formatter": { "enabled": false },
|
|
19
|
+
"linter": { "enabled": false }
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "consumer-app-example",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"argsbarg": "file:../..",
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@biomejs/biome": "^2.5.0",
|
|
12
|
+
"@types/bun": "^1.3.12",
|
|
13
|
+
"typescript": "^5.9.3",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
"packages": {
|
|
18
|
+
"@biomejs/biome": ["@biomejs/biome@2.5.1", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.1", "@biomejs/cli-darwin-x64": "2.5.1", "@biomejs/cli-linux-arm64": "2.5.1", "@biomejs/cli-linux-arm64-musl": "2.5.1", "@biomejs/cli-linux-x64": "2.5.1", "@biomejs/cli-linux-x64-musl": "2.5.1", "@biomejs/cli-win32-arm64": "2.5.1", "@biomejs/cli-win32-x64": "2.5.1" }, "bin": { "biome": "bin/biome" } }, "sha512-IXWLCxKmae+rI7LOHS1B3EbVisQ6GRAWbhN9msa6KjNCyFWrvKZWR4oUdinaNssrV852OrSHuSPa95h1GPJc7Q=="],
|
|
19
|
+
|
|
20
|
+
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.5.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-npqDzvqv7vFaWRiNN1Te71siRgPaqS9MpqgYCdP/CrUbkJ7ApezaeaKjueKHRN/JH/6lRjJQAHi8acQDCAz22w=="],
|
|
21
|
+
|
|
22
|
+
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.5.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-RgwTqPAM8g2tn1j+b5oRjF/DbSBX8a4gwojtuG9XuhfK7GgomvZ9+T+tqjXiVbjLEeGJOoL6VEk8mvRTVeSybw=="],
|
|
23
|
+
|
|
24
|
+
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-yhV35CzZh38VyMvTEXi3JTjxZBs++oCKK9KG8vB6VI5+uvQvZNR3BFWEKKzuOmx9DJJj7sQpZ4LQJcmbGTs3+Q=="],
|
|
25
|
+
|
|
26
|
+
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.5.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-WMcvMLgByyTqVxGlq918NBBYliq9FRR9GAQVETHb+VjGVqXCZFfHlZHC1FX4ibuYY/Hg6TJE3rHU0xVrdJXNRw=="],
|
|
27
|
+
|
|
28
|
+
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-J/7uHSX7NfoYDI7HijAkd8lnQIOrRb2W7j3X+tw4R+N5ExvXGsyXFiGdQcfcxfOmNQmZVSQOCDk757fwpzqQcg=="],
|
|
29
|
+
|
|
30
|
+
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.5.1", "", { "os": "linux", "cpu": "x64" }, "sha512-ANTowtlLmPYm5yeMckWY8Xzb9Ix+JJP3tgHR/n6xRj1VWyIzzWtfRfih9hv9VmClwadpBvZduISZIbBsIlYG3A=="],
|
|
31
|
+
|
|
32
|
+
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.5.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-zgXnKNgWPC4iPF7Y1lR3STUeCUuZRpD6IiOrC7TZTlh0Lx6FiVUT05myuMQHQ9D+1cc7uyMldi4forE6lp0ivQ=="],
|
|
33
|
+
|
|
34
|
+
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.5.1", "", { "os": "win32", "cpu": "x64" }, "sha512-6uxpR9hvaglANkZemeSiN/FhYgkGasrEGn267eXIWvjrjJ2LhDlk251IhjVJq6MXzkV2/bcXwLwSroLyPtqRZg=="],
|
|
35
|
+
|
|
36
|
+
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
|
37
|
+
|
|
38
|
+
"@types/node": ["@types/node@26.0.0", "", { "dependencies": { "undici-types": "~8.3.0" } }, "sha512-vf2YFi1iY9lHGwNJMs01biZFbKJkrZR1T6/MlzjhJLPdntOHLhTrDSnSVcdtvjihi4VQNlrFRIxLsDBlQpAipA=="],
|
|
39
|
+
|
|
40
|
+
"argsbarg": ["argsbarg@file:../..", { "devDependencies": { "@biomejs/biome": "^2.5.0", "@types/bun": "^1.3.12", "typescript": "^5.9.3" }, "bin": { "argsbarg": "src/index.ts" } }],
|
|
41
|
+
|
|
42
|
+
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
|
43
|
+
|
|
44
|
+
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
45
|
+
|
|
46
|
+
"undici-types": ["undici-types@8.3.0", "", {}, "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ=="],
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# full-example documentation
|
|
2
|
+
|
|
3
|
+
Reference template for argsbarg consumer docgen. Every builtin is enabled in `src/program.ts`.
|
|
4
|
+
|
|
5
|
+
| If you are… | Read |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| **Using the CLI** | [../README.md](../README.md) |
|
|
8
|
+
| **Authoring argsbarg schema** | `node_modules/argsbarg/docs/cli-program.md` — see [`AGENTS.md`](../AGENTS.md) |
|
|
9
|
+
| **HTTP API / curl** | [http.md](http.md) — generated; or run `full-example docs http` |
|
|
10
|
+
| **MCP tools** | [mcp.md](mcp.md) — generated; or run `full-example docs mcp` |
|
|
11
|
+
| **Full command tree (markdown)** | [cli.md](cli.md) — generated |
|
|
12
|
+
| **Full command tree (JSON)** | [cli-schema.json](cli-schema.json) — generated |
|
|
13
|
+
| **OpenAPI 3.1** | [openapi.json](openapi.json) — generated |
|
|
14
|
+
| **Agent skill index** | [skill.md](skill.md) — generated |
|
|
15
|
+
|
|
16
|
+
## Framework docs vs this directory
|
|
17
|
+
|
|
18
|
+
| Layer | Contents |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| **Argsbarg framework** | How to author `CliProgram`, MCP, HTTP API | `node_modules/argsbarg/docs/` |
|
|
21
|
+
| **This `docs/` folder** | *full-example* command tree and guides | `just docgen` |
|
|
22
|
+
|
|
23
|
+
Do not hand-edit generated files. Refresh with:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
just docgen
|
|
27
|
+
```
|