@darkrymit/crunes-cli 0.8.4 → 0.9.0
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-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
- package/dist/chunks/{apply-YC6JEPUN.js → apply-YY7MIM64.js} +13 -12
- package/dist/chunks/{benchmark-BJEAAFWG.js → benchmark-BQNMULOO.js} +17 -14
- package/dist/chunks/{browse-JZFU52ET.js → browse-PHMBDREQ.js} +2 -2
- package/dist/chunks/{chunk-6MRZXASS.js → chunk-2Q3KLBE6.js} +16 -0
- package/dist/chunks/{chunk-2PBPDTRD.js → chunk-34F4ZURL.js} +40 -37
- package/dist/chunks/{chunk-ZJDKCC2Y.js → chunk-4GJMCFR6.js} +6 -3
- package/dist/chunks/chunk-CY6C6ADU.js +2787 -0
- package/dist/chunks/{chunk-J3GZ3DXD.js → chunk-GVMT55GH.js} +3 -2
- package/dist/chunks/{chunk-JOAL437H.js → chunk-I6MHDUCW.js} +16 -1
- package/dist/chunks/{chunk-6XLT25GS.js → chunk-MIKWIFYR.js} +47 -0
- package/dist/chunks/chunk-MRNZFUXZ.js +70 -0
- package/dist/chunks/{chunk-NAEVMRNA.js → chunk-PBGUKXT6.js} +2940 -1847
- package/dist/chunks/chunk-QYRF3R35.js +154 -0
- package/dist/chunks/{chunk-DZJRYFOP.js → chunk-SNC7AOT7.js} +78 -12
- package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
- package/dist/chunks/{chunk-65J65MAP.js → chunk-VST6HAB6.js} +16 -2
- package/dist/chunks/{chunk-NDEYEYSU.js → chunk-WJII3LZK.js} +4 -3
- package/dist/chunks/chunk-X7PZN73N.js +44 -0
- package/dist/chunks/{chunk-NYLRTAAA.js → chunk-YVN3VDRE.js} +1 -1
- package/dist/chunks/{chunk-JU6FKUBY.js → chunk-YXCHIMLW.js} +995 -3097
- package/dist/chunks/{clear-YBDIPEEH.js → clear-AT7HNUV4.js} +2 -2
- package/dist/chunks/{create-GPDE2YKL.js → create-ET6DT5ZE.js} +22 -18
- package/dist/chunks/{create-OZACMPEU.js → create-LM7U3CJS.js} +28 -20
- package/dist/chunks/{create-ZFFV3Z2P.js → create-TLPM7HJE.js} +5 -5
- package/dist/chunks/{delete-LNOYM5KG.js → delete-5R3WBLVD.js} +5 -5
- package/dist/chunks/{delete-E4TEBRPX.js → delete-GKYA2W5Z.js} +4 -2
- package/dist/chunks/{delete-C4UJ7X5K.js → delete-U4STA2QZ.js} +5 -5
- package/dist/chunks/disable-TNTEIAKO.js +39 -0
- package/dist/chunks/doctor-VXAQYMTR.js +101 -0
- package/dist/chunks/enable-GUQCB4CU.js +31 -0
- package/dist/chunks/{globals-H2WF344Y.js → globals-SNQFCHMP.js} +1 -1
- package/dist/chunks/{init-HU5OMHEH.js → init-PJSCFOC6.js} +14 -8
- package/dist/chunks/{install-RRLUOYFO.js → install-4YP7FALO.js} +18 -16
- package/dist/chunks/{intro-4CICBP2J.js → intro-SA7MWV3Z.js} +113 -43
- package/dist/chunks/{kill-2UG7PHUV.js → kill-TX3PC73P.js} +2 -1
- package/dist/chunks/list-7R6NASFI.js +92 -0
- package/dist/chunks/{list-4X3JFQGS.js → list-EHREZR6M.js} +2 -1
- package/dist/chunks/{list-U7PAYNAH.js → list-LC6HB3H3.js} +2 -2
- package/dist/chunks/{list-FLAYJQKN.js → list-OMMZAQ23.js} +2 -2
- package/dist/chunks/{list-7VHJIUDX.js → list-U4EMHQZT.js} +2 -2
- package/dist/chunks/{list-PTAWQYWG.js → list-V7VVD5AG.js} +2 -1
- package/dist/chunks/{list-A5WVDBWF.js → list-VA73WPK6.js} +2 -2
- package/dist/chunks/{list-CK5X2YN3.js → list-WKNPZZOV.js} +5 -4
- package/dist/chunks/{output-RJ6JSNY7.js → output-QN5CVJ62.js} +4 -1
- package/dist/chunks/{query-AW7WYILM.js → query-2US3CPYT.js} +2 -2
- package/dist/chunks/{registry-3QIL5SVL.js → registry-K5DV5NAK.js} +4 -2
- package/dist/chunks/{remove-QUH2D3S5.js → remove-BCFTF23J.js} +2 -2
- package/dist/chunks/{repl-STBZC4P2.js → repl-2YWTHUWT.js} +4 -0
- package/dist/chunks/{repl-VGC5FUJG.js → repl-ZB3DIJ4K.js} +84 -26
- package/dist/chunks/resolver-QIYYFIDX.js +34 -0
- package/dist/chunks/run-22B65ZWZ.js +29 -0
- package/dist/chunks/rune-SYK4N642.js +425 -0
- package/dist/chunks/{search-MSSDGJTF.js → search-B7IM7JRJ.js} +2 -2
- package/dist/chunks/shell-explain-QLITLHW7.js +74 -0
- package/dist/chunks/{uninstall-55YTHZRH.js → uninstall-4WR5IHLC.js} +15 -11
- package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
- package/dist/chunks/{update-G6XO4RIM.js → update-ACLDK6E6.js} +19 -18
- package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
- package/dist/chunks/{utils-XOWJQWNR.js → utils-B2QULX5J.js} +8 -4
- package/dist/chunks/{version-PW7MHDFH.js → version-EULYWNXN.js} +3 -2
- package/dist/cli.js +93 -71
- package/package.json +2 -1
- package/dist/chunks/chunk-ASZKAC24.js +0 -103
- package/dist/chunks/chunk-H3BVJCIL.js +0 -105
- package/dist/chunks/disable-TMG2K3BF.js +0 -47
- package/dist/chunks/doctor-N43QEMAH.js +0 -53
- package/dist/chunks/enable-327OMBPC.js +0 -47
- package/dist/chunks/list-WH7KESMV.js +0 -111
- package/dist/chunks/resolver-QMIY33FM.js +0 -26
- package/dist/chunks/run-T33CMCFZ.js +0 -26
- package/dist/chunks/rune-UBRVWG5A.js +0 -139
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
utils_api_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PBGUKXT6.js";
|
|
4
4
|
import {
|
|
5
5
|
globals_api_default
|
|
6
6
|
} from "./chunk-V35LVVNV.js";
|
|
@@ -8,14 +8,11 @@ import {
|
|
|
8
8
|
formatMembers,
|
|
9
9
|
formatNode,
|
|
10
10
|
walk
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
loadConfig
|
|
14
|
-
} from "./chunk-H3BVJCIL.js";
|
|
15
|
-
import "./chunk-ASZKAC24.js";
|
|
11
|
+
} from "./chunk-I6MHDUCW.js";
|
|
16
12
|
import {
|
|
17
13
|
output
|
|
18
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MIKWIFYR.js";
|
|
15
|
+
import "./chunk-CGZL5SSH.js";
|
|
19
16
|
import "./chunk-WCODTMDN.js";
|
|
20
17
|
import {
|
|
21
18
|
init_require_shim
|
|
@@ -2495,14 +2492,19 @@ export async function run() {
|
|
|
2495
2492
|
import { shell, section } from '@utils'
|
|
2496
2493
|
|
|
2497
2494
|
export async function run() {
|
|
2498
|
-
// Run command relative to the project directory
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2495
|
+
// Run command relative to the project directory.
|
|
2496
|
+
// { throw: false } returns { stdout, stderr, exitCode, ok } instead of throwing on a non-zero exit.
|
|
2497
|
+
const result = await shell.exec('git status --short', { throw: false });
|
|
2498
|
+
if (!result.ok) {
|
|
2499
|
+
return section.create('git-status', {
|
|
2502
2500
|
type: 'markdown',
|
|
2503
|
-
content:
|
|
2504
|
-
})
|
|
2505
|
-
|
|
2501
|
+
content: \`Failed (exit \${result.exitCode}): \${result.stderr}\`
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
return section.create('git-status', {
|
|
2505
|
+
type: 'markdown',
|
|
2506
|
+
content: \`\\\`\\\`\\\`\\n\${result.stdout}\\n\\\`\\\`\\\`\`
|
|
2507
|
+
});
|
|
2506
2508
|
}
|
|
2507
2509
|
\`\`\``
|
|
2508
2510
|
};
|
|
@@ -2517,11 +2519,23 @@ async function compileIntro() {
|
|
|
2517
2519
|
lines.push("");
|
|
2518
2520
|
lines.push("Crunes execute inside an isolated sandbox (`isolated-vm`). Runes are ESM modules with two primary execution modes: **run** (one-shot) and **repl** (interactive session).");
|
|
2519
2521
|
lines.push("");
|
|
2520
|
-
lines.push("
|
|
2522
|
+
lines.push("Scaffold a new rune with `crunes create`. In non-interactive/agent sessions `--format` is required (no default); `--path` defaults to `.crunes/runes/<key>.js` if omitted. `-y`/`--yes` is a global flag, so it goes **before** the subcommand:");
|
|
2523
|
+
lines.push("```bash");
|
|
2524
|
+
lines.push("crunes -y create my-rune --format markdown");
|
|
2525
|
+
lines.push("```");
|
|
2526
|
+
lines.push("");
|
|
2527
|
+
lines.push("`crunes create` does not write a `permissions` block. Grants live in `.crunes/config.json` under `runes.<key>.permissions.<lifecycle>.allow` \u2014 not in the rune file \u2014 so add them there once you know what the rune touches (section 3).");
|
|
2528
|
+
lines.push("");
|
|
2529
|
+
lines.push('**Run mode** \u2014 export `args` to declare a schema and `run` to execute. `--help`/`-h` is NOT intercepted by `crunes run` \u2014 declare it yourself and check it at the top of `run(args)`, as shown below. This example also shows `args(builder)` reading `vars` at schema-build time to compute a dynamic option (`--profile`), a common pattern for anything with a "profile"/"environment" concept:');
|
|
2521
2530
|
lines.push("");
|
|
2522
2531
|
lines.push("```javascript");
|
|
2532
|
+
lines.push("import { vars, rune } from '@utils'");
|
|
2533
|
+
lines.push("");
|
|
2523
2534
|
lines.push("export function args(builder) {");
|
|
2535
|
+
lines.push(" const profiles = vars.read('deploy_profiles', ['staging', 'production'])");
|
|
2524
2536
|
lines.push(" return builder");
|
|
2537
|
+
lines.push(" .option('-h, --help', 'Show help')");
|
|
2538
|
+
lines.push(" .option('--profile <name>', `Deployment profile (${profiles.join('|')})`, profiles[0])");
|
|
2525
2539
|
lines.push(" .option('--verbose', 'Verbose output', false)");
|
|
2526
2540
|
lines.push(" .command('remote', 'Manage git remotes', remote => {");
|
|
2527
2541
|
lines.push(" remote.command('add', 'Add a remote', add => {");
|
|
@@ -2532,6 +2546,7 @@ async function compileIntro() {
|
|
|
2532
2546
|
lines.push("}");
|
|
2533
2547
|
lines.push("");
|
|
2534
2548
|
lines.push("export async function run(args) {");
|
|
2549
|
+
lines.push(" if (args.help) return rune.helpSection()");
|
|
2535
2550
|
lines.push(" if (args.$command === 'remote add') {");
|
|
2536
2551
|
lines.push(" return `Adding remote ${args.name} at ${args.url}`");
|
|
2537
2552
|
lines.push(" }");
|
|
@@ -2580,6 +2595,9 @@ async function compileIntro() {
|
|
|
2580
2595
|
lines.push("> [!WARNING]");
|
|
2581
2596
|
lines.push("> Placing a global flag after `run` (e.g. `crunes run --cwd ./project`) causes an instant error.");
|
|
2582
2597
|
lines.push("");
|
|
2598
|
+
lines.push("> [!WARNING]");
|
|
2599
|
+
lines.push("> `--help`/`-h` are NOT intercepted by `crunes run` \u2014 if a rune does not declare its own help option and check it inside `run(args)`, an unrecognized `--help` is silently ignored and the rune executes for real. Use `crunes docs rune <key>` to preview a rune's CLI surface without executing it.");
|
|
2600
|
+
lines.push("");
|
|
2583
2601
|
lines.push("### Bracket Syntax (Segment-Level Flags)");
|
|
2584
2602
|
lines.push("Section filters are embedded directly in the rune key using bracket syntax: `key[-s section]`. This is the only supported way to filter sections \u2014 placing `-s` before or after the key does not work.");
|
|
2585
2603
|
lines.push("");
|
|
@@ -2602,6 +2620,7 @@ async function compileIntro() {
|
|
|
2602
2620
|
lines.push('- **`args.$commands`**: The matched command path levels array (e.g. `["remote", "add"]`).');
|
|
2603
2621
|
lines.push("- **`args._`**: Data positionals only \u2014 command tokens are stripped, so `args._[0]` is always the first user-supplied value after the matched command.");
|
|
2604
2622
|
lines.push("- **Named Positionals**: Parameters like `<name>` or `[scope]` are automatically mapped to `args.name` or `args.scope`.");
|
|
2623
|
+
lines.push("- An unrecognized subcommand does not populate `$command` \u2014 it falls through to the root (`$command === ''`) with the unmatched token in `$rest`. To report \"unknown command,\" check `args.$command === '' && args.$rest.length > 0`.");
|
|
2605
2624
|
lines.push("");
|
|
2606
2625
|
lines.push("### Batched Executions");
|
|
2607
2626
|
lines.push("Multiple runes can be run sequentially in one invocation using the `+` operator (requires the `-b` / `--batch` command flag). Bracket syntax is especially useful in batch mode \u2014 each segment carries its own filters:");
|
|
@@ -2614,8 +2633,10 @@ async function compileIntro() {
|
|
|
2614
2633
|
lines.push("");
|
|
2615
2634
|
lines.push("Configuration properties in `.crunes/config.json` control permissions, default variables, mappings, and plugin registration.");
|
|
2616
2635
|
lines.push("");
|
|
2636
|
+
lines.push("`crunes init` also scaffolds a `.crunes/.gitignore` covering local-only files (`config.local.json`, `project.local.json`) and generated directories (`logs/`, `caches/`, `schemas/`, `sqlite/`, `jobs/`) \u2014 only `config.json` and your rune `.js` files need to be committed.");
|
|
2637
|
+
lines.push("");
|
|
2617
2638
|
lines.push("### Sandbox Security & Permissions");
|
|
2618
|
-
lines.push("Runes do not have direct access to Node.js APIs. They declare specific lifecycle-scoped permission scopes in `.crunes/config.json`:");
|
|
2639
|
+
lines.push("Runes do not have direct access to Node.js APIs. They declare specific lifecycle-scoped permission scopes nested inside their own entry in `.crunes/config.json`:");
|
|
2619
2640
|
lines.push("```json");
|
|
2620
2641
|
lines.push("{");
|
|
2621
2642
|
lines.push(' "runes": {');
|
|
@@ -2623,12 +2644,10 @@ async function compileIntro() {
|
|
|
2623
2644
|
lines.push(' "name": "My Rune",');
|
|
2624
2645
|
lines.push(' "description": "Does something useful",');
|
|
2625
2646
|
lines.push(' "path": ".crunes/runes/my-rune.js",');
|
|
2626
|
-
lines.push(' "vars": { "api_url": "https://example.com" }');
|
|
2627
|
-
lines.push("
|
|
2628
|
-
lines.push("
|
|
2629
|
-
lines.push(
|
|
2630
|
-
lines.push(' "my-rune": {');
|
|
2631
|
-
lines.push(' "run": { "allow": ["fs.read:src/**", "fs.write:dist/**", "shell.run:git *"] }');
|
|
2647
|
+
lines.push(' "vars": { "api_url": "https://example.com" },');
|
|
2648
|
+
lines.push(' "permissions": {');
|
|
2649
|
+
lines.push(' "run": { "allow": ["fs.read:src/**", "fs.write:dist/**", "shell.run:git *"] }');
|
|
2650
|
+
lines.push(" }");
|
|
2632
2651
|
lines.push(" }");
|
|
2633
2652
|
lines.push(" }");
|
|
2634
2653
|
lines.push("}");
|
|
@@ -2648,11 +2667,77 @@ async function compileIntro() {
|
|
|
2648
2667
|
lines.push("}");
|
|
2649
2668
|
lines.push("```");
|
|
2650
2669
|
lines.push("");
|
|
2670
|
+
lines.push('To grant a **plugin** rune extra permissions or vars from the project side (plugin runes have no `runes.<key>` entry of their own), add an entry keyed by the fully-qualified `"marketplace@plugin:runeKey"` string \u2014 **this must always be the full form, never the bare plugin name**, since two enabled plugins could share a bare name and a bare-form key can never resolve to anything (config loading rejects a bare-form key outright).');
|
|
2671
|
+
lines.push("```json");
|
|
2672
|
+
lines.push("{");
|
|
2673
|
+
lines.push(' "plugins": { "my-market@my-plugin": true },');
|
|
2674
|
+
lines.push(' "runes": {');
|
|
2675
|
+
lines.push(' "my-market@my-plugin:deploy": {');
|
|
2676
|
+
lines.push(' "vars": { "region": "us-east-1" },');
|
|
2677
|
+
lines.push(' "permissions": {');
|
|
2678
|
+
lines.push(' "run": { "allow": ["fs.read:src/**"] }');
|
|
2679
|
+
lines.push(" }");
|
|
2680
|
+
lines.push(" }");
|
|
2681
|
+
lines.push(" }");
|
|
2682
|
+
lines.push("}");
|
|
2683
|
+
lines.push("```");
|
|
2684
|
+
lines.push("");
|
|
2685
|
+
lines.push("### Disambiguating Same-Named Plugins");
|
|
2686
|
+
lines.push("If two enabled plugins from different marketplaces happen to share a bare name, `crunes run <name>:<rune>` (and `repl`, and `docs rune`) needs the fully-qualified `marketplace@plugin:rune` form to pick one \u2014 e.g. `crunes run my-org@git:status` instead of the ambiguous `crunes run git:status`. An ambiguity error always lists the full keys to use.");
|
|
2687
|
+
lines.push("");
|
|
2688
|
+
lines.push("A rune entry can also give a specific plugin rune its own project-local name and `vars`/`permissions` preset, by aliasing to it directly \u2014 useful any time you want a memorable name for one particular configuration of a plugin rune (e.g. a `deploy-staging` and `deploy-prod` entry both aliasing the same underlying rune with different `vars`). Disambiguating a same-named collision permanently is one example use of this:");
|
|
2689
|
+
lines.push("```json");
|
|
2690
|
+
lines.push("{");
|
|
2691
|
+
lines.push(' "runes": {');
|
|
2692
|
+
lines.push(' "git": { "plugin": "my-org@git:status" }');
|
|
2693
|
+
lines.push(" }");
|
|
2694
|
+
lines.push("}");
|
|
2695
|
+
lines.push("```");
|
|
2696
|
+
lines.push("Now `crunes run git` always resolves to that specific plugin rune, with no ambiguity, regardless of what else is enabled.");
|
|
2697
|
+
lines.push("");
|
|
2651
2698
|
lines.push("### Config File Fields Reference");
|
|
2652
|
-
lines.push(
|
|
2653
|
-
lines.push(
|
|
2654
|
-
lines.push("- **`
|
|
2655
|
-
lines.push("
|
|
2699
|
+
lines.push('- **`runes`**: Definition of project-registered runes, keyed by rune key (or the fully-qualified `"marketplace@plugin:runeKey"` string for a plugin-rune override \u2014 never a bare plugin name). Each entry may declare `path`, `name`, `description`, `vars` (key-value settings read via `utils.vars.read(key)`), `permissions` (lifecycle-scoped allow/deny lists), or `plugin` (an alias to a specific plugin rune, see above).');
|
|
2700
|
+
lines.push('- **`plugins`**: Map of plugin key to a boolean, e.g. `{"my-market@my-plugin": true}`. A legacy array of keys is still read and is converted to map form on the next write. `false` is meaningful: it turns a plugin off in this layer even though a lower layer enabled it.');
|
|
2701
|
+
lines.push("- **`templates`**: Definition of registered templates, keyed by template name, merged across layers exactly like `runes`.");
|
|
2702
|
+
lines.push("");
|
|
2703
|
+
lines.push("### Config Layers");
|
|
2704
|
+
lines.push("Configuration merges across three layers, lowest to highest \u2014 later layers win per key:");
|
|
2705
|
+
lines.push("```");
|
|
2706
|
+
lines.push("1. ~/.crunes/config.json (global \u2014 personal, machine-wide)");
|
|
2707
|
+
lines.push("2. <project>/.crunes/config.json");
|
|
2708
|
+
lines.push("3. <project>/.crunes/config.local.json");
|
|
2709
|
+
lines.push("```");
|
|
2710
|
+
lines.push("`~/.crunes` **is** the global config directory, so global paths carry no `.crunes/` segment: a global rune lives at `~/.crunes/runes/<key>.js`, not `~/.crunes/.crunes/runes/<key>.js`. Each layer resolves its own paths before merging, so a project can override one field of a global rune and still load the global file:");
|
|
2711
|
+
lines.push("```json");
|
|
2712
|
+
lines.push("// ~/.crunes/config.json");
|
|
2713
|
+
lines.push('{ "runes": { "serve": { "path": "runes/serve.js", "vars": { "port": 3000 } } } }');
|
|
2714
|
+
lines.push("");
|
|
2715
|
+
lines.push("// <project>/.crunes/config.json \u2014 same rune, different port");
|
|
2716
|
+
lines.push('{ "runes": { "serve": { "vars": { "port": 4000 } } } }');
|
|
2717
|
+
lines.push("```");
|
|
2718
|
+
lines.push('Because `plugins` is a boolean map, a project can also opt out of a globally-enabled plugin \u2014 `crunes plugin disable <name>` writes `{"my-market@my-plugin": false}` into the project config, leaving the global enable intact.');
|
|
2719
|
+
lines.push("");
|
|
2720
|
+
lines.push("`CRUNES_NO_GLOBAL=1` skips the global layer entirely. Set it in CI so a developer's personal config can never alter project behavior.");
|
|
2721
|
+
lines.push("");
|
|
2722
|
+
lines.push("### Rootless Mode");
|
|
2723
|
+
lines.push("In a directory with no `.crunes/config.json`, crunes runs **rootless**: the global layer alone applies, and every piece of local state \u2014 caches, SQLite databases, job logs, schema caches, `node_modules` \u2014 is redirected into the store under `~/.crunes/rootless/<hash-of-cwd>/`. **Nothing is written outside the store.** Running a global rune inside an Obsidian vault or any other directory leaves that directory byte-identical.");
|
|
2724
|
+
lines.push("");
|
|
2725
|
+
lines.push('`@project/` and permission paths still resolve against the current working directory, which is what makes a generic "serve this directory" rune work from anywhere. **This is also the security property to understand:** a permission granted once in the global config applies in every directory you invoke that rune from. Scope global-rune permissions deliberately.');
|
|
2726
|
+
lines.push("");
|
|
2727
|
+
lines.push("Running `crunes init` in such a directory turns it into a project \u2014 the layer simply appears.");
|
|
2728
|
+
lines.push("");
|
|
2729
|
+
lines.push("### Global Commands");
|
|
2730
|
+
lines.push("`-g` / `--global` targets the global config instead of the project:");
|
|
2731
|
+
lines.push("```bash");
|
|
2732
|
+
lines.push("crunes init -g # create ~/.crunes/config.json");
|
|
2733
|
+
lines.push("crunes create -g serve # write ~/.crunes/runes/serve.js and register it");
|
|
2734
|
+
lines.push("crunes plugin install -g mkt@plug # install and enable everywhere");
|
|
2735
|
+
lines.push("crunes plugin enable -g plug");
|
|
2736
|
+
lines.push("crunes plugin disable plug # opt this project out of a global enable");
|
|
2737
|
+
lines.push("crunes plugin disable -g plug # turn it off everywhere");
|
|
2738
|
+
lines.push("crunes template create -g base # ~/.crunes/templates/base.js");
|
|
2739
|
+
lines.push("crunes list -g # global entries only; bare `list` shows the merged set with a Layer column");
|
|
2740
|
+
lines.push("```");
|
|
2656
2741
|
lines.push("");
|
|
2657
2742
|
lines.push("## 4. Rune Exports API Reference");
|
|
2658
2743
|
lines.push("");
|
|
@@ -2692,24 +2777,9 @@ async function compileIntro() {
|
|
|
2692
2777
|
}
|
|
2693
2778
|
|
|
2694
2779
|
// src/docs/commands/intro.js
|
|
2695
|
-
async function handler({
|
|
2696
|
-
let config = null;
|
|
2697
|
-
let loadError = null;
|
|
2698
|
-
if (!global) {
|
|
2699
|
-
try {
|
|
2700
|
-
config = loadConfig(configRoot);
|
|
2701
|
-
} catch (err) {
|
|
2702
|
-
loadError = err.message;
|
|
2703
|
-
}
|
|
2704
|
-
}
|
|
2780
|
+
async function handler({ out } = {}) {
|
|
2705
2781
|
try {
|
|
2706
|
-
const content = await compileIntro(
|
|
2707
|
-
config,
|
|
2708
|
-
format,
|
|
2709
|
-
projectRoot,
|
|
2710
|
-
configRoot,
|
|
2711
|
-
hasProjectError: loadError
|
|
2712
|
-
});
|
|
2782
|
+
const content = await compileIntro();
|
|
2713
2783
|
if (out) {
|
|
2714
2784
|
const targetPath = resolve(process.cwd(), out);
|
|
2715
2785
|
writeFileSync(targetPath, content, "utf8");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_cli_table3
|
|
3
|
+
} from "./chunk-DMMC4X27.js";
|
|
4
|
+
import {
|
|
5
|
+
enumerateRunes
|
|
6
|
+
} from "./chunk-MRNZFUXZ.js";
|
|
7
|
+
import "./chunk-YXCHIMLW.js";
|
|
8
|
+
import "./chunk-UEUUOAJY.js";
|
|
9
|
+
import "./chunk-4GJMCFR6.js";
|
|
10
|
+
import "./chunk-CY6C6ADU.js";
|
|
11
|
+
import "./chunk-GVMT55GH.js";
|
|
12
|
+
import "./chunk-WJII3LZK.js";
|
|
13
|
+
import "./chunk-G4ZAUHHA.js";
|
|
14
|
+
import {
|
|
15
|
+
LAYER,
|
|
16
|
+
ROOTLESS,
|
|
17
|
+
loadConfig
|
|
18
|
+
} from "./chunk-QYRF3R35.js";
|
|
19
|
+
import {
|
|
20
|
+
output
|
|
21
|
+
} from "./chunk-MIKWIFYR.js";
|
|
22
|
+
import "./chunk-CGZL5SSH.js";
|
|
23
|
+
import "./chunk-WCODTMDN.js";
|
|
24
|
+
import "./chunk-VST6HAB6.js";
|
|
25
|
+
import "./chunk-2Q3KLBE6.js";
|
|
26
|
+
import "./chunk-G3U4V32O.js";
|
|
27
|
+
import {
|
|
28
|
+
__toESM,
|
|
29
|
+
init_require_shim
|
|
30
|
+
} from "./chunk-TPK5AGRA.js";
|
|
31
|
+
|
|
32
|
+
// src/rune/commands/list.js
|
|
33
|
+
init_require_shim();
|
|
34
|
+
var import_cli_table3 = __toESM(require_cli_table3(), 1);
|
|
35
|
+
async function collectListRows({ projectRoot = process.cwd(), configRoot, global = false } = {}) {
|
|
36
|
+
const config = loadConfig(configRoot ?? projectRoot);
|
|
37
|
+
const entries = await enumerateRunes(config);
|
|
38
|
+
const rows = entries.map((entry) => ({
|
|
39
|
+
...entry,
|
|
40
|
+
layer: config.runes?.[entry.key] ? config.runes[entry.key][LAYER] ?? "project" : "plugin"
|
|
41
|
+
}));
|
|
42
|
+
return {
|
|
43
|
+
rows: global ? rows.filter((r) => r.layer === "global") : rows,
|
|
44
|
+
rootless: config[ROOTLESS] === true
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async function handler({
|
|
48
|
+
format = "md",
|
|
49
|
+
plain = false,
|
|
50
|
+
projectRoot = process.cwd(),
|
|
51
|
+
configRoot = projectRoot,
|
|
52
|
+
global = false
|
|
53
|
+
} = {}) {
|
|
54
|
+
let entries, rootless;
|
|
55
|
+
try {
|
|
56
|
+
({ rows: entries, rootless } = await collectListRows({ projectRoot, configRoot, global }));
|
|
57
|
+
} catch (err) {
|
|
58
|
+
output.error(`Config unreadable: ${err.message}`);
|
|
59
|
+
output.info("Run `crunes init` to create a config file.");
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
if (entries.length === 0) {
|
|
63
|
+
process.stdout.write("No runes configured. Run `crunes create <key>` to add one.\n");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (format === "json") {
|
|
67
|
+
process.stdout.write(JSON.stringify(entries, null, 2) + "\n");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (plain) {
|
|
71
|
+
for (const { key, name, description, source, layer } of entries) {
|
|
72
|
+
process.stdout.write(`${key} ${name ?? ""} ${description ?? ""} ${source} ${layer}
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (rootless) {
|
|
78
|
+
process.stdout.write("no project config \u2014 global only\n");
|
|
79
|
+
}
|
|
80
|
+
const table = new import_cli_table3.default({
|
|
81
|
+
head: ["Key", "Name", "Description", "Source", "Layer"],
|
|
82
|
+
style: { head: ["cyan"] }
|
|
83
|
+
});
|
|
84
|
+
for (const { key, name, description, source, layer } of entries) {
|
|
85
|
+
table.push([key, name ?? "", description ?? "", source, layer]);
|
|
86
|
+
}
|
|
87
|
+
process.stdout.write(table.toString() + "\n");
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
collectListRows,
|
|
91
|
+
handler
|
|
92
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listLocalSqliteDbs,
|
|
3
3
|
listSqliteDbs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GVMT55GH.js";
|
|
5
5
|
import "./chunk-G4ZAUHHA.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-2Q3KLBE6.js";
|
|
7
7
|
import {
|
|
8
8
|
init_require_shim
|
|
9
9
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listCacheBuckets,
|
|
3
3
|
listLocalCacheBuckets
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WJII3LZK.js";
|
|
5
5
|
import "./chunk-G4ZAUHHA.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-2Q3KLBE6.js";
|
|
7
7
|
import {
|
|
8
8
|
init_require_shim
|
|
9
9
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -3,15 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-DMMC4X27.js";
|
|
4
4
|
import {
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QYRF3R35.js";
|
|
7
7
|
import {
|
|
8
8
|
output
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MIKWIFYR.js";
|
|
10
|
+
import "./chunk-CGZL5SSH.js";
|
|
10
11
|
import "./chunk-WCODTMDN.js";
|
|
11
12
|
import {
|
|
12
13
|
loadRegistry
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-VST6HAB6.js";
|
|
15
|
+
import "./chunk-2Q3KLBE6.js";
|
|
15
16
|
import {
|
|
16
17
|
loadPluginJson
|
|
17
18
|
} from "./chunk-G3U4V32O.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configure,
|
|
3
|
+
isPlain,
|
|
3
4
|
isVerbose,
|
|
4
5
|
output
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MIKWIFYR.js";
|
|
7
|
+
import "./chunk-CGZL5SSH.js";
|
|
6
8
|
import "./chunk-WCODTMDN.js";
|
|
7
9
|
import "./chunk-TPK5AGRA.js";
|
|
8
10
|
export {
|
|
9
11
|
configure,
|
|
12
|
+
isPlain,
|
|
10
13
|
isVerbose,
|
|
11
14
|
output
|
|
12
15
|
};
|
|
@@ -3,14 +3,16 @@ import {
|
|
|
3
3
|
registerPlugin,
|
|
4
4
|
removePlugin,
|
|
5
5
|
resolvePluginKey,
|
|
6
|
+
resolvePluginKeyScoped,
|
|
6
7
|
saveRegistry
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-VST6HAB6.js";
|
|
9
|
+
import "./chunk-2Q3KLBE6.js";
|
|
9
10
|
import "./chunk-TPK5AGRA.js";
|
|
10
11
|
export {
|
|
11
12
|
loadRegistry,
|
|
12
13
|
registerPlugin,
|
|
13
14
|
removePlugin,
|
|
14
15
|
resolvePluginKey,
|
|
16
|
+
resolvePluginKeyScoped,
|
|
15
17
|
saveRegistry
|
|
16
18
|
};
|
|
@@ -167,12 +167,16 @@ When \`--format jsonl\` is active and stdin is not a TTY, each stdin line is par
|
|
|
167
167
|
\`\`\`jsonl
|
|
168
168
|
{"type":"line","text":"SELECT 1"}
|
|
169
169
|
{"type":"line","text":"SELECT *\\nFROM books\\nWHERE genre = 'Sci-Fi'"}
|
|
170
|
+
{"type":"command","text":"/schema books"}
|
|
171
|
+
{"type":"command","args":{"$command":"schema","table":"books"}}
|
|
170
172
|
{"type":"interrupt"}
|
|
171
173
|
{"type":"eof"}
|
|
172
174
|
\`\`\`
|
|
173
175
|
|
|
174
176
|
Multi-line text is encoded as \`\\n\` in the JSON string \u2014 no Ctrl+Enter needed. Invalid JSON or unrecognised \`type\` values emit a \`{ type: "error" }\` JSONL output line and are skipped; the session continues.
|
|
175
177
|
|
|
178
|
+
Programmatic callers can use \`session.writeCommand('/schema books')\` or \`session.writeCommand('schema', { table: 'books' })\` to dispatch commands.
|
|
179
|
+
|
|
176
180
|
`);
|
|
177
181
|
}
|
|
178
182
|
export {
|