@shepai/cli 1.124.0 → 1.126.0-pr394.cbc260a

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 (420) hide show
  1. package/apis/json-schema/FeatureFlags.yaml +5 -0
  2. package/dist/packages/core/src/application/ports/output/repositories/feature-repository.interface.d.ts +11 -0
  3. package/dist/packages/core/src/application/ports/output/repositories/feature-repository.interface.d.ts.map +1 -1
  4. package/dist/packages/core/src/application/ports/output/services/deployment-service.interface.d.ts +13 -2
  5. package/dist/packages/core/src/application/ports/output/services/deployment-service.interface.d.ts.map +1 -1
  6. package/dist/packages/core/src/application/ports/output/services/worktree-service.interface.d.ts +25 -0
  7. package/dist/packages/core/src/application/ports/output/services/worktree-service.interface.d.ts.map +1 -1
  8. package/dist/packages/core/src/application/use-cases/features/adopt-branch.use-case.d.ts +49 -0
  9. package/dist/packages/core/src/application/use-cases/features/adopt-branch.use-case.d.ts.map +1 -0
  10. package/dist/packages/core/src/application/use-cases/features/adopt-branch.use-case.js +188 -0
  11. package/dist/packages/core/src/application/use-cases/features/branch-name-utils.d.ts +33 -0
  12. package/dist/packages/core/src/application/use-cases/features/branch-name-utils.d.ts.map +1 -0
  13. package/dist/packages/core/src/application/use-cases/features/branch-name-utils.js +77 -0
  14. package/dist/packages/core/src/domain/factories/settings-defaults.factory.d.ts.map +1 -1
  15. package/dist/packages/core/src/domain/factories/settings-defaults.factory.js +1 -0
  16. package/dist/packages/core/src/domain/generated/output.d.ts +4 -0
  17. package/dist/packages/core/src/domain/generated/output.d.ts.map +1 -1
  18. package/dist/packages/core/src/infrastructure/di/container.d.ts.map +1 -1
  19. package/dist/packages/core/src/infrastructure/di/container.js +7 -0
  20. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts +1 -0
  21. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.d.ts.map +1 -1
  22. package/dist/packages/core/src/infrastructure/persistence/sqlite/mappers/settings.mapper.js +2 -0
  23. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-add-feature-flag-adopt-branch.d.ts +10 -0
  24. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-add-feature-flag-adopt-branch.d.ts.map +1 -0
  25. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-add-feature-flag-adopt-branch.js +15 -0
  26. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-create-dev-servers-table.d.ts +21 -0
  27. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-create-dev-servers-table.d.ts.map +1 -0
  28. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations/040-create-dev-servers-table.js +32 -0
  29. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations.d.ts +5 -0
  30. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations.d.ts.map +1 -1
  31. package/dist/packages/core/src/infrastructure/persistence/sqlite/migrations.js +9 -0
  32. package/dist/packages/core/src/infrastructure/repositories/sqlite-feature.repository.d.ts +1 -0
  33. package/dist/packages/core/src/infrastructure/repositories/sqlite-feature.repository.d.ts.map +1 -1
  34. package/dist/packages/core/src/infrastructure/repositories/sqlite-feature.repository.js +8 -0
  35. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.d.ts.map +1 -1
  36. package/dist/packages/core/src/infrastructure/repositories/sqlite-settings.repository.js +3 -2
  37. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/ci-watch-fix-loop.d.ts.map +1 -1
  38. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/ci-watch-fix-loop.js +9 -0
  39. package/dist/packages/core/src/infrastructure/services/deployment/deployment.service.d.ts +24 -14
  40. package/dist/packages/core/src/infrastructure/services/deployment/deployment.service.d.ts.map +1 -1
  41. package/dist/packages/core/src/infrastructure/services/deployment/deployment.service.js +203 -31
  42. package/dist/packages/core/src/infrastructure/services/deployment/parse-port.d.ts +0 -6
  43. package/dist/packages/core/src/infrastructure/services/deployment/parse-port.d.ts.map +1 -1
  44. package/dist/packages/core/src/infrastructure/services/deployment/parse-port.js +6 -1
  45. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  46. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +7 -2
  47. package/dist/packages/core/src/infrastructure/services/git/worktree.service.d.ts +2 -0
  48. package/dist/packages/core/src/infrastructure/services/git/worktree.service.d.ts.map +1 -1
  49. package/dist/packages/core/src/infrastructure/services/git/worktree.service.js +39 -0
  50. package/dist/src/presentation/cli/commands/feat/adopt.command.d.ts +14 -0
  51. package/dist/src/presentation/cli/commands/feat/adopt.command.d.ts.map +1 -0
  52. package/dist/src/presentation/cli/commands/feat/adopt.command.js +46 -0
  53. package/dist/src/presentation/cli/commands/feat/index.d.ts.map +1 -1
  54. package/dist/src/presentation/cli/commands/feat/index.js +3 -1
  55. package/dist/src/presentation/web/app/(dashboard)/@drawer/adopt/page.d.ts +10 -0
  56. package/dist/src/presentation/web/app/(dashboard)/@drawer/adopt/page.d.ts.map +1 -0
  57. package/dist/src/presentation/web/app/(dashboard)/@drawer/adopt/page.js +32 -0
  58. package/dist/src/presentation/web/app/actions/adopt-branch.d.ts +11 -0
  59. package/dist/src/presentation/web/app/actions/adopt-branch.d.ts.map +1 -0
  60. package/dist/src/presentation/web/app/actions/adopt-branch.js +20 -0
  61. package/dist/src/presentation/web/app/actions/deploy-feature.js +1 -1
  62. package/dist/src/presentation/web/app/actions/deploy-repository.js +1 -1
  63. package/dist/src/presentation/web/app/actions/list-branches.d.ts +6 -0
  64. package/dist/src/presentation/web/app/actions/list-branches.d.ts.map +1 -0
  65. package/dist/src/presentation/web/app/actions/list-branches.js +18 -0
  66. package/dist/src/presentation/web/app/build-feature-node-data.d.ts.map +1 -1
  67. package/dist/src/presentation/web/app/build-feature-node-data.js +1 -0
  68. package/dist/src/presentation/web/app/build-graph-nodes.js +1 -0
  69. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.d.ts +20 -0
  70. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.d.ts.map +1 -0
  71. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.js +105 -0
  72. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.stories.d.ts +38 -0
  73. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.stories.d.ts.map +1 -0
  74. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-branch-drawer.stories.js +161 -0
  75. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-drawer-client.d.ts +7 -0
  76. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-drawer-client.d.ts.map +1 -0
  77. package/dist/src/presentation/web/components/common/control-center-drawer/adopt-drawer-client.js +78 -0
  78. package/dist/src/presentation/web/components/common/feature-drawer-tabs/feature-drawer-tabs.d.ts.map +1 -1
  79. package/dist/src/presentation/web/components/common/feature-drawer-tabs/feature-drawer-tabs.js +4 -1
  80. package/dist/src/presentation/web/components/common/feature-node/derive-feature-state.d.ts.map +1 -1
  81. package/dist/src/presentation/web/components/common/feature-node/derive-feature-state.js +4 -0
  82. package/dist/src/presentation/web/components/common/feature-node/feature-node-state-config.d.ts +2 -0
  83. package/dist/src/presentation/web/components/common/feature-node/feature-node-state-config.d.ts.map +1 -1
  84. package/dist/src/presentation/web/components/common/repository-node/repository-node.d.ts.map +1 -1
  85. package/dist/src/presentation/web/components/common/repository-node/repository-node.js +7 -4
  86. package/dist/src/presentation/web/components/features/control-center/use-control-center-state.d.ts.map +1 -1
  87. package/dist/src/presentation/web/components/features/control-center/use-control-center-state.js +12 -3
  88. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.d.ts.map +1 -1
  89. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.js +3 -1
  90. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.stories.d.ts.map +1 -1
  91. package/dist/src/presentation/web/components/features/settings/feature-flags-settings-section.stories.js +3 -0
  92. package/dist/src/presentation/web/components/features/settings/notification-settings-section.d.ts.map +1 -1
  93. package/dist/src/presentation/web/components/features/settings/notification-settings-section.js +4 -8
  94. package/dist/src/presentation/web/components/features/settings/notification-settings-section.stories.js +3 -3
  95. package/dist/src/presentation/web/components/features/settings/settings-page-client.d.ts.map +1 -1
  96. package/dist/src/presentation/web/components/features/settings/settings-page-client.js +22 -38
  97. package/dist/src/presentation/web/components/features/settings/settings-page-client.stories.js +3 -3
  98. package/dist/src/presentation/web/components/layouts/app-shell/app-shell.d.ts.map +1 -1
  99. package/dist/src/presentation/web/components/layouts/app-shell/app-shell.js +16 -3
  100. package/dist/src/presentation/web/components/layouts/app-sidebar/app-sidebar.stories.js +1 -1
  101. package/dist/src/presentation/web/hooks/feature-flags-context.d.ts.map +1 -1
  102. package/dist/src/presentation/web/hooks/feature-flags-context.js +6 -1
  103. package/dist/src/presentation/web/hooks/use-deploy-action.d.ts.map +1 -1
  104. package/dist/src/presentation/web/hooks/use-deploy-action.js +69 -10
  105. package/dist/src/presentation/web/hooks/use-feature-logs.d.ts.map +1 -1
  106. package/dist/src/presentation/web/hooks/use-feature-logs.js +7 -2
  107. package/dist/src/presentation/web/lib/feature-flags.d.ts +2 -0
  108. package/dist/src/presentation/web/lib/feature-flags.d.ts.map +1 -1
  109. package/dist/src/presentation/web/lib/feature-flags.js +5 -0
  110. package/dist/src/presentation/web/lib/layout-with-dagre.js +3 -3
  111. package/dist/tsconfig.build.tsbuildinfo +1 -1
  112. package/package.json +1 -1
  113. package/web/.next/BUILD_ID +1 -1
  114. package/web/.next/app-path-routes-manifest.json +1 -0
  115. package/web/.next/build-manifest.json +4 -4
  116. package/web/.next/fallback-build-manifest.json +2 -2
  117. package/web/.next/prerender-manifest.json +3 -3
  118. package/web/.next/required-server-files.js +3 -3
  119. package/web/.next/required-server-files.json +3 -3
  120. package/web/.next/routes-manifest.json +6 -0
  121. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/app-paths-manifest.json +3 -0
  122. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/build-manifest.json +18 -0
  123. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/next-font-manifest.json +6 -0
  124. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/react-loadable-manifest.json +1 -0
  125. package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +335 -0
  126. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js +21 -0
  127. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.map +5 -0
  128. package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -0
  129. package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +2 -0
  130. package/web/.next/server/app/(dashboard)/@drawer/create/page/build-manifest.json +2 -2
  131. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +57 -57
  132. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +3 -3
  133. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  134. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  135. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/build-manifest.json +2 -2
  136. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +69 -69
  137. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +3 -3
  138. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  139. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  140. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/build-manifest.json +2 -2
  141. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +69 -69
  142. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +3 -3
  143. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  144. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  145. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/build-manifest.json +2 -2
  146. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +53 -53
  147. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +3 -3
  148. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  149. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  150. package/web/.next/server/app/(dashboard)/create/page/build-manifest.json +2 -2
  151. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +57 -57
  152. package/web/.next/server/app/(dashboard)/create/page.js +3 -3
  153. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  154. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  155. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/build-manifest.json +2 -2
  156. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +69 -69
  157. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +3 -3
  158. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  159. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  160. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/build-manifest.json +2 -2
  161. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +69 -69
  162. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +3 -3
  163. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  164. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  165. package/web/.next/server/app/(dashboard)/page/build-manifest.json +2 -2
  166. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +53 -53
  167. package/web/.next/server/app/(dashboard)/page.js +3 -3
  168. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  169. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  170. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/build-manifest.json +2 -2
  171. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +53 -53
  172. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +3 -3
  173. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  174. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  175. package/web/.next/server/app/_global-error/page/build-manifest.json +2 -2
  176. package/web/.next/server/app/_global-error/page.js +1 -1
  177. package/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  178. package/web/.next/server/app/_global-error.html +2 -2
  179. package/web/.next/server/app/_global-error.rsc +1 -1
  180. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  181. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  182. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  183. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  184. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  185. package/web/.next/server/app/_not-found/page/build-manifest.json +2 -2
  186. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  187. package/web/.next/server/app/_not-found/page.js +1 -1
  188. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  189. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  190. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  191. package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
  192. package/web/.next/server/app/api/graph-data/route.js.nft.json +1 -1
  193. package/web/.next/server/app/settings/page/build-manifest.json +2 -2
  194. package/web/.next/server/app/settings/page/server-reference-manifest.json +6 -6
  195. package/web/.next/server/app/settings/page.js +1 -1
  196. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  197. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  198. package/web/.next/server/app/skills/page/build-manifest.json +2 -2
  199. package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
  200. package/web/.next/server/app/skills/page.js +4 -5
  201. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  202. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  203. package/web/.next/server/app/tools/page/build-manifest.json +2 -2
  204. package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
  205. package/web/.next/server/app/tools/page.js +2 -3
  206. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  207. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  208. package/web/.next/server/app/version/page/build-manifest.json +2 -2
  209. package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
  210. package/web/.next/server/app/version/page.js +1 -1
  211. package/web/.next/server/app/version/page.js.nft.json +1 -1
  212. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  213. package/web/.next/server/app-paths-manifest.json +1 -0
  214. package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js +1 -1
  215. package/web/.next/server/chunks/403f9_next_dist_esm_build_templates_app-route_370c43b1.js.map +1 -1
  216. package/web/.next/server/chunks/[root-of-the-server]__a402b567._.js +1 -1
  217. package/web/.next/server/chunks/[root-of-the-server]__cd67a84c._.js.map +1 -1
  218. package/web/.next/server/chunks/[root-of-the-server]__dcd4f847._.js.map +1 -1
  219. package/web/.next/server/chunks/ssr/403f9_next_dist_client_components_94d75bc3._.js +3 -0
  220. package/web/.next/server/chunks/ssr/403f9_next_dist_client_components_94d75bc3._.js.map +1 -0
  221. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_fbb88113.js +3 -0
  222. package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_(dashboard)_@drawer_adopt_page_actions_fbb88113.js.map +1 -0
  223. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  224. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  225. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_fdfbf5cc.js +3 -0
  226. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_fdfbf5cc.js.map +1 -0
  227. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_d8fa0b5f.js +3 -0
  228. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_d8fa0b5f.js.map +1 -0
  229. package/web/.next/server/chunks/ssr/[root-of-the-server]__02c84e6b._.js +3 -0
  230. package/web/.next/server/chunks/ssr/[root-of-the-server]__02c84e6b._.js.map +1 -0
  231. package/web/.next/server/chunks/ssr/[root-of-the-server]__06fef644._.js +1 -1
  232. package/web/.next/server/chunks/ssr/[root-of-the-server]__248b9fc3._.js +3 -0
  233. package/web/.next/server/chunks/ssr/[root-of-the-server]__248b9fc3._.js.map +1 -0
  234. package/web/.next/server/chunks/ssr/[root-of-the-server]__357de47c._.js +4 -0
  235. package/web/.next/server/chunks/ssr/[root-of-the-server]__357de47c._.js.map +1 -0
  236. package/web/.next/server/chunks/ssr/{[root-of-the-server]__2dddfea9._.js → [root-of-the-server]__4af0afe0._.js} +2 -2
  237. package/web/.next/server/chunks/ssr/{[root-of-the-server]__2dddfea9._.js.map → [root-of-the-server]__4af0afe0._.js.map} +1 -1
  238. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ed9b909._.js +3 -0
  239. package/web/.next/server/chunks/ssr/[root-of-the-server]__4ed9b909._.js.map +1 -0
  240. package/web/.next/server/chunks/ssr/[root-of-the-server]__6677a82c._.js +1 -1
  241. package/web/.next/server/chunks/ssr/[root-of-the-server]__6677a82c._.js.map +1 -1
  242. package/web/.next/server/chunks/ssr/[root-of-the-server]__67fe07fe._.js +4 -0
  243. package/web/.next/server/chunks/ssr/[root-of-the-server]__67fe07fe._.js.map +1 -0
  244. package/web/.next/server/chunks/ssr/[root-of-the-server]__68c2d48e._.js +3 -0
  245. package/web/.next/server/chunks/ssr/[root-of-the-server]__68c2d48e._.js.map +1 -0
  246. package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js +1 -1
  247. package/web/.next/server/chunks/ssr/[root-of-the-server]__6b17a22d._.js.map +1 -1
  248. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js +2 -2
  249. package/web/.next/server/chunks/ssr/[root-of-the-server]__6bb00d90._.js.map +1 -1
  250. package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js +1 -1
  251. package/web/.next/server/chunks/ssr/[root-of-the-server]__804c006d._.js.map +1 -1
  252. package/web/.next/server/chunks/ssr/[root-of-the-server]__8c553503._.js +2 -2
  253. package/web/.next/server/chunks/ssr/{[root-of-the-server]__4c7486cb._.js → [root-of-the-server]__9bc1434f._.js} +2 -2
  254. package/web/.next/server/chunks/ssr/{[root-of-the-server]__4c7486cb._.js.map → [root-of-the-server]__9bc1434f._.js.map} +1 -1
  255. package/web/.next/server/chunks/ssr/[root-of-the-server]__a50a7e39._.js +4 -0
  256. package/web/.next/server/chunks/ssr/[root-of-the-server]__a50a7e39._.js.map +1 -0
  257. package/web/.next/server/chunks/ssr/[root-of-the-server]__c1262d08._.js +3 -0
  258. package/web/.next/server/chunks/ssr/[root-of-the-server]__c1262d08._.js.map +1 -0
  259. package/web/.next/server/chunks/ssr/[root-of-the-server]__dfc367f2._.js +3 -0
  260. package/web/.next/server/chunks/ssr/[root-of-the-server]__dfc367f2._.js.map +1 -0
  261. package/web/.next/server/chunks/ssr/[root-of-the-server]__e7f61cc6._.js +3 -0
  262. package/web/.next/server/chunks/ssr/[root-of-the-server]__e7f61cc6._.js.map +1 -0
  263. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe48d2dc._.js +3 -0
  264. package/web/.next/server/chunks/ssr/[root-of-the-server]__fe48d2dc._.js.map +1 -0
  265. package/web/.next/server/chunks/ssr/_0067cc45._.js +3 -0
  266. package/web/.next/server/chunks/ssr/_0067cc45._.js.map +1 -0
  267. package/web/.next/server/chunks/ssr/_2f6f48b8._.js +1 -1
  268. package/web/.next/server/chunks/ssr/_2f6f48b8._.js.map +1 -1
  269. package/web/.next/server/chunks/ssr/_4093a637._.js +5 -0
  270. package/web/.next/server/chunks/ssr/_4093a637._.js.map +1 -0
  271. package/web/.next/server/chunks/ssr/_583a83fb._.js +3 -0
  272. package/web/.next/server/chunks/ssr/_583a83fb._.js.map +1 -0
  273. package/web/.next/server/chunks/ssr/_7dca1882._.js +3 -0
  274. package/web/.next/server/chunks/ssr/_7dca1882._.js.map +1 -0
  275. package/web/.next/server/chunks/ssr/{_0e506641._.js → _918887c5._.js} +2 -2
  276. package/web/.next/server/chunks/ssr/_918887c5._.js.map +1 -0
  277. package/web/.next/server/chunks/ssr/_9f56cf8f._.js +3 -0
  278. package/web/.next/server/chunks/ssr/_9f56cf8f._.js.map +1 -0
  279. package/web/.next/server/chunks/ssr/_a187fd7e._.js +3 -0
  280. package/web/.next/server/chunks/ssr/_a187fd7e._.js.map +1 -0
  281. package/web/.next/server/chunks/ssr/_a37f5f18._.js +1 -1
  282. package/web/.next/server/chunks/ssr/_a37f5f18._.js.map +1 -1
  283. package/web/.next/server/chunks/ssr/_a5aa6371._.js +9 -0
  284. package/web/.next/server/chunks/ssr/_a5aa6371._.js.map +1 -0
  285. package/web/.next/server/chunks/ssr/_a9f57758._.js +3 -0
  286. package/web/.next/server/chunks/ssr/_a9f57758._.js.map +1 -0
  287. package/web/.next/server/chunks/ssr/_b730ac57._.js +3 -0
  288. package/web/.next/server/chunks/ssr/_b730ac57._.js.map +1 -0
  289. package/web/.next/server/chunks/ssr/{_f84c16ab._.js → _ca985f88._.js} +2 -2
  290. package/web/.next/server/chunks/ssr/{_f84c16ab._.js.map → _ca985f88._.js.map} +1 -1
  291. package/web/.next/server/chunks/ssr/{_1bb131c4._.js → _d4b20e29._.js} +2 -2
  292. package/web/.next/server/chunks/ssr/_d4b20e29._.js.map +1 -0
  293. package/web/.next/server/chunks/ssr/_d5206f22._.js +4 -0
  294. package/web/.next/server/chunks/ssr/_d5206f22._.js.map +1 -0
  295. package/web/.next/server/chunks/ssr/_f39a1adb._.js +3 -0
  296. package/web/.next/server/chunks/ssr/{_135edb9c._.js.map → _f39a1adb._.js.map} +1 -1
  297. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  298. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  299. package/web/.next/server/chunks/ssr/f7870_sonner_dist_index_mjs_dbf63824._.js +3 -0
  300. package/web/.next/server/chunks/ssr/f7870_sonner_dist_index_mjs_dbf63824._.js.map +1 -0
  301. package/web/.next/server/chunks/ssr/node_modules__pnpm_026172d1._.js +3 -0
  302. package/web/.next/server/chunks/ssr/node_modules__pnpm_026172d1._.js.map +1 -0
  303. package/web/.next/server/chunks/ssr/src_presentation_web_9db47db7._.js +5 -0
  304. package/web/.next/server/chunks/ssr/{src_presentation_web_5f039db1._.js.map → src_presentation_web_9db47db7._.js.map} +1 -1
  305. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_f66cd328.js +3 -0
  306. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_f66cd328.js.map +1 -0
  307. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js +1 -1
  308. package/web/.next/server/chunks/ssr/src_presentation_web_ca99d62d._.js.map +1 -1
  309. package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js +1 -1
  310. package/web/.next/server/chunks/ssr/src_presentation_web_components_e599bb8c._.js.map +1 -1
  311. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  312. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  313. package/web/.next/server/chunks/ssr/src_presentation_web_d447591b._.js +3 -0
  314. package/web/.next/server/chunks/ssr/src_presentation_web_d447591b._.js.map +1 -0
  315. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js +3 -0
  316. package/web/.next/server/chunks/ssr/src_presentation_web_db9fa0c2._.js.map +1 -0
  317. package/web/.next/server/chunks/ssr/src_presentation_web_ede4a227._.js +5 -0
  318. package/web/.next/server/chunks/ssr/{src_presentation_web_c4337169._.js.map → src_presentation_web_ede4a227._.js.map} +1 -1
  319. package/web/.next/server/middleware-build-manifest.js +2 -2
  320. package/web/.next/server/pages/500.html +2 -2
  321. package/web/.next/server/server-reference-manifest.js +1 -1
  322. package/web/.next/server/server-reference-manifest.json +493 -323
  323. package/web/.next/static/chunks/01ba448cf76c6014.js +1 -0
  324. package/web/.next/static/chunks/05e9c71e5e4cf531.js +1 -0
  325. package/web/.next/static/chunks/18a2b4684056f84c.js +1 -0
  326. package/web/.next/static/chunks/33d2f67ad4814aba.css +1 -0
  327. package/web/.next/static/chunks/{5b7726ff31c25338.js → 3ada33a2a4ff98c9.js} +2 -2
  328. package/web/.next/static/chunks/410ac44266372b6f.js +1 -0
  329. package/web/.next/static/chunks/5b7f180cc7720fdf.js +1 -0
  330. package/web/.next/static/chunks/7c19a6b91900ce20.js +1 -0
  331. package/web/.next/static/chunks/8080c842b0358904.js +1 -0
  332. package/web/.next/static/chunks/{ed3a602003bcb31b.js → 89aac43287d73b02.js} +1 -1
  333. package/web/.next/static/chunks/9c912c68a5447922.js +1 -0
  334. package/web/.next/static/chunks/a24724c6ad4a288e.js +1 -0
  335. package/web/.next/static/chunks/a8ba3f3e2b0f87aa.js +1 -0
  336. package/web/.next/static/chunks/ab9669444102757d.js +1 -0
  337. package/web/.next/static/chunks/abec065fa72fc75e.js +1 -0
  338. package/web/.next/static/chunks/ae876e7d80026c97.js +1 -0
  339. package/web/.next/static/chunks/b70dd4985a814b27.js +1 -0
  340. package/web/.next/static/chunks/{74fa59dbd04fdfcb.js → c5e851a9786099f1.js} +2 -2
  341. package/web/.next/static/chunks/cd45aed9c46e1bf5.js +11 -0
  342. package/web/.next/static/chunks/d04de4be30ab78ca.js +3 -0
  343. package/web/.next/static/chunks/{turbopack-426d9bc2450816ba.js → turbopack-080e470ea902d0ba.js} +1 -1
  344. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js +0 -3
  345. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js.map +0 -1
  346. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_f30d0343.js +0 -3
  347. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_f30d0343.js.map +0 -1
  348. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_9f1775bb.js +0 -3
  349. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_9f1775bb.js.map +0 -1
  350. package/web/.next/server/chunks/ssr/[root-of-the-server]__14664e9b._.js +0 -4
  351. package/web/.next/server/chunks/ssr/[root-of-the-server]__14664e9b._.js.map +0 -1
  352. package/web/.next/server/chunks/ssr/[root-of-the-server]__4993a47c._.js +0 -3
  353. package/web/.next/server/chunks/ssr/[root-of-the-server]__4993a47c._.js.map +0 -1
  354. package/web/.next/server/chunks/ssr/[root-of-the-server]__52485955._.js +0 -3
  355. package/web/.next/server/chunks/ssr/[root-of-the-server]__52485955._.js.map +0 -1
  356. package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js +0 -3
  357. package/web/.next/server/chunks/ssr/[root-of-the-server]__545792ab._.js.map +0 -1
  358. package/web/.next/server/chunks/ssr/[root-of-the-server]__7cbda1ea._.js +0 -3
  359. package/web/.next/server/chunks/ssr/[root-of-the-server]__7cbda1ea._.js.map +0 -1
  360. package/web/.next/server/chunks/ssr/[root-of-the-server]__9e8b25ad._.js +0 -3
  361. package/web/.next/server/chunks/ssr/[root-of-the-server]__9e8b25ad._.js.map +0 -1
  362. package/web/.next/server/chunks/ssr/[root-of-the-server]__a7de2711._.js +0 -4
  363. package/web/.next/server/chunks/ssr/[root-of-the-server]__a7de2711._.js.map +0 -1
  364. package/web/.next/server/chunks/ssr/[root-of-the-server]__aed1d6f8._.js +0 -3
  365. package/web/.next/server/chunks/ssr/[root-of-the-server]__aed1d6f8._.js.map +0 -1
  366. package/web/.next/server/chunks/ssr/[root-of-the-server]__ce6057f6._.js +0 -3
  367. package/web/.next/server/chunks/ssr/[root-of-the-server]__ce6057f6._.js.map +0 -1
  368. package/web/.next/server/chunks/ssr/_0e506641._.js.map +0 -1
  369. package/web/.next/server/chunks/ssr/_135edb9c._.js +0 -3
  370. package/web/.next/server/chunks/ssr/_1bb131c4._.js.map +0 -1
  371. package/web/.next/server/chunks/ssr/_3a4c94e3._.js +0 -3
  372. package/web/.next/server/chunks/ssr/_3a4c94e3._.js.map +0 -1
  373. package/web/.next/server/chunks/ssr/_6d26a08f._.js +0 -3
  374. package/web/.next/server/chunks/ssr/_6d26a08f._.js.map +0 -1
  375. package/web/.next/server/chunks/ssr/_9ac70f88._.js +0 -5
  376. package/web/.next/server/chunks/ssr/_9ac70f88._.js.map +0 -1
  377. package/web/.next/server/chunks/ssr/_b56e7571._.js +0 -3
  378. package/web/.next/server/chunks/ssr/_b56e7571._.js.map +0 -1
  379. package/web/.next/server/chunks/ssr/_b89059c0._.js +0 -3
  380. package/web/.next/server/chunks/ssr/_b89059c0._.js.map +0 -1
  381. package/web/.next/server/chunks/ssr/_cc77a143._.js +0 -3
  382. package/web/.next/server/chunks/ssr/_cc77a143._.js.map +0 -1
  383. package/web/.next/server/chunks/ssr/_e9703421._.js +0 -3
  384. package/web/.next/server/chunks/ssr/_e9703421._.js.map +0 -1
  385. package/web/.next/server/chunks/ssr/_f1a649e3._.js +0 -9
  386. package/web/.next/server/chunks/ssr/_f1a649e3._.js.map +0 -1
  387. package/web/.next/server/chunks/ssr/node_modules__pnpm_bc66dcc6._.js +0 -3
  388. package/web/.next/server/chunks/ssr/node_modules__pnpm_bc66dcc6._.js.map +0 -1
  389. package/web/.next/server/chunks/ssr/src_presentation_web_164fa933._.js +0 -3
  390. package/web/.next/server/chunks/ssr/src_presentation_web_164fa933._.js.map +0 -1
  391. package/web/.next/server/chunks/ssr/src_presentation_web_5f039db1._.js +0 -5
  392. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_2a52b697.js +0 -3
  393. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_2a52b697.js.map +0 -1
  394. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +0 -3
  395. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +0 -1
  396. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +0 -3
  397. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +0 -1
  398. package/web/.next/server/chunks/ssr/src_presentation_web_c4337169._.js +0 -5
  399. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +0 -3
  400. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js.map +0 -1
  401. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +0 -3
  402. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js.map +0 -1
  403. package/web/.next/static/chunks/0dc102ef519487f5.js +0 -1
  404. package/web/.next/static/chunks/10fc8c2e5ff44bb2.js +0 -1
  405. package/web/.next/static/chunks/303a1217006489b9.js +0 -1
  406. package/web/.next/static/chunks/3925626b99dcd57a.css +0 -1
  407. package/web/.next/static/chunks/4443ee9c7733399b.js +0 -1
  408. package/web/.next/static/chunks/52b56677c842e45f.js +0 -3
  409. package/web/.next/static/chunks/76c038a9d55ca717.js +0 -1
  410. package/web/.next/static/chunks/9d7e0bb6dc2f88ae.js +0 -1
  411. package/web/.next/static/chunks/9db7f24ddea15a4c.js +0 -1
  412. package/web/.next/static/chunks/ac7251026c1e2cdf.js +0 -1
  413. package/web/.next/static/chunks/ad076c0b68dd9971.js +0 -1
  414. package/web/.next/static/chunks/d72044b2826292fe.js +0 -1
  415. package/web/.next/static/chunks/dbbb446493f21874.js +0 -1
  416. package/web/.next/static/chunks/e2ef95d904c360f3.js +0 -1
  417. package/web/.next/static/chunks/eaeabda870a35a9a.js +0 -11
  418. /package/web/.next/static/{Ap_0BUaFHzD8WxrlWsbMg → W_miKk1uDL5R44bTUYFaE}/_buildManifest.js +0 -0
  419. /package/web/.next/static/{Ap_0BUaFHzD8WxrlWsbMg → W_miKk1uDL5R44bTUYFaE}/_clientMiddlewareManifest.json +0 -0
  420. /package/web/.next/static/{Ap_0BUaFHzD8WxrlWsbMg → W_miKk1uDL5R44bTUYFaE}/_ssgManifest.js +0 -0
@@ -2,13 +2,20 @@
2
2
  * Deployment Service
3
3
  *
4
4
  * Infrastructure service that manages local dev server deployments.
5
- * Holds an in-memory Map of active deployments keyed by targetId.
6
- * Handles process spawning, stdout-based port detection, and graceful
7
- * shutdown (SIGTERM poll SIGKILL).
5
+ * Holds an in-memory Map of active deployments keyed by targetId AND
6
+ * persists deployment records to the `dev_servers` SQLite table so that
7
+ * running dev servers survive page reloads and server restarts.
8
+ *
9
+ * On startup, call `recoverAll()` to reconcile the DB with actual
10
+ * process state (clean up dead PIDs, re-adopt live ones).
8
11
  */
9
12
  import { spawn } from 'node:child_process';
10
13
  import { EventEmitter } from 'node:events';
11
- import treeKill from 'tree-kill';
14
+ // NOTE: We intentionally do NOT use tree-kill here. tree-kill traverses
15
+ // /proc to find child processes which can accidentally kill parent processes
16
+ // (including the Shep web UI). Instead, we use process.kill(-pid) to send
17
+ // signals to the process GROUP (since we spawn with detached: true, the
18
+ // child gets its own process group via setsid()).
12
19
  import { DeploymentState } from '../../../domain/generated/output.js';
13
20
  import { detectDevScript } from './detect-dev-script.js';
14
21
  import { createDeploymentLogger } from './deployment-logger.js';
@@ -20,7 +27,22 @@ const MAX_WAIT_MS = 5000;
20
27
  const defaultDeps = {
21
28
  spawn,
22
29
  detectDevScript,
23
- kill: (pid, signal) => treeKill(pid, signal),
30
+ kill: (pid, signal) => {
31
+ try {
32
+ // Kill the entire process group (negative PID) — safe because
33
+ // detached: true puts the child in its own group via setsid().
34
+ process.kill(-pid, signal);
35
+ }
36
+ catch {
37
+ // Fallback: kill just the process itself
38
+ try {
39
+ process.kill(pid, signal);
40
+ }
41
+ catch {
42
+ // Process already dead
43
+ }
44
+ }
45
+ },
24
46
  isAlive: (pid) => {
25
47
  try {
26
48
  process.kill(pid, 0);
@@ -35,14 +57,65 @@ export class DeploymentService {
35
57
  deployments = new Map();
36
58
  deps;
37
59
  emitter = new EventEmitter();
60
+ db = null;
38
61
  constructor(deps = {}) {
39
62
  this.deps = { ...defaultDeps, ...deps };
40
63
  }
64
+ /**
65
+ * Inject the database connection. Called from DI container after DB is ready.
66
+ */
67
+ setDatabase(db) {
68
+ this.db = db;
69
+ }
70
+ /**
71
+ * Recover dev servers from the database on startup.
72
+ * Validates each PID is still alive; removes dead rows.
73
+ */
74
+ recoverAll() {
75
+ if (!this.db)
76
+ return;
77
+ let rows;
78
+ try {
79
+ const stmt = this.db.prepare('SELECT * FROM dev_servers');
80
+ rows = stmt.all() ?? [];
81
+ }
82
+ catch {
83
+ log.info('dev_servers table not ready — skipping recovery');
84
+ return;
85
+ }
86
+ if (!rows || rows.length === 0) {
87
+ log.info('No dev servers to recover from database');
88
+ return;
89
+ }
90
+ log.info(`Recovering ${rows.length} dev server(s) from database`);
91
+ for (const row of rows) {
92
+ if (this.deps.isAlive(row.pid)) {
93
+ log.info(`Recovered "${row.target_id}" (pid=${row.pid}, state=${row.state}, url=${row.url})`);
94
+ const entry = {
95
+ pid: row.pid,
96
+ child: null, // orphan — we don't have the ChildProcess handle
97
+ state: row.state,
98
+ url: row.url,
99
+ targetId: row.target_id,
100
+ targetPath: row.target_path,
101
+ targetType: row.target_type,
102
+ stdoutBuffer: '',
103
+ stderrBuffer: '',
104
+ logs: new LogRingBuffer(),
105
+ };
106
+ this.deployments.set(row.target_id, entry);
107
+ }
108
+ else {
109
+ log.info(`Stale dev server "${row.target_id}" (pid=${row.pid}) — removing from DB`);
110
+ this.dbDelete(row.target_id);
111
+ }
112
+ }
113
+ }
41
114
  /**
42
115
  * Start a deployment for the given target.
43
116
  * If a deployment already exists for this target, it is stopped first.
44
117
  */
45
- start(targetId, targetPath) {
118
+ start(targetId, targetPath, targetType = 'repository') {
46
119
  log.info(`start() called — targetId="${targetId}", targetPath="${targetPath}"`);
47
120
  // Stop any existing deployment for this target
48
121
  const existing = this.deployments.get(targetId);
@@ -50,6 +123,7 @@ export class DeploymentService {
50
123
  log.info(`Stopping existing deployment for "${targetId}" (pid=${existing.pid})`);
51
124
  this.killProcess(existing);
52
125
  this.deployments.delete(targetId);
126
+ this.dbDelete(targetId);
53
127
  }
54
128
  // Detect the dev script
55
129
  const detection = this.deps.detectDevScript(targetPath);
@@ -78,11 +152,14 @@ export class DeploymentService {
78
152
  state: DeploymentState.Booting,
79
153
  url: null,
80
154
  targetId,
155
+ targetPath,
156
+ targetType,
81
157
  stdoutBuffer: '',
82
158
  stderrBuffer: '',
83
159
  logs: new LogRingBuffer(),
84
160
  };
85
161
  this.deployments.set(targetId, entry);
162
+ this.dbUpsert(entry);
86
163
  // Attach stdout/stderr listeners for port detection
87
164
  this.attachOutputListener(entry, 'stdout');
88
165
  this.attachOutputListener(entry, 'stderr');
@@ -91,6 +168,7 @@ export class DeploymentService {
91
168
  log.error(`Child process error for "${targetId}" (pid=${entry.pid}): ${err.message}`);
92
169
  entry.state = DeploymentState.Stopped;
93
170
  this.deployments.delete(targetId);
171
+ this.dbDelete(targetId);
94
172
  });
95
173
  // Clean up on process exit
96
174
  child.on('exit', (code, signal) => {
@@ -100,20 +178,52 @@ export class DeploymentService {
100
178
  log.warn('Process exited while still in Booting state — dev server likely crashed on startup. Check stderr output above.');
101
179
  }
102
180
  this.deployments.delete(targetId);
181
+ this.dbDelete(targetId);
103
182
  });
104
183
  }
105
184
  /**
106
185
  * Get the current deployment status for a target.
107
- * Returns null if no deployment exists for this target.
186
+ * Checks in-memory Map first, then falls back to DB for recovered deployments.
187
+ * Validates PID liveness — cleans up if dead.
108
188
  */
109
189
  getStatus(targetId) {
110
190
  const entry = this.deployments.get(targetId);
111
- if (!entry) {
112
- log.debug(`getStatus("${targetId}") no deployment found`);
113
- return null;
191
+ if (entry) {
192
+ // Validate the process is still alive (handles orphan crashes)
193
+ if (!this.deps.isAlive(entry.pid)) {
194
+ log.info(`getStatus("${targetId}") — pid=${entry.pid} is dead, cleaning up`);
195
+ this.deployments.delete(targetId);
196
+ this.dbDelete(targetId);
197
+ return null;
198
+ }
199
+ log.debug(`getStatus("${targetId}") — state=${entry.state}, url=${entry.url}, pid=${entry.pid}`);
200
+ return { state: entry.state, url: entry.url };
114
201
  }
115
- log.debug(`getStatus("${targetId}") state=${entry.state}, url=${entry.url}, pid=${entry.pid}`);
116
- return { state: entry.state, url: entry.url };
202
+ // Check DB for entries not yet in memory (e.g., after hook re-mount)
203
+ const row = this.dbFind(targetId);
204
+ if (row) {
205
+ if (this.deps.isAlive(row.pid)) {
206
+ // Re-adopt into memory
207
+ const recovered = {
208
+ pid: row.pid,
209
+ child: null,
210
+ state: row.state,
211
+ url: row.url,
212
+ targetId: row.target_id,
213
+ targetPath: row.target_path,
214
+ targetType: row.target_type,
215
+ stdoutBuffer: '',
216
+ stderrBuffer: '',
217
+ logs: new LogRingBuffer(),
218
+ };
219
+ this.deployments.set(targetId, recovered);
220
+ return { state: recovered.state, url: recovered.url };
221
+ }
222
+ // Dead — clean up
223
+ this.dbDelete(targetId);
224
+ }
225
+ log.debug(`getStatus("${targetId}") — no deployment found`);
226
+ return null;
117
227
  }
118
228
  /**
119
229
  * Stop a deployment gracefully: SIGTERM → poll → SIGKILL.
@@ -121,7 +231,19 @@ export class DeploymentService {
121
231
  async stop(targetId) {
122
232
  const entry = this.deployments.get(targetId);
123
233
  if (!entry) {
124
- log.info(`stop("${targetId}") no deployment found, nothing to stop`);
234
+ // Check DB in case it's a recovered orphan
235
+ const row = this.dbFind(targetId);
236
+ if (row && this.deps.isAlive(row.pid)) {
237
+ log.info(`stop("${targetId}") — killing orphan process (pid=${row.pid})`);
238
+ try {
239
+ this.deps.kill(row.pid, 'SIGKILL');
240
+ }
241
+ catch {
242
+ // already dead
243
+ }
244
+ }
245
+ this.dbDelete(targetId);
246
+ log.info(`stop("${targetId}") — no in-memory deployment found, cleaned DB`);
125
247
  return;
126
248
  }
127
249
  log.info(`stop("${targetId}") — sending SIGTERM to process tree (pid=${entry.pid})`);
@@ -133,13 +255,13 @@ export class DeploymentService {
133
255
  catch {
134
256
  log.info(`stop("${targetId}") — process already dead on SIGTERM`);
135
257
  this.deployments.delete(targetId);
258
+ this.dbDelete(targetId);
136
259
  return;
137
260
  }
138
261
  // Wait for the process to exit
139
262
  const died = await this.pollUntilDead(entry.pid, MAX_WAIT_MS, POLL_INTERVAL_MS);
140
263
  if (!died) {
141
264
  log.warn(`stop("${targetId}") — process did not exit after ${MAX_WAIT_MS}ms, escalating to SIGKILL`);
142
- // Escalate to SIGKILL
143
265
  try {
144
266
  this.deps.kill(entry.pid, 'SIGKILL');
145
267
  }
@@ -150,8 +272,13 @@ export class DeploymentService {
150
272
  else {
151
273
  log.info(`stop("${targetId}") — process exited gracefully`);
152
274
  }
153
- // Wait for the exit event to clean up the map
154
- await this.waitForExit(entry.child);
275
+ // Wait for the exit event to clean up the map (only if we have a ChildProcess handle)
276
+ if (entry.child) {
277
+ await this.waitForExit(entry.child);
278
+ }
279
+ // Ensure cleanup
280
+ this.deployments.delete(targetId);
281
+ this.dbDelete(targetId);
155
282
  }
156
283
  /**
157
284
  * Force-stop all tracked deployments immediately (for daemon shutdown).
@@ -161,6 +288,15 @@ export class DeploymentService {
161
288
  entry.logs.clear();
162
289
  this.killProcess(entry);
163
290
  }
291
+ // Also clean DB
292
+ if (this.db) {
293
+ try {
294
+ this.db.prepare('DELETE FROM dev_servers').run();
295
+ }
296
+ catch {
297
+ // table might not exist yet
298
+ }
299
+ }
164
300
  }
165
301
  /**
166
302
  * Get the accumulated log buffer for a deployment.
@@ -183,9 +319,54 @@ export class DeploymentService {
183
319
  off(event, handler) {
184
320
  this.emitter.off(event, handler);
185
321
  }
186
- /**
187
- * Send SIGKILL to a process tree.
188
- */
322
+ // ─── Database helpers ───────────────────────────────────────────────
323
+ dbUpsert(entry) {
324
+ if (!this.db)
325
+ return;
326
+ try {
327
+ this.db
328
+ .prepare(`INSERT OR REPLACE INTO dev_servers
329
+ (target_id, target_type, pid, state, url, target_path, started_at)
330
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
331
+ .run(entry.targetId, entry.targetType, entry.pid, entry.state, entry.url, entry.targetPath, Date.now());
332
+ }
333
+ catch (err) {
334
+ log.warn(`dbUpsert failed for "${entry.targetId}": ${err}`);
335
+ }
336
+ }
337
+ dbUpdateState(targetId, state, url) {
338
+ if (!this.db)
339
+ return;
340
+ try {
341
+ this.db
342
+ .prepare('UPDATE dev_servers SET state = ?, url = ? WHERE target_id = ?')
343
+ .run(state, url, targetId);
344
+ }
345
+ catch (err) {
346
+ log.warn(`dbUpdateState failed for "${targetId}": ${err}`);
347
+ }
348
+ }
349
+ dbDelete(targetId) {
350
+ if (!this.db)
351
+ return;
352
+ try {
353
+ this.db.prepare('DELETE FROM dev_servers WHERE target_id = ?').run(targetId);
354
+ }
355
+ catch (err) {
356
+ log.warn(`dbDelete failed for "${targetId}": ${err}`);
357
+ }
358
+ }
359
+ dbFind(targetId) {
360
+ if (!this.db)
361
+ return null;
362
+ try {
363
+ return (this.db.prepare('SELECT * FROM dev_servers WHERE target_id = ?').get(targetId) ?? null);
364
+ }
365
+ catch {
366
+ return null;
367
+ }
368
+ }
369
+ // ─── Process helpers ────────────────────────────────────────────────
189
370
  killProcess(entry) {
190
371
  try {
191
372
  this.deps.kill(entry.pid, 'SIGKILL');
@@ -200,24 +381,20 @@ export class DeploymentService {
200
381
  */
201
382
  attachOutputListener(entry, stream) {
202
383
  const bufferKey = stream === 'stdout' ? 'stdoutBuffer' : 'stderrBuffer';
203
- const childStream = entry.child[stream];
384
+ const childStream = entry.child?.[stream];
204
385
  if (!childStream) {
205
386
  log.warn(`[${entry.targetId}] No ${stream} stream available — cannot attach listener`);
206
387
  return;
207
388
  }
208
389
  childStream.on('data', (chunk) => {
209
390
  const text = chunk.toString();
210
- // Append chunk to buffer
211
391
  entry[bufferKey] += text;
212
- // Process complete lines
213
392
  const lines = entry[bufferKey].split('\n');
214
- // Keep the last element (incomplete line) in the buffer
215
393
  entry[bufferKey] = lines.pop() ?? '';
216
394
  for (const line of lines) {
217
395
  if (!line.trim())
218
396
  continue;
219
397
  log.debug(`[${entry.targetId}] ${stream}: ${line}`);
220
- // Accumulate in log buffer and emit event
221
398
  const logEntry = {
222
399
  targetId: entry.targetId,
223
400
  stream,
@@ -233,12 +410,12 @@ export class DeploymentService {
233
410
  log.info(`[${entry.targetId}] Port detected — url="${url}" (from ${stream})`);
234
411
  entry.state = DeploymentState.Ready;
235
412
  entry.url = url;
413
+ this.dbUpdateState(entry.targetId, entry.state, entry.url);
236
414
  }
237
415
  }
238
416
  }
239
417
  });
240
418
  childStream.on('end', () => {
241
- // Flush remaining buffer content
242
419
  const remaining = entry[bufferKey].trim();
243
420
  if (remaining) {
244
421
  log.debug(`[${entry.targetId}] ${stream} (flush): ${remaining}`);
@@ -248,6 +425,7 @@ export class DeploymentService {
248
425
  log.info(`[${entry.targetId}] Port detected in flushed buffer — url="${url}"`);
249
426
  entry.state = DeploymentState.Ready;
250
427
  entry.url = url;
428
+ this.dbUpdateState(entry.targetId, entry.state, entry.url);
251
429
  }
252
430
  }
253
431
  entry[bufferKey] = '';
@@ -255,9 +433,6 @@ export class DeploymentService {
255
433
  log.debug(`[${entry.targetId}] ${stream} stream ended`);
256
434
  });
257
435
  }
258
- /**
259
- * Poll until a process is dead or timeout expires.
260
- */
261
436
  async pollUntilDead(pid, maxMs, intervalMs) {
262
437
  const deadline = Date.now() + maxMs;
263
438
  while (Date.now() < deadline) {
@@ -268,9 +443,6 @@ export class DeploymentService {
268
443
  }
269
444
  return false;
270
445
  }
271
- /**
272
- * Wait for a child process to emit 'exit', with a short timeout.
273
- */
274
446
  waitForExit(child) {
275
447
  return new Promise((resolve) => {
276
448
  const timeout = setTimeout(() => resolve(), 1000);
@@ -5,11 +5,5 @@
5
5
  * dev server stdout/stderr output. Handles common patterns from Next.js,
6
6
  * Vite, Express, and generic servers.
7
7
  */
8
- /**
9
- * Parse a line of stdout/stderr output for a localhost URL or port.
10
- *
11
- * @param line - A single line of process output
12
- * @returns The detected URL string, or null if no URL/port was found
13
- */
14
8
  export declare function parsePort(line: string): string | null;
15
9
  //# sourceMappingURL=parse-port.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-port.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/parse-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkCH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAarD"}
1
+ {"version":3,"file":"parse-port.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/deployment/parse-port.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4CH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgBrD"}
@@ -38,12 +38,17 @@ const PORT_PATTERNS = [
38
38
  * @param line - A single line of process output
39
39
  * @returns The detected URL string, or null if no URL/port was found
40
40
  */
41
+ // Strip ANSI escape codes (colors, cursor movement, etc.)
42
+ // eslint-disable-next-line no-control-regex
43
+ const ANSI_REGEX = /\x1b\[[0-9;]*[a-zA-Z]/g;
41
44
  export function parsePort(line) {
42
45
  if (!line?.trim()) {
43
46
  return null;
44
47
  }
48
+ // Strip ANSI escape codes before matching — dev servers often emit colored output
49
+ const clean = line.replace(ANSI_REGEX, '');
45
50
  for (const { regex, extract } of PORT_PATTERNS) {
46
- const match = line.match(regex);
51
+ const match = clean.match(regex);
47
52
  if (match) {
48
53
  return extract(match);
49
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"git-pr.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-pr.service.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"git-pr.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/git-pr.service.ts"],"names":[],"mappings":"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"}
@@ -308,15 +308,19 @@ let GitPrService = class GitPrService {
308
308
  }
309
309
  }
310
310
  async watchCi(cwd, branch, timeoutMs, intervalSeconds) {
311
+ // Resolve the latest run for the branch BEFORE the try/catch so the
312
+ // runUrl is available in both success and failure return paths.
313
+ let runUrl;
311
314
  try {
312
315
  // gh run watch requires a run ID — it does not support --branch.
313
316
  // First, resolve the latest run ID for the branch via gh run list.
314
- const { stdout: listOut } = await this.execFile('gh', ['run', 'list', '--branch', branch, '--json', 'databaseId', '--limit', '1'], { cwd });
317
+ const { stdout: listOut } = await this.execFile('gh', ['run', 'list', '--branch', branch, '--json', 'databaseId,url', '--limit', '1'], { cwd });
315
318
  const runs = JSON.parse(listOut);
316
319
  if (runs.length === 0 || !runs[0].databaseId) {
317
320
  return { status: 'pending' };
318
321
  }
319
322
  const runId = String(runs[0].databaseId);
323
+ runUrl = runs[0].url;
320
324
  const interval = intervalSeconds ?? 30;
321
325
  const args = [
322
326
  'run',
@@ -335,6 +339,7 @@ let GitPrService = class GitPrService {
335
339
  // If we reach here (no exception), CI passed — no need for fragile stdout parsing.
336
340
  return {
337
341
  status: 'success',
342
+ runUrl,
338
343
  logExcerpt: stdout.trim(),
339
344
  };
340
345
  }
@@ -356,7 +361,7 @@ let GitPrService = class GitPrService {
356
361
  // Build a useful log excerpt from stdout/stderr if available
357
362
  const errObj = error;
358
363
  const parts = [errObj.stdout, errObj.stderr, message].filter(Boolean);
359
- return { status: 'failure', logExcerpt: parts.join('\n').trim() };
364
+ return { status: 'failure', runUrl, logExcerpt: parts.join('\n').trim() };
360
365
  }
361
366
  throw new GitPrError(message, GitPrErrorCode.GIT_ERROR, cause);
362
367
  }
@@ -18,12 +18,14 @@ export declare class WorktreeService implements IWorktreeService {
18
18
  private readonly execFile;
19
19
  constructor(execFile: ExecFunction);
20
20
  create(repoPath: string, branch: string, worktreePath: string, startPoint?: string): Promise<WorktreeInfo>;
21
+ addExisting(repoPath: string, branch: string, worktreePath: string): Promise<WorktreeInfo>;
21
22
  remove(repoPath: string, worktreePath: string, force?: boolean): Promise<void>;
22
23
  prune(repoPath: string): Promise<void>;
23
24
  list(repoPath: string): Promise<WorktreeInfo[]>;
24
25
  exists(repoPath: string, branch: string): Promise<boolean>;
25
26
  branchExists(repoPath: string, branch: string): Promise<boolean>;
26
27
  remoteBranchExists(repoPath: string, branch: string): Promise<boolean>;
28
+ listBranches(repoPath: string): Promise<string[]>;
27
29
  ensureGitRepository(repoPath: string): Promise<void>;
28
30
  getWorktreePath(repoPath: string, branch: string): string;
29
31
  private parseWorktreeOutput;
@@ -1 +1 @@
1
- {"version":3,"file":"worktree.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/worktree.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,0EAA0E,CAAC;AAQlF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjD,qBACa,eAAgB,YAAW,gBAAgB;IAClB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC;IAuBlB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9E,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAO/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWtE,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC1D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAQzD,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,qBAAqB;CAsB9B"}
1
+ {"version":3,"file":"worktree.service.d.ts","sourceRoot":"","sources":["../../../../../../../packages/core/src/infrastructure/services/git/worktree.service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,0EAA0E,CAAC;AAQlF;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjD,qBACa,eAAgB,YAAW,gBAAgB;IAClB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAErE,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC;IAuBlB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAoB1F,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9E,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAO/C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWhE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWtE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAuBjD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwC1D,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAQzD,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,qBAAqB;CAsB9B"}
@@ -50,6 +50,21 @@ let WorktreeService = class WorktreeService {
50
50
  }
51
51
  return created;
52
52
  }
53
+ async addExisting(repoPath, branch, worktreePath) {
54
+ try {
55
+ await this.execFile('git', ['worktree', 'add', worktreePath, branch], { cwd: repoPath });
56
+ }
57
+ catch (error) {
58
+ throw this.parseGitError(error);
59
+ }
60
+ const worktrees = await this.list(repoPath);
61
+ const created = worktrees.find((w) => w.branch === branch) ??
62
+ worktrees.find((w) => this.arePathsEquivalent(w.path, worktreePath));
63
+ if (!created) {
64
+ throw new WorktreeError('Worktree created but not found in list', WorktreeErrorCode.GIT_ERROR);
65
+ }
66
+ return created;
67
+ }
53
68
  async remove(repoPath, worktreePath, force) {
54
69
  try {
55
70
  const args = ['worktree', 'remove'];
@@ -102,6 +117,30 @@ let WorktreeService = class WorktreeService {
102
117
  return false;
103
118
  }
104
119
  }
120
+ async listBranches(repoPath) {
121
+ try {
122
+ const { stdout } = await this.execFile('git', ['branch', '-a', '--format=%(refname:short)'], {
123
+ cwd: repoPath,
124
+ });
125
+ const seen = new Set();
126
+ const branches = [];
127
+ for (const line of stdout.split('\n')) {
128
+ const trimmed = line.trim();
129
+ if (!trimmed || trimmed === 'origin/HEAD' || trimmed.startsWith('origin/HEAD ->'))
130
+ continue;
131
+ // Strip "origin/" prefix for remote branches
132
+ const name = trimmed.startsWith('origin/') ? trimmed.slice('origin/'.length) : trimmed;
133
+ if (!seen.has(name)) {
134
+ seen.add(name);
135
+ branches.push(name);
136
+ }
137
+ }
138
+ return branches.sort();
139
+ }
140
+ catch {
141
+ return [];
142
+ }
143
+ }
105
144
  async ensureGitRepository(repoPath) {
106
145
  let isExistingRepo = false;
107
146
  try {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Feature Adopt Command
3
+ *
4
+ * Adopts an existing git branch into Shep's feature tracking system.
5
+ * Creates a worktree (if needed), derives metadata from the branch name,
6
+ * and persists a Feature with lifecycle=Maintain (agent inactive).
7
+ *
8
+ * Usage:
9
+ * shep feat adopt <branch>
10
+ * shep feat adopt <branch> -r /path/to/repo
11
+ */
12
+ import { Command } from 'commander';
13
+ export declare function createAdoptCommand(): Command;
14
+ //# sourceMappingURL=adopt.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adopt.command.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/feat/adopt.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,kBAAkB,IAAI,OAAO,CAkC5C"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Feature Adopt Command
3
+ *
4
+ * Adopts an existing git branch into Shep's feature tracking system.
5
+ * Creates a worktree (if needed), derives metadata from the branch name,
6
+ * and persists a Feature with lifecycle=Maintain (agent inactive).
7
+ *
8
+ * Usage:
9
+ * shep feat adopt <branch>
10
+ * shep feat adopt <branch> -r /path/to/repo
11
+ */
12
+ import { Command } from 'commander';
13
+ import { container } from '../../../../../packages/core/src/infrastructure/di/container.js';
14
+ import { AdoptBranchUseCase } from '../../../../../packages/core/src/application/use-cases/features/adopt-branch.use-case.js';
15
+ import { colors, messages, spinner } from '../../ui/index.js';
16
+ export function createAdoptCommand() {
17
+ return new Command('adopt')
18
+ .description('Adopt an existing branch as a tracked feature')
19
+ .argument('<branch>', 'Branch name to adopt')
20
+ .option('-r, --repo <path>', 'Repository path (defaults to cwd)')
21
+ .action(async (branch, options) => {
22
+ try {
23
+ const useCase = container.resolve(AdoptBranchUseCase);
24
+ const { feature } = await spinner('Adopting branch', () => useCase.execute({
25
+ branchName: branch,
26
+ repositoryPath: options.repo ?? process.cwd(),
27
+ }));
28
+ messages.newline();
29
+ messages.success('Branch adopted');
30
+ console.log(` ${colors.muted('ID:')} ${colors.accent(feature.id.slice(0, 8))}`);
31
+ console.log(` ${colors.muted('Name:')} ${feature.name}`);
32
+ console.log(` ${colors.muted('Branch:')} ${colors.accent(feature.branch)}`);
33
+ console.log(` ${colors.muted('Status:')} ${feature.lifecycle}`);
34
+ if (feature.pr) {
35
+ console.log(` ${colors.muted('PR:')} ${colors.accent(feature.pr.url)} (${feature.pr.status})`);
36
+ }
37
+ console.log(` ${colors.muted('Worktree:')} ${colors.accent(feature.worktreePath ?? '')}`);
38
+ messages.newline();
39
+ }
40
+ catch (error) {
41
+ const err = error instanceof Error ? error : new Error(String(error));
42
+ messages.error('Failed to adopt branch', err);
43
+ process.exitCode = 1;
44
+ }
45
+ });
46
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/feat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAa3C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/cli/commands/feat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAc3C"}
@@ -20,6 +20,7 @@ import { createReviewCommand } from './review.command.js';
20
20
  import { createApproveCommand } from './approve.command.js';
21
21
  import { createRejectCommand } from './reject.command.js';
22
22
  import { createLogsCommand } from './logs.command.js';
23
+ import { createAdoptCommand } from './adopt.command.js';
23
24
  /**
24
25
  * Create the feat command group
25
26
  */
@@ -35,5 +36,6 @@ export function createFeatCommand() {
35
36
  .addCommand(createReviewCommand())
36
37
  .addCommand(createApproveCommand())
37
38
  .addCommand(createRejectCommand())
38
- .addCommand(createLogsCommand());
39
+ .addCommand(createLogsCommand())
40
+ .addCommand(createAdoptCommand());
39
41
  }
@@ -0,0 +1,10 @@
1
+ /** Skip static pre-rendering since we need runtime DI container. */
2
+ export declare const dynamic = "force-dynamic";
3
+ interface AdoptDrawerPageProps {
4
+ searchParams: Promise<{
5
+ repo?: string;
6
+ }>;
7
+ }
8
+ export default function AdoptDrawerPage({ searchParams }: AdoptDrawerPageProps): Promise<import("react/jsx-runtime").JSX.Element>;
9
+ export {};
10
+ //# sourceMappingURL=page.d.ts.map