fix(project): use directory param instead of process.cwd() for agents, commands, and slash commands

Extends the process.cwd() fix to cover all project-level loaders. In the desktop app, process.cwd() points to the app installation directory instead of the project directory, causing project-level agents, commands, and slash commands to not be discovered. Each function now accepts an optional directory parameter (defaulting to process.cwd() for backward compatibility) and callers pass ctx.directory from the plugin context.
This commit is contained in:
Willy
2026-02-13 11:09:35 +08:00
parent 6914f2fd04
commit f9ea9a4ee9
6 changed files with 18 additions and 18 deletions

View File

@@ -84,7 +84,7 @@ export async function applyAgentConfig(params: {
const includeClaudeAgents = params.pluginConfig.claude_code?.agents ?? true;
const userAgents = includeClaudeAgents ? loadUserAgents() : {};
const projectAgents = includeClaudeAgents ? loadProjectAgents() : {};
const projectAgents = includeClaudeAgents ? loadProjectAgents(params.ctx.directory) : {};
const rawPluginAgents = params.pluginComponents.agents;
const pluginAgents = Object.fromEntries(