@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 existsSync2, mkdirSync as
|
|
21
|
-
import { join as
|
|
20
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
21
|
+
import { join as join6 } 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 ?? join6(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 join6(getIndexMarkerDir(), `${markerKey}.json`);
|
|
29
29
|
}
|
|
30
30
|
function hasFreshIndexMarker(markerPath) {
|
|
31
31
|
if (!existsSync2(markerPath))
|
|
32
32
|
return false;
|
|
33
33
|
try {
|
|
34
|
-
const raw = JSON.parse(
|
|
34
|
+
const raw = JSON.parse(readFileSync5(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
|
+
mkdirSync4(getIndexMarkerDir(), { recursive: true });
|
|
45
|
+
writeFileSync4(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({
|
|
@@ -68,35 +68,41 @@ function deeplakeClientHeader() {
|
|
|
68
68
|
return { [DEEPLAKE_CLIENT_HEADER]: deeplakeClientValue() };
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
// dist/src/commands/
|
|
72
|
-
import { readFileSync, writeFileSync, mkdirSync
|
|
71
|
+
// dist/src/commands/install-id.js
|
|
72
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
73
73
|
import { join } from "node:path";
|
|
74
74
|
import { homedir } from "node:os";
|
|
75
|
+
import { randomUUID } from "node:crypto";
|
|
76
|
+
|
|
77
|
+
// dist/src/commands/auth-creds.js
|
|
78
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync } from "node:fs";
|
|
79
|
+
import { join as join2 } from "node:path";
|
|
80
|
+
import { homedir as homedir2 } from "node:os";
|
|
75
81
|
function configDir() {
|
|
76
|
-
return
|
|
82
|
+
return join2(homedir2(), ".deeplake");
|
|
77
83
|
}
|
|
78
84
|
function credsPath() {
|
|
79
|
-
return
|
|
85
|
+
return join2(configDir(), "credentials.json");
|
|
80
86
|
}
|
|
81
87
|
function loadCredentials() {
|
|
82
88
|
try {
|
|
83
|
-
return JSON.parse(
|
|
89
|
+
return JSON.parse(readFileSync2(credsPath(), "utf-8"));
|
|
84
90
|
} catch {
|
|
85
91
|
return null;
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
// dist/src/config.js
|
|
90
|
-
import { readFileSync as
|
|
91
|
-
import { join as
|
|
92
|
-
import { homedir as
|
|
96
|
+
import { readFileSync as readFileSync3, existsSync } from "node:fs";
|
|
97
|
+
import { join as join3 } from "node:path";
|
|
98
|
+
import { homedir as homedir3, userInfo } from "node:os";
|
|
93
99
|
function loadConfig() {
|
|
94
|
-
const home =
|
|
95
|
-
const credPath =
|
|
100
|
+
const home = homedir3();
|
|
101
|
+
const credPath = join3(home, ".deeplake", "credentials.json");
|
|
96
102
|
let creds = null;
|
|
97
103
|
if (existsSync(credPath)) {
|
|
98
104
|
try {
|
|
99
|
-
creds = JSON.parse(
|
|
105
|
+
creds = JSON.parse(readFileSync3(credPath, "utf-8"));
|
|
100
106
|
} catch {
|
|
101
107
|
return null;
|
|
102
108
|
}
|
|
@@ -115,18 +121,18 @@ function loadConfig() {
|
|
|
115
121
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
116
122
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
117
123
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
118
|
-
memoryPath: process.env.HIVEMIND_MEMORY_PATH ??
|
|
124
|
+
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join3(home, ".deeplake", "memory")
|
|
119
125
|
};
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
// dist/src/deeplake-api.js
|
|
123
|
-
import { randomUUID } from "node:crypto";
|
|
129
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
124
130
|
|
|
125
131
|
// dist/src/utils/debug.js
|
|
126
132
|
import { appendFileSync } from "node:fs";
|
|
127
|
-
import { join as
|
|
128
|
-
import { homedir as
|
|
129
|
-
var LOG =
|
|
133
|
+
import { join as join4 } from "node:path";
|
|
134
|
+
import { homedir as homedir4 } from "node:os";
|
|
135
|
+
var LOG = join4(homedir4(), ".deeplake", "hook-debug.log");
|
|
130
136
|
function isDebug() {
|
|
131
137
|
return process.env.HIVEMIND_DEBUG === "1";
|
|
132
138
|
}
|
|
@@ -269,23 +275,23 @@ async function healMissingColumns(args) {
|
|
|
269
275
|
}
|
|
270
276
|
|
|
271
277
|
// dist/src/notifications/queue.js
|
|
272
|
-
import { readFileSync as
|
|
273
|
-
import { join as
|
|
274
|
-
import { homedir as
|
|
278
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3, renameSync, mkdirSync as mkdirSync3, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
|
|
279
|
+
import { join as join5, resolve } from "node:path";
|
|
280
|
+
import { homedir as homedir5 } from "node:os";
|
|
275
281
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
276
282
|
var log2 = (msg) => log("notifications-queue", msg);
|
|
277
283
|
var LOCK_RETRY_MAX = 50;
|
|
278
284
|
var LOCK_RETRY_BASE_MS = 5;
|
|
279
285
|
var LOCK_STALE_MS = 5e3;
|
|
280
286
|
function queuePath() {
|
|
281
|
-
return
|
|
287
|
+
return join5(homedir5(), ".deeplake", "notifications-queue.json");
|
|
282
288
|
}
|
|
283
289
|
function lockPath() {
|
|
284
290
|
return `${queuePath()}.lock`;
|
|
285
291
|
}
|
|
286
292
|
function readQueue() {
|
|
287
293
|
try {
|
|
288
|
-
const raw =
|
|
294
|
+
const raw = readFileSync4(queuePath(), "utf-8");
|
|
289
295
|
const parsed = JSON.parse(raw);
|
|
290
296
|
if (!parsed || !Array.isArray(parsed.queue)) {
|
|
291
297
|
log2(`queue malformed \u2192 treating as empty`);
|
|
@@ -303,18 +309,18 @@ function _isQueuePathInsideHome(path, home) {
|
|
|
303
309
|
}
|
|
304
310
|
function writeQueue(q) {
|
|
305
311
|
const path = queuePath();
|
|
306
|
-
const home = resolve(
|
|
312
|
+
const home = resolve(homedir5());
|
|
307
313
|
if (!_isQueuePathInsideHome(path, home)) {
|
|
308
314
|
throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
|
|
309
315
|
}
|
|
310
|
-
|
|
316
|
+
mkdirSync3(join5(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
311
317
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
312
|
-
|
|
318
|
+
writeFileSync3(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
313
319
|
renameSync(tmp, path);
|
|
314
320
|
}
|
|
315
321
|
async function withQueueLock(fn) {
|
|
316
322
|
const path = lockPath();
|
|
317
|
-
|
|
323
|
+
mkdirSync3(join5(homedir5(), ".deeplake"), { recursive: true, mode: 448 });
|
|
318
324
|
let fd = null;
|
|
319
325
|
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
320
326
|
try {
|
|
@@ -587,7 +593,7 @@ var DeeplakeApi = class {
|
|
|
587
593
|
setClauses += `, description = '${sqlStr(row.description)}'`;
|
|
588
594
|
await this.query(`UPDATE "${this.tableName}" SET ${setClauses} WHERE path = '${sqlStr(row.path)}'`);
|
|
589
595
|
} else {
|
|
590
|
-
const id =
|
|
596
|
+
const id = randomUUID2();
|
|
591
597
|
let cols = `id, path, filename, summary, ${SUMMARY_EMBEDDING_COL}, mime_type, size_bytes, creation_date, last_update_date`;
|
|
592
598
|
let vals = `'${id}', '${sqlStr(row.path)}', '${sqlStr(row.filename)}', E'${sqlStr(row.contentText)}', NULL, '${sqlStr(row.mimeType)}', ${row.sizeBytes}, '${cd}', '${lud}'`;
|
|
593
599
|
if (row.project !== void 0) {
|
|
@@ -814,16 +820,16 @@ function renderSkillifyCommands() {
|
|
|
814
820
|
}
|
|
815
821
|
|
|
816
822
|
// dist/src/skillify/local-manifest.js
|
|
817
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
818
|
-
import { homedir as
|
|
819
|
-
import { dirname, join as
|
|
820
|
-
var LOCAL_MANIFEST_PATH =
|
|
821
|
-
var LOCAL_MINE_LOCK_PATH =
|
|
823
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
824
|
+
import { homedir as homedir6 } from "node:os";
|
|
825
|
+
import { dirname, join as join7 } from "node:path";
|
|
826
|
+
var LOCAL_MANIFEST_PATH = join7(homedir6(), ".claude", "hivemind", "local-mined.json");
|
|
827
|
+
var LOCAL_MINE_LOCK_PATH = join7(homedir6(), ".claude", "hivemind", "local-mined.lock");
|
|
822
828
|
function readLocalManifest(path = LOCAL_MANIFEST_PATH) {
|
|
823
829
|
if (!existsSync3(path))
|
|
824
830
|
return null;
|
|
825
831
|
try {
|
|
826
|
-
return JSON.parse(
|
|
832
|
+
return JSON.parse(readFileSync6(path, "utf-8"));
|
|
827
833
|
} catch {
|
|
828
834
|
return null;
|
|
829
835
|
}
|
|
@@ -832,22 +838,23 @@ function countLocalManifestEntries(path = LOCAL_MANIFEST_PATH) {
|
|
|
832
838
|
const m = readLocalManifest(path);
|
|
833
839
|
return Array.isArray(m?.entries) ? m.entries.length : 0;
|
|
834
840
|
}
|
|
841
|
+
var LATEST_RUN_WINDOW_MS = 5 * 60 * 1e3;
|
|
835
842
|
|
|
836
843
|
// dist/src/skillify/spawn-mine-local-worker.js
|
|
837
844
|
import { execFileSync, spawn } from "node:child_process";
|
|
838
|
-
import { closeSync as closeSync2, existsSync as existsSync4, mkdirSync as
|
|
839
|
-
import { homedir as
|
|
840
|
-
import { dirname as dirname2, join as
|
|
845
|
+
import { closeSync as closeSync2, existsSync as existsSync4, mkdirSync as mkdirSync6, openSync as openSync2, readdirSync, statSync as statSync2, unlinkSync as unlinkSync3 } from "node:fs";
|
|
846
|
+
import { homedir as homedir7 } from "node:os";
|
|
847
|
+
import { dirname as dirname2, join as join8 } from "node:path";
|
|
841
848
|
import { fileURLToPath } from "node:url";
|
|
842
|
-
var HOME =
|
|
843
|
-
var HIVEMIND_DIR =
|
|
844
|
-
var LOG_PATH =
|
|
845
|
-
var CLAUDE_PROJECTS_DIR =
|
|
849
|
+
var HOME = homedir7();
|
|
850
|
+
var HIVEMIND_DIR = join8(HOME, ".claude", "hivemind");
|
|
851
|
+
var LOG_PATH = join8(HOME, ".claude", "hooks", "mine-local.log");
|
|
852
|
+
var CLAUDE_PROJECTS_DIR = join8(HOME, ".claude", "projects");
|
|
846
853
|
var LOCK_STALE_MS2 = 15 * 60 * 1e3;
|
|
847
854
|
function findBundledCliPath() {
|
|
848
855
|
try {
|
|
849
856
|
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
850
|
-
const cliPath =
|
|
857
|
+
const cliPath = join8(thisDir, "..", "..", "bundle", "cli.js");
|
|
851
858
|
return existsSync4(cliPath) ? cliPath : null;
|
|
852
859
|
} catch {
|
|
853
860
|
return null;
|
|
@@ -880,7 +887,7 @@ function hasLocalClaudeSessions() {
|
|
|
880
887
|
for (const sub of subdirs) {
|
|
881
888
|
let files;
|
|
882
889
|
try {
|
|
883
|
-
files = readdirSync(
|
|
890
|
+
files = readdirSync(join8(CLAUDE_PROJECTS_DIR, sub));
|
|
884
891
|
} catch {
|
|
885
892
|
continue;
|
|
886
893
|
}
|
|
@@ -913,14 +920,14 @@ function maybeAutoMineLocal() {
|
|
|
913
920
|
if (!launcher)
|
|
914
921
|
return { triggered: false, reason: "no-hivemind-bin" };
|
|
915
922
|
try {
|
|
916
|
-
|
|
923
|
+
mkdirSync6(HIVEMIND_DIR, { recursive: true });
|
|
917
924
|
const fd = openSync2(LOCAL_MINE_LOCK_PATH, "wx");
|
|
918
925
|
closeSync2(fd);
|
|
919
926
|
} catch {
|
|
920
927
|
return { triggered: false, reason: "lock-acquire-failed" };
|
|
921
928
|
}
|
|
922
929
|
try {
|
|
923
|
-
|
|
930
|
+
mkdirSync6(join8(HOME, ".claude", "hooks"), { recursive: true });
|
|
924
931
|
const out = openSync2(LOG_PATH, "a");
|
|
925
932
|
const [cmd, args] = launcher.kind === "node-script" ? [process.execPath, [launcher.path, "skillify", "mine-local"]] : [launcher.path, ["skillify", "mine-local"]];
|
|
926
933
|
const child = spawn(cmd, args, {
|
|
@@ -958,18 +965,18 @@ function readStdin() {
|
|
|
958
965
|
}
|
|
959
966
|
|
|
960
967
|
// dist/src/utils/version-check.js
|
|
961
|
-
import { readFileSync as
|
|
962
|
-
import { dirname as dirname3, join as
|
|
968
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
969
|
+
import { dirname as dirname3, join as join9 } from "node:path";
|
|
963
970
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
964
971
|
try {
|
|
965
|
-
const pluginJson =
|
|
966
|
-
const plugin = JSON.parse(
|
|
972
|
+
const pluginJson = join9(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
973
|
+
const plugin = JSON.parse(readFileSync7(pluginJson, "utf-8"));
|
|
967
974
|
if (plugin.version)
|
|
968
975
|
return plugin.version;
|
|
969
976
|
} catch {
|
|
970
977
|
}
|
|
971
978
|
try {
|
|
972
|
-
const stamp =
|
|
979
|
+
const stamp = readFileSync7(join9(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
973
980
|
if (stamp)
|
|
974
981
|
return stamp;
|
|
975
982
|
} catch {
|
|
@@ -984,9 +991,9 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
984
991
|
]);
|
|
985
992
|
let dir = bundleDir;
|
|
986
993
|
for (let i = 0; i < 5; i++) {
|
|
987
|
-
const candidate =
|
|
994
|
+
const candidate = join9(dir, "package.json");
|
|
988
995
|
try {
|
|
989
|
-
const pkg = JSON.parse(
|
|
996
|
+
const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
|
|
990
997
|
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
991
998
|
return pkg.version;
|
|
992
999
|
} catch {
|
|
@@ -1002,7 +1009,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
1002
1009
|
// dist/src/hooks/shared/autoupdate.js
|
|
1003
1010
|
import { spawn as spawn2 } from "node:child_process";
|
|
1004
1011
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1005
|
-
import { join as
|
|
1012
|
+
import { join as join10 } from "node:path";
|
|
1006
1013
|
var log4 = (msg) => log("autoupdate", msg);
|
|
1007
1014
|
var defaultSpawn = (cmd, args) => {
|
|
1008
1015
|
const child = spawn2(cmd, args, {
|
|
@@ -1018,7 +1025,7 @@ function findHivemindOnPath() {
|
|
|
1018
1025
|
const PATH = process.env.PATH ?? "";
|
|
1019
1026
|
const dirs = PATH.split(":").filter(Boolean);
|
|
1020
1027
|
for (const dir of dirs) {
|
|
1021
|
-
const candidate =
|
|
1028
|
+
const candidate = join10(dir, "hivemind");
|
|
1022
1029
|
if (existsSync5(candidate))
|
|
1023
1030
|
return candidate;
|
|
1024
1031
|
}
|
|
@@ -1053,14 +1060,14 @@ async function autoUpdate(creds, opts) {
|
|
|
1053
1060
|
}
|
|
1054
1061
|
|
|
1055
1062
|
// dist/src/skillify/pull.js
|
|
1056
|
-
import { existsSync as existsSync10, readFileSync as
|
|
1057
|
-
import { homedir as
|
|
1058
|
-
import { dirname as dirname6, join as
|
|
1063
|
+
import { existsSync as existsSync10, readFileSync as readFileSync10, writeFileSync as writeFileSync8, mkdirSync as mkdirSync9, renameSync as renameSync4, lstatSync as lstatSync2, readlinkSync, symlinkSync, unlinkSync as unlinkSync5 } from "node:fs";
|
|
1064
|
+
import { homedir as homedir11 } from "node:os";
|
|
1065
|
+
import { dirname as dirname6, join as join16 } from "node:path";
|
|
1059
1066
|
|
|
1060
1067
|
// dist/src/skillify/skill-writer.js
|
|
1061
|
-
import { existsSync as existsSync6, mkdirSync as
|
|
1062
|
-
import { homedir as
|
|
1063
|
-
import { join as
|
|
1068
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync7, readFileSync as readFileSync8, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
1069
|
+
import { homedir as homedir8 } from "node:os";
|
|
1070
|
+
import { join as join11 } from "node:path";
|
|
1064
1071
|
function assertValidSkillName(name) {
|
|
1065
1072
|
if (typeof name !== "string" || name.length === 0) {
|
|
1066
1073
|
throw new Error(`invalid skill name: empty or non-string`);
|
|
@@ -1126,19 +1133,19 @@ function parseFrontmatter(text) {
|
|
|
1126
1133
|
}
|
|
1127
1134
|
|
|
1128
1135
|
// dist/src/skillify/manifest.js
|
|
1129
|
-
import { existsSync as existsSync8, lstatSync, mkdirSync as
|
|
1130
|
-
import { dirname as dirname5, join as
|
|
1136
|
+
import { existsSync as existsSync8, lstatSync, mkdirSync as mkdirSync8, readFileSync as readFileSync9, renameSync as renameSync3, unlinkSync as unlinkSync4, writeFileSync as writeFileSync7 } from "node:fs";
|
|
1137
|
+
import { dirname as dirname5, join as join14 } from "node:path";
|
|
1131
1138
|
|
|
1132
1139
|
// dist/src/skillify/legacy-migration.js
|
|
1133
1140
|
import { existsSync as existsSync7, renameSync as renameSync2 } from "node:fs";
|
|
1134
|
-
import { dirname as dirname4, join as
|
|
1141
|
+
import { dirname as dirname4, join as join13 } from "node:path";
|
|
1135
1142
|
|
|
1136
1143
|
// dist/src/skillify/state-dir.js
|
|
1137
|
-
import { homedir as
|
|
1138
|
-
import { join as
|
|
1144
|
+
import { homedir as homedir9 } from "node:os";
|
|
1145
|
+
import { join as join12 } from "node:path";
|
|
1139
1146
|
function getStateDir() {
|
|
1140
1147
|
const override = process.env.HIVEMIND_STATE_DIR?.trim();
|
|
1141
|
-
return override && override.length > 0 ? override :
|
|
1148
|
+
return override && override.length > 0 ? override : join12(homedir9(), ".deeplake", "state", "skillify");
|
|
1142
1149
|
}
|
|
1143
1150
|
|
|
1144
1151
|
// dist/src/skillify/legacy-migration.js
|
|
@@ -1151,7 +1158,7 @@ function migrateLegacyStateDir() {
|
|
|
1151
1158
|
return;
|
|
1152
1159
|
attempted = true;
|
|
1153
1160
|
const current = getStateDir();
|
|
1154
|
-
const legacy =
|
|
1161
|
+
const legacy = join13(dirname4(current), "skilify");
|
|
1155
1162
|
if (!existsSync7(legacy))
|
|
1156
1163
|
return;
|
|
1157
1164
|
if (existsSync7(current))
|
|
@@ -1174,7 +1181,7 @@ function emptyManifest() {
|
|
|
1174
1181
|
return { version: 1, entries: [] };
|
|
1175
1182
|
}
|
|
1176
1183
|
function manifestPath() {
|
|
1177
|
-
return
|
|
1184
|
+
return join14(getStateDir(), "pulled.json");
|
|
1178
1185
|
}
|
|
1179
1186
|
function loadManifest(path = manifestPath()) {
|
|
1180
1187
|
migrateLegacyStateDir();
|
|
@@ -1182,7 +1189,7 @@ function loadManifest(path = manifestPath()) {
|
|
|
1182
1189
|
return emptyManifest();
|
|
1183
1190
|
let raw;
|
|
1184
1191
|
try {
|
|
1185
|
-
raw =
|
|
1192
|
+
raw = readFileSync9(path, "utf-8");
|
|
1186
1193
|
} catch {
|
|
1187
1194
|
return emptyManifest();
|
|
1188
1195
|
}
|
|
@@ -1229,9 +1236,9 @@ function loadManifest(path = manifestPath()) {
|
|
|
1229
1236
|
}
|
|
1230
1237
|
function saveManifest(m, path = manifestPath()) {
|
|
1231
1238
|
migrateLegacyStateDir();
|
|
1232
|
-
|
|
1239
|
+
mkdirSync8(dirname5(path), { recursive: true });
|
|
1233
1240
|
const tmp = `${path}.tmp`;
|
|
1234
|
-
|
|
1241
|
+
writeFileSync7(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
|
|
1235
1242
|
renameSync3(tmp, path);
|
|
1236
1243
|
}
|
|
1237
1244
|
function recordPull(entry, path = manifestPath()) {
|
|
@@ -1267,7 +1274,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1267
1274
|
const live = [];
|
|
1268
1275
|
let pruned = 0;
|
|
1269
1276
|
for (const e of m.entries) {
|
|
1270
|
-
if (existsSync8(
|
|
1277
|
+
if (existsSync8(join14(e.installRoot, e.dirName))) {
|
|
1271
1278
|
live.push(e);
|
|
1272
1279
|
continue;
|
|
1273
1280
|
}
|
|
@@ -1281,25 +1288,25 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1281
1288
|
|
|
1282
1289
|
// dist/src/skillify/agent-roots.js
|
|
1283
1290
|
import { existsSync as existsSync9 } from "node:fs";
|
|
1284
|
-
import { homedir as
|
|
1285
|
-
import { join as
|
|
1291
|
+
import { homedir as homedir10 } from "node:os";
|
|
1292
|
+
import { join as join15 } from "node:path";
|
|
1286
1293
|
function resolveDetected(home) {
|
|
1287
1294
|
const out = [];
|
|
1288
|
-
const codexInstalled = existsSync9(
|
|
1289
|
-
const piInstalled = existsSync9(
|
|
1290
|
-
const hermesInstalled = existsSync9(
|
|
1295
|
+
const codexInstalled = existsSync9(join15(home, ".codex"));
|
|
1296
|
+
const piInstalled = existsSync9(join15(home, ".pi", "agent"));
|
|
1297
|
+
const hermesInstalled = existsSync9(join15(home, ".hermes"));
|
|
1291
1298
|
if (codexInstalled || piInstalled) {
|
|
1292
|
-
out.push(
|
|
1299
|
+
out.push(join15(home, ".agents", "skills"));
|
|
1293
1300
|
}
|
|
1294
1301
|
if (hermesInstalled) {
|
|
1295
|
-
out.push(
|
|
1302
|
+
out.push(join15(home, ".hermes", "skills"));
|
|
1296
1303
|
}
|
|
1297
1304
|
if (piInstalled) {
|
|
1298
|
-
out.push(
|
|
1305
|
+
out.push(join15(home, ".pi", "agent", "skills"));
|
|
1299
1306
|
}
|
|
1300
1307
|
return out;
|
|
1301
1308
|
}
|
|
1302
|
-
function detectAgentSkillsRoots(canonicalRoot, home =
|
|
1309
|
+
function detectAgentSkillsRoots(canonicalRoot, home = homedir10()) {
|
|
1303
1310
|
return resolveDetected(home).filter((p) => p !== canonicalRoot);
|
|
1304
1311
|
}
|
|
1305
1312
|
|
|
@@ -1343,15 +1350,15 @@ function isMissingTableError(message) {
|
|
|
1343
1350
|
}
|
|
1344
1351
|
function resolvePullDestination(install, cwd) {
|
|
1345
1352
|
if (install === "global")
|
|
1346
|
-
return
|
|
1353
|
+
return join16(homedir11(), ".claude", "skills");
|
|
1347
1354
|
if (!cwd)
|
|
1348
1355
|
throw new Error("install=project requires a cwd");
|
|
1349
|
-
return
|
|
1356
|
+
return join16(cwd, ".claude", "skills");
|
|
1350
1357
|
}
|
|
1351
1358
|
function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
1352
1359
|
const out = [];
|
|
1353
1360
|
for (const root of agentRoots) {
|
|
1354
|
-
const link =
|
|
1361
|
+
const link = join16(root, dirName);
|
|
1355
1362
|
let existing;
|
|
1356
1363
|
try {
|
|
1357
1364
|
existing = lstatSync2(link);
|
|
@@ -1379,7 +1386,7 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
|
1379
1386
|
}
|
|
1380
1387
|
}
|
|
1381
1388
|
try {
|
|
1382
|
-
|
|
1389
|
+
mkdirSync9(dirname6(link), { recursive: true });
|
|
1383
1390
|
symlinkSync(canonicalDir, link, "dir");
|
|
1384
1391
|
out.push(link);
|
|
1385
1392
|
} catch {
|
|
@@ -1394,7 +1401,7 @@ function backfillSymlinks(installRoot) {
|
|
|
1394
1401
|
return;
|
|
1395
1402
|
const detected = detectAgentSkillsRoots(installRoot);
|
|
1396
1403
|
for (const entry of entries) {
|
|
1397
|
-
const canonical =
|
|
1404
|
+
const canonical = join16(entry.installRoot, entry.dirName);
|
|
1398
1405
|
if (!existsSync10(canonical))
|
|
1399
1406
|
continue;
|
|
1400
1407
|
const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
|
|
@@ -1508,7 +1515,7 @@ function readLocalVersion(path) {
|
|
|
1508
1515
|
if (!existsSync10(path))
|
|
1509
1516
|
return null;
|
|
1510
1517
|
try {
|
|
1511
|
-
const text =
|
|
1518
|
+
const text = readFileSync10(path, "utf-8");
|
|
1512
1519
|
const parsed = parseFrontmatter(text);
|
|
1513
1520
|
if (!parsed)
|
|
1514
1521
|
return null;
|
|
@@ -1603,8 +1610,8 @@ async function runPull(opts) {
|
|
|
1603
1610
|
summary.skipped++;
|
|
1604
1611
|
continue;
|
|
1605
1612
|
}
|
|
1606
|
-
const skillDir =
|
|
1607
|
-
const skillFile =
|
|
1613
|
+
const skillDir = join16(root, dirName);
|
|
1614
|
+
const skillFile = join16(skillDir, "SKILL.md");
|
|
1608
1615
|
const remoteVersion = Number(row.version ?? 1);
|
|
1609
1616
|
const localVersion = readLocalVersion(skillFile);
|
|
1610
1617
|
const action = decideAction({
|
|
@@ -1615,14 +1622,14 @@ async function runPull(opts) {
|
|
|
1615
1622
|
});
|
|
1616
1623
|
let manifestError;
|
|
1617
1624
|
if (action === "wrote") {
|
|
1618
|
-
|
|
1625
|
+
mkdirSync9(skillDir, { recursive: true });
|
|
1619
1626
|
if (existsSync10(skillFile)) {
|
|
1620
1627
|
try {
|
|
1621
1628
|
renameSync4(skillFile, `${skillFile}.bak`);
|
|
1622
1629
|
} catch {
|
|
1623
1630
|
}
|
|
1624
1631
|
}
|
|
1625
|
-
|
|
1632
|
+
writeFileSync8(skillFile, renderSkillFile(row));
|
|
1626
1633
|
const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir, dirName, detectAgentSkillsRoots(root)) : [];
|
|
1627
1634
|
try {
|
|
1628
1635
|
recordPull({
|