diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..8ed9859 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,68 @@ +# Agent guide + +This is the repository entry point for coding agents. Human installation instructions live in [README.md](README.md); the contributor workflow is maintained in [CONTRIBUTING.md](CONTRIBUTING.md). Keep coordination outside the repository rather than adding an embedded agent framework. + +## Before editing + +- Read applicable nested instructions, inspect the target checkout, branch and existing changes, and preserve work you do not own. +- Start each feature branch from current `develop`, using `{type}/{issue-number}-{slug}`. Do not fork another feature branch or commit directly on `develop`/`main`. +- Keep one bounded issue per PR. Feature PRs target `develop`; release cuts go from `develop` to `main`. Use regular merge commits, never squash. +- Follow the owner's execution and publication authority. Do not infer permission to push, merge, release, install software or change a live machine from a plan or passing tests. +- Use Conventional Commits. AI-authored commits must contain exactly one `Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>` trailer; preserve the configured human author. +- If working as a delegated editor, leave changes unstaged/uncommitted for the coordinating owner. + +## Source map + +| Concern | Source of truth | +|---|---| +| OS routing | [`setup.sh`](setup.sh), [`setup.ps1`](setup.ps1) | +| Unix selection/default order and dispatch | [`scripts/linux/setup.sh`](scripts/linux/setup.sh) | +| Windows registry, aliases, default order and dispatch | [`scripts/windows/setup.ps1`](scripts/windows/setup.ps1) | +| Individual installers | [`scripts/linux/tools/`](scripts/linux/tools/), [`scripts/windows/tools/`](scripts/windows/tools/) | +| Picker state and ordered selection | [`scripts/linux/lib/tui.sh`](scripts/linux/lib/tui.sh), [`scripts/windows/lib/tui.ps1`](scripts/windows/lib/tui.ps1) | +| Version pins and readers | [`.tool-versions`](.tool-versions), [`scripts/lib/`](scripts/lib/) | +| Unix dotfiles and aliases | [`config/dotfiles/`](config/dotfiles/) | +| Windows profile writing | [`scripts/windows/tools/profile.ps1`](scripts/windows/tools/profile.ps1) | +| Regression and native CI contracts | [`tests/README.md`](tests/README.md), [workflows](.github/workflows/) | + +Use [ARCHITECTURE.md](ARCHITECTURE.md) for the deeper implementation map. Files under `docs/plans/` are historical design inputs; verify their issue/revision state before treating them as unfinished work. + +## Preserve these contracts + +- Default order is dependency-sensitive. Selected defaults retain that order; selected opt-ins follow alphabetically. Selecting a tool does not automatically add its prerequisites. +- Unix tool files can be opt-in without joining `DEFAULT_TOOLS`. Windows tools must be registered; preserve the `copilot-cli` alias for the canonical `copilot` entry. +- Unknown selections fail before dispatch. Listing/help, cancellation and an empty confirmed selection must not install tools. CI/headless guards still apply to explicit interactive requests. +- Retain Bash 3.2 compatibility and its line-input picker fallback. `.aliases` is Bash/Zsh code, not POSIX `sh`. +- Retain Windows PowerShell 5.1 and StrictMode compatibility. Linux `pwsh` or a command named `powershell` is not proof of native PS5.1 behavior. +- Versioned installers use the shared pin readers and version-aware guards, not a bare executable-presence check. See the [pinning contract](CONTRIBUTING.md#tool-version-pin-enforcement). +- Keep helpers in their canonical libraries. Preserve exit codes, noninteractive behavior and expected-failure `$LASTEXITCODE` handling. +- Keep changed PowerShell, shell, Markdown and YAML sources ASCII-clean; retain `.gitattributes` line endings. Preserve runtime output when escaping glyphs. +- Completion is a separate opt-in with its own ownership/backup rules. Do not enable it through ordinary setup or bypass Zsh's completion security audit. +- Profile updates may touch existing user text. Preserve the canonical managed-block boundaries and add explicit LF/CRLF, repeat-write and unrelated-content regressions. Current ASCII profile writes are not an arbitrary-Unicode preservation guarantee. + +## Safe validation + +Inspect test setup/teardown first. Use a private HOME/USERPROFILE and temp/cache tree for execution; retain failing evidence. Never use the real machine's setup, uninstall, auth, shutdown or session commands as smoke tests. `--non-interactive` still installs defaults. + +Run relevant maintained checks from the repository root: + +| Change | Focused checks | +|---|---| +| Tool selection / retirement | `bash tests/test_tool_retirement.sh`; `pwsh -NoProfile -File tests/test_tool_retirement.ps1`; both `test_setup_flags` suites | +| Picker | `bash tests/test_tui_bash.sh`; `pwsh -NoProfile -File tests/test_tui_pwsh.ps1` | +| Aliases | `bash tests/test_aliases.sh`; `bash tests/test_alias_parity.sh` | +| Ordered default fixtures | `bash scripts/dev/regenerate-baseline-fixtures.sh --check` | +| Completion | `bash tests/test_completion_install.sh`; `bash tests/test_completion_runtime.sh` | +| Shutdown helpers | `bash tests/test_shutdown_helpers.sh` (non-forwarding stubs only) | + +Completion runtime and shutdown suites require both Bash and Zsh. Report missing tools rather than weakening guards or calling a partial run a pass. Run relevant syntax checks, ShellCheck and native hosted CI as well. + +`tests/test_idempotency.sh` and the full `tests/test_windows_setup.ps1` include machine-changing setup. Use CI or a deliberately disposable machine, not a normal workstation. Profile load-only checks use a disposable startup-scope runspace: a nested function scope does not reproduce Windows `AllScope` alias behavior. + +For docs, check links/anchors and compare claims against current source. For visible changes, inspect actual tested output; label the source revision, environment and limitations. A rewritten description or generated preview is not execution evidence. + +## Delivery + +Review the final diff and relevant validation, including native Windows/macOS results when affected. Keep original failures and state what was newly tested versus reused. Do not bypass failing checks. The existing solo-owner review exception is documented in [CONTRIBUTING.md](CONTRIBUTING.md#branch-protection); it does not waive CI. + +Report the resulting commit, exact branch/checkout, publication state, evidence and any remaining limits. Keep README concise; extend the canonical reference instead of duplicating a second manual here. diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index c3ab5b7..5d90b80 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,6 +1,6 @@ # Architecture: dev-setup -> **Last updated:** 2026-08-09 +> **Last updated:** 2026-11-21 --- @@ -12,7 +12,7 @@ - Dev Containers - Fresh Linux, macOS, or Windows machines -Run `bash setup.sh` (Unix) or `powershell -File setup.ps1` (Windows) and walk away. Every tool this project installs is safe to re-install -- the scripts check first and skip if already present. +The entry points resolve a selection and run its steps in dependency order. Interactive terminals can use the picker; unattended runs use explicit flags or defaults. Version-aware skips make repeated setup practical, but configuration steps can still overwrite owned files or refresh profile blocks. Start with the [human overview](README.md), [agent guide](AGENTS.md) or [setup reference](docs/setup.md) as appropriate. --- @@ -27,7 +27,9 @@ dev-setup/ |---- ARCHITECTURE.md # This file |---- CHANGELOG.md # Keep-a-Changelog format |---- CONTRIBUTING.md # Contribution guide -|---- README.md # Project overview and quick start +|---- README.md # Concise human overview and quick start +|---- AGENTS.md # Agent source map, constraints and safe checks +|---- docs/ # Detailed setup and shutdown references | |---- scripts/ | |---- lib/ # Cross-platform shared libraries (PS + sh) @@ -40,7 +42,7 @@ dev-setup/ | | |---- lib/ | | | |---- log.sh # Shared log_info / log_ok / log_warn / log_error helpers | | | `---- tui.sh # Bash 3.2+ interactive picker -| | `---- tools/ # Per-tool installers (sourced by core in dependency order) +| | `---- tools/ # Per-tool installers (executed in dependency order) | | |---- auth.sh # GitHub CLI authentication (interactive) | | |---- copilot-cli.sh # Install GitHub Copilot CLI (pin from .tool-versions) | | |---- gh.sh # Install GitHub CLI (pin from .tool-versions) @@ -80,7 +82,7 @@ dev-setup/ | `---- README.md # Documents each dotfile and install behaviour | |---- hooks/ # Git hooks; auto-wired via `git config core.hooksPath hooks` -| |---- pre-commit # Branch ancestry + ASCII guard + shellcheck +| |---- pre-commit # ASCII guard + protected-branch refusal + shellcheck | |---- prepare-commit-msg # Rewrite auto-merge/revert messages into Conventional Commits form | |---- commit-msg # Enforce Conventional Commits format (hard reject on non-conforming) | `---- pre-push # Block direct pushes to main; advisory shellcheck + PSScriptAnalyzer @@ -92,7 +94,7 @@ dev-setup/ | |---- test_git_hooks.ps1 # Git hook tests (PowerShell) | |---- test_idempotency.sh # Idempotency tests (bash) | |---- test_nvm_bootstrap.sh # nvm bootstrap tests -| |---- test_precommit_hygiene.sh # pre-commit hygiene checks (ancestry, ASCII, rogue-path) +| |---- test_precommit_hygiene.sh # Historical/targeted pre-commit regression cases | |---- test_remove_custom_item.ps1 # Custom item removal tests (PowerShell) | |---- test_setup_flags.sh # Bash selection flags + interactive guards | |---- test_setup_flags_pwsh.ps1 # PowerShell selection flags + interactive guards @@ -176,7 +178,7 @@ Uses PowerShell's built-in `$IsWindows`, `$IsLinux`, `$IsMacOS` booleans. If Pow The public picker contract, including invocation, controls, headless behavior, flag precedence, and confirm/cancel results, is documented in the -[README interactive picker section](./README.md#interactive-tool-picker). +[setup guide](docs/setup.md#interactive-tool-picker). Internally, selection is separated from installation: @@ -272,7 +274,7 @@ Reference implementations: `scripts/linux/tools/nvm.sh` and `scripts/windows/too |------------|------| | Shebang | `#!/usr/bin/env bash` | | Safety flags | `set -euo pipefail` at top of every script | -| Idempotency | Check `command -v ` before installing; skip if present | +| Idempotency | For versioned tools, compare the installed version with the pin; skip only when the requested state already holds | | Logging | Source `scripts/linux/lib/log.sh`; call `log_info`, `log_ok`, `log_warn`, `log_error` | | Version pinning | Read from `.tool-versions` via `sh scripts/lib/read-tool-version.sh `; never hard-code versions | | Sourcing | `setup.sh` runs each `tools/*.sh` via `bash