workflow-template-extractor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorkflow: Template Extractor (Real Project → Template)
工作流:模板提取器(真实项目 → 模板)
Goal: Turn a real project into a shareable, runnable template in with minimal manual cleanup.
templates/This is intended for “proven projects” you want to reuse as a baseline for future builds.
目标:将真实项目转换为目录下可共享、可运行的模板,仅需少量手动清理工作。
本工作流适用于你希望将已验证可行的项目复用为未来开发基准的场景。
templates/Input (pass paths only)
输入(仅需传入路径)
- : Path to the real project
source_repo_root - : Ship Faster repository root (where
target_repo_rootlives)templates/ - :
run_dirruns/template-extractor/active/<run_id>/ - : What to keep/remove/generalize (brand, copy, assets, integrations, auth gates)
extract_spec.md
- :真实项目的根目录路径
source_repo_root - :Ship Faster仓库的根目录(即
target_repo_root所在目录)templates/ - :
run_dirruns/template-extractor/active/<run_id>/ - :定义需保留/移除/通用化的内容(品牌、文案、资源、集成、授权网关等)
extract_spec.md
Output (persisted)
输出(持久化存储)
03-plans/extract-plan.md05-final/extract-summary.md- (runnable)
templates/<NNN>-<slug>/
03-plans/extract-plan.md05-final/extract-summary.md- (可直接运行)
templates/<NNN>-<slug>/
Workflow
工作流步骤
0) Initialize
0) 初始化
- Create .
run_dir - Decide and
<slug>(next available template number).<NNN> - Copy →
source_repo_root(no build outputs, no caches).templates/<NNN>-<slug>/
- 创建目录。
run_dir - 确定和
<slug>(下一个可用的模板编号)。<NNN> - 将复制至
source_repo_root(不包含构建产物和缓存文件)。templates/<NNN>-<slug>/
1) De-secrets + de-brand
1) 移除敏感信息与去品牌化
Must do:
- Remove secret values from all files (, config, hard-coded tokens).
.env* - Replace project IDs (Stripe price IDs, Supabase URLs/keys, webhook secrets) with env var keys.
- Replace branding (names/domains/logos) with neutral placeholders unless the template is intentionally branded.
必须完成的操作:
- 从所有文件中移除敏感值(文件、配置文件、硬编码的令牌等)。
.env* - 将项目ID(Stripe价格ID、Supabase URL/密钥、Webhook密钥等)替换为环境变量键名。
- 将品牌信息(名称/域名/Logo)替换为中性占位符,除非模板需要保留特定品牌。
2) Normalize template entry docs
2) 标准化模板入口文档
Required files:
- (5‑minute runnable)
README.md - (keys only)
.env.local.example - (name + description)
metadata.json
Recommended:
- Ensure scripts exist for ,
dev,buildstart - If lint/typecheck/format are missing and the repo is TS-heavy, add minimal guardrails (avoid heavy governance)
必需文件:
- (5分钟即可上手运行)
README.md - (仅包含键名)
.env.local.example - (包含模板名称与描述)
metadata.json
推荐操作:
- 确保项目包含、
dev、build脚本start - 如果仓库以TS为主且缺少代码检查/类型校验/格式化工具,添加基础的防护规则(避免过度管控)
3) Verification
3) 验证
Document in :
05-final/extract-summary.md- install works
- starts
dev - succeeds (or clearly document why it can’t without credentials)
build
在中记录以下内容:
05-final/extract-summary.md- 安装流程正常
- 命令可启动服务
dev - 命令执行成功(若因缺少凭证无法构建,需明确说明原因)
build
Constraints
约束条件
- Never commit secret values.
- Extraction should be “copy + cleanup”, not a refactor project.
- 绝对不能提交敏感值。
- 提取操作应仅为“复制 + 清理”,而非重构项目。