- Renamed CLI binary and package from 'pi' to 'omp' across all platforms and installers. - Changed environment variable prefix from PI_* to OMP_* with automatic migration support. - Changed configuration directory from ~/.pi/ to ~/.omp/ with multi-path fallback discovery. - Added getConfigDirPaths(), findConfigFile(), and readConfigFile() functions for config resolution across .omp, .pi, and .claude directories.
43 lines
1023 B
TypeScript
43 lines
1023 B
TypeScript
/**
|
|
* Slash Commands
|
|
*
|
|
* File-based commands that inject content when invoked with /commandname.
|
|
*/
|
|
|
|
import {
|
|
createAgentSession,
|
|
discoverSlashCommands,
|
|
type FileSlashCommand,
|
|
SessionManager,
|
|
} from "@oh-my-pi/pi-coding-agent";
|
|
|
|
// Discover commands from cwd/.omp/commands/ and ~/.omp/agent/commands/
|
|
const discovered = discoverSlashCommands();
|
|
console.log("Discovered slash commands:");
|
|
for (const cmd of discovered) {
|
|
console.log(` /${cmd.name}: ${cmd.description}`);
|
|
}
|
|
|
|
// Define custom commands
|
|
const deployCommand: FileSlashCommand = {
|
|
name: "deploy",
|
|
description: "Deploy the application",
|
|
source: "(custom)",
|
|
content: `# Deploy Instructions
|
|
|
|
1. Build: npm run build
|
|
2. Test: npm test
|
|
3. Deploy: npm run deploy`,
|
|
};
|
|
|
|
// Use discovered + custom commands
|
|
await createAgentSession({
|
|
slashCommands: [...discovered, deployCommand],
|
|
sessionManager: SessionManager.inMemory(),
|
|
});
|
|
|
|
console.log(`Session created with ${discovered.length + 1} slash commands`);
|
|
|
|
// Disable slash commands:
|
|
// slashCommands: []
|