Skip to content

fix(cli): validate, analyze options, report server exposure, NaN bus factor; add roadmap - #20

Merged
markhazleton merged 2 commits into
mainfrom
chore/roadmap-and-cli-fixes
Nov 21, 2026
Merged

markhazleton merged 2 commits into
mainfrom
chore/roadmap-and-cli-fixes

Conversation

@markhazleton

Copy link
Copy Markdown
Owner

Summary

Two changes from the 2026-11-21 code review:

  1. DevSpark roadmap (.devspark.work/roadmap/): nine proposed Prospective Specs, seven small findings, and the open items from earlier planning records, all in one place.
  2. Fixes for four of those findings (F1 to F4), listed below.

Fixes

Problem Fix
F1 git-spark validate always printed "Failed to validate Git repository". A dynamic import had no .js extension, so Node couldn't load it. Import ../utils/git.js.
F2 html --serve listened on every network interface and sent Access-Control-Allow-Origin: *, so anyone on the local network could read the report, including author emails. Listen on 127.0.0.1 only and remove the CORS headers. Requests other than GET and HEAD get a 405.
F3 git-spark analyze only read --repo. --days, --format, --output, --path and the other global options were silently ignored. Merge the parent command's options, as the html command already does.
F4 Bus Factor showed NaN% when the date range had no commits. New busFactorShare() helper returns 0. It replaces the same calculation in 7 places: the CLI summary, health check, HTML command summary, report keyMetrics, and the console, HTML and Markdown reports.

The CHANGELOG [Unreleased] section is updated, and the roadmap now marks F1 to F4 as fixed.

Verification

  • Lint and type-check are clean. All 350 tests pass, and coverage is unchanged (80.2% branches, 96.2% functions, 94.93% lines).
  • New file test/cli-fixes-regression.test.ts:
    • It scans src/ and fails if any relative import lacks .js. This fails on the old code. Jest finds files without the extension, so a test that ran the command would have passed even with the bug.
    • It tests busFactorShare for an empty window.
    • It tests the report server: no CORS header, and 405 for OPTIONS and POST.
  • I also checked against the built CLI:
    • validate now reports a valid repository.
    • analyze --format json writes a JSON report.
    • A date range with no commits shows 0% in console, Markdown and HTML.
  • F3 has no automated test. Jest can't load src/cli/commands.ts because it uses import.meta and three packages that only ship as ES modules (commander, chalk, ora). No existing test covers that file either.

Not in this PR

  • The nine Prospective Specs and findings F5 to F7 are only proposed. Each needs a decision before work starts.
  • Four files, including src/cli/periods-command.ts, were already failing Prettier before this branch. They are not touched here.

🤖 Generated with Claude Code

markhazleton and others added 2 commits November 21, 2026 13:51
Nine proposed Prospective Specs, seven quickfix-sized findings, and the
open items from earlier planning records consolidated into one roadmap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd NaN bus factor

- validate: import ../utils/git.js; the extensionless import cannot resolve
  under Node ESM, so the repository check always failed
- analyze: merge the parent command's options; --days, --format, --output,
  --path and the rest were ignored
- html --serve: listen on 127.0.0.1 and drop the wildcard CORS headers so
  the report is not readable from the local network; reject non-GET/HEAD
- bus factor: busFactorShare returns 0 for an empty window instead of NaN,
  used by every CLI summary and the console, HTML, and Markdown reports

Adds regression tests, including a scan that every relative import in src
carries a .js extension (Jest resolves extensionless imports, so a runtime
test would not catch it). Marks roadmap findings F1-F4 fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@markhazleton
markhazleton merged commit ea4f5e3 into main Nov 21, 2026
11 checks passed
@markhazleton
markhazleton deleted the chore/roadmap-and-cli-fixes branch November 21, 2026 20:20
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