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