@sequenceholdings/studio-cli 0.1.26 → 0.1.28
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 +265 -81
- package/dist/app/adapters.d.ts +9 -0
- package/dist/app/adapters.js +176 -0
- package/dist/app/commands.d.ts +2 -2
- package/dist/app/commands.js +98 -22
- package/dist/app/deploy.d.ts +9 -10
- package/dist/app/deploy.js +83 -141
- package/dist/app/graph.d.ts +15 -0
- package/dist/app/graph.js +36 -0
- package/dist/app/manifest-validation.d.ts +16 -0
- package/dist/app/manifest-validation.js +99 -0
- package/dist/app/manifest.d.ts +27 -9
- package/dist/app/manifest.js +23 -107
- package/dist/app/paths.d.ts +14 -0
- package/dist/app/paths.js +77 -0
- package/dist/app/primitive-scaffold.d.ts +18 -0
- package/dist/app/primitive-scaffold.js +136 -0
- package/dist/app/readme.d.ts +4 -18
- package/dist/app/readme.js +107 -229
- package/dist/app/run-deployment.d.ts +8 -0
- package/dist/app/run-deployment.js +50 -0
- package/dist/app/scaffold-files.d.ts +13 -0
- package/dist/app/scaffold-files.js +68 -0
- package/dist/app/scaffold.d.ts +11 -3
- package/dist/app/scaffold.js +77 -245
- package/dist/app/workspace-compile.d.ts +18 -0
- package/dist/app/workspace-compile.js +143 -0
- package/dist/app/workspace-model.d.ts +70 -0
- package/dist/app/workspace-model.js +159 -0
- package/dist/app/workspace-scaffold.d.ts +27 -0
- package/dist/app/workspace-scaffold.js +126 -0
- package/dist/app/workspace.d.ts +14 -0
- package/dist/app/workspace.js +147 -0
- package/dist/atlas-client.js +28 -6
- package/dist/auth-cmds/commands.d.ts +1 -1
- package/dist/auth-cmds/commands.js +5 -2
- package/dist/functions/commands.js +7 -1
- package/dist/functions/manifest.d.ts +18 -0
- package/dist/functions/manifest.js +29 -4
- package/dist/main.js +9 -4
- package/dist/orm/delegate.js +30 -23
- package/dist/pat-hints.js +1 -0
- package/dist/pipeline/commands.js +27 -9
- package/dist/pipeline/lifecycle.d.ts +2 -0
- package/dist/pipeline/lifecycle.js +91 -11
- package/dist/process/build.js +59 -43
- package/dist/process/codegen.d.ts +3 -2
- package/dist/process/codegen.js +143 -27
- package/dist/process/commands.d.ts +2 -0
- package/dist/process/commands.js +63 -18
- package/dist/process/discover.d.ts +6 -3
- package/dist/process/discover.js +11 -3
- package/dist/process/lint.d.ts +14 -0
- package/dist/process/lint.js +143 -5
- package/dist/process/plan-diff.d.ts +8 -0
- package/dist/process/plan-diff.js +61 -4
- package/dist/process/safety-baseline.d.ts +154 -0
- package/dist/process/safety-baseline.js +387 -0
- package/dist/process/simulate.js +64 -22
- package/dist/repos/commands.d.ts +1 -1
- package/dist/repos/commands.js +29 -3
- package/package.json +8 -7
package/dist/app/readme.js
CHANGED
|
@@ -1,294 +1,172 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* README seeded by `seq-studio init` (and kept equivalent to the git-service
|
|
3
|
-
* createRepo initial commit). Third-party developers should be able to clone
|
|
4
|
-
* a new app repo and start building on Artifact Studio, the ORM, and
|
|
5
|
-
* Managed Functions without guessing the platform model.
|
|
6
|
-
*
|
|
7
|
-
* Keep in sync with atlas/src/server/services/git-service/initial-readme.ts.
|
|
8
|
-
*/
|
|
1
|
+
/** App README generated by init; git-service seed detection stays stable. */
|
|
9
2
|
import { titleizeSlug } from './manifest.js';
|
|
10
3
|
export const SEQUENCE_DOCS_URL = 'https://docs.seqholdings.com/';
|
|
11
|
-
/**
|
|
12
|
-
* Hidden marker written into the git-service createRepo README.
|
|
13
|
-
* `seq-studio init .` only overwrites a non-empty target when this is present,
|
|
14
|
-
* so an ordinary docs-only repository is not treated as a seed clone.
|
|
15
|
-
*
|
|
16
|
-
* Keep identical to atlas/src/server/services/git-service/initial-readme.ts.
|
|
17
|
-
*/
|
|
4
|
+
/** Keep identical to atlas/src/server/services/git-service/initial-readme.ts. */
|
|
18
5
|
export const GIT_SERVICE_SEED_MARKER = '<!-- seq-studio:git-service-seed -->';
|
|
19
6
|
export function isGitServiceSeedReadme(body) {
|
|
20
7
|
return body.includes(GIT_SERVICE_SEED_MARKER);
|
|
21
8
|
}
|
|
22
9
|
export const README_REQUIRED_SECTIONS = [
|
|
23
|
-
'https://docs.seqholdings.com/',
|
|
24
|
-
'
|
|
25
|
-
'ORM',
|
|
26
|
-
'Managed Function',
|
|
27
|
-
'seq-studio init',
|
|
28
|
-
'seq.functions.invoke',
|
|
10
|
+
'https://docs.seqholdings.com/', 'Artifact Studio', 'ORM', 'Managed Function',
|
|
11
|
+
'seq-studio init', 'seq.functions.invoke',
|
|
29
12
|
];
|
|
13
|
+
function primitivePath({ kind, appId, functionName }) {
|
|
14
|
+
switch (kind) {
|
|
15
|
+
case 'orm': return `orm/${appId.replace(/-/g, '_')}`;
|
|
16
|
+
case 'function': return `functions/${functionName}`;
|
|
17
|
+
case 'agent': return `agents/${appId}`;
|
|
18
|
+
case 'process': return `processes/${appId}`;
|
|
19
|
+
case 'pipeline': return `pipelines/${appId}`;
|
|
20
|
+
case 'artifact': return 'artifact';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const PRIMITIVE_LABELS = {
|
|
24
|
+
orm: 'ORM namespace', function: 'Managed Function', agent: 'Typed agent',
|
|
25
|
+
process: 'Lattice process', pipeline: 'Data Pipeline', artifact: 'Artifact Studio UI',
|
|
26
|
+
};
|
|
30
27
|
export function renderAppReadme(input) {
|
|
31
28
|
const title = input.title?.trim() || titleizeSlug(input.appId);
|
|
32
|
-
const description = input.description?.trim() ||
|
|
33
|
-
'A Sequence Platform app. Keep source in Git and deploy with seq-studio.';
|
|
29
|
+
const description = input.description?.trim() || 'A Sequence Platform app. Keep source in Git and deploy with seq-studio.';
|
|
34
30
|
const kinds = new Set(input.primitives);
|
|
35
31
|
const functionName = input.functionName ?? 'hello';
|
|
36
|
-
const
|
|
37
|
-
appId: input.appId,
|
|
38
|
-
|
|
39
|
-
functionName,
|
|
40
|
-
});
|
|
41
|
-
const primitiveRows = [
|
|
42
|
-
kinds.has('artifact')
|
|
43
|
-
? '| **Artifact Studio** | Frontend | `artifact/` — React UI + `artifact.bundle.yml` |'
|
|
44
|
-
: null,
|
|
45
|
-
kinds.has('orm')
|
|
46
|
-
? `| **ORM** | Data | \`orm/${snake(input.appId)}/\` — tables, policies, named GraphQL operations |`
|
|
47
|
-
: null,
|
|
48
|
-
kinds.has('function')
|
|
49
|
-
? `| **Managed Function** | Backend | \`functions/${functionName}/\` — TypeScript handler + \`managed-function.yml\` |`
|
|
50
|
-
: null,
|
|
51
|
-
]
|
|
52
|
-
.filter((row) => row !== null)
|
|
53
|
-
.join('\n');
|
|
32
|
+
const locations = input.primitives.map((kind) => ({
|
|
33
|
+
kind, path: primitivePath({ kind, appId: input.appId, functionName }),
|
|
34
|
+
}));
|
|
54
35
|
return `# ${title}
|
|
55
36
|
|
|
56
37
|
${description}
|
|
57
38
|
|
|
58
|
-
This
|
|
59
|
-
|
|
60
|
-
**Platform documentation:** [${SEQUENCE_DOCS_URL}](${SEQUENCE_DOCS_URL})
|
|
61
|
-
|
|
62
|
-
You still need an environment name, an Atlas URL, and resource grants from your platform administrator before Preview or deploy. Login proves identity; it does not grant every action.
|
|
39
|
+
This repository is a **seq-studio app bundle**. Its root \`sequence.app.yml\` defines the app's deployable primitives, source locations, and deployment prerequisites. Keep this file, shared packages, primitive manifests, and the root lockfile together in Git.
|
|
63
40
|
|
|
64
|
-
|
|
41
|
+
**Platform documentation:** [Sequence Platform](${SEQUENCE_DOCS_URL})
|
|
65
42
|
|
|
66
|
-
|
|
43
|
+
## What this repository contains
|
|
67
44
|
|
|
68
|
-
\`\`\`
|
|
69
|
-
${
|
|
45
|
+
\`\`\`text
|
|
46
|
+
${input.appId}/
|
|
47
|
+
sequence.app.yml app deployment graph + shared package declarations
|
|
48
|
+
package.json app workspace scripts and CLI version
|
|
49
|
+
pnpm-workspace.yaml package membership and install policy
|
|
50
|
+
packages/shared/ @${input.appId}/shared
|
|
51
|
+
${locations.map(({ kind, path }) => ` ${path}/ ${PRIMITIVE_LABELS[kind]}`).join('\n')}
|
|
70
52
|
\`\`\`
|
|
71
53
|
|
|
72
|
-
|
|
54
|
+
\`seq-studio init\` creates the bundle; \`seq-studio add <kind> <name>\` adds another primitive. All six kinds can be added more than once. Additional Artifact Studio UIs live under \`artifacts/<name>/\`; the initial UI lives in \`artifact/\`.
|
|
73
55
|
|
|
74
|
-
|
|
75
|
-
| --- | --- | --- |
|
|
76
|
-
${primitiveRows}
|
|
56
|
+
## Platform primitives
|
|
77
57
|
|
|
78
|
-
|
|
58
|
+
| Primitive | What you author | What the platform runs |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| **ORM** | TypeScript tables, policies, named GraphQL operations | Governed Data API and schema migrations |
|
|
61
|
+
| **Managed Function** | TypeScript handler + \`managed-function.yml\` | Server-side code with declared secrets and egress |
|
|
62
|
+
| **Typed agent** | \`agent.ts\` using \`defineAgent(...)\` | Agents-api conversation and task runtime |
|
|
63
|
+
| **Lattice process** | \`process.ts\` definitions | Workflow graphs and human review steps |
|
|
64
|
+
| **Data Pipeline** | \`*.stage.yml\` and transformation source | Databricks ingestion, transformation, and serving jobs |
|
|
65
|
+
| **Artifact Studio** | React UI + \`artifact.bundle.yml\` | Sandboxed browser app inside Atlas |
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
The app manifest composes these primitives. Each primitive's own definition still controls its runtime behavior, permissions, and capabilities. Secret values belong in the platform's Managed Secrets, never in the app manifest or a shared package.
|
|
81
68
|
|
|
82
|
-
|
|
69
|
+
## Install and authenticate
|
|
83
70
|
|
|
84
|
-
|
|
85
|
-
| --- | --- | --- | --- |
|
|
86
|
-
| **Artifact Studio** | Frontend | React UI + \`artifact.bundle.yml\` | Sandboxed browser app inside Atlas |
|
|
87
|
-
| **ORM** | Data | TypeScript tables, row policies, named GraphQL operations | Governed Data API in front of Postgres (you never open a connection) |
|
|
88
|
-
| **Managed Function** | Backend | TypeScript handler + \`managed-function.yml\` | Server-side code with declared secrets, egress, and invoke permissions |
|
|
71
|
+
Use Node.js 20 or later and pnpm 10.28.2. Ask your platform administrator for your environment name, Atlas URL, and the grants needed to create or update this app's resources.
|
|
89
72
|
|
|
90
|
-
\`\`\`
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
└──► Managed Function secrets, egress, work that must not run in the browser
|
|
73
|
+
\`\`\`bash
|
|
74
|
+
corepack enable
|
|
75
|
+
corepack prepare pnpm@10.28.2 --activate
|
|
76
|
+
pnpm install
|
|
77
|
+
seq-studio envs add <environment-name> <atlas-url>
|
|
78
|
+
seq-studio login --env <environment-name>
|
|
79
|
+
seq-studio doctor -e <environment-name>
|
|
98
80
|
\`\`\`
|
|
99
81
|
|
|
100
|
-
|
|
82
|
+
Run \`pnpm install\` **once from the app root**. Commit the generated root \`pnpm-lock.yaml\`; CI uses \`pnpm install --frozen-lockfile\`. App scaffolding consolidates the standalone templates' install configuration at the root. The root workspace retains the seven-day dependency age gate and explicit build-script allowlist.
|
|
101
83
|
|
|
102
|
-
|
|
84
|
+
Use the environment name your administrator supplies. \`local\` means a real Atlas server at \`http://localhost:5001\`, not a standalone Vite server. Login proves identity; resource permissions are still required. ORM and pipeline commands require the matching \`@sequenceholdings/orm\` / \`@sequenceholdings/pipeline-spec\` SDK installed alongside the CLI.
|
|
103
85
|
|
|
104
|
-
|
|
86
|
+
## Shared packages
|
|
105
87
|
|
|
106
|
-
|
|
88
|
+
Export common types, validation, and helpers from \`packages/shared/src/index.ts\`. JavaScript primitives depend on \`@${input.appId}/shared\` through \`workspace:*\`; ordinary imports work across the app:
|
|
107
89
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| [Basketball player lookup](${SEQUENCE_DOCS_URL}examples/basketball-player-lookup) | Artifact + Function + Secret | UI that calls protected server-side code |
|
|
112
|
-
| \`seq-studio init --with orm,function,artifact\` | All three | The intended app shape, once the ORM package is available (see below) |
|
|
90
|
+
\`\`\`ts
|
|
91
|
+
import { /* your exports */ } from '@${input.appId}/shared'
|
|
92
|
+
\`\`\`
|
|
113
93
|
|
|
114
|
-
|
|
94
|
+
Create another shared package with \`seq-studio add package contracts\`, then add it to a consumer using pnpm:
|
|
115
95
|
|
|
116
|
-
|
|
96
|
+
\`\`\`bash
|
|
97
|
+
pnpm --filter @${input.appId}/primitive-<primitive-id> add '@${input.appId}/contracts@workspace:*'
|
|
98
|
+
\`\`\`
|
|
117
99
|
|
|
118
|
-
|
|
100
|
+
Declare every shared package's \`name\` and \`path\` under \`packages\` in \`sequence.app.yml\`. Shared packages are build inputs; they are not separately deployed resources. Agent definitions compile to declarative data; they do not run imported helper functions at runtime. Lattice mapper closures cannot capture arbitrary shared executable code. Put shared runtime business logic in a managed function and reference that primitive from the workflow. App deployment prepares self-contained function and artifact sources so local workspace paths do not escape the deployed bundle. To share packages across app repositories, publish versioned packages and use pinned registry dependencies.
|
|
119
101
|
|
|
120
|
-
|
|
102
|
+
## Implement this app
|
|
121
103
|
|
|
122
|
-
|
|
123
|
-
2. **Atlas URL** — the origin used with \`seq-studio envs add\`. It is not docs.seqholdings.com. The CLI discovers login config at \`{url}/api/auth/cli-config\`.
|
|
124
|
-
3. **What you should create** — new Artifact Studio project, new function, new ORM namespace, or updates to existing ones.
|
|
125
|
-
4. **Grants** — create/deploy an artifact; runtime access to open the deployed UI; create/deploy/invoke a function; create secrets if you need them; apply an ORM namespace if you will persist data; permission to **share** the artifact (scaffolds create \`visibility: private\`, and a later deploy will not change that).
|
|
126
|
-
5. **\`@sequenceholdings/orm\` v2** — \`seq-studio init --with orm\` and namespace \`package.json\` files depend on \`@sequenceholdings/orm@^2.0.0\`, which is **not published**. Public npm's latest is a v1 package. Without a v2 tarball you can still ship Artifact + Function apps.
|
|
104
|
+
${renderImplementSection({ appId: input.appId, functionName, kinds })}
|
|
127
105
|
|
|
128
|
-
|
|
106
|
+
## Define deployment prerequisites
|
|
129
107
|
|
|
130
|
-
|
|
108
|
+
Set a primitive's \`depends_on\` to the IDs that must deploy successfully before it. Use the app's primitive IDs here; agent runtime IDs and process IDs stay in their typed definitions. For example, a workflow that invokes the agent should depend on that agent primitive:
|
|
131
109
|
|
|
132
|
-
|
|
110
|
+
\`\`\`bash
|
|
111
|
+
seq-studio add agent reviewer
|
|
112
|
+
seq-studio add process approvals --depends-on reviewer-agent
|
|
113
|
+
\`\`\`
|
|
133
114
|
|
|
134
|
-
|
|
135
|
-
| --- | --- |
|
|
136
|
-
| Node.js | 20 or later (22 is the documented baseline) |
|
|
137
|
-
| pnpm | 10.28.2 |
|
|
138
|
-
| Git | Required for official Artifact Studio deploys |
|
|
139
|
-
| \`seq-studio\` | \`@sequenceholdings/studio-cli\` (match \`studio.min_cli\` in \`sequence.app.yml\`) |
|
|
115
|
+
Version 2 derives a deterministic order from this graph. An optional \`deploy.order\` only prioritizes primitives whose prerequisites are ready. \`--only <id>\` includes that primitive's prerequisites. \`deploy.on_error: stop\` stops on failure; \`continue\` runs independent primitives and skips dependents of failed or skipped prerequisites. Deployment is not an atomic transaction: already successful primitives remain deployed if a later one fails. Removing an entry does not delete its deployed resource.
|
|
140
116
|
|
|
141
|
-
|
|
142
|
-
corepack enable
|
|
143
|
-
corepack prepare pnpm@10.28.2 --activate
|
|
144
|
-
pnpm setup # once; restart the terminal afterwards
|
|
145
|
-
pnpm add -g @sequenceholdings/studio-cli
|
|
146
|
-
seq-studio version
|
|
117
|
+
Version 2 preflight validates and compiles the selected sources before deployment. Pipeline preflight reads the remote repository and pins its commit, so its dry run requires network access and authentication. Results are saved under \`.sequence/deployments/<encoded-env>.json\`.
|
|
147
118
|
|
|
148
|
-
|
|
149
|
-
seq-studio login --env <environment-name>
|
|
150
|
-
seq-studio artifact list -e <environment-name>
|
|
151
|
-
seq-studio functions list -e <environment-name>
|
|
152
|
-
seq-studio doctor -e <environment-name>
|
|
153
|
-
\`\`\`
|
|
119
|
+
Review and deploy from this directory:
|
|
154
120
|
|
|
155
|
-
|
|
121
|
+
\`\`\`bash
|
|
122
|
+
seq-studio deploy -e <environment-name> --dry-run
|
|
123
|
+
seq-studio deploy -e <environment-name> --yes
|
|
124
|
+
\`\`\`
|
|
156
125
|
|
|
157
|
-
|
|
126
|
+
## Runtime boundaries
|
|
158
127
|
|
|
159
|
-
|
|
128
|
+
- **Artifact Studio** runs in a sandbox. Declare every table, operation, function, and API path under the artifact's capabilities. Invoke functions with \`seq.functions.invoke('<slug>', body)\`. Keep secrets and privileged logic server-side.
|
|
129
|
+
- **Managed Functions** declare secret names and outbound hosts in \`managed-function.yml\`. Keep local values in ignored \`.env\` files.
|
|
130
|
+
- **ORM** policies enforce caller access. Change TypeScript schema and operations, then generate migrations; do not edit generated migrations by hand.
|
|
131
|
+
- **Agent and process identities** are durable. Keep the generated identities stable when changing implementation; generate new identities when copying a resource.
|
|
132
|
+
- **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.
|
|
160
133
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Everyday loop
|
|
164
|
-
|
|
165
|
-
| You want to… | Command |
|
|
166
|
-
| --- | --- |
|
|
167
|
-
| Validate / build an artifact | \`seq-studio artifact validate artifact\` / \`artifact build artifact\` |
|
|
168
|
-
| Preview uncommitted UI | \`seq-studio artifact dev artifact -e <env>\` |
|
|
169
|
-
| Official UI deploy | \`seq-studio artifact deploy artifact -e <env>\` from clean \`main\` |
|
|
170
|
-
| Build / deploy a function | \`seq-studio functions build --dir functions/<name>\` then \`functions deploy --dir … -e <env>\` |
|
|
171
|
-
| Function logs | \`seq-studio functions logs --fn <slug> -e <env>\` |
|
|
172
|
-
| Apply an ORM namespace | \`seq-studio orm apply orm/<namespace> -e <env>\` |
|
|
173
|
-
| Deploy every primitive | \`seq-studio deploy -e <env>\` from this directory |
|
|
174
|
-
|
|
175
|
-
Official Artifact Studio deploys require a **clean \`main\`** with a committed revision. Uncommitted work is Preview (\`artifact dev\`). Open the URL the CLI prints.
|
|
176
|
-
|
|
177
|
-
## Rules that waste a day if you skip them
|
|
178
|
-
|
|
179
|
-
- **Manifests are the authorization surface.** A new \`seq.api\` call, ORM mutation, secret, or outbound host in source is not enough. Update \`artifact.bundle.yml\` or \`managed-function.yml\` and validate again.
|
|
180
|
-
- **Never commit secret values.** \`.env\` is gitignored. Never put secrets in the artifact — that bundle is browser code.
|
|
181
|
-
- **Delete the Chainguard \`.npmrc\`** in a new function unless you have Sequence-internal registry credentials. Without them \`pnpm install\` 401s. Removing the file is the supported public path.
|
|
182
|
-
- **Invoke functions with \`seq.functions.invoke('<slug>', body)\`**, not a raw \`seq.api.post\` to \`/api/managed-functions/…\`. Declare the slug under \`capabilities.functions.invoke\`.
|
|
183
|
-
- **Atlas wraps many \`seq.api\` responses** as \`{ success, data }\`. Use the scaffold \`unwrap\` helper. \`seq.functions.invoke\` is already the payload.
|
|
184
|
-
- **Do not reuse another app's identities.** If you copy files, change \`app.id\`, every primitive \`id\`, the ORM \`namespace\`, the artifact \`project_id\`, capability paths, and \`targets\`.
|
|
185
|
-
- **Do not edit ORM \`migrations/\`.** Change \`schema/*.ts\` / \`graphql/**/*.ts\`, then generate/apply.
|
|
186
|
-
- **Do not hardcode user emails** in policies or UI. Use \`claim('sub')\` / \`claim('org')\` and the Permissions / sharing UI.
|
|
187
|
-
|
|
188
|
-
## Further reading
|
|
189
|
-
|
|
190
|
-
- [Sequence Platform docs](${SEQUENCE_DOCS_URL})
|
|
191
|
-
- [Create your first project](${SEQUENCE_DOCS_URL}projects/create-first-project)
|
|
192
|
-
- [Artifact Studio](${SEQUENCE_DOCS_URL}artifact-studio/overview)
|
|
193
|
-
- [Managed Functions](${SEQUENCE_DOCS_URL}managed-functions/overview)
|
|
194
|
-
- [Managed Secrets](${SEQUENCE_DOCS_URL}managed-secrets/overview)
|
|
195
|
-
- [Basketball player lookup](${SEQUENCE_DOCS_URL}examples/basketball-player-lookup)
|
|
196
|
-
- [CLI command reference](${SEQUENCE_DOCS_URL}seq-studio/commands)
|
|
197
|
-
- [Troubleshooting](${SEQUENCE_DOCS_URL}troubleshooting)
|
|
134
|
+
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).
|
|
198
135
|
`;
|
|
199
136
|
}
|
|
200
|
-
|
|
201
|
-
export function renderEmptyRepoReadme({ repoName, namespaceSlug, }) {
|
|
202
|
-
const title = titleizeSlug(repoName);
|
|
137
|
+
export function renderEmptyRepoReadme({ repoName, namespaceSlug }) {
|
|
203
138
|
const qualified = namespaceSlug ? `${namespaceSlug}/${repoName}` : repoName;
|
|
204
139
|
return `${GIT_SERVICE_SEED_MARKER}\n${renderAppReadme({
|
|
205
140
|
appId: repoName,
|
|
206
|
-
|
|
207
|
-
description: `Sequence Platform git-service repository \`${qualified}\`. Scaffold an app in this clone with \`seq-studio init\`, then validate and deploy with the same CLI.`,
|
|
141
|
+
description: `Sequence Platform git-service repository \`${qualified}\`. Scaffold an app in this clone, then validate and deploy with seq-studio.`,
|
|
208
142
|
primitives: ['orm', 'function', 'artifact'],
|
|
209
|
-
functionName: 'hello',
|
|
210
143
|
}).replace('## Implement this app', `## Scaffold the app
|
|
211
144
|
|
|
212
|
-
|
|
145
|
+
From this clone's root:
|
|
213
146
|
|
|
214
147
|
\`\`\`bash
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
#
|
|
218
|
-
# seq-studio init . --with orm,function,artifact --function-name hello
|
|
148
|
+
seq-studio init . --with function,artifact --function-name hello
|
|
149
|
+
# Include other primitives as needed:
|
|
150
|
+
# seq-studio init . --with orm,function,agent,process,pipeline,artifact
|
|
219
151
|
\`\`\`
|
|
220
152
|
|
|
221
|
-
\`init\`
|
|
153
|
+
\`init\` replaces this seed README and creates the app workspace while preserving the git remote. It refuses to overwrite ordinary docs-only repositories.
|
|
222
154
|
|
|
223
155
|
## Implement this app`)}`;
|
|
224
156
|
}
|
|
225
|
-
function
|
|
226
|
-
return appId.replace(/-/g, '_');
|
|
227
|
-
}
|
|
228
|
-
function renderAppTree({ appId, kinds, functionName, }) {
|
|
229
|
-
const lines = [
|
|
230
|
-
`${appId}/`,
|
|
231
|
-
' README.md',
|
|
232
|
-
' sequence.app.yml primitives + deploy order',
|
|
233
|
-
];
|
|
234
|
-
if (kinds.has('artifact')) {
|
|
235
|
-
lines.push(' artifact/ Artifact Studio UI');
|
|
236
|
-
}
|
|
237
|
-
if (kinds.has('orm')) {
|
|
238
|
-
lines.push(` orm/${snake(appId)}/ ORM namespace`);
|
|
239
|
-
}
|
|
240
|
-
if (kinds.has('function')) {
|
|
241
|
-
lines.push(` functions/${functionName}/ Managed Function`);
|
|
242
|
-
}
|
|
243
|
-
return lines.join('\n');
|
|
244
|
-
}
|
|
245
|
-
function renderImplementSection({ kinds, functionName, appId, }) {
|
|
157
|
+
function renderImplementSection({ kinds, functionName, appId }) {
|
|
246
158
|
const steps = [];
|
|
247
|
-
if (kinds.has('function'))
|
|
248
|
-
steps.push(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
Grant the artifact matching \`capabilities.data\` entries (\`<namespace>/<table>\` for reads, \`<namespace>/ops/<MutationName>\` for named writes) and the Data API paths you call.`);
|
|
262
|
-
}
|
|
263
|
-
if (kinds.has('artifact')) {
|
|
264
|
-
const n = steps.length + 1;
|
|
265
|
-
steps.push(`${n}. **UI** — \`artifact/src/App.tsx\` with \`@sequenceholdings/atlas-ui\`. Delete the scaffold's \`alert()\` Atlas ping; native \`alert\` / \`confirm\` / \`prompt\` are blocked in the sandbox.
|
|
266
|
-
|
|
267
|
-
If this app has a function, declare it and invoke it:
|
|
268
|
-
|
|
269
|
-
\`\`\`yaml
|
|
270
|
-
capabilities:
|
|
271
|
-
functions:
|
|
272
|
-
invoke:
|
|
273
|
-
- ${functionName}
|
|
274
|
-
\`\`\`
|
|
275
|
-
|
|
276
|
-
\`\`\`ts
|
|
277
|
-
import { seq } from './lib/api'
|
|
278
|
-
const result = await seq.functions.invoke('${functionName}', { /* input */ })
|
|
279
|
-
\`\`\`
|
|
280
|
-
|
|
281
|
-
\`pnpm dev\` in \`artifact/\` is standalone Vite. Platform calls only work inside Preview or an official Atlas deployment.`);
|
|
282
|
-
}
|
|
283
|
-
steps.push(`${steps.length + 1}. **Targets** — put your environment in \`artifact.bundle.yml\` \`targets\` (if this app has an artifact). Scaffolds create \`visibility: private\`. Set \`shared\` before first create if other people must open the app.
|
|
284
|
-
|
|
285
|
-
${steps.length + 2}. **Validate, then deploy** from this directory:
|
|
286
|
-
|
|
287
|
-
\`\`\`bash
|
|
288
|
-
seq-studio deploy -e <environment-name> --dry-run
|
|
289
|
-
seq-studio deploy -e <environment-name> --yes
|
|
290
|
-
\`\`\`
|
|
291
|
-
|
|
292
|
-
\`--dry-run\` lists which primitives would run. Until \`git status\` is clean on \`main\`, use \`seq-studio artifact dev artifact -e <environment-name>\` for the UI.`);
|
|
293
|
-
return steps.join('\n\n');
|
|
159
|
+
if (kinds.has('function'))
|
|
160
|
+
steps.push(`- **Function:** implement \`functions/${functionName}/index.ts\`; declare egress and secret names in \`managed-function.yml\`.`);
|
|
161
|
+
if (kinds.has('orm'))
|
|
162
|
+
steps.push(`- **ORM:** author tables and operations under \`orm/${appId.replace(/-/g, '_')}/\`, then run \`seq-studio orm generate orm/${appId.replace(/-/g, '_')}\` and \`seq-studio orm diff orm/${appId.replace(/-/g, '_')}\`. Review and commit the generated \`migrations/\` ledger before the first deployment and after schema changes. Init creates namespace source; it does not create the migration baseline automatically.`);
|
|
163
|
+
if (kinds.has('agent'))
|
|
164
|
+
steps.push(`- **Agent:** edit \`agents/${appId}/agent.ts\`; run \`seq-studio agents validate --dir agents/${appId}\`.`);
|
|
165
|
+
if (kinds.has('process'))
|
|
166
|
+
steps.push(`- **Lattice:** edit \`processes/${appId}/${appId}/process.ts\`; run \`seq-studio process lint --dir processes/${appId} --offline\`.`);
|
|
167
|
+
if (kinds.has('pipeline'))
|
|
168
|
+
steps.push(`- **Pipeline:** complete \`pipelines/${appId}/${appId}.stage.yml\` and its source; run \`seq-studio pipeline validate pipelines/${appId}\`. The template is a transformation stage by default; \`--pipeline-type\` selects ingestion or serving. Pipeline deployment uses a platform git-service release unit: set this primitive's \`repo: pipelines/<repository>\` and \`ref\` in \`sequence.app.yml\`, and commit/push its source to that repository before deployment. A serving template also requires a real producing stage.`);
|
|
169
|
+
if (kinds.has('artifact'))
|
|
170
|
+
steps.push(`- **UI:** implement \`artifact/src/App.tsx\` with \`@sequenceholdings/atlas-ui\`; declare capabilities and deployment \`targets\` in \`artifact.bundle.yml\`. Scaffolds are private; set sharing intentionally. Validate with \`seq-studio artifact validate artifact\`.`);
|
|
171
|
+
return steps.join('\n');
|
|
294
172
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DeployAppResult, DeployPrimitiveArgs, PrimitiveDeployers } from './deploy.js';
|
|
2
|
+
import type { PrimitiveEntry } from './manifest.js';
|
|
3
|
+
export declare function executeDeployment({ entries, onError, deployers, argsFor }: {
|
|
4
|
+
entries: readonly PrimitiveEntry[];
|
|
5
|
+
onError: 'stop' | 'continue';
|
|
6
|
+
deployers: PrimitiveDeployers;
|
|
7
|
+
argsFor: (entry: PrimitiveEntry) => DeployPrimitiveArgs;
|
|
8
|
+
}): Promise<DeployAppResult>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const LOG = '[seq-studio]';
|
|
2
|
+
export async function executeDeployment({ entries, onError, deployers, argsFor }) {
|
|
3
|
+
const attempted = [];
|
|
4
|
+
const succeeded = [];
|
|
5
|
+
const failed = [];
|
|
6
|
+
const skipped = [];
|
|
7
|
+
/** Failed or dependency-skipped ids — blocks transitive `depends_on` edges. */
|
|
8
|
+
const unavailable = new Set();
|
|
9
|
+
let stop = false;
|
|
10
|
+
for (const entry of entries) {
|
|
11
|
+
if (stop) {
|
|
12
|
+
skipped.push(entry.id);
|
|
13
|
+
unavailable.add(entry.id);
|
|
14
|
+
console.log(`${LOG} skip ${entry.id} (stopped after earlier failure)`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const blockedBy = entry.depends_on.filter((id) => unavailable.has(id));
|
|
18
|
+
if (blockedBy.length > 0) {
|
|
19
|
+
skipped.push(entry.id);
|
|
20
|
+
unavailable.add(entry.id);
|
|
21
|
+
console.log(`${LOG} skip ${entry.id} (depends on failed/skipped: ${blockedBy.join(', ')})`);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
attempted.push(entry.id);
|
|
25
|
+
console.log(`${LOG} → ${entry.kind} ${entry.id}`);
|
|
26
|
+
let code;
|
|
27
|
+
try {
|
|
28
|
+
code = await deployers[entry.kind](argsFor(entry));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
+
console.error(`${LOG} ${entry.id} threw: ${message}`);
|
|
33
|
+
code = 1;
|
|
34
|
+
}
|
|
35
|
+
if (code === 0) {
|
|
36
|
+
succeeded.push(entry.id);
|
|
37
|
+
console.log(`${LOG} ✓ ${entry.id}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
failed.push(entry.id);
|
|
41
|
+
unavailable.add(entry.id);
|
|
42
|
+
console.error(`${LOG} ✗ ${entry.id} exited ${code}`);
|
|
43
|
+
if (onError === 'stop')
|
|
44
|
+
stop = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const exitCode = failed.length > 0 ? 1 : 0;
|
|
48
|
+
console.log(`${LOG} deploy finished: ${succeeded.length} ok, ${failed.length} failed, ${skipped.length} skipped`);
|
|
49
|
+
return { attempted, succeeded, failed, skipped, exitCode };
|
|
50
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function mergeGitignore(existing: string | null): string;
|
|
2
|
+
interface ScaffoldSnapshot {
|
|
3
|
+
existed: boolean;
|
|
4
|
+
previousReadme: string | null;
|
|
5
|
+
previousGitignore: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function inspectScaffoldTarget(appRoot: string): Promise<ScaffoldSnapshot>;
|
|
8
|
+
export declare function rollbackAppScaffold({ appRoot, snapshot, paths }: {
|
|
9
|
+
appRoot: string;
|
|
10
|
+
snapshot: ScaffoldSnapshot;
|
|
11
|
+
paths: readonly string[];
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** Protect existing repository content and roll back only generated scaffold files. */
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { isGitServiceSeedReadme } from './readme.js';
|
|
6
|
+
import { WORKSPACE_ROOT_FILES } from './workspace-scaffold.js';
|
|
7
|
+
const INIT_METADATA_ONLY = new Set(['.git', '.gitattributes', '.DS_Store']);
|
|
8
|
+
const INIT_ALLOWED_EXISTING = new Set([
|
|
9
|
+
...INIT_METADATA_ONLY, '.gitignore', 'README.md', 'LICENSE', 'LICENSE.md',
|
|
10
|
+
]);
|
|
11
|
+
const DEFAULT_GITIGNORE_LINES = [
|
|
12
|
+
'node_modules/', 'dist/', '.env', '.env.*', '!.env.example', '.DS_Store',
|
|
13
|
+
'*.log', '.sequence/deployments/', '.sequence/builds/',
|
|
14
|
+
];
|
|
15
|
+
export function mergeGitignore(existing) {
|
|
16
|
+
if (existing === null)
|
|
17
|
+
return `${DEFAULT_GITIGNORE_LINES.join('\n')}\n`;
|
|
18
|
+
const present = new Set(existing.split(/\r?\n/).map((line) => line.trim()));
|
|
19
|
+
const missing = DEFAULT_GITIGNORE_LINES.filter((line) => !present.has(line));
|
|
20
|
+
const base = existing.endsWith('\n') ? existing : `${existing}\n`;
|
|
21
|
+
return missing.length === 0 ? base : `${base}${missing.join('\n')}\n`;
|
|
22
|
+
}
|
|
23
|
+
export async function inspectScaffoldTarget(appRoot) {
|
|
24
|
+
if (existsSync(join(appRoot, 'sequence.app.yml'))) {
|
|
25
|
+
throw new Error(`${join(appRoot, 'sequence.app.yml')} already exists — refusing to re-init`);
|
|
26
|
+
}
|
|
27
|
+
const existed = existsSync(appRoot);
|
|
28
|
+
const entries = existed ? await readdir(appRoot) : [];
|
|
29
|
+
if (entries.some((name) => !INIT_ALLOWED_EXISTING.has(name))) {
|
|
30
|
+
throw new Error(`${appRoot} is not empty — init into a new directory or a git-service clone whose README contains the seq-studio seed marker`);
|
|
31
|
+
}
|
|
32
|
+
const previousReadme = existsSync(join(appRoot, 'README.md'))
|
|
33
|
+
? await readFile(join(appRoot, 'README.md'), 'utf8') : null;
|
|
34
|
+
if (entries.some((name) => !INIT_METADATA_ONLY.has(name))) {
|
|
35
|
+
if (previousReadme === null) {
|
|
36
|
+
throw new Error(`${appRoot} is not empty — a git-service clone must have a README.md containing the seq-studio seed marker`);
|
|
37
|
+
}
|
|
38
|
+
if (!isGitServiceSeedReadme(previousReadme)) {
|
|
39
|
+
throw new Error(`${appRoot} already has a README.md that is not a git-service seed — refusing to overwrite it`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const previousGitignore = existsSync(join(appRoot, '.gitignore'))
|
|
43
|
+
? await readFile(join(appRoot, '.gitignore'), 'utf8') : null;
|
|
44
|
+
return { existed, previousReadme, previousGitignore };
|
|
45
|
+
}
|
|
46
|
+
export async function rollbackAppScaffold({ appRoot, snapshot, paths }) {
|
|
47
|
+
if (!snapshot.existed) {
|
|
48
|
+
await rm(appRoot, { recursive: true, force: true }).catch(() => { });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const generated = new Set([
|
|
52
|
+
'sequence.app.yml', ...WORKSPACE_ROOT_FILES,
|
|
53
|
+
...paths.map((path) => path.split('/')[0]).filter((name) => Boolean(name)),
|
|
54
|
+
]);
|
|
55
|
+
for (const name of generated) {
|
|
56
|
+
await rm(join(appRoot, name), { recursive: true, force: true }).catch(() => { });
|
|
57
|
+
}
|
|
58
|
+
for (const [name, previous] of [
|
|
59
|
+
['README.md', snapshot.previousReadme], ['.gitignore', snapshot.previousGitignore],
|
|
60
|
+
]) {
|
|
61
|
+
if (previous === null) {
|
|
62
|
+
await rm(join(appRoot, name), { force: true }).catch(() => { });
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
await writeFile(join(appRoot, name), previous).catch(() => { });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/app/scaffold.d.ts
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Scaffold
|
|
2
|
+
* Scaffold platform primitives into an app monorepo and keep
|
|
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
8
|
export interface ScaffoldNames {
|
|
7
9
|
functionName: string;
|
|
8
10
|
}
|
|
9
11
|
export declare function defaultScaffoldNames(_appId: string): ScaffoldNames;
|
|
10
|
-
export declare function initAppMonorepo({ rootDir, appId, kinds, names, description, }: {
|
|
12
|
+
export declare function initAppMonorepo({ rootDir, appId, kinds, names, description, pipelineType, }: {
|
|
11
13
|
rootDir: string;
|
|
12
14
|
appId: string;
|
|
13
15
|
kinds: readonly PrimitiveKind[];
|
|
14
16
|
names?: ScaffoldNames;
|
|
15
17
|
description?: string;
|
|
18
|
+
pipelineType?: AppPipelineType;
|
|
16
19
|
}): Promise<AppManifest>;
|
|
17
|
-
export declare function addPrimitiveToApp({ rootDir, kind, name, }: {
|
|
20
|
+
export declare function addPrimitiveToApp({ rootDir, kind, name, pipelineType, dependsOn, }: {
|
|
18
21
|
rootDir: string;
|
|
19
22
|
kind: PrimitiveKind;
|
|
20
23
|
name: string;
|
|
24
|
+
pipelineType?: AppPipelineType;
|
|
25
|
+
dependsOn?: string[];
|
|
21
26
|
}): Promise<{
|
|
22
27
|
manifest: AppManifest;
|
|
23
28
|
entry: PrimitiveEntry;
|
|
24
29
|
}>;
|
|
30
|
+
export declare function printOrmPreparation({ primitives }: {
|
|
31
|
+
primitives: readonly PrimitiveEntry[];
|
|
32
|
+
}): void;
|
|
25
33
|
export declare function printInitNextSteps({ appRoot, manifest, }: {
|
|
26
34
|
appRoot: string;
|
|
27
35
|
manifest: AppManifest;
|