edgeone-pages-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEdgeOne Pages Deployment Skill
EdgeOne Pages 部署技能
Deploy any project to EdgeOne Pages.
将任意项目部署至EdgeOne Pages。
⛔ Critical Rules (MUST follow — never skip)
⛔ 重要规则(必须遵守,切勿跳过)
- CLI version MUST be or higher. If the installed version is lower, reinstall. Do NOT proceed with an outdated version.
1.2.30 - NEVER truncate the deploy URL. The includes query parameters that are required for access. Always output the complete URL including all query string parameters — without them the page won't load.
EDGEONE_DEPLOY_URL - MUST ask the user to choose China or Global site before login. Never assume.
- MUST auto-detect the login method — browser login in desktop environments, token login in headless/remote/CI environments. Follow the decision table below.
- After token login, MUST ask if the user wants to save the token locally for future use.
- CLI版本必须为或更高。若已安装版本低于该要求,请重新安装。切勿使用过时版本进行操作。
1.2.30 - 绝不要截断部署URL。包含访问所需的查询参数。务必输出完整的URL,包括所有查询字符串参数——缺少这些参数页面将无法加载。
EDGEONE_DEPLOY_URL - 登录前必须询问用户选择中国站还是全球站。切勿自行假设。
- 必须自动检测登录方式——桌面环境下使用浏览器登录,无头/远程/CI环境下使用Token登录。请遵循下方的决策表。
- Token登录完成后,必须询问用户是否要将Token本地保存,以便后续使用。
Deployment Flow
部署流程
Run these checks first, then follow the decision table:
bash
undefined先执行以下检查,再遵循决策表操作:
bash
undefinedCheck 1: CLI installed and correct version?
检查1:CLI是否已安装且版本正确?
edgeone -v
edgeone -v
Check 2: Already logged in?
检查2:是否已登录?
edgeone whoami
edgeone whoami
Check 3: Project already linked?
检查3:项目是否已关联?
cat edgeone.json 2>/dev/null
cat edgeone.json 2>/dev/null
Check 4: Saved token exists?
检查4:是否存在已保存的Token?
cat .edgeone/.token 2>/dev/null
undefinedcat .edgeone/.token 2>/dev/null
undefinedDecision Table
决策表
| CLI version | Login status | Action |
|---|---|---|
| Not installed or version < 1.2.30 | — | → Go to Install CLI |
| Logged in | → Go to Deploy |
| Not logged in, has saved token | → Go to Deploy with Token (use saved token) |
| Not logged in, no saved token | → Go to Login |
| CLI版本 | 登录状态 | 操作 |
|---|---|---|
| 未安装或版本 < 1.2.30 | — | → 跳转至安装CLI |
| 已登录 | → 跳转至部署 |
| 未登录,但存在已保存的Token | → 跳转至使用Token部署(使用已保存的Token) |
| 未登录,且无已保存的Token | → 跳转至登录 |
Install CLI
安装CLI
bash
npm install -g edgeone@latestVerify: must output or higher. If not, retry installation.
edgeone -v1.2.30bash
npm install -g edgeone@latest验证:必须输出或更高版本。若未达到,请重新安装。
edgeone -v1.2.30Login
登录
1. Ask the user to choose a site
1. 询问用户选择站点
You MUST ask before running any login command. Use the IDE's selection control ():
ask_followup_questionChoose your EdgeOne Pages site:
- China — For users in mainland China (console.cloud.tencent.com)
- Global — For users outside China (console.intl.cloud.tencent.com)
执行任何登录命令前必须询问。使用IDE的选择控件():
ask_followup_question选择你的EdgeOne Pages站点:
- 中国站 — 面向中国大陆用户(console.cloud.tencent.com)
- 全球站 — 面向海外用户(console.intl.cloud.tencent.com)
2. Detect environment and choose login method
2. 检测环境并选择登录方式
| Condition | Method |
|---|---|
| Local desktop IDE (e.g. VS Code, Cursor, etc.) | Browser Login |
| Remote / SSH / container / CI / cloud IDE / headless | Token Login |
| User explicitly requests token | Token Login |
| 条件 | 方式 |
|---|---|
| 本地桌面IDE(如VS Code、Cursor等) | 浏览器登录 |
| 远程/SSH/容器/CI/云IDE/无头环境 | Token登录 |
| 用户明确要求使用Token | Token登录 |
Browser Login
浏览器登录
bash
undefinedbash
undefinedChina site
中国站
edgeone login --site china
edgeone login --site china
Global site
全球站
edgeone login --site global
Wait for the user to complete browser auth. The CLI prints a success message when done.edgeone login --site global
等待用户完成浏览器端认证。完成后CLI会打印成功消息。Token Login
Token登录
Token login does NOT use . The token is passed directly in the deploy command via .
edgeone login-tGuide the user to get a token:
- Go to the console:
- Find API Token → Create Token → Copy it
⚠️ Remind the user: the token has account-level permissions. Never commit it to a repository.
Token登录不使用命令。Token通过部署命令中的参数直接传入。
edgeone login-t引导用户获取Token:
- 进入控制台:
- 找到API Token → 创建Token → 复制Token
⚠️ 提醒用户:该Token拥有账号级权限,切勿提交至代码仓库。
3. Offer to save the token locally
3. 提供Token本地保存选项
After the user provides a token, MUST ask:
Would you like to save this token locally for future deployments?
- Yes — Save to
(auto-used next time).edgeone/.token- No — Use for this deployment only
If Yes:
bash
mkdir -p .edgeone
echo "<token>" > .edgeone/.token
grep -q '.edgeone/.token' .gitignore 2>/dev/null || echo '.edgeone/.token' >> .gitignoreTell the user: "✅ Token saved to and added to ."
.edgeone/.token.gitignore用户提供Token后,必须询问:
是否要将该Token本地保存,以便未来部署使用?
- 是 — 保存至
(下次部署将自动使用).edgeone/.token- 否 — 仅本次部署使用
若选择是:
bash
mkdir -p .edgeone
echo "<token>" > .edgeone/.token
grep -q '.edgeone/.token' .gitignore 2>/dev/null || echo '.edgeone/.token' >> .gitignore告知用户:“✅ Token已保存至,并已添加至。”
.edgeone/.token.gitignoreDeploy
部署
Browser-authenticated deploy
浏览器认证后的部署
bash
undefinedbash
undefinedProject already linked (edgeone.json exists)
项目已关联(存在edgeone.json)
edgeone pages deploy
edgeone pages deploy
New project (no edgeone.json)
新项目(无edgeone.json)
edgeone pages deploy -n <project-name>
`<project-name>`: auto-generate from the project directory name. The first deploy creates `edgeone.json` automatically.edgeone pages deploy -n <project-name>
`<project-name>`:从项目目录名自动生成。首次部署会自动创建`edgeone.json`。Token-based deploy
基于Token的部署
First check for a saved token:
bash
cat .edgeone/.token 2>/dev/null- Saved token found → use it, tell the user: "Using saved token from "
.edgeone/.token - No saved token → ask the user to provide one (see Token Login above)
bash
undefined首先检查是否存在已保存的Token:
bash
cat .edgeone/.token 2>/dev/null- 找到已保存的Token → 使用该Token,并告知用户:“正在使用中保存的Token”
.edgeone/.token - 无已保存的Token → 引导用户提供Token(参考上方Token登录部分)
bash
undefinedProject already linked
项目已关联
edgeone pages deploy -t <token>
edgeone pages deploy -t <token>
New project
新项目
edgeone pages deploy -n <project-name> -t <token>
The token already contains site info — no `--site` flag needed.
**After a successful deploy with a manually-entered token**, ask if the user wants to save it (see "Offer to save the token locally" above).edgeone pages deploy -n <project-name> -t <token>
Token已包含站点信息 — 无需使用`--site`参数。
**若手动输入Token完成部署后**,询问用户是否要保存该Token(参考“提供Token本地保存选项”部分)。Deploy to preview environment
部署至预览环境
bash
edgeone pages deploy -e previewbash
edgeone pages deploy -e previewBuild behavior
构建行为
The CLI auto-detects the framework, runs the build, and uploads the output directory. No manual config needed.
CLI会自动检测框架,执行构建并上传输出目录。无需手动配置。
⚠️ Parse Deploy Output (Critical — read carefully)
⚠️ 解析部署输出(至关重要,请仔细阅读)
After succeeds, the CLI outputs:
edgeone pages deploy[cli][✔] Deploy Success
EDGEONE_DEPLOY_URL=https://my-project-abc123.edgeone.cool?<auth_query_params>
EDGEONE_DEPLOY_TYPE=preset
EDGEONE_PROJECT_ID=pages-xxxxxxxx
[cli][✔] You can view your deployment in the EdgeOne Pages Console at:
https://console.cloud.tencent.com/edgeone/pages/project/pages-xxxxxxxx/deployment/xxxxxxxExtraction rules:
| Field | How to extract | ⛔ Warning |
|---|---|---|
| Access URL | Full value after | MUST include the full query string ( |
| Project ID | Value after | — |
| Console URL | Line after "You can view your deployment..." | — |
Show the user:
✅ Deployment complete!
- Access URL:
https://my-project-abc123.edgeone.cool?<auth_query_params>- Console URL:
https://console.cloud.tencent.com/edgeone/pages/project/...
edgeone pages deploy[cli][✔] Deploy Success
EDGEONE_DEPLOY_URL=https://my-project-abc123.edgeone.cool?<auth_query_params>
EDGEONE_DEPLOY_TYPE=preset
EDGEONE_PROJECT_ID=pages-xxxxxxxx
[cli][✔] You can view your deployment in the EdgeOne Pages Console at:
https://console.cloud.tencent.com/edgeone/pages/project/pages-xxxxxxxx/deployment/xxxxxxx提取规则:
| 字段 | 提取方式 | ⛔ 注意事项 |
|---|---|---|
| 访问URL | | 必须包含完整的查询字符串( |
| 项目ID | | — |
| 控制台URL | “You can view your deployment...”后的行内容 | — |
展示给用户:
✅ 部署完成!
- 访问URL:
https://my-project-abc123.edgeone.cool?<auth_query_params>- 控制台URL:
https://console.cloud.tencent.com/edgeone/pages/project/...
Error Handling
错误处理
| Error | Solution |
|---|---|
| |
| Browser doesn't open during login | Use token login instead |
| "not logged in" error | |
| Auth error with token | Token may be expired — regenerate at the console |
| Project name conflict | Use a different name with |
| Build failure | Check logs — usually missing deps or bad build script |
| 错误 | 解决方案 |
|---|---|
| 执行 |
| 登录时浏览器未自动打开 | 改用Token登录 |
| “not logged in”错误 | 执行 |
| Token认证错误 | Token可能已过期 — 前往控制台重新生成 |
| 项目名称冲突 | 使用 |
| 构建失败 | 检查日志 — 通常是缺少依赖或构建脚本错误 |
Appendix
附录
Edge/Node Functions
Edge/Node 函数
For projects needing server-side functions, run before first deploy:
bash
edgeone pages initPure static projects skip this.
对于需要服务端函数的项目,首次部署前执行:
bash
edgeone pages init纯静态项目可跳过此步骤。
Local Development
本地开发
bash
edgeone pages dev # http://localhost:8088/bash
edgeone pages dev # http://localhost:8088/Environment Variables
环境变量
bash
edgeone pages env ls # List all
edgeone pages env pull # Pull to local .env
edgeone pages env add KEY val # Add
edgeone pages env rm KEY # Removebash
edgeone pages env ls # 列出所有环境变量
edgeone pages env pull # 拉取至本地.env文件
edgeone pages env add KEY val # 添加环境变量
edgeone pages env rm KEY # 删除环境变量Project Linking
项目关联
bash
edgeone pages linkbash
edgeone pages linkToken Management
Token管理
| Task | How |
|---|---|
| Save token | Stored in |
| Update token | Delete |
| Use saved token | Automatic — the agent reads |
| 任务 | 操作方式 |
|---|---|
| 保存Token | 存储在 |
| 更新Token | 删除 |
| 使用已保存的Token | 自动完成 — 代理会在每次Token部署前读取 |
Command Reference
命令参考
| Action | Command |
|---|---|
| Install CLI | |
| Check version | |
| Login (China) | |
| Login (Global) | |
| View login info | |
| Logout | |
| Switch account | |
| Init functions | |
| Local dev | |
| Link project | |
| Deploy | |
| Deploy new project | |
| Deploy preview | |
| Deploy with token | |
| 操作 | 命令 |
|---|---|
| 安装CLI | |
| 检查版本 | |
| 登录(中国站) | |
| 登录(全球站) | |
| 查看登录信息 | |
| 登出 | |
| 切换账号 | |
| 初始化函数 | |
| 本地开发 | |
| 关联项目 | |
| 部署 | |
| 部署新项目 | |
| 部署预览环境 | |
| 使用Token部署 | |