Repository navigation
feat: add get-pr-status command to dev-workflow - #193
Conversation
- Add get-pr-status command to check PR lifecycle state (merged/open/closed/not_found) - Refactor Step type from function to object with name and execute properties - Add failedStep tracking to workflow results - Write verbose errors to log file on failure, return short JSON response - Update format-complete-task-result to include failedStep and logFile - Add task-check.md agent for code review Co-Authored-By: Claude <[email protected]>
- Extract DELETED_USER_PLACEHOLDER constant to replace inline comment - Rename PRStatus to PRFeedbackStatus in get-pr-feedback for clarity - Rename PRStatus to PRLifecycleStatus in get-pr-status for clarity Co-Authored-By: Claude <[email protected]>
Deploying living-architecture with
|
| Latest commit: |
bda85bb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://191aa320.living-architecture.pages.dev |
| Branch Preview URL: | https://issue-192-add-get-pr-status.living-architecture.pages.dev |
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughRefactors workflow steps to object-shaped Steps with named execute, adds PR state/mergeable tracking and head SHA handling, updates PR resolution and commit validation, enhances failure reporting with failedStep and per-step log files, and extends get-pr-feedback context, docs, and CLI command usage. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Runner as WorkflowRunner
participant Step as Step{name, execute}
participant Git as Git Client
participant GH as GitHub Client
participant CI as CI Watcher
participant Formatter as formatCompleteTaskResult
Runner->>Step: step.execute(ctx)
Step->>Git: headSha() (submit-pr)
Step->>GH: findPRForBranchWithState(branch) / getMergeableState(prNumber)
Step->>CI: watchCI(prNumber, expectedSha)
CI-->>Step: CI status (success / failure details)
Step-->>Runner: StepResult (ok | failed + details)
Runner->>Formatter: formatCompleteTaskResult(result, ctx)
Formatter->>Runner: CompleteTaskResult (includes failedStep? logFile?)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@tools/dev-workflow/complete-task/format-complete-task-result.ts`:
- Around line 132-143: The code builds logFile via string concat and calls
writeFileSync without error handling; replace concatenation with path.join by
importing path and set logFile = path.join(ctx.reviewDir, `${failedStep}.log`),
and wrap the writeFileSync call in a try/catch around the block handling
formatted.nextAction === 'fix_errors' (referencing formatted.nextAction,
failedStep, ctx.reviewDir, logFile, and writeFileSync) so that any FS error is
caught and the function returns a structured failure object (success: false)
that includes the error message and any partial state instead of allowing the
workflow to crash.
In `@tools/dev-workflow/complete-task/steps/submit-pr.ts`:
- Around line 9-17: The submitPR step currently re-checks prTitle, prBody, and
commitMessage even though buildWorkflowContext (in context-builder.ts) already
validates/throws WorkflowError for missing required properties; remove the
redundant guard in submitPR.execute (the if that returns failure) and rely on
the validated CompleteTaskContext values (prTitle, prBody, commitMessage)
provided by buildWorkflowContext; update any type assertions or function
signatures in submitPR.execute to use the non-null context properties directly.
In `@tools/dev-workflow/external-clients/github.ts`:
- Line 34: The PRWithState interface is defined on a single line which is
inconsistent with other multi-line interfaces in this file; change the
declaration of PRWithState (symbol: PRWithState) to the same multi-line style
used by PR and CreatePROptions by expanding it across multiple lines with the
interface keyword, property line "state: PRState", and closing brace on its own
line to match file formatting conventions.
Users should set GH_TOKEN in their shell config instead. Co-Authored-By: Claude <[email protected]>
- Add validateConventionalCommit to check PR title format locally - Remove dangerous fallback of using issue title without validation - Make watchCI fail fast on first failed check instead of waiting for all - Include detailed CI error output (summary, details, URL) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@tools/dev-workflow/complete-task/resolve-pr-details.ts`:
- Around line 17-27: The code currently assigns commitMessage = cliCommitMessage
?? prTitle which allows missing --commit-message to be satisfied by a fallback;
change this so commitMessage is taken only from cliCommitMessage (remove
fallback) and update the validation to check for cliCommitMessage explicitly;
specifically, set commitMessage = cliCommitMessage, keep prTitle/prBody
assignment as-is, and modify the if guard to throw the WorkflowError when
!prTitle || !prBody || !cliCommitMessage so that --commit-message is required
(referencing variables: cliCommitMessage, commitMessage, prTitle, prBody, and
WorkflowError).
In `@tools/dev-workflow/external-clients/github.ts`:
- Around line 25-27: Export the intended public API types and constant so
consumers can type results from findPRForBranchWithState: add exports for
PRState, PRWithState, and DELETED_USER_PLACEHOLDER (the existing symbols) from
this module. Specifically, mark the type alias PRState, the interface/type
PRWithState, and the constant DELETED_USER_PLACEHOLDER as exported so other
modules can import them when using findPRForBranchWithState.
- Around line 56-64: The function determinePRState is currently not exported but
is part of the module's public API; export it so consumers can import it (either
add the export keyword to the function declaration "export function
determinePRState(...)" or add "export { determinePRState }" to the module's
exports), ensuring the exported symbol name remains determinePRState and its
signature (mergedAt: string | null, state: string): PRState is unchanged.
♻️ Duplicate comments (1)
tools/dev-workflow/external-clients/github.ts (1)
34-34: Missing export and formatting inconsistency.The interface should be exported for consumers (covered above). The single-line format was already flagged in a past review comment.
Proposed fix
-interface PRWithState extends PR {state: PRState} +export interface PRWithState extends PR { + state: PRState +}
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tools/dev-workflow/external-clients/github.ts (1)
94-106: Resolve unused export warning forgetRepoInfo.CI reports
getRepoInfoas an unused export. Since it’s only used internally here, drop theexportto clear the warning (or add a real external consumer if intended to be public).🧹 Suggested fix
-export async function getRepoInfo(): Promise<{ +async function getRepoInfo(): Promise<{ owner: string repo: string }> {
🤖 Fix all issues with AI agents
In @.claude/commands/post-merge-completion.md:
- Around line 55-63: Replace usage of the old command name get-pr-feedback with
the new get-pr-status in the post-merge flow: update the pnpm nx invocation and
any text references that say dev-workflow:get-pr-feedback to
dev-workflow:get-pr-status, and ensure the subsequent logic that parses the
returned JSON `state` field (`merged`, `open`, `closed`, `not_found`) remains
the same so the check that stops when state !== `merged` still uses the new
command output.
In `@tools/dev-workflow/get-pr-feedback/get-pr-feedback.ts`:
- Around line 9-15: The prStateSchema Zod schema is currently declared but not
exported; update the declaration of prStateSchema to export it (e.g., make it
"export const prStateSchema") so it complies with the Zod schema export rule and
remains usable by other modules and by getPRFeedbackContextSchema which
references it.
Co-Authored-By: Claude <[email protected]>
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.claude/hooks/task-completion-reminder.sh:
- Line 8: Update the user-facing text inside the "additionalContext" string:
correct the grammar by replacing "Pending checks is NOT a blocker" with "Pending
checks are NOT a blocker" so the subject-verb agreement is correct; ensure the
replacement preserves surrounding punctuation and newline formatting within the
same "additionalContext" string literal.



References
PR #186 - discovered during post-merge-completion workflow
Summary
The /post-merge-completion skill needs to check if a PR is merged, but get-pr-feedback is designed for active development (finding open PRs with feedback to address). Create a separate get-pr-status command that returns PR lifecycle state.
Full Details
Problem
The post-merge-completion instructions use a GitHub CLI command that is blocked by hooks. The workaround (using the API directly) works but isn't documented.
get-pr-feedback cannot be reused because:
Solution
Create get-pr-status command that returns:
{ "state": "merged" | "open" | "closed" | "not_found", "prNumber": 186, "prUrl": "..." }Files to modify
Acceptance Criteria
Summary by CodeRabbit
New Features
Improvements
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.