Skip to content

JGC-473 - Add AIDescription field and AI-mode help resolver#1563

Open
ehl-jf wants to merge 1 commit into
masterfrom
JGC-473-ai-context-help
Open

JGC-473 - Add AIDescription field and AI-mode help resolver#1563
ehl-jf wants to merge 1 commit into
masterfrom
JGC-473-ai-context-help

Conversation

@ehl-jf
Copy link
Copy Markdown
Contributor

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

Summary

Foundational change for JGC-473 (AI-agent-oriented help text in JFrog CLI).

  • Adds optional AIDescription string to components.Command and components.Namespace. Empty falls back to Description, so callers that don't opt in see no behavior change.
  • Adds docs/common.ResolveDescription(human, ai string), AIHelpEnabled(), and const EnvAIHelp = "JFROG_CLI_AI_HELP".
  • Wires ResolveDescription into the components -> urfave/cli conversion layer so plugins that populate AIDescription get agent-flavored help automatically.
  • Agent detection goes through an overridable AIAgentDetector function variable to keep the resolver unit-testable (the underlying ExecutionContext is sync.Once-memoized and can't be reset).

Cross-repo coordination

A companion coordination branch JGC-473-devbase is pushed to this same repo. It cherry-picks this PR's commit onto core's currently-pinned commit `908527b4` (pre-yarn-API-removal). Consumers (the 5 plugin repos and the jfrog-cli umbrella) reference `JGC-473-devbase` via temporary go.mod replaces during PR review because new core master + pinned artifactory currently can't compile together (RTECO-1035 yarn-API removal landed in core master but `jfrog-cli-artifactory` main still calls the removed functions). `JGC-473-devbase` is NEVER intended to merge; once this PR merges and the yarn coordination is resolved upstream, downstream PRs drop their replaces and pin to the merged master commit.

Test plan

  • go build ./... clean
  • go vet ./... clean (apart from a pre-existing sync.Once copy warning in common/commands/execution_context_test.go that predates this PR)
  • go test ./... all packages pass, including the new docs/common/aihelp_test.go (resolver matrix) and plugins/components/conversionlayer_test.go (round-trip via convertCommand)
  • Manual verification of all 9 scenarios from the plan's §6 matrix (env force-on/off, agent auto-detect, --ai-help flag, unparseable env value, runtime unaffected)

Linked PRs (downstream consumers)

To be filled in as each opens:

  • jfrog-cli-artifactory: ``
  • jfrog-cli-security: ``
  • jfrog-cli-evidence: ``
  • jfrog-cli-platform-services: ``
  • jfrog-cli-application: ``
  • jfrog-cli (umbrella): `` (DRAFT — blocked on the 5 above + yarn coordination)

Add AIDescription to components.Command and components.Namespace, plus a
new docs/common.ResolveDescription helper that prefers the AI text when
JFROG_CLI_AI_HELP is truthy or the process is detected as an AI agent.
Wire it into the components->urfave/cli conversion layer so plugins that
populate AIDescription get the agent-flavored help with no other changes.

Setting AIDescription is purely additive: empty falls back to Description,
so callers that don't opt in see no behavior change.

Detection hooks through an AIAgentDetector function variable rather than
calling commands.DetectExecutionContext() directly. The underlying
ExecutionContext is sync.Once-memoized and cannot be reset, which would
make the resolver untestable; the hook lets unit tests inject a
deterministic answer.
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