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
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-UEA4NCY2.js";
|
|
22
22
|
import {
|
|
23
23
|
PACKAGE_VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WWFVMCTR.js";
|
|
25
25
|
import {
|
|
26
26
|
__publicField
|
|
27
27
|
} from "./chunk-MKLJBW5N.js";
|
|
@@ -842,7 +842,7 @@ function commandEnv(command, args, options) {
|
|
|
842
842
|
}
|
|
843
843
|
function spawnCommand(command, args, options) {
|
|
844
844
|
const timeoutMs = resolveCommandTimeoutMs(options, command, args);
|
|
845
|
-
return new Promise((
|
|
845
|
+
return new Promise((resolve35) => {
|
|
846
846
|
let stdout = "";
|
|
847
847
|
let stderr = "";
|
|
848
848
|
let settled = false;
|
|
@@ -857,7 +857,7 @@ function spawnCommand(command, args, options) {
|
|
|
857
857
|
settled = true;
|
|
858
858
|
if (timer) clearTimeout(timer);
|
|
859
859
|
inflightChildren.delete(child);
|
|
860
|
-
|
|
860
|
+
resolve35(result);
|
|
861
861
|
};
|
|
862
862
|
const timer = timeoutMs === void 0 ? void 0 : setTimeout(() => {
|
|
863
863
|
child.kill("SIGTERM");
|
|
@@ -1592,7 +1592,7 @@ function describeStatusRefreshError(error) {
|
|
|
1592
1592
|
|
|
1593
1593
|
// src/services/status-read-cache.ts
|
|
1594
1594
|
import { existsSync as existsSync80, readdirSync as readdirSync31, readFileSync as readFileSync72, statSync as statSync29, watch } from "fs";
|
|
1595
|
-
import { basename as
|
|
1595
|
+
import { basename as basename14, dirname as dirname29, join as join106, sep as sep22 } from "path";
|
|
1596
1596
|
import { Worker, parentPort } from "worker_threads";
|
|
1597
1597
|
|
|
1598
1598
|
// src/platforms/registry.ts
|
|
@@ -2187,7 +2187,7 @@ function withHarnessScope(resource, scope) {
|
|
|
2187
2187
|
|
|
2188
2188
|
// src/services/global-profile-status-panel.ts
|
|
2189
2189
|
import { existsSync as existsSync79, readFileSync as readFileSync71 } from "fs";
|
|
2190
|
-
import { join as
|
|
2190
|
+
import { join as join105, resolve as resolve34 } from "path";
|
|
2191
2191
|
|
|
2192
2192
|
// src/plugins/claude-plugin-ref.ts
|
|
2193
2193
|
import { join as join11 } from "path";
|
|
@@ -2695,7 +2695,7 @@ var CursorPluginProvider = class {
|
|
|
2695
2695
|
return results;
|
|
2696
2696
|
}
|
|
2697
2697
|
async install(ctx, opts) {
|
|
2698
|
-
const { installCursorLocalPlugin } = await import("./cursor-local-install-
|
|
2698
|
+
const { installCursorLocalPlugin } = await import("./cursor-local-install-JS5KSOES.js");
|
|
2699
2699
|
return installCursorLocalPlugin(ctx, opts);
|
|
2700
2700
|
}
|
|
2701
2701
|
};
|
|
@@ -2826,7 +2826,17 @@ function listGlobalApplySnapshotInstalls(snapshotId) {
|
|
|
2826
2826
|
// src/models/project.ts
|
|
2827
2827
|
import { resolve } from "path";
|
|
2828
2828
|
import { ulid as ulid2 } from "ulid";
|
|
2829
|
+
function getProjectByLocalId(localId) {
|
|
2830
|
+
if (!localId) {
|
|
2831
|
+
return void 0;
|
|
2832
|
+
}
|
|
2833
|
+
const db = getDb();
|
|
2834
|
+
return db.prepare("SELECT * FROM projects WHERE local_id = ? AND git_origin = ''").get(localId);
|
|
2835
|
+
}
|
|
2829
2836
|
function getProjectByOrigin(gitOrigin) {
|
|
2837
|
+
if (!gitOrigin) {
|
|
2838
|
+
return void 0;
|
|
2839
|
+
}
|
|
2830
2840
|
const db = getDb();
|
|
2831
2841
|
return db.prepare("SELECT * FROM projects WHERE git_origin = ?").get(gitOrigin);
|
|
2832
2842
|
}
|
|
@@ -2857,32 +2867,6 @@ function getLatestSnapshot(projectId) {
|
|
|
2857
2867
|
return snapshots[0];
|
|
2858
2868
|
}
|
|
2859
2869
|
|
|
2860
|
-
// src/services/git.ts
|
|
2861
|
-
import { execSync } from "child_process";
|
|
2862
|
-
import { basename } from "path";
|
|
2863
|
-
function getGitOrigin(projectRoot) {
|
|
2864
|
-
try {
|
|
2865
|
-
const url = execSync("git config --get remote.origin.url", {
|
|
2866
|
-
cwd: projectRoot,
|
|
2867
|
-
encoding: "utf-8",
|
|
2868
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
2869
|
-
}).trim();
|
|
2870
|
-
return url || void 0;
|
|
2871
|
-
} catch {
|
|
2872
|
-
return void 0;
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
function normalizeGitUrl(url) {
|
|
2876
|
-
let normalized = url.trim();
|
|
2877
|
-
if (normalized.startsWith("git@")) {
|
|
2878
|
-
return normalized;
|
|
2879
|
-
}
|
|
2880
|
-
if (normalized.endsWith(".git")) {
|
|
2881
|
-
normalized = normalized.slice(0, -4);
|
|
2882
|
-
}
|
|
2883
|
-
return normalized;
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
2870
|
// src/services/host-native-mcp.ts
|
|
2887
2871
|
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
2888
2872
|
import { join as join15 } from "path";
|
|
@@ -2898,7 +2882,7 @@ import {
|
|
|
2898
2882
|
statSync as statSync3,
|
|
2899
2883
|
writeFileSync as writeFileSync5
|
|
2900
2884
|
} from "fs";
|
|
2901
|
-
import { basename
|
|
2885
|
+
import { basename, dirname as dirname2, join as join14, relative as relative3, resolve as resolve2, sep as sep2 } from "path";
|
|
2902
2886
|
function hostPluginViewsPath() {
|
|
2903
2887
|
return join14(getHarnesstapDir(), "cache", "host-plugin-views.json");
|
|
2904
2888
|
}
|
|
@@ -3092,7 +3076,7 @@ function pruneCreatedHostPluginViews(removedFiles) {
|
|
|
3092
3076
|
continue;
|
|
3093
3077
|
}
|
|
3094
3078
|
let parent = dirname2(view);
|
|
3095
|
-
while (
|
|
3079
|
+
while (basename(parent) !== "cache" && parent !== dirname2(parent)) {
|
|
3096
3080
|
try {
|
|
3097
3081
|
if (readdirSync5(parent).length > 0) break;
|
|
3098
3082
|
rmdirSync(parent);
|
|
@@ -3670,7 +3654,7 @@ function setPluginUpstream(pluginId, upstream, upstreamPluginId = "") {
|
|
|
3670
3654
|
}
|
|
3671
3655
|
|
|
3672
3656
|
// src/models/plugin-model.ts
|
|
3673
|
-
import { ulid as
|
|
3657
|
+
import { ulid as ulid18 } from "ulid";
|
|
3674
3658
|
import semver21 from "semver";
|
|
3675
3659
|
|
|
3676
3660
|
// src/models/resource.ts
|
|
@@ -4162,7 +4146,7 @@ function isGitRefConstraint(raw) {
|
|
|
4162
4146
|
|
|
4163
4147
|
// src/services/plugin-versioning.ts
|
|
4164
4148
|
import semver20 from "semver";
|
|
4165
|
-
import { ulid as
|
|
4149
|
+
import { ulid as ulid17 } from "ulid";
|
|
4166
4150
|
|
|
4167
4151
|
// src/config/settings.ts
|
|
4168
4152
|
import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "fs";
|
|
@@ -4464,7 +4448,7 @@ function assertSyncable(pluginId) {
|
|
|
4464
4448
|
|
|
4465
4449
|
// src/services/host-plugin-serialize.ts
|
|
4466
4450
|
import { existsSync as existsSync78, readdirSync as readdirSync30, readFileSync as readFileSync70 } from "fs";
|
|
4467
|
-
import { basename as
|
|
4451
|
+
import { basename as basename13, join as join104, relative as relative27, sep as sep21 } from "path";
|
|
4468
4452
|
|
|
4469
4453
|
// src/services/package-cache/paths.ts
|
|
4470
4454
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -5079,11 +5063,11 @@ function rewriteValue(value, state) {
|
|
|
5079
5063
|
|
|
5080
5064
|
// src/services/resource-sync.ts
|
|
5081
5065
|
import { existsSync as existsSync77, readdirSync as readdirSync29 } from "fs";
|
|
5082
|
-
import { basename as
|
|
5066
|
+
import { basename as basename12, join as join103 } from "path";
|
|
5083
5067
|
|
|
5084
5068
|
// src/services/plugin-source-import.ts
|
|
5085
5069
|
import { existsSync as existsSync35, readFileSync as readFileSync34, readdirSync as readdirSync14, statSync as statSync12 } from "fs";
|
|
5086
|
-
import { basename as
|
|
5070
|
+
import { basename as basename5, dirname as dirname12, isAbsolute as isAbsolute10, join as join55, relative as relative13, resolve as resolve14, sep as sep9 } from "path";
|
|
5087
5071
|
|
|
5088
5072
|
// src/utils/frontmatter.ts
|
|
5089
5073
|
import matter from "gray-matter";
|
|
@@ -6769,7 +6753,7 @@ function replaceOpaqueFiles(pluginId, files) {
|
|
|
6769
6753
|
|
|
6770
6754
|
// src/services/agent-plugins/vendor-extensions.ts
|
|
6771
6755
|
import { existsSync as existsSync19, readFileSync as readFileSync18, statSync as statSync6 } from "fs";
|
|
6772
|
-
import { basename as
|
|
6756
|
+
import { basename as basename2, resolve as resolve6 } from "path";
|
|
6773
6757
|
import matter3 from "gray-matter";
|
|
6774
6758
|
|
|
6775
6759
|
// src/services/agent-plugins/files.ts
|
|
@@ -7864,7 +7848,7 @@ import { dirname as dirname9, join as join51, resolve as resolve9 } from "path";
|
|
|
7864
7848
|
|
|
7865
7849
|
// src/services/apm-manifest.ts
|
|
7866
7850
|
import { existsSync as existsSync31, lstatSync as lstatSync8, readFileSync as readFileSync28 } from "fs";
|
|
7867
|
-
import { basename as
|
|
7851
|
+
import { basename as basename4, join as join50 } from "path";
|
|
7868
7852
|
import { parse as parseYaml3, stringify as stringifyYaml3 } from "yaml";
|
|
7869
7853
|
|
|
7870
7854
|
// src/services/apm-policy.ts
|
|
@@ -7904,7 +7888,7 @@ function getHarnessPreference() {
|
|
|
7904
7888
|
|
|
7905
7889
|
// src/services/scanner.ts
|
|
7906
7890
|
import { lstatSync as lstatSync6 } from "fs";
|
|
7907
|
-
import { basename as
|
|
7891
|
+
import { basename as basename3, dirname as dirname8, join as join48 } from "path";
|
|
7908
7892
|
|
|
7909
7893
|
// src/models/imported-snapshot.ts
|
|
7910
7894
|
import { ulid as ulid7 } from "ulid";
|
|
@@ -8961,8 +8945,8 @@ function isMergeableHostConfigPath(path) {
|
|
|
8961
8945
|
if (MERGEABLE_FILE_RE.test(normalized)) {
|
|
8962
8946
|
return true;
|
|
8963
8947
|
}
|
|
8964
|
-
const
|
|
8965
|
-
if (INSTRUCTION_BASENAMES.has(
|
|
8948
|
+
const basename15 = normalized.split("/").pop()?.toLowerCase() ?? "";
|
|
8949
|
+
if (INSTRUCTION_BASENAMES.has(basename15)) {
|
|
8966
8950
|
return true;
|
|
8967
8951
|
}
|
|
8968
8952
|
const registry = registryHostConfigPaths();
|
|
@@ -13947,7 +13931,7 @@ function existingPaths(paths, rootPath) {
|
|
|
13947
13931
|
);
|
|
13948
13932
|
}
|
|
13949
13933
|
function pathHasExactConfiguredName(fullPath, configuredPath) {
|
|
13950
|
-
const expectedName =
|
|
13934
|
+
const expectedName = basename3(configuredPath.replace(/\/+$/, ""));
|
|
13951
13935
|
if (!expectedName || expectedName === "." || expectedName === "..") {
|
|
13952
13936
|
return true;
|
|
13953
13937
|
}
|
|
@@ -14058,7 +14042,7 @@ function isPluginSourcePath(sourcePath) {
|
|
|
14058
14042
|
if (!existsSync2(sourcePath)) {
|
|
14059
14043
|
return false;
|
|
14060
14044
|
}
|
|
14061
|
-
if (
|
|
14045
|
+
if (basename3(sourcePath) === "marketplace.json") {
|
|
14062
14046
|
return true;
|
|
14063
14047
|
}
|
|
14064
14048
|
return existsSync2(join48(sourcePath, ".goose-plugin", "plugin.json")) || existsSync2(join48(sourcePath, ".plugin", "plugin.json")) || existsSync2(join48(sourcePath, "plugin.json")) || existsSync2(join48(sourcePath, ".cursor-plugin", "plugin.json")) || existsSync2(join48(sourcePath, ".claude-plugin", "plugin.json")) || existsSync2(join48(sourcePath, ".codex-plugin", "plugin.json")) || existsSync2(join48(sourcePath, ".github", "plugin", "plugin.json"));
|
|
@@ -15617,21 +15601,21 @@ function firstExistingPath(candidates) {
|
|
|
15617
15601
|
}
|
|
15618
15602
|
function marketplaceRepoRoot(manifestPath) {
|
|
15619
15603
|
const manifestDir = dirname12(manifestPath);
|
|
15620
|
-
const name =
|
|
15604
|
+
const name = basename5(manifestDir);
|
|
15621
15605
|
if (name === ".claude-plugin" || name === ".cursor-plugin" || name === ".codex-plugin") {
|
|
15622
15606
|
return dirname12(manifestDir);
|
|
15623
15607
|
}
|
|
15624
|
-
if (name === "plugin" &&
|
|
15608
|
+
if (name === "plugin" && basename5(dirname12(manifestDir)) === ".github") {
|
|
15625
15609
|
return dirname12(dirname12(manifestDir));
|
|
15626
15610
|
}
|
|
15627
|
-
if (name === "plugins" &&
|
|
15611
|
+
if (name === "plugins" && basename5(dirname12(manifestDir)) === ".agents") {
|
|
15628
15612
|
return dirname12(dirname12(manifestDir));
|
|
15629
15613
|
}
|
|
15630
15614
|
return manifestDir;
|
|
15631
15615
|
}
|
|
15632
15616
|
function isCodexMarketplaceManifest(manifestPath) {
|
|
15633
15617
|
const manifestDir = dirname12(manifestPath);
|
|
15634
|
-
return
|
|
15618
|
+
return basename5(manifestDir) === "plugins" && basename5(dirname12(manifestDir)) === ".agents";
|
|
15635
15619
|
}
|
|
15636
15620
|
function resolveMarketplaceEntryPath(manifestPath, entryPath) {
|
|
15637
15621
|
const repoRoot = marketplaceRepoRoot(manifestPath);
|
|
@@ -15713,7 +15697,7 @@ function resolvePluginRoot(sourcePath) {
|
|
|
15713
15697
|
throw new Error(`Unsupported plugin source layout: ${sourcePath}`);
|
|
15714
15698
|
}
|
|
15715
15699
|
function versionFromInstallDirectory(installRoot) {
|
|
15716
|
-
const dirName =
|
|
15700
|
+
const dirName = basename5(installRoot);
|
|
15717
15701
|
return GIT_SHA_DIR.test(dirName) ? dirName : void 0;
|
|
15718
15702
|
}
|
|
15719
15703
|
function isPluginInstallRoot(sourcePath) {
|
|
@@ -15745,7 +15729,7 @@ function buildProvenance(input) {
|
|
|
15745
15729
|
function scanSkills(rootPath, skillDirs, metadata) {
|
|
15746
15730
|
const resources = [];
|
|
15747
15731
|
for (const skillDir of skillDirs) {
|
|
15748
|
-
const entry =
|
|
15732
|
+
const entry = basename5(skillDir);
|
|
15749
15733
|
const skillPath = join55(skillDir, "SKILL.md");
|
|
15750
15734
|
const raw = readText2(skillPath);
|
|
15751
15735
|
if (!isDirectory3(skillDir) || !raw) continue;
|
|
@@ -16247,7 +16231,7 @@ function scanPluginRoot(sourcePath, opts) {
|
|
|
16247
16231
|
if (normalizePath2(pluginRoot) === normalizePath2(sourcePath)) {
|
|
16248
16232
|
continue;
|
|
16249
16233
|
}
|
|
16250
|
-
if (cache2 &&
|
|
16234
|
+
if (cache2 && basename5(pluginRoot) !== cache2.pluginName) {
|
|
16251
16235
|
continue;
|
|
16252
16236
|
}
|
|
16253
16237
|
try {
|
|
@@ -16281,7 +16265,7 @@ function scanPluginSourceSync(sourcePath) {
|
|
|
16281
16265
|
if (existsSync35(sourcePath) && isDirectory3(sourcePath)) {
|
|
16282
16266
|
return [scanPluginRoot(sourcePath)];
|
|
16283
16267
|
}
|
|
16284
|
-
if (
|
|
16268
|
+
if (basename5(sourcePath) !== "marketplace.json") {
|
|
16285
16269
|
throw new Error(`Unsupported plugin source layout: ${sourcePath}`);
|
|
16286
16270
|
}
|
|
16287
16271
|
const manifest = validateMarketplaceManifest(
|
|
@@ -16304,12 +16288,12 @@ async function scanPluginSource(sourcePath) {
|
|
|
16304
16288
|
|
|
16305
16289
|
// src/services/host-plugin-versions.ts
|
|
16306
16290
|
import { existsSync as existsSync76, readdirSync as readdirSync28 } from "fs";
|
|
16307
|
-
import { basename as
|
|
16291
|
+
import { basename as basename11, join as join102 } from "path";
|
|
16308
16292
|
import semver17 from "semver";
|
|
16309
16293
|
|
|
16310
16294
|
// src/services/host-plugin-source.ts
|
|
16311
|
-
import { cpSync as cpSync5, existsSync as existsSync75, mkdirSync as
|
|
16312
|
-
import { dirname as dirname28, join as
|
|
16295
|
+
import { cpSync as cpSync5, existsSync as existsSync75, mkdirSync as mkdirSync35, readFileSync as readFileSync69, rmSync as rmSync13, writeFileSync as writeFileSync31 } from "fs";
|
|
16296
|
+
import { dirname as dirname28, join as join101 } from "path";
|
|
16313
16297
|
import semver16 from "semver";
|
|
16314
16298
|
|
|
16315
16299
|
// src/services/marketplace-catalog.ts
|
|
@@ -16603,7 +16587,7 @@ function enrichCatalogPlugins(marketplaceRoot, plugins) {
|
|
|
16603
16587
|
}
|
|
16604
16588
|
|
|
16605
16589
|
// src/services/marketplace-catalog-parse.ts
|
|
16606
|
-
import { basename as
|
|
16590
|
+
import { basename as basename6 } from "path";
|
|
16607
16591
|
import semver9 from "semver";
|
|
16608
16592
|
function isRecord19(value) {
|
|
16609
16593
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -16703,7 +16687,7 @@ function resolveCursorPluginName(entry) {
|
|
|
16703
16687
|
if (typeof name === "string" && name.length > 0) return name;
|
|
16704
16688
|
const path = entry.path;
|
|
16705
16689
|
if (typeof path === "string" && path.length > 0) {
|
|
16706
|
-
const derived =
|
|
16690
|
+
const derived = basename6(path);
|
|
16707
16691
|
return derived.length > 0 ? derived : void 0;
|
|
16708
16692
|
}
|
|
16709
16693
|
return void 0;
|
|
@@ -17149,7 +17133,7 @@ async function ensureMarketplaceCatalog(harnesstapDir, options) {
|
|
|
17149
17133
|
// src/services/plugin-origin-apply.ts
|
|
17150
17134
|
import { createHash as createHash14 } from "crypto";
|
|
17151
17135
|
import { existsSync as existsSync74, readdirSync as readdirSync27, statSync as statSync28 } from "fs";
|
|
17152
|
-
import { join as
|
|
17136
|
+
import { join as join100 } from "path";
|
|
17153
17137
|
|
|
17154
17138
|
// src/services/agent-plugins/install-root.ts
|
|
17155
17139
|
import { createHash as createHash13 } from "crypto";
|
|
@@ -17157,12 +17141,12 @@ import {
|
|
|
17157
17141
|
chmodSync as chmodSync4,
|
|
17158
17142
|
existsSync as existsSync72,
|
|
17159
17143
|
lstatSync as lstatSync25,
|
|
17160
|
-
mkdirSync as
|
|
17144
|
+
mkdirSync as mkdirSync34,
|
|
17161
17145
|
readFileSync as readFileSync67,
|
|
17162
17146
|
writeFileSync as writeFileSync30
|
|
17163
17147
|
} from "fs";
|
|
17164
|
-
import { isAbsolute as isAbsolute14, join as
|
|
17165
|
-
import { ulid as
|
|
17148
|
+
import { isAbsolute as isAbsolute14, join as join98, relative as relative25, resolve as resolve33 } from "path";
|
|
17149
|
+
import { ulid as ulid16 } from "ulid";
|
|
17166
17150
|
|
|
17167
17151
|
// src/models/apply-removal-backup.ts
|
|
17168
17152
|
import { existsSync as existsSync39, readFileSync as readFileSync38 } from "fs";
|
|
@@ -17270,11 +17254,11 @@ import {
|
|
|
17270
17254
|
copyFileSync as copyFileSync4,
|
|
17271
17255
|
existsSync as existsSync71,
|
|
17272
17256
|
lstatSync as lstatSync24,
|
|
17273
|
-
mkdirSync as
|
|
17257
|
+
mkdirSync as mkdirSync33,
|
|
17274
17258
|
readdirSync as readdirSync25,
|
|
17275
17259
|
readFileSync as readFileSync66,
|
|
17276
17260
|
readlinkSync as readlinkSync6,
|
|
17277
|
-
realpathSync as
|
|
17261
|
+
realpathSync as realpathSync6,
|
|
17278
17262
|
renameSync as renameSync3,
|
|
17279
17263
|
rmdirSync as rmdirSync4,
|
|
17280
17264
|
rmSync as rmSync11,
|
|
@@ -17282,8 +17266,8 @@ import {
|
|
|
17282
17266
|
symlinkSync as symlinkSync5,
|
|
17283
17267
|
writeFileSync as writeFileSync29
|
|
17284
17268
|
} from "fs";
|
|
17285
|
-
import { basename as
|
|
17286
|
-
import { ulid as
|
|
17269
|
+
import { basename as basename10, dirname as dirname26, join as join97, resolve as resolve32, sep as sep19 } from "path";
|
|
17270
|
+
import { ulid as ulid15 } from "ulid";
|
|
17287
17271
|
|
|
17288
17272
|
// src/models/preexisting-path.ts
|
|
17289
17273
|
import { ulid as ulid10 } from "ulid";
|
|
@@ -17694,7 +17678,7 @@ import { parse as parseToml6 } from "smol-toml";
|
|
|
17694
17678
|
|
|
17695
17679
|
// src/services/profile-commit-resource.ts
|
|
17696
17680
|
import { existsSync as existsSync69, readFileSync as readFileSync63, writeFileSync as writeFileSync27 } from "fs";
|
|
17697
|
-
import { join as
|
|
17681
|
+
import { join as join94, resolve as resolve29 } from "path";
|
|
17698
17682
|
|
|
17699
17683
|
// src/constants/profile.ts
|
|
17700
17684
|
var PROFILE_PLUGIN_TAG = "profile";
|
|
@@ -18584,7 +18568,7 @@ function ensurePluginDataDir(pluginName) {
|
|
|
18584
18568
|
|
|
18585
18569
|
// src/services/agent-plugins/package-root.ts
|
|
18586
18570
|
import { existsSync as existsSync48 } from "fs";
|
|
18587
|
-
import { basename as
|
|
18571
|
+
import { basename as basename7, resolve as resolve18 } from "path";
|
|
18588
18572
|
|
|
18589
18573
|
// src/services/package-cache/host-plugin.ts
|
|
18590
18574
|
import {
|
|
@@ -19506,8 +19490,8 @@ function installedPackageForResource(resourceId) {
|
|
|
19506
19490
|
const path = pathInstallRoot(origin) ?? resolveInstallRoot(origin);
|
|
19507
19491
|
if (!path) return void 0;
|
|
19508
19492
|
const parsedName = parseDependencyRef(origin).name;
|
|
19509
|
-
const name = parsedName.includes("/") || parsedName.includes("\\") ?
|
|
19510
|
-
return { name: name ||
|
|
19493
|
+
const name = parsedName.includes("/") || parsedName.includes("\\") ? basename7(path) : parsedName;
|
|
19494
|
+
return { name: name || basename7(path), version: "0.0.0", path };
|
|
19511
19495
|
}
|
|
19512
19496
|
|
|
19513
19497
|
// src/services/agent-plugins/mcp-host-paths.ts
|
|
@@ -21217,7 +21201,7 @@ async function materializeFiles(files, rootPath, options = {}) {
|
|
|
21217
21201
|
};
|
|
21218
21202
|
}
|
|
21219
21203
|
async function clearLiveReadCachesAfterWrite() {
|
|
21220
|
-
const { clearLiveReadCaches: clearLiveReadCaches2 } = await import("./live-read-cache-
|
|
21204
|
+
const { clearLiveReadCaches: clearLiveReadCaches2 } = await import("./live-read-cache-BHU6L7MA.js");
|
|
21221
21205
|
clearLiveReadCaches2();
|
|
21222
21206
|
}
|
|
21223
21207
|
async function applyToGlobal(resources, platforms, homeRoot, options = {}) {
|
|
@@ -25571,7 +25555,7 @@ function hookInventoryWireFromResource(resource) {
|
|
|
25571
25555
|
}
|
|
25572
25556
|
|
|
25573
25557
|
// src/services/project-status-payload.ts
|
|
25574
|
-
import { resolve as
|
|
25558
|
+
import { resolve as resolve26 } from "path";
|
|
25575
25559
|
|
|
25576
25560
|
// src/services/notifications.ts
|
|
25577
25561
|
import { ulid as ulid13 } from "ulid";
|
|
@@ -25770,6 +25754,206 @@ async function assessProjectScanStatus(projectRoot) {
|
|
|
25770
25754
|
};
|
|
25771
25755
|
}
|
|
25772
25756
|
|
|
25757
|
+
// src/services/project-identity.ts
|
|
25758
|
+
import { mkdirSync as mkdirSync29, realpathSync as realpathSync4 } from "fs";
|
|
25759
|
+
import { basename as basename9, join as join92, resolve as resolve25 } from "path";
|
|
25760
|
+
import { ulid as ulid14 } from "ulid";
|
|
25761
|
+
|
|
25762
|
+
// src/services/git.ts
|
|
25763
|
+
import { execSync } from "child_process";
|
|
25764
|
+
import { basename as basename8 } from "path";
|
|
25765
|
+
function getGitOrigin(projectRoot) {
|
|
25766
|
+
try {
|
|
25767
|
+
const url = execSync("git config --get remote.origin.url", {
|
|
25768
|
+
cwd: projectRoot,
|
|
25769
|
+
encoding: "utf-8",
|
|
25770
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
25771
|
+
}).trim();
|
|
25772
|
+
return url || void 0;
|
|
25773
|
+
} catch {
|
|
25774
|
+
return void 0;
|
|
25775
|
+
}
|
|
25776
|
+
}
|
|
25777
|
+
function normalizeGitUrl(url) {
|
|
25778
|
+
let normalized = url.trim();
|
|
25779
|
+
if (normalized.startsWith("git@")) {
|
|
25780
|
+
return normalized;
|
|
25781
|
+
}
|
|
25782
|
+
if (normalized.endsWith(".git")) {
|
|
25783
|
+
normalized = normalized.slice(0, -4);
|
|
25784
|
+
}
|
|
25785
|
+
return normalized;
|
|
25786
|
+
}
|
|
25787
|
+
function projectNameFromUrl(url) {
|
|
25788
|
+
const sshMatch = url.match(/:([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
25789
|
+
if (sshMatch?.[1]) return sshMatch[1];
|
|
25790
|
+
try {
|
|
25791
|
+
const parsed = new URL(url);
|
|
25792
|
+
const path = parsed.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
25793
|
+
return path || basename8(url);
|
|
25794
|
+
} catch {
|
|
25795
|
+
return basename8(url).replace(/\.git$/, "");
|
|
25796
|
+
}
|
|
25797
|
+
}
|
|
25798
|
+
|
|
25799
|
+
// src/services/project-identity.ts
|
|
25800
|
+
var PATH_PROJECT_ID_PREFIX = "path:";
|
|
25801
|
+
function realOrResolved(path) {
|
|
25802
|
+
const absolute = resolve25(path);
|
|
25803
|
+
try {
|
|
25804
|
+
return realpathSync4.native(absolute);
|
|
25805
|
+
} catch {
|
|
25806
|
+
return absolute;
|
|
25807
|
+
}
|
|
25808
|
+
}
|
|
25809
|
+
function isCaseInsensitivePlatform(platform) {
|
|
25810
|
+
return platform === "win32" || platform === "darwin";
|
|
25811
|
+
}
|
|
25812
|
+
function stripTrailingSeparators(path) {
|
|
25813
|
+
let out = path;
|
|
25814
|
+
while (out.length > 1 && out.endsWith("/") && !/^[a-z]:\/$/i.test(out)) {
|
|
25815
|
+
out = out.slice(0, -1);
|
|
25816
|
+
}
|
|
25817
|
+
return out;
|
|
25818
|
+
}
|
|
25819
|
+
function normalizeProjectPath(path, platform = process.platform) {
|
|
25820
|
+
let out = realOrResolved(path);
|
|
25821
|
+
if (platform === "win32") {
|
|
25822
|
+
out = out.replace(/\\/g, "/");
|
|
25823
|
+
}
|
|
25824
|
+
if (isCaseInsensitivePlatform(platform)) {
|
|
25825
|
+
out = out.toLowerCase();
|
|
25826
|
+
}
|
|
25827
|
+
return stripTrailingSeparators(out);
|
|
25828
|
+
}
|
|
25829
|
+
function pathProjectId(path, platform = process.platform) {
|
|
25830
|
+
return `${PATH_PROJECT_ID_PREFIX}${normalizeProjectPath(path, platform)}`;
|
|
25831
|
+
}
|
|
25832
|
+
function resolveProjectIdentity(projectRoot) {
|
|
25833
|
+
const root = resolve25(projectRoot);
|
|
25834
|
+
const localId = pathProjectId(root);
|
|
25835
|
+
const gitOriginRaw = getGitOrigin(root);
|
|
25836
|
+
if (gitOriginRaw) {
|
|
25837
|
+
return {
|
|
25838
|
+
kind: "origin",
|
|
25839
|
+
root,
|
|
25840
|
+
gitOrigin: normalizeGitUrl(gitOriginRaw),
|
|
25841
|
+
gitOriginRaw,
|
|
25842
|
+
localId,
|
|
25843
|
+
name: projectNameFromUrl(gitOriginRaw)
|
|
25844
|
+
};
|
|
25845
|
+
}
|
|
25846
|
+
return { kind: "path", root, localId, name: basename9(realOrResolved(root)) || root };
|
|
25847
|
+
}
|
|
25848
|
+
function findProjectForRoot(projectRoot, identity = resolveProjectIdentity(projectRoot)) {
|
|
25849
|
+
if (identity.kind === "path") {
|
|
25850
|
+
return getProjectByLocalId(identity.localId);
|
|
25851
|
+
}
|
|
25852
|
+
migratePathProjectToOrigin(identity);
|
|
25853
|
+
return getProjectByOrigin(identity.gitOrigin) ?? getProjectByLocalId(identity.localId);
|
|
25854
|
+
}
|
|
25855
|
+
function backupDatabase(reason, db = getDb()) {
|
|
25856
|
+
const dir = join92(getHarnesstapDir(), "backups");
|
|
25857
|
+
mkdirSync29(dir, { recursive: true });
|
|
25858
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
|
|
25859
|
+
const file = join92(dir, `harnesstap-${stamp}-${ulid14()}-${reason}.db`);
|
|
25860
|
+
db.exec(`VACUUM INTO '${file.replace(/'/g, "''")}'`);
|
|
25861
|
+
return file;
|
|
25862
|
+
}
|
|
25863
|
+
function pendingPathProjectId(db, localId) {
|
|
25864
|
+
const row = db.prepare("SELECT id FROM projects WHERE local_id = ? AND git_origin = ''").get(localId);
|
|
25865
|
+
return row?.id;
|
|
25866
|
+
}
|
|
25867
|
+
function projectChildTables(db) {
|
|
25868
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'projects'").all();
|
|
25869
|
+
const out = [];
|
|
25870
|
+
for (const { name } of tables) {
|
|
25871
|
+
const columns = db.prepare(`PRAGMA table_info("${name}")`).all();
|
|
25872
|
+
if (!columns.some((column) => column.name === "project_id")) {
|
|
25873
|
+
continue;
|
|
25874
|
+
}
|
|
25875
|
+
const pk = columns.filter((column) => column.pk > 0).sort((a, b) => a.pk - b.pk).map((column) => column.name);
|
|
25876
|
+
out.push({ name, pk });
|
|
25877
|
+
}
|
|
25878
|
+
return out;
|
|
25879
|
+
}
|
|
25880
|
+
var RECENCY_COLUMN = {
|
|
25881
|
+
project_plugins: "applied_at",
|
|
25882
|
+
project_layers: "applied_at",
|
|
25883
|
+
project_harnesses: "updated_at"
|
|
25884
|
+
};
|
|
25885
|
+
function mergeProjectRows(db, fromId, toId) {
|
|
25886
|
+
let movedSnapshots = 0;
|
|
25887
|
+
for (const table of projectChildTables(db)) {
|
|
25888
|
+
const quoted = `"${table.name}"`;
|
|
25889
|
+
const keyColumns = table.pk.filter((column) => column !== "project_id");
|
|
25890
|
+
const recency = RECENCY_COLUMN[table.name];
|
|
25891
|
+
if (recency && table.pk.includes("project_id")) {
|
|
25892
|
+
const sameKey = keyColumns.map((column) => `o."${column}" = p."${column}"`).join(" AND ");
|
|
25893
|
+
const match = sameKey ? ` AND ${sameKey}` : "";
|
|
25894
|
+
db.prepare(
|
|
25895
|
+
`DELETE FROM ${quoted} AS o WHERE o.project_id = ? AND EXISTS (
|
|
25896
|
+
SELECT 1 FROM ${quoted} AS p
|
|
25897
|
+
WHERE p.project_id = ?${match} AND p."${recency}" > o."${recency}")`
|
|
25898
|
+
).run(toId, fromId);
|
|
25899
|
+
}
|
|
25900
|
+
const result = db.prepare(`UPDATE OR IGNORE ${quoted} SET project_id = ? WHERE project_id = ?`).run(toId, fromId);
|
|
25901
|
+
if (table.name === "snapshots") {
|
|
25902
|
+
movedSnapshots = result.changes;
|
|
25903
|
+
}
|
|
25904
|
+
}
|
|
25905
|
+
return movedSnapshots;
|
|
25906
|
+
}
|
|
25907
|
+
function migratePathProjectToOrigin(identity, db = getDb()) {
|
|
25908
|
+
if (!pendingPathProjectId(db, identity.localId)) {
|
|
25909
|
+
return { status: "none" };
|
|
25910
|
+
}
|
|
25911
|
+
let backupPath;
|
|
25912
|
+
try {
|
|
25913
|
+
backupPath = backupDatabase("before-project-origin", db);
|
|
25914
|
+
} catch (error) {
|
|
25915
|
+
return { status: "failed", error: error instanceof Error ? error.message : String(error) };
|
|
25916
|
+
}
|
|
25917
|
+
try {
|
|
25918
|
+
const run = db.transaction(() => {
|
|
25919
|
+
db.prepare("UPDATE projects SET local_id = local_id WHERE local_id = ?").run(identity.localId);
|
|
25920
|
+
const fromId = pendingPathProjectId(db, identity.localId);
|
|
25921
|
+
if (!fromId) {
|
|
25922
|
+
return { status: "none" };
|
|
25923
|
+
}
|
|
25924
|
+
const target = db.prepare("SELECT id FROM projects WHERE git_origin = ?").get(identity.gitOrigin);
|
|
25925
|
+
if (!target) {
|
|
25926
|
+
db.prepare(
|
|
25927
|
+
"UPDATE projects SET git_origin = ?, local_id = '', name = ?, local_path = ? WHERE id = ?"
|
|
25928
|
+
).run(identity.gitOrigin, identity.name, identity.root, fromId);
|
|
25929
|
+
const counted = db.prepare("SELECT COUNT(*) AS n FROM snapshots WHERE project_id = ?").get(fromId);
|
|
25930
|
+
return {
|
|
25931
|
+
status: "migrated",
|
|
25932
|
+
projectId: fromId,
|
|
25933
|
+
merged: false,
|
|
25934
|
+
movedSnapshots: counted?.n ?? 0,
|
|
25935
|
+
backupPath
|
|
25936
|
+
};
|
|
25937
|
+
}
|
|
25938
|
+
const movedSnapshots = mergeProjectRows(db, fromId, target.id);
|
|
25939
|
+
const leftover = db.prepare("SELECT COUNT(*) AS n FROM snapshots WHERE project_id = ?").get(fromId);
|
|
25940
|
+
if ((leftover?.n ?? 0) > 0) {
|
|
25941
|
+
throw new Error("Snapshots were left on the folder project; nothing was changed.");
|
|
25942
|
+
}
|
|
25943
|
+
db.prepare("DELETE FROM projects WHERE id = ?").run(fromId);
|
|
25944
|
+
db.prepare("UPDATE projects SET local_path = ? WHERE id = ?").run(identity.root, target.id);
|
|
25945
|
+
return { status: "migrated", projectId: target.id, merged: true, movedSnapshots, backupPath };
|
|
25946
|
+
});
|
|
25947
|
+
return run();
|
|
25948
|
+
} catch (error) {
|
|
25949
|
+
return {
|
|
25950
|
+
status: "failed",
|
|
25951
|
+
error: error instanceof Error ? error.message : String(error),
|
|
25952
|
+
backupPath
|
|
25953
|
+
};
|
|
25954
|
+
}
|
|
25955
|
+
}
|
|
25956
|
+
|
|
25773
25957
|
// src/services/project-status-payload.ts
|
|
25774
25958
|
function formatResourceTypeSummary(resources) {
|
|
25775
25959
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -25785,22 +25969,22 @@ function formatResourceTypeSummary(resources) {
|
|
|
25785
25969
|
// src/services/resource-editor-path.ts
|
|
25786
25970
|
import {
|
|
25787
25971
|
existsSync as existsSync67,
|
|
25788
|
-
mkdirSync as
|
|
25972
|
+
mkdirSync as mkdirSync30,
|
|
25789
25973
|
readFileSync as readFileSync61,
|
|
25790
|
-
realpathSync as
|
|
25974
|
+
realpathSync as realpathSync5,
|
|
25791
25975
|
statSync as statSync24,
|
|
25792
25976
|
writeFileSync as writeFileSync25
|
|
25793
25977
|
} from "fs";
|
|
25794
|
-
import { dirname as dirname23, isAbsolute as isAbsolute13, join as
|
|
25978
|
+
import { dirname as dirname23, isAbsolute as isAbsolute13, join as join93, resolve as resolve27 } from "path";
|
|
25795
25979
|
function expandUserPath(candidate) {
|
|
25796
25980
|
const trimmed = candidate.trim();
|
|
25797
25981
|
if (trimmed.startsWith("~/")) {
|
|
25798
|
-
return
|
|
25982
|
+
return join93(resolveHomeRoot(), trimmed.slice(2));
|
|
25799
25983
|
}
|
|
25800
25984
|
if (trimmed === "~") {
|
|
25801
25985
|
return resolveHomeRoot();
|
|
25802
25986
|
}
|
|
25803
|
-
return
|
|
25987
|
+
return resolve27(trimmed);
|
|
25804
25988
|
}
|
|
25805
25989
|
function isOpenableFile(path) {
|
|
25806
25990
|
if (!existsSync67(path)) {
|
|
@@ -25887,14 +26071,14 @@ function lookupRootsForResource(resource) {
|
|
|
25887
26071
|
const originDir = originDirectory(resource);
|
|
25888
26072
|
if (originDir) {
|
|
25889
26073
|
roots.push(originDir);
|
|
25890
|
-
roots.push(
|
|
26074
|
+
roots.push(join93(originDir, ".agents"));
|
|
25891
26075
|
}
|
|
25892
|
-
roots.push(
|
|
26076
|
+
roots.push(join93(resolveHomeRoot(), ".agents"));
|
|
25893
26077
|
return uniquePaths(roots);
|
|
25894
26078
|
}
|
|
25895
26079
|
function canonicalizeExistingPath(path) {
|
|
25896
26080
|
try {
|
|
25897
|
-
return
|
|
26081
|
+
return realpathSync5(path);
|
|
25898
26082
|
} catch {
|
|
25899
26083
|
return path;
|
|
25900
26084
|
}
|
|
@@ -25903,7 +26087,7 @@ function openableFileOrSkill(path) {
|
|
|
25903
26087
|
if (isOpenableFile(path)) {
|
|
25904
26088
|
return canonicalizeExistingPath(path);
|
|
25905
26089
|
}
|
|
25906
|
-
const skillMarkdown =
|
|
26090
|
+
const skillMarkdown = join93(path, "SKILL.md");
|
|
25907
26091
|
if (isOpenableFile(skillMarkdown)) {
|
|
25908
26092
|
return canonicalizeExistingPath(skillMarkdown);
|
|
25909
26093
|
}
|
|
@@ -25916,7 +26100,7 @@ function resolveExistingEditorPath(candidate, roots = []) {
|
|
|
25916
26100
|
}
|
|
25917
26101
|
if (isBareRelativePath(trimmed)) {
|
|
25918
26102
|
for (const root of roots) {
|
|
25919
|
-
const fromRoot = openableFileOrSkill(
|
|
26103
|
+
const fromRoot = openableFileOrSkill(resolve27(root, trimmed));
|
|
25920
26104
|
if (fromRoot) {
|
|
25921
26105
|
return fromRoot;
|
|
25922
26106
|
}
|
|
@@ -26144,8 +26328,8 @@ function resolveRegisteredScanTargets(harnessOption, homeRoot = resolveHomeRoot(
|
|
|
26144
26328
|
}
|
|
26145
26329
|
|
|
26146
26330
|
// src/services/profile-untracked-resources.ts
|
|
26147
|
-
import { existsSync as existsSync68, mkdirSync as
|
|
26148
|
-
import { dirname as dirname24, resolve as
|
|
26331
|
+
import { existsSync as existsSync68, mkdirSync as mkdirSync31, readFileSync as readFileSync62, writeFileSync as writeFileSync26 } from "fs";
|
|
26332
|
+
import { dirname as dirname24, resolve as resolve28 } from "path";
|
|
26149
26333
|
var MATERIAL_RESOURCE_TYPE_SET2 = new Set(MATERIAL_RESOURCE_TYPES);
|
|
26150
26334
|
function isMaterialResource(resource) {
|
|
26151
26335
|
return MATERIAL_RESOURCE_TYPE_SET2.has(resource.type);
|
|
@@ -26332,7 +26516,7 @@ async function notStagedFromProjectScan(profileSelector, projectPath) {
|
|
|
26332
26516
|
return [];
|
|
26333
26517
|
}
|
|
26334
26518
|
const committed = trackedResourceMap(profileSelector);
|
|
26335
|
-
const resolvedRoot =
|
|
26519
|
+
const resolvedRoot = resolve28(projectPath);
|
|
26336
26520
|
const scanStatus = await assessProjectScanStatus(resolvedRoot);
|
|
26337
26521
|
const platformIds = scanStatus.on_disk.platforms;
|
|
26338
26522
|
const ownedPaths = await profileOwnedPaths(
|
|
@@ -26834,21 +27018,21 @@ function persistWrittenMaterializations(input) {
|
|
|
26834
27018
|
import {
|
|
26835
27019
|
existsSync as existsSync70,
|
|
26836
27020
|
lstatSync as lstatSync22,
|
|
26837
|
-
mkdirSync as
|
|
27021
|
+
mkdirSync as mkdirSync32,
|
|
26838
27022
|
readFileSync as readFileSync65,
|
|
26839
27023
|
readdirSync as readdirSync24,
|
|
26840
27024
|
rmSync as rmSync10,
|
|
26841
27025
|
statSync as statSync25,
|
|
26842
27026
|
writeFileSync as writeFileSync28
|
|
26843
27027
|
} from "fs";
|
|
26844
|
-
import { join as
|
|
27028
|
+
import { join as join95, relative as relative23, resolve as resolve30, sep as sep17 } from "path";
|
|
26845
27029
|
var KEEP = 50;
|
|
26846
27030
|
function ownershipDir() {
|
|
26847
|
-
return
|
|
27031
|
+
return join95(getHarnesstapDir(), "cache", "removed-ownership");
|
|
26848
27032
|
}
|
|
26849
27033
|
function ownershipFile(snapshotId, suffix = "") {
|
|
26850
27034
|
if (!/^[0-9A-Za-z_-]+$/.test(snapshotId)) return void 0;
|
|
26851
|
-
return
|
|
27035
|
+
return join95(ownershipDir(), `${snapshotId}${suffix}.json`);
|
|
26852
27036
|
}
|
|
26853
27037
|
function readSaved(path) {
|
|
26854
27038
|
try {
|
|
@@ -26863,7 +27047,7 @@ function prune() {
|
|
|
26863
27047
|
try {
|
|
26864
27048
|
for (const name of readdirSync24(ownershipDir())) {
|
|
26865
27049
|
const stem = name.split(".")[0] ?? name;
|
|
26866
|
-
const mtime = statSync25(
|
|
27050
|
+
const mtime = statSync25(join95(ownershipDir(), name)).mtimeMs;
|
|
26867
27051
|
const entry = newest.get(stem) ?? { names: [], mtime: 0 };
|
|
26868
27052
|
entry.names.push(name);
|
|
26869
27053
|
entry.mtime = Math.max(entry.mtime, mtime);
|
|
@@ -26874,7 +27058,7 @@ function prune() {
|
|
|
26874
27058
|
}
|
|
26875
27059
|
const ordered = [...newest.values()].sort((a, b) => b.mtime - a.mtime);
|
|
26876
27060
|
for (const extra of ordered.slice(KEEP)) {
|
|
26877
|
-
for (const name of extra.names) rmSync10(
|
|
27061
|
+
for (const name of extra.names) rmSync10(join95(ownershipDir(), name), { force: true });
|
|
26878
27062
|
}
|
|
26879
27063
|
}
|
|
26880
27064
|
function saveRemovedOwnership(snapshotId, rootPath, relativePaths) {
|
|
@@ -26890,7 +27074,7 @@ function saveRemovedOwnership(snapshotId, rootPath, relativePaths) {
|
|
|
26890
27074
|
}
|
|
26891
27075
|
if (rows.length === 0) return;
|
|
26892
27076
|
try {
|
|
26893
|
-
|
|
27077
|
+
mkdirSync32(ownershipDir(), { recursive: true });
|
|
26894
27078
|
writeFileSync28(file, `${JSON.stringify([...readSaved(file), ...rows], null, 2)}
|
|
26895
27079
|
`);
|
|
26896
27080
|
prune();
|
|
@@ -26916,7 +27100,7 @@ function saveRemovedHostPluginViews(snapshotId, rootPath, relativePaths) {
|
|
|
26916
27100
|
const known = new Set(saved.map((entry) => entry.view));
|
|
26917
27101
|
let added2 = false;
|
|
26918
27102
|
for (const path of relativePaths) {
|
|
26919
|
-
const target =
|
|
27103
|
+
const target = resolve30(rootPath, path);
|
|
26920
27104
|
const view = views.find((candidate) => target.startsWith(`${candidate}${sep17}`));
|
|
26921
27105
|
const record = view ? records[view] : void 0;
|
|
26922
27106
|
if (!view || !record || record.legacy || known.has(view)) continue;
|
|
@@ -26926,7 +27110,7 @@ function saveRemovedHostPluginViews(snapshotId, rootPath, relativePaths) {
|
|
|
26926
27110
|
}
|
|
26927
27111
|
if (!added2) return;
|
|
26928
27112
|
try {
|
|
26929
|
-
|
|
27113
|
+
mkdirSync32(ownershipDir(), { recursive: true });
|
|
26930
27114
|
writeFileSync28(file, `${JSON.stringify(saved, null, 2)}
|
|
26931
27115
|
`);
|
|
26932
27116
|
prune();
|
|
@@ -26936,7 +27120,7 @@ function saveRemovedHostPluginViews(snapshotId, rootPath, relativePaths) {
|
|
|
26936
27120
|
|
|
26937
27121
|
// src/services/restore-blocker.ts
|
|
26938
27122
|
import { lstatSync as lstatSync23, statSync as statSync26 } from "fs";
|
|
26939
|
-
import { dirname as dirname25, join as
|
|
27123
|
+
import { dirname as dirname25, join as join96, relative as relative24, resolve as resolve31, sep as sep18 } from "path";
|
|
26940
27124
|
|
|
26941
27125
|
// src/services/streaming-content-hash.ts
|
|
26942
27126
|
import { createHash as createHash12 } from "crypto";
|
|
@@ -27028,7 +27212,7 @@ var CONTAINER_DIR_NAMES = /* @__PURE__ */ new Set([
|
|
|
27028
27212
|
"plugins"
|
|
27029
27213
|
]);
|
|
27030
27214
|
function applyTrashRoot() {
|
|
27031
|
-
return
|
|
27215
|
+
return join97(getHarnesstapDir(), "trash");
|
|
27032
27216
|
}
|
|
27033
27217
|
function hashOnDiskFile(fullPath) {
|
|
27034
27218
|
if (!inStatusComputation()) return hashOnDiskFileUncached(fullPath);
|
|
@@ -27064,16 +27248,16 @@ function leafLinkLeavesRoot(rootPath, fullPath) {
|
|
|
27064
27248
|
if (!isSymlinkPath(fullPath)) return false;
|
|
27065
27249
|
let root;
|
|
27066
27250
|
try {
|
|
27067
|
-
root =
|
|
27251
|
+
root = realpathSync6(rootPath);
|
|
27068
27252
|
} catch {
|
|
27069
27253
|
return true;
|
|
27070
27254
|
}
|
|
27071
27255
|
let target;
|
|
27072
27256
|
try {
|
|
27073
|
-
target =
|
|
27257
|
+
target = realpathSync6(fullPath);
|
|
27074
27258
|
} catch {
|
|
27075
27259
|
try {
|
|
27076
|
-
target =
|
|
27260
|
+
target = resolve32(dirname26(fullPath), readlinkSync6(fullPath));
|
|
27077
27261
|
} catch {
|
|
27078
27262
|
return true;
|
|
27079
27263
|
}
|
|
@@ -27096,11 +27280,11 @@ function normalizeRelative(path) {
|
|
|
27096
27280
|
var HOST_PLUGIN_CACHE_SEGMENT = "plugins/cache/";
|
|
27097
27281
|
function hostPluginViewSaysNotWritten(rootPath, relativePath2) {
|
|
27098
27282
|
const normalized = normalizeRelative(relativePath2);
|
|
27099
|
-
return normalized.includes(HOST_PLUGIN_CACHE_SEGMENT) && hostPluginViewWrittenHash(
|
|
27283
|
+
return normalized.includes(HOST_PLUGIN_CACHE_SEGMENT) && hostPluginViewWrittenHash(resolve32(rootPath, normalized)) === null;
|
|
27100
27284
|
}
|
|
27101
27285
|
function classifyManagedPathOwnership(rootPath, relativePath2) {
|
|
27102
27286
|
const normalized = normalizeRelative(relativePath2);
|
|
27103
|
-
const fullPath =
|
|
27287
|
+
const fullPath = resolve32(rootPath, normalized);
|
|
27104
27288
|
const linkLeavesRoot = leafLinkLeavesRoot(rootPath, fullPath);
|
|
27105
27289
|
if (normalized.includes(HOST_PLUGIN_CACHE_SEGMENT)) {
|
|
27106
27290
|
const written = hostPluginViewWrittenHash(fullPath);
|
|
@@ -27125,7 +27309,7 @@ function hasHarnessTapMaterialization(rootPath, relativePath2) {
|
|
|
27125
27309
|
}
|
|
27126
27310
|
function hasCurrentHarnessTapMaterialization(rootPath, relativePath2) {
|
|
27127
27311
|
const normalized = normalizeRelative(relativePath2);
|
|
27128
|
-
const diskHash = hashOnDiskFile(
|
|
27312
|
+
const diskHash = hashOnDiskFile(resolve32(rootPath, normalized));
|
|
27129
27313
|
return listMaterializationsForRootPath(rootPath, normalized).some((row) => row.generated_hash === diskHash);
|
|
27130
27314
|
}
|
|
27131
27315
|
function isHarnessTapOwnedPath(rootPath, relativePath2) {
|
|
@@ -27200,7 +27384,7 @@ function planSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
|
27200
27384
|
continue;
|
|
27201
27385
|
}
|
|
27202
27386
|
seen.add(relativePath2);
|
|
27203
|
-
const fullPath =
|
|
27387
|
+
const fullPath = resolve32(rootPath, relativePath2);
|
|
27204
27388
|
if (!existsSync71(fullPath) && !isSymlinkPath(fullPath)) {
|
|
27205
27389
|
skip.push({
|
|
27206
27390
|
path: relativePath2,
|
|
@@ -27264,14 +27448,14 @@ function planSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
|
27264
27448
|
function copyToTrash(applyId, relativePath2, bytes) {
|
|
27265
27449
|
const dest = removalBackupTrashFile(applyId, relativePath2);
|
|
27266
27450
|
if (pathExists(dest)) return dest;
|
|
27267
|
-
|
|
27451
|
+
mkdirSync33(dirname26(dest), { recursive: true });
|
|
27268
27452
|
writeFileSync29(dest, bytes);
|
|
27269
27453
|
return dest;
|
|
27270
27454
|
}
|
|
27271
27455
|
function linkToTrash(applyId, relativePath2, target) {
|
|
27272
27456
|
const dest = removalBackupTrashFile(applyId, relativePath2);
|
|
27273
27457
|
if (pathExists(dest)) return;
|
|
27274
|
-
|
|
27458
|
+
mkdirSync33(dirname26(dest), { recursive: true });
|
|
27275
27459
|
try {
|
|
27276
27460
|
symlinkSync5(target, dest);
|
|
27277
27461
|
} catch {
|
|
@@ -27296,7 +27480,7 @@ function pruneApplyTrash(keepLast = APPLY_TRASH_KEEP) {
|
|
|
27296
27480
|
return;
|
|
27297
27481
|
}
|
|
27298
27482
|
const dirs = entries.filter((name) => !pinned.has(name)).map((name) => {
|
|
27299
|
-
const full =
|
|
27483
|
+
const full = join97(root, name);
|
|
27300
27484
|
try {
|
|
27301
27485
|
const stat = statSync27(full);
|
|
27302
27486
|
return { full, mtime: stat.mtimeMs, isDir: stat.isDirectory() };
|
|
@@ -27312,13 +27496,13 @@ function pruneApplyTrash(keepLast = APPLY_TRASH_KEEP) {
|
|
|
27312
27496
|
}
|
|
27313
27497
|
var EMPTY_DIR_PRUNE_STOP = new Set(CONTAINER_DIR_NAMES);
|
|
27314
27498
|
function pruneEmptyAncestors(filePath, stopAt) {
|
|
27315
|
-
const stop =
|
|
27499
|
+
const stop = resolve32(stopAt);
|
|
27316
27500
|
let current = dirname26(filePath);
|
|
27317
27501
|
while (current !== stop) {
|
|
27318
|
-
if (
|
|
27502
|
+
if (resolve32(current) === stop) {
|
|
27319
27503
|
break;
|
|
27320
27504
|
}
|
|
27321
|
-
const base =
|
|
27505
|
+
const base = basename10(current);
|
|
27322
27506
|
if (EMPTY_DIR_PRUNE_STOP.has(base)) {
|
|
27323
27507
|
break;
|
|
27324
27508
|
}
|
|
@@ -27348,7 +27532,7 @@ function pathExists(path) {
|
|
|
27348
27532
|
function stashPristineFile(input) {
|
|
27349
27533
|
const dest = removalBackupTrashFile(input.applyId, input.relativePath);
|
|
27350
27534
|
if (pathExists(dest)) return false;
|
|
27351
|
-
|
|
27535
|
+
mkdirSync33(dirname26(dest), { recursive: true });
|
|
27352
27536
|
if (input.move) {
|
|
27353
27537
|
try {
|
|
27354
27538
|
renameSync3(input.fullPath, dest);
|
|
@@ -27368,7 +27552,7 @@ function stashPristineFile(input) {
|
|
|
27368
27552
|
return true;
|
|
27369
27553
|
}
|
|
27370
27554
|
function backupOnDiskFile(input) {
|
|
27371
|
-
const fullPath =
|
|
27555
|
+
const fullPath = resolve32(input.rootPath, input.relativePath);
|
|
27372
27556
|
if (isSymlinkPath(fullPath)) {
|
|
27373
27557
|
const target = readlinkSync6(fullPath, { encoding: "buffer" });
|
|
27374
27558
|
recordApplyRemovalBackup({
|
|
@@ -27408,17 +27592,17 @@ function backupOnDiskFile(input) {
|
|
|
27408
27592
|
copyToTrash(input.applyId, input.relativePath, bytes);
|
|
27409
27593
|
}
|
|
27410
27594
|
function backupAndUnlink(input) {
|
|
27411
|
-
const fullPath =
|
|
27595
|
+
const fullPath = resolve32(input.rootPath, input.relativePath);
|
|
27412
27596
|
backupOnDiskFile({ ...input, move: true });
|
|
27413
27597
|
removeFileOrLink(fullPath);
|
|
27414
27598
|
pruneEmptyAncestors(fullPath, input.rootPath);
|
|
27415
27599
|
input.removedPaths.push(fullPath);
|
|
27416
27600
|
}
|
|
27417
27601
|
function backupAndRewriteFile(input) {
|
|
27418
|
-
const fullPath =
|
|
27602
|
+
const fullPath = resolve32(input.rootPath, input.relativePath);
|
|
27419
27603
|
if (!existsSync71(fullPath)) {
|
|
27420
27604
|
if (input.nextContent === null) return;
|
|
27421
|
-
|
|
27605
|
+
mkdirSync33(dirname26(fullPath), { recursive: true });
|
|
27422
27606
|
writeFileSync29(fullPath, input.nextContent);
|
|
27423
27607
|
restoreFileMode(fullPath, input.mode);
|
|
27424
27608
|
return;
|
|
@@ -27444,10 +27628,10 @@ function backupAndRewriteFile(input) {
|
|
|
27444
27628
|
}
|
|
27445
27629
|
}
|
|
27446
27630
|
function executeSafeFileRemovals(rootPath, relativePaths, options = {}) {
|
|
27447
|
-
const applyId = options.applyId ??
|
|
27631
|
+
const applyId = options.applyId ?? ulid15();
|
|
27448
27632
|
const plan = planSafeFileRemovals(rootPath, relativePaths, options);
|
|
27449
27633
|
const warnings = plan.skip.filter((entry) => entry.reason !== "missing").map((entry) => entry.message);
|
|
27450
|
-
const backupDir =
|
|
27634
|
+
const backupDir = join97(applyTrashRoot(), applyId);
|
|
27451
27635
|
if (options.dryRun) {
|
|
27452
27636
|
return {
|
|
27453
27637
|
applyId,
|
|
@@ -27540,7 +27724,7 @@ function pathSegment(value) {
|
|
|
27540
27724
|
return replaced2;
|
|
27541
27725
|
}
|
|
27542
27726
|
function pluginInstallRootPath(pluginName, version) {
|
|
27543
|
-
return
|
|
27727
|
+
return join98(
|
|
27544
27728
|
getHarnesstapDir(),
|
|
27545
27729
|
"cache",
|
|
27546
27730
|
"agent-plugins",
|
|
@@ -27560,7 +27744,7 @@ function containedDest(root, relativePath2) {
|
|
|
27560
27744
|
if (parts.some((part) => part.length === 0 || part === "." || part === "..")) {
|
|
27561
27745
|
return void 0;
|
|
27562
27746
|
}
|
|
27563
|
-
const dest =
|
|
27747
|
+
const dest = resolve33(root, ...parts);
|
|
27564
27748
|
const rel = relative25(root, dest);
|
|
27565
27749
|
if (rel.startsWith("..") || isAbsolute14(rel)) return void 0;
|
|
27566
27750
|
return dest;
|
|
@@ -27588,7 +27772,7 @@ function deleteInstallRow(pluginName, version, relativePath2) {
|
|
|
27588
27772
|
).run(pluginName, version, relativePath2);
|
|
27589
27773
|
}
|
|
27590
27774
|
function backupFile(root, relativePath2, applyId) {
|
|
27591
|
-
const fullPath =
|
|
27775
|
+
const fullPath = resolve33(root, ...relativePath2.split("/"));
|
|
27592
27776
|
const bytes = readFileSync67(fullPath);
|
|
27593
27777
|
let mode = 0;
|
|
27594
27778
|
try {
|
|
@@ -27602,12 +27786,12 @@ function backupFile(root, relativePath2, applyId) {
|
|
|
27602
27786
|
content: bytes,
|
|
27603
27787
|
mode
|
|
27604
27788
|
});
|
|
27605
|
-
const dest =
|
|
27606
|
-
|
|
27789
|
+
const dest = join98(applyTrashRoot(), applyId, ...relativePath2.split("/"));
|
|
27790
|
+
mkdirSync34(resolve33(dest, ".."), { recursive: true });
|
|
27607
27791
|
writeFileSync30(dest, bytes);
|
|
27608
27792
|
}
|
|
27609
27793
|
function writeOwnedFile(dest, relativePath2, bytes) {
|
|
27610
|
-
|
|
27794
|
+
mkdirSync34(resolve33(dest, ".."), { recursive: true });
|
|
27611
27795
|
const mode = relativePath2.startsWith("bin/") ? 493 : 420;
|
|
27612
27796
|
writeFileSync30(dest, bytes, { mode });
|
|
27613
27797
|
if (relativePath2.startsWith("bin/")) {
|
|
@@ -27624,8 +27808,8 @@ function installAgentPluginPackage(plugin, files) {
|
|
|
27624
27808
|
);
|
|
27625
27809
|
return { path: root, warnings, backedUp };
|
|
27626
27810
|
}
|
|
27627
|
-
|
|
27628
|
-
const applyId = `plugin-install-${
|
|
27811
|
+
mkdirSync34(root, { recursive: true });
|
|
27812
|
+
const applyId = `plugin-install-${ulid16()}`;
|
|
27629
27813
|
const owned = new Map(listInstallRows(plugin.name, plugin.version).map((row) => [row.relative_path, row]));
|
|
27630
27814
|
const nextPaths = /* @__PURE__ */ new Set();
|
|
27631
27815
|
for (const relativePath2 of Object.keys(files).sort()) {
|
|
@@ -27838,11 +28022,11 @@ function parseMarkdownComponent(type, layoutPath, files) {
|
|
|
27838
28022
|
if (!relativePath2.startsWith(prefix) || !relativePath2.endsWith(".md")) continue;
|
|
27839
28023
|
const entry = files[relativePath2];
|
|
27840
28024
|
if (!entry) continue;
|
|
27841
|
-
const
|
|
27842
|
-
if (!
|
|
28025
|
+
const basename15 = relativePath2.slice(prefix.length, -".md".length);
|
|
28026
|
+
if (!basename15 || basename15.includes("/")) continue;
|
|
27843
28027
|
const parsed = parseFrontmatter(fileText2(entry));
|
|
27844
28028
|
const data = isRecord27(parsed.data) ? { ...parsed.data } : {};
|
|
27845
|
-
const name = typeof data.name === "string" && data.name.length > 0 ? data.name :
|
|
28029
|
+
const name = typeof data.name === "string" && data.name.length > 0 ? data.name : basename15;
|
|
27846
28030
|
const description = typeof data.description === "string" ? data.description : "";
|
|
27847
28031
|
delete data.name;
|
|
27848
28032
|
delete data.description;
|
|
@@ -28073,7 +28257,7 @@ import {
|
|
|
28073
28257
|
renameSync as renameSync4,
|
|
28074
28258
|
rmSync as rmSync12
|
|
28075
28259
|
} from "fs";
|
|
28076
|
-
import { dirname as dirname27, join as
|
|
28260
|
+
import { dirname as dirname27, join as join99, relative as relative26, sep as sep20 } from "path";
|
|
28077
28261
|
function skipped(rel) {
|
|
28078
28262
|
return rel === ".git" || rel.startsWith(".git/") || rel === "node_modules" || rel.startsWith("node_modules/");
|
|
28079
28263
|
}
|
|
@@ -28087,7 +28271,7 @@ function treeFiles(root) {
|
|
|
28087
28271
|
return;
|
|
28088
28272
|
}
|
|
28089
28273
|
for (const entry of entries) {
|
|
28090
|
-
const full =
|
|
28274
|
+
const full = join99(dir, entry.name);
|
|
28091
28275
|
const rel = relative26(root, full).split(sep20).join("/");
|
|
28092
28276
|
if (skipped(rel)) continue;
|
|
28093
28277
|
if (entry.isDirectory()) walk(full);
|
|
@@ -28117,7 +28301,7 @@ function sameTree(left, right) {
|
|
|
28117
28301
|
const rightFiles = treeFiles(right);
|
|
28118
28302
|
if (leftFiles.length !== rightFiles.length) return false;
|
|
28119
28303
|
return leftFiles.every(
|
|
28120
|
-
(path, index) => path === rightFiles[index] && sameEntry(
|
|
28304
|
+
(path, index) => path === rightFiles[index] && sameEntry(join99(left, path), join99(right, path))
|
|
28121
28305
|
);
|
|
28122
28306
|
}
|
|
28123
28307
|
function refreshCachedHostPluginVersion(input) {
|
|
@@ -28128,7 +28312,7 @@ function refreshCachedHostPluginVersion(input) {
|
|
|
28128
28312
|
if (!existsSync73(canonical) || !isPluginInstallRoot(canonical)) return false;
|
|
28129
28313
|
if (!isPluginInstallRoot(input.sourceInstallRoot)) return false;
|
|
28130
28314
|
if (sameTree(input.sourceInstallRoot, canonical)) return false;
|
|
28131
|
-
const staging =
|
|
28315
|
+
const staging = join99(dirname27(canonical), `.refresh-${process.pid}-${Date.now()}`);
|
|
28132
28316
|
rmSync12(staging, { recursive: true, force: true });
|
|
28133
28317
|
cpSync4(input.sourceInstallRoot, staging, {
|
|
28134
28318
|
recursive: true,
|
|
@@ -28149,14 +28333,14 @@ function isDirectory7(path) {
|
|
|
28149
28333
|
return existsSync74(path) && statSync28(path).isDirectory();
|
|
28150
28334
|
}
|
|
28151
28335
|
function resolveMarketplacePluginDirectory(cacheDir, pluginName) {
|
|
28152
|
-
const underPlugins =
|
|
28336
|
+
const underPlugins = join100(cacheDir, "plugins", pluginName);
|
|
28153
28337
|
if (isDirectory7(underPlugins) && isPluginInstallRoot(underPlugins)) {
|
|
28154
28338
|
return underPlugins;
|
|
28155
28339
|
}
|
|
28156
28340
|
if (isDirectory7(underPlugins)) {
|
|
28157
28341
|
return underPlugins;
|
|
28158
28342
|
}
|
|
28159
|
-
const atRoot =
|
|
28343
|
+
const atRoot = join100(cacheDir, pluginName);
|
|
28160
28344
|
if (isDirectory7(atRoot) && isPluginInstallRoot(atRoot)) {
|
|
28161
28345
|
return atRoot;
|
|
28162
28346
|
}
|
|
@@ -28168,7 +28352,7 @@ function resolveMarketplacePluginDirectory(cacheDir, pluginName) {
|
|
|
28168
28352
|
if (!entry.isDirectory() || entry.name === ".git") {
|
|
28169
28353
|
continue;
|
|
28170
28354
|
}
|
|
28171
|
-
const nested =
|
|
28355
|
+
const nested = join100(cacheDir, entry.name, pluginName);
|
|
28172
28356
|
if (isDirectory7(nested) && isPluginInstallRoot(nested)) {
|
|
28173
28357
|
return nested;
|
|
28174
28358
|
}
|
|
@@ -28188,7 +28372,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
28188
28372
|
if (!entry.isDirectory() || PLUGIN_ROOT_WALK_SKIP2.has(entry.name)) {
|
|
28189
28373
|
continue;
|
|
28190
28374
|
}
|
|
28191
|
-
const child =
|
|
28375
|
+
const child = join100(dir, entry.name);
|
|
28192
28376
|
if (entry.name === pluginName && isPluginInstallRoot(child)) {
|
|
28193
28377
|
return child;
|
|
28194
28378
|
}
|
|
@@ -28198,7 +28382,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
28198
28382
|
continue;
|
|
28199
28383
|
}
|
|
28200
28384
|
const found = walkNamedPluginInstallRoot(
|
|
28201
|
-
|
|
28385
|
+
join100(dir, entry.name),
|
|
28202
28386
|
pluginName,
|
|
28203
28387
|
depth + 1
|
|
28204
28388
|
);
|
|
@@ -28213,7 +28397,7 @@ function walkNamedPluginInstallRoot(dir, pluginName, depth) {
|
|
|
28213
28397
|
}
|
|
28214
28398
|
function gitOriginCacheDir(harnesstapDir, url) {
|
|
28215
28399
|
const digest = createHash14("sha256").update(url, "utf8").digest("hex");
|
|
28216
|
-
return
|
|
28400
|
+
return join100(harnesstapDir, "cache", "git-origins", digest);
|
|
28217
28401
|
}
|
|
28218
28402
|
function originPluginLookupName(plugin, locator) {
|
|
28219
28403
|
switch (locator.kind) {
|
|
@@ -28504,7 +28688,7 @@ function parseMarketplacePluginSource(entry) {
|
|
|
28504
28688
|
}
|
|
28505
28689
|
}
|
|
28506
28690
|
function defaultMarketplaceRoot(homeRoot, marketplace) {
|
|
28507
|
-
return
|
|
28691
|
+
return join101(claudePluginsDir(homeRoot), "marketplaces", marketplace);
|
|
28508
28692
|
}
|
|
28509
28693
|
function resolveMarketplaceRoot(homeRoot, marketplace) {
|
|
28510
28694
|
const known = readKnownMarketplace(homeRoot, marketplace);
|
|
@@ -28515,7 +28699,7 @@ function resolveMarketplaceRoot(homeRoot, marketplace) {
|
|
|
28515
28699
|
return existsSync75(fallback) ? fallback : null;
|
|
28516
28700
|
}
|
|
28517
28701
|
function readClaudeKnownMarketplace(homeRoot, marketplace) {
|
|
28518
|
-
const knownPath =
|
|
28702
|
+
const knownPath = join101(
|
|
28519
28703
|
claudePluginsDir(homeRoot),
|
|
28520
28704
|
"known_marketplaces.json"
|
|
28521
28705
|
);
|
|
@@ -28573,7 +28757,7 @@ function readKnownMarketplace(homeRoot, marketplace, harnesstapDir = getHarnesst
|
|
|
28573
28757
|
}
|
|
28574
28758
|
function readMarketplaceManifestRecord(root) {
|
|
28575
28759
|
for (const relative28 of MARKETPLACE_MANIFEST_RELATIVE_PATHS) {
|
|
28576
|
-
const file = readCachedMarketplaceJson(
|
|
28760
|
+
const file = readCachedMarketplaceJson(join101(root, relative28));
|
|
28577
28761
|
if (file && isRecord28(file)) {
|
|
28578
28762
|
return file;
|
|
28579
28763
|
}
|
|
@@ -28610,7 +28794,7 @@ async function resolveMarketplaceCloneUrl(homeRoot, marketplace, runCommand = ru
|
|
|
28610
28794
|
if (!root) {
|
|
28611
28795
|
return null;
|
|
28612
28796
|
}
|
|
28613
|
-
if (existsSync75(
|
|
28797
|
+
if (existsSync75(join101(root, ".git"))) {
|
|
28614
28798
|
const remote = await runGit2(runCommand, ["remote", "get-url", "origin"], root);
|
|
28615
28799
|
const url = remote.stdout.trim();
|
|
28616
28800
|
if (remote.exitCode === 0 && url) {
|
|
@@ -28656,7 +28840,7 @@ function readMarketplacePluginSourceAt(root, pluginName) {
|
|
|
28656
28840
|
return parseMarketplacePluginSource(entry);
|
|
28657
28841
|
}
|
|
28658
28842
|
function snapshotPath(harnesstapDir) {
|
|
28659
|
-
return
|
|
28843
|
+
return join101(harnesstapDir, SNAPSHOT_FILE);
|
|
28660
28844
|
}
|
|
28661
28845
|
function readHostPluginSourceSnapshot(originRef, harnesstapDir = getHarnesstapDir()) {
|
|
28662
28846
|
const raw = readJsonFile(
|
|
@@ -28669,7 +28853,7 @@ function readHostPluginSourceSnapshot(originRef, harnesstapDir = getHarnesstapDi
|
|
|
28669
28853
|
return row;
|
|
28670
28854
|
}
|
|
28671
28855
|
function cacheVersionDir(homeRoot, marketplace, pluginName, version) {
|
|
28672
|
-
return
|
|
28856
|
+
return join101(
|
|
28673
28857
|
claudePluginsDir(homeRoot),
|
|
28674
28858
|
"cache",
|
|
28675
28859
|
marketplace,
|
|
@@ -28715,7 +28899,7 @@ function verifiedGitRefsToTry(input) {
|
|
|
28715
28899
|
return refs;
|
|
28716
28900
|
}
|
|
28717
28901
|
function declaredPluginVersion(root) {
|
|
28718
|
-
for (const manifest of [
|
|
28902
|
+
for (const manifest of [join101(root, ".claude-plugin", "plugin.json"), join101(root, "plugin.json")]) {
|
|
28719
28903
|
if (!existsSync75(manifest)) continue;
|
|
28720
28904
|
try {
|
|
28721
28905
|
const parsed = JSON.parse(readFileSync69(manifest, "utf8"));
|
|
@@ -28912,9 +29096,9 @@ async function downloadHostPluginVersion(input) {
|
|
|
28912
29096
|
const advertised = live?.version ?? snapshot?.advertised_version;
|
|
28913
29097
|
const marketplaceRoot = resolveMarketplaceRoot(homeRoot, marketplace);
|
|
28914
29098
|
if (marketplaceRoot && advertised === input.version && (live?.path || resolveMarketplacePluginDirectory(marketplaceRoot, name))) {
|
|
28915
|
-
const pluginDir = (live?.path ?
|
|
29099
|
+
const pluginDir = (live?.path ? join101(marketplaceRoot, live.path) : void 0) ?? resolveMarketplacePluginDirectory(marketplaceRoot, name);
|
|
28916
29100
|
if (pluginDir && existsSync75(pluginDir) && isPluginInstallRoot(pluginDir)) {
|
|
28917
|
-
|
|
29101
|
+
mkdirSync35(dirname28(target), { recursive: true });
|
|
28918
29102
|
cpSync5(pluginDir, target, { recursive: true, verbatimSymlinks: true });
|
|
28919
29103
|
upsertPackageCacheEntry({
|
|
28920
29104
|
kind: "host_plugin",
|
|
@@ -28946,7 +29130,7 @@ function isCacheVersionDirectoryName2(name) {
|
|
|
28946
29130
|
return semver17.valid(name) !== null || GIT_SHA_DIR2.test(name);
|
|
28947
29131
|
}
|
|
28948
29132
|
function resolvedVersionFromInstallRoot(installRoot, manifestVersion) {
|
|
28949
|
-
const dirName =
|
|
29133
|
+
const dirName = basename11(installRoot);
|
|
28950
29134
|
if (isCacheVersionDirectoryName2(dirName)) {
|
|
28951
29135
|
return dirName;
|
|
28952
29136
|
}
|
|
@@ -28964,7 +29148,7 @@ function sortHostPluginVersionNames(versions) {
|
|
|
28964
29148
|
|
|
28965
29149
|
// src/services/resource-sync.ts
|
|
28966
29150
|
function defaultClaudePluginsRoot(homeRoot) {
|
|
28967
|
-
return
|
|
29151
|
+
return join103(homeRoot, ".claude", "plugins");
|
|
28968
29152
|
}
|
|
28969
29153
|
function uniqueInstallRefs(originRef, homeRoot) {
|
|
28970
29154
|
const ordered = [];
|
|
@@ -28990,7 +29174,7 @@ function resolveExistingInstallRoot(candidate) {
|
|
|
28990
29174
|
const children = [];
|
|
28991
29175
|
for (const entry of readdirSync29(candidate, { withFileTypes: true })) {
|
|
28992
29176
|
if (!entry.isDirectory()) continue;
|
|
28993
|
-
const childPath =
|
|
29177
|
+
const childPath = join103(candidate, entry.name);
|
|
28994
29178
|
if (isPluginInstallRoot(childPath)) {
|
|
28995
29179
|
children.push(childPath);
|
|
28996
29180
|
}
|
|
@@ -29001,7 +29185,7 @@ function resolveExistingInstallRoot(candidate) {
|
|
|
29001
29185
|
if (children.length === 1) {
|
|
29002
29186
|
return children[0];
|
|
29003
29187
|
}
|
|
29004
|
-
const byName = new Map(children.map((path) => [
|
|
29188
|
+
const byName = new Map(children.map((path) => [basename12(path), path]));
|
|
29005
29189
|
const newest = sortHostPluginVersionNames([...byName.keys()])[0];
|
|
29006
29190
|
return (newest ? byName.get(newest) : children[0]) ?? children[0];
|
|
29007
29191
|
} catch {
|
|
@@ -29030,23 +29214,23 @@ function resolveInstallRootCandidates(originRef, homeRoot, claudePluginsRoot) {
|
|
|
29030
29214
|
if (!resolvedMarketplace) {
|
|
29031
29215
|
return [];
|
|
29032
29216
|
}
|
|
29033
|
-
return [
|
|
29217
|
+
return [join103(claudePluginsRoot, "cache", resolvedMarketplace, plugin)];
|
|
29034
29218
|
});
|
|
29035
29219
|
const candidates = [
|
|
29036
29220
|
...installedPath ? [installedPath] : [],
|
|
29037
29221
|
...copilotInstalledPath ? [copilotInstalledPath] : [],
|
|
29038
29222
|
...cursorInstalledPath ? [cursorInstalledPath] : [],
|
|
29039
29223
|
...cacheCandidates,
|
|
29040
|
-
|
|
29041
|
-
|
|
29042
|
-
|
|
29043
|
-
|
|
29044
|
-
|
|
29045
|
-
|
|
29046
|
-
|
|
29224
|
+
join103(claudePluginsRoot, "cache", marketplace ?? plugin, plugin),
|
|
29225
|
+
join103(claudePluginsRoot, "CACHE", plugin),
|
|
29226
|
+
join103(claudePluginsRoot, "cache", plugin, plugin),
|
|
29227
|
+
join103(claudePluginsRoot, marketplace ?? plugin, plugin),
|
|
29228
|
+
join103(homeRoot, ".cursor", "plugins", plugin),
|
|
29229
|
+
join103(homeRoot, ".cursor", "plugins", "cache", marketplace ?? plugin, plugin),
|
|
29230
|
+
join103(homeRoot, ".agents", "plugins", plugin)
|
|
29047
29231
|
];
|
|
29048
29232
|
if (originRef.startsWith("./") || originRef.startsWith("../")) {
|
|
29049
|
-
candidates.unshift(
|
|
29233
|
+
candidates.unshift(join103(process.cwd(), originRef));
|
|
29050
29234
|
}
|
|
29051
29235
|
return candidates;
|
|
29052
29236
|
}
|
|
@@ -29273,7 +29457,7 @@ async function syncPluginResource(pluginResource, options = {}) {
|
|
|
29273
29457
|
scan = void 0;
|
|
29274
29458
|
}
|
|
29275
29459
|
if (!scan) {
|
|
29276
|
-
const manifestVersion = readPluginVersionFromInstallRoot(scanRoot) ?? (isPluginInstallRoot(scanRoot) && isCacheVersionDirectoryName2(
|
|
29460
|
+
const manifestVersion = readPluginVersionFromInstallRoot(scanRoot) ?? (isPluginInstallRoot(scanRoot) && isCacheVersionDirectoryName2(basename12(scanRoot)) ? basename12(scanRoot) : void 0);
|
|
29277
29461
|
if (!manifestVersion) {
|
|
29278
29462
|
stale.push({ resource: pluginResource, reason: "plugin tree is empty" });
|
|
29279
29463
|
return { checked: 1, updated, stale, unchanged, skipped: skipped2 };
|
|
@@ -29457,7 +29641,7 @@ function collectPluginFiles(root) {
|
|
|
29457
29641
|
continue;
|
|
29458
29642
|
}
|
|
29459
29643
|
if (entry.name === CURSOR_LOCAL_PLUGIN_SIDECAR) continue;
|
|
29460
|
-
const absolute =
|
|
29644
|
+
const absolute = join104(dir, entry.name);
|
|
29461
29645
|
if (entry.isDirectory()) {
|
|
29462
29646
|
stack.push(absolute);
|
|
29463
29647
|
continue;
|
|
@@ -29534,7 +29718,7 @@ function enabledPluginsFromRaw(raw) {
|
|
|
29534
29718
|
}
|
|
29535
29719
|
function mergeEnabledPlugin(files, homeRoot, ref, surfaceWarnings) {
|
|
29536
29720
|
const settingsPath2 = ".claude/settings.json";
|
|
29537
|
-
const existingOnDisk = existsSync78(
|
|
29721
|
+
const existingOnDisk = existsSync78(join104(homeRoot, settingsPath2)) ? readFileSync70(join104(homeRoot, settingsPath2), "utf-8") : void 0;
|
|
29538
29722
|
const generated = files.find((file) => file.path === settingsPath2)?.content;
|
|
29539
29723
|
const disabledByUser = enabledPluginsFromRaw(existingOnDisk)[ref] === false;
|
|
29540
29724
|
if (disabledByUser) {
|
|
@@ -29578,7 +29762,7 @@ function hostPluginSourceRoot(resource, originRef, homeRoot) {
|
|
|
29578
29762
|
const metadata = resource.metadata ?? {};
|
|
29579
29763
|
const version = metadata.resolved_version?.trim();
|
|
29580
29764
|
const { name, marketplace } = parsePluginRef(originRef);
|
|
29581
|
-
if (!version || !marketplace || isLocalMarketplace(marketplace) || installed &&
|
|
29765
|
+
if (!version || !marketplace || isLocalMarketplace(marketplace) || installed && basename13(installed) === version) {
|
|
29582
29766
|
return installed;
|
|
29583
29767
|
}
|
|
29584
29768
|
const cached = hostPluginPackageDir(
|
|
@@ -29649,7 +29833,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
29649
29833
|
alias_harnesses: []
|
|
29650
29834
|
});
|
|
29651
29835
|
}
|
|
29652
|
-
const sourceContent = remoteMarketplace && isMirroredHostPluginView(
|
|
29836
|
+
const sourceContent = remoteMarketplace && isMirroredHostPluginView(join104(options.homeRoot, relativeRoot)) ? new Map(filtered.files.map((file) => [file.relativePath, file.content])) : void 0;
|
|
29653
29837
|
for (const file of translated.files) {
|
|
29654
29838
|
if (sourceContent && !isClaudeReadPluginFile(file.relativePath, file.encoding) && sourceContent.get(file.relativePath) === file.content) {
|
|
29655
29839
|
continue;
|
|
@@ -29679,7 +29863,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
29679
29863
|
const metadata = resource.metadata ?? {};
|
|
29680
29864
|
const record = {
|
|
29681
29865
|
scope: "user",
|
|
29682
|
-
installPath:
|
|
29866
|
+
installPath: join104(options.homeRoot, relativeRoot),
|
|
29683
29867
|
version: metadata.resolved_version ?? "unknown"
|
|
29684
29868
|
};
|
|
29685
29869
|
if (remoteMarketplace) {
|
|
@@ -29687,7 +29871,7 @@ function emitHostPluginTrees(resources, options) {
|
|
|
29687
29871
|
plugins.push({ name: resource.name, version: record.version, relativeRoot });
|
|
29688
29872
|
claudeMarketplaces.set(remoteMarketplace, plugins);
|
|
29689
29873
|
}
|
|
29690
|
-
const existing = files.find((file) => file.path === installedPath)?.content ?? (existsSync78(
|
|
29874
|
+
const existing = files.find((file) => file.path === installedPath)?.content ?? (existsSync78(join104(options.homeRoot, installedPath)) ? readFileSync70(join104(options.homeRoot, installedPath), "utf-8") : void 0);
|
|
29691
29875
|
upsertSerializedFile(
|
|
29692
29876
|
files,
|
|
29693
29877
|
installedPath,
|
|
@@ -29720,7 +29904,7 @@ function foreignClaudeInstall(homeRoot, originRef, relativeRoot) {
|
|
|
29720
29904
|
if (!isHarnessTapClaudeRecord(homeRoot, record)) return recordPath;
|
|
29721
29905
|
candidates.push(recordPath);
|
|
29722
29906
|
}
|
|
29723
|
-
const destination =
|
|
29907
|
+
const destination = join104(homeRoot, relativeRoot);
|
|
29724
29908
|
if (existsSync78(destination)) candidates.push(destination);
|
|
29725
29909
|
for (const path of candidates) {
|
|
29726
29910
|
const view = readHostPluginViewRecord(path);
|
|
@@ -30440,7 +30624,7 @@ function mapAttachedResource(row) {
|
|
|
30440
30624
|
function createPlugin(input) {
|
|
30441
30625
|
const db = getDb();
|
|
30442
30626
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
30443
|
-
const id =
|
|
30627
|
+
const id = ulid18();
|
|
30444
30628
|
const version = input.version ?? "1.0.0";
|
|
30445
30629
|
const origin = input.origin ?? "authored";
|
|
30446
30630
|
db.prepare(
|
|
@@ -30829,7 +31013,7 @@ function readGlobalMcpServers(homeRoot, harnessId) {
|
|
|
30829
31013
|
return {};
|
|
30830
31014
|
}
|
|
30831
31015
|
const relativePath2 = configuredPath.startsWith("~/") ? configuredPath.slice(2) : configuredPath;
|
|
30832
|
-
const fullPath =
|
|
31016
|
+
const fullPath = join105(homeRoot, relativePath2);
|
|
30833
31017
|
if (!existsSync79(fullPath)) {
|
|
30834
31018
|
return {};
|
|
30835
31019
|
}
|
|
@@ -30940,10 +31124,8 @@ function buildHarnessMcpRows(declaredNames, liveNames, comparison) {
|
|
|
30940
31124
|
return rows;
|
|
30941
31125
|
}
|
|
30942
31126
|
function projectForDriftPath(projectPath) {
|
|
30943
|
-
const resolvedRoot =
|
|
30944
|
-
const
|
|
30945
|
-
const gitOrigin = gitOriginRaw ? normalizeGitUrl(gitOriginRaw) : null;
|
|
30946
|
-
const project = getProjectByLocalPath(resolvedRoot) ?? (gitOrigin ? getProjectByOrigin(gitOrigin) : void 0) ?? null;
|
|
31127
|
+
const resolvedRoot = resolve34(projectPath);
|
|
31128
|
+
const project = findProjectForRoot(resolvedRoot) ?? getProjectByLocalPath(resolvedRoot) ?? null;
|
|
30947
31129
|
if (!project) return null;
|
|
30948
31130
|
return { root: resolvedRoot, id: project.id };
|
|
30949
31131
|
}
|
|
@@ -30956,7 +31138,7 @@ function projectDriftWatchPaths(projectPath) {
|
|
|
30956
31138
|
const paths = [];
|
|
30957
31139
|
for (const files of Object.values(snapshot.state?.platform_files ?? {})) {
|
|
30958
31140
|
for (const relativePath2 of Object.keys(files)) {
|
|
30959
|
-
paths.push(
|
|
31141
|
+
paths.push(join105(project.root, relativePath2));
|
|
30960
31142
|
}
|
|
30961
31143
|
}
|
|
30962
31144
|
return paths;
|
|
@@ -31146,7 +31328,7 @@ function markDirty() {
|
|
|
31146
31328
|
}
|
|
31147
31329
|
function expandHomePath(value, home) {
|
|
31148
31330
|
if (value === "~") return home;
|
|
31149
|
-
if (value.startsWith("~/")) return
|
|
31331
|
+
if (value.startsWith("~/")) return join106(home, value.slice(2));
|
|
31150
31332
|
return value;
|
|
31151
31333
|
}
|
|
31152
31334
|
function pushPath(paths, value, home) {
|
|
@@ -31177,7 +31359,7 @@ function harnessConfigPaths(home) {
|
|
|
31177
31359
|
return paths;
|
|
31178
31360
|
}
|
|
31179
31361
|
function marketplaceInstallRoots(home) {
|
|
31180
|
-
const knownPath =
|
|
31362
|
+
const knownPath = join106(home, ".claude", "plugins", "known_marketplaces.json");
|
|
31181
31363
|
let parsed;
|
|
31182
31364
|
try {
|
|
31183
31365
|
parsed = JSON.parse(readFileSync72(knownPath, "utf8"));
|
|
@@ -31198,14 +31380,14 @@ function marketplaceInstallRoots(home) {
|
|
|
31198
31380
|
function manifestPathsUnder(root) {
|
|
31199
31381
|
const found = [];
|
|
31200
31382
|
for (const relative28 of MANIFEST_RELATIVE_PATHS) {
|
|
31201
|
-
const path =
|
|
31383
|
+
const path = join106(root, relative28);
|
|
31202
31384
|
if (existsSync80(path)) found.push(path);
|
|
31203
31385
|
}
|
|
31204
31386
|
return found;
|
|
31205
31387
|
}
|
|
31206
31388
|
function marketplaceManifestPaths(home) {
|
|
31207
31389
|
const roots = [
|
|
31208
|
-
|
|
31390
|
+
join106(home, ".claude", "plugins", "marketplaces"),
|
|
31209
31391
|
...marketplaceInstallRoots(home)
|
|
31210
31392
|
];
|
|
31211
31393
|
const found = [];
|
|
@@ -31218,7 +31400,7 @@ function marketplaceManifestPaths(home) {
|
|
|
31218
31400
|
continue;
|
|
31219
31401
|
}
|
|
31220
31402
|
for (const name of names) {
|
|
31221
|
-
const child =
|
|
31403
|
+
const child = join106(root, name);
|
|
31222
31404
|
try {
|
|
31223
31405
|
if (!statSync29(child).isDirectory()) continue;
|
|
31224
31406
|
} catch {
|
|
@@ -31230,12 +31412,12 @@ function marketplaceManifestPaths(home) {
|
|
|
31230
31412
|
return found;
|
|
31231
31413
|
}
|
|
31232
31414
|
function recursiveWatchPaths(home) {
|
|
31233
|
-
const plugins =
|
|
31415
|
+
const plugins = join106(home, ".cursor", "plugins");
|
|
31234
31416
|
const paths = /* @__PURE__ */ new Set([
|
|
31235
31417
|
plugins,
|
|
31236
|
-
|
|
31237
|
-
|
|
31238
|
-
|
|
31418
|
+
join106(plugins, "local"),
|
|
31419
|
+
join106(plugins, "cache"),
|
|
31420
|
+
join106(home, ".claude", "plugins", "marketplaces")
|
|
31239
31421
|
]);
|
|
31240
31422
|
for (const root of marketplaceInstallRoots(home)) {
|
|
31241
31423
|
paths.add(root);
|
|
@@ -31248,17 +31430,17 @@ function isSidecarOwnedPath(path) {
|
|
|
31248
31430
|
}
|
|
31249
31431
|
function collectFingerprintPaths(projectPath, extra) {
|
|
31250
31432
|
const home = resolveHomeRoot();
|
|
31251
|
-
const plugins =
|
|
31433
|
+
const plugins = join106(home, ".cursor", "plugins");
|
|
31252
31434
|
const paths = [
|
|
31253
31435
|
plugins,
|
|
31254
|
-
|
|
31255
|
-
|
|
31256
|
-
|
|
31257
|
-
|
|
31258
|
-
|
|
31259
|
-
|
|
31260
|
-
|
|
31261
|
-
|
|
31436
|
+
join106(plugins, "installed.json"),
|
|
31437
|
+
join106(plugins, "installed_plugins.json"),
|
|
31438
|
+
join106(plugins, "local"),
|
|
31439
|
+
join106(home, ".claude", "plugins", "installed_plugins.json"),
|
|
31440
|
+
join106(home, ".claude", "plugins", "known_marketplaces.json"),
|
|
31441
|
+
join106(home, ".claude", "plugins", "marketplaces"),
|
|
31442
|
+
join106(cursorUserDataDir(home), "User", "settings.json"),
|
|
31443
|
+
join106(home, ".cursor", "projects", "mcps"),
|
|
31262
31444
|
...harnessConfigPaths(home),
|
|
31263
31445
|
...marketplaceManifestPaths(home),
|
|
31264
31446
|
...projectDriftWatchPaths(projectPath),
|
|
@@ -31283,7 +31465,7 @@ function fingerprintPaths(paths) {
|
|
|
31283
31465
|
function notifyWatchDirty(path, file) {
|
|
31284
31466
|
if (path !== void 0 && typeof file === "string") {
|
|
31285
31467
|
const wanted = parentOnlyWatches.get(path);
|
|
31286
|
-
if (wanted && !wanted.has(
|
|
31468
|
+
if (wanted && !wanted.has(basename14(file))) return;
|
|
31287
31469
|
}
|
|
31288
31470
|
if (debugCache) console.error(`[status-cache] watch dirty ${path ?? ""} ${file ?? ""}`);
|
|
31289
31471
|
if (parentPort) {
|
|
@@ -31387,7 +31569,7 @@ function ensureWatchers(paths, recursive, home) {
|
|
|
31387
31569
|
const directlyWatched = hasWatcher(parent) && !parentOnlyWatches.has(parent);
|
|
31388
31570
|
if (!directlyWatched && !paths.includes(parent)) {
|
|
31389
31571
|
const wanted = parentOnlyWatches.get(parent) ?? /* @__PURE__ */ new Set();
|
|
31390
|
-
wanted.add(
|
|
31572
|
+
wanted.add(basename14(path));
|
|
31391
31573
|
parentOnlyWatches.set(parent, wanted);
|
|
31392
31574
|
}
|
|
31393
31575
|
watchOne(parent, false);
|
|
@@ -31488,4 +31670,4 @@ export {
|
|
|
31488
31670
|
hashOnDiskFile,
|
|
31489
31671
|
diffHostPluginView
|
|
31490
31672
|
};
|
|
31491
|
-
//# sourceMappingURL=chunk-
|
|
31673
|
+
//# sourceMappingURL=chunk-QF73VLAW.js.map
|