-
Notifications
You must be signed in to change notification settings - Fork 0
Add tiger-style CLI v1 with install/configure/doctor/bootstrap #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
63ef770
RED: scaffold tiger-style CLI and capture failing install test
robertguss 70d9677
GREEN: implement install asset copy with conflict-safe behavior
robertguss 43f928c
REFACTOR: simplify install action logging with full-suite safety gate
robertguss 398ace4
RED: add configure autodetect and AGENTS conflict tests
robertguss e0ec182
GREEN: implement configure manifest modes and autodetect
robertguss 628b044
REFACTOR: deduplicate configure status formatting
robertguss a57b5ac
RED: add doctor JSON and bootstrap orchestration tests
robertguss c6d971d
GREEN: implement doctor checks and bootstrap orchestration
robertguss 0bd6ffa
REFACTOR: collapse doctor tool checks into table-driven loop
robertguss 7027aa5
BUILD: add CLI CI/release workflows and lint-clean harness
robertguss 1bd5537
DOCS: publish tiger-style CLI usage and adoption guidance
robertguss a67c17b
CHORE: finalize evidence packet with validation details
robertguss 487b1a2
CHORE: temporarily disable CLI matrix workflow
robertguss cb74559
RED: add regression tests for review comments 5-8
robertguss 9ba872b
GREEN: resolve PR comments 5-9 in installer/configure workflow
robertguss 421cdf1
REFACTOR: centralize configure path labels in constants
robertguss 0ecf994
TEST: handle unusable bash in doctor and add regression coverage
robertguss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| # CLI v1 Task Packet | ||
|
|
||
| ## Objective | ||
|
|
||
| - Build a cross-platform `tiger-style` CLI that installs, configures, and validates Contract System v2 in downstream repositories. | ||
|
|
||
| ## Non-Goals | ||
|
|
||
| - Replacing current shell validators (`scripts/validate_tdd_cycle.sh`, `scripts/validate_evidence_packet.sh`). | ||
| - Supporting package-manager installation inside target repos. | ||
| - Implementing advanced migration/diff/upgrade subcommands beyond v1 scope. | ||
|
|
||
| ## Context | ||
|
|
||
| - v1.1 adoption currently depends on manual copy commands from `docs/adopting-in-a-new-project.md`. | ||
| - This change must dogfood Tiger Style (Tier 2) with strict Red -> Green -> Refactor commit sequencing. | ||
|
|
||
| ## Scope | ||
|
|
||
| - In scope: | ||
| - `tooling/tiger-style-cli/**` | ||
| - root `Cargo.toml` workspace setup | ||
| - `.github/workflows/cli-ci.yml` | ||
| - `.github/workflows/cli-release.yml` | ||
| - `docs/cli.md` | ||
| - `README.md` | ||
| - `docs/adopting-in-a-new-project.md` | ||
| - `.evidence/*` artifacts for this implementation | ||
| - Out of scope: | ||
| - redesigning existing core contracts/templates beyond wiring into CLI installation set. | ||
|
|
||
| ## Constraints | ||
|
|
||
| - Language: Rust + Clap. | ||
| - Binary name: `tiger-style`. | ||
| - Commands: `install`, `configure`, `doctor`, `bootstrap`. | ||
| - Conflict default: fail-safe with diff preview; `--force` required to overwrite. | ||
| - `bootstrap` runs non-strict doctor by default. | ||
| - Release tags: `tiger-style-cli-v*`. | ||
|
|
||
| ## Risk Tier | ||
|
|
||
| - Tier: `2` | ||
| - Rationale: introduces new executable installer path, release automation, and cross-platform behavior affecting repository setup correctness. | ||
|
|
||
| ## Interfaces And Dependencies | ||
|
|
||
| - CLI interface: | ||
| - `tiger-style install --target <path> [--force] [--dry-run]` | ||
| - `tiger-style configure --target <path> [--manifest-mode autodetect|all-inactive|all-active] [--force] [--dry-run]` | ||
| - `tiger-style doctor --target <path> [--strict] [--format text|json]` | ||
| - `tiger-style bootstrap --target <path> [--force] [--dry-run]` | ||
| - New Rust dependencies: `clap`, `anyhow`, `thiserror`, `include_dir`, `walkdir`, `similar`, `serde`, `serde_json`. | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| 1. CLI installs full v1.1 downstream layout and preserves idempotence. | ||
| 2. CLI configure writes canonical manifest status lines and can autodetect active languages. | ||
| 3. CLI doctor validates structure/tools/validator scripts and exits with defined status codes. | ||
| 4. Conflicts are reported with diff preview and fail exit code `3` without `--force`. | ||
| 5. Test suite covers install conflict modes, configure autodetect matrix, doctor missing-tool behavior, bootstrap orchestration, and dry-run behavior. | ||
|
|
||
| ## Test Expectations | ||
|
|
||
| - Required unit tests: manifest detection, conflict rendering, doctor manifest parsing. | ||
| - Required integration tests: install flow, configure modes, bootstrap flow, exit-code behavior. | ||
| - Required regression tests: conflicting file handling and AGENTS.md conflict handling. | ||
| - Required performance/security checks: bounded filesystem traversal and explicit command execution without shell interpolation. | ||
|
|
||
| ## Security Requirements | ||
|
|
||
| - No shell interpolation with untrusted input. | ||
| - No secret material embedded in emitted files/logs. | ||
| - Clear error surfaces for missing tooling and malformed manifest. | ||
|
|
||
| ## Performance Requirements | ||
|
|
||
| - CLI should complete typical install/configure/doctor runs quickly on small-to-medium repos. | ||
| - Repository traversal for autodetect must skip heavy known directories. | ||
|
|
||
| ## Observability Requirements | ||
|
|
||
| - Human-readable action logs for text output mode. | ||
| - Machine-readable JSON summary for doctor mode. | ||
|
|
||
| ## Rollback Conditions | ||
|
|
||
| - Roll back if CLI writes incorrect file layout, corrupts existing files without `--force`, or reports false-success health checks. | ||
| - Rollback mechanism: revert CLI/workflow/doc commits and keep manual adoption docs as primary path. | ||
|
|
||
| ## Definition Of Done | ||
|
|
||
| - CLI commands behave per contract and tests pass. | ||
| - Tier 2 artifacts and evidence are complete. | ||
| - Root and CLI validations pass, including `scripts/validate_tdd_cycle.sh` and `scripts/validate_evidence_packet.sh`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # CLI v1 Test Plan | ||
|
|
||
| ## Objective | ||
|
|
||
| - Verify `tiger-style` safely installs, configures, and validates Contract System v2 in downstream repositories. | ||
|
|
||
| ## Risk Tier | ||
|
|
||
| - Tier: `2` | ||
| - Rationale: new installer executable and release automation with cross-platform behavior. | ||
|
|
||
| ## Invariants | ||
|
|
||
| 1. Existing files are not overwritten unless `--force` is provided. | ||
| 2. Manifest output always contains exact canonical status lines for rust/python/typescript. | ||
| 3. `doctor` exit code semantics remain stable (`0` success, `2` validation failures). | ||
|
|
||
| ## Red Tests (Must Fail First) | ||
|
|
||
| | Test ID | Type | Scenario | Expected Failure | | ||
| | ------- | ---- | -------- | ---------------- | | ||
| | RED-1 | integration | Fresh install command expected to copy baseline files | Command fails before implementation due to missing command logic | | ||
| | RED-2 | integration | Configure autodetect should set active language status lines | Missing configure logic or incorrect manifest output | | ||
| | RED-3 | integration | Doctor should fail when active language tool is unavailable | Doctor not implemented or does not enforce required tool checks | | ||
|
|
||
| ## Green Validation Tests | ||
|
|
||
| | Test ID | Type | Scenario | Expected Pass Condition | | ||
| | ------- | ---- | -------- | ----------------------- | | ||
| | GREEN-1 | integration | `install` on empty temp repo | Required files/dirs exist after command | | ||
| | GREEN-2 | integration | `install` conflict without `--force` | Exit code `3` and diff preview emitted | | ||
| | GREEN-3 | integration | `configure --manifest-mode autodetect` matrix | Correct active/inactive statuses for each fixture repo | | ||
| | GREEN-4 | integration | `doctor --format json` | JSON includes pass/fail plus missing tools/checks | | ||
| | GREEN-5 | integration | `bootstrap` orchestration | Install+configure+doctor run sequentially and succeed | | ||
|
|
||
| ## Refactor Safety Net | ||
|
|
||
| - CLI integration tests under `tooling/tiger-style-cli/tests`. | ||
| - Full crate suite (`cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml`). | ||
| - Workspace rust checks after root workspace is added. | ||
|
|
||
| ## Boundary And Negative Tests | ||
|
|
||
| | Test ID | Boundary/Abuse Case | Expected Behavior | | ||
| | ------- | ------------------- | ----------------- | | ||
| | NEG-1 | Existing edited file during install | Conflict failure, no overwrite without `--force` | | ||
| | NEG-2 | Existing custom AGENTS.md during configure | Conflict failure unless `--force` | | ||
| | NEG-3 | Empty repo autodetect | All languages set inactive | | ||
| | NEG-4 | Missing bash during doctor non-strict | Warning only (not failure) | | ||
| | NEG-5 | Missing bash during doctor strict | Validation failure exit code `2` | | ||
|
|
||
| ## Performance Tests | ||
|
|
||
| - Validate directory traversal excludes heavy directories and completes quickly in test fixtures. | ||
| - Budgets asserted: command-level completion in local fixture runs without pathological slowdown. | ||
|
|
||
| ## Security Tests | ||
|
|
||
| - Auth/authz cases: N/A for local CLI. | ||
| - Malformed input cases: invalid target path and malformed manifest parsing. | ||
| - Data exposure cases: ensure no secret-bearing env/file dumps in errors. | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| # Red | ||
| cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- install_writes_required_tree | ||
|
|
||
| # Green | ||
| cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- install_writes_required_tree | ||
|
|
||
| # Full suite | ||
| cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml | ||
| ``` | ||
|
|
||
| ## Exit Criteria | ||
|
|
||
| - All required tests pass. | ||
| - No flaky/unresolved failures. | ||
| - Contract validators pass with evidence packet updated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| # Evidence Packet | ||
|
|
||
| ## Objective | ||
|
|
||
| - Problem solved: Manual adoption/install flow is cumbersome and error-prone. | ||
| - Intended outcome: Provide `tiger-style` CLI for repeatable install/configure/doctor/bootstrap workflow. | ||
|
|
||
| ## Risk Tier | ||
|
|
||
| - Tier: `2` | ||
| - Rationale: New executable plus CI/release automation with cross-platform behavior. | ||
|
|
||
| ## Scope | ||
|
|
||
| - Files/components changed: CLI crate, root Rust workspace, docs, workflows, and this evidence packet. | ||
| - Explicitly excluded scope: replacing existing validator scripts with Rust implementation. | ||
|
|
||
| ## Red | ||
|
|
||
| - Failing test(s): Three feature-slice RED tests are listed below. | ||
| - Slice 1 (`install` baseline): `install_writes_required_tree` | ||
| - Slice 2 (`configure` autodetect): `configure_autodetect_sets_manifest_statuses` | ||
| - Slice 3 (`doctor` + `bootstrap`): `bootstrap_installs_configures_and_passes_doctor` | ||
| - Command(s): Targeted RED commands are listed below. | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- install_writes_required_tree` | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- configure_autodetect_sets_manifest_statuses` | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- bootstrap_installs_configures_and_passes_doctor` | ||
| - Failure summary: Each RED stage failed for expected unimplemented behavior. | ||
| - Test failed with `install command is not implemented yet` and exit code `2`. | ||
| - Test failed with `configure command is not implemented yet` and exit code `2`. | ||
| - Test failed with `doctor checks failed` because doctor returned unimplemented status. | ||
| - Expected failure rationale: The implementation intentionally followed scaffold-first strict TDD. | ||
| - The command surface was scaffolded first; install behavior had not been implemented yet. | ||
| - Configure behavior and language autodetect had not been implemented yet. | ||
| - Doctor validation behavior was intentionally deferred until this feature slice. | ||
|
|
||
| ## Green | ||
|
|
||
| - Minimal implementation summary: | ||
| - Slice 1 (`install`): embedded install assets, implemented file copy/create/overwrite paths, | ||
| dry-run behavior, unix script permission setting, and conflict detection with diff previews. | ||
| - Slice 2 (`configure`): implemented manifest mode handling (`autodetect`, `all-active`, | ||
| `all-inactive`), language detection with directory exclusions, canonical manifest rendering, and | ||
| AGENTS template creation/conflict handling. | ||
| - Slice 3 (`doctor` + `bootstrap`): implemented structural checks, manifest parsing, active | ||
| language tool checks, validator checks with strict/non-strict bash handling, machine-readable | ||
| JSON output, and bootstrap orchestration with dry-run doctor skip. | ||
| - Command(s): Targeted GREEN commands are listed below. | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- install_` | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- configure_` | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- doctor_` | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml --test cli -- bootstrap_` | ||
| - Passing summary: All targeted GREEN test groups passed after minimal implementation. | ||
| - Install integration tests passed (`4 passed; 0 failed`). | ||
| - Configure integration tests passed (`3 passed; 0 failed`). | ||
| - Doctor and bootstrap integration tests passed (`4 passed; 0 failed` across targeted runs). | ||
|
|
||
| ## Refactor | ||
|
|
||
| - Structural improvements made: | ||
| - Slice 1 (`install`): extracted shared action logging helper to remove duplicated output logic. | ||
| - Slice 2 (`configure`): extracted shared status-label helper to remove duplicated mode rendering | ||
| logic. | ||
| - Slice 3 (`doctor`): replaced repeated per-tool checks with table-driven iteration. | ||
| - Why behavior is unchanged: Refactors only reduced duplication and preserved behavior contracts. | ||
| - Refactor touched only log-path structure and kept identical create/overwrite semantics. | ||
| - Refactor touched only formatting logic in dry-run output and did not alter manifest decisions. | ||
| - Refactor touched only control-flow structure for equivalent tool-check behavior. | ||
| - Confirmation commands: Full-suite command used after each refactor stage is listed below. | ||
| - `cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml` | ||
|
|
||
| ## Invariants | ||
|
|
||
| - Invariant assertions added/updated: | ||
| - Existing files are never overwritten by default when contents differ (conflict exit code `3`). | ||
| - Manifest output always includes exact rust/python/typescript status lines. | ||
| - `doctor` enforces tool presence only for active languages. | ||
| - Boundary conditions covered: | ||
| - Empty repository autodetect results in all languages inactive. | ||
| - Existing custom `AGENTS.md` conflicts without `--force`. | ||
| - `bootstrap --dry-run` writes nothing and skips `doctor`. | ||
| - `doctor --strict` fails when bash is unavailable. | ||
|
|
||
| ## Security Impact | ||
|
|
||
| - Threats considered: command execution safety, file overwrite safety, path traversal safety. | ||
| - Mitigations: explicit command invocation, conflict-default fail, bounded traversal exclusions. | ||
| - Residual risk: user may still apply `--force`; documented behavior required. | ||
|
|
||
| ## Performance Impact | ||
|
|
||
| - Baseline measurement: | ||
| - Manual install required multiple copy/chmod commands plus manual manifest edits. | ||
| - Post-change measurement: | ||
| - One command (`tiger-style bootstrap`) now performs install+configure+doctor in a single run. | ||
| - Delta explanation: | ||
| - CLI consolidates repeated manual operations, reducing operator steps and setup variance. | ||
|
|
||
| ## Assumptions | ||
|
|
||
| 1. GitHub releases are the canonical distribution channel for CLI binaries. | ||
| 2. Existing manual documentation remains fallback during initial CLI adoption. | ||
|
|
||
| ## Open Questions | ||
|
|
||
| 1. None. | ||
|
|
||
| ## Rollback Plan | ||
|
|
||
| - Trigger conditions: incorrect install layout, unsafe overwrite behavior, invalid doctor pass/fail outcomes. | ||
| - Rollback steps: revert CLI and workflow commits; retain existing docs/script-based installation flow. | ||
|
|
||
| ## Validation Commands | ||
|
|
||
| ```bash | ||
| cargo fmt --all -- --check | ||
| cargo clippy --workspace --all-targets --all-features -- -D warnings -D clippy::unwrap_used -D clippy::expect_used -D clippy::undocumented_unsafe_blocks | ||
| cargo test --workspace --all-features | ||
| scripts/validate_tdd_cycle.sh --base HEAD~10 | ||
| scripts/validate_evidence_packet.sh --file .evidence/EVIDENCE_PACKET.md | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: tiger-style-cli-ci | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| test: | ||
| name: test-${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
|
|
||
| - name: Install Rust toolchain | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Run CLI tests | ||
| run: cargo test --manifest-path tooling/tiger-style-cli/Cargo.toml | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.