Skip to content

Fix local chezmoi bootstrap for global agent installs#1

Open
DanielZ818 wants to merge 2 commits into
Kevin-Mok:masterfrom
DanielZ818:daniel-mac
Open

Fix local chezmoi bootstrap for global agent installs#1
DanielZ818 wants to merge 2 commits into
Kevin-Mok:masterfrom
DanielZ818:daniel-mac

Conversation

@DanielZ818

Copy link
Copy Markdown

Summary / Why This Matters

This branch adds a reusable global/local agent-surface installer for Codex and then fixes the first-run bootstrap bugs that showed up on a non-owner machine.

Before the follow-up fixes, the installer could leave local setup half-working:

  • chezmoi could be installed but not initialized
  • first-run chezmoi apply could fail on missing template data like gui
  • rendered chezmoi config could still point at the repo owner's ~/linux-config
  • the current shell might not see ~/.local/bin, so a freshly installed chezmoi was not callable

This PR makes the bootstrap path work for a local clone under a different home-directory layout.

What Changed

  • add scripts/executable_install-agent-surface to bootstrap:
    • repo-local AGENTS.md / AGENTS.repo.md / plans/
    • local .agents/skills/ or chezmoi-style dot_agents/skills/
    • global ~/.codex/AGENTS.md
    • global ~/.agents/AGENTS.md, ~/.agents/skills/, and ~/.agents/system-design/
  • add fish completions for install-agent-surface
  • add bash fallback ~/scripts path support in dot_bashrc
  • make global installer bootstrap chezmoi when missing
  • make global installer render a default ~/.config/chezmoi/chezmoi.toml when missing
  • make global installer initialize ~/.local/share/chezmoi from the current repo when missing
  • make .chezmoiignore tolerate missing first-run gui data
  • render chezmoi sourceDir from the actual local clone path instead of hardcoding ~/linux-config
  • update README, smoke-test coverage, installer plan notes, and lessons to reflect the new operator flow

How To Smoke Test

Use a fresh shell where ~/.local/bin is available, or add it first:

export PATH="$HOME/.local/bin:$PATH"

Run the global installer from this repo:

./scripts/executable_install-agent-surface --global --all-skills

Verify the global surfaces exist:

ls ~/.codex/AGENTS.md
ls ~/.agents/AGENTS.md
ls ~/.agents/skills
ls ~/.agents/system-design

Verify chezmoi is available and initialized:

command -v chezmoi
ls ~/.config/chezmoi/chezmoi.toml
ls ~/.local/share/chezmoi
chezmoi apply

Verify repo-local install modes still work:

./scripts/executable_install-agent-surface --target /tmp/test-agent-repo --skill commit-plan
./scripts/executable_install-agent-surface --target /tmp/test-agent-dotfiles --chezmoi --skill openai-docs

For fish-specific behavior, open a new fish shell and verify:

complete -C "install-agent-surface --"
command -v chezmoi

Tests Written / Verification Run

Automated tests written or updated:

  • tests/scripts/executable_install-agent-surface_test.sh

Commands run:

  • tests/scripts/executable_install-agent-surface_test.sh
  • bash -n scripts/executable_install-agent-surface tests/scripts/executable_install-agent-surface_test.sh
  • fish -n dot_config/fish/completions/install-agent-surface.fish
  • ./scripts/executable_readme-recruiter-sync .
  • chezmoi execute-template < .chezmoiignore

Commands not run:

  • refresh-config
  • a full real-machine chezmoi apply after the final sourceDir/template fixes from this branch

Known failing suites or unrelated failures:

  • Not available from this branch work
  • Git pushes to upstream origin fail from this environment with GitHub 403 for account DanielZ818

Follow-Up / Next Steps

  • Merge this PR and verify the flow on a clean non-owner machine
  • Consider a broader portability pass for the other historical ~/linux-config and /home/kevin/linux-config references that are outside this installer/bootstrap path

Reviewer Focus / What To Look For

Please focus on bootstrap safety and portability:

  • whether the installer now covers the full first-run chezmoi path instead of only the binary install
  • whether rendering sourceDir from the actual clone path is the right long-term behavior
  • whether the global-vs-local install modes are clearly separated and low-risk for an existing machine
  • whether the fish/bash path handling is sufficient for new sessions without surprising existing shell behavior

Risks, Caveats, Known Failures, And Rollback

  • This PR changes bootstrap behavior for global installer runs, so the main risk is affecting first-run setup on machines that were previously relying on manual chezmoi init steps
  • The installer intentionally leaves existing chezmoi config and source directories unchanged when they already exist, which reduces overwrite risk but means it will not repair arbitrary pre-existing local drift
  • The repo still contains other hardcoded linux-config paths outside the installer/bootstrap path; those are not addressed here
  • Rollback is straightforward:
    • remove the installer script and shell completion
    • revert the chezmoi template/ignore changes
    • revert the README and smoke-test updates
    • restore the previous shell path handling

UI Screenshots / Live Links

Not applicable for this shell/bootstrap workflow.

DanielZ818 and others added 2 commits June 9, 2026 12:15
- add install-agent-surface for repo-local and global ~/.agents / ~/.codex installs
- auto-install chezmoi for chezmoi-targeted setup when it is missing
- add shell support with fish completions and bash ~/scripts fallback path
- add installer tests plus README and smoke-test coverage for the new workflow
- ensure global installer bootstraps chezmoi config and source state before apply
- stop assuming the clone lives at ~/linux-config in rendered chezmoi config
- make .chezmoiignore tolerate missing first-run template data like gui
- add shell and installer test coverage for local bootstrap behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants