jfrog
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJFrog Skill
JFrog技能
The foundational skill for all JFrog agent interactions. Covers JFrog Platform concepts, CLI setup and authentication, and intent routing to workflow skills.
jfInteract with the JFrog Platform through the JFrog CLI () and, where the
CLI falls short, through REST APIs and GraphQL. In code examples below,
refers to this skill's directory and is resolved automatically
by the agent. If the agent does not resolve it, determine the path by locating
this SKILL.md file and using its parent directory.
jf<skill_path>所有JFrog Agent交互的基础技能。涵盖JFrog平台概念、 CLI的设置与认证,以及工作流技能的意图路由。
jf通过JFrog CLI()与JFrog平台交互,当CLI功能不足时,可通过REST API和GraphQL补充。以下代码示例中,指此技能的目录,Agent会自动解析该路径。若Agent未自动解析,可通过定位此SKILL.md文件并使用其父目录来确定路径。
jf<skill_path>Prerequisites
前置条件
The following tools must be available on :
PATH| Tool | Purpose |
|---|---|
| JSON parsing of CLI and API output |
All HTTP traffic to JFrog Platform APIs goes through the CLI itself
(, see Invoking platform APIs with below) —
no standalone is required for any JFrog interaction.
jfjf apijf apicurlRuntime permission for JFrog calls. All calls that touch the network
need an outbound-HTTPS escalation from the agent runtime. The
credential save ( during login) additionally needs a
filesystem-write escalation.
jf~/.jfrog/jf config add| Runtime | Network | Network + |
|---|---|---|
| Cursor | | |
| Claude Code | | same + filesystem allowlist |
| Other | Configure at the runtime/sandbox layer | same |
If exits 1 with empty output, the runtime's network gate is the first
thing to check — re-run with the appropriate escalation above.
jf以下工具必须在中可用:
PATH| 工具 | 用途 |
|---|---|
| 解析CLI和API输出的JSON数据 |
所有发往JFrog Platform API的HTTP流量均通过 CLI本身(,见下文的【通过调用平台API】)传输——任何JFrog交互都无需单独使用。
jfjf apijf apicurlJFrog调用的运行时权限:所有涉及网络的调用都需要Agent运行时的出站HTTPS权限提升。保存凭证(登录期间执行)还需要文件系统写入权限提升。
jf~/.jfrog/jf config add| 运行环境 | 网络权限要求 | 网络+ |
|---|---|---|
| Cursor | | |
| Claude Code | | 同上+文件系统白名单 |
| 其他环境 | 在运行时/沙箱层配置 | 同上 |
若执行返回状态码1且输出为空,首先检查运行时的网络网关——按照上述要求重新运行并获取权限提升。
jfEnvironment check
环境检查
Before your first JFrog operation in a session, run the environment check
and remember its stdout as for the rest of the session:
<UA>bash
bash <skill_path>/scripts/check-environment.sh <model-slug>在会话中首次执行JFrog操作前,运行环境检查并记住其标准输出作为,供本次会话后续使用:
<UA>bash
bash <skill_path>/scripts/check-environment.sh <model-slug>stdout (one line): model/<model-slug> jfrog-skills/<version> jfrog-cli-go/<cli-version>
标准输出(单行):model/<model-slug> jfrog-skills/<version> jfrog-cli-go/<cli-version>
stderr: JSON state (cached 24h at ${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/jfrog-skill-state.json)
标准错误输出:JSON状态(缓存24小时,路径为${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/jfrog-skill-state.json)
Pass the precise underlying-model slug with version: `opus-4.7`,
`sonnet-4.5`, `gpt-5-codex`, `gemini-2.5-pro`, `composer-2-fast`. Cursor's
Composer product slug **is** the canonical id — use it as-is. Do **not**
pass harness/role names (`subagent`, `agent`, `assistant`) or bare family
names (`claude`, `gpt`); subagents inherit the parent's slug. If genuinely
unknown, pass `unknown`.
传入包含版本的精确底层模型标识:`opus-4.7`、`sonnet-4.5`、`gpt-5-codex`、`gemini-2.5-pro`、`composer-2-fast`。Cursor的Composer产品标识即为标准ID——直接使用即可。请勿传入角色/ harness名称(如`subagent`、`agent`、`assistant`)或仅传入系列名称(如`claude`、`gpt`);子Agent会继承父Agent的标识。若确实未知,传入`unknown`。Export JFROG_CLI_USER_AGENT
once per bash invocation
JFROG_CLI_USER_AGENT每次bash调用时导出一次JFROG_CLI_USER_AGENT
JFROG_CLI_USER_AGENTAt the top of every bash invocation that runs , export once;
all calls in that invocation pick it up:
jf<UA>jfbash
export JFROG_CLI_USER_AGENT='<UA>'
jf config show
jf api /artifactory/api/system/versionDo not repeat the assignment per call (
on every line). Examples elsewhere in this skill and in
omit the export for readability — the rule is global. When launching a
subagent, pass in its prompt; subagents do not re-run the script.
jfJFROG_CLI_USER_AGENT='<UA>' jf …references/*.md<UA>| Exit | Meaning |
|---|---|
| 0 | Cache fresh — proceed |
| 1 | Cache refreshed — proceed |
| 2 | |
| 3 | |
On exit 2 or 3, do not fall back to , raw , or other
workarounds — see . Re-run with
only when the user explicitly asks to refresh or install/upgrade.
jf rt curlcurlreferences/jfrog-cli-install-upgrade.md--force在每个运行的bash调用顶部,导出一次;该调用中的所有命令都会自动读取此环境变量:
jf<UA>jfbash
export JFROG_CLI_USER_AGENT='<UA>'
jf config show
jf api /artifactory/api/system/version请勿在每个调用中重复赋值(即不要每行都写)。为便于阅读,本技能及中的示例省略了导出步骤,但此规则为全局生效。启动子Agent时,在其提示中传入;子Agent无需重新运行该脚本。
jfJFROG_CLI_USER_AGENT='<UA>' jf …references/*.md<UA>| 退出码 | 含义 |
|---|---|
| 0 | 缓存有效——继续执行 |
| 1 | 缓存已刷新——继续执行 |
| 2 | |
| 3 | |
若退出码为2或3,请勿回退使用、原生或其他替代方案——请参考。仅当用户明确要求刷新或安装/升级时,才添加参数重新运行。
jf rt curlcurlreferences/jfrog-cli-install-upgrade.md--forceJSON parsing (jq
)
jqJSON解析(jq
)
jqUse for all JSON parsing of CLI and API output (pipes, , filters).
jq-r所有CLI和API输出的JSON解析均需使用****(包括管道、参数、过滤器)。
jq-r~/.jfrog/skills-cache/
— allowed files only
~/.jfrog/skills-cache/~/.jfrog/skills-cache/
— 仅允许存放指定文件
~/.jfrog/skills-cache/${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/- — written by
jfrog-skill-state.json(24-hour CLI check cache).scripts/check-environment.sh - — cached OneModel supergraph schema (see
onemodel-schema-${JFROG_SERVER_ID}.graphql).references/onemodel-graphql.md
Do not save HTTP response bodies, GraphQL query results, ad-hoc JSON, reports,
or any other temporary files under . Write those to a host temp
path instead (for example or ), echo the path
when a follow-up Shell step must read the file — same pattern as Preserving
command output below.
skills-cache//tmp/<name>-$$.jsonmktemp -d${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/- — 由
jfrog-skill-state.json生成(24小时CLI检查缓存)。scripts/check-environment.sh - — 缓存的OneModel超级图模式(参考
onemodel-schema-${JFROG_SERVER_ID}.graphql)。references/onemodel-graphql.md
请勿在此目录下保存HTTP响应体、GraphQL查询结果、临时JSON、报告或其他临时文件。请将这些文件写入主机临时路径(例如或),当后续Shell步骤需要读取该文件时,输出其路径——与下文的【保存命令输出】模式一致。
/tmp/<name>-$$.jsonmktemp -dCautious execution
谨慎执行
Do not run commands speculatively. Before executing any JFrog CLI command or
API call:
- Confirm the operation is needed to fulfill the user's request. If the request is ambiguous or could refer to multiple systems (e.g. "builds" could mean Artifactory build-info or CI/CD pipeline runs), ask the user for clarification instead of guessing. Never fetch data from the wrong system — a wrong answer is worse than asking a question.
- Resolve the target server using the Server selection rules below — there must be no ambiguity about which server is used
- For mutating operations (create, update, delete, upload), confirm with the user unless the intent is clearly implied
- Prefer read operations first to understand current state before making changes
- Never invent preparatory mutations. If the requested operation fails because a precondition is not met (artifact missing from the specified repo, repository does not exist, package not at the expected location, build not found), stop and report the gap to the user. Do not perform copy, move, upload, create-repo, or any other mutating operation to satisfy the precondition unless the user explicitly asks for it. These "helper" mutations can have cascading effects the user has not considered — virtual repository resolution changes, storage quota consumption, replication triggers, Xray re-indexing, or permission propagation.
请勿随意执行命令。在执行任何JFrog CLI命令或API调用前:
- 确认该操作是满足用户请求所必需的。若请求存在歧义或可能涉及多个系统(例如"builds"可能指Artifactory构建信息或CI/CD流水线运行),请向用户确认而非猜测。切勿从错误的系统获取数据——错误的答案比提问更糟糕。
- 根据下文的【服务器选择规则】确定目标服务器——必须明确使用哪台服务器
- 对于变更操作(创建、更新、删除、上传),除非意图非常明确,否则请向用户确认
- 优先执行读取操作,在进行变更前先了解当前状态
- 切勿自行执行准备性变更。若请求的操作因前置条件未满足而失败(指定仓库中缺少制品、仓库不存在、包不在预期位置、未找到构建),停止操作并向用户报告问题。除非用户明确要求,否则请勿执行复制、移动、上传、创建仓库或其他变更操作来满足前置条件。这些"辅助"变更可能会带来用户未考虑到的连锁反应——虚拟仓库解析规则变更、存储配额消耗、触发复制、Xray重新索引或权限传播。
Server selection rules (mandatory)
服务器选择规则(强制要求)
Single-server invariant. Every call MUST pass
(default resolved below); for one user request, all calls use exactly
one server-id. A wrong answer from the wrong server is worse than a stop-and-ask.
jf--server-id <SID>jfMUST NOT retry on a second configured server after 401/403/404, empty, or
partial results; MUST NOT infer multi-server intent from "my"/"our" or
from seeing extra entries in . Override: only when the user
explicitly names another id ("on , …", "use ", "compare
and ") — inferred intent is not an override.
jf config show<id><id><a><b>单服务器不变原则:每个调用必须传入(默认值解析见下文);针对单个用户请求,所有调用必须使用完全相同的服务器ID。从错误服务器返回的错误答案比停止操作更糟糕。
jf--server-id <SID>jf禁止在收到401/403/404、空结果或部分结果后重试另一台已配置的服务器;禁止从"my"/"our"等词汇或中的额外条目推断多服务器意图。例外情况:仅当用户明确指定另一ID(例如"在上..."、"使用"、"比较和")时——推断的意图不算例外。
jf config show<id><id><a><b>Resolve the default once per session
会话开始时解析一次默认服务器
Before your first call, resolve the default server-id and remember it
as for the rest of the session — same pattern as :
jf<SID><UA>bash
jf config show 2>/dev/null \
| awk '/^Server ID:/{id=$NF} /^Default:[[:space:]]*true/{print id; exit}'首次执行调用前,解析默认服务器ID并记住为,供本次会话后续使用——与的使用模式一致:
jf<SID><UA>bash
jf config show 2>/dev/null \
| awk '/^Server ID:/{id=$NF} /^Default:[[:space:]]*true/{print id; exit}'stdout: the default server-id; if empty, stop and ask which to use
标准输出:默认服务器ID;若为空,停止操作并询问用户使用哪台服务器
Pass `--server-id <SID>` to every subsequent `jf` call. The flag goes
**after** the subcommand name, not after `jf` itself:
- ✅ `jf api --server-id <SID> /artifactory/api/system/version`
- ✅ `jf rt ping --server-id <SID>`
- ❌ `jf --server-id <SID> api /…` — fails with `flag provided but not defined`
When launching a subagent, pass `<SID>` in its prompt — subagents do not
re-resolve. Examples elsewhere in this skill and in `references/*.md` omit
`--server-id` for readability; the rule is global, same as
`JFROG_CLI_USER_AGENT`.
后续所有`jf`调用均需传入`--server-id <SID>`。该参数需放在子命令名称之后,而非`jf`本身之后:
- ✅ `jf api --server-id <SID> /artifactory/api/system/version`
- ✅ `jf rt ping --server-id <SID>`
- ❌ `jf --server-id <SID> api /…` — 会因`flag provided but not defined`失败
启动子Agent时,在其提示中传入`<SID>`;子Agent无需重新解析。为便于阅读,本技能及`references/*.md`中的示例省略了`--server-id`参数,但此规则为全局生效,与`JFROG_CLI_USER_AGENT`规则一致。On any error, stop — never switch
任何错误发生时,停止操作——切勿切换服务器
If a call returns 401/403, 404, network error, timeout, or any other
failure, stop with no further calls and respond:
jfjfreturned<server-id>for<code>:<endpoint>. Other configured server(s):<short reason>— I won't query them without your explicit instruction. How would you like to proceed?<list>
若调用返回401/403、404、网络错误、超时或其他失败,停止所有后续调用并回复:
jfjf针对<server-id>返回<endpoint>:<code>。其他已配置服务器:<简短原因>——未经您的明确指示,我不会查询这些服务器。您希望如何继续?<列表>
When to read reference files
何时参考参考文件
Load the most specific file for the task at hand. Avoid loading more than 2-3
reference files for a single operation — start with the most relevant one and
only load additional files if the first doesn't cover the need. File sizes
vary (~25–640 lines); larger files are noted with approximate line counts
below.
加载与当前任务最匹配的参考文件。单个操作避免加载超过2-3个参考文件——从最相关的文件开始,仅当第一个文件无法满足需求时再加载其他文件。文件大小各不相同(约25–640行);较大的文件会在下文标注大致行数。
Cross-domain
跨领域
- Disambiguating a JFrog entity, understanding entity types, or planning operations that span multiple products: read , then follow pointers to the relevant domain file
references/jfrog-entity-index.md - Looking up documentation URLs: read
references/jfrog-url-references.md
- 区分JFrog实体、理解实体类型,或规划跨多个产品的操作:阅读,然后根据指引阅读相关领域文件
references/jfrog-entity-index.md - 查找文档URL:阅读
references/jfrog-url-references.md
Artifactory
Artifactory
- Repository types, artifacts, builds, properties, or permission targets (concepts): read (~220 lines)
references/artifactory-entities.md - Stored packages, package versions, version locations, or the metadata layer over Artifactory (concepts): read (~165 lines)
references/stored-packages-entities.md - Repo, file, build, permission, user/group, or replication operations: read (for listing builds use AQL with
references/artifactory-operations.md/limit— see § Listing build names; for full build detail useoffset— see § Retrieving full build info)GET /api/build/<name>/<number>?project= - AQL queries: read (~585 lines)
references/artifactory-aql-syntax.md - Artifactory REST beyond the CLI, structured JSON templates (replacing interactive wizards), or any Artifactory API gap: read (~220 lines)
references/artifactory-api-gaps.md
- 仓库类型、制品、构建、属性或权限目标(概念):阅读(约220行)
references/artifactory-entities.md - 存储的包、包版本、版本位置或Artifactory元数据层(概念):阅读(约165行)
references/stored-packages-entities.md - 仓库、文件、构建、权限、用户/用户组或复制操作:阅读(列出构建需使用带
references/artifactory-operations.md/limit的AQL——参考【列出构建名称】章节;获取完整构建详情需使用offset——参考【获取完整构建信息】章节)GET /api/build/<name>/<number>?project= - AQL查询:阅读(约585行)
references/artifactory-aql-syntax.md - CLI未覆盖的Artifactory REST接口、结构化JSON模板(替代交互式向导)或任何Artifactory API空白:阅读(约220行)
references/artifactory-api-gaps.md
Xray & security
Xray & 安全
- Watches, policies, violations, components, or vulnerability scanning (concepts): read (~290 lines)
references/xray-entities.md - Exposures scanning results (secrets, IaC, service misconfigurations, application security risks): read § Exposures (Advanced Security)
references/xray-entities.md - Curation audit events (approved/blocked packages, dry-run policy evaluations, curation export): read § Curation audit events
references/xray-entities.md
- 监控、策略、违规、组件或漏洞扫描(概念):阅读(约290行)
references/xray-entities.md - 暴露扫描结果(密钥、IaC、服务配置错误、应用安全风险):阅读中的【暴露(高级安全)】章节
references/xray-entities.md - 治理审计事件(批准/拦截包、策略评估试运行、治理导出):阅读中的【治理审计事件】章节
references/xray-entities.md
Release lifecycle & distribution
发布生命周期与分发
- Release bundles, lifecycle stages, distribution, or evidence (concepts): read (~180 lines)
references/release-lifecycle-entities.md - Applications, application versions, releasables, promotions, or AppTrust (concepts): read (~155 lines)
references/apptrust-entities.md
- 发布包、生命周期阶段、分发或证据(概念):阅读(约180行)
references/release-lifecycle-entities.md - 应用、应用版本、可发布项、晋升或AppTrust(概念):阅读(约155行)
references/apptrust-entities.md
Catalog
目录
- Public or custom catalog, package metadata, vulnerability advisories, licenses, OpenSSF, or MCP services (concepts): read (~190 lines)
references/catalog-entities.md - CVE details, vulnerability lookup by CVE ID, or severity/affected-packages/fix-versions for a specific CVE: go directly to § Public security domain for the
references/onemodel-query-examples.mdquery shape — this is self-contained; do not load thesearchVulnerabilitiesskill for pure CVE lookupsjfrog-package-safety-and-download
- 公共或自定义目录、包元数据、漏洞公告、许可证、OpenSSF或MCP服务(概念):阅读(约190行)
references/catalog-entities.md - CVE详情、通过CVE ID查找漏洞,或特定CVE的严重性/受影响包/修复版本:直接查看中的【公共安全领域】章节获取
references/onemodel-query-examples.md查询结构——该章节内容独立;纯CVE查找无需加载searchVulnerabilities技能jfrog-package-safety-and-download
OneModel (GraphQL)
OneModel(GraphQL)
- GraphQL queries (applications, packages, evidence, release bundles, catalog, cross-domain, or "list/search my" platform entities): read (~325 lines)
references/onemodel-graphql.md - Query templates and domain-specific examples: read (~555 lines)
references/onemodel-query-examples.md - Pagination, filtering, GraphQL variables, or date formatting: read (~280 lines)
references/onemodel-common-patterns.md
- GraphQL查询(应用、包、证据、发布包、目录、跨领域或"列出/搜索我的"平台实体):阅读(约325行)
references/onemodel-graphql.md - 查询模板和领域特定示例:阅读(约555行)
references/onemodel-query-examples.md - 分页、过滤、GraphQL变量或日期格式化:阅读(约280行)
references/onemodel-common-patterns.md
Platform administration
平台管理
- Platform structure, project/repo membership, or project roles vs environments (concepts): read
references/platform-access-entities.md - Access tokens, stats, projects, or system health: read
references/platform-admin-operations.md - Managing JFrog Projects, members, or environments: read (~260 lines)
references/projects-api.md - Platform REST beyond the CLI, or any platform-level API gap: read (~180 lines)
references/platform-admin-api-gaps.md
- 平台结构、项目/仓库成员关系、或项目角色与环境(概念):阅读
references/platform-access-entities.md - 访问令牌、统计数据、项目或系统健康:阅读
references/platform-admin-operations.md - 管理JFrog项目、成员或环境:阅读(约260行)
references/projects-api.md - CLI未覆盖的平台REST接口,或任何平台级API空白:阅读(约180行)
references/platform-admin-api-gaps.md
CLI setup & authentication
CLI设置与认证
- Adding a server or logging in: read (~130 lines)
references/jfrog-login-flow.md - CLI not installed, upgrade needed, or unavailable: read
jqreferences/jfrog-cli-install-upgrade.md
- 添加服务器或登录:阅读(约130行)
references/jfrog-login-flow.md - CLI未安装、需要升级或不可用:阅读
jqreferences/jfrog-cli-install-upgrade.md
General patterns
通用模式
- Batching, parallel Shell calls, or launching subagents: read (~135 lines)
references/general-parallel-execution.md - Large or parallel data gathering, list-vs-detail APIs, cache hygiene: read
references/general-bulk-operations-and-agent-patterns.md - Standalone HTML report with JFrog-aligned styling: read
references/jfrog-brand-html-report.md - Reusable gotchas from past tasks: read or extend
references/general-use-case-hints.md
- 批量处理、并行Shell调用或启动子Agent:阅读(约135行)
references/general-parallel-execution.md - 大规模或并行数据收集、列表与详情API对比、缓存卫生:阅读
references/general-bulk-operations-and-agent-patterns.md - 符合JFrog风格的独立HTML报告:阅读
references/jfrog-brand-html-report.md - 过往任务中积累的常见问题:阅读或扩展
references/general-use-case-hints.md
Server management
服务器管理
Server configuration is always read live from (never cached).
jf config- List servers: (local operation, no network needed)
jf config show - Use a specific server: pass to any command
--server-id <id> - Switch default:
jf config use <server-id> - Add a new server: read for the full login procedure (web login or manual token setup)
references/jfrog-login-flow.md
服务器配置始终从实时读取(从不缓存)。
jf config- 列出服务器:(本地操作,无需网络)
jf config show - 使用特定服务器:在任何命令中传入
--server-id <id> - 切换默认服务器:
jf config use <server-id> - 添加新服务器:参考完成完整登录流程(网页登录或手动令牌设置)
references/jfrog-login-flow.md
Command discovery
命令发现
Use the commands listed below as your primary reference. Run to
verify options you are unsure about or to discover commands not listed here —
do not rely on memorized commands outside this skill, as they may be outdated.
--help- — list all namespaces and top-level commands
jf --help - — list subcommands in a namespace
jf <namespace> --help - — show usage, arguments, and options
jf <command> --help
以下列命令作为主要参考。若对选项不确定或需发现未在此列出的命令,运行进行验证——请勿依赖本技能之外的记忆命令,因为它们可能已过时。
--help- — 列出所有命名空间和顶级命令
jf --help - — 列出命名空间下的子命令
jf <namespace> --help - — 显示用法、参数和选项
jf <command> --help
CLI namespaces
CLI命名空间
| Namespace | Alias | Product |
|---|---|---|
| Artifactory | |
| Xray | |
| Distribution V1 | |
| | AppTrust |
| Evidence | |
| Mission Control | |
| Workers | |
| | CLI server configuration |
| CLI plugin management | |
| IDE integration |
Sunset notice: JFrog Pipelines has been sunset and is no longer supported. Do not use theCLI namespace or the Pipelines REST API (pl). If a user asks about Pipelines, inform them the product has been sunset./pipelines/api/...
Top-level lifecycle commands (no namespace): , , , ,
, , , , , , .
rbcrbprbdrbarbfrberbirbsrburbdellrbdelrTop-level security commands: , , , ,
.
auditscanbuild-scancuration-auditsbom-enrichTop-level other: (), , , ,
, , .
access-token-createatcloginhowstatsgenerate-summary-markdownexchange-oidc-tokencompletion| 命名空间 | 别名 | 产品 |
|---|---|---|
| Artifactory | |
| Xray | |
| Distribution V1 | |
| | AppTrust |
| Evidence | |
| Mission Control | |
| Workers | |
| | CLI服务器配置 |
| CLI插件管理 | |
| IDE集成 |
弃用通知:JFrog Pipelines已停止服务,不再提供支持。请勿使用CLI命名空间或Pipelines REST API(pl)。若用户询问Pipelines,告知他们该产品已停止服务。/pipelines/api/...
顶级生命周期命令(无命名空间):, , , , , , , , , , 。
rbcrbprbdrbarbfrberbirbsrburbdellrbdelr顶级安全命令:, , , , 。
auditscanbuild-scancuration-auditsbom-enrich其他顶级命令:(), , , , , , 。
access-token-createatcloginhowstatsgenerate-summary-markdownexchange-oidc-tokencompletionInvoking platform APIs with jf api
jf api通过jf api
调用平台API
jf apiWhen the CLI lacks a dedicated subcommand, use — the unified entry
point for every JFrog Platform REST and GraphQL endpoint, auto-authenticated
against the resolved server. Do not use or —
they are superseded by .
jf apijf rt curljf xr curljf api当CLI缺少专用子命令时,使用——这是所有JFrog Platform REST和GraphQL端点的统一入口,会自动针对已解析的服务器进行认证。请勿使用或——它们已被取代。
jf apijf rt curljf xr curljf apiProduct-prefix table
产品前缀表
jf api| Product | Path prefix |
|---|---|
| Artifactory | |
| Xray | |
| Access (users, groups, tokens, permissions, projects) | |
| Evidence | |
| Release Lifecycle | |
| AppTrust | |
| Distribution | |
| OneModel (GraphQL) | |
| Mission Control | |
| Curation | |
jf api| 产品 | 路径前缀 |
|---|---|
| Artifactory | |
| Xray | |
| Access(用户、组、令牌、权限、项目) | |
| Evidence | |
| Release Lifecycle | |
| AppTrust | |
| Distribution | |
| OneModel(GraphQL) | |
| Mission Control | |
| Curation | |
Examples
示例
bash
jf api /artifactory/api/repositories
jf api /artifactory/api/system/version --server-id <id>bash
jf api /artifactory/api/repositories
jf api /artifactory/api/system/version --server-id <id>AQL (POST with text/plain body)
AQL(POST请求,text/plain格式请求体)
jf api /artifactory/api/search/aql
-X POST -H "Content-Type: text/plain" -d '<aql-query>'
-X POST -H "Content-Type: text/plain" -d '<aql-query>'
Common flags: `-X/--method`, `-H/--header`, `-d/--data`, `--input <file>`,
`--server-id`, `--timeout`. Body on stdout, status on stderr — see
[Gotchas](#gotchas).jf api /artifactory/api/search/aql
-X POST -H "Content-Type: text/plain" -d '<aql-query>'
-X POST -H "Content-Type: text/plain" -d '<aql-query>'
常用参数:`-X/--method`, `-H/--header`, `-d/--data`, `--input <file>`, `--server-id`, `--timeout`。响应体输出到标准输出,状态信息输出到标准错误输出——参考【常见问题】章节。GraphQL (OneModel)
GraphQL(OneModel)
OneModel is the unified GraphQL API. Do not embed the query inside a JSON
literal () — escaping breaks requests. Build the payload
with , pass it via , and save the response to a file
before running on it.
-d '{"query":"..."}'jq -n --arg--inputjqbash
QUERY='{ evidence { searchEvidence(first: 5, where: { hasSubjectWith: { repositoryKey: "my-repo-local" } }) { totalCount } } }'
PAYLOAD=/tmp/onemodel-payload-$$.json RESPONSE=/tmp/onemodel-$$.json
jq -n --arg q "$QUERY" '{query:$q}' > "$PAYLOAD"
jf api /onemodel/api/v1/graphql -X POST \
-H "Content-Type: application/json" --input "$PAYLOAD" > "$RESPONSE"
jq . "$RESPONSE"Schema discovery:
(store only under , never query responses). Read
for the full workflow (schema fetch,
validation, pagination, errors), plus
and for query shapes, pagination,
variables, and dates.
jf api /onemodel/api/v1/supergraph/schema > "$SCHEMA_FILE"~/.jfrog/skills-cache/references/onemodel-graphql.mdreferences/onemodel-query-examples.mdreferences/onemodel-common-patterns.mdOneModel是统一的GraphQL API。请勿将查询嵌入JSON字面量中()——转义会导致请求失败。使用构建请求体,通过传入,并将响应保存到文件后再使用解析。
-d '{"query":"..."}'jq -n --arg--inputjqbash
QUERY='{ evidence { searchEvidence(first: 5, where: { hasSubjectWith: { repositoryKey: "my-repo-local" } }) { totalCount } } }'
PAYLOAD=/tmp/onemodel-payload-$$.json RESPONSE=/tmp/onemodel-$$.json
jq -n --arg q "$QUERY" '{query:$q}' > "$PAYLOAD"
jf api /onemodel/api/v1/graphql -X POST \
-H "Content-Type: application/json" --input "$PAYLOAD" > "$RESPONSE"
jq . "$RESPONSE"模式发现:(仅允许存储在下,请勿存储查询响应)。参考获取完整工作流(模式获取、验证、分页、错误处理),以及和获取查询结构、分页、变量和日期处理方式。
jf api /onemodel/api/v1/supergraph/schema > "$SCHEMA_FILE"~/.jfrog/skills-cache/references/onemodel-graphql.mdreferences/onemodel-query-examples.mdreferences/onemodel-common-patterns.mdStructured inputs
结构化输入
Several CLI commands require JSON template files. The templates are normally
created by interactive wizard commands (, , )
which agents cannot use. Instead, retrieve an existing config via REST API as a
starting point and modify it:
jf rt rptjf rt pttjf rt rpltbash
jf api /artifactory/api/repositories/<repo-key>For other Artifactory or platform REST patterns, or when you need more than
this repo GET, see Any API gap under When to read reference files.
部分CLI命令需要JSON模板文件。这些模板通常由交互式向导命令(, , )生成,但Agent无法使用这些命令。替代方案:通过REST API获取现有配置作为起点,然后进行修改:
jf rt rptjf rt pttjf rt rpltbash
jf api /artifactory/api/repositories/<repo-key>如需其他Artifactory或平台REST模式,或需要更多上述仓库GET操作之外的功能,请参考【何时参考参考文件】中的【任何API空白】部分。
Gotchas
常见问题
- requires the product prefix in the path (
jf api,/artifactory/...,/xray/...,/access/...,/evidence/...,/lifecycle/...,/apptrust/...,/distribution/...,/onemodel/...). Omitting the prefix returns 404. See the product-prefix table above./mc/... - writes the body (success or error JSON) to stdout and
jf apito stderr on every call; non-2xx also exits 1 and adds[Info] Http Status: NNN. Pipe stdout to[Warn] jf api: <method> <url> returned NNNdirectly; neverjq— stderr corrupts the JSON. To keep diagnostics:2>&1 | jq.jf api <path> 2>/tmp/err-$$.log | jq . - has no
jf api(follow redirects) and no-L(output file). Save bodies with shell redirection (-o); for binary downloads through the Artifactory remote proxy preferjf api ... > /tmp/out-$$.json, which handles the cache and redirect semantics natively.jf rt dl - Remote repository content is stored in a suffixed repo. Properties and AQL queries for remote repo artifacts must target the cache repo. Conversely,
-cacheonly accepts the parent remote key (without/api/repositories/<key>) — strip the suffix for configuration lookups.-cache - Do not use — always use a direct AQL query via
jf rt search. Seejf api /artifactory/api/search/aql -X POST -H "Content-Type: text/plain" -d '<aql>'.references/artifactory-aql-syntax.md - Use flag for non-interactive execution (suppresses confirmation prompts). Caution:
--quietis not a global flag — commands that do not support it (e.g.--quiet,jf rt s) will fail with misleading errors like "Wrong number of arguments" or "flag provided but not defined". Checkjf rt pingfor a command before adding--help.--quiet - Use when targeting a non-default server. If a command fails with
--server-id, do not retry without it — that silently targets the default server instead. See Server selection rules.--server-id - Never use interactive commands. All JFrog CLI operations must be performed
non-interactively. Known interactive commands to avoid: ,
jf config add,jf login,jf rt repo-template, andjf rt permission-target-template. For server setup, followjf rt replication-template. For templates, use JSON schemas or REST API. If a command prompts for input unexpectedly, find the non-interactive alternative viareferences/jfrog-login-flow.mdor REST API.--help - output is base64-encoded JSON. Decode with
jf config exportto extract fields.base64 -d | jq - Build info lookups require a scope (or
?buildRepo=) — resolve it before calling the API. See?project=§Retrieving build info for the full workflow.references/artifactory-operations.md - If a call returns 401, the configured token may have expired or been rotated — ask the user to re-run the login flow (see
jf api) for the same server. If 403, the token lacks required permissions. If 404, verify the endpoint path (especially the product prefix) and target server version. On any of these errors, do not try a different configured server as a workaround — that targets a different environment. Report the error and ask the user.references/jfrog-login-flow.md - Xray contextual analysis: the summary artifact response has two
applicability fields — (top-level, often null) and
applicability(always present with aapplicability_detailsstring). Useresultfor counts and summaries. Using the top-levelapplicability_details[].resultfield for aggregation produces wrong counts because it is null when no scanner exists. Seeapplicability§Contextual analysis for the eight possible result values and jq snippets.references/xray-entities.md - OneModel GraphQL: always fetch the supergraph schema from the same
server you query before building operations (schemas differ by deployment);
cache, validate, and execute per .
references/onemodel-graphql.md - Never duplicate a network-fetching command to retry parsing — save the response to a temp file first (see Preserving command output).
jq - When collecting detail responses in a loop (e.g. per-repo GETs), validate
each body with before appending to a results file. One non-JSON or empty response corrupts a downstream
jq -e .slurp. Write validated lines to an NDJSON file, thenjq -sto produce the final array. Seejq -s '.' file.ndjson.references/general-bulk-operations-and-agent-patterns.md - Accumulated edge cases from real tasks live in — read when debugging odd failures; append a short entry when you confirm a new, reusable gotcha.
references/general-use-case-hints.md
- 要求路径包含产品前缀(
jf api,/artifactory/...,/xray/...,/access/...,/evidence/...,/lifecycle/...,/apptrust/...,/distribution/...,/onemodel/...)。省略前缀会返回404。请参考上述【产品前缀表】。/mc/... - 将响应体(成功或错误的JSON)输出到标准输出,每次调用都会将
jf api输出到标准错误输出;非2xx状态码还会返回退出码1并添加[Info] Http Status: NNN。直接将标准输出管道到[Warn] jf api: <method> <url> returned NNN;切勿使用jq——标准错误输出会破坏JSON格式。如需保留诊断信息:2>&1 | jq。jf api <path> 2>/tmp/err-$$.log | jq . - 没有
jf api参数(跟随重定向),也没有-L参数(输出到文件)。使用Shell重定向保存响应体(-o);若通过Artifactory远程代理下载二进制文件,优先使用jf api ... > /tmp/out-$$.json,它会原生处理缓存和重定向逻辑。jf rt dl - 远程仓库的内容存储在后缀为的仓库中。针对远程仓库制品的属性和AQL查询必须指向缓存仓库。反之,
-cache仅接受父远程仓库的Key(不带/api/repositories/<key>后缀)——查询配置时需去掉该后缀。-cache - 请勿使用——始终通过
jf rt search直接使用AQL查询。参考jf api /artifactory/api/search/aql -X POST -H "Content-Type: text/plain" -d '<aql>'。references/artifactory-aql-syntax.md - 非交互式执行时使用参数(抑制确认提示)。注意:
--quiet并非全局参数——不支持该参数的命令(如--quiet,jf rt s)会返回误导性错误,例如"Wrong number of arguments"或"flag provided but not defined"。添加jf rt ping前请先查看命令的--quiet信息。--help - 针对非默认服务器时使用参数。若命令带
--server-id参数失败,请勿不带该参数重试——这会静默切换到默认服务器。参考【服务器选择规则】。--server-id - 切勿使用交互式命令。所有JFrog CLI操作必须以非交互式方式执行。已知需要避免的交互式命令:,
jf config add,jf login,jf rt repo-template, 和jf rt permission-target-template。服务器设置请遵循jf rt replication-template。模板请使用JSON模式或REST API。若命令意外提示输入,请通过references/jfrog-login-flow.md或REST API查找非交互式替代方案。--help - 的输出是base64编码的JSON。使用
jf config export解码以提取字段。base64 -d | jq - 构建信息查询需要作用域(或
?buildRepo=)——调用API前需确定该作用域。参考?project=中的【获取构建信息】章节获取完整工作流。references/artifactory-operations.md - 若调用返回401,配置的令牌可能已过期或被轮换——请用户针对同一服务器重新运行登录流程(参考
jf api)。若返回403,令牌缺少必要权限。若返回404,请验证端点路径(尤其是产品前缀)和目标服务器版本。遇到任何此类错误,请勿尝试使用其他已配置的服务器作为替代方案——这会指向不同的环境。报告错误并询问用户。references/jfrog-login-flow.md - Xray上下文分析:摘要制品响应包含两个适用性字段——(顶层,通常为null)和
applicability(始终存在,包含applicability_details字符串)。统计和汇总时请使用result。使用顶层applicability_details[].result字段进行汇总会导致统计错误,因为当不存在扫描器时该字段为null。参考applicability中的【上下文分析】章节获取八种可能的结果值和jq代码片段。references/xray-entities.md - OneModel GraphQL:在构建操作前,始终从同一服务器获取超级图模式(不同部署的模式不同);按照中的步骤进行缓存、验证和执行。
references/onemodel-graphql.md - 切勿重复执行网络查询命令来重试解析——先将响应保存到临时文件(参考【保存命令输出】)。
jq - 在循环中收集详情响应时(例如每个仓库的GET请求),在追加到结果文件前使用验证每个响应体。单个非JSON或空响应会破坏后续的
jq -e .合并操作。将验证后的行写入NDJSON文件,然后使用jq -s生成最终数组。参考jq -s '.' file.ndjson。references/general-bulk-operations-and-agent-patterns.md - 实际任务中积累的边缘案例存放在中——调试异常失败时请阅读;确认新的可复用问题后,请添加简短条目。
references/general-use-case-hints.md
Batch and parallel execution
批量与并行执行
When a task requires multiple independent operations, use the lightest
parallelism mechanism that fits. Three tiers: (1) batch commands in a single
Shell call using loops or , (2) issue parallel Shell tool calls, (3) launch
parallel subagents for large fan-out. Read
(~135 lines) for tier selection, examples, and subagent prompt structuring.
&references/general-parallel-execution.md当任务需要多个独立操作时,使用最适合的轻量级并行机制。分为三个层级:(1) 在单个Shell调用中使用循环或批量执行命令,(2) 发起并行Shell工具调用,(3) 针对大规模任务启动并行子Agent。参考(约135行)获取层级选择、示例和子Agent提示结构。
&references/general-parallel-execution.mdPreserving command output
保存命令输出
When a CLI command or API call returns data, redirect the output to a temporary
file so you can re-read it without re-executing the call:
bash
OUT=/tmp/jf-repos-$$.json
jf api /artifactory/api/repositories > "$OUT"
echo "$OUT"Use (the shell PID) in the filename to prevent collisions across
concurrent sessions or processes.
$$Cross-call gotcha: each Shell tool invocation runs in a new process with a
different PID, so expands to a different value in each call. Always
echo the expanded filename so the agent can read it from the output and
reuse the literal path in subsequent calls. Three patterns, in priority order:
$$- + echo (preferred): use
$$for collision safety, echo the path as shown above. The agent reads$$from the output and passes that literal value to the next Shell call./tmp/jf-repos-12345.json - Session ID: when many files share a prefix across calls, generate an ID
once (), echo it, and reuse in later calls.
SID=$(date +%s)-$$ - Hardcoded names: last resort — risks collisions when parallel calls or subagents write to the same path.
This protects against wasted round-trips when you need to retry parsing — for
example, if a filter fails or you extract the wrong field on the first
attempt. Re-read the file instead of hitting the server again.
jqDo not duplicate the same network request in a shell pipeline (e.g. with
) only to re-run or to reveal jq diagnostics—the duplicate call
adds load on JFrog without fetching new data. Run
(or redirect stdin from the file) instead
of re-running the same or other identical network-backed command.
||jqjq '<filter>' /tmp/jf-*-$$.jsonjf apiDo not reuse saved output across unrelated steps or changed contexts (different
server, user, or intent). The file is only valid for the immediate sequence of
operations that motivated the original call.
当CLI命令或API调用返回数据时,将输出重定向到临时文件,以便无需重新执行命令即可重新读取:
bash
OUT=/tmp/jf-repos-$$.json
jf api /artifactory/api/repositories > "$OUT"
echo "$OUT"在文件名中使用(Shell进程ID)以避免并发会话或进程间的冲突。
$$跨调用注意事项:每个Shell工具调用都在新进程中运行,PID不同,因此每个调用中的会展开为不同的值。请始终输出展开后的文件名,以便Agent从输出中读取并在后续调用中使用该字面路径。优先使用以下三种模式:
$$- + 输出(首选):使用
$$避免冲突,如上所示输出路径。Agent从输出中读取$$并将该字面值传递给下一个Shell调用。/tmp/jf-repos-12345.json - 会话ID:当多个文件在调用间共享前缀时,生成一次ID(),输出该ID并在后续调用中复用。
SID=$(date +%s)-$$ - 硬编码名称:最后选择——并行调用或子Agent写入同一路径时存在冲突风险。
这样可以避免在需要重试解析时浪费往返请求——例如,首次尝试时过滤器失败或提取了错误字段。重新读取文件即可,无需再次请求服务器。
jq切勿在Shell管道中重复执行相同的网络请求(例如使用)仅为了重新运行或显示jq诊断信息——重复调用会给JFrog增加负载但不会获取新数据。请运行(或从文件重定向标准输入),而非重新运行相同的或其他网络相关命令。
||jqjq '<filter>' /tmp/jf-*-$$.jsonjf api切勿在不相关的步骤或变更后的上下文(不同服务器、用户或意图)中复用保存的输出。该文件仅对触发原始调用的即时操作序列有效。