harnesstap 1.2.0 → 1.3.0
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 +28 -15
- package/dist/apply-QSS4242W.js +67 -0
- package/dist/apply-QSS4242W.js.map +1 -0
- package/dist/approve-CNYQY6DC.js +181 -0
- package/dist/approve-CNYQY6DC.js.map +1 -0
- package/dist/audit-V4SUV7KA.js +434 -0
- package/dist/audit-V4SUV7KA.js.map +1 -0
- package/dist/auth-63FOHIQ3.js +220 -0
- package/dist/auth-63FOHIQ3.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-2NE3QYMP.js +103 -0
- package/dist/chunk-2NE3QYMP.js.map +1 -0
- package/dist/chunk-2P2EOYEW.js +1140 -0
- package/dist/chunk-2P2EOYEW.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-37LQQWMF.js +496 -0
- package/dist/chunk-37LQQWMF.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3PGC6OA3.js +540 -0
- package/dist/chunk-3PGC6OA3.js.map +1 -0
- package/dist/chunk-4IHKBIY3.js +118 -0
- package/dist/chunk-4IHKBIY3.js.map +1 -0
- package/dist/chunk-4ZUBRLSP.js +17 -0
- package/dist/chunk-4ZUBRLSP.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-5TXI6BI2.js +1359 -0
- package/dist/chunk-5TXI6BI2.js.map +1 -0
- package/dist/chunk-6P5IO4BX.js +235 -0
- package/dist/chunk-6P5IO4BX.js.map +1 -0
- package/dist/chunk-ABXUKHAU.js +571 -0
- package/dist/chunk-ABXUKHAU.js.map +1 -0
- package/dist/chunk-AOUDSNRK.js +1357 -0
- package/dist/chunk-AOUDSNRK.js.map +1 -0
- package/dist/chunk-BNDJJAEI.js +311 -0
- package/dist/chunk-BNDJJAEI.js.map +1 -0
- package/dist/chunk-C2IWSFF5.js +818 -0
- package/dist/chunk-C2IWSFF5.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DEJLP7QJ.js +681 -0
- package/dist/chunk-DEJLP7QJ.js.map +1 -0
- package/dist/chunk-DJ6FN6EW.js +532 -0
- package/dist/chunk-DJ6FN6EW.js.map +1 -0
- package/dist/chunk-E4WRTRMH.js +1173 -0
- package/dist/chunk-E4WRTRMH.js.map +1 -0
- package/dist/chunk-E5QXNU3K.js +238 -0
- package/dist/chunk-E5QXNU3K.js.map +1 -0
- package/dist/chunk-EMTBGOR3.js +2959 -0
- package/dist/chunk-EMTBGOR3.js.map +1 -0
- package/dist/chunk-FFWYIGQ4.js +18 -0
- package/dist/chunk-FFWYIGQ4.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IHWAOIAU.js +172 -0
- package/dist/chunk-IHWAOIAU.js.map +1 -0
- package/dist/chunk-IHZUYG66.js +583 -0
- package/dist/chunk-IHZUYG66.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-KCBI6JQC.js +115 -0
- package/dist/chunk-KCBI6JQC.js.map +1 -0
- package/dist/chunk-KDUQMINL.js +60 -0
- package/dist/chunk-KDUQMINL.js.map +1 -0
- package/dist/chunk-KLR2DURP.js +656 -0
- package/dist/chunk-KLR2DURP.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LYQMK6SV.js +87 -0
- package/dist/chunk-LYQMK6SV.js.map +1 -0
- package/dist/chunk-MK3Q37ZN.js +183 -0
- package/dist/chunk-MK3Q37ZN.js.map +1 -0
- package/dist/chunk-MSGAGV7B.js +346 -0
- package/dist/chunk-MSGAGV7B.js.map +1 -0
- package/dist/chunk-MZQRSERO.js +430 -0
- package/dist/chunk-MZQRSERO.js.map +1 -0
- package/dist/chunk-N3WIJXXM.js +691 -0
- package/dist/chunk-N3WIJXXM.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NFYPBTKO.js +302 -0
- package/dist/chunk-NFYPBTKO.js.map +1 -0
- package/dist/chunk-NPO2IG6G.js +491 -0
- package/dist/chunk-NPO2IG6G.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PFUK3HJ4.js +296 -0
- package/dist/chunk-PFUK3HJ4.js.map +1 -0
- package/dist/chunk-PMQ55GDB.js +115 -0
- package/dist/chunk-PMQ55GDB.js.map +1 -0
- package/dist/chunk-QIVE2YFJ.js +514 -0
- package/dist/chunk-QIVE2YFJ.js.map +1 -0
- package/dist/chunk-QKXD3EUF.js +691 -0
- package/dist/chunk-QKXD3EUF.js.map +1 -0
- package/dist/chunk-RNQYUWF6.js +32 -0
- package/dist/chunk-RNQYUWF6.js.map +1 -0
- package/dist/chunk-S2E4SSQV.js +41 -0
- package/dist/chunk-S2E4SSQV.js.map +1 -0
- package/dist/chunk-SN4BXX3B.js +186 -0
- package/dist/chunk-SN4BXX3B.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-T5VRREN4.js +696 -0
- package/dist/chunk-T5VRREN4.js.map +1 -0
- package/dist/chunk-TKBMHZTS.js +10945 -0
- package/dist/chunk-TKBMHZTS.js.map +1 -0
- package/dist/chunk-TNJPTUE4.js +35 -0
- package/dist/chunk-TNJPTUE4.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TXXDMDPN.js +998 -0
- package/dist/chunk-TXXDMDPN.js.map +1 -0
- package/dist/chunk-UWXUBU7V.js +184 -0
- package/dist/chunk-UWXUBU7V.js.map +1 -0
- package/dist/chunk-UYRK2H24.js +141 -0
- package/dist/chunk-UYRK2H24.js.map +1 -0
- package/dist/chunk-V4IXIM3C.js +806 -0
- package/dist/chunk-V4IXIM3C.js.map +1 -0
- package/dist/chunk-VFHVXXP4.js +6438 -0
- package/dist/chunk-VFHVXXP4.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-W7HQ5X3S.js +610 -0
- package/dist/chunk-W7HQ5X3S.js.map +1 -0
- package/dist/chunk-WMSQAFK5.js +65 -0
- package/dist/chunk-WMSQAFK5.js.map +1 -0
- package/dist/chunk-WMYTBJPB.js +364 -0
- package/dist/chunk-WMYTBJPB.js.map +1 -0
- package/dist/chunk-WNLFNCOH.js +7795 -0
- package/dist/chunk-WNLFNCOH.js.map +1 -0
- package/dist/chunk-WRX7CB2M.js +6448 -0
- package/dist/chunk-WRX7CB2M.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-YSXRBUR4.js +682 -0
- package/dist/chunk-YSXRBUR4.js.map +1 -0
- package/dist/chunk-YTC2EG64.js +1759 -0
- package/dist/chunk-YTC2EG64.js.map +1 -0
- package/dist/compile-J3UGQSS3.js +161 -0
- package/dist/compile-J3UGQSS3.js.map +1 -0
- package/dist/config-5BPSZND3.js +438 -0
- package/dist/config-5BPSZND3.js.map +1 -0
- package/dist/doctor-BVFKLJVO.js +111 -0
- package/dist/doctor-BVFKLJVO.js.map +1 -0
- package/dist/environment-3RI5H32O.js +2745 -0
- package/dist/environment-3RI5H32O.js.map +1 -0
- package/dist/github-YFJQVH5K.js +114 -0
- package/dist/github-YFJQVH5K.js.map +1 -0
- package/dist/harness-ECGHPEKA.js +746 -0
- package/dist/harness-ECGHPEKA.js.map +1 -0
- package/dist/help-ELPNPPEM.js +2079 -0
- package/dist/help-ELPNPPEM.js.map +1 -0
- package/dist/help-UL5XLY3I.js +1892 -0
- package/dist/help-UL5XLY3I.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-UJQTDHW7.js +873 -0
- package/dist/init-UJQTDHW7.js.map +1 -0
- package/dist/lock-XUMJ63NZ.js +455 -0
- package/dist/lock-XUMJ63NZ.js.map +1 -0
- package/dist/marketplace-ZUMOLVXE.js +495 -0
- package/dist/marketplace-ZUMOLVXE.js.map +1 -0
- package/dist/mcp-RZA5O2ND.js +202 -0
- package/dist/mcp-RZA5O2ND.js.map +1 -0
- package/dist/migrate-CYQI2FH6.js +1043 -0
- package/dist/migrate-CYQI2FH6.js.map +1 -0
- package/dist/open-AWOAWLKO.js +32 -0
- package/dist/open-AWOAWLKO.js.map +1 -0
- package/dist/pack-2QD5ZUIO.js +99 -0
- package/dist/pack-2QD5ZUIO.js.map +1 -0
- package/dist/plugin-GQSSSFX4.js +64 -0
- package/dist/plugin-GQSSSFX4.js.map +1 -0
- package/dist/plugin-from-project-SIQUFYIO.js +16 -0
- package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
- package/dist/policy-CT4JRCJI.js +105 -0
- package/dist/policy-CT4JRCJI.js.map +1 -0
- package/dist/profile-4JQ6LECP.js +1886 -0
- package/dist/profile-4JQ6LECP.js.map +1 -0
- package/dist/project-JG7QWXRG.js +1392 -0
- package/dist/project-JG7QWXRG.js.map +1 -0
- package/dist/resource-QRMR6CSD.js +555 -0
- package/dist/resource-QRMR6CSD.js.map +1 -0
- package/dist/version-LZ5POOXY.js +17 -0
- package/dist/version-LZ5POOXY.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveHarnessSelection
|
|
3
|
+
} from "./chunk-LYQMK6SV.js";
|
|
4
|
+
import {
|
|
5
|
+
parseHarnessList
|
|
6
|
+
} from "./chunk-37E5M4JX.js";
|
|
7
|
+
import "./chunk-JQOKQKQT.js";
|
|
8
|
+
import "./chunk-3FIWOI3H.js";
|
|
9
|
+
import {
|
|
10
|
+
captureManagedSnapshotState,
|
|
11
|
+
collectManagedSkillPlacements,
|
|
12
|
+
extractHostPluginMaterial,
|
|
13
|
+
flattenUniqueFiles,
|
|
14
|
+
generateFiles,
|
|
15
|
+
getGitOrigin,
|
|
16
|
+
isHostPluginTreePlatform,
|
|
17
|
+
materializeFiles,
|
|
18
|
+
materializeFromSource,
|
|
19
|
+
materializeSkillHubPlan,
|
|
20
|
+
normalizeGitUrl,
|
|
21
|
+
persistWrittenMaterializations,
|
|
22
|
+
pinSkillEmitsToExistingLivePaths,
|
|
23
|
+
planPluginSkillHub,
|
|
24
|
+
portableHarnessesForPluginFanout,
|
|
25
|
+
preferSharedSkillEmits,
|
|
26
|
+
projectNameFromUrl,
|
|
27
|
+
replaceWithRelativeSymlink,
|
|
28
|
+
writeFiles
|
|
29
|
+
} from "./chunk-WNLFNCOH.js";
|
|
30
|
+
import "./chunk-E5QXNU3K.js";
|
|
31
|
+
import {
|
|
32
|
+
shouldUseWizard
|
|
33
|
+
} from "./chunk-NAGAJ5UM.js";
|
|
34
|
+
import {
|
|
35
|
+
initializeSchema
|
|
36
|
+
} from "./chunk-N3WIJXXM.js";
|
|
37
|
+
import "./chunk-TNJPTUE4.js";
|
|
38
|
+
import {
|
|
39
|
+
createSnapshot
|
|
40
|
+
} from "./chunk-KDUQMINL.js";
|
|
41
|
+
import "./chunk-I6XFZLTJ.js";
|
|
42
|
+
import "./chunk-JRFUTIEH.js";
|
|
43
|
+
import {
|
|
44
|
+
getHarnessPreference,
|
|
45
|
+
getProjectByOrigin,
|
|
46
|
+
getProjectHarnessConfig,
|
|
47
|
+
registeredHarnessesOf,
|
|
48
|
+
setHarnessPreference,
|
|
49
|
+
setProjectHarnessConfig,
|
|
50
|
+
uniqueHarnessTargets,
|
|
51
|
+
upsertProject
|
|
52
|
+
} from "./chunk-PFUK3HJ4.js";
|
|
53
|
+
import {
|
|
54
|
+
detectPlatforms,
|
|
55
|
+
dropPluginTranslatedResources,
|
|
56
|
+
getDedicatedSerializerPlatformIds,
|
|
57
|
+
getPlatformSerializer,
|
|
58
|
+
isClaudeLocalMcpResource,
|
|
59
|
+
persistScanResults,
|
|
60
|
+
resourceFingerprint,
|
|
61
|
+
resourceIdentity,
|
|
62
|
+
scanPlatform,
|
|
63
|
+
toPortableEmitResources,
|
|
64
|
+
unionHarnessResources,
|
|
65
|
+
writeHarnessSyncPluginTranslationMarkers
|
|
66
|
+
} from "./chunk-WRX7CB2M.js";
|
|
67
|
+
import "./chunk-MZQRSERO.js";
|
|
68
|
+
import "./chunk-DEJLP7QJ.js";
|
|
69
|
+
import {
|
|
70
|
+
getAllPlatforms,
|
|
71
|
+
isHostPluginPinResource,
|
|
72
|
+
resolveHomeRoot
|
|
73
|
+
} from "./chunk-TKBMHZTS.js";
|
|
74
|
+
import "./chunk-TXXDMDPN.js";
|
|
75
|
+
import "./chunk-C2IWSFF5.js";
|
|
76
|
+
import "./chunk-NPO2IG6G.js";
|
|
77
|
+
import {
|
|
78
|
+
configureCommandGroup
|
|
79
|
+
} from "./chunk-5TXI6BI2.js";
|
|
80
|
+
import {
|
|
81
|
+
parseOutputFormat,
|
|
82
|
+
printJson
|
|
83
|
+
} from "./chunk-TQ2NA4Z4.js";
|
|
84
|
+
import {
|
|
85
|
+
fail,
|
|
86
|
+
formatCommand,
|
|
87
|
+
reportNoGitOrigin
|
|
88
|
+
} from "./chunk-NFYPBTKO.js";
|
|
89
|
+
import {
|
|
90
|
+
formatCount,
|
|
91
|
+
ui
|
|
92
|
+
} from "./chunk-ABXUKHAU.js";
|
|
93
|
+
import "./chunk-2P2EOYEW.js";
|
|
94
|
+
import {
|
|
95
|
+
DEFAULT_PLUGIN_RESOURCE_MODE,
|
|
96
|
+
loadSettings,
|
|
97
|
+
parsePluginResourceMode
|
|
98
|
+
} from "./chunk-VQVUJYYY.js";
|
|
99
|
+
import {
|
|
100
|
+
getDb,
|
|
101
|
+
getHarnesstapDir
|
|
102
|
+
} from "./chunk-KLR2DURP.js";
|
|
103
|
+
|
|
104
|
+
// src/cli/commands/harness.ts
|
|
105
|
+
import { resolve as resolve2 } from "path";
|
|
106
|
+
import { Option } from "commander";
|
|
107
|
+
|
|
108
|
+
// src/services/harness-union-sync.ts
|
|
109
|
+
import { existsSync, statSync } from "fs";
|
|
110
|
+
import { isAbsolute, join as join2, resolve } from "path";
|
|
111
|
+
|
|
112
|
+
// src/services/harness-sync-preview.ts
|
|
113
|
+
function isHostPluginPin(resource) {
|
|
114
|
+
return isHostPluginPinResource({
|
|
115
|
+
type: resource.type,
|
|
116
|
+
metadata: resource.metadata,
|
|
117
|
+
origin_ref: resource.origin_ref ?? ""
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function sliceByIdentity(slice) {
|
|
121
|
+
const byIdentity = /* @__PURE__ */ new Map();
|
|
122
|
+
if (!slice) return byIdentity;
|
|
123
|
+
for (const resource of slice.resources) {
|
|
124
|
+
byIdentity.set(resourceIdentity(resource), resource);
|
|
125
|
+
}
|
|
126
|
+
return byIdentity;
|
|
127
|
+
}
|
|
128
|
+
function sliceSkillNames(slice) {
|
|
129
|
+
const names = /* @__PURE__ */ new Set();
|
|
130
|
+
if (!slice) return names;
|
|
131
|
+
for (const resource of slice.resources) {
|
|
132
|
+
if (resource.type === "skill") names.add(resource.name);
|
|
133
|
+
}
|
|
134
|
+
return names;
|
|
135
|
+
}
|
|
136
|
+
function skipPreviewResource(resource, portable) {
|
|
137
|
+
if (isClaudeLocalMcpResource(resource)) return true;
|
|
138
|
+
if (portable && isHostPluginPin(resource)) return true;
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
function countHarnessSyncChanges(input) {
|
|
142
|
+
const slices = new Map(
|
|
143
|
+
input.slices.map((slice) => [slice.platformId, slice])
|
|
144
|
+
);
|
|
145
|
+
return input.platforms.map((harness) => {
|
|
146
|
+
const slice = slices.get(harness);
|
|
147
|
+
const current = sliceByIdentity(slice);
|
|
148
|
+
const skillNames = sliceSkillNames(slice);
|
|
149
|
+
const portable = !isHostPluginTreePlatform(harness);
|
|
150
|
+
const planned = /* @__PURE__ */ new Set();
|
|
151
|
+
let added = 0;
|
|
152
|
+
let modified = 0;
|
|
153
|
+
let removed = 0;
|
|
154
|
+
const consider = (resource) => {
|
|
155
|
+
if (skipPreviewResource(resource, portable)) return;
|
|
156
|
+
const identity = resourceIdentity(resource);
|
|
157
|
+
if (planned.has(identity)) return;
|
|
158
|
+
planned.add(identity);
|
|
159
|
+
const existing = current.get(identity);
|
|
160
|
+
if (!existing) {
|
|
161
|
+
added += 1;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (resourceFingerprint(existing) !== resourceFingerprint(resource)) {
|
|
165
|
+
modified += 1;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
for (const resource of input.unionResources) {
|
|
169
|
+
consider(resource);
|
|
170
|
+
}
|
|
171
|
+
if (portable) {
|
|
172
|
+
for (const resource of input.extracted.resources) {
|
|
173
|
+
consider(resource);
|
|
174
|
+
}
|
|
175
|
+
for (const skill of input.extracted.skills) {
|
|
176
|
+
const identity = `skill:${skill.name}:`;
|
|
177
|
+
if (planned.has(identity)) continue;
|
|
178
|
+
planned.add(identity);
|
|
179
|
+
if (!skillNames.has(skill.name)) added += 1;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (const [identity, resource] of current) {
|
|
183
|
+
if (skipPreviewResource(resource, portable)) continue;
|
|
184
|
+
if (!planned.has(identity)) removed += 1;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
harness,
|
|
188
|
+
added,
|
|
189
|
+
removed,
|
|
190
|
+
modified,
|
|
191
|
+
changes: added + removed + modified
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/services/instruction-file-links.ts
|
|
197
|
+
import { mkdirSync } from "fs";
|
|
198
|
+
import { basename, dirname, join, relative } from "path";
|
|
199
|
+
var INSTRUCTION_BASENAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
200
|
+
function posixPath(path) {
|
|
201
|
+
return path.replace(/\\/g, "/");
|
|
202
|
+
}
|
|
203
|
+
function instructionBasename(path) {
|
|
204
|
+
return basename(posixPath(path));
|
|
205
|
+
}
|
|
206
|
+
function isInstructionFile(path) {
|
|
207
|
+
return INSTRUCTION_BASENAMES.has(instructionBasename(path));
|
|
208
|
+
}
|
|
209
|
+
function normalizeInstructionContent(content) {
|
|
210
|
+
return content.replace(/\r\n/g, "\n").replace(/\n+$/, "");
|
|
211
|
+
}
|
|
212
|
+
function pickCanonical(group) {
|
|
213
|
+
const agents = group.find((file) => instructionBasename(file.path) === "AGENTS.md");
|
|
214
|
+
if (agents) return agents;
|
|
215
|
+
const first = group[0];
|
|
216
|
+
if (!first) {
|
|
217
|
+
throw new Error("instruction group is empty");
|
|
218
|
+
}
|
|
219
|
+
return first;
|
|
220
|
+
}
|
|
221
|
+
function pairInstructionFiles(files, mode) {
|
|
222
|
+
if (mode === "copy") {
|
|
223
|
+
return { files: [...files], links: [] };
|
|
224
|
+
}
|
|
225
|
+
const instruction = files.filter((file) => isInstructionFile(file.path));
|
|
226
|
+
if (instruction.length < 2) {
|
|
227
|
+
return { files: [...files], links: [] };
|
|
228
|
+
}
|
|
229
|
+
const rest = files.filter((file) => !isInstructionFile(file.path));
|
|
230
|
+
const groups = /* @__PURE__ */ new Map();
|
|
231
|
+
for (const file of instruction) {
|
|
232
|
+
const key = normalizeInstructionContent(file.content);
|
|
233
|
+
const group = groups.get(key) ?? [];
|
|
234
|
+
group.push(file);
|
|
235
|
+
groups.set(key, group);
|
|
236
|
+
}
|
|
237
|
+
const filesOut = [...rest];
|
|
238
|
+
const links = [];
|
|
239
|
+
for (const group of groups.values()) {
|
|
240
|
+
if (group.length === 1) {
|
|
241
|
+
const only = group[0];
|
|
242
|
+
if (only) filesOut.push(only);
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
const canonical = pickCanonical(group);
|
|
246
|
+
filesOut.push(canonical);
|
|
247
|
+
for (const file of group) {
|
|
248
|
+
if (posixPath(file.path) === posixPath(canonical.path)) continue;
|
|
249
|
+
links.push({
|
|
250
|
+
path: posixPath(file.path),
|
|
251
|
+
target: posixPath(canonical.path)
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return { files: filesOut, links };
|
|
256
|
+
}
|
|
257
|
+
function applyInstructionLinks(rootPath, links, mode) {
|
|
258
|
+
if (mode === "copy" || links.length === 0) return;
|
|
259
|
+
for (const link of links) {
|
|
260
|
+
const dest = join(rootPath, link.path);
|
|
261
|
+
const canonical = join(rootPath, link.target);
|
|
262
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
263
|
+
switch (mode) {
|
|
264
|
+
case "symlink": {
|
|
265
|
+
const relativeTarget = relative(dirname(dest), canonical) || basename(canonical);
|
|
266
|
+
replaceWithRelativeSymlink(dest, relativeTarget);
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
case "clone":
|
|
270
|
+
materializeFromSource(dest, canonical, "clone");
|
|
271
|
+
break;
|
|
272
|
+
default: {
|
|
273
|
+
const exhaustive = mode;
|
|
274
|
+
throw new Error(`Unsupported instruction link mode: ${exhaustive}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/services/harness-union-sync.ts
|
|
281
|
+
var HarnessUnionSyncError = class extends Error {
|
|
282
|
+
code;
|
|
283
|
+
constructor(code, message) {
|
|
284
|
+
super(message);
|
|
285
|
+
this.name = "HarnessUnionSyncError";
|
|
286
|
+
this.code = code;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
function resolvePluginResourceMode(override) {
|
|
290
|
+
if (override) return override;
|
|
291
|
+
try {
|
|
292
|
+
return loadSettings(getHarnesstapDir()).harnessSync.pluginResources;
|
|
293
|
+
} catch {
|
|
294
|
+
return DEFAULT_PLUGIN_RESOURCE_MODE;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
function resolveConfiguredSelection(projectRoot) {
|
|
298
|
+
const global = getHarnessPreference();
|
|
299
|
+
if (projectRoot) {
|
|
300
|
+
const gitOrigin = getGitOrigin(projectRoot);
|
|
301
|
+
if (gitOrigin) {
|
|
302
|
+
const project = upsertProject({
|
|
303
|
+
git_origin: normalizeGitUrl(gitOrigin),
|
|
304
|
+
name: projectNameFromUrl(gitOrigin),
|
|
305
|
+
local_path: projectRoot
|
|
306
|
+
});
|
|
307
|
+
const projectConfig = getProjectHarnessConfig(project.id);
|
|
308
|
+
const registered2 = uniqueHarnessTargets(
|
|
309
|
+
projectConfig?.registered_harnesses ?? []
|
|
310
|
+
);
|
|
311
|
+
if (registered2.length > 0) {
|
|
312
|
+
return {
|
|
313
|
+
registered_harnesses: registered2,
|
|
314
|
+
...projectConfig?.cursor_skill_mode ? { cursor_skill_mode: projectConfig.cursor_skill_mode } : {}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const registered = uniqueHarnessTargets(global?.registered_harnesses ?? []);
|
|
320
|
+
if (registered.length === 0) {
|
|
321
|
+
throw new HarnessUnionSyncError(
|
|
322
|
+
"no_registered_harnesses",
|
|
323
|
+
"No harnesses configured. Run ht harness set --harnesses <slugs>."
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
return { registered_harnesses: registered };
|
|
327
|
+
}
|
|
328
|
+
function resourceMtimeMs(rootPath, source) {
|
|
329
|
+
if (!source) return void 0;
|
|
330
|
+
const full = isAbsolute(source) ? source : join2(rootPath, source);
|
|
331
|
+
try {
|
|
332
|
+
if (!existsSync(full)) return void 0;
|
|
333
|
+
return statSync(full).mtimeMs;
|
|
334
|
+
} catch {
|
|
335
|
+
return void 0;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
async function scanConfiguredSlices(platformIds, target, rootPath) {
|
|
339
|
+
const slices = [];
|
|
340
|
+
for (const platformId of platformIds) {
|
|
341
|
+
let resources;
|
|
342
|
+
if (target === "global") {
|
|
343
|
+
const serializer = getPlatformSerializer(platformId);
|
|
344
|
+
const scanned = serializer.scanGlobal ? await serializer.scanGlobal(rootPath) : await serializer.scan(rootPath);
|
|
345
|
+
resources = dropPluginTranslatedResources(rootPath, scanned);
|
|
346
|
+
} else {
|
|
347
|
+
const scan = await scanPlatform(platformId, rootPath);
|
|
348
|
+
resources = scan.resources;
|
|
349
|
+
}
|
|
350
|
+
const mtimesMs = /* @__PURE__ */ new Map();
|
|
351
|
+
for (const resource of resources) {
|
|
352
|
+
const mtime = resourceMtimeMs(rootPath, resource.source);
|
|
353
|
+
if (mtime !== void 0) {
|
|
354
|
+
mtimesMs.set(resourceIdentity(resource), mtime);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
slices.push({ platformId, resources, mtimesMs });
|
|
358
|
+
}
|
|
359
|
+
return slices;
|
|
360
|
+
}
|
|
361
|
+
async function syncConfiguredHarnesses(options = {}) {
|
|
362
|
+
const scope = options.scope ?? "global";
|
|
363
|
+
const target = scope === "global" ? "global" : "project";
|
|
364
|
+
const projectRoot = options.projectRoot ? resolve(options.projectRoot) : void 0;
|
|
365
|
+
const rootPath = target === "global" ? options.homeRoot ?? resolveHomeRoot() : projectRoot ?? resolve(".");
|
|
366
|
+
const selection = resolveConfiguredSelection(
|
|
367
|
+
target === "project" ? rootPath : void 0
|
|
368
|
+
);
|
|
369
|
+
const platforms = uniqueHarnessTargets(selection.registered_harnesses);
|
|
370
|
+
if (platforms.length < 2) {
|
|
371
|
+
throw new HarnessUnionSyncError(
|
|
372
|
+
"need_two_harnesses",
|
|
373
|
+
"Add another harness to sync."
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
const slices = await scanConfiguredSlices(platforms, target, rootPath);
|
|
377
|
+
const unioned = unionHarnessResources(slices, "last-write");
|
|
378
|
+
const emitResources = toPortableEmitResources(unioned.resources);
|
|
379
|
+
const serializeOptions = selection.cursor_skill_mode ? { target, skillCursorMode: selection.cursor_skill_mode } : { target };
|
|
380
|
+
const pluginResourceMode = resolvePluginResourceMode(options.pluginResourceMode);
|
|
381
|
+
const portablePlatforms = portableHarnessesForPluginFanout(platforms);
|
|
382
|
+
const homeRoot = options.homeRoot ?? resolveHomeRoot();
|
|
383
|
+
const previousSkillPlacements = collectManagedSkillPlacements(rootPath);
|
|
384
|
+
const skipSkillNames = new Set(previousSkillPlacements.keys());
|
|
385
|
+
const pinFromPrevious = previousSkillPlacements.size > 0 ? { previousManagedPlacements: previousSkillPlacements } : void 0;
|
|
386
|
+
const generated = await generateFiles(
|
|
387
|
+
emitResources,
|
|
388
|
+
platforms,
|
|
389
|
+
rootPath,
|
|
390
|
+
pinFromPrevious ? { ...serializeOptions, ...pinFromPrevious } : serializeOptions
|
|
391
|
+
);
|
|
392
|
+
const preferred = pinSkillEmitsToExistingLivePaths(
|
|
393
|
+
rootPath,
|
|
394
|
+
preferSharedSkillEmits(generated, platforms, target, { skipSkillNames }),
|
|
395
|
+
platforms,
|
|
396
|
+
target,
|
|
397
|
+
pinFromPrevious
|
|
398
|
+
);
|
|
399
|
+
const extraResults = [];
|
|
400
|
+
let skillHubPlans = [];
|
|
401
|
+
let extracted = {
|
|
402
|
+
skills: [],
|
|
403
|
+
resources: [],
|
|
404
|
+
resourcePlugins: /* @__PURE__ */ new Map()
|
|
405
|
+
};
|
|
406
|
+
if (target === "global" && portablePlatforms.length > 0) {
|
|
407
|
+
const occupied = new Set(unioned.resources.map(resourceIdentity));
|
|
408
|
+
extracted = await extractHostPluginMaterial(
|
|
409
|
+
unioned.resources,
|
|
410
|
+
homeRoot,
|
|
411
|
+
occupied
|
|
412
|
+
);
|
|
413
|
+
if (extracted.resources.length > 0) {
|
|
414
|
+
const extraGenerated = await generateFiles(
|
|
415
|
+
toPortableEmitResources(extracted.resources),
|
|
416
|
+
portablePlatforms,
|
|
417
|
+
rootPath,
|
|
418
|
+
pinFromPrevious ? { ...serializeOptions, ...pinFromPrevious } : serializeOptions
|
|
419
|
+
);
|
|
420
|
+
extraResults.push(
|
|
421
|
+
...pinSkillEmitsToExistingLivePaths(
|
|
422
|
+
rootPath,
|
|
423
|
+
preferSharedSkillEmits(extraGenerated, portablePlatforms, target, {
|
|
424
|
+
skipSkillNames
|
|
425
|
+
}),
|
|
426
|
+
portablePlatforms,
|
|
427
|
+
target,
|
|
428
|
+
pinFromPrevious
|
|
429
|
+
)
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
skillHubPlans = planPluginSkillHub(
|
|
433
|
+
extracted.skills,
|
|
434
|
+
portablePlatforms,
|
|
435
|
+
target
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
const paired = pairInstructionFiles(
|
|
439
|
+
flattenUniqueFiles([...preferred, ...extraResults]),
|
|
440
|
+
pluginResourceMode
|
|
441
|
+
);
|
|
442
|
+
const files = paired.files;
|
|
443
|
+
const filePaths = [
|
|
444
|
+
...files.map((file) => file.path.replace(/\\/g, "/")),
|
|
445
|
+
...paired.links.map((link) => link.path),
|
|
446
|
+
...skillHubPlans.map((plan) => plan.skillMdPath)
|
|
447
|
+
].filter((path, index, all) => all.indexOf(path) === index);
|
|
448
|
+
const harness_changes = countHarnessSyncChanges({
|
|
449
|
+
platforms,
|
|
450
|
+
slices,
|
|
451
|
+
unionResources: unioned.resources,
|
|
452
|
+
extracted
|
|
453
|
+
});
|
|
454
|
+
const payload = {
|
|
455
|
+
registered_harnesses: platforms,
|
|
456
|
+
conflict_policy: "last-write",
|
|
457
|
+
platforms_synced: platforms,
|
|
458
|
+
files_written: filePaths.length,
|
|
459
|
+
harness_changes,
|
|
460
|
+
conflicts: unioned.conflicts,
|
|
461
|
+
files: filePaths,
|
|
462
|
+
plugin_resource_mode: pluginResourceMode,
|
|
463
|
+
surface_warnings: [...preferred, ...extraResults].flatMap(
|
|
464
|
+
(result) => result.surface_warnings ?? []
|
|
465
|
+
)
|
|
466
|
+
};
|
|
467
|
+
if (options.dryRun) {
|
|
468
|
+
return payload;
|
|
469
|
+
}
|
|
470
|
+
let writtenByApply = /* @__PURE__ */ new Set();
|
|
471
|
+
if (target === "project") {
|
|
472
|
+
const gitOrigin = getGitOrigin(rootPath);
|
|
473
|
+
if (gitOrigin) {
|
|
474
|
+
const project = upsertProject({
|
|
475
|
+
git_origin: normalizeGitUrl(gitOrigin),
|
|
476
|
+
name: projectNameFromUrl(gitOrigin),
|
|
477
|
+
local_path: rootPath
|
|
478
|
+
});
|
|
479
|
+
createSnapshot({
|
|
480
|
+
project_id: project.id,
|
|
481
|
+
label: `Before harness sync (${platforms.join(", ")})`,
|
|
482
|
+
state: captureManagedSnapshotState({
|
|
483
|
+
rootPath,
|
|
484
|
+
resources: emitResources,
|
|
485
|
+
generated: preferred
|
|
486
|
+
})
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
writeFiles(files, rootPath);
|
|
490
|
+
} else {
|
|
491
|
+
const materialized = await materializeFiles(files, rootPath, {
|
|
492
|
+
conflictPolicy: "replace"
|
|
493
|
+
});
|
|
494
|
+
writtenByApply = new Set(
|
|
495
|
+
materialized.writtenFiles.map((path) => path.replace(/\\/g, "/"))
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
applyInstructionLinks(rootPath, paired.links, pluginResourceMode);
|
|
499
|
+
materializeSkillHubPlan(rootPath, skillHubPlans, pluginResourceMode);
|
|
500
|
+
await writeHarnessSyncPluginTranslationMarkers({
|
|
501
|
+
rootPath,
|
|
502
|
+
scope: target === "global" ? "global" : "project",
|
|
503
|
+
extracted,
|
|
504
|
+
skillHubPlans,
|
|
505
|
+
extraResults,
|
|
506
|
+
portablePlatforms,
|
|
507
|
+
target,
|
|
508
|
+
serializeOptions
|
|
509
|
+
});
|
|
510
|
+
persistWrittenMaterializations({
|
|
511
|
+
scope: target === "global" ? "global" : "project",
|
|
512
|
+
project_id: null,
|
|
513
|
+
root_path: rootPath,
|
|
514
|
+
platformResults: preferred.map((result) => ({
|
|
515
|
+
platformId: result.platformId,
|
|
516
|
+
files: result.files,
|
|
517
|
+
writtenPaths: result.files.map((file) => file.path.replace(/\\/g, "/")).filter(
|
|
518
|
+
(path) => target === "project" ? filePaths.includes(path) : writtenByApply.has(path)
|
|
519
|
+
)
|
|
520
|
+
}))
|
|
521
|
+
});
|
|
522
|
+
const afterSlices = await scanConfiguredSlices(platforms, target, rootPath);
|
|
523
|
+
persistScanResults(afterSlices, {
|
|
524
|
+
conflictPolicy: "overwrite",
|
|
525
|
+
originRef: rootPath
|
|
526
|
+
});
|
|
527
|
+
return payload;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// src/cli/commands/harness.ts
|
|
531
|
+
var NATIVE_HARNESS_IDS = new Set(getDedicatedSerializerPlatformIds());
|
|
532
|
+
function handleHarnessListCommand(opts = {}) {
|
|
533
|
+
const format = parseOutputFormat(opts.format);
|
|
534
|
+
const platforms = getAllPlatforms().filter(
|
|
535
|
+
(platform) => !opts.supported || NATIVE_HARNESS_IDS.has(platform.id)
|
|
536
|
+
);
|
|
537
|
+
if (format === "json") {
|
|
538
|
+
printJson(
|
|
539
|
+
platforms.map((platform) => ({
|
|
540
|
+
id: platform.id,
|
|
541
|
+
name: platform.name,
|
|
542
|
+
supports: [...platform.supports].sort()
|
|
543
|
+
}))
|
|
544
|
+
);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
const rows = platforms.map((p) => ({
|
|
548
|
+
id: p.id,
|
|
549
|
+
name: p.name,
|
|
550
|
+
supports: [...p.supports].join(", ")
|
|
551
|
+
}));
|
|
552
|
+
ui.table.print({
|
|
553
|
+
columns: [
|
|
554
|
+
{ key: "id", header: "ID", width: 20 },
|
|
555
|
+
{ key: "name", header: "NAME", width: 20 },
|
|
556
|
+
{ key: "supports", header: "SUPPORTS", width: 40 }
|
|
557
|
+
],
|
|
558
|
+
rows,
|
|
559
|
+
summary: `${platforms.length} harnesses`,
|
|
560
|
+
empty: "No harnesses found."
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
async function handleHarnessSetCommand(opts) {
|
|
564
|
+
const db = getDb();
|
|
565
|
+
initializeSchema(db);
|
|
566
|
+
const useWizard = shouldUseWizard({
|
|
567
|
+
interactive: opts.interactive,
|
|
568
|
+
noInteractive: opts.noInteractive,
|
|
569
|
+
missingRequiredArgs: !opts.harnesses && !opts.main && !opts.aliases
|
|
570
|
+
});
|
|
571
|
+
const selection = await resolveHarnessSelection({
|
|
572
|
+
harnesses: parseHarnessList(opts.harnesses),
|
|
573
|
+
main: opts.main,
|
|
574
|
+
aliases: parseHarnessList(opts.aliases),
|
|
575
|
+
nonInteractive: !useWizard,
|
|
576
|
+
current: getHarnessPreference()
|
|
577
|
+
});
|
|
578
|
+
const saved = setHarnessPreference(selection);
|
|
579
|
+
ui.success(
|
|
580
|
+
`Set harness preference ${ui.icons.hint} ${ui.theme.accent(registeredHarnessesOf(saved).join(", "))}`
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
function handleHarnessStatusCommand(opts) {
|
|
584
|
+
const db = getDb();
|
|
585
|
+
initializeSchema(db);
|
|
586
|
+
const format = parseOutputFormat(opts.format);
|
|
587
|
+
const preference = getHarnessPreference();
|
|
588
|
+
if (format === "json") {
|
|
589
|
+
printJson(
|
|
590
|
+
preference ?? {
|
|
591
|
+
registered_harnesses: []
|
|
592
|
+
}
|
|
593
|
+
);
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
if (!preference) {
|
|
597
|
+
ui.dim("No harness preference configured.");
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
ui.panel({
|
|
601
|
+
title: ["HARNESS"],
|
|
602
|
+
rows: [
|
|
603
|
+
["Registered", registeredHarnessesOf(preference).join(", ") || "(none)"],
|
|
604
|
+
[
|
|
605
|
+
"Plugin resources",
|
|
606
|
+
loadSettings(getHarnesstapDir()).harnessSync.pluginResources
|
|
607
|
+
]
|
|
608
|
+
]
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
async function handleHarnessProjectSetCommand(opts) {
|
|
612
|
+
const db = getDb();
|
|
613
|
+
initializeSchema(db);
|
|
614
|
+
const projectRoot = resolve2(opts.project);
|
|
615
|
+
const gitOrigin = getGitOrigin(projectRoot);
|
|
616
|
+
if (!gitOrigin) {
|
|
617
|
+
reportNoGitOrigin(`${formatCommand("harness project set --project . --harnesses claude-code,cursor")}`);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const project = upsertProject({
|
|
621
|
+
git_origin: normalizeGitUrl(gitOrigin),
|
|
622
|
+
name: projectNameFromUrl(gitOrigin),
|
|
623
|
+
local_path: projectRoot
|
|
624
|
+
});
|
|
625
|
+
const useWizard = shouldUseWizard({
|
|
626
|
+
interactive: opts.interactive,
|
|
627
|
+
noInteractive: opts.noInteractive,
|
|
628
|
+
missingRequiredArgs: !opts.harnesses && !opts.main && !opts.aliases
|
|
629
|
+
});
|
|
630
|
+
const selection = await resolveHarnessSelection({
|
|
631
|
+
harnesses: parseHarnessList(opts.harnesses),
|
|
632
|
+
main: opts.main,
|
|
633
|
+
aliases: parseHarnessList(opts.aliases),
|
|
634
|
+
nonInteractive: !useWizard,
|
|
635
|
+
current: getProjectHarnessConfig(project.id),
|
|
636
|
+
detected: detectPlatforms(projectRoot)
|
|
637
|
+
});
|
|
638
|
+
const saved = setProjectHarnessConfig({
|
|
639
|
+
project_id: project.id,
|
|
640
|
+
registered_harnesses: selection.registered_harnesses,
|
|
641
|
+
...opts.materializationStrategy ? {
|
|
642
|
+
materialization_strategy: opts.materializationStrategy === "copy" ? "copy" : "symlink-preferred"
|
|
643
|
+
} : {}
|
|
644
|
+
});
|
|
645
|
+
ui.success(
|
|
646
|
+
`Set project harness preference ${ui.icons.hint} ${ui.theme.accent(registeredHarnessesOf(saved).join(", "))}`
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
async function handleHarnessSyncCommand(opts) {
|
|
650
|
+
const db = getDb();
|
|
651
|
+
initializeSchema(db);
|
|
652
|
+
const format = parseOutputFormat(opts.format);
|
|
653
|
+
const scope = opts.project ? "project" : "global";
|
|
654
|
+
const pluginResourceMode = opts.pluginResources ? parsePluginResourceMode(opts.pluginResources) : void 0;
|
|
655
|
+
try {
|
|
656
|
+
const result = await syncConfiguredHarnesses({
|
|
657
|
+
scope,
|
|
658
|
+
...opts.project ? { projectRoot: resolve2(opts.project) } : {},
|
|
659
|
+
dryRun: opts.dryRun,
|
|
660
|
+
...pluginResourceMode ? { pluginResourceMode } : {}
|
|
661
|
+
});
|
|
662
|
+
if (format === "json") {
|
|
663
|
+
printJson(result);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
const verb = opts.dryRun ? "Would sync" : "Synced";
|
|
667
|
+
ui.success(
|
|
668
|
+
`${verb} ${result.platforms_synced.join(", ")} ${ui.icons.hint} ${formatCount(result.files_written, "file")}`
|
|
669
|
+
);
|
|
670
|
+
if (result.conflicts.length > 0) {
|
|
671
|
+
ui.dim(
|
|
672
|
+
`${formatCount(result.conflicts.length, "conflict")} resolved with last-write (newest on-disk copy)`
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
for (const warning of result.surface_warnings) {
|
|
676
|
+
ui.warn(
|
|
677
|
+
`${warning.harness} surface ${warning.path} is not rematerialized to ${warning.alias_harnesses.join(", ")}: ${warning.message}`
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
} catch (error) {
|
|
681
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
682
|
+
process.exitCode = 1;
|
|
683
|
+
fail(message, {
|
|
684
|
+
hints: [formatCommand("harness set --harnesses <slugs>")]
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
function handleHarnessProjectStatusCommand(opts) {
|
|
689
|
+
const db = getDb();
|
|
690
|
+
initializeSchema(db);
|
|
691
|
+
const format = parseOutputFormat(opts.format);
|
|
692
|
+
const projectRoot = resolve2(opts.project);
|
|
693
|
+
const gitOrigin = getGitOrigin(projectRoot);
|
|
694
|
+
if (!gitOrigin) {
|
|
695
|
+
reportNoGitOrigin(`${formatCommand("harness project status --project .")}`);
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const project = getProjectByOrigin(normalizeGitUrl(gitOrigin));
|
|
699
|
+
const config = project ? getProjectHarnessConfig(project.id) : void 0;
|
|
700
|
+
if (format === "json") {
|
|
701
|
+
printJson(
|
|
702
|
+
config ?? {
|
|
703
|
+
registered_harnesses: [],
|
|
704
|
+
materialization_strategy: "symlink-preferred"
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
if (!config) {
|
|
710
|
+
ui.dim("No project harness preference configured.");
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
ui.panel({
|
|
714
|
+
title: ["HARNESS", "project"],
|
|
715
|
+
rows: [
|
|
716
|
+
["Registered", registeredHarnessesOf(config).join(", ") || "(none)"],
|
|
717
|
+
["Materialization", config.materialization_strategy]
|
|
718
|
+
]
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function registerHarnessCommands(root) {
|
|
722
|
+
const harnessCmd = configureCommandGroup(
|
|
723
|
+
root.command("harness").alias("h").description("Manage the registered harness set")
|
|
724
|
+
);
|
|
725
|
+
harnessCmd.command("list").alias("ls").option("--supported", "Only show natively serialized harnesses").option("--format <mode>", "Output format: human or json", "human").description("List supported harnesses").action(handleHarnessListCommand);
|
|
726
|
+
harnessCmd.command("set").option("--harnesses <slugs>", "Comma-separated registered harness slugs").addOption(new Option("--main <slug>", "Deprecated: prepended to the registered set").hideHelp()).addOption(new Option("--aliases <slugs>", "Deprecated: appended to the registered set").hideHelp()).option("--interactive", "Prompt instead of relying on explicit flags").description("Set global registered harnesses").action(handleHarnessSetCommand);
|
|
727
|
+
harnessCmd.command("status").option("--format <mode>", "Output format: human or json", "human").description("Show global harness preferences").action(handleHarnessStatusCommand);
|
|
728
|
+
harnessCmd.command("sync").option("--project <path>", "Sync a git-backed project instead of home").option("--dry-run", "Show what would be written without writing files").option(
|
|
729
|
+
"--plugin-resources <mode>",
|
|
730
|
+
`How to materialize Cursor/Claude plugin files into .agents: symlink, copy, or clone (default ${DEFAULT_PLUGIN_RESOURCE_MODE}, or harnessSync.pluginResources in config.jsonc)`
|
|
731
|
+
).option("--format <mode>", "Output format: human or json", "human").description(
|
|
732
|
+
"Union resources from registered harnesses and materialize with last-write conflicts"
|
|
733
|
+
).action(handleHarnessSyncCommand);
|
|
734
|
+
const harnessProjectCmd = configureCommandGroup(
|
|
735
|
+
harnessCmd.command("project").description("Manage harness preferences for a git-backed project")
|
|
736
|
+
);
|
|
737
|
+
harnessProjectCmd.command("set").option("--project <path>", "Project directory", ".").option("--harnesses <slugs>", "Comma-separated registered harness slugs").addOption(new Option("--main <slug>", "Deprecated: prepended to the registered set").hideHelp()).addOption(new Option("--aliases <slugs>", "Deprecated: appended to the registered set").hideHelp()).option(
|
|
738
|
+
"--materialization-strategy <strategy>",
|
|
739
|
+
"Materialization strategy: symlink-preferred or copy"
|
|
740
|
+
).option("--interactive", "Prompt instead of relying on explicit flags").description("Set project-scoped registered harnesses").action(handleHarnessProjectSetCommand);
|
|
741
|
+
harnessProjectCmd.command("status").option("--project <path>", "Project directory", ".").option("--format <mode>", "Output format: human or json", "human").description("Show project-scoped harness preferences").action(handleHarnessProjectStatusCommand);
|
|
742
|
+
}
|
|
743
|
+
export {
|
|
744
|
+
registerHarnessCommands
|
|
745
|
+
};
|
|
746
|
+
//# sourceMappingURL=harness-ECGHPEKA.js.map
|