live-dev-config

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

live-dev-config

live-dev-config

This skill handles code repository linking, cloud hosting setup, and secure credential collection.
bash
blocks are POSIX (Git Bash on Windows). Any logic beyond one command/pipe lives in
resources/*.js
, never in shell control flow. If your Bash tool is cmd.exe or PowerShell, translate each snippet before running it.
该Skill负责代码仓库关联、云托管设置以及安全凭据收集。
bash
代码块遵循POSIX标准(Windows系统使用Git Bash)。任何超出单条命令/管道的逻辑都放在
resources/*.js
中,绝不使用Shell控制流。如果你的Bash工具是cmd.exe或PowerShell,请在运行前转换每个代码片段。

1. Provisioning & Project Linking

1. 资源配置与项目关联

Configure or verify repository and hosting resources in this order:
ResourceSkip ifConstraints
GitHub repoa remote exists
gh repo create --private --source=. --push
, from a repo with ≥1 commit. Repo name defaults to the folder name — ask the user for nothing else. Public only on request.
Vercel project
.vercel/project.json
vercel link --yes
— non-interactive. Linking also wires the Vercel↔GitHub integration.
按以下顺序配置或验证仓库和托管资源:
资源可跳过条件约束
GitHub repo已存在远程仓库使用
gh repo create --private --source=. --push
,需在已有至少1次提交的仓库中执行。仓库名称默认使用文件夹名称——无需向用户询问其他信息。仅在用户要求时设置为公开。
Vercel project存在
.vercel/project.json
使用
vercel link --yes
—— 非交互式操作。关联操作同时会建立Vercel与GitHub的集成。

2. Secure Credential Collection

2. 安全凭据收集

Ensure that credentials never leak into git history, command-line logs, or shell execution paths.
确保凭据不会泄露到Git历史、命令行日志或Shell执行路径中。

2.1 Credential collection

2.1 凭据收集

Emit
.credential-fields.json
holding only what this step needs (e.g. service account JSON or specific API keys):
json
[{ "name": "FIREBASE_SERVICE_ACCOUNT", "label": "Firebase 服務帳戶金鑰",
   "help": "Project settings → Service accounts → Generate new private key",
   "link": "https://console.firebase.google.com/project/<id>/settings/serviceaccounts/adminsdk" }]
bash
node resources/credential-form.js .credential-fields.json   # launch via the TOOL's background mode, NOT a shell `&`
  • Credential Form: Starts a 127.0.0.1-only form, opens the browser, writes to the gitignored
    .env.local
    file, and exits. Relay the URL to the user if the browser does not open automatically.
  • Manual template fallback: If no browser can open, write
    .env.local.template
    as
    KEY_NAME=   # description & link
    for the user to fill and save to
    .env.local
    .
  • Command CLI Logins: For CLI logins (
    gh auth login
    ,
    vercel login
    ,
    firebase login
    ), use each tool's standard device flow.
生成
.credential-fields.json
文件,仅包含此步骤所需的内容(例如服务账户JSON或特定API密钥):
json
[{ "name": "FIREBASE_SERVICE_ACCOUNT", "label": "Firebase 服務帳戶金鑰",
   "help": "Project settings → Service accounts → Generate new private key",
   "link": "https://console.firebase.google.com/project/<id>/settings/serviceaccounts/adminsdk" }]
bash
node resources/credential-form.js .credential-fields.json   # 通过工具的后台模式启动,不要使用Shell的 `&`
  • 凭据表单: 启动仅绑定127.0.0.1的表单,打开浏览器,将内容写入已被Git忽略的
    .env.local
    文件后退出。如果浏览器未自动打开,请将URL告知用户。
  • 手动模板回退: 若无法打开浏览器,生成
    .env.local.template
    文件,格式为
    KEY_NAME=   # 描述 & 链接
    ,供用户填写后保存为
    .env.local
  • 命令行登录: 对于CLI登录(
    gh auth login
    vercel login
    firebase login
    ),使用各工具的标准设备流程。

2.2 Security Guidelines

2.2 安全指南

Never
source
/
eval
.env.local
, never interpolate credentials into double quotes or
<<<
(shell expansions could execute code). Extract using
read-env-value.js
and pipe to stdin:
bash
node resources/read-env-value.js .env.local FIREBASE_SERVICE_ACCOUNT | vercel env add FIREBASE_SERVICE_ACCOUNT production
绝不要使用
source
/
eval
加载
.env.local
,绝不要将凭据插入双引号或
<<<
(Shell展开可能执行代码)。使用
read-env-value.js
提取并通过管道传递到标准输入:
bash
node resources/read-env-value.js .env.local FIREBASE_SERVICE_ACCOUNT | vercel env add FIREBASE_SERVICE_ACCOUNT production

or GitHub secrets:

或设置GitHub密钥:

node resources/read-env-value.js .env.local FIREBASE_SERVICE_ACCOUNT | gh secret set FIREBASE_SERVICE_ACCOUNT

Report by key name only: `✅ <KEY> set in Vercel/production` / `✅ <KEY> set in GitHub Secrets`.
node resources/read-env-value.js .env.local FIREBASE_SERVICE_ACCOUNT | gh secret set FIREBASE_SERVICE_ACCOUNT

仅按密钥名称报告:`✅ <KEY> 已在Vercel/production中设置` / `✅ <KEY> 已在GitHub Secrets中设置`。