workflow-template-extractor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow: Template Extractor (Real Project → Template)

工作流:模板提取器(真实项目 → 模板)

Goal: Turn a real project into a shareable, runnable template in
templates/
with minimal manual cleanup.
This is intended for “proven projects” you want to reuse as a baseline for future builds.
目标:将真实项目转换为
templates/
目录下可共享、可运行的模板,仅需少量手动清理工作。 本工作流适用于你希望将已验证可行的项目复用为未来开发基准的场景。

Input (pass paths only)

输入(仅需传入路径)

  • source_repo_root
    : Path to the real project
  • target_repo_root
    : Ship Faster repository root (where
    templates/
    lives)
  • run_dir
    :
    runs/template-extractor/active/<run_id>/
  • extract_spec.md
    : What to keep/remove/generalize (brand, copy, assets, integrations, auth gates)
  • source_repo_root
    :真实项目的根目录路径
  • target_repo_root
    :Ship Faster仓库的根目录(即
    templates/
    所在目录)
  • run_dir
    runs/template-extractor/active/<run_id>/
  • extract_spec.md
    :定义需保留/移除/通用化的内容(品牌、文案、资源、集成、授权网关等)

Output (persisted)

输出(持久化存储)

  • 03-plans/extract-plan.md
  • 05-final/extract-summary.md
  • templates/<NNN>-<slug>/
    (runnable)
  • 03-plans/extract-plan.md
  • 05-final/extract-summary.md
  • templates/<NNN>-<slug>/
    (可直接运行)

Workflow

工作流步骤

0) Initialize

0) 初始化

  1. Create
    run_dir
    .
  2. Decide
    <slug>
    and
    <NNN>
    (next available template number).
  3. Copy
    source_repo_root
    templates/<NNN>-<slug>/
    (no build outputs, no caches).
  1. 创建
    run_dir
    目录。
  2. 确定
    <slug>
    <NNN>
    (下一个可用的模板编号)。
  3. source_repo_root
    复制至
    templates/<NNN>-<slug>/
    (不包含构建产物和缓存文件)。

1) De-secrets + de-brand

1) 移除敏感信息与去品牌化

Must do:
  • Remove secret values from all files (
    .env*
    , config, hard-coded tokens).
  • 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:
  • README.md
    (5‑minute runnable)
  • .env.local.example
    (keys only)
  • metadata.json
    (name + description)
Recommended:
  • Ensure scripts exist for
    dev
    ,
    build
    ,
    start
  • If lint/typecheck/format are missing and the repo is TS-heavy, add minimal guardrails (avoid heavy governance)
必需文件:
  • README.md
    (5分钟即可上手运行)
  • .env.local.example
    (仅包含键名)
  • metadata.json
    (包含模板名称与描述)
推荐操作:
  • 确保项目包含
    dev
    build
    start
    脚本
  • 如果仓库以TS为主且缺少代码检查/类型校验/格式化工具,添加基础的防护规则(避免过度管控)

3) Verification

3) 验证

Document in
05-final/extract-summary.md
:
  • install works
  • dev
    starts
  • build
    succeeds (or clearly document why it can’t without credentials)
05-final/extract-summary.md
中记录以下内容:
  • 安装流程正常
  • dev
    命令可启动服务
  • build
    命令执行成功(若因缺少凭证无法构建,需明确说明原因)

Constraints

约束条件

  • Never commit secret values.
  • Extraction should be “copy + cleanup”, not a refactor project.
  • 绝对不能提交敏感值。
  • 提取操作应仅为“复制 + 清理”,而非重构项目。