@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.
- package/README.md +5 -4
- package/dist/chunks/{add-OWYVF3IE.js → add-CBHWFGCA.js} +2 -2
- package/dist/chunks/{apply-OMEVXCHC.js → apply-YC6JEPUN.js} +6 -5
- package/dist/chunks/args-repl-TX3YWUOO.js +81 -0
- package/dist/chunks/banner-repl-DD22Z33A.js +52 -0
- package/dist/chunks/benchmark-BJEAAFWG.js +234 -0
- package/dist/chunks/{browse-COH6IJEX.js → browse-JZFU52ET.js} +2 -2
- package/dist/chunks/{chunk-2Q24YPGL.js → chunk-2PBPDTRD.js} +2 -2
- package/dist/chunks/chunk-63H5VXZY.js +101 -0
- package/dist/chunks/{chunk-GHQOK4L7.js → chunk-65J65MAP.js} +1 -1
- package/dist/chunks/{chunk-HMU2J25D.js → chunk-6MRZXASS.js} +3 -3
- package/dist/chunks/{chunk-HOH7WZX4.js → chunk-ASZKAC24.js} +9 -1
- package/dist/chunks/{chunk-AIEWOUXT.js → chunk-DZJRYFOP.js} +104 -41
- package/dist/chunks/{chunk-QMWGQXEZ.js → chunk-G4ZAUHHA.js} +2 -4
- package/dist/chunks/{chunk-67I2J474.js → chunk-J3GZ3DXD.js} +14 -55
- package/dist/chunks/{chunk-XIXND2M4.js → chunk-JOAL437H.js} +5 -1
- package/dist/chunks/{chunk-6I7RHSAA.js → chunk-JU6FKUBY.js} +30394 -26055
- package/dist/chunks/{chunk-BVY5LN7X.js → chunk-NAEVMRNA.js} +22031 -13350
- package/dist/chunks/{chunk-NXSDVVTW.js → chunk-NDEYEYSU.js} +22 -69
- package/dist/chunks/{chunk-L72BG6DS.js → chunk-NYLRTAAA.js} +1 -1
- package/dist/chunks/{chunk-UGN3FFEF.js → chunk-V35LVVNV.js} +5113 -2117
- package/dist/chunks/chunk-ZJDKCC2Y.js +105 -0
- package/dist/chunks/{clear-Y5POLIMF.js → clear-YBDIPEEH.js} +5 -9
- package/dist/chunks/commands-repl-IPLJ4M7X.js +65 -0
- package/dist/chunks/complete-input-repl-IDSCMRYL.js +71 -0
- package/dist/chunks/{create-I6BNYZ5Q.js → create-ZFFV3Z2P.js} +2 -1
- package/dist/chunks/{delete-UB5SXO5I.js → delete-C4UJ7X5K.js} +5 -9
- package/dist/chunks/delete-E4TEBRPX.js +27 -0
- package/dist/chunks/{delete-7CQFYIXS.js → delete-LNOYM5KG.js} +5 -9
- package/dist/chunks/{disable-FCBW7WVG.js → disable-TMG2K3BF.js} +6 -6
- package/dist/chunks/{doctor-DS57HDLJ.js → doctor-N43QEMAH.js} +2 -2
- package/dist/chunks/{enable-IXRVUXJM.js → enable-327OMBPC.js} +6 -6
- package/dist/chunks/{globals-YCJ2DGWC.js → globals-H2WF344Y.js} +2 -2
- package/dist/chunks/{init-WGKQVAZE.js → init-HU5OMHEH.js} +1 -1
- package/dist/chunks/input-repl-ZBH6FVPV.js +87 -0
- package/dist/chunks/{install-BCTBOPBS.js → install-RRLUOYFO.js} +6 -6
- package/dist/chunks/intro-4CICBP2J.js +2727 -0
- package/dist/chunks/{kill-LWRXZVM5.js → kill-2UG7PHUV.js} +4 -10
- package/dist/chunks/list-4X3JFQGS.js +41 -0
- package/dist/chunks/{list-ZBYPMUID.js → list-7VHJIUDX.js} +2 -2
- package/dist/chunks/list-A5WVDBWF.js +53 -0
- package/dist/chunks/{list-NGOCMJXE.js → list-CK5X2YN3.js} +5 -4
- package/dist/chunks/{list-TTKLNJKI.js → list-FLAYJQKN.js} +2 -2
- package/dist/chunks/list-PTAWQYWG.js +35 -0
- package/dist/chunks/list-U7PAYNAH.js +47 -0
- package/dist/chunks/{list-OTOMCFLA.js → list-WH7KESMV.js} +12 -11
- package/dist/chunks/{query-NY4SCO77.js → query-AW7WYILM.js} +5 -9
- package/dist/chunks/{registry-W5XFI5T6.js → registry-3QIL5SVL.js} +2 -2
- package/dist/chunks/{remove-WEAZFZCO.js → remove-QUH2D3S5.js} +2 -2
- package/dist/chunks/repl-STBZC4P2.js +180 -0
- package/dist/chunks/repl-VGC5FUJG.js +378 -0
- package/dist/chunks/resolver-QMIY33FM.js +26 -0
- package/dist/chunks/run-T33CMCFZ.js +26 -0
- package/dist/chunks/{run-J2A5YTTY.js → run-Y4TG3EM3.js} +22 -3
- package/dist/chunks/rune-UBRVWG5A.js +139 -0
- package/dist/chunks/{search-XENXL3GC.js → search-MSSDGJTF.js} +2 -2
- package/dist/chunks/{uninstall-MX5PLGDI.js → uninstall-55YTHZRH.js} +5 -5
- package/dist/chunks/unset-YASSMSE5.js +24 -0
- package/dist/chunks/{update-7XDTVFZ3.js → update-EWWDROKW.js} +2 -2
- package/dist/chunks/{update-IEE54GPY.js → update-G6XO4RIM.js} +6 -6
- package/dist/chunks/{utils-PO3ZK53L.js → utils-XOWJQWNR.js} +2 -2
- package/dist/chunks/{version-V67W66HQ.js → version-I442SSH7.js} +10 -5
- package/dist/cli.js +114 -81
- package/package.json +9 -4
- package/dist/chunks/benchmark-ATSRQIDC.js +0 -164
- package/dist/chunks/check-G72VZKIP.js +0 -144
- package/dist/chunks/chunk-3TM6B4E5.js +0 -70
- package/dist/chunks/chunk-XXUNHQIB.js +0 -129
- package/dist/chunks/intro-RFWW5HIO.js +0 -1510
- package/dist/chunks/list-5DVVP7HX.js +0 -50
- package/dist/chunks/list-6WL5LGIZ.js +0 -80
- package/dist/chunks/list-YPI7YDKK.js +0 -80
- package/dist/chunks/run-AUAGELWL.js +0 -23
- package/dist/chunks/rune-D2FL547U.js +0 -87
- package/dist/chunks/unset-KQOZYVTE.js +0 -28
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
storageKey
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G4ZAUHHA.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
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(
|
|
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
|
|
27
|
+
async function listCacheBuckets() {
|
|
34
28
|
const data = await loadCacheBuckets();
|
|
35
|
-
|
|
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
|
|
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-
|
|
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
|
-
|
|
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:
|
|
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(
|
|
99
|
-
const pluginsDir = path.join(
|
|
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-
|
|
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
|
|
75
|
+
async function clearCacheBucket(id) {
|
|
120
76
|
const data = await loadCacheBuckets();
|
|
121
|
-
const key = resolveKey(id,
|
|
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
|
|
103
|
+
async function deleteCacheKey(id, keyName) {
|
|
148
104
|
const data = await loadCacheBuckets();
|
|
149
|
-
const key = resolveKey(id,
|
|
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
|
|
115
|
+
async function deleteCacheBucket(id) {
|
|
160
116
|
const data = await loadCacheBuckets();
|
|
161
|
-
const key = resolveKey(id,
|
|
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,
|