Files
xls_doc/docs/superpowers/plans/2026-06-18-docfill-mvp.md
2026-06-18 20:03:47 +08:00

46 lines
1.5 KiB
Markdown

# Docfill MVP 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:** Build a minimal Go CLI that fills `.docx` and `.xlsx` templates from Excel or SQLite rows.
**Architecture:** A single internal package loads JSON config, reads rows from Excel or SQLite, renders placeholders into docx/xlsx files, and exposes `Run`. A tiny CLI parses `run --config`.
**Tech Stack:** Go, `excelize` for `.xlsx`, `modernc.org/sqlite` for SQLite, standard `archive/zip` for `.docx`.
---
### Task 1: Tests First
**Files:**
- Create: `internal/docfill/docfill_test.go`
- [ ] Write tests for Excel row reading, SQLite row reading, xlsx rendering, docx rendering, and full config execution.
- [ ] Run `go test ./...` and confirm it fails because the package implementation does not exist yet.
### Task 2: Minimal Library
**Files:**
- Create: `internal/docfill/docfill.go`
- [ ] Implement config parsing.
- [ ] Implement Excel and SQLite row readers.
- [ ] Implement placeholder replacement.
- [ ] Implement xlsx and docx rendering.
- [ ] Implement `Run(configPath string) error`.
### Task 3: CLI
**Files:**
- Create: `cmd/docfill/main.go`
- [ ] Parse `docfill run --config task.json`.
- [ ] Print clear errors to stderr.
- [ ] Exit non-zero on failure.
### Task 4: Verify
- [ ] Run `go test ./...`.
- [ ] Run `go build ./cmd/docfill`.
- [ ] Keep README usage minimal.