harnesstap 1.4.0 → 1.6.1

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 (211) hide show
  1. package/README.md +3 -1
  2. package/dist/apply-ZGEAY6YZ.js +50 -0
  3. package/dist/{approve-FBGYQGWN.js → approve-VPVMU2MM.js} +10 -13
  4. package/dist/{approve-FBGYQGWN.js.map → approve-VPVMU2MM.js.map} +1 -1
  5. package/dist/{audit-VI4QZ6X2.js → audit-AO7AGET3.js} +11 -15
  6. package/dist/{audit-VI4QZ6X2.js.map → audit-AO7AGET3.js.map} +1 -1
  7. package/dist/{auth-4CQCDS2W.js → auth-7YRIJNXU.js} +10 -12
  8. package/dist/{auth-4CQCDS2W.js.map → auth-7YRIJNXU.js.map} +1 -1
  9. package/dist/bin.js +13 -34
  10. package/dist/bin.js.map +1 -1
  11. package/dist/{chunk-OML4HXKT.js → chunk-262KZULH.js} +16 -22
  12. package/dist/chunk-262KZULH.js.map +1 -0
  13. package/dist/{chunk-ZUASVASP.js → chunk-26QGX47N.js} +26097 -16881
  14. package/dist/chunk-26QGX47N.js.map +1 -0
  15. package/dist/{chunk-3P6BWL5F.js → chunk-27IPOVKQ.js} +2 -2
  16. package/dist/{chunk-M4KLHJ6U.js → chunk-2BESDRYP.js} +8 -10
  17. package/dist/{chunk-M4KLHJ6U.js.map → chunk-2BESDRYP.js.map} +1 -1
  18. package/dist/{chunk-PCMON7Y2.js → chunk-2BWIEB2G.js} +8 -10
  19. package/dist/{chunk-PCMON7Y2.js.map → chunk-2BWIEB2G.js.map} +1 -1
  20. package/dist/{chunk-XTVGCVU4.js → chunk-2NMLWSUH.js} +41 -42
  21. package/dist/chunk-2NMLWSUH.js.map +1 -0
  22. package/dist/{chunk-TQ2NA4Z4.js → chunk-4E3G4H5B.js} +8 -2
  23. package/dist/chunk-4E3G4H5B.js.map +1 -0
  24. package/dist/chunk-4QCGTUTM.js +61 -0
  25. package/dist/chunk-4QCGTUTM.js.map +1 -0
  26. package/dist/{chunk-TPEJFLV7.js → chunk-6RKJZW2N.js} +4 -6
  27. package/dist/{chunk-TPEJFLV7.js.map → chunk-6RKJZW2N.js.map} +1 -1
  28. package/dist/{chunk-JQOKQKQT.js → chunk-7IBFH736.js} +2 -2
  29. package/dist/{chunk-P2C7JPLD.js → chunk-CKJIS2FM.js} +6 -6
  30. package/dist/{chunk-R7ZOYVN3.js → chunk-CUOEQQFI.js} +187 -59
  31. package/dist/chunk-CUOEQQFI.js.map +1 -0
  32. package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
  33. package/dist/chunk-CWXCZBJR.js.map +1 -0
  34. package/dist/{chunk-4ZQ2SCGY.js → chunk-FLYQEB6D.js} +509 -207
  35. package/dist/chunk-FLYQEB6D.js.map +1 -0
  36. package/dist/{chunk-U6DXASQP.js → chunk-HC7IZY75.js} +2 -2
  37. package/dist/{chunk-UVVZHWD2.js → chunk-I4DKV63E.js} +2 -2
  38. package/dist/{chunk-PNGF5EV2.js → chunk-JEC5PWNH.js} +2 -2
  39. package/dist/{chunk-MR7IOHSX.js → chunk-KFIRABC7.js} +16 -22
  40. package/dist/{chunk-MR7IOHSX.js.map → chunk-KFIRABC7.js.map} +1 -1
  41. package/dist/{chunk-6LTLYV5D.js → chunk-LGWFLVZQ.js} +1064 -265
  42. package/dist/chunk-LGWFLVZQ.js.map +1 -0
  43. package/dist/{chunk-RDG5DT7S.js → chunk-LX6PMOOC.js} +54 -40
  44. package/dist/chunk-LX6PMOOC.js.map +1 -0
  45. package/dist/{chunk-WGP4GUYZ.js → chunk-MILGCNBK.js} +9 -11
  46. package/dist/{chunk-WGP4GUYZ.js.map → chunk-MILGCNBK.js.map} +1 -1
  47. package/dist/chunk-MKLJBW5N.js +14 -0
  48. package/dist/{chunk-N3ZCH64F.js → chunk-MSKTWYHG.js} +86 -32
  49. package/dist/chunk-MSKTWYHG.js.map +1 -0
  50. package/dist/{chunk-WG5A6EAU.js → chunk-MTCCUYBZ.js} +821 -28
  51. package/dist/chunk-MTCCUYBZ.js.map +1 -0
  52. package/dist/{chunk-BPWFQKI5.js → chunk-NIFKCS7J.js} +2 -2
  53. package/dist/{chunk-43BDGVN3.js → chunk-NWOYPK2O.js} +56 -9
  54. package/dist/chunk-NWOYPK2O.js.map +1 -0
  55. package/dist/{chunk-3FS775NP.js → chunk-NXILQDJG.js} +85 -4
  56. package/dist/chunk-NXILQDJG.js.map +1 -0
  57. package/dist/chunk-QF73VLAW.js +31673 -0
  58. package/dist/chunk-QF73VLAW.js.map +1 -0
  59. package/dist/{chunk-RFQ3N7FB.js → chunk-QHCGA6LC.js} +11 -19
  60. package/dist/chunk-QHCGA6LC.js.map +1 -0
  61. package/dist/{chunk-L6YZE5MY.js → chunk-QPJZKWML.js} +5 -7
  62. package/dist/{chunk-L6YZE5MY.js.map → chunk-QPJZKWML.js.map} +1 -1
  63. package/dist/{chunk-ULCD6DJE.js → chunk-RM7VP6ID.js} +24 -61
  64. package/dist/chunk-RM7VP6ID.js.map +1 -0
  65. package/dist/{chunk-7HP6AAI3.js → chunk-SMLO5YPI.js} +2 -2
  66. package/dist/{chunk-73OJQTBW.js → chunk-T2JBSRGG.js} +2 -2
  67. package/dist/{chunk-IE7B6Q5K.js → chunk-U5Y6WKKT.js} +17 -18
  68. package/dist/chunk-U5Y6WKKT.js.map +1 -0
  69. package/dist/chunk-UEA4NCY2.js +106 -0
  70. package/dist/chunk-UEA4NCY2.js.map +1 -0
  71. package/dist/chunk-VAPCU2FX.js +70 -0
  72. package/dist/chunk-VAPCU2FX.js.map +1 -0
  73. package/dist/{chunk-RVEXPMM3.js → chunk-WEJVFNRO.js} +3 -5
  74. package/dist/{chunk-RVEXPMM3.js.map → chunk-WEJVFNRO.js.map} +1 -1
  75. package/dist/{chunk-IMROMZ2K.js → chunk-WWFVMCTR.js} +19 -14
  76. package/dist/chunk-WWFVMCTR.js.map +1 -0
  77. package/dist/chunk-XPONNOBR.js +102 -0
  78. package/dist/chunk-XPONNOBR.js.map +1 -0
  79. package/dist/{chunk-N3VGY3T3.js → chunk-Y3HJ2F2W.js} +7 -5
  80. package/dist/{chunk-N3VGY3T3.js.map → chunk-Y3HJ2F2W.js.map} +1 -1
  81. package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
  82. package/dist/chunk-Y4I7ZCAE.js.map +1 -0
  83. package/dist/{chunk-GRASK6M6.js → chunk-ZREU2UHM.js} +5 -5
  84. package/dist/{chunk-QA5U36JN.js → chunk-ZT7ANP3H.js} +774 -364
  85. package/dist/chunk-ZT7ANP3H.js.map +1 -0
  86. package/dist/{chunk-EOPFER6N.js → chunk-ZUXFPAVX.js} +19 -5
  87. package/dist/chunk-ZUXFPAVX.js.map +1 -0
  88. package/dist/{chunk-D432JAXV.js → chunk-ZWB6YXVQ.js} +153 -25
  89. package/dist/chunk-ZWB6YXVQ.js.map +1 -0
  90. package/dist/{chunk-23XSG7LI.js → chunk-ZZQDJGWX.js} +4 -4
  91. package/dist/{compile-GXADKGH5.js → compile-IMJHVXQO.js} +33 -37
  92. package/dist/{compile-GXADKGH5.js.map → compile-IMJHVXQO.js.map} +1 -1
  93. package/dist/{config-JMHNA2U5.js → config-FVVN3NWL.js} +16 -21
  94. package/dist/{config-JMHNA2U5.js.map → config-FVVN3NWL.js.map} +1 -1
  95. package/dist/cursor-local-install-JS5KSOES.js +94 -0
  96. package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-JS5KSOES.js.map} +1 -1
  97. package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-QU5R2FV5.js} +8 -12
  98. package/dist/cursor-local-install-QU5R2FV5.js.map +1 -0
  99. package/dist/{doctor-N7ZULPOL.js → doctor-A7VUJSCP.js} +14 -17
  100. package/dist/doctor-A7VUJSCP.js.map +1 -0
  101. package/dist/{environment-OBB3WU5B.js → environment-6INIUBNC.js} +42 -50
  102. package/dist/environment-6INIUBNC.js.map +1 -0
  103. package/dist/{github-PBYBGOLH.js → github-TFJT3P53.js} +9 -10
  104. package/dist/{github-PBYBGOLH.js.map → github-TFJT3P53.js.map} +1 -1
  105. package/dist/{harness-7KYATIV6.js → harness-WQNC5HPZ.js} +46 -84
  106. package/dist/harness-WQNC5HPZ.js.map +1 -0
  107. package/dist/{help-EE3AJQD4.js → help-NMS3EXJB.js} +15 -20
  108. package/dist/{help-EE3AJQD4.js.map → help-NMS3EXJB.js.map} +1 -1
  109. package/dist/{help-VXWKLQ6A.js → help-VW4RIICD.js} +57 -575
  110. package/dist/help-VW4RIICD.js.map +1 -0
  111. package/dist/host-plugin-view-kept-HYCHDB4D.js +139 -0
  112. package/dist/host-plugin-view-kept-HYCHDB4D.js.map +1 -0
  113. package/dist/index.js +12 -16
  114. package/dist/{init-LBTMPDVJ.js → init-RXYL5ZUE.js} +33 -41
  115. package/dist/{init-LBTMPDVJ.js.map → init-RXYL5ZUE.js.map} +1 -1
  116. package/dist/live-read-cache-BHU6L7MA.js +13 -0
  117. package/dist/live-read-cache-NQU7M2C7.js +12 -0
  118. package/dist/{lock-WLJRXRVK.js → lock-3H3Z65DS.js} +9 -12
  119. package/dist/{lock-WLJRXRVK.js.map → lock-3H3Z65DS.js.map} +1 -1
  120. package/dist/{marketplace-GXSV6QIY.js → marketplace-KW35PJCY.js} +26 -79
  121. package/dist/marketplace-KW35PJCY.js.map +1 -0
  122. package/dist/{mcp-XPDWWU75.js → mcp-2HUGVDJ5.js} +33 -37
  123. package/dist/{mcp-XPDWWU75.js.map → mcp-2HUGVDJ5.js.map} +1 -1
  124. package/dist/{migrate-SBUIWN3U.js → migrate-6VAPYNXI.js} +93 -34
  125. package/dist/migrate-6VAPYNXI.js.map +1 -0
  126. package/dist/notifications-Y7KQCN6K.js +154 -0
  127. package/dist/notifications-Y7KQCN6K.js.map +1 -0
  128. package/dist/open-FADABB2S.js +20 -0
  129. package/dist/{pack-A73LDVOX.js → pack-NTECD3BZ.js} +10 -14
  130. package/dist/{pack-A73LDVOX.js.map → pack-NTECD3BZ.js.map} +1 -1
  131. package/dist/plugin-T2YFCYIO.js +47 -0
  132. package/dist/plugin-from-project-FGX5AHW6.js +15 -0
  133. package/dist/{policy-6VY3CMSU.js → policy-3FOWB4GR.js} +9 -12
  134. package/dist/{policy-6VY3CMSU.js.map → policy-3FOWB4GR.js.map} +1 -1
  135. package/dist/{profile-YCKPMRRU.js → profile-HM3ROXXB.js} +108 -78
  136. package/dist/profile-HM3ROXXB.js.map +1 -0
  137. package/dist/{project-KHPPBKPN.js → project-3DTXKMI6.js} +512 -119
  138. package/dist/project-3DTXKMI6.js.map +1 -0
  139. package/dist/{resource-IJU3FAN5.js → resource-TZDZAVZ6.js} +55 -45
  140. package/dist/resource-TZDZAVZ6.js.map +1 -0
  141. package/dist/status-refresh-worker.js +1155 -0
  142. package/dist/status-refresh-worker.js.map +1 -0
  143. package/dist/{version-Z66FWWMQ.js → version-AMZJHJIB.js} +3 -3
  144. package/dist/version-AMZJHJIB.js.map +1 -0
  145. package/package.json +16 -11
  146. package/dist/apply-SUNDXRJ3.js +0 -54
  147. package/dist/chunk-2A36HWDE.js.map +0 -1
  148. package/dist/chunk-2H7UOFLK.js +0 -11
  149. package/dist/chunk-3FS775NP.js.map +0 -1
  150. package/dist/chunk-43BDGVN3.js.map +0 -1
  151. package/dist/chunk-4ZQ2SCGY.js.map +0 -1
  152. package/dist/chunk-6LTLYV5D.js.map +0 -1
  153. package/dist/chunk-D432JAXV.js.map +0 -1
  154. package/dist/chunk-DF4Z7LAD.js +0 -3463
  155. package/dist/chunk-DF4Z7LAD.js.map +0 -1
  156. package/dist/chunk-EOPFER6N.js.map +0 -1
  157. package/dist/chunk-G6WKY2W4.js +0 -389
  158. package/dist/chunk-G6WKY2W4.js.map +0 -1
  159. package/dist/chunk-IE7B6Q5K.js.map +0 -1
  160. package/dist/chunk-IMROMZ2K.js.map +0 -1
  161. package/dist/chunk-M2U3J7UX.js +0 -46
  162. package/dist/chunk-M2U3J7UX.js.map +0 -1
  163. package/dist/chunk-N3ZCH64F.js.map +0 -1
  164. package/dist/chunk-NAGAJ5UM.js +0 -145
  165. package/dist/chunk-NAGAJ5UM.js.map +0 -1
  166. package/dist/chunk-OML4HXKT.js.map +0 -1
  167. package/dist/chunk-QA5U36JN.js.map +0 -1
  168. package/dist/chunk-R7ZOYVN3.js.map +0 -1
  169. package/dist/chunk-RDG5DT7S.js.map +0 -1
  170. package/dist/chunk-REHRUNBB.js.map +0 -1
  171. package/dist/chunk-RFQ3N7FB.js.map +0 -1
  172. package/dist/chunk-TQ2NA4Z4.js.map +0 -1
  173. package/dist/chunk-ULCD6DJE.js.map +0 -1
  174. package/dist/chunk-WG5A6EAU.js.map +0 -1
  175. package/dist/chunk-XGTTOO4R.js +0 -84
  176. package/dist/chunk-XGTTOO4R.js.map +0 -1
  177. package/dist/chunk-XTVGCVU4.js.map +0 -1
  178. package/dist/chunk-XUJKZQZA.js +0 -235
  179. package/dist/chunk-XUJKZQZA.js.map +0 -1
  180. package/dist/chunk-ZUASVASP.js.map +0 -1
  181. package/dist/doctor-N7ZULPOL.js.map +0 -1
  182. package/dist/environment-OBB3WU5B.js.map +0 -1
  183. package/dist/harness-7KYATIV6.js.map +0 -1
  184. package/dist/help-VXWKLQ6A.js.map +0 -1
  185. package/dist/live-read-cache-TUSP7U3D.js +0 -10
  186. package/dist/marketplace-GXSV6QIY.js.map +0 -1
  187. package/dist/migrate-SBUIWN3U.js.map +0 -1
  188. package/dist/open-HDGLYYVU.js +0 -24
  189. package/dist/plugin-CEO6ZJM5.js +0 -51
  190. package/dist/plugin-from-project-UK7VJVUP.js +0 -18
  191. package/dist/profile-YCKPMRRU.js.map +0 -1
  192. package/dist/project-KHPPBKPN.js.map +0 -1
  193. package/dist/resource-IJU3FAN5.js.map +0 -1
  194. /package/dist/{apply-SUNDXRJ3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
  195. /package/dist/{chunk-3P6BWL5F.js.map → chunk-27IPOVKQ.js.map} +0 -0
  196. /package/dist/{chunk-JQOKQKQT.js.map → chunk-7IBFH736.js.map} +0 -0
  197. /package/dist/{chunk-P2C7JPLD.js.map → chunk-CKJIS2FM.js.map} +0 -0
  198. /package/dist/{chunk-U6DXASQP.js.map → chunk-HC7IZY75.js.map} +0 -0
  199. /package/dist/{chunk-UVVZHWD2.js.map → chunk-I4DKV63E.js.map} +0 -0
  200. /package/dist/{chunk-PNGF5EV2.js.map → chunk-JEC5PWNH.js.map} +0 -0
  201. /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
  202. /package/dist/{chunk-BPWFQKI5.js.map → chunk-NIFKCS7J.js.map} +0 -0
  203. /package/dist/{chunk-7HP6AAI3.js.map → chunk-SMLO5YPI.js.map} +0 -0
  204. /package/dist/{chunk-73OJQTBW.js.map → chunk-T2JBSRGG.js.map} +0 -0
  205. /package/dist/{chunk-GRASK6M6.js.map → chunk-ZREU2UHM.js.map} +0 -0
  206. /package/dist/{chunk-23XSG7LI.js.map → chunk-ZZQDJGWX.js.map} +0 -0
  207. /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
  208. /package/dist/{open-HDGLYYVU.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
  209. /package/dist/{plugin-CEO6ZJM5.js.map → open-FADABB2S.js.map} +0 -0
  210. /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-T2YFCYIO.js.map} +0 -0
  211. /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  promptMaterializationConflict,
3
3
  resolveApplyConflictPolicy
4
- } from "./chunk-R7ZOYVN3.js";
4
+ } from "./chunk-CUOEQQFI.js";
5
5
  import {
6
6
  filterLocalBrowseRows,
7
7
  formatLocalPluginListName,
@@ -9,7 +9,7 @@ import {
9
9
  listNavigablePluginListBrowseRows,
10
10
  renderGroupedPluginListBrowseViewport,
11
11
  toRemoteBrowseRows
12
- } from "./chunk-MR7IOHSX.js";
12
+ } from "./chunk-KFIRABC7.js";
13
13
  import {
14
14
  DEFAULT_EXCLUDED_SKILL_CATEGORIES,
15
15
  createRemoteCatalogListPrompt,
@@ -20,27 +20,18 @@ import {
20
20
  resolveSelectedSkills,
21
21
  resolveSkillPackageCheckout,
22
22
  useDebouncedRemoteSearch
23
- } from "./chunk-OML4HXKT.js";
24
- import {
25
- catalogPluginKey,
26
- formatCatalogSelectionLabel,
27
- renderCatalogListChunk
28
- } from "./chunk-XUJKZQZA.js";
23
+ } from "./chunk-262KZULH.js";
29
24
  import {
30
25
  computeShowViewportBounds,
31
26
  createPromptScreen,
32
27
  renderScrollableShowContent
33
- } from "./chunk-P2C7JPLD.js";
28
+ } from "./chunk-CKJIS2FM.js";
34
29
  import {
35
30
  useTerminalSize
36
- } from "./chunk-UVVZHWD2.js";
37
- import {
38
- VIEWPORT_CHROME_LINES,
39
- computeRemoteListFetchLimit
40
- } from "./chunk-XGTTOO4R.js";
31
+ } from "./chunk-I4DKV63E.js";
41
32
  import {
42
33
  promptForSearchableMultiSelect
43
- } from "./chunk-JQOKQKQT.js";
34
+ } from "./chunk-7IBFH736.js";
44
35
  import {
45
36
  buildHelpLine,
46
37
  clampActiveIndex,
@@ -50,41 +41,55 @@ import {
50
41
  isLetterKey,
51
42
  isSearchCharacter
52
43
  } from "./chunk-3FIWOI3H.js";
53
- import {
54
- isPromptCancellationError,
55
- promptForChoice,
56
- promptForConfirmation,
57
- shouldUseWizard
58
- } from "./chunk-NAGAJ5UM.js";
59
44
  import {
60
45
  initializeSchema
61
- } from "./chunk-3FS775NP.js";
46
+ } from "./chunk-NXILQDJG.js";
62
47
  import {
63
48
  parseOutputFormat,
64
49
  printJson
65
- } from "./chunk-TQ2NA4Z4.js";
50
+ } from "./chunk-4E3G4H5B.js";
66
51
  import {
67
52
  fail,
68
53
  formatCommand
69
- } from "./chunk-RFQ3N7FB.js";
54
+ } from "./chunk-QHCGA6LC.js";
70
55
  import {
56
+ ExtendsError,
57
+ LocalPluginSelectorError,
58
+ PluginAmbiguityError,
59
+ PluginForkError,
71
60
  PluginProvenanceError,
61
+ PluginResolveError,
72
62
  PluginVersionError,
73
63
  RESOURCE_TYPES,
64
+ UpstreamUnpublishedError,
65
+ VIEWPORT_CHROME_LINES,
74
66
  addPluginAttachment,
67
+ addResourceToPlugin,
75
68
  applyToGlobal,
76
69
  assertAuthored,
70
+ assertNoExtendsCycle,
71
+ assertParentPublished,
77
72
  assertPluginsCleanForShare,
78
73
  buildApPackageFiles,
74
+ buildUpstream,
75
+ catalogUpstreamBase,
76
+ cloudPublishErrorMessage,
79
77
  collectPluginPinsForPrepare,
78
+ computeRemoteListFetchLimit,
80
79
  createPlugin,
81
80
  cutPluginVersion,
82
81
  deletePlugin,
83
82
  diagnoseApManifest,
84
83
  downloadCatalogPackage,
85
84
  envelopeFromFiles,
85
+ fetchPluginExportToTempFile,
86
+ findLocalPluginBySelector,
87
+ forkPlugin,
88
+ formatCatalogSelectionLabel,
86
89
  formatPluginVersionLabel,
87
90
  formatPublishedPluginSelector,
91
+ formatUpstreamLabel,
92
+ getActiveProfileName,
88
93
  getEnvironment,
89
94
  getImportedSnapshot,
90
95
  getPlugin,
@@ -95,31 +100,49 @@ import {
95
100
  getPluginResources,
96
101
  importApPackageFiles,
97
102
  installPluginFromCatalog,
98
- isApEnvelopePath,
99
- isPluginPackageDirectory,
103
+ isPluginExportFilePath,
104
+ isPluginUrl,
100
105
  isProfilePlugin,
101
- isZipBundlePath,
102
106
  listAttachedPluginPins,
103
107
  listCatalogPluginsPage,
108
+ listComposedItems,
104
109
  listDependencies,
105
110
  listLatestPublishedPluginsBySlug,
106
111
  listPluginDependencies,
112
+ listPluginExcludes,
107
113
  listPlugins,
108
114
  listPluginsInScope,
109
- looksLikeFilesystemPath,
115
+ markPluginDirty,
110
116
  mergePluginsById,
111
117
  parseSpecMcpJson,
112
118
  preparePluginPinsForApply,
113
119
  rankCatalogSearchResults,
114
120
  recordImportedSnapshotInstall,
121
+ renderCatalogListChunk,
122
+ resolveBareNameFromCatalog,
123
+ resolveClaudeEnabledPluginRef,
115
124
  resolveComposition,
116
125
  resolveEnvironmentCascadeForApply,
126
+ resolveInstallSelector,
117
127
  resolvePluginSelector,
118
128
  resolveScanGlobalHarnessTargets,
119
129
  satisfiesConstraint,
120
- updatePluginPublishedIdentity
121
- } from "./chunk-ZUASVASP.js";
130
+ setPluginExcludes,
131
+ setPluginResourceOrder,
132
+ setPluginUpstream,
133
+ substituteResourcesForApply,
134
+ updatePluginPublishedIdentity,
135
+ writePluginExcludes
136
+ } from "./chunk-26QGX47N.js";
122
137
  import {
138
+ isPromptCancellationError,
139
+ promptForChoice,
140
+ promptForConfirmation,
141
+ resolveHomeRoot,
142
+ shouldUseWizard
143
+ } from "./chunk-LGWFLVZQ.js";
144
+ import {
145
+ cloudErrorDetail,
123
146
  createPersistingCloudClient,
124
147
  ensureRegisteredPublishCatalog,
125
148
  formatCanonicalPublishedSelector,
@@ -128,212 +151,370 @@ import {
128
151
  formatPublishCatalogSelector,
129
152
  formatPublishedSelector,
130
153
  getCloudAccount,
131
- isPublicCatalogEnabled,
132
154
  loadRegisteredCatalogs,
133
155
  parsePluginSelector,
134
156
  parsePublishCatalogSelector,
135
157
  publishCatalogKey,
136
158
  registerPublishCatalog,
159
+ requestIdSuffix,
137
160
  resolveCatalogScope,
138
161
  resolveRemotePluginSelector,
139
162
  resolvedRemotePluginFromCatalog,
140
163
  trackPluginUsed,
141
164
  unregisterPublishCatalog
142
- } from "./chunk-N3ZCH64F.js";
165
+ } from "./chunk-MSKTWYHG.js";
143
166
  import {
167
+ CLI_ERRORS,
168
+ CLI_HINTS,
169
+ applyCancelledMessage,
170
+ formatCatalogRequestError,
171
+ formatCount,
144
172
  formatRelativeTimeWithAbsolute,
173
+ getDb,
145
174
  renderPanel,
146
175
  renderSubheader,
147
176
  renderTable,
148
177
  shortenId,
149
178
  theme,
150
179
  ui
151
- } from "./chunk-2A36HWDE.js";
152
- import {
153
- getActiveProfileName,
154
- resolveClaudeEnabledPluginRef,
155
- resolveHomeRoot,
156
- substituteResourcesForApply
157
- } from "./chunk-DF4Z7LAD.js";
158
- import {
159
- CLI_ERRORS,
160
- CLI_HINTS,
161
- applyCancelledMessage,
162
- fetchWithTimeout,
163
- formatCatalogRequestError,
164
- formatCount,
165
- getDb
166
- } from "./chunk-WG5A6EAU.js";
180
+ } from "./chunk-MTCCUYBZ.js";
167
181
 
168
- // src/services/plugin-source.ts
169
- import { mkdtempSync, writeFileSync } from "fs";
170
- import { tmpdir } from "os";
171
- import { join } from "path";
172
- var URL_PATTERN = /^https?:\/\//i;
173
- function isPluginUrl(source) {
174
- return URL_PATTERN.test(source);
175
- }
176
- function isPluginExportFilePath(source) {
177
- if (isApEnvelopePath(source)) return true;
178
- if (source.endsWith("/plugin.json") || source.endsWith("\\plugin.json")) return true;
179
- if (isZipBundlePath(source)) return true;
180
- return looksLikeFilesystemPath(source) && isPluginPackageDirectory(source);
181
- }
182
- function writePluginExportToTempFile(body) {
183
- const dir = mkdtempSync(join(tmpdir(), "harnesstap-plugin-export-"));
184
- const filePath = join(dir, "remote.ap.json");
185
- writeFileSync(filePath, body, "utf-8");
186
- return filePath;
187
- }
188
- async function fetchPluginExportToTempFile(url) {
189
- const response = await fetchWithTimeout(url, { timeoutMs: 6e4 });
190
- if (!response.ok) {
191
- throw new Error(`Failed to fetch plugin export (${response.status}): ${url}`);
192
- }
193
- const body = await response.text();
194
- return writePluginExportToTempFile(body);
182
+ // src/services/plugin-duplicate.ts
183
+ import { randomUUID } from "crypto";
184
+ function duplicatePlugin(selector, opts = {}) {
185
+ const mode = opts.mode ?? "inherit";
186
+ if (mode === "copy") {
187
+ const fork = forkPlugin(selector, opts.name, { allowAuthored: true, defaultSuffix: "-copy" });
188
+ return {
189
+ plugin: fork.plugin,
190
+ source: fork.source,
191
+ mode,
192
+ upstream: fork.upstream,
193
+ linked_to: fork.forked_from
194
+ };
195
+ }
196
+ const source = resolvePluginSelector(selector);
197
+ if (!source) {
198
+ throw new PluginForkError("not_found", `Plugin not found: ${selector}`);
199
+ }
200
+ const name = opts.name?.trim() || `${source.name}-copy`;
201
+ if (getPluginByName(name)) {
202
+ throw new PluginForkError("plugin_exists", `Plugin ${name} already exists.`, source.name);
203
+ }
204
+ const upstream = buildUpstream("extends", catalogUpstreamBase(source) ?? source.name, source.version);
205
+ assertNoExtendsCycle({ ...source, id: "", name, upstream: void 0 }, upstream, source.id);
206
+ const db = getDb();
207
+ const id = db.transaction(() => {
208
+ const created = createPlugin({
209
+ name,
210
+ version: "1.0.0",
211
+ description: source.description,
212
+ tags: source.tags,
213
+ ...source.needs ? { needs: source.needs } : {},
214
+ origin: "authored"
215
+ });
216
+ setPluginUpstream(created.id, upstream, source.id);
217
+ return created.id;
218
+ })();
219
+ const plugin = getPluginById(id);
220
+ if (!plugin) {
221
+ throw new PluginForkError("not_found", `Plugin not found after duplicate: ${name}`);
222
+ }
223
+ return { plugin, source, mode, upstream, linked_to: formatUpstreamLabel(upstream) };
195
224
  }
196
-
197
- // src/services/plugin-bare-name-resolve.ts
198
- var PluginResolveError = class extends Error {
199
- hints;
200
- constructor(message, hints = []) {
201
- super(message);
202
- this.name = "PluginResolveError";
203
- this.hints = hints;
225
+ var DETACH_UNDO_TTL_MS = 10 * 60 * 1e3;
226
+ var detachUndoSnapshots = /* @__PURE__ */ new Map();
227
+ function detachPlugin(selector) {
228
+ const plugin = resolvePluginSelector(selector);
229
+ if (!plugin) {
230
+ throw new PluginForkError("not_found", `Plugin not found: ${selector}`);
204
231
  }
205
- };
206
- var PluginAmbiguityError = class extends PluginResolveError {
207
- candidates;
208
- constructor(selector, candidates) {
209
- const lines = candidates.map(
210
- (plugin) => formatCatalogSelector(plugin, plugin.latestVersion ?? void 0)
211
- );
212
- super(
213
- `Ambiguous plugin name: ${selector}
214
- ${lines.map((line) => ` ${line}`).join("\n")}`,
215
- ["Use a fully qualified selector: org/catalog/slug@version"]
216
- );
217
- this.candidates = candidates;
232
+ if (plugin.upstream?.kind !== "extends") {
233
+ throw new ExtendsError("not_extends", `${plugin.name} does not keep in sync with a parent; there is nothing to detach.`);
218
234
  }
235
+ const upstream = plugin.upstream;
236
+ const items = listComposedItems(plugin.id);
237
+ const hidden = listPluginExcludes(plugin.id);
238
+ const ownIds = new Set(getPluginResources(plugin.id).map((resource) => resource.id));
239
+ const db = getDb();
240
+ const ownOrder = getPluginResources(plugin.id).map((resource) => resource.id);
241
+ const workingSnapshot = db.prepare(
242
+ "SELECT source_version, payload, created_at FROM plugin_working_snapshots WHERE plugin_id = ?"
243
+ ).get(plugin.id) ?? null;
244
+ const added = [];
245
+ let materialized = 0;
246
+ db.transaction(() => {
247
+ markPluginDirty(plugin.id);
248
+ for (const item of items) {
249
+ if (item.source !== "parent" || ownIds.has(item.resource.id)) continue;
250
+ addResourceToPlugin(plugin.id, item.resource.id, item.resource.harness_scope);
251
+ added.push(item.resource.id);
252
+ materialized += 1;
253
+ }
254
+ setPluginResourceOrder(
255
+ plugin.id,
256
+ items.map((item) => item.resource.id)
257
+ );
258
+ setPluginUpstream(plugin.id, { ...upstream, kind: "fork" }, plugin.upstream_plugin_id ?? "");
259
+ writePluginExcludes(plugin.id, []);
260
+ })();
261
+ const updated = getPluginById(plugin.id);
262
+ if (!updated) {
263
+ throw new PluginForkError("not_found", `Plugin not found after detach: ${plugin.name}`);
264
+ }
265
+ const token = randomUUID();
266
+ detachUndoSnapshots.set(plugin.id, {
267
+ token,
268
+ pluginId: plugin.id,
269
+ upstream,
270
+ upstreamPluginId: plugin.upstream_plugin_id ?? "",
271
+ excludes: hidden,
272
+ ownOrder,
273
+ added,
274
+ wasDirty: plugin.dirty === true,
275
+ workingSnapshot,
276
+ expiresAt: Date.now() + DETACH_UNDO_TTL_MS
277
+ });
278
+ return { plugin: updated, materialized, hidden, undo_token: token };
279
+ }
280
+
281
+ // src/services/plugin-duplicate-cloud.ts
282
+ var defaultDeps = {
283
+ createClient: async (account) => (await createPersistingCloudClient(account))?.client ?? null
219
284
  };
220
- function isBareInstallSelector(selector) {
221
- if (isPluginUrl(selector) || isPluginExportFilePath(selector)) {
222
- return false;
285
+ var CLOUD_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9.-]{0,62}[a-z0-9])?$/;
286
+ function cloudSlugFromName(name) {
287
+ const slug = name.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").slice(0, 64);
288
+ return CLOUD_SLUG_PATTERN.test(slug) ? slug : void 0;
289
+ }
290
+ function invalidNameMessage(name) {
291
+ return `"${name}" cannot be used as a Cloud profile name: it needs letters or digits, and its slug must be at most 64 characters without a hyphen at either end. Try a name such as planner-copy.`;
292
+ }
293
+ function parseTarget(to) {
294
+ const [org, catalog, ...rest] = to.split("/").map((part) => part.trim());
295
+ if (!org || rest.length > 0) {
296
+ throw new PluginForkError("not_found", `Invalid --to "${to}". Use <org>/<catalog>, e.g. my-org/default.`);
223
297
  }
224
- return !selector.includes("/");
298
+ return { org, catalog: catalog || "default" };
225
299
  }
226
- async function resolveInstallSelector(selector, options = {}) {
227
- if (isBareInstallSelector(selector)) {
228
- const hasRemoteHelpers = Boolean(
229
- options.org || options.catalog || options.version
300
+ function catalogSource(selector) {
301
+ const parsed = parsePluginSelector(selector);
302
+ if (parsed.scope === "published") {
303
+ return { org: parsed.org, catalog: parsed.catalog, slug: parsed.name };
304
+ }
305
+ const local = resolvePluginSelector(selector);
306
+ const base = local ? catalogUpstreamBase(local) : void 0;
307
+ if (!base) return void 0;
308
+ const [org, catalog, slug] = base.split("/");
309
+ return org && catalog && slug ? { org, catalog, slug } : void 0;
310
+ }
311
+ async function duplicateInCloud(selector, opts, deps = defaultDeps) {
312
+ const target = parseTarget(opts.to);
313
+ const source = catalogSource(selector);
314
+ if (!source) {
315
+ throw new PluginForkError(
316
+ "not_found",
317
+ `${selector} is not in a catalog, so Cloud cannot duplicate it. Drop --to to duplicate it in your Library.`
230
318
  );
231
- if (hasRemoteHelpers || !isPublicCatalogEnabled()) {
232
- return resolveRemotePluginSelector(selector, {
233
- org: options.org,
234
- catalog: options.catalog,
235
- version: options.version
236
- });
237
- }
238
- return resolveBareNameFromCatalog(selector, options);
239
319
  }
240
- return resolveRemotePluginSelector(selector, {
241
- org: options.org,
242
- catalog: options.catalog,
243
- version: options.version
244
- });
320
+ const name = opts.name?.trim() || `${source.slug}-copy`;
321
+ const slug = cloudSlugFromName(name);
322
+ if (!slug) {
323
+ throw new PluginForkError("not_found", invalidNameMessage(name));
324
+ }
325
+ const client = await deps.createClient(opts.account);
326
+ if (!client) {
327
+ throw new PluginForkError("not_found", "Not signed in to HarnessTap Cloud. Run `ht auth login` first.");
328
+ }
329
+ let response;
330
+ try {
331
+ response = await client.duplicateCatalogPlugin({
332
+ source,
333
+ mode: opts.mode === "copy" ? "copy" : "extends",
334
+ name,
335
+ targetOrg: target.org,
336
+ targetCatalog: target.catalog
337
+ });
338
+ } catch (error) {
339
+ throw new PluginForkError(
340
+ "not_found",
341
+ cloudDuplicateErrorMessage(error, { selector, source, target, name, slug }) ?? (error instanceof Error ? error.message : String(error))
342
+ );
343
+ }
344
+ if (response) return { kind: "cloud", response };
345
+ if (!resolvePluginSelector(selector)) {
346
+ throw new PluginForkError(
347
+ "not_found",
348
+ `Cloud cannot duplicate profiles yet and ${selector} is not in your Library. Run \`ht profile pull ${selector}\`, then duplicate without --to.`
349
+ );
350
+ }
351
+ return { kind: "local", result: duplicatePlugin(selector, { name, mode: opts.mode }) };
352
+ }
353
+ function cloudDuplicateErrorMessage(error, ctx) {
354
+ const detail = cloudErrorDetail(error);
355
+ const request = requestIdSuffix(detail);
356
+ const sourceLabel = `${ctx.source.org}/${ctx.source.catalog}/${ctx.source.slug}`;
357
+ const to = `${ctx.target.org}/${ctx.target.catalog}`;
358
+ switch (detail.code) {
359
+ case "invalid_input":
360
+ return `${invalidNameMessage(ctx.name)}${request}`;
361
+ case "duplicate_slug":
362
+ return `${to} already has a profile with the slug ${ctx.slug}. Pick another name, e.g. \`ht profile duplicate ${sourceLabel} ${ctx.slug}-2 --to ${to}\`.${request}`;
363
+ case "not_found":
364
+ return `Cloud cannot find ${sourceLabel}: it is hidden, private, or does not exist. Check the selector, or sign in with an account that can see it.${request}`;
365
+ case "forbidden":
366
+ return `Cloud does not know the organization ${ctx.target.org}, or this account cannot publish there. Check --to ${to}.${request}`;
367
+ case "catalog_not_found":
368
+ return `Cloud cannot find the catalog in ${to}${detail.message ? ` (${detail.message.replace(/\.$/, "")})` : ""}. Check --to <org>/<catalog>.${request}`;
369
+ case "upstream_unpublished":
370
+ return `${detail.ref ?? sourceLabel} is not published, so it cannot be duplicated.${request}`;
371
+ default:
372
+ return detail.message ? `Cloud could not duplicate ${sourceLabel}: ${detail.message}${request}` : void 0;
373
+ }
245
374
  }
246
- function exactCatalogMatches(plugins, searchName) {
247
- const normalized = searchName.trim().toLowerCase();
248
- return plugins.filter(
249
- (plugin) => plugin.slug.toLowerCase() === normalized || plugin.name.toLowerCase() === normalized
250
- );
375
+
376
+ // src/cli/handlers/profile-duplicate.ts
377
+ function reportError(error, hints = []) {
378
+ process.exitCode = 1;
379
+ if (error instanceof ExtendsError && error.hint) {
380
+ ui.danger(error.message, { hints: [error.hint, ...hints] });
381
+ return;
382
+ }
383
+ if (error instanceof PluginForkError && error.code === "plugin_exists") {
384
+ ui.danger(error.message, { hints: [`${formatCommand(["profile", "duplicate", error.sourceName ?? "<source>"])} <name>`] });
385
+ return;
386
+ }
387
+ if (error instanceof ExtendsError || error instanceof PluginForkError || error instanceof PluginVersionError) {
388
+ ui.danger(error.message, hints.length > 0 ? { hints } : void 0);
389
+ return;
390
+ }
391
+ ui.danger(error instanceof Error ? error.message : String(error));
251
392
  }
252
- function dedupeCatalogPluginsByIdentity(plugins) {
253
- const byKey = /* @__PURE__ */ new Map();
254
- for (const plugin of plugins) {
255
- byKey.set(catalogPluginKey(plugin), plugin);
256
- }
257
- return [...byKey.values()];
258
- }
259
- function formatCatalogSelector(plugin, version) {
260
- const base = `${plugin.orgSlug}/${plugin.catalogSlug}/${plugin.slug}`;
261
- const resolvedVersion = version ?? plugin.latestVersion ?? void 0;
262
- return resolvedVersion ? `${base}@${resolvedVersion}` : base;
263
- }
264
- function formatCatalogPluginChoiceLabel(plugin) {
265
- const selector = formatCatalogSelector(plugin, plugin.latestVersion ?? void 0);
266
- const summary = plugin.summary?.trim() || plugin.name;
267
- return `${selector}: ${summary}`;
268
- }
269
- async function promptCatalogPluginAmbiguity(selector, candidates) {
270
- const selectedKey = await promptForChoice({
271
- message: `Multiple catalog plugins match "${selector}". Which one?`,
272
- choices: candidates.map((plugin) => ({
273
- name: formatCatalogPluginChoiceLabel(plugin),
274
- value: catalogPluginKey(plugin)
275
- }))
276
- });
277
- const match = candidates.find((plugin) => catalogPluginKey(plugin) === selectedKey);
278
- if (!match) {
279
- throw new PluginResolveError(`Plugin not found: ${selector}`);
393
+ function renderLocalDuplicate(result, format) {
394
+ const { plugin, upstream, linked_to, mode } = result;
395
+ if (format === "json") {
396
+ printJson({ name: plugin.name, version: plugin.version, mode, linked_to, upstream });
397
+ return;
280
398
  }
281
- return match;
399
+ if (mode === "inherit") {
400
+ ui.success(`Created ${ui.theme.accent(plugin.name)}, kept in sync with ${linked_to}`);
401
+ ui.hint(`Parent updates show up here. Hide an item: ${formatCommand(["plugin", "edit", plugin.name])} --hide skill:<name>`);
402
+ return;
403
+ }
404
+ ui.success(`Created ${ui.theme.accent(plugin.name)}, a separate copy of ${linked_to}`);
405
+ ui.hint(formatCommand(["plugin", "edit", plugin.name]));
282
406
  }
283
- async function pickCatalogPluginMatch(selector, matches, options) {
284
- const unique = dedupeCatalogPluginsByIdentity(matches);
285
- if (unique.length === 1) {
286
- const only = unique[0];
287
- if (!only) {
288
- throw new PluginResolveError(`Plugin not found: ${selector}`);
289
- }
290
- return only;
407
+ async function handleProfileDuplicateCommand(source, name, opts = {}) {
408
+ initializeSchema(getDb());
409
+ const format = parseOutputFormat(opts.format);
410
+ if (opts.copy && opts.inherit) {
411
+ process.exitCode = 1;
412
+ ui.danger("Choose one of --inherit (include as a resource of a new profile) or --copy (separate copy).");
413
+ return;
291
414
  }
292
- if (options.promptAmbiguity) {
293
- return options.promptAmbiguity({ selector, candidates: unique });
415
+ const mode = opts.copy ? "copy" : "inherit";
416
+ if (opts.to) {
417
+ try {
418
+ const outcome = await duplicateInCloud(source, {
419
+ ...name ? { name } : {},
420
+ mode,
421
+ to: opts.to,
422
+ ...opts.account ? { account: opts.account } : {}
423
+ });
424
+ if (outcome.kind === "local") {
425
+ if (format !== "json") ui.info("Cloud cannot duplicate profiles yet, so the copy was made in your Library.");
426
+ renderLocalDuplicate(outcome.result, format);
427
+ if (format !== "json") {
428
+ const [org, catalog] = opts.to.split("/");
429
+ ui.hint(`Publish it: ${formatCommand(["plugin", "publish", outcome.result.plugin.name, "--org", org ?? "", "--catalog", catalog || "default"])}`);
430
+ }
431
+ return;
432
+ }
433
+ const { response } = outcome;
434
+ const upstream = response.publishedVersion?.upstream;
435
+ if (format === "json") {
436
+ printJson({ selector: response.selector, version: response.version, mode: response.mode, upstream: upstream ?? null, cloud: true });
437
+ return;
438
+ }
439
+ const link = upstream?.ref ?? source;
440
+ ui.success(
441
+ response.mode === "copy" ? `Published ${ui.theme.accent(response.selector)} ${response.version}, a separate copy of ${link}` : `Published ${ui.theme.accent(response.selector)} ${response.version}, kept in sync with ${link}`
442
+ );
443
+ ui.hint(`Get it locally: ${formatCommand(["profile", "pull", response.selector])}`);
444
+ } catch (error) {
445
+ reportError(error);
446
+ }
447
+ return;
294
448
  }
295
- const canPrompt = shouldUseWizard({
296
- interactive: options.interactive ?? true,
297
- noInteractive: options.noInteractive,
298
- format: options.format ?? "human",
299
- missingRequiredArgs: false
300
- });
301
- if (!canPrompt) {
302
- throw new PluginAmbiguityError(selector, unique);
449
+ let result;
450
+ try {
451
+ result = duplicatePlugin(source, { ...name ? { name } : {}, mode });
452
+ } catch (error) {
453
+ reportError(error);
454
+ return;
303
455
  }
304
- return promptCatalogPluginAmbiguity(selector, unique);
456
+ renderLocalDuplicate(result, format);
305
457
  }
306
- async function resolveBareNameFromCatalog(selector, options = {}) {
307
- if (!isPublicCatalogEnabled()) {
308
- throw new PluginResolveError(
309
- `Plugin not found: ${selector}`,
310
- [
311
- "Enable catalog.publicCatalog in ~/.harnesstap/config.jsonc",
312
- "Or use a published selector: org/catalog/slug"
313
- ]
314
- );
458
+ function handleProfileDetachCommand(name, opts = {}) {
459
+ initializeSchema(getDb());
460
+ const format = parseOutputFormat(opts.format);
461
+ let result;
462
+ try {
463
+ result = detachPlugin(name);
464
+ } catch (error) {
465
+ reportError(error);
466
+ return;
315
467
  }
316
- const parsed = parsePluginSelector(selector);
317
- if (parsed.scope !== "local") {
318
- throw new PluginResolveError(`Plugin not found: ${selector}`);
468
+ const { plugin, materialized, hidden } = result;
469
+ if (format === "json") {
470
+ printJson({ name: plugin.name, upstream: plugin.upstream ?? null, materialized, hidden_cleared: hidden });
471
+ return;
319
472
  }
320
- const catalogResults = await listPluginsInScope(
321
- { q: parsed.name, limit: 100, sort: "name" },
322
- { account: options.account, baseUrl: options.baseUrl }
473
+ ui.success(
474
+ `Detached ${ui.theme.accent(plugin.name)}: ${materialized} inherited ${materialized === 1 ? "item is" : "items are"} now its own. Nothing was deleted.`
323
475
  );
324
- const matches = exactCatalogMatches(catalogResults, parsed.name);
325
- if (matches.length === 0) {
326
- throw new PluginResolveError(`Plugin not found: ${selector}`, [
327
- "ht plugin list --search <query> --remote-only",
328
- "ht plugin pull org/catalog/slug",
329
- "ht plugin list"
330
- ]);
476
+ if (hidden.length > 0) {
477
+ ui.info(`Hidden items no longer apply and stay out of the copy: ${hidden.join(", ")}`);
478
+ }
479
+ ui.hint(`Not applied yet. Run ${formatCommand(["profile", "use", plugin.name])} to apply it.`);
480
+ }
481
+ function handlePluginHideOptions(name, opts) {
482
+ const hide = opts.hide ?? [];
483
+ const unhide = opts.unhide ?? [];
484
+ if (hide.length === 0 && unhide.length === 0) return false;
485
+ initializeSchema(getDb());
486
+ const plugin = name ? getPlugin(name) : void 0;
487
+ if (!plugin) {
488
+ process.exitCode = 1;
489
+ ui.danger(name ? `Plugin not found: ${name}` : "Name the profile to edit.");
490
+ return true;
491
+ }
492
+ try {
493
+ const next = new Set(listPluginExcludes(plugin.id));
494
+ for (const entry of hide) next.add(entry.trim());
495
+ for (const entry of unhide) next.delete(entry.trim());
496
+ const entries = setPluginExcludes(plugin.id, [...next]);
497
+ if (parseOutputFormat(opts.format) === "json") {
498
+ printJson({ name: plugin.name, hidden: entries });
499
+ return true;
500
+ }
501
+ ui.success(
502
+ entries.length > 0 ? `${plugin.name} hides ${entries.join(", ")}` : `${plugin.name} shows every item from its parent`
503
+ );
504
+ } catch (error) {
505
+ reportError(error);
331
506
  }
332
- const match = await pickCatalogPluginMatch(selector, matches, options);
333
- return resolveRemotePluginSelector(
334
- formatCatalogSelector(match, parsed.version ?? match.latestVersion ?? void 0),
335
- {}
507
+ return true;
508
+ }
509
+ function registerProfileDuplicateCommands(profileCmd) {
510
+ profileCmd.command("duplicate").argument("<source>", "Profile or plugin to duplicate").argument("[name]", "Name for the new profile (default: <source>-copy)").option("--inherit", "Include as a resource of a new profile: it contains the parent and gets its updates; only your changes are stored (default)").option("--copy", "Separate copy: copy the items now; later parent changes do not apply").option("--to <org/catalog>", "Duplicate in Cloud and publish to this catalog (source must be in a catalog)").option("--account <name>", "Cloud account to use with --to").option("--format <mode>", "Output format: human or json", "human").description("Duplicate a profile, kept in sync with it or as a separate copy").action(
511
+ async (source, name, opts) => {
512
+ await handleProfileDuplicateCommand(source, name, opts);
513
+ }
336
514
  );
515
+ profileCmd.command("detach").argument("<name>", "Profile that keeps in sync with a parent").option("--format <mode>", "Output format: human or json", "human").description("Stop keeping a profile in sync: its current items become its own (Library only)").action((name, opts) => {
516
+ handleProfileDetachCommand(name, opts);
517
+ });
337
518
  }
338
519
 
339
520
  // src/cli/handlers/plugin-install.ts
@@ -364,6 +545,7 @@ async function handlePluginInstallCommand(selector, opts) {
364
545
  try {
365
546
  const installed = await installPluginFromCatalog(parsed, {
366
547
  as: opts.as,
548
+ ...opts.profile ? { profile: true } : {},
367
549
  account: opts.account,
368
550
  baseUrl: opts.baseUrl
369
551
  });
@@ -814,6 +996,52 @@ function assertAgentPluginsPublishable(files, opts) {
814
996
  return warnings;
815
997
  }
816
998
 
999
+ // src/services/plugin-publish-dependencies.ts
1000
+ function findUnpublishedDependencies(refs, resolve3 = resolvePluginSelector) {
1001
+ const unpublished = [];
1002
+ for (const ref of refs) {
1003
+ if (ref.embed_on_export || ref.source_kind !== "local") {
1004
+ continue;
1005
+ }
1006
+ const selector = ref.version_constraint && ref.version_constraint !== "*" ? `${ref.name}@${ref.version_constraint}` : ref.name;
1007
+ const local = resolve3(selector);
1008
+ if (local && (!local.org_slug || !local.catalog_slug)) {
1009
+ if (!unpublished.includes(ref.name)) {
1010
+ unpublished.push(ref.name);
1011
+ }
1012
+ }
1013
+ }
1014
+ return unpublished;
1015
+ }
1016
+ function unpublishedDependenciesMessage(pluginName, dependencies, opts) {
1017
+ const lead = `Cannot publish ${pluginName}: it depends on local plugins that are not in a catalog: ${dependencies.join(", ")}. Publish them first, or remove them`;
1018
+ if (opts?.cliHint === false) {
1019
+ return `${lead} from ${pluginName}.`;
1020
+ }
1021
+ const removeArgs = dependencies.flatMap((name) => ["--remove", `plugin:${name}`]);
1022
+ return `${lead} with ${formatCommand(["plugin", "edit", pluginName, ...removeArgs])}`;
1023
+ }
1024
+ var UnpublishedDependenciesError = class extends Error {
1025
+ code = "unpublished_dependencies";
1026
+ pluginName;
1027
+ dependencies;
1028
+ constructor(pluginName, dependencies) {
1029
+ super(unpublishedDependenciesMessage(pluginName, dependencies));
1030
+ this.name = "UnpublishedDependenciesError";
1031
+ this.pluginName = pluginName;
1032
+ this.dependencies = dependencies;
1033
+ }
1034
+ };
1035
+ function listUnpublishedDependencies(pluginId) {
1036
+ return findUnpublishedDependencies(listDependencies(pluginId));
1037
+ }
1038
+ function assertDependenciesPublished(plugin) {
1039
+ const unpublished = listUnpublishedDependencies(plugin.id);
1040
+ if (unpublished.length > 0) {
1041
+ throw new UnpublishedDependenciesError(plugin.name, unpublished);
1042
+ }
1043
+ }
1044
+
817
1045
  // src/services/plugin-publish.ts
818
1046
  async function createCloudClientForTarget(target, accountOverride) {
819
1047
  const accountName = accountOverride ?? target.account;
@@ -822,6 +1050,8 @@ async function createCloudClientForTarget(target, accountOverride) {
822
1050
  }
823
1051
  async function publishPluginToCatalogs(plugin, targets, opts) {
824
1052
  assertPluginsCleanForShare([plugin]);
1053
+ assertParentPublished(plugin);
1054
+ assertDependenciesPublished(plugin);
825
1055
  const warnings = [];
826
1056
  const packageFiles = buildApPackageFiles(plugin.id, {
827
1057
  warnings,
@@ -870,7 +1100,8 @@ async function publishPluginToCatalogs(plugin, targets, opts) {
870
1100
  };
871
1101
  }
872
1102
  } catch (error) {
873
- const message = error instanceof Error ? error.message : String(error);
1103
+ const raw = error instanceof Error ? error.message : String(error);
1104
+ const message = cloudPublishErrorMessage(plugin, error) ?? raw;
874
1105
  results.push({ target, ok: false, error: message });
875
1106
  }
876
1107
  }
@@ -969,6 +1200,8 @@ async function handlePluginPublishCommand(pluginName, catalogSelector, opts) {
969
1200
  }
970
1201
  try {
971
1202
  assertAuthored(plugin.id, "publish");
1203
+ assertParentPublished(plugin);
1204
+ assertDependenciesPublished(plugin);
972
1205
  if (opts.version) {
973
1206
  plugin = cutPluginVersion({ pluginId: plugin.id, newVersion: opts.version });
974
1207
  } else if (plugin.dirty) {
@@ -1024,9 +1257,24 @@ async function handlePluginPublishCommand(pluginName, catalogSelector, opts) {
1024
1257
  ui.danger(err.message);
1025
1258
  return;
1026
1259
  }
1260
+ if (err instanceof UpstreamUnpublishedError) {
1261
+ ui.danger(err.message, { hints: [formatCommand(["profile", "detach", err.pluginName])] });
1262
+ return;
1263
+ }
1027
1264
  ui.danger(err instanceof Error ? err.message : String(err));
1028
1265
  }
1029
1266
  }
1267
+ function publishBlockers(plugin) {
1268
+ try {
1269
+ assertParentPublished(plugin);
1270
+ return [];
1271
+ } catch (error) {
1272
+ if (error instanceof UpstreamUnpublishedError) {
1273
+ return [{ code: error.code, ref: error.ref, message: error.message }];
1274
+ }
1275
+ throw error;
1276
+ }
1277
+ }
1030
1278
  async function handlePluginPublishPlanCommand(pluginName, opts) {
1031
1279
  const db = getDb();
1032
1280
  initializeSchema(db);
@@ -1040,11 +1288,31 @@ async function handlePluginPublishPlanCommand(pluginName, opts) {
1040
1288
  assertAuthored(plugin.id, "publish");
1041
1289
  const targets = resolvePublishTargetsForPlugin(plugin.id);
1042
1290
  const plans = await planPluginPublish(plugin, targets, { account: opts.account });
1291
+ const blockers = publishBlockers(plugin);
1292
+ const unpublished = listUnpublishedDependencies(plugin.id);
1293
+ const blocker = unpublished.length > 0 ? unpublishedDependenciesMessage(plugin.name, unpublished) : void 0;
1294
+ if (blocker) {
1295
+ process.exitCode = 1;
1296
+ }
1043
1297
  const format = parseOutputFormat(opts.format);
1044
1298
  if (format === "json") {
1045
- printJson({ plugin: plugin.name, plans });
1299
+ const all = [
1300
+ ...blockers,
1301
+ ...blocker ? [{ code: "unpublished_dependencies", message: blocker, dependencies: unpublished }] : []
1302
+ ];
1303
+ printJson({
1304
+ plugin: plugin.name,
1305
+ ...all.length > 0 ? { blockers: all } : {},
1306
+ plans
1307
+ });
1046
1308
  return;
1047
1309
  }
1310
+ for (const blocker2 of blockers) {
1311
+ ui.danger(blocker2.message, { hints: [formatCommand(["profile", "detach", plugin.name])] });
1312
+ }
1313
+ if (blocker) {
1314
+ ui.danger(blocker);
1315
+ }
1048
1316
  for (const plan of plans) {
1049
1317
  const label = formatPublishedSelector({
1050
1318
  org: plan.target.org,
@@ -1139,6 +1407,7 @@ function renderPluginShow(plugin, selector, opts) {
1139
1407
  ["Description", plugin.description || "none"],
1140
1408
  ["Tags", plugin.tags.length > 0 ? plugin.tags.join(", ") : "none"],
1141
1409
  ["Origin", formatOriginLabel(plugin.origin, plugin.origin_locator)],
1410
+ ...upstreamShowRows(plugin),
1142
1411
  ...opts?.profileExtras ? [["Active", opts.profileExtras.active ? "yes" : "no"]] : [],
1143
1412
  ["Resources", `${resources.length} (${summarizeResourceTypes(resources) || "none"})`],
1144
1413
  [
@@ -1185,17 +1454,48 @@ function renderPluginShow(plugin, selector, opts) {
1185
1454
  function renderPluginShowForPlugin(plugin, opts) {
1186
1455
  return renderPluginShow(plugin, `${plugin.name}@${plugin.version}`, opts);
1187
1456
  }
1457
+ function upstreamShowRows(plugin) {
1458
+ if (!plugin.upstream) {
1459
+ return [];
1460
+ }
1461
+ if (plugin.upstream.kind === "fork") {
1462
+ return [["Forked from", formatUpstreamLabel(plugin.upstream)]];
1463
+ }
1464
+ const hidden = listPluginExcludes(plugin.id);
1465
+ let inherited;
1466
+ try {
1467
+ const count = listComposedItems(plugin.id).filter((item) => item.source === "parent").length;
1468
+ inherited = `${count} ${count === 1 ? "item" : "items"} from the parent`;
1469
+ } catch {
1470
+ inherited = "parent not installed";
1471
+ }
1472
+ return [
1473
+ ["Extends", formatUpstreamLabel(plugin.upstream)],
1474
+ ["Inherited", inherited],
1475
+ ...hidden.length > 0 ? [["Hidden", hidden.join(", ")]] : []
1476
+ ];
1477
+ }
1188
1478
 
1189
1479
  // src/cli/handlers/plugin-show-command.ts
1190
1480
  function handlePluginShowCommand(name, opts, profileExtras) {
1191
1481
  const db = getDb();
1192
1482
  initializeSchema(db);
1193
1483
  const format = parseOutputFormat(opts.format);
1194
- const plugin = getPlugin(name);
1484
+ let plugin;
1485
+ try {
1486
+ plugin = getPlugin(name) ?? findLocalPluginBySelector(name, { command: "ht plugin show" });
1487
+ } catch (error) {
1488
+ if (error instanceof LocalPluginSelectorError) {
1489
+ fail(error.message, { hints: error.hints });
1490
+ return;
1491
+ }
1492
+ throw error;
1493
+ }
1195
1494
  if (!plugin) {
1196
1495
  fail(CLI_ERRORS.pluginNotFound(name), { hint: CLI_HINTS.pluginList });
1197
1496
  return;
1198
1497
  }
1498
+ const exactMatch = plugin.name === name || plugin.id === name || name.startsWith(`${plugin.name}@`);
1199
1499
  trackPluginUsed({
1200
1500
  pluginSlug: plugin.name
1201
1501
  });
@@ -1213,6 +1513,7 @@ function handlePluginShowCommand(name, opts, profileExtras) {
1213
1513
  }));
1214
1514
  const dependencies = listPluginDependencies(plugin.id);
1215
1515
  const configuredPlugin = (() => {
1516
+ if (!exactMatch) return plugin;
1216
1517
  if (/^[0-9A-Z]{26}$/.test(name)) {
1217
1518
  return getPluginById(name);
1218
1519
  }
@@ -1232,6 +1533,8 @@ function handlePluginShowCommand(name, opts, profileExtras) {
1232
1533
  description: plugin.description,
1233
1534
  tags: plugin.tags,
1234
1535
  ...plugin.claude ? { claude: plugin.claude } : {},
1536
+ ...plugin.upstream ? { upstream: plugin.upstream } : {},
1537
+ ...plugin.upstream?.kind === "extends" ? { excludes: listPluginExcludes(plugin.id) } : {},
1235
1538
  created_at: plugin.created_at,
1236
1539
  updated_at: plugin.updated_at,
1237
1540
  resources,
@@ -1249,7 +1552,7 @@ function handlePluginShowCommand(name, opts, profileExtras) {
1249
1552
  });
1250
1553
  return;
1251
1554
  }
1252
- console.log(renderPluginShow(plugin, name, {
1555
+ console.log(renderPluginShow(plugin, exactMatch ? name : plugin.id, {
1253
1556
  showId: opts.showId,
1254
1557
  profileExtras
1255
1558
  }));
@@ -1622,13 +1925,13 @@ async function editCatalogPluginComposition(plugin, selection, opts) {
1622
1925
 
1623
1926
  // src/services/catalog-list-stream.ts
1624
1927
  var visibilityRank = { organization: 3, shared: 2, public: 1 };
1625
- function catalogPluginKey2(plugin) {
1928
+ function catalogPluginKey(plugin) {
1626
1929
  return `${plugin.orgSlug}/${plugin.catalogSlug}/${plugin.slug}`;
1627
1930
  }
1628
1931
  function dedupePagePlugins(plugins, seen) {
1629
1932
  const result = [];
1630
1933
  for (const plugin of plugins) {
1631
- const key = catalogPluginKey2(plugin);
1934
+ const key = catalogPluginKey(plugin);
1632
1935
  const existing = seen.get(key);
1633
1936
  if (!existing) {
1634
1937
  seen.set(key, plugin);
@@ -1750,7 +2053,7 @@ async function listCatalogPluginsFromSources(sources, opts) {
1750
2053
  switch (event.type) {
1751
2054
  case "chunk": {
1752
2055
  for (const plugin of event.chunk.plugins) {
1753
- const key = catalogPluginKey2(plugin);
2056
+ const key = catalogPluginKey(plugin);
1754
2057
  if (seen.has(key)) {
1755
2058
  continue;
1756
2059
  }
@@ -3003,9 +3306,8 @@ async function runPluginCreateFromSourceWizard(input) {
3003
3306
  }
3004
3307
 
3005
3308
  export {
3006
- isPluginUrl,
3007
- PluginResolveError,
3008
- PluginAmbiguityError,
3309
+ handlePluginHideOptions,
3310
+ registerProfileDuplicateCommands,
3009
3311
  handlePluginInstallCommand,
3010
3312
  handlePluginCatalogRegisterCommand,
3011
3313
  handlePluginCatalogUnregisterCommand,
@@ -3024,4 +3326,4 @@ export {
3024
3326
  createPluginFromSource,
3025
3327
  runPluginCreateFromSourceWizard
3026
3328
  };
3027
- //# sourceMappingURL=chunk-4ZQ2SCGY.js.map
3329
+ //# sourceMappingURL=chunk-FLYQEB6D.js.map