Skip to content

Promote aitools from experimental to top-level command#4917

Open
jamesbroadhead wants to merge 11 commits intomainfrom
jbroadhead/aitools-public
Open

Promote aitools from experimental to top-level command#4917
jamesbroadhead wants to merge 11 commits intomainfrom
jbroadhead/aitools-public

Conversation

@jamesbroadhead
Copy link
Copy Markdown

@jamesbroadhead jamesbroadhead commented Apr 8, 2026

Summary

  • Promotes the aitools skills-management surface to top-level databricks aitools: install, update, uninstall, list, version, and the (hidden) skills alias group
  • Removes Hidden: true from those commands so they show up under databricks --help
  • Preserves databricks experimental aitools <skill-cmd> as a hidden, deprecated alias that prints a warning pointing users at the new path
  • Keeps databricks experimental aitools tools (query, discover-schema, get-default-warehouse, statement) under experimental for now — that subtree's own help text says "There are no stability guarantees for these tools," so it shouldn't graduate yet
  • The deprecation warning fires for skills subcommands (which have a top-level replacement) but not for tools subcommands (which don't)

The aitools skills-management surface is feature-complete after the 5-PR series (#4810#4814) that added state tracking, lifecycle commands (install/update/uninstall/list/version), and project scope support. The tools subtree is functionally useful but its shape is still in flux, so promoting only the stable half.

Command shape after this PR

# Stable, top-level
databricks aitools install [skill-name]
databricks aitools update
databricks aitools uninstall
databricks aitools list
databricks aitools version
databricks aitools skills {list,install}        # hidden alias group

# Experimental, unchanged path
databricks experimental aitools tools query
databricks experimental aitools tools discover-schema
databricks experimental aitools tools get-default-warehouse
databricks experimental aitools tools statement {submit,get,status,cancel}

# Deprecated alias — warns and forwards
databricks experimental aitools install/update/uninstall/list/version/skills

Implementation note for reviewers: cobra picks the nearest ancestor's PersistentPreRunE, so attaching tools under the experimental alias with its own non-warning hook overrides the alias's deprecation warning for tools-rooted invocations. Both hooks chain to the root's PersistentPreRunE so IO/log/user-agent setup is preserved.

Test plan

  • databricks aitools --help shows install/update/uninstall/list/version (no tools)
  • databricks --help lists aitools in the output
  • databricks experimental aitools install prints deprecation warning, runs, and the work happens
  • databricks experimental aitools tools query … does NOT print the warning
  • databricks experimental aitools tools --help lists query/discover-schema/get-default-warehouse/statement
  • Existing aitools tests pass

This pull request was AI-assisted by Isaac.

The aitools command is feature-complete after the 5-PR series (#4810-#4814)
that added state tracking, install/update/uninstall/list/version commands,
and project scope support. Move it to a top-level `databricks aitools`
command so it is discoverable without knowing the `experimental` prefix.

The old `databricks experimental aitools` path is preserved as a hidden
deprecated alias for backward compatibility.

Co-authored-by: Isaac
jamesbroadhead and others added 2 commits April 8, 2026 14:40
Add the new top-level aitools entry to the expected help output.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

Approval status: pending

/cmd/apps/ - needs approval

Files: cmd/apps/init.go
Suggested: @pkosiec
Also eligible: @MarioCadenas, @arsenyinfo, @fjakobs, @keugenek, @calvarjorge, @Shridhad, @atilafassina, @igrekun, @pffigueiredo, @ditadi

/experimental/aitools/ - needs approval

Files: experimental/aitools/README.md, experimental/aitools/cmd/aitools.go
Suggested: @pkosiec
Also eligible: @MarioCadenas, @arsenyinfo, @fjakobs, @lennartkats-db, @keugenek, @calvarjorge, @Shridhad, @atilafassina, @igrekun, @pffigueiredo, @ditadi

General files (require maintainer)

59 files changed
Based on git history:

  • @simonfaltum -- recent work in ./, .github/, experimental/aitools/cmd/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

@simonfaltum
Copy link
Copy Markdown
Member

I think we should move the code itself (the files) out of experimental as part of this as well.

- cobra's Deprecated only fires on the executed leaf command, so running
  'databricks experimental aitools install' or any other subcommand under
  the alias produced no warning. Set a PersistentPreRunE on the alias
  root that prints to stderr; that hook is inherited by every subcommand.
- After promoting aitools to a top-level command, every user-facing tip
  ("Run 'databricks experimental aitools install' to get started", etc.)
  was steering people back to the deprecated path. Update version.go,
  installer.go, update.go, uninstall.go, recommend.go, the per-command
  Examples in discover_schema.go/query.go/get_default_warehouse.go, and
  the README to use the canonical 'databricks aitools' form. Update
  recommend_test.go and update_test.go assertions to match.

Co-authored-by: Isaac
The null-count SQL interpolated DESCRIBE-reported column names directly
into a backtick-quoted identifier. A column whose name contained a
backtick (rare in real catalogs but legal under Spark's identifier
syntax) could break out of the identifier and inject SQL when this
command was run against an attacker-controllable schema.

Extract the loop into buildNullCountExprs so it can be unit-tested,
double every backtick before interpolation per Spark's identifier-quote
escape rule, and add a regression test that covers plain, single-tick,
and double-tick column names.

Co-authored-by: Isaac
…blic

# Conflicts:
#	cmd/experimental/experimental.go
#	experimental/aitools/README.md
#	experimental/aitools/cmd/discover_schema.go
#	experimental/aitools/cmd/discover_schema_test.go
#	experimental/aitools/cmd/query.go
Per Simon's review on #4917, the source files should live outside
experimental/ now that aitools is a top-level command. Renames the
directory from experimental/aitools/ to aitools/ and updates all
import paths, examples, and tooling references (Makefile, OWNERS,
testmask, pr-checklist).

The experimental/aitools alias still routes to the same package via
its new import path, so 'databricks experimental aitools' continues
to work as a deprecated entry point.

Co-authored-by: Isaac
Defining PersistentPreRunE on the deprecated aitools alias shadowed
the root command's hook (cobra's default EnableTraverseRunHooks=false
walks up and stops at the first one). Subcommands of
'databricks experimental aitools' lost their cmdio/log/user-agent
init and panicked with "no cmdIO found in the context".

Chain to the root hook explicitly so the deprecation warning still
prints and the rest of CLI initialization runs.

Reproducer (before): 'databricks experimental aitools version' panics.
After: prints warning, then version output.

Co-authored-by: Isaac
…blic

# Conflicts:
#	.agent/skills/pr-checklist/SKILL.md
#	Makefile
#	tools/testmask/targets.go
The skills-management surface (install/update/uninstall/list/version/skills)
graduates to top-level `databricks aitools`. The `tools` subtree
(query/discover-schema/get-default-warehouse/statement) keeps its
"no stability guarantees" disclaimer per `tools.go`, so it stays under
`databricks experimental aitools tools` for now.

The deprecation warning under `experimental aitools` fires for the skills
surface (which has a top-level replacement) but NOT for `tools` subcommands
(no top-level alternative exists). Cobra picks the nearest ancestor's
PersistentPreRunE, so attaching tools with its own non-warning hook
overrides the alias's warning hook for tools-rooted invocations.

- aitools/cmd/aitools.go: drop tools wiring; export NewToolsCmd
- cmd/experimental/experimental.go: attach tools to alias with non-warning
  PreRunE that still chains to root
- aitools/cmd/{query,discover_schema,get_default_warehouse,statement_*}.go:
  revert example strings back to `experimental aitools tools …`
- aitools/README.md: split into stable (skills) and experimental (tools)
  sections
- NEXT_CHANGELOG.md: clarify which surface graduates

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants