@sequenceholdings/studio-cli 0.4.2 → 0.4.5
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 +83 -18
- package/dist/app/agent-refs.d.ts +16 -0
- package/dist/app/agent-refs.js +18 -6
- package/dist/app/application-registration.d.ts +11 -3
- package/dist/app/application-registration.js +20 -6
- package/dist/app/application-suggestions.d.ts +58 -0
- package/dist/app/application-suggestions.js +164 -0
- package/dist/app/deploy.js +7 -4
- package/dist/app/env-bindings.js +2 -2
- package/dist/app/manifest-validation.d.ts +5 -0
- package/dist/app/manifest-validation.js +60 -22
- package/dist/app/manifest.d.ts +33 -0
- package/dist/app/manifest.js +16 -0
- package/dist/app/readme.d.ts +6 -3
- package/dist/app/readme.js +36 -6
- package/dist/app/scaffold.js +2 -1
- package/dist/artifact/delegate.js +6 -34
- package/dist/auth-cmds/commands.js +2 -2
- package/dist/auth.d.ts +0 -9
- package/dist/auth.js +2 -29
- package/dist/config.d.ts +7 -20
- package/dist/config.js +22 -64
- package/dist/envs/commands.js +17 -67
- package/dist/functions/commands.js +2 -2
- package/dist/login.d.ts +0 -6
- package/dist/login.js +3 -34
- package/dist/main.js +2 -2
- package/dist/orm/delegate.js +2 -2
- package/dist/pipeline/discovery.js +2 -2
- package/dist/pipeline/lifecycle.js +2 -2
- package/dist/pipeline/repin-orm.js +3 -3
- package/dist/process/commands.js +4 -8
- package/dist/repos/commands.js +2 -2
- package/dist/storage/commands.js +2 -2
- package/package.json +9 -9
- package/dist/env-catalog.d.ts +0 -63
- package/dist/env-catalog.js +0 -121
package/dist/config.js
CHANGED
|
@@ -5,8 +5,7 @@ import { homedir } from 'node:os';
|
|
|
5
5
|
import { basename, dirname, join } from 'node:path';
|
|
6
6
|
import { promisify } from 'node:util';
|
|
7
7
|
import { parse as parseToml, stringify as stringifyToml } from 'smol-toml';
|
|
8
|
-
import {
|
|
9
|
-
import { fetchCatalog, readCachedCatalog, } from './env-catalog.js';
|
|
8
|
+
import { isSequenceAuthEnvName } from './auth.js';
|
|
10
9
|
import { readRegisteredEnvironmentUrls } from './env-registry.js';
|
|
11
10
|
import { resolvePreviewFromSlug } from './preview.js';
|
|
12
11
|
/**
|
|
@@ -14,16 +13,15 @@ import { resolvePreviewFromSlug } from './preview.js';
|
|
|
14
13
|
* without a config.toml entry. The slug after the prefix is run through the
|
|
15
14
|
* canonical branch→slug transform (see `preview.ts`). PR-number resolution and
|
|
16
15
|
* the Cloudflare WAF bypass header live in `artifact/delegate.ts`.
|
|
17
|
-
* Preview targeting is a Sequence-staff surface — resolveEnv gates it on the
|
|
18
|
-
* discovered tier.
|
|
19
16
|
*/
|
|
20
17
|
export const PREVIEW_ENV_PREFIX = 'preview:';
|
|
21
18
|
/**
|
|
22
|
-
* Only `local` ships in the published package.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
19
|
+
* Only `local` ships in the published package. Every other environment is
|
|
20
|
+
* one the user configures: `seq-studio envs add <name> <url>` for an OpCo
|
|
21
|
+
* deployment, or a `[env.<name>]` entry in config.toml. The CLI never carries
|
|
22
|
+
* or fetches a list of deployments. `local` is the dev / `make dev-all`
|
|
23
|
+
* URL — kept named `local` (not `dev`) so it lines up with `seqapi -e local`
|
|
24
|
+
* and `artifact-studio --env local`.
|
|
27
25
|
*/
|
|
28
26
|
const BUILT_IN_ENV_URLS = {
|
|
29
27
|
local: 'http://localhost:5001',
|
|
@@ -102,16 +100,15 @@ export function defaultConfig() {
|
|
|
102
100
|
for (const [name, url] of Object.entries(BUILT_IN_ENV_URLS)) {
|
|
103
101
|
envs[name] = { url };
|
|
104
102
|
}
|
|
105
|
-
return { envs, defaultEnv: 'local'
|
|
103
|
+
return { envs, defaultEnv: 'local' };
|
|
106
104
|
}
|
|
107
105
|
/**
|
|
108
106
|
* Read the effective config. Merge precedence (later wins):
|
|
109
107
|
*
|
|
110
108
|
* 1. built-in `local`
|
|
111
109
|
* 2. local worktrees discovered from `.wt.env`
|
|
112
|
-
* 3.
|
|
113
|
-
* 4.
|
|
114
|
-
* 5. OpCo registrations shared with seqapi (`~/.config/sequence-api/config.json`)
|
|
110
|
+
* 3. user entries in config.toml (an override for `local`, or net-new envs)
|
|
111
|
+
* 4. OpCo registrations shared with seqapi (`~/.config/sequence-api/config.json`)
|
|
115
112
|
*
|
|
116
113
|
* Registered OpCo routes are authoritative for their names so a lower-trust
|
|
117
114
|
* config.toml override cannot send a tenant token to another origin.
|
|
@@ -119,13 +116,6 @@ export function defaultConfig() {
|
|
|
119
116
|
export async function readConfig() {
|
|
120
117
|
const merged = defaultConfig();
|
|
121
118
|
Object.assign(merged.envs, await worktreeEnvironmentUrls());
|
|
122
|
-
const catalog = await readCachedCatalog();
|
|
123
|
-
if (catalog) {
|
|
124
|
-
merged.tier = catalog.tier;
|
|
125
|
-
for (const env of catalog.environments) {
|
|
126
|
-
merged.envs[env.name] = { url: env.url };
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
119
|
const path = configPath();
|
|
130
120
|
if (existsSync(path)) {
|
|
131
121
|
const raw = parseToml(await readFile(path, 'utf8'));
|
|
@@ -172,11 +162,8 @@ export async function writeConfig(config) {
|
|
|
172
162
|
}
|
|
173
163
|
await writeFile(path, lines.join('\n') + '\n', { encoding: 'utf8', mode: 0o600 });
|
|
174
164
|
}
|
|
175
|
-
/** Shared hint appended to visibility errors at the anonymous/partner tiers. */
|
|
176
|
-
const DISCOVERY_HINT = 'If you expect more environments, authenticate (seq-studio login, or set ' +
|
|
177
|
-
'AUTH0_M2M_CLIENT_SECRET) and run: seq-studio envs refresh';
|
|
178
165
|
/**
|
|
179
|
-
* Copy-pasteable
|
|
166
|
+
* Copy-pasteable snippet for adding an environment by hand.
|
|
180
167
|
*
|
|
181
168
|
* The `[env.*]` table is safe to append to an existing config.toml. We
|
|
182
169
|
* intentionally omit `default_env` from the snippet — appending it after
|
|
@@ -195,58 +182,29 @@ export function manualEnvConfigHint() {
|
|
|
195
182
|
}
|
|
196
183
|
/**
|
|
197
184
|
* Resolve `--env <name>` against the effective config. Falls back to the
|
|
198
|
-
* config's `defaultEnv` when no name is passed. Throws a clear error
|
|
199
|
-
* the
|
|
200
|
-
* that are actually visible.
|
|
185
|
+
* config's `defaultEnv` when no name is passed. Throws a clear error listing
|
|
186
|
+
* the configured envs when the name does not resolve.
|
|
201
187
|
*/
|
|
202
188
|
export function resolveEnv({ config, requested, }) {
|
|
203
189
|
const name = requested ?? config.defaultEnv;
|
|
204
190
|
if (name.startsWith(PREVIEW_ENV_PREFIX)) {
|
|
205
|
-
if (config.tier !== 'sequence') {
|
|
206
|
-
throw new Error(`Preview environments (${PREVIEW_ENV_PREFIX}<branch>) are a Sequence-staff ` +
|
|
207
|
-
`surface. ${DISCOVERY_HINT}`);
|
|
208
|
-
}
|
|
209
191
|
const { slug, url } = resolvePreviewFromSlug(name.slice(PREVIEW_ENV_PREFIX.length));
|
|
210
192
|
return { name: `${PREVIEW_ENV_PREFIX}${slug}`, url };
|
|
211
193
|
}
|
|
212
194
|
const env = config.envs[name];
|
|
213
195
|
if (!env) {
|
|
214
196
|
const known = Object.keys(config.envs).join(', ');
|
|
197
|
+
// Reserved names use the shared Sequence login, so `envs add` rejects
|
|
198
|
+
// them; point those at config.toml instead.
|
|
199
|
+
const addHint = isSequenceAuthEnvName(name)
|
|
200
|
+
? `add an [env.${name}] entry to ${configPath()}`
|
|
201
|
+
: `register the deployment with: seq-studio envs add ${name} <url>`;
|
|
215
202
|
throw new Error(`Unknown env "${name}". Known envs: ${known}. ` +
|
|
216
|
-
`Pass --env <name
|
|
203
|
+
`Pass --env <name>, set default_env in ${configPath()}, or ${addHint}`);
|
|
217
204
|
}
|
|
218
205
|
return { name, url: env.url };
|
|
219
206
|
}
|
|
220
|
-
/**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
* refresh the catalog once — a logged-in identity that never ran
|
|
224
|
-
* `seq-studio envs refresh` (or fresh CI with AUTH0_M2M_CLIENT_SECRET)
|
|
225
|
-
* gets its environments on first use — then retry.
|
|
226
|
-
*/
|
|
227
|
-
export async function resolveEnvWithDiscovery({ requested, }) {
|
|
228
|
-
const config = await readConfig();
|
|
229
|
-
try {
|
|
230
|
-
return resolveEnv({ config, requested });
|
|
231
|
-
}
|
|
232
|
-
catch (err) {
|
|
233
|
-
let catalog;
|
|
234
|
-
try {
|
|
235
|
-
catalog = await fetchCatalog();
|
|
236
|
-
}
|
|
237
|
-
catch (fetchErr) {
|
|
238
|
-
// A configured-but-broken M2M credential is the real failure — CI must
|
|
239
|
-
// see the Auth0 error, not a misleading "unknown env" message.
|
|
240
|
-
if (fetchErr instanceof M2mTokenError)
|
|
241
|
-
throw fetchErr;
|
|
242
|
-
// Network/server errors: fall back to whatever is cached, else
|
|
243
|
-
// surface the original resolve error.
|
|
244
|
-
catalog = await readCachedCatalog();
|
|
245
|
-
}
|
|
246
|
-
if (!catalog)
|
|
247
|
-
throw err;
|
|
248
|
-
// Retry against the refreshed catalog; if the name still doesn't
|
|
249
|
-
// resolve, the retry throws an error rendered from the fresh state.
|
|
250
|
-
return resolveEnv({ config: await readConfig(), requested });
|
|
251
|
-
}
|
|
207
|
+
/** Resolve `--env <name>` against the config on disk. */
|
|
208
|
+
export async function resolveConfiguredEnv({ requested, }) {
|
|
209
|
+
return resolveEnv({ config: await readConfig(), requested });
|
|
252
210
|
}
|
package/dist/envs/commands.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import { tryGetAccessToken } from '../auth.js';
|
|
2
1
|
import { readConfig, configPath, manualEnvConfigHint } from '../config.js';
|
|
3
2
|
import { readRegisteredEnvironmentUrls, registerEnvironment, } from '../env-registry.js';
|
|
4
|
-
import { bootstrapUrl, fetchCatalog, readCachedCatalog, } from '../env-catalog.js';
|
|
5
3
|
const ENVS_USAGE = `usage:
|
|
6
|
-
seq-studio envs list show the environments
|
|
7
|
-
seq-studio envs refresh re-fetch the environment catalog for your identity
|
|
4
|
+
seq-studio envs list show the configured environments
|
|
8
5
|
seq-studio envs add <name> <url>
|
|
9
|
-
register
|
|
6
|
+
register your organization's deployment
|
|
10
7
|
|
|
11
|
-
The
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
catalog is cached at ~/.config/lattice/environments.json and also refreshes
|
|
15
|
-
lazily the first time you pass an -e <env> that isn't cached yet.
|
|
8
|
+
The CLI ships with only the "local" environment. Add your organization's
|
|
9
|
+
deployment with "envs add"; it reads the deployment's public sign-in
|
|
10
|
+
settings, then "seq-studio login --env <name>" signs you in to it.
|
|
16
11
|
|
|
17
|
-
Local worktrees are discovered from their .wt.env files.
|
|
18
|
-
${configPath()} are
|
|
12
|
+
Local worktrees are discovered from their .wt.env files. Entries in
|
|
13
|
+
${configPath()} are also honored.
|
|
19
14
|
`;
|
|
20
15
|
export async function runEnvsCommand(sub, rest) {
|
|
21
16
|
switch (sub) {
|
|
@@ -23,8 +18,6 @@ export async function runEnvsCommand(sub, rest) {
|
|
|
23
18
|
return addCommand(rest);
|
|
24
19
|
case 'list':
|
|
25
20
|
return listCommand();
|
|
26
|
-
case 'refresh':
|
|
27
|
-
return refreshCommand();
|
|
28
21
|
case undefined:
|
|
29
22
|
case 'help':
|
|
30
23
|
case '--help':
|
|
@@ -63,70 +56,27 @@ async function addCommand(rest) {
|
|
|
63
56
|
return 1;
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Tier `anonymous` means "no catalog cached", not necessarily "no token".
|
|
68
|
-
* Shared by list + refresh so they don't contradict each other.
|
|
69
|
-
*/
|
|
70
|
-
async function printNoCatalogGuidance(log = console.log) {
|
|
71
|
-
const token = await tryGetAccessToken();
|
|
72
|
-
log('');
|
|
73
|
-
if (token) {
|
|
74
|
-
log(`Logged in, but no environment catalog is cached against ${bootstrapUrl()} — ` +
|
|
75
|
-
'only "local" (plus any config.toml entries) is visible. Run: seq-studio envs refresh');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
log('Not authenticated — only "local" is visible. Authenticate with ' +
|
|
79
|
-
'`seq-studio login` (or set AUTH0_M2M_CLIENT_SECRET), then run: seq-studio envs refresh');
|
|
80
|
-
}
|
|
81
|
-
log('');
|
|
82
|
-
log(manualEnvConfigHint());
|
|
83
|
-
}
|
|
84
59
|
async function listCommand() {
|
|
85
|
-
const [config,
|
|
60
|
+
const [config, registered] = await Promise.all([
|
|
86
61
|
readConfig(),
|
|
87
|
-
readCachedCatalog(),
|
|
88
62
|
readRegisteredEnvironmentUrls(),
|
|
89
63
|
]);
|
|
90
|
-
const discovered = new Set(catalog?.environments.map((env) => env.name) ?? []);
|
|
91
64
|
const registeredNames = new Set(Object.keys(registered));
|
|
92
|
-
console.log(`tier: ${config.tier}`);
|
|
93
|
-
if (catalog) {
|
|
94
|
-
console.log(`catalog fetched: ${new Date(catalog.fetchedAt).toISOString()}`);
|
|
95
|
-
}
|
|
96
|
-
console.log('');
|
|
97
65
|
const width = Math.max(...Object.keys(config.envs).map((name) => name.length));
|
|
98
66
|
for (const [name, { url }] of Object.entries(config.envs)) {
|
|
99
|
-
const source =
|
|
100
|
-
? '
|
|
67
|
+
const source = registeredNames.has(name)
|
|
68
|
+
? 'registered'
|
|
101
69
|
: name.startsWith('local:')
|
|
102
70
|
? 'worktree'
|
|
103
|
-
:
|
|
104
|
-
? '
|
|
105
|
-
:
|
|
106
|
-
? 'registered'
|
|
107
|
-
: 'config.toml';
|
|
71
|
+
: name === 'local'
|
|
72
|
+
? 'built-in'
|
|
73
|
+
: 'config.toml';
|
|
108
74
|
console.log(` ${name.padEnd(width)} ${url} (${source})`);
|
|
109
75
|
}
|
|
110
|
-
if (config.
|
|
111
|
-
|
|
76
|
+
if (Object.keys(config.envs).every((name) => name === 'local' || name.startsWith('local:'))) {
|
|
77
|
+
console.log('');
|
|
78
|
+
console.log('Register your organization\'s deployment with: seq-studio envs add <name> <url>');
|
|
79
|
+
console.log(manualEnvConfigHint());
|
|
112
80
|
}
|
|
113
81
|
return 0;
|
|
114
82
|
}
|
|
115
|
-
async function refreshCommand() {
|
|
116
|
-
let catalog;
|
|
117
|
-
try {
|
|
118
|
-
catalog = await fetchCatalog();
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
console.error(`envs refresh: FAIL — ${err instanceof Error ? err.message : String(err)}`);
|
|
122
|
-
console.error('');
|
|
123
|
-
console.error(manualEnvConfigHint());
|
|
124
|
-
return 1;
|
|
125
|
-
}
|
|
126
|
-
if (!catalog) {
|
|
127
|
-
await printNoCatalogGuidance();
|
|
128
|
-
return 0;
|
|
129
|
-
}
|
|
130
|
-
console.log(`tier: ${catalog.tier} — ${catalog.environments.length} environment(s) cached.`);
|
|
131
|
-
return listCommand();
|
|
132
|
-
}
|
|
@@ -8,7 +8,7 @@ import { Writable } from 'node:stream';
|
|
|
8
8
|
import { load as parseYaml } from 'js-yaml';
|
|
9
9
|
import { MANAGED_FUNCTION_LIMITS, MF_LIMITS_DEFAULTS } from '@sequenceholdings/managed-functions/config';
|
|
10
10
|
import { getAccessTokenWithMode, tryGetAccessTokenWithMode } from '../auth.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
12
12
|
import { AtlasApiError, deleteJson, getJson, postJson, postJsonResponse, } from '../atlas-client.js';
|
|
13
13
|
import { clarifyApplyFailureReason, printCliError } from '../cli-errors.js';
|
|
14
14
|
import { currentVersion } from '../update-check.js';
|
|
@@ -45,7 +45,7 @@ export async function buildContext(args) {
|
|
|
45
45
|
if (!requested) {
|
|
46
46
|
throw new Error(REQUIRE_EXPLICIT_ENV_MESSAGE);
|
|
47
47
|
}
|
|
48
|
-
const env = await
|
|
48
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
49
49
|
const auth = await getAccessTokenWithMode({ env: env.name, targetUrl: env.url });
|
|
50
50
|
return { authMode: auth.authMode, env, token: auth.token };
|
|
51
51
|
}
|
package/dist/login.d.ts
CHANGED
|
@@ -12,12 +12,6 @@ interface LoginOptions {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function openSystemBrowser(authorizationUrl: string): Promise<void>;
|
|
14
14
|
export declare function loginWithPkce({ fetchImpl, now, openBrowser, port, realm, timeoutMs, }: LoginOptions): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Best-effort catalog refresh after a successful login. Drop the old cache
|
|
17
|
-
* first so a prior identity's tier never lingers; discovery failures must not
|
|
18
|
-
* fail login. Exported for unit tests.
|
|
19
|
-
*/
|
|
20
|
-
export declare function refreshCatalogAfterLogin(): Promise<void>;
|
|
21
15
|
export declare function login(envName?: string): Promise<void>;
|
|
22
16
|
export declare function logout(envName?: string): Promise<void>;
|
|
23
17
|
export {};
|
package/dist/login.js
CHANGED
|
@@ -5,8 +5,7 @@ import { spawn } from 'node:child_process';
|
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { deleteRealmTokens, realmForEnv, saveTokens, seqapiTokenPath, SEQUENCE_AUTH_REALM, SEQUENCE_REALM, verifyTokenMatchesRealm, } from './auth.js';
|
|
8
|
-
import { localAuthRealmOptions
|
|
9
|
-
import { bootstrapUrl, clearCatalog, fetchCatalog } from './env-catalog.js';
|
|
8
|
+
import { localAuthRealmOptions } from './config.js';
|
|
10
9
|
const DEFAULT_REDIRECT_PORT = 5099;
|
|
11
10
|
const DEFAULT_LOGIN_TIMEOUT_MS = 300_000;
|
|
12
11
|
function base64Url(input) {
|
|
@@ -193,33 +192,11 @@ export async function loginWithPkce({ fetchImpl = fetch, now = Date.now, openBro
|
|
|
193
192
|
}, realm.name);
|
|
194
193
|
return tokens.accessToken;
|
|
195
194
|
}
|
|
196
|
-
/**
|
|
197
|
-
* Best-effort catalog refresh after a successful login. Drop the old cache
|
|
198
|
-
* first so a prior identity's tier never lingers; discovery failures must not
|
|
199
|
-
* fail login. Exported for unit tests.
|
|
200
|
-
*/
|
|
201
|
-
export async function refreshCatalogAfterLogin() {
|
|
202
|
-
await clearCatalog();
|
|
203
|
-
try {
|
|
204
|
-
const catalog = await fetchCatalog();
|
|
205
|
-
if (catalog) {
|
|
206
|
-
console.log(`Environment catalog refreshed (tier: ${catalog.tier}, ` +
|
|
207
|
-
`${catalog.environments.length} environment(s)).`);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
catch {
|
|
212
|
-
// Network / non-auth discovery errors fall through to the same hint.
|
|
213
|
-
}
|
|
214
|
-
console.log(`Could not load the environment catalog from ${bootstrapUrl()} — ` +
|
|
215
|
-
'run: seq-studio envs refresh');
|
|
216
|
-
console.log(manualEnvConfigHint());
|
|
217
|
-
}
|
|
218
195
|
export async function login(envName) {
|
|
219
196
|
const realm = await realmForEnv(envName, await localAuthRealmOptions(envName));
|
|
220
197
|
if (envName && realm.name === SEQUENCE_REALM && envName !== SEQUENCE_REALM) {
|
|
221
|
-
// A
|
|
222
|
-
//
|
|
198
|
+
// A reserved Sequence name (staging, production…) resolves to the
|
|
199
|
+
// Sequence realm — one login covers all of those. A typo'd
|
|
223
200
|
// OpCo name would silently do a Sequence login otherwise, so say which
|
|
224
201
|
// realm we're using.
|
|
225
202
|
console.error(`'${envName}' uses the shared Sequence login ` +
|
|
@@ -227,11 +204,6 @@ export async function login(envName) {
|
|
|
227
204
|
}
|
|
228
205
|
await loginWithPkce({ realm });
|
|
229
206
|
console.log(`Authenticated [${realm.name}]. Short-lived access token saved to ${seqapiTokenPath()}.`);
|
|
230
|
-
// The environment catalog is a Sequence-deployment surface; OpCo realm
|
|
231
|
-
// logins target a single known deployment and have nothing to discover.
|
|
232
|
-
if (realm.name === SEQUENCE_REALM) {
|
|
233
|
-
await refreshCatalogAfterLogin();
|
|
234
|
-
}
|
|
235
207
|
}
|
|
236
208
|
/**
|
|
237
209
|
* Pre-unification artifact-studio token file. New builds never read it, but
|
|
@@ -245,9 +217,6 @@ export async function logout(envName) {
|
|
|
245
217
|
await deleteRealmTokens(realm.name);
|
|
246
218
|
if (realm.name === SEQUENCE_REALM) {
|
|
247
219
|
await rm(legacyArtifactTokenPath(), { force: true });
|
|
248
|
-
// The environment catalog belongs to the Sequence identity; tenant logout
|
|
249
|
-
// must not discard a still-authenticated Sequence user's cached tier.
|
|
250
|
-
await clearCatalog();
|
|
251
220
|
}
|
|
252
221
|
console.log(`Logged out [${realm.name}] from seq-studio and seqapi.`);
|
|
253
222
|
}
|
package/dist/main.js
CHANGED
|
@@ -52,8 +52,8 @@ const TOP_LEVEL_USAGE = `usage:
|
|
|
52
52
|
|
|
53
53
|
Authenticate with: seq-studio login
|
|
54
54
|
Where supported, --json writes structured stdout; check exit status and pagination.
|
|
55
|
-
Built-in env: local.
|
|
56
|
-
\`seq-studio envs
|
|
55
|
+
Built-in env: local. Add your organization's deployment with
|
|
56
|
+
\`seq-studio envs add <name> <url>\`; custom entries live in ~/.config/lattice/config.toml.
|
|
57
57
|
`;
|
|
58
58
|
const PROCESS_USAGE = `usage:
|
|
59
59
|
seq-studio process init <dir>
|
package/dist/orm/delegate.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { parseSourceSpec, resolveArtifactSource, } from '@sequenceholdings/artifact-studio/source-resolver';
|
|
10
10
|
import { getAccessToken, tryGetAccessTokenWithMode } from '../auth.js';
|
|
11
|
-
import {
|
|
11
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
12
12
|
import { normalizeShortEnvFlag, readEnvFromArgv } from '../env-flags.js';
|
|
13
13
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
14
14
|
import { resolveFunctionSourceDir } from '../functions/source-selection.js';
|
|
@@ -211,7 +211,7 @@ export async function runOrmCommand(sub, rest) {
|
|
|
211
211
|
}
|
|
212
212
|
let targetUrl;
|
|
213
213
|
if (requested) {
|
|
214
|
-
const resolved = await
|
|
214
|
+
const resolved = await resolveConfiguredEnv({ requested });
|
|
215
215
|
targetUrl = resolved.url;
|
|
216
216
|
process.env['SEQUENCE_ORM_BASE_URL'] = resolved.url;
|
|
217
217
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAccessToken } from '../auth.js';
|
|
2
2
|
import { getJson, postJson } from '../atlas-client.js';
|
|
3
3
|
import { printCliError } from '../cli-errors.js';
|
|
4
|
-
import {
|
|
4
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
5
5
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
6
6
|
import { resolvePipelineTarget } from './lifecycle.js';
|
|
7
7
|
export const PIPELINE_DISCOVERY_USAGE = ` seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]
|
|
@@ -172,7 +172,7 @@ export async function runPipelineDiscoveryCommand({ sub, args }) {
|
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
174
|
const options = discoveryOptions({ sub, args });
|
|
175
|
-
const env = await
|
|
175
|
+
const env = await resolveConfiguredEnv({ requested: options.environment });
|
|
176
176
|
const token = await getAccessToken({ env: env.name, targetUrl: env.url });
|
|
177
177
|
const client = { baseUrl: env.url, token };
|
|
178
178
|
if (sub === 'list') {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getAccessToken, NotLoggedInError } from '../auth.js';
|
|
6
6
|
import { AtlasApiError, getJson, postJson } from '../atlas-client.js';
|
|
7
|
-
import {
|
|
7
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
8
8
|
import { parseDurationMs } from '@sequenceholdings/lattice';
|
|
9
9
|
import { assertCloneDeployAllowed, publishCloneForDeploy } from './clone-deploy.js';
|
|
10
10
|
import { printReconcileResult, reconcileStageCredentials } from './stage-secrets.js';
|
|
@@ -56,7 +56,7 @@ export async function envAndToken(args) {
|
|
|
56
56
|
if (!requested) {
|
|
57
57
|
throw new Error('missing -e/--env <environment>');
|
|
58
58
|
}
|
|
59
|
-
const env = await
|
|
59
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
60
60
|
let token;
|
|
61
61
|
try {
|
|
62
62
|
token = await getAccessToken({ env: env.name, targetUrl: env.url });
|
|
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { getAccessToken } from '../auth.js';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
6
6
|
import { loadActiveOrmContracts } from './active-orm-contracts.js';
|
|
7
7
|
import { commitFileWrites } from './atomic-file-writes.js';
|
|
8
8
|
import { resolvePipelineTarget } from './lifecycle.js';
|
|
@@ -63,7 +63,7 @@ async function assertSharedStageContractsAgree({ contracts, orm, stages, target,
|
|
|
63
63
|
throw new Error(`cannot verify shared ORM pins for target '${otherTarget}'; ` +
|
|
64
64
|
'split multi-target stages or use environment-specific pins');
|
|
65
65
|
}
|
|
66
|
-
const otherEnv = await
|
|
66
|
+
const otherEnv = await resolveConfiguredEnv({ requested: environmentName });
|
|
67
67
|
const otherToken = await getAccessToken({ env: otherEnv.name, targetUrl: otherEnv.url });
|
|
68
68
|
const sharedStages = stages.filter((stage) => stage.environments.includes(otherTarget));
|
|
69
69
|
const otherContracts = await loadActiveOrmContracts({
|
|
@@ -106,7 +106,7 @@ export async function pipelineRepinOrmCommand(args) {
|
|
|
106
106
|
console.log(`${LOG} no ORM satisfies pins found in ${dirArg}`);
|
|
107
107
|
return 0;
|
|
108
108
|
}
|
|
109
|
-
const env = await
|
|
109
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
110
110
|
const token = await getAccessToken({ env: env.name, targetUrl: env.url });
|
|
111
111
|
const target = (await resolvePipelineTarget({ args, env, token })).id;
|
|
112
112
|
const pinnedStages = allPinnedStages.filter((stage) => stage.environments.includes(target));
|
package/dist/process/commands.js
CHANGED
|
@@ -13,7 +13,7 @@ import { forEachSerializedNode, } from '@sequenceholdings/lattice/bundle';
|
|
|
13
13
|
import { getJson, getJsonOr404, postJson, AtlasApiError } from '../atlas-client.js';
|
|
14
14
|
import { generateProcessFiles } from './codegen.js';
|
|
15
15
|
import { getAccessToken, getAccessTokenWithMode, inspectAuthPreflight, AuthTokenStoreError, NotLoggedInError, } from '../auth.js';
|
|
16
|
-
import { readConfig, resolveEnv,
|
|
16
|
+
import { readConfig, resolveEnv, resolveConfiguredEnv } from '../config.js';
|
|
17
17
|
import { writeScaffoldGuidance } from '../scaffold-guidance.js';
|
|
18
18
|
import { finalizeCompiledBundle, summarizeBundle } from './build.js';
|
|
19
19
|
import { buildResolveProcessPinFromEnv } from './resolve-process-pin.js';
|
|
@@ -29,7 +29,7 @@ import { compileProcessSourceIsolated, simulateProcessIsolated, } from './compil
|
|
|
29
29
|
export { parseArgs } from '../argv.js';
|
|
30
30
|
async function getEnvAndToken(args) {
|
|
31
31
|
const requested = typeof args.flags.env === 'string' ? args.flags.env : undefined;
|
|
32
|
-
const env = await
|
|
32
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
33
33
|
let token;
|
|
34
34
|
try {
|
|
35
35
|
token = await getAccessToken({ env: env.name, targetUrl: env.url });
|
|
@@ -44,7 +44,7 @@ async function getEnvAndToken(args) {
|
|
|
44
44
|
}
|
|
45
45
|
async function getEnvAndAuth(args) {
|
|
46
46
|
const requested = typeof args.flags.env === 'string' ? args.flags.env : undefined;
|
|
47
|
-
const env = await
|
|
47
|
+
const env = await resolveConfiguredEnv({ requested });
|
|
48
48
|
const auth = await getAccessTokenWithMode({ env: env.name, targetUrl: env.url });
|
|
49
49
|
return { authMode: auth.authMode, env, token: auth.token };
|
|
50
50
|
}
|
|
@@ -961,10 +961,6 @@ export async function doctorCommand(args) {
|
|
|
961
961
|
}
|
|
962
962
|
else {
|
|
963
963
|
lines.push(`config: ok — default_env=${config.defaultEnv}, envs=${Object.keys(config.envs).join(',')}`);
|
|
964
|
-
lines.push(`tier: ${config.tier}` +
|
|
965
|
-
(config.tier === 'anonymous'
|
|
966
|
-
? ' — no environment catalog cached; run `seq-studio envs refresh` to discover more environments'
|
|
967
|
-
: ''));
|
|
968
964
|
}
|
|
969
965
|
const requested = typeof args.flags.env === 'string' ? args.flags.env : undefined;
|
|
970
966
|
let env = null;
|
|
@@ -972,7 +968,7 @@ export async function doctorCommand(args) {
|
|
|
972
968
|
try {
|
|
973
969
|
env = offline
|
|
974
970
|
? resolveEnv({ config, requested })
|
|
975
|
-
: await
|
|
971
|
+
: await resolveConfiguredEnv({ requested });
|
|
976
972
|
lines.push(`env: ok — ${env.name} (${env.url})`);
|
|
977
973
|
}
|
|
978
974
|
catch (err) {
|
package/dist/repos/commands.js
CHANGED
|
@@ -25,7 +25,7 @@ import { buildContext, clientOptions, flagBool, LOG, } from '../functions/comman
|
|
|
25
25
|
import { looksLikeCommitSha, resolveGitPatFromEnv, runGitClone, } from './git-clone.js';
|
|
26
26
|
import { formatPatSetupHint } from '../pat-hints.js';
|
|
27
27
|
import { tryGetAccessToken } from '../auth.js';
|
|
28
|
-
import {
|
|
28
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
29
29
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
30
30
|
const PAGE_SIZE = 200;
|
|
31
31
|
// ---------------------------------------------------------------------------
|
|
@@ -499,7 +499,7 @@ async function resolveEnvOnly(args) {
|
|
|
499
499
|
if (!requested) {
|
|
500
500
|
throw new Error(REQUIRE_EXPLICIT_ENV_MESSAGE);
|
|
501
501
|
}
|
|
502
|
-
return
|
|
502
|
+
return resolveConfiguredEnv({ requested });
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* Validate clone URL shape and that the origin matches the resolved Atlas env
|
package/dist/storage/commands.js
CHANGED
|
@@ -7,7 +7,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
7
7
|
import { load as yaml } from 'js-yaml';
|
|
8
8
|
import { storageClient, workspaceManifestSchema, startUploadSchema, updateStorageAccessSchema, } from '@sequenceholdings/storage';
|
|
9
9
|
import { getAccessTokenWithMode } from '../auth.js';
|
|
10
|
-
import {
|
|
10
|
+
import { resolveConfiguredEnv } from '../config.js';
|
|
11
11
|
import { getJson, postJson, putJson, patchJson, deleteJson, } from '../atlas-client.js';
|
|
12
12
|
import { printCliError } from '../cli-errors.js';
|
|
13
13
|
import { runStorageImport } from './import-run.js';
|
|
@@ -66,7 +66,7 @@ export async function runStorageCommand(sub, args) {
|
|
|
66
66
|
}
|
|
67
67
|
if (!flag('env'))
|
|
68
68
|
throw new Error(REQUIRE_EXPLICIT_ENV_MESSAGE);
|
|
69
|
-
const env = await
|
|
69
|
+
const env = await resolveConfiguredEnv({ requested: flag('env') });
|
|
70
70
|
const { token } = await getAccessTokenWithMode({
|
|
71
71
|
env: env.name,
|
|
72
72
|
targetUrl: env.url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth pat`. Includes Auth0 browser login shared with seqapi.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"smol-toml": "^1.9.0",
|
|
42
42
|
"tsx": "^4.20.3",
|
|
43
43
|
"zod": "^4.1.13",
|
|
44
|
-
"@sequenceholdings/agent-spec": "0.1.3",
|
|
45
|
-
"@sequenceholdings/artifact-studio": "0.6.3",
|
|
46
44
|
"@sequenceholdings/lattice": "0.1.5",
|
|
47
|
-
"@sequenceholdings/
|
|
48
|
-
"@sequenceholdings/storage": "0.1.
|
|
45
|
+
"@sequenceholdings/agent-spec": "0.1.3",
|
|
46
|
+
"@sequenceholdings/storage": "0.1.1",
|
|
47
|
+
"@sequenceholdings/artifact-studio": "0.6.6",
|
|
48
|
+
"@sequenceholdings/managed-functions": "0.3.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@sequenceholdings/orm": "2.
|
|
52
|
-
"@sequenceholdings/pipeline-spec": "0.2.
|
|
51
|
+
"@sequenceholdings/orm": "2.5.0",
|
|
52
|
+
"@sequenceholdings/pipeline-spec": "0.2.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
55
55
|
"@sequenceholdings/orm": {
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@types/node": "^22.0.0",
|
|
65
65
|
"typescript": "^5.6.0",
|
|
66
66
|
"vitest": "^4.1.11",
|
|
67
|
-
"@sequenceholdings/orm": "2.
|
|
68
|
-
"@sequenceholdings/pipeline-spec": "0.2.
|
|
67
|
+
"@sequenceholdings/orm": "2.5.0",
|
|
68
|
+
"@sequenceholdings/pipeline-spec": "0.2.3"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=20"
|