fix(project): add trash/ to .skillshare/.gitignore

Project mode uninstall moves skills to .skillshare/trash/, but this
directory was not gitignored — soft-deleted skills could be accidentally
committed.

- ensureProjectGitignore now adds both logs/ and trash/ via a single
  UpdateGitIgnoreBatch call (replaces two separate UpdateGitIgnore calls)
- uninstall_project.go calls ensureProjectGitignore for backward compat,
  patching projects created before this fix on next uninstall run
This commit is contained in:
Willie
2026-03-17 04:48:42 +08:00
parent 7b65ffe60a
commit 90c096b8e9
2 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -501,8 +501,8 @@ func ensureProjectGitignore(root string) error {
}
}
// Always ignore project logs to avoid committing operational noise.
if err := install.UpdateGitIgnore(gitignoreDir, "logs"); err != nil {
// Always ignore operational directories to avoid committing noise.
if err := install.UpdateGitIgnoreBatch(gitignoreDir, []string{"logs", "trash"}); err != nil {
return fmt.Errorf("failed to update .skillshare/.gitignore: %w", err)
}
+3
View File
@@ -89,6 +89,9 @@ func cmdUninstallProject(args []string, root string) error {
sourceDir := filepath.Join(root, ".skillshare", "skills")
trashDir := trash.ProjectTrashDir(root)
// Backward compat: ensure operational dirs are gitignored for projects created before v0.17.3.
_ = ensureProjectGitignore(root)
// --- Phase 1: RESOLVE ---
var targets []*uninstallTarget
seen := map[string]bool{}