You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1.4 KiB
1.4 KiB
+++
title = "nbd init command"
priority = 7
status = "done"
ticket_type = "feature"
dependencies = []
+++
Add an explicit nbd init subcommand that creates .nbd/tickets/ in the current working directory, analogous to git init.
Motivation
Currently users must run mkdir -p .nbd/tickets manually before first use. This is a friction point — especially for first-time users and agent workflows bootstrapping a new project.
Approach
- Add
Initvariant to theCommandsenum inmain.rs. - Implement
cmd_init(json: bool) -> store::Result<()>:- Get cwd via
std::env::current_dir(). - Call
store::ensure_tickets_dir(&cwd)(already exists, idempotent). - Print confirmation:
initialised .nbd/tickets/ in <path>(or JSON:{"root": "<path>"}).
- Get cwd via
- No changes to
store.rsneeded —ensure_tickets_diralready usescreate_dir_all(idempotent). - The command should NOT require
.nbd/to already exist (i.e. do NOT callfind_nbd_roothere — use cwd directly).
Tests
- Integration test: run
nbd initin a fresh tempdir, verify.nbd/tickets/is created. - Integration test: run
nbd inittwice in the same dir — succeeds both times (idempotent). - Integration test:
nbd init --jsonoutputs valid JSON with arootfield.
Files touched
src/main.rs— newInitvariant andcmd_inithandlertests/integration.rs— new integration testsREADME.md— update Initialise section