@darkrymit/crunes-cli 0.8.5 → 0.10.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 (95) hide show
  1. package/dist/chunks/{add-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
  2. package/dist/chunks/add-MSX6XSU3.js +68 -0
  3. package/dist/chunks/{apply-J4YICV6H.js → apply-LOIJIPLR.js} +21 -12
  4. package/dist/chunks/{benchmark-AKKV7G32.js → benchmark-3IHFP3V2.js} +27 -18
  5. package/dist/chunks/{browse-JZFU52ET.js → browse-PHMBDREQ.js} +2 -2
  6. package/dist/chunks/chunk-2DNYVKBF.js +109 -0
  7. package/dist/chunks/chunk-2FI6KN3C.js +283 -0
  8. package/dist/chunks/chunk-2HM5Q52B.js +131 -0
  9. package/dist/chunks/{chunk-6MRZXASS.js → chunk-2Q3KLBE6.js} +16 -0
  10. package/dist/chunks/{chunk-ZJDKCC2Y.js → chunk-4GJMCFR6.js} +6 -3
  11. package/dist/chunks/chunk-55GTJG5I.js +1154 -0
  12. package/dist/chunks/chunk-6IC6ZJ74.js +9525 -0
  13. package/dist/chunks/chunk-7KYCYDAS.js +325 -0
  14. package/dist/chunks/chunk-DTOYFY3Z.js +578 -0
  15. package/dist/chunks/chunk-EO3CSXWK.js +70 -0
  16. package/dist/chunks/chunk-FIAFVIAN.js +79 -0
  17. package/dist/chunks/{chunk-J3GZ3DXD.js → chunk-GVMT55GH.js} +3 -2
  18. package/dist/chunks/chunk-H2OT7D6N.js +303 -0
  19. package/dist/chunks/{chunk-JOAL437H.js → chunk-I6MHDUCW.js} +16 -1
  20. package/dist/chunks/chunk-KSQDFE5N.js +85 -0
  21. package/dist/chunks/{chunk-BTIPUR5S.js → chunk-KUEMDPNG.js} +108 -91
  22. package/dist/chunks/{chunk-6XLT25GS.js → chunk-MIKWIFYR.js} +47 -0
  23. package/dist/chunks/{chunk-GTCPZ22N.js → chunk-MTJ2KW3V.js} +3 -1
  24. package/dist/chunks/chunk-MVCBPI4J.js +2354 -0
  25. package/dist/chunks/{chunk-T53L5CJW.js → chunk-PBGUKXT6.js} +2887 -1874
  26. package/dist/chunks/{chunk-KII6KW5Z.js → chunk-RVBAAXRY.js} +64 -44
  27. package/dist/chunks/chunk-SUCYDYMU.js +44 -0
  28. package/dist/chunks/chunk-UBCAZGLE.js +15 -0
  29. package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
  30. package/dist/chunks/chunk-VP7YLCQP.js +244 -0
  31. package/dist/chunks/{chunk-NDEYEYSU.js → chunk-WJII3LZK.js} +4 -3
  32. package/dist/chunks/chunk-XDMMSZIL.js +71 -0
  33. package/dist/chunks/chunk-YKIKJHYO.js +94 -0
  34. package/dist/chunks/{chunk-NYLRTAAA.js → chunk-YVN3VDRE.js} +1 -1
  35. package/dist/chunks/{clear-YBDIPEEH.js → clear-AT7HNUV4.js} +2 -2
  36. package/dist/chunks/{create-L6DJN4ME.js → create-DXW4YYLJ.js} +8 -8
  37. package/dist/chunks/create-LPLNCOW4.js +268 -0
  38. package/dist/chunks/{create-GPDE2YKL.js → create-Y4LHLWGL.js} +26 -18
  39. package/dist/chunks/{delete-LNOYM5KG.js → delete-2EXPFBFC.js} +2 -2
  40. package/dist/chunks/{delete-E4TEBRPX.js → delete-GKYA2W5Z.js} +4 -2
  41. package/dist/chunks/{delete-C4UJ7X5K.js → delete-MJAECXXV.js} +2 -2
  42. package/dist/chunks/disable-TITOSMXB.js +43 -0
  43. package/dist/chunks/doctor-R2Y6UAY4.js +208 -0
  44. package/dist/chunks/enable-LGTPDWPV.js +35 -0
  45. package/dist/chunks/{globals-H2WF344Y.js → globals-SNQFCHMP.js} +1 -1
  46. package/dist/chunks/{init-HU5OMHEH.js → init-KO2HLED5.js} +18 -8
  47. package/dist/chunks/install-7IRUAGSF.js +64 -0
  48. package/dist/chunks/{intro-36OLGNYN.js → intro-JNJ6A75J.js} +89 -21
  49. package/dist/chunks/{kill-2UG7PHUV.js → kill-TX3PC73P.js} +2 -1
  50. package/dist/chunks/{list-2JYMBMZC.js → list-BCCM3TLP.js} +12 -7
  51. package/dist/chunks/{list-4X3JFQGS.js → list-EHREZR6M.js} +2 -1
  52. package/dist/chunks/{list-U7PAYNAH.js → list-LC6HB3H3.js} +2 -2
  53. package/dist/chunks/list-MLKZE36K.js +92 -0
  54. package/dist/chunks/list-QVZKR3IE.js +62 -0
  55. package/dist/chunks/{list-7VHJIUDX.js → list-U4EMHQZT.js} +2 -2
  56. package/dist/chunks/{list-PTAWQYWG.js → list-V7VVD5AG.js} +2 -1
  57. package/dist/chunks/{list-A5WVDBWF.js → list-VA73WPK6.js} +2 -2
  58. package/dist/chunks/{manifest-7RVNKBOH.js → manifest-76MIEL2F.js} +3 -1
  59. package/dist/chunks/migrate-Y3EKMVP5.js +87 -0
  60. package/dist/chunks/{output-RJ6JSNY7.js → output-QN5CVJ62.js} +4 -1
  61. package/dist/chunks/{query-AW7WYILM.js → query-2US3CPYT.js} +2 -2
  62. package/dist/chunks/{registry-RG34DPD7.js → registry-IWP7JMNI.js} +2 -2
  63. package/dist/chunks/{remove-QUH2D3S5.js → remove-BCFTF23J.js} +2 -2
  64. package/dist/chunks/{repl-STBZC4P2.js → repl-2YWTHUWT.js} +4 -0
  65. package/dist/chunks/{repl-BPEWARN7.js → repl-5GDN3RAO.js} +99 -31
  66. package/dist/chunks/resolver-CA2A32AC.js +36 -0
  67. package/dist/chunks/run-WL3IZBXF.js +35 -0
  68. package/dist/chunks/rune-YA4TFHTB.js +283 -0
  69. package/dist/chunks/runner-QNZMBHQY.js +34 -0
  70. package/dist/chunks/{search-MSSDGJTF.js → search-B7IM7JRJ.js} +2 -2
  71. package/dist/chunks/shell-explain-LKBBP2BG.js +77 -0
  72. package/dist/chunks/trust-BFIDANXD.js +109 -0
  73. package/dist/chunks/uninstall-3MWZIZVA.js +58 -0
  74. package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
  75. package/dist/chunks/{update-KSC6VRMU.js → update-W4MJUTTW.js} +25 -19
  76. package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
  77. package/dist/chunks/{utils-3SJFSUSV.js → utils-B2QULX5J.js} +8 -4
  78. package/dist/chunks/{version-YG2M7HER.js → version-FLHI5KFS.js} +3 -3
  79. package/dist/cli.js +115 -70
  80. package/package.json +2 -2
  81. package/dist/chunks/chunk-ASZKAC24.js +0 -103
  82. package/dist/chunks/chunk-G3U4V32O.js +0 -46
  83. package/dist/chunks/chunk-GSA432UC.js +0 -90
  84. package/dist/chunks/chunk-WJRZN7BR.js +0 -77492
  85. package/dist/chunks/create-VYZRWRGQ.js +0 -170
  86. package/dist/chunks/disable-FGJ7VMPO.js +0 -47
  87. package/dist/chunks/doctor-7NWBJAH7.js +0 -53
  88. package/dist/chunks/enable-ZL6QOC2I.js +0 -47
  89. package/dist/chunks/install-FIYRMVLR.js +0 -57
  90. package/dist/chunks/list-AIYNOPNZ.js +0 -28
  91. package/dist/chunks/list-NZ5DHXJF.js +0 -111
  92. package/dist/chunks/resolver-36V72VKR.js +0 -28
  93. package/dist/chunks/run-IVL23SMW.js +0 -26
  94. package/dist/chunks/rune-XRREUL56.js +0 -186
  95. package/dist/chunks/uninstall-G56DZRFG.js +0 -49
@@ -1,170 +0,0 @@
1
- import {
2
- Ee,
3
- Re,
4
- fe,
5
- ge,
6
- ye
7
- } from "./chunk-CGZL5SSH.js";
8
- import {
9
- output
10
- } from "./chunk-6XLT25GS.js";
11
- import "./chunk-WCODTMDN.js";
12
- import {
13
- init_require_shim
14
- } from "./chunk-TPK5AGRA.js";
15
-
16
- // src/rune/commands/create.js
17
- init_require_shim();
18
- import { mkdir, writeFile, readFile, rename } from "node:fs/promises";
19
- import { join, dirname } from "node:path";
20
- var VALID_FORMATS = ["tree", "markdown"];
21
- function template(key, format) {
22
- const imports = format === "tree" ? `import { md, section, tree } from '@utils'` : `import { md, section } from '@utils'`;
23
- const header = [
24
- `// permissions:`,
25
- `// run:`,
26
- `// allow: [] \u2014 add patterns like fs.read:./** if you use utils.fs`,
27
- `// deny: []`,
28
- ``,
29
- imports,
30
- ``,
31
- `// export async function args(b) {`,
32
- `// return b`,
33
- `// .option('-v, --verbose', 'Verbose output', false)`,
34
- `// .build()`,
35
- `// }`,
36
- ``,
37
- `export async function run(args) {`,
38
- ` // args._ \u2014 data positionals (command tokens stripped)`,
39
- ` // args.$rest \u2014 unmapped positional arguments`,
40
- ` // args.verbose \u2014 named flag (if args export is defined above)`,
41
- ` // utils.fs.cwd() \u2014 absolute path to the project root`
42
- ].join("\n");
43
- if (format === "tree") {
44
- return header + "\n" + [
45
- ``,
46
- ` const root = tree.node('${key}', 'Root description', [`,
47
- ` tree.node('child', 'Child description'),`,
48
- ` ]);`,
49
- ` return section.create('example-tree', { type: 'tree', root });`,
50
- `}`,
51
- ``
52
- ].join("\n");
53
- }
54
- return header + "\n" + [
55
- ``,
56
- ` const content = [`,
57
- ` md.h3('${key}'),`,
58
- ` md.ul(['Replace with real data']),`,
59
- ` ].join('\\n');`,
60
- ` return section.create('example-md', { type: 'markdown', content });`,
61
- `}`,
62
- ``
63
- ].join("\n");
64
- }
65
- async function handler({
66
- key,
67
- format,
68
- path: runeRelPath,
69
- name,
70
- description,
71
- yes = false,
72
- projectRoot = process.cwd(),
73
- configRoot = projectRoot
74
- } = {}) {
75
- const isNonInteractive = yes || !process.stdout.isTTY;
76
- if (isNonInteractive) {
77
- if (!key) {
78
- output.error("Missing required argument: <key>");
79
- process.exit(1);
80
- }
81
- if (format && !VALID_FORMATS.includes(format)) {
82
- output.error(`Invalid --format. Must be one of: ${VALID_FORMATS.join(", ")}`);
83
- process.exit(1);
84
- }
85
- if (!format) {
86
- format = "markdown";
87
- output.info('--format not specified, defaulting to "markdown"');
88
- }
89
- } else {
90
- ye("crunes create");
91
- if (!key) {
92
- const result = await Re({ message: "Rune key?", validate: (v) => v ? void 0 : "Required" });
93
- if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
94
- ge("Cancelled.");
95
- return;
96
- }
97
- key = result;
98
- }
99
- if (!format) {
100
- const result = await Ee({
101
- message: "Output format?",
102
- options: [
103
- { value: "tree", label: "tree", hint: "hierarchical ASCII tree structure" },
104
- { value: "markdown", label: "markdown", hint: "freeform markdown content" }
105
- ]
106
- });
107
- if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
108
- ge("Cancelled.");
109
- return;
110
- }
111
- format = result;
112
- }
113
- if (!runeRelPath) {
114
- const defaultPath = `.crunes/runes/${key}.js`;
115
- const result = await Re({ message: "File path?", initialValue: defaultPath });
116
- if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
117
- ge("Cancelled.");
118
- return;
119
- }
120
- runeRelPath = result;
121
- }
122
- if (!name) {
123
- const result = await Re({ message: "Name? (optional)", placeholder: "Human-readable label for crunes list" });
124
- if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
125
- ge("Cancelled.");
126
- return;
127
- }
128
- name = result || void 0;
129
- }
130
- if (!description) {
131
- const result = await Re({ message: "Description? (optional)", placeholder: "What context does this rune provide?" });
132
- if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
133
- ge("Cancelled.");
134
- return;
135
- }
136
- description = result || void 0;
137
- }
138
- }
139
- runeRelPath = runeRelPath ?? `.crunes/runes/${key}.js`;
140
- const runeAbsPath = join(configRoot, runeRelPath);
141
- await mkdir(dirname(runeAbsPath), { recursive: true });
142
- await writeFile(runeAbsPath, template(key, format));
143
- const configPath = join(configRoot, ".crunes", "config.json");
144
- await mkdir(dirname(configPath), { recursive: true });
145
- let config = { runes: {} };
146
- try {
147
- config = JSON.parse(await readFile(configPath, "utf8"));
148
- } catch {
149
- }
150
- const entry = {
151
- path: runeRelPath,
152
- ...name && { name },
153
- ...description && { description }
154
- };
155
- config.runes = { ...config.runes ?? {}, [key]: entry };
156
- const tmpPath = configPath + ".tmp";
157
- await writeFile(tmpPath, JSON.stringify(config, null, 2) + "\n", "utf8");
158
- await rename(tmpPath, configPath);
159
- if (!isNonInteractive) {
160
- fe(`Created ${runeRelPath}
161
- Run: crunes run ${key}`);
162
- } else {
163
- output.success(`Created ${runeRelPath}`);
164
- output.info(`Run: crunes run ${key}`);
165
- }
166
- }
167
- export {
168
- handler,
169
- template
170
- };
@@ -1,47 +0,0 @@
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
- };
@@ -1,53 +0,0 @@
1
- import {
2
- loadConfig
3
- } from "./chunk-GSA432UC.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-GTCPZ22N.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,57 +0,0 @@
1
- import {
2
- resolveFromMarketplace
3
- } from "./chunk-NYLRTAAA.js";
4
- import {
5
- installPlugin
6
- } from "./chunk-KII6KW5Z.js";
7
- import {
8
- fe,
9
- ge,
10
- ye
11
- } from "./chunk-CGZL5SSH.js";
12
- import "./chunk-GTCPZ22N.js";
13
- import "./chunk-6MRZXASS.js";
14
- import "./chunk-G3U4V32O.js";
15
- import {
16
- init_require_shim
17
- } from "./chunk-TPK5AGRA.js";
18
-
19
- // src/plugin/commands/install.js
20
- init_require_shim();
21
- function parseInstallArg(arg) {
22
- const idx = arg.indexOf("@");
23
- if (idx === -1) return null;
24
- return [arg.slice(0, idx), arg.slice(idx + 1)];
25
- }
26
- async function handler({ source, projectRoot, configRoot, yes }) {
27
- const parts = parseInstallArg(source);
28
- if (!parts) {
29
- ge("Use <marketplace>@<plugin> format (e.g. hello-world@hello-world)");
30
- process.exit(1);
31
- }
32
- const [marketplaceName, pluginName] = parts;
33
- ye("Installing plugin\u2026");
34
- let resolvedSource, provenance;
35
- try {
36
- ;
37
- ({ resolvedSource, ...provenance } = await resolveFromMarketplace(marketplaceName, pluginName));
38
- } catch (err) {
39
- ge(err.message);
40
- process.exit(1);
41
- }
42
- let result;
43
- try {
44
- result = await installPlugin(resolvedSource, configRoot ?? projectRoot, provenance, { yes });
45
- } catch (err) {
46
- ge(`Installation failed: ${err.message}`);
47
- process.exit(1);
48
- }
49
- if (!result.installed) {
50
- ge("Installation cancelled.");
51
- process.exit(0);
52
- }
53
- fe(`Installed ${result.name}@${result.version}`);
54
- }
55
- export {
56
- handler
57
- };
@@ -1,28 +0,0 @@
1
- import {
2
- loadRegistry
3
- } from "./chunk-GTCPZ22N.js";
4
- import "./chunk-6MRZXASS.js";
5
- import {
6
- init_require_shim
7
- } from "./chunk-TPK5AGRA.js";
8
-
9
- // src/plugin/commands/list.js
10
- init_require_shim();
11
- async function handler({ format = "md" }) {
12
- const registry = await loadRegistry();
13
- const plugins = Object.entries(registry.plugins ?? {});
14
- if (plugins.length === 0) {
15
- console.log("No plugins installed.");
16
- return;
17
- }
18
- if (format === "json") {
19
- console.log(JSON.stringify(registry.plugins, null, 2));
20
- return;
21
- }
22
- for (const [key, entry] of plugins) {
23
- console.log(`${key} v${entry.version}`);
24
- }
25
- }
26
- export {
27
- handler
28
- };
@@ -1,111 +0,0 @@
1
- import {
2
- require_cli_table3
3
- } from "./chunk-DMMC4X27.js";
4
- import {
5
- loadConfig
6
- } from "./chunk-GSA432UC.js";
7
- import {
8
- getRune
9
- } from "./chunk-WJRZN7BR.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-GTCPZ22N.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-RG34DPD7.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,28 +0,0 @@
1
- import {
2
- getRune,
3
- normaliseRune,
4
- resolvePluginRune,
5
- resolveRuneEntry,
6
- resolveRuneFromPlugins,
7
- runRune
8
- } from "./chunk-WJRZN7BR.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-GTCPZ22N.js";
18
- import "./chunk-6MRZXASS.js";
19
- import "./chunk-G3U4V32O.js";
20
- import "./chunk-TPK5AGRA.js";
21
- export {
22
- getRune,
23
- normaliseRune,
24
- resolvePluginRune,
25
- resolveRuneEntry,
26
- resolveRuneFromPlugins,
27
- runRune
28
- };
@@ -1,26 +0,0 @@
1
- import {
2
- handler,
3
- parseBracketKey,
4
- parseRunArgs,
5
- parseSegment
6
- } from "./chunk-BTIPUR5S.js";
7
- import "./chunk-GSA432UC.js";
8
- import "./chunk-WJRZN7BR.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-GTCPZ22N.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
- };