@ratio-app/cli 0.1.1
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 +504 -0
- package/bin/run.mjs +5 -0
- package/dist/commands/__test__/throw.d.ts +25 -0
- package/dist/commands/__test__/throw.js +238 -0
- package/dist/commands/__test__/throw.js.map +1 -0
- package/dist/commands/app/create.d.ts +55 -0
- package/dist/commands/app/create.js +609 -0
- package/dist/commands/app/create.js.map +1 -0
- package/dist/commands/app/deploy.d.ts +14 -0
- package/dist/commands/app/deploy.js +179 -0
- package/dist/commands/app/deploy.js.map +1 -0
- package/dist/commands/app/dev.d.ts +28 -0
- package/dist/commands/app/dev.js +701 -0
- package/dist/commands/app/dev.js.map +1 -0
- package/dist/commands/app/generate.d.ts +14 -0
- package/dist/commands/app/generate.js +179 -0
- package/dist/commands/app/generate.js.map +1 -0
- package/dist/commands/app/info.d.ts +14 -0
- package/dist/commands/app/info.js +179 -0
- package/dist/commands/app/info.js.map +1 -0
- package/dist/commands/app/link.d.ts +118 -0
- package/dist/commands/app/link.js +1120 -0
- package/dist/commands/app/link.js.map +1 -0
- package/dist/commands/auth/login.d.ts +43 -0
- package/dist/commands/auth/login.js +987 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +15 -0
- package/dist/commands/auth/logout.js +486 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/whoami.d.ts +16 -0
- package/dist/commands/auth/whoami.js +531 -0
- package/dist/commands/auth/whoami.js.map +1 -0
- package/dist/commands/dev/listen.d.ts +84 -0
- package/dist/commands/dev/listen.js +1187 -0
- package/dist/commands/dev/listen.js.map +1 -0
- package/dist/commands/dev/trigger.d.ts +88 -0
- package/dist/commands/dev/trigger.js +729 -0
- package/dist/commands/dev/trigger.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +617 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/auth/authorize-code-exchange.d.ts +50 -0
- package/dist/lib/auth/authorize-code-exchange.js +114 -0
- package/dist/lib/auth/authorize-code-exchange.js.map +1 -0
- package/dist/lib/auth/authorize-url.d.ts +42 -0
- package/dist/lib/auth/authorize-url.js +35 -0
- package/dist/lib/auth/authorize-url.js.map +1 -0
- package/dist/lib/auth/browser.d.ts +16 -0
- package/dist/lib/auth/browser.js +48 -0
- package/dist/lib/auth/browser.js.map +1 -0
- package/dist/lib/auth/config.d.ts +41 -0
- package/dist/lib/auth/config.js +21 -0
- package/dist/lib/auth/config.js.map +1 -0
- package/dist/lib/auth/http-refresher.d.ts +30 -0
- package/dist/lib/auth/http-refresher.js +103 -0
- package/dist/lib/auth/http-refresher.js.map +1 -0
- package/dist/lib/auth/identity.d.ts +26 -0
- package/dist/lib/auth/identity.js +10 -0
- package/dist/lib/auth/identity.js.map +1 -0
- package/dist/lib/auth/index.d.ts +13 -0
- package/dist/lib/auth/index.js +527 -0
- package/dist/lib/auth/index.js.map +1 -0
- package/dist/lib/auth/loopback-server.d.ts +65 -0
- package/dist/lib/auth/loopback-server.js +245 -0
- package/dist/lib/auth/loopback-server.js.map +1 -0
- package/dist/lib/auth/manual-prompt.d.ts +17 -0
- package/dist/lib/auth/manual-prompt.js +20 -0
- package/dist/lib/auth/manual-prompt.js.map +1 -0
- package/dist/lib/auth/pkce.d.ts +24 -0
- package/dist/lib/auth/pkce.js +15 -0
- package/dist/lib/auth/pkce.js.map +1 -0
- package/dist/lib/auth/state.d.ts +20 -0
- package/dist/lib/auth/state.js +19 -0
- package/dist/lib/auth/state.js.map +1 -0
- package/dist/lib/auth/verbose-trace.d.ts +25 -0
- package/dist/lib/auth/verbose-trace.js +17 -0
- package/dist/lib/auth/verbose-trace.js.map +1 -0
- package/dist/lib/credentials/clock.d.ts +18 -0
- package/dist/lib/credentials/clock.js +10 -0
- package/dist/lib/credentials/clock.js.map +1 -0
- package/dist/lib/credentials/index.d.ts +5 -0
- package/dist/lib/credentials/index.js +340 -0
- package/dist/lib/credentials/index.js.map +1 -0
- package/dist/lib/credentials/path.d.ts +26 -0
- package/dist/lib/credentials/path.js +32 -0
- package/dist/lib/credentials/path.js.map +1 -0
- package/dist/lib/credentials/refresher.d.ts +26 -0
- package/dist/lib/credentials/refresher.js +34 -0
- package/dist/lib/credentials/refresher.js.map +1 -0
- package/dist/lib/credentials/schema.d.ts +138 -0
- package/dist/lib/credentials/schema.js +85 -0
- package/dist/lib/credentials/schema.js.map +1 -0
- package/dist/lib/credentials/store.d.ts +102 -0
- package/dist/lib/credentials/store.js +337 -0
- package/dist/lib/credentials/store.js.map +1 -0
- package/dist/lib/credentials/types.d.ts +65 -0
- package/dist/lib/credentials/types.js +1 -0
- package/dist/lib/credentials/types.js.map +1 -0
- package/dist/lib/dev-store-gate.d.ts +66 -0
- package/dist/lib/dev-store-gate.js +15 -0
- package/dist/lib/dev-store-gate.js.map +1 -0
- package/dist/lib/errors.d.ts +60 -0
- package/dist/lib/errors.js +101 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/manifest/index.d.ts +2 -0
- package/dist/lib/manifest/index.js +144 -0
- package/dist/lib/manifest/index.js.map +1 -0
- package/dist/lib/manifest/read-manifest.d.ts +32 -0
- package/dist/lib/manifest/read-manifest.js +87 -0
- package/dist/lib/manifest/read-manifest.js.map +1 -0
- package/dist/lib/manifest/write-client-id.d.ts +33 -0
- package/dist/lib/manifest/write-client-id.js +94 -0
- package/dist/lib/manifest/write-client-id.js.map +1 -0
- package/dist/lib/messages.d.ts +15 -0
- package/dist/lib/messages.js +16 -0
- package/dist/lib/messages.js.map +1 -0
- package/dist/lib/orchestrator/child-runner.d.ts +140 -0
- package/dist/lib/orchestrator/child-runner.js +471 -0
- package/dist/lib/orchestrator/child-runner.js.map +1 -0
- package/dist/lib/preview/index.d.ts +11 -0
- package/dist/lib/preview/index.js +17 -0
- package/dist/lib/preview/index.js.map +1 -0
- package/dist/lib/preview/types.d.ts +16 -0
- package/dist/lib/preview/types.js +11 -0
- package/dist/lib/preview/types.js.map +1 -0
- package/dist/lib/ratio-command.d.ts +52 -0
- package/dist/lib/ratio-command.js +141 -0
- package/dist/lib/ratio-command.js.map +1 -0
- package/dist/lib/relay/index.d.ts +7 -0
- package/dist/lib/relay/index.js +362 -0
- package/dist/lib/relay/index.js.map +1 -0
- package/dist/lib/relay/relay-client.d.ts +91 -0
- package/dist/lib/relay/relay-client.js +362 -0
- package/dist/lib/relay/relay-client.js.map +1 -0
- package/dist/lib/relay/types.d.ts +71 -0
- package/dist/lib/relay/types.js +1 -0
- package/dist/lib/relay/types.js.map +1 -0
- package/dist/lib/render-error.d.ts +35 -0
- package/dist/lib/render-error.js +115 -0
- package/dist/lib/render-error.js.map +1 -0
- package/dist/lib/verbose-flag.d.ts +12 -0
- package/dist/lib/verbose-flag.js +17 -0
- package/dist/lib/verbose-flag.js.map +1 -0
- package/dist/render-CrHGqTPH.d.ts +115 -0
- package/dist/templates/.gitkeep +0 -0
- package/dist/templates/minimal/.env.example.tmpl +4 -0
- package/dist/templates/minimal/README.md.tmpl +26 -0
- package/dist/templates/minimal/gitignore +5 -0
- package/dist/templates/minimal/manifest.json +5 -0
- package/dist/templates/minimal/package.json.tmpl +25 -0
- package/dist/templates/minimal/ratio.config.jsonc.tmpl +17 -0
- package/dist/templates/minimal/src/index.ts.tmpl +26 -0
- package/dist/templates/minimal/src/install.ts.tmpl +37 -0
- package/dist/templates/minimal/src/webhooks.ts.tmpl +57 -0
- package/dist/templates/minimal/tsconfig.json +17 -0
- package/dist/templates/serverless/README.md.tmpl +28 -0
- package/dist/templates/serverless/gitignore +6 -0
- package/dist/templates/serverless/manifest.json +5 -0
- package/dist/templates/serverless/package.json.tmpl +22 -0
- package/dist/templates/serverless/ratio.config.jsonc.tmpl +17 -0
- package/dist/templates/serverless/src/index.ts.tmpl +20 -0
- package/dist/templates/serverless/src/install.ts.tmpl +20 -0
- package/dist/templates/serverless/src/webhooks.ts.tmpl +36 -0
- package/dist/templates/serverless/tsconfig.json +18 -0
- package/dist/templates/serverless/wrangler.toml.tmpl +9 -0
- package/dist/templates/with-admin-ui/.env.example.tmpl +4 -0
- package/dist/templates/with-admin-ui/README.md.tmpl +28 -0
- package/dist/templates/with-admin-ui/gitignore +6 -0
- package/dist/templates/with-admin-ui/manifest.json +5 -0
- package/dist/templates/with-admin-ui/package.json.tmpl +31 -0
- package/dist/templates/with-admin-ui/ratio.config.jsonc.tmpl +17 -0
- package/dist/templates/with-admin-ui/src/admin/app/globals.css +19 -0
- package/dist/templates/with-admin-ui/src/admin/app/layout.tsx.tmpl +13 -0
- package/dist/templates/with-admin-ui/src/admin/app/page.tsx.tmpl +8 -0
- package/dist/templates/with-admin-ui/src/admin/next-env.d.ts.tmpl +5 -0
- package/dist/templates/with-admin-ui/src/admin/next.config.mjs +3 -0
- package/dist/templates/with-admin-ui/src/admin/tsconfig.json +20 -0
- package/dist/templates/with-admin-ui/src/index.ts.tmpl +26 -0
- package/dist/templates/with-admin-ui/src/install.ts.tmpl +37 -0
- package/dist/templates/with-admin-ui/src/webhooks.ts.tmpl +57 -0
- package/dist/templates/with-admin-ui/tsconfig.json +17 -0
- package/package.json +78 -0
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
// src/commands/auth/whoami.ts
|
|
2
|
+
import { Flags as Flags2 } from "@oclif/core";
|
|
3
|
+
|
|
4
|
+
// src/lib/ratio-command.ts
|
|
5
|
+
import { Command, Errors } from "@oclif/core";
|
|
6
|
+
|
|
7
|
+
// src/lib/errors.ts
|
|
8
|
+
var RatioCLIError = class extends Error {
|
|
9
|
+
code;
|
|
10
|
+
exitCode;
|
|
11
|
+
hint;
|
|
12
|
+
docsUrl;
|
|
13
|
+
constructor(opts) {
|
|
14
|
+
super(opts.message);
|
|
15
|
+
this.name = new.target.name;
|
|
16
|
+
this.code = opts.code;
|
|
17
|
+
this.exitCode = opts.exitCode;
|
|
18
|
+
if (opts.hint !== void 0) this.hint = opts.hint;
|
|
19
|
+
if (opts.docsUrl !== void 0) this.docsUrl = opts.docsUrl;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var NotLoggedInError = class extends RatioCLIError {
|
|
23
|
+
constructor(message, hint = "Run 'ratio auth login' to sign in.") {
|
|
24
|
+
super({ code: "NOT_LOGGED_IN", exitCode: 3, message, hint });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var TokenExpiredError = class extends RatioCLIError {
|
|
28
|
+
constructor(message, hint = "Run 'ratio auth login' to refresh your session.") {
|
|
29
|
+
super({ code: "TOKEN_EXPIRED", exitCode: 3, message, hint });
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var ValidationError = class extends RatioCLIError {
|
|
33
|
+
constructor(message, hint) {
|
|
34
|
+
const opts = {
|
|
35
|
+
code: "VALIDATION_ERROR",
|
|
36
|
+
exitCode: 8,
|
|
37
|
+
message
|
|
38
|
+
};
|
|
39
|
+
if (hint !== void 0) opts.hint = hint;
|
|
40
|
+
super(opts);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
function isRatioCLIError(err) {
|
|
44
|
+
return err instanceof RatioCLIError;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/lib/render-error.ts
|
|
48
|
+
function isOclifParserError(err) {
|
|
49
|
+
return err instanceof Error && "parse" in err && err.parse !== null && err.parse !== void 0;
|
|
50
|
+
}
|
|
51
|
+
function buildErrorEnvelope(code, message, hint, docsUrl) {
|
|
52
|
+
const obj = { ok: false, code, message };
|
|
53
|
+
if (hint !== void 0) obj["hint"] = hint;
|
|
54
|
+
if (docsUrl !== void 0) obj["docsUrl"] = docsUrl;
|
|
55
|
+
return JSON.stringify(obj) + "\n";
|
|
56
|
+
}
|
|
57
|
+
function renderError(input) {
|
|
58
|
+
const { err, verbose, json } = input;
|
|
59
|
+
if (isRatioCLIError(err)) {
|
|
60
|
+
const ratioErr = err;
|
|
61
|
+
if (ratioErr.exitCode === 0) {
|
|
62
|
+
if (json) {
|
|
63
|
+
return {
|
|
64
|
+
stdout: JSON.stringify({ ok: true, data: null }) + "\n",
|
|
65
|
+
stderr: "",
|
|
66
|
+
exitCode: 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
stdout: ratioErr.message + "\n",
|
|
71
|
+
stderr: "",
|
|
72
|
+
exitCode: 0
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
let stderrLines = `${ratioErr.code}: ${ratioErr.message}
|
|
76
|
+
`;
|
|
77
|
+
if (ratioErr.hint !== void 0) stderrLines += `${ratioErr.hint}
|
|
78
|
+
`;
|
|
79
|
+
if (ratioErr.docsUrl !== void 0) stderrLines += `${ratioErr.docsUrl}
|
|
80
|
+
`;
|
|
81
|
+
if (json) {
|
|
82
|
+
return {
|
|
83
|
+
stdout: buildErrorEnvelope(ratioErr.code, ratioErr.message, ratioErr.hint, ratioErr.docsUrl),
|
|
84
|
+
stderr: verbose && ratioErr.stack ? ratioErr.stack + "\n" : "",
|
|
85
|
+
exitCode: ratioErr.exitCode
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (verbose && ratioErr.stack) {
|
|
89
|
+
stderrLines += ratioErr.stack + "\n";
|
|
90
|
+
}
|
|
91
|
+
return { stdout: "", stderr: stderrLines, exitCode: ratioErr.exitCode };
|
|
92
|
+
}
|
|
93
|
+
if (isOclifParserError(err)) {
|
|
94
|
+
const parserErr = err;
|
|
95
|
+
const msg = parserErr.message || "Unknown parse error";
|
|
96
|
+
const coercedErr = new ValidationError(msg);
|
|
97
|
+
let stderrText2 = `${coercedErr.code}: ${msg}
|
|
98
|
+
`;
|
|
99
|
+
if (json) {
|
|
100
|
+
return {
|
|
101
|
+
stdout: buildErrorEnvelope(coercedErr.code, msg),
|
|
102
|
+
stderr: verbose && parserErr.stack ? parserErr.stack + "\n" : "",
|
|
103
|
+
exitCode: 8
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (verbose && parserErr.stack) {
|
|
107
|
+
stderrText2 += parserErr.stack + "\n";
|
|
108
|
+
}
|
|
109
|
+
return { stdout: "", stderr: stderrText2, exitCode: 8 };
|
|
110
|
+
}
|
|
111
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
112
|
+
const stack = err instanceof Error ? err.stack : void 0;
|
|
113
|
+
const stderrPrefix = `INTERNAL: ${message}
|
|
114
|
+
`;
|
|
115
|
+
if (json) {
|
|
116
|
+
return {
|
|
117
|
+
stdout: buildErrorEnvelope("INTERNAL", message),
|
|
118
|
+
stderr: verbose && stack ? stack + "\n" : "",
|
|
119
|
+
exitCode: 1
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
let stderrText = stderrPrefix;
|
|
123
|
+
if (verbose && stack) {
|
|
124
|
+
stderrText += stack + "\n";
|
|
125
|
+
}
|
|
126
|
+
return { stdout: "", stderr: stderrText, exitCode: 1 };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/lib/ratio-command.ts
|
|
130
|
+
var RatioCommand = class extends Command {
|
|
131
|
+
_getRenderFlags() {
|
|
132
|
+
const argv = this.argv;
|
|
133
|
+
return {
|
|
134
|
+
verbose: argv.includes("--verbose"),
|
|
135
|
+
json: argv.includes("--json")
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async catch(err) {
|
|
139
|
+
const { verbose, json } = this._getRenderFlags();
|
|
140
|
+
const output = renderError({ err, verbose, json });
|
|
141
|
+
if (output.stdout) process.stdout.write(output.stdout);
|
|
142
|
+
if (output.stderr) process.stderr.write(output.stderr);
|
|
143
|
+
if (output.exitCode === 0) {
|
|
144
|
+
throw new Errors.ExitError(0);
|
|
145
|
+
}
|
|
146
|
+
err.skipOclifErrorHandling = true;
|
|
147
|
+
err.oclif = { exit: output.exitCode };
|
|
148
|
+
throw err;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/lib/verbose-flag.ts
|
|
153
|
+
import { Flags } from "@oclif/core";
|
|
154
|
+
var verboseFlag = {
|
|
155
|
+
verbose: Flags.boolean({
|
|
156
|
+
description: "Show diagnostic detail: HTTP status/timing lines for auth requests (stderr) and stack traces for internal errors."
|
|
157
|
+
})
|
|
158
|
+
};
|
|
159
|
+
var jsonFlag = {
|
|
160
|
+
json: Flags.boolean({
|
|
161
|
+
description: "Emit machine-readable JSON on stdout."
|
|
162
|
+
})
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// src/lib/credentials/clock.ts
|
|
166
|
+
var SystemClock = class {
|
|
167
|
+
now() {
|
|
168
|
+
return Date.now();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// src/lib/credentials/path.ts
|
|
173
|
+
import os from "os";
|
|
174
|
+
import path from "path";
|
|
175
|
+
function snapshotPathEnv() {
|
|
176
|
+
const snapshot = {};
|
|
177
|
+
const xdgConfigHome = process.env["XDG_CONFIG_HOME"];
|
|
178
|
+
if (xdgConfigHome !== void 0) {
|
|
179
|
+
snapshot.XDG_CONFIG_HOME = xdgConfigHome;
|
|
180
|
+
}
|
|
181
|
+
const appData = process.env["APPDATA"];
|
|
182
|
+
if (appData !== void 0) {
|
|
183
|
+
snapshot.APPDATA = appData;
|
|
184
|
+
}
|
|
185
|
+
return snapshot;
|
|
186
|
+
}
|
|
187
|
+
function defaultCredentialsPath(platform, homedir, env) {
|
|
188
|
+
const resolvedPlatform = platform ?? process.platform;
|
|
189
|
+
const resolvedHome = homedir ?? os.homedir();
|
|
190
|
+
const resolvedEnv = env ?? snapshotPathEnv();
|
|
191
|
+
if (resolvedPlatform === "win32") {
|
|
192
|
+
const appData = resolvedEnv.APPDATA;
|
|
193
|
+
const base2 = appData !== void 0 && appData !== "" ? appData : path.win32.join(resolvedHome, "AppData", "Roaming");
|
|
194
|
+
return path.win32.join(base2, "ratio", "credentials");
|
|
195
|
+
}
|
|
196
|
+
const xdgConfigHome = resolvedEnv.XDG_CONFIG_HOME;
|
|
197
|
+
const base = typeof xdgConfigHome === "string" && xdgConfigHome !== "" ? xdgConfigHome : path.posix.join(resolvedHome, ".config");
|
|
198
|
+
return path.posix.join(base, "ratio", "credentials");
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// src/lib/credentials/refresher.ts
|
|
202
|
+
var NotImplementedRefresher = class {
|
|
203
|
+
async refresh(refreshToken) {
|
|
204
|
+
void refreshToken;
|
|
205
|
+
throw new NotLoggedInError(
|
|
206
|
+
"Token refresh is not available yet in this CLI version."
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/lib/credentials/store.ts
|
|
212
|
+
import crypto from "crypto";
|
|
213
|
+
import fs from "fs";
|
|
214
|
+
import { dirname } from "path";
|
|
215
|
+
|
|
216
|
+
// src/lib/credentials/schema.ts
|
|
217
|
+
import { z } from "zod";
|
|
218
|
+
var identitySchema = z.object({
|
|
219
|
+
developerId: z.string(),
|
|
220
|
+
email: z.string(),
|
|
221
|
+
// Token-derived fields captured at login. Optional (additive) so files
|
|
222
|
+
// written before these fields existed still validate as version 1.
|
|
223
|
+
merchantId: z.string().optional(),
|
|
224
|
+
scopes: z.array(z.string()).optional()
|
|
225
|
+
}).strict();
|
|
226
|
+
var profileSchema = z.object({
|
|
227
|
+
accessToken: z.string(),
|
|
228
|
+
refreshToken: z.string(),
|
|
229
|
+
expiresAt: z.string().datetime({ offset: true }),
|
|
230
|
+
identity: identitySchema,
|
|
231
|
+
obtainedAt: z.string().datetime({ offset: true })
|
|
232
|
+
}).strict();
|
|
233
|
+
var developerSessionSchema = z.object({
|
|
234
|
+
jwt: z.string(),
|
|
235
|
+
developerId: z.string(),
|
|
236
|
+
email: z.string(),
|
|
237
|
+
expiresAt: z.string().datetime({ offset: true }),
|
|
238
|
+
obtainedAt: z.string().datetime({ offset: true })
|
|
239
|
+
}).strict();
|
|
240
|
+
var credentialsSchema = z.object({
|
|
241
|
+
version: z.literal(1),
|
|
242
|
+
server: z.string(),
|
|
243
|
+
clientId: z.string(),
|
|
244
|
+
profiles: z.record(z.string(), profileSchema),
|
|
245
|
+
// Optional cached developer session. Additive so files written before
|
|
246
|
+
// this field existed still validate as version 1.
|
|
247
|
+
developer: developerSessionSchema.optional()
|
|
248
|
+
}).strict();
|
|
249
|
+
function parseCredentials(input) {
|
|
250
|
+
if (typeof input === "object" && input !== null && "version" in input) {
|
|
251
|
+
const version = input.version;
|
|
252
|
+
if (version !== 1) {
|
|
253
|
+
const label = typeof version === "number" ? String(version) : "unknown";
|
|
254
|
+
throw new ValidationError(
|
|
255
|
+
`credentials file version ${label} is unsupported by this CLI \u2014 upgrade the CLI or sign in again`
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const result = credentialsSchema.safeParse(input);
|
|
260
|
+
if (!result.success) {
|
|
261
|
+
throw new ValidationError(
|
|
262
|
+
"credentials file schema mismatch \u2014 expected v1 shape"
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
return result.data;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// src/lib/credentials/store.ts
|
|
269
|
+
var REFRESH_WINDOW_MS = 3e5;
|
|
270
|
+
var ENV_TOKEN_VAR = "RATIO_API_TOKEN";
|
|
271
|
+
var ENV_DEVELOPER_TOKEN_VAR = "RATIO_DEVELOPER_TOKEN";
|
|
272
|
+
function hasErrnoCode(err, code) {
|
|
273
|
+
return err instanceof Error && err.code === code;
|
|
274
|
+
}
|
|
275
|
+
var FileCredentialStore = class {
|
|
276
|
+
filePath;
|
|
277
|
+
clock;
|
|
278
|
+
refresher;
|
|
279
|
+
envReader;
|
|
280
|
+
platform;
|
|
281
|
+
constructor(opts) {
|
|
282
|
+
this.filePath = opts?.filePath ?? defaultCredentialsPath();
|
|
283
|
+
this.clock = opts?.clock ?? new SystemClock();
|
|
284
|
+
this.refresher = opts?.refresher ?? new NotImplementedRefresher();
|
|
285
|
+
this.envReader = opts?.envReader ?? (() => process.env);
|
|
286
|
+
this.platform = opts?.platform ?? process.platform;
|
|
287
|
+
}
|
|
288
|
+
async load() {
|
|
289
|
+
this.reapplyFileModeIfDrifted();
|
|
290
|
+
let raw;
|
|
291
|
+
try {
|
|
292
|
+
raw = fs.readFileSync(this.filePath, "utf8");
|
|
293
|
+
} catch (err) {
|
|
294
|
+
if (hasErrnoCode(err, "ENOENT")) {
|
|
295
|
+
throw new NotLoggedInError("You are not signed in.");
|
|
296
|
+
}
|
|
297
|
+
throw err;
|
|
298
|
+
}
|
|
299
|
+
let parsed;
|
|
300
|
+
try {
|
|
301
|
+
parsed = JSON.parse(raw);
|
|
302
|
+
} catch {
|
|
303
|
+
throw new ValidationError(
|
|
304
|
+
'credentials file is not valid JSON \u2014 run "ratio auth login" to reset'
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
return parseCredentials(parsed);
|
|
308
|
+
}
|
|
309
|
+
async save(creds) {
|
|
310
|
+
const dir = dirname(this.filePath);
|
|
311
|
+
fs.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
312
|
+
if (this.platform !== "win32") {
|
|
313
|
+
fs.chmodSync(dir, 448);
|
|
314
|
+
}
|
|
315
|
+
const tmpPath = `${this.filePath}.${process.pid}.${crypto.randomBytes(8).toString("hex")}.tmp`;
|
|
316
|
+
try {
|
|
317
|
+
fs.writeFileSync(tmpPath, JSON.stringify(creds, null, 2), {
|
|
318
|
+
mode: 384
|
|
319
|
+
});
|
|
320
|
+
fs.renameSync(tmpPath, this.filePath);
|
|
321
|
+
} catch (err) {
|
|
322
|
+
try {
|
|
323
|
+
fs.unlinkSync(tmpPath);
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
throw err;
|
|
327
|
+
}
|
|
328
|
+
if (this.platform !== "win32") {
|
|
329
|
+
fs.chmodSync(this.filePath, 384);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async clear() {
|
|
333
|
+
try {
|
|
334
|
+
fs.unlinkSync(this.filePath);
|
|
335
|
+
} catch (err) {
|
|
336
|
+
if (hasErrnoCode(err, "ENOENT")) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
throw err;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
async getValidAccessToken(profileName) {
|
|
343
|
+
const envToken = this.envReader()[ENV_TOKEN_VAR];
|
|
344
|
+
if (typeof envToken === "string" && envToken.length > 0) {
|
|
345
|
+
return envToken;
|
|
346
|
+
}
|
|
347
|
+
const creds = await this.load();
|
|
348
|
+
const name = profileName ?? "default";
|
|
349
|
+
const profile = creds.profiles[name];
|
|
350
|
+
if (profile === void 0) {
|
|
351
|
+
throw new NotLoggedInError("You are not signed in.");
|
|
352
|
+
}
|
|
353
|
+
const msUntilExpiry = new Date(profile.expiresAt).getTime() - this.clock.now();
|
|
354
|
+
if (msUntilExpiry < REFRESH_WINDOW_MS) {
|
|
355
|
+
return this.refreshAndPersist(creds, name, profile);
|
|
356
|
+
}
|
|
357
|
+
return profile.accessToken;
|
|
358
|
+
}
|
|
359
|
+
async getValidDeveloperToken() {
|
|
360
|
+
const envToken = this.envReader()[ENV_DEVELOPER_TOKEN_VAR];
|
|
361
|
+
if (typeof envToken === "string" && envToken.length > 0) {
|
|
362
|
+
return envToken;
|
|
363
|
+
}
|
|
364
|
+
let creds;
|
|
365
|
+
try {
|
|
366
|
+
creds = await this.load();
|
|
367
|
+
} catch (err) {
|
|
368
|
+
if (err instanceof NotLoggedInError) {
|
|
369
|
+
throw new NotLoggedInError("Developer signin required.");
|
|
370
|
+
}
|
|
371
|
+
throw err;
|
|
372
|
+
}
|
|
373
|
+
const session = creds.developer;
|
|
374
|
+
if (session === void 0) {
|
|
375
|
+
throw new NotLoggedInError("Developer signin required.");
|
|
376
|
+
}
|
|
377
|
+
const msUntilExpiry = new Date(session.expiresAt).getTime() - this.clock.now();
|
|
378
|
+
if (msUntilExpiry < REFRESH_WINDOW_MS) {
|
|
379
|
+
throw new NotLoggedInError("Developer signin required.");
|
|
380
|
+
}
|
|
381
|
+
return session.jwt;
|
|
382
|
+
}
|
|
383
|
+
async saveDeveloperSession(session) {
|
|
384
|
+
let creds;
|
|
385
|
+
try {
|
|
386
|
+
creds = await this.load();
|
|
387
|
+
} catch (err) {
|
|
388
|
+
if (err instanceof NotLoggedInError) {
|
|
389
|
+
creds = { version: 1, server: "", clientId: "", profiles: {} };
|
|
390
|
+
} else {
|
|
391
|
+
throw err;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const updated = {
|
|
395
|
+
...creds,
|
|
396
|
+
developer: session
|
|
397
|
+
};
|
|
398
|
+
await this.save(updated);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Exchange the profile's refresh token for a fresh token set, merge it
|
|
402
|
+
* into the loaded credentials (preserving every other profile), persist
|
|
403
|
+
* atomically, and return the new access token. A refresher failure is
|
|
404
|
+
* wrapped in TokenExpiredError; the underlying message is deliberately
|
|
405
|
+
* discarded so a secret can never leak through the error surface.
|
|
406
|
+
*/
|
|
407
|
+
async refreshAndPersist(creds, name, profile) {
|
|
408
|
+
let refreshed;
|
|
409
|
+
try {
|
|
410
|
+
refreshed = await this.refresher.refresh(profile.refreshToken);
|
|
411
|
+
} catch {
|
|
412
|
+
throw new TokenExpiredError(
|
|
413
|
+
"Your session has expired and could not be refreshed."
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
const updated = {
|
|
417
|
+
...creds,
|
|
418
|
+
profiles: {
|
|
419
|
+
...creds.profiles,
|
|
420
|
+
[name]: {
|
|
421
|
+
...profile,
|
|
422
|
+
accessToken: refreshed.accessToken,
|
|
423
|
+
refreshToken: refreshed.refreshToken,
|
|
424
|
+
expiresAt: refreshed.expiresAt
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
await this.save(updated);
|
|
429
|
+
return refreshed.accessToken;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* POSIX-only startup permission check: if the file exists with a mode
|
|
433
|
+
* other than 0600, re-apply 0600 and emit a warning to stderr. Never
|
|
434
|
+
* runs on Windows (stat modes there do not map to POSIX bits and chmod
|
|
435
|
+
* must not be called). Missing file is NOT an error here — load()
|
|
436
|
+
* reports it as NotLoggedInError.
|
|
437
|
+
*/
|
|
438
|
+
reapplyFileModeIfDrifted() {
|
|
439
|
+
if (this.platform === "win32") {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
let stat;
|
|
443
|
+
try {
|
|
444
|
+
stat = fs.statSync(this.filePath);
|
|
445
|
+
} catch (err) {
|
|
446
|
+
if (hasErrnoCode(err, "ENOENT")) {
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
throw err;
|
|
450
|
+
}
|
|
451
|
+
const mode = stat.mode & 511;
|
|
452
|
+
if (mode !== 384) {
|
|
453
|
+
fs.chmodSync(this.filePath, 384);
|
|
454
|
+
process.stderr.write(
|
|
455
|
+
`[warn] credentials file permissions were 0o${mode.toString(8)}; corrected to 0600.
|
|
456
|
+
`
|
|
457
|
+
);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
// src/commands/auth/whoami.ts
|
|
463
|
+
var AuthWhoami = class _AuthWhoami extends RatioCommand {
|
|
464
|
+
static description = "Show the currently signed-in Ratio user.";
|
|
465
|
+
static examples = [
|
|
466
|
+
"<%= config.bin %> auth whoami",
|
|
467
|
+
"<%= config.bin %> auth whoami --json"
|
|
468
|
+
];
|
|
469
|
+
static flags = {
|
|
470
|
+
...verboseFlag,
|
|
471
|
+
...jsonFlag,
|
|
472
|
+
profile: Flags2.string({
|
|
473
|
+
description: "Credential profile name to read.",
|
|
474
|
+
default: "default"
|
|
475
|
+
})
|
|
476
|
+
};
|
|
477
|
+
async run() {
|
|
478
|
+
const { flags } = await this.parse(_AuthWhoami);
|
|
479
|
+
const envToken = process.env["RATIO_API_TOKEN"];
|
|
480
|
+
if (typeof envToken === "string" && envToken.length > 0) {
|
|
481
|
+
if (flags.json) {
|
|
482
|
+
this.log(JSON.stringify({ ok: true, data: { source: "env", identity: null } }));
|
|
483
|
+
} else {
|
|
484
|
+
this.log("Using RATIO_API_TOKEN (identity unknown)");
|
|
485
|
+
}
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const store = new FileCredentialStore();
|
|
489
|
+
const profileName = flags.profile ?? "default";
|
|
490
|
+
let creds;
|
|
491
|
+
try {
|
|
492
|
+
creds = await store.load();
|
|
493
|
+
} catch {
|
|
494
|
+
throw new NotLoggedInError("You are not signed in.");
|
|
495
|
+
}
|
|
496
|
+
const profile = creds.profiles[profileName];
|
|
497
|
+
if (!profile) {
|
|
498
|
+
throw new NotLoggedInError("You are not signed in.");
|
|
499
|
+
}
|
|
500
|
+
const identity = profile.identity;
|
|
501
|
+
const merchantId = identity.merchantId ?? null;
|
|
502
|
+
const scopes = identity.scopes ?? [];
|
|
503
|
+
if (flags.json) {
|
|
504
|
+
this.log(
|
|
505
|
+
JSON.stringify({
|
|
506
|
+
ok: true,
|
|
507
|
+
data: {
|
|
508
|
+
source: "file",
|
|
509
|
+
clientId: creds.clientId,
|
|
510
|
+
merchantId,
|
|
511
|
+
scopes,
|
|
512
|
+
expiresAt: profile.expiresAt,
|
|
513
|
+
profile: profileName
|
|
514
|
+
}
|
|
515
|
+
})
|
|
516
|
+
);
|
|
517
|
+
} else {
|
|
518
|
+
const emailPart = identity.email ? ` email=${identity.email}` : "";
|
|
519
|
+
this.log(
|
|
520
|
+
`Signed in as clientId=${creds.clientId}${emailPart} (profile: ${profileName})`
|
|
521
|
+
);
|
|
522
|
+
this.log(` Merchant: ${merchantId ?? "unknown"}`);
|
|
523
|
+
this.log(` Scopes: ${scopes.length > 0 ? scopes.join(", ") : "(none)"}`);
|
|
524
|
+
this.log(` Token expires: ${profile.expiresAt}`);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
export {
|
|
529
|
+
AuthWhoami as default
|
|
530
|
+
};
|
|
531
|
+
//# sourceMappingURL=whoami.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/commands/auth/whoami.ts","../../../src/lib/ratio-command.ts","../../../src/lib/errors.ts","../../../src/lib/render-error.ts","../../../src/lib/verbose-flag.ts","../../../src/lib/credentials/clock.ts","../../../src/lib/credentials/path.ts","../../../src/lib/credentials/refresher.ts","../../../src/lib/credentials/store.ts","../../../src/lib/credentials/schema.ts"],"sourcesContent":["import { Flags } from '@oclif/core';\nimport { RatioCommand } from '../../lib/ratio-command.js';\nimport { jsonFlag, verboseFlag } from '../../lib/verbose-flag.js';\nimport { FileCredentialStore } from '../../lib/credentials/index.js';\nimport { NotLoggedInError } from '../../lib/errors.js';\n\nexport default class AuthWhoami extends RatioCommand {\n static override description = 'Show the currently signed-in Ratio user.';\n\n static override examples = [\n '<%= config.bin %> auth whoami',\n '<%= config.bin %> auth whoami --json',\n ];\n\n static override flags = {\n ...verboseFlag,\n ...jsonFlag,\n profile: Flags.string({\n description: 'Credential profile name to read.',\n default: 'default',\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(AuthWhoami);\n\n // RATIO_API_TOKEN env bypass — identity unknown (token is opaque to CLI).\n const envToken = process.env['RATIO_API_TOKEN'];\n if (typeof envToken === 'string' && envToken.length > 0) {\n if (flags.json) {\n this.log(JSON.stringify({ ok: true, data: { source: 'env', identity: null } }));\n } else {\n this.log('Using RATIO_API_TOKEN (identity unknown)');\n }\n return;\n }\n\n const store = new FileCredentialStore();\n const profileName = flags.profile ?? 'default';\n\n let creds;\n try {\n creds = await store.load();\n } catch {\n throw new NotLoggedInError('You are not signed in.');\n }\n\n const profile = creds.profiles[profileName];\n if (!profile) {\n throw new NotLoggedInError('You are not signed in.');\n }\n\n const identity = profile.identity;\n\n // Token-derived view: {clientId, merchantId, scopes}. Files written\n // before merchantId/scopes were persisted degrade gracefully.\n const merchantId = identity.merchantId ?? null;\n const scopes = identity.scopes ?? [];\n\n if (flags.json) {\n // SC-11: --json outputs {\"ok\":true,\"data\":{...}}\n this.log(\n JSON.stringify({\n ok: true,\n data: {\n source: 'file',\n clientId: creds.clientId,\n merchantId,\n scopes,\n expiresAt: profile.expiresAt,\n profile: profileName,\n },\n }),\n );\n } else {\n const emailPart = identity.email ? ` email=${identity.email}` : '';\n this.log(\n `Signed in as clientId=${creds.clientId}${emailPart} (profile: ${profileName})`,\n );\n this.log(` Merchant: ${merchantId ?? 'unknown'}`);\n this.log(` Scopes: ${scopes.length > 0 ? scopes.join(', ') : '(none)'}`);\n this.log(` Token expires: ${profile.expiresAt}`);\n }\n }\n}\n","import { Command, Errors } from '@oclif/core';\nimport { renderError } from './render-error.js';\n\n/**\n * Base class for all Ratio CLI commands.\n *\n * Overrides catch() to intercept every error thrown from run(), render it\n * per the Ratio CLI error-UX spec (typed hierarchy -> structured stderr/stdout,\n * --verbose for stack traces, --json for machine-readable envelope), and then\n * suppress oclif's own double-render by setting skipOclifErrorHandling on the\n * re-thrown error.\n *\n * Path B: base-class override — no oclif.hooks wiring needed.\n * oclif v4 does not expose a command_error hook; the reliable interception\n * point is Command.catch(), which is called by Command._run() before the\n * error bubbles up to oclif's global handle() function.\n *\n * Double-render prevention:\n * oclif's handle() checks err.skipOclifErrorHandling before printing.\n * After rendering we set skipOclifErrorHandling = true so oclif's\n * pretty-print is skipped. We also set err.oclif.exit = N so handle()\n * calls process.exit(N) with the correct code.\n *\n * Exit-code routing:\n * - exitCode === 0 (ComingSoonError): throw ExitError(0) so oclif calls\n * process.exit(0) cleanly. ExitError has code 'EEXIT' and is treated as\n * a clean exit — shouldPrint is false in handle().\n * - exitCode > 0: mark err.skipOclifErrorHandling = true and set\n * err.oclif = { exit: N }, then re-throw so handle() exits N.\n *\n * Verbose/json detection strategy:\n * We scan this.argv directly. this.argv is set by oclif's Command before\n * run() is called and always contains the raw argument list. This approach\n * works both for:\n * (a) post-parse errors (thrown after this.parse() succeeds) — argv has the\n * flags that were successfully recognised.\n * (b) pre-parse errors (thrown BY this.parse(), e.g. unknown flag) — argv\n * still contains --verbose / --json even though parse() threw.\n * Simple string scan is sufficient since --verbose and --json are boolean\n * flags with no value argument.\n */\nexport abstract class RatioCommand extends Command {\n private _getRenderFlags(): { verbose: boolean; json: boolean } {\n const argv = this.argv as string[];\n return {\n verbose: argv.includes('--verbose'),\n json: argv.includes('--json'),\n };\n }\n\n override async catch(\n err: Error & {\n exitCode?: number;\n oclif?: { exit?: number };\n skipOclifErrorHandling?: boolean;\n },\n ): Promise<never> {\n const { verbose, json } = this._getRenderFlags();\n\n const output = renderError({ err, verbose, json });\n\n // Write rendered output before any exit/throw\n if (output.stdout) process.stdout.write(output.stdout);\n if (output.stderr) process.stderr.write(output.stderr);\n\n if (output.exitCode === 0) {\n // ComingSoonError path — ExitError(0) causes oclif to call process.exit(0)\n // cleanly. ExitError has code 'EEXIT'; handle() treats it as a clean exit\n // (shouldPrint is false) so no additional output is written.\n throw new Errors.ExitError(0);\n }\n\n // For non-zero exits: suppress oclif's pretty-print by marking the error,\n // then route the correct exit code via oclif.exit so handle() calls process.exit(N).\n err.skipOclifErrorHandling = true;\n err.oclif = { exit: output.exitCode };\n throw err;\n }\n}\n","/**\n * Error hierarchy for the Ratio CLI. Every error thrown from a command's\n * run() is expected to be an instance of RatioCLIError so the global\n * render-error handler can map it to a deterministic stderr line and exit\n * code. Uncaught Error subclasses render as \"INTERNAL: <msg>\" with exit 1.\n *\n * No import from @oclif/core — this file is dependency-free so tests\n * can import it without oclif overhead.\n */\n\nexport class RatioCLIError extends Error {\n readonly code: string;\n readonly exitCode: number;\n readonly hint?: string;\n readonly docsUrl?: string;\n\n constructor(opts: {\n code: string;\n exitCode: number;\n message: string;\n hint?: string;\n docsUrl?: string;\n }) {\n super(opts.message);\n this.name = new.target.name;\n this.code = opts.code;\n this.exitCode = opts.exitCode;\n if (opts.hint !== undefined) this.hint = opts.hint;\n if (opts.docsUrl !== undefined) this.docsUrl = opts.docsUrl;\n }\n}\n\n/** Coming-soon stub UX. Renders on stdout with exit 0. */\nexport class ComingSoonError extends RatioCLIError {\n constructor(message: string) {\n super({ code: 'COMING_SOON', exitCode: 0, message });\n }\n}\n\n/** User has no credentials and command requires auth. */\nexport class NotLoggedInError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = \"Run 'ratio auth login' to sign in.\",\n ) {\n super({ code: 'NOT_LOGGED_IN', exitCode: 3, message, hint });\n }\n}\n\nexport class TokenExpiredError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = \"Run 'ratio auth login' to refresh your session.\",\n ) {\n super({ code: 'TOKEN_EXPIRED', exitCode: 3, message, hint });\n }\n}\n\nexport class ScopeDeniedError extends RatioCLIError {\n constructor(message: string, hint?: string) {\n const opts: { code: string; exitCode: number; message: string; hint?: string } = {\n code: 'SCOPE_DENIED',\n exitCode: 4,\n message,\n };\n if (hint !== undefined) opts.hint = hint;\n super(opts);\n }\n}\n\nexport class NetworkError extends RatioCLIError {\n constructor(message: string, hint: string = 'Check your network and retry.') {\n super({ code: 'NETWORK_ERROR', exitCode: 5, message, hint });\n }\n}\n\nexport class RelayConnectError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = 'Verify the tunnel URL and that the auth-server is reachable.',\n ) {\n super({ code: 'RELAY_CONNECT', exitCode: 6, message, hint });\n }\n}\n\nexport class TemplateExistsError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = 'Choose a different name or remove the existing directory.',\n ) {\n super({ code: 'TEMPLATE_EXISTS', exitCode: 7, message, hint });\n }\n}\n\nexport class ValidationError extends RatioCLIError {\n constructor(message: string, hint?: string) {\n const opts: { code: string; exitCode: number; message: string; hint?: string } = {\n code: 'VALIDATION_ERROR',\n exitCode: 8,\n message,\n };\n if (hint !== undefined) opts.hint = hint;\n super(opts);\n }\n}\n\nexport class RelayResumeGapError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = 'Reconnect from the current cursor; older events are outside the buffer window.',\n ) {\n super({ code: 'RELAY_RESUME_GAP', exitCode: 9, message, hint });\n }\n}\n\nexport class OrchestratorSpawnError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = \"Could not start your app's dev command — check that the command in ratio.config.jsonc runs from this directory.\",\n ) {\n super({ code: 'ORCHESTRATOR_SPAWN', exitCode: 10, message, hint });\n }\n}\n\nexport class OrchestratorDrainTimeoutError extends RatioCLIError {\n constructor(\n message: string,\n hint: string = 'Your dev command did not exit cleanly within 5 seconds — it was forcibly terminated.',\n ) {\n super({ code: 'ORCHESTRATOR_DRAIN', exitCode: 11, message, hint });\n }\n}\n\nexport function isRatioCLIError(err: unknown): err is RatioCLIError {\n return err instanceof RatioCLIError;\n}\n","import { isRatioCLIError, RatioCLIError, ValidationError } from './errors.js';\n\nexport interface RenderInput {\n err: unknown;\n verbose: boolean;\n json: boolean;\n}\n\nexport interface RenderOutput {\n /** Text to write to stdout. Empty string means nothing to write. */\n stdout: string;\n /** Text to write to stderr. Empty string means nothing to write. */\n stderr: string;\n exitCode: number;\n}\n\n/**\n * Detects whether an error originates from the oclif argument/flag parser.\n * oclif's CLIParseError subclasses (NonExistentFlagsError, RequiredArgsError,\n * etc.) all carry a `parse` property set by CLIParseErrorOptions. This is the\n * stable structural signal — more reliable than checking the class name string.\n */\nfunction isOclifParserError(err: unknown): err is Error & { parse: unknown } {\n return (\n err instanceof Error &&\n 'parse' in err &&\n err.parse !== null &&\n err.parse !== undefined\n );\n}\n\n/**\n * Builds the JSON error envelope. Fields with undefined values are omitted\n * so the consumer never sees `\"hint\": null` or `\"docsUrl\": null`.\n */\nfunction buildErrorEnvelope(\n code: string,\n message: string,\n hint?: string,\n docsUrl?: string,\n): string {\n const obj: Record<string, unknown> = { ok: false, code, message };\n if (hint !== undefined) obj['hint'] = hint;\n if (docsUrl !== undefined) obj['docsUrl'] = docsUrl;\n return JSON.stringify(obj) + '\\n';\n}\n\n/**\n * Pure rendering function — no side effects, no process.exit, no I/O.\n * The caller (RatioCommand.catch) is responsible for writing output and exiting.\n *\n * Rendering rules (all branches):\n *\n * | Error shape | --json | --verbose | stdout | stderr | exit |\n * |----------------------|--------|-----------|--------------------------------|----------------------------------|------|\n * | ComingSoonError | false | any | err.message + '\\n' | '' | 0 |\n * | ComingSoonError | true | any | '{\"ok\":true,\"data\":null}\\n' | '' | 0 |\n * | RatioCLIError >0 | false | false | '' | code: msg [+ hint] [+ docsUrl] | N |\n * | RatioCLIError >0 | false | true | '' | above + stack | N |\n * | RatioCLIError >0 | true | false | JSON envelope | '' | N |\n * | RatioCLIError >0 | true | true | JSON envelope | stack only | N |\n * | oclif ParserError | false | any | '' | VALIDATION_ERROR: msg [+stack] | 8 |\n * | oclif ParserError | true | any | JSON VALIDATION_ERROR envelope | stack if verbose | 8 |\n * | Plain Error / other | false | false | '' | INTERNAL: msg\\n | 1 |\n * | Plain Error / other | false | true | '' | INTERNAL: msg\\n + stack\\n | 1 |\n * | Plain Error / other | true | any | JSON INTERNAL envelope | stack if verbose | 1 |\n */\nexport function renderError(input: RenderInput): RenderOutput {\n const { err, verbose, json } = input;\n\n // ── Branch 1: our own typed hierarchy ───────────────────────────────────\n if (isRatioCLIError(err)) {\n const ratioErr = err as RatioCLIError;\n\n // exitCode === 0 → coming-soon: render on stdout, no stderr, exit 0\n if (ratioErr.exitCode === 0) {\n if (json) {\n return {\n stdout: JSON.stringify({ ok: true, data: null }) + '\\n',\n stderr: '',\n exitCode: 0,\n };\n }\n return {\n stdout: ratioErr.message + '\\n',\n stderr: '',\n exitCode: 0,\n };\n }\n\n // exitCode > 0 → error render\n let stderrLines = `${ratioErr.code}: ${ratioErr.message}\\n`;\n if (ratioErr.hint !== undefined) stderrLines += `${ratioErr.hint}\\n`;\n if (ratioErr.docsUrl !== undefined) stderrLines += `${ratioErr.docsUrl}\\n`;\n\n if (json) {\n return {\n stdout: buildErrorEnvelope(ratioErr.code, ratioErr.message, ratioErr.hint, ratioErr.docsUrl),\n stderr: verbose && ratioErr.stack ? ratioErr.stack + '\\n' : '',\n exitCode: ratioErr.exitCode,\n };\n }\n\n if (verbose && ratioErr.stack) {\n stderrLines += ratioErr.stack + '\\n';\n }\n\n return { stdout: '', stderr: stderrLines, exitCode: ratioErr.exitCode };\n }\n\n // ── Branch 2: oclif parser error (unknown flag, missing required arg, etc.) ──\n if (isOclifParserError(err)) {\n const parserErr = err as Error & { parse: unknown };\n const msg = parserErr.message || 'Unknown parse error';\n\n // Strip oclif's \"Unexpected argument: --foo\" or similar prefix noise where\n // possible, but keep the core message as-is since it's already human-readable.\n const coercedErr = new ValidationError(msg);\n\n let stderrText = `${coercedErr.code}: ${msg}\\n`;\n\n if (json) {\n return {\n stdout: buildErrorEnvelope(coercedErr.code, msg),\n stderr: verbose && parserErr.stack ? parserErr.stack + '\\n' : '',\n exitCode: 8,\n };\n }\n\n if (verbose && parserErr.stack) {\n stderrText += parserErr.stack + '\\n';\n }\n\n return { stdout: '', stderr: stderrText, exitCode: 8 };\n }\n\n // ── Branch 3: plain Error or non-Error throw ─────────────────────────────\n const message = err instanceof Error ? err.message : String(err);\n const stack = err instanceof Error ? err.stack : undefined;\n const stderrPrefix = `INTERNAL: ${message}\\n`;\n\n if (json) {\n return {\n stdout: buildErrorEnvelope('INTERNAL', message),\n stderr: verbose && stack ? stack + '\\n' : '',\n exitCode: 1,\n };\n }\n\n let stderrText = stderrPrefix;\n if (verbose && stack) {\n stderrText += stack + '\\n';\n }\n\n return { stdout: '', stderr: stderrText, exitCode: 1 };\n}\n","import { Flags } from '@oclif/core';\n\n/** Global verbose flag — every command imports and spreads this. */\nexport const verboseFlag = {\n verbose: Flags.boolean({\n description:\n 'Show diagnostic detail: HTTP status/timing lines for auth requests (stderr) and stack traces for internal errors.',\n }),\n};\n\n/** JSON envelope flag — read-style commands (whoami, dev trigger --list) import. */\nexport const jsonFlag = {\n json: Flags.boolean({\n description: 'Emit machine-readable JSON on stdout.',\n }),\n};\n","/**\n * Injectable wall-clock seam for the credential store.\n *\n * This is the ONLY file in the credentials module allowed to sample the\n * real wall clock. Every other file receives a {@link Clock} instance so\n * tests can drive expiry-window logic deterministically with a fake.\n */\n\n/** Injectable time source. */\nexport interface Clock {\n /** Milliseconds since Unix epoch. */\n now(): number;\n}\n\n/** Production {@link Clock} backed by the system wall clock. */\nexport class SystemClock implements Clock {\n now(): number {\n return Date.now();\n }\n}\n","/**\n * Pure path resolution for the credentials file.\n *\n * POSIX: `$XDG_CONFIG_HOME/ratio/credentials` when the override is a\n * non-empty string, otherwise `~/.config/ratio/credentials`.\n * Windows: `%APPDATA%\\ratio\\credentials`, falling back to\n * `<home>\\AppData\\Roaming\\ratio\\credentials` when APPDATA is unset.\n *\n * `path.win32.join` / `path.posix.join` are used explicitly (never bare\n * `path.join`) so the result is deterministic when a test running on a\n * POSIX host fakes `platform === 'win32'`.\n */\n\nimport os from 'node:os';\nimport path from 'node:path';\n\n/** The subset of environment variables the path algorithm consults. */\nexport interface PathEnv {\n readonly XDG_CONFIG_HOME?: string;\n readonly APPDATA?: string;\n}\n\n/** Snapshot the two relevant variables from the real process env. */\nfunction snapshotPathEnv(): PathEnv {\n const snapshot: { XDG_CONFIG_HOME?: string; APPDATA?: string } = {};\n const xdgConfigHome = process.env['XDG_CONFIG_HOME'];\n if (xdgConfigHome !== undefined) {\n snapshot.XDG_CONFIG_HOME = xdgConfigHome;\n }\n const appData = process.env['APPDATA'];\n if (appData !== undefined) {\n snapshot.APPDATA = appData;\n }\n return snapshot;\n}\n\n/**\n * Pure function. Returns the on-disk path for the credentials file.\n * platform defaults to process.platform, homedir defaults to os.homedir(),\n * env defaults to a snapshot of {XDG_CONFIG_HOME, APPDATA} from process.env.\n * All three are injectable so unit tests fake Windows without a Windows host.\n */\nexport function defaultCredentialsPath(\n platform?: NodeJS.Platform,\n homedir?: string,\n env?: PathEnv,\n): string {\n const resolvedPlatform = platform ?? process.platform;\n const resolvedHome = homedir ?? os.homedir();\n const resolvedEnv = env ?? snapshotPathEnv();\n\n if (resolvedPlatform === 'win32') {\n const appData = resolvedEnv.APPDATA;\n const base =\n appData !== undefined && appData !== ''\n ? appData\n : path.win32.join(resolvedHome, 'AppData', 'Roaming');\n return path.win32.join(base, 'ratio', 'credentials');\n }\n\n const xdgConfigHome = resolvedEnv.XDG_CONFIG_HOME;\n const base =\n typeof xdgConfigHome === 'string' && xdgConfigHome !== ''\n ? xdgConfigHome\n : path.posix.join(resolvedHome, '.config');\n return path.posix.join(base, 'ratio', 'credentials');\n}\n","/**\n * Injectable token-refresh seam for the credential store.\n *\n * The store never performs network I/O itself: when a stored token is\n * close to expiry the store calls the injected {@link TokenRefresher}\n * and persists whatever it returns. The concrete HTTP implementation is\n * wired in by the auth commands; this module only defines the seam plus\n * a throw-if-called placeholder used before sign-in support is wired.\n */\n\nimport { NotLoggedInError } from '../errors.js';\nimport type { TokenSet } from './types.js';\n\n/** Injectable seam that exchanges a refresh token for a fresh token set. */\nexport interface TokenRefresher {\n refresh(refreshToken: string): Promise<TokenSet>;\n}\n\n/**\n * v1 stub. Always rejects with a static-message NotLoggedInError; it\n * never inspects, echoes, or logs the token it was handed. The real\n * HTTP implementation is supplied by the auth commands.\n */\nexport class NotImplementedRefresher implements TokenRefresher {\n async refresh(refreshToken: string): Promise<TokenSet> {\n // Deliberately unused: this placeholder must never touch the token.\n void refreshToken;\n throw new NotLoggedInError(\n 'Token refresh is not available yet in this CLI version.',\n );\n }\n}\n","/**\n * File-backed credential store.\n *\n * Token resolution precedence (highest first):\n * 1. `RATIO_API_TOKEN` from the injected env reader — returned as-is\n * with ZERO filesystem access and ZERO refresher involvement.\n * 2. The requested profile (default: \"default\") from the credentials\n * file, silently refreshed via the injected TokenRefresher when it\n * is within 5 minutes of expiry.\n *\n * Write contract: atomic tmp + rename in the SAME directory, tmp created\n * with mode 0600 at open time (POSIX), parent directory created 0700,\n * belt-and-braces chmod 0600 after rename. On Windows no chmod / mode\n * checks are ever performed. Concurrent writers are last-writer-wins by\n * design — the atomic rename guarantees no half-written file, which is\n * sufficient for a single-developer CLI.\n *\n * No secret (access token, refresh token, raw file contents) is ever\n * included in an error message or a log line.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport { dirname } from 'node:path';\nimport {\n NotLoggedInError,\n TokenExpiredError,\n ValidationError,\n} from '../errors.js';\nimport { SystemClock } from './clock.js';\nimport type { Clock } from './clock.js';\nimport { defaultCredentialsPath } from './path.js';\nimport { NotImplementedRefresher } from './refresher.js';\nimport type { TokenRefresher } from './refresher.js';\nimport { parseCredentials } from './schema.js';\nimport type { Credentials, DeveloperSession, Profile, TokenSet } from './types.js';\n\n/** Milliseconds before expiry at which a silent refresh is triggered. */\nconst REFRESH_WINDOW_MS = 300_000;\n\n/** Env var that short-circuits all file access when set to a non-empty string. */\nconst ENV_TOKEN_VAR = 'RATIO_API_TOKEN';\n\n/**\n * Env var that short-circuits developer-session file access when set to a\n * non-empty string. Strictly separate from RATIO_API_TOKEN: this one carries\n * the developer sign-in bearer used for app-management calls, never the\n * OAuth access token.\n */\nconst ENV_DEVELOPER_TOKEN_VAR = 'RATIO_DEVELOPER_TOKEN';\n\nexport interface CredentialStoreOptions {\n /** Defaults to defaultCredentialsPath(). */\n readonly filePath?: string;\n /** Defaults to new SystemClock(). */\n readonly clock?: Clock;\n /** Defaults to new NotImplementedRefresher(). */\n readonly refresher?: TokenRefresher;\n /** Defaults to () => process.env — injected for env-precedence tests. */\n readonly envReader?: () => Readonly<Record<string, string | undefined>>;\n /** Defaults to process.platform. */\n readonly platform?: NodeJS.Platform;\n}\n\nexport interface CredentialStore {\n /** Reads the full credentials file. Throws NotLoggedInError if missing. */\n load(): Promise<Credentials>;\n /** Atomic write with 0600 on POSIX. tmp + rename in same dir. */\n save(creds: Credentials): Promise<void>;\n /** Deletes the credentials file. Idempotent. */\n clear(): Promise<void>;\n /**\n * Env precedence: if envReader().RATIO_API_TOKEN is set, returns it\n * WITHOUT reading the file, WITHOUT touching the refresher, WITHOUT\n * any fs I/O. This is the auditable \"no disk access\" path.\n *\n * Otherwise: reads the file, validates, computes\n * msUntilExpiry = new Date(profile.expiresAt).getTime() - clock.now()\n * If msUntilExpiry < 300_000 (5 min), calls refresher.refresh(...),\n * persists the new TokenSet atomically, returns the new accessToken.\n * Otherwise returns profile.accessToken.\n */\n getValidAccessToken(profileName?: string): Promise<string>;\n /**\n * Env precedence: RATIO_DEVELOPER_TOKEN if set (no fs I/O).\n * Otherwise: load(); if creds.developer is absent or within 5 minutes of\n * expiry, throws NotLoggedInError ('Developer signin required.').\n * Otherwise returns creds.developer.jwt.\n * NO refresh attempt — the caller drives the re-prompt UX.\n */\n getValidDeveloperToken(): Promise<string>;\n /**\n * Merge a DeveloperSession into the loaded credentials (creating the file\n * if absent), atomic tmp+rename, 0600.\n */\n saveDeveloperSession(session: DeveloperSession): Promise<void>;\n}\n\n/** Narrow an unknown thrown value to a Node errno error with the given code. */\nfunction hasErrnoCode(err: unknown, code: string): boolean {\n return (\n err instanceof Error &&\n (err as NodeJS.ErrnoException).code === code\n );\n}\n\nexport class FileCredentialStore implements CredentialStore {\n private readonly filePath: string;\n private readonly clock: Clock;\n private readonly refresher: TokenRefresher;\n private readonly envReader: () => Readonly<\n Record<string, string | undefined>\n >;\n private readonly platform: NodeJS.Platform;\n\n constructor(opts?: CredentialStoreOptions) {\n this.filePath = opts?.filePath ?? defaultCredentialsPath();\n this.clock = opts?.clock ?? new SystemClock();\n this.refresher = opts?.refresher ?? new NotImplementedRefresher();\n this.envReader = opts?.envReader ?? (() => process.env);\n this.platform = opts?.platform ?? process.platform;\n }\n\n async load(): Promise<Credentials> {\n this.reapplyFileModeIfDrifted();\n\n let raw: string;\n try {\n raw = fs.readFileSync(this.filePath, 'utf8');\n } catch (err) {\n if (hasErrnoCode(err, 'ENOENT')) {\n throw new NotLoggedInError('You are not signed in.');\n }\n throw err;\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch {\n // Never echo the raw contents — they may hold a truncated token.\n throw new ValidationError(\n 'credentials file is not valid JSON — run \"ratio auth login\" to reset',\n );\n }\n\n return parseCredentials(parsed);\n }\n\n async save(creds: Credentials): Promise<void> {\n const dir = dirname(this.filePath);\n fs.mkdirSync(dir, { recursive: true, mode: 0o700 });\n if (this.platform !== 'win32') {\n // mkdirSync does not re-mode a pre-existing directory; re-apply.\n fs.chmodSync(dir, 0o700);\n }\n\n const tmpPath = `${this.filePath}.${process.pid}.${crypto\n .randomBytes(8)\n .toString('hex')}.tmp`;\n try {\n // mode at open time closes the create-then-chmod race window.\n fs.writeFileSync(tmpPath, JSON.stringify(creds, null, 2), {\n mode: 0o600,\n });\n fs.renameSync(tmpPath, this.filePath);\n } catch (err) {\n try {\n fs.unlinkSync(tmpPath);\n } catch {\n // Best-effort cleanup: the tmp file may never have been created.\n }\n throw err;\n }\n\n if (this.platform !== 'win32') {\n // Belt-and-braces: rename may preserve a prior destination mode.\n fs.chmodSync(this.filePath, 0o600);\n }\n }\n\n async clear(): Promise<void> {\n try {\n fs.unlinkSync(this.filePath);\n } catch (err) {\n if (hasErrnoCode(err, 'ENOENT')) {\n return; // Idempotent: already gone.\n }\n throw err;\n }\n }\n\n async getValidAccessToken(profileName?: string): Promise<string> {\n const envToken = this.envReader()[ENV_TOKEN_VAR];\n if (typeof envToken === 'string' && envToken.length > 0) {\n return envToken;\n }\n\n const creds = await this.load();\n const name = profileName ?? 'default';\n const profile = creds.profiles[name];\n if (profile === undefined) {\n throw new NotLoggedInError('You are not signed in.');\n }\n\n const msUntilExpiry =\n new Date(profile.expiresAt).getTime() - this.clock.now();\n if (msUntilExpiry < REFRESH_WINDOW_MS) {\n return this.refreshAndPersist(creds, name, profile);\n }\n\n return profile.accessToken;\n }\n\n async getValidDeveloperToken(): Promise<string> {\n const envToken = this.envReader()[ENV_DEVELOPER_TOKEN_VAR];\n if (typeof envToken === 'string' && envToken.length > 0) {\n return envToken;\n }\n\n let creds: Credentials;\n try {\n creds = await this.load();\n } catch (err) {\n if (err instanceof NotLoggedInError) {\n throw new NotLoggedInError('Developer signin required.');\n }\n throw err;\n }\n\n const session = creds.developer;\n if (session === undefined) {\n throw new NotLoggedInError('Developer signin required.');\n }\n\n const msUntilExpiry =\n new Date(session.expiresAt).getTime() - this.clock.now();\n if (msUntilExpiry < REFRESH_WINDOW_MS) {\n // No refresh endpoint exists for developer sessions — the caller\n // drives a fresh interactive sign-in instead.\n throw new NotLoggedInError('Developer signin required.');\n }\n\n return session.jwt;\n }\n\n async saveDeveloperSession(session: DeveloperSession): Promise<void> {\n let creds: Credentials;\n try {\n creds = await this.load();\n } catch (err) {\n if (err instanceof NotLoggedInError) {\n // Edge case: no prior credentials file. Create a fresh v1 shell so\n // the merged write below still validates on the next load().\n creds = { version: 1, server: '', clientId: '', profiles: {} };\n } else {\n throw err;\n }\n }\n\n const updated: Credentials = {\n ...creds,\n developer: session,\n };\n await this.save(updated);\n }\n\n /**\n * Exchange the profile's refresh token for a fresh token set, merge it\n * into the loaded credentials (preserving every other profile), persist\n * atomically, and return the new access token. A refresher failure is\n * wrapped in TokenExpiredError; the underlying message is deliberately\n * discarded so a secret can never leak through the error surface.\n */\n private async refreshAndPersist(\n creds: Credentials,\n name: string,\n profile: Profile,\n ): Promise<string> {\n let refreshed: TokenSet;\n try {\n refreshed = await this.refresher.refresh(profile.refreshToken);\n } catch {\n throw new TokenExpiredError(\n 'Your session has expired and could not be refreshed.',\n );\n }\n\n const updated: Credentials = {\n ...creds,\n profiles: {\n ...creds.profiles,\n [name]: {\n ...profile,\n accessToken: refreshed.accessToken,\n refreshToken: refreshed.refreshToken,\n expiresAt: refreshed.expiresAt,\n },\n },\n };\n await this.save(updated);\n return refreshed.accessToken;\n }\n\n /**\n * POSIX-only startup permission check: if the file exists with a mode\n * other than 0600, re-apply 0600 and emit a warning to stderr. Never\n * runs on Windows (stat modes there do not map to POSIX bits and chmod\n * must not be called). Missing file is NOT an error here — load()\n * reports it as NotLoggedInError.\n */\n private reapplyFileModeIfDrifted(): void {\n if (this.platform === 'win32') {\n return;\n }\n\n let stat: fs.Stats;\n try {\n stat = fs.statSync(this.filePath);\n } catch (err) {\n if (hasErrnoCode(err, 'ENOENT')) {\n return; // load() turns the missing file into NotLoggedInError.\n }\n throw err;\n }\n\n const mode = stat.mode & 0o777;\n if (mode !== 0o600) {\n fs.chmodSync(this.filePath, 0o600);\n process.stderr.write(\n `[warn] credentials file permissions were 0o${mode.toString(8)}; corrected to 0600.\\n`,\n );\n }\n }\n}\n","/**\n * Runtime validation for the on-disk credentials file.\n *\n * The parser is deliberately strict: unknown top-level keys, missing\n * fields, non-ISO timestamps, and any `version` other than `1` are all\n * rejected with a typed ValidationError. Error messages NEVER embed the\n * raw file contents — a malformed file may contain a truncated token.\n */\n\nimport { z } from 'zod';\nimport { ValidationError } from '../errors.js';\nimport type { Credentials } from './types.js';\n\nconst identitySchema = z\n .object({\n developerId: z.string(),\n email: z.string(),\n // Token-derived fields captured at login. Optional (additive) so files\n // written before these fields existed still validate as version 1.\n merchantId: z.string().optional(),\n scopes: z.array(z.string()).optional(),\n })\n .strict();\n\nconst profileSchema = z\n .object({\n accessToken: z.string(),\n refreshToken: z.string(),\n expiresAt: z.string().datetime({ offset: true }),\n identity: identitySchema,\n obtainedAt: z.string().datetime({ offset: true }),\n })\n .strict();\n\nconst developerSessionSchema = z\n .object({\n jwt: z.string(),\n developerId: z.string(),\n email: z.string(),\n expiresAt: z.string().datetime({ offset: true }),\n obtainedAt: z.string().datetime({ offset: true }),\n })\n .strict();\n\n/** Strict zod schema for the version-1 credentials file. */\nexport const credentialsSchema = z\n .object({\n version: z.literal(1),\n server: z.string(),\n clientId: z.string(),\n profiles: z.record(z.string(), profileSchema),\n // Optional cached developer session. Additive so files written before\n // this field existed still validate as version 1.\n developer: developerSessionSchema.optional(),\n })\n .strict();\n\n/**\n * Validate an already-JSON-parsed value against the version-1 shape.\n *\n * Throws ValidationError on any mismatch. A recognisable-but-unsupported\n * `version` gets a dedicated upgrade message; the version label is only\n * echoed when it is a number so arbitrary file contents can never leak\n * into an error message.\n */\nexport function parseCredentials(input: unknown): Credentials {\n if (typeof input === 'object' && input !== null && 'version' in input) {\n const version = (input as { version: unknown }).version;\n if (version !== 1) {\n const label = typeof version === 'number' ? String(version) : 'unknown';\n throw new ValidationError(\n `credentials file version ${label} is unsupported by this CLI — upgrade the CLI or sign in again`,\n );\n }\n }\n\n const result = credentialsSchema.safeParse(input);\n if (!result.success) {\n throw new ValidationError(\n 'credentials file schema mismatch — expected v1 shape',\n );\n }\n return result.data as Credentials;\n}\n"],"mappings":";AAAA,SAAS,SAAAA,cAAa;;;ACAtB,SAAS,SAAS,cAAc;;;ACUzB,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAMT;AACD,UAAM,KAAK,OAAO;AAClB,SAAK,OAAO,WAAW;AACvB,SAAK,OAAO,KAAK;AACjB,SAAK,WAAW,KAAK;AACrB,QAAI,KAAK,SAAS,OAAW,MAAK,OAAO,KAAK;AAC9C,QAAI,KAAK,YAAY,OAAW,MAAK,UAAU,KAAK;AAAA,EACtD;AACF;AAUO,IAAM,mBAAN,cAA+B,cAAc;AAAA,EAClD,YACE,SACA,OAAe,sCACf;AACA,UAAM,EAAE,MAAM,iBAAiB,UAAU,GAAG,SAAS,KAAK,CAAC;AAAA,EAC7D;AACF;AAEO,IAAM,oBAAN,cAAgC,cAAc;AAAA,EACnD,YACE,SACA,OAAe,mDACf;AACA,UAAM,EAAE,MAAM,iBAAiB,UAAU,GAAG,SAAS,KAAK,CAAC;AAAA,EAC7D;AACF;AAsCO,IAAM,kBAAN,cAA8B,cAAc;AAAA,EACjD,YAAY,SAAiB,MAAe;AAC1C,UAAM,OAA2E;AAAA,MAC/E,MAAM;AAAA,MACN,UAAU;AAAA,MACV;AAAA,IACF;AACA,QAAI,SAAS,OAAW,MAAK,OAAO;AACpC,UAAM,IAAI;AAAA,EACZ;AACF;AA6BO,SAAS,gBAAgB,KAAoC;AAClE,SAAO,eAAe;AACxB;;;ACjHA,SAAS,mBAAmB,KAAiD;AAC3E,SACE,eAAe,SACf,WAAW,OACX,IAAI,UAAU,QACd,IAAI,UAAU;AAElB;A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