mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
- Add cleanup-ghost-commands.mjs script - Refresh ccw-help index files (remove stale entries) - CLI session manager: add instruction assembler and launch registry - Frontend: orchestrator plan builder, property panel, dashboard toolbar updates - Flow executor and type updates - Minor fixes across multiple skills and commands
38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
// ========================================
|
|
// CLI Instruction Assembler
|
|
// ========================================
|
|
// Assembles the final sendText string based on CLI type and instruction type.
|
|
|
|
export type InstructionType = 'prompt' | 'skill' | 'command';
|
|
|
|
/**
|
|
* Assemble the text to send to a CLI interactive session.
|
|
*
|
|
* - prompt → raw content text
|
|
* - skill → CLI-specific skill prefix (claude: /, codex: $, others: fallback to prompt)
|
|
* - command → raw content text (CLI native command)
|
|
*/
|
|
export function assembleInstruction(
|
|
cliTool: string,
|
|
instructionType: InstructionType,
|
|
content: string,
|
|
skillName?: string,
|
|
): string {
|
|
if (instructionType === 'prompt' || instructionType === 'command') {
|
|
return content;
|
|
}
|
|
|
|
// instructionType === 'skill'
|
|
const name = skillName ?? '';
|
|
|
|
switch (cliTool) {
|
|
case 'claude':
|
|
return `/${name} ${content}`;
|
|
case 'codex':
|
|
return `$${name} ${content}`;
|
|
default:
|
|
// Other CLIs don't support skill syntax — fallback to plain prompt
|
|
return content;
|
|
}
|
|
}
|