fix(watch): allow --board-owner override for org-owned ProjectV2#1087
Open
vejadu wants to merge 1 commit into
Open
fix(watch): allow --board-owner override for org-owned ProjectV2#1087vejadu wants to merge 1 commit into
vejadu wants to merge 1 commit into
Conversation
The board capability hardcoded `--owner @me` when calling `gh project item-list`, so users whose project boards are org-owned (e.g. https://github.com/orgs/<org>/projects/22) could not use `--board` at all — gh resolved `@me` and failed with "Could not resolve to a ProjectV2 with the number N". - Read `owner` from board capability config, defaulting to `@me`. - Add `--board-owner <name>` CLI flag and document it. - Plumb `boardOwner` through legacy WatchOptions. - Add tests covering supplied and default owner. Closes bradygaster#1079
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an override for the GitHub Projects v2 owner used by the watch board capability, enabling squad watch --board to work with org-owned ProjectV2 boards (not just @me).
Changes:
- Introduces
--board-owner <name>(default@me) and threads it into watch capability config. - Updates
BoardCapabilityto use the configured owner when callinggh project item-list. - Adds a focused unit test for owner propagation and updates CLI/docs references.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/watch-board-capability.test.ts | Adds tests asserting configured/default --owner behavior for gh project item-list. |
| packages/squad-cli/src/cli/commands/watch/index.ts | Extends legacy WatchOptions shim to carry boardOwner into capability config. |
| packages/squad-cli/src/cli/commands/watch/capabilities/board.ts | Uses context.config.owner (default @me) when invoking gh project item-list. |
| packages/squad-cli/src/cli-entry.ts | Adds --board-owner help text, parsing, and positional-arg skip list support. |
| docs/src/content/docs/reference/cli.md | Documents --board-project and new --board-owner flags in the CLI reference. |
| docs/src/content/docs/features/ralph.md | Documents --board-owner in Ralph’s opt-in feature flag table. |
|
|
||
| async execute(context: WatchContext): Promise<CapabilityResult> { | ||
| const projectNumber = (context.config['projectNumber'] as number) ?? 1; | ||
| const owner = (context.config['owner'] as string) ?? '@me'; |
Comment on lines
+487
to
+494
| // --board-owner sets the project owner (default @me, override for org-owned ProjectV2 boards) | ||
| const boardOwnerIdx = args.indexOf('--board-owner'); | ||
| if (boardOwnerIdx !== -1 && args[boardOwnerIdx + 1]) { | ||
| const existing = capabilities['board']; | ||
| capabilities['board'] = typeof existing === 'object' && existing !== null | ||
| ? { ...existing, owner: args[boardOwnerIdx + 1]! } | ||
| : { owner: args[boardOwnerIdx + 1]! }; | ||
| } |
Comment on lines
183
to
187
| console.log(` --self-pull git fetch/pull at round start`); | ||
| console.log(` --board project board lifecycle + reconciliation`); | ||
| console.log(` --board-project N project number (default 1)`); | ||
| console.log(` --board-owner X project owner (default @me; use org name for org-owned ProjectV2)`); | ||
| console.log(` --monitor-teams scan Teams for actionable messages`); |
Comment on lines
+487
to
+494
| // --board-owner sets the project owner (default @me, override for org-owned ProjectV2 boards) | ||
| const boardOwnerIdx = args.indexOf('--board-owner'); | ||
| if (boardOwnerIdx !== -1 && args[boardOwnerIdx + 1]) { | ||
| const existing = capabilities['board']; | ||
| capabilities['board'] = typeof existing === 'object' && existing !== null | ||
| ? { ...existing, owner: args[boardOwnerIdx + 1]! } | ||
| : { owner: args[boardOwnerIdx + 1]! }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BoardCapabilityhardcoded--owner @mewhen shelling out togh project item-list, so users whose project boards live under an organization (e.g.https://github.com/orgs/<org>/projects/22) could not use--boardat all —ghresolved@meand failed withCould not resolve to a ProjectV2 with the number N.--board-owner <name>CLI flag (default@me); also acceptscapabilities.board.ownerin.squad/config.json.boardOwnerthrough the legacyWatchOptionsshim.Closes #1079
Test plan
npx vitest run test/watch-board-capability.test.ts— both new tests pass.npx tsc --noEmit— clean.npx eslinton the touched files — 0 errors (only pre-existingno-consolewarnings incli-entry.ts).squad watch --board --board-project 22 --board-owner my-orgagainst an org-owned ProjectV2 board and confirmgh project item-listis invoked with the configured owner.🤖 Generated with Claude Code