Conversation
The protected-main doctor path was carrying sandbox bootstrap, nested execution, auto-commit, finish, merge-back, lock sync, scaffold sync, JSON emission, and console reporting inside one long routine. This refactor adds JSDoc contracts for the summary/result payloads and splits the lifecycle into named helpers so the flow is easier to reason about and safer to change. Constraint: Must preserve gx doctor protected-main behavior and output wording Rejected: Replace the parser or migrate shell helpers in the same PR | scope too broad for one reversible cleanup pass Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep future parser and shell-runtime migrations separate until the protected-main doctor lifecycle remains green under install.test.js Tested: node --check bin/multiagent-safety.js; node --test --test-name-pattern="doctor on protected main|doctor forwards --no-wait-for-merge|doctor compacts auto-finish failures" test/install.test.js; node --test test/install.test.js; openspec validate agent-codex-refactor-cli-doctor-foundations-2026-04-22-10-50 --type change --strict; openspec validate --specs Not-tested: node --test test/metadata.test.js remains red because scripts/agent-branch-start.sh already diverges from templates/scripts/agent-branch-start.sh outside this diff
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.
Automated by gx branch finish (PR flow).