xonecas.io
60255
Zn

Zoea-Nova / commit a816cf0

chore(db): add db-reset-accounts target

Add a reset flow that preserves accounts and point docs to the new make target.

required_permissions: ["all"]

xonecas2026-02-04 a816cf058e143aa5f98f5bed8d9b28067a1c721e parent 65e3d52

5 files changed

AGENTS.md+1−1
@@ -60,7 +60,7 @@ The application uses SQLite for persistence.
6060
6161 - **Location**: `~/.zoea-nova/zoea.db`
6262 - **Querying**: Use `sqlite3 ~/.zoea-nova/zoea.db` to run manual queries.
63-- **Wiping**: To reset the state or apply schema changes (since migrations are not supported), delete the database and its temporary files: `rm ~/.zoea-nova/zoea.db*`.
63+- **Wiping**: To reset state or apply schema changes (no migrations), run `make db-reset-accounts` to export usernames/passwords to `accounts-backup.sql`, wipe the DB, recreate schema, and reimport accounts.
6464 - **Testing**: Tests use `t.TempDir()` for isolated database files. Never use the production database path in tests.
6565
6666 ## Terminology:
Makefile+10−1
@@ -1,7 +1,9 @@
1-.PHONY: fmt build run test clean
1+.PHONY: fmt build run test clean db-reset-accounts
22
33 VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
44 LDFLAGS := -ldflags "-X main.Version=$(VERSION)"
5+DB_PATH ?= $(HOME)/.zoea-nova/zoea.db
6+ACCOUNTS_EXPORT ?= accounts-backup.sql
57
68 fmt:
79 go fmt ./...
@@ -18,3 +20,10 @@ test:
1820
1921 clean:
2022 rm -rf bin/ coverage.out
23+
24+db-reset-accounts:
25+ mkdir -p $(HOME)/.zoea-nova
26+ test -f $(DB_PATH) && sqlite3 $(DB_PATH) "SELECT 'INSERT INTO accounts (username, password) VALUES (' || quote(username) || ',' || quote(password) || ');' FROM accounts;" > $(ACCOUNTS_EXPORT) || true
27+ rm -f $(DB_PATH) $(DB_PATH)-shm $(DB_PATH)-wal
28+ sqlite3 $(DB_PATH) < internal/store/schema.sql
29+ test -s $(ACCOUNTS_EXPORT) && sqlite3 $(DB_PATH) < $(ACCOUNTS_EXPORT) || true
documentation/INITIAL_IMPLEMENTATION_DESIGN.md+3−2
@@ -121,10 +121,11 @@ CREATE TABLE accounts (
121121 ```
122122
123123 **Schema v6 → v7 Migration:**
124-Requires fresh database. Delete existing:
124+Requires fresh database. Reset with:
125125 ```bash
126-rm ~/.zoea-nova/zoea.db*
126+make db-reset-accounts
127127 ```
128+This exports usernames/passwords to `accounts-backup.sql` before recreating the DB.
128129
129130 **Memory Sources:**
130131 - `direct` — Message sent directly to a specific Mysis
documentation/KNOWN_ISSUES.md+1−1
@@ -53,7 +53,7 @@ These are the currently known issues to investigate:
5353
5454 - [ ] Create an OpenCode workflow command to enforce: "Save the plan, make a todo list, then follow the plan. Stop if anything deviates from the plan."
5555
56-- [ ] Add a Make command that:
56+- [x] Add a Make command that:
5757 - extracts username/passwords from the current DB to a root-level file
5858 - wipes the current DB
5959 - imports username/passwords from file
documentation/PER_MYSIS_CONFIG_PLAN.md+4−2
@@ -484,12 +484,14 @@ func TestCommanderConfigureMysisWithModel(t *testing.T) {
484484
485485 ## Database Migration Note
486486
487-This change requires schema v4 with a new `temperature` column. Per AGENTS.md, no data migrations are supported. Users must wipe their database:
487+This change requires schema v4 with a new `temperature` column. Per AGENTS.md, no data migrations are supported. Reset with:
488488
489489 ```bash
490-rm ~/.zoea-nova/zoea.db*
490+make db-reset-accounts
491491 ```
492492
493+This exports usernames/passwords to `accounts-backup.sql` before recreating the DB.
494+
493495 ---
494496
495497 ## Implementation Order