@darkrymit/crunes-cli 0.9.0 → 0.10.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/dist/chunks/add-2OM5KGN5.js +67 -0
- package/dist/chunks/{apply-YY7MIM64.js → apply-GBUQQ4XF.js} +21 -9
- package/dist/chunks/{benchmark-BQNMULOO.js → benchmark-QWGVX3BX.js} +21 -15
- package/dist/chunks/chunk-2DNYVKBF.js +109 -0
- package/dist/chunks/chunk-2HM5Q52B.js +131 -0
- package/dist/chunks/chunk-3KKRNQQU.js +275 -0
- package/dist/chunks/chunk-55GTJG5I.js +1154 -0
- package/dist/chunks/chunk-7KYCYDAS.js +325 -0
- package/dist/chunks/{chunk-SNC7AOT7.js → chunk-AL37NFWR.js} +45 -94
- package/dist/chunks/chunk-ARIFLX5E.js +9525 -0
- package/dist/chunks/{chunk-X7PZN73N.js → chunk-E7CZPAM2.js} +1 -1
- package/dist/chunks/chunk-EO3CSXWK.js +70 -0
- package/dist/chunks/chunk-FIAFVIAN.js +79 -0
- package/dist/chunks/{chunk-MRNZFUXZ.js → chunk-KQMTTEJV.js} +22 -7
- package/dist/chunks/chunk-KX6QEHM5.js +578 -0
- package/dist/chunks/{chunk-VST6HAB6.js → chunk-MTJ2KW3V.js} +2 -0
- package/dist/chunks/chunk-MUWDZJN2.js +71 -0
- package/dist/chunks/{chunk-CY6C6ADU.js → chunk-MVCBPI4J.js} +45 -478
- package/dist/chunks/{chunk-34F4ZURL.js → chunk-NJVPLN5D.js} +29 -12
- package/dist/chunks/chunk-UBCAZGLE.js +15 -0
- package/dist/chunks/chunk-VP7YLCQP.js +244 -0
- package/dist/chunks/chunk-VSMAZISQ.js +303 -0
- package/dist/chunks/chunk-WE4HDHFU.js +37 -0
- package/dist/chunks/{create-ET6DT5ZE.js → create-2CQZF53Z.js} +5 -2
- package/dist/chunks/{create-LM7U3CJS.js → create-36F6V4WP.js} +99 -6
- package/dist/chunks/{create-TLPM7HJE.js → create-DXW4YYLJ.js} +5 -5
- package/dist/chunks/{disable-TNTEIAKO.js → disable-FB64CSYV.js} +5 -2
- package/dist/chunks/doctor-PVO4JLYN.js +208 -0
- package/dist/chunks/{enable-GUQCB4CU.js → enable-UVXHTKCJ.js} +6 -3
- package/dist/chunks/{init-PJSCFOC6.js → init-GPNC7TR5.js} +5 -2
- package/dist/chunks/{install-4YP7FALO.js → install-3G7U5ZIO.js} +10 -5
- package/dist/chunks/{intro-SA7MWV3Z.js → intro-YI5HUZCF.js} +45 -19
- package/dist/chunks/{list-WKNPZZOV.js → list-J2UCBYAY.js} +9 -6
- package/dist/chunks/list-JB4447YK.js +62 -0
- package/dist/chunks/{list-7R6NASFI.js → list-W4JAYPAA.js} +19 -19
- package/dist/chunks/{manifest-7RVNKBOH.js → manifest-76MIEL2F.js} +3 -1
- package/dist/chunks/{registry-K5DV5NAK.js → registry-IWP7JMNI.js} +1 -1
- package/dist/chunks/{repl-ZB3DIJ4K.js → repl-MWFEZ65P.js} +30 -20
- package/dist/chunks/resolver-URPQMOIV.js +36 -0
- package/dist/chunks/{run-22B65ZWZ.js → run-3VKWSRLO.js} +17 -11
- package/dist/chunks/rune-L5EP645W.js +283 -0
- package/dist/chunks/runner-VPTLUQJE.js +34 -0
- package/dist/chunks/{shell-explain-QLITLHW7.js → shell-explain-LKBBP2BG.js} +5 -2
- package/dist/chunks/trust-LXXYSF6W.js +109 -0
- package/dist/chunks/{uninstall-4WR5IHLC.js → uninstall-J7JUYETA.js} +10 -5
- package/dist/chunks/{update-ACLDK6E6.js → update-ZJRLDCUT.js} +10 -5
- package/dist/chunks/{version-EULYWNXN.js → version-ZULO6CV3.js} +2 -2
- package/dist/cli.js +47 -34
- package/package.json +2 -2
- package/dist/chunks/chunk-G3U4V32O.js +0 -46
- package/dist/chunks/chunk-QYRF3R35.js +0 -154
- package/dist/chunks/chunk-YXCHIMLW.js +0 -75308
- package/dist/chunks/doctor-VXAQYMTR.js +0 -101
- package/dist/chunks/list-OMMZAQ23.js +0 -28
- package/dist/chunks/resolver-QIYYFIDX.js +0 -34
- package/dist/chunks/rune-SYK4N642.js +0 -425
- package/dist/chunks/{delete-5R3WBLVD.js → delete-2EXPFBFC.js} +4 -4
- package/dist/chunks/{delete-U4STA2QZ.js → delete-MJAECXXV.js} +4 -4
package/dist/cli.js
CHANGED
|
@@ -3397,10 +3397,11 @@ 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.
|
|
3400
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.10.1", "-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
|
-
|
|
3403
|
-
|
|
3402
|
+
const opts = { ...program3.opts(), ...actionCommand.opts() };
|
|
3403
|
+
configure({ plain: !!opts.plain, verbose: !!opts.verbose });
|
|
3404
|
+
if (opts.verbose) {
|
|
3404
3405
|
console.error(`[crunes:debug] Executing command: ${actionCommand.name()}`);
|
|
3405
3406
|
}
|
|
3406
3407
|
});
|
|
@@ -3416,7 +3417,7 @@ function buildProgram() {
|
|
|
3416
3417
|
"after",
|
|
3417
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>'
|
|
3418
3419
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3419
|
-
const { handler, parseRunArgs } = await import("./chunks/run-
|
|
3420
|
+
const { handler, parseRunArgs } = await import("./chunks/run-3VKWSRLO.js");
|
|
3420
3421
|
const { segments, format, failFast, isBatch } = parseRunArgs(args);
|
|
3421
3422
|
await handler({ segments, format, failFast, isBatch, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3422
3423
|
});
|
|
@@ -3424,7 +3425,7 @@ function buildProgram() {
|
|
|
3424
3425
|
"after",
|
|
3425
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>'
|
|
3426
3427
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3427
|
-
const { handler, parseReplArgs } = await import("./chunks/repl-
|
|
3428
|
+
const { handler, parseReplArgs } = await import("./chunks/repl-MWFEZ65P.js");
|
|
3428
3429
|
const { key, runeArgs, sections, format } = parseReplArgs(args);
|
|
3429
3430
|
await handler({ key, runeArgs, sections, format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3430
3431
|
});
|
|
@@ -3433,7 +3434,7 @@ function buildProgram() {
|
|
|
3433
3434
|
"after",
|
|
3434
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"
|
|
3435
3436
|
).addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (key, path3, opts) => {
|
|
3436
|
-
const { handler } = await import("./chunks/rune-
|
|
3437
|
+
const { handler } = await import("./chunks/rune-L5EP645W.js");
|
|
3437
3438
|
await handler({ key, path: path3, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3438
3439
|
});
|
|
3439
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) => {
|
|
@@ -3445,7 +3446,7 @@ function buildProgram() {
|
|
|
3445
3446
|
await handler({ format: opts.format });
|
|
3446
3447
|
});
|
|
3447
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) => {
|
|
3448
|
-
const { handler } = await import("./chunks/intro-
|
|
3449
|
+
const { handler } = await import("./chunks/intro-YI5HUZCF.js");
|
|
3449
3450
|
await handler({ out: opts.out });
|
|
3450
3451
|
});
|
|
3451
3452
|
helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
|
|
@@ -3481,18 +3482,18 @@ function buildProgram() {
|
|
|
3481
3482
|
await handler();
|
|
3482
3483
|
});
|
|
3483
3484
|
program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
|
|
3484
|
-
const { handler } = await import("./chunks/version-
|
|
3485
|
+
const { handler } = await import("./chunks/version-ZULO6CV3.js");
|
|
3485
3486
|
await handler({ check: opts.check, plain: !!program3.opts().plain });
|
|
3486
3487
|
});
|
|
3487
|
-
program3.command("doctor").description("Verify environment and project setup").action(async () => {
|
|
3488
|
-
const { handler } = await import("./chunks/doctor-
|
|
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-PVO4JLYN.js");
|
|
3489
3490
|
await handler({ projectRoot: projectRoot() });
|
|
3490
3491
|
});
|
|
3491
3492
|
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText(
|
|
3492
3493
|
"after",
|
|
3493
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'
|
|
3494
3495
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3495
|
-
const { handler, parseBenchArgs } = await import("./chunks/benchmark-
|
|
3496
|
+
const { handler, parseBenchArgs } = await import("./chunks/benchmark-QWGVX3BX.js");
|
|
3496
3497
|
const parsed = parseBenchArgs(args);
|
|
3497
3498
|
if (!parsed.segments[0]?.key) {
|
|
3498
3499
|
const { output } = await import("./chunks/output-QN5CVJ62.js");
|
|
@@ -3501,9 +3502,9 @@ function buildProgram() {
|
|
|
3501
3502
|
}
|
|
3502
3503
|
await handler({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3503
3504
|
});
|
|
3504
|
-
program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).option("-g, --global", "list only runes from the global config (~/.crunes/config.json)").action(async (opts) => {
|
|
3505
|
-
const { handler } = await import("./chunks/list-
|
|
3506
|
-
await handler({ format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
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) => {
|
|
3506
|
+
const { handler } = await import("./chunks/list-W4JAYPAA.js");
|
|
3507
|
+
await handler({ format: opts.format, plain: !!program3.opts().plain || !!opts.plain, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3507
3508
|
});
|
|
3508
3509
|
const jobs = program3.command("job").description("Manage background jobs");
|
|
3509
3510
|
jobs.command("list").description("List background jobs for the current project").action(async () => {
|
|
@@ -3516,7 +3517,7 @@ function buildProgram() {
|
|
|
3516
3517
|
});
|
|
3517
3518
|
const shell = program3.command("shell").description("Inspect how commands are parsed and permission-checked");
|
|
3518
3519
|
shell.command("explain <cmd>").description("Show the command positions and redirect targets a command resolves to").option("-s, --shell <mode>", "force a shell mode: 'bash' or 'cmd'").action(async (cmd, opts) => {
|
|
3519
|
-
const { handler } = await import("./chunks/shell-explain-
|
|
3520
|
+
const { handler } = await import("./chunks/shell-explain-LKBBP2BG.js");
|
|
3520
3521
|
await handler({ cmd, shellMode: opts.shell });
|
|
3521
3522
|
});
|
|
3522
3523
|
const cache = program3.command("cache").description("Manage cache buckets");
|
|
@@ -3529,7 +3530,7 @@ function buildProgram() {
|
|
|
3529
3530
|
await handler({ id, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3530
3531
|
});
|
|
3531
3532
|
cache.command("delete <id>").description("Delete a cache bucket directory and deregister it").option("-p, --plugin [pluginId]", "filter to plugin-related buckets").action(async (id, opts) => {
|
|
3532
|
-
const { handler } = await import("./chunks/delete-
|
|
3533
|
+
const { handler } = await import("./chunks/delete-2EXPFBFC.js");
|
|
3533
3534
|
await handler({ id, projectDir: projectRoot(), yes: !!program3.opts().yes, plugin: opts.plugin });
|
|
3534
3535
|
});
|
|
3535
3536
|
cache.command("unset <id> <key>").description("Remove a single key from a cache bucket").option("-p, --plugin [pluginId]", "filter to plugin-related buckets").action(async (id, key, opts) => {
|
|
@@ -3551,7 +3552,7 @@ function buildProgram() {
|
|
|
3551
3552
|
await handler({ projectDir: projectRoot(), plugin: opts.plugin });
|
|
3552
3553
|
});
|
|
3553
3554
|
sqlite.command("delete <id>").description("Delete a SQLite database file and deregister it").option("-p, --plugin [pluginId]", "filter to plugin-related databases").action(async (id, opts) => {
|
|
3554
|
-
const { handler } = await import("./chunks/delete-
|
|
3555
|
+
const { handler } = await import("./chunks/delete-MJAECXXV.js");
|
|
3555
3556
|
await handler({ id, yes: !!program3.opts().yes, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3556
3557
|
});
|
|
3557
3558
|
sqlite.command("query <id> <sql>").description("Run a SQL query against a registered SQLite database (readonly)").option("-p, --plugin [pluginId]", "filter to plugin-related databases").action(async (id, sql, opts) => {
|
|
@@ -3559,56 +3560,64 @@ function buildProgram() {
|
|
|
3559
3560
|
await handler({ id, sql, projectDir: projectRoot(), plugin: opts.plugin });
|
|
3560
3561
|
});
|
|
3561
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) => {
|
|
3562
|
-
const { handler } = await import("./chunks/init-
|
|
3563
|
+
const { handler } = await import("./chunks/init-GPNC7TR5.js");
|
|
3563
3564
|
await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot(), global: !!opts.global });
|
|
3564
3565
|
});
|
|
3565
|
-
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").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").action(async (key, opts) => {
|
|
3566
|
-
const { handler } = await import("./chunks/create-
|
|
3567
|
-
await handler({ key, format: opts.format, 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>.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) => {
|
|
3567
|
+
const { handler } = await import("./chunks/create-36F6V4WP.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 });
|
|
3569
|
+
});
|
|
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) => {
|
|
3571
|
+
const { handler } = await import("./chunks/add-2OM5KGN5.js");
|
|
3572
|
+
await handler({ key, command, argv, name: opts.name, description: opts.description, configRoot: configRoot(), global: !!opts.global });
|
|
3568
3573
|
});
|
|
3569
3574
|
const plugin = program3.command("plugin").description("Manage rune plugins");
|
|
3570
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) => {
|
|
3571
|
-
const { handler } = await import("./chunks/install-
|
|
3576
|
+
const { handler } = await import("./chunks/install-3G7U5ZIO.js");
|
|
3572
3577
|
await handler({ source, projectRoot: projectRoot(), configRoot: configRoot(), yes: !!program3.opts().yes, global: !!opts.global });
|
|
3573
3578
|
});
|
|
3574
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) => {
|
|
3575
|
-
const { handler } = await import("./chunks/uninstall-
|
|
3580
|
+
const { handler } = await import("./chunks/uninstall-J7JUYETA.js");
|
|
3576
3581
|
await handler({ name, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3577
3582
|
});
|
|
3578
|
-
plugin.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
3579
|
-
const { handler } = await import("./chunks/list-
|
|
3580
|
-
await handler({ format: opts.format });
|
|
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) => {
|
|
3584
|
+
const { handler } = await import("./chunks/list-JB4447YK.js");
|
|
3585
|
+
await handler({ format: opts.format, projectRoot: projectRoot() });
|
|
3581
3586
|
});
|
|
3582
3587
|
plugin.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
|
|
3583
|
-
const { handler } = await import("./chunks/update-
|
|
3588
|
+
const { handler } = await import("./chunks/update-ZJRLDCUT.js");
|
|
3584
3589
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3585
3590
|
});
|
|
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) => {
|
|
3592
|
+
const { handler } = await import("./chunks/trust-LXXYSF6W.js");
|
|
3593
|
+
await handler({ name, rune: rune ?? null, yes: !!program3.opts().yes });
|
|
3594
|
+
});
|
|
3586
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) => {
|
|
3587
|
-
const { handler } = await import("./chunks/enable-
|
|
3596
|
+
const { handler } = await import("./chunks/enable-UVXHTKCJ.js");
|
|
3588
3597
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3589
3598
|
});
|
|
3590
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) => {
|
|
3591
|
-
const { handler } = await import("./chunks/disable-
|
|
3600
|
+
const { handler } = await import("./chunks/disable-FB64CSYV.js");
|
|
3592
3601
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3593
3602
|
});
|
|
3594
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>)").action(async (name, opts) => {
|
|
3595
|
-
const { handler } = await import("./chunks/create-
|
|
3604
|
+
const { handler } = await import("./chunks/create-DXW4YYLJ.js");
|
|
3596
3605
|
await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3597
3606
|
});
|
|
3598
3607
|
const template = program3.command("template").description("Manage rune templates");
|
|
3599
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) => {
|
|
3600
|
-
const { handler } = await import("./chunks/list-
|
|
3609
|
+
const { handler } = await import("./chunks/list-J2UCBYAY.js");
|
|
3601
3610
|
await handler({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3602
3611
|
});
|
|
3603
3612
|
template.command("apply <template>").description("Copy a template into the project as a new rune and register it in config.").addHelpText(
|
|
3604
3613
|
"after",
|
|
3605
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"
|
|
3606
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) => {
|
|
3607
|
-
const { handler } = await import("./chunks/apply-
|
|
3616
|
+
const { handler } = await import("./chunks/apply-GBUQQ4XF.js");
|
|
3608
3617
|
await handler({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3609
3618
|
});
|
|
3610
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) => {
|
|
3611
|
-
const { handler } = await import("./chunks/create-
|
|
3620
|
+
const { handler } = await import("./chunks/create-2CQZF53Z.js");
|
|
3612
3621
|
await handler({ name, path: opts.path, templateName: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3613
3622
|
});
|
|
3614
3623
|
const marketplace = program3.command("marketplace").description("Manage plugin marketplace sources");
|
|
@@ -3620,7 +3629,7 @@ function buildProgram() {
|
|
|
3620
3629
|
const { handler } = await import("./chunks/remove-BCFTF23J.js");
|
|
3621
3630
|
await handler({ url });
|
|
3622
3631
|
});
|
|
3623
|
-
marketplace.command("list").description("List configured marketplace sources").action(async () => {
|
|
3632
|
+
marketplace.command("list").description("List configured marketplace sources").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async () => {
|
|
3624
3633
|
const { handler } = await import("./chunks/list-U4EMHQZT.js");
|
|
3625
3634
|
await handler();
|
|
3626
3635
|
});
|
|
@@ -3670,6 +3679,10 @@ if (process.env.CRUNES_NO_TIMEOUT === "1") {
|
|
|
3670
3679
|
}
|
|
3671
3680
|
}
|
|
3672
3681
|
var program2 = buildProgram();
|
|
3682
|
+
process.stdout.on("error", (err) => {
|
|
3683
|
+
if (err.code === "EPIPE") process.exit(0);
|
|
3684
|
+
throw err;
|
|
3685
|
+
});
|
|
3673
3686
|
process.on("uncaughtException", (err) => {
|
|
3674
3687
|
console.error("[crunes] FATAL UNCAUGHT EXCEPTION:", err);
|
|
3675
3688
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkrymit/crunes-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "CLI tool for querying crunes enrichers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "typedoc --options typedoc.json && typedoc --options typedoc-lifecycle.json && typedoc --options typedoc-globals.json && node build.mjs",
|
|
14
|
-
"prepack": "
|
|
14
|
+
"prepack": "npm run build",
|
|
15
15
|
"test": "vitest run"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
init_require_shim
|
|
3
|
-
} from "./chunk-TPK5AGRA.js";
|
|
4
|
-
|
|
5
|
-
// src/plugin/manifest.js
|
|
6
|
-
init_require_shim();
|
|
7
|
-
import fs from "node:fs/promises";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
var PLUGIN_JSON_RELATIVE = ".crunes-plugin/plugin.json";
|
|
10
|
-
async function loadPluginJson(pluginDir) {
|
|
11
|
-
const jsonPath = path.join(pluginDir, PLUGIN_JSON_RELATIVE);
|
|
12
|
-
const raw = await fs.readFile(jsonPath, "utf8");
|
|
13
|
-
const json = JSON.parse(raw);
|
|
14
|
-
validatePluginJson(json);
|
|
15
|
-
return json;
|
|
16
|
-
}
|
|
17
|
-
function validatePluginJson(json) {
|
|
18
|
-
if (json.format !== "1") throw new Error(`plugin.json: unsupported format "${json.format}" (expected "1")`);
|
|
19
|
-
if (!json.runes || typeof json.runes !== "object") throw new Error('plugin.json: "runes" must be an object');
|
|
20
|
-
for (const [key, rune] of Object.entries(json.runes)) {
|
|
21
|
-
if (!rune.permissions || Object.keys(rune.permissions).length === 0) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const perms = rune.permissions;
|
|
25
|
-
if (Array.isArray(perms)) {
|
|
26
|
-
throw new Error(`plugin.json: rune "${key}" permissions must be lifecycle-scoped (e.g. permissions.run.allow)`);
|
|
27
|
-
}
|
|
28
|
-
if (perms.allow || perms.deny) {
|
|
29
|
-
throw new Error(`plugin.json: rune "${key}" permissions must be lifecycle-scoped (e.g. permissions.run.allow)`);
|
|
30
|
-
}
|
|
31
|
-
const hasLifecycleScoped = Object.values(perms).some((v) => v && Array.isArray(v.allow));
|
|
32
|
-
if (!hasLifecycleScoped) {
|
|
33
|
-
const hasEmptyRun = perms.run && typeof perms.run === "object" && Object.keys(perms.run).length === 0;
|
|
34
|
-
if (hasEmptyRun) {
|
|
35
|
-
console.warn(`[crunes:warn] plugin.json: rune "${key}" permissions.run is empty.`);
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
throw new Error(`plugin.json: rune "${key}" must have lifecycle-scoped permissions (e.g. permissions.run.allow)`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export {
|
|
44
|
-
loadPluginJson,
|
|
45
|
-
validatePluginJson
|
|
46
|
-
};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getStorePath
|
|
3
|
-
} from "./chunk-2Q3KLBE6.js";
|
|
4
|
-
import {
|
|
5
|
-
init_require_shim
|
|
6
|
-
} from "./chunk-TPK5AGRA.js";
|
|
7
|
-
|
|
8
|
-
// src/core/config.js
|
|
9
|
-
init_require_shim();
|
|
10
|
-
import { readFileSync, existsSync } from "node:fs";
|
|
11
|
-
import { join, resolve } from "node:path";
|
|
12
|
-
function isObject(item) {
|
|
13
|
-
return item && typeof item === "object" && !Array.isArray(item);
|
|
14
|
-
}
|
|
15
|
-
var LAYER = /* @__PURE__ */ Symbol.for("crunes.layer");
|
|
16
|
-
function absolutizeSection(section, kind, baseDir, layer) {
|
|
17
|
-
const out = {};
|
|
18
|
-
for (const [key, entry] of Object.entries(section)) {
|
|
19
|
-
if (!isObject(entry)) {
|
|
20
|
-
out[key] = entry;
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
const copy = { ...entry, [LAYER]: layer };
|
|
24
|
-
const isPluginRef = Boolean(entry.plugin) || key.includes(":");
|
|
25
|
-
if (entry.path) copy.path = resolve(baseDir, entry.path);
|
|
26
|
-
else if (layer === "global" && !isPluginRef) copy.path = resolve(baseDir, `${kind}/${key}.js`);
|
|
27
|
-
out[key] = copy;
|
|
28
|
-
}
|
|
29
|
-
return out;
|
|
30
|
-
}
|
|
31
|
-
function absolutizeEntryPaths(config, baseDir, layer) {
|
|
32
|
-
const out = { ...config };
|
|
33
|
-
if (isObject(config.runes)) out.runes = absolutizeSection(config.runes, "runes", baseDir, layer);
|
|
34
|
-
if (isObject(config.templates)) out.templates = absolutizeSection(config.templates, "templates", baseDir, layer);
|
|
35
|
-
return out;
|
|
36
|
-
}
|
|
37
|
-
function coercePlugins(plugins) {
|
|
38
|
-
if (Array.isArray(plugins)) return Object.fromEntries(plugins.map((k) => [k, true]));
|
|
39
|
-
return isObject(plugins) ? { ...plugins } : {};
|
|
40
|
-
}
|
|
41
|
-
function enabledPluginKeys(config) {
|
|
42
|
-
return Object.entries(coercePlugins(config?.plugins)).filter(([, enabled]) => enabled === true).map(([key]) => key);
|
|
43
|
-
}
|
|
44
|
-
function mergeConfigs(shared, local) {
|
|
45
|
-
const merged = { ...shared };
|
|
46
|
-
for (const [key, value] of Object.entries(local)) {
|
|
47
|
-
if (key !== "runes" && key !== "templates" && key !== "plugins") {
|
|
48
|
-
merged[key] = value;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (local.runes) {
|
|
52
|
-
merged.runes = { ...shared.runes };
|
|
53
|
-
for (const [key, localEntry] of Object.entries(local.runes)) {
|
|
54
|
-
const sharedEntry = shared.runes?.[key];
|
|
55
|
-
if (sharedEntry && isObject(sharedEntry) && isObject(localEntry)) {
|
|
56
|
-
merged.runes[key] = {
|
|
57
|
-
...sharedEntry,
|
|
58
|
-
...localEntry,
|
|
59
|
-
vars: { ...sharedEntry.vars, ...localEntry.vars }
|
|
60
|
-
};
|
|
61
|
-
} else {
|
|
62
|
-
merged.runes[key] = localEntry;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (local.templates) {
|
|
67
|
-
merged.templates = { ...shared.templates };
|
|
68
|
-
for (const [key, localEntry] of Object.entries(local.templates)) {
|
|
69
|
-
const sharedEntry = shared.templates?.[key];
|
|
70
|
-
merged.templates[key] = isObject(sharedEntry) && isObject(localEntry) ? { ...sharedEntry, ...localEntry } : localEntry;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (shared.plugins || local.plugins) {
|
|
74
|
-
merged.plugins = { ...coercePlugins(shared.plugins), ...coercePlugins(local.plugins) };
|
|
75
|
-
}
|
|
76
|
-
return merged;
|
|
77
|
-
}
|
|
78
|
-
function validateConfig(config, fileName = "config.json") {
|
|
79
|
-
if (config.runes && typeof config.runes === "object") {
|
|
80
|
-
for (const [runeKey, entry] of Object.entries(config.runes)) {
|
|
81
|
-
if (entry && typeof entry === "object" && entry.permissions) {
|
|
82
|
-
const perms = entry.permissions;
|
|
83
|
-
if (Array.isArray(perms)) {
|
|
84
|
-
throw new Error(`${fileName}: runes["${runeKey}"].permissions must be lifecycle-scoped (e.g. permissions.run.allow)`);
|
|
85
|
-
}
|
|
86
|
-
if (perms && typeof perms === "object") {
|
|
87
|
-
if (Array.isArray(perms.allow) || Array.isArray(perms.deny)) {
|
|
88
|
-
throw new Error(`${fileName}: runes["${runeKey}"].permissions must be lifecycle-scoped (e.g. permissions.run.allow)`);
|
|
89
|
-
}
|
|
90
|
-
if (perms.run && typeof perms.run === "object" && Object.keys(perms.run).length === 0) {
|
|
91
|
-
console.warn(`[crunes:warn] ${fileName}: runes["${runeKey}"].permissions.run is empty. No extra permissions will be granted.`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (entry && typeof entry === "object" && !entry.path && !entry.plugin) {
|
|
96
|
-
const colonIdx = runeKey.indexOf(":");
|
|
97
|
-
if (colonIdx !== -1) {
|
|
98
|
-
const pluginPart = runeKey.slice(0, colonIdx);
|
|
99
|
-
if (!pluginPart.includes("@")) {
|
|
100
|
-
throw new Error(
|
|
101
|
-
`${fileName}: runes["${runeKey}"] has no path or plugin, so it can only be a plugin-rune override \u2014 but "${pluginPart}" is missing the marketplace prefix. Use the full "marketplace@plugin:${runeKey.slice(colonIdx + 1)}" form.`
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (config.plugins && !Array.isArray(config.plugins) && typeof config.plugins === "object") {
|
|
109
|
-
for (const [key, value] of Object.entries(config.plugins)) {
|
|
110
|
-
if (typeof value !== "boolean") {
|
|
111
|
-
throw new Error(`${fileName}: plugins["${key}"] must be true or false, got ${JSON.stringify(value)}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
var ROOTLESS = /* @__PURE__ */ Symbol.for("crunes.rootless");
|
|
117
|
-
function readLayer(filePath, label) {
|
|
118
|
-
if (!existsSync(filePath)) return null;
|
|
119
|
-
let parsed;
|
|
120
|
-
try {
|
|
121
|
-
parsed = JSON.parse(readFileSync(filePath, "utf8"));
|
|
122
|
-
} catch (err) {
|
|
123
|
-
throw new Error(`${label} is invalid JSON: ${err.message}`);
|
|
124
|
-
}
|
|
125
|
-
validateConfig(parsed, label);
|
|
126
|
-
return parsed;
|
|
127
|
-
}
|
|
128
|
-
function loadConfig(dir) {
|
|
129
|
-
const layers = [];
|
|
130
|
-
if (process.env.CRUNES_NO_GLOBAL !== "1") {
|
|
131
|
-
const storeRoot = getStorePath();
|
|
132
|
-
const globalPath = join(storeRoot, "config.json");
|
|
133
|
-
const globalRaw = readLayer(globalPath, globalPath);
|
|
134
|
-
if (globalRaw) layers.push(absolutizeEntryPaths(globalRaw, storeRoot, "global"));
|
|
135
|
-
}
|
|
136
|
-
const sharedRaw = readLayer(join(dir, ".crunes", "config.json"), "config.json");
|
|
137
|
-
const rootless = sharedRaw === null;
|
|
138
|
-
if (sharedRaw) {
|
|
139
|
-
layers.push(absolutizeEntryPaths(sharedRaw, dir, "project"));
|
|
140
|
-
const localRaw = readLayer(join(dir, ".crunes", "config.local.json"), "config.local.json");
|
|
141
|
-
if (localRaw) layers.push(absolutizeEntryPaths(localRaw, dir, "local"));
|
|
142
|
-
}
|
|
143
|
-
const merged = layers.reduce((acc, layer) => mergeConfigs(acc, layer), {});
|
|
144
|
-
merged[ROOTLESS] = rootless;
|
|
145
|
-
return merged;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export {
|
|
149
|
-
LAYER,
|
|
150
|
-
coercePlugins,
|
|
151
|
-
enabledPluginKeys,
|
|
152
|
-
ROOTLESS,
|
|
153
|
-
loadConfig
|
|
154
|
-
};
|