dorfl 0.0.0 → 0.1.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 (619) hide show
  1. package/dist/advance-ci-template.d.ts +73 -0
  2. package/dist/advance-ci-template.d.ts.map +1 -0
  3. package/dist/advance-ci-template.js +104 -0
  4. package/dist/advance-ci-template.js.map +1 -0
  5. package/dist/advance-classify.d.ts +132 -0
  6. package/dist/advance-classify.d.ts.map +1 -0
  7. package/dist/advance-classify.js +120 -0
  8. package/dist/advance-classify.js.map +1 -0
  9. package/dist/advance-drivers.d.ts +182 -0
  10. package/dist/advance-drivers.d.ts.map +1 -0
  11. package/dist/advance-drivers.js +231 -0
  12. package/dist/advance-drivers.js.map +1 -0
  13. package/dist/advance-isolated.d.ts +156 -0
  14. package/dist/advance-isolated.d.ts.map +1 -0
  15. package/dist/advance-isolated.js +256 -0
  16. package/dist/advance-isolated.js.map +1 -0
  17. package/dist/advance-lifecycle-template.d.ts +107 -0
  18. package/dist/advance-lifecycle-template.d.ts.map +1 -0
  19. package/dist/advance-lifecycle-template.js +668 -0
  20. package/dist/advance-lifecycle-template.js.map +1 -0
  21. package/dist/advance-loop-driver.d.ts +325 -0
  22. package/dist/advance-loop-driver.d.ts.map +1 -0
  23. package/dist/advance-loop-driver.js +437 -0
  24. package/dist/advance-loop-driver.js.map +1 -0
  25. package/dist/advance-treeless-publish.d.ts +108 -0
  26. package/dist/advance-treeless-publish.d.ts.map +1 -0
  27. package/dist/advance-treeless-publish.js +71 -0
  28. package/dist/advance-treeless-publish.js.map +1 -0
  29. package/dist/advance.d.ts +340 -0
  30. package/dist/advance.d.ts.map +1 -0
  31. package/dist/advance.js +1122 -0
  32. package/dist/advance.js.map +1 -0
  33. package/dist/advancing-lock.d.ts +294 -0
  34. package/dist/advancing-lock.d.ts.map +1 -0
  35. package/dist/advancing-lock.js +594 -0
  36. package/dist/advancing-lock.js.map +1 -0
  37. package/dist/agent-launch.d.ts +79 -0
  38. package/dist/agent-launch.d.ts.map +1 -0
  39. package/dist/agent-launch.js +61 -0
  40. package/dist/agent-launch.js.map +1 -0
  41. package/dist/agent-stop.d.ts +149 -0
  42. package/dist/agent-stop.d.ts.map +1 -0
  43. package/dist/agent-stop.js +307 -0
  44. package/dist/agent-stop.js.map +1 -0
  45. package/dist/apply-decide.d.ts +127 -0
  46. package/dist/apply-decide.d.ts.map +1 -0
  47. package/dist/apply-decide.js +176 -0
  48. package/dist/apply-decide.js.map +1 -0
  49. package/dist/apply-merge-action.d.ts +206 -0
  50. package/dist/apply-merge-action.d.ts.map +1 -0
  51. package/dist/apply-merge-action.js +307 -0
  52. package/dist/apply-merge-action.js.map +1 -0
  53. package/dist/apply-persist.d.ts +174 -0
  54. package/dist/apply-persist.d.ts.map +1 -0
  55. package/dist/apply-persist.js +359 -0
  56. package/dist/apply-persist.js.map +1 -0
  57. package/dist/arbiter.d.ts +120 -0
  58. package/dist/arbiter.d.ts.map +1 -0
  59. package/dist/arbiter.js +255 -0
  60. package/dist/arbiter.js.map +1 -0
  61. package/dist/brand.d.ts +70 -0
  62. package/dist/brand.d.ts.map +1 -0
  63. package/dist/brand.js +84 -0
  64. package/dist/brand.js.map +1 -0
  65. package/dist/buildable-body.d.ts +132 -0
  66. package/dist/buildable-body.d.ts.map +1 -0
  67. package/dist/buildable-body.js +131 -0
  68. package/dist/buildable-body.js.map +1 -0
  69. package/dist/categorise.d.ts +66 -0
  70. package/dist/categorise.d.ts.map +1 -0
  71. package/dist/categorise.js +106 -0
  72. package/dist/categorise.js.map +1 -0
  73. package/dist/claim-cas.d.ts +117 -0
  74. package/dist/claim-cas.d.ts.map +1 -0
  75. package/dist/claim-cas.js +312 -0
  76. package/dist/claim-cas.js.map +1 -0
  77. package/dist/cli-spinner.d.ts +112 -0
  78. package/dist/cli-spinner.d.ts.map +1 -0
  79. package/dist/cli-spinner.js +157 -0
  80. package/dist/cli-spinner.js.map +1 -0
  81. package/dist/cli.d.ts +11 -0
  82. package/dist/cli.d.ts.map +1 -0
  83. package/dist/cli.js +3094 -0
  84. package/dist/cli.js.map +1 -0
  85. package/dist/close-job-template.d.ts +70 -0
  86. package/dist/close-job-template.d.ts.map +1 -0
  87. package/dist/close-job-template.js +180 -0
  88. package/dist/close-job-template.js.map +1 -0
  89. package/dist/close-job.d.ts +95 -0
  90. package/dist/close-job.d.ts.map +1 -0
  91. package/dist/close-job.js +226 -0
  92. package/dist/close-job.js.map +1 -0
  93. package/dist/complete.d.ts +361 -0
  94. package/dist/complete.d.ts.map +1 -0
  95. package/dist/complete.js +885 -0
  96. package/dist/complete.js.map +1 -0
  97. package/dist/concurrency.d.ts +68 -0
  98. package/dist/concurrency.d.ts.map +1 -0
  99. package/dist/concurrency.js +112 -0
  100. package/dist/concurrency.js.map +1 -0
  101. package/dist/config-override.d.ts +76 -0
  102. package/dist/config-override.d.ts.map +1 -0
  103. package/dist/config-override.js +50 -0
  104. package/dist/config-override.js.map +1 -0
  105. package/dist/config.d.ts +668 -0
  106. package/dist/config.d.ts.map +1 -0
  107. package/dist/config.js +241 -0
  108. package/dist/config.js.map +1 -0
  109. package/dist/continue-branch.d.ts +249 -0
  110. package/dist/continue-branch.d.ts.map +1 -0
  111. package/dist/continue-branch.js +389 -0
  112. package/dist/continue-branch.js.map +1 -0
  113. package/dist/cwd-section.d.ts +186 -0
  114. package/dist/cwd-section.d.ts.map +1 -0
  115. package/dist/cwd-section.js +209 -0
  116. package/dist/cwd-section.js.map +1 -0
  117. package/dist/decision-engine.d.ts +170 -0
  118. package/dist/decision-engine.d.ts.map +1 -0
  119. package/dist/decision-engine.js +136 -0
  120. package/dist/decision-engine.js.map +1 -0
  121. package/dist/detect.d.ts +17 -0
  122. package/dist/detect.d.ts.map +1 -0
  123. package/dist/detect.js +118 -0
  124. package/dist/detect.js.map +1 -0
  125. package/dist/do-autopick.d.ts +85 -0
  126. package/dist/do-autopick.d.ts.map +1 -0
  127. package/dist/do-autopick.js +112 -0
  128. package/dist/do-autopick.js.map +1 -0
  129. package/dist/do-config.d.ts +312 -0
  130. package/dist/do-config.d.ts.map +1 -0
  131. package/dist/do-config.js +358 -0
  132. package/dist/do-config.js.map +1 -0
  133. package/dist/do-remote-auto.d.ts +75 -0
  134. package/dist/do-remote-auto.d.ts.map +1 -0
  135. package/dist/do-remote-auto.js +111 -0
  136. package/dist/do-remote-auto.js.map +1 -0
  137. package/dist/do.d.ts +621 -0
  138. package/dist/do.d.ts.map +1 -0
  139. package/dist/do.js +1882 -0
  140. package/dist/do.js.map +1 -0
  141. package/dist/drop-source.d.ts +96 -0
  142. package/dist/drop-source.d.ts.map +1 -0
  143. package/dist/drop-source.js +91 -0
  144. package/dist/drop-source.js.map +1 -0
  145. package/dist/eligibility.d.ts +46 -0
  146. package/dist/eligibility.d.ts.map +1 -0
  147. package/dist/eligibility.js +34 -0
  148. package/dist/eligibility.js.map +1 -0
  149. package/dist/env-config.d.ts +51 -0
  150. package/dist/env-config.d.ts.map +1 -0
  151. package/dist/env-config.js +272 -0
  152. package/dist/env-config.js.map +1 -0
  153. package/dist/failure-cause.d.ts +70 -0
  154. package/dist/failure-cause.d.ts.map +1 -0
  155. package/dist/failure-cause.js +126 -0
  156. package/dist/failure-cause.js.map +1 -0
  157. package/dist/format.d.ts +43 -0
  158. package/dist/format.d.ts.map +1 -0
  159. package/dist/format.js +256 -0
  160. package/dist/format.js.map +1 -0
  161. package/dist/frontmatter.d.ts +215 -0
  162. package/dist/frontmatter.d.ts.map +1 -0
  163. package/dist/frontmatter.js +345 -0
  164. package/dist/frontmatter.js.map +1 -0
  165. package/dist/gate-readiness.d.ts +84 -0
  166. package/dist/gate-readiness.d.ts.map +1 -0
  167. package/dist/gate-readiness.js +103 -0
  168. package/dist/gate-readiness.js.map +1 -0
  169. package/dist/gc.d.ts +165 -0
  170. package/dist/gc.d.ts.map +1 -0
  171. package/dist/gc.js +313 -0
  172. package/dist/gc.js.map +1 -0
  173. package/dist/gh-failure.d.ts +42 -0
  174. package/dist/gh-failure.d.ts.map +1 -0
  175. package/dist/gh-failure.js +49 -0
  176. package/dist/gh-failure.js.map +1 -0
  177. package/dist/git.d.ts +75 -0
  178. package/dist/git.d.ts.map +1 -0
  179. package/dist/git.js +130 -0
  180. package/dist/git.js.map +1 -0
  181. package/dist/github.d.ts +187 -0
  182. package/dist/github.d.ts.map +1 -0
  183. package/dist/github.js +343 -0
  184. package/dist/github.js.map +1 -0
  185. package/dist/harness.d.ts +242 -0
  186. package/dist/harness.d.ts.map +1 -0
  187. package/dist/harness.js +157 -0
  188. package/dist/harness.js.map +1 -0
  189. package/dist/identity.d.ts +167 -0
  190. package/dist/identity.d.ts.map +1 -0
  191. package/dist/identity.js +231 -0
  192. package/dist/identity.js.map +1 -0
  193. package/dist/index.d.ts +147 -0
  194. package/dist/index.d.ts.map +1 -0
  195. package/dist/index.js +76 -0
  196. package/dist/index.js.map +1 -0
  197. package/dist/install-ci-branch-protection.d.ts +147 -0
  198. package/dist/install-ci-branch-protection.d.ts.map +1 -0
  199. package/dist/install-ci-branch-protection.js +166 -0
  200. package/dist/install-ci-branch-protection.js.map +1 -0
  201. package/dist/install-ci-capabilities/advance-lifecycle.d.ts +15 -0
  202. package/dist/install-ci-capabilities/advance-lifecycle.d.ts.map +1 -0
  203. package/dist/install-ci-capabilities/advance-lifecycle.js +28 -0
  204. package/dist/install-ci-capabilities/advance-lifecycle.js.map +1 -0
  205. package/dist/install-ci-capabilities/close-job.d.ts +13 -0
  206. package/dist/install-ci-capabilities/close-job.d.ts.map +1 -0
  207. package/dist/install-ci-capabilities/close-job.js +26 -0
  208. package/dist/install-ci-capabilities/close-job.js.map +1 -0
  209. package/dist/install-ci-capabilities/example-noop.d.ts +16 -0
  210. package/dist/install-ci-capabilities/example-noop.d.ts.map +1 -0
  211. package/dist/install-ci-capabilities/example-noop.js +23 -0
  212. package/dist/install-ci-capabilities/example-noop.js.map +1 -0
  213. package/dist/install-ci-capabilities/intake.d.ts +15 -0
  214. package/dist/install-ci-capabilities/intake.d.ts.map +1 -0
  215. package/dist/install-ci-capabilities/intake.js +28 -0
  216. package/dist/install-ci-capabilities/intake.js.map +1 -0
  217. package/dist/install-ci-capabilities/verify.d.ts +14 -0
  218. package/dist/install-ci-capabilities/verify.d.ts.map +1 -0
  219. package/dist/install-ci-capabilities/verify.js +27 -0
  220. package/dist/install-ci-capabilities/verify.js.map +1 -0
  221. package/dist/install-ci-core.d.ts +446 -0
  222. package/dist/install-ci-core.d.ts.map +1 -0
  223. package/dist/install-ci-core.js +760 -0
  224. package/dist/install-ci-core.js.map +1 -0
  225. package/dist/install-ci-github.d.ts +167 -0
  226. package/dist/install-ci-github.d.ts.map +1 -0
  227. package/dist/install-ci-github.js +315 -0
  228. package/dist/install-ci-github.js.map +1 -0
  229. package/dist/install-ci.d.ts +105 -0
  230. package/dist/install-ci.d.ts.map +1 -0
  231. package/dist/install-ci.js +363 -0
  232. package/dist/install-ci.js.map +1 -0
  233. package/dist/intake-event.d.ts +88 -0
  234. package/dist/intake-event.d.ts.map +1 -0
  235. package/dist/intake-event.js +66 -0
  236. package/dist/intake-event.js.map +1 -0
  237. package/dist/intake-marker.d.ts +95 -0
  238. package/dist/intake-marker.d.ts.map +1 -0
  239. package/dist/intake-marker.js +127 -0
  240. package/dist/intake-marker.js.map +1 -0
  241. package/dist/intake-triage.d.ts +48 -0
  242. package/dist/intake-triage.d.ts.map +1 -0
  243. package/dist/intake-triage.js +95 -0
  244. package/dist/intake-triage.js.map +1 -0
  245. package/dist/intake-trigger-template.d.ts +185 -0
  246. package/dist/intake-trigger-template.d.ts.map +1 -0
  247. package/dist/intake-trigger-template.js +449 -0
  248. package/dist/intake-trigger-template.js.map +1 -0
  249. package/dist/intake.d.ts +569 -0
  250. package/dist/intake.d.ts.map +1 -0
  251. package/dist/intake.js +1628 -0
  252. package/dist/intake.js.map +1 -0
  253. package/dist/integration-core.d.ts +539 -0
  254. package/dist/integration-core.d.ts.map +1 -0
  255. package/dist/integration-core.js +2195 -0
  256. package/dist/integration-core.js.map +1 -0
  257. package/dist/integrator.d.ts +343 -0
  258. package/dist/integrator.d.ts.map +1 -0
  259. package/dist/integrator.js +400 -0
  260. package/dist/integrator.js.map +1 -0
  261. package/dist/isolation.d.ts +219 -0
  262. package/dist/isolation.d.ts.map +1 -0
  263. package/dist/isolation.js +261 -0
  264. package/dist/isolation.js.map +1 -0
  265. package/dist/issue-provider.d.ts +349 -0
  266. package/dist/issue-provider.d.ts.map +1 -0
  267. package/dist/issue-provider.js +360 -0
  268. package/dist/issue-provider.js.map +1 -0
  269. package/dist/item-lock.d.ts +626 -0
  270. package/dist/item-lock.d.ts.map +1 -0
  271. package/dist/item-lock.js +1381 -0
  272. package/dist/item-lock.js.map +1 -0
  273. package/dist/item-path.d.ts +49 -0
  274. package/dist/item-path.d.ts.map +1 -0
  275. package/dist/item-path.js +66 -0
  276. package/dist/item-path.js.map +1 -0
  277. package/dist/ledger-lint.d.ts +129 -0
  278. package/dist/ledger-lint.d.ts.map +1 -0
  279. package/dist/ledger-lint.js +249 -0
  280. package/dist/ledger-lint.js.map +1 -0
  281. package/dist/ledger-read.d.ts +357 -0
  282. package/dist/ledger-read.d.ts.map +1 -0
  283. package/dist/ledger-read.js +442 -0
  284. package/dist/ledger-read.js.map +1 -0
  285. package/dist/ledger-write.d.ts +330 -0
  286. package/dist/ledger-write.d.ts.map +1 -0
  287. package/dist/ledger-write.js +411 -0
  288. package/dist/ledger-write.js.map +1 -0
  289. package/dist/lifecycle-gather.d.ts +30 -0
  290. package/dist/lifecycle-gather.d.ts.map +1 -0
  291. package/dist/lifecycle-gather.js +205 -0
  292. package/dist/lifecycle-gather.js.map +1 -0
  293. package/dist/lifecycle-pools.d.ts +180 -0
  294. package/dist/lifecycle-pools.d.ts.map +1 -0
  295. package/dist/lifecycle-pools.js +78 -0
  296. package/dist/lifecycle-pools.js.map +1 -0
  297. package/dist/merge-question-surfacer.d.ts +166 -0
  298. package/dist/merge-question-surfacer.d.ts.map +1 -0
  299. package/dist/merge-question-surfacer.js +297 -0
  300. package/dist/merge-question-surfacer.js.map +1 -0
  301. package/dist/mint-adr.d.ts +126 -0
  302. package/dist/mint-adr.d.ts.map +1 -0
  303. package/dist/mint-adr.js +257 -0
  304. package/dist/mint-adr.js.map +1 -0
  305. package/dist/mirror-pool-scan.d.ts +125 -0
  306. package/dist/mirror-pool-scan.d.ts.map +1 -0
  307. package/dist/mirror-pool-scan.js +104 -0
  308. package/dist/mirror-pool-scan.js.map +1 -0
  309. package/dist/needs-attention.d.ts +341 -0
  310. package/dist/needs-attention.d.ts.map +1 -0
  311. package/dist/needs-attention.js +900 -0
  312. package/dist/needs-attention.js.map +1 -0
  313. package/dist/orphan-sidecar.d.ts +79 -0
  314. package/dist/orphan-sidecar.d.ts.map +1 -0
  315. package/dist/orphan-sidecar.js +71 -0
  316. package/dist/orphan-sidecar.js.map +1 -0
  317. package/dist/output.d.ts +48 -0
  318. package/dist/output.d.ts.map +1 -0
  319. package/dist/output.js +66 -0
  320. package/dist/output.js.map +1 -0
  321. package/dist/pi-harness.d.ts +179 -0
  322. package/dist/pi-harness.d.ts.map +1 -0
  323. package/dist/pi-harness.js +342 -0
  324. package/dist/pi-harness.js.map +1 -0
  325. package/dist/placement.d.ts +99 -0
  326. package/dist/placement.d.ts.map +1 -0
  327. package/dist/placement.js +67 -0
  328. package/dist/placement.js.map +1 -0
  329. package/dist/prd-to-spec.d.ts +315 -0
  330. package/dist/prd-to-spec.d.ts.map +1 -0
  331. package/dist/prd-to-spec.js +684 -0
  332. package/dist/prd-to-spec.js.map +1 -0
  333. package/dist/prepare.d.ts +121 -0
  334. package/dist/prepare.d.ts.map +1 -0
  335. package/dist/prepare.js +140 -0
  336. package/dist/prepare.js.map +1 -0
  337. package/dist/prompt.d.ts +360 -0
  338. package/dist/prompt.d.ts.map +1 -0
  339. package/dist/prompt.js +499 -0
  340. package/dist/prompt.js.map +1 -0
  341. package/dist/protocol/ADR-FORMAT.md +47 -0
  342. package/dist/protocol/CLAIM-PROTOCOL.md +217 -0
  343. package/dist/protocol/REVIEW-PROTOCOL.md +119 -0
  344. package/dist/protocol/SURFACE-PROTOCOL.md +121 -0
  345. package/dist/protocol/TASKING-PROTOCOL.md +122 -0
  346. package/dist/protocol/WORK-CONTRACT.md +276 -0
  347. package/dist/protocol/spec-template.md +71 -0
  348. package/dist/protocol/task-template.md +65 -0
  349. package/dist/readiness.d.ts +66 -0
  350. package/dist/readiness.d.ts.map +1 -0
  351. package/dist/readiness.js +36 -0
  352. package/dist/readiness.js.map +1 -0
  353. package/dist/reap-branches.d.ts +102 -0
  354. package/dist/reap-branches.d.ts.map +1 -0
  355. package/dist/reap-branches.js +149 -0
  356. package/dist/reap-branches.js.map +1 -0
  357. package/dist/recover-isolated.d.ts +72 -0
  358. package/dist/recover-isolated.d.ts.map +1 -0
  359. package/dist/recover-isolated.js +188 -0
  360. package/dist/recover-isolated.js.map +1 -0
  361. package/dist/registry.d.ts +172 -0
  362. package/dist/registry.d.ts.map +1 -0
  363. package/dist/registry.js +296 -0
  364. package/dist/registry.js.map +1 -0
  365. package/dist/repo-config.d.ts +201 -0
  366. package/dist/repo-config.d.ts.map +1 -0
  367. package/dist/repo-config.js +414 -0
  368. package/dist/repo-config.js.map +1 -0
  369. package/dist/repo-key.d.ts +20 -0
  370. package/dist/repo-key.d.ts.map +1 -0
  371. package/dist/repo-key.js +68 -0
  372. package/dist/repo-key.js.map +1 -0
  373. package/dist/repo-mirror.d.ts +177 -0
  374. package/dist/repo-mirror.d.ts.map +1 -0
  375. package/dist/repo-mirror.js +271 -0
  376. package/dist/repo-mirror.js.map +1 -0
  377. package/dist/retry-backoff.d.ts +90 -0
  378. package/dist/retry-backoff.d.ts.map +1 -0
  379. package/dist/retry-backoff.js +98 -0
  380. package/dist/retry-backoff.js.map +1 -0
  381. package/dist/review-gate.d.ts +173 -0
  382. package/dist/review-gate.d.ts.map +1 -0
  383. package/dist/review-gate.js +261 -0
  384. package/dist/review-gate.js.map +1 -0
  385. package/dist/review-verdict.d.ts +149 -0
  386. package/dist/review-verdict.d.ts.map +1 -0
  387. package/dist/review-verdict.js +332 -0
  388. package/dist/review-verdict.js.map +1 -0
  389. package/dist/run.d.ts +221 -0
  390. package/dist/run.d.ts.map +1 -0
  391. package/dist/run.js +963 -0
  392. package/dist/run.js.map +1 -0
  393. package/dist/scan.d.ts +308 -0
  394. package/dist/scan.d.ts.map +1 -0
  395. package/dist/scan.js +374 -0
  396. package/dist/scan.js.map +1 -0
  397. package/dist/select-order.d.ts +75 -0
  398. package/dist/select-order.d.ts.map +1 -0
  399. package/dist/select-order.js +108 -0
  400. package/dist/select-order.js.map +1 -0
  401. package/dist/select-priority.d.ts +188 -0
  402. package/dist/select-priority.d.ts.map +1 -0
  403. package/dist/select-priority.js +80 -0
  404. package/dist/select-priority.js.map +1 -0
  405. package/dist/select.d.ts +25 -0
  406. package/dist/select.d.ts.map +1 -0
  407. package/dist/select.js +43 -0
  408. package/dist/select.js.map +1 -0
  409. package/dist/session-path.d.ts +36 -0
  410. package/dist/session-path.d.ts.map +1 -0
  411. package/dist/session-path.js +129 -0
  412. package/dist/session-path.js.map +1 -0
  413. package/dist/sidecar-apply.d.ts +83 -0
  414. package/dist/sidecar-apply.d.ts.map +1 -0
  415. package/dist/sidecar-apply.js +111 -0
  416. package/dist/sidecar-apply.js.map +1 -0
  417. package/dist/sidecar.d.ts +245 -0
  418. package/dist/sidecar.d.ts.map +1 -0
  419. package/dist/sidecar.js +481 -0
  420. package/dist/sidecar.js.map +1 -0
  421. package/dist/slug-namespace.d.ts +204 -0
  422. package/dist/slug-namespace.d.ts.map +1 -0
  423. package/dist/slug-namespace.js +229 -0
  424. package/dist/slug-namespace.js.map +1 -0
  425. package/dist/spec-complete.d.ts +44 -0
  426. package/dist/spec-complete.d.ts.map +1 -0
  427. package/dist/spec-complete.js +69 -0
  428. package/dist/spec-complete.js.map +1 -0
  429. package/dist/start.d.ts +97 -0
  430. package/dist/start.d.ts.map +1 -0
  431. package/dist/start.js +633 -0
  432. package/dist/start.js.map +1 -0
  433. package/dist/status.d.ts +199 -0
  434. package/dist/status.d.ts.map +1 -0
  435. package/dist/status.js +228 -0
  436. package/dist/status.js.map +1 -0
  437. package/dist/surface-gate.d.ts +162 -0
  438. package/dist/surface-gate.d.ts.map +1 -0
  439. package/dist/surface-gate.js +206 -0
  440. package/dist/surface-gate.js.map +1 -0
  441. package/dist/surface-persist.d.ts +86 -0
  442. package/dist/surface-persist.d.ts.map +1 -0
  443. package/dist/surface-persist.js +129 -0
  444. package/dist/surface-persist.js.map +1 -0
  445. package/dist/tasker-review-loop.d.ts +249 -0
  446. package/dist/tasker-review-loop.d.ts.map +1 -0
  447. package/dist/tasker-review-loop.js +369 -0
  448. package/dist/tasker-review-loop.js.map +1 -0
  449. package/dist/tasking-eligibility.d.ts +74 -0
  450. package/dist/tasking-eligibility.d.ts.map +1 -0
  451. package/dist/tasking-eligibility.js +52 -0
  452. package/dist/tasking-eligibility.js.map +1 -0
  453. package/dist/tasking-lock.d.ts +111 -0
  454. package/dist/tasking-lock.d.ts.map +1 -0
  455. package/dist/tasking-lock.js +256 -0
  456. package/dist/tasking-lock.js.map +1 -0
  457. package/dist/tasking.d.ts +275 -0
  458. package/dist/tasking.d.ts.map +1 -0
  459. package/dist/tasking.js +952 -0
  460. package/dist/tasking.js.map +1 -0
  461. package/dist/triage-gate.d.ts +127 -0
  462. package/dist/triage-gate.d.ts.map +1 -0
  463. package/dist/triage-gate.js +139 -0
  464. package/dist/triage-gate.js.map +1 -0
  465. package/dist/triage-persist.d.ts +163 -0
  466. package/dist/triage-persist.d.ts.map +1 -0
  467. package/dist/triage-persist.js +387 -0
  468. package/dist/triage-persist.js.map +1 -0
  469. package/dist/verdict-json.d.ts +32 -0
  470. package/dist/verdict-json.d.ts.map +1 -0
  471. package/dist/verdict-json.js +74 -0
  472. package/dist/verdict-json.js.map +1 -0
  473. package/dist/verify-workflow-template.d.ts +60 -0
  474. package/dist/verify-workflow-template.d.ts.map +1 -0
  475. package/dist/verify-workflow-template.js +126 -0
  476. package/dist/verify-workflow-template.js.map +1 -0
  477. package/dist/verify.d.ts +60 -0
  478. package/dist/verify.d.ts.map +1 -0
  479. package/dist/verify.js +62 -0
  480. package/dist/verify.js.map +1 -0
  481. package/dist/watch-session.d.ts +112 -0
  482. package/dist/watch-session.d.ts.map +1 -0
  483. package/dist/watch-session.js +347 -0
  484. package/dist/watch-session.js.map +1 -0
  485. package/dist/work-layout.d.ts +198 -0
  486. package/dist/work-layout.d.ts.map +1 -0
  487. package/dist/work-layout.js +217 -0
  488. package/dist/work-layout.js.map +1 -0
  489. package/dist/work-on.d.ts +154 -0
  490. package/dist/work-on.d.ts.map +1 -0
  491. package/dist/work-on.js +387 -0
  492. package/dist/work-on.js.map +1 -0
  493. package/dist/workspace.d.ts +224 -0
  494. package/dist/workspace.d.ts.map +1 -0
  495. package/dist/workspace.js +325 -0
  496. package/dist/workspace.js.map +1 -0
  497. package/package.json +46 -2
  498. package/src/advance-ci-template.ts +203 -0
  499. package/src/advance-classify.ts +197 -0
  500. package/src/advance-drivers.ts +414 -0
  501. package/src/advance-isolated.ts +432 -0
  502. package/src/advance-lifecycle-template.ts +791 -0
  503. package/src/advance-loop-driver.ts +745 -0
  504. package/src/advance-treeless-publish.ts +177 -0
  505. package/src/advance.ts +1564 -0
  506. package/src/advancing-lock.ts +988 -0
  507. package/src/agent-launch.ts +137 -0
  508. package/src/agent-stop.ts +361 -0
  509. package/src/apply-decide.ts +242 -0
  510. package/src/apply-merge-action.ts +502 -0
  511. package/src/apply-persist.ts +518 -0
  512. package/src/arbiter.ts +372 -0
  513. package/src/brand.ts +111 -0
  514. package/src/buildable-body.ts +196 -0
  515. package/src/categorise.ts +158 -0
  516. package/src/claim-cas.ts +513 -0
  517. package/src/cli-spinner.ts +225 -0
  518. package/src/cli.ts +4369 -0
  519. package/src/close-job-template.ts +236 -0
  520. package/src/close-job.ts +319 -0
  521. package/src/complete.ts +1379 -0
  522. package/src/concurrency.ts +151 -0
  523. package/src/config-override.ts +116 -0
  524. package/src/config.ts +883 -0
  525. package/src/continue-branch.ts +542 -0
  526. package/src/cwd-section.ts +392 -0
  527. package/src/decision-engine.ts +272 -0
  528. package/src/detect.ts +124 -0
  529. package/src/do-autopick.ts +223 -0
  530. package/src/do-config.ts +589 -0
  531. package/src/do-remote-auto.ts +197 -0
  532. package/src/do.ts +2623 -0
  533. package/src/drop-source.ts +194 -0
  534. package/src/eligibility.ts +79 -0
  535. package/src/env-config.ts +305 -0
  536. package/src/failure-cause.ts +142 -0
  537. package/src/format.ts +313 -0
  538. package/src/frontmatter.ts +485 -0
  539. package/src/gate-readiness.ts +147 -0
  540. package/src/gc.ts +510 -0
  541. package/src/gh-failure.ts +53 -0
  542. package/src/git.ts +186 -0
  543. package/src/github.ts +468 -0
  544. package/src/harness.ts +355 -0
  545. package/src/identity.ts +322 -0
  546. package/src/index.ts +785 -0
  547. package/src/install-ci-branch-protection.ts +255 -0
  548. package/src/install-ci-capabilities/advance-lifecycle.ts +34 -0
  549. package/src/install-ci-capabilities/close-job.ts +32 -0
  550. package/src/install-ci-capabilities/example-noop.ts +24 -0
  551. package/src/install-ci-capabilities/intake.ts +34 -0
  552. package/src/install-ci-capabilities/verify.ts +33 -0
  553. package/src/install-ci-core.ts +1088 -0
  554. package/src/install-ci-github.ts +376 -0
  555. package/src/install-ci.ts +552 -0
  556. package/src/intake-event.ts +102 -0
  557. package/src/intake-marker.ts +195 -0
  558. package/src/intake-triage.ts +138 -0
  559. package/src/intake-trigger-template.ts +591 -0
  560. package/src/intake.ts +2445 -0
  561. package/src/integration-core.ts +3065 -0
  562. package/src/integrator.ts +771 -0
  563. package/src/isolation.ts +484 -0
  564. package/src/issue-provider.ts +733 -0
  565. package/src/item-lock.ts +1858 -0
  566. package/src/item-path.ts +75 -0
  567. package/src/ledger-lint.ts +332 -0
  568. package/src/ledger-read.ts +924 -0
  569. package/src/ledger-write.ts +865 -0
  570. package/src/lifecycle-gather.ts +298 -0
  571. package/src/lifecycle-pools.ts +250 -0
  572. package/src/merge-question-surfacer.ts +496 -0
  573. package/src/mint-adr.ts +362 -0
  574. package/src/mirror-pool-scan.ts +240 -0
  575. package/src/needs-attention.ts +1506 -0
  576. package/src/orphan-sidecar.ts +150 -0
  577. package/src/output.ts +89 -0
  578. package/src/pi-harness.ts +403 -0
  579. package/src/placement.ts +131 -0
  580. package/src/prd-to-spec.ts +1023 -0
  581. package/src/prepare.ts +230 -0
  582. package/src/prompt.ts +760 -0
  583. package/src/readiness.ts +98 -0
  584. package/src/reap-branches.ts +278 -0
  585. package/src/recover-isolated.ts +276 -0
  586. package/src/registry.ts +475 -0
  587. package/src/repo-config.ts +550 -0
  588. package/src/repo-key.ts +74 -0
  589. package/src/repo-mirror.ts +367 -0
  590. package/src/retry-backoff.ts +130 -0
  591. package/src/review-gate.ts +389 -0
  592. package/src/review-verdict.ts +422 -0
  593. package/src/run.ts +1430 -0
  594. package/src/scan.ts +611 -0
  595. package/src/select-order.ts +143 -0
  596. package/src/select-priority.ts +266 -0
  597. package/src/select.ts +62 -0
  598. package/src/session-path.ts +153 -0
  599. package/src/sidecar-apply.ts +216 -0
  600. package/src/sidecar.ts +700 -0
  601. package/src/slug-namespace.ts +367 -0
  602. package/src/spec-complete.ts +118 -0
  603. package/src/start.ts +974 -0
  604. package/src/status.ts +441 -0
  605. package/src/surface-gate.ts +337 -0
  606. package/src/surface-persist.ts +241 -0
  607. package/src/tasker-review-loop.ts +671 -0
  608. package/src/tasking-eligibility.ts +114 -0
  609. package/src/tasking-lock.ts +416 -0
  610. package/src/tasking.ts +1438 -0
  611. package/src/triage-gate.ts +248 -0
  612. package/src/triage-persist.ts +570 -0
  613. package/src/verdict-json.ts +73 -0
  614. package/src/verify-workflow-template.ts +159 -0
  615. package/src/verify.ts +123 -0
  616. package/src/watch-session.ts +397 -0
  617. package/src/work-layout.ts +262 -0
  618. package/src/work-on.ts +660 -0
  619. package/src/workspace.ts +502 -0
@@ -0,0 +1,387 @@
1
+ import { cpSync, existsSync, mkdirSync, rmSync, statSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { git, runAsync } from './git.js';
5
+ import { performClaim } from './claim-cas.js';
6
+ import { encodeRepoKey, ensureMirror, fetchMirrorMain, mirrorPath, } from './repo-mirror.js';
7
+ import { defaultConfigPath, loadConfig, saveConfig, } from './config.js';
8
+ import { brand } from './brand.js';
9
+ import { workBranchRef } from './slug-namespace.js';
10
+ const DEFAULT_ARBITER = 'origin';
11
+ /** Raised for usage/environment errors (exit 1, outcome 'usage-error'). */
12
+ class WorkOnUsageError extends Error {
13
+ }
14
+ /**
15
+ * Run the `work-on` ritual. Never throws for the expected lost/contended/refused
16
+ * cases — those are returned with the appropriate exit code and NO worktree.
17
+ * Usage/environment problems surface as exit 1.
18
+ */
19
+ export async function performWorkOn(options) {
20
+ const note = options.note ?? (() => { });
21
+ try {
22
+ return await runWorkOn(options, note);
23
+ }
24
+ catch (err) {
25
+ const message = err instanceof Error ? err.message : String(err);
26
+ return { exitCode: 1, outcome: 'usage-error', message };
27
+ }
28
+ }
29
+ async function runWorkOn(options, note) {
30
+ const slug = options.slug;
31
+ if (!slug) {
32
+ throw new WorkOnUsageError('missing <slug>. usage: dorfl work-on <slug> [--remote <r>]');
33
+ }
34
+ const env = options.env;
35
+ const workspacesDir = options.workspacesDir ?? join(homedir(), brand.workdirName);
36
+ // The human worktree root: configured value wins; otherwise prompt + save on
37
+ // first use (a sensible suggestion, NEVER a silent default; never under
38
+ // ~/.dorfl/).
39
+ const root = await resolveHumanWorktreesRoot(options, note);
40
+ // Resolve the arbiter URL + a CLAIM CONTEXT (a checkout with the arbiter
41
+ // remote where the CAS runs). The ONLY thing that differs between the two
42
+ // forms is the claim context's location; both fetch + branch off the fresh
43
+ // arbiter main, so the starting commit is identical.
44
+ const ctx = await resolveClaimContext({
45
+ slug,
46
+ remote: options.remote,
47
+ cwd: options.cwd,
48
+ arbiter: options.arbiter ?? DEFAULT_ARBITER,
49
+ workspacesDir,
50
+ env,
51
+ note,
52
+ });
53
+ try {
54
+ // Claim FIRST. On a lost/contended/refused claim, create NO worktree
55
+ // (clean failure, exactly like `claim`).
56
+ const claim = await performClaim({
57
+ slug,
58
+ cwd: ctx.claimCwd,
59
+ arbiter: ctx.claimArbiter,
60
+ env,
61
+ humanPath: true,
62
+ override: options.override,
63
+ note,
64
+ });
65
+ if (claim.exitCode !== 0) {
66
+ const outcome = claim.outcome === 'not-ready'
67
+ ? 'refused'
68
+ : claim.exitCode === 2
69
+ ? 'lost'
70
+ : claim.exitCode === 3
71
+ ? 'contended'
72
+ : 'usage-error';
73
+ return { exitCode: claim.exitCode, outcome, message: claim.message };
74
+ }
75
+ // The claim landed. Create the human worktree off the FRESHLY-FETCHED
76
+ // arbiter main (which now includes the claim move). We branch from the hub
77
+ // mirror's main so both forms share one branching primitive.
78
+ const created = createHumanWorktree({
79
+ slug,
80
+ root,
81
+ arbiterUrl: ctx.arbiterUrl,
82
+ workspacesDir,
83
+ env,
84
+ });
85
+ // Copy named gitignored files (copy, not symlink) so the project is
86
+ // runnable; print a security notice. Source resolved per mode.
87
+ const copied = copyGitignoredFiles({
88
+ copy: options.copy,
89
+ copyFrom: options.copyFrom,
90
+ remoteMode: ctx.remoteMode,
91
+ inRepoSource: options.cwd,
92
+ destDir: created.dir,
93
+ note,
94
+ });
95
+ const message = `Created worktree for '${slug}' at ${created.dir} (branch ${created.branch}).`;
96
+ note(message);
97
+ note(`To start working: cd ${created.dir}`);
98
+ // `--agent` (task `agent-interactive-launch`): launch the configured harness
99
+ // INTERACTIVELY in the freshly-created worktree so the human can immediately
100
+ // drive the agent there. It is NOT a tracked job (decision #3): no record, no
101
+ // gate — it blocks in the foreground until the human exits, then control
102
+ // returns and they drive `complete`/`requeue`. The model/session are bound in
103
+ // the CLI's launcher closure (config lives there).
104
+ if (options.launchInteractive) {
105
+ note(`Launching the configured harness interactively in ${created.dir}.`);
106
+ options.launchInteractive({ slug, dir: created.dir, env });
107
+ }
108
+ return {
109
+ exitCode: 0,
110
+ outcome: 'created',
111
+ dir: created.dir,
112
+ branch: created.branch,
113
+ arbiterUrl: ctx.arbiterUrl,
114
+ startCommit: created.startCommit,
115
+ copied,
116
+ message,
117
+ };
118
+ }
119
+ finally {
120
+ ctx.cleanup();
121
+ }
122
+ }
123
+ /**
124
+ * Resolve where + how the claim CAS runs, per mode. The starting commit is
125
+ * guaranteed identical because the claim and the worktree both branch off the
126
+ * freshly-fetched arbiter main; only the claim context's LOCATION differs.
127
+ */
128
+ async function resolveClaimContext(params) {
129
+ const { remote, cwd, arbiter, workspacesDir, env, note } = params;
130
+ if (remote === undefined || remote.trim() === '') {
131
+ // IN-REPO: infer the arbiter URL from the current repo; claim runs here.
132
+ if ((await gitSoft(['rev-parse', '--git-dir'], cwd, env)).status !== 0) {
133
+ throw new WorkOnUsageError('not inside a git repository (run inside a clone, or use the remote form: work-on --remote <r> <slug>)');
134
+ }
135
+ const url = await gitSoft(['remote', 'get-url', arbiter], cwd, env);
136
+ if (url.status !== 0) {
137
+ throw new WorkOnUsageError(`no git remote named '${arbiter}' (set one, or pass --arbiter)`);
138
+ }
139
+ return {
140
+ arbiterUrl: url.stdout.trim(),
141
+ claimCwd: cwd,
142
+ claimArbiter: arbiter,
143
+ remoteMode: false,
144
+ cleanup: () => { },
145
+ };
146
+ }
147
+ // REMOTE: ensure a hub mirror for <remote> (create if absent, like agents do)
148
+ // so the worktree can later branch off it. The claim itself needs a normal
149
+ // (non-bare) checkout with an `origin/main` tracking ref + a work tree to
150
+ // commit in, which a bare mirror does not provide — so the claim runs in a
151
+ // THROWAWAY clone of the arbiter URL (removed in cleanup either way).
152
+ //
153
+ // When the mirror already exists we refresh ONLY `main` (non-pruning): a
154
+ // pruning mirror-fetch here would delete the LOCAL-ONLY `work/<slug>` branches
155
+ // of other live human worktrees off this hub.
156
+ const hubPath = mirrorPath(workspacesDir, remote);
157
+ let mirrorUrl;
158
+ if (existsSync(hubPath)) {
159
+ mirrorUrl = ensureMirrorUrl(remote);
160
+ fetchMirrorMain(hubPath, env);
161
+ note(`Reusing hub mirror for ${mirrorUrl} at ${hubPath}.`);
162
+ }
163
+ else {
164
+ const created = ensureMirror({ url: remote, workspacesDir, env });
165
+ mirrorUrl = created.url;
166
+ note(`Created hub mirror for ${mirrorUrl} at ${created.path}.`);
167
+ }
168
+ const claimDir = join(workspacesDir, 'claim', `${encodeRepoKey(mirrorUrl).split('/').join('__')}__${params.slug}`);
169
+ rmSync(claimDir, { recursive: true, force: true });
170
+ mkdirSync(dirname(claimDir), { recursive: true });
171
+ // A lightweight clone whose `origin` IS the arbiter URL — the claim CAS fetches
172
+ // `origin` + branches off `origin/main`, exactly as in the in-repo form.
173
+ git(['clone', '--quiet', mirrorUrl, claimDir], dirname(claimDir), { env });
174
+ return {
175
+ arbiterUrl: mirrorUrl,
176
+ claimCwd: claimDir,
177
+ claimArbiter: 'origin',
178
+ remoteMode: true,
179
+ cleanup: () => rmSync(claimDir, { recursive: true, force: true }),
180
+ };
181
+ }
182
+ /**
183
+ * Create the human worktree at `<root>/<key>/<slug>/` on `work/<slug>`, branched
184
+ * off the freshly-fetched hub-mirror `main`. The mirror is (re-)fetched here too,
185
+ * so even in in-repo mode the worktree is cut from the latest arbiter main — the
186
+ * same-starting-commit guarantee.
187
+ */
188
+ function createHumanWorktree(params) {
189
+ const { slug, root, arbiterUrl, workspacesDir, env } = params;
190
+ // Ensure the hub mirror exists, then refresh ONLY `main` to the latest arbiter
191
+ // tip (which, post-claim, includes the claim move). We do NOT use the pruning
192
+ // mirror-fetch here: this mirror also holds the LOCAL-ONLY `work/<slug>`
193
+ // branches of other live human worktrees, and a pruning fetch would delete
194
+ // (and corrupt) them. fetchMirrorMain refreshes main without touching them.
195
+ const hubPath = mirrorPath(workspacesDir, arbiterUrl);
196
+ let mirrorUrl = arbiterUrl;
197
+ if (existsSync(hubPath)) {
198
+ fetchMirrorMain(hubPath, env);
199
+ }
200
+ else {
201
+ mirrorUrl = ensureMirror({ url: arbiterUrl, workspacesDir, env }).url;
202
+ }
203
+ const key = encodeRepoKey(mirrorUrl);
204
+ // `work-on` builds a TASK in a worktree — the task-namespaced work branch.
205
+ const branch = workBranchRef('task', slug);
206
+ const dir = join(root, key, slug);
207
+ // Clear any stale worktree/branch for this slug (idempotent re-run).
208
+ clearWorktree(hubPath, dir, env);
209
+ pruneBranch(hubPath, branch, env);
210
+ mkdirSync(dirname(dir), { recursive: true });
211
+ git(['worktree', 'add', '--quiet', '-b', branch, dir, 'main'], hubPath, {
212
+ env,
213
+ });
214
+ const startCommit = git(['rev-parse', 'HEAD'], dir, { env }).trim();
215
+ return { dir, branch, startCommit };
216
+ }
217
+ /**
218
+ * Copy the named gitignored files into the new worktree (COPY, not symlink). A
219
+ * fresh worktree has NONE of your untracked files, so a project that needs e.g.
220
+ * `.env.local` to run won't run without this. Prints a one-line SECURITY NOTICE
221
+ * naming what was copied and that secrets now live in a second location.
222
+ *
223
+ * Source: the current repo in in-repo mode; in remote mode there is no implicit
224
+ * source, so `--copy` REQUIRES `--copy-from <path>`.
225
+ */
226
+ function copyGitignoredFiles(params) {
227
+ const { copy, copyFrom, remoteMode, inRepoSource, destDir, note } = params;
228
+ if (!copy || copy.trim() === '') {
229
+ return [];
230
+ }
231
+ const patterns = copy
232
+ .split(',')
233
+ .map((p) => p.trim())
234
+ .filter((p) => p.length > 0);
235
+ if (patterns.length === 0) {
236
+ return [];
237
+ }
238
+ const source = resolveCopySource({ remoteMode, copyFrom, inRepoSource });
239
+ const copied = [];
240
+ const missing = [];
241
+ for (const name of patterns) {
242
+ const from = join(source, name);
243
+ if (!existsSync(from)) {
244
+ missing.push(name);
245
+ continue;
246
+ }
247
+ const to = join(destDir, name);
248
+ mkdirSync(dirname(to), { recursive: true });
249
+ // Copy (recursively for dirs); explicitly NOT a symlink, so the worktree is
250
+ // tooling-safe and self-contained.
251
+ cpSync(from, to, { recursive: true });
252
+ copied.push(name);
253
+ }
254
+ if (missing.length > 0) {
255
+ note(`!! --copy: not found in ${source} (skipped): ${missing.join(', ')}.`);
256
+ }
257
+ if (copied.length > 0) {
258
+ note(`!! SECURITY NOTICE: copied ${copied.length} gitignored file(s) into the ` +
259
+ `new worktree: ${copied.join(', ')}. These are real copies (not ` +
260
+ `symlinks) — secrets now live in a SECOND location (${destDir}). ` +
261
+ 'Treat that worktree like the source for credential hygiene.');
262
+ }
263
+ return copied;
264
+ }
265
+ /** Resolve the source dir for `--copy`, enforcing `--copy-from` in remote mode. */
266
+ function resolveCopySource(params) {
267
+ const { remoteMode, copyFrom, inRepoSource } = params;
268
+ if (remoteMode) {
269
+ if (!copyFrom || copyFrom.trim() === '') {
270
+ throw new WorkOnUsageError('--copy needs an explicit source in remote mode: pass --copy-from <path> ' +
271
+ '(there is no current repo to copy gitignored files from).');
272
+ }
273
+ const src = resolve(copyFrom);
274
+ if (!existsSync(src) || !statSync(src).isDirectory()) {
275
+ throw new WorkOnUsageError(`--copy-from path does not exist or is not a directory: ${src}`);
276
+ }
277
+ return src;
278
+ }
279
+ return inRepoSource;
280
+ }
281
+ /**
282
+ * Resolve the human worktree root: a configured `humanWorktreesDir` wins; else
283
+ * prompt for it (a sensible SUGGESTION, no silent default) and SAVE it, so the
284
+ * human is asked exactly once. NEVER allow a root under `~/.dorfl/` (that
285
+ * is the agents' execution area — work-on is human-only).
286
+ */
287
+ async function resolveHumanWorktreesRoot(options, note) {
288
+ const configured = options.humanWorktreesDir;
289
+ if (configured && configured.trim() !== '') {
290
+ return assertHumanRoot(resolve(configured));
291
+ }
292
+ if (!options.promptForRoot) {
293
+ throw new WorkOnUsageError('humanWorktreesDir is not configured and no prompt is available; set ' +
294
+ '`humanWorktreesDir` in config (a human-only worktree root, NOT under ' +
295
+ '~/.dorfl/).');
296
+ }
297
+ const suggestion = suggestHumanWorktreesDir();
298
+ const answeredRaw = await options.promptForRoot(suggestion);
299
+ const answered = (answeredRaw ?? '').trim();
300
+ if (answered === '') {
301
+ throw new WorkOnUsageError('no humanWorktreesDir provided — aborting (work-on needs a worktree root).');
302
+ }
303
+ const chosen = assertHumanRoot(resolve(answered));
304
+ if (options.saveRoot) {
305
+ options.saveRoot(chosen);
306
+ note(`Saved humanWorktreesDir = ${chosen} to config.`);
307
+ }
308
+ return chosen;
309
+ }
310
+ /**
311
+ * Reject a human worktree root under `~/.dorfl/` (the agents' area, ADR
312
+ * §3): work-on is human-only and must never share that space.
313
+ */
314
+ function assertHumanRoot(dir) {
315
+ const agentArea = join(homedir(), brand.workdirName);
316
+ const normalized = dir.endsWith('/') ? dir.slice(0, -1) : dir;
317
+ if (normalized === agentArea || normalized.startsWith(agentArea + '/')) {
318
+ throw new WorkOnUsageError(`humanWorktreesDir must NOT be under ${agentArea} (that is the agents' ` +
319
+ 'execution area; work-on is human-only). Choose a separate human dir.');
320
+ }
321
+ return dir;
322
+ }
323
+ /**
324
+ * A sensible SUGGESTION for the human worktree root. Deliberately uses a name
325
+ * (`~/worktrees`) that does NOT share a prefix with the usual code dir
326
+ * (`~/dev/...`), so shell tab-completion on the code dir never collides with it.
327
+ * This is only a suggestion — there is no silent default; the human confirms.
328
+ */
329
+ export function suggestHumanWorktreesDir() {
330
+ return join(homedir(), 'worktrees');
331
+ }
332
+ /** Remove a worktree registration from the hub (git's own removal, never rm -rf). */
333
+ function clearWorktree(mirrorPath, dir, env) {
334
+ if (existsSync(dir)) {
335
+ try {
336
+ git(['worktree', 'remove', '--force', dir], mirrorPath, { env });
337
+ }
338
+ catch {
339
+ // not a registered worktree — fall through to a plain rm + prune
340
+ rmSync(dir, { recursive: true, force: true });
341
+ }
342
+ }
343
+ try {
344
+ git(['worktree', 'prune'], mirrorPath, { env });
345
+ }
346
+ catch {
347
+ // best-effort
348
+ }
349
+ }
350
+ /** Drop a branch from the hub if it exists (idempotent re-run safety). */
351
+ function pruneBranch(mirrorPath, branch, env) {
352
+ try {
353
+ git(['branch', '-D', branch], mirrorPath, { env });
354
+ }
355
+ catch {
356
+ // branch may not exist
357
+ }
358
+ }
359
+ /**
360
+ * The canonical arbiter URL a mirror tracks for a given `remote` spec. The
361
+ * mirror is cloned from `remote`, so the tracked URL is just the trimmed spec
362
+ * (the same value {@link ensureMirror} would resolve from `url`).
363
+ */
364
+ function ensureMirrorUrl(remote) {
365
+ return remote.trim();
366
+ }
367
+ /** Run git, returning the raw result (no throw) — for soft checks. */
368
+ function gitSoft(args, cwd, env) {
369
+ return runAsync('git', args, cwd, { env });
370
+ }
371
+ /**
372
+ * Resolve `humanWorktreesDir` + `configPath` for the CLI: read config from
373
+ * `configPath` and surface its `humanWorktreesDir` (undefined ⇒ first use). The
374
+ * CLI wires the prompt/save around this; kept here so the wiring is testable.
375
+ */
376
+ export function loadHumanWorktreesDir(configPath = defaultConfigPath()) {
377
+ const config = loadConfig(configPath);
378
+ return { dir: config.humanWorktreesDir, config };
379
+ }
380
+ /** Save a chosen `humanWorktreesDir` back to `configPath`, preserving the rest. */
381
+ export function persistHumanWorktreesDir(dir, configPath = defaultConfigPath()) {
382
+ const config = loadConfig(configPath);
383
+ saveConfig({ ...config, humanWorktreesDir: dir }, configPath);
384
+ }
385
+ // Re-export for callers that want the encoding without importing repo-mirror.
386
+ export { encodeRepoKey };
387
+ //# sourceMappingURL=work-on.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-on.js","sourceRoot":"","sources":["../src/work-on.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AACxE,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,EAAC,GAAG,EAAE,QAAQ,EAAiB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,aAAa,EACb,YAAY,EACZ,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C;AAED,sEAAsE;AACtE,SAAS,OAAO,CACf,IAAc,EACd,GAAW,EACX,GAAkC;IAElC,OAAO,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAC,GAAG,EAAC,CAAC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,aAAqB,iBAAiB,EAAE;IAKxC,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,EAAC,GAAG,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAC,CAAC;AAChD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,wBAAwB,CACvC,GAAW,EACX,aAAqB,iBAAiB,EAAE;IAExC,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,UAAU,CAAC,EAAC,GAAG,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAC,EAAE,UAAU,CAAC,CAAC;AAC7D,CAAC;AAED,8EAA8E;AAC9E,OAAO,EAAC,aAAa,EAAC,CAAC"}
@@ -0,0 +1,224 @@
1
+ import { type EnsureMirrorResult } from './repo-mirror.js';
2
+ import { type HarnessRecord } from './harness.js';
3
+ import { type SlugNamespace } from './slug-namespace.js';
4
+ /**
5
+ * The workspace manager (ADR §2): one git worktree per **job** (a claimed work
6
+ * item being processed), checked out OUTSIDE the bare hub mirror at
7
+ * `<workspacesDir>/work/<work-id>/`, on branch `work/<slug>`, branched off the
8
+ * hub's freshly-fetched `main`.
9
+ *
10
+ * This is the single isolation primitive (ADR §1: jobs-not-agents) — both the
11
+ * autonomous `run-once` runner and (later) the human `work-on` build on it. It
12
+ * consumes the **`repo-mirror`** hub primitive (it does NOT reimplement mirror
13
+ * management or the repo→key encoding) and leaves a per-job state record (a
14
+ * `<work-id>.json` SIBLING of the worktree, OUTSIDE the checked-out tree —
15
+ * {@link jobRecordPath}) + the worktree on disk for `gc`/`status` to read (those
16
+ * are SEPARATE tasks — this task only provides the state they evaluate).
17
+ *
18
+ * `<workspacesDir>` is STATE, not cache (ADR §3): it lives under a single
19
+ * visible `~/.dorfl/`, never `~/.cache`.
20
+ */
21
+ /** The on-disk JSON record `gc`/`status` read to evaluate a job. */
22
+ export interface JobRecord {
23
+ /** The work slug being processed. */
24
+ slug: string;
25
+ /** The encoded repo key (the hub mirror key for the arbiter URL). */
26
+ repoKey: string;
27
+ /** The work branch checked out in the worktree (`work/<slug>`). */
28
+ branch: string;
29
+ /** ISO timestamp the job worktree was created. */
30
+ startedAt: string;
31
+ /** Lifecycle state; `gc`/`status` read this alongside the worktree's existence. */
32
+ state: JobState;
33
+ /**
34
+ * Why the job is stuck, when `state` is `needs-attention` (ADR §12). The
35
+ * runner records the reason it routed the job to needs-attention (a red gate,
36
+ * a rebase conflict, …) so `status` can surface it without re-deriving it.
37
+ * Absent for `running`/`done` jobs.
38
+ */
39
+ reason?: string;
40
+ /**
41
+ * The URL of the review request opened for this job (e.g. a GitHub PR), when
42
+ * `propose` mode + a real provider (ADR §6) opened one. Recorded so `status`
43
+ * can surface it. Absent for merge mode, the push-only `none`/degraded path,
44
+ * and jobs that have not integrated yet.
45
+ */
46
+ prUrl?: string;
47
+ /** The harness block: how this job is launched + its liveness pointer. */
48
+ harness: HarnessRecord;
49
+ }
50
+ /**
51
+ * A job's lifecycle state, persisted in its record. The reaper (`gc`) and
52
+ * `status` read it together with the worktree's existence (ADR §4); this task
53
+ * only ever sets `running` (and lets the harness/integration update it later).
54
+ */
55
+ export type JobState = 'running' | 'done' | 'needs-attention';
56
+ /**
57
+ * Encode a flat, deterministic, unique-per-claim **work-id** from the arbiter
58
+ * URL + slug: the hierarchical repo key with its `/` separators flattened to
59
+ * `__`, then `__<slug>` appended (ADR §2). Flat (not hierarchical) so listing /
60
+ * counting / GC of jobs is a flat `ls`. Reuses the `repo-mirror` repo→key
61
+ * encoding (dot→dash per segment) — it does NOT duplicate it.
62
+ *
63
+ * E.g. `git@github.com:wighawag/dorfl.git` + `feat`
64
+ * → `github-com__wighawag__dorfl__feat`.
65
+ */
66
+ export declare function encodeWorkId(url: string, slug: string): string;
67
+ /**
68
+ * The on-disk location of a job's worktree: `<workspacesDir>/work/<work-id>/`.
69
+ * Flat, OUTSIDE the hub (`<workspacesDir>/repos/...`), under `workspacesDir`
70
+ * (default `~/.dorfl`), never `~/.cache` (ADR §3).
71
+ */
72
+ export declare function jobWorktreePath(workspacesDir: string, url: string, slug: string): string;
73
+ /** Filename of the per-job record. Derived from the single brand identity
74
+ * (`.{base}-job.json`) so a rename flips it in lockstep.
75
+ *
76
+ * HISTORICAL: this used to be the name of a file written INSIDE the job worktree
77
+ * (`<work-id>/.dorfl-job.json`). That in-tree location was the mistake —
78
+ * a runtime control file inside the checked-out worktree got swept onto the work
79
+ * branch by the runner's broad `git add -A` commits (and once WEDGED a
80
+ * continue-rebase `git switch`). The record now lives at a SIBLING path OUTSIDE
81
+ * the worktree ({@link jobRecordPath}); this constant survives only as the
82
+ * legacy in-tree read-fallback name + as the no-op-build / clean-worktree
83
+ * classification token in `agent-stop.ts`/`gc.ts` (now inert — the record can no
84
+ * longer appear in `git status`). */
85
+ export declare const JOB_RECORD_FILENAME: string;
86
+ /**
87
+ * The on-disk location of a job's state record: a SIBLING of its worktree dir,
88
+ * `<workspacesDir>/work/<work-id>.json` (NEXT TO `<workspacesDir>/work/<work-id>/`,
89
+ * NOT inside it).
90
+ *
91
+ * This is the structural fix for the in-tree leak: the record is still under the
92
+ * same `workspacesDir/work/` control area (so `discoverJobs`'s single-directory
93
+ * walk still finds it), but it is PHYSICALLY OUTSIDE the checked-out git
94
+ * worktree, so the runner's broad `git add -A` commits can NEVER stage it — in
95
+ * ANY repo, with no `.gitignore` entry needed. A `<work-id>.json` file name can
96
+ * never collide with the `<work-id>/` worktree DIR (one carries a `.json`
97
+ * extension, the other does not).
98
+ *
99
+ * Derived purely from the worktree `dir` (sibling = `<dir>.json`) so every
100
+ * existing caller that holds a worktree dir keeps the same `(dir, …)` signature.
101
+ */
102
+ export declare function jobRecordPath(dir: string): string;
103
+ export interface CreateJobOptions {
104
+ /**
105
+ * The arbiter remote URL to mirror + branch from. Either `url` OR
106
+ * (`fromRepo` + `arbiter`) must be given; if both, `url` wins.
107
+ */
108
+ url?: string;
109
+ /** A working repo to resolve the arbiter URL from (with `arbiter`). */
110
+ fromRepo?: string;
111
+ /** Remote name in `fromRepo` whose URL to mirror (default `origin`). */
112
+ arbiter?: string;
113
+ /** The work slug being processed (→ branch `work/<type>-<slug>` + work-id). */
114
+ slug: string;
115
+ /**
116
+ * The item TYPE — `'task'` (build) or `'prd'` (tasking) — namespacing the
117
+ * work branch via {@link workBranchRef} so a same-slug task and prd never
118
+ * collide. Defaults to `'task'`.
119
+ */
120
+ type?: SlugNamespace;
121
+ /** The execution working area (config `workspacesDir`, default `~/.dorfl`). */
122
+ workspacesDir: string;
123
+ /** The initial harness block to persist in the record (default: null adapter). */
124
+ harness?: HarnessRecord;
125
+ env?: NodeJS.ProcessEnv;
126
+ }
127
+ export interface Job {
128
+ /** Working directory the agent + tests run in (the worktree). */
129
+ dir: string;
130
+ /** The work branch checked out there (`work/<slug>`). */
131
+ branch: string;
132
+ /** The slug being processed. */
133
+ slug: string;
134
+ /**
135
+ * The git remote name VALID INSIDE the worktree that tracks the arbiter. A
136
+ * job worktree is cut from the bare hub mirror, whose clone remote is
137
+ * `origin` (pointing at the arbiter URL). So rebase/integrate inside the
138
+ * worktree always target `origin`, regardless of what the source working repo
139
+ * calls its arbiter remote.
140
+ */
141
+ arbiterRemote: string;
142
+ /** Absolute path to the per-job record. */
143
+ recordPath: string;
144
+ /** The persisted record. */
145
+ record: JobRecord;
146
+ /** The hub-mirror result this job was cut from. */
147
+ mirror: EnsureMirrorResult;
148
+ /**
149
+ * True iff this job CONTINUED a kept arbiter `work/<slug>` branch (a requeue)
150
+ * rather than cutting fresh off main — the worktree was cut from that branch
151
+ * and rebased onto the freshly-fetched main at onboard-time (ADR §10).
152
+ */
153
+ continued: boolean;
154
+ /**
155
+ * True iff a CONTINUE rebase onto fresh main CONFLICTED (aborted, never
156
+ * auto-resolved). The caller (`run`'s pipeline / `do --remote`) routes the
157
+ * item to needs-attention via the §10 path; the worktree is left on the
158
+ * un-rebased kept branch as the never-lose-work signal.
159
+ */
160
+ continueRebaseConflict: boolean;
161
+ /**
162
+ * Set iff the CONTINUE reconcile push to the arbiter FAILED TERMINALLY (the
163
+ * stale-lease retry cap was exhausted, or a non-stale-lease rejection such as
164
+ * a protected ref / an unreachable arbiter) — the helper THROWS, and we catch
165
+ * it here so the run does NOT crash leaving the task silently in-progress on
166
+ * the arbiter (the stale-lease-strand bug). The caller routes the item to
167
+ * needs-attention, the kept work left committed + recoverable on the branch.
168
+ * Absent on a fresh cut, a clean continue that pushed, and a rebase conflict
169
+ * (which sets {@link continueRebaseConflict} instead).
170
+ */
171
+ continuePushFailure?: string;
172
+ /**
173
+ * Remove the job's worktree + work branch from the hub (`git worktree remove`
174
+ * + prune; never a bare `rm -rf`, ADR §4). NOTE: the SAFE-to-delete predicate
175
+ * (ADR §4) is owned by the `gc` task — this is only the mechanical teardown
176
+ * the runner uses after a job is provably saved.
177
+ */
178
+ dispose(): void;
179
+ }
180
+ /**
181
+ * Create (or recreate) a job: ensure the hub mirror via `repo-mirror`, then
182
+ * `git worktree add` a per-job worktree OUTSIDE the hub at
183
+ * `<workspacesDir>/work/<work-id>/` on `work/<slug>`, branched off the
184
+ * freshly-fetched `<hub>/main`. Writes the per-job record at a SIBLING of the
185
+ * worktree (`<work-id>.json`, OUTSIDE the tree — {@link jobRecordPath}).
186
+ *
187
+ * Distinct slugs ⇒ distinct `work/<slug>` branches, so git's one-branch-per-
188
+ * worktree constraint is naturally avoided (ADR §2). If a stale worktree/branch
189
+ * for this work-id already exists it is cleared first (idempotent re-create).
190
+ */
191
+ export declare function createJob(options: CreateJobOptions): Job;
192
+ /**
193
+ * Write (or overwrite) a job's record to its SIBLING path ({@link jobRecordPath},
194
+ * `<work-id>.json` next to the worktree), OUTSIDE the checked-out tree. `dir` is
195
+ * the worktree dir, kept as the parameter so every caller is unchanged.
196
+ */
197
+ export declare function writeJobRecord(dir: string, record: JobRecord): void;
198
+ /**
199
+ * Read a job's record given its worktree `dir`, or `undefined` if absent/invalid.
200
+ *
201
+ * Reads the NEW sibling location ({@link jobRecordPath}) first, then falls back
202
+ * to the LEGACY in-tree location (`<dir>/.dorfl-job.json`) so a job
203
+ * worktree materialised by an OLD binary (record still inside the tree) stays
204
+ * discoverable/reapable until it is torn down. New jobs only ever write the
205
+ * sibling path, so the fallback is purely for in-flight migration.
206
+ */
207
+ export declare function readJobRecord(dir: string): JobRecord | undefined;
208
+ /**
209
+ * Delete a job's record on teardown — BOTH the new sibling path
210
+ * ({@link jobRecordPath}) and the legacy in-tree path (an old-binary worktree).
211
+ * Best-effort + idempotent (a missing file is fine). Called when a worktree is
212
+ * removed (reaped / disposed / cleared) so the relocated record does not outlive
213
+ * its worktree as an orphan `<work-id>.json` (when the record lived INSIDE the
214
+ * worktree it was deleted WITH it by `git worktree remove`; now that it is a
215
+ * sibling, its teardown must be explicit).
216
+ */
217
+ export declare function removeJobRecord(dir: string): void;
218
+ /**
219
+ * Update a job's record in place (e.g. flip `state` to `needs-attention` after a
220
+ * rebase conflict), merging the patch over the on-disk record. A no-op if no
221
+ * record exists.
222
+ */
223
+ export declare function updateJobRecord(dir: string, patch: Partial<JobRecord>): JobRecord | undefined;
224
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAGN,KAAK,kBAAkB,EACvB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAAC,KAAK,aAAa,EAAC,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAgB,KAAK,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAEtE;;;;;;;;;;;;;;;;GAgBG;AAEH,oEAAoE;AACpE,M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