p-dev-harness 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (808) hide show
  1. package/README.md +16 -5
  2. package/dist/github/client.d.ts +88 -1
  3. package/dist/github/client.d.ts.map +1 -1
  4. package/dist/github/client.js +98 -7
  5. package/dist/github/client.js.map +1 -1
  6. package/dist/github/rate-limit-metadata.d.ts +16 -0
  7. package/dist/github/rate-limit-metadata.d.ts.map +1 -0
  8. package/dist/github/rate-limit-metadata.js +73 -0
  9. package/dist/github/rate-limit-metadata.js.map +1 -0
  10. package/dist/p-dev/git-object-plumbing.d.ts +19 -0
  11. package/dist/p-dev/git-object-plumbing.d.ts.map +1 -0
  12. package/dist/p-dev/git-object-plumbing.js +196 -0
  13. package/dist/p-dev/git-object-plumbing.js.map +1 -0
  14. package/dist/p-dev/package-paths.d.ts +1 -0
  15. package/dist/p-dev/package-paths.d.ts.map +1 -1
  16. package/dist/p-dev/package-paths.js +3 -0
  17. package/dist/p-dev/package-paths.js.map +1 -1
  18. package/dist/p-dev/workspace-snapshot-digest.d.ts +12 -0
  19. package/dist/p-dev/workspace-snapshot-digest.d.ts.map +1 -0
  20. package/dist/p-dev/workspace-snapshot-digest.js +34 -0
  21. package/dist/p-dev/workspace-snapshot-digest.js.map +1 -0
  22. package/dist/p-dev/workspace-snapshot-generator.d.ts +15 -0
  23. package/dist/p-dev/workspace-snapshot-generator.d.ts.map +1 -0
  24. package/dist/p-dev/workspace-snapshot-generator.js +69 -0
  25. package/dist/p-dev/workspace-snapshot-generator.js.map +1 -0
  26. package/dist/p-dev/workspace-snapshot-git.d.ts +26 -0
  27. package/dist/p-dev/workspace-snapshot-git.d.ts.map +1 -0
  28. package/dist/p-dev/workspace-snapshot-git.js +151 -0
  29. package/dist/p-dev/workspace-snapshot-git.js.map +1 -0
  30. package/dist/p-dev/workspace-snapshot-manifest.d.ts +18 -0
  31. package/dist/p-dev/workspace-snapshot-manifest.d.ts.map +1 -0
  32. package/dist/p-dev/workspace-snapshot-manifest.js +292 -0
  33. package/dist/p-dev/workspace-snapshot-manifest.js.map +1 -0
  34. package/dist/p-dev/workspace-snapshot-policy.d.ts +16 -0
  35. package/dist/p-dev/workspace-snapshot-policy.d.ts.map +1 -0
  36. package/dist/p-dev/workspace-snapshot-policy.js +168 -0
  37. package/dist/p-dev/workspace-snapshot-policy.js.map +1 -0
  38. package/dist/p-dev/workspace-snapshot-types.d.ts +54 -0
  39. package/dist/p-dev/workspace-snapshot-types.d.ts.map +1 -0
  40. package/dist/p-dev/workspace-snapshot-types.js +7 -0
  41. package/dist/p-dev/workspace-snapshot-types.js.map +1 -0
  42. package/dist/p-dev/workspace-snapshot-validation.d.ts +17 -0
  43. package/dist/p-dev/workspace-snapshot-validation.d.ts.map +1 -0
  44. package/dist/p-dev/workspace-snapshot-validation.js +115 -0
  45. package/dist/p-dev/workspace-snapshot-validation.js.map +1 -0
  46. package/dist/setup/github-remote-provider.d.ts +129 -0
  47. package/dist/setup/github-remote-provider.d.ts.map +1 -1
  48. package/dist/setup/github-remote-provider.js +214 -3
  49. package/dist/setup/github-remote-provider.js.map +1 -1
  50. package/dist/setup/github-remote-setup-live.d.ts +46 -1
  51. package/dist/setup/github-remote-setup-live.d.ts.map +1 -1
  52. package/dist/setup/github-remote-setup-live.js +121 -4
  53. package/dist/setup/github-remote-setup-live.js.map +1 -1
  54. package/dist/setup/github-secret-encryption.d.ts.map +1 -1
  55. package/dist/setup/github-secret-encryption.js +3 -1
  56. package/dist/setup/github-secret-encryption.js.map +1 -1
  57. package/dist/setup/github-upload-rate-limit-gate.d.ts +17 -0
  58. package/dist/setup/github-upload-rate-limit-gate.d.ts.map +1 -0
  59. package/dist/setup/github-upload-rate-limit-gate.js +42 -0
  60. package/dist/setup/github-upload-rate-limit-gate.js.map +1 -0
  61. package/dist/setup/harness-managed-repo-marker.d.ts +28 -1
  62. package/dist/setup/harness-managed-repo-marker.d.ts.map +1 -1
  63. package/dist/setup/harness-managed-repo-marker.js +165 -2
  64. package/dist/setup/harness-managed-repo-marker.js.map +1 -1
  65. package/dist/setup/harness-provisioning-context.d.ts +14 -12
  66. package/dist/setup/harness-provisioning-context.d.ts.map +1 -1
  67. package/dist/setup/harness-provisioning-context.js +54 -42
  68. package/dist/setup/harness-provisioning-context.js.map +1 -1
  69. package/dist/setup/harness-provisioning-pending-state.d.ts +33 -22
  70. package/dist/setup/harness-provisioning-pending-state.d.ts.map +1 -1
  71. package/dist/setup/harness-provisioning-pending-state.js +49 -30
  72. package/dist/setup/harness-provisioning-pending-state.js.map +1 -1
  73. package/dist/setup/harness-repo-provisioning.d.ts +10 -5
  74. package/dist/setup/harness-repo-provisioning.d.ts.map +1 -1
  75. package/dist/setup/harness-repo-provisioning.js +403 -335
  76. package/dist/setup/harness-repo-provisioning.js.map +1 -1
  77. package/dist/setup/harness-snapshot-provisioning-helpers.d.ts +21 -0
  78. package/dist/setup/harness-snapshot-provisioning-helpers.d.ts.map +1 -0
  79. package/dist/setup/harness-snapshot-provisioning-helpers.js +55 -0
  80. package/dist/setup/harness-snapshot-provisioning-helpers.js.map +1 -0
  81. package/dist/setup/harness-snapshot-provisioning.d.ts +111 -0
  82. package/dist/setup/harness-snapshot-provisioning.d.ts.map +1 -0
  83. package/dist/setup/harness-snapshot-provisioning.js +684 -0
  84. package/dist/setup/harness-snapshot-provisioning.js.map +1 -0
  85. package/dist/setup/harness-workspace-snapshot-loader.d.ts +15 -0
  86. package/dist/setup/harness-workspace-snapshot-loader.d.ts.map +1 -0
  87. package/dist/setup/harness-workspace-snapshot-loader.js +80 -0
  88. package/dist/setup/harness-workspace-snapshot-loader.js.map +1 -0
  89. package/dist/setup/mock-git-repository-store.d.ts +43 -0
  90. package/dist/setup/mock-git-repository-store.d.ts.map +1 -0
  91. package/dist/setup/mock-git-repository-store.js +232 -0
  92. package/dist/setup/mock-git-repository-store.js.map +1 -0
  93. package/gui/.next/BUILD_ID +1 -1
  94. package/gui/.next/app-build-manifest.json +49 -49
  95. package/gui/.next/app-path-routes-manifest.json +15 -15
  96. package/gui/.next/build-manifest.json +2 -2
  97. package/gui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  98. package/gui/.next/server/app/_not-found.html +1 -1
  99. package/gui/.next/server/app/_not-found.rsc +2 -2
  100. package/gui/.next/server/app/api/setup/apply-connect-services/route.js +1 -1
  101. package/gui/.next/server/app/api/setup/apply-connect-services/route.js.nft.json +1 -1
  102. package/gui/.next/server/app/api/setup/apply-connect-services/route_client-reference-manifest.js +1 -1
  103. package/gui/.next/server/app/api/setup/apply-harness-repo-provisioning/route.js +1 -1
  104. package/gui/.next/server/app/api/setup/apply-harness-repo-provisioning/route.js.nft.json +1 -1
  105. package/gui/.next/server/app/api/setup/apply-harness-repo-provisioning/route_client-reference-manifest.js +1 -1
  106. package/gui/.next/server/app/api/setup/apply-harness-secrets/route.js +1 -1
  107. package/gui/.next/server/app/api/setup/apply-harness-secrets/route.js.nft.json +1 -1
  108. package/gui/.next/server/app/api/setup/apply-harness-secrets/route_client-reference-manifest.js +1 -1
  109. package/gui/.next/server/app/api/setup/apply-linear-setup/route.js +1 -1
  110. package/gui/.next/server/app/api/setup/apply-linear-setup/route.js.nft.json +1 -1
  111. package/gui/.next/server/app/api/setup/apply-linear-setup/route_client-reference-manifest.js +1 -1
  112. package/gui/.next/server/app/api/setup/apply-local-files/route.js +1 -1
  113. package/gui/.next/server/app/api/setup/apply-local-files/route.js.nft.json +1 -1
  114. package/gui/.next/server/app/api/setup/apply-local-files/route_client-reference-manifest.js +1 -1
  115. package/gui/.next/server/app/api/setup/apply-target-workflow/route.js +1 -1
  116. package/gui/.next/server/app/api/setup/apply-target-workflow/route.js.nft.json +1 -1
  117. package/gui/.next/server/app/api/setup/apply-target-workflow/route_client-reference-manifest.js +1 -1
  118. package/gui/.next/server/app/api/setup/apply-vercel-bridge/route.js +1 -1
  119. package/gui/.next/server/app/api/setup/apply-vercel-bridge/route.js.nft.json +1 -1
  120. package/gui/.next/server/app/api/setup/apply-vercel-bridge/route_client-reference-manifest.js +1 -1
  121. package/gui/.next/server/app/api/setup/finalize-target-workflow/route.js +1 -1
  122. package/gui/.next/server/app/api/setup/finalize-target-workflow/route.js.nft.json +1 -1
  123. package/gui/.next/server/app/api/setup/finalize-target-workflow/route_client-reference-manifest.js +1 -1
  124. package/gui/.next/server/app/api/setup/harness-provisioning-summary/route.js +1 -1
  125. package/gui/.next/server/app/api/setup/harness-provisioning-summary/route.js.nft.json +1 -1
  126. package/gui/.next/server/app/api/setup/harness-provisioning-summary/route_client-reference-manifest.js +1 -1
  127. package/gui/.next/server/app/api/setup/linear-options/route.js +1 -1
  128. package/gui/.next/server/app/api/setup/linear-options/route.js.nft.json +1 -1
  129. package/gui/.next/server/app/api/setup/linear-options/route_client-reference-manifest.js +1 -1
  130. package/gui/.next/server/app/api/setup/linear-summary/route.js +1 -1
  131. package/gui/.next/server/app/api/setup/linear-summary/route.js.nft.json +1 -1
  132. package/gui/.next/server/app/api/setup/linear-summary/route_client-reference-manifest.js +1 -1
  133. package/gui/.next/server/app/api/setup/local-readiness/route_client-reference-manifest.js +1 -1
  134. package/gui/.next/server/app/api/setup/manual-harness-secret-values/route.js +1 -1
  135. package/gui/.next/server/app/api/setup/manual-harness-secret-values/route.js.nft.json +1 -1
  136. package/gui/.next/server/app/api/setup/manual-harness-secret-values/route_client-reference-manifest.js +1 -1
  137. package/gui/.next/server/app/api/setup/preview-connect-services/route.js +1 -1
  138. package/gui/.next/server/app/api/setup/preview-connect-services/route.js.nft.json +1 -1
  139. package/gui/.next/server/app/api/setup/preview-connect-services/route_client-reference-manifest.js +1 -1
  140. package/gui/.next/server/app/api/setup/preview-harness-repo-provisioning/route.js +1 -1
  141. package/gui/.next/server/app/api/setup/preview-harness-repo-provisioning/route.js.nft.json +1 -1
  142. package/gui/.next/server/app/api/setup/preview-harness-repo-provisioning/route_client-reference-manifest.js +1 -1
  143. package/gui/.next/server/app/api/setup/preview-harness-secrets/route.js +1 -1
  144. package/gui/.next/server/app/api/setup/preview-harness-secrets/route.js.nft.json +1 -1
  145. package/gui/.next/server/app/api/setup/preview-harness-secrets/route_client-reference-manifest.js +1 -1
  146. package/gui/.next/server/app/api/setup/preview-linear-setup/route.js +1 -1
  147. package/gui/.next/server/app/api/setup/preview-linear-setup/route.js.nft.json +1 -1
  148. package/gui/.next/server/app/api/setup/preview-linear-setup/route_client-reference-manifest.js +1 -1
  149. package/gui/.next/server/app/api/setup/preview-local-files/route.js +1 -1
  150. package/gui/.next/server/app/api/setup/preview-local-files/route.js.nft.json +1 -1
  151. package/gui/.next/server/app/api/setup/preview-local-files/route_client-reference-manifest.js +1 -1
  152. package/gui/.next/server/app/api/setup/preview-target-workflow/route.js +1 -1
  153. package/gui/.next/server/app/api/setup/preview-target-workflow/route.js.nft.json +1 -1
  154. package/gui/.next/server/app/api/setup/preview-target-workflow/route_client-reference-manifest.js +1 -1
  155. package/gui/.next/server/app/api/setup/preview-vercel-bridge/route.js +1 -1
  156. package/gui/.next/server/app/api/setup/preview-vercel-bridge/route.js.nft.json +1 -1
  157. package/gui/.next/server/app/api/setup/preview-vercel-bridge/route_client-reference-manifest.js +1 -1
  158. package/gui/.next/server/app/api/setup/remote-summary/route.js +1 -1
  159. package/gui/.next/server/app/api/setup/remote-summary/route.js.nft.json +1 -1
  160. package/gui/.next/server/app/api/setup/remote-summary/route_client-reference-manifest.js +1 -1
  161. package/gui/.next/server/app/api/setup/summary/route.js +1 -1
  162. package/gui/.next/server/app/api/setup/summary/route.js.nft.json +1 -1
  163. package/gui/.next/server/app/api/setup/summary/route_client-reference-manifest.js +1 -1
  164. package/gui/.next/server/app/api/setup/vercel-bridge-options/route.js +1 -1
  165. package/gui/.next/server/app/api/setup/vercel-bridge-options/route.js.nft.json +1 -1
  166. package/gui/.next/server/app/api/setup/vercel-bridge-options/route_client-reference-manifest.js +1 -1
  167. package/gui/.next/server/app/api/setup/vercel-bridge-redeploy-status/route.js +1 -1
  168. package/gui/.next/server/app/api/setup/vercel-bridge-redeploy-status/route.js.nft.json +1 -1
  169. package/gui/.next/server/app/api/setup/vercel-bridge-redeploy-status/route_client-reference-manifest.js +1 -1
  170. package/gui/.next/server/app/api/setup/vercel-summary/route.js +1 -1
  171. package/gui/.next/server/app/api/setup/vercel-summary/route.js.nft.json +1 -1
  172. package/gui/.next/server/app/api/setup/vercel-summary/route_client-reference-manifest.js +1 -1
  173. package/gui/.next/server/app/api/setup/verify-harness-repo/route.js +1 -1
  174. package/gui/.next/server/app/api/setup/verify-harness-repo/route.js.nft.json +1 -1
  175. package/gui/.next/server/app/api/setup/verify-harness-repo/route_client-reference-manifest.js +1 -1
  176. package/gui/.next/server/app/api/setup/verify-service/route_client-reference-manifest.js +1 -1
  177. package/gui/.next/server/app/api/setup/verify-target-repo/route_client-reference-manifest.js +1 -1
  178. package/gui/.next/server/app/index.html +1 -1
  179. package/gui/.next/server/app/index.rsc +2 -2
  180. package/gui/.next/server/app/page_client-reference-manifest.js +1 -1
  181. package/gui/.next/server/app/settings/configure/page.js +2 -2
  182. package/gui/.next/server/app/settings/configure/page.js.nft.json +1 -1
  183. package/gui/.next/server/app/settings/configure/page_client-reference-manifest.js +1 -1
  184. package/gui/.next/server/app-paths-manifest.json +15 -15
  185. package/gui/.next/server/chunks/477.js +2 -2
  186. package/gui/.next/server/chunks/647.js +82 -0
  187. package/gui/.next/server/chunks/900.js +1 -1
  188. package/gui/.next/server/pages/404.html +1 -1
  189. package/gui/.next/server/pages/500.html +1 -1
  190. package/gui/.next/static/css/781f3c93b6d7425a.css +3 -0
  191. package/gui/.next/trace +4 -4
  192. package/package.json +2 -1
  193. package/workspace-snapshot/files/.agents/skills/architecture-evolution-audit/SKILL.md +282 -0
  194. package/workspace-snapshot/files/.agents/skills/code-health-audit/SKILL.md +188 -0
  195. package/workspace-snapshot/files/.agents/skills/implementation/SKILL.md +279 -0
  196. package/workspace-snapshot/files/.agents/skills/issue-intake/SKILL.md +163 -0
  197. package/workspace-snapshot/files/.agents/skills/issue-intake/examples.md +112 -0
  198. package/workspace-snapshot/files/.agents/skills/planner/SKILL.md +253 -0
  199. package/workspace-snapshot/files/.agents/skills/security-audit/SKILL.md +270 -0
  200. package/workspace-snapshot/files/.env.example +37 -0
  201. package/workspace-snapshot/files/.github/CODEOWNERS +4 -0
  202. package/workspace-snapshot/files/.github/dependabot.yml +12 -0
  203. package/workspace-snapshot/files/.github/workflows/ci.yml +32 -0
  204. package/workspace-snapshot/files/.github/workflows/codeql.yml +35 -0
  205. package/workspace-snapshot/files/.github/workflows/harness-auto-runner.yml +561 -0
  206. package/workspace-snapshot/files/.harness/config.example.json +83 -0
  207. package/workspace-snapshot/files/AGENTS.md +130 -0
  208. package/workspace-snapshot/files/ARCHITECTURE.md +385 -0
  209. package/workspace-snapshot/files/CHANGELOG.md +166 -0
  210. package/workspace-snapshot/files/LICENSE +21 -0
  211. package/workspace-snapshot/files/README.md +110 -0
  212. package/workspace-snapshot/files/ROADMAP.md +50 -0
  213. package/workspace-snapshot/files/api/linear-webhook.ts +41 -0
  214. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-connect-services/route.ts +21 -0
  215. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-harness-repo-provisioning/route.ts +35 -0
  216. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-harness-secrets/route.ts +42 -0
  217. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-linear-setup/route.ts +23 -0
  218. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-local-files/route.ts +42 -0
  219. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-target-workflow/route.ts +49 -0
  220. package/workspace-snapshot/files/apps/gui/app/api/setup/apply-vercel-bridge/route.ts +26 -0
  221. package/workspace-snapshot/files/apps/gui/app/api/setup/finalize-target-workflow/route.ts +32 -0
  222. package/workspace-snapshot/files/apps/gui/app/api/setup/harness-provisioning-summary/route.ts +17 -0
  223. package/workspace-snapshot/files/apps/gui/app/api/setup/linear-options/route.ts +17 -0
  224. package/workspace-snapshot/files/apps/gui/app/api/setup/linear-summary/route.ts +15 -0
  225. package/workspace-snapshot/files/apps/gui/app/api/setup/local-readiness/route.ts +18 -0
  226. package/workspace-snapshot/files/apps/gui/app/api/setup/manual-harness-secret-values/route.ts +33 -0
  227. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-connect-services/route.ts +17 -0
  228. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-harness-repo-provisioning/route.ts +22 -0
  229. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-harness-secrets/route.ts +19 -0
  230. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-linear-setup/route.ts +20 -0
  231. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-local-files/route.ts +17 -0
  232. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-target-workflow/route.ts +25 -0
  233. package/workspace-snapshot/files/apps/gui/app/api/setup/preview-vercel-bridge/route.ts +23 -0
  234. package/workspace-snapshot/files/apps/gui/app/api/setup/remote-summary/route.ts +15 -0
  235. package/workspace-snapshot/files/apps/gui/app/api/setup/summary/route.ts +10 -0
  236. package/workspace-snapshot/files/apps/gui/app/api/setup/vercel-bridge-options/route.ts +29 -0
  237. package/workspace-snapshot/files/apps/gui/app/api/setup/vercel-bridge-redeploy-status/route.ts +22 -0
  238. package/workspace-snapshot/files/apps/gui/app/api/setup/vercel-summary/route.ts +15 -0
  239. package/workspace-snapshot/files/apps/gui/app/api/setup/verify-harness-repo/route.ts +31 -0
  240. package/workspace-snapshot/files/apps/gui/app/api/setup/verify-service/route.ts +41 -0
  241. package/workspace-snapshot/files/apps/gui/app/api/setup/verify-target-repo/route.ts +33 -0
  242. package/workspace-snapshot/files/apps/gui/app/layout.tsx +28 -0
  243. package/workspace-snapshot/files/apps/gui/app/page.tsx +5 -0
  244. package/workspace-snapshot/files/apps/gui/app/settings/configure/page.tsx +34 -0
  245. package/workspace-snapshot/files/apps/gui/components/custom/app-shell.tsx +39 -0
  246. package/workspace-snapshot/files/apps/gui/components/custom/configure-experience.tsx +671 -0
  247. package/workspace-snapshot/files/apps/gui/components/custom/configure-page-content.tsx +45 -0
  248. package/workspace-snapshot/files/apps/gui/components/custom/configure-workflow.tsx +1284 -0
  249. package/workspace-snapshot/files/apps/gui/components/custom/connected-status.tsx +30 -0
  250. package/workspace-snapshot/files/apps/gui/components/custom/environment-config-form.tsx +400 -0
  251. package/workspace-snapshot/files/apps/gui/components/custom/first-run-stepper.tsx +199 -0
  252. package/workspace-snapshot/files/apps/gui/components/custom/github-token-help-disclosure.tsx +142 -0
  253. package/workspace-snapshot/files/apps/gui/components/custom/guided-cloud-secrets-card.tsx +993 -0
  254. package/workspace-snapshot/files/apps/gui/components/custom/guided-linear-workspace-card.tsx +526 -0
  255. package/workspace-snapshot/files/apps/gui/components/custom/guided-local-readiness-card.tsx +132 -0
  256. package/workspace-snapshot/files/apps/gui/components/custom/guided-step-transition.tsx +60 -0
  257. package/workspace-snapshot/files/apps/gui/components/custom/guided-target-workflow-card.tsx +396 -0
  258. package/workspace-snapshot/files/apps/gui/components/custom/guided-vercel-bridge-card.tsx +861 -0
  259. package/workspace-snapshot/files/apps/gui/components/custom/local-write-confirmation.tsx +91 -0
  260. package/workspace-snapshot/files/apps/gui/components/custom/local-write-preview.tsx +52 -0
  261. package/workspace-snapshot/files/apps/gui/components/custom/preview-panel.tsx +19 -0
  262. package/workspace-snapshot/files/apps/gui/components/custom/primary-setup-task-card.tsx +65 -0
  263. package/workspace-snapshot/files/apps/gui/components/custom/readiness-banner.tsx +91 -0
  264. package/workspace-snapshot/files/apps/gui/components/custom/remote-action-confirmation.tsx +155 -0
  265. package/workspace-snapshot/files/apps/gui/components/custom/remote-action-preview.tsx +84 -0
  266. package/workspace-snapshot/files/apps/gui/components/custom/remote-secret-form.tsx +123 -0
  267. package/workspace-snapshot/files/apps/gui/components/custom/remote-setup-section.tsx +354 -0
  268. package/workspace-snapshot/files/apps/gui/components/custom/review-cloud-secrets-disclosure.tsx +59 -0
  269. package/workspace-snapshot/files/apps/gui/components/custom/review-generated-files-disclosure.tsx +67 -0
  270. package/workspace-snapshot/files/apps/gui/components/custom/section-card.tsx +33 -0
  271. package/workspace-snapshot/files/apps/gui/components/custom/service-icons.tsx +30 -0
  272. package/workspace-snapshot/files/apps/gui/components/custom/setup-apply-result.tsx +52 -0
  273. package/workspace-snapshot/files/apps/gui/components/custom/setup-checklist.tsx +206 -0
  274. package/workspace-snapshot/files/apps/gui/components/custom/setup-dashboard.tsx +124 -0
  275. package/workspace-snapshot/files/apps/gui/components/custom/setup-readonly-sections.tsx +210 -0
  276. package/workspace-snapshot/files/apps/gui/components/custom/status-badge.tsx +22 -0
  277. package/workspace-snapshot/files/apps/gui/components/custom/target-repo-config-form.tsx +647 -0
  278. package/workspace-snapshot/files/apps/gui/components/custom/target-workflow-pr-card.tsx +283 -0
  279. package/workspace-snapshot/files/apps/gui/components/custom/theme-provider.tsx +11 -0
  280. package/workspace-snapshot/files/apps/gui/components/custom/theme-toggle.tsx +44 -0
  281. package/workspace-snapshot/files/apps/gui/components/custom/workflow-install-pending-panel.tsx +116 -0
  282. package/workspace-snapshot/files/apps/gui/components/ui/badge.tsx +40 -0
  283. package/workspace-snapshot/files/apps/gui/components/ui/button.tsx +52 -0
  284. package/workspace-snapshot/files/apps/gui/components/ui/card.tsx +64 -0
  285. package/workspace-snapshot/files/apps/gui/components/ui/checkbox.tsx +21 -0
  286. package/workspace-snapshot/files/apps/gui/components/ui/input.tsx +22 -0
  287. package/workspace-snapshot/files/apps/gui/components/ui/label.tsx +20 -0
  288. package/workspace-snapshot/files/apps/gui/components/ui/separator.tsx +23 -0
  289. package/workspace-snapshot/files/apps/gui/components/ui/skeleton.tsx +13 -0
  290. package/workspace-snapshot/files/apps/gui/components/ui/textarea.tsx +22 -0
  291. package/workspace-snapshot/files/apps/gui/components.json +21 -0
  292. package/workspace-snapshot/files/apps/gui/lib/constants/breakpoints.ts +13 -0
  293. package/workspace-snapshot/files/apps/gui/lib/constants/form.ts +8 -0
  294. package/workspace-snapshot/files/apps/gui/lib/constants/index.ts +4 -0
  295. package/workspace-snapshot/files/apps/gui/lib/constants/layout.ts +9 -0
  296. package/workspace-snapshot/files/apps/gui/lib/constants/spacing.ts +8 -0
  297. package/workspace-snapshot/files/apps/gui/lib/guided-setup.ts +216 -0
  298. package/workspace-snapshot/files/apps/gui/lib/setup-json-response.ts +19 -0
  299. package/workspace-snapshot/files/apps/gui/lib/setup-server.ts +836 -0
  300. package/workspace-snapshot/files/apps/gui/lib/step6-remote-state.ts +43 -0
  301. package/workspace-snapshot/files/apps/gui/lib/utils.ts +6 -0
  302. package/workspace-snapshot/files/apps/gui/lib/vercel-bridge-polling-ui.ts +16 -0
  303. package/workspace-snapshot/files/apps/gui/lib/verification-state.ts +170 -0
  304. package/workspace-snapshot/files/apps/gui/next-env.d.ts +6 -0
  305. package/workspace-snapshot/files/apps/gui/next.config.ts +34 -0
  306. package/workspace-snapshot/files/apps/gui/postcss.config.mjs +8 -0
  307. package/workspace-snapshot/files/apps/gui/public/setup/github-token/github-pat-generate-classic.png +0 -0
  308. package/workspace-snapshot/files/apps/gui/public/setup/github-token/github-pat-generate-new-token.png +0 -0
  309. package/workspace-snapshot/files/apps/gui/public/setup/github-token/github-pat-verify-email.png +0 -0
  310. package/workspace-snapshot/files/apps/gui/styles/globals.css +86 -0
  311. package/workspace-snapshot/files/apps/gui/tsconfig.json +24 -0
  312. package/workspace-snapshot/files/apps/gui/tweetsodium.d.ts +14 -0
  313. package/workspace-snapshot/files/docs/architecture/linear-automation-state-machine.md +267 -0
  314. package/workspace-snapshot/files/docs/decisions/0001-cursor-first-v0.1.md +59 -0
  315. package/workspace-snapshot/files/docs/decisions/0003-automation-state-machine-and-auto-model-policy.md +65 -0
  316. package/workspace-snapshot/files/docs/decisions/0004-agent-provider-boundary.md +109 -0
  317. package/workspace-snapshot/files/docs/design/product-development-harness-gui.md +1024 -0
  318. package/workspace-snapshot/files/docs/getting-started.md +123 -0
  319. package/workspace-snapshot/files/docs/gui-local.md +151 -0
  320. package/workspace-snapshot/files/docs/gui-remote-setup.md +106 -0
  321. package/workspace-snapshot/files/docs/integration-repair.md +82 -0
  322. package/workspace-snapshot/files/docs/issue-intake.md +124 -0
  323. package/workspace-snapshot/files/docs/linear-watcher-setup.md +184 -0
  324. package/workspace-snapshot/files/docs/milestones/m1-runner-foundation.md +51 -0
  325. package/workspace-snapshot/files/docs/milestones/m2-planning-phase.md +129 -0
  326. package/workspace-snapshot/files/docs/milestones/m3-implementation-phase.md +158 -0
  327. package/workspace-snapshot/files/docs/milestones/m4-handoff-phase.md +122 -0
  328. package/workspace-snapshot/files/docs/milestones/m5-revision-phase.md +101 -0
  329. package/workspace-snapshot/files/docs/milestones/m6-merge-phase.md +143 -0
  330. package/workspace-snapshot/files/docs/milestones/m7-issue-intake.md +72 -0
  331. package/workspace-snapshot/files/docs/milestones/m8-linear-watcher.md +80 -0
  332. package/workspace-snapshot/files/docs/npm-packaging-spike.md +52 -0
  333. package/workspace-snapshot/files/docs/operator-config.md +187 -0
  334. package/workspace-snapshot/files/docs/p-dev.md +213 -0
  335. package/workspace-snapshot/files/docs/production-sync-automation.md +176 -0
  336. package/workspace-snapshot/files/docs/provider-portability.md +131 -0
  337. package/workspace-snapshot/files/docs/releases/release-process.md +272 -0
  338. package/workspace-snapshot/files/docs/releases/v0.2.0.md +193 -0
  339. package/workspace-snapshot/files/docs/releases/v0.3.0.md +188 -0
  340. package/workspace-snapshot/files/docs/releases/v0.3.1.md +102 -0
  341. package/workspace-snapshot/files/docs/research/001-manual-run-retrospective.md +64 -0
  342. package/workspace-snapshot/files/docs/research/002-linear-cursor-integration-smoke-test.md +64 -0
  343. package/workspace-snapshot/files/docs/research/003-cursor-automation-planning-router-spike.md +104 -0
  344. package/workspace-snapshot/files/docs/research/README.md +26 -0
  345. package/workspace-snapshot/files/docs/security.md +190 -0
  346. package/workspace-snapshot/files/docs/skills/README.md +7 -0
  347. package/workspace-snapshot/files/docs/skills/skill-architecture.md +197 -0
  348. package/workspace-snapshot/files/docs/target-repo-branch-setup.md +80 -0
  349. package/workspace-snapshot/files/evals/README.md +31 -0
  350. package/workspace-snapshot/files/examples/README.md +32 -0
  351. package/workspace-snapshot/files/examples/runs/001-target-app-github-link/README.md +49 -0
  352. package/workspace-snapshot/files/examples/runs/001-target-app-github-link/eval-scorecard.md +63 -0
  353. package/workspace-snapshot/files/examples/runs/001-target-app-github-link/implementation-plan.md +79 -0
  354. package/workspace-snapshot/files/examples/runs/001-target-app-github-link/linear-issue.md +74 -0
  355. package/workspace-snapshot/files/examples/runs/001-target-app-github-link/pr-readiness-report.md +92 -0
  356. package/workspace-snapshot/files/examples/runs/m5.5-live-sandbox-smoke/README.md +73 -0
  357. package/workspace-snapshot/files/gpt/issue-intake/custom-gpt-instructions.md +112 -0
  358. package/workspace-snapshot/files/gpt/issue-intake/knowledge.md +278 -0
  359. package/workspace-snapshot/files/gpt/issue-intake/setup-guide.md +115 -0
  360. package/workspace-snapshot/files/gpt/issue-intake/smoke-test.md +119 -0
  361. package/workspace-snapshot/files/harness.config.json +92 -0
  362. package/workspace-snapshot/files/harness.config.schema.json +352 -0
  363. package/workspace-snapshot/files/package-lock.json +3716 -0
  364. package/workspace-snapshot/files/package.json +60 -0
  365. package/workspace-snapshot/files/packages/p-dev/LICENSE +21 -0
  366. package/workspace-snapshot/files/packages/p-dev/README.md +64 -0
  367. package/workspace-snapshot/files/packages/p-dev/gui.next.config.mjs +13 -0
  368. package/workspace-snapshot/files/packages/p-dev/package.json +63 -0
  369. package/workspace-snapshot/files/prompts/issue-intake-chatgpt.md +264 -0
  370. package/workspace-snapshot/files/scripts/generate-config-schema.ts +16 -0
  371. package/workspace-snapshot/files/scripts/prepare-p-dev-package.ts +155 -0
  372. package/workspace-snapshot/files/skills/README.md +7 -0
  373. package/workspace-snapshot/files/skills/issue-intake/README.md +5 -0
  374. package/workspace-snapshot/files/src/agents/cursor-provider.ts +109 -0
  375. package/workspace-snapshot/files/src/agents/index.ts +68 -0
  376. package/workspace-snapshot/files/src/agents/provider.ts +7 -0
  377. package/workspace-snapshot/files/src/agents/types.ts +85 -0
  378. package/workspace-snapshot/files/src/artifacts/events.ts +31 -0
  379. package/workspace-snapshot/files/src/artifacts/manifest-fields.ts +9 -0
  380. package/workspace-snapshot/files/src/artifacts/manifest.ts +20 -0
  381. package/workspace-snapshot/files/src/artifacts/paths.ts +145 -0
  382. package/workspace-snapshot/files/src/artifacts/redact.ts +50 -0
  383. package/workspace-snapshot/files/src/artifacts/run-id.ts +4 -0
  384. package/workspace-snapshot/files/src/artifacts/snapshot.ts +13 -0
  385. package/workspace-snapshot/files/src/artifacts/summary.ts +116 -0
  386. package/workspace-snapshot/files/src/cli/commands/diagnose-vercel-bridge.ts +25 -0
  387. package/workspace-snapshot/files/src/cli/commands/doctor.ts +205 -0
  388. package/workspace-snapshot/files/src/cli/commands/inspect.ts +46 -0
  389. package/workspace-snapshot/files/src/cli/commands/operator-init.ts +39 -0
  390. package/workspace-snapshot/files/src/cli/commands/redact-output.ts +19 -0
  391. package/workspace-snapshot/files/src/cli/commands/resolve-route.ts +81 -0
  392. package/workspace-snapshot/files/src/cli/commands/run.ts +53 -0
  393. package/workspace-snapshot/files/src/cli/commands/sync-production.ts +207 -0
  394. package/workspace-snapshot/files/src/cli/commands/validate-issue.ts +72 -0
  395. package/workspace-snapshot/files/src/cli/exit-codes.ts +4 -0
  396. package/workspace-snapshot/files/src/cli/finalize-exit.ts +9 -0
  397. package/workspace-snapshot/files/src/cli/program.ts +200 -0
  398. package/workspace-snapshot/files/src/config/defaults.ts +33 -0
  399. package/workspace-snapshot/files/src/config/load-config.ts +80 -0
  400. package/workspace-snapshot/files/src/config/load-dotenv.ts +11 -0
  401. package/workspace-snapshot/files/src/config/resolve-config.ts +127 -0
  402. package/workspace-snapshot/files/src/config/schema.ts +129 -0
  403. package/workspace-snapshot/files/src/config/status-names.ts +63 -0
  404. package/workspace-snapshot/files/src/config/types.ts +1 -0
  405. package/workspace-snapshot/files/src/cursor/agent-factory.ts +126 -0
  406. package/workspace-snapshot/files/src/cursor/errors.ts +18 -0
  407. package/workspace-snapshot/files/src/cursor/git-result.ts +87 -0
  408. package/workspace-snapshot/files/src/cursor/model.ts +47 -0
  409. package/workspace-snapshot/files/src/cursor/revision-git-result.ts +80 -0
  410. package/workspace-snapshot/files/src/cursor/run-cleanup.ts +30 -0
  411. package/workspace-snapshot/files/src/cursor/run-observer.ts +367 -0
  412. package/workspace-snapshot/files/src/cursor/urls.ts +19 -0
  413. package/workspace-snapshot/files/src/fixture/frontmatter.ts +56 -0
  414. package/workspace-snapshot/files/src/github/actions-url.ts +13 -0
  415. package/workspace-snapshot/files/src/github/base-branch.ts +120 -0
  416. package/workspace-snapshot/files/src/github/check-policy.ts +108 -0
  417. package/workspace-snapshot/files/src/github/client.ts +796 -0
  418. package/workspace-snapshot/files/src/github/commit-reachability.ts +184 -0
  419. package/workspace-snapshot/files/src/github/links.ts +23 -0
  420. package/workspace-snapshot/files/src/github/merge-result.ts +31 -0
  421. package/workspace-snapshot/files/src/github/pr-discovery.ts +55 -0
  422. package/workspace-snapshot/files/src/github/pr-inspector.ts +297 -0
  423. package/workspace-snapshot/files/src/github/pr-url.ts +23 -0
  424. package/workspace-snapshot/files/src/github/rate-limit-metadata.ts +105 -0
  425. package/workspace-snapshot/files/src/gui/configure-health.ts +160 -0
  426. package/workspace-snapshot/files/src/gui/dev-server-process.ts +213 -0
  427. package/workspace-snapshot/files/src/gui/port.ts +78 -0
  428. package/workspace-snapshot/files/src/gui/repo-root.ts +61 -0
  429. package/workspace-snapshot/files/src/gui/start-configure-stable.ts +139 -0
  430. package/workspace-snapshot/files/src/gui/start-gui.ts +126 -0
  431. package/workspace-snapshot/files/src/index.ts +10 -0
  432. package/workspace-snapshot/files/src/linear/client.ts +49 -0
  433. package/workspace-snapshot/files/src/linear/comment-card.ts +74 -0
  434. package/workspace-snapshot/files/src/linear/comments.ts +891 -0
  435. package/workspace-snapshot/files/src/linear/handoff-comment.ts +19 -0
  436. package/workspace-snapshot/files/src/linear/issue-query.ts +70 -0
  437. package/workspace-snapshot/files/src/linear/markers.ts +238 -0
  438. package/workspace-snapshot/files/src/linear/merge-source-comment.ts +46 -0
  439. package/workspace-snapshot/files/src/linear/parser.ts +101 -0
  440. package/workspace-snapshot/files/src/linear/phase-labels.ts +58 -0
  441. package/workspace-snapshot/files/src/linear/planning-comment.ts +19 -0
  442. package/workspace-snapshot/files/src/linear/pm-feedback-comment.ts +41 -0
  443. package/workspace-snapshot/files/src/linear/revision-comment.ts +19 -0
  444. package/workspace-snapshot/files/src/linear/states.ts +20 -0
  445. package/workspace-snapshot/files/src/linear/writer.ts +216 -0
  446. package/workspace-snapshot/files/src/p-dev/browser.ts +26 -0
  447. package/workspace-snapshot/files/src/p-dev/cli.ts +93 -0
  448. package/workspace-snapshot/files/src/p-dev/git-object-plumbing.ts +271 -0
  449. package/workspace-snapshot/files/src/p-dev/launch.ts +173 -0
  450. package/workspace-snapshot/files/src/p-dev/main.ts +10 -0
  451. package/workspace-snapshot/files/src/p-dev/next-bin.ts +8 -0
  452. package/workspace-snapshot/files/src/p-dev/node-version.ts +46 -0
  453. package/workspace-snapshot/files/src/p-dev/package-paths.ts +47 -0
  454. package/workspace-snapshot/files/src/p-dev/package-version.ts +63 -0
  455. package/workspace-snapshot/files/src/p-dev/runtime-mode.ts +28 -0
  456. package/workspace-snapshot/files/src/p-dev/shutdown.ts +66 -0
  457. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-digest.ts +50 -0
  458. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-generator.ts +112 -0
  459. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-git.ts +221 -0
  460. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-manifest.ts +336 -0
  461. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-policy.ts +198 -0
  462. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-types.ts +59 -0
  463. package/workspace-snapshot/files/src/p-dev/workspace-snapshot-validation.ts +137 -0
  464. package/workspace-snapshot/files/src/p-dev/workspace.ts +114 -0
  465. package/workspace-snapshot/files/src/preview/production-from-merge.ts +143 -0
  466. package/workspace-snapshot/files/src/preview/urls.ts +28 -0
  467. package/workspace-snapshot/files/src/preview/vercel-from-pr.ts +123 -0
  468. package/workspace-snapshot/files/src/prompts/branch-name.ts +22 -0
  469. package/workspace-snapshot/files/src/prompts/builder.ts +88 -0
  470. package/workspace-snapshot/files/src/prompts/implementation.md +77 -0
  471. package/workspace-snapshot/files/src/prompts/integration-repair-builder.ts +65 -0
  472. package/workspace-snapshot/files/src/prompts/integration-repair.md +111 -0
  473. package/workspace-snapshot/files/src/prompts/planning.md +64 -0
  474. package/workspace-snapshot/files/src/prompts/revision-builder.ts +61 -0
  475. package/workspace-snapshot/files/src/prompts/revision.md +71 -0
  476. package/workspace-snapshot/files/src/resolver/allowed-repos.ts +18 -0
  477. package/workspace-snapshot/files/src/resolver/errors.ts +14 -0
  478. package/workspace-snapshot/files/src/resolver/normalize-repo.ts +32 -0
  479. package/workspace-snapshot/files/src/resolver/target-repo.ts +118 -0
  480. package/workspace-snapshot/files/src/runner/building-recovery.ts +26 -0
  481. package/workspace-snapshot/files/src/runner/dry-run.ts +137 -0
  482. package/workspace-snapshot/files/src/runner/errors.ts +70 -0
  483. package/workspace-snapshot/files/src/runner/execution-environment.ts +179 -0
  484. package/workspace-snapshot/files/src/runner/fixture.ts +25 -0
  485. package/workspace-snapshot/files/src/runner/idempotency.ts +507 -0
  486. package/workspace-snapshot/files/src/runner/orchestrator.ts +182 -0
  487. package/workspace-snapshot/files/src/runner/phase-args.ts +49 -0
  488. package/workspace-snapshot/files/src/runner/phase-infer.ts +67 -0
  489. package/workspace-snapshot/files/src/runner/phases/handoff.ts +615 -0
  490. package/workspace-snapshot/files/src/runner/phases/implementation.ts +617 -0
  491. package/workspace-snapshot/files/src/runner/phases/integration-repair.ts +613 -0
  492. package/workspace-snapshot/files/src/runner/phases/merge.ts +1202 -0
  493. package/workspace-snapshot/files/src/runner/phases/planning.ts +456 -0
  494. package/workspace-snapshot/files/src/runner/phases/production-sync.ts +308 -0
  495. package/workspace-snapshot/files/src/runner/phases/revision.ts +795 -0
  496. package/workspace-snapshot/files/src/runner/preflight.ts +218 -0
  497. package/workspace-snapshot/files/src/runner/resolve-route.ts +154 -0
  498. package/workspace-snapshot/files/src/setup/config-builder.ts +117 -0
  499. package/workspace-snapshot/files/src/setup/config-local-editor.ts +260 -0
  500. package/workspace-snapshot/files/src/setup/config-writer.ts +173 -0
  501. package/workspace-snapshot/files/src/setup/control-plane-readiness-server.ts +16 -0
  502. package/workspace-snapshot/files/src/setup/control-plane-readiness.ts +291 -0
  503. package/workspace-snapshot/files/src/setup/control-plane-setup-state.ts +60 -0
  504. package/workspace-snapshot/files/src/setup/control-plane-types.ts +121 -0
  505. package/workspace-snapshot/files/src/setup/doctor-summary.ts +96 -0
  506. package/workspace-snapshot/files/src/setup/env-merge.ts +266 -0
  507. package/workspace-snapshot/files/src/setup/env-writer.ts +179 -0
  508. package/workspace-snapshot/files/src/setup/first-run-readiness.ts +1431 -0
  509. package/workspace-snapshot/files/src/setup/generated-instructions.ts +96 -0
  510. package/workspace-snapshot/files/src/setup/github-dispatch-token.ts +88 -0
  511. package/workspace-snapshot/files/src/setup/github-remote-provider.ts +983 -0
  512. package/workspace-snapshot/files/src/setup/github-remote-setup-live.ts +775 -0
  513. package/workspace-snapshot/files/src/setup/github-repo-slug.ts +31 -0
  514. package/workspace-snapshot/files/src/setup/github-secret-encryption.ts +16 -0
  515. package/workspace-snapshot/files/src/setup/github-upload-rate-limit-gate.ts +58 -0
  516. package/workspace-snapshot/files/src/setup/github-workflow-permissions.ts +174 -0
  517. package/workspace-snapshot/files/src/setup/gui-view-model.ts +566 -0
  518. package/workspace-snapshot/files/src/setup/guided-config-form.ts +52 -0
  519. package/workspace-snapshot/files/src/setup/harness-dispatch-repo.ts +158 -0
  520. package/workspace-snapshot/files/src/setup/harness-managed-repo-marker.ts +653 -0
  521. package/workspace-snapshot/files/src/setup/harness-provisioning-context.ts +331 -0
  522. package/workspace-snapshot/files/src/setup/harness-provisioning-pending-state.ts +282 -0
  523. package/workspace-snapshot/files/src/setup/harness-repo-provisioning.ts +1656 -0
  524. package/workspace-snapshot/files/src/setup/harness-secret-fingerprint.ts +51 -0
  525. package/workspace-snapshot/files/src/setup/harness-secret-setup.ts +439 -0
  526. package/workspace-snapshot/files/src/setup/harness-snapshot-provisioning-helpers.ts +92 -0
  527. package/workspace-snapshot/files/src/setup/harness-snapshot-provisioning.ts +1007 -0
  528. package/workspace-snapshot/files/src/setup/harness-template-identity.ts +151 -0
  529. package/workspace-snapshot/files/src/setup/harness-workspace-snapshot-loader.ts +105 -0
  530. package/workspace-snapshot/files/src/setup/linear-setup-apply.ts +270 -0
  531. package/workspace-snapshot/files/src/setup/linear-setup-client.ts +276 -0
  532. package/workspace-snapshot/files/src/setup/linear-setup-plan.ts +353 -0
  533. package/workspace-snapshot/files/src/setup/linear-setup-summary.ts +33 -0
  534. package/workspace-snapshot/files/src/setup/linear-status-contract.ts +110 -0
  535. package/workspace-snapshot/files/src/setup/linear-webhook-env-local.ts +104 -0
  536. package/workspace-snapshot/files/src/setup/linear-webhook-secret.ts +441 -0
  537. package/workspace-snapshot/files/src/setup/local-apply-actions.ts +524 -0
  538. package/workspace-snapshot/files/src/setup/local-readiness-checks.ts +334 -0
  539. package/workspace-snapshot/files/src/setup/mock-git-repository-store.ts +291 -0
  540. package/workspace-snapshot/files/src/setup/mock-target-workflow-finalization.ts +445 -0
  541. package/workspace-snapshot/files/src/setup/model-settings.ts +73 -0
  542. package/workspace-snapshot/files/src/setup/permission-model.ts +79 -0
  543. package/workspace-snapshot/files/src/setup/redact-secrets.ts +85 -0
  544. package/workspace-snapshot/files/src/setup/remote-actions.ts +214 -0
  545. package/workspace-snapshot/files/src/setup/remote-apply-actions.ts +390 -0
  546. package/workspace-snapshot/files/src/setup/remote-preview-fingerprint.ts +37 -0
  547. package/workspace-snapshot/files/src/setup/remote-setup-summary.ts +143 -0
  548. package/workspace-snapshot/files/src/setup/secret-change-token.ts +14 -0
  549. package/workspace-snapshot/files/src/setup/service-verification.ts +549 -0
  550. package/workspace-snapshot/files/src/setup/setup-actions.ts +183 -0
  551. package/workspace-snapshot/files/src/setup/setup-github-auth.ts +15 -0
  552. package/workspace-snapshot/files/src/setup/setup-state.ts +74 -0
  553. package/workspace-snapshot/files/src/setup/stale-smoke-repo.ts +141 -0
  554. package/workspace-snapshot/files/src/setup/sync-downstream-summaries.ts +105 -0
  555. package/workspace-snapshot/files/src/setup/target-workflow-finalization-lock.ts +95 -0
  556. package/workspace-snapshot/files/src/setup/target-workflow-finalization-types.ts +55 -0
  557. package/workspace-snapshot/files/src/setup/target-workflow-finalization.ts +897 -0
  558. package/workspace-snapshot/files/src/setup/target-workflow-setup.ts +247 -0
  559. package/workspace-snapshot/files/src/setup/test-only-provisioning-provider.ts +51 -0
  560. package/workspace-snapshot/files/src/setup/test-only-remote-setup-provider.ts +51 -0
  561. package/workspace-snapshot/files/src/setup/tweetsodium.d.ts +14 -0
  562. package/workspace-snapshot/files/src/setup/vercel-bridge-diagnostics.ts +510 -0
  563. package/workspace-snapshot/files/src/setup/vercel-bridge-options.ts +160 -0
  564. package/workspace-snapshot/files/src/setup/vercel-bridge-readiness.ts +150 -0
  565. package/workspace-snapshot/files/src/setup/vercel-bridge-redeploy-poll.ts +744 -0
  566. package/workspace-snapshot/files/src/setup/vercel-bridge-redeploy-state.ts +46 -0
  567. package/workspace-snapshot/files/src/setup/vercel-bridge-structured-log.ts +86 -0
  568. package/workspace-snapshot/files/src/setup/vercel-bridge-verification.ts +63 -0
  569. package/workspace-snapshot/files/src/setup/vercel-production-redeploy.ts +298 -0
  570. package/workspace-snapshot/files/src/setup/vercel-setup-apply.ts +1058 -0
  571. package/workspace-snapshot/files/src/setup/vercel-setup-client.ts +695 -0
  572. package/workspace-snapshot/files/src/setup/vercel-setup-plan.ts +672 -0
  573. package/workspace-snapshot/files/src/setup/vercel-setup-summary.ts +42 -0
  574. package/workspace-snapshot/files/src/setup/vercel-webhook-probe.ts +161 -0
  575. package/workspace-snapshot/files/src/setup/workflow-install-merge-errors.ts +166 -0
  576. package/workspace-snapshot/files/src/types/parsed-issue.ts +8 -0
  577. package/workspace-snapshot/files/src/types/run.ts +157 -0
  578. package/workspace-snapshot/files/src/validate/constants.ts +2 -0
  579. package/workspace-snapshot/files/src/validate/issue.ts +286 -0
  580. package/workspace-snapshot/files/src/validate/report.ts +68 -0
  581. package/workspace-snapshot/files/src/validate/types.ts +29 -0
  582. package/workspace-snapshot/files/src/webhook/dispatch-github.ts +44 -0
  583. package/workspace-snapshot/files/src/webhook/dispatch-statuses.ts +26 -0
  584. package/workspace-snapshot/files/src/webhook/extract-issue-key.ts +49 -0
  585. package/workspace-snapshot/files/src/webhook/filter.ts +41 -0
  586. package/workspace-snapshot/files/src/webhook/handle-linear-webhook.ts +201 -0
  587. package/workspace-snapshot/files/src/webhook/parse-linear-issue-event.ts +105 -0
  588. package/workspace-snapshot/files/src/webhook/redact-log.ts +26 -0
  589. package/workspace-snapshot/files/src/webhook/types.ts +75 -0
  590. package/workspace-snapshot/files/src/webhook/verify.ts +68 -0
  591. package/workspace-snapshot/files/src/webhook/workflow-command.ts +10 -0
  592. package/workspace-snapshot/files/src/workflow/dispatch-metadata.ts +59 -0
  593. package/workspace-snapshot/files/src/workflow/manifest-summary.ts +57 -0
  594. package/workspace-snapshot/files/src/workflow/production-sync-dispatch.ts +65 -0
  595. package/workspace-snapshot/files/src/workflow/summarize-manifest.ts +20 -0
  596. package/workspace-snapshot/files/src/workflow/validate.ts +43 -0
  597. package/workspace-snapshot/files/src/workflow/write-dispatch-metadata.ts +8 -0
  598. package/workspace-snapshot/files/templates/eval-scorecard.md +54 -0
  599. package/workspace-snapshot/files/templates/implementation-plan.md +59 -0
  600. package/workspace-snapshot/files/templates/linear-issue.md +53 -0
  601. package/workspace-snapshot/files/templates/pr-readiness-report.md +57 -0
  602. package/workspace-snapshot/files/tests/agents/cursor-provider.test.ts +238 -0
  603. package/workspace-snapshot/files/tests/artifacts/manifest.test.ts +54 -0
  604. package/workspace-snapshot/files/tests/artifacts/redact.test.ts +47 -0
  605. package/workspace-snapshot/files/tests/cli/doctor.test.ts +120 -0
  606. package/workspace-snapshot/files/tests/cli/finalize-exit.test.ts +28 -0
  607. package/workspace-snapshot/files/tests/cli/operator-init.test.ts +146 -0
  608. package/workspace-snapshot/files/tests/cli/sync-production-dispatch.test.ts +103 -0
  609. package/workspace-snapshot/files/tests/cli/validate-issue.test.ts +99 -0
  610. package/workspace-snapshot/files/tests/config/load-dotenv.test.ts +64 -0
  611. package/workspace-snapshot/files/tests/config/resolve-config.test.ts +273 -0
  612. package/workspace-snapshot/files/tests/config/schema.test.ts +107 -0
  613. package/workspace-snapshot/files/tests/cursor/agent-factory.test.ts +217 -0
  614. package/workspace-snapshot/files/tests/cursor/git-result.test.ts +77 -0
  615. package/workspace-snapshot/files/tests/cursor/model.test.ts +108 -0
  616. package/workspace-snapshot/files/tests/cursor/revision-git-result.test.ts +68 -0
  617. package/workspace-snapshot/files/tests/cursor/run-cleanup.test.ts +52 -0
  618. package/workspace-snapshot/files/tests/cursor/run-observer.test.ts +280 -0
  619. package/workspace-snapshot/files/tests/cursor/urls.test.ts +27 -0
  620. package/workspace-snapshot/files/tests/fixtures/config/minimal.json +16 -0
  621. package/workspace-snapshot/files/tests/fixtures/github/pr-4-vercel-comment.json +10 -0
  622. package/workspace-snapshot/files/tests/fixtures/issues/broad-for-direct-impl.md +28 -0
  623. package/workspace-snapshot/files/tests/fixtures/issues/context-target-repo.md +21 -0
  624. package/workspace-snapshot/files/tests/fixtures/issues/explicit-target-repo.md +21 -0
  625. package/workspace-snapshot/files/tests/fixtures/issues/gpt-broad-example.md +35 -0
  626. package/workspace-snapshot/files/tests/fixtures/issues/gpt-narrow-example.md +30 -0
  627. package/workspace-snapshot/files/tests/fixtures/issues/invalid-missing-task.md +16 -0
  628. package/workspace-snapshot/files/tests/fixtures/issues/invalid-no-ac-bullets.md +20 -0
  629. package/workspace-snapshot/files/tests/fixtures/issues/missing-acceptance-criteria.md +17 -0
  630. package/workspace-snapshot/files/tests/fixtures/issues/unknown-repo.md +20 -0
  631. package/workspace-snapshot/files/tests/fixtures/issues/valid-minimal.md +20 -0
  632. package/workspace-snapshot/files/tests/fixtures/issues/valid-project-only.md +17 -0
  633. package/workspace-snapshot/files/tests/fixtures/issues/valid-target-app.md +31 -0
  634. package/workspace-snapshot/files/tests/fixtures/linear/implementation-comment-wes-13.md +16 -0
  635. package/workspace-snapshot/files/tests/fixtures/linear/pm-feedback-wes-13.md +3 -0
  636. package/workspace-snapshot/files/tests/fixtures/webhook/issue-building-to-pr-open.json +27 -0
  637. package/workspace-snapshot/files/tests/fixtures/webhook/issue-pm-review.json +27 -0
  638. package/workspace-snapshot/files/tests/fixtures/webhook/issue-ready-for-planning.json +27 -0
  639. package/workspace-snapshot/files/tests/fixtures/webhook/issue-title-only-update.json +25 -0
  640. package/workspace-snapshot/files/tests/fixtures/workflows/harness-auto-runner-with-production-sync.yml +561 -0
  641. package/workspace-snapshot/files/tests/fixtures/workflows/trigger-harness-production-sync.yml +31 -0
  642. package/workspace-snapshot/files/tests/github/actions-url.test.ts +45 -0
  643. package/workspace-snapshot/files/tests/github/base-branch.test.ts +156 -0
  644. package/workspace-snapshot/files/tests/github/check-policy.test.ts +59 -0
  645. package/workspace-snapshot/files/tests/github/client.test.ts +226 -0
  646. package/workspace-snapshot/files/tests/github/commit-reachability.test.ts +148 -0
  647. package/workspace-snapshot/files/tests/github/merge-result.test.ts +26 -0
  648. package/workspace-snapshot/files/tests/github/pr-discovery.test.ts +55 -0
  649. package/workspace-snapshot/files/tests/github/pr-inspector.test.ts +393 -0
  650. package/workspace-snapshot/files/tests/github/pr-url.test.ts +30 -0
  651. package/workspace-snapshot/files/tests/github/rate-limit-metadata.test.ts +92 -0
  652. package/workspace-snapshot/files/tests/gui/configure-fix-loop.test.ts +460 -0
  653. package/workspace-snapshot/files/tests/gui/configure-health.test.ts +67 -0
  654. package/workspace-snapshot/files/tests/gui/design-system.test.ts +86 -0
  655. package/workspace-snapshot/files/tests/gui/dev-server-process.test.ts +22 -0
  656. package/workspace-snapshot/files/tests/gui/guided-setup.test.ts +186 -0
  657. package/workspace-snapshot/files/tests/gui/m6-configure-boundaries.test.ts +884 -0
  658. package/workspace-snapshot/files/tests/gui/packaged-harness-cloud-secrets-routes.test.ts +287 -0
  659. package/workspace-snapshot/files/tests/gui/packaged-harness-provisioning-routes.test.ts +212 -0
  660. package/workspace-snapshot/files/tests/gui/packaged-harness-target-workflow-routes.test.ts +227 -0
  661. package/workspace-snapshot/files/tests/gui/port.test.ts +74 -0
  662. package/workspace-snapshot/files/tests/gui/repo-root.test.ts +60 -0
  663. package/workspace-snapshot/files/tests/gui/setup-api.test.ts +181 -0
  664. package/workspace-snapshot/files/tests/gui/setup-json-response.test.ts +34 -0
  665. package/workspace-snapshot/files/tests/gui/step6-remote-state.test.ts +75 -0
  666. package/workspace-snapshot/files/tests/gui/sync-downstream-summaries.test.ts +198 -0
  667. package/workspace-snapshot/files/tests/gui/vercel-bridge-polling-ui.test.ts +25 -0
  668. package/workspace-snapshot/files/tests/gui/verification-state.test.ts +172 -0
  669. package/workspace-snapshot/files/tests/linear/comment-assertions.ts +24 -0
  670. package/workspace-snapshot/files/tests/linear/comment-card.test.ts +73 -0
  671. package/workspace-snapshot/files/tests/linear/comments.test.ts +185 -0
  672. package/workspace-snapshot/files/tests/linear/handoff-comment.test.ts +34 -0
  673. package/workspace-snapshot/files/tests/linear/markers.test.ts +97 -0
  674. package/workspace-snapshot/files/tests/linear/merge-comment.test.ts +61 -0
  675. package/workspace-snapshot/files/tests/linear/merge-source-comment.test.ts +49 -0
  676. package/workspace-snapshot/files/tests/linear/parser.test.ts +83 -0
  677. package/workspace-snapshot/files/tests/linear/planning-comment.test.ts +29 -0
  678. package/workspace-snapshot/files/tests/linear/pm-feedback-comment.test.ts +63 -0
  679. package/workspace-snapshot/files/tests/p-dev/browser.test.ts +38 -0
  680. package/workspace-snapshot/files/tests/p-dev/cli.test.ts +39 -0
  681. package/workspace-snapshot/files/tests/p-dev/git-object-plumbing.test.ts +139 -0
  682. package/workspace-snapshot/files/tests/p-dev/launch.test.ts +110 -0
  683. package/workspace-snapshot/files/tests/p-dev/next-bin.test.ts +16 -0
  684. package/workspace-snapshot/files/tests/p-dev/node-version.test.ts +20 -0
  685. package/workspace-snapshot/files/tests/p-dev/package-manifest.test.ts +47 -0
  686. package/workspace-snapshot/files/tests/p-dev/package-packed-artifact.test.ts +130 -0
  687. package/workspace-snapshot/files/tests/p-dev/package-paths.test.ts +43 -0
  688. package/workspace-snapshot/files/tests/p-dev/package-version.test.ts +55 -0
  689. package/workspace-snapshot/files/tests/p-dev/packaged-workspace-setup.test.ts +87 -0
  690. package/workspace-snapshot/files/tests/p-dev/runtime-mode.test.ts +18 -0
  691. package/workspace-snapshot/files/tests/p-dev/workspace-snapshot-digest.test.ts +61 -0
  692. package/workspace-snapshot/files/tests/p-dev/workspace-snapshot-generator.test.ts +76 -0
  693. package/workspace-snapshot/files/tests/p-dev/workspace-snapshot-policy.test.ts +35 -0
  694. package/workspace-snapshot/files/tests/p-dev/workspace-snapshot-validation.test.ts +158 -0
  695. package/workspace-snapshot/files/tests/p-dev/workspace.test.ts +80 -0
  696. package/workspace-snapshot/files/tests/preview/production-from-merge.test.ts +39 -0
  697. package/workspace-snapshot/files/tests/preview/vercel-from-pr.test.ts +120 -0
  698. package/workspace-snapshot/files/tests/prompts/builder.test.ts +58 -0
  699. package/workspace-snapshot/files/tests/prompts/implementation-builder.test.ts +76 -0
  700. package/workspace-snapshot/files/tests/prompts/issue-intake-chatgpt.test.ts +105 -0
  701. package/workspace-snapshot/files/tests/resolver/allowed-repos.test.ts +44 -0
  702. package/workspace-snapshot/files/tests/resolver/normalize-repo.test.ts +44 -0
  703. package/workspace-snapshot/files/tests/resolver/target-repo.test.ts +91 -0
  704. package/workspace-snapshot/files/tests/runner/building-recovery.test.ts +30 -0
  705. package/workspace-snapshot/files/tests/runner/dry-run.test.ts +128 -0
  706. package/workspace-snapshot/files/tests/runner/execution-environment.test.ts +114 -0
  707. package/workspace-snapshot/files/tests/runner/handoff.test.ts +312 -0
  708. package/workspace-snapshot/files/tests/runner/idempotency-handoff.test.ts +170 -0
  709. package/workspace-snapshot/files/tests/runner/idempotency-implementation.test.ts +143 -0
  710. package/workspace-snapshot/files/tests/runner/idempotency-merge.test.ts +118 -0
  711. package/workspace-snapshot/files/tests/runner/idempotency-revision.test.ts +111 -0
  712. package/workspace-snapshot/files/tests/runner/idempotency.test.ts +83 -0
  713. package/workspace-snapshot/files/tests/runner/implementation.test.ts +196 -0
  714. package/workspace-snapshot/files/tests/runner/integration-repair.test.ts +263 -0
  715. package/workspace-snapshot/files/tests/runner/merge.test.ts +760 -0
  716. package/workspace-snapshot/files/tests/runner/orchestrator.test.ts +301 -0
  717. package/workspace-snapshot/files/tests/runner/phase-args.test.ts +38 -0
  718. package/workspace-snapshot/files/tests/runner/planning.test.ts +160 -0
  719. package/workspace-snapshot/files/tests/runner/resolve-route.test.ts +249 -0
  720. package/workspace-snapshot/files/tests/runner/revision.test.ts +326 -0
  721. package/workspace-snapshot/files/tests/setup/config-builder.test.ts +136 -0
  722. package/workspace-snapshot/files/tests/setup/config-local-editor.test.ts +164 -0
  723. package/workspace-snapshot/files/tests/setup/connect-services-credential-availability.test.ts +151 -0
  724. package/workspace-snapshot/files/tests/setup/connect-services-env.test.ts +84 -0
  725. package/workspace-snapshot/files/tests/setup/control-plane-readiness.test.ts +59 -0
  726. package/workspace-snapshot/files/tests/setup/doctor-summary.test.ts +48 -0
  727. package/workspace-snapshot/files/tests/setup/env-merge.test.ts +177 -0
  728. package/workspace-snapshot/files/tests/setup/env-writer.test.ts +97 -0
  729. package/workspace-snapshot/files/tests/setup/first-run-readiness.test.ts +1099 -0
  730. package/workspace-snapshot/files/tests/setup/generated-instructions.test.ts +48 -0
  731. package/workspace-snapshot/files/tests/setup/github-dispatch-token.test.ts +111 -0
  732. package/workspace-snapshot/files/tests/setup/github-remote-provider.test.ts +66 -0
  733. package/workspace-snapshot/files/tests/setup/github-remote-setup-live.test.ts +59 -0
  734. package/workspace-snapshot/files/tests/setup/github-workflow-permissions.test.ts +71 -0
  735. package/workspace-snapshot/files/tests/setup/gui-remote-storage.test.ts +43 -0
  736. package/workspace-snapshot/files/tests/setup/gui-view-model.test.ts +251 -0
  737. package/workspace-snapshot/files/tests/setup/guided-config-form.test.ts +54 -0
  738. package/workspace-snapshot/files/tests/setup/harness-dispatch-repo.test.ts +105 -0
  739. package/workspace-snapshot/files/tests/setup/harness-managed-repo-marker.test.ts +141 -0
  740. package/workspace-snapshot/files/tests/setup/harness-provisioning-context.test.ts +89 -0
  741. package/workspace-snapshot/files/tests/setup/harness-provisioning-pending-state.test.ts +88 -0
  742. package/workspace-snapshot/files/tests/setup/harness-repo-provisioning.test.ts +897 -0
  743. package/workspace-snapshot/files/tests/setup/harness-secret-setup.test.ts +255 -0
  744. package/workspace-snapshot/files/tests/setup/harness-snapshot-default-branch.test.ts +73 -0
  745. package/workspace-snapshot/files/tests/setup/harness-snapshot-description-finalization.test.ts +136 -0
  746. package/workspace-snapshot/files/tests/setup/harness-snapshot-marker-tree.test.ts +61 -0
  747. package/workspace-snapshot/files/tests/setup/harness-snapshot-reconciliation.test.ts +132 -0
  748. package/workspace-snapshot/files/tests/setup/harness-snapshot-structured-errors.test.ts +137 -0
  749. package/workspace-snapshot/files/tests/setup/harness-snapshot-upload-rate-limit.test.ts +105 -0
  750. package/workspace-snapshot/files/tests/setup/linear-setup-apply.test.ts +131 -0
  751. package/workspace-snapshot/files/tests/setup/linear-setup-plan.test.ts +106 -0
  752. package/workspace-snapshot/files/tests/setup/linear-webhook-env-local.test.ts +95 -0
  753. package/workspace-snapshot/files/tests/setup/linear-webhook-secret.test.ts +256 -0
  754. package/workspace-snapshot/files/tests/setup/live-provisioning-error-preservation.test.ts +98 -0
  755. package/workspace-snapshot/files/tests/setup/local-apply-actions.test.ts +352 -0
  756. package/workspace-snapshot/files/tests/setup/local-readiness-checks.test.ts +175 -0
  757. package/workspace-snapshot/files/tests/setup/model-settings.test.ts +52 -0
  758. package/workspace-snapshot/files/tests/setup/packaged-provisioning-permissions.test.ts +41 -0
  759. package/workspace-snapshot/files/tests/setup/permission-model.test.ts +38 -0
  760. package/workspace-snapshot/files/tests/setup/redact-secrets.test.ts +78 -0
  761. package/workspace-snapshot/files/tests/setup/remote-actions.test.ts +45 -0
  762. package/workspace-snapshot/files/tests/setup/remote-apply-actions.test.ts +302 -0
  763. package/workspace-snapshot/files/tests/setup/remote-preview-fingerprint.test.ts +121 -0
  764. package/workspace-snapshot/files/tests/setup/service-verification.test.ts +312 -0
  765. package/workspace-snapshot/files/tests/setup/setup-actions.test.ts +96 -0
  766. package/workspace-snapshot/files/tests/setup/setup-form-defaults.test.ts +35 -0
  767. package/workspace-snapshot/files/tests/setup/setup-server-remote.test.ts +90 -0
  768. package/workspace-snapshot/files/tests/setup/stale-smoke-repo.test.ts +84 -0
  769. package/workspace-snapshot/files/tests/setup/step6-automatic-apply-outcome.test.ts +303 -0
  770. package/workspace-snapshot/files/tests/setup/target-workflow-finalization-lock.test.ts +51 -0
  771. package/workspace-snapshot/files/tests/setup/target-workflow-finalization-step-github.test.ts +435 -0
  772. package/workspace-snapshot/files/tests/setup/target-workflow-finalization.test.ts +222 -0
  773. package/workspace-snapshot/files/tests/setup/target-workflow-setup.test.ts +62 -0
  774. package/workspace-snapshot/files/tests/setup/test-workspace-snapshot-fixture.ts +100 -0
  775. package/workspace-snapshot/files/tests/setup/vercel-bridge-diagnostics.test.ts +429 -0
  776. package/workspace-snapshot/files/tests/setup/vercel-bridge-options.test.ts +135 -0
  777. package/workspace-snapshot/files/tests/setup/vercel-bridge-preview-fingerprint.test.ts +52 -0
  778. package/workspace-snapshot/files/tests/setup/vercel-bridge-redeploy-poll.test.ts +582 -0
  779. package/workspace-snapshot/files/tests/setup/vercel-bridge-structured-log.test.ts +45 -0
  780. package/workspace-snapshot/files/tests/setup/vercel-bridge-verification.test.ts +39 -0
  781. package/workspace-snapshot/files/tests/setup/vercel-endpoint-reachability.test.ts +60 -0
  782. package/workspace-snapshot/files/tests/setup/vercel-production-redeploy.test.ts +184 -0
  783. package/workspace-snapshot/files/tests/setup/vercel-setup-apply.test.ts +1282 -0
  784. package/workspace-snapshot/files/tests/setup/vercel-setup-client.test.ts +395 -0
  785. package/workspace-snapshot/files/tests/setup/vercel-setup-plan.test.ts +261 -0
  786. package/workspace-snapshot/files/tests/setup/vercel-webhook-probe.test.ts +78 -0
  787. package/workspace-snapshot/files/tests/setup/workflow-install-merge-errors.test.ts +38 -0
  788. package/workspace-snapshot/files/tests/validate-issue/report.test.ts +56 -0
  789. package/workspace-snapshot/files/tests/validate-issue/validate-issue.test.ts +202 -0
  790. package/workspace-snapshot/files/tests/webhook/dispatch-github.test.ts +193 -0
  791. package/workspace-snapshot/files/tests/webhook/extract-issue-key.test.ts +65 -0
  792. package/workspace-snapshot/files/tests/webhook/filter.test.ts +132 -0
  793. package/workspace-snapshot/files/tests/webhook/harness-auto-runner-workflow.test.ts +169 -0
  794. package/workspace-snapshot/files/tests/webhook/parse-linear-issue-event.test.ts +89 -0
  795. package/workspace-snapshot/files/tests/webhook/verify.test.ts +125 -0
  796. package/workspace-snapshot/files/tests/workflow/dispatch-metadata.test.ts +38 -0
  797. package/workspace-snapshot/files/tests/workflow/manifest-summary.test.ts +58 -0
  798. package/workspace-snapshot/files/tests/workflow/production-sync-dispatch.test.ts +101 -0
  799. package/workspace-snapshot/files/tests/workflow/validate.test.ts +70 -0
  800. package/workspace-snapshot/files/tests/workflow/workflow-shell-safety.test.ts +92 -0
  801. package/workspace-snapshot/files/tsconfig.json +22 -0
  802. package/workspace-snapshot/files/vercel.json +10 -0
  803. package/workspace-snapshot/files/vitest.config.ts +15 -0
  804. package/workspace-snapshot/manifest.json +4911 -0
  805. package/gui/.next/server/chunks/120.js +0 -81
  806. package/gui/.next/static/css/cc2acc71c03f3b4b.css +0 -3
  807. /package/gui/.next/static/{7x8X_k4tESvkyqRnNCC9E → ZGJuemeaiW4yT7CTlmjdG}/_buildManifest.js +0 -0
  808. /package/gui/.next/static/{7x8X_k4tESvkyqRnNCC9E → ZGJuemeaiW4yT7CTlmjdG}/_ssgManifest.js +0 -0
@@ -0,0 +1,1284 @@
1
+ "use client";
2
+
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
+ import { useReducedMotion } from "framer-motion";
5
+ import type { LocalConfigFormInput } from "@harness/setup/config-local-editor";
6
+ import { prepareGuidedConfigFormInput } from "@harness/setup/guided-config-form";
7
+ import type {
8
+ LocalSetupFormPayload,
9
+ LocalSetupPreviewResult,
10
+ } from "@harness/setup/local-apply-actions";
11
+ import type { SetupGuiViewModel } from "@/lib/setup-server";
12
+ import { FORM, SPACING } from "@/lib/constants";
13
+ import { GUIDED_SETUP_STEP_COUNT } from "@/lib/guided-setup";
14
+ import { Button } from "@/components/ui/button";
15
+ import { Separator } from "@/components/ui/separator";
16
+ import { SectionCard } from "@/components/custom/section-card";
17
+ import {
18
+ EnvironmentConfigForm,
19
+ INITIAL_SERVICE_VERIFICATION,
20
+ type EnvironmentFormValues,
21
+ type EnvironmentFormPresence,
22
+ type ServiceKey,
23
+ type ServiceVerificationMap,
24
+ } from "@/components/custom/environment-config-form";
25
+ import {
26
+ GITHUB_REPO_URL_PATTERN,
27
+ TargetRepoConfigForm,
28
+ type RepoVerificationUi,
29
+ } from "@/components/custom/target-repo-config-form";
30
+ import { LocalWritePreview } from "@/components/custom/local-write-preview";
31
+ import { LocalWriteConfirmation } from "@/components/custom/local-write-confirmation";
32
+ import { ReviewGeneratedFilesDisclosure } from "@/components/custom/review-generated-files-disclosure";
33
+ import { SetupApplyResult } from "@/components/custom/setup-apply-result";
34
+ import { GuidedStepTransition } from "@/components/custom/guided-step-transition";
35
+ import {
36
+ createGuidedRepoRowId,
37
+ guidedRowsFromConfig,
38
+ guidedRowsToConfigRepos,
39
+ isRepoVerifiedForActiveToken,
40
+ isServiceVerifiedForValue,
41
+ resolveActiveGitHubToken,
42
+ valueFingerprint,
43
+ type GuidedRepoRow,
44
+ } from "@/lib/verification-state";
45
+ import type { GuidedLocalSetupStep } from "@/lib/guided-setup";
46
+
47
+ export type GuidedLocalStep = GuidedLocalSetupStep;
48
+
49
+ interface ConfigureWorkflowProps {
50
+ mode?: "guided" | "advanced";
51
+ guidedStep?: GuidedLocalStep;
52
+ onGuidedStepChange?: (step: GuidedLocalStep) => void;
53
+ initialEnv: {
54
+ harnessConfigPath: string;
55
+ githubDispatchRepository: string;
56
+ savedHarnessDispatchRepository?: string;
57
+ suggestedHarnessDispatchRepo?: string;
58
+ secretPresence: EnvironmentFormPresence;
59
+ };
60
+ initialConfig: LocalConfigFormInput;
61
+ highlightStaleDispatch?: boolean;
62
+ highlightStaleTarget?: boolean;
63
+ onSummaryUpdated?: (summary: SetupGuiViewModel) => void;
64
+ onUiStateChange?: (state: { localPreviewStale: boolean }) => void;
65
+ onGuidedLocalApplySuccess?: () => void;
66
+ onConnectServicesComplete?: () => void;
67
+ localSetupFilesExist?: boolean;
68
+ }
69
+
70
+ const SERVICE_API_MAP: Record<ServiceKey, "linear" | "cursor" | "github" | "vercel"> = {
71
+ LINEAR_API_KEY: "linear",
72
+ CURSOR_API_KEY: "cursor",
73
+ GITHUB_TOKEN: "github",
74
+ VERCEL_TOKEN: "vercel",
75
+ };
76
+
77
+ const SERVICE_VALUE_KEY: Record<
78
+ ServiceKey,
79
+ keyof Pick<
80
+ EnvironmentFormValues,
81
+ "linearApiKey" | "cursorApiKey" | "githubToken" | "vercelToken"
82
+ >
83
+ > = {
84
+ LINEAR_API_KEY: "linearApiKey",
85
+ CURSOR_API_KEY: "cursorApiKey",
86
+ GITHUB_TOKEN: "githubToken",
87
+ VERCEL_TOKEN: "vercelToken",
88
+ };
89
+
90
+ export function ConfigureWorkflow({
91
+ mode = "advanced",
92
+ guidedStep: guidedStepProp,
93
+ onGuidedStepChange,
94
+ initialEnv,
95
+ initialConfig,
96
+ highlightStaleDispatch = false,
97
+ highlightStaleTarget = false,
98
+ onSummaryUpdated,
99
+ onUiStateChange,
100
+ onGuidedLocalApplySuccess,
101
+ onConnectServicesComplete,
102
+ localSetupFilesExist = false,
103
+ }: ConfigureWorkflowProps) {
104
+ const prefersReducedMotion = useReducedMotion();
105
+ const guidedTopRef = useRef<HTMLDivElement | null>(null);
106
+ const guidedRepoRowCounter = useRef(1);
107
+
108
+ const [internalGuidedStep, setInternalGuidedStep] =
109
+ useState<GuidedLocalStep>("connect-services");
110
+ const guidedStep = guidedStepProp ?? internalGuidedStep;
111
+ const [envValues, setEnvValues] = useState<EnvironmentFormValues>({
112
+ harnessConfigPath: initialEnv.harnessConfigPath,
113
+ githubDispatchRepository:
114
+ initialEnv.githubDispatchRepository ||
115
+ initialEnv.suggestedHarnessDispatchRepo ||
116
+ "",
117
+ linearApiKey: "",
118
+ cursorApiKey: "",
119
+ githubToken: "",
120
+ vercelToken: "",
121
+ });
122
+ const [configValues, setConfigValues] =
123
+ useState<LocalConfigFormInput>(initialConfig);
124
+ const [guidedRepoRows, setGuidedRepoRows] = useState<GuidedRepoRow[]>(() =>
125
+ guidedRowsFromConfig(initialConfig, guidedRepoRowCounter.current),
126
+ );
127
+ const [presence, setPresence] = useState<EnvironmentFormPresence>(
128
+ initialEnv.secretPresence,
129
+ );
130
+ const [serviceVerification, setServiceVerification] =
131
+ useState<ServiceVerificationMap>(INITIAL_SERVICE_VERIFICATION);
132
+ const [verifyingServiceKey, setVerifyingServiceKey] =
133
+ useState<ServiceKey | null>(null);
134
+ const [repoVerification, setRepoVerification] = useState<
135
+ Record<string, RepoVerificationUi>
136
+ >({});
137
+ const [verifyingRepoRowId, setVerifyingRepoRowId] = useState<string | null>(
138
+ null,
139
+ );
140
+ const [harnessRepoVerification, setHarnessRepoVerification] = useState<{
141
+ state: "unchecked" | "checking" | "connected" | "failed";
142
+ verifiedRepo?: string;
143
+ verifiedGithubTokenFingerprint?: string;
144
+ message?: string;
145
+ limitation?: string;
146
+ }>({ state: "unchecked" });
147
+ const [autoProvisionedHarnessRepo, setAutoProvisionedHarnessRepo] = useState<
148
+ string | null
149
+ >(null);
150
+ const [serverValidatedHarnessRepo, setServerValidatedHarnessRepo] = useState<
151
+ string | null
152
+ >(null);
153
+ const [provisioningHarnessRepo, setProvisioningHarnessRepo] = useState(false);
154
+ const [provisioningMessage, setProvisioningMessage] = useState<string | null>(
155
+ null,
156
+ );
157
+ const [provisioningError, setProvisioningError] = useState<string | null>(
158
+ null,
159
+ );
160
+ const [verifyingHarnessRepo, setVerifyingHarnessRepo] = useState(false);
161
+ const [showPreviewDisclosure, setShowPreviewDisclosure] = useState(false);
162
+ const [preview, setPreview] = useState<LocalSetupPreviewResult | null>(null);
163
+ const [previewPayload, setPreviewPayload] =
164
+ useState<LocalSetupFormPayload | null>(null);
165
+ const [confirmed, setConfirmed] = useState(false);
166
+ const [loading, setLoading] = useState<"preview" | "apply" | null>(null);
167
+ const [previewError, setPreviewError] = useState<string | null>(null);
168
+ const [error, setError] = useState<string | null>(null);
169
+ const [applySummary, setApplySummary] = useState<SetupGuiViewModel | null>(
170
+ null,
171
+ );
172
+ const [applySuccess, setApplySuccess] = useState<boolean | null>(null);
173
+
174
+ const guidedConfigValues = useMemo<LocalConfigFormInput>(
175
+ () => ({
176
+ ...configValues,
177
+ repos: guidedRowsToConfigRepos(guidedRepoRows),
178
+ }),
179
+ [configValues, guidedRepoRows],
180
+ );
181
+
182
+ const preparedConfig = useMemo(
183
+ () =>
184
+ mode === "guided"
185
+ ? prepareGuidedConfigFormInput(guidedConfigValues)
186
+ : configValues,
187
+ [configValues, guidedConfigValues, mode],
188
+ );
189
+
190
+ const currentPayload = useMemo<LocalSetupFormPayload>(
191
+ () => ({
192
+ env: envValues,
193
+ config: preparedConfig,
194
+ }),
195
+ [envValues, preparedConfig],
196
+ );
197
+
198
+ const previewIsCurrent =
199
+ preview !== null &&
200
+ previewPayload !== null &&
201
+ JSON.stringify(previewPayload) === JSON.stringify(currentPayload);
202
+
203
+ useEffect(() => {
204
+ if (mode !== "guided" || guidedStepProp === undefined) {
205
+ return;
206
+ }
207
+ setInternalGuidedStep(guidedStepProp);
208
+ }, [guidedStepProp, mode]);
209
+
210
+ useEffect(() => {
211
+ onUiStateChange?.({
212
+ localPreviewStale: preview !== null && !previewIsCurrent,
213
+ });
214
+ }, [onUiStateChange, preview, previewIsCurrent]);
215
+
216
+ const setGuidedStep = useCallback(
217
+ (step: GuidedLocalStep) => {
218
+ if (onGuidedStepChange) {
219
+ onGuidedStepChange(step);
220
+ return;
221
+ }
222
+ setInternalGuidedStep(step);
223
+ },
224
+ [onGuidedStepChange],
225
+ );
226
+
227
+ const goToGuidedStep = useCallback(
228
+ (nextStep: GuidedLocalStep) => {
229
+ setGuidedStep(nextStep);
230
+ requestAnimationFrame(() => {
231
+ guidedTopRef.current?.scrollIntoView({
232
+ block: "start",
233
+ behavior: prefersReducedMotion ? "auto" : "smooth",
234
+ });
235
+ });
236
+ },
237
+ [prefersReducedMotion, setGuidedStep],
238
+ );
239
+
240
+ const serviceConnectionReady = (key: ServiceKey) => {
241
+ if (!presence[key]) {
242
+ return false;
243
+ }
244
+ if (serviceVerification[key].state !== "connected") {
245
+ return false;
246
+ }
247
+ const typedValue = envValues[SERVICE_VALUE_KEY[key]].trim();
248
+ if (typedValue) {
249
+ return isServiceVerifiedForValue(serviceVerification[key], typedValue);
250
+ }
251
+ return true;
252
+ };
253
+
254
+ const connectServicesReady =
255
+ serviceConnectionReady("LINEAR_API_KEY") &&
256
+ serviceConnectionReady("CURSOR_API_KEY") &&
257
+ serviceConnectionReady("GITHUB_TOKEN") &&
258
+ serviceConnectionReady("VERCEL_TOKEN");
259
+
260
+ const servicesPersistedReady =
261
+ presence.LINEAR_API_KEY &&
262
+ presence.CURSOR_API_KEY &&
263
+ presence.GITHUB_TOKEN &&
264
+ presence.VERCEL_TOKEN;
265
+
266
+ const isGuidedLocalSetupStep =
267
+ mode === "guided" && guidedStep === "choose-target-repos";
268
+
269
+ const activeGithubToken = useMemo(
270
+ () =>
271
+ resolveActiveGitHubToken({
272
+ typedToken: envValues.githubToken,
273
+ hasSavedToken: presence.GITHUB_TOKEN,
274
+ }),
275
+ [envValues.githubToken, presence.GITHUB_TOKEN],
276
+ );
277
+
278
+ const guidedRepos =
279
+ preparedConfig.repos.length > 0
280
+ ? preparedConfig.repos
281
+ : [{ id: "", targetRepo: "" }];
282
+
283
+ const targetReposReady = guidedRepoRows.every((repo) =>
284
+ GITHUB_REPO_URL_PATTERN.test(repo.targetRepo.trim()),
285
+ );
286
+
287
+ const allReposVerified = guidedRepoRows.every((row) =>
288
+ isRepoVerifiedForActiveToken(
289
+ repoVerification[row.rowId],
290
+ row.targetRepo.trim(),
291
+ activeGithubToken?.fingerprint ?? null,
292
+ ),
293
+ );
294
+
295
+ const effectiveHarnessDispatchRepo =
296
+ envValues.githubDispatchRepository.trim() ||
297
+ initialEnv.savedHarnessDispatchRepository?.trim() ||
298
+ "";
299
+
300
+ const harnessRepoReady =
301
+ effectiveHarnessDispatchRepo.length > 0 &&
302
+ (serverValidatedHarnessRepo === effectiveHarnessDispatchRepo ||
303
+ (harnessRepoVerification.state === "connected" &&
304
+ harnessRepoVerification.verifiedRepo === effectiveHarnessDispatchRepo &&
305
+ (!activeGithubToken?.fingerprint ||
306
+ harnessRepoVerification.verifiedGithubTokenFingerprint ===
307
+ activeGithubToken.fingerprint)));
308
+
309
+ useEffect(() => {
310
+ if (mode !== "guided" || guidedStep !== "choose-target-repos") {
311
+ return;
312
+ }
313
+
314
+ let cancelled = false;
315
+ void (async () => {
316
+ try {
317
+ const response = await fetch("/api/setup/harness-provisioning-summary");
318
+ const data = await response.json();
319
+ if (!response.ok || cancelled) {
320
+ return;
321
+ }
322
+
323
+ if (data.verifiedSavedRepo && data.harnessDispatchRepo) {
324
+ setServerValidatedHarnessRepo(data.harnessDispatchRepo);
325
+ setEnvValues((current) => ({
326
+ ...current,
327
+ githubDispatchRepository: data.harnessDispatchRepo,
328
+ }));
329
+ if (data.connectedAutomatically) {
330
+ setAutoProvisionedHarnessRepo(data.harnessDispatchRepo);
331
+ }
332
+ setHarnessRepoVerification({
333
+ state: "connected",
334
+ verifiedRepo: data.harnessDispatchRepo,
335
+ message: data.message,
336
+ });
337
+ } else {
338
+ setServerValidatedHarnessRepo(null);
339
+ }
340
+ } catch {
341
+ if (!cancelled) {
342
+ setServerValidatedHarnessRepo(null);
343
+ }
344
+ }
345
+ })();
346
+
347
+ return () => {
348
+ cancelled = true;
349
+ };
350
+ }, [guidedStep, mode]);
351
+
352
+ useEffect(() => {
353
+ if (serverValidatedHarnessRepo || autoProvisionedHarnessRepo) {
354
+ return;
355
+ }
356
+ setHarnessRepoVerification({ state: "unchecked" });
357
+ }, [
358
+ activeGithubToken?.fingerprint,
359
+ autoProvisionedHarnessRepo,
360
+ serverValidatedHarnessRepo,
361
+ ]);
362
+
363
+ const continueWithHarnessProvisioning = useCallback(async () => {
364
+ setProvisioningHarnessRepo(true);
365
+ setProvisioningError(null);
366
+ setProvisioningMessage("Setting up your private p-dev workspace...");
367
+
368
+ try {
369
+ const previewResponse = await fetch(
370
+ "/api/setup/preview-harness-repo-provisioning",
371
+ {
372
+ method: "POST",
373
+ headers: { "Content-Type": "application/json" },
374
+ body: JSON.stringify({}),
375
+ },
376
+ );
377
+ const previewData = await previewResponse.json();
378
+ if (!previewResponse.ok) {
379
+ throw new Error(previewData.error ?? "Provisioning preview failed");
380
+ }
381
+
382
+ if (previewData.state === "skipped-not-packaged") {
383
+ onConnectServicesComplete?.();
384
+ return;
385
+ }
386
+
387
+ const applyResponse = await fetch(
388
+ "/api/setup/apply-harness-repo-provisioning",
389
+ {
390
+ method: "POST",
391
+ headers: { "Content-Type": "application/json" },
392
+ body: JSON.stringify({
393
+ confirmed: true,
394
+ fingerprint: previewData.fingerprint,
395
+ operationId: previewData.operationId,
396
+ }),
397
+ },
398
+ );
399
+ const applyData = await applyResponse.json();
400
+ if (!applyResponse.ok) {
401
+ throw new Error(applyData.error ?? "Provisioning apply failed");
402
+ }
403
+
404
+ if (applyData.apply.state !== "verified-and-persisted") {
405
+ if (applyData.apply.recoverable) {
406
+ setProvisioningError(applyData.apply.message);
407
+ return;
408
+ }
409
+ throw new Error(
410
+ applyData.apply.message ?? "Harness workspace provisioning did not complete.",
411
+ );
412
+ }
413
+
414
+ const repoSlug = applyData.apply.harnessDispatchRepo as string | null;
415
+ if (repoSlug) {
416
+ setAutoProvisionedHarnessRepo(repoSlug);
417
+ setEnvValues((current) => ({
418
+ ...current,
419
+ githubDispatchRepository: repoSlug,
420
+ }));
421
+ setHarnessRepoVerification({
422
+ state: "connected",
423
+ verifiedRepo: repoSlug,
424
+ message: applyData.apply.message,
425
+ });
426
+ }
427
+
428
+ onSummaryUpdated?.(applyData.summary as SetupGuiViewModel);
429
+ setProvisioningMessage(applyData.apply.message);
430
+ onConnectServicesComplete?.();
431
+ } catch (provisionError) {
432
+ setProvisioningError(
433
+ provisionError instanceof Error
434
+ ? provisionError.message
435
+ : "Harness workspace provisioning failed",
436
+ );
437
+ } finally {
438
+ setProvisioningHarnessRepo(false);
439
+ }
440
+ }, [onConnectServicesComplete, onSummaryUpdated]);
441
+
442
+ const resetApplyState = () => {
443
+ setApplySuccess(null);
444
+ setApplySummary(null);
445
+ setError(null);
446
+ };
447
+
448
+ const invalidatePreview = useCallback(() => {
449
+ resetApplyState();
450
+ setPreview(null);
451
+ setPreviewPayload(null);
452
+ setPreviewError(null);
453
+ setConfirmed(false);
454
+ }, []);
455
+
456
+ const markServiceUnchecked = (key: ServiceKey) => {
457
+ setServiceVerification((current) => ({
458
+ ...current,
459
+ [key]: { state: "unchecked" },
460
+ }));
461
+ };
462
+
463
+ const clearAllRepoVerification = useCallback(() => {
464
+ setRepoVerification({});
465
+ }, []);
466
+
467
+ const resetRepoVerificationIfUrlChanged = useCallback(
468
+ (rows: GuidedRepoRow[]) => {
469
+ setRepoVerification((current) => {
470
+ const next = { ...current };
471
+ for (const row of rows) {
472
+ const existing = current[row.rowId];
473
+ if (!existing) {
474
+ continue;
475
+ }
476
+ const trimmedUrl = row.targetRepo.trim();
477
+ if (
478
+ existing.verifiedTargetRepo &&
479
+ existing.verifiedTargetRepo !== trimmedUrl
480
+ ) {
481
+ next[row.rowId] = { state: "unchecked" };
482
+ } else if (
483
+ existing.attemptedTargetRepo &&
484
+ existing.attemptedTargetRepo !== trimmedUrl
485
+ ) {
486
+ next[row.rowId] = { state: "unchecked" };
487
+ }
488
+ }
489
+ return next;
490
+ });
491
+ },
492
+ [],
493
+ );
494
+
495
+ const saveConnectServiceKey = useCallback(
496
+ async (key: ServiceKey) => {
497
+ const previewResponse = await fetch("/api/setup/preview-connect-services", {
498
+ method: "POST",
499
+ headers: { "Content-Type": "application/json" },
500
+ body: JSON.stringify(envValues),
501
+ });
502
+ const previewData = await previewResponse.json();
503
+ if (!previewResponse.ok) {
504
+ throw new Error(previewData.error ?? "Preview failed");
505
+ }
506
+
507
+ const response = await fetch("/api/setup/apply-connect-services", {
508
+ method: "POST",
509
+ headers: { "Content-Type": "application/json" },
510
+ body: JSON.stringify({
511
+ env: envValues,
512
+ confirmed: true,
513
+ fingerprint: previewData.fingerprint,
514
+ }),
515
+ });
516
+ const data = await response.json();
517
+ if (!response.ok) {
518
+ throw new Error(data.error ?? "Save failed");
519
+ }
520
+
521
+ onSummaryUpdated?.(data.summary as SetupGuiViewModel);
522
+ setPresence({
523
+ LINEAR_API_KEY: data.summary.envKeyPresence.LINEAR_API_KEY,
524
+ CURSOR_API_KEY: data.summary.envKeyPresence.CURSOR_API_KEY,
525
+ GITHUB_TOKEN: data.summary.envKeyPresence.GITHUB_TOKEN,
526
+ VERCEL_TOKEN: data.summary.envKeyPresence.VERCEL_TOKEN,
527
+ });
528
+ setEnvValues((current) => ({
529
+ ...current,
530
+ [SERVICE_VALUE_KEY[key]]: "",
531
+ }));
532
+ },
533
+ [envValues, onSummaryUpdated],
534
+ );
535
+
536
+ const verifyAndSaveService = useCallback(
537
+ async (key: ServiceKey) => {
538
+ const token = envValues[SERVICE_VALUE_KEY[key]].trim();
539
+ const fingerprint = token ? valueFingerprint(token) : undefined;
540
+
541
+ setVerifyingServiceKey(key);
542
+ setServiceVerification((current) => ({
543
+ ...current,
544
+ [key]: { state: "checking" },
545
+ }));
546
+
547
+ try {
548
+ const response = await fetch("/api/setup/verify-service", {
549
+ method: "POST",
550
+ headers: { "Content-Type": "application/json" },
551
+ body: JSON.stringify({
552
+ service: SERVICE_API_MAP[key],
553
+ ...(token ? { token } : {}),
554
+ }),
555
+ });
556
+ const data = await response.json();
557
+ if (!response.ok) {
558
+ throw new Error(data.error ?? "Verification failed");
559
+ }
560
+
561
+ if (data.status !== "connected") {
562
+ setServiceVerification((current) => ({
563
+ ...current,
564
+ [key]: {
565
+ state: "failed",
566
+ attemptedValueFingerprint: fingerprint,
567
+ message: data.message,
568
+ limitation: data.limitation,
569
+ label: data.label,
570
+ },
571
+ }));
572
+ return;
573
+ }
574
+
575
+ if (token) {
576
+ await saveConnectServiceKey(key);
577
+ }
578
+
579
+ setServiceVerification((current) => ({
580
+ ...current,
581
+ [key]: {
582
+ state: "connected",
583
+ verifiedValueFingerprint: fingerprint,
584
+ message: data.message,
585
+ limitation: data.limitation,
586
+ label: data.label,
587
+ },
588
+ }));
589
+ } catch (verifyError) {
590
+ setServiceVerification((current) => ({
591
+ ...current,
592
+ [key]: {
593
+ state: "failed",
594
+ attemptedValueFingerprint: fingerprint,
595
+ message:
596
+ verifyError instanceof Error
597
+ ? verifyError.message
598
+ : "Verification failed",
599
+ },
600
+ }));
601
+ } finally {
602
+ setVerifyingServiceKey(null);
603
+ }
604
+ },
605
+ [envValues, saveConnectServiceKey],
606
+ );
607
+
608
+ const verifyAndUseHarnessRepo = useCallback(
609
+ async (draftRepo: string) => {
610
+ const harnessDispatchRepo = draftRepo.trim();
611
+ const tokenContext = resolveActiveGitHubToken({
612
+ typedToken: envValues.githubToken,
613
+ hasSavedToken: presence.GITHUB_TOKEN,
614
+ });
615
+ const tokenFingerprint = tokenContext?.fingerprint ?? null;
616
+
617
+ setVerifyingHarnessRepo(true);
618
+ setHarnessRepoVerification({ state: "checking" });
619
+
620
+ try {
621
+ const response = await fetch("/api/setup/verify-harness-repo", {
622
+ method: "POST",
623
+ headers: { "Content-Type": "application/json" },
624
+ body: JSON.stringify({
625
+ harnessDispatchRepo,
626
+ ...(tokenContext?.tokenForRequest
627
+ ? { githubToken: tokenContext.tokenForRequest }
628
+ : {}),
629
+ }),
630
+ });
631
+ const data = await response.json();
632
+ if (!response.ok) {
633
+ throw new Error(data.error ?? "Harness repo verification failed");
634
+ }
635
+
636
+ if (data.status === "connected" && data.repoSlug) {
637
+ invalidatePreview();
638
+ setEnvValues((current) => ({
639
+ ...current,
640
+ githubDispatchRepository: data.repoSlug,
641
+ }));
642
+ setHarnessRepoVerification({
643
+ state: "connected",
644
+ verifiedRepo: data.repoSlug,
645
+ verifiedGithubTokenFingerprint: tokenFingerprint ?? undefined,
646
+ message: data.message,
647
+ limitation: data.limitation,
648
+ });
649
+ } else {
650
+ setHarnessRepoVerification({
651
+ state: "failed",
652
+ message: data.message,
653
+ limitation: data.limitation,
654
+ });
655
+ }
656
+ } catch (verifyError) {
657
+ setHarnessRepoVerification({
658
+ state: "failed",
659
+ message:
660
+ verifyError instanceof Error
661
+ ? verifyError.message
662
+ : "Harness repo verification failed",
663
+ });
664
+ } finally {
665
+ setVerifyingHarnessRepo(false);
666
+ }
667
+ },
668
+ [
669
+ envValues.githubToken,
670
+ invalidatePreview,
671
+ presence.GITHUB_TOKEN,
672
+ ],
673
+ );
674
+
675
+ const verifyRepo = useCallback(
676
+ async (rowId: string) => {
677
+ const repo = guidedRepoRows.find((row) => row.rowId === rowId);
678
+ if (!repo) {
679
+ return;
680
+ }
681
+
682
+ const targetRepo = repo.targetRepo.trim();
683
+ const tokenContext = resolveActiveGitHubToken({
684
+ typedToken: envValues.githubToken,
685
+ hasSavedToken: presence.GITHUB_TOKEN,
686
+ });
687
+ const tokenFingerprint = tokenContext?.fingerprint ?? null;
688
+
689
+ setVerifyingRepoRowId(rowId);
690
+ setRepoVerification((current) => ({
691
+ ...current,
692
+ [rowId]: { state: "checking" },
693
+ }));
694
+
695
+ try {
696
+ const response = await fetch("/api/setup/verify-target-repo", {
697
+ method: "POST",
698
+ headers: { "Content-Type": "application/json" },
699
+ body: JSON.stringify({
700
+ targetRepo,
701
+ ...(tokenContext?.tokenForRequest
702
+ ? { githubToken: tokenContext.tokenForRequest }
703
+ : {}),
704
+ }),
705
+ });
706
+ const data = await response.json();
707
+ if (!response.ok) {
708
+ throw new Error(data.error ?? "Repo verification failed");
709
+ }
710
+
711
+ setRepoVerification((current) => ({
712
+ ...current,
713
+ [rowId]:
714
+ data.status === "connected" && data.workflowInstallReady !== false
715
+ ? {
716
+ state: "connected",
717
+ verifiedTargetRepo: targetRepo,
718
+ verifiedGithubTokenFingerprint: tokenFingerprint ?? undefined,
719
+ message: data.message,
720
+ repoSlug: data.repoSlug,
721
+ limitation: data.limitation,
722
+ workflowInstallReady: data.workflowInstallReady,
723
+ }
724
+ : {
725
+ state: "failed",
726
+ attemptedTargetRepo: targetRepo,
727
+ attemptedGithubTokenFingerprint: tokenFingerprint ?? undefined,
728
+ message: data.message,
729
+ repoSlug: data.repoSlug,
730
+ limitation: data.limitation,
731
+ workflowInstallReady: data.workflowInstallReady,
732
+ },
733
+ }));
734
+ } catch (verifyError) {
735
+ setRepoVerification((current) => ({
736
+ ...current,
737
+ [rowId]: {
738
+ state: "failed",
739
+ attemptedTargetRepo: targetRepo,
740
+ attemptedGithubTokenFingerprint: tokenFingerprint ?? undefined,
741
+ message:
742
+ verifyError instanceof Error
743
+ ? verifyError.message
744
+ : "Repo verification failed",
745
+ },
746
+ }));
747
+ } finally {
748
+ setVerifyingRepoRowId(null);
749
+ }
750
+ },
751
+ [envValues.githubToken, guidedRepoRows, presence.GITHUB_TOKEN],
752
+ );
753
+
754
+ const handleServiceBlur = useCallback(
755
+ (key: ServiceKey) => {
756
+ const value = envValues[SERVICE_VALUE_KEY[key]].trim();
757
+ if (!value) {
758
+ return;
759
+ }
760
+ if (isServiceVerifiedForValue(serviceVerification[key], value)) {
761
+ return;
762
+ }
763
+ void verifyAndSaveService(key);
764
+ },
765
+ [envValues, serviceVerification, verifyAndSaveService],
766
+ );
767
+
768
+ const handleRepoBlur = useCallback(
769
+ (rowId: string) => {
770
+ const repo = guidedRepoRows.find((row) => row.rowId === rowId);
771
+ if (!repo || !GITHUB_REPO_URL_PATTERN.test(repo.targetRepo.trim())) {
772
+ return;
773
+ }
774
+ if (
775
+ isRepoVerifiedForActiveToken(
776
+ repoVerification[rowId],
777
+ repo.targetRepo.trim(),
778
+ activeGithubToken?.fingerprint ?? null,
779
+ )
780
+ ) {
781
+ return;
782
+ }
783
+ void verifyRepo(rowId);
784
+ },
785
+ [activeGithubToken?.fingerprint, guidedRepoRows, repoVerification, verifyRepo],
786
+ );
787
+
788
+ const runPreview = useCallback(async (): Promise<LocalSetupPreviewResult> => {
789
+ const response = await fetch("/api/setup/preview-local-files", {
790
+ method: "POST",
791
+ headers: { "Content-Type": "application/json" },
792
+ body: JSON.stringify(currentPayload),
793
+ });
794
+ const data = await response.json();
795
+ if (!response.ok) {
796
+ throw new Error(data.error ?? "Preview failed");
797
+ }
798
+ const result = data as LocalSetupPreviewResult;
799
+ setPreview(result);
800
+ setPreviewPayload(currentPayload);
801
+ return result;
802
+ }, [currentPayload]);
803
+
804
+ const handlePreview = useCallback(async () => {
805
+ setLoading("preview");
806
+ setPreviewError(null);
807
+ setConfirmed(false);
808
+ try {
809
+ await runPreview();
810
+ setShowPreviewDisclosure(true);
811
+ } catch (previewFailure) {
812
+ setPreview(null);
813
+ setPreviewPayload(null);
814
+ setPreviewError(
815
+ previewFailure instanceof Error
816
+ ? previewFailure.message
817
+ : "Preview failed",
818
+ );
819
+ setShowPreviewDisclosure(true);
820
+ } finally {
821
+ setLoading(null);
822
+ }
823
+ }, [runPreview]);
824
+
825
+ const handlePreviewDisclosureOpenChange = useCallback(
826
+ (open: boolean) => {
827
+ setShowPreviewDisclosure(open);
828
+ if (open && !previewIsCurrent && loading !== "preview") {
829
+ void handlePreview();
830
+ }
831
+ },
832
+ [handlePreview, loading, previewIsCurrent],
833
+ );
834
+
835
+ const handleApply = async () => {
836
+ if (isGuidedLocalSetupStep) {
837
+ if (!confirmed) {
838
+ return;
839
+ }
840
+ } else if (!preview || !previewIsCurrent || !confirmed) {
841
+ return;
842
+ }
843
+
844
+ setLoading("apply");
845
+ resetApplyState();
846
+ try {
847
+ const applyPreview = isGuidedLocalSetupStep
848
+ ? previewIsCurrent && preview
849
+ ? preview
850
+ : await runPreview()
851
+ : preview;
852
+ if (!applyPreview) {
853
+ throw new Error("Preview failed");
854
+ }
855
+ if (applyPreview.validationError) {
856
+ throw new Error(applyPreview.validationError);
857
+ }
858
+
859
+ const response = await fetch("/api/setup/apply-local-files", {
860
+ method: "POST",
861
+ headers: { "Content-Type": "application/json" },
862
+ body: JSON.stringify({
863
+ ...currentPayload,
864
+ confirmed: true,
865
+ fingerprint: applyPreview.fingerprint,
866
+ }),
867
+ });
868
+ const data = await response.json();
869
+ if (!response.ok) {
870
+ throw new Error(data.error ?? "Apply failed");
871
+ }
872
+
873
+ onSummaryUpdated?.(data.summary as SetupGuiViewModel);
874
+ setPresence({
875
+ LINEAR_API_KEY: data.summary.envKeyPresence.LINEAR_API_KEY,
876
+ CURSOR_API_KEY: data.summary.envKeyPresence.CURSOR_API_KEY,
877
+ GITHUB_TOKEN: data.summary.envKeyPresence.GITHUB_TOKEN,
878
+ VERCEL_TOKEN: data.summary.envKeyPresence.VERCEL_TOKEN,
879
+ });
880
+ setEnvValues((current) => ({
881
+ ...current,
882
+ linearApiKey: "",
883
+ cursorApiKey: "",
884
+ githubToken: "",
885
+ vercelToken: "",
886
+ }));
887
+ setPreview(null);
888
+ setPreviewPayload(null);
889
+ setConfirmed(false);
890
+ setShowPreviewDisclosure(false);
891
+
892
+ if (mode === "guided") {
893
+ onGuidedLocalApplySuccess?.();
894
+ } else {
895
+ setApplySuccess(true);
896
+ setApplySummary(data.summary as SetupGuiViewModel);
897
+ }
898
+ } catch (applyError) {
899
+ setApplySuccess(false);
900
+ setError(
901
+ applyError instanceof Error ? applyError.message : "Apply failed",
902
+ );
903
+ } finally {
904
+ setLoading(null);
905
+ }
906
+ };
907
+
908
+ const handleCreateSetupFiles = async () => {
909
+ await handleApply();
910
+ };
911
+
912
+ const previewDisabledReason =
913
+ loading !== null ? "Wait for the current action to finish." : undefined;
914
+ const confirmDisabledReason = !previewIsCurrent
915
+ ? "Generate a preview before you can confirm this write."
916
+ : preview?.validationError
917
+ ? "Fix validation errors before confirming this write."
918
+ : undefined;
919
+ const guidedConfirmDisabledReason = preview?.validationError
920
+ ? "Fix validation errors before confirming this write."
921
+ : undefined;
922
+ const applyDisabledReason =
923
+ confirmDisabledReason ??
924
+ (!confirmed
925
+ ? "Confirm that you understand local setup files will be created on this machine."
926
+ : undefined);
927
+
928
+ const canCreateSetupFiles =
929
+ loading === null &&
930
+ servicesPersistedReady &&
931
+ targetReposReady &&
932
+ allReposVerified &&
933
+ harnessRepoReady &&
934
+ confirmed;
935
+
936
+ const guidedApplyBlockedReason =
937
+ loading !== null
938
+ ? "Wait for the current action to finish."
939
+ : !servicesPersistedReady
940
+ ? "Complete Step 1 service setup before creating local files."
941
+ : !targetReposReady
942
+ ? "Enter a valid GitHub target repo URL for each repo row to continue."
943
+ : !allReposVerified
944
+ ? `Verify access for each target repo before ${
945
+ localSetupFilesExist ? "updating" : "creating"
946
+ } setup files.`
947
+ : !harnessRepoReady
948
+ ? effectiveHarnessDispatchRepo
949
+ ? "Verify and use your harness repo before creating local setup files."
950
+ : "Complete Step 1 harness workspace setup before creating local setup files."
951
+ : !confirmed
952
+ ? `Confirm that you understand local setup files will be ${
953
+ localSetupFilesExist ? "updated" : "created"
954
+ } on this machine.`
955
+ : preview?.validationError
956
+ ? "Fix validation errors before creating setup files."
957
+ : undefined;
958
+
959
+ const guidedLocalSetupActionLabel = localSetupFilesExist
960
+ ? "Update local setup files"
961
+ : "Create local setup files";
962
+ const guidedLocalSetupActionLoadingLabel = localSetupFilesExist
963
+ ? "Updating…"
964
+ : "Creating…";
965
+
966
+ if (mode === "guided") {
967
+ const renderGuidedStep = () => {
968
+ switch (guidedStep) {
969
+ case "connect-services":
970
+ return (
971
+ <SectionCard
972
+ title={`Step 1 of ${GUIDED_SETUP_STEP_COUNT} · Connect services`}
973
+ description="Add the API keys the harness needs on this machine."
974
+ >
975
+ <EnvironmentConfigForm
976
+ values={envValues}
977
+ presence={presence}
978
+ variant="guided-services"
979
+ verification={serviceVerification}
980
+ verifyingKey={verifyingServiceKey}
981
+ onChange={(values) => {
982
+ invalidatePreview();
983
+ setEnvValues(values);
984
+ if (values.linearApiKey !== envValues.linearApiKey) {
985
+ markServiceUnchecked("LINEAR_API_KEY");
986
+ }
987
+ if (values.cursorApiKey !== envValues.cursorApiKey) {
988
+ markServiceUnchecked("CURSOR_API_KEY");
989
+ }
990
+ if (values.githubToken !== envValues.githubToken) {
991
+ markServiceUnchecked("GITHUB_TOKEN");
992
+ clearAllRepoVerification();
993
+ }
994
+ if (values.vercelToken !== envValues.vercelToken) {
995
+ markServiceUnchecked("VERCEL_TOKEN");
996
+ }
997
+ }}
998
+ onVerifyService={verifyAndSaveService}
999
+ onServiceBlur={handleServiceBlur}
1000
+ />
1001
+ <div className={FORM.actions}>
1002
+ <Button
1003
+ type="button"
1004
+ onClick={() => {
1005
+ void continueWithHarnessProvisioning();
1006
+ }}
1007
+ disabled={!connectServicesReady || provisioningHarnessRepo}
1008
+ >
1009
+ {provisioningHarnessRepo
1010
+ ? "Setting up your private p-dev workspace..."
1011
+ : "Continue and set up private p-dev workspace"}
1012
+ </Button>
1013
+ </div>
1014
+ {!connectServicesReady ? (
1015
+ <p className="text-sm text-muted-foreground">
1016
+ Verify and save each service key above. Continue unlocks after
1017
+ all four services are verified and saved locally.
1018
+ </p>
1019
+ ) : (
1020
+ <p className="text-sm text-muted-foreground">
1021
+ p-dev will use your GitHub token to create or reconnect your
1022
+ private `p-dev-harness` workspace before continuing.
1023
+ </p>
1024
+ )}
1025
+ {provisioningMessage ? (
1026
+ <p className="text-sm text-muted-foreground">{provisioningMessage}</p>
1027
+ ) : null}
1028
+ {provisioningError ? (
1029
+ <p className="text-sm text-destructive">{provisioningError}</p>
1030
+ ) : null}
1031
+ </SectionCard>
1032
+ );
1033
+ case "choose-target-repos":
1034
+ return (
1035
+ <SectionCard
1036
+ title={`Step 4 of ${GUIDED_SETUP_STEP_COUNT} · Choose target repo(s) and create setup files`}
1037
+ description="Tell the harness which GitHub repo(s) it should work against, then create local setup files on this machine."
1038
+ >
1039
+ <TargetRepoConfigForm
1040
+ values={guidedConfigValues}
1041
+ highlightStaleTarget={highlightStaleTarget}
1042
+ variant="guided-minimal"
1043
+ harnessDispatchRepository={envValues.githubDispatchRepository}
1044
+ savedHarnessDispatchRepository={
1045
+ initialEnv.savedHarnessDispatchRepository
1046
+ }
1047
+ suggestedHarnessDispatchRepo={
1048
+ initialEnv.suggestedHarnessDispatchRepo
1049
+ }
1050
+ harnessRepoVerification={harnessRepoVerification}
1051
+ verifyingHarnessRepo={verifyingHarnessRepo}
1052
+ onHarnessDispatchRepositoryChange={(value) => {
1053
+ invalidatePreview();
1054
+ setHarnessRepoVerification({ state: "unchecked" });
1055
+ setEnvValues((current) => ({
1056
+ ...current,
1057
+ githubDispatchRepository: value,
1058
+ }));
1059
+ }}
1060
+ onVerifyAndUseHarnessRepo={(draftRepo) => {
1061
+ void verifyAndUseHarnessRepo(draftRepo);
1062
+ }}
1063
+ harnessConnectedAutomatically={
1064
+ autoProvisionedHarnessRepo === effectiveHarnessDispatchRepo &&
1065
+ serverValidatedHarnessRepo === effectiveHarnessDispatchRepo &&
1066
+ Boolean(effectiveHarnessDispatchRepo)
1067
+ }
1068
+ guidedRepos={guidedRepoRows}
1069
+ repoVerification={repoVerification}
1070
+ verifyingRepoRowId={verifyingRepoRowId}
1071
+ onChange={(values) => {
1072
+ invalidatePreview();
1073
+ setConfigValues(values);
1074
+ }}
1075
+ onGuidedReposChange={(rows) => {
1076
+ invalidatePreview();
1077
+ resetRepoVerificationIfUrlChanged(rows);
1078
+ setGuidedRepoRows(rows);
1079
+ }}
1080
+ onVerifyRepo={verifyRepo}
1081
+ onRepoBlur={handleRepoBlur}
1082
+ activeGithubTokenFingerprint={activeGithubToken?.fingerprint ?? null}
1083
+ onAddRepo={() => {
1084
+ invalidatePreview();
1085
+ guidedRepoRowCounter.current += 1;
1086
+ const rowId = createGuidedRepoRowId(
1087
+ guidedRepoRowCounter.current,
1088
+ );
1089
+ setGuidedRepoRows((current) => [
1090
+ ...current,
1091
+ { rowId, id: "", targetRepo: "" },
1092
+ ]);
1093
+ }}
1094
+ onRemoveRepo={(rowId) => {
1095
+ invalidatePreview();
1096
+ setGuidedRepoRows((current) =>
1097
+ current.filter((row) => row.rowId !== rowId),
1098
+ );
1099
+ setRepoVerification((current) => {
1100
+ const next = { ...current };
1101
+ delete next[rowId];
1102
+ return next;
1103
+ });
1104
+ }}
1105
+ />
1106
+
1107
+ <Separator className="my-6" />
1108
+
1109
+ <div className="rounded-md border border-border bg-muted/20 p-4 space-y-3">
1110
+ <p className="text-sm font-medium">{guidedLocalSetupActionLabel}</p>
1111
+ <p className="text-sm text-muted-foreground">
1112
+ {localSetupFilesExist
1113
+ ? "Local gitignored setup files already exist on this machine. Preview the changes, confirm, and update `.env.local` and `.harness/config.local.json`."
1114
+ : "This is the point where the app writes local gitignored setup files to this machine: `.env.local` and `.harness/config.local.json`."}
1115
+ </p>
1116
+
1117
+ <ReviewGeneratedFilesDisclosure
1118
+ open={showPreviewDisclosure}
1119
+ onOpenChange={handlePreviewDisclosureOpenChange}
1120
+ isLoading={loading === "preview"}
1121
+ previewError={previewError ?? undefined}
1122
+ envPreview={previewIsCurrent ? preview?.envPreview : undefined}
1123
+ configPreview={
1124
+ previewIsCurrent ? preview?.configPreview : undefined
1125
+ }
1126
+ validationError={
1127
+ previewIsCurrent ? preview?.validationError : undefined
1128
+ }
1129
+ previewIsCurrent={previewIsCurrent}
1130
+ />
1131
+
1132
+ <LocalWriteConfirmation
1133
+ variant="guided"
1134
+ intent={localSetupFilesExist ? "update" : "create"}
1135
+ plan={previewIsCurrent ? preview?.plan : undefined}
1136
+ confirmed={confirmed}
1137
+ disabled={Boolean(preview?.validationError)}
1138
+ disabledReason={guidedConfirmDisabledReason}
1139
+ onConfirmedChange={setConfirmed}
1140
+ />
1141
+ </div>
1142
+
1143
+ <div className={FORM.actions}>
1144
+ <Button
1145
+ type="button"
1146
+ onClick={handleCreateSetupFiles}
1147
+ disabled={!canCreateSetupFiles}
1148
+ data-primary-preview-button="true"
1149
+ >
1150
+ {loading === "apply"
1151
+ ? guidedLocalSetupActionLoadingLabel
1152
+ : guidedLocalSetupActionLabel}
1153
+ </Button>
1154
+ </div>
1155
+ {!canCreateSetupFiles && guidedApplyBlockedReason ? (
1156
+ <p className="text-sm text-muted-foreground">
1157
+ {guidedApplyBlockedReason}
1158
+ </p>
1159
+ ) : null}
1160
+ </SectionCard>
1161
+ );
1162
+ }
1163
+ };
1164
+
1165
+ return (
1166
+ <div className={SPACING.section}>
1167
+ <div ref={guidedTopRef} />
1168
+ <GuidedStepTransition stepKey={guidedStep}>
1169
+ {renderGuidedStep()}
1170
+ </GuidedStepTransition>
1171
+
1172
+ {error ? (
1173
+ <SetupApplyResult success={false} message={error} />
1174
+ ) : null}
1175
+ </div>
1176
+ );
1177
+ }
1178
+
1179
+ return (
1180
+ <div className={SPACING.section}>
1181
+ <SectionCard
1182
+ title="Environment (.env.local)"
1183
+ description="Edit local env keys. Existing secret values are never shown."
1184
+ >
1185
+ <EnvironmentConfigForm
1186
+ values={envValues}
1187
+ presence={presence}
1188
+ highlightDispatchRepo={highlightStaleDispatch}
1189
+ variant="advanced"
1190
+ onChange={(values) => {
1191
+ invalidatePreview();
1192
+ setEnvValues(values);
1193
+ }}
1194
+ />
1195
+ </SectionCard>
1196
+
1197
+ <SectionCard
1198
+ title="Target repo config"
1199
+ description="Guided fields for .harness/config.local.json."
1200
+ >
1201
+ <TargetRepoConfigForm
1202
+ values={configValues}
1203
+ highlightStaleTarget={highlightStaleTarget}
1204
+ variant="advanced"
1205
+ onChange={(values) => {
1206
+ invalidatePreview();
1207
+ setConfigValues(values);
1208
+ }}
1209
+ />
1210
+ </SectionCard>
1211
+
1212
+ <SectionCard
1213
+ title="Preview local changes"
1214
+ description="Required before apply. Secret values are redacted in previews."
1215
+ >
1216
+ <LocalWritePreview
1217
+ envPreview={previewIsCurrent ? preview?.envPreview : undefined}
1218
+ configPreview={previewIsCurrent ? preview?.configPreview : undefined}
1219
+ validationError={
1220
+ previewIsCurrent ? preview?.validationError : undefined
1221
+ }
1222
+ />
1223
+ <div className={FORM.actions}>
1224
+ <Button
1225
+ type="button"
1226
+ onClick={handlePreview}
1227
+ disabled={loading !== null}
1228
+ data-primary-preview-button="true"
1229
+ >
1230
+ {loading === "preview" ? "Generating preview…" : "Preview setup files"}
1231
+ </Button>
1232
+ </div>
1233
+ {previewDisabledReason ? (
1234
+ <p className="text-sm text-muted-foreground">{previewDisabledReason}</p>
1235
+ ) : null}
1236
+ </SectionCard>
1237
+
1238
+ <SectionCard
1239
+ title="Confirm and apply"
1240
+ description="Writes only local gitignored setup files through setup core."
1241
+ >
1242
+ <LocalWriteConfirmation
1243
+ plan={previewIsCurrent ? preview?.plan : undefined}
1244
+ confirmed={confirmed}
1245
+ disabled={!previewIsCurrent || Boolean(preview?.validationError)}
1246
+ disabledReason={confirmDisabledReason}
1247
+ onConfirmedChange={setConfirmed}
1248
+ />
1249
+ <div className={FORM.actions}>
1250
+ <Button
1251
+ type="button"
1252
+ onClick={handleApply}
1253
+ disabled={
1254
+ loading !== null ||
1255
+ !previewIsCurrent ||
1256
+ !confirmed ||
1257
+ Boolean(preview?.validationError)
1258
+ }
1259
+ >
1260
+ {loading === "apply" ? "Creating…" : "Create local setup files"}
1261
+ </Button>
1262
+ </div>
1263
+ {applyDisabledReason ? (
1264
+ <p className="text-sm text-muted-foreground">{applyDisabledReason}</p>
1265
+ ) : null}
1266
+ </SectionCard>
1267
+
1268
+ {error ? (
1269
+ <SetupApplyResult success={false} message={error} />
1270
+ ) : null}
1271
+ {applySuccess !== null && !error ? (
1272
+ <SetupApplyResult
1273
+ success={applySuccess}
1274
+ message={
1275
+ applySuccess
1276
+ ? "Local setup files were written successfully."
1277
+ : "Apply failed."
1278
+ }
1279
+ summary={applySummary ?? undefined}
1280
+ />
1281
+ ) : null}
1282
+ </div>
1283
+ );
1284
+ }