Add .gitignore to .beads directory during init (#64)
- Create .gitignore file in .beads/ when running bd init
- Ignores *.db and *.db-* patterns to prevent database commits
- Add test coverage to verify .gitignore creation
- Add .claude/settings.local.json to project .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Ben Madore <madorb@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,14 @@ and database file. Optionally specify a custom issue prefix.`,
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Create .gitignore in .beads directory
|
||||
gitignorePath := filepath.Join(beadsDir, ".gitignore")
|
||||
gitignoreContent := "*.db\n*.db-*\n"
|
||||
if err := os.WriteFile(gitignorePath, []byte(gitignoreContent), 0644); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Warning: failed to create .gitignore: %v\n", err)
|
||||
// Non-fatal - continue anyway
|
||||
}
|
||||
|
||||
// Create database
|
||||
dbPath := filepath.Join(beadsDir, prefix+".db")
|
||||
store, err := sqlite.New(dbPath)
|
||||
|
||||
3
cmd/bd/testdata/init.txt
vendored
3
cmd/bd/testdata/init.txt
vendored
@@ -2,3 +2,6 @@
|
||||
bd init --prefix test
|
||||
stdout 'initialized successfully'
|
||||
exists .beads/test.db
|
||||
exists .beads/.gitignore
|
||||
grep '^\*\.db$' .beads/.gitignore
|
||||
grep '^\*\.db-\*$' .beads/.gitignore
|
||||
|
||||
Reference in New Issue
Block a user