@darkrymit/crunes-cli 0.10.0 → 0.10.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.
Files changed (40) hide show
  1. package/dist/chunks/{add-MSX6XSU3.js → add-2OM5KGN5.js} +2 -3
  2. package/dist/chunks/{apply-LOIJIPLR.js → apply-GBUQQ4XF.js} +7 -4
  3. package/dist/chunks/{benchmark-3IHFP3V2.js → benchmark-5OWBATUN.js} +6 -6
  4. package/dist/chunks/{chunk-2FI6KN3C.js → chunk-3KKRNQQU.js} +5 -13
  5. package/dist/chunks/{chunk-6IC6ZJ74.js → chunk-AG4PDJSY.js} +98 -10
  6. package/dist/chunks/{chunk-SUCYDYMU.js → chunk-E7CZPAM2.js} +1 -1
  7. package/dist/chunks/{chunk-KUEMDPNG.js → chunk-EHKFHILS.js} +4 -4
  8. package/dist/chunks/{chunk-DTOYFY3Z.js → chunk-JBQXPW7P.js} +2 -2
  9. package/dist/chunks/{chunk-KSQDFE5N.js → chunk-KQMTTEJV.js} +3 -3
  10. package/dist/chunks/{chunk-H2OT7D6N.js → chunk-MOAQLHP2.js} +8 -8
  11. package/dist/chunks/{chunk-XDMMSZIL.js → chunk-MUWDZJN2.js} +1 -1
  12. package/dist/chunks/{chunk-RVBAAXRY.js → chunk-NJVPLN5D.js} +4 -4
  13. package/dist/chunks/{chunk-PBGUKXT6.js → chunk-TXCUSUZ6.js} +2291 -1812
  14. package/dist/chunks/chunk-WE4HDHFU.js +37 -0
  15. package/dist/chunks/{create-Y4LHLWGL.js → create-2CQZF53Z.js} +2 -3
  16. package/dist/chunks/{create-LPLNCOW4.js → create-3TDAFVL2.js} +130 -32
  17. package/dist/chunks/{create-DXW4YYLJ.js → create-EC6TQW7N.js} +20 -4
  18. package/dist/chunks/{disable-TITOSMXB.js → disable-FB64CSYV.js} +2 -3
  19. package/dist/chunks/{doctor-R2Y6UAY4.js → doctor-WXTY6RGK.js} +5 -5
  20. package/dist/chunks/{enable-LGTPDWPV.js → enable-UVXHTKCJ.js} +2 -3
  21. package/dist/chunks/{init-KO2HLED5.js → init-GPNC7TR5.js} +2 -3
  22. package/dist/chunks/{install-7IRUAGSF.js → install-3G7U5ZIO.js} +5 -5
  23. package/dist/chunks/{intro-JNJ6A75J.js → intro-3FSOGWPR.js} +3 -3
  24. package/dist/chunks/{list-BCCM3TLP.js → list-J2UCBYAY.js} +1 -2
  25. package/dist/chunks/{list-QVZKR3IE.js → list-JB4447YK.js} +3 -3
  26. package/dist/chunks/{list-MLKZE36K.js → list-W4JAYPAA.js} +4 -4
  27. package/dist/chunks/{repl-5GDN3RAO.js → repl-32TENE2U.js} +7 -7
  28. package/dist/chunks/{resolver-CA2A32AC.js → resolver-WN4HKKBV.js} +5 -5
  29. package/dist/chunks/{run-WL3IZBXF.js → run-WD2ZA63Z.js} +6 -6
  30. package/dist/chunks/{rune-YA4TFHTB.js → rune-TSED6W3R.js} +7 -7
  31. package/dist/chunks/{runner-QNZMBHQY.js → runner-KA3YHICN.js} +4 -2
  32. package/dist/chunks/{trust-BFIDANXD.js → trust-LXXYSF6W.js} +2 -2
  33. package/dist/chunks/{uninstall-3MWZIZVA.js → uninstall-J7JUYETA.js} +5 -5
  34. package/dist/chunks/{update-W4MJUTTW.js → update-ZJRLDCUT.js} +5 -5
  35. package/dist/chunks/{utils-B2QULX5J.js → utils-VVD4VCTC.js} +1 -1
  36. package/dist/chunks/{version-FLHI5KFS.js → version-HUA2QNMT.js} +1 -1
  37. package/dist/cli.js +28 -32
  38. package/package.json +1 -1
  39. package/dist/chunks/chunk-YKIKJHYO.js +0 -94
  40. package/dist/chunks/migrate-Y3EKMVP5.js +0 -87
@@ -4,20 +4,20 @@ import {
4
4
  parseBracketKey,
5
5
  parseRunArgs,
6
6
  parseSegment
7
- } from "./chunk-KUEMDPNG.js";
7
+ } from "./chunk-EHKFHILS.js";
8
8
  import "./chunk-MIKWIFYR.js";
9
9
  import "./chunk-CGZL5SSH.js";
10
10
  import "./chunk-WCODTMDN.js";
11
- import "./chunk-H2OT7D6N.js";
12
- import "./chunk-DTOYFY3Z.js";
11
+ import "./chunk-MOAQLHP2.js";
12
+ import "./chunk-JBQXPW7P.js";
13
13
  import "./chunk-2DNYVKBF.js";
14
- import "./chunk-XDMMSZIL.js";
15
- import "./chunk-2FI6KN3C.js";
14
+ import "./chunk-MUWDZJN2.js";
15
+ import "./chunk-3KKRNQQU.js";
16
16
  import "./chunk-UBCAZGLE.js";
17
17
  import "./chunk-MTJ2KW3V.js";
18
18
  import "./chunk-FIAFVIAN.js";
19
19
  import "./chunk-VP7YLCQP.js";
20
- import "./chunk-YKIKJHYO.js";
20
+ import "./chunk-WE4HDHFU.js";
21
21
  import "./chunk-MVCBPI4J.js";
22
22
  import "./chunk-GVMT55GH.js";
23
23
  import "./chunk-2HM5Q52B.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  enumerateRunes
3
- } from "./chunk-KSQDFE5N.js";
3
+ } from "./chunk-KQMTTEJV.js";
4
4
  import {
5
5
  getArgsSchema,
6
6
  getPluginRunePath,
7
7
  getReplSchema
8
- } from "./chunk-6IC6ZJ74.js";
8
+ } from "./chunk-AG4PDJSY.js";
9
9
  import "./chunk-UEUUOAJY.js";
10
10
  import "./chunk-4GJMCFR6.js";
11
11
  import "./chunk-7KYCYDAS.js";
@@ -18,7 +18,7 @@ import "./chunk-WCODTMDN.js";
18
18
  import {
19
19
  resolvePluginRune,
20
20
  resolveRuneFromPlugins
21
- } from "./chunk-H2OT7D6N.js";
21
+ } from "./chunk-MOAQLHP2.js";
22
22
  import {
23
23
  describeRunBlock,
24
24
  flattenCommands,
@@ -27,17 +27,17 @@ import {
27
27
  formatRuneIndex,
28
28
  getRunBlockSchema,
29
29
  selectNode
30
- } from "./chunk-DTOYFY3Z.js";
30
+ } from "./chunk-JBQXPW7P.js";
31
31
  import {
32
32
  resolveInterpreter
33
33
  } from "./chunk-2DNYVKBF.js";
34
34
  import {
35
35
  isNativeRune
36
- } from "./chunk-XDMMSZIL.js";
36
+ } from "./chunk-MUWDZJN2.js";
37
37
  import {
38
38
  getRune,
39
39
  loadConfig
40
- } from "./chunk-2FI6KN3C.js";
40
+ } from "./chunk-3KKRNQQU.js";
41
41
  import {
42
42
  isPathCommand
43
43
  } from "./chunk-UBCAZGLE.js";
@@ -49,7 +49,7 @@ import "./chunk-VP7YLCQP.js";
49
49
  import {
50
50
  blockModule,
51
51
  scopedPermissions
52
- } from "./chunk-YKIKJHYO.js";
52
+ } from "./chunk-WE4HDHFU.js";
53
53
  import {
54
54
  computeEffectivePermissions
55
55
  } from "./chunk-MVCBPI4J.js";
@@ -3,10 +3,11 @@ import {
3
3
  getArgsSchema,
4
4
  getPluginRunePath,
5
5
  getReplSchema,
6
+ resolveRuneExecCwd,
6
7
  runPluginRune,
7
8
  runRuneInIsolate,
8
9
  runRuneInRepl
9
- } from "./chunk-6IC6ZJ74.js";
10
+ } from "./chunk-AG4PDJSY.js";
10
11
  import "./chunk-UEUUOAJY.js";
11
12
  import "./chunk-4GJMCFR6.js";
12
13
  import "./chunk-7KYCYDAS.js";
@@ -14,7 +15,7 @@ import "./chunk-EO3CSXWK.js";
14
15
  import "./chunk-MIKWIFYR.js";
15
16
  import "./chunk-CGZL5SSH.js";
16
17
  import "./chunk-WCODTMDN.js";
17
- import "./chunk-YKIKJHYO.js";
18
+ import "./chunk-WE4HDHFU.js";
18
19
  import "./chunk-MVCBPI4J.js";
19
20
  import "./chunk-GVMT55GH.js";
20
21
  import "./chunk-2HM5Q52B.js";
@@ -28,6 +29,7 @@ export {
28
29
  getArgsSchema,
29
30
  getPluginRunePath,
30
31
  getReplSchema,
32
+ resolveRuneExecCwd,
31
33
  runPluginRune,
32
34
  runRuneInIsolate,
33
35
  runRuneInRepl
@@ -8,7 +8,7 @@ import {
8
8
  recordTrust,
9
9
  trustDigest,
10
10
  trustState
11
- } from "./chunk-XDMMSZIL.js";
11
+ } from "./chunk-MUWDZJN2.js";
12
12
  import "./chunk-UBCAZGLE.js";
13
13
  import {
14
14
  loadRegistry,
@@ -20,7 +20,7 @@ import {
20
20
  import "./chunk-VP7YLCQP.js";
21
21
  import {
22
22
  blockOf
23
- } from "./chunk-YKIKJHYO.js";
23
+ } from "./chunk-WE4HDHFU.js";
24
24
  import "./chunk-2Q3KLBE6.js";
25
25
  import "./chunk-55GTJG5I.js";
26
26
  import {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  uninstallPlugin
3
- } from "./chunk-RVBAAXRY.js";
4
- import "./chunk-SUCYDYMU.js";
3
+ } from "./chunk-NJVPLN5D.js";
4
+ import "./chunk-E7CZPAM2.js";
5
5
  import {
6
6
  output
7
7
  } from "./chunk-MIKWIFYR.js";
@@ -10,8 +10,8 @@ import {
10
10
  le
11
11
  } from "./chunk-CGZL5SSH.js";
12
12
  import "./chunk-WCODTMDN.js";
13
- import "./chunk-XDMMSZIL.js";
14
- import "./chunk-2FI6KN3C.js";
13
+ import "./chunk-MUWDZJN2.js";
14
+ import "./chunk-3KKRNQQU.js";
15
15
  import "./chunk-UBCAZGLE.js";
16
16
  import {
17
17
  loadRegistry,
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-MTJ2KW3V.js";
20
20
  import "./chunk-FIAFVIAN.js";
21
21
  import "./chunk-VP7YLCQP.js";
22
- import "./chunk-YKIKJHYO.js";
22
+ import "./chunk-WE4HDHFU.js";
23
23
  import "./chunk-2Q3KLBE6.js";
24
24
  import "./chunk-55GTJG5I.js";
25
25
  import {
@@ -3,15 +3,15 @@ import {
3
3
  } from "./chunk-YVN3VDRE.js";
4
4
  import {
5
5
  installPlugin
6
- } from "./chunk-RVBAAXRY.js";
7
- import "./chunk-SUCYDYMU.js";
6
+ } from "./chunk-NJVPLN5D.js";
7
+ import "./chunk-E7CZPAM2.js";
8
8
  import {
9
9
  output
10
10
  } from "./chunk-MIKWIFYR.js";
11
11
  import "./chunk-CGZL5SSH.js";
12
12
  import "./chunk-WCODTMDN.js";
13
- import "./chunk-XDMMSZIL.js";
14
- import "./chunk-2FI6KN3C.js";
13
+ import "./chunk-MUWDZJN2.js";
14
+ import "./chunk-3KKRNQQU.js";
15
15
  import "./chunk-UBCAZGLE.js";
16
16
  import {
17
17
  loadRegistry,
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-MTJ2KW3V.js";
20
20
  import "./chunk-FIAFVIAN.js";
21
21
  import "./chunk-VP7YLCQP.js";
22
- import "./chunk-YKIKJHYO.js";
22
+ import "./chunk-WE4HDHFU.js";
23
23
  import "./chunk-2Q3KLBE6.js";
24
24
  import "./chunk-55GTJG5I.js";
25
25
  import {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  utils_api_default
3
- } from "./chunk-PBGUKXT6.js";
3
+ } from "./chunk-TXCUSUZ6.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.10.0",
19
+ version: "0.10.2",
20
20
  description: "CLI tool for querying crunes enrichers",
21
21
  type: "module",
22
22
  bin: {
package/dist/cli.js CHANGED
@@ -3397,7 +3397,7 @@ var program = new Command();
3397
3397
  // src/cli/program.js
3398
3398
  function buildProgram() {
3399
3399
  const program3 = new Command();
3400
- program3.name("crunes").description("CLI tool for managing context runes").version("0.10.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");
3400
+ program3.name("crunes").description("CLI tool for managing context runes").version("0.10.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");
3401
3401
  program3.hook("preAction", (_thisCommand, actionCommand) => {
3402
3402
  const opts = { ...program3.opts(), ...actionCommand.opts() };
3403
3403
  configure({ plain: !!opts.plain, verbose: !!opts.verbose });
@@ -3417,7 +3417,7 @@ function buildProgram() {
3417
3417
  "after",
3418
3418
  '\nImportant: Global flags (e.g. --cwd) MUST appear before the "run" command.\n\nSyntax:\n [run-flags] <key>[-s s1,s2] [rune-args...]\n -b [run-flags] <key1>[-s s1] [rune-args1] + <key2>[-s s2] [rune-args2]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\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\n\nFor rune argument documentation: crunes docs rune <key>'
3419
3419
  ).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
3420
- const { handler, parseRunArgs } = await import("./chunks/run-WL3IZBXF.js");
3420
+ const { handler, parseRunArgs } = await import("./chunks/run-WD2ZA63Z.js");
3421
3421
  const { segments, format, failFast, isBatch } = parseRunArgs(args);
3422
3422
  await handler({ segments, format, failFast, isBatch, projectRoot: projectRoot(), configRoot: configRoot() });
3423
3423
  });
@@ -3425,7 +3425,7 @@ function buildProgram() {
3425
3425
  "after",
3426
3426
  '\nImportant: Global flags (e.g. --cwd) MUST appear before the "repl" command.\n\nSyntax:\n [--format text|jsonl] <key>[-s s1,s2] [rune-args...]\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\n\nThe rune must export repl(args) and/or inputRepl(input).\nFor rune argument documentation: crunes docs rune <key>'
3427
3427
  ).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
3428
- const { handler, parseReplArgs } = await import("./chunks/repl-5GDN3RAO.js");
3428
+ const { handler, parseReplArgs } = await import("./chunks/repl-32TENE2U.js");
3429
3429
  const { key, runeArgs, sections, format } = parseReplArgs(args);
3430
3430
  await handler({ key, runeArgs, sections, format, projectRoot: projectRoot(), configRoot: configRoot() });
3431
3431
  });
@@ -3434,11 +3434,11 @@ function buildProgram() {
3434
3434
  "after",
3435
3435
  "\n crunes docs rune index of every rune and its commands\n crunes docs rune <key> command index for one rune\n crunes docs rune <key> <cmd>... detail for one command path\n"
3436
3436
  ).addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (key, path3, opts) => {
3437
- const { handler } = await import("./chunks/rune-YA4TFHTB.js");
3437
+ const { handler } = await import("./chunks/rune-TSED6W3R.js");
3438
3438
  await handler({ key, path: path3, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
3439
3439
  });
3440
3440
  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) => {
3441
- const { handler } = await import("./chunks/utils-B2QULX5J.js");
3441
+ const { handler } = await import("./chunks/utils-VVD4VCTC.js");
3442
3442
  await handler({ namespaces, format: opts.format });
3443
3443
  });
3444
3444
  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) => {
@@ -3446,7 +3446,7 @@ function buildProgram() {
3446
3446
  await handler({ format: opts.format });
3447
3447
  });
3448
3448
  helpGroup.command("intro").description("Generate a comprehensive introduction to Crunes: rune anatomy, calling conventions, config, permissions and the full @utils API. Generic \u2014 for this project's own runes use `crunes list` and `crunes docs rune`").option("--out <path>", "output file path (defaults to stdout)").action(async (opts) => {
3449
- const { handler } = await import("./chunks/intro-JNJ6A75J.js");
3449
+ const { handler } = await import("./chunks/intro-3FSOGWPR.js");
3450
3450
  await handler({ out: opts.out });
3451
3451
  });
3452
3452
  helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
@@ -3482,22 +3482,18 @@ function buildProgram() {
3482
3482
  await handler();
3483
3483
  });
3484
3484
  program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
3485
- const { handler } = await import("./chunks/version-FLHI5KFS.js");
3485
+ const { handler } = await import("./chunks/version-HUA2QNMT.js");
3486
3486
  await handler({ check: opts.check, plain: !!program3.opts().plain });
3487
3487
  });
3488
3488
  program3.command("doctor").description("Verify environment and project setup").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async () => {
3489
- const { handler } = await import("./chunks/doctor-R2Y6UAY4.js");
3489
+ const { handler } = await import("./chunks/doctor-WXTY6RGK.js");
3490
3490
  await handler({ projectRoot: projectRoot() });
3491
3491
  });
3492
- program3.command("migrate").description("Rewrite rune entries from path/permissions to run and repl blocks, renaming isolate modules to *.rune.js").option("-g, --global", "migrate the global config (~/.crunes/config.json) instead of the project").option("--dry-run", "print the rewrite without writing or renaming anything").action(async (opts) => {
3493
- const { handler } = await import("./chunks/migrate-Y3EKMVP5.js");
3494
- await handler({ configRoot: configRoot(), global: !!opts.global, dryRun: !!opts.dryRun });
3495
- });
3496
3492
  program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText(
3497
3493
  "after",
3498
3494
  '\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] <key>[--runs <n>] [--warmup] [-s s1,s2] [rune-args...]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n --runs <n> default number of runs for all runes (default: 1)\n --warmup default warmup run for all runes\n\nPer-rune bracket flags (inside key[...]):\n --runs <n> override run count for this rune\n --warmup override warmup for this rune\n -s, --section s1,s2 filter output sections for this rune'
3499
3495
  ).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
3500
- const { handler, parseBenchArgs } = await import("./chunks/benchmark-3IHFP3V2.js");
3496
+ const { handler, parseBenchArgs } = await import("./chunks/benchmark-5OWBATUN.js");
3501
3497
  const parsed = parseBenchArgs(args);
3502
3498
  if (!parsed.segments[0]?.key) {
3503
3499
  const { output } = await import("./chunks/output-QN5CVJ62.js");
@@ -3507,7 +3503,7 @@ function buildProgram() {
3507
3503
  await handler({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
3508
3504
  });
3509
3505
  program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("-g, --global", "list only runes from the global config (~/.crunes/config.json)").action(async (opts) => {
3510
- const { handler } = await import("./chunks/list-MLKZE36K.js");
3506
+ const { handler } = await import("./chunks/list-W4JAYPAA.js");
3511
3507
  await handler({ format: opts.format, plain: !!program3.opts().plain || !!opts.plain, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3512
3508
  });
3513
3509
  const jobs = program3.command("job").description("Manage background jobs");
@@ -3564,64 +3560,64 @@ function buildProgram() {
3564
3560
  await handler({ id, sql, projectDir: projectRoot(), plugin: opts.plugin });
3565
3561
  });
3566
3562
  program3.command("init").description("Create .crunes/config.json in the current project").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").action(async (opts) => {
3567
- const { handler } = await import("./chunks/init-KO2HLED5.js");
3563
+ const { handler } = await import("./chunks/init-GPNC7TR5.js");
3568
3564
  await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot(), global: !!opts.global });
3569
3565
  });
3570
- 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)").addOption(new Option("--lang <lang>", "scaffold a script rune instead of a sandboxed JS one").choices(["python", "bash", "node"])).option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").action(async (key, opts) => {
3571
- const { handler } = await import("./chunks/create-LPLNCOW4.js");
3572
- await handler({ key, format: opts.format, lang: opts.lang, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3566
+ 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>/src/index.rune.js)").addOption(new Option("--lang <lang>", "scaffold a script rune instead of a sandboxed JS one").choices(["python", "bash", "node"])).option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").option("--plugin", "register the rune in .crunes-plugin/plugin.json instead of .crunes/config.json").option("--project", "register the rune in .crunes/config.json even when .crunes-plugin/plugin.json exists").action(async (key, opts) => {
3567
+ const { handler } = await import("./chunks/create-3TDAFVL2.js");
3568
+ await handler({ key, format: opts.format, lang: opts.lang, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global, plugin: !!opts.plugin, project: !!opts.project });
3573
3569
  });
3574
3570
  program3.command("add <key> <command> [argv...]").description("Register an existing script or program as a rune (fixed arguments go after --)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what the rune does").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").addHelpText("after", '\nExamples:\n crunes add coverage tools/coverage.py --description "Test coverage per module"\n crunes add log git -- log --oneline -n 20').action(async (key, command, argv, opts) => {
3575
- const { handler } = await import("./chunks/add-MSX6XSU3.js");
3571
+ const { handler } = await import("./chunks/add-2OM5KGN5.js");
3576
3572
  await handler({ key, command, argv, name: opts.name, description: opts.description, configRoot: configRoot(), global: !!opts.global });
3577
3573
  });
3578
3574
  const plugin = program3.command("plugin").description("Manage rune plugins");
3579
3575
  plugin.command("install <source>").description("Install a plugin from a configured marketplace in the format <marketplace>@<plugin>").option("-g, --global", "enable in the global config (~/.crunes/config.json) instead of the project").action(async (source, opts) => {
3580
- const { handler } = await import("./chunks/install-7IRUAGSF.js");
3576
+ const { handler } = await import("./chunks/install-3G7U5ZIO.js");
3581
3577
  await handler({ source, projectRoot: projectRoot(), configRoot: configRoot(), yes: !!program3.opts().yes, global: !!opts.global });
3582
3578
  });
3583
3579
  plugin.command("uninstall <plugin>").description("Uninstall an installed plugin").option("-g, --global", "also drop the plugin from the global config (~/.crunes/config.json)").action(async (name, opts) => {
3584
- const { handler } = await import("./chunks/uninstall-3MWZIZVA.js");
3580
+ const { handler } = await import("./chunks/uninstall-J7JUYETA.js");
3585
3581
  await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3586
3582
  });
3587
3583
  plugin.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async (opts) => {
3588
- const { handler } = await import("./chunks/list-QVZKR3IE.js");
3584
+ const { handler } = await import("./chunks/list-JB4447YK.js");
3589
3585
  await handler({ format: opts.format, projectRoot: projectRoot() });
3590
3586
  });
3591
3587
  plugin.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
3592
- const { handler } = await import("./chunks/update-W4MJUTTW.js");
3588
+ const { handler } = await import("./chunks/update-ZJRLDCUT.js");
3593
3589
  await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
3594
3590
  });
3595
3591
  plugin.command("trust <plugin> [rune]").description("Review a plugin's native runes \u2014 scripts that run outside the sandbox \u2014 and trust them to run").action(async (name, rune) => {
3596
- const { handler } = await import("./chunks/trust-BFIDANXD.js");
3592
+ const { handler } = await import("./chunks/trust-LXXYSF6W.js");
3597
3593
  await handler({ name, rune: rune ?? null, yes: !!program3.opts().yes });
3598
3594
  });
3599
3595
  plugin.command("enable <plugin>").description("Add a plugin to this project's enabled list").option("-g, --global", "enable in the global config (~/.crunes/config.json), for every directory").action(async (name, opts) => {
3600
- const { handler } = await import("./chunks/enable-LGTPDWPV.js");
3596
+ const { handler } = await import("./chunks/enable-UVXHTKCJ.js");
3601
3597
  await handler({ name, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3602
3598
  });
3603
3599
  plugin.command("disable <plugin>").description("Turn a plugin off for this project, including one enabled globally").option("-g, --global", "disable in the global config (~/.crunes/config.json) instead of the project").action(async (name, opts) => {
3604
- const { handler } = await import("./chunks/disable-TITOSMXB.js");
3600
+ const { handler } = await import("./chunks/disable-FB64CSYV.js");
3605
3601
  await handler({ name, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3606
3602
  });
3607
- plugin.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").action(async (name, opts) => {
3608
- const { handler } = await import("./chunks/create-DXW4YYLJ.js");
3609
- await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
3603
+ plugin.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").option("--multi", "scaffold under runes/example/{src,test}/ for a multi-rune plugin").action(async (name, opts) => {
3604
+ const { handler } = await import("./chunks/create-EC6TQW7N.js");
3605
+ await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, multi: !!opts.multi, yes: !!program3.opts().yes, projectRoot: projectRoot() });
3610
3606
  });
3611
3607
  const template = program3.command("template").description("Manage rune templates");
3612
3608
  template.command("list [template-source]").description('List available templates. [template-source] can be "project" (project config only) or a plugin name; omit to list all.').addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (source, opts) => {
3613
- const { handler } = await import("./chunks/list-BCCM3TLP.js");
3609
+ const { handler } = await import("./chunks/list-J2UCBYAY.js");
3614
3610
  await handler({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
3615
3611
  });
3616
3612
  template.command("apply <template>").description("Copy a template into the project as a new rune and register it in config.").addHelpText(
3617
3613
  "after",
3618
3614
  "\nKey prefixes:\n project:name \u2014 use a template defined in this project's config\n plugin:name \u2014 use a template from a specific installed plugin\n name \u2014 auto-resolve: project config first, then installed plugins"
3619
3615
  ).option("--as <new-rune>", "register the rune under a different key (default: template name)").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 (ref, opts) => {
3620
- const { handler } = await import("./chunks/apply-LOIJIPLR.js");
3616
+ const { handler } = await import("./chunks/apply-GBUQQ4XF.js");
3621
3617
  await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
3622
3618
  });
3623
3619
  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").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").action(async (name, opts) => {
3624
- const { handler } = await import("./chunks/create-Y4LHLWGL.js");
3620
+ const { handler } = await import("./chunks/create-2CQZF53Z.js");
3625
3621
  await handler({ name, path: opts.path, templateName: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
3626
3622
  });
3627
3623
  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.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "CLI tool for querying crunes enrichers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,94 +0,0 @@
1
- import {
2
- init_require_shim
3
- } from "./chunk-TPK5AGRA.js";
4
-
5
- // src/core/rune-entry.js
6
- init_require_shim();
7
- import { existsSync, readFileSync } from "node:fs";
8
- import { join, isAbsolute } from "node:path";
9
- var ISOLATE_MODULE = /\.rune\.m?js$/i;
10
- var REPL_EXPORT = /\bexport\s+(?:async\s+)?(?:function\s*\*?\s*|const\s+|let\s+|var\s+)repl\b|\bexport\s*\{[^}]*\brepl\b[^}]*\}/;
11
- function blockOf(entry, name) {
12
- const block2 = entry?.[name];
13
- if (block2 == null) return null;
14
- return typeof block2 === "string" ? { command: block2 } : block2;
15
- }
16
- function scopedPermissions(entry) {
17
- const out = {};
18
- for (const mode of ["run", "repl"]) {
19
- const permissions = blockOf(entry, mode)?.permissions;
20
- if (permissions) out[mode] = permissions;
21
- }
22
- return Object.keys(out).length ? out : void 0;
23
- }
24
- function blockModule(entry, mode, base) {
25
- const command = blockOf(entry, mode)?.command;
26
- if (!command) return null;
27
- return isAbsolute(command) ? command : join(base, command);
28
- }
29
- function isolateName(file) {
30
- if (ISOLATE_MODULE.test(file)) return file;
31
- return file.replace(/\.(m?js)$/i, ".rune.$1");
32
- }
33
- function exportsRepl(file) {
34
- try {
35
- return REPL_EXPORT.test(readFileSync(file, "utf8"));
36
- } catch {
37
- return false;
38
- }
39
- }
40
- function block(command, permissions) {
41
- return permissions ? { ...command && { command }, permissions } : command;
42
- }
43
- function migrateEntry(entry, { base, defaultFile }) {
44
- if (entry == null || typeof entry !== "object" || Array.isArray(entry)) return null;
45
- const perms = entry.permissions;
46
- const isV1 = entry.path !== void 0 || perms !== void 0 || entry.run == null && entry.plugin == null && defaultFile && existsSync(join(base, defaultFile));
47
- if (!isV1) return null;
48
- const renames = [];
49
- const file = entry.path ?? (entry.plugin == null && defaultFile && existsSync(join(base, defaultFile)) ? defaultFile : null);
50
- const blocks = {};
51
- if (file) {
52
- const command = isolateName(file);
53
- if (command !== file) renames.push({ from: file, to: command });
54
- const absolute = isAbsolute(file) ? file : join(base, file);
55
- blocks.run = block(command, perms?.run);
56
- if (perms?.repl || exportsRepl(absolute)) blocks.repl = block(command, perms?.repl);
57
- } else {
58
- if (perms?.run) blocks.run = { permissions: perms.run };
59
- if (perms?.repl) blocks.repl = { permissions: perms.repl };
60
- }
61
- const out = {};
62
- let placed = false;
63
- for (const [key, value] of Object.entries(entry)) {
64
- if (key === "path" || key === "permissions") {
65
- if (!placed) {
66
- Object.assign(out, blocks);
67
- placed = true;
68
- }
69
- continue;
70
- }
71
- out[key] = value;
72
- }
73
- if (!placed) Object.assign(out, blocks);
74
- return { entry: out, renames };
75
- }
76
- function v1EntryError(fileName, where, rewritten) {
77
- return new Error(
78
- `${fileName}: ${where} uses the old entry shape (path / permissions.run / an implicit REPL), which is no longer read. Rewritten, it is:
79
-
80
- ${JSON.stringify(rewritten.entry, null, 2).replace(/^/gm, " ")}
81
- ` + (rewritten.renames.length ? `
82
- and the module is renamed: ${rewritten.renames.map((r) => `${r.from} \u2192 ${r.to}`).join(", ")}
83
- ` : "") + `
84
- Run \`crunes migrate\` to rewrite every entry and rename the modules.`
85
- );
86
- }
87
-
88
- export {
89
- blockOf,
90
- scopedPermissions,
91
- blockModule,
92
- migrateEntry,
93
- v1EntryError
94
- };
@@ -1,87 +0,0 @@
1
- import {
2
- output
3
- } from "./chunk-MIKWIFYR.js";
4
- import "./chunk-CGZL5SSH.js";
5
- import "./chunk-WCODTMDN.js";
6
- import {
7
- defaultRuneFile
8
- } from "./chunk-2FI6KN3C.js";
9
- import "./chunk-UBCAZGLE.js";
10
- import "./chunk-VP7YLCQP.js";
11
- import {
12
- migrateEntry
13
- } from "./chunk-YKIKJHYO.js";
14
- import {
15
- getStorePath
16
- } from "./chunk-2Q3KLBE6.js";
17
- import "./chunk-55GTJG5I.js";
18
- import {
19
- init_require_shim
20
- } from "./chunk-TPK5AGRA.js";
21
-
22
- // src/cli/commands/migrate.js
23
- init_require_shim();
24
- import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
25
- import { join, isAbsolute, relative } from "node:path";
26
- function migrateRunes(runes, base, defaultFileFor) {
27
- const changed = [];
28
- const renames = [];
29
- for (const [key, entry] of Object.entries(runes ?? {})) {
30
- const rewritten = migrateEntry(entry, { base, defaultFile: defaultFileFor(key) });
31
- if (!rewritten) continue;
32
- runes[key] = rewritten.entry;
33
- changed.push(key);
34
- renames.push(...rewritten.renames.map((r) => ({
35
- from: isAbsolute(r.from) ? r.from : join(base, r.from),
36
- to: isAbsolute(r.to) ? r.to : join(base, r.to)
37
- })));
38
- }
39
- return { changed, renames };
40
- }
41
- function readJson(file) {
42
- return JSON.parse(readFileSync(file, "utf8"));
43
- }
44
- function planMigration({ configRoot, global = false }) {
45
- const files = [];
46
- const layers = global ? [{ file: join(getStorePath(), "config.json"), base: getStorePath(), layer: "global" }] : [
47
- { file: join(configRoot, ".crunes", "config.json"), base: configRoot, layer: "project" },
48
- { file: join(configRoot, ".crunes", "config.local.json"), base: configRoot, layer: "local" }
49
- ];
50
- const declared = /* @__PURE__ */ new Set();
51
- for (const { file, base, layer } of layers) {
52
- if (!existsSync(file)) continue;
53
- const json = readJson(file);
54
- const { changed, renames } = migrateRunes(json.runes, base, (key) => declared.has(key) ? null : defaultRuneFile(key, layer));
55
- for (const key of Object.keys(json.runes ?? {})) declared.add(key);
56
- if (changed.length) files.push({ file, json, changed, renames });
57
- }
58
- return files;
59
- }
60
- async function handler({ configRoot, global = false, dryRun = false }) {
61
- const plan = planMigration({ configRoot, global });
62
- const shown = (file) => relative(process.cwd(), file).replace(/\\/g, "/") || file;
63
- if (plan.length === 0) {
64
- output.success("Nothing to migrate \u2014 every entry already uses run and repl blocks.");
65
- return;
66
- }
67
- const renames = /* @__PURE__ */ new Map();
68
- for (const { file, json, changed, renames: needed } of plan) {
69
- output.info(`${shown(file)}: ${changed.length} entr${changed.length === 1 ? "y" : "ies"} rewritten (${changed.join(", ")})`);
70
- if (dryRun) output.info(JSON.stringify({ runes: Object.fromEntries(changed.map((k) => [k, json.runes[k]])) }, null, 2));
71
- for (const r of needed) renames.set(r.from, r.to);
72
- }
73
- for (const [from, to] of renames) {
74
- const state = !existsSync(from) ? " (not found \u2014 skipped)" : existsSync(to) ? " (target exists \u2014 skipped)" : "";
75
- output.info(`rename ${shown(from)} \u2192 ${shown(to)}${state}`);
76
- }
77
- if (dryRun) return;
78
- for (const { file, json } of plan) writeFileSync(file, JSON.stringify(json, null, 2) + "\n");
79
- for (const [from, to] of renames) {
80
- if (existsSync(from) && !existsSync(to)) renameSync(from, to);
81
- }
82
- output.success("Migrated. Rename the modules in version control too if it does not track renames.");
83
- }
84
- export {
85
- handler,
86
- planMigration
87
- };