warden-service

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Warden Service

Warden Service

Query Warden Service with a read-only personal token and return a bounded, evidence-based answer.
使用只读个人令牌查询Warden Service,并返回有依据的限定性答案。

Workflow

工作流程

  1. Identify the Warden Service origin and confirm
    WARDEN_PAT
    is set without displaying its value.
  2. If the token is missing, direct the user to API access in the Warden Service dashboard. Have them create a personal token and export it as
    WARDEN_PAT
    ; never ask them to paste it into chat or a command literal.
  3. Read
    references/read-api.md
    to select the exact route, supported filters, pagination behavior, and response fields for the question.
  4. Narrow the request to the user's repository, time range, skill, severity, or other stated scope. Use a bounded
    limit
    for runs and findings.
  5. Send a
    GET
    request with the token read from the environment. URL-encode every query value.
  6. Follow
    nextCursor
    only while more results are needed. Preserve all original filters and stop when the requested scope is satisfied or the response omits
    nextCursor
    .
  7. Summarize the relevant JSON fields. State the route and filters used, and distinguish an empty result from a failed request.
  1. 确定Warden Service的源地址,确认
    WARDEN_PAT
    已设置,但不显示其具体值。
  2. 如果令牌缺失,引导用户前往Warden Service控制台的API访问页面。让他们创建个人令牌并将其导出为
    WARDEN_PAT
    ;切勿要求用户将令牌粘贴到聊天框或命令文本中。
  3. 阅读
    references/read-api.md
    文档,为当前问题选择准确的路由、支持的过滤器、分页规则以及响应字段。
  4. 根据用户指定的代码库、时间范围、Skill、严重程度或其他限定范围缩小请求范围。对运行记录和检测结果使用限定的
    limit
    参数。
  5. 使用从环境变量中读取的令牌发送
    GET
    请求。对所有查询参数值进行URL编码。
  6. 仅在需要更多结果时才跟随
    nextCursor
    。保留所有原始过滤器,当满足请求范围或响应中没有
    nextCursor
    时停止请求。
  7. 总结相关的JSON字段。说明使用的路由和过滤器,并区分空结果与请求失败的情况。

Request Pattern

请求模式

Use
--get
with
--data-urlencode
instead of assembling a query string manually:
bash
curl --fail-with-body --silent --show-error --get \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer ${WARDEN_PAT}" \
  --data-urlencode 'severity=high' \
  --data-urlencode 'skill=security-review' \
  --data-urlencode 'limit=30' \
  "${WARDEN_SERVICE_URL%/}/api/v1/findings"
Keep the token in
WARDEN_PAT
. Do not enable verbose or trace output that could expose the authorization header.
使用
--get
--data-urlencode
参数,而非手动拼接查询字符串:
bash
curl --fail-with-body --silent --show-error --get \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer ${WARDEN_PAT}" \
  --data-urlencode 'severity=high' \
  --data-urlencode 'skill=security-review' \
  --data-urlencode 'limit=30' \
  "${WARDEN_SERVICE_URL%/}/api/v1/findings"
将令牌保存在
WARDEN_PAT
中。不要启用可能暴露授权头的详细或跟踪输出。

Pagination

分页

Only
/api/v1/runs
and
/api/v1/findings
use cursor pagination. Treat
nextCursor
as opaque and pass it back unchanged through URL encoding:
bash
curl --fail-with-body --silent --show-error --get \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer ${WARDEN_PAT}" \
  --data-urlencode "cursor=${NEXT_CURSOR}" \
  --data-urlencode 'severity=high' \
  --data-urlencode 'limit=100' \
  "${WARDEN_SERVICE_URL%/}/api/v1/findings"
只有
/api/v1/runs
/api/v1/findings
接口使用游标分页。将
nextCursor
视为不透明值,通过URL编码后原样传递:
bash
curl --fail-with-body --silent --show-error --get \
  -H 'Accept: application/json' \
  -H "Authorization: Bearer ${WARDEN_PAT}" \
  --data-urlencode "cursor=${NEXT_CURSOR}" \
  --data-urlencode 'severity=high' \
  --data-urlencode 'limit=100' \
  "${WARDEN_SERVICE_URL%/}/api/v1/findings"

Errors

错误处理

Use the HTTP status and the JSON
error.code
and
error.message
together:
StatusMeaningAction
400Invalid query filtersCorrect the parameter names, values, or RFC 3339 timestamps.
401Missing, invalid, or expired authenticationVerify the origin and replace the personal token through API access.
403Insufficient role or disallowed personal-token operationKeep the request read-only and within the token's repository scope.
404Unknown or unauthorized route/resourceVerify the documented route or ID without assuming the resource exists.
429Rate limitedWait and retry later; do not create a tight retry loop.
结合HTTP状态码以及JSON中的
error.code
error.message
进行处理:
状态码含义操作
400查询过滤器无效修正参数名称、参数值或RFC 3339格式的时间戳。
401身份验证缺失、无效或过期验证源地址,并通过API访问页面更换个人令牌。
403角色权限不足或个人令牌操作被禁止保持请求为只读,并在令牌的代码库权限范围内操作。
404路由/资源未知或未授权验证文档中记录的路由或ID,不要假设资源存在。
429请求频率受限等待后重试;不要创建频繁重试的循环。

Boundaries

边界限制

  • Use personal tokens only for
    GET
    or
    HEAD
    . Never attempt
    POST
    ,
    PUT
    ,
    PATCH
    , or
    DELETE
    with them.
  • Never reveal, log, persist, embed as a command literal, or ask the user to paste a token.
  • Respect the token's tenant, role, and repository restrictions. Never attempt to bypass them.
  • Use only routes, filters, and response fields documented in
    references/read-api.md
    .
  • Fetch and display only the data required for the user's stated scope. Use the export route only when the user explicitly requests an export.
  • If the read API cannot answer the question, say so. Do not substitute an ingest, memory-recall, token-management, retention, or deletion request.
  • 个人令牌仅用于
    GET
    HEAD
    请求。切勿使用其尝试
    POST
    PUT
    PATCH
    DELETE
    操作。
  • 切勿泄露、记录、持久化、嵌入到命令文本中,或要求用户粘贴令牌。
  • 遵守令牌的租户、角色和代码库限制。切勿尝试绕过这些限制。
  • 仅使用
    references/read-api.md
    文档中记录的路由、过滤器和响应字段。
  • 仅获取并显示用户指定范围内所需的数据。仅当用户明确要求导出时才使用导出路由。
  • 如果只读API无法回答问题,直接说明。不要替换为数据摄入、记忆召回、令牌管理、数据保留或删除请求。