Add agents to aitools list output - #6020
Conversation
Integration test reportCommit: f84991a
11 interesting tests: 4 SKIP, 3 FAIL, 3 RECOVERED, 1 KNOWN
Top 1 slowest tests (at least 2 minutes):
|
b90063a to
737b0e0
Compare
| Name: a.Name, | ||
| DisplayName: a.DisplayName, | ||
| Managed: a.Plugin != nil, | ||
| Detected: a.IsPreselected(ctx), |
There was a problem hiding this comment.
detected comes from IsPreselected, which for a plugin agent is true only when its binary is on PATH — so an installed ~/.claude with no claude on PATH reports detected:false, contradicting the PR's "binary or config dir found". Intended, or did you mean a presence check?
There was a problem hiding this comment.
I want to just copy the TUI UX, so I used IsPreselected which is the same method the TUI agent selector uses to decide if an agent is detected or not.
Plugin agents needs the binary on PATH to install properly, so returning detected: false is expected here
| // skills are symlinked/copied into the agent's own skills dir instead. | ||
| // Detect the install from disk and report the scope's recorded release | ||
| // as the version, so JSON consumers see them as installed too. | ||
| if a.Plugin == nil && agentHasSkillsInScope(ctx, a, scope) { |
There was a problem hiding this comment.
This disk check is gated on a.Plugin == nil, but a plugin agent installed with --skills-only also has skills on disk and no plugin record, so it shows installed:{}. Should the fallback fire whenever there's no recorded plugin, not only for skills-only agents?
There was a problem hiding this comment.
For the VSCode usecase I think this granularity isn't needed, we're just focussing on the happy path of plugin installs and we don't expose --skills-only.
My feeling is that users who already did an installation with --skills-only know enough about what they're doing, and won't be tripped up on installed: {}
There was a problem hiding this comment.
The CLI is not just for VS Code. I don't want to optimize CLI for a single product. I would think of this as a bug for CLI because it does not cover every possible scenario. I also think it's not hard to implement. So, I would like us to have it logic complete.
| Name: a.Name, | ||
| DisplayName: a.DisplayName, | ||
| Managed: a.Plugin != nil, | ||
| Detected: a.IsPreselected(ctx), |
There was a problem hiding this comment.
detected is populated from the preselection verdict, not a presence check.
The JSON field is named detected, but it's set from Agent.IsPreselected(ctx) rather than Agent.Detected(ctx). Those are different concepts, and they diverge from "is this agent present on the machine" in both directions (see IsPreselected → DisplayState in libs/aitools/agents/detect.go):
- Configured but CLI not on PATH →
StateInstalledCLIMissing→detected: false. E.g. an agent installed via a GUI so its config dir exists but the binary isn't onPATH— reported as not detected, though it's actually present. - Binary on PATH but never configured →
StateAvailable→detected: true. E.g. the CLI is installed but the config dir doesn't exist yet — reported as detected, though nothing's set up.
IsPreselected is the "should the picker pre-check this row" verdict, which is a reasonable thing to expose — but under the name detected a JSON consumer (the VSCode extension) will read it as presence and get the wrong answer at both boundaries.
Two ways to resolve:
- If presence is what consumers want, populate the field from
a.Detected(ctx)(the config-dir match that already exists). - If the preselection verdict is intentional, keep the value but rename the field (e.g.
preselected/recommended) and expand the doc comment — right now it reads "the CLI's own presence verdict," which describesDetected, notIsPreselected.
There was a problem hiding this comment.
TLDR; yes this is intentional.
The naming here is a bit tricky, but I think detected is the best name here for what it means without being overly verbose. We are asking "which agents are available to install plugins/skills for?" and for plugin agents if the binary is missing from PATH then we detected that the agent is not available for installation.
preselected or recommended couples this to the initial install UI and I'm not sure if we'll want to use this elsewhere (maybe we never will), so I biased towards a more neutral name.
If the conflict with a.Detected seems too confusing then I can rename (but IMO a.Detected would be better renamed to a.IsConfigPresent)
There was a problem hiding this comment.
I think both variables are not really represent what they imply.
IsConfigPresent is better then Detected.
Also, if it is within our control, let's rename IsPreselected to explain the real meaning of variable (IsConfigPresent).
parthban-db
left a comment
There was a problem hiding this comment.
Approving to unblock, but can you please do the change in this comment?
| // skills are symlinked/copied into the agent's own skills dir instead. | ||
| // Detect the install from disk and report the scope's recorded release | ||
| // as the version, so JSON consumers see them as installed too. | ||
| if a.Plugin == nil && agentHasSkillsInScope(ctx, a, scope) { |
There was a problem hiding this comment.
The CLI is not just for VS Code. I don't want to optimize CLI for a single product. I would think of this as a bug for CLI because it does not cover every possible scenario. I also think it's not hard to implement. So, I would like us to have it logic complete.
Changes
Update
aitools listto report every supported coding agent in--output jsonmode, with its detection status (whether the CLI binary and config directory were found) and databricks plugin installation status and version.Why
This is needed to power integration with the VSCode extension in two places:
Tests
Added automated tests