crewx 0.9.0-rc.13 → 0.9.0-rc.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crewx",
3
- "version": "0.9.0-rc.13",
3
+ "version": "0.9.0-rc.14",
4
4
  "description": "CrewX — AI agent team dashboard with Electron UI and CLI (Web + Electron + Global CLI)",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -81,19 +81,19 @@
81
81
  "yargs": "17.7.0",
82
82
  "zod": "3.25.76",
83
83
  "@crewx/chromex": "0.1.0",
84
- "@crewx/cli": "0.9.0-rc.13",
84
+ "@crewx/cli": "0.9.0-rc.14",
85
85
  "@crewx/cron": "0.1.10",
86
86
  "@crewx/doc": "0.1.9",
87
87
  "@crewx/dreaming": "0.1.0",
88
- "@crewx/sdk": "0.9.0-rc.13",
89
- "@crewx/shared": "0.0.6",
90
- "@crewx/memory": "0.1.23",
91
88
  "@crewx/knowledge-core": "0.1.17",
89
+ "@crewx/memory": "0.1.23",
90
+ "@crewx/search": "0.1.10",
91
+ "@crewx/shared": "0.0.6",
92
+ "@crewx/sdk": "0.9.0-rc.14",
93
+ "@crewx/wbs": "0.1.10",
92
94
  "@crewx/skill": "0.1.20",
93
95
  "@crewx/wi": "0.1.10",
94
- "@crewx/search": "0.1.10",
95
- "@crewx/workflow": "0.3.22-rc.59",
96
- "@crewx/wbs": "0.1.10"
96
+ "@crewx/workflow": "0.3.22-rc.60"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@ccusage/codex": "0.0.1",
@@ -27,6 +27,7 @@ const parse_common_flags_1 = require("./parse-common-flags");
27
27
  const resolve_prompt_1 = require("./resolve-prompt");
28
28
  const crewx_cli_1 = require("../bootstrap/crewx-cli");
29
29
  const inherited_trace_1 = require("../utils/inherited-trace");
30
+ const write_output_1 = require("./write-output");
30
31
  /**
31
32
  * Handle `crewx execute <agentRef> <message>` command.
32
33
  *
@@ -34,7 +35,7 @@ const inherited_trace_1 = require("../utils/inherited-trace");
34
35
  * --verbose: debug info written to stderr, response to stdout.
35
36
  */
36
37
  async function handleExecute(args) {
37
- const { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, rest } = (0, parse_common_flags_1.parseCommonFlags)(args);
38
+ const { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, out, rest } = (0, parse_common_flags_1.parseCommonFlags)(args);
38
39
  const { agentRef: parsedAgentRef, message } = (0, parse_agent_message_1.parseAgentMessage)(rest);
39
40
  // No @mention → default to @crewx agent (matches cli-bak behaviour)
40
41
  const agentRef = parsedAgentRef || '@crewx';
@@ -111,6 +112,7 @@ async function handleExecute(args) {
111
112
  if (!result.ok) {
112
113
  const errMsg = result.error?.message ?? 'Execute failed';
113
114
  console.error(errMsg);
115
+ (0, write_output_1.appendError)(out, errMsg);
114
116
  exitCode = 1;
115
117
  }
116
118
  else {
@@ -123,7 +125,7 @@ async function handleExecute(args) {
123
125
  process.stderr.write('\n📄 Response:\n');
124
126
  process.stderr.write('─'.repeat(40) + '\n');
125
127
  }
126
- console.log(result.data);
128
+ (0, write_output_1.writeResult)(out, result.data);
127
129
  if (verbose) {
128
130
  process.stderr.write('\n✅ Execute completed successfully\n');
129
131
  }
@@ -132,6 +134,7 @@ async function handleExecute(args) {
132
134
  catch (err) {
133
135
  const errMsg = err instanceof Error ? err.message : String(err);
134
136
  console.error(`Error: ${errMsg}`);
137
+ (0, write_output_1.appendError)(out, `Error: ${errMsg}`);
135
138
  exitCode = 1;
136
139
  }
137
140
  finally {
@@ -28,6 +28,8 @@ export interface CommonFlags {
28
28
  promptFile?: string;
29
29
  /** Whether overdrive (boost) is active for this request. */
30
30
  overdrive: boolean;
31
+ /** Output file path for saving result (--out/-o). */
32
+ out?: string;
31
33
  /** Template variables from --var key=value flags. */
32
34
  vars: Record<string, string>;
33
35
  /** Remaining non-flag positional arguments. */
@@ -68,6 +68,7 @@ function parseCommonFlags(args) {
68
68
  const outputFormat = parseFlag(args, '--output-format');
69
69
  const effort = parseFlag(args, '--effort');
70
70
  const promptFile = parseFlag(args, '--prompt-file', '-f');
71
+ const out = parseFlag(args, '--out', '-o');
71
72
  const verbose = hasFlag(args, '--verbose');
72
73
  const overdrive = hasFlag(args, '--overdrive');
73
74
  // Collect consumed positions for known flags
@@ -80,6 +81,7 @@ function parseCommonFlags(args) {
80
81
  { names: ['--output-format'] },
81
82
  { names: ['--effort'] },
82
83
  { names: ['--prompt-file', '-f'] },
84
+ { names: ['--out', '-o'] },
83
85
  ];
84
86
  // Parse --var key=value flags (multiple allowed; last value wins on duplicate keys)
85
87
  const vars = {};
@@ -153,7 +155,7 @@ function parseCommonFlags(args) {
153
155
  }
154
156
  rest.push(token);
155
157
  }
156
- return { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, rest };
158
+ return { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, out, rest };
157
159
  }
158
160
  /**
159
161
  * Parse metadata JSON string from --metadata flag.
@@ -27,6 +27,7 @@ const parse_common_flags_1 = require("./parse-common-flags");
27
27
  const resolve_prompt_1 = require("./resolve-prompt");
28
28
  const crewx_cli_1 = require("../bootstrap/crewx-cli");
29
29
  const inherited_trace_1 = require("../utils/inherited-trace");
30
+ const write_output_1 = require("./write-output");
30
31
  /**
31
32
  * Handle `crewx query <agentRef> <message>` command.
32
33
  *
@@ -34,7 +35,7 @@ const inherited_trace_1 = require("../utils/inherited-trace");
34
35
  * --verbose: debug info written to stderr, response to stdout.
35
36
  */
36
37
  async function handleQuery(args) {
37
- const { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, rest } = (0, parse_common_flags_1.parseCommonFlags)(args);
38
+ const { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, out, rest } = (0, parse_common_flags_1.parseCommonFlags)(args);
38
39
  const { agentRef: parsedAgentRef, message } = (0, parse_agent_message_1.parseAgentMessage)(rest);
39
40
  // No @mention → default to @crewx agent (matches cli-bak behaviour)
40
41
  const agentRef = parsedAgentRef || '@crewx';
@@ -111,6 +112,7 @@ async function handleQuery(args) {
111
112
  if (!result.ok) {
112
113
  const errMsg = result.error?.message ?? 'Query failed';
113
114
  console.error(errMsg);
115
+ (0, write_output_1.appendError)(out, errMsg);
114
116
  exitCode = 1;
115
117
  }
116
118
  else {
@@ -123,7 +125,7 @@ async function handleQuery(args) {
123
125
  process.stderr.write('\n📄 Response:\n');
124
126
  process.stderr.write('─'.repeat(40) + '\n');
125
127
  }
126
- console.log(result.data);
128
+ (0, write_output_1.writeResult)(out, result.data);
127
129
  if (verbose) {
128
130
  process.stderr.write('\n✅ Query completed successfully\n');
129
131
  }
@@ -132,6 +134,7 @@ async function handleQuery(args) {
132
134
  catch (err) {
133
135
  const errMsg = err instanceof Error ? err.message : String(err);
134
136
  console.error(`Error: ${errMsg}`);
137
+ (0, write_output_1.appendError)(out, `Error: ${errMsg}`);
135
138
  exitCode = 1;
136
139
  }
137
140
  finally {
@@ -0,0 +1,3 @@
1
+ export declare function writeResult(out: string | undefined, data: string): void;
2
+ /** On failure: if out is specified, append to file (avoid empty file). stderr is kept by the caller. */
3
+ export declare function appendError(out: string | undefined, message: string): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeResult = writeResult;
4
+ exports.appendError = appendError;
5
+ /**
6
+ * EPIPE-safe result output.
7
+ * - out specified: write success result to file (sync, no stream EPIPE)
8
+ * - out not specified: fall back to existing stdout (console.log)
9
+ */
10
+ const fs_1 = require("fs");
11
+ function writeResult(out, data) {
12
+ if (out) {
13
+ (0, fs_1.writeFileSync)(out, data, 'utf8');
14
+ }
15
+ else {
16
+ console.log(data);
17
+ }
18
+ }
19
+ /** On failure: if out is specified, append to file (avoid empty file). stderr is kept by the caller. */
20
+ function appendError(out, message) {
21
+ if (out) {
22
+ (0, fs_1.appendFileSync)(out, message.endsWith('\n') ? message : message + '\n', 'utf8');
23
+ }
24
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/cli",
3
- "version": "0.9.0-rc.13",
3
+ "version": "0.9.0-rc.14",
4
4
  "license": "UNLICENSED",
5
5
  "engines": {
6
6
  "node": ">=20.19.0"