@darkrymit/crunes-cli 0.11.3 → 0.12.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/README.md +3 -2
- package/dist/chunks/{add-J3E6GLVR.js → add-GDF3XEGN.js} +2 -2
- package/dist/chunks/{apply-OZTKRCFK.js → apply-GDTGTBPD.js} +76 -37
- package/dist/chunks/{benchmark-R4CZKOQY.js → benchmark-2TVN6HDF.js} +6 -6
- package/dist/chunks/{chunk-CST3HAZF.js → chunk-3VFNNPQI.js} +4 -4
- package/dist/chunks/{chunk-P5WTJJSV.js → chunk-4SZGKHSW.js} +1 -7
- package/dist/chunks/{chunk-X5SKOAGS.js → chunk-ATI5HNNC.js} +2 -2
- package/dist/chunks/{chunk-NXNUMGXV.js → chunk-GABVYS5O.js} +3 -3
- package/dist/chunks/{chunk-YYOMTVCG.js → chunk-HQUMVDQE.js} +11 -3
- package/dist/chunks/{chunk-64INAIPB.js → chunk-J33GQMPV.js} +1 -1
- package/dist/chunks/{chunk-JQHD5C7T.js → chunk-KP4EW2DS.js} +1 -1
- package/dist/chunks/{create-EG6XUWZU.js → chunk-PBQDFAR4.js} +13 -14
- package/dist/chunks/{chunk-KJDS6KLG.js → chunk-QAP63JIK.js} +8 -8
- package/dist/chunks/{chunk-JCZPJPKB.js → chunk-THGPCLJD.js} +4 -4
- package/dist/chunks/{chunk-OSHSGWZN.js → chunk-YUI5RTLD.js} +1 -1
- package/dist/chunks/{trust-QJWRA2UU.js → chunk-ZLIG4RAI.js} +22 -22
- package/dist/chunks/{create-LZPZZIVO.js → create-4DEH53O6.js} +29 -12
- package/dist/chunks/{create-ZXC6IVTR.js → create-YLXRZQXI.js} +18 -7
- package/dist/chunks/create-ZWBV7PPT.js +24 -0
- package/dist/chunks/{disable-D64RMPMM.js → disable-QLB4FZOF.js} +2 -2
- package/dist/chunks/{doctor-RPMWVIU2.js → doctor-SXKAEYUF.js} +5 -5
- package/dist/chunks/{enable-WQ67RBZM.js → enable-D5BM5VZ7.js} +2 -2
- package/dist/chunks/{init-WXAPVBVC.js → init-EY5R26HE.js} +4 -3
- package/dist/chunks/{install-RIB6WJAJ.js → install-FSJAC3CL.js} +5 -5
- package/dist/chunks/{intro-WRYGSVZA.js → intro-PN7LT6ZG.js} +10 -10
- package/dist/chunks/{list-2L47SUMZ.js → list-THRLETUN.js} +4 -4
- package/dist/chunks/{list-YPY6WXXM.js → list-U44ZZ3NZ.js} +2 -4
- package/dist/chunks/{list-4HIUYIH6.js → list-WFMSED5O.js} +3 -3
- package/dist/chunks/{repl-D74NDSU3.js → repl-PSADU3MJ.js} +7 -7
- package/dist/chunks/{resolver-7OOQKADV.js → resolver-YEUZSOS4.js} +5 -5
- package/dist/chunks/{run-NWDA34W2.js → run-CYGL3HTA.js} +6 -6
- package/dist/chunks/{rune-M6CDT6KM.js → rune-OQX5EYSQ.js} +32 -19
- package/dist/chunks/{runner-J2ILUQH5.js → runner-VUSHR2OR.js} +2 -2
- package/dist/chunks/trust-7GU7ODWL.js +20 -0
- package/dist/chunks/{uninstall-NCBA2KNM.js → uninstall-MSCIWDWV.js} +5 -5
- package/dist/chunks/{update-PMK4FT7F.js → update-IHCYA3JW.js} +5 -5
- package/dist/chunks/{version-BHXXTACZ.js → version-QBWEJ45I.js} +1 -1
- package/dist/cli.js +27 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Install globally via `npm`:
|
|
|
24
24
|
npm install -g @darkrymit/crunes-cli
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
*Requires Node.js ≥
|
|
27
|
+
*Requires Node.js ≥ 24.*
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
@@ -38,7 +38,7 @@ cd your-project
|
|
|
38
38
|
# Initialize .crunes/config.json
|
|
39
39
|
crunes init
|
|
40
40
|
|
|
41
|
-
# Scaffold a new rune (.crunes/runes/fetch-status.js)
|
|
41
|
+
# Scaffold a new rune (.crunes/runes/fetch-status/src/index.rune.js)
|
|
42
42
|
crunes create fetch-status
|
|
43
43
|
|
|
44
44
|
# Run the rune and output the markdown sections
|
|
@@ -69,6 +69,7 @@ crunes job kill <id> # Forcefully terminate a running background
|
|
|
69
69
|
|
|
70
70
|
# Templates, Plugins, and Markets
|
|
71
71
|
crunes template list # List available rune templates
|
|
72
|
+
crunes template create <name> # Scaffold a new rune template
|
|
72
73
|
crunes template apply <name> # Copy a template as a new local rune
|
|
73
74
|
crunes plugin install <pkg> # Install a secure plugin from marketplace
|
|
74
75
|
crunes plugin list # List active marketplace plugins
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getConfigPath,
|
|
3
3
|
readRawConfig,
|
|
4
4
|
writeRawConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J33GQMPV.js";
|
|
6
6
|
import {
|
|
7
7
|
output
|
|
8
8
|
} from "./chunk-RQ6KHY6W.js";
|
|
@@ -11,7 +11,7 @@ import "./chunk-AFAVAB5Q.js";
|
|
|
11
11
|
import {
|
|
12
12
|
runtimeOf
|
|
13
13
|
} from "./chunk-UKAIACRQ.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-YUI5RTLD.js";
|
|
15
15
|
import {
|
|
16
16
|
isPathCommand
|
|
17
17
|
} from "./chunk-BK4WG54O.js";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
scriptLines
|
|
3
|
+
} from "./chunk-ZLIG4RAI.js";
|
|
1
4
|
import {
|
|
2
5
|
output
|
|
3
6
|
} from "./chunk-RQ6KHY6W.js";
|
|
@@ -8,9 +11,13 @@ import {
|
|
|
8
11
|
ye
|
|
9
12
|
} from "./chunk-PRCVJ727.js";
|
|
10
13
|
import "./chunk-AFAVAB5Q.js";
|
|
14
|
+
import {
|
|
15
|
+
runtimeOf
|
|
16
|
+
} from "./chunk-UKAIACRQ.js";
|
|
17
|
+
import "./chunk-HQUMVDQE.js";
|
|
11
18
|
import {
|
|
12
19
|
loadConfig
|
|
13
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YUI5RTLD.js";
|
|
14
21
|
import "./chunk-BK4WG54O.js";
|
|
15
22
|
import {
|
|
16
23
|
loadRegistry,
|
|
@@ -20,9 +27,8 @@ import {
|
|
|
20
27
|
loadPluginJson
|
|
21
28
|
} from "./chunk-CEQBF5LN.js";
|
|
22
29
|
import "./chunk-ESXRY4PQ.js";
|
|
23
|
-
import
|
|
24
|
-
|
|
25
|
-
} from "./chunk-P5WTJJSV.js";
|
|
30
|
+
import "./chunk-4SZGKHSW.js";
|
|
31
|
+
import "./chunk-ZT4QFTQM.js";
|
|
26
32
|
import "./chunk-7YY3GPPK.js";
|
|
27
33
|
import "./chunk-DR6PVO72.js";
|
|
28
34
|
import {
|
|
@@ -32,7 +38,28 @@ import {
|
|
|
32
38
|
// src/template/commands/apply.js
|
|
33
39
|
init_require_shim();
|
|
34
40
|
import fs from "node:fs/promises";
|
|
41
|
+
import { existsSync } from "node:fs";
|
|
35
42
|
import path from "node:path";
|
|
43
|
+
var ENTRY_FILE = /^index(\.rune)?\.[^.]+$/i;
|
|
44
|
+
async function findEntries(templateDir) {
|
|
45
|
+
let files;
|
|
46
|
+
try {
|
|
47
|
+
files = await fs.readdir(path.join(templateDir, "src"), { withFileTypes: true });
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return files.filter((f) => f.isFile() && ENTRY_FILE.test(f.name) && runtimeOf(`./${f.name}`) !== "file").map((f) => `src/${f.name}`);
|
|
52
|
+
}
|
|
53
|
+
async function describeScript(templateName, templateDir, entry) {
|
|
54
|
+
const files = await fs.readdir(templateDir, { recursive: true, withFileTypes: true });
|
|
55
|
+
const others = files.filter((f) => !f.isDirectory()).map((f) => path.relative(templateDir, path.join(f.parentPath, f.name)).replace(/\\/g, "/")).filter((f) => f !== entry).sort();
|
|
56
|
+
return [
|
|
57
|
+
`Template "${templateName}" runs natively, outside the sandbox, with your full access`,
|
|
58
|
+
` command: ${entry}`,
|
|
59
|
+
...scriptLines(path.join(templateDir, entry)),
|
|
60
|
+
...others.length ? ["", ` also copied: ${others.join(", ")}`] : []
|
|
61
|
+
].join("\n");
|
|
62
|
+
}
|
|
36
63
|
async function resolveTemplate(sourceName, templateName, projectRoot) {
|
|
37
64
|
if (!sourceName || sourceName === "project") {
|
|
38
65
|
let config = { templates: {} };
|
|
@@ -43,13 +70,13 @@ async function resolveTemplate(sourceName, templateName, projectRoot) {
|
|
|
43
70
|
const templates = config.templates ?? {};
|
|
44
71
|
const entry = templates[templateName];
|
|
45
72
|
if (entry !== void 0) {
|
|
46
|
-
if (
|
|
73
|
+
if (entry.path) {
|
|
47
74
|
return { type: "local", templateName, entry };
|
|
48
75
|
}
|
|
49
76
|
if (entry.plugin) {
|
|
50
77
|
return { type: "shortcut", templateName, entry };
|
|
51
78
|
}
|
|
52
|
-
return { type: "local", templateName, entry: { ...entry, path: `.crunes/templates/${templateName}
|
|
79
|
+
return { type: "local", templateName, entry: { ...entry, path: `.crunes/templates/${templateName}` } };
|
|
53
80
|
}
|
|
54
81
|
if (sourceName === "project") return null;
|
|
55
82
|
}
|
|
@@ -84,7 +111,7 @@ async function resolveTemplate(sourceName, templateName, projectRoot) {
|
|
|
84
111
|
async function handler({
|
|
85
112
|
ref,
|
|
86
113
|
key,
|
|
87
|
-
path:
|
|
114
|
+
path: runePath,
|
|
88
115
|
name,
|
|
89
116
|
description,
|
|
90
117
|
yes = false,
|
|
@@ -105,30 +132,14 @@ async function handler({
|
|
|
105
132
|
process.exit(1);
|
|
106
133
|
}
|
|
107
134
|
const outputKey = key ?? templateName;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
output.error(`${runeRelPath}: a sandboxed rune's file must be named *.rune.js \u2014 the name is what runs it in the isolate.`);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
const runeAbsPath = path.join(projectRoot, runeRelPath);
|
|
135
|
+
const runeRelDir = (runePath ?? `.crunes/runes/${outputKey}`).replace(/[/\\]+$/, "");
|
|
136
|
+
const runeAbsDir = path.join(projectRoot, runeRelDir);
|
|
114
137
|
if (!isNonInteractive) ye("crunes template apply");
|
|
115
|
-
try {
|
|
116
|
-
await fs.access(runeAbsPath);
|
|
117
|
-
if (!isNonInteractive) {
|
|
118
|
-
const ok = await le({ message: `${runeRelPath} already exists. Overwrite?` });
|
|
119
|
-
if (!ok || ok === /* @__PURE__ */ Symbol.for("clack:cancel")) {
|
|
120
|
-
ge("Cancelled.");
|
|
121
|
-
process.exit(0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
} catch {
|
|
125
|
-
}
|
|
126
|
-
await fs.mkdir(path.dirname(runeAbsPath), { recursive: true });
|
|
127
138
|
let templateMeta = {};
|
|
139
|
+
let templateDir;
|
|
128
140
|
if (resolved.type === "local") {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
templateMeta = typeof resolved.entry === "string" ? {} : resolved.entry;
|
|
141
|
+
templateDir = path.resolve(projectRoot, resolved.entry.path);
|
|
142
|
+
templateMeta = resolved.entry;
|
|
132
143
|
} else if (resolved.type === "shortcut") {
|
|
133
144
|
const pluginRef = resolved.entry.plugin;
|
|
134
145
|
const colonIdx = pluginRef.indexOf(":");
|
|
@@ -153,16 +164,44 @@ async function handler({
|
|
|
153
164
|
output.error(`Template shortcut "${templateName}" \u2192 "${pluginRef}" not found in plugin.`);
|
|
154
165
|
process.exit(1);
|
|
155
166
|
}
|
|
156
|
-
|
|
157
|
-
const srcPath = path.join(pluginEntry.path, templateRelPath);
|
|
158
|
-
await fs.copyFile(srcPath, runeAbsPath);
|
|
167
|
+
templateDir = path.join(pluginEntry.path, meta.path ?? `templates/${pluginTemplateKey}`);
|
|
159
168
|
templateMeta = { ...meta, ...resolved.entry.name && { name: resolved.entry.name }, ...resolved.entry.description && { description: resolved.entry.description } };
|
|
160
169
|
} else if (resolved.type === "plugin") {
|
|
161
|
-
|
|
162
|
-
const srcPath = path.join(resolved.pluginEntry.path, templateRelPath);
|
|
163
|
-
await fs.copyFile(srcPath, runeAbsPath);
|
|
170
|
+
templateDir = path.join(resolved.pluginEntry.path, resolved.templateMeta.path ?? `templates/${resolved.templateName}`);
|
|
164
171
|
templateMeta = resolved.templateMeta;
|
|
165
172
|
}
|
|
173
|
+
const entries = await findEntries(templateDir);
|
|
174
|
+
if (entries.length !== 1) {
|
|
175
|
+
output.error(`Template "${templateName}" needs exactly one src/index.* entry in ${templateDir} \u2014 found ${entries.length ? entries.join(", ") : "none"}.`);
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
const [entry] = entries;
|
|
179
|
+
if (runtimeOf(`./${entry}`) !== "isolate") {
|
|
180
|
+
if (templateMeta.permissions) {
|
|
181
|
+
output.error(`Template "${templateName}" declares permissions, but ${entry} runs natively with full access, so grants would not apply to it.`);
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
console.log(await describeScript(templateName, templateDir, entry) + "\n");
|
|
185
|
+
if (!yes) {
|
|
186
|
+
if (isNonInteractive) {
|
|
187
|
+
output.error("Applying a script template is a decision to make after reading it. Run this in a terminal, or pass -y (crunes -y template apply \u2026) once you have reviewed it.");
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
const ok = await le({ message: "Apply this script to run with your full access?" });
|
|
191
|
+
if (ok !== true) {
|
|
192
|
+
ge("Cancelled.");
|
|
193
|
+
process.exit(0);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!isNonInteractive && existsSync(runeAbsDir)) {
|
|
198
|
+
const ok = await le({ message: `${runeRelDir} already exists. Overwrite?` });
|
|
199
|
+
if (ok !== true) {
|
|
200
|
+
ge("Cancelled.");
|
|
201
|
+
process.exit(0);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
await fs.cp(templateDir, runeAbsDir, { recursive: true });
|
|
166
205
|
const configPath = path.join(configRoot ?? projectRoot, ".crunes", "config.json");
|
|
167
206
|
let config = { runes: {} };
|
|
168
207
|
try {
|
|
@@ -171,7 +210,7 @@ async function handler({
|
|
|
171
210
|
}
|
|
172
211
|
const resolvedName = name ?? templateMeta.name;
|
|
173
212
|
const resolvedDesc = description ?? templateMeta.description;
|
|
174
|
-
const command =
|
|
213
|
+
const command = `${runeRelDir}/${entry}`;
|
|
175
214
|
const perms = templateMeta.permissions;
|
|
176
215
|
const configEntry = {
|
|
177
216
|
...resolvedName && { name: resolvedName },
|
|
@@ -184,10 +223,10 @@ async function handler({
|
|
|
184
223
|
await fs.writeFile(tmp, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
185
224
|
await fs.rename(tmp, configPath);
|
|
186
225
|
if (!isNonInteractive) {
|
|
187
|
-
fe(`Created ${
|
|
226
|
+
fe(`Created ${runeRelDir}
|
|
188
227
|
Run: crunes run ${outputKey}`);
|
|
189
228
|
} else {
|
|
190
|
-
output.success(`Created ${
|
|
229
|
+
output.success(`Created ${runeRelDir}`);
|
|
191
230
|
output.info(`Run: crunes run ${outputKey}`);
|
|
192
231
|
}
|
|
193
232
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
joinBracketTokens,
|
|
3
3
|
parseBracketKey
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3VFNNPQI.js";
|
|
5
5
|
import {
|
|
6
6
|
output
|
|
7
7
|
} from "./chunk-RQ6KHY6W.js";
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
} from "./chunk-AFAVAB5Q.js";
|
|
12
12
|
import {
|
|
13
13
|
runRune
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-QAP63JIK.js";
|
|
15
|
+
import "./chunk-ATI5HNNC.js";
|
|
16
16
|
import "./chunk-UKAIACRQ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-HQUMVDQE.js";
|
|
18
18
|
import {
|
|
19
19
|
loadConfig
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YUI5RTLD.js";
|
|
21
21
|
import "./chunk-BK4WG54O.js";
|
|
22
22
|
import "./chunk-V2VVG44B.js";
|
|
23
23
|
import "./chunk-CEQBF5LN.js";
|
|
24
24
|
import "./chunk-ESXRY4PQ.js";
|
|
25
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-4SZGKHSW.js";
|
|
26
26
|
import "./chunk-C2JSNCGY.js";
|
|
27
27
|
import "./chunk-Q6K5MEDF.js";
|
|
28
28
|
import "./chunk-ZT4QFTQM.js";
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
describeConfigLayers,
|
|
7
7
|
runRune
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QAP63JIK.js";
|
|
9
9
|
import {
|
|
10
10
|
renderSection
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ATI5HNNC.js";
|
|
12
12
|
import {
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YUI5RTLD.js";
|
|
15
15
|
import {
|
|
16
16
|
isGlobMatch,
|
|
17
17
|
isWildcardMatch
|
|
@@ -216,7 +216,7 @@ async function handler({
|
|
|
216
216
|
process.exit(1);
|
|
217
217
|
}
|
|
218
218
|
if (isBatch) {
|
|
219
|
-
const { resolvePluginRune } = await import("./resolver-
|
|
219
|
+
const { resolvePluginRune } = await import("./resolver-YEUZSOS4.js");
|
|
220
220
|
const { loadPluginJson } = await import("./manifest-6KLIS7BL.js");
|
|
221
221
|
for (const seg of segments) {
|
|
222
222
|
let entry = config.runes?.[seg.key] ?? {};
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
// src/core/rune-entry.js
|
|
6
6
|
init_require_shim();
|
|
7
7
|
import { join, isAbsolute } from "node:path";
|
|
8
|
-
var ISOLATE_MODULE = /\.rune\.m?js$/i;
|
|
9
8
|
function blockOf(entry, name) {
|
|
10
9
|
const block = entry?.[name];
|
|
11
10
|
if (block == null) return null;
|
|
@@ -24,14 +23,9 @@ function blockModule(entry, mode, base) {
|
|
|
24
23
|
if (!command) return null;
|
|
25
24
|
return isAbsolute(command) ? command : join(base, command);
|
|
26
25
|
}
|
|
27
|
-
function isolateName(file) {
|
|
28
|
-
if (ISOLATE_MODULE.test(file)) return file;
|
|
29
|
-
return file.replace(/\.(m?js)$/i, ".rune.$1");
|
|
30
|
-
}
|
|
31
26
|
|
|
32
27
|
export {
|
|
33
28
|
blockOf,
|
|
34
29
|
scopedPermissions,
|
|
35
|
-
blockModule
|
|
36
|
-
isolateName
|
|
30
|
+
blockModule
|
|
37
31
|
};
|
|
@@ -440,7 +440,7 @@ async function getRunBlockSchema(desc, projectDir, { vars = {}, runeKey = null }
|
|
|
440
440
|
if (/\.json$/i.test(desc.argsModule)) {
|
|
441
441
|
return loadJsonSchema(desc.argsModule, relative(projectDir, desc.argsModule).replace(/\\/g, "/") || desc.argsModule);
|
|
442
442
|
}
|
|
443
|
-
const { getArgsSchema } = await import("./runner-
|
|
443
|
+
const { getArgsSchema } = await import("./runner-VUSHR2OR.js");
|
|
444
444
|
return getArgsSchema(desc.argsModule, blockGrants({ permissions: desc.argsPermissions }), projectDir, { vars, runeKey });
|
|
445
445
|
}
|
|
446
446
|
function parseOutputLine(line) {
|
|
@@ -474,7 +474,7 @@ async function runRunBlock({ dir, key, args, entry, opts = {}, configDir, runeCa
|
|
|
474
474
|
const desc = describeRunBlock(entry, configDir);
|
|
475
475
|
let callArgs = [...desc.argv, ...args];
|
|
476
476
|
if (desc.runtime === "isolate") {
|
|
477
|
-
const { runRuneInIsolate } = await import("./runner-
|
|
477
|
+
const { runRuneInIsolate } = await import("./runner-VUSHR2OR.js");
|
|
478
478
|
return runRuneInIsolate(desc.command, blockGrants(desc), callArgs, dir, {
|
|
479
479
|
runeCallback,
|
|
480
480
|
sections: opts.sections ?? null,
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-UKAIACRQ.js";
|
|
4
4
|
import {
|
|
5
5
|
isNativeRune
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HQUMVDQE.js";
|
|
7
7
|
import {
|
|
8
8
|
enabledPluginKeys,
|
|
9
9
|
getRune
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YUI5RTLD.js";
|
|
11
11
|
import {
|
|
12
12
|
blockOf
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4SZGKHSW.js";
|
|
14
14
|
import {
|
|
15
15
|
init_require_shim
|
|
16
16
|
} from "./chunk-FATG2PA7.js";
|
|
@@ -5,9 +5,12 @@ import {
|
|
|
5
5
|
loadRegistry,
|
|
6
6
|
saveRegistry
|
|
7
7
|
} from "./chunk-V2VVG44B.js";
|
|
8
|
+
import {
|
|
9
|
+
isInlineSchema
|
|
10
|
+
} from "./chunk-ESXRY4PQ.js";
|
|
8
11
|
import {
|
|
9
12
|
blockOf
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4SZGKHSW.js";
|
|
11
14
|
import {
|
|
12
15
|
init_require_shim
|
|
13
16
|
} from "./chunk-FATG2PA7.js";
|
|
@@ -27,11 +30,16 @@ function nativeRuneFile(pluginDir, rune) {
|
|
|
27
30
|
if (!isPathCommand(command)) return null;
|
|
28
31
|
return isAbsolute(command) ? command : join(pluginDir, command);
|
|
29
32
|
}
|
|
33
|
+
function argsFile(pluginDir, rune) {
|
|
34
|
+
if (rune.args == null || isInlineSchema(rune.args)) return null;
|
|
35
|
+
const { command } = blockOf(rune, "args");
|
|
36
|
+
return isAbsolute(command) ? command : join(pluginDir, command);
|
|
37
|
+
}
|
|
30
38
|
function trustDigest(pluginDir, rune) {
|
|
31
39
|
const hash = createHash("sha256");
|
|
32
40
|
hash.update(JSON.stringify({ run: blockOf(rune, "run"), args: rune.args ?? null }));
|
|
33
|
-
const file
|
|
34
|
-
|
|
41
|
+
for (const file of [nativeRuneFile(pluginDir, rune), argsFile(pluginDir, rune)]) {
|
|
42
|
+
if (!file) continue;
|
|
35
43
|
try {
|
|
36
44
|
hash.update(readFileSync(file));
|
|
37
45
|
} catch {
|
|
@@ -2,25 +2,21 @@ import {
|
|
|
2
2
|
getConfigPath,
|
|
3
3
|
readRawConfig,
|
|
4
4
|
writeRawConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J33GQMPV.js";
|
|
6
6
|
import {
|
|
7
7
|
output
|
|
8
8
|
} from "./chunk-RQ6KHY6W.js";
|
|
9
9
|
import {
|
|
10
10
|
Ee,
|
|
11
|
+
R,
|
|
11
12
|
Re,
|
|
12
13
|
fe,
|
|
13
14
|
ge,
|
|
14
15
|
ye
|
|
15
16
|
} from "./chunk-PRCVJ727.js";
|
|
16
|
-
import "./chunk-AFAVAB5Q.js";
|
|
17
|
-
import "./chunk-OSHSGWZN.js";
|
|
18
|
-
import "./chunk-BK4WG54O.js";
|
|
19
|
-
import "./chunk-ESXRY4PQ.js";
|
|
20
17
|
import {
|
|
21
18
|
getStorePath
|
|
22
19
|
} from "./chunk-7YY3GPPK.js";
|
|
23
|
-
import "./chunk-DR6PVO72.js";
|
|
24
20
|
import {
|
|
25
21
|
init_require_shim
|
|
26
22
|
} from "./chunk-FATG2PA7.js";
|
|
@@ -70,7 +66,7 @@ async function resolveTarget({ configRoot, global, plugin, project, isNonInterac
|
|
|
70
66
|
{ value: "project", label: "project (.crunes/config.json)", hint: "dev-time project rune" }
|
|
71
67
|
]
|
|
72
68
|
});
|
|
73
|
-
if (picked
|
|
69
|
+
if (R(picked)) return null;
|
|
74
70
|
return picked;
|
|
75
71
|
}
|
|
76
72
|
return hasPlugin ? "plugin" : "project";
|
|
@@ -288,7 +284,7 @@ async function handler({
|
|
|
288
284
|
ye("crunes create");
|
|
289
285
|
if (!key) {
|
|
290
286
|
const result = await Re({ message: "Rune key?", validate: (v) => v ? void 0 : "Required" });
|
|
291
|
-
if (result
|
|
287
|
+
if (R(result)) {
|
|
292
288
|
ge("Cancelled.");
|
|
293
289
|
return;
|
|
294
290
|
}
|
|
@@ -302,7 +298,7 @@ async function handler({
|
|
|
302
298
|
{ value: "markdown", label: "markdown", hint: "freeform markdown content" }
|
|
303
299
|
]
|
|
304
300
|
});
|
|
305
|
-
if (result
|
|
301
|
+
if (R(result)) {
|
|
306
302
|
ge("Cancelled.");
|
|
307
303
|
return;
|
|
308
304
|
}
|
|
@@ -311,7 +307,7 @@ async function handler({
|
|
|
311
307
|
if (!runeRelPath) {
|
|
312
308
|
const defaultPath = defaultRunePaths({ target, key, ext: "rune.js", pluginManifest }).runeRelPath;
|
|
313
309
|
const result = await Re({ message: "File path?", initialValue: defaultPath });
|
|
314
|
-
if (result
|
|
310
|
+
if (R(result)) {
|
|
315
311
|
ge("Cancelled.");
|
|
316
312
|
return;
|
|
317
313
|
}
|
|
@@ -319,7 +315,7 @@ async function handler({
|
|
|
319
315
|
}
|
|
320
316
|
if (!name) {
|
|
321
317
|
const result = await Re({ message: "Name? (optional)", placeholder: "Human-readable label for crunes list" });
|
|
322
|
-
if (result
|
|
318
|
+
if (R(result)) {
|
|
323
319
|
ge("Cancelled.");
|
|
324
320
|
return;
|
|
325
321
|
}
|
|
@@ -327,7 +323,7 @@ async function handler({
|
|
|
327
323
|
}
|
|
328
324
|
if (!description) {
|
|
329
325
|
const result = await Re({ message: "Description? (optional)", placeholder: "What context does this rune provide?" });
|
|
330
|
-
if (result
|
|
326
|
+
if (R(result)) {
|
|
331
327
|
ge("Cancelled.");
|
|
332
328
|
return;
|
|
333
329
|
}
|
|
@@ -359,8 +355,11 @@ Run: crunes run ${key}`);
|
|
|
359
355
|
output.info(`Run: crunes run ${key}`);
|
|
360
356
|
}
|
|
361
357
|
}
|
|
358
|
+
|
|
362
359
|
export {
|
|
360
|
+
runeTestTemplate,
|
|
361
|
+
SCRIPT_LANGS,
|
|
363
362
|
VALID_LANGS,
|
|
364
|
-
|
|
365
|
-
|
|
363
|
+
template,
|
|
364
|
+
handler
|
|
366
365
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRunBlock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ATI5HNNC.js";
|
|
4
4
|
import {
|
|
5
5
|
isNativeRune,
|
|
6
6
|
trustDigest,
|
|
7
7
|
trustState,
|
|
8
8
|
untrustedError
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HQUMVDQE.js";
|
|
10
10
|
import {
|
|
11
11
|
enabledPluginKeys,
|
|
12
12
|
getRune
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YUI5RTLD.js";
|
|
14
14
|
import {
|
|
15
15
|
loadRegistry,
|
|
16
16
|
resolvePluginKeyScoped
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import {
|
|
22
22
|
blockModule,
|
|
23
23
|
scopedPermissions
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4SZGKHSW.js";
|
|
25
25
|
import {
|
|
26
26
|
computeEffectivePermissions
|
|
27
27
|
} from "./chunk-C2JSNCGY.js";
|
|
@@ -127,7 +127,7 @@ async function runPluginMatch({ match, pluginJson, projectPerms, projectVars, ke
|
|
|
127
127
|
});
|
|
128
128
|
return result2?.directExitCode !== void 0 ? result2 : normaliseResult(result2);
|
|
129
129
|
}
|
|
130
|
-
const { executePluginRune } = await import("./runner-
|
|
130
|
+
const { executePluginRune } = await import("./runner-VUSHR2OR.js");
|
|
131
131
|
const result = await executePluginRune({
|
|
132
132
|
pluginDir,
|
|
133
133
|
pluginCacheDir,
|
|
@@ -225,7 +225,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
|
|
|
225
225
|
const vars = { ...pluginJson.runes[runeKey]?.vars ?? {}, ...config.runes?.[`${pluginKey}:${runeKey}`]?.vars ?? {} };
|
|
226
226
|
return {
|
|
227
227
|
async createReplSession(args, opts = {}) {
|
|
228
|
-
const { getPluginRunePath, runRuneInRepl } = await import("./runner-
|
|
228
|
+
const { getPluginRunePath, runRuneInRepl } = await import("./runner-VUSHR2OR.js");
|
|
229
229
|
const runeFile = getPluginRunePath(pluginDir, runeKey, pluginJson, "repl");
|
|
230
230
|
const nodeModulesDir = join(pluginCacheDir, "node_modules");
|
|
231
231
|
return runRuneInRepl(runeFile, effective, args, projectDir, {
|
|
@@ -251,7 +251,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
|
|
|
251
251
|
const vars = entry.vars ?? {};
|
|
252
252
|
return {
|
|
253
253
|
async createReplSession(args, opts = {}) {
|
|
254
|
-
const { runRuneInRepl } = await import("./runner-
|
|
254
|
+
const { runRuneInRepl } = await import("./runner-VUSHR2OR.js");
|
|
255
255
|
return runRuneInRepl(runeFile, effective, args, projectDir, {
|
|
256
256
|
vars,
|
|
257
257
|
runeKey: key,
|
|
@@ -275,7 +275,7 @@ async function resolveRuneEntry(projectDir, config, key, configDir = projectDir)
|
|
|
275
275
|
const vars = { ...pluginJson.runes[runeKey]?.vars ?? {}, ...config.runes?.[`${pluginKey}:${runeKey}`]?.vars ?? {} };
|
|
276
276
|
return {
|
|
277
277
|
async createReplSession(args, opts = {}) {
|
|
278
|
-
const { getPluginRunePath, runRuneInRepl } = await import("./runner-
|
|
278
|
+
const { getPluginRunePath, runRuneInRepl } = await import("./runner-VUSHR2OR.js");
|
|
279
279
|
const runeFile = getPluginRunePath(pluginDir, runeKey, pluginJson, "repl");
|
|
280
280
|
const nodeModulesDir = join(pluginCacheDir, "node_modules");
|
|
281
281
|
return runRuneInRepl(runeFile, effective, args, projectDir, {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
readRawConfig,
|
|
7
7
|
setPluginEnabled,
|
|
8
8
|
writeRawConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-J33GQMPV.js";
|
|
10
10
|
import {
|
|
11
11
|
output
|
|
12
12
|
} from "./chunk-RQ6KHY6W.js";
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from "./chunk-PRCVJ727.js";
|
|
17
17
|
import {
|
|
18
18
|
isNativeRune
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HQUMVDQE.js";
|
|
20
20
|
import {
|
|
21
21
|
coercePlugins
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-YUI5RTLD.js";
|
|
23
23
|
import {
|
|
24
24
|
loadRegistry,
|
|
25
25
|
registerPlugin,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
blockOf,
|
|
33
33
|
scopedPermissions
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-4SZGKHSW.js";
|
|
35
35
|
import {
|
|
36
36
|
ensureStoreDirs,
|
|
37
37
|
getPluginCacheDir,
|
|
@@ -32,7 +32,7 @@ function absolutizeSection(section, kind, baseDir, layer) {
|
|
|
32
32
|
if (kind === "templates") {
|
|
33
33
|
const isPluginRef = Boolean(entry.plugin) || key.includes(":");
|
|
34
34
|
if (entry.path) copy.path = resolve(baseDir, entry.path);
|
|
35
|
-
else if (layer === "global" && !isPluginRef) copy.path = resolve(baseDir, `templates/${key}
|
|
35
|
+
else if (layer === "global" && !isPluginRef) copy.path = resolve(baseDir, `templates/${key}`);
|
|
36
36
|
out[key] = copy;
|
|
37
37
|
continue;
|
|
38
38
|
}
|