@crewx/cli 0.9.0-rc.13 ā 0.9.0-rc.15
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/dist/commands/execute.js +6 -2
- package/dist/commands/parse-common-flags.d.ts +2 -0
- package/dist/commands/parse-common-flags.js +3 -1
- package/dist/commands/query.js +6 -2
- package/dist/commands/write-output.d.ts +3 -0
- package/dist/commands/write-output.js +24 -0
- package/dist/main.js +1 -0
- package/package.json +6 -6
package/dist/commands/execute.js
CHANGED
|
@@ -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';
|
|
@@ -62,6 +63,7 @@ async function handleExecute(args) {
|
|
|
62
63
|
console.error(' --verbose Debug output mode');
|
|
63
64
|
console.error(' --config/-c <path> Config file path');
|
|
64
65
|
console.error(' --output-format <fmt> Output format (json|text|stream-json)');
|
|
66
|
+
console.error(' --out/-o <path> Save result to file (stdout suppressed)');
|
|
65
67
|
console.error(' --effort <level> Model effort (high|medium|low)');
|
|
66
68
|
console.error(' -f/--prompt-file <path> Read task body from file');
|
|
67
69
|
console.error(' --var key=value Template variable (repeatable)');
|
|
@@ -111,6 +113,7 @@ async function handleExecute(args) {
|
|
|
111
113
|
if (!result.ok) {
|
|
112
114
|
const errMsg = result.error?.message ?? 'Execute failed';
|
|
113
115
|
console.error(errMsg);
|
|
116
|
+
(0, write_output_1.appendError)(out, errMsg);
|
|
114
117
|
exitCode = 1;
|
|
115
118
|
}
|
|
116
119
|
else {
|
|
@@ -123,7 +126,7 @@ async function handleExecute(args) {
|
|
|
123
126
|
process.stderr.write('\nš Response:\n');
|
|
124
127
|
process.stderr.write('ā'.repeat(40) + '\n');
|
|
125
128
|
}
|
|
126
|
-
|
|
129
|
+
(0, write_output_1.writeResult)(out, result.data);
|
|
127
130
|
if (verbose) {
|
|
128
131
|
process.stderr.write('\nā
Execute completed successfully\n');
|
|
129
132
|
}
|
|
@@ -132,6 +135,7 @@ async function handleExecute(args) {
|
|
|
132
135
|
catch (err) {
|
|
133
136
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
134
137
|
console.error(`Error: ${errMsg}`);
|
|
138
|
+
(0, write_output_1.appendError)(out, `Error: ${errMsg}`);
|
|
135
139
|
exitCode = 1;
|
|
136
140
|
}
|
|
137
141
|
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.
|
package/dist/commands/query.js
CHANGED
|
@@ -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';
|
|
@@ -62,6 +63,7 @@ async function handleQuery(args) {
|
|
|
62
63
|
console.error(' --verbose Debug output mode');
|
|
63
64
|
console.error(' --config/-c <path> Config file path');
|
|
64
65
|
console.error(' --output-format <fmt> Output format (json|text|stream-json)');
|
|
66
|
+
console.error(' --out/-o <path> Save result to file (stdout suppressed)');
|
|
65
67
|
console.error(' --effort <level> Model effort (high|medium|low)');
|
|
66
68
|
console.error(' -f/--prompt-file <path> Read prompt body from file');
|
|
67
69
|
console.error(' --var key=value Template variable (repeatable)');
|
|
@@ -111,6 +113,7 @@ async function handleQuery(args) {
|
|
|
111
113
|
if (!result.ok) {
|
|
112
114
|
const errMsg = result.error?.message ?? 'Query failed';
|
|
113
115
|
console.error(errMsg);
|
|
116
|
+
(0, write_output_1.appendError)(out, errMsg);
|
|
114
117
|
exitCode = 1;
|
|
115
118
|
}
|
|
116
119
|
else {
|
|
@@ -123,7 +126,7 @@ async function handleQuery(args) {
|
|
|
123
126
|
process.stderr.write('\nš Response:\n');
|
|
124
127
|
process.stderr.write('ā'.repeat(40) + '\n');
|
|
125
128
|
}
|
|
126
|
-
|
|
129
|
+
(0, write_output_1.writeResult)(out, result.data);
|
|
127
130
|
if (verbose) {
|
|
128
131
|
process.stderr.write('\nā
Query completed successfully\n');
|
|
129
132
|
}
|
|
@@ -132,6 +135,7 @@ async function handleQuery(args) {
|
|
|
132
135
|
catch (err) {
|
|
133
136
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
134
137
|
console.error(`Error: ${errMsg}`);
|
|
138
|
+
(0, write_output_1.appendError)(out, `Error: ${errMsg}`);
|
|
135
139
|
exitCode = 1;
|
|
136
140
|
}
|
|
137
141
|
finally {
|
|
@@ -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
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -262,6 +262,7 @@ Query / Execute:
|
|
|
262
262
|
--verbose Debug output mode (default: raw response only)
|
|
263
263
|
--config/-c <path> Config file path (default: CREWX_CONFIG or crewx.yaml)
|
|
264
264
|
--output-format <fmt> Output format (json|text|stream-json)
|
|
265
|
+
--out/-o <path> Save result to file (stdout suppressed)
|
|
265
266
|
--effort <level> Model effort (high|medium|low)
|
|
266
267
|
-f/--prompt-file <path> Read task body from file (bypasses argv length limits)
|
|
267
268
|
--var key=value Template variable (repeatable). Accessible as {{key}} in agent prompt.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/cli",
|
|
3
|
-
"version": "0.9.0-rc.
|
|
3
|
+
"version": "0.9.0-rc.15",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"@crewx/adapter-slack": "0.1.4",
|
|
25
25
|
"better-sqlite3": "*",
|
|
26
26
|
"isomorphic-git": "1.37.1",
|
|
27
|
-
"@crewx/sdk": "0.9.0-rc.
|
|
27
|
+
"@crewx/sdk": "0.9.0-rc.15",
|
|
28
28
|
"@crewx/doc": "0.1.9",
|
|
29
29
|
"@crewx/search": "0.1.10",
|
|
30
|
+
"@crewx/workflow": "0.3.22-rc.61",
|
|
30
31
|
"@crewx/cron": "0.1.10",
|
|
31
|
-
"@crewx/workflow": "0.3.22-rc.59",
|
|
32
32
|
"@crewx/skill": "0.1.20",
|
|
33
|
-
"@crewx/wbs": "0.1.10",
|
|
34
|
-
"@crewx/chromex": "0.1.0",
|
|
35
33
|
"@crewx/memory": "0.1.23",
|
|
36
34
|
"@crewx/shared": "0.0.6",
|
|
37
|
-
"@crewx/
|
|
35
|
+
"@crewx/chromex": "0.1.0",
|
|
36
|
+
"@crewx/wbs": "0.1.10",
|
|
37
|
+
"@crewx/wi": "0.1.10-rc.35"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/better-sqlite3": "*",
|