✨ feat: doctor checks a Claude cloud session instead of refusing it

Merged
AT
1mo ago
+448-27

Slice: #51

Builds State #171 of P-22: process-rules doctor checks a Claude cloud session instead of refusing it. A cloud session ran doctor on 2026-11-07 and got only "process-rules supports macOS only", exit 1.

  • src/doctor.ts: when CLAUDE_CODE_REMOTE=true (the test session-start and as-agent use), doctor runs cloudDoctor before it looks for a token store. Same grouped ✓/▲/✗ layout, a fix per problem, exit 1 on any ✗:
    • This cloud session: .github/process-rules/cloud-setup.sh against the workflow's pin (✗ when they disagree or the file is missing or isn't onboard's → process-rules onboard again; ▲ when the workflow pins no one version); the running CLI against that release (▲ → bash .github/process-rules/cloud-setup.sh, or a new session); /opt/process-rules/from-setup (▲ → paste what process-rules cloud-setup prints into the Setup script, once).
    • GitHub: the account the proxy acts as is one of the settings' agents, as session-start checks it (✗ → connect claude.ai's GitHub as the agent); PROCESS_RULES_AGENT is set to an agent, so session-start lifted the lock (✗ → a new session).
    • This repo: hooksHittingLock, as on a Mac.
      On any other machine without a token store, the refusal stands. The Mac path is unchanged; its printing and the hook findings moved into report and repoFindings, which both paths share.
  • src/cloud.ts: repoReleases(sys, root) reads the workflow's one pin and the version the cloud setup file installs; session-start's cloudDrift now uses it too. An unreadable setup file counts as missing.
  • src/session-start.ts: exports repoRoot for doctor.
  • Tests come first: 16 new cloud tests on a fake Sys (Linux, no keychain, proxy token), plus Linux without CLAUDE_CODE_REMOTE still refused.
  • README (Agent identity, doctor, Claude cloud sessions) and docs/decisions.md are updated. The version is not bumped; the coordinator does that.

pnpm check: 959 tests pass, 99.35% line coverage.

🤖 Generated with Claude Code


Summary by cubic

process-rules doctor now checks a Claude cloud session instead of refusing with "process-rules supports macOS only". On any other machine without a token store, the refusal stands; the Mac path is unchanged.

  • Runs cloud checks before looking for a token store when CLAUDE_CODE_REMOTE=true.
  • Checks the repo's cloud setup file against the workflow's pin, the running CLI release, the Setup script's /opt/process-rules/from-setup mark, and the proxy account among the settings' agents; the session-start identity must match that account, case-insensitively, in the same grouped ✓/▲/✗ layout with a fix per problem.
  • Shares repoReleases (the pin and setup-file reader) with session-start's drift check; exports repoRoot from session-start for doctor.
  • Adds 16 cloud doctor tests on a fake Linux Sys; non-cloud Linux is still refused.