@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
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* Registering a schema_version 3 app with Atlas as an Application, after its
|
|
3
3
|
* primitives deploy (`PUT /api/custom-roles/applications/<app.id>`).
|
|
4
4
|
*
|
|
5
|
+
* Members the deployer doesn't administer aren't an error: Atlas records a
|
|
6
|
+
* consent request for their admins and the deploy succeeds with those
|
|
7
|
+
* members' includes dormant. The log says who to ask.
|
|
8
|
+
*
|
|
5
9
|
* The YAML's `role: end_user | invoker` alias becomes the server's single
|
|
6
10
|
* `{ type: 'end_user' }` spelling here, so the API has one contract. Members
|
|
7
|
-
* are the artifact/function/ORM primitives
|
|
8
|
-
* referenced by the stable names that resolve in every environment.
|
|
11
|
+
* are the artifact/function/ORM primitives, single-process entries and
|
|
12
|
+
* pipelines, referenced by the stable names that resolve in every environment.
|
|
9
13
|
*/
|
|
10
14
|
import { type ClientOptions } from '../atlas-client.js';
|
|
11
15
|
import { type AppManifest, type PrimitiveEntry } from './manifest.js';
|
|
12
|
-
type MemberKind = 'artifact' | 'function' | 'orm' | 'lattice';
|
|
16
|
+
type MemberKind = 'artifact' | 'function' | 'orm' | 'lattice' | 'pipeline';
|
|
13
17
|
export interface ApplicationDeployMember {
|
|
14
18
|
key: string;
|
|
15
19
|
kind: MemberKind;
|
|
@@ -58,19 +62,42 @@ export interface ApplicationDeployBody {
|
|
|
58
62
|
roles: Record<string, ApplicationDeployRole>;
|
|
59
63
|
/** Collaborator roles: member tiers only. */
|
|
60
64
|
collaborators: Record<string, ApplicationDeployRole>;
|
|
65
|
+
/** The Application's own capabilities; members pin them as `app/<id>/<key>`. */
|
|
66
|
+
capabilities: Record<string, {
|
|
67
|
+
description?: string;
|
|
68
|
+
}>;
|
|
61
69
|
}
|
|
62
70
|
export interface ApplicationDeployWarning {
|
|
63
71
|
type: string;
|
|
64
72
|
role: string;
|
|
65
|
-
/** `collaborator` for a collaborator role; older servers send none. */
|
|
73
|
+
/** `collaborator` for a collaborator role, `capability` for an Application capability (`role` is then its key); older servers send none. */
|
|
66
74
|
kind?: string;
|
|
67
75
|
detail: string;
|
|
68
76
|
}
|
|
69
|
-
|
|
77
|
+
/**
|
|
78
|
+
* `agentRefs`: primitive id -> the agent an agent entry deploys (see
|
|
79
|
+
* agent-refs.ts). Without it, an agent component names its agent only when
|
|
80
|
+
* `only` selects exactly one.
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildApplicationDeployBody(manifest: AppManifest, { agentRefs }?: {
|
|
83
|
+
agentRefs?: ReadonlyMap<string, string>;
|
|
84
|
+
}): ApplicationDeployBody;
|
|
85
|
+
/** A member the deploy left waiting for its admins' consent (older servers send none). */
|
|
86
|
+
export interface ApplicationConsentRequest {
|
|
87
|
+
member: string;
|
|
88
|
+
kind: MemberKind;
|
|
89
|
+
ref: string;
|
|
90
|
+
/** `runtime` (use, roles, capabilities) or `collaborator` (edit tiers too). */
|
|
91
|
+
level: string;
|
|
92
|
+
/** The member had been withdrawn or declined before this request. */
|
|
93
|
+
previously: string | null;
|
|
94
|
+
}
|
|
70
95
|
export type ApplicationRegistration = {
|
|
71
96
|
status: 'registered';
|
|
72
97
|
created: boolean;
|
|
73
98
|
warnings: ApplicationDeployWarning[];
|
|
99
|
+
/** Members whose admins must allow this Application before roles reach them. Older servers send none. */
|
|
100
|
+
requested?: ApplicationConsentRequest[];
|
|
74
101
|
} | {
|
|
75
102
|
status: 'failed';
|
|
76
103
|
message: string;
|
|
@@ -78,10 +105,13 @@ export type ApplicationRegistration = {
|
|
|
78
105
|
export type RegisterApplication = (args: {
|
|
79
106
|
manifest: AppManifest;
|
|
80
107
|
env: string;
|
|
108
|
+
/** Primitive id -> the agent an agent entry deploys. */
|
|
109
|
+
agentRefs?: ReadonlyMap<string, string>;
|
|
81
110
|
}) => Promise<ApplicationRegistration>;
|
|
82
|
-
export declare function putApplication({ client, manifest, }: {
|
|
111
|
+
export declare function putApplication({ client, manifest, agentRefs, }: {
|
|
83
112
|
client: ClientOptions;
|
|
84
113
|
manifest: AppManifest;
|
|
114
|
+
agentRefs?: ReadonlyMap<string, string>;
|
|
85
115
|
}): Promise<ApplicationRegistration>;
|
|
86
116
|
export declare function logApplicationRegistration({ appId, registration, }: {
|
|
87
117
|
appId: string;
|
|
@@ -2,18 +2,24 @@
|
|
|
2
2
|
* Registering a schema_version 3 app with Atlas as an Application, after its
|
|
3
3
|
* primitives deploy (`PUT /api/custom-roles/applications/<app.id>`).
|
|
4
4
|
*
|
|
5
|
+
* Members the deployer doesn't administer aren't an error: Atlas records a
|
|
6
|
+
* consent request for their admins and the deploy succeeds with those
|
|
7
|
+
* members' includes dormant. The log says who to ask.
|
|
8
|
+
*
|
|
5
9
|
* The YAML's `role: end_user | invoker` alias becomes the server's single
|
|
6
10
|
* `{ type: 'end_user' }` spelling here, so the API has one contract. Members
|
|
7
|
-
* are the artifact/function/ORM primitives
|
|
8
|
-
* referenced by the stable names that resolve in every environment.
|
|
11
|
+
* are the artifact/function/ORM primitives, single-process entries and
|
|
12
|
+
* pipelines, referenced by the stable names that resolve in every environment.
|
|
9
13
|
*/
|
|
10
14
|
import { AtlasApiError, putJson } from '../atlas-client.js';
|
|
11
15
|
import { buildContext, clientOptions } from '../functions/commands.js';
|
|
16
|
+
import { pipelineReleaseUnit } from './adapters.js';
|
|
12
17
|
import { isFloorRoleAlias } from './manifest.js';
|
|
13
18
|
const LOG = '[seq-studio]';
|
|
14
19
|
/**
|
|
15
|
-
* The member ref Atlas resolves: project slug, function slug, namespace,
|
|
16
|
-
* — for a process entry that deploys exactly one
|
|
20
|
+
* The member ref Atlas resolves: project slug, function slug, namespace, a
|
|
21
|
+
* pipeline's release unit, or — for a process entry that deploys exactly one
|
|
22
|
+
* process — its process id.
|
|
17
23
|
*/
|
|
18
24
|
function memberOf(entry) {
|
|
19
25
|
if (entry.kind === 'artifact' && entry.project_id)
|
|
@@ -22,20 +28,23 @@ function memberOf(entry) {
|
|
|
22
28
|
return { key: entry.id, kind: 'function', ref: entry.slug };
|
|
23
29
|
if (entry.kind === 'orm' && entry.namespace)
|
|
24
30
|
return { key: entry.id, kind: 'orm', ref: entry.namespace };
|
|
31
|
+
const releaseUnit = entry.kind === 'pipeline' ? pipelineReleaseUnit(entry) : undefined;
|
|
32
|
+
if (releaseUnit)
|
|
33
|
+
return { key: entry.id, kind: 'pipeline', ref: releaseUnit };
|
|
25
34
|
const [processId, ...more] = entry.kind === 'process' ? (entry.only ?? []) : [];
|
|
26
35
|
if (processId && more.length === 0)
|
|
27
36
|
return { key: entry.id, kind: 'lattice', ref: processId };
|
|
28
37
|
return null;
|
|
29
38
|
}
|
|
30
|
-
function componentRef(entry) {
|
|
39
|
+
function componentRef(entry, agentRefs) {
|
|
31
40
|
switch (entry.kind) {
|
|
32
41
|
case 'artifact': return entry.project_id;
|
|
33
42
|
case 'function': return entry.slug;
|
|
34
43
|
case 'orm': return entry.namespace;
|
|
35
44
|
case 'workspace': return entry.name;
|
|
36
45
|
case 'process': return entry.only?.length === 1 ? entry.only[0] : undefined;
|
|
37
|
-
case '
|
|
38
|
-
case '
|
|
46
|
+
case 'pipeline': return pipelineReleaseUnit(entry);
|
|
47
|
+
case 'agent': return agentRefs.get(entry.id) ?? (entry.only?.length === 1 ? entry.only[0] : undefined);
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
function collaboratorRolesOf(manifest) {
|
|
@@ -48,7 +57,12 @@ function collaboratorRolesOf(manifest) {
|
|
|
48
57
|
},
|
|
49
58
|
]));
|
|
50
59
|
}
|
|
51
|
-
|
|
60
|
+
/**
|
|
61
|
+
* `agentRefs`: primitive id -> the agent an agent entry deploys (see
|
|
62
|
+
* agent-refs.ts). Without it, an agent component names its agent only when
|
|
63
|
+
* `only` selects exactly one.
|
|
64
|
+
*/
|
|
65
|
+
export function buildApplicationDeployBody(manifest, { agentRefs = new Map() } = {}) {
|
|
52
66
|
const roles = {};
|
|
53
67
|
for (const [key, definition] of Object.entries(manifest.roles?.definitions ?? {})) {
|
|
54
68
|
roles[key] = {
|
|
@@ -73,18 +87,28 @@ export function buildApplicationDeployBody(manifest) {
|
|
|
73
87
|
return member ? [member] : [];
|
|
74
88
|
}),
|
|
75
89
|
components: manifest.primitives.map((entry) => {
|
|
76
|
-
const ref = componentRef(entry);
|
|
90
|
+
const ref = componentRef(entry, agentRefs);
|
|
77
91
|
return { key: entry.id, kind: entry.kind, ...(ref !== undefined ? { ref } : {}) };
|
|
78
92
|
}),
|
|
79
93
|
edges: manifest.primitives.flatMap((entry) => entry.uses.map((use) => ({ from: entry.id, to: use.primitive, ...(use.as !== undefined ? { label: use.as } : {}) }))),
|
|
80
94
|
roles,
|
|
81
95
|
collaborators: collaboratorRolesOf(manifest),
|
|
96
|
+
capabilities: manifest.capabilities ?? {},
|
|
82
97
|
};
|
|
83
98
|
}
|
|
84
99
|
function asRecord(value) {
|
|
85
100
|
return value && typeof value === 'object' ? Object.fromEntries(Object.entries(value)) : {};
|
|
86
101
|
}
|
|
87
102
|
const isString = (value) => typeof value === 'string';
|
|
103
|
+
const MEMBER_KINDS = ['artifact', 'function', 'orm', 'lattice', 'pipeline'];
|
|
104
|
+
const isMemberKind = (value) => MEMBER_KINDS.some((kind) => kind === value);
|
|
105
|
+
const MEMBER_KIND_LABEL = {
|
|
106
|
+
artifact: 'artifact',
|
|
107
|
+
function: 'function',
|
|
108
|
+
orm: 'ORM namespace',
|
|
109
|
+
lattice: 'Lattice process',
|
|
110
|
+
pipeline: 'pipeline',
|
|
111
|
+
};
|
|
88
112
|
/** Server-side detail worth printing beyond the error message. */
|
|
89
113
|
function errorDetailLines(error) {
|
|
90
114
|
const record = asRecord(error.body);
|
|
@@ -100,13 +124,21 @@ function errorDetailLines(error) {
|
|
|
100
124
|
}
|
|
101
125
|
return lines;
|
|
102
126
|
}
|
|
103
|
-
export async function putApplication({ client, manifest, }) {
|
|
127
|
+
export async function putApplication({ client, manifest, agentRefs, }) {
|
|
104
128
|
const path = `/api/custom-roles/applications/${encodeURIComponent(manifest.app.id)}`;
|
|
105
129
|
try {
|
|
106
130
|
const response = await putJson({
|
|
107
131
|
...client,
|
|
108
132
|
path,
|
|
109
|
-
body: buildApplicationDeployBody(manifest),
|
|
133
|
+
body: buildApplicationDeployBody(manifest, { agentRefs }),
|
|
134
|
+
});
|
|
135
|
+
const consent = asRecord(response.consent);
|
|
136
|
+
const requested = (Array.isArray(consent.requested) ? consent.requested : []).flatMap((entry) => {
|
|
137
|
+
const { member, hostType, naturalKey, level, previously } = asRecord(entry);
|
|
138
|
+
const kind = isMemberKind(hostType) ? hostType : null;
|
|
139
|
+
return isString(member) && kind && isString(naturalKey) && isString(level)
|
|
140
|
+
? [{ member, kind, ref: naturalKey, level, previously: isString(previously) ? previously : null }]
|
|
141
|
+
: [];
|
|
110
142
|
});
|
|
111
143
|
const warnings = (Array.isArray(response.warnings) ? response.warnings : []).flatMap((warning) => {
|
|
112
144
|
const { type, role, kind, detail } = asRecord(warning);
|
|
@@ -119,7 +151,7 @@ export async function putApplication({ client, manifest, }) {
|
|
|
119
151
|
}]
|
|
120
152
|
: [];
|
|
121
153
|
});
|
|
122
|
-
return { status: 'registered', created: response.created === true, warnings };
|
|
154
|
+
return { status: 'registered', created: response.created === true, warnings, requested };
|
|
123
155
|
}
|
|
124
156
|
catch (error) {
|
|
125
157
|
if (!(error instanceof AtlasApiError))
|
|
@@ -134,12 +166,25 @@ export function logApplicationRegistration({ appId, registration, }) {
|
|
|
134
166
|
}
|
|
135
167
|
console.log(`${LOG} ✓ Application "${appId}" ${registration.created ? 'registered' : 'synced'}`);
|
|
136
168
|
for (const warning of registration.warnings) {
|
|
137
|
-
|
|
169
|
+
// Consent requests print below, with who to ask.
|
|
170
|
+
if (warning.type === 'consent_requested')
|
|
171
|
+
continue;
|
|
172
|
+
const section = warning.kind === 'collaborator' ? 'collaborators' : warning.kind === 'capability' ? 'capabilities' : 'roles';
|
|
138
173
|
console.warn(`${LOG} ! ${section}.${warning.role}: ${warning.detail}`);
|
|
139
174
|
}
|
|
175
|
+
const requested = registration.requested ?? [];
|
|
176
|
+
if (requested.length > 0) {
|
|
177
|
+
console.warn(`${LOG} Waiting for consent — roles that include these members take effect once their admins allow "${appId}":`);
|
|
178
|
+
for (const request of requested) {
|
|
179
|
+
const what = request.level === 'collaborator' ? 'to bundle its edit tiers' : 'to give people access';
|
|
180
|
+
const before = request.previously ? ` (previously ${request.previously})` : '';
|
|
181
|
+
console.warn(`${LOG} ${request.member}: ${MEMBER_KIND_LABEL[request.kind]} "${request.ref}" — ask its admins ${what}${before}`);
|
|
182
|
+
}
|
|
183
|
+
console.warn(`${LOG} Admins approve from Permissions → the member → Applications, or by redeploying as someone who administers it.`);
|
|
184
|
+
}
|
|
140
185
|
}
|
|
141
186
|
/** Default registrar: authenticate against `env` the same way the primitive deployers do. */
|
|
142
|
-
export const registerApplicationWithAtlas = async ({ manifest, env }) => {
|
|
187
|
+
export const registerApplicationWithAtlas = async ({ manifest, env, agentRefs }) => {
|
|
143
188
|
const context = await buildContext({ positional: [], flags: { env } });
|
|
144
|
-
return putApplication({ client: clientOptions(context), manifest });
|
|
189
|
+
return putApplication({ client: clientOptions(context), manifest, agentRefs });
|
|
145
190
|
};
|
package/dist/app/commands.js
CHANGED
|
@@ -18,7 +18,7 @@ export const APP_INIT_USAGE = `usage:
|
|
|
18
18
|
seq-studio init <dir> --orm --function --artifact [options]
|
|
19
19
|
|
|
20
20
|
Scaffold an app monorepo with ${APP_MANIFEST_FILENAME}, a Sequence app
|
|
21
|
-
README.md
|
|
21
|
+
README.md, AGENTS.md + CLAUDE.md guidance, and one subfolder per
|
|
22
22
|
selected primitive. At least one kind is required. A git-service clone
|
|
23
23
|
whose README.md contains the seq-studio seed marker is a valid target;
|
|
24
24
|
ordinary docs-only repositories are refused so we do not overwrite them.
|
|
@@ -30,6 +30,7 @@ export const APP_INIT_USAGE = `usage:
|
|
|
30
30
|
--orm --function … boolean aliases for --with
|
|
31
31
|
--function-name <n> name/slug for the first function (default: hello)
|
|
32
32
|
--pipeline-type <t> ingestion, transformation (default), or serving
|
|
33
|
+
--template <t> artifact template: react-vite (default) or nextjs
|
|
33
34
|
--description <text> optional app.description in the manifest
|
|
34
35
|
|
|
35
36
|
Examples:
|
|
@@ -39,7 +40,7 @@ export const APP_INIT_USAGE = `usage:
|
|
|
39
40
|
seq-studio init review-app --with orm,function,agent,process,pipeline,artifact
|
|
40
41
|
`;
|
|
41
42
|
export const APP_ADD_USAGE = `usage:
|
|
42
|
-
seq-studio add <kind> <name> [--depends-on <ids>] [--pipeline-type <type>]
|
|
43
|
+
seq-studio add <kind> <name> [--depends-on <ids>] [--pipeline-type <type>] [--template <t>]
|
|
43
44
|
seq-studio add package <name>
|
|
44
45
|
|
|
45
46
|
Scaffold another primitive into the current app monorepo (must contain
|
|
@@ -49,10 +50,14 @@ export const APP_ADD_USAGE = `usage:
|
|
|
49
50
|
|
|
50
51
|
--depends-on <ids> comma-separated prerequisite primitive ids
|
|
51
52
|
--pipeline-type <t> ingestion, transformation (default), or serving
|
|
53
|
+
--template <t> artifact template: react-vite (default) or nextjs. A
|
|
54
|
+
Next.js artifact keeps its own pnpm-lock.yaml outside
|
|
55
|
+
the app workspace, as hosted builds require.
|
|
52
56
|
|
|
53
57
|
Examples:
|
|
54
58
|
seq-studio add function list-types
|
|
55
59
|
seq-studio add artifact ui
|
|
60
|
+
seq-studio add artifact portal --template nextjs
|
|
56
61
|
seq-studio add agent reviewer --depends-on list-types
|
|
57
62
|
seq-studio add process approvals --depends-on reviewer-agent
|
|
58
63
|
seq-studio add orm audit
|
|
@@ -105,6 +110,16 @@ function pipelineTypeFlag(flags) {
|
|
|
105
110
|
return value;
|
|
106
111
|
throw new Error('--pipeline-type requires ingestion, transformation, or serving');
|
|
107
112
|
}
|
|
113
|
+
function artifactTemplateFlag({ flags, kinds }) {
|
|
114
|
+
const value = flags.template;
|
|
115
|
+
if (value === undefined)
|
|
116
|
+
return undefined;
|
|
117
|
+
if (value !== 'react-vite' && value !== 'nextjs')
|
|
118
|
+
throw new Error('--template requires react-vite or nextjs');
|
|
119
|
+
if (!kinds.includes('artifact'))
|
|
120
|
+
throw new Error('--template only applies when scaffolding an artifact');
|
|
121
|
+
return value;
|
|
122
|
+
}
|
|
108
123
|
function printError(error) {
|
|
109
124
|
const message = error instanceof Error ? error.message : String(error);
|
|
110
125
|
console.error(`${LOG} ${message}`);
|
|
@@ -160,6 +175,7 @@ export async function runAppInitCommand(args) {
|
|
|
160
175
|
names,
|
|
161
176
|
description,
|
|
162
177
|
pipelineType: pipelineTypeFlag(args.flags),
|
|
178
|
+
artifactTemplate: artifactTemplateFlag({ flags: args.flags, kinds }),
|
|
163
179
|
});
|
|
164
180
|
printInitNextSteps({ appRoot, manifest });
|
|
165
181
|
return 0;
|
|
@@ -209,6 +225,7 @@ export async function runAppAddCommand({ kindArg, args, }) {
|
|
|
209
225
|
kind: kindArg,
|
|
210
226
|
name,
|
|
211
227
|
pipelineType: pipelineTypeFlag(args.flags),
|
|
228
|
+
artifactTemplate: artifactTemplateFlag({ flags: args.flags, kinds: [kindArg] }),
|
|
212
229
|
dependsOn,
|
|
213
230
|
});
|
|
214
231
|
console.log(`${LOG} added ${entry.kind} "${entry.id}" at ${entry.path}`);
|
package/dist/app/deploy.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { resolveContainedPrimitivePath } from './paths.js';
|
|
|
8
8
|
import { type ApplicationRegistration, type RegisterApplication } from './application-registration.js';
|
|
9
9
|
export { createDefaultDeployers } from './adapters.js';
|
|
10
10
|
import { type AppManifest, type PrimitiveEntry, type PrimitiveKind } from './manifest.js';
|
|
11
|
+
import { type EnvironmentBindingContext } from './env-bindings.js';
|
|
11
12
|
export type DeployPrimitiveArgs = {
|
|
12
13
|
entry: PrimitiveEntry;
|
|
13
14
|
/** Absolute path to the primitive directory. */
|
|
@@ -34,6 +35,8 @@ export type DeployAppOptions = {
|
|
|
34
35
|
waitTimeout?: string;
|
|
35
36
|
/** Registers a schema_version 3 app with Atlas after its primitives deploy. */
|
|
36
37
|
registerApplication?: RegisterApplication;
|
|
38
|
+
/** Resolves environment origins and workspace names. Tests inject this; deploys discover it. */
|
|
39
|
+
environmentBindings?: () => Promise<EnvironmentBindingContext>;
|
|
37
40
|
};
|
|
38
41
|
export type DeployAppResult = {
|
|
39
42
|
attempted: string[];
|
package/dist/app/deploy.js
CHANGED
|
@@ -9,6 +9,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
9
9
|
import { existsSync } from 'node:fs';
|
|
10
10
|
import { join, resolve } from 'node:path';
|
|
11
11
|
import { ensureAppOutputDirectory, resolveContainedPrimitivePath } from './paths.js';
|
|
12
|
+
import { agentComponentRefs } from './agent-refs.js';
|
|
12
13
|
export { resolveContainedPrimitivePath } from './paths.js';
|
|
13
14
|
import { executeDeployment } from './run-deployment.js';
|
|
14
15
|
import { buildApplicationDeployBody, logApplicationRegistration, registerApplicationWithAtlas, } from './application-registration.js';
|
|
@@ -19,6 +20,8 @@ import { localGitMetadata } from '@sequenceholdings/artifact-studio/source-resol
|
|
|
19
20
|
import { assertActiveDeployProvenance } from '@sequenceholdings/artifact-studio/active-deploy-policy';
|
|
20
21
|
export { createDefaultDeployers } from './adapters.js';
|
|
21
22
|
import { defaultDeployOrder, loadAppManifest, usesAppGraph, } from './manifest.js';
|
|
23
|
+
import { warnOnManifestRoles } from '../manifest-roles-notice.js';
|
|
24
|
+
import { assertAppEnvironmentBindings } from './env-bindings.js';
|
|
22
25
|
const LOG = '[seq-studio]';
|
|
23
26
|
const APP_MANIFEST_HINT = 'sequence.app.yml';
|
|
24
27
|
/**
|
|
@@ -27,7 +30,7 @@ const APP_MANIFEST_HINT = 'sequence.app.yml';
|
|
|
27
30
|
* fails the deploy. Never throws: the primitives have already deployed, so
|
|
28
31
|
* even a network or auth failure must reach the deployment report.
|
|
29
32
|
*/
|
|
30
|
-
async function registerApplicationStep({ manifest, options, result, }) {
|
|
33
|
+
async function registerApplicationStep({ manifest, options, result, rootDir, }) {
|
|
31
34
|
if (manifest.schema_version !== 3)
|
|
32
35
|
return;
|
|
33
36
|
if (result.exitCode !== 0) {
|
|
@@ -36,7 +39,8 @@ async function registerApplicationStep({ manifest, options, result, }) {
|
|
|
36
39
|
return;
|
|
37
40
|
}
|
|
38
41
|
const register = options.registerApplication ?? registerApplicationWithAtlas;
|
|
39
|
-
const
|
|
42
|
+
const agentRefs = await agentComponentRefs({ manifest, rootDir, env: options.env });
|
|
43
|
+
const registration = await register({ manifest, env: options.env, agentRefs }).catch((error) => ({
|
|
40
44
|
status: 'failed',
|
|
41
45
|
message: error instanceof Error ? error.message : String(error),
|
|
42
46
|
}));
|
|
@@ -83,7 +87,10 @@ function assertAppDeploymentSource({ manifest, options, rootDir, entries }) {
|
|
|
83
87
|
// Shared sources live outside the UI directory. Check the entire original
|
|
84
88
|
// app before packaging so ignored staging cannot conceal a dirty package.
|
|
85
89
|
if (usesAppGraph(manifest) && options.env !== 'local' && entries.some((entry) => entry.kind === 'artifact')) {
|
|
86
|
-
assertActiveDeployProvenance(
|
|
90
|
+
assertActiveDeployProvenance({
|
|
91
|
+
...localGitMetadata(rootDir),
|
|
92
|
+
environment: options.env,
|
|
93
|
+
});
|
|
87
94
|
}
|
|
88
95
|
if (usesAppGraph(manifest) && manifest.packages?.length && options.env !== 'local' && !options.dryRun && !existsSync(join(rootDir, 'pnpm-lock.yaml'))) {
|
|
89
96
|
throw new Error('App workspace deployment requires a root pnpm-lock.yaml. Run pnpm install at the app root and commit the lockfile before deploying.');
|
|
@@ -92,6 +99,7 @@ function assertAppDeploymentSource({ manifest, options, rootDir, entries }) {
|
|
|
92
99
|
export async function deployApp(options) {
|
|
93
100
|
const rootDir = resolve(options.rootDir);
|
|
94
101
|
const manifest = await loadAppManifest(rootDir);
|
|
102
|
+
await warnOnManifestRoles({ dir: rootDir, file: 'sequence.app.yml', kind: 'application' });
|
|
95
103
|
const entries = resolveDeployEntries({ manifest, only: options.only });
|
|
96
104
|
const onError = manifest.deploy.on_error;
|
|
97
105
|
const deployers = options.deployers ?? (await createDefaultDeployers());
|
|
@@ -109,6 +117,14 @@ export async function deployApp(options) {
|
|
|
109
117
|
console.log(`${LOG} - ${entry.kind.padEnd(9)} ${entry.id} (${entry.path})`);
|
|
110
118
|
}
|
|
111
119
|
assertAppDeploymentSource({ manifest, options, rootDir, entries });
|
|
120
|
+
await assertAppEnvironmentBindings({
|
|
121
|
+
manifest,
|
|
122
|
+
entries,
|
|
123
|
+
paths: resolvedPaths,
|
|
124
|
+
rootDir,
|
|
125
|
+
deployEnvironment: options.env,
|
|
126
|
+
...(options.environmentBindings ? { loadContext: options.environmentBindings } : {}),
|
|
127
|
+
});
|
|
112
128
|
const provenance = localGitMetadata(rootDir);
|
|
113
129
|
const prepared = usesAppGraph(manifest)
|
|
114
130
|
? await prepareAppWorkspace({ rootDir, manifest, entries, paths: resolvedPaths })
|
|
@@ -131,8 +147,8 @@ export async function deployApp(options) {
|
|
|
131
147
|
if (manifest.schema_version === 3) {
|
|
132
148
|
const body = buildApplicationDeployBody(manifest);
|
|
133
149
|
console.log(`${LOG} dry-run: would register Application "${manifest.app.id}" ` +
|
|
134
|
-
`(${body.members.length} member(s), ${Object.keys(body.
|
|
135
|
-
`${Object.keys(body.collaborators).length} collaborator role(s) to seed)`);
|
|
150
|
+
`(${body.members.length} member(s), ${Object.keys(body.capabilities).length} capability(ies), ` +
|
|
151
|
+
`${Object.keys(body.roles).length} role(s) and ${Object.keys(body.collaborators).length} collaborator role(s) to seed)`);
|
|
136
152
|
}
|
|
137
153
|
console.log(`${LOG} dry-run: no primitives deployed`);
|
|
138
154
|
return {
|
|
@@ -146,7 +162,7 @@ export async function deployApp(options) {
|
|
|
146
162
|
const reportDir = usesAppGraph(manifest)
|
|
147
163
|
? await ensureAppOutputDirectory({ rootDir, entryPath: '.sequence/deployments' }) : undefined;
|
|
148
164
|
const result = await executeDeployment({ entries, onError, deployers, argsFor });
|
|
149
|
-
await registerApplicationStep({ manifest, options, result });
|
|
165
|
+
await registerApplicationStep({ manifest, options, result, rootDir });
|
|
150
166
|
if (reportDir) {
|
|
151
167
|
result.reportPath = join(reportDir, `${encodeURIComponent(options.env)}.json`);
|
|
152
168
|
const temporaryReport = join(reportDir, `${randomUUID()}.tmp`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type NamedOrigin } from '@sequenceholdings/artifact-studio/deployment-validation';
|
|
2
|
+
import type { AppManifest, PrimitiveEntry } from './manifest.js';
|
|
3
|
+
export interface EnvironmentBindingContext {
|
|
4
|
+
deployOrigin: string;
|
|
5
|
+
origins: readonly NamedOrigin[];
|
|
6
|
+
resolveWorkspaceByName: (workspaceName: string) => Promise<string | undefined>;
|
|
7
|
+
workspaceExists: (workspaceId: string) => Promise<boolean>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolve `uses` workspace names and artifact `targets` in the selected
|
|
11
|
+
* environment, then refuse the deploy when source still points elsewhere.
|
|
12
|
+
* Apps with no scannable source and no workspace edges skip the lookup.
|
|
13
|
+
*/
|
|
14
|
+
export declare function assertAppEnvironmentBindings({ manifest, entries, paths, rootDir, deployEnvironment, loadContext, }: {
|
|
15
|
+
manifest: AppManifest;
|
|
16
|
+
entries: readonly PrimitiveEntry[];
|
|
17
|
+
paths: ReadonlyMap<string, string>;
|
|
18
|
+
rootDir: string;
|
|
19
|
+
deployEnvironment: string;
|
|
20
|
+
loadContext?: () => Promise<EnvironmentBindingContext>;
|
|
21
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { existsSync, lstatSync } from 'node:fs';
|
|
2
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
3
|
+
import { join, relative } from 'node:path';
|
|
4
|
+
import { assertNoCrossEnvironmentBindings, canonicalDeploymentOrigin, readArtifactStudioSource, } from '@sequenceholdings/artifact-studio/deployment-validation';
|
|
5
|
+
import { loadWorkspacePackages, packageClosure, readWorkspacePackage } from './workspace-model.js';
|
|
6
|
+
const SKIP_DIRS = new Set(['node_modules', '.git', 'dist', '.next', '.artifact-studio', 'coverage']);
|
|
7
|
+
const TEXT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs', '.json', '.yml', '.yaml']);
|
|
8
|
+
/**
|
|
9
|
+
* Resolve `uses` workspace names and artifact `targets` in the selected
|
|
10
|
+
* environment, then refuse the deploy when source still points elsewhere.
|
|
11
|
+
* Apps with no scannable source and no workspace edges skip the lookup.
|
|
12
|
+
*/
|
|
13
|
+
export async function assertAppEnvironmentBindings({ manifest, entries, paths, rootDir, deployEnvironment, loadContext, }) {
|
|
14
|
+
const files = [
|
|
15
|
+
...(await Promise.all(entries.map(async (entry) => {
|
|
16
|
+
const directory = paths.get(entry.id);
|
|
17
|
+
return directory ? primitiveBindingFiles({ entry, directory }) : [];
|
|
18
|
+
}))).flat(),
|
|
19
|
+
...await sharedPackageFiles({ rootDir, manifest, entries, paths }),
|
|
20
|
+
];
|
|
21
|
+
const workspaces = namedWorkspaces({ manifest, entries });
|
|
22
|
+
if (files.length === 0 && workspaces.length === 0)
|
|
23
|
+
return;
|
|
24
|
+
const context = await (loadContext ?? (() => defaultBindingContext(deployEnvironment)))();
|
|
25
|
+
const resolved = await Promise.all(workspaces.map(async (workspace) => ({
|
|
26
|
+
...workspace,
|
|
27
|
+
workspaceId: await context.resolveWorkspaceByName(workspace.workspaceName),
|
|
28
|
+
})));
|
|
29
|
+
await assertNoCrossEnvironmentBindings({
|
|
30
|
+
deployEnvironment,
|
|
31
|
+
deployOrigin: context.deployOrigin,
|
|
32
|
+
origins: context.origins,
|
|
33
|
+
workspaces: resolved,
|
|
34
|
+
files,
|
|
35
|
+
workspaceExists: context.workspaceExists,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function namedWorkspaces({ manifest, entries, }) {
|
|
39
|
+
const selected = new Set(entries.map((entry) => entry.id));
|
|
40
|
+
const byId = new Map(manifest.primitives.map((entry) => [entry.id, entry]));
|
|
41
|
+
const seen = new Set();
|
|
42
|
+
const workspaces = [];
|
|
43
|
+
for (const entry of manifest.primitives) {
|
|
44
|
+
if (!selected.has(entry.id))
|
|
45
|
+
continue;
|
|
46
|
+
for (const use of entry.uses) {
|
|
47
|
+
const target = byId.get(use.primitive);
|
|
48
|
+
if (target?.kind !== 'workspace' || !target.name || seen.has(target.name))
|
|
49
|
+
continue;
|
|
50
|
+
seen.add(target.name);
|
|
51
|
+
workspaces.push({
|
|
52
|
+
name: target.id,
|
|
53
|
+
workspaceName: target.name,
|
|
54
|
+
provisioned: selected.has(target.id),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return workspaces;
|
|
59
|
+
}
|
|
60
|
+
async function sharedPackageFiles({ rootDir, manifest, entries, paths, }) {
|
|
61
|
+
if (!manifest.packages?.length)
|
|
62
|
+
return [];
|
|
63
|
+
const packages = await loadWorkspacePackages({ rootDir, manifest });
|
|
64
|
+
const directories = new Map();
|
|
65
|
+
for (const entry of entries) {
|
|
66
|
+
const directory = paths.get(entry.id);
|
|
67
|
+
if (!directory || !existsSync(join(directory, 'package.json')))
|
|
68
|
+
continue;
|
|
69
|
+
const json = await readWorkspacePackage({ dir: directory });
|
|
70
|
+
for (const pkg of packageClosure({ json, packages })) {
|
|
71
|
+
directories.set(pkg.dir, pkg.path);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return (await Promise.all([...directories].map(([directory, label]) => readBindingFiles({ directory, label })))).flat();
|
|
75
|
+
}
|
|
76
|
+
async function primitiveBindingFiles({ entry, directory, }) {
|
|
77
|
+
if (entry.kind !== 'artifact' || !existsSync(join(directory, 'artifact.bundle.yml'))) {
|
|
78
|
+
return readBindingFiles({ directory, label: entry.path });
|
|
79
|
+
}
|
|
80
|
+
const source = await readArtifactStudioSource(directory);
|
|
81
|
+
return source.files.map((file) => ({
|
|
82
|
+
path: `${entry.path}/${file.path}`,
|
|
83
|
+
content: file.content,
|
|
84
|
+
...(file.encoding ? { encoding: file.encoding } : {}),
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
async function readBindingFiles({ directory, label, }) {
|
|
88
|
+
if (!existsSync(directory))
|
|
89
|
+
return [];
|
|
90
|
+
const files = [];
|
|
91
|
+
async function walk(current) {
|
|
92
|
+
const entries = await readdir(current, { withFileTypes: true });
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
if (entry.isSymbolicLink() || SKIP_DIRS.has(entry.name))
|
|
95
|
+
continue;
|
|
96
|
+
const absolute = join(current, entry.name);
|
|
97
|
+
if (entry.isDirectory()) {
|
|
98
|
+
await walk(absolute);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (!entry.isFile() || !isBindingText(entry.name))
|
|
102
|
+
continue;
|
|
103
|
+
const stat = lstatSync(absolute);
|
|
104
|
+
if (!stat.isFile() || stat.size > 2_000_000)
|
|
105
|
+
continue;
|
|
106
|
+
files.push({
|
|
107
|
+
path: `${label}/${relative(directory, absolute)}`,
|
|
108
|
+
content: await readFile(absolute, 'utf8'),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
await walk(directory);
|
|
113
|
+
return files;
|
|
114
|
+
}
|
|
115
|
+
function isBindingText(name) {
|
|
116
|
+
if (name === 'pnpm-lock.yaml' || name === 'package-lock.json' || name === 'yarn.lock' || name.endsWith('.md'))
|
|
117
|
+
return false;
|
|
118
|
+
if (name === '.env')
|
|
119
|
+
return true;
|
|
120
|
+
const extension = name.includes('.') ? name.slice(name.lastIndexOf('.')) : '';
|
|
121
|
+
return TEXT_EXTENSIONS.has(extension);
|
|
122
|
+
}
|
|
123
|
+
async function defaultBindingContext(envName) {
|
|
124
|
+
const { readConfig, resolveEnvWithDiscovery } = await import('../config.js');
|
|
125
|
+
const { getAccessTokenWithMode } = await import('../auth.js');
|
|
126
|
+
const { getJson, patchJson, postJson, putJson, deleteJson } = await import('../atlas-client.js');
|
|
127
|
+
const { storageClient } = await import('@sequenceholdings/storage');
|
|
128
|
+
const env = await resolveEnvWithDiscovery({ requested: envName });
|
|
129
|
+
const deployOrigin = canonicalDeploymentOrigin(env.url);
|
|
130
|
+
if (!deployOrigin)
|
|
131
|
+
throw new Error(`Invalid deployment URL '${env.url}'.`);
|
|
132
|
+
const config = await readConfig();
|
|
133
|
+
const origins = Object.entries(config.envs).flatMap(([name, value]) => {
|
|
134
|
+
const origin = canonicalDeploymentOrigin(value.url);
|
|
135
|
+
return origin ? [{ name, origin }] : [];
|
|
136
|
+
});
|
|
137
|
+
const { token } = await getAccessTokenWithMode({ env: env.name, targetUrl: env.url });
|
|
138
|
+
const client = storageClient({
|
|
139
|
+
async request(method, path, body) {
|
|
140
|
+
const options = { baseUrl: env.url, token, path, body };
|
|
141
|
+
switch (method) {
|
|
142
|
+
case 'GET': return getJson(options);
|
|
143
|
+
case 'POST': return postJson(options);
|
|
144
|
+
case 'PUT': return putJson(options);
|
|
145
|
+
case 'PATCH': return patchJson(options);
|
|
146
|
+
case 'DELETE': return deleteJson(options);
|
|
147
|
+
default: throw new Error(`Unsupported storage method ${method}`);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
deployOrigin,
|
|
153
|
+
origins,
|
|
154
|
+
resolveWorkspaceByName: (workspaceName) => findWorkspaceId({ client, workspaceName }),
|
|
155
|
+
workspaceExists: async (workspaceId) => {
|
|
156
|
+
try {
|
|
157
|
+
await client.workspace(workspaceId).get();
|
|
158
|
+
// A successful read is already limited to this API's storage environment.
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
if (isNotFound(error))
|
|
163
|
+
return false;
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async function findWorkspaceId({ client, workspaceName, }) {
|
|
170
|
+
let cursor;
|
|
171
|
+
for (let page = 0; page < 20; page += 1) {
|
|
172
|
+
const listed = await client.list({ q: workspaceName, limit: 100, cursor });
|
|
173
|
+
const match = listed.items.find((item) => item.name === workspaceName);
|
|
174
|
+
if (match)
|
|
175
|
+
return match.id;
|
|
176
|
+
if (!listed.nextCursor)
|
|
177
|
+
return undefined;
|
|
178
|
+
cursor = listed.nextCursor;
|
|
179
|
+
}
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
function isNotFound(error) {
|
|
183
|
+
return typeof error === 'object' && error !== null && 'status' in error && error.status === 404;
|
|
184
|
+
}
|
|
@@ -9,6 +9,7 @@ const COLLABORATOR_TIERS_BY_KIND = {
|
|
|
9
9
|
function: ['reader', 'editor'],
|
|
10
10
|
orm: ['reader', 'writer'],
|
|
11
11
|
process: ['editor'],
|
|
12
|
+
pipeline: ['viewer', 'operator', 'editor'],
|
|
12
13
|
};
|
|
13
14
|
/** v2 and v3 share the deployment graph (manifest.ts `usesAppGraph`; inlined to avoid an import cycle). */
|
|
14
15
|
const usesGraph = (manifest) => manifest.schema_version >= 2;
|
|
@@ -43,6 +44,10 @@ function validateRoles({ manifest, ctx }) {
|
|
|
43
44
|
// static grant can't express it. Apps reach storage as their own identity.
|
|
44
45
|
ctx.addIssue({ code: 'custom', message: "Application roles can't include workspace primitives — grant workspace access in Workspaces V2", path: at('includes', index, 'primitive') });
|
|
45
46
|
}
|
|
47
|
+
else if (kind === 'pipeline') {
|
|
48
|
+
// A pipeline runs as a service principal: nothing about it is "used" at runtime.
|
|
49
|
+
ctx.addIssue({ code: 'custom', message: "pipelines have no runtime access to bundle — give their viewer, operator or editor tier under collaborators", path: at('includes', index, 'primitive') });
|
|
50
|
+
}
|
|
46
51
|
else if (!ROLE_MEMBER_KINDS.has(kind)) {
|
|
47
52
|
ctx.addIssue({ code: 'custom', message: `Application roles can't include ${kind} primitives yet`, path: at('includes', index, 'primitive') });
|
|
48
53
|
}
|
|
@@ -84,6 +89,9 @@ function validateCollaborators({ manifest, ctx }) {
|
|
|
84
89
|
else if (!allowed.includes(include.tier)) {
|
|
85
90
|
ctx.addIssue({ code: 'custom', message: `${entry.kind} primitives offer ${allowed.join(', ')} — admin and owner stay direct grants`, path: at('includes', index, 'tier') });
|
|
86
91
|
}
|
|
92
|
+
else if (entry.kind === 'pipeline' && !entry.repo) {
|
|
93
|
+
ctx.addIssue({ code: 'custom', message: `set repo on "${entry.id}" so the role reaches its pipeline`, path: at('includes', index) });
|
|
94
|
+
}
|
|
87
95
|
else if (entry.kind === 'process' && entry.only?.length !== 1) {
|
|
88
96
|
ctx.addIssue({ code: 'custom', message: `set only: [<process-id>] on "${entry.id}" so the role reaches exactly one process`, path: at('includes', index) });
|
|
89
97
|
}
|