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