Skip to content

feat(kits): add neutral shell rc.d hook for personal kits #482

Closed

Description

@mogul

Intent

Move the neutral shell drop-in hook described in ADR-0030 out of team-specific kit behavior and into the base-image contract or a built-in neutral kit.

Parent: #473
ADR: #474

Scope

  • Provide a neutral ~/.rc.d hook for shell snippets delivered by built-in, team, or personal kits.
  • Source snippets for bash and zsh in deterministic lexical order.
  • Define equivalent native conf.d behavior or documented constraints for fish and nushell.
  • Document guardrails: kit-owned, not user-editable state; no secrets; do not duplicate what devenv already provides inside a devenv shell.
  • Document intended use-cases: neutral hook, agent shell integration outside devenv, team tool completions/env, personal aliases/functions, direnv/devenv hook.

Deferred Decisions

  • Whether this lives in the base image or a built-in neutral kit can be decided at implementation time, based on which path minimizes backend-specific behavior.

Acceptance Criteria

  • Personal kits can add shell snippets without depending on a team kit.
  • Existing team-kit behavior has a migration path.
  • Shell startup remains deterministic and does not expose secrets.
  • Tests cover snippet ordering and shell startup integration where feasible.

Orchestration Notes

Implementation should be done by an authoring sub-agent and reviewed by an independent adversarial review sub-agent. Review findings must be addressed before the increment is accepted.

Activity

  1. mogul commented on Sep 17, 2026

    @mogul
    ContributorAuthor

    Implemented the first quickstart-side rc.d increment on refactor/acq-devenv-base-image.

    Commit: 2982ba5 feat(kits): source neutral rc snippets

    What landed:

    • MSB agent-user login profile bridge now sources kit-owned ~/.rc.d/*.sh snippets for bash/zsh login shells.
    • Snippets are sourced in deterministic lexical order via the shell glob expansion.
    • The bridge remains acq-owned/idempotent and is rewritten only when it still matches the acq-owned profile block.
    • The hook does not run direnv allow and does not duplicate the explicit ACQ_ACTIVATE_PROJECT_ENV behavior.
    • Existing .bashrc bridge behavior remains intact.

    Verification:

    • PASS: bash -n acq.backends/msb.sh test/bats/72-msb-agent-user.bats
    • PASS: git diff --check
    • PASS: printf %s\\n acq.backends/msb.sh test/bats/72-msb-agent-user.bats | xargs -r -n8 shellcheck --severity=warning
    • PASS: ./scripts/test-acq-bats test/bats/72-msb-agent-user.bats test/bats/140-opencode-migration-gate.bats (50/50)

    Still deferred:

    • Publishing a built-in neutral capability kit artifact that installs/populates snippets.
    • SBX/base-image-side parity, if needed beyond what sbx images/kits already provide.
    • Fish/nushell native conf.d behavior; this increment covers bash/zsh-compatible .sh snippets only.
  2. mogul commented on Sep 18, 2026

    @mogul
    ContributorAuthor

    Added fixture coverage for neutral rc.d snippet delivery.

    Commit: 932a8b7 test(kits): cover neutral rc snippet delivery

    What landed:

    • SBX: test proves a neutral hybrid/v1 kit with files/home/agent/.rc.d/10-team.sh materializes through kit_translate_to_sbx into the sbx-v2 kit payload and mode workaround.
    • MSB: test proves a neutral kit can copy /home/agent/.rc.d/10-team.sh and /home/agent/.rc.d/90-personal.sh into the guest and chown the top rc.d tree to the agent user.
    • This complements 2982ba5, which added the MSB login-profile bridge that sources ~/.rc.d/*.sh for bash/zsh login shells.

    Verification:

    • PASS: bash -n acq.backends/msb.sh acq.backends/kit-translate.sh test/bats/72-msb-agent-user.bats test/bats/74-msb-restart-durability.bats test/bats/90-sbx-startup-kit.bats
    • PASS: git diff --check
    • PASS: focused ShellCheck on changed files
    • PASS: filtered Bats: ./test/vendor/bats-core/bin/bats --filter 'rc\\.d\\(sbx\\)|rc\\.d\\(msb\\)|migration gate' test/bats/90-sbx-startup-kit.bats test/bats/72-msb-agent-user.bats test/bats/74-msb-restart-durability.bats test/bats/140-opencode-migration-gate.bats (9/9)

    Known residual:

    • Full test/bats/90-sbx-startup-kit.bats still includes the unrelated pre-existing stale-probe/git-identity failure; the new SBX rc.d test passes.
  3. mogul commented on Sep 24, 2026

    @mogul
    ContributorAuthor

    Updated rc.d implementation status

    The latest quickstart-side rc.d increment is now pushed on refactor/acq-devenv-base-image / #474.

    Latest relevant commit: 59d10f0 feat(kits): wire neutral rc snippets

    What changed since the earlier comments here:

    • Added acq_login_profile_rc_block as the shared backend-neutral bridge text.
    • MSB now writes that shared bridge from its acq-owned login-profile setup.
    • SBX now installs the same bridge at create time through a post-create sbx exec, rather than through a startup-bearing kit.
    • SBX waits for exec readiness before bridge installation, so freshly-created sandboxes do not silently miss the hook while exec is still starting.
    • The bridge sources readable ~/.rc.d/*.sh snippets in deterministic byte order via LC_ALL=C listing.
    • Tests now execute the generated block against a temporary HOME and verify snippet order, instead of only checking logged command text.
    • Documentation now states the implemented shell behavior precisely: the built-in ~/.profile bridge covers bash login shells; zsh-capable base images must wire the same directory from native zsh startup files; fish/nushell remain documented native-conf.d future paths.

    Verification:

    Check Result
    ./scripts/test-acq-bats test/bats/72-msb-agent-user.bats test/bats/90-sbx-startup-kit.bats PASS (61/61)
    ./scripts/test-acq-bats PASS (597/597) after the follow-up hardening commit
    ShellCheck on touched shell/test files PASS
    git diff --check PASS
    npm run lint:md PASS (0 issues)

    Residual risk: live ./scripts/verify-backends was not run in this session because it requires a sandbox-capable host/backend setup.

  4. mogul commented on Oct 6, 2026

    @mogul
    ContributorAuthor

    Implemented and shipped in v4.0.0 via #474 (with corrective #549). Neutral ~/.rc.d/*.sh hook is delivered and bridged on both msb and sbx. The PR's Closes: footer did not auto-close this because the collapsed-stack squash merge dropped the closing keyword references; closing manually now that the work is on main and released.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions