@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,10 +1,10 @@
1
1
  import {
2
2
  storageKey
3
- } from "./chunk-QMWGQXEZ.js";
3
+ } from "./chunk-G4ZAUHHA.js";
4
4
  import {
5
- getCacheJsonPath,
6
- getCachesBasePath
7
- } from "./chunk-HMU2J25D.js";
5
+ getCacheBasePath,
6
+ getCacheJsonPath
7
+ } from "./chunk-6MRZXASS.js";
8
8
  import {
9
9
  init_require_shim
10
10
  } from "./chunk-TPK5AGRA.js";
@@ -15,13 +15,7 @@ import { readFile, readdir, writeFile, mkdir, rm } from "node:fs/promises";
15
15
  import { dirname } from "node:path";
16
16
  import path from "node:path";
17
17
  function getCachePluginDir(pluginId) {
18
- return path.join(getCachesBasePath(), "plugins", pluginId);
19
- }
20
- function getCacheProjectDir(key) {
21
- return path.join(getCachesBasePath(), "projects", key);
22
- }
23
- function getCacheProjectPluginDir(key, pluginId) {
24
- return path.join(getCachesBasePath(), "project-plugins", key, pluginId);
18
+ return path.join(getCacheBasePath(), "plugins", pluginId);
25
19
  }
26
20
  async function loadCacheBuckets() {
27
21
  try {
@@ -30,49 +24,13 @@ async function loadCacheBuckets() {
30
24
  return { format: "1", buckets: {} };
31
25
  }
32
26
  }
33
- async function upsertCacheBucket(resolvedPath, { scope, projectId, pluginId, location, name }) {
27
+ async function listCacheBuckets() {
34
28
  const data = await loadCacheBuckets();
35
- const key = storageKey(scope, { projectId, pluginId, name });
36
- const effectiveProjectId = projectId ?? null;
37
- data.buckets[key] = {
38
- path: resolvedPath,
39
- scope,
40
- projectKey: effectiveProjectId,
41
- pluginId: pluginId ?? null,
42
- location,
43
- name,
44
- firstSeenAt: data.buckets[key]?.firstSeenAt ?? (/* @__PURE__ */ new Date()).toISOString()
45
- };
46
- const p = getCacheJsonPath();
47
- await mkdir(dirname(p), { recursive: true });
48
- await writeFile(p, JSON.stringify(data, null, 2), "utf8");
49
- }
50
- function scopedBuckets(data, projectKey) {
51
- if (projectKey === void 0) return data.buckets;
52
- return Object.fromEntries(
53
- Object.entries(data.buckets).filter(
54
- ([, e]) => (e.scope === "global-project" || e.scope === "global-project-plugin") && e.projectKey === projectKey
55
- )
56
- );
57
- }
58
- async function listCacheBuckets(projectKey = void 0) {
59
- const data = await loadCacheBuckets();
60
- const entries = Object.entries(data.buckets).map(([key, entry]) => ({ key, ...entry }));
61
- if (projectKey === void 0) return entries;
62
- return entries.filter(
63
- (e) => (e.scope === "global-project" || e.scope === "global-project-plugin") && e.projectKey === projectKey
64
- );
29
+ return Object.entries(data.buckets).map(([key, entry]) => ({ key, ...entry }));
65
30
  }
66
31
  async function listLocalCacheBuckets(projectDir) {
67
- let projectId;
68
- try {
69
- const raw = await readFile(path.join(projectDir, ".crunes", "project.local.json"), "utf8");
70
- projectId = JSON.parse(raw).id;
71
- } catch {
72
- return [];
73
- }
74
32
  const results = [];
75
- const localCachesDir = path.join(projectDir, ".crunes", "caches");
33
+ const localCacheDir = path.join(projectDir, ".crunes", "caches");
76
34
  async function scanScope(scopeDir, scope, pluginId = null) {
77
35
  let entries;
78
36
  try {
@@ -83,20 +41,18 @@ async function listLocalCacheBuckets(projectDir) {
83
41
  for (const entry of entries) {
84
42
  if (!entry.isDirectory()) continue;
85
43
  const name = entry.name;
86
- const key = storageKey(scope, { projectId, pluginId, name });
87
- const location = pluginId ? `@local-project-plugin-cache/${pluginId}/${name}` : `@local-project-cache/${name}`;
88
- let firstSeenAt;
44
+ const key = storageKey(scope, { projectId: null, pluginId, name });
45
+ const location = pluginId ? `@local-plugin-cache/${pluginId}/${name}` : `@local-cache/${name}`;
46
+ let firstSeenAt = null;
89
47
  try {
90
- const stat = await readFile(path.join(scopeDir, name, ".firstSeen"), "utf8");
91
- firstSeenAt = stat.trim();
48
+ firstSeenAt = (await readFile(path.join(scopeDir, name, ".firstSeen"), "utf8")).trim();
92
49
  } catch {
93
- firstSeenAt = null;
94
50
  }
95
- results.push({ key, scope, projectKey: projectId, pluginId, location, name, firstSeenAt, path: path.join(scopeDir, name) });
51
+ results.push({ key, scope, projectKey: null, pluginId, location, name, firstSeenAt, path: path.join(scopeDir, name) });
96
52
  }
97
53
  }
98
- await scanScope(path.join(localCachesDir, "project"), "local-project");
99
- const pluginsDir = path.join(localCachesDir, "project-plugins");
54
+ await scanScope(path.join(localCacheDir, "project"), "local");
55
+ const pluginsDir = path.join(localCacheDir, "plugins");
100
56
  let pluginEntries;
101
57
  try {
102
58
  pluginEntries = await readdir(pluginsDir, { withFileTypes: true });
@@ -105,7 +61,7 @@ async function listLocalCacheBuckets(projectDir) {
105
61
  }
106
62
  for (const pluginEntry of pluginEntries) {
107
63
  if (!pluginEntry.isDirectory()) continue;
108
- await scanScope(path.join(pluginsDir, pluginEntry.name), "local-project-plugin", pluginEntry.name);
64
+ await scanScope(path.join(pluginsDir, pluginEntry.name), "local-plugin", pluginEntry.name);
109
65
  }
110
66
  return results;
111
67
  }
@@ -116,9 +72,9 @@ function resolveKey(id, buckets) {
116
72
  if (matches.length === 0) throw new Error(`No cache bucket matching "${id}".`);
117
73
  throw new Error(`Ambiguous id "${id}" \u2014 matches: ${matches.join(", ")}.`);
118
74
  }
119
- async function clearCacheBucket(id, projectKey = void 0) {
75
+ async function clearCacheBucket(id) {
120
76
  const data = await loadCacheBuckets();
121
- const key = resolveKey(id, scopedBuckets(data, projectKey));
77
+ const key = resolveKey(id, data.buckets);
122
78
  const { path: bucketPath, name } = data.buckets[key];
123
79
  let removed = 0;
124
80
  try {
@@ -144,9 +100,9 @@ async function clearCacheBucket(id, projectKey = void 0) {
144
100
  }
145
101
  return { removed, name };
146
102
  }
147
- async function deleteCacheKey(id, keyName, projectKey = void 0) {
103
+ async function deleteCacheKey(id, keyName) {
148
104
  const data = await loadCacheBuckets();
149
- const key = resolveKey(id, scopedBuckets(data, projectKey));
105
+ const key = resolveKey(id, data.buckets);
150
106
  const { path: bucketPath, name } = data.buckets[key];
151
107
  try {
152
108
  await rm(path.join(bucketPath, `${keyName}.json`));
@@ -156,9 +112,9 @@ async function deleteCacheKey(id, keyName, projectKey = void 0) {
156
112
  }
157
113
  return { name };
158
114
  }
159
- async function deleteCacheBucket(id, projectKey = void 0) {
115
+ async function deleteCacheBucket(id) {
160
116
  const data = await loadCacheBuckets();
161
- const key = resolveKey(id, scopedBuckets(data, projectKey));
117
+ const key = resolveKey(id, data.buckets);
162
118
  const { path: bucketPath, name } = data.buckets[key];
163
119
  await rm(bucketPath, { recursive: true, force: true });
164
120
  delete data.buckets[key];
@@ -170,9 +126,6 @@ async function deleteCacheBucket(id, projectKey = void 0) {
170
126
 
171
127
  export {
172
128
  getCachePluginDir,
173
- getCacheProjectDir,
174
- getCacheProjectPluginDir,
175
- upsertCacheBucket,
176
129
  listCacheBuckets,
177
130
  listLocalCacheBuckets,
178
131
  clearCacheBucket,
@@ -2,7 +2,7 @@ import {
2
2
  ensureStoreDirs,
3
3
  getMarketplaceCacheDir,
4
4
  getMarketplacesJsonPath
5
- } from "./chunk-HMU2J25D.js";
5
+ } from "./chunk-6MRZXASS.js";
6
6
  import {
7
7
  init_require_shim
8
8
  } from "./chunk-TPK5AGRA.js";