harnesstap 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/README.md +28 -15
  2. package/dist/apply-QSS4242W.js +67 -0
  3. package/dist/apply-QSS4242W.js.map +1 -0
  4. package/dist/approve-CNYQY6DC.js +181 -0
  5. package/dist/approve-CNYQY6DC.js.map +1 -0
  6. package/dist/audit-V4SUV7KA.js +434 -0
  7. package/dist/audit-V4SUV7KA.js.map +1 -0
  8. package/dist/auth-63FOHIQ3.js +220 -0
  9. package/dist/auth-63FOHIQ3.js.map +1 -0
  10. package/dist/bin.js +166 -0
  11. package/dist/bin.js.map +1 -0
  12. package/dist/chunk-2H7UOFLK.js +11 -0
  13. package/dist/chunk-2H7UOFLK.js.map +1 -0
  14. package/dist/chunk-2NE3QYMP.js +103 -0
  15. package/dist/chunk-2NE3QYMP.js.map +1 -0
  16. package/dist/chunk-2P2EOYEW.js +1140 -0
  17. package/dist/chunk-2P2EOYEW.js.map +1 -0
  18. package/dist/chunk-37E5M4JX.js +34 -0
  19. package/dist/chunk-37E5M4JX.js.map +1 -0
  20. package/dist/chunk-37LQQWMF.js +496 -0
  21. package/dist/chunk-37LQQWMF.js.map +1 -0
  22. package/dist/chunk-3FIWOI3H.js +98 -0
  23. package/dist/chunk-3FIWOI3H.js.map +1 -0
  24. package/dist/chunk-3PGC6OA3.js +540 -0
  25. package/dist/chunk-3PGC6OA3.js.map +1 -0
  26. package/dist/chunk-4IHKBIY3.js +118 -0
  27. package/dist/chunk-4IHKBIY3.js.map +1 -0
  28. package/dist/chunk-4ZUBRLSP.js +17 -0
  29. package/dist/chunk-4ZUBRLSP.js.map +1 -0
  30. package/dist/chunk-5F3LNDZG.js +9 -0
  31. package/dist/chunk-5F3LNDZG.js.map +1 -0
  32. package/dist/chunk-5TXI6BI2.js +1359 -0
  33. package/dist/chunk-5TXI6BI2.js.map +1 -0
  34. package/dist/chunk-6P5IO4BX.js +235 -0
  35. package/dist/chunk-6P5IO4BX.js.map +1 -0
  36. package/dist/chunk-ABXUKHAU.js +571 -0
  37. package/dist/chunk-ABXUKHAU.js.map +1 -0
  38. package/dist/chunk-AOUDSNRK.js +1357 -0
  39. package/dist/chunk-AOUDSNRK.js.map +1 -0
  40. package/dist/chunk-BNDJJAEI.js +311 -0
  41. package/dist/chunk-BNDJJAEI.js.map +1 -0
  42. package/dist/chunk-C2IWSFF5.js +818 -0
  43. package/dist/chunk-C2IWSFF5.js.map +1 -0
  44. package/dist/chunk-CHQGE2HF.js +283 -0
  45. package/dist/chunk-CHQGE2HF.js.map +1 -0
  46. package/dist/chunk-DEJLP7QJ.js +681 -0
  47. package/dist/chunk-DEJLP7QJ.js.map +1 -0
  48. package/dist/chunk-DJ6FN6EW.js +532 -0
  49. package/dist/chunk-DJ6FN6EW.js.map +1 -0
  50. package/dist/chunk-E4WRTRMH.js +1173 -0
  51. package/dist/chunk-E4WRTRMH.js.map +1 -0
  52. package/dist/chunk-E5QXNU3K.js +238 -0
  53. package/dist/chunk-E5QXNU3K.js.map +1 -0
  54. package/dist/chunk-EMTBGOR3.js +2959 -0
  55. package/dist/chunk-EMTBGOR3.js.map +1 -0
  56. package/dist/chunk-FFWYIGQ4.js +18 -0
  57. package/dist/chunk-FFWYIGQ4.js.map +1 -0
  58. package/dist/chunk-I6XFZLTJ.js +9 -0
  59. package/dist/chunk-I6XFZLTJ.js.map +1 -0
  60. package/dist/chunk-IHWAOIAU.js +172 -0
  61. package/dist/chunk-IHWAOIAU.js.map +1 -0
  62. package/dist/chunk-IHZUYG66.js +583 -0
  63. package/dist/chunk-IHZUYG66.js.map +1 -0
  64. package/dist/chunk-JQOKQKQT.js +158 -0
  65. package/dist/chunk-JQOKQKQT.js.map +1 -0
  66. package/dist/chunk-JRFUTIEH.js +426 -0
  67. package/dist/chunk-JRFUTIEH.js.map +1 -0
  68. package/dist/chunk-KCBI6JQC.js +115 -0
  69. package/dist/chunk-KCBI6JQC.js.map +1 -0
  70. package/dist/chunk-KDUQMINL.js +60 -0
  71. package/dist/chunk-KDUQMINL.js.map +1 -0
  72. package/dist/chunk-KLR2DURP.js +656 -0
  73. package/dist/chunk-KLR2DURP.js.map +1 -0
  74. package/dist/chunk-KRI4R7EM.js +25 -0
  75. package/dist/chunk-KRI4R7EM.js.map +1 -0
  76. package/dist/chunk-LYQMK6SV.js +87 -0
  77. package/dist/chunk-LYQMK6SV.js.map +1 -0
  78. package/dist/chunk-MK3Q37ZN.js +183 -0
  79. package/dist/chunk-MK3Q37ZN.js.map +1 -0
  80. package/dist/chunk-MSGAGV7B.js +346 -0
  81. package/dist/chunk-MSGAGV7B.js.map +1 -0
  82. package/dist/chunk-MZQRSERO.js +430 -0
  83. package/dist/chunk-MZQRSERO.js.map +1 -0
  84. package/dist/chunk-N3WIJXXM.js +691 -0
  85. package/dist/chunk-N3WIJXXM.js.map +1 -0
  86. package/dist/chunk-NAGAJ5UM.js +145 -0
  87. package/dist/chunk-NAGAJ5UM.js.map +1 -0
  88. package/dist/chunk-NFYPBTKO.js +302 -0
  89. package/dist/chunk-NFYPBTKO.js.map +1 -0
  90. package/dist/chunk-NPO2IG6G.js +491 -0
  91. package/dist/chunk-NPO2IG6G.js.map +1 -0
  92. package/dist/chunk-OS6NUIBJ.js +38 -0
  93. package/dist/chunk-OS6NUIBJ.js.map +1 -0
  94. package/dist/chunk-PFUK3HJ4.js +296 -0
  95. package/dist/chunk-PFUK3HJ4.js.map +1 -0
  96. package/dist/chunk-PMQ55GDB.js +115 -0
  97. package/dist/chunk-PMQ55GDB.js.map +1 -0
  98. package/dist/chunk-QIVE2YFJ.js +514 -0
  99. package/dist/chunk-QIVE2YFJ.js.map +1 -0
  100. package/dist/chunk-QKXD3EUF.js +691 -0
  101. package/dist/chunk-QKXD3EUF.js.map +1 -0
  102. package/dist/chunk-RNQYUWF6.js +32 -0
  103. package/dist/chunk-RNQYUWF6.js.map +1 -0
  104. package/dist/chunk-S2E4SSQV.js +41 -0
  105. package/dist/chunk-S2E4SSQV.js.map +1 -0
  106. package/dist/chunk-SN4BXX3B.js +186 -0
  107. package/dist/chunk-SN4BXX3B.js.map +1 -0
  108. package/dist/chunk-SNVAMWB7.js +40 -0
  109. package/dist/chunk-SNVAMWB7.js.map +1 -0
  110. package/dist/chunk-T5VRREN4.js +696 -0
  111. package/dist/chunk-T5VRREN4.js.map +1 -0
  112. package/dist/chunk-TKBMHZTS.js +10945 -0
  113. package/dist/chunk-TKBMHZTS.js.map +1 -0
  114. package/dist/chunk-TNJPTUE4.js +35 -0
  115. package/dist/chunk-TNJPTUE4.js.map +1 -0
  116. package/dist/chunk-TQ2NA4Z4.js +24 -0
  117. package/dist/chunk-TQ2NA4Z4.js.map +1 -0
  118. package/dist/chunk-TXXDMDPN.js +998 -0
  119. package/dist/chunk-TXXDMDPN.js.map +1 -0
  120. package/dist/chunk-UWXUBU7V.js +184 -0
  121. package/dist/chunk-UWXUBU7V.js.map +1 -0
  122. package/dist/chunk-UYRK2H24.js +141 -0
  123. package/dist/chunk-UYRK2H24.js.map +1 -0
  124. package/dist/chunk-V4IXIM3C.js +806 -0
  125. package/dist/chunk-V4IXIM3C.js.map +1 -0
  126. package/dist/chunk-VFHVXXP4.js +6438 -0
  127. package/dist/chunk-VFHVXXP4.js.map +1 -0
  128. package/dist/chunk-VQVUJYYY.js +244 -0
  129. package/dist/chunk-VQVUJYYY.js.map +1 -0
  130. package/dist/chunk-VZQG2JDV.js +9 -0
  131. package/dist/chunk-VZQG2JDV.js.map +1 -0
  132. package/dist/chunk-W7HQ5X3S.js +610 -0
  133. package/dist/chunk-W7HQ5X3S.js.map +1 -0
  134. package/dist/chunk-WMSQAFK5.js +65 -0
  135. package/dist/chunk-WMSQAFK5.js.map +1 -0
  136. package/dist/chunk-WMYTBJPB.js +364 -0
  137. package/dist/chunk-WMYTBJPB.js.map +1 -0
  138. package/dist/chunk-WNLFNCOH.js +7795 -0
  139. package/dist/chunk-WNLFNCOH.js.map +1 -0
  140. package/dist/chunk-WRX7CB2M.js +6448 -0
  141. package/dist/chunk-WRX7CB2M.js.map +1 -0
  142. package/dist/chunk-XGTTOO4R.js +84 -0
  143. package/dist/chunk-XGTTOO4R.js.map +1 -0
  144. package/dist/chunk-YSXRBUR4.js +682 -0
  145. package/dist/chunk-YSXRBUR4.js.map +1 -0
  146. package/dist/chunk-YTC2EG64.js +1759 -0
  147. package/dist/chunk-YTC2EG64.js.map +1 -0
  148. package/dist/compile-J3UGQSS3.js +161 -0
  149. package/dist/compile-J3UGQSS3.js.map +1 -0
  150. package/dist/config-5BPSZND3.js +438 -0
  151. package/dist/config-5BPSZND3.js.map +1 -0
  152. package/dist/doctor-BVFKLJVO.js +111 -0
  153. package/dist/doctor-BVFKLJVO.js.map +1 -0
  154. package/dist/environment-3RI5H32O.js +2745 -0
  155. package/dist/environment-3RI5H32O.js.map +1 -0
  156. package/dist/github-YFJQVH5K.js +114 -0
  157. package/dist/github-YFJQVH5K.js.map +1 -0
  158. package/dist/harness-ECGHPEKA.js +746 -0
  159. package/dist/harness-ECGHPEKA.js.map +1 -0
  160. package/dist/help-ELPNPPEM.js +2079 -0
  161. package/dist/help-ELPNPPEM.js.map +1 -0
  162. package/dist/help-UL5XLY3I.js +1892 -0
  163. package/dist/help-UL5XLY3I.js.map +1 -0
  164. package/dist/index.d.ts +164 -1
  165. package/dist/index.js +50 -59246
  166. package/dist/index.js.map +1 -1
  167. package/dist/init-UJQTDHW7.js +873 -0
  168. package/dist/init-UJQTDHW7.js.map +1 -0
  169. package/dist/lock-XUMJ63NZ.js +455 -0
  170. package/dist/lock-XUMJ63NZ.js.map +1 -0
  171. package/dist/marketplace-ZUMOLVXE.js +495 -0
  172. package/dist/marketplace-ZUMOLVXE.js.map +1 -0
  173. package/dist/mcp-RZA5O2ND.js +202 -0
  174. package/dist/mcp-RZA5O2ND.js.map +1 -0
  175. package/dist/migrate-CYQI2FH6.js +1043 -0
  176. package/dist/migrate-CYQI2FH6.js.map +1 -0
  177. package/dist/open-AWOAWLKO.js +32 -0
  178. package/dist/open-AWOAWLKO.js.map +1 -0
  179. package/dist/pack-2QD5ZUIO.js +99 -0
  180. package/dist/pack-2QD5ZUIO.js.map +1 -0
  181. package/dist/plugin-GQSSSFX4.js +64 -0
  182. package/dist/plugin-GQSSSFX4.js.map +1 -0
  183. package/dist/plugin-from-project-SIQUFYIO.js +16 -0
  184. package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
  185. package/dist/policy-CT4JRCJI.js +105 -0
  186. package/dist/policy-CT4JRCJI.js.map +1 -0
  187. package/dist/profile-4JQ6LECP.js +1886 -0
  188. package/dist/profile-4JQ6LECP.js.map +1 -0
  189. package/dist/project-JG7QWXRG.js +1392 -0
  190. package/dist/project-JG7QWXRG.js.map +1 -0
  191. package/dist/resource-QRMR6CSD.js +555 -0
  192. package/dist/resource-QRMR6CSD.js.map +1 -0
  193. package/dist/version-LZ5POOXY.js +17 -0
  194. package/dist/version-LZ5POOXY.js.map +1 -0
  195. package/package.json +21 -14
  196. package/schemas/ap-package.v1.json +36 -0
  197. package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
  198. package/schemas/fixtures/confidence.ap.json +13 -0
  199. package/schemas/fixtures/context7.ap.json +13 -0
  200. package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
  201. package/schemas/fixtures/superpowers.ap.json +13 -0
  202. package/schemas/fixtures/third-party-skills.ap.json +13 -0
@@ -0,0 +1,656 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/version.ts
8
+ import { execFileSync } from "child_process";
9
+
10
+ // package.json
11
+ var package_default = {
12
+ name: "harnesstap",
13
+ version: "1.3.0",
14
+ description: "Agent harness configuration toolkit for Claude Code, Codex, Cursor, and other coding CLIs",
15
+ type: "module",
16
+ packageManager: "bun@1.3.9",
17
+ files: [
18
+ "dist",
19
+ "LICENSE",
20
+ "README.md",
21
+ "schemas"
22
+ ],
23
+ bin: {
24
+ harnesstap: "./dist/bin.js",
25
+ ht: "./dist/bin.js"
26
+ },
27
+ scripts: {
28
+ build: "bun scripts/generate-scenarios.ts && rm -rf dist && tsup",
29
+ "generate:scenarios": "bun scripts/generate-scenarios.ts",
30
+ "check:packaged-help": "bun scripts/check-packaged-help.ts",
31
+ "snapshot:released-cli": "bun scripts/snapshot-released-cli.ts",
32
+ "build:sidecar": "bash scripts/build-sidecar.sh",
33
+ "check:compiled-sidecar": "bun scripts/check-compiled-sidecar.ts",
34
+ "desktop:cleanup": "bash apps/desktop/scripts/cleanup-stale-dev.sh",
35
+ "desktop:prepare-sidecar": "bash apps/desktop/scripts/prepare-sidecar.sh",
36
+ "desktop:watch-sidecar": "bun apps/desktop/scripts/watch-sidecar.ts",
37
+ "desktop:icons": "cd apps/desktop && bun run icons",
38
+ "desktop:dev": "bash apps/desktop/scripts/desktop-dev.sh",
39
+ "desktop:build": "bun run desktop:prepare-sidecar && cd apps/desktop && bun install && bun run tauri build && bash scripts/reseal-macos-app.sh",
40
+ "desktop:install": "bun apps/desktop/scripts/install-local.ts",
41
+ "desktop:e2e:build": "bash apps/desktop/scripts/e2e-build.sh",
42
+ "desktop:e2e": "bash apps/desktop/scripts/e2e-run.sh",
43
+ "desktop:demo-agent": "bash apps/desktop/scripts/demo-home.sh",
44
+ "desktop:shots": "cd apps/desktop && bun run shots",
45
+ "desktop:check": "bash apps/desktop/scripts/desktop-check.sh",
46
+ dev: "tsup --watch",
47
+ start: "bun src/bin.ts",
48
+ "start:dist": "node dist/bin.js",
49
+ link: "bun run build && bun link",
50
+ unlink: "bun unlink",
51
+ test: "bun test --timeout 30000",
52
+ "test:run": "bun test --dots --timeout 30000",
53
+ "test:core": "bun test --dots test/models test/db test/config test/utils test/telemetry test/scripts",
54
+ "test:platforms": "bun test --dots test/platforms",
55
+ "test:plugins": "bun test --dots test/plugins",
56
+ "test:services": "bun test --dots test/services test/integration test/agent/init-apply-noop.test.ts",
57
+ "test:cli": "bun test --dots test/cli test/ui test/helpers",
58
+ "test:docs": "bun test --dots test/docs",
59
+ lint: "biome lint .",
60
+ "lint:fix": "biome lint --write --unsafe .",
61
+ "lint:css": "bun scripts/check-css-tokens.ts",
62
+ "check:cli-error-contract": "bun scripts/check-cli-error-contract.ts",
63
+ "check:copy": "bun scripts/check-copy.ts",
64
+ typecheck: "tsc --noEmit",
65
+ clean: "rm -rf dist && find . -maxdepth 1 -name '*.bun-build' -delete",
66
+ 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",
67
+ prepublishOnly: "bun run build",
68
+ "docs:vhs": "bash scripts/generate-vhs-scenarios.sh",
69
+ "check:scenario-docs": "bash scripts/check-scenario-docs.sh",
70
+ "check:scenario-smoke": "bun test test/cli/scenario-smoke.test.ts",
71
+ "check:sqlite-wal-smoke": "bun scripts/sqlite-wal-write-smoke.ts",
72
+ "sync:cloud-docs": "bash scripts/sync-cloud-cli-docs.sh"
73
+ },
74
+ keywords: [
75
+ "ai",
76
+ "coding-assistant",
77
+ "cli",
78
+ "configuration",
79
+ "claude-code",
80
+ "cursor",
81
+ "codex",
82
+ "skills",
83
+ "layers"
84
+ ],
85
+ license: "Apache-2.0",
86
+ repository: {
87
+ type: "git",
88
+ url: "git+https://github.com/harnesstap/harnesstap.git"
89
+ },
90
+ bugs: {
91
+ url: "https://github.com/harnesstap/harnesstap/issues"
92
+ },
93
+ homepage: "https://github.com/harnesstap/harnesstap#readme",
94
+ engines: {
95
+ node: ">=22.12.0"
96
+ },
97
+ dependencies: {
98
+ "@inquirer/core": "^10.3.2",
99
+ "@inquirer/search": "^3.2.2",
100
+ "better-sqlite3": "^12.11.1",
101
+ chalk: "^5.4.1",
102
+ "cli-table3": "^0.6.5",
103
+ commander: "^13.1.0",
104
+ "gray-matter": "^4.0.3",
105
+ inquirer: "^12.3.0",
106
+ "jsonc-parser": "^3.3.1",
107
+ ora: "^9.4.0",
108
+ picomatch: "^4.0.2",
109
+ semver: "^7.8.0",
110
+ "smol-toml": "^1.3.1",
111
+ ulid: "^2.3.0",
112
+ yaml: "^2.7.0"
113
+ },
114
+ devDependencies: {
115
+ "@biomejs/biome": "^2.4.10",
116
+ "@inquirer/testing": "^3.3.8",
117
+ "@types/better-sqlite3": "^7.6.12",
118
+ "@types/node": "^22.10.0",
119
+ "@types/semver": "^7.7.1",
120
+ tsup: "^8.3.5",
121
+ typescript: "^5.7.0"
122
+ }
123
+ };
124
+
125
+ // src/version.ts
126
+ var GIT_SHA = /^[0-9a-f]{7,40}$/i;
127
+ function compactGitSha(sha) {
128
+ const trimmed = sha?.trim().toLowerCase();
129
+ if (!trimmed || !GIT_SHA.test(trimmed)) {
130
+ return void 0;
131
+ }
132
+ return trimmed.slice(0, 7);
133
+ }
134
+ function isReleaseBuild(env = process.env) {
135
+ return env.HT_RELEASE === "1" || env.HARNESSTAP_RELEASE === "1";
136
+ }
137
+ function readGitSha(env = process.env, cwd = process.cwd()) {
138
+ const fromEnv = compactGitSha(env.HT_GIT_SHA ?? env.GITHUB_SHA);
139
+ if (fromEnv) {
140
+ return fromEnv;
141
+ }
142
+ try {
143
+ const sha = execFileSync("git", ["rev-parse", "HEAD"], {
144
+ cwd,
145
+ encoding: "utf8",
146
+ stdio: ["ignore", "pipe", "ignore"]
147
+ }).trim();
148
+ return compactGitSha(sha);
149
+ } catch {
150
+ return void 0;
151
+ }
152
+ }
153
+ function formatDevBuildVersion(version, options = {}) {
154
+ const trimmed = version.trim();
155
+ if (options.isRelease) {
156
+ return trimmed;
157
+ }
158
+ if (trimmed.includes("-dev+")) {
159
+ return trimmed;
160
+ }
161
+ const sha = compactGitSha(options.gitSha);
162
+ if (!sha) {
163
+ return `${trimmed}-dev`;
164
+ }
165
+ return `${trimmed}-dev+${sha}`;
166
+ }
167
+ function resolveBuildVersion(env = process.env) {
168
+ return formatDevBuildVersion(package_default.version, {
169
+ isRelease: isReleaseBuild(env),
170
+ gitSha: readGitSha(env)
171
+ });
172
+ }
173
+ function resolvePackageVersion() {
174
+ if ("1.3.0-dev+2f07930".length > 0) {
175
+ return "1.3.0-dev+2f07930";
176
+ }
177
+ return resolveBuildVersion();
178
+ }
179
+ var PACKAGE_VERSION = resolvePackageVersion();
180
+
181
+ // src/copy/cli.ts
182
+ var DRY_RUN_NOTHING_CHANGED = "Dry run. Nothing was changed.";
183
+ var NATIVE_MODULE_MISMATCH_MESSAGE = "HarnessTap was installed under a different Node.js version. Run: npm rebuild -g harnesstap";
184
+ function quoteCliArg(value) {
185
+ if (value.length === 0) {
186
+ return '""';
187
+ }
188
+ if (/^[A-Za-z0-9_./:@+=-]+$/.test(value)) {
189
+ return value;
190
+ }
191
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
192
+ }
193
+ function formatHtCommand(path) {
194
+ return `ht ${path}`.trim();
195
+ }
196
+ function quoted(name) {
197
+ return `"${name}"`;
198
+ }
199
+ function skippedInvalidPluginExport(name) {
200
+ return `Warning: Skipped plugin ${quoted(name)}. Its version is not valid semver.`;
201
+ }
202
+ function marketplaceUnreachable(source) {
203
+ return `Error: Couldn't reach ${source}.`;
204
+ }
205
+ function marketplaceUnreachableHint() {
206
+ return "Check the URL, or sign in with ht github login if it's private.";
207
+ }
208
+ function marketplacePathMissing(path) {
209
+ return `Error: Couldn't find a marketplace at ${quoted(path)}.`;
210
+ }
211
+ function marketplacePathNotMarketplace(path) {
212
+ return `Error: ${quoted(path)} is not a marketplace. It needs a marketplace.json file.`;
213
+ }
214
+ function marketplaceAddFailedNothingSaved() {
215
+ return "Nothing was saved.";
216
+ }
217
+ function installPinnedPluginsNeedsYes() {
218
+ return "Error: Pass --yes to install pinned plugins without a prompt.";
219
+ }
220
+ function installPinnedPluginsHint(profileName) {
221
+ if (profileName) {
222
+ return `Run ht profile use ${quoted(profileName)} --yes to install them.`;
223
+ }
224
+ return "Run ht profile use --yes to install them.";
225
+ }
226
+ function skippedHostPluginHook(hookName) {
227
+ return `Skipped hook ${hookName}. It only works when the plugin is installed as a host plugin.`;
228
+ }
229
+ function skippedDuplicateCommand(name) {
230
+ return `Skipped command ${quoted(name)}. A skill already uses that name.`;
231
+ }
232
+ function quoteName(name) {
233
+ return `"${name.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
234
+ }
235
+ function hintToken(value) {
236
+ if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {
237
+ return value;
238
+ }
239
+ return quoteName(value);
240
+ }
241
+ function ensureErrorPrefix(message) {
242
+ const stripped = message.replace(/^error:\s*/i, "").trim();
243
+ if (stripped.length === 0) {
244
+ return "Error: Something went wrong.";
245
+ }
246
+ const sentence = /[.!?]$/.test(stripped) ? stripped : `${stripped}.`;
247
+ return `Error: ${sentence}`;
248
+ }
249
+ var CLI_HINTS = {
250
+ seeOptions: (commandPath) => commandPath.trim().length > 0 ? `Run ht ${commandPath.trim()} --help to see the options.` : "Run ht --help to see the options.",
251
+ pluginList: "Run ht plugin list to see your plugins.",
252
+ resourceList: "Run ht resource list to see your resources.",
253
+ profileUseExample: 'For example: ht profile use "global default"',
254
+ authLogin: "Run ht auth login to sign in.",
255
+ githubLogin: marketplaceUnreachableHint(),
256
+ onConflictReplace: "Use --on-conflict replace to replace it.",
257
+ unsavedChanges: "Run again with --changes save, stash or discard.",
258
+ updateNpm: "Update with: npm i -g harnesstap",
259
+ mcpSearch: (name) => `Run ht mcp search ${hintToken(name)} to find it.`,
260
+ scopeAdd: (name, harnesses) => `Run ht resource scope ${hintToken(name)} --add ${hintToken(harnesses)}.`,
261
+ portableMcpTip: (name, harnessList, command) => `Tip: ${quoteName(name)} also works on ${harnessList}. Run ${command}.`,
262
+ forceRemove: "To remove them too, run: ht apply --force-remove",
263
+ revert: "Snapshot saved. Undo with: ht revert",
264
+ stashPop: "Bring them back with: ht profile stash pop",
265
+ harnessSet: "Run ht harness set to pick your harnesses.",
266
+ harnessSetOrFlag: "Run ht harness set, or pass --harness <slugs>."
267
+ };
268
+ var CLI_ERRORS = {
269
+ pluginNotFound: (name) => `No plugin named ${quoteName(name)}.`,
270
+ resourceNotFound: (name) => `No resource named ${quoteName(name)}.`,
271
+ invalidResourceType: (value, valid) => `${quoteName(value)} isn't a resource type. Valid: ${valid.join(", ")}.`,
272
+ conflictingResourceTypes: (a, b) => `Conflicting type filters: ${quoteName(a)} and ${quoteName(b)}.`,
273
+ pluginAlreadyExists: (name) => `A plugin named ${quoteName(name)} already exists.`,
274
+ environmentAlreadyExists: (name) => `An environment named ${quoteName(name)} already exists.`,
275
+ notAuthenticated: "Not authenticated to HarnessTap Cloud.",
276
+ directoryNotFound: (path) => `Directory not found: ${path}.`,
277
+ fileNotFound: (path) => `File not found: ${path}.`,
278
+ gitUnreachable: (url) => `Couldn't reach ${url}.`,
279
+ gitUnreachableGeneric: "Couldn't reach that git repository.",
280
+ uniqueConstraintGeneric: "That name already exists.",
281
+ missingProfileName: "Pass a profile name.",
282
+ noProfileNamed: (name) => `No profile named ${quoteName(name)}.`,
283
+ invalidPluginName: (name) => `${quoteName(name)} isn't a valid plugin name. Use a non-empty name without /, \\, .. or control characters.`,
284
+ emptyPluginName: "Pass a plugin name.",
285
+ invalidFormat: (value) => `Invalid --format value: ${value}. Use human or json.`,
286
+ mcpNotInLibrary: (name) => `${quoteName(name)} isn't in your library.`,
287
+ newerSchema: "This data was saved by a newer HarnessTap.",
288
+ noHarnesses: "Not set up for any harness yet.",
289
+ unsavedChanges: (name, count) => `${quoteName(name)} has ${count} unsaved change${count === 1 ? "" : "s"}.`,
290
+ resourceSyncStale: (count) => `${count} linked resource${count === 1 ? "" : "s"} ${count === 1 ? "is" : "are"} stale.`
291
+ };
292
+ var SWITCH_CHANGES_VALUES = ["save", "stash", "discard"];
293
+ var SWITCH_CHANGES_FLAG_HELP = "What to do with unsaved changes: save, stash or discard";
294
+ var DEVICE_LOGIN_WAITING = "Waiting for you to approve in the browser. The code expires in 15 minutes. Press Ctrl+C to cancel.";
295
+ function initPickHarnessesLine() {
296
+ return `Pick your harnesses: ${formatHtCommand("harness set")}`;
297
+ }
298
+ function initCompletionHintLine(shell) {
299
+ switch (shell) {
300
+ case "bash":
301
+ return `Enable tab completion: ${formatHtCommand("init completion bash >> ~/.bashrc")}`;
302
+ case "zsh":
303
+ return `Enable tab completion: ${formatHtCommand("init completion zsh >> ~/.zshrc")}`;
304
+ case "fish":
305
+ return `Enable tab completion: ${formatHtCommand("init completion fish > ~/.config/fish/completions/ht.fish")}`;
306
+ default:
307
+ return `Enable tab completion: ${formatHtCommand("init completion <bash|zsh|fish>")}`;
308
+ }
309
+ }
310
+ var CLI_COPY = {
311
+ dryRunNothingChanged: DRY_RUN_NOTHING_CHANGED,
312
+ everythingUpToDate: "Everything is up to date.",
313
+ snapshotSavedUndo: "Snapshot saved. Undo with:",
314
+ forceRemoveHint: "To remove them too, run:",
315
+ keptYouChanged: "you changed it",
316
+ keptNotMade: "not made by HarnessTap",
317
+ viewSnapshot: "View snapshot",
318
+ keptFilesIntro: "files you changed or that HarnessTap didn't create:"
319
+ };
320
+ function unsavedChangesLine(profileName, count) {
321
+ return CLI_ERRORS.unsavedChanges(profileName, count);
322
+ }
323
+ function unsavedChangesFlagHint() {
324
+ return CLI_HINTS.unsavedChanges;
325
+ }
326
+ function savedChangesLine(profileName, count) {
327
+ return `Saved ${count} changes to ${quoteName(profileName)}.`;
328
+ }
329
+ function stashedChangesLine(count, popCommand) {
330
+ return `Stashed ${count} changes. Bring them back with: ${popCommand}`;
331
+ }
332
+ function discardedChangesLine(count) {
333
+ return `Discarded ${count} changes.`;
334
+ }
335
+ function discardConfirm(count) {
336
+ return `Discard ${count} changes? A snapshot keeps a copy.`;
337
+ }
338
+ function applyWroteLine(input) {
339
+ const parts = [];
340
+ if (input.wrote > 0) parts.push(`Wrote ${input.wrote}`);
341
+ if (input.removed > 0) parts.push(`removed ${input.removed}`);
342
+ if (input.wrote === 0 && input.removed === 0) {
343
+ return input.unchanged !== void 0 ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.` : CLI_COPY.everythingUpToDate;
344
+ }
345
+ if (input.kept > 0) parts.push(`kept ${input.kept}`);
346
+ if (parts.length === 0) {
347
+ return input.unchanged !== void 0 ? `${CLI_COPY.everythingUpToDate} ${input.unchanged} unchanged.` : CLI_COPY.everythingUpToDate;
348
+ }
349
+ if (!input.omitUnchanged && input.unchanged !== void 0 && input.unchanged > 0) {
350
+ parts.push(`unchanged ${input.unchanged}`);
351
+ }
352
+ const [first, ...rest] = parts;
353
+ const head = first ?? "";
354
+ if (rest.length === 0) {
355
+ return `${head}.`;
356
+ }
357
+ return `${head}, ${rest.join(", ")}.`;
358
+ }
359
+ function applyHeaderLine(profileName, harnessCount) {
360
+ const noun = harnessCount === 1 ? "harness" : "harnesses";
361
+ return `Applied "${profileName}" to ${harnessCount} ${noun}.`;
362
+ }
363
+ function dryRunWouldLine(input) {
364
+ return `Would write ${input.write}, remove ${input.remove}, keep ${input.keep}. ${input.unchanged} unchanged.`;
365
+ }
366
+ function dryRunStashLine(count, profileName) {
367
+ return `Dry run. Would stash ${count} changes from "${profileName}".`;
368
+ }
369
+ function snapshotSavedUndoLine(revertCommand) {
370
+ return `${CLI_COPY.snapshotSavedUndo} ${revertCommand}`;
371
+ }
372
+ function keptFilesHeader(count) {
373
+ return `Kept ${count} ${CLI_COPY.keptFilesIntro}`;
374
+ }
375
+ function restoredRemovedLine(restored, removed, options = {}) {
376
+ if (options.dryRun) {
377
+ return `Would restore ${restored}, would remove ${removed}.`;
378
+ }
379
+ return `Restored ${restored}, removed ${removed}.`;
380
+ }
381
+ function dryRunSectionHeader(kind, count) {
382
+ switch (kind) {
383
+ case "write":
384
+ return `Would write (${count})`;
385
+ case "remove":
386
+ return `Would remove (${count})`;
387
+ case "keep":
388
+ return `Would keep (${count})`;
389
+ default: {
390
+ const _exhaustive = kind;
391
+ return _exhaustive;
392
+ }
393
+ }
394
+ }
395
+ function keptReasonLabel(reason) {
396
+ switch (reason) {
397
+ case "modified":
398
+ return CLI_COPY.keptYouChanged;
399
+ case "unmanaged":
400
+ return CLI_COPY.keptNotMade;
401
+ default: {
402
+ const _exhaustive = reason;
403
+ return _exhaustive;
404
+ }
405
+ }
406
+ }
407
+
408
+ // src/db/native-module.ts
409
+ function shouldShowNativeModuleDetails() {
410
+ if (process.env.HARNESSTAP_DEBUG === "1") {
411
+ return true;
412
+ }
413
+ return process.argv.includes("-v") || process.argv.includes("--verbose");
414
+ }
415
+ function isNativeModuleMismatch(error) {
416
+ if (!error || typeof error !== "object") {
417
+ return false;
418
+ }
419
+ const err = error;
420
+ const code = typeof err.code === "string" ? err.code : "";
421
+ const message = typeof err.message === "string" ? err.message : String(error);
422
+ if (code === "ERR_DLOPEN_FAILED") {
423
+ return true;
424
+ }
425
+ return message.includes("NODE_MODULE_VERSION") || message.includes("ERR_DLOPEN");
426
+ }
427
+ function reportNativeModuleMismatch(cause) {
428
+ if (shouldShowNativeModuleDetails() && cause !== void 0) {
429
+ console.error(cause);
430
+ }
431
+ console.error(NATIVE_MODULE_MISMATCH_MESSAGE);
432
+ process.exit(1);
433
+ }
434
+ function withNativeModuleGuard(load) {
435
+ try {
436
+ return load();
437
+ } catch (error) {
438
+ if (isNativeModuleMismatch(error)) {
439
+ reportNativeModuleMismatch(error);
440
+ }
441
+ throw error;
442
+ }
443
+ }
444
+
445
+ // src/db/connection.ts
446
+ import { existsSync, mkdirSync } from "fs";
447
+ import { createRequire } from "module";
448
+ import { join } from "path";
449
+ import { homedir } from "os";
450
+ var require2 = createRequire(import.meta.url);
451
+ var instance = null;
452
+ var instancePath = null;
453
+ function loadBetterSqlite3() {
454
+ return withNativeModuleGuard(
455
+ () => require2("better-sqlite3")
456
+ );
457
+ }
458
+ function resolveDatabaseConstructor() {
459
+ if ("Bun" in globalThis) {
460
+ return require2("bun:sqlite").Database;
461
+ }
462
+ return loadBetterSqlite3();
463
+ }
464
+ function usesBunSqlite() {
465
+ return "Bun" in globalThis;
466
+ }
467
+ function wrapDatabase(db) {
468
+ return {
469
+ prepare(sql) {
470
+ const statement = db.prepare(sql);
471
+ return {
472
+ run: (...params) => statement.run(...params),
473
+ get: (...params) => {
474
+ const row = statement.get(...params);
475
+ return row ?? void 0;
476
+ },
477
+ all: (...params) => statement.all(...params)
478
+ };
479
+ },
480
+ exec: (sql) => db.exec(sql),
481
+ transaction: (fn) => db.transaction(fn),
482
+ close: () => db.close()
483
+ };
484
+ }
485
+ function resolveHarnesstapDir() {
486
+ if (process.env.HARNESSTAP_HOME) {
487
+ return process.env.HARNESSTAP_HOME;
488
+ }
489
+ const homePath = process.env.HOME ?? process.env.USERPROFILE ?? homedir();
490
+ return join(homePath, ".harnesstap");
491
+ }
492
+ function harnesstapDirForHomeRoot(homeRoot) {
493
+ if (process.env.HARNESSTAP_HOME) {
494
+ return process.env.HARNESSTAP_HOME;
495
+ }
496
+ return join(homeRoot, ".harnesstap");
497
+ }
498
+ function resolveDbPath() {
499
+ return join(resolveHarnesstapDir(), "harnesstap.db");
500
+ }
501
+ function getDbPath() {
502
+ return resolveDbPath();
503
+ }
504
+ function getHarnesstapDir() {
505
+ return resolveHarnesstapDir();
506
+ }
507
+ function isCompletionMode() {
508
+ return process.env.HARNESSTAP_COMPLETE === "1";
509
+ }
510
+ function getDb() {
511
+ const dbPath = resolveDbPath();
512
+ const completionMode = isCompletionMode();
513
+ if (instance && instancePath === dbPath) {
514
+ return instance;
515
+ }
516
+ if (instance) {
517
+ instance.close();
518
+ instance = null;
519
+ instancePath = null;
520
+ }
521
+ if (completionMode) {
522
+ if (!existsSync(dbPath)) {
523
+ throw new Error(`HarnessTap database not found: ${dbPath}`);
524
+ }
525
+ } else {
526
+ mkdirSync(resolveHarnesstapDir(), { recursive: true });
527
+ }
528
+ const Database = resolveDatabaseConstructor();
529
+ const rawDb = withNativeModuleGuard(
530
+ () => completionMode ? new Database(dbPath, { readonly: true }) : new Database(dbPath)
531
+ );
532
+ instance = usesBunSqlite() ? wrapDatabase(rawDb) : rawDb;
533
+ instancePath = dbPath;
534
+ if (!completionMode) {
535
+ instance.exec("PRAGMA journal_mode = WAL");
536
+ instance.exec("PRAGMA busy_timeout = 5000");
537
+ }
538
+ instance.exec("PRAGMA foreign_keys = ON");
539
+ return instance;
540
+ }
541
+ function closeDb() {
542
+ if (instance) {
543
+ instance.close();
544
+ instance = null;
545
+ instancePath = null;
546
+ }
547
+ }
548
+
549
+ // src/utils/fetch-with-timeout.ts
550
+ var DEFAULT_TIMEOUT_MS = 3e4;
551
+ var DEFAULT_RETRIES = 2;
552
+ var CATALOG_LIST_TIMEOUT_MESSAGE = "Catalog request timed out (30s). Try again, or list local plugins without --remote.";
553
+ async function fetchWithTimeout(input, init) {
554
+ const timeoutMs = init?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
555
+ const retries = init?.retries ?? DEFAULT_RETRIES;
556
+ let lastError;
557
+ for (let attempt = 0; attempt <= retries; attempt += 1) {
558
+ const controller = new AbortController();
559
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
560
+ try {
561
+ const { timeoutMs: _t, retries: _r, ...fetchInit } = init ?? {};
562
+ return await fetch(input, { ...fetchInit, signal: controller.signal });
563
+ } catch (error) {
564
+ lastError = error;
565
+ if (attempt === retries) break;
566
+ await new Promise((r) => setTimeout(r, 250 * (attempt + 1)));
567
+ } finally {
568
+ clearTimeout(timer);
569
+ }
570
+ }
571
+ throw new Error(
572
+ `Request timed out after ${timeoutMs}ms (${retries + 1} attempts): ${String(input)}`,
573
+ { cause: lastError }
574
+ );
575
+ }
576
+ function isRequestTimeoutError(error) {
577
+ return error instanceof Error && error.message.startsWith("Request timed out after");
578
+ }
579
+ function formatCatalogRequestError(error) {
580
+ if (isRequestTimeoutError(error)) {
581
+ return CATALOG_LIST_TIMEOUT_MESSAGE;
582
+ }
583
+ return error instanceof Error ? error.message : String(error);
584
+ }
585
+
586
+ // src/utils/git-errors.ts
587
+ function mapGitStderr(stderr, url) {
588
+ if (stderr.startsWith("Couldn't reach")) {
589
+ return stderr.endsWith(".") ? stderr : `${stderr}.`;
590
+ }
591
+ if (url) {
592
+ return `Couldn't reach ${url}.`;
593
+ }
594
+ return "Couldn't reach that git repository.";
595
+ }
596
+ function gitFailureHint() {
597
+ return "Check the URL, or sign in with ht github login if it's private.";
598
+ }
599
+
600
+ export {
601
+ __export,
602
+ isReleaseBuild,
603
+ readGitSha,
604
+ formatDevBuildVersion,
605
+ resolveBuildVersion,
606
+ PACKAGE_VERSION,
607
+ quoteCliArg,
608
+ formatHtCommand,
609
+ skippedInvalidPluginExport,
610
+ marketplaceUnreachable,
611
+ marketplaceUnreachableHint,
612
+ marketplacePathMissing,
613
+ marketplacePathNotMarketplace,
614
+ marketplaceAddFailedNothingSaved,
615
+ installPinnedPluginsNeedsYes,
616
+ installPinnedPluginsHint,
617
+ skippedHostPluginHook,
618
+ skippedDuplicateCommand,
619
+ quoteName,
620
+ ensureErrorPrefix,
621
+ CLI_HINTS,
622
+ CLI_ERRORS,
623
+ SWITCH_CHANGES_VALUES,
624
+ SWITCH_CHANGES_FLAG_HELP,
625
+ DEVICE_LOGIN_WAITING,
626
+ initPickHarnessesLine,
627
+ initCompletionHintLine,
628
+ CLI_COPY,
629
+ unsavedChangesLine,
630
+ unsavedChangesFlagHint,
631
+ savedChangesLine,
632
+ stashedChangesLine,
633
+ discardedChangesLine,
634
+ discardConfirm,
635
+ applyWroteLine,
636
+ applyHeaderLine,
637
+ dryRunWouldLine,
638
+ dryRunStashLine,
639
+ snapshotSavedUndoLine,
640
+ keptFilesHeader,
641
+ restoredRemovedLine,
642
+ dryRunSectionHeader,
643
+ keptReasonLabel,
644
+ mapGitStderr,
645
+ gitFailureHint,
646
+ isNativeModuleMismatch,
647
+ reportNativeModuleMismatch,
648
+ harnesstapDirForHomeRoot,
649
+ getDbPath,
650
+ getHarnesstapDir,
651
+ getDb,
652
+ closeDb,
653
+ fetchWithTimeout,
654
+ formatCatalogRequestError
655
+ };
656
+ //# sourceMappingURL=chunk-KLR2DURP.js.map