Skip to content

Commit 31e27b2

Browse files
fix: pass project path to skills and agents queries (#132)
Skills and agents from project-level .claude/ folders were not showing up in the settings tab or @ mention dropdown because the frontend was not passing the project path (cwd) to the backend tRPC queries. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 68e81e3 commit 31e27b2

3 files changed

Lines changed: 26 additions & 10 deletions

File tree

src/renderer/components/dialogs/settings-tabs/agents-custom-agents-tab.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useState, useEffect } from "react"
2+
import { useAtomValue } from "jotai"
23
import { ChevronRight } from "lucide-react"
34
import { motion, AnimatePresence } from "motion/react"
5+
import { selectedProjectAtom } from "../../../features/agents/atoms"
46
import { trpc } from "../../../lib/trpc"
57
import { cn } from "../../../lib/utils"
68
import { AgentIcon } from "../../ui/icons"
@@ -36,8 +38,11 @@ interface FileAgent {
3638
export function AgentsCustomAgentsTab() {
3739
const isNarrowScreen = useIsNarrowScreen()
3840
const [expandedAgentName, setExpandedAgentName] = useState<string | null>(null)
41+
const selectedProject = useAtomValue(selectedProjectAtom)
3942

40-
const { data: agents = [], isLoading } = trpc.agents.list.useQuery(undefined)
43+
const { data: agents = [], isLoading } = trpc.agents.list.useQuery(
44+
selectedProject?.path ? { cwd: selectedProject.path } : undefined,
45+
)
4146

4247
const openInFinderMutation = trpc.external.openInFinder.useMutation()
4348

src/renderer/components/dialogs/settings-tabs/agents-skills-tab.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useState, useEffect } from "react"
2+
import { useAtomValue } from "jotai"
23
import { ChevronRight } from "lucide-react"
34
import { motion, AnimatePresence } from "motion/react"
5+
import { selectedProjectAtom } from "../../../features/agents/atoms"
46
import { trpc } from "../../../lib/trpc"
57
import { cn } from "../../../lib/utils"
68
import { SkillIcon } from "../../ui/icons"
@@ -25,8 +27,11 @@ function useIsNarrowScreen(): boolean {
2527
export function AgentsSkillsTab() {
2628
const isNarrowScreen = useIsNarrowScreen()
2729
const [expandedSkillName, setExpandedSkillName] = useState<string | null>(null)
30+
const selectedProject = useAtomValue(selectedProjectAtom)
2831

29-
const { data: skills = [], isLoading } = trpc.skills.list.useQuery(undefined)
32+
const { data: skills = [], isLoading } = trpc.skills.list.useQuery(
33+
selectedProject?.path ? { cwd: selectedProject.path } : undefined,
34+
)
3035
const openInFinderMutation = trpc.external.openInFinder.useMutation()
3136

3237
const userSkills = skills.filter((s) => s.source === "user")

src/renderer/features/agents/mentions/agents-file-mention.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -695,16 +695,22 @@ export const AgentsFileMention = memo(function AgentsFileMention({
695695
const sessionInfo = useAtomValue(sessionInfoAtom)
696696

697697
// Fetch skills from filesystem (cached for 5 minutes)
698-
const { data: skills = [], isFetching: isFetchingSkills } = trpc.skills.listEnabled.useQuery(undefined, {
699-
enabled: isOpen,
700-
staleTime: 5 * 60 * 1000, // 5 minutes - skills don't change frequently
701-
})
698+
const { data: skills = [], isFetching: isFetchingSkills } = trpc.skills.listEnabled.useQuery(
699+
projectPath ? { cwd: projectPath } : undefined,
700+
{
701+
enabled: isOpen,
702+
staleTime: 5 * 60 * 1000, // 5 minutes - skills don't change frequently
703+
},
704+
)
702705

703706
// Fetch custom agents from filesystem (cached for 5 minutes)
704-
const { data: customAgents = [], isFetching: isFetchingAgents } = trpc.agents.listEnabled.useQuery(undefined, {
705-
enabled: isOpen,
706-
staleTime: 5 * 60 * 1000, // 5 minutes - agents don't change frequently
707-
})
707+
const { data: customAgents = [], isFetching: isFetchingAgents } = trpc.agents.listEnabled.useQuery(
708+
projectPath ? { cwd: projectPath } : undefined,
709+
{
710+
enabled: isOpen,
711+
staleTime: 5 * 60 * 1000, // 5 minutes - agents don't change frequently
712+
},
713+
)
708714

709715
// Debounce search text (300ms to match canvas implementation)
710716
useEffect(() => {

0 commit comments

Comments
 (0)