Goal
Evaluate and, only if justified by ownership boundaries, extract the Linux/Debian setup helper surface from setup_common.sh without changing setup/check/doctor behavior.
Background
docs/setup-common-ownership.md correctly says setup_common.sh should not be split just because it is long. The current file remains shared by setup, check, doctor, update, CI mode, profile setup, host probes, project artifact dispatch, and platform installers. Since the ownership note was written, Ubuntu/Debian setup has become more concrete: apt prerequisite checks, GitHub CLI apt repository setup, Linux command checks, Linux recovery messages, and Linux install dispatch now form a clearer platform-specific surface. That may be a natural boundary, but it still has to preserve the single-sourceable shell standard and avoid adding source-order risk.
Scope
- Refresh
docs/setup-common-ownership.md against the current setup_common.sh implementation and the completed JSON diagnostics migration.
- Identify all Linux/Debian-owned helpers currently spread through setup recovery, platform checks, apt prerequisite setup, GitHub CLI setup, and install dispatch.
- Decide whether those helpers should move to a sourced helper such as
setup_linux_debian.sh or remain in setup_common.sh with better section ordering.
- If extraction is justified, move only the Linux/Debian platform-specific helpers and preserve existing function prefixes, call sites, output, and exit behavior.
- If extraction is not justified, update the ownership doc with the evidence and create no code split.
Acceptance Criteria
- The PR explains the decision using cohesive ownership evidence, not line count.
docs/setup-common-ownership.md is current after the evaluation.
- If code moves, Linux/Debian setup/check/doctor behavior, dry-run output,
--yes consent behavior, and GitHub CLI apt setup behavior are unchanged.
- If code does not move, the doc clearly records why no split is currently worth it.
- Tests cover the moved or reaffirmed Linux/Debian behavior.
Validation
- Relevant BATS coverage in
cli/bash/commands/basectl/tests/setup-common.bats, setup.bats, check.bats, or platform-specific tests.
- Shell syntax check for touched shell files.
- ShellCheck at the repo standard level for touched shell files where available.
git diff --check.
Non-Goals
- Do not split
setup_common.sh by arbitrary topic or line count.
- Do not move macOS Homebrew/Xcode setup in this issue.
- Do not change the platform setup contract: check inspects, setup applies, dry-run previews, and --yes is consent.
- Do not rewrite setup/check/doctor orchestration in Python.
Project Fields
- Priority: P3
- Status: Backlog
- Size: M
- Area: Setup
- Initiative: Contract Hardening
Agent Assignment
Human first. This is a boundary decision plus possible refactor, and it should preserve behavior exactly.
Goal
Evaluate and, only if justified by ownership boundaries, extract the Linux/Debian setup helper surface from
setup_common.shwithout changing setup/check/doctor behavior.Background
docs/setup-common-ownership.mdcorrectly sayssetup_common.shshould not be split just because it is long. The current file remains shared by setup, check, doctor, update, CI mode, profile setup, host probes, project artifact dispatch, and platform installers. Since the ownership note was written, Ubuntu/Debian setup has become more concrete: apt prerequisite checks, GitHub CLI apt repository setup, Linux command checks, Linux recovery messages, and Linux install dispatch now form a clearer platform-specific surface. That may be a natural boundary, but it still has to preserve the single-sourceable shell standard and avoid adding source-order risk.Scope
docs/setup-common-ownership.mdagainst the currentsetup_common.shimplementation and the completed JSON diagnostics migration.setup_linux_debian.shor remain insetup_common.shwith better section ordering.Acceptance Criteria
docs/setup-common-ownership.mdis current after the evaluation.--yesconsent behavior, and GitHub CLI apt setup behavior are unchanged.Validation
cli/bash/commands/basectl/tests/setup-common.bats,setup.bats,check.bats, or platform-specific tests.git diff --check.Non-Goals
setup_common.shby arbitrary topic or line count.Project Fields
Agent Assignment
Human first. This is a boundary decision plus possible refactor, and it should preserve behavior exactly.