@darkrymit/crunes-cli 0.5.10 → 0.7.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 +5 -5
- package/dist/chunks/add-OWYVF3IE.js +22 -0
- package/dist/chunks/apply-OMEVXCHC.js +183 -0
- package/dist/chunks/args-32BVYW77.js +42 -0
- package/dist/chunks/benchmark-CLUBISCR.js +164 -0
- package/dist/chunks/browse-COH6IJEX.js +34 -0
- package/dist/chunks/check-BS6TZGRR.js +144 -0
- package/dist/chunks/chunk-2Q24YPGL.js +369 -0
- package/dist/chunks/chunk-3TM6B4E5.js +70 -0
- package/dist/chunks/chunk-67I2J474.js +153 -0
- package/dist/chunks/chunk-6XLT25GS.js +50 -0
- package/dist/chunks/chunk-BVY5LN7X.js +25091 -0
- package/dist/chunks/chunk-CGZL5SSH.js +926 -0
- package/dist/chunks/chunk-DMMC4X27.js +1836 -0
- package/dist/chunks/chunk-G3U4V32O.js +46 -0
- package/dist/chunks/chunk-GHQOK4L7.js +59 -0
- package/dist/chunks/chunk-H3BVJCIL.js +105 -0
- package/dist/chunks/chunk-HMU2J25D.js +63 -0
- package/dist/chunks/chunk-HOH7WZX4.js +95 -0
- package/dist/chunks/chunk-L72BG6DS.js +225 -0
- package/dist/chunks/chunk-NXSDVVTW.js +181 -0
- package/dist/chunks/chunk-QLDB3FO2.js +73059 -0
- package/dist/chunks/chunk-QMWGQXEZ.js +26 -0
- package/dist/chunks/chunk-TPK5AGRA.js +54 -0
- package/dist/chunks/chunk-UGN3FFEF.js +8379 -0
- package/dist/chunks/chunk-WCODTMDN.js +508 -0
- package/dist/chunks/chunk-XIXND2M4.js +296 -0
- package/dist/chunks/chunk-XXUNHQIB.js +129 -0
- package/dist/chunks/chunk-ZXIP4Z5V.js +281 -0
- package/dist/chunks/clear-Y5POLIMF.js +32 -0
- package/dist/chunks/completions-2MSEWWTG.js +232 -0
- package/dist/chunks/create-5FXQYCGM.js +165 -0
- package/dist/chunks/create-I6BNYZ5Q.js +247 -0
- package/dist/chunks/create-O3HMODSL.js +130 -0
- package/dist/chunks/delete-7CQFYIXS.js +40 -0
- package/dist/chunks/delete-UB5SXO5I.js +40 -0
- package/dist/chunks/disable-FCBW7WVG.js +47 -0
- package/dist/chunks/doctor-DS57HDLJ.js +53 -0
- package/dist/chunks/enable-IXRVUXJM.js +47 -0
- package/dist/chunks/esm-7MEWZCHY.js +5162 -0
- package/dist/chunks/globals-YCJ2DGWC.js +60 -0
- package/dist/chunks/init-WGKQVAZE.js +59 -0
- package/dist/chunks/install-BCTBOPBS.js +57 -0
- package/dist/chunks/intro-2UDWF6D4.js +1482 -0
- package/dist/chunks/kill-LWRXZVM5.js +37 -0
- package/dist/chunks/list-5DVVP7HX.js +50 -0
- package/dist/chunks/list-6WL5LGIZ.js +80 -0
- package/dist/chunks/list-NGOCMJXE.js +104 -0
- package/dist/chunks/list-TTKLNJKI.js +28 -0
- package/dist/chunks/list-WUAOSO3M.js +110 -0
- package/dist/chunks/list-YPI7YDKK.js +80 -0
- package/dist/chunks/list-ZBYPMUID.js +23 -0
- package/dist/chunks/manifest-7RVNKBOH.js +9 -0
- package/dist/chunks/output-RJ6JSNY7.js +12 -0
- package/dist/chunks/promise-DUSIQMA2.js +19400 -0
- package/dist/chunks/query-NY4SCO77.js +41 -0
- package/dist/chunks/registry-W5XFI5T6.js +16 -0
- package/dist/chunks/remove-WEAZFZCO.js +22 -0
- package/dist/chunks/run-I6TZX347.js +23 -0
- package/dist/chunks/run-MVIZQVJ6.js +36 -0
- package/dist/chunks/rune-TAX26NH2.js +76 -0
- package/dist/chunks/search-XENXL3GC.js +25 -0
- package/dist/chunks/uninstall-MX5PLGDI.js +49 -0
- package/dist/chunks/unset-KQOZYVTE.js +28 -0
- package/dist/chunks/update-7XDTVFZ3.js +39 -0
- package/dist/chunks/update-IEE54GPY.js +79 -0
- package/dist/chunks/utils-PO3ZK53L.js +50 -0
- package/dist/chunks/version-DIEA5FVV.js +145 -0
- package/dist/cli.js +3360 -125840
- package/package.json +23 -15
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deleteJob,
|
|
3
|
+
listJobs,
|
|
4
|
+
resolveJobId
|
|
5
|
+
} from "./chunk-XXUNHQIB.js";
|
|
6
|
+
import {
|
|
7
|
+
ensureProjectIdentity
|
|
8
|
+
} from "./chunk-3TM6B4E5.js";
|
|
9
|
+
import "./chunk-HMU2J25D.js";
|
|
10
|
+
import {
|
|
11
|
+
init_require_shim
|
|
12
|
+
} from "./chunk-TPK5AGRA.js";
|
|
13
|
+
|
|
14
|
+
// src/job/commands/kill.js
|
|
15
|
+
init_require_shim();
|
|
16
|
+
async function handler({ id, projectDir, global: isGlobal }) {
|
|
17
|
+
const key = isGlobal ? void 0 : (await ensureProjectIdentity(projectDir)).id;
|
|
18
|
+
const jobs = await listJobs(key);
|
|
19
|
+
let resolvedId;
|
|
20
|
+
try {
|
|
21
|
+
resolvedId = resolveJobId(id, jobs);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.error(`Error: ${err.message}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const record = jobs.find((j) => j.id === resolvedId);
|
|
27
|
+
const recordKey = key ?? record.projectKey;
|
|
28
|
+
try {
|
|
29
|
+
process.kill(record.pid, "SIGTERM");
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
await deleteJob(recordKey, record.id);
|
|
33
|
+
console.log(`Sent SIGTERM to job ${record.id.slice(0, 8)} (${record.runeKey ?? "unknown"})`);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
handler
|
|
37
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cleanJobs,
|
|
3
|
+
isAlive,
|
|
4
|
+
listJobs
|
|
5
|
+
} from "./chunk-XXUNHQIB.js";
|
|
6
|
+
import {
|
|
7
|
+
ensureProjectIdentity
|
|
8
|
+
} from "./chunk-3TM6B4E5.js";
|
|
9
|
+
import "./chunk-HMU2J25D.js";
|
|
10
|
+
import {
|
|
11
|
+
init_require_shim
|
|
12
|
+
} from "./chunk-TPK5AGRA.js";
|
|
13
|
+
|
|
14
|
+
// src/job/commands/list.js
|
|
15
|
+
init_require_shim();
|
|
16
|
+
function pad(str, len) {
|
|
17
|
+
return String(str ?? "-").padEnd(len);
|
|
18
|
+
}
|
|
19
|
+
async function handler({ projectDir, global: isGlobal }) {
|
|
20
|
+
const key = isGlobal ? void 0 : (await ensureProjectIdentity(projectDir)).id;
|
|
21
|
+
await cleanJobs(key);
|
|
22
|
+
const jobs = await listJobs(key);
|
|
23
|
+
if (jobs.length === 0) {
|
|
24
|
+
console.log("No background jobs.");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const header = isGlobal ? ["PROJECT", "ID", "RUNE", "SPAWNED BY", "STATUS", "STARTED"] : ["ID", "RUNE", "SPAWNED BY", "STATUS", "STARTED"];
|
|
28
|
+
const rows = jobs.map((r) => {
|
|
29
|
+
const row = [
|
|
30
|
+
r.id.slice(0, 8),
|
|
31
|
+
r.runeKey ?? "-",
|
|
32
|
+
r.spawnedBy ?? "-",
|
|
33
|
+
isAlive(r.pid) ? "alive" : "dead",
|
|
34
|
+
new Date(r.startedAt).toLocaleString()
|
|
35
|
+
];
|
|
36
|
+
if (isGlobal) row.unshift(r.projectDir ?? "-");
|
|
37
|
+
return row;
|
|
38
|
+
});
|
|
39
|
+
const widths = header.map(
|
|
40
|
+
(h, i) => Math.max(h.length, ...rows.map((r) => String(r[i] ?? "").length))
|
|
41
|
+
);
|
|
42
|
+
console.log(header.map((h, i) => pad(h, widths[i])).join(" "));
|
|
43
|
+
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
44
|
+
for (const row of rows) {
|
|
45
|
+
console.log(row.map((cell, i) => pad(cell, widths[i])).join(" "));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
handler
|
|
50
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listLocalSqliteDbs,
|
|
3
|
+
listSqliteDbs
|
|
4
|
+
} from "./chunk-67I2J474.js";
|
|
5
|
+
import "./chunk-QMWGQXEZ.js";
|
|
6
|
+
import {
|
|
7
|
+
ensureProjectIdentity,
|
|
8
|
+
loadProjects
|
|
9
|
+
} from "./chunk-3TM6B4E5.js";
|
|
10
|
+
import "./chunk-HMU2J25D.js";
|
|
11
|
+
import {
|
|
12
|
+
init_require_shim
|
|
13
|
+
} from "./chunk-TPK5AGRA.js";
|
|
14
|
+
|
|
15
|
+
// src/sqlite/commands/list.js
|
|
16
|
+
init_require_shim();
|
|
17
|
+
function pad(s, n) {
|
|
18
|
+
return String(s ?? "-").padEnd(n);
|
|
19
|
+
}
|
|
20
|
+
function applyPluginFilter(dbs, plugin) {
|
|
21
|
+
if (plugin === void 0) return dbs;
|
|
22
|
+
const pluginScopes = /* @__PURE__ */ new Set(["global-plugin", "global-project-plugin", "local-project-plugin"]);
|
|
23
|
+
if (plugin === true) {
|
|
24
|
+
return dbs.filter((d) => pluginScopes.has(d.scope));
|
|
25
|
+
}
|
|
26
|
+
return dbs.filter((d) => pluginScopes.has(d.scope) && d.pluginId === plugin);
|
|
27
|
+
}
|
|
28
|
+
async function handler({ projectDir, global: isGlobal, plugin }) {
|
|
29
|
+
let dbs;
|
|
30
|
+
if (isGlobal) {
|
|
31
|
+
dbs = await listSqliteDbs();
|
|
32
|
+
} else {
|
|
33
|
+
const { id: projectId } = await ensureProjectIdentity(projectDir);
|
|
34
|
+
const [local, global] = await Promise.all([
|
|
35
|
+
listLocalSqliteDbs(projectDir),
|
|
36
|
+
listSqliteDbs(projectId)
|
|
37
|
+
]);
|
|
38
|
+
dbs = [...local, ...global];
|
|
39
|
+
}
|
|
40
|
+
dbs = applyPluginFilter(dbs, plugin);
|
|
41
|
+
let projectAliases = {};
|
|
42
|
+
if (isGlobal) {
|
|
43
|
+
const { projects } = await loadProjects();
|
|
44
|
+
for (const [id, entry] of Object.entries(projects)) {
|
|
45
|
+
projectAliases[id] = typeof entry === "object" ? entry.alias ?? entry.path : entry;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (dbs.length === 0) {
|
|
49
|
+
console.log("No SQLite databases.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
function projectPlugin(entry) {
|
|
53
|
+
if (entry.scope === "global-project" || entry.scope === "local-project") {
|
|
54
|
+
return projectAliases[entry.projectKey] ?? entry.projectKey ?? "-";
|
|
55
|
+
}
|
|
56
|
+
if (entry.scope === "global-plugin") return entry.pluginId ?? "-";
|
|
57
|
+
if (entry.scope === "global-project-plugin" || entry.scope === "local-project-plugin") {
|
|
58
|
+
const proj = projectAliases[entry.projectKey] ?? entry.projectKey;
|
|
59
|
+
return `${proj}/${entry.pluginId}`;
|
|
60
|
+
}
|
|
61
|
+
return "-";
|
|
62
|
+
}
|
|
63
|
+
const cols = ["KEY", "NAME", "SCOPE", "PROJECT/PLUGIN", "FIRST SEEN"];
|
|
64
|
+
const rows = dbs.map((d) => [
|
|
65
|
+
d.key,
|
|
66
|
+
d.name,
|
|
67
|
+
d.scope,
|
|
68
|
+
projectPlugin(d),
|
|
69
|
+
d.firstSeenAt ? new Date(d.firstSeenAt).toLocaleString() : "-"
|
|
70
|
+
]);
|
|
71
|
+
const widths = cols.map((c, i) => Math.max(c.length, ...rows.map((r) => String(r[i] ?? "").length)));
|
|
72
|
+
console.log(cols.map((c, i) => pad(c, widths[i])).join(" "));
|
|
73
|
+
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
74
|
+
for (const row of rows) {
|
|
75
|
+
console.log(row.map((cell, i) => pad(cell, widths[i])).join(" "));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
handler
|
|
80
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_cli_table3
|
|
3
|
+
} from "./chunk-DMMC4X27.js";
|
|
4
|
+
import {
|
|
5
|
+
loadConfig
|
|
6
|
+
} from "./chunk-H3BVJCIL.js";
|
|
7
|
+
import {
|
|
8
|
+
output
|
|
9
|
+
} from "./chunk-6XLT25GS.js";
|
|
10
|
+
import "./chunk-WCODTMDN.js";
|
|
11
|
+
import {
|
|
12
|
+
loadRegistry
|
|
13
|
+
} from "./chunk-GHQOK4L7.js";
|
|
14
|
+
import "./chunk-HMU2J25D.js";
|
|
15
|
+
import {
|
|
16
|
+
loadPluginJson
|
|
17
|
+
} from "./chunk-G3U4V32O.js";
|
|
18
|
+
import {
|
|
19
|
+
__toESM,
|
|
20
|
+
init_require_shim
|
|
21
|
+
} from "./chunk-TPK5AGRA.js";
|
|
22
|
+
|
|
23
|
+
// src/template/commands/list.js
|
|
24
|
+
init_require_shim();
|
|
25
|
+
var import_cli_table3 = __toESM(require_cli_table3(), 1);
|
|
26
|
+
async function handler({
|
|
27
|
+
source,
|
|
28
|
+
format = "md",
|
|
29
|
+
plain = false,
|
|
30
|
+
projectRoot = process.cwd()
|
|
31
|
+
} = {}) {
|
|
32
|
+
const results = [];
|
|
33
|
+
if (!source || source === "project") {
|
|
34
|
+
let config = { templates: {} };
|
|
35
|
+
try {
|
|
36
|
+
config = loadConfig(projectRoot);
|
|
37
|
+
} catch {
|
|
38
|
+
}
|
|
39
|
+
const templates = config.templates ?? {};
|
|
40
|
+
for (const [name, entry] of Object.entries(templates)) {
|
|
41
|
+
if (typeof entry === "string") {
|
|
42
|
+
results.push({ source: "project", template: name, name, description: "" });
|
|
43
|
+
} else if (entry.path) {
|
|
44
|
+
results.push({ source: "project", template: name, name: entry.name ?? name, description: entry.description ?? "" });
|
|
45
|
+
} else if (entry.plugin) {
|
|
46
|
+
results.push({ source: "project", template: name, name: entry.name ?? name, description: entry.description ?? "", plugin: entry.plugin });
|
|
47
|
+
} else {
|
|
48
|
+
results.push({ source: "project", template: name, name: entry.name ?? name, description: entry.description ?? "" });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (!source || source !== "project") {
|
|
53
|
+
const registry = await loadRegistry();
|
|
54
|
+
if (source && source !== "project") {
|
|
55
|
+
const found = Object.keys(registry.plugins ?? {}).some((k) => k === source || k.slice(k.indexOf("@") + 1) === source);
|
|
56
|
+
if (!found) {
|
|
57
|
+
output.error(`Plugin "${source}" is not installed.`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const [pluginKey, pluginEntry] of Object.entries(registry.plugins ?? {})) {
|
|
62
|
+
const pluginName = pluginKey.slice(pluginKey.indexOf("@") + 1);
|
|
63
|
+
if (source && source !== pluginName && source !== pluginKey) continue;
|
|
64
|
+
if (!pluginEntry.path) continue;
|
|
65
|
+
let pluginJson;
|
|
66
|
+
try {
|
|
67
|
+
pluginJson = await loadPluginJson(pluginEntry.path);
|
|
68
|
+
} catch {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const templates = pluginJson.templates ?? {};
|
|
72
|
+
for (const [name, meta] of Object.entries(templates)) {
|
|
73
|
+
results.push({ source: pluginName, template: name, name: meta.name ?? name, description: meta.description ?? "" });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (results.length === 0) {
|
|
78
|
+
output.info("No templates found. Add local ones with: crunes template create");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (format === "json") {
|
|
82
|
+
process.stdout.write(JSON.stringify(results, null, 2) + "\n");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (plain) {
|
|
86
|
+
for (const { source: src, template, description } of results) {
|
|
87
|
+
process.stdout.write(`${src} ${template} ${description}
|
|
88
|
+
`);
|
|
89
|
+
}
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const table = new import_cli_table3.default({
|
|
93
|
+
head: ["Source", "Template", "Description"],
|
|
94
|
+
style: { head: ["cyan"] }
|
|
95
|
+
});
|
|
96
|
+
for (const { source: src, template, description, plugin } of results) {
|
|
97
|
+
const desc = plugin ? `${description} [\u2192 ${plugin}]`.trim() : description;
|
|
98
|
+
table.push([src, template, desc]);
|
|
99
|
+
}
|
|
100
|
+
process.stdout.write(table.toString() + "\n");
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
handler
|
|
104
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadRegistry
|
|
3
|
+
} from "./chunk-GHQOK4L7.js";
|
|
4
|
+
import "./chunk-HMU2J25D.js";
|
|
5
|
+
import {
|
|
6
|
+
init_require_shim
|
|
7
|
+
} from "./chunk-TPK5AGRA.js";
|
|
8
|
+
|
|
9
|
+
// src/plugin/commands/list.js
|
|
10
|
+
init_require_shim();
|
|
11
|
+
async function handler({ format = "md" }) {
|
|
12
|
+
const registry = await loadRegistry();
|
|
13
|
+
const plugins = Object.entries(registry.plugins ?? {});
|
|
14
|
+
if (plugins.length === 0) {
|
|
15
|
+
console.log("No plugins installed.");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (format === "json") {
|
|
19
|
+
console.log(JSON.stringify(registry.plugins, null, 2));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const [key, entry] of plugins) {
|
|
23
|
+
console.log(`${key} v${entry.version}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
handler
|
|
28
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_cli_table3
|
|
3
|
+
} from "./chunk-DMMC4X27.js";
|
|
4
|
+
import {
|
|
5
|
+
getRune
|
|
6
|
+
} from "./chunk-QLDB3FO2.js";
|
|
7
|
+
import "./chunk-67I2J474.js";
|
|
8
|
+
import "./chunk-XXUNHQIB.js";
|
|
9
|
+
import "./chunk-NXSDVVTW.js";
|
|
10
|
+
import "./chunk-QMWGQXEZ.js";
|
|
11
|
+
import "./chunk-3TM6B4E5.js";
|
|
12
|
+
import {
|
|
13
|
+
loadConfig
|
|
14
|
+
} from "./chunk-H3BVJCIL.js";
|
|
15
|
+
import {
|
|
16
|
+
output
|
|
17
|
+
} from "./chunk-6XLT25GS.js";
|
|
18
|
+
import "./chunk-WCODTMDN.js";
|
|
19
|
+
import "./chunk-GHQOK4L7.js";
|
|
20
|
+
import "./chunk-HMU2J25D.js";
|
|
21
|
+
import "./chunk-G3U4V32O.js";
|
|
22
|
+
import {
|
|
23
|
+
__toESM,
|
|
24
|
+
init_require_shim
|
|
25
|
+
} from "./chunk-TPK5AGRA.js";
|
|
26
|
+
|
|
27
|
+
// src/rune/commands/list.js
|
|
28
|
+
init_require_shim();
|
|
29
|
+
var import_cli_table3 = __toESM(require_cli_table3(), 1);
|
|
30
|
+
async function handler({
|
|
31
|
+
format = "md",
|
|
32
|
+
plain = false,
|
|
33
|
+
projectRoot = process.cwd(),
|
|
34
|
+
configRoot = projectRoot
|
|
35
|
+
} = {}) {
|
|
36
|
+
let config;
|
|
37
|
+
try {
|
|
38
|
+
config = loadConfig(configRoot);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
output.error(`Config unreadable: ${err.message}`);
|
|
41
|
+
output.info("Run `crunes init` to create a config file.");
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const runes = config.runes ?? {};
|
|
45
|
+
const keys = Object.keys(runes);
|
|
46
|
+
const entries = [];
|
|
47
|
+
for (const key of keys) {
|
|
48
|
+
const entry = getRune(config, key);
|
|
49
|
+
const source = entry.plugin ? `\u2192 ${entry.plugin}` : entry.path ?? "";
|
|
50
|
+
entries.push({ key, source, name: entry.name ?? null, description: entry.description ?? null });
|
|
51
|
+
}
|
|
52
|
+
const enabledPlugins = config.plugins ?? [];
|
|
53
|
+
if (enabledPlugins.length > 0) {
|
|
54
|
+
try {
|
|
55
|
+
const { loadRegistry } = await import("./registry-W5XFI5T6.js");
|
|
56
|
+
const { loadPluginJson } = await import("./manifest-7RVNKBOH.js");
|
|
57
|
+
const registry = await loadRegistry();
|
|
58
|
+
for (const pluginKey of enabledPlugins) {
|
|
59
|
+
const entry = registry.plugins?.[pluginKey];
|
|
60
|
+
if (!entry) continue;
|
|
61
|
+
let pluginJson;
|
|
62
|
+
try {
|
|
63
|
+
pluginJson = await loadPluginJson(entry.path);
|
|
64
|
+
} catch {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
for (const [runeKey, runeEntry] of Object.entries(pluginJson.runes ?? {})) {
|
|
68
|
+
const idx = pluginKey.indexOf("@");
|
|
69
|
+
const shortName = idx !== -1 ? pluginKey.slice(idx + 1) : pluginKey;
|
|
70
|
+
const displayKey = `${shortName}:${runeKey}`;
|
|
71
|
+
if (!entries.some((e) => e.key === displayKey)) {
|
|
72
|
+
entries.push({
|
|
73
|
+
key: displayKey,
|
|
74
|
+
source: `plugin: ${pluginKey}`,
|
|
75
|
+
name: runeEntry.name ?? null,
|
|
76
|
+
description: runeEntry.description ?? null
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (entries.length === 0) {
|
|
85
|
+
process.stdout.write("No runes configured. Run `crunes create <key>` to add one.\n");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (format === "json") {
|
|
89
|
+
process.stdout.write(JSON.stringify(entries, null, 2) + "\n");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (plain) {
|
|
93
|
+
for (const { key, name, description, source } of entries) {
|
|
94
|
+
process.stdout.write(`${key} ${name ?? ""} ${description ?? ""} ${source}
|
|
95
|
+
`);
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const table = new import_cli_table3.default({
|
|
100
|
+
head: ["Key", "Name", "Description", "Source"],
|
|
101
|
+
style: { head: ["cyan"] }
|
|
102
|
+
});
|
|
103
|
+
for (const { key, name, description, source } of entries) {
|
|
104
|
+
table.push([key, name ?? "", description ?? "", source]);
|
|
105
|
+
}
|
|
106
|
+
process.stdout.write(table.toString() + "\n");
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
handler
|
|
110
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listCacheBuckets,
|
|
3
|
+
listLocalCacheBuckets
|
|
4
|
+
} from "./chunk-NXSDVVTW.js";
|
|
5
|
+
import "./chunk-QMWGQXEZ.js";
|
|
6
|
+
import {
|
|
7
|
+
ensureProjectIdentity,
|
|
8
|
+
loadProjects
|
|
9
|
+
} from "./chunk-3TM6B4E5.js";
|
|
10
|
+
import "./chunk-HMU2J25D.js";
|
|
11
|
+
import {
|
|
12
|
+
init_require_shim
|
|
13
|
+
} from "./chunk-TPK5AGRA.js";
|
|
14
|
+
|
|
15
|
+
// src/cache/commands/list.js
|
|
16
|
+
init_require_shim();
|
|
17
|
+
function pad(s, n) {
|
|
18
|
+
return String(s ?? "-").padEnd(n);
|
|
19
|
+
}
|
|
20
|
+
function applyPluginFilter(buckets, plugin) {
|
|
21
|
+
if (plugin === void 0) return buckets;
|
|
22
|
+
const pluginScopes = /* @__PURE__ */ new Set(["global-plugin", "global-project-plugin", "local-project-plugin"]);
|
|
23
|
+
if (plugin === true) {
|
|
24
|
+
return buckets.filter((b) => pluginScopes.has(b.scope));
|
|
25
|
+
}
|
|
26
|
+
return buckets.filter((b) => pluginScopes.has(b.scope) && b.pluginId === plugin);
|
|
27
|
+
}
|
|
28
|
+
async function handler({ projectDir, global: isGlobal, plugin }) {
|
|
29
|
+
let buckets;
|
|
30
|
+
if (isGlobal) {
|
|
31
|
+
buckets = await listCacheBuckets();
|
|
32
|
+
} else {
|
|
33
|
+
const { id: projectId } = await ensureProjectIdentity(projectDir);
|
|
34
|
+
const [local, global] = await Promise.all([
|
|
35
|
+
listLocalCacheBuckets(projectDir),
|
|
36
|
+
listCacheBuckets(projectId)
|
|
37
|
+
]);
|
|
38
|
+
buckets = [...local, ...global];
|
|
39
|
+
}
|
|
40
|
+
buckets = applyPluginFilter(buckets, plugin);
|
|
41
|
+
let projectAliases = {};
|
|
42
|
+
if (isGlobal) {
|
|
43
|
+
const { projects } = await loadProjects();
|
|
44
|
+
for (const [id, entry] of Object.entries(projects)) {
|
|
45
|
+
projectAliases[id] = typeof entry === "object" ? entry.alias ?? entry.path : entry;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (buckets.length === 0) {
|
|
49
|
+
console.log("No cache buckets.");
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
function projectPlugin(entry) {
|
|
53
|
+
if (entry.scope === "global-project" || entry.scope === "local-project") {
|
|
54
|
+
return projectAliases[entry.projectKey] ?? entry.projectKey ?? "-";
|
|
55
|
+
}
|
|
56
|
+
if (entry.scope === "global-plugin") return entry.pluginId ?? "-";
|
|
57
|
+
if (entry.scope === "global-project-plugin" || entry.scope === "local-project-plugin") {
|
|
58
|
+
const proj = projectAliases[entry.projectKey] ?? entry.projectKey;
|
|
59
|
+
return `${proj}/${entry.pluginId}`;
|
|
60
|
+
}
|
|
61
|
+
return "-";
|
|
62
|
+
}
|
|
63
|
+
const cols = ["KEY", "NAME", "SCOPE", "PROJECT/PLUGIN", "FIRST SEEN"];
|
|
64
|
+
const rows = buckets.map((b) => [
|
|
65
|
+
b.key,
|
|
66
|
+
b.name,
|
|
67
|
+
b.scope,
|
|
68
|
+
projectPlugin(b),
|
|
69
|
+
b.firstSeenAt ? new Date(b.firstSeenAt).toLocaleString() : "-"
|
|
70
|
+
]);
|
|
71
|
+
const widths = cols.map((c, i) => Math.max(c.length, ...rows.map((r) => String(r[i] ?? "").length)));
|
|
72
|
+
console.log(cols.map((c, i) => pad(c, widths[i])).join(" "));
|
|
73
|
+
console.log(widths.map((w) => "-".repeat(w)).join(" "));
|
|
74
|
+
for (const row of rows) {
|
|
75
|
+
console.log(row.map((cell, i) => pad(cell, widths[i])).join(" "));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
handler
|
|
80
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listMarketplaces
|
|
3
|
+
} from "./chunk-L72BG6DS.js";
|
|
4
|
+
import "./chunk-HMU2J25D.js";
|
|
5
|
+
import {
|
|
6
|
+
init_require_shim
|
|
7
|
+
} from "./chunk-TPK5AGRA.js";
|
|
8
|
+
|
|
9
|
+
// src/marketplace/commands/list.js
|
|
10
|
+
init_require_shim();
|
|
11
|
+
async function handler() {
|
|
12
|
+
const sources = await listMarketplaces();
|
|
13
|
+
if (sources.length === 0) {
|
|
14
|
+
console.log("No marketplace sources configured.");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
for (const { source, name } of sources) {
|
|
18
|
+
console.log(name ? `${name} ${source}` : source);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
handler
|
|
23
|
+
};
|