@crewx/cli 0.8.0-rc.91 → 0.8.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.
|
@@ -4,8 +4,13 @@ import { Crewx } from '@crewx/sdk';
|
|
|
4
4
|
* and built-in tools registered. Use this from any CLI command that needs a
|
|
5
5
|
* Crewx instance — keeps environment consistent across query / execute / slack / agent.
|
|
6
6
|
*
|
|
7
|
-
* workspaceRoot
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* workspaceRoot is always process.cwd()-based so that per-workspace logs land
|
|
8
|
+
* in {cwd}/.crewx/logs/. Critical for file:// remote agent delegation.
|
|
9
|
+
*
|
|
10
|
+
* Behavior:
|
|
11
|
+
* - If configPath resolves to an existing file → load it (with built-ins merged)
|
|
12
|
+
* - If configPath is NOT set via CREWX_CONFIG env AND the file doesn't exist →
|
|
13
|
+
* fall back to built-in-only mode (no user yaml required)
|
|
14
|
+
* - If CREWX_CONFIG is explicitly set AND the file doesn't exist → throw
|
|
10
15
|
*/
|
|
11
16
|
export declare function createCliCrewx(configPath?: string): Promise<Crewx>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCliCrewx = createCliCrewx;
|
|
4
|
+
const fs_1 = require("fs");
|
|
4
5
|
const path_1 = require("path");
|
|
5
6
|
const sdk_1 = require("@crewx/sdk");
|
|
6
7
|
const plugins_1 = require("@crewx/sdk/plugins");
|
|
@@ -11,17 +12,37 @@ const version_1 = require("../utils/version");
|
|
|
11
12
|
* and built-in tools registered. Use this from any CLI command that needs a
|
|
12
13
|
* Crewx instance — keeps environment consistent across query / execute / slack / agent.
|
|
13
14
|
*
|
|
14
|
-
* workspaceRoot
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* workspaceRoot is always process.cwd()-based so that per-workspace logs land
|
|
16
|
+
* in {cwd}/.crewx/logs/. Critical for file:// remote agent delegation.
|
|
17
|
+
*
|
|
18
|
+
* Behavior:
|
|
19
|
+
* - If configPath resolves to an existing file → load it (with built-ins merged)
|
|
20
|
+
* - If configPath is NOT set via CREWX_CONFIG env AND the file doesn't exist →
|
|
21
|
+
* fall back to built-in-only mode (no user yaml required)
|
|
22
|
+
* - If CREWX_CONFIG is explicitly set AND the file doesn't exist → throw
|
|
17
23
|
*/
|
|
18
24
|
async function createCliCrewx(configPath = process.env.CREWX_CONFIG ?? 'crewx.yaml') {
|
|
19
25
|
const absConfigPath = (0, path_1.resolve)(configPath);
|
|
20
|
-
|
|
26
|
+
// workspaceRoot is always cwd-based, never package-internal
|
|
27
|
+
const workspaceRoot = process.cwd();
|
|
28
|
+
const isExplicitConfig = Boolean(process.env.CREWX_CONFIG);
|
|
29
|
+
const fileExists = (0, fs_1.existsSync)(absConfigPath);
|
|
30
|
+
let yamlPath;
|
|
31
|
+
if (fileExists) {
|
|
32
|
+
yamlPath = absConfigPath;
|
|
33
|
+
}
|
|
34
|
+
else if (isExplicitConfig) {
|
|
35
|
+
// Explicit config was set but file doesn't exist — throw
|
|
36
|
+
throw new Error(`[crewx] Config file not found: ${absConfigPath} (set via CREWX_CONFIG)`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// No explicit config and file doesn't exist — built-in-only mode
|
|
40
|
+
yamlPath = undefined;
|
|
41
|
+
}
|
|
21
42
|
// Pass ourselves back to the SDK: when this Crewx encounters a file:// remote
|
|
22
43
|
// agent, the SDK uses this factory to bootstrap the target Crewx instance
|
|
23
44
|
// with the same plugin set (FileLogger + SqliteTracing + built-in tools).
|
|
24
|
-
const crewx = await sdk_1.Crewx.loadYaml(
|
|
45
|
+
const crewx = await sdk_1.Crewx.loadYaml(yamlPath, {
|
|
25
46
|
remoteFactory: createCliCrewx,
|
|
26
47
|
});
|
|
27
48
|
(0, register_builtin_tools_1.registerBuiltinToolsIfNeeded)(crewx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/cli",
|
|
3
|
-
"version": "0.8.0
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@crewx/adapter-slack": "0.1.3",
|
|
29
29
|
"better-sqlite3": "*",
|
|
30
|
-
"@crewx/sdk": "0.8.0
|
|
31
|
-
"@crewx/memory": "0.1.9",
|
|
32
|
-
"@crewx/search": "0.1.7",
|
|
30
|
+
"@crewx/sdk": "0.8.0",
|
|
33
31
|
"@crewx/doc": "0.1.7",
|
|
32
|
+
"@crewx/wbs": "0.1.8",
|
|
33
|
+
"@crewx/search": "0.1.8",
|
|
34
34
|
"@crewx/cron": "0.1.7",
|
|
35
|
+
"@crewx/memory": "0.1.9",
|
|
35
36
|
"@crewx/workflow": "0.3.7",
|
|
36
|
-
"@crewx/wbs": "0.1.8",
|
|
37
37
|
"@crewx/skill": "0.1.6",
|
|
38
38
|
"@crewx/shared": "0.0.4"
|
|
39
39
|
},
|