@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 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
|
}
|
|
@@ -835,19 +841,19 @@ function countLocalManifestEntries(path = LOCAL_MANIFEST_PATH) {
|
|
|
835
841
|
|
|
836
842
|
// dist/src/skillify/spawn-mine-local-worker.js
|
|
837
843
|
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
|
|
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";
|
|
841
847
|
import { fileURLToPath } from "node:url";
|
|
842
|
-
var HOME =
|
|
843
|
-
var HIVEMIND_DIR =
|
|
844
|
-
var LOG_PATH =
|
|
845
|
-
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");
|
|
846
852
|
var LOCK_STALE_MS2 = 15 * 60 * 1e3;
|
|
847
853
|
function findBundledCliPath() {
|
|
848
854
|
try {
|
|
849
855
|
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
850
|
-
const cliPath =
|
|
856
|
+
const cliPath = join8(thisDir, "..", "..", "bundle", "cli.js");
|
|
851
857
|
return existsSync4(cliPath) ? cliPath : null;
|
|
852
858
|
} catch {
|
|
853
859
|
return null;
|
|
@@ -880,7 +886,7 @@ function hasLocalClaudeSessions() {
|
|
|
880
886
|
for (const sub of subdirs) {
|
|
881
887
|
let files;
|
|
882
888
|
try {
|
|
883
|
-
files = readdirSync(
|
|
889
|
+
files = readdirSync(join8(CLAUDE_PROJECTS_DIR, sub));
|
|
884
890
|
} catch {
|
|
885
891
|
continue;
|
|
886
892
|
}
|
|
@@ -913,14 +919,14 @@ function maybeAutoMineLocal() {
|
|
|
913
919
|
if (!launcher)
|
|
914
920
|
return { triggered: false, reason: "no-hivemind-bin" };
|
|
915
921
|
try {
|
|
916
|
-
|
|
922
|
+
mkdirSync6(HIVEMIND_DIR, { recursive: true });
|
|
917
923
|
const fd = openSync2(LOCAL_MINE_LOCK_PATH, "wx");
|
|
918
924
|
closeSync2(fd);
|
|
919
925
|
} catch {
|
|
920
926
|
return { triggered: false, reason: "lock-acquire-failed" };
|
|
921
927
|
}
|
|
922
928
|
try {
|
|
923
|
-
|
|
929
|
+
mkdirSync6(join8(HOME, ".claude", "hooks"), { recursive: true });
|
|
924
930
|
const out = openSync2(LOG_PATH, "a");
|
|
925
931
|
const [cmd, args] = launcher.kind === "node-script" ? [process.execPath, [launcher.path, "skillify", "mine-local"]] : [launcher.path, ["skillify", "mine-local"]];
|
|
926
932
|
const child = spawn(cmd, args, {
|
|
@@ -958,18 +964,18 @@ function readStdin() {
|
|
|
958
964
|
}
|
|
959
965
|
|
|
960
966
|
// dist/src/utils/version-check.js
|
|
961
|
-
import { readFileSync as
|
|
962
|
-
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";
|
|
963
969
|
function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
964
970
|
try {
|
|
965
|
-
const pluginJson =
|
|
966
|
-
const plugin = JSON.parse(
|
|
971
|
+
const pluginJson = join9(bundleDir, "..", pluginManifestDir, "plugin.json");
|
|
972
|
+
const plugin = JSON.parse(readFileSync7(pluginJson, "utf-8"));
|
|
967
973
|
if (plugin.version)
|
|
968
974
|
return plugin.version;
|
|
969
975
|
} catch {
|
|
970
976
|
}
|
|
971
977
|
try {
|
|
972
|
-
const stamp =
|
|
978
|
+
const stamp = readFileSync7(join9(bundleDir, "..", ".hivemind_version"), "utf-8").trim();
|
|
973
979
|
if (stamp)
|
|
974
980
|
return stamp;
|
|
975
981
|
} catch {
|
|
@@ -984,9 +990,9 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
984
990
|
]);
|
|
985
991
|
let dir = bundleDir;
|
|
986
992
|
for (let i = 0; i < 5; i++) {
|
|
987
|
-
const candidate =
|
|
993
|
+
const candidate = join9(dir, "package.json");
|
|
988
994
|
try {
|
|
989
|
-
const pkg = JSON.parse(
|
|
995
|
+
const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
|
|
990
996
|
if (HIVEMIND_PKG_NAMES.has(pkg.name) && pkg.version)
|
|
991
997
|
return pkg.version;
|
|
992
998
|
} catch {
|
|
@@ -1002,7 +1008,7 @@ function getInstalledVersion(bundleDir, pluginManifestDir) {
|
|
|
1002
1008
|
// dist/src/hooks/shared/autoupdate.js
|
|
1003
1009
|
import { spawn as spawn2 } from "node:child_process";
|
|
1004
1010
|
import { existsSync as existsSync5 } from "node:fs";
|
|
1005
|
-
import { join as
|
|
1011
|
+
import { join as join10 } from "node:path";
|
|
1006
1012
|
var log4 = (msg) => log("autoupdate", msg);
|
|
1007
1013
|
var defaultSpawn = (cmd, args) => {
|
|
1008
1014
|
const child = spawn2(cmd, args, {
|
|
@@ -1018,7 +1024,7 @@ function findHivemindOnPath() {
|
|
|
1018
1024
|
const PATH = process.env.PATH ?? "";
|
|
1019
1025
|
const dirs = PATH.split(":").filter(Boolean);
|
|
1020
1026
|
for (const dir of dirs) {
|
|
1021
|
-
const candidate =
|
|
1027
|
+
const candidate = join10(dir, "hivemind");
|
|
1022
1028
|
if (existsSync5(candidate))
|
|
1023
1029
|
return candidate;
|
|
1024
1030
|
}
|
|
@@ -1053,14 +1059,14 @@ async function autoUpdate(creds, opts) {
|
|
|
1053
1059
|
}
|
|
1054
1060
|
|
|
1055
1061
|
// dist/src/skillify/pull.js
|
|
1056
|
-
import { existsSync as existsSync10, readFileSync as
|
|
1057
|
-
import { homedir as
|
|
1058
|
-
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";
|
|
1059
1065
|
|
|
1060
1066
|
// dist/src/skillify/skill-writer.js
|
|
1061
|
-
import { existsSync as existsSync6, mkdirSync as
|
|
1062
|
-
import { homedir as
|
|
1063
|
-
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";
|
|
1064
1070
|
function assertValidSkillName(name) {
|
|
1065
1071
|
if (typeof name !== "string" || name.length === 0) {
|
|
1066
1072
|
throw new Error(`invalid skill name: empty or non-string`);
|
|
@@ -1126,19 +1132,19 @@ function parseFrontmatter(text) {
|
|
|
1126
1132
|
}
|
|
1127
1133
|
|
|
1128
1134
|
// dist/src/skillify/manifest.js
|
|
1129
|
-
import { existsSync as existsSync8, lstatSync, mkdirSync as
|
|
1130
|
-
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";
|
|
1131
1137
|
|
|
1132
1138
|
// dist/src/skillify/legacy-migration.js
|
|
1133
1139
|
import { existsSync as existsSync7, renameSync as renameSync2 } from "node:fs";
|
|
1134
|
-
import { dirname as dirname4, join as
|
|
1140
|
+
import { dirname as dirname4, join as join13 } from "node:path";
|
|
1135
1141
|
|
|
1136
1142
|
// dist/src/skillify/state-dir.js
|
|
1137
|
-
import { homedir as
|
|
1138
|
-
import { join as
|
|
1143
|
+
import { homedir as homedir9 } from "node:os";
|
|
1144
|
+
import { join as join12 } from "node:path";
|
|
1139
1145
|
function getStateDir() {
|
|
1140
1146
|
const override = process.env.HIVEMIND_STATE_DIR?.trim();
|
|
1141
|
-
return override && override.length > 0 ? override :
|
|
1147
|
+
return override && override.length > 0 ? override : join12(homedir9(), ".deeplake", "state", "skillify");
|
|
1142
1148
|
}
|
|
1143
1149
|
|
|
1144
1150
|
// dist/src/skillify/legacy-migration.js
|
|
@@ -1151,7 +1157,7 @@ function migrateLegacyStateDir() {
|
|
|
1151
1157
|
return;
|
|
1152
1158
|
attempted = true;
|
|
1153
1159
|
const current = getStateDir();
|
|
1154
|
-
const legacy =
|
|
1160
|
+
const legacy = join13(dirname4(current), "skilify");
|
|
1155
1161
|
if (!existsSync7(legacy))
|
|
1156
1162
|
return;
|
|
1157
1163
|
if (existsSync7(current))
|
|
@@ -1174,7 +1180,7 @@ function emptyManifest() {
|
|
|
1174
1180
|
return { version: 1, entries: [] };
|
|
1175
1181
|
}
|
|
1176
1182
|
function manifestPath() {
|
|
1177
|
-
return
|
|
1183
|
+
return join14(getStateDir(), "pulled.json");
|
|
1178
1184
|
}
|
|
1179
1185
|
function loadManifest(path = manifestPath()) {
|
|
1180
1186
|
migrateLegacyStateDir();
|
|
@@ -1182,7 +1188,7 @@ function loadManifest(path = manifestPath()) {
|
|
|
1182
1188
|
return emptyManifest();
|
|
1183
1189
|
let raw;
|
|
1184
1190
|
try {
|
|
1185
|
-
raw =
|
|
1191
|
+
raw = readFileSync9(path, "utf-8");
|
|
1186
1192
|
} catch {
|
|
1187
1193
|
return emptyManifest();
|
|
1188
1194
|
}
|
|
@@ -1229,9 +1235,9 @@ function loadManifest(path = manifestPath()) {
|
|
|
1229
1235
|
}
|
|
1230
1236
|
function saveManifest(m, path = manifestPath()) {
|
|
1231
1237
|
migrateLegacyStateDir();
|
|
1232
|
-
|
|
1238
|
+
mkdirSync8(dirname5(path), { recursive: true });
|
|
1233
1239
|
const tmp = `${path}.tmp`;
|
|
1234
|
-
|
|
1240
|
+
writeFileSync7(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
|
|
1235
1241
|
renameSync3(tmp, path);
|
|
1236
1242
|
}
|
|
1237
1243
|
function recordPull(entry, path = manifestPath()) {
|
|
@@ -1267,7 +1273,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1267
1273
|
const live = [];
|
|
1268
1274
|
let pruned = 0;
|
|
1269
1275
|
for (const e of m.entries) {
|
|
1270
|
-
if (existsSync8(
|
|
1276
|
+
if (existsSync8(join14(e.installRoot, e.dirName))) {
|
|
1271
1277
|
live.push(e);
|
|
1272
1278
|
continue;
|
|
1273
1279
|
}
|
|
@@ -1281,25 +1287,25 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
1281
1287
|
|
|
1282
1288
|
// dist/src/skillify/agent-roots.js
|
|
1283
1289
|
import { existsSync as existsSync9 } from "node:fs";
|
|
1284
|
-
import { homedir as
|
|
1285
|
-
import { join as
|
|
1290
|
+
import { homedir as homedir10 } from "node:os";
|
|
1291
|
+
import { join as join15 } from "node:path";
|
|
1286
1292
|
function resolveDetected(home) {
|
|
1287
1293
|
const out = [];
|
|
1288
|
-
const codexInstalled = existsSync9(
|
|
1289
|
-
const piInstalled = existsSync9(
|
|
1290
|
-
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"));
|
|
1291
1297
|
if (codexInstalled || piInstalled) {
|
|
1292
|
-
out.push(
|
|
1298
|
+
out.push(join15(home, ".agents", "skills"));
|
|
1293
1299
|
}
|
|
1294
1300
|
if (hermesInstalled) {
|
|
1295
|
-
out.push(
|
|
1301
|
+
out.push(join15(home, ".hermes", "skills"));
|
|
1296
1302
|
}
|
|
1297
1303
|
if (piInstalled) {
|
|
1298
|
-
out.push(
|
|
1304
|
+
out.push(join15(home, ".pi", "agent", "skills"));
|
|
1299
1305
|
}
|
|
1300
1306
|
return out;
|
|
1301
1307
|
}
|
|
1302
|
-
function detectAgentSkillsRoots(canonicalRoot, home =
|
|
1308
|
+
function detectAgentSkillsRoots(canonicalRoot, home = homedir10()) {
|
|
1303
1309
|
return resolveDetected(home).filter((p) => p !== canonicalRoot);
|
|
1304
1310
|
}
|
|
1305
1311
|
|
|
@@ -1343,15 +1349,15 @@ function isMissingTableError(message) {
|
|
|
1343
1349
|
}
|
|
1344
1350
|
function resolvePullDestination(install, cwd) {
|
|
1345
1351
|
if (install === "global")
|
|
1346
|
-
return
|
|
1352
|
+
return join16(homedir11(), ".claude", "skills");
|
|
1347
1353
|
if (!cwd)
|
|
1348
1354
|
throw new Error("install=project requires a cwd");
|
|
1349
|
-
return
|
|
1355
|
+
return join16(cwd, ".claude", "skills");
|
|
1350
1356
|
}
|
|
1351
1357
|
function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
1352
1358
|
const out = [];
|
|
1353
1359
|
for (const root of agentRoots) {
|
|
1354
|
-
const link =
|
|
1360
|
+
const link = join16(root, dirName);
|
|
1355
1361
|
let existing;
|
|
1356
1362
|
try {
|
|
1357
1363
|
existing = lstatSync2(link);
|
|
@@ -1379,7 +1385,7 @@ function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
|
1379
1385
|
}
|
|
1380
1386
|
}
|
|
1381
1387
|
try {
|
|
1382
|
-
|
|
1388
|
+
mkdirSync9(dirname6(link), { recursive: true });
|
|
1383
1389
|
symlinkSync(canonicalDir, link, "dir");
|
|
1384
1390
|
out.push(link);
|
|
1385
1391
|
} catch {
|
|
@@ -1394,7 +1400,7 @@ function backfillSymlinks(installRoot) {
|
|
|
1394
1400
|
return;
|
|
1395
1401
|
const detected = detectAgentSkillsRoots(installRoot);
|
|
1396
1402
|
for (const entry of entries) {
|
|
1397
|
-
const canonical =
|
|
1403
|
+
const canonical = join16(entry.installRoot, entry.dirName);
|
|
1398
1404
|
if (!existsSync10(canonical))
|
|
1399
1405
|
continue;
|
|
1400
1406
|
const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
|
|
@@ -1508,7 +1514,7 @@ function readLocalVersion(path) {
|
|
|
1508
1514
|
if (!existsSync10(path))
|
|
1509
1515
|
return null;
|
|
1510
1516
|
try {
|
|
1511
|
-
const text =
|
|
1517
|
+
const text = readFileSync10(path, "utf-8");
|
|
1512
1518
|
const parsed = parseFrontmatter(text);
|
|
1513
1519
|
if (!parsed)
|
|
1514
1520
|
return null;
|
|
@@ -1603,8 +1609,8 @@ async function runPull(opts) {
|
|
|
1603
1609
|
summary.skipped++;
|
|
1604
1610
|
continue;
|
|
1605
1611
|
}
|
|
1606
|
-
const skillDir =
|
|
1607
|
-
const skillFile =
|
|
1612
|
+
const skillDir = join16(root, dirName);
|
|
1613
|
+
const skillFile = join16(skillDir, "SKILL.md");
|
|
1608
1614
|
const remoteVersion = Number(row.version ?? 1);
|
|
1609
1615
|
const localVersion = readLocalVersion(skillFile);
|
|
1610
1616
|
const action = decideAction({
|
|
@@ -1615,14 +1621,14 @@ async function runPull(opts) {
|
|
|
1615
1621
|
});
|
|
1616
1622
|
let manifestError;
|
|
1617
1623
|
if (action === "wrote") {
|
|
1618
|
-
|
|
1624
|
+
mkdirSync9(skillDir, { recursive: true });
|
|
1619
1625
|
if (existsSync10(skillFile)) {
|
|
1620
1626
|
try {
|
|
1621
1627
|
renameSync4(skillFile, `${skillFile}.bak`);
|
|
1622
1628
|
} catch {
|
|
1623
1629
|
}
|
|
1624
1630
|
}
|
|
1625
|
-
|
|
1631
|
+
writeFileSync8(skillFile, renderSkillFile(row));
|
|
1626
1632
|
const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir, dirName, detectAgentSkillsRoots(root)) : [];
|
|
1627
1633
|
try {
|
|
1628
1634
|
recordPull({
|