模板工作流
.doct 是 Docmod 的模板包,也是 Agent 的任务边界。它不只是样式文件,而是把内容字段、格式角色、完整模板和写作指南放在一起。
template.doct├── format.json├── content.json├── document.html├── source.docx├── guides/├── images/└── meta.json模板负责什么
Section titled “模板负责什么”content.json定义文档应该包含哪些字段。format.json定义 paragraph、run、table 的角色和样式。document.html提供完整模板和{{placeholder}}。guides/提供写作、审阅、排版规则。
Agent 应该输出角色和内容,而不是随意写 CSS:
<p data-pstyle="title">{{title}}</p><p data-pstyle="body">正文内容。</p>Docmod 负责把 data-pstyle / data-rstyle 转成模板里的真实 Word 样式。
docmod template listdocmod read government.doct --contentdocmod read government.doct --formatdocmod read government.doct --guide writing模板解析顺序是路径、用户模板库、内置模板。用户模板通常安装在 ~/.docmod/templates/。
使用模板创建文档
Section titled “使用模板创建文档”docmod create output.docx --template government --from changes.htmldocmod create output.docx --template ./custom.doct --from changes.html创建时模板会填充占位符、烘焙 format.json,并使用模板的 source.docx 作为 Keep 基底。
docmod template init marked.docx --to template.doctdocmod template validate template.doctdocmod template install template.doct --name government标记样本文档时,先在 Word 中放好 {{title}}、{{body}}、{{date}} 等占位符,再从它生成 .doct。生成后继续补充 guides,让 Agent 知道怎么写、怎么审、怎么排。
重新绑定模板
Section titled “重新绑定模板”.docmod 在 meta.json 里按裸名引用模板:
docmod set-template work.docmod --template government如果引用名解析不到,读取会返回 TEMPLATE_NOT_FOUND,提示先 docmod template list 找候选模板,再重绑。