SuperAPI AI Directory

bedrock

Deployment & operations

View repository

Updated 10-16 08:34

About this skill

bedrock

Operate the Bedrock server through the scripts/bedrock.mjsin this skill directory (Node.js ≥ 24). In the commands below, <cli> all refer to node <本技能目录>/scripts/bedrock.mjs。

The configuration file is at the project root .bedrock.json(automatically searched upward from the current directory):

{
  "pat": "br_xxx",        // 访问令牌,Bedrock Web「资源 → 访问令牌」创建
  "base_url": "http://192.168.1.10:8080",  // 服务器地址,不带 /api/v1 结尾
  "builds":    [{ "name": "xx项目", "id": 1 }],
  "scripts":   [{ "name": "xxx脚本任务", "id": 1 }],
  "pipelines": [{ "name": "xxx流水线", "id": 1 }],
  "agents":    [{ "name": "xxxx智能体", "id": 1 }]
}

.bedrock.json contains the access token and is a sensitive file: it must never be committed to git (init subcommand automatically writes .gitignore; recheck after modifying the configuration), and do not display the full pat in replies.

Step 1: Check the configuration

<cli> doctor
  • All outputs are ✓ and the task is registered → proceed to "Select a task and run it".
  • File does not exist / missing pat / missing base_url / task not registered → proceed to "Configuration guidance".

Configuration guidance (when configuration is missing)

Need to collect from the user: ① base_url; ② pat; ③ the tasks to register (build/script/pipeline/agent, name + id). Ask for all missing items at once; do not drag it out.

  1. Generate a template (automatically add .bedrock.json to .gitignore; if prompted that it already exists, edit the existing file directly):

    <cli> init
    
  2. Fill the pat and base_url provided by the user into the template (keep valid JSON; comments may be retained). It is normal for the user not to know the id—first fill in pat and base_url, then use server queries to help the user choose:

    <cli> search --type builds                  # 也支持 scripts / pipelines / agents
    <cli> search --type agents --keyword 订单   # 按名称过滤
    

    Show the results (id + name) to the user for selection, and after selection write them into .bedrock.json the corresponding array.

  3. Instructions for filling in and using agents → first read references/agents.md then explain to the user or ask questions.

  4. Validation:<cli> doctor --remote(this will actually request the server health check).

  5. Remind the user: when creating the PAT, they need to check builds:run / scripts:run / pipelines:run / agents:run the corresponding scope, otherwise triggering will return 403.

Select a task and run it

  1. The user has specified a task(such as /bedrock 构建xxx任务, "run the deployment pipeline"): map verbs to types—build/deploy→build, script task→script, pipeline→pipeline, agent→agent; pass the task name to --name(partial matching supported).

    <cli> build --name "xx项目" --branch main
    <cli> script --name "xxx脚本任务"
    <cli> pipeline --name "xxx流水线"
    <cli> agent --name "xxxx智能体" --prompt "修复登录超时问题并自测"
    

    --name When it cannot be matched in the configuration, use search to find candidates on the server, ask the user whether to adopt them, and register the selected one into .bedrock.jsonso you do not need to query again next time.

  2. There is only one task in the configuration: run it directly; do not ask. Shortcut:<cli> run(automatically identifies the type).

  3. There are multiple tasks in the configuration and the user did not specify one: ask interactively to let the user choose. First ask for the type (only when multiple types are configured; use AskUserQuestion), then ask for the specific task. AskUserQuestion allows at most 4 options per question; when there are more, switch to listing numbers in text for the user to reply with. Show the task names from the configuration directly in the question (ids may be attached); do not make the user guess.

Running and reporting results

Default behavior: trigger (a 202 returned by the server means queued) → the script polls until the terminal state (default 5s interval, 30-minute timeout,--timeout / --poll-interval / --no-wait adjustable) → output the result. When the build/script fails, the script automatically prints the tail of the log; when the agent succeeds, it prints the full output_text。

After completion, report to the user: task name, run id, final status, and elapsed time; on failure, relay the key error and log highlights (do not paste long logs in their entirety). On timeout or --no-wait , provide the follow-up query command (the script automatically prompts on timeout status / log usage):

<cli> status --type build --run-id 123
<cli> log --type build --run-id 123 --tail 100

Note

  • Exit codes for trigger-type commands: 0 success, 1 run or request failure, 2 configuration/usage error; 401 = invalid token, 403 = missing scope.
  • The prerequisite for running the agent is that the workspace is ready (workspace_status = ready), see references/agents.mdfor details; for API details (fields, state machine, WebSocket logs) see references/api.md。
  • pat can also be overridden with the environment variable BEDROCK_PAT / BEDROCK_BASE_URL (for CI scenarios); the script will read the environment variable first.