@gravity-rail/cli 0.7.1 → 0.7.3
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/account-verify-phone-TDQNZ5XN.js +41 -0
- package/dist/account-verify-phone-TDQNZ5XN.js.map +1 -0
- package/dist/{chunk-OPWCTOHP.js → chunk-7VZ4JLAJ.js} +11 -1
- package/dist/chunk-7VZ4JLAJ.js.map +1 -0
- package/dist/chunk-KTTHOL3B.js +758 -0
- package/dist/chunk-KTTHOL3B.js.map +1 -0
- package/dist/cli-utils.js +0 -1
- package/dist/{errors-4MAJGD3C.js → errors-VK4QO3QZ.js} +2 -3
- package/dist/gr.js +2051 -2164
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +19 -13
- package/dist/lib.js +7593 -6759
- package/dist/lib.js.map +1 -1
- package/package.json +3 -7
- package/dist/chunk-424PT5DM.js +0 -23
- package/dist/chunk-OPWCTOHP.js.map +0 -1
- package/dist/errors-4MAJGD3C.js.map +0 -1
- package/dist/register-special-commands.d.ts +0 -4
- package/dist/register-special-commands.js +0 -5525
- package/dist/register-special-commands.js.map +0 -1
- /package/dist/{chunk-424PT5DM.js.map → errors-VK4QO3QZ.js.map} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
confirmAccountPhoneVerify,
|
|
3
|
+
requireAuth,
|
|
4
|
+
startAccountPhoneVerify
|
|
5
|
+
} from "./chunk-KTTHOL3B.js";
|
|
6
|
+
import "./chunk-H62EC2CF.js";
|
|
7
|
+
import "./chunk-7VZ4JLAJ.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/account-verify-phone.ts
|
|
10
|
+
import * as readline from "readline/promises";
|
|
11
|
+
import { stdin as input, stdout as output } from "process";
|
|
12
|
+
var TCPA_NOTICE = "By verifying you agree to receive calls and SMS from Gravity Rail at this number.";
|
|
13
|
+
async function accountVerifyPhoneCommand(hctx) {
|
|
14
|
+
const ctx = requireAuth(hctx.ctx);
|
|
15
|
+
const phoneArg = typeof hctx.args.phone === "string" ? hctx.args.phone : void 0;
|
|
16
|
+
process.stderr.write(`${TCPA_NOTICE}
|
|
17
|
+
`);
|
|
18
|
+
const phone = phoneArg ?? await promptLine("Phone number (E.164, e.g. +15551234567): ");
|
|
19
|
+
if (!phone.trim()) {
|
|
20
|
+
throw new Error("Phone number is required");
|
|
21
|
+
}
|
|
22
|
+
await startAccountPhoneVerify(ctx, phone.trim());
|
|
23
|
+
process.stderr.write("Verification code sent via SMS.\n");
|
|
24
|
+
const code = await promptLine("Enter 6-digit code: ");
|
|
25
|
+
await confirmAccountPhoneVerify(ctx, code.trim());
|
|
26
|
+
process.stderr.write(
|
|
27
|
+
"Phone verified. You can use `gr concierge chat --call` or `gr concierge chat --sms`.\n"
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
async function promptLine(question) {
|
|
31
|
+
const rl = readline.createInterface({ input, output });
|
|
32
|
+
try {
|
|
33
|
+
return await rl.question(question) ?? "";
|
|
34
|
+
} finally {
|
|
35
|
+
rl.close();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
accountVerifyPhoneCommand
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=account-verify-phone-TDQNZ5XN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/account-verify-phone.ts"],"sourcesContent":["/**\n * `gr account verify-phone` — verify account phone for concierge PSTN/SMS.\n */\n\nimport * as readline from 'node:readline/promises';\nimport { stdin as input, stdout as output } from 'node:process';\nimport { confirmAccountPhoneVerify, startAccountPhoneVerify } from '../lib/concierge-api';\nimport { requireAuth } from '../lib/context';\nimport type { CommandHandlerContext } from '../lib/types';\n\nconst TCPA_NOTICE =\n 'By verifying you agree to receive calls and SMS from Gravity Rail at this number.';\n\nexport async function accountVerifyPhoneCommand(hctx: CommandHandlerContext): Promise<void> {\n const ctx = requireAuth(hctx.ctx);\n const phoneArg = typeof hctx.args.phone === 'string' ? hctx.args.phone : undefined;\n\n process.stderr.write(`${TCPA_NOTICE}\\n`);\n\n const phone = phoneArg ?? (await promptLine('Phone number (E.164, e.g. +15551234567): '));\n if (!phone.trim()) {\n throw new Error('Phone number is required');\n }\n\n await startAccountPhoneVerify(ctx, phone.trim());\n process.stderr.write('Verification code sent via SMS.\\n');\n\n const code = await promptLine('Enter 6-digit code: ');\n await confirmAccountPhoneVerify(ctx, code.trim());\n process.stderr.write(\n 'Phone verified. You can use `gr concierge chat --call` or `gr concierge chat --sms`.\\n'\n );\n}\n\nasync function promptLine(question: string): Promise<string> {\n const rl = readline.createInterface({ input, output });\n try {\n return (await rl.question(question)) ?? '';\n } finally {\n rl.close();\n }\n}\n"],"mappings":";;;;;;;;;AAIA,YAAY,cAAc;AAC1B,SAAS,SAAS,OAAO,UAAU,cAAc;AAKjD,IAAM,cACH;AAEH,eAAsB,0BAA0B,MAA4C;AACzF,QAAM,MAAM,YAAY,KAAK,GAAG;AAChC,QAAM,WAAW,OAAO,KAAK,KAAK,UAAU,WAAW,KAAK,KAAK,QAAQ;AAEzE,UAAQ,OAAO,MAAM,GAAG,WAAW;AAAA,CAAI;AAEvC,QAAM,QAAQ,YAAa,MAAM,WAAW,2CAA2C;AACvF,MAAI,CAAC,MAAM,KAAK,GAAG;AAChB,UAAM,IAAI,MAAM,0BAA0B;AAAA,EAC7C;AAEA,QAAM,wBAAwB,KAAK,MAAM,KAAK,CAAC;AAC/C,UAAQ,OAAO,MAAM,mCAAmC;AAExD,QAAM,OAAO,MAAM,WAAW,sBAAsB;AACpD,QAAM,0BAA0B,KAAK,KAAK,KAAK,CAAC;AAChD,UAAQ,OAAO;AAAA,IACZ;AAAA,EACH;AACH;AAEA,eAAe,WAAW,UAAmC;AAC1D,QAAM,KAAc,yBAAgB,EAAE,OAAO,OAAO,CAAC;AACrD,MAAI;AACD,WAAQ,MAAM,GAAG,SAAS,QAAQ,KAAM;AAAA,EAC3C,UAAE;AACC,OAAG,MAAM;AAAA,EACZ;AACH;","names":[]}
|
|
@@ -31,6 +31,16 @@ function handleError(err) {
|
|
|
31
31
|
process.stderr.write(
|
|
32
32
|
`
|
|
33
33
|
Hint: Run "gr login" to authenticate, or set GRAVITY_RAIL_API_KEY for non-interactive use.
|
|
34
|
+
`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if ("statusCode" in err && err.statusCode === 403 && process.env.GRAVITY_RAIL_SANDBOX === "1") {
|
|
38
|
+
process.stderr.write(
|
|
39
|
+
`
|
|
40
|
+
Hint: This is a write/admin operation and the sandbox token lacks the required scope.
|
|
41
|
+
Re-run the exec tool with the needed write scope, e.g.:
|
|
42
|
+
exec(code="<your gr command>", language="bash", scopes=["datatypes:write"])
|
|
43
|
+
Common scopes: datatypes:write, workflows:write, members:write, automations:admin, agents:write
|
|
34
44
|
`
|
|
35
45
|
);
|
|
36
46
|
}
|
|
@@ -46,4 +56,4 @@ export {
|
|
|
46
56
|
AuthRequiredError,
|
|
47
57
|
handleError
|
|
48
58
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-7VZ4JLAJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/errors.ts"],"sourcesContent":["export class CLIError extends Error {\n constructor(\n message: string,\n public exitCode: number = 1\n ) {\n super(message);\n this.name = 'CLIError';\n }\n}\n\nexport class AuthRequiredError extends CLIError {\n constructor(message = 'Not authenticated. Run `gr login` or set GRAVITY_RAIL_API_KEY.') {\n super(message, 2);\n this.name = 'AuthRequiredError';\n }\n}\n\nexport function handleError(err: unknown): never {\n if (err instanceof CLIError) {\n process.stderr.write(`Error: ${err.message}\\n`);\n process.exit(err.exitCode);\n }\n\n if (err instanceof Error) {\n process.stderr.write(`Error: ${err.message}\\n`);\n if ('errors' in err && Array.isArray((err as any).errors)) {\n for (const e of (err as any).errors) {\n process.stderr.write(` - ${e}\\n`);\n }\n }\n if ('statusCode' in err && (err as any).statusCode === 401) {\n process.stderr.write(\n `\\nHint: Run \"gr login\" to authenticate, or set GRAVITY_RAIL_API_KEY for non-interactive use.\\n`\n );\n }\n // In the manager sandbox a 403 almost always means the service token lacks the\n // write/admin scope for this command. The token's scopes are granted by the exec\n // tool's `scopes=[...]` (HITL-approved), so tell the agent how to re-request them.\n if (\n 'statusCode' in err &&\n (err as any).statusCode === 403 &&\n process.env.GRAVITY_RAIL_SANDBOX === '1'\n ) {\n process.stderr.write(\n `\\nHint: This is a write/admin operation and the sandbox token lacks the required scope.\\n` +\n `Re-run the exec tool with the needed write scope, e.g.:\\n` +\n ` exec(code=\"<your gr command>\", language=\"bash\", scopes=[\"datatypes:write\"])\\n` +\n `Common scopes: datatypes:write, workflows:write, members:write, automations:admin, agents:write\\n`\n );\n }\n process.exit(1);\n }\n\n process.stderr.write(`Error: ${String(err)}\\n`);\n process.exit(1);\n}\n"],"mappings":";AAAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EACjC,YACG,SACO,WAAmB,GAC3B;AACC,UAAM,OAAO;AAFN;AAGP,SAAK,OAAO;AAAA,EACf;AACH;AAEO,IAAM,oBAAN,cAAgC,SAAS;AAAA,EAC7C,YAAY,UAAU,kEAAkE;AACrF,UAAM,SAAS,CAAC;AAChB,SAAK,OAAO;AAAA,EACf;AACH;AAEO,SAAS,YAAY,KAAqB;AAC9C,MAAI,eAAe,UAAU;AAC1B,YAAQ,OAAO,MAAM,UAAU,IAAI,OAAO;AAAA,CAAI;AAC9C,YAAQ,KAAK,IAAI,QAAQ;AAAA,EAC5B;AAEA,MAAI,eAAe,OAAO;AACvB,YAAQ,OAAO,MAAM,UAAU,IAAI,OAAO;AAAA,CAAI;AAC9C,QAAI,YAAY,OAAO,MAAM,QAAS,IAAY,MAAM,GAAG;AACxD,iBAAW,KAAM,IAAY,QAAQ;AAClC,gBAAQ,OAAO,MAAM,OAAO,CAAC;AAAA,CAAI;AAAA,MACpC;AAAA,IACH;AACA,QAAI,gBAAgB,OAAQ,IAAY,eAAe,KAAK;AACzD,cAAQ,OAAO;AAAA,QACZ;AAAA;AAAA;AAAA,MACH;AAAA,IACH;AAIA,QACG,gBAAgB,OACf,IAAY,eAAe,OAC5B,QAAQ,IAAI,yBAAyB,KACtC;AACC,cAAQ,OAAO;AAAA,QACZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAIH;AAAA,IACH;AACA,YAAQ,KAAK,CAAC;AAAA,EACjB;AAEA,UAAQ,OAAO,MAAM,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AAC9C,UAAQ,KAAK,CAAC;AACjB;","names":[]}
|