Add AIDescription field and AI-mode help resolver#1563
Merged
Conversation
This was referenced May 21, 2026
3e94a8d to
2c472e7
Compare
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.
2c472e7 to
6f07899
Compare
BlasttS
approved these changes
Jun 1, 2026
| // The default consults the memoized ExecutionContext in | ||
| // common/commands. Exposed as a variable so tests can inject a deterministic | ||
| // answer — DetectExecutionContext caches via sync.Once and cannot be reset. | ||
| var AIAgentDetector = func() bool { |
Contributor
There was a problem hiding this comment.
nit: IsAIAgentRequest or similar would match better with a boolean return
vitaliil-jfrog
approved these changes
Jun 1, 2026
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
This is the foundation PR; the 5 plugin PRs and the jfrog-cli umbrella PR reference this branch via temporary
go.modreplaces during review, and re-pin to the merged master commit once this PR lands. Merge this PR first.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)