Skip to content

feat: add download command to CLI#3

Merged
Arthurvdv merged 3 commits into
mainfrom
feature/cli-download
Apr 29, 2026
Merged

feat: add download command to CLI#3
Arthurvdv merged 3 commits into
mainfrom
feature/cli-download

Conversation

@Arthurvdv

@Arthurvdv Arthurvdv commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

Adds alcops download command that performs the full analyzer download pipeline:

  1. TFM detection via --detect-using flag, with smart input routing:

    • URL → bc-artifact detector
    • Local path → compiler-path detector
    • Channel keyword (latest/prerelease/current) → nuget-devtools detector
    • Specific version → API-based resolution (NuGet first, marketplace fallback)
  2. --detect-from override - forces a specific detector, always overrides smart routing

  3. Download + extract - downloads the ALCops NuGet package and extracts analyzer DLLs for the detected TFM

  4. Temp cleanup - intermediate .nupkg is downloaded to a temp directory and cleaned up after extraction

CLI Interface

alcops download --output <dir> [--detect-using <input>] [--detect-from <source>] [--tfm <tfm>] [--version <ver>] [--verbose]

All flags are named (no positional arguments), making --version unambiguously the ALCops package version.

New Files

  • src/resolve-detect-source.ts - API-based version-source resolution module
  • src/download/download-command.ts - download pipeline orchestration
  • tests/resolve-detect-source.test.ts - 11 tests for source resolution
  • tests/download/download-command.test.ts - 6 tests for download pipeline

Changes

  • src/cli.ts - added download command, --verbose flag (global)
  • src/index.ts - new public API exports
  • README.md - documentation with examples

Arthurvdv and others added 3 commits April 29, 2026 12:21
Add 'alcops download' command that performs the full pipeline:
- Smart input routing: URL → bc-artifact, path → compiler-path,
  channel → nuget-devtools, version → API resolution
- --detect-from flag to override smart routing
- --tfm for explicit TFM (skips detection)
- --version for specific ALCops package version
- --verbose for debug logging (global, applies to all commands)
- Temp .nupkg cleanup via try/finally

New modules:
- src/resolve-detect-source.ts: API-based version source resolution
  (NuGet first, marketplace fallback)
- src/download/download-command.ts: download pipeline orchestration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove ambiguous positional [source] argument from the download command.
Add --detect-source named flag for TFM detection input (URL, path,
channel keyword, or version number). This makes --version unambiguously
refer to the ALCops package version.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
More self-documenting flag name: --detect-using clearly communicates
that the value is the input used for TFM detection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Arthurvdv Arthurvdv merged commit 4cd267e into main Apr 29, 2026
2 checks passed
@Arthurvdv Arthurvdv deleted the feature/cli-download branch April 29, 2026 11:48
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