@darkrymit/crunes-cli 0.8.3 → 0.8.5
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/{apply-YC6JEPUN.js → apply-J4YICV6H.js} +6 -5
- package/dist/chunks/{benchmark-BJEAAFWG.js → benchmark-AKKV7G32.js} +4 -4
- package/dist/chunks/{chunk-DZJRYFOP.js → chunk-BTIPUR5S.js} +3 -3
- package/dist/chunks/{chunk-H3BVJCIL.js → chunk-GSA432UC.js} +12 -27
- package/dist/chunks/{chunk-65J65MAP.js → chunk-GTCPZ22N.js} +15 -1
- package/dist/chunks/{chunk-2PBPDTRD.js → chunk-KII6KW5Z.js} +1 -1
- package/dist/chunks/{chunk-NAEVMRNA.js → chunk-T53L5CJW.js} +90 -10
- package/dist/chunks/{chunk-JU6FKUBY.js → chunk-WJRZN7BR.js} +173 -91
- package/dist/chunks/{create-ZFFV3Z2P.js → create-L6DJN4ME.js} +2 -2
- package/dist/chunks/{create-OZACMPEU.js → create-VYZRWRGQ.js} +6 -2
- package/dist/chunks/disable-FGJ7VMPO.js +47 -0
- package/dist/chunks/{doctor-N43QEMAH.js → doctor-7NWBJAH7.js} +1 -1
- package/dist/chunks/{enable-327OMBPC.js → enable-ZL6QOC2I.js} +1 -1
- package/dist/chunks/{install-RRLUOYFO.js → install-FIYRMVLR.js} +2 -2
- package/dist/chunks/{intro-4CICBP2J.js → intro-36OLGNYN.js} +68 -40
- package/dist/chunks/{list-CK5X2YN3.js → list-2JYMBMZC.js} +2 -2
- package/dist/chunks/{list-FLAYJQKN.js → list-AIYNOPNZ.js} +1 -1
- package/dist/chunks/{list-WH7KESMV.js → list-NZ5DHXJF.js} +4 -4
- package/dist/chunks/{registry-3QIL5SVL.js → registry-RG34DPD7.js} +3 -1
- package/dist/chunks/{repl-VGC5FUJG.js → repl-BPEWARN7.js} +5 -5
- package/dist/chunks/{resolver-QMIY33FM.js → resolver-36V72VKR.js} +4 -2
- package/dist/chunks/{run-T33CMCFZ.js → run-IVL23SMW.js} +4 -4
- package/dist/chunks/{rune-UBRVWG5A.js → rune-XRREUL56.js} +63 -16
- package/dist/chunks/{uninstall-55YTHZRH.js → uninstall-G56DZRFG.js} +2 -2
- package/dist/chunks/{update-G6XO4RIM.js → update-KSC6VRMU.js} +2 -2
- package/dist/chunks/{utils-XOWJQWNR.js → utils-3SJFSUSV.js} +1 -1
- package/dist/chunks/{version-2W2M74UT.js → version-YG2M7HER.js} +3 -2
- package/dist/cli.js +22 -28
- package/package.json +3 -2
- package/dist/chunks/disable-TMG2K3BF.js +0 -47
|
@@ -155,8 +155,8 @@ async function handler({
|
|
|
155
155
|
process.exit(1);
|
|
156
156
|
}
|
|
157
157
|
if (!description) {
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
description = `${name} \u2014 a crunes plugin`;
|
|
159
|
+
output.info(`--description not specified, defaulting to "${description}"`);
|
|
160
160
|
}
|
|
161
161
|
author = author ?? getGitAuthor();
|
|
162
162
|
license = license ?? "MIT";
|
|
@@ -78,10 +78,14 @@ async function handler({
|
|
|
78
78
|
output.error("Missing required argument: <key>");
|
|
79
79
|
process.exit(1);
|
|
80
80
|
}
|
|
81
|
-
if (
|
|
82
|
-
output.error(`
|
|
81
|
+
if (format && !VALID_FORMATS.includes(format)) {
|
|
82
|
+
output.error(`Invalid --format. Must be one of: ${VALID_FORMATS.join(", ")}`);
|
|
83
83
|
process.exit(1);
|
|
84
84
|
}
|
|
85
|
+
if (!format) {
|
|
86
|
+
format = "markdown";
|
|
87
|
+
output.info('--format not specified, defaulting to "markdown"');
|
|
88
|
+
}
|
|
85
89
|
} else {
|
|
86
90
|
ye("crunes create");
|
|
87
91
|
if (!key) {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_require_shim
|
|
3
|
+
} from "./chunk-TPK5AGRA.js";
|
|
4
|
+
|
|
5
|
+
// src/plugin/commands/disable.js
|
|
6
|
+
init_require_shim();
|
|
7
|
+
import fs from "node:fs/promises";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
function resolveEnabledPluginKey(nameOrKey, enabledPlugins) {
|
|
10
|
+
if (nameOrKey.includes("@")) return nameOrKey;
|
|
11
|
+
const matches = enabledPlugins.filter((k) => k.slice(k.indexOf("@") + 1) === nameOrKey);
|
|
12
|
+
if (matches.length > 1) {
|
|
13
|
+
throw new Error(`Ambiguous plugin "${nameOrKey}". Use the full key: ${matches.join(", ")}`);
|
|
14
|
+
}
|
|
15
|
+
return matches[0] ?? null;
|
|
16
|
+
}
|
|
17
|
+
async function handler({ name, projectRoot, configRoot }) {
|
|
18
|
+
const configPath = path.join(configRoot ?? projectRoot, ".crunes", "config.json");
|
|
19
|
+
let config;
|
|
20
|
+
try {
|
|
21
|
+
config = JSON.parse(await fs.readFile(configPath, "utf8"));
|
|
22
|
+
} catch (err) {
|
|
23
|
+
if (err.code === "ENOENT") {
|
|
24
|
+
console.error("Error: No .crunes/config.json found. Run: crunes init");
|
|
25
|
+
} else {
|
|
26
|
+
console.error(`Error: ${err.message}`);
|
|
27
|
+
}
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const enabledPlugins = config.plugins ?? [];
|
|
31
|
+
let pluginKey;
|
|
32
|
+
try {
|
|
33
|
+
pluginKey = resolveEnabledPluginKey(name, enabledPlugins);
|
|
34
|
+
if (!pluginKey) throw new Error(`Plugin "${name}" is not enabled in this project.`);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.error(`Error: ${err.message}`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
config.plugins = enabledPlugins.filter((p) => p !== pluginKey);
|
|
40
|
+
const tmp = configPath + ".tmp";
|
|
41
|
+
await fs.writeFile(tmp, JSON.stringify(config, null, 2), "utf8");
|
|
42
|
+
await fs.rename(tmp, configPath);
|
|
43
|
+
console.log(`Plugin "${pluginKey}" disabled.`);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
handler
|
|
47
|
+
};
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-NYLRTAAA.js";
|
|
4
4
|
import {
|
|
5
5
|
installPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KII6KW5Z.js";
|
|
7
7
|
import {
|
|
8
8
|
fe,
|
|
9
9
|
ge,
|
|
10
10
|
ye
|
|
11
11
|
} from "./chunk-CGZL5SSH.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-GTCPZ22N.js";
|
|
13
13
|
import "./chunk-6MRZXASS.js";
|
|
14
14
|
import "./chunk-G3U4V32O.js";
|
|
15
15
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
utils_api_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T53L5CJW.js";
|
|
4
4
|
import {
|
|
5
5
|
globals_api_default
|
|
6
6
|
} from "./chunk-V35LVVNV.js";
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
formatNode,
|
|
10
10
|
walk
|
|
11
11
|
} from "./chunk-JOAL437H.js";
|
|
12
|
-
import {
|
|
13
|
-
loadConfig
|
|
14
|
-
} from "./chunk-H3BVJCIL.js";
|
|
15
12
|
import "./chunk-ASZKAC24.js";
|
|
16
13
|
import {
|
|
17
14
|
output
|
|
@@ -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,21 @@ 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:");
|
|
2523
|
+
lines.push("```bash");
|
|
2524
|
+
lines.push("crunes create my-rune --format markdown --yes");
|
|
2525
|
+
lines.push("```");
|
|
2526
|
+
lines.push("");
|
|
2527
|
+
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
2528
|
lines.push("");
|
|
2522
2529
|
lines.push("```javascript");
|
|
2530
|
+
lines.push("import { vars, rune } from '@utils'");
|
|
2531
|
+
lines.push("");
|
|
2523
2532
|
lines.push("export function args(builder) {");
|
|
2533
|
+
lines.push(" const profiles = vars.read('deploy_profiles', ['staging', 'production'])");
|
|
2524
2534
|
lines.push(" return builder");
|
|
2535
|
+
lines.push(" .option('-h, --help', 'Show help')");
|
|
2536
|
+
lines.push(" .option('--profile <name>', `Deployment profile (${profiles.join('|')})`, profiles[0])");
|
|
2525
2537
|
lines.push(" .option('--verbose', 'Verbose output', false)");
|
|
2526
2538
|
lines.push(" .command('remote', 'Manage git remotes', remote => {");
|
|
2527
2539
|
lines.push(" remote.command('add', 'Add a remote', add => {");
|
|
@@ -2532,6 +2544,7 @@ async function compileIntro() {
|
|
|
2532
2544
|
lines.push("}");
|
|
2533
2545
|
lines.push("");
|
|
2534
2546
|
lines.push("export async function run(args) {");
|
|
2547
|
+
lines.push(" if (args.help) return rune.helpSection()");
|
|
2535
2548
|
lines.push(" if (args.$command === 'remote add') {");
|
|
2536
2549
|
lines.push(" return `Adding remote ${args.name} at ${args.url}`");
|
|
2537
2550
|
lines.push(" }");
|
|
@@ -2580,6 +2593,9 @@ async function compileIntro() {
|
|
|
2580
2593
|
lines.push("> [!WARNING]");
|
|
2581
2594
|
lines.push("> Placing a global flag after `run` (e.g. `crunes run --cwd ./project`) causes an instant error.");
|
|
2582
2595
|
lines.push("");
|
|
2596
|
+
lines.push("> [!WARNING]");
|
|
2597
|
+
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.");
|
|
2598
|
+
lines.push("");
|
|
2583
2599
|
lines.push("### Bracket Syntax (Segment-Level Flags)");
|
|
2584
2600
|
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
2601
|
lines.push("");
|
|
@@ -2602,6 +2618,7 @@ async function compileIntro() {
|
|
|
2602
2618
|
lines.push('- **`args.$commands`**: The matched command path levels array (e.g. `["remote", "add"]`).');
|
|
2603
2619
|
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
2620
|
lines.push("- **Named Positionals**: Parameters like `<name>` or `[scope]` are automatically mapped to `args.name` or `args.scope`.");
|
|
2621
|
+
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
2622
|
lines.push("");
|
|
2606
2623
|
lines.push("### Batched Executions");
|
|
2607
2624
|
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 +2631,10 @@ async function compileIntro() {
|
|
|
2614
2631
|
lines.push("");
|
|
2615
2632
|
lines.push("Configuration properties in `.crunes/config.json` control permissions, default variables, mappings, and plugin registration.");
|
|
2616
2633
|
lines.push("");
|
|
2634
|
+
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.");
|
|
2635
|
+
lines.push("");
|
|
2617
2636
|
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`:");
|
|
2637
|
+
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
2638
|
lines.push("```json");
|
|
2620
2639
|
lines.push("{");
|
|
2621
2640
|
lines.push(' "runes": {');
|
|
@@ -2623,12 +2642,10 @@ async function compileIntro() {
|
|
|
2623
2642
|
lines.push(' "name": "My Rune",');
|
|
2624
2643
|
lines.push(' "description": "Does something useful",');
|
|
2625
2644
|
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 *"] }');
|
|
2645
|
+
lines.push(' "vars": { "api_url": "https://example.com" },');
|
|
2646
|
+
lines.push(' "permissions": {');
|
|
2647
|
+
lines.push(' "run": { "allow": ["fs.read:src/**", "fs.write:dist/**", "shell.run:git *"] }');
|
|
2648
|
+
lines.push(" }");
|
|
2632
2649
|
lines.push(" }");
|
|
2633
2650
|
lines.push(" }");
|
|
2634
2651
|
lines.push("}");
|
|
@@ -2648,11 +2665,37 @@ async function compileIntro() {
|
|
|
2648
2665
|
lines.push("}");
|
|
2649
2666
|
lines.push("```");
|
|
2650
2667
|
lines.push("");
|
|
2668
|
+
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).');
|
|
2669
|
+
lines.push("```json");
|
|
2670
|
+
lines.push("{");
|
|
2671
|
+
lines.push(' "plugins": ["my-market@my-plugin"],');
|
|
2672
|
+
lines.push(' "runes": {');
|
|
2673
|
+
lines.push(' "my-market@my-plugin:deploy": {');
|
|
2674
|
+
lines.push(' "vars": { "region": "us-east-1" },');
|
|
2675
|
+
lines.push(' "permissions": {');
|
|
2676
|
+
lines.push(' "run": { "allow": ["fs.read:src/**"] }');
|
|
2677
|
+
lines.push(" }");
|
|
2678
|
+
lines.push(" }");
|
|
2679
|
+
lines.push(" }");
|
|
2680
|
+
lines.push("}");
|
|
2681
|
+
lines.push("```");
|
|
2682
|
+
lines.push("");
|
|
2683
|
+
lines.push("### Disambiguating Same-Named Plugins");
|
|
2684
|
+
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.");
|
|
2685
|
+
lines.push("");
|
|
2686
|
+
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:");
|
|
2687
|
+
lines.push("```json");
|
|
2688
|
+
lines.push("{");
|
|
2689
|
+
lines.push(' "runes": {');
|
|
2690
|
+
lines.push(' "git": { "plugin": "my-org@git:status" }');
|
|
2691
|
+
lines.push(" }");
|
|
2692
|
+
lines.push("}");
|
|
2693
|
+
lines.push("```");
|
|
2694
|
+
lines.push("Now `crunes run git` always resolves to that specific plugin rune, with no ambiguity, regardless of what else is enabled.");
|
|
2695
|
+
lines.push("");
|
|
2651
2696
|
lines.push("### Config File Fields Reference");
|
|
2652
|
-
lines.push(
|
|
2653
|
-
lines.push("- **`
|
|
2654
|
-
lines.push("- **`vars`**: Key-value settings scoped to specific runes (accessible inside the isolate via `utils.vars.read(key)`).");
|
|
2655
|
-
lines.push("- **`plugins`**: Mappings of enabled third-party marketplaces or plugins.");
|
|
2697
|
+
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).');
|
|
2698
|
+
lines.push("- **`plugins`**: List of enabled third-party marketplaces or plugins.");
|
|
2656
2699
|
lines.push("");
|
|
2657
2700
|
lines.push("## 4. Rune Exports API Reference");
|
|
2658
2701
|
lines.push("");
|
|
@@ -2692,24 +2735,9 @@ async function compileIntro() {
|
|
|
2692
2735
|
}
|
|
2693
2736
|
|
|
2694
2737
|
// 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
|
-
}
|
|
2738
|
+
async function handler({ out } = {}) {
|
|
2705
2739
|
try {
|
|
2706
|
-
const content = await compileIntro(
|
|
2707
|
-
config,
|
|
2708
|
-
format,
|
|
2709
|
-
projectRoot,
|
|
2710
|
-
configRoot,
|
|
2711
|
-
hasProjectError: loadError
|
|
2712
|
-
});
|
|
2740
|
+
const content = await compileIntro();
|
|
2713
2741
|
if (out) {
|
|
2714
2742
|
const targetPath = resolve(process.cwd(), out);
|
|
2715
2743
|
writeFileSync(targetPath, content, "utf8");
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-DMMC4X27.js";
|
|
4
4
|
import {
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GSA432UC.js";
|
|
7
7
|
import {
|
|
8
8
|
output
|
|
9
9
|
} from "./chunk-6XLT25GS.js";
|
|
10
10
|
import "./chunk-WCODTMDN.js";
|
|
11
11
|
import {
|
|
12
12
|
loadRegistry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GTCPZ22N.js";
|
|
14
14
|
import "./chunk-6MRZXASS.js";
|
|
15
15
|
import {
|
|
16
16
|
loadPluginJson
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
} from "./chunk-DMMC4X27.js";
|
|
4
4
|
import {
|
|
5
5
|
loadConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GSA432UC.js";
|
|
7
7
|
import {
|
|
8
8
|
getRune
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WJRZN7BR.js";
|
|
10
10
|
import "./chunk-J3GZ3DXD.js";
|
|
11
11
|
import "./chunk-ZJDKCC2Y.js";
|
|
12
12
|
import "./chunk-NDEYEYSU.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
output
|
|
18
18
|
} from "./chunk-6XLT25GS.js";
|
|
19
19
|
import "./chunk-WCODTMDN.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-GTCPZ22N.js";
|
|
21
21
|
import "./chunk-6MRZXASS.js";
|
|
22
22
|
import "./chunk-G3U4V32O.js";
|
|
23
23
|
import {
|
|
@@ -53,7 +53,7 @@ async function handler({
|
|
|
53
53
|
const enabledPlugins = config.plugins ?? [];
|
|
54
54
|
if (enabledPlugins.length > 0) {
|
|
55
55
|
try {
|
|
56
|
-
const { loadRegistry } = await import("./registry-
|
|
56
|
+
const { loadRegistry } = await import("./registry-RG34DPD7.js");
|
|
57
57
|
const { loadPluginJson } = await import("./manifest-7RVNKBOH.js");
|
|
58
58
|
const registry = await loadRegistry();
|
|
59
59
|
for (const pluginKey of enabledPlugins) {
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
registerPlugin,
|
|
4
4
|
removePlugin,
|
|
5
5
|
resolvePluginKey,
|
|
6
|
+
resolvePluginKeyScoped,
|
|
6
7
|
saveRegistry
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GTCPZ22N.js";
|
|
8
9
|
import "./chunk-6MRZXASS.js";
|
|
9
10
|
import "./chunk-TPK5AGRA.js";
|
|
10
11
|
export {
|
|
@@ -12,5 +13,6 @@ export {
|
|
|
12
13
|
registerPlugin,
|
|
13
14
|
removePlugin,
|
|
14
15
|
resolvePluginKey,
|
|
16
|
+
resolvePluginKeyScoped,
|
|
15
17
|
saveRegistry
|
|
16
18
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatSection,
|
|
3
3
|
parseSegment
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BTIPUR5S.js";
|
|
5
5
|
import {
|
|
6
6
|
loadConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GSA432UC.js";
|
|
8
8
|
import {
|
|
9
9
|
isGlobMatch,
|
|
10
10
|
parseArgs,
|
|
11
11
|
tailStdin
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WJRZN7BR.js";
|
|
13
13
|
import "./chunk-J3GZ3DXD.js";
|
|
14
14
|
import "./chunk-ZJDKCC2Y.js";
|
|
15
15
|
import "./chunk-NDEYEYSU.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
output
|
|
22
22
|
} from "./chunk-6XLT25GS.js";
|
|
23
23
|
import "./chunk-WCODTMDN.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-GTCPZ22N.js";
|
|
25
25
|
import "./chunk-6MRZXASS.js";
|
|
26
26
|
import "./chunk-G3U4V32O.js";
|
|
27
27
|
import {
|
|
@@ -104,7 +104,7 @@ async function handler({
|
|
|
104
104
|
output.info("Run `crunes init` to create a config file.");
|
|
105
105
|
process.exit(1);
|
|
106
106
|
}
|
|
107
|
-
const { resolveRuneEntry } = await import("./resolver-
|
|
107
|
+
const { resolveRuneEntry } = await import("./resolver-36V72VKR.js");
|
|
108
108
|
let runeEntry;
|
|
109
109
|
try {
|
|
110
110
|
runeEntry = await resolveRuneEntry(projectRoot, config, key, configRoot);
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
normaliseRune,
|
|
4
4
|
resolvePluginRune,
|
|
5
5
|
resolveRuneEntry,
|
|
6
|
+
resolveRuneFromPlugins,
|
|
6
7
|
runRune
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WJRZN7BR.js";
|
|
8
9
|
import "./chunk-J3GZ3DXD.js";
|
|
9
10
|
import "./chunk-ZJDKCC2Y.js";
|
|
10
11
|
import "./chunk-NDEYEYSU.js";
|
|
@@ -13,7 +14,7 @@ import "./chunk-63H5VXZY.js";
|
|
|
13
14
|
import "./chunk-ASZKAC24.js";
|
|
14
15
|
import "./chunk-6XLT25GS.js";
|
|
15
16
|
import "./chunk-WCODTMDN.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-GTCPZ22N.js";
|
|
17
18
|
import "./chunk-6MRZXASS.js";
|
|
18
19
|
import "./chunk-G3U4V32O.js";
|
|
19
20
|
import "./chunk-TPK5AGRA.js";
|
|
@@ -22,5 +23,6 @@ export {
|
|
|
22
23
|
normaliseRune,
|
|
23
24
|
resolvePluginRune,
|
|
24
25
|
resolveRuneEntry,
|
|
26
|
+
resolveRuneFromPlugins,
|
|
25
27
|
runRune
|
|
26
28
|
};
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
parseBracketKey,
|
|
4
4
|
parseRunArgs,
|
|
5
5
|
parseSegment
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-BTIPUR5S.js";
|
|
7
|
+
import "./chunk-GSA432UC.js";
|
|
8
|
+
import "./chunk-WJRZN7BR.js";
|
|
9
9
|
import "./chunk-J3GZ3DXD.js";
|
|
10
10
|
import "./chunk-ZJDKCC2Y.js";
|
|
11
11
|
import "./chunk-NDEYEYSU.js";
|
|
@@ -14,7 +14,7 @@ import "./chunk-63H5VXZY.js";
|
|
|
14
14
|
import "./chunk-ASZKAC24.js";
|
|
15
15
|
import "./chunk-6XLT25GS.js";
|
|
16
16
|
import "./chunk-WCODTMDN.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-GTCPZ22N.js";
|
|
18
18
|
import "./chunk-6MRZXASS.js";
|
|
19
19
|
import "./chunk-G3U4V32O.js";
|
|
20
20
|
import "./chunk-TPK5AGRA.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GSA432UC.js";
|
|
4
4
|
import {
|
|
5
5
|
computeEffectivePermissions,
|
|
6
6
|
getArgsSchema,
|
|
7
|
+
getPluginRunePath,
|
|
7
8
|
getReplSchema,
|
|
8
|
-
getRune
|
|
9
|
-
|
|
9
|
+
getRune,
|
|
10
|
+
resolvePluginRune,
|
|
11
|
+
resolveRuneFromPlugins
|
|
12
|
+
} from "./chunk-WJRZN7BR.js";
|
|
10
13
|
import "./chunk-J3GZ3DXD.js";
|
|
11
14
|
import "./chunk-ZJDKCC2Y.js";
|
|
12
15
|
import "./chunk-NDEYEYSU.js";
|
|
@@ -19,9 +22,11 @@ import {
|
|
|
19
22
|
output
|
|
20
23
|
} from "./chunk-6XLT25GS.js";
|
|
21
24
|
import "./chunk-WCODTMDN.js";
|
|
22
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-GTCPZ22N.js";
|
|
23
26
|
import "./chunk-6MRZXASS.js";
|
|
24
|
-
import
|
|
27
|
+
import {
|
|
28
|
+
loadPluginJson
|
|
29
|
+
} from "./chunk-G3U4V32O.js";
|
|
25
30
|
import {
|
|
26
31
|
init_require_shim
|
|
27
32
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -72,8 +77,27 @@ async function handler({ keys, format = "text", projectRoot = process.cwd(), con
|
|
|
72
77
|
const results = [];
|
|
73
78
|
let anyFailed = false;
|
|
74
79
|
for (const key of keys) {
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
let pluginMatch;
|
|
81
|
+
try {
|
|
82
|
+
pluginMatch = await resolvePluginRune(config, key);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
output.warn(err.message);
|
|
85
|
+
anyFailed = true;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const localEntry = pluginMatch ? null : getRune(config, key);
|
|
89
|
+
let autoMatch = null;
|
|
90
|
+
if (!pluginMatch && !localEntry) {
|
|
91
|
+
try {
|
|
92
|
+
autoMatch = await resolveRuneFromPlugins(config, key);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
output.warn(err.message);
|
|
95
|
+
anyFailed = true;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const resolved = pluginMatch ?? autoMatch;
|
|
100
|
+
if (!localEntry && !resolved) {
|
|
77
101
|
if (SUGGESTIONS[key]) {
|
|
78
102
|
output.warn(`Unknown rune: "${key}". (Tip: Did you mean "${SUGGESTIONS[key]}"?)`);
|
|
79
103
|
} else {
|
|
@@ -82,12 +106,36 @@ async function handler({ keys, format = "text", projectRoot = process.cwd(), con
|
|
|
82
106
|
anyFailed = true;
|
|
83
107
|
continue;
|
|
84
108
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
109
|
+
let runeFile, relativePath, basePerms, vars, displayName, displayDescription, batch;
|
|
110
|
+
if (resolved) {
|
|
111
|
+
const { runeKey, pluginDir } = resolved;
|
|
112
|
+
let pluginJson;
|
|
113
|
+
try {
|
|
114
|
+
pluginJson = await loadPluginJson(pluginDir);
|
|
115
|
+
} catch (err) {
|
|
116
|
+
output.warn(`Could not load plugin for "${key}": ${err.message}`);
|
|
117
|
+
anyFailed = true;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const runeDef = pluginJson.runes[runeKey] ?? {};
|
|
121
|
+
runeFile = getPluginRunePath(pluginDir, runeKey, pluginJson);
|
|
122
|
+
relativePath = void 0;
|
|
123
|
+
basePerms = runeDef.permissions ?? { allow: [], deny: [] };
|
|
124
|
+
vars = runeDef.vars ?? {};
|
|
125
|
+
displayName = runeDef.name ?? runeKey;
|
|
126
|
+
displayDescription = runeDef.description ?? null;
|
|
127
|
+
batch = runeDef.batch != null ? { allow: runeDef.batch.allow ?? [], deny: runeDef.batch.deny ?? [] } : null;
|
|
128
|
+
} else {
|
|
129
|
+
runeFile = join(configRoot, localEntry.path ?? `.crunes/runes/${key}.js`);
|
|
130
|
+
relativePath = relative(projectRoot, runeFile).replace(/\\/g, "/");
|
|
131
|
+
basePerms = localEntry.permissions ?? { allow: [], deny: [] };
|
|
132
|
+
vars = localEntry.vars ?? {};
|
|
133
|
+
displayName = localEntry.name ?? key;
|
|
134
|
+
displayDescription = localEntry.description ?? null;
|
|
135
|
+
batch = localEntry.batch != null ? { allow: localEntry.batch.allow ?? [], deny: localEntry.batch.deny ?? [] } : null;
|
|
136
|
+
}
|
|
137
|
+
const runEffective = computeEffectivePermissions(basePerms, void 0, "run");
|
|
138
|
+
const replEffective = computeEffectivePermissions(basePerms, void 0, "repl");
|
|
91
139
|
let schema = null;
|
|
92
140
|
try {
|
|
93
141
|
schema = await getArgsSchema(runeFile, runEffective, projectRoot, { vars, runeKey: key });
|
|
@@ -103,11 +151,10 @@ async function handler({ keys, format = "text", projectRoot = process.cwd(), con
|
|
|
103
151
|
} catch (err) {
|
|
104
152
|
output.warn(`Could not load REPL schema for "${key}": ${err.message}`);
|
|
105
153
|
}
|
|
106
|
-
const batch = entry.batch != null ? { allow: entry.batch.allow ?? [], deny: entry.batch.deny ?? [] } : null;
|
|
107
154
|
results.push({
|
|
108
155
|
key,
|
|
109
|
-
name:
|
|
110
|
-
description:
|
|
156
|
+
name: displayName,
|
|
157
|
+
description: displayDescription,
|
|
111
158
|
relativePath,
|
|
112
159
|
schema,
|
|
113
160
|
repl,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
uninstallPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KII6KW5Z.js";
|
|
4
4
|
import {
|
|
5
5
|
R,
|
|
6
6
|
fe,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
loadRegistry,
|
|
12
12
|
resolvePluginKey
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GTCPZ22N.js";
|
|
14
14
|
import "./chunk-6MRZXASS.js";
|
|
15
15
|
import "./chunk-G3U4V32O.js";
|
|
16
16
|
import {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-NYLRTAAA.js";
|
|
4
4
|
import {
|
|
5
5
|
installPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KII6KW5Z.js";
|
|
7
7
|
import {
|
|
8
8
|
R2 as R,
|
|
9
9
|
fe,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
loadRegistry,
|
|
15
15
|
resolvePluginKey
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GTCPZ22N.js";
|
|
17
17
|
import "./chunk-6MRZXASS.js";
|
|
18
18
|
import "./chunk-G3U4V32O.js";
|
|
19
19
|
import {
|