@darkrymit/crunes-cli 0.7.1 → 0.8.1

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.
Files changed (75) hide show
  1. package/README.md +5 -4
  2. package/dist/chunks/{add-OWYVF3IE.js → add-CBHWFGCA.js} +2 -2
  3. package/dist/chunks/{apply-OMEVXCHC.js → apply-YC6JEPUN.js} +6 -5
  4. package/dist/chunks/args-repl-TX3YWUOO.js +81 -0
  5. package/dist/chunks/banner-repl-DD22Z33A.js +52 -0
  6. package/dist/chunks/benchmark-BJEAAFWG.js +234 -0
  7. package/dist/chunks/{browse-COH6IJEX.js → browse-JZFU52ET.js} +2 -2
  8. package/dist/chunks/{chunk-2Q24YPGL.js → chunk-2PBPDTRD.js} +2 -2
  9. package/dist/chunks/chunk-63H5VXZY.js +101 -0
  10. package/dist/chunks/{chunk-GHQOK4L7.js → chunk-65J65MAP.js} +1 -1
  11. package/dist/chunks/{chunk-HMU2J25D.js → chunk-6MRZXASS.js} +3 -3
  12. package/dist/chunks/{chunk-HOH7WZX4.js → chunk-ASZKAC24.js} +9 -1
  13. package/dist/chunks/{chunk-AIEWOUXT.js → chunk-DZJRYFOP.js} +104 -41
  14. package/dist/chunks/{chunk-QMWGQXEZ.js → chunk-G4ZAUHHA.js} +2 -4
  15. package/dist/chunks/{chunk-67I2J474.js → chunk-J3GZ3DXD.js} +14 -55
  16. package/dist/chunks/{chunk-XIXND2M4.js → chunk-JOAL437H.js} +5 -1
  17. package/dist/chunks/{chunk-6I7RHSAA.js → chunk-JU6FKUBY.js} +30394 -26055
  18. package/dist/chunks/{chunk-BVY5LN7X.js → chunk-NAEVMRNA.js} +22031 -13350
  19. package/dist/chunks/{chunk-NXSDVVTW.js → chunk-NDEYEYSU.js} +22 -69
  20. package/dist/chunks/{chunk-L72BG6DS.js → chunk-NYLRTAAA.js} +1 -1
  21. package/dist/chunks/{chunk-UGN3FFEF.js → chunk-V35LVVNV.js} +5113 -2117
  22. package/dist/chunks/chunk-ZJDKCC2Y.js +105 -0
  23. package/dist/chunks/{clear-Y5POLIMF.js → clear-YBDIPEEH.js} +5 -9
  24. package/dist/chunks/commands-repl-IPLJ4M7X.js +65 -0
  25. package/dist/chunks/complete-input-repl-IDSCMRYL.js +71 -0
  26. package/dist/chunks/{create-I6BNYZ5Q.js → create-ZFFV3Z2P.js} +2 -1
  27. package/dist/chunks/{delete-UB5SXO5I.js → delete-C4UJ7X5K.js} +5 -9
  28. package/dist/chunks/delete-E4TEBRPX.js +27 -0
  29. package/dist/chunks/{delete-7CQFYIXS.js → delete-LNOYM5KG.js} +5 -9
  30. package/dist/chunks/{disable-FCBW7WVG.js → disable-TMG2K3BF.js} +6 -6
  31. package/dist/chunks/{doctor-DS57HDLJ.js → doctor-N43QEMAH.js} +2 -2
  32. package/dist/chunks/{enable-IXRVUXJM.js → enable-327OMBPC.js} +6 -6
  33. package/dist/chunks/{globals-YCJ2DGWC.js → globals-H2WF344Y.js} +2 -2
  34. package/dist/chunks/{init-WGKQVAZE.js → init-HU5OMHEH.js} +1 -1
  35. package/dist/chunks/input-repl-ZBH6FVPV.js +87 -0
  36. package/dist/chunks/{install-BCTBOPBS.js → install-RRLUOYFO.js} +6 -6
  37. package/dist/chunks/intro-4CICBP2J.js +2727 -0
  38. package/dist/chunks/{kill-LWRXZVM5.js → kill-2UG7PHUV.js} +4 -10
  39. package/dist/chunks/list-4X3JFQGS.js +41 -0
  40. package/dist/chunks/{list-ZBYPMUID.js → list-7VHJIUDX.js} +2 -2
  41. package/dist/chunks/list-A5WVDBWF.js +53 -0
  42. package/dist/chunks/{list-NGOCMJXE.js → list-CK5X2YN3.js} +5 -4
  43. package/dist/chunks/{list-TTKLNJKI.js → list-FLAYJQKN.js} +2 -2
  44. package/dist/chunks/list-PTAWQYWG.js +35 -0
  45. package/dist/chunks/list-U7PAYNAH.js +47 -0
  46. package/dist/chunks/{list-OTOMCFLA.js → list-WH7KESMV.js} +12 -11
  47. package/dist/chunks/{query-NY4SCO77.js → query-AW7WYILM.js} +5 -9
  48. package/dist/chunks/{registry-W5XFI5T6.js → registry-3QIL5SVL.js} +2 -2
  49. package/dist/chunks/{remove-WEAZFZCO.js → remove-QUH2D3S5.js} +2 -2
  50. package/dist/chunks/repl-STBZC4P2.js +180 -0
  51. package/dist/chunks/repl-VGC5FUJG.js +378 -0
  52. package/dist/chunks/resolver-QMIY33FM.js +26 -0
  53. package/dist/chunks/run-T33CMCFZ.js +26 -0
  54. package/dist/chunks/{run-J2A5YTTY.js → run-Y4TG3EM3.js} +22 -3
  55. package/dist/chunks/rune-UBRVWG5A.js +139 -0
  56. package/dist/chunks/{search-XENXL3GC.js → search-MSSDGJTF.js} +2 -2
  57. package/dist/chunks/{uninstall-MX5PLGDI.js → uninstall-55YTHZRH.js} +5 -5
  58. package/dist/chunks/unset-YASSMSE5.js +24 -0
  59. package/dist/chunks/{update-7XDTVFZ3.js → update-EWWDROKW.js} +2 -2
  60. package/dist/chunks/{update-IEE54GPY.js → update-G6XO4RIM.js} +6 -6
  61. package/dist/chunks/{utils-PO3ZK53L.js → utils-XOWJQWNR.js} +2 -2
  62. package/dist/chunks/{version-V67W66HQ.js → version-I442SSH7.js} +10 -5
  63. package/dist/cli.js +114 -81
  64. package/package.json +9 -4
  65. package/dist/chunks/benchmark-ATSRQIDC.js +0 -164
  66. package/dist/chunks/check-G72VZKIP.js +0 -144
  67. package/dist/chunks/chunk-3TM6B4E5.js +0 -70
  68. package/dist/chunks/chunk-XXUNHQIB.js +0 -129
  69. package/dist/chunks/intro-RFWW5HIO.js +0 -1510
  70. package/dist/chunks/list-5DVVP7HX.js +0 -50
  71. package/dist/chunks/list-6WL5LGIZ.js +0 -80
  72. package/dist/chunks/list-YPI7YDKK.js +0 -80
  73. package/dist/chunks/run-AUAGELWL.js +0 -23
  74. package/dist/chunks/rune-D2FL547U.js +0 -87
  75. package/dist/chunks/unset-KQOZYVTE.js +0 -28
@@ -1,50 +0,0 @@
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
- };
@@ -1,80 +0,0 @@
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
- };
@@ -1,80 +0,0 @@
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
- };
@@ -1,23 +0,0 @@
1
- import {
2
- handler,
3
- parseRunArgs,
4
- parseSegment
5
- } from "./chunk-AIEWOUXT.js";
6
- import "./chunk-6I7RHSAA.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 "./chunk-H3BVJCIL.js";
13
- import "./chunk-6XLT25GS.js";
14
- import "./chunk-WCODTMDN.js";
15
- import "./chunk-GHQOK4L7.js";
16
- import "./chunk-HMU2J25D.js";
17
- import "./chunk-G3U4V32O.js";
18
- import "./chunk-TPK5AGRA.js";
19
- export {
20
- handler,
21
- parseRunArgs,
22
- parseSegment
23
- };
@@ -1,87 +0,0 @@
1
- import {
2
- formatHelp
3
- } from "./chunk-HOH7WZX4.js";
4
- import {
5
- computeEffectivePermissions,
6
- getArgsSchema,
7
- getRune
8
- } from "./chunk-6I7RHSAA.js";
9
- import "./chunk-67I2J474.js";
10
- import "./chunk-XXUNHQIB.js";
11
- import "./chunk-NXSDVVTW.js";
12
- import "./chunk-QMWGQXEZ.js";
13
- import "./chunk-3TM6B4E5.js";
14
- import {
15
- loadConfig
16
- } from "./chunk-H3BVJCIL.js";
17
- import {
18
- output
19
- } from "./chunk-6XLT25GS.js";
20
- import "./chunk-WCODTMDN.js";
21
- import "./chunk-GHQOK4L7.js";
22
- import "./chunk-HMU2J25D.js";
23
- import "./chunk-G3U4V32O.js";
24
- import {
25
- init_require_shim
26
- } from "./chunk-TPK5AGRA.js";
27
-
28
- // src/docs/commands/rune.js
29
- init_require_shim();
30
- import { join, relative } from "node:path";
31
- var SUGGESTIONS = {
32
- run: "crunes docs run",
33
- args: "crunes docs args",
34
- intro: "crunes docs intro",
35
- utils: "crunes docs utils",
36
- globals: "crunes docs globals"
37
- };
38
- async function handler({ keys, format = "text", projectRoot = process.cwd(), configRoot = projectRoot }) {
39
- let config;
40
- try {
41
- config = loadConfig(configRoot);
42
- } catch (err) {
43
- output.error(`Config unreadable: ${err.message}`);
44
- process.exit(1);
45
- }
46
- const results = [];
47
- let anyFailed = false;
48
- for (const key of keys) {
49
- const entry = getRune(config, key);
50
- if (!entry) {
51
- if (SUGGESTIONS[key]) {
52
- output.warn(`Unknown rune: "${key}". (Tip: Did you mean "${SUGGESTIONS[key]}"?)`);
53
- } else {
54
- output.warn(`Unknown rune: "${key}"`);
55
- }
56
- anyFailed = true;
57
- continue;
58
- }
59
- const runeFile = join(configRoot, entry.path ?? `.crunes/runes/${key}.js`);
60
- const relativePath = relative(projectRoot, runeFile).replace(/\\/g, "/");
61
- const basePerms = entry.permissions ?? { allow: [], deny: [] };
62
- const effective = computeEffectivePermissions(basePerms, config.permissions?.[key], "args", projectRoot);
63
- let schema = null;
64
- try {
65
- schema = await getArgsSchema(runeFile, effective, projectRoot, { vars: entry.vars ?? {} });
66
- } catch (err) {
67
- output.warn(`Could not load args schema for "${key}": ${err.message}`);
68
- }
69
- results.push({
70
- key,
71
- name: entry.name ?? key,
72
- description: entry.description ?? null,
73
- relativePath,
74
- schema
75
- });
76
- }
77
- if (format === "json") {
78
- process.stdout.write(JSON.stringify(results, null, 2) + "\n");
79
- } else {
80
- const blocks = results.map((r) => formatHelp(r.schema, { key: r.key, name: r.name, description: r.description, relativePath: r.relativePath }));
81
- if (blocks.length > 0) process.stdout.write(blocks.join("\n\n") + "\n");
82
- }
83
- if (anyFailed) process.exit(1);
84
- }
85
- export {
86
- handler
87
- };
@@ -1,28 +0,0 @@
1
- import {
2
- deleteCacheKey
3
- } from "./chunk-NXSDVVTW.js";
4
- import "./chunk-QMWGQXEZ.js";
5
- import {
6
- ensureProjectIdentity
7
- } from "./chunk-3TM6B4E5.js";
8
- import "./chunk-HMU2J25D.js";
9
- import {
10
- init_require_shim
11
- } from "./chunk-TPK5AGRA.js";
12
-
13
- // src/cache/commands/unset.js
14
- init_require_shim();
15
- async function handler({ id, key: keyName, projectDir, global: isGlobal }) {
16
- const projKey = isGlobal ? void 0 : (await ensureProjectIdentity(projectDir)).id;
17
- let result;
18
- try {
19
- result = await deleteCacheKey(id, keyName, projKey);
20
- } catch (err) {
21
- console.error(`Error: ${err.message}`);
22
- process.exit(1);
23
- }
24
- console.log(`Removed key "${keyName}" from "${result.name}".`);
25
- }
26
- export {
27
- handler
28
- };