feat: add docfill mvp cli

This commit is contained in:
赵义仑
2026-06-18 20:03:47 +08:00
commit ca444bd5d0
22 changed files with 2539 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
# Docfill MVP Design
## Goal
Build the smallest local Go command-line tool that a digital employee can call to fill Word or Excel templates from Excel or SQLite data.
## MVP Scope
- Input data: `.xlsx` table or SQLite query result.
- Template files: `.docx` or `.xlsx`.
- Placeholder syntax: `{{column_name}}`.
- Output: one generated file per input row.
- Invocation: `docfill run --config task.json`.
## Explicit Non-Goals
- No web UI.
- No permission system.
- No workflow engine.
- No template designer.
- No direct business-system integration.
- No AI guessing of fields.
- No complex Word layout manipulation.
## Config Shape
```json
{
"data": {
"type": "excel",
"path": "./data.xlsx",
"sheet": "Sheet1"
},
"template": {
"path": "./template.docx"
},
"output": {
"path": "./out/report_{{name}}_{{_row}}.docx"
}
}
```
For SQLite, `data` uses `type: "sqlite"` and `query`.
## Constraints
- Keep the implementation boring and inspectable.
- Infer template behavior from file extension.
- Treat Excel first row or SQL column names as placeholder keys.
- If a Word placeholder is split across Word XML runs, MVP may not replace it; users should type placeholders as plain contiguous text.