Skip to content

feat(extractor): --help + auto-derive project bin/ references (CLI polish)#143

Merged
PhysShell merged 2 commits into
mainfrom
claude/roslyn-tools-own-net-l36cwp
Jun 27, 2026
Merged

feat(extractor): --help + auto-derive project bin/ references (CLI polish)#143
PhysShell merged 2 commits into
mainfrom
claude/roslyn-tools-own-net-l36cwp

Conversation

@PhysShell

@PhysShell PhysShell commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Что и зачем

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 --help pointer on the no-input error. The discoverable-CLI surface, no preview dependency.
  • --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 (WPF/DevExpress) bind to real symbols instead of surfacing as OWN050. --no-project-refs opts out; an unbuilt project contributes nothing (no crash — it just degrades to OWN050). New ProjectBinDirs helper.

Why not System.CommandLine

It 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 local dotnet). 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.

Тип изменения

  • Новая возможность (feature) — --help, auto-derived project refs
  • Исправление бага
  • Документация
  • CI / инфраструктура

Проверка

  • No local dotnet here, so the C# changes build/run only in CI. They're small and mechanical (a const usage string + early exit; a file-only ProjectBinDirs mirroring the existing ProjectCsFiles/--ref-dir patterns), and follow the file's existing interleaved top-level-statements + local-functions structure.
  • CI smokes added to the wpf-extractor job: --help renders Usage: + the option list and exits 0; --no-project-refs is accepted and (no bin/ on the sample) yields identical facts (jq -S parity with the bare run).
  • net8.0 ⇒ C# 12, so the """ raw-string usage block + local const are in-language (no Directory.Build.props/global.json pins it lower).
  • ci.yml validated as YAML.

Связанный issue

Нет — continuation of #139/#142 / docs/notes/roslyn-tools-and-cli.md ("CLI polish").

Чеклист

  • CI-голдены на новую возможность (--help render + --no-project-refs fact-parity)
  • Документация обновлена (note + README), incl. the System.CommandLine rationale
  • Обратная совместимость — bare form unchanged; auto-refs no-op on an unbuilt project
  • Принцип "один чекер" сохранён — extractor only emits facts

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a --no-project-refs option to disable automatic inclusion of built project reference directories (bin/) for .csproj/.sln inputs.
    • Enhanced CLI ergonomics with -h/--help, including a fully rendered usage block and clearer messaging on missing input.
  • Bug Fixes

    • Improved project reference behavior so built outputs are used when available; unbuilt projects no longer contribute reference directories.
  • Documentation

    • Updated CLI docs and README to describe the new help behavior and reference-directory logic.
  • Tests

    • Added CI coverage to regression-test help output and ensure consistent results across invocation styles.

…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
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4dceec1f-8891-4c38-9018-e9d9f9ca191f

📥 Commits

Reviewing files that changed from the base of the PR and between 6ef2ead and ddd6bcf.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • frontend/roslyn/README.md
✅ Files skipped from review due to trivial changes (1)
  • frontend/roslyn/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

The extractor CLI now supports --no-project-refs, updates help and error messaging, and auto-adds existing project bin/ directories for .csproj and .sln inputs unless that flag is set. CI and docs were updated to cover the new behavior.

Changes

CLI project reference polish

Layer / File(s) Summary
Help text and flag parsing
frontend/roslyn/OwnSharp.Extractor/Program.cs, .github/workflows/ci.yml
--no-project-refs is added to CLI parsing and usage text, the no-input error points to --help, and CI checks help output plus fact parity with and without the flag.
Project bin reference resolution
frontend/roslyn/OwnSharp.Extractor/Program.cs, docs/notes/roslyn-tools-and-cli.md, frontend/roslyn/README.md
The extractor derives existing project bin/ directories from .csproj and .sln inputs, appends them to refDirs unless opted out, and the docs describe the updated reference behavior.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PhysShell/Own.NET#109: Modifies the same Roslyn reference-directory pipeline in frontend/roslyn/OwnSharp.Extractor/Program.cs with explicit --ref-dir handling.
  • PhysShell/Own.NET#139: Extends the same .csproj/.sln CLI input path in Program.cs with related extractor behavior and CI coverage.
  • PhysShell/Own.NET#142: Touches the Roslyn extractor CLI and CI surface around extract/CLI behavior with adjacent command-flow changes.

Poem

I twitched my nose at the CLI glow,
--help said hi, and --no-project-refs said no.
Project bins hopped in, then quietly stayed,
while unbuilt little projects left no trace made.
🐇✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: CLI help plus auto-derived project bin references.
Description check ✅ Passed The description covers the required sections with clear purpose, change type, verification, issue, and checklist details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/roslyn-tools-own-net-l36cwp

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 98ebb51 and 6ef2ead.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • docs/notes/roslyn-tools-and-cli.md
  • frontend/roslyn/OwnSharp.Extractor/Program.cs
  • frontend/roslyn/README.md

Comment thread .github/workflows/ci.yml
Comment thread frontend/roslyn/README.md Outdated
…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
@PhysShell PhysShell merged commit f2285eb into main Jun 27, 2026
28 checks passed
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.

2 participants