@darkrymit/crunes-cli 0.8.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
- package/dist/chunks/{apply-YC6JEPUN.js → apply-YY7MIM64.js} +13 -12
- package/dist/chunks/{benchmark-BJEAAFWG.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-2PBPDTRD.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-NAEVMRNA.js → chunk-PBGUKXT6.js} +2940 -1847
- package/dist/chunks/chunk-QYRF3R35.js +154 -0
- package/dist/chunks/{chunk-DZJRYFOP.js → chunk-SNC7AOT7.js} +78 -12
- package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
- package/dist/chunks/{chunk-65J65MAP.js → chunk-VST6HAB6.js} +16 -2
- 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-JU6FKUBY.js → chunk-YXCHIMLW.js} +995 -3097
- 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-OZACMPEU.js → create-LM7U3CJS.js} +28 -20
- package/dist/chunks/{create-ZFFV3Z2P.js → create-TLPM7HJE.js} +5 -5
- 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-RRLUOYFO.js → install-4YP7FALO.js} +18 -16
- package/dist/chunks/{intro-4CICBP2J.js → intro-SA7MWV3Z.js} +113 -43
- 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-FLAYJQKN.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-CK5X2YN3.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-3QIL5SVL.js → registry-K5DV5NAK.js} +4 -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-VGC5FUJG.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-55YTHZRH.js → uninstall-4WR5IHLC.js} +15 -11
- package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
- package/dist/chunks/{update-G6XO4RIM.js → update-ACLDK6E6.js} +19 -18
- package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
- package/dist/chunks/{utils-XOWJQWNR.js → utils-B2QULX5J.js} +8 -4
- package/dist/chunks/{version-PW7MHDFH.js → version-EULYWNXN.js} +3 -2
- package/dist/cli.js +93 -71
- package/package.json +2 -1
- package/dist/chunks/chunk-ASZKAC24.js +0 -103
- package/dist/chunks/chunk-H3BVJCIL.js +0 -105
- package/dist/chunks/disable-TMG2K3BF.js +0 -47
- package/dist/chunks/doctor-N43QEMAH.js +0 -53
- package/dist/chunks/enable-327OMBPC.js +0 -47
- package/dist/chunks/list-WH7KESMV.js +0 -111
- package/dist/chunks/resolver-QMIY33FM.js +0 -26
- package/dist/chunks/run-T33CMCFZ.js +0 -26
- package/dist/chunks/rune-UBRVWG5A.js +0 -139
|
@@ -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) {
|
|
@@ -78,10 +88,14 @@ async function handler({
|
|
|
78
88
|
output.error("Missing required argument: <key>");
|
|
79
89
|
process.exit(1);
|
|
80
90
|
}
|
|
81
|
-
if (
|
|
82
|
-
output.error(`
|
|
91
|
+
if (format && !VALID_FORMATS.includes(format)) {
|
|
92
|
+
output.error(`Invalid --format. Must be one of: ${VALID_FORMATS.join(", ")}`);
|
|
83
93
|
process.exit(1);
|
|
84
94
|
}
|
|
95
|
+
if (!format) {
|
|
96
|
+
format = "markdown";
|
|
97
|
+
output.info('--format not specified, defaulting to "markdown"');
|
|
98
|
+
}
|
|
85
99
|
} else {
|
|
86
100
|
ye("crunes create");
|
|
87
101
|
if (!key) {
|
|
@@ -107,7 +121,7 @@ async function handler({
|
|
|
107
121
|
format = result;
|
|
108
122
|
}
|
|
109
123
|
if (!runeRelPath) {
|
|
110
|
-
const defaultPath = `.crunes/runes/${key}.js`;
|
|
124
|
+
const defaultPath = global ? `runes/${key}.js` : `.crunes/runes/${key}.js`;
|
|
111
125
|
const result = await Re({ message: "File path?", initialValue: defaultPath });
|
|
112
126
|
if (result === /* @__PURE__ */ Symbol.for("clack:cancel")) {
|
|
113
127
|
ge("Cancelled.");
|
|
@@ -132,26 +146,20 @@ async function handler({
|
|
|
132
146
|
description = result || void 0;
|
|
133
147
|
}
|
|
134
148
|
}
|
|
135
|
-
runeRelPath = runeRelPath ?? `.crunes/runes/${key}.js
|
|
136
|
-
const
|
|
149
|
+
runeRelPath = runeRelPath ?? (global ? `runes/${key}.js` : `.crunes/runes/${key}.js`);
|
|
150
|
+
const baseRoot = global ? getStorePath() : configRoot;
|
|
151
|
+
const runeAbsPath = join(baseRoot, runeRelPath);
|
|
137
152
|
await mkdir(dirname(runeAbsPath), { recursive: true });
|
|
138
153
|
await writeFile(runeAbsPath, template(key, format));
|
|
139
|
-
const configPath =
|
|
140
|
-
|
|
141
|
-
let config = { runes: {} };
|
|
142
|
-
try {
|
|
143
|
-
config = JSON.parse(await readFile(configPath, "utf8"));
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
154
|
+
const configPath = getConfigPath({ configRoot, global });
|
|
155
|
+
const config = readRawConfig(configPath) ?? { runes: {} };
|
|
146
156
|
const entry = {
|
|
147
157
|
path: runeRelPath,
|
|
148
158
|
...name && { name },
|
|
149
159
|
...description && { description }
|
|
150
160
|
};
|
|
151
161
|
config.runes = { ...config.runes ?? {}, [key]: entry };
|
|
152
|
-
|
|
153
|
-
await writeFile(tmpPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
154
|
-
await rename(tmpPath, configPath);
|
|
162
|
+
await writeRawConfig(configPath, config);
|
|
155
163
|
if (!isNonInteractive) {
|
|
156
164
|
fe(`Created ${runeRelPath}
|
|
157
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
|
|
@@ -155,8 +155,8 @@ async function handler({
|
|
|
155
155
|
process.exit(1);
|
|
156
156
|
}
|
|
157
157
|
if (!description) {
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
description = `${name} \u2014 a crunes plugin`;
|
|
159
|
+
output.info(`--description not specified, defaulting to "${description}"`);
|
|
160
160
|
}
|
|
161
161
|
author = author ?? getGitAuthor();
|
|
162
162
|
license = license ?? "MIT";
|
|
@@ -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
|