@jfrog/opencode-jfrog-plugin 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +105 -51
  2. package/dist/index.js +30 -238
  3. package/package.json +6 -6
  4. package/skills/jfrog/SKILL.md +529 -0
  5. package/skills/jfrog/assets/.gitkeep +0 -0
  6. package/skills/jfrog/references/apptrust-entities.md +154 -0
  7. package/skills/jfrog/references/artifactory-api-gaps.md +206 -0
  8. package/skills/jfrog/references/artifactory-aql-syntax.md +656 -0
  9. package/skills/jfrog/references/artifactory-entities.md +236 -0
  10. package/skills/jfrog/references/artifactory-operations.md +178 -0
  11. package/skills/jfrog/references/catalog-entities.md +219 -0
  12. package/skills/jfrog/references/general-bulk-operations-and-agent-patterns.md +93 -0
  13. package/skills/jfrog/references/general-parallel-execution.md +131 -0
  14. package/skills/jfrog/references/general-use-case-hints.md +27 -0
  15. package/skills/jfrog/references/jfrog-brand-html-report.md +98 -0
  16. package/skills/jfrog/references/jfrog-cli-install-upgrade.md +30 -0
  17. package/skills/jfrog/references/jfrog-entity-index.md +112 -0
  18. package/skills/jfrog/references/jfrog-login-flow.md +132 -0
  19. package/skills/jfrog/references/jfrog-url-references.md +51 -0
  20. package/skills/jfrog/references/onemodel-common-patterns.md +323 -0
  21. package/skills/jfrog/references/onemodel-graphql.md +446 -0
  22. package/skills/jfrog/references/onemodel-query-examples.md +753 -0
  23. package/skills/jfrog/references/platform-access-entities.md +200 -0
  24. package/skills/jfrog/references/platform-admin-api-gaps.md +164 -0
  25. package/skills/jfrog/references/platform-admin-operations.md +58 -0
  26. package/skills/jfrog/references/projects-api.md +241 -0
  27. package/skills/jfrog/references/release-lifecycle-entities.md +180 -0
  28. package/skills/jfrog/references/stored-packages-entities.md +165 -0
  29. package/skills/jfrog/references/xray-entities.md +740 -0
  30. package/skills/jfrog/scripts/check-environment.sh +224 -0
  31. package/skills/jfrog/scripts/jfrog-login-register-session.sh +84 -0
  32. package/skills/jfrog/scripts/jfrog-login-save-credentials.sh +128 -0
  33. package/skills/jfrog-package-safety-and-download/SKILL.md +275 -0
  34. package/sync-skills-vendor.json +5 -0
@@ -0,0 +1,529 @@
1
+ ---
2
+ name: jfrog
3
+ description: >-
4
+ Interact with the JFrog Platform via the JFrog CLI, JFrog MCP server and REST/GraphQL APIs.
5
+ Use this skill when the user wants to manage Artifactory repositories,
6
+ upload or download artifacts, manage builds, configure permissions,
7
+ manage users and groups, work with access tokens, configure JFrog CLI
8
+ servers, search artifacts, manage properties, set up replication,
9
+ manage JFrog Projects, run security audits or scans, look up CVE details,
10
+ query exposures scan results from JFrog Advanced Security, manage
11
+ release bundles and lifecycle operations, aggregate or export platform
12
+ data, or perform any JFrog Platform administration task.
13
+ Also use when the user mentions jf, jfrog, artifactory, xray, distribution,
14
+ evidence, apptrust, onemodel, graphql, workers, mission control, curation,
15
+ advanced security, exposures, or any JFrog product name.
16
+ compatibility: >-
17
+ Requires jq on PATH.
18
+ metadata:
19
+ role: base
20
+ version: "0.14.0"
21
+ ---
22
+
23
+ # JFrog Skill
24
+
25
+ The foundational skill for all JFrog agent interactions. Covers JFrog Platform concepts, `jf` CLI setup and authentication, and intent routing to workflow skills.
26
+
27
+ Interact with the JFrog Platform through three tool tiers — see
28
+ [Tool selection strategy](#tool-selection-strategy). In code examples below,
29
+ `<skill_path>` refers to this skill's directory and is resolved automatically
30
+ by the agent. If the agent does not resolve it, determine the path by locating
31
+ this SKILL.md file and using its parent directory.
32
+
33
+ ## Tool selection strategy
34
+
35
+ Try the tiers in order; move to the next only when the current does not
36
+ cover the operation or fails:
37
+
38
+ 1. **JFrog MCP tools** (preferred): `CallMcpTool` against the JFrog MCP
39
+ server. Discover available tools from the server's tool list; never
40
+ guess tool names.
41
+ 2. **`jf` CLI subcommands** (fallback): dedicated commands such as
42
+ `jf rt upload`, `jf rt dl`, `jf build-publish`.
43
+ 3. **`jf api`** (last resort): REST/GraphQL endpoints with no dedicated
44
+ subcommand. Validate the path first — see rule 6 in
45
+ [Cautious execution](#cautious-execution).
46
+
47
+ MCP and the CLI may use different token scopes. If one tier returns 403,
48
+ try the alternate tier before reporting the operation blocked.
49
+
50
+ ## Prerequisites
51
+
52
+ The following tools must be available on `PATH`:
53
+
54
+ | Tool | Purpose |
55
+ |------|---------|
56
+ | `jq` | JSON parsing of CLI and API output |
57
+
58
+ All JFrog HTTP traffic from Tiers 2 and 3 goes through the `jf` CLI itself
59
+ (`jf api`, see [Invoking platform APIs with `jf api`](#invoking-platform-apis-with-jf-api) below) —
60
+ no standalone `curl` is required for any JFrog interaction.
61
+
62
+ **Runtime permission for JFrog calls.** All `jf` calls that touch the network
63
+ need an outbound-HTTPS escalation from the agent runtime. The `~/.jfrog/`
64
+ credential save (`jf config add` during login) additionally needs a
65
+ filesystem-write escalation.
66
+
67
+ | Runtime | Network | Network + `~/.jfrog/` write |
68
+ | ----------- | --------------------------------------------- | ------------------------------- |
69
+ | Cursor | `required_permissions: ["full_network"]` | `required_permissions: ["all"]` |
70
+ | Claude Code | `allowed-tools: Bash(jf:*)` + host allowlist | same + filesystem allowlist |
71
+ | Other | Configure at the runtime/sandbox layer | same |
72
+
73
+ If `jf` exits 1 with empty output, the runtime's network gate is the first
74
+ thing to check — re-run with the appropriate escalation above.
75
+
76
+ ## Environment check
77
+
78
+ MCP (Tier 1) operations do not require this check and can proceed immediately.
79
+ Before your first Tier 2 or Tier 3 (`jf`) operation in a session, run the
80
+ environment check and **remember its stdout** as `<UA>` for the rest of the
81
+ session:
82
+
83
+ ```bash
84
+ bash <skill_path>/scripts/check-environment.sh <model-slug>
85
+ # stdout (one line): jfrog-skills/<version> [(tool=<harness>; model=<model-slug>)] jfrog-cli-go/<cli-version>
86
+ # stderr: JSON state (cached 24h at ${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/jfrog-skill-state.json)
87
+ ```
88
+
89
+ Pass the precise underlying-model slug with version: `opus-4.7`,
90
+ `sonnet-4.5`, `gpt-5-codex`, `gemini-2.5-pro`, `composer-2-fast`. Cursor's
91
+ Composer product slug **is** the canonical id — use it as-is. Do **not**
92
+ pass harness/role names (`subagent`, `agent`, `assistant`) or bare family
93
+ names (`claude`, `gpt`); subagents inherit the parent's slug. If genuinely
94
+ unknown, pass `unknown`.
95
+
96
+ ### Export `JFROG_CLI_USER_AGENT` once per bash invocation
97
+
98
+ At the top of every bash invocation that runs `jf`, export `<UA>` once;
99
+ all `jf` calls in that invocation pick it up:
100
+
101
+ ```bash
102
+ export JFROG_CLI_USER_AGENT='<UA>'
103
+ jf config show
104
+ jf api /artifactory/api/system/version
105
+ ```
106
+
107
+ Do **not** repeat the assignment per `jf` call (`JFROG_CLI_USER_AGENT='<UA>' jf …`
108
+ on every line). Examples elsewhere in this skill and in `references/*.md`
109
+ omit the export for readability — the rule is global. When launching a
110
+ subagent, pass `<UA>` in its prompt; subagents do not re-run the script.
111
+
112
+ | Exit | Meaning |
113
+ |------|---------|
114
+ | 0 | Cache fresh — CLI ready (Tiers 2 and 3 available), proceed |
115
+ | 1 | Cache refreshed — CLI ready (Tiers 2 and 3 available), proceed |
116
+ | 2 | `jf` not installed — Tiers 2 and 3 unavailable; only MCP (Tier 1) remains |
117
+ | 3 | `jf` below minimum version — Tiers 2 and 3 unavailable; only MCP (Tier 1) remains |
118
+
119
+ Exit 2 or 3 is not a fatal error. Attempt to install or upgrade the CLI
120
+ (see `references/jfrog-cli-install-upgrade.md`). If installation succeeds,
121
+ re-run the environment check. If installation is not possible (no permissions,
122
+ restricted environment), proceed with MCP (Tier 1) only. Both `jf` CLI commands
123
+ (Tier 2) and `jf api` (Tier 3) require a working `jf` installation.
124
+
125
+ ### JSON parsing (`jq`)
126
+
127
+ Use **`jq`** for all JSON parsing of CLI and API output (pipes, `-r`, filters).
128
+
129
+ ## `~/.jfrog/skills-cache/` — allowed files only
130
+
131
+ `${JFROG_CLI_HOME_DIR:-$HOME/.jfrog}/skills-cache/` is **not** a general scratch
132
+ or temp directory. Use it **only** for these two artifacts:
133
+
134
+ 1. **`jfrog-skill-state.json`** — written by `scripts/check-environment.sh`
135
+ (24-hour CLI check cache).
136
+ 2. **`onemodel-schema-${JFROG_SERVER_ID}.graphql`** — cached OneModel supergraph
137
+ schema (see `references/onemodel-graphql.md`).
138
+
139
+ **Do not** save HTTP response bodies, GraphQL query results, ad-hoc JSON, reports,
140
+ or any other temporary files under `skills-cache/`. Write those to a host temp
141
+ path instead (for example `/tmp/<name>-$$.json` or `mktemp -d`), echo the path
142
+ when a follow-up Shell step must read the file — same pattern as *Preserving
143
+ command output* below.
144
+
145
+ ## Cautious execution
146
+
147
+ Do not run commands speculatively. Before executing any JFrog CLI command,
148
+ MCP tool call, or API call:
149
+
150
+ 1. Confirm the operation is needed to fulfill the user's request.
151
+ If the request is ambiguous or could refer to multiple systems (e.g.
152
+ "builds" could mean Artifactory build-info or CI/CD pipeline runs),
153
+ **ask the user for clarification** instead of guessing. Never fetch data
154
+ from the wrong system — a wrong answer is worse than asking a question.
155
+ 2. Resolve the target server using the **Server selection rules** below —
156
+ there must be no ambiguity about which server is used
157
+ 3. For mutating operations (create, update, delete, upload), confirm with the
158
+ user unless the intent is clearly implied. This applies to all tiers
159
+ (MCP tools, CLI commands, and `jf api` with POST/PUT/DELETE).
160
+ 4. Prefer read operations first to understand current state before making changes
161
+ 5. **Never invent preparatory mutations.** If the requested operation fails
162
+ because a precondition is not met (artifact missing from the specified repo,
163
+ repository does not exist, package not at the expected location, build not
164
+ found), **stop and report the gap to the user**. Do not perform copy, move,
165
+ upload, create-repo, or any other mutating operation to satisfy the
166
+ precondition unless the user explicitly asks for it. These "helper" mutations
167
+ can have cascading effects the user has not considered — virtual repository
168
+ resolution changes, storage quota consumption, replication triggers, Xray
169
+ re-indexing, or permission propagation.
170
+ 6. **Never guess tool names or API paths.** For MCP tools, confirm the tool
171
+ exists in the server's tool list. For `jf api` paths, validate against
172
+ `<skill_path>/references/` (or
173
+ [JFrog OpenAPI specifications](https://docs.jfrog.com/integrations/docs/openapi-specifications)
174
+ if you have web access). On a 404, stop and report — never retry with a guessed
175
+ alternative path.
176
+
177
+ ## Server selection rules (mandatory)
178
+
179
+ **Single-server invariant.** Every `jf` call MUST pass `--server-id <SID>`
180
+ (default resolved below); for one user request, all `jf` calls use **exactly
181
+ one** server-id. A wrong answer from the wrong server is worse than a stop-and-ask.
182
+
183
+ **JFrog MCP and CLI use independent auth.** MCP tools authenticate through
184
+ the MCP server session (not `jf config`); CLI commands authenticate through
185
+ `jf config`. If you switch the CLI target server via `jf config use`, the
186
+ MCP connection still points to its original server. Do not mix MCP and CLI
187
+ calls targeting different servers in the same session. If the user asks to
188
+ switch servers, warn that MCP tools will continue to target the original
189
+ server until the MCP connection is re-established.
190
+
191
+ **MUST NOT** retry on a second configured server after 401/403/404, empty, or
192
+ partial results; **MUST NOT** infer multi-server intent from "my"/"our" or
193
+ from seeing extra entries in `jf config show`. **Override:** only when the user
194
+ **explicitly** names another id ("on `<id>`, …", "use `<id>`", "compare `<a>`
195
+ and `<b>`") — inferred intent is not an override.
196
+
197
+ ### Resolve the default once per session
198
+
199
+ Before your first `jf` call, resolve the default server-id and **remember it**
200
+ as `<SID>` for the rest of the session, same pattern as `<UA>`:
201
+
202
+ ```bash
203
+ jf config show 2>/dev/null \
204
+ | awk '/^Server ID:/{id=$NF} /^Default:[[:space:]]*true/{print id; exit}'
205
+ # stdout: the default server-id; if empty, stop and ask which to use
206
+ ```
207
+
208
+ Pass `--server-id <SID>` to every subsequent `jf` call. The flag goes
209
+ **after** the subcommand name, not after `jf` itself:
210
+
211
+ - ✅ `jf api --server-id <SID> /artifactory/api/system/version`
212
+ - ✅ `jf rt ping --server-id <SID>`
213
+ - ❌ `jf --server-id <SID> api /…` — fails with `flag provided but not defined`
214
+
215
+ When launching a subagent, pass `<SID>` in its prompt — subagents do not
216
+ re-resolve. Examples elsewhere in this skill and in `references/*.md` omit
217
+ `--server-id` for readability; the rule is global, same as
218
+ `JFROG_CLI_USER_AGENT`. To add a new server, read
219
+ `references/jfrog-login-flow.md`.
220
+
221
+ ### On any error, stop — never switch
222
+
223
+ If a `jf` call returns 401/403, 404, network error, timeout, or any other
224
+ failure, **stop with no further `jf` calls** and respond:
225
+
226
+ > `<server-id>` returned `<code>` for `<endpoint>`: `<short reason>`. Other
227
+ > configured server(s): `<list>` — I won't query them without your explicit
228
+ > instruction. How would you like to proceed?
229
+
230
+ ## When to read reference files
231
+
232
+ Load the most specific file for the task at hand. Avoid loading more than 2-3
233
+ reference files for a single operation — start with the most relevant one and
234
+ only load additional files if the first doesn't cover the need. File sizes
235
+ vary (~25–640 lines); larger files are noted with approximate line counts
236
+ below.
237
+
238
+ ### Cross-domain
239
+
240
+ - **Disambiguating a JFrog entity, understanding entity types, or planning operations that span multiple products**: read `references/jfrog-entity-index.md`, then follow pointers to the relevant domain file
241
+ - **Looking up documentation URLs**: read `references/jfrog-url-references.md`
242
+
243
+ ### Artifactory
244
+
245
+ - **Repository types, artifacts, builds, properties, or permission targets (concepts)**: read `references/artifactory-entities.md` (~220 lines)
246
+ - **Stored packages, package versions, version locations, or the metadata layer over Artifactory (concepts)**: read `references/stored-packages-entities.md` (~165 lines)
247
+ - **Repo, file, build, permission, user/group, or replication operations**: if the JFrog MCP server exposes a tool for the operation, prefer it. For CLI/API fallback, read `references/artifactory-operations.md` (for **listing builds** use AQL with `limit`/`offset` — see § *Listing build names*; for **full build detail** use `GET /api/build/<name>/<number>?project=` — see § *Retrieving full build info*)
248
+ - **AQL queries**: read `references/artifactory-aql-syntax.md` (~585 lines)
249
+ - **Artifactory REST beyond the CLI, structured JSON templates (replacing interactive wizards), or any Artifactory API gap**: read `references/artifactory-api-gaps.md` (~220 lines)
250
+
251
+ ### Xray & security
252
+
253
+ - **Watches, policies, violations, components, or vulnerability scanning (concepts)**: read `references/xray-entities.md` (~290 lines)
254
+ - **Exposures scanning results (secrets, IaC, service misconfigurations, application security risks)**: read `references/xray-entities.md` § Exposures (Advanced Security)
255
+ - **Curation audit events (approved/blocked packages, dry-run policy evaluations, curation export)**: read `references/xray-entities.md` § Curation audit events
256
+
257
+ ### Release lifecycle & distribution
258
+
259
+ - **Release bundles, lifecycle stages, distribution, or evidence (concepts)**: read `references/release-lifecycle-entities.md` (~180 lines)
260
+ - **Applications, application versions, releasables, promotions, or AppTrust (concepts)**: read `references/apptrust-entities.md` (~155 lines)
261
+
262
+ ### Catalog
263
+
264
+ - **Public or custom catalog, package metadata, vulnerability advisories, licenses, OpenSSF, or MCP services (concepts)**: if the JFrog MCP server exposes a catalog tool, prefer it for single-package lookups. For deeper queries, read `references/catalog-entities.md` (~190 lines)
265
+ - **CVE details, vulnerability lookup by CVE ID, or severity/affected-packages/fix-versions for a specific CVE**: prefer an MCP vulnerability-lookup tool if the JFrog MCP server exposes one. Otherwise read `references/onemodel-query-examples.md` § *Public security domain* for the `searchVulnerabilities` query shape — this is self-contained; do not load the `jfrog-package-safety-and-download` skill for pure CVE lookups
266
+
267
+ ### OneModel (GraphQL)
268
+
269
+ - **GraphQL queries** (applications, packages, evidence, release bundles, catalog, cross-domain, or "list/search my" platform entities): read `references/onemodel-graphql.md` (~325 lines)
270
+ - **Query templates and domain-specific examples**: read `references/onemodel-query-examples.md` (~555 lines)
271
+ - **Pagination, filtering, GraphQL variables, or date formatting**: read `references/onemodel-common-patterns.md` (~280 lines)
272
+
273
+ ### Platform administration
274
+
275
+ - **Platform structure, project/repo membership, or project roles vs environments (concepts)**: read `references/platform-access-entities.md`
276
+ - **Access tokens, stats, projects, or system health**: read `references/platform-admin-operations.md`
277
+ - **Managing JFrog Projects, members, or environments**: read `references/projects-api.md` (~260 lines)
278
+ - **Platform REST beyond the CLI, or any platform-level API gap**: read `references/platform-admin-api-gaps.md` (~180 lines)
279
+
280
+ ### CLI setup & authentication
281
+
282
+ - **Adding a server or logging in**: read `references/jfrog-login-flow.md` (~130 lines)
283
+ - **CLI not installed, upgrade needed, or `jq` unavailable**: read `references/jfrog-cli-install-upgrade.md`
284
+
285
+ ### General patterns
286
+
287
+ - **Batching, parallel Shell calls, or launching subagents**: read `references/general-parallel-execution.md` (~135 lines)
288
+ - **Large or parallel data gathering, list-vs-detail APIs, cache hygiene**: read `references/general-bulk-operations-and-agent-patterns.md`
289
+ - **Standalone HTML report with JFrog-aligned styling**: read `references/jfrog-brand-html-report.md`
290
+ - **Reusable gotchas from past tasks**: read or extend `references/general-use-case-hints.md`
291
+
292
+ ## Command discovery
293
+
294
+ Use the commands listed below as your primary reference. Run `--help` to
295
+ verify options you are unsure about or to discover commands not listed here —
296
+ do not rely on memorized commands outside this skill, as they may be outdated.
297
+
298
+ 1. `jf --help` — list all namespaces and top-level commands
299
+ 2. `jf <namespace> --help` — list subcommands in a namespace
300
+ 3. `jf <command> --help` — show usage, arguments, and options
301
+
302
+ ### CLI namespaces
303
+
304
+ | Namespace | Alias | Product |
305
+ |-----------|-------|---------|
306
+ | `rt` | | Artifactory |
307
+ | `xr` | | Xray |
308
+ | `ds` | | Distribution V1 |
309
+ | `at` | `apptrust` | AppTrust |
310
+ | `evd` | | Evidence |
311
+ | `mc` | | Mission Control |
312
+ | `worker` | | Workers |
313
+ | `config` | `c` | CLI server configuration |
314
+ | `plugin` | | CLI plugin management |
315
+ | `ide` | | IDE integration |
316
+
317
+ > **Sunset notice:** JFrog Pipelines has been sunset and is no longer supported.
318
+ > Do not use the `pl` CLI namespace or the Pipelines REST API
319
+ > (`/pipelines/api/...`). If a user asks about Pipelines, inform them the
320
+ > product has been sunset.
321
+
322
+ Top-level lifecycle commands (no namespace): `rbc`, `rbp`, `rbd`, `rba`,
323
+ `rbf`, `rbe`, `rbi`, `rbs`, `rbu`, `rbdell`, `rbdelr`.
324
+
325
+ Top-level security commands: `audit`, `scan`, `build-scan`, `curation-audit`,
326
+ `sbom-enrich`.
327
+
328
+ Top-level other: `access-token-create` (`atc`), `login`, `how`, `stats`,
329
+ `generate-summary-markdown`, `exchange-oidc-token`, `completion`.
330
+
331
+ ## Invoking platform APIs with `jf api`
332
+
333
+ `jf api` is the Tier 3 entry point for JFrog Platform REST and GraphQL
334
+ endpoints, auto-authenticated against the resolved server. **Do not use
335
+ `jf rt curl` or `jf xr curl`**; they are superseded by `jf api`.
336
+
337
+ ### Product-prefix table
338
+
339
+ `jf api` requires the **full** path including the product prefix; omitting it
340
+ returns 404.
341
+
342
+ | Product | Path prefix |
343
+ |---------|-------------|
344
+ | Artifactory | `/artifactory/api/...` |
345
+ | Xray | `/xray/api/...` |
346
+ | Access (users, groups, tokens, permissions, projects) | `/access/api/...` |
347
+ | Evidence | `/evidence/api/...` |
348
+ | Release Lifecycle | `/lifecycle/api/...` |
349
+ | AppTrust | `/apptrust/api/...` |
350
+ | Distribution | `/distribution/api/...` |
351
+ | OneModel (GraphQL) | `/onemodel/api/v1/graphql`, `/onemodel/api/v1/supergraph/schema` |
352
+ | Mission Control | `/mc/api/...` |
353
+ | Curation | `/xray/api/v1/curation/...` (lives under Xray) |
354
+
355
+ ### Examples
356
+
357
+ ```bash
358
+ jf api /artifactory/api/repositories
359
+ jf api --server-id <SID> /artifactory/api/system/version
360
+
361
+ # AQL (POST with text/plain body)
362
+ jf api /artifactory/api/search/aql \
363
+ -X POST -H "Content-Type: text/plain" -d '<aql-query>'
364
+ ```
365
+
366
+ Common flags: `-X/--method`, `-H/--header`, `-d/--data`, `--input <file>`,
367
+ `--server-id`, `--timeout`. Body on stdout, status on stderr — see
368
+ [Gotchas](#gotchas).
369
+
370
+ ### GraphQL (OneModel)
371
+
372
+ OneModel is the unified GraphQL API. **Do not** embed the query inside a JSON
373
+ literal (`-d '{"query":"..."}'`) — escaping breaks requests. Build the payload
374
+ with `jq -n --arg`, pass it via `--input`, and save the response to a file
375
+ before running `jq` on it.
376
+
377
+ ```bash
378
+ QUERY='{ evidence { searchEvidence(first: 5, where: { hasSubjectWith: { repositoryKey: "my-repo-local" } }) { totalCount } } }'
379
+ PAYLOAD=/tmp/onemodel-payload-$$.json RESPONSE=/tmp/onemodel-$$.json
380
+ jq -n --arg q "$QUERY" '{query:$q}' > "$PAYLOAD"
381
+ jf api /onemodel/api/v1/graphql -X POST \
382
+ -H "Content-Type: application/json" --input "$PAYLOAD" > "$RESPONSE"
383
+ jq . "$RESPONSE"
384
+ ```
385
+
386
+ Schema discovery: `jf api /onemodel/api/v1/supergraph/schema > "$SCHEMA_FILE"`
387
+ (store only under `~/.jfrog/skills-cache/`, never query responses). Read
388
+ `references/onemodel-graphql.md` for the full workflow (schema fetch,
389
+ validation, pagination, errors), plus `references/onemodel-query-examples.md`
390
+ and `references/onemodel-common-patterns.md` for query shapes, pagination,
391
+ variables, and dates.
392
+
393
+ ## Structured inputs
394
+
395
+ Several CLI commands require JSON template files. The templates are normally
396
+ created by interactive wizard commands (`jf rt rpt`, `jf rt ptt`, `jf rt rplt`)
397
+ which agents cannot use. Instead, retrieve an existing config via REST API as a
398
+ starting point and modify it:
399
+
400
+ ```bash
401
+ jf api /artifactory/api/repositories/<repo-key>
402
+ ```
403
+
404
+ For other Artifactory or platform REST patterns, or when you need more than
405
+ this repo GET, see **Any API gap** under [When to read reference files](#when-to-read-reference-files).
406
+
407
+ ## Gotchas
408
+
409
+ ### MCP tools
410
+
411
+ - MCP tools return structured data in the tool result. Read response fields
412
+ directly; do not pipe MCP output through shell commands or `jq`.
413
+
414
+ ### CLI and `jf api`
415
+
416
+ - `jf api` requires the **product prefix** in the path. Omitting it returns
417
+ 404. See the [product-prefix table](#product-prefix-table) for the full list.
418
+ - `jf api` writes the body (success or error JSON) to **stdout** and
419
+ `[Info] Http Status: NNN` to **stderr** on every call; non-2xx also exits
420
+ 1 and adds `[Warn] jf api: <method> <url> returned NNN`. Pipe stdout to
421
+ `jq` directly; **never `2>&1 | jq`** — stderr corrupts the JSON. To keep
422
+ diagnostics: `jf api <path> 2>/tmp/err-$$.log | jq .`.
423
+ - `jf api` has **no `-L`** (follow redirects) and **no `-o`** (output file).
424
+ Save bodies with shell redirection
425
+ (`jf api ... > /tmp/out-$$.json`); for
426
+ binary downloads through the Artifactory remote proxy prefer `jf rt dl`,
427
+ which handles the cache and redirect semantics natively.
428
+ - Remote repository content is stored in a `-cache` suffixed repo. Properties
429
+ and AQL queries for remote repo artifacts must target the cache repo.
430
+ Conversely, `/api/repositories/<key>` only accepts the parent remote key
431
+ (without `-cache`) — strip the suffix for configuration lookups.
432
+ - **Do not use `jf rt search`** — always use a direct AQL query via
433
+ `jf api /artifactory/api/search/aql -X POST -H "Content-Type: text/plain" -d '<aql>'`.
434
+ See `references/artifactory-aql-syntax.md`.
435
+ - Use `--quiet` flag for non-interactive execution (suppresses confirmation
436
+ prompts). **Caution:** `--quiet` is not a global flag — commands that do not
437
+ support it (e.g. `jf rt s`, `jf rt ping`) will fail with misleading errors
438
+ like "Wrong number of arguments" or "flag provided but not defined". Check
439
+ `--help` for a command before adding `--quiet`.
440
+ - Use `--server-id` when targeting a non-default server. If a command fails
441
+ with `--server-id`, do not retry without it — that silently targets the
442
+ default server instead. See [Server selection rules](#server-selection-rules-mandatory).
443
+ - Never use interactive commands. All JFrog CLI operations must be performed
444
+ non-interactively. Known interactive commands to avoid: `jf config add`,
445
+ `jf login`, `jf rt repo-template`, `jf rt permission-target-template`, and
446
+ `jf rt replication-template`. For server setup, follow `references/jfrog-login-flow.md`.
447
+ For templates, use JSON schemas or REST API. If a command prompts for input
448
+ unexpectedly, find the non-interactive alternative via `--help` or REST API.
449
+ - `jf config export` output is base64-encoded JSON. Decode with
450
+ `base64 -d | jq` to extract fields.
451
+ - Build info lookups require a scope (`?buildRepo=` or `?project=`) —
452
+ resolve it before calling the API. See `references/artifactory-operations.md`
453
+ §Retrieving build info for the full workflow.
454
+ - If a `jf api` call returns 401, the configured token may have expired or
455
+ been rotated — ask the user to re-run the login flow (see
456
+ `references/jfrog-login-flow.md`) for the **same** server. If 403, the
457
+ token lacks required permissions. If 404, verify the endpoint path
458
+ (especially the product prefix) and target server version. On any of
459
+ these errors, do not try a different configured server as a workaround —
460
+ that targets a different environment. Report the error and ask the user.
461
+ - **Xray contextual analysis:** the summary artifact response has two
462
+ applicability fields — `applicability` (top-level, often null) and
463
+ `applicability_details` (always present with a `result` string). **Use
464
+ `applicability_details[].result` for counts and summaries.** Using the
465
+ top-level `applicability` field for aggregation produces wrong counts because
466
+ it is null when no scanner exists. See `references/xray-entities.md`
467
+ §Contextual analysis for the eight possible result values and jq snippets.
468
+ - **OneModel GraphQL:** always fetch the supergraph schema from the **same**
469
+ server you query before building operations (schemas differ by deployment);
470
+ cache, validate, and execute per `references/onemodel-graphql.md`.
471
+ - Never duplicate a network-fetching command to retry `jq` parsing — save the
472
+ response to a temp file first (see [Preserving command output](#preserving-command-output)).
473
+ - When collecting detail responses in a loop (e.g. per-repo GETs), validate
474
+ each body with `jq -e .` before appending to a results file. One non-JSON
475
+ or empty response corrupts a downstream `jq -s` slurp. Write validated
476
+ lines to an NDJSON file, then `jq -s '.' file.ndjson` to produce the final
477
+ array. See `references/general-bulk-operations-and-agent-patterns.md`.
478
+ - Accumulated edge cases from real tasks live in `references/general-use-case-hints.md`
479
+ — read when debugging odd failures; **append** a short entry when you confirm
480
+ a new, reusable gotcha.
481
+
482
+ ## Batch and parallel execution
483
+
484
+ When a task requires multiple independent operations, use the lightest
485
+ parallelism mechanism that fits. Three tiers: (1) batch commands in a single
486
+ Shell call using loops or `&`, (2) issue parallel Shell tool calls, (3) launch
487
+ parallel subagents for large fan-out. Read `references/general-parallel-execution.md`
488
+ (~135 lines) for tier selection, examples, and subagent prompt structuring.
489
+
490
+ ## Preserving command output
491
+
492
+ When a CLI command or API call returns data, redirect the output to a temporary
493
+ file so you can re-read it without re-executing the call:
494
+
495
+ ```bash
496
+ OUT=/tmp/jf-repos-$$.json
497
+ jf api /artifactory/api/repositories > "$OUT"
498
+ echo "$OUT"
499
+ ```
500
+
501
+ Use `$$` (the shell PID) in the filename to prevent collisions across
502
+ concurrent sessions or processes.
503
+
504
+ **Cross-call gotcha:** each Shell tool invocation runs in a new process with a
505
+ different PID, so `$$` expands to a different value in each call. Always
506
+ **echo the expanded filename** so the agent can read it from the output and
507
+ reuse the literal path in subsequent calls. Three patterns, in priority order:
508
+
509
+ 1. **`$$` + echo** (preferred): use `$$` for collision safety, echo the path
510
+ as shown above. The agent reads `/tmp/jf-repos-12345.json` from the output
511
+ and passes that literal value to the next Shell call.
512
+ 2. **Session ID**: when many files share a prefix across calls, generate an ID
513
+ once (`SID=$(date +%s)-$$`), echo it, and reuse in later calls.
514
+ 3. **Hardcoded names**: last resort — risks collisions when parallel calls or
515
+ subagents write to the same path.
516
+
517
+ This protects against wasted round-trips when you need to retry parsing — for
518
+ example, if a `jq` filter fails or you extract the wrong field on the first
519
+ attempt. Re-read the file instead of hitting the server again.
520
+
521
+ Do **not** duplicate the same **network** request in a shell pipeline (e.g. with
522
+ `||`) only to re-run `jq` or to reveal jq diagnostics—the duplicate call
523
+ adds load on JFrog without fetching new data. Run
524
+ `jq '<filter>' /tmp/jf-*-$$.json` (or redirect stdin from the file) instead
525
+ of re-running the same `jf api` or other identical network-backed command.
526
+
527
+ Do **not** reuse saved output across unrelated steps or changed contexts (different
528
+ server, user, or intent). The file is only valid for the immediate sequence of
529
+ operations that motivated the original call.
File without changes