Skip to content

JGC-473 - Add --ai-help flag, AI text for umbrella commands, and call-site wiring#3503

Draft
ehl-jf wants to merge 2 commits into
masterfrom
JGC-473-ai-context-help
Draft

JGC-473 - Add --ai-help flag, AI text for umbrella commands, and call-site wiring#3503
ehl-jf wants to merge 2 commits into
masterfrom
JGC-473-ai-context-help

Conversation

@ehl-jf
Copy link
Copy Markdown
Contributor

@ehl-jf ehl-jf commented May 21, 2026

Summary

Top-of-stack PR for JGC-473. Adds AI-agent-oriented help text to the JFrog CLI as a whole.

Two commits on this branch:

  1. 0650eecb — Add --ai-help global flag + argv pre-pass. Bridges `--ai-help` to `JFROG_CLI_AI_HELP` before `getCommands()` runs, since the conversion layer in jfrog-cli-core reads the env var during command setup (urfave/cli's own flag parser runs too late).

  2. dfde4c12 — Populate GetAIDescription() in 85 docs/<ns>/<cmd>/help.go files for all visible umbrella-local commands (28 hidden/dead-code stubs skipped). Rewrite ~85 cli.Command literals in main.go + 7 */cli.go files to route Usage/HelpName through corecommon.ResolveDescription (umbrella uses urfave/cli directly, not components.Command, so the core conversion-layer mechanism doesn't reach these — call-site rewrites are necessary). For namespace shells with hard-coded Usage strings (rt, mc, pl, c, etc.) new <name>AIUsage consts were introduced. Adds JFROG_CLI_AI_HELP=false to setupIntegrationTests so help-text-asserting tests are deterministic when the runner inherits an AI agent's env (CLAUDECODE, CURSOR_AGENT, etc.).

⚠️ DO NOT MERGE — DRAFT until blocking PRs land

This PR is blocked on:

  1. jfrog-cli-core: JGC-473 - Add AIDescription field and AI-mode help resolver jfrog-cli-core#1563
  2. jfrog-cli-artifactory: JGC-473 - Add AI-agent help text to artifactory commands jfrog-cli-artifactory#455
  3. jfrog-cli-security: JGC-473 - Add AI-agent help text to security commands jfrog-cli-security#760
  4. jfrog-cli-evidence: JGC-473 - Add AI-agent help text to evidence commands jfrog-cli-evidence#65
  5. jfrog-cli-platform-services: JGC-473 - Add AI-agent help text to platform-services commands jfrog-cli-platform-services#58
  6. jfrog-cli-application: JGC-473 - Add AI-agent help text to application commands jfrog-cli-application#81
  7. The yarn-coordination break (RTECO-1035 follow-up): jfrog-cli-core master removed yarn.IsVersionSupported and IsInstalledYarnVersionSupported, but jfrog-cli-artifactory/artifactory/commands/yarn/yarn.go still calls them. A fix in jfrog-cli-artifactory is needed before this umbrella can build against merged-core-master without temporary replace directives.

TEMPORARY go.mod replaces — MUST BE REMOVED BEFORE MERGE

go.mod contains 5 replace directives pointing at the in-flight JGC-473 branches:

github.com/jfrog/jfrog-cli-application => github.com/ehl-jf/jfrog-cli-application v0.0.0-...
github.com/jfrog/jfrog-cli-artifactory => github.com/ehl-jf/jfrog-cli-artifactory v0.0.0-...
github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260521114102-d507b5c64941
github.com/jfrog/jfrog-cli-evidence => github.com/ehl-jf/jfrog-cli-evidence v0.0.0-...
github.com/jfrog/jfrog-cli-security => github.com/ehl-jf/jfrog-cli-security v0.0.0-...

The core entry points at `JGC-473-devbase` (a coordination branch); the other 4 point at the developer's fork (because direct org push permissions are not in scope for the plugin repos). Once each linked PR merges and the yarn coordination is resolved, replaces must be dropped and each require re-pinned to the merged base-branch pseudo-version.

Test plan

  • go build ./... clean
  • go test ./... 0 failures, 15 OK packages (with the test-setup env force-off)
  • Full §6 verification matrix on locally-built binary: env force-on/off, agent auto-detect (CLAUDECODE=1), --ai-help flag, namespace listing, unparseable env value (graceful fallback), runtime unaffected
  • End-to-end plugin AI text rendering verified: jf rt upload --help, jf audit --help, jf evd create --help, jf apptrust ping --help, jf worker deploy --help all produce AI-mode output when JFROG_CLI_AI_HELP=true

Out of scope (deferred to follow-ups)

  • Multi-line AI text inside CreateUsage's Name:\n\t<cmd> - <text> format is functional but awkward. Defining aiCommandHelpTemplate/aiAppHelpTemplate that surface Description as a standalone section is plan §3.2 — deferred.
  • Localization (English only for v1).
  • apptrust version-rollback: declares 2 Arguments but Action requires 3 (from-stage undocumented) — pre-existing bug, separate fix.

ehl-jf added 2 commits May 21, 2026 14:04
Add a global --ai-help flag that, together with the JFROG_CLI_AI_HELP env
var, switches the conversion layer in jfrog-cli-core to render
AIDescription instead of Description.

The argv pre-pass runs before getCommands() so the conversion layer
(invoked during command setup) reads the env var early; urfave/cli's
own flag parsing happens later inside app.Run, by which time
command strings are already frozen.

The flag deliberately omits EnvVar: urfave/cli's BoolFlag EnvVar
binding parses the env value with strconv.ParseBool at startup and
crashes on unparseable values (e.g. JFROG_CLI_AI_HELP=maybe). Our
resolver in docs/common.AIHelpEnabled treats unparseable as a soft
fall-back to detection - bypassing urfave/cli's binding preserves
that gentler behavior.

No AIDescription content is populated yet; that arrives via the
follow-up backfill commit (umbrella subagent for help.go files and
call-site rewrites).
…l sites

Builds on commit 0650eec (which added the --ai-help flag and argv
pre-pass to main.go). This commit completes the umbrella's side of
JGC-473 by:

1. Adding GetAIDescription() to 85 docs/<ns>/<cmd>/help.go files for
   all visible jfrog-cli local commands. 28 help.go files for hidden /
   deprecated / dead-code stubs were intentionally skipped.

2. Rewriting cli.Command literals in main.go and 7 */cli.go files to
   route Usage / HelpName through corecommon.ResolveDescription, so the
   conversion-layer mechanism in jfrog-cli-core applies to the umbrella's
   own urfave/cli-based commands (which don't go through components.Command).
   For namespace shells with hardcoded Usage strings (rt, mc, pl, c, etc.)
   new <name>AIUsage constants were introduced.

3. Adding JFROG_CLI_AI_HELP=false default in main_test.go's
   setupIntegrationTests so help-text assertions remain deterministic
   when the test runner inherits an AI agent's env (CLAUDECODE,
   CURSOR_AGENT, etc.). CI runners without agent env are unaffected.

TEMPORARY go.mod state - REMOVE the 5 replace directives in the replace
block before merge. Each points at the in-flight JGC-473 branch of the
respective repo (jfrog-cli-core on JGC-473-devbase; 4 plugin repos on
developer's fork because direct org push is not in scope for plugin
repos). Once each repo's JGC-473 PR merges to its base branch, the
require pinning is sufficient and these replaces MUST be removed.

This PR MUST NOT merge until: (a) all 5 cross-repo JGC-473 PRs have
merged, AND (b) the yarn-coordination break between core master and
jfrog-cli-artifactory main is resolved upstream (RTECO-1035 follow-up).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant