@idea1/cli 1.8.2 → 1.9.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 (147) hide show
  1. package/README.md +205 -69
  2. package/dist/cli/resolver.d.ts +1 -0
  3. package/dist/cli/resolver.d.ts.map +1 -1
  4. package/dist/cli/resolver.js +5 -0
  5. package/dist/cli/resolver.js.map +1 -1
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +2 -1
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/approve-pr.d.ts.map +1 -1
  10. package/dist/commands/approve-pr.js +24 -41
  11. package/dist/commands/approve-pr.js.map +1 -1
  12. package/dist/commands/attach-project-item.d.ts.map +1 -1
  13. package/dist/commands/attach-project-item.js +27 -7
  14. package/dist/commands/attach-project-item.js.map +1 -1
  15. package/dist/commands/close-worktree.d.ts.map +1 -1
  16. package/dist/commands/close-worktree.js +4 -3
  17. package/dist/commands/close-worktree.js.map +1 -1
  18. package/dist/commands/help.d.ts.map +1 -1
  19. package/dist/commands/help.js +17 -11
  20. package/dist/commands/help.js.map +1 -1
  21. package/dist/commands/index.d.ts +2 -1
  22. package/dist/commands/index.d.ts.map +1 -1
  23. package/dist/commands/index.js +3 -1
  24. package/dist/commands/index.js.map +1 -1
  25. package/dist/commands/integrate.d.ts +13 -0
  26. package/dist/commands/integrate.d.ts.map +1 -0
  27. package/dist/commands/integrate.js +128 -0
  28. package/dist/commands/integrate.js.map +1 -0
  29. package/dist/commands/join-project-item.d.ts.map +1 -1
  30. package/dist/commands/join-project-item.js +22 -48
  31. package/dist/commands/join-project-item.js.map +1 -1
  32. package/dist/commands/next-workflow-step.d.ts.map +1 -1
  33. package/dist/commands/next-workflow-step.js +20 -21
  34. package/dist/commands/next-workflow-step.js.map +1 -1
  35. package/dist/commands/ready-for-approval.d.ts.map +1 -1
  36. package/dist/commands/ready-for-approval.js +27 -19
  37. package/dist/commands/ready-for-approval.js.map +1 -1
  38. package/dist/commands/release.d.ts +6 -0
  39. package/dist/commands/release.d.ts.map +1 -1
  40. package/dist/commands/release.js +189 -25
  41. package/dist/commands/release.js.map +1 -1
  42. package/dist/commands/ship-local-changes.d.ts +8 -0
  43. package/dist/commands/ship-local-changes.d.ts.map +1 -0
  44. package/dist/commands/ship-local-changes.js +34 -0
  45. package/dist/commands/ship-local-changes.js.map +1 -0
  46. package/dist/commands/start-agent-implementation.js +2 -2
  47. package/dist/commands/start-agent-implementation.js.map +1 -1
  48. package/dist/commands/start-dev-implementation.d.ts.map +1 -1
  49. package/dist/commands/start-dev-implementation.js +8 -3
  50. package/dist/commands/start-dev-implementation.js.map +1 -1
  51. package/dist/commands/start-project-item.d.ts +27 -0
  52. package/dist/commands/start-project-item.d.ts.map +1 -0
  53. package/dist/commands/start-project-item.js +325 -0
  54. package/dist/commands/start-project-item.js.map +1 -0
  55. package/dist/commands/start.d.ts +8 -2
  56. package/dist/commands/start.d.ts.map +1 -1
  57. package/dist/commands/start.js +76 -35
  58. package/dist/commands/start.js.map +1 -1
  59. package/dist/index.js +0 -0
  60. package/dist/interactive.d.ts.map +1 -1
  61. package/dist/interactive.js +164 -0
  62. package/dist/interactive.js.map +1 -1
  63. package/dist/jobs/job.d.ts +81 -0
  64. package/dist/jobs/job.d.ts.map +1 -0
  65. package/dist/jobs/job.js +258 -0
  66. package/dist/jobs/job.js.map +1 -0
  67. package/dist/jobs/targets.d.ts +58 -0
  68. package/dist/jobs/targets.d.ts.map +1 -0
  69. package/dist/jobs/targets.js +215 -0
  70. package/dist/jobs/targets.js.map +1 -0
  71. package/dist/lib/claude-options.d.ts +3 -2
  72. package/dist/lib/claude-options.d.ts.map +1 -1
  73. package/dist/lib/claude-options.js +15 -4
  74. package/dist/lib/claude-options.js.map +1 -1
  75. package/dist/lib/logger.d.ts +10 -0
  76. package/dist/lib/logger.d.ts.map +1 -1
  77. package/dist/lib/logger.js +16 -0
  78. package/dist/lib/logger.js.map +1 -1
  79. package/dist/lib/prompt.d.ts +7 -0
  80. package/dist/lib/prompt.d.ts.map +1 -1
  81. package/dist/lib/prompt.js +29 -0
  82. package/dist/lib/prompt.js.map +1 -1
  83. package/dist/lib/settings.d.ts +13 -3
  84. package/dist/lib/settings.d.ts.map +1 -1
  85. package/dist/lib/settings.js +12 -3
  86. package/dist/lib/settings.js.map +1 -1
  87. package/dist/lib/shell.d.ts +2 -1
  88. package/dist/lib/shell.d.ts.map +1 -1
  89. package/dist/lib/shell.js +17 -1
  90. package/dist/lib/shell.js.map +1 -1
  91. package/dist/services/git.d.ts +41 -13
  92. package/dist/services/git.d.ts.map +1 -1
  93. package/dist/services/git.js +85 -46
  94. package/dist/services/git.js.map +1 -1
  95. package/dist/services/github.d.ts +28 -0
  96. package/dist/services/github.d.ts.map +1 -1
  97. package/dist/services/github.js +82 -3
  98. package/dist/services/github.js.map +1 -1
  99. package/dist/services/setup.d.ts +4 -2
  100. package/dist/services/setup.d.ts.map +1 -1
  101. package/dist/services/setup.js +61 -37
  102. package/dist/services/setup.js.map +1 -1
  103. package/dist/services/workflow.d.ts +17 -0
  104. package/dist/services/workflow.d.ts.map +1 -0
  105. package/dist/services/workflow.js +39 -0
  106. package/dist/services/workflow.js.map +1 -0
  107. package/dist/services/worktree.js +1 -1
  108. package/dist/services/worktree.js.map +1 -1
  109. package/dist/types/index.d.ts +25 -24
  110. package/dist/types/index.d.ts.map +1 -1
  111. package/dist/version.d.ts +2 -1
  112. package/dist/version.d.ts.map +1 -1
  113. package/dist/version.js +3 -2
  114. package/dist/version.js.map +1 -1
  115. package/dist/workflow/engine/approval-flow.d.ts +10 -2
  116. package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
  117. package/dist/workflow/engine/approval-flow.js +58 -9
  118. package/dist/workflow/engine/approval-flow.js.map +1 -1
  119. package/dist/workflow/engine/handlers/agent-implementation.d.ts.map +1 -1
  120. package/dist/workflow/engine/handlers/agent-implementation.js +4 -11
  121. package/dist/workflow/engine/handlers/agent-implementation.js.map +1 -1
  122. package/dist/workflow/engine/handlers/approve-pr.d.ts.map +1 -1
  123. package/dist/workflow/engine/handlers/approve-pr.js +9 -3
  124. package/dist/workflow/engine/handlers/approve-pr.js.map +1 -1
  125. package/dist/workflow/engine/handlers/dev-implementation.d.ts +2 -2
  126. package/dist/workflow/engine/handlers/dev-implementation.d.ts.map +1 -1
  127. package/dist/workflow/engine/handlers/dev-implementation.js +13 -7
  128. package/dist/workflow/engine/handlers/dev-implementation.js.map +1 -1
  129. package/dist/workflow/engine/handlers/ready-for-approval.d.ts +5 -0
  130. package/dist/workflow/engine/handlers/ready-for-approval.d.ts.map +1 -1
  131. package/dist/workflow/engine/handlers/ready-for-approval.js +11 -7
  132. package/dist/workflow/engine/handlers/ready-for-approval.js.map +1 -1
  133. package/dist/workflow/engine/{release-flow.d.ts → release-engine.d.ts} +83 -6
  134. package/dist/workflow/engine/release-engine.d.ts.map +1 -0
  135. package/dist/workflow/engine/{release-flow.js → release-engine.js} +291 -19
  136. package/dist/workflow/engine/release-engine.js.map +1 -0
  137. package/dist/workflow/engine/ship-flow.d.ts +87 -0
  138. package/dist/workflow/engine/ship-flow.d.ts.map +1 -0
  139. package/dist/workflow/engine/ship-flow.js +221 -0
  140. package/dist/workflow/engine/ship-flow.js.map +1 -0
  141. package/dist/workflow/engine/workflow-engine.d.ts +85 -15
  142. package/dist/workflow/engine/workflow-engine.d.ts.map +1 -1
  143. package/dist/workflow/engine/workflow-engine.js +195 -66
  144. package/dist/workflow/engine/workflow-engine.js.map +1 -1
  145. package/package.json +3 -3
  146. package/dist/workflow/engine/release-flow.d.ts.map +0 -1
  147. package/dist/workflow/engine/release-flow.js.map +0 -1
@@ -1,11 +1,10 @@
1
- import { isolationModeOption, resolveIsolationMode } from '../../../lib/isolation.js';
1
+ import { isolationModeOption } from '../../../lib/isolation.js';
2
2
  import { claudeEntryPointOption, claudeEntryPointPromptOptions, claudeSessionOptions, resolveClaudeSessionOptions } from '../../../lib/claude-options.js';
3
3
  import { projectItemPromptModel, renderAgentImplementationPrompt } from '../../../prompts/project-item-prompts.js';
4
- import * as git from '../../../services/git.js';
5
4
  import * as worktree from '../../../services/worktree.js';
6
5
  import { WorkflowStates } from '../../data/workflow-states.js';
7
6
  import { logger } from '../../../lib/logger.js';
8
- import { isWorkMerged, requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
7
+ import { ensureWorkingPath, isWorkMerged, requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
9
8
  /**
10
9
  * Entering "Agent Implementation": make sure the branch is checked out locally
11
10
  * (worktree or main repo, per the isolation mode), then — once the state is
@@ -16,19 +15,13 @@ import { isWorkMerged, requireLiveContext, requireWorkingPath } from '../workflo
16
15
  */
17
16
  export const agentImplementationHandler = {
18
17
  state: WorkflowStates.AgentImplementation,
19
- options: [isolationModeOption, ...claudeSessionOptions, claudeEntryPointOption, ...claudeEntryPointPromptOptions],
18
+ options: [isolationModeOption, claudeEntryPointOption, ...claudeSessionOptions, ...claudeEntryPointPromptOptions],
20
19
  async prepare(transition) {
21
20
  if (isWorkMerged(transition)) {
22
21
  logger.dim('The item\'s work is already merged; nothing to do.');
23
22
  return;
24
23
  }
25
- const { branchName } = requireLiveContext(transition);
26
- const isolationMode = resolveIsolationMode(transition.options);
27
- const { workingPath } = await worktree.ensureBranchEnvironment(isolationMode, branchName);
28
- transition.workingPath = workingPath;
29
- if ((await git.getRepoRoot()).trim() !== workingPath) {
30
- process.chdir(workingPath);
31
- }
24
+ await ensureWorkingPath(transition);
32
25
  },
33
26
  async complete(transition) {
34
27
  if (isWorkMerged(transition)) {
@@ -1 +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,CA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AC7B,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,WAAW,GAAG,kBAAkB,CAAC,UAAU,EAAE,gCAAgC,CAAC,CAAC;QACrF,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,GAAG,2BAA2B,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClI,MAAM,MAAM,GAAG,MAAM,+BAA+B,CAClD,sBAAsB,CAAC,UAAU,CAAC,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
+ {"version":3,"file":"agent-implementation.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/agent-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,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,QAAQ,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAE3I;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC9D,KAAK,EA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BAAgB,EAAE,oBAiD9B,CAAC"}
1
+ {"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/approve-pr.ts"],"names":[],"mappings":"AAOA,OAAO,EAAoD,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEpH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,oBAuD9B,CAAC"}
@@ -3,8 +3,8 @@ import * as git from '../../../services/git.js';
3
3
  import * as github from '../../../services/github.js';
4
4
  import { WorkflowBranchState } from '../../data/workflow-context.js';
5
5
  import { WorkflowStates } from '../../data/workflow-states.js';
6
- import { cleanUpMergedBranch, mergeAsApprover } from '../approval-flow.js';
7
- import { confirmApproverIdentity } from '../release-flow.js';
6
+ import { cleanUpMergedBranch, mergeAsApprover, mergeConfirmationOption } from '../approval-flow.js';
7
+ import { confirmApproverIdentity } from '../release-engine.js';
8
8
  import { isWorkMerged, requireContext, requireLiveContext } from '../workflow-engine.js';
9
9
  /**
10
10
  * Entering "Approved and Merged": merge the PR. The merge IS the approval - it is performed by
@@ -20,6 +20,7 @@ import { isWorkMerged, requireContext, requireLiveContext } from '../workflow-en
20
20
  */
21
21
  export const approvePrHandler = {
22
22
  state: WorkflowStates.ApprovedAndMerged,
23
+ options: [mergeConfirmationOption],
23
24
  async prepare(transition) {
24
25
  // The pull request was merged on an earlier pass through this state.
25
26
  if (isWorkMerged(transition)) {
@@ -43,7 +44,12 @@ export const approvePrHandler = {
43
44
  return;
44
45
  }
45
46
  await confirmApproverIdentity(context.branchName);
46
- await mergeAsApprover({ branchName: context.branchName, baseBranch: context.baseBranch, prNumber: prInfo.number });
47
+ await mergeAsApprover({
48
+ branchName: context.branchName,
49
+ baseBranch: context.baseBranch,
50
+ prNumber: prInfo.number,
51
+ confirmed: transition.options[mergeConfirmationOption.longName] === 'true'
52
+ });
47
53
  context.branchState = WorkflowBranchState.Merged;
48
54
  },
49
55
  async complete(transition) {
@@ -1 +1 @@
1
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,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,MAAM,yCAAyC,CAAC,CAAC;YAC1E,OAAO,CAAC,WAAW,GAAG,mBAAmB,CAAC,MAAM,CAAC;YACjD,OAAO;QACT,CAAC;QAED,MAAM,uBAAuB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,eAAe,CAAC;YACpB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM;YACvB,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,MAAM;SAC3E,CAAC,CAAC;QACH,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,7 +1,7 @@
1
1
  import { type WorkflowStateHandler } from '../workflow-engine.js';
2
2
  /**
3
- * Entering "Dev Implementation": the agent's work is committed and pushed and a
4
- * PR exists, so a developer can test, clean up and finish the work. Afterwards
3
+ * Entering "Dev Implementation": the agent's work is committed and pushed (from
4
+ * the branch's checkout, when it has one here) and a PR exists, so a developer can test, clean up and finish the work. Afterwards
5
5
  * the worktree is removed when `removeWorktreeAtState` says so. Idempotent: an
6
6
  * existing PR is reused, a clean branch is pushed as it is, and work that is
7
7
  * already merged is left as it is.
@@ -1 +1 @@
1
- {"version":3,"file":"dev-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/dev-implementation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwD,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAExH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBAoCtC,CAAC"}
1
+ {"version":3,"file":"dev-implementation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/dev-implementation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoC,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEpG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBAyCtC,CAAC"}
@@ -3,10 +3,10 @@ import * as git from '../../../services/git.js';
3
3
  import * as github from '../../../services/github.js';
4
4
  import { removeWorktreeForWorkflowState } from '../../../services/worktree.js';
5
5
  import { WorkflowStates } from '../../data/workflow-states.js';
6
- import { isWorkMerged, requireLiveContext, requireWorkingPath } from '../workflow-engine.js';
6
+ import { isWorkMerged, requireLiveContext } from '../workflow-engine.js';
7
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
8
+ * Entering "Dev Implementation": the agent's work is committed and pushed (from
9
+ * the branch's checkout, when it has one here) and a PR exists, so a developer can test, clean up and finish the work. Afterwards
10
10
  * the worktree is removed when `removeWorktreeAtState` says so. Idempotent: an
11
11
  * existing PR is reused, a clean branch is pushed as it is, and work that is
12
12
  * already merged is left as it is.
@@ -19,11 +19,17 @@ export const devImplementationHandler = {
19
19
  return;
20
20
  }
21
21
  const context = requireLiveContext(transition);
22
- requireWorkingPath(transition, 'commit and push the implementation');
23
- if (await git.hasUncommittedChanges()) {
24
- await git.commitAllChanges(`Agent Implementation of ${transition.projectItemUrl} on ${context.branchName}`);
22
+ // Work done in the branch's checkout is committed and pushed from there; a branch with no
23
+ // checkout here carries its work on origin already.
24
+ if (transition.workingPath) {
25
+ if (await git.hasUncommittedChanges()) {
26
+ await git.commitAllChanges(`Agent Implementation of ${transition.projectItemUrl} on ${context.branchName}`);
27
+ }
28
+ await git.pushToRemote(context.branchName);
29
+ }
30
+ else {
31
+ logger.dim(`${context.branchName} has no local checkout; its work is on origin.`);
25
32
  }
26
- await git.pushToRemote(context.branchName);
27
33
  const prInfo = await github.createPrIfNeeded(context.branchName, context.baseBranch, transition.projectItemUrl);
28
34
  if (prInfo) {
29
35
  context.pullRequestUrl = prInfo.url;
@@ -1 +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,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAExH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAyB;IAC5D,KAAK,EAAE,cAAc,CAAC,iBAAiB;IAEvC,KAAK,CAAC,OAAO,CAAC,UAAU;QACtB,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;YACjE,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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,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,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"}
@@ -1,4 +1,9 @@
1
+ import type { CommandOption } from '../../../types/index.js';
1
2
  import { type WorkflowStateHandler } from '../workflow-engine.js';
3
+ /**
4
+ * Reviewers requested on the PR. Optional: the assignee is the approver.
5
+ */
6
+ export declare const reviewersOption: CommandOption;
2
7
  /**
3
8
  * Entering "Needs Approval for Release": the PR is complete and gets its assignee - the person
4
9
  * who will approve it by merging it with `idea1 approve-pr`. The assignee is required: without
@@ -1 +1 @@
1
- {"version":3,"file":"ready-for-approval.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/ready-for-approval.ts"],"names":[],"mappings":"AAKA,OAAO,EAAoC,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEpG;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,oBAsDrC,CAAC"}
1
+ {"version":3,"file":"ready-for-approval.d.ts","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/ready-for-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D,OAAO,EAAoC,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEpG;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,aAM7B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,oBAgDrC,CAAC"}
@@ -4,6 +4,16 @@ import { removeWorktreeForWorkflowState } from '../../../services/worktree.js';
4
4
  import { WorkflowStates } from '../../data/workflow-states.js';
5
5
  import { ensurePrReadyForApproval } from '../approval-flow.js';
6
6
  import { isWorkMerged, requireLiveContext } from '../workflow-engine.js';
7
+ /**
8
+ * Reviewers requested on the PR. Optional: the assignee is the approver.
9
+ */
10
+ export const reviewersOption = {
11
+ longName: 'reviewers',
12
+ shortName: 'r',
13
+ description: 'Who to request a review from - optional, the assignee is the approver (select any number)',
14
+ choices: 'github-members',
15
+ multiSelect: true
16
+ };
7
17
  /**
8
18
  * Entering "Needs Approval for Release": the PR is complete and gets its assignee - the person
9
19
  * who will approve it by merging it with `idea1 approve-pr`. The assignee is required: without
@@ -23,13 +33,7 @@ export const readyForApprovalHandler = {
23
33
  choices: 'github-members',
24
34
  validate: value => value.trim() ? undefined : 'An assignee is required - the assignee is the approver of record'
25
35
  },
26
- {
27
- longName: 'reviewers',
28
- shortName: 'r',
29
- description: 'Who to request a review from - optional, the assignee is the approver (select any number)',
30
- choices: 'github-members',
31
- multiSelect: true
32
- }
36
+ reviewersOption
33
37
  ],
34
38
  async prepare(transition) {
35
39
  if (isWorkMerged(transition)) {
@@ -1 +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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I,EAAE;YAChD,iBAAiB,EAAE,IAAI;SACxB,CAAC,CAAC;QACH,OAAO,CAAC,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAU;QACvB,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,MAAM,EAAE,UAAU,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACtD,MAAM,8BAA8B,CAAC,cAAc,CAAC,uBAAuB,EAAE,UAAU,EAAE,UAAU,CAAC,cAAc,EAAE,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC,CAAC;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
+ {"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../../../src/workflow/engine/handlers/ready-for-approval.ts"],"names":[],"mappings":"AACA,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,YAAY,EAAE,kBAAkB,EAA6B,MAAM,uBAAuB,CAAC;AAEpG;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB;IAC5C,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,GAAG;IACd,WAAW,EAAE,2FAA2F;IACxG,OAAO,EAAE,gBAAgB;IACzB,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,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E,UAAU,EAAE,UAAU,CAAC,cAAc,EAAE,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC,CAAC;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,11 +1,23 @@
1
- import type { CommandOption } from '../../types/index.js';
1
+ import type { CommandOption, VersionedPackage } from '../../types/index.js';
2
2
  /**
3
- * The gated PR sequence: a PR whose body is the approval chain of the changes it carries, assigned
3
+ * The release engine: the gated PR sequence, a PR whose body is the approval chain of the changes it carries, assigned
4
4
  * to its approver, merged only once the required CI/CD checks have passed. `idea1 release`
5
5
  * (release branch -> main) runs the whole sequence here, including the one sanctioned admin
6
6
  * override (change-management-policy.md clause 3) recorded on the PR before any merge happens.
7
7
  * `idea1 ready-for-approval` opens a stage-1 change PR with the same kind of body for a branch
8
8
  * that has no project item (see approval-flow.ts).
9
+ *
10
+ * A release's version bumps land on the release branch before its PR is opened, so the PR's head,
11
+ * and the one CI/CD run the release is gated on, already carry them. The packages that changed since
12
+ * the last release are detected here, and this engine makes the bump itself: it edits each package's
13
+ * `package.json` and the lockfiles above it in the local checkout, commits the edit as one
14
+ * `chore: bump ...` commit, and pushes it. The repository only declares which folders are candidates
15
+ * (`release.versionedPackages` in `.idea1/settings.json`); no script or workflow is involved.
16
+ *
17
+ * The platform's `ReleaseEngine` (backend-core/applicationlayer/workflow) runs the same release
18
+ * sequence from the web app and writes the same PR and the same bump commit, by making the same edits
19
+ * to the same files and committing them through the GitHub API instead of a local checkout, so a
20
+ * release cut on either side reads the same. Keep the two in step.
9
21
  */
10
22
  /** Which command opened the PR; shapes the PR body and the override record. */
11
23
  export interface GatedPrKind {
@@ -28,7 +40,8 @@ export type PrMode = 'create' | 'merge';
28
40
  /**
29
41
  * The `--pr-mode` option of `idea1 release`. `create` is the default: the PR is opened and the
30
42
  * approver merges it in GitHub once the required checks are green - that merge is the approval of
31
- * record, exactly as in `merge` mode, where the CLI waits for the checks and merges here.
43
+ * record, exactly as in `merge` mode, where the CLI turns on GitHub's auto-merge on the approver's
44
+ * behalf (or, where GitHub can't auto-merge, waits for the checks and merges here).
32
45
  */
33
46
  export declare const PR_MODE_OPTION: CommandOption;
34
47
  /** The first line of the comment that records an admin override; the evidence script keys on it. */
@@ -40,11 +53,50 @@ export declare const OVERRIDE_COMMENT_MARKER = "**Change-management exception: m
40
53
  * the two separately.
41
54
  */
42
55
  export declare const UNAPPROVED_COMMITS_COMMENT_MARKER = "**Change-management exception: released with commits that had no pull request.**";
56
+ /**
57
+ * The first line of the comment that records a release approved in the Idea1 web app. A web merge,
58
+ * or a web-enabled auto-merge, is performed by the Idea1 GitHub App, so GitHub records the app as
59
+ * `merged_by`; the platform posts this comment, naming the approver, before the merge happens, and
60
+ * the evidence script keys on it to attribute the merge to that approver.
61
+ */
62
+ export declare const RELEASE_APPROVAL_COMMENT_MARKER = "**Change-management approval: release approved in Idea1.**";
43
63
  /**
44
64
  * The local checkout must be the source branch, clean, fully pushed and level with origin, so the
45
65
  * PR carries exactly what the person running the command is looking at.
46
66
  */
47
67
  export declare function validateSourceBranch(sourceBranch: string): Promise<void>;
68
+ export type VersionBumpType = 'patch' | 'minor' | 'major';
69
+ export declare const VERSION_BUMP_TYPES: readonly VersionBumpType[];
70
+ /** A versioned package that changed in the release without its version being bumped yet. */
71
+ export interface PendingVersionBump extends VersionedPackage {
72
+ currentVersion: string;
73
+ }
74
+ /**
75
+ * The versioned packages the release still has to bump, read from origin's branches as last
76
+ * fetched. A package needs a bump when its folder changed between the target and the release
77
+ * branch and its package.json version is still the same on both - a version that already differs
78
+ * was bumped for this release, so re-running a release never bumps twice. The Idea1 web app applies
79
+ * the same rule.
80
+ *
81
+ * `incomingBranches` are branches about to merge into the release branch before it is released:
82
+ * a package they change is counted as changed, so a release that approves them first can ask for
83
+ * every bump it will need before any of them merges.
84
+ */
85
+ export declare function detectPendingVersionBumps(packages: readonly VersionedPackage[], releaseBranch: string, targetBranch: string, incomingBranches: readonly string[]): Promise<PendingVersionBump[]>;
86
+ export interface CommitVersionBumpsOptions {
87
+ /** The release branch, which must be the checked-out branch. */
88
+ releaseBranch: string;
89
+ /** The packages that need a bump, as `detectPendingVersionBumps` returned them. */
90
+ pending: readonly PendingVersionBump[];
91
+ /** Bump type per package name; every pending package needs one. */
92
+ bumps: Record<string, VersionBumpType>;
93
+ }
94
+ /**
95
+ * Bump the versions of the pending packages in one commit on the release branch and push it, so
96
+ * the release PR opens against a branch that already carries them. The commit is `chore: bump
97
+ * <package> <version>, ...` and is made as whoever runs the command.
98
+ */
99
+ export declare function commitVersionBumps(options: CommitVersionBumpsOptions): Promise<void>;
48
100
  interface BranchCommit {
49
101
  sha: string;
50
102
  author: string;
@@ -101,20 +153,45 @@ export declare function confirmApproverIdentity(branchName: string): Promise<voi
101
153
  * comment cannot be posted, nothing is merged.
102
154
  */
103
155
  export declare function mergeWithCheckGate(branchName: string, kind: GatedPrKind): Promise<void>;
156
+ /** What `enableAutoMergeOrPoll` left the PR as. */
157
+ export type AutoMergeOutcome = 'auto-merge-enabled' | 'merged';
158
+ /**
159
+ * Merge the PR the way that records the person running this as `merged_by`, without them having to
160
+ * wait: GitHub's auto-merge, which merges once the required checks pass. Where GitHub can't
161
+ * auto-merge (the PR is already mergeable, or the repository doesn't allow auto-merge), it falls
162
+ * back to waiting for the checks here and merging (`mergeWithCheckGate`, with its admin-override
163
+ * path). Any other refusal throws.
164
+ */
165
+ export declare function enableAutoMergeOrPoll(branchName: string, kind: GatedPrKind): Promise<AutoMergeOutcome>;
104
166
  export interface RunPrModeOptions {
105
167
  mode: PrMode;
106
168
  sourceBranch: string;
107
169
  targetBranch: string;
108
170
  prUrl: string;
109
171
  kind: GatedPrKind;
110
- /** Open the Actions page after the merge - the merge to main triggers the production deploy. */
172
+ /**
173
+ * Open the Actions page after a merge made here - the merge to main triggers the production
174
+ * deploy. An auto-merge GitHub performs later opens nothing.
175
+ */
111
176
  openActionsAfterMerge: boolean;
177
+ /** The approver already said to merge (`--yes`), so the merge is not confirmed again. */
178
+ confirmed: boolean;
112
179
  }
113
180
  /**
114
181
  * Finish the sequence in the chosen mode. Either way the merge is the approval of record: in
115
182
  * `create` mode the approver performs it in GitHub once the checks are green; in `merge` mode the
116
- * CLI waits for the checks and performs it here, as the approver.
183
+ * CLI turns on GitHub's auto-merge as the approver, so GitHub merges once the checks pass and
184
+ * records the approver as the merger - or, where GitHub can't auto-merge, waits for the checks and
185
+ * merges here.
117
186
  */
118
187
  export declare function runPrMode(options: RunPrModeOptions): Promise<void>;
188
+ /**
189
+ * `idea1 release --approve`: approve and merge the open release PR from the source branch into the
190
+ * target, as its approver. With every check passed it merges now; with checks still running it
191
+ * turns on auto-merge (or waits and merges where GitHub can't auto-merge); with a failed check it
192
+ * goes to the gate's admin-override path, which refuses unless the override is confirmed, reasoned
193
+ * and recorded.
194
+ */
195
+ export declare function approveRelease(sourceBranch: string, targetBranch: string): Promise<void>;
119
196
  export {};
120
- //# sourceMappingURL=release-flow.d.ts.map
197
+ //# sourceMappingURL=release-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-engine.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/release-engine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ5E;;;;;;;;;;;;;;;;;;;GAmBG;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;AAE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