@crewx/cli 0.9.0-rc.2 → 0.9.0-rc.200
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 +64 -0
- package/dist/bootstrap/codex-writable-roots.js +1 -0
- package/dist/bootstrap/crewx-cli.js +1 -61
- package/dist/bootstrap/rate-limit-snapshot.d.ts +15 -0
- package/dist/bootstrap/rate-limit-snapshot.js +1 -0
- package/dist/builtin.d.ts +1 -1
- package/dist/builtin.js +5 -127
- package/dist/commands/agent.d.ts +1 -0
- package/dist/commands/agent.js +3 -246
- package/dist/commands/ai-account.d.ts +16 -0
- package/dist/commands/ai-account.js +38 -0
- package/dist/commands/cal.d.ts +15 -0
- package/dist/commands/cal.js +2 -0
- package/dist/commands/command-help.d.ts +28 -0
- package/dist/commands/command-help.js +87 -0
- package/dist/commands/db.d.ts +3 -0
- package/dist/commands/db.js +59 -125
- package/dist/commands/detached.d.ts +121 -0
- package/dist/commands/detached.js +15 -0
- package/dist/commands/doctor.d.ts +77 -0
- package/dist/commands/doctor.js +4 -196
- package/dist/commands/emit-trailer.d.ts +25 -0
- package/dist/commands/emit-trailer.js +2 -0
- package/dist/commands/execute.d.ts +8 -4
- package/dist/commands/execute.js +15 -138
- package/dist/commands/history.d.ts +18 -0
- package/dist/commands/history.js +2 -0
- package/dist/commands/hook/command-marker.d.ts +2 -0
- package/dist/commands/hook/command-marker.js +1 -0
- package/dist/commands/hook/install.d.ts +0 -1
- package/dist/commands/hook/install.js +8 -175
- package/dist/commands/hook/paths.js +1 -94
- package/dist/commands/hook/status.js +1 -86
- package/dist/commands/hook/uninstall.js +1 -71
- package/dist/commands/hook-dispatch.js +2 -180
- package/dist/commands/init.d.ts +34 -0
- package/dist/commands/init.js +38 -371
- package/dist/commands/kill.d.ts +2 -8
- package/dist/commands/kill.js +1 -52
- package/dist/commands/log.js +3 -95
- package/dist/commands/parse-agent-message.js +1 -52
- package/dist/commands/parse-common-flags.d.ts +10 -2
- package/dist/commands/parse-common-flags.js +3 -174
- package/dist/commands/ps.d.ts +2 -2
- package/dist/commands/ps.js +2 -59
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +27 -0
- package/dist/commands/query.d.ts +7 -2
- package/dist/commands/query.js +16 -138
- package/dist/commands/registry.js +1 -31
- package/dist/commands/resolve-prompt.js +3 -54
- package/dist/commands/resolve-recipient.d.ts +14 -0
- package/dist/commands/resolve-recipient.js +3 -0
- package/dist/commands/restart.d.ts +3 -1
- package/dist/commands/restart.js +18 -148
- package/dist/commands/result.d.ts +8 -3
- package/dist/commands/result.js +1 -70
- package/dist/commands/shortcut.d.ts +1 -0
- package/dist/commands/shortcut.js +18 -0
- package/dist/commands/slack.js +16 -559
- package/dist/commands/stop.d.ts +8 -0
- package/dist/commands/stop.js +8 -0
- package/dist/commands/write-output.d.ts +3 -0
- package/dist/commands/write-output.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -5
- package/dist/logging.d.ts +1 -1
- package/dist/logging.js +10 -86
- package/dist/main.d.ts +3 -2
- package/dist/main.js +52 -247
- package/dist/register-builtin-tools.js +1 -9
- package/dist/slack/file-download.js +1 -134
- package/dist/slack/markdown.js +1 -33
- package/dist/utils/env-defaults.d.ts +2 -5
- package/dist/utils/env-defaults.js +1 -10
- package/dist/utils/inherited-trace.d.ts +24 -0
- package/dist/utils/inherited-trace.js +1 -25
- package/dist/utils/product-package-root.d.ts +6 -0
- package/dist/utils/product-package-root.js +1 -0
- package/dist/utils/sdk-compat.d.ts +24 -0
- package/dist/utils/sdk-compat.js +1 -0
- package/dist/utils/version.js +1 -28
- package/package.json +16 -12
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Re-exported from @crewx/sdk for convenience.
|
|
4
|
-
*/
|
|
5
|
-
export { resolveCrewxCli, resolveCrewxWorkspace } from '@crewx/sdk';
|
|
1
|
+
export declare function resolveCrewxCli(): string;
|
|
2
|
+
export declare function resolveCrewxWorkspace(): string;
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveCrewxWorkspace = exports.resolveCrewxCli = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* CREWX_* environment variable defaults for CLI bootstrap.
|
|
6
|
-
* Re-exported from @crewx/sdk for convenience.
|
|
7
|
-
*/
|
|
8
|
-
var sdk_1 = require("@crewx/sdk");
|
|
9
|
-
Object.defineProperty(exports, "resolveCrewxCli", { enumerable: true, get: function () { return sdk_1.resolveCrewxCli; } });
|
|
10
|
-
Object.defineProperty(exports, "resolveCrewxWorkspace", { enumerable: true, get: function () { return sdk_1.resolveCrewxWorkspace; } });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveCrewxCli=r;exports.resolveCrewxWorkspace=o;const e=require("./sdk-compat");function r(){return e.sdkCompat.resolveCrewxCli()}function o(){return e.sdkCompat.resolveCrewxWorkspace()}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import type { TraceContext } from '@crewx/sdk';
|
|
2
|
+
export interface InheritedRunnerIdentity {
|
|
3
|
+
assignedTaskId?: string;
|
|
4
|
+
detachedRunner: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Consume the runner-only identity exactly once.
|
|
8
|
+
*
|
|
9
|
+
* These variables are a one-hop capability, not trace context. Keeping the
|
|
10
|
+
* values in this module lets the current CLI process use them while deleting
|
|
11
|
+
* them from process.env prevents later child processes from inheriting the
|
|
12
|
+
* receipt runner identity.
|
|
13
|
+
*/
|
|
14
|
+
export declare function consumeInheritedRunnerIdentity(): InheritedRunnerIdentity;
|
|
15
|
+
/** Test-only reset for the module-level one-shot cache. */
|
|
16
|
+
export declare function resetInheritedRunnerIdentityForTests(): void;
|
|
2
17
|
/**
|
|
3
18
|
* Read cross-process trace context from inherited environment variables.
|
|
4
19
|
*
|
|
@@ -10,3 +25,12 @@ import type { TraceContext } from '@crewx/sdk';
|
|
|
10
25
|
* Returns undefined when none of the three vars are set (root invocation).
|
|
11
26
|
*/
|
|
12
27
|
export declare function readInheritedTrace(): TraceContext | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Read the pre-assigned task id carried only by a detached runner.
|
|
30
|
+
*
|
|
31
|
+
* This is deliberately separate from readInheritedTrace(): trace variables
|
|
32
|
+
* describe the caller's chain and must not be used as this task's identity.
|
|
33
|
+
*/
|
|
34
|
+
export declare function readRunnerAssignment(): string | undefined;
|
|
35
|
+
/** Return true only for the final detached runner process. */
|
|
36
|
+
export declare function isDetachedRunner(): boolean;
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readInheritedTrace = readInheritedTrace;
|
|
4
|
-
/**
|
|
5
|
-
* Read cross-process trace context from inherited environment variables.
|
|
6
|
-
*
|
|
7
|
-
* This is the ONLY place in the CLI that reads CREWX_PARENT_TASK_ID /
|
|
8
|
-
* CREWX_TRACE_ID / CREWX_CALLER_AGENT_ID. The values are passed as
|
|
9
|
-
* options.trace into crewx.query/execute so the SDK's ALS takes over
|
|
10
|
-
* from there — no direct env reads inside SDK code.
|
|
11
|
-
*
|
|
12
|
-
* Returns undefined when none of the three vars are set (root invocation).
|
|
13
|
-
*/
|
|
14
|
-
function readInheritedTrace() {
|
|
15
|
-
const parentTaskId = process.env['CREWX_PARENT_TASK_ID'] || null;
|
|
16
|
-
const rootTraceId = process.env['CREWX_TRACE_ID'] || null;
|
|
17
|
-
const callerAgentId = process.env['CREWX_CALLER_AGENT_ID'] || null;
|
|
18
|
-
if (!parentTaskId && !rootTraceId && !callerAgentId)
|
|
19
|
-
return undefined;
|
|
20
|
-
return {
|
|
21
|
-
parentTaskId,
|
|
22
|
-
rootTraceId: rootTraceId ?? (parentTaskId ?? ''),
|
|
23
|
-
callerAgentId,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.consumeInheritedRunnerIdentity=t;exports.resetInheritedRunnerIdentityForTests=d;exports.readInheritedTrace=u;exports.readRunnerAssignment=i;exports.isDetachedRunner=c;let n;function t(){if(n!==void 0)return n;const e=process.env["CREWX_ASSIGNED_TASK_ID"]?.trim()||void 0;const r=process.env["CREWX_DETACHED_RUNNER"]==="1";delete process.env["CREWX_ASSIGNED_TASK_ID"];delete process.env["CREWX_DETACHED_RUNNER"];n={assignedTaskId:e,detachedRunner:r};return n}function d(){n=void 0}function u(){const e=process.env["CREWX_PARENT_TASK_ID"]||null;const r=process.env["CREWX_TRACE_ID"]||null;const s=process.env["CREWX_CALLER_AGENT_ID"]||null;if(!e&&!r&&!s)return void 0;return{parentTaskId:e,rootTraceId:r??(e??""),callerAgentId:s}}function i(){return t().assignedTaskId}function c(){return t().detachedRunner}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds the installed product root from the CLI entry file that is running.
|
|
3
|
+
* The real CLI path is walked to the first package named `crewx`, which must
|
|
4
|
+
* contain the compiled bundle helper. cwd and environment are deliberately ignored.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveProductRootFromCliEntry(cliEntryPath: string | undefined): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.resolveProductRootFromCliEntry=c;const t=require("node:fs");const n=require("node:path");const d=(0,n.join)("dist-server","common","product-app-bundle.js");function c(r){if(typeof r!=="string"||r.trim().length===0)return void 0;let o;try{o=(0,t.realpathSync)(r)}catch{return void 0}let e=(0,n.dirname)(o);while(true){try{const u=JSON.parse((0,t.readFileSync)((0,n.join)(e,"package.json"),"utf8"));if(u.name==="crewx"){return(0,t.existsSync)((0,n.join)(e,d))?e:void 0}}catch{}const i=(0,n.dirname)(e);if(i===e)return void 0;e=i}return void 0}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CrewxExecutableResolution } from '@crewx/sdk';
|
|
2
|
+
type PricingInitializer = () => Promise<unknown> | unknown;
|
|
3
|
+
export interface SdkLike {
|
|
4
|
+
resolveCrewxCli?: () => string;
|
|
5
|
+
resolveCrewxCliArgv?: () => CrewxExecutableResolution;
|
|
6
|
+
resolveCrewxWorkspace?: () => string;
|
|
7
|
+
initPricingRemote?: PricingInitializer;
|
|
8
|
+
}
|
|
9
|
+
export interface SdkCompat {
|
|
10
|
+
resolveCrewxCli(): string;
|
|
11
|
+
resolveCrewxCliArgv(): CrewxExecutableResolution;
|
|
12
|
+
resolveCrewxWorkspace(): string;
|
|
13
|
+
initPricingRemote(): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create the CLI bootstrap capability accessor for the installed SDK.
|
|
17
|
+
*
|
|
18
|
+
* SDK exports are additive across compatible majors, so an older SDK may not
|
|
19
|
+
* expose every capability that a newer CLI knows about. Optional capabilities
|
|
20
|
+
* are checked here rather than at each bootstrap call site.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createSdkCompat(sdkLike?: SdkLike): SdkCompat;
|
|
23
|
+
export declare const sdkCompat: SdkCompat;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=exports&&exports.__createBinding||(Object.create?(function(e,r,t,n){if(n===void 0)n=t;var i=Object.getOwnPropertyDescriptor(r,t);if(!i||("get"in i?!r.__esModule:i.writable||i.configurable)){i={enumerable:true,get:function(){return r[t]}}}Object.defineProperty(e,n,i)}):(function(e,r,t,n){if(n===void 0)n=t;e[n]=r[t]}));var u=exports&&exports.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}):function(e,r){e["default"]=r});var c=exports&&exports.__importStar||(function(){var e=function(r){e=Object.getOwnPropertyNames||function(t){var n=[];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))n[n.length]=i;return n};return e(r)};return function(r){if(r&&r.__esModule)return r;var t={};if(r!=null){for(var n=e(r),i=0;i<n.length;i++)if(n[i]!=="default")l(t,r,n[i])}u(t,r);return t}})();Object.defineProperty(exports,"__esModule",{value:true});exports.sdkCompat=void 0;exports.createSdkCompat=o;const a=c(require("@crewx/sdk"));function s(e){const r=a.formatCrewxExecutableArgv;if(typeof r==="function")return r(e);if(process.platform==="win32"){return e.map(t=>{const n=t.replace(/(\\*)"/g,'$1$1\\"').replace(/(\\+)$/g,"$1$1");return`"${n}"`}).join(" ")}return e.map(t=>`'${t.replace(/'/g,`'\\''`)}'`).join(" ")}const f="crewx";function v(){return{ok:false,reason:"The installed SDK does not expose the argv-based CrewX CLI resolver.",attempts:[{stage:"env",reason:"argv resolver capability is unavailable"},{stage:"self",reason:"argv resolver capability is unavailable"},{stage:"workspace",reason:"argv resolver capability is unavailable"},{stage:"module",reason:"argv resolver capability is unavailable"},{stage:"path",reason:"argv resolver capability is unavailable"}]}}function o(e=a){return{resolveCrewxCli:()=>{const r=process.env.CREWX_CLI;if(r?.trim())return r;if(typeof e.resolveCrewxCliArgv==="function"){const t=e.resolveCrewxCliArgv();if(t.ok)return s(t.argv)}if(typeof e.resolveCrewxCli==="function"){const t=e.resolveCrewxCli();if(t.trim())return t}return f},resolveCrewxCliArgv:()=>{if(typeof e.resolveCrewxCliArgv==="function"){return e.resolveCrewxCliArgv()}return v()},resolveCrewxWorkspace:()=>{if(typeof e.resolveCrewxWorkspace==="function"){return e.resolveCrewxWorkspace()}return process.env.CREWX_WORKSPACE||process.cwd()},initPricingRemote:()=>{if(typeof e.initPricingRemote!=="function")return;try{void Promise.resolve(e.initPricingRemote()).catch(()=>void 0)}catch{}}}}exports.sdkCompat=o();
|
package/dist/utils/version.js
CHANGED
|
@@ -1,28 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_VERSION = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
/**
|
|
7
|
-
* Return the installed @crewx/cli package version.
|
|
8
|
-
*
|
|
9
|
-
* Resolution strategy (mirrors cli-bak version.ts):
|
|
10
|
-
* 1. Read the package.json that is co-located with the compiled dist tree.
|
|
11
|
-
* At runtime __dirname resolves to dist/utils/, so ../../package.json
|
|
12
|
-
* reaches the package root — both in development and in an npm-installed
|
|
13
|
-
* deployment (node_modules/@crewx/cli/package.json).
|
|
14
|
-
* 2. Fall back to '0.0.0' on any I/O or parse error.
|
|
15
|
-
*
|
|
16
|
-
* Result is cached in the module-level constant to avoid repeated disk reads.
|
|
17
|
-
*/
|
|
18
|
-
function readVersion() {
|
|
19
|
-
try {
|
|
20
|
-
const pkgPath = (0, path_1.join)(__dirname, '../../package.json');
|
|
21
|
-
const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
|
|
22
|
-
return pkg.version ?? '0.0.0';
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return '0.0.0';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.CLI_VERSION = readVersion();
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CLI_VERSION=void 0;const t=require("fs");const n=require("path");function o(){try{const e=(0,n.join)(__dirname,"../../package.json");const r=JSON.parse((0,t.readFileSync)(e,"utf8"));return r.version??"0.0.0"}catch{return"0.0.0"}}exports.CLI_VERSION=o();
|
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.200",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -23,18 +23,22 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@crewx/adapter-slack": "0.1.4",
|
|
25
25
|
"better-sqlite3": "*",
|
|
26
|
+
"dotenv": "17.2.3",
|
|
26
27
|
"isomorphic-git": "1.37.1",
|
|
27
|
-
"@crewx/
|
|
28
|
-
"@crewx/
|
|
29
|
-
"@crewx/
|
|
30
|
-
"@crewx/
|
|
31
|
-
"@crewx/
|
|
32
|
-
"@crewx/
|
|
33
|
-
"@crewx/
|
|
34
|
-
"@crewx/
|
|
35
|
-
"@crewx/
|
|
36
|
-
"@crewx/
|
|
37
|
-
"@crewx/
|
|
28
|
+
"@crewx/sdk": "0.9.0-rc.200",
|
|
29
|
+
"@crewx/search": "0.1.10-rc.196",
|
|
30
|
+
"@crewx/knowledge-core": "0.1.17-rc.210",
|
|
31
|
+
"@crewx/memory": "0.1.23-rc.217",
|
|
32
|
+
"@crewx/wbs": "0.1.10-rc.226",
|
|
33
|
+
"@crewx/skill": "0.1.20-rc.94",
|
|
34
|
+
"@crewx/wi": "0.1.10-rc.220",
|
|
35
|
+
"@crewx/cron": "0.1.10-rc.235",
|
|
36
|
+
"@crewx/notify": "0.1.0-rc.171",
|
|
37
|
+
"@crewx/app": "0.1.0-rc.81",
|
|
38
|
+
"@crewx/workflow": "0.3.22-rc.246",
|
|
39
|
+
"@crewx/chromex": "0.1.0-rc.233",
|
|
40
|
+
"@crewx/shared": "0.0.6-rc.115",
|
|
41
|
+
"@crewx/doc": "0.1.9-rc.193"
|
|
38
42
|
},
|
|
39
43
|
"devDependencies": {
|
|
40
44
|
"@types/better-sqlite3": "*",
|