@idea1/cli 1.7.7 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +126 -60
  2. package/dist/cli/named-lists.d.ts.map +1 -1
  3. package/dist/cli/named-lists.js +5 -0
  4. package/dist/cli/named-lists.js.map +1 -1
  5. package/dist/commands/approve-pr.d.ts.map +1 -1
  6. package/dist/commands/approve-pr.js +94 -8
  7. package/dist/commands/approve-pr.js.map +1 -1
  8. package/dist/commands/attach-project-item.d.ts.map +1 -1
  9. package/dist/commands/attach-project-item.js +28 -41
  10. package/dist/commands/attach-project-item.js.map +1 -1
  11. package/dist/commands/close-worktree.d.ts.map +1 -1
  12. package/dist/commands/close-worktree.js +50 -84
  13. package/dist/commands/close-worktree.js.map +1 -1
  14. package/dist/commands/create-worktree.d.ts.map +1 -1
  15. package/dist/commands/create-worktree.js +1 -4
  16. package/dist/commands/create-worktree.js.map +1 -1
  17. package/dist/commands/get-project-item-url.d.ts.map +1 -1
  18. package/dist/commands/get-project-item-url.js +3 -1
  19. package/dist/commands/get-project-item-url.js.map +1 -1
  20. package/dist/commands/help.js +13 -13
  21. package/dist/commands/help.js.map +1 -1
  22. package/dist/commands/index.d.ts +1 -2
  23. package/dist/commands/index.d.ts.map +1 -1
  24. package/dist/commands/index.js +1 -3
  25. package/dist/commands/index.js.map +1 -1
  26. package/dist/commands/join-project-item.d.ts.map +1 -1
  27. package/dist/commands/join-project-item.js +18 -60
  28. package/dist/commands/join-project-item.js.map +1 -1
  29. package/dist/commands/next-workflow-step.d.ts.map +1 -1
  30. package/dist/commands/next-workflow-step.js +16 -22
  31. package/dist/commands/next-workflow-step.js.map +1 -1
  32. package/dist/commands/push.d.ts.map +1 -1
  33. package/dist/commands/push.js +4 -3
  34. package/dist/commands/push.js.map +1 -1
  35. package/dist/commands/ready-for-approval.d.ts.map +1 -1
  36. package/dist/commands/ready-for-approval.js +94 -8
  37. package/dist/commands/ready-for-approval.js.map +1 -1
  38. package/dist/commands/release.d.ts.map +1 -1
  39. package/dist/commands/release.js +4 -15
  40. package/dist/commands/release.js.map +1 -1
  41. package/dist/commands/start-agent-implementation.d.ts.map +1 -1
  42. package/dist/commands/start-agent-implementation.js +10 -13
  43. package/dist/commands/start-agent-implementation.js.map +1 -1
  44. package/dist/commands/start-dev-implementation.d.ts.map +1 -1
  45. package/dist/commands/start-dev-implementation.js +7 -8
  46. package/dist/commands/start-dev-implementation.js.map +1 -1
  47. package/dist/commands/start.d.ts.map +1 -1
  48. package/dist/commands/start.js +21 -15
  49. package/dist/commands/start.js.map +1 -1
  50. package/dist/commands/update-branch.d.ts.map +1 -1
  51. package/dist/commands/update-branch.js +28 -75
  52. package/dist/commands/update-branch.js.map +1 -1
  53. package/dist/interactive.d.ts.map +1 -1
  54. package/dist/interactive.js +11 -23
  55. package/dist/interactive.js.map +1 -1
  56. package/dist/lib/claude-options.d.ts +11 -10
  57. package/dist/lib/claude-options.d.ts.map +1 -1
  58. package/dist/lib/claude-options.js +38 -39
  59. package/dist/lib/claude-options.js.map +1 -1
  60. package/dist/lib/settings.d.ts +23 -27
  61. package/dist/lib/settings.d.ts.map +1 -1
  62. package/dist/lib/settings.js +35 -50
  63. package/dist/lib/settings.js.map +1 -1
  64. package/dist/prompts/platform-prompts.d.ts +30 -0
  65. package/dist/prompts/platform-prompts.d.ts.map +1 -0
  66. package/dist/prompts/platform-prompts.js +38 -0
  67. package/dist/prompts/platform-prompts.js.map +1 -0
  68. package/dist/prompts/project-item-prompts.d.ts +44 -0
  69. package/dist/prompts/project-item-prompts.d.ts.map +1 -0
  70. package/dist/prompts/project-item-prompts.js +41 -0
  71. package/dist/prompts/project-item-prompts.js.map +1 -0
  72. package/dist/services/claude.d.ts +27 -33
  73. package/dist/services/claude.d.ts.map +1 -1
  74. package/dist/services/claude.js +40 -140
  75. package/dist/services/claude.js.map +1 -1
  76. package/dist/services/git.d.ts +24 -121
  77. package/dist/services/git.d.ts.map +1 -1
  78. package/dist/services/git.js +73 -470
  79. package/dist/services/git.js.map +1 -1
  80. package/dist/services/github.d.ts +20 -4
  81. package/dist/services/github.d.ts.map +1 -1
  82. package/dist/services/github.js +77 -6
  83. package/dist/services/github.js.map +1 -1
  84. package/dist/services/platform.d.ts +75 -0
  85. package/dist/services/platform.d.ts.map +1 -0
  86. package/dist/services/platform.js +237 -0
  87. package/dist/services/platform.js.map +1 -0
  88. package/dist/services/setup.d.ts +1 -1
  89. package/dist/services/setup.js +1 -1
  90. package/dist/services/template-renderer.d.ts +10 -0
  91. package/dist/services/template-renderer.d.ts.map +1 -0
  92. package/dist/services/template-renderer.js +20 -0
  93. package/dist/services/template-renderer.js.map +1 -0
  94. package/dist/services/worktree.d.ts +17 -16
  95. package/dist/services/worktree.d.ts.map +1 -1
  96. package/dist/services/worktree.js +41 -65
  97. package/dist/services/worktree.js.map +1 -1
  98. package/dist/types/index.d.ts +14 -58
  99. package/dist/types/index.d.ts.map +1 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/dist/workflow/data/project-item.d.ts +21 -0
  103. package/dist/workflow/data/project-item.d.ts.map +1 -0
  104. package/dist/workflow/data/project-item.js +2 -0
  105. package/dist/workflow/data/project-item.js.map +1 -0
  106. package/dist/workflow/data/workflow-context.d.ts +46 -0
  107. package/dist/workflow/data/workflow-context.d.ts.map +1 -0
  108. package/dist/workflow/data/workflow-context.js +14 -0
  109. package/dist/workflow/data/workflow-context.js.map +1 -0
  110. package/dist/{lib → workflow/data}/workflow-states.d.ts +1 -1
  111. package/dist/workflow/data/workflow-states.d.ts.map +1 -0
  112. package/dist/{lib → workflow/data}/workflow-states.generated.d.ts +1 -1
  113. package/dist/workflow/data/workflow-states.generated.d.ts.map +1 -0
  114. package/dist/{lib → workflow/data}/workflow-states.generated.js +1 -1
  115. package/dist/workflow/data/workflow-states.generated.js.map +1 -0
  116. package/dist/{lib → workflow/data}/workflow-states.js +1 -1
  117. package/dist/workflow/data/workflow-states.js.map +1 -0
  118. package/dist/workflow/engine/approval-flow.d.ts +53 -0
  119. package/dist/workflow/engine/approval-flow.d.ts.map +1 -0
  120. package/dist/workflow/engine/approval-flow.js +111 -0
  121. package/dist/workflow/engine/approval-flow.js.map +1 -0
  122. package/dist/{services → workflow/engine}/branch-setup.d.ts +2 -1
  123. package/dist/workflow/engine/branch-setup.d.ts.map +1 -0
  124. package/dist/{services → workflow/engine}/branch-setup.js +6 -5
  125. package/dist/workflow/engine/branch-setup.js.map +1 -0
  126. package/dist/workflow/engine/handlers/agent-implementation.d.ts +10 -0
  127. package/dist/workflow/engine/handlers/agent-implementation.d.ts.map +1 -0
  128. package/dist/workflow/engine/handlers/agent-implementation.js +42 -0
  129. package/dist/workflow/engine/handlers/agent-implementation.js.map +1 -0
  130. package/dist/{services/workflow-handlers → workflow/engine/handlers}/approve-pr.d.ts +7 -4
  131. package/dist/workflow/engine/handlers/approve-pr.d.ts.map +1 -0
  132. package/dist/workflow/engine/handlers/approve-pr.js +63 -0
  133. package/dist/workflow/engine/handlers/approve-pr.js.map +1 -0
  134. package/dist/{services/workflow-handlers → workflow/engine/handlers}/dev-implementation.d.ts +3 -2
  135. package/dist/workflow/engine/handlers/dev-implementation.d.ts.map +1 -0
  136. package/dist/workflow/engine/handlers/dev-implementation.js +36 -0
  137. package/dist/workflow/engine/handlers/dev-implementation.js.map +1 -0
  138. package/dist/workflow/engine/handlers/index.d.ts +21 -0
  139. package/dist/workflow/engine/handlers/index.d.ts.map +1 -0
  140. package/dist/{services/workflow-handlers → workflow/engine/handlers}/index.js +10 -6
  141. package/dist/workflow/engine/handlers/index.js.map +1 -0
  142. package/dist/workflow/engine/handlers/ready-for-approval.d.ts +11 -0
  143. package/dist/workflow/engine/handlers/ready-for-approval.d.ts.map +1 -0
  144. package/dist/workflow/engine/handlers/ready-for-approval.js +56 -0
  145. package/dist/workflow/engine/handlers/ready-for-approval.js.map +1 -0
  146. package/dist/{services → workflow/engine}/release-flow.d.ts +19 -10
  147. package/dist/workflow/engine/release-flow.d.ts.map +1 -0
  148. package/dist/{services → workflow/engine}/release-flow.js +33 -16
  149. package/dist/workflow/engine/release-flow.js.map +1 -0
  150. package/dist/workflow/engine/workflow-engine.d.ts +162 -0
  151. package/dist/workflow/engine/workflow-engine.d.ts.map +1 -0
  152. package/dist/workflow/engine/workflow-engine.js +405 -0
  153. package/dist/workflow/engine/workflow-engine.js.map +1 -0
  154. package/package.json +2 -1
  155. package/dist/commands/integrate.d.ts +0 -13
  156. package/dist/commands/integrate.d.ts.map +0 -1
  157. package/dist/commands/integrate.js +0 -128
  158. package/dist/commands/integrate.js.map +0 -1
  159. package/dist/lib/workflow-states.d.ts.map +0 -1
  160. package/dist/lib/workflow-states.generated.d.ts.map +0 -1
  161. package/dist/lib/workflow-states.generated.js.map +0 -1
  162. package/dist/lib/workflow-states.js.map +0 -1
  163. package/dist/services/branch-setup.d.ts.map +0 -1
  164. package/dist/services/branch-setup.js.map +0 -1
  165. package/dist/services/context.d.ts +0 -26
  166. package/dist/services/context.d.ts.map +0 -1
  167. package/dist/services/context.js +0 -304
  168. package/dist/services/context.js.map +0 -1
  169. package/dist/services/release-flow.d.ts.map +0 -1
  170. package/dist/services/release-flow.js.map +0 -1
  171. package/dist/services/workflow-engine.d.ts +0 -67
  172. package/dist/services/workflow-engine.d.ts.map +0 -1
  173. package/dist/services/workflow-engine.js +0 -371
  174. package/dist/services/workflow-engine.js.map +0 -1
  175. package/dist/services/workflow-handlers/agent-implementation.d.ts +0 -9
  176. package/dist/services/workflow-handlers/agent-implementation.d.ts.map +0 -1
  177. package/dist/services/workflow-handlers/agent-implementation.js +0 -38
  178. package/dist/services/workflow-handlers/agent-implementation.js.map +0 -1
  179. package/dist/services/workflow-handlers/approve-pr.d.ts.map +0 -1
  180. package/dist/services/workflow-handlers/approve-pr.js +0 -122
  181. package/dist/services/workflow-handlers/approve-pr.js.map +0 -1
  182. package/dist/services/workflow-handlers/dev-implementation.d.ts.map +0 -1
  183. package/dist/services/workflow-handlers/dev-implementation.js +0 -34
  184. package/dist/services/workflow-handlers/dev-implementation.js.map +0 -1
  185. package/dist/services/workflow-handlers/index.d.ts +0 -18
  186. package/dist/services/workflow-handlers/index.d.ts.map +0 -1
  187. package/dist/services/workflow-handlers/index.js.map +0 -1
  188. package/dist/services/workflow-handlers/ready-for-approval.d.ts +0 -10
  189. package/dist/services/workflow-handlers/ready-for-approval.d.ts.map +0 -1
  190. package/dist/services/workflow-handlers/ready-for-approval.js +0 -59
  191. package/dist/services/workflow-handlers/ready-for-approval.js.map +0 -1
  192. package/dist/services/workflow.d.ts +0 -14
  193. package/dist/services/workflow.d.ts.map +0 -1
  194. package/dist/services/workflow.js +0 -37
  195. package/dist/services/workflow.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { WorkflowState } from '../lib/workflow-states.generated.js';
1
+ import type { WorkflowState } from '../workflow/data/workflow-states.js';
2
2
  /**
3
3
  * Unified command option definition following the ops pattern.
4
4
  * Every option can be supplied as a CLI argument or an interactive prompt.
@@ -95,6 +95,13 @@ export interface HookConfig {
95
95
  * A hook can be either a simple string (command) or a full config object
96
96
  */
97
97
  export type Hook = string | HookConfig;
98
+ /**
99
+ * A prompt template: the Handlebars template itself, or the file that holds it
100
+ */
101
+ export type PromptTemplateSetting = string | {
102
+ /** Path of the template file, relative to the repo root */
103
+ templateFile: string;
104
+ };
98
105
  /**
99
106
  * Idea1 settings from .idea1/settings.json, overlaid with .idea1/settings.local.json
100
107
  */
@@ -103,6 +110,10 @@ export interface Idea1Settings {
103
110
  'setup-worktree'?: Hook;
104
111
  'pre-release'?: Hook;
105
112
  };
113
+ prompts?: {
114
+ /** The prompt an Agent Implementation session starts with. */
115
+ agentImplementation?: PromptTemplateSetting;
116
+ };
106
117
  defaults?: {
107
118
  branchPrefix?: string;
108
119
  baseBranch?: string;
@@ -139,10 +150,6 @@ export type ClaudeModel = 'fable' | 'opus' | 'sonnet' | 'haiku';
139
150
  * - 'none': Do not invoke Claude
140
151
  */
141
152
  export type ClaudeEntryPointMode = 'launch' | 'inline' | 'none';
142
- /**
143
- * Development workflow types for branching strategies
144
- */
145
- export type DevWorkflowType = 'independent' | 'integration';
146
153
  /**
147
154
  * Where work on a branch happens.
148
155
  * - 'worktree': a dedicated git worktree in a sibling directory (isolated)
@@ -164,58 +171,7 @@ export interface PrInfo {
164
171
  number: number;
165
172
  url: string;
166
173
  state: string;
167
- }
168
- /**
169
- * Workflow state representing the current status of a project item.
170
- * Generated from shared-config/workflow-states.json.
171
- */
172
- export type { WorkflowState } from '../lib/workflow-states.generated.js';
173
- /**
174
- * Everything a workflow transition operates on: the project item, its branch and
175
- * where (if anywhere) that branch is checked out locally. Built by the workflow
176
- * engine and handed to every state handler.
177
- */
178
- export interface WorkflowContext {
179
- projectItemUrl: string;
180
- /** The item's branch; null until `ensureManaged` has created one. */
181
- branchName: string | null;
182
- /** PR target branch (the integration branch for integration work). */
183
- baseBranch: string;
184
- devWorkflowType: DevWorkflowType;
185
- stackBranch: string | null;
186
- integrationBranch: string | null;
187
- /** The item's current state; null when it has never been started. */
188
- currentState: WorkflowState | null;
189
- /** Local checkout of the branch (worktree or main repo), or null when none exists. */
190
- workingPath: string | null;
191
- /** Set by a handler once the branch has been merged and no longer carries metadata. */
192
- branchRetired: boolean;
193
- /** Resolved command options the handlers read (model, effort, assignee, ...). */
194
- options: Record<string, string>;
195
- }
196
- /**
197
- * Side effects attached to entering a workflow state. `prepare` runs before the
198
- * new state is recorded (it must succeed for the transition to happen);
199
- * `complete` runs after the state has been persisted.
200
- */
201
- export interface WorkflowStateHandler {
202
- state: WorkflowState;
203
- /** Options the handler reads from `WorkflowContext.options`, contributed to the commands that can reach this state. */
204
- options?: CommandOption[];
205
- prepare?: (context: WorkflowContext) => Promise<void>;
206
- complete?: (context: WorkflowContext) => Promise<void>;
207
- }
208
- /**
209
- * Per-branch metadata stored in `.idea1/<sanitized-branch>.json`.
210
- * Committed on the branch so it's discoverable from any clone via `git show`.
211
- */
212
- export interface BranchMetadata {
213
- branchName: string;
214
- projectItemUrl?: string;
215
- baseBranch?: string;
216
- workflowState?: string;
217
- devWorkflowType?: string;
218
- stackBranch?: string;
219
- integrationBranch?: string;
174
+ /** The PR's target branch. Present from `getPrInfo`; absent from `checkPrExists`. */
175
+ baseRefName?: string;
220
176
  }
221
177
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACvC,sGAAsG;IACtG,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC;IAC1D;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sKAAsK;IACtK,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,MAAM,CAAC;IAC3D;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAA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,oBAAoB,GAAG,aAAa,GAAG,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAErH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,WAAW,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.7.7";
1
+ export declare const VERSION = "1.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.js - do not edit manually
2
- export const VERSION = '1.7.7';
2
+ export const VERSION = '1.8.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -0,0 +1,21 @@
1
+ import type { WorkflowContext } from './workflow-context.js';
2
+ /**
3
+ * The summary of a project item, as the platform returns it from every tool that reads an item's
4
+ * summary, looks one up by its branch, or changes its workflow context: the item's core fields and
5
+ * the workflow context it contains. `workflowContext` is null for an item outside workflow
6
+ * management. The item's large content, such as its description, is not part of the summary.
7
+ *
8
+ * Mirrors the platform's `ProjectItemSummaryResponse`.
9
+ */
10
+ export interface ProjectItemSummary {
11
+ url: string;
12
+ externalId: number;
13
+ title: string;
14
+ /** The Epic the item is in; null when it is in none. */
15
+ epicId: string | null;
16
+ completionDate: string | null;
17
+ /** A status the item had outside the workflow states, kept for reference; empty when it had none. */
18
+ legacyWorkflowStatus: string;
19
+ workflowContext: WorkflowContext | null;
20
+ }
21
+ //# sourceMappingURL=project-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-item.d.ts","sourceRoot":"","sources":["../../../src/workflow/data/project-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,qGAAqG;IACrG,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;CACzC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-item.js","sourceRoot":"","sources":["../../../src/workflow/data/project-item.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Whether a branch is worked on its own or as part of an integration branch.
3
+ */
4
+ export type DevWorkflowType = 'independent' | 'integration';
5
+ /**
6
+ * Whether a workflow context's branch is live, and the ways it can be disconnected from one.
7
+ * Serialized as the platform's numeric enum values.
8
+ */
9
+ export declare enum WorkflowBranchState {
10
+ /** The branch exists in the repository and is recorded as the item's. */
11
+ Live = 0,
12
+ /** The branch's pull request merged and the branch was retired; the work has landed. */
13
+ Merged = 1,
14
+ /** The branch was deleted without its pull request merging, or was never recorded. */
15
+ Deleted = 2
16
+ }
17
+ /**
18
+ * A project item's place in the workflow: its workflow status and the git branch that carries its
19
+ * work, as the platform stores it on the item. An item with no context is outside workflow
20
+ * management and has no workflow status. Every context has a branch: putting an item under
21
+ * workflow management creates or records the branch, and the branch's pull request targets
22
+ * `baseBranch`. A context whose branch is no longer live keeps the branch fields as the record of
23
+ * where the work was, and `branchState` says why the branch is not live.
24
+ *
25
+ * Mirrors the platform's `WorkflowContext`.
26
+ */
27
+ export interface WorkflowContext {
28
+ /** The item's workflow state as stored; always a canonical state name. */
29
+ workflowStatus: string;
30
+ /** Where an external coding agent is implementing the item; empty when none is. */
31
+ codingAgentUrl: string;
32
+ /** The pull request carrying the branch's work; empty until one exists. */
33
+ pullRequestUrl: string;
34
+ /** The repository the branch lives in, as `owner/name`. */
35
+ repositoryFullName: string;
36
+ branchName: string;
37
+ /** The branch the pull request targets: the integration branch for integration work. */
38
+ baseBranch: string;
39
+ devWorkflowType: DevWorkflowType;
40
+ /** The branch this one is stacked on; null for a branch cut from its base. */
41
+ stackBranch: string | null;
42
+ /** The integration branch this one belongs to, for integration work. */
43
+ integrationBranch: string | null;
44
+ branchState: WorkflowBranchState;
45
+ }
46
+ //# sourceMappingURL=workflow-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-context.d.ts","sourceRoot":"","sources":["../../../src/workflow/data/workflow-context.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,aAAa,CAAC;AAE5D;;;GAGG;AACH,oBAAY,mBAAmB;IAC7B,yEAAyE;IACzE,IAAI,IAAI;IACR,wFAAwF;IACxF,MAAM,IAAI;IACV,sFAAsF;IACtF,OAAO,IAAI;CACZ;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,cAAc,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,cAAc,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,8EAA8E;IAC9E,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,wEAAwE;IACxE,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,mBAAmB,CAAC;CAClC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Whether a workflow context's branch is live, and the ways it can be disconnected from one.
3
+ * Serialized as the platform's numeric enum values.
4
+ */
5
+ export var WorkflowBranchState;
6
+ (function (WorkflowBranchState) {
7
+ /** The branch exists in the repository and is recorded as the item's. */
8
+ WorkflowBranchState[WorkflowBranchState["Live"] = 0] = "Live";
9
+ /** The branch's pull request merged and the branch was retired; the work has landed. */
10
+ WorkflowBranchState[WorkflowBranchState["Merged"] = 1] = "Merged";
11
+ /** The branch was deleted without its pull request merging, or was never recorded. */
12
+ WorkflowBranchState[WorkflowBranchState["Deleted"] = 2] = "Deleted";
13
+ })(WorkflowBranchState || (WorkflowBranchState = {}));
14
+ //# sourceMappingURL=workflow-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-context.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-context.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAOX;AAPD,WAAY,mBAAmB;IAC7B,yEAAyE;IACzE,6DAAQ,CAAA;IACR,wFAAwF;IACxF,iEAAU,CAAA;IACV,sFAAsF;IACtF,mEAAW,CAAA;AACb,CAAC,EAPW,mBAAmB,KAAnB,mBAAmB,QAO9B"}
@@ -7,7 +7,7 @@ export type { WorkflowState } from './workflow-states.generated.js';
7
7
  export declare const WORKFLOW_STATE_ORDER: readonly WorkflowState[];
8
8
  /**
9
9
  * Normalize a stored workflow state value to a current WorkflowState.
10
- * Accepts current names (case-insensitively, since older metadata files carry
10
+ * Accepts current names (case-insensitively, since stored statuses carry
11
11
  * variants like "Dev implementation"), maps legacy state names to their current
12
12
  * equivalents, and returns null for unrecognized values.
13
13
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-states.d.ts","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAChH,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,aAAa,EAAoB,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAiB3F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,aAAa,GAAG,IAAI,CAStF;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,EAAE,EAAE,EAAE,aAAa,GAAG,aAAa,EAAE,CASvG;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,GAAG,OAAO,CAE1F"}
@@ -14,7 +14,7 @@ export declare const WorkflowStates: {
14
14
  readonly Released: "Released";
15
15
  };
16
16
  /**
17
- * Retired state names still found on older project items and branch metadata, mapped to their
17
+ * Retired state names still found in older workflow data, mapped to their
18
18
  * current equivalents. Keys are lowercase; compare case-insensitively.
19
19
  */
20
20
  export declare const LEGACY_WORKFLOW_STATE_ALIASES: Readonly<Record<string, WorkflowState>>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-states.generated.d.ts","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.generated.ts"],"names":[],"mappings":"AAEA,+CAA+C;AAC/C,eAAO,MAAM,eAAe,gPAUlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,8CAA8C;AAC9C,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAGjF,CAAC"}
@@ -24,7 +24,7 @@ export const WorkflowStates = {
24
24
  Released: 'Released',
25
25
  };
26
26
  /**
27
- * Retired state names still found on older project items and branch metadata, mapped to their
27
+ * Retired state names still found in older workflow data, mapped to their
28
28
  * current equivalents. Keys are lowercase; compare case-insensitively.
29
29
  */
30
30
  export const LEGACY_WORKFLOW_STATE_ALIASES = {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-states.generated.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.generated.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,wBAAwB;IACxB,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;IAChC,sBAAsB;IACtB,oBAAoB;IACpB,4BAA4B;IAC5B,qBAAqB;IACrB,UAAU;CACF,CAAC;AAIX,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,mBAAmB,EAAE,wBAAwB;IAC7C,mBAAmB,EAAE,yBAAyB;IAC9C,wBAAwB,EAAE,6BAA6B;IACvD,2BAA2B,EAAE,gCAAgC;IAC7D,mBAAmB,EAAE,sBAAsB;IAC3C,iBAAiB,EAAE,oBAAoB;IACvC,uBAAuB,EAAE,4BAA4B;IACrD,iBAAiB,EAAE,qBAAqB;IACxC,QAAQ,EAAE,UAAU;CACZ,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAA4C;IACpF,mBAAmB,EAAE,4BAA4B;IACjD,UAAU,EAAE,qBAAqB;CAClC,CAAC"}
@@ -6,7 +6,7 @@ export { WORKFLOW_STATES, WorkflowStates, LEGACY_WORKFLOW_STATE_ALIASES } from '
6
6
  export const WORKFLOW_STATE_ORDER = WORKFLOW_STATES;
7
7
  /**
8
8
  * Normalize a stored workflow state value to a current WorkflowState.
9
- * Accepts current names (case-insensitively, since older metadata files carry
9
+ * Accepts current names (case-insensitively, since stored statuses carry
10
10
  * variants like "Dev implementation"), maps legacy state names to their current
11
11
  * equivalents, and returns null for unrecognized values.
12
12
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-states.js","sourceRoot":"","sources":["../../../src/workflow/data/workflow-states.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,6BAA6B,EAE9B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAGhH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA6B,eAAe,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAA8B;IACnE,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,oBAAoB,CAAC,QAAQ,CAAC,OAAwB,CAAC,EAAE,CAAC;QAC5D,OAAO,OAAwB,CAAC;IAClC,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE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,WAAW,CAAC,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { PrInfo } from '../../types/index.js';
2
+ /**
3
+ * Stage 1 of change management as it applies to a branch and its PR
4
+ * (change-management-policy.md clause 2): the PR gets its assignee - the approver of record -
5
+ * and the assignee approves by merging it once the required CI/CD checks pass. Used by the
6
+ * workflow handlers for a project item's branch and by `ready-for-approval` / `approve-pr` for a
7
+ * branch with no project item (an integration branch, for instance). Nothing here reads or writes
8
+ * the item's workflow context on idea1.ai; that stays with the workflow engine.
9
+ */
10
+ export interface ReadyForApprovalInput {
11
+ branchName: string;
12
+ /** The branch the PR targets. */
13
+ baseBranch: string;
14
+ /** The approver of record. A PR with no assignee has no approver (clause 2). */
15
+ assignee: string;
16
+ /** The raw `--reviewers` value: comma separated, possibly empty. */
17
+ reviewers: string;
18
+ /**
19
+ * Open the PR when the branch has none, with this title. Null on a project item's branch: that
20
+ * PR is created on the way into Dev Implementation, so a missing one is reported, not created.
21
+ */
22
+ createWhenMissing: {
23
+ title: string;
24
+ } | null;
25
+ }
26
+ /**
27
+ * The PR that carries the change, with its assignee and any requested reviewers set. A PR that has
28
+ * to be created gets the approval chain of what the branch carries as its body.
29
+ */
30
+ export declare function ensurePrReadyForApproval(input: ReadyForApprovalInput): Promise<PrInfo>;
31
+ export interface MergeAsApproverInput {
32
+ branchName: string;
33
+ baseBranch: string;
34
+ prNumber: number;
35
+ }
36
+ /**
37
+ * The stage-1 approval: the assignee merges the PR once the required checks pass. There is no
38
+ * admin override here (change-management-policy.md clause 3) - a red or unfinished suite stops it,
39
+ * and the only way past is to fix the build. The caller confirms the approver's identity first.
40
+ */
41
+ export declare function mergeAsApprover(input: MergeAsApproverInput): Promise<void>;
42
+ export interface CleanUpMergedBranchInput {
43
+ branchName: string;
44
+ baseBranch: string;
45
+ /** The branch's local checkout (worktree or main repo), or null when it has none. */
46
+ workingPath: string | null;
47
+ }
48
+ /**
49
+ * After the merge the branch is finished: the remote branch goes, and so do its worktree and local
50
+ * branch, leaving the user on a branch that still exists.
51
+ */
52
+ export declare function cleanUpMergedBranch(input: CleanUpMergedBranchInput): Promise<void>;
53
+ //# sourceMappingURL=approval-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-flow.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/approval-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAQnD;;;;;;;GAOG;AAEH,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,iBAAiB,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC5F;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhF;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCxF"}
@@ -0,0 +1,111 @@
1
+ import { logger } from '../../lib/logger.js';
2
+ import { promptConfirm } from '../../lib/prompt.js';
3
+ import * as git from '../../services/git.js';
4
+ import * as github from '../../services/github.js';
5
+ import { removeCurrentWorktree, resolveBaseBranch } from '../../services/worktree.js';
6
+ import { CHANGE_KIND, createGatedPr } from './release-flow.js';
7
+ /**
8
+ * The PR that carries the change, with its assignee and any requested reviewers set. A PR that has
9
+ * to be created gets the approval chain of what the branch carries as its body.
10
+ */
11
+ export async function ensurePrReadyForApproval(input) {
12
+ const { branchName, baseBranch, assignee } = input;
13
+ let prInfo = await github.checkPrExists(branchName, baseBranch);
14
+ if (prInfo) {
15
+ logger.info(`PR #${prInfo.number} found`);
16
+ }
17
+ else {
18
+ if (!input.createWhenMissing) {
19
+ throw new Error('No PR exists for this branch. Move the item to Dev Implementation first (idea1 next), which creates the PR.');
20
+ }
21
+ await createGatedPr({
22
+ sourceBranch: branchName,
23
+ targetBranch: baseBranch,
24
+ title: input.createWhenMissing.title,
25
+ assignee,
26
+ kind: CHANGE_KIND
27
+ });
28
+ prInfo = await github.checkPrExists(branchName, baseBranch);
29
+ if (!prInfo) {
30
+ throw new Error(`The PR for ${branchName} was created but could not be read back from GitHub.`);
31
+ }
32
+ }
33
+ const reviewers = input.reviewers
34
+ .split(',')
35
+ .map(name => name.trim())
36
+ .filter(name => name.length > 0);
37
+ await github.assignReviewers(branchName, reviewers);
38
+ await github.assignAssignee(branchName, assignee);
39
+ logger.hint(`PR: ${prInfo.url}`);
40
+ return prInfo;
41
+ }
42
+ /**
43
+ * The stage-1 approval: the assignee merges the PR once the required checks pass. There is no
44
+ * admin override here (change-management-policy.md clause 3) - a red or unfinished suite stops it,
45
+ * and the only way past is to fix the build. The caller confirms the approver's identity first.
46
+ */
47
+ export async function mergeAsApprover(input) {
48
+ const { branchName, baseBranch, prNumber } = input;
49
+ const confirmMerge = await promptConfirm(`Approve PR #${prNumber} by merging it (${branchName} -> ${baseBranch})?`, { default: true });
50
+ if (!confirmMerge) {
51
+ throw new Error('Merge cancelled by user');
52
+ }
53
+ const checks = await github.waitForPrChecks(branchName);
54
+ if (!checks.passed) {
55
+ throw new Error('Required checks did not pass, so the PR was not merged. There is no override at this stage ' +
56
+ '(change-management-policy.md clause 3) - fix the build and run idea1 approve-pr again.\n\n' +
57
+ checks.summary);
58
+ }
59
+ const mergeResult = await github.mergePr(branchName);
60
+ if (!mergeResult.success) {
61
+ throw new Error(`Failed to merge PR: ${mergeResult.error}`);
62
+ }
63
+ }
64
+ /**
65
+ * After the merge the branch is finished: the remote branch goes, and so do its worktree and local
66
+ * branch, leaving the user on a branch that still exists.
67
+ */
68
+ export async function cleanUpMergedBranch(input) {
69
+ const { branchName, baseBranch, workingPath } = input;
70
+ await git.fetchLatest();
71
+ if (!workingPath) {
72
+ await github.deleteRemoteBranch(branchName);
73
+ return;
74
+ }
75
+ const isWorktree = await git.isInsideWorktree();
76
+ const mainRepoRoot = await git.getMainRepoRoot();
77
+ // Inside a worktree the base branch cannot be checked out in place, so the
78
+ // worktree is removed regardless of removeWorktreeAtState.
79
+ if (isWorktree) {
80
+ const worktreePath = await removeCurrentWorktree(mainRepoRoot);
81
+ await deleteBranchQuietly(branchName);
82
+ logger.hint(`Worktree removed: ${worktreePath}`);
83
+ logger.hint(`Change to a different folder (e.g. ${mainRepoRoot}) to continue.`);
84
+ return;
85
+ }
86
+ // Switch to the base branch (it may be checked out in another worktree)
87
+ const baseWorktreePath = await git.getWorktreePathForBranch(baseBranch);
88
+ if (baseWorktreePath) {
89
+ logger.step(`Base branch ${baseBranch} is in a worktree at ${baseWorktreePath}, pulling there...`);
90
+ await git.updateBranchToLatest(baseBranch);
91
+ const settingsBaseBranch = await resolveBaseBranch();
92
+ await git.checkoutAndPullBranch(settingsBaseBranch);
93
+ }
94
+ else {
95
+ await git.checkoutAndPullBranch(baseBranch);
96
+ }
97
+ await deleteBranchQuietly(branchName);
98
+ if (baseWorktreePath) {
99
+ logger.hint(`Base branch is in worktree at: ${baseWorktreePath}`);
100
+ }
101
+ }
102
+ async function deleteBranchQuietly(branchName) {
103
+ try {
104
+ await git.deleteBranch(branchName, true);
105
+ }
106
+ catch {
107
+ // The remote branch may already have been deleted automatically after the merge
108
+ logger.dim(`Note: Branch ${branchName} may have been automatically deleted after merge`);
109
+ }
110
+ }
111
+ //# sourceMappingURL=approval-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-flow.js","sourceRoot":"","sources":["../../../src/workflow/engine/approval-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA0B/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,KAA4B;IACzE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEnD,IAAI,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAChE,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,MAAM,QAAQ,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,6GAA6G,CAAC,CAAC;QACjI,CAAC;QACD,MAAM,aAAa,CAAC;YAClB,YAAY,EAAE,UAAU;YACxB,YAAY,EAAE,UAAU;YACxB,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,KAAK;YACpC,QAAQ;YACR,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;QACH,MA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CAAC;QAC3C,MAAM,kBAAkB,GAAG,MAAM,iBAAiB,EAAE,CAAC;QACrD,MAAM,GAAG,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,mBAAmB,CAAC,UAAU,CAAC,CAAC;IACtC,IAAI,gBAAgB,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,kCAAkC,gBAAgB,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,UAAkB;IACnD,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,gFAAgF;QAChF,MAAM,CAAC,GAAG,CAAC,gBAAgB,UAAU,kDAAkD,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { CommandOption, DevWorkflowType } from '../types/index.js';
1
+ import type { CommandOption } from '../../types/index.js';
2
+ import type { DevWorkflowType } from '../data/workflow-context.js';
2
3
  export declare const WORKFLOW_CHOICES: {
3
4
  label: string;
4
5
  value: string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch-setup.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/branch-setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE,eAAO,MAAM,gBAAgB;;;GAG5B,CAAC;AAaF,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,EAyBhD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,eAAe,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oBAAoB,EAAE,0BAA0B,GAAG,IAAI,CAAC;CACzD;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAYnH;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BnE;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAoBtF"}
@@ -1,7 +1,8 @@
1
- import { logger } from '../lib/logger.js';
2
- import { promptInput, promptSelect } from '../lib/prompt.js';
3
- import * as git from './git.js';
4
- import * as worktree from './worktree.js';
1
+ import { logger } from '../../lib/logger.js';
2
+ import { promptInput, promptSelect } from '../../lib/prompt.js';
3
+ import * as git from '../../services/git.js';
4
+ import * as worktree from '../../services/worktree.js';
5
+ import { resolveBranchForItem } from './workflow-engine.js';
5
6
  export const WORKFLOW_CHOICES = [
6
7
  { label: 'Independent Feature', value: 'independent' },
7
8
  { label: 'Work for Integration', value: 'integration' }
@@ -84,7 +85,7 @@ export async function promptForStackBranch() {
84
85
  if (!stackUrl) {
85
86
  throw new Error('Project item URL is required when stacking by URL');
86
87
  }
87
- const stackBranch = await git.resolveBranchFromProjectItemUrl(stackUrl);
88
+ const stackBranch = await resolveBranchForItem(stackUrl);
88
89
  if (!stackBranch) {
89
90
  throw new Error(`No branch found for project item URL: ${stackUrl}. Make sure the project item has been started.`);
90
91
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch-setup.js","sourceRoot":"","sources":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e,GAAG,MAAM,WAAW,CAAC,0CAA0C,CAAC,CAAC;IACtF,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,qBAAqB,GAAG,MAAM,QAAQ,CAAC,0BAA0B,CAAC,eAAe,CAAC,CAAC;IACzF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACjE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type WorkflowStateHandler } from '../workflow-engine.js';
2
+ /**
3
+ * Entering "Agent Implementation": make sure the branch is checked out locally
4
+ * (worktree or main repo, per the isolation mode), then — once the state is
5
+ * recorded — launch Claude to implement the item with the Agent Implementation
6
+ * prompt, rendered against the item's branch context. This is the only
7
+ * transition that starts code-writing automation.
8
+ */
9
+ export declare const agentImplementationHandler: WorkflowStateHandler;
10
+ //# sourceMappingURL=agent-implementation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0C,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE1G;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBAkCxC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { isolationModeOption, resolveIsolationMode } from '../../../lib/isolation.js';
2
+ import { claudeEntryPointOption, claudeEntryPointPromptOptions, claudeSessionOptions, resolveClaudeSessionOptions } from '../../../lib/claude-options.js';
3
+ import { projectItemPromptModel, renderAgentImplementationPrompt } from '../../../prompts/project-item-prompts.js';
4
+ import * as git from '../../../services/git.js';
5
+ import * as worktree from '../../../services/worktree.js';
6
+ import { WorkflowStates } from '../../data/workflow-states.js';
7
+ import { requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
8
+ /**
9
+ * Entering "Agent Implementation": make sure the branch is checked out locally
10
+ * (worktree or main repo, per the isolation mode), then — once the state is
11
+ * recorded — launch Claude to implement the item with the Agent Implementation
12
+ * prompt, rendered against the item's branch context. This is the only
13
+ * transition that starts code-writing automation.
14
+ */
15
+ export const agentImplementationHandler = {
16
+ state: WorkflowStates.AgentImplementation,
17
+ options: [isolationModeOption, ...claudeSessionOptions, claudeEntryPointOption, ...claudeEntryPointPromptOptions],
18
+ async prepare(transition) {
19
+ const { branchName } = requireLiveContext(transition);
20
+ const isolationMode = resolveIsolationMode(transition.options);
21
+ const { workingPath } = await worktree.ensureBranchEnvironment(isolationMode, branchName);
22
+ transition.workingPath = workingPath;
23
+ if ((await git.getRepoRoot()).trim() !== workingPath) {
24
+ process.chdir(workingPath);
25
+ }
26
+ },
27
+ async complete(transition) {
28
+ const context = requireLiveContext(transition);
29
+ const workingPath = requireWorkingPath(transition, 'run the implementation session');
30
+ const { permissionMode, model, effort, claudeEntryPointMode, entryPointPrompt } = resolveClaudeSessionOptions(transition.options);
31
+ const prompt = await renderAgentImplementationPrompt(projectItemPromptModel(transition.projectItemUrl, context, workingPath), entryPointPrompt);
32
+ await worktree.launchClaudeForBranch(workingPath, {
33
+ projectItemUrl: transition.projectItemUrl,
34
+ prompt,
35
+ permissionMode,
36
+ model,
37
+ effort,
38
+ claudeEntryPointMode
39
+ });
40
+ }
41
+ };
42
+ //# sourceMappingURL=agent-implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-implementation.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAC1J,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AACnH,OAAO,KAAK,GAAG,M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C,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC,EACvE,gBAAgB,CACjB,CAAC;QAEF,MAAM,QAAQ,CAAC,qBAAqB,CAAC,WAAW,EAAE;YAChD,cAAc,EAAE,UAAU,CAAC,cAAc;YACzC,MAAM;YACN,cAAc;YACd,KAAK;YACL,MAAM;YACN,oBAAoB;SACrB,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
@@ -1,12 +1,15 @@
1
- import type { WorkflowStateHandler } from '../../types/index.js';
1
+ import { type WorkflowStateHandler } from '../workflow-engine.js';
2
2
  /**
3
3
  * Entering "Approved and Merged": merge the PR. The merge IS the approval - it is performed by
4
4
  * the PR's assignee, and GitHub records it as `merged_by` with a timestamp and merge commit
5
5
  * (change-management-policy.md clause 2, stage 1). The merge waits for the required CI/CD checks
6
6
  * and there is no override at this stage: a red or unfinished suite stops it. A repository with no
7
- * CI/CD configured has no suite to wait for, so its PR merges straight away. Before merging, the
8
- * branch's metadata file is dropped so it does not leak into the target branch; afterwards the
9
- * branch and any worktree are cleaned up.
7
+ * CI/CD configured has no suite to wait for, so its PR merges straight away.
8
+ *
9
+ * The branch is merged as it stands, so the checks waited for are the checks of what merges.
10
+ * Afterwards the branch and any worktree are cleaned up; the platform records the branch as merged
11
+ * when GitHub reports its deletion. A context whose branch is already merged has all the pull
12
+ * request work done, so re-entering this state leaves it as it is.
10
13
  */
11
14
  export declare const approvePrHandler: WorkflowStateHandler;
12
15
  //# sourceMappingURL=approve-pr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/approve-pr.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsC,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEtG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,oBAiD9B,CAAC"}