@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
@@ -0,0 +1,63 @@
1
+ import { logger } from '../../../lib/logger.js';
2
+ import * as git from '../../../services/git.js';
3
+ import * as github from '../../../services/github.js';
4
+ import { WorkflowBranchState } from '../../data/workflow-context.js';
5
+ import { WorkflowStates } from '../../data/workflow-states.js';
6
+ import { cleanUpMergedBranch, mergeAsApprover } from '../approval-flow.js';
7
+ import { confirmApproverIdentity } from '../release-flow.js';
8
+ import { requireContext, requireLiveContext } from '../workflow-engine.js';
9
+ /**
10
+ * Entering "Approved and Merged": merge the PR. The merge IS the approval - it is performed by
11
+ * the PR's assignee, and GitHub records it as `merged_by` with a timestamp and merge commit
12
+ * (change-management-policy.md clause 2, stage 1). The merge waits for the required CI/CD checks
13
+ * and there is no override at this stage: a red or unfinished suite stops it. A repository with no
14
+ * CI/CD configured has no suite to wait for, so its PR merges straight away.
15
+ *
16
+ * The branch is merged as it stands, so the checks waited for are the checks of what merges.
17
+ * Afterwards the branch and any worktree are cleaned up; the platform records the branch as merged
18
+ * when GitHub reports its deletion. A context whose branch is already merged has all the pull
19
+ * request work done, so re-entering this state leaves it as it is.
20
+ */
21
+ export const approvePrHandler = {
22
+ state: WorkflowStates.ApprovedAndMerged,
23
+ async prepare(transition) {
24
+ // The pull request was merged on an earlier pass through this state.
25
+ if (requireContext(transition).branchState === WorkflowBranchState.Merged) {
26
+ logger.dim('The branch\'s PR is already merged; nothing to approve.');
27
+ return;
28
+ }
29
+ const context = requireLiveContext(transition);
30
+ if (transition.workingPath) {
31
+ await git.ensureBranchUpToDate();
32
+ }
33
+ const prInfo = await github.getPrInfo(context.branchName);
34
+ if (!prInfo) {
35
+ throw new Error('No PR found for this branch. Nothing to approve.');
36
+ }
37
+ logger.info(`PR #${prInfo.number} found`);
38
+ context.pullRequestUrl = prInfo.url;
39
+ // Re-entering this state after the item was moved back: the merge already happened.
40
+ if (prInfo.state.toUpperCase() === 'MERGED') {
41
+ logger.dim(`PR #${prInfo.number} is already merged; nothing to approve.`);
42
+ context.branchState = WorkflowBranchState.Merged;
43
+ return;
44
+ }
45
+ await confirmApproverIdentity(context.branchName);
46
+ await mergeAsApprover({ branchName: context.branchName, baseBranch: context.baseBranch, prNumber: prInfo.number });
47
+ context.branchState = WorkflowBranchState.Merged;
48
+ },
49
+ async complete(transition) {
50
+ const context = requireContext(transition);
51
+ await cleanUpMergedBranch({
52
+ branchName: context.branchName,
53
+ baseBranch: context.baseBranch,
54
+ workingPath: transition.workingPath
55
+ });
56
+ logger.newline();
57
+ logger.success('Workflow complete!');
58
+ logger.newline();
59
+ logger.hint(`PR merged into ${context.baseBranch} - the merge is the recorded approval`);
60
+ logger.hint(`Project item: ${transition.projectItemUrl}`);
61
+ }
62
+ };
63
+ //# sourceMappingURL=approve-pr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approve-pr.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/approve-pr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,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AAC;YACjD,OAAO;QACT,CAAC;QAED,MAAM,uBAAuB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,eAAe,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACnH,OAAO,CAAC,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAU;QACvB,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,mBAAmB,CAAC;YACxB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,UAAU,CAAC,WAAW;SACpC,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,UAAU,uCAAuC,CAAC,CAAC;QACzF,MAAM,CAAC,IAAI,CAAC,iBAAiB,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC"}
@@ -1,8 +1,9 @@
1
- import type { WorkflowStateHandler } from '../../types/index.js';
1
+ import { type WorkflowStateHandler } from '../workflow-engine.js';
2
2
  /**
3
3
  * Entering "Dev Implementation": the agent's work is committed and pushed and a
4
4
  * PR exists, so a developer can test, clean up and finish the work. Afterwards
5
- * the worktree is removed when `removeWorktreeAtState` says so.
5
+ * the worktree is removed when `removeWorktreeAtState` says so. Idempotent: an
6
+ * existing PR is reused and a clean branch is pushed as it is.
6
7
  */
7
8
  export declare const devImplementationHandler: WorkflowStateHandler;
8
9
  //# sourceMappingURL=dev-implementation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/dev-implementation.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0C,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE1G;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBA2BtC,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { logger } from '../../../lib/logger.js';
2
+ import * as git from '../../../services/git.js';
3
+ import * as github from '../../../services/github.js';
4
+ import { removeWorktreeForWorkflowState } from '../../../services/worktree.js';
5
+ import { WorkflowStates } from '../../data/workflow-states.js';
6
+ import { requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
7
+ /**
8
+ * Entering "Dev Implementation": the agent's work is committed and pushed and a
9
+ * PR exists, so a developer can test, clean up and finish the work. Afterwards
10
+ * the worktree is removed when `removeWorktreeAtState` says so. Idempotent: an
11
+ * existing PR is reused and a clean branch is pushed as it is.
12
+ */
13
+ export const devImplementationHandler = {
14
+ state: WorkflowStates.DevImplementation,
15
+ async prepare(transition) {
16
+ const context = requireLiveContext(transition);
17
+ requireWorkingPath(transition, 'commit and push the implementation');
18
+ if (await git.hasUncommittedChanges()) {
19
+ await git.commitAllChanges(`Agent Implementation of ${transition.projectItemUrl} on ${context.branchName}`);
20
+ }
21
+ await git.pushToRemote(context.branchName);
22
+ const prInfo = await github.createPrIfNeeded(context.branchName, context.baseBranch, transition.projectItemUrl);
23
+ if (prInfo) {
24
+ context.pullRequestUrl = prInfo.url;
25
+ logger.hint(`PR: ${prInfo.url}`);
26
+ }
27
+ },
28
+ async complete(transition) {
29
+ const { branchName } = requireLiveContext(transition);
30
+ await removeWorktreeForWorkflowState(WorkflowStates.DevImplementation, branchName, transition.projectItemUrl, { checkoutBranchInMainRepo: false });
31
+ logger.newline();
32
+ logger.success('Transitioned to Dev Implementation');
33
+ logger.hint('When ready for review, run: idea1 ready-for-approval [--assignee <username>] [--reviewers <user1,user2>]');
34
+ }
35
+ };
36
+ //# sourceMappingURL=dev-implementation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-implementation.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/dev-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAE1G;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAyB;IAC5D,KAAK,EAAE,cAAc,CAAC,iBAAiB;IAEvC,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,MAAM,OAAO,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC/C,kBAAkB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;QAErE,IAAI,MAAM,GAAG,CAAC,qBAAqB,EAAE,EAAE,CAAC;YACtC,MAAM,GAAG,CAAC,gBAAgB,CAAC,2BAA2B,UAAU,CAAC,cAAc,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAC9G,CAAC;QACD,MAAM,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,CAAC;QAChH,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC;YACpC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAU;QACvB,MAAM,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACtD,MAAM,8BAA8B,CAAC,cAAc,CAAC,iBAAiB,EAAE,UAAU,EAAE,UAAU,CAAC,cAAc,EAAE,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnJ,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC;QACrD,MAAM,CAAC,IAAI,CAAC,0GAA0G,CAAC,CAAC;IAC1H,CAAC;CACF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { CommandOption } from '../../../types/index.js';
2
+ import type { WorkflowState } from '../../data/workflow-states.js';
3
+ import type { WorkflowStateHandler } from '../workflow-engine.js';
4
+ /**
5
+ * Side effects attached to entering a workflow state. States without an entry
6
+ * are status-only: entering them records the state and nothing else.
7
+ */
8
+ export declare const HANDLERS_BY_STATE: ReadonlyMap<WorkflowState, WorkflowStateHandler>;
9
+ /**
10
+ * The handler for a state, for commands dedicated to one transition.
11
+ */
12
+ export declare function getHandler(state: WorkflowState): WorkflowStateHandler;
13
+ /**
14
+ * Every handler option a command does not already declare, for commands that can
15
+ * advance an item through several states (e.g. `next`, or `ready-for-approval`
16
+ * from an early state). The options are declared so they parse on the command
17
+ * line, but marked inapplicable so the resolver never prompts for them up front —
18
+ * the engine prompts for the ones the actual transition needs.
19
+ */
20
+ export declare function deferredHandlerOptions(declaredOptions: CommandOption[]): CommandOption[];
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAMlE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,aAAa,EAAE,oBAAoB,CAG9E,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,oBAAoB,CAMrE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,aAAa,EAAE,GAAG,aAAa,EAAE,CAWxF"}
@@ -19,16 +19,20 @@ export function getHandler(state) {
19
19
  return handler;
20
20
  }
21
21
  /**
22
- * Every handler option, for commands that can reach any state (e.g. `next`).
23
- * The options are declared so they parse on the command line, but marked
24
- * inapplicable so the resolver never prompts for them up front — the engine
25
- * prompts for the ones the actual transition needs.
22
+ * Every handler option a command does not already declare, for commands that can
23
+ * advance an item through several states (e.g. `next`, or `ready-for-approval`
24
+ * from an early state). The options are declared so they parse on the command
25
+ * line, but marked inapplicable so the resolver never prompts for them up front —
26
+ * the engine prompts for the ones the actual transition needs.
26
27
  */
27
- export function deferredHandlerOptions() {
28
+ export function deferredHandlerOptions(declaredOptions) {
29
+ const declared = new Set(declaredOptions.map(option => option.longName));
28
30
  const options = [];
29
31
  for (const handler of HANDLERS_BY_STATE.values()) {
30
32
  for (const option of handler.options ?? []) {
31
- options.push({ ...option, dependsOn: () => false });
33
+ if (!declared.has(option.longName)) {
34
+ options.push({ ...option, dependsOn: () => false });
35
+ }
32
36
  }
33
37
  }
34
38
  return options;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OA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
+ /**
3
+ * Entering "Needs Approval for Release": the PR is complete and gets its assignee - the person
4
+ * who will approve it by merging it with `idea1 approve-pr`. The assignee is required: without
5
+ * one the PR has no approver of record (change-management-policy.md clause 2). Reviewers are
6
+ * optional. From here on the branch stays as it is, so the CI/CD run the approval is gated on is
7
+ * the run on the code exactly as it will merge. Afterwards the worktree is removed when
8
+ * `removeWorktreeAtState` says so (this state is the default).
9
+ */
10
+ export declare const readyForApprovalHandler: WorkflowStateHandler;
11
+ //# sourceMappingURL=ready-for-approval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ready-for-approval.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/ready-for-approval.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEtF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,oBA6CrC,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { logger } from '../../../lib/logger.js';
2
+ import * as git from '../../../services/git.js';
3
+ import { removeWorktreeForWorkflowState } from '../../../services/worktree.js';
4
+ import { WorkflowStates } from '../../data/workflow-states.js';
5
+ import { ensurePrReadyForApproval } from '../approval-flow.js';
6
+ import { requireLiveContext } from '../workflow-engine.js';
7
+ /**
8
+ * Entering "Needs Approval for Release": the PR is complete and gets its assignee - the person
9
+ * who will approve it by merging it with `idea1 approve-pr`. The assignee is required: without
10
+ * one the PR has no approver of record (change-management-policy.md clause 2). Reviewers are
11
+ * optional. From here on the branch stays as it is, so the CI/CD run the approval is gated on is
12
+ * the run on the code exactly as it will merge. Afterwards the worktree is removed when
13
+ * `removeWorktreeAtState` says so (this state is the default).
14
+ */
15
+ export const readyForApprovalHandler = {
16
+ state: WorkflowStates.NeedsApprovalForRelease,
17
+ options: [
18
+ {
19
+ longName: 'assignee',
20
+ shortName: 'a',
21
+ description: 'Who to assign the PR to - The assignee approves the PR by merging it (the approver of record)',
22
+ choices: 'github-members',
23
+ validate: value => value.trim() ? undefined : 'An assignee is required - the assignee is the approver of record'
24
+ },
25
+ {
26
+ longName: 'reviewers',
27
+ shortName: 'r',
28
+ description: 'Who to request a review from - optional, the assignee is the approver (select any number)',
29
+ choices: 'github-members',
30
+ multiSelect: true
31
+ }
32
+ ],
33
+ async prepare(transition) {
34
+ const context = requireLiveContext(transition);
35
+ if (transition.workingPath) {
36
+ await git.ensureBranchUpToDate();
37
+ }
38
+ // The PR was created on the way into Dev Implementation; a missing one is an error.
39
+ const prInfo = await ensurePrReadyForApproval({
40
+ branchName: context.branchName,
41
+ baseBranch: context.baseBranch,
42
+ assignee: transition.options['assignee'],
43
+ reviewers: transition.options['reviewers'] ?? '',
44
+ createWhenMissing: null
45
+ });
46
+ context.pullRequestUrl = prInfo.url;
47
+ },
48
+ async complete(transition) {
49
+ const { branchName } = requireLiveContext(transition);
50
+ await removeWorktreeForWorkflowState(WorkflowStates.NeedsApprovalForRelease, branchName, transition.projectItemUrl, { checkoutBranchInMainRepo: false });
51
+ logger.newline();
52
+ logger.success('PR is ready for approval');
53
+ logger.hint('The assignee approves it by running: idea1 approve-pr (which merges it once the CI/CD suite passes)');
54
+ }
55
+ };
56
+ //# sourceMappingURL=ready-for-approval.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/ready-for-approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAEtF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBA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AC;QAEzJ,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,qGAAqG,CAAC,CAAC;IACrH,CAAC;CACF,CAAC"}
@@ -1,23 +1,32 @@
1
- import type { CommandOption } from '../types/index.js';
1
+ import type { CommandOption } from '../../types/index.js';
2
2
  /**
3
- * The gated-merge sequence shared by `idea1 release` (release branch -> main) and
4
- * `idea1 integrate` (integration branch -> release branch). Both open a PR whose body is the
5
- * approval chain of the changes it carries, both assign it to its approver, and both merge it only
6
- * once the required CI/CD checks have passed - with the one sanctioned admin override
7
- * (change-management-policy.md clause 3) recorded on the PR before any merge happens.
3
+ * The gated PR sequence: a PR whose body is the approval chain of the changes it carries, assigned
4
+ * to its approver, merged only once the required CI/CD checks have passed. `idea1 release`
5
+ * (release branch -> main) runs the whole sequence here, including the one sanctioned admin
6
+ * override (change-management-policy.md clause 3) recorded on the PR before any merge happens.
7
+ * `idea1 ready-for-approval` opens a stage-1 change PR with the same kind of body for a branch
8
+ * that has no project item (see approval-flow.ts).
8
9
  */
9
- /** Which command is running the sequence; shapes the PR body and the override record. */
10
+ /** Which command opened the PR; shapes the PR body and the override record. */
10
11
  export interface GatedPrKind {
11
12
  /** The command as recorded on the PR, e.g. `idea1 release`. */
12
13
  commandName: string;
13
- /** Noun for the PR, e.g. `Release` / `Integration`. */
14
+ /** Noun for the PR, e.g. `Release` / `Change`. */
14
15
  label: string;
16
+ /**
17
+ * Whether the PR's assignee reviews the commits it carries. True for a stage-1 change PR opened
18
+ * by `idea1 ready-for-approval`: a commit pushed straight to the branch IS the change under
19
+ * review, so it is listed neutrally and never refused - this PR is its approval. False for a
20
+ * release, where every change was already approved on its own PR (change-management-policy.md
21
+ * clause 2), so a commit with no pull request is an exception.
22
+ */
23
+ assigneeReviewsCommits: boolean;
15
24
  }
16
25
  export declare const RELEASE_KIND: GatedPrKind;
17
- export declare const INTEGRATION_KIND: GatedPrKind;
26
+ export declare const CHANGE_KIND: GatedPrKind;
18
27
  export type PrMode = 'create' | 'merge';
19
28
  /**
20
- * The `--pr-mode` option both commands share. `create` is the default: the PR is opened and the
29
+ * The `--pr-mode` option of `idea1 release`. `create` is the default: the PR is opened and the
21
30
  * approver merges it in GitHub once the required checks are green - that merge is the approval of
22
31
  * record, exactly as in `merge` mode, where the CLI waits for the checks and merges here.
23
32
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-flow.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/release-flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAO1D;;;;;;;GAOG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAED,eAAO,MAAM,YAAY,EAAE,WAA+F,CAAC;AAC3H,eAAO,MAAM,WAAW,EAAE,WAAwG,CAAC;AAEnI,MAAM,MAAM,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,aAU5B,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,uBAAuB,iEAAiE,CAAC;AAEtG;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,qFACsC,CAAC;AAErF;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C9E;AAED,UAAU,YAAY;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AA4CD,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,OAAO,EAAE,YAA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
@@ -1,12 +1,12 @@
1
- import { logger } from '../lib/logger.js';
2
- import { exec, execOrThrow } from '../lib/shell.js';
3
- import { promptConfirm, promptInput } from '../lib/prompt.js';
4
- import * as git from './git.js';
5
- import * as github from './github.js';
6
- export const RELEASE_KIND = { commandName: 'idea1 release', label: 'Release' };
7
- export const INTEGRATION_KIND = { commandName: 'idea1 integrate', label: 'Integration' };
1
+ import { logger } from '../../lib/logger.js';
2
+ import { exec, execOrThrow } from '../../lib/shell.js';
3
+ import { promptConfirm, promptInput } from '../../lib/prompt.js';
4
+ import * as git from '../../services/git.js';
5
+ import * as github from '../../services/github.js';
6
+ export const RELEASE_KIND = { commandName: 'idea1 release', label: 'Release', assigneeReviewsCommits: false };
7
+ export const CHANGE_KIND = { commandName: 'idea1 ready-for-approval', label: 'Change', assigneeReviewsCommits: true };
8
8
  /**
9
- * The `--pr-mode` option both commands share. `create` is the default: the PR is opened and the
9
+ * The `--pr-mode` option of `idea1 release`. `create` is the default: the PR is opened and the
10
10
  * approver merges it in GitHub once the required checks are green - that merge is the approval of
11
11
  * record, exactly as in `merge` mode, where the CLI waits for the checks and merges here.
12
12
  */
@@ -197,8 +197,9 @@ export async function buildApprovalChain(sourceBranch, targetBranch, kind) {
197
197
  unapprovedCommits.push(commit);
198
198
  }
199
199
  // A release of nothing but the pre-release version bump is a release of release automation:
200
- // there is no unapproved change in it, so there is nothing to refuse.
201
- const exception = prNumbers.size === 0 && unapprovedCommits.length > 0
200
+ // there is no unapproved change in it, so there is nothing to refuse. A change PR is never
201
+ // refused over direct commits: they are what its assignee reviews.
202
+ const exception = !kind.assigneeReviewsCommits && prNumbers.size === 0 && unapprovedCommits.length > 0
202
203
  ? await resolveUnapprovedCommits(unapprovedCommits, sourceBranch, targetBranch, kind)
203
204
  : null;
204
205
  const records = new Map((await github.listMergedPrsInto(sourceBranch)).map(record => [record.number, record]));
@@ -213,7 +214,14 @@ export async function buildApprovalChain(sourceBranch, targetBranch, kind) {
213
214
  lines.push(`No pull request was merged into \`${sourceBranch}\` for the changes below.`);
214
215
  }
215
216
  else {
216
- lines.push('Every pull request below was approved by its assignee, who merged it into', `\`${sourceBranch}\` (change-management-policy.md clause 2, stage 1). This PR is the next gate:`, 'no further review is required, it must pass the required CI/CD checks, and the merge of this', 'PR is its approval - performed by its assignee.', '', '| PR | Title | Author | Merged (UTC) | Approved by |', '|---|---|---|---|---|');
217
+ lines.push('Every pull request below was approved by its assignee, who merged it into', `\`${sourceBranch}\` (change-management-policy.md clause 2, stage 1).`);
218
+ if (kind.assigneeReviewsCommits) {
219
+ lines.push('This PR is the stage-1 gate for everything it carries: its assignee reviews it, it must pass', 'the required CI/CD checks, and the merge of this PR is its approval.');
220
+ }
221
+ else {
222
+ lines.push('This PR is the next gate: no further review is required, it must pass the required CI/CD', 'checks, and the merge of this PR is its approval - performed by its assignee.');
223
+ }
224
+ lines.push('', '| PR | Title | Author | Merged (UTC) | Approved by |', '|---|---|---|---|---|');
217
225
  }
218
226
  let selfApproved = 0;
219
227
  for (const number of sortedNumbers) {
@@ -250,11 +258,20 @@ export async function buildApprovalChain(sourceBranch, targetBranch, kind) {
250
258
  }
251
259
  if (unapprovedCommits.length > 0) {
252
260
  lines.push('');
253
- lines.push('## Direct commits (no pull request)');
254
- lines.push('');
255
- lines.push(`The commits below reached \`${sourceBranch}\` without a pull request, so they were never approved`);
256
- lines.push('at stage 1. Each is an exception under change-management-policy.md clause 2, to be explained');
257
- lines.push('at the quarterly review.');
261
+ if (kind.assigneeReviewsCommits) {
262
+ lines.push('## Commits in this change');
263
+ lines.push('');
264
+ lines.push(`The commits below were pushed to \`${sourceBranch}\`. They are the change this PR asks its assignee to`);
265
+ lines.push('review and approve by merging it, so they are not an exception under change-management-policy.md');
266
+ lines.push('clause 2 - this PR is their stage-1 approval.');
267
+ }
268
+ else {
269
+ lines.push('## Direct commits (no pull request)');
270
+ lines.push('');
271
+ lines.push(`The commits below reached \`${sourceBranch}\` without a pull request, so they were never approved`);
272
+ lines.push('at stage 1. Each is an exception under change-management-policy.md clause 2, to be explained');
273
+ lines.push('at the quarterly review.');
274
+ }
258
275
  lines.push('');
259
276
  lines.push('| Commit | Author | Subject |');
260
277
  lines.push('|---|---|---|');
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-flow.js","sourceRoot":"","sources":["../../../src/workflow/engine/release-flow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,GAAG,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AA2BnD,MAAM,CAAC,MAAM,YAAY,GAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;AAC3H,MAAM,CAAC,MAAM,WAAW,GAAgB,EAAE,WAAW,EAAE,0BAA0B,EAAE,KAAK,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC;AAInI;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,+BAA+B;IAC5C,YAAY,EAAE,QAAQ;IACtB,uBAAuB,EAAE,IAAI;IAC7B,OAAO,EAAE;QACP,EAAE,KAAK,EAAE,iGAAiG,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC7H,EAAE,KAAK,EAAE,gEAAgE,EAAE,KAAK,EAAE,OAAO,EAAE;KAC5F;CACF,CAAC;AAEF,oGAAoG;AACpG,MAAM,CAAC,MAAM,uBAAuB,GAAG,8DAA8D,CAAC;AAEtG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAC5C,kFAAkF,CAAC;A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AAC,OAAO,EAAE,CAAC;QAEjB,MAAM,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;QACnE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,mCAAmC,CAAC,CAAC;QACjE,MAAM,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;QACnE,MAAM,CAAC,IAAI,CAAC,wEAAwE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QACpI,OAAO;IACT,CAAC;IAED,MAAM,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,MAAM,aAAa,CACtC,SAAS,IAAI,KAAK,YAAY,OAAO,YAAY,kCAAkC,EACnF,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;IACF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,wBAAwB,IAAI,oDAAoD,CAAC,CAAC;QAC9F,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;QAC5B,OAAO;IACT,CAAC;IAED,MAAM,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAClC,MAAM,iBAAiB,EAAE,CAAC;QAC1B,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;IAC3D,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,aAAa,YAAY,YAAY,CAAC,CAAC;IACnE,MAAM,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,162 @@
1
+ import type { CommandOption } from '../../types/index.js';
2
+ import type { ProjectItemSummary } from '../data/project-item.js';
3
+ import type { DevWorkflowType, WorkflowContext } from '../data/workflow-context.js';
4
+ import { type WorkflowState } from '../data/workflow-states.js';
5
+ /**
6
+ * The workflow engine: it moves a project item between workflow states and owns every operation on
7
+ * the `WorkflowContext` the item contains in the Idea1 platform, reading the item's summary (its core
8
+ * fields and its context) by item or by branch.
9
+ *
10
+ * A transition is "enter state X": the state's handler runs its `prepare` side effects, the new
11
+ * state is recorded on the item, then the handler's `complete` side effects run. Advancing to a
12
+ * later state enters every state on the way in turn, each prepared, recorded and completed before
13
+ * the next, exactly as advancing one state at a time does; a run that stops part way leaves the
14
+ * item at the last state it entered, and running it again continues from there. Handlers are
15
+ * idempotent, so a transition replayed after the item was moved back finds its work done and
16
+ * leaves it as it is.
17
+ *
18
+ * A command resolves the transition it operates on and, when it changes the item, calls the
19
+ * operation that says so: `advanceAsNeededTo` to move the item on, `reenterState` to run the
20
+ * automation of the state it is already in. Both put the item under workflow management on the way
21
+ * in - an item with no live branch gets one, created on origin and recorded on the platform as the
22
+ * item's - so a command never arranges that for itself and every handler runs on a branch.
23
+ *
24
+ * The workflow changes the item's context; the branch itself carries the work. A branch's PR is
25
+ * therefore gated on a CI/CD run of exactly what merges, and approving merges that run's head.
26
+ *
27
+ * One thing lives locally, and only here: the item URL of each branch is remembered in the clone's
28
+ * git config, so "is this branch under workflow?" and "which item?" are answered instantly for
29
+ * display. The platform is the truth.
30
+ */
31
+ /**
32
+ * One project item moving through the workflow, as the engine and the state handlers see it.
33
+ */
34
+ export interface WorkflowTransition {
35
+ projectItemUrl: string;
36
+ /** The item's workflow context; null for an item outside workflow management, until the transition puts it under. */
37
+ context: WorkflowContext | null;
38
+ /** The item's current state; null when it is outside workflow management. */
39
+ currentState: WorkflowState | null;
40
+ /** Local checkout of the branch (worktree or main repo), or null when none exists. */
41
+ workingPath: string | null;
42
+ /** Resolved command options the handlers read (model, effort, assignee, ...). */
43
+ options: Record<string, string>;
44
+ }
45
+ /**
46
+ * Side effects attached to entering a workflow state. `prepare` runs before the new state is
47
+ * recorded (it must succeed for the transition to happen); `complete` runs after the state has been
48
+ * persisted. Handlers record what they did on the transition's context in memory.
49
+ */
50
+ export interface WorkflowStateHandler {
51
+ state: WorkflowState;
52
+ /** Options the handler reads from `WorkflowTransition.options`, contributed to the commands that can reach this state. */
53
+ options?: CommandOption[];
54
+ prepare?: (transition: WorkflowTransition) => Promise<void>;
55
+ complete?: (transition: WorkflowTransition) => Promise<void>;
56
+ }
57
+ export interface ResolveTransitionInput {
58
+ /** Project item URL; required when the current branch is not the item's branch. */
59
+ projectItemUrl?: string;
60
+ /** Resolved command options, handed to the state handlers. */
61
+ options: Record<string, string>;
62
+ }
63
+ /**
64
+ * Work out which project item and branch a command operates on. Reading only: an item outside
65
+ * workflow management resolves to a transition with no context, and the transition the command
66
+ * goes on to make is what gives it one.
67
+ *
68
+ * On a managed branch (the platform records the current branch as an item's) the branch is the
69
+ * target. Otherwise the item URL is required: its summary is read from the platform and, when its
70
+ * branch is live and checked out somewhere locally, that checkout becomes the working directory.
71
+ */
72
+ export declare function resolveTransition(input: ResolveTransitionInput): Promise<WorkflowTransition>;
73
+ /**
74
+ * Like `resolveTransition`, returning null for a current branch outside workflow management when
75
+ * no item URL was given. For commands that also operate on a branch with no project item
76
+ * (`ready-for-approval`, `approve-pr`).
77
+ */
78
+ export declare function resolveTransitionIfManaged(input: ResolveTransitionInput): Promise<WorkflowTransition | null>;
79
+ /**
80
+ * Move the item to `targetState` one state at a time: each state on the way is entered in order -
81
+ * its handler prepares, the state is recorded on the item, its handler completes - exactly as
82
+ * advancing to each state with its own command would. The options of every handler on the way are
83
+ * asked for before the first state is entered. An item that is not under workflow management yet
84
+ * is put under it first, so advancing an item that has never been started to the first state is
85
+ * what starts it; an item already at or past `targetState` keeps its state and only gains its
86
+ * branch, so advancing again is a no-op and a run that stopped part way continues where it stopped.
87
+ */
88
+ export declare function advanceAsNeededTo(transition: WorkflowTransition, targetState: WorkflowState): Promise<void>;
89
+ /**
90
+ * Run the automation of the state the item is already in, without a transition: the state's
91
+ * handler prepares and completes again, so its working environment is set up and its session
92
+ * starts afresh. The item's status already is this state and stays as it is.
93
+ */
94
+ export declare function reenterState(transition: WorkflowTransition, state: WorkflowState): Promise<void>;
95
+ /**
96
+ * The summary of the project item a branch in this repository implements, with the item's workflow
97
+ * context. Null for a branch outside workflow management. The item URL is remembered locally for
98
+ * the branch.
99
+ */
100
+ export declare function getProjectItemSummaryForBranch(branchName: string): Promise<ProjectItemSummary | null>;
101
+ /**
102
+ * The summary of a project item, with its workflow context: `workflowContext` is null for an item
103
+ * outside workflow management. When the item's live branch is in this repository, the item URL is
104
+ * remembered locally for it.
105
+ */
106
+ export declare function getProjectItemSummary(projectItemUrl: string): Promise<ProjectItemSummary>;
107
+ export interface UpsertProjectItemWorkflowContextInput {
108
+ projectItemUrl: string;
109
+ branchName: string;
110
+ /** The PR target branch: the integration branch for integration work. */
111
+ baseBranch: string;
112
+ devWorkflowType: DevWorkflowType;
113
+ stackBranch: string | null;
114
+ integrationBranch: string | null;
115
+ }
116
+ /**
117
+ * Record a branch of this repository in an item's workflow context as the one implementing the
118
+ * item, putting the item under workflow management when it is not yet. The status is left alone: a
119
+ * new context starts at the first state, an existing one keeps its state. Idempotent for the same
120
+ * branch and item. Returns the item's summary.
121
+ */
122
+ export declare function upsertProjectItemWorkflowContext(input: UpsertProjectItemWorkflowContextInput): Promise<ProjectItemSummary>;
123
+ /**
124
+ * The item URL of a branch as this clone last saw it - instant, and null for a branch this clone
125
+ * has yet to resolve. For display and for deciding whether a platform read is worth making; the
126
+ * platform is the truth (`getProjectItemSummaryForBranch`).
127
+ */
128
+ export declare function getRememberedProjectItemUrl(branchName: string): Promise<string | null>;
129
+ /**
130
+ * The item URL of a branch: remembered locally, else read from the platform. Null for a branch
131
+ * outside workflow management.
132
+ */
133
+ export declare function getProjectItemUrlForBranch(branchName: string): Promise<string | null>;
134
+ /**
135
+ * The live branch of an item in this repository, as this clone remembers it when that branch
136
+ * still exists, else the platform's answer. Null for an item with no live branch here.
137
+ */
138
+ export declare function resolveBranchForItem(projectItemUrl: string): Promise<string | null>;
139
+ /**
140
+ * The current branch and the summary of the project item it implements, for display. A branch this
141
+ * clone has yet to resolve as an item's is reported with a null item straight from the remembered
142
+ * URLs, so the interactive header is instant on ordinary branches; the platform is read for a
143
+ * branch this clone knows as an item's.
144
+ */
145
+ export declare function getProjectItemSummaryForCurrentBranch(): Promise<{
146
+ branch: string;
147
+ item: ProjectItemSummary | null;
148
+ }>;
149
+ /**
150
+ * The item's context, for handlers that record what they did on it; the item is put under
151
+ * workflow management before any handler runs.
152
+ */
153
+ export declare function requireContext(transition: WorkflowTransition): WorkflowContext;
154
+ /**
155
+ * The item's context with its live branch, for handlers that do branch work.
156
+ */
157
+ export declare function requireLiveContext(transition: WorkflowTransition): WorkflowContext;
158
+ /**
159
+ * The local checkout a handler needs, with guidance when there is none.
160
+ */
161
+ export declare function requireWorkingPath(transition: WorkflowTransition, purpose: string): string;
162
+ //# sourceMappingURL=workflow-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-engine.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/workflow-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAOnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEpF,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAIpC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,qHAAqH;IACrH,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,6EAA6E;IAC7E,YAAY,EAAE,aAAa,GAAG,IAAI,CAAC;IACnC,sFAAsF;IACtF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,i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