feat: add info command for system diagnostics#137
Conversation
Adds `ralph-tui info` command that collects and displays system information useful for bug reports, including: - ralph-tui version - Runtime (Bun/Node) version - OS details - Config file locations and status - Installed templates - Agent detection status - Tracker configuration Available output formats: - Default: Human-readable display - --json: Machine-readable JSON - -c/--copyable: Markdown code block for GitHub issues Also updates the GitHub bug report template to request `ralph-tui info -c` output instead of manual version/platform fields.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
WalkthroughThis PR introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as CLI Handler
participant InfoCmd as Info Command
participant Collector as System Collector
participant Config as Config/Templates
participant Agent as Agent Registry
participant Formatter as Output Formatter
User->>CLI: ralph-tui info [--json|--copyable]
CLI->>InfoCmd: executeInfoCommand(args)
InfoCmd->>Collector: collectSystemInfo(cwd)
par Parallel Collection
Collector->>Collector: Detect runtime (Bun/Node)
Collector->>Collector: Read OS info
Collector->>Config: Load stored config
Collector->>Config: Enumerate templates
Collector->>Agent: Initialize agents
Collector->>Agent: Resolve tracker
end
Collector-->>InfoCmd: SystemInfo object
alt Format Type
InfoCmd->>Formatter: formatSystemInfo() or
InfoCmd->>Formatter: formatForBugReport() or
InfoCmd->>Formatter: JSON serialization
end
Formatter-->>InfoCmd: Formatted output
InfoCmd-->>User: Display diagnostics
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #137 +/- ##
==========================================
+ Coverage 47.28% 47.69% +0.41%
==========================================
Files 60 61 +1
Lines 13447 13664 +217
==========================================
+ Hits 6358 6517 +159
- Misses 7089 7147 +58
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/ISSUE_TEMPLATE/bug_report.yaml:
- Around line 18-21: Update the placeholder example in the bug report template
so the ralph-tui version matches the stated requirement for the info command;
replace the placeholder line "ralph-tui: 0.2.0" with "ralph-tui: 0.2.1" within
the placeholder block so the example and the "info command requires v0.2.1 or
higher" note are consistent.
In `@src/commands/info.ts`:
- Around line 284-298: The help text and parsing in executeInfoCommand disagree:
the code currently reads cwd via args.find((a) =>
a.startsWith('--cwd='))?.split('=')[1] which both enforces an equals form and
breaks on paths containing '='; update parsing to accept both forms and avoid
split-truncation by checking for a standalone flag or an equals assignment
(e.g., if an arg equals '--cwd' take the next args element, else if it
startsWith('--cwd=') take the substring after the first '=' using indexOf) and
fall back to process.cwd(); alternatively, if you prefer the simpler change,
update the displayed help to show --cwd=<path> to match the current
implementation, but the preferred fix is to make executeInfoCommand robust to
both '--cwd path' and '--cwd=path' and handle '=' characters safely when
extracting the value.
🧹 Nitpick comments (2)
src/commands/info.ts (2)
17-40: Redundant outer try-catch block.The outer
try-catch(lines 38-40) is unnecessary since all errors from the inner loop are already caught by the innertry-catchat line 34. The version detection logic is sound, but the structure could be simplified.Suggested simplification
// Package version - imported at runtime let packageVersion = 'unknown'; -try { - // Try to read from package.json in various locations - const possiblePaths = [ - join(__dirname, '../../package.json'), - join(__dirname, '../package.json'), - join(process.cwd(), 'package.json'), - ]; - for (const p of possiblePaths) { - try { - const pkg = await readFile(p, 'utf-8'); - const parsed = JSON.parse(pkg); - if (parsed.name === 'ralph-tui') { - packageVersion = parsed.version; - break; - } - } catch { - // Try next path - } +// Try to read from package.json in various locations +const possiblePaths = [ + join(__dirname, '../../package.json'), + join(__dirname, '../package.json'), + join(process.cwd(), 'package.json'), +]; +for (const p of possiblePaths) { + try { + const pkg = await readFile(p, 'utf-8'); + const parsed = JSON.parse(pkg); + if (parsed.name === 'ralph-tui') { + packageVersion = parsed.version; + break; + } + } catch { + // Try next path } -} catch { - // Version remains unknown }
119-128: Redundant dynamic import ofreaddir.
readdircould be imported statically alongsidereadFileat line 9, avoiding the dynamic import overhead on each call.Suggested fix
Update the import at line 9:
-import { access, constants, readFile } from 'node:fs/promises'; +import { access, constants, readFile, readdir } from 'node:fs/promises';Then simplify the usage:
// Check templates directory const templatesDir = join(getUserConfigDir(), 'templates'); const installedTemplates: string[] = []; try { - const { readdir } = await import('node:fs/promises'); const files = await readdir(templatesDir); installedTemplates.push(...files.filter((f) => f.endsWith('.hbs'))); } catch { // Directory doesn't exist or can't read }
- Update bug report template placeholder to show v0.2.1 (matches stated requirement) - Fix --cwd argument parsing to handle both '--cwd path' and '--cwd=path' forms - Use substring instead of split to preserve '=' characters in paths - Add tests for parseCwdArg covering edge cases
…mplat feat: add info command for system diagnostics
Summary
ralph-tui infocommand that collects and displays system information useful for bug reportsralph-tui info -coutputWhat the info command provides
Output formats
--json: Machine-readable JSON for scripts-c/--copyable: Markdown code block for GitHub issuesExample output
Test plan
bun run typecheckpassesbun run buildpassesbun run lintpasses (only pre-existing warnings)bun test src/commands/info.test.ts- 25 tests passralph-tui infodisplays system inforalph-tui info -coutputs copyable formatralph-tui info --jsonoutputs valid JSONralph-tui info --helpshows helpSummary by CodeRabbit
Release Notes
infosubcommand to display comprehensive system diagnostic information (version, runtime, OS, configuration, templates, agent, and tracker details)✏️ Tip: You can customize this high-level summary in your review settings.