--- # nbd-m9q2 title: 'nbd init: add cache.db to .nbd/.gitignore' status: todo type: task priority: normal created_at: 2026-03-10T23:30:30Z updated_at: 2026-03-10T23:30:30Z --- ## 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`): 1. Read `.nbd/.gitignore` if it exists. 2. If `cache.db` is not a line in the file, append `cache.db\n`. 3. 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).