@sequenceholdings/studio-cli 0.1.26 → 0.1.27

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 CHANGED
@@ -144,9 +144,9 @@ scaffolding and for the eventual Applications UI. Do not hand-author apps
144
144
  without it.
145
145
 
146
146
  > **Availability:** This is currently an internal orchestration workflow.
147
- > Generated ORM apps depend on unpublished `@sequenceholdings/orm`, so
148
- > standalone external installs and the function-to-ORM runtime path are not
149
- > supported yet.
147
+ > Standalone ORM namespaces are the supported Preview path; app-monorepo
148
+ > orchestration and the function-to-ORM runtime path are not public workflows
149
+ > yet.
150
150
 
151
151
  | Command | What it does |
152
152
  |---------|--------------|
@@ -259,8 +259,15 @@ compiled to canonical SQL before registration.
259
259
  | `seq-studio orm plan [dir] -e <env>` | Compare the compiled namespace with registry state without applying database changes. |
260
260
  | `seq-studio orm diff [dir] [--check]` | Author the next committed migration, or verify the migration/snapshot chain offline for CI. |
261
261
  | `seq-studio orm apply [dir] -e <env>` | Author a migration if needed, register/apply the namespace, activate its operation set, publish roles/capabilities, and refresh generated outputs. |
262
+ | `seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>` | Execute one named persisted operation from `operations.manifest.json` with variables from a JSON object file, as the signed-in caller. |
262
263
  | `seq-studio orm migrate-from-yaml <dir>` | Convert a legacy YAML namespace to TypeScript authoring while preserving its committed migrations. |
263
264
 
265
+ Install the CLI and ORM package together:
266
+
267
+ ```bash
268
+ pnpm add -g @sequenceholdings/studio-cli@0.1.27 @sequenceholdings/orm@2.0.0
269
+ ```
270
+
264
271
  The everyday loop is:
265
272
 
266
273
  ```bash
@@ -280,15 +287,9 @@ the target environment's data. `apply --no-create` is the CI guard that refuses
280
287
  to provision a missing namespace. Destructive DDL requires explicit
281
288
  `--allow-destructive` consent.
282
289
 
283
- > **ORM v2 branch status:** the scaffold currently depends on
284
- > `@sequenceholdings/orm@^2.0.0`, which is not published yet; the registry's
285
- > latest release is the v1 `0.1.1` package. A clean standalone scaffold cannot
286
- > complete `pnpm install` until the v2 ORM dependency chain is released. Do not
287
- > use monorepo workspace links as evidence that the external workflow is ready.
288
- > Sequence contributors should see
289
- > [`docs/platform/orm-v2.md`](../../../docs/platform/orm-v2.md) for the branch
290
- > architecture, internal verification workflow, demo, and remaining rollout
291
- > gates.
290
+ > **Preview:** ORM v2 is a Preview workflow. The generated namespace package
291
+ > depends on `@sequenceholdings/orm@^2.0.0`; use the matching published major
292
+ > version and keep generated manifests and migrations committed with source.
292
293
 
293
294
  ## Process commands
294
295
 
@@ -99,7 +99,7 @@ Artifact Studio UI
99
99
 
100
100
  **Artifact Studio** is the screen. In Atlas the UI runs in a sandboxed iframe and talks to the platform through \`seq\` from \`@sequenceholdings/artifact-studio\`. It has no raw network access and must not contain secrets. Every table, operation, API path, or function the UI uses must be listed in \`artifact.bundle.yml\` first. Prefer \`@sequenceholdings/atlas-ui\`. Docs: [Artifact Studio](${SEQUENCE_DOCS_URL}artifact-studio/overview).
101
101
 
102
- **ORM** is the data layer. You author tables and policies in TypeScript (\`defineNamespace\`, \`defineTable\`) and persist reads/writes as named GraphQL documents. \`seq-studio orm apply\` compiles that into a reviewed migration and publishes persisted operations. The UI calls \`{ op: <hash>, variables }\` on the Atlas Data API. Policies are the row boundary — stamp identity from \`claim('sub')\` rather than trusting the browser. There is no ad-hoc SQL; exotic writes go through a declared table action. Public docs do not yet have an ORM guide; \`seq-studio orm --help\` and a reference app (for example Pokedex: Artifact UI + trainer-scoped \`pokemon\` rows) are the working model.
102
+ **ORM** is the data layer. You author tables and policies in TypeScript (\`defineNamespace\`, \`defineTable\`) and persist reads/writes as named GraphQL documents. \`seq-studio orm apply\` compiles that into a reviewed migration and publishes persisted operations. The UI calls \`{ op: <hash>, variables }\` on the Atlas Data API. Policies are the row boundary — stamp identity from \`claim('sub')\` rather than trusting the browser. There is no ad-hoc SQL; exotic writes go through a declared table action. See the ORM section of the [CLI command reference](${SEQUENCE_DOCS_URL}seq-studio/commands) and \`seq-studio orm --help\`; a reference app (for example Pokedex: Artifact UI + trainer-scoped \`pokemon\` rows) shows the working model.
103
103
 
104
104
  **Managed Function** is the backend. Use it for an external API, a write-only secret, or any work that must not run in the browser. The handler receives JSON and returns JSON. The manifest declares secret *names* (never values) and an egress allowlist — functions do not get arbitrary outbound network. Docs: [Managed Functions](${SEQUENCE_DOCS_URL}managed-functions/overview), [Managed Secrets](${SEQUENCE_DOCS_URL}managed-secrets/overview).
105
105
 
@@ -109,7 +109,7 @@ How the examples split:
109
109
  | --- | --- | --- |
110
110
  | Pokedex-style app | Artifact + ORM | UI that reads and writes governed tables |
111
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) |
112
+ | \`seq-studio init --with orm,function,artifact\` | All three | The intended three-primitive app shape |
113
113
 
114
114
  A function calling the ORM under a service account is **not** a supported public path yet. Keep user-scoped table access in the artifact; keep secrets and egress in the function.
115
115
 
@@ -123,7 +123,13 @@ Ask your administrator for:
123
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
124
  3. **What you should create** — new Artifact Studio project, new function, new ORM namespace, or updates to existing ones.
125
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.
126
+ 5. **\`@sequenceholdings/orm\` v2 (Preview)** — \`seq-studio init --with orm\` and namespace \`package.json\` files depend on \`@sequenceholdings/orm@^2.0.0\`. Install the matching Preview CLI and SDK pair before scaffolding an ORM namespace:
127
+
128
+ \`\`\`bash
129
+ pnpm add -g @sequenceholdings/studio-cli@0.1.27 @sequenceholdings/orm@2.0.0
130
+ \`\`\`
131
+
132
+ Without that pair you can still ship Artifact + Function apps.
127
133
 
128
134
  \`local\`, \`staging\`, \`production\`, and \`banksouth\` are **reserved built-in CLI names**. \`seq-studio envs add banksouth …\` fails. Use the OpCo name you were given.
129
135
 
@@ -214,7 +220,7 @@ This repository was created empty except for this README. From the clone root:
214
220
  \`\`\`bash
215
221
  # into this directory (keeps the git-service remote)
216
222
  seq-studio init . --with function,artifact --function-name hello --description "${title}"
217
- # or the intended three-primitive shape, once @sequenceholdings/orm v2 is available:
223
+ # or the three-primitive Preview shape:
218
224
  # seq-studio init . --with orm,function,artifact --function-name hello
219
225
  \`\`\`
220
226
 
package/dist/main.js CHANGED
@@ -35,7 +35,7 @@ const TOP_LEVEL_USAGE = `usage:
35
35
  seq-studio repos <sub> [args] list | namespaces | show | create | clone | pull | delete
36
36
  seq-studio pipeline <sub> [args] init | validate — Data Pipelines stage specs
37
37
  seq-studio auth <sub> [args] pat create | pat list | pat revoke
38
- seq-studio orm <sub> [args] init | validate | plan | apply
38
+ seq-studio orm <sub> [args] init | generate | validate | plan | apply | execute | diff | migrate-from-yaml
39
39
  seq-studio envs <sub> add | list | refresh environments
40
40
  seq-studio login [--env <name>] authenticate in the browser
41
41
  seq-studio logout [--env <name>] remove one realm's cached user tokens
@@ -13,13 +13,15 @@ import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
13
13
  * ORM subcommands that talk to Atlas — must not silently target `local`.
14
14
  * `init`, `generate`, `validate`, `diff`, and `migrate-from-yaml` are offline.
15
15
  */
16
- const ORM_NETWORK_SUBS = new Set(['plan', 'apply']);
16
+ const ORM_NETWORK_SUBS = new Set(['plan', 'apply', 'execute']);
17
17
  const ORM_USAGE = `usage:
18
18
  seq-studio orm init <dir> scaffold a namespace package (v2: TypeScript schema + GraphQL documents)
19
19
  seq-studio orm generate [dir] write schema.graphql + operations.manifest.json + typePolicies.gen.ts (offline; runs consumer codegen when codegen.ts is present)
20
20
  seq-studio orm validate [dir] parse + validate definitions and verify committed migrations are in sync
21
21
  seq-studio orm plan [dir] -e <env> compile definitions and diff against the registry
22
22
  seq-studio orm apply [dir] -e <env> author the migration, register, apply, and refresh the generated outputs (the everyday command)
23
+ seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>
24
+ execute one named persisted operation as the signed-in caller
23
25
  seq-studio orm diff [dir] write/verify the committed migration standalone (--check is the offline CI gate; --allow-destructive consents; --rebase records a v1 -> v2 conversion)
24
26
  seq-studio orm migrate-from-yaml <dir> convert a v1 YAML namespace to the v2 TypeScript format (offline; migrations/ preserved)
25
27
 
@@ -39,12 +41,35 @@ export function isOrmPackageMissing(message) {
39
41
  const specifier = message.match(/Cannot find (?:package|module) '([^']+)'/)?.[1];
40
42
  return specifier === '@sequenceholdings/orm' || (specifier?.startsWith('@sequenceholdings/orm/') ?? false);
41
43
  }
44
+ async function loadOrmCli() {
45
+ try {
46
+ return await import('@sequenceholdings/orm/cli');
47
+ }
48
+ catch (err) {
49
+ if (err.code !== 'ERR_MODULE_NOT_FOUND')
50
+ throw err;
51
+ const message = err instanceof Error ? err.message : String(err);
52
+ if (isOrmPackageMissing(message)) {
53
+ console.error('seq-studio orm needs the @sequenceholdings/orm package. Install it alongside the CLI:\n' +
54
+ ' npm install @sequenceholdings/orm');
55
+ }
56
+ else {
57
+ console.error('@sequenceholdings/orm is installed but a dependency failed to load. Reinstall dependencies, then retry.\n' +
58
+ ` ${message}`);
59
+ }
60
+ return null;
61
+ }
62
+ }
42
63
  export async function runOrmCommand(sub, rest) {
43
64
  if (!sub || sub === 'help' || sub === '--help' || sub === '-h') {
44
65
  console.log(ORM_USAGE);
45
66
  return sub ? 0 : 1;
46
67
  }
47
68
  const normalized = normalizeShortEnvFlag(rest);
69
+ if (normalized.includes('--help') || normalized.includes('-h')) {
70
+ const ormCli = await loadOrmCli();
71
+ return ormCli ? ormCli.runCli([sub, ...normalized]) : 1;
72
+ }
48
73
  const requested = readEnvFromArgv(normalized);
49
74
  if (ORM_NETWORK_SUBS.has(sub) && !requested) {
50
75
  console.error(`[seq-studio] ${REQUIRE_EXPLICIT_ENV_MESSAGE}`);
@@ -63,28 +88,10 @@ export async function runOrmCommand(sub, rest) {
63
88
  });
64
89
  if (token)
65
90
  process.env['SEQUENCE_ORM_TOKEN'] = token;
66
- // Lazy import keeps `process`/`doctor` from pulling in the orm package.
67
- // @sequenceholdings/orm is a private, optional peer — absent in public
68
- // installs of the CLI, present in the monorepo (dev dep) and internal setups.
69
- let ormCli;
70
- try {
71
- ormCli = await import('@sequenceholdings/orm/cli');
72
- }
73
- catch (err) {
74
- if (err.code === 'ERR_MODULE_NOT_FOUND') {
75
- const message = err instanceof Error ? err.message : String(err);
76
- if (isOrmPackageMissing(message)) {
77
- console.error('seq-studio orm needs the @sequenceholdings/orm package. Install it alongside the CLI:\n' +
78
- ' npm install @sequenceholdings/orm');
79
- }
80
- else {
81
- console.error('@sequenceholdings/orm is installed but a dependency failed to load. Reinstall dependencies, then retry.\n' +
82
- ` ${message}`);
83
- }
84
- return 1;
85
- }
86
- throw err;
87
- }
91
+ // Lazy import keeps `process`/`doctor` from pulling in the optional ORM package.
92
+ const ormCli = await loadOrmCli();
93
+ if (!ormCli)
94
+ return 1;
88
95
  const { runCli, setTokenProvider } = ormCli;
89
96
  setTokenProvider(async () => {
90
97
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Unified Sequence Studio CLI — `seq-studio init` / `add` / `deploy` (app monorepos), `seq-studio agents`, `seq-studio process` (Lattice), `seq-studio artifact`, `seq-studio functions` / `secrets`, `seq-studio repos`, and `seq-studio auth pat`. Includes Auth0 browser login shared with seqapi.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "@sequenceholdings/lattice": "0.1.2"
46
46
  },
47
47
  "peerDependencies": {
48
- "@sequenceholdings/orm": "0.1.3",
48
+ "@sequenceholdings/orm": "2.0.0",
49
49
  "@sequenceholdings/pipeline-spec": "0.1.0"
50
50
  },
51
51
  "peerDependenciesMeta": {
@@ -61,7 +61,7 @@
61
61
  "@types/node": "^22.0.0",
62
62
  "typescript": "^5.6.0",
63
63
  "vitest": "^4.1.5",
64
- "@sequenceholdings/orm": "0.1.3",
64
+ "@sequenceholdings/orm": "2.0.0",
65
65
  "@sequenceholdings/pipeline-spec": "0.1.0"
66
66
  },
67
67
  "engines": {