feat: cw task add CLI command + {AGENT_ID} prompt placeholder
- Add `createTaskForAgent` tRPC mutation: resolves agent → task → phase, creates sibling task
- Add `cw task add <name> --agent-id <id>` CLI command
- Replace `{AGENT_ID}` and `{AGENT_NAME}` placeholders in writeInputFiles() before flushing
- Update docs/agent.md and docs/cli-config.md
This commit is contained in:
@@ -282,6 +282,17 @@ export async function writeInputFiles(options: WriteInputFilesOptions): Promise<
|
||||
});
|
||||
}
|
||||
|
||||
// Replace agent placeholders in all content before writing
|
||||
const placeholders: Record<string, string> = {
|
||||
'{AGENT_ID}': options.agentId ?? '',
|
||||
'{AGENT_NAME}': options.agentName ?? '',
|
||||
};
|
||||
for (const w of writes) {
|
||||
for (const [token, value] of Object.entries(placeholders)) {
|
||||
w.content = w.content.replaceAll(token, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Flush all file writes in parallel — yields the event loop between I/O ops
|
||||
await Promise.all(writes.map(w => writeFile(w.path, w.content, 'utf-8')));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user