@darkrymit/crunes-cli 0.7.0 → 0.7.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.
@@ -0,0 +1,67 @@
1
+ import {
2
+ init_require_shim
3
+ } from "./chunk-TPK5AGRA.js";
4
+
5
+ // src/docs/commands/args.js
6
+ init_require_shim();
7
+ async function handler() {
8
+ process.stdout.write(`# Docs: The args(builder) Export
9
+
10
+ Runes declare options, positionals, examples, and nested commands using \`export function args(builder)\`. This is executed inside a sandboxed V8 isolate context before running the rune or loading help text.
11
+
12
+ ## 1. Builder Methods Reference
13
+
14
+ - **\`.option(flags, description, defaultValue?)\`**: Declares a named flag.
15
+ - *Example*: \`b.option('-v, --verbose', 'Verbose output', false)\`
16
+ - **\`.positional(spec, description)\`**: Declares a descriptive positional parameter.
17
+ - *Example*: \`b.positional('<target>', 'Target path')\`
18
+ - *Variadic (Rest) Example*: \`b.positional('<targets...>', 'One or more target paths')\` (collects all remaining positional arguments into \`args.targets\` as an array)
19
+ - **\`.example(usage, description)\`**: Adds a CLI calling example.
20
+ - *Example*: \`b.example('crunes run my-rune hello', 'Basic call')\`
21
+ - **\`.command(name, description, callback?)\`**: Declares a recursively nested command.
22
+ - The callback receives the subcommand's own builder instance, allowing nested subcommand chains.
23
+
24
+ ## 2. Declaring Nested Subcommands (Unified Example)
25
+
26
+ To build a clean command hierarchy with nested arguments/options, define subcommand callbacks recursively:
27
+
28
+ \`\`\`javascript
29
+ export function args(b) {
30
+ return b
31
+ // Root level options
32
+ .option('--verbose', 'Verbose logs', false)
33
+
34
+ // Command: remote
35
+ .command('remote', 'Manage remote repositories', remote => {
36
+ remote
37
+ // Subcommand: remote add <name> <url> [--fetch]
38
+ .command('add', 'Add a remote repository', add => {
39
+ add
40
+ .positional('<name>', 'Remote name')
41
+ .positional('<url>', 'Remote URL')
42
+ .option('--fetch', 'Fetch immediately', true)
43
+ })
44
+ // Subcommand: remote remove <name>
45
+ .command('remove', 'Remove a remote repository', remove => {
46
+ remove
47
+ .positional('<name>', 'Remote name')
48
+ })
49
+ })
50
+ }
51
+ \`\`\`
52
+
53
+ ## 3. Sandbox Extraction & Implicit Build Gotcha
54
+ The arguments builder runs inside a strict, secure V8 isolate. Because functions (methods) cannot cross the sandbox-host boundary directly, the host automatically calls \`.build()\` inside the sandbox.
55
+
56
+ Developers can return the builder chain directly without appending \`.build()\`:
57
+ \`\`\`javascript
58
+ export function args(b) {
59
+ return b.positional('<query>', 'Query search') // Implicitly built!
60
+ }
61
+ \`\`\`
62
+
63
+ `);
64
+ }
65
+ export {
66
+ handler
67
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseSegment
3
- } from "./chunk-ZXIP4Z5V.js";
3
+ } from "./chunk-AIEWOUXT.js";
4
4
  import {
5
5
  runRune
6
- } from "./chunk-QLDB3FO2.js";
6
+ } from "./chunk-6I7RHSAA.js";
7
7
  import "./chunk-67I2J474.js";
8
8
  import "./chunk-XXUNHQIB.js";
9
9
  import "./chunk-NXSDVVTW.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRune
3
- } from "./chunk-QLDB3FO2.js";
3
+ } from "./chunk-6I7RHSAA.js";
4
4
  import "./chunk-67I2J474.js";
5
5
  import "./chunk-XXUNHQIB.js";
6
6
  import "./chunk-NXSDVVTW.js";
@@ -11682,7 +11682,7 @@ var utils_api_default = {
11682
11682
  },
11683
11683
  {
11684
11684
  kind: "code",
11685
- text: "`undefined`"
11685
+ text: "`null`"
11686
11686
  },
11687
11687
  {
11688
11688
  kind: "text",
@@ -11691,8 +11691,11 @@ var utils_api_default = {
11691
11691
  ]
11692
11692
  },
11693
11693
  type: {
11694
- type: "intrinsic",
11695
- name: "string"
11694
+ type: "array",
11695
+ elementType: {
11696
+ type: "intrinsic",
11697
+ name: "string"
11698
+ }
11696
11699
  }
11697
11700
  }
11698
11701
  ]
@@ -71438,18 +71438,30 @@ function buildYargsConfig(schema) {
71438
71438
  return cfg;
71439
71439
  }
71440
71440
  function mapPositionals(parsed, positionals, offset = 0) {
71441
- if (!positionals) return;
71442
- for (let i = 0; i < positionals.length; i++) {
71443
- const spec = positionals[i].spec;
71444
- const match2 = spec.match(/^[<\[]([a-zA-Z0-9_-]+)[>\]]$/);
71445
- if (match2) {
71446
- const key = match2[1];
71447
- const val = parsed._[i + offset];
71448
- if (val !== void 0) {
71449
- parsed[key] = val;
71441
+ let consumedCount = 0;
71442
+ parsed.$rest = [];
71443
+ if (positionals && positionals.length > 0) {
71444
+ for (let i = 0; i < positionals.length; i++) {
71445
+ const spec = positionals[i].spec;
71446
+ const varMatch = spec.match(/^[<\[]([a-zA-Z0-9_-]+)\.\.\.[>\]]$/);
71447
+ if (varMatch) {
71448
+ const key = varMatch[1];
71449
+ parsed[key] = parsed._.slice(i + offset);
71450
+ consumedCount = parsed._.length;
71451
+ break;
71452
+ }
71453
+ const match2 = spec.match(/^[<\[]([a-zA-Z0-9_-]+)[>\]]$/);
71454
+ if (match2) {
71455
+ const key = match2[1];
71456
+ const val = parsed._[i + offset];
71457
+ if (val !== void 0) {
71458
+ parsed[key] = val;
71459
+ consumedCount = i + 1;
71460
+ }
71450
71461
  }
71451
71462
  }
71452
71463
  }
71464
+ parsed.$rest = parsed._.slice(offset + consumedCount);
71453
71465
  }
71454
71466
  function parseArgs(rawArgs, schema) {
71455
71467
  if (!schema) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  require_micromatch,
3
3
  runRune
4
- } from "./chunk-QLDB3FO2.js";
4
+ } from "./chunk-6I7RHSAA.js";
5
5
  import {
6
6
  loadConfig
7
7
  } from "./chunk-H3BVJCIL.js";
@@ -13,6 +13,13 @@ function formatCommands(commands, depth = 0) {
13
13
  const posSpecs = (cmd.positionals ?? []).map((p) => p.spec).join(" ");
14
14
  const cmdStr = `${cmd.name}${posSpecs ? " " + posSpecs : ""}`;
15
15
  lines.push(`${indent}${cmdStr.padEnd(30 - depth * 2)} ${cmd.description ?? ""}`.trimEnd());
16
+ const cmdPos = cmd.positionals ?? [];
17
+ if (cmdPos.length > 0) {
18
+ lines.push(`${childIndent}Positionals:`);
19
+ for (const p of cmdPos) {
20
+ lines.push(`${detailIndent}${p.spec.padEnd(26)} ${p.description ?? ""}`.trimEnd());
21
+ }
22
+ }
16
23
  const cmdOpts = cmd.options ?? [];
17
24
  if (cmdOpts.length > 0) {
18
25
  lines.push(`${childIndent}Options:`);
@@ -33,6 +33,7 @@ function templateStub(name) {
33
33
  ``,
34
34
  `export async function run(args) {`,
35
35
  ` // args._ \u2014 data positionals (command tokens stripped)`,
36
+ ` // args.$rest \u2014 unmapped positional arguments`,
36
37
  ` // args.verbose \u2014 named flag (if args export is defined above)`,
37
38
  ` // utils.fs.cwd() \u2014 absolute path to the project root`,
38
39
  ``,
@@ -36,6 +36,7 @@ function template(key, format) {
36
36
  ``,
37
37
  `export async function run(args) {`,
38
38
  ` // args._ \u2014 data positionals (command tokens stripped)`,
39
+ ` // args.$rest \u2014 unmapped positional arguments`,
39
40
  ` // args.verbose \u2014 named flag (if args export is defined above)`,
40
41
  ` // utils.fs.cwd() \u2014 absolute path to the project root`
41
42
  ].join("\n");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  utils_api_default
3
- } from "./chunk-BVY5LN7X.js";
3
+ } from "./chunk-5RGDIMK6.js";
4
4
  import {
5
5
  globals_api_default
6
6
  } from "./chunk-UGN3FFEF.js";
@@ -11,11 +11,11 @@ import {
11
11
  } from "./chunk-XIXND2M4.js";
12
12
  import {
13
13
  formatHelp
14
- } from "./chunk-HOH7WZX4.js";
14
+ } from "./chunk-BEVULQIG.js";
15
15
  import {
16
16
  computeEffectivePermissions,
17
17
  getArgsSchema
18
- } from "./chunk-QLDB3FO2.js";
18
+ } from "./chunk-6I7RHSAA.js";
19
19
  import "./chunk-67I2J474.js";
20
20
  import "./chunk-XXUNHQIB.js";
21
21
  import "./chunk-NXSDVVTW.js";
@@ -423,7 +423,7 @@ var lifecycle_api_default = {
423
423
  summary: [
424
424
  {
425
425
  kind: "text",
426
- text: "Positional argument specification (e.g., '<name>' for required, '[name]' for optional)."
426
+ text: "Positional argument specification (e.g., '<name>' for required, '[name]' for optional, '<targets...>' or '[targets...]' for variadic rest arrays)."
427
427
  }
428
428
  ]
429
429
  },
@@ -511,7 +511,7 @@ var lifecycle_api_default = {
511
511
  }
512
512
  },
513
513
  {
514
- id: 35,
514
+ id: 36,
515
515
  name: "$command",
516
516
  variant: "declaration",
517
517
  kind: 1024,
@@ -532,7 +532,7 @@ var lifecycle_api_default = {
532
532
  }
533
533
  },
534
534
  {
535
- id: 36,
535
+ id: 37,
536
536
  name: "$commands",
537
537
  variant: "declaration",
538
538
  kind: 1024,
@@ -556,7 +556,7 @@ var lifecycle_api_default = {
556
556
  }
557
557
  },
558
558
  {
559
- id: 34,
559
+ id: 35,
560
560
  name: "$raw",
561
561
  variant: "declaration",
562
562
  kind: 1024,
@@ -576,6 +576,28 @@ var lifecycle_api_default = {
576
576
  name: "string"
577
577
  }
578
578
  }
579
+ },
580
+ {
581
+ id: 34,
582
+ name: "$rest",
583
+ variant: "declaration",
584
+ kind: 1024,
585
+ flags: {},
586
+ comment: {
587
+ summary: [
588
+ {
589
+ kind: "text",
590
+ text: "Positional arguments not mapped to any named parameters."
591
+ }
592
+ ]
593
+ },
594
+ type: {
595
+ type: "array",
596
+ elementType: {
597
+ type: "intrinsic",
598
+ name: "string"
599
+ }
600
+ }
579
601
  }
580
602
  ],
581
603
  groups: [
@@ -583,22 +605,23 @@ var lifecycle_api_default = {
583
605
  title: "Properties",
584
606
  children: [
585
607
  33,
586
- 35,
587
608
  36,
609
+ 37,
610
+ 35,
588
611
  34
589
612
  ]
590
613
  }
591
614
  ],
592
615
  indexSignatures: [
593
616
  {
594
- id: 37,
617
+ id: 38,
595
618
  name: "__index",
596
619
  variant: "signature",
597
620
  kind: 8192,
598
621
  flags: {},
599
622
  parameters: [
600
623
  {
601
- id: 38,
624
+ id: 39,
602
625
  name: "key",
603
626
  variant: "param",
604
627
  kind: 32768,
@@ -1034,14 +1057,19 @@ var lifecycle_api_default = {
1034
1057
  "34": {
1035
1058
  packageName: "@darkrymit/crunes-cli",
1036
1059
  packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
1037
- qualifiedName: "lifecycle.ParsedArgs.$raw"
1060
+ qualifiedName: "lifecycle.ParsedArgs.$rest"
1038
1061
  },
1039
1062
  "35": {
1040
1063
  packageName: "@darkrymit/crunes-cli",
1041
1064
  packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
1042
- qualifiedName: "lifecycle.ParsedArgs.$command"
1065
+ qualifiedName: "lifecycle.ParsedArgs.$raw"
1043
1066
  },
1044
1067
  "36": {
1068
+ packageName: "@darkrymit/crunes-cli",
1069
+ packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
1070
+ qualifiedName: "lifecycle.ParsedArgs.$command"
1071
+ },
1072
+ "37": {
1045
1073
  packageName: "@darkrymit/crunes-cli",
1046
1074
  packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
1047
1075
  qualifiedName: "lifecycle.ParsedArgs.$commands"
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DMMC4X27.js";
4
4
  import {
5
5
  getRune
6
- } from "./chunk-QLDB3FO2.js";
6
+ } from "./chunk-6I7RHSAA.js";
7
7
  import "./chunk-67I2J474.js";
8
8
  import "./chunk-XXUNHQIB.js";
9
9
  import "./chunk-NXSDVVTW.js";
@@ -2,8 +2,8 @@ import {
2
2
  handler,
3
3
  parseRunArgs,
4
4
  parseSegment
5
- } from "./chunk-ZXIP4Z5V.js";
6
- import "./chunk-QLDB3FO2.js";
5
+ } from "./chunk-AIEWOUXT.js";
6
+ import "./chunk-6I7RHSAA.js";
7
7
  import "./chunk-67I2J474.js";
8
8
  import "./chunk-XXUNHQIB.js";
9
9
  import "./chunk-NXSDVVTW.js";
@@ -0,0 +1,93 @@
1
+ import {
2
+ init_require_shim
3
+ } from "./chunk-TPK5AGRA.js";
4
+
5
+ // src/docs/commands/run.js
6
+ init_require_shim();
7
+ async function handler() {
8
+ process.stdout.write(`# Docs: The run(args) Export
9
+
10
+ The entrypoint \`export async function run(args)\` executes the rune's main script lifecycle, receiving a parsed, type-coerced arguments object.
11
+
12
+ ## 1. Parsed Arguments Structure
13
+
14
+ Inside \`run(args)\`, the \`args\` parameter contains:
15
+ - **\`args.$command\`** *(string)*: The space-separated matched command path (e.g. \`"remote add"\` or \`""\` for the root).
16
+ - **\`args.$commands\`** *(string[])*: The array of matched command levels (e.g. \`["remote", "add"]\` or \`[]\` for the root).
17
+ - **\`args._\`** *(string[])*: All data positionals (command tokens are stripped, so \`args._[0]\` is always the first positional argument after the matched command path).
18
+ - **\`args.$rest\`** *(string[])*: Unmapped positional arguments that were not bound to named positionals.
19
+ - **\`args.$raw\`** *(string[])*: The exact raw string array before parsing.
20
+ - **Named Options/Positionals**: Automatically mapped values from flags and positionals.
21
+
22
+ ## 2. Parameter Mapping (Unified Example)
23
+
24
+ Consider a rune configured with the following command structure:
25
+ \`\`\`
26
+ my-rune [--verbose] remote add <name> <url> [--fetch]
27
+ \`\`\`
28
+
29
+ When a user runs the command:
30
+ \`\`\`bash
31
+ crunes run my-rune remote add origin https://github.com/foo/bar.git --fetch
32
+ \`\`\`
33
+
34
+ The parsed \`args\` object will look like this:
35
+ \`\`\`json
36
+ {
37
+ "$command": "remote add",
38
+ "$commands": ["remote", "add"],
39
+ "name": "origin",
40
+ "url": "https://github.com/foo/bar.git",
41
+ "fetch": true,
42
+ "verbose": false,
43
+ "_": ["origin", "https://github.com/foo/bar.git"],
44
+ "$rest": [],
45
+ "$raw": ["remote", "add", "origin", "https://github.com/foo/bar.git", "--fetch"]
46
+ }
47
+ \`\`\`
48
+
49
+ ## 3. Subcommand Routing in run(args)
50
+
51
+ You can route your code execution based on the matched command path in \`args.$command\`:
52
+
53
+ \`\`\`javascript
54
+ import { section } from '@utils'
55
+
56
+ export async function run(args) {
57
+ // 1. Root level command logic
58
+ if (args.$command === '') {
59
+ return section.create('root', { type: 'markdown', content: 'Root command' })
60
+ }
61
+
62
+ // 2. Subcommand routing
63
+ switch (args.$command) {
64
+ case 'remote add':
65
+ // Access named positionals and options directly
66
+ return section.create('remote', {
67
+ type: 'markdown',
68
+ content: \`Adding remote \${args.name} at \${args.url} (fetch: \${args.fetch})\`
69
+ })
70
+
71
+ case 'remote remove':
72
+ return section.create('remote', {
73
+ type: 'markdown',
74
+ content: \`Removing remote \${args.name}\`
75
+ })
76
+
77
+ default:
78
+ throw new Error(\`Unknown command: \${args.$command}\`)
79
+ }
80
+ }
81
+ \`\`\`
82
+
83
+ ## 4. Strict 3-Tier Parsing Boundary
84
+ 1. **Global Flags**: Scoped to the process prefix (e.g. \`crunes --cwd ./project\`).
85
+ 2. **Command Flags**: Scoped to the command (e.g. \`run --format json\`).
86
+ 3. **Rune Arguments**: Scoped after the rune key (e.g. \`myrune remote add origin --verbose\`).
87
+ Placing global or command flags after the rune key will cause them to be passed as raw rune arguments!
88
+
89
+ `);
90
+ }
91
+ export {
92
+ handler
93
+ };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  formatHelp
3
- } from "./chunk-HOH7WZX4.js";
3
+ } from "./chunk-BEVULQIG.js";
4
4
  import {
5
5
  computeEffectivePermissions,
6
6
  getArgsSchema,
7
7
  getRune
8
- } from "./chunk-QLDB3FO2.js";
8
+ } from "./chunk-6I7RHSAA.js";
9
9
  import "./chunk-67I2J474.js";
10
10
  import "./chunk-XXUNHQIB.js";
11
11
  import "./chunk-NXSDVVTW.js";
@@ -28,6 +28,13 @@ import {
28
28
  // src/docs/commands/rune.js
29
29
  init_require_shim();
30
30
  import { join, relative } from "node:path";
31
+ var SUGGESTIONS = {
32
+ run: "crunes docs run",
33
+ args: "crunes docs args",
34
+ intro: "crunes docs intro",
35
+ utils: "crunes docs utils",
36
+ globals: "crunes docs globals"
37
+ };
31
38
  async function handler({ keys, format = "text", projectRoot = process.cwd(), configRoot = projectRoot }) {
32
39
  let config;
33
40
  try {
@@ -41,7 +48,11 @@ async function handler({ keys, format = "text", projectRoot = process.cwd(), con
41
48
  for (const key of keys) {
42
49
  const entry = getRune(config, key);
43
50
  if (!entry) {
44
- output.warn(`Unknown rune: "${key}"`);
51
+ if (SUGGESTIONS[key]) {
52
+ output.warn(`Unknown rune: "${key}". (Tip: Did you mean "${SUGGESTIONS[key]}"?)`);
53
+ } else {
54
+ output.warn(`Unknown rune: "${key}"`);
55
+ }
45
56
  anyFailed = true;
46
57
  continue;
47
58
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  utils_api_default
3
- } from "./chunk-BVY5LN7X.js";
3
+ } from "./chunk-5RGDIMK6.js";
4
4
  import {
5
5
  formatNode,
6
6
  walk
@@ -16,7 +16,7 @@ import path from "node:path";
16
16
  // package.json
17
17
  var package_default = {
18
18
  name: "@darkrymit/crunes-cli",
19
- version: "0.7.0",
19
+ version: "0.7.2",
20
20
  description: "CLI tool for querying crunes enrichers",
21
21
  type: "module",
22
22
  bin: {
package/dist/cli.js CHANGED
@@ -3396,7 +3396,7 @@ var program = new Command();
3396
3396
  // src/cli/program.js
3397
3397
  function buildProgram() {
3398
3398
  const program3 = new Command();
3399
- program3.name("crunes").description("CLI tool for managing context runes").version("0.7.0", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
3399
+ program3.name("crunes").description("CLI tool for managing context runes").version("0.7.2", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
3400
3400
  program3.hook("preAction", (_thisCommand, actionCommand) => {
3401
3401
  configure({ plain: !!program3.opts().plain, verbose: !!program3.opts().verbose });
3402
3402
  if (program3.opts().verbose) {
@@ -3415,17 +3415,17 @@ function buildProgram() {
3415
3415
  "after",
3416
3416
  '\nImportant: Global flags (e.g. --cwd) MUST appear before the "run" command.\n\nSyntax:\n [-b] [--section s1,s2] <key> [rune-args...] [+ [--section s] <key> [rune-args...]]...\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --section s1,s2 filter output sections (per rune, before the key)\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n\nKey prefixes:\n project:name resolve from project config only\n plugin:name resolve directly from an enabled plugin\n name auto-resolve: project config first, then plugins'
3417
3417
  ).allowUnknownOption().passThroughOptions().action(async (args) => {
3418
- const { handler, parseRunArgs } = await import("./chunks/run-I6TZX347.js");
3418
+ const { handler, parseRunArgs } = await import("./chunks/run-AUAGELWL.js");
3419
3419
  const { segments, format, failFast } = parseRunArgs(args);
3420
3420
  await handler({ segments, format, failFast, projectRoot: projectRoot(), configRoot: configRoot() });
3421
3421
  });
3422
3422
  const helpGroup = program3.command("docs").description("Show documentation for runes and other resources");
3423
3423
  helpGroup.command("rune <rune...>").description("Show usage, argument schema, and examples for one or more runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (keys, opts) => {
3424
- const { handler } = await import("./chunks/rune-TAX26NH2.js");
3424
+ const { handler } = await import("./chunks/rune-ZYEVEYID.js");
3425
3425
  await handler({ keys, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
3426
3426
  });
3427
3427
  helpGroup.command("utils [namespaces...]").description("Show function signatures and parameter docs for utils.* namespaces").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (namespaces, opts) => {
3428
- const { handler } = await import("./chunks/utils-PO3ZK53L.js");
3428
+ const { handler } = await import("./chunks/utils-JKGIWZTS.js");
3429
3429
  await handler({ namespaces, format: opts.format });
3430
3430
  });
3431
3431
  helpGroup.command("globals").description("Show injected sandbox globals and ES2020 builtins available in rune scripts").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
@@ -3433,7 +3433,7 @@ function buildProgram() {
3433
3433
  await handler({ format: opts.format });
3434
3434
  });
3435
3435
  helpGroup.command("intro").description("Generate a comprehensive introduction and context document for Crunes and the active project").option("-g, --global", "generate a global, pure-ecosystem guide (skip local project context)").option("--out <path>", "output file path (defaults to stdout)").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
3436
- const { handler } = await import("./chunks/intro-2UDWF6D4.js");
3436
+ const { handler } = await import("./chunks/intro-QVSLNH4R.js");
3437
3437
  await handler({
3438
3438
  global: !!opts.global,
3439
3439
  out: opts.out,
@@ -3443,15 +3443,15 @@ function buildProgram() {
3443
3443
  });
3444
3444
  });
3445
3445
  helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
3446
- const { handler } = await import("./chunks/args-32BVYW77.js");
3446
+ const { handler } = await import("./chunks/args-KBPMNKBI.js");
3447
3447
  await handler();
3448
3448
  });
3449
3449
  helpGroup.command("run").description("Show detailed documentation, conventions, and examples for the run(args) export").action(async () => {
3450
- const { handler } = await import("./chunks/run-MVIZQVJ6.js");
3450
+ const { handler } = await import("./chunks/run-J2A5YTTY.js");
3451
3451
  await handler();
3452
3452
  });
3453
3453
  program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
3454
- const { handler } = await import("./chunks/version-DIEA5FVV.js");
3454
+ const { handler } = await import("./chunks/version-OPTLR63W.js");
3455
3455
  await handler({ check: opts.check, plain: !!program3.opts().plain });
3456
3456
  });
3457
3457
  program3.command("doctor").description("Verify environment and project setup").action(async () => {
@@ -3459,8 +3459,8 @@ function buildProgram() {
3459
3459
  await handler({ projectRoot: projectRoot() });
3460
3460
  });
3461
3461
  program3.command("check [args...]").description("Run a rune and validate its output shape.").addHelpText("after", '\nImportant: Global flags (e.g. --cwd) MUST appear before the "check" command.\n\nSyntax:\n [--section s1,s2] <key> [rune-args...]').allowUnknownOption().passThroughOptions().action(async (args) => {
3462
- const { parseSegment } = await import("./chunks/run-I6TZX347.js");
3463
- const { handler } = await import("./chunks/check-BS6TZGRR.js");
3462
+ const { parseSegment } = await import("./chunks/run-AUAGELWL.js");
3463
+ const { handler } = await import("./chunks/check-G72VZKIP.js");
3464
3464
  const { key, sections, runeArgs } = parseSegment(args);
3465
3465
  if (!key) {
3466
3466
  const { output } = await import("./chunks/output-RJ6JSNY7.js");
@@ -3470,7 +3470,7 @@ function buildProgram() {
3470
3470
  await handler({ key, sections, runeArgs, projectRoot: projectRoot(), configRoot: configRoot() });
3471
3471
  });
3472
3472
  program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText("after", '\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] [--section s1,s2] <key> [rune-args...]').allowUnknownOption().passThroughOptions().action(async (args) => {
3473
- const { handler, parseBenchArgs } = await import("./chunks/benchmark-CLUBISCR.js");
3473
+ const { handler, parseBenchArgs } = await import("./chunks/benchmark-ATSRQIDC.js");
3474
3474
  const parsed = parseBenchArgs(args);
3475
3475
  if (!parsed.key) {
3476
3476
  const { output } = await import("./chunks/output-RJ6JSNY7.js");
@@ -3480,7 +3480,7 @@ function buildProgram() {
3480
3480
  await handler({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
3481
3481
  });
3482
3482
  program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
3483
- const { handler } = await import("./chunks/list-WUAOSO3M.js");
3483
+ const { handler } = await import("./chunks/list-OTOMCFLA.js");
3484
3484
  await handler({ format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
3485
3485
  });
3486
3486
  const jobs = program3.command("job").description("Manage background jobs");
@@ -3527,7 +3527,7 @@ function buildProgram() {
3527
3527
  await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot() });
3528
3528
  });
3529
3529
  program3.command("create [new-rune]").description("Scaffold a new rune and register it in config").addOption(new Option("--format <format>", "rune output format").choices(["tree", "markdown"])).option("--path <path>", "file path for the rune (default: .crunes/runes/<key>.js)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").action(async (key, opts) => {
3530
- const { handler } = await import("./chunks/create-5FXQYCGM.js");
3530
+ const { handler } = await import("./chunks/create-OZACMPEU.js");
3531
3531
  await handler({ key, format: opts.format, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
3532
3532
  });
3533
3533
  const plugin = program3.command("plugin").description("Manage rune plugins");
@@ -3572,7 +3572,7 @@ function buildProgram() {
3572
3572
  await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot() });
3573
3573
  });
3574
3574
  template.command("create [new-template]").description("Scaffold a new template file and register it in config").option("--path <path>", "file path for the template (default: .crunes/templates/<name>.js)").option("--name <name>", "display label shown in crunes template list (separate from the template key)").option("--description <description>", "short description of what kind of rune this template produces").action(async (name, opts) => {
3575
- const { handler } = await import("./chunks/create-O3HMODSL.js");
3575
+ const { handler } = await import("./chunks/create-GPDE2YKL.js");
3576
3576
  await handler({ name, path: opts.path, templateName: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
3577
3577
  });
3578
3578
  const marketplace = program3.command("marketplace").description("Manage plugin marketplace sources");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkrymit/crunes-cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "CLI tool for querying crunes enrichers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,42 +0,0 @@
1
- import {
2
- init_require_shim
3
- } from "./chunk-TPK5AGRA.js";
4
-
5
- // src/docs/commands/args.js
6
- init_require_shim();
7
- async function handler() {
8
- process.stdout.write(`# Docs: The args(builder) Export
9
-
10
- Runes declare options, positionals, examples, and nested commands using \`export function args(builder)\`. This is executed inside a sandboxed V8 isolate context before running the rune or loading help text.
11
-
12
- ## 1. Builder Methods Reference
13
-
14
- - **\`.option(flags, description, defaultValue?)\`**: Declares a named flag.
15
- - *Example*: \`b.option('-c, --count <number>', 'Max results', 10)\`
16
- - **\`.positional(spec, description)\`**: Declares a descriptive positional parameter.
17
- - *Example*: \`b.positional('<name>', 'Item name')\`
18
- - **\`.example(usage, description)\`**: Adds a CLI calling example.
19
- - *Example*: \`b.example('crunes run my-rune hello', 'Basic call')\`
20
- - **\`.command(name, description, callback?)\`**: Declares a recursively nested command.
21
- - *Example*:
22
- \`\`\`javascript
23
- b.command('remote', 'Manage remotes', remote => {
24
- remote.command('add', 'Add a remote repository')
25
- })
26
- \`\`\`
27
-
28
- ## 2. Sandbox Extraction & Implicit Build Gotcha
29
- The arguments builder runs inside a strict, secure V8 isolate. Because functions (methods) cannot cross the sandbox-host boundary directly, the host automatically calls \`.build()\` inside the sandbox.
30
-
31
- Developers can return the builder chain directly without appending \`.build()\`:
32
- \`\`\`javascript
33
- export function args(b) {
34
- return b.positional('<query>', 'Query search') // Implicitly built!
35
- }
36
- \`\`\`
37
-
38
- `);
39
- }
40
- export {
41
- handler
42
- };
@@ -1,36 +0,0 @@
1
- import {
2
- init_require_shim
3
- } from "./chunk-TPK5AGRA.js";
4
-
5
- // src/docs/commands/run.js
6
- init_require_shim();
7
- async function handler() {
8
- process.stdout.write(`# Docs: The run(args) Export
9
-
10
- The entrypoint \`export async function run(args)\` executes the rune's main script lifecycle, receiving a parsed, type-coerced arguments object.
11
-
12
- ## 1. Parsed Arguments Structure
13
-
14
- Inside \`run(args)\`, the \`args\` parameter contains:
15
- - **\`args.$command\`** *(string)*: The full, space-separated matched command path (e.g. \`"remote add"\`).
16
- - **\`args.$commands\`** *(string[])*: The array of matched command levels (e.g. \`["remote", "add"]\`).
17
- - **\`args._\`** *(string[])*: Data positionals only \u2014 command tokens are stripped, so \`args._[0]\` is always the first user-supplied value after the matched command.
18
- - **\`args.$raw\`** *(string[])*: The exact raw string array before parsing.
19
- - **Named Options**: Values parsed from option flags (e.g., \`args.verbose\`).
20
-
21
- ## 2. Named Positional Mapping
22
- Positional parameters defined in \`args(builder)\` are **automatically mapped** to their named keys:
23
- - **Root Level**: If you define \`.positional('<who>', ...)\` and run \`crunes run greeting "Alice"\`, you can access \`args.who\` directly!
24
- - **Subcommands**: If you define \`remote add <name> <url>\`, after matching \`remote add\` the parser maps \`args.name\` and \`args.url\` from the remaining data positionals.
25
-
26
- ## 3. Strict 3-Tier Parsing Boundary
27
- 1. **Global Flags**: Scoped to the process prefix (e.g. \`crunes --cwd ./project\`).
28
- 2. **Command Flags**: Scoped to the command (e.g. \`run --format json\`).
29
- 3. **Rune Arguments**: Scoped after the rune key (e.g. \`myrune remote add origin --verbose\`).
30
- Placing global or command flags after the rune key will cause them to be passed as raw rune arguments!
31
-
32
- `);
33
- }
34
- export {
35
- handler
36
- };