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/environment-selectors.ts","../src/ui/hook-display.ts"],"sourcesContent":["import { getPluginByName, getPluginById, resolvePluginSelector } from \"../models/plugin-model.js\";\nimport { getEnvironment, resolveEnvironmentSelector } from \"../models/environment.js\";\nimport type { Plugin, Environment } from \"../types.js\";\n\nfunction isUlid(value: string): boolean {\n return /^[0-9A-Z]{26}$/.test(value);\n}\n\nexport function resolveEnvironmentOrThrow(selector: string): Environment {\n const result = resolveEnvironmentSelector(selector);\n if (result.status === \"found\" && result.environment) {\n return result.environment;\n }\n if (result.status === \"ambiguous\") {\n const matches = (result.matches ?? []).map((environment) => environment.id).join(\", \");\n throw new Error(`Environment selector is ambiguous: ${selector} (${matches})`);\n }\n throw new Error(`Environment not found: ${selector}`);\n}\n\nexport function maybeResolveEnvironment(selector: string): Environment | undefined {\n const result = resolveEnvironmentSelector(selector);\n return result.status === \"found\" ? result.environment : undefined;\n}\n\nexport function resolveConfiguredPluginOrThrow(selector: string): Plugin {\n const plugin = resolvePluginSelector(selector);\n if (!plugin) {\n throw new Error(`Configured plugin not found: ${selector}`);\n }\n return plugin;\n}\n\nexport function resolveConfiguredPluginByNameOrId(\n selector: string,\n): Plugin | undefined {\n if (isUlid(selector)) {\n return getPluginById(selector);\n }\n return getPluginByName(selector);\n}\n\nexport function resolveEnvironmentByIdOrThrow(environmentId: string): Environment {\n const environment = getEnvironment(environmentId);\n if (!environment) {\n throw new Error(`Environment not found: ${environmentId}`);\n }\n return environment;\n}\n","const KNOWN_HOOK_EVENTS = [\n \"SessionStart\",\n \"SessionEnd\",\n \"UserPromptSubmit\",\n \"PreToolUse\",\n \"PostToolUse\",\n \"Notification\",\n \"PermissionRequest\",\n \"PreCompact\",\n \"Stop\",\n \"SubagentStop\",\n \"Setup\",\n] as const;\n\nconst INTERPRETERS = new Set([\n \"node\",\n \"nodejs\",\n \"bun\",\n \"deno\",\n \"python\",\n \"python3\",\n \"python2\",\n \"bash\",\n \"sh\",\n \"zsh\",\n \"fish\",\n \"cmd\",\n \"cmd.exe\",\n \"powershell\",\n \"powershell.exe\",\n \"pwsh\",\n \"npx\",\n \"pnpm\",\n \"yarn\",\n \"bunx\",\n \"ts-node\",\n \"tsx\",\n \"env\",\n \"uvx\",\n]);\n\nconst LAUNCHER_FOLLOWERS = new Set([\"dlx\", \"exec\"]);\n\nexport interface HookInventoryWire {\n event: string;\n script: string;\n matcher?: string;\n type?: string;\n}\n\nexport interface HookDisplayInput {\n event?: string | null;\n name?: string | null;\n script?: string | null;\n content?: string | null;\n matcher?: string | null;\n hookType?: string | null;\n hook?: HookInventoryWire | null;\n metadata?: unknown;\n}\n\nfunction compactEventKey(value: string): string {\n return value.replace(/[_\\-\\s]+/g, \"\").toLowerCase();\n}\n\nexport function normalizeHookEventName(event: string): string {\n const trimmed = event.trim();\n if (!trimmed) {\n return trimmed;\n }\n const compact = compactEventKey(trimmed);\n const known = KNOWN_HOOK_EVENTS.find((name) => name.toLowerCase() === compact);\n if (known) {\n return known;\n }\n if (/^[A-Za-z][A-Za-z0-9]*$/.test(trimmed)) {\n return capitalizeFirst(trimmed);\n }\n return trimmed\n .split(/[_\\-\\s]+/)\n .filter(Boolean)\n .map(capitalizeFirst)\n .join(\"\");\n}\n\nfunction capitalizeFirst(value: string): string {\n const head = value.slice(0, 1);\n return `${head.toUpperCase()}${value.slice(1)}`;\n}\n\nexport function eventFromHookResourceName(name: string | null | undefined): string | undefined {\n const trimmed = name?.trim() ?? \"\";\n if (!trimmed) {\n return undefined;\n }\n const compactName = compactEventKey(trimmed);\n const known = [...KNOWN_HOOK_EVENTS]\n .sort((left, right) => right.length - left.length)\n .find((event) => {\n const compact = event.toLowerCase();\n return compactName === compact || compactName.startsWith(compact);\n });\n if (known) {\n return known;\n }\n const dash = trimmed.search(/[-_\\s]/);\n if (dash > 0) {\n return normalizeHookEventName(trimmed.slice(0, dash));\n }\n return normalizeHookEventName(trimmed);\n}\n\nfunction stripWrappingQuotes(token: string): string {\n if (\n (token.startsWith('\"') && token.endsWith('\"'))\n || (token.startsWith(\"'\") && token.endsWith(\"'\"))\n ) {\n return token.slice(1, -1);\n }\n return token;\n}\n\nexport function pathBasename(path: string): string {\n const trimmed = stripWrappingQuotes(path.trim()).replace(/[\\\\/]+$/, \"\");\n if (!trimmed) {\n return \"\";\n }\n const parts = trimmed.split(/[/\\\\]/).filter(Boolean);\n return parts[parts.length - 1] ?? trimmed;\n}\n\nfunction tokenizeCommand(command: string): string[] {\n const tokens: string[] = [];\n const pattern = /\"([^\"]*)\"|'([^']*)'|(\\S+)/g;\n for (const match of command.matchAll(pattern)) {\n const token = match[1] ?? match[2] ?? match[3] ?? \"\";\n if (token) {\n tokens.push(token);\n }\n }\n return tokens;\n}\n\nfunction isFlagToken(token: string): boolean {\n return token.startsWith(\"-\");\n}\n\nfunction isLauncherToken(token: string): boolean {\n const base = pathBasename(token).toLowerCase();\n return INTERPRETERS.has(base) || LAUNCHER_FOLLOWERS.has(base);\n}\n\nexport function hookCommandShortToken(command: string): string {\n const trimmed = command.trim();\n if (!trimmed) {\n return \"\";\n }\n const tokens = tokenizeCommand(trimmed).filter((token) => !/^\\w+=/.test(token));\n if (tokens.length === 0) {\n return pathBasename(trimmed);\n }\n for (const token of tokens) {\n if (isFlagToken(token) || isLauncherToken(token)) {\n continue;\n }\n return pathBasename(token);\n }\n const first = tokens[0] ?? \"\";\n return pathBasename(first);\n}\n\nfunction stringField(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction hookEntryType(entry: unknown): string {\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) {\n return \"\";\n }\n return stringField((entry as { type?: unknown }).type);\n}\n\ntype HookMetadataFields = {\n event?: unknown;\n script?: unknown;\n matcher?: unknown;\n hook_entry?: unknown;\n};\n\nfunction asHookMetadata(value: unknown): HookMetadataFields | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return undefined;\n }\n return value as HookMetadataFields;\n}\n\nexport function hookDisplayInputFromResource(resource: HookDisplayInput): HookDisplayInput {\n const metadata = asHookMetadata(resource.metadata);\n const hook = resource.hook ?? undefined;\n const event = resource.event ?? hook?.event ?? stringField(metadata?.event);\n const script =\n resource.script\n ?? hook?.script\n ?? stringField(metadata?.script)\n ?? resource.content\n ?? \"\";\n const matcher = resource.matcher ?? hook?.matcher ?? stringField(metadata?.matcher);\n const hookType =\n resource.hookType ?? hook?.type ?? hookEntryType(metadata?.hook_entry);\n return {\n event: event || undefined,\n name: resource.name,\n script: script || undefined,\n content: resource.content,\n matcher: matcher || undefined,\n hookType: hookType || undefined,\n hook,\n metadata,\n };\n}\n\nexport function hookInventoryWireFromResource(resource: {\n type?: string | null;\n content?: string | null;\n metadata?: unknown;\n}): HookInventoryWire | undefined {\n if (resource.type !== \"hook\") {\n return undefined;\n }\n const metadata = asHookMetadata(resource.metadata);\n const event = stringField(metadata?.event);\n const script = stringField(metadata?.script) || stringField(resource.content);\n if (!event && !script) {\n return undefined;\n }\n const matcher = stringField(metadata?.matcher);\n const type = hookEntryType(metadata?.hook_entry);\n return {\n event,\n script,\n ...(matcher ? { matcher } : {}),\n ...(type ? { type } : {}),\n };\n}\n\nfunction resolvedEvent(input: HookDisplayInput): string {\n const raw = input.event?.trim() || eventFromHookResourceName(input.name) || \"\";\n return raw ? normalizeHookEventName(raw) : \"\";\n}\n\nfunction resolvedCommand(input: HookDisplayInput): string {\n return (input.script ?? input.content ?? \"\").trim();\n}\n\nexport function formatHookInventoryLabel(input: HookDisplayInput): string {\n const resolved = hookDisplayInputFromResource(input);\n const command = resolvedCommand(resolved);\n const short = hookCommandShortToken(command);\n const event = resolvedEvent(resolved);\n if (!short) {\n return resolved.name?.trim() || event;\n }\n if (!event) {\n return short;\n }\n return `${event}: ${short}`;\n}\n\nexport function formatHookInventoryTooltipLines(input: HookDisplayInput): string[] {\n const resolved = hookDisplayInputFromResource(input);\n const lines: string[] = [];\n const matcher = resolved.matcher?.trim();\n if (matcher) {\n lines.push(`matcher: ${matcher}`);\n }\n const hookType = resolved.hookType?.trim();\n if (hookType) {\n lines.push(`type: ${hookType}`);\n }\n const command = resolvedCommand(resolved);\n const short = hookCommandShortToken(command);\n if (command && command !== short) {\n lines.push(command);\n }\n return lines;\n}\n"],"mappings":";;;;;;AAQO,SAAS,0BAA0B,UAA+B;AACvE,QAAM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AAAA,IAC7B,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,EACzB;AACF;AAEA,SAAS,cAAc,OAAiC;AACtD,QAAM,MAAM,MAAM,OAAO,KAAK,KAAK,0BAA0B,MAAM,IAAI,KAAK;AAC5E,SAAO,MAAM,uBAAuB,GAAG,IAAI;AAC7C;AAEA,SAAS,gBAAgB,OAAiC;AACxD,UAAQ,MAAM,UAAU,MAAM,WAAW,IAAI,KAAK;AACpD;AAEO,SAAS,yBAAyB,OAAiC;AACxE,QAAM,WAAW,6BAA6B,KAAK;AACnD,QAAM,UAAU,gBAAgB,QAAQ;AACxC,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,QAAM,QAAQ,cAAc,QAAQ;AACpC,MAAI,CAAC,OAAO;AACV,WAAO,SAAS,MAAM,KAAK,KAAK;AAAA,EAClC;AACA,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AACA,SAAO,GAAG,KAAK,KAAK,KAAK;AAC3B;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/copy/cli.ts"],"sourcesContent":["/**\n * User-facing CLI copy. ASCII punctuation only (DS-6).\n * Command hints always start with `ht`.\n */\n\nexport const DRY_RUN_NOTHING_CHANGED = \"Dry run. Nothing was changed.\";\n\nexport const NATIVE_MODULE_MISMATCH_MESSAGE =\n \"HarnessTap was installed under a different Node.js version. Run: npm rebuild -g harnesstap\";\n\n/** Quote a user-provided token so a pasted hint parses as one Commander argument. */\nexport function quoteCliArg(value: string): string {\n if (value.length === 0) {\n return '\"\"';\n }\n if (/^[A-Za-z0-9_./:@+=-]+$/.test(value)) {\n return value;\n }\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\nexport function formatHtCommand(path: string): string {\n return `ht ${path}`.trim();\n}\n\nexport function quoted(name: string): string {\n return `\"${name}\"`;\n}\n\nexport function skippedInvalidPluginExport(name: string): string {\n return `Warning: Skipped plugin ${quoted(name)}. Its version is not valid semver.`;\n}\n\nexport function marketplaceUnreachable(source: string): string {\n return `Error: Couldn't reach ${source}.`;\n}\n\nexport function marketplaceUnreachableHint(): string {\n return \"Check the URL, or sign in with ht github login if it's private.\";\n}\n\nexport function marketplacePathMissing(path: string): string {\n return `Error: Couldn't find a marketplace at ${quoted(path)}.`;\n}\n\nexport function marketplacePathNotMarketplace(path: string): string {\n return `Error: ${quoted(path)} is not a marketplace. It needs a marketplace.json file.`;\n}\n\nexport function marketplaceAddFailedNothingSaved(): string {\n return \"Nothing was saved.\";\n}\n\nexport function installPinnedPluginsPrompt(names: string[]): string {\n if (names.length === 1) {\n const only = names[0];\n return `Install pinned plugin ${quoted(only ?? \"\")} into the package cache?`;\n }\n return `Install ${String(names.length)} pinned plugins into the package cache?`;\n}\n\nexport function installPinnedPluginsNeedsYes(): string {\n return \"Error: Pass --yes to install pinned plugins without a prompt.\";\n}\n\nexport function installPinnedPluginsHint(profileName?: string): string {\n if (profileName) {\n return `Run ht profile use ${quoted(profileName)} --yes to install them.`;\n }\n return \"Run ht profile use --yes to install them.\";\n}\n\nexport function missingMarketplacePluginHint(pluginName: string): string {\n return `Run ht profile use to install ${quoted(pluginName)}.`;\n}\n\nexport function skippedHostPluginHook(hookName: string): string {\n return `Skipped hook ${hookName}. It only works when the plugin is installed as a host plugin.`;\n}\n\nexport function skippedDuplicateCommand(name: string): string {\n return `Skipped command ${quoted(name)}. A skill already uses that name.`;\n}\n\n/** Quote a user-provided name in error text (DS-6). */\nexport function quoteName(name: string): string {\n return `\"${name.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"\\\"\", \"\\\\\\\"\")}\"`;\n}\n\nfunction hintToken(value: string): string {\n if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {\n return value;\n }\n return quoteName(value);\n}\n\nexport function ensureErrorPrefix(message: string): string {\n const stripped = message.replace(/^error:\\s*/i, \"\").trim();\n if (stripped.length === 0) {\n return \"Error: Something went wrong.\";\n }\n const sentence = /[.!?]$/.test(stripped) ? stripped : `${stripped}.`;\n return `Error: ${sentence}`;\n}\n\nexport function ensureWarningPrefix(message: string): string {\n const stripped = message.replace(/^warning:\\s*/i, \"\").trim();\n const sentence = /[.!?]$/.test(stripped) ? stripped : `${stripped}.`;\n return `Warning: ${sentence}`;\n}\n\nexport const CLI_HINTS = {\n seeOptions: (commandPath: string): string =>\n commandPath.trim().length > 0\n ? `Run ht ${commandPath.trim()} --help to see the options.`\n : \"Run ht --help to see the options.\",\n pluginList: \"Run ht plugin list to see your plugins.\",\n resourceList: \"Run ht resource list to see your resources.\",\n profileUseExample: 'For example: ht profile use \"global default\"',\n authLogin: \"Run ht auth login to sign in.\",\n githubLogin: marketplaceUnreachableHint(),\n onConflictReplace: \"Use --on-conflict replace to replace it.\",\n unsavedChanges: \"Run again with --changes save, stash or discard.\",\n updateNpm: \"Update with: npm i -g harnesstap\",\n mcpSearch: (name: string): string => `Run ht mcp search ${hintToken(name)} to find it.`,\n scopeAdd: (name: string, harnesses: string): string =>\n `Run ht resource scope ${hintToken(name)} --add ${hintToken(harnesses)}.`,\n portableMcpTip: (name: string, harnessList: string, command: string): string =>\n `Tip: ${quoteName(name)} also works on ${harnessList}. Run ${command}.`,\n forceRemove: \"To remove them too, run: ht apply --force-remove\",\n revert: \"Snapshot saved. Undo with: ht revert\",\n stashPop: \"Bring them back with: ht profile stash pop\",\n harnessSet: \"Run ht harness set to pick your harnesses.\",\n harnessSetOrFlag: \"Run ht harness set, or pass --harness <slugs>.\",\n} as const;\n\nexport const CLI_ERRORS = {\n pluginNotFound: (name: string): string => `No plugin named ${quoteName(name)}.`,\n resourceNotFound: (name: string): string => `No resource named ${quoteName(name)}.`,\n invalidResourceType: (value: string, valid: readonly string[]): string =>\n `${quoteName(value)} isn't a resource type. Valid: ${valid.join(\", \")}.`,\n conflictingResourceTypes: (a: string, b: string): string =>\n `Conflicting type filters: ${quoteName(a)} and ${quoteName(b)}.`,\n pluginAlreadyExists: (name: string): string =>\n `A plugin named ${quoteName(name)} already exists.`,\n environmentAlreadyExists: (name: string): string =>\n `An environment named ${quoteName(name)} already exists.`,\n notAuthenticated: \"Not authenticated to HarnessTap Cloud.\",\n directoryNotFound: (path: string): string => `Directory not found: ${path}.`,\n fileNotFound: (path: string): string => `File not found: ${path}.`,\n gitUnreachable: (url: string): string => `Couldn't reach ${url}.`,\n gitUnreachableGeneric: \"Couldn't reach that git repository.\",\n uniqueConstraintGeneric: \"That name already exists.\",\n missingProfileName: \"Pass a profile name.\",\n noProfileNamed: (name: string): string => `No profile named ${quoteName(name)}.`,\n invalidPluginName: (name: string): string =>\n `${quoteName(name)} isn't a valid plugin name. Use a non-empty name without /, \\\\, .. or control characters.`,\n emptyPluginName: \"Pass a plugin name.\",\n invalidFormat: (value: string): string => `Invalid --format value: ${value}. Use human or json.`,\n mcpNotInLibrary: (name: string): string => `${quoteName(name)} isn't in your library.`,\n newerSchema: \"This data was saved by a newer HarnessTap.\",\n noHarnesses: \"Not set up for any harness yet.\",\n unsavedChanges: (name: string, count: number): string =>\n `${quoteName(name)} has ${count} unsaved change${count === 1 ? \"\" : \"s\"}.`,\n resourceSyncStale: (count: number): string =>\n `${count} linked resource${count === 1 ? \"\" : \"s\"} ${count === 1 ? \"is\" : \"are\"} stale.`,\n} as const;\n\nexport const SCOPE_COPY = {\n allHarnesses: \"Applies to all your harnesses\",\n notSetUp: \"Not set up for any harness yet\",\n mainHarnessTooltip: \"Your main harness. It wins when harnesses disagree.\",\n} as const;\n\nexport const SWITCH_CHANGES_VALUES = [\"save\", \"stash\", \"discard\"] as const;\nexport type SwitchChangesValue = (typeof SWITCH_CHANGES_VALUES)[number];\n\nexport const SWITCH_CHANGES_FLAG_HELP =\n \"What to do with unsaved changes: save, stash or discard\";\n\nexport const DEVICE_LOGIN_WAITING =\n \"Waiting for you to approve in the browser. The code expires in 15 minutes. Press Ctrl+C to cancel.\";\n\nexport function initPickHarnessesLine(): string {\n return `Pick your harnesses: ${formatHtCommand(\"harness set\")}`;\n}\n\nexport function initCompletionHintLine(\n shell: \"bash\" | \"zsh\" | \"fish\" | undefined,\n): string {\n switch (shell) {\n case \"bash\":\n return `Enable tab completion: ${formatHtCommand(\"init completion bash >> ~/.bashrc\")}`;\n case \"zsh\":\n return `Enable tab completion: ${formatHtCommand(\"init completion zsh >> ~/.zshrc\")}`;\n case \"fish\":\n return `Enable tab completion: ${formatHtCommand(\"init completion fish > ~/.config/fish/completions/ht.fish\")}`;\n default:\n return `Enable tab completion: ${formatHtCommand(\"init completion <bash|zsh|fish>\")}`;\n }\n}\n\nexport const CLI_COPY = {\n dryRunNothingChanged: DRY_RUN_NOTHING_CHANGED,\n everythingUpToDate: \"Everything is up to date.\",\n snapshotSavedUndo: \"Snapshot saved. Undo with:\",\n forceRemoveHint: \"To remove them too, run:\",\n keptYouChanged: \"you changed it\",\n keptNotMade: \"not made by HarnessTap\",\n viewSnapshot: \"View snapshot\",\n keptFilesIntro:\n \"files you changed or that HarnessTap didn't create:\",\n} as const;\n\nexport function alreadyExistsOnConflictHint(kind: string, name: string): string {\n return `A ${kind} named \"${name}\" already exists. Use --on-conflict replace to replace it.`;\n}\n\nexport function unsavedChangesLine(profileName: string, count: number): string {\n return CLI_ERRORS.unsavedChanges(profileName, count);\n}\n\nexport function unsavedChangesFlagHint(): string {\n return CLI_HINTS.unsavedChanges;\n}\n\nexport function savedChangesLine(profileName: string, count: number): string {\n return `Saved ${count} changes to ${quoteName(profileName)}.`;\n}\n\nexport function stashedChangesLine(count: number, popCommand: string): string {\n return `Stashed ${count} changes. Bring them back with: ${popCommand}`;\n}\n\nexport function discardedChangesLine(count: number): string {\n return `Discarded ${count} changes.`;\n}\n\nexport function discardConfirm(count: number): string {\n return `Discard ${count} changes? A snapshot keeps a copy.`;\n}\n\nexport const PREVIEW_LABELS = {\n willWrite: \"Will write\",\n upToDate: \"Up to date\",\n notInProfile: \"Not in profile\",\n willRemove: \"Will remove\",\n keptChanged: \"Kept. You changed it.\",\n keptUnmanaged: \"Kept. Not made by HarnessTap.\",\n dryRunHeader: DRY_RUN_NOTHING_CHANGED,\n everythingUpToDate: (unchanged: number): string => `Everything is up to date. ${unchanged} unchanged.`,\n} as const;\n\nexport function applyWroteLine(input: {\n wrote: number;\n removed: number;\n kept: number;\n unchanged?: number;\n omitUnchanged?: boolean;\n}): string {\n const parts: string[] = [];\n if (input.wrote > 0) parts.push(`Wrote ${input.wrote}`);\n if (input.removed > 0) parts.push(`removed ${input.removed}`);\n if (input.wrote === 0 && input.removed === 0) {\n return input.unchanged !== undefined\n ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.`\n : CLI_COPY.everythingUpToDate;\n }\n if (input.kept > 0) parts.push(`kept ${input.kept}`);\n if (parts.length === 0) {\n return input.unchanged !== undefined\n ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.`\n : CLI_COPY.everythingUpToDate;\n }\n if (!input.omitUnchanged && input.unchanged !== undefined && input.unchanged > 0) {\n parts.push(`unchanged ${input.unchanged}`);\n }\n const [first, ...rest] = parts;\n const head = first ?? \"\";\n if (rest.length === 0) {\n return `${head}.`;\n }\n return `${head}, ${rest.join(\", \")}.`;\n}\n\nexport function applyHeaderLine(profileName: string, harnessCount: number): string {\n const noun = harnessCount === 1 ? \"harness\" : \"harnesses\";\n return `Applied \"${profileName}\" to ${harnessCount} ${noun}.`;\n}\n\nexport function dryRunWouldLine(input: {\n write: number;\n remove: number;\n keep: number;\n unchanged: number;\n}): string {\n return `Would write ${input.write}, remove ${input.remove}, keep ${input.keep}. ${input.unchanged} unchanged.`;\n}\n\nexport function dryRunStashLine(count: number, profileName: string): string {\n return `Dry run. Would stash ${count} changes from \"${profileName}\".`;\n}\n\nexport function snapshotSavedUndoLine(revertCommand: string): string {\n return `${CLI_COPY.snapshotSavedUndo} ${revertCommand}`;\n}\n\nexport function keptFilesHeader(count: number): string {\n return `Kept ${count} ${CLI_COPY.keptFilesIntro}`;\n}\n\nexport function restoredRemovedLine(\n restored: number,\n removed: number,\n options: { dryRun?: boolean } = {},\n): string {\n if (options.dryRun) {\n return `Would restore ${restored}, would remove ${removed}.`;\n }\n return `Restored ${restored}, removed ${removed}.`;\n}\n\nexport function dryRunSectionHeader(\n kind: \"write\" | \"remove\" | \"keep\",\n count: number,\n): string {\n switch (kind) {\n case \"write\":\n return `Would write (${count})`;\n case \"remove\":\n return `Would remove (${count})`;\n case \"keep\":\n return `Would keep (${count})`;\n default: {\n const _exhaustive: never = kind;\n return _exhaustive;\n }\n }\n}\n\nexport function keptReasonLabel(reason: \"modified\" | \"unmanaged\"): string {\n switch (reason) {\n case \"modified\":\n return CLI_COPY.keptYouChanged;\n case \"unmanaged\":\n return CLI_COPY.keptNotMade;\n default: {\n const _exhaustive: never = reason;\n return _exhaustive;\n }\n }\n}\n"],"mappings":";;;AAOO,IAAM,iCACX;AA6BK,SAAS,6BAAqC;AACnD,SAAO;AACT;AA8CO,SAAS,UAAU,MAAsB;AAC9C,SAAO,IAAI,KAAK,WAAW,MAAM,MAAM,EAAE,WAAW,KAAM,KAAM,CAAC;AACnE;AAEA,SAAS,UAAU,OAAuB;AACxC,MAAI,0BAA0B,KAAK,KAAK,GAAG;AACzC,WAAO;AAAA,EACT;AACA,SAAO,UAAU,KAAK;AACxB;AAiBO,IAAM,YAAY;AAAA,EACvB,YAAY,CAAC,gBACX,YAAY,KAAK,EAAE,SAAS,IACxB,UAAU,YAAY,KAAK,CAAC,gCAC5B;AAAA,EACN,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,aAAa,2BAA2B;AAAA,EACxC,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,WAAW,CAAC,SAAyB,qBAAqB,UAAU,IAAI,CAAC;AAAA,EACzE,UAAU,CAAC,MAAc,cACvB,yBAAyB,UAAU,IAAI,CAAC,UAAU,UAAU,SAAS,CAAC;AAAA,EACxE,gBAAgB,CAAC,MAAc,aAAqB,YAClD,QAAQ,UAAU,IAAI,CAAC,kBAAkB,WAAW,SAAS,OAAO;AAAA,EACtE,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,kBAAkB;AACpB;","names":[]}
@@ -1,430 +0,0 @@
1
- import {
2
- canonicalApmRepoUrl
3
- } from "./chunk-EWBCFAF3.js";
4
- import {
5
- getPluginById,
6
- getPluginResources,
7
- hasParentTraversalSegment,
8
- recoverOriginLocator,
9
- resolutionKey,
10
- resourceFingerprint
11
- } from "./chunk-2EIJYDNI.js";
12
- import {
13
- PACKAGE_VERSION
14
- } from "./chunk-DWVAR4BP.js";
15
-
16
- // src/services/lockfile.ts
17
- import { createHash } from "crypto";
18
- import { existsSync, readFileSync, writeFileSync } from "fs";
19
- import { join } from "path";
20
- import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
21
- var APM_LOCKFILE_FILENAME = "apm.lock.yaml";
22
- var LOCKFILE_VERSION = "1";
23
- function isRecord(value) {
24
- return value !== null && typeof value === "object" && !Array.isArray(value);
25
- }
26
- function sha256Envelope(value) {
27
- const digest = createHash("sha256").update(value).digest("hex");
28
- return `sha256:${digest}`;
29
- }
30
- function canonicalizeText(content) {
31
- return content.replace(/\r\n/g, "\n");
32
- }
33
- function lockfilePath(projectRoot) {
34
- return join(projectRoot, APM_LOCKFILE_FILENAME);
35
- }
36
- function resourceMapHash(resources) {
37
- const entries = resources.map((resource) => `${resolutionKey(resource)}=${resourceFingerprint(resource)}`).sort();
38
- return sha256Envelope(entries.join("\n"));
39
- }
40
- function pluginIntegrity(pluginId) {
41
- const entries = getPluginResources(pluginId).map((resource) => `${resolutionKey(resource)}=${resourceFingerprint(resource)}`).sort();
42
- return sha256Envelope(entries.join("\n"));
43
- }
44
- function lockSourceFromSelected(plugin) {
45
- switch (plugin.source) {
46
- case "local":
47
- case "marketplace":
48
- case "git":
49
- case "catalog":
50
- return plugin.source;
51
- default: {
52
- const unhandled = plugin.source;
53
- return unhandled;
54
- }
55
- }
56
- }
57
- function gitFieldsForPlugin(pluginId) {
58
- const plugin = getPluginById(pluginId);
59
- if (!plugin) {
60
- return {};
61
- }
62
- const locator = recoverOriginLocator(plugin);
63
- const repo_url = locator?.kind === "git" ? canonicalApmRepoUrl(locator.url) : plugin.origin_locator || void 0;
64
- const resolved_commit = plugin.origin_fingerprint_kind === "git_sha" && plugin.origin_fingerprint ? plugin.origin_fingerprint : void 0;
65
- return {
66
- ...repo_url ? { repo_url } : {},
67
- ...resolved_commit ? { resolved_commit, resolved_ref: resolved_commit } : {}
68
- };
69
- }
70
- function mergeGitLockFields(entry, extras) {
71
- const extra = extras?.find((item) => item.name === entry.name);
72
- if (!extra) {
73
- return entry;
74
- }
75
- return {
76
- ...entry,
77
- source: "git",
78
- repo_url: extra.repo_url,
79
- resolved_commit: extra.resolved_commit,
80
- resolved_ref: extra.resolved_ref,
81
- constraint: extra.constraint,
82
- resolved_tag: extra.resolved_tag,
83
- virtual_path: extra.virtual_path,
84
- ...extra.declared_license ? { declared_license: extra.declared_license } : {}
85
- };
86
- }
87
- function mcpServersFromResources(resources) {
88
- return resources.filter((resource) => resource.type === "mcp_server").map((resource) => {
89
- const metadata = resource.metadata;
90
- return {
91
- name: resource.name,
92
- ...metadata.transport ? { transport: metadata.transport } : {},
93
- ...metadata.command ? { command: metadata.command } : {},
94
- ...metadata.url ? { url: metadata.url } : {}
95
- };
96
- });
97
- }
98
- function deployedFileHashes(files) {
99
- const hashes = {};
100
- for (const file of [...files].sort((left, right) => left.path.localeCompare(right.path))) {
101
- hashes[file.path] = sha256Envelope(canonicalizeText(file.content));
102
- }
103
- return hashes;
104
- }
105
- function normalizeDigest(value) {
106
- return value.replace(/^sha256:/i, "").toLowerCase();
107
- }
108
- var LockIntegrityError = class extends Error {
109
- constructor(message) {
110
- super(message);
111
- this.name = "LockIntegrityError";
112
- }
113
- };
114
- function hashFileOnDisk(rootPath, relativePath) {
115
- const fullPath = join(rootPath, relativePath);
116
- if (!existsSync(fullPath)) {
117
- return void 0;
118
- }
119
- try {
120
- return sha256Envelope(canonicalizeText(readFileSync(fullPath, "utf8")));
121
- } catch {
122
- return void 0;
123
- }
124
- }
125
- function diffDeployedFileHashes(expected, files, options = {}) {
126
- const issues = [];
127
- const planned = deployedFileHashes(files);
128
- for (const relativePath of Object.keys(expected).sort()) {
129
- if (hasParentTraversalSegment(relativePath) || relativePath.startsWith("/")) {
130
- issues.push({ kind: "unsafe-path", path: relativePath });
131
- }
132
- }
133
- for (const relativePath of Object.keys(expected).sort()) {
134
- const expectedHash = expected[relativePath];
135
- const plannedHash = planned[relativePath];
136
- if (plannedHash !== void 0) {
137
- if (expectedHash && normalizeDigest(expectedHash) !== normalizeDigest(plannedHash)) {
138
- issues.push({
139
- kind: "mismatch",
140
- path: relativePath,
141
- expected: normalizeDigest(expectedHash),
142
- actual: normalizeDigest(plannedHash)
143
- });
144
- }
145
- continue;
146
- }
147
- if (options.rootPath) {
148
- const diskHash = hashFileOnDisk(options.rootPath, relativePath);
149
- if (diskHash === void 0) {
150
- issues.push({ kind: "missing", path: relativePath, expected: expectedHash });
151
- }
152
- continue;
153
- }
154
- issues.push({ kind: "missing", path: relativePath, expected: expectedHash });
155
- }
156
- for (const relativePath of Object.keys(planned).sort()) {
157
- if (expected[relativePath] === void 0) {
158
- issues.push({ kind: "extra", path: relativePath, actual: planned[relativePath] });
159
- }
160
- }
161
- return issues;
162
- }
163
- function verifyDeployedFileHashes(expected, files, options = {}) {
164
- const issues = diffDeployedFileHashes(expected, files, options);
165
- const first = issues[0];
166
- if (!first) return;
167
- switch (first.kind) {
168
- case "unsafe-path":
169
- throw new LockIntegrityError(
170
- `Unsafe local_deployed_file_hashes path ${first.path}. Apply aborted closed.`
171
- );
172
- case "missing":
173
- throw new LockIntegrityError(
174
- `Deployed tree is missing ${first.path} listed in local_deployed_file_hashes`
175
- );
176
- case "mismatch":
177
- throw new LockIntegrityError(
178
- `Hash mismatch for ${first.path}: lockfile records ${first.expected}, file is ${first.actual}`
179
- );
180
- case "extra":
181
- throw new LockIntegrityError(
182
- `Deployed tree contains extra file ${first.path} that is not listed in local_deployed_file_hashes`
183
- );
184
- default: {
185
- const unhandled = first.kind;
186
- throw new LockIntegrityError(`Unknown lock integrity issue: ${String(unhandled)}`);
187
- }
188
- }
189
- }
190
- function lockfileFromResolution(result, extras = {}) {
191
- const mcp_servers = mcpServersFromResources(result.resources);
192
- const deployed = extras.deployedFiles ? deployedFileHashes(extras.deployedFiles) : void 0;
193
- return {
194
- root: result.root.name,
195
- resolved_at: (/* @__PURE__ */ new Date()).toISOString(),
196
- resource_map_hash: resourceMapHash(result.resources),
197
- plugins: result.selected.filter((plugin) => plugin.depth > 0).map((plugin) => {
198
- const integrity = pluginIntegrity(plugin.pluginId);
199
- const declared = extras.declaredLicenses?.[plugin.name] ?? extras.gitLocks?.find((item) => item.name === plugin.name)?.declared_license;
200
- return mergeGitLockFields(
201
- {
202
- name: plugin.name,
203
- version: plugin.version,
204
- source: lockSourceFromSelected(plugin),
205
- integrity,
206
- depth: plugin.depth,
207
- path: plugin.path,
208
- content_hash: integrity,
209
- ...gitFieldsForPlugin(plugin.pluginId),
210
- ...extras.execStatuses?.[plugin.name] ? { exec_status: extras.execStatuses[plugin.name] } : {},
211
- ...declared ? { declared_license: declared } : {}
212
- },
213
- extras.gitLocks
214
- );
215
- }),
216
- ...extras.environment ? { environment: extras.environment } : {},
217
- ...mcp_servers.length > 0 ? { mcp_servers } : {},
218
- ...deployed && Object.keys(deployed).length > 0 ? { deployed_file_hashes: deployed } : {}
219
- };
220
- }
221
- function apmSourceForEntry(entry) {
222
- if (entry.source === "local") return "local";
223
- if (entry.source === "catalog") return "registry";
224
- return void 0;
225
- }
226
- function serializeLockDependency(entry) {
227
- return {
228
- name: entry.name,
229
- version: entry.version,
230
- depth: entry.depth,
231
- ...apmSourceForEntry(entry) ? { source: apmSourceForEntry(entry) } : {},
232
- ...entry.repo_url ? { repo_url: entry.repo_url } : {},
233
- ...entry.resolved_commit ? { resolved_commit: entry.resolved_commit } : {},
234
- ...entry.resolved_ref ? { resolved_ref: entry.resolved_ref } : {},
235
- ...entry.constraint ? { constraint: entry.constraint } : {},
236
- ...entry.resolved_tag ? { resolved_tag: entry.resolved_tag } : {},
237
- ...entry.virtual_path ? { virtual_path: entry.virtual_path } : {},
238
- ...entry.content_hash ? { content_hash: entry.content_hash } : {},
239
- ...entry.exec_status ? { exec_status: entry.exec_status } : {},
240
- ...entry.declared_license ? { declared_license: entry.declared_license } : {}
241
- };
242
- }
243
- function writeLockfile(projectRoot, lock) {
244
- const path = lockfilePath(projectRoot);
245
- const document = {
246
- lockfile_version: LOCKFILE_VERSION,
247
- generated_at: lock.resolved_at,
248
- apm_version: PACKAGE_VERSION,
249
- dependencies: [...lock.plugins].sort((left, right) => {
250
- const byRepo = (left.repo_url ?? left.name).localeCompare(right.repo_url ?? right.name);
251
- return byRepo;
252
- }).map(serializeLockDependency),
253
- ...lock.mcp_servers && lock.mcp_servers.length > 0 ? { mcp_servers: lock.mcp_servers } : {},
254
- ...lock.deployed_file_hashes ? { local_deployed_file_hashes: lock.deployed_file_hashes } : {},
255
- root: lock.root,
256
- resource_map_hash: lock.resource_map_hash,
257
- ...lock.environment ? { environment: lock.environment } : {},
258
- plugins: lock.plugins.map((entry) => ({
259
- name: entry.name,
260
- version: entry.version,
261
- source: entry.source,
262
- integrity: entry.integrity,
263
- depth: entry.depth,
264
- path: entry.path,
265
- ...entry.repo_url ? { repo_url: entry.repo_url } : {},
266
- ...entry.resolved_commit ? { resolved_commit: entry.resolved_commit } : {},
267
- ...entry.resolved_ref ? { resolved_ref: entry.resolved_ref } : {},
268
- ...entry.constraint ? { constraint: entry.constraint } : {},
269
- ...entry.resolved_tag ? { resolved_tag: entry.resolved_tag } : {},
270
- ...entry.virtual_path ? { virtual_path: entry.virtual_path } : {},
271
- ...entry.content_hash ? { content_hash: entry.content_hash } : {},
272
- ...entry.exec_status ? { exec_status: entry.exec_status } : {},
273
- ...entry.declared_license ? { declared_license: entry.declared_license } : {}
274
- }))
275
- };
276
- writeFileSync(
277
- path,
278
- stringifyYaml(document, {
279
- indent: 2,
280
- lineWidth: 0,
281
- defaultKeyType: "PLAIN"
282
- }),
283
- "utf8"
284
- );
285
- }
286
- function parseLockSource(value) {
287
- switch (value) {
288
- case "local":
289
- case "marketplace":
290
- case "git":
291
- case "catalog":
292
- return value;
293
- case "registry":
294
- return "catalog";
295
- default:
296
- return "local";
297
- }
298
- }
299
- function parseHtPluginEntry(entry) {
300
- return {
301
- name: String(entry.name ?? ""),
302
- version: String(entry.version ?? ""),
303
- source: parseLockSource(entry.source),
304
- integrity: String(entry.integrity ?? entry.content_hash ?? ""),
305
- depth: Number(entry.depth ?? 1),
306
- path: Array.isArray(entry.path) ? entry.path.map(String) : [],
307
- ...typeof entry.repo_url === "string" ? { repo_url: entry.repo_url } : {},
308
- ...typeof entry.resolved_commit === "string" ? { resolved_commit: entry.resolved_commit } : {},
309
- ...typeof entry.resolved_ref === "string" ? { resolved_ref: entry.resolved_ref } : {},
310
- ...typeof entry.constraint === "string" ? { constraint: entry.constraint } : {},
311
- ...typeof entry.resolved_tag === "string" ? { resolved_tag: entry.resolved_tag } : {},
312
- ...typeof entry.virtual_path === "string" ? { virtual_path: entry.virtual_path } : {},
313
- ...typeof entry.content_hash === "string" ? { content_hash: entry.content_hash } : {},
314
- ...parseExecStatus(entry.exec_status) ? { exec_status: parseExecStatus(entry.exec_status) } : {},
315
- ...typeof entry.declared_license === "string" && entry.declared_license.trim() ? { declared_license: entry.declared_license.trim() } : {}
316
- };
317
- }
318
- function parseExecStatus(value) {
319
- switch (value) {
320
- case "deployed":
321
- case "gated_pending_approval":
322
- case "denied":
323
- case "absent":
324
- return value;
325
- default:
326
- return void 0;
327
- }
328
- }
329
- function parseApmDependencyEntry(entry) {
330
- return parseHtPluginEntry({
331
- name: entry.name,
332
- version: entry.version,
333
- source: entry.source,
334
- integrity: entry.integrity ?? entry.content_hash,
335
- depth: entry.depth,
336
- path: entry.path,
337
- repo_url: entry.repo_url,
338
- resolved_commit: entry.resolved_commit,
339
- resolved_ref: entry.resolved_ref,
340
- constraint: entry.constraint,
341
- resolved_tag: entry.resolved_tag,
342
- virtual_path: entry.virtual_path,
343
- content_hash: entry.content_hash,
344
- exec_status: entry.exec_status,
345
- declared_license: entry.declared_license
346
- });
347
- }
348
- function readLockfile(projectRoot) {
349
- const path = lockfilePath(projectRoot);
350
- if (!existsSync(path)) {
351
- return void 0;
352
- }
353
- const parsed = parseYaml(readFileSync(path, "utf8"));
354
- if (!isRecord(parsed)) {
355
- throw new Error(`Invalid lockfile in ${path}: expected a YAML mapping`);
356
- }
357
- const version = String(parsed.lockfile_version ?? "");
358
- if (version !== LOCKFILE_VERSION && version !== "2") {
359
- throw new Error(
360
- `Unsupported lockfile_version: ${version || "(missing)"}. Expected "${LOCKFILE_VERSION}". Delete ${APM_LOCKFILE_FILENAME} and re-run apply to regenerate it.`
361
- );
362
- }
363
- const htPlugins = Array.isArray(parsed.plugins) ? parsed.plugins.filter(isRecord).map(parseHtPluginEntry) : [];
364
- const apmDeps = Array.isArray(parsed.dependencies) ? parsed.dependencies.filter(isRecord).map(parseApmDependencyEntry) : [];
365
- const plugins = htPlugins.length > 0 ? htPlugins : apmDeps;
366
- const mcpRaw = parsed.mcp_servers;
367
- const mcp_servers = Array.isArray(mcpRaw) ? mcpRaw.filter(isRecord).map((entry) => ({
368
- name: String(entry.name ?? ""),
369
- ...typeof entry.transport === "string" ? { transport: entry.transport } : {},
370
- ...typeof entry.command === "string" ? { command: entry.command } : {},
371
- ...typeof entry.url === "string" ? { url: entry.url } : {}
372
- })) : void 0;
373
- const deployedRaw = parsed.local_deployed_file_hashes;
374
- const deployed_file_hashes = isRecord(deployedRaw) ? Object.fromEntries(
375
- Object.entries(deployedRaw).map(([filePath, hash]) => [filePath, String(hash)])
376
- ) : void 0;
377
- return {
378
- root: String(parsed.root ?? ""),
379
- resolved_at: String(parsed.generated_at ?? parsed.resolved_at ?? ""),
380
- resource_map_hash: String(parsed.resource_map_hash ?? ""),
381
- plugins,
382
- ...typeof parsed.environment === "string" ? { environment: parsed.environment } : {},
383
- ...mcp_servers && mcp_servers.length > 0 ? { mcp_servers } : {},
384
- ...deployed_file_hashes ? { deployed_file_hashes } : {}
385
- };
386
- }
387
- function lockedVersionsFrom(lock) {
388
- return new Map(lock.plugins.map((entry) => [entry.name, entry.version]));
389
- }
390
- function lockIsUsable(lock, rootName) {
391
- return lock.root === rootName && lock.plugins.every((entry) => entry.version !== "");
392
- }
393
- function compareLockToResolution(lock, result) {
394
- const lockedByName = new Map(lock.plugins.map((entry) => [entry.name, entry.version]));
395
- const resolvedByName = new Map(
396
- result.selected.filter((p) => p.depth > 0).map((p) => [p.name, p.version])
397
- );
398
- const changes = [];
399
- for (const [name, locked] of lockedByName) {
400
- const resolved = resolvedByName.get(name);
401
- if (resolved !== void 0 && resolved !== locked) {
402
- changes.push({ name, locked, resolved });
403
- }
404
- }
405
- const added = [...resolvedByName.keys()].filter((name) => !lockedByName.has(name));
406
- const removed = [...lockedByName.keys()].filter((name) => !lockedByName.has(name));
407
- const resourceDrift = lock.resource_map_hash !== resourceMapHash(result.resources);
408
- return {
409
- drift: changes.length > 0 || added.length > 0 || removed.length > 0 || resourceDrift,
410
- root: lock.root,
411
- changes,
412
- added,
413
- removed
414
- };
415
- }
416
-
417
- export {
418
- APM_LOCKFILE_FILENAME,
419
- lockfilePath,
420
- LockIntegrityError,
421
- diffDeployedFileHashes,
422
- verifyDeployedFileHashes,
423
- lockfileFromResolution,
424
- writeLockfile,
425
- readLockfile,
426
- lockedVersionsFrom,
427
- lockIsUsable,
428
- compareLockToResolution
429
- };
430
- //# sourceMappingURL=chunk-SPRVUATR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/lockfile.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { hasParentTraversalSegment } from \"../utils/path-containment.js\";\nimport { getPluginById, getPluginResources } from \"../models/plugin-model.js\";\nimport type { McpServerMetadata, Resource } from \"../types.js\";\nimport { PACKAGE_VERSION } from \"../version.js\";\nimport { recoverOriginLocator } from \"./plugin-origin-locator.js\";\nimport { canonicalApmRepoUrl } from \"./apm-git-resolve.js\";\nimport type { ExecStatus } from \"./executable-trust.js\";\nimport { resourceFingerprint, resolutionKey } from \"./resolve/resource-resolution.js\";\nimport type { ResolutionResult, SelectedPlugin } from \"./resolve/types.js\";\n\nexport const APM_LOCKFILE_FILENAME = \"apm.lock.yaml\";\nexport const LOCKFILE_VERSION = \"1\";\n\nexport type LockSource = \"local\" | \"marketplace\" | \"git\" | \"catalog\";\n\nexport interface LockEntry {\n name: string;\n version: string;\n source: LockSource;\n /** Hash over the plugin's attached resource fingerprints. */\n integrity: string;\n depth: number;\n /** Dependency path from the root that selected this version. */\n path: string[];\n repo_url?: string;\n resolved_commit?: string;\n resolved_ref?: string;\n constraint?: string;\n resolved_tag?: string;\n virtual_path?: string;\n content_hash?: string;\n exec_status?: ExecStatus;\n /** Manifest `license:` recorded at apply/install. Omitted when undeclared. */\n declared_license?: string;\n}\n\nexport interface LockMcpServer {\n name: string;\n transport?: string;\n command?: string;\n url?: string;\n}\n\nexport interface Lockfile {\n root: string;\n resolved_at: string;\n /** Hash over the resolved `type:name` → fingerprint map, for drift detection. */\n resource_map_hash: string;\n plugins: LockEntry[];\n environment?: string;\n mcp_servers?: LockMcpServer[];\n deployed_file_hashes?: Record<string, string>;\n}\n\nexport interface ApmGitLockFields {\n name: string;\n repo_url: string;\n resolved_commit: string;\n resolved_ref?: string;\n constraint?: string;\n resolved_tag?: string;\n virtual_path?: string;\n declared_license?: string;\n}\n\nexport interface LockfileFromResolutionExtras {\n environment?: string;\n deployedFiles?: Array<{ path: string; content: string }>;\n gitLocks?: ApmGitLockFields[];\n execStatuses?: Record<string, ExecStatus>;\n declaredLicenses?: Record<string, string>;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function sha256Envelope(value: string): string {\n const digest = createHash(\"sha256\").update(value).digest(\"hex\");\n return `sha256:${digest}`;\n}\n\nfunction canonicalizeText(content: string): string {\n return content.replace(/\\r\\n/g, \"\\n\");\n}\n\nexport function lockfilePath(projectRoot: string): string {\n return join(projectRoot, APM_LOCKFILE_FILENAME);\n}\n\nexport function resourceMapHash(resources: Resource[]): string {\n const entries = resources\n .map((resource) => `${resolutionKey(resource)}=${resourceFingerprint(resource)}`)\n .sort();\n return sha256Envelope(entries.join(\"\\n\"));\n}\n\nexport function pluginIntegrity(pluginId: string): string {\n const entries = getPluginResources(pluginId)\n .map((resource) => `${resolutionKey(resource)}=${resourceFingerprint(resource)}`)\n .sort();\n return sha256Envelope(entries.join(\"\\n\"));\n}\n\nfunction lockSourceFromSelected(plugin: SelectedPlugin): LockSource {\n switch (plugin.source) {\n case \"local\":\n case \"marketplace\":\n case \"git\":\n case \"catalog\":\n return plugin.source;\n default: {\n const unhandled: never = plugin.source;\n return unhandled;\n }\n }\n}\n\nfunction gitFieldsForPlugin(pluginId: string): Pick<\n LockEntry,\n \"repo_url\" | \"resolved_commit\" | \"resolved_ref\"\n> {\n const plugin = getPluginById(pluginId);\n if (!plugin) {\n return {};\n }\n const locator = recoverOriginLocator(plugin);\n const repo_url = locator?.kind === \"git\"\n ? canonicalApmRepoUrl(locator.url)\n : plugin.origin_locator || undefined;\n const resolved_commit =\n plugin.origin_fingerprint_kind === \"git_sha\" && plugin.origin_fingerprint\n ? plugin.origin_fingerprint\n : undefined;\n return {\n ...(repo_url ? { repo_url } : {}),\n ...(resolved_commit ? { resolved_commit, resolved_ref: resolved_commit } : {}),\n };\n}\n\nfunction mergeGitLockFields(\n entry: LockEntry,\n extras: ApmGitLockFields[] | undefined,\n): LockEntry {\n const extra = extras?.find((item) => item.name === entry.name);\n if (!extra) {\n return entry;\n }\n return {\n ...entry,\n source: \"git\",\n repo_url: extra.repo_url,\n resolved_commit: extra.resolved_commit,\n resolved_ref: extra.resolved_ref,\n constraint: extra.constraint,\n resolved_tag: extra.resolved_tag,\n virtual_path: extra.virtual_path,\n ...(extra.declared_license ? { declared_license: extra.declared_license } : {}),\n };\n}\n\nfunction mcpServersFromResources(resources: Resource[]): LockMcpServer[] {\n return resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => {\n const metadata = resource.metadata as McpServerMetadata;\n return {\n name: resource.name,\n ...(metadata.transport ? { transport: metadata.transport } : {}),\n ...(metadata.command ? { command: metadata.command } : {}),\n ...(metadata.url ? { url: metadata.url } : {}),\n };\n });\n}\n\nfunction deployedFileHashes(\n files: Array<{ path: string; content: string }>,\n): Record<string, string> {\n const hashes: Record<string, string> = {};\n for (const file of [...files].sort((left, right) => left.path.localeCompare(right.path))) {\n hashes[file.path] = sha256Envelope(canonicalizeText(file.content));\n }\n return hashes;\n}\n\nfunction normalizeDigest(value: string): string {\n return value.replace(/^sha256:/i, \"\").toLowerCase();\n}\n\nexport class LockIntegrityError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"LockIntegrityError\";\n }\n}\n\nexport type DeployedHashIssueKind = \"missing\" | \"extra\" | \"mismatch\" | \"unsafe-path\";\n\nexport interface DeployedHashIssue {\n kind: DeployedHashIssueKind;\n path: string;\n expected?: string;\n actual?: string;\n}\n\nexport interface VerifyDeployedHashesOptions {\n /** When set, \"missing\" means the lock path is absent on disk, not absent from the new plan. */\n rootPath?: string;\n}\n\nfunction hashFileOnDisk(rootPath: string, relativePath: string): string | undefined {\n const fullPath = join(rootPath, relativePath);\n if (!existsSync(fullPath)) {\n return undefined;\n }\n try {\n return sha256Envelope(canonicalizeText(readFileSync(fullPath, \"utf8\")));\n } catch {\n return undefined;\n }\n}\n\nexport function diffDeployedFileHashes(\n expected: Record<string, string>,\n files: Array<{ path: string; content: string }>,\n options: VerifyDeployedHashesOptions = {},\n): DeployedHashIssue[] {\n const issues: DeployedHashIssue[] = [];\n const planned = deployedFileHashes(files);\n\n for (const relativePath of Object.keys(expected).sort()) {\n if (hasParentTraversalSegment(relativePath) || relativePath.startsWith(\"/\")) {\n issues.push({ kind: \"unsafe-path\", path: relativePath });\n }\n }\n\n for (const relativePath of Object.keys(expected).sort()) {\n const expectedHash = expected[relativePath];\n const plannedHash = planned[relativePath];\n if (plannedHash !== undefined) {\n if (expectedHash && normalizeDigest(expectedHash) !== normalizeDigest(plannedHash)) {\n issues.push({\n kind: \"mismatch\",\n path: relativePath,\n expected: normalizeDigest(expectedHash),\n actual: normalizeDigest(plannedHash),\n });\n }\n continue;\n }\n // Path is in the lock but not in the new plan. With rootPath, that is only\n // a lock failure when the file is also gone from disk (W1-1).\n if (options.rootPath) {\n const diskHash = hashFileOnDisk(options.rootPath, relativePath);\n if (diskHash === undefined) {\n issues.push({ kind: \"missing\", path: relativePath, expected: expectedHash });\n }\n continue;\n }\n issues.push({ kind: \"missing\", path: relativePath, expected: expectedHash });\n }\n\n for (const relativePath of Object.keys(planned).sort()) {\n if (expected[relativePath] === undefined) {\n issues.push({ kind: \"extra\", path: relativePath, actual: planned[relativePath] });\n }\n }\n\n return issues;\n}\n\nexport function verifyDeployedFileHashes(\n expected: Record<string, string>,\n files: Array<{ path: string; content: string }>,\n options: VerifyDeployedHashesOptions = {},\n): void {\n const issues = diffDeployedFileHashes(expected, files, options);\n const first = issues[0];\n if (!first) return;\n\n switch (first.kind) {\n case \"unsafe-path\":\n throw new LockIntegrityError(\n `Unsafe local_deployed_file_hashes path ${first.path}. Apply aborted closed.`,\n );\n case \"missing\":\n throw new LockIntegrityError(\n `Deployed tree is missing ${first.path} listed in local_deployed_file_hashes`,\n );\n case \"mismatch\":\n throw new LockIntegrityError(\n `Hash mismatch for ${first.path}: lockfile records ${first.expected}, file is ${first.actual}`,\n );\n case \"extra\":\n throw new LockIntegrityError(\n `Deployed tree contains extra file ${first.path} that is not listed in local_deployed_file_hashes`,\n );\n default: {\n const unhandled: never = first.kind;\n throw new LockIntegrityError(`Unknown lock integrity issue: ${String(unhandled)}`);\n }\n }\n}\n\nexport function lockfileFromResolution(\n result: ResolutionResult,\n extras: LockfileFromResolutionExtras = {},\n): Lockfile {\n const mcp_servers = mcpServersFromResources(result.resources);\n const deployed = extras.deployedFiles ? deployedFileHashes(extras.deployedFiles) : undefined;\n return {\n root: result.root.name,\n resolved_at: new Date().toISOString(),\n resource_map_hash: resourceMapHash(result.resources),\n plugins: result.selected\n .filter((plugin) => plugin.depth > 0)\n .map((plugin) => {\n const integrity = pluginIntegrity(plugin.pluginId);\n const declared =\n extras.declaredLicenses?.[plugin.name]\n ?? extras.gitLocks?.find((item) => item.name === plugin.name)?.declared_license;\n return mergeGitLockFields(\n {\n name: plugin.name,\n version: plugin.version,\n source: lockSourceFromSelected(plugin),\n integrity,\n depth: plugin.depth,\n path: plugin.path,\n content_hash: integrity,\n ...gitFieldsForPlugin(plugin.pluginId),\n ...(extras.execStatuses?.[plugin.name]\n ? { exec_status: extras.execStatuses[plugin.name] }\n : {}),\n ...(declared ? { declared_license: declared } : {}),\n },\n extras.gitLocks,\n );\n }),\n ...(extras.environment ? { environment: extras.environment } : {}),\n ...(mcp_servers.length > 0 ? { mcp_servers } : {}),\n ...(deployed && Object.keys(deployed).length > 0 ? { deployed_file_hashes: deployed } : {}),\n };\n}\n\nfunction apmSourceForEntry(entry: LockEntry): string | undefined {\n if (entry.source === \"local\") return \"local\";\n if (entry.source === \"catalog\") return \"registry\";\n return undefined;\n}\n\nfunction serializeLockDependency(entry: LockEntry): Record<string, unknown> {\n return {\n name: entry.name,\n version: entry.version,\n depth: entry.depth,\n ...(apmSourceForEntry(entry) ? { source: apmSourceForEntry(entry) } : {}),\n ...(entry.repo_url ? { repo_url: entry.repo_url } : {}),\n ...(entry.resolved_commit ? { resolved_commit: entry.resolved_commit } : {}),\n ...(entry.resolved_ref ? { resolved_ref: entry.resolved_ref } : {}),\n ...(entry.constraint ? { constraint: entry.constraint } : {}),\n ...(entry.resolved_tag ? { resolved_tag: entry.resolved_tag } : {}),\n ...(entry.virtual_path ? { virtual_path: entry.virtual_path } : {}),\n ...(entry.content_hash ? { content_hash: entry.content_hash } : {}),\n ...(entry.exec_status ? { exec_status: entry.exec_status } : {}),\n ...(entry.declared_license ? { declared_license: entry.declared_license } : {}),\n };\n}\n\nexport function writeLockfile(projectRoot: string, lock: Lockfile): void {\n const path = lockfilePath(projectRoot);\n const document: Record<string, unknown> = {\n lockfile_version: LOCKFILE_VERSION,\n generated_at: lock.resolved_at,\n apm_version: PACKAGE_VERSION,\n dependencies: [...lock.plugins]\n .sort((left, right) => {\n const byRepo = (left.repo_url ?? left.name).localeCompare(right.repo_url ?? right.name);\n return byRepo;\n })\n .map(serializeLockDependency),\n ...(lock.mcp_servers && lock.mcp_servers.length > 0\n ? { mcp_servers: lock.mcp_servers }\n : {}),\n ...(lock.deployed_file_hashes\n ? { local_deployed_file_hashes: lock.deployed_file_hashes }\n : {}),\n root: lock.root,\n resource_map_hash: lock.resource_map_hash,\n ...(lock.environment ? { environment: lock.environment } : {}),\n plugins: lock.plugins.map((entry) => ({\n name: entry.name,\n version: entry.version,\n source: entry.source,\n integrity: entry.integrity,\n depth: entry.depth,\n path: entry.path,\n ...(entry.repo_url ? { repo_url: entry.repo_url } : {}),\n ...(entry.resolved_commit ? { resolved_commit: entry.resolved_commit } : {}),\n ...(entry.resolved_ref ? { resolved_ref: entry.resolved_ref } : {}),\n ...(entry.constraint ? { constraint: entry.constraint } : {}),\n ...(entry.resolved_tag ? { resolved_tag: entry.resolved_tag } : {}),\n ...(entry.virtual_path ? { virtual_path: entry.virtual_path } : {}),\n ...(entry.content_hash ? { content_hash: entry.content_hash } : {}),\n ...(entry.exec_status ? { exec_status: entry.exec_status } : {}),\n ...(entry.declared_license ? { declared_license: entry.declared_license } : {}),\n })),\n };\n writeFileSync(\n path,\n stringifyYaml(document, {\n indent: 2,\n lineWidth: 0,\n defaultKeyType: \"PLAIN\",\n }),\n \"utf8\",\n );\n}\n\nfunction parseLockSource(value: unknown): LockSource {\n switch (value) {\n case \"local\":\n case \"marketplace\":\n case \"git\":\n case \"catalog\":\n return value;\n case \"registry\":\n return \"catalog\";\n default:\n return \"local\";\n }\n}\n\nfunction parseHtPluginEntry(entry: Record<string, unknown>): LockEntry {\n return {\n name: String(entry.name ?? \"\"),\n version: String(entry.version ?? \"\"),\n source: parseLockSource(entry.source),\n integrity: String(entry.integrity ?? entry.content_hash ?? \"\"),\n depth: Number(entry.depth ?? 1),\n path: Array.isArray(entry.path) ? entry.path.map(String) : [],\n ...(typeof entry.repo_url === \"string\" ? { repo_url: entry.repo_url } : {}),\n ...(typeof entry.resolved_commit === \"string\"\n ? { resolved_commit: entry.resolved_commit }\n : {}),\n ...(typeof entry.resolved_ref === \"string\" ? { resolved_ref: entry.resolved_ref } : {}),\n ...(typeof entry.constraint === \"string\" ? { constraint: entry.constraint } : {}),\n ...(typeof entry.resolved_tag === \"string\" ? { resolved_tag: entry.resolved_tag } : {}),\n ...(typeof entry.virtual_path === \"string\" ? { virtual_path: entry.virtual_path } : {}),\n ...(typeof entry.content_hash === \"string\" ? { content_hash: entry.content_hash } : {}),\n ...(parseExecStatus(entry.exec_status) ? { exec_status: parseExecStatus(entry.exec_status) } : {}),\n ...(typeof entry.declared_license === \"string\" && entry.declared_license.trim()\n ? { declared_license: entry.declared_license.trim() }\n : {}),\n };\n}\n\nfunction parseExecStatus(value: unknown): ExecStatus | undefined {\n switch (value) {\n case \"deployed\":\n case \"gated_pending_approval\":\n case \"denied\":\n case \"absent\":\n return value;\n default:\n return undefined;\n }\n}\n\nfunction parseApmDependencyEntry(entry: Record<string, unknown>): LockEntry {\n return parseHtPluginEntry({\n name: entry.name,\n version: entry.version,\n source: entry.source,\n integrity: entry.integrity ?? entry.content_hash,\n depth: entry.depth,\n path: entry.path,\n repo_url: entry.repo_url,\n resolved_commit: entry.resolved_commit,\n resolved_ref: entry.resolved_ref,\n constraint: entry.constraint,\n resolved_tag: entry.resolved_tag,\n virtual_path: entry.virtual_path,\n content_hash: entry.content_hash,\n exec_status: entry.exec_status,\n declared_license: entry.declared_license,\n });\n}\n\nexport function readLockfile(projectRoot: string): Lockfile | undefined {\n const path = lockfilePath(projectRoot);\n if (!existsSync(path)) {\n return undefined;\n }\n const parsed = parseYaml(readFileSync(path, \"utf8\"));\n if (!isRecord(parsed)) {\n throw new Error(`Invalid lockfile in ${path}: expected a YAML mapping`);\n }\n const version = String(parsed.lockfile_version ?? \"\");\n if (version !== LOCKFILE_VERSION && version !== \"2\") {\n throw new Error(\n `Unsupported lockfile_version: ${version || \"(missing)\"}. Expected \"${LOCKFILE_VERSION}\". ` +\n `Delete ${APM_LOCKFILE_FILENAME} and re-run apply to regenerate it.`,\n );\n }\n\n const htPlugins = Array.isArray(parsed.plugins)\n ? parsed.plugins.filter(isRecord).map(parseHtPluginEntry)\n : [];\n const apmDeps = Array.isArray(parsed.dependencies)\n ? parsed.dependencies.filter(isRecord).map(parseApmDependencyEntry)\n : [];\n const plugins = htPlugins.length > 0 ? htPlugins : apmDeps;\n\n const mcpRaw = parsed.mcp_servers;\n const mcp_servers = Array.isArray(mcpRaw)\n ? mcpRaw.filter(isRecord).map((entry) => ({\n name: String(entry.name ?? \"\"),\n ...(typeof entry.transport === \"string\" ? { transport: entry.transport } : {}),\n ...(typeof entry.command === \"string\" ? { command: entry.command } : {}),\n ...(typeof entry.url === \"string\" ? { url: entry.url } : {}),\n }))\n : undefined;\n\n const deployedRaw = parsed.local_deployed_file_hashes;\n const deployed_file_hashes = isRecord(deployedRaw)\n ? Object.fromEntries(\n Object.entries(deployedRaw).map(([filePath, hash]) => [filePath, String(hash)]),\n )\n : undefined;\n\n return {\n root: String(parsed.root ?? \"\"),\n resolved_at: String(parsed.generated_at ?? parsed.resolved_at ?? \"\"),\n resource_map_hash: String(parsed.resource_map_hash ?? \"\"),\n plugins,\n ...(typeof parsed.environment === \"string\" ? { environment: parsed.environment } : {}),\n ...(mcp_servers && mcp_servers.length > 0 ? { mcp_servers } : {}),\n ...(deployed_file_hashes ? { deployed_file_hashes } : {}),\n };\n}\n\nexport function lockedVersionsFrom(lock: Lockfile): Map<string, string> {\n return new Map(lock.plugins.map((entry) => [entry.name, entry.version]));\n}\n\nexport function lockfileMatchesResolution(\n lock: Lockfile,\n result: ResolutionResult,\n): boolean {\n if (lock.root !== result.root.name) return false;\n if (lock.resource_map_hash !== resourceMapHash(result.resources)) return false;\n const resolved = new Map(\n result.selected.filter((p) => p.depth > 0).map((p) => [p.name, p.version]),\n );\n if (resolved.size !== lock.plugins.length) return false;\n return lock.plugins.every((entry) => resolved.get(entry.name) === entry.version);\n}\n\n/**\n * True when every locked plugin is still available at the locked version.\n * A stale lock falls back to a full re-resolution rather than failing.\n */\nexport function lockIsUsable(lock: Lockfile, rootName: string): boolean {\n return lock.root === rootName && lock.plugins.every((entry) => entry.version !== \"\");\n}\n\nexport interface LockDrift {\n drift: boolean;\n root: string;\n changes: Array<{ name: string; locked: string; resolved: string }>;\n added: string[];\n removed: string[];\n}\n\nexport function compareLockToResolution(\n lock: Lockfile,\n result: ResolutionResult,\n): LockDrift {\n const lockedByName = new Map(lock.plugins.map((entry) => [entry.name, entry.version]));\n const resolvedByName = new Map(\n result.selected.filter((p) => p.depth > 0).map((p) => [p.name, p.version]),\n );\n\n const changes: LockDrift[\"changes\"] = [];\n for (const [name, locked] of lockedByName) {\n const resolved = resolvedByName.get(name);\n if (resolved !== undefined && resolved !== locked) {\n changes.push({ name, locked, resolved });\n }\n }\n const added = [...resolvedByName.keys()].filter((name) => !lockedByName.has(name));\n const removed = [...lockedByName.keys()].filter((name) => !lockedByName.has(name));\n const resourceDrift = lock.resource_map_hash !== resourceMapHash(result.resources);\n\n return {\n drift: changes.length > 0 || added.length > 0 || removed.length > 0 || resourceDrift,\n root: lock.root,\n changes,\n added,\n removed,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SA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DEFAULT_PROFILE_NAME = "global default";
8
- var LEGACY_DEFAULT_PROFILE_NAME = "default";
9
- var CLEARED_GLOBAL_PROFILE_NAME = "empty";
10
- var CLEARED_GLOBAL_PROFILE_PLUGIN_ID = "builtin:empty";
11
- function isEmptyBuiltinProfile(name) {
12
- return name.trim() === CLEARED_GLOBAL_PROFILE_NAME;
13
- }
14
- function isReservedProfileName(name) {
15
- return isEmptyBuiltinProfile(name);
16
- }
17
- function isProfilePlugin(plugin) {
18
- return plugin.tags.includes(PROFILE_PLUGIN_TAG);
19
- }
20
- function listProfilePlugins() {
21
- return listPlugins().filter((plugin) => isProfilePlugin(plugin));
22
- }
23
-
24
- export {
25
- PROFILE_PLUGIN_TAG,
26
- GLOBAL_DEFAULT_PROFILE_NAME,
27
- LEGACY_DEFAULT_PROFILE_NAME,
28
- CLEARED_GLOBAL_PROFILE_NAME,
29
- CLEARED_GLOBAL_PROFILE_PLUGIN_ID,
30
- isEmptyBuiltinProfile,
31
- isReservedProfileName,
32
- isProfilePlugin,
33
- listProfilePlugins
34
- };
35
- //# sourceMappingURL=chunk-SY7G5QEI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants/profile.ts"],"sourcesContent":["import { listPlugins } from \"../models/plugin-model.js\";\nimport type { Plugin } from \"../types.js\";\n\nexport const PROFILE_PLUGIN_TAG = \"profile\";\n\n/** Home-scoped profile seeded from `ht init` / first-run home scan. */\nexport const GLOBAL_DEFAULT_PROFILE_NAME = \"global default\";\n\n/** Pre-rename init profile name; migrated to GLOBAL_DEFAULT_PROFILE_NAME. */\nexport const LEGACY_DEFAULT_PROFILE_NAME = \"default\";\n\n/** Project-scoped profile seeded when desktop adds a repository. */\nexport const PROJECT_DEFAULT_PROFILE_NAME = \"project default\";\n\n/** Extra tag on auto-seeded project profiles; omitted from the Global rail. */\nexport const PROJECT_PROFILE_TAG = \"project\";\n\n/** @deprecated Use PROFILE_PLUGIN_TAG */\nexport const PROFILE_LAYER_TAG = PROFILE_PLUGIN_TAG;\n\n/** Internal snapshot key for a cleared global apply (not a user-facing profile). */\nexport const CLEARED_GLOBAL_PROFILE_NAME = \"empty\";\n\n/** @deprecated Use CLEARED_GLOBAL_PROFILE_NAME. Reserved legacy name: not a selectable profile. */\nexport const EMPTY_PROFILE_NAME = CLEARED_GLOBAL_PROFILE_NAME;\n\n/** Sentinel id for cleared global apply snapshots (not a DB plugin row). */\nexport const CLEARED_GLOBAL_PROFILE_PLUGIN_ID = \"builtin:empty\";\n\n/** @deprecated Use CLEARED_GLOBAL_PROFILE_PLUGIN_ID */\nexport const CLEARED_GLOBAL_PROFILE_LAYER_ID = CLEARED_GLOBAL_PROFILE_PLUGIN_ID;\n\n/** @deprecated Use CLEARED_GLOBAL_PROFILE_PLUGIN_ID. */\nexport const EMPTY_PROFILE_LAYER_ID = CLEARED_GLOBAL_PROFILE_PLUGIN_ID;\n\nexport function isEmptyBuiltinProfile(name: string): boolean {\n return name.trim() === CLEARED_GLOBAL_PROFILE_NAME;\n}\n\nexport function isReservedProfileName(name: string): boolean {\n return isEmptyBuiltinProfile(name);\n}\n\nexport function isProfilePlugin(plugin: Pick<Plugin, \"tags\">): boolean {\n return plugin.tags.includes(PROFILE_PLUGIN_TAG);\n}\n\nexport function isProjectProfilePlugin(plugin: Pick<Plugin, \"tags\">): boolean {\n return isProfilePlugin(plugin) && plugin.tags.includes(PROJECT_PROFILE_TAG);\n}\n\nexport function isAutoSeededDefaultProfileName(name: string): boolean {\n return name === LEGACY_DEFAULT_PROFILE_NAME || name === GLOBAL_DEFAULT_PROFILE_NAME;\n}\n\n/** @deprecated Use isProfilePlugin */\nexport const isProfileLayer = isProfilePlugin;\n\nexport function listProfilePlugins(): Plugin[] {\n return listPlugins().filter((plugin) => isProfilePlugin(plugin));\n}\n\n/** @deprecated Use listProfilePlugins */\nexport const listProfileLayers = listProfilePlugins;\n"],"mappings":";;;;;AAGO,IAAM,qBAAqB;AAG3B,IAAM,8BAA8B;AAGpC,IAAM,8BAA8B;AAYpC,IAAM,8BAA8B;AAMpC,IAAM,mCAAmC;AAQzC,SAAS,sBAAsB,MAAuB;AAC3D,SAAO,KAAK,KAAK,MAAM;AACzB;AAEO,SAAS,sBAAsB,MAAuB;AAC3D,SAAO,sBAAsB,IAAI;AACnC;AAEO,SAAS,gBAAgB,QAAuC;AACrE,SAAO,OAAO,KAAK,SAAS,kBAAkB;AAChD;AAaO,SAAS,qBAA+B;AAC7C,SAAO,YAAY,EAAE,OAAO,CAAC,WAAW,gBAAgB,MAAM,CAAC;AACjE;","names":[]}