@darkrymit/crunes-cli 0.8.5 → 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.
- package/dist/chunks/{add-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
- package/dist/chunks/{apply-J4YICV6H.js → apply-YY7MIM64.js} +9 -9
- package/dist/chunks/{benchmark-AKKV7G32.js → benchmark-BQNMULOO.js} +17 -14
- package/dist/chunks/{browse-JZFU52ET.js → browse-PHMBDREQ.js} +2 -2
- package/dist/chunks/{chunk-6MRZXASS.js → chunk-2Q3KLBE6.js} +16 -0
- package/dist/chunks/{chunk-KII6KW5Z.js → chunk-34F4ZURL.js} +40 -37
- package/dist/chunks/{chunk-ZJDKCC2Y.js → chunk-4GJMCFR6.js} +6 -3
- package/dist/chunks/chunk-CY6C6ADU.js +2787 -0
- package/dist/chunks/{chunk-J3GZ3DXD.js → chunk-GVMT55GH.js} +3 -2
- package/dist/chunks/{chunk-JOAL437H.js → chunk-I6MHDUCW.js} +16 -1
- package/dist/chunks/{chunk-6XLT25GS.js → chunk-MIKWIFYR.js} +47 -0
- package/dist/chunks/chunk-MRNZFUXZ.js +70 -0
- package/dist/chunks/{chunk-T53L5CJW.js → chunk-PBGUKXT6.js} +2887 -1874
- package/dist/chunks/chunk-QYRF3R35.js +154 -0
- package/dist/chunks/{chunk-BTIPUR5S.js → chunk-SNC7AOT7.js} +78 -12
- package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
- package/dist/chunks/{chunk-GTCPZ22N.js → chunk-VST6HAB6.js} +1 -1
- package/dist/chunks/{chunk-NDEYEYSU.js → chunk-WJII3LZK.js} +4 -3
- package/dist/chunks/chunk-X7PZN73N.js +44 -0
- package/dist/chunks/{chunk-NYLRTAAA.js → chunk-YVN3VDRE.js} +1 -1
- package/dist/chunks/{chunk-WJRZN7BR.js → chunk-YXCHIMLW.js} +843 -3027
- package/dist/chunks/{clear-YBDIPEEH.js → clear-AT7HNUV4.js} +2 -2
- package/dist/chunks/{create-GPDE2YKL.js → create-ET6DT5ZE.js} +22 -18
- package/dist/chunks/{create-VYZRWRGQ.js → create-LM7U3CJS.js} +22 -18
- package/dist/chunks/{create-L6DJN4ME.js → create-TLPM7HJE.js} +3 -3
- package/dist/chunks/{delete-LNOYM5KG.js → delete-5R3WBLVD.js} +5 -5
- package/dist/chunks/{delete-E4TEBRPX.js → delete-GKYA2W5Z.js} +4 -2
- package/dist/chunks/{delete-C4UJ7X5K.js → delete-U4STA2QZ.js} +5 -5
- package/dist/chunks/disable-TNTEIAKO.js +39 -0
- package/dist/chunks/doctor-VXAQYMTR.js +101 -0
- package/dist/chunks/enable-GUQCB4CU.js +31 -0
- package/dist/chunks/{globals-H2WF344Y.js → globals-SNQFCHMP.js} +1 -1
- package/dist/chunks/{init-HU5OMHEH.js → init-PJSCFOC6.js} +14 -8
- package/dist/chunks/{install-FIYRMVLR.js → install-4YP7FALO.js} +18 -16
- package/dist/chunks/{intro-36OLGNYN.js → intro-SA7MWV3Z.js} +50 -8
- package/dist/chunks/{kill-2UG7PHUV.js → kill-TX3PC73P.js} +2 -1
- package/dist/chunks/list-7R6NASFI.js +92 -0
- package/dist/chunks/{list-4X3JFQGS.js → list-EHREZR6M.js} +2 -1
- package/dist/chunks/{list-U7PAYNAH.js → list-LC6HB3H3.js} +2 -2
- package/dist/chunks/{list-AIYNOPNZ.js → list-OMMZAQ23.js} +2 -2
- package/dist/chunks/{list-7VHJIUDX.js → list-U4EMHQZT.js} +2 -2
- package/dist/chunks/{list-PTAWQYWG.js → list-V7VVD5AG.js} +2 -1
- package/dist/chunks/{list-A5WVDBWF.js → list-VA73WPK6.js} +2 -2
- package/dist/chunks/{list-2JYMBMZC.js → list-WKNPZZOV.js} +5 -4
- package/dist/chunks/{output-RJ6JSNY7.js → output-QN5CVJ62.js} +4 -1
- package/dist/chunks/{query-AW7WYILM.js → query-2US3CPYT.js} +2 -2
- package/dist/chunks/{registry-RG34DPD7.js → registry-K5DV5NAK.js} +2 -2
- package/dist/chunks/{remove-QUH2D3S5.js → remove-BCFTF23J.js} +2 -2
- package/dist/chunks/{repl-STBZC4P2.js → repl-2YWTHUWT.js} +4 -0
- package/dist/chunks/{repl-BPEWARN7.js → repl-ZB3DIJ4K.js} +84 -26
- package/dist/chunks/resolver-QIYYFIDX.js +34 -0
- package/dist/chunks/run-22B65ZWZ.js +29 -0
- package/dist/chunks/rune-SYK4N642.js +425 -0
- package/dist/chunks/{search-MSSDGJTF.js → search-B7IM7JRJ.js} +2 -2
- package/dist/chunks/shell-explain-QLITLHW7.js +74 -0
- package/dist/chunks/{uninstall-G56DZRFG.js → uninstall-4WR5IHLC.js} +15 -11
- package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
- package/dist/chunks/{update-KSC6VRMU.js → update-ACLDK6E6.js} +19 -18
- package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
- package/dist/chunks/{utils-3SJFSUSV.js → utils-B2QULX5J.js} +8 -4
- package/dist/chunks/{version-YG2M7HER.js → version-EULYWNXN.js} +2 -2
- package/dist/cli.js +92 -64
- package/package.json +1 -1
- package/dist/chunks/chunk-ASZKAC24.js +0 -103
- package/dist/chunks/chunk-GSA432UC.js +0 -90
- package/dist/chunks/disable-FGJ7VMPO.js +0 -47
- package/dist/chunks/doctor-7NWBJAH7.js +0 -53
- package/dist/chunks/enable-ZL6QOC2I.js +0 -47
- package/dist/chunks/list-NZ5DHXJF.js +0 -111
- package/dist/chunks/resolver-36V72VKR.js +0 -28
- package/dist/chunks/run-IVL23SMW.js +0 -26
- package/dist/chunks/rune-XRREUL56.js +0 -186
|
@@ -1,20 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath,
|
|
3
|
+
readRawConfig,
|
|
4
|
+
writeRawConfig
|
|
5
|
+
} from "./chunk-X7PZN73N.js";
|
|
6
|
+
import "./chunk-QYRF3R35.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-MIKWIFYR.js";
|
|
1
10
|
import {
|
|
2
11
|
Re,
|
|
3
12
|
fe,
|
|
4
13
|
ge,
|
|
5
14
|
ye
|
|
6
15
|
} from "./chunk-CGZL5SSH.js";
|
|
7
|
-
import {
|
|
8
|
-
output
|
|
9
|
-
} from "./chunk-6XLT25GS.js";
|
|
10
16
|
import "./chunk-WCODTMDN.js";
|
|
17
|
+
import {
|
|
18
|
+
getStorePath
|
|
19
|
+
} from "./chunk-2Q3KLBE6.js";
|
|
11
20
|
import {
|
|
12
21
|
init_require_shim
|
|
13
22
|
} from "./chunk-TPK5AGRA.js";
|
|
14
23
|
|
|
15
24
|
// src/template/commands/create.js
|
|
16
25
|
init_require_shim();
|
|
17
|
-
import { mkdir, writeFile
|
|
26
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
18
27
|
import { join, dirname } from "node:path";
|
|
19
28
|
function templateStub(name) {
|
|
20
29
|
return [
|
|
@@ -53,7 +62,8 @@ async function handler({
|
|
|
53
62
|
description,
|
|
54
63
|
yes = false,
|
|
55
64
|
projectRoot = process.cwd(),
|
|
56
|
-
configRoot = projectRoot
|
|
65
|
+
configRoot = projectRoot,
|
|
66
|
+
global = false
|
|
57
67
|
} = {}) {
|
|
58
68
|
const isNonInteractive = yes || !process.stdout.isTTY;
|
|
59
69
|
if (isNonInteractive) {
|
|
@@ -72,7 +82,7 @@ async function handler({
|
|
|
72
82
|
name = result;
|
|
73
83
|
}
|
|
74
84
|
if (!templateRelPath) {
|
|
75
|
-
const defaultPath = `.crunes/templates/${name}.js`;
|
|
85
|
+
const defaultPath = global ? `templates/${name}.js` : `.crunes/templates/${name}.js`;
|
|
76
86
|
const result = await Re({ message: "File path?", initialValue: defaultPath });
|
|
77
87
|
if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
|
|
78
88
|
ge("Cancelled.");
|
|
@@ -97,26 +107,20 @@ async function handler({
|
|
|
97
107
|
description = result || void 0;
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
|
-
templateRelPath = templateRelPath ?? `.crunes/templates/${name}.js
|
|
101
|
-
const
|
|
110
|
+
templateRelPath = templateRelPath ?? (global ? `templates/${name}.js` : `.crunes/templates/${name}.js`);
|
|
111
|
+
const baseRoot = global ? getStorePath() : configRoot;
|
|
112
|
+
const templateAbsPath = join(baseRoot, templateRelPath);
|
|
102
113
|
await mkdir(dirname(templateAbsPath), { recursive: true });
|
|
103
114
|
await writeFile(templateAbsPath, templateStub(name));
|
|
104
|
-
const configPath =
|
|
105
|
-
|
|
106
|
-
let config = { runes: {} };
|
|
107
|
-
try {
|
|
108
|
-
config = JSON.parse(await readFile(configPath, "utf8"));
|
|
109
|
-
} catch {
|
|
110
|
-
}
|
|
115
|
+
const configPath = getConfigPath({ configRoot, global });
|
|
116
|
+
const config = readRawConfig(configPath) ?? { runes: {} };
|
|
111
117
|
const entry = {
|
|
112
118
|
path: templateRelPath,
|
|
113
119
|
...templateName && { name: templateName },
|
|
114
120
|
...description && { description }
|
|
115
121
|
};
|
|
116
122
|
config.templates = { ...config.templates ?? {}, [name]: entry };
|
|
117
|
-
|
|
118
|
-
await writeFile(tmpPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
119
|
-
await rename(tmpPath, configPath);
|
|
123
|
+
await writeRawConfig(configPath, config);
|
|
120
124
|
if (!isNonInteractive) {
|
|
121
125
|
fe(`Created ${templateRelPath}
|
|
122
126
|
Use it with: crunes template apply ${name}`);
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath,
|
|
3
|
+
readRawConfig,
|
|
4
|
+
writeRawConfig
|
|
5
|
+
} from "./chunk-X7PZN73N.js";
|
|
6
|
+
import "./chunk-QYRF3R35.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-MIKWIFYR.js";
|
|
1
10
|
import {
|
|
2
11
|
Ee,
|
|
3
12
|
Re,
|
|
@@ -5,17 +14,17 @@ import {
|
|
|
5
14
|
ge,
|
|
6
15
|
ye
|
|
7
16
|
} from "./chunk-CGZL5SSH.js";
|
|
8
|
-
import {
|
|
9
|
-
output
|
|
10
|
-
} from "./chunk-6XLT25GS.js";
|
|
11
17
|
import "./chunk-WCODTMDN.js";
|
|
18
|
+
import {
|
|
19
|
+
getStorePath
|
|
20
|
+
} from "./chunk-2Q3KLBE6.js";
|
|
12
21
|
import {
|
|
13
22
|
init_require_shim
|
|
14
23
|
} from "./chunk-TPK5AGRA.js";
|
|
15
24
|
|
|
16
25
|
// src/rune/commands/create.js
|
|
17
26
|
init_require_shim();
|
|
18
|
-
import { mkdir, writeFile
|
|
27
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
19
28
|
import { join, dirname } from "node:path";
|
|
20
29
|
var VALID_FORMATS = ["tree", "markdown"];
|
|
21
30
|
function template(key, format) {
|
|
@@ -70,7 +79,8 @@ async function handler({
|
|
|
70
79
|
description,
|
|
71
80
|
yes = false,
|
|
72
81
|
projectRoot = process.cwd(),
|
|
73
|
-
configRoot = projectRoot
|
|
82
|
+
configRoot = projectRoot,
|
|
83
|
+
global = false
|
|
74
84
|
} = {}) {
|
|
75
85
|
const isNonInteractive = yes || !process.stdout.isTTY;
|
|
76
86
|
if (isNonInteractive) {
|
|
@@ -111,7 +121,7 @@ async function handler({
|
|
|
111
121
|
format = result;
|
|
112
122
|
}
|
|
113
123
|
if (!runeRelPath) {
|
|
114
|
-
const defaultPath = `.crunes/runes/${key}.js`;
|
|
124
|
+
const defaultPath = global ? `runes/${key}.js` : `.crunes/runes/${key}.js`;
|
|
115
125
|
const result = await Re({ message: "File path?", initialValue: defaultPath });
|
|
116
126
|
if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
|
|
117
127
|
ge("Cancelled.");
|
|
@@ -136,26 +146,20 @@ async function handler({
|
|
|
136
146
|
description = result || void 0;
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
|
-
runeRelPath = runeRelPath ?? `.crunes/runes/${key}.js
|
|
140
|
-
const
|
|
149
|
+
runeRelPath = runeRelPath ?? (global ? `runes/${key}.js` : `.crunes/runes/${key}.js`);
|
|
150
|
+
const baseRoot = global ? getStorePath() : configRoot;
|
|
151
|
+
const runeAbsPath = join(baseRoot, runeRelPath);
|
|
141
152
|
await mkdir(dirname(runeAbsPath), { recursive: true });
|
|
142
153
|
await writeFile(runeAbsPath, template(key, format));
|
|
143
|
-
const configPath =
|
|
144
|
-
|
|
145
|
-
let config = { runes: {} };
|
|
146
|
-
try {
|
|
147
|
-
config = JSON.parse(await readFile(configPath, "utf8"));
|
|
148
|
-
} catch {
|
|
149
|
-
}
|
|
154
|
+
const configPath = getConfigPath({ configRoot, global });
|
|
155
|
+
const config = readRawConfig(configPath) ?? { runes: {} };
|
|
150
156
|
const entry = {
|
|
151
157
|
path: runeRelPath,
|
|
152
158
|
...name && { name },
|
|
153
159
|
...description && { description }
|
|
154
160
|
};
|
|
155
161
|
config.runes = { ...config.runes ?? {}, [key]: entry };
|
|
156
|
-
|
|
157
|
-
await writeFile(tmpPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
158
|
-
await rename(tmpPath, configPath);
|
|
162
|
+
await writeRawConfig(configPath, config);
|
|
159
163
|
if (!isNonInteractive) {
|
|
160
164
|
fe(`Created ${runeRelPath}
|
|
161
165
|
Run: crunes run ${key}`);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
output
|
|
3
|
+
} from "./chunk-MIKWIFYR.js";
|
|
1
4
|
import {
|
|
2
5
|
Re,
|
|
3
6
|
fe,
|
|
@@ -5,9 +8,6 @@ import {
|
|
|
5
8
|
le,
|
|
6
9
|
ye
|
|
7
10
|
} from "./chunk-CGZL5SSH.js";
|
|
8
|
-
import {
|
|
9
|
-
output
|
|
10
|
-
} from "./chunk-6XLT25GS.js";
|
|
11
11
|
import "./chunk-WCODTMDN.js";
|
|
12
12
|
import {
|
|
13
13
|
init_require_shim
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteCacheBucket
|
|
3
|
+
} from "./chunk-WJII3LZK.js";
|
|
4
|
+
import "./chunk-G4ZAUHHA.js";
|
|
1
5
|
import {
|
|
2
6
|
R,
|
|
3
7
|
ge,
|
|
4
8
|
le
|
|
5
9
|
} from "./chunk-CGZL5SSH.js";
|
|
6
|
-
import
|
|
7
|
-
deleteCacheBucket
|
|
8
|
-
} from "./chunk-NDEYEYSU.js";
|
|
9
|
-
import "./chunk-G4ZAUHHA.js";
|
|
10
|
-
import "./chunk-6MRZXASS.js";
|
|
10
|
+
import "./chunk-2Q3KLBE6.js";
|
|
11
11
|
import {
|
|
12
12
|
init_require_shim
|
|
13
13
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deleteSchemaCache,
|
|
3
3
|
listSchemaCaches
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UEUUOAJY.js";
|
|
5
5
|
import {
|
|
6
6
|
output
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MIKWIFYR.js";
|
|
8
|
+
import "./chunk-CGZL5SSH.js";
|
|
8
9
|
import "./chunk-WCODTMDN.js";
|
|
10
|
+
import "./chunk-2Q3KLBE6.js";
|
|
9
11
|
import {
|
|
10
12
|
init_require_shim
|
|
11
13
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteSqliteDb
|
|
3
|
+
} from "./chunk-GVMT55GH.js";
|
|
4
|
+
import "./chunk-G4ZAUHHA.js";
|
|
1
5
|
import {
|
|
2
6
|
R,
|
|
3
7
|
ge,
|
|
4
8
|
le
|
|
5
9
|
} from "./chunk-CGZL5SSH.js";
|
|
6
|
-
import
|
|
7
|
-
deleteSqliteDb
|
|
8
|
-
} from "./chunk-J3GZ3DXD.js";
|
|
9
|
-
import "./chunk-G4ZAUHHA.js";
|
|
10
|
-
import "./chunk-6MRZXASS.js";
|
|
10
|
+
import "./chunk-2Q3KLBE6.js";
|
|
11
11
|
import {
|
|
12
12
|
init_require_shim
|
|
13
13
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath,
|
|
3
|
+
setPluginEnabled
|
|
4
|
+
} from "./chunk-X7PZN73N.js";
|
|
5
|
+
import {
|
|
6
|
+
enabledPluginKeys,
|
|
7
|
+
loadConfig
|
|
8
|
+
} from "./chunk-QYRF3R35.js";
|
|
9
|
+
import "./chunk-2Q3KLBE6.js";
|
|
10
|
+
import {
|
|
11
|
+
init_require_shim
|
|
12
|
+
} from "./chunk-TPK5AGRA.js";
|
|
13
|
+
|
|
14
|
+
// src/plugin/commands/disable.js
|
|
15
|
+
init_require_shim();
|
|
16
|
+
function resolveEnabledPluginKey(nameOrKey, enabledPlugins) {
|
|
17
|
+
if (nameOrKey.includes("@")) return nameOrKey;
|
|
18
|
+
const matches = enabledPlugins.filter((k) => k.slice(k.indexOf("@") + 1) === nameOrKey);
|
|
19
|
+
if (matches.length > 1) {
|
|
20
|
+
throw new Error(`Ambiguous plugin "${nameOrKey}". Use the full key: ${matches.join(", ")}`);
|
|
21
|
+
}
|
|
22
|
+
return matches[0] ?? null;
|
|
23
|
+
}
|
|
24
|
+
async function handler({ name, projectRoot, configRoot, global = false }) {
|
|
25
|
+
try {
|
|
26
|
+
const root = configRoot ?? projectRoot;
|
|
27
|
+
const enabled = enabledPluginKeys(loadConfig(root));
|
|
28
|
+
const pluginKey = resolveEnabledPluginKey(name, enabled);
|
|
29
|
+
if (!pluginKey) throw new Error(`Plugin "${name}" is not enabled.`);
|
|
30
|
+
await setPluginEnabled(getConfigPath({ configRoot: root, global }), pluginKey, false);
|
|
31
|
+
console.log(`Plugin "${pluginKey}" disabled${global ? " globally" : " for this project"}.`);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error(`Error: ${err.message}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
handler
|
|
39
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath,
|
|
3
|
+
readRawConfig
|
|
4
|
+
} from "./chunk-X7PZN73N.js";
|
|
5
|
+
import {
|
|
6
|
+
coercePlugins,
|
|
7
|
+
loadConfig
|
|
8
|
+
} from "./chunk-QYRF3R35.js";
|
|
9
|
+
import {
|
|
10
|
+
output
|
|
11
|
+
} from "./chunk-MIKWIFYR.js";
|
|
12
|
+
import "./chunk-CGZL5SSH.js";
|
|
13
|
+
import "./chunk-WCODTMDN.js";
|
|
14
|
+
import "./chunk-2Q3KLBE6.js";
|
|
15
|
+
import {
|
|
16
|
+
init_require_shim
|
|
17
|
+
} from "./chunk-TPK5AGRA.js";
|
|
18
|
+
|
|
19
|
+
// src/cli/commands/doctor.js
|
|
20
|
+
init_require_shim();
|
|
21
|
+
import { spawnSync } from "node:child_process";
|
|
22
|
+
var KNOWN_FORMATS = /* @__PURE__ */ new Set(["1"]);
|
|
23
|
+
function collectLayerWarnings({ global = {}, project = {} } = {}) {
|
|
24
|
+
const warnings = [];
|
|
25
|
+
for (const key of Object.keys(project.runes ?? {})) {
|
|
26
|
+
if (global.runes?.[key]) {
|
|
27
|
+
warnings.push(`rune "${key}" shadows the global rune of the same name`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const globalPlugins = coercePlugins(global.plugins);
|
|
31
|
+
const projectPlugins = coercePlugins(project.plugins);
|
|
32
|
+
for (const [key, enabled] of Object.entries(projectPlugins)) {
|
|
33
|
+
if (globalPlugins[key] === true && enabled === false) {
|
|
34
|
+
warnings.push(`plugin "${key}" is enabled globally but disabled in this project`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return warnings;
|
|
38
|
+
}
|
|
39
|
+
async function handler({ projectRoot = process.cwd() } = {}) {
|
|
40
|
+
let anyFailed = false;
|
|
41
|
+
const major = parseInt(process.versions.node.split(".")[0], 10);
|
|
42
|
+
if (major >= 22) {
|
|
43
|
+
output.success(`Node.js v${process.versions.node}`);
|
|
44
|
+
} else {
|
|
45
|
+
output.error(`Node.js v${process.versions.node} \u2014 requires >= 22`);
|
|
46
|
+
anyFailed = true;
|
|
47
|
+
}
|
|
48
|
+
const versionResult = spawnSync("crunes", ["--version"], { encoding: "utf8", shell: true });
|
|
49
|
+
if (versionResult.status === 0) {
|
|
50
|
+
output.success(`crunes ${versionResult.stdout.trim()} in PATH`);
|
|
51
|
+
} else {
|
|
52
|
+
output.warn("crunes not found globally in PATH (you can still run it locally or via npx)");
|
|
53
|
+
}
|
|
54
|
+
let config;
|
|
55
|
+
try {
|
|
56
|
+
config = loadConfig(projectRoot);
|
|
57
|
+
} catch (err) {
|
|
58
|
+
output.error(`Config: ${err.message}`);
|
|
59
|
+
anyFailed = true;
|
|
60
|
+
}
|
|
61
|
+
if (config) {
|
|
62
|
+
const runeCount = Object.keys(config.runes ?? {}).length;
|
|
63
|
+
if (config.format !== void 0 && !KNOWN_FORMATS.has(String(config.format))) {
|
|
64
|
+
output.error(`Config format "${config.format}" not recognised by this CLI version`);
|
|
65
|
+
anyFailed = true;
|
|
66
|
+
} else {
|
|
67
|
+
output.success(`Config valid \u2014 ${runeCount} rune${runeCount === 1 ? "" : "s"} registered`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const globalPath = getConfigPath({ global: true });
|
|
71
|
+
let globalRaw = null;
|
|
72
|
+
try {
|
|
73
|
+
globalRaw = readRawConfig(globalPath);
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
if (process.env.CRUNES_NO_GLOBAL === "1") {
|
|
77
|
+
output.warn("Global config skipped (CRUNES_NO_GLOBAL=1)");
|
|
78
|
+
} else if (globalRaw) {
|
|
79
|
+
output.success(`Global config found at ${globalPath}`);
|
|
80
|
+
} else {
|
|
81
|
+
output.info(`No global config at ${globalPath}`);
|
|
82
|
+
}
|
|
83
|
+
let projectRaw = null;
|
|
84
|
+
try {
|
|
85
|
+
projectRaw = readRawConfig(getConfigPath({ configRoot: projectRoot }));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
if (!projectRaw) {
|
|
89
|
+
output.info("No project config \u2014 crunes runs rootless here, writing no local state");
|
|
90
|
+
}
|
|
91
|
+
for (const warning of collectLayerWarnings({ global: globalRaw ?? {}, project: projectRaw ?? {} })) {
|
|
92
|
+
output.warn(warning);
|
|
93
|
+
}
|
|
94
|
+
if (anyFailed) {
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
collectLayerWarnings,
|
|
100
|
+
handler
|
|
101
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath,
|
|
3
|
+
setPluginEnabled
|
|
4
|
+
} from "./chunk-X7PZN73N.js";
|
|
5
|
+
import "./chunk-QYRF3R35.js";
|
|
6
|
+
import {
|
|
7
|
+
loadRegistry,
|
|
8
|
+
resolvePluginKey
|
|
9
|
+
} from "./chunk-VST6HAB6.js";
|
|
10
|
+
import "./chunk-2Q3KLBE6.js";
|
|
11
|
+
import {
|
|
12
|
+
init_require_shim
|
|
13
|
+
} from "./chunk-TPK5AGRA.js";
|
|
14
|
+
|
|
15
|
+
// src/plugin/commands/enable.js
|
|
16
|
+
init_require_shim();
|
|
17
|
+
async function handler({ name, projectRoot, configRoot, global = false }) {
|
|
18
|
+
try {
|
|
19
|
+
const registry = await loadRegistry();
|
|
20
|
+
const pluginKey = resolvePluginKey(name, registry);
|
|
21
|
+
if (!pluginKey) throw new Error(`Plugin "${name}" is not installed. Run: crunes plugin list`);
|
|
22
|
+
await setPluginEnabled(getConfigPath({ configRoot: configRoot ?? projectRoot, global }), pluginKey, true);
|
|
23
|
+
console.log(`Plugin "${pluginKey}" enabled${global ? " globally" : ""}.`);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`Error: ${err.message}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
handler
|
|
31
|
+
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getConfigPath
|
|
3
|
+
} from "./chunk-X7PZN73N.js";
|
|
4
|
+
import "./chunk-QYRF3R35.js";
|
|
5
|
+
import {
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-MIKWIFYR.js";
|
|
1
8
|
import {
|
|
2
9
|
fe,
|
|
3
10
|
ge,
|
|
4
11
|
le,
|
|
5
12
|
ye
|
|
6
13
|
} from "./chunk-CGZL5SSH.js";
|
|
7
|
-
import {
|
|
8
|
-
output
|
|
9
|
-
} from "./chunk-6XLT25GS.js";
|
|
10
14
|
import "./chunk-WCODTMDN.js";
|
|
15
|
+
import "./chunk-2Q3KLBE6.js";
|
|
11
16
|
import {
|
|
12
17
|
init_require_shim
|
|
13
18
|
} from "./chunk-TPK5AGRA.js";
|
|
@@ -15,15 +20,16 @@ import {
|
|
|
15
20
|
// src/core/commands/init.js
|
|
16
21
|
init_require_shim();
|
|
17
22
|
import { mkdirSync, writeFileSync, existsSync } from "node:fs";
|
|
18
|
-
import { join } from "node:path";
|
|
23
|
+
import { join, dirname } from "node:path";
|
|
19
24
|
var EMPTY_CONFIG = JSON.stringify({ runes: {} }, null, 2) + "\n";
|
|
20
25
|
var GITIGNORE_CONTENT = "# local overrides (machine-specific, never commit)\nconfig.local.json\nproject.local.json\n\n# run logs\nlogs/\n\n# local caches, databases, schema cache and job logs (gitignored by default)\ncaches/\nschemas/\nsqlite/\njobs/\n";
|
|
21
26
|
async function handler({
|
|
22
27
|
yes = false,
|
|
23
|
-
projectRoot = process.cwd()
|
|
28
|
+
projectRoot = process.cwd(),
|
|
29
|
+
global = false
|
|
24
30
|
} = {}) {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
31
|
+
const configPath = getConfigPath({ configRoot: projectRoot, global });
|
|
32
|
+
const configDir = dirname(configPath);
|
|
27
33
|
const isNonInteractive = yes || !process.stdout.isTTY;
|
|
28
34
|
if (existsSync(configPath)) {
|
|
29
35
|
if (!yes) {
|
|
@@ -45,7 +51,7 @@ async function handler({
|
|
|
45
51
|
mkdirSync(configDir, { recursive: true });
|
|
46
52
|
writeFileSync(configPath, EMPTY_CONFIG);
|
|
47
53
|
const gitignorePath = join(configDir, ".gitignore");
|
|
48
|
-
if (!existsSync(gitignorePath)) {
|
|
54
|
+
if (!global && !existsSync(gitignorePath)) {
|
|
49
55
|
writeFileSync(gitignorePath, GITIGNORE_CONTENT);
|
|
50
56
|
}
|
|
51
57
|
if (!isNonInteractive) {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveFromMarketplace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YVN3VDRE.js";
|
|
4
4
|
import {
|
|
5
5
|
installPlugin
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-34F4ZURL.js";
|
|
7
|
+
import "./chunk-X7PZN73N.js";
|
|
8
|
+
import "./chunk-QYRF3R35.js";
|
|
7
9
|
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
10
|
+
output
|
|
11
|
+
} from "./chunk-MIKWIFYR.js";
|
|
12
|
+
import "./chunk-CGZL5SSH.js";
|
|
13
|
+
import "./chunk-WCODTMDN.js";
|
|
14
|
+
import "./chunk-VST6HAB6.js";
|
|
15
|
+
import "./chunk-2Q3KLBE6.js";
|
|
14
16
|
import "./chunk-G3U4V32O.js";
|
|
15
17
|
import {
|
|
16
18
|
init_require_shim
|
|
@@ -23,34 +25,34 @@ function parseInstallArg(arg) {
|
|
|
23
25
|
if (idx === -1) return null;
|
|
24
26
|
return [arg.slice(0, idx), arg.slice(idx + 1)];
|
|
25
27
|
}
|
|
26
|
-
async function handler({ source, projectRoot, configRoot, yes }) {
|
|
28
|
+
async function handler({ source, projectRoot, configRoot, yes, global = false }) {
|
|
27
29
|
const parts = parseInstallArg(source);
|
|
28
30
|
if (!parts) {
|
|
29
|
-
|
|
31
|
+
output.cancel("Use <marketplace>@<plugin> format (e.g. hello-world@hello-world)");
|
|
30
32
|
process.exit(1);
|
|
31
33
|
}
|
|
32
34
|
const [marketplaceName, pluginName] = parts;
|
|
33
|
-
|
|
35
|
+
output.intro("Installing plugin\u2026");
|
|
34
36
|
let resolvedSource, provenance;
|
|
35
37
|
try {
|
|
36
38
|
;
|
|
37
39
|
({ resolvedSource, ...provenance } = await resolveFromMarketplace(marketplaceName, pluginName));
|
|
38
40
|
} catch (err) {
|
|
39
|
-
|
|
41
|
+
output.cancel(err.message);
|
|
40
42
|
process.exit(1);
|
|
41
43
|
}
|
|
42
44
|
let result;
|
|
43
45
|
try {
|
|
44
|
-
result = await installPlugin(resolvedSource, configRoot ?? projectRoot, provenance, { yes });
|
|
46
|
+
result = await installPlugin(resolvedSource, configRoot ?? projectRoot, provenance, { yes, global });
|
|
45
47
|
} catch (err) {
|
|
46
|
-
|
|
48
|
+
output.cancel(`Installation failed: ${err.message}`);
|
|
47
49
|
process.exit(1);
|
|
48
50
|
}
|
|
49
51
|
if (!result.installed) {
|
|
50
|
-
|
|
52
|
+
output.cancel("Installation cancelled.");
|
|
51
53
|
process.exit(0);
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
output.outro(`Installed ${result.name}@${result.version}`);
|
|
54
56
|
}
|
|
55
57
|
export {
|
|
56
58
|
handler
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
utils_api_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PBGUKXT6.js";
|
|
4
4
|
import {
|
|
5
5
|
globals_api_default
|
|
6
6
|
} from "./chunk-V35LVVNV.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
formatMembers,
|
|
9
9
|
formatNode,
|
|
10
10
|
walk
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-ASZKAC24.js";
|
|
11
|
+
} from "./chunk-I6MHDUCW.js";
|
|
13
12
|
import {
|
|
14
13
|
output
|
|
15
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-MIKWIFYR.js";
|
|
15
|
+
import "./chunk-CGZL5SSH.js";
|
|
16
16
|
import "./chunk-WCODTMDN.js";
|
|
17
17
|
import {
|
|
18
18
|
init_require_shim
|
|
@@ -2519,11 +2519,13 @@ async function compileIntro() {
|
|
|
2519
2519
|
lines.push("");
|
|
2520
2520
|
lines.push("Crunes execute inside an isolated sandbox (`isolated-vm`). Runes are ESM modules with two primary execution modes: **run** (one-shot) and **repl** (interactive session).");
|
|
2521
2521
|
lines.push("");
|
|
2522
|
-
lines.push("Scaffold a new rune with `crunes create`. In non-interactive/agent sessions `--format` is required (no default); `--path` defaults to `.crunes/runes/<key>.js` if omitted:");
|
|
2522
|
+
lines.push("Scaffold a new rune with `crunes create`. In non-interactive/agent sessions `--format` is required (no default); `--path` defaults to `.crunes/runes/<key>.js` if omitted. `-y`/`--yes` is a global flag, so it goes **before** the subcommand:");
|
|
2523
2523
|
lines.push("```bash");
|
|
2524
|
-
lines.push("crunes create my-rune --format markdown
|
|
2524
|
+
lines.push("crunes -y create my-rune --format markdown");
|
|
2525
2525
|
lines.push("```");
|
|
2526
2526
|
lines.push("");
|
|
2527
|
+
lines.push("`crunes create` does not write a `permissions` block. Grants live in `.crunes/config.json` under `runes.<key>.permissions.<lifecycle>.allow` \u2014 not in the rune file \u2014 so add them there once you know what the rune touches (section 3).");
|
|
2528
|
+
lines.push("");
|
|
2527
2529
|
lines.push('**Run mode** \u2014 export `args` to declare a schema and `run` to execute. `--help`/`-h` is NOT intercepted by `crunes run` \u2014 declare it yourself and check it at the top of `run(args)`, as shown below. This example also shows `args(builder)` reading `vars` at schema-build time to compute a dynamic option (`--profile`), a common pattern for anything with a "profile"/"environment" concept:');
|
|
2528
2530
|
lines.push("");
|
|
2529
2531
|
lines.push("```javascript");
|
|
@@ -2668,7 +2670,7 @@ async function compileIntro() {
|
|
|
2668
2670
|
lines.push('To grant a **plugin** rune extra permissions or vars from the project side (plugin runes have no `runes.<key>` entry of their own), add an entry keyed by the fully-qualified `"marketplace@plugin:runeKey"` string \u2014 **this must always be the full form, never the bare plugin name**, since two enabled plugins could share a bare name and a bare-form key can never resolve to anything (config loading rejects a bare-form key outright).');
|
|
2669
2671
|
lines.push("```json");
|
|
2670
2672
|
lines.push("{");
|
|
2671
|
-
lines.push(' "plugins":
|
|
2673
|
+
lines.push(' "plugins": { "my-market@my-plugin": true },');
|
|
2672
2674
|
lines.push(' "runes": {');
|
|
2673
2675
|
lines.push(' "my-market@my-plugin:deploy": {');
|
|
2674
2676
|
lines.push(' "vars": { "region": "us-east-1" },');
|
|
@@ -2695,7 +2697,47 @@ async function compileIntro() {
|
|
|
2695
2697
|
lines.push("");
|
|
2696
2698
|
lines.push("### Config File Fields Reference");
|
|
2697
2699
|
lines.push('- **`runes`**: Definition of project-registered runes, keyed by rune key (or the fully-qualified `"marketplace@plugin:runeKey"` string for a plugin-rune override \u2014 never a bare plugin name). Each entry may declare `path`, `name`, `description`, `vars` (key-value settings read via `utils.vars.read(key)`), `permissions` (lifecycle-scoped allow/deny lists), or `plugin` (an alias to a specific plugin rune, see above).');
|
|
2698
|
-
lines.push(
|
|
2700
|
+
lines.push('- **`plugins`**: Map of plugin key to a boolean, e.g. `{"my-market@my-plugin": true}`. A legacy array of keys is still read and is converted to map form on the next write. `false` is meaningful: it turns a plugin off in this layer even though a lower layer enabled it.');
|
|
2701
|
+
lines.push("- **`templates`**: Definition of registered templates, keyed by template name, merged across layers exactly like `runes`.");
|
|
2702
|
+
lines.push("");
|
|
2703
|
+
lines.push("### Config Layers");
|
|
2704
|
+
lines.push("Configuration merges across three layers, lowest to highest \u2014 later layers win per key:");
|
|
2705
|
+
lines.push("```");
|
|
2706
|
+
lines.push("1. ~/.crunes/config.json (global \u2014 personal, machine-wide)");
|
|
2707
|
+
lines.push("2. <project>/.crunes/config.json");
|
|
2708
|
+
lines.push("3. <project>/.crunes/config.local.json");
|
|
2709
|
+
lines.push("```");
|
|
2710
|
+
lines.push("`~/.crunes` **is** the global config directory, so global paths carry no `.crunes/` segment: a global rune lives at `~/.crunes/runes/<key>.js`, not `~/.crunes/.crunes/runes/<key>.js`. Each layer resolves its own paths before merging, so a project can override one field of a global rune and still load the global file:");
|
|
2711
|
+
lines.push("```json");
|
|
2712
|
+
lines.push("// ~/.crunes/config.json");
|
|
2713
|
+
lines.push('{ "runes": { "serve": { "path": "runes/serve.js", "vars": { "port": 3000 } } } }');
|
|
2714
|
+
lines.push("");
|
|
2715
|
+
lines.push("// <project>/.crunes/config.json \u2014 same rune, different port");
|
|
2716
|
+
lines.push('{ "runes": { "serve": { "vars": { "port": 4000 } } } }');
|
|
2717
|
+
lines.push("```");
|
|
2718
|
+
lines.push('Because `plugins` is a boolean map, a project can also opt out of a globally-enabled plugin \u2014 `crunes plugin disable <name>` writes `{"my-market@my-plugin": false}` into the project config, leaving the global enable intact.');
|
|
2719
|
+
lines.push("");
|
|
2720
|
+
lines.push("`CRUNES_NO_GLOBAL=1` skips the global layer entirely. Set it in CI so a developer's personal config can never alter project behavior.");
|
|
2721
|
+
lines.push("");
|
|
2722
|
+
lines.push("### Rootless Mode");
|
|
2723
|
+
lines.push("In a directory with no `.crunes/config.json`, crunes runs **rootless**: the global layer alone applies, and every piece of local state \u2014 caches, SQLite databases, job logs, schema caches, `node_modules` \u2014 is redirected into the store under `~/.crunes/rootless/<hash-of-cwd>/`. **Nothing is written outside the store.** Running a global rune inside an Obsidian vault or any other directory leaves that directory byte-identical.");
|
|
2724
|
+
lines.push("");
|
|
2725
|
+
lines.push('`@project/` and permission paths still resolve against the current working directory, which is what makes a generic "serve this directory" rune work from anywhere. **This is also the security property to understand:** a permission granted once in the global config applies in every directory you invoke that rune from. Scope global-rune permissions deliberately.');
|
|
2726
|
+
lines.push("");
|
|
2727
|
+
lines.push("Running `crunes init` in such a directory turns it into a project \u2014 the layer simply appears.");
|
|
2728
|
+
lines.push("");
|
|
2729
|
+
lines.push("### Global Commands");
|
|
2730
|
+
lines.push("`-g` / `--global` targets the global config instead of the project:");
|
|
2731
|
+
lines.push("```bash");
|
|
2732
|
+
lines.push("crunes init -g # create ~/.crunes/config.json");
|
|
2733
|
+
lines.push("crunes create -g serve # write ~/.crunes/runes/serve.js and register it");
|
|
2734
|
+
lines.push("crunes plugin install -g mkt@plug # install and enable everywhere");
|
|
2735
|
+
lines.push("crunes plugin enable -g plug");
|
|
2736
|
+
lines.push("crunes plugin disable plug # opt this project out of a global enable");
|
|
2737
|
+
lines.push("crunes plugin disable -g plug # turn it off everywhere");
|
|
2738
|
+
lines.push("crunes template create -g base # ~/.crunes/templates/base.js");
|
|
2739
|
+
lines.push("crunes list -g # global entries only; bare `list` shows the merged set with a Layer column");
|
|
2740
|
+
lines.push("```");
|
|
2699
2741
|
lines.push("");
|
|
2700
2742
|
lines.push("## 4. Rune Exports API Reference");
|
|
2701
2743
|
lines.push("");
|