@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.
Files changed (72) hide show
  1. package/dist/chunks/{add-CBHWFGCA.js → add-IT3IHBPO.js} +2 -2
  2. package/dist/chunks/{apply-YC6JEPUN.js → apply-YY7MIM64.js} +13 -12
  3. package/dist/chunks/{benchmark-BJEAAFWG.js → benchmark-BQNMULOO.js} +17 -14
  4. package/dist/chunks/{browse-JZFU52ET.js → browse-PHMBDREQ.js} +2 -2
  5. package/dist/chunks/{chunk-6MRZXASS.js → chunk-2Q3KLBE6.js} +16 -0
  6. package/dist/chunks/{chunk-2PBPDTRD.js → chunk-34F4ZURL.js} +40 -37
  7. package/dist/chunks/{chunk-ZJDKCC2Y.js → chunk-4GJMCFR6.js} +6 -3
  8. package/dist/chunks/chunk-CY6C6ADU.js +2787 -0
  9. package/dist/chunks/{chunk-J3GZ3DXD.js → chunk-GVMT55GH.js} +3 -2
  10. package/dist/chunks/{chunk-JOAL437H.js → chunk-I6MHDUCW.js} +16 -1
  11. package/dist/chunks/{chunk-6XLT25GS.js → chunk-MIKWIFYR.js} +47 -0
  12. package/dist/chunks/chunk-MRNZFUXZ.js +70 -0
  13. package/dist/chunks/{chunk-NAEVMRNA.js → chunk-PBGUKXT6.js} +2940 -1847
  14. package/dist/chunks/chunk-QYRF3R35.js +154 -0
  15. package/dist/chunks/{chunk-DZJRYFOP.js → chunk-SNC7AOT7.js} +78 -12
  16. package/dist/chunks/{chunk-63H5VXZY.js → chunk-UEUUOAJY.js} +4 -1
  17. package/dist/chunks/{chunk-65J65MAP.js → chunk-VST6HAB6.js} +16 -2
  18. package/dist/chunks/{chunk-NDEYEYSU.js → chunk-WJII3LZK.js} +4 -3
  19. package/dist/chunks/chunk-X7PZN73N.js +44 -0
  20. package/dist/chunks/{chunk-NYLRTAAA.js → chunk-YVN3VDRE.js} +1 -1
  21. package/dist/chunks/{chunk-JU6FKUBY.js → chunk-YXCHIMLW.js} +995 -3097
  22. package/dist/chunks/{clear-YBDIPEEH.js → clear-AT7HNUV4.js} +2 -2
  23. package/dist/chunks/{create-GPDE2YKL.js → create-ET6DT5ZE.js} +22 -18
  24. package/dist/chunks/{create-OZACMPEU.js → create-LM7U3CJS.js} +28 -20
  25. package/dist/chunks/{create-ZFFV3Z2P.js → create-TLPM7HJE.js} +5 -5
  26. package/dist/chunks/{delete-LNOYM5KG.js → delete-5R3WBLVD.js} +5 -5
  27. package/dist/chunks/{delete-E4TEBRPX.js → delete-GKYA2W5Z.js} +4 -2
  28. package/dist/chunks/{delete-C4UJ7X5K.js → delete-U4STA2QZ.js} +5 -5
  29. package/dist/chunks/disable-TNTEIAKO.js +39 -0
  30. package/dist/chunks/doctor-VXAQYMTR.js +101 -0
  31. package/dist/chunks/enable-GUQCB4CU.js +31 -0
  32. package/dist/chunks/{globals-H2WF344Y.js → globals-SNQFCHMP.js} +1 -1
  33. package/dist/chunks/{init-HU5OMHEH.js → init-PJSCFOC6.js} +14 -8
  34. package/dist/chunks/{install-RRLUOYFO.js → install-4YP7FALO.js} +18 -16
  35. package/dist/chunks/{intro-4CICBP2J.js → intro-SA7MWV3Z.js} +113 -43
  36. package/dist/chunks/{kill-2UG7PHUV.js → kill-TX3PC73P.js} +2 -1
  37. package/dist/chunks/list-7R6NASFI.js +92 -0
  38. package/dist/chunks/{list-4X3JFQGS.js → list-EHREZR6M.js} +2 -1
  39. package/dist/chunks/{list-U7PAYNAH.js → list-LC6HB3H3.js} +2 -2
  40. package/dist/chunks/{list-FLAYJQKN.js → list-OMMZAQ23.js} +2 -2
  41. package/dist/chunks/{list-7VHJIUDX.js → list-U4EMHQZT.js} +2 -2
  42. package/dist/chunks/{list-PTAWQYWG.js → list-V7VVD5AG.js} +2 -1
  43. package/dist/chunks/{list-A5WVDBWF.js → list-VA73WPK6.js} +2 -2
  44. package/dist/chunks/{list-CK5X2YN3.js → list-WKNPZZOV.js} +5 -4
  45. package/dist/chunks/{output-RJ6JSNY7.js → output-QN5CVJ62.js} +4 -1
  46. package/dist/chunks/{query-AW7WYILM.js → query-2US3CPYT.js} +2 -2
  47. package/dist/chunks/{registry-3QIL5SVL.js → registry-K5DV5NAK.js} +4 -2
  48. package/dist/chunks/{remove-QUH2D3S5.js → remove-BCFTF23J.js} +2 -2
  49. package/dist/chunks/{repl-STBZC4P2.js → repl-2YWTHUWT.js} +4 -0
  50. package/dist/chunks/{repl-VGC5FUJG.js → repl-ZB3DIJ4K.js} +84 -26
  51. package/dist/chunks/resolver-QIYYFIDX.js +34 -0
  52. package/dist/chunks/run-22B65ZWZ.js +29 -0
  53. package/dist/chunks/rune-SYK4N642.js +425 -0
  54. package/dist/chunks/{search-MSSDGJTF.js → search-B7IM7JRJ.js} +2 -2
  55. package/dist/chunks/shell-explain-QLITLHW7.js +74 -0
  56. package/dist/chunks/{uninstall-55YTHZRH.js → uninstall-4WR5IHLC.js} +15 -11
  57. package/dist/chunks/{unset-YASSMSE5.js → unset-P6IUF7SS.js} +2 -2
  58. package/dist/chunks/{update-G6XO4RIM.js → update-ACLDK6E6.js} +19 -18
  59. package/dist/chunks/{update-EWWDROKW.js → update-WXT7CHYA.js} +2 -2
  60. package/dist/chunks/{utils-XOWJQWNR.js → utils-B2QULX5J.js} +8 -4
  61. package/dist/chunks/{version-PW7MHDFH.js → version-EULYWNXN.js} +3 -2
  62. package/dist/cli.js +93 -71
  63. package/package.json +2 -1
  64. package/dist/chunks/chunk-ASZKAC24.js +0 -103
  65. package/dist/chunks/chunk-H3BVJCIL.js +0 -105
  66. package/dist/chunks/disable-TMG2K3BF.js +0 -47
  67. package/dist/chunks/doctor-N43QEMAH.js +0 -53
  68. package/dist/chunks/enable-327OMBPC.js +0 -47
  69. package/dist/chunks/list-WH7KESMV.js +0 -111
  70. package/dist/chunks/resolver-QMIY33FM.js +0 -26
  71. package/dist/chunks/run-T33CMCFZ.js +0 -26
  72. package/dist/chunks/rune-UBRVWG5A.js +0 -139
@@ -0,0 +1,74 @@
1
+ import {
2
+ BUILTIN_ALLOWLIST,
3
+ ScanRefusal,
4
+ resolveShell,
5
+ scanCommand
6
+ } from "./chunk-CY6C6ADU.js";
7
+ import "./chunk-GVMT55GH.js";
8
+ import "./chunk-WJII3LZK.js";
9
+ import "./chunk-G4ZAUHHA.js";
10
+ import "./chunk-2Q3KLBE6.js";
11
+ import {
12
+ init_require_shim
13
+ } from "./chunk-TPK5AGRA.js";
14
+
15
+ // src/rune/commands/shell-explain.js
16
+ init_require_shim();
17
+ function explain({ cmd, shellMode }) {
18
+ const shell = resolveShell(shellMode).kind;
19
+ try {
20
+ const { commands, redirects } = scanCommand(cmd, shell);
21
+ return {
22
+ shell,
23
+ refusal: null,
24
+ commands: commands.map((c) => ({
25
+ program: c.program,
26
+ segment: c.segment,
27
+ offset: c.offset,
28
+ builtin: BUILTIN_ALLOWLIST.has(c.program)
29
+ })),
30
+ redirects: redirects.map((r) => ({
31
+ capability: r.mode === "write" ? "fs.write" : "fs.read",
32
+ target: r.target,
33
+ offset: r.offset
34
+ }))
35
+ };
36
+ } catch (e) {
37
+ if (!(e instanceof ScanRefusal)) throw e;
38
+ return { shell, refusal: { construct: e.construct, offset: e.offset }, commands: [], redirects: [] };
39
+ }
40
+ }
41
+ async function handler({ cmd, shellMode }) {
42
+ const r = explain({ cmd, shellMode });
43
+ console.log(`shell: ${r.shell}`);
44
+ console.log();
45
+ if (r.refusal) {
46
+ console.log(`REFUSED: ${r.refusal.construct} at offset ${r.refusal.offset}`);
47
+ console.log();
48
+ console.log(cmd);
49
+ console.log(" ".repeat(r.refusal.offset) + "^");
50
+ console.log();
51
+ console.log("This construct cannot be classified, so it is denied. There is no");
52
+ console.log("grant that overrides this. Rewrite the command without it.");
53
+ process.exitCode = 1;
54
+ return;
55
+ }
56
+ console.log("command positions:");
57
+ for (const c of r.commands) {
58
+ const tag = c.builtin ? "builtin, no grant needed" : `needs shell.run:${c.segment}`;
59
+ console.log(` @${String(c.offset).padStart(4)} ${c.segment}`);
60
+ console.log(` ${tag}`);
61
+ }
62
+ if (r.redirects.length > 0) {
63
+ console.log();
64
+ console.log("redirects:");
65
+ for (const rd of r.redirects) {
66
+ console.log(` @${String(rd.offset).padStart(4)} ${rd.target}`);
67
+ console.log(` needs ${rd.capability}:${rd.target}`);
68
+ }
69
+ }
70
+ }
71
+ export {
72
+ explain,
73
+ handler
74
+ };
@@ -1,17 +1,21 @@
1
1
  import {
2
2
  uninstallPlugin
3
- } from "./chunk-2PBPDTRD.js";
3
+ } from "./chunk-34F4ZURL.js";
4
+ import "./chunk-X7PZN73N.js";
5
+ import "./chunk-QYRF3R35.js";
6
+ import {
7
+ output
8
+ } from "./chunk-MIKWIFYR.js";
4
9
  import {
5
10
  R,
6
- fe,
7
- ge,
8
11
  le
9
12
  } from "./chunk-CGZL5SSH.js";
13
+ import "./chunk-WCODTMDN.js";
10
14
  import {
11
15
  loadRegistry,
12
16
  resolvePluginKey
13
- } from "./chunk-65J65MAP.js";
14
- import "./chunk-6MRZXASS.js";
17
+ } from "./chunk-VST6HAB6.js";
18
+ import "./chunk-2Q3KLBE6.js";
15
19
  import "./chunk-G3U4V32O.js";
16
20
  import {
17
21
  init_require_shim
@@ -19,28 +23,28 @@ import {
19
23
 
20
24
  // src/plugin/commands/uninstall.js
21
25
  init_require_shim();
22
- async function handler({ name, yes, projectRoot, configRoot }) {
26
+ async function handler({ name, yes, projectRoot, configRoot, global = false }) {
23
27
  let pluginKey;
24
28
  try {
25
29
  const registry = await loadRegistry();
26
30
  pluginKey = resolvePluginKey(name, registry);
27
31
  if (!pluginKey) throw new Error(`Plugin "${name}" is not installed. Run: crunes plugin list`);
28
32
  } catch (err) {
29
- ge(`Error: ${err.message}`);
33
+ output.cancel(`Error: ${err.message}`);
30
34
  process.exit(1);
31
35
  }
32
36
  if (!yes) {
33
37
  const confirm = await le({ message: `Uninstall plugin "${pluginKey}"?` });
34
38
  if (R(confirm) || !confirm) {
35
- ge("Cancelled.");
39
+ output.cancel("Cancelled.");
36
40
  process.exit(0);
37
41
  }
38
42
  }
39
43
  try {
40
- await uninstallPlugin(pluginKey, configRoot ?? projectRoot);
41
- fe(`Uninstalled ${pluginKey}`);
44
+ await uninstallPlugin(pluginKey, configRoot ?? projectRoot, { global });
45
+ output.outro(`Uninstalled ${pluginKey}`);
42
46
  } catch (err) {
43
- ge(`Failed: ${err.message}`);
47
+ output.cancel(`Failed: ${err.message}`);
44
48
  process.exit(1);
45
49
  }
46
50
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  deleteCacheKey
3
- } from "./chunk-NDEYEYSU.js";
3
+ } from "./chunk-WJII3LZK.js";
4
4
  import "./chunk-G4ZAUHHA.js";
5
- import "./chunk-6MRZXASS.js";
5
+ import "./chunk-2Q3KLBE6.js";
6
6
  import {
7
7
  init_require_shim
8
8
  } from "./chunk-TPK5AGRA.js";
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  resolveFromMarketplace
3
- } from "./chunk-NYLRTAAA.js";
3
+ } from "./chunk-YVN3VDRE.js";
4
4
  import {
5
5
  installPlugin
6
- } from "./chunk-2PBPDTRD.js";
6
+ } from "./chunk-34F4ZURL.js";
7
+ import "./chunk-X7PZN73N.js";
8
+ import "./chunk-QYRF3R35.js";
7
9
  import {
8
- R2 as R,
9
- fe,
10
- ge,
11
- ye
12
- } from "./chunk-CGZL5SSH.js";
10
+ output
11
+ } from "./chunk-MIKWIFYR.js";
12
+ import "./chunk-CGZL5SSH.js";
13
+ import "./chunk-WCODTMDN.js";
13
14
  import {
14
15
  loadRegistry,
15
16
  resolvePluginKey
16
- } from "./chunk-65J65MAP.js";
17
- import "./chunk-6MRZXASS.js";
17
+ } from "./chunk-VST6HAB6.js";
18
+ import "./chunk-2Q3KLBE6.js";
18
19
  import "./chunk-G3U4V32O.js";
19
20
  import {
20
21
  init_require_shim
@@ -28,7 +29,7 @@ async function handler({ name, projectRoot, configRoot }) {
28
29
  if (name) {
29
30
  const pluginKey = resolvePluginKey(name, registry);
30
31
  if (!pluginKey) {
31
- ge(`Plugin "${name}" is not installed. Run: crunes plugin list`);
32
+ output.cancel(`Plugin "${name}" is not installed. Run: crunes plugin list`);
32
33
  process.exit(1);
33
34
  }
34
35
  plugins = [pluginKey];
@@ -39,16 +40,16 @@ async function handler({ name, projectRoot, configRoot }) {
39
40
  console.log("No plugins installed.");
40
41
  return;
41
42
  }
42
- ye(name ? `Updating ${name}\u2026` : "Updating all plugins\u2026");
43
+ output.intro(name ? `Updating ${name}\u2026` : "Updating all plugins\u2026");
43
44
  for (const pluginName of plugins) {
44
45
  const entry = registry.plugins[pluginName];
45
46
  if (!entry) {
46
- R.warn(`Plugin "${pluginName}" is not installed.`);
47
+ output.log.warn(`Plugin "${pluginName}" is not installed.`);
47
48
  continue;
48
49
  }
49
50
  const atIdx = pluginName.indexOf("@");
50
51
  if (atIdx === -1) {
51
- R.warn(`Skipping ${pluginName}: no marketplace provenance (legacy entry).`);
52
+ output.log.warn(`Skipping ${pluginName}: no marketplace provenance (legacy entry).`);
52
53
  continue;
53
54
  }
54
55
  const marketplaceName = pluginName.slice(0, atIdx);
@@ -58,21 +59,21 @@ async function handler({ name, projectRoot, configRoot }) {
58
59
  ;
59
60
  ({ resolvedSource, ...provenance } = await resolveFromMarketplace(marketplaceName, pluginNamePart));
60
61
  } catch (err) {
61
- R.error(`Failed to resolve ${pluginName} from marketplace: ${err.message}`);
62
+ output.log.error(`Failed to resolve ${pluginName} from marketplace: ${err.message}`);
62
63
  continue;
63
64
  }
64
65
  try {
65
66
  const result = await installPlugin(resolvedSource, configRoot ?? projectRoot, provenance);
66
67
  if (result.installed) {
67
- R.success(`Updated ${pluginName}@${result.version}`);
68
+ output.log.success(`Updated ${pluginName}@${result.version}`);
68
69
  } else {
69
- R.warn(`Update of ${pluginName} cancelled (permission consent declined).`);
70
+ output.log.warn(`Update of ${pluginName} cancelled (permission consent declined).`);
70
71
  }
71
72
  } catch (err) {
72
- R.error(`Failed to update ${pluginName}: ${err.message}`);
73
+ output.log.error(`Failed to update ${pluginName}: ${err.message}`);
73
74
  }
74
75
  }
75
- fe("Done.");
76
+ output.outro("Done.");
76
77
  }
77
78
  export {
78
79
  handler
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  listMarketplaces,
3
3
  updateMarketplace
4
- } from "./chunk-NYLRTAAA.js";
5
- import "./chunk-6MRZXASS.js";
4
+ } from "./chunk-YVN3VDRE.js";
5
+ import "./chunk-2Q3KLBE6.js";
6
6
  import {
7
7
  init_require_shim
8
8
  } from "./chunk-TPK5AGRA.js";
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  utils_api_default
3
- } from "./chunk-NAEVMRNA.js";
3
+ } from "./chunk-PBGUKXT6.js";
4
4
  import {
5
5
  formatNode,
6
6
  walk
7
- } from "./chunk-JOAL437H.js";
7
+ } from "./chunk-I6MHDUCW.js";
8
8
  import {
9
9
  output
10
- } from "./chunk-6XLT25GS.js";
10
+ } from "./chunk-MIKWIFYR.js";
11
+ import "./chunk-CGZL5SSH.js";
11
12
  import "./chunk-WCODTMDN.js";
12
13
  import {
13
14
  init_require_shim
@@ -16,10 +17,13 @@ import {
16
17
  // src/docs/commands/utils.js
17
18
  init_require_shim();
18
19
  var ALL_NAMESPACES = walk(utils_api_default);
20
+ function summarize(description) {
21
+ return (description ?? "").split(/\n\s*\n/)[0].replace(/\s+/g, " ").trim();
22
+ }
19
23
  function formatIndex(namespaces) {
20
24
  const lines = ["Available utils namespaces:", ""];
21
25
  for (const ns of namespaces) {
22
- lines.push(` ${ns.name} ${ns.description ?? ""}`.trimEnd());
26
+ lines.push(` ${ns.name} ${summarize(ns.description)}`.trimEnd());
23
27
  }
24
28
  return lines.join("\n");
25
29
  }
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-WCODTMDN.js";
4
4
  import {
5
5
  getStorePath
6
- } from "./chunk-6MRZXASS.js";
6
+ } from "./chunk-2Q3KLBE6.js";
7
7
  import {
8
8
  init_require_shim
9
9
  } from "./chunk-TPK5AGRA.js";
@@ -16,7 +16,7 @@ import path from "node:path";
16
16
  // package.json
17
17
  var package_default = {
18
18
  name: "@darkrymit/crunes-cli",
19
- version: "0.8.4",
19
+ version: "0.9.0",
20
20
  description: "CLI tool for querying crunes enrichers",
21
21
  type: "module",
22
22
  bin: {
@@ -41,6 +41,7 @@ var package_default = {
41
41
  devDependencies: {
42
42
  "@clack/prompts": "^1.5.0",
43
43
  archiver: "^8.0.0",
44
+ buffer: "^6.0.3",
44
45
  chalk: "^5.6.2",
45
46
  chokidar: "^5.0.0",
46
47
  "cli-table3": "^0.6.5",