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.
Files changed (217) hide show
  1. package/README.md +2 -0
  2. package/dist/apply-SUNDXRJ3.js +54 -0
  3. package/dist/{approve-KQNCNH2R.js → approve-FBGYQGWN.js} +14 -15
  4. package/dist/{approve-KQNCNH2R.js.map → approve-FBGYQGWN.js.map} +1 -1
  5. package/dist/{audit-SLYOZCMI.js → audit-VI4QZ6X2.js} +30 -39
  6. package/dist/{audit-SLYOZCMI.js.map → audit-VI4QZ6X2.js.map} +1 -1
  7. package/dist/{auth-3IEVICFT.js → auth-4CQCDS2W.js} +17 -19
  8. package/dist/{auth-3IEVICFT.js.map → auth-4CQCDS2W.js.map} +1 -1
  9. package/dist/bin.js +3 -3
  10. package/dist/{chunk-KDDXZBMC.js → chunk-23XSG7LI.js} +7 -11
  11. package/dist/{chunk-KDDXZBMC.js.map → chunk-23XSG7LI.js.map} +1 -1
  12. package/dist/{chunk-YDD3ES2K.js → chunk-2A36HWDE.js} +63 -13
  13. package/dist/chunk-2A36HWDE.js.map +1 -0
  14. package/dist/{chunk-IK524ZDW.js → chunk-3FS775NP.js} +51 -4
  15. package/dist/chunk-3FS775NP.js.map +1 -0
  16. package/dist/{chunk-IBOABSIA.js → chunk-3P6BWL5F.js} +2 -2
  17. package/dist/{chunk-G26HZZDJ.js → chunk-43BDGVN3.js} +19 -6
  18. package/dist/chunk-43BDGVN3.js.map +1 -0
  19. package/dist/{chunk-TYULB6ZY.js → chunk-4ZQ2SCGY.js} +146 -78
  20. package/dist/chunk-4ZQ2SCGY.js.map +1 -0
  21. package/dist/{chunk-6BY4BV5G.js → chunk-6LTLYV5D.js} +353 -230
  22. package/dist/chunk-6LTLYV5D.js.map +1 -0
  23. package/dist/{chunk-GQKKX7OE.js → chunk-73OJQTBW.js} +6 -2
  24. package/dist/chunk-73OJQTBW.js.map +1 -0
  25. package/dist/{chunk-IRU7NBOT.js → chunk-7HP6AAI3.js} +2 -2
  26. package/dist/{chunk-MWXA4PFE.js → chunk-BPWFQKI5.js} +5 -7
  27. package/dist/{chunk-MWXA4PFE.js.map → chunk-BPWFQKI5.js.map} +1 -1
  28. package/dist/{chunk-3RBYT7QN.js → chunk-D432JAXV.js} +44 -19
  29. package/dist/chunk-D432JAXV.js.map +1 -0
  30. package/dist/chunk-DF4Z7LAD.js +3463 -0
  31. package/dist/chunk-DF4Z7LAD.js.map +1 -0
  32. package/dist/{chunk-J4CKQXQ6.js → chunk-EOPFER6N.js} +71 -318
  33. package/dist/chunk-EOPFER6N.js.map +1 -0
  34. package/dist/chunk-G6WKY2W4.js +389 -0
  35. package/dist/chunk-G6WKY2W4.js.map +1 -0
  36. package/dist/{chunk-JKGSJGCC.js → chunk-GRASK6M6.js} +5 -5
  37. package/dist/{chunk-63U7QWNY.js → chunk-IE7B6Q5K.js} +33 -39
  38. package/dist/chunk-IE7B6Q5K.js.map +1 -0
  39. package/dist/{chunk-VC6OKCJF.js → chunk-IMROMZ2K.js} +7 -4
  40. package/dist/{chunk-VC6OKCJF.js.map → chunk-IMROMZ2K.js.map} +1 -1
  41. package/dist/{chunk-DV74UZJI.js → chunk-L6YZE5MY.js} +3 -3
  42. package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
  43. package/dist/chunk-M2U3J7UX.js.map +1 -0
  44. package/dist/{chunk-BSOBXLYI.js → chunk-M4KLHJ6U.js} +16 -13
  45. package/dist/chunk-M4KLHJ6U.js.map +1 -0
  46. package/dist/{chunk-VL7BGD47.js → chunk-MR7IOHSX.js} +16 -19
  47. package/dist/chunk-MR7IOHSX.js.map +1 -0
  48. package/dist/{chunk-4KNQZDZC.js → chunk-N3VGY3T3.js} +15 -15
  49. package/dist/chunk-N3VGY3T3.js.map +1 -0
  50. package/dist/{chunk-ZY2MZ2KQ.js → chunk-N3ZCH64F.js} +496 -10
  51. package/dist/chunk-N3ZCH64F.js.map +1 -0
  52. package/dist/{chunk-H6DVP2SI.js → chunk-OML4HXKT.js} +20 -22
  53. package/dist/chunk-OML4HXKT.js.map +1 -0
  54. package/dist/{chunk-NJ7WRKIQ.js → chunk-P2C7JPLD.js} +3 -3
  55. package/dist/{chunk-LNJ3WZZX.js → chunk-PCMON7Y2.js} +7 -7
  56. package/dist/{chunk-VL2NWCZV.js → chunk-PNGF5EV2.js} +2 -2
  57. package/dist/{chunk-SZNBUIDR.js → chunk-QA5U36JN.js} +199 -215
  58. package/dist/chunk-QA5U36JN.js.map +1 -0
  59. package/dist/{chunk-KDAV2GUT.js → chunk-R7ZOYVN3.js} +241 -126
  60. package/dist/chunk-R7ZOYVN3.js.map +1 -0
  61. package/dist/{chunk-QO4LBDVI.js → chunk-RDG5DT7S.js} +45 -49
  62. package/dist/{chunk-QO4LBDVI.js.map → chunk-RDG5DT7S.js.map} +1 -1
  63. package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
  64. package/dist/chunk-REHRUNBB.js.map +1 -0
  65. package/dist/{chunk-DXKAKKLP.js → chunk-RFQ3N7FB.js} +19 -29
  66. package/dist/chunk-RFQ3N7FB.js.map +1 -0
  67. package/dist/{chunk-C4QBVVEH.js → chunk-RVEXPMM3.js} +3 -3
  68. package/dist/{chunk-XFZQVYIN.js → chunk-TPEJFLV7.js} +13 -15
  69. package/dist/{chunk-XFZQVYIN.js.map → chunk-TPEJFLV7.js.map} +1 -1
  70. package/dist/{chunk-7LWH5SWH.js → chunk-U6DXASQP.js} +2 -2
  71. package/dist/{chunk-BIBUCC2E.js → chunk-ULCD6DJE.js} +30 -8
  72. package/dist/chunk-ULCD6DJE.js.map +1 -0
  73. package/dist/{chunk-KMWHZSEG.js → chunk-UVVZHWD2.js} +2 -2
  74. package/dist/{chunk-DWVAR4BP.js → chunk-WG5A6EAU.js} +270 -12
  75. package/dist/chunk-WG5A6EAU.js.map +1 -0
  76. package/dist/{chunk-QRZPQNLX.js → chunk-WGP4GUYZ.js} +10 -10
  77. package/dist/{chunk-F2L4VNQK.js → chunk-XTVGCVU4.js} +124 -83
  78. package/dist/chunk-XTVGCVU4.js.map +1 -0
  79. package/dist/{chunk-EIWXS4RM.js → chunk-XUJKZQZA.js} +8 -8
  80. package/dist/chunk-XUJKZQZA.js.map +1 -0
  81. package/dist/chunk-ZUASVASP.js +30317 -0
  82. package/dist/chunk-ZUASVASP.js.map +1 -0
  83. package/dist/{compile-57EEIUMB.js → compile-GXADKGH5.js} +37 -50
  84. package/dist/{compile-57EEIUMB.js.map → compile-GXADKGH5.js.map} +1 -1
  85. package/dist/{config-4EJ3D7QJ.js → config-JMHNA2U5.js} +22 -35
  86. package/dist/{config-4EJ3D7QJ.js.map → config-JMHNA2U5.js.map} +1 -1
  87. package/dist/cursor-local-install-46RWRBDT.js +98 -0
  88. package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
  89. package/dist/{doctor-EEV6P5CH.js → doctor-N7ZULPOL.js} +18 -19
  90. package/dist/{doctor-EEV6P5CH.js.map → doctor-N7ZULPOL.js.map} +1 -1
  91. package/dist/{environment-WFEG4DAT.js → environment-OBB3WU5B.js} +60 -71
  92. package/dist/{environment-WFEG4DAT.js.map → environment-OBB3WU5B.js.map} +1 -1
  93. package/dist/{github-BSMQD72A.js → github-PBYBGOLH.js} +17 -17
  94. package/dist/{harness-VX3PNVQW.js → harness-7KYATIV6.js} +56 -67
  95. package/dist/{harness-VX3PNVQW.js.map → harness-7KYATIV6.js.map} +1 -1
  96. package/dist/{help-AW2HKX63.js → help-EE3AJQD4.js} +48 -52
  97. package/dist/help-EE3AJQD4.js.map +1 -0
  98. package/dist/{help-BVFOZD7E.js → help-VXWKLQ6A.js} +55 -15
  99. package/dist/help-VXWKLQ6A.js.map +1 -0
  100. package/dist/index.d.ts +7 -0
  101. package/dist/index.js +16 -24
  102. package/dist/{init-SPN2GEZ4.js → init-LBTMPDVJ.js} +43 -56
  103. package/dist/init-LBTMPDVJ.js.map +1 -0
  104. package/dist/live-read-cache-TUSP7U3D.js +10 -0
  105. package/dist/{lock-K2LLUU7H.js → lock-WLJRXRVK.js} +16 -16
  106. package/dist/{marketplace-VEKSWGX3.js → marketplace-GXSV6QIY.js} +62 -28
  107. package/dist/marketplace-GXSV6QIY.js.map +1 -0
  108. package/dist/{mcp-T6DKIKSF.js → mcp-XPDWWU75.js} +35 -48
  109. package/dist/{mcp-T6DKIKSF.js.map → mcp-XPDWWU75.js.map} +1 -1
  110. package/dist/{migrate-OO37WSB2.js → migrate-SBUIWN3U.js} +79 -64
  111. package/dist/migrate-SBUIWN3U.js.map +1 -0
  112. package/dist/open-HDGLYYVU.js +24 -0
  113. package/dist/{pack-V32UPC7W.js → pack-A73LDVOX.js} +16 -22
  114. package/dist/{pack-V32UPC7W.js.map → pack-A73LDVOX.js.map} +1 -1
  115. package/dist/plugin-CEO6ZJM5.js +51 -0
  116. package/dist/plugin-from-project-UK7VJVUP.js +18 -0
  117. package/dist/{policy-F5MKZNOC.js → policy-6VY3CMSU.js} +13 -14
  118. package/dist/{policy-F5MKZNOC.js.map → policy-6VY3CMSU.js.map} +1 -1
  119. package/dist/{profile-H4PMH4XT.js → profile-YCKPMRRU.js} +96 -102
  120. package/dist/profile-YCKPMRRU.js.map +1 -0
  121. package/dist/{project-QVNEJJGH.js → project-KHPPBKPN.js} +63 -77
  122. package/dist/{project-QVNEJJGH.js.map → project-KHPPBKPN.js.map} +1 -1
  123. package/dist/{resource-GL4RLSGI.js → resource-IJU3FAN5.js} +42 -49
  124. package/dist/{resource-GL4RLSGI.js.map → resource-IJU3FAN5.js.map} +1 -1
  125. package/dist/{version-PBHZK44K.js → version-Z66FWWMQ.js} +2 -2
  126. package/dist/version-Z66FWWMQ.js.map +1 -0
  127. package/package.json +4 -1
  128. package/schemas/fixtures/confidence.ap.json +1 -1
  129. package/schemas/fixtures/context7.ap.json +1 -1
  130. package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
  131. package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
  132. package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
  133. package/schemas/fixtures/superpowers.ap.json +1 -1
  134. package/schemas/fixtures/third-party-skills.ap.json +1 -1
  135. package/dist/apply-2GRNKR5H.js +0 -67
  136. package/dist/chunk-2EIJYDNI.js +0 -10945
  137. package/dist/chunk-2EIJYDNI.js.map +0 -1
  138. package/dist/chunk-3IWTJCPA.js +0 -6448
  139. package/dist/chunk-3IWTJCPA.js.map +0 -1
  140. package/dist/chunk-3IZ7SEGT.js +0 -346
  141. package/dist/chunk-3IZ7SEGT.js.map +0 -1
  142. package/dist/chunk-3RBYT7QN.js.map +0 -1
  143. package/dist/chunk-4KNQZDZC.js.map +0 -1
  144. package/dist/chunk-63U7QWNY.js.map +0 -1
  145. package/dist/chunk-6BY4BV5G.js.map +0 -1
  146. package/dist/chunk-7L2K4N25.js +0 -610
  147. package/dist/chunk-7L2K4N25.js.map +0 -1
  148. package/dist/chunk-BIBUCC2E.js.map +0 -1
  149. package/dist/chunk-BSOBXLYI.js.map +0 -1
  150. package/dist/chunk-DWVAR4BP.js.map +0 -1
  151. package/dist/chunk-DXKAKKLP.js.map +0 -1
  152. package/dist/chunk-EIWXS4RM.js.map +0 -1
  153. package/dist/chunk-EWBCFAF3.js +0 -681
  154. package/dist/chunk-EWBCFAF3.js.map +0 -1
  155. package/dist/chunk-F2L4VNQK.js.map +0 -1
  156. package/dist/chunk-G26HZZDJ.js.map +0 -1
  157. package/dist/chunk-GQKKX7OE.js.map +0 -1
  158. package/dist/chunk-GRJY22U6.js +0 -691
  159. package/dist/chunk-GRJY22U6.js.map +0 -1
  160. package/dist/chunk-H6DVP2SI.js.map +0 -1
  161. package/dist/chunk-HVVPTCKR.js +0 -1173
  162. package/dist/chunk-HVVPTCKR.js.map +0 -1
  163. package/dist/chunk-IK524ZDW.js.map +0 -1
  164. package/dist/chunk-J4CKQXQ6.js.map +0 -1
  165. package/dist/chunk-JRFUTIEH.js +0 -426
  166. package/dist/chunk-JRFUTIEH.js.map +0 -1
  167. package/dist/chunk-K2BPYEH5.js +0 -491
  168. package/dist/chunk-K2BPYEH5.js.map +0 -1
  169. package/dist/chunk-KCQC7YBK.js +0 -7795
  170. package/dist/chunk-KCQC7YBK.js.map +0 -1
  171. package/dist/chunk-KDAV2GUT.js.map +0 -1
  172. package/dist/chunk-MY62SSKC.js +0 -183
  173. package/dist/chunk-MY62SSKC.js.map +0 -1
  174. package/dist/chunk-PXU2OS26.js +0 -238
  175. package/dist/chunk-PXU2OS26.js.map +0 -1
  176. package/dist/chunk-SNVAMWB7.js.map +0 -1
  177. package/dist/chunk-SPRVUATR.js +0 -430
  178. package/dist/chunk-SPRVUATR.js.map +0 -1
  179. package/dist/chunk-SY7G5QEI.js +0 -35
  180. package/dist/chunk-SY7G5QEI.js.map +0 -1
  181. package/dist/chunk-SZNBUIDR.js.map +0 -1
  182. package/dist/chunk-TYULB6ZY.js.map +0 -1
  183. package/dist/chunk-UJYFTXHV.js +0 -296
  184. package/dist/chunk-UJYFTXHV.js.map +0 -1
  185. package/dist/chunk-VL7BGD47.js.map +0 -1
  186. package/dist/chunk-VQVUJYYY.js.map +0 -1
  187. package/dist/chunk-XQFT4PEP.js +0 -60
  188. package/dist/chunk-XQFT4PEP.js.map +0 -1
  189. package/dist/chunk-YDD3ES2K.js.map +0 -1
  190. package/dist/chunk-ZY2MZ2KQ.js.map +0 -1
  191. package/dist/help-AW2HKX63.js.map +0 -1
  192. package/dist/help-BVFOZD7E.js.map +0 -1
  193. package/dist/init-SPN2GEZ4.js.map +0 -1
  194. package/dist/marketplace-VEKSWGX3.js.map +0 -1
  195. package/dist/migrate-OO37WSB2.js.map +0 -1
  196. package/dist/open-3V3QK5RK.js +0 -32
  197. package/dist/plugin-KOBNQ7GT.js +0 -64
  198. package/dist/plugin-from-project-X3VO3MB6.js +0 -16
  199. package/dist/profile-H4PMH4XT.js.map +0 -1
  200. /package/dist/{apply-2GRNKR5H.js.map → apply-SUNDXRJ3.js.map} +0 -0
  201. /package/dist/{chunk-IBOABSIA.js.map → chunk-3P6BWL5F.js.map} +0 -0
  202. /package/dist/{chunk-IRU7NBOT.js.map → chunk-7HP6AAI3.js.map} +0 -0
  203. /package/dist/{chunk-JKGSJGCC.js.map → chunk-GRASK6M6.js.map} +0 -0
  204. /package/dist/{chunk-DV74UZJI.js.map → chunk-L6YZE5MY.js.map} +0 -0
  205. /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-P2C7JPLD.js.map} +0 -0
  206. /package/dist/{chunk-LNJ3WZZX.js.map → chunk-PCMON7Y2.js.map} +0 -0
  207. /package/dist/{chunk-VL2NWCZV.js.map → chunk-PNGF5EV2.js.map} +0 -0
  208. /package/dist/{chunk-C4QBVVEH.js.map → chunk-RVEXPMM3.js.map} +0 -0
  209. /package/dist/{chunk-7LWH5SWH.js.map → chunk-U6DXASQP.js.map} +0 -0
  210. /package/dist/{chunk-KMWHZSEG.js.map → chunk-UVVZHWD2.js.map} +0 -0
  211. /package/dist/{chunk-QRZPQNLX.js.map → chunk-WGP4GUYZ.js.map} +0 -0
  212. /package/dist/{github-BSMQD72A.js.map → github-PBYBGOLH.js.map} +0 -0
  213. /package/dist/{open-3V3QK5RK.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
  214. /package/dist/{lock-K2LLUU7H.js.map → lock-WLJRXRVK.js.map} +0 -0
  215. /package/dist/{plugin-KOBNQ7GT.js.map → open-HDGLYYVU.js.map} +0 -0
  216. /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-CEO6ZJM5.js.map} +0 -0
  217. /package/dist/{version-PBHZK44K.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/apm-dependencies.ts","../src/services/apm-git-resolve.ts"],"sourcesContent":["export type ApmDependencySourceKind = \"git\" | \"catalog\" | \"marketplace\" | \"local\";\n\nexport interface ParsedApmDependency {\n raw: string;\n sourceKind: ApmDependencySourceKind;\n name: string;\n originRef: string;\n applySelector: string;\n ref?: string;\n versionConstraint?: string;\n /** Virtual package subpath inside the git repo (object-form `path:`). */\n path?: string;\n}\n\nexport interface ParsedMcpDependency {\n raw: string;\n name: string;\n registryId?: string;\n transport?: \"stdio\" | \"http\";\n command?: string;\n args?: string[];\n url?: string;\n env?: Record<string, string>;\n headers?: Record<string, string>;\n selfDefined: boolean;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction splitHashRef(value: string): { body: string; ref?: string } {\n const hash = value.lastIndexOf(\"#\");\n if (hash <= 0) {\n return { body: value };\n }\n const body = value.slice(0, hash);\n const ref = value.slice(hash + 1);\n if (!body || !ref) {\n return { body: value };\n }\n return { body, ref };\n}\n\nfunction repoNameFromGitRef(value: string): string {\n const withoutGit = value.replace(/\\.git$/, \"\");\n const tail = withoutGit.split(\"/\").filter(Boolean).pop() ?? withoutGit;\n return tail.split(\":\").pop() ?? tail;\n}\n\nfunction looksLikeHost(segment: string): boolean {\n return segment.includes(\".\") || segment === \"localhost\";\n}\n\nfunction githubCloneUrl(ownerRepo: string): string {\n const trimmed = ownerRepo.replace(/\\.git$/, \"\");\n return `https://github.com/${trimmed}.git`;\n}\n\n/** Strip `git+` transport prefix so the value is a cloneable URL. */\nexport function cloneUrlFromOrigin(originRef: string): string {\n return originRef.startsWith(\"git+\") ? originRef.slice(4) : originRef;\n}\n\nfunction parseGitShorthand(body: string, raw: string, ref?: string): ParsedApmDependency {\n const name = repoNameFromGitRef(body);\n const originRef = looksLikeHost(body.split(\"/\")[0] ?? \"\")\n ? body\n : githubCloneUrl(body);\n return {\n raw,\n sourceKind: \"git\",\n name,\n originRef,\n applySelector: name,\n ...(ref ? { ref, versionConstraint: ref } : {}),\n };\n}\n\nexport function parseApmDependencyString(entry: string): ParsedApmDependency {\n const trimmed = entry.trim();\n const { body, ref } = splitHashRef(trimmed);\n\n if (\n body.startsWith(\"./\")\n || body.startsWith(\"../\")\n || body.startsWith(\"~/\")\n || body.startsWith(\"/\")\n || body.startsWith(\".\\\\\")\n || body.startsWith(\"..\\\\\")\n || body.startsWith(\"~\\\\\")\n ) {\n const name = body.split(/[/\\\\]/).filter(Boolean).pop() ?? body;\n return {\n raw: trimmed,\n sourceKind: \"local\",\n name,\n originRef: body,\n applySelector: name,\n };\n }\n\n if (\n body.startsWith(\"https://\")\n || body.startsWith(\"http://\")\n || body.startsWith(\"file://\")\n || body.startsWith(\"git://\")\n || body.startsWith(\"git@\")\n || body.startsWith(\"ssh://git@\")\n || body.startsWith(\"git+\")\n ) {\n const name = repoNameFromGitRef(body);\n return {\n raw: trimmed,\n sourceKind: \"git\",\n name,\n originRef: cloneUrlFromOrigin(body),\n applySelector: name,\n ...(ref ? { ref, versionConstraint: ref } : {}),\n };\n }\n\n const slashParts = body.split(\"/\").filter(Boolean);\n const at = body.lastIndexOf(\"@\");\n\n if (slashParts.length === 3) {\n const namePart = slashParts[2] ?? body;\n const name = namePart.includes(\"@\") ? (namePart.split(\"@\")[0] ?? namePart) : namePart;\n return {\n raw: trimmed,\n sourceKind: \"catalog\",\n name,\n originRef: body,\n applySelector: body,\n ...(ref ? { ref, versionConstraint: ref } : {}),\n };\n }\n\n if (at > 0 && !body.slice(0, at).includes(\"/\")) {\n const name = body.slice(0, at);\n return {\n raw: trimmed,\n sourceKind: \"marketplace\",\n name,\n originRef: body,\n applySelector: body,\n };\n }\n\n if (slashParts.length === 2) {\n return parseGitShorthand(body, trimmed, ref);\n }\n\n if (slashParts.length > 2 && looksLikeHost(slashParts[0] ?? \"\")) {\n return parseGitShorthand(body, trimmed, ref);\n }\n\n return {\n raw: trimmed,\n sourceKind: \"local\",\n name: body,\n originRef: body,\n applySelector: body,\n ...(ref ? { ref, versionConstraint: ref } : {}),\n };\n}\n\nfunction stringMap(value: unknown): Record<string, string> | undefined {\n if (!isRecord(value)) {\n return undefined;\n }\n const result: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value)) {\n result[key] = String(entry);\n }\n return result;\n}\n\nexport function parseApmDependencyEntry(entry: unknown): ParsedApmDependency {\n if (typeof entry === \"string\") {\n return parseApmDependencyString(entry);\n }\n if (!isRecord(entry)) {\n throw new Error(\"dependencies.apm entries must be strings or mappings\");\n }\n\n if (typeof entry.git === \"string\" && typeof entry.id === \"string\") {\n throw new Error(\"dependencies.apm object cannot set both git and id\");\n }\n\n if (typeof entry.marketplace === \"string\" && typeof entry.name === \"string\") {\n const version = typeof entry.version === \"string\" ? entry.version : undefined;\n const originRef = `${entry.name}@${entry.marketplace}`;\n return {\n raw: JSON.stringify(entry),\n sourceKind: \"marketplace\",\n name: entry.name,\n originRef,\n applySelector: originRef,\n ...(version ? { versionConstraint: version } : {}),\n };\n }\n\n if (typeof entry.id === \"string\") {\n const version = typeof entry.version === \"string\" ? entry.version : undefined;\n const parsed = parseApmDependencyString(entry.id);\n const selector = version && parsed.sourceKind === \"catalog\"\n ? `${entry.id}@${version}`\n : parsed.applySelector;\n return {\n ...parsed,\n raw: JSON.stringify(entry),\n applySelector: selector,\n originRef: parsed.sourceKind === \"catalog\" ? selector : parsed.originRef,\n ...(version ? { versionConstraint: version, ref: parsed.ref ?? version } : {}),\n };\n }\n\n if (typeof entry.git === \"string\") {\n const ref = typeof entry.ref === \"string\" ? entry.ref : undefined;\n const parsed = parseApmDependencyString(ref ? `${entry.git}#${ref}` : entry.git);\n const path = typeof entry.path === \"string\" && entry.path.length > 0\n ? entry.path\n : undefined;\n return {\n ...parsed,\n raw: JSON.stringify(entry),\n originRef: cloneUrlFromOrigin(parsed.originRef),\n ...(ref ? { ref, versionConstraint: ref } : {}),\n ...(path ? { path } : {}),\n };\n }\n\n if (typeof entry.path === \"string\") {\n return parseApmDependencyString(entry.path);\n }\n\n throw new Error(\"dependencies.apm object must include git, id, path, or marketplace\");\n}\n\nexport function parseApmDependencyList(value: unknown): ParsedApmDependency[] {\n if (value === undefined) {\n return [];\n }\n if (!Array.isArray(value)) {\n throw new Error(\"dependencies.apm must be a list\");\n }\n return value.map(parseApmDependencyEntry);\n}\n\nfunction mcpTransport(value: unknown): \"stdio\" | \"http\" | undefined {\n if (value === \"stdio\") {\n return \"stdio\";\n }\n if (value === \"http\" || value === \"sse\" || value === \"streamable-http\") {\n return \"http\";\n }\n return undefined;\n}\n\nexport function parseMcpDependencyEntry(entry: unknown): ParsedMcpDependency {\n if (typeof entry === \"string\") {\n const trimmed = entry.trim();\n const name = trimmed.split(\"/\").filter(Boolean).pop() ?? trimmed;\n return {\n raw: trimmed,\n name,\n registryId: trimmed,\n selfDefined: false,\n };\n }\n if (!isRecord(entry)) {\n throw new Error(\"dependencies.mcp entries must be strings or mappings\");\n }\n\n const name = typeof entry.name === \"string\" && entry.name.length > 0\n ? entry.name\n : undefined;\n if (!name) {\n throw new Error(\"dependencies.mcp object must include a name\");\n }\n\n const registry = entry.registry;\n const selfDefined = registry === false;\n const argsRaw = entry.args;\n const args = Array.isArray(argsRaw) ? argsRaw.map((value) => String(value)) : undefined;\n\n return {\n raw: JSON.stringify(entry),\n name,\n ...(typeof registry === \"string\" ? { registryId: registry } : {}),\n ...(!selfDefined && typeof name === \"string\" && !registry ? { registryId: name } : {}),\n transport: mcpTransport(entry.transport),\n ...(typeof entry.command === \"string\" ? { command: entry.command } : {}),\n ...(args ? { args } : {}),\n ...(typeof entry.url === \"string\" ? { url: entry.url } : {}),\n ...(stringMap(entry.env) ? { env: stringMap(entry.env) } : {}),\n ...(stringMap(entry.headers) ? { headers: stringMap(entry.headers) } : {}),\n selfDefined,\n };\n}\n\nexport function parseMcpDependencyList(value: unknown): ParsedMcpDependency[] {\n if (value === undefined) {\n return [];\n }\n if (!Array.isArray(value)) {\n throw new Error(\"dependencies.mcp must be a list\");\n }\n return value.map(parseMcpDependencyEntry);\n}\n\nexport function collectRuntimeApmDependencies(\n document: Record<string, unknown>,\n): ParsedApmDependency[] {\n const dependencies = isRecord(document.dependencies) ? document.dependencies : {};\n return parseApmDependencyList(dependencies.apm);\n}\n\nexport function collectApmAndDevDependencies(document: Record<string, unknown>): {\n apm: ParsedApmDependency[];\n mcp: ParsedMcpDependency[];\n} {\n const dependencies = isRecord(document.dependencies) ? document.dependencies : {};\n const devDependencies = isRecord(document.devDependencies) ? document.devDependencies : {};\n return {\n apm: [\n ...parseApmDependencyList(dependencies.apm),\n ...parseApmDependencyList(devDependencies.apm),\n ],\n mcp: [\n ...parseMcpDependencyList(dependencies.mcp),\n ...parseMcpDependencyList(devDependencies.mcp),\n ],\n };\n}\n\nexport function isFilesystemApmDependency(dependency: ParsedApmDependency): boolean {\n if (dependency.sourceKind !== \"local\") {\n return false;\n }\n const origin = dependency.originRef;\n return (\n origin.startsWith(\"./\")\n || origin.startsWith(\"../\")\n || origin.startsWith(\"~/\")\n || origin.startsWith(\"/\")\n || origin.startsWith(\".\\\\\")\n || origin.startsWith(\"..\\\\\")\n || origin.startsWith(\"~\\\\\")\n );\n}\n","import { existsSync, lstatSync, mkdirSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { upsertPackageCacheEntry } from \"../models/package-cache-entry.js\";\nimport {\n apmGitLegacyPackagePaths,\n apmGitPackageDir,\n apmGitPackageRelativePath,\n} from \"./package-cache/paths.js\";\nimport semver from \"semver\";\nimport {\n DEFAULT_GIT_CLONE_TIMEOUT_MS,\n runCommandWithTimeout,\n} from \"../utils/run-command-with-timeout.js\";\nimport type { RunCommand } from \"../plugins/run-command.js\";\nimport {\n ensureGithubGitConfigArgs,\n githubHttpsRemoteForAuth,\n resolveGithubAccessToken,\n} from \"./github-credentials.js\";\nimport {\n BundleSymlinkError,\n assertContainedPath,\n hasParentTraversalSegment,\n} from \"../utils/path-containment.js\";\nimport type { ParsedApmDependency } from \"./apm-dependencies.js\";\nimport { cloneUrlFromOrigin } from \"./apm-dependencies.js\";\nimport type { LockEntry, Lockfile } from \"./lockfile.js\";\n\nexport type ApmGitRefKind = \"semver\" | \"literal\" | \"none\";\n\nexport class ApmGitResolveError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ApmGitResolveError\";\n }\n}\n\nexport interface ApmGitResolution {\n name: string;\n cloneUrl: string;\n repoUrl: string;\n commit: string;\n resolvedRef?: string;\n constraint?: string;\n resolvedTag?: string;\n resolvedAt?: string;\n virtualPath?: string;\n replayed: boolean;\n}\n\nexport interface ResolveApmGitOptions {\n update?: boolean;\n lock?: Lockfile;\n runCommand?: RunCommand;\n}\n\nconst FULL_SHA = /^[0-9a-f]{40}$/i;\nconst LITERAL_SEMVER_TAG = /^v?\\d+\\.\\d+\\.\\d+$/;\nconst RANGE_OPERATOR = /[\\^~><*=xX]| \\|\\|| - /;\n\nexport function classifyApmGitRef(ref?: string): ApmGitRefKind {\n if (!ref || ref.trim().length === 0) {\n return \"none\";\n }\n const trimmed = ref.trim();\n if (FULL_SHA.test(trimmed) || LITERAL_SEMVER_TAG.test(trimmed)) {\n return \"literal\";\n }\n if (semver.validRange(trimmed) && RANGE_OPERATOR.test(trimmed)) {\n return \"semver\";\n }\n return \"literal\";\n}\n\n/**\n * Canonical lockfile `repo_url`: host + repository path, no scheme or `.git`.\n * file:// remotes keep the path after stripping one trailing `.git`.\n */\nexport function canonicalApmRepoUrl(originRef: string): string {\n const cloneUrl = cloneUrlFromOrigin(originRef.trim());\n\n if (cloneUrl.startsWith(\"git@\")) {\n const match = cloneUrl.match(/^git@([^:]+):(.+)$/);\n if (match?.[1] && match[2]) {\n return `${match[1].toLowerCase()}/${stripGitSuffix(match[2])}`;\n }\n }\n\n const ssh = cloneUrl.match(/^ssh:\\/\\/git@([^/]+)\\/(.+)$/);\n if (ssh?.[1] && ssh[2]) {\n return `${hostWithoutDefaultPort(ssh[1])}/${stripGitSuffix(ssh[2])}`;\n }\n\n try {\n const parsed = new URL(cloneUrl);\n const host = hostWithoutDefaultPort(parsed.host);\n const path = stripGitSuffix(parsed.pathname.replace(/^\\/+/, \"\"));\n if (parsed.protocol === \"file:\") {\n return `file:///${path}`;\n }\n return host ? `${host}/${path}` : path;\n } catch {\n return stripGitSuffix(cloneUrl.replace(/^https?:\\/\\//, \"\"));\n }\n}\n\nfunction hostWithoutDefaultPort(host: string): string {\n const lowered = host.toLowerCase();\n return lowered\n .replace(/:443$/, \"\")\n .replace(/:22$/, \"\")\n .replace(/:80$/, \"\")\n .replace(/:9418$/, \"\");\n}\n\nfunction stripGitSuffix(value: string): string {\n const trimmed = value.replace(/\\/+$/, \"\");\n return trimmed.replace(/\\.git$/i, \"\");\n}\n\nexport function apmGitCacheDir(\n harnesstapDir: string,\n repoUrl: string,\n commit: string,\n): string {\n const modern = apmGitPackageDir(harnesstapDir, repoUrl, commit);\n if (existsSync(modern)) {\n return modern;\n }\n for (const legacy of apmGitLegacyPackagePaths(harnesstapDir, repoUrl, commit)) {\n if (existsSync(legacy)) {\n return legacy;\n }\n }\n return modern;\n}\n\nexport function recordApmGitPackageCacheEntry(input: {\n harnesstapDir: string;\n repoUrl: string;\n commit: string;\n originRef: string;\n}): void {\n upsertPackageCacheEntry({\n kind: \"apm_git\",\n origin_ref: input.originRef,\n resolved_key: input.commit.toLowerCase(),\n relative_path: apmGitPackageRelativePath(input.repoUrl, input.commit),\n });\n}\n\nexport function assertSafeApmVirtualPath(path: string): void {\n const normalized = path.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\");\n if (!normalized || normalized === \".\") {\n throw new ApmGitResolveError(\"dependencies.apm path must be a non-empty repository subpath\");\n }\n if (normalized.startsWith(\"/\") || hasParentTraversalSegment(normalized)) {\n throw new ApmGitResolveError(\n `Unsafe dependencies.apm path ${path}: apply aborted closed`,\n );\n }\n assertContainedPath(\".\", normalized);\n}\n\nconst VIRTUAL_FILE_SUFFIXES = [\".prompt.md\", \".instructions.md\", \".agent.md\"] as const;\n\nexport function isApmVirtualFilePath(path: string): boolean {\n const lowered = path.replaceAll(\"\\\\\", \"/\").toLowerCase();\n return VIRTUAL_FILE_SUFFIXES.some((suffix) => lowered.endsWith(suffix));\n}\n\nexport function assertCheckoutPathSafe(checkoutRoot: string, relativePath: string): string {\n assertSafeApmVirtualPath(relativePath);\n const absolute = join(checkoutRoot, relativePath);\n if (lstatSync(absolute).isSymbolicLink()) {\n throw new BundleSymlinkError(relativePath);\n }\n assertContainedPath(checkoutRoot, relativePath);\n return absolute;\n}\n\ninterface RemoteRef {\n sha: string;\n name: string;\n peeled: boolean;\n}\n\nfunction runGit(\n run: RunCommand,\n args: string[],\n cwd?: string,\n): { stdout: string; stderr: string; exitCode: number } {\n return run(\"git\", ensureGithubGitConfigArgs(args), {\n timeoutMs: DEFAULT_GIT_CLONE_TIMEOUT_MS,\n ...(cwd ? { cwd } : {}),\n });\n}\n\nfunction parseLsRemote(stdout: string): RemoteRef[] {\n const refs: RemoteRef[] = [];\n for (const line of stdout.split(\"\\n\")) {\n const tab = line.indexOf(\"\\t\");\n if (tab <= 0) continue;\n const sha = line.slice(0, tab).trim().toLowerCase();\n const rawName = line.slice(tab + 1).trim();\n if (!FULL_SHA.test(sha) || !rawName) continue;\n const peeled = rawName.endsWith(\"^{}\");\n const name = peeled ? rawName.slice(0, -3) : rawName;\n refs.push({ sha, name, peeled });\n }\n return refs;\n}\n\nfunction shaForRefName(refs: RemoteRef[], name: string): string | undefined {\n const matches = refs.filter((entry) => entry.name === name || entry.name.endsWith(`/${name}`));\n const peeled = matches.find((entry) => entry.peeled);\n return peeled?.sha ?? matches[0]?.sha;\n}\n\nfunction tagSemver(tagName: string): { tag: string; version: string } | undefined {\n const name = tagName.replace(/^refs\\/tags\\//, \"\");\n const withoutV = name.startsWith(\"v\") ? name.slice(1) : name;\n if (!semver.valid(withoutV)) {\n return undefined;\n }\n return { tag: name, version: withoutV };\n}\n\nexport function selectSemverTag(\n range: string,\n tagNames: string[],\n): { tag: string; version: string } | undefined {\n const candidates: Array<{ tag: string; version: string }> = [];\n for (const tagName of tagNames) {\n const parsed = tagSemver(tagName);\n if (!parsed) continue;\n if (!semver.satisfies(parsed.version, range, { includePrerelease: false })) {\n continue;\n }\n candidates.push(parsed);\n }\n if (candidates.length === 0) {\n return undefined;\n }\n candidates.sort((left, right) => {\n const byVersion = semver.rcompare(left.version, right.version);\n if (byVersion !== 0) return byVersion;\n return right.tag < left.tag ? -1 : right.tag > left.tag ? 1 : 0;\n });\n return candidates[0];\n}\n\nfunction authorizedGitRemote(url: string): string {\n return githubHttpsRemoteForAuth(url, resolveGithubAccessToken().token);\n}\n\nfunction listRemoteTags(run: RunCommand, cloneUrl: string): RemoteRef[] {\n const remote = authorizedGitRemote(cloneUrl);\n const result = runGit(run, [\"ls-remote\", \"--tags\", remote]);\n if (result.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to list tags for ${cloneUrl}: ${result.stderr.trim() || \"git ls-remote failed\"}`,\n );\n }\n return parseLsRemote(result.stdout);\n}\n\nfunction resolveLiteralRef(run: RunCommand, cloneUrl: string, ref: string): string {\n if (FULL_SHA.test(ref)) {\n const probe = runGit(run, [\"ls-remote\", authorizedGitRemote(cloneUrl), ref]);\n if (probe.exitCode === 0) {\n const parsed = parseLsRemote(probe.stdout);\n const sha = parsed[0]?.sha ?? ref.toLowerCase();\n if (FULL_SHA.test(sha)) {\n return sha;\n }\n }\n return ref.toLowerCase();\n }\n\n const listed = runGit(run, [\"ls-remote\", authorizedGitRemote(cloneUrl), ref, `refs/heads/${ref}`, `refs/tags/${ref}`]);\n if (listed.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to resolve ${ref} for ${cloneUrl}: ${listed.stderr.trim() || \"git ls-remote failed\"}`,\n );\n }\n const refs = parseLsRemote(listed.stdout);\n const sha =\n shaForRefName(refs, `refs/tags/${ref}`)\n ?? shaForRefName(refs, `refs/heads/${ref}`)\n ?? shaForRefName(refs, ref)\n ?? refs[0]?.sha;\n if (!sha) {\n throw new ApmGitResolveError(\n `Could not resolve git ref ${ref} for ${cloneUrl}: apply aborted closed`,\n );\n }\n return sha;\n}\n\nfunction resolveHead(run: RunCommand, cloneUrl: string): string {\n const result = runGit(run, [\"ls-remote\", authorizedGitRemote(cloneUrl), \"HEAD\"]);\n if (result.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to resolve HEAD for ${cloneUrl}: ${result.stderr.trim() || \"git ls-remote failed\"}`,\n );\n }\n const sha = parseLsRemote(result.stdout)[0]?.sha;\n if (!sha) {\n throw new ApmGitResolveError(\n `Could not resolve HEAD for ${cloneUrl}: apply aborted closed`,\n );\n }\n return sha;\n}\n\nfunction lockMatchesDependency(entry: LockEntry, dependency: ParsedApmDependency): boolean {\n const repoUrl = canonicalApmRepoUrl(dependency.originRef);\n if (entry.repo_url && entry.repo_url !== repoUrl) {\n return false;\n }\n if (!entry.repo_url && entry.name !== dependency.name) {\n return false;\n }\n const lockedPath = entry.virtual_path ?? \"\";\n const declaredPath = dependency.path ?? \"\";\n return lockedPath === declaredPath;\n}\n\nfunction findLockedGit(lock: Lockfile | undefined, dependency: ParsedApmDependency): LockEntry | undefined {\n if (!lock) return undefined;\n return lock.plugins.find((entry) => lockMatchesDependency(entry, dependency));\n}\n\nfunction canReplayLock(\n entry: LockEntry,\n dependency: ParsedApmDependency,\n kind: ApmGitRefKind,\n): boolean {\n if (!entry.resolved_commit || !FULL_SHA.test(entry.resolved_commit)) {\n return false;\n }\n if (kind === \"none\") {\n return true;\n }\n if (kind === \"semver\") {\n const constraint = dependency.versionConstraint ?? dependency.ref ?? \"\";\n return Boolean(entry.constraint && entry.constraint === constraint);\n }\n const declared = dependency.ref ?? dependency.versionConstraint ?? \"\";\n const locked = entry.resolved_ref ?? \"\";\n if (!declared && !locked) {\n return true;\n }\n return declared === locked;\n}\n\nexport function resolveApmGitDependency(\n dependency: ParsedApmDependency,\n options: ResolveApmGitOptions = {},\n): ApmGitResolution {\n if (dependency.sourceKind !== \"git\") {\n throw new ApmGitResolveError(`Expected a git dependency, got ${dependency.sourceKind}`);\n }\n if (dependency.path) {\n assertSafeApmVirtualPath(dependency.path);\n }\n\n const cloneUrl = cloneUrlFromOrigin(dependency.originRef);\n const repoUrl = canonicalApmRepoUrl(cloneUrl);\n const kind = classifyApmGitRef(dependency.ref ?? dependency.versionConstraint);\n const locked = options.update ? undefined : findLockedGit(options.lock, dependency);\n\n if (locked && canReplayLock(locked, dependency, kind)) {\n const lockedCommit = locked.resolved_commit;\n if (!lockedCommit || !FULL_SHA.test(lockedCommit)) {\n throw new ApmGitResolveError(\n `Lock entry for ${dependency.originRef} is missing a resolved commit: apply aborted closed`,\n );\n }\n return {\n name: dependency.name,\n cloneUrl,\n repoUrl,\n commit: lockedCommit.toLowerCase(),\n ...(locked.resolved_ref ? { resolvedRef: locked.resolved_ref } : {}),\n ...(locked.constraint ? { constraint: locked.constraint } : {}),\n ...(locked.resolved_tag ? { resolvedTag: locked.resolved_tag } : {}),\n ...(dependency.path ? { virtualPath: dependency.path } : {}),\n replayed: true,\n };\n }\n\n const run = options.runCommand ?? runCommandWithTimeout;\n\n if (kind === \"semver\") {\n const constraint = dependency.ref ?? dependency.versionConstraint ?? \"\";\n const tags = listRemoteTags(run, cloneUrl);\n const tagNames = [...new Set(tags.map((entry) => entry.name.replace(/^refs\\/tags\\//, \"\")))];\n const selected = selectSemverTag(constraint, tagNames);\n if (!selected) {\n throw new ApmGitResolveError(\n `No git tag satisfies ${constraint} for ${cloneUrl}: apply aborted closed`,\n );\n }\n const sha =\n shaForRefName(tags, `refs/tags/${selected.tag}`)\n ?? resolveLiteralRef(run, cloneUrl, selected.tag);\n return {\n name: dependency.name,\n cloneUrl,\n repoUrl,\n commit: sha,\n resolvedRef: constraint,\n constraint,\n resolvedTag: selected.tag,\n resolvedAt: new Date().toISOString(),\n ...(dependency.path ? { virtualPath: dependency.path } : {}),\n replayed: false,\n };\n }\n\n if (kind === \"none\") {\n const commit = resolveHead(run, cloneUrl);\n return {\n name: dependency.name,\n cloneUrl,\n repoUrl,\n commit,\n ...(dependency.path ? { virtualPath: dependency.path } : {}),\n replayed: false,\n };\n }\n\n const ref = dependency.ref ?? dependency.versionConstraint ?? \"\";\n const commit = resolveLiteralRef(run, cloneUrl, ref);\n return {\n name: dependency.name,\n cloneUrl,\n repoUrl,\n commit,\n resolvedRef: ref,\n ...(dependency.path ? { virtualPath: dependency.path } : {}),\n replayed: false,\n };\n}\n\nexport function checkoutApmGitCommit(\n resolution: ApmGitResolution,\n targetDir: string,\n runCommand: RunCommand = runCommandWithTimeout,\n): string {\n if (existsSync(join(targetDir, \".git\"))) {\n const current = runGit(runCommand, [\"-C\", targetDir, \"rev-parse\", \"HEAD\"]);\n if (current.exitCode === 0 && current.stdout.trim().toLowerCase() === resolution.commit) {\n return targetDir;\n }\n }\n\n if (existsSync(targetDir)) {\n rmSync(targetDir, { recursive: true, force: true });\n }\n mkdirSync(targetDir, { recursive: true });\n\n const init = runGit(runCommand, [\"init\", \"--quiet\", targetDir]);\n if (init.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to initialize checkout for ${resolution.cloneUrl}: ${init.stderr.trim()}`,\n );\n }\n const remote = runGit(runCommand, [\"-C\", targetDir, \"remote\", \"add\", \"origin\", authorizedGitRemote(resolution.cloneUrl)]);\n if (remote.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to add origin ${resolution.cloneUrl}: ${remote.stderr.trim()}`,\n );\n }\n\n let fetch = runGit(runCommand, [\n \"-C\",\n targetDir,\n \"fetch\",\n \"--depth\",\n \"1\",\n \"origin\",\n resolution.commit,\n ]);\n if (fetch.exitCode !== 0) {\n fetch = runGit(runCommand, [\"-C\", targetDir, \"fetch\", \"origin\", resolution.commit]);\n }\n if (fetch.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to fetch ${resolution.commit} from ${resolution.cloneUrl}: ${fetch.stderr.trim() || \"git fetch failed\"}`,\n );\n }\n\n const checkout = runGit(runCommand, [\"-C\", targetDir, \"checkout\", \"--quiet\", \"FETCH_HEAD\"]);\n if (checkout.exitCode !== 0) {\n throw new ApmGitResolveError(\n `Failed to checkout ${resolution.commit}: ${checkout.stderr.trim() || \"git checkout failed\"}`,\n );\n }\n\n const head = runGit(runCommand, [\"-C\", targetDir, \"rev-parse\", \"HEAD\"]);\n const sha = head.stdout.trim().toLowerCase();\n if (head.exitCode !== 0 || sha !== resolution.commit) {\n throw new ApmGitResolveError(\n `Checkout HEAD ${sha || \"(unknown)\"} does not match resolved commit ${resolution.commit}: apply aborted closed`,\n );\n }\n return targetDir;\n}\n\nexport function resolveAndFetchApmGitDependency(\n dependency: ParsedApmDependency,\n harnesstapDir: string,\n options: ResolveApmGitOptions = {},\n): ApmGitResolution & { checkoutRoot: string } {\n const resolution = resolveApmGitDependency(dependency, options);\n const checkoutRoot = checkoutApmGitCommit(\n resolution,\n apmGitCacheDir(harnesstapDir, resolution.repoUrl, resolution.commit),\n options.runCommand,\n );\n recordApmGitPackageCacheEntry({\n harnesstapDir,\n repoUrl: resolution.repoUrl,\n commit: resolution.commit,\n originRef: dependency.originRef,\n });\n return { ...resolution, checkoutRoot };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,SAAS,OAAkD;AAClE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,aAAa,OAA+C;AACnE,QAAM,OAAO,MAAM,YAAY,GAAG;AAClC,MAAI,QAAQ,GAAG;AACb,WAAO,EAAE,MAAM,MAAM;AAAA,EACvB;AACA,QAAM,OAAO,MAAM,MAAM,GAAG,IAAI;AAChC,QAAM,MAAM,MAAM,MAAM,OAAO,CAAC;AAChC,MAAI,CAAC,QAAQ,CAAC,KAAK;AACjB,WAAO,EAAE,MAAM,MAAM;AAAA,EACvB;AACA,SAAO,EAAE,MAAM,IAAI;AACrB;AAEA,SAAS,mBAAmB,OAAuB;AACjD,QAAM,aAAa,MAAM,QAAQ,UAAU,EAAE;AAC7C,QAAM,OAAO,WAAW,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,IAAI,KAAK;AAC5D,SAAO,KAAK,MAAM,GAAG,EAAE,IAAI,KAAK;AAClC;AAEA,SAAS,cAAc,SAA0B;AAC/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AAM,aAAa,wBAAwB,YAAY,OAAO;AAC9D,QAAM,eAAe;AAAA,IACnB;AAAA,IACA,eAAe,eAAe,WAAW,SAAS,WAAW,MAAM;AAAA,IACnE,QAAQ;AAAA,EACV;AACA,gCAA8B;AAAA,IAC5B;AAAA,IACA,SAAS,WAAW;AAAA,IACpB,QAAQ,WAAW;AAAA,IACnB,WAAW,WAAW;AAAA,EACxB,CAAC;AACD,SAAO,EAAE,GAAG,YAAY,aAAa;AACvC;","names":["name","sha","commit"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/copy/scope.ts","../src/cli/commands/profile-live-files.ts","../src/services/profile-file-diff.ts","../src/services/profile-apply-preview.ts","../src/services/apply-preview-inherited.ts","../src/services/profile-remove-resource.ts","../src/services/profile-restore-file.ts","../src/cli/handlers/profile-live-files.ts","../src/cli/commands/profile-preview.ts","../src/cli/commands/parity-register.ts"],"sourcesContent":["import { getPlatform } from \"../platforms/registry.js\";\nimport type { HarnessScope } from \"../services/harness-scope.js\";\n\n/** DS-1 scope copy. ASCII punctuation only. */\n\nexport const SCOPE_COPY = {\n appliesToAll: \"Applies to all your harnesses\",\n notSetUp: \"Not set up for any harness yet\",\n detectHarnesses: \"Detect harnesses\",\n foundInSettingsSuffix: \"Found in its settings.\",\n useOn: \"Use on\",\n selectAll: \"Select all\",\n none: \"None\",\n emptyHint: \"Pick at least one harness\",\n linkedTooltip: \"These read the same folder, so they share one setting\",\n allTooltip: \"On all harnesses. Pick which ones\",\n orphanedTooltip: \"Its harnesses are gone. Pick new ones\",\n main: \"Main\",\n mainTooltip: \"Your main harness. It wins when harnesses disagree.\",\n alsoUseOnPrefix: \"Also use on\",\n notNow: \"Not now\",\n willWrite: \"Will write\",\n upToDate: \"Up to date\",\n notInProfile: \"Not in profile\",\n willRemove: \"Will remove\",\n keptYouChanged: \"Kept. You changed it.\",\n keptNotMadeByHarnessTap: \"Kept. Not made by HarnessTap.\",\n} as const;\n\nexport function harnessDisplayName(id: string): string {\n return getPlatform(id)?.name ?? id;\n}\n\n/** Join display names: \"A and B\" / \"A, B and C\". */\nexport function formatHarnessList(names: readonly string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n if (names.length === 1) {\n return names[0] ?? \"\";\n }\n if (names.length === 2) {\n return `${names[0]} and ${names[1]}`;\n }\n return `${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\nexport function formatHarnessIds(ids: readonly string[]): string {\n return formatHarnessList(ids.map(harnessDisplayName));\n}\n\n/**\n * Subset scope line: \"Only on Claude Code and Codex\",\n * or \"Only on Claude Code, Codex, Cursor and {n} more\" for 4+.\n */\nexport function subsetScopeLine(ids: readonly string[]): string {\n if (ids.length === 0) {\n return SCOPE_COPY.notSetUp;\n }\n if (ids.length <= 3) {\n return `Only on ${formatHarnessIds(ids)}`;\n }\n const visible = ids.slice(0, 3).map(harnessDisplayName);\n const extra = ids.length - visible.length;\n return `Only on ${visible.join(\", \")} and ${extra} more`;\n}\n\nexport function scopeLine(\n scope: HarnessScope,\n options?: { originPortable?: boolean },\n): string {\n if (scope.kind === \"all\") {\n return SCOPE_COPY.appliesToAll;\n }\n const line = subsetScopeLine(scope.harnesses);\n if (options?.originPortable && scope.harnesses.length === 1) {\n return `${line}. ${SCOPE_COPY.foundInSettingsSuffix}`;\n }\n return line;\n}\n\nexport function alsoUseOnLabel(ids: readonly string[]): string {\n if (ids.length <= 3) {\n return `${SCOPE_COPY.alsoUseOnPrefix} ${formatHarnessIds(ids)}`;\n }\n const visible = ids.slice(0, 3).map(harnessDisplayName);\n const extra = ids.length - visible.length;\n return `${SCOPE_COPY.alsoUseOnPrefix} ${visible.join(\", \")} and ${extra} more`;\n}\n\nexport function portableMcpTooltip(ids: readonly string[]): string {\n return `This server works anywhere. Add it to ${formatHarnessIds(ids)} too.`;\n}\n\nexport function nowOnToast(ids: readonly string[]): string {\n return `Now on ${formatHarnessIds(ids)}`;\n}\n\nexport function skippedNotUsedOnFooter(count: number, harnessId: string): string {\n return `${count} skipped. Not used on ${harnessDisplayName(harnessId)}.`;\n}\n\nexport function portableScopeTip(input: {\n resourceName: string;\n targetIds: readonly string[];\n command: string;\n}): string {\n return `Tip: \"${input.resourceName}\" also works on ${formatHarnessIds(input.targetIds)}. Run ${input.command}.`;\n}\n","import { Option, type Command } from \"commander\";\nimport { isPromptCancellationError } from \"../../services/wizards/shared.js\";\nimport { CliUsageError } from \"../../services/cli-errors.js\";\nimport { COMMAND_HELP_REGISTRY } from \"../../services/cli-help-registry.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { fail } from \"../shared.js\";\nimport {\n handleProfileAddAllResourcesCommand,\n handleProfileAddResourceCommand,\n handleProfileCommitResourceCommand,\n handleProfileFileDiffCommand,\n handleProfileRemoveResourceCommand,\n handleProfileRestoreFileCommand,\n} from \"../handlers/profile-live-files.js\";\n\nfunction addFormatInteractiveOptions(cmd: Command): Command {\n return cmd\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .option(\"--interactive\", \"Enable interactive prompts\");\n}\n\nfunction addLiveScopeOptions(cmd: Command): Command {\n return addFormatInteractiveOptions(cmd)\n .addOption(\n new Option(\"--scope <home|project>\", \"home or project\")\n .choices([\"home\", \"project\"])\n .makeOptionMandatory(),\n )\n .option(\"--project <path>\", \"Project path (required when --scope project)\")\n .option(\"--harness <slug>\", \"Harness slug\");\n}\n\nasync function runLiveAction(work: () => Promise<void>): Promise<void> {\n try {\n await work();\n } catch (err) {\n if (isPromptCancellationError(err)) {\n ui.info(\"Operation cancelled.\");\n process.exitCode = 0;\n return;\n }\n process.exitCode = 1;\n if (err instanceof CliUsageError) {\n renderCliError(err);\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n}\n\nfunction assignLiveFileHelp(): void {\n COMMAND_HELP_REGISTRY[\"profile.add-resource\"] = {\n description: \"Adopt one untracked on-disk resource into the profile library\",\n examples: [\n \"profile add-resource work --selector skill:foo --scope home\",\n \"profile add-resource work --selector skill:foo --scope project --project . --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.add-all-resources\"] = {\n description: \"Adopt every untracked material resource in the scope\",\n examples: [\n \"profile add-all-resources work --scope home\",\n \"profile add-all-resources work --scope project --project . --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.commit-resource\"] = {\n description: \"Snapshot live disk into the profile library\",\n examples: [\n \"profile commit-resource work --path .claude/skills/foo/SKILL.md --scope home\",\n \"profile commit-resource work --selector skill:foo --scope home --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.remove-resource\"] = {\n description: \"Detach a material resource from the profile stack\",\n examples: [\n \"profile remove-resource work --selector skill:foo -y\",\n \"profile remove-resource work --selector skill:foo --format json -y\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.restore-file\"] = {\n description: \"Overwrite the live managed file with the profile snapshot\",\n examples: [\n \"profile restore-file work --path .claude/skills/foo/SKILL.md --scope home -y\",\n \"profile restore-file work --path .claude/skills/foo/SKILL.md --scope home --format json -y\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.file-diff\"] = {\n description: \"Show live content vs after-apply (profile) as a unified diff\",\n examples: [\n \"profile file-diff work --path .claude/skills/foo/SKILL.md --scope home\",\n \"profile file-diff work --path .claude/skills/foo/SKILL.md --scope home --format json\",\n ],\n };\n}\n\nexport function registerProfileLiveFileCommands(profileCmd: Command): void {\n assignLiveFileHelp();\n\n addLiveScopeOptions(\n profileCmd\n .command(\"add-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--selector <type:name>\", \"Resource selector\")\n .description(\"Adopt one untracked on-disk resource into the profile library\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileAddResourceCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"add-all-resources\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .description(\"Adopt every untracked material resource in the scope\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileAddAllResourcesCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"commit-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .option(\"--path <path>\", \"Managed relative path\")\n .option(\"--selector <type:name>\", \"Resource selector\")\n .description(\"Snapshot live disk into the profile library\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileCommitResourceCommand(name, opts));\n });\n\n addFormatInteractiveOptions(\n profileCmd\n .command(\"remove-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--selector <type:name>\", \"Resource selector\")\n .option(\"--plugin-id <id>\", \"Plugin id in the profile stack\")\n .option(\"-y, --yes\", \"Skip the confirmation prompt\")\n .description(\"Detach a material resource from the profile stack\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileRemoveResourceCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"restore-file\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--path <path>\", \"Managed relative path\")\n .option(\"-y, --yes\", \"Skip the confirmation prompt\")\n .description(\"Overwrite the live managed file with the profile snapshot\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileRestoreFileCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"file-diff\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--path <path>\", \"Managed relative path\")\n .description(\"Show live content vs after-apply (profile) as a unified diff\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileFileDiffCommand(name, opts));\n });\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\nimport {\n collectExpectedManagedFiles,\n type ProfileApplyPreviewScope,\n} from \"./profile-apply-preview.js\";\nimport {\n isMcpConfigManagedPath,\n resourceKeyFromManagedPath,\n} from \"./profile-commit-resource.js\";\nimport { scopeHostConfigToResource } from \"./host-config-resource-detail.js\";\nimport { scopeMcpConfigToServer } from \"./mcp-resource-detail.js\";\nimport { isMergeableHostConfigPath } from \"./merged-host-config.js\";\nimport { normalizeManagedPath } from \"./profile-untracked-resources.js\";\n\nexport interface ManagedFileDiff {\n path: string;\n absolute_path: string;\n /** Expected content from the profile (last applied / would-apply snapshot). */\n expected: string;\n /** Current on-disk content, or null if the file is missing. */\n current: string | null;\n}\n\nconst ONE_TO_ONE_DIFF_TYPES = new Set([\"skill\", \"agent\", \"command\", \"rule\", \"instruction\"]);\nconst HOST_CONFIG_DIFF_TYPES = new Set([\"permission\", \"hook\", \"env_var\"]);\n\nfunction readLiveFile(absolutePath: string): string | null {\n if (!existsSync(absolutePath)) {\n return null;\n }\n try {\n return readFileSync(absolutePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction namesEqualIgnoreCase(left: string, right: string): boolean {\n return left.toLowerCase() === right.toLowerCase();\n}\n\nfunction pathsReferToSameManagedFile(\n left: string,\n right: string,\n rootPath: string,\n): boolean {\n const a = normalizeManagedPath(left, rootPath);\n const b = normalizeManagedPath(right, rootPath);\n if (a === b) {\n return true;\n }\n return a.endsWith(`/${b}`) || b.endsWith(`/${a}`);\n}\n\nfunction resolveLiveAbsolute(path: string, rootPath: string): string {\n const normalized = normalizeManagedPath(path, rootPath);\n if (isAbsolute(normalized)) {\n return normalized;\n }\n return join(rootPath, normalized);\n}\n\nfunction resourceMatchesFile(\n resource: { type: string; name: string },\n filePath: string,\n rootPath: string,\n): boolean {\n const mapped = resourceKeyFromManagedPath(filePath, rootPath);\n return (\n mapped !== null\n && mapped.type === resource.type\n && namesEqualIgnoreCase(mapped.name, resource.name)\n );\n}\n\nfunction findExpectedManagedFile(input: {\n expectedFiles: Array<{ path: string; content: string }>;\n requestedPath: string;\n rootPath: string;\n resource?: { type: string; name: string };\n}): { path: string; content: string } | undefined {\n const byPath = input.expectedFiles.find((file) =>\n pathsReferToSameManagedFile(file.path, input.requestedPath, input.rootPath),\n );\n const resource = input.resource;\n if (!resource?.type || !resource.name.trim()) {\n return byPath;\n }\n\n const byIdentity = input.expectedFiles.find((file) =>\n resourceMatchesFile(resource, file.path, input.rootPath),\n );\n\n if (ONE_TO_ONE_DIFF_TYPES.has(resource.type)) {\n if (byPath && resourceMatchesFile(resource, byPath.path, input.rootPath)) {\n return byPath;\n }\n return byIdentity ?? byPath;\n }\n\n if (resource.type === \"mcp_server\") {\n if (byPath && isMcpConfigManagedPath(byPath.path, input.rootPath)) {\n return byPath;\n }\n return (\n input.expectedFiles.find((file) =>\n isMcpConfigManagedPath(file.path, input.rootPath),\n )\n ?? byPath\n );\n }\n\n if (HOST_CONFIG_DIFF_TYPES.has(resource.type)) {\n if (byPath && isMergeableHostConfigPath(byPath.path)) {\n return byPath;\n }\n return (\n input.expectedFiles.find((file) => isMergeableHostConfigPath(file.path))\n ?? byPath\n );\n }\n\n return byIdentity ?? byPath;\n}\n\nfunction resolveCurrentAbsolute(input: {\n requestedPath: string;\n matchPath: string;\n rootPath: string;\n resource?: { type: string; name: string };\n}): string {\n const matchAbs = join(\n input.rootPath,\n normalizeManagedPath(input.matchPath, input.rootPath),\n );\n const requestedAbs = resolveLiveAbsolute(input.requestedPath, input.rootPath);\n if (input.resource && ONE_TO_ONE_DIFF_TYPES.has(input.resource.type)) {\n return matchAbs;\n }\n if (existsSync(requestedAbs)) {\n return requestedAbs;\n }\n return matchAbs;\n}\n\nfunction applyResourceScope(input: {\n relativePath: string;\n rootPath: string;\n expected: string;\n current: string | null;\n resource?: { type: string; name: string };\n}): { expected: string; current: string | null } {\n const resourceName = input.resource?.name.trim() ?? \"\";\n const resourceType = input.resource?.type ?? \"\";\n if (!resourceName || !resourceType) {\n return { expected: input.expected, current: input.current };\n }\n\n if (\n resourceType === \"mcp_server\"\n && isMcpConfigManagedPath(input.relativePath, input.rootPath)\n ) {\n return {\n expected: scopeMcpConfigToServer(input.expected, resourceName) ?? input.expected,\n current: scopeMcpConfigToServer(input.current, resourceName),\n };\n }\n\n if (\n HOST_CONFIG_DIFF_TYPES.has(resourceType)\n && isMergeableHostConfigPath(input.relativePath)\n ) {\n const resource = { type: resourceType, name: resourceName };\n return {\n expected: scopeHostConfigToResource(input.expected, resource) ?? input.expected,\n current: scopeHostConfigToResource(input.current, resource),\n };\n }\n\n return { expected: input.expected, current: input.current };\n}\n\nexport async function getManagedFileDiff(input: {\n profileSelector: string;\n path: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n resource?: { type: string; name: string };\n}): Promise<ManagedFileDiff> {\n const profile = input.profileSelector.trim();\n const requestedPath = input.path.trim();\n\n const collected = await collectExpectedManagedFiles({\n profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (collected.warning) {\n throw new Error(collected.warning);\n }\n\n const match = findExpectedManagedFile({\n expectedFiles: collected.expectedFiles,\n requestedPath,\n rootPath: collected.rootPath,\n ...(input.resource ? { resource: input.resource } : {}),\n });\n\n if (!match) {\n const liveAbsolute = resolveLiveAbsolute(requestedPath, collected.rootPath);\n if (\n input.resource?.type === \"agent\"\n && readLiveFile(liveAbsolute) !== null\n ) {\n const relativePath = normalizeManagedPath(liveAbsolute, collected.rootPath);\n const live = readLiveFile(liveAbsolute) ?? \"\";\n return {\n path: relativePath,\n absolute_path: liveAbsolute,\n expected: live,\n current: live,\n };\n }\n throw new Error(`Path is not a managed file for this profile: ${input.path}`);\n }\n\n const relativePath = normalizeManagedPath(match.path, collected.rootPath);\n const absolutePath = resolveCurrentAbsolute({\n requestedPath,\n matchPath: match.path,\n rootPath: collected.rootPath,\n ...(input.resource ? { resource: input.resource } : {}),\n });\n const scoped = applyResourceScope({\n relativePath,\n rootPath: collected.rootPath,\n expected: match.content,\n current: readLiveFile(absolutePath),\n ...(input.resource ? { resource: input.resource } : {}),\n });\n\n return {\n path: relativePath,\n absolute_path: absolutePath,\n expected: scoped.expected,\n current: scoped.current,\n };\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { isEmptyBuiltinProfile, isProfilePlugin } from \"../constants/profile.js\";\nimport { resolvePluginSelector } from \"../models/plugin-model.js\";\nimport { getProjectByLocalPath, getProjectByOrigin } from \"../models/project.js\";\nimport { getLatestSnapshot } from \"../models/snapshot.js\";\nimport type { McpServerMetadata, Resource } from \"../types.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport { generateFiles } from \"./applier.js\";\nimport {\n collectOwnedPreviewResources,\n expectedFileMatchesLiveForPreview,\n omitInheritedPluginFileChanges,\n} from \"./apply-preview-inherited.js\";\nimport {\n buildHostManagedStatus,\n type HostManagedStatus,\n profileSkillNameMap,\n} from \"./cursor-host-managed-skills.js\";\nimport { fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { getGitOrigin, normalizeGitUrl } from \"./git.js\";\nimport {\n buildHarnessLiveStatusMap,\n declaredMcpFromExpectedFiles,\n type HarnessLiveStatus,\n} from \"./global-profile-status-panel.js\";\nimport {\n isMergeableHostConfigPath,\n} from \"./merged-host-config.js\";\nimport { mergePluginsForApply } from \"./plugin-apply-merge.js\";\nimport {\n type ApplyProfilePluginResult,\n applyProfilePlugin,\n clearGlobalProfileApply,\n collectProfilePluginIds,\n} from \"./profile-apply.js\";\nimport { resourceKeyFromManagedPath } from \"./profile-commit-resource.js\";\nimport {\n buildProfileContents,\n type ProfileContents,\n type ProfileContentsResource,\n} from \"./profile-contents.js\";\nimport { detectNotStagedProfileResources } from \"./profile-untracked-resources.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\nimport {\n type RecoveryAction,\n SingletonConflictError,\n UnsatisfiableConstraintError,\n} from \"./resolve/types.js\";\nimport {\n emptyPlannedRemovals,\n groupPlannedRemovals,\n type PlannedRemovalGroup,\n type PlannedRemovals,\n planSafeFileRemovals,\n} from \"./safe-file-removal.js\";\nimport { detectPlatforms } from \"./scanner.js\";\nimport { withAffectedResources } from \"./scoped-file-content-delta.js\";\n\nexport type ProfileApplyPreviewScope = \"home\" | \"project\";\n\nexport interface ProfileApplyPreviewRequest {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}\n\nexport interface ProfileApplyPreview {\n profile: string;\n scope: ProfileApplyPreviewScope;\n contents: ProfileContents | null;\n harnesses?: Record<string, HarnessLiveStatus>;\n /** Material resources on disk not attached to the target profile (not staged). */\n not_staged: ProfileContentsResource[];\n /** @deprecated Use not_staged. */\n untracked_resources: ProfileContentsResource[];\n files: {\n expected_count: number;\n /** File changes for tracked (profile-managed) paths only. */\n changes: DriftFileChange[];\n root_path: string;\n /** Resource identities owned by the target apply set (including inherited plugin material). */\n owned_resources?: Array<{ type: string; name: string }>;\n };\n /** Planned whole-file removals grouped by ownership (DT-3). */\n removals: PlannedRemovals;\n relative_to_active: boolean;\n warning?: string;\n recovery_actions?: RecoveryAction[];\n /** App-managed inventory for home scope; never applied or persisted. */\n host_managed?: HostManagedStatus;\n}\n\nfunction warningFromError(error: unknown): {\n warning: string;\n recovery_actions?: RecoveryAction[];\n} {\n if (error instanceof UnsatisfiableConstraintError) {\n return {\n warning: error.message,\n recovery_actions: error.actions,\n };\n }\n if (error instanceof SingletonConflictError) {\n return {\n warning: error.message,\n recovery_actions: error.actions,\n };\n }\n return {\n warning: error instanceof Error ? error.message : String(error),\n };\n}\n\nfunction notProfileWarning(pluginName: string): {\n warning: string;\n recovery_actions: RecoveryAction[];\n} {\n return {\n warning: `plugin \"${pluginName}\" is not tagged as a profile`,\n recovery_actions: [\n {\n id: \"tag-as-profile\",\n label: `Tag ${pluginName} as a profile`,\n pluginName,\n },\n ],\n };\n}\n\nfunction spreadWarningFields(input: {\n warning?: string;\n recovery_actions?: RecoveryAction[];\n}): { warning?: string; recovery_actions?: RecoveryAction[] } {\n return {\n ...(input.warning ? { warning: input.warning } : {}),\n ...(input.recovery_actions ? { recovery_actions: input.recovery_actions } : {}),\n };\n}\n\nfunction readRootFile(rootPath: string, relativePath: string): string | null {\n const fullPath = join(rootPath, relativePath);\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n return readFileSync(fullPath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction declaredMcpFromExpectedApply(expectedApply: ApplyProfilePluginResult): {\n namesByHarness: Record<string, string[]>;\n configsByHarness: Record<string, Record<string, McpServerMetadata>>;\n} {\n return declaredMcpFromExpectedFiles(\n expectedApply.harnesses,\n expectedApply.expected_files ?? [],\n );\n}\n\nfunction uniqueExpectedFiles(\n expectedFiles: Array<{ path: string; content: string }>,\n): Array<{ path: string; content: string }> {\n const seen = new Set<string>();\n const unique: Array<{ path: string; content: string }> = [];\n for (const file of expectedFiles) {\n if (seen.has(file.path)) {\n continue;\n }\n seen.add(file.path);\n unique.push(file);\n }\n return unique;\n}\n\nfunction compareExpectedFiles(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n): DriftFileChange[] {\n const changes: DriftFileChange[] = [];\n const homeRoot = resolveHomeRoot();\n for (const file of uniqueExpectedFiles(expectedFiles)) {\n const current = readRootFile(rootPath, file.path);\n if (expectedFileMatchesLiveForPreview(homeRoot, file, current)) {\n continue;\n }\n if (current === null) {\n changes.push(\n withAffectedResources({ path: file.path, type: \"deleted\" }, file.content, null),\n );\n continue;\n }\n if (!fileContentsEquivalentForDrift(file.path, current, file.content)) {\n changes.push(\n withAffectedResources(\n { path: file.path, type: \"modified\" },\n file.content,\n current,\n ),\n );\n }\n }\n return changes;\n}\n\n/**\n * Hide \"would add\" gaps for alternate harness materializations when the same\n * profile resource is already present on disk under another harness path, and\n * leftover extra-harness copies when apply still keeps that resource elsewhere,\n * including extra-harness content noise when another copy already matches.\n * Apply still writes or deletes those files; File changes stays transparent.\n */\nexport function omitTransparentCrossHarnessAdds(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n changes: DriftFileChange[],\n): DriftFileChange[] {\n const siblingPathsByResource = new Map<string, string[]>();\n for (const file of uniqueExpectedFiles(expectedFiles)) {\n const mapped = resourceKeyFromManagedPath(file.path);\n if (!mapped) {\n continue;\n }\n const key = `${mapped.type}:${mapped.name}`;\n const siblings = siblingPathsByResource.get(key) ?? [];\n siblings.push(file.path);\n siblingPathsByResource.set(key, siblings);\n }\n\n return changes.filter((change) => {\n const mapped = resourceKeyFromManagedPath(change.path);\n if (!mapped) {\n return true;\n }\n const siblings = siblingPathsByResource.get(`${mapped.type}:${mapped.name}`) ?? [];\n switch (change.type) {\n case \"deleted\": {\n const materializedElsewhere = siblings.some(\n (path) =>\n path !== change.path && readRootFile(rootPath, path) !== null,\n );\n return !materializedElsewhere;\n }\n case \"added\":\n return siblings.length === 0;\n case \"modified\": {\n const siblingMatches = siblings.some((path) => {\n if (path === change.path) {\n return false;\n }\n const expected = expectedFiles.find((file) => file.path === path);\n if (!expected) {\n return false;\n }\n const current = readRootFile(rootPath, path);\n if (current === null) {\n return false;\n }\n return fileContentsEquivalentForDrift(\n path,\n current,\n expected.content,\n );\n });\n return !siblingMatches;\n }\n default: {\n const neverType: never = change.type;\n return neverType;\n }\n }\n });\n}\n\n/**\n * Claude `.claude/settings.json` is a shared host config. Apply merges\n * profile-managed keys and never deletes the whole file, so preview must not\n * list it as a would-delete (`added`) stack item.\n */\nfunction omitMergeableHostConfigRemovals(\n changes: DriftFileChange[],\n): DriftFileChange[] {\n return changes.filter(\n (change) =>\n !(change.type === \"added\" && isMergeableHostConfigPath(change.path)),\n );\n}\n\nfunction withMappedResources(changes: DriftFileChange[]): DriftFileChange[] {\n return changes.map((change) => {\n const mapped = resourceKeyFromManagedPath(change.path);\n return mapped ? { ...change, resource: mapped } : change;\n });\n}\n\n/**\n * Map planned apply removals into File changes as drift \"added\" (on disk, not\n * expected → apply would delete). Skip paths that are already gone so Target\n * preview does not show phantom − rows.\n */\nfunction pushRemovalChange(\n next: DriftFileChange[],\n seen: Set<string>,\n rootPath: string,\n path: string,\n removal_group: PlannedRemovalGroup,\n): void {\n if (seen.has(path) || isMergeableHostConfigPath(path)) {\n return;\n }\n if (readRootFile(rootPath, path) === null) {\n return;\n }\n seen.add(path);\n next.push({ path, type: \"added\", removal_group });\n}\n\nfunction classifyPreviewRemovals(\n rootPath: string,\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n extraPaths: readonly string[] = [],\n): PlannedRemovals {\n const candidates = [\n ...new Set([\n ...(removedFiles ?? []),\n ...(skippedRemovals ?? [])\n .filter((skip) => skip.reason !== \"missing\")\n .map((skip) => skip.path),\n ...extraPaths,\n ]),\n ];\n const groups = groupPlannedRemovals(planSafeFileRemovals(rootPath, candidates));\n const pull = (list: string[], path: string) => {\n const index = list.indexOf(path);\n if (index >= 0) {\n list.splice(index, 1);\n }\n };\n for (const skip of skippedRemovals ?? []) {\n if (skip.reason === \"missing\") {\n continue;\n }\n if (skip.reason === \"modified\") {\n pull(groups.owned_unmodified, skip.path);\n pull(groups.unmanaged, skip.path);\n if (!groups.owned_modified.includes(skip.path)) {\n groups.owned_modified.push(skip.path);\n }\n continue;\n }\n if (skip.reason === \"unmanaged\" || skip.reason === \"preexisting\") {\n pull(groups.owned_unmodified, skip.path);\n pull(groups.owned_modified, skip.path);\n if (!groups.unmanaged.includes(skip.path)) {\n groups.unmanaged.push(skip.path);\n }\n }\n }\n return groups;\n}\n\nexport function withManagedRemovals(\n rootPath: string,\n changes: DriftFileChange[],\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): DriftFileChange[] {\n const groups = classifyPreviewRemovals(\n rootPath,\n removedFiles,\n skippedRemovals,\n );\n const classified = changes.filter((change) => change.type !== \"added\");\n const seen = new Set(classified.map((change) => change.path));\n for (const path of groups.owned_unmodified) {\n pushRemovalChange(classified, seen, rootPath, path, \"owned_unmodified\");\n }\n for (const path of groups.owned_modified) {\n pushRemovalChange(classified, seen, rootPath, path, \"owned_modified\");\n }\n for (const path of groups.unmanaged) {\n pushRemovalChange(classified, seen, rootPath, path, \"unmanaged\");\n }\n return classified;\n}\n\nfunction targetPinRefs(pluginIds?: string[]): Set<string> {\n if (!pluginIds || pluginIds.length === 0) {\n return new Set();\n }\n return new Set(\n mergePluginsForApply(pluginIds).pluginPins.map((pin) => pin.ref),\n );\n}\n\nfunction buildPreviewFileChanges(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n removedFiles: string[] | undefined,\n pluginIds?: string[],\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): DriftFileChange[] {\n const mapped = withMappedResources(\n omitMergeableHostConfigRemovals(\n omitTransparentCrossHarnessAdds(\n rootPath,\n expectedFiles,\n withManagedRemovals(\n rootPath,\n compareExpectedFiles(rootPath, expectedFiles),\n removedFiles,\n skippedRemovals,\n ),\n ),\n ),\n );\n return omitInheritedPluginFileChanges(\n resolveHomeRoot(),\n mapped,\n targetPinRefs(pluginIds),\n );\n}\n\nfunction previewFilesResult(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n removedFiles: string[] | undefined,\n pluginIds?: string[],\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): ProfileApplyPreview[\"files\"] {\n return {\n expected_count: expectedFiles.length,\n changes: buildPreviewFileChanges(\n rootPath,\n expectedFiles,\n removedFiles,\n pluginIds,\n skippedRemovals,\n ),\n root_path: rootPath,\n owned_resources: collectOwnedPreviewResources(expectedFiles),\n };\n}\n\nfunction previewRemovals(\n rootPath: string,\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): PlannedRemovals {\n return classifyPreviewRemovals(rootPath, removedFiles, skippedRemovals);\n}\n\nfunction isMaterialResource(resource: Resource): boolean {\n return resource.type !== \"plugin\";\n}\n\nexport interface CollectExpectedManagedFilesInput {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}\n\nexport interface CollectExpectedManagedFilesResult {\n rootPath: string;\n expectedFiles: Array<{ path: string; content: string }>;\n warning?: string;\n recovery_actions?: RecoveryAction[];\n expectedApply?: ApplyProfilePluginResult;\n pluginIds?: string[];\n removedFiles?: string[];\n}\n\nasync function collectHomeExpectedManagedFiles(\n profile: string,\n harness?: string,\n): Promise<CollectExpectedManagedFilesResult> {\n const homeRoot = resolveHomeRoot();\n\n if (isEmptyBuiltinProfile(profile)) {\n try {\n const expectedApply = await clearGlobalProfileApply({\n dryRun: true,\n harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n return {\n rootPath: homeRoot,\n expectedFiles: uniqueExpectedFiles(expectedApply.expected_files ?? []),\n expectedApply,\n removedFiles: expectedApply.removed_files,\n };\n } catch (error) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n ...warningFromError(error),\n };\n }\n }\n\n const plugin = resolvePluginSelector(profile);\n if (!plugin) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n warning: `missing plugin \"${profile}\"`,\n };\n }\n if (!isProfilePlugin(plugin)) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n ...notProfileWarning(plugin.name),\n };\n }\n\n const pluginIds = collectProfilePluginIds(plugin);\n try {\n const expectedApply = await applyProfilePlugin(profile, {\n dryRun: true,\n harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n return {\n rootPath: homeRoot,\n expectedFiles: uniqueExpectedFiles(expectedApply.expected_files ?? []),\n expectedApply,\n pluginIds,\n removedFiles: expectedApply.removed_files,\n };\n } catch (error) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n pluginIds,\n ...warningFromError(error),\n };\n }\n}\n\nfunction snapshotPreviousPaths(resolvedRoot: string): string[] {\n const gitOriginRaw = getGitOrigin(resolvedRoot);\n const gitOrigin = gitOriginRaw ? normalizeGitUrl(gitOriginRaw) : null;\n const project =\n getProjectByLocalPath(resolvedRoot)\n ?? (gitOrigin ? getProjectByOrigin(gitOrigin) : undefined)\n ?? null;\n const snapshot = project ? getLatestSnapshot(project.id) : null;\n return snapshot\n ? Object.values(snapshot.state.platform_files).flatMap((files) =>\n Object.keys(files),\n )\n : [];\n}\n\nasync function collectProjectExpectedManagedFiles(\n profile: string,\n projectPath?: string,\n harness?: string,\n): Promise<CollectExpectedManagedFilesResult> {\n if (!projectPath) {\n return {\n rootPath: resolve(\"\"),\n expectedFiles: [],\n warning: \"projectPath is required for project scope\",\n };\n }\n\n const resolvedRoot = resolve(projectPath);\n const plugin = resolvePluginSelector(profile);\n if (!plugin) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n warning: `missing plugin \"${profile}\"`,\n };\n }\n if (!isProfilePlugin(plugin) && !isEmptyBuiltinProfile(profile)) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n ...notProfileWarning(plugin.name),\n };\n }\n\n const detected = detectPlatforms(resolvedRoot);\n const platformIds = harness\n ? detected.filter((id) => id === harness)\n : detected;\n\n if (isEmptyBuiltinProfile(profile) || platformIds.length === 0) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n removedFiles: snapshotPreviousPaths(resolvedRoot),\n };\n }\n\n const pluginIds = collectProfilePluginIds(plugin);\n const merged = mergePluginsForApply(pluginIds);\n const material = merged.resources.filter(isMaterialResource);\n try {\n const generated = await generateFiles(material, platformIds, resolvedRoot, {\n target: \"project\",\n claudeConfig: merged.claude,\n });\n const expectedFiles = uniqueExpectedFiles(\n generated.flatMap((result) =>\n result.files.map((file) => ({ path: file.path, content: file.content })),\n ),\n );\n const previousPaths = snapshotPreviousPaths(resolvedRoot);\n const desired = new Set(expectedFiles.map((file) => file.path));\n const removedFiles = previousPaths.filter((path) => !desired.has(path));\n return {\n rootPath: resolvedRoot,\n expectedFiles,\n pluginIds,\n removedFiles,\n };\n } catch (error) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n pluginIds,\n ...warningFromError(error),\n };\n }\n}\n\nexport async function collectExpectedManagedFiles(\n input: CollectExpectedManagedFilesInput,\n): Promise<CollectExpectedManagedFilesResult> {\n if (input.scope === \"project\") {\n return collectProjectExpectedManagedFiles(\n input.profile,\n input.projectPath,\n input.harness,\n );\n }\n return collectHomeExpectedManagedFiles(input.profile, input.harness);\n}\n\nasync function previewHomeApply(\n profile: string,\n harness?: string,\n): Promise<\n Pick<ProfileApplyPreview, \"harnesses\" | \"files\" | \"removals\" | \"warning\" | \"recovery_actions\">\n> {\n const collected = await collectHomeExpectedManagedFiles(profile, harness);\n\n if (collected.warning) {\n if (collected.pluginIds) {\n const merged = mergePluginsForApply(collected.pluginIds);\n const declaredMcpByHarness = {\n \"claude-code\": merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name),\n cursor: merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name),\n };\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins: merged.pluginPins,\n declaredMcpByHarness,\n }),\n files: {\n expected_count: 0,\n changes: withMappedResources([]),\n root_path: collected.rootPath,\n },\n removals: emptyPlannedRemovals(),\n ...spreadWarningFields(collected),\n };\n }\n return {\n files: {\n expected_count: 0,\n changes: withMappedResources([]),\n root_path: collected.rootPath,\n },\n removals: emptyPlannedRemovals(),\n ...spreadWarningFields(collected),\n };\n }\n\n if (isEmptyBuiltinProfile(profile)) {\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins: [],\n declaredMcpByHarness: {},\n }),\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n };\n }\n\n const declaredPins = collected.pluginIds\n ? mergePluginsForApply(collected.pluginIds).pluginPins\n : [];\n const declaredMcp = collected.expectedApply\n ? declaredMcpFromExpectedApply(collected.expectedApply)\n : { namesByHarness: {}, configsByHarness: {} };\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins,\n declaredMcpByHarness: declaredMcp.namesByHarness,\n expectedMcpConfigsByHarness: declaredMcp.configsByHarness,\n }),\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n };\n}\n\nasync function previewProjectApply(\n profile: string,\n projectPath?: string,\n harness?: string,\n): Promise<Pick<ProfileApplyPreview, \"files\" | \"removals\" | \"warning\" | \"recovery_actions\">> {\n const collected = await collectProjectExpectedManagedFiles(\n profile,\n projectPath,\n harness,\n );\n\n return {\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n ...spreadWarningFields(collected),\n };\n}\n\nexport async function previewProfileApply(\n input: ProfileApplyPreviewRequest,\n): Promise<ProfileApplyPreview> {\n const profile = input.profile.trim();\n const contents = buildProfileContents(profile);\n const relativeToActive = getActiveProfileName() === profile;\n const notStaged = await detectNotStagedProfileResources({\n profileSelector: profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (input.scope === \"project\") {\n const projectPreview = await previewProjectApply(\n profile,\n input.projectPath,\n input.harness,\n );\n return {\n profile,\n scope: \"project\",\n contents,\n not_staged: notStaged,\n untracked_resources: notStaged,\n files: projectPreview.files,\n removals: projectPreview.removals,\n relative_to_active: relativeToActive,\n ...spreadWarningFields(projectPreview),\n };\n }\n\n const homePreview = await previewHomeApply(profile, input.harness);\n return {\n profile,\n scope: \"home\",\n contents,\n not_staged: notStaged,\n untracked_resources: notStaged,\n ...(homePreview.harnesses ? { harnesses: homePreview.harnesses } : {}),\n files: homePreview.files,\n removals: homePreview.removals,\n relative_to_active: relativeToActive,\n host_managed: buildHostManagedStatus({\n homeRoot: homePreview.files.root_path,\n profileSkills: profileSkillNameMap(contents?.resources ?? []),\n }),\n ...spreadWarningFields(homePreview),\n };\n}\n","import { findResourceByKey, getResource } from \"../models/resource.js\";\nimport type { Resource, ResourceType } from \"../types.js\";\nimport { MATERIAL_RESOURCE_TYPES } from \"../types.js\";\nimport {\n mcpConfigContentsEquivalent,\n parseMcpServersDocument,\n} from \"./mcp-config-bridge.js\";\nimport { fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { hostPluginPinIsInstalled, listHostNativeMcpNames } from \"./host-native-mcp.js\";\nimport {\n isMcpConfigManagedPath,\n resourceKeyFromManagedPath,\n} from \"./profile-commit-resource.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\n\nconst MATERIAL_TYPE_SET = new Set<string>(MATERIAL_RESOURCE_TYPES);\n\nexport interface OwnedPreviewResource {\n type: string;\n name: string;\n}\n\nfunction findMaterialResource(type: string, name: string): Resource | undefined {\n if (!MATERIAL_TYPE_SET.has(type)) {\n return undefined;\n }\n return (\n getResource(`${type}:${name}`)\n ?? findResourceByKey(type as ResourceType, name, \"\")\n );\n}\n\nfunction nativeMcpNamesForPath(homeRoot: string, path: string): Set<string> {\n const normalized = path.replace(/\\\\/g, \"/\");\n if (normalized.includes(\".cursor/\") && /(^|\\/)mcp\\.json$/i.test(normalized)) {\n return listHostNativeMcpNames(homeRoot, \"cursor\");\n }\n if (\n /(^|\\/)\\.mcp\\.json$/i.test(normalized)\n || /(^|\\/)\\.claude\\.json$/i.test(normalized)\n ) {\n return listHostNativeMcpNames(homeRoot, \"claude-code\");\n }\n return new Set();\n}\n\n/**\n * Treat host-native plugin MCP servers as already present when comparing\n * expected vs live MCP config for apply preview.\n */\nexport function mcpPreviewContentsEquivalent(\n current: string | null,\n expected: string,\n nativeNames: ReadonlySet<string>,\n): boolean {\n let expectedDocument: unknown;\n try {\n expectedDocument = JSON.parse(expected) as unknown;\n } catch {\n return false;\n }\n const expectedServers = parseMcpServersDocument(expectedDocument);\n const expectedNames = Object.keys(expectedServers);\n const nonNativeExpected = expectedNames.filter((name) => !nativeNames.has(name));\n\n if (current === null) {\n return expectedNames.length === 0 || nonNativeExpected.length === 0;\n }\n\n let currentDocument: unknown;\n try {\n currentDocument = JSON.parse(current) as unknown;\n } catch {\n return false;\n }\n const currentServers = parseMcpServersDocument(currentDocument);\n const mergedCurrent: Record<string, (typeof expectedServers)[string]> = {\n ...currentServers,\n };\n for (const name of expectedNames) {\n const expectedMeta = expectedServers[name];\n if (nativeNames.has(name) && expectedMeta && !(name in mergedCurrent)) {\n mergedCurrent[name] = expectedMeta;\n }\n }\n\n return mcpConfigContentsEquivalent(\n JSON.stringify({ mcpServers: mergedCurrent }),\n JSON.stringify({ mcpServers: expectedServers }),\n );\n}\n\nexport function collectOwnedPreviewResources(\n expectedFiles: Array<{ path: string; content: string }>,\n): OwnedPreviewResource[] {\n const order: string[] = [];\n const byKey = new Map<string, OwnedPreviewResource>();\n const add = (type: string, name: string) => {\n const key = `${type}:${name}`;\n if (byKey.has(key)) {\n return;\n }\n order.push(key);\n byKey.set(key, { type, name });\n };\n\n for (const file of expectedFiles) {\n const mapped = resourceKeyFromManagedPath(file.path);\n if (mapped) {\n add(mapped.type, mapped.name);\n }\n if (!isMcpConfigManagedPath(file.path)) {\n continue;\n }\n try {\n const document = JSON.parse(file.content) as unknown;\n for (const name of Object.keys(parseMcpServersDocument(document))) {\n add(\"mcp_server\", name);\n }\n } catch {\n // skip invalid MCP payloads\n }\n }\n\n return order\n .map((key) => byKey.get(key))\n .filter((entry): entry is OwnedPreviewResource => entry !== undefined);\n}\n\nfunction resourceIsDeployedHostPluginOwned(\n type: string,\n name: string,\n homeRoot: string,\n): { originRef: string; installed: boolean } | null {\n const resource = findMaterialResource(type, name);\n if (\n !resource\n || resource.origin_kind !== \"marketplace_link\"\n || !resource.origin_ref\n ) {\n return null;\n }\n return {\n originRef: resource.origin_ref,\n installed: hostPluginPinIsInstalled(homeRoot, resource.origin_ref),\n };\n}\n\n/**\n * Drop stack/file preview noise for resources already deployed by an installed\n * host plugin (marketplace pin). MCP config paths are handled separately.\n */\nexport function omitInheritedPluginFileChanges(\n homeRoot: string,\n changes: DriftFileChange[],\n targetPinRefs: ReadonlySet<string>,\n): DriftFileChange[] {\n return changes.filter((change) => {\n if (isMcpConfigManagedPath(change.path)) {\n return true;\n }\n const mapped = change.resource ?? resourceKeyFromManagedPath(change.path);\n if (!mapped || mapped.type === \"mcp_server\") {\n return true;\n }\n const owned = resourceIsDeployedHostPluginOwned(\n mapped.type,\n mapped.name,\n homeRoot,\n );\n if (!owned?.installed) {\n return true;\n }\n switch (change.type) {\n case \"deleted\":\n case \"modified\":\n return false;\n case \"added\":\n return !targetPinRefs.has(owned.originRef);\n default: {\n const neverType: never = change.type;\n return neverType;\n }\n }\n });\n}\n\nexport function expectedFileMatchesLiveForPreview(\n homeRoot: string,\n file: { path: string; content: string },\n current: string | null,\n): boolean {\n if (isMcpConfigManagedPath(file.path)) {\n const nativeNames = nativeMcpNamesForPath(homeRoot, file.path);\n if (nativeNames.size > 0) {\n return mcpPreviewContentsEquivalent(current, file.content, nativeNames);\n }\n }\n if (current === null) {\n return false;\n }\n return fileContentsEquivalentForDrift(file.path, current, file.content);\n}\n","import { isProfilePlugin } from \"../constants/profile.js\";\nimport {\n getPluginResources,\n removeResourceFromPlugin,\n resolvePluginSelector,\n touchPluginUpdatedAt,\n} from \"../models/plugin-model.js\";\nimport { resolveResource } from \"../models/resource.js\";\nimport { collectProfilePluginIds } from \"./profile-apply.js\";\nimport { markPluginDirty } from \"./plugin-versioning.js\";\nimport {\n type ProfileContentsResource,\n toContentsResource,\n} from \"./profile-contents.js\";\n\nconst COMPOSITION_RESOURCE_TYPES = new Set([\"plugin\"]);\n\nexport function removeResourceFromProfile(input: {\n profileSelector: string;\n resourceType: string;\n resourceName: string;\n pluginId?: string;\n}): ProfileContentsResource {\n const profilePlugin = resolvePluginSelector(input.profileSelector);\n if (!profilePlugin) {\n throw new Error(`Profile not found: ${input.profileSelector}`);\n }\n if (!isProfilePlugin(profilePlugin)) {\n throw new Error(`Plugin \"${profilePlugin.name}\" is not tagged as a profile`);\n }\n if (COMPOSITION_RESOURCE_TYPES.has(input.resourceType)) {\n throw new Error(`Cannot remove composition resource type: ${input.resourceType}`);\n }\n\n const stackPluginIds = collectProfilePluginIds(profilePlugin);\n const stackPluginIdSet = new Set(stackPluginIds);\n if (input.pluginId && !stackPluginIdSet.has(input.pluginId)) {\n throw new Error(`Plugin is not part of profile stack: ${input.pluginId}`);\n }\n\n const selector = `${input.resourceType}:${input.resourceName}`;\n const resolved = resolveResource(selector, { mode: \"compose\" });\n if (resolved.status === \"not_found\") {\n throw new Error(`Resource not found in profile: ${selector}`);\n }\n if (resolved.status === \"ambiguous\") {\n throw new Error(`Ambiguous resource selector: ${selector}`);\n }\n\n const resourceId = resolved.resource.id;\n const searchPluginIds = input.pluginId ? [input.pluginId] : stackPluginIds;\n let removedFromPluginId: string | null = null;\n for (const pluginId of searchPluginIds) {\n const attached = getPluginResources(pluginId);\n if (attached.some((resource) => resource.id === resourceId)) {\n markPluginDirty(pluginId);\n removeResourceFromPlugin(pluginId, resourceId);\n touchPluginUpdatedAt(pluginId);\n removedFromPluginId = pluginId;\n break;\n }\n }\n\n if (!removedFromPluginId) {\n throw new Error(`Resource is not attached to profile: ${selector}`);\n }\n\n return toContentsResource(resolved.resource);\n}\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport {\n collectExpectedManagedFiles,\n type ProfileApplyPreviewScope,\n} from \"./profile-apply-preview.js\";\nimport { normalizeManagedPath } from \"./profile-untracked-resources.js\";\n\nexport async function restoreManagedFile(input: {\n profileSelector: string;\n path: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}): Promise<{ path: string; absolute_path: string }> {\n const profile = input.profileSelector.trim();\n const requestedPath = normalizeManagedPath(input.path.trim());\n\n const collected = await collectExpectedManagedFiles({\n profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (collected.warning) {\n throw new Error(collected.warning);\n }\n\n const match = collected.expectedFiles.find((file) => {\n const normalized = normalizeManagedPath(file.path, collected.rootPath);\n return (\n normalized === requestedPath\n || normalizeManagedPath(file.path) === requestedPath\n );\n });\n\n if (!match) {\n throw new Error(`Path is not a managed file for this profile: ${input.path}`);\n }\n\n const relativePath = normalizeManagedPath(match.path, collected.rootPath);\n const absolutePath = join(collected.rootPath, relativePath);\n\n mkdirSync(dirname(absolutePath), { recursive: true });\n writeFileSync(absolutePath, match.content, \"utf-8\");\n\n return { path: relativePath, absolute_path: absolutePath };\n}\n","import { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { missingRequiredArg } from \"../../services/cli-errors.js\";\nimport { parseResourceSelector } from \"../../services/resource-selector.js\";\nimport type { ProfileApplyPreviewScope } from \"../../services/profile-apply-preview.js\";\nimport {\n commitManagedPathFromLive,\n commitManagedResourceFromLive,\n} from \"../../services/profile-commit-resource.js\";\nimport { getManagedFileDiff } from \"../../services/profile-file-diff.js\";\nimport { removeResourceFromProfile } from \"../../services/profile-remove-resource.js\";\nimport { restoreManagedFile } from \"../../services/profile-restore-file.js\";\nimport {\n addAllUntrackedResourcesToProfile,\n addResourceToProfile,\n} from \"../../services/profile-untracked-resources.js\";\nimport {\n promptForConfirmation,\n shouldUseBrowsePicker,\n} from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { buildUnifiedDiffLines } from \"../../utils/unified-diff.js\";\n\nexport interface LiveScopeOpts {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}\n\nexport interface ConfirmOpts {\n yes?: boolean;\n format?: string;\n noInteractive?: boolean;\n}\n\nfunction initDb(): void {\n const db = getDb();\n initializeSchema(db);\n}\n\nfunction requireTypeNameSelector(\n raw: string | undefined,\n commandPath: string,\n): { type: string; name: string } {\n if (!raw) {\n throw missingRequiredArg(\"selector\", commandPath);\n }\n const parsed = parseResourceSelector(raw);\n if (!parsed.type || parsed.name.trim().length === 0) {\n throw missingRequiredArg(\"selector\", commandPath);\n }\n return { type: parsed.type, name: parsed.name };\n}\n\nfunction requireLiveScope(\n opts: LiveScopeOpts,\n commandPath: string,\n): {\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n} {\n if (opts.scope !== \"home\" && opts.scope !== \"project\") {\n throw missingRequiredArg(\"scope\", commandPath);\n }\n const harness = opts.harness?.trim();\n if (opts.scope === \"project\") {\n const projectPath = opts.project?.trim();\n if (!projectPath) {\n throw missingRequiredArg(\"project\", commandPath);\n }\n return {\n scope: opts.scope,\n projectPath,\n ...(harness ? { harness } : {}),\n };\n }\n return {\n scope: opts.scope,\n ...(harness ? { harness } : {}),\n };\n}\n\nasync function confirmOrRefuse(input: {\n message: string;\n yes?: boolean;\n format?: string;\n noInteractive?: boolean;\n}): Promise<\"proceed\" | \"cancelled\" | \"refused\"> {\n if (input.yes) {\n return \"proceed\";\n }\n if (shouldUseBrowsePicker({\n noInteractive: input.noInteractive,\n format: input.format,\n })) {\n const confirmed = await promptForConfirmation({\n message: input.message,\n default: false,\n });\n if (!confirmed) {\n ui.info(\"Operation cancelled.\");\n return \"cancelled\";\n }\n return \"proceed\";\n }\n process.exitCode = 1;\n ui.hint(\"Pass -y to confirm.\");\n return \"refused\";\n}\n\nexport async function handleProfileAddResourceCommand(\n name: string,\n opts: LiveScopeOpts & { selector?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const selector = requireTypeNameSelector(opts.selector, \"profile add-resource\");\n const scope = requireLiveScope(opts, \"profile add-resource\");\n const resource = await addResourceToProfile({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Added ${selector.type}:${selector.name} to profile ${name}.`);\n}\n\nexport async function handleProfileAddAllResourcesCommand(\n name: string,\n opts: LiveScopeOpts,\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile add-all-resources\");\n const result = await addAllUntrackedResourcesToProfile({\n profileSelector: name,\n ...scope,\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n const noun = result.added_count === 1 ? \"resource\" : \"resources\";\n ui.success(`Added ${result.added_count} ${noun} to profile ${name}.`);\n}\n\nexport async function handleProfileCommitResourceCommand(\n name: string,\n opts: LiveScopeOpts & { path?: string; selector?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile commit-resource\");\n const path = opts.path?.trim() ?? \"\";\n const hasSelector = Boolean(opts.selector?.trim());\n if (!path && !hasSelector) {\n throw missingRequiredArg(\"path\", \"profile commit-resource\");\n }\n\n if (path && !hasSelector) {\n const resources = await commitManagedPathFromLive({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource: resources[0] ?? null, resources });\n return;\n }\n ui.success(`Committed ${path} into profile ${name}.`);\n return;\n }\n\n const selector = requireTypeNameSelector(opts.selector, \"profile commit-resource\");\n if (path) {\n const resources = await commitManagedPathFromLive({\n profileSelector: name,\n path,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource: resources[0] ?? null, resources });\n return;\n }\n ui.success(`Committed ${path} into profile ${name}.`);\n return;\n }\n\n const resource = await commitManagedResourceFromLive({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Committed ${selector.type}:${selector.name} into profile ${name}.`);\n}\n\nexport async function handleProfileRemoveResourceCommand(\n name: string,\n opts: ConfirmOpts & { selector?: string; pluginId?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const selector = requireTypeNameSelector(opts.selector, \"profile remove-resource\");\n const gate = await confirmOrRefuse({\n message: `Remove ${selector.type}:${selector.name} from profile ${name}?`,\n yes: opts.yes,\n format: opts.format,\n noInteractive: opts.noInteractive,\n });\n if (gate !== \"proceed\") {\n return;\n }\n const resource = removeResourceFromProfile({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...(opts.pluginId?.trim() ? { pluginId: opts.pluginId.trim() } : {}),\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Removed ${selector.type}:${selector.name} from profile ${name}.`);\n}\n\nexport async function handleProfileRestoreFileCommand(\n name: string,\n opts: LiveScopeOpts & ConfirmOpts & { path?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile restore-file\");\n const path = opts.path?.trim() ?? \"\";\n if (!path) {\n throw missingRequiredArg(\"path\", \"profile restore-file\");\n }\n const gate = await confirmOrRefuse({\n message:\n `Overwrite ${path} with the profile version? Live edits cannot be restored.`,\n yes: opts.yes,\n format: opts.format,\n noInteractive: opts.noInteractive,\n });\n if (gate !== \"proceed\") {\n return;\n }\n const result = await restoreManagedFile({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n ui.success(`Restored ${result.path}.`);\n}\n\nexport async function handleProfileFileDiffCommand(\n name: string,\n opts: LiveScopeOpts & { path?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile file-diff\");\n const path = opts.path?.trim() ?? \"\";\n if (!path) {\n throw missingRequiredArg(\"path\", \"profile file-diff\");\n }\n const diff = await getManagedFileDiff({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson({\n path: diff.path,\n absolute_path: diff.absolute_path,\n expected: diff.expected,\n current: diff.current,\n });\n return;\n }\n const lines = buildUnifiedDiffLines(diff.path, diff.current ?? \"\", diff.expected);\n console.log(lines.map((line) => line.text).join(\"\\n\"));\n}\n","import type { Command } from \"commander\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { getActiveProfileName } from \"../../services/active-profile.js\";\nimport { CliUsageError, missingRequiredArg } from \"../../services/cli-errors.js\";\nimport { COMMAND_HELP_REGISTRY } from \"../../services/cli-help-registry.js\";\nimport {\n type ProfileApplyPreview,\n type ProfileApplyPreviewScope,\n previewProfileApply,\n} from \"../../services/profile-apply-preview.js\";\nimport { isPromptCancellationError } from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { resolvePluginMutationTarget } from \"../handlers/resolve-plugin-mutation-target.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { formatCommand } from \"../shared.js\";\nimport { SCOPE_COPY, portableScopeTip, scopeLine } from \"../../copy/scope.js\";\nimport { getHarnessPreference } from \"../../models/harness.js\";\nimport { collectProfilePluginIds } from \"../../services/profile-apply.js\";\nimport { mergePluginsForApply } from \"../../services/plugin-apply-merge.js\";\nimport { resolvePluginSelector } from \"../../models/plugin-model.js\";\nimport { registeredHarnessesOf } from \"../../services/harness-targets.js\";\nimport { resourceHarnessScope } from \"../../services/harness-scope.js\";\nimport { isPortableMcpResource } from \"../../services/mcp-target.js\";\nimport type { DriftFileChange } from \"../../services/project-drift.js\";\n\nconst CLI_PREVIEW_SCOPES = [\"home\", \"project\", \"both\"] as const;\ntype CliPreviewScope = (typeof CLI_PREVIEW_SCOPES)[number];\n\nconst PROFILE_PREVIEW_HELP = {\n description:\n \"Show apply preview for a profile (contents, files, untracked, recovery) without writing\",\n examples: [\n \"profile preview\",\n \"profile preview work --format json\",\n \"profile preview work --scope project --project .\",\n \"profile preview work --scope both\",\n ],\n} as const;\n\nfunction isCliPreviewScope(value: string): value is CliPreviewScope {\n return (CLI_PREVIEW_SCOPES as readonly string[]).includes(value);\n}\n\nfunction parseCliPreviewScope(value: string | undefined): CliPreviewScope {\n const scope = value ?? \"home\";\n if (!isCliPreviewScope(scope)) {\n throw new CliUsageError(\n `Invalid --scope value: ${scope}. Use home, project, or both.`,\n );\n }\n return scope;\n}\n\nfunction resolveProjectPathForScope(\n scope: CliPreviewScope,\n project: string | undefined,\n): string | undefined {\n if (scope === \"home\") {\n return undefined;\n }\n const projectPath = (project ?? \".\").trim();\n if (!projectPath) {\n throw new CliUsageError(\"projectPath is required for project scope\");\n }\n return projectPath;\n}\n\nasync function resolvePreviewProfileName(input: {\n name: string | undefined;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}): Promise<string | undefined> {\n const trimmed = input.name?.trim();\n if (trimmed) {\n return trimmed;\n }\n const active = getActiveProfileName();\n if (active) {\n return active;\n }\n return resolvePluginMutationTarget({\n pluginName: undefined,\n profileMode: true,\n interactive: input.interactive,\n noInteractive: input.noInteractive,\n format: input.format,\n message: \"Which profile do you want to preview?\",\n });\n}\n\nfunction engineScopes(scope: CliPreviewScope): ProfileApplyPreviewScope[] {\n switch (scope) {\n case \"home\":\n return [\"home\"];\n case \"project\":\n return [\"project\"];\n case \"both\":\n return [\"home\", \"project\"];\n default: {\n const _exhaustive: never = scope;\n return _exhaustive;\n }\n }\n}\n\nasync function loadPreview(input: {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}): Promise<ProfileApplyPreview> {\n return previewProfileApply({\n profile: input.profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n}\n\nfunction printInstallGaps(preview: ProfileApplyPreview): void {\n if (preview.scope !== \"home\" || !preview.harnesses) {\n return;\n }\n for (const status of Object.values(preview.harnesses)) {\n for (const plugin of status.plugins) {\n if (plugin.state === \"missing\") {\n ui.dim(`plugin ${plugin.id} not installed`);\n }\n }\n for (const mcp of status.mcp) {\n switch (mcp.state) {\n case \"missing\":\n ui.dim(`mcp ${mcp.name} not installed`);\n break;\n case \"mismatch\":\n ui.dim(`mcp ${mcp.name} different value`);\n break;\n case \"present\":\n case \"extra\":\n break;\n default: {\n const _exhaustive: never = mcp.state;\n void _exhaustive;\n break;\n }\n }\n }\n }\n}\n\nfunction printHostManagedCollisions(preview: ProfileApplyPreview): void {\n const collisionCount = preview.host_managed?.cursor?.collisions.length ?? 0;\n if (collisionCount > 0) {\n ui.warn(\n `${formatCount(collisionCount, \"Cursor host-managed skill name collision\")} with user or profile skills.`,\n );\n }\n}\n\nfunction previewChangeLabel(change: DriftFileChange): string {\n switch (change.type) {\n case \"added\":\n case \"modified\":\n return SCOPE_COPY.willWrite;\n case \"deleted\":\n return SCOPE_COPY.willRemove;\n default: {\n const unhandled: never = change.type;\n return String(unhandled);\n }\n }\n}\n\nfunction printPortableMcpTips(preview: ProfileApplyPreview): void {\n const plugin = resolvePluginSelector(preview.profile);\n if (!plugin) {\n return;\n }\n const registered = registeredHarnessesOf(getHarnessPreference());\n if (registered.length === 0) {\n return;\n }\n const resources = mergePluginsForApply(collectProfilePluginIds(plugin)).resources;\n for (const resource of resources) {\n if (!isPortableMcpResource(resource)) {\n continue;\n }\n const scope = resourceHarnessScope(resource);\n if (scope.kind !== \"subset\") {\n continue;\n }\n const extra = registered.filter((id) => !scope.harnesses.includes(id));\n if (extra.length === 0) {\n continue;\n }\n const command = formatCommand([\n \"resource\",\n \"scope\",\n resource.name,\n \"--add\",\n extra.join(\",\"),\n ]);\n ui.hint(\n portableScopeTip({\n resourceName: resource.name,\n targetIds: extra,\n command,\n }),\n );\n }\n}\n\nfunction printHumanPreview(preview: ProfileApplyPreview): void {\n ui.info(\n `Profile ${preview.profile} scope=${preview.scope} root=${preview.files.root_path}`,\n );\n if (preview.relative_to_active) {\n ui.dim(\"already active\");\n }\n\n if (preview.warning) {\n ui.warn(preview.warning);\n }\n\n ui.subheader(\"Contents\");\n const contents = preview.contents;\n const hasPlugins = (contents?.plugins.length ?? 0) > 0;\n const hasPins = (contents?.plugin_pins.length ?? 0) > 0;\n if (contents?.stack_summary) {\n ui.dim(contents.stack_summary);\n }\n if (!contents || (!hasPlugins && !hasPins)) {\n ui.hint(\"Add plugins or resources from your library.\");\n } else {\n for (const plugin of contents.plugins) {\n ui.info(`plugin ${plugin.name}@${plugin.version}`);\n for (const resource of plugin.resources) {\n const scope = resource.harness_scope\n ? scopeLine(\n Array.isArray(resource.harness_scope)\n ? { kind: \"subset\", harnesses: resource.harness_scope }\n : { kind: \"all\" },\n )\n : SCOPE_COPY.appliesToAll;\n ui.dim(` ${resource.type}:${resource.name} ${scope}`);\n }\n }\n for (const pin of contents.plugin_pins) {\n ui.info(`pin ${pin.ref}@${pin.version_constraint}`);\n }\n }\n\n ui.subheader(\"Files\");\n const changeCount = preview.files.changes.length;\n ui.dim(`${changeCount} would change · ${preview.files.expected_count} managed`);\n if (changeCount === 0) {\n ui.hint(\"No file changes.\");\n } else {\n for (const change of preview.files.changes) {\n const resource = change.resource\n ? ` [${change.resource.type}:${change.resource.name}]`\n : \"\";\n ui.info(`${previewChangeLabel(change)} ${change.path}${resource}`);\n }\n }\n printInstallGaps(preview);\n\n const untracked = preview.not_staged.length > 0\n ? preview.not_staged\n : preview.untracked_resources;\n if (untracked.length > 0) {\n ui.subheader(SCOPE_COPY.notInProfile);\n for (const resource of untracked) {\n ui.info(`${resource.type}:${resource.name} ${resource.source}`);\n }\n }\n\n if (preview.recovery_actions && preview.recovery_actions.length > 0) {\n ui.subheader(\"Recovery\");\n for (const action of preview.recovery_actions) {\n ui.warn(`${action.id} ${action.label}`);\n }\n ui.hint(\"Recovery stays interactive on apply; preview does not run these.\");\n ui.hint(\"File adopt/restore is a separate command.\");\n }\n\n printHostManagedCollisions(preview);\n printPortableMcpTips(preview);\n}\n\nexport async function handleProfilePreviewCommand(\n name: string | undefined,\n opts: {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n },\n): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const cliScope = parseCliPreviewScope(opts.scope);\n const projectPath = resolveProjectPathForScope(cliScope, opts.project);\n const harness = opts.harness?.trim() || undefined;\n\n const resolvedName = await resolvePreviewProfileName({\n name,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n });\n if (!resolvedName) {\n process.exitCode = 1;\n renderCliError(missingRequiredArg(\"name\", \"profile preview\"));\n return;\n }\n\n const scopes = engineScopes(cliScope);\n const previews: ProfileApplyPreview[] = [];\n for (const scope of scopes) {\n previews.push(\n await loadPreview({\n profile: resolvedName,\n scope,\n projectPath,\n harness,\n }),\n );\n }\n\n if (format === \"json\") {\n if (cliScope === \"both\") {\n printJson({ home: previews[0], project: previews[1] });\n } else {\n printJson(previews[0]);\n }\n return;\n }\n\n if (cliScope === \"both\") {\n const [homePreview, projectPreview] = previews;\n if (homePreview === undefined || projectPreview === undefined) {\n throw new Error(\"expected home and project apply previews\");\n }\n ui.header(\"Home\");\n printHumanPreview(homePreview);\n ui.header(\"Project\");\n printHumanPreview(projectPreview);\n return;\n }\n\n const [preview] = previews;\n if (preview === undefined) {\n throw new Error(\"expected apply preview\");\n }\n printHumanPreview(preview);\n}\n\nexport function registerProfilePreviewCommand(profileCmd: Command): void {\n COMMAND_HELP_REGISTRY[\"profile.preview\"] = {\n description: PROFILE_PREVIEW_HELP.description,\n examples: [...PROFILE_PREVIEW_HELP.examples],\n };\n\n profileCmd\n .command(\"preview\")\n .argument(\"[name]\", \"Profile plugin name or selector\")\n .option(\"--scope <home|project|both>\", \"Apply preview scope\", \"home\")\n .option(\"--project <path>\", \"Project directory for project scope\", \".\")\n .option(\"--harness <slugs>\", \"Comma-separated harness slugs forwarded to preview\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive wizards\")\n .option(\"--interactive\", \"Prompt instead of relying on explicit flags\")\n .description(PROFILE_PREVIEW_HELP.description)\n .action(async (\n name: string | undefined,\n opts: {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n },\n ) => {\n try {\n await handleProfilePreviewCommand(name, opts);\n } catch (error) {\n if (isPromptCancellationError(error)) {\n process.exitCode = 1;\n return;\n }\n process.exitCode = 1;\n renderCliError(error);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { registerOpenCommand } from \"./open.js\";\nimport { registerProfileLiveFileCommands } from \"./profile-live-files.js\";\nimport { registerProfilePreviewCommand } from \"./profile-preview.js\";\nimport { registerResourceDirectoriesCommand } from \"./resource-directories.js\";\n\nexport function registerParityCommands(root: Command): void {\n registerOpenCommand(root);\n}\n\nexport function registerProfileParityCommands(profileCmd: Command): void {\n registerProfilePreviewCommand(profileCmd);\n registerProfileLiveFileCommands(profileCmd);\n}\n\nexport function registerResourceParityCommands(resourceCmd: Command): void {\n registerResourceDirectoriesCommand(resourceCmd);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,aAAa;AAAA,EACxB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,WAAW;AAAA,EACX,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,cAAc;AAAA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EAC1C;AACA,oBAAkB,OAAO;AAC3B;AAEO,SAAS,8BAA8B,YAA2B;AACvE,wBAAsB,iBAAiB,IAAI;AAAA,IACzC,aAAa,qBAAqB;AAAA,IAClC,UAAU,CAAC,GAAG,qBAAqB,QAAQ;AAAA,EAC7C;AAEA,aACG,QAAQ,SAAS,EACjB,SAAS,UAAU,iCAAiC,EACpD,OAAO,+BAA+B,uBAAuB,MAAM,EACnE,OAAO,oBAAoB,uCAAuC,GAAG,EACrE,OAAO,qBAAqB,oDAAoD,EAChF,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,OAAO,oBAAoB,6BAA6B,EACxD,OAAO,iBAAiB,6CAA6C,EACrE,YAAY,qBAAqB,WAAW,EAC5C,OAAO,OACN,MACA,SAQG;AACH,QAAI;AACF,YAAM,4BAA4B,MAAM,IAAI;AAAA,IAC9C,SAAS,OAAO;AACd,UAAI,0BAA0B,KAAK,GAAG;AACpC,gBAAQ,WAAW;AACnB;AAAA,MACF;AACA,cAAQ,WAAW;AACnB,qBAAe,KAAK;AAAA,IACtB;AAAA,EACF,CAAC;AACL;;;ACzYO,SAAS,8BAA8B,YAA2B;AACvE,gCAA8B,UAAU;AACxC,kCAAgC,UAAU;AAC5C;AAEO,SAAS,+BAA+B,aAA4B;AACzE,qCAAmC,WAAW;AAChD;","names":["existsSync","readFileSync","join","targetPinRefs","existsSync","readFileSync","join","relativePath","join","join"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/cli-help-registry.ts","../src/cli/command-catalog.ts","../src/cli/help.ts"],"sourcesContent":["import type { Command } from \"commander\";\n\nexport interface CommandHelpEntry {\n description: string;\n /** Extra paragraphs shown under the short description on leaf-command help. */\n details?: string;\n examples?: string[];\n /** Optional args that error without a TTY; help shows them as required. */\n requiredOffTtyArgs?: string[];\n}\n\nexport type CommandHelpRegistry = Record<string, CommandHelpEntry>;\n\nexport const COMMAND_HELP_REGISTRY: CommandHelpRegistry = {\n \"help.scenario\": {\n description: \"Show a numbered scenario playbook from the docs\",\n examples: [\"help scenario 11\", \"help scenario 7 --format json\"],\n },\n doctor: {\n description: \"Check Node, native modules, paths, and harness detection\",\n examples: [\"doctor\", \"doctor --format json\"],\n },\n init: {\n description: \"Initialize local HarnessTap state\",\n examples: [\n \"init\",\n \"init --harnesses claude-code,cursor,codex\",\n \"init --format json\",\n ],\n },\n \"init.completion\": {\n description:\n \"Generate shell completion scripts for bash, zsh, or fish\",\n examples: [\n \"init completion bash >> ~/.bashrc\",\n \"init completion zsh >> ~/.zshrc\",\n \"init completion fish > ~/.config/fish/completions/ht.fish\",\n ],\n },\n add: {\n description:\n \"Install skills from a remote GitHub repo, Git URL, or local skill-package directory\",\n examples: [\n \"add mattpocock/skills\",\n \"add mattpocock/skills --list\",\n \"add mattpocock/skills --skill caveman,grill-me --global --yes\",\n ],\n },\n scan: {\n description:\n \"Import resources from a project tree (hash-aware upsert; prompts on content drift when interactive)\",\n examples: [\n \"scan\",\n \"scan ./my-project --dry-run\",\n \"scan --harness claude-code\",\n \"scan --format json\",\n ],\n },\n mirror: {\n description:\n \"Mirror alias harness outputs from the main harness on-disk configuration\",\n examples: [\n \"mirror\",\n \"mirror . --dry-run\",\n \"mirror --reference auto --format json\",\n ],\n },\n use: {\n description:\n \"Switch to a project-configured profile and environment from apm.yml\",\n examples: [\n \"use\",\n \"use --profile dev\",\n \"use --list\",\n \"use --profile dev --dry-run --format json\",\n ],\n },\n \"config.show\": {\n description: \"Show resolved project profile config\",\n examples: [\n \"config show\",\n \"config show --project . --format json\",\n ],\n },\n \"config.validate\": {\n description: \"Validate project profile config references\",\n examples: [\n \"config validate\",\n \"config validate --format json\",\n ],\n },\n \"config.init\": {\n description: \"Create a starter apm.yml from local profile plugins\",\n examples: [\n \"config init\",\n \"config init --profile work --profile personal --default work\",\n \"config init --force --format json\",\n ],\n },\n status: {\n description: \"Show current project status and drift summary\",\n examples: [\n \"status\",\n \"status --check\",\n \"status --format json\",\n ],\n },\n history: {\n description: \"List configuration snapshots for a project\",\n examples: [\n \"history\",\n \"history --format json\",\n \"history --show-id\",\n ],\n },\n revert: {\n description: \"Revert a project or global apply snapshot\",\n examples: [\n \"revert <snapshot-id>\",\n \"revert <snapshot-id> --dry-run\",\n ],\n },\n apply: {\n description:\n \"Resolve a plugin's dependency graph and materialize it into the project, or into machine home with --global\",\n examples: [\n \"apply base\",\n \"apply base --harness claude-code\",\n \"apply work --global\",\n \"apply ./build/my-pkg\",\n \"apply base --format json\",\n \"apply base --on-conflict replace\",\n ],\n },\n install: {\n description:\n \"Onboard a project from apm.yml (same as apply with no plugin selector)\",\n details:\n \"Reads repo-root apm.yml, resolves dependencies.apm (including transitive dependencies.apm on fetched packages) / dependencies.mcp (including MCP Registry v0.1 identities such as io.github...), compiles local .apm/ primitives, writes apm.lock.yaml, and materializes resolved target harness directories. Registry strings are fetched from registry.modelcontextprotocol.io and converted to the same native MCP files HT already emits. Self-defined registry: false entries keep command/url as authored. --mcp <id> appends the identity to apm.yml then runs install; a failed install rolls the manifest write back. Target resolution: --target/--all/--harness, then targets: in apm.yml, then project/global harness preference, then filesystem auto-detect. Declared targets: win over preference and folder detection. Fails closed when no target can be resolved. Commit the lockfile plus generated harness output. Same project-scope flags as apply. Does not take a plugin selector or --global.\",\n examples: [\n \"install\",\n \"install --project .\",\n \"install --mcp io.github.github/github-mcp-server --target cursor\",\n \"install --target cursor,claude\",\n \"install --harness claude-code,cursor\",\n \"install --dry-run\",\n \"install --update\",\n ],\n },\n \"mcp.search\": {\n description: \"Search the official MCP Registry (v0.1)\",\n details:\n \"GET /v0.1/servers?search= against registry.modelcontextprotocol.io. This is discovery only; install still goes through ht install / ht mcp install.\",\n examples: [\n \"mcp search github\",\n \"mcp search filesystem --format json\",\n ],\n },\n \"mcp.list\": {\n description: \"List servers from the official MCP Registry (v0.1)\",\n details:\n \"GET /v0.1/servers with cursor pagination. Does not install or mutate apm.yml.\",\n examples: [\n \"mcp list\",\n \"mcp list --limit 10 --format json\",\n ],\n },\n \"mcp.show\": {\n description: \"Show one MCP Registry server and the native config HT would emit\",\n details:\n \"Fetches GET /v0.1/servers/{id}/versions/latest (URL-encoded). Prefers a remote HTTP/SSE endpoint when the registry document has remotes; otherwise picks npm, then oci, then pypi, then nuget. Secret values stay ${VAR} placeholders: HT does not inject a GitHub PAT.\",\n examples: [\n \"mcp show io.github.github/github-mcp-server\",\n \"mcp show io.github.github/github-mcp-server --format json\",\n ],\n },\n \"mcp.install\": {\n description: \"Append an MCP Registry identity to apm.yml and run ht install\",\n details:\n \"Same as ht install --mcp <id>: writes the identity under dependencies.mcp, then runs the existing apply-from-manifest install (same --target/--all/--harness pipeline as ht compile, including transitive dependencies.apm). If install fails, the apm.yml write is rolled back.\",\n examples: [\n \"mcp install io.github.github/github-mcp-server --target cursor\",\n \"mcp install io.github.github/github-mcp-server --dry-run\",\n ],\n },\n compile: {\n description:\n \"Named apply-from-manifest entry: compile .apm/ primitives into resolved target harness directories\",\n details:\n \"Same overlay path as ht install / ht apply with no plugin selector: existing writers, apm.lock.yaml local_deployed_file_hashes, policy, and trust. Resolution order: --target / --all / --harness, then targets: in apm.yml, then project/global harness preference, then filesystem auto-detect. Declared targets: win over preference so install stays portable. Fails closed when no target resolves. Does not take a plugin selector or --global. compilation.strategy: distributed is noted and ignored; output stays single-file root context (AGENTS.md / CLAUDE.md).\",\n examples: [\n \"compile\",\n \"compile --target cursor\",\n \"compile -t claude,cursor --dry-run\",\n \"compile --all\",\n \"compile --project . --format json\",\n ],\n },\n targets: {\n description:\n \"Show which apply harness targets resolve for this project, and why\",\n details:\n \"Prints the canonical target table (or JSON) using the same resolution order as ht compile / ht install: CLI flags, then targets: in apm.yml, then project/global harness preference, then filesystem auto-detect. --all includes the agent-skills meta-target row. Use this to preview the set before pinning targets: for portable lockfile / harness ownership.\",\n examples: [\n \"targets\",\n \"targets --format json\",\n \"targets --all --format json\",\n \"targets --project .\",\n ],\n },\n \"lock.export\": {\n description:\n \"Export a CycloneDX or SPDX SBOM inventory from the existing lockfile\",\n details:\n \"Inventory export only: reads apm.lock.yaml and serializes it. Never re-resolves, re-hashes, or touches the network. Default format is CycloneDX 1.5; --format spdx writes SPDX 2.3. This is not a security attestation: the document is unsigned and does not claim SLSA. --timestamp pins the document time; otherwise SOURCE_DATE_EPOCH, then the lockfile generated_at. Diagnostics go to stderr so stdout stays pipe-clean.\",\n examples: [\n \"lock export\",\n \"lock export --format cyclonedx -o sbom.json\",\n \"lock export --format spdx --timestamp 2024-06-01T00:00:00+00:00\",\n \"lock export --project .\",\n ],\n },\n pack: {\n description:\n \"Pack an apm.yml project into an Agent Plugins 1.0 bundle (plugin.json + primitives + apm.lock.yaml)\",\n details:\n \"Writes build/<name>/ by default, or a .zip with --archive. Consumers install the artifact with ht apply <dir-or-zip>. Bundles are target-agnostic; plugin.json is metadata and is never deployed as a harness file.\",\n examples: [\n \"pack\",\n \"pack --archive -o ./dist\",\n \"pack --dry-run --verbose\",\n \"pack --format json\",\n ],\n },\n audit: {\n description:\n \"Scan a project for hidden Unicode, lockfile hashes, and apm-policy.yml\",\n details:\n \"Default scan covers lockfile-recorded deployed files plus local primitive dirs, and evaluates apm-policy.yml when present. --ci fails on critical Unicode, hash mismatch/extra/missing, blocking policy, or required-executable-untrusted. --require-policy with --ci fails if no policy file exists. --strip removes critical and warning characters (mutually exclusive with --ci). Use --file to scan any one file.\",\n examples: [\n \"audit\",\n \"audit --file .cursorrules\",\n \"audit --ci --require-policy --format json\",\n \"audit --strip --dry-run\",\n ],\n },\n approve: {\n description: \"Approve executable primitives from dependency packages\",\n details:\n \"Writes project apm.yml executables.allow by default. --user writes ~/.harnesstap/config.jsonc (can only narrow past org/project deny). --pending lists gated packages; --all approves them; --recommended accepts the org recommend set; --list shows the effective decision per locked package.\",\n examples: [\n \"approve owner/repo\",\n \"approve --user owner/repo\",\n \"approve --pending\",\n \"approve --all\",\n ],\n },\n deny: {\n description: \"Deny executable primitives from dependency packages\",\n details:\n \"Writes project apm.yml executables.deny by default. --user writes ~/.harnesstap/config.jsonc.\",\n examples: [\"deny owner/repo\", \"deny --user owner/repo\"],\n },\n \"policy.explain\": {\n description: \"Print the effective executable-trust decision for a package\",\n details:\n \"Shows allowed or blocked per executable type, the deciding policy layer, and shadowed lower-authority layers.\",\n examples: [\"policy explain owner/repo\", \"policy explain owner/repo --format json\"],\n },\n \"plugin.create\": {\n description: \"Create a new local plugin\",\n examples: [\n \"plugin create my-plugin\",\n \"plugin create my-plugin -d \\\"Team defaults\\\" --tags team\",\n \"plugin create skills --from mattpocock/skills --skill caveman\",\n ],\n },\n \"plugin.list\": {\n description:\n \"List local plugins. Pass --remote to include catalog results, or --remote-only for catalog only.\",\n examples: [\n \"plugin list\",\n \"plugin list --remote --search foundation\",\n \"plugin list --remote-only --tag profile\",\n ],\n },\n \"plugin.show\": {\n description: \"Show plugin details, resources, and plugin pins\",\n examples: [\n \"plugin show my-plugin\",\n \"plugin show my-plugin --format json\",\n ],\n requiredOffTtyArgs: [\"name\"],\n },\n \"plugin.edit\": {\n description:\n \"Edit plugin composition and default environment (interactive or scripting)\",\n examples: [\n \"plugin edit my-plugin\",\n \"plugin edit my-plugin --add skill:caveman\",\n \"plugin edit my-plugin --environment dev\",\n ],\n },\n \"plugin.editor\": {\n description: \"Open a plugin definition file in your system editor\",\n examples: [\"plugin editor my-plugin\"],\n },\n \"plugin.delete\": {\n description: \"Delete a local plugin\",\n examples: [\n \"plugin delete my-plugin\",\n \"plugin delete\",\n ],\n requiredOffTtyArgs: [\"name\"],\n },\n \"plugin.catalog.list\": {\n description: \"Show default and connected catalog sources\",\n examples: [\n \"plugin catalog list\",\n \"plugin catalog list --format json\",\n ],\n },\n \"plugin.catalog.connect\": {\n description:\n \"Connect an org or individual public plugin to the local catalog scope\",\n examples: [\n \"plugin catalog connect org acme\",\n \"plugin catalog connect plugin acme/default/foundation\",\n ],\n },\n \"plugin.catalog.disconnect\": {\n description:\n \"Disconnect a connected org or plugin from the local catalog scope\",\n examples: [\n \"plugin catalog disconnect org acme\",\n \"plugin catalog disconnect plugin acme/default/foundation\",\n ],\n },\n \"plugin.catalog.register\": {\n description: \"Register a publish catalog on this machine\",\n examples: [\n \"plugin catalog register acme/default\",\n \"plugin catalog register work@acme/releases\",\n ],\n },\n \"plugin.catalog.unregister\": {\n description: \"Remove a publish catalog from this machine\",\n examples: [\"plugin catalog unregister acme/default\"],\n },\n \"plugin.catalog.registered\": {\n description: \"List registered publish catalogs\",\n examples: [\n \"plugin catalog registered\",\n \"plugin catalog registered --format json\",\n ],\n },\n \"plugin.catalog.bindings\": {\n description: \"Configure which registered catalogs a plugin publishes to\",\n examples: [\n \"plugin catalog bindings my-plugin\",\n \"plugin catalog bindings my-plugin --add acme/default\",\n \"plugin catalog bindings my-plugin --clear\",\n ],\n },\n \"plugin.publish\": {\n description: \"Publish a local plugin to registered cloud catalogs\",\n examples: [\n \"plugin publish my-plugin\",\n \"plugin publish my-plugin acme/default\",\n \"plugin publish my-plugin --version 1.1.0\",\n ],\n },\n \"plugin.pull\": {\n description: \"Pull a plugin from the remote catalog into the local DB\",\n examples: [\n \"plugin pull acme/foundation\",\n \"plugin pull foundation --org acme --as local-foundation\",\n ],\n },\n \"plugin.publish.plan\": {\n description: \"Dry-run publish targets for a local plugin\",\n examples: [\n \"plugin publish plan my-plugin\",\n \"plugin publish plan my-plugin --format json\",\n ],\n },\n \"plugin.diff\": {\n description: \"Diff two plugins or a plugin and a plugin export file\",\n examples: [\n \"plugin diff left right\",\n \"plugin diff my-plugin ./export.ap.json\",\n ],\n },\n \"plugin.doctor\": {\n description: \"Run doctor checks against a plugin\",\n examples: [\n \"plugin doctor my-plugin\",\n \"plugin doctor my-plugin --format json\",\n ],\n },\n \"plugin.check\": {\n description:\n \"Compare library working heads to marketplace, git, and catalog origins\",\n details:\n \"Omit a name to check every syncable working head. --refresh force-fetches origins. \"\n + \"Outdated is not a failure; exit 1 only when a check row is error.\",\n examples: [\n \"plugin check\",\n \"plugin check my-plugin --refresh\",\n \"plugin check --format json\",\n ],\n },\n \"plugin.update\": {\n description:\n \"Update library working heads from marketplace, git, and catalog origins\",\n details:\n \"Pass a plugin name or --all. --all confirms on TTY unless --yes; non-interactive \"\n + \"--all requires --yes. --force reapplies when fingerprints already match.\",\n examples: [\n \"plugin update my-plugin\",\n \"plugin update --all --yes\",\n \"plugin update --all --yes --format json\",\n ],\n },\n \"plugin.cut\": {\n description: \"Cut a new local version from the working head\",\n examples: [\n \"plugin cut my-plugin --version 1.3.0\",\n \"plugin cut my-plugin --version 1.3.0 --format json\",\n ],\n },\n \"plugin.versions\": {\n description: \"List local frozen versions and the working head\",\n examples: [\n \"plugin versions my-plugin\",\n \"plugin versions my-plugin --format json\",\n ],\n },\n \"plugin.rollback\": {\n description: \"Restore a frozen version onto the working head\",\n details:\n \"Copies the frozen snapshot onto the current semver and marks the head dirty. \" +\n \"Does not apply the plugin. Non-interactive use requires --yes.\",\n examples: [\n \"plugin rollback my-plugin --to 1.0.0 --yes\",\n \"plugin rollback my-plugin --to 1.0.0 --yes --format json\",\n ],\n },\n \"plugin.why\": {\n description:\n \"Explain why a version was selected, or which plugin won a resource\",\n details:\n \"Answers why a version was selected, or which plugin won a given resource, \" +\n \"against the lockfile in the current project.\",\n examples: [\n \"plugin why base\",\n \"plugin why skill:deploy\",\n \"plugin why base --format json\",\n ],\n },\n \"plugin.fork\": {\n description:\n \"Create an editable authored copy of an upstream or catalog plugin\",\n details:\n \"Upstream and catalog plugins cannot be edited in place. A fork is an \"\n + \"authored plugin that starts with the same resources and dependencies.\",\n examples: [\n \"plugin fork web-search\",\n \"plugin fork web-search --as my-search\",\n \"plugin fork web-search --format json\",\n ],\n },\n \"plugin.from-project\": {\n description: \"Scan current folder and create a plugin from its resources\",\n examples: [\n \"plugin from-project my-plugin --project .\",\n \"plugin from-project team-plugin -d \\\"From repo\\\"\",\n ],\n },\n \"profile.list\": {\n description:\n \"List local profile plugins. Pass --remote to include catalog profiles with tag=profile. Marks the active profile.\",\n examples: [\n \"profile list\",\n \"profile list --search work\",\n \"profile list --remote\",\n ],\n },\n \"profile.show\": {\n description:\n \"Show profile plugin details, resources, and dependencies\",\n examples: [\n \"profile show work\",\n \"profile show work --format json\",\n ],\n requiredOffTtyArgs: [\"name\"],\n },\n \"profile.status\": {\n description:\n \"Show the active profile and whether global harness files are in sync\",\n examples: [\n \"profile status\",\n \"profile status --check\",\n \"profile status --format json\",\n ],\n },\n \"profile.switch\": {\n description:\n \"Switch the active profile and restore the previous one on failure\",\n examples: [\n \"profile switch work\",\n \"profile switch work --harness claude-code\",\n \"profile switch work --format json\",\n ],\n },\n \"profile.use\": {\n description:\n \"Merge profile stack, apply globally, and set active pointer; delegates to project config when present\",\n examples: [\n \"profile use work\",\n \"profile use --profile dev\",\n \"profile use work --dry-run\",\n \"profile use work --harness claude-code\",\n ],\n },\n \"profile.stash.list\": {\n description: \"List stashed profiles\",\n examples: [\n \"profile stash list\",\n \"profile stash ls --format json\",\n ],\n },\n \"profile.stash.pop\": {\n description:\n \"Restore the most recent stashed profile and remove it from the stash\",\n examples: [\n \"profile stash pop\",\n \"profile stash pop --harness claude-code\",\n ],\n },\n \"profile.stash.apply\": {\n description:\n \"Restore the most recent stashed profile without removing it from the stash\",\n examples: [\n \"profile stash apply\",\n \"profile stash apply --dry-run\",\n ],\n },\n \"profile.create\": {\n description:\n \"Create a profile plugin, promote an existing plugin, or import from a skill package\",\n examples: [\n \"profile create work\",\n \"profile create work --from mattpocock/skills --use\",\n \"profile create work -d \\\"Work profile\\\"\",\n ],\n },\n \"profile.delete\": {\n description:\n \"Demote a profile plugin and optionally delete the underlying plugin\",\n examples: [\n \"profile delete work\",\n \"profile delete work --plugin -y\",\n ],\n },\n \"profile.pull\": {\n description: \"Pull a profile plugin from catalog\",\n examples: [\n \"profile pull acme/work-profile\",\n \"profile pull work-profile --org acme --as work\",\n ],\n },\n \"profile.publish\": {\n description: \"Publish a profile plugin with validation warnings\",\n examples: [\n \"profile publish work\",\n \"profile publish work --org acme --catalog default\",\n ],\n },\n \"environment.create\": {\n description:\n \"Create a named environment bundle (blank, from project, or from configured plugin requirements)\",\n examples: [\n \"environment create dev\",\n \"environment create dev --from-project .\",\n \"environment create dev --from-plugin my-plugin --bind\",\n ],\n },\n \"environment.edit\": {\n description:\n \"Edit environment values interactively or via scripting flags\",\n examples: [\n \"environment edit dev\",\n \"environment edit dev --var API_URL=https://api.example.com\",\n \"environment edit dev --model claude-sonnet-4-20250514\",\n ],\n },\n \"environment.list\": {\n description: \"List named environment bundles\",\n examples: [\n \"environment list\",\n \"environment list --format json\",\n ],\n },\n \"environment.show\": {\n description:\n \"Show environment values, secret refs, and reverse references\",\n examples: [\n \"environment show dev\",\n \"environment show dev --plugin my-plugin\",\n ],\n },\n \"environment.delete\": {\n description: \"Delete a named environment\",\n examples: [\n \"environment delete dev\",\n \"environment delete dev --force\",\n ],\n },\n \"environment.use\": {\n description:\n \"Set the global active environment; --local applies only to this terminal session\",\n examples: [\n \"environment use dev\",\n \"environment use dev --local\",\n ],\n },\n \"environment.status\": {\n description:\n \"Show the active environment and whether terminal env vars match expected values\",\n examples: [\n \"environment status\",\n \"environment status --check\",\n \"environment status --format json\",\n ],\n },\n \"migrate.export\": {\n description:\n \"Export workspace, plugin, or resource as an Agent Plugins package or workspace archive\",\n examples: [\n \"migrate export backup.tar.gz --workspace\",\n \"migrate export --plugin my-plugin -o ./my-plugin\",\n \"migrate export --plugin my-plugin --single-file -o my-plugin.ap.json\",\n \"migrate export --resource skill:caveman\",\n ],\n },\n \"migrate.import\": {\n description:\n \"Import a package directory, .ap.json envelope, or .tar.gz workspace archive\",\n examples: [\n \"migrate import backup.tar.gz\",\n \"migrate import ./my-plugin\",\n \"migrate import my-plugin.ap.json\",\n ],\n },\n \"migrate.resolve-order\": {\n description:\n \"Pin last-applied resource winners as overrides where current resolution would pick a different plugin\",\n examples: [\n \"migrate resolve-order\",\n \"migrate resolve-order --dry-run\",\n \"migrate resolve-order --format json\",\n ],\n },\n \"resource.list\": {\n description: \"List imported resources in the local library\",\n examples: [\n \"resource list\",\n \"resource list skill\",\n \"resource list --search caveman\",\n ],\n },\n \"resource.show\": {\n description:\n \"Show resource details (name, type:name, type:name@namespace, or ULID)\",\n examples: [\n \"resource show caveman\",\n \"resource show skill:caveman --format json\",\n \"resource show tiny-skill --full\",\n ],\n requiredOffTtyArgs: [\"resource\"],\n },\n \"resource.sync\": {\n description:\n \"Sync plugin resources and marketplace-linked definitions from install trees\",\n examples: [\n \"resource sync\",\n \"resource sync plugin:my-plugin --dry-run\",\n \"resource sync --on-conflict replace\",\n ],\n },\n \"resource.delete\": {\n description: \"Delete a resource from the local library\",\n examples: [\n \"resource delete caveman\",\n \"resource delete\",\n ],\n requiredOffTtyArgs: [\"resource\"],\n },\n \"harness.list\": {\n description: \"List supported harnesses\",\n examples: [\n \"harness list\",\n \"harness list --supported --format json\",\n ],\n },\n \"harness.set\": {\n description: \"Set global registered harnesses\",\n examples: [\n \"harness set --harnesses claude-code,cursor,codex\",\n ],\n },\n \"harness.status\": {\n description: \"Show global harness preferences\",\n examples: [\n \"harness status\",\n \"harness status --format json\",\n ],\n },\n \"harness.sync\": {\n description:\n \"Union resources from registered harnesses and materialize with last-write conflicts\",\n details:\n \"Scans every registered harness, unions portable types (skills, MCP, rules, host plugin install trees, and other serializer-supported resources), keeps the newest on-disk copy when the same identity differs (later registered harness on ties), and emits shared skill paths when multiple targets can read them. Claude and Cursor plugin trees are copied into each native root (they do not share a runtime plugin directory). Skills, agents, and commands inside those plugins are also materialized into `.agents` (and equivalent folders) for OpenCode and other harnesses that do not load Cursor/Claude plugin roots. Matching CLAUDE.md and AGENTS.md share one file: AGENTS.md is canonical and CLAUDE.md links to it unless copy mode is set. Configure with `harnessSync.pluginResources` in config.jsonc (`symlink`, `copy`, or `clone`) or `--plugin-resources`. Default scope is the home directory. This is not copy-from-one-harness mirror.\",\n examples: [\n \"harness sync\",\n \"harness sync --dry-run --format json\",\n \"harness sync --plugin-resources copy\",\n \"harness sync --project .\",\n ],\n },\n \"harness.project.set\": {\n description: \"Set project-scoped registered harnesses\",\n examples: [\n \"harness project set --harnesses claude-code,cursor\",\n \"harness project set --project . --harnesses cursor\",\n ],\n },\n \"harness.project.status\": {\n description: \"Show project-scoped harness preferences\",\n examples: [\n \"harness project status\",\n \"harness project status --format json\",\n ],\n },\n \"auth.login\": {\n description: \"Log into HarnessTap Cloud via device authentication\",\n examples: [\n \"auth login\",\n \"auth login work --base-url https://harnesstap.com\",\n ],\n },\n \"auth.status\": {\n description: \"Show authenticated user and account context\",\n examples: [\n \"auth status\",\n \"auth status --account work --format json\",\n ],\n },\n \"auth.orgs\": {\n description: \"List organizations and optionally switch\",\n examples: [\n \"auth orgs\",\n \"auth orgs --switch acme\",\n ],\n },\n \"auth.logout\": {\n description: \"Log out and remove local cloud account\",\n examples: [\n \"auth logout\",\n \"auth logout --account work\",\n ],\n },\n \"github.login\": {\n description: \"Log into GitHub via device authentication (GitHub App user-to-server)\",\n examples: [\n \"github login\",\n ],\n },\n \"github.status\": {\n description: \"Show GitHub authentication status\",\n examples: [\n \"github status\",\n \"github status --format json\",\n ],\n },\n \"github.logout\": {\n description: \"Remove the stored GitHub session\",\n examples: [\n \"github logout\",\n ],\n },\n \"marketplace.add\": {\n description: \"Register a plugin marketplace URL\",\n examples: [\n \"marketplace add https://github.com/example/demo.git --name demo\",\n \"marketplace add https://github.com/example/demo.git --platform claude-code --format json\",\n ],\n },\n \"marketplace.list\": {\n description: \"List configured plugin marketplaces\",\n examples: [\n \"marketplace list\",\n \"marketplace ls --format json\",\n ],\n },\n \"marketplace.remove\": {\n description: \"Remove a configured plugin marketplace\",\n examples: [\n \"marketplace remove demo\",\n \"marketplace rm demo --format json\",\n ],\n },\n \"marketplace.show\": {\n description: \"List or browse plugins from a marketplace catalog\",\n examples: [\n \"marketplace show demo\",\n \"marketplace show demo --refresh --format json\",\n ],\n },\n \"plugin.search\": {\n description: \"Search marketplace catalogs for plugins by name, tags, and nested skills/commands\",\n examples: [\n \"plugin search typescript\",\n \"plugin search --refresh --format json\",\n ],\n },\n \"plugin.add\": {\n description:\n \"Import a GitHub plugin.json package into the library, or add a dependency to a plugin with --to\",\n examples: [\n \"plugin add DietrichGebert/ponytail\",\n \"plugin add https://github.com/DietrichGebert/ponytail\",\n \"plugin add gh:DietrichGebert/ponytail\",\n \"plugin add base --to root\",\n \"plugin add fmt@demo --to team-stack\",\n ],\n },\n};\n\nfunction normalizeCommandName(name: string): string {\n const bracketIndex = name.indexOf(\" \");\n return bracketIndex === -1 ? name : name.slice(0, bracketIndex);\n}\n\nexport function resolveCommandHelpPath(cmd: Command): string {\n const segments: string[] = [];\n let current: Command | null = cmd;\n\n while (current?.parent) {\n segments.unshift(normalizeCommandName(current.name()));\n current = current.parent;\n }\n\n return segments.join(\".\");\n}\n\nexport function getCommandHelpEntry(cmd: Command): CommandHelpEntry | undefined {\n return COMMAND_HELP_REGISTRY[resolveCommandHelpPath(cmd)];\n}\n","export type CommandCatalogKind = \"group\" | \"project\";\n\nexport type CommandLoaderId =\n | \"apply\"\n | \"approve\"\n | \"audit\"\n | \"auth\"\n | \"compile\"\n | \"config\"\n | \"doctor\"\n | \"environment\"\n | \"github\"\n | \"harness\"\n | \"help\"\n | \"init\"\n | \"lock\"\n | \"marketplace\"\n | \"mcp\"\n | \"migrate\"\n | \"open\"\n | \"pack\"\n | \"plugin\"\n | \"policy\"\n | \"profile\"\n | \"project\"\n | \"resource\";\n\nexport interface CommandCatalogEntry {\n name: string;\n aliases?: string[];\n description: string;\n kind: CommandCatalogKind;\n loader: CommandLoaderId;\n /** Commander-style args shown in top-level PROJECT help, e.g. `<source>`. */\n args?: string;\n hidden?: boolean;\n}\n\nexport const COMMAND_CATALOG: CommandCatalogEntry[] = [\n {\n name: \"auth\",\n aliases: [\"a\"],\n description: \"Authenticate with HarnessTap Cloud and manage cloud accounts\",\n kind: \"group\",\n loader: \"auth\",\n },\n {\n name: \"config\",\n description: \"Manage project profile config (apm.yml)\",\n kind: \"group\",\n loader: \"config\",\n },\n {\n name: \"environment\",\n aliases: [\"e\"],\n description: \"Manage reusable environments and plugin environment cascade\",\n kind: \"group\",\n loader: \"environment\",\n },\n {\n name: \"github\",\n description: \"Authenticate with GitHub for private marketplace and repo reads\",\n kind: \"group\",\n loader: \"github\",\n },\n {\n name: \"harness\",\n aliases: [\"h\"],\n description: \"Manage the registered harness set\",\n kind: \"group\",\n loader: \"harness\",\n },\n {\n name: \"help\",\n description: \"Core concepts and scenario playbooks\",\n kind: \"group\",\n loader: \"help\",\n },\n {\n name: \"lock\",\n description: \"Read apm.lock.yaml and export inventory artifacts\",\n kind: \"group\",\n loader: \"lock\",\n },\n {\n name: \"marketplace\",\n aliases: [\"mkt\"],\n description: \"Manage plugin marketplace sources\",\n kind: \"group\",\n loader: \"marketplace\",\n },\n {\n name: \"mcp\",\n description: \"Discover and install MCP Registry servers\",\n kind: \"group\",\n loader: \"mcp\",\n },\n {\n name: \"migrate\",\n aliases: [\"m\"],\n description: \"Export or import workspace, plugins, or resources for offline sharing\",\n kind: \"group\",\n loader: \"migrate\",\n },\n {\n name: \"plugin\",\n aliases: [\"l\"],\n description: \"Manage plugins (named bundles of resources that can be applied to a project)\",\n kind: \"group\",\n loader: \"plugin\",\n },\n {\n name: \"policy\",\n description: \"Inspect executable-trust and apm-policy.yml decisions\",\n kind: \"group\",\n loader: \"policy\",\n },\n {\n name: \"profile\",\n aliases: [\"p\"],\n description: \"Manage profile plugins and global profile switching\",\n kind: \"group\",\n loader: \"profile\",\n },\n {\n name: \"resource\",\n aliases: [\"r\"],\n description:\n \"Manage resources (individual pieces of AI configuration like agents, skills, or instructions)\",\n kind: \"group\",\n loader: \"resource\",\n },\n {\n name: \"add\",\n args: \"<source>\",\n description: \"Add skills from a remote or local source\",\n kind: \"project\",\n loader: \"init\",\n },\n {\n name: \"apply\",\n args: \"[plugins]\",\n description: \"Resolve a plugin's dependency graph and materialize it\",\n kind: \"project\",\n loader: \"apply\",\n },\n {\n name: \"approve\",\n args: \"[PACKAGE_REF]\",\n description: \"Approve executable primitives from dependency packages\",\n kind: \"project\",\n loader: \"approve\",\n },\n {\n name: \"audit\",\n description:\n \"Scan a project for hidden Unicode, lockfile hashes, apm-policy.yml, and executable trust\",\n kind: \"project\",\n loader: \"audit\",\n },\n {\n name: \"compile\",\n description: \"Compile local .apm/ primitives into resolved target harness directories\",\n kind: \"project\",\n loader: \"compile\",\n },\n {\n name: \"deny\",\n args: \"[PACKAGE_REF]\",\n description: \"Deny executable primitives from dependency packages\",\n kind: \"project\",\n loader: \"approve\",\n },\n {\n name: \"doctor\",\n description: \"Check Node, native modules, paths, and harness detection\",\n kind: \"project\",\n loader: \"doctor\",\n },\n {\n name: \"history\",\n args: \"[path]\",\n description: \"List configuration snapshots for a project\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"init\",\n description: \"Initialize the harnesstap database and config directory\",\n kind: \"project\",\n loader: \"init\",\n },\n {\n name: \"install\",\n description: \"Onboard a project from apm.yml (same as apply with no plugin selector)\",\n kind: \"project\",\n loader: \"apply\",\n },\n {\n name: \"mirror\",\n args: \"[path]\",\n description:\n \"Rematerialize registered harness files from one on-disk harness (or plugin/AGENTS.md fallback)\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"open\",\n args: \"[path]\",\n description: \"Open a file or directory in your system editor\",\n kind: \"project\",\n loader: \"open\",\n },\n {\n name: \"pack\",\n description:\n \"Pack an apm.yml project into an Agent Plugins 1.0 bundle (plugin.json + primitives + apm.lock.yaml)\",\n kind: \"project\",\n loader: \"pack\",\n },\n {\n name: \"revert\",\n args: \"[snapshot-id]\",\n description: \"Revert a project or global apply snapshot\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"scan\",\n args: \"[path]\",\n description:\n \"Scan a project directory or plugin source and import configurations into the database\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"status\",\n args: \"[path]\",\n description: \"Show current project status and drift summary\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"targets\",\n description: \"Show which apply harness targets resolve for this project, and why\",\n kind: \"project\",\n loader: \"compile\",\n },\n {\n name: \"use\",\n description: \"Switch to a project-configured profile and environment\",\n kind: \"project\",\n loader: \"project\",\n },\n {\n name: \"layer\",\n description: \"\",\n kind: \"project\",\n loader: \"plugin\",\n hidden: true,\n },\n {\n name: \"__complete\",\n description: \"\",\n kind: \"project\",\n loader: \"help\",\n hidden: true,\n },\n];\n\nexport const COMMAND_LOADER_IDS: CommandLoaderId[] = [\n \"apply\",\n \"approve\",\n \"audit\",\n \"auth\",\n \"compile\",\n \"config\",\n \"doctor\",\n \"environment\",\n \"github\",\n \"harness\",\n \"help\",\n \"init\",\n \"lock\",\n \"marketplace\",\n \"mcp\",\n \"migrate\",\n \"open\",\n \"pack\",\n \"plugin\",\n \"policy\",\n \"profile\",\n \"project\",\n \"resource\",\n];\n\nexport function visibleCatalogEntries(kind: CommandCatalogKind): CommandCatalogEntry[] {\n return COMMAND_CATALOG\n .filter((entry) => !entry.hidden && entry.kind === kind)\n .sort((a, b) => a.name.localeCompare(b.name));\n}\n\nexport function findCatalogEntry(token: string): CommandCatalogEntry | undefined {\n return COMMAND_CATALOG.find(\n (entry) => entry.name === token || entry.aliases?.includes(token),\n );\n}\n\nexport function topLevelCommandTokens(): Set<string> {\n const tokens = new Set<string>();\n for (const entry of COMMAND_CATALOG) {\n tokens.add(entry.name);\n for (const alias of entry.aliases ?? []) {\n tokens.add(alias);\n }\n }\n return tokens;\n}\n\nexport function catalogCommandLabel(entry: CommandCatalogEntry): string {\n let label = entry.name;\n if (entry.aliases && entry.aliases.length > 0) {\n label += ` (${entry.aliases.join(\", \")})`;\n }\n if (entry.args) {\n label += ` ${entry.args}`;\n }\n return label;\n}\n","import type { Command } from \"commander\";\nimport { getCommandHelpEntry } from \"../services/cli-help-registry.js\";\nimport { ui } from \"../ui/index.js\";\nimport { PACKAGE_VERSION } from \"../version.js\";\nimport {\n catalogCommandLabel,\n type CommandCatalogEntry,\n visibleCatalogEntries,\n} from \"./command-catalog.js\";\nimport { formatCommand, resolveInvocationName } from \"./shared.js\";\n\nconst PLUGIN_HELP_LOCAL_COMMANDS = new Set([\n \"create\",\n \"list\",\n \"show\",\n \"edit\",\n \"editor\",\n \"delete\",\n \"export\",\n \"import\",\n \"add\",\n \"cut\",\n \"versions\",\n \"rollback\",\n \"diff\",\n \"doctor\",\n \"check\",\n \"update\",\n \"why\",\n \"fork\",\n \"from-project\",\n]);\n\nconst PLUGIN_HELP_REMOTE_COMMANDS = new Set([\n \"search\",\n \"catalog\",\n \"pull\",\n \"publish\",\n]);\n\nfunction isCommanderHidden(command: Command): boolean {\n return (command as unknown as { _hidden?: boolean })._hidden === true;\n}\n\nexport function isHiddenHelpCommand(command: Command): boolean {\n return (\n command.name() === \"__complete\"\n || isCommanderHidden(command)\n || (command.description() as unknown) === false\n );\n}\n\nexport function resolveCommandDescription(command: Command): string {\n return command.description() || getCommandHelpEntry(command)?.description || \"\";\n}\n\n/** Commands that run a default action while also hosting subcommands. */\nexport function commandKeepsDefaultAction(command: Command): boolean {\n if (command.name() === \"init\") {\n return true;\n }\n return command.name() === \"publish\" && command.parent?.name() === \"plugin\";\n}\n\nfunction commandUsageLine(cmd: Command): string {\n const names: string[] = [];\n let current: Command | null = cmd;\n while (current?.parent) {\n names.unshift(current.name());\n current = current.parent;\n }\n const usage = cmd.usage().trim();\n return formatCommand(`${names.join(\" \")}${usage ? ` ${usage}` : \"\"}`);\n}\n\nfunction formatHelpArgName(name: string, required: boolean): string {\n return required ? `<${name}>` : `[${name}]`;\n}\n\nfunction visibleHelpOptions(cmd: Command): Command[\"options\"] {\n const opts = cmd.options.filter((opt) => !opt.hidden);\n const hasNoInteractive = opts.some((opt) => opt.long === \"--no-interactive\");\n if (!hasNoInteractive) {\n return opts;\n }\n return opts.filter((opt) => opt.long !== \"--interactive\");\n}\n\nfunction renderCatalogSection(title: string, entries: CommandCatalogEntry[]): string {\n if (entries.length === 0) {\n return \"\";\n }\n const commandStrs = entries.map((entry) => catalogCommandLabel(entry));\n const maxNameLength = Math.max(...commandStrs.map((entry) => entry.length));\n const lines = [ui.theme.heading(title)];\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n const nameStr = commandStrs[i];\n if (!entry || !nameStr) {\n continue;\n }\n const padding = \" \".repeat(Math.max(2, maxNameLength - nameStr.length + 2));\n lines.push(` ${ui.theme.command(nameStr)}${padding}${entry.description}`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction renderTopLevelCommandHelp(): string {\n const sections = [\n renderCatalogSection(\"COMMAND GROUPS\", visibleCatalogEntries(\"group\")),\n renderCatalogSection(\"PROJECT\", visibleCatalogEntries(\"project\")),\n ].filter((section) => section.length > 0);\n\n return sections.join(\"\\n\\n\");\n}\n\nexport function renderRootHelpText(): string {\n const lines = [\n \"\",\n `${ui.theme.primary(resolveInvocationName())} ${ui.theme.muted(`v${PACKAGE_VERSION}`)}`,\n \"Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs\",\n \"\",\n ui.theme.heading(\"USAGE\"),\n ` ${resolveInvocationName()} [options] [command]`,\n \"\",\n ui.theme.heading(\"OPTIONS\"),\n ` ${ui.theme.flag(\"-V, --version\")} output the version number`,\n ` ${ui.theme.flag(\"-v, --verbose\")} show verbose error output`,\n ` ${ui.theme.flag(\"--no-color\")} disable color output`,\n ` ${ui.theme.flag(\"--no-interactive\")} disable interactive prompts`,\n ` ${ui.theme.flag(\"-h, --help\")} display help for command`,\n \"\",\n renderTopLevelCommandHelp(),\n \"\",\n ];\n return lines.join(\"\\n\");\n}\n\nexport function printRootHelp(argv: string[] = process.argv): void {\n if (argv.includes(\"--no-color\")) {\n ui.disableColor();\n }\n process.stdout.write(renderRootHelpText());\n}\n\nfunction renderGroupedCommandHelp(cmd: Command): string {\n const commands = cmd.commands.filter((command) => !isHiddenHelpCommand(command));\n\n if (commands.length === 0) {\n return \"\";\n }\n\n const lines: string[] = [];\n\n const commandStrs = commands.map((c) => {\n const name = c.name();\n const aliases = c.aliases();\n const args = c.registeredArguments?.map((arg) => {\n if (arg.required) {\n return `<${arg.name()}>`;\n }\n return `[${arg.name()}]`;\n }).join(\" \") || \"\";\n\n let fullStr = name;\n if (aliases.length) {\n fullStr += ` (${aliases.join(\", \")})`;\n }\n if (args) {\n fullStr += ` ${args}`;\n }\n\n return fullStr;\n });\n\n const maxNameLength = commandStrs.length > 0 ? Math.max(...commandStrs.map((s) => s.length)) : 0;\n\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i];\n const nameStr = commandStrs[i];\n if (!command || !nameStr) continue;\n const padding = \" \".repeat(Math.max(2, maxNameLength - nameStr.length + 2));\n const desc = resolveCommandDescription(command);\n lines.push(` ${ui.theme.command(nameStr)}${padding}${desc}`);\n }\n\n return lines.join(\"\\n\");\n}\n\nfunction renderCommandSection(title: string, commands: Command[]): string {\n if (commands.length === 0) {\n return \"\";\n }\n\n const commandStrs = commands.map((c) => {\n const name = c.name();\n const aliases = c.aliases();\n const args = c.registeredArguments?.map((arg) => {\n if (arg.required) {\n return `<${arg.name()}>`;\n }\n return `[${arg.name()}]`;\n }).join(\" \") || \"\";\n let fullStr = name;\n if (aliases.length) {\n fullStr += ` (${aliases.join(\", \")})`;\n }\n if (args) {\n fullStr += ` ${args}`;\n }\n return fullStr;\n });\n const maxNameLength = Math.max(...commandStrs.map((entry) => entry.length));\n const lines = [ui.theme.heading(title)];\n for (let i = 0; i < commands.length; i++) {\n const command = commands[i];\n const nameStr = commandStrs[i];\n if (!command || !nameStr) {\n continue;\n }\n const padding = \" \".repeat(Math.max(2, maxNameLength - nameStr.length + 2));\n lines.push(` ${ui.theme.command(nameStr)}${padding}${resolveCommandDescription(command)}`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction renderPluginGroupedCommandHelp(cmd: Command): string {\n const local = cmd.commands.filter((command) =>\n PLUGIN_HELP_LOCAL_COMMANDS.has(command.name()),\n );\n const remote = cmd.commands.filter((command) =>\n PLUGIN_HELP_REMOTE_COMMANDS.has(command.name()),\n );\n return [\n renderCommandSection(\"LOCAL LIBRARY\", local),\n \"\",\n renderCommandSection(\"REMOTE CATALOG\", remote),\n ].join(\"\\n\");\n}\n\nexport function configureCommandGroup(cmd: Command): Command {\n cmd.helpCommand(false);\n cmd.action(() => {\n cmd.outputHelp();\n });\n return cmd;\n}\n\nexport function configureProgramHelp(program: Command): void {\n program\n .name(\"harnesstap\")\n .description(\n \"Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs\",\n )\n // Root -V/--version is handled in runHarnesstapCli (top-level only) so\n // subcommands can keep their own --version options. Help still lists it.\n .option(\"-v, --verbose\", \"Show verbose error output\")\n .option(\"--no-color\", \"Disable color output\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .helpCommand(false)\n .configureOutput({\n outputError: () => {},\n })\n .hook(\"preAction\", (command) => {\n const opts = command.optsWithGlobals<{ color?: boolean }>();\n if (opts.color === false) {\n ui.disableColor();\n }\n })\n .configureHelp({\n formatHelp: (cmd) => {\n if (process.argv.includes(\"--no-color\")) {\n ui.disableColor();\n }\n\n const isTopLevel = cmd.parent === null;\n\n if (!isTopLevel) {\n const helpEntry = getCommandHelpEntry(cmd);\n const lines = [\n \"\",\n ui.theme.heading(\"USAGE\"),\n ` ${commandUsageLine(cmd)}`,\n \"\",\n ];\n\n const description = resolveCommandDescription(cmd);\n if (description) {\n lines.push(description, \"\");\n }\n\n if (helpEntry?.details?.trim()) {\n lines.push(helpEntry.details.trim(), \"\");\n }\n\n const args = cmd.registeredArguments?.filter((arg) => arg.description) ?? [];\n if (args.length > 0) {\n lines.push(ui.theme.heading(\"ARGUMENTS\"));\n const requiredOffTty = new Set(helpEntry?.requiredOffTtyArgs ?? []);\n const argNames = args.map((arg) =>\n formatHelpArgName(arg.name(), arg.required || requiredOffTty.has(arg.name())),\n );\n const maxArgLength = Math.max(...argNames.map((name) => name.length));\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const name = argNames[i];\n if (!arg || !name) continue;\n const padding = \" \".repeat(Math.max(2, maxArgLength - name.length + 2));\n lines.push(` ${ui.theme.flag(name)}${padding}${arg.description}`);\n }\n lines.push(\"\");\n }\n\n if (helpEntry?.examples && helpEntry.examples.length > 0) {\n lines.push(ui.theme.heading(\"EXAMPLES\"));\n for (const example of helpEntry.examples) {\n lines.push(` ${formatCommand(example)}`);\n }\n lines.push(\"\");\n }\n\n const opts = visibleHelpOptions(cmd);\n if (opts.length > 0) {\n lines.push(ui.theme.heading(\"OPTIONS\"));\n const flagStrs = opts.map((opt) => opt.flags);\n const maxFlagLength = Math.max(...flagStrs.map((flags) => flags.length));\n for (let i = 0; i < opts.length; i++) {\n const opt = opts[i];\n const flags = flagStrs[i];\n if (!opt || !flags) continue;\n const padding = \" \".repeat(Math.max(2, maxFlagLength - flags.length + 2));\n lines.push(` ${ui.theme.flag(flags)}${padding}${opt.description || \"\"}`);\n }\n lines.push(\"\");\n }\n\n const subcommands = cmd.name() === \"plugin\"\n ? renderPluginGroupedCommandHelp(cmd)\n : renderGroupedCommandHelp(cmd);\n if (subcommands) {\n if (cmd.name() !== \"plugin\") {\n lines.push(ui.theme.heading(\"COMMANDS\"));\n }\n lines.push(subcommands);\n lines.push(\"\");\n }\n\n return lines.join(\"\\n\");\n }\n\n return renderRootHelpText();\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;AAaO,IAAM,wBAA6C;AAAA,EACxD,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,UAAU,CAAC,oBAAoB,+BAA+B;AAAA,EAChE;AAAA,EACA,QAAQ;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,UAAU,sBAAsB;AAAA,EAC7C;AAAA,EACA,MAAM;AAAA,IACJ,aAAa;AAAA,IACb,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,aACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA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AU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,aAAa;AAAA,IACb,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,aAAa;AAAA,IACb,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,aAAa;AAAA,IACb,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,aACE;AAAA,IACF,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,aACE;AAAA,IACF,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,aACE;AAAA,IACF,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,aACE;AAAA,IACF,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL,aACE;AAAA,IACF,SACE;AAAA,IACF,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,aA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