@gravity-rail/cli 4.0.0 → 6.0.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.
- package/README.md +65 -32
- package/dist/{account-verify-phone-VZYUPN64.js → account-verify-phone-IC7FNUQE.js} +5 -5
- package/dist/chunk-LQLGLI4Q.js +128 -0
- package/dist/chunk-LQLGLI4Q.js.map +1 -0
- package/dist/{chunk-KDWGBYCM.js → chunk-VA6G6IBW.js} +922 -13
- package/dist/chunk-VA6G6IBW.js.map +1 -0
- package/dist/cli-utils.d.ts +20 -0
- package/dist/cli-utils.js +1 -1
- package/dist/errors-YBSCLOHE.js +13 -0
- package/dist/gr.js +8753 -5082
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +91 -6
- package/dist/lib.js +4609 -2354
- package/dist/lib.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-3T7A5PSF.js +0 -59
- package/dist/chunk-3T7A5PSF.js.map +0 -1
- package/dist/chunk-JOXB4Y4Q.js +0 -861
- package/dist/chunk-JOXB4Y4Q.js.map +0 -1
- package/dist/chunk-KDWGBYCM.js.map +0 -1
- package/dist/errors-CFRLSAGA.js +0 -11
- /package/dist/{account-verify-phone-VZYUPN64.js.map → account-verify-phone-IC7FNUQE.js.map} +0 -0
- /package/dist/{errors-CFRLSAGA.js.map → errors-YBSCLOHE.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-rail/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Gravity Rail CLI — manage workspaces from the command line",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"test:ci": "jest --forceExit --passWithNoTests --coverage --coverageReporters=json-summary --coverageReporters=text-summary"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@gravity-rail/sdk": "^
|
|
51
|
+
"@gravity-rail/sdk": "^6.0.0",
|
|
52
52
|
"js-yaml": "^5.5.0",
|
|
53
|
-
"libphonenumber-js": "^1.13.
|
|
53
|
+
"libphonenumber-js": "^1.13.16",
|
|
54
54
|
"proper-lockfile": "^4.1.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@gravity-rail/sandbox": "0.
|
|
57
|
+
"@gravity-rail/sandbox": "0.8.1",
|
|
58
58
|
"@types/jest": "^30.0.0",
|
|
59
|
-
"@types/node": "^26.6.
|
|
59
|
+
"@types/node": "^26.6.6",
|
|
60
60
|
"@types/proper-lockfile": "^4.1.4",
|
|
61
61
|
"jest": "^30.5.2",
|
|
62
62
|
"ts-jest": "29.4.9",
|
package/dist/chunk-3T7A5PSF.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// src/lib/errors.ts
|
|
2
|
-
var CLIError = class extends Error {
|
|
3
|
-
constructor(message, exitCode = 1) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.exitCode = exitCode;
|
|
6
|
-
this.name = "CLIError";
|
|
7
|
-
}
|
|
8
|
-
exitCode;
|
|
9
|
-
};
|
|
10
|
-
var AuthRequiredError = class extends CLIError {
|
|
11
|
-
constructor(message = "Not authenticated. Run `gr login` or set GRAVITY_RAIL_API_KEY.") {
|
|
12
|
-
super(message, 2);
|
|
13
|
-
this.name = "AuthRequiredError";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
function handleError(err) {
|
|
17
|
-
if (err instanceof CLIError) {
|
|
18
|
-
process.stderr.write(`Error: ${err.message}
|
|
19
|
-
`);
|
|
20
|
-
process.exit(err.exitCode);
|
|
21
|
-
}
|
|
22
|
-
if (err instanceof Error) {
|
|
23
|
-
process.stderr.write(`Error: ${err.message}
|
|
24
|
-
`);
|
|
25
|
-
if ("errors" in err && Array.isArray(err.errors)) {
|
|
26
|
-
for (const e of err.errors) {
|
|
27
|
-
process.stderr.write(` - ${e}
|
|
28
|
-
`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if ("statusCode" in err && err.statusCode === 401) {
|
|
32
|
-
process.stderr.write(
|
|
33
|
-
`
|
|
34
|
-
Hint: Run "gr login" to authenticate, or set GRAVITY_RAIL_API_KEY for non-interactive use.
|
|
35
|
-
`
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
if ("statusCode" in err && err.statusCode === 403 && process.env.GRAVITY_RAIL_SANDBOX === "1") {
|
|
39
|
-
process.stderr.write(
|
|
40
|
-
`
|
|
41
|
-
Hint: This is a write/admin operation and the sandbox token lacks the required scope.
|
|
42
|
-
If the error above names a required scope, re-run the exec tool with it, e.g.:
|
|
43
|
-
exec(code="<your gr command>", language="bash", scopes=["<required scope>"])
|
|
44
|
-
`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
process.stderr.write(`Error: ${String(err)}
|
|
50
|
-
`);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export {
|
|
55
|
-
CLIError,
|
|
56
|
-
AuthRequiredError,
|
|
57
|
-
handleError
|
|
58
|
-
};
|
|
59
|
-
//# sourceMappingURL=chunk-3T7A5PSF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 //\n // Deliberately NO hard-coded scope list: it drifts from the Scope enum and then\n // actively misleads the agent (prod manager chat 287 — the omitted scope was\n // records:write). Scope-only denials name the scope in `err.message`\n // (\"... Required scopes: records:write\"), which is printed above, and the exec\n // tool derives its retry hint from that same text.\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 `If the error above names a required scope, re-run the exec tool with it, e.g.:\\n` +\n ` exec(code=\"<your gr command>\", language=\"bash\", scopes=[\"<required scope>\"])\\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;AAAA,EAJU;AAKb;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;AAUA,QACG,gBAAgB,OACf,IAAY,eAAe,OAC5B,QAAQ,IAAI,yBAAyB,KACtC;AACC,cAAQ,OAAO;AAAA,QACZ;AAAA;AAAA;AAAA;AAAA;AAAA,MAGH;AAAA,IACH;AACA,YAAQ,KAAK,CAAC;AAAA,EACjB;AAEA,UAAQ,OAAO,MAAM,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AAC9C,UAAQ,KAAK,CAAC;AACjB;","names":[]}
|