@cargo-ai/cli 1.0.45 → 1.0.47
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/README.md +50 -10
- package/build/api.d.ts +2 -1
- package/build/api.d.ts.map +1 -1
- package/build/api.js +5 -1
- package/build/commands/auth/auth0.d.ts +33 -0
- package/build/commands/auth/auth0.d.ts.map +1 -0
- package/build/commands/auth/auth0.js +90 -0
- package/build/commands/auth/email.d.ts +16 -0
- package/build/commands/auth/email.d.ts.map +1 -0
- package/build/commands/auth/email.js +93 -0
- package/build/commands/auth/index.d.ts +19 -1
- package/build/commands/auth/index.d.ts.map +1 -1
- package/build/commands/auth/index.js +121 -59
- package/build/commands/auth/loginChannel.d.ts +21 -0
- package/build/commands/auth/loginChannel.d.ts.map +1 -0
- package/build/commands/auth/loginChannel.js +42 -0
- package/build/commands/auth/oauth.d.ts +2 -6
- package/build/commands/auth/oauth.d.ts.map +1 -1
- package/build/commands/auth/oauth.js +54 -91
- package/build/commands/auth/passwordless.d.ts +22 -0
- package/build/commands/auth/passwordless.d.ts.map +1 -0
- package/build/commands/auth/passwordless.js +70 -0
- package/build/commands/auth/session.d.ts +21 -0
- package/build/commands/auth/session.d.ts.map +1 -0
- package/build/commands/auth/session.js +55 -0
- package/build/commands/auth/workspace.d.ts +9 -1
- package/build/commands/auth/workspace.d.ts.map +1 -1
- package/build/commands/auth/workspace.js +42 -69
- package/build/commands/billing/addPaymentMethod.d.ts +26 -0
- package/build/commands/billing/addPaymentMethod.d.ts.map +1 -0
- package/build/commands/billing/addPaymentMethod.js +57 -0
- package/build/commands/billing/subscription.d.ts.map +1 -1
- package/build/commands/billing/subscription.js +28 -1
- package/build/commands/doctor.js +3 -3
- package/build/commands/mcp.d.ts.map +1 -1
- package/build/commands/mcp.js +35 -8
- package/build/commands/runHandler.d.ts +6 -0
- package/build/commands/runHandler.d.ts.map +1 -1
- package/build/commands/runHandler.js +34 -4
- package/build/config.d.ts +22 -1
- package/build/config.d.ts.map +1 -1
- package/build/config.js +44 -3
- package/build/credentials.d.ts +1 -10
- package/build/credentials.d.ts.map +1 -1
- package/build/credentials.js +4 -34
- package/build/index.js +14 -7
- package/build/oauthConfig.d.ts +1 -6
- package/build/oauthConfig.d.ts.map +1 -1
- package/build/oauthConfig.js +9 -14
- package/build/utils/openBrowser.d.ts +7 -0
- package/build/utils/openBrowser.d.ts.map +1 -0
- package/build/utils/openBrowser.js +29 -0
- package/build/utils/prompt.d.ts +12 -0
- package/build/utils/prompt.d.ts.map +1 -0
- package/build/utils/prompt.js +38 -0
- package/package.json +6 -4
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as readline from "node:readline/promises";
|
|
3
|
+
import * as tty from "node:tty";
|
|
4
|
+
// Interactive prompts must not assume stdin is a terminal: `curl | sh`
|
|
5
|
+
// installers and agent-driven shells pipe stdin while the controlling
|
|
6
|
+
// terminal stays reachable via /dev/tty. Prefer stdin when it is a TTY,
|
|
7
|
+
// otherwise fall back to opening /dev/tty directly.
|
|
8
|
+
export function openPromptInput() {
|
|
9
|
+
if (process.stdin.isTTY === true) {
|
|
10
|
+
return { stream: process.stdin, close: () => undefined };
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const fd = fs.openSync("/dev/tty", "r");
|
|
14
|
+
const stream = new tty.ReadStream(fd);
|
|
15
|
+
return { stream, close: () => stream.destroy() };
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Asks a single question on the controlling terminal. Prompts are written to
|
|
23
|
+
* stderr so that piping stdout to `jq` keeps working.
|
|
24
|
+
*/
|
|
25
|
+
export async function askQuestion(input, question) {
|
|
26
|
+
const rl = readline.createInterface({ input, output: process.stderr });
|
|
27
|
+
try {
|
|
28
|
+
const answer = await rl.question(question);
|
|
29
|
+
const trimmed = answer.trim();
|
|
30
|
+
if (trimmed === "") {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return trimmed;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
rl.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cargo-ai/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "Command-line interface for the Cargo API",
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"build": "tsc --build",
|
|
24
24
|
"dev": "tsx watch src/index.ts",
|
|
25
25
|
"start": "node build/index.js",
|
|
26
|
+
"test": "npm run build && node --test \"test/**/*.test.mjs\"",
|
|
27
|
+
"test:watch": "node --test --watch \"test/**/*.test.mjs\"",
|
|
26
28
|
"type:check": "tsc --noEmit",
|
|
27
29
|
"lint": "eslint ./ --fix",
|
|
28
30
|
"lint:check": "eslint ./ --max-warnings=0",
|
|
@@ -30,10 +32,10 @@
|
|
|
30
32
|
"format:check": "prettier --check ."
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
|
-
"@cargo-ai/api": "^1.0.
|
|
35
|
+
"@cargo-ai/api": "^1.0.57",
|
|
34
36
|
"@cargo-ai/app-sdk": "^1.0.5",
|
|
35
|
-
"@cargo-ai/cdk": "
|
|
36
|
-
"@cargo-ai/types": "
|
|
37
|
+
"@cargo-ai/cdk": "^1.0.43",
|
|
38
|
+
"@cargo-ai/types": "^1.0.56",
|
|
37
39
|
"@cargo-ai/worker-sdk": "^1.0.11",
|
|
38
40
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
39
41
|
"commander": "^12.1.0",
|