feat: standalone CLI (aicoach) — all harnesses in one terminal report#171
Open
felipetruman wants to merge 1 commit into
Open
feat: standalone CLI (aicoach) — all harnesses in one terminal report#171felipetruman wants to merge 1 commit into
felipetruman wants to merge 1 commit into
Conversation
Runs the same parsing/analysis pipeline as the extension against every supported harness (VS Code/Copilot, Claude Code, Codex, OpenCode) and renders reports without an editor: an ANSI terminal dashboard, plus md/json/html report files. Includes commands for summary export, per-area JSON payloads, session listing/detail, anti-patterns, and context health, with date/workspace/harness filters. Local rules/metrics stay blocked by default (no interactive approval UI in a terminal); --allow-local-rules opts in explicitly.
Comment on lines
+166
to
+172
| const totals = extractBulletMap(baseMarkdown, '## Totals'); | ||
|
|
||
| const payloadWithoutActions = { | ||
| generatedAt: new Date().toISOString(), | ||
| filter: totals['Filter'] ?? 'All data', | ||
| totals, | ||
| flow: extractBulletMap(baseMarkdown, '## Flow'), |
Comment on lines
+100
to
+103
| if (blockedLocalFiles.length > 0 && !getBool(opts, 'quiet')) { | ||
| console.error(`Local rules/metrics blocked for safety: ${blockedLocalFiles.length}`); | ||
| console.error('Pass --allow-local-rules if you trust these files.'); | ||
| } |
Comment on lines
+160
to
+167
| if (!outDir && formats.length === 1) { | ||
| writeOrPrint(contentByFormat[formats[0]]); | ||
| return; | ||
| } | ||
|
|
||
| const targetDir = path.resolve(outDir ?? './reports'); | ||
| const extByFormat: Record<ReportFormat, string> = { terminal: 'txt', md: 'md', json: 'json', html: 'html' }; | ||
|
|
Comment on lines
+40
to
+46
| // --logs-dir may repeat; collect every occurrence. | ||
| if (key === 'logs-dir') { | ||
| const current = opts[key]; | ||
| opts[key] = Array.isArray(current) ? [...current, String(value)] : [String(value)]; | ||
| } else { | ||
| opts[key] = value; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a standalone CLI (
aicoach) that runs the same read-only parsing/analysis pipeline as the extension and renders reports in a terminal — no VS Code required. This makes the coach usable from a plain shell, over SSH, and in CI/cron for people who work primarily in terminal harnesses (Claude Code, Codex, OpenCode).Commands
aicoach report— ANSI terminal dashboard (scores, priorities, context, next actions);--format md|json|html|both|all+--outwrites self-contained report filesaicoach summary— existing summary-export renderers (md/json)aicoach json <summary|activity|patterns|flow|insights|workflows|context|production|credits|wellbeing|compare>— raw payloads from the MCP formattersaicoach sessions/aicoach session --session-id <id>— paged listing and detailaicoach observe summary,aicoach measure output,aicoach improve anti-patterns|context-health--from/--to/--workspace/--harnessfilters plus--logs-diroverrides--verboseprogress goes to stderr; stdout carries only command output, soaicoach json … | jqworks. Coreconsole.info/console.debugdiagnostics are routed to stderr for the same reason.Safety: local rules/metrics stay blocked by default via a blocking
TrustGate(the CLI has no interactive approval UI);--allow-local-rulesopts in explicitly, and blocked files are reported on stderr.Build: separate
esbuild-cli.mjs→dist/cli.js(npm run build:cli); the extension pipeline inesbuild.mjsis untouched.package.jsongains twobinaliases (aicoach,ai-engineer-coach) and two scripts;src/cli.tsis registered as a knip entry.Related Issues
Relates to #46 — "would be extremely useful to collect all the information from various tools in one dashboard": the CLI surfaces every supported harness (VS Code/Copilot, Claude Code, Codex, OpenCode) in one report from the terminal. OpenCode parsing on current OpenCode versions additionally needs #170 (SQLite storage).
Checklist
npm run checkpasses (typecheck + lint + spellcheck + knip + tests) — 1227 tests,tsc --noEmitclean, ESLint 0 errors (0 new warnings), cspell 0 issues, knip cleansrc/cli/cli.test.ts: arg parsing, filters, payload extraction, next-action dedup, HTML escaping, ANSI stripping)Verification against real data
Audited on a machine with 6,086 real sessions across 67 workspaces (with #170 applied locally for OpenCode):
sessions --harness Claude→ 4,343 ·Codex→ 466 ·OpenCode→ 1,143report --format all --outproduces consistent txt/md/json/html; JSON parses and matches the dashboard totalsjson comparebreaks down per harness;measure output --fromfilters correctly