@crewx/cli 0.9.0-rc.105 → 0.9.0-rc.106
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/init.d.ts +34 -0
- package/dist/commands/init.js +108 -56
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/main.js +8 -2
- package/package.json +12 -12
package/dist/commands/init.d.ts
CHANGED
|
@@ -6,16 +6,48 @@
|
|
|
6
6
|
* crewx init Create crewx.yaml in current directory
|
|
7
7
|
* crewx init --force Overwrite existing configuration
|
|
8
8
|
*/
|
|
9
|
+
import { type ProviderAvailabilityDeps } from '@crewx/sdk';
|
|
10
|
+
export type InitProvider = 'cli/claude' | 'cli/codex';
|
|
11
|
+
type InitAgent = {
|
|
12
|
+
id: 'planner' | 'developer' | 'reviewer';
|
|
13
|
+
name: string;
|
|
14
|
+
role: string;
|
|
15
|
+
team: string;
|
|
16
|
+
provider: InitProvider;
|
|
17
|
+
working_directory: string;
|
|
18
|
+
description: string;
|
|
19
|
+
options: {
|
|
20
|
+
query: {
|
|
21
|
+
mode: string;
|
|
22
|
+
effort: string;
|
|
23
|
+
};
|
|
24
|
+
execute: {
|
|
25
|
+
mode: string;
|
|
26
|
+
effort: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
inline: {
|
|
30
|
+
model: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/** Build the three default agents using the selected CLI provider profile. */
|
|
35
|
+
export declare function buildDefaultAgents(provider: InitProvider): InitAgent[];
|
|
9
36
|
export interface InitResult {
|
|
10
37
|
yamlCreated: boolean;
|
|
11
38
|
hookInstalled: boolean;
|
|
12
39
|
errors: string[];
|
|
40
|
+
provider: InitProvider;
|
|
13
41
|
skippedReason?: 'yaml-exists';
|
|
14
42
|
workspaceId?: string;
|
|
15
43
|
slug?: string;
|
|
16
44
|
statusLineConfigured?: boolean;
|
|
17
45
|
statusLineSkipped?: boolean;
|
|
18
46
|
}
|
|
47
|
+
/** Parse the provider option accepted by `crewx init`. */
|
|
48
|
+
export declare function parseInitProvider(args: readonly string[]): InitProvider | undefined;
|
|
49
|
+
/** Resolve an explicit provider or detect Claude, then Codex, using PATH only. */
|
|
50
|
+
export declare function resolveInitProvider(provider?: InitProvider, deps?: ProviderAvailabilityDeps): InitProvider;
|
|
19
51
|
/**
|
|
20
52
|
* Programmatic init — creates crewx.yaml, support dirs, and optionally installs hooks.
|
|
21
53
|
* Throws on unrecoverable errors (PATH_NOT_FOUND, YAML_CREATE_FAILED).
|
|
@@ -27,4 +59,6 @@ export declare function handleInit(opts: {
|
|
|
27
59
|
path: string;
|
|
28
60
|
skipHook?: boolean;
|
|
29
61
|
force?: boolean;
|
|
62
|
+
provider?: InitProvider;
|
|
30
63
|
}): Promise<InitResult>;
|
|
64
|
+
export {};
|
package/dist/commands/init.js
CHANGED
|
@@ -44,6 +44,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
44
44
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
45
45
|
};
|
|
46
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.buildDefaultAgents = buildDefaultAgents;
|
|
48
|
+
exports.parseInitProvider = parseInitProvider;
|
|
49
|
+
exports.resolveInitProvider = resolveInitProvider;
|
|
47
50
|
exports.handleInit = handleInit;
|
|
48
51
|
const fs_1 = require("fs");
|
|
49
52
|
const path_1 = require("path");
|
|
@@ -103,59 +106,66 @@ skills/*/.crewx/
|
|
|
103
106
|
|
|
104
107
|
# OS
|
|
105
108
|
.DS_Store`.trim();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
provider: 'acp/claude',
|
|
130
|
-
working_directory: './',
|
|
131
|
-
description: 'Implements code changes and tests',
|
|
132
|
-
options: {
|
|
133
|
-
query: { effort: 'high' },
|
|
134
|
-
execute: { effort: 'high', mode: 'bypassPermissions' },
|
|
135
|
-
},
|
|
136
|
-
inline: {
|
|
137
|
-
model: 'claude-sonnet-4-6',
|
|
138
|
-
prompt: `Implement what the planner specifies. Prefer editing\nexisting files. Run tests before reporting done.`,
|
|
109
|
+
/** Build the three default agents using the selected CLI provider profile. */
|
|
110
|
+
function buildDefaultAgents(provider) {
|
|
111
|
+
const profile = (0, sdk_1.getDefaultAgentProfile)(provider);
|
|
112
|
+
if (!profile) {
|
|
113
|
+
throw new Error(`DEFAULT_AGENT_PROFILE_NOT_FOUND: ${provider}`);
|
|
114
|
+
}
|
|
115
|
+
return [
|
|
116
|
+
{
|
|
117
|
+
id: 'planner',
|
|
118
|
+
name: 'Planner',
|
|
119
|
+
role: 'Product/Architecture Planner',
|
|
120
|
+
team: 'core',
|
|
121
|
+
provider,
|
|
122
|
+
working_directory: './',
|
|
123
|
+
description: 'Owns requirements analysis, design, and work breakdown',
|
|
124
|
+
options: {
|
|
125
|
+
query: profile.planner.query,
|
|
126
|
+
execute: profile.planner.execute,
|
|
127
|
+
},
|
|
128
|
+
inline: {
|
|
129
|
+
model: profile.planner.model,
|
|
130
|
+
prompt: `You are a planner. Break down user goals into concrete,\ntestable steps. Challenge assumptions. Never write code directly.`,
|
|
131
|
+
},
|
|
139
132
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
133
|
+
{
|
|
134
|
+
id: 'developer',
|
|
135
|
+
name: 'Developer',
|
|
136
|
+
role: 'Implementation Engineer',
|
|
137
|
+
team: 'core',
|
|
138
|
+
provider,
|
|
139
|
+
working_directory: './',
|
|
140
|
+
description: 'Implements code changes and tests',
|
|
141
|
+
options: {
|
|
142
|
+
query: profile.worker.query,
|
|
143
|
+
execute: profile.worker.execute,
|
|
144
|
+
},
|
|
145
|
+
inline: {
|
|
146
|
+
model: profile.worker.model,
|
|
147
|
+
prompt: `Implement what the planner specifies. Prefer editing\nexisting files. Run tests before reporting done.`,
|
|
148
|
+
},
|
|
152
149
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
{
|
|
151
|
+
id: 'reviewer',
|
|
152
|
+
name: 'Reviewer',
|
|
153
|
+
role: 'Code Reviewer',
|
|
154
|
+
team: 'core',
|
|
155
|
+
provider,
|
|
156
|
+
working_directory: './',
|
|
157
|
+
description: 'Reviews code quality, security, and readability',
|
|
158
|
+
options: {
|
|
159
|
+
query: profile.worker.query,
|
|
160
|
+
execute: profile.worker.execute,
|
|
161
|
+
},
|
|
162
|
+
inline: {
|
|
163
|
+
model: profile.worker.model,
|
|
164
|
+
prompt: `Review diffs for correctness, security, readability.\nCite file:line. Be blunt, not polite.`,
|
|
165
|
+
},
|
|
156
166
|
},
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
];
|
|
168
|
+
}
|
|
159
169
|
const GOAL_TEMPLATE = `---
|
|
160
170
|
type: goal
|
|
161
171
|
description: CrewX Goal — OKR
|
|
@@ -376,10 +386,11 @@ function generateDefaultYaml(agents) {
|
|
|
376
386
|
description: "${a.description}"
|
|
377
387
|
options:
|
|
378
388
|
query:
|
|
379
|
-
|
|
389
|
+
mode: "${a.options.query.mode}"
|
|
390
|
+
effort: "${a.options.query.effort}"
|
|
380
391
|
execute:
|
|
381
|
-
|
|
382
|
-
|
|
392
|
+
mode: "${a.options.execute.mode}"
|
|
393
|
+
effort: "${a.options.execute.effort}"
|
|
383
394
|
inline:
|
|
384
395
|
model: "${a.inline.model}"
|
|
385
396
|
prompt: |
|
|
@@ -397,6 +408,46 @@ ${agentBlocks}
|
|
|
397
408
|
# crewx agent ls
|
|
398
409
|
`;
|
|
399
410
|
}
|
|
411
|
+
function isInitProvider(value) {
|
|
412
|
+
return value === 'cli/claude' || value === 'cli/codex';
|
|
413
|
+
}
|
|
414
|
+
function invalidProviderError(value) {
|
|
415
|
+
if (value === undefined || value.length === 0) {
|
|
416
|
+
return new Error('Missing --provider value. Expected: cli/claude | cli/codex');
|
|
417
|
+
}
|
|
418
|
+
return new Error(`Invalid --provider value: "${value}". Expected: cli/claude | cli/codex`);
|
|
419
|
+
}
|
|
420
|
+
/** Parse the provider option accepted by `crewx init`. */
|
|
421
|
+
function parseInitProvider(args) {
|
|
422
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
423
|
+
const arg = args[index];
|
|
424
|
+
if (arg === '--provider') {
|
|
425
|
+
const value = args[index + 1];
|
|
426
|
+
if (value === undefined || value.startsWith('--'))
|
|
427
|
+
throw invalidProviderError(undefined);
|
|
428
|
+
if (!isInitProvider(value))
|
|
429
|
+
throw invalidProviderError(value);
|
|
430
|
+
return value;
|
|
431
|
+
}
|
|
432
|
+
if (arg?.startsWith('--provider=')) {
|
|
433
|
+
const value = arg.slice('--provider='.length);
|
|
434
|
+
if (!isInitProvider(value))
|
|
435
|
+
throw invalidProviderError(value);
|
|
436
|
+
return value;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return undefined;
|
|
440
|
+
}
|
|
441
|
+
/** Resolve an explicit provider or detect Claude, then Codex, using PATH only. */
|
|
442
|
+
function resolveInitProvider(provider, deps = {}) {
|
|
443
|
+
if (provider !== undefined)
|
|
444
|
+
return provider;
|
|
445
|
+
if ((0, sdk_1.isProviderAvailable)('cli/claude', deps))
|
|
446
|
+
return 'cli/claude';
|
|
447
|
+
if ((0, sdk_1.isProviderAvailable)('cli/codex', deps))
|
|
448
|
+
return 'cli/codex';
|
|
449
|
+
return 'cli/claude';
|
|
450
|
+
}
|
|
400
451
|
/**
|
|
401
452
|
* Programmatic init — creates crewx.yaml, support dirs, and optionally installs hooks.
|
|
402
453
|
* Throws on unrecoverable errors (PATH_NOT_FOUND, YAML_CREATE_FAILED).
|
|
@@ -405,7 +456,8 @@ ${agentBlocks}
|
|
|
405
456
|
* server paths both produce a row in ~/.crewx/crewx.db.
|
|
406
457
|
*/
|
|
407
458
|
async function handleInit(opts) {
|
|
408
|
-
const { path: target, skipHook = false, force = false } = opts;
|
|
459
|
+
const { path: target, skipHook = false, force = false, provider: requestedProvider } = opts;
|
|
460
|
+
const provider = resolveInitProvider(requestedProvider);
|
|
409
461
|
const errors = [];
|
|
410
462
|
let yamlCreated = false;
|
|
411
463
|
let hookInstalled = false;
|
|
@@ -423,7 +475,7 @@ async function handleInit(opts) {
|
|
|
423
475
|
}
|
|
424
476
|
if (!skippedReason) {
|
|
425
477
|
try {
|
|
426
|
-
const content = generateDefaultYaml(
|
|
478
|
+
const content = generateDefaultYaml(buildDefaultAgents(provider));
|
|
427
479
|
(0, fs_1.writeFileSync)(yamlPath, content, 'utf-8');
|
|
428
480
|
yamlCreated = true;
|
|
429
481
|
}
|
|
@@ -508,7 +560,7 @@ async function handleInit(opts) {
|
|
|
508
560
|
await initGitRepo(target, errors);
|
|
509
561
|
// Idempotent statusLine merge into ~/.claude/settings.json
|
|
510
562
|
const statusLineResult = ensureClaudeStatusLine();
|
|
511
|
-
return { yamlCreated, hookInstalled, errors, skippedReason, workspaceId, slug, ...statusLineResult };
|
|
563
|
+
return { yamlCreated, hookInstalled, errors, provider, skippedReason, workspaceId, slug, ...statusLineResult };
|
|
512
564
|
}
|
|
513
565
|
function ensureClaudeStatusLine() {
|
|
514
566
|
const home = os_1.default.homedir();
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { handleInit, type InitResult } from './commands/init';
|
|
1
|
+
export { buildDefaultAgents, handleInit, parseInitProvider, resolveInitProvider, type InitProvider, type InitResult, } from './commands/init';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleInit = void 0;
|
|
3
|
+
exports.resolveInitProvider = exports.parseInitProvider = exports.handleInit = exports.buildDefaultAgents = void 0;
|
|
4
4
|
var init_1 = require("./commands/init");
|
|
5
|
+
Object.defineProperty(exports, "buildDefaultAgents", { enumerable: true, get: function () { return init_1.buildDefaultAgents; } });
|
|
5
6
|
Object.defineProperty(exports, "handleInit", { enumerable: true, get: function () { return init_1.handleInit; } });
|
|
7
|
+
Object.defineProperty(exports, "parseInitProvider", { enumerable: true, get: function () { return init_1.parseInitProvider; } });
|
|
8
|
+
Object.defineProperty(exports, "resolveInitProvider", { enumerable: true, get: function () { return init_1.resolveInitProvider; } });
|
package/dist/main.js
CHANGED
|
@@ -48,6 +48,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
// Must run before any other code that might use process.env.CREWX_CLI.
|
|
49
49
|
const sdk_compat_1 = require("./utils/sdk-compat");
|
|
50
50
|
const account_1 = require("@crewx/sdk/account");
|
|
51
|
+
const sdk_1 = require("@crewx/sdk");
|
|
51
52
|
const inherited_trace_1 = require("./utils/inherited-trace");
|
|
52
53
|
process.env.CREWX_CLI ??= sdk_compat_1.sdkCompat.resolveCrewxCli();
|
|
53
54
|
process.env.CREWX_WORKSPACE ??= sdk_compat_1.sdkCompat.resolveCrewxWorkspace();
|
|
@@ -171,7 +172,8 @@ async function main(emitState) {
|
|
|
171
172
|
const initArgs = args.slice(1);
|
|
172
173
|
const force = initArgs.includes('--force') || initArgs.includes('-f');
|
|
173
174
|
try {
|
|
174
|
-
const
|
|
175
|
+
const provider = (0, init_1.parseInitProvider)(initArgs);
|
|
176
|
+
const r = await (0, init_1.handleInit)({ path: process.cwd(), force, provider });
|
|
175
177
|
if (r.skippedReason === 'yaml-exists') {
|
|
176
178
|
console.log('✓ crewx.yaml already exists (use --force to overwrite)');
|
|
177
179
|
}
|
|
@@ -181,6 +183,10 @@ async function main(emitState) {
|
|
|
181
183
|
if (r.errors.length > 0)
|
|
182
184
|
console.warn('Warnings:', r.errors.join('; '));
|
|
183
185
|
}
|
|
186
|
+
const profile = (0, sdk_1.getDefaultAgentProfile)(r.provider);
|
|
187
|
+
if (profile) {
|
|
188
|
+
console.log(`✓ default agents: ${r.provider} (${profile.planner.model} / ${profile.worker.model})`);
|
|
189
|
+
}
|
|
184
190
|
if (r.workspaceId)
|
|
185
191
|
console.log(`✓ workspace registered (id=${r.workspaceId}, slug=${r.slug})`);
|
|
186
192
|
console.log('✓ done');
|
|
@@ -317,7 +323,7 @@ Task Management:
|
|
|
317
323
|
Logs & Diagnostics:
|
|
318
324
|
log [ls|<task-id>] View task logs
|
|
319
325
|
doctor [--config <path>] Run system diagnosis
|
|
320
|
-
init [--force] [--
|
|
326
|
+
init [--force] [--provider cli/claude|cli/codex] Initialize crewx.yaml
|
|
321
327
|
|
|
322
328
|
Database:
|
|
323
329
|
db push Sync DB schema to current code (additive only)
|
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.106",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"better-sqlite3": "*",
|
|
26
26
|
"dotenv": "17.2.3",
|
|
27
27
|
"isomorphic-git": "1.37.1",
|
|
28
|
-
"@crewx/
|
|
29
|
-
"@crewx/
|
|
30
|
-
"@crewx/
|
|
31
|
-
"@crewx/
|
|
32
|
-
"@crewx/
|
|
33
|
-
"@crewx/
|
|
28
|
+
"@crewx/knowledge-core": "0.1.17-rc.116",
|
|
29
|
+
"@crewx/sdk": "0.9.0-rc.106",
|
|
30
|
+
"@crewx/memory": "0.1.23-rc.123",
|
|
31
|
+
"@crewx/search": "0.1.10-rc.102",
|
|
32
|
+
"@crewx/doc": "0.1.9-rc.99",
|
|
33
|
+
"@crewx/wbs": "0.1.10-rc.132",
|
|
34
|
+
"@crewx/workflow": "0.3.22-rc.152",
|
|
35
|
+
"@crewx/cron": "0.1.10-rc.141",
|
|
36
|
+
"@crewx/wi": "0.1.10-rc.126",
|
|
34
37
|
"@crewx/skill": "0.1.20",
|
|
35
|
-
"@crewx/
|
|
36
|
-
"@crewx/
|
|
37
|
-
"@crewx/notify": "0.1.0-rc.76",
|
|
38
|
-
"@crewx/knowledge-core": "0.1.17-rc.115",
|
|
39
|
-
"@crewx/chromex": "0.1.0-rc.138",
|
|
38
|
+
"@crewx/chromex": "0.1.0-rc.139",
|
|
39
|
+
"@crewx/notify": "0.1.0-rc.77",
|
|
40
40
|
"@crewx/shared": "0.0.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|