@idea1/cli 1.8.3 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +121 -59
  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 +20 -37
  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 +2 -5
  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 +9 -5
  20. package/dist/commands/help.js.map +1 -1
  21. package/dist/commands/join-project-item.d.ts.map +1 -1
  22. package/dist/commands/join-project-item.js +22 -48
  23. package/dist/commands/join-project-item.js.map +1 -1
  24. package/dist/commands/next-workflow-step.d.ts.map +1 -1
  25. package/dist/commands/next-workflow-step.js +22 -23
  26. package/dist/commands/next-workflow-step.js.map +1 -1
  27. package/dist/commands/ready-for-approval.d.ts.map +1 -1
  28. package/dist/commands/ready-for-approval.js +26 -18
  29. package/dist/commands/ready-for-approval.js.map +1 -1
  30. package/dist/commands/release.d.ts +3 -1
  31. package/dist/commands/release.d.ts.map +1 -1
  32. package/dist/commands/release.js +98 -19
  33. package/dist/commands/release.js.map +1 -1
  34. package/dist/commands/ship-local-changes.d.ts.map +1 -1
  35. package/dist/commands/ship-local-changes.js +4 -3
  36. package/dist/commands/ship-local-changes.js.map +1 -1
  37. package/dist/commands/start-agent-implementation.js +2 -2
  38. package/dist/commands/start-agent-implementation.js.map +1 -1
  39. package/dist/commands/start-dev-implementation.d.ts.map +1 -1
  40. package/dist/commands/start-dev-implementation.js +8 -3
  41. package/dist/commands/start-dev-implementation.js.map +1 -1
  42. package/dist/commands/start.d.ts +2 -2
  43. package/dist/commands/start.d.ts.map +1 -1
  44. package/dist/commands/start.js +27 -21
  45. package/dist/commands/start.js.map +1 -1
  46. package/dist/index.js +0 -0
  47. package/dist/interactive.d.ts.map +1 -1
  48. package/dist/interactive.js +164 -0
  49. package/dist/interactive.js.map +1 -1
  50. package/dist/jobs/job.d.ts +81 -0
  51. package/dist/jobs/job.d.ts.map +1 -0
  52. package/dist/jobs/job.js +258 -0
  53. package/dist/jobs/job.js.map +1 -0
  54. package/dist/jobs/targets.d.ts +58 -0
  55. package/dist/jobs/targets.d.ts.map +1 -0
  56. package/dist/jobs/targets.js +215 -0
  57. package/dist/jobs/targets.js.map +1 -0
  58. package/dist/lib/logger.d.ts +10 -0
  59. package/dist/lib/logger.d.ts.map +1 -1
  60. package/dist/lib/logger.js +16 -0
  61. package/dist/lib/logger.js.map +1 -1
  62. package/dist/lib/prompt.d.ts +7 -0
  63. package/dist/lib/prompt.d.ts.map +1 -1
  64. package/dist/lib/prompt.js +29 -0
  65. package/dist/lib/prompt.js.map +1 -1
  66. package/dist/lib/shell.d.ts +2 -1
  67. package/dist/lib/shell.d.ts.map +1 -1
  68. package/dist/lib/shell.js +17 -1
  69. package/dist/lib/shell.js.map +1 -1
  70. package/dist/services/git.d.ts +7 -0
  71. package/dist/services/git.d.ts.map +1 -1
  72. package/dist/services/git.js +10 -7
  73. package/dist/services/git.js.map +1 -1
  74. package/dist/services/github.d.ts +13 -0
  75. package/dist/services/github.d.ts.map +1 -1
  76. package/dist/services/github.js +35 -3
  77. package/dist/services/github.js.map +1 -1
  78. package/dist/services/setup.d.ts +4 -2
  79. package/dist/services/setup.d.ts.map +1 -1
  80. package/dist/services/setup.js +43 -13
  81. package/dist/services/setup.js.map +1 -1
  82. package/dist/services/worktree.js +1 -1
  83. package/dist/services/worktree.js.map +1 -1
  84. package/dist/types/index.d.ts +7 -0
  85. package/dist/types/index.d.ts.map +1 -1
  86. package/dist/workflow/engine/approval-flow.d.ts +2 -1
  87. package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
  88. package/dist/workflow/engine/approval-flow.js +35 -1
  89. package/dist/workflow/engine/approval-flow.js.map +1 -1
  90. package/dist/workflow/engine/branch-setup.d.ts +8 -2
  91. package/dist/workflow/engine/branch-setup.d.ts.map +1 -1
  92. package/dist/workflow/engine/branch-setup.js +16 -6
  93. package/dist/workflow/engine/branch-setup.js.map +1 -1
  94. package/dist/workflow/engine/handlers/agent-implementation.d.ts.map +1 -1
  95. package/dist/workflow/engine/handlers/agent-implementation.js +3 -10
  96. package/dist/workflow/engine/handlers/agent-implementation.js.map +1 -1
  97. package/dist/workflow/engine/handlers/dev-implementation.d.ts +2 -2
  98. package/dist/workflow/engine/handlers/dev-implementation.d.ts.map +1 -1
  99. package/dist/workflow/engine/handlers/dev-implementation.js +13 -7
  100. package/dist/workflow/engine/handlers/dev-implementation.js.map +1 -1
  101. package/dist/workflow/engine/release-engine.d.ts +7 -1
  102. package/dist/workflow/engine/release-engine.d.ts.map +1 -1
  103. package/dist/workflow/engine/release-engine.js +16 -6
  104. package/dist/workflow/engine/release-engine.js.map +1 -1
  105. package/dist/workflow/engine/ship-flow.d.ts +5 -4
  106. package/dist/workflow/engine/ship-flow.d.ts.map +1 -1
  107. package/dist/workflow/engine/ship-flow.js +8 -13
  108. package/dist/workflow/engine/ship-flow.js.map +1 -1
  109. package/dist/workflow/engine/workflow-engine.d.ts +67 -13
  110. package/dist/workflow/engine/workflow-engine.d.ts.map +1 -1
  111. package/dist/workflow/engine/workflow-engine.js +137 -47
  112. package/dist/workflow/engine/workflow-engine.js.map +1 -1
  113. package/package.json +2 -2
  114. package/dist/commands/integrate.d.ts +0 -13
  115. package/dist/commands/integrate.d.ts.map +0 -1
  116. package/dist/commands/integrate.js +0 -128
  117. package/dist/commands/integrate.js.map +0 -1
  118. package/dist/commands/start-project-item.d.ts +0 -27
  119. package/dist/commands/start-project-item.d.ts.map +0 -1
  120. package/dist/commands/start-project-item.js +0 -325
  121. package/dist/commands/start-project-item.js.map +0 -1
  122. package/dist/services/hooks.d.ts +0 -8
  123. package/dist/services/hooks.d.ts.map +0 -1
  124. package/dist/services/hooks.js +0 -72
  125. package/dist/services/hooks.js.map +0 -1
  126. package/dist/services/workflow.d.ts +0 -17
  127. package/dist/services/workflow.d.ts.map +0 -1
  128. package/dist/services/workflow.js +0 -39
  129. package/dist/services/workflow.js.map +0 -1
package/README.md CHANGED
@@ -16,16 +16,16 @@ Run commands directly from the command line:
16
16
 
17
17
  ```bash
18
18
  # Put a project item under workflow management (branch recorded on idea1.ai, no code changes)
19
- idea1 start --url https://app.idea1.ai/project/items/590
19
+ idea1 start --target https://app.idea1.ai/project/items/590
20
20
 
21
21
  # Ship the uncommitted changes of your working/release checkout: new item, its branch, PR, checks, merge
22
22
  idea1 ship --title "Release prep" --project "Omega"
23
23
 
24
24
  # Advance the item to its next workflow state (runs that state's automation)
25
- idea1 next --url https://app.idea1.ai/project/items/590 # or just `idea1 next` on the item's branch
25
+ idea1 next --target https://app.idea1.ai/project/items/590 # or just `idea1 next` on the item's branch
26
26
 
27
27
  # Jump straight to Agent Implementation (worktree + Claude) — the "send for implementation" path
28
- idea1 start-agent-implementation --url https://app.idea1.ai/project/items/590 # alias: start-project-item
28
+ idea1 start-agent-implementation --target https://app.idea1.ai/project/items/590 # alias: start-project-item
29
29
 
30
30
  # Dedicated transitions (each is one `next` step)
31
31
  idea1 start-dev-implementation # or: idea1 dev
@@ -35,11 +35,15 @@ idea1 approve-pr # or: idea1 approve
35
35
  # The same two commands on a branch with no project item, e.g. an integration branch:
36
36
  # open its PR into working/release and name the approver, then (as the approver) merge it
37
37
  idea1 ready-for-approval --assignee octocat
38
- idea1 approve-pr --branch working/integration/<name>-main
38
+ idea1 approve-pr --target working/integration/<name>-main
39
+
40
+ # From working/release: approve several items, branches or PRs at once, each in its own unattended run, in parallel
41
+ idea1 approve-pr --target https://app.idea1.ai/project/items/590,working/agent/fix-config,https://github.com/org/repo/pull/912
39
42
 
40
43
  # Release the release branch to production (bumps changed packages' versions, opens the release PR into main assigned to you, and merges it once the checks pass)
41
44
  idea1 release # or: idea1 r
42
45
  idea1 release --approve # approve and merge the release PR that is already open
46
+ idea1 release --target <item url>,<branch> # approve these into working/release first, then release once all have merged
43
47
 
44
48
  # Show help
45
49
  idea1 --help
@@ -47,7 +51,40 @@ idea1 --help
47
51
 
48
52
  ### Interactive Mode
49
53
 
50
- Run `idea1` without arguments to enter interactive mode with a searchable command interface.
54
+ Run `idea1` without arguments to enter interactive mode with a searchable command interface. A command run on several targets runs there as a background job: the prompt comes back at once, a notice is printed when the job finishes, and `/jobs` lists the session's jobs and opens a live view of one (Esc returns to the prompt). Leaving with `/exit` while a job runs asks whether to stop it. Whatever a command does, the session stays in the directory it started in.
55
+
56
+ ## Targets and parallel runs
57
+
58
+ Every command that works on a project item or a branch names it with `--target`, which takes any of:
59
+
60
+ - a project item URL (`https://app.idea1.ai/project/items/590`)
61
+ - a branch name (`working/agent/fix-config`)
62
+ - a GitHub PR URL (`https://github.com/org/repo/pull/912`), which stands for its head branch
63
+
64
+ A branch, or a PR's branch, resolves to the project item it implements. A command that needs a project item (`next`, `start-dev-implementation`, `start`, `start-agent-implementation`, `attach-project-item`, `ship-local-changes`, `join-project-item` for an item) refuses a branch that is no item's. `ready-for-approval` and `approve-pr` also operate on a branch with no project item.
65
+
66
+ With no `--target`, a command works on the current branch when it can be the target: an item's branch, or for `ready-for-approval` and `approve-pr` any branch other than the base branch. Otherwise, as on `working/release`, the targets are the first thing it asks for. It shows a picker of the open PRs into the base branch and the branches your clone knows as project items' (worktrees included). Pick any number with space, and pick **Other** to type item URLs, branch names or PR URLs as well. `release` asks the same way; picking nothing releases the branch as it is.
67
+
68
+ **One target** runs exactly as the command always has, in your terminal. Its work happens in the branch's local checkout when it has one. A branch with no checkout is worked on through origin and GitHub, and is checked out only when a step needs its files: entering Agent Implementation creates it, per the isolation mode. Approving or readying an item's PR from `working/release` therefore checks nothing out at all, and the merge brings your `working/release` checkout up to date.
69
+
70
+ **Several targets** (comma-separated) run as a job, one unattended CLI process per target, in parallel:
71
+
72
+ - Before anything starts, every target is resolved. Anything that would stop one (an item with no live branch here, a branch that is no item's for a command that needs one, two targets on one branch) stops the whole command.
73
+ - Everything the runs will need is asked once, up front: the options of every workflow state the items will enter, then one confirmation of the set (`--yes` skips it).
74
+ - Runs work in worktrees, never in your checkout, and launch no Claude session.
75
+ - Each run fails fast on its own: a PR that conflicts with its base fails before its checks are waited for, and a failed check ends the wait. The other runs carry on.
76
+ - Every run's output is logged in your main clone under `.idea1/jobs/`, one folder per job. Git ignores the folder through `.idea1/.gitignore`. On every run, the CLI creates that file if it is missing and adds any entry it lacks; commit the change when it does. Logs older than 14 days, and beyond the 50 most recent jobs, are deleted as new jobs start.
77
+ - Outside interactive mode the job runs in the foreground: each run's steps are reported as they happen, then a summary. The exit code is non-zero when any run failed.
78
+
79
+ ```bash
80
+ idea1 approve-pr --target <item url>,<branch>,<PR url> --yes
81
+ idea1 ready-for-approval --target <item url>,<item url> --assignee octocat
82
+ idea1 next --to "Dev Implementation" --target <item url>,<item url>
83
+ ```
84
+
85
+ An unattended run asks nothing. A text question with a default (a PR title, say) takes the default. Every other question, such as a confirmation or a choice, fails the run at once with the question it needed answered.
86
+
87
+ Several CLIs can also run side by side in one clone, from separate terminals. Their git commands wait for each other's locks rather than failing.
51
88
 
52
89
  ## Commands
53
90
 
@@ -64,7 +101,7 @@ The state names and their order are defined once, in `shared-config/workflow-sta
64
101
 
65
102
  ### How the workflow engine works
66
103
 
67
- An item **under workflow management** has a *workflow context* on idea1.ai: its workflow status together with the one branch on origin that carries its work — the repository and branch name, the PR target (base) branch, the dev workflow type and any stack or integration branch. An item with no context is outside workflow management and has no status. The CLI reads and records the context through the platform's MCP tools (`get_item_summary_for_branch`, `get_item_summary`, `upsert_item_workflow_context`) and, having run a transition's automation itself, records the state it reached directly with `update_item`'s `workflowStatus`; the web client works on the same context, so the two always agree, and any clone resolves a branch to its item from the platform. Locally, each clone remembers the item URL a branch was last resolved to in its git config, so ordinary branches are recognized as unmanaged instantly.
104
+ An item **under workflow management** has a *workflow context* on idea1.ai: its workflow status together with the one branch on origin that carries its work — the repository and branch name, the PR target (base) branch, the dev workflow type and any stack or integration branch. An item with no context is outside workflow management and has no status. The CLI reads and records the context through the platform's MCP tools (`get_item_summary_for_branch`, `get_item_summary`, `upsert_item_workflow_context`) and, having run a transition's automation itself, records the state it reached directly with `update_item`'s `workflowStatus`; the web client works on the same context, so the two always agree, and any clone resolves a branch to its item from the platform. The branching decisions the context records (dev workflow type, stack and integration branch, branch name) are made once, when the item's branch is created, and are never asked again for an item that has one. Locally, each clone remembers the item URL a branch was last resolved to in its git config, so ordinary branches are recognized as unmanaged instantly.
68
105
 
69
106
  The branch itself carries the work. A branch's PR is therefore gated on a CI/CD run of exactly what merges, and `approve-pr` merges that run's head. When a branch is deleted on GitHub the context keeps its name and records whether the work merged; a context whose branch is gone without merging gets a new branch the next time the item enters a pre-merge state, while merged work stays merged. Branches put under workflow before the platform kept contexts carry a legacy `.idea1/<branch>.json` file, which the CLI removes from the branch before the approval gate.
70
107
 
@@ -73,10 +110,10 @@ A transition is "enter state X". Entering a state runs that state's automation (
73
110
  | Entering | Automation |
74
111
  |----------|-----------|
75
112
  | Build Spec in Progress … Ready for Agent Implementation | none — status only |
76
- | **Agent Implementation** | ensures the branch is checked out locally (worktree or main repo), then **launches Claude** to implement the item. This is the only transition that starts code-writing automation |
77
- | **Dev Implementation** | commits and pushes the agent's work, creates the PR, removes the worktree if `removeWorktreeAtState` says so |
113
+ | **Agent Implementation** | ensures the branch is checked out locally (worktree or main repo) — the one step that creates a checkout when the branch has none — then **launches Claude** to implement the item. This is the only transition that starts code-writing automation |
114
+ | **Dev Implementation** | commits and pushes the agent's work from the branch's checkout (a branch with no checkout here has its work on origin), creates the PR, removes the worktree if `removeWorktreeAtState` says so |
78
115
  | **Needs Approval for Release** | requires the PR, sets its assignee (required — the approver of record) and any requested reviewers, removes a legacy workflow context file if the branch still carries one (its final commit), and removes the worktree if configured. From here on the branch stays as it is |
79
- | **Approved and Merged** | verifies you are the assignee, waits for the CI/CD suite, merges the PR as it stands — the merge is the approval — then deletes the branch and worktree |
116
+ | **Approved and Merged** | verifies you are the assignee, refuses a PR that conflicts with its base, waits for the CI/CD suite, merges the PR as it stands — the merge is the approval — then deletes the branch and worktree and fast-forwards your base branch checkout |
80
117
  | Released | none — normally set by GitHub automation when the work merges to `main` |
81
118
 
82
119
  `start` begins state management, `next` advances one state, `start-agent-implementation` jumps to Agent Implementation, and `ship-local-changes` takes uncommitted base-branch work all the way to Approved and Merged — all three reduce to the same engine, so branches and items always end up consistent with the state they are in. The engine and its layers are described in `src/workflow/README.md`.
@@ -98,19 +135,19 @@ This is the change-management control DataFabrIQ is audited on; see `infrastruct
98
135
  Put a project item under workflow management. An item yet to be started enters **Build Spec in Progress**; an item that already has a state keeps it. The branch is created on origin at the base branch's tip and recorded in the item's workflow context on idea1.ai; the working tree and the code stay as they are, and Claude stays closed. Idempotent: running it again for a managed item just reports the branch and state.
99
136
 
100
137
  ```bash
101
- idea1 start --url <url> [options]
102
- idea1 start # prompts for the URL (blank to create a new item)
103
- idea1 s --url <url>
138
+ idea1 start --target <url> [options]
139
+ idea1 start # prompts for the target (blank to create a new item)
140
+ idea1 s --target <url>
104
141
  ```
105
142
 
106
143
  **Options:**
107
- - `-u, --url <url>` - The Idea1.ai project item URL. Leave blank to create a new item (you'll be prompted for a `--title` and a `--project`).
108
- - `-t, --title <title>` - Title for the new project item (only when no URL is given).
109
- - `-P, --project <name>` - The Project to create the new item in, chosen from the team's live Projects (only when no URL is given; always asked, never defaulted).
144
+ - `--target <url | branch | PR url>` - The project item, or its branch or that branch's PR. Leave blank to create a new item (you'll be prompted for a `--title` and a `--project`). One target only.
145
+ - `-t, --title <title>` - Title for the new project item (only when no target is given).
146
+ - `-P, --project <name>` - The Project to create the new item in, chosen from the team's live Projects (only when no target is given; always asked, never defaulted).
110
147
  - `-p, --source-path <path>` - Path to source directory.
111
- - `-n, --branch-name <name>` - Branch name (auto-generated from the item description if not provided).
148
+ - `-n, --branch-name <name>` - Branch name (auto-generated from the item description if not provided). Asked, blank to generate one, only when the item has no branch yet.
112
149
  - `-b, --base-branch <branch>` - Base branch / PR target (default: `working/release`).
113
- - `-w, --workflow-type <type>` - `independent` or `integration`; you also choose any stack branch and (for integration) the integration branch. Not asked when carrying local changes, which go onto an independent branch.
150
+ - `-w, --workflow-type <type>` - `independent` or `integration`; you also choose any stack branch and (for integration) the integration branch. These are asked only when the command gives the item its branch, never for an item whose workflow context already holds one, and an option given on the command line is not asked. Carried local changes go onto an independent branch.
114
151
  - `-c, --carry-local-changes` - Make the uncommitted changes of your base branch checkout the item's work. See [Carrying local changes](#carrying-local-changes).
115
152
  - `--approve-and-merge` - Advance the item through every state up to **Approved and Merged** without prompting. See [Carrying local changes](#carrying-local-changes).
116
153
  - `-M, --commit-message <message>` - Commit message for carried changes (default: the new item's title).
@@ -125,7 +162,7 @@ Work sometimes starts before its project item does: you make changes in your `wo
125
162
  2. Every uncommitted change — staged or not, plus untracked files that are not ignored — is committed on top of the checkout's commit without touching the checkout, and that commit becomes the tip of the item's branch on origin. For an item with no branch, the branch is created at that commit and recorded as the item's; an item whose branch exists takes the changes only while that branch has no commits of its own and no local checkout. The base branch itself is never committed to or pushed.
126
163
  3. The branch is checked out per the isolation mode: with `main-repo`, the checkout that held the changes switches to the branch with its working tree untouched (it is the branch's tip, so the checkout is clean); with `worktree`, the branch gets a worktree and the carried changes are removed from the base branch checkout.
127
164
 
128
- With `--approve-and-merge`, the item is then advanced through every workflow state up to **Approved and Merged** with nothing asked on the way: no Claude session is launched at Agent Implementation, the PR is created and assigned to **you** (the person who merges is the approver of record), the CLI waits for the required CI/CD checks — the same no-override gate as `approve-pr` — and merges, then brings your local base branch up to date with the merge. On a new item it needs changes to carry. A run that stops (failing checks, say) leaves the item at the last state it reached; fix the branch and run `idea1 approve-pr`, or run the command again with `--url`, to continue.
165
+ With `--approve-and-merge`, the item is then advanced through every workflow state up to **Approved and Merged** with nothing asked on the way: no Claude session is launched at Agent Implementation, the PR is created and assigned to **you** (the person who merges is the approver of record), the CLI waits for the required CI/CD checks — the same no-override gate as `approve-pr` — and merges, then brings your local base branch up to date with the merge. On a new item it needs changes to carry. A run that stops (failing checks, say) leaves the item at the last state it reached; fix the branch and run `idea1 approve-pr`, or run the command again with `--target`, to continue.
129
166
 
130
167
  ### ship-local-changes
131
168
 
@@ -135,12 +172,12 @@ With `--approve-and-merge`, the item is then advanced through every workflow sta
135
172
  idea1 ship-local-changes --title "Release prep" --project "Omega"
136
173
  idea1 ship --title "Release prep" --project "Omega" --branch-name release-prep
137
174
  idea1 ship --title "Release prep" --project "Omega" --isolation main-repo
138
- idea1 ship --url <url> # an existing item whose branch has no commits yet
175
+ idea1 ship --target <url> # an existing item whose branch has no commits yet
139
176
  ```
140
177
 
141
178
  **Options:**
142
- - `-u, --url <url>` - An existing project item (default: create a new one).
143
- - `-t, --title <title>`, `-P, --project <name>` - The new item's title and Project (asked when missing and no URL is given).
179
+ - `--target <url | branch | PR url>` - An existing project item (default: create a new one).
180
+ - `-t, --title <title>`, `-P, --project <name>` - The new item's title and Project (asked when missing and no target is given).
144
181
  - `-n, --branch-name <name>` - Branch name under the branch prefix (default: derived from the item).
145
182
  - `-b, --base-branch <branch>` - The branch your checkout is on, which the item's branch is cut from and merges into (default: `baseBranch`).
146
183
  - `-M, --commit-message <message>` - Commit message (default: the item's title).
@@ -149,19 +186,20 @@ idea1 ship --url <url> # an existing item whose branch has no commit
149
186
 
150
187
  ### next-workflow-step
151
188
 
152
- Advance a project item to its next workflow state and run that state's automation. On the item's branch no arguments are needed; from anywhere else pass the item URL — the CLI finds the branch on origin (moving into its local checkout when one exists) or, for an item without a branch yet, reads the current state from idea1.ai and creates the branch first.
189
+ Advance a project item to its next workflow state and run that state's automation. On the item's branch no arguments are needed; from anywhere else pass the item (its URL, branch or PR URL) as `--target` — the CLI finds the branch on origin (moving into its local checkout when one exists) or, for an item without a branch yet, reads the current state from idea1.ai and creates the branch first. Several targets advance in parallel (see [Targets and parallel runs](#targets-and-parallel-runs)), each to its own next state or all to `--to`.
153
190
 
154
191
  With `--to <state>` the item advances through every state up to that one in a single run — the same as running `next` once per state: each state's automation runs and the state is recorded on idea1.ai before the next state is entered. A run that stops part way leaves the item at the last state it entered, and running it again continues from there. The CLI only moves forward; an item already at or past the requested state is left as it is.
155
192
 
156
193
  ```bash
157
194
  idea1 next # on the item's branch
158
- idea1 next --url <url> # from anywhere in the repository
195
+ idea1 next --target <url> # from anywhere in the repository
159
196
  idea1 next --to "Dev Implementation" # several states at once
197
+ idea1 next --to "Needs Approval for Release" --target <url>,<url> --assignee octocat # several items in parallel
160
198
  idea1 n
161
199
  ```
162
200
 
163
201
  **Options:**
164
- - `-u, --url <url>` - Project item URL (required when not on the item's branch).
202
+ - `--target <url | branch | PR url>[,...]` - The project item(s) (default: the current branch, when it is an item's).
165
203
  - `--to <state>` - Workflow state to advance to (default: the next state).
166
204
  - `-p, --source-path <path>` - Path to source directory.
167
205
  - Any option of the state being entered (for example `--model`/`--effort` for Agent Implementation, `--assignee`/`--reviewers` for Needs Approval for Release). Options that were not supplied are prompted for when that state is reached.
@@ -179,10 +217,10 @@ The automation is idempotent, so re-running a transition after the item was move
179
217
  Start implementing a project item: put it under workflow management if needed, move it to **Agent Implementation** (through any intermediate states, which have no automation), set up the working environment and launch Claude Code with the implementation prompt — the repository's `prompts.agentImplementation` setting (see [Prompts](#prompts)), the built-in default, or a prompt you supply with `--entry-point-prompt`. This is the command behind "Send for Implementation" in the web client; `start-project-item` remains an alias so existing team command templates keep working.
180
218
 
181
219
  ```bash
182
- idea1 start-agent-implementation --url <url> [options]
183
- idea1 implement --url <url>
184
- idea1 start-project-item --url <url> # alias
185
- idea1 implement --url <url> --entry-point-prompt "Read the spec in docs/spec.md and implement step 3"
220
+ idea1 start-agent-implementation --target <url> [options]
221
+ idea1 implement --target <url>
222
+ idea1 start-project-item --target <url> # alias
223
+ idea1 implement --target <url> --entry-point-prompt "Read the spec in docs/spec.md and implement step 3"
186
224
  ```
187
225
 
188
226
  **Options:** all `start` options, plus the Agent Implementation options:
@@ -210,16 +248,14 @@ Supply `-iso worktree` or `-iso main-repo` on the command line to skip the promp
210
248
  Join an **in-progress** project item by setting up a working environment on its existing branch — for picking up work started elsewhere (e.g. on another machine, by another developer, or from the web client). It does not change the workflow state and never launches a Claude implementation session.
211
249
 
212
250
  ```bash
213
- idea1 join-project-item --project-item-url <url>
214
- idea1 join-project-item --branch-name <branch>
215
- idea1 join-project-item --pull-request-url <pr url>
216
- idea1 j --branch-name <branch>
251
+ idea1 join-project-item --target <url>
252
+ idea1 join-project-item --target <branch>
253
+ idea1 join-project-item --target <pr url>
254
+ idea1 j --target <branch>
217
255
  ```
218
256
 
219
- **Options (exactly one of the first three must be supplied — they are mutually exclusive):**
220
- - `--project-item-url <url>` - The Idea1.ai project item URL; its branch is discovered automatically.
221
- - `-n, --branch-name <branch>` - The branch to join; its associated project item is discovered automatically.
222
- - `--pull-request-url <url>` - A GitHub PR URL; its head branch is joined.
257
+ **Options:**
258
+ - `--target <url | branch | PR url>` - **Required.** The project item (its branch is discovered automatically), the branch to join (its project item is discovered automatically), or a GitHub PR (its head branch is joined). One target only.
223
259
  - `-p, --source-path <path>` - Path to source directory.
224
260
  - `-iso, --isolation <mode>` - Where to work on the branch (default: `worktree`). See [Isolation mode](#isolation-mode).
225
261
 
@@ -238,62 +274,66 @@ Attach the **current branch** to a project item, putting it under workflow manag
238
274
  On the base branch, `--carry-local-changes` gives the item a branch of its own instead and carries your uncommitted changes onto it, exactly as `start --carry-local-changes` does (see [Carrying local changes](#carrying-local-changes)); `--branch-name`, `--commit-message` and `--isolation` then apply. With `--approve-and-merge`, the attached (or new) branch is advanced through every state up to Approved and Merged without prompting.
239
275
 
240
276
  ```bash
241
- idea1 attach-project-item --url <url>
242
- idea1 attach-project-item # prompts for the URL (blank to create a new item)
243
- idea1 a --url <url>
277
+ idea1 attach-project-item --target <url>
278
+ idea1 attach-project-item # prompts for the target (blank to create a new item)
279
+ idea1 a --target <url>
244
280
  ```
245
281
 
246
282
  **Options:**
247
- - `-u, --url <url>` - The Idea1.ai project item URL. Leave blank to create a new item (you'll be prompted for a `--title`).
248
- - `-t, --title <title>` - Title for the new project item (only when no URL is given).
283
+ - `--target <url | branch | PR url>` - The project item, or its branch or that branch's PR. Leave blank to create a new item (you'll be prompted for a `--title`).
284
+ - `-t, --title <title>` - Title for the new project item (only when no target is given).
249
285
  - `-p, --source-path <path>` - Path to source directory.
250
286
  - `-b, --base-branch <branch>` - Base branch / PR target for an independent feature (default: `working/release`).
251
- - `-w, --workflow-type <type>` - Development workflow type: `independent` or `integration`. You also choose any stack branch and (for integration) the integration branch.
287
+ - `-w, --workflow-type <type>` - Development workflow type: `independent` or `integration`. You also choose any stack branch and (for integration) the integration branch. Asked here because attaching records a new branch on the item; an option given on the command line is not asked.
252
288
  - `-c, --carry-local-changes`, `--approve-and-merge`, `-n, --branch-name`, `-M, --commit-message`, `-iso, --isolation`, `-r, --reviewers` - As for `start`.
253
289
 
254
290
  **What it does:**
255
291
  1. Verifies the current branch is free to implement the item (a branch that already implements one is resumed with `join-project-item`).
256
- 2. Creates the project item if no URL was supplied.
292
+ 2. Creates the project item if no target was supplied.
257
293
  3. Records the branch in the item's workflow context on idea1.ai (base branch, dev workflow type, stack/integration branch) in a single call, which puts an item outside workflow management under it at `Build Spec in Progress` and leaves an item that already has a state at that state. The branch is pushed to origin beforehand and stays as it is.
258
294
  4. If the item is already at `Dev Implementation` or later, makes sure a PR into the base branch exists.
259
295
 
260
296
  ### start-dev-implementation
261
297
 
262
- Advance the item to **Dev Implementation** — the same as `next --to "Dev Implementation"`. From Agent Implementation that is one step; from an earlier state every state in between is entered first, each with its own automation. An item already at or past Dev Implementation is left as it is.
298
+ Advance the item to **Dev Implementation** — the same as `next --to "Dev Implementation"`. From Agent Implementation that is one step; from an earlier state every state in between is entered first, each with its own automation. An item already at or past Dev Implementation is left as it is. Several targets advance in parallel.
263
299
 
264
300
  ```bash
265
301
  idea1 start-dev-implementation [options]
266
302
  idea1 dev [options]
303
+ idea1 dev --target <url>,<url>
267
304
  ```
268
305
 
269
306
  **Options:**
307
+ - `--target <url | branch | PR url>[,...]` - The project item(s) (default: the current branch, when it is an item's)
270
308
  - `-p, --source-path <path>` - Path to worktree directory
271
309
 
272
310
  **What it does:**
273
311
  1. Enters every state before Dev Implementation the item has yet to reach (after syncing from origin)
274
- 2. Commits and pushes all changes in the branch
312
+ 2. Commits and pushes all changes in the branch's local checkout; a branch with no checkout here carries its work on origin already
275
313
  3. Creates a PR of the branch into its base branch
276
314
  4. Records "Dev Implementation" on Idea1.ai
277
315
  5. If in a worktree and `removeWorktreeAtState` is `Dev Implementation`, removes the worktree. The main repo stays on its current branch; use `join-project-item` to work on the item in the main repo or a new worktree.
278
316
 
279
317
  ### ready-for-approval
280
318
 
281
- On a project item's branch, advance the item to **Needs Approval for Release** — the same as `next --to "Needs Approval for Release"`: from an earlier state, every state in between is entered first, each with its own automation (PR creation on the way into Dev Implementation, for one), and an item already at or past it is left as it is. On any other branch (an integration branch, a branch with no project item), open the branch's PR into the base branch when it has none. Either way its job is to name the **assignee**, who will approve the change by merging it.
319
+ For a project item, advance the item to **Needs Approval for Release** — the same as `next --to "Needs Approval for Release"`: from an earlier state, every state in between is entered first, each with its own automation (PR creation on the way into Dev Implementation, for one), and an item already at or past it is left as it is. For any other branch (an integration branch, a branch with no project item), open the branch's PR into the base branch when it has none. Either way its job is to name the **assignee**, who will approve the change by merging it. Several targets run in parallel.
282
320
 
283
321
  ```bash
284
322
  idea1 ready-for-approval [options]
285
323
  idea1 rfa --assignee octocat
286
324
  idea1 rfa --assignee octocat # on working/integration/<name>-main: opens the PR into working/release
287
325
  idea1 rfa --assignee octocat -b working/release # a branch with no project item, naming the PR target
326
+ idea1 rfa --assignee octocat --target <url>,<branch> # from working/release, in parallel
288
327
  ```
289
328
 
290
329
  **Options:**
330
+ - `--target <url | branch | PR url>[,...]` - The project item(s) or branch(es) (default: the current branch; asked for on the base branch)
291
331
  - `-a, --assignee <username>` - **Required.** Who approves the PR by merging it (prompted from the repository's assignable users when omitted)
292
332
  - `-r, --reviewers <user1,user2>` - Who to request a review from (multi-select when omitted). Optional, and separate from approval — the assignee is the approver
293
333
  - `-b, --base-branch <branch>` - Branches with no project item only: the branch the PR targets (default: the open PR's base, else `baseBranch`, then `working/release`)
294
334
  - `--title <title>` - Branches with no project item only: PR title when the PR has to be created (default: `Integration <name> <YYYY-MM-DD>` for an integration branch, else the branch name; prompted when omitted)
295
335
 
296
- **What it does on a project item's branch:**
336
+ **What it does for a project item:**
297
337
  1. Enters every state before Needs Approval for Release the item has yet to reach (after syncing from origin)
298
338
  2. Ensures no uncommitted or unpushed changes in the local checkout
299
339
  3. Requires the PR to exist, then sets the assignee (the transition refuses to proceed without one) and requests any reviewers
@@ -301,38 +341,39 @@ idea1 rfa --assignee octocat -b working/release # a branch with no project it
301
341
  5. Records "Needs Approval for Release" on Idea1.ai. From here on the branch stays as it is
302
342
  6. If in a worktree and `removeWorktreeAtState` is `Needs Approval for Release` (the default) or earlier, removes the worktree
303
343
 
304
- **What it does on a branch with no project item:**
305
- 1. Requires you to be on the branch with nothing uncommitted, unpushed or behind origin; refuses on the base branch itself and refuses a PR straight into `main` (that is `idea1 release`)
344
+ **What it does for a branch with no project item:**
345
+ 1. Requires the branch on origin and, when it is checked out here, nothing uncommitted, unpushed or behind origin in that checkout; refuses the base branch itself and refuses a PR straight into `main` (that is `idea1 release`)
306
346
  2. Reuses the branch's open PR (and its base) when one exists; otherwise creates the PR into the base branch with the approval chain of what the branch carries as its body — every PR merged into the branch with its author and approver, and commits pushed straight to the branch listed as the change under review (they are not an exception: this PR is their stage-1 approval)
307
347
  3. Sets the assignee and requests any reviewers
308
348
  4. Records no workflow status — there is no project item
309
349
 
310
350
  ### approve-pr
311
351
 
312
- On a project item's branch, advance the item to **Approved and Merged** — the same as `next --to "Approved and Merged"`: from an earlier state, every state in between is entered first, each with its own automation, and an item already at or past it is left as it is. On any other branch, merge the branch's PR. Run by the PR's **assignee**: it waits for the CI/CD suite and merges the PR, and that merge is the approval of record. There is no admin override at this stage for any branch.
352
+ For a project item, advance the item to **Approved and Merged** — the same as `next --to "Approved and Merged"`: from an earlier state, every state in between is entered first, each with its own automation, and an item already at or past it is left as it is. For any other branch, merge the branch's PR. Run by the PR's **assignee**: it waits for the CI/CD suite and merges the PR, and that merge is the approval of record. There is no admin override at this stage for any branch. Several targets are approved in parallel, from `working/release`: each merges as soon as its PR can, and your checkout ends on `working/release`, up to date with every merge, with no worktree left behind.
313
353
 
314
354
  ```bash
315
355
  idea1 approve-pr
316
356
  idea1 approve
317
- idea1 approve-pr --branch working/integration/<name>-main # from anywhere: the branch need not be checked out
357
+ idea1 approve-pr --target working/integration/<name>-main # from anywhere: the branch need not be checked out
358
+ idea1 approve-pr --target <url>,<branch>,<pr url> --yes # several, in parallel
318
359
  ```
319
360
 
320
361
  **Options:**
321
- - `-b, --branch <branch>` - Branch whose PR to approve (default: the current branch). A project item's branch is approved through the workflow; any other branch through its PR alone
362
+ - `--target <url | branch | PR url>[,...]` - The project item(s) or branch(es) whose PR to approve (default: the current branch; asked for on the base branch). A project item is approved through the workflow; any other branch through its PR alone
322
363
  - `-y, --yes` - Merge without asking for confirmation. The approver check and the wait for the required checks still apply
323
364
 
324
- **What it does on a project item's branch:**
365
+ **What it does for a project item:**
325
366
  1. Enters every state before Approved and Merged the item has yet to reach (after syncing from origin)
326
367
  2. Verifies the approver: refuses when the PR has no assignee, and when you are not the assignee warns that the merge record will name you instead and requires an explicit confirmation (the evidence report lists such a merge as an exception)
327
- 3. Waits for the required CI/CD checks on the PR — the checks of the branch's tip on origin, which the PR must have picked up first — then merges the PR. A red or unfinished suite stops the merge — there is no admin override at this stage. The branch is merged as it stands. A legacy branch that still carries its workflow context file has the file removed and pushed instead, and the approval is left for a second run once the re-run suite passes
368
+ 3. Refuses a PR that conflicts with its base straight away, before any wait, and again after the checks (another merge may have made it conflict meanwhile). Waits for the required CI/CD checks on the PR — the checks of the branch's tip on origin, which the PR must have picked up first — then merges the PR. A red or unfinished suite stops the merge — there is no admin override at this stage. The branch is merged as it stands. A legacy branch that still carries its workflow context file has the file removed and pushed instead, and the approval is left for a second run once the re-run suite passes
328
369
  4. Records "Approved and Merged" on Idea1.ai
329
- 5. Switches to the base branch and deletes the feature branch. If still running inside a worktree, removes the worktree instead of switching branches — this always happens, since the base branch can't be checked out in place there
370
+ 5. Deletes the feature branch: when it is checked out in the main repo, switches to the base branch first; inside a worktree, removes the worktree instead — this always happens, since the base branch can't be checked out in place there. Then fast-forwards the base branch's local checkout to the merge
330
371
 
331
- **What it does on a branch with no project item:**
372
+ **What it does for a branch with no project item:**
332
373
  1. Finds the branch's PR (run `ready-for-approval` first if there is none) and takes the target branch from it
333
374
  2. Refuses while any open PR still targets the branch — merging would retire the branch and orphan them
334
- 3. Verifies the approver exactly as above, waits for the required CI/CD checks and merges. A red or unfinished suite stops the merge — no override
335
- 4. Deletes the branch on origin and locally (removing its worktree, or switching to the base branch first when it is checked out in the main repo). Records no workflow status
375
+ 3. Verifies the approver exactly as above, refuses a conflicting PR, waits for the required CI/CD checks and merges. A red or unfinished suite stops the merge — no override
376
+ 4. Deletes the branch on origin and locally (removing its worktree, or switching to the base branch first when it is checked out in the main repo), and fast-forwards the base branch's local checkout. Records no workflow status
336
377
 
337
378
  ### release
338
379
 
@@ -343,16 +384,19 @@ idea1 release # prompts for any version bumps,
343
384
  idea1 release --bumps filekit=minor,cli=patch # bump types given up front
344
385
  idea1 release --pr-mode merge # enable auto-merge (or wait for the checks and merge here)
345
386
  idea1 release --approve # approve and merge the open release PR
387
+ idea1 release --target <url>,<branch> # approve these into the release branch first, then release
346
388
  idea1 r
347
389
  ```
348
390
 
349
391
  **Options:**
350
392
  - `-b, --branch <branch>` - Source branch to release from (default: `baseBranch`, then `working/release`)
351
- - `-t, --target <branch>` - Target branch to release into (default: `releaseTargetBranch`, then `main`)
393
+ - `-t, --target-branch <branch>` - Target branch to release into (default: `releaseTargetBranch`, then `main`)
352
394
  - `--approve` - Approve and merge the release PR that is already open, instead of opening one. See [Approving an open release](#approving-an-open-release)
395
+ - `--target <url | branch | PR url>[,...]` - Project items, branches or PRs to approve into the release branch before releasing it. Asked for, blank by default, which releases the branch as it is. See [Releasing with approvals](#releasing-with-approvals)
353
396
  - `--bumps <package=type,...>` - Version bump per changed package, as `patch`, `minor` or `major` (e.g. `filekit=minor,cli=patch`). A changed package it doesn't name is prompted for, with `patch` preselected; a package that needs no bump is ignored
354
397
  - `-pr, --pr-mode <mode>` - `create` (default) creates the PR and opens it in the browser so you merge it there once the required checks pass; `merge` turns on GitHub's auto-merge, so GitHub merges once the required checks pass, and falls back to waiting for every check with `gh` and merging here when GitHub can't auto-merge (the PR is already mergeable, or the repository doesn't allow auto-merge). You are the recorded merger, and the merge is the recorded approval, in every case
355
398
  - `--title <title>` - PR title (default: `Release <YYYY-MM-DD>`)
399
+ - `-y, --yes` - In `merge` mode, merge without asking for confirmation; with `--target`, also start the approvals without asking. The required checks still gate every merge
356
400
 
357
401
  **What it does:**
358
402
  1. Requires you to be on the release branch with nothing uncommitted, unpushed or behind origin
@@ -362,6 +406,24 @@ idea1 r
362
406
  5. In `merge` mode, enables auto-merge, or waits for the required CI/CD checks and merges normally. Checks that fail, never start or never finish stop the release; an admin override is available but takes an explicit confirmation and a required reason, and the exception is recorded as a comment on the PR before anything is merged
363
407
  6. Opens GitHub Actions once it has merged the PR itself, where the merge to `main` has triggered the production deploy
364
408
 
409
+ #### Releasing with approvals
410
+
411
+ `idea1 release --target <items, branches or PRs>` releases the release branch once the given targets are approved into it, as one unattended sequence:
412
+
413
+ 1. **Checks:** your checkout must be on the release branch, clean and level with origin. Then every target is resolved exactly as `approve-pr` resolves several targets.
414
+ 2. **Questions, all asked up front:**
415
+ - the options the targets' workflow states need, then one confirmation of the approvals;
416
+ - the version bump of every versioned package changed on the release branch or on any target's branch;
417
+ - the title (`--pr-mode` is asked as usual).
418
+ 3. **Approvals:** every target's PR is approved in parallel, each in its own unattended run, exactly as `approve-pr` does.
419
+ 4. **Fast fail:** the first target that fails (a red check, or a PR that cannot merge) stops the others, and nothing is released. Fix it and run the command again: the approvals that merged stay merged.
420
+ 5. **Release:** once every target has merged, the release runs as it does on its own, in your up-to-date checkout:
421
+ - it bumps the versions;
422
+ - it opens the release PR into `main`, assigned to you;
423
+ - it carries on in the chosen PR mode.
424
+
425
+ In interactive mode the whole sequence runs as a background job (see `/jobs`); otherwise it runs in the foreground, reporting each run's steps.
426
+
365
427
  #### Approving an open release
366
428
 
367
429
  `idea1 release --approve` finds the open release PR from the release branch into the target and merges it as its approver, after the same assignee check as `approve-pr`:
@@ -12,6 +12,7 @@ import type { Command } from '../types/index.js';
12
12
  * applicable, so it is neither prompted nor required and left unset.
13
13
  * 1. Skip if isFlag — flags are never prompted
14
14
  * 2. Skip if already in parsed — value was provided on CLI
15
+ * 2a. If resolveValue exists: let it resolve the value (it may ask), and use that
15
16
  * 3. If has default and promptWhenDefaultExists is not true: silently use default
16
17
  * 4. If no default: prompt (required — re-prompt until valid value given)
17
18
  * 5. If has default and promptWhenDefaultExists is true: prompt showing default as hint
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/cli/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAKhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwGjC"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/cli/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAKhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA6GjC"}
@@ -14,6 +14,7 @@ import { resolveNamedList } from './named-lists.js';
14
14
  * applicable, so it is neither prompted nor required and left unset.
15
15
  * 1. Skip if isFlag — flags are never prompted
16
16
  * 2. Skip if already in parsed — value was provided on CLI
17
+ * 2a. If resolveValue exists: let it resolve the value (it may ask), and use that
17
18
  * 3. If has default and promptWhenDefaultExists is not true: silently use default
18
19
  * 4. If no default: prompt (required — re-prompt until valid value given)
19
20
  * 5. If has default and promptWhenDefaultExists is true: prompt showing default as hint
@@ -56,6 +57,10 @@ export async function resolveOptions(command, parsed) {
56
57
  }
57
58
  continue;
58
59
  }
60
+ if (option.resolveValue) {
61
+ resolved[option.longName] = await option.resolveValue(resolved);
62
+ continue;
63
+ }
59
64
  const defaultVal = resolveDefault(option);
60
65
  const hasDefault = defaultVal !== undefined;
61
66
  const promptWhenDefault = option.promptWhenDefaultExists !== false; // default true
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/cli/resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAA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CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAChF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;QAC/E,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyE1D"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0E1D"}
package/dist/cli.js CHANGED
@@ -21,7 +21,8 @@ export async function runCli(argv) {
21
21
  if (!isSimpleFlag) {
22
22
  try {
23
23
  repoRoot = await git.getRepoRoot();
24
- await ensureSetup(repoRoot);
24
+ // The main clone is set up, never a worktree, whose branch a setup change would make dirty.
25
+ await ensureSetup((await git.getMainRepoRoot()).trim());
25
26
  }
26
27
  catch {
27
28
  // Not in a git repository - skip setup
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB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QACf,MAAM,GAAG,GAAG,KAAc,CAAC;QAC3B,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YAC1H,OAAO;QACT,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAuFjD,eAAO,MAAM,gBAAgB,EAAE,OAuC9B,CAAC"}
1
+ {"version":3,"file":"approve-pr.d.ts","sourceRoot":"","sources":["../../src/commands/approve-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAyEjD,eAAO,MAAM,gBAAgB,EAAE,OAyB9B,CAAC"}
@@ -6,7 +6,8 @@ import * as worktree from '../services/worktree.js';
6
6
  import { WorkflowStates } from '../workflow/data/workflow-states.js';
7
7
  import { cleanUpMergedBranch, mergeAsApprover, mergeConfirmationOption } from '../workflow/engine/approval-flow.js';
8
8
  import { confirmApproverIdentity } from '../workflow/engine/release-engine.js';
9
- import { advanceAsNeededTo, getProjectItemSummaryForBranch, resolveTransition, resolveTransitionIfManaged } from '../workflow/engine/workflow-engine.js';
9
+ import { advanceAsNeededTo, resolveTarget } from '../workflow/engine/workflow-engine.js';
10
+ import { runForTargets, targetOption } from '../jobs/targets.js';
10
11
  import { deferredHandlerOptions } from '../workflow/engine/handlers/index.js';
11
12
  /**
12
13
  * Stage 1 approval for a branch with no project item: the assignee merges the branch's PR once
@@ -17,10 +18,9 @@ async function approvePrOnBranchWithNoItem(branchName, confirmed) {
17
18
  await github.ensureGitHubCli();
18
19
  // Captured before anything moves: cleanup may switch branches or remove a worktree.
19
20
  const workingPath = await git.getCheckoutPathForBranch(branchName);
20
- const isCurrentBranch = (await git.getCurrentBranch()) === branchName;
21
21
  const prInfo = await github.getPrInfo(branchName);
22
22
  if (!prInfo) {
23
- throw new Error('No PR found for this branch. Run idea1 ready-for-approval first to open it and name its approver.');
23
+ throw new Error(`No PR found for ${branchName}. Run idea1 ready-for-approval --target ${branchName} first to open it and name its approver.`);
24
24
  }
25
25
  logger.info(`PR #${prInfo.number} found`);
26
26
  const state = prInfo.state.toUpperCase();
@@ -40,7 +40,7 @@ async function approvePrOnBranchWithNoItem(branchName, confirmed) {
40
40
  logger.dim(`PR #${prInfo.number} is already merged; cleaning up the branch.`);
41
41
  }
42
42
  else {
43
- if (isCurrentBranch) {
43
+ if (workingPath) {
44
44
  await git.ensureBranchUpToDate();
45
45
  }
46
46
  // Merging retires the branch, which would orphan any PR still targeting it.
@@ -56,46 +56,29 @@ async function approvePrOnBranchWithNoItem(branchName, confirmed) {
56
56
  logger.newline();
57
57
  logger.success(`PR merged into ${baseBranch} - the merge is the recorded approval`);
58
58
  }
59
- /**
60
- * The transition for a named branch when it is a project item's branch, else null.
61
- */
62
- async function resolveTransitionForNamedBranch(branchName, resolved) {
63
- const projectItemUrl = (await getProjectItemSummaryForBranch(branchName))?.url ?? null;
64
- return projectItemUrl ? resolveTransition({ projectItemUrl, options: resolved }) : null;
65
- }
66
59
  export const approvePrCommand = {
67
60
  name: 'approve-pr',
68
61
  aliases: ['approve'],
69
- description: 'Approve the PR by merging it (the assignee runs this) - on a project item\'s branch (advancing the item through every state before it) or any other branch',
62
+ description: 'Approve PRs by merging them once their checks pass (the assignee runs this) - project items (advancing each through every state before it) or branches with no item; several run in parallel',
70
63
  options: [
71
- {
72
- longName: 'branch',
73
- shortName: 'b',
74
- description: 'Branch whose PR to approve (default: the current branch)',
75
- defaultValue: '',
76
- promptWhenDefaultExists: false
77
- },
78
- // On a project item's branch the item may be further back; the states it passes through on the
79
- // way (the assignee of Needs Approval for Release, for one) ask for their own options.
64
+ targetOption(true),
65
+ // A project item may be further back; the states it passes through on the way (the assignee
66
+ // of Needs Approval for Release, for one) ask for their own options.
80
67
  ...deferredHandlerOptions([])
81
68
  ],
82
69
  async execute(resolved) {
83
- const requestedBranch = resolved['branch'] || null;
84
- // A named branch the platform records as an item's is approved through
85
- // the workflow engine, from wherever the command is run. With no branch named, the current
86
- // branch is the target, managed or not.
87
- const transition = requestedBranch
88
- ? await resolveTransitionForNamedBranch(requestedBranch, resolved)
89
- : await resolveTransitionIfManaged({ options: resolved });
90
- if (transition) {
91
- await advanceAsNeededTo(transition, WorkflowStates.ApprovedAndMerged);
92
- return;
93
- }
94
- const branchName = requestedBranch ?? await git.getCurrentBranch();
95
- if (branchName === 'HEAD') {
96
- throw new Error('You are not on a branch (detached HEAD). Check out the branch to approve, or pass --branch <name>.');
97
- }
98
- await approvePrOnBranchWithNoItem(branchName, resolved[mergeConfirmationOption.longName] === 'true');
70
+ await runForTargets(approvePrCommand, resolved, {
71
+ advancesTo: () => WorkflowStates.ApprovedAndMerged,
72
+ itemlessBranches: true,
73
+ run: async (target) => {
74
+ const resolvedTarget = await resolveTarget({ target, options: resolved });
75
+ if (resolvedTarget.kind === 'item') {
76
+ await advanceAsNeededTo(resolvedTarget.transition, WorkflowStates.ApprovedAndMerged);
77
+ return;
78
+ }
79
+ await approvePrOnBranchWithNoItem(resolvedTarget.branchName, resolved[mergeConfirmationOption.longName] === 'true');
80
+ }
81
+ });
99
82
  }
100
83
  };
101
84
  //# sourceMappingURL=approve-pr.js.map