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
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/copy/plurals.ts
4
+ function formatCount(count, noun, plural = `${noun}s`) {
5
+ return `${count} ${count === 1 ? noun : plural}`;
6
+ }
7
+
8
+ // src/copy/cli.ts
9
+ var NATIVE_MODULE_MISMATCH_MESSAGE = "HarnessTap was installed under a different Node.js version. Run: npm rebuild -g harnesstap";
10
+ var SQLITE_MODULE_MISSING_MESSAGE = "HarnessTap could not load its SQLite module (better-sqlite3), which did not install for this Node.js. Reinstall on Node 22.12 or newer: npm install -g harnesstap. Or run it on Bun: bun x --bun harnesstap@latest";
11
+ function quoted(name) {
12
+ return `"${name}"`;
13
+ }
14
+ function marketplaceUnreachableHint() {
15
+ return "Check the URL, or sign in with ht github login if it's private.";
16
+ }
17
+ function installPinnedPluginsNeedsYes() {
18
+ return "Error: Pass --yes to install pinned plugins without a prompt.";
19
+ }
20
+ function installPinnedPluginsHint(profileName) {
21
+ if (profileName) {
22
+ return `Run ht profile use ${quoted(profileName)} --yes to install them.`;
23
+ }
24
+ return "Run ht profile use --yes to install them.";
25
+ }
26
+ function skippedHostPluginHook(hookName) {
27
+ return `Skipped hook ${hookName}. It only works when the plugin is installed as a host plugin.`;
28
+ }
29
+ function skippedDuplicateCommand(name) {
30
+ return `Skipped command ${quoted(name)}. A skill already uses that name.`;
31
+ }
32
+ function quoteName(name) {
33
+ return `"${name.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
34
+ }
35
+ function hintToken(value) {
36
+ if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {
37
+ return value;
38
+ }
39
+ return quoteName(value);
40
+ }
41
+ var CLI_HINTS = {
42
+ seeOptions: (commandPath) => commandPath.trim().length > 0 ? `Run ht ${commandPath.trim()} --help to see the options.` : "Run ht --help to see the options.",
43
+ pluginList: "Run ht plugin list to see your plugins.",
44
+ resourceList: "Run ht resource list to see your resources.",
45
+ profileUseExample: 'For example: ht profile use "global default"',
46
+ authLogin: "Run ht auth login to sign in.",
47
+ githubLogin: marketplaceUnreachableHint(),
48
+ onConflictReplace: "Use --on-conflict replace to replace it.",
49
+ unsavedChanges: "Run again with --changes save, stash or discard.",
50
+ updateNpm: "Update with: npm i -g harnesstap",
51
+ mcpSearch: (name) => `Run ht mcp search ${hintToken(name)} to find it.`,
52
+ scopeAdd: (name, harnesses) => `Run ht resource scope ${hintToken(name)} --add ${hintToken(harnesses)}.`,
53
+ portableMcpTip: (name, harnessList, command) => `Tip: ${quoteName(name)} also works on ${harnessList}. Run ${command}.`,
54
+ forceRemove: "To remove them too, run the command again with --force-remove.",
55
+ forceRemoveAlreadyUsed: "HarnessTap never removes these, even with --force-remove.",
56
+ revert: "Snapshot saved. Undo with: ht revert",
57
+ stashPop: "Bring them back with: ht profile stash pop",
58
+ harnessSet: "Run ht harness set to pick your harnesses.",
59
+ harnessSetOrFlag: "Run ht harness set, or pass --harness <slugs>."
60
+ };
61
+ var CLI_ERRORS = {
62
+ pluginNotFound: (name) => `No plugin named ${quoteName(name)}.`,
63
+ resourceNotFound: (name) => `No resource named ${quoteName(name)}.`,
64
+ invalidResourceType: (value, valid) => `${quoteName(value)} isn't a resource type. Valid: ${valid.join(", ")}.`,
65
+ conflictingResourceTypes: (a, b) => `Conflicting type filters: ${quoteName(a)} and ${quoteName(b)}.`,
66
+ pluginAlreadyExists: (name) => `A plugin named ${quoteName(name)} already exists.`,
67
+ environmentAlreadyExists: (name) => `An environment named ${quoteName(name)} already exists.`,
68
+ notAuthenticated: "Not authenticated to HarnessTap Cloud.",
69
+ directoryNotFound: (path) => `Directory not found: ${path}.`,
70
+ fileNotFound: (path) => `File not found: ${path}.`,
71
+ gitUnreachable: (url) => `Couldn't reach ${url}.`,
72
+ gitUnreachableGeneric: "Couldn't reach that git repository.",
73
+ uniqueConstraintGeneric: "That name already exists.",
74
+ missingProfileName: "Pass a profile name.",
75
+ noProfileNamed: (name) => `No profile named ${quoteName(name)}.`,
76
+ invalidPluginName: (name) => `${quoteName(name)} isn't a valid plugin name. Use a non-empty name without /, \\, .. or control characters.`,
77
+ emptyPluginName: "Pass a plugin name.",
78
+ invalidFormat: (value) => `Invalid --format value: ${value}. Use human or json.`,
79
+ mcpNotInLibrary: (name) => `${quoteName(name)} isn't in your library.`,
80
+ newerSchema: "This data was saved by a newer HarnessTap.",
81
+ noHarnesses: "Not set up for any harness yet.",
82
+ unsavedChanges: (name, count) => `${quoteName(name)} has ${count} unsaved change${count === 1 ? "" : "s"}.`,
83
+ resourceSyncFailed: (refs) => `Could not install ${[...new Set(refs)].join(", ")}.`,
84
+ resourceSyncStale: (count) => `${count} linked resource${count === 1 ? "" : "s"} ${count === 1 ? "is" : "are"} stale.`
85
+ };
86
+ function keptLinkOutsideRoot(path) {
87
+ return `Kept ${path}: it is your link to a file outside your home, and HarnessTap never writes through it.`;
88
+ }
89
+ function skippedRemovalOutsideRoot(path) {
90
+ return `Skipped removing ${path} (a folder above it links outside your home).`;
91
+ }
92
+
93
+ export {
94
+ formatCount,
95
+ NATIVE_MODULE_MISMATCH_MESSAGE,
96
+ SQLITE_MODULE_MISSING_MESSAGE,
97
+ installPinnedPluginsNeedsYes,
98
+ installPinnedPluginsHint,
99
+ skippedHostPluginHook,
100
+ skippedDuplicateCommand,
101
+ CLI_HINTS,
102
+ CLI_ERRORS,
103
+ keptLinkOutsideRoot,
104
+ skippedRemovalOutsideRoot
105
+ };
106
+ //# sourceMappingURL=chunk-UEA4NCY2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/copy/plurals.ts","../src/copy/cli.ts"],"sourcesContent":["/**\n * Shared count/plural helper for CLI and Desktop (W3-2).\n * Desktop can import this module or mirror `apps/desktop/src/lib/plurals.ts`.\n */\n\nexport function formatCount(count: number, noun: string, plural = `${noun}s`): string {\n return `${count} ${count === 1 ? noun : plural}`;\n}\n\nexport function pluralNoun(count: number, noun: string, plural = `${noun}s`): string {\n return count === 1 ? noun : plural;\n}\n","/**\n * User-facing CLI copy. ASCII punctuation only (DS-6).\n * Command hints always start with `ht`.\n */\n\nimport { pluralNoun } from \"./plurals.js\";\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/** better-sqlite3 is optional (#501): Bun uses bun:sqlite, so an install may skip it. */\nexport const SQLITE_MODULE_MISSING_MESSAGE =\n \"HarnessTap could not load its SQLite module (better-sqlite3), which did not install for this Node.js. Reinstall on Node 22.12 or newer: npm install -g harnesstap. Or run it on Bun: bun x --bun harnesstap@latest\";\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\n/** `ht` plus shell-quoted arguments. Names with spaces stay one token. */\nexport function formatHtArgs(args: readonly string[]): string {\n return [\"ht\", ...args.map(hintToken)].join(\" \");\n}\n\n/** Turn markdown links into terminal text. Relative targets keep the label only. */\nexport function plainTerminalText(value: string): string {\n return value.replace(\n /\\[([^\\]]+)\\]\\(([^)]+)\\)/g,\n (_match, label: string, target: string) => {\n if (target.startsWith(\"http://\") || target.startsWith(\"https://\")) {\n return `${label} (${target})`;\n }\n return label;\n },\n );\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 the command again with --force-remove.\",\n forceRemoveAlreadyUsed: \"HarnessTap never removes these, even with --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 resourceSyncFailed: (refs: readonly string[]): string =>\n `Could not install ${[...new Set(refs)].join(\", \")}.`,\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} 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 keptYouChanged: \"you changed it\",\n keptClaudeChanged: \"Claude Code changed it\",\n keptNotMade: \"not made by HarnessTap\",\n viewSnapshot: \"View snapshot\",\n keptFilesIntro: \"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\n/**\n * Hint after a cancelled apply. One file says \"it\"; two or more say \"them\".\n */\nexport function onConflictReplaceHint(conflicts: readonly string[]): string {\n const count = new Set(\n conflicts.map((path) => path.trim()).filter((path) => path.length > 0),\n ).size;\n if (count > 1) {\n return \"Use --on-conflict replace to replace them.\";\n }\n return CLI_HINTS.onConflictReplace;\n}\n\n/**\n * Human line for a cancelled apply. Names every conflicting path.\n * Pair with onConflictReplaceHint.\n */\nexport function applyCancelledMessage(\n conflicts: readonly string[],\n scope: \"profile\" | \"apply\" = \"apply\",\n): string {\n const paths = [\n ...new Set(\n conflicts.map((path) => path.trim()).filter((path) => path.length > 0),\n ),\n ];\n const lead = scope === \"profile\" ? \"Profile apply cancelled.\" : \"Apply cancelled.\";\n if (paths.length === 0) {\n return lead;\n }\n const listed = paths.map((path) => quoteCliArg(path)).join(\", \");\n if (paths.length === 1) {\n return `${lead} ${listed} would change.`;\n }\n return `${lead} These files would change: ${listed}.`;\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} ${pluralNoun(count, \"change\")} to ${quoteName(profileName)}.`;\n}\n\nexport function stashedChangesLine(count: number, popCommand: string): string {\n return `Stashed ${count} ${pluralNoun(count, \"change\")}. Bring ${count === 1 ? \"it\" : \"them\"} back with: ${popCommand}`;\n}\n\nexport function discardedChangesLine(count: number): string {\n return `Discarded ${count} ${pluralNoun(count, \"change\")}.`;\n}\n\nexport function discardConfirm(count: number): string {\n return `Discard ${count} ${pluralNoun(count, \"change\")}? 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 if (input.wrote === 0 && input.removed === 0 && input.kept === 0) {\n return input.unchanged !== undefined\n ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.`\n : CLI_COPY.everythingUpToDate;\n }\n if (input.wrote === 0 && input.removed === 0) {\n const line = `Wrote 0, removed 0, kept ${input.kept}`;\n if (!input.omitUnchanged && input.unchanged !== undefined && input.unchanged > 0) {\n return `${line}, unchanged ${input.unchanged}.`;\n }\n return `${line}.`;\n }\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.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 ? `${first.charAt(0).toUpperCase()}${first.slice(1)}` : \"\";\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} ${pluralNoun(count, \"change\")} 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} ${pluralNoun(count, \"file\")} ${CLI_COPY.keptFilesIntro}`;\n}\n\nexport function keptReportedBeforeLine(count: number): string {\n return `${count} more kept ${pluralNoun(count, \"file\")} in a plugin folder ${count === 1 ? \"was\" : \"were\"} listed by an earlier apply. \\`ht profile status\\` lists every kept file.`;\n}\n\nexport function keptLinkOutsideRoot(path: string): string {\n return `Kept ${path}: it is your link to a file outside your home, and HarnessTap never writes through it.`;\n}\n\nexport function skippedRemovalOutsideRoot(path: string): string {\n return `Skipped removing ${path} (a folder above it links outside your home).`;\n}\n\nexport function forceRemoveHintLine(count: number): string {\n return `To remove ${count === 1 ? \"it\" : \"them\"} too, run the command again with --force-remove.`;\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\n/** Claude Code's plugin store, which it rewrites on a marketplace refresh or plugin update. */\nfunction isClaudePluginStorePath(path: string): boolean {\n return path.replaceAll(\"\\\\\", \"/\").startsWith(\".claude/plugins/\");\n}\n\nexport function keptReasonLabel(reason: \"modified\" | \"unmanaged\", path?: string): string {\n switch (reason) {\n case \"modified\":\n return path && isClaudePluginStorePath(path) ? CLI_COPY.keptClaudeChanged : CLI_COPY.keptYouChanged;\n case \"unmanaged\":\n return CLI_COPY.keptNotMade;\n default: {\n const _exhaustive: never = reason;\n return _exhaustive;\n }\n }\n}\n"],"mappings":";;;AAKO,SAAS,YAAY,OAAe,MAAc,SAAS,GAAG,IAAI,KAAa;AACpF,SAAO,GAAG,KAAK,IAAI,UAAU,IAAI,OAAO,MAAM;AAChD;;;ACEO,IAAM,iCACX;AAGK,IAAM,gCACX;AAiBK,SAAS,OAAO,MAAsB;AAC3C,SAAO,IAAI,IAAI;AACjB;AAUO,SAAS,6BAAqC;AACnD,SAAO;AACT;AAsBO,SAAS,+BAAuC;AACrD,SAAO;AACT;AAEO,SAAS,yBAAyB,aAA8B;AACrE,MAAI,aAAa;AACf,WAAO,sBAAsB,OAAO,WAAW,CAAC;AAAA,EAClD;AACA,SAAO;AACT;AAMO,SAAS,sBAAsB,UAA0B;AAC9D,SAAO,gBAAgB,QAAQ;AACjC;AAEO,SAAS,wBAAwB,MAAsB;AAC5D,SAAO,mBAAmB,OAAO,IAAI,CAAC;AACxC;AAGO,SAAS,UAAU,MAAsB;AAC9C,SAAO,IAAI,KAAK,WAAW,MAAM,MAAM,EAAE,WAAW,KAAM,KAAM,CAAC;AACnE;AAEA,SAAS,UAAU,OAAuB;AACxC,MAAI,0BAA0B,KAAK,KAAK,GAAG;AACzC,WAAO;AAAA,EACT;AACA,SAAO,UAAU,KAAK;AACxB;AAmCO,IAAM,YAAY;AAAA,EACvB,YAAY,CAAC,gBACX,YAAY,KAAK,EAAE,SAAS,IACxB,UAAU,YAAY,KAAK,CAAC,gCAC5B;AAAA,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CAAC;AAAA,EAC7E,mBAAmB,CAAC,SAClB,GAAG,UAAU,IAAI,CAAC;AAAA,EACpB,iBAAiB;AAAA,EACjB,eAAe,CAAC,UAA0B,2BAA2B,KAAK;AAAA,EAC1E,iBAAiB,CAAC,SAAyB,GAAG,UAAU,IAAI,CAAC;AAAA,EAC7D,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB,CAAC,MAAc,UAC7B,GAAG,UAAU,IAAI,CAAC,QAAQ,KAAK,kBAAkB,UAAU,IAAI,KAAK,GAAG;AAAA,EACzE,oBAAoB,CAAC,SACnB,qBAAqB,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,EACpD,mBAAmB,CAAC,UAClB,GAAG,KAAK,mBAAmB,UAAU,IAAI,KAAK,GAAG,IAAI,UAAU,IAAI,OAAO,KAAK;AACnF;AA+LO,SAAS,oBAAoB,MAAsB;AACxD,SAAO,QAAQ,IAAI;AACrB;AAEO,SAAS,0BAA0B,MAAsB;AAC9D,SAAO,oBAAoB,IAAI;AACjC;","names":[]}
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ NATIVE_MODULE_MISMATCH_MESSAGE,
4
+ SQLITE_MODULE_MISSING_MESSAGE
5
+ } from "./chunk-UEA4NCY2.js";
6
+
7
+ // src/db/native-module.ts
8
+ function shouldShowNativeModuleDetails() {
9
+ if (process.env.HARNESSTAP_DEBUG === "1") {
10
+ return true;
11
+ }
12
+ return process.argv.includes("-v") || process.argv.includes("--verbose");
13
+ }
14
+ function isNativeModuleMismatch(error) {
15
+ if (!error || typeof error !== "object") {
16
+ return false;
17
+ }
18
+ const err = error;
19
+ const code = typeof err.code === "string" ? err.code : "";
20
+ const message = typeof err.message === "string" ? err.message : String(error);
21
+ if (code === "ERR_DLOPEN_FAILED") {
22
+ return true;
23
+ }
24
+ return message.includes("NODE_MODULE_VERSION") || message.includes("ERR_DLOPEN");
25
+ }
26
+ function reportNativeModuleMismatch(cause) {
27
+ if (shouldShowNativeModuleDetails() && cause !== void 0) {
28
+ console.error(cause);
29
+ }
30
+ console.error(NATIVE_MODULE_MISMATCH_MESSAGE);
31
+ process.exit(1);
32
+ }
33
+ function isSqliteModuleMissing(error) {
34
+ if (!error || typeof error !== "object") {
35
+ return false;
36
+ }
37
+ const err = error;
38
+ const message = typeof err.message === "string" ? err.message : "";
39
+ if (!message.includes("better-sqlite3") && !message.includes("better_sqlite3")) {
40
+ return false;
41
+ }
42
+ return err.code === "MODULE_NOT_FOUND" || err.code === "ERR_MODULE_NOT_FOUND" || message.includes("Could not locate the bindings file") || message.includes("Cannot find module");
43
+ }
44
+ function reportSqliteModuleMissing(cause) {
45
+ if (shouldShowNativeModuleDetails() && cause !== void 0) {
46
+ console.error(cause);
47
+ }
48
+ console.error(SQLITE_MODULE_MISSING_MESSAGE);
49
+ process.exit(1);
50
+ }
51
+ function withNativeModuleGuard(load) {
52
+ try {
53
+ return load();
54
+ } catch (error) {
55
+ if (isNativeModuleMismatch(error)) {
56
+ reportNativeModuleMismatch(error);
57
+ }
58
+ if (isSqliteModuleMissing(error)) {
59
+ reportSqliteModuleMissing(error);
60
+ }
61
+ throw error;
62
+ }
63
+ }
64
+
65
+ export {
66
+ isNativeModuleMismatch,
67
+ reportNativeModuleMismatch,
68
+ withNativeModuleGuard
69
+ };
70
+ //# sourceMappingURL=chunk-VAPCU2FX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/db/native-module.ts"],"sourcesContent":["import { NATIVE_MODULE_MISMATCH_MESSAGE, SQLITE_MODULE_MISSING_MESSAGE } from \"../copy/cli.js\";\n\nexport { NATIVE_MODULE_MISMATCH_MESSAGE, SQLITE_MODULE_MISSING_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/**\n * better-sqlite3 is an optional dependency (#501). An install where its\n * native build failed, or one with scripts off, leaves it missing.\n */\nexport function isSqliteModuleMissing(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const err = error as { code?: unknown; message?: unknown };\n const message = typeof err.message === \"string\" ? err.message : \"\";\n if (!message.includes(\"better-sqlite3\") && !message.includes(\"better_sqlite3\")) {\n return false;\n }\n return (\n err.code === \"MODULE_NOT_FOUND\"\n || err.code === \"ERR_MODULE_NOT_FOUND\"\n || message.includes(\"Could not locate the bindings file\")\n || message.includes(\"Cannot find module\")\n );\n}\n\nexport function reportSqliteModuleMissing(cause?: unknown): never {\n if (shouldShowNativeModuleDetails() && cause !== undefined) {\n console.error(cause);\n }\n console.error(SQLITE_MODULE_MISSING_MESSAGE);\n process.exit(1);\n}\n\n/** Run a native sqlite load; print a DS-6 one-liner on ABI mismatch or a missing module. */\nexport function withNativeModuleGuard<T>(load: () => T): T {\n try {\n return load();\n } catch (error) {\n if (isNativeModuleMismatch(error)) {\n reportNativeModuleMismatch(error);\n }\n if (isSqliteModuleMissing(error)) {\n reportSqliteModuleMissing(error);\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;AAIA,SAAS,gCAAyC;AAChD,MAAI,QAAQ,IAAI,qBAAqB,KAAK;AACxC,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,KAAK,SAAS,IAAI,KA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sBAAsB,KAAK,GAAG;AAChC,gCAA0B,KAAK;AAAA,IACjC;AACA,UAAM;AAAA,EACR;AACF;","names":[]}
@@ -1,10 +1,8 @@
1
1
  import {
2
+ DEVICE_LOGIN_WAITING,
2
3
  createProgress,
3
4
  isTty
4
- } from "./chunk-2A36HWDE.js";
5
- import {
6
- DEVICE_LOGIN_WAITING
7
- } from "./chunk-WG5A6EAU.js";
5
+ } from "./chunk-MTCCUYBZ.js";
8
6
 
9
7
  // src/services/device-login-prompt.ts
10
8
  function printDeviceLoginInstructions(input) {
@@ -29,4 +27,4 @@ function printDeviceLoginInstructions(input) {
29
27
  export {
30
28
  printDeviceLoginInstructions
31
29
  };
32
- //# sourceMappingURL=chunk-RVEXPMM3.js.map
30
+ //# sourceMappingURL=chunk-WEJVFNRO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/device-login-prompt.ts"],"sourcesContent":["import { DEVICE_LOGIN_WAITING } from \"../copy/cli.js\";\nimport { createProgress, type ProgressHandle } from \"../ui/progress.js\";\nimport { isTty } from \"../ui/theme.js\";\n\nexport { DEVICE_LOGIN_WAITING };\n\nexport function printDeviceLoginInstructions(input: {\n verificationUri: string;\n userCode: string;\n}): ProgressHandle {\n console.log(`Visit: ${input.verificationUri}`);\n console.log(`Code: ${input.userCode}`);\n if (isTty() && process.env.NODE_ENV !== \"test\") {\n return createProgress(DEVICE_LOGIN_WAITING);\n }\n console.log(DEVICE_LOGIN_WAITING);\n return {\n succeed() {},\n fail() {},\n stop() {},\n update() {},\n };\n}\n"],"mappings":";;;;;;;;;AAMO,SAAS,6BAA6B,OAG1B;AACjB,UAAQ,IAAI,UAAU,MAAM,eAAe,EAAE;AAC7C,UAAQ,IAAI,UAAU,MAAM,QAAQ,EAAE;AACtC,MAAI,MAAM,KAAK,QAAQ,IAAI,aAAa,QAAQ;AAC9C,WAAO,eAAe,oBAAoB;AAAA,EAC5C;AACA,UAAQ,IAAI,oBAAoB;AAChC,SAAO;AAAA,IACL,UAAU;AAAA,IAAC;AAAA,IACX,OAAO;AAAA,IAAC;AAAA,IACR,OAAO;AAAA,IAAC;AAAA,IACR,SAAS;AAAA,IAAC;AAAA,EACZ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/services/device-login-prompt.ts"],"sourcesContent":["import { DEVICE_LOGIN_WAITING } from \"../copy/cli.js\";\nimport { createProgress, type ProgressHandle } from \"../ui/progress.js\";\nimport { isTty } from \"../ui/theme.js\";\n\nexport { DEVICE_LOGIN_WAITING };\n\nexport function printDeviceLoginInstructions(input: {\n verificationUri: string;\n userCode: string;\n}): ProgressHandle {\n console.log(`Visit: ${input.verificationUri}`);\n console.log(`Code: ${input.userCode}`);\n if (isTty() && process.env.NODE_ENV !== \"test\") {\n return createProgress(DEVICE_LOGIN_WAITING);\n }\n console.log(DEVICE_LOGIN_WAITING);\n return {\n succeed() {},\n fail() {},\n stop() {},\n update() {},\n };\n}\n"],"mappings":";;;;;;;AAMO,SAAS,6BAA6B,OAG1B;AACjB,UAAQ,IAAI,UAAU,MAAM,eAAe,EAAE;AAC7C,UAAQ,IAAI,UAAU,MAAM,QAAQ,EAAE;AACtC,MAAI,MAAM,KAAK,QAAQ,IAAI,aAAa,QAAQ;AAC9C,WAAO,eAAe,oBAAoB;AAAA,EAC5C;AACA,UAAQ,IAAI,oBAAoB;AAChC,SAAO;AAAA,IACL,UAAU;AAAA,IAAC;AAAA,IACX,OAAO;AAAA,IAAC;AAAA,IACR,OAAO;AAAA,IAAC;AAAA,IACR,SAAS;AAAA,IAAC;AAAA,EACZ;AACF;","names":[]}
@@ -6,7 +6,7 @@ import { execFileSync } from "child_process";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "harnesstap",
9
- version: "1.4.0",
9
+ version: "1.6.1",
10
10
  description: "Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs",
11
11
  type: "module",
12
12
  packageManager: "bun@1.3.9",
@@ -46,25 +46,28 @@ var package_default = {
46
46
  unlink: "bun unlink",
47
47
  test: "bun test --timeout 30000",
48
48
  "test:run": "bun test --dots --timeout 30000",
49
- "test:core": "bun test --dots test/models test/db test/config test/utils test/telemetry test/scripts",
50
- "test:platforms": "bun test --dots test/platforms",
51
- "test:plugins": "bun test --dots test/plugins",
52
- "test:services": "bun test --dots test/services test/integration test/agent/init-apply-noop.test.ts",
53
- "test:cli": "bun test --dots test/cli test/ui test/helpers",
54
- "test:docs": "bun test --dots test/docs",
49
+ "test:core": "bun test --dots --timeout 30000 test/models test/db test/config test/utils test/telemetry test/scripts",
50
+ "test:platforms": "bun test --dots --timeout 30000 test/platforms",
51
+ "test:plugins": "bun test --dots --timeout 30000 test/plugins",
52
+ "test:services": "bun test --dots --timeout 30000 test/services test/integration",
53
+ "test:cli": "bun test --dots --timeout 30000 test/cli test/ui test/helpers",
54
+ "test:agent": "bun test --dots --timeout 30000 test/agent",
55
+ "test:desktop": "bun test --dots --timeout 30000 test/desktop",
56
+ "test:docs": "bun test --dots --timeout 30000 test/docs",
55
57
  lint: "biome lint .",
56
58
  "lint:fix": "biome lint --write --unsafe .",
57
59
  "lint:css": "bun scripts/check-css-tokens.ts",
58
60
  "check:cli-error-contract": "bun scripts/check-cli-error-contract.ts",
59
61
  "check:copy": "bun scripts/check-copy.ts",
60
- "check:agent-plugins-spec": "bun test test/services/agent-plugins/spec-schema-guard.test.ts test/services/agent-plugins/spec-mcp.test.ts test/services/agent-plugins/spec-load.test.ts",
62
+ "check:agent-plugins-spec": "bun test --timeout 30000 test/services/agent-plugins/spec-schema-guard.test.ts test/services/agent-plugins/spec-mcp.test.ts test/services/agent-plugins/spec-load.test.ts",
61
63
  typecheck: "tsc --noEmit",
62
64
  clean: "rm -rf dist && find . -maxdepth 1 -name '*.bun-build' -delete",
63
65
  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",
64
- prepublishOnly: "bun run build",
66
+ prepublishOnly: "HT_RELEASE=1 bun run build",
67
+ "check:release-version": "bash scripts/check-release-version.sh",
65
68
  "docs:vhs": "bash scripts/generate-vhs-scenarios.sh",
66
69
  "check:scenario-docs": "bash scripts/check-scenario-docs.sh",
67
- "check:scenario-smoke": "bun test test/cli/scenario-smoke.test.ts",
70
+ "check:scenario-smoke": "bun test --timeout 30000 test/cli/scenario-smoke.test.ts",
68
71
  "check:sqlite-wal-smoke": "bun scripts/sqlite-wal-write-smoke.ts",
69
72
  "sync:cloud-docs": "bash scripts/sync-cloud-cli-docs.sh"
70
73
  },
@@ -94,7 +97,6 @@ var package_default = {
94
97
  dependencies: {
95
98
  "@inquirer/core": "^10.3.2",
96
99
  "@inquirer/search": "^3.2.2",
97
- "better-sqlite3": "^12.11.1",
98
100
  chalk: "^5.4.1",
99
101
  "cli-table3": "^0.6.5",
100
102
  commander: "^13.1.0",
@@ -108,6 +110,9 @@ var package_default = {
108
110
  ulid: "^2.3.0",
109
111
  yaml: "^2.7.0"
110
112
  },
113
+ optionalDependencies: {
114
+ "better-sqlite3": "^12.11.1"
115
+ },
111
116
  devDependencies: {
112
117
  "@biomejs/biome": "^2.4.10",
113
118
  "@inquirer/testing": "^3.3.8",
@@ -170,8 +175,8 @@ function resolveBuildVersion(env = process.env) {
170
175
  });
171
176
  }
172
177
  function resolvePackageVersion() {
173
- if ("1.4.0-dev+9dcdc1f".length > 0) {
174
- return "1.4.0-dev+9dcdc1f";
178
+ if ("1.6.1".length > 0) {
179
+ return "1.6.1";
175
180
  }
176
181
  return resolveBuildVersion();
177
182
  }
@@ -184,4 +189,4 @@ export {
184
189
  resolveBuildVersion,
185
190
  PACKAGE_VERSION
186
191
  };
187
- //# sourceMappingURL=chunk-IMROMZ2K.js.map
192
+ //# sourceMappingURL=chunk-WWFVMCTR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts","../package.json"],"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.6.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 --timeout 30000 test/models test/db test/config test/utils test/telemetry test/scripts\",\n \"test:platforms\": \"bun test --dots --timeout 30000 test/platforms\",\n \"test:plugins\": \"bun test --dots --timeout 30000 test/plugins\",\n \"test:services\": \"bun test --dots --timeout 30000 test/services test/integration\",\n \"test:cli\": \"bun test --dots --timeout 30000 test/cli test/ui test/helpers\",\n \"test:agent\": \"bun test --dots --timeout 30000 test/agent\",\n \"test:desktop\": \"bun test --dots --timeout 30000 test/desktop\",\n \"test:docs\": \"bun test --dots --timeout 30000 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 \"check:agent-plugins-spec\": \"bun test --timeout 30000 test/services/agent-plugins/spec-schema-guard.test.ts test/services/agent-plugins/spec-mcp.test.ts test/services/agent-plugins/spec-load.test.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\": \"HT_RELEASE=1 bun run build\",\n \"check:release-version\": \"bash scripts/check-release-version.sh\",\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 --timeout 30000 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 \"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 \"optionalDependencies\": {\n \"better-sqlite3\": \"^12.11.1\"\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 \"ajv\": \"^8.20.0\",\n \"happy-dom\": \"17.4.4\",\n \"tsup\": \"^8.3.5\",\n \"typescript\": \"^5.7.0\"\n }\n}\n"],"mappings":";;;AAAA,SAAS,oBAAoB;;;ACA7B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MAAQ;AAAA,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AAa,MAAM,GAAG;AAAA,MACrD;AAAA,MACA,UAAU;AAAA,MACV,OAAO,CAAC,UAAU,QAAQ,QAAQ;AAAA,IACpC,CAAC,EAAE,KAAK;AACR,WAAO,cAAc,GAAG;AAAA,EAC1B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,SAAS,sBACd,SACA,UAAkC,CAAC,GAC3B;AACR,QAAM,UAAU,QAAQ,KAAK;AAC7B,MAAI,QAAQ,WAAW;AACrB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,SAAS,OAAO,GAAG;AAC7B,WAAO;AAAA,EACT;AACA,QAAM,MAAM,cAAc,QAAQ,MAAM;AACxC,MAAI,CAAC,KAAK;AACR,WAAO,GAAG,OAAO;AAAA,EACnB;AACA,SAAO,GAAG,OAAO,QAAQ,GAAG;AAC9B;AAGO,SAAS,oBAAoB,MAAyB,QAAQ,KAAa;AAChF,SAAO,sBAAsB,gBAAY,SAAS;AAAA,IAChD,WAAW,eAAe,GAAG;AAAA,IAC7B,QAAQ,WAAW,GAAG;AAAA,EACxB,CAAC;AACH;AAEA,SAAS,wBAAgC;AAGvC,MAA0C,QAAe,SAAS,GAAG;AACnE,WAAO;AAAA,EACT;AACA,SAAO,oBAAoB;AAC7B;AAEO,IAAM,kBAA0B,sBAAsB;","names":[]}
@@ -0,0 +1,102 @@
1
+ import {
2
+ parseOutputFormat,
3
+ printJson
4
+ } from "./chunk-4E3G4H5B.js";
5
+ import {
6
+ isPromptCancellationError,
7
+ promptForChoice
8
+ } from "./chunk-LGWFLVZQ.js";
9
+ import {
10
+ isUpdateFrequency,
11
+ isUpdateMode,
12
+ loadUpdateSettings,
13
+ saveUpdateSettings
14
+ } from "./chunk-CWXCZBJR.js";
15
+ import {
16
+ getHarnesstapDir,
17
+ ui
18
+ } from "./chunk-MTCCUYBZ.js";
19
+
20
+ // src/cli/handlers/plugin-auto-update.ts
21
+ function describeUpdateSettings(settings) {
22
+ if (settings.mode === "off") return "Plugin updates: off (no background checks).";
23
+ const what = settings.mode === "install" ? "install minor and patch versions in range automatically, never a major" : "notify only";
24
+ return `Plugin updates: ${what}, checked ${settings.frequency}.`;
25
+ }
26
+ async function handlePluginAutoUpdateCommand(opts) {
27
+ const format = parseOutputFormat(opts.format);
28
+ const patch = {};
29
+ if (opts.mode !== void 0) {
30
+ if (!isUpdateMode(opts.mode)) {
31
+ process.exitCode = 1;
32
+ ui.danger("--mode must be off, notify or install");
33
+ return;
34
+ }
35
+ patch.mode = opts.mode;
36
+ }
37
+ if (opts.frequency !== void 0) {
38
+ if (!isUpdateFrequency(opts.frequency)) {
39
+ process.exitCode = 1;
40
+ ui.danger("--frequency must be hourly, daily or weekly");
41
+ return;
42
+ }
43
+ patch.frequency = opts.frequency;
44
+ }
45
+ const dir = getHarnesstapDir();
46
+ const changed = Object.keys(patch).length > 0;
47
+ const settings = changed ? saveUpdateSettings(dir, { ...patch, prompted: true }) : loadUpdateSettings(dir);
48
+ if (format === "json") {
49
+ printJson(settings);
50
+ return;
51
+ }
52
+ if (changed) ui.success("Saved.");
53
+ ui.info(describeUpdateSettings(settings));
54
+ }
55
+ function canPromptInteractively() {
56
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY) && !process.argv.includes("--no-interactive") && process.env.HARNESSTAP_NO_INTERACTIVE !== "1";
57
+ }
58
+ async function maybePromptKeepUpToDate(deps = {
59
+ interactive: canPromptInteractively(),
60
+ choose: promptForChoice,
61
+ harnesstapDir: getHarnesstapDir()
62
+ }) {
63
+ if (!deps.interactive) return null;
64
+ const current = loadUpdateSettings(deps.harnesstapDir);
65
+ if (current.prompted) return null;
66
+ try {
67
+ const mode = await deps.choose({
68
+ message: "Keep plugins up to date?",
69
+ default: current.mode,
70
+ choices: [
71
+ { name: "Notify only (default)", value: "notify" },
72
+ { name: "Install automatically (minor and patch updates install on their own, majors always ask)", value: "install" },
73
+ { name: "Off (never check; synced profiles still follow their parent)", value: "off" }
74
+ ]
75
+ });
76
+ let frequency = current.frequency;
77
+ if (mode !== "off") {
78
+ frequency = await deps.choose({
79
+ message: "How often should HarnessTap check?",
80
+ default: current.frequency,
81
+ choices: [
82
+ { name: "Daily (default)", value: "daily" },
83
+ { name: "Hourly", value: "hourly" },
84
+ { name: "Weekly", value: "weekly" }
85
+ ]
86
+ });
87
+ }
88
+ const saved = saveUpdateSettings(deps.harnesstapDir, { mode, frequency, prompted: true });
89
+ ui.info(`${describeUpdateSettings(saved)} Change it with ht plugin auto-update or in Desktop Settings.`);
90
+ return saved;
91
+ } catch (error) {
92
+ if (!isPromptCancellationError(error)) throw error;
93
+ return saveUpdateSettings(deps.harnesstapDir, { prompted: true });
94
+ }
95
+ }
96
+
97
+ export {
98
+ handlePluginAutoUpdateCommand,
99
+ canPromptInteractively,
100
+ maybePromptKeepUpToDate
101
+ };
102
+ //# sourceMappingURL=chunk-XPONNOBR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/handlers/plugin-auto-update.ts"],"sourcesContent":["import {\n isUpdateFrequency,\n isUpdateMode,\n loadUpdateSettings,\n saveUpdateSettings,\n type UpdateFrequency,\n type UpdateMode,\n type UpdateSettings,\n} from \"../../config/settings.js\";\nimport { getHarnesstapDir } from \"../../db/connection.js\";\nimport {\n isPromptCancellationError,\n promptForChoice,\n} from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\n\nexport const MODE_LABELS: Record<UpdateMode, string> = {\n off: \"Off\",\n notify: \"Notify only\",\n install: \"Install automatically\",\n};\n\nexport function describeUpdateSettings(settings: UpdateSettings): string {\n if (settings.mode === \"off\") return \"Plugin updates: off (no background checks).\";\n const what = settings.mode === \"install\"\n ? \"install minor and patch versions in range automatically, never a major\"\n : \"notify only\";\n return `Plugin updates: ${what}, checked ${settings.frequency}.`;\n}\n\n/** `ht plugin auto-update [--mode] [--frequency]`: show or change the updates settings. */\nexport async function handlePluginAutoUpdateCommand(opts: {\n mode?: string;\n frequency?: string;\n format?: string;\n}): Promise<void> {\n const format = parseOutputFormat(opts.format);\n const patch: Partial<UpdateSettings> = {};\n if (opts.mode !== undefined) {\n if (!isUpdateMode(opts.mode)) {\n process.exitCode = 1;\n ui.danger(\"--mode must be off, notify or install\");\n return;\n }\n patch.mode = opts.mode;\n }\n if (opts.frequency !== undefined) {\n if (!isUpdateFrequency(opts.frequency)) {\n process.exitCode = 1;\n ui.danger(\"--frequency must be hourly, daily or weekly\");\n return;\n }\n patch.frequency = opts.frequency;\n }\n const dir = getHarnesstapDir();\n const changed = Object.keys(patch).length > 0;\n const settings = changed ? saveUpdateSettings(dir, { ...patch, prompted: true }) : loadUpdateSettings(dir);\n if (format === \"json\") {\n printJson(settings);\n return;\n }\n if (changed) ui.success(\"Saved.\");\n ui.info(describeUpdateSettings(settings));\n}\n\nexport interface KeepUpToDatePromptDeps {\n interactive: boolean;\n choose: <T extends string>(input: {\n message: string;\n choices: Array<{ name: string; value: T }>;\n default?: T;\n }) => Promise<T>;\n harnesstapDir: string;\n}\n\nexport function canPromptInteractively(): boolean {\n return Boolean(process.stdin.isTTY && process.stdout.isTTY)\n && !process.argv.includes(\"--no-interactive\")\n && process.env.HARNESSTAP_NO_INTERACTIVE !== \"1\";\n}\n\n/**\n * After the first successful `ht plugin update --all`, ask once. Only in an\n * interactive terminal; a cancelled prompt also counts as asked.\n */\nexport async function maybePromptKeepUpToDate(\n deps: KeepUpToDatePromptDeps = {\n interactive: canPromptInteractively(),\n choose: promptForChoice,\n harnesstapDir: getHarnesstapDir(),\n },\n): Promise<UpdateSettings | null> {\n if (!deps.interactive) return null;\n const current = loadUpdateSettings(deps.harnesstapDir);\n if (current.prompted) return null;\n try {\n const mode = await deps.choose<UpdateMode>({\n message: \"Keep plugins up to date?\",\n default: current.mode,\n choices: [\n { name: \"Notify only (default)\", value: \"notify\" },\n { name: \"Install automatically (minor and patch updates install on their own, majors always ask)\", value: \"install\" },\n { name: \"Off (never check; synced profiles still follow their parent)\", value: \"off\" },\n ],\n });\n let frequency: UpdateFrequency = current.frequency;\n if (mode !== \"off\") {\n frequency = await deps.choose<UpdateFrequency>({\n message: \"How often should HarnessTap check?\",\n default: current.frequency,\n choices: [\n { name: \"Daily (default)\", value: \"daily\" },\n { name: \"Hourly\", value: \"hourly\" },\n { name: \"Weekly\", value: \"weekly\" },\n ],\n });\n }\n const saved = saveUpdateSettings(deps.harnesstapDir, { mode, frequency, prompted: true });\n ui.info(`${describeUpdateSettings(saved)} Change it with ht plugin auto-update or in Desktop Settings.`);\n return saved;\n } catch (error) {\n if (!isPromptCancellationError(error)) throw error;\n return saveUpdateSettings(deps.harnesstapDir, { prompted: true });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBO,SAAS,uBAAuB,UAAkC;AACvE,MAAI,SAAS,SAAS,MAAO,QAAO;AACpC,QAAM,OAAO,SAAS,SAAS,YAC3B,2EACA;AACJ,SAAO,mBAAmB,IAAI,aAAa,SAAS,SAAS;AAC/D;AAGA,eAAsB,8BAA8B,MAIlC;AAChB,QAAM,SAAS,kBAAkB,KAAK,MAAM;AAC5C,QAAM,QAAiC,CAAC;AACxC,MAAI,KAAK,SAAS,QAAW;AAC3B,QAAI,CAAC,aAAa,KAAK,IAAI,GAAG;AAC5B,cAAQ,WAAW;AACnB,SAAG,OAAO,uCAAuC;AACjD;AAAA,IACF;AACA,UAAM,OAAO,KAAK;AAAA,EACpB;AACA,MAAI,KAAK,cAAc,QAAW;AAChC,QAAI,CAAC,kBAAkB,KAAK,SAAS,GAAG;AACtC,cAAQ,WAAW;AACnB,SAAG,OAAO,6CAA6C;AACvD;AAAA,IACF;AACA,UAAM,YAAY,KAAK;AAAA,EACzB;AACA,QAAM,MAAM,iBAAiB;AAC7B,QAAM,UAAU,OAAO,KAAK,KAAK,EAAE,SAAS;AAC5C,QAAM,WAAW,UAAU,mBAAmB,KAAK,EAAE,GAAG,OAAO,UAAU,KAAK,CAAC,IAAI,mBAAmB,GAAG;AACzG,MAAI,WAAW,Q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AAS,OAAO;AACd,QAAI,CAAC,0BAA0B,KAAK,EAAG,OAAM;AAC7C,WAAO,mBAAmB,KAAK,eAAe,EAAE,UAAU,KAAK,CAAC;AAAA,EAClE;AACF;","names":[]}
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  listResourceTrackedDirectories
3
- } from "./chunk-GRASK6M6.js";
3
+ } from "./chunk-ZREU2UHM.js";
4
+ import {
5
+ listProjects
6
+ } from "./chunk-26QGX47N.js";
4
7
  import {
5
- listProjects,
6
8
  resolveHomeRoot
7
- } from "./chunk-DF4Z7LAD.js";
9
+ } from "./chunk-LGWFLVZQ.js";
8
10
  import {
9
11
  getHarnesstapDir
10
- } from "./chunk-WG5A6EAU.js";
12
+ } from "./chunk-MTCCUYBZ.js";
11
13
 
12
14
  // src/services/open-path.ts
13
15
  import { spawn } from "child_process";
@@ -112,4 +114,4 @@ export {
112
114
  openPathInSystemEditor,
113
115
  resolveOpenableFilesystemPath
114
116
  };
115
- //# sourceMappingURL=chunk-N3VGY3T3.js.map
117
+ //# sourceMappingURL=chunk-Y3HJ2F2W.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/open-path.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { listProjects } from \"../models/project.js\";\nimport { listResourceTrackedDirectories } from \"./resource-tracked-directories.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\n/** Start a file-manager opener and return. Do not wait for Finder, Explorer, or xdg-open. */\nfunction runOpener(command: string, args: string[], filePath: string): void {\n const child = spawn(command, args, {\n stdio: \"ignore\",\n detached: true,\n windowsHide: true,\n });\n child.on(\"error\", (error) => {\n console.error(`[ht-agent] failed to open ${filePath}: ${error.message}`);\n });\n child.unref();\n}\n\nexport function openPathInSystemEditor(filePath: string): void {\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"cmd\", [\"/c\", \"start\", \"\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [filePath], filePath);\n}\n\n/** Reveal a file in Finder / Explorer, or open a directory in the file manager. */\nexport function revealPathInFileManager(filePath: string): void {\n let isDirectory = false;\n try {\n isDirectory = statSync(filePath).isDirectory();\n } catch {\n isDirectory = false;\n }\n if (isDirectory) {\n openPathInSystemEditor(filePath);\n return;\n }\n\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [\"-R\", filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"explorer\", [\"/select,\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [dirname(filePath)], filePath);\n}\n\nexport function expandUserPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (trimmed.startsWith(\"~/\")) {\n return join(resolveHomeRoot(), trimmed.slice(2));\n }\n if (trimmed === \"~\") {\n return resolveHomeRoot();\n }\n return resolve(trimmed);\n}\n\nfunction realExistingPath(path: string): string | null {\n if (!existsSync(path)) {\n return null;\n }\n try {\n return realpathSync(path);\n } catch {\n return null;\n }\n}\n\nfunction isNestedOrEqual(root: string, target: string): boolean {\n if (target === root) {\n return true;\n }\n const rel = relative(root, target);\n return rel !== \"\" && rel !== \"..\" && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);\n}\n\nfunction collectAllowedOpenRoots(): string[] {\n const candidates = [\n getHarnesstapDir(),\n resolveHomeRoot(),\n ...listProjects().map((project) => project.local_path),\n ...listResourceTrackedDirectories().map((entry) => entry.path),\n ];\n const roots: string[] = [];\n for (const candidate of candidates) {\n const real = realExistingPath(candidate);\n if (real) {\n roots.push(real);\n }\n }\n return roots;\n}\n\nexport function isPathUnderAllowedOpenRoots(realPath: string): boolean {\n return collectAllowedOpenRoots().some((root) => isNestedOrEqual(root, realPath));\n}\n\nexport function resolveOpenableFilesystemPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (!trimmed) {\n throw new Error(\"Path is required\");\n }\n\n const expanded = expandUserPath(trimmed);\n const real = realExistingPath(expanded);\n if (!real) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\n }\n\n let isFileOrDirectory = false;\n try {\n const stat = statSync(real);\n isFileOrDirectory = stat.isFile() || stat.isDirectory();\n } catch {\n isFileOrDirectory = false;\n }\n if (!isFileOrDirectory) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\n }\n\n if (!isPathUnderAllowedOpenRoots(real)) {\n throw new Error(`Path is outside allowed roots: ${real}`);\n }\n\n return real;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,YAAY,cAAc,gBAAgB;AACnD,SAAS,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;AAOlE,SAAS,UAAU,SAAiB,MAAgB,UAAwB;AAC1E,QAAM,QAAQ,MAAM,SAAS,MAAM;AAAA,IACjC,OAAO;AAAA,IACP,UAAU;AAAA,IACV,aAAa;AAAA,EACf,CAAC;AACD,QAAM,GAAG,SAAS,CAAC,UAAU;AAC3B,YAAQ,MAAM,6BAA6B,QAAQ,KAAK,MAAM,OAAO,EAAE;AAAA,EACzE,CAAC;AACD,QAAM,MAAM;AACd;AAEO,SAAS,uBAAuB,UAAwB;AAC7D,QAAM,WAAW,QAAQ;AACzB,MAAI,aAAa,UAAU;AACzB,cAAU,QAAQ,CAAC,QAAQ,GAAG,QAAQ;AACtC;AAAA,EACF;AACA,MAAI,aAAa,SAAS;AACxB,cAAU,OAAO,CAAC,MAAM,SAAS,IAAI,QAAQ,GAAG,QAAQ;AACxD;AAAA,EACF;AACA,YAAU,YAAY,CAAC,QAAQ,GAAG,QAAQ;AAC5C;AA2BO,SAAS,eAAe,WAA2B;AACxD,QAAM,UAAU,UAAU,KAAK;AAC/B,MAAI,QAAQ,WAAW,IAAI,GAAG;AAC5B,WAAO,KAAK,gBAAgB,GAAG,QAAQ,MAAM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AAS,EAAE;AAAA,EAC3E;AAEA,MAAI,oBAAoB;AACxB,MAAI;AACF,UAAM,OAAO,SAAS,IAAI;AAC1B,wBAAoB,KAAK,OAAO,KAAK,KAAK,YAAY;AAAA,EACxD,QAAQ;AACN,wBAAoB;AAAA,EACtB;AACA,MAAI,CAAC,mBAAmB;AACtB,UAAM,IAAI,MAAM,8CAA8C,SAAS,EAAE;AAAA,EAC3E;AAEA,MAAI,CAAC,4BAA4B,IAAI,GAAG;AACtC,UAAM,IAAI,MAAM,kCAAkC,IAAI,EAAE;AAAA,EAC1D;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/services/open-path.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync, realpathSync, statSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { listProjects } from \"../models/project.js\";\nimport { listResourceTrackedDirectories } from \"./resource-tracked-directories.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\n/** Start a file-manager opener and return. Do not wait for Finder, Explorer, or xdg-open. */\nfunction runOpener(command: string, args: string[], filePath: string): void {\n const child = spawn(command, args, {\n stdio: \"ignore\",\n detached: true,\n windowsHide: true,\n });\n child.on(\"error\", (error) => {\n console.error(`[ht-agent] failed to open ${filePath}: ${error.message}`);\n });\n child.unref();\n}\n\nexport function openPathInSystemEditor(filePath: string): void {\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"cmd\", [\"/c\", \"start\", \"\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [filePath], filePath);\n}\n\n/** Reveal a file in Finder / Explorer, or open a directory in the file manager. */\nexport function revealPathInFileManager(filePath: string): void {\n let isDirectory = false;\n try {\n isDirectory = statSync(filePath).isDirectory();\n } catch {\n isDirectory = false;\n }\n if (isDirectory) {\n openPathInSystemEditor(filePath);\n return;\n }\n\n const platform = process.platform;\n if (platform === \"darwin\") {\n runOpener(\"open\", [\"-R\", filePath], filePath);\n return;\n }\n if (platform === \"win32\") {\n runOpener(\"explorer\", [\"/select,\", filePath], filePath);\n return;\n }\n runOpener(\"xdg-open\", [dirname(filePath)], filePath);\n}\n\nexport function expandUserPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (trimmed.startsWith(\"~/\")) {\n return join(resolveHomeRoot(), trimmed.slice(2));\n }\n if (trimmed === \"~\") {\n return resolveHomeRoot();\n }\n return resolve(trimmed);\n}\n\nfunction realExistingPath(path: string): string | null {\n if (!existsSync(path)) {\n return null;\n }\n try {\n return realpathSync(path);\n } catch {\n return null;\n }\n}\n\nfunction isNestedOrEqual(root: string, target: string): boolean {\n if (target === root) {\n return true;\n }\n const rel = relative(root, target);\n return rel !== \"\" && rel !== \"..\" && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);\n}\n\nfunction collectAllowedOpenRoots(): string[] {\n const candidates = [\n getHarnesstapDir(),\n resolveHomeRoot(),\n ...listProjects().map((project) => project.local_path),\n ...listResourceTrackedDirectories().map((entry) => entry.path),\n ];\n const roots: string[] = [];\n for (const candidate of candidates) {\n const real = realExistingPath(candidate);\n if (real) {\n roots.push(real);\n }\n }\n return roots;\n}\n\nexport function isPathUnderAllowedOpenRoots(realPath: string): boolean {\n return collectAllowedOpenRoots().some((root) => isNestedOrEqual(root, realPath));\n}\n\nexport function resolveOpenableFilesystemPath(candidate: string): string {\n const trimmed = candidate.trim();\n if (!trimmed) {\n throw new Error(\"Path is required\");\n }\n\n const expanded = expandUserPath(trimmed);\n const real = realExistingPath(expanded);\n if (!real) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\n }\n\n let isFileOrDirectory = false;\n try {\n const stat = statSync(real);\n isFileOrDirectory = stat.isFile() || stat.isDirectory();\n } catch {\n isFileOrDirectory = false;\n }\n if (!isFileOrDirectory) {\n throw new Error(`Path is not an openable file or directory: ${candidate}`);\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