Skip to content

feat(cli)!: replace commands monolith with module-per-command architecture - #24

Merged
eschaar merged 2 commits into
mainfrom
feat/improved_cli
Apr 26, 2026
Merged

feat(cli)!: replace commands monolith with module-per-command architecture#24
eschaar merged 2 commits into
mainfrom
feat/improved_cli

Conversation

@eschaar

@eschaar eschaar commented Apr 26, 2026

Copy link
Copy Markdown
Owner

BREAKING CHANGE: vstack.cli.commands removed. CommandService and all command classes now live in dedicated modules under vstack.cli (service, install, verify, validate, status, uninstall, manifest, report). Manifest persistence classes moved to new vstack.manifest package.

  • Split 596-line commands.py into 12 focused modules: base, catalog, helpers, registry, service, interface, install, verify, validate, status, uninstall, report
  • Extract vstack.manifest package (store.py) with schema-versioned Manifest, ManifestFile, ArtifactEntry, content_hash
  • Add manifest upgrade --backfill to retroactively compute checksums for legacy manifest entries without checksum
  • Fix _version_gt TypeError when existing version is None on first install
  • Restructure full test suite: per-module test files, TestClass layout, delete catch-all test_commands.py; test count 288 -> 337
  • Add mypy to quality gate (106 files, 0 errors)
  • Consolidate e2e tests into tests/vstack/test_integration.py
  • Add 4 new ADRs: 014 manifest schema versioning, 015 conservative install defaults, 016 atomic manifest writes, 017 checksum backfill
  • Write release notes docs/releases/2026-04-26.md and update CHANGELOG

…cture

BREAKING CHANGE: vstack.cli.commands removed. CommandService and all
command classes now live in dedicated modules under vstack.cli (service,
install, verify, validate, status, uninstall, manifest, report). Manifest
persistence classes moved to new vstack.manifest package.

- Split 596-line commands.py into 12 focused modules: base, catalog,
  helpers, registry, service, interface, install, verify, validate,
  status, uninstall, report
- Extract vstack.manifest package (store.py) with schema-versioned
  Manifest, ManifestFile, ArtifactEntry, content_hash
- Add manifest upgrade --backfill to retroactively compute checksums
  for legacy manifest entries without checksum
- Fix _version_gt TypeError when existing version is None on first install
- Restructure full test suite: per-module test files, TestClass layout,
  delete catch-all test_commands.py; test count 288 -> 337
- Add mypy to quality gate (106 files, 0 errors)
- Consolidate e2e tests into tests/vstack/test_integration.py
- Add 4 new ADRs: 014 manifest schema versioning, 015 conservative
  install defaults, 016 atomic manifest writes, 017 checksum backfill
- Write release notes docs/releases/2026-04-26.md and update CHANGELOG
Copilot AI review requested due to automatic review settings April 26, 2026 00:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR performs a breaking refactor of the vstack CLI from a monolithic command module into a catalog/registry/interface architecture with per-command modules, and extracts manifest persistence into a dedicated vstack.manifest package with schema versioning and checksum backfill support.

Changes:

  • Replaced the vstack.cli.commands monolith with a module-per-command CLI (parser/catalog/registry/interface/service + command handlers).
  • Introduced vstack.manifest with schema-v2 manifest models, atomic writes, and manifest upgrade --backfill.
  • Restructured and expanded the test suite (unit tests per module + consolidated integration tests) and updated user-facing docs/release notes.

Reviewed changes

Copilot reviewed 62 out of 62 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/vstack/test_main.py Updates entrypoint tests to exercise the new CommandLineInterface-based main() behavior.
tests/vstack/test_integration.py Adds end-to-end subprocess coverage for verify/status/manifest upgrade/backfill flows.
tests/vstack/prompts/test_constants.py Adds prompt constant tests aligning with new prompt module structure.
tests/vstack/prompts/test_config.py Adds prompt artifact type config tests.
tests/vstack/prompts/test___init__.py Adds prompts package public API export tests.
tests/vstack/manifest/test_store.py Adds comprehensive tests for manifest schema v2 parsing, upgrade, backfill, and atomic write behaviors.
tests/vstack/instructions/test_constants.py Adds instruction constant tests.
tests/vstack/instructions/test_config.py Adds instruction artifact type config tests.
tests/vstack/instructions/test___init__.py Adds instructions package public API export tests.
tests/vstack/cli/test_verify.py Adds VerifyCommand unit tests for manifest error handling and context forwarding.
tests/vstack/cli/test_validate.py Adds ValidateCommand context-forwarding tests.
tests/vstack/cli/test_uninstall.py Adds UninstallCommand behavior + context-forwarding tests.
tests/vstack/cli/test_status.py Adds StatusCommand context-forwarding tests.
tests/vstack/cli/test_report.py Adds report rendering/YAML serializer tests for status output.
tests/vstack/cli/test_registry.py Adds registry construction tests for catalog-driven dispatch.
tests/vstack/cli/test_parser.py Updates parser tests for new command catalog, new flags, and new error behavior (ValueError vs SystemExit).
tests/vstack/cli/test_manifest.py Replaces manifest model tests with ManifestCommand dispatch tests.
tests/vstack/cli/test_interface.py Adds interface-level tests for parser/service wiring, scope resolution, and dispatch.
tests/vstack/cli/test_integration_runtime.py Removes superseded CLI runtime integration test (moved into consolidated integration tests).
tests/vstack/cli/test_install.py Adds InstallCommand decision/version/backfill-related unit tests and context forwarding.
tests/vstack/cli/test_helpers.py Adds tests for shared helper normalization logic.
tests/vstack/cli/test_catalog.py Adds tests ensuring command/subcommand catalog correctness and invariants.
tests/vstack/cli/test_base.py Adds tests for the new CommandContext and BaseCommand contract.
src/vstack/manifest/store.py New manifest domain implementation: schema v2, checksum support, backfill, and atomic file persistence.
src/vstack/manifest/init.py Exposes manifest domain API at package level.
src/vstack/main.py Switches entrypoint to CommandLineInterface.run() with centralized ValueError handling.
src/vstack/constants.py Adds explicit bandit suppression comment for safe subprocess.check_output usage.
src/vstack/cli/verify.py New VerifyCommand handler with manifest checksum + metadata verification paths.
src/vstack/cli/validate.py New ValidateCommand handler (in-memory render + unresolved placeholder reporting).
src/vstack/cli/uninstall.py New UninstallCommand handler implementing conservative removal + manifest updates.
src/vstack/cli/status.py New StatusCommand handler producing text/json/yaml status reports.
src/vstack/cli/service.py Introduces CommandService as shared CLI coordinator (generators, manifest access, drift checks, wrappers).
src/vstack/cli/report.py Adds report builders/renderers and a minimal YAML serializer for status output.
src/vstack/cli/registry.py Adds catalog-driven registry construction for command dispatch.
src/vstack/cli/parser.py Rebuilds argparse tree from catalogs; target resolution now raises ValueError instead of exiting.
src/vstack/cli/manifest.py Re-exports manifest symbols for compatibility and adds vstack manifest <action> dispatch command.
src/vstack/cli/interface.py Adds orchestration facade that wires parser → service → registry → command execution.
src/vstack/cli/install.py New InstallCommand implementing conservative install/update/adopt/force-name behaviors + manifest writes.
src/vstack/cli/helpers.py Adds shared CLI helpers (targeted-name normalization).
src/vstack/cli/constants.py Centralizes CLI constants: ANSI colors, known types, global-only supported types, expected input names, artifact states.
src/vstack/cli/commands.py Removes the legacy monolithic CLI implementation.
src/vstack/cli/catalog.py Adds central command/subcommand configuration catalogs and ordering.
src/vstack/cli/base.py Adds BaseCommand ABC and CommandContext dataclass for unified handler interface.
docs/test-report.md Adds/updates a consolidated QA report for the refactor and new gates.
docs/security-report.md Adds/updates security review notes and documents the subprocess suppression decision.
docs/releases/2026-04-26.md Adds release notes for v2.0.0 and the breaking CLI/manifest changes.
docs/product/roadmap.md Updates roadmap counts and supporting narrative to match current skill set.
docs/product/requirements.md Rewrites requirements doc with the new CLI/manifest contracts and conservative install semantics.
docs/performance-baseline.md Adds a performance baseline document for CLI operations and import time.
docs/architecture/architecture.md Updates architecture doc to reflect new manifest package and CLI component model.
docs/architecture/adr/017-checksum-backfill-on-upgrade.md Adds ADR for checksum backfill behavior and its safety model.
docs/architecture/adr/016-atomic-manifest-writes.md Adds ADR documenting atomic manifest writes.
docs/architecture/adr/015-conservative-install-by-default.md Adds ADR documenting conservative install semantics and flags.
docs/architecture/adr/014-manifest-schema-versioning.md Adds ADR documenting manifest schema versioning and explicit upgrade gating.
docs/architecture/adr/012-flat-templates-install-time-generation.md Updates ADR to reflect conservative install/adopt/force behaviors and checksum usage.
README.md Updates CLI command documentation and usage guidance for new commands/subcommands and conservative defaults.
README-pypi.md Updates PyPI-safe README content to include new manifest commands and conservative behavior summary.
CHANGELOG.md Adds 2.0.0 entry documenting breaking changes, additions, and fixes.
.github/vstack.json Updates the repo’s installed manifest artifact to schema v2 with checksums (generated output snapshot).

Comment thread src/vstack/cli/verify.py
Comment thread src/vstack/cli/install.py Outdated
Comment thread src/vstack/cli/install.py
Comment thread src/vstack/manifest/store.py
Comment thread src/vstack/manifest/store.py
Comment thread docs/performance-baseline.md Outdated
@eschaar
eschaar merged commit 6d61543 into main Apr 26, 2026
12 checks passed
@eschaar
eschaar deleted the feat/improved_cli branch April 26, 2026 13:20
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