Skip to content

refactor(doctor/status): unify daemon health checks#872

Closed
jackwener wants to merge 10 commits intomainfrom
refactor/simplify-core-modules
Closed

refactor(doctor/status): unify daemon health checks#872
jackwener wants to merge 10 commits intomainfrom
refactor/simplify-core-modules

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Add getDaemonHealth() as single entry point for daemon status checks, returning discriminated union: 'stopped' | 'no-extension' | 'ready'
  • Delete browser/discover.ts (pure wrapper layer with no value)
  • Remove isExtensionConnected() (subsumed by getDaemonHealth)
  • Simplify doctor.ts: remove double status check and self-managed auto-start — bridge.connect() already handles auto-start
  • Update bridge.ts to throw typed BrowserConnectError instead of plain Error
  • Simplify commanderAdapter.ts renderError(): use err.kind directly instead of making a separate real-time status check that could race/fail
  • Update execution.ts fail-fast to use getDaemonHealth() with typed error kind

Addresses: 5 fragmented status-check paths → 1 unified entry point. Net deletion of code.

Test plan

  • All 1267 unit/integration tests pass (169 test files)
  • Manual: opencli doctor shows correct daemon/extension status
  • Manual: opencli daemon status still works
  • Manual: Running a browser command with no daemon auto-starts correctly
  • Manual: Running a browser command with daemon but no extension shows typed error

jackwener and others added 10 commits April 5, 2026 03:06
…r classification, streamline cascade/interceptor, clean up synthesize

1. Remove root-level shim files (errors.ts, logger.ts, registry.ts, types.ts, utils.ts, launcher.ts) — update all ~840 adapter imports to reference src/ directly
2. Consolidate interceptor: reuse shared DISGUISE_FN in tap interceptor instead of reimplementing
3. Unify error classification: single ClassifiedError type with icon/exitCode/hint lookup table, eliminating duplicated pattern matching between resolveExitCode and renderError
4. Simplify cascade probe: replace repetitive switch cases with PROBE_OPTIONS lookup map
12. Clean up synthesize.ts: remove deprecated snake_case field aliases (recommended_args, recommended_columns, recommendedColumnsLegacy) and unnecessary constant aliases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update all documentation and skill files to reference src/ directly,
matching the shim removal in the previous commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix imports in newly added deep-research adapter files that were
still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests now expect /search_result/<id> for bare note IDs (matching
the note-helpers.ts change from PR #774) and updated empty-shell
hint assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix imports in newly merged LessWrong and hupu/mentions adapter
files that were still referencing the deleted root shim files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ode paths

- Add getDaemonHealth() as single entry point for daemon status checks
  returning a discriminated union: 'stopped' | 'no-extension' | 'ready'
- Delete browser/discover.ts (was a thin wrapper adding no value)
- Remove isExtensionConnected() (replaced by getDaemonHealth)
- Simplify doctor.ts: remove self-managed auto-start and double status
  check — bridge.connect() already handles auto-start, so doctor now
  does 1 live test + 1 health check instead of 2 checks + 1 bridge + 1 live + 1 check
- Update bridge.ts to throw typed BrowserConnectError (via formatBrowserConnectError)
  instead of plain Error, enabling precise catch without string matching
- Extract _pollUntilReady() in bridge.ts to deduplicate polling loops
- Simplify commanderAdapter.ts renderError(): use err.kind directly
  instead of making a separate real-time status check that could race/fail
- Update execution.ts fail-fast to use getDaemonHealth() with typed error kind
- Update all affected tests (doctor, daemon-client, browser bridge)
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