Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions Releases/v4.0.3/.claude/PAI/Tools/pai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ function cmdWallpaper(args: string[]) {
// Commands
// ============================================================================

async function cmdLaunch(options: { mcp?: string; resume?: boolean; skipPerms?: boolean; local?: boolean }) {
async function cmdLaunch(options: { mcp?: string; resume?: boolean; skipPerms?: boolean; local?: boolean; passthrough?: string[] }) {
// CLAUDE.md is now static — no build step needed.
// Algorithm spec is loaded on-demand when Algorithm mode triggers.
// (InstantiatePAI.ts is retired — kept for reference only)
Expand All @@ -412,6 +412,11 @@ async function cmdLaunch(options: { mcp?: string; resume?: boolean; skipPerms?:
args.push("--resume");
}

// Pass through any unrecognized flags to claude
if (options.passthrough?.length) {
args.push(...options.passthrough);
}

// Change to PAI directory unless --local flag is set
if (!options.local) {
process.chdir(CLAUDE_DIR);
Expand Down Expand Up @@ -636,6 +641,7 @@ async function main() {
let subArg: string | undefined;
let promptText: string | undefined;
let wallpaperArgs: string[] = [];
let passthrough: string[] = [];

for (let i = 0; i < args.length; i++) {
const arg = args[i];
Expand Down Expand Up @@ -697,8 +703,14 @@ async function main() {
i = args.length; // Exit loop
break;
default:
if (!arg.startsWith("-")) {
// Might be an unknown command
if (arg.startsWith("-")) {
// Pass through unknown flags to claude (e.g., --plugin-dir, --mcp-config)
passthrough.push(arg);
// If the next arg doesn't start with -, it's the flag's value
if (i + 1 < args.length && !args[i + 1].startsWith("-")) {
passthrough.push(args[++i]);
}
} else {
error(`Unknown command: ${arg}. Use 'k help' for usage.`);
}
}
Expand Down Expand Up @@ -738,7 +750,7 @@ async function main() {
break;
default:
// Launch with options
await cmdLaunch({ mcp, resume, skipPerms, local });
await cmdLaunch({ mcp, resume, skipPerms, local, passthrough });
}
}

Expand Down