edgeone-pages-deploy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

EdgeOne Pages Deployment Skill

EdgeOne Pages 部署Skill

Deploy any project to EdgeOne Pages.
将任意项目部署至EdgeOne Pages

⛔ Critical Rules (never skip)

⛔ 关键规则(切勿跳过)

  1. CLI version ≥
    1.2.30
    — reinstall if lower. Never proceed with an outdated version.
  2. Never truncate the deploy URL
    EDGEONE_DEPLOY_URL
    includes query parameters required for access. Always output the complete URL.
  3. Ask the user to choose China or Global site before login. Never assume.
  4. Auto-detect the login method — browser login in desktop environments, token login in headless/remote/CI environments. Follow the decision table below.
  5. After token login, ask if the user wants to save the token locally for future use.
  6. Before triggering any browser popup (login / 注册), explain the reason and the benefits to the user first — never silently launch a browser window.

  1. CLI版本 ≥
    1.2.30
    — 若版本过低请重新安装。切勿使用过时版本进行操作。
  2. 切勿截断部署URL
    EDGEONE_DEPLOY_URL
    包含访问所需的查询参数。请始终输出完整的URL。
  3. 登录前请询问用户选择国内站还是国际站。切勿自行假设。
  4. 自动检测登录方式 — 桌面环境下使用浏览器登录,无头/远程/CI环境下使用token登录。请遵循下方的决策表。
  5. 使用token登录后,请询问用户是否要将token本地保存以便后续使用。
  6. 在触发任何浏览器弹窗(登录/注册)之前,先向用户说明原因和收益 — 切勿静默启动浏览器窗口。

Deployment Flow

部署流程

Run these checks first, then follow the decision table:
bash
undefined
先执行以下检查,然后遵循决策表操作:
bash
undefined

Check 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
undefined
cat .edgeone/.token 2>/dev/null
undefined

Decision Table

决策表

CLI versionLogin statusAction
Not installed or < 1.2.30→ Go to Install CLI
≥ 1.2.30
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

CLI版本登录状态操作
未安装或 < 1.2.30→ 前往安装CLI
≥ 1.2.30
已登录→ 前往部署
≥ 1.2.30
未登录,但有已保存的token→ 前往使用Token部署(使用已保存的token)
≥ 1.2.30
未登录,无已保存的token→ 前往登录

Install CLI

安装CLI

bash
npm install -g edgeone@latest
Verify:
edgeone -v
— confirm output is
1.2.30
or higher. Retry installation if not.

bash
npm install -g edgeone@latest
验证:执行
edgeone -v
— 确认输出为
1.2.30
或更高版本。若不符合请重新安装。

Login

登录

0. Explain the registration/login step

0. 说明注册/登录步骤

Before triggering any login flow, explain to the user why this step is needed and what to expect. Do not silently launch a browser window.
Tell the user:
接下来需要登录 / 注册 EdgeOne Pages 账号,原因和收益如下:
  • 为什么要登录:部署需要把构建产物上传到你自己的账号下,生成独立的访问 URL 和项目记录。
  • 免费能得到什么:EdgeOne Pages 提供免费额度,包含全球 CDN 加速、自动 HTTPS、以及自定义域名绑定能力,个人项目通常完全够用。
  • 接下来会发生什么:我会运行
    edgeone login
    ,你的默认浏览器会自动弹出腾讯云登录页面,请在浏览器中完成登录 / 注册并授权,然后回到这里。
  • 如果卡住了:如果浏览器没弹出,或者你在浏览器里完成登录后 CLI 仍在等待,请告诉我,我会切换到 Token 登录方式。
如果用户长时间(例如超过 1–2 分钟)没有反馈登录完成,主动询问用户当前状态(浏览器是否打开、是否遇到报错、是否需要改用 Token 登录),不要无限期等待。
在触发任何登录流程之前,向用户说明为什么需要这一步以及会发生什么。切勿静默启动浏览器窗口。
告知用户:
接下来需要登录/注册EdgeOne Pages账号,原因和收益如下:
  • 为什么要登录:部署需要将构建产物上传到您自己的账号下,生成独立的访问URL和项目记录。
  • 免费额度包含什么:EdgeOne Pages提供免费额度,包含全球CDN加速、自动HTTPS以及自定义域名绑定能力,个人项目通常完全够用。
  • 接下来会发生什么:我将运行
    edgeone login
    ,您的默认浏览器会自动弹出腾讯云登录页面,请在浏览器中完成登录/注册并授权,然后回到此处。
  • 如果遇到卡住的情况:如果浏览器未弹出,或者您在浏览器中完成登录后CLI仍处于等待状态,请告知我,我将切换到Token登录方式。
如果用户长时间(例如超过1–2分钟)未反馈登录完成,请主动询问用户当前状态(浏览器是否打开、是否遇到报错、是否需要改用Token登录),切勿无限期等待。

1. Ask the user to choose a site

1. 请用户选择站点

Use the IDE's selection control (
ask_followup_question
) before running any login command:
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)
在运行任何登录命令前,使用IDE的选择控件(
ask_followup_question
)询问:
选择您的EdgeOne Pages站点:
  • 国内站 — 面向中国大陆用户(console.cloud.tencent.com)
  • 国际站 — 面向中国大陆以外用户(console.intl.cloud.tencent.com)

2. Detect environment and choose login method

2. 检测环境并选择登录方式

ConditionMethod
Local desktop IDE (VS Code, Cursor, etc.)Browser Login
Remote / SSH / container / CI / cloud IDE / headlessToken Login
User explicitly requests tokenToken Login
条件方式
本地桌面IDE(VS Code、Cursor等)浏览器登录
远程/SSH/容器/CI/云IDE/无头环境Token登录
用户明确要求使用tokenToken登录

Browser Login

浏览器登录

bash
undefined
bash
undefined

China 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.

⚠️ **浏览器 Session 复用陷阱**:如果用户此前已经在同一个浏览器登录过 EdgeOne Pages 的**另一个站点**(例如之前登过国际站,这次要登国内站,或反之),浏览器可能**静默复用旧的腾讯云 session**,CLI 会以为登录成功,但实际绑定的是错误账号,后续 `deploy` 时会出现 auth 错误或 `whoami` 显示意外账号。

遇到这种情况,引导用户:
1. 在弹出的登录页点击「**使用其他账户登录**」切换账号;或
2. 先从**所有腾讯云控制台**(国内站 `console.cloud.tencent.com` 和国际站 `console.intl.cloud.tencent.com`)退出登录,再重新执行 `edgeone login`。
edgeone login --site global

等待用户完成浏览器授权。完成后CLI会打印成功消息。

⚠️ **浏览器Session复用陷阱**:如果用户此前已在同一浏览器登录过EdgeOne Pages的**其他站点**(例如之前登录过国际站,这次要登录国内站,反之亦然),浏览器可能**静默复用旧的腾讯云session**,CLI会误以为登录成功,但实际绑定的是错误账号,后续执行`deploy`时会出现权限错误或`whoami`显示意外账号。

遇到这种情况,引导用户:
1. 在弹出的登录页点击「**使用其他账户登录**」切换账号;或
2. 先从**所有腾讯云控制台**(国内站`console.cloud.tencent.com`和国际站`console.intl.cloud.tencent.com`)退出登录,再重新执行`edgeone login`。

Token Login

Token登录

Token login does NOT use
edgeone login
. Pass the token directly in the deploy command via
-t
.
Guide the user to obtain a token:
  1. Go to the console:
  2. Find API TokenCreate Token → Copy it
⚠️ Remind the user: the token has account-level permissions. Never commit it to a repository.
Token登录不使用
edgeone login
命令。通过
-t
参数在部署命令中直接传入token即可。
引导用户获取token:
  1. 前往控制台:
  2. 找到API Token创建Token → 复制token
⚠️ 提醒用户:该token拥有账号级权限。切勿将其提交到代码仓库中。

3. Offer to save the token locally

3. 询问是否本地保存token

After the user provides a token, ask:
Save this token locally for future deployments?
  • Yes — Save to
    .edgeone/.token
    (auto-used next time)
  • 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' >> .gitignore
Confirm to the user: "✅ Token saved to
.edgeone/.token
and added to
.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
并添加到
.gitignore
中。"

Deploy

部署

Browser-authenticated deploy

已通过浏览器授权的部署

bash
undefined
bash
undefined

Project 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 → 使用它,并告知用户:"正在使用
    .edgeone/.token
    中保存的token"
  • 无已保存的token → 请用户提供token(参见上方的Token登录部分)
bash
undefined

Project 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 preview
bash
edgeone pages deploy -e preview

Build behavior

构建行为

The CLI auto-detects the framework, runs the build, and uploads the output directory. No manual config needed.

CLI会自动检测框架,执行构建并上传输出目录。无需手动配置。

⚠️ Parse Deploy Output (Critical)

⚠️ 解析部署输出(至关重要)

After
edgeone pages deploy
succeeds, the CLI outputs:
[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
Extraction rules:
FieldHow to extract⛔ Warning
Access URLFull value after
EDGEONE_DEPLOY_URL=
Include the full query string (
?
and everything after) — without these params the page will not load
Project IDValue after
EDGEONE_PROJECT_ID=
Console URLLine 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/...
ℹ️ 说明:此预览链接用于快速验证部署结果。在国内网络环境下访问时,因域名备案状态 / 加速策略等原因,链接可能在一段时间后或被分享给他人访问时出现访问限制(如 401)。如需长期稳定对外访问,建议绑定已备案的自定义域名。

edgeone pages deploy
成功后,CLI会输出:
[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
EDGEONE_DEPLOY_URL=
后的完整值
包含完整的查询字符串
?
及之后的所有内容)—— 缺少这些参数页面将无法加载
项目ID
EDGEONE_PROJECT_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/...
ℹ️ 说明:此预览链接用于快速验证部署结果。在国内网络环境下访问时,因域名备案状态/加速策略等原因,链接可能在一段时间后或分享给他人访问时出现访问限制(如401)。如需长期稳定对外访问,建议绑定已备案的自定义域名。

Error Handling

错误处理

ErrorSolution
command not found: edgeone
Run
npm install -g edgeone@latest
Browser does not open during loginSwitch to token login
"not logged in" errorRun
edgeone whoami
to check, then re-login or use token
Auth error with tokenToken may be expired — regenerate at the console
登录显示成功,但
deploy
报 auth / 鉴权错误
浏览器复用了错误站点的旧 session,导致账号错位。点击登录页的「使用其他账户登录」重新登录,或先从所有腾讯云控制台退出后再试
edgeone whoami
显示的是意外账号
同上:浏览器 session 复用导致。使用「使用其他账户登录」切换,或从所有腾讯云控制台退出后重登
Project name conflictUse a different name with
-n
Build failureCheck logs — usually missing deps or bad build script

For CLI command reference, environment variables, local dev setup, and token management details, see references/command-reference.md.
错误解决方案
command not found: edgeone
执行
npm install -g edgeone@latest
登录时浏览器未打开切换到token登录
"not logged in"错误执行
edgeone whoami
检查状态,然后重新登录或使用token
Token权限错误Token可能已过期 — 在控制台重新生成
登录显示成功,但
deploy
报权限/鉴权错误
浏览器复用了错误站点的旧session,导致账号错位。点击登录页的「使用其他账户登录」重新登录,或先从所有腾讯云控制台退出后再尝试
edgeone whoami
显示意外账号
同上:浏览器session复用导致。使用「使用其他账户登录」切换,或从所有腾讯云控制台退出后重新登录
项目名称冲突使用
-n
参数指定其他名称
构建失败检查日志 — 通常是缺少依赖或构建脚本错误

关于CLI命令参考、环境变量、本地开发设置和token管理的详细信息,请查看references/command-reference.md