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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user