@darkrymit/crunes-cli 0.10.1 → 0.11.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/{benchmark-QWGVX3BX.js → benchmark-5OWBATUN.js} +3 -3
- package/dist/chunks/{chunk-ARIFLX5E.js → chunk-AG4PDJSY.js} +97 -9
- package/dist/chunks/{chunk-AL37NFWR.js → chunk-EHKFHILS.js} +3 -3
- package/dist/chunks/{chunk-KX6QEHM5.js → chunk-JBQXPW7P.js} +2 -2
- package/dist/chunks/{chunk-VSMAZISQ.js → chunk-MOAQLHP2.js} +5 -5
- package/dist/chunks/{chunk-PBGUKXT6.js → chunk-TXCUSUZ6.js} +2291 -1812
- package/dist/chunks/{create-36F6V4WP.js → create-3TDAFVL2.js} +128 -29
- package/dist/chunks/{create-DXW4YYLJ.js → create-EC6TQW7N.js} +20 -4
- package/dist/chunks/{doctor-PVO4JLYN.js → doctor-WXTY6RGK.js} +1 -1
- package/dist/chunks/{intro-YI5HUZCF.js → intro-3FSOGWPR.js} +1 -1
- package/dist/chunks/{repl-MWFEZ65P.js → repl-32TENE2U.js} +4 -4
- package/dist/chunks/{resolver-URPQMOIV.js → resolver-WN4HKKBV.js} +2 -2
- package/dist/chunks/{run-3VKWSRLO.js → run-WD2ZA63Z.js} +3 -3
- package/dist/chunks/{rune-L5EP645W.js → rune-TSED6W3R.js} +3 -3
- package/dist/chunks/{runner-VPTLUQJE.js → runner-KA3YHICN.js} +3 -1
- package/dist/chunks/{utils-B2QULX5J.js → utils-VVD4VCTC.js} +1 -1
- package/dist/chunks/{version-ZULO6CV3.js → version-IDG3M56C.js} +3 -3
- package/dist/cli.js +15 -15
- package/package.json +3 -3
|
@@ -28,8 +28,100 @@ import {
|
|
|
28
28
|
// src/rune/commands/create.js
|
|
29
29
|
init_require_shim();
|
|
30
30
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
31
|
+
import { existsSync } from "node:fs";
|
|
31
32
|
import { join, dirname } from "node:path";
|
|
32
33
|
var VALID_FORMATS = ["tree", "markdown"];
|
|
34
|
+
function runeTestTemplate(key) {
|
|
35
|
+
return [
|
|
36
|
+
`import { describe, it } from 'node:test'`,
|
|
37
|
+
`import assert from 'node:assert/strict'`,
|
|
38
|
+
``,
|
|
39
|
+
`describe('${key} rune', () => {`,
|
|
40
|
+
` it('placeholder', () => {`,
|
|
41
|
+
` assert.ok(true)`,
|
|
42
|
+
` })`,
|
|
43
|
+
`})`,
|
|
44
|
+
``
|
|
45
|
+
].join("\n");
|
|
46
|
+
}
|
|
47
|
+
async function resolveTarget({ configRoot, global, plugin, project, isNonInteractive }) {
|
|
48
|
+
if (plugin && project) {
|
|
49
|
+
output.error("Cannot specify both --plugin and --project.");
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
if (global && plugin) {
|
|
53
|
+
output.error("Cannot specify both --global and --plugin.");
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
if (global) return "global";
|
|
57
|
+
if (plugin) return "plugin";
|
|
58
|
+
if (project) return "project";
|
|
59
|
+
const hasPlugin = existsSync(join(configRoot, ".crunes-plugin", "plugin.json"));
|
|
60
|
+
const hasProject = existsSync(join(configRoot, ".crunes", "config.json"));
|
|
61
|
+
if (hasPlugin && hasProject) {
|
|
62
|
+
if (isNonInteractive) {
|
|
63
|
+
output.error("Both .crunes-plugin/plugin.json and .crunes/config.json exist. Pass --plugin or --project.");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
const picked = await Ee({
|
|
67
|
+
message: "Where should this rune be registered?",
|
|
68
|
+
options: [
|
|
69
|
+
{ value: "plugin", label: "plugin (.crunes-plugin/plugin.json)", hint: "exported plugin rune" },
|
|
70
|
+
{ value: "project", label: "project (.crunes/config.json)", hint: "dev-time project rune" }
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
if (picked === /* @__PURE__ */ Symbol.for("clack:cancel")) return null;
|
|
74
|
+
return picked;
|
|
75
|
+
}
|
|
76
|
+
return hasPlugin ? "plugin" : "project";
|
|
77
|
+
}
|
|
78
|
+
function defaultRunePaths({ target, key, ext, pluginManifest }) {
|
|
79
|
+
if (target === "plugin") {
|
|
80
|
+
const isEmpty = Object.keys(pluginManifest?.runes ?? {}).length === 0;
|
|
81
|
+
return {
|
|
82
|
+
runeRelPath: isEmpty ? `src/index.${ext}` : `runes/${key}/src/index.${ext}`,
|
|
83
|
+
testRelPath: isEmpty ? `test/${key}.test.js` : `runes/${key}/test/${key}.test.js`
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (target === "global") {
|
|
87
|
+
return {
|
|
88
|
+
runeRelPath: `runes/${key}/src/index.${ext}`,
|
|
89
|
+
testRelPath: `runes/${key}/test/${key}.test.js`
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
runeRelPath: `.crunes/runes/${key}/src/index.${ext}`,
|
|
94
|
+
testRelPath: `.crunes/runes/${key}/test/${key}.test.js`
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function registerRune({ target, configRoot, key, name, description, runeRelPath, isIsolate }) {
|
|
98
|
+
if (target === "plugin") {
|
|
99
|
+
const pluginJsonPath = join(configRoot, ".crunes-plugin", "plugin.json");
|
|
100
|
+
const manifest = readRawConfig(pluginJsonPath) ?? { format: "1", runes: {} };
|
|
101
|
+
if (manifest.runes?.[key] != null) {
|
|
102
|
+
output.error(`Rune "${key}" already exists in ${pluginJsonPath}.`);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
const runBlock = isIsolate ? { command: runeRelPath, permissions: { allow: [], deny: [] } } : { command: runeRelPath };
|
|
106
|
+
manifest.runes = {
|
|
107
|
+
...manifest.runes ?? {},
|
|
108
|
+
[key]: { ...name && { name }, ...description && { description }, run: runBlock }
|
|
109
|
+
};
|
|
110
|
+
await writeRawConfig(pluginJsonPath, manifest);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const configPath = getConfigPath({ configRoot, global: target === "global" });
|
|
114
|
+
const config = readRawConfig(configPath) ?? { runes: {} };
|
|
115
|
+
if (config.runes?.[key] != null) {
|
|
116
|
+
output.error(`Rune "${key}" already exists in ${configPath}.`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
config.runes = {
|
|
120
|
+
...config.runes ?? {},
|
|
121
|
+
[key]: { ...name && { name }, ...description && { description }, run: runeRelPath }
|
|
122
|
+
};
|
|
123
|
+
await writeRawConfig(configPath, config);
|
|
124
|
+
}
|
|
33
125
|
var SCRIPT_LANGS = {
|
|
34
126
|
python: {
|
|
35
127
|
ext: "py",
|
|
@@ -82,7 +174,7 @@ var SCRIPT_LANGS = {
|
|
|
82
174
|
}
|
|
83
175
|
};
|
|
84
176
|
var VALID_LANGS = Object.keys(SCRIPT_LANGS);
|
|
85
|
-
async function createScriptRune({ key, lang, runeRelPath, name, description, configRoot,
|
|
177
|
+
async function createScriptRune({ key, lang, runeRelPath, name, description, configRoot, target }) {
|
|
86
178
|
const spec = SCRIPT_LANGS[lang];
|
|
87
179
|
if (!spec) {
|
|
88
180
|
output.error(`Invalid --lang. Must be one of: ${VALID_LANGS.join(", ")}`);
|
|
@@ -92,21 +184,20 @@ async function createScriptRune({ key, lang, runeRelPath, name, description, con
|
|
|
92
184
|
output.error("Missing required argument: <key>");
|
|
93
185
|
process.exit(1);
|
|
94
186
|
}
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
187
|
+
const pluginManifest = target === "plugin" ? readRawConfig(join(configRoot, ".crunes-plugin", "plugin.json")) : null;
|
|
188
|
+
const defaults = defaultRunePaths({ target, key, ext: spec.ext, pluginManifest });
|
|
189
|
+
const hasCustomPath = Boolean(runeRelPath);
|
|
190
|
+
runeRelPath = runeRelPath ?? defaults.runeRelPath;
|
|
191
|
+
const baseRoot = target === "global" ? getStorePath() : configRoot;
|
|
192
|
+
const runeAbsPath = join(baseRoot, runeRelPath);
|
|
193
|
+
await registerRune({ target, configRoot, key, name, description, runeRelPath, isIsolate: false });
|
|
103
194
|
await mkdir(dirname(runeAbsPath), { recursive: true });
|
|
104
195
|
await writeFile(runeAbsPath, spec.body(key));
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
196
|
+
if (!hasCustomPath) {
|
|
197
|
+
const testAbsPath = join(baseRoot, defaults.testRelPath);
|
|
198
|
+
await mkdir(dirname(testAbsPath), { recursive: true });
|
|
199
|
+
await writeFile(testAbsPath, runeTestTemplate(key));
|
|
200
|
+
}
|
|
110
201
|
output.success(`Created ${runeRelPath} (${lang}, native)`);
|
|
111
202
|
output.info(`Run: crunes run ${key}`);
|
|
112
203
|
}
|
|
@@ -164,13 +255,22 @@ async function handler({
|
|
|
164
255
|
yes = false,
|
|
165
256
|
projectRoot = process.cwd(),
|
|
166
257
|
configRoot = projectRoot,
|
|
167
|
-
global = false
|
|
258
|
+
global = false,
|
|
259
|
+
plugin = false,
|
|
260
|
+
project = false
|
|
168
261
|
} = {}) {
|
|
262
|
+
const isNonInteractive = yes || !process.stdout.isTTY;
|
|
263
|
+
const target = await resolveTarget({ configRoot, global, plugin, project, isNonInteractive });
|
|
264
|
+
if (!target) {
|
|
265
|
+
ge("Cancelled.");
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
169
268
|
if (lang) {
|
|
170
|
-
await createScriptRune({ key, lang, runeRelPath, name, description, configRoot,
|
|
269
|
+
await createScriptRune({ key, lang, runeRelPath, name, description, configRoot, target });
|
|
171
270
|
return;
|
|
172
271
|
}
|
|
173
|
-
const
|
|
272
|
+
const pluginManifest = target === "plugin" ? readRawConfig(join(configRoot, ".crunes-plugin", "plugin.json")) : null;
|
|
273
|
+
const defaults = key ? defaultRunePaths({ target, key, ext: "rune.js", pluginManifest }) : null;
|
|
174
274
|
if (isNonInteractive) {
|
|
175
275
|
if (!key) {
|
|
176
276
|
output.error("Missing required argument: <key>");
|
|
@@ -209,7 +309,7 @@ async function handler({
|
|
|
209
309
|
format = result;
|
|
210
310
|
}
|
|
211
311
|
if (!runeRelPath) {
|
|
212
|
-
const defaultPath =
|
|
312
|
+
const defaultPath = defaultRunePaths({ target, key, ext: "rune.js", pluginManifest }).runeRelPath;
|
|
213
313
|
const result = await Re({ message: "File path?", initialValue: defaultPath });
|
|
214
314
|
if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
|
|
215
315
|
ge("Cancelled.");
|
|
@@ -234,24 +334,23 @@ async function handler({
|
|
|
234
334
|
description = result || void 0;
|
|
235
335
|
}
|
|
236
336
|
}
|
|
237
|
-
|
|
337
|
+
const finalDefaults = defaults ?? defaultRunePaths({ target, key, ext: "rune.js", pluginManifest });
|
|
338
|
+
const hasCustomPath = Boolean(runeRelPath);
|
|
339
|
+
runeRelPath = runeRelPath ?? finalDefaults.runeRelPath;
|
|
238
340
|
if (!/\.rune\.m?js$/i.test(runeRelPath)) {
|
|
239
341
|
output.error(`${runeRelPath}: a sandboxed rune's file must be named *.rune.js \u2014 the name is what runs it in the isolate.`);
|
|
240
342
|
process.exit(1);
|
|
241
343
|
}
|
|
242
|
-
const baseRoot = global ? getStorePath() : configRoot;
|
|
344
|
+
const baseRoot = target === "global" ? getStorePath() : configRoot;
|
|
243
345
|
const runeAbsPath = join(baseRoot, runeRelPath);
|
|
346
|
+
await registerRune({ target, configRoot, key, name, description, runeRelPath, isIsolate: true });
|
|
244
347
|
await mkdir(dirname(runeAbsPath), { recursive: true });
|
|
245
348
|
await writeFile(runeAbsPath, template(key, format));
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
run: runeRelPath
|
|
252
|
-
};
|
|
253
|
-
config.runes = { ...config.runes ?? {}, [key]: entry };
|
|
254
|
-
await writeRawConfig(configPath, config);
|
|
349
|
+
if (!hasCustomPath) {
|
|
350
|
+
const testAbsPath = join(baseRoot, finalDefaults.testRelPath);
|
|
351
|
+
await mkdir(dirname(testAbsPath), { recursive: true });
|
|
352
|
+
await writeFile(testAbsPath, runeTestTemplate(key));
|
|
353
|
+
}
|
|
255
354
|
if (!isNonInteractive) {
|
|
256
355
|
fe(`Created ${runeRelPath}
|
|
257
356
|
Run: crunes run ${key}`);
|
|
@@ -18,7 +18,7 @@ init_require_shim();
|
|
|
18
18
|
import { mkdir, writeFile, readdir } from "node:fs/promises";
|
|
19
19
|
import { join, resolve, dirname } from "node:path";
|
|
20
20
|
import { spawnSync } from "node:child_process";
|
|
21
|
-
function pluginJson({ name, description, author, license }) {
|
|
21
|
+
function pluginJson({ name, description, author, license, multi = false }) {
|
|
22
22
|
return JSON.stringify({
|
|
23
23
|
format: "1",
|
|
24
24
|
runes: {
|
|
@@ -26,7 +26,7 @@ function pluginJson({ name, description, author, license }) {
|
|
|
26
26
|
name: "Example Rune",
|
|
27
27
|
description: "Replace with your rune description",
|
|
28
28
|
run: {
|
|
29
|
-
command: "runes/example.rune.js",
|
|
29
|
+
command: multi ? "runes/example/src/index.rune.js" : "src/index.rune.js",
|
|
30
30
|
permissions: {
|
|
31
31
|
allow: [],
|
|
32
32
|
deny: []
|
|
@@ -135,6 +135,17 @@ function changelogMd() {
|
|
|
135
135
|
- Initial release
|
|
136
136
|
`;
|
|
137
137
|
}
|
|
138
|
+
function exampleTest() {
|
|
139
|
+
return `import { describe, it } from 'node:test'
|
|
140
|
+
import assert from 'node:assert/strict'
|
|
141
|
+
|
|
142
|
+
describe('example rune', () => {
|
|
143
|
+
it('placeholder', () => {
|
|
144
|
+
assert.ok(true)
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
138
149
|
function getGitAuthor() {
|
|
139
150
|
const result = spawnSync("git", ["config", "user.name"], { encoding: "utf8" });
|
|
140
151
|
return result.status === 0 ? result.stdout.trim() : "";
|
|
@@ -145,6 +156,7 @@ async function handler({
|
|
|
145
156
|
author,
|
|
146
157
|
license,
|
|
147
158
|
out,
|
|
159
|
+
multi = false,
|
|
148
160
|
yes = false,
|
|
149
161
|
projectRoot = process.cwd()
|
|
150
162
|
} = {}) {
|
|
@@ -212,11 +224,14 @@ async function handler({
|
|
|
212
224
|
return;
|
|
213
225
|
}
|
|
214
226
|
}
|
|
215
|
-
const opts = { name, description, author, license };
|
|
227
|
+
const opts = { name, description, author, license, multi };
|
|
228
|
+
const runeEntry = multi ? join(outDir, "runes", "example", "src", "index.rune.js") : join(outDir, "src", "index.rune.js");
|
|
229
|
+
const testEntry = multi ? join(outDir, "runes", "example", "test", "example.test.js") : join(outDir, "test", `${name}.test.js`);
|
|
216
230
|
const files = [
|
|
217
231
|
[join(outDir, ".crunes-plugin", "plugin.json"), pluginJson(opts)],
|
|
218
232
|
[join(outDir, ".crunes-plugin", "marketplace.json"), marketplaceJson(opts)],
|
|
219
|
-
[
|
|
233
|
+
[runeEntry, exampleRune()],
|
|
234
|
+
[testEntry, exampleTest()],
|
|
220
235
|
[join(outDir, "templates", "example-template.js"), exampleTemplate()],
|
|
221
236
|
[join(outDir, "README.md"), readmeMd(opts)],
|
|
222
237
|
[join(outDir, "CHANGELOG.md"), changelogMd()]
|
|
@@ -241,6 +256,7 @@ export {
|
|
|
241
256
|
changelogMd,
|
|
242
257
|
exampleRune,
|
|
243
258
|
exampleTemplate,
|
|
259
|
+
exampleTest,
|
|
244
260
|
handler,
|
|
245
261
|
marketplaceJson,
|
|
246
262
|
pluginJson,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseSegment,
|
|
3
3
|
permissionHint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EHKFHILS.js";
|
|
5
5
|
import {
|
|
6
6
|
tailStdin
|
|
7
7
|
} from "./chunk-EO3CSXWK.js";
|
|
@@ -13,10 +13,10 @@ import "./chunk-CGZL5SSH.js";
|
|
|
13
13
|
import "./chunk-WCODTMDN.js";
|
|
14
14
|
import {
|
|
15
15
|
describeConfigLayers
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MOAQLHP2.js";
|
|
17
17
|
import {
|
|
18
18
|
formatSection
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JBQXPW7P.js";
|
|
20
20
|
import "./chunk-2DNYVKBF.js";
|
|
21
21
|
import "./chunk-MUWDZJN2.js";
|
|
22
22
|
import {
|
|
@@ -157,7 +157,7 @@ async function handler({
|
|
|
157
157
|
output.info("Run `crunes init` to create a config file.");
|
|
158
158
|
process.exit(1);
|
|
159
159
|
}
|
|
160
|
-
const { resolveRuneEntry } = await import("./resolver-
|
|
160
|
+
const { resolveRuneEntry } = await import("./resolver-WN4HKKBV.js");
|
|
161
161
|
let runeEntry;
|
|
162
162
|
try {
|
|
163
163
|
runeEntry = await resolveRuneEntry(projectRoot, config, key, configRoot);
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
resolveRuneEntry,
|
|
5
5
|
resolveRuneFromPlugins,
|
|
6
6
|
runRune
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-MOAQLHP2.js";
|
|
8
|
+
import "./chunk-JBQXPW7P.js";
|
|
9
9
|
import "./chunk-2DNYVKBF.js";
|
|
10
10
|
import "./chunk-MUWDZJN2.js";
|
|
11
11
|
import {
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
parseBracketKey,
|
|
5
5
|
parseRunArgs,
|
|
6
6
|
parseSegment
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EHKFHILS.js";
|
|
8
8
|
import "./chunk-MIKWIFYR.js";
|
|
9
9
|
import "./chunk-CGZL5SSH.js";
|
|
10
10
|
import "./chunk-WCODTMDN.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-MOAQLHP2.js";
|
|
12
|
+
import "./chunk-JBQXPW7P.js";
|
|
13
13
|
import "./chunk-2DNYVKBF.js";
|
|
14
14
|
import "./chunk-MUWDZJN2.js";
|
|
15
15
|
import "./chunk-3KKRNQQU.js";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getArgsSchema,
|
|
6
6
|
getPluginRunePath,
|
|
7
7
|
getReplSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AG4PDJSY.js";
|
|
9
9
|
import "./chunk-UEUUOAJY.js";
|
|
10
10
|
import "./chunk-4GJMCFR6.js";
|
|
11
11
|
import "./chunk-7KYCYDAS.js";
|
|
@@ -18,7 +18,7 @@ import "./chunk-WCODTMDN.js";
|
|
|
18
18
|
import {
|
|
19
19
|
resolvePluginRune,
|
|
20
20
|
resolveRuneFromPlugins
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-MOAQLHP2.js";
|
|
22
22
|
import {
|
|
23
23
|
describeRunBlock,
|
|
24
24
|
flattenCommands,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
formatRuneIndex,
|
|
28
28
|
getRunBlockSchema,
|
|
29
29
|
selectNode
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-JBQXPW7P.js";
|
|
31
31
|
import {
|
|
32
32
|
resolveInterpreter
|
|
33
33
|
} from "./chunk-2DNYVKBF.js";
|
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
getArgsSchema,
|
|
4
4
|
getPluginRunePath,
|
|
5
5
|
getReplSchema,
|
|
6
|
+
resolveRuneExecCwd,
|
|
6
7
|
runPluginRune,
|
|
7
8
|
runRuneInIsolate,
|
|
8
9
|
runRuneInRepl
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AG4PDJSY.js";
|
|
10
11
|
import "./chunk-UEUUOAJY.js";
|
|
11
12
|
import "./chunk-4GJMCFR6.js";
|
|
12
13
|
import "./chunk-7KYCYDAS.js";
|
|
@@ -28,6 +29,7 @@ export {
|
|
|
28
29
|
getArgsSchema,
|
|
29
30
|
getPluginRunePath,
|
|
30
31
|
getReplSchema,
|
|
32
|
+
resolveRuneExecCwd,
|
|
31
33
|
runPluginRune,
|
|
32
34
|
runRuneInIsolate,
|
|
33
35
|
runRuneInRepl
|
|
@@ -16,7 +16,7 @@ import path from "node:path";
|
|
|
16
16
|
// package.json
|
|
17
17
|
var package_default = {
|
|
18
18
|
name: "@darkrymit/crunes-cli",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.11.0",
|
|
20
20
|
description: "CLI tool for querying crunes enrichers",
|
|
21
21
|
type: "module",
|
|
22
22
|
bin: {
|
|
@@ -33,7 +33,7 @@ var package_default = {
|
|
|
33
33
|
dependencies: {
|
|
34
34
|
"comment-json": "^5.0.0",
|
|
35
35
|
esbuild: "^0.28.0",
|
|
36
|
-
"isolated-vm": "^
|
|
36
|
+
"isolated-vm": "^7.0.2"
|
|
37
37
|
},
|
|
38
38
|
optionalDependencies: {
|
|
39
39
|
"better-sqlite3": "^12.10.0"
|
|
@@ -74,7 +74,7 @@ var package_default = {
|
|
|
74
74
|
license: "MIT",
|
|
75
75
|
author: "DarkRymit",
|
|
76
76
|
engines: {
|
|
77
|
-
node: ">=
|
|
77
|
+
node: ">=24"
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
|
package/dist/cli.js
CHANGED
|
@@ -3397,7 +3397,7 @@ var program = new Command();
|
|
|
3397
3397
|
// src/cli/program.js
|
|
3398
3398
|
function buildProgram() {
|
|
3399
3399
|
const program3 = new Command();
|
|
3400
|
-
program3.name("crunes").description("CLI tool for managing context runes").version("0.
|
|
3400
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.11.0", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
|
|
3401
3401
|
program3.hook("preAction", (_thisCommand, actionCommand) => {
|
|
3402
3402
|
const opts = { ...program3.opts(), ...actionCommand.opts() };
|
|
3403
3403
|
configure({ plain: !!opts.plain, verbose: !!opts.verbose });
|
|
@@ -3417,7 +3417,7 @@ function buildProgram() {
|
|
|
3417
3417
|
"after",
|
|
3418
3418
|
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "run" command.\n\nSyntax:\n [run-flags] <key>[-s s1,s2] [rune-args...]\n -b [run-flags] <key1>[-s s1] [rune-args1] + <key2>[-s s2] [rune-args2]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\n\nKey prefixes:\n project:name resolve from project config only\n plugin:name resolve directly from an enabled plugin\n name auto-resolve: project config first, then plugins\n\nFor rune argument documentation: crunes docs rune <key>'
|
|
3419
3419
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3420
|
-
const { handler, parseRunArgs } = await import("./chunks/run-
|
|
3420
|
+
const { handler, parseRunArgs } = await import("./chunks/run-WD2ZA63Z.js");
|
|
3421
3421
|
const { segments, format, failFast, isBatch } = parseRunArgs(args);
|
|
3422
3422
|
await handler({ segments, format, failFast, isBatch, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3423
3423
|
});
|
|
@@ -3425,7 +3425,7 @@ function buildProgram() {
|
|
|
3425
3425
|
"after",
|
|
3426
3426
|
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "repl" command.\n\nSyntax:\n [--format text|jsonl] <key>[-s s1,s2] [rune-args...]\n\nPer-rune bracket flags (inside key[...]):\n -s, --section s1,s2 filter output sections for this rune\n\nThe rune must export repl(args) and/or inputRepl(input).\nFor rune argument documentation: crunes docs rune <key>'
|
|
3427
3427
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3428
|
-
const { handler, parseReplArgs } = await import("./chunks/repl-
|
|
3428
|
+
const { handler, parseReplArgs } = await import("./chunks/repl-32TENE2U.js");
|
|
3429
3429
|
const { key, runeArgs, sections, format } = parseReplArgs(args);
|
|
3430
3430
|
await handler({ key, runeArgs, sections, format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3431
3431
|
});
|
|
@@ -3434,11 +3434,11 @@ function buildProgram() {
|
|
|
3434
3434
|
"after",
|
|
3435
3435
|
"\n crunes docs rune index of every rune and its commands\n crunes docs rune <key> command index for one rune\n crunes docs rune <key> <cmd>... detail for one command path\n"
|
|
3436
3436
|
).addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (key, path3, opts) => {
|
|
3437
|
-
const { handler } = await import("./chunks/rune-
|
|
3437
|
+
const { handler } = await import("./chunks/rune-TSED6W3R.js");
|
|
3438
3438
|
await handler({ key, path: path3, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
3439
3439
|
});
|
|
3440
3440
|
helpGroup.command("utils [namespaces...]").description("Show function signatures and parameter docs for utils.* namespaces").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (namespaces, opts) => {
|
|
3441
|
-
const { handler } = await import("./chunks/utils-
|
|
3441
|
+
const { handler } = await import("./chunks/utils-VVD4VCTC.js");
|
|
3442
3442
|
await handler({ namespaces, format: opts.format });
|
|
3443
3443
|
});
|
|
3444
3444
|
helpGroup.command("globals").description("Show injected sandbox globals and ES2020 builtins available in rune scripts").addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (opts) => {
|
|
@@ -3446,7 +3446,7 @@ function buildProgram() {
|
|
|
3446
3446
|
await handler({ format: opts.format });
|
|
3447
3447
|
});
|
|
3448
3448
|
helpGroup.command("intro").description("Generate a comprehensive introduction to Crunes: rune anatomy, calling conventions, config, permissions and the full @utils API. Generic \u2014 for this project's own runes use `crunes list` and `crunes docs rune`").option("--out <path>", "output file path (defaults to stdout)").action(async (opts) => {
|
|
3449
|
-
const { handler } = await import("./chunks/intro-
|
|
3449
|
+
const { handler } = await import("./chunks/intro-3FSOGWPR.js");
|
|
3450
3450
|
await handler({ out: opts.out });
|
|
3451
3451
|
});
|
|
3452
3452
|
helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
|
|
@@ -3482,18 +3482,18 @@ function buildProgram() {
|
|
|
3482
3482
|
await handler();
|
|
3483
3483
|
});
|
|
3484
3484
|
program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
|
|
3485
|
-
const { handler } = await import("./chunks/version-
|
|
3485
|
+
const { handler } = await import("./chunks/version-IDG3M56C.js");
|
|
3486
3486
|
await handler({ check: opts.check, plain: !!program3.opts().plain });
|
|
3487
3487
|
});
|
|
3488
3488
|
program3.command("doctor").description("Verify environment and project setup").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").action(async () => {
|
|
3489
|
-
const { handler } = await import("./chunks/doctor-
|
|
3489
|
+
const { handler } = await import("./chunks/doctor-WXTY6RGK.js");
|
|
3490
3490
|
await handler({ projectRoot: projectRoot() });
|
|
3491
3491
|
});
|
|
3492
3492
|
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText(
|
|
3493
3493
|
"after",
|
|
3494
3494
|
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] <key>[--runs <n>] [--warmup] [-s s1,s2] [rune-args...]\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --format text|jsonl output format (default: text)\n --fail-fast stop on first error\n --runs <n> default number of runs for all runes (default: 1)\n --warmup default warmup run for all runes\n\nPer-rune bracket flags (inside key[...]):\n --runs <n> override run count for this rune\n --warmup override warmup for this rune\n -s, --section s1,s2 filter output sections for this rune'
|
|
3495
3495
|
).allowUnknownOption().passThroughOptions().action(async (args, _opts, _command) => {
|
|
3496
|
-
const { handler, parseBenchArgs } = await import("./chunks/benchmark-
|
|
3496
|
+
const { handler, parseBenchArgs } = await import("./chunks/benchmark-5OWBATUN.js");
|
|
3497
3497
|
const parsed = parseBenchArgs(args);
|
|
3498
3498
|
if (!parsed.segments[0]?.key) {
|
|
3499
3499
|
const { output } = await import("./chunks/output-QN5CVJ62.js");
|
|
@@ -3563,9 +3563,9 @@ function buildProgram() {
|
|
|
3563
3563
|
const { handler } = await import("./chunks/init-GPNC7TR5.js");
|
|
3564
3564
|
await handler({ yes: !!program3.opts().yes, projectRoot: projectRoot(), global: !!opts.global });
|
|
3565
3565
|
});
|
|
3566
|
-
program3.command("create [new-rune]").description("Scaffold a new rune and register it in config").addOption(new Option("--format <format>", "rune output format").choices(["tree", "markdown"])).option("--path <path>", "file path for the rune (default: .crunes/runes/<key
|
|
3567
|
-
const { handler } = await import("./chunks/create-
|
|
3568
|
-
await handler({ key, format: opts.format, lang: opts.lang, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3566
|
+
program3.command("create [new-rune]").description("Scaffold a new rune and register it in config").addOption(new Option("--format <format>", "rune output format").choices(["tree", "markdown"])).option("--path <path>", "file path for the rune (default: .crunes/runes/<key>/src/index.rune.js)").addOption(new Option("--lang <lang>", "scaffold a script rune instead of a sandboxed JS one").choices(["python", "bash", "node"])).option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").option("--plugin", "register the rune in .crunes-plugin/plugin.json instead of .crunes/config.json").option("--project", "register the rune in .crunes/config.json even when .crunes-plugin/plugin.json exists").action(async (key, opts) => {
|
|
3567
|
+
const { handler } = await import("./chunks/create-3TDAFVL2.js");
|
|
3568
|
+
await handler({ key, format: opts.format, lang: opts.lang, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global, plugin: !!opts.plugin, project: !!opts.project });
|
|
3569
3569
|
});
|
|
3570
3570
|
program3.command("add <key> <command> [argv...]").description("Register an existing script or program as a rune (fixed arguments go after --)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what the rune does").option("-g, --global", "operate on the global config (~/.crunes/config.json) instead of the project").addHelpText("after", '\nExamples:\n crunes add coverage tools/coverage.py --description "Test coverage per module"\n crunes add log git -- log --oneline -n 20').action(async (key, command, argv, opts) => {
|
|
3571
3571
|
const { handler } = await import("./chunks/add-2OM5KGN5.js");
|
|
@@ -3600,9 +3600,9 @@ function buildProgram() {
|
|
|
3600
3600
|
const { handler } = await import("./chunks/disable-FB64CSYV.js");
|
|
3601
3601
|
await handler({ name, projectRoot: projectRoot(), configRoot: configRoot(), global: !!opts.global });
|
|
3602
3602
|
});
|
|
3603
|
-
plugin.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").action(async (name, opts) => {
|
|
3604
|
-
const { handler } = await import("./chunks/create-
|
|
3605
|
-
await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3603
|
+
plugin.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").option("--multi", "scaffold under runes/example/{src,test}/ for a multi-rune plugin").action(async (name, opts) => {
|
|
3604
|
+
const { handler } = await import("./chunks/create-EC6TQW7N.js");
|
|
3605
|
+
await handler({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, multi: !!opts.multi, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
3606
3606
|
});
|
|
3607
3607
|
const template = program3.command("template").description("Manage rune templates");
|
|
3608
3608
|
template.command("list [template-source]").description('List available templates. [template-source] can be "project" (project config only) or a plugin name; omit to list all.').addOption(new Option("--format <format>", "output format").choices(["text", "json"]).default("text")).action(async (source, opts) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darkrymit/crunes-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "CLI tool for querying crunes enrichers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"comment-json": "^5.0.0",
|
|
19
19
|
"esbuild": "^0.28.0",
|
|
20
|
-
"isolated-vm": "^
|
|
20
|
+
"isolated-vm": "^7.0.2"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
23
|
"better-sqlite3": "^12.10.0"
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"license": "MIT",
|
|
59
59
|
"author": "DarkRymit",
|
|
60
60
|
"engines": {
|
|
61
|
-
"node": ">=
|
|
61
|
+
"node": ">=24"
|
|
62
62
|
}
|
|
63
63
|
}
|