@sequenceholdings/studio-cli 0.9.6 → 0.9.7

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
@@ -3304,3 +3304,54 @@ service-account and roster workflows consume them. The coordinated Platform,
3304
3304
  Storage and primitive SDK release remains prepared and unpublished. See
3305
3305
  [consumer coverage](../../../docs/platform/sdk-consumer-coverage.md) for exact
3306
3306
  operations and application-owned compatibility routes.
3307
+
3308
+ ### Workspace snapshots for independent pipeline consumers (internal preview)
3309
+
3310
+ ```sh
3311
+ seq-studio storage source apply --workspace <uuid> --retention-days 30 -e local
3312
+ seq-studio storage sync --workspace <uuid> --idempotency-key import-2026-10-21 --wait -e local
3313
+ seq-studio storage sync status <sync-id> --workspace <uuid> -e local
3314
+ seq-studio storage snapshots list --workspace <uuid> -e local
3315
+ seq-studio storage snapshots show <snapshot-id> --workspace <uuid> -e local
3316
+ seq-studio storage sync retry <sync-id> --workspace <uuid> -e local
3317
+ seq-studio storage sync cancel <sync-id> --workspace <uuid> -e local
3318
+ ```
3319
+
3320
+ `source apply` uses the server's configured target; `--target` selects only a target
3321
+ the current deployment permits. `--readers <application-id,...>` sets explicit
3322
+ Databricks readers, and omission preserves the current audience. Waiting times out
3323
+ after one hour by default (`--timeout <seconds>`); it leaves the sync running.
3324
+ Snapshot history supports `--cursor` and `--limit`. Workspace manifests may include
3325
+ `pipelineSource: { target, readers, retentionDays }` for declarative configuration.
3326
+
3327
+ Use the same symbolic source in two pipeline repositories; each gets its own
3328
+ materialized bronze tables and batches:
3329
+
3330
+ ```yaml
3331
+ runtime: upload
3332
+ file_source:
3333
+ binding: workspaces/customer-inputs
3334
+ snapshot: latest-completed # or an explicit completed snapshot UUID for replay
3335
+ feeds:
3336
+ accounts:
3337
+ snapshot_mode: full_snapshot
3338
+ natural_key: [id]
3339
+ format: csv
3340
+ files: [exports/accounts/*.csv]
3341
+ ```
3342
+
3343
+ This is the ingestion body inside an ordinary stage spec. `upload` requires explicit
3344
+ file selection and CSV, JSON, or Parquet. Unsupported/mixed selections and no matches
3345
+ fail before a batch is created. Arbitrary PDFs/binaries still sync successfully and
3346
+ can be consumed by a `runtime: databricks` parser with a `file_source` and the injected
3347
+ `pipeline_runtime.workspace_file_source()` helper. A source snapshot may feed many
3348
+ pipelines. Deployment/run admission resolves and authorizes the reference; a native
3349
+ workflow pins shared sources once before its ingestion roots. Runs record snapshot
3350
+ IDs and manifest hashes. Sync and run success are distinct.
3351
+
3352
+ Local development uses the active profile's Databricks workspace, a personal Lakebase
3353
+ branch, and a source catalog derived from the local storage environment. In deployed
3354
+ OpCo environments, staging and production can share a Databricks workspace while
3355
+ remaining separate catalog/binding identities. Sync refuses foreign-workspace and
3356
+ foreign-environment destination bindings. It does not switch profiles or make local
3357
+ Atlas mirror another tenant automatically.
@@ -29,6 +29,10 @@ const usage = `usage:
29
29
  seq-studio storage access --workspace <id> [--node <id>] [--file <access.json>] -e <env>
30
30
  seq-studio storage operations --workspace <id> [--retry <operation-id>] -e <env>
31
31
  seq-studio storage abort --workspace <id> --upload <id> -e <env>
32
+ seq-studio storage source show|apply --workspace <id> [--target <id>] [--readers <principal-ids>] -e <env>
33
+ seq-studio storage sync --workspace <id> [--idempotency-key <key>] [--wait] -e <env>
34
+ seq-studio storage sync status|retry|cancel <sync-id> --workspace <id> -e <env>
35
+ seq-studio storage snapshots [list|show <snapshot-id>] --workspace <id> [--cursor <cursor>] -e <env>
32
36
  seq-studio storage delete --workspace <id> --revision <n> --yes -e <env>
33
37
 
34
38
  Workspaces are provisioned from YAML; paths create folders at upload time.
@@ -92,7 +96,16 @@ export async function runStorageCommand(sub, args) {
92
96
  },
93
97
  });
94
98
  if (sub === 'apply' && manifest) {
95
- print(await client.apply(manifest));
99
+ const applied = await client.apply(manifest);
100
+ if (manifest.pipelineSource) {
101
+ const workspace = client.workspace(applied.id);
102
+ const source = await workspace.pipelineSource();
103
+ const target = manifest.pipelineSource.target ?? source.targets[0]?.id;
104
+ if (!target)
105
+ throw new Error('This environment has no workspace pipeline destination');
106
+ await workspace.applyPipelineSource({ ...manifest.pipelineSource, target });
107
+ }
108
+ print(applied);
96
109
  return 0;
97
110
  }
98
111
  const list = {
@@ -112,6 +125,67 @@ export async function runStorageCommand(sub, args) {
112
125
  return n;
113
126
  };
114
127
  switch (sub) {
128
+ case 'source': {
129
+ if (args.positional[0] === 'apply') {
130
+ const current = await workspace.pipelineSource();
131
+ const target = flag('target') ?? current.targets[0]?.id;
132
+ if (!target)
133
+ throw new Error('No pipeline destination is configured for this environment');
134
+ print(await workspace.applyPipelineSource({ target, readers: flag('readers') === undefined ? current.source?.readers ?? [] : flag('readers').split(',').map(x => x.trim()).filter(Boolean), retentionDays: flag('retention-days') ? Number(flag('retention-days')) : current.source?.retentionDays ?? 30 }));
135
+ }
136
+ else if (!args.positional[0] || args.positional[0] === 'show')
137
+ print(await workspace.pipelineSource());
138
+ else
139
+ throw new Error('Expected storage source show|apply');
140
+ break;
141
+ }
142
+ case 'sync': {
143
+ const action = args.positional[0], id = args.positional[1];
144
+ if (action) {
145
+ if (!id)
146
+ throw new Error('Sync ID is required');
147
+ if (action === 'status')
148
+ print(await workspace.pipelineSync(id));
149
+ else if (action === 'retry')
150
+ print(await workspace.retryPipelineSync(id));
151
+ else if (action === 'cancel')
152
+ print(await workspace.cancelPipelineSync(id));
153
+ else
154
+ throw new Error('Expected storage sync status|retry|cancel <id>');
155
+ break;
156
+ }
157
+ let result = await workspace.syncForPipelines({ idempotencyKey: flag('idempotency-key') ?? randomUUID() });
158
+ console.error(`Sync ${result.operation.id}`);
159
+ const timeout = Number(flag('timeout') ?? 3600);
160
+ if (!Number.isFinite(timeout) || timeout <= 0)
161
+ throw new Error('--timeout must be a positive number of seconds');
162
+ const deadline = Date.now() + timeout * 1000;
163
+ if (args.flags.wait) {
164
+ while (['queued', 'running'].includes(result.operation.status)) {
165
+ if (Date.now() > deadline)
166
+ throw new Error(`Wait timed out. Resume with storage sync status ${result.operation.id}; the sync continues.`);
167
+ await new Promise(resolve => setTimeout(resolve, 2000));
168
+ result = await workspace.pipelineSync(result.operation.id);
169
+ }
170
+ }
171
+ print(result);
172
+ if (result.operation.status === 'failed' || result.operation.status === 'canceled')
173
+ return 1;
174
+ break;
175
+ }
176
+ case 'snapshots': {
177
+ if (args.positional[0] === 'show') {
178
+ const id = args.positional[1];
179
+ if (!id)
180
+ throw new Error('Snapshot ID is required');
181
+ print(await workspace.pipelineSnapshot(id));
182
+ }
183
+ else if (!args.positional[0] || args.positional[0] === 'list')
184
+ print(await workspace.pipelineSnapshots({ cursor: flag('cursor'), limit: list.limit }));
185
+ else
186
+ throw new Error('Expected storage snapshots list|show <id>');
187
+ break;
188
+ }
115
189
  case 'list':
116
190
  print(await workspace.list({
117
191
  ...list,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
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 whoami`. Includes Auth0 browser login shared with seqapi.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -44,16 +44,16 @@
44
44
  "tsx": "^4.20.3",
45
45
  "yaml": "^2.8.4",
46
46
  "zod": "^4.1.13",
47
- "@sequenceholdings/artifact-studio": "0.11.6",
47
+ "@sequenceholdings/artifact-studio": "0.11.7",
48
48
  "@sequenceholdings/agent-spec": "0.1.5",
49
49
  "@sequenceholdings/lattice": "0.1.8",
50
- "@sequenceholdings/managed-functions": "0.5.5",
51
- "@sequenceholdings/storage": "0.1.5",
52
- "@sequenceholdings/platform": "0.1.2"
50
+ "@sequenceholdings/managed-functions": "0.5.6",
51
+ "@sequenceholdings/platform": "0.1.2",
52
+ "@sequenceholdings/storage": "0.1.5"
53
53
  },
54
54
  "peerDependencies": {
55
- "@sequenceholdings/pipeline-spec": "0.3.3",
56
- "@sequenceholdings/orm": "2.8.3"
55
+ "@sequenceholdings/pipeline-spec": "0.3.4",
56
+ "@sequenceholdings/orm": "2.8.4"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@sequenceholdings/orm": {
@@ -69,8 +69,8 @@
69
69
  "@types/semver": "^7.8.0",
70
70
  "typescript": "^5.6.0",
71
71
  "vitest": "^4.1.11",
72
- "@sequenceholdings/pipeline-spec": "0.3.3",
73
- "@sequenceholdings/orm": "2.8.3"
72
+ "@sequenceholdings/pipeline-spec": "0.3.4",
73
+ "@sequenceholdings/orm": "2.8.4"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=20"