fix(coding-agent): passed commands settings to slash command discovery

commands.enableClaudeUser and commands.enableClaudeProject settings
were not being used - fixed by passing settingsManager.getCommandsSettings()
to discoverSlashCommands in createAgentSession.
This commit is contained in:
can1357
2026-01-03 04:49:05 +01:00
parent a099076a99
commit 83809771d9
2 changed files with 13 additions and 6 deletions
+3 -3
View File
@@ -3,9 +3,9 @@
## [Unreleased]
### Added
- Added support for custom TypeScript slash commands loaded from `~/.pi/commands/` and `.pi/commands/` directories
- Added support for loading markdown slash commands from Claude's `~/.claude/commands/` and `.claude/commands/` directories
- Added `commands.enableClaudeUser` and `commands.enableClaudeProject` settings to control Claude command directory loading
- Custom TypeScript slash commands: Create programmable commands at `~/.pi/agent/commands/[name]/index.ts` or `.pi/commands/[name]/index.ts`. Commands export a factory returning `{ name, description, execute(args, ctx) }`. Return a string to send as LLM prompt, or void for fire-and-forget actions. Full access to `HookCommandContext` for UI dialogs, session control, and shell execution.
- Claude command directories: Markdown slash commands now also load from `~/.claude/commands/` and `.claude/commands/` (parallel to existing `.pi/commands/` support)
- `commands.enableClaudeUser` and `commands.enableClaudeProject` settings to disable Claude command directory loading
- `/export --copy` option to copy entire session as formatted text to clipboard
## [1.341.0] - 2026-01-03
+10 -3
View File
@@ -52,7 +52,7 @@ import { discoverAndLoadMCPTools, type MCPManager, type MCPToolsLoadResult } fro
import { convertToLlm } from "./messages.js";
import { ModelRegistry } from "./model-registry.js";
import { SessionManager } from "./session-manager.js";
import { type Settings, SettingsManager, type SkillsSettings } from "./settings-manager.js";
import { type CommandsSettings, type Settings, SettingsManager, type SkillsSettings } from "./settings-manager.js";
import { loadSkills as loadSkillsInternal, type Skill } from "./skills.js";
import { type FileSlashCommand, loadSlashCommands as loadSlashCommandsInternal } from "./slash-commands.js";
import {
@@ -283,10 +283,16 @@ export function discoverContextFiles(cwd?: string, agentDir?: string): Array<{ p
/**
* Discover slash commands from cwd and agentDir.
*/
export function discoverSlashCommands(cwd?: string, agentDir?: string): FileSlashCommand[] {
export function discoverSlashCommands(
cwd?: string,
agentDir?: string,
settings?: CommandsSettings,
): FileSlashCommand[] {
return loadSlashCommandsInternal({
cwd: cwd ?? process.cwd(),
agentDir: agentDir ?? getDefaultAgentDir(),
enableClaudeUser: settings?.enableClaudeUser,
enableClaudeProject: settings?.enableClaudeProject,
});
}
@@ -748,7 +754,8 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
systemPrompt = options.systemPrompt(defaultPrompt);
}
const slashCommands = options.slashCommands ?? discoverSlashCommands(cwd, agentDir);
const commandsSettings = settingsManager.getCommandsSettings();
const slashCommands = options.slashCommands ?? discoverSlashCommands(cwd, agentDir, commandsSettings);
time("discoverSlashCommands");
// Discover custom commands (TypeScript slash commands)