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