@moda-ai/cli 1.22.0 → 1.22.2

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.
Files changed (115) hide show
  1. package/dist/cli-g8qs2tj9.js +9777 -0
  2. package/dist/cli-pwbvtes8.js +2312 -0
  3. package/dist/cli-qszcpda3.js +284 -0
  4. package/dist/cli.js +4775 -1159
  5. package/dist/index-6h0nc1r5.js +2765 -0
  6. package/dist/provision-j5gq8cvx.js +72 -0
  7. package/package.json +3 -2
  8. package/skills/integration/index.json +2 -2
  9. package/dist/agent-schemas.d.ts +0 -3
  10. package/dist/agent-schemas.js +0 -358
  11. package/dist/agent.d.ts +0 -5
  12. package/dist/agent.js +0 -477
  13. package/dist/analyst-tui.d.ts +0 -81
  14. package/dist/analyst-tui.js +0 -314
  15. package/dist/api-client.d.ts +0 -46
  16. package/dist/api-client.js +0 -120
  17. package/dist/ask-stream.d.ts +0 -146
  18. package/dist/ask-stream.js +0 -473
  19. package/dist/auth-storage.d.ts +0 -35
  20. package/dist/auth-storage.js +0 -159
  21. package/dist/auth.d.ts +0 -50
  22. package/dist/auth.js +0 -694
  23. package/dist/cli-session.d.ts +0 -26
  24. package/dist/cli-session.js +0 -169
  25. package/dist/cli.d.ts +0 -44
  26. package/dist/command-context.d.ts +0 -62
  27. package/dist/command-context.js +0 -57
  28. package/dist/command-registry.d.ts +0 -22
  29. package/dist/command-registry.js +0 -15
  30. package/dist/config.d.ts +0 -60
  31. package/dist/config.js +0 -110
  32. package/dist/doctor.d.ts +0 -79
  33. package/dist/doctor.js +0 -1182
  34. package/dist/errors.d.ts +0 -50
  35. package/dist/errors.js +0 -64
  36. package/dist/exit-funnel.d.ts +0 -14
  37. package/dist/exit-funnel.js +0 -53
  38. package/dist/harness-artifact-bodies.d.ts +0 -28
  39. package/dist/harness-artifact-bodies.js +0 -276
  40. package/dist/harness-candidates.d.ts +0 -77
  41. package/dist/harness-candidates.js +0 -482
  42. package/dist/harness-remote.d.ts +0 -135
  43. package/dist/harness-remote.js +0 -540
  44. package/dist/harness-report.d.ts +0 -145
  45. package/dist/harness-report.js +0 -1579
  46. package/dist/harness-sync-limits.d.ts +0 -8
  47. package/dist/harness-sync-limits.js +0 -21
  48. package/dist/harness.d.ts +0 -463
  49. package/dist/harness.js +0 -4009
  50. package/dist/init/index.d.ts +0 -78
  51. package/dist/init/index.js +0 -1442
  52. package/dist/init/mcp.d.ts +0 -2
  53. package/dist/init/mcp.js +0 -27
  54. package/dist/init/progress-board.d.ts +0 -80
  55. package/dist/init/progress-board.js +0 -225
  56. package/dist/init/rules.d.ts +0 -6
  57. package/dist/init/rules.js +0 -171
  58. package/dist/init/sdk-catalog.d.ts +0 -10
  59. package/dist/init/sdk-catalog.js +0 -80
  60. package/dist/init/sdk-guide.d.ts +0 -19
  61. package/dist/init/sdk-guide.js +0 -185
  62. package/dist/init/sdk-integration.d.ts +0 -53
  63. package/dist/init/sdk-integration.js +0 -835
  64. package/dist/init/sdk-protocol.d.ts +0 -135
  65. package/dist/init/sdk-protocol.js +0 -152
  66. package/dist/init/sdk-verification.d.ts +0 -27
  67. package/dist/init/sdk-verification.js +0 -123
  68. package/dist/init/tenant.d.ts +0 -67
  69. package/dist/init/tenant.js +0 -421
  70. package/dist/intelligence-schema.d.ts +0 -349
  71. package/dist/intelligence-schema.js +0 -174
  72. package/dist/keys.d.ts +0 -47
  73. package/dist/keys.js +0 -136
  74. package/dist/manifest.d.ts +0 -5
  75. package/dist/manifest.js +0 -114
  76. package/dist/markdown-terminal.d.ts +0 -49
  77. package/dist/markdown-terminal.js +0 -212
  78. package/dist/output.d.ts +0 -191
  79. package/dist/output.js +0 -624
  80. package/dist/production-intelligence.d.ts +0 -175
  81. package/dist/production-intelligence.js +0 -1430
  82. package/dist/profile-commands.d.ts +0 -10
  83. package/dist/profile-commands.js +0 -342
  84. package/dist/profiles.d.ts +0 -112
  85. package/dist/profiles.js +0 -573
  86. package/dist/prompts-ab.d.ts +0 -71
  87. package/dist/prompts-ab.js +0 -313
  88. package/dist/prompts-propose.d.ts +0 -15
  89. package/dist/prompts-propose.js +0 -212
  90. package/dist/prompts.d.ts +0 -58
  91. package/dist/prompts.js +0 -418
  92. package/dist/provision.d.ts +0 -28
  93. package/dist/provision.js +0 -104
  94. package/dist/redact.d.ts +0 -2
  95. package/dist/redact.js +0 -90
  96. package/dist/schemas.d.ts +0 -225
  97. package/dist/schemas.js +0 -126
  98. package/dist/skills-bundled.d.ts +0 -35
  99. package/dist/skills-bundled.js +0 -157
  100. package/dist/skills-manifest.d.ts +0 -33
  101. package/dist/skills-manifest.js +0 -244
  102. package/dist/skills.d.ts +0 -57
  103. package/dist/skills.js +0 -777
  104. package/dist/sync.d.ts +0 -5
  105. package/dist/sync.js +0 -36
  106. package/dist/telemetry.d.ts +0 -56
  107. package/dist/telemetry.js +0 -167
  108. package/dist/transforms.d.ts +0 -25
  109. package/dist/transforms.js +0 -102
  110. package/dist/tui.d.ts +0 -48
  111. package/dist/tui.js +0 -393
  112. package/dist/update-check.d.ts +0 -31
  113. package/dist/update-check.js +0 -141
  114. package/dist/workspace.d.ts +0 -12
  115. package/dist/workspace.js +0 -1294
@@ -1,10 +0,0 @@
1
- import type { CommandContext } from './command-context.js';
2
- type CommandResult = {
3
- exitCode: number;
4
- };
5
- export declare function runAuthCommand(context: CommandContext): Promise<CommandResult>;
6
- export declare function runProfilesCommand(context: CommandContext): Promise<CommandResult>;
7
- export declare function runConfigCommand(context: CommandContext): Promise<CommandResult>;
8
- export declare function runKeysCommand(context: CommandContext): Promise<CommandResult>;
9
- export {};
10
- //# sourceMappingURL=profile-commands.d.ts.map
@@ -1,342 +0,0 @@
1
- import { authFetch, clearAuthSession, isAuthSessionValid, loadAuthSession, login, revokeCliSessionToken, } from './auth.js';
2
- import { EXIT_AUTH_REQUIRED, EXIT_OK } from './output.js';
3
- import { KEY_LIFECYCLE_ENDPOINT_REQUIREMENTS, createLocalKeyDescriptor, loadLocalKeyDescriptors, upsertLocalKeyDescriptor, writeLocalApiKeySecret, } from './keys.js';
4
- import { DEFAULT_INGEST_URL, PROD_BASE_URL, clearStoredApiKeyCredentials, ensureSecretFilePermissions, getActiveProfile, getModaPaths, loadProfileConfig, resolveApiKeyFromActiveProfile, resolveSecretReference, secretFilePathFromRef, setActiveProfile, upsertProfile, } from './profiles.js';
5
- import { CliInputError } from './errors.js';
6
- // Bound the `auth status --online` probe: without a signal, undici's defaults
7
- // can stall a status check for minutes on a black-holed connection.
8
- const ONLINE_PROBE_TIMEOUT_MS = 5_000;
9
- function subcommand(context) {
10
- return context.positionals[0];
11
- }
12
- function requirePositional(context, index, usage) {
13
- const value = context.positionals[index];
14
- if (!value)
15
- throw new CliInputError('Missing required argument.', usage);
16
- return value;
17
- }
18
- function flag(context, name) {
19
- const value = context.flags[name];
20
- return value && value !== 'true' ? value : undefined;
21
- }
22
- function boolFlag(context, name) {
23
- return context.flags[name] === 'true';
24
- }
25
- function normalizeEnvironment(value) {
26
- if (value === 'local' || value === 'dev' || value === 'staging' || value === 'prod') {
27
- return value;
28
- }
29
- return 'prod';
30
- }
31
- function defaultBaseUrl(environment) {
32
- if (environment === 'local')
33
- return 'http://localhost:3000';
34
- if (environment === 'staging')
35
- return 'https://staging.moda.dev';
36
- return PROD_BASE_URL;
37
- }
38
- function defaultIngestUrl(environment) {
39
- if (environment === 'local')
40
- return 'http://localhost:8787';
41
- return DEFAULT_INGEST_URL;
42
- }
43
- function redactSecret(value) {
44
- if (!value)
45
- return undefined;
46
- if (value.length <= 12)
47
- return '<redacted>';
48
- return `${value.slice(0, 8)}...${value.slice(-4)}`;
49
- }
50
- function serializeProfile(profile, activeProfile) {
51
- return {
52
- name: profile.name,
53
- active: profile.name === activeProfile,
54
- environment: profile.environment,
55
- base_url: profile.base_url,
56
- ingest_url: profile.ingest_url,
57
- tenant_id: profile.tenant_id,
58
- workspace_id: profile.workspace_id,
59
- api_key_ref: profile.api_key_ref,
60
- auth_token_ref: profile.auth_token_ref,
61
- };
62
- }
63
- export async function runAuthCommand(context) {
64
- switch (subcommand(context)) {
65
- case 'login': {
66
- const screen = flag(context, 'screen') === 'signup' ? 'signup' : 'login';
67
- await login(screen, { profile: context.profile, env: context.env });
68
- context.output.writeData({
69
- status: 'authenticated',
70
- profile: context.profile ?? process.env.MODA_PROFILE ?? null,
71
- });
72
- return { exitCode: 0 };
73
- }
74
- case 'logout': {
75
- // moda_ct session tokens are server-side revocable: best-effort revoke
76
- // (bounded, catch-all inside) before the local deletion. Legacy
77
- // auth0-kind sessions have nothing to revoke.
78
- await revokeCliSessionToken({ profile: context.profile, env: context.env });
79
- clearAuthSession({ profile: context.profile, env: context.env });
80
- // The session token is only the control-plane credential. Data commands
81
- // authenticate with the moda_sk_ API key written by `moda init`
82
- // (~/.moda/config.json + profile api_key_ref), so logout must clear it
83
- // too or the next login keeps acting as the old tenant.
84
- const apiKeyCleared = clearStoredApiKeyCredentials({
85
- profile: context.profile,
86
- env: context.env,
87
- });
88
- if (context.env.MODA_API_KEY) {
89
- console.error('Note: MODA_API_KEY is set in the environment and still takes precedence. Unset it to fully sign out.');
90
- }
91
- context.output.writeData({
92
- status: 'logged_out',
93
- profile: context.profile ?? process.env.MODA_PROFILE ?? null,
94
- api_key_cleared: apiKeyCleared,
95
- });
96
- return { exitCode: 0 };
97
- }
98
- case 'whoami': {
99
- const session = loadAuthSession({ profile: context.profile, env: context.env });
100
- if (!session) {
101
- throw new CliInputError('Not authenticated.', 'Run "moda auth login" or "moda init".');
102
- }
103
- const response = await authFetch('/api/cli/context', {}, { profile: context.profile, env: context.env });
104
- if (!response.ok) {
105
- const body = await response.text();
106
- throw new Error(`Failed to fetch auth context (${response.status}): ${body}`);
107
- }
108
- const data = await response.json();
109
- context.output.writeData({
110
- profile: context.profile ?? process.env.MODA_PROFILE ?? null,
111
- session: {
112
- expires_at: session.expires_at,
113
- token_type: session.token_type ?? 'bearer',
114
- },
115
- context: data,
116
- });
117
- return { exitCode: 0 };
118
- }
119
- case 'status': {
120
- // Being logged out is an expected state for `auth status`, not a
121
- // failure: it must never throw CliAuthError (no error block, no error
122
- // telemetry classification) and must never trigger a browser open. It
123
- // reports clean data in every mode and signals session validity purely
124
- // through the exit code (0 valid, 4 auth required).
125
- const authOptions = { profile: context.profile, env: context.env };
126
- const session = loadAuthSession({ ...authOptions, includeExpired: true });
127
- const loggedIn = isAuthSessionValid(session);
128
- const data = {
129
- loggedIn,
130
- profile: context.profile ??
131
- context.env.MODA_PROFILE ??
132
- session?.profile ??
133
- null,
134
- expiresAt: session
135
- ? new Date(session.expires_at * 1000).toISOString()
136
- : null,
137
- };
138
- // `user` is emitted only when the stored session carries an email —
139
- // the PKCE exchange path persists user_email; legacy sessions lack it.
140
- if (session?.user_email) {
141
- data.user = { email: session.user_email };
142
- }
143
- if (boolFlag(context, 'online')) {
144
- let online = { reachable: false };
145
- try {
146
- const response = await authFetch('/api/cli/context', { signal: AbortSignal.timeout(ONLINE_PROBE_TIMEOUT_MS) }, authOptions);
147
- // Any HTTP response means the server was reached; `ok` separates a
148
- // healthy 2xx from e.g. a 401/500.
149
- online = { reachable: true, ok: response.ok };
150
- if (response.ok) {
151
- const body = await response.json();
152
- if (Array.isArray(body.tenants)) {
153
- online.tenantCount = body.tenants.length;
154
- }
155
- }
156
- }
157
- catch {
158
- // Network failure, probe timeout, or no stored token to send: report
159
- // reachable: false; the exit code still follows local session
160
- // validity, never the online probe.
161
- }
162
- data.online = online;
163
- }
164
- context.output.writeData(data);
165
- return { exitCode: loggedIn ? EXIT_OK : EXIT_AUTH_REQUIRED };
166
- }
167
- case 'token': {
168
- const session = loadAuthSession({ profile: context.profile, env: context.env });
169
- if (!session) {
170
- if (context.flags.json === 'true') {
171
- // An explicit --json caller gets a parseable failure on stdout.
172
- process.stdout.write(`${JSON.stringify({ error: 'not_authenticated' })}\n`);
173
- }
174
- else {
175
- console.error('Not authenticated. Run "moda auth login".');
176
- }
177
- return { exitCode: EXIT_AUTH_REQUIRED };
178
- }
179
- // `auth token` exists to compose as $(moda auth token) and in pipes.
180
- // Command substitution IS a pipe, so stdout is a non-TTY and this CLI
181
- // would auto-select agent mode and wrap the token in a JSON envelope,
182
- // breaking every composition. This command therefore deliberately
183
- // bypasses the CliOutput envelope machinery in EVERY output mode
184
- // (human/json/agent/agent-stream) and writes exactly the bare token plus
185
- // a trailing newline to stdout — nothing else.
186
- process.stdout.write(`${session.access_token}\n`);
187
- return { exitCode: EXIT_OK };
188
- }
189
- default:
190
- throw new CliInputError('Unknown auth command.', 'Usage: moda auth <login|logout|status|token|whoami>');
191
- }
192
- }
193
- export async function runProfilesCommand(context) {
194
- switch (subcommand(context)) {
195
- case 'list': {
196
- const config = loadProfileConfig({ env: context.env });
197
- context.output.writeData({
198
- active_profile: config.active_profile,
199
- profiles: Object.values(config.profiles).map((profile) => serializeProfile(profile, config.active_profile)),
200
- migrations: config.migrations,
201
- });
202
- return { exitCode: 0 };
203
- }
204
- case 'use': {
205
- const name = requirePositional(context, 1, 'Usage: moda profiles use <name>');
206
- const config = setActiveProfile(name, { env: context.env });
207
- context.output.writeData({
208
- active_profile: config.active_profile,
209
- profile: serializeProfile(config.profiles[name], config.active_profile),
210
- });
211
- return { exitCode: 0 };
212
- }
213
- case 'create': {
214
- const name = requirePositional(context, 1, 'Usage: moda profiles create <name>');
215
- const environment = normalizeEnvironment(flag(context, 'environment') ?? name);
216
- const profile = {
217
- name,
218
- environment,
219
- base_url: flag(context, 'base-url') ?? defaultBaseUrl(environment),
220
- ingest_url: flag(context, 'ingest-url') ?? defaultIngestUrl(environment),
221
- tenant_id: flag(context, 'tenant-id'),
222
- workspace_id: flag(context, 'workspace-id'),
223
- api_key_ref: flag(context, 'api-key-ref'),
224
- metadata: {
225
- created_at: new Date().toISOString(),
226
- source: 'profiles.create',
227
- },
228
- };
229
- const config = upsertProfile(profile, { env: context.env });
230
- const next = boolFlag(context, 'use')
231
- ? setActiveProfile(name, { env: context.env })
232
- : config;
233
- context.output.writeData({
234
- active_profile: next.active_profile,
235
- profile: serializeProfile(next.profiles[name], next.active_profile),
236
- });
237
- return { exitCode: 0 };
238
- }
239
- case 'doctor': {
240
- const requested = context.positionals[1];
241
- const config = loadProfileConfig({ env: context.env });
242
- const activeName = requested ?? context.profile ?? config.active_profile;
243
- const profile = config.profiles[activeName];
244
- if (!profile)
245
- throw new CliInputError(`Moda profile '${activeName}' does not exist.`);
246
- const secretPath = profile.api_key_ref ? secretFilePathFromRef(profile.api_key_ref) : undefined;
247
- const permission = secretPath ? ensureSecretFilePermissions(secretPath) : undefined;
248
- context.output.writeData({
249
- profile: serializeProfile(profile, config.active_profile),
250
- checks: [
251
- { id: 'profile_exists', status: 'pass' },
252
- {
253
- id: 'api_key_available',
254
- status: resolveSecretReference(profile.api_key_ref) ? 'pass' : 'warning',
255
- },
256
- {
257
- id: 'tenant_selected',
258
- status: profile.tenant_id ? 'pass' : 'warning',
259
- },
260
- ...(permission
261
- ? [{
262
- id: 'secret_file_permissions',
263
- status: permission.secure ? 'pass' : 'fail',
264
- details: permission,
265
- }]
266
- : []),
267
- ],
268
- });
269
- return { exitCode: 0 };
270
- }
271
- default:
272
- throw new CliInputError('Unknown profiles command.', 'Usage: moda profiles <list|use|create|doctor>');
273
- }
274
- }
275
- export async function runConfigCommand(context) {
276
- if (subcommand(context) !== 'show') {
277
- throw new CliInputError('Unknown config command.', 'Usage: moda config show');
278
- }
279
- const config = loadProfileConfig({ env: context.env });
280
- const profile = getActiveProfile({ profile: context.profile, env: context.env });
281
- context.output.writeData({
282
- moda_dir: getModaPaths({ env: context.env }).dir,
283
- active_profile: profile.name,
284
- profile: serializeProfile(profile, config.active_profile),
285
- resolved: {
286
- api_key: redactSecret(resolveApiKeyFromActiveProfile({ profile: profile.name, env: context.env })),
287
- base_url: profile.base_url,
288
- ingest_url: profile.ingest_url,
289
- tenant_id: profile.tenant_id,
290
- workspace_id: profile.workspace_id,
291
- },
292
- migrations: config.migrations,
293
- });
294
- return { exitCode: 0 };
295
- }
296
- export async function runKeysCommand(context) {
297
- switch (subcommand(context)) {
298
- case 'list': {
299
- const profile = context.profile ?? loadProfileConfig({ env: context.env }).active_profile;
300
- const keys = loadLocalKeyDescriptors({ env: context.env })
301
- .filter((key) => !profile || key.profile === profile);
302
- context.output.writeData({
303
- profile,
304
- keys,
305
- endpoint_requirements: KEY_LIFECYCLE_ENDPOINT_REQUIREMENTS,
306
- });
307
- return { exitCode: 0 };
308
- }
309
- case 'create': {
310
- const active = getActiveProfile({ profile: context.profile, env: context.env });
311
- const name = flag(context, 'name') ?? `${active.name}-${Date.now()}`;
312
- const descriptor = createLocalKeyDescriptor({
313
- profile: active.name,
314
- environment: active.environment,
315
- name,
316
- purpose: 'data_api',
317
- tenant_id: active.tenant_id,
318
- workspace_id: active.workspace_id,
319
- });
320
- const value = flag(context, 'value');
321
- const secretPath = value
322
- ? writeLocalApiKeySecret(descriptor, value, { env: context.env })
323
- : undefined;
324
- upsertLocalKeyDescriptor(descriptor, { env: context.env });
325
- context.output.writeData({
326
- key: descriptor,
327
- secret_path: secretPath,
328
- endpoint_requirements: KEY_LIFECYCLE_ENDPOINT_REQUIREMENTS.create,
329
- });
330
- return { exitCode: 0 };
331
- }
332
- case 'rotate':
333
- case 'revoke': {
334
- const action = subcommand(context);
335
- const keyId = requirePositional(context, 1, `Usage: moda keys ${action} <key_id>`);
336
- throw new CliInputError(`moda keys ${action} is waiting on Moda Cloud key lifecycle support for ${keyId}.`, `Required endpoint: ${KEY_LIFECYCLE_ENDPOINT_REQUIREMENTS[action]}`);
337
- }
338
- default:
339
- throw new CliInputError('Unknown keys command.', 'Usage: moda keys <list|create|rotate|revoke>');
340
- }
341
- }
342
- //# sourceMappingURL=profile-commands.js.map
@@ -1,112 +0,0 @@
1
- export declare const PROFILE_CONFIG_VERSION = 1;
2
- export declare const PROD_BASE_URL = "https://moda.dev";
3
- export declare const DEFAULT_INGEST_URL = "https://moda-ingest.modas.workers.dev";
4
- export declare const DEFAULT_PROFILE_NAME = "prod";
5
- export type ModaEnvironment = 'local' | 'dev' | 'staging' | 'prod';
6
- export type SecretReference = `env:${string}` | `file:${string}` | 'legacy:config.api_key' | 'legacy:auth.access_token';
7
- export interface LegacyCliConfig {
8
- api_key?: string;
9
- ingest_url?: string;
10
- tenant_id?: string;
11
- }
12
- export interface ModaProfile {
13
- name: string;
14
- environment: ModaEnvironment;
15
- base_url: string;
16
- ingest_url?: string;
17
- tenant_id?: string;
18
- workspace_id?: string;
19
- api_key_ref?: SecretReference;
20
- auth_token_ref?: SecretReference;
21
- metadata?: Record<string, unknown>;
22
- }
23
- export interface ProfileMigrationState {
24
- legacy_config: {
25
- path: string;
26
- present: boolean;
27
- has_api_key: boolean;
28
- has_ingest_url: boolean;
29
- has_tenant_id: boolean;
30
- };
31
- legacy_auth: {
32
- path: string;
33
- present: boolean;
34
- has_access_token: boolean;
35
- expires_at?: number;
36
- expired?: boolean;
37
- };
38
- }
39
- export interface ProfileConfig {
40
- version: typeof PROFILE_CONFIG_VERSION;
41
- active_profile: string;
42
- profiles: Record<string, ModaProfile>;
43
- migrations: ProfileMigrationState;
44
- }
45
- export interface ProfileIOOptions {
46
- home?: string;
47
- profile?: string;
48
- now?: Date;
49
- env?: NodeJS.ProcessEnv;
50
- }
51
- export interface ModaPaths {
52
- home: string;
53
- dir: string;
54
- legacyConfigPath: string;
55
- legacyAuthPath: string;
56
- profileConfigPath: string;
57
- secretsDir: string;
58
- }
59
- export interface SecretFilePermissionStatus {
60
- path: string;
61
- exists: boolean;
62
- secure: boolean;
63
- repaired: boolean;
64
- mode?: string;
65
- reason?: string;
66
- }
67
- export declare function resolveModaHome(options?: ProfileIOOptions): string;
68
- export declare function getModaPaths(options?: ProfileIOOptions): ModaPaths;
69
- export declare function getModaDir(options?: ProfileIOOptions): string;
70
- export declare function getLegacyConfigPath(options?: ProfileIOOptions): string;
71
- export declare function loadLegacyCliConfig(options?: ProfileIOOptions): LegacyCliConfig;
72
- export declare function writeLegacyCliConfig(update: LegacyCliConfig, options?: ProfileIOOptions): LegacyCliConfig;
73
- export declare function createDefaultProfiles(options?: ProfileIOOptions): Record<string, ModaProfile>;
74
- export declare function isLoopbackBaseUrl(url: string): boolean;
75
- export declare function assertValidProfileName(name: string): void;
76
- export declare function inspectProfileMigrationState(options?: ProfileIOOptions): ProfileMigrationState;
77
- export declare function loadProfileConfig(options?: ProfileIOOptions): ProfileConfig;
78
- export declare function saveProfileConfig(config: ProfileConfig, options?: ProfileIOOptions): void;
79
- export declare function getActiveProfile(options?: ProfileIOOptions): ModaProfile;
80
- export declare function setActiveProfile(name: string, options?: ProfileIOOptions): ProfileConfig;
81
- export declare function upsertProfile(profile: ModaProfile, options?: ProfileIOOptions): ProfileConfig;
82
- export declare function syncLegacyConfigToProfile(legacy: LegacyCliConfig, options?: ProfileIOOptions): ProfileConfig;
83
- /**
84
- * Forget the stored data-plane credentials (`moda_sk_` API key + tenant
85
- * binding written by `moda init`): the legacy config's api_key/tenant_id and
86
- * the target profile's api_key_ref/tenant_id, deleting `file:` key secrets
87
- * under ~/.moda. Called by `moda auth logout` — without this, analytics
88
- * commands keep authenticating as the old tenant after a re-login, because
89
- * they use the x-api-key plane, not the session token. MODA_API_KEY in the
90
- * environment still wins at resolve time.
91
- *
92
- * The legacy config must be cleared BEFORE reading the profile config:
93
- * applyLegacyAwareness re-derives api_key_ref onto the prod profile on every
94
- * load while config.json still holds an api_key.
95
- */
96
- export declare function clearStoredApiKeyCredentials(options?: ProfileIOOptions): boolean;
97
- export declare function secretFilePathFromRef(reference: SecretReference, options?: ProfileIOOptions): string | undefined;
98
- export declare function resolveSecretReference(reference: SecretReference | undefined, options?: ProfileIOOptions): string | undefined;
99
- export declare function resolveApiKeyFromActiveProfile(options?: ProfileIOOptions): string | undefined;
100
- /**
101
- * Vercel serves moda.dev as canonical and 308-redirects www to the apex. Node
102
- * fetch strips Authorization on cross-host redirects, which breaks moda init
103
- * step 3 when the base URL still points at www.
104
- */
105
- export declare function normalizeModaBaseUrl(url: string): string;
106
- export declare function resolveBaseUrl(options?: ProfileIOOptions): string;
107
- export declare function resolveIngestUrl(options?: ProfileIOOptions): string;
108
- export declare function resolveIngestUrlFromActiveProfile(options?: ProfileIOOptions): string | undefined;
109
- export declare function resolveTenantIdFromActiveProfile(options?: ProfileIOOptions): string | undefined;
110
- export declare function ensureSecretFilePermissions(path: string, repair?: boolean): SecretFilePermissionStatus;
111
- export declare function writeSecretJsonFile(path: string, value: unknown): void;
112
- //# sourceMappingURL=profiles.d.ts.map