argsbarg 2.0.1 → 2.1.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 +12 -1
- package/README.md +4 -4
- package/docs/ai-skills.md +1 -1
- package/docs/install.md +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/builtins/builtins.test.ts +13 -23
- package/src/builtins/dispatch.ts +0 -7
- package/src/builtins/install.ts +1 -2
- package/src/capabilities.ts +5 -3
- package/src/index.test.ts +1 -1
- package/src/runtime.ts +2 -3
- package/src/types.ts +2 -2
- package/src/install/compiled.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.1.1] - 2026-06-20
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **`install` built-in** — no longer gated on compiled binaries; available whenever `install.enabled !== false` (default on). Removed `isCompiledExecutable()` and `src/install/compiled.ts`.
|
|
15
|
+
|
|
16
|
+
## [2.1.0] - 2026-06-20
|
|
17
|
+
|
|
18
|
+
|
|
10
19
|
## [2.0.1] - 2026-06-20
|
|
11
20
|
|
|
12
21
|
### Removed
|
|
@@ -177,7 +186,9 @@ const cli = { ... } satisfies CliProgram; // or : CliProgram
|
|
|
177
186
|
- 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`).
|
|
178
187
|
- Imports: use `CliPositional` where needed; replace `CliOptionDef` with `CliOption` or `CliPositional` as appropriate.
|
|
179
188
|
|
|
180
|
-
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v2.
|
|
189
|
+
[Unreleased]: https://github.com/bdombro/bun-argsbarg/compare/v2.1.1...HEAD
|
|
190
|
+
[2.1.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v2.1.1
|
|
191
|
+
[2.1.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v2.1.0
|
|
181
192
|
[2.0.1]: https://github.com/bdombro/bun-argsbarg/releases/tag/v2.0.1
|
|
182
193
|
[2.0.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v2.0.0
|
|
183
194
|
[1.5.0]: https://github.com/bdombro/bun-argsbarg/releases/tag/v1.5.0
|
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Every app gets:
|
|
|
97
97
|
- **`--schema`** at the program root — print the full command tree as JSON (for tooling and agents).
|
|
98
98
|
- **`completion bash` / `completion zsh` / `completion fish`** — print shell completion scripts to stdout (injected by `cliRun`).
|
|
99
99
|
- **`mcp`** — when `mcpServer` is set on the program root, run as an MCP stdio server (`myapp mcp`).
|
|
100
|
-
- **`install`** —
|
|
100
|
+
- **`install`** — install the binary, completions, skills, and MCP config to the user environment (`myapp install --all --yes`). See [docs/install.md](docs/install.md).
|
|
101
101
|
|
|
102
102
|
Do not declare a top-level command named **`completion`** or **`install`** — they are reserved.
|
|
103
103
|
When **`mcpServer`** is set, do not declare a top-level command named **`mcp`** — it is reserved for the MCP built-in.
|
|
@@ -110,9 +110,9 @@ Opt in on the program root with `mcpServer: {}` (or `{ name, version, … }`), t
|
|
|
110
110
|
|
|
111
111
|
See **[docs/mcp.md](docs/mcp.md)** for configuration, env bootstrapping, custom resources, Cursor setup, and protocol details.
|
|
112
112
|
|
|
113
|
-
### Install
|
|
113
|
+
### Install
|
|
114
114
|
|
|
115
|
-
After `bun build --compile
|
|
115
|
+
After `bun build --compile` (or when running via `bun`), ship your CLI and let users run:
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
118
|
myapp install --all --yes
|
|
@@ -185,7 +185,7 @@ Add `CliPositional` entries to the command’s `positionals` list (separate from
|
|
|
185
185
|
|
|
186
186
|
### Capabilities (built-ins)
|
|
187
187
|
|
|
188
|
-
`completion`, `install`, and `mcp` are not part of your schema — they are injected at runtime from program-level config (`mcpServer`,
|
|
188
|
+
`completion`, `install`, and `mcp` are not part of your schema — they are injected at runtime from program-level config (`mcpServer`, `install`). Reserved command names follow from that config: `completion` and `install` are always reserved unless `install.enabled: false`; `mcp` is reserved when `mcpServer` is set.
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
|
package/docs/ai-skills.md
CHANGED
|
@@ -4,7 +4,7 @@ ArgsBarg can generate Cursor and Claude Code skill directories (`SKILL.md` + `re
|
|
|
4
4
|
|
|
5
5
|
## Install via `install` (recommended)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Install skills to the user environment:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
myapp install --skill --yes
|
package/docs/install.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Install command
|
|
2
2
|
|
|
3
|
-
The `install` built-in
|
|
3
|
+
The `install` built-in installs the binary, shell completions, agent skills, and MCP config. Opt out with `install: { enabled: false }` on the program root.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
package/index.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface CliMcpToolConfig {
|
|
|
166
166
|
requiresEnv?: string[];
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
* Opt-out and defaults for the `install` built-in (
|
|
169
|
+
* Opt-out and defaults for the `install` built-in (program root only).
|
|
170
170
|
*/
|
|
171
171
|
export interface CliInstallConfig {
|
|
172
172
|
/** When `false`, hide/disable `install` (default: enabled). */
|
|
@@ -220,7 +220,7 @@ export type CliNode = CliLeaf | CliRouter;
|
|
|
220
220
|
export type CliProgram = CliNode & {
|
|
221
221
|
/** When set, enables the `mcp` built-in subcommand. */
|
|
222
222
|
mcpServer?: CliMcpServerConfig;
|
|
223
|
-
/** Opt-out and defaults for `install
|
|
223
|
+
/** Opt-out and defaults for `install`. */
|
|
224
224
|
install?: CliInstallConfig;
|
|
225
225
|
};
|
|
226
226
|
/**
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { describe, expect, test
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
2
|
import { cliBuiltinInstallCommand, installBuiltinOptions } from "./install.ts";
|
|
3
3
|
import { cliBuiltinMcpCommand } from "./mcp.ts";
|
|
4
4
|
import { cliPresentationRoot } from "./presentation.ts";
|
|
5
5
|
import { completionBashScript, completionFishScript, completionZshScript } from "./index.ts";
|
|
6
6
|
import { exportPresentationBuiltins } from "./export.ts";
|
|
7
7
|
import { CliProgram } from "../types.ts";
|
|
8
|
-
import { setCompiledExecutableOverride } from "../install/compiled.ts";
|
|
9
8
|
|
|
10
9
|
const fixture: CliProgram = {
|
|
11
10
|
key: "myapp",
|
|
@@ -20,16 +19,11 @@ const fixture: CliProgram = {
|
|
|
20
19
|
],
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
setCompiledExecutableOverride(null);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
22
|
describe("builtins help copy", () => {
|
|
28
|
-
test("install command includes description and option text
|
|
29
|
-
setCompiledExecutableOverride(true);
|
|
23
|
+
test("install command includes description and option text", () => {
|
|
30
24
|
const install = cliBuiltinInstallCommand(fixture);
|
|
31
25
|
expect(install.description).toContain("Install the binary");
|
|
32
|
-
expect(install.notes).toContain("
|
|
26
|
+
expect(install.notes).toContain("install --all");
|
|
33
27
|
const names = installBuiltinOptions(fixture).map((o) => o.name);
|
|
34
28
|
expect(names).toContain("all");
|
|
35
29
|
expect(names).toContain("mcp");
|
|
@@ -37,7 +31,6 @@ describe("builtins help copy", () => {
|
|
|
37
31
|
});
|
|
38
32
|
|
|
39
33
|
test("install omits --mcp option when mcpServer unset", () => {
|
|
40
|
-
setCompiledExecutableOverride(true);
|
|
41
34
|
const noMcp: CliProgram = { key: "x", description: "x", handler: () => {} };
|
|
42
35
|
const names = installBuiltinOptions(noMcp).map((o) => o.name);
|
|
43
36
|
expect(names).not.toContain("mcp");
|
|
@@ -51,23 +44,22 @@ describe("builtins help copy", () => {
|
|
|
51
44
|
});
|
|
52
45
|
|
|
53
46
|
describe("presentation root", () => {
|
|
54
|
-
test("includes mcp when
|
|
55
|
-
setCompiledExecutableOverride(false);
|
|
47
|
+
test("includes mcp and install when enabled", () => {
|
|
56
48
|
const root = cliPresentationRoot(fixture);
|
|
57
|
-
|
|
58
|
-
expect(
|
|
49
|
+
const keys = root.commands?.map((c) => c.key) ?? [];
|
|
50
|
+
expect(keys).toContain("mcp");
|
|
51
|
+
expect(keys).toContain("install");
|
|
59
52
|
});
|
|
60
53
|
|
|
61
|
-
test("
|
|
62
|
-
|
|
63
|
-
const root = cliPresentationRoot(
|
|
64
|
-
expect(root.commands?.map((c) => c.key)).toContain("install");
|
|
54
|
+
test("omits install when install.enabled is false", () => {
|
|
55
|
+
const disabled: CliProgram = { ...fixture, install: { enabled: false } };
|
|
56
|
+
const root = cliPresentationRoot(disabled);
|
|
57
|
+
expect(root.commands?.map((c) => c.key)).not.toContain("install");
|
|
65
58
|
});
|
|
66
59
|
});
|
|
67
60
|
|
|
68
61
|
describe("completion emitters", () => {
|
|
69
62
|
test("fish script references app key and subcommands", () => {
|
|
70
|
-
setCompiledExecutableOverride(true);
|
|
71
63
|
const schema = cliPresentationRoot(fixture);
|
|
72
64
|
const fish = completionFishScript(schema);
|
|
73
65
|
expect(fish).toContain("complete -c myapp");
|
|
@@ -75,8 +67,7 @@ describe("completion emitters", () => {
|
|
|
75
67
|
expect(fish).toContain("install");
|
|
76
68
|
});
|
|
77
69
|
|
|
78
|
-
test("bash script includes install flags
|
|
79
|
-
setCompiledExecutableOverride(true);
|
|
70
|
+
test("bash script includes install flags", () => {
|
|
80
71
|
const schema = cliPresentationRoot(fixture);
|
|
81
72
|
const bash = completionBashScript(schema);
|
|
82
73
|
expect(bash).toContain("--all");
|
|
@@ -92,8 +83,7 @@ describe("completion emitters", () => {
|
|
|
92
83
|
});
|
|
93
84
|
|
|
94
85
|
describe("schema export builtins", () => {
|
|
95
|
-
test("exportPresentationBuiltins includes install options
|
|
96
|
-
setCompiledExecutableOverride(true);
|
|
86
|
+
test("exportPresentationBuiltins includes install options", () => {
|
|
97
87
|
const builtins = exportPresentationBuiltins(fixture);
|
|
98
88
|
const install = builtins.find((b) => b.key === "install");
|
|
99
89
|
expect(install?.options?.find((o) => o.name === "all")?.description).toContain("binary");
|
package/src/builtins/dispatch.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { cliBuiltinCompletionGroup as completionGroup } from "./completion-group
|
|
|
10
10
|
import { cliPresentationRoot } from "./presentation.ts";
|
|
11
11
|
import { cliMcpServeStdio } from "../mcp.ts";
|
|
12
12
|
import { cliInstall } from "../install/index.ts";
|
|
13
|
-
import { isCompiledExecutable } from "../install/compiled.ts";
|
|
14
13
|
import type { ParseResult } from "../parse.ts";
|
|
15
14
|
import { ParseKind } from "../parse.ts";
|
|
16
15
|
|
|
@@ -71,12 +70,6 @@ export async function dispatchBuiltin(
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
if (pr.path[0] === "install") {
|
|
74
|
-
if (!isCompiledExecutable()) {
|
|
75
|
-
process.stderr.write(
|
|
76
|
-
"install is only available in compiled binaries (bun build --compile).\n",
|
|
77
|
-
);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
73
|
if (!caps.install) {
|
|
81
74
|
process.stderr.write("install is disabled. Remove install.enabled: false from the program root.\n");
|
|
82
75
|
process.exit(1);
|
package/src/builtins/install.ts
CHANGED
|
@@ -77,13 +77,12 @@ export function installBuiltinOptions(root: CliProgram): CliOption[] {
|
|
|
77
77
|
return opts;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
/** Builds the `install` built-in command
|
|
80
|
+
/** Builds the `install` built-in command. */
|
|
81
81
|
export function cliBuiltinInstallCommand(root: CliProgram): CliLeaf {
|
|
82
82
|
return {
|
|
83
83
|
key: "install",
|
|
84
84
|
description: "Install the binary, shell completions, agent skills, and MCP config to your user environment.",
|
|
85
85
|
notes:
|
|
86
|
-
"Requires a compiled binary (bun build --compile).\n\n" +
|
|
87
86
|
"First-time setup:\n" +
|
|
88
87
|
` {app} install --all --yes\n\n` +
|
|
89
88
|
"Refresh after upgrading:\n" +
|
package/src/capabilities.ts
CHANGED
|
@@ -4,7 +4,6 @@ Not exported from the public package barrel.
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { CliProgram } from "./types.ts";
|
|
7
|
-
import { isCompiledExecutable } from "./install/compiled.ts";
|
|
8
7
|
|
|
9
8
|
/** Platform builtins derived from program config and runtime. */
|
|
10
9
|
export interface CliCapabilities {
|
|
@@ -18,13 +17,16 @@ export function resolveCapabilities(program: CliProgram): CliCapabilities {
|
|
|
18
17
|
return {
|
|
19
18
|
completion: true,
|
|
20
19
|
mcp: program.mcpServer !== undefined,
|
|
21
|
-
install:
|
|
20
|
+
install: program.install?.enabled !== false,
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
/** Reserved top-level command names for the given capabilities. */
|
|
26
25
|
export function reservedCommandNames(caps: CliCapabilities): string[] {
|
|
27
|
-
const names = ["completion"
|
|
26
|
+
const names = ["completion"];
|
|
27
|
+
if (caps.install) {
|
|
28
|
+
names.push("install");
|
|
29
|
+
}
|
|
28
30
|
if (caps.mcp) {
|
|
29
31
|
names.push("mcp");
|
|
30
32
|
}
|
package/src/index.test.ts
CHANGED
|
@@ -519,7 +519,7 @@ test("--schema exports JSON for leaf roots", async () => {
|
|
|
519
519
|
expect(schema.key).toBe("minimal.ts");
|
|
520
520
|
expect(schema.positionals[0].name).toBe("name");
|
|
521
521
|
expect(schema.options[0].name).toBe("verbose");
|
|
522
|
-
expect(schema.commands.map((c: { key: string }) => c.key)).toEqual(["completion"]);
|
|
522
|
+
expect(schema.commands.map((c: { key: string }) => c.key)).toEqual(["completion", "install"]);
|
|
523
523
|
});
|
|
524
524
|
|
|
525
525
|
test("leaf root help lists completion built-in", async () => {
|
package/src/runtime.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { builtinInterceptRoot, dispatchBuiltin } from "./builtins/dispatch.ts";
|
|
|
7
7
|
import { cliPresentationRoot } from "./builtins/presentation.ts";
|
|
8
8
|
import type { CliRouter } from "./types.ts";
|
|
9
9
|
import { type CliNode, type CliProgram, isCliLeaf, isCliRouter } from "./types.ts";
|
|
10
|
-
import { isCompiledExecutable } from "./install/compiled.ts";
|
|
11
10
|
import { CliContext } from "./context.ts";
|
|
12
11
|
import { cliHelpRender } from "./help.ts";
|
|
13
12
|
import { parse, postParseValidate, ParseKind } from "./parse.ts";
|
|
@@ -37,8 +36,8 @@ export async function cliRun(program: CliProgram, argv: string[] = process.argv.
|
|
|
37
36
|
process.exit(1);
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
if (argv.length >= 1 && argv[0] === "install" && !
|
|
41
|
-
process.stderr.write("install is
|
|
39
|
+
if (argv.length >= 1 && argv[0] === "install" && !caps.install) {
|
|
40
|
+
process.stderr.write("install is disabled. Remove install.enabled: false from the program root.\n");
|
|
42
41
|
process.exit(1);
|
|
43
42
|
}
|
|
44
43
|
|
package/src/types.ts
CHANGED
|
@@ -152,7 +152,7 @@ export interface CliMcpToolConfig {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* Opt-out and defaults for the `install` built-in (
|
|
155
|
+
* Opt-out and defaults for the `install` built-in (program root only).
|
|
156
156
|
*/
|
|
157
157
|
export interface CliInstallConfig {
|
|
158
158
|
/** When `false`, hide/disable `install` (default: enabled). */
|
|
@@ -211,7 +211,7 @@ export type CliNode = CliLeaf | CliRouter;
|
|
|
211
211
|
export type CliProgram = CliNode & {
|
|
212
212
|
/** When set, enables the `mcp` built-in subcommand. */
|
|
213
213
|
mcpServer?: CliMcpServerConfig;
|
|
214
|
-
/** Opt-out and defaults for `install
|
|
214
|
+
/** Opt-out and defaults for `install`. */
|
|
215
215
|
install?: CliInstallConfig;
|
|
216
216
|
};
|
|
217
217
|
|
package/src/install/compiled.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** Test override: when set, `isCompiledExecutable()` returns this value instead of checking Bun.embeddedFiles. */
|
|
2
|
-
let compiledOverride: boolean | null = null;
|
|
3
|
-
|
|
4
|
-
/** @internal For tests only. */
|
|
5
|
-
export function setCompiledExecutableOverride(value: boolean | null): void {
|
|
6
|
-
compiledOverride = value;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/** True when running as a `bun build --compile` binary (embedded files present). */
|
|
10
|
-
export function isCompiledExecutable(): boolean {
|
|
11
|
-
if (compiledOverride !== null) {
|
|
12
|
-
return compiledOverride;
|
|
13
|
-
}
|
|
14
|
-
return (Bun.embeddedFiles?.length ?? 0) > 0;
|
|
15
|
-
}
|