feat(extractor): --help + auto-derive project bin/ references (CLI polish)#143
Conversation
…lish) Delivers the remaining "discoverable CLI" value from the roslyn-tools note, without adopting System.CommandLine (a churn-prone preview dependency; the extractor builds only in CI here, so a blind framework restructure of the 3,400-line entry point is the risky path — the hand-rolled surface is the same UX at a fraction of the risk): - `-h`/`--help`: a full usage block (commands, inputs, options), plus a --help pointer on the no-input error. - `--ref-dir`-from-project-`bin` auto-derivation: for a .csproj/.sln input, the project's built bin/ output is auto-added to the reference set (the --ref-dir you'd otherwise pass by hand), so a built/restored project's third-party events bind to real symbols instead of OWN050. `--no-project-refs` opts out; an unbuilt project contributes nothing (no crash, degrades to OWN050). See ProjectBinDirs. CI: --help renders the option list; --no-project-refs is accepted and (no bin/ on the sample) yields identical facts. Docs (note + README) updated, incl. the explicit rationale for not taking the System.CommandLine dependency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzA6KGQVRzP52tBEKwJ3SW
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe extractor CLI now supports ChangesCLI project reference polish
Sequence Diagram(s)sequenceDiagram
participant User
participant Program
participant ProjectBinDirs
participant CI
User->>Program: run extractor with .csproj or .sln input
Program->>Program: parse --no-project-refs and show help text
alt noProjectRefs is false
Program->>ProjectBinDirs: derive candidate bin directories from rawInputs
ProjectBinDirs-->>Program: existing bin directories
Program->>Program: append derived dirs to refDirs and log each one
else noProjectRefs is true
Program->>Program: skip auto-derived project references
end
CI->>Program: verify help output and facts with --no-project-refs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 1011-1017: The `--no-project-refs` parity check in the CI workflow
assumes the sample project has not been built, but it never verifies that
`frontend/roslyn/project-input-sample/bin` is absent before running the
comparison. Harden this step by adding an explicit precondition check around the
`dotnet run`/`diff` block (or the equivalent shell guard) so the assertion only
runs when the sample project is truly unbuilt, using the existing
`--no-project-refs` parity test as the reference point.
In `@frontend/roslyn/README.md`:
- Around line 66-70: The README usage example is inconsistent with the
surrounding source-tree instructions because it calls ownsharp-extract directly
instead of using the same dotnet run invocation. Update the help reference in
this section so it matches the documented workflow, or rephrase it to avoid
assuming a globally installed tool; keep the wording aligned with the examples
around the project usage text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9523a8c7-b06e-44f0-a149-78ab28ed5fb3
📒 Files selected for processing (4)
.github/workflows/ci.ymldocs/notes/roslyn-tools-and-cli.mdfrontend/roslyn/OwnSharp.Extractor/Program.csfrontend/roslyn/README.md
…t --help invocation (CodeRabbit) - ci.yml: the --no-project-refs parity check assumed the sample is unbuilt but never asserted it. Add an explicit `[ ! -d .../bin ]` guard so a future step that builds the sample fails with a clear message, not a confusing facts diff. - README: the help example used the bare `ownsharp-extract` command while that section documents source-tree `dotnet run` usage; switch to `dotnet run --project OwnSharp.Extractor -- --help` for consistency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzA6KGQVRzP52tBEKwJ3SW
Что и зачем
The CLI-polish follow-up to #139/#142 — the remaining "discoverable CLI" value the roslyn-tools note pointed at, delivered without adopting
System.CommandLine(see rationale below).-h/--help— a full hand-rendered usage block (commands, inputs, options), plus a--helppointer on the no-input error. The discoverable-CLI surface, no preview dependency.--ref-dir-from-project-binauto-derivation — for a.csproj/.slninput, the project's builtbin/output is auto-added to the reference set (the--ref-diryou'd otherwise pass by hand), so a built/restored project's third-party events (WPF/DevExpress) bind to real symbols instead of surfacing asOWN050.--no-project-refsopts out; an unbuilt project contributes nothing (no crash — it just degrades toOWN050). NewProjectBinDirshelper.Why not
System.CommandLineIt buys auto-
--help, validation, and tab-completion — but it's a churn-prone preview dependency, and the migration is a large restructure of a 3,400-line entry point that builds only in CI here (no localdotnet). A blind framework swap is the genuinely risky path; the hand-rolled help/validation gives the same user-facing surface at a fraction of the risk. The framework swap stays available if generated help / completions ever earn their keep — documented in the note.Тип изменения
--help, auto-derived project refsПроверка
dotnethere, so the C# changes build/run only in CI. They're small and mechanical (a const usage string + early exit; a file-onlyProjectBinDirsmirroring the existingProjectCsFiles/--ref-dirpatterns), and follow the file's existing interleaved top-level-statements + local-functions structure.wpf-extractorjob:--helprendersUsage:+ the option list and exits 0;--no-project-refsis accepted and (nobin/on the sample) yields identical facts (jq -Sparity with the bare run)."""raw-string usage block + localconstare in-language (noDirectory.Build.props/global.jsonpins it lower).ci.ymlvalidated as YAML.Связанный issue
Нет — continuation of #139/#142 /
docs/notes/roslyn-tools-and-cli.md("CLI polish").Чеклист
--helprender +--no-project-refsfact-parity)🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit
New Features
--no-project-refsoption to disable automatic inclusion of built project reference directories (bin/) for.csproj/.slninputs.-h/--help, including a fully rendered usage block and clearer messaging on missing input.Bug Fixes
Documentation
Tests