Skip to content

feat(cli): add environment doctor command - #100

Merged
OthmaneZ05 merged 2 commits into
mainfrom
feat/cli-doctor
Sep 8, 2026
Merged

OthmaneZ05 merged 2 commits into
mainfrom
feat/cli-doctor

Conversation

@OthmaneZ05

@OthmaneZ05 OthmaneZ05 commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary of Changes

Adds torollo doctor as a single support command for validating a local Torollo setup before or after start fails, and reduces the work required during the package's first launch.

  • Six environment checks: Node.js satisfies the package engine, the Docker CLI is installed, the exact Docker daemon Torollo will target is reachable, ports 23232/23233 are available, at least 2 GB is free for Torollo data and images, and the installed Torollo package has a valid version.
  • Actionable failures: daemon errors keep the existing stable reasons and OS-specific fixes for missing sockets, permissions, refused connections, timeouts, and unknown responses. Blocking failures return exit code 1. Occupied default ports are warnings because start already selects replacements.
  • Support report: torollo doctor --json emits a versioned, stable report with system metadata, check ids, statuses, details, and hints. Home-directory paths are redacted to ~; JSON mode writes no progress or color noise to stdout.
  • CLI integration: help and argument validation cover both commands, and a failed torollo start now points users to the full doctor report.
  • Lighter first launch: the 1.32 GB MongoDB image is no longer preloaded when Torollo starts. MongoDB remains fully supported and is downloaded automatically when the first MongoDB node is created.
  • Documentation and packaging: the README documents both formats, the root test command includes the new suite, and the published npm allowlist includes the doctor implementation while excluding its tests.

Types of Changes

  • New feature / node type addition
  • Bug fix (non-breaking change resolving an issue)
  • Refactoring / structural cleanup
  • Documentation update

Verification & Testing

Automated Checks

  • Run npm run lint successfully with no errors (backend clean; frontend: 0 errors and 5 pre-existing warnings in untouched files)
  • Run npm run build successfully with no compilation errors (backend and frontend)
  • Run root npm test successfully: 39/39 CLI tests
  • Run backend npm test -- --runInBand successfully: 509/509 tests
  • Run frontend npm test -- --maxWorkers=1 successfully: 371/371 tests
  • Run the complete CLI suite under CI's Node 20 runtime successfully: 39/39 tests
  • Run npm pack --dry-run successfully, including the full prepack build

Manual Verification

  • Ran node bin/cli.js doctor against the real local Docker daemon: all six checks passed and the command exited 0.
  • Ran node bin/cli.js doctor --json, parsed the result, and confirmed schemaVersion: 1, ok: true, the six stable check ids, and exit 0.
  • Exercised invalid CLI arguments and confirmed they print usage and exit 1.
  • Simulated old Node, missing Docker CLI, missing/default and permission-denied daemon sockets, occupied ports, low disk, and an unavailable disk measurement through the testable check adapters. Blocking checks fail with hints; port and measurement uncertainty remain warnings.
  • Verified that startup now prepares four images without pulling MongoDB, while the existing first-use image path remains covered.
  • Inspected the packed file list: bin/lib/doctor.js is present and bin/lib/doctor.test.js is excluded.

Checklist

  • My code follows the repository's code style and lint standards
  • I have updated the documentation or instructions if necessary
  • All unit and integration tests are passing

@OthmaneZ05
OthmaneZ05 requested a review from Derssa as a code owner September 8, 2026 04:12
@OthmaneZ05
OthmaneZ05 merged commit 79ec6da into main Sep 8, 2026
4 checks passed
@OthmaneZ05
OthmaneZ05 deleted the feat/cli-doctor branch September 8, 2026 04:39
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