Skip to content

Alpha gate A: OwnSharp.Cli — the single ownsharp check command#210

Merged
PhysShell merged 2 commits into
mainfrom
claude/ownsharp-cli-gate-a
Jul 10, 2026
Merged

Alpha gate A: OwnSharp.Cli — the single ownsharp check command#210
PhysShell merged 2 commits into
mainfrom
claude/ownsharp-cli-gate-a

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Что и зачем

Реализует пакетное решение, записанное в #202 (комментарий с архитектурным решением): один dotnet tool (OwnSharp.Cli, команда ownsharp) оборачивает существующий пайплайн extractor → core в одну установку — ownsharp check <path|.sln>. Никаких изменений в поведении экстрактора или ядра, только упаковка.

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

  • feat — новая возможность
  • fix — исправление бага
  • docs — документация
  • refactor / chore / test / ci — без изменения поведения

Как проверено

  • python tests/run_tests.py
  • ruff check . и mypy
  • селфтесты затронутых скриптов (python scripts/<...>.py --selftest)

Локальных dotnet/C#-тулчейнов в песочнице нет (как и для остального C#-кода в этом репо) — питоновская часть не тронута, python tests/run_tests.py/ruff/mypy прогнаны и зелёные (ничего не сломано). Новый C#-код проверяется исключительно через CI: новая джоба ownsharp-cli-smoke (matrix ubuntu-latest + windows-latest) реально паковает, ставит dotnet tool install --global, запускает ownsharp check на реальном лике и проверяет no-Python fail-fast путь.

Связанные issue

Closes #202.

Чеклист

  • изменение покрыто тестом/селфтестом (или объяснено, почему нет) — новая CI-джоба ownsharp-cli-smoke
  • README/docs обновлены при необходимости
  • коммиты в conventional-commit стиле (feat:, fix:, docs: …)

Пакетная форма (решение из #202, не пересматривается)

  • Экстрактор не изменён — подключён через ProjectReference; check запускает его как дочерний процесс (dotnet exec <bundled>/OwnSharp.Extractor.dll ...), тем же способом, каким это уже делает scripts/own-check.sh.
  • Ядро не изменено — вендорится как исходный *.py (zero-dependency, pyproject.toml: requires-python >=3.11), распаковывается в ~/.ownsharp/core/<version>/ при первом запуске, никогда — в анализируемый репозиторий. Выполняется системным Python.
  • Resolution Python: OWN_PYTHON → иначе py -3 (Windows) / python3 (остальные), версия проверяется (>=3.11); если не найден — быстрый отказ с однострочной инструкцией (winget/apt/brew/python.org), без автоскачивания. (Плюс мягкий фолбэк на python3/python после py -3 на Windows — не ослабляет контракт "версия ≥3.11 или отказ", просто снижает ложные "не найдено" на реальных машинах.)
  • CLI-флаги зеркалят scripts/own-check.sh 1:1: --format, --severity, --fail-on-finding, --emit-facts, --legacy, --stats, --body-throw-edges. Контракт кодов возврата тот же (0 чисто / 1 находки / ≥2 hard error), плюс 3 — не найден Python.
  • Отвергнутые альтернативы из Alpha gate A: single ownsharp check <path|.sln> CLI — implementation (design decided, see comments) #202 (встраивание CPython, PyInstaller как дефолт, ждать Rust, порт на C#) — не пересматривались.

CI-доказательство (issue's acceptance)

Новая джоба ownsharp-cli-smoke (.github/workflows/ci.yml), matrix ubuntu-latest + windows-latest — специально оба, а не "для покрытия": dotnet tool-шим на Windows — нативный apphost, на Unix — shell-скрипт, разная механика запуска процесса. Шаги: pack → dotnet tool install --globalownsharp check на минимальном лике в scratch-директории ВНЕ репозитория (доказывает, что тулу не нужен чекаут репо) → таймер install→check→findings с щедрым потолком регрессии (240s, не точное число "~3 минуты", а страховка от "стало занимать 20 минут") → отдельная проверка no-Python-пути (OWN_PYTHON на несуществующий путь) на exit 3 + текст с actionable-инструкцией.

Честно: не опубликовано в nuget.org

Публикация в nuget.org явно вне скоупа (P-013 Non-goals, не менялось). Сегодня — сборка и установка из исходников (frontend/roslyn/OwnSharp.Cli/README.md). alpha-readiness.md gate A обновлён честно: "построено", а не "опубликовано".


Generated by Claude Code

…202)

Implements the packaging decision recorded in issue #202: one dotnet
global tool (`OwnSharp.Cli`, command `ownsharp`) that wraps the
existing extractor -> core pipeline into one install, exactly
mirroring what scripts/own-check.sh already does by hand.

- The Roslyn extractor (OwnSharp.Extractor) is pulled in via
  ProjectReference, unmodified; `check` invokes its bundled dll as a
  child process (`dotnet exec`), the same subprocess shape
  own-check.sh already uses.
- The Python core (ownlang/) is vendored as loose *.py content,
  unmodified, and unpacked to ~/.ownsharp/core/<version>/ on first
  run -- never into the analyzed repo. It runs on the machine's own
  Python (OWN_PYTHON env var, else `py -3`/`python3`, >=3.11), with a
  fast, actionable, one-line failure (winget/apt/brew per OS) and no
  auto-download if none is found.
- CLI flags mirror own-check.sh 1:1 (--format, --severity,
  --fail-on-finding, --emit-facts, --legacy, --stats,
  --body-throw-edges); the exit-code contract (0/1/>=2, plus 3 for
  "no Python") is unchanged from the scripts.

No behaviour changes to the extractor or core -- packaging only, per
the issue's guardrail. own-check.sh/.ps1 and action.yml are untouched.

CI: a new ownsharp-cli-smoke job (matrix: ubuntu-latest +
windows-latest) proves pack -> dotnet tool install --global ->
ownsharp check finds a real leak on a clean runner, gated on a
regression-ceiling timer, plus a separate assertion that the
no-Python path fails fast with the actionable message.

Docs: frontend/roslyn/OwnSharp.Cli/README.md (the tool itself),
updates to alpha-readiness.md gate A, P-013's Scope, and the root
README's local-quickstart paragraph -- all noting honestly that the
package isn't published to nuget.org yet (build-and-install from
source until then).
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@PhysShell, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 10 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ab445c16-f653-4aeb-b2b2-0a642a38e41f

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc8c27 and d01fb54.

📒 Files selected for processing (13)
  • .github/workflows/ci.yml
  • README.md
  • README.ru.md
  • docs/notes/alpha-readiness.md
  • docs/proposals/P-013-distribution-surface.md
  • frontend/roslyn/OwnSharp.Cli/CheckCommand.cs
  • frontend/roslyn/OwnSharp.Cli/CoreVendor.cs
  • frontend/roslyn/OwnSharp.Cli/OwnSharp.Cli.csproj
  • frontend/roslyn/OwnSharp.Cli/Program.cs
  • frontend/roslyn/OwnSharp.Cli/PythonResolver.cs
  • frontend/roslyn/OwnSharp.Cli/README.md
  • frontend/roslyn/OwnSharp.Cli/ToolVersion.cs
  • frontend/roslyn/README.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ownsharp-cli-gate-a

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee6583a1d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

private static async Task<int> RunExtractorAsync(
IReadOnlyList<string> paths, string factsPath, bool legacy, bool stats, bool bodyThrowEdges)
{
var extractorDll = Path.Combine(AppContext.BaseDirectory, "OwnSharp.Extractor.dll");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use the actual extractor assembly name

When ownsharp check runs after a tool install, this path is checked before extraction, but the referenced extractor project sets <AssemblyName>ownsharp-extract</AssemblyName> in frontend/roslyn/OwnSharp.Extractor/OwnSharp.Extractor.csproj, so the build/pack output is ownsharp-extract.dll, not OwnSharp.Extractor.dll. As a result every normal check invocation reports the bundled extractor as missing and exits before producing facts/findings.

Useful? React with 👍 / 👎.

…actor.dll

OwnSharp.Extractor.csproj sets <AssemblyName>ownsharp-extract</AssemblyName>,
so the built/packed DLL is ownsharp-extract.dll — the project/package name is
not the assembly name. CheckCommand.RunExtractorAsync was checking for the
wrong filename, so every check invocation reported a corrupt install and
exited before producing findings. Also fixed the two cosmetic comment
references (csproj, README) to match.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D6Naf8CcezjCbikueKdeYv
@PhysShell
PhysShell merged commit e3d98c6 into main Jul 10, 2026
37 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.

Alpha gate A: single ownsharp check <path|.sln> CLI — implementation (design decided, see comments)

2 participants