Skip to content

Add module headers describing each command's flow and failure modes - #41

Merged
rafaeelricco merged 1 commit into
mainfrom
rafaeelricco/module-header-comments
Sep 27, 2026
Merged

rafaeelricco merged 1 commit into
mainfrom
rafaeelricco/module-header-comments

Conversation

@rafaeelricco

Copy link
Copy Markdown
Owner

What's New

Command Flow Headers

  • index.ts documents argv parsing, command dispatch, and exit codes. It also records that a rejection inside a command's create() (a failed token refresh, or a missing config for model/effort) exits 1 without printing anything.
  • src/cli/commit.ts, split.ts, setup.ts, branch.ts and doctor.ts get numbered ASCII flows showing each command's steps, where a cancelled prompt lands, and who logs errors.

Git and Isolated Commits

  • src/infra/git/repo.ts documents the isolated commit behind split commits: the temp index, the worktree snapshot taken around the pre-commit hook, the core.hooksPath copy that stops the hook from running twice, and the update of the real index afterwards.
  • src/infra/shell.ts, version-check.ts and github/pr.ts get short headers. The pr.ts header notes that getOpenPullRequest has no state filter, so closed or merged PRs come back as found.

LLM Pipeline and Auth

  • src/domain/llm/router.ts shows the shared pipeline (effort floor, prompt, provider dispatch, parse, retry) and how three retry layers stack: the SDK's own retries, the effort-fallback retry, and withTransientRetry.
  • retry.ts, auth-resolver.ts, src/domain/split/plan.ts and src/domain/commit/prompts.ts document the transient-error policy, how tokens are refreshed and saved, split-plan validation, and which diff each prompt receives.
  • src/infra/auth/google.ts, openai.ts and xai.ts lay out the browser PKCE and device-code sign-in steps, their timeouts, and refresh behavior.

Changed Files

File Change Type Summary
index.ts Modified Entry flow, exit codes, silent create() failures
src/cli/commit.ts Modified Route, interact loop, commit and push flow
src/cli/split.ts Modified Plan edit loop, sequential apply with no rollback
src/cli/setup.ts Modified Onboarding prompts, sign-in per auth method, save last
src/cli/branch.ts Modified Suggest, pick, confirm, git switch -c
src/cli/doctor.ts Modified Failures become rows; always exits 0
src/infra/git/repo.ts Modified Isolated commit steps and hook handling
src/infra/github/pr.ts Modified PrLookup outcomes; no state filter
src/infra/shell.ts Modified execBin vs execBinInteractive failure channels
src/infra/version-check.ts Modified Daily cache, detached background refresh
src/domain/llm/router.ts Modified Shared LLM pipeline and retry layers
src/domain/llm/retry.ts Modified Transient patterns, attempts, retry prompt
src/domain/llm/auth-resolver.ts Modified Token refresh and saving
src/domain/split/plan.ts Modified Split-plan parse and validation steps
src/domain/commit/prompts.ts Modified Which diff each prompt gets; JSON contracts
src/infra/auth/google.ts Modified PKCE + localhost callback flow
src/infra/auth/openai.ts Modified Device-code flow and refresh
src/infra/auth/xai.ts Modified Device-code flow, proxy, client version

Testing & Feedback

Only comments changed; no runtime code was touched. pnpm typecheck, pnpm lint and prettier --check pass on the changed files. Please check that the headers match your understanding, especially the isolated-commit steps in repo.ts and the retry counts in router.ts and retry.ts, and flag any header that feels too long for its file.

If you find any bugs or have recommendations for improvements, please open an issue and assign it to me.

- Add a header to `index.ts` that maps argv parsing, command dispatch, and which startup failures exit without a message.
- Add headers to `src/cli/commit.ts`, `split.ts`, `setup.ts`, `branch.ts` and `doctor.ts` showing each command's steps, cancel behavior, and error logging.
- Add a header to `src/infra/git/repo.ts` that walks through the isolated commit behind split commits, including the pre-commit hook handling.
- Add headers to `src/domain/llm/router.ts`, `retry.ts` and `auth-resolver.ts` covering the shared LLM pipeline, the stacked retry layers, and OAuth token refresh.
- Add headers to `src/domain/split/plan.ts` and `src/domain/commit/prompts.ts` covering split-plan validation and which diff each prompt receives.
- Add headers to the Google, OpenAI and xAI sign-in flows in `src/infra/auth`.
- Add headers to `src/infra/shell.ts`, `version-check.ts` and `github/pr.ts`, noting that `getOpenPullRequest` does not filter by state.
@rafaeelricco rafaeelricco self-assigned this Sep 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T14:42:40.796736Z 36b7530 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@rafaeelricco
rafaeelricco merged commit 31bd8b6 into main Sep 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant