Files
gstack/bin/gstack-doctor-components.sh
T
Garry Tanandcapy-ai[bot] ada251bbc0 v1.91.96.0 fix: honest install and self-upgrade on Capy (field wave A, items 1-5) (#3164)
* docs(designs): gstack field wave plan (2026-10-12) and the shared simulated Capy host fixture

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(doctor): --min-revision, a launch Bun found off PATH, planning-only pins SKIP

gstack-doctor --check gains --min-revision <v>|unknown: below it the revision
row FAILs with REVISION_BELOW_MINIMUM naming the Capy wrapper or
bin/gstack-upgrade; unknown says so and never claims the minimum. The runtime
and pins rows name a supported Bun found in $BUN_INSTALL/bin (not on PATH)
with the export/GSTACK_LAUNCH fix (gstack_bun_launch_dir, one helper in
bin/gstack-bun-version.sh). --for a planning-only workflow (autoplan, the plan
reviews, office-hours) reports a repo test-pin mismatch as SKIP pins
(planning-only; ...). New result codes UPGRADE_REFUSED, UPGRADE_FETCH_FAILED,
REVISION_BELOW_MINIMUM, CAPY_WRAPPER_STALE, INSTALL_UNVERIFIED with
troubleshooting anchors; REVISION_UNMET's fix names bin/gstack-upgrade.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(install): install verdict and install admission at skill start

bin/gstack-install-verdict.sh (Bash) and lib/install-verdict.ts (TypeScript)
are the one reader of the install verdict gstack-capy-install writes to
<state root>/install-verdicts/<sha256(checkout realpath)>.json (checkout,
HEAD, workflow and required components, planning-only pins, trailer). The
source checkout and capy/support.env resolve through gstack_source_root /
sourceRoot, which follow an installed root's .source-path.

gstack-skill-start, after SESSION_KIND: an unattended session (any host)
refuses on a PATH Bun below the supported minimum; with GSTACK_CAPY=1 an
unattended or explicit spawned session also refuses without a passing
verdict for this checkout, HEAD and workflow (INSTALL_UNVERIFIED). A refusal
prints the INSTALL: row, an install-refused instruction block bound to its
SESSION_ID, GSTACK_RESULT ... status=refused run=- and exits 3. Ambient
spawned sessions warn; GSTACK_ALLOW_UNSUPPORTED_RUNTIME=1 admits and says so.
capy/support.env declares GSTACK_MIN_REVISION and GSTACK_CAPY_MIN_WRAPPER.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(capy-install): launch PATH, Bun reuse and CI pins, setup skip on HEAD, verdict, --check

The GSTACK_LAUNCH line carries PATH=<dir>:$PATH when the certified Bun is not
first on PATH, plus GSTACK_CAPY=1 and GSTACK_INSTALL_VERDICT, and
GSTACK_LAUNCH_PATH: <dir>; the doctor runs with that PATH. A supported Bun in
$BUN_INSTALL/bin is reused instead of downloaded again. Project pins are read
with bin/gstack-runtime-pins.ts (CI lanes included): when every exact pin is
gstack's verified version the archive is installed alongside a different PATH
Bun; any other exact pin is RUNTIME_PIN_CONFLICT. Both ./setup runs are
skipped when this HEAD was set up with the same hosts, model and browser flag
and the check passes (never after a fast-forward); a failed setup ends with
gstack: fail setup and is retried next run. --check certifies only;
GSTACK_CAPY_LOCK_HELD=1 accepts the bootstrapper's held lock; result anchors
come from the generated components table; REV_NOTE names bin/gstack-upgrade.

Intentional pin change: test/gstack-capy-install.test.ts --revision trailer
now names <root>/bin/gstack-upgrade (the old text named a command that never
existed).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(upgrade): bin/gstack-upgrade, the unattended fast-forward every fix line names

--check fetches and prints current|behind <installed> -> <remote> (<n>
commits); the default fast-forwards to the remote default branch tip and
reinstalls (bin/gstack-capy-install on a Capy install, else ./setup
--refresh-registered), completing a pending reinstall on the next run. It
refuses (UPGRADE_REFUSED, exit 3, nothing changed) a dirty tracked byte, a
diverged commit, a pinned checkout, the incoming Bun floor and a held
.setup-lock; never stashes or resets; an unreachable remote is
UPGRADE_FETCH_FAILED. Fetches are receipted (fail-open). The unattended
skill-end UPGRADE_AVAILABLE line is followed by UPGRADE_COMMAND naming it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(capy): vendored Capy skill, frozen bootstrapper and full wrapper bin/gstack-capy-session

capy/skill/gstack/ is the Drive skill's source of truth. scripts/install.sh
is a frozen bootstrapper: it prints gstack-capy-skill: wrapper <n> (<path>),
clones or fetches under .gstack-capy-install.lock, reads the remote
capy/support.env (FETCH_HEAD), fast-forwards a clean unpinned checkout below
GSTACK_MIN_REVISION (refusing dirty, diverged or pinned checkouts with the
exact commands; GSTACK_CAPY_AUTO_UPGRADE=0 disables), and execs the
checkout's own bin/gstack-capy-session with GSTACK_CAPY_LOCK_HELD=1 so the
held lock is never taken twice. Offline it says the remote minimum is
unknown. A Drive copy older than GSTACK_CAPY_MIN_WRAPPER prints an owner
action (CAPY_WRAPPER_STALE). SKILL.md: check at session start, install
lazily before the first workflow, the GSTACK_LAUNCH line, the trailer rule,
the subagent first-report line, gstack-pregate sealed before any push, and
the autoplan/DRIVER.md pointer. The context-budget fixture gains the skill's
entry.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs: Capy install layers, lazy install, snapshot bake, forward-only recovery, raising the minimum

docs/capy-install.md describes the three layers (Drive bootstrapper, full
wrapper, installer), the lazy install, the GSTACK_LAUNCH line, install
admission, baking gstack into a Capy snapshot, and that recovery after an
interrupted fast-forward completes or refuses the pending install stages
(checking out an older commit is not a rollback). docs/CHANGELOG_STYLE.md
(the release doc; there is no docs/RELEASING.md) says when
GSTACK_MIN_REVISION may be raised.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* refactor(capy): the stale-copy owner action moves from the frozen bootstrapper to bin/gstack-capy-session

The checkout-owned full wrapper reads GSTACK_CAPY_MIN_WRAPPER through
gstack_support_env_get(gstack_source_root) and compares it with the
bootstrapper revision it was handed, so the rule can change without
recopying the Drive skill. The bootstrapper keeps only what a stale checkout
cannot do: clone, fetch, read the remote minimum, fast-forward, exec.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* v1.91.96.0: honest install and self-upgrade on Capy; supported minimum 1.91.96.0

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test: drop the helper-only Capy host fixture test (test-of-test ratchet); lane tests exercise the helper

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test: bound the new sync spawns in the install-verdict and wrapper tests (spawnSync tripwire)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* ci(paid-pr-profile): the vendored Capy skill is free-only; free-only files are not prompts needing paid coverage

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* chore(harness): non-behavioral HARNESS_VERSION decision for the PR-profile free-only rule

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(doctor): lane A runtime and pins cases are platform-neutral (bash paths; a lane-free .bun-version pin)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs(designs): field wave plan with amendments and the gate rev 2-3 review record (ARTIFACT_VALID, 3 gate revisions)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(capy-install): follow a project's exact Bun pin above the minimum when gstack has its verified archive (adds Bun 1.4.3)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs: the installer follows a verified exact project Bun pin (capy-install, troubleshooting, changelog)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(capy-install): the install reason names the project's pin and gstack's real minimum

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-13 14:41:58 +00:00

185 lines
11 KiB
Bash

# shellcheck shell=bash
# gstack-doctor-components.sh — GENERATED from lib/doctor-components.ts and
# lib/result-codes.ts by scripts/gen-doctor-components.ts (bun run gen:skill-docs). Do not edit; the
# freshness test is test/doctor-components.test.ts. Sourced by
# bin/gstack-doctor-check.sh; Bash 3.2 builtins only.
GSTACK_DOCTOR_COMPONENTS="claude codex patch codex-cli browse-bundle browser cso runtime pins state-root privacy cores revision"
GSTACK_DOCTOR_CORE="runtime pins state-root privacy cores revision"
GSTACK_DOCTOR_HOSTS="claude codex"
GSTACK_DOCTOR_OPTIONAL="codex-cli cso"
GSTACK_DOCTOR_SKILLS="autoplan plan-ceo-review plan-eng-review plan-design-review plan-devex-review plan-tune office-hours spec review ship investigate codex cso browse qa qa-only design-review design-consultation design-html devex-review scrape skillify canary benchmark make-pdf diagram pair-agent open-gstack-browser setup-browser-cookies connect-chrome land-and-deploy benchmark-models careful claude-code context-restore context-save design-shotgun deslop-shared-libs document-generate document-release eval-plan freeze gstack-upgrade guard health ios-clean ios-design-review ios-fix ios-qa ios-sync landing-report learn retro setup-deploy setup-gbrain sync-gbrain test-audit unfreeze"
GSTACK_BROWSER_LAZY_REASON="lazy; gstack-browser-ensure installs on first use"
# gstack_doctor_component_title ID — the human title; returns 1 for an unknown id.
gstack_doctor_component_title() {
case "$1" in
claude) printf '%s' 'Claude skills' ;;
codex) printf '%s' 'Codex skills' ;;
patch) printf '%s' 'Astra behavioral patch in the Codex render' ;;
codex-cli) printf '%s' 'Codex CLI (outside voice)' ;;
browse-bundle) printf '%s' 'browse bundle' ;;
browser) printf '%s' 'Chromium launch and render' ;;
cso) printf '%s' 'CSO native helper' ;;
runtime) printf '%s' 'gstack runtime (Bun)' ;;
pins) printf '%s' 'project pins' ;;
state-root) printf '%s' 'state root' ;;
privacy) printf '%s' 'privacy' ;;
cores) printf '%s' 'cores' ;;
revision) printf '%s' 'revision' ;;
*) return 1 ;;
esac
}
# gstack_doctor_component_kind ID — core | host | component | optional; returns 1 for an unknown id.
gstack_doctor_component_kind() {
case "$1" in
claude) printf '%s' 'host' ;;
codex) printf '%s' 'host' ;;
patch) printf '%s' 'component' ;;
codex-cli) printf '%s' 'optional' ;;
browse-bundle) printf '%s' 'component' ;;
browser) printf '%s' 'component' ;;
cso) printf '%s' 'optional' ;;
runtime) printf '%s' 'core' ;;
pins) printf '%s' 'core' ;;
state-root) printf '%s' 'core' ;;
privacy) printf '%s' 'core' ;;
cores) printf '%s' 'core' ;;
revision) printf '%s' 'core' ;;
*) return 1 ;;
esac
}
# gstack_doctor_skill_requires SKILL — the non-core ids the skill needs; returns 1 for an unknown skill.
gstack_doctor_skill_requires() {
case "$1" in
autoplan|plan-ceo-review|plan-eng-review|plan-design-review|plan-devex-review|plan-tune|office-hours|spec|review|ship|investigate) printf '%s' 'claude codex patch' ;;
codex) printf '%s' 'claude codex patch codex-cli' ;;
cso) printf '%s' 'claude cso' ;;
browse|qa|qa-only|design-review|design-consultation|design-html|devex-review|scrape|skillify|canary|benchmark|make-pdf|diagram|pair-agent|open-gstack-browser|setup-browser-cookies|connect-chrome|land-and-deploy) printf '%s' 'claude codex patch browse-bundle browser' ;;
benchmark-models|careful|claude-code|context-restore|context-save|design-shotgun|deslop-shared-libs|document-generate|document-release|eval-plan|freeze|gstack-upgrade|guard|health|ios-clean|ios-design-review|ios-fix|ios-qa|ios-sync|landing-report|learn|retro|setup-deploy|setup-gbrain|sync-gbrain|test-audit|unfreeze) printf '%s' 'claude' ;;
*) return 1 ;;
esac
}
# gstack_doctor_skill_optional SKILL — ids that SKIP when absent; returns 1 for an unknown skill.
gstack_doctor_skill_optional() {
case "$1" in
autoplan|plan-ceo-review|plan-eng-review|plan-design-review|plan-devex-review|plan-tune|office-hours|spec|review|ship|investigate) printf '%s' 'codex-cli' ;;
codex) printf '%s' '' ;;
cso) printf '%s' '' ;;
browse|qa|qa-only|design-review|design-consultation|design-html|devex-review|scrape|skillify|canary|benchmark|make-pdf|diagram|pair-agent|open-gstack-browser|setup-browser-cookies|connect-chrome|land-and-deploy) printf '%s' 'codex-cli' ;;
benchmark-models|careful|claude-code|context-restore|context-save|design-shotgun|deslop-shared-libs|document-generate|document-release|eval-plan|freeze|gstack-upgrade|guard|health|ios-clean|ios-design-review|ios-fix|ios-qa|ios-sync|landing-report|learn|retro|setup-deploy|setup-gbrain|sync-gbrain|test-audit|unfreeze) printf '%s' '' ;;
*) return 1 ;;
esac
}
# gstack_doctor_skill_pins_advisory SKILL — true for a planning-only workflow (a repo test-pin mismatch SKIPs pins).
gstack_doctor_skill_pins_advisory() {
case "$1" in
autoplan|plan-ceo-review|plan-eng-review|plan-design-review|plan-devex-review|office-hours) return 0 ;;
*) return 1 ;;
esac
}
# gstack_result_anchor CODE — the docs/troubleshooting.md anchor for a lib/result-codes.ts code; returns 1 for an unknown code.
gstack_result_anchor() {
case "$1" in
ARTIFACT_INVALID_JSON) printf '%s' 'artifact-invalid-json' ;;
ARTIFACT_UNSUPPORTED_VERSION) printf '%s' 'artifact-unsupported-version' ;;
ARTIFACT_SCHEMA) printf '%s' 'artifact-schema' ;;
ARTIFACT_MISSING) printf '%s' 'artifact-missing' ;;
ARTIFACT_STALE) printf '%s' 'artifact-stale' ;;
ARTIFACT_PATH_ESCAPE) printf '%s' 'artifact-path-escape' ;;
ARTIFACT_MALFORMED_JSONL) printf '%s' 'artifact-malformed-jsonl' ;;
ARTIFACT_DUPLICATE_ID) printf '%s' 'artifact-duplicate-id' ;;
ARTIFACT_UNBOUND_ID) printf '%s' 'artifact-unbound-id' ;;
ARTIFACT_DANGLING_REF) printf '%s' 'artifact-dangling-ref' ;;
ARTIFACT_DEPENDENCY_CYCLE) printf '%s' 'artifact-dependency-cycle' ;;
ARTIFACT_COUNT_MISMATCH) printf '%s' 'artifact-count-mismatch' ;;
ARTIFACT_RUN_INTERRUPTED) printf '%s' 'artifact-run-interrupted' ;;
ARTIFACT_REVIEWER_MISSING) printf '%s' 'artifact-reviewer-missing' ;;
ARTIFACT_GUARD_LINE_MISSING) printf '%s' 'artifact-guard-line-missing' ;;
GUARD_NOT_INSTALLED) printf '%s' 'guard-not-installed' ;;
REVIEW_STATUS_MISMATCH) printf '%s' 'review-status-mismatch' ;;
GATE_REV_STALE) printf '%s' 'gate-rev-stale' ;;
GATE_REPLY_UNPARSED) printf '%s' 'gate-reply-unparsed' ;;
COMPONENT_MISSING) printf '%s' 'doctor-component-missing' ;;
RUNTIME_BELOW_MINIMUM) printf '%s' 'doctor-runtime-below-minimum' ;;
PROJECT_PIN_MISMATCH) printf '%s' 'doctor-project-pin-mismatch' ;;
REVISION_UNMET) printf '%s' 'doctor-revision-unmet' ;;
RUNTIME_PIN_CONFLICT) printf '%s' 'capy-install-runtime-conflict' ;;
BROWSER_UNAVAILABLE) printf '%s' 'browser-ensure-failed' ;;
INSTALL_PREFLIGHT_FAILED) printf '%s' 'capy-install-preflight-failed' ;;
POLICY_SOURCE_UNAVAILABLE) printf '%s' 'policy-source-unavailable' ;;
POLICY_INVALID) printf '%s' 'policy-invalid' ;;
POLICY_CONTAINMENT) printf '%s' 'policy-containment' ;;
POLICY_EXISTS) printf '%s' 'policy-exists' ;;
REPO_COMMANDS_NOT_ALLOWED) printf '%s' 'repo-commands-not-allowed' ;;
QUEUE_STALE) printf '%s' 'queue-stale' ;;
RESTAMP_VERSION_SOURCE) printf '%s' 'restamp-version-source' ;;
RESTAMP_MERGE_CONFLICT) printf '%s' 'restamp-merge-conflict' ;;
RESTAMP_RELEASE_TOOL_FAILED) printf '%s' 'restamp-release-tool-failed' ;;
RESTAMP_OUTPUT_OUTSIDE_ALLOWED) printf '%s' 'restamp-output-outside-allowed' ;;
RESTAMP_CONFLICT) printf '%s' 'restamp-conflict' ;;
RESTAMP_PREDECESSOR_MOVED) printf '%s' 'restamp-predecessor-moved' ;;
CHANGELOG_DUPLICATE_HEADING) printf '%s' 'changelog-duplicate-heading' ;;
CHANGELOG_TOP_MISMATCH) printf '%s' 'changelog-top-mismatch' ;;
CHANGELOG_SECTION_MISSING) printf '%s' 'changelog-section-missing' ;;
GATE_REUSE_NOT_ELIGIBLE) printf '%s' 'gate-reuse-not-eligible' ;;
EVIDENCE_IDENTITY_UNKNOWN) printf '%s' 'evidence-identity-unknown' ;;
EVIDENCE_BUNDLE_INVALID) printf '%s' 'evidence-bundle-invalid' ;;
PREREGISTRATION_NOT_ANCESTOR) printf '%s' 'preregistration-not-ancestor' ;;
HISTORY_POLICY_VIOLATION) printf '%s' 'history-policy-violation' ;;
RECEIPT_MISSING) printf '%s' 'receipt-missing' ;;
RECEIPT_INVALID) printf '%s' 'receipt-invalid' ;;
EXECUTION_UNKNOWN) printf '%s' 'execution-unknown' ;;
RUN_LOCKED) printf '%s' 'run-locked' ;;
RUN_NOT_INITIALIZED) printf '%s' 'run-not-initialized' ;;
PHASE_NOT_AWAITING) printf '%s' 'phase-not-awaiting' ;;
ATTEMPT_MISMATCH) printf '%s' 'attempt-mismatch' ;;
RESULT_RECEIPT_MISSING) printf '%s' 'result-receipt-missing' ;;
RESULT_FINDINGS_MISSING) printf '%s' 'result-findings-missing' ;;
MODEL_FAMILY_CONFLICT) printf '%s' 'model-family-conflict' ;;
SPEND_CAP_EXCEEDED) printf '%s' 'spend-cap-exceeded' ;;
CONSENSUS_MISSING) printf '%s' 'consensus-missing' ;;
OUTSIDE_RUNNER_UNAVAILABLE) printf '%s' 'outside-runner-unavailable' ;;
REALITY_ROW_MISSING) printf '%s' 'reality-row-missing' ;;
REALITY_RECEIPT_MISSING) printf '%s' 'reality-receipt-missing' ;;
REGEN_REGISTRY_INVALID) printf '%s' 'regen-registry-invalid' ;;
REGEN_CONTAINMENT) printf '%s' 'regen-containment' ;;
REGEN_STALE) printf '%s' 'regen-stale' ;;
REGEN_COMMAND_FAILED) printf '%s' 'regen-command-failed' ;;
PREGATE_CONFIG_INVALID) printf '%s' 'pregate-config-invalid' ;;
PREGATE_SECRETS) printf '%s' 'pregate-secrets' ;;
PREGATE_STRAYS) printf '%s' 'pregate-strays' ;;
PREGATE_LITERALS) printf '%s' 'pregate-literals' ;;
PREGATE_NO_LANE) printf '%s' 'pregate-no-lane' ;;
PREGATE_LANE_FAILED) printf '%s' 'pregate-lane-failed' ;;
PREGATE_INCOMPLETE) printf '%s' 'pregate-incomplete' ;;
PREGATE_STALE) printf '%s' 'pregate-stale' ;;
PREGATE_REMOTE_UNCLEARED) printf '%s' 'pregate-remote-uncleared' ;;
ISSUE_UNREADABLE) printf '%s' 'issue-unreadable' ;;
PREREG_INCOMPLETE) printf '%s' 'prereg-incomplete' ;;
EVAL_PRICE_MISSING) printf '%s' 'eval-price-missing' ;;
EVAL_DRY_RUN_FAILED) printf '%s' 'eval-dry-run-failed' ;;
EVAL_ARMS_UNRESOLVED) printf '%s' 'eval-arms-unresolved' ;;
EVAL_BUDGET_EXHAUSTED) printf '%s' 'eval-budget-exhausted' ;;
LANE_CONFLICT) printf '%s' 'lane-conflict' ;;
LANE_REF_UNAVAILABLE) printf '%s' 'lane-ref-unavailable' ;;
EVIDENCE_UNVERIFIED) printf '%s' 'evidence-unverified' ;;
BANNED_TERM_FOUND) printf '%s' 'banned-term-found' ;;
BANNED_TERMS_INVALID) printf '%s' 'banned-terms-invalid' ;;
CONTRIBUTOR_SOURCE_UNAVAILABLE) printf '%s' 'contributor-source-unavailable' ;;
BRIEF_INPUT_MISSING) printf '%s' 'brief-input-missing' ;;
DRAFT_DIRECTION_UNRESOLVED) printf '%s' 'draft-direction-unresolved' ;;
UPGRADE_REFUSED) printf '%s' 'upgrade-refused' ;;
UPGRADE_FETCH_FAILED) printf '%s' 'upgrade-fetch-failed' ;;
REVISION_BELOW_MINIMUM) printf '%s' 'revision-below-minimum' ;;
CAPY_WRAPPER_STALE) printf '%s' 'capy-wrapper-stale' ;;
INSTALL_UNVERIFIED) printf '%s' 'install-unverified' ;;
*) return 1 ;;
esac
}