@indigoai-us/hq-cloud 6.14.50 → 6.15.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 (340) hide show
  1. package/dist/bin/sync-mutation.d.ts +14 -0
  2. package/dist/bin/sync-mutation.d.ts.map +1 -0
  3. package/dist/bin/sync-mutation.js +60 -0
  4. package/dist/bin/sync-mutation.js.map +1 -0
  5. package/dist/bin/sync-mutation.test.d.ts +2 -0
  6. package/dist/bin/sync-mutation.test.d.ts.map +1 -0
  7. package/dist/bin/sync-mutation.test.js +64 -0
  8. package/dist/bin/sync-mutation.test.js.map +1 -0
  9. package/dist/bin/sync-runner-company.d.ts +8 -0
  10. package/dist/bin/sync-runner-company.d.ts.map +1 -1
  11. package/dist/bin/sync-runner-company.js +16 -0
  12. package/dist/bin/sync-runner-company.js.map +1 -1
  13. package/dist/bin/sync-runner-company.test.d.ts +2 -0
  14. package/dist/bin/sync-runner-company.test.d.ts.map +1 -0
  15. package/dist/bin/sync-runner-company.test.js +36 -0
  16. package/dist/bin/sync-runner-company.test.js.map +1 -0
  17. package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
  18. package/dist/bin/sync-runner-watch-loop.js +98 -8
  19. package/dist/bin/sync-runner-watch-loop.js.map +1 -1
  20. package/dist/bin/sync-runner.d.ts +17 -0
  21. package/dist/bin/sync-runner.d.ts.map +1 -1
  22. package/dist/bin/sync-runner.js.map +1 -1
  23. package/dist/bin/sync-runner.test.js +109 -0
  24. package/dist/bin/sync-runner.test.js.map +1 -1
  25. package/dist/cli/conflict-recovery.test.d.ts +2 -0
  26. package/dist/cli/conflict-recovery.test.d.ts.map +1 -0
  27. package/dist/cli/conflict-recovery.test.js +201 -0
  28. package/dist/cli/conflict-recovery.test.js.map +1 -0
  29. package/dist/cli/conflict.d.ts +60 -0
  30. package/dist/cli/conflict.d.ts.map +1 -1
  31. package/dist/cli/conflict.js +333 -0
  32. package/dist/cli/conflict.js.map +1 -1
  33. package/dist/cli/reindex-knowledge.d.ts +7 -0
  34. package/dist/cli/reindex-knowledge.d.ts.map +1 -0
  35. package/dist/cli/reindex-knowledge.js +389 -0
  36. package/dist/cli/reindex-knowledge.js.map +1 -0
  37. package/dist/cli/reindex-knowledge.test.d.ts +12 -0
  38. package/dist/cli/reindex-knowledge.test.d.ts.map +1 -0
  39. package/dist/cli/reindex-knowledge.test.js +260 -0
  40. package/dist/cli/reindex-knowledge.test.js.map +1 -0
  41. package/dist/cli/reindex.d.ts.map +1 -1
  42. package/dist/cli/reindex.js +8 -0
  43. package/dist/cli/reindex.js.map +1 -1
  44. package/dist/cli/rescue-settings-reconcile.test.js +47 -0
  45. package/dist/cli/rescue-settings-reconcile.test.js.map +1 -1
  46. package/dist/cli/sync.d.ts +27 -0
  47. package/dist/cli/sync.d.ts.map +1 -1
  48. package/dist/cli/sync.js +52 -0
  49. package/dist/cli/sync.js.map +1 -1
  50. package/dist/cli/sync.test.js +31 -1
  51. package/dist/cli/sync.test.js.map +1 -1
  52. package/dist/index.d.ts +2 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +1 -0
  55. package/dist/index.js.map +1 -1
  56. package/dist/skill-telemetry.d.ts +6 -0
  57. package/dist/skill-telemetry.d.ts.map +1 -1
  58. package/dist/skill-telemetry.js +14 -2
  59. package/dist/skill-telemetry.js.map +1 -1
  60. package/dist/skill-telemetry.test.js +79 -0
  61. package/dist/skill-telemetry.test.js.map +1 -1
  62. package/dist/sync/candidate-uploader.d.ts +88 -0
  63. package/dist/sync/candidate-uploader.d.ts.map +1 -0
  64. package/dist/sync/candidate-uploader.js +212 -0
  65. package/dist/sync/candidate-uploader.js.map +1 -0
  66. package/dist/sync/candidate-uploader.test.d.ts +2 -0
  67. package/dist/sync/candidate-uploader.test.d.ts.map +1 -0
  68. package/dist/sync/candidate-uploader.test.js +132 -0
  69. package/dist/sync/candidate-uploader.test.js.map +1 -0
  70. package/dist/sync/delta-client.d.ts +73 -0
  71. package/dist/sync/delta-client.d.ts.map +1 -0
  72. package/dist/sync/delta-client.js +201 -0
  73. package/dist/sync/delta-client.js.map +1 -0
  74. package/dist/sync/delta-client.test.d.ts +2 -0
  75. package/dist/sync/delta-client.test.d.ts.map +1 -0
  76. package/dist/sync/delta-client.test.js +97 -0
  77. package/dist/sync/delta-client.test.js.map +1 -0
  78. package/dist/sync/durable-apply.d.ts +76 -0
  79. package/dist/sync/durable-apply.d.ts.map +1 -0
  80. package/dist/sync/durable-apply.js +530 -0
  81. package/dist/sync/durable-apply.js.map +1 -0
  82. package/dist/sync/durable-apply.test.d.ts +2 -0
  83. package/dist/sync/durable-apply.test.d.ts.map +1 -0
  84. package/dist/sync/durable-apply.test.js +180 -0
  85. package/dist/sync/durable-apply.test.js.map +1 -0
  86. package/dist/sync/event-sync.d.ts +33 -1
  87. package/dist/sync/event-sync.d.ts.map +1 -1
  88. package/dist/sync/event-sync.js +149 -1
  89. package/dist/sync/event-sync.js.map +1 -1
  90. package/dist/sync/event-sync.test.js +142 -1
  91. package/dist/sync/event-sync.test.js.map +1 -1
  92. package/dist/sync/index.d.ts +2 -0
  93. package/dist/sync/index.d.ts.map +1 -1
  94. package/dist/sync/index.js +1 -0
  95. package/dist/sync/index.js.map +1 -1
  96. package/dist/sync/multipart-uploader.d.ts +99 -0
  97. package/dist/sync/multipart-uploader.d.ts.map +1 -0
  98. package/dist/sync/multipart-uploader.js +447 -0
  99. package/dist/sync/multipart-uploader.js.map +1 -0
  100. package/dist/sync/multipart-uploader.test.d.ts +2 -0
  101. package/dist/sync/multipart-uploader.test.d.ts.map +1 -0
  102. package/dist/sync/multipart-uploader.test.js +119 -0
  103. package/dist/sync/multipart-uploader.test.js.map +1 -0
  104. package/dist/sync/mutation-client.d.ts +82 -0
  105. package/dist/sync/mutation-client.d.ts.map +1 -0
  106. package/dist/sync/mutation-client.js +221 -0
  107. package/dist/sync/mutation-client.js.map +1 -0
  108. package/dist/sync/mutation-client.test.d.ts +2 -0
  109. package/dist/sync/mutation-client.test.d.ts.map +1 -0
  110. package/dist/sync/mutation-client.test.js +51 -0
  111. package/dist/sync/mutation-client.test.js.map +1 -0
  112. package/dist/sync/push-receiver.d.ts +45 -0
  113. package/dist/sync/push-receiver.d.ts.map +1 -1
  114. package/dist/sync/push-receiver.js +101 -0
  115. package/dist/sync/push-receiver.js.map +1 -1
  116. package/dist/sync/push-receiver.test.js +54 -2
  117. package/dist/sync/push-receiver.test.js.map +1 -1
  118. package/dist/sync/scope-inventory-client.d.ts +69 -0
  119. package/dist/sync/scope-inventory-client.d.ts.map +1 -0
  120. package/dist/sync/scope-inventory-client.js +210 -0
  121. package/dist/sync/scope-inventory-client.js.map +1 -0
  122. package/dist/sync/scope-inventory-client.test.d.ts +2 -0
  123. package/dist/sync/scope-inventory-client.test.d.ts.map +1 -0
  124. package/dist/sync/scope-inventory-client.test.js +94 -0
  125. package/dist/sync/scope-inventory-client.test.js.map +1 -0
  126. package/dist/sync/snapshot-client.d.ts +98 -0
  127. package/dist/sync/snapshot-client.d.ts.map +1 -0
  128. package/dist/sync/snapshot-client.js +402 -0
  129. package/dist/sync/snapshot-client.js.map +1 -0
  130. package/dist/sync/snapshot-client.test.d.ts +2 -0
  131. package/dist/sync/snapshot-client.test.d.ts.map +1 -0
  132. package/dist/sync/snapshot-client.test.js +169 -0
  133. package/dist/sync/snapshot-client.test.js.map +1 -0
  134. package/dist/sync/uploader-finalization.d.ts +97 -0
  135. package/dist/sync/uploader-finalization.d.ts.map +1 -0
  136. package/dist/sync/uploader-finalization.js +273 -0
  137. package/dist/sync/uploader-finalization.js.map +1 -0
  138. package/dist/sync/uploader-finalization.test.d.ts +2 -0
  139. package/dist/sync/uploader-finalization.test.d.ts.map +1 -0
  140. package/dist/sync/uploader-finalization.test.js +92 -0
  141. package/dist/sync/uploader-finalization.test.js.map +1 -0
  142. package/dist/telemetry.d.ts +11 -1
  143. package/dist/telemetry.d.ts.map +1 -1
  144. package/dist/telemetry.js +21 -2
  145. package/dist/telemetry.js.map +1 -1
  146. package/dist/telemetry.test.js +80 -0
  147. package/dist/telemetry.test.js.map +1 -1
  148. package/package.json +6 -1
  149. package/.claude/policies/hq-cloud-esm-cannot-spy-fs-builtins.md +0 -30
  150. package/.claude/policies/hq-cloud-strip-types-no-parameter-properties.md +0 -22
  151. package/.github/workflows/ci.yml +0 -84
  152. package/.github/workflows/publish.yml +0 -56
  153. package/.github/workflows/unreleased-commits-nag.yml +0 -256
  154. package/eslint.config.js +0 -67
  155. package/pnpm-workspace.yaml +0 -2
  156. package/scripts/presign-transport-e2e.mjs +0 -250
  157. package/scripts/vault-rebaseline.sh +0 -323
  158. package/scripts/vault-rescue.sh +0 -332
  159. package/src/active-company.test.ts +0 -188
  160. package/src/active-company.ts +0 -168
  161. package/src/agent-codex-instructions.test.ts +0 -332
  162. package/src/agent-codex-instructions.ts +0 -309
  163. package/src/auth.ts +0 -146
  164. package/src/backup-prune.test.ts +0 -98
  165. package/src/backup-prune.ts +0 -182
  166. package/src/bin/backup-prune-runner.ts +0 -33
  167. package/src/bin/rescue-runner.ts +0 -25
  168. package/src/bin/sync-runner-company.ts +0 -695
  169. package/src/bin/sync-runner-events.test.ts +0 -143
  170. package/src/bin/sync-runner-events.ts +0 -55
  171. package/src/bin/sync-runner-planning.test.ts +0 -311
  172. package/src/bin/sync-runner-planning.ts +0 -258
  173. package/src/bin/sync-runner-rollup.test.ts +0 -37
  174. package/src/bin/sync-runner-rollup.ts +0 -97
  175. package/src/bin/sync-runner-telemetry.ts +0 -15
  176. package/src/bin/sync-runner-watch-loop.ts +0 -1235
  177. package/src/bin/sync-runner-watch-routes.test.ts +0 -71
  178. package/src/bin/sync-runner-watch-routes.ts +0 -184
  179. package/src/bin/sync-runner.test.ts +0 -8767
  180. package/src/bin/sync-runner.ts +0 -2190
  181. package/src/cli/accept.ts +0 -124
  182. package/src/cli/conflict.ts +0 -119
  183. package/src/cli/doctor.test.ts +0 -581
  184. package/src/cli/doctor.ts +0 -642
  185. package/src/cli/index.ts +0 -49
  186. package/src/cli/invite.test.ts +0 -250
  187. package/src/cli/invite.ts +0 -214
  188. package/src/cli/promote.ts +0 -157
  189. package/src/cli/reindex.test.ts +0 -957
  190. package/src/cli/reindex.ts +0 -970
  191. package/src/cli/rescue-classify-ordering.test.ts +0 -548
  192. package/src/cli/rescue-clone-diagnostics.test.ts +0 -120
  193. package/src/cli/rescue-core.ts +0 -3011
  194. package/src/cli/rescue-drift-reconcile.test.ts +0 -179
  195. package/src/cli/rescue-drop-dir-symlink.test.ts +0 -224
  196. package/src/cli/rescue-exec-bit-preserve.test.ts +0 -187
  197. package/src/cli/rescue-hq-root-guard.test.ts +0 -232
  198. package/src/cli/rescue-journal-reconcile.test.ts +0 -215
  199. package/src/cli/rescue-mtime-preserve.test.ts +0 -203
  200. package/src/cli/rescue-settings-reconcile.test.ts +0 -583
  201. package/src/cli/rescue-snapshot.test.ts +0 -57
  202. package/src/cli/rescue-snapshot.ts +0 -51
  203. package/src/cli/rescue.reindex.test.ts +0 -63
  204. package/src/cli/rescue.test.ts +0 -131
  205. package/src/cli/rescue.ts +0 -182
  206. package/src/cli/share.test.ts +0 -7843
  207. package/src/cli/share.ts +0 -3663
  208. package/src/cli/sync-scope.test.ts +0 -652
  209. package/src/cli/sync.test.ts +0 -5207
  210. package/src/cli/sync.ts +0 -3470
  211. package/src/cli/tombstones.ts +0 -106
  212. package/src/cli/watch-event-push-conflict.test.ts +0 -234
  213. package/src/client-info.test.ts +0 -214
  214. package/src/client-info.ts +0 -121
  215. package/src/cognito-auth.test.ts +0 -712
  216. package/src/cognito-auth.ts +0 -1422
  217. package/src/company-resolver.test.ts +0 -618
  218. package/src/company-resolver.ts +0 -521
  219. package/src/context.test.ts +0 -583
  220. package/src/context.ts +0 -378
  221. package/src/daemon-worker.ts +0 -26
  222. package/src/daemon.ts +0 -99
  223. package/src/entity-resolver.test.ts +0 -315
  224. package/src/entity-resolver.ts +0 -180
  225. package/src/ignore.test.ts +0 -466
  226. package/src/ignore.ts +0 -469
  227. package/src/index.ts +0 -439
  228. package/src/journal.test.ts +0 -968
  229. package/src/journal.ts +0 -765
  230. package/src/lib/cloud-authoritative.test.ts +0 -45
  231. package/src/lib/cloud-authoritative.ts +0 -59
  232. package/src/lib/conflict-file.ts +0 -86
  233. package/src/lib/conflict-index.ts +0 -289
  234. package/src/lib/conflict.test.ts +0 -348
  235. package/src/lib/describe-error.test.ts +0 -100
  236. package/src/lib/describe-error.ts +0 -58
  237. package/src/lib/exit-codes.ts +0 -24
  238. package/src/lib/machine-id.test.ts +0 -231
  239. package/src/lib/machine-id.ts +0 -175
  240. package/src/lib/net-errors.test.ts +0 -65
  241. package/src/lib/net-errors.ts +0 -86
  242. package/src/lib/readlink-safe.test.ts +0 -43
  243. package/src/lib/readlink-safe.ts +0 -29
  244. package/src/local-path-codec.test.ts +0 -138
  245. package/src/local-path-codec.ts +0 -161
  246. package/src/machine-auth.test.ts +0 -1323
  247. package/src/manifest-reconcile.test.ts +0 -1123
  248. package/src/manifest-reconcile.ts +0 -518
  249. package/src/object-io.test.ts +0 -1221
  250. package/src/object-io.ts +0 -1306
  251. package/src/operation-lock.test.ts +0 -484
  252. package/src/operation-lock.ts +0 -680
  253. package/src/outcome-telemetry.test.ts +0 -498
  254. package/src/outcome-telemetry.ts +0 -639
  255. package/src/personal-vault-exclusions.test.ts +0 -308
  256. package/src/personal-vault-exclusions.ts +0 -354
  257. package/src/personal-vault.test.ts +0 -756
  258. package/src/personal-vault.ts +0 -496
  259. package/src/prefix-coalesce.test.ts +0 -240
  260. package/src/prefix-coalesce.ts +0 -273
  261. package/src/public-surface.test.ts +0 -117
  262. package/src/qmd-reindex.test.ts +0 -877
  263. package/src/qmd-reindex.ts +0 -842
  264. package/src/read-only-state-dir.test.ts +0 -188
  265. package/src/remote-pull.test.ts +0 -1130
  266. package/src/remote-pull.ts +0 -618
  267. package/src/s3.symlink-materialize.test.ts +0 -492
  268. package/src/s3.test.ts +0 -1789
  269. package/src/s3.ts +0 -1532
  270. package/src/schemas/signal-types.test.ts +0 -82
  271. package/src/schemas/signal-types.ts +0 -38
  272. package/src/schemas/source-channels.test.ts +0 -82
  273. package/src/schemas/source-channels.ts +0 -53
  274. package/src/scope-shrink.test.ts +0 -633
  275. package/src/scope-shrink.ts +0 -481
  276. package/src/signals/get.test.ts +0 -310
  277. package/src/signals/get.ts +0 -75
  278. package/src/signals/internals.ts +0 -195
  279. package/src/signals/list.test.ts +0 -420
  280. package/src/signals/list.ts +0 -79
  281. package/src/signals/parse.ts +0 -8
  282. package/src/signals/types.ts +0 -91
  283. package/src/skill-telemetry.test.ts +0 -1825
  284. package/src/skill-telemetry.ts +0 -1439
  285. package/src/sources/get.test.ts +0 -293
  286. package/src/sources/get.ts +0 -66
  287. package/src/sources/internals.ts +0 -198
  288. package/src/sources/list.test.ts +0 -402
  289. package/src/sources/list.ts +0 -84
  290. package/src/sources/parse.ts +0 -43
  291. package/src/sources/types.ts +0 -84
  292. package/src/sync/event-sync.test.ts +0 -594
  293. package/src/sync/event-sync.ts +0 -545
  294. package/src/sync/feature-flags.test.ts +0 -378
  295. package/src/sync/feature-flags.ts +0 -62
  296. package/src/sync/index.ts +0 -76
  297. package/src/sync/lease-client.test.ts +0 -128
  298. package/src/sync/lease-client.ts +0 -207
  299. package/src/sync/logger.test.ts +0 -242
  300. package/src/sync/logger.ts +0 -79
  301. package/src/sync/metrics.test.ts +0 -462
  302. package/src/sync/metrics.ts +0 -213
  303. package/src/sync/pull-scope.ts +0 -265
  304. package/src/sync/push-event.test.ts +0 -266
  305. package/src/sync/push-event.ts +0 -224
  306. package/src/sync/push-receiver.test.ts +0 -566
  307. package/src/sync/push-receiver.ts +0 -1048
  308. package/src/sync/push-transport.ts +0 -231
  309. package/src/sync/realtime-rollout.test.ts +0 -86
  310. package/src/sync/realtime-rollout.ts +0 -262
  311. package/src/sync/state-store.test.ts +0 -194
  312. package/src/sync/state-store.ts +0 -727
  313. package/src/sync-core.ts +0 -58
  314. package/src/sync-progress.test.ts +0 -94
  315. package/src/sync-progress.ts +0 -140
  316. package/src/telemetry-events.test.ts +0 -88
  317. package/src/telemetry-events.ts +0 -205
  318. package/src/telemetry.test.ts +0 -1280
  319. package/src/telemetry.ts +0 -1109
  320. package/src/types.ts +0 -314
  321. package/src/vault-client.test.ts +0 -1380
  322. package/src/vault-client.ts +0 -1694
  323. package/src/version.ts +0 -24
  324. package/src/watch-roots.test.ts +0 -278
  325. package/src/watch-roots.ts +0 -162
  326. package/src/watcher-event-gate.test.ts +0 -212
  327. package/src/watcher.test.ts +0 -1079
  328. package/src/watcher.ts +0 -1741
  329. package/test/e2e/sync/cross-tenant-isolation.test.ts +0 -630
  330. package/test/e2e/sync/skill-telemetry-oversized-transcript.test.ts +0 -124
  331. package/test/e2e/sync/transient-company-leg.test.ts +0 -384
  332. package/test/e2e/sync/windows-unreadable-link-leg.test.ts +0 -191
  333. package/test/e2e/watcher-real-chokidar.test.ts +0 -165
  334. package/test/e2e/watcher-recursive-backend.test.ts +0 -181
  335. package/test/e2e/watcher-scoped-coverage.test.ts +0 -381
  336. package/test/invite-flow.integration.test.ts +0 -244
  337. package/test/joiner-manifest-reconcile.integration.test.ts +0 -322
  338. package/test/share-sync.integration.test.ts +0 -213
  339. package/tsconfig.json +0 -19
  340. package/vitest.config.ts +0 -22
package/src/cli/doctor.ts DELETED
@@ -1,642 +0,0 @@
1
- /**
2
- * `hq sync doctor` — bounded skill-key dedupe + local farm GC (US-003,
3
- * hq-sync-windows-skill-symlink-collision).
4
- *
5
- * The mixed-version amplifier (see `canonicalVaultKeySpelling` in
6
- * local-path-codec.ts) leaves the vault holding several percent-encoded
7
- * GENERATIONS of every `.claude/skills/<ns>:<skill>` wrapper key (`:`, `%3A`,
8
- * `%253A`, `%25253A`, …) and the local farm holding junk-named wrapper dirs.
9
- * US-001/US-002 stop NEW generations from being minted; this doctor is the
10
- * one-shot reconcile that collapses the families already in the wild:
11
- *
12
- * 1. Vault dedupe — list keys under `.claude/skills/`, group them by their
13
- * decode-to-fixpoint canonical form, let the newest-bodied spelling win,
14
- * (re)write the canonical `:` key when it is missing or stale, and delete
15
- * every non-canonical spelling. Deletion is gated hard: only bodies that
16
- * start with the `hq-symlink:` marker, or that are byte-identical to the
17
- * canonical twin, are auto-deleted — anything else is surfaced for manual
18
- * review, never silently removed.
19
- * 2. Local farm GC — remove `.claude/skills/` entries whose names decode to
20
- * a canonical wrapper that already exists on disk and whose content is
21
- * exclusively symlink-farm material. A real file anywhere is a refusal.
22
- *
23
- * Dry-run is the DEFAULT: the full keep/rewrite/tombstone/rm plan is printed
24
- * (counts + every key/path) and nothing is written until `--yes`
25
- * (`options.yes`). Remote deletes respect the sync-delete-bulk-asymmetry-guard
26
- * policy — same thresholds, env override, and refusal semantics as
27
- * `computeDeletePlan` in share.ts. Per-item failures are loud warnings, never
28
- * process-fatal (hq-sync-deliberate-skip-not-fatal-error-exit2).
29
- */
30
-
31
- import * as fs from "fs";
32
- import * as path from "path";
33
- import { resolveEntityContext } from "../context.js";
34
- import { resolveObjectIO, type ObjectIO } from "../object-io.js";
35
- import type { ListedRemoteObject } from "../object-io.js";
36
- import { SYMLINK_BODY_PREFIX } from "../s3.js";
37
- import {
38
- canonicalVaultKeySpelling,
39
- canonicalVaultSegmentSpelling,
40
- encodeLocalVaultSegment,
41
- } from "../local-path-codec.js";
42
- import { withOperationLock } from "../operation-lock.js";
43
- import type { VaultServiceConfig } from "../types.js";
44
-
45
- /** Vault prefix the doctor is bounded to — the skill wrapper link farm. */
46
- export const SKILLS_KEY_PREFIX = ".claude/skills/";
47
-
48
- /**
49
- * Bulk-asymmetry circuit-breaker, per the sync-delete-bulk-asymmetry-guard
50
- * policy: any new delete-propagation site must ship the guard inline with the
51
- * SAME threshold defaults and env-var name as the reference implementation
52
- * (share.ts `BULK_ASYMMETRY_*` + `isBulkAsymmetryOverride`). Here the
53
- * numerator is the planned tombstone count and the denominator is every
54
- * in-scope `.claude/skills/` key — a dedupe pass that wants to delete a large
55
- * slice of the farm at once must be explicitly confirmed, because that shape
56
- * is indistinguishable from a planner bug eating the vault.
57
- */
58
- const BULK_ASYMMETRY_RATIO = 0.10;
59
- const BULK_ASYMMETRY_MIN_ABS = 10;
60
-
61
- function isBulkDeleteOverride(explicit: boolean | undefined): boolean {
62
- if (explicit) return true;
63
- const v = (process.env.HQ_SYNC_DELETE_BULK_OVERRIDE ?? "").toLowerCase();
64
- return v === "1" || v === "true" || v === "yes";
65
- }
66
-
67
- /**
68
- * The narrow object-store seam the doctor needs. Structurally satisfied by
69
- * every `ObjectIO` transport; tests inject an in-memory fake (the same
70
- * dependency-injection convention the s3.ts suites use via
71
- * `setObjectIOFactory`).
72
- */
73
- export type DoctorStore = Pick<
74
- ObjectIO,
75
- "listObjects" | "getObject" | "putObject" | "deleteObject"
76
- >;
77
-
78
- export interface SyncDoctorOptions {
79
- /** Entity whose vault to reconcile (prs_/agt_ uid, cmp_ uid, or slug). */
80
- entity: string;
81
- /** Vault service config (auth + region), as for `sync()`/`share()`. */
82
- vaultConfig: VaultServiceConfig;
83
- /** HQ root whose local `.claude/skills/` farm the GC pass walks. */
84
- hqRoot: string;
85
- /** Apply the plan. Default false = dry-run: print the plan, write nothing. */
86
- yes?: boolean;
87
- /**
88
- * Explicit bulk-delete override (the `--force-bulk` CLI flag). Equivalent to
89
- * `HQ_SYNC_DELETE_BULK_OVERRIDE=1`; without either, a tombstone plan that
90
- * trips the asymmetry thresholds is refused (writes and local GC still run).
91
- */
92
- bulkDeleteOverride?: boolean;
93
- /** DI seam for tests; defaults to the entity's resolved ObjectIO. */
94
- store?: DoctorStore;
95
- /**
96
- * Platform override for local farm-name encoding (local-path-codec
97
- * convention). Decode-to-fixpoint always uses win32 semantics — junk
98
- * spellings are a key-space phenomenon, not a host one — but the canonical
99
- * LOCAL wrapper name a junk dir must collapse into is host-specific
100
- * (`ns%3Askill` on win32, `ns:skill` on POSIX).
101
- */
102
- win32?: boolean;
103
- /**
104
- * The doctor takes the same per-root operation lock as `sync()`. Set when a
105
- * caller (runner/daemon) already holds it for this root.
106
- */
107
- operationLockAlreadyHeld?: boolean;
108
- }
109
-
110
- /** One canonical key the doctor will (re)write, and the spelling it copies. */
111
- export interface SkillKeyRewrite {
112
- key: string;
113
- /** Winning (newest-bodied) spelling whose body becomes the canonical body. */
114
- fromSpelling: string;
115
- }
116
-
117
- export interface DoctorManualReviewItem {
118
- key: string;
119
- reason: string;
120
- }
121
-
122
- export interface LocalGcManualReviewItem {
123
- path: string;
124
- reason: string;
125
- }
126
-
127
- export interface SyncDoctorPlan {
128
- /** Every listed `.claude/skills/` key (the bulk-guard denominator). */
129
- inScopeKeys: number;
130
- /** Canonical-spelling keys that need no action. */
131
- keep: string[];
132
- /** Canonical keys to (re)write from their winning spelling's body. */
133
- rewrites: SkillKeyRewrite[];
134
- /** Non-canonical spellings safe to delete (marker body or byte-identical). */
135
- tombstones: string[];
136
- /** Keys the safety gate refused to auto-delete — surfaced, never removed. */
137
- manualReview: DoctorManualReviewItem[];
138
- /** Junk-named local farm entries (symlink-farm content only) to remove. */
139
- localRemovals: string[];
140
- /** Junk-named local entries the GC refused to touch — surfaced only. */
141
- localManualReview: LocalGcManualReviewItem[];
142
- /** True when the tombstone plan tripped the bulk-asymmetry breaker. */
143
- bulkRefused: boolean;
144
- }
145
-
146
- export interface SyncDoctorResult {
147
- plan: SyncDoctorPlan;
148
- /** False on dry-run (the default) and when `--yes` was absent. */
149
- applied: boolean;
150
- keysRewritten: number;
151
- keysDeleted: number;
152
- dirsRemoved: number;
153
- /** Loud non-fatal warnings emitted during plan + apply. */
154
- warnings: number;
155
- }
156
-
157
- /** A group member whose body was fetched for winner selection / gating. */
158
- interface FetchedSpelling {
159
- key: string;
160
- lastModified: Date;
161
- body: Buffer;
162
- metadata?: Record<string, string>;
163
- }
164
-
165
- /** Payload for one canonical-key rewrite, staged at plan time. */
166
- interface RewritePayload {
167
- key: string;
168
- body: Buffer;
169
- metadata?: Record<string, string>;
170
- /** CAS fence: canonical key was listed with this ETag. */
171
- ifMatch?: string;
172
- /** CAS fence: canonical key was absent at list time. */
173
- ifNoneMatch?: "*";
174
- }
175
-
176
- function isSymlinkMarkerBody(body: Buffer): boolean {
177
- return (
178
- body.subarray(0, SYMLINK_BODY_PREFIX.length).toString("utf-8") ===
179
- SYMLINK_BODY_PREFIX
180
- );
181
- }
182
-
183
- /** Exhaustively page the skills prefix (the transport caps pages at ~1000). */
184
- async function listSkillObjects(
185
- store: DoctorStore,
186
- ): Promise<ListedRemoteObject[]> {
187
- const objects: ListedRemoteObject[] = [];
188
- let continuationToken: string | undefined;
189
- do {
190
- const page = await store.listObjects({
191
- prefix: SKILLS_KEY_PREFIX,
192
- continuationToken,
193
- });
194
- for (const object of page.objects) {
195
- objects.push(object);
196
- }
197
- continuationToken = page.nextContinuationToken;
198
- } while (continuationToken);
199
- return objects;
200
- }
201
-
202
- /**
203
- * Winner ordering: newest lastModified first ("newest-bodied spelling wins");
204
- * ties prefer the canonical spelling, then the lexicographically smallest key
205
- * so the plan is deterministic under equal timestamps.
206
- */
207
- function pickWinner(
208
- members: FetchedSpelling[],
209
- canonicalKey: string,
210
- ): FetchedSpelling {
211
- return members.reduce((best, m) => {
212
- if (m.lastModified.getTime() !== best.lastModified.getTime()) {
213
- return m.lastModified.getTime() > best.lastModified.getTime() ? m : best;
214
- }
215
- if ((m.key === canonicalKey) !== (best.key === canonicalKey)) {
216
- return m.key === canonicalKey ? m : best;
217
- }
218
- return m.key < best.key ? m : best;
219
- });
220
- }
221
-
222
- /**
223
- * True when every entry under `dir` (recursively) is symlink-farm material:
224
- * symlinks, or directories that themselves contain only symlink-farm
225
- * material. Any regular file — or anything that is neither a symlink nor a
226
- * directory (fifo, socket) — makes the tree untouchable.
227
- */
228
- function containsOnlySymlinkFarmContent(dir: string): boolean {
229
- const entries = fs.readdirSync(dir, { withFileTypes: true });
230
- for (const entry of entries) {
231
- if (entry.isSymbolicLink()) continue;
232
- if (entry.isDirectory()) {
233
- if (!containsOnlySymlinkFarmContent(path.join(dir, entry.name))) {
234
- return false;
235
- }
236
- continue;
237
- }
238
- return false;
239
- }
240
- return true;
241
- }
242
-
243
- /** lstat-based existence probe — a broken symlink wrapper still "exists". */
244
- function entryExists(p: string): boolean {
245
- try {
246
- fs.lstatSync(p);
247
- return true;
248
- } catch {
249
- return false;
250
- }
251
- }
252
-
253
- /**
254
- * Plan the local `.claude/skills/` farm GC. Pure planning — no removal here.
255
- * An entry qualifies when its name percent-decodes (to fixpoint) to a
256
- * canonical wrapper name DIFFERENT from its own spelling, that canonical
257
- * wrapper already exists on disk, and the entry is a symlink or a directory
258
- * of exclusively symlink-farm content. Everything else that is junk-named is
259
- * listed for manual review with the reason it was refused.
260
- */
261
- function planLocalSkillFarmGc(
262
- skillsDir: string,
263
- win32: boolean,
264
- warn: (message: string) => void,
265
- ): { removals: string[]; manualReview: LocalGcManualReviewItem[] } {
266
- const removals: string[] = [];
267
- const manualReview: LocalGcManualReviewItem[] = [];
268
- if (!entryExists(skillsDir)) return { removals, manualReview };
269
-
270
- let entries: fs.Dirent[];
271
- try {
272
- entries = fs.readdirSync(skillsDir, { withFileTypes: true });
273
- } catch (err) {
274
- warn(`local GC skipped — cannot read ${skillsDir}: ${String(err)}`);
275
- return { removals, manualReview };
276
- }
277
-
278
- for (const entry of entries) {
279
- // Fixpoint-decode the name (win32 key-space semantics unconditionally —
280
- // a mac's literal `ns%3Askill` junk dir is junk too), then re-encode for
281
- // THIS host to get the canonical local wrapper spelling.
282
- const canonicalName = canonicalVaultSegmentSpelling(entry.name);
283
- // A no-op canonicalization means this name is NOT an amplifier
284
- // generation: generated wrapper generations always decode back to a
285
- // `<ns>:<skill>` name, and canonicalVaultSegmentSpelling deliberately
286
- // returns colon-free names unchanged (`foo%25bar` is a legitimate
287
- // wrapper for the canonical skill name `foo%bar`, distinct from a
288
- // literal `foo%bar` dir). Encoding such a name for the host would
289
- // re-escape it into a different spelling (`foo%2525bar` on win32) and,
290
- // if that double-encoded sibling happens to exist, `--yes` would delete
291
- // the legitimate wrapper. Bail before the host encode — the amplifier
292
- // family this GC exists to collapse always changes spelling here.
293
- if (canonicalName === entry.name) continue;
294
- const canonicalLocalName = encodeLocalVaultSegment(canonicalName, win32);
295
- if (entry.name === canonicalLocalName) continue; // already canonical
296
-
297
- const fullPath = path.join(skillsDir, entry.name);
298
- if (!entryExists(path.join(skillsDir, canonicalLocalName))) {
299
- manualReview.push({
300
- path: fullPath,
301
- reason: `canonical wrapper '${canonicalLocalName}' missing on disk — junk-named entry may be the only copy`,
302
- });
303
- continue;
304
- }
305
- if (entry.isSymbolicLink()) {
306
- removals.push(fullPath);
307
- continue;
308
- }
309
- if (entry.isDirectory()) {
310
- let farmOnly = false;
311
- try {
312
- farmOnly = containsOnlySymlinkFarmContent(fullPath);
313
- } catch (err) {
314
- warn(`local GC cannot inspect ${fullPath}: ${String(err)}`);
315
- manualReview.push({ path: fullPath, reason: "unreadable — not inspected" });
316
- continue;
317
- }
318
- if (farmOnly) {
319
- removals.push(fullPath);
320
- } else {
321
- manualReview.push({
322
- path: fullPath,
323
- reason: "contains real (non-symlink) files — never auto-deleted",
324
- });
325
- }
326
- continue;
327
- }
328
- manualReview.push({
329
- path: fullPath,
330
- reason: "junk-named regular file — never auto-deleted",
331
- });
332
- }
333
- return { removals, manualReview };
334
- }
335
-
336
- /** Remove one farm entry: unlink symlinks (rmdir for win32 dir links), rm dirs. */
337
- function removeFarmEntry(fullPath: string): void {
338
- const st = fs.lstatSync(fullPath);
339
- if (st.isSymbolicLink()) {
340
- try {
341
- fs.unlinkSync(fullPath);
342
- } catch (err) {
343
- const code = (err as NodeJS.ErrnoException).code;
344
- // A Windows directory symlink is a directory reparse point; unlink()
345
- // refuses it (EPERM/EISDIR) and rmdir removes the LINK, not the target.
346
- if (code === "EPERM" || code === "EISDIR") {
347
- fs.rmdirSync(fullPath);
348
- } else {
349
- throw err;
350
- }
351
- }
352
- return;
353
- }
354
- fs.rmSync(fullPath, { recursive: true });
355
- }
356
-
357
- /**
358
- * Run the doctor: build the dedupe + GC plan, print it in full, and — only
359
- * with `yes: true` — apply it. See the module doc for semantics.
360
- */
361
- export async function syncDoctor(
362
- options: SyncDoctorOptions,
363
- ): Promise<SyncDoctorResult> {
364
- if (options.operationLockAlreadyHeld) {
365
- return syncDoctorWithOperationLockHeld(options);
366
- }
367
- return withOperationLock(options.hqRoot, "sync-doctor", () =>
368
- syncDoctorWithOperationLockHeld(options),
369
- );
370
- }
371
-
372
- async function syncDoctorWithOperationLockHeld(
373
- options: SyncDoctorOptions,
374
- ): Promise<SyncDoctorResult> {
375
- let warnings = 0;
376
- const warn = (message: string): void => {
377
- warnings++;
378
- console.error(` ! ${message}`);
379
- };
380
-
381
- const win32 = options.win32 ?? process.platform === "win32";
382
- const store =
383
- options.store ??
384
- resolveObjectIO(
385
- await resolveEntityContext(options.entity, options.vaultConfig),
386
- );
387
-
388
- // ── Vault leg: plan ────────────────────────────────────────────────────────
389
- const listed = await listSkillObjects(store);
390
- const groups = new Map<string, ListedRemoteObject[]>();
391
- for (const obj of listed) {
392
- const canonicalKey = canonicalVaultKeySpelling(obj.key);
393
- const members = groups.get(canonicalKey);
394
- if (members) {
395
- members.push(obj);
396
- } else {
397
- groups.set(canonicalKey, [obj]);
398
- }
399
- }
400
-
401
- const keep: string[] = [];
402
- const rewrites: SkillKeyRewrite[] = [];
403
- const rewritePayloads: RewritePayload[] = [];
404
- const tombstones: string[] = [];
405
- const manualReview: DoctorManualReviewItem[] = [];
406
-
407
- for (const [canonicalKey, members] of groups) {
408
- // Fast path: one spelling and it is already canonical — nothing to do,
409
- // and no body fetch (the common case must stay O(list), not O(get)).
410
- if (members.length === 1 && members[0]!.key === canonicalKey) {
411
- keep.push(canonicalKey);
412
- continue;
413
- }
414
-
415
- // Actionable family: fetch every member's body. A fetch failure demotes
416
- // that spelling to manual review (unknown bytes are never deleted) and
417
- // never aborts the run.
418
- const fetched: FetchedSpelling[] = [];
419
- for (const member of members) {
420
- try {
421
- const res = await store.getObject(member.key);
422
- fetched.push({
423
- key: member.key,
424
- lastModified: member.lastModified,
425
- body: res.body,
426
- metadata: res.metadata,
427
- });
428
- } catch (err) {
429
- warn(`body fetch failed for ${member.key}: ${String(err)} — left for manual review`);
430
- manualReview.push({
431
- key: member.key,
432
- reason: "body fetch failed — bytes unknown, not touched",
433
- });
434
- }
435
- }
436
- if (fetched.length === 0) continue; // every member failed; all warned above
437
-
438
- // A canonical spelling that is LISTED but whose body fetch failed means
439
- // the canonical bytes are unknown — rewriting from a junk sibling could
440
- // overwrite a non-marker object behind a transient read fault. Park the
441
- // whole family: no rewrite, no deletes; re-run once the read recovers.
442
- const canonicalListed = members.some((m) => m.key === canonicalKey);
443
- const canonicalMember = fetched.find((m) => m.key === canonicalKey);
444
- if (canonicalListed && canonicalMember === undefined) {
445
- for (const member of fetched) {
446
- manualReview.push({
447
- key: member.key,
448
- reason: "canonical body unknown (fetch failed) — family not touched",
449
- });
450
- }
451
- continue;
452
- }
453
-
454
- const winner = pickWinner(fetched, canonicalKey);
455
-
456
- // The body the canonical key will hold after this pass: the newest-bodied
457
- // spelling's. (Re)write when the canonical key is missing entirely or its
458
- // bytes are stale relative to the winner.
459
- const finalBody = winner.body;
460
- if (!canonicalMember || !canonicalMember.body.equals(finalBody)) {
461
- rewrites.push({ key: canonicalKey, fromSpelling: winner.key });
462
- // CAS fence (same contract as the push path): if the canonical key was
463
- // listed, the PUT lands only while its ETag is unchanged; if it was
464
- // absent, only while it is still absent. A concurrent upload from
465
- // another machine turns the rewrite into a 412 warning (and the
466
- // failed-rewrite guard below keeps the family's tombstones), never a
467
- // clobber of bytes this run has not seen.
468
- const listedCanonical = members.find((m) => m.key === canonicalKey);
469
- rewritePayloads.push({
470
- key: canonicalKey,
471
- body: finalBody,
472
- metadata: winner.metadata,
473
- ...(listedCanonical
474
- ? { ifMatch: listedCanonical.etag }
475
- : { ifNoneMatch: "*" as const }),
476
- });
477
- } else {
478
- keep.push(canonicalKey);
479
- }
480
-
481
- // Safety gate, per spelling: auto-delete ONLY symlink-marker bodies or
482
- // bodies byte-identical to the canonical twin's final content.
483
- for (const member of fetched) {
484
- if (member.key === canonicalKey) continue;
485
- if (isSymlinkMarkerBody(member.body) || member.body.equals(finalBody)) {
486
- tombstones.push(member.key);
487
- } else {
488
- manualReview.push({
489
- key: member.key,
490
- reason: "body is neither a symlink marker nor byte-identical to the canonical key — not auto-deleted",
491
- });
492
- }
493
- }
494
- }
495
-
496
- // ── Bulk-asymmetry decision (policy: sync-delete-bulk-asymmetry-guard) ────
497
- const bulkRefused =
498
- !isBulkDeleteOverride(options.bulkDeleteOverride) &&
499
- tombstones.length >= BULK_ASYMMETRY_MIN_ABS &&
500
- listed.length > 0 &&
501
- tombstones.length / listed.length >= BULK_ASYMMETRY_RATIO;
502
-
503
- // ── Local leg: plan ───────────────────────────────────────────────────────
504
- const skillsDir = path.join(options.hqRoot, ".claude", "skills");
505
- const localGc = planLocalSkillFarmGc(skillsDir, win32, warn);
506
-
507
- const plan: SyncDoctorPlan = {
508
- inScopeKeys: listed.length,
509
- keep,
510
- rewrites,
511
- tombstones,
512
- manualReview,
513
- localRemovals: localGc.removals,
514
- localManualReview: localGc.manualReview,
515
- bulkRefused,
516
- };
517
- printPlan(plan);
518
-
519
- const result: SyncDoctorResult = {
520
- plan,
521
- applied: false,
522
- keysRewritten: 0,
523
- keysDeleted: 0,
524
- dirsRemoved: 0,
525
- warnings,
526
- };
527
-
528
- // ── Dry-run is the default: full plan printed, nothing written. ───────────
529
- if (!options.yes) {
530
- console.log("\nDry-run (default): nothing written. Re-run with --yes to apply.");
531
- result.warnings = warnings;
532
- return result;
533
- }
534
-
535
- // ── Apply: canonical rewrites first (additive), then gated deletes, then
536
- // local GC. Per-item failures warn and continue — never fatal. ─────────
537
- // Canonical keys whose rewrite failed: their families' tombstones must NOT
538
- // be deleted below — when the canonical body was missing or stale, the junk
539
- // spelling may hold the newest (or only) remote copy, and deleting it after
540
- // a failed rewrite would drop that body permanently.
541
- const failedRewriteCanonicals = new Set<string>();
542
- for (const payload of rewritePayloads) {
543
- try {
544
- await store.putObject({
545
- key: payload.key,
546
- body: payload.body,
547
- // Content-type is not consulted by the engine's read path; marker
548
- // records upload as octet-stream (s3.ts uploadSymlink convention).
549
- contentType: "application/octet-stream",
550
- metadata: payload.metadata,
551
- ifMatch: payload.ifMatch,
552
- ifNoneMatch: payload.ifNoneMatch,
553
- });
554
- result.keysRewritten++;
555
- } catch (err) {
556
- failedRewriteCanonicals.add(payload.key);
557
- warn(`canonical rewrite failed for ${payload.key}: ${String(err)}`);
558
- }
559
- }
560
-
561
- if (bulkRefused) {
562
- // Refusal is event-only (policy req #4): nothing deleted, nothing
563
- // journaled away — re-run with the override once the plan is reviewed.
564
- console.error(
565
- ` ! bulk-asymmetry circuit-breaker tripped: ${tombstones.length}/${listed.length} in-scope skill keys planned for deletion.\n` +
566
- ` Refusing the delete leg — review the plan above, then re-run with --force-bulk (or HQ_SYNC_DELETE_BULK_OVERRIDE=1) to apply it.`,
567
- );
568
- } else {
569
- for (const key of tombstones) {
570
- if (failedRewriteCanonicals.has(canonicalVaultKeySpelling(key))) {
571
- warn(
572
- `skipping delete of ${key} — its canonical rewrite failed; re-run the doctor once the write path recovers`,
573
- );
574
- continue;
575
- }
576
- try {
577
- await store.deleteObject(key);
578
- result.keysDeleted++;
579
- } catch (err) {
580
- warn(`delete failed for ${key}: ${String(err)}`);
581
- }
582
- }
583
- }
584
-
585
- for (const fullPath of plan.localRemovals) {
586
- try {
587
- // Re-verify at apply time: the entry may have changed between plan and
588
- // apply (sync pass, user edit). Positive check — remove ONLY what is
589
- // still a symlink or a farm-only directory; anything else (a regular
590
- // file that replaced the planned entry, a dir that grew real files) is
591
- // refused rather than trusted from the plan.
592
- const st = fs.lstatSync(fullPath);
593
- const stillFarmEntry =
594
- st.isSymbolicLink() ||
595
- (st.isDirectory() && containsOnlySymlinkFarmContent(fullPath));
596
- if (!stillFarmEntry) {
597
- warn(`skipped ${fullPath} — no longer symlink-farm content (changed since planning)`);
598
- continue;
599
- }
600
- removeFarmEntry(fullPath);
601
- result.dirsRemoved++;
602
- } catch (err) {
603
- warn(`local removal failed for ${fullPath}: ${String(err)}`);
604
- }
605
- }
606
-
607
- result.applied = true;
608
- result.warnings = warnings;
609
- console.log(
610
- `\nApplied: ${result.keysRewritten} canonical key(s) written, ${result.keysDeleted} spelling(s) deleted, ${result.dirsRemoved} local entr(ies) removed.`,
611
- );
612
- return result;
613
- }
614
-
615
- /** Print the full plan: counts plus every key/path in each bucket. */
616
- function printPlan(plan: SyncDoctorPlan): void {
617
- console.log(`hq sync doctor — skill-key dedupe plan (${SKILLS_KEY_PREFIX})`);
618
- console.log(` in-scope keys: ${plan.inScopeKeys}`);
619
- console.log(` keep (canonical, no action): ${plan.keep.length}`);
620
- for (const key of plan.keep) console.log(` = ${key}`);
621
- console.log(` rewrite canonical: ${plan.rewrites.length}`);
622
- for (const r of plan.rewrites) {
623
- console.log(` + ${r.key} (body from ${r.fromSpelling})`);
624
- }
625
- console.log(` tombstone (delete non-canonical spelling): ${plan.tombstones.length}`);
626
- for (const key of plan.tombstones) console.log(` - ${key}`);
627
- console.log(` manual review (NOT deleted): ${plan.manualReview.length}`);
628
- for (const item of plan.manualReview) {
629
- console.log(` ? ${item.key} — ${item.reason}`);
630
- }
631
- console.log(` local farm GC — remove: ${plan.localRemovals.length}`);
632
- for (const p of plan.localRemovals) console.log(` - ${p}`);
633
- console.log(` local farm GC — manual review: ${plan.localManualReview.length}`);
634
- for (const item of plan.localManualReview) {
635
- console.log(` ? ${item.path} — ${item.reason}`);
636
- }
637
- if (plan.bulkRefused) {
638
- console.log(
639
- ` bulk-asymmetry: delete leg WOULD BE REFUSED (${plan.tombstones.length}/${plan.inScopeKeys} keys; override with --force-bulk or HQ_SYNC_DELETE_BULK_OVERRIDE=1)`,
640
- );
641
- }
642
- }
package/src/cli/index.ts DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * hq-cloud CLI entry points.
3
- *
4
- * Registers `hq share`, `hq sync`, and membership commands.
5
- * These are consumed by @indigoai-us/hq-cli or invoked directly.
6
- */
7
-
8
- export { share } from "./share.js";
9
- export type { ShareOptions, ShareResult } from "./share.js";
10
-
11
- export { sync } from "./sync.js";
12
- export type { SyncOptions, SyncResult, SyncProgressEvent } from "./sync.js";
13
-
14
- export { resolveConflict, showDiff } from "./conflict.js";
15
- export type { ConflictStrategy, ConflictInfo, ConflictResolution } from "./conflict.js";
16
-
17
- // Membership commands (VLT-7)
18
- export { invite, listInvites, revokeInvite } from "./invite.js";
19
- export type { InviteOptions, InviteResult, InviteListOptions, InviteRevokeOptions } from "./invite.js";
20
-
21
- export { accept, parseToken } from "./accept.js";
22
- export type { AcceptOptions, AcceptResult } from "./accept.js";
23
-
24
- export { promote } from "./promote.js";
25
- export type { PromoteOptions, PromoteResult } from "./promote.js";
26
-
27
- // Skill/personal-overlay mirroring + workers-registry regen (formerly the
28
- // hq-core master-sync.sh hook; `hq reindex`).
29
- export { reindex } from "./reindex.js";
30
- export type { ReindexOptions, ReindexResult } from "./reindex.js";
31
-
32
- // Drift-preserving HQ-core re-sync (formerly bundled only inside the HQ Sync
33
- // menubar app). Now shared between the app and `hq rescue`.
34
- export { rescue, buildRescueArgs } from "./rescue.js";
35
- export type { RescueOptions, RescueResult } from "./rescue.js";
36
-
37
- // Bounded skill-key dedupe + local `.claude/skills/` farm GC for the
38
- // mixed-version amplifier (`hq sync doctor`, US-003
39
- // hq-sync-windows-skill-symlink-collision). Dry-run by default; --yes applies.
40
- export { syncDoctor, SKILLS_KEY_PREFIX } from "./doctor.js";
41
- export type {
42
- SyncDoctorOptions,
43
- SyncDoctorResult,
44
- SyncDoctorPlan,
45
- SkillKeyRewrite,
46
- DoctorManualReviewItem,
47
- LocalGcManualReviewItem,
48
- DoctorStore,
49
- } from "./doctor.js";