harnery 0.0.1 → 0.2.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 (445) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +84 -2
  3. package/bin/agent-coord +42 -0
  4. package/bin/agent-hook +44 -0
  5. package/bin/harn +40 -0
  6. package/dist/cli.d.ts +9 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +18 -0
  9. package/dist/commander.d.ts +128 -0
  10. package/dist/commander.d.ts.map +1 -0
  11. package/dist/commander.js +126 -0
  12. package/dist/commands/agents.d.ts +18 -0
  13. package/dist/commands/agents.d.ts.map +1 -0
  14. package/dist/commands/agents.js +3946 -0
  15. package/dist/commands/backup.d.ts +22 -0
  16. package/dist/commands/backup.d.ts.map +1 -0
  17. package/dist/commands/backup.js +262 -0
  18. package/dist/commands/browse-ai.d.ts +4 -0
  19. package/dist/commands/browse-ai.d.ts.map +1 -0
  20. package/dist/commands/browse-ai.js +156 -0
  21. package/dist/commands/browse.d.ts +4 -0
  22. package/dist/commands/browse.d.ts.map +1 -0
  23. package/dist/commands/browse.js +590 -0
  24. package/dist/commands/callers.d.ts +4 -0
  25. package/dist/commands/callers.d.ts.map +1 -0
  26. package/dist/commands/callers.js +276 -0
  27. package/dist/commands/completion.d.ts +17 -0
  28. package/dist/commands/completion.d.ts.map +1 -0
  29. package/dist/commands/completion.js +158 -0
  30. package/dist/commands/config-get.d.ts +4 -0
  31. package/dist/commands/config-get.d.ts.map +1 -0
  32. package/dist/commands/config-get.js +131 -0
  33. package/dist/commands/context.d.ts +11 -0
  34. package/dist/commands/context.d.ts.map +1 -0
  35. package/dist/commands/context.js +185 -0
  36. package/dist/commands/cookies.d.ts +4 -0
  37. package/dist/commands/cookies.d.ts.map +1 -0
  38. package/dist/commands/cookies.js +140 -0
  39. package/dist/commands/docs.d.ts +4 -0
  40. package/dist/commands/docs.d.ts.map +1 -0
  41. package/dist/commands/docs.js +137 -0
  42. package/dist/commands/doctor.d.ts +25 -0
  43. package/dist/commands/doctor.d.ts.map +1 -0
  44. package/dist/commands/doctor.js +200 -0
  45. package/dist/commands/edit-batch.d.ts +18 -0
  46. package/dist/commands/edit-batch.d.ts.map +1 -0
  47. package/dist/commands/edit-batch.js +172 -0
  48. package/dist/commands/eml.d.ts +4 -0
  49. package/dist/commands/eml.d.ts.map +1 -0
  50. package/dist/commands/eml.js +428 -0
  51. package/dist/commands/env.d.ts +4 -0
  52. package/dist/commands/env.d.ts.map +1 -0
  53. package/dist/commands/env.js +201 -0
  54. package/dist/commands/fetch.d.ts +4 -0
  55. package/dist/commands/fetch.d.ts.map +1 -0
  56. package/dist/commands/fetch.js +99 -0
  57. package/dist/commands/file-history.d.ts +4 -0
  58. package/dist/commands/file-history.d.ts.map +1 -0
  59. package/dist/commands/file-history.js +152 -0
  60. package/dist/commands/grep.d.ts +4 -0
  61. package/dist/commands/grep.d.ts.map +1 -0
  62. package/dist/commands/grep.js +317 -0
  63. package/dist/commands/init.d.ts +82 -0
  64. package/dist/commands/init.d.ts.map +1 -0
  65. package/dist/commands/init.js +288 -0
  66. package/dist/commands/outline.d.ts +4 -0
  67. package/dist/commands/outline.d.ts.map +1 -0
  68. package/dist/commands/outline.js +494 -0
  69. package/dist/commands/presence.d.ts +12 -0
  70. package/dist/commands/presence.d.ts.map +1 -0
  71. package/dist/commands/presence.js +123 -0
  72. package/dist/commands/read.d.ts +7 -0
  73. package/dist/commands/read.d.ts.map +1 -0
  74. package/dist/commands/read.js +46 -0
  75. package/dist/commands/scratch.d.ts +4 -0
  76. package/dist/commands/scratch.d.ts.map +1 -0
  77. package/dist/commands/scratch.js +426 -0
  78. package/dist/commands/session.d.ts +4 -0
  79. package/dist/commands/session.d.ts.map +1 -0
  80. package/dist/commands/session.js +162 -0
  81. package/dist/commands/sync.d.ts +24 -0
  82. package/dist/commands/sync.d.ts.map +1 -0
  83. package/dist/commands/sync.js +275 -0
  84. package/dist/commands/toc.d.ts +5 -0
  85. package/dist/commands/toc.d.ts.map +1 -0
  86. package/dist/commands/toc.js +153 -0
  87. package/dist/commands/tokens.d.ts +4 -0
  88. package/dist/commands/tokens.d.ts.map +1 -0
  89. package/dist/commands/tokens.js +48 -0
  90. package/dist/commands/tunnel.d.ts +4 -0
  91. package/dist/commands/tunnel.d.ts.map +1 -0
  92. package/dist/commands/tunnel.js +513 -0
  93. package/dist/commands/uninstall.d.ts +22 -0
  94. package/dist/commands/uninstall.d.ts.map +1 -0
  95. package/dist/commands/uninstall.js +126 -0
  96. package/dist/commands/web.d.ts +4 -0
  97. package/dist/commands/web.d.ts.map +1 -0
  98. package/dist/commands/web.js +165 -0
  99. package/dist/core/agents/canonical-emit.d.ts +27 -0
  100. package/dist/core/agents/canonical-emit.d.ts.map +1 -0
  101. package/dist/core/agents/canonical-emit.js +72 -0
  102. package/dist/core/agents/cli-emit.d.ts +27 -0
  103. package/dist/core/agents/cli-emit.d.ts.map +1 -0
  104. package/dist/core/agents/cli-emit.js +57 -0
  105. package/dist/core/agents/cli.d.ts +10 -0
  106. package/dist/core/agents/cli.d.ts.map +1 -0
  107. package/dist/core/agents/cli.js +757 -0
  108. package/dist/core/agents/codex-replay.d.ts +29 -0
  109. package/dist/core/agents/codex-replay.d.ts.map +1 -0
  110. package/dist/core/agents/codex-replay.js +138 -0
  111. package/dist/core/agents/coord-client.d.ts +98 -0
  112. package/dist/core/agents/coord-client.d.ts.map +1 -0
  113. package/dist/core/agents/coord-client.js +212 -0
  114. package/dist/core/agents/events/consume.d.ts +59 -0
  115. package/dist/core/agents/events/consume.d.ts.map +1 -0
  116. package/dist/core/agents/events/consume.js +147 -0
  117. package/dist/core/agents/events/emit.d.ts +42 -0
  118. package/dist/core/agents/events/emit.d.ts.map +1 -0
  119. package/dist/core/agents/events/emit.js +70 -0
  120. package/dist/core/agents/events/ulid.d.ts +11 -0
  121. package/dist/core/agents/events/ulid.d.ts.map +1 -0
  122. package/dist/core/agents/events/ulid.js +47 -0
  123. package/dist/core/agents/index.d.ts +14 -0
  124. package/dist/core/agents/index.d.ts.map +1 -0
  125. package/dist/core/agents/index.js +13 -0
  126. package/dist/core/agents/paths.d.ts +6 -0
  127. package/dist/core/agents/paths.d.ts.map +1 -0
  128. package/dist/core/agents/paths.js +17 -0
  129. package/dist/core/agents/render/prompt-context.d.ts +43 -0
  130. package/dist/core/agents/render/prompt-context.d.ts.map +1 -0
  131. package/dist/core/agents/render/prompt-context.js +335 -0
  132. package/dist/core/agents/render/session-context.d.ts +39 -0
  133. package/dist/core/agents/render/session-context.d.ts.map +1 -0
  134. package/dist/core/agents/render/session-context.js +283 -0
  135. package/dist/core/agents/rules/claim-conflict.d.ts +35 -0
  136. package/dist/core/agents/rules/claim-conflict.d.ts.map +1 -0
  137. package/dist/core/agents/rules/claim-conflict.js +244 -0
  138. package/dist/core/agents/rules/commit-conflict.d.ts +59 -0
  139. package/dist/core/agents/rules/commit-conflict.d.ts.map +1 -0
  140. package/dist/core/agents/rules/commit-conflict.js +244 -0
  141. package/dist/core/agents/rules/stop-hook.d.ts +44 -0
  142. package/dist/core/agents/rules/stop-hook.d.ts.map +1 -0
  143. package/dist/core/agents/rules/stop-hook.js +161 -0
  144. package/dist/core/agents/session-events.d.ts +41 -0
  145. package/dist/core/agents/session-events.d.ts.map +1 -0
  146. package/dist/core/agents/session-events.js +205 -0
  147. package/dist/core/agents/state/activity-log.d.ts +18 -0
  148. package/dist/core/agents/state/activity-log.d.ts.map +1 -0
  149. package/dist/core/agents/state/activity-log.js +34 -0
  150. package/dist/core/agents/state/council.d.ts +39 -0
  151. package/dist/core/agents/state/council.d.ts.map +1 -0
  152. package/dist/core/agents/state/council.js +216 -0
  153. package/dist/core/agents/state/heartbeat-projector.d.ts +59 -0
  154. package/dist/core/agents/state/heartbeat-projector.d.ts.map +1 -0
  155. package/dist/core/agents/state/heartbeat-projector.js +436 -0
  156. package/dist/core/agents/state/heartbeat-writer.d.ts +64 -0
  157. package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -0
  158. package/dist/core/agents/state/heartbeat-writer.js +271 -0
  159. package/dist/core/agents/state/names.d.ts +35 -0
  160. package/dist/core/agents/state/names.d.ts.map +1 -0
  161. package/dist/core/agents/state/names.js +376 -0
  162. package/dist/core/agents/state/pidmap.d.ts +11 -0
  163. package/dist/core/agents/state/pidmap.d.ts.map +1 -0
  164. package/dist/core/agents/state/pidmap.js +32 -0
  165. package/dist/core/agents/state/scratch.d.ts +27 -0
  166. package/dist/core/agents/state/scratch.d.ts.map +1 -0
  167. package/dist/core/agents/state/scratch.js +90 -0
  168. package/dist/core/agents/state/shell-mutation.d.ts +17 -0
  169. package/dist/core/agents/state/shell-mutation.d.ts.map +1 -0
  170. package/dist/core/agents/state/shell-mutation.js +41 -0
  171. package/dist/core/agents/state/stale-sweep.d.ts +16 -0
  172. package/dist/core/agents/state/stale-sweep.d.ts.map +1 -0
  173. package/dist/core/agents/state/stale-sweep.js +166 -0
  174. package/dist/core/config.d.ts +29 -0
  175. package/dist/core/config.d.ts.map +1 -0
  176. package/dist/core/config.js +108 -0
  177. package/dist/core/hooks/cli.d.ts +21 -0
  178. package/dist/core/hooks/cli.d.ts.map +1 -0
  179. package/dist/core/hooks/cli.js +1123 -0
  180. package/dist/core/hooks/effects/image-capture.d.ts +43 -0
  181. package/dist/core/hooks/effects/image-capture.d.ts.map +1 -0
  182. package/dist/core/hooks/effects/image-capture.js +288 -0
  183. package/dist/core/hooks/effects/index.d.ts +64 -0
  184. package/dist/core/hooks/effects/index.d.ts.map +1 -0
  185. package/dist/core/hooks/effects/index.js +197 -0
  186. package/dist/core/hooks/events/emit.d.ts +31 -0
  187. package/dist/core/hooks/events/emit.d.ts.map +1 -0
  188. package/dist/core/hooks/events/emit.js +89 -0
  189. package/dist/core/hooks/events/schema.d.ts +235 -0
  190. package/dist/core/hooks/events/schema.d.ts.map +1 -0
  191. package/dist/core/hooks/events/schema.js +12 -0
  192. package/dist/core/hooks/events/ulid.d.ts +10 -0
  193. package/dist/core/hooks/events/ulid.d.ts.map +1 -0
  194. package/dist/core/hooks/events/ulid.js +47 -0
  195. package/dist/core/hooks/harness/detect.d.ts +9 -0
  196. package/dist/core/hooks/harness/detect.d.ts.map +1 -0
  197. package/dist/core/hooks/harness/detect.js +29 -0
  198. package/dist/core/hooks/harness/events.d.ts +45 -0
  199. package/dist/core/hooks/harness/events.d.ts.map +1 -0
  200. package/dist/core/hooks/harness/events.js +71 -0
  201. package/dist/core/hooks/harness/output.d.ts +46 -0
  202. package/dist/core/hooks/harness/output.d.ts.map +1 -0
  203. package/dist/core/hooks/harness/output.js +87 -0
  204. package/dist/core/hooks/harness/parse.d.ts +67 -0
  205. package/dist/core/hooks/harness/parse.d.ts.map +1 -0
  206. package/dist/core/hooks/harness/parse.js +132 -0
  207. package/dist/core/hooks/index.d.ts +8 -0
  208. package/dist/core/hooks/index.d.ts.map +1 -0
  209. package/dist/core/hooks/index.js +7 -0
  210. package/dist/core/hooks/resolve/anchor.d.ts +37 -0
  211. package/dist/core/hooks/resolve/anchor.d.ts.map +1 -0
  212. package/dist/core/hooks/resolve/anchor.js +48 -0
  213. package/dist/core/hooks/resolve/coord-root.d.ts +6 -0
  214. package/dist/core/hooks/resolve/coord-root.d.ts.map +1 -0
  215. package/dist/core/hooks/resolve/coord-root.js +27 -0
  216. package/dist/core/hooks/resolve/intent.d.ts +33 -0
  217. package/dist/core/hooks/resolve/intent.d.ts.map +1 -0
  218. package/dist/core/hooks/resolve/intent.js +79 -0
  219. package/dist/core/hooks/resolve/owner.d.ts +42 -0
  220. package/dist/core/hooks/resolve/owner.d.ts.map +1 -0
  221. package/dist/core/hooks/resolve/owner.js +140 -0
  222. package/dist/core/hooks/resolve/transcript.d.ts +26 -0
  223. package/dist/core/hooks/resolve/transcript.d.ts.map +1 -0
  224. package/dist/core/hooks/resolve/transcript.js +73 -0
  225. package/dist/index.d.ts +15 -0
  226. package/dist/index.d.ts.map +1 -0
  227. package/dist/index.js +13 -0
  228. package/dist/lib/agent-browser/client.d.ts +99 -0
  229. package/dist/lib/agent-browser/client.d.ts.map +1 -0
  230. package/dist/lib/agent-browser/client.js +177 -0
  231. package/dist/lib/agent-browser/index.d.ts +2 -0
  232. package/dist/lib/agent-browser/index.d.ts.map +1 -0
  233. package/dist/lib/agent-browser/index.js +1 -0
  234. package/dist/lib/browser/client.d.ts +193 -0
  235. package/dist/lib/browser/client.d.ts.map +1 -0
  236. package/dist/lib/browser/client.js +325 -0
  237. package/dist/lib/browser/dev-overlay.d.ts +23 -0
  238. package/dist/lib/browser/dev-overlay.d.ts.map +1 -0
  239. package/dist/lib/browser/dev-overlay.js +153 -0
  240. package/dist/lib/browser/index.d.ts +5 -0
  241. package/dist/lib/browser/index.d.ts.map +1 -0
  242. package/dist/lib/browser/index.js +2 -0
  243. package/dist/lib/browser/layout.d.ts +79 -0
  244. package/dist/lib/browser/layout.d.ts.map +1 -0
  245. package/dist/lib/browser/layout.js +220 -0
  246. package/dist/lib/browser/visibility.d.ts +86 -0
  247. package/dist/lib/browser/visibility.d.ts.map +1 -0
  248. package/dist/lib/browser/visibility.js +333 -0
  249. package/dist/lib/browser/visual-diff.d.ts +38 -0
  250. package/dist/lib/browser/visual-diff.d.ts.map +1 -0
  251. package/dist/lib/browser/visual-diff.js +107 -0
  252. package/dist/lib/completion/bash.d.ts +25 -0
  253. package/dist/lib/completion/bash.d.ts.map +1 -0
  254. package/dist/lib/completion/bash.js +284 -0
  255. package/dist/lib/completion/fish.d.ts +16 -0
  256. package/dist/lib/completion/fish.d.ts.map +1 -0
  257. package/dist/lib/completion/fish.js +118 -0
  258. package/dist/lib/completion/index.d.ts +5 -0
  259. package/dist/lib/completion/index.d.ts.map +1 -0
  260. package/dist/lib/completion/index.js +4 -0
  261. package/dist/lib/completion/walk.d.ts +68 -0
  262. package/dist/lib/completion/walk.d.ts.map +1 -0
  263. package/dist/lib/completion/walk.js +102 -0
  264. package/dist/lib/completion/zsh.d.ts +13 -0
  265. package/dist/lib/completion/zsh.d.ts.map +1 -0
  266. package/dist/lib/completion/zsh.js +249 -0
  267. package/dist/lib/context/index.d.ts +107 -0
  268. package/dist/lib/context/index.d.ts.map +1 -0
  269. package/dist/lib/context/index.js +275 -0
  270. package/dist/lib/cookies/client.d.ts +131 -0
  271. package/dist/lib/cookies/client.d.ts.map +1 -0
  272. package/dist/lib/cookies/client.js +239 -0
  273. package/dist/lib/cookies/index.d.ts +2 -0
  274. package/dist/lib/cookies/index.d.ts.map +1 -0
  275. package/dist/lib/cookies/index.js +1 -0
  276. package/dist/lib/council/index.d.ts +266 -0
  277. package/dist/lib/council/index.d.ts.map +1 -0
  278. package/dist/lib/council/index.js +674 -0
  279. package/dist/lib/docs-index.d.ts +28 -0
  280. package/dist/lib/docs-index.d.ts.map +1 -0
  281. package/dist/lib/docs-index.js +169 -0
  282. package/dist/lib/docs-lint.d.ts +26 -0
  283. package/dist/lib/docs-lint.d.ts.map +1 -0
  284. package/dist/lib/docs-lint.js +378 -0
  285. package/dist/lib/docs-sweep.d.ts +34 -0
  286. package/dist/lib/docs-sweep.d.ts.map +1 -0
  287. package/dist/lib/docs-sweep.js +304 -0
  288. package/dist/lib/docs.d.ts +27 -0
  289. package/dist/lib/docs.d.ts.map +1 -0
  290. package/dist/lib/docs.js +142 -0
  291. package/dist/lib/env.d.ts +11 -0
  292. package/dist/lib/env.d.ts.map +1 -0
  293. package/dist/lib/env.js +12 -0
  294. package/dist/lib/exec.d.ts +32 -0
  295. package/dist/lib/exec.d.ts.map +1 -0
  296. package/dist/lib/exec.js +54 -0
  297. package/dist/lib/format.d.ts +29 -0
  298. package/dist/lib/format.d.ts.map +1 -0
  299. package/dist/lib/format.js +139 -0
  300. package/dist/lib/http/client.d.ts +56 -0
  301. package/dist/lib/http/client.d.ts.map +1 -0
  302. package/dist/lib/http/client.js +160 -0
  303. package/dist/lib/http/index.d.ts +2 -0
  304. package/dist/lib/http/index.d.ts.map +1 -0
  305. package/dist/lib/http/index.js +1 -0
  306. package/dist/lib/identities/index.d.ts +77 -0
  307. package/dist/lib/identities/index.d.ts.map +1 -0
  308. package/dist/lib/identities/index.js +190 -0
  309. package/dist/lib/machine.d.ts +19 -0
  310. package/dist/lib/machine.d.ts.map +1 -0
  311. package/dist/lib/machine.js +61 -0
  312. package/dist/lib/presence.d.ts +48 -0
  313. package/dist/lib/presence.d.ts.map +1 -0
  314. package/dist/lib/presence.js +123 -0
  315. package/dist/lib/readability/client.d.ts +32 -0
  316. package/dist/lib/readability/client.d.ts.map +1 -0
  317. package/dist/lib/readability/client.js +119 -0
  318. package/dist/lib/readability/index.d.ts +2 -0
  319. package/dist/lib/readability/index.d.ts.map +1 -0
  320. package/dist/lib/readability/index.js +1 -0
  321. package/dist/lib/scratch/index.d.ts +74 -0
  322. package/dist/lib/scratch/index.d.ts.map +1 -0
  323. package/dist/lib/scratch/index.js +393 -0
  324. package/dist/lib/tunnel/gate.d.ts +12 -0
  325. package/dist/lib/tunnel/gate.d.ts.map +1 -0
  326. package/dist/lib/tunnel/gate.js +101 -0
  327. package/dist/lib/tunnel/state.d.ts +34 -0
  328. package/dist/lib/tunnel/state.d.ts.map +1 -0
  329. package/dist/lib/tunnel/state.js +132 -0
  330. package/package.json +160 -8
  331. package/schemas/.gitkeep +0 -0
  332. package/schemas/config.schema.json +109 -0
  333. package/src/cli.ts +22 -0
  334. package/src/commander.ts +242 -0
  335. package/src/commands/.gitkeep +0 -0
  336. package/src/commands/agents.ts +4567 -0
  337. package/src/commands/backup.ts +305 -0
  338. package/src/commands/browse-ai.ts +198 -0
  339. package/src/commands/browse.ts +849 -0
  340. package/src/commands/callers.ts +363 -0
  341. package/src/commands/completion.ts +193 -0
  342. package/src/commands/config-get.ts +161 -0
  343. package/src/commands/context.ts +209 -0
  344. package/src/commands/cookies.ts +198 -0
  345. package/src/commands/docs.ts +174 -0
  346. package/src/commands/doctor.ts +231 -0
  347. package/src/commands/edit-batch.ts +233 -0
  348. package/src/commands/eml.ts +519 -0
  349. package/src/commands/env.ts +254 -0
  350. package/src/commands/fetch.ts +136 -0
  351. package/src/commands/file-history.ts +202 -0
  352. package/src/commands/grep.ts +371 -0
  353. package/src/commands/init.ts +335 -0
  354. package/src/commands/outline.ts +564 -0
  355. package/src/commands/presence.ts +152 -0
  356. package/src/commands/read.ts +64 -0
  357. package/src/commands/scratch.ts +445 -0
  358. package/src/commands/session.ts +187 -0
  359. package/src/commands/sync.ts +306 -0
  360. package/src/commands/toc.ts +218 -0
  361. package/src/commands/tokens.ts +79 -0
  362. package/src/commands/tunnel.ts +633 -0
  363. package/src/commands/uninstall.ts +144 -0
  364. package/src/commands/web.ts +193 -0
  365. package/src/core/agents/canonical-emit.ts +77 -0
  366. package/src/core/agents/cli-emit.ts +64 -0
  367. package/src/core/agents/cli.ts +838 -0
  368. package/src/core/agents/codex-replay.ts +163 -0
  369. package/src/core/agents/coord-client.ts +249 -0
  370. package/src/core/agents/events/consume.ts +196 -0
  371. package/src/core/agents/events/emit.ts +108 -0
  372. package/src/core/agents/events/ulid.ts +51 -0
  373. package/src/core/agents/index.ts +14 -0
  374. package/src/core/agents/paths.ts +16 -0
  375. package/src/core/agents/render/prompt-context.ts +401 -0
  376. package/src/core/agents/render/session-context.ts +341 -0
  377. package/src/core/agents/rules/claim-conflict.ts +282 -0
  378. package/src/core/agents/rules/commit-conflict.ts +303 -0
  379. package/src/core/agents/rules/stop-hook.ts +229 -0
  380. package/src/core/agents/session-events.ts +228 -0
  381. package/src/core/agents/state/activity-log.ts +33 -0
  382. package/src/core/agents/state/council.ts +265 -0
  383. package/src/core/agents/state/heartbeat-projector.ts +488 -0
  384. package/src/core/agents/state/heartbeat-writer.ts +333 -0
  385. package/src/core/agents/state/names.ts +399 -0
  386. package/src/core/agents/state/pidmap.ts +38 -0
  387. package/src/core/agents/state/scratch.ts +121 -0
  388. package/src/core/agents/state/shell-mutation.ts +44 -0
  389. package/src/core/agents/state/stale-sweep.ts +190 -0
  390. package/src/core/config.ts +111 -0
  391. package/src/core/hooks/cli.ts +1247 -0
  392. package/src/core/hooks/effects/image-capture.ts +330 -0
  393. package/src/core/hooks/effects/index.ts +210 -0
  394. package/src/core/hooks/events/emit.ts +120 -0
  395. package/src/core/hooks/events/schema.ts +430 -0
  396. package/src/core/hooks/events/ulid.ts +51 -0
  397. package/src/core/hooks/harness/detect.ts +30 -0
  398. package/src/core/hooks/harness/events.ts +102 -0
  399. package/src/core/hooks/harness/output.ts +100 -0
  400. package/src/core/hooks/harness/parse.ts +180 -0
  401. package/src/core/hooks/index.ts +16 -0
  402. package/src/core/hooks/resolve/anchor.ts +51 -0
  403. package/src/core/hooks/resolve/coord-root.ts +25 -0
  404. package/src/core/hooks/resolve/intent.ts +89 -0
  405. package/src/core/hooks/resolve/owner.ts +140 -0
  406. package/src/core/hooks/resolve/transcript.ts +72 -0
  407. package/src/hooks/.gitkeep +0 -0
  408. package/src/index.ts +15 -0
  409. package/src/lib/agent-browser/client.ts +239 -0
  410. package/src/lib/agent-browser/index.ts +1 -0
  411. package/src/lib/browser/client.ts +449 -0
  412. package/src/lib/browser/dev-overlay.ts +207 -0
  413. package/src/lib/browser/index.ts +24 -0
  414. package/src/lib/browser/layout.ts +288 -0
  415. package/src/lib/browser/visibility.ts +419 -0
  416. package/src/lib/browser/visual-diff.ts +150 -0
  417. package/src/lib/completion/bash.ts +291 -0
  418. package/src/lib/completion/fish.ts +134 -0
  419. package/src/lib/completion/index.ts +10 -0
  420. package/src/lib/completion/walk.ts +184 -0
  421. package/src/lib/completion/zsh.ts +262 -0
  422. package/src/lib/context/index.ts +386 -0
  423. package/src/lib/cookies/client.ts +301 -0
  424. package/src/lib/cookies/index.ts +13 -0
  425. package/src/lib/council/index.ts +803 -0
  426. package/src/lib/docs-index.ts +216 -0
  427. package/src/lib/docs-lint.ts +413 -0
  428. package/src/lib/docs-sweep.ts +348 -0
  429. package/src/lib/docs.ts +199 -0
  430. package/src/lib/env.ts +12 -0
  431. package/src/lib/exec.ts +74 -0
  432. package/src/lib/format.ts +147 -0
  433. package/src/lib/http/client.ts +211 -0
  434. package/src/lib/http/index.ts +1 -0
  435. package/src/lib/identities/index.ts +210 -0
  436. package/src/lib/machine.ts +61 -0
  437. package/src/lib/presence.ts +154 -0
  438. package/src/lib/readability/client.ts +156 -0
  439. package/src/lib/readability/index.ts +5 -0
  440. package/src/lib/readability/turndown-plugin-gfm.d.ts +10 -0
  441. package/src/lib/scratch/index.ts +470 -0
  442. package/src/lib/tunnel/gate.ts +113 -0
  443. package/src/lib/tunnel/state.ts +167 -0
  444. package/src/web/.gitkeep +0 -0
  445. package/index.js +0 -1
@@ -0,0 +1,185 @@
1
+ import { buildContext, DEFAULT_SECTIONS, OPT_IN_SECTIONS, } from "../lib/context/index.js";
2
+ /**
3
+ * `harn context`: one-shot orientation snapshot.
4
+ *
5
+ * Aggregates self / time / repo / commits / submodules / peers (default) plus
6
+ * opt-in services. Useful at session start, post-compaction, or before
7
+ * dispatching subagents. Fail-open per section.
8
+ */
9
+ export function registerContextCommand(program, emit, context) {
10
+ program
11
+ .command("context")
12
+ .description(`One-shot orientation snapshot: self, repo, submodules, peers, recent commits. Default sections: ${DEFAULT_SECTIONS.join(" / ")}. Opt-in: ${OPT_IN_SECTIONS.join(" / ")}.`)
13
+ .option("--section <name>", `Limit to specific sections (comma-list or repeated; valid: ${[...DEFAULT_SECTIONS, ...OPT_IN_SECTIONS].join(", ")})`, collectSections, [])
14
+ .option("--include <name>", "Add an opt-in section (e.g. services)", collectSections, [])
15
+ .option("--show-clean", "Don't hide clean submodules")
16
+ .option("--json", "Structured JSON envelope")
17
+ .action(async (opts) => {
18
+ try {
19
+ const sections = opts.section.length > 0 ? opts.section : DEFAULT_SECTIONS;
20
+ const report = await buildContext({
21
+ sections,
22
+ include: opts.include,
23
+ showClean: opts.showClean,
24
+ repoRoot: context?.repoRoot,
25
+ submodules: context?.submodules,
26
+ });
27
+ if (opts.json) {
28
+ emit.config({ format: "json" });
29
+ emit.data(report);
30
+ return;
31
+ }
32
+ emit.text(`${renderReport(report)}\n`);
33
+ }
34
+ catch (err) {
35
+ const msg = err instanceof Error ? err.message : String(err);
36
+ emit.error({ code: "context_failed", message: msg });
37
+ process.exit(1);
38
+ }
39
+ });
40
+ }
41
+ function collectSections(value, prev) {
42
+ const all = [...DEFAULT_SECTIONS, ...OPT_IN_SECTIONS];
43
+ const out = [...prev];
44
+ for (const tok of value
45
+ .split(",")
46
+ .map((s) => s.trim())
47
+ .filter(Boolean)) {
48
+ if (!all.includes(tok)) {
49
+ throw new Error(`unknown section "${tok}". Valid: ${all.join(", ")}`);
50
+ }
51
+ if (!out.includes(tok))
52
+ out.push(tok);
53
+ }
54
+ return out;
55
+ }
56
+ // ─── TTY rendering ─────────────────────────────────────────────────────────
57
+ function renderReport(r) {
58
+ const lines = [];
59
+ if (r.self)
60
+ lines.push(...renderSelf(r.self));
61
+ if (r.time)
62
+ lines.push(...renderTime(r.time));
63
+ if (r.repo)
64
+ lines.push(...renderRepo(r.repo));
65
+ if (r.commits)
66
+ lines.push(...renderCommits(r.commits));
67
+ if (r.submodules)
68
+ lines.push(...renderSubmodules(r.submodules));
69
+ if (r.peers)
70
+ lines.push(...renderPeers(r.peers));
71
+ if (r.services)
72
+ lines.push(...renderServices(r.services));
73
+ lines.push("");
74
+ lines.push(`(elapsed: ${r.meta.elapsed_ms}ms)`);
75
+ return lines.join("\n");
76
+ }
77
+ function section(header, body) {
78
+ return ["", `── ${header} ──`, ...body];
79
+ }
80
+ function renderSelf(s) {
81
+ if ("error" in s)
82
+ return section("self", [` (unavailable: ${s.error})`]);
83
+ const body = [];
84
+ body.push(` agent-${s.name ?? "?"} (${formatAge(s.session_age_secs)} old, owner=${s.instance_id.slice(0, 8)}…)`);
85
+ if (s.task)
86
+ body.push(` task: "${s.task}"`);
87
+ if (s.last_tool) {
88
+ const target = s.last_tool_target ? ` ${truncate(s.last_tool_target, 80)}` : "";
89
+ body.push(` last: ${s.last_tool}${target}`);
90
+ }
91
+ if (s.files_held.length > 0) {
92
+ body.push(` holds ${s.files_held.length} file(s):`);
93
+ for (const f of s.files_held.slice(0, 5))
94
+ body.push(` ${f}`);
95
+ if (s.files_held.length > 5)
96
+ body.push(` +${s.files_held.length - 5} more`);
97
+ }
98
+ else {
99
+ body.push(" files: none held");
100
+ }
101
+ return section("self", body);
102
+ }
103
+ function renderTime(t) {
104
+ return section("time", [` ${t.chicago} (UTC: ${t.utc})`]);
105
+ }
106
+ function renderRepo(r) {
107
+ if ("error" in r)
108
+ return section("repo", [` (unavailable: ${r.error})`]);
109
+ const parts = [];
110
+ const aheadBehind = r.ahead > 0 || r.behind > 0 ? ` (ahead ${r.ahead}, behind ${r.behind} vs origin)` : "";
111
+ parts.push(` cwd: ${r.cwd}`);
112
+ parts.push(` branch: ${r.branch}${aheadBehind}`);
113
+ const dirtyBits = [];
114
+ if (r.staged)
115
+ dirtyBits.push(`${r.staged} staged`);
116
+ if (r.modified)
117
+ dirtyBits.push(`${r.modified} modified`);
118
+ if (r.untracked)
119
+ dirtyBits.push(`${r.untracked} untracked`);
120
+ parts.push(` status: ${dirtyBits.length ? dirtyBits.join(", ") : "clean"}`);
121
+ return section("repo", parts);
122
+ }
123
+ function renderCommits(c) {
124
+ if ("error" in c)
125
+ return section("commits", [` (unavailable: ${c.error})`]);
126
+ if (c.rows.length === 0)
127
+ return section("commits", [" (none)"]);
128
+ return section("commits (last 3)", c.rows.map((row) => ` ${row.sha} ${truncate(row.subject, 80)}`));
129
+ }
130
+ function renderSubmodules(s) {
131
+ if ("error" in s)
132
+ return section("submodules", [` (unavailable: ${s.error})`]);
133
+ if (s.rows.length === 0) {
134
+ const tail = s.clean_omitted > 0 ? ` (${s.clean_omitted} clean omitted)` : "";
135
+ return section("submodules", [` all clean${tail}`]);
136
+ }
137
+ const lines = s.rows.map((sm) => {
138
+ const aheadBehind = sm.ahead > 0 || sm.behind > 0 ? ` ±${sm.ahead}/${sm.behind}` : "";
139
+ const dirty = sm.dirty ? ` (${sm.modifiedFiles}m+${sm.untrackedFiles}u)` : "";
140
+ return ` ${sm.name.padEnd(28)} ${sm.branch}${aheadBehind}${dirty}`;
141
+ });
142
+ const tail = s.clean_omitted > 0 ? [` (+${s.clean_omitted} clean omitted)`] : [];
143
+ return section("submodules", [...lines, ...tail]);
144
+ }
145
+ function renderPeers(p) {
146
+ if ("error" in p)
147
+ return section("peers", [` (unavailable: ${p.error})`]);
148
+ if (p.rows.length === 0)
149
+ return section("peers", [" (none active)"]);
150
+ const lines = p.rows.map((peer) => {
151
+ const taskBit = peer.task ? ` "${truncate(peer.task, 40)}"` : "";
152
+ const filesBit = peer.files > 0 ? `${peer.files}f` : "0f";
153
+ const lastBit = peer.last_tool ? `, last: ${peer.last_tool}` : "";
154
+ return ` agent-${peer.name.padEnd(12)}${taskBit} (${peer.age_min}m old, ${filesBit}${lastBit})`;
155
+ });
156
+ return section("peers", lines);
157
+ }
158
+ function renderServices(s) {
159
+ if ("error" in s)
160
+ return section("services", [` (unavailable: ${s.error})`]);
161
+ if (s.docker_compose.length === 0)
162
+ return section("services", [" (no compose project running)"]);
163
+ const lines = s.docker_compose.map((sv) => ` ${sv.service.padEnd(20)} ${sv.status}`);
164
+ return section("services (docker compose)", lines);
165
+ }
166
+ // ─── Format helpers ────────────────────────────────────────────────────────
167
+ function formatAge(secs) {
168
+ if (secs < 60)
169
+ return `${secs}s`;
170
+ if (secs < 3600)
171
+ return `${Math.floor(secs / 60)}m`;
172
+ if (secs < 86400) {
173
+ const h = Math.floor(secs / 3600);
174
+ const m = Math.floor((secs % 3600) / 60);
175
+ return `${h}h ${m}m`;
176
+ }
177
+ const d = Math.floor(secs / 86400);
178
+ const h = Math.floor((secs % 86400) / 3600);
179
+ return `${d}d ${h}h`;
180
+ }
181
+ function truncate(s, n) {
182
+ if (s.length <= n)
183
+ return s;
184
+ return `${s.slice(0, n - 1)}…`;
185
+ }
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { EmitContext } from "../commander.js";
3
+ export declare function registerCookiesCommand(program: Command, emitParam: EmitContext): void;
4
+ //# sourceMappingURL=cookies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/commands/cookies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA8BnD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,CA4FrF"}
@@ -0,0 +1,140 @@
1
+ import { homedir } from "node:os";
2
+ import { resolve } from "node:path";
3
+ import { CookieJar } from "../lib/cookies/index.js";
4
+ /**
5
+ * `cookies`: manage the local browser cookie store.
6
+ *
7
+ * Default store path: `~/.cache/harnery/cookies.json`. Override with
8
+ * `--store <path>` if you need a separate jar (e.g., one per environment).
9
+ * Format is CDP-native (compatible with Playwright/agent-browser).
10
+ */
11
+ const DEFAULT_STORE = resolve(homedir(), ".cache", "harnery", "cookies.json");
12
+ function jarFrom(opts) {
13
+ return new CookieJar({
14
+ path: opts.store ?? DEFAULT_STORE,
15
+ source: "bp-cookies",
16
+ });
17
+ }
18
+ // Module-scoped emit assigned by registerCookiesCommand; the module-level
19
+ // helpers below close over this so the Commander .action callbacks stay
20
+ // concise. Safe because the command tree is registered once at startup.
21
+ let emit;
22
+ export function registerCookiesCommand(program, emitParam) {
23
+ emit = emitParam;
24
+ const cmd = program
25
+ .command("cookies")
26
+ .description(`Manage the shared browser cookie store (default: ${DEFAULT_STORE}). Format is CDP-native (compatible with Playwright/agent-browser).`)
27
+ .option("--store <path>", "Override store path");
28
+ cmd.action((opts) => safe(() => runList(jarFrom(opts), {})));
29
+ cmd
30
+ .command("list")
31
+ .description("List cookies in the store, grouped by domain")
32
+ .option("--domain <domain>", "Filter by domain")
33
+ .option("--json", "Output as JSON")
34
+ .action((opts) => safe(() => runList(jarFrom({ ...cmd.opts(), ...opts }), opts)));
35
+ cmd
36
+ .command("set <name> <value>")
37
+ .description("Set a cookie in the store (creates the file if missing)")
38
+ .requiredOption("--domain <domain>", "Cookie domain (e.g., .example.com)")
39
+ .option("--path <path>", "Cookie path", "/")
40
+ .option("--secure", "HTTPS only")
41
+ .option("--httpOnly", "Prevent JavaScript access")
42
+ .option("--sameSite <policy>", "SameSite policy: Strict | Lax | None")
43
+ .option("--expires <unix-seconds>", "Unix timestamp; omit for session cookie")
44
+ .action((name, value, opts) => safe(() => runSet(jarFrom({ ...cmd.opts(), ...opts }), name, value, opts)));
45
+ cmd
46
+ .command("clear")
47
+ .description("Remove cookies from the store")
48
+ .option("--domain <domain>", "Drop cookies matching a single domain")
49
+ .option("--all", "Wipe everything (cookies + origins)")
50
+ .action((opts) => safe(() => runClear(jarFrom({ ...cmd.opts(), ...opts }), opts)));
51
+ cmd
52
+ .command("header <url>")
53
+ .description("Print a Cookie: header value for the given URL (empty if no match)")
54
+ .action((url, opts) => safe(() => {
55
+ const jar = jarFrom({ ...cmd.opts(), ...opts });
56
+ const out = jar.header(url);
57
+ if (out)
58
+ emit.text(`${out}\n`);
59
+ }));
60
+ cmd
61
+ .command("import <file>")
62
+ .description("Merge cookies from a JSON file (CDP/agent-browser shape)")
63
+ .option("--replace", "Replace the entire store instead of merging")
64
+ .action((file, opts) => safe(() => {
65
+ const jar = jarFrom({ ...cmd.opts(), ...opts });
66
+ const { count } = jar.import(file, opts);
67
+ emit.data({ ok: true, action: "import", count, file });
68
+ }));
69
+ cmd
70
+ .command("export <file>")
71
+ .description("Write the store to a file (for sharing with another tool)")
72
+ .action((file, opts) => safe(() => {
73
+ const jar = jarFrom({ ...cmd.opts(), ...opts });
74
+ const { count } = jar.export(file);
75
+ emit.file(file, { cookies: count });
76
+ }));
77
+ cmd
78
+ .command("info")
79
+ .description("Show store path, size, cookie counts, and exporting tool")
80
+ .option("--json", "Output as JSON")
81
+ .action((opts) => safe(() => runInfo(jarFrom({ ...cmd.opts(), ...opts }), opts)));
82
+ }
83
+ // ---------------------------------------------------------------------------
84
+ // Subcommand handlers
85
+ // ---------------------------------------------------------------------------
86
+ function runList(jar, opts) {
87
+ if (opts.json)
88
+ emit.config({ format: "json" });
89
+ const cookies = jar.list({ domain: opts.domain });
90
+ emit.rows(cookies);
91
+ }
92
+ function runSet(jar, name, value, opts) {
93
+ const cookie = {
94
+ name,
95
+ value,
96
+ domain: opts.domain,
97
+ path: opts.path,
98
+ expires: opts.expires ? Number.parseFloat(opts.expires) : -1,
99
+ httpOnly: opts.httpOnly ?? false,
100
+ secure: opts.secure ?? false,
101
+ session: !opts.expires,
102
+ size: name.length + value.length,
103
+ };
104
+ if (opts.sameSite)
105
+ cookie.sameSite = opts.sameSite;
106
+ jar.set(cookie);
107
+ emit.data({ ok: true, action: "set", name, domain: opts.domain });
108
+ }
109
+ function runClear(jar, opts) {
110
+ if (!opts.domain && !opts.all) {
111
+ throw new Error("Specify --domain <domain> or --all");
112
+ }
113
+ const { before, after } = jar.clear(opts);
114
+ const removed = before - after;
115
+ emit.data({
116
+ ok: true,
117
+ action: "clear",
118
+ removed,
119
+ before,
120
+ after,
121
+ domain: opts.domain ?? null,
122
+ all: opts.all ?? false,
123
+ });
124
+ }
125
+ function runInfo(jar, opts) {
126
+ if (opts.json)
127
+ emit.config({ format: "json" });
128
+ const i = jar.info();
129
+ emit.data(i);
130
+ }
131
+ function safe(fn) {
132
+ try {
133
+ fn();
134
+ }
135
+ catch (err) {
136
+ const msg = err instanceof Error ? err.message : String(err);
137
+ emit.error({ code: "cookies_error", message: msg });
138
+ process.exit(1);
139
+ }
140
+ }
@@ -0,0 +1,4 @@
1
+ import type { Command } from "commander";
2
+ import type { EmitContext, HarneryProgramContext } from "../commander.js";
3
+ export declare function registerDocsCommand(program: Command, emitParam: EmitContext, context?: HarneryProgramContext): void;
4
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAuB1E,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,WAAW,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI,CA+EN"}
@@ -0,0 +1,137 @@
1
+ import { initDocsContext as initDocs, scanDocs } from "../lib/docs.js";
2
+ import { initDocsContext as initDocsIndex, runIndex } from "../lib/docs-index.js";
3
+ import { initDocsContext as initDocsLint, runLint } from "../lib/docs-lint.js";
4
+ import { countColdHandoffs, initDocsContext as initDocsSweep, runSweep, } from "../lib/docs-sweep.js";
5
+ function ensureContext(context) {
6
+ if (!context?.repoRoot || !context?.submodules) {
7
+ throw new Error("docs commands require harnery to be configured with repoRoot + submodules");
8
+ }
9
+ const opts = { repoRoot: context.repoRoot, submodules: context.submodules };
10
+ initDocs(opts);
11
+ initDocsIndex(opts);
12
+ initDocsLint({ ...opts, extraExcludedPrefixes: context.extraDocsExcludedPrefixes });
13
+ initDocsSweep(opts);
14
+ }
15
+ let emit;
16
+ export function registerDocsCommand(program, emitParam, context) {
17
+ emit = emitParam;
18
+ const docs = program
19
+ .command("docs")
20
+ .description("Documentation tooling: freshness report, lint, sweep, index")
21
+ // Options on the group itself back the default (no-subcommand) behavior.
22
+ // See handleDocs below.
23
+ .option("--stale <days>", "Only show files not committed in N+ days", Number.parseInt)
24
+ .option("--dir <name>", "Filter to a specific top-level directory")
25
+ .option("--no-submodules", "Exclude submodule files; only show parent repo docs")
26
+ .option("--commits <n>", "Number of recent commits to show per file", Number.parseInt, 1)
27
+ .option("--format <type>", "Output format: table, csv, json", "table")
28
+ .action(async (opts) => {
29
+ try {
30
+ ensureContext(context);
31
+ await handleDocs(opts);
32
+ }
33
+ catch (err) {
34
+ const msg = err instanceof Error ? err.message : String(err);
35
+ emit.error({ code: "docs_error", message: msg });
36
+ }
37
+ });
38
+ docs
39
+ .command("lint")
40
+ .description("Verify every repo matches the documentation contract (directory layout + naming rules)")
41
+ .option("--fast", "Skip content-reading checks; filename/structure only (for pre-commit)")
42
+ .option("--repo <name>", "Limit to one submodule or '.' for parent")
43
+ .option("--format <type>", "Output format: human, json", "human")
44
+ .action(async (opts) => {
45
+ try {
46
+ ensureContext(context);
47
+ await handleLint(opts);
48
+ }
49
+ catch (err) {
50
+ const msg = err instanceof Error ? err.message : String(err);
51
+ emit.error({ code: "docs_error", message: msg });
52
+ }
53
+ });
54
+ docs
55
+ .command("sweep")
56
+ .description("Surface stalled lifecycle states: stalled plans, cold issues, unverified runbooks")
57
+ .option("--repo <name>", "Limit to one submodule or '.' for parent")
58
+ .option("--format <type>", "Output format: human, json", "human")
59
+ .action(async (opts) => {
60
+ try {
61
+ ensureContext(context);
62
+ await handleSweep(opts);
63
+ }
64
+ catch (err) {
65
+ const msg = err instanceof Error ? err.message : String(err);
66
+ emit.error({ code: "docs_error", message: msg });
67
+ }
68
+ });
69
+ docs
70
+ .command("index")
71
+ .description("Regenerate index READMEs for docs/audits/ and docs/issues/ directories")
72
+ .option("--dry-run", "Show what would change, don't write files")
73
+ .option("--repo <name>", "Limit to one submodule or '.' for parent")
74
+ .action(async (opts) => {
75
+ try {
76
+ ensureContext(context);
77
+ await handleIndex(opts);
78
+ }
79
+ catch (err) {
80
+ const msg = err instanceof Error ? err.message : String(err);
81
+ emit.error({ code: "docs_error", message: msg });
82
+ }
83
+ });
84
+ }
85
+ // --- Default `harn docs` (freshness report) ---
86
+ async function handleDocs(opts) {
87
+ if (opts.format === "json")
88
+ emit.config({ format: "json" });
89
+ else if (opts.format === "csv")
90
+ emit.config({ format: "csv" });
91
+ const files = await scanDocs({
92
+ commitCount: opts.commits,
93
+ dir: opts.dir,
94
+ noSubmodules: opts.submodules === false,
95
+ staleDays: opts.stale,
96
+ });
97
+ emit.rows(files);
98
+ }
99
+ // --- `harn docs lint` ---
100
+ async function handleLint(opts) {
101
+ const violations = await runLint({ fast: opts.fast, repo: opts.repo });
102
+ const errors = violations.filter((v) => v.severity === "error");
103
+ const warnings = violations.filter((v) => v.severity === "warning");
104
+ const cold = await countColdHandoffs();
105
+ emit.data({
106
+ fast: !!opts.fast,
107
+ repo: opts.repo ?? null,
108
+ error_count: errors.length,
109
+ warning_count: warnings.length,
110
+ cold_handoffs: cold,
111
+ violations,
112
+ });
113
+ if (errors.length > 0)
114
+ emit.setExitCode(1);
115
+ }
116
+ // --- `harn docs sweep` ---
117
+ async function handleSweep(opts) {
118
+ if (opts.format === "json")
119
+ emit.config({ format: "json" });
120
+ const items = await runSweep({ repo: opts.repo });
121
+ emit.data(items);
122
+ }
123
+ // --- `harn docs index` ---
124
+ async function handleIndex(opts) {
125
+ const results = await runIndex({ dryRun: opts.dryRun, repo: opts.repo });
126
+ emit.data({
127
+ dry_run: !!opts.dryRun,
128
+ repo: opts.repo ?? null,
129
+ counts: {
130
+ updated: results.filter((r) => r.status === "updated").length,
131
+ created: results.filter((r) => r.status === "created").length,
132
+ needs_markers: results.filter((r) => r.status === "needs-markers").length,
133
+ unchanged: results.filter((r) => r.status === "unchanged").length,
134
+ },
135
+ results,
136
+ });
137
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `harn doctor`: runtime + dependency check.
3
+ *
4
+ * Walks through every dependency harnery touches and reports presence,
5
+ * version, and OS-specific install hints. Returns a checklist:
6
+ *
7
+ * ✓ ok: dep is present and recent enough
8
+ * ⚠ warn: optional dep missing (feature degrades)
9
+ * ✗ fail: required dep missing (commands will throw)
10
+ *
11
+ * Exits 0 unless a required dep is missing.
12
+ */
13
+ import type { Command } from "commander";
14
+ import type { EmitContext } from "../commander.js";
15
+ type Severity = "ok" | "warn" | "fail";
16
+ interface Check {
17
+ name: string;
18
+ severity: Severity;
19
+ detail: string;
20
+ hint?: string;
21
+ }
22
+ export declare function registerDoctorCommand(program: Command, emit: EmitContext): void;
23
+ export declare function runChecks(): Check[];
24
+ export {};
25
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvC,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAMD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAwC/E;AAED,wBAAgB,SAAS,IAAI,KAAK,EAAE,CAWnC"}