@@ -10,8 +10,8 @@ import (
1010 "strings"
1111 "text/tabwriter"
1212
13- "github.com/databricks/cli/libs/aitools/installer"
1413 "github.com/databricks/cli/cmd/root"
14+ "github.com/databricks/cli/libs/aitools/installer"
1515 "github.com/databricks/cli/libs/cmdio"
1616 "github.com/databricks/cli/libs/flags"
1717 "github.com/databricks/cli/libs/log"
@@ -36,7 +36,7 @@ func NewListCmd() *cobra.Command {
3636 return err
3737 }
3838
39- // list: empty scope = show both. Both flags set is equivalent .
39+ // list: empty scope = show both. --scope=both also lands here .
4040 var scope string
4141 switch {
4242 case projectFlag && ! globalFlag :
@@ -74,6 +74,9 @@ type skillEntry struct {
7474type scopeSummary struct {
7575 Installed int `json:"installed"`
7676 Total int `json:"total"`
77+
78+ // loaded preserves text rendering semantics without changing the JSON contract.
79+ loaded bool
7780}
7881
7982func defaultListSkills (cmd * cobra.Command , scope string ) error {
@@ -97,13 +100,13 @@ func defaultListSkills(cmd *cobra.Command, scope string) error {
97100// returns the structured listOutput. scope=="" loads both scopes; "global"
98101// or "project" loads only that scope.
99102func buildListOutput (ctx context.Context , scope string ) (listOutput , error ) {
100- ref , _ , err := installer .GetSkillsRef (ctx )
103+ ref , explicit , err := installer .GetSkillsRef (ctx )
101104 if err != nil {
102105 return listOutput {}, err
103106 }
104107
105108 src := & installer.GitHubManifestSource {}
106- manifest , err := src . FetchManifest (ctx , ref )
109+ manifest , ref , err := installer . FetchSkillsManifestWithFallback (ctx , src , ref , ! explicit )
107110 if err != nil {
108111 return listOutput {}, fmt .Errorf ("failed to fetch manifest: %w" , err )
109112 }
@@ -147,10 +150,10 @@ func buildListOutput(ctx context.Context, scope string) (listOutput, error) {
147150 // install state is missing — agents should see "0/N" rather than guess
148151 // from the absence of a key.
149152 if scope != installer .ScopeProject {
150- out .Summary [installer .ScopeGlobal ] = scopeSummary {Installed : globalCount , Total : len (names )}
153+ out .Summary [installer .ScopeGlobal ] = scopeSummary {Installed : globalCount , Total : len (names ), loaded : globalState != nil }
151154 }
152155 if scope != installer .ScopeGlobal {
153- out .Summary [installer .ScopeProject ] = scopeSummary {Installed : projectCount , Total : len (names )}
156+ out .Summary [installer .ScopeProject ] = scopeSummary {Installed : projectCount , Total : len (names ), loaded : projectState != nil }
154157 }
155158
156159 return out , nil
@@ -259,10 +262,10 @@ func summaryLine(out listOutput, scope string) string {
259262 case gOK && pOK :
260263 // Mirror prior behavior: only print the dual-scope line when both
261264 // scopes have a state file; otherwise only mention the one that does.
262- if anyInstalled ( out , installer . ScopeGlobal ) && anyInstalled ( out , installer . ScopeProject ) {
265+ if g . loaded && p . loaded {
263266 return fmt .Sprintf ("%d/%d skills installed (global), %d/%d (project)" , g .Installed , g .Total , p .Installed , p .Total )
264267 }
265- if anyInstalled ( out , installer . ScopeProject ) {
268+ if p . loaded {
266269 return fmt .Sprintf ("%d/%d skills installed (project)" , p .Installed , p .Total )
267270 }
268271 return fmt .Sprintf ("%d/%d skills installed (global)" , g .Installed , g .Total )
0 commit comments