cowork-cli 2.0.1 → 2.1.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cowork-cli",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "work with cowork",
5
5
  "bin": {
6
6
  "cwk": "bin/cli.js"
package/src/main.js CHANGED
@@ -15,8 +15,20 @@ const PKG_PATH = path.join(__dirname, '../package.json');
15
15
  * @param {string[]} args Command line arguments.
16
16
  */
17
17
  export default async function main(args) {
18
+ let pipedData = '';
19
+ if (!process.stdin.isTTY) {
20
+ try {
21
+ for await (const chunk of process.stdin) {
22
+ pipedData += chunk;
23
+ }
24
+ pipedData = pipedData.trim();
25
+ } catch (err) {
26
+ logger.error(`Error reading from stdin: ${err.message}`);
27
+ }
28
+ }
29
+
18
30
  // Handle empty arguments or help flags
19
- if (args.length === 0 || args[0] === '-h' || args[0] === '--help') {
31
+ if ((args.length === 0 && !pipedData) || args[0] === '-h' || args[0] === '--help') {
20
32
  show_help();
21
33
  return;
22
34
  }
@@ -33,7 +45,12 @@ export default async function main(args) {
33
45
  }
34
46
 
35
47
  // Handle query execution
36
- const query = args[0];
48
+ let query = args.join(' ').trim();
49
+ if (pipedData) {
50
+ query = query
51
+ ? `${query}\n\n[Piped Input]:\n${pipedData}`
52
+ : `Analyze the following data:\n\n[Piped Input]:\n${pipedData}`;
53
+ }
37
54
  const config = loadConfig();
38
55
 
39
56
  // clientLoader handles config validation and throws if invalid