@crewx/cli 0.9.0-rc.10 → 0.9.0-rc.101
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/bootstrap/codex-writable-roots.d.ts +13 -0
- package/dist/bootstrap/codex-writable-roots.js +25 -0
- package/dist/bootstrap/crewx-cli.js +7 -2
- package/dist/builtin.js +1 -0
- package/dist/commands/agent.js +0 -58
- package/dist/commands/cal.d.ts +15 -0
- package/dist/commands/cal.js +44 -0
- package/dist/commands/db.d.ts +2 -0
- package/dist/commands/db.js +381 -1
- package/dist/commands/detached.d.ts +65 -0
- package/dist/commands/detached.js +507 -0
- package/dist/commands/doctor.d.ts +53 -0
- package/dist/commands/doctor.js +391 -21
- package/dist/commands/emit-trailer.d.ts +25 -0
- package/dist/commands/emit-trailer.js +33 -0
- package/dist/commands/execute.d.ts +7 -4
- package/dist/commands/execute.js +118 -17
- package/dist/commands/hook/command-marker.d.ts +2 -0
- package/dist/commands/hook/command-marker.js +5 -0
- package/dist/commands/hook/install.d.ts +0 -1
- package/dist/commands/hook/install.js +60 -63
- package/dist/commands/hook/status.js +3 -3
- package/dist/commands/hook/uninstall.js +2 -2
- package/dist/commands/init.js +22 -1
- package/dist/commands/kill.d.ts +2 -8
- package/dist/commands/kill.js +6 -47
- package/dist/commands/log.js +4 -3
- package/dist/commands/parse-common-flags.d.ts +5 -1
- package/dist/commands/parse-common-flags.js +6 -2
- package/dist/commands/ps.d.ts +2 -2
- package/dist/commands/ps.js +25 -15
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +303 -0
- package/dist/commands/query.d.ts +5 -1
- package/dist/commands/query.js +110 -11
- package/dist/commands/registry.js +4 -2
- package/dist/commands/result.d.ts +8 -3
- package/dist/commands/result.js +139 -7
- package/dist/commands/shortcut.d.ts +1 -0
- package/dist/commands/shortcut.js +267 -0
- package/dist/commands/slack.js +2 -1
- package/dist/commands/stop.d.ts +8 -0
- package/dist/commands/stop.js +119 -0
- package/dist/commands/write-output.d.ts +3 -0
- package/dist/commands/write-output.js +24 -0
- package/dist/logging.d.ts +1 -1
- package/dist/logging.js +3 -2
- package/dist/main.d.ts +3 -2
- package/dist/main.js +66 -16
- package/dist/utils/env-defaults.d.ts +2 -5
- package/dist/utils/env-defaults.js +10 -5
- package/dist/utils/inherited-trace.d.ts +24 -0
- package/dist/utils/inherited-trace.js +40 -0
- package/dist/utils/sdk-compat.d.ts +24 -0
- package/dist/utils/sdk-compat.js +120 -0
- package/package.json +14 -11
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Common flag parser for query/execute commands.
|
|
4
4
|
*
|
|
5
5
|
* Supports both `--flag=value` and `--flag value` forms.
|
|
6
|
-
* Handles: --thread, --provider, --metadata, --verbose, --config/-c,
|
|
6
|
+
* Handles: --thread, --provider, --model, --metadata, --verbose, --config/-c,
|
|
7
7
|
* --output-format, --effort, --prompt-file/-f, --overdrive.
|
|
8
8
|
*
|
|
9
9
|
* Strict mode: unknown --xxx tokens after known flags are consumed throw an
|
|
@@ -63,11 +63,13 @@ exports.UnknownOptionError = UnknownOptionError;
|
|
|
63
63
|
function parseCommonFlags(args) {
|
|
64
64
|
const thread = parseFlag(args, '--thread');
|
|
65
65
|
const provider = parseFlag(args, '--provider');
|
|
66
|
+
const model = parseFlag(args, '--model');
|
|
66
67
|
const metadata = parseFlag(args, '--metadata');
|
|
67
68
|
const config = parseFlag(args, '--config', '-c');
|
|
68
69
|
const outputFormat = parseFlag(args, '--output-format');
|
|
69
70
|
const effort = parseFlag(args, '--effort');
|
|
70
71
|
const promptFile = parseFlag(args, '--prompt-file', '-f');
|
|
72
|
+
const out = parseFlag(args, '--out', '-o');
|
|
71
73
|
const verbose = hasFlag(args, '--verbose');
|
|
72
74
|
const overdrive = hasFlag(args, '--overdrive');
|
|
73
75
|
// Collect consumed positions for known flags
|
|
@@ -75,11 +77,13 @@ function parseCommonFlags(args) {
|
|
|
75
77
|
const flagPairs = [
|
|
76
78
|
{ names: ['--thread'] },
|
|
77
79
|
{ names: ['--provider'] },
|
|
80
|
+
{ names: ['--model'] },
|
|
78
81
|
{ names: ['--metadata'] },
|
|
79
82
|
{ names: ['--config', '-c'] },
|
|
80
83
|
{ names: ['--output-format'] },
|
|
81
84
|
{ names: ['--effort'] },
|
|
82
85
|
{ names: ['--prompt-file', '-f'] },
|
|
86
|
+
{ names: ['--out', '-o'] },
|
|
83
87
|
];
|
|
84
88
|
// Parse --var key=value flags (multiple allowed; last value wins on duplicate keys)
|
|
85
89
|
const vars = {};
|
|
@@ -153,7 +157,7 @@ function parseCommonFlags(args) {
|
|
|
153
157
|
}
|
|
154
158
|
rest.push(token);
|
|
155
159
|
}
|
|
156
|
-
return { thread, provider, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, rest };
|
|
160
|
+
return { thread, provider, model, metadata, verbose, config, outputFormat, effort, promptFile, overdrive, vars, out, rest };
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
163
|
* Parse metadata JSON string from --metadata flag.
|
package/dist/commands/ps.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* crewx ps handler.
|
|
3
|
-
* Lists
|
|
3
|
+
* Lists active tasks (pending or running) in table format.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* crewx ps List all running tasks
|
|
6
|
+
* crewx ps List all pending and running tasks
|
|
7
7
|
* crewx ps --json Output as JSON array
|
|
8
8
|
*/
|
|
9
9
|
export declare function handlePs(args: string[]): Promise<void>;
|
package/dist/commands/ps.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* crewx ps handler.
|
|
4
|
-
* Lists
|
|
4
|
+
* Lists active tasks (pending or running) in table format.
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
* crewx ps List all running tasks
|
|
7
|
+
* crewx ps List all pending and running tasks
|
|
8
8
|
* crewx ps --json Output as JSON array
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.handlePs = handlePs;
|
|
12
12
|
const repository_1 = require("@crewx/sdk/repository");
|
|
13
|
+
const cal_1 = require("./cal");
|
|
13
14
|
function formatElapsed(ms) {
|
|
14
15
|
const s = Math.floor(ms / 1000);
|
|
15
16
|
if (s < 60)
|
|
@@ -34,9 +35,9 @@ function isAgyCommand(codingAgentCommand) {
|
|
|
34
35
|
const base = firstToken.split('/').pop() ?? firstToken;
|
|
35
36
|
return base.startsWith('agy');
|
|
36
37
|
}
|
|
37
|
-
function getLastActive(task) {
|
|
38
|
+
function getLastActive(task, taskRepo) {
|
|
38
39
|
try {
|
|
39
|
-
const entries =
|
|
40
|
+
const entries = taskRepo.readLogsTail(task.id, 1)?.entries ?? [];
|
|
40
41
|
if (Array.isArray(entries) && entries.length > 0) {
|
|
41
42
|
const lastEntry = entries[entries.length - 1];
|
|
42
43
|
const ts = lastEntry?.timestamp;
|
|
@@ -59,12 +60,13 @@ function getLastActive(task) {
|
|
|
59
60
|
}
|
|
60
61
|
return { display: '—', isoTimestamp: null, logCapable: true };
|
|
61
62
|
}
|
|
62
|
-
function taskToRow(task) {
|
|
63
|
+
function taskToRow(task, taskRepo) {
|
|
63
64
|
const elapsed = formatElapsed(Date.now() - new Date(task.started_at).getTime());
|
|
64
|
-
const lastActive = getLastActive(task);
|
|
65
|
+
const lastActive = getLastActive(task, taskRepo);
|
|
65
66
|
return [
|
|
66
67
|
task.id,
|
|
67
68
|
task.agent_id ?? '—',
|
|
69
|
+
task.status,
|
|
68
70
|
task.pid !== null && task.pid !== undefined ? String(task.pid) : '—',
|
|
69
71
|
elapsed,
|
|
70
72
|
task.mode ?? '—',
|
|
@@ -83,14 +85,14 @@ function renderTable(headers, rows) {
|
|
|
83
85
|
}
|
|
84
86
|
async function handlePs(args) {
|
|
85
87
|
const repo = new repository_1.TaskRepository();
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
console.
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const reaped = repo.reapOrphanedTasks();
|
|
89
|
+
if (reaped > 0)
|
|
90
|
+
console.error(`Reaped ${reaped} orphaned task(s)`);
|
|
91
|
+
repo.reapRunningWorkflowTasks();
|
|
92
|
+
const tasks = repo.getActiveTasks();
|
|
91
93
|
if (args.includes('--json')) {
|
|
92
94
|
const withLastActive = tasks.map((task) => {
|
|
93
|
-
const lastActive = getLastActive(task);
|
|
95
|
+
const lastActive = getLastActive(task, repo);
|
|
94
96
|
return {
|
|
95
97
|
...task,
|
|
96
98
|
last_active_at: lastActive.isoTimestamp,
|
|
@@ -100,8 +102,16 @@ async function handlePs(args) {
|
|
|
100
102
|
console.log(JSON.stringify(withLastActive, null, 2));
|
|
101
103
|
return;
|
|
102
104
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
if (tasks.length === 0) {
|
|
106
|
+
console.log('No active tasks.');
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const headers = ['TASK ID', 'AGENT', 'STATUS', 'PID', 'ELAPSED', 'MODE', 'LAST ACTIVE'];
|
|
110
|
+
const rows = tasks.map((task) => taskToRow(task, repo));
|
|
105
111
|
renderTable(headers, rows);
|
|
106
|
-
console.log(`\n ${tasks.length}
|
|
112
|
+
console.log(`\n ${tasks.length} active task(s)`);
|
|
113
|
+
(0, cal_1.writeCalFooter)({
|
|
114
|
+
commandId: 'crewx.ps',
|
|
115
|
+
params: { taskId: tasks[0].id },
|
|
116
|
+
});
|
|
107
117
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handlePublish(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.handlePublish = handlePublish;
|
|
37
|
+
/**
|
|
38
|
+
* crewx publish handler — thin CLI wrapper over @crewx/sdk/publish.
|
|
39
|
+
*
|
|
40
|
+
* Usage:
|
|
41
|
+
* crewx publish [dir] [--dry-run] [--version <semver>] [--json] [--upload]
|
|
42
|
+
*
|
|
43
|
+
* All scanning, exclusion-rule judgment, secret detection, hashing, and
|
|
44
|
+
* tar.gz packing lives in @crewx/sdk/publish (planPublish / packTemplate).
|
|
45
|
+
* Submit+upload (WI-SHR-20260806-013) lives in the same package
|
|
46
|
+
* (uploadToMarketplace) for the same reason — see that module's header.
|
|
47
|
+
* This command only parses argv, forwards options, asks the SDK SessionManager
|
|
48
|
+
* for a valid account bearer when upload is requested, and renders the result.
|
|
49
|
+
*/
|
|
50
|
+
const fs = __importStar(require("fs"));
|
|
51
|
+
const account_1 = require("@crewx/sdk/account");
|
|
52
|
+
const publish_1 = require("@crewx/sdk/publish");
|
|
53
|
+
const parse_common_flags_1 = require("./parse-common-flags");
|
|
54
|
+
function parsePublishFlags(args) {
|
|
55
|
+
const flags = { dryRun: false, json: false, help: false, upload: false };
|
|
56
|
+
for (let i = 0; i < args.length; i++) {
|
|
57
|
+
const arg = args[i];
|
|
58
|
+
if (arg === '--help' || arg === '-h') {
|
|
59
|
+
flags.help = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (arg === '--dry-run') {
|
|
63
|
+
flags.dryRun = true;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (arg === '--json') {
|
|
67
|
+
flags.json = true;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (arg === '--upload') {
|
|
71
|
+
flags.upload = true;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (arg === '--version') {
|
|
75
|
+
const value = args[i + 1];
|
|
76
|
+
if (value === undefined)
|
|
77
|
+
throw new parse_common_flags_1.UnknownOptionError('--version requires a value');
|
|
78
|
+
flags.version = value;
|
|
79
|
+
i++;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (arg.startsWith('--version=')) {
|
|
83
|
+
flags.version = arg.slice('--version='.length);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (arg.startsWith('-')) {
|
|
87
|
+
throw new parse_common_flags_1.UnknownOptionError(`Unknown option: ${arg}`);
|
|
88
|
+
}
|
|
89
|
+
if (flags.dir === undefined) {
|
|
90
|
+
flags.dir = arg;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
throw new parse_common_flags_1.UnknownOptionError(`Unknown option: ${arg}`);
|
|
94
|
+
}
|
|
95
|
+
return flags;
|
|
96
|
+
}
|
|
97
|
+
function resolveWorkspaceDir(flags) {
|
|
98
|
+
return flags.dir ?? process.env['CREWX_WORKSPACE'] ?? process.cwd();
|
|
99
|
+
}
|
|
100
|
+
function printJson(payload) {
|
|
101
|
+
console.log(JSON.stringify(payload));
|
|
102
|
+
}
|
|
103
|
+
/** Prints the error and exits 1. Never returns (matches `process.exit`'s `never` type). */
|
|
104
|
+
function failWithError(err, json) {
|
|
105
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
106
|
+
if (json) {
|
|
107
|
+
printJson({ success: false, error: message });
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.error(`✗ ${message}`);
|
|
111
|
+
}
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
function printHelp() {
|
|
115
|
+
console.log(`
|
|
116
|
+
crewx publish — package a workspace as a distributable template archive
|
|
117
|
+
|
|
118
|
+
Usage:
|
|
119
|
+
crewx publish [dir] [--dry-run] [--version <semver>] [--json] [--upload]
|
|
120
|
+
|
|
121
|
+
Arguments:
|
|
122
|
+
dir Workspace to publish (default: $CREWX_WORKSPACE or cwd)
|
|
123
|
+
|
|
124
|
+
Options:
|
|
125
|
+
--dry-run Scan + build manifest only; do not write a .tgz
|
|
126
|
+
--version <ver> Override manifest version (semver, e.g. 1.0.0)
|
|
127
|
+
--json Print machine-readable JSON to stdout
|
|
128
|
+
--upload Submit + upload the packed archive to marketplace
|
|
129
|
+
(uses the configured account target and a prior login;
|
|
130
|
+
ignored when combined with --dry-run)
|
|
131
|
+
--help, -h Show this help
|
|
132
|
+
|
|
133
|
+
Notes:
|
|
134
|
+
Without --upload, this command only scans the workspace, applies
|
|
135
|
+
exclusion rules, checks for secrets, and packs a local
|
|
136
|
+
.crewx/publish/<name>-<version>.tgz archive.
|
|
137
|
+
`.trim());
|
|
138
|
+
}
|
|
139
|
+
/** Resolve and validate the Marketplace target immediately before an upload. */
|
|
140
|
+
function requireMarketplaceUrl() {
|
|
141
|
+
try {
|
|
142
|
+
const url = (0, account_1.resolveMarketplaceUrl)();
|
|
143
|
+
(0, account_1.assertAccountTargetNotMixed)();
|
|
144
|
+
return url;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
const code = typeof error === 'object' && error !== null && 'code' in error
|
|
148
|
+
? error.code
|
|
149
|
+
: undefined;
|
|
150
|
+
if (code === 'ACCOUNT_TARGET_INVALID' ||
|
|
151
|
+
code === 'ACCOUNT_TARGET_MIXED' ||
|
|
152
|
+
code === 'MARKETPLACE_DISABLED' ||
|
|
153
|
+
code === 'MARKETPLACE_URL_INVALID') {
|
|
154
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
155
|
+
throw new Error(`publish: [${code}] ${message}`);
|
|
156
|
+
}
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function isMarketplaceUnauthorized(err) {
|
|
161
|
+
return err instanceof Error
|
|
162
|
+
&& err.message.includes('publish: [E_AUTH_EXPIRED]')
|
|
163
|
+
&& /HTTP 401\b/.test(err.message);
|
|
164
|
+
}
|
|
165
|
+
async function uploadWithSessionRefresh(sessionManager, options, accessToken) {
|
|
166
|
+
try {
|
|
167
|
+
return await (0, publish_1.uploadToMarketplace)({ ...options, accessToken });
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
if (!isMarketplaceUnauthorized(err))
|
|
171
|
+
throw err;
|
|
172
|
+
const refreshedSession = await sessionManager.refresh();
|
|
173
|
+
return (0, publish_1.uploadToMarketplace)({ ...options, accessToken: refreshedSession.access_token });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
async function handlePublish(args) {
|
|
177
|
+
const flags = parsePublishFlags(args);
|
|
178
|
+
if (flags.help) {
|
|
179
|
+
printHelp();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const dir = resolveWorkspaceDir(flags);
|
|
183
|
+
process.stderr.write(`[publish] scanning ${dir}...\n`);
|
|
184
|
+
let plan;
|
|
185
|
+
try {
|
|
186
|
+
plan = await (0, publish_1.planPublish)(dir, { version: flags.version });
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
failWithError(err, flags.json);
|
|
190
|
+
}
|
|
191
|
+
if (plan.secretFindings.length > 0) {
|
|
192
|
+
if (flags.json) {
|
|
193
|
+
printJson({ success: false, error: 'secret findings detected', findings: plan.secretFindings });
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
console.error('✗ secret findings detected — publish aborted');
|
|
197
|
+
for (const f of plan.secretFindings) {
|
|
198
|
+
console.error(` ${f.path}:${f.line} (${f.rule})`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
if (flags.dryRun) {
|
|
204
|
+
if (flags.json) {
|
|
205
|
+
printJson({
|
|
206
|
+
success: true,
|
|
207
|
+
dryRun: true,
|
|
208
|
+
workspace: dir,
|
|
209
|
+
manifest: plan.manifest,
|
|
210
|
+
included: plan.included,
|
|
211
|
+
excluded: plan.excluded,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
console.log('✓ dry-run — no archive written');
|
|
216
|
+
console.log(` workspace: ${dir}`);
|
|
217
|
+
console.log(` name: ${plan.manifest.name} version: ${plan.manifest.version}`);
|
|
218
|
+
console.log(` included: ${plan.included.length} files`);
|
|
219
|
+
console.log(` excluded: ${plan.excluded.length} entries`);
|
|
220
|
+
for (const e of plan.excluded) {
|
|
221
|
+
console.log(` ${e.path} (${e.rule})`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
// Resolved before packing (not after) so a doomed --upload run (no
|
|
227
|
+
// marketplace url / no session) never writes a stray .tgz to the
|
|
228
|
+
// workspace — WI-SHR-20260806-013 AC-U5.
|
|
229
|
+
let marketplaceUrl = '';
|
|
230
|
+
let accessToken = '';
|
|
231
|
+
let sessionManager;
|
|
232
|
+
if (flags.upload) {
|
|
233
|
+
try {
|
|
234
|
+
marketplaceUrl = requireMarketplaceUrl();
|
|
235
|
+
sessionManager = new account_1.SessionManager({ authClient: new account_1.AuthClient() });
|
|
236
|
+
accessToken = await sessionManager.getAccessToken();
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
if (err instanceof Error && !err.message.startsWith('publish: [')) {
|
|
240
|
+
failWithError(new Error(`publish: [E_AUTH_EXPIRED] Authentication is missing or expired — please log in again — ${err.message}`), flags.json);
|
|
241
|
+
}
|
|
242
|
+
failWithError(err, flags.json);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
process.stderr.write(`[publish] packing ${plan.manifest.name}@${plan.manifest.version}...\n`);
|
|
246
|
+
let packed;
|
|
247
|
+
try {
|
|
248
|
+
packed = await (0, publish_1.packTemplate)(dir, { version: flags.version });
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
failWithError(err, flags.json);
|
|
252
|
+
}
|
|
253
|
+
const fileCount = packed.manifest.files.length;
|
|
254
|
+
const totalBytes = fs.statSync(packed.tgzPath).size;
|
|
255
|
+
let uploadResult;
|
|
256
|
+
if (flags.upload) {
|
|
257
|
+
process.stderr.write(`[publish] uploading ${packed.manifest.name}@${packed.manifest.version} to ${marketplaceUrl}...\n`);
|
|
258
|
+
try {
|
|
259
|
+
if (!sessionManager)
|
|
260
|
+
throw new Error('publish: [E_AUTH_EXPIRED] Account session is unavailable');
|
|
261
|
+
uploadResult = await uploadWithSessionRefresh(sessionManager, {
|
|
262
|
+
tgzPath: packed.tgzPath,
|
|
263
|
+
manifest: packed.manifest,
|
|
264
|
+
baseUrl: marketplaceUrl,
|
|
265
|
+
}, accessToken);
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
failWithError(err, flags.json);
|
|
269
|
+
}
|
|
270
|
+
process.stderr.write(`[publish] submit -> ${uploadResult.submitOutcome}\n`);
|
|
271
|
+
}
|
|
272
|
+
if (flags.json) {
|
|
273
|
+
printJson({
|
|
274
|
+
success: true,
|
|
275
|
+
tgzPath: packed.tgzPath,
|
|
276
|
+
fileCount,
|
|
277
|
+
totalBytes,
|
|
278
|
+
manifest: packed.manifest,
|
|
279
|
+
...(uploadResult
|
|
280
|
+
? {
|
|
281
|
+
slug: uploadResult.slug,
|
|
282
|
+
version: uploadResult.version,
|
|
283
|
+
artifactChecksum: uploadResult.artifactChecksum,
|
|
284
|
+
artifactSizeBytes: uploadResult.artifactSizeBytes,
|
|
285
|
+
submitOutcome: uploadResult.submitOutcome,
|
|
286
|
+
versionUpdate: uploadResult.versionUpdate,
|
|
287
|
+
serverVersionBefore: uploadResult.serverVersionBefore,
|
|
288
|
+
}
|
|
289
|
+
: {}),
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
console.log(`✓ packed: ${packed.tgzPath}`);
|
|
294
|
+
console.log(` files: ${fileCount} bytes: ${totalBytes}`);
|
|
295
|
+
if (uploadResult) {
|
|
296
|
+
console.log(`✓ uploaded: ${uploadResult.slug}@${uploadResult.version} (${uploadResult.submitOutcome})`);
|
|
297
|
+
console.log(` artifactChecksum: ${uploadResult.artifactChecksum} artifactSizeBytes: ${uploadResult.artifactSizeBytes}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!flags.upload) {
|
|
301
|
+
console.error('⚠ To upload, use --upload — check the generated file path');
|
|
302
|
+
}
|
|
303
|
+
}
|
package/dist/commands/query.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Flags:
|
|
6
6
|
* --thread <name> Conversation thread name
|
|
7
7
|
* --provider <cli/xxx> Provider override
|
|
8
|
+
* --model <name> Model override (e.g. claude-sonnet-5)
|
|
8
9
|
* --metadata <json> Extra metadata JSON (double-quoted object). Propagated to events/hooks/tracing.
|
|
9
10
|
* e.g. --metadata='{"workflow_id":"wf-1"}'
|
|
10
11
|
* --verbose Debug output mode (default: raw agent response only)
|
|
@@ -12,16 +13,19 @@
|
|
|
12
13
|
* --output-format <fmt> Output format (json|text|stream-json)
|
|
13
14
|
* --effort <level> Model effort (high|medium|low)
|
|
14
15
|
* -f/--prompt-file <path> Read prompt body from file (bypasses cmd.exe argv truncation)
|
|
16
|
+
* --detach/--async Persist a receipt and launch a detached runner
|
|
17
|
+
* --wait Force synchronous execution
|
|
15
18
|
*
|
|
16
19
|
* Stdin support:
|
|
17
20
|
* Pipe or redirect content into crewx q to supply the prompt body via stdin.
|
|
18
21
|
* e.g. cat brief.md | crewx q "@agent label"
|
|
19
22
|
* Stdin is ignored when running in an interactive TTY.
|
|
20
23
|
*/
|
|
24
|
+
import { type DelegationEmitState } from './emit-trailer';
|
|
21
25
|
/**
|
|
22
26
|
* Handle `crewx query <agentRef> <message>` command.
|
|
23
27
|
*
|
|
24
28
|
* Default output: raw agent response only (stdout).
|
|
25
29
|
* --verbose: debug info written to stderr, response to stdout.
|
|
26
30
|
*/
|
|
27
|
-
export declare function handleQuery(args: string[]): Promise<void>;
|
|
31
|
+
export declare function handleQuery(args: string[], command?: string, emitState?: DelegationEmitState): Promise<void>;
|