From ce0db55e3619c3433519758dc4cfee97a1a280d9 Mon Sep 17 00:00:00 2001 From: MiFaZhan Date: Fri, 30 Oct 2026 11:43:10 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E7=A7=BB=E9=99=A4=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=96=87=E6=A1=A3=EF=BC=8C=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E7=89=88=E6=96=87=E6=A1=A3=E7=BB=9F=E4=B8=80=E8=A7=81=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docs/superpowers/plans/2026-07-13-sqlite-generated-cards.md(SQLite 挡板改造实施计划,含任务分解与勾选清单) 保留 docs/deploy.md(面向使用者的部署说明)。 文档站:https://git.5iot.com/iotlcm-public/iotlcm-docs --- .../2026-07-13-sqlite-generated-cards.md | 88 ------------------- 1 file changed, 88 deletions(-) delete mode 100644 docs/superpowers/plans/2026-07-13-sqlite-generated-cards.md diff --git a/docs/superpowers/plans/2026-07-13-sqlite-generated-cards.md b/docs/superpowers/plans/2026-07-13-sqlite-generated-cards.md deleted file mode 100644 index 5349b9b..0000000 --- a/docs/superpowers/plans/2026-07-13-sqlite-generated-cards.md +++ /dev/null @@ -1,88 +0,0 @@ -# SQLite Generated Cards Implementation Plan - -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. - -**Goal:** Replace the MySQL-backed card source with a local SQLite-backed mock data generator, fixed traffic values, and Excel export. - -**Architecture:** The service will use SQLite as the runtime persistence layer and keep the existing in-memory `Store` shape for OneLink handlers. The admin sync action becomes card generation: it appends generated rows to SQLite and refreshes memory. Excel export maps stored card rows to the inbound workbook column format. - -**Tech Stack:** Go `net/http`, `database/sql`, SQLite driver, Vue 3, Vite, simple XLSX generation via Go standard library zip/XML. - ---- - -### Task 1: Lock Generated Card Rules With Tests - -**Files:** -- Test: `internal/app/generator_test.go` -- Create: `internal/app/generator.go` - -- [ ] Write tests that generated cards use timestamp-related unique identifiers, fixed monthly traffic `18432 KB`, APN `CMIOT`, and export metadata matching the confirmed sample. -- [ ] Run `go test ./internal/app -run TestGenerated -count=1` and verify it fails because the generator does not exist. -- [ ] Implement the minimal generator API and constants. -- [ ] Run the focused test and verify it passes. - -### Task 2: Replace MySQL Backend With SQLite Backend - -**Files:** -- Modify: `go.mod` -- Modify: `internal/app/store_file.go` -- Create/modify: `internal/app/store_sqlite.go` -- Modify: `internal/app/store.go` -- Test: `internal/app/store_test.go` - -- [ ] Add tests that `NewStoreManager` no longer requires `BAFFLE_DB_DSN`, loads from SQLite, and appends generated cards without deleting existing rows. -- [ ] Run focused tests and verify failure. -- [ ] Implement SQLite schema creation, load, save, delete, and append generation behavior. -- [ ] Remove runtime database reload from `Snapshot()` so normal reads do not hit external DB logic. -- [ ] Run focused tests and verify pass. - -### Task 3: Admin API And Excel Export - -**Files:** -- Modify: `internal/app/admin.go` -- Create: `internal/app/export_xlsx.go` -- Test: `internal/app/admin_test.go` or existing app tests - -- [ ] Add tests for `POST /api/generate` with `count`, and `GET /api/cards/export` returning XLSX bytes with the confirmed headers. -- [ ] Run focused tests and verify failure. -- [ ] Implement generate and export handlers. -- [ ] Run focused tests and verify pass. - -### Task 4: Remove Traffic Growth From Runtime - -**Files:** -- Modify: `internal/app/store.go` -- Modify: `internal/app/model.go` -- Modify: `internal/app/admin.go` -- Test: `internal/app/store_test.go` - -- [ ] Add or update tests to prove snapshot does not increment traffic over time. -- [ ] Remove `applyGrowthLocked()` calls and UI-facing settings behavior. -- [ ] Keep fixed traffic values in generated card records. -- [ ] Run focused tests and verify pass. - -### Task 5: Frontend Update - -**Files:** -- Modify: `frontend/src/main.js` -- Modify: `frontend/src/style.css` - -- [ ] Replace "一键同步" with "一键生成". -- [ ] Add generation count input. -- [ ] Call `POST /api/generate`. -- [ ] Add export button linking/downloading from `/api/cards/export`. -- [ ] Remove traffic growth controls and growth column. -- [ ] Run `npm run build` in `frontend`. - -### Task 6: Documentation And Verification - -**Files:** -- Modify: `README.md` -- Modify: `docker-compose.yaml` -- Modify: `docker-compose.yaml` if needed - -- [ ] Update docs to describe SQLite, generation, export, and fixed traffic. -- [ ] Remove MySQL DSN instructions. -- [ ] Run `go test ./...` with a writable `GOCACHE`. -- [ ] Run frontend build. -- [ ] Check `git diff` for unintended changes.