claude-code-workflow 6.1.0 → 6.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,44 +66,13 @@ async function schemaAction(options) {
66
66
  }
67
67
  }
68
68
 
69
- /**
70
- * Read from stdin if available
71
- */
72
- async function readStdin() {
73
- // Check if stdin is a TTY (interactive terminal)
74
- if (process.stdin.isTTY) {
75
- return null;
76
- }
77
-
78
- return new Promise((resolve, reject) => {
79
- let data = '';
80
-
81
- process.stdin.setEncoding('utf8');
82
-
83
- process.stdin.on('readable', () => {
84
- let chunk;
85
- while ((chunk = process.stdin.read()) !== null) {
86
- data += chunk;
87
- }
88
- });
89
-
90
- process.stdin.on('end', () => {
91
- resolve(data.trim() || null);
92
- });
93
-
94
- process.stdin.on('error', (err) => {
95
- reject(err);
96
- });
97
- });
98
- }
99
-
100
69
  /**
101
70
  * Execute a tool with given parameters
102
71
  */
103
- async function execAction(toolName, jsonInput, options) {
72
+ async function execAction(toolName, options) {
104
73
  if (!toolName) {
105
74
  console.error(chalk.red('Tool name is required'));
106
- console.error(chalk.gray('Usage: ccw tool exec <tool-name> \'{"param": "value"}\''));
75
+ console.error(chalk.gray('Usage: ccw tool exec edit_file --path file.txt --old "old" --new "new"'));
107
76
  process.exit(1);
108
77
  }
109
78
 
@@ -114,34 +83,22 @@ async function execAction(toolName, jsonInput, options) {
114
83
  process.exit(1);
115
84
  }
116
85
 
117
- // Parse JSON input (default format)
118
- let params = {};
86
+ // Build params from CLI options
87
+ const params = {};
119
88
 
120
- if (jsonInput) {
121
- try {
122
- params = JSON.parse(jsonInput);
123
- } catch (error) {
124
- console.error(chalk.red(`Invalid JSON: ${error.message}`));
89
+ if (toolName === 'edit_file') {
90
+ if (!options.path || !options.old || !options.new) {
91
+ console.error(chalk.red('edit_file requires --path, --old, and --new parameters'));
92
+ console.error(chalk.gray('Usage: ccw tool exec edit_file --path file.txt --old "old text" --new "new text"'));
125
93
  process.exit(1);
126
94
  }
127
- }
128
-
129
- // Check for stdin input (for piped commands)
130
- const stdinData = await readStdin();
131
- if (stdinData) {
132
- // If tool has an 'input' parameter, use it
133
- // Otherwise, try to parse stdin as JSON and merge with params
134
- if (tool.parameters?.properties?.input) {
135
- params.input = stdinData;
136
- } else {
137
- try {
138
- const stdinJson = JSON.parse(stdinData);
139
- params = { ...stdinJson, ...params };
140
- } catch {
141
- // If not JSON, store as 'input' anyway
142
- params.input = stdinData;
143
- }
144
- }
95
+ params.path = options.path;
96
+ params.oldText = options.old;
97
+ params.newText = options.new;
98
+ } else {
99
+ console.error(chalk.red(`Tool "${toolName}" is not supported via CLI parameters`));
100
+ console.error(chalk.gray('Currently only edit_file is supported'));
101
+ process.exit(1);
145
102
  }
146
103
 
147
104
  // Execute tool
@@ -164,7 +121,7 @@ export async function toolCommand(subcommand, args, options) {
164
121
  await schemaAction({ name: args });
165
122
  break;
166
123
  case 'exec':
167
- await execAction(args, options.json, options);
124
+ await execAction(args, options);
168
125
  break;
169
126
  default:
170
127
  console.log(chalk.bold.cyan('\nCCW Tool System\n'));
@@ -173,9 +130,9 @@ export async function toolCommand(subcommand, args, options) {
173
130
  console.log(chalk.gray(' schema [name] Show tool schema (JSON)'));
174
131
  console.log(chalk.gray(' exec <name> Execute a tool'));
175
132
  console.log();
176
- console.log('Examples:');
133
+ console.log('Usage:');
177
134
  console.log(chalk.gray(' ccw tool list'));
178
135
  console.log(chalk.gray(' ccw tool schema edit_file'));
179
- console.log(chalk.gray(' ccw tool exec edit_file \'{"path":"file.txt","oldText":"old","newText":"new"}\''));
136
+ console.log(chalk.gray(' ccw tool exec edit_file --path file.txt --old "old text" --new "new text"'));
180
137
  }
181
138
  }