@matteeh/osq 0.2.1 → 0.2.2

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 (606) hide show
  1. package/README.md +234 -15
  2. package/dist/cli/approve.d.ts +7 -0
  3. package/dist/cli/approve.d.ts.map +1 -1
  4. package/dist/cli/approve.js +34 -0
  5. package/dist/cli/approve.js.map +1 -1
  6. package/dist/cli/bin.js +2 -3
  7. package/dist/cli/bin.js.map +1 -1
  8. package/dist/cli/check.d.ts +15 -0
  9. package/dist/cli/check.d.ts.map +1 -0
  10. package/dist/cli/check.js +65 -0
  11. package/dist/cli/check.js.map +1 -0
  12. package/dist/cli/index.d.ts.map +1 -1
  13. package/dist/cli/index.js +10 -10
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/cli/init.d.ts.map +1 -1
  16. package/dist/cli/init.js +6 -1
  17. package/dist/cli/init.js.map +1 -1
  18. package/dist/cli/lint.d.ts +3 -0
  19. package/dist/cli/lint.d.ts.map +1 -1
  20. package/dist/cli/lint.js +33 -14
  21. package/dist/cli/lint.js.map +1 -1
  22. package/dist/cli/plan-queue.d.ts +10 -4
  23. package/dist/cli/plan-queue.d.ts.map +1 -1
  24. package/dist/cli/plan-queue.js +20 -19
  25. package/dist/cli/plan-queue.js.map +1 -1
  26. package/dist/cli/plan-sections.d.ts +15 -0
  27. package/dist/cli/plan-sections.d.ts.map +1 -0
  28. package/dist/cli/plan-sections.js +47 -0
  29. package/dist/cli/plan-sections.js.map +1 -0
  30. package/dist/cli/plan.d.ts +1 -0
  31. package/dist/cli/plan.d.ts.map +1 -1
  32. package/dist/cli/plan.js +14 -4
  33. package/dist/cli/plan.js.map +1 -1
  34. package/dist/cli/report.d.ts.map +1 -1
  35. package/dist/cli/report.js +73 -1
  36. package/dist/cli/report.js.map +1 -1
  37. package/dist/cli/run.d.ts +7 -0
  38. package/dist/cli/run.d.ts.map +1 -0
  39. package/dist/cli/run.js +22 -0
  40. package/dist/cli/run.js.map +1 -0
  41. package/dist/cli/verified.d.ts +15 -0
  42. package/dist/cli/verified.d.ts.map +1 -0
  43. package/dist/cli/verified.js +34 -0
  44. package/dist/cli/verified.js.map +1 -0
  45. package/dist/core/foundation/config-agents.d.ts +16 -0
  46. package/dist/core/foundation/config-agents.d.ts.map +1 -0
  47. package/dist/core/foundation/config-agents.js +2 -0
  48. package/dist/core/foundation/config-agents.js.map +1 -0
  49. package/dist/core/foundation/config-claude.d.ts +48 -0
  50. package/dist/core/foundation/config-claude.d.ts.map +1 -0
  51. package/dist/core/foundation/config-claude.js +106 -0
  52. package/dist/core/foundation/config-claude.js.map +1 -0
  53. package/dist/core/foundation/config-codex-resolve.d.ts +10 -0
  54. package/dist/core/foundation/config-codex-resolve.d.ts.map +1 -0
  55. package/dist/core/foundation/config-codex-resolve.js +24 -0
  56. package/dist/core/foundation/config-codex-resolve.js.map +1 -0
  57. package/dist/core/foundation/config-file.d.ts +18 -0
  58. package/dist/core/foundation/config-file.d.ts.map +1 -0
  59. package/dist/core/foundation/config-file.js +46 -0
  60. package/dist/core/foundation/config-file.js.map +1 -0
  61. package/dist/core/foundation/config-gates.d.ts +2 -0
  62. package/dist/core/foundation/config-gates.d.ts.map +1 -1
  63. package/dist/core/foundation/config-gates.js +8 -0
  64. package/dist/core/foundation/config-gates.js.map +1 -1
  65. package/dist/core/foundation/config-opencode.d.ts +25 -0
  66. package/dist/core/foundation/config-opencode.d.ts.map +1 -0
  67. package/dist/core/foundation/config-opencode.js +55 -0
  68. package/dist/core/foundation/config-opencode.js.map +1 -0
  69. package/dist/core/foundation/config-pi.d.ts +10 -0
  70. package/dist/core/foundation/config-pi.d.ts.map +1 -1
  71. package/dist/core/foundation/config-pi.js +13 -0
  72. package/dist/core/foundation/config-pi.js.map +1 -1
  73. package/dist/core/foundation/config-planning.d.ts +12 -1
  74. package/dist/core/foundation/config-planning.d.ts.map +1 -1
  75. package/dist/core/foundation/config-planning.js +29 -1
  76. package/dist/core/foundation/config-planning.js.map +1 -1
  77. package/dist/core/foundation/config-traceability.d.ts +28 -0
  78. package/dist/core/foundation/config-traceability.d.ts.map +1 -0
  79. package/dist/core/foundation/config-traceability.js +63 -0
  80. package/dist/core/foundation/config-traceability.js.map +1 -0
  81. package/dist/core/foundation/config-user.d.ts +32 -0
  82. package/dist/core/foundation/config-user.d.ts.map +1 -0
  83. package/dist/core/foundation/config-user.js +2 -0
  84. package/dist/core/foundation/config-user.js.map +1 -0
  85. package/dist/core/foundation/config-vcs.d.ts +29 -0
  86. package/dist/core/foundation/config-vcs.d.ts.map +1 -0
  87. package/dist/core/foundation/config-vcs.js +57 -0
  88. package/dist/core/foundation/config-vcs.js.map +1 -0
  89. package/dist/core/foundation/config.d.ts +23 -24
  90. package/dist/core/foundation/config.d.ts.map +1 -1
  91. package/dist/core/foundation/config.js +29 -36
  92. package/dist/core/foundation/config.js.map +1 -1
  93. package/dist/core/foundation/decisions-validate.d.ts +16 -0
  94. package/dist/core/foundation/decisions-validate.d.ts.map +1 -0
  95. package/dist/core/foundation/decisions-validate.js +74 -0
  96. package/dist/core/foundation/decisions-validate.js.map +1 -0
  97. package/dist/core/foundation/decisions.d.ts +34 -0
  98. package/dist/core/foundation/decisions.d.ts.map +1 -0
  99. package/dist/core/foundation/decisions.js +152 -0
  100. package/dist/core/foundation/decisions.js.map +1 -0
  101. package/dist/core/foundation/doctor-decisions.d.ts +9 -0
  102. package/dist/core/foundation/doctor-decisions.d.ts.map +1 -0
  103. package/dist/core/foundation/doctor-decisions.js +49 -0
  104. package/dist/core/foundation/doctor-decisions.js.map +1 -0
  105. package/dist/core/foundation/doctor-managed.d.ts.map +1 -1
  106. package/dist/core/foundation/doctor-managed.js +3 -0
  107. package/dist/core/foundation/doctor-managed.js.map +1 -1
  108. package/dist/core/foundation/doctor-prices.d.ts +8 -0
  109. package/dist/core/foundation/doctor-prices.d.ts.map +1 -0
  110. package/dist/core/foundation/doctor-prices.js +25 -0
  111. package/dist/core/foundation/doctor-prices.js.map +1 -0
  112. package/dist/core/foundation/doctor.d.ts.map +1 -1
  113. package/dist/core/foundation/doctor.js +20 -30
  114. package/dist/core/foundation/doctor.js.map +1 -1
  115. package/dist/core/foundation/harness-catalog.d.ts +7 -8
  116. package/dist/core/foundation/harness-catalog.d.ts.map +1 -1
  117. package/dist/core/foundation/harness-catalog.js +26 -41
  118. package/dist/core/foundation/harness-catalog.js.map +1 -1
  119. package/dist/core/foundation/init-blocks.d.ts +1 -1
  120. package/dist/core/foundation/init-blocks.d.ts.map +1 -1
  121. package/dist/core/foundation/init-blocks.js +51 -14
  122. package/dist/core/foundation/init-blocks.js.map +1 -1
  123. package/dist/core/foundation/init.d.ts +4 -0
  124. package/dist/core/foundation/init.d.ts.map +1 -1
  125. package/dist/core/foundation/init.js +7 -0
  126. package/dist/core/foundation/init.js.map +1 -1
  127. package/dist/core/foundation/new.d.ts +4 -1
  128. package/dist/core/foundation/new.d.ts.map +1 -1
  129. package/dist/core/foundation/new.js +18 -8
  130. package/dist/core/foundation/new.js.map +1 -1
  131. package/dist/core/foundation/package-root.d.ts +6 -0
  132. package/dist/core/foundation/package-root.d.ts.map +1 -1
  133. package/dist/core/foundation/package-root.js +6 -0
  134. package/dist/core/foundation/package-root.js.map +1 -1
  135. package/dist/core/foundation/rules-block.d.ts +11 -0
  136. package/dist/core/foundation/rules-block.d.ts.map +1 -0
  137. package/dist/core/foundation/rules-block.js +90 -0
  138. package/dist/core/foundation/rules-block.js.map +1 -0
  139. package/dist/core/foundation/traceability-block.d.ts +13 -0
  140. package/dist/core/foundation/traceability-block.d.ts.map +1 -0
  141. package/dist/core/foundation/traceability-block.js +124 -0
  142. package/dist/core/foundation/traceability-block.js.map +1 -0
  143. package/dist/core/lifecycle/done.d.ts.map +1 -1
  144. package/dist/core/lifecycle/done.js +2 -4
  145. package/dist/core/lifecycle/done.js.map +1 -1
  146. package/dist/core/lifecycle/recertify.d.ts +9 -0
  147. package/dist/core/lifecycle/recertify.d.ts.map +1 -0
  148. package/dist/core/lifecycle/recertify.js +27 -0
  149. package/dist/core/lifecycle/recertify.js.map +1 -0
  150. package/dist/core/lifecycle/reject.d.ts.map +1 -1
  151. package/dist/core/lifecycle/reject.js +3 -4
  152. package/dist/core/lifecycle/reject.js.map +1 -1
  153. package/dist/core/lifecycle/retry.d.ts.map +1 -1
  154. package/dist/core/lifecycle/retry.js +6 -20
  155. package/dist/core/lifecycle/retry.js.map +1 -1
  156. package/dist/core/lifecycle/verification-record.d.ts +42 -0
  157. package/dist/core/lifecycle/verification-record.d.ts.map +1 -0
  158. package/dist/core/lifecycle/verification-record.js +76 -0
  159. package/dist/core/lifecycle/verification-record.js.map +1 -0
  160. package/dist/core/report/approval-flags.d.ts +16 -3
  161. package/dist/core/report/approval-flags.d.ts.map +1 -1
  162. package/dist/core/report/approval-flags.js +59 -22
  163. package/dist/core/report/approval-flags.js.map +1 -1
  164. package/dist/core/report/brief-to-approval.d.ts +7 -0
  165. package/dist/core/report/brief-to-approval.d.ts.map +1 -0
  166. package/dist/core/report/brief-to-approval.js +43 -0
  167. package/dist/core/report/brief-to-approval.js.map +1 -0
  168. package/dist/core/report/planning-price-gaps.d.ts +10 -0
  169. package/dist/core/report/planning-price-gaps.d.ts.map +1 -0
  170. package/dist/core/report/planning-price-gaps.js +37 -0
  171. package/dist/core/report/planning-price-gaps.js.map +1 -0
  172. package/dist/core/report/planning-slice-lookup.d.ts.map +1 -1
  173. package/dist/core/report/planning-slice-lookup.js +3 -9
  174. package/dist/core/report/planning-slice-lookup.js.map +1 -1
  175. package/dist/core/report/recent-disclosures.d.ts +18 -0
  176. package/dist/core/report/recent-disclosures.d.ts.map +1 -0
  177. package/dist/core/report/recent-disclosures.js +105 -0
  178. package/dist/core/report/recent-disclosures.js.map +1 -0
  179. package/dist/core/report/record-disclosures.d.ts +14 -0
  180. package/dist/core/report/record-disclosures.d.ts.map +1 -0
  181. package/dist/core/report/record-disclosures.js +30 -0
  182. package/dist/core/report/record-disclosures.js.map +1 -0
  183. package/dist/core/report/record-estimates.d.ts +25 -0
  184. package/dist/core/report/record-estimates.d.ts.map +1 -0
  185. package/dist/core/report/record-estimates.js +83 -0
  186. package/dist/core/report/record-estimates.js.map +1 -0
  187. package/dist/core/report/record-rework.d.ts +19 -0
  188. package/dist/core/report/record-rework.d.ts.map +1 -0
  189. package/dist/core/report/record-rework.js +50 -0
  190. package/dist/core/report/record-rework.js.map +1 -0
  191. package/dist/core/report/record-verification.d.ts +16 -0
  192. package/dist/core/report/record-verification.d.ts.map +1 -0
  193. package/dist/core/report/record-verification.js +33 -0
  194. package/dist/core/report/record-verification.js.map +1 -0
  195. package/dist/core/report/report-dependencies.d.ts +29 -0
  196. package/dist/core/report/report-dependencies.d.ts.map +1 -0
  197. package/dist/core/report/report-dependencies.js +92 -0
  198. package/dist/core/report/report-dependencies.js.map +1 -0
  199. package/dist/core/report/report-events.d.ts +1 -0
  200. package/dist/core/report/report-events.d.ts.map +1 -1
  201. package/dist/core/report/report-events.js +8 -26
  202. package/dist/core/report/report-events.js.map +1 -1
  203. package/dist/core/report/report-mutation.d.ts +34 -0
  204. package/dist/core/report/report-mutation.d.ts.map +1 -0
  205. package/dist/core/report/report-mutation.js +191 -0
  206. package/dist/core/report/report-mutation.js.map +1 -0
  207. package/dist/core/report/report-scope.d.ts +21 -0
  208. package/dist/core/report/report-scope.d.ts.map +1 -0
  209. package/dist/core/report/report-scope.js +61 -0
  210. package/dist/core/report/report-scope.js.map +1 -0
  211. package/dist/core/report/report-traceability.d.ts +29 -0
  212. package/dist/core/report/report-traceability.d.ts.map +1 -0
  213. package/dist/core/report/report-traceability.js +94 -0
  214. package/dist/core/report/report-traceability.js.map +1 -0
  215. package/dist/core/report/report.d.ts +35 -1
  216. package/dist/core/report/report.d.ts.map +1 -1
  217. package/dist/core/report/report.js +130 -111
  218. package/dist/core/report/report.js.map +1 -1
  219. package/dist/core/report/result-sections.d.ts +30 -0
  220. package/dist/core/report/result-sections.d.ts.map +1 -0
  221. package/dist/core/report/result-sections.js +125 -0
  222. package/dist/core/report/result-sections.js.map +1 -0
  223. package/dist/core/report/scope-size.d.ts +7 -0
  224. package/dist/core/report/scope-size.d.ts.map +1 -0
  225. package/dist/core/report/scope-size.js +22 -0
  226. package/dist/core/report/scope-size.js.map +1 -0
  227. package/dist/core/run/commit-message.d.ts +24 -0
  228. package/dist/core/run/commit-message.d.ts.map +1 -0
  229. package/dist/core/run/commit-message.js +76 -0
  230. package/dist/core/run/commit-message.js.map +1 -0
  231. package/dist/core/run/dead-commit.d.ts +10 -0
  232. package/dist/core/run/dead-commit.d.ts.map +1 -0
  233. package/dist/core/run/dead-commit.js +70 -0
  234. package/dist/core/run/dead-commit.js.map +1 -0
  235. package/dist/core/run/focused-tests.d.ts +43 -0
  236. package/dist/core/run/focused-tests.d.ts.map +1 -0
  237. package/dist/core/run/focused-tests.js +116 -0
  238. package/dist/core/run/focused-tests.js.map +1 -0
  239. package/dist/core/run/manifest-approval.d.ts +7 -0
  240. package/dist/core/run/manifest-approval.d.ts.map +1 -0
  241. package/dist/core/run/manifest-approval.js +30 -0
  242. package/dist/core/run/manifest-approval.js.map +1 -0
  243. package/dist/core/run/manifest.d.ts +11 -1
  244. package/dist/core/run/manifest.d.ts.map +1 -1
  245. package/dist/core/run/manifest.js +52 -11
  246. package/dist/core/run/manifest.js.map +1 -1
  247. package/dist/core/run/mutation-report.d.ts +29 -0
  248. package/dist/core/run/mutation-report.d.ts.map +1 -0
  249. package/dist/core/run/mutation-report.js +107 -0
  250. package/dist/core/run/mutation-report.js.map +1 -0
  251. package/dist/core/run/mutation-run.d.ts +32 -0
  252. package/dist/core/run/mutation-run.d.ts.map +1 -0
  253. package/dist/core/run/mutation-run.js +80 -0
  254. package/dist/core/run/mutation-run.js.map +1 -0
  255. package/dist/core/run/verification.d.ts +12 -1
  256. package/dist/core/run/verification.d.ts.map +1 -1
  257. package/dist/core/run/verification.js +24 -2
  258. package/dist/core/run/verification.js.map +1 -1
  259. package/dist/core/spec/approve-worktree-shared.d.ts +33 -0
  260. package/dist/core/spec/approve-worktree-shared.d.ts.map +1 -0
  261. package/dist/core/spec/approve-worktree-shared.js +59 -0
  262. package/dist/core/spec/approve-worktree-shared.js.map +1 -0
  263. package/dist/core/spec/approve-worktree.d.ts +21 -0
  264. package/dist/core/spec/approve-worktree.d.ts.map +1 -0
  265. package/dist/core/spec/approve-worktree.js +153 -0
  266. package/dist/core/spec/approve-worktree.js.map +1 -0
  267. package/dist/core/spec/approve.d.ts +20 -10
  268. package/dist/core/spec/approve.d.ts.map +1 -1
  269. package/dist/core/spec/approve.js +57 -54
  270. package/dist/core/spec/approve.js.map +1 -1
  271. package/dist/core/spec/capability-impact.d.ts +43 -0
  272. package/dist/core/spec/capability-impact.d.ts.map +1 -0
  273. package/dist/core/spec/capability-impact.js +85 -0
  274. package/dist/core/spec/capability-impact.js.map +1 -0
  275. package/dist/core/spec/decisions-lint.d.ts +18 -0
  276. package/dist/core/spec/decisions-lint.d.ts.map +1 -0
  277. package/dist/core/spec/decisions-lint.js +127 -0
  278. package/dist/core/spec/decisions-lint.js.map +1 -0
  279. package/dist/core/spec/delta.d.ts +6 -0
  280. package/dist/core/spec/delta.d.ts.map +1 -1
  281. package/dist/core/spec/delta.js +73 -5
  282. package/dist/core/spec/delta.js.map +1 -1
  283. package/dist/core/spec/digest-decisions.d.ts +27 -0
  284. package/dist/core/spec/digest-decisions.d.ts.map +1 -0
  285. package/dist/core/spec/digest-decisions.js +86 -0
  286. package/dist/core/spec/digest-decisions.js.map +1 -0
  287. package/dist/core/spec/digest-format.d.ts +4 -0
  288. package/dist/core/spec/digest-format.d.ts.map +1 -0
  289. package/dist/core/spec/digest-format.js +44 -0
  290. package/dist/core/spec/digest-format.js.map +1 -0
  291. package/dist/core/spec/digest.d.ts +5 -3
  292. package/dist/core/spec/digest.d.ts.map +1 -1
  293. package/dist/core/spec/digest.js +14 -33
  294. package/dist/core/spec/digest.js.map +1 -1
  295. package/dist/core/spec/human-steps.d.ts +20 -0
  296. package/dist/core/spec/human-steps.d.ts.map +1 -0
  297. package/dist/core/spec/human-steps.js +52 -0
  298. package/dist/core/spec/human-steps.js.map +1 -0
  299. package/dist/core/spec/impact-lint.d.ts +24 -0
  300. package/dist/core/spec/impact-lint.d.ts.map +1 -0
  301. package/dist/core/spec/impact-lint.js +39 -0
  302. package/dist/core/spec/impact-lint.js.map +1 -0
  303. package/dist/core/spec/import-graph.d.ts +35 -0
  304. package/dist/core/spec/import-graph.d.ts.map +1 -0
  305. package/dist/core/spec/import-graph.js +155 -0
  306. package/dist/core/spec/import-graph.js.map +1 -0
  307. package/dist/core/spec/lint-findings.d.ts +44 -0
  308. package/dist/core/spec/lint-findings.d.ts.map +1 -0
  309. package/dist/core/spec/lint-findings.js +56 -0
  310. package/dist/core/spec/lint-findings.js.map +1 -0
  311. package/dist/core/spec/lint-output.d.ts +53 -0
  312. package/dist/core/spec/lint-output.d.ts.map +1 -0
  313. package/dist/core/spec/lint-output.js +87 -0
  314. package/dist/core/spec/lint-output.js.map +1 -0
  315. package/dist/core/spec/linter.d.ts +14 -4
  316. package/dist/core/spec/linter.d.ts.map +1 -1
  317. package/dist/core/spec/linter.js +271 -111
  318. package/dist/core/spec/linter.js.map +1 -1
  319. package/dist/core/spec/merged-spec-check.d.ts +24 -0
  320. package/dist/core/spec/merged-spec-check.d.ts.map +1 -0
  321. package/dist/core/spec/merged-spec-check.js +95 -0
  322. package/dist/core/spec/merged-spec-check.js.map +1 -0
  323. package/dist/core/spec/openspec-issues.d.ts +58 -0
  324. package/dist/core/spec/openspec-issues.d.ts.map +1 -0
  325. package/dist/core/spec/openspec-issues.js +166 -0
  326. package/dist/core/spec/openspec-issues.js.map +1 -0
  327. package/dist/core/spec/parser.d.ts +1 -0
  328. package/dist/core/spec/parser.d.ts.map +1 -1
  329. package/dist/core/spec/parser.js +16 -6
  330. package/dist/core/spec/parser.js.map +1 -1
  331. package/dist/core/spec/scenario-impact.d.ts +47 -0
  332. package/dist/core/spec/scenario-impact.d.ts.map +1 -0
  333. package/dist/core/spec/scenario-impact.js +130 -0
  334. package/dist/core/spec/scenario-impact.js.map +1 -0
  335. package/dist/core/spec/test-impact.d.ts +28 -0
  336. package/dist/core/spec/test-impact.d.ts.map +1 -0
  337. package/dist/core/spec/test-impact.js +119 -0
  338. package/dist/core/spec/test-impact.js.map +1 -0
  339. package/dist/core/spec/traceability-links.d.ts +50 -0
  340. package/dist/core/spec/traceability-links.d.ts.map +1 -0
  341. package/dist/core/spec/traceability-links.js +120 -0
  342. package/dist/core/spec/traceability-links.js.map +1 -0
  343. package/dist/core/spec/traceability-lint.d.ts +29 -0
  344. package/dist/core/spec/traceability-lint.d.ts.map +1 -0
  345. package/dist/core/spec/traceability-lint.js +143 -0
  346. package/dist/core/spec/traceability-lint.js.map +1 -0
  347. package/dist/core/status/blocked-item.d.ts +8 -0
  348. package/dist/core/status/blocked-item.d.ts.map +1 -0
  349. package/dist/core/status/blocked-item.js +45 -0
  350. package/dist/core/status/blocked-item.js.map +1 -0
  351. package/dist/core/status/change-locations.d.ts +44 -0
  352. package/dist/core/status/change-locations.d.ts.map +1 -0
  353. package/dist/core/status/change-locations.js +138 -0
  354. package/dist/core/status/change-locations.js.map +1 -0
  355. package/dist/core/status/dependency-readiness.d.ts +11 -0
  356. package/dist/core/status/dependency-readiness.d.ts.map +1 -0
  357. package/dist/core/status/dependency-readiness.js +39 -0
  358. package/dist/core/status/dependency-readiness.js.map +1 -0
  359. package/dist/core/status/inbox-projection.d.ts.map +1 -1
  360. package/dist/core/status/inbox-projection.js +23 -4
  361. package/dist/core/status/inbox-projection.js.map +1 -1
  362. package/dist/core/status/inbox-text.d.ts.map +1 -1
  363. package/dist/core/status/inbox-text.js +34 -3
  364. package/dist/core/status/inbox-text.js.map +1 -1
  365. package/dist/core/status/inbox.d.ts +10 -1
  366. package/dist/core/status/inbox.d.ts.map +1 -1
  367. package/dist/core/status/inbox.js +19 -1
  368. package/dist/core/status/inbox.js.map +1 -1
  369. package/dist/core/status/layout.d.ts +6 -0
  370. package/dist/core/status/layout.d.ts.map +1 -1
  371. package/dist/core/status/layout.js +8 -0
  372. package/dist/core/status/layout.js.map +1 -1
  373. package/dist/core/status/next-step.d.ts +17 -0
  374. package/dist/core/status/next-step.d.ts.map +1 -0
  375. package/dist/core/status/next-step.js +85 -0
  376. package/dist/core/status/next-step.js.map +1 -0
  377. package/dist/core/status/pre-spawn-words.d.ts +13 -0
  378. package/dist/core/status/pre-spawn-words.d.ts.map +1 -0
  379. package/dist/core/status/pre-spawn-words.js +26 -0
  380. package/dist/core/status/pre-spawn-words.js.map +1 -0
  381. package/dist/core/status/queue-parser.d.ts +1 -0
  382. package/dist/core/status/queue-parser.d.ts.map +1 -1
  383. package/dist/core/status/queue-parser.js +41 -2
  384. package/dist/core/status/queue-parser.js.map +1 -1
  385. package/dist/core/status/queue-planning.d.ts +1 -0
  386. package/dist/core/status/queue-planning.d.ts.map +1 -1
  387. package/dist/core/status/queue-planning.js +24 -12
  388. package/dist/core/status/queue-planning.js.map +1 -1
  389. package/dist/core/status/queue-report-detail.d.ts.map +1 -1
  390. package/dist/core/status/queue-report-detail.js +5 -3
  391. package/dist/core/status/queue-report-detail.js.map +1 -1
  392. package/dist/core/status/queue-state.d.ts +1 -1
  393. package/dist/core/status/queue-state.d.ts.map +1 -1
  394. package/dist/core/status/queue-state.js +27 -41
  395. package/dist/core/status/queue-state.js.map +1 -1
  396. package/dist/core/status/show.d.ts +25 -0
  397. package/dist/core/status/show.d.ts.map +1 -1
  398. package/dist/core/status/show.js +354 -91
  399. package/dist/core/status/show.js.map +1 -1
  400. package/dist/core/status/state.d.ts.map +1 -1
  401. package/dist/core/status/state.js +1 -23
  402. package/dist/core/status/state.js.map +1 -1
  403. package/dist/core/status/status.d.ts +18 -0
  404. package/dist/core/status/status.d.ts.map +1 -1
  405. package/dist/core/status/status.js +59 -80
  406. package/dist/core/status/status.js.map +1 -1
  407. package/dist/core/status/verification.d.ts +27 -0
  408. package/dist/core/status/verification.d.ts.map +1 -0
  409. package/dist/core/status/verification.js +111 -0
  410. package/dist/core/status/verification.js.map +1 -0
  411. package/dist/core/trace/function-ranges.d.ts +30 -0
  412. package/dist/core/trace/function-ranges.d.ts.map +1 -0
  413. package/dist/core/trace/function-ranges.js +250 -0
  414. package/dist/core/trace/function-ranges.js.map +1 -0
  415. package/dist/core/trace/mutation-pick.d.ts +55 -0
  416. package/dist/core/trace/mutation-pick.d.ts.map +1 -0
  417. package/dist/core/trace/mutation-pick.js +96 -0
  418. package/dist/core/trace/mutation-pick.js.map +1 -0
  419. package/dist/core/trace/scenario-index.d.ts +27 -0
  420. package/dist/core/trace/scenario-index.d.ts.map +1 -0
  421. package/dist/core/trace/scenario-index.js +76 -0
  422. package/dist/core/trace/scenario-index.js.map +1 -0
  423. package/dist/core/trace/scenario-lookup.d.ts +14 -0
  424. package/dist/core/trace/scenario-lookup.d.ts.map +1 -0
  425. package/dist/core/trace/scenario-lookup.js +179 -0
  426. package/dist/core/trace/scenario-lookup.js.map +1 -0
  427. package/dist/core/trace/tag-scan.d.ts +44 -0
  428. package/dist/core/trace/tag-scan.d.ts.map +1 -0
  429. package/dist/core/trace/tag-scan.js +200 -0
  430. package/dist/core/trace/tag-scan.js.map +1 -0
  431. package/dist/core/vcs/doctor-git.d.ts +13 -0
  432. package/dist/core/vcs/doctor-git.d.ts.map +1 -0
  433. package/dist/core/vcs/doctor-git.js +114 -0
  434. package/dist/core/vcs/doctor-git.js.map +1 -0
  435. package/dist/core/vcs/git-vcs-write.d.ts +47 -0
  436. package/dist/core/vcs/git-vcs-write.d.ts.map +1 -0
  437. package/dist/core/vcs/git-vcs-write.js +210 -0
  438. package/dist/core/vcs/git-vcs-write.js.map +1 -0
  439. package/dist/core/vcs/git-vcs.d.ts +40 -0
  440. package/dist/core/vcs/git-vcs.d.ts.map +1 -0
  441. package/dist/core/vcs/git-vcs.js +170 -0
  442. package/dist/core/vcs/git-vcs.js.map +1 -0
  443. package/dist/core/vcs/no-vcs.d.ts +26 -0
  444. package/dist/core/vcs/no-vcs.d.ts.map +1 -0
  445. package/dist/core/vcs/no-vcs.js +62 -0
  446. package/dist/core/vcs/no-vcs.js.map +1 -0
  447. package/dist/core/vcs/select.d.ts +11 -0
  448. package/dist/core/vcs/select.d.ts.map +1 -0
  449. package/dist/core/vcs/select.js +33 -0
  450. package/dist/core/vcs/select.js.map +1 -0
  451. package/dist/core/vcs/snapshot.d.ts +34 -0
  452. package/dist/core/vcs/snapshot.d.ts.map +1 -0
  453. package/dist/core/vcs/snapshot.js +71 -0
  454. package/dist/core/vcs/snapshot.js.map +1 -0
  455. package/dist/core/vcs/vcs.d.ts +55 -0
  456. package/dist/core/vcs/vcs.d.ts.map +1 -0
  457. package/dist/core/vcs/vcs.js +2 -0
  458. package/dist/core/vcs/vcs.js.map +1 -0
  459. package/dist/core/vcs/worktree.d.ts +10 -0
  460. package/dist/core/vcs/worktree.d.ts.map +1 -0
  461. package/dist/core/vcs/worktree.js +25 -0
  462. package/dist/core/vcs/worktree.js.map +1 -0
  463. package/dist/core/web/web-data-folders.d.ts.map +1 -1
  464. package/dist/core/web/web-data-folders.js +18 -33
  465. package/dist/core/web/web-data-folders.js.map +1 -1
  466. package/dist/core/web/web-data-lifecycle.d.ts.map +1 -1
  467. package/dist/core/web/web-data-lifecycle.js +2 -1
  468. package/dist/core/web/web-data-lifecycle.js.map +1 -1
  469. package/dist/core/web/web-events.d.ts +8 -6
  470. package/dist/core/web/web-events.d.ts.map +1 -1
  471. package/dist/core/web/web-events.js +7 -31
  472. package/dist/core/web/web-events.js.map +1 -1
  473. package/dist/core/web/web-server.d.ts.map +1 -1
  474. package/dist/core/web/web-server.js +3 -0
  475. package/dist/core/web/web-server.js.map +1 -1
  476. package/dist/core/web/web-trees.d.ts +27 -0
  477. package/dist/core/web/web-trees.d.ts.map +1 -0
  478. package/dist/core/web/web-trees.js +82 -0
  479. package/dist/core/web/web-trees.js.map +1 -0
  480. package/dist/harness/claude/claude-exec-args.d.ts +13 -0
  481. package/dist/harness/claude/claude-exec-args.d.ts.map +1 -0
  482. package/dist/harness/claude/claude-exec-args.js +61 -0
  483. package/dist/harness/claude/claude-exec-args.js.map +1 -0
  484. package/dist/harness/claude/claude-exec.d.ts +12 -0
  485. package/dist/harness/claude/claude-exec.d.ts.map +1 -0
  486. package/dist/harness/claude/claude-exec.js +79 -0
  487. package/dist/harness/claude/claude-exec.js.map +1 -0
  488. package/dist/harness/claude/claude-stream.d.ts +31 -0
  489. package/dist/harness/claude/claude-stream.d.ts.map +1 -0
  490. package/dist/harness/claude/claude-stream.js +150 -0
  491. package/dist/harness/claude/claude-stream.js.map +1 -0
  492. package/dist/harness/claude/claude-tools.d.ts +5 -0
  493. package/dist/harness/claude/claude-tools.d.ts.map +1 -0
  494. package/dist/harness/claude/claude-tools.js +30 -0
  495. package/dist/harness/claude/claude-tools.js.map +1 -0
  496. package/dist/harness/index.d.ts +1 -0
  497. package/dist/harness/index.d.ts.map +1 -1
  498. package/dist/harness/index.js +3 -0
  499. package/dist/harness/index.js.map +1 -1
  500. package/dist/harness/opencode/opencode-session.d.ts +42 -0
  501. package/dist/harness/opencode/opencode-session.d.ts.map +1 -0
  502. package/dist/harness/opencode/opencode-session.js +123 -0
  503. package/dist/harness/opencode/opencode-session.js.map +1 -0
  504. package/dist/harness/opencode/opencode.d.ts +2 -1
  505. package/dist/harness/opencode/opencode.d.ts.map +1 -1
  506. package/dist/harness/opencode/opencode.js +52 -28
  507. package/dist/harness/opencode/opencode.js.map +1 -1
  508. package/dist/harness/prompt.js +1 -1
  509. package/dist/harness/prompt.js.map +1 -1
  510. package/dist/harness/types.d.ts +112 -1
  511. package/dist/harness/types.d.ts.map +1 -1
  512. package/dist/harness/types.js.map +1 -1
  513. package/dist/index.d.ts +3 -1
  514. package/dist/index.d.ts.map +1 -1
  515. package/dist/index.js +1 -0
  516. package/dist/index.js.map +1 -1
  517. package/dist/testing/index.d.ts +3 -0
  518. package/dist/testing/index.d.ts.map +1 -0
  519. package/dist/testing/index.js +2 -0
  520. package/dist/testing/index.js.map +1 -0
  521. package/dist/testing/scenario.d.ts +29 -0
  522. package/dist/testing/scenario.d.ts.map +1 -0
  523. package/dist/testing/scenario.js +157 -0
  524. package/dist/testing/scenario.js.map +1 -0
  525. package/dist/watcher/archiver.d.ts +2 -1
  526. package/dist/watcher/archiver.d.ts.map +1 -1
  527. package/dist/watcher/archiver.js +27 -2
  528. package/dist/watcher/archiver.js.map +1 -1
  529. package/dist/watcher/auto-recertify.d.ts +27 -0
  530. package/dist/watcher/auto-recertify.d.ts.map +1 -0
  531. package/dist/watcher/auto-recertify.js +113 -0
  532. package/dist/watcher/auto-recertify.js.map +1 -0
  533. package/dist/watcher/auto-retry.d.ts +1 -1
  534. package/dist/watcher/auto-retry.d.ts.map +1 -1
  535. package/dist/watcher/auto-retry.js +3 -11
  536. package/dist/watcher/auto-retry.js.map +1 -1
  537. package/dist/watcher/baseline-key.d.ts +17 -0
  538. package/dist/watcher/baseline-key.d.ts.map +1 -0
  539. package/dist/watcher/baseline-key.js +31 -0
  540. package/dist/watcher/baseline-key.js.map +1 -0
  541. package/dist/watcher/baseline.d.ts +32 -0
  542. package/dist/watcher/baseline.d.ts.map +1 -0
  543. package/dist/watcher/baseline.js +166 -0
  544. package/dist/watcher/baseline.js.map +1 -0
  545. package/dist/watcher/blocked.d.ts +12 -0
  546. package/dist/watcher/blocked.d.ts.map +1 -0
  547. package/dist/watcher/blocked.js +24 -0
  548. package/dist/watcher/blocked.js.map +1 -0
  549. package/dist/watcher/dependencies.d.ts +28 -0
  550. package/dist/watcher/dependencies.d.ts.map +1 -0
  551. package/dist/watcher/dependencies.js +152 -0
  552. package/dist/watcher/dependencies.js.map +1 -0
  553. package/dist/watcher/done-metadata.d.ts +4 -0
  554. package/dist/watcher/done-metadata.d.ts.map +1 -0
  555. package/dist/watcher/done-metadata.js +20 -0
  556. package/dist/watcher/done-metadata.js.map +1 -0
  557. package/dist/watcher/failure-reason.d.ts +1 -1
  558. package/dist/watcher/failure-reason.d.ts.map +1 -1
  559. package/dist/watcher/focused-verify.d.ts +17 -0
  560. package/dist/watcher/focused-verify.d.ts.map +1 -0
  561. package/dist/watcher/focused-verify.js +54 -0
  562. package/dist/watcher/focused-verify.js.map +1 -0
  563. package/dist/watcher/git-guard.d.ts +24 -0
  564. package/dist/watcher/git-guard.d.ts.map +1 -0
  565. package/dist/watcher/git-guard.js +95 -0
  566. package/dist/watcher/git-guard.js.map +1 -0
  567. package/dist/watcher/instructions-drift.d.ts +21 -0
  568. package/dist/watcher/instructions-drift.d.ts.map +1 -0
  569. package/dist/watcher/instructions-drift.js +115 -0
  570. package/dist/watcher/instructions-drift.js.map +1 -0
  571. package/dist/watcher/loop.d.ts.map +1 -1
  572. package/dist/watcher/loop.js +36 -50
  573. package/dist/watcher/loop.js.map +1 -1
  574. package/dist/watcher/measures.d.ts.map +1 -1
  575. package/dist/watcher/measures.js +22 -39
  576. package/dist/watcher/measures.js.map +1 -1
  577. package/dist/watcher/mutation-check.d.ts +42 -0
  578. package/dist/watcher/mutation-check.d.ts.map +1 -0
  579. package/dist/watcher/mutation-check.js +147 -0
  580. package/dist/watcher/mutation-check.js.map +1 -0
  581. package/dist/watcher/regression.d.ts +10 -5
  582. package/dist/watcher/regression.d.ts.map +1 -1
  583. package/dist/watcher/regression.js +29 -22
  584. package/dist/watcher/regression.js.map +1 -1
  585. package/dist/watcher/runner.d.ts.map +1 -1
  586. package/dist/watcher/runner.js +12 -14
  587. package/dist/watcher/runner.js.map +1 -1
  588. package/dist/watcher/spawn.d.ts.map +1 -1
  589. package/dist/watcher/spawn.js +5 -0
  590. package/dist/watcher/spawn.js.map +1 -1
  591. package/dist/watcher/task-verify.d.ts +7 -2
  592. package/dist/watcher/task-verify.d.ts.map +1 -1
  593. package/dist/watcher/task-verify.js +33 -8
  594. package/dist/watcher/task-verify.js.map +1 -1
  595. package/dist/watcher/verify.d.ts +1 -5
  596. package/dist/watcher/verify.d.ts.map +1 -1
  597. package/dist/watcher/verify.js +2 -6
  598. package/dist/watcher/verify.js.map +1 -1
  599. package/package.json +5 -1
  600. package/templates/PLANNER.md +35 -9
  601. package/templates/openspec/config.yaml +1 -1
  602. package/templates/openspec/schemas/osq/schema.yaml +4 -2
  603. package/templates/openspec/schemas/osq/templates/proposal.md +9 -2
  604. package/templates/proposal.md +9 -2
  605. package/ui/dist/assets/{index-CZYeQ8la.js → index-D39uYbbL.js} +1 -1
  606. package/ui/dist/index.html +1 -1
@@ -0,0 +1,114 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { probeVersion } from '../foundation/config-doctor.js';
4
+ import { DEFAULT_GIT_SECONDS } from './git-vcs.js';
5
+ import { selectVcs } from './select.js';
6
+ /** Variables that redirect git and that osq's own git reads ignore. */
7
+ const GIT_ENV_KEYS = ['GIT_DIR', 'GIT_INDEX_FILE', 'GIT_WORK_TREE'];
8
+ /** Lockfiles whose presence asks for a `vcs.prepare` install command. */
9
+ const LOCKFILES = [
10
+ 'pnpm-lock.yaml',
11
+ 'package-lock.json',
12
+ 'yarn.lock',
13
+ 'bun.lock',
14
+ 'bun.lockb',
15
+ ];
16
+ /** The hooks git runs during a commit; other hooks do not affect osq's commit. */
17
+ const COMMIT_HOOKS = new Set(['pre-commit', 'prepare-commit-msg', 'commit-msg', 'post-commit']);
18
+ /** The git config values git itself treats as true. */
19
+ const TRUE_VALUES = new Set(['true', '1', 'yes', 'on']);
20
+ /** The redirecting variables set in osq's environment, in a stable order. */
21
+ function setGitEnvVars() {
22
+ return GIT_ENV_KEYS.filter((key) => (process.env[key] ?? '') !== '');
23
+ }
24
+ /** The `git-env` warning naming the variables set and who ignores them. */
25
+ function gitEnvMessage(names) {
26
+ const subject = names.length === 1 ? `${names[0]} is set` : `${names.join(' and ')} are set`;
27
+ const pronoun = names.length === 1 ? 'it' : 'them';
28
+ return `${subject}; osq's own git reads ignore ${pronoun} while verify commands and hooks do not`;
29
+ }
30
+ /** The `git` check and the selected port: git's version, or a warning why off. */
31
+ async function gitCheck(projectRoot, config, binary) {
32
+ const vcs = await selectVcs(projectRoot, config, binary === undefined ? undefined : { gitBinary: binary });
33
+ if (vcs.kind === 'git') {
34
+ const seconds = config.timeouts.gitSeconds ?? DEFAULT_GIT_SECONDS;
35
+ const version = await probeVersion(binary ?? 'git', projectRoot, seconds);
36
+ return { check: { name: 'git', ok: true, message: version }, vcs };
37
+ }
38
+ return {
39
+ check: {
40
+ name: 'git',
41
+ ok: true,
42
+ warning: true,
43
+ message: `${vcs.unavailableReason}; git checks off`,
44
+ },
45
+ vcs,
46
+ };
47
+ }
48
+ /** The lockfiles present at the project root, in a stable order. */
49
+ async function presentLockfiles(projectRoot) {
50
+ const found = [];
51
+ for (const file of LOCKFILES) {
52
+ const exists = await fs.stat(path.join(projectRoot, file)).then(() => true, () => false);
53
+ if (exists)
54
+ found.push(file);
55
+ }
56
+ return found;
57
+ }
58
+ /**
59
+ * The three warnings shown only with `vcs.enabled` and `GitVcs`: a lockfile
60
+ * with no `vcs.prepare`, the active commit hooks, and commit signing. Each
61
+ * passes with a warning and never changes doctor's exit code.
62
+ */
63
+ async function vcsWarnings(projectRoot, config, vcs) {
64
+ const warnings = [];
65
+ const prepare = config.vcs?.prepare;
66
+ if (prepare === undefined || prepare === '') {
67
+ const locks = await presentLockfiles(projectRoot);
68
+ if (locks.length > 0) {
69
+ warnings.push({
70
+ name: 'vcs-prepare',
71
+ ok: true,
72
+ warning: true,
73
+ message: `${locks.join(', ')} found without vcs.prepare; set vcs.prepare to the install command`,
74
+ });
75
+ }
76
+ }
77
+ const hooks = (await vcs.hookNames()).filter((name) => COMMIT_HOOKS.has(name));
78
+ if (hooks.length > 0) {
79
+ warnings.push({
80
+ name: 'git-hooks',
81
+ ok: true,
82
+ warning: true,
83
+ message: `active commit hooks: ${hooks.join(', ')}; check each runs unattended and leaves the tree as verified`,
84
+ });
85
+ }
86
+ const signing = await vcs.configValue('commit.gpgsign');
87
+ if (signing !== null && TRUE_VALUES.has(signing.toLowerCase())) {
88
+ warnings.push({
89
+ name: 'git-signing',
90
+ ok: true,
91
+ warning: true,
92
+ message: 'commit.gpgsign is true; check signing runs without a prompt',
93
+ });
94
+ }
95
+ return warnings;
96
+ }
97
+ /**
98
+ * The `git` doctor check, the version-control warnings, and, when a
99
+ * redirecting variable is set, the `git-env` warning. All pass with a warning
100
+ * and never change doctor's exit code.
101
+ */
102
+ export async function checkGit(projectRoot, config, options = {}) {
103
+ const { check, vcs } = await gitCheck(projectRoot, config, options.gitBinary);
104
+ const checks = [check];
105
+ if (config.vcs?.enabled === true && vcs.kind === 'git') {
106
+ checks.push(...(await vcsWarnings(projectRoot, config, vcs)));
107
+ }
108
+ const set = setGitEnvVars();
109
+ if (set.length > 0) {
110
+ checks.push({ name: 'git-env', ok: true, warning: true, message: gitEnvMessage(set) });
111
+ }
112
+ return checks;
113
+ }
114
+ //# sourceMappingURL=doctor-git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-git.js","sourceRoot":"","sources":["../../../src/core/vcs/doctor-git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,uEAAuE;AACvE,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAU,CAAC;AAE7E,yEAAyE;AACzE,MAAM,SAAS,GAAG;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,WAAW;IACX,UAAU;IACV,WAAW;CACH,CAAC;AAEX,kFAAkF;AAClF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC;AAEhG,uDAAuD;AACv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CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,GAAG,GAAG,aAAa,EAAE,CAAC;IAC5B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { GitResult } from './git-vcs.js';
2
+ import type { VcsWorktree } from './vcs.js';
3
+ /** The narrow view of `GitVcs` the write helpers run through. */
4
+ export interface GitWriteContext {
5
+ /** The repository top level, also the child process's working directory. */
6
+ readonly projectRoot: string;
7
+ /** Run a read or a non-commit write, bounded by `timeouts.gitSeconds`. */
8
+ run(args: string[], env?: NodeJS.ProcessEnv): Promise<GitResult>;
9
+ /** Run a commit, bounded by `timeouts.gitCommitSeconds`. */
10
+ runCommit(args: string[], env?: NodeJS.ProcessEnv): Promise<GitResult>;
11
+ }
12
+ /** One git config value, or null when the key is unset or git fails. */
13
+ export declare function configValue(ctx: GitWriteContext, key: string): Promise<string | null>;
14
+ /**
15
+ * The executable, non-`.sample` files in the directory `git rev-parse
16
+ * --git-path hooks` names, which follows `core.hooksPath`.
17
+ */
18
+ export declare function hookNames(ctx: GitWriteContext): Promise<string[]>;
19
+ /** Every branch whose short name starts with `prefix`, sorted by name. */
20
+ export declare function listBranches(ctx: GitWriteContext, prefix: string): Promise<string[]>;
21
+ /**
22
+ * The default branch: the branch `refs/remotes/origin/HEAD` names without its
23
+ * `origin/` prefix, read locally, else `fallback`. Never contacts the remote.
24
+ */
25
+ export declare function defaultBranch(ctx: GitWriteContext, fallback: string): Promise<string>;
26
+ /** Every worktree with its path, branch, and HEAD. */
27
+ export declare function worktreeList(ctx: GitWriteContext): Promise<VcsWorktree[]>;
28
+ /** Create `name` at `base`; git fails when the branch already exists. */
29
+ export declare function createBranch(ctx: GitWriteContext, name: string, base: string): Promise<void>;
30
+ /** Add a worktree for an existing branch. */
31
+ export declare function worktreeAdd(ctx: GitWriteContext, worktreePath: string, branch: string): Promise<void>;
32
+ /** Remove a worktree; git refuses one with changes outside ignored files. */
33
+ export declare function worktreeRemove(ctx: GitWriteContext, worktreePath: string): Promise<void>;
34
+ /**
35
+ * Stage exactly `paths` and commit only them, leaving anything else staged as
36
+ * it was; with no paths commit the index as it stands.
37
+ */
38
+ export declare function commit(ctx: GitWriteContext, paths: readonly string[], message: string, author: string): Promise<string>;
39
+ /** A binary diff against HEAD through a copy of the index, leaving it unchanged. */
40
+ export declare function patch(ctx: GitWriteContext): Promise<string>;
41
+ /**
42
+ * Restore `paths` to HEAD in the index and the tree, remove files under them
43
+ * HEAD lacks, staged or untracked, and never remove ignored ones. With no
44
+ * paths it returns before running git.
45
+ */
46
+ export declare function discard(ctx: GitWriteContext, paths: readonly string[]): Promise<void>;
47
+ //# sourceMappingURL=git-vcs-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-vcs-write.d.ts","sourceRoot":"","sources":["../../../src/core/vcs/git-vcs-write.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,0EAA0E;IAC1E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACjE,4DAA4D;IAC5D,SAAS,C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AAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED,oFAAoF;AACpF,wBAAsB,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAajE;AAuCD;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAW3F"}
@@ -0,0 +1,210 @@
1
+ import fs from 'node:fs/promises';
2
+ import os from 'node:os';
3
+ import path from 'node:path';
4
+ /** Git's combined output, stdout first, as one error message. */
5
+ function combined(result) {
6
+ return [result.stdout, result.stderr].filter((part) => part.length > 0).join('');
7
+ }
8
+ /** Git's stdout, or throw an `Error` holding its combined output. */
9
+ function ok(result) {
10
+ if (result.code !== 0)
11
+ throw new Error(combined(result));
12
+ return result.stdout;
13
+ }
14
+ /** Non-empty, trimmed lines of a line-oriented git output. */
15
+ function lines(output) {
16
+ return output
17
+ .split('\n')
18
+ .map((line) => line.trim())
19
+ .filter((line) => line.length > 0);
20
+ }
21
+ /** One git config value, or null when the key is unset or git fails. */
22
+ export async function configValue(ctx, key) {
23
+ const result = await ctx.run(['config', '--get', key]);
24
+ if (result.code !== 0)
25
+ return null;
26
+ const value = result.stdout.trim();
27
+ return value.length > 0 ? value : null;
28
+ }
29
+ /**
30
+ * The executable, non-`.sample` files in the directory `git rev-parse
31
+ * --git-path hooks` names, which follows `core.hooksPath`.
32
+ */
33
+ export async function hookNames(ctx) {
34
+ const result = await ctx.run(['rev-parse', '--git-path', 'hooks']);
35
+ if (result.code !== 0)
36
+ return [];
37
+ const dir = path.resolve(ctx.projectRoot, result.stdout.trim());
38
+ const entries = await fs.readdir(dir).catch(() => []);
39
+ const names = [];
40
+ for (const name of entries) {
41
+ if (name.endsWith('.sample'))
42
+ continue;
43
+ const stat = await fs.stat(path.join(dir, name)).catch(() => null);
44
+ if (stat?.isFile() && (stat.mode & 0o111) !== 0)
45
+ names.push(name);
46
+ }
47
+ return names.sort();
48
+ }
49
+ /** Every branch whose short name starts with `prefix`, sorted by name. */
50
+ export async function listBranches(ctx, prefix) {
51
+ const result = await ctx.run(['branch', '--list', '--format=%(refname:short)', `${prefix}*`]);
52
+ if (result.code !== 0)
53
+ return [];
54
+ return lines(result.stdout);
55
+ }
56
+ /**
57
+ * The default branch: the branch `refs/remotes/origin/HEAD` names without its
58
+ * `origin/` prefix, read locally, else `fallback`. Never contacts the remote.
59
+ */
60
+ export async function defaultBranch(ctx, fallback) {
61
+ const result = await ctx.run(['symbolic-ref', '--quiet', '--short', 'refs/remotes/origin/HEAD']);
62
+ const value = result.code === 0 ? result.stdout.trim() : '';
63
+ if (value.startsWith('origin/') && value.length > 'origin/'.length) {
64
+ return value.slice('origin/'.length);
65
+ }
66
+ return fallback;
67
+ }
68
+ function parseWorktrees(output) {
69
+ const trees = [];
70
+ let current = null;
71
+ const flush = () => {
72
+ if (current?.path !== undefined) {
73
+ trees.push({ path: current.path, branch: current.branch, head: current.head });
74
+ }
75
+ current = null;
76
+ };
77
+ for (const raw of output.split('\n')) {
78
+ const line = raw.trim();
79
+ if (line === '') {
80
+ flush();
81
+ }
82
+ else if (line.startsWith('worktree ')) {
83
+ flush();
84
+ current = { path: line.slice('worktree '.length), branch: null, head: null };
85
+ }
86
+ else if (current !== null && line.startsWith('HEAD ')) {
87
+ current.head = line.slice('HEAD '.length);
88
+ }
89
+ else if (current !== null && line.startsWith('branch ')) {
90
+ current.branch = line.slice('branch '.length).replace(/^refs\/heads\//, '');
91
+ }
92
+ }
93
+ flush();
94
+ return trees;
95
+ }
96
+ /** Every worktree with its path, branch, and HEAD. */
97
+ export async function worktreeList(ctx) {
98
+ const result = await ctx.run(['worktree', 'list', '--porcelain']);
99
+ if (result.code !== 0)
100
+ return [];
101
+ return parseWorktrees(result.stdout);
102
+ }
103
+ /** Create `name` at `base`; git fails when the branch already exists. */
104
+ export async function createBranch(ctx, name, base) {
105
+ ok(await ctx.run(['branch', name, base]));
106
+ }
107
+ /** Add a worktree for an existing branch. */
108
+ export async function worktreeAdd(ctx, worktreePath, branch) {
109
+ ok(await ctx.run(['worktree', 'add', worktreePath, branch]));
110
+ }
111
+ /** Remove a worktree; git refuses one with changes outside ignored files. */
112
+ export async function worktreeRemove(ctx, worktreePath) {
113
+ ok(await ctx.run(['worktree', 'remove', worktreePath]));
114
+ }
115
+ /** Write the commit message to a temporary file git reads, never an argument. */
116
+ async function commitMessage(ctx, author, message, paths) {
117
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'osq-commit-'));
118
+ const file = path.join(dir, 'message.txt');
119
+ try {
120
+ await fs.writeFile(file, message, 'utf8');
121
+ const args = ['commit', `--author=${author}`, '-F', file];
122
+ if (paths.length > 0)
123
+ args.push('--only', '--', ...paths);
124
+ ok(await ctx.runCommit(args));
125
+ }
126
+ finally {
127
+ await fs.rm(dir, { recursive: true, force: true });
128
+ }
129
+ }
130
+ /**
131
+ * Stage exactly `paths` and commit only them, leaving anything else staged as
132
+ * it was; with no paths commit the index as it stands.
133
+ */
134
+ export async function commit(ctx, paths, message, author) {
135
+ if (paths.length > 0)
136
+ ok(await ctx.run(['add', '--', ...paths]));
137
+ await commitMessage(ctx, author, message, paths);
138
+ return ok(await ctx.run(['rev-parse', '--verify', 'HEAD'])).trim();
139
+ }
140
+ /** A binary diff against HEAD through a copy of the index, leaving it unchanged. */
141
+ export async function patch(ctx) {
142
+ const indexPath = await ctx.run(['rev-parse', '--git-path', 'index']);
143
+ const realIndex = path.resolve(ctx.projectRoot, indexPath.stdout.trim());
144
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'osq-patch-'));
145
+ const tempIndex = path.join(dir, 'index');
146
+ try {
147
+ await fs.copyFile(realIndex, tempIndex).catch(() => undefined);
148
+ const env = { GIT_INDEX_FILE: tempIndex };
149
+ ok(await ctx.run(['add', '-A'], env));
150
+ return ok(await ctx.run(['diff', '--cached', '--binary', 'HEAD'], env));
151
+ }
152
+ finally {
153
+ await fs.rm(dir, { recursive: true, force: true });
154
+ }
155
+ }
156
+ function assertLinkedWorktree(gitDir, commonDir, root) {
157
+ const dir = path.resolve(root, gitDir.trim());
158
+ const common = path.resolve(root, commonDir.trim());
159
+ if (dir === common)
160
+ throw new Error('discard requires a linked worktree');
161
+ }
162
+ function assertOsqBranch(branch, code) {
163
+ if (code !== 0 || !branch.trim().startsWith('osq/')) {
164
+ throw new Error('discard requires HEAD on a branch starting "osq/"');
165
+ }
166
+ }
167
+ /** Assert the linked-worktree and `osq/` branch preconditions. */
168
+ async function assertDiscardable(ctx) {
169
+ const [gitDir, commonDir, branch] = await Promise.all([
170
+ ctx.run(['rev-parse', '--git-dir']),
171
+ ctx.run(['rev-parse', '--git-common-dir']),
172
+ ctx.run(['symbolic-ref', '--quiet', '--short', 'HEAD']),
173
+ ]);
174
+ assertLinkedWorktree(gitDir.stdout, commonDir.stdout, ctx.projectRoot);
175
+ assertOsqBranch(branch.stdout, branch.code);
176
+ }
177
+ /** Files HEAD tracks under `paths`. */
178
+ async function headPaths(ctx, paths) {
179
+ const result = await ctx.run(['ls-tree', '-r', '--name-only', 'HEAD', '--', ...paths]);
180
+ if (result.code !== 0)
181
+ return [];
182
+ return lines(result.stdout);
183
+ }
184
+ /** Files in the index under `paths`. */
185
+ async function indexPaths(ctx, paths) {
186
+ const result = await ctx.run(['ls-files', '-z', '--', ...paths]);
187
+ if (result.code !== 0)
188
+ return [];
189
+ return result.stdout.split('\0').filter((entry) => entry.length > 0);
190
+ }
191
+ /**
192
+ * Restore `paths` to HEAD in the index and the tree, remove files under them
193
+ * HEAD lacks, staged or untracked, and never remove ignored ones. With no
194
+ * paths it returns before running git.
195
+ */
196
+ export async function discard(ctx, paths) {
197
+ if (paths.length === 0)
198
+ return;
199
+ await assertDiscardable(ctx);
200
+ const head = await headPaths(ctx, paths);
201
+ const inHead = new Set(head);
202
+ const absent = (await indexPaths(ctx, paths)).filter((entry) => !inHead.has(entry));
203
+ if (absent.length > 0)
204
+ ok(await ctx.run(['rm', '--cached', '-q', '--', ...absent]));
205
+ if (head.length > 0) {
206
+ ok(await ctx.run(['restore', '--source=HEAD', '--staged', '--worktree', '--', ...head]));
207
+ }
208
+ ok(await ctx.run(['clean', '-fd', '--', ...paths]));
209
+ }
210
+ //# sourceMappingURL=git-vcs-write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-vcs-write.js","sourceRoot":"","sources":["../../../src/core/vcs/git-vcs-write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAc7B,iEAAiE;AACjE,SAAS,QAAQ,CAAC,MAAiB;IACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnF,CAAC;AAED,qEAAqE;AACrE,SAAS,EAAE,CAAC,MAAiB;IAC3B,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,8DAA8D;AAC9D,SAAS,KAAK,CAAC,MAAc;IAC3B,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAoB,EAAE,GAAW;IACjE,MAA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,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { OsqConfig } from '../foundation/config.js';
2
+ import type { Vcs, VcsHead, VcsStash, VcsStatusEntry, VcsWorktree } from './vcs.js';
3
+ /** Default bound in seconds for each git read when `timeouts.gitSeconds` is unset. */
4
+ export declare const DEFAULT_GIT_SECONDS = 10;
5
+ export interface GitResult {
6
+ readonly code: number;
7
+ readonly stdout: string;
8
+ readonly stderr: string;
9
+ }
10
+ /** Run `git` with an argument list, never a shell, bounded by `timeoutSeconds`. */
11
+ export declare function runGit(binary: string, args: string[], cwd: string, timeoutSeconds: number, extraEnv?: NodeJS.ProcessEnv): Promise<GitResult>;
12
+ /** The git-backed port. Selection guarantees the project root is the top level. */
13
+ export declare class GitVcs implements Vcs {
14
+ private readonly projectRoot;
15
+ private readonly config;
16
+ private readonly binary;
17
+ readonly kind: "git";
18
+ readonly unavailableReason: null;
19
+ constructor(projectRoot: string, config: OsqConfig, binary?: string);
20
+ private readonly context;
21
+ private run;
22
+ private runCommit;
23
+ root(): Promise<string | null>;
24
+ head(): Promise<VcsHead>;
25
+ indexDigest(): Promise<string>;
26
+ stashList(): Promise<VcsStash[]>;
27
+ status(): Promise<VcsStatusEntry[]>;
28
+ configValue(key: string): Promise<string | null>;
29
+ hookNames(): Promise<string[]>;
30
+ defaultBranch(): Promise<string>;
31
+ listBranches(prefix: string): Promise<string[]>;
32
+ createBranch(name: string, base: string): Promise<void>;
33
+ worktreeAdd(worktreePath: string, branch: string): Promise<void>;
34
+ worktreeRemove(worktreePath: string): Promise<void>;
35
+ worktreeList(): Promise<VcsWorktree[]>;
36
+ commit(paths: readonly string[], message: string, author: string): Promise<string>;
37
+ patch(): Promise<string>;
38
+ discard(paths: readonly string[]): Promise<void>;
39
+ }
40
+ //# sourceMappingURL=git-vcs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-vcs.d.ts","sourceRoot":"","sources":["../../../src/core/vcs/git-vcs.ts"],"names":[],"m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,CAAC;IAMzC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIhD,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI9B,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvD,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAItC,MAAM,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlF,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAIxB,OAAO,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
@@ -0,0 +1,170 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { createHash } from 'node:crypto';
3
+ import fs from 'node:fs/promises';
4
+ import { DEFAULT_BRANCH, DEFAULT_GIT_COMMIT_SECONDS } from '../foundation/config-vcs.js';
5
+ import * as writes from './git-vcs-write.js';
6
+ /** Default bound in seconds for each git read when `timeouts.gitSeconds` is unset. */
7
+ export const DEFAULT_GIT_SECONDS = 10;
8
+ /** Environment variables that would redirect osq's own git reads. */
9
+ const GIT_ENV_VARS = ['GIT_DIR', 'GIT_INDEX_FILE', 'GIT_WORK_TREE'];
10
+ /** The child environment with redirecting variables removed, then `extra` applied. */
11
+ function childGitEnv(extra) {
12
+ const env = { ...process.env };
13
+ for (const key of GIT_ENV_VARS)
14
+ delete env[key];
15
+ if (extra !== undefined)
16
+ Object.assign(env, extra);
17
+ return env;
18
+ }
19
+ /** Run `git` with an argument list, never a shell, bounded by `timeoutSeconds`. */
20
+ export function runGit(binary, args, cwd, timeoutSeconds, extraEnv) {
21
+ return new Promise((resolve) => {
22
+ execFile(binary, args, { cwd, timeout: timeoutSeconds * 1000, env: childGitEnv(extraEnv) }, (error, stdout, stderr) => {
23
+ let code = 0;
24
+ if (error)
25
+ code = typeof error.code === 'number' ? error.code : 1;
26
+ resolve({ code, stdout: String(stdout), stderr: String(stderr) });
27
+ });
28
+ });
29
+ }
30
+ function nonEmpty(text) {
31
+ const trimmed = text.trim();
32
+ return trimmed.length > 0 ? trimmed : null;
33
+ }
34
+ function parseStashBranch(subject) {
35
+ const match = /^(?:WIP on|On) (.+?): /.exec(subject);
36
+ if (match === null)
37
+ return null;
38
+ const branch = match[1] ?? '';
39
+ return branch === '(no branch)' ? null : branch;
40
+ }
41
+ function parseStashes(output) {
42
+ const stashes = [];
43
+ for (const line of output.split('\n')) {
44
+ const [sha, subject] = line.split('\0');
45
+ if (!sha)
46
+ continue;
47
+ stashes.push({ sha, branch: parseStashBranch(subject ?? '') });
48
+ }
49
+ return stashes;
50
+ }
51
+ function parseStatus(output) {
52
+ const fields = output.split('\0');
53
+ const entries = [];
54
+ let index = 0;
55
+ while (index < fields.length) {
56
+ const field = fields[index] ?? '';
57
+ index += 1;
58
+ if (field.length < 4)
59
+ continue;
60
+ const code = field.slice(0, 2);
61
+ const entry = {
62
+ path: field.slice(3),
63
+ code,
64
+ };
65
+ if (code.includes('R') || code.includes('C')) {
66
+ const from = fields[index];
67
+ index += 1;
68
+ if (from !== undefined && from !== '')
69
+ entry.from = from;
70
+ }
71
+ entries.push(entry);
72
+ }
73
+ return entries;
74
+ }
75
+ /** The git-backed port. Selection guarantees the project root is the top level. */
76
+ export class GitVcs {
77
+ projectRoot;
78
+ config;
79
+ binary;
80
+ kind = 'git';
81
+ unavailableReason = null;
82
+ constructor(projectRoot, config, binary = 'git') {
83
+ this.projectRoot = projectRoot;
84
+ this.config = config;
85
+ this.binary = binary;
86
+ this.context = {
87
+ projectRoot: this.projectRoot,
88
+ run: (args, env) => this.run(args, env),
89
+ runCommit: (args, env) => this.runCommit(args, env),
90
+ };
91
+ }
92
+ context;
93
+ run(args, env) {
94
+ const seconds = this.config.timeouts.gitSeconds ?? DEFAULT_GIT_SECONDS;
95
+ return runGit(this.binary, args, this.projectRoot, seconds, env);
96
+ }
97
+ runCommit(args, env) {
98
+ const seconds = this.config.timeouts.gitCommitSeconds ?? DEFAULT_GIT_COMMIT_SECONDS;
99
+ return runGit(this.binary, args, this.projectRoot, seconds, env);
100
+ }
101
+ async root() {
102
+ const result = await this.run(['rev-parse', '--show-toplevel']);
103
+ const top = result.stdout.trim();
104
+ if (result.code !== 0 || top === '')
105
+ return null;
106
+ return fs.realpath(top).catch(() => top);
107
+ }
108
+ async head() {
109
+ const [commit, branch] = await Promise.all([
110
+ this.run(['rev-parse', '--verify', '--quiet', 'HEAD']),
111
+ this.run(['symbolic-ref', '--quiet', '--short', 'HEAD']),
112
+ ]);
113
+ return {
114
+ sha: commit.code === 0 ? nonEmpty(commit.stdout) : null,
115
+ branch: branch.code === 0 ? nonEmpty(branch.stdout) : null,
116
+ };
117
+ }
118
+ async indexDigest() {
119
+ const result = await this.run(['ls-files', '--stage', '-z']);
120
+ if (result.code !== 0)
121
+ return '';
122
+ return createHash('sha256').update(result.stdout).digest('hex');
123
+ }
124
+ async stashList() {
125
+ const result = await this.run(['stash', 'list', '--format=%H%x00%gs']);
126
+ if (result.code !== 0)
127
+ return [];
128
+ return parseStashes(result.stdout);
129
+ }
130
+ async status() {
131
+ const result = await this.run(['status', '--porcelain=v1', '-z', '--untracked-files=all']);
132
+ if (result.code !== 0)
133
+ return [];
134
+ return parseStatus(result.stdout);
135
+ }
136
+ configValue(key) {
137
+ return writes.configValue(this.context, key);
138
+ }
139
+ hookNames() {
140
+ return writes.hookNames(this.context);
141
+ }
142
+ defaultBranch() {
143
+ return writes.defaultBranch(this.context, this.config.vcs?.defaultBranch ?? DEFAULT_BRANCH);
144
+ }
145
+ listBranches(prefix) {
146
+ return writes.listBranches(this.context, prefix);
147
+ }
148
+ createBranch(name, base) {
149
+ return writes.createBranch(this.context, name, base);
150
+ }
151
+ worktreeAdd(worktreePath, branch) {
152
+ return writes.worktreeAdd(this.context, worktreePath, branch);
153
+ }
154
+ worktreeRemove(worktreePath) {
155
+ return writes.worktreeRemove(this.context, worktreePath);
156
+ }
157
+ worktreeList() {
158
+ return writes.worktreeList(this.context);
159
+ }
160
+ commit(paths, message, author) {
161
+ return writes.commit(this.context, paths, message, author);
162
+ }
163
+ patch() {
164
+ return writes.patch(this.context);
165
+ }
166
+ discard(paths) {
167
+ return writes.discard(this.context, paths);
168
+ }
169
+ }
170
+ //# sourceMappingURL=git-vcs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-vcs.js","sourceRoot":"","sources":["../../../src/core/vcs/git-vcs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzF,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAI7C,sFAAsF;AACtF,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC,qEAAqE;AACrE,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAU,CAAC;AAQ7E,sFAAsF;AACtF,SAAS,WAAW,CAAC,KAAyB;IAC5C,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,KAAK,MAAM,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