fix(cli): write concatenated multi-skill report to --output for non-JSON formats#209
Open
rodboev wants to merge 2 commits into
Open
fix(cli): write concatenated multi-skill report to --output for non-JSON formats#209rodboev wants to merge 2 commits into
rodboev wants to merge 2 commits into
Conversation
…bsent Signed-off-by: Rod Boev <rod.boev@gmail.com>
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.
Summary
skillspector scan ./skills/ --recursive --format markdown --output report.mdprints to stdout instead of writingreport.md. The JSON recursive path and single-skill mode both write the file correctly; only the recursive + non-JSON combination silently ignores--output.Closes #203
Root cause
_scan_multi_skill()(cli.py:434-437) passesNoneinstead ofoutputto_write_result(), so_write_result()routes to stdout unconditionally. A naiveNone → outputsubstitution would also fail:_write_resultcallsPath(output).write_text(...)per skill, truncating the file on each call and leaving only the last skill's report.Diff Notes
src/skillspector/cli.py: add private_result_body()helper (extractsreport_bodyor SARIF fallback); refactor_write_resultbody resolution to use it (no behavior change); rewritecli.py:434-437to concatenate per-skill bodies with--- {skill.relative_path} ---separators and write once viaPath(output).write_text(); file is always created when-ois given. JSON branch (lines 410-433) and single-skill path (line 321) untouched.tests/unit/test_cli.py: two new tests — one asserts the file is created with both skills' content and stdout is not the destination; one locks the JSON branch behavior.Scope
No change to the JSON multi-skill branch, single-skill path,
_scan_multi_skill()signature, or summary-table stdout output. No new dependencies. Concatenated non-JSON output is not valid SARIF; this matches the issue's Option 1 scope.Before / After
scan ./skills/ --recursive --format markdown --output report.mdreport.mdnot created; output to stdoutreport.mdwritten with per-skill sectionsscan ./skills/ --recursive --format json --output combined.jsoncombined.jsonwritten (unchanged)combined.jsonwritten (unchanged)scan ./skill --format markdown --output report.mdreport.mdwritten (unchanged)report.mdwritten (unchanged)Verification
.\.venv\Scripts\python.exe -m pytest tests/unit/test_cli.py -v— 9 passed, 0 failed (7 pre-existing + 2 new)uv run ruff check src/skillspector/cli.py tests/unit/test_cli.py— exit 0uv run ruff format --check src/skillspector/cli.py tests/unit/test_cli.py— 2 files already formatted, exit 0Lint & Test (Python 3.12),Lint & Test (Python 3.13), andDCO Check— pending maintainer approval if fork checks are gatedNotes
DCO sign-off required on every commit (
git commit -s). Known existing failures (tests/nodes/test_meta_analyzer.py) are unrelated to this surface.