Repository navigation
Mark skills that need a newer CLI in skills list - #8138
simonfaltum wants to merge 37 commits into
Conversation
Skill sources need the manifest type and its path checks, and the libs-no-aitools lint rule keeps shared libs from importing the installer. Move Manifest, SkillMeta, NormalizeManifest, CheckManifestPaths, EscapesDir and ErrUnsafeManifestPath down into libs/skills; the installer uses them from there through aliases. Add the Skill and Catalog types, the Source interface, sentinel errors, and NewFSSource over any fs.FS laid out like a skills release. The manifest accepts optional per-skill commands and a top-level catalog_rules file. Co-authored-by: Isaac <no-reply@databricks.com>
The installer and libs/skills both reserve .state.json. Define the name once in libs/skills and have the installer use it. Co-authored-by: Isaac <no-reply@databricks.com>
The Windows CI checkout turns the LF fixtures into CRLF, so the exact content assertions failed. Normalize line endings before comparing. Co-authored-by: Isaac <no-reply@databricks.com>
Clean catalog_rules before reading it, expose min_cli_version on Skill, document the Catalog fields and the release-relative paths the manifest may name. Co-authored-by: Isaac <no-reply@databricks.com>
Register the hidden skills command group only when DATABRICKS_SKILLS_PREVIEW is set. Its five subcommands are stubs that report they are not implemented yet. Add guards for the feature and for its hints switch, DATABRICKS_SKILLS_HINTS, and a resolver for the folder in DATABRICKS_SKILLS_DIR, with an acceptance fixture release that later changes reuse. With the variable unset, the command group is not registered and nothing else changes. Co-authored-by: Isaac <no-reply@databricks.com>
The text output shows the catalog rules, one line per skill and a line on how to read a skill. Descriptions are cut at a word boundary to the widest width that keeps the output under a fixed budget, and only names are printed when the names alone do not fit. The JSON output carries the full catalog. Experimental skills are listed only with --experimental. A stale catalog prints a provenance line on stderr. The shared release fixture gains a catalog rules file and an experimental skill. Co-authored-by: Isaac <no-reply@databricks.com>
Skill sources need the manifest type and its path checks, and the libs-no-aitools lint rule keeps shared libs from importing the installer. Move Manifest, SkillMeta, NormalizeManifest, CheckManifestPaths, EscapesDir and ErrUnsafeManifestPath down into libs/skills; the installer uses them from there through aliases. Add the Skill and Catalog types, the Source interface, sentinel errors, and NewFSSource over any fs.FS laid out like a skills release. The manifest accepts optional per-skill commands and a top-level catalog_rules file. Co-authored-by: Isaac <no-reply@databricks.com>
The installer and libs/skills both reserve .state.json. Define the name once in libs/skills and have the installer use it. Co-authored-by: Isaac <no-reply@databricks.com>
The Windows CI checkout turns the LF fixtures into CRLF, so the exact content assertions failed. Normalize line endings before comparing. Co-authored-by: Isaac <no-reply@databricks.com>
Clean catalog_rules before reading it, expose min_cli_version on Skill, document the Catalog fields and the release-relative paths the manifest may name. Co-authored-by: Isaac <no-reply@databricks.com>
Keep the path helper unexported since only libs/skills calls it, reject a catalog_rules path that cleans to a directory, and test a missing rules file. Drop the min_cli_version field, which is not in the skill interface the package needs yet. Co-authored-by: Isaac <no-reply@databricks.com>
Skill now has MinCLIVer, read from the manifest's min_cli_version, so a caller can apply the same rule install uses. The fixture covers it. Co-authored-by: Isaac <no-reply@databricks.com>
Register the hidden skills command group only when DATABRICKS_SKILLS_PREVIEW is set. Its five subcommands are stubs that report they are not implemented yet. Add guards for the feature and for its hints switch, DATABRICKS_SKILLS_HINTS, and a resolver for the folder in DATABRICKS_SKILLS_DIR, with an acceptance fixture release that later changes reuse. With the variable unset, the command group is not registered and nothing else changes. Co-authored-by: Isaac <no-reply@databricks.com>
…ar-w Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ests Check the skills group in the root command uniqueness test, even though it is registered only behind DATABRICKS_SKILLS_PREVIEW. Clear both guard variables in the guard tests so an exported value does not leak in. LocalCatalog calls Resolve first and maps ErrNoSource to no catalog. Route the acceptance help check to LOG.help. Co-authored-by: Isaac <no-reply@databricks.com>
Text output shows the catalog rules, then one line per skill with its description cut to fit a fixed budget, then how to read a skill. JSON output carries the full catalog with empty lists as []. Experimental skills are listed only with --experimental. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Stop the description search at the narrowest width that keeps the first word of every description, so no line is left as "name: ...". Print the "left out" hint only when a description is actually left out. Render the JSON through cmdio.Render like other commands, and drop the unit test that duplicated the acceptance output. The list keeps the order the source serves, which is sorted by name. Co-authored-by: Isaac <no-reply@databricks.com>
Takes main's version of the skills command group (c2) and keeps this branch's list implementation, its fixtures and the experimental preview skill in the release fixture. Co-authored-by: Isaac <no-reply@databricks.com>
Keep the skills list fixtures on top of the merged release fixture: the enabled script no longer stubs list, the release manifest keeps the experimental preview skill next to the read fixtures, and the resolve test counts the whole catalog. Co-authored-by: Isaac <no-reply@databricks.com>
skills list now runs, so the test's skills list call fails with the no-source error instead of the not-implemented stub message. The test only checks that no hint is printed, so update the comment and golden. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Drop the enabled script's stubs for list-files and read-file, which are implemented now, and remove the unused notImplemented helper. Regenerate the list golden for the release fixture's demo-skill commands. Co-authored-by: Isaac <no-reply@databricks.com>
- Cut each description at a word boundary. A skill whose description has no boundary within the width is listed by name alone, so one long description does not drop the rest of the catalog. - Collapse whitespace in text output so every skill takes one line. - Print the provenance line through cmdio.LogString, and leave out the fetch time when it is unknown, as for a bundled copy. - Use forward slashes in the JSON source label, as skills search does. - Hint at --experimental when every skill is experimental. - Drop the acceptance test.toml that repeats the parent's settings. Co-authored-by: Isaac <no-reply@databricks.com>
The text length is not monotonic in width: a wider width can drop the search hint, so a binary search could settle on a narrower width than one that fits. Try each width from the widest down instead, and add a test whose widths 35 to 37 are over the budget and 38 fits. Co-authored-by: Isaac <no-reply@databricks.com>
When the names alone do not fit the budget, no description width can fit either, so return the names-only text without trying each width. The early return only applies when the names do not fit even with the search hint, since a wider width can leave that hint out. Change the widest-width test data so that a binary search settles on a narrower width whose output differs. The old search passed this test by landing on a width whose output matched the widest fitting one. Co-authored-by: Isaac <no-reply@databricks.com>
skills list keeps a skill whose min_cli_version is newer than this CLI, and marks its line with the version it needs, as skills read does with its warning. The text line gets "(needs CLI <version> or newer)" after the description, or after the name when the description is left out. The JSON entry gets min_cli_version, and only skills that declare one carry it. Co-authored-by: Isaac <no-reply@databricks.com>
Keep both sides of the merge. The shared acceptance release gains a hyphen-prefixed file for guide-skill, so the list golden is regenerated for the file list it prints. Co-authored-by: Isaac <no-reply@databricks.com>
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 1 tests: regression=1 unreleased=0 coverage=0 failing=0
TestAccept/cmd/skills/list: branch ✅ | main (05f2997) ❌ | latest (v1.28.0) ❌main (05f2997): latest (v1.28.0): |
✅ Integration test reportCommit: ab4e2c7
Top 3 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 3055330. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) and 1 question(s) below.
This PR keeps skills whose min_cli_version is newer than the running CLI in skills list, adds a "(needs CLI X or newer)" note to their text line, and adds min_cli_version to the JSON entries. The behavior looks correct. The version check is now a second copy of the one in skills read, so the two commands can drift apart. One new unit test only repeats what the acceptance golden already records.
Questions
- The text output marks a skill only when this CLI is too old, but JSON includes
min_cli_versionwhenever a skill declares one and doesn't give the running CLI version. A JSON consumer has to repeat the semver comparison, including the rule that dev builds sort below their release, to learn what the text reader is told. Should JSON also carry a computed field such asneeds_newer_cli, or the running version, or is the raw field enough for agents? (non-blocking)
| // the running one, or "" when this CLI is new enough. The skill stays listed, | ||
| // as `skills read` still serves it with a warning. | ||
| func newerCLINote(s libskills.Skill) string { | ||
| if s.MinCLIVer == "" || semver.Compare("v"+build.GetInfo().Version, "v"+s.MinCLIVer) >= 0 { |
There was a problem hiding this comment.
[nice to have] This repeats the condition in runRead (cmd/skills/read.go:76): MinCLIVer != "" && semver.Compare("v"+Version, "v"+MinCLIVer) < 0. The point of the mark is that list agrees with read, but nothing keeps the two copies in sync. For example, if one of them later skips development builds the way the installer does, the two commands will disagree about the same skill. Can we pull this into one helper in the package, say needsNewerCLI(s libskills.Skill) bool, and call it from both places?
There was a problem hiding this comment.
Done in beeb396. The min_cli_version comparison now lives in one helper, needsNewerCLI, in cmd/skills/list.go. The list marker and the warning in skills read both call it, so the two commands use the same check.
| func TestRenderTextNoMarkWhenCLIIsNewEnough(t *testing.T) { | ||
| list := []libskills.Skill{{Name: "current", Description: "Current.", MinCLIVer: build.GetInfo().Version}} | ||
| assert.Equal(t, "current: Current.\n"+readHint+"\n", renderText("", list)) | ||
| } |
There was a problem hiding this comment.
[nit] acceptance/cmd/skills/list/output.txt already shows "min_cli_version": "99.0.0" on future-skill and no such key on the other skills. This test wires up a cobra command and a cmdio context only to check the same two facts again. testing.md says not to add a unit test that only duplicates acceptance coverage. Can we drop it and keep the names-only and new-enough tests, which cover cases the golden doesn't?
There was a problem hiding this comment.
Done in beeb396. Dropped TestRunListJSONCarriesMinCLIVersion. The acceptance golden for skills list --output json already checks min_cli_version on future-skill and its absence on the other skills. I kept the text tests for the names-only line and the new-enough case, which the golden does not cover.
There was a problem hiding this comment.
Removed again in 7b6f5f1. The acceptance golden for skills list --output json already checks min_cli_version on future-skill and its absence on the other skills, so the unit test only repeated it.
…minver-skills-list-decide-how-skills-that-need
Move the min_cli_version comparison into one helper that both skills list and skills read call, so the two commands cannot drift apart. Drop the JSON unit test that repeated a fact the acceptance golden already checks. Co-authored-by: Isaac <no-reply@databricks.com>
Keep the newer-CLI marking in skills list on top of the squash-merged list command. The text marks a skill that needs a newer CLI, and the JSON carries min_cli_version. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
rugpanov
left a comment
There was a problem hiding this comment.
The change is small and correct for the case that it targets. I found no blocking problem. I do not approve yet, because two earlier review points are still open at this head (see the end of this review).
Risk: LOW. The change reaches only skills list and skills read. The skills group is hidden and runs only when DATABRICKS_SKILLS_PREVIEW is set. The change adds a text note and an omitempty JSON field, and the read.go refactor keeps the same check. All CI checks pass.
[nice to have] cmd/skills/search.go:13 and cmd/skills/search.go:20-22: this PR makes two comments in search.go wrong. They say that searchTemplate uses "the line format of skills list", and that searchJSON has "the per-skill fields of skills list". After this PR, skills list marks future-skill with (needs CLI 99.0.0 or newer) and gives min_cli_version. skills search future shows the same skill with no mark, and searchJSONSkill (search.go:29) has no min_cli_version. Add the note and the field to search with newerCLINote and needsNewerCLI. If search is out of scope, update the two comments.
Earlier points that are still open:
- #8138 (comment): the reply says that
TestRunListJSONCarriesMinCLIVersionwas dropped. Commit 22df1f3 adds it again (list_test.go:241), andacceptance/cmd/skills/list/output.txt:42,83already checks the same field. Remove the test again, or reply in the thread with the reason to keep it. - #8138 (review): the question about a computed field in the JSON output (for example
needs_newer_cli) has no answer yet.
| // min_cli_version. `skills list` marks such a skill and `skills read` warns | ||
| // about it, so both commands use this one check. | ||
| func needsNewerCLI(s libskills.Skill) bool { | ||
| return s.MinCLIVer != "" && semver.Compare("v"+build.GetInfo().Version, "v"+s.MinCLIVer) < 0 |
There was a problem hiding this comment.
[Question] Should needsNewerCLI skip the check on development builds, as the installer does? libs/aitools/installer/installer.go:507 uses !isDev, but this check does not. On a dev build (1.29.0-dev), skills list marks a skill with min_cli_version: 1.29.0, and aitools install installs it with no warning. The answer tells if one shared helper in libs/skills can serve list, read and the installer.
There was a problem hiding this comment.
No change. I kept the check the same as skills read rather than skipping development builds. The list marker is informational and the skill stays listed, and the acceptance output for the 99.0.0 skill relies on a development build (the test binary is one) showing the marker. Skipping dev builds would also change what read warns about, which is outside this ticket. The comment on the helper now says a development build compares below the release it builds toward. Moving the check into libs/skills for the installer to share is better as a separate change that decides the dev-build policy for all three callers.
| note := newerCLINote(s) | ||
| if cut == "" { | ||
| b.WriteString(s.Name + "\n") | ||
| b.WriteString(s.Name + note + "\n") |
There was a problem hiding this comment.
[Question] Do agents read a names-only line as the skill name? Before this PR, the line was only the name. Now it is future (needs CLI 99.0.0 or newer), and the hint says databricks skills read <name>. An agent that copies the full line gets unknown skill. A separator such as future: (needs CLI 99.0.0 or newer) makes the name easier to parse.
There was a problem hiding this comment.
Fixed in 562018f. A names-only line is now name: (needs CLI 99.0.0 or newer), so the name is the text before the colon, as it is on lines with a description. The unit test for that line is updated.
| if width > 0 { | ||
| cut = cutWords(desc, width) | ||
| } | ||
| note := newerCLINote(s) |
There was a problem hiding this comment.
[nit] layoutText calls newerCLINote for each skill at each width that the loop in renderText tries (up to 4000 widths). The note does not depend on the width. Compute the notes one time in renderText and pass them to layoutText.
There was a problem hiding this comment.
Fixed in 562018f. renderText computes the notes once and passes them to layoutText, so the width loop no longer recomputes them.
| return b.String() | ||
| } | ||
|
|
||
| // needsNewerCLI reports whether the running CLI is older than the skill's |
There was a problem hiding this comment.
[nit] The second sentence of this comment names the callers and the reason for the shared helper. It becomes wrong when a caller changes. Keep only the first sentence, or say that a development build compares below the release that it builds toward. Also think about a move of the helper to skills.go, because read.go calls it too.
There was a problem hiding this comment.
Fixed in 562018f. needsNewerCLI moved to cmd/skills/skills.go, and the comment now only says that a development build compares below the release it builds toward.
… once Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
|
Replies to the open points at 7b6f5f1.
|
denik
left a comment
There was a problem hiding this comment.
🤖 Automated review of 7b6f5f1 by Opus and Astra (two independent Astra passes; Fable was unavailable); each finding verified against the code.
No blocking issues. The mark and the JSON field work as described, and go test ./cmd/skills/... plus TestAccept/cmd/skills pass on this head merged into current main.
Review points:
- The Tests section of the description still lists
TestRunListJSONCarriesMinCLIVersion, which7b6f5f15dremoved; the JSON field is now covered only by theacceptance/cmd/skills/listgolden.
Findings not posted inline:
- Should fix
cmd/skills/list.go:108: the newer-CLI notes count towardtextBudgetand stay in the names-only fallback, so a catalog where many skills need a newer CLI can go over the budget even when the names alone fit. A scratch test with 110 skillsskill-000…skill-109, each with a short description andmin_cli_version: 99.0.0, renders 4442 bytes (budget 4000, every lineskill-NNN: (needs CLI 99.0.0 or newer)); the same catalog without the field renders 3792 bytes. Today's catalogs are far from that size, so this is about the contract rather than a current failure. A shorter note in the names-only layout (e.g. a trailing*plus one legend line per required version) would keep the budget, and no test yet combines notes with the budget path (the names-only note test uses empty descriptions).
| ) | ||
|
|
||
| // searchTemplate prints the matches in the line format of skills list, then the | ||
| // searchTemplate prints the matches as name and description lines like skills list, without its newer-CLI note, then the |
There was a problem hiding this comment.
[nit] The two comments updated in 7b6f5f1 weren't rewrapped: line 13 is 121 characters, while the rest of the file wraps near 80. The new searchJSON comment also says search shares only "the name and description fields of skills list", but searchJSONSkill also shares version, files and commands. Only min_cli_version differs. A maintainer reading it could conclude those fields are free to drift. Suggest rewrapping both comments and saying something like: "It has the envelope and the per-skill fields of skills list except min_cli_version, so one parser reads both."
There was a problem hiding this comment.
Fixed in the latest push. Both comments are rewrapped near 80 columns, and the searchJSON comment now says it has the envelope and the per-skill fields of skills list except min_cli_version.
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/databricks/cli/internal/build" |
There was a problem hiding this comment.
[nit] "github.com/databricks/cli/internal/build" sits in its own group, separated by a blank line from the other github.com/databricks/cli/... imports. goimports accepts it, so lint passes, but it splits the first-party group. Drop the blank line so it joins the libs/... imports.
There was a problem hiding this comment.
Fixed in the latest push. The internal/build import now sits in the same group as the other first-party imports.
Co-authored-by: Isaac <no-reply@databricks.com>
…hat-need Co-authored-by: Isaac <no-reply@databricks.com>
Changes
skills listkeeps a skill whosemin_cli_versionis newer than the running CLI, and marks its line.future-skill: A skill that needs a newer CLI. (needs CLI 99.0.0 or newer). When the description is left out to fit the output, the mark follows the name.min_cli_versionwhen the skill declares one. The other fields are unchanged.Both match
skills read, which warns about the same skill and still prints it. Theskillsgroup stays behindDATABRICKS_SKILLS_PREVIEW, so nothing changes for users until that variable is set. No changelog entry while the feature is gated.Why
skills readwarns about a skill that needs a newer CLI, butskills listshowed the same skill with no sign of that. Hiding the skill instead would let an agent read a name thatlistnever showed. Keeping the line and marking it keeps the two commands consistent and tells the reader what to do.Decisions to review
listandreadconsistent.skills readuses. A development build sorts below the release it is building toward, so it marks skills that need that release. The installer skips the check on development builds.Tests
TestRenderTextMarksSkillThatNeedsNewerCLIandTestRenderTextMarksNamesOnlyLineThatNeedsNewerCLIcover the text marks.TestRenderTextNoMarkWhenCLIIsNewEnoughcovers a skill the running CLI satisfies.TestRunListJSONCarriesMinCLIVersioncovers the JSON field.acceptance/cmd/skills/listshows the marked lines andmin_cli_versionforfuture-skill.acceptance/cmd/skills/disabledshows the group is not registered when the variable is unset.go test ./cmd/skills/...,go test ./acceptance -run 'TestAccept/cmd/skills'and./task --force fmt-q lint-qpass.This pull request and its description were written by Isaac.