test-statusline
Scannednpx machina-cli add skill yusufalikync/ccs/test-statusline --openclawTest statusline.js
Run scripts/statusline.js with mock JSON input to verify output formatting and color-coded progress bars.
Instructions
Based on $ARGUMENTS, pick one of these test scenarios:
low — Low usage (all green)
echo '{"model":{"display_name":"Claude Opus 4"},"cost":{"total_cost_usd":0.12},"context_window":{"used_percentage":25},"workspace":{"current_dir":"/Users/test/my-project"},"session_id":"test-low"}' | node scripts/statusline.js
medium — Medium usage (yellow zone)
echo '{"model":{"display_name":"Claude Sonnet 4.5"},"cost":{"total_cost_usd":1.87},"context_window":{"used_percentage":75},"workspace":{"current_dir":"/Users/test/big-refactor"},"session_id":"test-medium"}' | node scripts/statusline.js
high — High usage (red zone)
echo '{"model":{"display_name":"Claude Opus 4"},"cost":{"total_cost_usd":5.42},"context_window":{"used_percentage":95},"workspace":{"current_dir":"/Users/test/marathon-session"},"session_id":"test-high"}' | node scripts/statusline.js
null — Null/missing values (fallback handling)
echo '{"model":{},"cost":{},"context_window":{},"workspace":{},"session_id":"test-null"}' | node scripts/statusline.js
No argument — Run all scenarios
If $ARGUMENTS is empty, run all four scenarios above sequentially and compare outputs.
Validation
After running, verify:
- Line 1 contains model name (or
?for null), folder name, and cost - Line 2 contains context progress bar with percentage
- No errors or crashes in stderr
- Null scenario shows safe fallbacks:
[?],$0.0000,0%
Report PASS/FAIL for each check.
Source
git clone https://github.com/yusufalikync/ccs/blob/main/.claude/skills/test-statusline/SKILL.mdView on GitHub Overview
Test statusline.js using mock JSON input to validate output formatting and color-coded progress bars. The skill provides four test scenarios plus a null handling case to confirm safe fallbacks and error-free runs.
How This Skill Works
Technically, you provide a JSON payload to the CLI script via standard input, invoking node scripts/statusline.js. The script renders two lines: the first shows model name, folder, and cost; the second shows a context usage progress bar with the used percentage, enabling PASS/FAIL validation per the scenarios.
When to Use It
- low — Low usage (all green)
- medium — Medium usage (yellow zone)
- high — High usage (red zone)
- null — Null/missing values (fallback handling)
- No argument — Run all scenarios sequentially
Quick Start
- Step 1: Set ARGUMENTS to one of low, medium, high, null, or leave empty for all scenarios.
- Step 2: Pipe a mock JSON payload to node scripts/statusline.js (e.g., via echo '...json...' | node scripts/statusline.js).
- Step 3: Check that the output matches the expected two-line format and that the PASS/FAIL report is correct.
Best Practices
- Use the exact mock JSON samples from the SKILL.md for reproducibility.
- Validate both Line 1 (model name/folder/cost) and Line 2 (context progress bar) outputs.
- Check null scenario for safe fallbacks: [?], $0.0000, 0%.
- Run all four scenarios (or all scenarios) when ARGUMENTS is empty to ensure end-to-end coverage.
- Inspect stderr for absence of errors or crashes.
Example Use Cases
- QA regression tests for statusline rendering to ensure formatting stability.
- CI pipelines validating CLI output formatting across scenarios.
- Demonstrations of color-coded progress bars for product demos.
- Debugging and validating null/missing data handling in statusline.js.
- End-to-end checks in a harness that compares expected vs. actual output.