@deeplake/hivemind 0.7.40 → 0.7.44
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/.claude-plugin/marketplace.json +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +233 -165
- package/codex/bundle/commands/auth-login.js +89 -46
- package/codex/bundle/session-start-setup.js +57 -51
- package/codex/bundle/session-start.js +103 -96
- package/cursor/bundle/commands/auth-login.js +89 -46
- package/cursor/bundle/session-start.js +103 -96
- package/hermes/bundle/commands/auth-login.js +89 -46
- package/hermes/bundle/session-start.js +103 -96
- package/mcp/bundle/server.js +53 -47
- package/openclaw/dist/index.js +68 -27
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +1 -1
|
@@ -17,21 +17,21 @@ __export(index_marker_store_exports, {
|
|
|
17
17
|
hasFreshIndexMarker: () => hasFreshIndexMarker,
|
|
18
18
|
writeIndexMarker: () => writeIndexMarker
|
|
19
19
|
});
|
|
20
|
-
import { existsSync as existsSync4, mkdirSync as
|
|
21
|
-
import { join as
|
|
20
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "node:fs";
|
|
21
|
+
import { join as join9 } from "node:path";
|
|
22
22
|
import { tmpdir } from "node:os";
|
|
23
23
|
function getIndexMarkerDir() {
|
|
24
|
-
return process.env.HIVEMIND_INDEX_MARKER_DIR ??
|
|
24
|
+
return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join9(tmpdir(), "hivemind-deeplake-indexes");
|
|
25
25
|
}
|
|
26
26
|
function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
|
|
27
27
|
const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
28
|
-
return
|
|
28
|
+
return join9(getIndexMarkerDir(), `${markerKey}.json`);
|
|
29
29
|
}
|
|
30
30
|
function hasFreshIndexMarker(markerPath) {
|
|
31
31
|
if (!existsSync4(markerPath))
|
|
32
32
|
return false;
|
|
33
33
|
try {
|
|
34
|
-
const raw = JSON.parse(
|
|
34
|
+
const raw = JSON.parse(readFileSync7(markerPath, "utf-8"));
|
|
35
35
|
const updatedAt = raw.updatedAt ? new Date(raw.updatedAt).getTime() : NaN;
|
|
36
36
|
if (!Number.isFinite(updatedAt) || Date.now() - updatedAt > INDEX_MARKER_TTL_MS)
|
|
37
37
|
return false;
|
|
@@ -41,8 +41,8 @@ function hasFreshIndexMarker(markerPath) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function writeIndexMarker(markerPath) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
mkdirSync6(getIndexMarkerDir(), { recursive: true });
|
|
45
|
+
writeFileSync5(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
46
46
|
}
|
|
47
47
|
var INDEX_MARKER_TTL_MS;
|
|
48
48
|
var init_index_marker_store = __esm({
|
|
@@ -55,7 +55,7 @@ var init_index_marker_store = __esm({
|
|
|
55
55
|
// dist/src/hooks/codex/session-start.js
|
|
56
56
|
import { spawn as spawn2 } from "node:child_process";
|
|
57
57
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
58
|
-
import { dirname as dirname7, join as
|
|
58
|
+
import { dirname as dirname7, join as join16 } from "node:path";
|
|
59
59
|
|
|
60
60
|
// dist/src/commands/auth.js
|
|
61
61
|
import { execSync } from "node:child_process";
|
|
@@ -69,19 +69,25 @@ function deeplakeClientHeader() {
|
|
|
69
69
|
return { [DEEPLAKE_CLIENT_HEADER]: deeplakeClientValue() };
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// dist/src/commands/
|
|
73
|
-
import { readFileSync, writeFileSync, mkdirSync
|
|
72
|
+
// dist/src/commands/install-id.js
|
|
73
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
74
74
|
import { join } from "node:path";
|
|
75
75
|
import { homedir } from "node:os";
|
|
76
|
+
import { randomUUID } from "node:crypto";
|
|
77
|
+
|
|
78
|
+
// dist/src/commands/auth-creds.js
|
|
79
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync } from "node:fs";
|
|
80
|
+
import { join as join2 } from "node:path";
|
|
81
|
+
import { homedir as homedir2 } from "node:os";
|
|
76
82
|
function configDir() {
|
|
77
|
-
return
|
|
83
|
+
return join2(homedir2(), ".deeplake");
|
|
78
84
|
}
|
|
79
85
|
function credsPath() {
|
|
80
|
-
return
|
|
86
|
+
return join2(configDir(), "credentials.json");
|
|
81
87
|
}
|
|
82
88
|
function loadCredentials() {
|
|
83
89
|
try {
|
|
84
|
-
return JSON.parse(
|
|
90
|
+
return JSON.parse(readFileSync2(credsPath(), "utf-8"));
|
|
85
91
|
} catch {
|
|
86
92
|
return null;
|
|
87
93
|
}
|
|
@@ -105,16 +111,16 @@ function readStdin() {
|
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
// dist/src/skillify/local-manifest.js
|
|
108
|
-
import { existsSync, mkdirSync as
|
|
109
|
-
import { homedir as
|
|
110
|
-
import { dirname, join as
|
|
111
|
-
var LOCAL_MANIFEST_PATH =
|
|
112
|
-
var LOCAL_MINE_LOCK_PATH =
|
|
114
|
+
import { existsSync, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
115
|
+
import { homedir as homedir3 } from "node:os";
|
|
116
|
+
import { dirname, join as join3 } from "node:path";
|
|
117
|
+
var LOCAL_MANIFEST_PATH = join3(homedir3(), ".claude", "hivemind", "local-mined.json");
|
|
118
|
+
var LOCAL_MINE_LOCK_PATH = join3(homedir3(), ".claude", "hivemind", "local-mined.lock");
|
|
113
119
|
function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
|
|
114
120
|
if (!existsSync(path))
|
|
115
121
|
return null;
|
|
116
122
|
try {
|
|
117
|
-
return JSON.parse(
|
|
123
|
+
return JSON.parse(readFileSync3(path, "utf-8"));
|
|
118
124
|
} catch {
|
|
119
125
|
return null;
|
|
120
126
|
}
|
|
@@ -123,22 +129,23 @@ function countLocalManifestEntries(path = LOCAL_MANIFEST_PATH) {
|
|
|
123
129
|
const m = readLocalManifest(path);
|
|
124
130
|
return Array.isArray(m?.entries) ? m.entries.length : 0;
|
|
125
131
|
}
|
|
132
|
+
var LATEST_RUN_WINDOW_MS = 5 * 60 * 1e3;
|
|
126
133
|
|
|
127
134
|
// dist/src/skillify/spawn-mine-local-worker.js
|
|
128
135
|
import { execFileSync, spawn } from "node:child_process";
|
|
129
|
-
import { closeSync, existsSync as existsSync2, mkdirSync as
|
|
130
|
-
import { homedir as
|
|
131
|
-
import { dirname as dirname2, join as
|
|
136
|
+
import { closeSync, existsSync as existsSync2, mkdirSync as mkdirSync4, openSync, readdirSync, statSync, unlinkSync as unlinkSync2 } from "node:fs";
|
|
137
|
+
import { homedir as homedir4 } from "node:os";
|
|
138
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
132
139
|
import { fileURLToPath } from "node:url";
|
|
133
|
-
var HOME =
|
|
134
|
-
var HIVEMIND_DIR =
|
|
135
|
-
var LOG_PATH =
|
|
136
|
-
var CLAUDE_PROJECTS_DIR =
|
|
140
|
+
var HOME = homedir4();
|
|
141
|
+
var HIVEMIND_DIR = join4(HOME, ".claude", "hivemind");
|
|
142
|
+
var LOG_PATH = join4(HOME, ".claude", "hooks", "mine-local.log");
|
|
143
|
+
var CLAUDE_PROJECTS_DIR = join4(HOME, ".claude", "projects");
|
|
137
144
|
var LOCK_STALE_MS = 15 * 60 * 1e3;
|
|
138
145
|
function findBundledCliPath() {
|
|
139
146
|
try {
|
|
140
147
|
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
141
|
-
const cliPath =
|
|
148
|
+
const cliPath = join4(thisDir, "..", "..", "bundle", "cli.js");
|
|
142
149
|
return existsSync2(cliPath) ? cliPath : null;
|
|
143
150
|
} catch {
|
|
144
151
|
return null;
|
|
@@ -171,7 +178,7 @@ function hasLocalClaudeSessions() {
|
|
|
171
178
|
for (const sub of subdirs) {
|
|
172
179
|
let files;
|
|
173
180
|
try {
|
|
174
|
-
files = readdirSync(
|
|
181
|
+
files = readdirSync(join4(CLAUDE_PROJECTS_DIR, sub));
|
|
175
182
|
} catch {
|
|
176
183
|
continue;
|
|
177
184
|
}
|
|
@@ -204,14 +211,14 @@ function maybeAutoMineLocal() {
|
|
|
204
211
|
if (!launcher)
|
|
205
212
|
return { triggered: false, reason: "no-hivemind-bin" };
|
|
206
213
|
try {
|
|
207
|
-
|
|
214
|
+
mkdirSync4(HIVEMIND_DIR, { recursive: true });
|
|
208
215
|
const fd = openSync(LOCAL_MINE_LOCK_PATH, "wx");
|
|
209
216
|
closeSync(fd);
|
|
210
217
|
} catch {
|
|
211
218
|
return { triggered: false, reason: "lock-acquire-failed" };
|
|
212
219
|
}
|
|
213
220
|
try {
|
|
214
|
-
|
|
221
|
+
mkdirSync4(join4(HOME, ".claude", "hooks"), { recursive: true });
|
|
215
222
|
const out = openSync(LOG_PATH, "a");
|
|
216
223
|
const [cmd, args] = launcher.kind === "node-script" ? [process.execPath, [launcher.path, "skillify", "mine-local"]] : [launcher.path, ["skillify", "mine-local"]];
|
|
217
224
|
const child = spawn(cmd, args, {
|
|
@@ -233,9 +240,9 @@ function maybeAutoMineLocal() {
|
|
|
233
240
|
|
|
234
241
|
// dist/src/utils/debug.js
|
|
235
242
|
import { appendFileSync } from "node:fs";
|
|
236
|
-
import { join as
|
|
237
|
-
import { homedir as
|
|
238
|
-
var LOG =
|
|
243
|
+
import { join as join5 } from "node:path";
|
|
244
|
+
import { homedir as homedir5 } from "node:os";
|
|
245
|
+
var LOG = join5(homedir5(), ".deeplake", "hook-debug.log");
|
|
239
246
|
function isDebug() {
|
|
240
247
|
return process.env.HIVEMIND_DEBUG === "1";
|
|
241
248
|
}
|
|
@@ -247,18 +254,18 @@ function log(tag, msg) {
|
|
|
247
254
|
}
|
|
248
255
|
|
|
249
256
|
// dist/src/utils/version-check.js
|
|
250
|
-
import { readFileSync as
|
|
251
|
-
import { dirname as dirname3, join as
|
|
257
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
258
|
+
import { dirname as dirname3, join as join6 } from "node:path";
|
|
252
259
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
253
260
|
try {
|
|
254
|
-
const pluginJson =
|
|
255
|
-
const plugin = JSON.parse(
|
|
261
|
+
const pluginJson = join6(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
262
|
+
const plugin = JSON.parse(readFileSync4(pluginJson, "utf-8"));
|
|
256
263
|
if (plugin.version)
|
|
257
264
|
return plugin.version;
|
|
258
265
|
} catch {
|
|
259
266
|
}
|
|
260
267
|
try {
|
|
261
|
-
const stamp =
|
|
268
|
+
const stamp = readFileSync4(join6(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
262
269
|
if (stamp)
|
|
263
270
|
return stamp;
|
|
264
271
|
} catch {
|
|
@@ -273,9 +280,9 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
273
280
|
]);
|
|
274
281
|
let dir = bundleDir;
|
|
275
282
|
for (let i = 0; i < 5; i++) {
|
|
276
|
-
const candidate =
|
|
283
|
+
const candidate = join6(dir, "package.json");
|
|
277
284
|
try {
|
|
278
|
-
const pkg = JSON.parse(
|
|
285
|
+
const pkg = JSON.parse(readFileSync4(candidate, "utf-8"));
|
|
279
286
|
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
280
287
|
return pkg.version;
|
|
281
288
|
} catch {
|
|
@@ -289,16 +296,16 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
289
296
|
}
|
|
290
297
|
|
|
291
298
|
// dist/src/config.js
|
|
292
|
-
import { readFileSync as
|
|
293
|
-
import { join as
|
|
294
|
-
import { homedir as
|
|
299
|
+
import { readFileSync as readFileSync5, existsSync as existsSync3 } from "node:fs";
|
|
300
|
+
import { join as join7 } from "node:path";
|
|
301
|
+
import { homedir as homedir6, userInfo } from "node:os";
|
|
295
302
|
function loadConfig() {
|
|
296
|
-
const home =
|
|
297
|
-
const credPath =
|
|
303
|
+
const home = homedir6();
|
|
304
|
+
const credPath = join7(home, ".deeplake", "credentials.json");
|
|
298
305
|
let creds = null;
|
|
299
306
|
if (existsSync3(credPath)) {
|
|
300
307
|
try {
|
|
301
|
-
creds = JSON.parse(
|
|
308
|
+
creds = JSON.parse(readFileSync5(credPath, "utf-8"));
|
|
302
309
|
} catch {
|
|
303
310
|
return null;
|
|
304
311
|
}
|
|
@@ -317,12 +324,12 @@ function loadConfig() {
|
|
|
317
324
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
318
325
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
319
326
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
320
|
-
memoryPath: process.env.HIVEMIND_MEMORY_PATH ??
|
|
327
|
+
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join7(home, ".deeplake", "memory")
|
|
321
328
|
};
|
|
322
329
|
}
|
|
323
330
|
|
|
324
331
|
// dist/src/deeplake-api.js
|
|
325
|
-
import { randomUUID } from "node:crypto";
|
|
332
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
326
333
|
|
|
327
334
|
// dist/src/utils/sql.js
|
|
328
335
|
function sqlStr(value) {
|
|
@@ -456,23 +463,23 @@ async function healMissingColumns(args) {
|
|
|
456
463
|
}
|
|
457
464
|
|
|
458
465
|
// dist/src/notifications/queue.js
|
|
459
|
-
import { readFileSync as
|
|
460
|
-
import { join as
|
|
461
|
-
import { homedir as
|
|
466
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, renameSync, mkdirSync as mkdirSync5, openSync as openSync2, closeSync as closeSync2, unlinkSync as unlinkSync3, statSync as statSync2 } from "node:fs";
|
|
467
|
+
import { join as join8, resolve } from "node:path";
|
|
468
|
+
import { homedir as homedir7 } from "node:os";
|
|
462
469
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
463
470
|
var log2 = (msg) => log("notifications-queue", msg);
|
|
464
471
|
var LOCK_RETRY_MAX = 50;
|
|
465
472
|
var LOCK_RETRY_BASE_MS = 5;
|
|
466
473
|
var LOCK_STALE_MS2 = 5e3;
|
|
467
474
|
function queuePath() {
|
|
468
|
-
return
|
|
475
|
+
return join8(homedir7(), ".deeplake", "notifications-queue.json");
|
|
469
476
|
}
|
|
470
477
|
function lockPath() {
|
|
471
478
|
return `${queuePath()}.lock`;
|
|
472
479
|
}
|
|
473
480
|
function readQueue() {
|
|
474
481
|
try {
|
|
475
|
-
const raw =
|
|
482
|
+
const raw = readFileSync6(queuePath(), "utf-8");
|
|
476
483
|
const parsed = JSON.parse(raw);
|
|
477
484
|
if (!parsed || !Array.isArray(parsed.queue)) {
|
|
478
485
|
log2(`queue malformed \u2192 treating as empty`);
|
|
@@ -490,18 +497,18 @@ function _isQueuePathInsideHome(path, home) {
|
|
|
490
497
|
}
|
|
491
498
|
function writeQueue(q) {
|
|
492
499
|
const path = queuePath();
|
|
493
|
-
const home = resolve(
|
|
500
|
+
const home = resolve(homedir7());
|
|
494
501
|
if (!_isQueuePathInsideHome(path, home)) {
|
|
495
502
|
throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
|
|
496
503
|
}
|
|
497
|
-
|
|
504
|
+
mkdirSync5(join8(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
498
505
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
499
|
-
|
|
506
|
+
writeFileSync4(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
500
507
|
renameSync(tmp, path);
|
|
501
508
|
}
|
|
502
509
|
async function withQueueLock(fn) {
|
|
503
510
|
const path = lockPath();
|
|
504
|
-
|
|
511
|
+
mkdirSync5(join8(homedir7(), ".deeplake"), { recursive: true, mode: 448 });
|
|
505
512
|
let fd = null;
|
|
506
513
|
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
507
514
|
try {
|
|
@@ -774,7 +781,7 @@ var DeeplakeApi = class {
|
|
|
774
781
|
setClauses += `, description = '${sqlStr(row.description)}'`;
|
|
775
782
|
await this.query(`UPDATE "${this.tableName}" SET ${setClauses} WHERE path = '${sqlStr(row.path)}'`);
|
|
776
783
|
} else {
|
|
777
|
-
const id =
|
|
784
|
+
const id = randomUUID2();
|
|
778
785
|
let cols = `id, path, filename, summary, ${SUMMARY_EMBEDDING_COL}, mime_type, size_bytes, creation_date, last_update_date`;
|
|
779
786
|
let vals = `'${id}', '${sqlStr(row.path)}', '${sqlStr(row.filename)}', E'${sqlStr(row.contentText)}', NULL, '${sqlStr(row.mimeType)}', ${row.sizeBytes}, '${cd}', '${lud}'`;
|
|
780
787
|
if (row.project !== void 0) {
|
|
@@ -972,14 +979,14 @@ var DeeplakeApi = class {
|
|
|
972
979
|
};
|
|
973
980
|
|
|
974
981
|
// dist/src/skillify/pull.js
|
|
975
|
-
import { existsSync as existsSync9, readFileSync as
|
|
976
|
-
import { homedir as
|
|
977
|
-
import { dirname as dirname6, join as
|
|
982
|
+
import { existsSync as existsSync9, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync9, renameSync as renameSync4, lstatSync as lstatSync2, readlinkSync, symlinkSync, unlinkSync as unlinkSync5 } from "node:fs";
|
|
983
|
+
import { homedir as homedir11 } from "node:os";
|
|
984
|
+
import { dirname as dirname6, join as join15 } from "node:path";
|
|
978
985
|
|
|
979
986
|
// dist/src/skillify/skill-writer.js
|
|
980
|
-
import { existsSync as existsSync5, mkdirSync as
|
|
981
|
-
import { homedir as
|
|
982
|
-
import { join as
|
|
987
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync7, readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
988
|
+
import { homedir as homedir8 } from "node:os";
|
|
989
|
+
import { join as join10 } from "node:path";
|
|
983
990
|
function assertValidSkillName(name) {
|
|
984
991
|
if (typeof name !== "string" || name.length === 0) {
|
|
985
992
|
throw new Error(`invalid skill name: empty or non-string`);
|
|
@@ -1045,19 +1052,19 @@ function parseFrontmatter(text) {
|
|
|
1045
1052
|
}
|
|
1046
1053
|
|
|
1047
1054
|
// dist/src/skillify/manifest.js
|
|
1048
|
-
import { existsSync as existsSync7, lstatSync, mkdirSync as
|
|
1049
|
-
import { dirname as dirname5, join as
|
|
1055
|
+
import { existsSync as existsSync7, lstatSync, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
1056
|
+
import { dirname as dirname5, join as join13 } from "node:path";
|
|
1050
1057
|
|
|
1051
1058
|
// dist/src/skillify/legacy-migration.js
|
|
1052
1059
|
import { existsSync as existsSync6, renameSync as renameSync2 } from "node:fs";
|
|
1053
|
-
import { dirname as dirname4, join as
|
|
1060
|
+
import { dirname as dirname4, join as join12 } from "node:path";
|
|
1054
1061
|
|
|
1055
1062
|
// dist/src/skillify/state-dir.js
|
|
1056
|
-
import { homedir as
|
|
1057
|
-
import { join as
|
|
1063
|
+
import { homedir as homedir9 } from "node:os";
|
|
1064
|
+
import { join as join11 } from "node:path";
|
|
1058
1065
|
function getStateDir() {
|
|
1059
1066
|
const override = process.env.HIVEMIND_STATE_DIR?.trim();
|
|
1060
|
-
return override && override.length > 0 ? override :
|
|
1067
|
+
return override && override.length > 0 ? override : join11(homedir9(), ".deeplake", "state", "skillify");
|
|
1061
1068
|
}
|
|
1062
1069
|
|
|
1063
1070
|
// dist/src/skillify/legacy-migration.js
|
|
@@ -1070,7 +1077,7 @@ function migrateLegacyStateDir() {
|
|
|
1070
1077
|
return;
|
|
1071
1078
|
attempted = true;
|
|
1072
1079
|
const current = getStateDir();
|
|
1073
|
-
const legacy =
|
|
1080
|
+
const legacy = join12(dirname4(current), "skilify");
|
|
1074
1081
|
if (!existsSync6(legacy))
|
|
1075
1082
|
return;
|
|
1076
1083
|
if (existsSync6(current))
|
|
@@ -1093,7 +1100,7 @@ function emptyManifest() {
|
|
|
1093
1100
|
return { version: 1, entries: [] };
|
|
1094
1101
|
}
|
|
1095
1102
|
function manifestPath() {
|
|
1096
|
-
return
|
|
1103
|
+
return join13(getStateDir(), "pulled.json");
|
|
1097
1104
|
}
|
|
1098
1105
|
function loadManifest(path = manifestPath()) {
|
|
1099
1106
|
migrateLegacyStateDir();
|
|
@@ -1101,7 +1108,7 @@ function loadManifest(path = manifestPath()) {
|
|
|
1101
1108
|
return emptyManifest();
|
|
1102
1109
|
let raw;
|
|
1103
1110
|
try {
|
|
1104
|
-
raw =
|
|
1111
|
+
raw = readFileSync9(path, "utf-8");
|
|
1105
1112
|
} catch {
|
|
1106
1113
|
return emptyManifest();
|
|
1107
1114
|
}
|
|
@@ -1148,9 +1155,9 @@ function loadManifest(path = manifestPath()) {
|
|
|
1148
1155
|
}
|
|
1149
1156
|
function saveManifest(m, path = manifestPath()) {
|
|
1150
1157
|
migrateLegacyStateDir();
|
|
1151
|
-
|
|
1158
|
+
mkdirSync8(dirname5(path), { recursive: true });
|
|
1152
1159
|
const tmp = `${path}.tmp`;
|
|
1153
|
-
|
|
1160
|
+
writeFileSync7(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
|
|
1154
1161
|
renameSync3(tmp, path);
|
|
1155
1162
|
}
|
|
1156
1163
|
function recordPull(entry, path = manifestPath()) {
|
|
@@ -1186,7 +1193,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1186
1193
|
const live = [];
|
|
1187
1194
|
let pruned = 0;
|
|
1188
1195
|
for (const e of m.entries) {
|
|
1189
|
-
if (existsSync7(
|
|
1196
|
+
if (existsSync7(join13(e.installRoot, e.dirName))) {
|
|
1190
1197
|
live.push(e);
|
|
1191
1198
|
continue;
|
|
1192
1199
|
}
|
|
@@ -1200,25 +1207,25 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1200
1207
|
|
|
1201
1208
|
// dist/src/skillify/agent-roots.js
|
|
1202
1209
|
import { existsSync as existsSync8 } from "node:fs";
|
|
1203
|
-
import { homedir as
|
|
1204
|
-
import { join as
|
|
1210
|
+
import { homedir as homedir10 } from "node:os";
|
|
1211
|
+
import { join as join14 } from "node:path";
|
|
1205
1212
|
function resolveDetected(home) {
|
|
1206
1213
|
const out = [];
|
|
1207
|
-
const codexInstalled = existsSync8(
|
|
1208
|
-
const piInstalled = existsSync8(
|
|
1209
|
-
const hermesInstalled = existsSync8(
|
|
1214
|
+
const codexInstalled = existsSync8(join14(home, ".codex"));
|
|
1215
|
+
const piInstalled = existsSync8(join14(home, ".pi", "agent"));
|
|
1216
|
+
const hermesInstalled = existsSync8(join14(home, ".hermes"));
|
|
1210
1217
|
if (codexInstalled || piInstalled) {
|
|
1211
|
-
out.push(
|
|
1218
|
+
out.push(join14(home, ".agents", "skills"));
|
|
1212
1219
|
}
|
|
1213
1220
|
if (hermesInstalled) {
|
|
1214
|
-
out.push(
|
|
1221
|
+
out.push(join14(home, ".hermes", "skills"));
|
|
1215
1222
|
}
|
|
1216
1223
|
if (piInstalled) {
|
|
1217
|
-
out.push(
|
|
1224
|
+
out.push(join14(home, ".pi", "agent", "skills"));
|
|
1218
1225
|
}
|
|
1219
1226
|
return out;
|
|
1220
1227
|
}
|
|
1221
|
-
function detectAgentSkillsRoots(canonicalRoot, home =
|
|
1228
|
+
function detectAgentSkillsRoots(canonicalRoot, home = homedir10()) {
|
|
1222
1229
|
return resolveDetected(home).filter((p) => p !== canonicalRoot);
|
|
1223
1230
|
}
|
|
1224
1231
|
|
|
@@ -1262,15 +1269,15 @@ function isMissingTableError(message) {
|
|
|
1262
1269
|
}
|
|
1263
1270
|
function resolvePullDestination(install, cwd) {
|
|
1264
1271
|
if (install === "global")
|
|
1265
|
-
return
|
|
1272
|
+
return join15(homedir11(), ".claude", "skills");
|
|
1266
1273
|
if (!cwd)
|
|
1267
1274
|
throw new Error("install=project requires a cwd");
|
|
1268
|
-
return
|
|
1275
|
+
return join15(cwd, ".claude", "skills");
|
|
1269
1276
|
}
|
|
1270
1277
|
function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
1271
1278
|
const out = [];
|
|
1272
1279
|
for (const root of agentRoots) {
|
|
1273
|
-
const link =
|
|
1280
|
+
const link = join15(root, dirName);
|
|
1274
1281
|
let existing;
|
|
1275
1282
|
try {
|
|
1276
1283
|
existing = lstatSync2(link);
|
|
@@ -1298,7 +1305,7 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
|
1298
1305
|
}
|
|
1299
1306
|
}
|
|
1300
1307
|
try {
|
|
1301
|
-
|
|
1308
|
+
mkdirSync9(dirname6(link), { recursive: true });
|
|
1302
1309
|
symlinkSync(canonicalDir, link, "dir");
|
|
1303
1310
|
out.push(link);
|
|
1304
1311
|
} catch {
|
|
@@ -1313,7 +1320,7 @@ function backfillSymlinks(installRoot) {
|
|
|
1313
1320
|
return;
|
|
1314
1321
|
const detected = detectAgentSkillsRoots(installRoot);
|
|
1315
1322
|
for (const entry of entries) {
|
|
1316
|
-
const canonical =
|
|
1323
|
+
const canonical = join15(entry.installRoot, entry.dirName);
|
|
1317
1324
|
if (!existsSync9(canonical))
|
|
1318
1325
|
continue;
|
|
1319
1326
|
const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
|
|
@@ -1427,7 +1434,7 @@ function readLocalVersion(path) {
|
|
|
1427
1434
|
if (!existsSync9(path))
|
|
1428
1435
|
return null;
|
|
1429
1436
|
try {
|
|
1430
|
-
const text =
|
|
1437
|
+
const text = readFileSync10(path, "utf-8");
|
|
1431
1438
|
const parsed = parseFrontmatter(text);
|
|
1432
1439
|
if (!parsed)
|
|
1433
1440
|
return null;
|
|
@@ -1522,8 +1529,8 @@ async function runPull(opts) {
|
|
|
1522
1529
|
summary.skipped++;
|
|
1523
1530
|
continue;
|
|
1524
1531
|
}
|
|
1525
|
-
const skillDir =
|
|
1526
|
-
const skillFile =
|
|
1532
|
+
const skillDir = join15(root, dirName);
|
|
1533
|
+
const skillFile = join15(skillDir, "SKILL.md");
|
|
1527
1534
|
const remoteVersion = Number(row.version ?? 1);
|
|
1528
1535
|
const localVersion = readLocalVersion(skillFile);
|
|
1529
1536
|
const action = decideAction({
|
|
@@ -1534,14 +1541,14 @@ async function runPull(opts) {
|
|
|
1534
1541
|
});
|
|
1535
1542
|
let manifestError;
|
|
1536
1543
|
if (action === "wrote") {
|
|
1537
|
-
|
|
1544
|
+
mkdirSync9(skillDir, { recursive: true });
|
|
1538
1545
|
if (existsSync9(skillFile)) {
|
|
1539
1546
|
try {
|
|
1540
1547
|
renameSync4(skillFile, `${skillFile}.bak`);
|
|
1541
1548
|
} catch {
|
|
1542
1549
|
}
|
|
1543
1550
|
}
|
|
1544
|
-
|
|
1551
|
+
writeFileSync8(skillFile, renderSkillFile(row));
|
|
1545
1552
|
const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir, dirName, detectAgentSkillsRoots(root)) : [];
|
|
1546
1553
|
try {
|
|
1547
1554
|
recordPull({
|
|
@@ -1651,7 +1658,7 @@ async function main() {
|
|
|
1651
1658
|
log5(`credentials loaded: org=${creds.orgName ?? creds.orgId}`);
|
|
1652
1659
|
}
|
|
1653
1660
|
if (creds?.token) {
|
|
1654
|
-
const setupScript =
|
|
1661
|
+
const setupScript = join16(__bundleDir, "session-start-setup.js");
|
|
1655
1662
|
const child = spawn2("node", [setupScript], {
|
|
1656
1663
|
detached: true,
|
|
1657
1664
|
stdio: ["pipe", "ignore", "ignore"],
|