diff --git a/libs/aitools/agents/hint_test.go b/libs/aitools/agents/hint_test.go index b2b70d72ff4..9d0971e17df 100644 --- a/libs/aitools/agents/hint_test.go +++ b/libs/aitools/agents/hint_test.go @@ -601,3 +601,40 @@ func TestMaybeHint_InstalledLogsNothing(t *testing.T) { MaybeHint(ctx, regularCmd(), noPluginRecorded) assert.Empty(t, telemetry.BufferedEvents(ctx)) } + +// writeProjectSkill creates a project-scoped Claude skill symlink. +func writeProjectSkill(t *testing.T, project, name string) { + canonical := filepath.Join(project, ".databricks", "aitools", "skills", name) + require.NoError(t, os.MkdirAll(canonical, 0o755)) + link := filepath.Join(project, ".claude", "skills", name) + require.NoError(t, os.MkdirAll(filepath.Dir(link), 0o755)) + rel, err := filepath.Rel(filepath.Dir(link), canonical) + require.NoError(t, err) + require.NoError(t, os.Symlink(rel, link)) +} + +func TestMaybeHint_ProjectSkillsInstalledSilent(t *testing.T) { + for _, tc := range []struct { + name string + // subdir is where the command runs, relative to the project root. + subdir string + }{ + {name: "project root"}, + {name: "repo subdirectory", subdir: "train"}, + } { + t.Run(tc.name, func(t *testing.T) { + setClaudeAgent(t) + home := t.TempDir() + ctx, stderr := claudeCtx(t, home) + project := t.TempDir() + require.NoError(t, os.Mkdir(filepath.Join(project, ".git"), 0o755)) + writeProjectSkill(t, project, "databricks-ai-runtime") + cwd := filepath.Join(project, tc.subdir) + require.NoError(t, os.MkdirAll(cwd, 0o755)) + t.Chdir(cwd) + + MaybeHint(ctx, regularCmd(), noPluginRecorded) + assert.Empty(t, stderr.String()) + }) + } +}