Skip to content

Name the module the three environment bootstraps share #68

Description

@daniel-kindl

Problem

Converging the agent home inside a container is one concept. It is written inline three
times, in bootstrap/web-dev.sh, bootstrap/python-dev.sh and bootstrap/rust-dev.sh.

Measured with difflib, after normalising the environment name:

Pair Identical lines
python-dev and rust-dev 137 of 173
web-dev and python-dev 125 of 218
web-dev and rust-dev 122 of 218

The shared tail is one coherent step: install the agent CLIs, wire ~/.agents, wire the
Claude and Codex homes, link the skills, merge the Codex preferences, and install the status
line.

The LINK_ROOT block that remaps /workspace to the host spelling is byte-identical three
times, at web-dev.sh:47-55, python-dev.sh:35-43 and rust-dev.sh:39-47. It is subtle,
and a fix in one copy does not reach the other two.

docs/bootstrap.md reproduces the duplication a fourth time, as three idempotency tables
that differ only in their toolchain rows.

The host side already has the module

The host version of this exact concept is a module. bootstrap/lib/agent-home.sh:10-37
holds install_host_agent_home, and both bootstrap/host.sh:102 and
components/agent-home/install.sh:20 call it.

So bootstrap/lib/ holds a library for the side that has two callers, and none for the side
that has three.

install_host_agent_home already takes the home directory as a parameter
(local home=${2:-$HOME}), which is the same trick the container version needs.

No test covers these three scripts

They run inside a container. verify/25-python-dev.sh and verify/26-rust-dev.sh observe
the result on a live machine, and they share 61 of about 110 lines with each other.

Goal

Name the module the three environment bootstraps share, and let each script hold only its
toolchain.

Proposed direction

  • Add a function beside install_host_agent_home that converges the agent home inside a
    container. It takes the home directory and the link root as parameters.
  • Move the shared tail into it: the agent CLIs, the ~/.agents wiring, the client wiring,
    the skills, the preferences, the status line and the LINK_ROOT resolution.
  • Each bootstrap/<env>.sh keeps its header, its guard, its manifest, its toolchain step,
    one call and its manual list.
  • Document the shared step once in docs/bootstrap.md, and document the three toolchain
    differences separately.
  • Drive the shared environment checks in verify/25-python-dev.sh and
    verify/26-rust-dev.sh from the module record, so a new environment gets its container,
    home, package and routing checks from its manifest, and contributes only its toolchain
    assertions.

Acceptance criteria

  • One function converges the agent home inside a container, and the three environment bootstraps call it.
  • The LINK_ROOT resolution has one definition.
  • Each bootstrap/<env>.sh holds only its toolchain step and its manual list.
  • A test exercises the shared function against a temporary directory, with no container.
  • docs/bootstrap.md states the shared step once.
  • The shared environment verification reads the module record, and names no environment identifier.
  • Adding a supported environment adds no copy of the shared tail.
  • ./verify.sh remains green.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorStructural change without intended behavior change

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions