harnesstap 1.3.1 → 1.3.2

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 (175) hide show
  1. package/dist/apply-Q5SFF3FY.js +67 -0
  2. package/dist/{approve-KQNCNH2R.js → approve-L7IFSYBO.js} +12 -12
  3. package/dist/{audit-SLYOZCMI.js → audit-PBJDK7A4.js} +16 -16
  4. package/dist/{auth-3IEVICFT.js → auth-OM73RLNS.js} +8 -8
  5. package/dist/bin.js +2 -2
  6. package/dist/{chunk-DWVAR4BP.js → chunk-24V5ZSIF.js} +6 -4
  7. package/dist/chunk-24V5ZSIF.js.map +1 -0
  8. package/dist/{chunk-NJ7WRKIQ.js → chunk-3EGM4IUI.js} +3 -3
  9. package/dist/{chunk-GRJY22U6.js → chunk-3JOPDYQD.js} +45 -6
  10. package/dist/chunk-3JOPDYQD.js.map +1 -0
  11. package/dist/{chunk-XQFT4PEP.js → chunk-555XE3NJ.js} +2 -2
  12. package/dist/{chunk-3RBYT7QN.js → chunk-64R32MG2.js} +7 -7
  13. package/dist/{chunk-XFZQVYIN.js → chunk-6I3RY6R5.js} +4 -4
  14. package/dist/{chunk-SZNBUIDR.js → chunk-6JMVGKMD.js} +47 -47
  15. package/dist/chunk-6JMVGKMD.js.map +1 -0
  16. package/dist/{chunk-KCQC7YBK.js → chunk-6ZWKF3YZ.js} +13 -13
  17. package/dist/{chunk-BSOBXLYI.js → chunk-AFKCNFPP.js} +6 -6
  18. package/dist/{chunk-UJYFTXHV.js → chunk-AUWWL6KX.js} +5 -5
  19. package/dist/{chunk-KDAV2GUT.js → chunk-AVZOFMJX.js} +11 -11
  20. package/dist/{chunk-KMWHZSEG.js → chunk-BXSS2S4W.js} +2 -2
  21. package/dist/{chunk-TYULB6ZY.js → chunk-CZ4T75PP.js} +19 -19
  22. package/dist/{chunk-MWXA4PFE.js → chunk-ENHDEB7Z.js} +3 -3
  23. package/dist/{chunk-C4QBVVEH.js → chunk-EY4ES5MG.js} +3 -3
  24. package/dist/{chunk-VL2NWCZV.js → chunk-FBYAIBHP.js} +2 -2
  25. package/dist/{chunk-J4CKQXQ6.js → chunk-FUV7QYBS.js} +5 -5
  26. package/dist/{chunk-DV74UZJI.js → chunk-G5RWVZZ7.js} +3 -3
  27. package/dist/{chunk-F2L4VNQK.js → chunk-GWQVYGRD.js} +16 -16
  28. package/dist/{chunk-3IZ7SEGT.js → chunk-HENOKIBB.js} +3 -3
  29. package/dist/{chunk-PXU2OS26.js → chunk-HWL67OCJ.js} +2 -2
  30. package/dist/{chunk-7LWH5SWH.js → chunk-IAZNF35S.js} +2 -2
  31. package/dist/{chunk-JKGSJGCC.js → chunk-IHW4PCDT.js} +4 -4
  32. package/dist/{chunk-ZY2MZ2KQ.js → chunk-IKAGGJEO.js} +2 -2
  33. package/dist/{chunk-G26HZZDJ.js → chunk-JJJJ2RAD.js} +4 -4
  34. package/dist/{chunk-2EIJYDNI.js → chunk-KJIFZLHN.js} +191 -70
  35. package/dist/chunk-KJIFZLHN.js.map +1 -0
  36. package/dist/{chunk-YDD3ES2K.js → chunk-LDVXYN6F.js} +2 -2
  37. package/dist/{chunk-QRZPQNLX.js → chunk-LGWUTV5Q.js} +8 -8
  38. package/dist/{chunk-LNJ3WZZX.js → chunk-MFCZN253.js} +7 -7
  39. package/dist/{chunk-SPRVUATR.js → chunk-MHOTXMD2.js} +4 -4
  40. package/dist/{chunk-SY7G5QEI.js → chunk-NEPUP33Q.js} +2 -2
  41. package/dist/{chunk-GQKKX7OE.js → chunk-OPVIX7E4.js} +2 -2
  42. package/dist/{chunk-BIBUCC2E.js → chunk-OQ4KBUN2.js} +4 -4
  43. package/dist/{chunk-K2BPYEH5.js → chunk-OXVCYRZB.js} +2 -2
  44. package/dist/{chunk-MY62SSKC.js → chunk-PJQAMC6L.js} +3 -3
  45. package/dist/{chunk-HVVPTCKR.js → chunk-PW5QXRBA.js} +4 -4
  46. package/dist/{chunk-IK524ZDW.js → chunk-QNAIDM6W.js} +2 -2
  47. package/dist/{chunk-63U7QWNY.js → chunk-R4PTE774.js} +14 -14
  48. package/dist/{chunk-7L2K4N25.js → chunk-S2E4KSYW.js} +6 -6
  49. package/dist/{chunk-H6DVP2SI.js → chunk-U472S6IB.js} +10 -10
  50. package/dist/{chunk-4KNQZDZC.js → chunk-UEHDEADL.js} +5 -5
  51. package/dist/{chunk-VC6OKCJF.js → chunk-UNRR4KH5.js} +6 -4
  52. package/dist/{chunk-VC6OKCJF.js.map → chunk-UNRR4KH5.js.map} +1 -1
  53. package/dist/{chunk-IRU7NBOT.js → chunk-WXRPQICX.js} +2 -2
  54. package/dist/{chunk-IBOABSIA.js → chunk-XCPWLGPB.js} +2 -2
  55. package/dist/{chunk-VL7BGD47.js → chunk-XRXFJTAT.js} +7 -7
  56. package/dist/{chunk-DXKAKKLP.js → chunk-Y2JGMICO.js} +2 -2
  57. package/dist/{chunk-KDDXZBMC.js → chunk-YRGM7RAD.js} +5 -5
  58. package/dist/{chunk-QO4LBDVI.js → chunk-YVJQ2QDG.js} +34 -34
  59. package/dist/{chunk-EIWXS4RM.js → chunk-YX7MVSDA.js} +3 -3
  60. package/dist/{chunk-EWBCFAF3.js → chunk-ZGRBIBO7.js} +4 -4
  61. package/dist/{chunk-3IWTJCPA.js → chunk-ZTBAMBAI.js} +4 -4
  62. package/dist/{chunk-6BY4BV5G.js → chunk-ZVANUFPF.js} +40 -3
  63. package/dist/chunk-ZVANUFPF.js.map +1 -0
  64. package/dist/{compile-57EEIUMB.js → compile-SDOASKGL.js} +44 -44
  65. package/dist/{config-4EJ3D7QJ.js → config-4VZTVZKF.js} +22 -22
  66. package/dist/{doctor-EEV6P5CH.js → doctor-HH6CFBRQ.js} +11 -11
  67. package/dist/{environment-WFEG4DAT.js → environment-K7YMJJYN.js} +24 -24
  68. package/dist/{github-BSMQD72A.js → github-A6TYG7WS.js} +7 -7
  69. package/dist/{harness-VX3PNVQW.js → harness-772XBFZQ.js} +20 -20
  70. package/dist/{help-AW2HKX63.js → help-QR4VTJZU.js} +16 -16
  71. package/dist/{help-BVFOZD7E.js → help-TLHNRJJ6.js} +2 -2
  72. package/dist/index.js +19 -19
  73. package/dist/{init-SPN2GEZ4.js → init-AOKFPZHG.js} +28 -28
  74. package/dist/{lock-K2LLUU7H.js → lock-INAXNLMC.js} +11 -11
  75. package/dist/{marketplace-VEKSWGX3.js → marketplace-TUVLLPBG.js} +7 -7
  76. package/dist/{mcp-T6DKIKSF.js → mcp-MMWGRASN.js} +44 -44
  77. package/dist/{migrate-OO37WSB2.js → migrate-55S4XODX.js} +24 -24
  78. package/dist/open-SLFQV45J.js +32 -0
  79. package/dist/{pack-V32UPC7W.js → pack-VZIBS42E.js} +16 -16
  80. package/dist/plugin-WLEFFBRY.js +64 -0
  81. package/dist/plugin-from-project-UV2O364T.js +16 -0
  82. package/dist/{policy-F5MKZNOC.js → policy-P3HGLEZS.js} +11 -11
  83. package/dist/{profile-H4PMH4XT.js → profile-STS3CZUK.js} +41 -41
  84. package/dist/{project-QVNEJJGH.js → project-R4DGM3ZG.js} +26 -26
  85. package/dist/{resource-GL4RLSGI.js → resource-GJVEDXVZ.js} +33 -33
  86. package/dist/{version-PBHZK44K.js → version-FUHV4O6U.js} +2 -2
  87. package/package.json +3 -1
  88. package/schemas/fixtures/confidence.ap.json +1 -1
  89. package/schemas/fixtures/context7.ap.json +1 -1
  90. package/schemas/fixtures/legacy-schema-v1.ap.json +13 -0
  91. package/schemas/fixtures/legacy-schemas-v1.ap.json +13 -0
  92. package/schemas/fixtures/minimal-with-schema.ap.json +1 -1
  93. package/schemas/fixtures/superpowers.ap.json +1 -1
  94. package/schemas/fixtures/third-party-skills.ap.json +1 -1
  95. package/dist/apply-2GRNKR5H.js +0 -67
  96. package/dist/chunk-2EIJYDNI.js.map +0 -1
  97. package/dist/chunk-6BY4BV5G.js.map +0 -1
  98. package/dist/chunk-DWVAR4BP.js.map +0 -1
  99. package/dist/chunk-GRJY22U6.js.map +0 -1
  100. package/dist/chunk-SZNBUIDR.js.map +0 -1
  101. package/dist/open-3V3QK5RK.js +0 -32
  102. package/dist/plugin-KOBNQ7GT.js +0 -64
  103. package/dist/plugin-from-project-X3VO3MB6.js +0 -16
  104. /package/dist/{apply-2GRNKR5H.js.map → apply-Q5SFF3FY.js.map} +0 -0
  105. /package/dist/{approve-KQNCNH2R.js.map → approve-L7IFSYBO.js.map} +0 -0
  106. /package/dist/{audit-SLYOZCMI.js.map → audit-PBJDK7A4.js.map} +0 -0
  107. /package/dist/{auth-3IEVICFT.js.map → auth-OM73RLNS.js.map} +0 -0
  108. /package/dist/{chunk-NJ7WRKIQ.js.map → chunk-3EGM4IUI.js.map} +0 -0
  109. /package/dist/{chunk-XQFT4PEP.js.map → chunk-555XE3NJ.js.map} +0 -0
  110. /package/dist/{chunk-3RBYT7QN.js.map → chunk-64R32MG2.js.map} +0 -0
  111. /package/dist/{chunk-XFZQVYIN.js.map → chunk-6I3RY6R5.js.map} +0 -0
  112. /package/dist/{chunk-KCQC7YBK.js.map → chunk-6ZWKF3YZ.js.map} +0 -0
  113. /package/dist/{chunk-BSOBXLYI.js.map → chunk-AFKCNFPP.js.map} +0 -0
  114. /package/dist/{chunk-UJYFTXHV.js.map → chunk-AUWWL6KX.js.map} +0 -0
  115. /package/dist/{chunk-KDAV2GUT.js.map → chunk-AVZOFMJX.js.map} +0 -0
  116. /package/dist/{chunk-KMWHZSEG.js.map → chunk-BXSS2S4W.js.map} +0 -0
  117. /package/dist/{chunk-TYULB6ZY.js.map → chunk-CZ4T75PP.js.map} +0 -0
  118. /package/dist/{chunk-MWXA4PFE.js.map → chunk-ENHDEB7Z.js.map} +0 -0
  119. /package/dist/{chunk-C4QBVVEH.js.map → chunk-EY4ES5MG.js.map} +0 -0
  120. /package/dist/{chunk-VL2NWCZV.js.map → chunk-FBYAIBHP.js.map} +0 -0
  121. /package/dist/{chunk-J4CKQXQ6.js.map → chunk-FUV7QYBS.js.map} +0 -0
  122. /package/dist/{chunk-DV74UZJI.js.map → chunk-G5RWVZZ7.js.map} +0 -0
  123. /package/dist/{chunk-F2L4VNQK.js.map → chunk-GWQVYGRD.js.map} +0 -0
  124. /package/dist/{chunk-3IZ7SEGT.js.map → chunk-HENOKIBB.js.map} +0 -0
  125. /package/dist/{chunk-PXU2OS26.js.map → chunk-HWL67OCJ.js.map} +0 -0
  126. /package/dist/{chunk-7LWH5SWH.js.map → chunk-IAZNF35S.js.map} +0 -0
  127. /package/dist/{chunk-JKGSJGCC.js.map → chunk-IHW4PCDT.js.map} +0 -0
  128. /package/dist/{chunk-ZY2MZ2KQ.js.map → chunk-IKAGGJEO.js.map} +0 -0
  129. /package/dist/{chunk-G26HZZDJ.js.map → chunk-JJJJ2RAD.js.map} +0 -0
  130. /package/dist/{chunk-YDD3ES2K.js.map → chunk-LDVXYN6F.js.map} +0 -0
  131. /package/dist/{chunk-QRZPQNLX.js.map → chunk-LGWUTV5Q.js.map} +0 -0
  132. /package/dist/{chunk-LNJ3WZZX.js.map → chunk-MFCZN253.js.map} +0 -0
  133. /package/dist/{chunk-SPRVUATR.js.map → chunk-MHOTXMD2.js.map} +0 -0
  134. /package/dist/{chunk-SY7G5QEI.js.map → chunk-NEPUP33Q.js.map} +0 -0
  135. /package/dist/{chunk-GQKKX7OE.js.map → chunk-OPVIX7E4.js.map} +0 -0
  136. /package/dist/{chunk-BIBUCC2E.js.map → chunk-OQ4KBUN2.js.map} +0 -0
  137. /package/dist/{chunk-K2BPYEH5.js.map → chunk-OXVCYRZB.js.map} +0 -0
  138. /package/dist/{chunk-MY62SSKC.js.map → chunk-PJQAMC6L.js.map} +0 -0
  139. /package/dist/{chunk-HVVPTCKR.js.map → chunk-PW5QXRBA.js.map} +0 -0
  140. /package/dist/{chunk-IK524ZDW.js.map → chunk-QNAIDM6W.js.map} +0 -0
  141. /package/dist/{chunk-63U7QWNY.js.map → chunk-R4PTE774.js.map} +0 -0
  142. /package/dist/{chunk-7L2K4N25.js.map → chunk-S2E4KSYW.js.map} +0 -0
  143. /package/dist/{chunk-H6DVP2SI.js.map → chunk-U472S6IB.js.map} +0 -0
  144. /package/dist/{chunk-4KNQZDZC.js.map → chunk-UEHDEADL.js.map} +0 -0
  145. /package/dist/{chunk-IRU7NBOT.js.map → chunk-WXRPQICX.js.map} +0 -0
  146. /package/dist/{chunk-IBOABSIA.js.map → chunk-XCPWLGPB.js.map} +0 -0
  147. /package/dist/{chunk-VL7BGD47.js.map → chunk-XRXFJTAT.js.map} +0 -0
  148. /package/dist/{chunk-DXKAKKLP.js.map → chunk-Y2JGMICO.js.map} +0 -0
  149. /package/dist/{chunk-KDDXZBMC.js.map → chunk-YRGM7RAD.js.map} +0 -0
  150. /package/dist/{chunk-QO4LBDVI.js.map → chunk-YVJQ2QDG.js.map} +0 -0
  151. /package/dist/{chunk-EIWXS4RM.js.map → chunk-YX7MVSDA.js.map} +0 -0
  152. /package/dist/{chunk-EWBCFAF3.js.map → chunk-ZGRBIBO7.js.map} +0 -0
  153. /package/dist/{chunk-3IWTJCPA.js.map → chunk-ZTBAMBAI.js.map} +0 -0
  154. /package/dist/{compile-57EEIUMB.js.map → compile-SDOASKGL.js.map} +0 -0
  155. /package/dist/{config-4EJ3D7QJ.js.map → config-4VZTVZKF.js.map} +0 -0
  156. /package/dist/{doctor-EEV6P5CH.js.map → doctor-HH6CFBRQ.js.map} +0 -0
  157. /package/dist/{environment-WFEG4DAT.js.map → environment-K7YMJJYN.js.map} +0 -0
  158. /package/dist/{github-BSMQD72A.js.map → github-A6TYG7WS.js.map} +0 -0
  159. /package/dist/{harness-VX3PNVQW.js.map → harness-772XBFZQ.js.map} +0 -0
  160. /package/dist/{help-AW2HKX63.js.map → help-QR4VTJZU.js.map} +0 -0
  161. /package/dist/{help-BVFOZD7E.js.map → help-TLHNRJJ6.js.map} +0 -0
  162. /package/dist/{init-SPN2GEZ4.js.map → init-AOKFPZHG.js.map} +0 -0
  163. /package/dist/{lock-K2LLUU7H.js.map → lock-INAXNLMC.js.map} +0 -0
  164. /package/dist/{marketplace-VEKSWGX3.js.map → marketplace-TUVLLPBG.js.map} +0 -0
  165. /package/dist/{mcp-T6DKIKSF.js.map → mcp-MMWGRASN.js.map} +0 -0
  166. /package/dist/{migrate-OO37WSB2.js.map → migrate-55S4XODX.js.map} +0 -0
  167. /package/dist/{open-3V3QK5RK.js.map → open-SLFQV45J.js.map} +0 -0
  168. /package/dist/{pack-V32UPC7W.js.map → pack-VZIBS42E.js.map} +0 -0
  169. /package/dist/{plugin-KOBNQ7GT.js.map → plugin-WLEFFBRY.js.map} +0 -0
  170. /package/dist/{plugin-from-project-X3VO3MB6.js.map → plugin-from-project-UV2O364T.js.map} +0 -0
  171. /package/dist/{policy-F5MKZNOC.js.map → policy-P3HGLEZS.js.map} +0 -0
  172. /package/dist/{profile-H4PMH4XT.js.map → profile-STS3CZUK.js.map} +0 -0
  173. /package/dist/{project-QVNEJJGH.js.map → project-R4DGM3ZG.js.map} +0 -0
  174. /package/dist/{resource-GL4RLSGI.js.map → resource-GJVEDXVZ.js.map} +0 -0
  175. /package/dist/{version-PBHZK44K.js.map → version-FUHV4O6U.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/marketplace-registry.ts","../src/services/marketplace-catalog.ts","../src/plugins/refresh.ts","../src/utils/run-command-with-timeout.ts","../src/services/builtin-marketplaces.ts","../src/services/marketplace-catalog-index.ts","../src/plugins/host-plugin-manifest.ts","../src/services/skill-discovery.ts","../src/services/marketplace-catalog-parse.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { isAbsolute, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport {\n loadSettings,\n parseTrackedBranches,\n saveSettings,\n type PluginMarketplaceEntry,\n type PluginMarketplacePlatform,\n} from \"../config/settings.js\";\n\nfunction stripGitSuffix(value: string): string {\n return value.replace(/\\.git$/i, \"\");\n}\n\nfunction isLocalFilesystemSource(value: string): boolean {\n if (value.startsWith(\"file:\")) return true;\n if (value.startsWith(\"/\") || value.startsWith(\"./\") || value.startsWith(\"../\")) {\n return true;\n }\n if (value.startsWith(\"~/\")) return true;\n if (/^[A-Za-z]:[\\\\/]/.test(value)) return true;\n return false;\n}\n\nexport function normalizeMarketplaceUrl(url: string): string {\n const trimmed = url.trim();\n if (!trimmed) return \"\";\n\n if (trimmed.startsWith(\"file:\")) {\n try {\n const parsed = new URL(trimmed);\n if (parsed.protocol === \"file:\") {\n return stripGitSuffix(fileURLToPath(parsed));\n }\n } catch {\n // fall through to filesystem / remote handling\n }\n }\n\n if (isLocalFilesystemSource(trimmed)) {\n const expanded = trimmed.startsWith(\"~/\")\n ? resolve(homedir(), trimmed.slice(2))\n : isAbsolute(trimmed)\n ? trimmed\n : resolve(trimmed);\n return stripGitSuffix(expanded);\n }\n\n return stripGitSuffix(trimmed);\n}\n\nexport function marketplaceEntryPayload(\n name: string,\n url: string,\n platforms: PluginMarketplacePlatform[],\n trackedBranches?: string[],\n): PluginMarketplaceEntry {\n const branches = parseTrackedBranches(trackedBranches ?? []);\n return {\n name,\n url,\n platforms: [...platforms],\n ...(branches.length > 0 ? { trackedBranches: branches } : {}),\n };\n}\n\nexport type AddMarketplaceResult =\n | { status: \"added\"; entry: PluginMarketplaceEntry }\n | { status: \"already_configured\"; entry: PluginMarketplaceEntry };\n\nexport function listMarketplaces(harnesstapDir: string): PluginMarketplaceEntry[] {\n return loadSettings(harnesstapDir).plugins.marketplaces;\n}\n\nexport function addMarketplace(\n harnesstapDir: string,\n input: {\n url: string;\n name: string;\n platforms: PluginMarketplacePlatform[];\n trackedBranches?: string[];\n },\n): AddMarketplaceResult {\n const url = normalizeMarketplaceUrl(input.url);\n const name = input.name.trim();\n if (!name) throw new Error(\"Marketplace name is required\");\n if (!url) throw new Error(\"Marketplace URL is required\");\n if (input.platforms.length === 0) {\n throw new Error(\"At least one --platform is required\");\n }\n\n const settings = loadSettings(harnesstapDir);\n const existing = settings.plugins.marketplaces;\n const byUrl = existing.find(\n (e) => normalizeMarketplaceUrl(e.url) === url,\n );\n if (byUrl) {\n return { status: \"already_configured\", entry: byUrl };\n }\n const byName = existing.find((e) => e.name === name);\n if (byName) {\n throw new Error(\n `Marketplace name conflict: \"${name}\" already points at ${byName.url}. Pass a different --name or remove it first.`,\n );\n }\n\n const entry = marketplaceEntryPayload(\n name,\n url,\n input.platforms,\n input.trackedBranches,\n );\n saveSettings(harnesstapDir, {\n ...settings,\n plugins: {\n ...settings.plugins,\n marketplaces: [...existing, entry],\n },\n });\n return { status: \"added\", entry };\n}\n\nexport type RemoveMarketplaceResult =\n | { status: \"removed\"; entry: PluginMarketplaceEntry }\n | { status: \"not_found\"; name: string };\n\nexport function removeMarketplace(\n harnesstapDir: string,\n name: string,\n): RemoveMarketplaceResult {\n const settings = loadSettings(harnesstapDir);\n const entry = settings.plugins.marketplaces.find((e) => e.name === name);\n if (!entry) return { status: \"not_found\", name };\n saveSettings(harnesstapDir, {\n ...settings,\n plugins: {\n ...settings.plugins,\n marketplaces: settings.plugins.marketplaces.filter((e) => e.name !== name),\n },\n });\n return { status: \"removed\", entry };\n}\n\nexport type UpdateMarketplaceResult =\n | {\n status: \"updated\";\n entry: PluginMarketplaceEntry;\n renamedFrom?: string;\n urlChanged: boolean;\n trackedBranchesChanged: boolean;\n }\n | { status: \"not_found\"; name: string };\n\nexport function updateMarketplace(\n harnesstapDir: string,\n currentName: string,\n input: {\n name?: string;\n url?: string;\n platforms?: PluginMarketplacePlatform[];\n trackedBranches?: string[];\n },\n): UpdateMarketplaceResult {\n const settings = loadSettings(harnesstapDir);\n const existing = settings.plugins.marketplaces;\n const index = existing.findIndex((e) => e.name === currentName);\n if (index < 0) return { status: \"not_found\", name: currentName };\n\n const current = existing[index];\n if (!current) return { status: \"not_found\", name: currentName };\n\n const nextName = input.name !== undefined ? input.name.trim() : current.name;\n if (!nextName) throw new Error(\"Marketplace name is required\");\n const nextUrl =\n input.url !== undefined ? normalizeMarketplaceUrl(input.url) : current.url;\n if (!nextUrl) throw new Error(\"Marketplace URL is required\");\n const nextPlatforms =\n input.platforms !== undefined ? [...input.platforms] : [...current.platforms];\n if (nextPlatforms.length === 0) {\n throw new Error(\"At least one --platform is required\");\n }\n const nextTrackedBranches =\n input.trackedBranches !== undefined\n ? parseTrackedBranches(input.trackedBranches)\n : parseTrackedBranches(current.trackedBranches ?? []);\n\n if (nextName !== current.name) {\n const collision = existing.find((e) => e.name === nextName);\n if (collision) {\n throw new Error(\n `Marketplace name conflict: \"${nextName}\" already points at ${collision.url}. Pass a different --name or remove it first.`,\n );\n }\n }\n\n if (nextUrl !== current.url) {\n const collision = existing.find(\n (e) => e.name !== current.name && normalizeMarketplaceUrl(e.url) === nextUrl,\n );\n if (collision) {\n throw new Error(\n `Marketplace URL conflict: \"${collision.name}\" already points at ${collision.url}. Pass a different --url or remove it first.`,\n );\n }\n }\n\n const entry = marketplaceEntryPayload(\n nextName,\n nextUrl,\n nextPlatforms,\n nextTrackedBranches,\n );\n const trackedBranchesChanged =\n parseTrackedBranches(current.trackedBranches ?? []).join(\"\\0\") !==\n parseTrackedBranches(entry.trackedBranches ?? []).join(\"\\0\");\n const marketplaces = [...existing];\n marketplaces[index] = entry;\n saveSettings(harnesstapDir, {\n ...settings,\n plugins: { ...settings.plugins, marketplaces },\n });\n return {\n status: \"updated\",\n entry,\n ...(nextName !== current.name ? { renamedFrom: current.name } : {}),\n urlChanged: nextUrl !== current.url,\n trackedBranchesChanged,\n };\n}\n","import {\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n renameSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join } from \"node:path\";\nimport {\n DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,\n type PluginMarketplacePlatform,\n loadSettings,\n marketplaceRefreshMaxAgeMs,\n parseTrackedBranches,\n} from \"../config/settings.js\";\nimport { refreshGitSource } from \"../plugins/refresh.js\";\nimport { runCommandWithTimeout } from \"../utils/run-command-with-timeout.js\";\nimport {\n builtinMarketplaceEntry,\n builtinMarketplaceGitUrl,\n} from \"./builtin-marketplaces.js\";\nimport {\n catalogPluginMatchesQuery,\n enrichCatalogPlugins,\n} from \"./marketplace-catalog-index.js\";\nimport {\n type CatalogPlugin,\n mergeCatalogPluginsByIdentity,\n type ParsedMarketplaceCatalog,\n parseClaudeMarketplaceManifest,\n parseCursorMarketplaceManifest,\n} from \"./marketplace-catalog-parse.js\";\nimport { listMarketplaces } from \"./marketplace-registry.js\";\n\nexport type { CatalogPlugin } from \"./marketplace-catalog-parse.js\";\n\nexport interface MarketplacePluginBranchVersion {\n name: string;\n version: string;\n branch: string;\n}\n\nexport const MARKETPLACE_CATALOG_INDEX_VERSION = 1;\n\nexport interface StoredMarketplaceCatalog extends ParsedMarketplaceCatalog {\n marketplaceEntryName: string;\n manifestName?: string;\n refreshedAt: string;\n sha?: string;\n pluginVersions?: MarketplacePluginBranchVersion[];\n indexVersion?: number;\n}\n\nexport interface RefreshMarketplaceCatalogOptions {\n name: string;\n force?: boolean;\n}\n\nexport interface RefreshMarketplaceCatalogResult {\n ok: boolean;\n message: string;\n sha?: string;\n}\n\nexport interface ListCatalogPluginsOptions {\n name: string;\n}\n\nconst MANIFEST_PATHS = [\n { path: \".claude-plugin/marketplace.json\", platform: \"claude-code\" as const },\n { path: \".cursor-plugin/marketplace.json\", platform: \"cursor\" as const },\n { path: \"marketplace.json\", platform: null },\n];\n\nexport function marketplaceCacheDir(harnesstapDir: string, name: string): string {\n return join(harnesstapDir, \"cache\", \"marketplaces\", name);\n}\n\nexport function marketplaceCatalogPath(harnesstapDir: string, name: string): string {\n return join(marketplaceCacheDir(harnesstapDir, name), \"catalog.json\");\n}\n\nexport const MARKETPLACE_CATALOG_MAX_AGE_MS = marketplaceRefreshMaxAgeMs(\n DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,\n);\n\nexport function relocateMarketplaceCache(\n harnesstapDir: string,\n fromName: string,\n toName: string,\n): void {\n if (fromName === toName) return;\n const fromDir = marketplaceCacheDir(harnesstapDir, fromName);\n if (!existsSync(fromDir)) return;\n const toDir = marketplaceCacheDir(harnesstapDir, toName);\n if (existsSync(toDir)) {\n rmSync(toDir, { recursive: true, force: true });\n }\n mkdirSync(dirname(toDir), { recursive: true });\n renameSync(fromDir, toDir);\n}\n\nfunction isGooseOnly(platforms: PluginMarketplacePlatform[]): boolean {\n return platforms.length === 1 && platforms[0] === \"goose\";\n}\n\nfunction catalogIsFresh(catalogPath: string, maxAgeMs: number): boolean {\n if (!existsSync(catalogPath)) return false;\n const ageMs = Date.now() - statSync(catalogPath).mtimeMs;\n return ageMs < maxAgeMs;\n}\n\nfunction readStoredCatalog(catalogPath: string): StoredMarketplaceCatalog | undefined {\n if (!existsSync(catalogPath)) return undefined;\n try {\n const raw = JSON.parse(readFileSync(catalogPath, \"utf8\")) as StoredMarketplaceCatalog;\n if (!Array.isArray(raw.plugins)) return undefined;\n return raw;\n } catch {\n return undefined;\n }\n}\n\nfunction writeStoredCatalog(\n catalogPath: string,\n catalog: StoredMarketplaceCatalog,\n): void {\n mkdirSync(dirname(catalogPath), { recursive: true });\n writeFileSync(catalogPath, `${JSON.stringify(catalog, null, 2)}\\n`, \"utf8\");\n}\n\nfunction resolveManifest(\n cacheDir: string,\n platforms: PluginMarketplacePlatform[],\n): { manifestPath: string; platform: PluginMarketplacePlatform } | undefined {\n for (const candidate of MANIFEST_PATHS) {\n const manifestPath = join(cacheDir, candidate.path);\n if (!existsSync(manifestPath)) continue;\n\n if (candidate.platform) {\n return { manifestPath, platform: candidate.platform };\n }\n\n if (platforms.includes(\"claude-code\") || platforms.includes(\"copilot-cli\")) {\n return { manifestPath, platform: \"claude-code\" };\n }\n if (platforms.includes(\"cursor\")) {\n return { manifestPath, platform: \"cursor\" };\n }\n return undefined;\n }\n return undefined;\n}\n\nfunction parseManifest(\n platform: PluginMarketplacePlatform,\n raw: unknown,\n): ParsedMarketplaceCatalog {\n switch (platform) {\n case \"claude-code\":\n return parseClaudeMarketplaceManifest(raw);\n case \"copilot-cli\":\n return parseClaudeMarketplaceManifest(raw);\n case \"cursor\":\n return parseCursorMarketplaceManifest(raw);\n case \"goose\":\n return { marketplaceName: \"\", plugins: [] };\n default: {\n const _exhaustive: never = platform;\n return _exhaustive;\n }\n }\n}\n\nfunction catalogWithRegistryIdentity(\n parsed: ParsedMarketplaceCatalog,\n registryName: string,\n): Pick<StoredMarketplaceCatalog, \"marketplaceName\" | \"manifestName\" | \"plugins\"> {\n const manifestName =\n parsed.marketplaceName.length > 0 && parsed.marketplaceName !== registryName\n ? parsed.marketplaceName\n : undefined;\n\n return {\n marketplaceName: registryName,\n ...(manifestName ? { manifestName } : {}),\n plugins: parsed.plugins.map((plugin) => ({\n ...plugin,\n ref: `${plugin.name}@${registryName}`,\n })),\n };\n}\n\nfunction catalogRefreshEntry(\n harnesstapDir: string,\n name: string,\n):\n | {\n name: string;\n url: string;\n platforms: PluginMarketplacePlatform[];\n trackedBranches?: string[];\n }\n | undefined {\n const registered = listMarketplaces(harnesstapDir).find((entry) => entry.name === name);\n if (registered) {\n return registered;\n }\n const url = builtinMarketplaceGitUrl(name);\n if (!url) {\n return undefined;\n }\n return builtinMarketplaceEntry();\n}\n\nfunction parseCatalogFromDir(\n dir: string,\n platforms: PluginMarketplacePlatform[],\n registryName: string,\n):\n | { ok: true; catalog: ReturnType<typeof catalogWithRegistryIdentity> }\n | { ok: false; message: string } {\n const manifest = resolveManifest(dir, platforms);\n if (!manifest) {\n return {\n ok: false,\n message:\n \"No marketplace manifest found (.claude-plugin/marketplace.json, .cursor-plugin/marketplace.json, or marketplace.json).\",\n };\n }\n\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(manifest.manifestPath, \"utf8\"));\n } catch {\n return { ok: false, message: \"Failed to parse marketplace manifest JSON\" };\n }\n\n return {\n ok: true,\n catalog: catalogWithRegistryIdentity(parseManifest(manifest.platform, raw), registryName),\n };\n}\n\nfunction checkoutBranchName(dir: string): string {\n const result = runCommandWithTimeout(\"git\", [\n \"-c\",\n \"protocol.file.allow=always\",\n \"-C\",\n dir,\n \"rev-parse\",\n \"--abbrev-ref\",\n \"HEAD\",\n ]);\n const name = result.stdout.trim();\n return result.exitCode === 0 && name && name !== \"HEAD\" ? name : \"HEAD\";\n}\n\nfunction versionsFromPlugins(\n plugins: CatalogPlugin[],\n branch: string,\n): MarketplacePluginBranchVersion[] {\n const rows: MarketplacePluginBranchVersion[] = [];\n for (const plugin of plugins) {\n if (!plugin.version) continue;\n rows.push({ name: plugin.name, version: plugin.version, branch });\n }\n return rows;\n}\n\nexport function refreshMarketplaceCatalog(\n harnesstapDir: string,\n options: RefreshMarketplaceCatalogOptions,\n): RefreshMarketplaceCatalogResult {\n const entry = catalogRefreshEntry(harnesstapDir, options.name);\n if (!entry) {\n return { ok: false, message: `Marketplace not found: ${options.name}` };\n }\n\n if (isGooseOnly(entry.platforms)) {\n return {\n ok: false,\n message:\n \"Marketplace catalog refresh is not supported for Goose-only marketplaces.\",\n };\n }\n\n const cacheDir = marketplaceCacheDir(harnesstapDir, entry.name);\n const catalogPath = marketplaceCatalogPath(harnesstapDir, entry.name);\n const settings = loadSettings(harnesstapDir);\n const maxAgeMs = marketplaceRefreshMaxAgeMs(\n settings.plugins.marketplaceRefreshMaxAgeMinutes,\n );\n\n if (!options.force && catalogIsFresh(catalogPath, maxAgeMs)) {\n const stored = readStoredCatalog(catalogPath);\n return {\n ok: true,\n message: \"Catalog is up to date\",\n ...(stored?.sha ? { sha: stored.sha } : {}),\n };\n }\n\n const refresh = refreshGitSource({\n url: entry.url,\n targetDir: cacheDir,\n });\n if (!refresh.ok) {\n return { ok: false, message: refresh.message };\n }\n\n const defaultCatalog = parseCatalogFromDir(cacheDir, entry.platforms, entry.name);\n if (!defaultCatalog.ok) {\n return defaultCatalog;\n }\n\n const defaultBranch = checkoutBranchName(cacheDir);\n const extraBranches = parseTrackedBranches(entry.trackedBranches ?? []).filter(\n (branch) => branch !== defaultBranch,\n );\n const pluginVersions = versionsFromPlugins(defaultCatalog.catalog.plugins, defaultBranch);\n const pluginBatches: CatalogPlugin[][] = [defaultCatalog.catalog.plugins];\n\n for (const branch of extraBranches) {\n const branchDir = mkdtempSync(join(tmpdir(), \"ht-mkt-branch-\"));\n try {\n const branchRefresh = refreshGitSource({\n url: entry.url,\n targetDir: branchDir,\n ref: branch,\n });\n if (!branchRefresh.ok) {\n return {\n ok: false,\n message: `Tracked branch \"${branch}\": ${branchRefresh.message}`,\n };\n }\n const branchCatalog = parseCatalogFromDir(branchDir, entry.platforms, entry.name);\n if (!branchCatalog.ok) {\n return {\n ok: false,\n message: `Tracked branch \"${branch}\": ${branchCatalog.message}`,\n };\n }\n pluginBatches.push(branchCatalog.catalog.plugins);\n pluginVersions.push(...versionsFromPlugins(branchCatalog.catalog.plugins, branch));\n } finally {\n rmSync(branchDir, { recursive: true, force: true });\n }\n }\n\n const catalog = {\n ...defaultCatalog.catalog,\n plugins: enrichCatalogPlugins(\n cacheDir,\n mergeCatalogPluginsByIdentity(pluginBatches.flat()),\n ),\n };\n const stored: StoredMarketplaceCatalog = {\n ...catalog,\n marketplaceEntryName: entry.name,\n refreshedAt: new Date().toISOString(),\n indexVersion: MARKETPLACE_CATALOG_INDEX_VERSION,\n ...(refresh.sha ? { sha: refresh.sha } : {}),\n ...(pluginVersions.length > 0 ? { pluginVersions } : {}),\n };\n writeStoredCatalog(catalogPath, stored);\n\n return {\n ok: true,\n message: refresh.message,\n ...(refresh.sha ? { sha: refresh.sha } : {}),\n };\n}\n\nfunction persistIndexedCatalog(\n harnesstapDir: string,\n name: string,\n stored: StoredMarketplaceCatalog,\n): StoredMarketplaceCatalog {\n if (stored.indexVersion === MARKETPLACE_CATALOG_INDEX_VERSION) {\n return stored;\n }\n const next: StoredMarketplaceCatalog = {\n ...stored,\n plugins: enrichCatalogPlugins(\n marketplaceCacheDir(harnesstapDir, name),\n stored.plugins,\n ),\n indexVersion: MARKETPLACE_CATALOG_INDEX_VERSION,\n };\n writeStoredCatalog(marketplaceCatalogPath(harnesstapDir, name), next);\n return next;\n}\n\nexport function listCatalogPlugins(\n harnesstapDir: string,\n options: ListCatalogPluginsOptions,\n): CatalogPlugin[] {\n const stored = readStoredCatalog(marketplaceCatalogPath(harnesstapDir, options.name));\n if (!stored) {\n return [];\n }\n return persistIndexedCatalog(harnesstapDir, options.name, stored).plugins;\n}\n\n/** Refresh from git only when the on-disk catalog is missing or stale, then list. */\nexport function ensureMarketplaceCatalog(\n harnesstapDir: string,\n options: ListCatalogPluginsOptions & { force?: boolean },\n): CatalogPlugin[] {\n refreshMarketplaceCatalog(harnesstapDir, {\n name: options.name,\n force: options.force ?? false,\n });\n return listCatalogPlugins(harnesstapDir, { name: options.name });\n}\n\nexport function listCatalogPluginBranchVersions(\n harnesstapDir: string,\n marketplace: string,\n pluginName: string,\n): MarketplacePluginBranchVersion[] {\n const stored = readStoredCatalog(marketplaceCatalogPath(harnesstapDir, marketplace));\n return (stored?.pluginVersions ?? []).filter((row) => row.name === pluginName);\n}\n\nexport function listPluginsFromMarketplaceRoot(\n root: string,\n registryName: string,\n platforms: PluginMarketplacePlatform[] = [\"claude-code\"],\n): CatalogPlugin[] {\n const manifest = resolveManifest(root, platforms);\n if (!manifest) return [];\n\n let raw: unknown;\n try {\n raw = JSON.parse(readFileSync(manifest.manifestPath, \"utf8\"));\n } catch {\n return [];\n }\n\n const plugins = catalogWithRegistryIdentity(\n parseManifest(manifest.platform, raw),\n registryName,\n ).plugins;\n return enrichCatalogPlugins(root, plugins);\n}\n\nexport function readMarketplaceManifest(root: string): unknown | undefined {\n const manifest = resolveManifest(root, [\"claude-code\", \"cursor\", \"copilot-cli\"]);\n if (!manifest) return undefined;\n try {\n return JSON.parse(readFileSync(manifest.manifestPath, \"utf8\"));\n } catch {\n return undefined;\n }\n}\n\nfunction pluginMatchesQuery(plugin: CatalogPlugin, query: string): boolean {\n return catalogPluginMatchesQuery(plugin, query);\n}\n\nfunction listCatalogSearchMarketplaces(\n harnesstapDir: string,\n): Array<{ name: string }> {\n const registered = listMarketplaces(harnesstapDir);\n if (registered.some((entry) => builtinMarketplaceGitUrl(entry.name))) {\n return registered;\n }\n return [...registered, builtinMarketplaceEntry()];\n}\n\nexport interface SearchCatalogPluginsOptions {\n refresh?: boolean;\n}\n\nexport function searchCatalogPlugins(\n harnesstapDir: string,\n query: string,\n options: SearchCatalogPluginsOptions = {},\n): CatalogPlugin[] {\n const marketplaces = listCatalogSearchMarketplaces(harnesstapDir);\n if (options.refresh) {\n for (const marketplace of marketplaces) {\n refreshMarketplaceCatalog(harnesstapDir, {\n name: marketplace.name,\n force: true,\n });\n }\n }\n\n const trimmed = query.trim();\n const results: CatalogPlugin[] = [];\n for (const marketplace of marketplaces) {\n const plugins = listCatalogPlugins(harnesstapDir, { name: marketplace.name });\n for (const plugin of plugins) {\n if (!trimmed || pluginMatchesQuery(plugin, trimmed)) {\n results.push(plugin);\n }\n }\n }\n return results;\n}\n","import { existsSync, mkdirSync, rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n githubGitConfigArgs,\n githubHttpsRemoteForAuth,\n resolveGithubAccessToken,\n} from \"../services/github-credentials.js\";\nimport {\n DEFAULT_GIT_CLONE_TIMEOUT_MS,\n runCommandWithTimeout,\n} from \"../utils/run-command-with-timeout.js\";\nimport { mapGitStderr } from \"../utils/git-errors.js\";\nimport type { RunCommand } from \"./run-command.js\";\n\nexport interface GitRefreshOptions {\n url: string;\n ref?: string;\n targetDir: string;\n runCommand?: RunCommand;\n}\n\nexport function refreshGitSource(opts: GitRefreshOptions): {\n ok: boolean;\n sha?: string;\n message: string;\n} {\n const run = opts.runCommand ?? runCommandWithTimeout;\n\n if (existsSync(opts.targetDir)) {\n rmSync(opts.targetDir, { recursive: true, force: true });\n }\n mkdirSync(opts.targetDir, { recursive: true });\n\n const token = resolveGithubAccessToken().token;\n const url = githubHttpsRemoteForAuth(opts.url, token);\n const cloneArgs = [...githubGitConfigArgs(token), \"clone\", \"--depth\", \"1\"];\n if (opts.ref) cloneArgs.push(\"--branch\", opts.ref);\n cloneArgs.push(url, opts.targetDir);\n\n const clone = run(\"git\", cloneArgs, { timeoutMs: DEFAULT_GIT_CLONE_TIMEOUT_MS });\n if (clone.exitCode !== 0) {\n return {\n ok: false,\n message: mapGitStderr(clone.stderr.trim() || \"git clone failed\", opts.url),\n };\n }\n\n const rev = run(\"git\", [\n ...githubGitConfigArgs(token),\n \"-C\",\n opts.targetDir,\n \"rev-parse\",\n \"HEAD\",\n ]);\n return {\n ok: true,\n sha: rev.stdout.trim(),\n message: \"Refreshed from git\",\n };\n}\n\nexport function cursorRepoSourceKey(url: string): string {\n return `cursor:repo:${url}`;\n}\n\nexport function cursorCacheRoot(homeRoot: string): string {\n return join(homeRoot, \".cursor\", \"plugins\", \"cache\");\n}\n\nexport function cursorLocalRoot(homeRoot: string): string {\n return join(homeRoot, \".cursor\", \"plugins\", \"local\");\n}\n\nexport function cursorMarketplacesRoot(homeRoot: string): string {\n return join(homeRoot, \".cursor\", \"plugins\", \"marketplaces\");\n}\n\nexport function cursorProjectsMcpsRoot(homeRoot: string): string {\n return join(homeRoot, \".cursor\", \"projects\", \"mcps\");\n}\n","import { spawnSync } from \"node:child_process\";\nimport type { CommandResult, RunCommandOptions } from \"../plugins/run-command.js\";\n\nexport const DEFAULT_GIT_CLONE_TIMEOUT_MS = 120_000;\n\nexport interface RunCommandWithTimeoutOptions extends RunCommandOptions {\n timeoutMs?: number;\n}\n\nexport function runCommandWithTimeout(\n command: string,\n args: string[],\n options?: RunCommandWithTimeoutOptions,\n): CommandResult {\n const timeoutMs = options?.timeoutMs ?? DEFAULT_GIT_CLONE_TIMEOUT_MS;\n const result = spawnSync(command, args, {\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n cwd: options?.cwd,\n timeout: timeoutMs,\n killSignal: \"SIGTERM\",\n env: command === \"git\"\n ? { ...process.env, GIT_TERMINAL_PROMPT: \"0\", GCM_INTERACTIVE: \"never\" }\n : process.env,\n });\n\n const spawnError = result.error;\n if (spawnError && \"code\" in spawnError && spawnError.code === \"ETIMEDOUT\") {\n return {\n stdout: result.stdout?.toString() ?? \"\",\n stderr: `Command timed out after ${timeoutMs}ms: ${command} ${args.join(\" \")}`,\n exitCode: 124,\n };\n }\n\n return {\n stdout: result.stdout?.toString() ?? \"\",\n stderr: result.stderr?.toString() ?? \"\",\n exitCode: result.status ?? 1,\n };\n}\n","import type { PluginMarketplacePlatform } from \"../config/settings.js\";\n\n/** Cursor's built-in public marketplace, cloned from github.com/cursor/plugins. */\nexport const CURSOR_PUBLIC_MARKETPLACE = \"cursor-public\";\n\nexport const CURSOR_PUBLIC_GIT_URL = \"https://github.com/cursor/plugins.git\";\n\nexport const CURSOR_PUBLIC_PLATFORMS: PluginMarketplacePlatform[] = [\n \"cursor\",\n \"claude-code\",\n];\n\nexport function isCursorPublicMarketplace(name: string): boolean {\n return name === CURSOR_PUBLIC_MARKETPLACE;\n}\n\nexport function builtinMarketplaceGitUrl(name: string): string | null {\n return isCursorPublicMarketplace(name) ? CURSOR_PUBLIC_GIT_URL : null;\n}\n\nexport function builtinMarketplaceEntry(): {\n name: string;\n url: string;\n platforms: PluginMarketplacePlatform[];\n} {\n return {\n name: CURSOR_PUBLIC_MARKETPLACE,\n url: CURSOR_PUBLIC_GIT_URL,\n platforms: [...CURSOR_PUBLIC_PLATFORMS],\n };\n}\n","import { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport matter from \"gray-matter\";\nimport {\n HOST_PLUGIN_MANIFEST_RELATIVE_PATHS,\n readFirstHostPluginManifest,\n} from \"../plugins/host-plugin-manifest.js\";\nimport type {\n CatalogPlugin,\n CatalogPluginContent,\n} from \"./marketplace-catalog-parse.js\";\nimport { discoverSkillPackage } from \"./skill-discovery.js\";\n\nconst PLUGIN_ROOT_WALK_SKIP = new Set([\".git\", \"node_modules\", \".hg\"]);\nconst PLUGIN_ROOT_WALK_MAX_DEPTH = 6;\nconst COMMAND_DIRS = [\"commands\", \".claude/commands\"] as const;\n\nfunction isDirectory(path: string): boolean {\n try {\n return existsSync(path) && statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction uniqueStrings(values: string[]): string[] {\n const seen = new Set<string>();\n const next: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n next.push(value);\n }\n return next;\n}\n\nfunction looksLikePluginRoot(path: string): boolean {\n for (const relative of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {\n if (existsSync(join(path, relative))) return true;\n }\n return isDirectory(join(path, \"skills\")) || isDirectory(join(path, \"commands\"));\n}\n\nfunction walkNamedPluginRoot(\n dir: string,\n pluginName: string,\n depth: number,\n): string | undefined {\n if (depth > PLUGIN_ROOT_WALK_MAX_DEPTH || !isDirectory(dir)) {\n return undefined;\n }\n try {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n if (!entry.isDirectory() || PLUGIN_ROOT_WALK_SKIP.has(entry.name)) {\n continue;\n }\n const child = join(dir, entry.name);\n if (entry.name === pluginName && looksLikePluginRoot(child)) {\n return child;\n }\n const nested = walkNamedPluginRoot(child, pluginName, depth + 1);\n if (nested) return nested;\n }\n } catch {\n return undefined;\n }\n return undefined;\n}\n\nexport function resolveMarketplaceCatalogPluginRoot(\n marketplaceRoot: string,\n plugin: Pick<CatalogPlugin, \"name\" | \"sourcePath\">,\n): string | undefined {\n if (plugin.sourcePath) {\n const fromSource = join(marketplaceRoot, plugin.sourcePath);\n if (isDirectory(fromSource)) return fromSource;\n }\n const underPlugins = join(marketplaceRoot, \"plugins\", plugin.name);\n if (isDirectory(underPlugins) && looksLikePluginRoot(underPlugins)) {\n return underPlugins;\n }\n const atRoot = join(marketplaceRoot, plugin.name);\n if (isDirectory(atRoot) && looksLikePluginRoot(atRoot)) {\n return atRoot;\n }\n return walkNamedPluginRoot(marketplaceRoot, plugin.name, 0);\n}\n\nfunction commandContents(pluginRoot: string): CatalogPluginContent[] {\n const contents: CatalogPluginContent[] = [];\n const seen = new Set<string>();\n for (const relative of COMMAND_DIRS) {\n const dir = join(pluginRoot, relative);\n if (!isDirectory(dir)) continue;\n let entries: string[];\n try {\n entries = readdirSync(dir, { encoding: \"utf8\" });\n } catch {\n continue;\n }\n for (const entry of entries) {\n const name = entry.replace(/\\.(md|toml)$/, \"\");\n if (name === entry || seen.has(name)) continue;\n const absolute = join(dir, entry);\n let description: string | undefined;\n if (entry.endsWith(\".md\")) {\n try {\n const parsed = matter(readFileSync(absolute, \"utf8\"));\n if (typeof parsed.data.description === \"string\") {\n description = parsed.data.description;\n }\n } catch {\n description = undefined;\n }\n }\n seen.add(name);\n contents.push({\n type: \"command\",\n name,\n ...(description ? { description } : {}),\n });\n }\n }\n return contents;\n}\n\nexport function enrichCatalogPlugin(\n marketplaceRoot: string,\n plugin: CatalogPlugin,\n): CatalogPlugin {\n const pluginRoot = resolveMarketplaceCatalogPluginRoot(marketplaceRoot, plugin);\n if (!pluginRoot) return plugin;\n\n const manifest = readFirstHostPluginManifest(pluginRoot);\n const description = plugin.description ?? manifest?.description;\n const keywords = (manifest?.keywords ?? []).filter(\n (keyword): keyword is string =>\n typeof keyword === \"string\" && keyword.trim().length > 0,\n );\n const tags = uniqueStrings([...(plugin.tags ?? []), ...keywords]);\n\n let skills: ReturnType<typeof discoverSkillPackage> = [];\n try {\n skills = discoverSkillPackage(pluginRoot);\n } catch {\n skills = [];\n }\n const contents: CatalogPluginContent[] = [\n ...skills.map((skill) => ({\n type: \"skill\" as const,\n name: skill.name,\n ...(skill.description ? { description: skill.description } : {}),\n })),\n ...commandContents(pluginRoot),\n ];\n\n return {\n ...plugin,\n ...(description ? { description } : {}),\n ...(tags.length > 0 ? { tags } : {}),\n ...(contents.length > 0 ? { contents } : {}),\n };\n}\n\nexport function enrichCatalogPlugins(\n marketplaceRoot: string,\n plugins: CatalogPlugin[],\n): CatalogPlugin[] {\n if (!isDirectory(marketplaceRoot)) return plugins;\n return plugins.map((plugin) => enrichCatalogPlugin(marketplaceRoot, plugin));\n}\n\nexport function catalogPluginMatchesQuery(plugin: CatalogPlugin, query: string): boolean {\n const needle = query.trim().toLowerCase();\n if (!needle) return true;\n if (plugin.name.toLowerCase().includes(needle)) return true;\n if (plugin.ref.toLowerCase().includes(needle)) return true;\n if (plugin.description?.toLowerCase().includes(needle)) return true;\n for (const tag of plugin.tags ?? []) {\n if (tag.toLowerCase().includes(needle)) return true;\n }\n for (const content of plugin.contents ?? []) {\n if (content.name.toLowerCase().includes(needle)) return true;\n if (content.description?.toLowerCase().includes(needle)) return true;\n }\n return false;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\n/** Host and Agent Plugins 1.0 manifest locations, preferred native first. */\nexport const HOST_PLUGIN_MANIFEST_RELATIVE_PATHS = [\n \".claude-plugin/plugin.json\",\n \".cursor-plugin/plugin.json\",\n \".codex-plugin/plugin.json\",\n \".github/plugin/plugin.json\",\n \".goose-plugin/plugin.json\",\n \"plugin.json\",\n] as const;\n\nexport interface HostPluginManifest {\n name?: string;\n version?: string;\n description?: string;\n keywords?: string[];\n repository?: string;\n homepage?: string;\n $schema?: string;\n}\n\nexport function readJsonFile<T>(path: string): T | null {\n if (!existsSync(path)) return null;\n try {\n return JSON.parse(readFileSync(path, \"utf-8\")) as T;\n } catch {\n return null;\n }\n}\n\nexport function readFirstHostPluginManifest(\n installPath: string,\n): HostPluginManifest | null {\n for (const relativePath of HOST_PLUGIN_MANIFEST_RELATIVE_PATHS) {\n const manifest = readJsonFile<HostPluginManifest>(\n join(installPath, relativePath),\n );\n if (manifest?.name) {\n return manifest;\n }\n }\n return null;\n}\n\nexport function isAgentPluginsRootManifest(\n manifest: HostPluginManifest,\n): boolean {\n return (\n typeof manifest.$schema === \"string\" &&\n manifest.$schema.includes(\"agent-plugins\")\n );\n}\n\nexport function parsePluginRef(ref: string): { name: string; marketplace: string } {\n const at = ref.lastIndexOf(\"@\");\n if (at <= 0) return { name: ref, marketplace: \"\" };\n return { name: ref.slice(0, at), marketplace: ref.slice(at + 1) };\n}\n","import { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport matter from \"gray-matter\";\n\nexport interface DiscoveredSkill {\n name: string;\n description: string;\n category: string;\n skillDirRelative: string;\n skillMdRelative: string;\n}\n\nconst SKILL_ROOTS = [\"skills\", \".agents/skills\"] as const;\n\nfunction isDirectory(path: string): boolean {\n try {\n return statSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\nfunction scalarString(value: unknown): string {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\n\nfunction parseSkillFrontmatterFallback(raw: string): {\n data: Record<string, string>;\n content: string;\n} {\n if (!raw.startsWith(\"---\")) {\n return { data: {}, content: raw };\n }\n const end = raw.indexOf(\"\\n---\", 3);\n if (end === -1) {\n return { data: {}, content: raw };\n }\n const data: Record<string, string> = {};\n for (const line of raw.slice(4, end).split(\"\\n\")) {\n const separator = line.indexOf(\":\");\n if (separator <= 0) continue;\n const key = line.slice(0, separator).trim();\n if (!key) continue;\n let value = line.slice(separator + 1).trim();\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n data[key] = value;\n }\n return {\n data,\n content: raw.slice(end + 4).replace(/^\\n/, \"\"),\n };\n}\n\nfunction parseSkillMarkdown(raw: string): {\n data: Record<string, unknown>;\n content: string;\n} {\n try {\n const parsed = matter(raw);\n return { data: parsed.data as Record<string, unknown>, content: parsed.content };\n } catch {\n return parseSkillFrontmatterFallback(raw);\n }\n}\n\nfunction readSkillMd(skillDir: string): { name: string; description: string; body: string } | null {\n const skillPath = join(skillDir, \"SKILL.md\");\n if (!existsSync(skillPath)) return null;\n let raw: string;\n try {\n raw = readFileSync(skillPath, \"utf-8\");\n } catch {\n return null;\n }\n const parsed = parseSkillMarkdown(raw);\n const dirName = skillDir.split(/[/\\\\]/).pop() ?? \"skill\";\n const name = scalarString(parsed.data.name);\n return {\n name: name || dirName,\n description: scalarString(parsed.data.description),\n body: parsed.content,\n };\n}\n\nfunction walkForSkills(rootPath: string, currentDir: string, results: DiscoveredSkill[]): void {\n if (!isDirectory(currentDir)) return;\n\n const skill = readSkillMd(currentDir);\n if (skill) {\n const skillDirRelative = relative(rootPath, currentDir).split(\"\\\\\").join(\"/\");\n const parts = skillDirRelative.split(\"/\");\n const category =\n parts.length >= 3 && parts[0] === \"skills\" ? (parts[1] ?? \"general\") : \"general\";\n results.push({\n name: skill.name,\n description: skill.description,\n category,\n skillDirRelative,\n skillMdRelative: `${skillDirRelative}/SKILL.md`,\n });\n return;\n }\n\n for (const entry of readdirSync(currentDir)) {\n if (entry.startsWith(\".\")) continue;\n walkForSkills(rootPath, join(currentDir, entry), results);\n }\n}\n\nexport function discoverSkillPackage(rootPath: string): DiscoveredSkill[] {\n const results: DiscoveredSkill[] = [];\n for (const root of SKILL_ROOTS) {\n const dir = join(rootPath, root);\n if (!isDirectory(dir)) continue;\n for (const entry of readdirSync(dir)) {\n if (entry.startsWith(\".\")) continue;\n walkForSkills(rootPath, join(dir, entry), results);\n }\n }\n\n const byName = new Map<string, DiscoveredSkill>();\n for (const skill of results) {\n byName.set(skill.name, skill);\n }\n return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));\n}\n","import { basename } from \"node:path\";\nimport semver from \"semver\";\n\nexport type CatalogPluginContentType = \"skill\" | \"command\";\n\nexport interface CatalogPluginContent {\n type: CatalogPluginContentType;\n name: string;\n description?: string;\n}\n\nexport interface CatalogPlugin {\n name: string;\n version?: string;\n ref: string;\n description?: string;\n tags?: string[];\n sourcePath?: string;\n contents?: CatalogPluginContent[];\n}\n\nexport interface ParsedMarketplaceCatalog {\n marketplaceName: string;\n plugins: CatalogPlugin[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction readMarketplaceName(raw: unknown): string {\n if (!isRecord(raw)) return \"\";\n const name = raw.name;\n return typeof name === \"string\" ? name : \"\";\n}\n\nfunction buildRef(name: string, marketplaceName: string): string {\n return marketplaceName ? `${name}@${marketplaceName}` : name;\n}\n\nfunction resolveVersion(entry: Record<string, unknown>): string | undefined {\n const version = entry.version;\n if (typeof version === \"string\" && version.length > 0) return version;\n\n const source = entry.source;\n if (!isRecord(source)) return undefined;\n\n const sha = source.sha;\n if (typeof sha === \"string\" && sha.length > 0) return sha.slice(0, 12);\n\n const ref = source.ref;\n if (typeof ref === \"string\" && ref.length > 0) return ref;\n\n return undefined;\n}\n\nfunction resolveDescription(entry: Record<string, unknown>): string | undefined {\n const description = entry.description;\n return typeof description === \"string\" && description.length > 0\n ? description\n : undefined;\n}\n\nfunction resolveTags(entry: Record<string, unknown>): string[] | undefined {\n const tags = entry.tags;\n if (!Array.isArray(tags)) return undefined;\n const next = tags.filter(\n (tag): tag is string => typeof tag === \"string\" && tag.trim().length > 0,\n );\n return next.length > 0 ? next : undefined;\n}\n\nexport function normalizeMarketplaceSourcePath(value: string): string {\n return value.replaceAll(\"\\\\\", \"/\").replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\");\n}\n\nfunction resolveSourcePath(entry: Record<string, unknown>): string | undefined {\n const source = entry.source;\n if (typeof source === \"string\" && source.trim().length > 0) {\n return normalizeMarketplaceSourcePath(source);\n }\n const path = entry.path;\n if (typeof path === \"string\" && path.trim().length > 0) {\n return normalizeMarketplaceSourcePath(path);\n }\n return undefined;\n}\n\nfunction parsePluginEntry(\n entry: unknown,\n marketplaceName: string,\n resolveName: (entry: Record<string, unknown>) => string | undefined,\n): CatalogPlugin | undefined {\n if (!isRecord(entry)) return undefined;\n\n const name = resolveName(entry);\n if (!name) return undefined;\n\n const version = resolveVersion(entry);\n const description = resolveDescription(entry);\n const tags = resolveTags(entry);\n const sourcePath = resolveSourcePath(entry);\n const ref = buildRef(name, marketplaceName);\n\n return {\n name,\n ...(version !== undefined ? { version } : {}),\n ref,\n ...(description !== undefined ? { description } : {}),\n ...(tags !== undefined ? { tags } : {}),\n ...(sourcePath !== undefined ? { sourcePath } : {}),\n };\n}\n\nfunction parsePlugins(\n raw: unknown,\n marketplaceName: string,\n resolveName: (entry: Record<string, unknown>) => string | undefined,\n): CatalogPlugin[] {\n if (!isRecord(raw)) return [];\n const plugins = raw.plugins;\n if (!Array.isArray(plugins)) return [];\n\n const parsed: CatalogPlugin[] = [];\n for (const entry of plugins) {\n const plugin = parsePluginEntry(entry, marketplaceName, resolveName);\n if (plugin) parsed.push(plugin);\n }\n return parsed;\n}\n\nfunction resolveClaudePluginName(entry: Record<string, unknown>): string | undefined {\n const name = entry.name;\n return typeof name === \"string\" && name.length > 0 ? name : undefined;\n}\n\nfunction resolveCursorPluginName(entry: Record<string, unknown>): string | undefined {\n const name = entry.name;\n if (typeof name === \"string\" && name.length > 0) return name;\n\n const path = entry.path;\n if (typeof path === \"string\" && path.length > 0) {\n const derived = basename(path);\n return derived.length > 0 ? derived : undefined;\n }\n\n return undefined;\n}\n\nexport function parseClaudeMarketplaceManifest(raw: unknown): ParsedMarketplaceCatalog {\n const marketplaceName = readMarketplaceName(raw);\n const plugins = parsePlugins(raw, marketplaceName, resolveClaudePluginName);\n return { marketplaceName, plugins };\n}\n\nexport function parseCursorMarketplaceManifest(raw: unknown): ParsedMarketplaceCatalog {\n const marketplaceName = readMarketplaceName(raw);\n const plugins = parsePlugins(raw, marketplaceName, resolveCursorPluginName);\n return { marketplaceName, plugins };\n}\n\nfunction catalogSemver(version: string | undefined): string | null {\n if (!version?.trim()) return null;\n const trimmed = version.trim();\n const withoutV = trimmed.startsWith(\"v\") ? trimmed.slice(1) : trimmed;\n return semver.valid(withoutV);\n}\n\nfunction preferCatalogPlugin(current: CatalogPlugin, incoming: CatalogPlugin): CatalogPlugin {\n const currentRank = catalogSemver(current.version);\n const incomingRank = catalogSemver(incoming.version);\n const preferIncoming =\n incomingRank !== null &&\n (currentRank === null || semver.rcompare(incomingRank, currentRank) < 0);\n\n const chosen = preferIncoming ? incoming : current;\n const other = preferIncoming ? current : incoming;\n const tags = uniqueStrings([...(chosen.tags ?? []), ...(other.tags ?? [])]);\n const contents = chosen.contents?.length ? chosen.contents : other.contents;\n return {\n ...chosen,\n version: chosen.version ?? other.version,\n description: chosen.description ?? other.description,\n sourcePath: chosen.sourcePath ?? other.sourcePath,\n ...(tags.length > 0 ? { tags } : {}),\n ...(contents && contents.length > 0 ? { contents } : {}),\n };\n}\n\nfunction uniqueStrings(values: string[]): string[] {\n const seen = new Set<string>();\n const next: string[] = [];\n for (const value of values) {\n if (seen.has(value)) continue;\n seen.add(value);\n next.push(value);\n }\n return next;\n}\n\n/** One catalog row per plugin name; later copies (other branches) merge into the first. */\nexport function mergeCatalogPluginsByIdentity(plugins: CatalogPlugin[]): CatalogPlugin[] {\n const byName = new Map<string, CatalogPlugin>();\n for (const plugin of plugins) {\n const existing = byName.get(plugin.name);\n if (!existing) {\n byName.set(plugin.name, plugin);\n continue;\n }\n byName.set(plugin.name, preferCatalogPlugin(existing, plugin));\n }\n return [...byName.values()];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,YAAY,eAAe;AACpC,SAAS,qBAAqB;AAS9B,SAAS,eAAe,OAAuB;AAC7C,SAAO,MAAM,QAAQ,WAAW,EAAE;AACpC;AAEA,SAAS,wBAAwB,OAAwB;AACvD,MAAI,MAAM,WAAW,OAAO,EAAG,QAAO;AACtC,MAAI,MAAM,WAAW,GAAG,KAAK,MAAM,WAAW,IAAI,KAAK,MAAM,WAAW,KAAK,GAAG;AAC9E,WAAO;AAAA,EACT;AACA,MAAI,MAAM,WAAW,IAAI,EAAG,QAAO;AACnC,MAAI,kBAAkB,KAAK,KAAK,EAAG,QAAO;AAC1C,SAAO;AACT;AAEO,SAAS,wBAAwB,KAAqB;AAC3D,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,CAAC,QAAS,QAAO;AA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M,KAAK;AAC3B,QAAM,UAA2B,CAAC;AAClC,aAAW,eAAe,cAAc;AACtC,UAAM,UAAU,mBAAmB,eAAe,EAAE,MAAM,YAAY,KAAK,CAAC;AAC5E,eAAW,UAAU,SAAS;AAC5B,UAAI,CAAC,WAAW,mBAAmB,QAAQ,OAAO,GAAG;AACnD,gBAAQ,KAAK,MAAM;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":["existsSync","mkdirSync","readFileSync","rmSync","statSync","join","existsSync","readdirSync","readFileSync","statSync","join","matter","existsSync","join","existsSync","readFileSync","join","isDirectory","existsSync","statSync","relative","join","readdirSync","matter","readFileSync","uniqueStrings","join","existsSync","statSync","readFileSync","mkdirSync","join","stored","rmSync","readFileSync"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/version.ts","../package.json","../src/copy/cli.ts","../src/db/native-module.ts","../src/db/connection.ts","../src/utils/fetch-with-timeout.ts","../src/utils/git-errors.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport packageJson from \"../package.json\" with { type: \"json\" };\n\ndeclare const __HT_VERSION__: string | undefined;\n\nconst GIT_SHA = /^[0-9a-f]{7,40}$/i;\n\nexport interface DevBuildVersionOptions {\n isRelease?: boolean;\n gitSha?: string | null;\n}\n\nfunction compactGitSha(sha: string | null | undefined): string | undefined {\n const trimmed = sha?.trim().toLowerCase();\n if (!trimmed || !GIT_SHA.test(trimmed)) {\n return undefined;\n }\n return trimmed.slice(0, 7);\n}\n\n/** True when a release workflow baked a publishable version (no `-dev+sha`). */\nexport function isReleaseBuild(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.HT_RELEASE === \"1\" || env.HARNESSTAP_RELEASE === \"1\";\n}\n\n/** Best-effort git SHA for the `-dev+sha` suffix. */\nexport function readGitSha(\n env: NodeJS.ProcessEnv = process.env,\n cwd: string = process.cwd(),\n): string | undefined {\n const fromEnv = compactGitSha(env.HT_GIT_SHA ?? env.GITHUB_SHA);\n if (fromEnv) {\n return fromEnv;\n }\n try {\n const sha = execFileSync(\"git\", [\"rev-parse\", \"HEAD\"], {\n cwd,\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n return compactGitSha(sha);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Append `-dev+<sha>` on non-release builds so CLI and Desktop can tell a\n * local/CI binary from a published version. Release builds return `version`\n * unchanged. Desktop should call this helper when reporting a newer-schema DB.\n */\nexport function formatDevBuildVersion(\n version: string,\n options: DevBuildVersionOptions = {},\n): string {\n const trimmed = version.trim();\n if (options.isRelease) {\n return trimmed;\n }\n if (trimmed.includes(\"-dev+\")) {\n return trimmed;\n }\n const sha = compactGitSha(options.gitSha);\n if (!sha) {\n return `${trimmed}-dev`;\n }\n return `${trimmed}-dev+${sha}`;\n}\n\n/** Version baked into tsup and the compiled sidecar (`__HT_VERSION__`). */\nexport function resolveBuildVersion(env: NodeJS.ProcessEnv = process.env): string {\n return formatDevBuildVersion(packageJson.version, {\n isRelease: isReleaseBuild(env),\n gitSha: readGitSha(env),\n });\n}\n\nfunction resolvePackageVersion(): string {\n // tsup and the sidecar build define __HT_VERSION__; the JSON import is the\n // source/test fallback and is inlined by every bundler, never read at runtime.\n if (typeof __HT_VERSION__ === \"string\" && __HT_VERSION__.length > 0) {\n return __HT_VERSION__;\n }\n return resolveBuildVersion();\n}\n\nexport const PACKAGE_VERSION: string = resolvePackageVersion();\n","{\n \"name\": \"harnesstap\",\n \"version\": \"1.3.1\",\n \"description\": \"Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs\",\n \"type\": \"module\",\n \"packageManager\": \"bun@1.3.9\",\n \"files\": [\n \"dist\",\n \"LICENSE\",\n \"README.md\",\n \"schemas\"\n ],\n \"bin\": {\n \"harnesstap\": \"./dist/bin.js\",\n \"ht\": \"./dist/bin.js\"\n },\n \"scripts\": {\n \"build\": \"bun scripts/generate-scenarios.ts && rm -rf dist && tsup\",\n \"generate:scenarios\": \"bun scripts/generate-scenarios.ts\",\n \"check:packaged-help\": \"bun scripts/check-packaged-help.ts\",\n \"snapshot:released-cli\": \"bun scripts/snapshot-released-cli.ts\",\n \"build:sidecar\": \"bash scripts/build-sidecar.sh\",\n \"check:compiled-sidecar\": \"bun scripts/check-compiled-sidecar.ts\",\n \"desktop:cleanup\": \"bash apps/desktop/scripts/cleanup-stale-dev.sh\",\n \"desktop:prepare-sidecar\": \"bash apps/desktop/scripts/prepare-sidecar.sh\",\n \"desktop:watch-sidecar\": \"bun apps/desktop/scripts/watch-sidecar.ts\",\n \"desktop:icons\": \"cd apps/desktop && bun run icons\",\n \"desktop:dev\": \"bash apps/desktop/scripts/desktop-dev.sh\",\n \"desktop:build\": \"bun run desktop:prepare-sidecar && cd apps/desktop && bun install && bun run tauri build && bash scripts/reseal-macos-app.sh\",\n \"desktop:install\": \"bun apps/desktop/scripts/install-local.ts\",\n \"desktop:e2e:build\": \"bash apps/desktop/scripts/e2e-build.sh\",\n \"desktop:e2e\": \"bash apps/desktop/scripts/e2e-run.sh\",\n \"desktop:demo-agent\": \"bash apps/desktop/scripts/demo-home.sh\",\n \"desktop:shots\": \"cd apps/desktop && bun run shots\",\n \"desktop:check\": \"bash apps/desktop/scripts/desktop-check.sh\",\n \"dev\": \"tsup --watch\",\n \"start\": \"bun src/bin.ts\",\n \"start:dist\": \"node dist/bin.js\",\n \"link\": \"bun run build && bun link\",\n \"unlink\": \"bun unlink\",\n \"test\": \"bun test --timeout 30000\",\n \"test:run\": \"bun test --dots --timeout 30000\",\n \"test:core\": \"bun test --dots test/models test/db test/config test/utils test/telemetry test/scripts\",\n \"test:platforms\": \"bun test --dots test/platforms\",\n \"test:plugins\": \"bun test --dots test/plugins\",\n \"test:services\": \"bun test --dots test/services test/integration test/agent/init-apply-noop.test.ts\",\n \"test:cli\": \"bun test --dots test/cli test/ui test/helpers\",\n \"test:docs\": \"bun test --dots test/docs\",\n \"lint\": \"biome lint .\",\n \"lint:fix\": \"biome lint --write --unsafe .\",\n \"lint:css\": \"bun scripts/check-css-tokens.ts\",\n \"check:cli-error-contract\": \"bun scripts/check-cli-error-contract.ts\",\n \"check:copy\": \"bun scripts/check-copy.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist && find . -maxdepth 1 -name '*.bun-build' -delete\",\n \"preflight\": \"bun run lint && bun run lint:css && bun run check:cli-error-contract && bun run check:copy && bun run typecheck && bun run test:run && bun run build\",\n \"prepublishOnly\": \"bun run build\",\n \"docs:vhs\": \"bash scripts/generate-vhs-scenarios.sh\",\n \"check:scenario-docs\": \"bash scripts/check-scenario-docs.sh\",\n \"check:scenario-smoke\": \"bun test test/cli/scenario-smoke.test.ts\",\n \"check:sqlite-wal-smoke\": \"bun scripts/sqlite-wal-write-smoke.ts\",\n \"sync:cloud-docs\": \"bash scripts/sync-cloud-cli-docs.sh\"\n },\n \"keywords\": [\n \"ai\",\n \"coding-assistant\",\n \"cli\",\n \"configuration\",\n \"claude-code\",\n \"cursor\",\n \"codex\",\n \"skills\",\n \"layers\"\n ],\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/harnesstap/harnesstap.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/harnesstap/harnesstap/issues\"\n },\n \"homepage\": \"https://github.com/harnesstap/harnesstap#readme\",\n \"engines\": {\n \"node\": \">=22.12.0\"\n },\n \"dependencies\": {\n \"@inquirer/core\": \"^10.3.2\",\n \"@inquirer/search\": \"^3.2.2\",\n \"better-sqlite3\": \"^12.11.1\",\n \"chalk\": \"^5.4.1\",\n \"cli-table3\": \"^0.6.5\",\n \"commander\": \"^13.1.0\",\n \"gray-matter\": \"^4.0.3\",\n \"inquirer\": \"^12.3.0\",\n \"jsonc-parser\": \"^3.3.1\",\n \"ora\": \"^9.4.0\",\n \"picomatch\": \"^4.0.2\",\n \"semver\": \"^7.8.0\",\n \"smol-toml\": \"^1.3.1\",\n \"ulid\": \"^2.3.0\",\n \"yaml\": \"^2.7.0\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"^2.4.10\",\n \"@inquirer/testing\": \"^3.3.8\",\n \"@types/better-sqlite3\": \"^7.6.12\",\n \"@types/node\": \"^22.10.0\",\n \"@types/semver\": \"^7.7.1\",\n \"tsup\": \"^8.3.5\",\n \"typescript\": \"^5.7.0\"\n }\n}\n","/**\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","import { NATIVE_MODULE_MISMATCH_MESSAGE } from \"../copy/cli.js\";\n\nexport { NATIVE_MODULE_MISMATCH_MESSAGE };\n\nfunction shouldShowNativeModuleDetails(): boolean {\n if (process.env.HARNESSTAP_DEBUG === \"1\") {\n return true;\n }\n return process.argv.includes(\"-v\") || process.argv.includes(\"--verbose\");\n}\n\nexport function isNativeModuleMismatch(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const err = error as { code?: unknown; message?: unknown };\n const code = typeof err.code === \"string\" ? err.code : \"\";\n const message = typeof err.message === \"string\" ? err.message : String(error);\n if (code === \"ERR_DLOPEN_FAILED\") {\n return true;\n }\n return message.includes(\"NODE_MODULE_VERSION\") || message.includes(\"ERR_DLOPEN\");\n}\n\nexport function reportNativeModuleMismatch(cause?: unknown): never {\n if (shouldShowNativeModuleDetails() && cause !== undefined) {\n console.error(cause);\n }\n console.error(NATIVE_MODULE_MISMATCH_MESSAGE);\n process.exit(1);\n}\n\n/** Run a native sqlite load; print the DS-6 one-liner on ABI mismatch. */\nexport function withNativeModuleGuard<T>(load: () => T): T {\n try {\n return load();\n } catch (error) {\n if (isNativeModuleMismatch(error)) {\n reportNativeModuleMismatch(error);\n }\n throw error;\n }\n}\n","import { existsSync, mkdirSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { withNativeModuleGuard } from \"./native-module.js\";\nimport type { SqliteDatabase, SqliteDatabaseConstructor } from \"./types.js\";\n\nconst require = createRequire(import.meta.url);\n\nlet instance: SqliteDatabase | null = null;\nlet instancePath: string | null = null;\n\nfunction loadBetterSqlite3(): SqliteDatabaseConstructor {\n return withNativeModuleGuard(\n () => require(\"better-sqlite3\") as SqliteDatabaseConstructor,\n );\n}\n\nfunction resolveDatabaseConstructor(): SqliteDatabaseConstructor {\n if (\"Bun\" in globalThis) {\n return (require(\"bun:sqlite\") as { Database: SqliteDatabaseConstructor })\n .Database;\n }\n\n return loadBetterSqlite3();\n}\n\nfunction usesBunSqlite(): boolean {\n return \"Bun\" in globalThis;\n}\n\nfunction wrapDatabase(db: SqliteDatabase): SqliteDatabase {\n return {\n prepare<Row = unknown>(sql: string) {\n const statement = db.prepare<Row>(sql);\n return {\n run: (...params: unknown[]) => statement.run(...params),\n get: (...params: unknown[]) => {\n const row = statement.get(...params);\n return row ?? undefined;\n },\n all: (...params: unknown[]) => statement.all(...params),\n };\n },\n exec: (sql: string) => db.exec(sql),\n transaction: <T extends (...args: never[]) => unknown>(fn: T) =>\n db.transaction(fn),\n close: () => db.close(),\n };\n}\n\nfunction resolveHarnesstapDir(): string {\n if (process.env.HARNESSTAP_HOME) {\n return process.env.HARNESSTAP_HOME;\n }\n const homePath = process.env.HOME ?? process.env.USERPROFILE ?? homedir();\n return join(homePath, \".harnesstap\");\n}\n\n/** HarnessTap data dir for a given user home (isolates tests that pass a custom homeRoot). */\nexport function harnesstapDirForHomeRoot(homeRoot: string): string {\n if (process.env.HARNESSTAP_HOME) {\n return process.env.HARNESSTAP_HOME;\n }\n return join(homeRoot, \".harnesstap\");\n}\n\nfunction resolveDbPath(): string {\n return join(resolveHarnesstapDir(), \"harnesstap.db\");\n}\n\nfunction resolveConfigJsoncPath(): string {\n return join(resolveHarnesstapDir(), \"config.jsonc\");\n}\n\nfunction resolveLegacyConfigPath(): string {\n return join(resolveHarnesstapDir(), \"config.json\");\n}\n\nexport function getDbPath(): string {\n return resolveDbPath();\n}\n\nexport function getHarnesstapDir(): string {\n return resolveHarnesstapDir();\n}\n\nexport function getConfigJsoncPath(): string {\n return resolveConfigJsoncPath();\n}\n\nexport function getLegacyConfigPath(): string {\n return resolveLegacyConfigPath();\n}\n\nfunction isCompletionMode(): boolean {\n return process.env.HARNESSTAP_COMPLETE === \"1\";\n}\n\nexport function getDb(): SqliteDatabase {\n const dbPath = resolveDbPath();\n const completionMode = isCompletionMode();\n\n if (instance && instancePath === dbPath) {\n return instance;\n }\n\n if (instance) {\n instance.close();\n instance = null;\n instancePath = null;\n }\n\n if (completionMode) {\n if (!existsSync(dbPath)) {\n throw new Error(`HarnessTap database not found: ${dbPath}`);\n }\n } else {\n mkdirSync(resolveHarnesstapDir(), { recursive: true });\n }\n\n const Database = resolveDatabaseConstructor();\n const rawDb = withNativeModuleGuard(() =>\n completionMode\n ? new Database(dbPath, { readonly: true })\n : new Database(dbPath),\n );\n instance = usesBunSqlite() ? wrapDatabase(rawDb) : rawDb;\n instancePath = dbPath;\n if (!completionMode) {\n instance.exec(\"PRAGMA journal_mode = WAL\");\n instance.exec(\"PRAGMA busy_timeout = 5000\");\n }\n instance.exec(\"PRAGMA foreign_keys = ON\");\n\n return instance;\n}\n\nexport function closeDb(): void {\n if (instance) {\n instance.close();\n instance = null;\n instancePath = null;\n }\n}\n","export const DEFAULT_TIMEOUT_MS = 30_000;\nconst DEFAULT_RETRIES = 2;\n\nexport const CATALOG_LIST_TIMEOUT_MESSAGE =\n \"Catalog request timed out (30s). Try again, or list local plugins without --remote.\";\n\nexport async function fetchWithTimeout(\n input: string | URL,\n init?: RequestInit & { timeoutMs?: number; retries?: number },\n): Promise<Response> {\n const timeoutMs = init?.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const retries = init?.retries ?? DEFAULT_RETRIES;\n let lastError: unknown;\n\n for (let attempt = 0; attempt <= retries; attempt += 1) {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n try {\n const { timeoutMs: _t, retries: _r, ...fetchInit } = init ?? {};\n return await fetch(input, { ...fetchInit, signal: controller.signal });\n } catch (error) {\n lastError = error;\n if (attempt === retries) break;\n await new Promise((r) => setTimeout(r, 250 * (attempt + 1)));\n } finally {\n clearTimeout(timer);\n }\n }\n\n throw new Error(\n `Request timed out after ${timeoutMs}ms (${retries + 1} attempts): ${String(input)}`,\n { cause: lastError },\n );\n}\n\nexport function isRequestTimeoutError(error: unknown): boolean {\n return error instanceof Error && error.message.startsWith(\"Request timed out after\");\n}\n\nexport function formatCatalogRequestError(error: unknown): string {\n if (isRequestTimeoutError(error)) {\n return CATALOG_LIST_TIMEOUT_MESSAGE;\n }\n return error instanceof Error ? error.message : String(error);\n}\n","export function mapGitStderr(stderr: string, url?: string): string {\n if (stderr.startsWith(\"Couldn't reach\")) {\n return stderr.endsWith(\".\") ? stderr : `${stderr}.`;\n }\n if (url) {\n return `Couldn't reach ${url}.`;\n }\n return \"Couldn't reach that git repository.\";\n}\n\nexport function gitFailureHint(): string {\n return \"Check the URL, or sign in with ht github login if it's private.\";\n}\n"],"mappings":";;;;;;;AAAA,SAAS,oBAAoB;;;ACA7B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,gBAAkB;AAAA,EAClB,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,YAAc;AAAA,IACd,IAAM;AAAA,EACR;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,sBAAsB;AAAA,IACtB,uBAAuB;AAAA,IACvB,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,0BAA0B;AAAA,IAC1B,mBAAmB;AAAA,IACnB,2BAA2B;AAAA,IAC3B,yBAAyB;AAAA,IACzB,iBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,KAAO;AAAA,IACP,OAAS;AAAA,IACT,cAAc;AAAA,IACd,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,MAAQ;AAAA,IACR,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,YA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AC;AAAA,IAC7D,UAAE;AACA,mBAAa,KAAK;AAAA,IACpB;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR,2BAA2B,SAAS,OAAO,UAAU,CAAC,eAAe,OAAO,KAAK,CAAC;AAAA,IAClF,EAAE,OAAO,UAAU;AAAA,EACrB;AACF;AAEO,SAAS,sBAAsB,OAAyB;AAC7D,SAAO,iBAAiB,SAAS,MAAM,QAAQ,WAAW,yBAAyB;AACrF;AAEO,SAAS,0BAA0B,OAAwB;AAChE,MAAI,sBAAsB,KAAK,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;;;AC5CO,SAAS,aAAa,QAAgB,KAAsB;AACjE,MAAI,OAAO,WAAW,gBAAgB,GAAG;AACvC,WAAO,OAAO,SAAS,GAAG,IAAI,SAAS,GAAG,MAAM;AAAA,EAClD;AACA,MAAI,KAAK;AACP,WAAO,kBAAkB,GAAG;AAAA,EAC9B;AACA,SAAO;AACT;AAEO,SAAS,iBAAyB;AACvC,SAAO;AACT;","names":["require"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/apm-pack.ts","../src/utils/zip-archive.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n lstatSync,\n mkdirSync,\n readFileSync,\n readdirSync,\n rmSync,\n writeFileSync,\n} from \"node:fs\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport type { ApManifest } from \"./agent-plugins/manifest.js\";\nimport { isValidApName, slugifyApName } from \"./agent-plugins/name.js\";\nimport { AP_SCHEMA_URL, validateApManifest } from \"./agent-plugins/validate.js\";\nimport { APM_LOCKFILE_FILENAME } from \"./lockfile.js\";\nimport { skippedRootSourceWarning } from \"./apm-overlay.js\";\nimport { findProjectConfig, type ResolvedProjectConfig } from \"./project-config.js\";\nimport {\n hasCriticalUnicode,\n scanUnicodeBuffer,\n type UnicodeScanFinding,\n} from \"./unicode-scan.js\";\nimport {\n BundleSymlinkError,\n PathEscapeError,\n assertContainedPath,\n} from \"../utils/path-containment.js\";\nimport { writeZipArchive } from \"../utils/zip-archive.js\";\n\nexport const PLUGIN_NATIVE_DIRS = [\"agents\", \"skills\", \"commands\", \"hooks\"] as const;\nexport type PluginNativeDir = (typeof PLUGIN_NATIVE_DIRS)[number];\n\nexport const PACK_LOCKFILE_NAME = APM_LOCKFILE_FILENAME;\nexport const APM_CACHE_DIR = \"apm_modules\";\n\nconst AUTHORED_PLUGIN_JSON_PATHS = [\n \"plugin.json\",\n \".github/plugin/plugin.json\",\n \".claude-plugin/plugin.json\",\n \".cursor-plugin/plugin.json\",\n];\n\nexport class PackError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"PackError\";\n }\n}\n\nexport interface PackedFile {\n relativePath: string;\n bytes: Buffer;\n remappedFrom?: string;\n}\n\nexport interface PackOptions {\n projectRoot?: string;\n outputDir?: string;\n archive?: boolean;\n dryRun?: boolean;\n verbose?: boolean;\n}\n\nexport interface PackResult {\n name: string;\n version: string;\n outputPath: string;\n archive: boolean;\n dryRun: boolean;\n fileCount: number;\n files: Array<{ path: string; remappedFrom?: string }>;\n warnings: string[];\n unicodeFindings: UnicodeScanFinding[];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction posixRelative(from: string, to: string): string {\n return relative(from, to).split(sep).join(\"/\");\n}\n\nexport function sha256Hex(bytes: Buffer): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\n\nexport function normalizeSha256(value: string): string {\n return value.replace(/^sha256:/i, \"\").toLowerCase();\n}\n\nfunction isPluginNativeDir(value: string): value is PluginNativeDir {\n return (PLUGIN_NATIVE_DIRS as readonly string[]).includes(value);\n}\n\nfunction isSymlink(path: string): boolean {\n try {\n return lstatSync(path).isSymbolicLink();\n } catch {\n return false;\n }\n}\n\nfunction assertNotSymlink(path: string, relativePath: string): void {\n if (isSymlink(path)) {\n throw new BundleSymlinkError(relativePath);\n }\n}\n\nfunction walkRegularFiles(root: string, current: string, files: string[]): void {\n assertNotSymlink(current, posixRelative(root, current) || \".\");\n for (const entry of readdirSync(current, { withFileTypes: true })) {\n if (entry.name.startsWith(\".\")) continue;\n const absolute = join(current, entry.name);\n const relativePath = posixRelative(root, absolute);\n if (entry.isSymbolicLink() || isSymlink(absolute)) {\n throw new BundleSymlinkError(relativePath);\n }\n if (entry.isDirectory()) {\n walkRegularFiles(root, absolute, files);\n continue;\n }\n if (!entry.isFile()) {\n throw new BundleSymlinkError(relativePath);\n }\n files.push(relativePath);\n }\n}\n\nfunction readBytes(root: string, relativePath: string): Buffer {\n assertContainedPath(root, relativePath);\n const absolute = join(root, relativePath);\n assertNotSymlink(absolute, relativePath);\n return readFileSync(absolute);\n}\n\nfunction remapLocalPath(relativePath: string, fromApm: boolean): string | undefined {\n const posix = relativePath.split(\"\\\\\").join(\"/\");\n if (fromApm) {\n if (!posix.startsWith(\".apm/\")) return undefined;\n const rest = posix.slice(\".apm/\".length);\n const kind = rest.split(\"/\")[0] ?? \"\";\n if (!isPluginNativeDir(kind) || rest === kind) return undefined;\n return rest;\n }\n const kind = posix.split(\"/\")[0] ?? \"\";\n if (!isPluginNativeDir(kind) || posix === kind) return undefined;\n return posix;\n}\n\nfunction remapDependencyPath(relativePath: string): string | undefined {\n const posix = relativePath.split(\"\\\\\").join(\"/\");\n if (posix === \".mcp.json\" || posix === \"mcp.json\") return \"mcp.json\";\n const fromApm = remapLocalPath(posix, true);\n if (fromApm) return fromApm;\n return remapLocalPath(posix, false);\n}\n\nfunction putFile(\n files: Map<string, PackedFile>,\n relativePath: string,\n bytes: Buffer,\n remappedFrom?: string,\n): void {\n if (relativePath.split(\"/\").includes(\"..\")) {\n throw new PathEscapeError(relativePath, \".\");\n }\n assertContainedPath(\".\", relativePath);\n files.set(relativePath, {\n relativePath,\n bytes,\n ...(remappedFrom && remappedFrom !== relativePath ? { remappedFrom } : {}),\n });\n}\n\nfunction collectDir(\n projectRoot: string,\n sourceRelative: string,\n fromApm: boolean,\n files: Map<string, PackedFile>,\n): void {\n const sourceDir = join(projectRoot, sourceRelative);\n if (!existsSync(sourceDir)) return;\n assertNotSymlink(sourceDir, sourceRelative);\n const found: string[] = [];\n walkRegularFiles(sourceDir, sourceDir, found);\n for (const child of found) {\n const sourcePath = posixRelative(projectRoot, join(sourceDir, child));\n const mapped = remapLocalPath(sourcePath, fromApm);\n if (!mapped) continue;\n putFile(files, mapped, readBytes(projectRoot, sourcePath), sourcePath);\n }\n}\n\nfunction collectLocalPrimitives(\n projectRoot: string,\n files: Map<string, PackedFile>,\n warnings: string[],\n): void {\n const apmDir = join(projectRoot, \".apm\");\n const apmPresent = existsSync(apmDir);\n if (apmPresent) {\n assertNotSymlink(apmDir, \".apm\");\n for (const dir of PLUGIN_NATIVE_DIRS) {\n collectDir(projectRoot, join(\".apm\", dir), true, files);\n }\n for (const dir of PLUGIN_NATIVE_DIRS) {\n if (existsSync(join(projectRoot, dir))) {\n warnings.push(skippedRootSourceWarning(dir));\n }\n }\n return;\n }\n\n for (const dir of PLUGIN_NATIVE_DIRS) {\n collectDir(projectRoot, dir, false, files);\n }\n}\n\nfunction collectExplicitIncludes(\n projectRoot: string,\n includes: string[],\n files: Map<string, PackedFile>,\n): void {\n for (const include of includes) {\n const relativePath = include.split(\"\\\\\").join(\"/\").replace(/^\\.\\//, \"\");\n const absolute = join(projectRoot, relativePath);\n if (!existsSync(absolute)) {\n throw new PackError(\n `includes path ${include} is missing and cannot be packed`,\n );\n }\n assertNotSymlink(absolute, relativePath);\n const stat = lstatSync(absolute);\n if (stat.isDirectory()) {\n const found: string[] = [];\n walkRegularFiles(absolute, absolute, found);\n for (const child of found) {\n const sourcePath = posixRelative(projectRoot, join(absolute, child));\n const mapped = remapDependencyPath(sourcePath) ?? sourcePath;\n putFile(files, mapped, readBytes(projectRoot, sourcePath), sourcePath);\n }\n continue;\n }\n const mapped = remapDependencyPath(relativePath) ?? relativePath;\n putFile(files, mapped, readBytes(projectRoot, relativePath), relativePath);\n }\n}\n\nfunction parseIncludes(document: Record<string, unknown> | undefined): \"auto\" | string[] {\n if (!document || document.includes === undefined || document.includes === null) {\n return \"auto\";\n }\n if (document.includes === \"auto\") {\n return \"auto\";\n }\n if (Array.isArray(document.includes) && document.includes.every((entry) => typeof entry === \"string\")) {\n return document.includes;\n }\n throw new PackError(\"apm.yml field includes must be \\\"auto\\\" or a list of paths\");\n}\n\nfunction asAuthor(value: unknown): ApManifest[\"author\"] | undefined {\n if (typeof value === \"string\" && value.trim()) {\n return { name: value.trim() };\n }\n if (isRecord(value)) {\n const name = typeof value.name === \"string\" ? value.name : undefined;\n if (!name) return undefined;\n return {\n name,\n ...(typeof value.email === \"string\" ? { email: value.email } : {}),\n ...(typeof value.url === \"string\" ? { url: value.url } : {}),\n };\n }\n return undefined;\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === \"string\" && value.length > 0 ? value : undefined;\n}\n\nfunction asKeywords(value: unknown): string[] | undefined {\n if (!Array.isArray(value) || value.some((entry) => typeof entry !== \"string\")) {\n return undefined;\n }\n return value;\n}\n\nfunction repositoryUrl(value: unknown): string | undefined {\n if (typeof value === \"string\" && value.length > 0) return value;\n if (isRecord(value) && typeof value.url === \"string\") return value.url;\n return undefined;\n}\n\nexport function synthesizePluginManifest(\n config: ResolvedProjectConfig,\n): ApManifest {\n const document = config.apm_document ?? {};\n const rawName = config.apm_name ?? \"plugin\";\n const name = isValidApName(rawName) ? rawName : slugifyApName(rawName);\n const version = config.apm_version ?? \"1.0.0\";\n const author = asAuthor(document.author);\n const keywords = asKeywords(document.keywords);\n const homepage = asString(document.homepage);\n const repository = repositoryUrl(document.repository);\n const license = asString(document.license);\n const description = config.apm_description ?? asString(document.description);\n\n const manifest: ApManifest = {\n $schema: AP_SCHEMA_URL,\n name,\n version,\n ...(description ? { description } : {}),\n ...(author ? { author } : {}),\n ...(homepage ? { homepage } : {}),\n ...(repository ? { repository } : {}),\n ...(license ? { license } : {}),\n ...(keywords && keywords.length > 0 ? { keywords } : {}),\n };\n validateApManifest(manifest);\n return manifest;\n}\n\nfunction loadAuthoredPluginJson(projectRoot: string): Buffer | undefined {\n for (const relativePath of AUTHORED_PLUGIN_JSON_PATHS) {\n const absolute = join(projectRoot, relativePath);\n if (!existsSync(absolute)) continue;\n assertNotSymlink(absolute, relativePath);\n const bytes = readFileSync(absolute);\n let parsed: unknown;\n try {\n parsed = JSON.parse(bytes.toString(\"utf8\")) as unknown;\n } catch {\n throw new PackError(`Invalid JSON in ${relativePath}`);\n }\n if (!isRecord(parsed)) {\n throw new PackError(`${relativePath} must be a JSON object`);\n }\n if (typeof parsed.$schema !== \"string\" || parsed.$schema.length === 0) {\n parsed.$schema = AP_SCHEMA_URL;\n }\n validateApManifest(parsed);\n return Buffer.from(`${JSON.stringify(parsed, null, 2)}\\n`, \"utf8\");\n }\n return undefined;\n}\n\nfunction collectMcpJson(projectRoot: string, files: Map<string, PackedFile>): void {\n for (const source of [\".mcp.json\", \"mcp.json\"]) {\n const absolute = join(projectRoot, source);\n if (!existsSync(absolute)) continue;\n assertNotSymlink(absolute, source);\n putFile(files, \"mcp.json\", readFileSync(absolute), source);\n return;\n }\n}\n\nfunction lockDocument(projectRoot: string): Record<string, unknown> | undefined {\n const path = join(projectRoot, APM_LOCKFILE_FILENAME);\n if (!existsSync(path)) return undefined;\n assertNotSymlink(path, APM_LOCKFILE_FILENAME);\n const parsed = parseYaml(readFileSync(path, \"utf8\"));\n if (!isRecord(parsed)) {\n throw new PackError(`Invalid lockfile in ${path}: expected a YAML mapping`);\n }\n return parsed;\n}\n\nfunction collectAttestedDependencies(\n projectRoot: string,\n config: ResolvedProjectConfig,\n lock: Record<string, unknown> | undefined,\n files: Map<string, PackedFile>,\n warnings: string[],\n): void {\n const cacheDir = join(projectRoot, APM_CACHE_DIR);\n if (existsSync(cacheDir)) {\n warnings.push(\n `${APM_CACHE_DIR}/ is never packed; dependency content is taken only from lockfile-attested deployed_files`,\n );\n }\n\n const fileBackedDeps = config.apmDependencies.filter(\n (dependency) =>\n dependency.sourceKind === \"git\"\n || dependency.sourceKind === \"marketplace\"\n || dependency.sourceKind === \"catalog\"\n || dependency.sourceKind === \"local\",\n );\n const lockDeps = Array.isArray(lock?.dependencies)\n ? lock.dependencies.filter(isRecord)\n : [];\n\n for (const dependency of fileBackedDeps) {\n if (dependency.sourceKind === \"local\" && !dependency.originRef.includes(\"/\") && !dependency.originRef.startsWith(\".\")) {\n continue;\n }\n const lockEntry = lockDeps.find((entry) => {\n const name = String(entry.name ?? \"\");\n const repo = String(entry.repo_url ?? \"\");\n return name === dependency.name || repo.includes(dependency.name);\n });\n const deployedFiles = lockEntry && Array.isArray(lockEntry.deployed_files)\n ? lockEntry.deployed_files.map(String)\n : [];\n const hashes = lockEntry && isRecord(lockEntry.deployed_file_hashes)\n ? Object.fromEntries(\n Object.entries(lockEntry.deployed_file_hashes).map(([path, hash]) => [\n path,\n String(hash),\n ]),\n )\n : {};\n\n if (deployedFiles.length === 0) {\n if (existsSync(cacheDir)) {\n throw new PackError(\n `Dependency ${dependency.name} has cached primitives but no deployed_files in ${APM_LOCKFILE_FILENAME}. ` +\n `Run ht apply so the content is attested.`,\n );\n }\n continue;\n }\n\n for (const deployed of deployedFiles) {\n const relativePath = deployed.split(\"\\\\\").join(\"/\");\n const absolute = join(projectRoot, relativePath);\n if (!existsSync(absolute)) {\n throw new PackError(\n `Attested file ${relativePath} from ${dependency.name} is missing. Run ht apply to restore it.`,\n );\n }\n assertNotSymlink(absolute, relativePath);\n const bytes = readFileSync(absolute);\n const expected = hashes[relativePath];\n if (expected && normalizeSha256(expected) !== sha256Hex(bytes)) {\n throw new PackError(\n `${relativePath} does not match the hash recorded in ${APM_LOCKFILE_FILENAME}`,\n );\n }\n const mapped = remapDependencyPath(relativePath);\n if (!mapped) continue;\n putFile(files, mapped, bytes, relativePath);\n }\n }\n}\n\nfunction embedLockfile(\n lock: Record<string, unknown> | undefined,\n files: Map<string, PackedFile>,\n): void {\n const bundleFiles: Record<string, string> = {};\n for (const file of [...files.values()].sort((left, right) =>\n left.relativePath.localeCompare(right.relativePath),\n )) {\n bundleFiles[file.relativePath] = sha256Hex(file.bytes);\n }\n const document: Record<string, unknown> = {\n ...(lock ?? { lockfile_version: \"1\" }),\n pack: {\n format: \"plugin\",\n packed_at: new Date().toISOString(),\n bundle_files: bundleFiles,\n },\n };\n const yaml = stringifyYaml(document, {\n indent: 2,\n lineWidth: 0,\n defaultKeyType: \"PLAIN\",\n });\n putFile(files, PACK_LOCKFILE_NAME, Buffer.from(yaml, \"utf8\"));\n}\n\nfunction writeDirectory(targetDir: string, files: PackedFile[]): void {\n if (existsSync(targetDir)) {\n rmSync(targetDir, { recursive: true, force: true });\n }\n mkdirSync(targetDir, { recursive: true });\n for (const file of files) {\n const absolute = join(targetDir, file.relativePath);\n mkdirSync(dirname(absolute), { recursive: true });\n writeFileSync(absolute, file.bytes);\n }\n}\n\nexport function packProject(options: PackOptions = {}): PackResult {\n const start = resolve(options.projectRoot ?? process.cwd());\n const config = findProjectConfig(start);\n if (!config) {\n throw new PackError(\n `No apm.yml found under ${start}. Run ht config init or add an apm.yml at the project root.`,\n );\n }\n\n const warnings: string[] = [];\n const files = new Map<string, PackedFile>();\n const includes = parseIncludes(config.apm_document);\n\n if (includes === \"auto\") {\n collectLocalPrimitives(config.rootPath, files, warnings);\n collectMcpJson(config.rootPath, files);\n } else {\n collectExplicitIncludes(config.rootPath, includes, files);\n }\n\n const lock = lockDocument(config.rootPath);\n collectAttestedDependencies(config.rootPath, config, lock, files, warnings);\n\n const authored = loadAuthoredPluginJson(config.rootPath);\n const manifestBytes = authored\n ?? Buffer.from(`${JSON.stringify(synthesizePluginManifest(config), null, 2)}\\n`, \"utf8\");\n putFile(files, \"plugin.json\", manifestBytes, authored ? undefined : \"apm.yml\");\n\n const unicodeFindings: UnicodeScanFinding[] = [];\n for (const file of files.values()) {\n unicodeFindings.push(...scanUnicodeBuffer(file.bytes, file.relativePath));\n }\n if (hasCriticalUnicode(unicodeFindings)) {\n const critical = unicodeFindings.filter((finding) => finding.severity === \"critical\");\n const first = critical[0];\n throw new PackError(\n `Pack blocked: critical hidden Unicode in ${first?.file ?? \"bundle\"} ` +\n `(${first?.codepoint ?? \"U+????\"} ${first?.description ?? \"critical character\"}).`,\n );\n }\n for (const finding of unicodeFindings.filter((entry) => entry.severity === \"warning\")) {\n warnings.push(\n `${finding.file}:${finding.line}:${finding.column} ${finding.codepoint} ${finding.description}`,\n );\n }\n\n embedLockfile(lock, files);\n\n const packed = [...files.values()].sort((left, right) =>\n left.relativePath.localeCompare(right.relativePath),\n );\n let manifest: ApManifest;\n const pluginJson = files.get(\"plugin.json\");\n if (!pluginJson) {\n throw new PackError(\"Packed bundle is missing plugin.json\");\n }\n try {\n manifest = JSON.parse(pluginJson.bytes.toString(\"utf8\")) as ApManifest;\n } catch {\n throw new PackError(\"Packed plugin.json is not valid JSON\");\n }\n const name = manifest.name;\n const version = manifest.version;\n const outputRoot = resolve(config.rootPath, options.outputDir ?? \"build\");\n const outputPath = options.archive\n ? join(outputRoot, `${name}-${version}.zip`)\n : join(outputRoot, name);\n\n if (!options.dryRun) {\n mkdirSync(outputRoot, { recursive: true });\n if (options.archive) {\n writeFileSync(\n outputPath,\n writeZipArchive(packed.map((file) => ({ path: file.relativePath, data: file.bytes }))),\n );\n } else {\n writeDirectory(outputPath, packed);\n }\n }\n\n return {\n name,\n version,\n outputPath,\n archive: Boolean(options.archive),\n dryRun: Boolean(options.dryRun),\n fileCount: packed.length,\n files: packed.map((file) => ({\n path: file.relativePath,\n ...(file.remappedFrom ? { remappedFrom: file.remappedFrom } : {}),\n })),\n warnings,\n unicodeFindings,\n };\n}\n","import { deflateRawSync, inflateRawSync } from \"node:zlib\";\nimport { PathEscapeError, assertContainedPath } from \"./path-containment.js\";\n\nconst LOCAL_SIG = 0x04034b50;\nconst CENTRAL_SIG = 0x02014b50;\nconst EOCD_SIG = 0x06054b50;\nconst UNIX_MADE_BY = 3 << 8;\nconst S_IFLNK = 0o120000;\nconst S_IFREG = 0o100000;\nconst MODE_FILE = S_IFREG | 0o644;\n\nconst CRC_TABLE = new Uint32Array(256);\nfor (let n = 0; n < 256; n++) {\n let c = n;\n for (let k = 0; k < 8; k++) {\n c = (c & 1) !== 0 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;\n }\n CRC_TABLE[n] = c >>> 0;\n}\n\nfunction crc32(buffer: Buffer): number {\n let c = 0xffffffff;\n for (let i = 0; i < buffer.length; i++) {\n c = CRC_TABLE[(c ^ (buffer[i] ?? 0)) & 0xff]! ^ (c >>> 8);\n }\n return (c ^ 0xffffffff) >>> 0;\n}\n\nexport interface ZipArchiveFile {\n path: string;\n data: Buffer;\n}\n\nexport class ZipSymlinkError extends Error {\n readonly entry: string;\n\n constructor(entry: string) {\n super(`Symlinks are not allowed in a bundle: ${entry}`);\n this.name = \"ZipSymlinkError\";\n this.entry = entry;\n }\n}\n\nfunction unixMode(externalAttributes: number): number {\n return (externalAttributes >>> 16) & 0o170000;\n}\n\nfunction writeU16(buffer: Buffer, offset: number, value: number): void {\n buffer.writeUInt16LE(value, offset);\n}\n\nfunction writeU32(buffer: Buffer, offset: number, value: number): void {\n buffer.writeUInt32LE(value >>> 0, offset);\n}\n\nfunction readU16(buffer: Buffer, offset: number): number {\n return buffer.readUInt16LE(offset);\n}\n\nfunction readU32(buffer: Buffer, offset: number): number {\n return buffer.readUInt32LE(offset);\n}\n\nfunction normalizeZipPath(entry: string): string {\n const trimmed = entry.replace(/\\\\/g, \"/\").replace(/^\\.\\//, \"\").replace(/\\/+$/, \"\");\n if (!trimmed || trimmed === \".\") {\n return \"\";\n }\n assertContainedPath(\".\", trimmed);\n if (trimmed.split(\"/\").includes(\"..\")) {\n throw new PathEscapeError(trimmed, \".\");\n }\n return trimmed;\n}\n\nexport function writeZipArchive(files: ZipArchiveFile[]): Buffer {\n const locals: Buffer[] = [];\n const centrals: Buffer[] = [];\n let offset = 0;\n\n const sorted = [...files].sort((left, right) => left.path.localeCompare(right.path));\n for (const file of sorted) {\n const name = normalizeZipPath(file.path);\n if (!name) continue;\n const nameBytes = Buffer.from(name, \"utf8\");\n const uncompressed = file.data;\n const compressed = deflateRawSync(uncompressed);\n const checksum = crc32(uncompressed);\n\n const local = Buffer.alloc(30 + nameBytes.length);\n writeU32(local, 0, LOCAL_SIG);\n writeU16(local, 4, 20);\n writeU16(local, 6, 0);\n writeU16(local, 8, 8);\n writeU16(local, 10, 0);\n writeU16(local, 12, 0);\n writeU32(local, 14, checksum);\n writeU32(local, 18, compressed.length);\n writeU32(local, 22, uncompressed.length);\n writeU16(local, 26, nameBytes.length);\n writeU16(local, 28, 0);\n nameBytes.copy(local, 30);\n\n const central = Buffer.alloc(46 + nameBytes.length);\n writeU32(central, 0, CENTRAL_SIG);\n writeU16(central, 4, UNIX_MADE_BY | 20);\n writeU16(central, 6, 20);\n writeU16(central, 8, 0);\n writeU16(central, 10, 8);\n writeU16(central, 12, 0);\n writeU16(central, 14, 0);\n writeU32(central, 16, checksum);\n writeU32(central, 20, compressed.length);\n writeU32(central, 24, uncompressed.length);\n writeU16(central, 28, nameBytes.length);\n writeU16(central, 30, 0);\n writeU16(central, 32, 0);\n writeU16(central, 34, 0);\n writeU16(central, 36, 0);\n writeU32(central, 38, MODE_FILE << 16);\n writeU32(central, 42, offset);\n nameBytes.copy(central, 46);\n\n locals.push(local, compressed);\n centrals.push(central);\n offset += local.length + compressed.length;\n }\n\n const centralDirectory = Buffer.concat(centrals);\n const eocd = Buffer.alloc(22);\n writeU32(eocd, 0, EOCD_SIG);\n writeU16(eocd, 4, 0);\n writeU16(eocd, 6, 0);\n writeU16(eocd, 8, centrals.length);\n writeU16(eocd, 10, centrals.length);\n writeU32(eocd, 12, centralDirectory.length);\n writeU32(eocd, 16, offset);\n writeU16(eocd, 20, 0);\n\n return Buffer.concat([...locals, centralDirectory, eocd]);\n}\n\nfunction findEocdOffset(buffer: Buffer): number {\n const min = Math.max(0, buffer.length - 22 - 0xffff);\n for (let i = buffer.length - 22; i >= min; i--) {\n if (readU32(buffer, i) === EOCD_SIG) {\n return i;\n }\n }\n throw new Error(\"Invalid zip archive: missing end of central directory\");\n}\n\nfunction stripSingleRoot(files: ZipArchiveFile[]): ZipArchiveFile[] {\n if (files.length === 0) return files;\n const first = files[0]?.path.split(\"/\")[0];\n if (!first) return files;\n const prefix = `${first}/`;\n if (!files.every((file) => file.path === first || file.path.startsWith(prefix))) {\n return files;\n }\n if (!files.some((file) => file.path === `${prefix}plugin.json` || file.path === \"plugin.json\")) {\n return files;\n }\n const stripped: ZipArchiveFile[] = [];\n for (const file of files) {\n if (file.path === first) continue;\n stripped.push({ path: file.path.slice(prefix.length), data: file.data });\n }\n return stripped;\n}\n\nexport function readZipArchive(buffer: Buffer): ZipArchiveFile[] {\n if (buffer.length < 22) {\n throw new Error(\"Invalid zip archive\");\n }\n const eocd = findEocdOffset(buffer);\n const count = readU16(buffer, eocd + 10);\n const centralSize = readU32(buffer, eocd + 12);\n const centralOffset = readU32(buffer, eocd + 16);\n if (centralOffset + centralSize > buffer.length) {\n throw new Error(\"Invalid zip archive: truncated central directory\");\n }\n\n const files: ZipArchiveFile[] = [];\n let cursor = centralOffset;\n for (let i = 0; i < count; i++) {\n if (readU32(buffer, cursor) !== CENTRAL_SIG) {\n throw new Error(\"Invalid zip archive: bad central directory entry\");\n }\n const madeBy = readU16(buffer, cursor + 4);\n const compression = readU16(buffer, cursor + 10);\n const compressedSize = readU32(buffer, cursor + 20);\n const uncompressedSize = readU32(buffer, cursor + 24);\n const nameLength = readU16(buffer, cursor + 28);\n const extraLength = readU16(buffer, cursor + 30);\n const commentLength = readU16(buffer, cursor + 32);\n const externalAttributes = readU32(buffer, cursor + 38);\n const localOffset = readU32(buffer, cursor + 42);\n const name = buffer.subarray(cursor + 46, cursor + 46 + nameLength).toString(\"utf8\");\n cursor += 46 + nameLength + extraLength + commentLength;\n\n const posixName = name.replace(/\\\\/g, \"/\");\n if (posixName.endsWith(\"/\")) {\n continue;\n }\n const relativePath = normalizeZipPath(posixName);\n if (!relativePath) continue;\n\n const unixHost = (madeBy >> 8) === 3;\n if (unixHost && unixMode(externalAttributes) === S_IFLNK) {\n throw new ZipSymlinkError(relativePath);\n }\n\n if (readU32(buffer, localOffset) !== LOCAL_SIG) {\n throw new Error(`Invalid zip archive: bad local header for ${relativePath}`);\n }\n const localNameLength = readU16(buffer, localOffset + 26);\n const localExtraLength = readU16(buffer, localOffset + 28);\n const dataStart = localOffset + 30 + localNameLength + localExtraLength;\n const payload = buffer.subarray(dataStart, dataStart + compressedSize);\n let data: Buffer;\n if (compression === 0) {\n data = Buffer.from(payload);\n } else if (compression === 8) {\n data = inflateRawSync(payload);\n } else {\n throw new Error(`Unsupported zip compression method ${compression} for ${relativePath}`);\n }\n if (data.length !== uncompressedSize) {\n throw new Error(`Zip size mismatch for ${relativePath}`);\n }\n files.push({ path: relativePath, data });\n }\n\n return stripSingleRoot(files);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,MAAM,UAAU,SAAS,WAAW;AACtD,SAAS,SAAS,WAAW,aAAa,qBAAqB;;;ACX/D,SAAS,gBAAgB,sBAAsB;AAG/C,IAAM,YAAY;AAClB,IAAM,cAAc;AACpB,IAAM,WAAW;AACjB,IAAM,eAAe,KAAK;AAC1B,IAAM,UAAU;AAChB,IAAM,UAAU;AAChB,IAAM,YAAY,UAAU;AAE5B,IAAM,YAAY,IAAI,YAAY,GAAG;AACrC,SAAS,IAAI,GAAG,IAAI,KAAK,KAAK;AAC5B,MAAI,IAAI;AACR,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,SAA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