harnesstap 1.3.1 → 1.4.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 +2 -0
- package/dist/apply-SUNDXRJ3.js +54 -0
- package/dist/{approve-KQNCNH2R.js → approve-FBGYQGWN.js} +14 -15
- package/dist/{approve-KQNCNH2R.js.map → approve-FBGYQGWN.js.map} +1 -1
- package/dist/{audit-SLYOZCMI.js → audit-VI4QZ6X2.js} +30 -39
- package/dist/{audit-SLYOZCMI.js.map → audit-VI4QZ6X2.js.map} +1 -1
- package/dist/{auth-3IEVICFT.js → auth-4CQCDS2W.js} +17 -19
- package/dist/{auth-3IEVICFT.js.map → auth-4CQCDS2W.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{chunk-KDDXZBMC.js → chunk-23XSG7LI.js} +7 -11
- package/dist/{chunk-KDDXZBMC.js.map → chunk-23XSG7LI.js.map} +1 -1
- package/dist/{chunk-YDD3ES2K.js → chunk-2A36HWDE.js} +63 -13
- package/dist/chunk-2A36HWDE.js.map +1 -0
- package/dist/{chunk-IK524ZDW.js → chunk-3FS775NP.js} +51 -4
- package/dist/chunk-3FS775NP.js.map +1 -0
- package/dist/{chunk-IBOABSIA.js → chunk-3P6BWL5F.js} +2 -2
- package/dist/{chunk-G26HZZDJ.js → chunk-43BDGVN3.js} +19 -6
- package/dist/chunk-43BDGVN3.js.map +1 -0
- package/dist/{chunk-TYULB6ZY.js → chunk-4ZQ2SCGY.js} +146 -78
- package/dist/chunk-4ZQ2SCGY.js.map +1 -0
- package/dist/{chunk-6BY4BV5G.js → chunk-6LTLYV5D.js} +353 -230
- package/dist/chunk-6LTLYV5D.js.map +1 -0
- package/dist/{chunk-GQKKX7OE.js → chunk-73OJQTBW.js} +6 -2
- package/dist/chunk-73OJQTBW.js.map +1 -0
- package/dist/{chunk-IRU7NBOT.js → chunk-7HP6AAI3.js} +2 -2
- package/dist/{chunk-MWXA4PFE.js → chunk-BPWFQKI5.js} +5 -7
- package/dist/{chunk-MWXA4PFE.js.map → chunk-BPWFQKI5.js.map} +1 -1
- package/dist/{chunk-3RBYT7QN.js → chunk-D432JAXV.js} +44 -19
- package/dist/chunk-D432JAXV.js.map +1 -0
- package/dist/chunk-DF4Z7LAD.js +3463 -0
- package/dist/chunk-DF4Z7LAD.js.map +1 -0
- package/dist/{chunk-J4CKQXQ6.js → chunk-EOPFER6N.js} +71 -318
- package/dist/chunk-EOPFER6N.js.map +1 -0
- package/dist/chunk-G6WKY2W4.js +389 -0
- package/dist/chunk-G6WKY2W4.js.map +1 -0
- package/dist/{chunk-JKGSJGCC.js → chunk-GRASK6M6.js} +5 -5
- package/dist/{chunk-63U7QWNY.js → chunk-IE7B6Q5K.js} +33 -39
- package/dist/chunk-IE7B6Q5K.js.map +1 -0
- package/dist/{chunk-VC6OKCJF.js → chunk-IMROMZ2K.js} +7 -4
- package/dist/{chunk-VC6OKCJF.js.map → chunk-IMROMZ2K.js.map} +1 -1
- package/dist/{chunk-DV74UZJI.js → chunk-L6YZE5MY.js} +3 -3
- package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
- package/dist/chunk-M2U3J7UX.js.map +1 -0
- package/dist/{chunk-BSOBXLYI.js → chunk-M4KLHJ6U.js} +16 -13
- package/dist/chunk-M4KLHJ6U.js.map +1 -0
- package/dist/{chunk-VL7BGD47.js → chunk-MR7IOHSX.js} +16 -19
- package/dist/chunk-MR7IOHSX.js.map +1 -0
- package/dist/{chunk-4KNQZDZC.js → chunk-N3VGY3T3.js} +15 -15
- package/dist/chunk-N3VGY3T3.js.map +1 -0
- package/dist/{chunk-ZY2MZ2KQ.js → chunk-N3ZCH64F.js} +496 -10
- package/dist/chunk-N3ZCH64F.js.map +1 -0
- package/dist/{chunk-H6DVP2SI.js → chunk-OML4HXKT.js} +20 -22
- package/dist/chunk-OML4HXKT.js.map +1 -0
- package/dist/{chunk-NJ7WRKIQ.js → chunk-P2C7JPLD.js} +3 -3
- package/dist/{chunk-LNJ3WZZX.js → chunk-PCMON7Y2.js} +7 -7
- package/dist/{chunk-VL2NWCZV.js → chunk-PNGF5EV2.js} +2 -2
- package/dist/{chunk-SZNBUIDR.js → chunk-QA5U36JN.js} +199 -215
- package/dist/chunk-QA5U36JN.js.map +1 -0
- package/dist/{chunk-KDAV2GUT.js → chunk-R7ZOYVN3.js} +241 -126
- package/dist/chunk-R7ZOYVN3.js.map +1 -0
- package/dist/{chunk-QO4LBDVI.js → chunk-RDG5DT7S.js} +45 -49
- package/dist/{chunk-QO4LBDVI.js.map → chunk-RDG5DT7S.js.map} +1 -1
- package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
- package/dist/chunk-REHRUNBB.js.map +1 -0
- package/dist/{chunk-DXKAKKLP.js → chunk-RFQ3N7FB.js} +19 -29
- package/dist/chunk-RFQ3N7FB.js.map +1 -0
- package/dist/{chunk-C4QBVVEH.js → chunk-RVEXPMM3.js} +3 -3
- package/dist/{chunk-XFZQVYIN.js → chunk-TPEJFLV7.js} +13 -15
- package/dist/{chunk-XFZQVYIN.js.map → chunk-TPEJFLV7.js.map} +1 -1
- package/dist/{chunk-7LWH5SWH.js → chunk-U6DXASQP.js} +2 -2
- package/dist/{chunk-BIBUCC2E.js → chunk-ULCD6DJE.js} +30 -8
- package/dist/chunk-ULCD6DJE.js.map +1 -0
- package/dist/{chunk-KMWHZSEG.js → chunk-UVVZHWD2.js} +2 -2
- package/dist/{chunk-DWVAR4BP.js → chunk-WG5A6EAU.js} +270 -12
- package/dist/chunk-WG5A6EAU.js.map +1 -0
- package/dist/{chunk-QRZPQNLX.js → chunk-WGP4GUYZ.js} +10 -10
- package/dist/{chunk-F2L4VNQK.js → chunk-XTVGCVU4.js} +124 -83
- package/dist/chunk-XTVGCVU4.js.map +1 -0
- package/dist/{chunk-EIWXS4RM.js → chunk-XUJKZQZA.js} +8 -8
- package/dist/chunk-XUJKZQZA.js.map +1 -0
- package/dist/chunk-ZUASVASP.js +30317 -0
- package/dist/chunk-ZUASVASP.js.map +1 -0
- package/dist/{compile-57EEIUMB.js → compile-GXADKGH5.js} +37 -50
- package/dist/{compile-57EEIUMB.js.map → compile-GXADKGH5.js.map} +1 -1
- package/dist/{config-4EJ3D7QJ.js → config-JMHNA2U5.js} +22 -35
- package/dist/{config-4EJ3D7QJ.js.map → config-JMHNA2U5.js.map} +1 -1
- package/dist/cursor-local-install-46RWRBDT.js +98 -0
- package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
- package/dist/{doctor-EEV6P5CH.js → doctor-N7ZULPOL.js} +18 -19
- package/dist/{doctor-EEV6P5CH.js.map → doctor-N7ZULPOL.js.map} +1 -1
- package/dist/{environment-WFEG4DAT.js → environment-OBB3WU5B.js} +60 -71
- package/dist/{environment-WFEG4DAT.js.map → environment-OBB3WU5B.js.map} +1 -1
- package/dist/{github-BSMQD72A.js → github-PBYBGOLH.js} +17 -17
- package/dist/{harness-VX3PNVQW.js → harness-7KYATIV6.js} +56 -67
- package/dist/{harness-VX3PNVQW.js.map → harness-7KYATIV6.js.map} +1 -1
- package/dist/{help-AW2HKX63.js → help-EE3AJQD4.js} +48 -52
- package/dist/help-EE3AJQD4.js.map +1 -0
- package/dist/{help-BVFOZD7E.js → help-VXWKLQ6A.js} +55 -15
- package/dist/help-VXWKLQ6A.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -24
- package/dist/{init-SPN2GEZ4.js → init-LBTMPDVJ.js} +43 -56
- package/dist/init-LBTMPDVJ.js.map +1 -0
- package/dist/live-read-cache-TUSP7U3D.js +10 -0
- package/dist/{lock-K2LLUU7H.js → lock-WLJRXRVK.js} +16 -16
- package/dist/{marketplace-VEKSWGX3.js → marketplace-GXSV6QIY.js} +62 -28
- package/dist/marketplace-GXSV6QIY.js.map +1 -0
- package/dist/{mcp-T6DKIKSF.js → mcp-XPDWWU75.js} +35 -48
- package/dist/{mcp-T6DKIKSF.js.map → mcp-XPDWWU75.js.map} +1 -1
- package/dist/{migrate-OO37WSB2.js → migrate-SBUIWN3U.js} +79 -64
- package/dist/migrate-SBUIWN3U.js.map +1 -0
- package/dist/open-HDGLYYVU.js +24 -0
- package/dist/{pack-V32UPC7W.js → pack-A73LDVOX.js} +16 -22
- package/dist/{pack-V32UPC7W.js.map → pack-A73LDVOX.js.map} +1 -1
- package/dist/plugin-CEO6ZJM5.js +51 -0
- package/dist/plugin-from-project-UK7VJVUP.js +18 -0
- package/dist/{policy-F5MKZNOC.js → policy-6VY3CMSU.js} +13 -14
- package/dist/{policy-F5MKZNOC.js.map → policy-6VY3CMSU.js.map} +1 -1
- package/dist/{profile-H4PMH4XT.js → profile-YCKPMRRU.js} +96 -102
- package/dist/profile-YCKPMRRU.js.map +1 -0
- package/dist/{project-QVNEJJGH.js → project-KHPPBKPN.js} +63 -77
- package/dist/{project-QVNEJJGH.js.map → project-KHPPBKPN.js.map} +1 -1
- package/dist/{resource-GL4RLSGI.js → resource-IJU3FAN5.js} +42 -49
- package/dist/{resource-GL4RLSGI.js.map → resource-IJU3FAN5.js.map} +1 -1
- package/dist/{version-PBHZK44K.js → version-Z66FWWMQ.js} +2 -2
- package/dist/version-Z66FWWMQ.js.map +1 -0
- package/package.json +4 -1
- package/schemas/fixtures/confidence.ap.json +1 -1
- package/schemas/fixtures/context7.ap.json +1 -1
- package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
- package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
- package/schemas/fixtures/superpowers.ap.json +1 -1
- package/schemas/fixtures/third-party-skills.ap.json +1 -1
- package/dist/apply-2GRNKR5H.js +0 -67
- package/dist/chunk-2EIJYDNI.js +0 -10945
- package/dist/chunk-2EIJYDNI.js.map +0 -1
- package/dist/chunk-3IWTJCPA.js +0 -6448
- package/dist/chunk-3IWTJCPA.js.map +0 -1
- package/dist/chunk-3IZ7SEGT.js +0 -346
- package/dist/chunk-3IZ7SEGT.js.map +0 -1
- package/dist/chunk-3RBYT7QN.js.map +0 -1
- package/dist/chunk-4KNQZDZC.js.map +0 -1
- package/dist/chunk-63U7QWNY.js.map +0 -1
- package/dist/chunk-6BY4BV5G.js.map +0 -1
- package/dist/chunk-7L2K4N25.js +0 -610
- package/dist/chunk-7L2K4N25.js.map +0 -1
- package/dist/chunk-BIBUCC2E.js.map +0 -1
- package/dist/chunk-BSOBXLYI.js.map +0 -1
- package/dist/chunk-DWVAR4BP.js.map +0 -1
- package/dist/chunk-DXKAKKLP.js.map +0 -1
- package/dist/chunk-EIWXS4RM.js.map +0 -1
- package/dist/chunk-EWBCFAF3.js +0 -681
- package/dist/chunk-EWBCFAF3.js.map +0 -1
- package/dist/chunk-F2L4VNQK.js.map +0 -1
- package/dist/chunk-G26HZZDJ.js.map +0 -1
- package/dist/chunk-GQKKX7OE.js.map +0 -1
- package/dist/chunk-GRJY22U6.js +0 -691
- package/dist/chunk-GRJY22U6.js.map +0 -1
- package/dist/chunk-H6DVP2SI.js.map +0 -1
- package/dist/chunk-HVVPTCKR.js +0 -1173
- package/dist/chunk-HVVPTCKR.js.map +0 -1
- package/dist/chunk-IK524ZDW.js.map +0 -1
- package/dist/chunk-J4CKQXQ6.js.map +0 -1
- package/dist/chunk-JRFUTIEH.js +0 -426
- package/dist/chunk-JRFUTIEH.js.map +0 -1
- package/dist/chunk-K2BPYEH5.js +0 -491
- package/dist/chunk-K2BPYEH5.js.map +0 -1
- package/dist/chunk-KCQC7YBK.js +0 -7795
- package/dist/chunk-KCQC7YBK.js.map +0 -1
- package/dist/chunk-KDAV2GUT.js.map +0 -1
- package/dist/chunk-MY62SSKC.js +0 -183
- package/dist/chunk-MY62SSKC.js.map +0 -1
- package/dist/chunk-PXU2OS26.js +0 -238
- package/dist/chunk-PXU2OS26.js.map +0 -1
- package/dist/chunk-SNVAMWB7.js.map +0 -1
- package/dist/chunk-SPRVUATR.js +0 -430
- package/dist/chunk-SPRVUATR.js.map +0 -1
- package/dist/chunk-SY7G5QEI.js +0 -35
- package/dist/chunk-SY7G5QEI.js.map +0 -1
- package/dist/chunk-SZNBUIDR.js.map +0 -1
- package/dist/chunk-TYULB6ZY.js.map +0 -1
- package/dist/chunk-UJYFTXHV.js +0 -296
- package/dist/chunk-UJYFTXHV.js.map +0 -1
- package/dist/chunk-VL7BGD47.js.map +0 -1
- package/dist/chunk-VQVUJYYY.js.map +0 -1
- package/dist/chunk-XQFT4PEP.js +0 -60
- package/dist/chunk-XQFT4PEP.js.map +0 -1
- package/dist/chunk-YDD3ES2K.js.map +0 -1
- package/dist/chunk-ZY2MZ2KQ.js.map +0 -1
- package/dist/help-AW2HKX63.js.map +0 -1
- package/dist/help-BVFOZD7E.js.map +0 -1
- package/dist/init-SPN2GEZ4.js.map +0 -1
- package/dist/marketplace-VEKSWGX3.js.map +0 -1
- package/dist/migrate-OO37WSB2.js.map +0 -1
- package/dist/open-3V3QK5RK.js +0 -32
- package/dist/plugin-KOBNQ7GT.js +0 -64
- package/dist/plugin-from-project-X3VO3MB6.js +0 -16
- package/dist/profile-H4PMH4XT.js.map +0 -1
- /package/dist/{apply-2GRNKR5H.js.map → apply-SUNDXRJ3.js.map} +0 -0
- /package/dist/{chunk-IBOABSIA.js.map → chunk-3P6BWL5F.js.map} +0 -0
- /package/dist/{chunk-IRU7NBOT.js.map → chunk-7HP6AAI3.js.map} +0 -0
- /package/dist/{chunk-JKGSJGCC.js.map → chunk-GRASK6M6.js.map} +0 -0
- /package/dist/{chunk-DV74UZJI.js.map → chunk-L6YZE5MY.js.map} +0 -0
- /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-P2C7JPLD.js.map} +0 -0
- /package/dist/{chunk-LNJ3WZZX.js.map → chunk-PCMON7Y2.js.map} +0 -0
- /package/dist/{chunk-VL2NWCZV.js.map → chunk-PNGF5EV2.js.map} +0 -0
- /package/dist/{chunk-C4QBVVEH.js.map → chunk-RVEXPMM3.js.map} +0 -0
- /package/dist/{chunk-7LWH5SWH.js.map → chunk-U6DXASQP.js.map} +0 -0
- /package/dist/{chunk-KMWHZSEG.js.map → chunk-UVVZHWD2.js.map} +0 -0
- /package/dist/{chunk-QRZPQNLX.js.map → chunk-WGP4GUYZ.js.map} +0 -0
- /package/dist/{github-BSMQD72A.js.map → github-PBYBGOLH.js.map} +0 -0
- /package/dist/{open-3V3QK5RK.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
- /package/dist/{lock-K2LLUU7H.js.map → lock-WLJRXRVK.js.map} +0 -0
- /package/dist/{plugin-KOBNQ7GT.js.map → open-HDGLYYVU.js.map} +0 -0
- /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-CEO6ZJM5.js.map} +0 -0
- /package/dist/{version-PBHZK44K.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
package/dist/chunk-3IZ7SEGT.js
DELETED
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
APM_MANIFEST_FILENAME,
|
|
3
|
-
parseApmManifestContents
|
|
4
|
-
} from "./chunk-7L2K4N25.js";
|
|
5
|
-
import {
|
|
6
|
-
parseTransportToml
|
|
7
|
-
} from "./chunk-2EIJYDNI.js";
|
|
8
|
-
|
|
9
|
-
// src/services/project-config.ts
|
|
10
|
-
import { existsSync, readFileSync, statSync } from "fs";
|
|
11
|
-
import { dirname, join, resolve } from "path";
|
|
12
|
-
function isRecord(value) {
|
|
13
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
14
|
-
}
|
|
15
|
-
function resolveWalkRoot(startPath) {
|
|
16
|
-
const absolute = resolve(startPath);
|
|
17
|
-
try {
|
|
18
|
-
if (existsSync(absolute) && statSync(absolute).isFile()) {
|
|
19
|
-
return dirname(absolute);
|
|
20
|
-
}
|
|
21
|
-
} catch {
|
|
22
|
-
}
|
|
23
|
-
return absolute;
|
|
24
|
-
}
|
|
25
|
-
function projectManifestPath(rootPath) {
|
|
26
|
-
return join(rootPath, APM_MANIFEST_FILENAME);
|
|
27
|
-
}
|
|
28
|
-
function locateProjectConfigFile(startPath) {
|
|
29
|
-
let current = resolveWalkRoot(startPath);
|
|
30
|
-
while (true) {
|
|
31
|
-
const configPath = projectManifestPath(current);
|
|
32
|
-
if (existsSync(configPath)) {
|
|
33
|
-
return {
|
|
34
|
-
rootPath: current,
|
|
35
|
-
configPath,
|
|
36
|
-
configDir: join(current, ".harnesstap")
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const parent = dirname(current);
|
|
40
|
-
if (parent === current) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
current = parent;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function parseProfileSource(value, profileName) {
|
|
47
|
-
if (typeof value !== "string") {
|
|
48
|
-
throw new Error(`Profile ${profileName} must include a source string`);
|
|
49
|
-
}
|
|
50
|
-
switch (value) {
|
|
51
|
-
case "catalog":
|
|
52
|
-
case "local":
|
|
53
|
-
case "inline":
|
|
54
|
-
return value;
|
|
55
|
-
default:
|
|
56
|
-
throw new Error(`Unknown profile source for ${profileName}: ${value}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function parseProfileEntry(value, index) {
|
|
60
|
-
if (!isRecord(value)) {
|
|
61
|
-
throw new Error(`Profile at index ${index} must be a table`);
|
|
62
|
-
}
|
|
63
|
-
const name = value.name;
|
|
64
|
-
if (typeof name !== "string" || name.length === 0) {
|
|
65
|
-
throw new Error(`Profile at index ${index} must include a non-empty name`);
|
|
66
|
-
}
|
|
67
|
-
const source = parseProfileSource(value.source, name);
|
|
68
|
-
const environment = typeof value.environment === "string" && value.environment.length > 0 ? value.environment : void 0;
|
|
69
|
-
switch (source) {
|
|
70
|
-
case "catalog": {
|
|
71
|
-
const selector = value.selector;
|
|
72
|
-
if (typeof selector !== "string" || selector.length === 0) {
|
|
73
|
-
throw new Error(`Profile ${name} with catalog source must include a selector`);
|
|
74
|
-
}
|
|
75
|
-
return { name, source, selector, ...environment ? { environment } : {} };
|
|
76
|
-
}
|
|
77
|
-
case "local": {
|
|
78
|
-
const selector = typeof value.selector === "string" && value.selector.length > 0 ? value.selector : name;
|
|
79
|
-
return { name, source, selector, ...environment ? { environment } : {} };
|
|
80
|
-
}
|
|
81
|
-
case "inline": {
|
|
82
|
-
const plugin = value.plugin;
|
|
83
|
-
if (typeof plugin !== "string" || plugin.length === 0) {
|
|
84
|
-
throw new Error(`Profile ${name} with inline source must include a plugin key`);
|
|
85
|
-
}
|
|
86
|
-
return { name, source, plugin, ...environment ? { environment } : {} };
|
|
87
|
-
}
|
|
88
|
-
default: {
|
|
89
|
-
const unhandledSource = source;
|
|
90
|
-
throw new Error(`Unhandled profile source: ${unhandledSource}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function parseSecretProvider(value, environmentName, key) {
|
|
95
|
-
const provider = String(value ?? "env");
|
|
96
|
-
switch (provider) {
|
|
97
|
-
case "keychain":
|
|
98
|
-
case "env":
|
|
99
|
-
case "file":
|
|
100
|
-
return provider;
|
|
101
|
-
default:
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Environment ${environmentName} secret_refs.${key} has unknown provider: ${provider}`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function parseNamedEnvironment(name, value) {
|
|
108
|
-
if (!isRecord(value)) {
|
|
109
|
-
throw new Error(`Environment ${name} must be a mapping`);
|
|
110
|
-
}
|
|
111
|
-
const valuesRaw = value.values;
|
|
112
|
-
const values = {};
|
|
113
|
-
if (valuesRaw !== void 0 && !isRecord(valuesRaw)) {
|
|
114
|
-
throw new Error(`Environment ${name} field values must be a mapping`);
|
|
115
|
-
}
|
|
116
|
-
if (isRecord(valuesRaw)) {
|
|
117
|
-
for (const [key, entry] of Object.entries(valuesRaw)) {
|
|
118
|
-
values[key] = String(entry);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const secretRefsRaw = value.secret_refs;
|
|
122
|
-
const secret_refs = {};
|
|
123
|
-
if (secretRefsRaw !== void 0 && !isRecord(secretRefsRaw)) {
|
|
124
|
-
throw new Error(`Environment ${name} field secret_refs must be a mapping`);
|
|
125
|
-
}
|
|
126
|
-
if (isRecord(secretRefsRaw)) {
|
|
127
|
-
for (const [key, entry] of Object.entries(secretRefsRaw)) {
|
|
128
|
-
if (!isRecord(entry)) {
|
|
129
|
-
throw new Error(`Environment ${name} secret_refs.${key} must be a mapping`);
|
|
130
|
-
}
|
|
131
|
-
secret_refs[key] = {
|
|
132
|
-
provider: parseSecretProvider(entry.provider, name, key),
|
|
133
|
-
ref: String(entry.ref ?? "")
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
name,
|
|
139
|
-
values,
|
|
140
|
-
...Object.keys(secret_refs).length > 0 ? { secret_refs } : {}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
function parsePluginTable(value, index) {
|
|
144
|
-
if (!isRecord(value)) {
|
|
145
|
-
throw new Error(`Plugin at index ${index} must be a table`);
|
|
146
|
-
}
|
|
147
|
-
const name = value.name;
|
|
148
|
-
if (typeof name !== "string" || name.length === 0) {
|
|
149
|
-
throw new Error(`Plugin at index ${index} must include a non-empty name`);
|
|
150
|
-
}
|
|
151
|
-
return { ...value, name };
|
|
152
|
-
}
|
|
153
|
-
function parseOptionalStringField(document, field) {
|
|
154
|
-
const value = document[field];
|
|
155
|
-
if (value === void 0) {
|
|
156
|
-
return void 0;
|
|
157
|
-
}
|
|
158
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
159
|
-
throw new Error(`Project config field ${field} must be a non-empty string when set`);
|
|
160
|
-
}
|
|
161
|
-
return value;
|
|
162
|
-
}
|
|
163
|
-
function parseProfiles(document) {
|
|
164
|
-
const profilesRaw = document.profiles;
|
|
165
|
-
if (profilesRaw === void 0) {
|
|
166
|
-
return [];
|
|
167
|
-
}
|
|
168
|
-
if (!Array.isArray(profilesRaw)) {
|
|
169
|
-
throw new Error("Project config profiles must be an array of tables");
|
|
170
|
-
}
|
|
171
|
-
const profiles = profilesRaw.map(parseProfileEntry);
|
|
172
|
-
const seen = /* @__PURE__ */ new Set();
|
|
173
|
-
for (const profile of profiles) {
|
|
174
|
-
if (seen.has(profile.name)) {
|
|
175
|
-
throw new Error(`Duplicate profile name: ${profile.name}`);
|
|
176
|
-
}
|
|
177
|
-
seen.add(profile.name);
|
|
178
|
-
}
|
|
179
|
-
return profiles;
|
|
180
|
-
}
|
|
181
|
-
function parseEnvironmentBlock(document) {
|
|
182
|
-
const raw = document.environments;
|
|
183
|
-
if (raw === void 0) {
|
|
184
|
-
return { environments: [] };
|
|
185
|
-
}
|
|
186
|
-
if (!isRecord(raw)) {
|
|
187
|
-
throw new Error("Project config field environments must be a mapping");
|
|
188
|
-
}
|
|
189
|
-
let default_environment;
|
|
190
|
-
const environments = [];
|
|
191
|
-
const seen = /* @__PURE__ */ new Set();
|
|
192
|
-
for (const [key, value] of Object.entries(raw)) {
|
|
193
|
-
if (key === "default") {
|
|
194
|
-
if (value === void 0) {
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
198
|
-
throw new Error(
|
|
199
|
-
"Project config field environments.default must be a non-empty string when set"
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
default_environment = value;
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
if (seen.has(key)) {
|
|
206
|
-
throw new Error(`Duplicate environment name: ${key}`);
|
|
207
|
-
}
|
|
208
|
-
seen.add(key);
|
|
209
|
-
environments.push(parseNamedEnvironment(key, value));
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
...default_environment !== void 0 ? { default_environment } : {},
|
|
213
|
-
environments
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
function parsePlugins(document) {
|
|
217
|
-
const pluginsRaw = document.plugins;
|
|
218
|
-
if (pluginsRaw === void 0) {
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
|
-
if (!Array.isArray(pluginsRaw)) {
|
|
222
|
-
throw new Error("Project config plugins must be an array of tables");
|
|
223
|
-
}
|
|
224
|
-
return pluginsRaw.map(parsePluginTable);
|
|
225
|
-
}
|
|
226
|
-
function projectConfigFromTomlDocument(document) {
|
|
227
|
-
const default_profile = parseOptionalStringField(document, "default_profile");
|
|
228
|
-
const parsedEnvironment = parseEnvironmentBlock(document);
|
|
229
|
-
return {
|
|
230
|
-
...default_profile !== void 0 ? { default_profile } : {},
|
|
231
|
-
...parsedEnvironment,
|
|
232
|
-
profiles: parseProfiles(document),
|
|
233
|
-
plugins: parsePlugins(document)
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
function parseResolvedProjectConfig(filePath, rootPath) {
|
|
237
|
-
const raw = readFileSync(filePath, "utf-8");
|
|
238
|
-
const fields = parseApmManifestContents(raw, filePath, rootPath);
|
|
239
|
-
const config = projectConfigFromTomlDocument(fields.vendor);
|
|
240
|
-
return {
|
|
241
|
-
...config,
|
|
242
|
-
apm_name: fields.name,
|
|
243
|
-
apm_version: fields.version,
|
|
244
|
-
...fields.description ? { apm_description: fields.description } : {},
|
|
245
|
-
...Object.keys(fields.rest).length > 0 ? { apm_document: fields.rest } : {},
|
|
246
|
-
harnessTargets: fields.harnessTargets,
|
|
247
|
-
skippedTargets: fields.skippedTargets,
|
|
248
|
-
apmDependencies: fields.apmDependencies,
|
|
249
|
-
mcpDependencies: fields.mcpDependencies,
|
|
250
|
-
...fields.policyPin ? { policyPin: fields.policyPin } : {},
|
|
251
|
-
...fields.overlay ? { overlay: fields.overlay } : {},
|
|
252
|
-
...fields.compilation ? { compilation: fields.compilation } : {},
|
|
253
|
-
warnings: fields.warnings
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
function mergeProjectConfigLocalOverrides(config, configDir) {
|
|
257
|
-
const localPath = join(configDir, "local.toml");
|
|
258
|
-
if (!existsSync(localPath)) {
|
|
259
|
-
return config;
|
|
260
|
-
}
|
|
261
|
-
const raw = readFileSync(localPath, "utf-8");
|
|
262
|
-
const document = parseTransportToml(raw, "project local overrides");
|
|
263
|
-
const default_profile = parseOptionalStringField(document, "default_profile");
|
|
264
|
-
const default_environment = parseOptionalStringField(document, "default_environment");
|
|
265
|
-
return {
|
|
266
|
-
...config,
|
|
267
|
-
...default_profile !== void 0 ? { default_profile } : {},
|
|
268
|
-
...default_environment !== void 0 ? { default_environment } : {}
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function findProjectConfig(startPath) {
|
|
272
|
-
const located = locateProjectConfigFile(startPath);
|
|
273
|
-
if (!located) {
|
|
274
|
-
return null;
|
|
275
|
-
}
|
|
276
|
-
const parsed = parseResolvedProjectConfig(located.configPath, located.rootPath);
|
|
277
|
-
const merged = mergeProjectConfigLocalOverrides(parsed, located.configDir);
|
|
278
|
-
return {
|
|
279
|
-
...parsed,
|
|
280
|
-
...merged,
|
|
281
|
-
rootPath: located.rootPath,
|
|
282
|
-
configPath: located.configPath,
|
|
283
|
-
harnessTargets: parsed.harnessTargets,
|
|
284
|
-
skippedTargets: parsed.skippedTargets,
|
|
285
|
-
apmDependencies: parsed.apmDependencies,
|
|
286
|
-
mcpDependencies: parsed.mcpDependencies,
|
|
287
|
-
warnings: parsed.warnings,
|
|
288
|
-
...parsed.overlay ? { overlay: parsed.overlay } : {},
|
|
289
|
-
...parsed.compilation ? { compilation: parsed.compilation } : {}
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
function getProfileEntry(config, profileKey) {
|
|
293
|
-
const entry = config.profiles.find((profile) => profile.name === profileKey);
|
|
294
|
-
if (!entry) {
|
|
295
|
-
throw new Error(`Unknown profile: ${profileKey}`);
|
|
296
|
-
}
|
|
297
|
-
return entry;
|
|
298
|
-
}
|
|
299
|
-
function resolveProfileEnvironment(config, entry) {
|
|
300
|
-
if (entry.environment) {
|
|
301
|
-
return entry.environment;
|
|
302
|
-
}
|
|
303
|
-
return config.default_environment;
|
|
304
|
-
}
|
|
305
|
-
function validateProjectConfig(config) {
|
|
306
|
-
const errors = [];
|
|
307
|
-
const profileNames = new Set(config.profiles.map((profile) => profile.name));
|
|
308
|
-
const environmentNames = new Set(config.environments.map((environment) => environment.name));
|
|
309
|
-
const pluginNames = new Set(config.plugins.map((plugin) => plugin.name));
|
|
310
|
-
if (config.default_profile && !profileNames.has(config.default_profile)) {
|
|
311
|
-
errors.push(`default_profile references unknown profile: ${config.default_profile}`);
|
|
312
|
-
}
|
|
313
|
-
if (config.default_environment && !environmentNames.has(config.default_environment)) {
|
|
314
|
-
errors.push(
|
|
315
|
-
`environments.default references unknown environment: ${config.default_environment}`
|
|
316
|
-
);
|
|
317
|
-
}
|
|
318
|
-
for (const profile of config.profiles) {
|
|
319
|
-
if (profile.environment && !environmentNames.has(profile.environment)) {
|
|
320
|
-
errors.push(
|
|
321
|
-
`Profile ${profile.name} references unknown environment: ${profile.environment}`
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
if (profile.source === "inline") {
|
|
325
|
-
const pluginKey = profile.plugin;
|
|
326
|
-
if (!pluginKey || !pluginNames.has(pluginKey)) {
|
|
327
|
-
errors.push(
|
|
328
|
-
`Profile ${profile.name} with inline source references unknown plugin: ${pluginKey ?? "(missing)"}`
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return {
|
|
334
|
-
valid: errors.length === 0,
|
|
335
|
-
errors
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
export {
|
|
340
|
-
projectManifestPath,
|
|
341
|
-
findProjectConfig,
|
|
342
|
-
getProfileEntry,
|
|
343
|
-
resolveProfileEnvironment,
|
|
344
|
-
validateProjectConfig
|
|
345
|
-
};
|
|
346
|
-
//# sourceMappingURL=chunk-3IZ7SEGT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/project-config.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type { DeckJsonEnvironment, DeckJsonEnvironmentSecretRef, DeckJsonSecretProvider } from \"../types.js\";\nimport type { ParsedApmDependency, ParsedMcpDependency } from \"./apm-dependencies.js\";\nimport {\n APM_MANIFEST_FILENAME,\n parseApmManifestContents,\n type ApmCompilationConfig,\n} from \"./apm-manifest.js\";\nimport type { ApmPolicyPin } from \"./apm-policy.js\";\nimport type { ApmOverlayInfo } from \"./apm-overlay.js\";\nimport { parseTransportToml } from \"./toml/read.js\";\n\nexport type ProjectProfileSource = \"catalog\" | \"local\" | \"inline\";\n\nexport interface ProjectProfileEntry {\n name: string;\n source: ProjectProfileSource;\n selector?: string;\n plugin?: string;\n environment?: string;\n}\n\nexport type ProjectPluginTable = Record<string, unknown> & { name: string };\n\nexport interface ProjectConfig {\n default_profile?: string;\n default_environment?: string;\n profiles: ProjectProfileEntry[];\n environments: DeckJsonEnvironment[];\n plugins: ProjectPluginTable[];\n apm_name?: string;\n apm_version?: string;\n apm_description?: string;\n apm_document?: Record<string, unknown>;\n}\n\nexport interface ResolvedProjectConfig extends ProjectConfig {\n rootPath: string;\n configPath: string;\n harnessTargets: string[];\n skippedTargets: string[];\n apmDependencies: ParsedApmDependency[];\n mcpDependencies: ParsedMcpDependency[];\n policyPin?: ApmPolicyPin;\n overlay?: ApmOverlayInfo;\n compilation?: ApmCompilationConfig;\n warnings: string[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction resolveWalkRoot(startPath: string): string {\n const absolute = resolve(startPath);\n try {\n if (existsSync(absolute) && statSync(absolute).isFile()) {\n return dirname(absolute);\n }\n } catch {\n // Fall through to treat the path as a directory.\n }\n return absolute;\n}\n\nexport function projectManifestPath(rootPath: string): string {\n return join(rootPath, APM_MANIFEST_FILENAME);\n}\n\nfunction locateProjectConfigFile(\n startPath: string,\n): { rootPath: string; configPath: string; configDir: string } | null {\n let current = resolveWalkRoot(startPath);\n\n while (true) {\n const configPath = projectManifestPath(current);\n if (existsSync(configPath)) {\n return {\n rootPath: current,\n configPath,\n configDir: join(current, \".harnesstap\"),\n };\n }\n\n const parent = dirname(current);\n if (parent === current) {\n return null;\n }\n current = parent;\n }\n}\n\nfunction parseProfileSource(value: unknown, profileName: string): ProjectProfileSource {\n if (typeof value !== \"string\") {\n throw new Error(`Profile ${profileName} must include a source string`);\n }\n switch (value) {\n case \"catalog\":\n case \"local\":\n case \"inline\":\n return value;\n default:\n throw new Error(`Unknown profile source for ${profileName}: ${value}`);\n }\n}\n\nfunction parseProfileEntry(value: unknown, index: number): ProjectProfileEntry {\n if (!isRecord(value)) {\n throw new Error(`Profile at index ${index} must be a table`);\n }\n\n const name = value.name;\n if (typeof name !== \"string\" || name.length === 0) {\n throw new Error(`Profile at index ${index} must include a non-empty name`);\n }\n\n const source = parseProfileSource(value.source, name);\n const environment =\n typeof value.environment === \"string\" && value.environment.length > 0\n ? value.environment\n : undefined;\n\n switch (source) {\n case \"catalog\": {\n const selector = value.selector;\n if (typeof selector !== \"string\" || selector.length === 0) {\n throw new Error(`Profile ${name} with catalog source must include a selector`);\n }\n return { name, source, selector, ...(environment ? { environment } : {}) };\n }\n case \"local\": {\n const selector =\n typeof value.selector === \"string\" && value.selector.length > 0\n ? value.selector\n : name;\n return { name, source, selector, ...(environment ? { environment } : {}) };\n }\n case \"inline\": {\n const plugin = value.plugin;\n if (typeof plugin !== \"string\" || plugin.length === 0) {\n throw new Error(`Profile ${name} with inline source must include a plugin key`);\n }\n return { name, source, plugin, ...(environment ? { environment } : {}) };\n }\n default: {\n const unhandledSource: never = source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction parseSecretProvider(\n value: unknown,\n environmentName: string,\n key: string,\n): DeckJsonSecretProvider {\n const provider = String(value ?? \"env\");\n switch (provider) {\n case \"keychain\":\n case \"env\":\n case \"file\":\n return provider;\n default:\n throw new Error(\n `Environment ${environmentName} secret_refs.${key} has unknown provider: ${provider}`,\n );\n }\n}\n\nfunction parseNamedEnvironment(name: string, value: unknown): DeckJsonEnvironment {\n if (!isRecord(value)) {\n throw new Error(`Environment ${name} must be a mapping`);\n }\n\n const valuesRaw = value.values;\n const values: Record<string, string> = {};\n if (valuesRaw !== undefined && !isRecord(valuesRaw)) {\n throw new Error(`Environment ${name} field values must be a mapping`);\n }\n if (isRecord(valuesRaw)) {\n for (const [key, entry] of Object.entries(valuesRaw)) {\n values[key] = String(entry);\n }\n }\n\n const secretRefsRaw = value.secret_refs;\n const secret_refs: Record<string, DeckJsonEnvironmentSecretRef> = {};\n if (secretRefsRaw !== undefined && !isRecord(secretRefsRaw)) {\n throw new Error(`Environment ${name} field secret_refs must be a mapping`);\n }\n if (isRecord(secretRefsRaw)) {\n for (const [key, entry] of Object.entries(secretRefsRaw)) {\n if (!isRecord(entry)) {\n throw new Error(`Environment ${name} secret_refs.${key} must be a mapping`);\n }\n secret_refs[key] = {\n provider: parseSecretProvider(entry.provider, name, key),\n ref: String(entry.ref ?? \"\"),\n };\n }\n }\n\n return {\n name,\n values,\n ...(Object.keys(secret_refs).length > 0 ? { secret_refs } : {}),\n };\n}\n\nfunction parsePluginTable(value: unknown, index: number): ProjectPluginTable {\n if (!isRecord(value)) {\n throw new Error(`Plugin at index ${index} must be a table`);\n }\n\n const name = value.name;\n if (typeof name !== \"string\" || name.length === 0) {\n throw new Error(`Plugin at index ${index} must include a non-empty name`);\n }\n\n return { ...value, name };\n}\n\nfunction parseOptionalStringField(\n document: Record<string, unknown>,\n field: \"default_profile\" | \"default_environment\",\n): string | undefined {\n const value = document[field];\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(`Project config field ${field} must be a non-empty string when set`);\n }\n return value;\n}\n\nfunction parseProfiles(document: Record<string, unknown>): ProjectProfileEntry[] {\n const profilesRaw = document.profiles;\n if (profilesRaw === undefined) {\n return [];\n }\n if (!Array.isArray(profilesRaw)) {\n throw new Error(\"Project config profiles must be an array of tables\");\n }\n\n const profiles = profilesRaw.map(parseProfileEntry);\n const seen = new Set<string>();\n for (const profile of profiles) {\n if (seen.has(profile.name)) {\n throw new Error(`Duplicate profile name: ${profile.name}`);\n }\n seen.add(profile.name);\n }\n return profiles;\n}\n\nfunction parseEnvironmentBlock(document: Record<string, unknown>): {\n default_environment?: string;\n environments: DeckJsonEnvironment[];\n} {\n const raw = document.environments;\n if (raw === undefined) {\n return { environments: [] };\n }\n if (!isRecord(raw)) {\n throw new Error(\"Project config field environments must be a mapping\");\n }\n\n let default_environment: string | undefined;\n const environments: DeckJsonEnvironment[] = [];\n const seen = new Set<string>();\n\n for (const [key, value] of Object.entries(raw)) {\n if (key === \"default\") {\n if (value === undefined) {\n continue;\n }\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(\n \"Project config field environments.default must be a non-empty string when set\",\n );\n }\n default_environment = value;\n continue;\n }\n if (seen.has(key)) {\n throw new Error(`Duplicate environment name: ${key}`);\n }\n seen.add(key);\n environments.push(parseNamedEnvironment(key, value));\n }\n\n return {\n ...(default_environment !== undefined ? { default_environment } : {}),\n environments,\n };\n}\n\nfunction parsePlugins(document: Record<string, unknown>): ProjectPluginTable[] {\n const pluginsRaw = document.plugins;\n if (pluginsRaw === undefined) {\n return [];\n }\n if (!Array.isArray(pluginsRaw)) {\n throw new Error(\"Project config plugins must be an array of tables\");\n }\n return pluginsRaw.map(parsePluginTable);\n}\n\nexport function projectConfigFromTomlDocument(document: Record<string, unknown>): ProjectConfig {\n const default_profile = parseOptionalStringField(document, \"default_profile\");\n const parsedEnvironment = parseEnvironmentBlock(document);\n\n return {\n ...(default_profile !== undefined ? { default_profile } : {}),\n ...parsedEnvironment,\n profiles: parseProfiles(document),\n plugins: parsePlugins(document),\n };\n}\n\nexport function parseProjectConfigContents(\n raw: string,\n filePath: string,\n rootPath?: string,\n): ProjectConfig {\n const fields = parseApmManifestContents(raw, filePath, rootPath);\n const config = projectConfigFromTomlDocument(fields.vendor);\n return {\n ...config,\n apm_name: fields.name,\n apm_version: fields.version,\n ...(fields.description ? { apm_description: fields.description } : {}),\n ...(Object.keys(fields.rest).length > 0 ? { apm_document: fields.rest } : {}),\n };\n}\n\nexport function parseProjectConfigFile(filePath: string, rootPath?: string): ProjectConfig {\n return parseProjectConfigContents(readFileSync(filePath, \"utf-8\"), filePath, rootPath);\n}\n\nexport function locateProjectManifest(\n startPath: string,\n): { rootPath: string; configPath: string } | null {\n const located = locateProjectConfigFile(startPath);\n if (!located) {\n return null;\n }\n return { rootPath: located.rootPath, configPath: located.configPath };\n}\n\nfunction parseResolvedProjectConfig(\n filePath: string,\n rootPath: string,\n): Omit<ResolvedProjectConfig, \"rootPath\" | \"configPath\"> {\n const raw = readFileSync(filePath, \"utf-8\");\n const fields = parseApmManifestContents(raw, filePath, rootPath);\n const config = projectConfigFromTomlDocument(fields.vendor);\n return {\n ...config,\n apm_name: fields.name,\n apm_version: fields.version,\n ...(fields.description ? { apm_description: fields.description } : {}),\n ...(Object.keys(fields.rest).length > 0 ? { apm_document: fields.rest } : {}),\n harnessTargets: fields.harnessTargets,\n skippedTargets: fields.skippedTargets,\n apmDependencies: fields.apmDependencies,\n mcpDependencies: fields.mcpDependencies,\n ...(fields.policyPin ? { policyPin: fields.policyPin } : {}),\n ...(fields.overlay ? { overlay: fields.overlay } : {}),\n ...(fields.compilation ? { compilation: fields.compilation } : {}),\n warnings: fields.warnings,\n };\n}\n\nexport function mergeProjectConfigLocalOverrides(\n config: ProjectConfig,\n configDir: string,\n): ProjectConfig {\n const localPath = join(configDir, \"local.toml\");\n if (!existsSync(localPath)) {\n return config;\n }\n\n const raw = readFileSync(localPath, \"utf-8\");\n const document = parseTransportToml(raw, \"project local overrides\");\n const default_profile = parseOptionalStringField(document, \"default_profile\");\n const default_environment = parseOptionalStringField(document, \"default_environment\");\n\n return {\n ...config,\n ...(default_profile !== undefined ? { default_profile } : {}),\n ...(default_environment !== undefined ? { default_environment } : {}),\n };\n}\n\nexport function findProjectConfig(startPath: string): ResolvedProjectConfig | null {\n const located = locateProjectConfigFile(startPath);\n if (!located) {\n return null;\n }\n\n const parsed = parseResolvedProjectConfig(located.configPath, located.rootPath);\n const merged = mergeProjectConfigLocalOverrides(parsed, located.configDir);\n\n return {\n ...parsed,\n ...merged,\n rootPath: located.rootPath,\n configPath: located.configPath,\n harnessTargets: parsed.harnessTargets,\n skippedTargets: parsed.skippedTargets,\n apmDependencies: parsed.apmDependencies,\n mcpDependencies: parsed.mcpDependencies,\n warnings: parsed.warnings,\n ...(parsed.overlay ? { overlay: parsed.overlay } : {}),\n ...(parsed.compilation ? { compilation: parsed.compilation } : {}),\n };\n}\n\nexport function getProfileEntry(\n config: ProjectConfig,\n profileKey: string,\n): ProjectProfileEntry {\n const entry = config.profiles.find((profile) => profile.name === profileKey);\n if (!entry) {\n throw new Error(`Unknown profile: ${profileKey}`);\n }\n return entry;\n}\n\nexport function resolveProfileEnvironment(\n config: ProjectConfig,\n entry: ProjectProfileEntry,\n): string | undefined {\n if (entry.environment) {\n return entry.environment;\n }\n return config.default_environment;\n}\n\nexport interface ProjectConfigValidationResult {\n valid: boolean;\n errors: string[];\n}\n\nexport function validateProjectConfig(config: ProjectConfig): ProjectConfigValidationResult {\n const errors: string[] = [];\n const profileNames = new Set(config.profiles.map((profile) => profile.name));\n const environmentNames = new Set(config.environments.map((environment) => environment.name));\n const pluginNames = new Set(config.plugins.map((plugin) => plugin.name));\n\n if (config.default_profile && !profileNames.has(config.default_profile)) {\n errors.push(`default_profile references unknown profile: ${config.default_profile}`);\n }\n\n if (config.default_environment && !environmentNames.has(config.default_environment)) {\n errors.push(\n `environments.default references unknown environment: ${config.default_environment}`,\n );\n }\n\n for (const profile of config.profiles) {\n if (profile.environment && !environmentNames.has(profile.environment)) {\n errors.push(\n `Profile ${profile.name} references unknown environment: ${profile.environment}`,\n );\n }\n\n if (profile.source === \"inline\") {\n const pluginKey = profile.plugin;\n if (!pluginKey || !pluginNames.has(pluginKey)) {\n errors.push(\n `Profile ${profile.name} with inline source references unknown plugin: ${pluginKey ?? \"(missing)\"}`,\n );\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n\nexport function evaluateProjectConfigContents(\n raw: string,\n filePath: string,\n rootPath: string,\n):\n | { ok: true; config: ProjectConfig; validation: ProjectConfigValidationResult }\n | { ok: false; errors: string[] } {\n try {\n const config = parseProjectConfigContents(raw, filePath, rootPath);\n const validation = validateProjectConfig(config);\n if (!validation.valid) {\n return { ok: false, errors: validation.errors };\n }\n return { ok: true, config, validation };\n } catch (error) {\n return {\n ok: false,\n errors: [error instanceof Error ? error.message : String(error)],\n };\n }\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,SAAS,MAAM,eAAe;AAiDvC,SAAS,SAAS,OAAkD;AAClE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,gBAAgB,WAA2B;AAClD,QAAM,WAAW,QAAQ,SAAS;AAClC,MAAI;AACF,QAAI,WAAW,QAAQ,KAAK,SAAS,QAAQ,EAAE,OAAO,GAAG;AACvD,aAAO,QAAQ,QAAQ;AAAA,IACzB;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAEO,SAAS,oBAAoB,UAA0B;AAC5D,SAAO,KAAK,UAAU,qBAAqB;AAC7C;AAEA,SAAS,wBACP,WACoE;AACpE,MAAI,UAAU,gBAAgB,SAAS;AAEvC,SAAO,MAAM;AACX,UAAM,aAAa,oBAAoB,OAAO;AAC9C,QAAI,WAAW,UAAU,GAAG;AAC1B,aAAO;AAAA,QACL,UAAU;AAAA,QACV;AAAA,QACA,WAAW,KAAK,SAAS,aAAa;AAAA,MACxC;AAAA,IACF;AAEA,UAAM,SAAS,QAAQ,OAAO;AAC9B,QAAI,WAAW,SAAS;AACtB,aAAO;AAAA,IACT;AACA,cAAU;AAAA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,aAAa,IAAI,CAAC,gBAAgB,YAAY,IAAI,CAAC;AAC3F,QAAM,cAAc,IAAI,IAAI,OAAO,QAAQ,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC;AAEvE,MAAI,OAAO,mBAAmB,CAAC,aAAa,IAAI,OAAO,eAAe,GAAG;AACvE,WAAO,KAAK,+CAA+C,OAAO,eAAe,EAAE;AAAA,EACrF;AAEA,MAAI,OAAO,uBAAuB,CAAC,iBAAiB,IAAI,OAAO,mBAAmB,GAAG;AACnF,WAAO;AAAA,MACL,wDAAwD,OAAO,mBAAmB;AAAA,IACpF;AAAA,EACF;AAEA,aAAW,WAAW,OAAO,UAAU;AACrC,QAAI,QAAQ,eAAe,CAAC,iBAAiB,IAAI,QAAQ,WAAW,GAAG;AACrE,aAAO;AAAA,QACL,WAAW,QAAQ,IAAI,oCAAoC,QAAQ,WAAW;AAAA,MAChF;AAAA,IACF;AAEA,QAAI,QAAQ,WAAW,UAAU;AAC/B,YAAM,YAAY,QAAQ;AAC1B,UAAI,CAAC,aAAa,CAAC,YAAY,IAAI,SAAS,GAAG;AAC7C,eAAO;AAAA,UACL,WAAW,QAAQ,IAAI,kDAAkD,aAAa,WAAW;AAAA,QACnG;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO,OAAO,WAAW;AAAA,IACzB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/handlers/resource-list.ts","../src/services/resource-show.ts","../src/services/plugin-resource-show.ts","../src/services/host-marketplaces.ts"],"sourcesContent":["import type { ResourceType } from \"../../types.js\";\nimport { RESOURCE_TYPES } from \"../../types.js\";\nimport { ui } from \"../../ui/index.js\";\nimport type { Column } from \"../../ui/table.js\";\nimport { parseOutputFormat } from \"../../utils/output-format.js\";\nimport { shouldUseWizard } from \"../../services/wizards/shared.js\";\n\nexport function makeResourceTypeColumn(width = 14): Column {\n return {\n key: \"type\",\n header: \"TYPE\",\n width,\n style: (value) => ui.theme.resourceType(value),\n };\n}\n\nexport function isPluginAttachmentOnlyType(type: string | undefined): boolean {\n if (!type) {\n return false;\n }\n return type === \"plugin\";\n}\n\nexport function resolveResourceListType(\n positionalType?: string,\n flagType?: string,\n): ResourceType | undefined | \"invalid\" | \"conflict\" {\n if (positionalType && flagType && positionalType !== flagType) {\n return \"conflict\";\n }\n const type = positionalType ?? flagType;\n if (!type) {\n return undefined;\n }\n const normalized = type === \"plugin_pin\" ? \"plugin\" : type;\n if (!RESOURCE_TYPES.includes(normalized as ResourceType)) {\n return \"invalid\";\n }\n return normalized as ResourceType;\n}\n\nexport function shouldUseInteractiveResourceList(input: {\n noInteractive?: boolean;\n format?: string;\n search?: string;\n}): boolean {\n if (input.search) {\n return false;\n }\n\n return shouldUseWizard({\n interactive: true,\n noInteractive: input.noInteractive,\n format: parseOutputFormat(input.format),\n missingRequiredArgs: true,\n });\n}\n\nexport function resourceListRenderOptions(opts: {\n showId?: boolean;\n all?: boolean;\n}): { showId: boolean; showAll: boolean } {\n return {\n showId: Boolean(opts.showId),\n showAll: Boolean(opts.all),\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport type { Resource } from \"../types.js\";\nimport { formatRelativeTimeWithAbsolute } from \"../ui/format.js\";\nimport { renderPanel } from \"../ui/panel.js\";\nimport {\n formatOriginDisplayLabel,\n formatResourceDisplayName,\n packageDirectoryDisplayPath,\n resourceHumanName,\n} from \"../ui/resource-display.js\";\nimport { renderSubheader } from \"../ui/section.js\";\nimport {\n type PluginContainedResource,\n packageResourceShowExtras,\n pluginResourceShowExtras,\n} from \"./plugin-resource-show.js\";\n\nconst DEFAULT_CONTENT_LINE_LIMIT = 15;\n\nexport type ResourceShowOptions = {\n showAllFields?: boolean;\n full?: boolean;\n};\n\nfunction resourceShowExtras(\n resource: Resource,\n): ReturnType<typeof pluginResourceShowExtras> | ReturnType<typeof packageResourceShowExtras> {\n return pluginResourceShowExtras(resource) ?? packageResourceShowExtras(resource);\n}\n\nfunction resourceShowPanelRows(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n opts?: ResourceShowOptions,\n): Array<[string, string]> {\n const path =\n extras && \"install_path\" in extras && extras.install_path\n ? extras.install_path\n : packageDirectoryDisplayPath(resource.source);\n const panelRows: Array<[string, string]> = [\n [\"Type\", resource.type],\n [\"Name\", resourceHumanName(resource)],\n [\"Description\", resource.description || \": \"],\n [\"Path\", path || \": \"],\n [\"Origin\", formatOriginDisplayLabel(\n resource.origin_kind,\n resource.origin_ref,\n { includeRef: resource.type !== \"plugin\" },\n )],\n [\"Updated\", formatRelativeTimeWithAbsolute(resource.updated_at)],\n ];\n if (resource.namespace) {\n panelRows.splice(2, 0, [\"Namespace\", resource.namespace]);\n }\n if (opts?.showAllFields) {\n panelRows.push(\n [\"Source\", resource.source],\n [\"Content hash\", resource.content_hash || \": \"],\n [\"ID\", resource.id],\n [\"Created\", resource.created_at],\n [\"Metadata\", JSON.stringify(resource.metadata)],\n );\n }\n return panelRows;\n}\n\nexport function truncateResourceContent(\n content: string,\n maxLines = DEFAULT_CONTENT_LINE_LIMIT,\n): string {\n const lines = content.split(\"\\n\");\n if (lines.length <= maxLines) {\n return content;\n }\n const totalLines = lines.length;\n return [\n ...lines.slice(0, maxLines),\n `... (${totalLines} lines in content)`,\n ].join(\"\\n\");\n}\n\nfunction readContainedSkillBody(files: PluginContainedResource[]): string | undefined {\n const skillFile = files.find((file) => {\n const base = file.relative_path.split(\"/\").at(-1)?.toLowerCase();\n return base === \"skill.md\";\n });\n if (!skillFile) {\n return undefined;\n }\n try {\n return readFileSync(skillFile.path, \"utf-8\");\n } catch {\n return undefined;\n }\n}\n\nfunction resolveResourceBody(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n): string {\n if (resource.type !== \"plugin\" && resource.content.trim().length > 0) {\n return resource.content;\n }\n if (resource.type !== \"plugin\" && extras && \"contained_resources\" in extras) {\n const fromDisk = readContainedSkillBody(extras.contained_resources);\n if (fromDisk !== undefined) {\n return fromDisk;\n }\n }\n return resource.content;\n}\n\nfunction renderContainedFileList(files: PluginContainedResource[]): string {\n if (files.length === 0) {\n return \"Nothing loaded yet.\";\n }\n return files.map((file) => file.relative_path).join(\"\\n\");\n}\n\nfunction renderResourceContent(\n resource: Resource,\n extras: ReturnType<typeof resourceShowExtras>,\n opts?: ResourceShowOptions,\n): string {\n if (resource.type === \"plugin\") {\n if (!extras || extras.contained_resources.length === 0) {\n return \"Nothing loaded yet.\";\n }\n return renderContainedFileList(extras.contained_resources);\n }\n\n const body = resolveResourceBody(resource, extras);\n const renderedBody = opts?.full ? body : truncateResourceContent(body);\n if (!extras || extras.contained_resources.length === 0) {\n return renderedBody;\n }\n const companions = extras.contained_resources.filter((file) => {\n const base = file.relative_path.split(\"/\").at(-1)?.toLowerCase();\n return base !== \"skill.md\";\n });\n if (companions.length === 0) {\n return renderedBody;\n }\n return [renderedBody, \"\", renderContainedFileList(extras.contained_resources)].join(\"\\n\");\n}\n\nexport function renderResourceShow(resource: Resource, opts?: ResourceShowOptions): string {\n const extras = resourceShowExtras(resource);\n return [\n renderPanel({\n title: [\"RESOURCE\", formatResourceDisplayName(resource)],\n rows: resourceShowPanelRows(resource, extras, opts),\n }),\n renderSubheader(\"CONTENT\"),\n renderResourceContent(resource, extras, opts),\n ].join(\"\\n\");\n}\n\nexport function printResourceShow(resource: Resource, opts?: ResourceShowOptions): void {\n console.log(renderResourceShow(resource, opts));\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { listResourcesMatchingOriginRef } from \"../models/resource.js\";\nimport { getInstalledCursorPluginInstallPath } from \"../plugins/cursor-installed.js\";\nimport type { PluginDependencyMetadata, Resource } from \"../types.js\";\nimport {\n containedFileStem,\n inferContainedFileType,\n isPackageEntryFileName,\n packageDirectoryDisplayPath,\n} from \"../ui/resource-display.js\";\nimport { listContainedFilesPage } from \"../utils/path-containment.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { listVisibleMarketplaces } from \"./host-marketplaces.js\";\nimport { parseDependencyRef } from \"./plugin-dependency.js\";\nimport {\n hostPluginPullUnavailableReason,\n listHostPluginVersions,\n type HostPluginCacheVersion,\n} from \"./host-plugin-versions.js\";\nimport { resolveExistingResourceFilesystemPath } from \"./resource-editor-path.js\";\nimport { resolveInstallRoot } from \"./resource-sync.js\";\n\nexport const CONTAINED_FILES_PAGE_SIZE = 20;\n\nexport interface PluginContainedResource {\n type: string;\n name: string;\n path: string;\n relative_path: string;\n}\n\nexport interface PluginResourceShowExtras {\n install_path: string | null;\n marketplace_url: string | null;\n contained_resources: PluginContainedResource[];\n current_version: string | null;\n advertised_version: string | null;\n available_versions: HostPluginCacheVersion[];\n pull_unavailable_reason: string | null;\n}\n\nexport type PluginResourceShowOptions = {\n homeRoot?: string;\n harnesstapDir?: string;\n pathHint?: string | null;\n includeContained?: boolean;\n limit?: number;\n offset?: number;\n};\n\nexport type ContainedResourcePage = {\n contained_resources: PluginContainedResource[];\n has_more: boolean;\n};\n\nexport function pluginResourceShowExtras(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): PluginResourceShowExtras | undefined {\n if (resource.type !== \"plugin\") {\n return undefined;\n }\n const originRef = resource.origin_ref || resource.name;\n const homeRoot = options?.homeRoot ?? resolveHomeRoot();\n const cursorInstall = getInstalledCursorPluginInstallPath(homeRoot, originRef);\n const preferCursorInstall = (resource.source ?? \"\").includes(\".cursor/plugins\");\n const installPath =\n preferCursorInstall && cursorInstall\n ? cursorInstall\n : resolveInstallRoot(\n originRef,\n homeRoot,\n join(homeRoot, \".claude\", \"plugins\"),\n preferCursorInstall ? { preferCanonicalPackage: false } : {},\n );\n const marketplaceName =\n (resource.metadata as PluginDependencyMetadata).marketplace_name ||\n parseDependencyRef(originRef).namespace ||\n resource.namespace?.split(\"#\")[0] ||\n \"\";\n const marketplaceUrl =\n resource.origin_kind === \"marketplace_link\" && marketplaceName\n ? (listVisibleMarketplaces(\n options?.harnesstapDir ?? getHarnesstapDir(),\n options?.homeRoot,\n ).find((entry) => entry.name === marketplaceName)?.url ?? null)\n : null;\n const versions = listHostPluginVersions(originRef, options?.homeRoot);\n const pull_unavailable_reason = hostPluginPullUnavailableReason(\n originRef,\n options?.homeRoot,\n );\n const current_version =\n versions.current_version ??\n (resource.metadata as PluginDependencyMetadata).resolved_version ??\n null;\n const includeContained = options?.includeContained !== false;\n if (!installPath) {\n return {\n install_path: null,\n marketplace_url: marketplaceUrl,\n contained_resources: [],\n current_version,\n advertised_version: versions.advertised_version,\n available_versions: versions.available_versions,\n pull_unavailable_reason,\n };\n }\n return {\n install_path: installPath,\n marketplace_url: marketplaceUrl,\n contained_resources: includeContained\n ? listContainedPluginFiles(installPath, originRef, resource.id, {\n limit: options?.limit,\n offset: options?.offset,\n }).contained_resources\n : [],\n current_version,\n advertised_version: versions.advertised_version,\n available_versions: versions.available_versions,\n pull_unavailable_reason,\n };\n}\n\nexport interface PackageResourceShowExtras {\n contained_resources: PluginContainedResource[];\n}\n\n/** Nested files for SKILL.md / plugin.json packages that are not plugin-type resources. */\nexport function packageResourceShowExtras(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): PackageResourceShowExtras | undefined {\n if (resource.type === \"plugin\") {\n return undefined;\n }\n if (options?.includeContained === false) {\n return undefined;\n }\n const page = listPackageContainedFiles(resource, options);\n if (!page || page.contained_resources.length === 0) {\n return undefined;\n }\n return { contained_resources: page.contained_resources };\n}\n\nexport function listResourceContainedFiles(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): ContainedResourcePage {\n if (resource.type === \"plugin\") {\n const extras = pluginResourceShowExtras(resource, {\n ...options,\n includeContained: false,\n });\n if (!extras?.install_path) {\n return { contained_resources: [], has_more: false };\n }\n return listContainedPluginFiles(\n extras.install_path,\n resource.origin_ref || resource.name,\n resource.id,\n { limit: options?.limit, offset: options?.offset },\n );\n }\n return (\n listPackageContainedFiles(resource, options) ?? {\n contained_resources: [],\n has_more: false,\n }\n );\n}\n\nconst SKIP_TREE_SEGMENTS = new Set([\".git\", \"node_modules\"]);\n\nfunction listPluginTreeRelativePaths(\n installPath: string,\n options?: { limit?: number; offset?: number },\n): { files: string[]; hasMore: boolean } {\n try {\n const page = listContainedFilesPage(installPath, {\n limit: options?.limit,\n offset: options?.offset,\n skipDirNames: SKIP_TREE_SEGMENTS,\n });\n if (options?.limit === undefined && (options?.offset ?? 0) === 0) {\n return {\n files: page.files.slice().sort((left, right) => left.localeCompare(right)),\n hasMore: page.hasMore,\n };\n }\n return page;\n } catch {\n return { files: [], hasMore: false };\n }\n}\n\nfunction inferPackageContainedFileType(relativePath: string): string {\n const base = relativePath.split(\"/\").at(-1)?.toLowerCase() ?? \"\";\n if (base === \"skill.md\") {\n return \"skill\";\n }\n if (base === \"plugin.json\") {\n return \"plugin\";\n }\n return inferContainedFileType(relativePath);\n}\n\nfunction listPackageTreeFiles(\n packageDir: string,\n options?: { limit?: number; offset?: number },\n): ContainedResourcePage {\n const page = listPluginTreeRelativePaths(packageDir, options);\n return {\n contained_resources: page.files.map((relative_path) => ({\n type: inferPackageContainedFileType(relative_path),\n name: containedFileStem(relative_path),\n path: join(packageDir, ...relative_path.split(\"/\")),\n relative_path,\n })),\n has_more: page.hasMore,\n };\n}\n\nfunction listPackageContainedFiles(\n resource: Resource,\n options?: PluginResourceShowOptions,\n): ContainedResourcePage | undefined {\n const filePath = resolveExistingResourceFilesystemPath(resource, options?.pathHint);\n if (!filePath) {\n return undefined;\n }\n const fileName = filePath.split(/[/\\\\]/).pop() ?? \"\";\n if (!isPackageEntryFileName(fileName)) {\n return undefined;\n }\n return listPackageTreeFiles(packageDirectoryDisplayPath(filePath), {\n limit: options?.limit,\n offset: options?.offset,\n });\n}\n\nfunction listContainedPluginFiles(\n installPath: string,\n originRef: string,\n pluginResourceId: string,\n options?: { limit?: number; offset?: number },\n): ContainedResourcePage {\n const libraryByRelative = new Map<string, Resource>();\n for (const row of listResourcesMatchingOriginRef(originRef)) {\n if (row.type === \"plugin\" || row.id === pluginResourceId) {\n continue;\n }\n const contained = containedFile(installPath, row.source);\n if (contained) {\n libraryByRelative.set(contained.relative_path, row);\n }\n }\n\n const treePage = listPluginTreeRelativePaths(installPath, options);\n if (treePage.files.length === 0 && !treePage.hasMore) {\n const fallback = [...libraryByRelative.entries()]\n .map(([relative_path, row]) => {\n const contained = containedFile(installPath, row.source);\n return {\n type: row.type,\n name: row.name,\n path: contained?.path ?? join(installPath, ...relative_path.split(\"/\")),\n relative_path,\n };\n })\n .sort((left, right) => left.relative_path.localeCompare(right.relative_path));\n const start = Math.max(0, options?.offset ?? 0);\n const limit = options?.limit;\n if (limit === undefined) {\n return { contained_resources: fallback.slice(start), has_more: false };\n }\n const end = start + limit;\n return {\n contained_resources: fallback.slice(start, end),\n has_more: end < fallback.length,\n };\n }\n\n return {\n contained_resources: treePage.files.map((relative_path) => {\n const path = join(installPath, ...relative_path.split(\"/\"));\n const row = libraryByRelative.get(relative_path);\n if (row) {\n return {\n type: row.type,\n name: row.name,\n path,\n relative_path,\n };\n }\n return {\n type: inferContainedFileType(relative_path),\n name: containedFileStem(relative_path),\n path,\n relative_path,\n };\n }),\n has_more: treePage.hasMore,\n };\n}\n\nfunction containedFile(\n installPath: string,\n source: string,\n): { path: string; relative_path: string } | null {\n if (!source.trim()) {\n return null;\n }\n const absolute = resolve(installPath, source);\n const root = resolve(installPath);\n const rel = relative(root, absolute);\n if (!rel || rel.startsWith(\"..\")) {\n return null;\n }\n if (!existsSync(absolute)) {\n return null;\n }\n try {\n if (!statSync(absolute).isFile()) {\n return null;\n }\n } catch {\n return null;\n }\n return {\n path: absolute,\n relative_path: rel.split(sep).join(\"/\"),\n };\n}\n","import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type {\n PluginMarketplaceEntry,\n PluginMarketplacePlatform,\n} from \"../config/settings.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { readJsonFile } from \"../plugins/claude-installed.js\";\nimport { readMarketplaceManifest } from \"./marketplace-catalog.js\";\nimport {\n listMarketplaces,\n normalizeMarketplaceUrl,\n} from \"./marketplace-registry.js\";\nimport { builtinMarketplaceEntry } from \"./builtin-marketplaces.js\";\nimport { resolveMarketplaceRoot } from \"./host-plugin-source.js\";\n\nexport interface VisibleMarketplaceEntry extends PluginMarketplaceEntry {\n managed: boolean;\n contentRoot?: string;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction stripTrailingSlash(url: string): string {\n return url.replace(/\\/+$/, \"\");\n}\n\nfunction githubMarketplaceUrl(repo: string): string {\n const trimmed = repo.trim();\n if (trimmed.includes(\"://\")) {\n return stripTrailingSlash(normalizeMarketplaceUrl(trimmed));\n }\n return stripTrailingSlash(normalizeMarketplaceUrl(`https://github.com/${trimmed}`));\n}\n\nfunction mergeMarketplacePlatforms(\n left: PluginMarketplacePlatform[],\n right: PluginMarketplacePlatform[],\n): PluginMarketplacePlatform[] {\n const seen = new Set<PluginMarketplacePlatform>();\n const merged: PluginMarketplacePlatform[] = [];\n for (const platform of [...left, ...right]) {\n if (seen.has(platform)) continue;\n seen.add(platform);\n merged.push(platform);\n }\n return merged;\n}\n\nfunction repositoryUrlFromManifest(root: string): string | undefined {\n const raw = readMarketplaceManifest(root);\n if (!isRecord(raw)) return undefined;\n const repository = raw.repository;\n if (typeof repository === \"string\" && repository.trim()) {\n return stripTrailingSlash(normalizeMarketplaceUrl(repository));\n }\n if (isRecord(repository) && typeof repository.url === \"string\" && repository.url.trim()) {\n return stripTrailingSlash(normalizeMarketplaceUrl(repository.url));\n }\n return undefined;\n}\n\nfunction discoverClaudeMarketplaces(homeRoot: string): VisibleMarketplaceEntry[] {\n const knownPath = join(homeRoot, \".claude\", \"plugins\", \"known_marketplaces.json\");\n const known = readJsonFile<Record<string, unknown>>(knownPath);\n if (!known || !isRecord(known)) return [];\n\n const discovered: VisibleMarketplaceEntry[] = [];\n for (const [name, value] of Object.entries(known)) {\n const trimmedName = name.trim();\n if (!trimmedName || !isRecord(value)) continue;\n\n const source = isRecord(value.source) ? value.source : {};\n const kind = typeof source.source === \"string\" ? source.source : \"\";\n const installLocation =\n typeof value.installLocation === \"string\" && value.installLocation.trim()\n ? value.installLocation.trim()\n : undefined;\n const contentRoot =\n installLocation && existsSync(installLocation) ? installLocation : undefined;\n\n let url = \"\";\n switch (kind) {\n case \"github\": {\n const repo = typeof source.repo === \"string\" ? source.repo : \"\";\n if (!repo.trim()) continue;\n url = githubMarketplaceUrl(repo);\n break;\n }\n case \"directory\": {\n const path =\n typeof source.path === \"string\" && source.path.trim()\n ? source.path.trim()\n : (installLocation ?? \"\");\n if (!path) continue;\n url = (contentRoot ? repositoryUrlFromManifest(contentRoot) : undefined) ?? path;\n break;\n }\n default:\n continue;\n }\n\n const platforms: PluginMarketplacePlatform[] = [\"claude-code\"];\n discovered.push({\n name: trimmedName,\n url,\n platforms,\n managed: false,\n ...(contentRoot ? { contentRoot } : {}),\n });\n }\n return discovered;\n}\n\nexport function listVisibleMarketplaces(\n harnesstapDir: string,\n homeRoot: string = resolveHomeRoot(),\n): VisibleMarketplaceEntry[] {\n const registered: VisibleMarketplaceEntry[] = listMarketplaces(harnesstapDir).map((entry) => ({\n ...entry,\n managed: true,\n }));\n const seenNames = new Set(registered.map((entry) => entry.name));\n const seenUrls = new Set(\n registered.map((entry) => stripTrailingSlash(normalizeMarketplaceUrl(entry.url))),\n );\n\n const host: VisibleMarketplaceEntry[] = [];\n for (const entry of discoverClaudeMarketplaces(homeRoot)) {\n const urlKey = stripTrailingSlash(normalizeMarketplaceUrl(entry.url));\n if (seenNames.has(entry.name) || seenUrls.has(urlKey)) continue;\n seenNames.add(entry.name);\n seenUrls.add(urlKey);\n host.push(entry);\n }\n\n const listed = [...registered, ...host];\n const builtin = builtinMarketplaceEntry();\n const existing = listed.find((entry) => entry.name === builtin.name);\n const contentRoot = resolveMarketplaceRoot(homeRoot, builtin.name);\n if (existing) {\n existing.platforms = mergeMarketplacePlatforms(builtin.platforms, existing.platforms);\n if (!existing.url) {\n existing.url = builtin.url;\n }\n if (contentRoot && !existing.contentRoot) {\n existing.contentRoot = contentRoot;\n }\n } else {\n listed.push({\n ...builtin,\n managed: false,\n ...(contentRoot ? { contentRoot } : {}),\n });\n }\n\n return listed;\n}\n\nexport function toMarketplaceListEntry(\n entry: VisibleMarketplaceEntry,\n): PluginMarketplaceEntry & { managed: boolean } {\n return {\n name: entry.name,\n url: entry.url,\n platforms: entry.platforms,\n managed: entry.managed,\n ...(entry.trackedBranches && entry.trackedBranches.length > 0\n ? { trackedBranches: entry.trackedBranches }\n : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,uBAAuB,QAAQ,IAAY;AACzD,SAAO;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR;AAAA,IACA,OAAO,CAAC,UAAU,GAAG,MAAM,aAAa,KAAK;AAAA,EAC/C;AACF;AAEO,SAAS,2BAA2B,MAAmC;AAC5E,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,SAAO,SAAS;AAClB;AAEO,SAAS,wBACd,gBACA,UACmD;AACnD,MAAI,kBAAkB,YAAY,mBAAmB,UAAU;AAC7D,WAAO;AAAA,EACT;AACA,QAAM,OAAO,kBAAkB;AAC/B,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,QAAM,aAAa,SAAS,eAAe,WAAW;AACtD,MAAI,CAAC,eAAe,SAAS,UAA0B,GAAG;AACxD,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,SAAS,iCAAiC,OAIrC;AACV,MAAI,MAAM,QAAQ;AAChB,WAAO;AAAA,EACT;AAEA,SAAO,gBAAgB;AAAA,IACrB,aAAa;AAAA,IACb,eAAe,MAAM;AAAA,IACrB,QAAQ,kBAAkB,MA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OAAO,mBAAmB;AAAA,EAC3D;AAEA,QAAM,OAAO,oBAAoB,UAAU,MAAM;AACjD,QAAM,eAAe,MAAM,OAAO,OAAO,wBAAwB,IAAI;AACrE,MAAI,CAAC,UAAU,OAAO,oBAAoB,WAAW,GAAG;AACtD,WAAO;AAAA,EACT;AACA,QAAM,aAAa,OAAO,oBAAoB,OAAO,CAAC,SAAS;AAC7D,UAAM,OAAO,KAAK,cAAc,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,YAAY;AAC/D,WAAO,SAAS;AAAA,EAClB,CAAC;AACD,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AACA,SAAO,CAAC,cAAc,IAAI,wBAAwB,OAAO,mBAAmB,CAAC,EAAE,KAAK,IAAI;AAC1F;AAEO,SAAS,mBAAmB,UAAoB,MAAoC;AACzF,QAAM,SAAS,mBAAmB,QAAQ;AAC1C,SAAO;AAAA,IACL,YAAY;AAAA,MACV,OAAO,CAAC,YAAY,0BAA0B,QAAQ,CAAC;AAAA,MACvD,MAAM,sBAAsB,UAAU,QAAQ,IAAI;AAAA,IACpD,CAAC;AAAA,IACD,gBAAgB,SAAS;AAAA,IACzB,sBAAsB,UAAU,QAAQ,IAAI;AAAA,EAC9C,EAAE,KAAK,IAAI;AACb;AAEO,SAAS,kBAAkB,UAAoB,MAAkC;AACtF,UAAQ,IAAI,mBAAmB,UAAU,IAAI,CAAC;AAChD;","names":["existsSync","join","join","join","existsSync"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/open-path.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { listProjects } from \"../models/project.js\";\nimport { listResourceTrackedDirectories } from \"./resource-tracked-directories.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\nfunction runOpener(command: string, args: string[], filePath: string): void {\n const result = spawnSync(command, args, { stdio: \"ignore\" });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw new Error(`Failed to open ${filePath}`);\n }\n}\n\nexport function openPathInSystemEditor(filePath: string): void {\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"cmd\", [\"/c\", \"start\", \"\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [filePath], filePath);\n}\n\n/** Reveal a file in Finder / Explorer, or open a directory in the file manager. */\nexport function revealPathInFileManager(filePath: string): void {\n let isDirectory = false;\n try {\n isDirectory = statSync(filePath).isDirectory();\n } catch {\n isDirectory = false;\n }\n if (isDirectory) {\n openPathInSystemEditor(filePath);\n return;\n }\n\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [\"-R\", filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"explorer\", [\"/select,\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [dirname(filePath)], filePath);\n}\n\nexport function expandUserPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (trimmed.startsWith(\"~/\")) {\n return join(resolveHomeRoot(), trimmed.slice(2));\n }\n if (trimmed === \"~\") {\n return resolveHomeRoot();\n }\n return resolve(trimmed);\n}\n\nfunction realExistingPath(path: string): string | null {\n if (!existsSync(path)) {\n return null;\n }\n try {\n return realpathSync(path);\n } catch {\n return null;\n }\n}\n\nfunction isNestedOrEqual(root: string, target: string): boolean {\n if (target === root) {\n return true;\n }\n const rel = relative(root, target);\n return rel !== \"\" && rel !== \"..\" && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);\n}\n\nfunction collectAllowedOpenRoots(): string[] {\n const candidates = [\n getHarnesstapDir(),\n resolveHomeRoot(),\n ...listProjects().map((project) => project.local_path),\n ...listResourceTrackedDirectories().map((entry) => entry.path),\n ];\n const roots: string[] = [];\n for (const candidate of candidates) {\n const real = realExistingPath(candidate);\n if (real) {\n roots.push(real);\n }\n }\n return roots;\n}\n\nexport function isPathUnderAllowedOpenRoots(realPath: string): boolean {\n return collectAllowedOpenRoots().some((root) => isNestedOrEqual(root, realPath));\n}\n\nexport function resolveOpenableFilesystemPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (!trimmed) {\n throw new Error(\"Path is required\");\n }\n\n const expanded = expandUserPath(trimmed);\n const real = realExistingPath(expanded);\n if (!real) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\n }\n\n let isFileOrDirectory = false;\n try {\n const stat = statSync(real);\n isFileOrDirectory = stat.isFile() || stat.isDirectory();\n } catch {\n isFileOrDirectory = false;\n }\n if (!isFileOrDirectory) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\n }\n\n if (!isPathUnderAllowedOpenRoots(real)) {\n throw new Error(`Path is outside allowed roots: ${real}`);\n }\n\n return real;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;AAMlE,SAAS,UAAU,SAAiB,MAAgB,UAAwB;AAC1E,QAAM,SAAS,UAAU,SAAS,MAAM,EAAE,OAAO,SAAS,CAAC;AAC3D,MAAI,OAAO,OAAO;AAChB,UAAM,OAAO;AAAA,EACf;AACA,MAAI,OAAO,WAAW,GAAG;AACvB,UAAM,IAAI,MAAM,kBAAkB,QAAQ,EAAE;AAAA,EAC9C;AACF;AAEO,SAAS,uBAAuB,UAAwB;AAC7D,QAAM,WAAW,QAAQ;AACzB,MAAI,aAAa,UAAU;AACzB,cAAU,QAAQ,CAAC,QAAQ,GAAG,QAAQ;AACtC;AAAA,EACF;AACA,MAAI,aAAa,SAAS;AACxB,cAAU,OAAO,CAAC,MAAM,SAAS,IAAI,QAAQ,GAAG,QAAQ;AACxD;AAAA,EACF;AACA,YAAU,YAAY,CAAC,QAAQ,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,UAAM,IAAI,MAAM,kBAAkB;AAAA,EACpC;AAEA,QAAM,WAAW,eAAe,OAAO;AACvC,QAAM,OAAO,iBAAiB,QAAQ;AACtC,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,8CAA8C,SAAS,EAAE;AAAA,EAC3E;AAEA,MAAI,oBAAoB;AACxB,MAAI;AACF,UAAM,OAAO,SAAS,IAAI;AAC1B,wBAAoB,KAAK,OAAO,KAAK,KAAK,YAAY;AAAA,EACxD,QAAQ;AACN,wBAAoB;AAAA,EACtB;AACA,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,8CAA8C,SAAS,EAAE;AAAA,EAC3E;AAEA,MAAI,CAAC,4BAA4B,IAAI,GAAG;AACtC,UAAM,IAAI,MAAM,kCAAkC,IAAI,EAAE;AAAA,EAC1D;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/apply-scope.ts","../src/services/apm-mcp-manifest.ts","../src/cli/commands/apply.ts"],"sourcesContent":["import type { PlatformPaths } from \"../types.js\";\nimport { getPlatform } from \"../platforms/registry.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { resolveUserPath } from \"../utils/user-path.js\";\nimport { ui } from \"../ui/index.js\";\n\nexport type ApplyScope = \"project\" | \"global\";\n\nexport interface ResolvedApplyScope {\n scope: ApplyScope;\n /** Project root for `project`, home root for `global`. */\n root: string;\n /** First line of output, printed in TTY and non-TTY runs alike. */\n destinationLine: string;\n}\n\nexport function resolveApplyScope(input: {\n global?: boolean;\n project?: string;\n platforms: string[];\n}): ResolvedApplyScope {\n if (input.global) {\n const home = resolveHomeRoot();\n const paths = input.platforms\n .map((id) => getPlatform(id))\n .filter((platform): platform is NonNullable<typeof platform> => platform != null)\n .map((platform) => topLevelGlobalPath(platform.globalPaths))\n .filter((path, index, all) => path !== \"\" && all.indexOf(path) === index);\n return {\n scope: \"global\",\n root: home,\n destinationLine: `→ machine home ${paths.map((p) => `~/${p}`).join(\", \")}`.trimEnd(),\n };\n }\n const root = resolveUserPath(input.project ?? \".\", { mustExist: true });\n return { scope: \"project\", root, destinationLine: `→ project ${root}` };\n}\n\nfunction topLevelGlobalPath(paths: PlatformPaths): string {\n for (const value of Object.values(paths)) {\n if (typeof value !== \"string\" || !value) continue;\n const normalized = value.replace(/^~\\//, \"\");\n const segment = normalized.split(\"/\")[0];\n if (segment && segment.startsWith(\".\")) return segment;\n }\n return \"\";\n}\n\nexport function printDestination(resolved: ResolvedApplyScope): void {\n console.log(ui.theme.muted(resolved.destinationLine));\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport { APM_MANIFEST_FILENAME, parseApmYamlDocument } from \"./apm-manifest.js\";\nimport { collectApmAndDevDependencies } from \"./apm-dependencies.js\";\nimport { splitMcpRegistryIdentity } from \"./mcp-registry.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function apmManifestPath(projectRoot: string): string {\n return join(projectRoot, APM_MANIFEST_FILENAME);\n}\n\nexport function manifestHasMcpRegistryId(raw: string, registryId: string): boolean {\n const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);\n const { name } = splitMcpRegistryIdentity(registryId);\n const deps = collectApmAndDevDependencies(document);\n return deps.mcp.some((entry) => {\n if (entry.registryId === registryId || entry.registryId === name) {\n return true;\n }\n return entry.raw === registryId || entry.raw === name;\n });\n}\n\nexport function appendMcpRegistryIdToManifest(\n raw: string,\n registryId: string,\n): { next: string; added: boolean } {\n if (manifestHasMcpRegistryId(raw, registryId)) {\n return { next: raw, added: false };\n }\n const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);\n const dependencies = isRecord(document.dependencies) ? { ...document.dependencies } : {};\n const existing = dependencies.mcp;\n const mcp = Array.isArray(existing) ? [...existing, registryId] : [registryId];\n document.dependencies = { ...dependencies, mcp };\n return {\n next: stringifyYaml(document, {\n indent: 2,\n lineWidth: 0,\n defaultKeyType: \"PLAIN\",\n }),\n added: true,\n };\n}\n\nexport async function withMcpManifestAppend(options: {\n projectRoot: string;\n registryId: string;\n dryRun?: boolean;\n run: () => Promise<void>;\n}): Promise<{ added: boolean }> {\n const path = apmManifestPath(options.projectRoot);\n if (!existsSync(path)) {\n throw new Error(\n `No ${APM_MANIFEST_FILENAME} found under ${options.projectRoot}. Run ht config init first.`,\n );\n }\n const previous = readFileSync(path, \"utf8\");\n const { next, added } = appendMcpRegistryIdToManifest(previous, options.registryId);\n if (added) {\n writeFileSync(path, next, \"utf8\");\n }\n const restore = (): void => {\n if (added) {\n writeFileSync(path, previous, \"utf8\");\n }\n };\n try {\n await options.run();\n if ((process.exitCode ?? 0) !== 0 || options.dryRun) {\n restore();\n }\n return { added };\n } catch (error) {\n restore();\n throw error;\n }\n}\n","import type { Command } from \"commander\";\nimport { resolveUserPath } from \"../../utils/user-path.js\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { isProfilePlugin } from \"../../constants/profile.js\";\nimport { resolvePluginSelector } from \"../../models/plugin-model.js\";\nimport {\n addApplyCommandOptions,\n validateApplyOnConflict,\n type ApplyCommandOpts,\n} from \"../../services/apply-command-options.js\";\nimport {\n printDestination,\n resolveApplyScope,\n} from \"../../services/apply-scope.js\";\nimport {\n parsePlatformFilter,\n resolveRegisteredGlobalApplyHarnesses,\n uniqueHarnessTargets,\n} from \"../../services/harness-targets.js\";\nimport { resolveApplyConflictPolicy, promptMaterializationConflict } from \"../../services/materialization-conflicts.js\";\nimport { applyProfilePlugin } from \"../../services/profile-apply.js\";\nimport { withProfileApplyLock } from \"../../services/profile-apply-lock.js\";\nimport { useProfileCommand } from \"../../services/profile-commands.js\";\nimport { CliUsageError } from \"../../services/cli-errors.js\";\nimport { explainPayload, renderExplain } from \"../../services/resolve/explain.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { CLI_HINTS } from \"../messages.js\";\nimport {\n fail,\n formatCommand,\n} from \"../shared.js\";\nimport { printApplyPayload } from \"../print-apply-summary.js\";\nimport { trackPluginApplied } from \"../../telemetry/index.js\";\nimport { CriticalUnicodeError } from \"../../services/unicode-scan.js\";\nimport { handleProjectApplyCommand } from \"./plugin.js\";\nimport { withMcpManifestAppend } from \"../../services/apm-mcp-manifest.js\";\n\nexport type ApplyCommandActionOpts = ApplyCommandOpts & {\n global?: boolean;\n};\n\nexport type InstallCommandActionOpts = ApplyCommandActionOpts & {\n mcp?: string;\n};\n\nfunction resolveDestinationPlatforms(\n harnessOption: string | undefined,\n forGlobal: boolean,\n): string[] {\n if (forGlobal) {\n return resolveRegisteredGlobalApplyHarnesses(harnessOption);\n }\n return uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n}\n\nasync function handleGlobalApplyCommand(\n plugins: string[],\n opts: ApplyCommandActionOpts,\n): Promise<void> {\n const conflictError = validateApplyOnConflict(opts.onConflict);\n if (conflictError) {\n fail(conflictError);\n return;\n }\n\n const db = getDb();\n initializeSchema(db);\n\n const outputFormat = parseOutputFormat(opts.format);\n if (plugins.length === 0) {\n process.exitCode = 1;\n fail(\"Provide exactly one plugin name for --global apply.\", {\n hints: [formatCommand(\"apply <plugin> --global\")],\n });\n return;\n }\n if (plugins.length > 1) {\n process.exitCode = 1;\n fail(\"Global apply accepts exactly one plugin.\", {\n hints: [formatCommand(\"apply <plugin> --global\")],\n });\n return;\n }\n\n const selector = plugins[0];\n if (!selector) {\n process.exitCode = 1;\n fail(\"Provide exactly one plugin name for --global apply.\");\n return;\n }\n\n const plugin = resolvePluginSelector(selector);\n if (!plugin) {\n process.exitCode = 1;\n fail(`Plugin not found: ${selector}`);\n return;\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? outputFormat === \"json\",\n });\n const applyOptions = {\n dryRun: opts.dryRun,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n ...(opts.force ? { forceUnicode: true } : {}),\n };\n\n try {\n const recordActiveProfile = isProfilePlugin(plugin);\n const payload = recordActiveProfile\n ? await useProfileCommand(selector, applyOptions)\n : await withProfileApplyLock(() =>\n applyProfilePlugin(selector, {\n ...applyOptions,\n recordActiveProfile: false,\n }),\n );\n\n if (!recordActiveProfile && !payload.cancelled) {\n console.warn(\n ui.theme.warn(\n `Applied to machine home, but no active profile was recorded because ${plugin.name} is not a profile plugin.`,\n ),\n );\n }\n\n if (!payload.cancelled && !payload.dry_run) {\n trackPluginApplied({\n pluginSlug: plugin.name,\n harness: payload.harnesses[0],\n });\n }\n\n if (outputFormat === \"json\") {\n const { resolution, ...rest } = payload;\n printJson({\n scope: \"global\",\n ...rest,\n ...(opts.explain && resolution ? { explain: explainPayload(resolution) } : {}),\n });\n return;\n }\n\n if (payload.cancelled) {\n fail(\"Apply cancelled due to file conflicts.\", {\n hint: CLI_HINTS.onConflictReplace,\n });\n return;\n }\n\n if (opts.explain && payload.resolution) {\n console.log(renderExplain(payload.resolution));\n console.log(\"\");\n }\n printApplyPayload(payload);\n } catch (err) {\n process.exitCode = 1;\n if (err instanceof CriticalUnicodeError) {\n fail(err.message, {\n hints: [formatCommand(\"apply --global --force\")],\n });\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n}\n\nexport async function handleApplyCommand(\n plugins: string[],\n opts: ApplyCommandActionOpts,\n): Promise<void> {\n const conflictError = validateApplyOnConflict(opts.onConflict);\n if (conflictError) {\n fail(conflictError);\n return;\n }\n\n const outputFormat = parseOutputFormat(opts.format);\n let platforms: string[];\n let resolved: ReturnType<typeof resolveApplyScope>;\n try {\n platforms = resolveDestinationPlatforms(opts.harness, Boolean(opts.global));\n resolved = resolveApplyScope({\n global: opts.global,\n project: opts.project,\n platforms,\n });\n } catch (error) {\n if (error instanceof CliUsageError) {\n fail(error.message, { hints: error.hints });\n return;\n }\n fail(error instanceof Error ? error.message : String(error));\n return;\n }\n\n if (outputFormat === \"human\") {\n printDestination(resolved);\n }\n\n if (resolved.scope === \"global\") {\n await handleGlobalApplyCommand(plugins, opts);\n return;\n }\n\n await handleProjectApplyCommand(\n plugins as [string, ...string[]] | [],\n opts,\n );\n}\n\nexport function registerApplyCommand(root: Command): void {\n const apply = root\n .command(\"apply\")\n .argument(\"[plugins...]\", \"Plugins to apply\")\n .option(\"--global\", \"Materialize into machine home instead of the project\")\n .description(\"Resolve a plugin's dependency graph and materialize it\");\n addApplyCommandOptions(apply);\n apply.action(async (plugins: string[], opts: ApplyCommandActionOpts) => {\n await handleApplyCommand(plugins, opts);\n });\n}\n\nexport async function handleInstallCommand(\n extraArgs: string[],\n opts: InstallCommandActionOpts,\n): Promise<void> {\n if (extraArgs.length > 0) {\n process.exitCode = 1;\n fail(\n \"ht install does not take a plugin selector. It reads repo-root apm.yml.\",\n {\n hints: [formatCommand(\"install\"), formatCommand(\"apply <plugin>\")],\n },\n );\n return;\n }\n\n const registryId = opts.mcp?.trim();\n if (registryId) {\n try {\n const result = await withMcpManifestAppend({\n projectRoot: resolveUserPath(opts.project, { mustExist: true }),\n registryId,\n dryRun: opts.dryRun,\n run: () => handleApplyCommand([], opts),\n });\n if (opts.dryRun && result.added) {\n ui.info(`Would add \"${registryId}\" to apm.yml dependencies.mcp.`);\n } else if (result.added && (process.exitCode ?? 0) === 0) {\n ui.info(`Added \"${registryId}\" to apm.yml dependencies.mcp.`);\n }\n } catch (error) {\n process.exitCode = 1;\n fail(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n await handleApplyCommand([], opts);\n}\n\nexport function registerInstallCommand(root: Command): void {\n const install = root\n .command(\"install\")\n .description(\n \"Onboard a project from apm.yml (same as apply with no plugin selector)\",\n )\n .allowExcessArguments(true);\n addApplyCommandOptions(install);\n install.option(\n \"--mcp <id>\",\n \"Append an MCP Registry v0.1 identity to apm.yml dependencies.mcp, then install\",\n );\n install.action(async (opts: InstallCommandActionOpts) => {\n await handleInstallCommand(install.args, opts);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,kBAAkB,OAIX;AACrB,MAAI,MAAM,QAAQ;AAChB,UAAM,OAAO,gBAAgB;AAC7B,UAAM,QAAQ,MAAM,UACjB,IAAI,CAAC,OAAO,YAAY,EAAE,CAAC,EAC3B,OAAO,CAAC,aAAuD,YAAY,IAAI,EAC/E,IAAI,CAAC,aAAa,mBAAmB,SAAS,WAAW,CAAC,EAC1D,OAAO,CAAC,MAAM,OAAO,QAAQ,SAAS,MAAM,IAAI,QAAQ,IAAI,MAAM,KAAK;AAC1E,WAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,iBAAiB,uBAAkB,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,GAAG,QAAQ;AAAA,IACrF;AAAA,EACF;AACA,QAAM,OAAO,gBAAgB,MAAM,WAAW,KAAK,EAAE,WAAW,KAAK,CAAC;AACtE,SAAO,EAAE,OAAO,WAAW,MAAM,iBAAiB,kBAAa,IAAI,GAAG;AACxE;AAEA,SAAS,mBAAmB,OAA8B;AACxD,aAAW,SAAS,OAAO,OAAO,KAAK,GAAG;AACxC,QAAI,OAAO,UAAU,YAAY,CAAC,MAAO;AACzC,UAAM,aAAa,MAAM,QAAQ,QAAQ,EAAE;AAC3C,UAAM,UAAU,WAAW,MAAM,GAAG,EAAE,CAAC;AACvC,QAAI,WAAW,QAAQ,WAAW,GAAG,EAAG,QAAO;AAAA,EACjD;AACA,SAAO;AACT;AAEO,SAAS,iBAAiB,UAAoC;AACnE,UAAQ,IAAI,GAAG,MAAM,MAAM,SAAS,eAAe,C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