EdgeOne Pages Deployment Skill
Deploy any project to EdgeOne Pages.
⛔ Critical Rules (MUST follow — never skip)
- 1. CLI version MUST be
1.2.30 or higher. If the installed version is lower, reinstall. Do NOT proceed with an outdated version. - NEVER truncate the deploy URL. The
EDGEONE_DEPLOY_URL includes eo_token= and eo_time= query parameters — they are required for access. Always output the complete 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.
Deployment Flow
Run these checks first, then follow the decision table:
CODEBLOCK0
Decision Table
| CLI version | Login status | Action |
|---|
| Not installed or version < 1.2.30 | — | → Go to Install CLI |
| INLINECODE4 ✓ |
Logged in | → Go to
Deploy |
|
≥ 1.2.30 ✓ | Not logged in, has saved token | → Go to
Deploy with Token (use saved token) |
|
≥ 1.2.30 ✓ | Not logged in, no saved token | → Go to
Login |
Install CLI
CODEBLOCK1
Verify: edgeone -v must output 1.2.30 or higher. If not, retry installation.
Login
1. Ask the user to choose a site
You MUST ask before running any login command. Use the IDE's selection control (ask_followup_question):
Choose your EdgeOne Pages site:
- - China — For users in mainland China (console.cloud.tencent.com)
- Global — For users outside China (console.intl.cloud.tencent.com)
2. Detect environment and choose login method
| 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 |
Browser Login
CODEBLOCK2
Wait for the user to complete browser auth. The CLI prints a success message when done.
Token Login
Token login does NOT use edgeone login. The token is passed directly in the deploy command via -t.
Guide the user to get a token:
- 1. Go to the console:
-
China: https://console.cloud.tencent.com/edgeone/pages?tab=settings
-
Global: https://console.intl.cloud.tencent.com/edgeone/pages?tab=settings
- 2. Find API Token → Create Token → Copy it
⚠️ Remind the user: the token has account-level permissions. Never commit it to a repository.
3. Offer to save the token locally
After the user provides a token, MUST ask:
Would you like to save this token locally for future deployments?
- - Yes — Save to
.edgeone/.token (auto-used next time) - No — Use for this deployment only
If Yes:
CODEBLOCK3
Tell the user: "✅ Token saved to .edgeone/.token and added to .gitignore."
Deploy
Browser-authenticated deploy
CODEBLOCK4
INLINECODE15 : auto-generate from the project directory name. The first deploy creates edgeone.json automatically.
Token-based deploy
First check for a saved token:
CODEBLOCK5
- - 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)
CODEBLOCK6
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).
Deploy to preview environment
CODEBLOCK7
Build behavior
The CLI auto-detects the framework, runs the build, and uploads the output directory. No manual config needed.
⚠️ Parse Deploy Output (Critical — read carefully)
After edgeone pages deploy succeeds, the CLI outputs:
CODEBLOCK8
Extraction rules:
| Field | How to extract | ⛔ Warning |
|---|
| Access URL | Full value after INLINECODE20 | MUST include ?eo_token=...&eo_time=... — without these params the page won't load |
| Project ID |
Value after
EDGEONE_PROJECT_ID= | — |
|
Console URL | Line after "You can view your deployment..." | — |
Show the user:
✅ Deployment complete!
- - Access URL: INLINECODE23
- Console URL: INLINECODE24
Error Handling
| Error | Solution |
|---|
| INLINECODE25 | INLINECODE26 |
| Browser doesn't open during login |
Use token login instead |
| "not logged in" error |
edgeone whoami to check, then re-login or use token |
| Auth error with token | Token may be expired — regenerate at the console |
| Project name conflict | Use a different name with
-n |
| Build failure | Check logs — usually missing deps or bad build script |
Appendix
Edge/Node Functions
For projects needing server-side functions, run before first deploy:
CODEBLOCK9
Pure static projects skip this.
Local Development
CODEBLOCK10
Environment Variables
CODEBLOCK11
Project Linking
CODEBLOCK12
Token Management
| Task | How |
|---|
| Save token | Stored in .edgeone/.token (auto-added to .gitignore) |
| Update token |
Delete
.edgeone/.token, then deploy again — you'll be prompted to enter and save a new one |
| Use saved token | Automatic — the agent reads
.edgeone/.token before each token deploy |
Command Reference
| Action | Command |
|---|
| Install CLI | INLINECODE33 |
| Check version |
edgeone -v |
| Login (China) |
edgeone login --site china |
| Login (Global) |
edgeone login --site global |
| View login info |
edgeone whoami |
| Logout |
edgeone logout |
| Switch account |
edgeone switch |
| Init functions |
edgeone pages init |
| Local dev |
edgeone pages dev |
| Link project |
edgeone pages link |
| Deploy |
edgeone pages deploy |
| Deploy new project |
edgeone pages deploy -n <name> |
| Deploy preview |
edgeone pages deploy -e preview |
| Deploy with token |
edgeone pages deploy -t <token> |
EdgeOne Pages 部署技能
将任意项目部署到 EdgeOne Pages。
⛔ 关键规则(必须遵守——切勿跳过)
- 1. CLI 版本必须为 1.2.30 或更高。如果已安装版本较低,请重新安装。请勿使用过时版本继续操作。
- 切勿截断部署 URL。EDGEONEDEPLOYURL 包含 eotoken= 和 eotime= 查询参数——它们是访问所必需的。始终输出完整 URL。
- 在登录前必须要求用户选择中国站或全球站。切勿自行假设。
- 必须自动检测登录方式——桌面环境使用浏览器登录,无头/远程/CI 环境使用令牌登录。请遵循以下决策表。
- 令牌登录后,必须询问用户是否要将令牌保存在本地以供将来使用。
部署流程
首先运行这些检查,然后遵循决策表:
bash
检查 1:CLI 是否已安装且版本正确?
edgeone -v
检查 2:是否已登录?
edgeone whoami
检查 3:项目是否已关联?
cat edgeone.json 2>/dev/null
检查 4:是否存在已保存的令牌?
cat .edgeone/.token 2>/dev/null
决策表
| CLI 版本 | 登录状态 | 操作 |
|---|
| 未安装或版本 < 1.2.30 | — | → 前往 安装 CLI |
| ≥ 1.2.30 ✓ |
已登录 | → 前往
部署 |
| ≥ 1.2.30 ✓ | 未登录,有已保存的令牌 | → 前往
使用令牌部署(使用已保存的令牌) |
| ≥ 1.2.30 ✓ | 未登录,无已保存的令牌 | → 前往
登录 |
安装 CLI
bash
npm install -g edgeone@latest
验证:edgeone -v 必须输出 1.2.30 或更高版本。否则,请重试安装。
登录
1. 询问用户选择站点
在运行任何登录命令之前,你必须询问用户。 使用 IDE 的选择控件(askfollowupquestion):
选择你的 EdgeOne Pages 站点:
- - 中国站 — 适用于中国大陆用户(console.cloud.tencent.com)
- 全球站 — 适用于中国以外用户(console.intl.cloud.tencent.com)
2. 检测环境并选择登录方式
| 条件 | 方式 |
|---|
| 本地桌面 IDE(例如 VS Code、Cursor 等) | 浏览器登录 |
| 远程 / SSH / 容器 / CI / 云 IDE / 无头环境 |
令牌登录 |
| 用户明确要求使用令牌 |
令牌登录 |
浏览器登录
bash
中国站
edgeone login --site china
全球站
edgeone login --site global
等待用户完成浏览器认证。完成后 CLI 会打印成功消息。
令牌登录
令牌登录不使用 edgeone login。令牌通过 -t 参数直接传入部署命令。
引导用户获取令牌:
- 1. 前往控制台:
-
中国站:https://console.cloud.tencent.com/edgeone/pages?tab=settings
-
全球站:https://console.intl.cloud.tencent.com/edgeone/pages?tab=settings
- 2. 找到 API 令牌 → 创建令牌 → 复制它
⚠️ 提醒用户:令牌具有账户级权限。切勿将其提交到代码仓库。
3. 提供保存令牌的选项
用户提供令牌后,必须询问:
是否要将此令牌保存在本地以供将来部署使用?
- - 是 — 保存到 .edgeone/.token(下次自动使用)
- 否 — 仅本次部署使用
如果选择是:
bash
mkdir -p .edgeone
echo > .edgeone/.token
grep -q .edgeone/.token .gitignore 2>/dev/null || echo .edgeone/.token >> .gitignore
告知用户:✅ 令牌已保存到 .edgeone/.token 并已添加到 .gitignore。
部署
浏览器认证部署
bash
项目已关联(存在 edgeone.json)
edgeone pages deploy
新项目(无 edgeone.json)
edgeone pages deploy -n <项目名称>
<项目名称>:从项目目录名称自动生成。首次部署会自动创建 edgeone.json。
基于令牌的部署
首先检查已保存的令牌:
bash
cat .edgeone/.token 2>/dev/null
- - 找到已保存的令牌 → 使用它,告知用户:正在使用 .edgeone/.token 中的已保存令牌
- 未找到已保存的令牌 → 要求用户提供一个(参见上面的令牌登录)
bash
项目已关联
edgeone pages deploy -t <令牌>
新项目
edgeone pages deploy -n <项目名称> -t <令牌>
令牌已包含站点信息——无需 --site 标志。
使用手动输入的令牌成功部署后,询问用户是否要保存它(参见上面的提供保存令牌的选项)。
部署到预览环境
bash
edgeone pages deploy -e preview
构建行为
CLI 会自动检测框架、运行构建并上传输出目录。无需手动配置。
⚠️ 解析部署输出(关键——仔细阅读)
edgeone pages deploy 成功后,CLI 会输出:
[cli][✔] 部署成功
EDGEONEDEPLOYURL=https://my-project-abc123.edgeone.cool?eotoken=xxxx&eotime=yyyy
EDGEONEDEPLOYTYPE=preset
EDGEONEPROJECTID=pages-xxxxxxxx
[cli][✔] 你可以在 EdgeOne Pages 控制台中查看你的部署:
https://console.cloud.tencent.com/edgeone/pages/project/pages-xxxxxxxx/deployment/xxxxxxx
提取规则:
| 字段 | 提取方式 | ⛔ 警告 |
|---|
| 访问 URL | EDGEONEDEPLOYURL= 后的完整值 | 必须包含 ?eotoken=...&eotime=... — 缺少这些参数页面将无法加载 |
| 项目 ID |
EDGEONE
PROJECTID= 后的值 | — |
|
控制台 URL | 你可以在 EdgeOne Pages 控制台中查看你的部署: 后的行 | — |
向用户展示:
✅ 部署完成!
- - 访问 URL:https://my-project-abc123.edgeone.cool?eotoken=xxxx&eotime=yyyy
- 控制台 URL:https://console.cloud.tencent.com/edgeone/pages/project/...
错误处理
| 错误 | 解决方案 |
|---|
| command not found: edgeone | npm install -g edgeone@latest |
| 登录时浏览器未打开 |
改用令牌登录 |
| 未登录错误 | 使用 edgeone whoami 检查,然后重新登录或使用令牌 |
| 令牌认证错误 | 令牌可能已过期——在控制台重新生成 |
| 项目名称冲突 | 使用 -n 指定不同的名称 |
| 构建失败 | 检查日志——通常是缺少依赖或构建脚本错误 |
附录
Edge/Node 函数
对于需要服务端函数的项目,在首次部署前运行:
bash
edgeone pages init
纯静态项目可跳过此步骤。
本地开发
bash
edgeone pages dev # http://localhost:8088/
环境变量
bash
edgeone pages env ls # 列出所有
edgeone pages env pull # 拉取到本地 .env
edgeone pages env add KEY val # 添加
edgeone pages env rm KEY # 删除
项目关联
bash
edgeone pages link
令牌管理
| 任务 | 方式 |
|---|
| 保存令牌 | 存储在 .edgeone/.token(自动添加到 .gitignore) |
| 更新令牌 |
删除 .edgeone/.token,然后重新部署——系统会提示你输入并保存新令牌 |
| 使用已保存的令牌 | 自动——代理在每次令牌部署前读取 .edgeone/.token |
命令参考
| 操作 | 命令 |
|---|
| 安装 CLI | npm install -g edgeone@latest |
| 检查版本 |
edgeone -v |
| 登录(中国站) | edge