1.2 KiB
+++ title = "nbd init: add cache.db to .nbd/.gitignore" priority = 5 status = "todo" ticket_type = "task" dependencies = [] +++
Problem
.nbd/cache.db is a Turso/libsql SQLite cache file created automatically by list_tickets_cached. It should never be committed to git. Currently nbd init does not create a .gitignore to exclude it.
Implementation
src/main.rs — cmd_init
After ensure_tickets_dir succeeds, write (or append to) .nbd/.gitignore:
cache.db
Use idempotent logic: read the file if it exists, check whether cache.db is already listed, and only append/create if it is absent. This keeps nbd init safe to run multiple times.
Suggested helper (can be inline in cmd_init):
- Read
.nbd/.gitignoreif it exists. - If
cache.dbis not a line in the file, appendcache.db\n. - If the file does not exist, create it with
cache.db\n.
The JSON output for --json should include a gitignore key indicating the path that was created/updated (or unchanged).
tests/integration.rs
Add a test that runs nbd init and asserts .nbd/.gitignore contains cache.db. Run nbd init a second time and assert the file is unchanged (idempotent).