Skip to content

aitools: emit Claude Code's native plugin install hint - #7585

Open
anton-107 wants to merge 1 commit into
mainfrom
aitools/claude-code-native-hint
Open

anton-107 wants to merge 1 commit into
mainfrom
aitools/claude-code-native-hint

Conversation

@anton-107

Copy link
Copy Markdown
Contributor

Summary

When Claude Code runs the CLI without the Databricks plugin or skills, the install hint now also prints Claude Code's native <claude-code-hint> line, which makes Claude Code offer a one-click install of databricks@claude-plugins-official.

 MaybeHint(ctx, cmd)                         # libs/aitools/agents/hint.go
   hint := hintForAgent(AgentProvider())     # only Claude Code has one
   skip: aitools commands
+  skip: `auth token`, `auth docker token`   # their stderr is embedded in other tools' errors
+  skip: DATABRICKS_CLI_SELF_EXEC set        # CLI started by the CLI (air images push, apps init)
   skip: no IO, hinted this session within 1h
-  skip: plugin, or skills in ~/.databricks/aitools/skills or legacy store
+  skip: Agent.DatabricksTooling != none     # only what Claude Code itself loads
+  if CLAUDE_CODE_CHILD_SESSION set and not CI and no stdin/stdout/stderr terminal
+    print <claude-code-hint .../>, log hint event CLAUDE_CODE_NATIVE
   print text hint, log hint event INSTALL_TEXT
   record session marker                     # throttles both lines together
  • cmdio.HasTerminal (any standard stream is a TTY) and cmdio.FakeTTYReader for tests.
  • agents.SelfExecEnv is set on the child processes of air images push (auth docker configure) and apps init (post-create deploy/dev runs).
  • Telemetry docs (protos/README.md, aitools_events.go): one aitools_hint_event per printed hint line.
  • Changelog fragment: .nextchanges/cli/claude-code-native-hint.md.

Evidence

Run at this head with the host's agent and CI env scrubbed.

  • Before (the native-print block in MaybeHint removed, tests unchanged):
    --- FAIL: TestMaybeHint_NativeHint (claude child session prints native then text, CI=false still prints native, ...)
    --- FAIL: TestMaybeHint_NativeHintThrottledPerSession
    --- FAIL: TestMaybeHint_LogsEventsOncePerSession
    --- FAIL: TestAccept/cmd/aitools/telemetry/hint
    --- FAIL: TestAccept/cmd/aitools/claude-config-dir
    
    After:
    ok  libs/aitools/agents, libs/cmdio, libs/telemetry/..., cmd/air
    ok  TestAccept/cmd/aitools/... (10 cases), TestAccept/air/image-push
    
  • TestAccept/air/image-push: inside a simulated Claude Code session, the auth docker configure child adds no hint to the parent's output or to its error text.
  • TestMaybeHint_NativeHint also covers: CI (CI=true, CI=<provider name>, TF_BUILD) prints the text only; plugin or Claude skills installed prints nothing; auth token, auth docker token, self-exec and aitools commands print nothing.
  • TestMaybeHint_NativeHintSilentOnTerminal: a terminal on stdin, stdout or stderr drops the native line.

Merge Danger

Door: two-way

Pure CLI output and telemetry change; reverting removes the line. No exit code changes and no extra network calls.

Blast Radius: small

  • New stderr line under Claude Code on the first eligible command per session per hour; a 2>&1 | jq pipeline in that command reads it raw. With the file cache disabled, both lines print on every eligible command.
  • Skills only in ~/.databricks/aitools/skills or ~/.databricks/agent-skills no longer silence the hint for Claude Code.
  • auth token, auth docker token and CLI-spawned CLI processes no longer print any install hint.
  • A new hint kind, CLAUDE_CODE_NATIVE, is logged.
  • Not tested on Windows or macOS.

This pull request and its description were written by Isaac.

@anton-107
anton-107 requested review from a team and lennartkats-db as code owners November 13, 2026 06:01
@anton-107
anton-107 requested review from misha-db and rauchy November 13, 2026 06:01
When Claude Code runs the CLI without the Databricks plugin or skills, the
install hint now also prints Claude Code's native `<claude-code-hint>` line
(https://code.claude.com/docs/en/plugins/cli-hints), which makes Claude Code
offer a one-click install of `databricks@claude-plugins-official`.

- The native line prints only when CLAUDE_CODE_CHILD_SESSION is set, outside
  CI, and when no standard stream is a terminal. It shares the text hint's
  per-session throttle and logs a CLAUDE_CODE_NATIVE hint event.
- Only tooling Claude Code itself loads (Agent.DatabricksTooling) silences the
  hint; skills only in the shared ~/.databricks stores no longer do.
- `auth token`, `auth docker token` and CLI processes started by the CLI
  (DATABRICKS_CLI_SELF_EXEC, set by `air images push` and `apps init`) print
  no install hint.
- `cmdio.HasTerminal` (any standard stream is a TTY) and `cmdio.FakeTTYReader`
  for tests.
- Telemetry docs: one `aitools_hint_event` per printed hint line.

Co-authored-by: Isaac <no-reply@databricks.com>
@anton-107
anton-107 force-pushed the aitools/claude-code-native-hint branch from 028eb23 to 07a831d Compare November 13, 2026 06:01
@github-actions github-actions Bot added the AIR Databricks AI Runtime CLI label Nov 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Commit: 07a831d8a | Workflow run

Regression test report

Selected 3 changed tests (limit=20, 0 not selected)

3 tests: regression=3 unreleased=0 coverage=0 failing=0
test branch main (eeb4ef9) latest (v1.26.0)
TestAccept/air/image-push ✅ ❌ ❌
TestAccept/cmd/aitools/claude-config-dir ✅ ❌ ❌
TestAccept/cmd/aitools/telemetry/hint ✅ ❌ ❌
TestAccept/air/image-push: branch ✅ | main (eeb4ef9) ❌ | latest (v1.26.0) ❌

main (eeb4ef9):

acceptance_test.go:1378: Diff:
        --- air/image-push/output.txt
        +++ /tmp/TestAcceptairimage-push1945862881/002/output.txt
        @@ -217,10 +217,10 @@
         === in a Claude Code session the auth docker configure child adds no install hint
         
         >>> databricks air images push -p docker-test -s example/image:v1 --catalog main --schema training
        -<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
         Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         Warning: This feature is in Preview. APIs may change, and the workspace must enable the Preview features.
         Pushing example/image:v1 as main.training.image:v1 using profile docker-test
        +Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         Configured Docker credential helper for [WORKSPACE_ID].container.us-west-2.localhost
         Updated Docker config: [TEST_TMP_DIR]/home/docker/config.json
         Installed Docker credential helper: [TEST_TMP_DIR]/home/bin/docker-credential-databricks
        @@ -232,8 +229,8 @@
         Now you can set `environment.unity_catalog_image = main.training.image:v1` in your YAML config and create a workload with `databricks air run -f config.yaml`.
         
         >>> musterr databricks air images push -p pat-test -s example/image:v1 --catalog main --schema training
        -<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
         Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         Warning: This feature is in Preview. APIs may change, and the workspace must enable the Preview features.
         Pushing example/image:v1 as main.training.image:v1 using profile pat-test
        -Error: configure Docker authentication: run auth docker configure: exit status 1: Error: profile "pat-test" uses auth_type "pat". Docker credential helper requires a profile created by databricks auth login
        +Error: configure Docker authentication: run auth docker configure: exit status 1: Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
        +Error: profile "pat-test" uses auth_type "pat". Docker credential helper requires a profile created by databricks auth login
        
FAIL

latest (v1.26.0): same output as main (eeb4ef9)

TestAccept/cmd/aitools/claude-config-dir: branch ✅ | main (eeb4ef9) ❌ | latest (v1.26.0) ❌

main (eeb4ef9):

acceptance_test.go:1378: Diff:
        --- cmd/aitools/claude-config-dir/output.txt
        +++ /tmp/TestAcceptcmdaitoolsclaude-config-dir972588294/002/output.txt
        @@ -7,7 +7,6 @@
         === Custom directory takes precedence over the default installation
         
         >>> CLAUDE_CONFIG_DIR=missing [CLI] version
        -<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
         Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         Databricks CLI v[CLI_VERSION]
         
        @@ -30,7 +29,6 @@
         === Within one session both lines print once, so 2>&1 pipelines see them only on the first command
         
         >>> [CLI] version
        -<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
         Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
         Databricks CLI v[CLI_VERSION]

latest (v1.26.0): same output as main (eeb4ef9)

TestAccept/cmd/aitools/telemetry/hint: branch ✅ | main (eeb4ef9) ❌ | latest (v1.26.0) ❌

main (eeb4ef9):

acceptance_test.go:1246: Substituted DATABRICKS_CLI_GITHUB_API_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43119" ("[DATABRICKS_HOST]")
    acceptance_test.go:1246: Substituted DATABRICKS_SKILLS_BASE_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43119" ("[DATABRICKS_HOST]")
    acceptance_test.go:1378: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1378
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1119
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:664
        	Error:      	Not equal: 
        	            	expected: "\n=== hint printed on an authenticated command: one hint-shown event per printed line is uploaded\n\n>>> [CLI] jobs list\n<claude-code-hint v=\"1\" type=\"plugin\" value=\"databricks@claude-plugins-official\" />\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\n\n>>> print_telemetry\n{\"command\":\"jobs_list\",\"exit_code\":0,\"aitools_hint_event\":{\"hint_kind\":\"CLAUDE_CODE_NATIVE\"}}\n{\"command\":\"jobs_list\",\"exit_code\":0,\"aitools_hint_event\":{\"hint_kind\":\"INSTALL_TEXT\"}}\n\n=== hint printed on a command that resolves no auth: nothing is uploaded\n\n>>> [CLI] version\n<claude-code-hint v=\"1\" type=\"plugin\" value=\"databricks@claude-plugins-official\" />\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\nDatabricks CLI v[CLI_VERSION]\n\n>>> print_telemetry\n\n=== plugin installed: no hint, no event\n\n>>> [CLI] jobs list\n\n>>> print_telemetry\n"
        	            	actual  : "\n=== hint printed on an authenticated command: one hint-shown event per printed line is uploaded\n\n>>> [CLI] jobs list\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\n\n>>> print_telemetry\n{\"command\":\"jobs_list\",\"exit_code\":0,\"aitools_hint_event\":{\"hint_kind\":\"INSTALL_TEXT\"}}\n\n=== hint printed on a command that resolves no auth: nothing is uploaded\n\n>>> [CLI] version\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\nDatabricks CLI v[CLI_VERSION]\n\n>>> print_telemetry\n\n=== plugin installed: no hint, no event\n\n>>> [CLI] jobs list\n\n>>> print_telemetry\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -4,3 +4,2 @@
        	            	 >>> [CLI] jobs list
        	            	-<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
        	            	 Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
        	            	@@ -8,3 +7,2 @@
        	            	 >>> print_telemetry
        	            	-{"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"CLAUDE_CODE_NATIVE"}}
        	            	 {"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"INSTALL_TEXT"}}
        	            	@@ -14,3 +12,2 @@
        	            	 >>> [CLI] version
        	            	-<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
        	            	 Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
        	Test:       	TestAccept/cmd/aitools/telemetry/hint
        	Messages:   	cmd/aitools/telemetry/hint/output.txt vs /tmp/TestAcceptcmdaitoolstelemetryhint3218873202/002/output.txt

latest (v1.26.0):

acceptance_test.go:1246: Substituted DATABRICKS_CLI_GITHUB_API_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43617" ("[DATABRICKS_HOST]")
    acceptance_test.go:1246: Substituted DATABRICKS_SKILLS_BASE_URL "$DATABRICKS_HOST" -> "http://127.0.0.1:43617" ("[DATABRICKS_HOST]")
    acceptance_test.go:1378: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1378
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1119
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:664
        	Error:      	Not equal: 
        	            	expected: "\n=== hint printed on an authenticated command: one hint-shown event per printed line is uploaded\n\n>>> [CLI] jobs list\n<claude-code-hint v=\"1\" type=\"plugin\" value=\"databricks@claude-plugins-official\" />\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\n\n>>> print_telemetry\n{\"command\":\"jobs_list\",\"exit_code\":0,\"aitools_hint_event\":{\"hint_kind\":\"CLAUDE_CODE_NATIVE\"}}\n{\"command\":\"jobs_list\",\"exit_code\":0,\"aitools_hint_event\":{\"hint_kind\":\"INSTALL_TEXT\"}}\n\n=== hint printed on a command that resolves no auth: nothing is uploaded\n\n>>> [CLI] version\n<claude-code-hint v=\"1\" type=\"plugin\" value=\"databricks@claude-plugins-official\" />\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\nDatabricks CLI v[CLI_VERSION]\n\n>>> print_telemetry\n\n=== plugin installed: no hint, no event\n\n>>> [CLI] jobs list\n\n>>> print_telemetry\n"
        	            	actual  : "\n=== hint printed on an authenticated command: one hint-shown event per printed line is uploaded\n\n>>> [CLI] jobs list\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\n\n>>> print_telemetry\n\n=== hint printed on a command that resolves no auth: nothing is uploaded\n\n>>> [CLI] version\nDatabricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install\nDatabricks CLI v[CLI_VERSION]\n\n>>> print_telemetry\n\n=== plugin installed: no hint, no event\n\n>>> [CLI] jobs list\n\n>>> print_telemetry\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -4,3 +4,2 @@
        	            	 >>> [CLI] jobs list
        	            	-<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
        	            	 Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
        	            	@@ -8,4 +7,2 @@
        	            	 >>> print_telemetry
        	            	-{"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"CLAUDE_CODE_NATIVE"}}
        	            	-{"command":"jobs_list","exit_code":0,"aitools_hint_event":{"hint_kind":"INSTALL_TEXT"}}
        	            	 
        	            	@@ -14,3 +11,2 @@
        	            	 >>> [CLI] version
        	            	-<claude-code-hint v="1" type="plugin" value="databricks@claude-plugins-official" />
        	            	 Databricks skills are not installed. To work with Databricks reliably, first run: databricks aitools install
        	Test:       	TestAccept/cmd/aitools/telemetry/hint
        	Messages:   	cmd/aitools/telemetry/hint/output.txt vs /tmp/TestAcceptcmdaitoolstelemetryhint2550114036/002/output.txt

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 07a831d

Run: 43376056070

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 18 5:52
💚​ aws-windows-latest-4core-16gb 1 272 16 3:45
💚​ azure linux-2core-8gb 1 269 18 5:16
💚​ azure-windows-latest-4core-16gb 1 271 16 4:25
💚​ gcp linux-2core-8gb 1 270 18 5:19
💚​ gcp-windows-latest-4core-16gb 1 272 16 5:26
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
5:17 gcp-windows-latest-4core-16gb TestAccept
4:20 azure-windows-latest-4core-16gb TestAccept
3:59 aws linux-2core-8gb TestAccept
3:58 azure linux-2core-8gb TestAccept
3:53 gcp linux-2core-8gb TestAccept
3:41 aws-windows-latest-4core-16gb TestAccept

@simonfaltum simonfaltum left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Automated review from simonfaltum's review agent (pr-review skill) at 07a831d. Each finding was verified against the code; simonfaltum may follow up.

No blocking issues found, approving. 10 non-blocking comment(s) and 3 question(s) below.

This PR prints Claude Code's native <claude-code-hint> line next to the existing text hint, bases Claude Code install detection on what Claude Code itself loads, and stops hinting in auth token, auth docker token and CLI processes started by the CLI. The tag format, stderr placement and CLAUDE_CODE_CHILD_SESSION gate match Claude Code's docs, the tests are thorough, and CI is green. I found nothing blocking. There are two nice-to-have points: a subagent or hook call can use up the session's throttle without ever showing the dialog, and apps init still treats shared-store skills as installed for Claude Code. There are also a few nits and three non-blocking questions about scope, the single-agent abstraction and the extra CI and terminal gates.

Questions

  1. This PR changes four things: the native hint; which installs count for Claude Code (shared-store skills no longer count, and project or local plugins count only inside their project); the auth token / auth docker token and self-exec exclusions; and the agentHint refactor. AGENTS.md asks for one change per PR. The exclusions look like a prerequisite for the native line, because Claude Code can't strip a tag embedded mid-line. Would you move the detection change, and possibly the refactor, into separate PRs, or do they need to land together? (non-blocking)
  2. agentHint, hintForAgent (a switch with one case), the nil check in nativeLine, the empty check in sessionID and TestAgentHint_NativeLineNilIsEmpty exist for agents that don't have a hint yet. AGENTS.md asks for simplicity and no speculative flexibility. Would you keep the direct Claude Code check plus a few lines for the native line, and add the table when a second agent needs it? (non-blocking)
  3. The cli-hints docs only ask for the CLAUDECODE / CLAUDE_CODE_CHILD_SESSION gate, and Claude Code itself never prompts in -p, subagent, hook or unattended runs. The CI and terminal checks add an 11-variable CI list to three acceptance scripts. If some Claude Code surface runs tools with a terminal on any stream, the native line silently never prints, and telemetry would not show it because it only counts printed lines. Was the dialog checked end to end in an attended session (the description notes Windows and macOS were not tested)? Are both checks needed? (non-blocking)

Comments outside the changed lines

  • [nit] libs/aitools/agents/hint_test.go:254: This test still writes some-other-skill into the shared store, which claudeToolingInstalled no longer reads, so it passes whatever the prefix filter does. Use writeClaudeSkill so it checks that a non-Databricks skill in ~/.claude/skills doesn't silence the hint.
  • [nit] .github/PULL_REQUEST_TEMPLATE.md: The description uses ## Summary, ## Evidence and ## Merge Danger. .agents/skills/pr-checklist/SKILL.md asks for the template's ## Changes, ## Why and ## Tests, in that order and with no extra sections, and recent merged PRs follow it. Suggest moving the content under those headings.

Comment on lines +180 to +186
if native := hint.nativeLine(ctx); native != "" {
cmdio.LogString(ctx, native)
logHintShown(ctx, hint.nativeKind)
}
cmdio.LogString(ctx, hint.text)
logHintShown(ctx, hint.textKind)
recordSessionHint(ctx, hint.sessionEnv)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] The session marker is written whenever the text line prints, including when the native line printed somewhere Claude Code never shows the dialog. A subagent's Bash calls carry the parent's CLAUDE_CODE_SESSION_ID and CLAUDE_CODE_CHILD_SESSION=1, and the cli-hints docs say subagent runs and hook output strip the tag without prompting. So when a subagent or a hook makes the session's first databricks call, the main loop's commands print neither line for the next hour, and a session shorter than an hour never sees the dialog. The same happens when the native line is withheld because a terminal is attached. Consider throttling the native line under its own key, and not writing that key when the line was withheld. A shorter TTL for the native line would also limit the subagent and hook case, since Claude Code already shows the dialog at most once per session.

Comment on lines +246 to +251
// claudeToolingInstalled reports whether Claude Code has Databricks AI tooling
// in its own locations (see Agent.DatabricksTooling): the databricks plugin, or
// databricks skills in Claude's skills dirs. Skills present only in the shared
// ~/.databricks/aitools/skills store don't count, because Claude Code doesn't
// load them from there. Any read/parse failure reports false, so an unreadable
// state errs toward hinting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] This comment now says Claude Code doesn't load skills from the shared ~/.databricks/aitools/skills store. But HasDatabricksToolingInstalled (skills.go:23-33), which apps init uses, still treats shared-store skills as covering every agent, Claude Code included. With skills only in the shared store, databricks apps init under Claude Code prints this hint ("Databricks skills are not installed…") from the root hook, while the command's own check reports the tooling as installed and skips its tip. A human running apps init with Claude Code detected is never offered the install either. Either switch HasDatabricksToolingInstalled to per-agent DatabricksTooling, or say in both comments why they differ. A follow-up PR is fine.

Comment on lines +261 to 264
tooling := claude.DatabricksTooling(ctx, func() bool { return false })
if tooling == ToolingPlugin {
version, _ := claude.DatabricksPluginVersion(ctx)
log.Debugf(ctx, "Databricks plugin detected for Claude Code (version %q); skipping install hint", version)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] WithCallingAgentToolingInUserAgent (cmd/root/root.go:88) already computes DatabricksTooling for Claude Code right before MaybeHint. On the plugin path, DatabricksPluginVersion then parses installed_plugins.json a third time just for a debug log, and because the throttle is never written once the plugin is installed, this runs on every command. Also, func() bool { return false } duplicates noRecordedPlugin in recommend.go:45, and the Go style guide asks for a named function. Suggest dropping the version from the debug line and adding a package-level noRecordedPlugin for both callers.

export CLAUDE_CODE_CHILD_SESSION=1
unset CLAUDE_CODE_SESSION_ID
# CI and the CI/CD provider markers the SDK detects (GitHub Actions sets both).
unset CI GITHUB_ACTIONS GITLAB_CI JENKINS_URL TF_BUILD CIRCLECI TRAVIS BITBUCKET_BUILD_NUMBER PROJECT_ID CODEBUILD_BUILD_ARN TFC_RUN_ID

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] The same unset CI GITHUB_ACTIONS … TFC_RUN_ID line, which mirrors the SDK's CI provider list, appears here, in telemetry/hint/script:7 and in air/image-push/script:69, and again as hintEnvVars in hint_test.go. If the SDK adds a provider, the native line disappears only when tests run on that provider's CI, and four copies need updating. .agents/rules/testing.md says shared bash helpers go in a parent script.prepare, and an unset_ci_env helper there would keep a single copy.

Comment on lines +48 to +57
// in parallel (see testutil.SetAgentEnv). The first t.TempDir call runs before
// SetAgentEnv clears TMPDIR / TEMP, so later calls in the test still work.
// It also moves into an empty project with its own .git boundary, so project
// skills in the checkout running the tests are not detected.
func setClaudeAgent(t *testing.T) {
cwd := t.TempDir()
require.NoError(t, os.Mkdir(filepath.Join(cwd, ".git"), 0o755))
t.Chdir(cwd)
testutil.SetAgentEnv(t, "CLAUDECODE", "1")
unsetEnv(t, hintEnvVars)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] testutil.SetAgentEnv already clears the environment (NullEnvironment → os.Clearenv) and keeps TMPDIR, TEMP and TMP. So unsetEnv(t, hintEnvVars) right after it, here and at line 467, does nothing, and the sentence saying SetAgentEnv clears TMPDIR/TEMP is wrong. Suggest dropping those two calls and that sentence. hintEnvVars is then needed only in TestClaudeToolingInstalled_LogsPluginVersion, where only CLAUDE_CONFIG_DIR matters.

Comment on lines +259 to +261
// Claude Code's own manifest decides, so the CLI's install record is never
// consulted for it.
tooling := claude.DatabricksTooling(ctx, func() bool { return false })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Plugin records with project or local scope now count only when the CLI's working directory is inside the recorded project. Claude Code loads them from the directory it started in, which the CLI can't see. So a session started in ~/repo with a project-scoped plugin that runs cd /tmp/scratch && databricks jobs list is now told "Databricks skills are not installed". Before this PR, any plugin record kept the hint quiet. The description and the changelog mention the shared-store change but not this one. Please add it there, or keep counting project and local records if a false hint is worse than a missed one.

// TF_BUILD, which doesn't set CI).
func inCI(ctx context.Context) bool {
if v := env.Get(ctx, ciEnv); v != "" {
if b, err := strconv.ParseBool(v); err != nil || b {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] strconv.ParseBool fails on no and off, so CI=no or CI=off counts as CI here and the native line is dropped. libs/versioncheck reads the same variable with env.GetBool, which treats those values as false. Treat no and off as false too, by checking them before the ParseBool fallback.

@@ -0,0 +1 @@
* When Claude Code runs the CLI without the Databricks plugin or skills, the CLI now also prints Claude Code's native `<claude-code-hint>` line, at most once per hour per Claude Code session together with the text hint, so Claude Code offers a one-click install of the Databricks plugin. Skills stored only in `~/.databricks/aitools/skills` or the legacy `~/.databricks/agent-skills` no longer count as installed for Claude Code, and `databricks auth token`, `databricks auth docker token` and the CLI commands that `databricks air images push` and `databricks apps init` run as subprocesses no longer print install hints. ([#7585](https://github.com/databricks/cli/pull/7585))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] .agents/skills/pr-checklist/SKILL.md asks for entries that start with a verb, or with the affected command followed by "now". This one opens with a "When…" clause. At 678 characters it is also the longest fragment in .nextchanges/cli and puts four changes in one line. Suggest leading with the change, e.g. "Print Claude Code's native plugin install hint when…", and keeping the detection and auth token notes short.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIR Databricks AI Runtime CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants