feat: add srtd doctor command for setup diagnostics#60
Conversation
New read-only diagnostic command that validates SRTD configuration: - Config file exists and schema valid - Template/migration directories exist with correct permissions - Build log integrity checks - Database connectivity test - Template count verification Includes 29 new unit tests for doctor check functions.
🦋 Changeset detectedLatest commit: 34421b6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
- Coverage 80.68% 79.85% -0.84%
==========================================
Files 44 46 +2
Lines 2061 2219 +158
Branches 513 546 +33
==========================================
+ Hits 1663 1772 +109
- Misses 398 447 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||
- Add srtd doctor to readme demo video - Add missing tests for checkLocalBuildLogValid (invalid JSON/schema) - Use SEPARATOR constant for consistent UI width
|
@claude review please |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
@claude review please |
This comment was marked as outdated.
This comment was marked as outdated.
Address code review feedback: if write succeeds but cleanup fails, the directory is still writable. Use finally block with ignored cleanup errors to prevent incorrect failure reports.
|
@claude review please - addressed writability check feedback |
This comment was marked as outdated.
This comment was marked as outdated.
- Add E2E tests covering help, all 10 checks, exit code, summary - Replace process.exit() with process.exitCode for graceful cleanup - Add hint field to DoctorCheckResult for actionable suggestions - Add actionable hints to all 10 doctor checks - Add test for cleanup failure scenario (write succeeds, unlink fails) Addresses Claude code review feedback on PR #60.
|
/review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
@claude review |
|
Claude finished @t1mmen's task in 1m 58s —— View job Code Review:
|
Capture setTimeout ID and clear it after Promise.race completes to prevent timer callbacks from holding references after the function returns. Also ensure cleanup in finally block for edge cases.
|
@claude /review |
|
Claude finished @t1mmen's task in 1m 44s —— View job Code Review:
|
Wait for connection promise to settle before disposing to prevent pool.end() racing with pool.connect() when timeout fires first.
The previous fix to wait for connectionPromise to settle before dispose caused unexplained E2E test failures in CI. The dispose() method already handles cleanup gracefully with its own timeout, making the additional wait unnecessary for practical purposes. Updated doc comment to clarify the disposal behavior.
|
@claude re-review please |
1 similar comment
This comment was marked as outdated.
This comment was marked as outdated.
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Claude finished @t1mmen's task in 2m 31s —— View job Re-review:
|
The template directory was removed in main but is needed for the doctor command E2E tests to pass (checkTemplateCount requires at least one template).
8bfd7f2 to
b857e27
Compare
Capture and display the actual error message instead of a generic message, improving debugging when the template directory check fails.
User description
Summary
New
srtd doctorcommand that validates your SRTD configuration and diagnoses setup issues.What it does
Runs 10 diagnostic checks in sequence:
srtd.config.jsonis presenttemplateDirpath existsmigrationDirpath exists.srtd.buildlog.jsonintegrity.srtd.buildlog.local.jsonintegrityOutput Example
Implementation
src/utils/doctorChecks.ts- Pure check functions (testable)src/commands/doctor.ts- Command orchestrationTest plan
PR Type
Enhancement
Description
Add
srtd doctorcommand for setup diagnosticsImplement 10 diagnostic checks as pure, testable functions
Integrate doctor command into CLI and interactive menu
Add 29 comprehensive unit tests for all check functions
Diagram Walkthrough
File Walkthrough
doctorChecks.test.ts
Comprehensive unit tests for doctor checkssrc/tests/doctorChecks.test.ts
runAllChecksorchestration functiondoctorChecks.ts
Pure doctor check functions implementationsrc/utils/doctorChecks.ts
runAllChecksorchestration functiondoctor.ts
Doctor command orchestration and outputsrc/commands/doctor.ts
doctorCommandfor CLImenu.ts
Add doctor to interactive menusrc/commands/menu.ts
cli.ts
Register doctor command in CLIsrc/cli.ts
doctorCommandmoduleconfig-doctor.md
Changelog entry for doctor command.changeset/config-doctor.md
srtd doctorcommand in changelog