argsbarg 6.1.2 → 6.1.3
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 +65 -1
- package/README.md +17 -19
- package/bin/argsbarg +10 -0
- package/docs/README.md +4 -3
- package/docs/ai-skills.md +4 -2
- package/docs/bundled-docs.md +50 -25
- package/docs/cli-program.md +52 -10
- package/docs/config-schema.md +10 -11
- package/docs/configure.md +2 -0
- package/docs/decisions.md +40 -0
- package/docs/developing.md +43 -5
- package/docs/http-server.md +171 -0
- package/docs/json-schema-subset.md +51 -0
- package/docs/mcp.md +4 -2
- package/docs/output-schema.md +55 -62
- package/examples/formats.ts +6 -6
- package/examples/full-example/Formula/full-example.rb +35 -0
- package/examples/full-example/README.md +20 -21
- package/examples/full-example/docs/README.md +1 -1
- package/examples/full-example/docs/cli-schema.json +1790 -98
- package/examples/full-example/docs/cli.md +1990 -0
- package/examples/full-example/docs/http.md +28 -29
- package/examples/full-example/docs/mcp.md +8 -22
- package/examples/full-example/docs/openapi.json +783 -50
- package/examples/full-example/docs/skill.md +10 -10
- package/examples/full-example/justfile +11 -1
- package/examples/full-example/src/commands/render-json/__generated__/RenderJsonInputSchema.json +15 -0
- package/examples/full-example/src/commands/render-json/__generated__/index.ts +5 -0
- package/examples/full-example/src/commands/render-json/command.test.ts +46 -0
- package/examples/full-example/src/commands/render-json/command.ts +30 -0
- package/examples/full-example/src/commands/render-json/types.ts +9 -0
- package/examples/full-example/src/commands/status/__generated__/StatusJsonOutputSchema.json +15 -0
- package/examples/full-example/src/commands/status/__generated__/index.ts +2 -2
- package/examples/full-example/src/commands/status/command.ts +5 -13
- package/examples/full-example/src/commands/status/types.ts +1 -14
- package/examples/full-example/src/commands/workspaces/__generated__/WorkspaceNameInputSchema.json +15 -0
- package/examples/full-example/src/commands/workspaces/__generated__/index.ts +5 -0
- package/examples/full-example/src/commands/workspaces/command.test.ts +58 -0
- package/examples/full-example/src/commands/workspaces/command.ts +94 -0
- package/examples/full-example/src/commands/workspaces/types.ts +6 -0
- package/examples/full-example/src/db/index.test.ts +86 -0
- package/examples/full-example/src/db/index.ts +101 -0
- package/examples/full-example/src/db/migrate.test.ts +35 -0
- package/examples/full-example/src/db/migrate.ts +69 -0
- package/examples/full-example/src/db/migrations/001_workspaces.sql +6 -0
- package/examples/full-example/src/db/tables/workspaces.ts +66 -0
- package/examples/full-example/src/program.ts +11 -36
- package/examples/full-example/src/types/argsbarg.d.ts +11 -0
- package/examples/full-example/src/types/md.d.ts +4 -0
- package/examples/full-example/tsconfig.json +5 -2
- package/examples/mcp-test.ts +1 -2
- package/examples/minimal.ts +1 -7
- package/examples/nested.ts +1 -2
- package/examples/option-required.ts +1 -1
- package/examples/servers.ts +4 -5
- package/index.d.ts +431 -136
- package/package.json +19 -2
- package/src/builtins/builtins.test.ts +7 -7
- package/src/builtins/completion-bash.ts +1 -1
- package/src/builtins/completion-fish.ts +1 -1
- package/src/builtins/completion-group.ts +4 -4
- package/src/builtins/completion-simulate-shared.ts +9 -0
- package/src/builtins/completion-zsh.ts +1 -1
- package/src/builtins/config.test.ts +3 -3
- package/src/builtins/config.ts +9 -9
- package/src/builtins/configure-copy.ts +2 -2
- package/src/builtins/configure.ts +4 -4
- package/src/builtins/dispatch.ts +19 -18
- package/src/builtins/export.ts +7 -5
- package/src/builtins/http.ts +68 -0
- package/src/builtins/mcp.ts +28 -4
- package/src/builtins/presentation.ts +6 -6
- package/src/builtins/registry.ts +6 -6
- package/src/builtins/scopes.ts +2 -2
- package/src/builtins/version.ts +1 -1
- package/src/cli-tool/full-example-capabilities.test.ts +10 -15
- package/src/cli-tool/main.ts +1 -1
- package/src/cli-tool/program.ts +3 -2
- package/src/cli-tool/prompt.ts +1 -1
- package/src/cli-tool/run-schemagen.ts +1 -3
- package/src/cli-tool/schemagen/cleanup.ts +6 -7
- package/src/cli-tool/schemagen/discover-schema-roots.ts +66 -120
- package/src/cli-tool/schemagen/index.ts +2 -2
- package/src/cli-tool/schemagen/names.ts +8 -13
- package/src/cli-tool/schemagen/run.ts +21 -28
- package/src/cli-tool/schemagen/schemagen.test.ts +136 -46
- package/src/config/bindings.test.ts +1 -1
- package/src/config/bindings.ts +1 -1
- package/src/config/bootstrap.test.ts +1 -1
- package/src/config/bootstrap.ts +36 -4
- package/src/config/context.test.ts +1 -1
- package/src/config/context.ts +1 -1
- package/src/config/entry.ts +1 -1
- package/src/config/file.test.ts +1 -1
- package/src/config/file.ts +3 -3
- package/src/config/manifest.ts +1 -1
- package/src/config/resolve.test.ts +1 -1
- package/src/config/resolve.ts +1 -1
- package/src/config/schema.ts +1 -1
- package/src/config/validate.ts +1 -1
- package/src/{install → configure/artifacts}/binary-placement.test.ts +1 -1
- package/src/{install → configure/artifacts}/binary-placement.ts +1 -1
- package/src/{install → configure/artifacts}/gh-release-update.ts +1 -1
- package/src/{install → configure/artifacts}/install-validate.test.ts +3 -3
- package/src/{install → configure/artifacts}/mcp-config.ts +1 -1
- package/src/{install → configure/artifacts}/mcp-opencode.test.ts +1 -1
- package/src/{install → configure/artifacts}/mcp-opencode.ts +1 -1
- package/src/{install → configure/artifacts}/paths.ts +5 -5
- package/src/configure/artifacts/plan.ts +24 -0
- package/src/{install → configure/artifacts}/status.test.ts +1 -1
- package/src/{install → configure/artifacts}/status.ts +2 -2
- package/src/{install → configure/artifacts}/target-base.ts +1 -1
- package/src/{install → configure/artifacts}/target-detect.ts +1 -1
- package/src/{install → configure/artifacts}/target-effective.ts +3 -9
- package/src/{install → configure/artifacts}/target-mcp-cli.ts +1 -1
- package/src/{install → configure/artifacts}/target-mcp-json.ts +1 -1
- package/src/{install → configure/artifacts}/target-plan-build.ts +2 -2
- package/src/{install → configure/artifacts}/target-registry.ts +2 -2
- package/src/{install → configure/artifacts}/target-scope.ts +3 -3
- package/src/{install → configure/artifacts}/target-skill.ts +1 -1
- package/src/{install → configure/artifacts}/target-types.ts +2 -2
- package/src/{install → configure/artifacts}/targets/app.ts +5 -5
- package/src/{install → configure/artifacts}/targets/chatgpt-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/claude-code-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/claude-desktop-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/claude-skill.ts +2 -2
- package/src/{install → configure/artifacts}/targets/codex-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/codex-skill.ts +2 -2
- package/src/{install → configure/artifacts}/targets/configure.ts +5 -5
- package/src/{install → configure/artifacts}/targets/cursor-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/cursor-skill.ts +2 -2
- package/src/{install → configure/artifacts}/targets/index.ts +1 -1
- package/src/{install → configure/artifacts}/targets/openclaw-mcp.ts +2 -2
- package/src/{install → configure/artifacts}/targets/openclaw-skill.ts +3 -3
- package/src/{install → configure/artifacts}/targets/opencode-mcp.ts +5 -5
- package/src/{install → configure/artifacts}/targets/opencode-skill.ts +3 -3
- package/src/{install → configure/artifacts}/targets.test.ts +1 -1
- package/src/{install → configure/artifacts}/uninstall.ts +1 -1
- package/src/configure/configure.test.ts +11 -11
- package/src/configure/index.ts +14 -14
- package/src/configure/prompt.ts +2 -2
- package/src/{context.ts → core/context.ts} +26 -20
- package/src/{json-leaf.test.ts → core/json-leaf.test.ts} +4 -4
- package/src/{leaf-inputs.test.ts → core/leaf-inputs.test.ts} +7 -7
- package/src/{leaf-inputs.ts → core/leaf-inputs.ts} +16 -12
- package/src/{parse.test.ts → core/parse.test.ts} +97 -109
- package/src/{parse.ts → core/parse.ts} +129 -31
- package/src/{schema.ts → core/schema.ts} +25 -13
- package/src/{types.ts → core/types.ts} +225 -35
- package/src/{validate.ts → core/validate.ts} +39 -29
- package/src/docs/builtin.ts +8 -19
- package/src/docs/{api-guide.test.ts → cli-guide.test.ts} +21 -21
- package/src/docs/{api-guide.ts → cli-guide.ts} +45 -16
- package/src/docs/docs.test.ts +76 -41
- package/src/docs/http-guide.ts +37 -34
- package/src/docs/mcp-guide.ts +12 -14
- package/src/docs/mcp-resources.test.ts +2 -3
- package/src/docs/mcp-resources.ts +6 -11
- package/src/docs/resolve.ts +22 -30
- package/src/docs/save.ts +3 -3
- package/src/exports/cli.ts +47 -0
- package/src/exports/headless.ts +13 -0
- package/src/exports/http.ts +6 -0
- package/src/exports/mcp.ts +6 -0
- package/src/{headless.test.ts → headless/routing.test.ts} +3 -3
- package/src/{headless.ts → headless/routing.ts} +3 -3
- package/src/headless/tool-call.ts +114 -46
- package/src/help.test.ts +152 -0
- package/src/help.ts +3 -3
- package/src/hooks/builtin.ts +20 -0
- package/src/hooks/run.ts +142 -0
- package/src/http/openapi.ts +182 -0
- package/src/http/readiness.ts +78 -0
- package/src/{api → http}/result.ts +16 -5
- package/src/http/routes.ts +329 -0
- package/src/http/server.ts +225 -0
- package/src/index.ts +36 -25
- package/src/log/ecs.test.ts +43 -0
- package/src/log/ecs.ts +59 -0
- package/src/log/emitter.ts +166 -0
- package/src/mcp/bundle.ts +2 -2
- package/src/mcp/claude.test.ts +1 -1
- package/src/mcp/claude.ts +4 -4
- package/src/{hidden-mcpb.test.ts → mcp/hidden-mcpb.test.ts} +10 -9
- package/src/mcp/result.ts +2 -2
- package/src/mcp/server.ts +54 -6
- package/src/mcp/tools.ts +9 -20
- package/src/{capabilities.ts → runtime/capabilities.ts} +11 -11
- package/src/{cli-errors.ts → runtime/cli-errors.ts} +4 -4
- package/src/{cli.ts → runtime/cli.ts} +159 -49
- package/src/runtime/exposure.ts +102 -0
- package/src/{invoke.test.ts → runtime/invoke.test.ts} +31 -7
- package/src/server/context.ts +25 -0
- package/src/server/overrides.ts +112 -0
- package/src/skill/generate.ts +8 -8
- package/src/skill/hint.ts +1 -1
- package/src/skill/install.ts +2 -2
- package/src/skill/naming.ts +1 -1
- package/src/{test-fixtures.ts → test/fixtures.ts} +3 -2
- package/src/{config.integration.test.ts → test/integration/config.test.ts} +8 -8
- package/src/{api.integration.test.ts → test/integration/http.test.ts} +170 -67
- package/src/{mcp.integration.test.ts → test/integration/mcp.test.ts} +11 -57
- package/docs/api-server.md +0 -141
- package/examples/full-example/docs/api.md +0 -511
- package/examples/full-example/src/commands/status/__generated__/outputSchema.json +0 -28
- package/examples/full-example/src/config/__generated__/configSchema.json +0 -40
- package/examples/full-example/src/config/__generated__/index.ts +0 -5
- package/examples/full-example/src/config/types.ts +0 -24
- package/src/api/openapi.ts +0 -117
- package/src/api/server.ts +0 -120
- package/src/builtins/api.ts +0 -38
- package/src/hidden.ts +0 -30
- package/src/install/plan.ts +0 -53
- /package/src/{install → configure/artifacts}/detect-installed.ts +0 -0
- /package/src/{install → configure/artifacts}/gh-release-update.test.ts +0 -0
- /package/src/{install → configure/artifacts}/mcp-codex.test.ts +0 -0
- /package/src/{install → configure/artifacts}/mcp-codex.ts +0 -0
- /package/src/{install → configure/artifacts}/mcp-openclaw.test.ts +0 -0
- /package/src/{install → configure/artifacts}/mcp-openclaw.ts +0 -0
- /package/src/{install → configure/artifacts}/normalize-uninstall.ts +0 -0
- /package/src/{install → configure/artifacts}/normalize.ts +0 -0
- /package/src/{install → configure/artifacts}/opts.ts +0 -0
- /package/src/{install → configure/artifacts}/shell.ts +0 -0
- /package/src/{formats.test.ts → core/formats.test.ts} +0 -0
- /package/src/{formats.ts → core/formats.ts} +0 -0
- /package/src/{respond.ts → core/respond.ts} +0 -0
- /package/src/{types.test.ts → core/types.test.ts} +0 -0
- /package/src/{api → http}/schema-deref.test.ts +0 -0
- /package/src/{api → http}/schema-deref.ts +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# HTTP API (full-example)
|
|
2
2
|
|
|
3
|
-
full-example exposes
|
|
3
|
+
full-example exposes user commands over HTTP REST routes derived from the CLI tree.
|
|
4
4
|
|
|
5
5
|
## Running
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
full-example
|
|
8
|
+
full-example http
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Listens on **http://127.0.0.1:3000** by default (`
|
|
11
|
+
Listens on **http://127.0.0.1:3000** by default (`httpServer.host` / `httpServer.port`).
|
|
12
12
|
|
|
13
13
|
Bind is localhost-only in v0 — use a reverse proxy for remote access.
|
|
14
14
|
|
|
@@ -16,59 +16,58 @@ Bind is localhost-only in v0 — use a reverse proxy for remote access.
|
|
|
16
16
|
|
|
17
17
|
| Method | Path | Purpose |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| `GET` | `/health` | Liveness check |
|
|
20
|
-
| `GET` | `/
|
|
19
|
+
| `GET` | `/health` or `/health/live` | Liveness check |
|
|
20
|
+
| `GET` | `/health/ready` | Readiness (config + `program.readiness`) |
|
|
21
|
+
| `GET` | `/openapi.json` | OpenAPI 3.1 REST paths |
|
|
21
22
|
| `GET` | `/openapi-browser` | Interactive Scalar API reference |
|
|
22
|
-
|
|
|
23
|
+
| `*` | `/api/...` | Invoke user commands (method per route) |
|
|
23
24
|
| `OPTIONS` | `*` | CORS preflight |
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
Discover paths from `openapi.json` (`/api/...`). Query binds options; POST/PUT/PATCH body binds options and `inputSchema` fields.
|
|
26
27
|
|
|
27
28
|
## Examples
|
|
28
29
|
|
|
29
30
|
```bash
|
|
30
31
|
curl -s http://127.0.0.1:3000/health
|
|
32
|
+
curl -s http://127.0.0.1:3000/health/ready
|
|
31
33
|
curl -s http://127.0.0.1:3000/openapi.json
|
|
32
|
-
curl -s
|
|
34
|
+
curl -s http://127.0.0.1:3000/api/workspaces
|
|
35
|
+
curl -s -X POST http://127.0.0.1:3000/api/workspaces \
|
|
33
36
|
-H "content-type: application/json" \
|
|
34
|
-
-d '{
|
|
37
|
+
-d '{"name":"qa2"}'
|
|
35
38
|
```
|
|
36
39
|
|
|
37
40
|
## Responses
|
|
38
41
|
|
|
39
|
-
Success
|
|
42
|
+
Success: status from handler → `http.successStatus` → method default (GET 200, POST 201, DELETE 204).
|
|
40
43
|
|
|
41
44
|
Handlers must use `ctx.respond()` or return a value for API/MCP tool calls.
|
|
42
45
|
|
|
43
46
|
Errors use `{ "error": "..." }` with `400`, `404`, `503`, or `500`.
|
|
44
47
|
|
|
45
|
-
##
|
|
48
|
+
## REST routes
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
- `POST /api/echo` (CLI: `full-example echo`) — Echo a message (MCP-friendly leaf).
|
|
51
|
+
- `POST /api/render-json` (CLI: `full-example render-json`) — Echo a JSON message (schema-first JSON leaf demo).
|
|
52
|
+
- `POST /api/status` (CLI: `full-example status`) — Show app version. (flags: --json)
|
|
53
|
+
- `GET /api/workspaces` (CLI: `full-example workspaces get`) — List workspaces.
|
|
54
|
+
- `POST /api/workspaces` (CLI: `full-example workspaces post`) — Create a workspace.
|
|
55
|
+
- `GET /api/workspaces/{id}` (CLI: `full-example workspaces :id get`) — Get one workspace.
|
|
56
|
+
- `PUT /api/workspaces/{id}` (CLI: `full-example workspaces :id put`) — Replace a workspace.
|
|
57
|
+
- `PATCH /api/workspaces/{id}` (CLI: `full-example workspaces :id patch`) — Patch a workspace name.
|
|
58
|
+
- `DELETE /api/workspaces/{id}` (CLI: `full-example workspaces :id delete`) — Delete a workspace.
|
|
48
59
|
|
|
49
|
-
|
|
60
|
+
## Request bodies
|
|
50
61
|
|
|
51
|
-
|
|
52
|
-
- **defaultRegion** (`defaultRegion`, optional) — AWS region for API calls.
|
|
53
|
-
- **maxRetries** (`maxRetries`, optional) — HTTP retry count (0–10).
|
|
54
|
-
- **prefs** (`prefs`, optional) — Local cache preferences (not exported to env).
|
|
62
|
+
POST/PUT/PATCH bodies are a flat JSON object keyed by long option and positional names (hyphenated option names are valid keys).
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- `echo` (MCP: `echo`, CLI: `full-example echo`) — echo — Echo a message (MCP-friendly leaf).
|
|
59
|
-
- `status` (MCP: `status`, CLI: `full-example status`) — status — Show resolved config and app version. (flags: --json)
|
|
60
|
-
|
|
61
|
-
## Tool arguments
|
|
62
|
-
|
|
63
|
-
POST bodies are a flat JSON object keyed by long option and positional names (hyphenated option names are valid keys).
|
|
64
|
-
|
|
65
|
-
For HTTP clients, use **`GET /openapi.json`** (or **`GET /openapi-browser`**) for per-tool request shapes — each `POST /tools/{name}` path has a `requestBody` schema.
|
|
64
|
+
For HTTP clients, use **`GET /openapi.json`** (or **`GET /openapi-browser`**) for per-route request shapes.
|
|
66
65
|
|
|
67
66
|
Varargs positionals accept a JSON array of strings (not a comma-separated string).
|
|
68
67
|
Options with `format: comma-list` accept a comma-separated string or JSON array.
|
|
69
68
|
Options with a schema `default` are applied when omitted.
|
|
70
69
|
|
|
71
|
-
Shell invocation reference: `full-example docs
|
|
70
|
+
Shell invocation reference: `full-example docs cli`. Full CLI tree JSON: `full-example docs cli-schema`.
|
|
72
71
|
|
|
73
72
|
## OpenAPI
|
|
74
73
|
|
|
@@ -78,4 +77,4 @@ The HTTP API is described in OpenAPI 3.1.
|
|
|
78
77
|
- **Fetch** — `curl -s http://127.0.0.1:3000/openapi.json`
|
|
79
78
|
- **Save offline** — `full-example docs openapi --save` → `./docs/openapi.json` (or `just docgen` in app repos)
|
|
80
79
|
|
|
81
|
-
Use the spec to discover
|
|
80
|
+
Use the spec to discover REST paths and request/response shapes before calling `/api/...`.
|
|
@@ -109,27 +109,6 @@ full-example mcp
|
|
|
109
109
|
|
|
110
110
|
- **`shellEnv`** — on by default; captures login-shell environment at MCP startup (PATH, toolchain shims, exports). Opt out with `shellEnv: false`.
|
|
111
111
|
|
|
112
|
-
## Configuration
|
|
113
|
-
|
|
114
|
-
Configure before first use in Cursor or Claude Desktop (MCP hosts are non-interactive): `full-example configure`.
|
|
115
|
-
|
|
116
|
-
Default config file: `~/.local/lib/full_example/config.json` (flat JSON keys).
|
|
117
|
-
|
|
118
|
-
- **apiToken** (`apiToken`, required → env `FULL_EXAMPLE_API_TOKEN`) — Create at https://example.com/settings/tokens
|
|
119
|
-
- **defaultRegion** (`defaultRegion`, optional) — AWS region for API calls.
|
|
120
|
-
- **maxRetries** (`maxRetries`, optional) — HTTP retry count (0–10).
|
|
121
|
-
- **prefs** (`prefs`, optional) — Local cache preferences (not exported to env).
|
|
122
|
-
|
|
123
|
-
Example:
|
|
124
|
-
|
|
125
|
-
```typescript
|
|
126
|
-
config: {
|
|
127
|
-
schema: {
|
|
128
|
-
apiToken: { description: "…", env: "API_TOKEN", sensitive: true },
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
```
|
|
132
|
-
|
|
133
112
|
## What agents get
|
|
134
113
|
|
|
135
114
|
| Mechanism | Purpose |
|
|
@@ -142,7 +121,14 @@ config: {
|
|
|
142
121
|
## Exposed tools
|
|
143
122
|
|
|
144
123
|
- `full-example echo` — echo — Echo a message (MCP-friendly leaf).
|
|
145
|
-
- `full-example
|
|
124
|
+
- `full-example render-json` — render-json — Echo a JSON message (schema-first JSON leaf demo).
|
|
125
|
+
- `full-example status` — status — Show app version. (flags: --json)
|
|
126
|
+
- `full-example workspaces get` — workspaces get — List workspaces.
|
|
127
|
+
- `full-example workspaces post` — workspaces post — Create a workspace.
|
|
128
|
+
- `full-example workspaces :id get` — workspaces :id get — Get one workspace.
|
|
129
|
+
- `full-example workspaces :id put` — workspaces :id put — Replace a workspace.
|
|
130
|
+
- `full-example workspaces :id patch` — workspaces :id patch — Patch a workspace name.
|
|
131
|
+
- `full-example workspaces :id delete` — workspaces :id delete — Delete a workspace.
|
|
146
132
|
|
|
147
133
|
## Tool arguments
|
|
148
134
|
|