mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-26 19:56:37 +08:00
feat: Add --to-file option to ccw cli for saving output to files
Adds support for saving CLI execution output directly to files with the following features: - Support for relative paths: --to-file output.txt - Support for nested directories: --to-file results/analysis/output.txt (auto-creates directories) - Support for absolute paths: --to-file /tmp/output.txt or --to-file D:/results/output.txt - Works in both streaming and non-streaming modes - Automatically creates parent directories if they don't exist - Proper error handling with user-friendly messages - Shows file save location in completion feedback Implementation details: - Updated CLI option parser in ccw/src/cli.ts - Added toFile parameter to CliExecOptions interface - Implemented file saving logic in execAction() for both streaming and non-streaming modes - Updated HTTP API endpoint /api/cli/execute to support toFile parameter - All changes are backward compatible Testing: - Tested with relative paths (single and nested directories) - Tested with absolute paths (Windows and Unix style) - Tested with streaming mode - All tests passed successfully
This commit is contained in:
@@ -209,6 +209,7 @@ export function run(argv: string[]): void {
|
||||
.option('--turn <n>', 'Turn number for cache (default: latest)')
|
||||
.option('--raw', 'Raw output only (no formatting)')
|
||||
.option('--final', 'Output final result only with usage hint')
|
||||
.option('--to-file <path>', 'Save output to file')
|
||||
.action((subcommand, args, options) => cliCommand(subcommand, args, options));
|
||||
|
||||
// Memory command
|
||||
|
||||
Reference in New Issue
Block a user