harnesstap 1.6.0 → 1.6.1
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/README.md +1 -1
- package/dist/apply-ZGEAY6YZ.js +50 -0
- package/dist/{approve-R6AWQB3I.js → approve-VPVMU2MM.js} +9 -9
- package/dist/{audit-2HNKFPSU.js → audit-AO7AGET3.js} +9 -9
- package/dist/{auth-C54KRLNF.js → auth-7YRIJNXU.js} +7 -7
- package/dist/bin.js +2 -2
- package/dist/{chunk-42E2MPES.js → chunk-262KZULH.js} +6 -6
- package/dist/{chunk-BUA7WFI4.js → chunk-26QGX47N.js} +462 -256
- package/dist/chunk-26QGX47N.js.map +1 -0
- package/dist/{chunk-K4UDZUJ2.js → chunk-27IPOVKQ.js} +2 -2
- package/dist/{chunk-M6FEDSHY.js → chunk-2BESDRYP.js} +6 -6
- package/dist/{chunk-UZCAYOIQ.js → chunk-2BWIEB2G.js} +7 -7
- package/dist/{chunk-TERYL7JH.js → chunk-2NMLWSUH.js} +20 -20
- package/dist/chunk-2NMLWSUH.js.map +1 -0
- package/dist/{chunk-R4NV3Q7G.js → chunk-4E3G4H5B.js} +2 -2
- package/dist/{chunk-HV3ENT2F.js → chunk-4QCGTUTM.js} +2 -2
- package/dist/{chunk-ZKMSHLXP.js → chunk-6RKJZW2N.js} +2 -2
- package/dist/{chunk-S2D5PWAO.js → chunk-7IBFH736.js} +2 -2
- package/dist/{chunk-EPXAOEBB.js → chunk-CKJIS2FM.js} +4 -4
- package/dist/{chunk-D7R577XZ.js → chunk-CUOEQQFI.js} +8 -8
- package/dist/{chunk-5HACBPK2.js → chunk-FLYQEB6D.js} +14 -14
- package/dist/{chunk-CBSDMRMY.js → chunk-HC7IZY75.js} +2 -2
- package/dist/{chunk-R27VZIF6.js → chunk-I4DKV63E.js} +2 -2
- package/dist/{chunk-MHLAIGIM.js → chunk-JEC5PWNH.js} +2 -2
- package/dist/{chunk-MQCAPCAF.js → chunk-KFIRABC7.js} +6 -6
- package/dist/{chunk-UC27MQ3T.js → chunk-LGWFLVZQ.js} +3 -3
- package/dist/{chunk-CR2TYMKC.js → chunk-LX6PMOOC.js} +34 -34
- package/dist/{chunk-OWE3OSX6.js → chunk-MILGCNBK.js} +8 -8
- package/dist/{chunk-V4UNYSZO.js → chunk-MSKTWYHG.js} +2 -2
- package/dist/{chunk-OHZNDV4A.js → chunk-MTCCUYBZ.js} +4 -4
- package/dist/{chunk-OHZNDV4A.js.map → chunk-MTCCUYBZ.js.map} +1 -1
- package/dist/{chunk-MHMFF6A5.js → chunk-NIFKCS7J.js} +2 -2
- package/dist/{chunk-T4EKNX2Q.js → chunk-NWOYPK2O.js} +3 -3
- package/dist/{chunk-RQLVXJH2.js → chunk-NXILQDJG.js} +2 -2
- package/dist/{chunk-M7PHQ3UC.js → chunk-QF73VLAW.js} +378 -196
- package/dist/chunk-QF73VLAW.js.map +1 -0
- package/dist/{chunk-WGVU3LA5.js → chunk-QHCGA6LC.js} +2 -12
- package/dist/chunk-QHCGA6LC.js.map +1 -0
- package/dist/{chunk-3277RVZT.js → chunk-QPJZKWML.js} +3 -3
- package/dist/{chunk-L6BJCRBU.js → chunk-RM7VP6ID.js} +13 -25
- package/dist/chunk-RM7VP6ID.js.map +1 -0
- package/dist/{chunk-UK2IV2ZQ.js → chunk-SMLO5YPI.js} +2 -2
- package/dist/{chunk-A3TZT4WT.js → chunk-T2JBSRGG.js} +2 -2
- package/dist/{chunk-2XDYQXP2.js → chunk-U5Y6WKKT.js} +10 -10
- package/dist/{chunk-PCNHBMBU.js → chunk-WEJVFNRO.js} +2 -2
- package/dist/{chunk-WQ3F4O7U.js → chunk-WWFVMCTR.js} +4 -4
- package/dist/{chunk-WQ3F4O7U.js.map → chunk-WWFVMCTR.js.map} +1 -1
- package/dist/{chunk-XNS4I3W6.js → chunk-XPONNOBR.js} +4 -4
- package/dist/{chunk-MQCH3YZ5.js → chunk-Y3HJ2F2W.js} +5 -5
- package/dist/{chunk-6FXJIKEG.js → chunk-ZREU2UHM.js} +4 -4
- package/dist/{chunk-3Q72LZPJ.js → chunk-ZT7ANP3H.js} +39 -53
- package/dist/chunk-ZT7ANP3H.js.map +1 -0
- package/dist/{chunk-R6VFJKZB.js → chunk-ZUXFPAVX.js} +2 -2
- package/dist/{chunk-GZU4LVFF.js → chunk-ZWB6YXVQ.js} +6 -6
- package/dist/{chunk-QGTDQNVV.js → chunk-ZZQDJGWX.js} +3 -3
- package/dist/{compile-B2QG6BAQ.js → compile-IMJHVXQO.js} +32 -32
- package/dist/{config-D3F6ICZ2.js → config-FVVN3NWL.js} +11 -11
- package/dist/{cursor-local-install-LL367GZY.js → cursor-local-install-JS5KSOES.js} +3 -3
- package/dist/{cursor-local-install-4HDIBX22.js → cursor-local-install-QU5R2FV5.js} +6 -6
- package/dist/{doctor-QSGETVDE.js → doctor-A7VUJSCP.js} +9 -9
- package/dist/{environment-2JS4RWQA.js → environment-6INIUBNC.js} +16 -16
- package/dist/{github-JXSTHLY2.js → github-TFJT3P53.js} +7 -7
- package/dist/{harness-GBI3AMLH.js → harness-WQNC5HPZ.js} +38 -70
- package/dist/harness-WQNC5HPZ.js.map +1 -0
- package/dist/{help-EC52ERIE.js → help-NMS3EXJB.js} +8 -8
- package/dist/{help-VIRMBOPJ.js → help-VW4RIICD.js} +2 -2
- package/dist/{help-VIRMBOPJ.js.map → help-VW4RIICD.js.map} +1 -1
- package/dist/{host-plugin-view-kept-XKHD6NGU.js → host-plugin-view-kept-HYCHDB4D.js} +9 -9
- package/dist/index.js +9 -9
- package/dist/{init-OK3K6ILG.js → init-RXYL5ZUE.js} +17 -17
- package/dist/{live-read-cache-ESQQJBNS.js → live-read-cache-BHU6L7MA.js} +3 -3
- package/dist/live-read-cache-NQU7M2C7.js +12 -0
- package/dist/{lock-AA2F4I3K.js → lock-3H3Z65DS.js} +8 -8
- package/dist/{marketplace-QUYCV23F.js → marketplace-KW35PJCY.js} +7 -7
- package/dist/{mcp-CIHSR4DD.js → mcp-2HUGVDJ5.js} +32 -32
- package/dist/{migrate-TQPEZYS5.js → migrate-6VAPYNXI.js} +14 -14
- package/dist/{notifications-TAELTPDW.js → notifications-Y7KQCN6K.js} +12 -12
- package/dist/open-FADABB2S.js +20 -0
- package/dist/{pack-VUO4UBWL.js → pack-NTECD3BZ.js} +8 -8
- package/dist/plugin-T2YFCYIO.js +47 -0
- package/dist/plugin-from-project-FGX5AHW6.js +15 -0
- package/dist/{policy-Z5TL4N3V.js → policy-3FOWB4GR.js} +8 -8
- package/dist/{profile-QFI7SL3S.js → profile-HM3ROXXB.js} +27 -27
- package/dist/{project-3KR3EPYR.js → project-3DTXKMI6.js} +45 -78
- package/dist/project-3DTXKMI6.js.map +1 -0
- package/dist/{resource-45BPRQ7V.js → resource-TZDZAVZ6.js} +23 -23
- package/dist/status-refresh-worker.js +2 -2
- package/dist/{version-QUJZGTZ5.js → version-AMZJHJIB.js} +2 -2
- package/package.json +1 -1
- package/dist/apply-FTAIL3X3.js +0 -50
- package/dist/chunk-3Q72LZPJ.js.map +0 -1
- package/dist/chunk-BUA7WFI4.js.map +0 -1
- package/dist/chunk-L6BJCRBU.js.map +0 -1
- package/dist/chunk-M7PHQ3UC.js.map +0 -1
- package/dist/chunk-TERYL7JH.js.map +0 -1
- package/dist/chunk-WGVU3LA5.js.map +0 -1
- package/dist/harness-GBI3AMLH.js.map +0 -1
- package/dist/live-read-cache-WPUFHVMZ.js +0 -12
- package/dist/open-D3GWGDSQ.js +0 -20
- package/dist/plugin-L3466DHK.js +0 -47
- package/dist/plugin-from-project-U5UGKTJH.js +0 -15
- package/dist/project-3KR3EPYR.js.map +0 -1
- /package/dist/{apply-FTAIL3X3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
- /package/dist/{approve-R6AWQB3I.js.map → approve-VPVMU2MM.js.map} +0 -0
- /package/dist/{audit-2HNKFPSU.js.map → audit-AO7AGET3.js.map} +0 -0
- /package/dist/{auth-C54KRLNF.js.map → auth-7YRIJNXU.js.map} +0 -0
- /package/dist/{chunk-42E2MPES.js.map → chunk-262KZULH.js.map} +0 -0
- /package/dist/{chunk-K4UDZUJ2.js.map → chunk-27IPOVKQ.js.map} +0 -0
- /package/dist/{chunk-M6FEDSHY.js.map → chunk-2BESDRYP.js.map} +0 -0
- /package/dist/{chunk-UZCAYOIQ.js.map → chunk-2BWIEB2G.js.map} +0 -0
- /package/dist/{chunk-R4NV3Q7G.js.map → chunk-4E3G4H5B.js.map} +0 -0
- /package/dist/{chunk-HV3ENT2F.js.map → chunk-4QCGTUTM.js.map} +0 -0
- /package/dist/{chunk-ZKMSHLXP.js.map → chunk-6RKJZW2N.js.map} +0 -0
- /package/dist/{chunk-S2D5PWAO.js.map → chunk-7IBFH736.js.map} +0 -0
- /package/dist/{chunk-EPXAOEBB.js.map → chunk-CKJIS2FM.js.map} +0 -0
- /package/dist/{chunk-D7R577XZ.js.map → chunk-CUOEQQFI.js.map} +0 -0
- /package/dist/{chunk-5HACBPK2.js.map → chunk-FLYQEB6D.js.map} +0 -0
- /package/dist/{chunk-CBSDMRMY.js.map → chunk-HC7IZY75.js.map} +0 -0
- /package/dist/{chunk-R27VZIF6.js.map → chunk-I4DKV63E.js.map} +0 -0
- /package/dist/{chunk-MHLAIGIM.js.map → chunk-JEC5PWNH.js.map} +0 -0
- /package/dist/{chunk-MQCAPCAF.js.map → chunk-KFIRABC7.js.map} +0 -0
- /package/dist/{chunk-UC27MQ3T.js.map → chunk-LGWFLVZQ.js.map} +0 -0
- /package/dist/{chunk-CR2TYMKC.js.map → chunk-LX6PMOOC.js.map} +0 -0
- /package/dist/{chunk-OWE3OSX6.js.map → chunk-MILGCNBK.js.map} +0 -0
- /package/dist/{chunk-V4UNYSZO.js.map → chunk-MSKTWYHG.js.map} +0 -0
- /package/dist/{chunk-MHMFF6A5.js.map → chunk-NIFKCS7J.js.map} +0 -0
- /package/dist/{chunk-T4EKNX2Q.js.map → chunk-NWOYPK2O.js.map} +0 -0
- /package/dist/{chunk-RQLVXJH2.js.map → chunk-NXILQDJG.js.map} +0 -0
- /package/dist/{chunk-3277RVZT.js.map → chunk-QPJZKWML.js.map} +0 -0
- /package/dist/{chunk-UK2IV2ZQ.js.map → chunk-SMLO5YPI.js.map} +0 -0
- /package/dist/{chunk-A3TZT4WT.js.map → chunk-T2JBSRGG.js.map} +0 -0
- /package/dist/{chunk-2XDYQXP2.js.map → chunk-U5Y6WKKT.js.map} +0 -0
- /package/dist/{chunk-PCNHBMBU.js.map → chunk-WEJVFNRO.js.map} +0 -0
- /package/dist/{chunk-XNS4I3W6.js.map → chunk-XPONNOBR.js.map} +0 -0
- /package/dist/{chunk-MQCH3YZ5.js.map → chunk-Y3HJ2F2W.js.map} +0 -0
- /package/dist/{chunk-6FXJIKEG.js.map → chunk-ZREU2UHM.js.map} +0 -0
- /package/dist/{chunk-R6VFJKZB.js.map → chunk-ZUXFPAVX.js.map} +0 -0
- /package/dist/{chunk-GZU4LVFF.js.map → chunk-ZWB6YXVQ.js.map} +0 -0
- /package/dist/{chunk-QGTDQNVV.js.map → chunk-ZZQDJGWX.js.map} +0 -0
- /package/dist/{compile-B2QG6BAQ.js.map → compile-IMJHVXQO.js.map} +0 -0
- /package/dist/{config-D3F6ICZ2.js.map → config-FVVN3NWL.js.map} +0 -0
- /package/dist/{cursor-local-install-4HDIBX22.js.map → cursor-local-install-JS5KSOES.js.map} +0 -0
- /package/dist/{cursor-local-install-LL367GZY.js.map → cursor-local-install-QU5R2FV5.js.map} +0 -0
- /package/dist/{doctor-QSGETVDE.js.map → doctor-A7VUJSCP.js.map} +0 -0
- /package/dist/{environment-2JS4RWQA.js.map → environment-6INIUBNC.js.map} +0 -0
- /package/dist/{github-JXSTHLY2.js.map → github-TFJT3P53.js.map} +0 -0
- /package/dist/{help-EC52ERIE.js.map → help-NMS3EXJB.js.map} +0 -0
- /package/dist/{host-plugin-view-kept-XKHD6NGU.js.map → host-plugin-view-kept-HYCHDB4D.js.map} +0 -0
- /package/dist/{init-OK3K6ILG.js.map → init-RXYL5ZUE.js.map} +0 -0
- /package/dist/{live-read-cache-ESQQJBNS.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
- /package/dist/{live-read-cache-WPUFHVMZ.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
- /package/dist/{lock-AA2F4I3K.js.map → lock-3H3Z65DS.js.map} +0 -0
- /package/dist/{marketplace-QUYCV23F.js.map → marketplace-KW35PJCY.js.map} +0 -0
- /package/dist/{mcp-CIHSR4DD.js.map → mcp-2HUGVDJ5.js.map} +0 -0
- /package/dist/{migrate-TQPEZYS5.js.map → migrate-6VAPYNXI.js.map} +0 -0
- /package/dist/{notifications-TAELTPDW.js.map → notifications-Y7KQCN6K.js.map} +0 -0
- /package/dist/{open-D3GWGDSQ.js.map → open-FADABB2S.js.map} +0 -0
- /package/dist/{pack-VUO4UBWL.js.map → pack-NTECD3BZ.js.map} +0 -0
- /package/dist/{plugin-L3466DHK.js.map → plugin-T2YFCYIO.js.map} +0 -0
- /package/dist/{plugin-from-project-U5UGKTJH.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
- /package/dist/{policy-Z5TL4N3V.js.map → policy-3FOWB4GR.js.map} +0 -0
- /package/dist/{profile-QFI7SL3S.js.map → profile-HM3ROXXB.js.map} +0 -0
- /package/dist/{resource-45BPRQ7V.js.map → resource-TZDZAVZ6.js.map} +0 -0
- /package/dist/{version-QUJZGTZ5.js.map → version-AMZJHJIB.js.map} +0 -0
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
shouldUseWizard,
|
|
43
43
|
statSync,
|
|
44
44
|
wellKnownMarketplaceEntry
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-LGWFLVZQ.js";
|
|
46
46
|
import {
|
|
47
47
|
AP_PACKAGE_MEDIA_TYPE,
|
|
48
48
|
DEFAULT_CATALOG_SLUG,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveCatalogScope,
|
|
63
63
|
resolveRemotePluginSelector,
|
|
64
64
|
trackPluginInstalled
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MSKTWYHG.js";
|
|
66
66
|
import {
|
|
67
67
|
loadSettings
|
|
68
68
|
} from "./chunk-CWXCZBJR.js";
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
ensureGithubGitConfigArgs,
|
|
71
71
|
githubHttpsRemoteForAuth,
|
|
72
72
|
resolveGithubAccessToken
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-T2JBSRGG.js";
|
|
74
74
|
import {
|
|
75
75
|
CLI_ERRORS,
|
|
76
76
|
CLI_HINTS,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
traceRecord,
|
|
108
108
|
traceSpan,
|
|
109
109
|
ui
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-MTCCUYBZ.js";
|
|
111
111
|
|
|
112
112
|
// src/plugins/cursor-inventory.ts
|
|
113
113
|
import { isAbsolute, join as join3, relative as relative2 } from "path";
|
|
@@ -688,7 +688,7 @@ function describeStatusRefreshError(error) {
|
|
|
688
688
|
|
|
689
689
|
// src/services/status-read-cache.ts
|
|
690
690
|
import { existsSync as existsSync69, readdirSync as readdirSync28, readFileSync as readFileSync63, statSync as statSync25, watch } from "fs";
|
|
691
|
-
import { basename as
|
|
691
|
+
import { basename as basename13, dirname as dirname28, join as join93, sep as sep22 } from "path";
|
|
692
692
|
import { Worker, parentPort } from "worker_threads";
|
|
693
693
|
|
|
694
694
|
// src/platforms/registry.ts
|
|
@@ -1371,7 +1371,7 @@ function withHarnessScope(resource, scope) {
|
|
|
1371
1371
|
|
|
1372
1372
|
// src/services/global-profile-status-panel.ts
|
|
1373
1373
|
import { existsSync as existsSync68, readFileSync as readFileSync62 } from "fs";
|
|
1374
|
-
import { join as
|
|
1374
|
+
import { join as join92, resolve as resolve33 } from "path";
|
|
1375
1375
|
|
|
1376
1376
|
// src/plugins/claude-plugin-ref.ts
|
|
1377
1377
|
import { join as join6 } from "path";
|
|
@@ -1821,7 +1821,7 @@ var CursorPluginProvider = class {
|
|
|
1821
1821
|
return results;
|
|
1822
1822
|
}
|
|
1823
1823
|
async install(ctx, opts) {
|
|
1824
|
-
const { installCursorLocalPlugin } = await import("./cursor-local-install-
|
|
1824
|
+
const { installCursorLocalPlugin } = await import("./cursor-local-install-QU5R2FV5.js");
|
|
1825
1825
|
return installCursorLocalPlugin(ctx, opts);
|
|
1826
1826
|
}
|
|
1827
1827
|
};
|
|
@@ -1968,13 +1968,37 @@ function createProject(input) {
|
|
|
1968
1968
|
const db = getDb();
|
|
1969
1969
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1970
1970
|
const id = ulid2();
|
|
1971
|
+
const localId = input.local_id ?? "";
|
|
1971
1972
|
db.prepare(
|
|
1972
|
-
`INSERT INTO projects (id, git_origin, name, local_path, created_at)
|
|
1973
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
1974
|
-
).run(id, input.git_origin, input.name, input.local_path, now);
|
|
1975
|
-
return { id, ...input, created_at: now };
|
|
1973
|
+
`INSERT INTO projects (id, git_origin, local_id, name, local_path, created_at)
|
|
1974
|
+
VALUES (?, ?, ?, ?, ?, ?)`
|
|
1975
|
+
).run(id, input.git_origin, localId, input.name, input.local_path, now);
|
|
1976
|
+
return { id, ...input, local_id: localId, created_at: now };
|
|
1977
|
+
}
|
|
1978
|
+
function getProjectByLocalId(localId) {
|
|
1979
|
+
if (!localId) {
|
|
1980
|
+
return void 0;
|
|
1981
|
+
}
|
|
1982
|
+
const db = getDb();
|
|
1983
|
+
return db.prepare("SELECT * FROM projects WHERE local_id = ? AND git_origin = ''").get(localId);
|
|
1984
|
+
}
|
|
1985
|
+
function upsertProjectByLocalId(input) {
|
|
1986
|
+
const existing = getProjectByLocalId(input.local_id);
|
|
1987
|
+
if (existing) {
|
|
1988
|
+
const db = getDb();
|
|
1989
|
+
db.prepare("UPDATE projects SET local_path = ?, name = ? WHERE id = ?").run(
|
|
1990
|
+
input.local_path,
|
|
1991
|
+
input.name,
|
|
1992
|
+
existing.id
|
|
1993
|
+
);
|
|
1994
|
+
return { ...existing, local_path: input.local_path, name: input.name };
|
|
1995
|
+
}
|
|
1996
|
+
return createProject({ git_origin: "", ...input });
|
|
1976
1997
|
}
|
|
1977
1998
|
function getProjectByOrigin(gitOrigin) {
|
|
1999
|
+
if (!gitOrigin) {
|
|
2000
|
+
return void 0;
|
|
2001
|
+
}
|
|
1978
2002
|
const db = getDb();
|
|
1979
2003
|
return db.prepare("SELECT * FROM projects WHERE git_origin = ?").get(gitOrigin);
|
|
1980
2004
|
}
|
|
@@ -2081,43 +2105,6 @@ function getLatestSnapshot(projectId) {
|
|
|
2081
2105
|
return snapshots[0];
|
|
2082
2106
|
}
|
|
2083
2107
|
|
|
2084
|
-
// src/services/git.ts
|
|
2085
|
-
import { execSync } from "child_process";
|
|
2086
|
-
import { basename } from "path";
|
|
2087
|
-
function getGitOrigin(projectRoot) {
|
|
2088
|
-
try {
|
|
2089
|
-
const url = execSync("git config --get remote.origin.url", {
|
|
2090
|
-
cwd: projectRoot,
|
|
2091
|
-
encoding: "utf-8",
|
|
2092
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
2093
|
-
}).trim();
|
|
2094
|
-
return url || void 0;
|
|
2095
|
-
} catch {
|
|
2096
|
-
return void 0;
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
function normalizeGitUrl(url) {
|
|
2100
|
-
let normalized = url.trim();
|
|
2101
|
-
if (normalized.startsWith("git@")) {
|
|
2102
|
-
return normalized;
|
|
2103
|
-
}
|
|
2104
|
-
if (normalized.endsWith(".git")) {
|
|
2105
|
-
normalized = normalized.slice(0, -4);
|
|
2106
|
-
}
|
|
2107
|
-
return normalized;
|
|
2108
|
-
}
|
|
2109
|
-
function projectNameFromUrl(url) {
|
|
2110
|
-
const sshMatch = url.match(/:([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
2111
|
-
if (sshMatch?.[1]) return sshMatch[1];
|
|
2112
|
-
try {
|
|
2113
|
-
const parsed = new URL(url);
|
|
2114
|
-
const path = parsed.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
2115
|
-
return path || basename(url);
|
|
2116
|
-
} catch {
|
|
2117
|
-
return basename(url).replace(/\.git$/, "");
|
|
2118
|
-
}
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
2108
|
// src/services/host-native-mcp.ts
|
|
2122
2109
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
|
|
2123
2110
|
import { join as join10 } from "path";
|
|
@@ -2133,7 +2120,7 @@ import {
|
|
|
2133
2120
|
statSync as statSync2,
|
|
2134
2121
|
writeFileSync as writeFileSync4
|
|
2135
2122
|
} from "fs";
|
|
2136
|
-
import { basename
|
|
2123
|
+
import { basename, dirname as dirname2, join as join9, relative as relative3, resolve as resolve2, sep as sep2 } from "path";
|
|
2137
2124
|
function hostPluginViewsPath() {
|
|
2138
2125
|
return join9(getHarnesstapDir(), "cache", "host-plugin-views.json");
|
|
2139
2126
|
}
|
|
@@ -2338,7 +2325,7 @@ function pruneCreatedHostPluginViews(removedFiles) {
|
|
|
2338
2325
|
continue;
|
|
2339
2326
|
}
|
|
2340
2327
|
let parent = dirname2(view);
|
|
2341
|
-
while (
|
|
2328
|
+
while (basename(parent) !== "cache" && parent !== dirname2(parent)) {
|
|
2342
2329
|
try {
|
|
2343
2330
|
if (readdirSync4(parent).length > 0) break;
|
|
2344
2331
|
rmdirSync(parent);
|
|
@@ -2932,7 +2919,7 @@ function setPluginUpstream(pluginId, upstream, upstreamPluginId = "") {
|
|
|
2932
2919
|
}
|
|
2933
2920
|
|
|
2934
2921
|
// src/models/plugin-model.ts
|
|
2935
|
-
import { ulid as
|
|
2922
|
+
import { ulid as ulid18 } from "ulid";
|
|
2936
2923
|
import semver19 from "semver";
|
|
2937
2924
|
|
|
2938
2925
|
// src/models/resource.ts
|
|
@@ -3470,7 +3457,7 @@ function isGitRefConstraint(raw) {
|
|
|
3470
3457
|
|
|
3471
3458
|
// src/services/plugin-versioning.ts
|
|
3472
3459
|
import semver18 from "semver";
|
|
3473
|
-
import { ulid as
|
|
3460
|
+
import { ulid as ulid17 } from "ulid";
|
|
3474
3461
|
|
|
3475
3462
|
// src/services/plugin-origin.ts
|
|
3476
3463
|
var CAPABILITY_VERB = {
|
|
@@ -3527,7 +3514,7 @@ function assertSyncable(pluginId) {
|
|
|
3527
3514
|
|
|
3528
3515
|
// src/services/host-plugin-serialize.ts
|
|
3529
3516
|
import { existsSync as existsSync67, readdirSync as readdirSync27, readFileSync as readFileSync61 } from "fs";
|
|
3530
|
-
import { basename as
|
|
3517
|
+
import { basename as basename12, join as join91, relative as relative26, sep as sep21 } from "path";
|
|
3531
3518
|
|
|
3532
3519
|
// src/services/package-cache/paths.ts
|
|
3533
3520
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -4036,11 +4023,11 @@ function rewriteValue(value, state) {
|
|
|
4036
4023
|
|
|
4037
4024
|
// src/services/resource-sync.ts
|
|
4038
4025
|
import { existsSync as existsSync66, readdirSync as readdirSync26 } from "fs";
|
|
4039
|
-
import { basename as
|
|
4026
|
+
import { basename as basename11, join as join90 } from "path";
|
|
4040
4027
|
|
|
4041
4028
|
// src/services/plugin-source-import.ts
|
|
4042
4029
|
import { existsSync as existsSync30, readFileSync as readFileSync31, readdirSync as readdirSync13, statSync as statSync11 } from "fs";
|
|
4043
|
-
import { basename as
|
|
4030
|
+
import { basename as basename5, dirname as dirname12, isAbsolute as isAbsolute9, join as join49, relative as relative13, resolve as resolve13, sep as sep9 } from "path";
|
|
4044
4031
|
import { parse as parseToml3 } from "smol-toml";
|
|
4045
4032
|
|
|
4046
4033
|
// src/services/agent-bridge.ts
|
|
@@ -6357,7 +6344,7 @@ function readOpaqueFiles(pluginId) {
|
|
|
6357
6344
|
|
|
6358
6345
|
// src/services/agent-plugins/vendor-extensions.ts
|
|
6359
6346
|
import { existsSync as existsSync14, readFileSync as readFileSync15, statSync as statSync5 } from "fs";
|
|
6360
|
-
import { basename as
|
|
6347
|
+
import { basename as basename2, resolve as resolve5 } from "path";
|
|
6361
6348
|
import matter2 from "gray-matter";
|
|
6362
6349
|
var COPILOT_NS = "com.github.copilot";
|
|
6363
6350
|
var OPENAI_NS = "com.openai";
|
|
@@ -6419,7 +6406,7 @@ function rewriteOutsideCommand(command, bundleDir, files, warnings, hookName, ho
|
|
|
6419
6406
|
const relative27 = bundledRelativePath(
|
|
6420
6407
|
files,
|
|
6421
6408
|
bundleDir,
|
|
6422
|
-
safeStem(
|
|
6409
|
+
safeStem(basename2(absolute)),
|
|
6423
6410
|
readFileSync15(absolute, "utf8"),
|
|
6424
6411
|
hookName
|
|
6425
6412
|
);
|
|
@@ -9048,7 +9035,7 @@ import { dirname as dirname9, join as join45, resolve as resolve8 } from "path";
|
|
|
9048
9035
|
|
|
9049
9036
|
// src/services/apm-manifest.ts
|
|
9050
9037
|
import { existsSync as existsSync26, lstatSync as lstatSync8, readFileSync as readFileSync25 } from "fs";
|
|
9051
|
-
import { basename as
|
|
9038
|
+
import { basename as basename4, join as join44 } from "path";
|
|
9052
9039
|
import { parse as parseYaml3, stringify as stringifyYaml3 } from "yaml";
|
|
9053
9040
|
|
|
9054
9041
|
// src/services/apm-policy.ts
|
|
@@ -9990,7 +9977,7 @@ function setProjectHarnessConfig(input) {
|
|
|
9990
9977
|
|
|
9991
9978
|
// src/services/scanner.ts
|
|
9992
9979
|
import { lstatSync as lstatSync6 } from "fs";
|
|
9993
|
-
import { basename as
|
|
9980
|
+
import { basename as basename3, dirname as dirname8, join as join42 } from "path";
|
|
9994
9981
|
|
|
9995
9982
|
// src/models/imported-snapshot.ts
|
|
9996
9983
|
import { ulid as ulid7 } from "ulid";
|
|
@@ -11120,8 +11107,8 @@ function isMergeableHostConfigPath(path) {
|
|
|
11120
11107
|
if (MERGEABLE_FILE_RE.test(normalized)) {
|
|
11121
11108
|
return true;
|
|
11122
11109
|
}
|
|
11123
|
-
const
|
|
11124
|
-
if (INSTRUCTION_BASENAMES.has(
|
|
11110
|
+
const basename14 = normalized.split("/").pop()?.toLowerCase() ?? "";
|
|
11111
|
+
if (INSTRUCTION_BASENAMES.has(basename14)) {
|
|
11125
11112
|
return true;
|
|
11126
11113
|
}
|
|
11127
11114
|
const registry = registryHostConfigPaths();
|
|
@@ -16397,7 +16384,7 @@ function existingPaths(paths, rootPath) {
|
|
|
16397
16384
|
);
|
|
16398
16385
|
}
|
|
16399
16386
|
function pathHasExactConfiguredName(fullPath, configuredPath) {
|
|
16400
|
-
const expectedName =
|
|
16387
|
+
const expectedName = basename3(configuredPath.replace(/\/+$/, ""));
|
|
16401
16388
|
if (!expectedName || expectedName === "." || expectedName === "..") {
|
|
16402
16389
|
return true;
|
|
16403
16390
|
}
|
|
@@ -16508,7 +16495,7 @@ function isPluginSourcePath(sourcePath) {
|
|
|
16508
16495
|
if (!existsSync(sourcePath)) {
|
|
16509
16496
|
return false;
|
|
16510
16497
|
}
|
|
16511
|
-
if (
|
|
16498
|
+
if (basename3(sourcePath) === "marketplace.json") {
|
|
16512
16499
|
return true;
|
|
16513
16500
|
}
|
|
16514
16501
|
return existsSync(join42(sourcePath, ".goose-plugin", "plugin.json")) || existsSync(join42(sourcePath, ".plugin", "plugin.json")) || existsSync(join42(sourcePath, "plugin.json")) || existsSync(join42(sourcePath, ".cursor-plugin", "plugin.json")) || existsSync(join42(sourcePath, ".claude-plugin", "plugin.json")) || existsSync(join42(sourcePath, ".codex-plugin", "plugin.json")) || existsSync(join42(sourcePath, ".github", "plugin", "plugin.json"));
|
|
@@ -17563,7 +17550,7 @@ function readPackageRuntimeApmDependencies(packageRoot) {
|
|
|
17563
17550
|
return collectRuntimeApmDependencies(document);
|
|
17564
17551
|
}
|
|
17565
17552
|
function sanitizePackageName(projectPath) {
|
|
17566
|
-
const base =
|
|
17553
|
+
const base = basename4(projectPath).trim();
|
|
17567
17554
|
return base.length > 0 ? base : "project";
|
|
17568
17555
|
}
|
|
17569
17556
|
function serializeEnvironmentBlock(config) {
|
|
@@ -19961,21 +19948,21 @@ function firstExistingPath(candidates) {
|
|
|
19961
19948
|
}
|
|
19962
19949
|
function marketplaceRepoRoot(manifestPath) {
|
|
19963
19950
|
const manifestDir = dirname12(manifestPath);
|
|
19964
|
-
const name =
|
|
19951
|
+
const name = basename5(manifestDir);
|
|
19965
19952
|
if (name === ".claude-plugin" || name === ".cursor-plugin" || name === ".codex-plugin") {
|
|
19966
19953
|
return dirname12(manifestDir);
|
|
19967
19954
|
}
|
|
19968
|
-
if (name === "plugin" &&
|
|
19955
|
+
if (name === "plugin" && basename5(dirname12(manifestDir)) === ".github") {
|
|
19969
19956
|
return dirname12(dirname12(manifestDir));
|
|
19970
19957
|
}
|
|
19971
|
-
if (name === "plugins" &&
|
|
19958
|
+
if (name === "plugins" && basename5(dirname12(manifestDir)) === ".agents") {
|
|
19972
19959
|
return dirname12(dirname12(manifestDir));
|
|
19973
19960
|
}
|
|
19974
19961
|
return manifestDir;
|
|
19975
19962
|
}
|
|
19976
19963
|
function isCodexMarketplaceManifest(manifestPath) {
|
|
19977
19964
|
const manifestDir = dirname12(manifestPath);
|
|
19978
|
-
return
|
|
19965
|
+
return basename5(manifestDir) === "plugins" && basename5(dirname12(manifestDir)) === ".agents";
|
|
19979
19966
|
}
|
|
19980
19967
|
function resolveMarketplaceEntryPath(manifestPath, entryPath) {
|
|
19981
19968
|
const repoRoot = marketplaceRepoRoot(manifestPath);
|
|
@@ -20057,7 +20044,7 @@ function resolvePluginRoot(sourcePath) {
|
|
|
20057
20044
|
throw new Error(`Unsupported plugin source layout: ${sourcePath}`);
|
|
20058
20045
|
}
|
|
20059
20046
|
function versionFromInstallDirectory(installRoot) {
|
|
20060
|
-
const dirName =
|
|
20047
|
+
const dirName = basename5(installRoot);
|
|
20061
20048
|
return GIT_SHA_DIR.test(dirName) ? dirName : void 0;
|
|
20062
20049
|
}
|
|
20063
20050
|
function isPluginInstallRoot(sourcePath) {
|
|
@@ -20089,7 +20076,7 @@ function buildProvenance(input) {
|
|
|
20089
20076
|
function scanSkills(rootPath, skillDirs, metadata) {
|
|
20090
20077
|
const resources = [];
|
|
20091
20078
|
for (const skillDir of skillDirs) {
|
|
20092
|
-
const entry =
|
|
20079
|
+
const entry = basename5(skillDir);
|
|
20093
20080
|
const skillPath = join49(skillDir, "SKILL.md");
|
|
20094
20081
|
const raw = readText2(skillPath);
|
|
20095
20082
|
if (!isDirectory5(skillDir) || !raw) continue;
|
|
@@ -20591,7 +20578,7 @@ function scanPluginRoot(sourcePath, opts) {
|
|
|
20591
20578
|
if (normalizePath2(pluginRoot) === normalizePath2(sourcePath)) {
|
|
20592
20579
|
continue;
|
|
20593
20580
|
}
|
|
20594
|
-
if (cache &&
|
|
20581
|
+
if (cache && basename5(pluginRoot) !== cache.pluginName) {
|
|
20595
20582
|
continue;
|
|
20596
20583
|
}
|
|
20597
20584
|
try {
|
|
@@ -20625,7 +20612,7 @@ function scanPluginSourceSync(sourcePath) {
|
|
|
20625
20612
|
if (existsSync30(sourcePath) && isDirectory5(sourcePath)) {
|
|
20626
20613
|
return [scanPluginRoot(sourcePath)];
|
|
20627
20614
|
}
|
|
20628
|
-
if (
|
|
20615
|
+
if (basename5(sourcePath) !== "marketplace.json") {
|
|
20629
20616
|
throw new Error(`Unsupported plugin source layout: ${sourcePath}`);
|
|
20630
20617
|
}
|
|
20631
20618
|
const manifest = validateMarketplaceManifest(
|
|
@@ -20648,18 +20635,18 @@ async function scanPluginSource(sourcePath) {
|
|
|
20648
20635
|
|
|
20649
20636
|
// src/services/host-plugin-versions.ts
|
|
20650
20637
|
import { existsSync as existsSync65, readdirSync as readdirSync25 } from "fs";
|
|
20651
|
-
import { basename as
|
|
20638
|
+
import { basename as basename10, join as join89 } from "path";
|
|
20652
20639
|
import semver15 from "semver";
|
|
20653
20640
|
|
|
20654
20641
|
// src/services/host-plugin-source.ts
|
|
20655
|
-
import { cpSync as cpSync5, existsSync as existsSync64, mkdirSync as
|
|
20656
|
-
import { dirname as dirname27, join as
|
|
20642
|
+
import { cpSync as cpSync5, existsSync as existsSync64, mkdirSync as mkdirSync29, readFileSync as readFileSync60, rmSync as rmSync11, writeFileSync as writeFileSync26 } from "fs";
|
|
20643
|
+
import { dirname as dirname27, join as join88 } from "path";
|
|
20657
20644
|
import semver14 from "semver";
|
|
20658
20645
|
|
|
20659
20646
|
// src/services/plugin-origin-apply.ts
|
|
20660
20647
|
import { createHash as createHash14 } from "crypto";
|
|
20661
20648
|
import { existsSync as existsSync63, readdirSync as readdirSync24, statSync as statSync24 } from "fs";
|
|
20662
|
-
import { join as
|
|
20649
|
+
import { join as join87 } from "path";
|
|
20663
20650
|
|
|
20664
20651
|
// src/services/agent-plugins/install-root.ts
|
|
20665
20652
|
import { createHash as createHash13 } from "crypto";
|
|
@@ -20667,12 +20654,12 @@ import {
|
|
|
20667
20654
|
chmodSync as chmodSync3,
|
|
20668
20655
|
existsSync as existsSync61,
|
|
20669
20656
|
lstatSync as lstatSync25,
|
|
20670
|
-
mkdirSync as
|
|
20657
|
+
mkdirSync as mkdirSync28,
|
|
20671
20658
|
readFileSync as readFileSync58,
|
|
20672
20659
|
writeFileSync as writeFileSync25
|
|
20673
20660
|
} from "fs";
|
|
20674
|
-
import { isAbsolute as isAbsolute13, join as
|
|
20675
|
-
import { ulid as
|
|
20661
|
+
import { isAbsolute as isAbsolute13, join as join85, relative as relative24, resolve as resolve32 } from "path";
|
|
20662
|
+
import { ulid as ulid16 } from "ulid";
|
|
20676
20663
|
|
|
20677
20664
|
// src/models/apply-removal-backup.ts
|
|
20678
20665
|
import { existsSync as existsSync31, readFileSync as readFileSync32 } from "fs";
|
|
@@ -20805,11 +20792,11 @@ import {
|
|
|
20805
20792
|
copyFileSync as copyFileSync3,
|
|
20806
20793
|
existsSync as existsSync60,
|
|
20807
20794
|
lstatSync as lstatSync24,
|
|
20808
|
-
mkdirSync as
|
|
20795
|
+
mkdirSync as mkdirSync27,
|
|
20809
20796
|
readdirSync as readdirSync22,
|
|
20810
20797
|
readFileSync as readFileSync57,
|
|
20811
20798
|
readlinkSync as readlinkSync6,
|
|
20812
|
-
realpathSync as
|
|
20799
|
+
realpathSync as realpathSync6,
|
|
20813
20800
|
renameSync,
|
|
20814
20801
|
rmdirSync as rmdirSync4,
|
|
20815
20802
|
rmSync as rmSync9,
|
|
@@ -20817,8 +20804,8 @@ import {
|
|
|
20817
20804
|
symlinkSync as symlinkSync5,
|
|
20818
20805
|
writeFileSync as writeFileSync24
|
|
20819
20806
|
} from "fs";
|
|
20820
|
-
import { basename as
|
|
20821
|
-
import { ulid as
|
|
20807
|
+
import { basename as basename9, dirname as dirname25, join as join84, resolve as resolve31, sep as sep19 } from "path";
|
|
20808
|
+
import { ulid as ulid15 } from "ulid";
|
|
20822
20809
|
|
|
20823
20810
|
// src/models/preexisting-path.ts
|
|
20824
20811
|
import { ulid as ulid10 } from "ulid";
|
|
@@ -21256,7 +21243,7 @@ import { parse as parseToml6 } from "smol-toml";
|
|
|
21256
21243
|
|
|
21257
21244
|
// src/services/profile-commit-resource.ts
|
|
21258
21245
|
import { existsSync as existsSync58, readFileSync as readFileSync54, writeFileSync as writeFileSync22 } from "fs";
|
|
21259
|
-
import { join as
|
|
21246
|
+
import { join as join81, resolve as resolve28 } from "path";
|
|
21260
21247
|
|
|
21261
21248
|
// src/constants/profile.ts
|
|
21262
21249
|
var PROFILE_PLUGIN_TAG = "profile";
|
|
@@ -22154,7 +22141,7 @@ function ensurePluginDataDir(pluginName) {
|
|
|
22154
22141
|
|
|
22155
22142
|
// src/services/agent-plugins/package-root.ts
|
|
22156
22143
|
import { existsSync as existsSync40 } from "fs";
|
|
22157
|
-
import { basename as
|
|
22144
|
+
import { basename as basename6, resolve as resolve17 } from "path";
|
|
22158
22145
|
|
|
22159
22146
|
// src/services/package-cache/host-plugin.ts
|
|
22160
22147
|
import {
|
|
@@ -23207,8 +23194,8 @@ function installedPackageForResource(resourceId) {
|
|
|
23207
23194
|
const path = pathInstallRoot(origin) ?? resolveInstallRoot(origin);
|
|
23208
23195
|
if (!path) return void 0;
|
|
23209
23196
|
const parsedName = parseDependencyRef(origin).name;
|
|
23210
|
-
const name = parsedName.includes("/") || parsedName.includes("\\") ?
|
|
23211
|
-
return { name: name ||
|
|
23197
|
+
const name = parsedName.includes("/") || parsedName.includes("\\") ? basename6(path) : parsedName;
|
|
23198
|
+
return { name: name || basename6(path), version: "0.0.0", path };
|
|
23212
23199
|
}
|
|
23213
23200
|
|
|
23214
23201
|
// src/services/agent-plugins/mcp-host-paths.ts
|
|
@@ -25266,7 +25253,7 @@ async function materializeFiles(files, rootPath, options = {}) {
|
|
|
25266
25253
|
};
|
|
25267
25254
|
}
|
|
25268
25255
|
async function clearLiveReadCachesAfterWrite() {
|
|
25269
|
-
const { clearLiveReadCaches: clearLiveReadCaches2 } = await import("./live-read-cache-
|
|
25256
|
+
const { clearLiveReadCaches: clearLiveReadCaches2 } = await import("./live-read-cache-NQU7M2C7.js");
|
|
25270
25257
|
clearLiveReadCaches2();
|
|
25271
25258
|
}
|
|
25272
25259
|
async function applyToGlobal(resources, platforms, homeRoot, options = {}) {
|
|
@@ -29314,7 +29301,7 @@ function formatHookInventoryLabel(input) {
|
|
|
29314
29301
|
}
|
|
29315
29302
|
|
|
29316
29303
|
// src/services/project-status-payload.ts
|
|
29317
|
-
import { resolve as
|
|
29304
|
+
import { resolve as resolve25 } from "path";
|
|
29318
29305
|
|
|
29319
29306
|
// src/services/notifications.ts
|
|
29320
29307
|
import { ulid as ulid13 } from "ulid";
|
|
@@ -30785,6 +30772,227 @@ async function assessProjectScanStatus(projectRoot) {
|
|
|
30785
30772
|
};
|
|
30786
30773
|
}
|
|
30787
30774
|
|
|
30775
|
+
// src/services/project-identity.ts
|
|
30776
|
+
import { mkdirSync as mkdirSync23, realpathSync as realpathSync4 } from "fs";
|
|
30777
|
+
import { basename as basename8, join as join79, resolve as resolve24 } from "path";
|
|
30778
|
+
import { ulid as ulid14 } from "ulid";
|
|
30779
|
+
|
|
30780
|
+
// src/services/git.ts
|
|
30781
|
+
import { execSync } from "child_process";
|
|
30782
|
+
import { basename as basename7 } from "path";
|
|
30783
|
+
function getGitOrigin(projectRoot) {
|
|
30784
|
+
try {
|
|
30785
|
+
const url = execSync("git config --get remote.origin.url", {
|
|
30786
|
+
cwd: projectRoot,
|
|
30787
|
+
encoding: "utf-8",
|
|
30788
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
30789
|
+
}).trim();
|
|
30790
|
+
return url || void 0;
|
|
30791
|
+
} catch {
|
|
30792
|
+
return void 0;
|
|
30793
|
+
}
|
|
30794
|
+
}
|
|
30795
|
+
function normalizeGitUrl(url) {
|
|
30796
|
+
let normalized = url.trim();
|
|
30797
|
+
if (normalized.startsWith("git@")) {
|
|
30798
|
+
return normalized;
|
|
30799
|
+
}
|
|
30800
|
+
if (normalized.endsWith(".git")) {
|
|
30801
|
+
normalized = normalized.slice(0, -4);
|
|
30802
|
+
}
|
|
30803
|
+
return normalized;
|
|
30804
|
+
}
|
|
30805
|
+
function projectNameFromUrl(url) {
|
|
30806
|
+
const sshMatch = url.match(/:([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
30807
|
+
if (sshMatch?.[1]) return sshMatch[1];
|
|
30808
|
+
try {
|
|
30809
|
+
const parsed = new URL(url);
|
|
30810
|
+
const path = parsed.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
30811
|
+
return path || basename7(url);
|
|
30812
|
+
} catch {
|
|
30813
|
+
return basename7(url).replace(/\.git$/, "");
|
|
30814
|
+
}
|
|
30815
|
+
}
|
|
30816
|
+
|
|
30817
|
+
// src/services/project-identity.ts
|
|
30818
|
+
var PATH_PROJECT_ID_PREFIX = "path:";
|
|
30819
|
+
function realOrResolved(path) {
|
|
30820
|
+
const absolute = resolve24(path);
|
|
30821
|
+
try {
|
|
30822
|
+
return realpathSync4.native(absolute);
|
|
30823
|
+
} catch {
|
|
30824
|
+
return absolute;
|
|
30825
|
+
}
|
|
30826
|
+
}
|
|
30827
|
+
function isCaseInsensitivePlatform(platform) {
|
|
30828
|
+
return platform === "win32" || platform === "darwin";
|
|
30829
|
+
}
|
|
30830
|
+
function stripTrailingSeparators(path) {
|
|
30831
|
+
let out = path;
|
|
30832
|
+
while (out.length > 1 && out.endsWith("/") && !/^[a-z]:\/$/i.test(out)) {
|
|
30833
|
+
out = out.slice(0, -1);
|
|
30834
|
+
}
|
|
30835
|
+
return out;
|
|
30836
|
+
}
|
|
30837
|
+
function normalizeProjectPath(path, platform = process.platform) {
|
|
30838
|
+
let out = realOrResolved(path);
|
|
30839
|
+
if (platform === "win32") {
|
|
30840
|
+
out = out.replace(/\\/g, "/");
|
|
30841
|
+
}
|
|
30842
|
+
if (isCaseInsensitivePlatform(platform)) {
|
|
30843
|
+
out = out.toLowerCase();
|
|
30844
|
+
}
|
|
30845
|
+
return stripTrailingSeparators(out);
|
|
30846
|
+
}
|
|
30847
|
+
function pathProjectId(path, platform = process.platform) {
|
|
30848
|
+
return `${PATH_PROJECT_ID_PREFIX}${normalizeProjectPath(path, platform)}`;
|
|
30849
|
+
}
|
|
30850
|
+
function resolveProjectIdentity(projectRoot) {
|
|
30851
|
+
const root = resolve24(projectRoot);
|
|
30852
|
+
const localId = pathProjectId(root);
|
|
30853
|
+
const gitOriginRaw = getGitOrigin(root);
|
|
30854
|
+
if (gitOriginRaw) {
|
|
30855
|
+
return {
|
|
30856
|
+
kind: "origin",
|
|
30857
|
+
root,
|
|
30858
|
+
gitOrigin: normalizeGitUrl(gitOriginRaw),
|
|
30859
|
+
gitOriginRaw,
|
|
30860
|
+
localId,
|
|
30861
|
+
name: projectNameFromUrl(gitOriginRaw)
|
|
30862
|
+
};
|
|
30863
|
+
}
|
|
30864
|
+
return { kind: "path", root, localId, name: basename8(realOrResolved(root)) || root };
|
|
30865
|
+
}
|
|
30866
|
+
function findProjectForRoot(projectRoot, identity = resolveProjectIdentity(projectRoot)) {
|
|
30867
|
+
if (identity.kind === "path") {
|
|
30868
|
+
return getProjectByLocalId(identity.localId);
|
|
30869
|
+
}
|
|
30870
|
+
migratePathProjectToOrigin(identity);
|
|
30871
|
+
return getProjectByOrigin(identity.gitOrigin) ?? getProjectByLocalId(identity.localId);
|
|
30872
|
+
}
|
|
30873
|
+
function ensureProjectForRoot(projectRoot, identity = resolveProjectIdentity(projectRoot)) {
|
|
30874
|
+
if (identity.kind === "path") {
|
|
30875
|
+
return upsertProjectByLocalId({
|
|
30876
|
+
local_id: identity.localId,
|
|
30877
|
+
name: identity.name,
|
|
30878
|
+
local_path: identity.root
|
|
30879
|
+
});
|
|
30880
|
+
}
|
|
30881
|
+
const migration = migratePathProjectToOrigin(identity);
|
|
30882
|
+
if (migration.status === "failed") {
|
|
30883
|
+
const pathProject = getProjectByLocalId(identity.localId);
|
|
30884
|
+
if (pathProject) {
|
|
30885
|
+
return pathProject;
|
|
30886
|
+
}
|
|
30887
|
+
}
|
|
30888
|
+
return upsertProject({
|
|
30889
|
+
git_origin: identity.gitOrigin,
|
|
30890
|
+
name: identity.name,
|
|
30891
|
+
local_path: identity.root
|
|
30892
|
+
});
|
|
30893
|
+
}
|
|
30894
|
+
function backupDatabase(reason, db = getDb()) {
|
|
30895
|
+
const dir = join79(getHarnesstapDir(), "backups");
|
|
30896
|
+
mkdirSync23(dir, { recursive: true });
|
|
30897
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
|
30898
|
+
const file = join79(dir, `harnesstap-${stamp}-${ulid14()}-${reason}.db`);
|
|
30899
|
+
db.exec(`VACUUM INTO '${file.replace(/'/g, "''")}'`);
|
|
30900
|
+
return file;
|
|
30901
|
+
}
|
|
30902
|
+
function pendingPathProjectId(db, localId) {
|
|
30903
|
+
const row = db.prepare("SELECT id FROM projects WHERE local_id = ? AND git_origin = ''").get(localId);
|
|
30904
|
+
return row?.id;
|
|
30905
|
+
}
|
|
30906
|
+
function projectChildTables(db) {
|
|
30907
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'projects'").all();
|
|
30908
|
+
const out = [];
|
|
30909
|
+
for (const { name } of tables) {
|
|
30910
|
+
const columns = db.prepare(`PRAGMA table_info("${name}")`).all();
|
|
30911
|
+
if (!columns.some((column) => column.name === "project_id")) {
|
|
30912
|
+
continue;
|
|
30913
|
+
}
|
|
30914
|
+
const pk = columns.filter((column) => column.pk > 0).sort((a, b) => a.pk - b.pk).map((column) => column.name);
|
|
30915
|
+
out.push({ name, pk });
|
|
30916
|
+
}
|
|
30917
|
+
return out;
|
|
30918
|
+
}
|
|
30919
|
+
var RECENCY_COLUMN = {
|
|
30920
|
+
project_plugins: "applied_at",
|
|
30921
|
+
project_layers: "applied_at",
|
|
30922
|
+
project_harnesses: "updated_at"
|
|
30923
|
+
};
|
|
30924
|
+
function mergeProjectRows(db, fromId, toId) {
|
|
30925
|
+
let movedSnapshots = 0;
|
|
30926
|
+
for (const table of projectChildTables(db)) {
|
|
30927
|
+
const quoted = `"${table.name}"`;
|
|
30928
|
+
const keyColumns = table.pk.filter((column) => column !== "project_id");
|
|
30929
|
+
const recency = RECENCY_COLUMN[table.name];
|
|
30930
|
+
if (recency && table.pk.includes("project_id")) {
|
|
30931
|
+
const sameKey = keyColumns.map((column) => `o."${column}" = p."${column}"`).join(" AND ");
|
|
30932
|
+
const match = sameKey ? ` AND ${sameKey}` : "";
|
|
30933
|
+
db.prepare(
|
|
30934
|
+
`DELETE FROM ${quoted} AS o WHERE o.project_id = ? AND EXISTS (
|
|
30935
|
+
SELECT 1 FROM ${quoted} AS p
|
|
30936
|
+
WHERE p.project_id = ?${match} AND p."${recency}" > o."${recency}")`
|
|
30937
|
+
).run(toId, fromId);
|
|
30938
|
+
}
|
|
30939
|
+
const result = db.prepare(`UPDATE OR IGNORE ${quoted} SET project_id = ? WHERE project_id = ?`).run(toId, fromId);
|
|
30940
|
+
if (table.name === "snapshots") {
|
|
30941
|
+
movedSnapshots = result.changes;
|
|
30942
|
+
}
|
|
30943
|
+
}
|
|
30944
|
+
return movedSnapshots;
|
|
30945
|
+
}
|
|
30946
|
+
function migratePathProjectToOrigin(identity, db = getDb()) {
|
|
30947
|
+
if (!pendingPathProjectId(db, identity.localId)) {
|
|
30948
|
+
return { status: "none" };
|
|
30949
|
+
}
|
|
30950
|
+
let backupPath;
|
|
30951
|
+
try {
|
|
30952
|
+
backupPath = backupDatabase("before-project-origin", db);
|
|
30953
|
+
} catch (error) {
|
|
30954
|
+
return { status: "failed", error: error instanceof Error ? error.message : String(error) };
|
|
30955
|
+
}
|
|
30956
|
+
try {
|
|
30957
|
+
const run = db.transaction(() => {
|
|
30958
|
+
db.prepare("UPDATE projects SET local_id = local_id WHERE local_id = ?").run(identity.localId);
|
|
30959
|
+
const fromId = pendingPathProjectId(db, identity.localId);
|
|
30960
|
+
if (!fromId) {
|
|
30961
|
+
return { status: "none" };
|
|
30962
|
+
}
|
|
30963
|
+
const target = db.prepare("SELECT id FROM projects WHERE git_origin = ?").get(identity.gitOrigin);
|
|
30964
|
+
if (!target) {
|
|
30965
|
+
db.prepare(
|
|
30966
|
+
"UPDATE projects SET git_origin = ?, local_id = '', name = ?, local_path = ? WHERE id = ?"
|
|
30967
|
+
).run(identity.gitOrigin, identity.name, identity.root, fromId);
|
|
30968
|
+
const counted = db.prepare("SELECT COUNT(*) AS n FROM snapshots WHERE project_id = ?").get(fromId);
|
|
30969
|
+
return {
|
|
30970
|
+
status: "migrated",
|
|
30971
|
+
projectId: fromId,
|
|
30972
|
+
merged: false,
|
|
30973
|
+
movedSnapshots: counted?.n ?? 0,
|
|
30974
|
+
backupPath
|
|
30975
|
+
};
|
|
30976
|
+
}
|
|
30977
|
+
const movedSnapshots = mergeProjectRows(db, fromId, target.id);
|
|
30978
|
+
const leftover = db.prepare("SELECT COUNT(*) AS n FROM snapshots WHERE project_id = ?").get(fromId);
|
|
30979
|
+
if ((leftover?.n ?? 0) > 0) {
|
|
30980
|
+
throw new Error("Snapshots were left on the folder project; nothing was changed.");
|
|
30981
|
+
}
|
|
30982
|
+
db.prepare("DELETE FROM projects WHERE id = ?").run(fromId);
|
|
30983
|
+
db.prepare("UPDATE projects SET local_path = ? WHERE id = ?").run(identity.root, target.id);
|
|
30984
|
+
return { status: "migrated", projectId: target.id, merged: true, movedSnapshots, backupPath };
|
|
30985
|
+
});
|
|
30986
|
+
return run();
|
|
30987
|
+
} catch (error) {
|
|
30988
|
+
return {
|
|
30989
|
+
status: "failed",
|
|
30990
|
+
error: error instanceof Error ? error.message : String(error),
|
|
30991
|
+
backupPath
|
|
30992
|
+
};
|
|
30993
|
+
}
|
|
30994
|
+
}
|
|
30995
|
+
|
|
30788
30996
|
// src/services/project-status-payload.ts
|
|
30789
30997
|
function materialResources(resources) {
|
|
30790
30998
|
return resources.filter(
|
|
@@ -30932,11 +31140,11 @@ function formatDriftStatusLabel(project, driftReport) {
|
|
|
30932
31140
|
return `${formatCount(driftReport.changes.length, "change")} since snapshot ${driftReport.snapshot_id}`;
|
|
30933
31141
|
}
|
|
30934
31142
|
async function buildProjectStatusPayload(projectRoot) {
|
|
30935
|
-
const resolvedRoot =
|
|
30936
|
-
const
|
|
30937
|
-
const
|
|
30938
|
-
const
|
|
30939
|
-
const project =
|
|
31143
|
+
const resolvedRoot = resolve25(projectRoot);
|
|
31144
|
+
const identity = resolveProjectIdentity(resolvedRoot);
|
|
31145
|
+
const gitOriginRaw = identity.kind === "origin" ? identity.gitOriginRaw : void 0;
|
|
31146
|
+
const gitOrigin = identity.kind === "origin" ? identity.gitOrigin : null;
|
|
31147
|
+
const project = findProjectForRoot(resolvedRoot, identity) ?? getProjectByLocalPath(resolvedRoot) ?? null;
|
|
30940
31148
|
const configuredPluginIds = project ? getProjectConfiguredPlugins(project.id).map((row) => row.plugin_id) : [];
|
|
30941
31149
|
const environmentCascade = environmentCascadePayload({
|
|
30942
31150
|
configuredPluginIds
|
|
@@ -30984,22 +31192,22 @@ async function buildProjectStatusPayload(projectRoot) {
|
|
|
30984
31192
|
// src/services/resource-editor-path.ts
|
|
30985
31193
|
import {
|
|
30986
31194
|
existsSync as existsSync56,
|
|
30987
|
-
mkdirSync as
|
|
31195
|
+
mkdirSync as mkdirSync24,
|
|
30988
31196
|
readFileSync as readFileSync52,
|
|
30989
|
-
realpathSync as
|
|
31197
|
+
realpathSync as realpathSync5,
|
|
30990
31198
|
statSync as statSync20,
|
|
30991
31199
|
writeFileSync as writeFileSync20
|
|
30992
31200
|
} from "fs";
|
|
30993
|
-
import { dirname as dirname22, isAbsolute as isAbsolute12, join as
|
|
31201
|
+
import { dirname as dirname22, isAbsolute as isAbsolute12, join as join80, resolve as resolve26 } from "path";
|
|
30994
31202
|
function expandUserPath2(candidate) {
|
|
30995
31203
|
const trimmed = candidate.trim();
|
|
30996
31204
|
if (trimmed.startsWith("~/")) {
|
|
30997
|
-
return
|
|
31205
|
+
return join80(resolveHomeRoot(), trimmed.slice(2));
|
|
30998
31206
|
}
|
|
30999
31207
|
if (trimmed === "~") {
|
|
31000
31208
|
return resolveHomeRoot();
|
|
31001
31209
|
}
|
|
31002
|
-
return
|
|
31210
|
+
return resolve26(trimmed);
|
|
31003
31211
|
}
|
|
31004
31212
|
function isOpenableFile(path) {
|
|
31005
31213
|
if (!existsSync56(path)) {
|
|
@@ -31086,14 +31294,14 @@ function lookupRootsForResource(resource) {
|
|
|
31086
31294
|
const originDir = originDirectory(resource);
|
|
31087
31295
|
if (originDir) {
|
|
31088
31296
|
roots.push(originDir);
|
|
31089
|
-
roots.push(
|
|
31297
|
+
roots.push(join80(originDir, ".agents"));
|
|
31090
31298
|
}
|
|
31091
|
-
roots.push(
|
|
31299
|
+
roots.push(join80(resolveHomeRoot(), ".agents"));
|
|
31092
31300
|
return uniquePaths(roots);
|
|
31093
31301
|
}
|
|
31094
31302
|
function canonicalizeExistingPath(path) {
|
|
31095
31303
|
try {
|
|
31096
|
-
return
|
|
31304
|
+
return realpathSync5(path);
|
|
31097
31305
|
} catch {
|
|
31098
31306
|
return path;
|
|
31099
31307
|
}
|
|
@@ -31102,7 +31310,7 @@ function openableFileOrSkill(path) {
|
|
|
31102
31310
|
if (isOpenableFile(path)) {
|
|
31103
31311
|
return canonicalizeExistingPath(path);
|
|
31104
31312
|
}
|
|
31105
|
-
const skillMarkdown =
|
|
31313
|
+
const skillMarkdown = join80(path, "SKILL.md");
|
|
31106
31314
|
if (isOpenableFile(skillMarkdown)) {
|
|
31107
31315
|
return canonicalizeExistingPath(skillMarkdown);
|
|
31108
31316
|
}
|
|
@@ -31115,7 +31323,7 @@ function resolveExistingEditorPath(candidate, roots = []) {
|
|
|
31115
31323
|
}
|
|
31116
31324
|
if (isBareRelativePath(trimmed)) {
|
|
31117
31325
|
for (const root of roots) {
|
|
31118
|
-
const fromRoot = openableFileOrSkill(
|
|
31326
|
+
const fromRoot = openableFileOrSkill(resolve26(root, trimmed));
|
|
31119
31327
|
if (fromRoot) {
|
|
31120
31328
|
return fromRoot;
|
|
31121
31329
|
}
|
|
@@ -31358,8 +31566,8 @@ function resolveRegisteredScanTargets(harnessOption, homeRoot = resolveHomeRoot(
|
|
|
31358
31566
|
}
|
|
31359
31567
|
|
|
31360
31568
|
// src/services/profile-untracked-resources.ts
|
|
31361
|
-
import { existsSync as existsSync57, mkdirSync as
|
|
31362
|
-
import { dirname as dirname23, resolve as
|
|
31569
|
+
import { existsSync as existsSync57, mkdirSync as mkdirSync25, readFileSync as readFileSync53, writeFileSync as writeFileSync21 } from "fs";
|
|
31570
|
+
import { dirname as dirname23, resolve as resolve27 } from "path";
|
|
31363
31571
|
var MATERIAL_RESOURCE_TYPE_SET2 = new Set(MATERIAL_RESOURCE_TYPES);
|
|
31364
31572
|
function isMaterialResource(resource) {
|
|
31365
31573
|
return MATERIAL_RESOURCE_TYPE_SET2.has(resource.type);
|
|
@@ -31549,7 +31757,7 @@ async function notStagedFromProjectScan(profileSelector, projectPath) {
|
|
|
31549
31757
|
return [];
|
|
31550
31758
|
}
|
|
31551
31759
|
const committed = trackedResourceMap(profileSelector);
|
|
31552
|
-
const resolvedRoot =
|
|
31760
|
+
const resolvedRoot = resolve27(projectPath);
|
|
31553
31761
|
const scanStatus = await assessProjectScanStatus(resolvedRoot);
|
|
31554
31762
|
const platformIds = scanStatus.on_disk.platforms;
|
|
31555
31763
|
const ownedPaths = await profileOwnedPaths(
|
|
@@ -31681,7 +31889,7 @@ async function resolveUntrackedScanResults(input) {
|
|
|
31681
31889
|
if (!input.projectPath) {
|
|
31682
31890
|
throw new Error("projectPath is required for project scope");
|
|
31683
31891
|
}
|
|
31684
|
-
const originRef2 =
|
|
31892
|
+
const originRef2 = resolve27(input.projectPath);
|
|
31685
31893
|
const scanned2 = await scanProject(originRef2);
|
|
31686
31894
|
const ownedPaths2 = await profileOwnedPaths(
|
|
31687
31895
|
input.profileSelector,
|
|
@@ -31791,7 +31999,7 @@ function filterScanResultsToNotStaged(results, committed, ownedPaths, rootPath,
|
|
|
31791
31999
|
return filtered;
|
|
31792
32000
|
}
|
|
31793
32001
|
function readHomeFile2(homeRoot, relativePath2) {
|
|
31794
|
-
const fullPath =
|
|
32002
|
+
const fullPath = resolve27(homeRoot, relativePath2);
|
|
31795
32003
|
if (!existsSync57(fullPath)) {
|
|
31796
32004
|
return null;
|
|
31797
32005
|
}
|
|
@@ -31885,8 +32093,8 @@ function restoreUntrackedStashFiles(homeRoot, files, dryRun = false) {
|
|
|
31885
32093
|
restored.push(file.path);
|
|
31886
32094
|
continue;
|
|
31887
32095
|
}
|
|
31888
|
-
const fullPath =
|
|
31889
|
-
|
|
32096
|
+
const fullPath = resolve27(homeRoot, file.path);
|
|
32097
|
+
mkdirSync25(dirname23(fullPath), { recursive: true });
|
|
31890
32098
|
writeFileSync21(fullPath, file.content, "utf-8");
|
|
31891
32099
|
restored.push(file.path);
|
|
31892
32100
|
}
|
|
@@ -32095,8 +32303,8 @@ function isInstructionManagedPath(path, rootPath) {
|
|
|
32095
32303
|
if (pathMatchesKnownFile(path, REGISTRY_INSTRUCTION_FILE_PATHS, rootPath)) {
|
|
32096
32304
|
return true;
|
|
32097
32305
|
}
|
|
32098
|
-
const
|
|
32099
|
-
return Boolean(
|
|
32306
|
+
const basename14 = normalizeManagedPath(path, rootPath).split("/").pop()?.toLowerCase();
|
|
32307
|
+
return Boolean(basename14 && INSTRUCTION_FILE_BASENAMES.has(basename14));
|
|
32100
32308
|
}
|
|
32101
32309
|
function isPluginRegistryManagedPath(path, rootPath) {
|
|
32102
32310
|
const normalized = normalizeManagedPath(path, rootPath).replace(/^~\//, "");
|
|
@@ -32106,7 +32314,7 @@ function isSourceBoundCommitPath(path, rootPath) {
|
|
|
32106
32314
|
return isAggregateConfigManagedPath(path, rootPath) || isInstructionManagedPath(path, rootPath) || isPluginRegistryManagedPath(path, rootPath);
|
|
32107
32315
|
}
|
|
32108
32316
|
async function scanForCommit(input) {
|
|
32109
|
-
const originRef = input.scope === "project" ?
|
|
32317
|
+
const originRef = input.scope === "project" ? resolve28(input.projectPath ?? "") : resolveHomeRoot();
|
|
32110
32318
|
if (input.scope === "project" && !input.projectPath) {
|
|
32111
32319
|
throw new Error("projectPath is required for project scope");
|
|
32112
32320
|
}
|
|
@@ -32240,7 +32448,7 @@ async function commitManagedResourceFromLive(input) {
|
|
|
32240
32448
|
})).filter((result) => result.resources.length > 0);
|
|
32241
32449
|
if (matching.length === 0) {
|
|
32242
32450
|
if (input.path && attached.type === "instruction") {
|
|
32243
|
-
const fullPath =
|
|
32451
|
+
const fullPath = join81(originRef, normalizeManagedPath(input.path, originRef));
|
|
32244
32452
|
if (!existsSync58(fullPath)) {
|
|
32245
32453
|
throw new Error(`Live file not found: ${input.path}`);
|
|
32246
32454
|
}
|
|
@@ -32294,7 +32502,7 @@ async function commitManagedResourceFromLive(input) {
|
|
|
32294
32502
|
function mirrorCommittedSkillContent(originRef, name, content) {
|
|
32295
32503
|
const dirs = collectManagedSkillPlacements(originRef).get(name) ?? [];
|
|
32296
32504
|
for (const dir of dirs) {
|
|
32297
|
-
const fullPath =
|
|
32505
|
+
const fullPath = join81(originRef, `${dir}${name}/SKILL.md`);
|
|
32298
32506
|
if (!existsSync58(fullPath)) {
|
|
32299
32507
|
continue;
|
|
32300
32508
|
}
|
|
@@ -32583,21 +32791,21 @@ function persistWrittenMaterializations(input) {
|
|
|
32583
32791
|
import {
|
|
32584
32792
|
existsSync as existsSync59,
|
|
32585
32793
|
lstatSync as lstatSync22,
|
|
32586
|
-
mkdirSync as
|
|
32794
|
+
mkdirSync as mkdirSync26,
|
|
32587
32795
|
readFileSync as readFileSync56,
|
|
32588
32796
|
readdirSync as readdirSync21,
|
|
32589
32797
|
rmSync as rmSync8,
|
|
32590
32798
|
statSync as statSync21,
|
|
32591
32799
|
writeFileSync as writeFileSync23
|
|
32592
32800
|
} from "fs";
|
|
32593
|
-
import { join as
|
|
32801
|
+
import { join as join82, relative as relative22, resolve as resolve29, sep as sep17 } from "path";
|
|
32594
32802
|
var KEEP = 50;
|
|
32595
32803
|
function ownershipDir() {
|
|
32596
|
-
return
|
|
32804
|
+
return join82(getHarnesstapDir(), "cache", "removed-ownership");
|
|
32597
32805
|
}
|
|
32598
32806
|
function ownershipFile(snapshotId, suffix = "") {
|
|
32599
32807
|
if (!/^[0-9A-Za-z_-]+$/.test(snapshotId)) return void 0;
|
|
32600
|
-
return
|
|
32808
|
+
return join82(ownershipDir(), `${snapshotId}${suffix}.json`);
|
|
32601
32809
|
}
|
|
32602
32810
|
function readSaved(path) {
|
|
32603
32811
|
try {
|
|
@@ -32612,7 +32820,7 @@ function prune() {
|
|
|
32612
32820
|
try {
|
|
32613
32821
|
for (const name of readdirSync21(ownershipDir())) {
|
|
32614
32822
|
const stem = name.split(".")[0] ?? name;
|
|
32615
|
-
const mtime = statSync21(
|
|
32823
|
+
const mtime = statSync21(join82(ownershipDir(), name)).mtimeMs;
|
|
32616
32824
|
const entry = newest.get(stem) ?? { names: [], mtime: 0 };
|
|
32617
32825
|
entry.names.push(name);
|
|
32618
32826
|
entry.mtime = Math.max(entry.mtime, mtime);
|
|
@@ -32623,7 +32831,7 @@ function prune() {
|
|
|
32623
32831
|
}
|
|
32624
32832
|
const ordered = [...newest.values()].sort((a, b) => b.mtime - a.mtime);
|
|
32625
32833
|
for (const extra of ordered.slice(KEEP)) {
|
|
32626
|
-
for (const name of extra.names) rmSync8(
|
|
32834
|
+
for (const name of extra.names) rmSync8(join82(ownershipDir(), name), { force: true });
|
|
32627
32835
|
}
|
|
32628
32836
|
}
|
|
32629
32837
|
function saveRemovedOwnership(snapshotId, rootPath, relativePaths) {
|
|
@@ -32639,7 +32847,7 @@ function saveRemovedOwnership(snapshotId, rootPath, relativePaths) {
|
|
|
32639
32847
|
}
|
|
32640
32848
|
if (rows.length === 0) return;
|
|
32641
32849
|
try {
|
|
32642
|
-
|
|
32850
|
+
mkdirSync26(ownershipDir(), { recursive: true });
|
|
32643
32851
|
writeFileSync23(file, `${JSON.stringify([...readSaved(file), ...rows], null, 2)}
|
|
32644
32852
|
`);
|
|
32645
32853
|
prune();
|
|
@@ -32652,9 +32860,9 @@ function restoreRemovedOwnership(input) {
|
|
|
32652
32860
|
const restored = new Set(input.restoredPaths);
|
|
32653
32861
|
let count = 0;
|
|
32654
32862
|
for (const row of readSaved(file)) {
|
|
32655
|
-
if (!restored.has(row.path) ||
|
|
32863
|
+
if (!restored.has(row.path) || resolve29(row.root_path) !== resolve29(input.rootPath)) continue;
|
|
32656
32864
|
const merged = input.isMergedConfig?.(row.path) === true;
|
|
32657
|
-
if (!merged && input.hashOf(
|
|
32865
|
+
if (!merged && input.hashOf(resolve29(input.rootPath, row.path)) !== row.generated_hash) continue;
|
|
32658
32866
|
try {
|
|
32659
32867
|
recordResourceMaterialization(row);
|
|
32660
32868
|
count += 1;
|
|
@@ -32682,7 +32890,7 @@ function saveRemovedHostPluginViews(snapshotId, rootPath, relativePaths) {
|
|
|
32682
32890
|
const known = new Set(saved.map((entry) => entry.view));
|
|
32683
32891
|
let added = false;
|
|
32684
32892
|
for (const path of relativePaths) {
|
|
32685
|
-
const target =
|
|
32893
|
+
const target = resolve29(rootPath, path);
|
|
32686
32894
|
const view = views.find((candidate) => target.startsWith(`${candidate}${sep17}`));
|
|
32687
32895
|
const record = view ? records[view] : void 0;
|
|
32688
32896
|
if (!view || !record || record.legacy || known.has(view)) continue;
|
|
@@ -32692,7 +32900,7 @@ function saveRemovedHostPluginViews(snapshotId, rootPath, relativePaths) {
|
|
|
32692
32900
|
}
|
|
32693
32901
|
if (!added) return;
|
|
32694
32902
|
try {
|
|
32695
|
-
|
|
32903
|
+
mkdirSync26(ownershipDir(), { recursive: true });
|
|
32696
32904
|
writeFileSync23(file, `${JSON.stringify(saved, null, 2)}
|
|
32697
32905
|
`);
|
|
32698
32906
|
prune();
|
|
@@ -32707,7 +32915,7 @@ function folderHoldsOnly(dir, known, base = dir) {
|
|
|
32707
32915
|
return false;
|
|
32708
32916
|
}
|
|
32709
32917
|
for (const name of names) {
|
|
32710
|
-
const full =
|
|
32918
|
+
const full = join82(dir, name);
|
|
32711
32919
|
let isDirectory8;
|
|
32712
32920
|
try {
|
|
32713
32921
|
isDirectory8 = lstatSync22(full).isDirectory();
|
|
@@ -32725,12 +32933,12 @@ function folderHoldsOnly(dir, known, base = dir) {
|
|
|
32725
32933
|
function restoreRemovedHostPluginViews(input) {
|
|
32726
32934
|
const file = ownershipFile(input.snapshotId, ".views");
|
|
32727
32935
|
if (!file || !existsSync59(file)) return 0;
|
|
32728
|
-
const restored = new Set(input.restoredPaths.map((path) =>
|
|
32936
|
+
const restored = new Set(input.restoredPaths.map((path) => resolve29(input.rootPath, path)));
|
|
32729
32937
|
let count = 0;
|
|
32730
32938
|
for (const { view, record } of readSavedViews(file)) {
|
|
32731
32939
|
const files = {};
|
|
32732
32940
|
for (const [path, hash] of Object.entries(record.files)) {
|
|
32733
|
-
const full =
|
|
32941
|
+
const full = resolve29(view, path);
|
|
32734
32942
|
if (restored.has(full) && input.hashOf(full) === hash) files[path] = hash;
|
|
32735
32943
|
}
|
|
32736
32944
|
if (Object.keys(files).length === 0) continue;
|
|
@@ -32743,14 +32951,14 @@ function restoreRemovedHostPluginViews(input) {
|
|
|
32743
32951
|
|
|
32744
32952
|
// src/services/restore-blocker.ts
|
|
32745
32953
|
import { lstatSync as lstatSync23, statSync as statSync22 } from "fs";
|
|
32746
|
-
import { dirname as dirname24, join as
|
|
32954
|
+
import { dirname as dirname24, join as join83, relative as relative23, resolve as resolve30, sep as sep18 } from "path";
|
|
32747
32955
|
function restoreBlocker(rootPath, relativePath2) {
|
|
32748
|
-
const root =
|
|
32749
|
-
const target =
|
|
32956
|
+
const root = resolve30(rootPath);
|
|
32957
|
+
const target = resolve30(root, relativePath2);
|
|
32750
32958
|
const parts = relative23(root, dirname24(target)).split(sep18).filter((part) => part.length > 0);
|
|
32751
32959
|
let current = root;
|
|
32752
32960
|
for (const part of parts) {
|
|
32753
|
-
current =
|
|
32961
|
+
current = join83(current, part);
|
|
32754
32962
|
try {
|
|
32755
32963
|
lstatSync23(current);
|
|
32756
32964
|
} catch {
|
|
@@ -32867,7 +33075,7 @@ var CONTAINER_DIR_NAMES = /* @__PURE__ */ new Set([
|
|
|
32867
33075
|
"plugins"
|
|
32868
33076
|
]);
|
|
32869
33077
|
function applyTrashRoot() {
|
|
32870
|
-
return
|
|
33078
|
+
return join84(getHarnesstapDir(), "trash");
|
|
32871
33079
|
}
|
|
32872
33080
|
function hashOnDiskFile(fullPath) {
|
|
32873
33081
|
if (!inStatusComputation()) return hashOnDiskFileUncached(fullPath);
|
|
@@ -32904,16 +33112,16 @@ function leafLinkLeavesRoot(rootPath, fullPath) {
|
|
|
32904
33112
|
if (!isSymlinkPath(fullPath)) return false;
|
|
32905
33113
|
let root;
|
|
32906
33114
|
try {
|
|
32907
|
-
root =
|
|
33115
|
+
root = realpathSync6(rootPath);
|
|
32908
33116
|
} catch {
|
|
32909
33117
|
return true;
|
|
32910
33118
|
}
|
|
32911
33119
|
let target;
|
|
32912
33120
|
try {
|
|
32913
|
-
target =
|
|
33121
|
+
target = realpathSync6(fullPath);
|
|
32914
33122
|
} catch {
|
|
32915
33123
|
try {
|
|
32916
|
-
target =
|
|
33124
|
+
target = resolve31(dirname25(fullPath), readlinkSync6(fullPath));
|
|
32917
33125
|
} catch {
|
|
32918
33126
|
return true;
|
|
32919
33127
|
}
|
|
@@ -32936,11 +33144,11 @@ function normalizeRelative(path) {
|
|
|
32936
33144
|
var HOST_PLUGIN_CACHE_SEGMENT = "plugins/cache/";
|
|
32937
33145
|
function hostPluginViewSaysNotWritten(rootPath, relativePath2) {
|
|
32938
33146
|
const normalized = normalizeRelative(relativePath2);
|
|
32939
|
-
return normalized.includes(HOST_PLUGIN_CACHE_SEGMENT) && hostPluginViewWrittenHash(
|
|
33147
|
+
return normalized.includes(HOST_PLUGIN_CACHE_SEGMENT) && hostPluginViewWrittenHash(resolve31(rootPath, normalized)) === null;
|
|
32940
33148
|
}
|
|
32941
33149
|
function classifyManagedPathOwnership(rootPath, relativePath2) {
|
|
32942
33150
|
const normalized = normalizeRelative(relativePath2);
|
|
32943
|
-
const fullPath =
|
|
33151
|
+
const fullPath = resolve31(rootPath, normalized);
|
|
32944
33152
|
const linkLeavesRoot = leafLinkLeavesRoot(rootPath, fullPath);
|
|
32945
33153
|
if (normalized.includes(HOST_PLUGIN_CACHE_SEGMENT)) {
|
|
32946
33154
|
const written = hostPluginViewWrittenHash(fullPath);
|
|
@@ -32965,7 +33173,7 @@ function hasHarnessTapMaterialization(rootPath, relativePath2) {
|
|
|
32965
33173
|
}
|
|
32966
33174
|
function hasCurrentHarnessTapMaterialization(rootPath, relativePath2) {
|
|
32967
33175
|
const normalized = normalizeRelative(relativePath2);
|
|
32968
|
-
const diskHash = hashOnDiskFile(
|
|
33176
|
+
const diskHash = hashOnDiskFile(resolve31(rootPath, normalized));
|
|
32969
33177
|
return listMaterializationsForRootPath(rootPath, normalized).some((row) => row.generated_hash === diskHash);
|
|
32970
33178
|
}
|
|
32971
33179
|
function isHarnessTapOwnedPath(rootPath, relativePath2) {
|
|
@@ -33040,7 +33248,7 @@ function planSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
|
33040
33248
|
continue;
|
|
33041
33249
|
}
|
|
33042
33250
|
seen.add(relativePath2);
|
|
33043
|
-
const fullPath =
|
|
33251
|
+
const fullPath = resolve31(rootPath, relativePath2);
|
|
33044
33252
|
if (!existsSync60(fullPath) && !isSymlinkPath(fullPath)) {
|
|
33045
33253
|
skip.push({
|
|
33046
33254
|
path: relativePath2,
|
|
@@ -33104,14 +33312,14 @@ function planSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
|
33104
33312
|
function copyToTrash(applyId, relativePath2, bytes) {
|
|
33105
33313
|
const dest = removalBackupTrashFile(applyId, relativePath2);
|
|
33106
33314
|
if (pathExists2(dest)) return dest;
|
|
33107
|
-
|
|
33315
|
+
mkdirSync27(dirname25(dest), { recursive: true });
|
|
33108
33316
|
writeFileSync24(dest, bytes);
|
|
33109
33317
|
return dest;
|
|
33110
33318
|
}
|
|
33111
33319
|
function linkToTrash(applyId, relativePath2, target) {
|
|
33112
33320
|
const dest = removalBackupTrashFile(applyId, relativePath2);
|
|
33113
33321
|
if (pathExists2(dest)) return;
|
|
33114
|
-
|
|
33322
|
+
mkdirSync27(dirname25(dest), { recursive: true });
|
|
33115
33323
|
try {
|
|
33116
33324
|
symlinkSync5(target, dest);
|
|
33117
33325
|
} catch {
|
|
@@ -33136,7 +33344,7 @@ function pruneApplyTrash(keepLast = APPLY_TRASH_KEEP) {
|
|
|
33136
33344
|
return;
|
|
33137
33345
|
}
|
|
33138
33346
|
const dirs = entries.filter((name) => !pinned.has(name)).map((name) => {
|
|
33139
|
-
const full =
|
|
33347
|
+
const full = join84(root, name);
|
|
33140
33348
|
try {
|
|
33141
33349
|
const stat = statSync23(full);
|
|
33142
33350
|
return { full, mtime: stat.mtimeMs, isDir: stat.isDirectory() };
|
|
@@ -33152,13 +33360,13 @@ function pruneApplyTrash(keepLast = APPLY_TRASH_KEEP) {
|
|
|
33152
33360
|
}
|
|
33153
33361
|
var EMPTY_DIR_PRUNE_STOP = new Set(CONTAINER_DIR_NAMES);
|
|
33154
33362
|
function pruneEmptyAncestors(filePath, stopAt) {
|
|
33155
|
-
const stop =
|
|
33363
|
+
const stop = resolve31(stopAt);
|
|
33156
33364
|
let current = dirname25(filePath);
|
|
33157
33365
|
while (current !== stop) {
|
|
33158
|
-
if (
|
|
33366
|
+
if (resolve31(current) === stop) {
|
|
33159
33367
|
break;
|
|
33160
33368
|
}
|
|
33161
|
-
const base =
|
|
33369
|
+
const base = basename9(current);
|
|
33162
33370
|
if (EMPTY_DIR_PRUNE_STOP.has(base)) {
|
|
33163
33371
|
break;
|
|
33164
33372
|
}
|
|
@@ -33188,7 +33396,7 @@ function pathExists2(path) {
|
|
|
33188
33396
|
function stashPristineFile(input) {
|
|
33189
33397
|
const dest = removalBackupTrashFile(input.applyId, input.relativePath);
|
|
33190
33398
|
if (pathExists2(dest)) return false;
|
|
33191
|
-
|
|
33399
|
+
mkdirSync27(dirname25(dest), { recursive: true });
|
|
33192
33400
|
if (input.move) {
|
|
33193
33401
|
try {
|
|
33194
33402
|
renameSync(input.fullPath, dest);
|
|
@@ -33208,7 +33416,7 @@ function stashPristineFile(input) {
|
|
|
33208
33416
|
return true;
|
|
33209
33417
|
}
|
|
33210
33418
|
function backupOnDiskFile(input) {
|
|
33211
|
-
const fullPath =
|
|
33419
|
+
const fullPath = resolve31(input.rootPath, input.relativePath);
|
|
33212
33420
|
if (isSymlinkPath(fullPath)) {
|
|
33213
33421
|
const target = readlinkSync6(fullPath, { encoding: "buffer" });
|
|
33214
33422
|
recordApplyRemovalBackup({
|
|
@@ -33248,17 +33456,17 @@ function backupOnDiskFile(input) {
|
|
|
33248
33456
|
copyToTrash(input.applyId, input.relativePath, bytes);
|
|
33249
33457
|
}
|
|
33250
33458
|
function backupAndUnlink(input) {
|
|
33251
|
-
const fullPath =
|
|
33459
|
+
const fullPath = resolve31(input.rootPath, input.relativePath);
|
|
33252
33460
|
backupOnDiskFile({ ...input, move: true });
|
|
33253
33461
|
removeFileOrLink(fullPath);
|
|
33254
33462
|
pruneEmptyAncestors(fullPath, input.rootPath);
|
|
33255
33463
|
input.removedPaths.push(fullPath);
|
|
33256
33464
|
}
|
|
33257
33465
|
function backupAndRewriteFile(input) {
|
|
33258
|
-
const fullPath =
|
|
33466
|
+
const fullPath = resolve31(input.rootPath, input.relativePath);
|
|
33259
33467
|
if (!existsSync60(fullPath)) {
|
|
33260
33468
|
if (input.nextContent === null) return;
|
|
33261
|
-
|
|
33469
|
+
mkdirSync27(dirname25(fullPath), { recursive: true });
|
|
33262
33470
|
writeFileSync24(fullPath, input.nextContent);
|
|
33263
33471
|
restoreFileMode(fullPath, input.mode);
|
|
33264
33472
|
return;
|
|
@@ -33284,10 +33492,10 @@ function backupAndRewriteFile(input) {
|
|
|
33284
33492
|
}
|
|
33285
33493
|
}
|
|
33286
33494
|
function executeSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
33287
|
-
const applyId = options.applyId ??
|
|
33495
|
+
const applyId = options.applyId ?? ulid15();
|
|
33288
33496
|
const plan = planSafeFileRemovals(rootPath, relativePaths, options);
|
|
33289
33497
|
const warnings = plan.skip.filter((entry) => entry.reason !== "missing").map((entry) => entry.message);
|
|
33290
|
-
const backupDir =
|
|
33498
|
+
const backupDir = join84(applyTrashRoot(), applyId);
|
|
33291
33499
|
if (options.dryRun) {
|
|
33292
33500
|
return {
|
|
33293
33501
|
applyId,
|
|
@@ -33346,9 +33554,9 @@ function restoreSafeRemovalBackup(input) {
|
|
|
33346
33554
|
});
|
|
33347
33555
|
const restored = [];
|
|
33348
33556
|
for (const backup of backups) {
|
|
33349
|
-
const fullPath =
|
|
33557
|
+
const fullPath = resolve31(input.rootPath, backup.relative_path);
|
|
33350
33558
|
if (!free(backup.relative_path, fullPath)) continue;
|
|
33351
|
-
|
|
33559
|
+
mkdirSync27(dirname25(fullPath), { recursive: true });
|
|
33352
33560
|
if (((backup.mode ?? 0) & S_IFMT3) === S_IFLNK4) {
|
|
33353
33561
|
symlinkSync5(backup.content, fullPath);
|
|
33354
33562
|
} else {
|
|
@@ -33364,22 +33572,22 @@ function restoreSafeRemovalBackup(input) {
|
|
|
33364
33572
|
if (!applyId) {
|
|
33365
33573
|
return restored;
|
|
33366
33574
|
}
|
|
33367
|
-
const trashDir =
|
|
33575
|
+
const trashDir = join84(applyTrashRoot(), applyId);
|
|
33368
33576
|
if (!existsSync60(trashDir)) {
|
|
33369
33577
|
return restored;
|
|
33370
33578
|
}
|
|
33371
33579
|
const walk = (dir, prefix) => {
|
|
33372
33580
|
for (const name of readdirSync22(dir)) {
|
|
33373
|
-
const full =
|
|
33581
|
+
const full = join84(dir, name);
|
|
33374
33582
|
const rel = prefix ? `${prefix}/${name}` : name;
|
|
33375
33583
|
const stat = lstatSync24(full);
|
|
33376
33584
|
if (stat.isDirectory()) {
|
|
33377
33585
|
walk(full, rel);
|
|
33378
33586
|
continue;
|
|
33379
33587
|
}
|
|
33380
|
-
const dest =
|
|
33588
|
+
const dest = resolve31(input.rootPath, rel);
|
|
33381
33589
|
if (!free(rel, dest)) continue;
|
|
33382
|
-
|
|
33590
|
+
mkdirSync27(dirname25(dest), { recursive: true });
|
|
33383
33591
|
if (stat.isSymbolicLink()) {
|
|
33384
33592
|
symlinkSync5(readlinkSync6(full, { encoding: "buffer" }), dest);
|
|
33385
33593
|
} else {
|
|
@@ -33444,7 +33652,7 @@ function pathSegment(value) {
|
|
|
33444
33652
|
return replaced;
|
|
33445
33653
|
}
|
|
33446
33654
|
function pluginInstallRootPath(pluginName, version) {
|
|
33447
|
-
return
|
|
33655
|
+
return join85(
|
|
33448
33656
|
getHarnesstapDir(),
|
|
33449
33657
|
"cache",
|
|
33450
33658
|
"agent-plugins",
|
|
@@ -33464,7 +33672,7 @@ function containedDest(root, relativePath2) {
|
|
|
33464
33672
|
if (parts.some((part) => part.length === 0 || part === "." || part === "..")) {
|
|
33465
33673
|
return void 0;
|
|
33466
33674
|
}
|
|
33467
|
-
const dest =
|
|
33675
|
+
const dest = resolve32(root, ...parts);
|
|
33468
33676
|
const rel = relative24(root, dest);
|
|
33469
33677
|
if (rel.startsWith("..") || isAbsolute13(rel)) return void 0;
|
|
33470
33678
|
return dest;
|
|
@@ -33492,7 +33700,7 @@ function deleteInstallRow(pluginName, version, relativePath2) {
|
|
|
33492
33700
|
).run(pluginName, version, relativePath2);
|
|
33493
33701
|
}
|
|
33494
33702
|
function backupFile(root, relativePath2, applyId) {
|
|
33495
|
-
const fullPath =
|
|
33703
|
+
const fullPath = resolve32(root, ...relativePath2.split("/"));
|
|
33496
33704
|
const bytes = readFileSync58(fullPath);
|
|
33497
33705
|
let mode = 0;
|
|
33498
33706
|
try {
|
|
@@ -33506,12 +33714,12 @@ function backupFile(root, relativePath2, applyId) {
|
|
|
33506
33714
|
content: bytes,
|
|
33507
33715
|
mode
|
|
33508
33716
|
});
|
|
33509
|
-
const dest =
|
|
33510
|
-
|
|
33717
|
+
const dest = join85(applyTrashRoot(), applyId, ...relativePath2.split("/"));
|
|
33718
|
+
mkdirSync28(resolve32(dest, ".."), { recursive: true });
|
|
33511
33719
|
writeFileSync25(dest, bytes);
|
|
33512
33720
|
}
|
|
33513
33721
|
function writeOwnedFile(dest, relativePath2, bytes) {
|
|
33514
|
-
|
|
33722
|
+
mkdirSync28(resolve32(dest, ".."), { recursive: true });
|
|
33515
33723
|
const mode = relativePath2.startsWith("bin/") ? 493 : 420;
|
|
33516
33724
|
writeFileSync25(dest, bytes, { mode });
|
|
33517
33725
|
if (relativePath2.startsWith("bin/")) {
|
|
@@ -33528,8 +33736,8 @@ function installAgentPluginPackage(plugin, files) {
|
|
|
33528
33736
|
);
|
|
33529
33737
|
return { path: root, warnings, backedUp };
|
|
33530
33738
|
}
|
|
33531
|
-
|
|
33532
|
-
const applyId = `plugin-install-${
|
|
33739
|
+
mkdirSync28(root, { recursive: true });
|
|
33740
|
+
const applyId = `plugin-install-${ulid16()}`;
|
|
33533
33741
|
const owned = new Map(listInstallRows(plugin.name, plugin.version).map((row) => [row.relative_path, row]));
|
|
33534
33742
|
const nextPaths = /* @__PURE__ */ new Set();
|
|
33535
33743
|
for (const relativePath2 of Object.keys(files).sort()) {
|
|
@@ -33742,11 +33950,11 @@ function parseMarkdownComponent(type, layoutPath, files) {
|
|
|
33742
33950
|
if (!relativePath2.startsWith(prefix) || !relativePath2.endsWith(".md")) continue;
|
|
33743
33951
|
const entry = files[relativePath2];
|
|
33744
33952
|
if (!entry) continue;
|
|
33745
|
-
const
|
|
33746
|
-
if (!
|
|
33953
|
+
const basename14 = relativePath2.slice(prefix.length, -".md".length);
|
|
33954
|
+
if (!basename14 || basename14.includes("/")) continue;
|
|
33747
33955
|
const parsed = parseFrontmatter(fileText2(entry));
|
|
33748
33956
|
const data = isRecord34(parsed.data) ? { ...parsed.data } : {};
|
|
33749
|
-
const name = typeof data.name === "string" && data.name.length > 0 ? data.name :
|
|
33957
|
+
const name = typeof data.name === "string" && data.name.length > 0 ? data.name : basename14;
|
|
33750
33958
|
const description = typeof data.description === "string" ? data.description : "";
|
|
33751
33959
|
delete data.name;
|
|
33752
33960
|
delete data.description;
|
|
@@ -33977,7 +34185,7 @@ import {
|
|
|
33977
34185
|
renameSync as renameSync2,
|
|
33978
34186
|
rmSync as rmSync10
|
|
33979
34187
|
} from "fs";
|
|
33980
|
-
import { dirname as dirname26, join as
|
|
34188
|
+
import { dirname as dirname26, join as join86, relative as relative25, sep as sep20 } from "path";
|
|
33981
34189
|
function skipped(rel) {
|
|
33982
34190
|
return rel === ".git" || rel.startsWith(".git/") || rel === "node_modules" || rel.startsWith("node_modules/");
|
|
33983
34191
|
}
|
|
@@ -33991,7 +34199,7 @@ function treeFiles(root) {
|
|
|
33991
34199
|
return;
|
|
33992
34200
|
}
|
|
33993
34201
|
for (const entry of entries) {
|
|
33994
|
-
const full =
|
|
34202
|
+
const full = join86(dir, entry.name);
|
|
33995
34203
|
const rel = relative25(root, full).split(sep20).join("/");
|
|
33996
34204
|
if (skipped(rel)) continue;
|
|
33997
34205
|
if (entry.isDirectory()) walk(full);
|
|
@@ -34021,7 +34229,7 @@ function sameTree(left, right) {
|
|
|
34021
34229
|
const rightFiles = treeFiles(right);
|
|
34022
34230
|
if (leftFiles.length !== rightFiles.length) return false;
|
|
34023
34231
|
return leftFiles.every(
|
|
34024
|
-
(path, index) => path === rightFiles[index] && sameEntry(
|
|
34232
|
+
(path, index) => path === rightFiles[index] && sameEntry(join86(left, path), join86(right, path))
|
|
34025
34233
|
);
|
|
34026
34234
|
}
|
|
34027
34235
|
function refreshCachedHostPluginVersion(input) {
|
|
@@ -34032,7 +34240,7 @@ function refreshCachedHostPluginVersion(input) {
|
|
|
34032
34240
|
if (!existsSync62(canonical) || !isPluginInstallRoot(canonical)) return false;
|
|
34033
34241
|
if (!isPluginInstallRoot(input.sourceInstallRoot)) return false;
|
|
34034
34242
|
if (sameTree(input.sourceInstallRoot, canonical)) return false;
|
|
34035
|
-
const staging =
|
|
34243
|
+
const staging = join86(dirname26(canonical), `.refresh-${process.pid}-${Date.now()}`);
|
|
34036
34244
|
rmSync10(staging, { recursive: true, force: true });
|
|
34037
34245
|
cpSync4(input.sourceInstallRoot, staging, {
|
|
34038
34246
|
recursive: true,
|
|
@@ -34053,14 +34261,14 @@ function isDirectory7(path) {
|
|
|
34053
34261
|
return existsSync63(path) && statSync24(path).isDirectory();
|
|
34054
34262
|
}
|
|
34055
34263
|
function resolveMarketplacePluginDirectory(cacheDir, pluginName) {
|
|
34056
|
-
const underPlugins =
|
|
34264
|
+
const underPlugins = join87(cacheDir, "plugins", pluginName);
|
|
34057
34265
|
if (isDirectory7(underPlugins) && isPluginInstallRoot(underPlugins)) {
|
|
34058
34266
|
return underPlugins;
|
|
34059
34267
|
}
|
|
34060
34268
|
if (isDirectory7(underPlugins)) {
|
|
34061
34269
|
return underPlugins;
|
|
34062
34270
|
}
|
|
34063
|
-
const atRoot =
|
|
34271
|
+
const atRoot = join87(cacheDir, pluginName);
|
|
34064
34272
|
if (isDirectory7(atRoot) && isPluginInstallRoot(atRoot)) {
|
|
34065
34273
|
return atRoot;
|
|
34066
34274
|
}
|
|
@@ -34072,7 +34280,7 @@ function resolveMarketplacePluginDirectory(cacheDir, pluginName) {
|
|
|
34072
34280
|
if (!entry.isDirectory() || entry.name === ".git") {
|
|
34073
34281
|
continue;
|
|
34074
34282
|
}
|
|
34075
|
-
const nested =
|
|
34283
|
+
const nested = join87(cacheDir, entry.name, pluginName);
|
|
34076
34284
|
if (isDirectory7(nested) && isPluginInstallRoot(nested)) {
|
|
34077
34285
|
return nested;
|
|
34078
34286
|
}
|
|
@@ -34092,7 +34300,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
34092
34300
|
if (!entry.isDirectory() || PLUGIN_ROOT_WALK_SKIP.has(entry.name)) {
|
|
34093
34301
|
continue;
|
|
34094
34302
|
}
|
|
34095
|
-
const child =
|
|
34303
|
+
const child = join87(dir, entry.name);
|
|
34096
34304
|
if (entry.name === pluginName && isPluginInstallRoot(child)) {
|
|
34097
34305
|
return child;
|
|
34098
34306
|
}
|
|
@@ -34102,7 +34310,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
34102
34310
|
continue;
|
|
34103
34311
|
}
|
|
34104
34312
|
const found = walkNamedPluginInstallRoot(
|
|
34105
|
-
|
|
34313
|
+
join87(dir, entry.name),
|
|
34106
34314
|
pluginName,
|
|
34107
34315
|
depth + 1
|
|
34108
34316
|
);
|
|
@@ -34117,7 +34325,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
34117
34325
|
}
|
|
34118
34326
|
function gitOriginCacheDir(harnesstapDir, url) {
|
|
34119
34327
|
const digest = createHash14("sha256").update(url, "utf8").digest("hex");
|
|
34120
|
-
return
|
|
34328
|
+
return join87(harnesstapDir, "cache", "git-origins", digest);
|
|
34121
34329
|
}
|
|
34122
34330
|
function originPluginLookupName(plugin, locator) {
|
|
34123
34331
|
switch (locator.kind) {
|
|
@@ -34455,7 +34663,7 @@ function parseMarketplacePluginSource(entry) {
|
|
|
34455
34663
|
}
|
|
34456
34664
|
}
|
|
34457
34665
|
function defaultMarketplaceRoot(homeRoot, marketplace) {
|
|
34458
|
-
return
|
|
34666
|
+
return join88(claudePluginsDir(homeRoot), "marketplaces", marketplace);
|
|
34459
34667
|
}
|
|
34460
34668
|
function resolveMarketplaceRoot(homeRoot, marketplace) {
|
|
34461
34669
|
const known = readKnownMarketplace(homeRoot, marketplace);
|
|
@@ -34466,7 +34674,7 @@ function resolveMarketplaceRoot(homeRoot, marketplace) {
|
|
|
34466
34674
|
return existsSync64(fallback) ? fallback : null;
|
|
34467
34675
|
}
|
|
34468
34676
|
function readClaudeKnownMarketplace(homeRoot, marketplace) {
|
|
34469
|
-
const knownPath =
|
|
34677
|
+
const knownPath = join88(
|
|
34470
34678
|
claudePluginsDir(homeRoot),
|
|
34471
34679
|
"known_marketplaces.json"
|
|
34472
34680
|
);
|
|
@@ -34527,7 +34735,7 @@ function marketplaceNotInstalledMessage(marketplace) {
|
|
|
34527
34735
|
}
|
|
34528
34736
|
function readMarketplaceManifestRecord(root) {
|
|
34529
34737
|
for (const relative27 of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {
|
|
34530
|
-
const file = readCachedMarketplaceJson(
|
|
34738
|
+
const file = readCachedMarketplaceJson(join88(root, relative27));
|
|
34531
34739
|
if (file && isRecord35(file)) {
|
|
34532
34740
|
return file;
|
|
34533
34741
|
}
|
|
@@ -34564,7 +34772,7 @@ async function resolveMarketplaceCloneUrl(homeRoot, marketplace, runCommand = ru
|
|
|
34564
34772
|
if (!root) {
|
|
34565
34773
|
return null;
|
|
34566
34774
|
}
|
|
34567
|
-
if (existsSync64(
|
|
34775
|
+
if (existsSync64(join88(root, ".git"))) {
|
|
34568
34776
|
const remote = await runGit2(runCommand, ["remote", "get-url", "origin"], root);
|
|
34569
34777
|
const url = remote.stdout.trim();
|
|
34570
34778
|
if (remote.exitCode === 0 && url) {
|
|
@@ -34610,7 +34818,7 @@ function readMarketplacePluginSourceAt(root, pluginName) {
|
|
|
34610
34818
|
return parseMarketplacePluginSource(entry);
|
|
34611
34819
|
}
|
|
34612
34820
|
function snapshotPath(harnesstapDir) {
|
|
34613
|
-
return
|
|
34821
|
+
return join88(harnesstapDir, SNAPSHOT_FILE);
|
|
34614
34822
|
}
|
|
34615
34823
|
function readHostPluginSourceSnapshot(originRef, harnesstapDir = getHarnesstapDir()) {
|
|
34616
34824
|
const raw = readJsonFile(
|
|
@@ -34623,7 +34831,7 @@ function readHostPluginSourceSnapshot(originRef, harnesstapDir = getHarnesstapDi
|
|
|
34623
34831
|
return row;
|
|
34624
34832
|
}
|
|
34625
34833
|
function cacheVersionDir(homeRoot, marketplace, pluginName, version) {
|
|
34626
|
-
return
|
|
34834
|
+
return join88(
|
|
34627
34835
|
claudePluginsDir(homeRoot),
|
|
34628
34836
|
"cache",
|
|
34629
34837
|
marketplace,
|
|
@@ -34669,7 +34877,7 @@ function verifiedGitRefsToTry(input) {
|
|
|
34669
34877
|
return refs;
|
|
34670
34878
|
}
|
|
34671
34879
|
function declaredPluginVersion(root) {
|
|
34672
|
-
for (const manifest of [
|
|
34880
|
+
for (const manifest of [join88(root, ".claude-plugin", "plugin.json"), join88(root, "plugin.json")]) {
|
|
34673
34881
|
if (!existsSync64(manifest)) continue;
|
|
34674
34882
|
try {
|
|
34675
34883
|
const parsed = JSON.parse(readFileSync60(manifest, "utf8"));
|
|
@@ -34866,9 +35074,9 @@ async function downloadHostPluginVersion(input) {
|
|
|
34866
35074
|
const advertised = live?.version ?? snapshot?.advertised_version;
|
|
34867
35075
|
const marketplaceRoot = resolveMarketplaceRoot(homeRoot, marketplace);
|
|
34868
35076
|
if (marketplaceRoot && advertised === input.version && (live?.path || resolveMarketplacePluginDirectory(marketplaceRoot, name))) {
|
|
34869
|
-
const pluginDir = (live?.path ?
|
|
35077
|
+
const pluginDir = (live?.path ? join88(marketplaceRoot, live.path) : void 0) ?? resolveMarketplacePluginDirectory(marketplaceRoot, name);
|
|
34870
35078
|
if (pluginDir && existsSync64(pluginDir) && isPluginInstallRoot(pluginDir)) {
|
|
34871
|
-
|
|
35079
|
+
mkdirSync29(dirname27(target), { recursive: true });
|
|
34872
35080
|
cpSync5(pluginDir, target, { recursive: true, verbatimSymlinks: true });
|
|
34873
35081
|
upsertPackageCacheEntry({
|
|
34874
35082
|
kind: "host_plugin",
|
|
@@ -34904,7 +35112,7 @@ function isCacheVersionDirectoryName2(name) {
|
|
|
34904
35112
|
return semver15.valid(name) !== null || GIT_SHA_DIR2.test(name);
|
|
34905
35113
|
}
|
|
34906
35114
|
function resolvedVersionFromInstallRoot(installRoot, manifestVersion) {
|
|
34907
|
-
const dirName =
|
|
35115
|
+
const dirName = basename10(installRoot);
|
|
34908
35116
|
if (isCacheVersionDirectoryName2(dirName)) {
|
|
34909
35117
|
return dirName;
|
|
34910
35118
|
}
|
|
@@ -34920,7 +35128,7 @@ function sortHostPluginVersionNames(versions) {
|
|
|
34920
35128
|
return [...semverVersions, ...rest];
|
|
34921
35129
|
}
|
|
34922
35130
|
function cachePluginDir(homeRoot, marketplace, pluginName) {
|
|
34923
|
-
return
|
|
35131
|
+
return join89(claudePluginsDir(homeRoot), "cache", marketplace, pluginName);
|
|
34924
35132
|
}
|
|
34925
35133
|
function missingMarketplacePullMessage(originRef) {
|
|
34926
35134
|
return `Plugin ${originRef} has no marketplace, so source versions cannot be pulled`;
|
|
@@ -34955,7 +35163,7 @@ function checkoutPluginManifestVersion(homeRoot, marketplace, pluginName) {
|
|
|
34955
35163
|
return null;
|
|
34956
35164
|
}
|
|
34957
35165
|
const relative27 = live?.path?.trim() ?? "";
|
|
34958
|
-
const pluginDir = relative27 === "." || relative27 === "./" ? root :
|
|
35166
|
+
const pluginDir = relative27 === "." || relative27 === "./" ? root : join89(root, relative27);
|
|
34959
35167
|
if (!existsSync65(pluginDir)) {
|
|
34960
35168
|
return null;
|
|
34961
35169
|
}
|
|
@@ -34983,7 +35191,7 @@ function scanCacheParent(parent) {
|
|
|
34983
35191
|
const rows = [];
|
|
34984
35192
|
for (const entry of readdirSync25(parent, { withFileTypes: true })) {
|
|
34985
35193
|
if (!entry.isDirectory()) continue;
|
|
34986
|
-
const path =
|
|
35194
|
+
const path = join89(parent, entry.name);
|
|
34987
35195
|
if (!isPluginInstallRoot(path)) continue;
|
|
34988
35196
|
const manifest = readManifestVersion(path);
|
|
34989
35197
|
rows.push({
|
|
@@ -35001,7 +35209,7 @@ function listCacheVersionDirs(homeRoot, marketplace, pluginName) {
|
|
|
35001
35209
|
const rows = [
|
|
35002
35210
|
...scanCacheParent(cachePluginDir(homeRoot, marketplace, pluginName)),
|
|
35003
35211
|
...scanCacheParent(
|
|
35004
|
-
|
|
35212
|
+
join89(cursorCacheRoot(homeRoot), marketplace, pluginName)
|
|
35005
35213
|
)
|
|
35006
35214
|
];
|
|
35007
35215
|
const byVersion = /* @__PURE__ */ new Map();
|
|
@@ -35114,7 +35322,7 @@ function listHostPluginVersions(originRef, homeRoot) {
|
|
|
35114
35322
|
|
|
35115
35323
|
// src/services/resource-sync.ts
|
|
35116
35324
|
function defaultClaudePluginsRoot(homeRoot) {
|
|
35117
|
-
return
|
|
35325
|
+
return join90(homeRoot, ".claude", "plugins");
|
|
35118
35326
|
}
|
|
35119
35327
|
function uniqueInstallRefs(originRef, homeRoot) {
|
|
35120
35328
|
const ordered = [];
|
|
@@ -35140,7 +35348,7 @@ function resolveExistingInstallRoot(candidate) {
|
|
|
35140
35348
|
const children = [];
|
|
35141
35349
|
for (const entry of readdirSync26(candidate, { withFileTypes: true })) {
|
|
35142
35350
|
if (!entry.isDirectory()) continue;
|
|
35143
|
-
const childPath =
|
|
35351
|
+
const childPath = join90(candidate, entry.name);
|
|
35144
35352
|
if (isPluginInstallRoot(childPath)) {
|
|
35145
35353
|
children.push(childPath);
|
|
35146
35354
|
}
|
|
@@ -35151,7 +35359,7 @@ function resolveExistingInstallRoot(candidate) {
|
|
|
35151
35359
|
if (children.length === 1) {
|
|
35152
35360
|
return children[0];
|
|
35153
35361
|
}
|
|
35154
|
-
const byName = new Map(children.map((path) => [
|
|
35362
|
+
const byName = new Map(children.map((path) => [basename11(path), path]));
|
|
35155
35363
|
const newest = sortHostPluginVersionNames([...byName.keys()])[0];
|
|
35156
35364
|
return (newest ? byName.get(newest) : children[0]) ?? children[0];
|
|
35157
35365
|
} catch {
|
|
@@ -35180,23 +35388,23 @@ function resolveInstallRootCandidates(originRef, homeRoot, claudePluginsRoot) {
|
|
|
35180
35388
|
if (!resolvedMarketplace) {
|
|
35181
35389
|
return [];
|
|
35182
35390
|
}
|
|
35183
|
-
return [
|
|
35391
|
+
return [join90(claudePluginsRoot, "cache", resolvedMarketplace, plugin)];
|
|
35184
35392
|
});
|
|
35185
35393
|
const candidates = [
|
|
35186
35394
|
...installedPath ? [installedPath] : [],
|
|
35187
35395
|
...copilotInstalledPath ? [copilotInstalledPath] : [],
|
|
35188
35396
|
...cursorInstalledPath ? [cursorInstalledPath] : [],
|
|
35189
35397
|
...cacheCandidates,
|
|
35190
|
-
|
|
35191
|
-
|
|
35192
|
-
|
|
35193
|
-
|
|
35194
|
-
|
|
35195
|
-
|
|
35196
|
-
|
|
35398
|
+
join90(claudePluginsRoot, "cache", marketplace ?? plugin, plugin),
|
|
35399
|
+
join90(claudePluginsRoot, "CACHE", plugin),
|
|
35400
|
+
join90(claudePluginsRoot, "cache", plugin, plugin),
|
|
35401
|
+
join90(claudePluginsRoot, marketplace ?? plugin, plugin),
|
|
35402
|
+
join90(homeRoot, ".cursor", "plugins", plugin),
|
|
35403
|
+
join90(homeRoot, ".cursor", "plugins", "cache", marketplace ?? plugin, plugin),
|
|
35404
|
+
join90(homeRoot, ".agents", "plugins", plugin)
|
|
35197
35405
|
];
|
|
35198
35406
|
if (originRef.startsWith("./") || originRef.startsWith("../")) {
|
|
35199
|
-
candidates.unshift(
|
|
35407
|
+
candidates.unshift(join90(process.cwd(), originRef));
|
|
35200
35408
|
}
|
|
35201
35409
|
return candidates;
|
|
35202
35410
|
}
|
|
@@ -35423,7 +35631,7 @@ async function syncPluginResource(pluginResource, options = {}) {
|
|
|
35423
35631
|
scan = void 0;
|
|
35424
35632
|
}
|
|
35425
35633
|
if (!scan) {
|
|
35426
|
-
const manifestVersion = readPluginVersionFromInstallRoot(scanRoot) ?? (isPluginInstallRoot(scanRoot) && isCacheVersionDirectoryName2(
|
|
35634
|
+
const manifestVersion = readPluginVersionFromInstallRoot(scanRoot) ?? (isPluginInstallRoot(scanRoot) && isCacheVersionDirectoryName2(basename11(scanRoot)) ? basename11(scanRoot) : void 0);
|
|
35427
35635
|
if (!manifestVersion) {
|
|
35428
35636
|
stale.push({ resource: pluginResource, reason: "plugin tree is empty" });
|
|
35429
35637
|
return { checked: 1, updated, stale, unchanged, skipped: skipped2 };
|
|
@@ -35690,7 +35898,7 @@ function collectPluginFiles(root) {
|
|
|
35690
35898
|
continue;
|
|
35691
35899
|
}
|
|
35692
35900
|
if (entry.name === CURSOR_LOCAL_PLUGIN_SIDECAR) continue;
|
|
35693
|
-
const absolute =
|
|
35901
|
+
const absolute = join91(dir, entry.name);
|
|
35694
35902
|
if (entry.isDirectory()) {
|
|
35695
35903
|
stack.push(absolute);
|
|
35696
35904
|
continue;
|
|
@@ -35767,7 +35975,7 @@ function enabledPluginsFromRaw(raw) {
|
|
|
35767
35975
|
}
|
|
35768
35976
|
function mergeEnabledPlugin(files, homeRoot, ref, surfaceWarnings) {
|
|
35769
35977
|
const settingsPath = ".claude/settings.json";
|
|
35770
|
-
const existingOnDisk = existsSync67(
|
|
35978
|
+
const existingOnDisk = existsSync67(join91(homeRoot, settingsPath)) ? readFileSync61(join91(homeRoot, settingsPath), "utf-8") : void 0;
|
|
35771
35979
|
const generated = files.find((file) => file.path === settingsPath)?.content;
|
|
35772
35980
|
const disabledByUser = enabledPluginsFromRaw(existingOnDisk)[ref] === false;
|
|
35773
35981
|
if (disabledByUser) {
|
|
@@ -35811,7 +36019,7 @@ function hostPluginSourceRoot(resource, originRef, homeRoot) {
|
|
|
35811
36019
|
const metadata = resource.metadata ?? {};
|
|
35812
36020
|
const version = metadata.resolved_version?.trim();
|
|
35813
36021
|
const { name, marketplace } = parsePluginRef(originRef);
|
|
35814
|
-
if (!version || !marketplace || isLocalMarketplace(marketplace) || installed &&
|
|
36022
|
+
if (!version || !marketplace || isLocalMarketplace(marketplace) || installed && basename12(installed) === version) {
|
|
35815
36023
|
return installed;
|
|
35816
36024
|
}
|
|
35817
36025
|
const cached = hostPluginPackageDir(
|
|
@@ -35882,7 +36090,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
35882
36090
|
alias_harnesses: []
|
|
35883
36091
|
});
|
|
35884
36092
|
}
|
|
35885
|
-
const sourceContent = remoteMarketplace && isMirroredHostPluginView(
|
|
36093
|
+
const sourceContent = remoteMarketplace && isMirroredHostPluginView(join91(options.homeRoot, relativeRoot)) ? new Map(filtered.files.map((file) => [file.relativePath, file.content])) : void 0;
|
|
35886
36094
|
for (const file of translated.files) {
|
|
35887
36095
|
if (sourceContent && !isClaudeReadPluginFile(file.relativePath, file.encoding) && sourceContent.get(file.relativePath) === file.content) {
|
|
35888
36096
|
continue;
|
|
@@ -35912,7 +36120,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
35912
36120
|
const metadata = resource.metadata ?? {};
|
|
35913
36121
|
const record = {
|
|
35914
36122
|
scope: "user",
|
|
35915
|
-
installPath:
|
|
36123
|
+
installPath: join91(options.homeRoot, relativeRoot),
|
|
35916
36124
|
version: metadata.resolved_version ?? "unknown"
|
|
35917
36125
|
};
|
|
35918
36126
|
if (remoteMarketplace) {
|
|
@@ -35920,7 +36128,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
35920
36128
|
plugins.push({ name: resource.name, version: record.version, relativeRoot });
|
|
35921
36129
|
claudeMarketplaces.set(remoteMarketplace, plugins);
|
|
35922
36130
|
}
|
|
35923
|
-
const existing = files.find((file) => file.path === installedPath)?.content ?? (existsSync67(
|
|
36131
|
+
const existing = files.find((file) => file.path === installedPath)?.content ?? (existsSync67(join91(options.homeRoot, installedPath)) ? readFileSync61(join91(options.homeRoot, installedPath), "utf-8") : void 0);
|
|
35924
36132
|
upsertSerializedFile(
|
|
35925
36133
|
files,
|
|
35926
36134
|
installedPath,
|
|
@@ -35953,7 +36161,7 @@ function foreignClaudeInstall(homeRoot, originRef, relativeRoot) {
|
|
|
35953
36161
|
if (!isHarnessTapClaudeRecord(homeRoot, record)) return recordPath;
|
|
35954
36162
|
candidates.push(recordPath);
|
|
35955
36163
|
}
|
|
35956
|
-
const destination =
|
|
36164
|
+
const destination = join91(homeRoot, relativeRoot);
|
|
35957
36165
|
if (existsSync67(destination)) candidates.push(destination);
|
|
35958
36166
|
for (const path of candidates) {
|
|
35959
36167
|
const view = readHostPluginViewRecord(path);
|
|
@@ -36638,7 +36846,7 @@ function cutPluginVersion(input) {
|
|
|
36638
36846
|
}
|
|
36639
36847
|
const payload = JSON.parse(snapshot.payload);
|
|
36640
36848
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
36641
|
-
const frozenId =
|
|
36849
|
+
const frozenId = ulid17();
|
|
36642
36850
|
db.prepare(
|
|
36643
36851
|
`UPDATE plugins
|
|
36644
36852
|
SET version = ?, dirty = 0, updated_at = ?
|
|
@@ -37246,7 +37454,7 @@ function mapAttachedResource(row) {
|
|
|
37246
37454
|
function createPlugin(input) {
|
|
37247
37455
|
const db = getDb();
|
|
37248
37456
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
37249
|
-
const id =
|
|
37457
|
+
const id = ulid18();
|
|
37250
37458
|
const version = input.version ?? "1.0.0";
|
|
37251
37459
|
const origin = input.origin ?? "authored";
|
|
37252
37460
|
db.prepare(
|
|
@@ -37776,7 +37984,7 @@ function readGlobalMcpServers(homeRoot, harnessId) {
|
|
|
37776
37984
|
return {};
|
|
37777
37985
|
}
|
|
37778
37986
|
const relativePath2 = configuredPath.startsWith("~/") ? configuredPath.slice(2) : configuredPath;
|
|
37779
|
-
const fullPath =
|
|
37987
|
+
const fullPath = join92(homeRoot, relativePath2);
|
|
37780
37988
|
if (!existsSync68(fullPath)) {
|
|
37781
37989
|
return {};
|
|
37782
37990
|
}
|
|
@@ -37887,10 +38095,8 @@ function buildHarnessMcpRows(declaredNames, liveNames, comparison) {
|
|
|
37887
38095
|
return rows;
|
|
37888
38096
|
}
|
|
37889
38097
|
function projectForDriftPath(projectPath) {
|
|
37890
|
-
const resolvedRoot =
|
|
37891
|
-
const
|
|
37892
|
-
const gitOrigin = gitOriginRaw ? normalizeGitUrl(gitOriginRaw) : null;
|
|
37893
|
-
const project = getProjectByLocalPath(resolvedRoot) ?? (gitOrigin ? getProjectByOrigin(gitOrigin) : void 0) ?? null;
|
|
38098
|
+
const resolvedRoot = resolve33(projectPath);
|
|
38099
|
+
const project = findProjectForRoot(resolvedRoot) ?? getProjectByLocalPath(resolvedRoot) ?? null;
|
|
37894
38100
|
if (!project) return null;
|
|
37895
38101
|
return { root: resolvedRoot, id: project.id };
|
|
37896
38102
|
}
|
|
@@ -37903,7 +38109,7 @@ function projectDriftWatchPaths(projectPath) {
|
|
|
37903
38109
|
const paths = [];
|
|
37904
38110
|
for (const files of Object.values(snapshot.state?.platform_files ?? {})) {
|
|
37905
38111
|
for (const relativePath2 of Object.keys(files)) {
|
|
37906
|
-
paths.push(
|
|
38112
|
+
paths.push(join92(project.root, relativePath2));
|
|
37907
38113
|
}
|
|
37908
38114
|
}
|
|
37909
38115
|
return paths;
|
|
@@ -38106,7 +38312,7 @@ function markDirty() {
|
|
|
38106
38312
|
}
|
|
38107
38313
|
function expandHomePath(value, home) {
|
|
38108
38314
|
if (value === "~") return home;
|
|
38109
|
-
if (value.startsWith("~/")) return
|
|
38315
|
+
if (value.startsWith("~/")) return join93(home, value.slice(2));
|
|
38110
38316
|
return value;
|
|
38111
38317
|
}
|
|
38112
38318
|
function pushPath(paths, value, home) {
|
|
@@ -38137,7 +38343,7 @@ function harnessConfigPaths(home) {
|
|
|
38137
38343
|
return paths;
|
|
38138
38344
|
}
|
|
38139
38345
|
function marketplaceInstallRoots(home) {
|
|
38140
|
-
const knownPath =
|
|
38346
|
+
const knownPath = join93(home, ".claude", "plugins", "known_marketplaces.json");
|
|
38141
38347
|
let parsed;
|
|
38142
38348
|
try {
|
|
38143
38349
|
parsed = JSON.parse(readFileSync63(knownPath, "utf8"));
|
|
@@ -38158,14 +38364,14 @@ function marketplaceInstallRoots(home) {
|
|
|
38158
38364
|
function manifestPathsUnder(root) {
|
|
38159
38365
|
const found = [];
|
|
38160
38366
|
for (const relative27 of MANIFEST_RELATIVE_PATHS) {
|
|
38161
|
-
const path =
|
|
38367
|
+
const path = join93(root, relative27);
|
|
38162
38368
|
if (existsSync69(path)) found.push(path);
|
|
38163
38369
|
}
|
|
38164
38370
|
return found;
|
|
38165
38371
|
}
|
|
38166
38372
|
function marketplaceManifestPaths(home) {
|
|
38167
38373
|
const roots = [
|
|
38168
|
-
|
|
38374
|
+
join93(home, ".claude", "plugins", "marketplaces"),
|
|
38169
38375
|
...marketplaceInstallRoots(home)
|
|
38170
38376
|
];
|
|
38171
38377
|
const found = [];
|
|
@@ -38178,7 +38384,7 @@ function marketplaceManifestPaths(home) {
|
|
|
38178
38384
|
continue;
|
|
38179
38385
|
}
|
|
38180
38386
|
for (const name of names) {
|
|
38181
|
-
const child =
|
|
38387
|
+
const child = join93(root, name);
|
|
38182
38388
|
try {
|
|
38183
38389
|
if (!statSync25(child).isDirectory()) continue;
|
|
38184
38390
|
} catch {
|
|
@@ -38190,12 +38396,12 @@ function marketplaceManifestPaths(home) {
|
|
|
38190
38396
|
return found;
|
|
38191
38397
|
}
|
|
38192
38398
|
function recursiveWatchPaths(home) {
|
|
38193
|
-
const plugins =
|
|
38399
|
+
const plugins = join93(home, ".cursor", "plugins");
|
|
38194
38400
|
const paths = /* @__PURE__ */ new Set([
|
|
38195
38401
|
plugins,
|
|
38196
|
-
|
|
38197
|
-
|
|
38198
|
-
|
|
38402
|
+
join93(plugins, "local"),
|
|
38403
|
+
join93(plugins, "cache"),
|
|
38404
|
+
join93(home, ".claude", "plugins", "marketplaces")
|
|
38199
38405
|
]);
|
|
38200
38406
|
for (const root of marketplaceInstallRoots(home)) {
|
|
38201
38407
|
paths.add(root);
|
|
@@ -38208,17 +38414,17 @@ function isSidecarOwnedPath(path) {
|
|
|
38208
38414
|
}
|
|
38209
38415
|
function collectFingerprintPaths(projectPath, extra) {
|
|
38210
38416
|
const home = resolveHomeRoot();
|
|
38211
|
-
const plugins =
|
|
38417
|
+
const plugins = join93(home, ".cursor", "plugins");
|
|
38212
38418
|
const paths = [
|
|
38213
38419
|
plugins,
|
|
38214
|
-
|
|
38215
|
-
|
|
38216
|
-
|
|
38217
|
-
|
|
38218
|
-
|
|
38219
|
-
|
|
38220
|
-
|
|
38221
|
-
|
|
38420
|
+
join93(plugins, "installed.json"),
|
|
38421
|
+
join93(plugins, "installed_plugins.json"),
|
|
38422
|
+
join93(plugins, "local"),
|
|
38423
|
+
join93(home, ".claude", "plugins", "installed_plugins.json"),
|
|
38424
|
+
join93(home, ".claude", "plugins", "known_marketplaces.json"),
|
|
38425
|
+
join93(home, ".claude", "plugins", "marketplaces"),
|
|
38426
|
+
join93(cursorUserDataDir(home), "User", "settings.json"),
|
|
38427
|
+
join93(home, ".cursor", "projects", "mcps"),
|
|
38222
38428
|
...harnessConfigPaths(home),
|
|
38223
38429
|
...marketplaceManifestPaths(home),
|
|
38224
38430
|
...projectDriftWatchPaths(projectPath),
|
|
@@ -38243,7 +38449,7 @@ function fingerprintPaths(paths) {
|
|
|
38243
38449
|
function notifyWatchDirty(path, file) {
|
|
38244
38450
|
if (path !== void 0 && typeof file === "string") {
|
|
38245
38451
|
const wanted = parentOnlyWatches.get(path);
|
|
38246
|
-
if (wanted && !wanted.has(
|
|
38452
|
+
if (wanted && !wanted.has(basename13(file))) return;
|
|
38247
38453
|
}
|
|
38248
38454
|
if (debugCache) console.error(`[status-cache] watch dirty ${path ?? ""} ${file ?? ""}`);
|
|
38249
38455
|
if (parentPort) {
|
|
@@ -38347,7 +38553,7 @@ function ensureWatchers(paths, recursive, home) {
|
|
|
38347
38553
|
const directlyWatched = hasWatcher(parent) && !parentOnlyWatches.has(parent);
|
|
38348
38554
|
if (!directlyWatched && !paths.includes(parent)) {
|
|
38349
38555
|
const wanted = parentOnlyWatches.get(parent) ?? /* @__PURE__ */ new Set();
|
|
38350
|
-
wanted.add(
|
|
38556
|
+
wanted.add(basename13(path));
|
|
38351
38557
|
parentOnlyWatches.set(parent, wanted);
|
|
38352
38558
|
}
|
|
38353
38559
|
watchOne(parent, false);
|
|
@@ -38637,7 +38843,7 @@ function blockRefreshDelay() {
|
|
|
38637
38843
|
}
|
|
38638
38844
|
function enqueueStatusRefresh(key, projectPath, input, load, epochAtStart, gen) {
|
|
38639
38845
|
const home = process.env.HOME;
|
|
38640
|
-
return new Promise((
|
|
38846
|
+
return new Promise((resolve34) => {
|
|
38641
38847
|
const runInProcess = () => {
|
|
38642
38848
|
setTimeout(() => {
|
|
38643
38849
|
void (async () => {
|
|
@@ -38648,13 +38854,13 @@ function enqueueStatusRefresh(key, projectPath, input, load, epochAtStart, gen)
|
|
|
38648
38854
|
remember(key, projectPath, loaded, epochAtStart, readStatusWriteGeneration());
|
|
38649
38855
|
refreshCompletions += 1;
|
|
38650
38856
|
}
|
|
38651
|
-
|
|
38857
|
+
resolve34({
|
|
38652
38858
|
ok: true,
|
|
38653
38859
|
value: deepFreeze(loaded.value),
|
|
38654
38860
|
watchedPaths: [...loaded.watchedPaths]
|
|
38655
38861
|
});
|
|
38656
38862
|
} catch (error) {
|
|
38657
|
-
|
|
38863
|
+
resolve34({ ok: false, error: describeStatusRefreshError(error) });
|
|
38658
38864
|
}
|
|
38659
38865
|
})();
|
|
38660
38866
|
}, 0);
|
|
@@ -38682,7 +38888,7 @@ function enqueueStatusRefresh(key, projectPath, input, load, epochAtStart, gen)
|
|
|
38682
38888
|
...statusTraceEnabled ? { postedAt: performance.now() } : {},
|
|
38683
38889
|
resolve: (outcome) => {
|
|
38684
38890
|
if (outcome.ok) {
|
|
38685
|
-
|
|
38891
|
+
resolve34(outcome);
|
|
38686
38892
|
return;
|
|
38687
38893
|
}
|
|
38688
38894
|
const reason = outcome.error?.stack ?? outcome.error?.message ?? "no error was reported";
|
|
@@ -38727,8 +38933,8 @@ function enqueueStatusRefresh(key, projectPath, input, load, epochAtStart, gen)
|
|
|
38727
38933
|
function trackRefresh(key, projectPath, input, load, gen) {
|
|
38728
38934
|
let resolveDone = () => {
|
|
38729
38935
|
};
|
|
38730
|
-
const promise = new Promise((
|
|
38731
|
-
resolveDone =
|
|
38936
|
+
const promise = new Promise((resolve34) => {
|
|
38937
|
+
resolveDone = resolve34;
|
|
38732
38938
|
});
|
|
38733
38939
|
inflight.set(key, { generation: gen, promise });
|
|
38734
38940
|
const epochAtStart = epoch;
|
|
@@ -38941,9 +39147,7 @@ export {
|
|
|
38941
39147
|
setHarnessPreference,
|
|
38942
39148
|
getProjectHarnessConfig,
|
|
38943
39149
|
setProjectHarnessConfig,
|
|
38944
|
-
getProjectByOrigin,
|
|
38945
39150
|
getProject,
|
|
38946
|
-
upsertProject,
|
|
38947
39151
|
listProjects,
|
|
38948
39152
|
getProjectByLocalPath,
|
|
38949
39153
|
applyConfiguredPluginToProject,
|
|
@@ -39150,11 +39354,13 @@ export {
|
|
|
39150
39354
|
findSnapshotById,
|
|
39151
39355
|
listSnapshots,
|
|
39152
39356
|
getLatestSnapshot,
|
|
39153
|
-
getGitOrigin,
|
|
39154
|
-
normalizeGitUrl,
|
|
39155
|
-
projectNameFromUrl,
|
|
39156
39357
|
driftChangeIsKept,
|
|
39157
39358
|
detectProjectDriftFromLatest,
|
|
39359
|
+
getGitOrigin,
|
|
39360
|
+
projectNameFromUrl,
|
|
39361
|
+
resolveProjectIdentity,
|
|
39362
|
+
findProjectForRoot,
|
|
39363
|
+
ensureProjectForRoot,
|
|
39158
39364
|
collectOwnedGlobalProfileFiles,
|
|
39159
39365
|
classifyGlobalDriftChanges,
|
|
39160
39366
|
declaredMcpFromExpectedFiles,
|
|
@@ -39324,4 +39530,4 @@ export {
|
|
|
39324
39530
|
diffHostPluginView,
|
|
39325
39531
|
replaceKeptHostPluginViewFiles
|
|
39326
39532
|
};
|
|
39327
|
-
//# sourceMappingURL=chunk-
|
|
39533
|
+
//# sourceMappingURL=chunk-26QGX47N.js.map
|