Skip to content

feat: add doctor command and auto-detect editors#166

Merged
rhuanbarreto merged 3 commits into
mainfrom
feat/telemetry-doctor-editor-detect
Mar 24, 2026
Merged

feat: add doctor command and auto-detect editors#166
rhuanbarreto merged 3 commits into
mainfrom
feat/telemetry-doctor-editor-detect

Conversation

@rhuanbarreto

Copy link
Copy Markdown
Contributor

Summary

  • Telemetry enrichment: Added 4 new per-command outcome events (check_completed, init_completed, upgrade_completed, login_completed) with rich properties. Enriched common properties on every event (is_wsl, install_method, has_project, adr_count, adr_with_rules_count). Added option-flag presence tracking to command_executed. Failed upgrades now tracked too.
  • archgate doctor command: New diagnostic command that reports system environment, install method, project context, editor CLI availability, and plugin integrations. Supports --json output.
  • Editor auto-detection: When --editor is omitted in a TTY, the CLI detects available editor CLIs and prompts the user to select which to configure (multi-select for init/plugin install, single-select for plugin url). Non-TTY falls back to "claude" for backward compatibility. Applies to init, plugin install, and plugin url.
  • Exit code fixes: Pre-main Bun/platform guards now use logError() + exit(1) instead of raw throw; upgrade "unsupported platform" changed from exit(2) to exit(1); login status/logout wrapped in try-catch per ARCH-012.
  • Config: Relaxed oxlint max-lines from 300 to 500.
  • Docs: Updated telemetry reference and CLI commands reference (EN + pt-BR).

Test plan

  • bun run validate passes (599 tests, 22/22 ADR checks, build compiles)
  • archgate doctor outputs correct system info in TTY and --json modes
  • archgate init without --editor prompts for editor selection in TTY
  • archgate plugin install without --editor prompts for editor selection in TTY
  • archgate plugin url without --editor prompts for single editor selection in TTY
  • Non-TTY invocations (agent context) default to "claude" without prompting
  • Telemetry events in PostHog show enriched properties

rhuanbarreto and others added 2 commits March 24, 2026 13:03
- Enrich PostHog telemetry with per-command outcome events
  (check_completed, init_completed, upgrade_completed, login_completed),
  common properties (is_wsl, install_method, project context), and
  option-flag presence tracking on command_executed

- Add `archgate doctor` command for system diagnostics: environment,
  install method, project context, editor CLIs, and plugin integrations.
  Supports --json output.

- Add editor auto-detection: when --editor is omitted in a TTY, detect
  available editor CLIs and prompt the user to select which to configure.
  Applies to init, plugin install, and plugin url. Non-TTY falls back
  to "claude" for backward compatibility.

- Fix exit codes: pre-main Bun/platform guards now use logError + exit(1)
  instead of throw; upgrade "unsupported platform" changed from exit(2)
  to exit(1); login status/logout wrapped in try-catch (ARCH-012)

- Track failed upgrades in telemetry (catch block)

- Relax oxlint max-lines from 300 to 500

- Update telemetry and CLI command docs (EN + pt-BR)
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 24, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 468356b
Status: ✅  Deploy successful!
Preview URL: https://8cd0d6de.archgate-cli.pages.dev
Branch Preview URL: https://feat-telemetry-doctor-editor.archgate-cli.pages.dev

View logs

@rhuanbarreto rhuanbarreto changed the title feat: enrich telemetry, add doctor command, and auto-detect editors feat: add doctor command, and auto-detect editors Mar 24, 2026
@rhuanbarreto rhuanbarreto changed the title feat: add doctor command, and auto-detect editors feat: add doctor command and auto-detect editors Mar 24, 2026
Extract shared helpers into src/helpers/install-info.ts:
- detectInstallMethod() — previously duplicated in telemetry.ts,
  doctor.ts, and sentry.ts (4 copies)
- getProjectContext() — previously duplicated in telemetry.ts and
  doctor.ts (2 copies)

Also deduplicate editor detection in doctor.ts by reusing
detectEditors() from editor-detect.ts instead of calling
isClaudeCliAvailable/etc directly.
@rhuanbarreto rhuanbarreto merged commit ec5be2a into main Mar 24, 2026
9 checks passed
@rhuanbarreto rhuanbarreto deleted the feat/telemetry-doctor-editor-detect branch March 24, 2026 12:29
@github-actions github-actions Bot mentioned this pull request Mar 24, 2026
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