JGC-473 - Add AIDescription field and AI-mode help resolver#1563
Open
ehl-jf wants to merge 1 commit into
Open
Conversation
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.
This was referenced May 21, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foundational change for JGC-473 (AI-agent-oriented help text in JFrog CLI).
AIDescription stringtocomponents.Commandandcomponents.Namespace. Empty falls back toDescription, so callers that don't opt in see no behavior change.docs/common.ResolveDescription(human, ai string),AIHelpEnabled(), and constEnvAIHelp = "JFROG_CLI_AI_HELP".ResolveDescriptioninto thecomponents -> urfave/cliconversion layer so plugins that populateAIDescriptionget agent-flavored help automatically.AIAgentDetectorfunction variable to keep the resolver unit-testable (the underlyingExecutionContextissync.Once-memoized and can't be reset).Cross-repo coordination
A companion coordination branch
JGC-473-devbaseis 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 ./...cleango vet ./...clean (apart from a pre-existingsync.Oncecopy warning incommon/commands/execution_context_test.gothat predates this PR)go test ./...all packages pass, including the newdocs/common/aihelp_test.go(resolver matrix) andplugins/components/conversionlayer_test.go(round-trip viaconvertCommand)--ai-helpflag, unparseable env value, runtime unaffected)Linked PRs (downstream consumers)
To be filled in as each opens: