@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.
Files changed (72) hide show
  1. package/dist/chunks/{add-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
  2. package/dist/chunks/{apply-YC6JEPUN.js → apply-YY7MIM64.js} +13 -12
  3. package/dist/chunks/{benchmark-BJEAAFWG.js → benchmark-BQNMULOO.js} +17 -14
  4. package/dist/chunks/{browse-JZFU52ET.js → browse-PHMBDREQ.js} +2 -2
  5. package/dist/chunks/{chunk-6MRZXASS.js → chunk-2Q3KLBE6.js} +16 -0
  6. package/dist/chunks/{chunk-2PBPDTRD.js → chunk-34F4ZURL.js} +40 -37
  7. package/dist/chunks/{chunk-ZJDKCC2Y.js → chunk-4GJMCFR6.js} +6 -3
  8. package/dist/chunks/chunk-CY6C6ADU.js +2787 -0
  9. package/dist/chunks/{chunk-J3GZ3DXD.js → chunk-GVMT55GH.js} +3 -2
  10. package/dist/chunks/{chunk-JOAL437H.js → chunk-I6MHDUCW.js} +16 -1
  11. package/dist/chunks/{chunk-6XLT25GS.js → chunk-MIKWIFYR.js} +47 -0
  12. package/dist/chunks/chunk-MRNZFUXZ.js +70 -0
  13. package/dist/chunks/{chunk-NAEVMRNA.js → chunk-PBGUKXT6.js} +2940 -1847
  14. package/dist/chunks/chunk-QYRF3R35.js +154 -0
  15. package/dist/chunks/{chunk-DZJRYFOP.js → chunk-SNC7AOT7.js} +78 -12
  16. package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
  17. package/dist/chunks/{chunk-65J65MAP.js → chunk-VST6HAB6.js} +16 -2
  18. package/dist/chunks/{chunk-NDEYEYSU.js → chunk-WJII3LZK.js} +4 -3
  19. package/dist/chunks/chunk-X7PZN73N.js +44 -0
  20. package/dist/chunks/{chunk-NYLRTAAA.js → chunk-YVN3VDRE.js} +1 -1
  21. package/dist/chunks/{chunk-JU6FKUBY.js → chunk-YXCHIMLW.js} +995 -3097
  22. package/dist/chunks/{clear-YBDIPEEH.js → clear-AT7HNUV4.js} +2 -2
  23. package/dist/chunks/{create-GPDE2YKL.js → create-ET6DT5ZE.js} +22 -18
  24. package/dist/chunks/{create-OZACMPEU.js → create-LM7U3CJS.js} +28 -20
  25. package/dist/chunks/{create-ZFFV3Z2P.js → create-TLPM7HJE.js} +5 -5
  26. package/dist/chunks/{delete-LNOYM5KG.js → delete-5R3WBLVD.js} +5 -5
  27. package/dist/chunks/{delete-E4TEBRPX.js → delete-GKYA2W5Z.js} +4 -2
  28. package/dist/chunks/{delete-C4UJ7X5K.js → delete-U4STA2QZ.js} +5 -5
  29. package/dist/chunks/disable-TNTEIAKO.js +39 -0
  30. package/dist/chunks/doctor-VXAQYMTR.js +101 -0
  31. package/dist/chunks/enable-GUQCB4CU.js +31 -0
  32. package/dist/chunks/{globals-H2WF344Y.js → globals-SNQFCHMP.js} +1 -1
  33. package/dist/chunks/{init-HU5OMHEH.js → init-PJSCFOC6.js} +14 -8
  34. package/dist/chunks/{install-RRLUOYFO.js → install-4YP7FALO.js} +18 -16
  35. package/dist/chunks/{intro-4CICBP2J.js → intro-SA7MWV3Z.js} +113 -43
  36. package/dist/chunks/{kill-2UG7PHUV.js → kill-TX3PC73P.js} +2 -1
  37. package/dist/chunks/list-7R6NASFI.js +92 -0
  38. package/dist/chunks/{list-4X3JFQGS.js → list-EHREZR6M.js} +2 -1
  39. package/dist/chunks/{list-U7PAYNAH.js → list-LC6HB3H3.js} +2 -2
  40. package/dist/chunks/{list-FLAYJQKN.js → list-OMMZAQ23.js} +2 -2
  41. package/dist/chunks/{list-7VHJIUDX.js → list-U4EMHQZT.js} +2 -2
  42. package/dist/chunks/{list-PTAWQYWG.js → list-V7VVD5AG.js} +2 -1
  43. package/dist/chunks/{list-A5WVDBWF.js → list-VA73WPK6.js} +2 -2
  44. package/dist/chunks/{list-CK5X2YN3.js → list-WKNPZZOV.js} +5 -4
  45. package/dist/chunks/{output-RJ6JSNY7.js → output-QN5CVJ62.js} +4 -1
  46. package/dist/chunks/{query-AW7WYILM.js → query-2US3CPYT.js} +2 -2
  47. package/dist/chunks/{registry-3QIL5SVL.js → registry-K5DV5NAK.js} +4 -2
  48. package/dist/chunks/{remove-QUH2D3S5.js → remove-BCFTF23J.js} +2 -2
  49. package/dist/chunks/{repl-STBZC4P2.js → repl-2YWTHUWT.js} +4 -0
  50. package/dist/chunks/{repl-VGC5FUJG.js → repl-ZB3DIJ4K.js} +84 -26
  51. package/dist/chunks/resolver-QIYYFIDX.js +34 -0
  52. package/dist/chunks/run-22B65ZWZ.js +29 -0
  53. package/dist/chunks/rune-SYK4N642.js +425 -0
  54. package/dist/chunks/{search-MSSDGJTF.js → search-B7IM7JRJ.js} +2 -2
  55. package/dist/chunks/shell-explain-QLITLHW7.js +74 -0
  56. package/dist/chunks/{uninstall-55YTHZRH.js → uninstall-4WR5IHLC.js} +15 -11
  57. package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
  58. package/dist/chunks/{update-G6XO4RIM.js → update-ACLDK6E6.js} +19 -18
  59. package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
  60. package/dist/chunks/{utils-XOWJQWNR.js → utils-B2QULX5J.js} +8 -4
  61. package/dist/chunks/{version-PW7MHDFH.js → version-EULYWNXN.js} +3 -2
  62. package/dist/cli.js +93 -71
  63. package/package.json +2 -1
  64. package/dist/chunks/chunk-ASZKAC24.js +0 -103
  65. package/dist/chunks/chunk-H3BVJCIL.js +0 -105
  66. package/dist/chunks/disable-TMG2K3BF.js +0 -47
  67. package/dist/chunks/doctor-N43QEMAH.js +0 -53
  68. package/dist/chunks/enable-327OMBPC.js +0 -47
  69. package/dist/chunks/list-WH7KESMV.js +0 -111
  70. package/dist/chunks/resolver-QMIY33FM.js +0 -26
  71. package/dist/chunks/run-T33CMCFZ.js +0 -26
  72. package/dist/chunks/rune-UBRVWG5A.js +0 -139
@@ -1,53 +0,0 @@
1
- import {
2
- loadConfig
3
- } from "./chunk-H3BVJCIL.js";
4
- import {
5
- output
6
- } from "./chunk-6XLT25GS.js";
7
- import "./chunk-WCODTMDN.js";
8
- import {
9
- init_require_shim
10
- } from "./chunk-TPK5AGRA.js";
11
-
12
- // src/cli/commands/doctor.js
13
- init_require_shim();
14
- import { spawnSync } from "node:child_process";
15
- var KNOWN_FORMATS = /* @__PURE__ */ new Set(["1"]);
16
- async function handler({ projectRoot = process.cwd() } = {}) {
17
- let anyFailed = false;
18
- const major = parseInt(process.versions.node.split(".")[0], 10);
19
- if (major >= 22) {
20
- output.success(`Node.js v${process.versions.node}`);
21
- } else {
22
- output.error(`Node.js v${process.versions.node} \u2014 requires >= 22`);
23
- anyFailed = true;
24
- }
25
- const versionResult = spawnSync("crunes", ["--version"], { encoding: "utf8", shell: true });
26
- if (versionResult.status === 0) {
27
- output.success(`crunes ${versionResult.stdout.trim()} in PATH`);
28
- } else {
29
- output.warn("crunes not found globally in PATH (you can still run it locally or via npx)");
30
- }
31
- let config;
32
- try {
33
- config = loadConfig(projectRoot);
34
- } catch (err) {
35
- output.error(`Config: ${err.message}`);
36
- anyFailed = true;
37
- }
38
- if (config) {
39
- const runeCount = Object.keys(config.runes ?? {}).length;
40
- if (config.format !== void 0 && !KNOWN_FORMATS.has(String(config.format))) {
41
- output.error(`Config format "${config.format}" not recognised by this CLI version`);
42
- anyFailed = true;
43
- } else {
44
- output.success(`Config valid \u2014 ${runeCount} rune${runeCount === 1 ? "" : "s"} registered`);
45
- }
46
- }
47
- if (anyFailed) {
48
- process.exit(1);
49
- }
50
- }
51
- export {
52
- handler
53
- };
@@ -1,47 +0,0 @@
1
- import {
2
- loadRegistry,
3
- resolvePluginKey
4
- } from "./chunk-65J65MAP.js";
5
- import "./chunk-6MRZXASS.js";
6
- import {
7
- init_require_shim
8
- } from "./chunk-TPK5AGRA.js";
9
-
10
- // src/plugin/commands/enable.js
11
- init_require_shim();
12
- import fs from "node:fs/promises";
13
- import path from "node:path";
14
- async function handler({ name, projectRoot, configRoot }) {
15
- try {
16
- const registry = await loadRegistry();
17
- const pluginKey = resolvePluginKey(name, registry);
18
- if (!pluginKey) throw new Error(`Plugin "${name}" is not installed. Run: crunes plugin list`);
19
- await setProjectPluginEnabled(configRoot ?? projectRoot, pluginKey, true);
20
- console.log(`Plugin "${pluginKey}" enabled.`);
21
- } catch (err) {
22
- console.error(`Error: ${err.message}`);
23
- process.exit(1);
24
- }
25
- }
26
- async function setProjectPluginEnabled(configRoot, pluginKey, enabled) {
27
- const configPath = path.join(configRoot, ".crunes", "config.json");
28
- let config;
29
- try {
30
- config = JSON.parse(await fs.readFile(configPath, "utf8"));
31
- } catch (err) {
32
- if (err.code === "ENOENT") throw new Error("No .crunes/config.json found. Run: crunes init");
33
- throw err;
34
- }
35
- const plugins = config.plugins ?? [];
36
- if (enabled && !plugins.includes(pluginKey)) {
37
- config.plugins = [...plugins, pluginKey];
38
- } else if (!enabled) {
39
- config.plugins = plugins.filter((p) => p !== pluginKey);
40
- }
41
- const tmp = configPath + ".tmp";
42
- await fs.writeFile(tmp, JSON.stringify(config, null, 2), "utf8");
43
- await fs.rename(tmp, configPath);
44
- }
45
- export {
46
- handler
47
- };
@@ -1,111 +0,0 @@
1
- import {
2
- require_cli_table3
3
- } from "./chunk-DMMC4X27.js";
4
- import {
5
- loadConfig
6
- } from "./chunk-H3BVJCIL.js";
7
- import {
8
- getRune
9
- } from "./chunk-JU6FKUBY.js";
10
- import "./chunk-J3GZ3DXD.js";
11
- import "./chunk-ZJDKCC2Y.js";
12
- import "./chunk-NDEYEYSU.js";
13
- import "./chunk-G4ZAUHHA.js";
14
- import "./chunk-63H5VXZY.js";
15
- import "./chunk-ASZKAC24.js";
16
- import {
17
- output
18
- } from "./chunk-6XLT25GS.js";
19
- import "./chunk-WCODTMDN.js";
20
- import "./chunk-65J65MAP.js";
21
- import "./chunk-6MRZXASS.js";
22
- import "./chunk-G3U4V32O.js";
23
- import {
24
- __toESM,
25
- init_require_shim
26
- } from "./chunk-TPK5AGRA.js";
27
-
28
- // src/rune/commands/list.js
29
- init_require_shim();
30
- var import_cli_table3 = __toESM(require_cli_table3(), 1);
31
- async function handler({
32
- format = "md",
33
- plain = false,
34
- projectRoot = process.cwd(),
35
- configRoot = projectRoot
36
- } = {}) {
37
- let config;
38
- try {
39
- config = loadConfig(configRoot);
40
- } catch (err) {
41
- output.error(`Config unreadable: ${err.message}`);
42
- output.info("Run `crunes init` to create a config file.");
43
- process.exit(1);
44
- }
45
- const runes = config.runes ?? {};
46
- const keys = Object.keys(runes);
47
- const entries = [];
48
- for (const key of keys) {
49
- const entry = getRune(config, key);
50
- const source = entry.plugin ? `\u2192 ${entry.plugin}` : entry.path ?? "";
51
- entries.push({ key, source, name: entry.name ?? null, description: entry.description ?? null });
52
- }
53
- const enabledPlugins = config.plugins ?? [];
54
- if (enabledPlugins.length > 0) {
55
- try {
56
- const { loadRegistry } = await import("./registry-3QIL5SVL.js");
57
- const { loadPluginJson } = await import("./manifest-7RVNKBOH.js");
58
- const registry = await loadRegistry();
59
- for (const pluginKey of enabledPlugins) {
60
- const entry = registry.plugins?.[pluginKey];
61
- if (!entry) continue;
62
- let pluginJson;
63
- try {
64
- pluginJson = await loadPluginJson(entry.path);
65
- } catch {
66
- continue;
67
- }
68
- for (const [runeKey, runeEntry] of Object.entries(pluginJson.runes ?? {})) {
69
- const idx = pluginKey.indexOf("@");
70
- const shortName = idx !== -1 ? pluginKey.slice(idx + 1) : pluginKey;
71
- const displayKey = `${shortName}:${runeKey}`;
72
- if (!entries.some((e) => e.key === displayKey)) {
73
- entries.push({
74
- key: displayKey,
75
- source: `plugin: ${pluginKey}`,
76
- name: runeEntry.name ?? null,
77
- description: runeEntry.description ?? null
78
- });
79
- }
80
- }
81
- }
82
- } catch (e) {
83
- }
84
- }
85
- if (entries.length === 0) {
86
- process.stdout.write("No runes configured. Run `crunes create <key>` to add one.\n");
87
- return;
88
- }
89
- if (format === "json") {
90
- process.stdout.write(JSON.stringify(entries, null, 2) + "\n");
91
- return;
92
- }
93
- if (plain) {
94
- for (const { key, name, description, source } of entries) {
95
- process.stdout.write(`${key} ${name ?? ""} ${description ?? ""} ${source}
96
- `);
97
- }
98
- return;
99
- }
100
- const table = new import_cli_table3.default({
101
- head: ["Key", "Name", "Description", "Source"],
102
- style: { head: ["cyan"] }
103
- });
104
- for (const { key, name, description, source } of entries) {
105
- table.push([key, name ?? "", description ?? "", source]);
106
- }
107
- process.stdout.write(table.toString() + "\n");
108
- }
109
- export {
110
- handler
111
- };
@@ -1,26 +0,0 @@
1
- import {
2
- getRune,
3
- normaliseRune,
4
- resolvePluginRune,
5
- resolveRuneEntry,
6
- runRune
7
- } from "./chunk-JU6FKUBY.js";
8
- import "./chunk-J3GZ3DXD.js";
9
- import "./chunk-ZJDKCC2Y.js";
10
- import "./chunk-NDEYEYSU.js";
11
- import "./chunk-G4ZAUHHA.js";
12
- import "./chunk-63H5VXZY.js";
13
- import "./chunk-ASZKAC24.js";
14
- import "./chunk-6XLT25GS.js";
15
- import "./chunk-WCODTMDN.js";
16
- import "./chunk-65J65MAP.js";
17
- import "./chunk-6MRZXASS.js";
18
- import "./chunk-G3U4V32O.js";
19
- import "./chunk-TPK5AGRA.js";
20
- export {
21
- getRune,
22
- normaliseRune,
23
- resolvePluginRune,
24
- resolveRuneEntry,
25
- runRune
26
- };
@@ -1,26 +0,0 @@
1
- import {
2
- handler,
3
- parseBracketKey,
4
- parseRunArgs,
5
- parseSegment
6
- } from "./chunk-DZJRYFOP.js";
7
- import "./chunk-H3BVJCIL.js";
8
- import "./chunk-JU6FKUBY.js";
9
- import "./chunk-J3GZ3DXD.js";
10
- import "./chunk-ZJDKCC2Y.js";
11
- import "./chunk-NDEYEYSU.js";
12
- import "./chunk-G4ZAUHHA.js";
13
- import "./chunk-63H5VXZY.js";
14
- import "./chunk-ASZKAC24.js";
15
- import "./chunk-6XLT25GS.js";
16
- import "./chunk-WCODTMDN.js";
17
- import "./chunk-65J65MAP.js";
18
- import "./chunk-6MRZXASS.js";
19
- import "./chunk-G3U4V32O.js";
20
- import "./chunk-TPK5AGRA.js";
21
- export {
22
- handler,
23
- parseBracketKey,
24
- parseRunArgs,
25
- parseSegment
26
- };
@@ -1,139 +0,0 @@
1
- import {
2
- loadConfig
3
- } from "./chunk-H3BVJCIL.js";
4
- import {
5
- computeEffectivePermissions,
6
- getArgsSchema,
7
- getReplSchema,
8
- getRune
9
- } from "./chunk-JU6FKUBY.js";
10
- import "./chunk-J3GZ3DXD.js";
11
- import "./chunk-ZJDKCC2Y.js";
12
- import "./chunk-NDEYEYSU.js";
13
- import "./chunk-G4ZAUHHA.js";
14
- import "./chunk-63H5VXZY.js";
15
- import {
16
- formatHelp
17
- } from "./chunk-ASZKAC24.js";
18
- import {
19
- output
20
- } from "./chunk-6XLT25GS.js";
21
- import "./chunk-WCODTMDN.js";
22
- import "./chunk-65J65MAP.js";
23
- import "./chunk-6MRZXASS.js";
24
- import "./chunk-G3U4V32O.js";
25
- import {
26
- init_require_shim
27
- } from "./chunk-TPK5AGRA.js";
28
-
29
- // src/docs/commands/rune.js
30
- init_require_shim();
31
- import { join, relative } from "node:path";
32
- var SUGGESTIONS = {
33
- run: "crunes docs run",
34
- args: "crunes docs args",
35
- intro: "crunes docs intro",
36
- utils: "crunes docs utils",
37
- globals: "crunes docs globals"
38
- };
39
- function formatSlashCommands(commands, indent = "") {
40
- const lines = [`${indent}REPL Slash Commands:`];
41
- for (const cmd of commands) {
42
- lines.push(`${indent} /${cmd.name.padEnd(12)} ${cmd.description ?? ""}`);
43
- for (const pos of cmd.positionals ?? []) {
44
- lines.push(`${indent} ${pos.spec.padEnd(14)} ${pos.description ?? ""}`);
45
- }
46
- for (const opt of cmd.options ?? []) {
47
- lines.push(`${indent} ${opt.flags.padEnd(14)} ${opt.description ?? ""}`);
48
- }
49
- }
50
- return lines.join("\n");
51
- }
52
- function formatBatch(batch) {
53
- const lines = ["Batch:"];
54
- if (!batch) {
55
- lines.push(" (not permitted \u2014 no batch block declared)");
56
- return lines.join("\n");
57
- }
58
- const allow = batch.allow ?? [];
59
- const deny = batch.deny ?? [];
60
- lines.push(` allow: ${allow.length ? allow.join(", ") : "(none)"}`);
61
- if (deny.length) lines.push(` deny: ${deny.join(", ")}`);
62
- return lines.join("\n");
63
- }
64
- async function handler({ keys, format = "text", projectRoot = process.cwd(), configRoot = projectRoot }) {
65
- let config;
66
- try {
67
- config = loadConfig(configRoot);
68
- } catch (err) {
69
- output.error(`Config unreadable: ${err.message}`);
70
- process.exit(1);
71
- }
72
- const results = [];
73
- let anyFailed = false;
74
- for (const key of keys) {
75
- const entry = getRune(config, key);
76
- if (!entry) {
77
- if (SUGGESTIONS[key]) {
78
- output.warn(`Unknown rune: "${key}". (Tip: Did you mean "${SUGGESTIONS[key]}"?)`);
79
- } else {
80
- output.warn(`Unknown rune: "${key}"`);
81
- }
82
- anyFailed = true;
83
- continue;
84
- }
85
- const runeFile = join(configRoot, entry.path ?? `.crunes/runes/${key}.js`);
86
- const relativePath = relative(projectRoot, runeFile).replace(/\\/g, "/");
87
- const basePerms = entry.permissions ?? { allow: [], deny: [] };
88
- const vars = entry.vars ?? {};
89
- const runEffective = computeEffectivePermissions(basePerms, config.permissions?.[key], "run");
90
- const replEffective = computeEffectivePermissions(basePerms, config.permissions?.[key], "repl");
91
- let schema = null;
92
- try {
93
- schema = await getArgsSchema(runeFile, runEffective, projectRoot, { vars, runeKey: key });
94
- } catch (err) {
95
- output.warn(`Could not load args schema for "${key}": ${err.message}`);
96
- }
97
- let repl = null;
98
- try {
99
- const { argsSchema, commandsSchema } = await getReplSchema(runeFile, replEffective, [], projectRoot, { vars, runeKey: key });
100
- if (argsSchema !== null || commandsSchema !== null) {
101
- repl = { argsSchema, commandsSchema };
102
- }
103
- } catch (err) {
104
- output.warn(`Could not load REPL schema for "${key}": ${err.message}`);
105
- }
106
- const batch = entry.batch != null ? { allow: entry.batch.allow ?? [], deny: entry.batch.deny ?? [] } : null;
107
- results.push({
108
- key,
109
- name: entry.name ?? key,
110
- description: entry.description ?? null,
111
- relativePath,
112
- schema,
113
- repl,
114
- batch
115
- });
116
- }
117
- if (format === "json") {
118
- process.stdout.write(JSON.stringify(results, null, 2) + "\n");
119
- } else {
120
- const blocks = [];
121
- for (const r of results) {
122
- const parts = [];
123
- parts.push(formatHelp(r.schema, { key: r.key, name: r.name, description: r.description, relativePath: r.relativePath }));
124
- if (r.repl?.argsSchema) {
125
- parts.push(formatHelp(r.repl.argsSchema, { key: r.key, name: r.name, description: r.description, relativePath: r.relativePath, lifecycle: "repl" }));
126
- }
127
- if (r.repl?.commandsSchema?.commands?.length) {
128
- parts.push(formatSlashCommands(r.repl.commandsSchema.commands));
129
- }
130
- parts.push(formatBatch(r.batch));
131
- blocks.push(parts.join("\n\n"));
132
- }
133
- if (blocks.length > 0) process.stdout.write(blocks.join("\n\n") + "\n");
134
- }
135
- if (anyFailed) process.exit(1);
136
- }
137
- export {
138
- handler
139
- };