Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions crates/shelbi-cli/src/commands/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,13 @@ fn expand_tilde(p: &std::path::Path) -> PathBuf {
}

/// Add shelbi's footprint to the repo's `.gitignore` if it isn't already
/// covered: `.shelbi/` (metadata) plus the `.claude/` files shelbi deploys
/// into the worktree on every dispatch (settings.json, agent-instructions.md,
/// skills/, the ready marker). Without the `.claude/` entries a repo that
/// doesn't already ignore that dir shows those files as untracked and the
/// worktree reads as dirty. Writes to the file on the workspace's filesystem
/// via `sh -c`; never commits.
/// covered: `.shelbi/` (metadata) plus the fixed `.claude/` files shelbi
/// deploys into the worktree on every dispatch (settings.json,
/// agent-instructions.md, the ready marker). Shelbi's *skill* mounts are
/// intentionally NOT claimed here — they're excluded per-name in the
/// worktree's git exclude at mount time, so a user's own `.claude/skills/`
/// stays under their git control (see `refresh_agent_skills`). Writes to the
/// file on the workspace's filesystem via `sh -c`; never commits.
fn ensure_gitignored(host: &Host, machine: &Machine) -> Result<()> {
let repo = machine.work_dir.to_string_lossy().into_owned();
// Probe each footprint independently so a repo that already ignores
Expand All @@ -295,12 +296,18 @@ fn ensure_gitignored(host: &Host, machine: &Machine) -> Result<()> {
}
// Representative probe: if the ready marker isn't ignored, none of the
// shelbi-written `.claude/` files are, so append the whole block.
//
// NB: we deliberately do NOT blanket-claim `.claude/skills/` here — that
// would hide (and, historically, let Shelbi destroy) user-authored skills.
// Shelbi's own skill mounts are gitignored per-name in the worktree's git
// exclude at mount time (see `refresh_agent_skills` /
// `deploy_orchestrator_system_skill`), so a user's `.claude/skills/` stays
// fully under their own git control.
if !check_ignored(host, &repo, ".claude/shelbi-ready")? {
snippet.push_str(
"\n# shelbi deploy footprint written into the worktree on dispatch\n\
.claude/settings.json\n\
.claude/agent-instructions.md\n\
.claude/skills/\n\
.claude/shelbi-ready\n",
);
}
Expand Down
Loading
Loading