@sequenceholdings/studio-cli 0.2.2 → 0.4.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 +616 -78
- package/dist/access/commands.d.ts +3 -0
- package/dist/access/commands.js +91 -0
- package/dist/agents/commands.d.ts +1 -1
- package/dist/agents/commands.js +5 -0
- package/dist/agents/scaffold.js +5 -7
- package/dist/agents/voice-authoring.d.ts +5 -0
- package/dist/agents/voice-authoring.js +75 -0
- package/dist/agents/voice-publication.d.ts +5 -0
- package/dist/agents/voice-publication.js +63 -0
- package/dist/agents/voice-shared.d.ts +20 -0
- package/dist/agents/voice-shared.js +112 -0
- package/dist/agents/voice.d.ts +3 -0
- package/dist/agents/voice.js +57 -0
- package/dist/app/adapters.d.ts +6 -0
- package/dist/app/adapters.js +17 -2
- package/dist/app/agent-refs.d.ts +16 -0
- package/dist/app/agent-refs.js +36 -0
- package/dist/app/application-registration.d.ts +36 -6
- package/dist/app/application-registration.js +60 -15
- package/dist/app/commands.js +19 -2
- package/dist/app/deploy.d.ts +3 -0
- package/dist/app/deploy.js +22 -6
- package/dist/app/env-bindings.d.ts +21 -0
- package/dist/app/env-bindings.js +184 -0
- package/dist/app/manifest-validation.js +8 -0
- package/dist/app/manifest.d.ts +32 -14
- package/dist/app/manifest.js +16 -6
- package/dist/app/primitive-scaffold.d.ts +4 -1
- package/dist/app/primitive-scaffold.js +4 -4
- package/dist/app/readme.js +1 -0
- package/dist/app/scaffold-files.js +1 -1
- package/dist/app/scaffold.d.ts +6 -4
- package/dist/app/scaffold.js +7 -4
- package/dist/app/workspace-scaffold.js +12 -7
- package/dist/argv.d.ts +7 -0
- package/dist/argv.js +56 -0
- package/dist/artifact/delegate.js +8 -4
- package/dist/atlas-client.d.ts +6 -0
- package/dist/atlas-client.js +39 -2
- package/dist/auth-cmds/commands.d.ts +1 -1
- package/dist/auth-cmds/commands.js +16 -0
- package/dist/auth.d.ts +32 -0
- package/dist/auth.js +170 -33
- package/dist/bin.js +23 -4
- package/dist/command-contract.d.ts +137 -0
- package/dist/command-contract.js +43 -0
- package/dist/command-help.d.ts +8 -0
- package/dist/command-help.js +71 -0
- package/dist/command-input.d.ts +15 -0
- package/dist/command-input.js +33 -0
- package/dist/functions/commands.d.ts +2 -1
- package/dist/functions/commands.js +78 -33
- package/dist/functions/deploy-preflight.d.ts +21 -0
- package/dist/functions/deploy-preflight.js +58 -0
- package/dist/functions/egress-postgres.d.ts +7 -0
- package/dist/functions/egress-postgres.js +36 -0
- package/dist/functions/manifest.d.ts +15 -1
- package/dist/functions/manifest.js +49 -12
- package/dist/functions/secret-reconcile.d.ts +3 -3
- package/dist/functions/secret-reconcile.js +5 -7
- package/dist/functions/source-selection.js +4 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +75 -25
- package/dist/manifest-roles-notice.d.ts +33 -0
- package/dist/manifest-roles-notice.js +75 -0
- package/dist/orm/delegate.d.ts +16 -0
- package/dist/orm/delegate.js +142 -7
- package/dist/pipeline/clone-deploy.d.ts +37 -0
- package/dist/pipeline/clone-deploy.js +125 -0
- package/dist/pipeline/codegen.js +6 -2
- package/dist/pipeline/commands.js +21 -5
- package/dist/pipeline/lifecycle.d.ts +1 -0
- package/dist/pipeline/lifecycle.js +95 -44
- package/dist/pipeline/repin-orm.js +6 -2
- package/dist/pipeline/stage-secrets.d.ts +4 -1
- package/dist/pipeline/stage-secrets.js +7 -3
- package/dist/process/build.js +17 -0
- package/dist/process/codegen.js +16 -0
- package/dist/process/commands.d.ts +15 -7
- package/dist/process/commands.js +294 -98
- package/dist/process/lint.js +35 -0
- package/dist/process/plan-diff.js +9 -0
- package/dist/process/simulate.js +8 -0
- package/dist/release-age.d.ts +12 -0
- package/dist/release-age.js +24 -0
- package/dist/repos/commands.d.ts +10 -1
- package/dist/repos/commands.js +42 -8
- package/dist/repos/pulls.d.ts +3 -0
- package/dist/repos/pulls.js +131 -0
- package/dist/scaffold-guidance.d.ts +4 -0
- package/dist/scaffold-guidance.js +15 -0
- package/dist/secrets/commands.d.ts +1 -1
- package/dist/secrets/commands.js +97 -16
- package/dist/service-accounts/commands.d.ts +3 -0
- package/dist/service-accounts/commands.js +50 -0
- package/dist/storage/commands.js +23 -1
- package/dist/storage/gcs-download.d.ts +13 -0
- package/dist/storage/gcs-download.js +41 -0
- package/dist/storage/import-cycle.d.ts +41 -0
- package/dist/storage/import-cycle.js +123 -0
- package/dist/storage/import-files.d.ts +30 -0
- package/dist/storage/import-files.js +133 -0
- package/dist/storage/import-gcloud.d.ts +12 -0
- package/dist/storage/import-gcloud.js +54 -0
- package/dist/storage/import-identity.d.ts +12 -0
- package/dist/storage/import-identity.js +15 -0
- package/dist/storage/import-plan.d.ts +120 -0
- package/dist/storage/import-plan.js +189 -0
- package/dist/storage/import-preflight.d.ts +36 -0
- package/dist/storage/import-preflight.js +62 -0
- package/dist/storage/import-progress-map.d.ts +5 -0
- package/dist/storage/import-progress-map.js +22 -0
- package/dist/storage/import-recover.d.ts +97 -0
- package/dist/storage/import-recover.js +186 -0
- package/dist/storage/import-run.d.ts +14 -0
- package/dist/storage/import-run.js +140 -0
- package/dist/templates/guidance/AGENTS.md +10 -0
- package/dist/templates/guidance/CLAUDE.md +1 -0
- package/dist/templates/process/package.json +2 -2
- package/dist/templates/process/pnpm-workspace.yaml +7 -4
- package/dist/validation-detail.d.ts +2 -0
- package/dist/validation-detail.js +20 -0
- package/package.json +9 -9
- package/templates/guidance/AGENTS.md +10 -0
- package/templates/guidance/CLAUDE.md +1 -0
- package/templates/process/package.json +2 -2
- package/templates/process/pnpm-workspace.yaml +7 -4
package/dist/app/manifest.d.ts
CHANGED
|
@@ -19,12 +19,12 @@ declare const primitiveEntrySchema: z.ZodObject<{
|
|
|
19
19
|
id: z.ZodString;
|
|
20
20
|
kind: z.ZodEnum<{
|
|
21
21
|
function: "function";
|
|
22
|
-
agent: "agent";
|
|
23
22
|
process: "process";
|
|
23
|
+
artifact: "artifact";
|
|
24
|
+
pipeline: "pipeline";
|
|
24
25
|
orm: "orm";
|
|
26
|
+
agent: "agent";
|
|
25
27
|
workspace: "workspace";
|
|
26
|
-
pipeline: "pipeline";
|
|
27
|
-
artifact: "artifact";
|
|
28
28
|
}>;
|
|
29
29
|
path: z.ZodString;
|
|
30
30
|
depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -50,9 +50,10 @@ export declare const FLOOR_ROLE_ALIASES: readonly ["end_user", "invoker"];
|
|
|
50
50
|
export type FloorRoleAlias = (typeof FLOOR_ROLE_ALIASES)[number];
|
|
51
51
|
export declare function isFloorRoleAlias(value: string): value is FloorRoleAlias;
|
|
52
52
|
/**
|
|
53
|
-
* Application roles (schema_version 3).
|
|
54
|
-
*
|
|
55
|
-
*
|
|
53
|
+
* Application roles (schema_version 3). DEPRECATED: create and edit roles in
|
|
54
|
+
* Atlas instead. Still accepted as a one-time seed — the first deploy that
|
|
55
|
+
* sees a key creates it; after that Atlas owns the role and a changed
|
|
56
|
+
* definition here is reported as drift, never applied.
|
|
56
57
|
*/
|
|
57
58
|
export declare const applicationRolesSchema: z.ZodObject<{
|
|
58
59
|
definitions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -65,17 +66,27 @@ export declare const applicationRolesSchema: z.ZodObject<{
|
|
|
65
66
|
}, z.core.$strict>>>;
|
|
66
67
|
}, z.core.$strict>>;
|
|
67
68
|
}, z.core.$strict>;
|
|
69
|
+
/**
|
|
70
|
+
* The Application's own capabilities (schema_version 3). Unlike roles these
|
|
71
|
+
* are code, like a primitive's capabilities: every deploy reconciles them
|
|
72
|
+
* (new keys published, removed keys deprecated). A member checks one by
|
|
73
|
+
* pinning `app/<app.id>/<key>` in its own `capabilities.uses`; roles, created
|
|
74
|
+
* in Atlas, grant them.
|
|
75
|
+
*/
|
|
76
|
+
export declare const applicationCapabilitiesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
77
|
+
description: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>>;
|
|
68
79
|
/**
|
|
69
80
|
* The member tiers a collaborator role can bundle. Which tier each primitive
|
|
70
81
|
* kind offers is checked in manifest-validation.ts; admin and owner never
|
|
71
82
|
* are — they stay direct grants.
|
|
72
83
|
*/
|
|
73
|
-
export declare const COLLABORATOR_TIERS: readonly ["reader", "writer", "editor"];
|
|
84
|
+
export declare const COLLABORATOR_TIERS: readonly ["viewer", "reader", "operator", "writer", "editor"];
|
|
74
85
|
export type CollaboratorTier = (typeof COLLABORATOR_TIERS)[number];
|
|
75
86
|
/**
|
|
76
87
|
* Application collaborator roles (schema_version 3): bundle the tiers that
|
|
77
|
-
* let someone change a member — never use-only access, never admin.
|
|
78
|
-
*
|
|
88
|
+
* let someone change a member — never use-only access, never admin.
|
|
89
|
+
* DEPRECATED here the same way `roles` are: create them in Atlas.
|
|
79
90
|
*/
|
|
80
91
|
export declare const applicationCollaboratorsSchema: z.ZodObject<{
|
|
81
92
|
definitions: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -84,9 +95,11 @@ export declare const applicationCollaboratorsSchema: z.ZodObject<{
|
|
|
84
95
|
includes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
85
96
|
primitive: z.ZodString;
|
|
86
97
|
tier: z.ZodEnum<{
|
|
98
|
+
viewer: "viewer";
|
|
99
|
+
editor: "editor";
|
|
87
100
|
reader: "reader";
|
|
88
101
|
writer: "writer";
|
|
89
|
-
|
|
102
|
+
operator: "operator";
|
|
90
103
|
}>;
|
|
91
104
|
}, z.core.$strict>>>;
|
|
92
105
|
}, z.core.$strict>>;
|
|
@@ -106,12 +119,12 @@ export declare const appManifestSchema: z.ZodObject<{
|
|
|
106
119
|
id: z.ZodString;
|
|
107
120
|
kind: z.ZodEnum<{
|
|
108
121
|
function: "function";
|
|
109
|
-
agent: "agent";
|
|
110
122
|
process: "process";
|
|
123
|
+
artifact: "artifact";
|
|
124
|
+
pipeline: "pipeline";
|
|
111
125
|
orm: "orm";
|
|
126
|
+
agent: "agent";
|
|
112
127
|
workspace: "workspace";
|
|
113
|
-
pipeline: "pipeline";
|
|
114
|
-
artifact: "artifact";
|
|
115
128
|
}>;
|
|
116
129
|
path: z.ZodString;
|
|
117
130
|
depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -157,13 +170,18 @@ export declare const appManifestSchema: z.ZodObject<{
|
|
|
157
170
|
includes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
158
171
|
primitive: z.ZodString;
|
|
159
172
|
tier: z.ZodEnum<{
|
|
173
|
+
viewer: "viewer";
|
|
174
|
+
editor: "editor";
|
|
160
175
|
reader: "reader";
|
|
161
176
|
writer: "writer";
|
|
162
|
-
|
|
177
|
+
operator: "operator";
|
|
163
178
|
}>;
|
|
164
179
|
}, z.core.$strict>>>;
|
|
165
180
|
}, z.core.$strict>>;
|
|
166
181
|
}, z.core.$strict>>;
|
|
182
|
+
capabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
183
|
+
description: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strict>>>;
|
|
167
185
|
}, z.core.$strict>;
|
|
168
186
|
export type AppManifest = z.infer<typeof appManifestSchema>;
|
|
169
187
|
export type ApplicationRoles = z.infer<typeof applicationRolesSchema>;
|
package/dist/app/manifest.js
CHANGED
|
@@ -113,19 +113,28 @@ const applicationRoleDefinitionSchema = z
|
|
|
113
113
|
})
|
|
114
114
|
.strict();
|
|
115
115
|
/**
|
|
116
|
-
* Application roles (schema_version 3).
|
|
117
|
-
*
|
|
118
|
-
*
|
|
116
|
+
* Application roles (schema_version 3). DEPRECATED: create and edit roles in
|
|
117
|
+
* Atlas instead. Still accepted as a one-time seed — the first deploy that
|
|
118
|
+
* sees a key creates it; after that Atlas owns the role and a changed
|
|
119
|
+
* definition here is reported as drift, never applied.
|
|
119
120
|
*/
|
|
120
121
|
export const applicationRolesSchema = z
|
|
121
122
|
.object({ definitions: z.record(roleKeySchema, applicationRoleDefinitionSchema) })
|
|
122
123
|
.strict();
|
|
124
|
+
/**
|
|
125
|
+
* The Application's own capabilities (schema_version 3). Unlike roles these
|
|
126
|
+
* are code, like a primitive's capabilities: every deploy reconciles them
|
|
127
|
+
* (new keys published, removed keys deprecated). A member checks one by
|
|
128
|
+
* pinning `app/<app.id>/<key>` in its own `capabilities.uses`; roles, created
|
|
129
|
+
* in Atlas, grant them.
|
|
130
|
+
*/
|
|
131
|
+
export const applicationCapabilitiesSchema = z.record(roleKeySchema, z.object({ description: z.string().max(1024).optional() }).strict());
|
|
123
132
|
/**
|
|
124
133
|
* The member tiers a collaborator role can bundle. Which tier each primitive
|
|
125
134
|
* kind offers is checked in manifest-validation.ts; admin and owner never
|
|
126
135
|
* are — they stay direct grants.
|
|
127
136
|
*/
|
|
128
|
-
export const COLLABORATOR_TIERS = ['reader', 'writer', 'editor'];
|
|
137
|
+
export const COLLABORATOR_TIERS = ['viewer', 'reader', 'operator', 'writer', 'editor'];
|
|
129
138
|
const applicationCollaboratorDefinitionSchema = z
|
|
130
139
|
.object({
|
|
131
140
|
description: z.string().max(1024).optional(),
|
|
@@ -137,8 +146,8 @@ const applicationCollaboratorDefinitionSchema = z
|
|
|
137
146
|
.strict();
|
|
138
147
|
/**
|
|
139
148
|
* Application collaborator roles (schema_version 3): bundle the tiers that
|
|
140
|
-
* let someone change a member — never use-only access, never admin.
|
|
141
|
-
*
|
|
149
|
+
* let someone change a member — never use-only access, never admin.
|
|
150
|
+
* DEPRECATED here the same way `roles` are: create them in Atlas.
|
|
142
151
|
*/
|
|
143
152
|
export const applicationCollaboratorsSchema = z
|
|
144
153
|
.object({ definitions: z.record(roleKeySchema, applicationCollaboratorDefinitionSchema) })
|
|
@@ -170,6 +179,7 @@ export const appManifestSchema = z
|
|
|
170
179
|
.default({ on_error: 'stop' }),
|
|
171
180
|
roles: applicationRolesSchema.optional(),
|
|
172
181
|
collaborators: applicationCollaboratorsSchema.optional(),
|
|
182
|
+
capabilities: applicationCapabilitiesSchema.optional(),
|
|
173
183
|
}).strict()
|
|
174
184
|
.superRefine(validateManifestGraph);
|
|
175
185
|
/** Local helper so schema refinement does not depend on later exports. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type PrimitiveEntry, type PrimitiveKind } from './manifest.js';
|
|
2
2
|
export type AppPipelineType = 'ingestion' | 'transformation' | 'serving';
|
|
3
|
+
/** Same templates as `seq-studio artifact init --template`. */
|
|
4
|
+
export type AppArtifactTemplate = 'react-vite' | 'nextjs';
|
|
3
5
|
export declare function primitiveIdFor({ kind, name }: {
|
|
4
6
|
kind: PrimitiveKind;
|
|
5
7
|
name: string;
|
|
@@ -9,10 +11,11 @@ export declare function relativePathFor({ kind, appId, name, }: {
|
|
|
9
11
|
appId: string;
|
|
10
12
|
name: string;
|
|
11
13
|
}): string;
|
|
12
|
-
export declare function scaffoldKind({ kind, appRoot, appId, name, pipelineType, }: {
|
|
14
|
+
export declare function scaffoldKind({ kind, appRoot, appId, name, pipelineType, artifactTemplate, }: {
|
|
13
15
|
kind: PrimitiveKind;
|
|
14
16
|
appRoot: string;
|
|
15
17
|
appId: string;
|
|
16
18
|
name: string;
|
|
17
19
|
pipelineType?: AppPipelineType;
|
|
20
|
+
artifactTemplate?: AppArtifactTemplate;
|
|
18
21
|
}): Promise<PrimitiveEntry>;
|
|
@@ -91,9 +91,9 @@ async function scaffoldOrm({ absPath }) {
|
|
|
91
91
|
'(workspace / internal installs today; not yet available via public npm).');
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
async function scaffoldArtifact({ absPath, appId, }) {
|
|
94
|
+
async function scaffoldArtifact({ absPath, appId, template, }) {
|
|
95
95
|
const { runCli } = await import('@sequenceholdings/artifact-studio/cli');
|
|
96
|
-
const code = await runCli(['init', absPath]);
|
|
96
|
+
const code = await runCli(['init', absPath, '--template', template]);
|
|
97
97
|
if (code !== 0) {
|
|
98
98
|
throw new Error(`artifact init failed for ${absPath} (exit ${code})`);
|
|
99
99
|
}
|
|
@@ -105,7 +105,7 @@ async function scaffoldFunction({ absPath }) {
|
|
|
105
105
|
throw new Error(`functions init failed for ${absPath} (exit ${code})`);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
export async function scaffoldKind({ kind, appRoot, appId, name, pipelineType = 'transformation', }) {
|
|
108
|
+
export async function scaffoldKind({ kind, appRoot, appId, name, pipelineType = 'transformation', artifactTemplate = 'react-vite', }) {
|
|
109
109
|
const relPath = relativePathFor({ kind, appId, name }).replace(/\\/g, '/');
|
|
110
110
|
const absPath = join(appRoot, relPath);
|
|
111
111
|
const entry = buildPrimitiveEntry({ kind, appId, name, dependsOn: [] });
|
|
@@ -119,7 +119,7 @@ export async function scaffoldKind({ kind, appRoot, appId, name, pipelineType =
|
|
|
119
119
|
break;
|
|
120
120
|
case 'artifact':
|
|
121
121
|
await mkdir(absPath, { recursive: true });
|
|
122
|
-
await scaffoldArtifact({ absPath, appId: name });
|
|
122
|
+
await scaffoldArtifact({ absPath, appId: name, template: artifactTemplate });
|
|
123
123
|
break;
|
|
124
124
|
case 'agent':
|
|
125
125
|
if (await agentsInitCommand(parseArgs([absPath])) !== 0) {
|
package/dist/app/readme.js
CHANGED
|
@@ -132,6 +132,7 @@ seq-studio deploy -e <environment-name> --yes
|
|
|
132
132
|
- **ORM** policies enforce caller access. Change TypeScript schema and operations, then generate migrations; do not edit generated migrations by hand.
|
|
133
133
|
- **Agent and process identities** are durable. Keep the generated identities stable when changing implementation; generate new identities when copying a resource.
|
|
134
134
|
- **Official artifact deployments** require the full app checkout to be clean on \`main\`, including shared packages and the root manifest. Use \`seq-studio artifact dev artifact -e <environment-name>\` to preview uncommitted UI.
|
|
135
|
+
- **Environment bindings** are resolved at deploy time. \`-e\` selects the environment. Source may not hardcode another environment's API origin or workspace UUID. Declare API origins in \`artifact.bundle.yml\` \`targets\`, and workspace use with \`uses\` on the workspace primitive.
|
|
135
136
|
|
|
136
137
|
The per-primitive commands remain available for validation and operation; \`seq-studio deploy\` is the app-level deployment entry point. See \`seq-studio deploy --help\` and the [CLI command reference](${SEQUENCE_DOCS_URL}seq-studio/commands).
|
|
137
138
|
`;
|
|
@@ -49,7 +49,7 @@ export async function rollbackAppScaffold({ appRoot, snapshot, paths }) {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const generated = new Set([
|
|
52
|
-
'sequence.app.yml', ...WORKSPACE_ROOT_FILES,
|
|
52
|
+
'sequence.app.yml', 'AGENTS.md', 'CLAUDE.md', ...WORKSPACE_ROOT_FILES,
|
|
53
53
|
...paths.map((path) => path.split('/')[0]).filter((name) => Boolean(name)),
|
|
54
54
|
]);
|
|
55
55
|
for (const name of generated) {
|
package/dist/app/scaffold.d.ts
CHANGED
|
@@ -3,25 +3,27 @@
|
|
|
3
3
|
* sequence.app.yml in sync. Delegates to each primitive's real `init`.
|
|
4
4
|
*/
|
|
5
5
|
import { type AppManifest, type PrimitiveEntry, type PrimitiveKind } from './manifest.js';
|
|
6
|
-
import { type AppPipelineType } from './primitive-scaffold.js';
|
|
7
|
-
export type { AppPipelineType } from './primitive-scaffold.js';
|
|
6
|
+
import { type AppArtifactTemplate, type AppPipelineType } from './primitive-scaffold.js';
|
|
7
|
+
export type { AppArtifactTemplate, AppPipelineType } from './primitive-scaffold.js';
|
|
8
8
|
export interface ScaffoldNames {
|
|
9
9
|
functionName: string;
|
|
10
10
|
}
|
|
11
11
|
export declare function defaultScaffoldNames(_appId: string): ScaffoldNames;
|
|
12
|
-
export declare function initAppMonorepo({ rootDir, appId, kinds, names, description, pipelineType, }: {
|
|
12
|
+
export declare function initAppMonorepo({ rootDir, appId, kinds, names, description, pipelineType, artifactTemplate, }: {
|
|
13
13
|
rootDir: string;
|
|
14
14
|
appId: string;
|
|
15
15
|
kinds: readonly PrimitiveKind[];
|
|
16
16
|
names?: ScaffoldNames;
|
|
17
17
|
description?: string;
|
|
18
18
|
pipelineType?: AppPipelineType;
|
|
19
|
+
artifactTemplate?: AppArtifactTemplate;
|
|
19
20
|
}): Promise<AppManifest>;
|
|
20
|
-
export declare function addPrimitiveToApp({ rootDir, kind, name, pipelineType, dependsOn, }: {
|
|
21
|
+
export declare function addPrimitiveToApp({ rootDir, kind, name, pipelineType, artifactTemplate, dependsOn, }: {
|
|
21
22
|
rootDir: string;
|
|
22
23
|
kind: PrimitiveKind;
|
|
23
24
|
name: string;
|
|
24
25
|
pipelineType?: AppPipelineType;
|
|
26
|
+
artifactTemplate?: AppArtifactTemplate;
|
|
25
27
|
dependsOn?: string[];
|
|
26
28
|
}): Promise<{
|
|
27
29
|
manifest: AppManifest;
|
package/dist/app/scaffold.js
CHANGED
|
@@ -9,6 +9,7 @@ import { currentVersion, isNewerVersion } from '../update-check.js';
|
|
|
9
9
|
import { extendDeployOrder, loadAppManifest, titleizeSlug, writeAppManifest, } from './manifest.js';
|
|
10
10
|
import { inspectScaffoldTarget, mergeGitignore, rollbackAppScaffold } from './scaffold-files.js';
|
|
11
11
|
import { renderAppReadme } from './readme.js';
|
|
12
|
+
import { writeScaffoldGuidance } from '../scaffold-guidance.js';
|
|
12
13
|
import { primitiveIdFor, relativePathFor, scaffoldKind } from './primitive-scaffold.js';
|
|
13
14
|
import { joinAppWorkspace, scaffoldAppWorkspace, scaffoldSharedPackage } from './workspace-scaffold.js';
|
|
14
15
|
const LOG = '[seq-studio]';
|
|
@@ -31,7 +32,7 @@ function applyDefaultDependsOn(primitives) {
|
|
|
31
32
|
return { ...entry, depends_on: [orm.id] };
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
export async function initAppMonorepo({ rootDir, appId, kinds, names = defaultScaffoldNames(appId), description, pipelineType, }) {
|
|
35
|
+
export async function initAppMonorepo({ rootDir, appId, kinds, names = defaultScaffoldNames(appId), description, pipelineType, artifactTemplate, }) {
|
|
35
36
|
if (kinds.length === 0) {
|
|
36
37
|
throw new Error('select at least one primitive via --with orm,workspace,function,agent,process,pipeline,artifact (or --orm --function …)');
|
|
37
38
|
}
|
|
@@ -41,11 +42,12 @@ export async function initAppMonorepo({ rootDir, appId, kinds, names = defaultSc
|
|
|
41
42
|
const snapshot = await inspectScaffoldTarget(appRoot);
|
|
42
43
|
await mkdir(appRoot, { recursive: true });
|
|
43
44
|
try {
|
|
45
|
+
await writeScaffoldGuidance({ directory: appRoot });
|
|
44
46
|
const version = currentVersion();
|
|
45
47
|
const primitives = [];
|
|
46
48
|
for (const kind of kinds) {
|
|
47
49
|
const name = kind === 'function' ? names.functionName : appId;
|
|
48
|
-
primitives.push(await scaffoldKind({ kind, appRoot, appId, name, pipelineType }));
|
|
50
|
+
primitives.push(await scaffoldKind({ kind, appRoot, appId, name, pipelineType, artifactTemplate }));
|
|
49
51
|
}
|
|
50
52
|
const withDeps = applyDefaultDependsOn(primitives);
|
|
51
53
|
const shared = await scaffoldSharedPackage({ rootDir: appRoot, appId, name: 'shared' });
|
|
@@ -89,7 +91,7 @@ export async function initAppMonorepo({ rootDir, appId, kinds, names = defaultSc
|
|
|
89
91
|
throw error;
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
export async function addPrimitiveToApp({ rootDir, kind, name, pipelineType, dependsOn, }) {
|
|
94
|
+
export async function addPrimitiveToApp({ rootDir, kind, name, pipelineType, artifactTemplate, dependsOn, }) {
|
|
93
95
|
const appRoot = resolve(rootDir);
|
|
94
96
|
const manifest = await loadAppManifest(appRoot);
|
|
95
97
|
const appId = manifest.app.id;
|
|
@@ -115,7 +117,7 @@ export async function addPrimitiveToApp({ rootDir, kind, name, pipelineType, dep
|
|
|
115
117
|
const workspacePath = join(appRoot, 'pnpm-workspace.yaml');
|
|
116
118
|
const previousWorkspace = existsSync(workspacePath) ? await readFile(workspacePath, 'utf8') : null;
|
|
117
119
|
try {
|
|
118
|
-
let entry = await scaffoldKind({ kind, appRoot, appId, name, pipelineType });
|
|
120
|
+
let entry = await scaffoldKind({ kind, appRoot, appId, name, pipelineType, artifactTemplate });
|
|
119
121
|
const orm = manifest.primitives.find((item) => item.kind === 'orm');
|
|
120
122
|
if (dependsOn !== undefined) {
|
|
121
123
|
entry = { ...entry, depends_on: dependsOn };
|
|
@@ -173,6 +175,7 @@ export function printInitNextSteps({ appRoot, manifest, }) {
|
|
|
173
175
|
const rel = relative(process.cwd(), appRoot);
|
|
174
176
|
const display = !rel || rel.startsWith('..') ? appRoot : rel;
|
|
175
177
|
console.log(`${LOG} scaffolded app "${manifest.app.id}" in ${display}`);
|
|
178
|
+
console.log(`${LOG} AGENTS.md points to your environment's live docs; CLAUDE.md imports it`);
|
|
176
179
|
console.log(`${LOG} wrote README.md (Sequence app docs) and ${APP_MANIFEST_LABEL} with ${manifest.primitives.length} primitive(s):`);
|
|
177
180
|
for (const entry of manifest.primitives) {
|
|
178
181
|
console.log(`${LOG} - ${entry.kind.padEnd(9)} ${entry.id} (${entry.path})`);
|
|
@@ -5,10 +5,20 @@ import { dump as yamlDump, load as yamlLoad } from 'js-yaml';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { loadAppManifest, usesAppGraph, writeAppManifest } from './manifest.js';
|
|
7
7
|
import { currentVersion } from '../update-check.js';
|
|
8
|
+
import { FIRST_PARTY_RELEASE_AGE_EXCLUDE } from '../release-age.js';
|
|
8
9
|
const packageSchema = z.looseObject({
|
|
9
10
|
dependencies: z.record(z.string(), z.string()).optional(),
|
|
10
11
|
pnpm: z.strictObject({ overrides: z.record(z.string(), z.string()).optional() }).optional(),
|
|
11
12
|
});
|
|
13
|
+
const artifactTypeSchema = z.looseObject({ artifact: z.looseObject({ type: z.string().optional() }) });
|
|
14
|
+
/** Hosted Next.js builds need a standalone lockfile with one root importer and no workspace: links. */
|
|
15
|
+
async function isStandaloneNextArtifact({ entry, directory }) {
|
|
16
|
+
const manifestPath = join(directory, 'artifact.bundle.yml');
|
|
17
|
+
if (entry.kind !== 'artifact' || !existsSync(manifestPath))
|
|
18
|
+
return false;
|
|
19
|
+
const parsed = artifactTypeSchema.safeParse(yamlLoad(await readFile(manifestPath, 'utf8')));
|
|
20
|
+
return parsed.success && parsed.data.artifact.type === 'nextjs';
|
|
21
|
+
}
|
|
12
22
|
const workspaceSchema = z.looseObject({
|
|
13
23
|
packages: z.array(z.string()).optional(),
|
|
14
24
|
overrides: z.record(z.string(), z.string()).optional(),
|
|
@@ -51,7 +61,7 @@ export async function joinAppWorkspace({ rootDir, manifest, entries, }) {
|
|
|
51
61
|
for (const entry of entries) {
|
|
52
62
|
const directory = join(rootDir, entry.path);
|
|
53
63
|
const packagePath = join(directory, 'package.json');
|
|
54
|
-
if (!existsSync(packagePath))
|
|
64
|
+
if (!existsSync(packagePath) || await isStandaloneNextArtifact({ entry, directory }))
|
|
55
65
|
continue;
|
|
56
66
|
const pkg = packageSchema.parse(JSON.parse(await readFile(packagePath, 'utf8')));
|
|
57
67
|
const { pnpm, ...packageFields } = pkg;
|
|
@@ -89,12 +99,7 @@ export async function scaffoldAppWorkspace({ rootDir, manifest, }) {
|
|
|
89
99
|
await writeFile(join(rootDir, 'pnpm-workspace.yaml'), yamlDump({
|
|
90
100
|
packages: [],
|
|
91
101
|
minimumReleaseAge: 10080,
|
|
92
|
-
minimumReleaseAgeExclude: [
|
|
93
|
-
'@sequenceholdings/agent-spec', '@sequenceholdings/atlas-ui',
|
|
94
|
-
'@sequenceholdings/lattice-form-renderer', '@sequenceholdings/artifact-studio',
|
|
95
|
-
'@sequenceholdings/lattice', '@sequenceholdings/orm',
|
|
96
|
-
'@sequenceholdings/pipeline-spec', '@sequenceholdings/studio-cli',
|
|
97
|
-
],
|
|
102
|
+
minimumReleaseAgeExclude: [...FIRST_PARTY_RELEASE_AGE_EXCLUDE],
|
|
98
103
|
strictDepBuilds: true,
|
|
99
104
|
allowBuilds: { esbuild: true },
|
|
100
105
|
}));
|
package/dist/argv.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ParsedArgs {
|
|
2
|
+
positional: string[];
|
|
3
|
+
flags: Record<string, string | true>;
|
|
4
|
+
/** All string values for flags supplied more than once; flags keeps the last value. */
|
|
5
|
+
repeatedFlags?: Record<string, string[]>;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseArgs(rest: string[]): ParsedArgs;
|
package/dist/argv.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const SHORT_FLAG_ALIASES = { '-e': 'env', '-m': 'message', '-o': 'out' };
|
|
2
|
+
export function parseArgs(rest) {
|
|
3
|
+
const positional = [];
|
|
4
|
+
const flags = {};
|
|
5
|
+
const repeatedFlags = {};
|
|
6
|
+
const setFlag = (key, value) => {
|
|
7
|
+
flags[key] = value;
|
|
8
|
+
if (typeof value === 'string')
|
|
9
|
+
(repeatedFlags[key] ??= []).push(value);
|
|
10
|
+
};
|
|
11
|
+
for (let i = 0; i < rest.length; i++) {
|
|
12
|
+
const arg = rest[i];
|
|
13
|
+
if (arg === '--') {
|
|
14
|
+
positional.push(...rest.slice(i + 1));
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
if (arg.startsWith('--')) {
|
|
18
|
+
const body = arg.slice(2);
|
|
19
|
+
const eqIdx = body.indexOf('=');
|
|
20
|
+
if (eqIdx >= 0) {
|
|
21
|
+
setFlag(body.slice(0, eqIdx), body.slice(eqIdx + 1));
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const next = rest[i + 1];
|
|
25
|
+
if (next && !next.startsWith('-')) {
|
|
26
|
+
setFlag(body, next);
|
|
27
|
+
i += 1;
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
setFlag(body, true);
|
|
31
|
+
}
|
|
32
|
+
else if (arg.startsWith('-') && arg.length >= 2 && !arg.startsWith('--')) {
|
|
33
|
+
const eqIdx = arg.indexOf('=');
|
|
34
|
+
const shortName = eqIdx >= 0 ? arg.slice(0, eqIdx) : arg;
|
|
35
|
+
const longName = SHORT_FLAG_ALIASES[shortName];
|
|
36
|
+
if (!longName || shortName.length !== 2) {
|
|
37
|
+
positional.push(arg);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (eqIdx >= 0) {
|
|
41
|
+
setFlag(longName, arg.slice(eqIdx + 1));
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const next = rest[i + 1];
|
|
45
|
+
if (next && !next.startsWith('-')) {
|
|
46
|
+
setFlag(longName, next);
|
|
47
|
+
i += 1;
|
|
48
|
+
}
|
|
49
|
+
else
|
|
50
|
+
setFlag(longName, true);
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
positional.push(arg);
|
|
54
|
+
}
|
|
55
|
+
return { positional, flags, ...(Object.keys(repeatedFlags).length ? { repeatedFlags } : {}) };
|
|
56
|
+
}
|
|
@@ -19,9 +19,9 @@ import { PREVIEW_DOMAIN, PREVIEW_PROJECT, resolvePreviewByPr } from '../preview.
|
|
|
19
19
|
const ARTIFACT_USAGE = `usage:
|
|
20
20
|
seq-studio artifact init <dir> [--template react-vite|nextjs]
|
|
21
21
|
seq-studio artifact validate [dir]
|
|
22
|
-
seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--out file.json]
|
|
23
|
-
seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] -e <env>
|
|
24
|
-
seq-studio artifact deploy [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] -e <env> [--skip-unchanged] [--no-create] [--project <id>]
|
|
22
|
+
seq-studio artifact build [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] [--out file.json]
|
|
23
|
+
seq-studio artifact plan [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] -e <env>
|
|
24
|
+
seq-studio artifact deploy [dir | --repo <ns>/<name> | --git-url <url>] [--ref <ref>] [--path <dir>] -e <env> [--skip-unchanged] [--no-create] [--project <id>]
|
|
25
25
|
seq-studio artifact dev [dir] -e <env> [--once] [--key default] [--link <pkgDir>[,<pkgDir>]] [--port <port>]
|
|
26
26
|
seq-studio artifact pull <project-id> -e <env> --out <dir>
|
|
27
27
|
seq-studio artifact promote <deployment-id> -e <env>
|
|
@@ -39,7 +39,8 @@ const ARTIFACT_USAGE = `usage:
|
|
|
39
39
|
|
|
40
40
|
Source for build/plan/deploy: a local [dir] (default), a platform git-service
|
|
41
41
|
repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --ref selects a
|
|
42
|
-
branch/tag/commit (default: the repo's default branch).
|
|
42
|
+
branch/tag/commit (default: the repo's default branch). --path <dir> selects the
|
|
43
|
+
application directory inside that repository (default: its root).
|
|
43
44
|
|
|
44
45
|
Interactive --repo builds clone over smart-HTTP and require ATLAS_GIT_PAT
|
|
45
46
|
(a repo:read PAT — seq-studio auth pat create, or Atlas → Settings → Tokens).
|
|
@@ -54,6 +55,9 @@ const ARTIFACT_USAGE = `usage:
|
|
|
54
55
|
with a Git Service origin on the target Atlas environment also works.
|
|
55
56
|
Use pnpm build for a local production-build check. --once is static-only;
|
|
56
57
|
--port selects the local Next loopback port.
|
|
58
|
+
Deploy rejects source that still points at another environment's API origin
|
|
59
|
+
or workspace UUID. Declare API origins under targets.<environment>.url.
|
|
60
|
+
Workspace IDs in source must exist in the selected environment.
|
|
57
61
|
|
|
58
62
|
Per-PR preview environments (https://studio-atlas-git-<slug>.preview.seqholdings.com):
|
|
59
63
|
-e preview:<branch-or-slug> compute the preview host from a branch name
|
package/dist/atlas-client.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export declare class AtlasApiError extends Error {
|
|
|
22
22
|
readonly name = "AtlasApiError";
|
|
23
23
|
constructor(status: number, message: string, path: string, statusText?: string, body?: unknown);
|
|
24
24
|
}
|
|
25
|
+
/** Bounded single attempt for commands whose uncertain result must be reconciled by the caller. */
|
|
26
|
+
export declare function requestJsonOnce({ baseUrl, token, path, method, body, }: ClientOptions & {
|
|
27
|
+
path: string;
|
|
28
|
+
method: 'GET' | 'POST' | 'PUT';
|
|
29
|
+
body?: unknown;
|
|
30
|
+
}): Promise<unknown>;
|
|
25
31
|
export declare function getJson<T>({ baseUrl, token, path, }: ClientOptions & {
|
|
26
32
|
path: string;
|
|
27
33
|
}): Promise<T>;
|
package/dist/atlas-client.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the caller — this file knows nothing about token files or config TOMLs.
|
|
6
6
|
*/
|
|
7
7
|
import { authenticatedRequestUrl } from '@sequenceholdings/artifact-studio/deployment-validation';
|
|
8
|
+
import { validationDetail } from './validation-detail.js';
|
|
8
9
|
import { PREVIEW_DOMAIN } from './preview.js';
|
|
9
10
|
const MAX_503_RETRIES = 5;
|
|
10
11
|
const DEFAULT_RETRY_AFTER_SECONDS = 2;
|
|
@@ -36,9 +37,10 @@ async function fetchWith503Retry(input, init) {
|
|
|
36
37
|
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
async function authenticatedFetch({ baseUrl, init = {}, path, token, }) {
|
|
40
|
+
async function authenticatedFetch({ baseUrl, init = {}, path, token, retry503 = true, }) {
|
|
40
41
|
const url = authenticatedRequestUrl({ baseUrl, path });
|
|
41
|
-
|
|
42
|
+
const send = retry503 ? fetchWith503Retry : fetch;
|
|
43
|
+
return send(url, {
|
|
42
44
|
...init,
|
|
43
45
|
redirect: 'manual',
|
|
44
46
|
headers: {
|
|
@@ -49,6 +51,38 @@ async function authenticatedFetch({ baseUrl, init = {}, path, token, }) {
|
|
|
49
51
|
},
|
|
50
52
|
});
|
|
51
53
|
}
|
|
54
|
+
/** Bounded single attempt for commands whose uncertain result must be reconciled by the caller. */
|
|
55
|
+
export async function requestJsonOnce({ baseUrl, token, path, method, body, }) {
|
|
56
|
+
const response = await authenticatedFetch({ baseUrl, token, path, retry503: false,
|
|
57
|
+
init: { method, signal: AbortSignal.timeout(30_000),
|
|
58
|
+
headers: body === undefined ? {} : { 'Content-Type': 'application/json' },
|
|
59
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }) } });
|
|
60
|
+
const reader = response.body?.getReader();
|
|
61
|
+
if (!reader)
|
|
62
|
+
throw new Error('Missing response body');
|
|
63
|
+
const chunks = [];
|
|
64
|
+
let size = 0;
|
|
65
|
+
try {
|
|
66
|
+
for (;;) {
|
|
67
|
+
const item = await reader.read();
|
|
68
|
+
if (item.done)
|
|
69
|
+
break;
|
|
70
|
+
size += item.value.byteLength;
|
|
71
|
+
if (size > 8_388_608)
|
|
72
|
+
throw new Error('Response exceeds 8 MiB');
|
|
73
|
+
chunks.push(item.value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
void reader.cancel().catch(() => { });
|
|
78
|
+
reader.releaseLock();
|
|
79
|
+
}
|
|
80
|
+
const raw = Buffer.concat(chunks).toString('utf8');
|
|
81
|
+
const parsed = parseErrorBody(raw, response.headers.get('content-type') ?? '');
|
|
82
|
+
if (!response.ok)
|
|
83
|
+
throw new AtlasApiError(response.status, messageFromBody(parsed, response.status, response.statusText), path, response.statusText, parsed);
|
|
84
|
+
return parsed;
|
|
85
|
+
}
|
|
52
86
|
function previewAccessHeaders(baseUrl) {
|
|
53
87
|
const secret = process.env.PREVIEW_ACCESS_HEADER?.trim();
|
|
54
88
|
if (!secret)
|
|
@@ -114,6 +148,9 @@ function messageFromBody(body, status, statusText) {
|
|
|
114
148
|
const record = body;
|
|
115
149
|
const violations = violationLines(record.violations);
|
|
116
150
|
const withViolations = (headline) => violations.length > 0 ? [headline, ...violations].join('\n') : headline;
|
|
151
|
+
const fields = validationDetail(record.errors);
|
|
152
|
+
if (fields)
|
|
153
|
+
return withViolations(fields);
|
|
117
154
|
if (typeof record.detail === 'string' && record.detail.length > 0) {
|
|
118
155
|
return withViolations(record.detail);
|
|
119
156
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ParsedArgs } from '../process/commands.js';
|
|
2
2
|
declare const PAT_SCOPES: readonly ["repo:read", "repo:write", "repo:admin"];
|
|
3
3
|
type PatScope = (typeof PAT_SCOPES)[number];
|
|
4
|
-
export declare const AUTH_USAGE = "usage:\n seq-studio auth pat create --name <n> -e <env> [--scopes repo:read,repo:write]\n [--expires 1d|7d|30d|90d|1y|never] [--store-credentials]\n seq-studio auth pat list -e <env>\n seq-studio auth pat revoke <id> -e <env> [--yes]\n\n Issue a personal access token for git clone / git push against the platform\n git service.\n\n Authenticate with `seq-studio login`, then run `auth pat create -e <env>`.\n Alternatively, open Atlas \u2192 Settings \u2192 Tokens:\n https://<atlas-host>/settings/tokens\n Sign in, create a token (repo:read / repo:write), copy once, then:\n export ATLAS_GIT_PAT=<token>\n repo:write covers push and PR open; merging a PR requires an FGA Merge\n (or Admin) grant on the repository, not a PAT scope.\n\n On create the raw token is printed ONCE \u2014 store it; Atlas cannot re-show it.\n Git Basic auth: any username (e.g. git), PAT as the password.\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n";
|
|
4
|
+
export declare const AUTH_USAGE = "usage:\n seq-studio auth whoami -e <env> [--json] server-verified identity and target (no tokens)\n seq-studio auth pat create --name <n> -e <env> [--scopes repo:read,repo:write]\n [--expires 1d|7d|30d|90d|1y|never] [--store-credentials]\n seq-studio auth pat list -e <env>\n seq-studio auth pat revoke <id> -e <env> [--yes]\n\n Issue a personal access token for git clone / git push against the platform\n git service.\n\n Authenticate with `seq-studio login`, then run `auth pat create -e <env>`.\n Alternatively, open Atlas \u2192 Settings \u2192 Tokens:\n https://<atlas-host>/settings/tokens\n Sign in, create a token (repo:read / repo:write), copy once, then:\n export ATLAS_GIT_PAT=<token>\n repo:write covers push and PR open; merging a PR requires an FGA Merge\n (or Admin) grant on the repository, not a PAT scope.\n\n On create the raw token is printed ONCE \u2014 store it; Atlas cannot re-show it.\n Git Basic auth: any username (e.g. git), PAT as the password.\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n";
|
|
5
5
|
export declare function parsePatScopes(raw: string | undefined): PatScope[];
|
|
6
6
|
/**
|
|
7
7
|
* Map UI-style duration choices to an absolute ISO-8601 expiresAt, or undefined
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* The raw token is printed exactly once on create; use it as the Basic-auth
|
|
9
9
|
* password for `git clone` / `git push` (username is ignored).
|
|
10
10
|
*/
|
|
11
|
+
import { validateCommandInput, wantsHelp } from '../command-input.js';
|
|
11
12
|
import { deleteNoContent, getJson, postJson } from '../atlas-client.js';
|
|
12
13
|
import { printCliError } from '../cli-errors.js';
|
|
13
14
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
@@ -39,6 +40,7 @@ function stringFlag(flags, key) {
|
|
|
39
40
|
return value;
|
|
40
41
|
}
|
|
41
42
|
export const AUTH_USAGE = `usage:
|
|
43
|
+
seq-studio auth whoami -e <env> [--json] server-verified identity and target (no tokens)
|
|
42
44
|
seq-studio auth pat create --name <n> -e <env> [--scopes repo:read,repo:write]
|
|
43
45
|
[--expires 1d|7d|30d|90d|1y|never] [--store-credentials]
|
|
44
46
|
seq-studio auth pat list -e <env>
|
|
@@ -223,7 +225,21 @@ export async function authPatRevokeCommand(args) {
|
|
|
223
225
|
}
|
|
224
226
|
export async function runAuthCommand(sub, args) {
|
|
225
227
|
try {
|
|
228
|
+
if (wantsHelp({ sub, args })) {
|
|
229
|
+
console.log(AUTH_USAGE);
|
|
230
|
+
return 0;
|
|
231
|
+
}
|
|
226
232
|
switch (sub) {
|
|
233
|
+
case 'whoami': {
|
|
234
|
+
validateCommandInput({ args, flags: {}, positional: 0 });
|
|
235
|
+
const ctx = await buildContext(args);
|
|
236
|
+
const { sub: subject, email, name, tenantSlug, roles, permissions } = await getJson({ ...clientOptions(ctx), path: '/api/me' });
|
|
237
|
+
console.log(JSON.stringify({
|
|
238
|
+
environment: ctx.env.name, url: ctx.env.url, authMode: ctx.authMode,
|
|
239
|
+
identity: { sub: subject, email, name, tenantSlug, roles, permissions },
|
|
240
|
+
}, null, 2));
|
|
241
|
+
return 0;
|
|
242
|
+
}
|
|
227
243
|
case 'pat': {
|
|
228
244
|
const action = args.positional[0];
|
|
229
245
|
const nested = {
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/** A token-cache failure is distinct from an absent or expired login. */
|
|
2
|
+
export declare class AuthTokenStoreError extends Error {
|
|
3
|
+
readonly kind: 'permission' | 'invalid' | 'io';
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly name = "AuthTokenStoreError";
|
|
6
|
+
constructor(message: string, kind: 'permission' | 'invalid' | 'io', path: string, options?: ErrorOptions);
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
9
|
* seq-studio and seqapi share one token file and one Auth0 application:
|
|
3
10
|
* same tenant, client id, audience, and token shape. Either CLI can log in,
|
|
@@ -55,6 +62,7 @@ export interface SeqapiTokens {
|
|
|
55
62
|
}
|
|
56
63
|
interface RealmResolutionOptions {
|
|
57
64
|
fetchImpl?: typeof fetch;
|
|
65
|
+
offline?: boolean;
|
|
58
66
|
targetUrl?: string;
|
|
59
67
|
}
|
|
60
68
|
/**
|
|
@@ -133,6 +141,30 @@ export declare function tryGetAccessToken(options?: {
|
|
|
133
141
|
env?: string;
|
|
134
142
|
targetUrl?: string;
|
|
135
143
|
}): Promise<string | null>;
|
|
144
|
+
export interface AuthPreflightDiagnostics {
|
|
145
|
+
authMode: 'auto' | 'm2m';
|
|
146
|
+
realm: string;
|
|
147
|
+
realmVerified: boolean;
|
|
148
|
+
tokenCachePath: string;
|
|
149
|
+
tokenCache: 'readable' | 'missing' | 'permission-denied' | 'invalid-json' | 'io-error';
|
|
150
|
+
cachedUserToken: 'valid' | 'expired' | 'missing' | 'unavailable';
|
|
151
|
+
cachedM2mToken: 'valid' | 'expired' | 'missing' | 'unavailable';
|
|
152
|
+
m2mCredentialConfigured: boolean;
|
|
153
|
+
selectedCredential: 'user' | 'm2m' | 'none' | 'unavailable';
|
|
154
|
+
detail?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Read-only, non-interactive authentication preflight. This never returns a
|
|
158
|
+
* credential, launches a browser, contacts Auth0, or writes the shared cache.
|
|
159
|
+
* Atomic rename means reading the cache without taking its write lock is safe;
|
|
160
|
+
* importantly, a read-only doctor still works when the cache directory cannot
|
|
161
|
+
* create the lock file.
|
|
162
|
+
*/
|
|
163
|
+
export declare function inspectAuthPreflight(options?: {
|
|
164
|
+
env?: string;
|
|
165
|
+
offline?: boolean;
|
|
166
|
+
targetUrl?: string;
|
|
167
|
+
}): Promise<AuthPreflightDiagnostics>;
|
|
136
168
|
/**
|
|
137
169
|
* Refuse to persist a token minted for another audience or Auth0
|
|
138
170
|
* organization. Auth0/server-side JWT verification remains authoritative;
|