@sequenceholdings/studio-cli 1.0.6 → 1.0.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.
@@ -15,6 +15,16 @@ export declare function lockfileOmitsWorkspaceOverrides({ workspace, lockfile }:
15
15
  workspace: string | undefined;
16
16
  lockfile: string;
17
17
  }): boolean;
18
+ /**
19
+ * Whether a workspace file lists `path`, a directory below it, as a member. Only `packages` makes a
20
+ * member: without it the workspace is its root alone. What this cannot read leaves the install as
21
+ * pnpm would run it, so that pnpm reports a broken file: a file or a pattern it cannot read counts as
22
+ * listing the directory, and an exclusion it cannot read as not excluding it.
23
+ */
24
+ export declare function workspaceLists({ workspace, path }: {
25
+ workspace: string | undefined;
26
+ path: string;
27
+ }): boolean;
18
28
  export type InstallDecision = {
19
29
  install: false;
20
30
  reason: 'installed' | 'no-package';
@@ -66,6 +66,59 @@ function standaloneRoot({ dir, appRoot, exists }) {
66
66
  }
67
67
  return undefined;
68
68
  }
69
+ /** A workspace `packages` pattern as an expression, or undefined for glob syntax beyond `*`, `**` and `?`. */
70
+ function workspacePattern(pattern) {
71
+ const path = pattern.replace(/^\.\//, '').replace(/\/+$/, '');
72
+ // `@` and `+` are glob syntax only before a parenthesis; alone they are characters of a name, as in `@scope`.
73
+ if (/[{}[\]()]/.test(path))
74
+ return undefined;
75
+ const source = path
76
+ .replace(/[.^$|+\\]/g, '\\$&')
77
+ .replace(/\*\*\/|\*\*|\*|\?/g, (glob) => ({ '**/': '(?:.*/)?', '**': '.*', '*': '[^/]*', '?': '[^/]' })[glob] ?? glob);
78
+ return new RegExp(`^${source}$`);
79
+ }
80
+ /**
81
+ * Whether a workspace file lists `path`, a directory below it, as a member. Only `packages` makes a
82
+ * member: without it the workspace is its root alone. What this cannot read leaves the install as
83
+ * pnpm would run it, so that pnpm reports a broken file: a file or a pattern it cannot read counts as
84
+ * listing the directory, and an exclusion it cannot read as not excluding it.
85
+ */
86
+ export function workspaceLists({ workspace, path }) {
87
+ if (workspace === undefined)
88
+ return true;
89
+ let parsed;
90
+ try {
91
+ parsed = parseYaml(workspace);
92
+ }
93
+ catch {
94
+ return true;
95
+ }
96
+ const packages = typeof parsed === 'object' && parsed !== null ? Reflect.get(parsed, 'packages') : undefined;
97
+ if (!Array.isArray(packages))
98
+ return false;
99
+ const patterns = packages.filter((entry) => typeof entry === 'string');
100
+ const matches = ({ pattern, unreadable }) => workspacePattern(pattern)?.test(path) ?? unreadable;
101
+ const excluded = patterns.some((pattern) => pattern.startsWith('!') && matches({ pattern: pattern.slice(1), unreadable: false }));
102
+ return !excluded && patterns.some((pattern) => !pattern.startsWith('!') && matches({ pattern, unreadable: true }));
103
+ }
104
+ /**
105
+ * Whether a directory without its own workspace file sits inside a workspace that does not list it.
106
+ * pnpm run there installs that workspace instead, and a package the workspace does not list is
107
+ * skipped without a word. A listed member is left to the workspace even when it keeps its own
108
+ * lockfile (`sharedWorkspaceLockfile: false`): installed alone, the members it links to would get
109
+ * no dependencies of their own.
110
+ */
111
+ function unlistedInWorkspaceAbove({ root, exists, read }) {
112
+ if (exists(join(root, 'pnpm-workspace.yaml')))
113
+ return false;
114
+ for (let directory = dirname(root);; directory = dirname(directory)) {
115
+ const workspace = join(directory, 'pnpm-workspace.yaml');
116
+ if (exists(workspace))
117
+ return !workspaceLists({ workspace: read(workspace), path: relative(directory, root).split(sep).join('/') });
118
+ if (directory === dirname(directory))
119
+ return false;
120
+ }
121
+ }
69
122
  /**
70
123
  * A fresh clone has no node_modules, and an artifact cannot build without them. Install where the
71
124
  * artifact resolves its dependencies from: the nearest directory, its own or one above it inside the
@@ -89,7 +142,9 @@ export function decideInstall({ artifactDir, appRoot, exists = existsSync, read
89
142
  args: [
90
143
  'install', '--frozen-lockfile', '--ignore-scripts',
91
144
  ...(peers === undefined ? [] : [`--config.auto-install-peers=${peers}`]),
92
- ...(lockfileOmitsWorkspaceOverrides({ workspace: read(join(root, 'pnpm-workspace.yaml')), lockfile }) ? ['--ignore-workspace'] : []),
145
+ ...(lockfileOmitsWorkspaceOverrides({ workspace: read(join(root, 'pnpm-workspace.yaml')), lockfile }) || unlistedInWorkspaceAbove({ root, exists, read })
146
+ ? ['--ignore-workspace']
147
+ : []),
93
148
  ],
94
149
  };
95
150
  }
@@ -46,6 +46,11 @@ ${PIPELINE_DISCOVERY_USAGE}
46
46
  inspect with --retirement-id <id>; resume a stopped operation with
47
47
  --retirement-id <id> --resume --yes (never creates a replacement plan)
48
48
 
49
+ seq-studio pipeline handoff --from <unit>[,<unit>…] --to <unit> -e <env> [--target <id>] [--json]
50
+ preview moving whole live release units into another unit; nothing is
51
+ created, deleted or re-synced. Approve with --plan-hash <hash> --yes;
52
+ inspect with --handoff-id <id>; resume with --handoff-id <id> --resume --yes
53
+
49
54
  seq-studio pipeline build tables [--from <authoring.ts>] [--dir <dir>] [--dry-run] [--force]
50
55
  emit one <stage>.stage.yml per table from a typed PerTableIngestionAuthoring
51
56
  module (default export, authoring, or silverlakeAuthoring export name)
@@ -444,6 +449,10 @@ export async function runPipelineCommand(sub, args) {
444
449
  const { pipelineRetireCommand } = await import('./retirement.js');
445
450
  return pipelineRetireCommand(args);
446
451
  }
452
+ case 'handoff': {
453
+ const { pipelineHandoffCommand } = await import('./handoff.js');
454
+ return pipelineHandoffCommand(args);
455
+ }
447
456
  case 'plan': {
448
457
  const { pipelinePlanCommand } = await import('./lifecycle.js');
449
458
  return pipelinePlanCommand(args);
@@ -0,0 +1,3 @@
1
+ import type { ParsedArgs } from '../process/commands.js';
2
+ /** Handoff is preview-first; neither --yes nor a hash alone moves anything. */
3
+ export declare function pipelineHandoffCommand(args: ParsedArgs): Promise<number>;
@@ -0,0 +1,54 @@
1
+ import { postJson } from '../atlas-client.js';
2
+ import { envAndToken, resolvePipelineTarget } from './lifecycle.js';
3
+ /** Returns undefined when the combination is incomplete; throws on malformed values. */
4
+ function parseHandoffFlags(args) {
5
+ const string = (name) => {
6
+ const value = args.flags[name];
7
+ if (value === true)
8
+ throw new Error(`--${name} requires a value`);
9
+ return value;
10
+ };
11
+ if (args.flags.stages !== undefined)
12
+ throw new Error('--stages is not supported yet: a handoff moves whole release units');
13
+ const from = string('from');
14
+ const sources = from === undefined ? undefined : from.split(',').map(s => s.trim()).sort();
15
+ if (sources && (sources.some(s => !s) || new Set(sources).size !== sources.length))
16
+ throw new Error('--from must be a nonempty, unique comma-separated list of release units');
17
+ const [to, planHash, handoffId] = [string('to'), string('plan-hash'), string('handoff-id')];
18
+ const resume = args.flags.resume === true;
19
+ const confirmed = args.flags.yes === true;
20
+ if (!sources || !to || ((planHash || resume) && !confirmed) || (resume && !handoffId) || (confirmed && !planHash && !resume))
21
+ return undefined;
22
+ return { sources, to, planHash, handoffId, resume };
23
+ }
24
+ function printHandoff(result, environment) {
25
+ if (!result.plan) {
26
+ console.log(`Handoff ${result.handoffId}: ${result.status}${result.statusDetail ? ` — ${result.statusDetail}` : ''}\nCheck with --handoff-id ${result.handoffId}. Resume a stopped failure with --handoff-id ${result.handoffId} --resume --yes.`);
27
+ return;
28
+ }
29
+ const { inventory } = result.plan;
30
+ console.log(`Hand off ${result.plan.sources.join(', ')} → ${result.plan.target} in ${environment}: ${inventory.stages.length} stages, ${inventory.moves.length} live resources. Nothing is created, deleted or re-synced.`);
31
+ // Every stage is listed: approving archives it in its source and recreates it in the target, even with no live bindings.
32
+ for (const stage of inventory.stages)
33
+ console.log(` Move stage: ${stage.repo} ${stage.slug} → ${result.plan.target} ${stage.slug}${stage.activeDeploymentId ? '' : ' (no active deployment)'}`);
34
+ for (const m of inventory.moves)
35
+ console.log(` ${['job', 'dlt_pipeline'].includes(m.kind) ? 'Rebind bundle owner' : 'Move registry owner'}: ${m.kind} ${m.nativeId} (${m.resourceKey}) from ${m.sourceRepo}`);
36
+ console.log(`Review the inventory, then approve with --plan-hash ${result.plan.planHash} --yes. Afterwards, plan the target: every moved stage should show update or no change.`);
37
+ }
38
+ /** Handoff is preview-first; neither --yes nor a hash alone moves anything. */
39
+ export async function pipelineHandoffCommand(args) {
40
+ const flags = parseHandoffFlags(args);
41
+ if (!flags) {
42
+ console.error('usage: seq-studio pipeline handoff --from <unit>[,<unit>…] --to <unit> -e <env> [--target <id>] [--plan-hash <hash> --yes | --handoff-id <id> [--resume --yes]] [--json]');
43
+ return 1;
44
+ }
45
+ const { env, token } = await envAndToken(args, { human: true });
46
+ const target = await resolvePipelineTarget({ args, env, token });
47
+ const { sources, to, planHash, handoffId, resume } = flags;
48
+ const result = await postJson({ baseUrl: env.url, token, path: '/api/data-pipelines/pipelines/handoff', body: { sources, target: to, environment: target.id, ...(planHash ? { planHash } : {}), ...(handoffId ? { handoffId } : {}), resume } });
49
+ if (args.flags.json)
50
+ console.log(JSON.stringify(result, null, 2));
51
+ else
52
+ printHandoff(result, target.id);
53
+ return result.status === 'failed' ? 1 : 0;
54
+ }
@@ -1,2 +1,2 @@
1
1
  /** Offline help: keep this module free of authentication and runtime SDK imports. */
2
- export declare const PIPELINE_HELP = "usage:\n seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repository rollups (not assets)\n seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]\n list asset declarations, including assets that may not be deployed\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]\n seq-studio pipeline show <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]\n seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...\n For local validation, run from the pipeline tooling/app directory:\n pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec\n pnpm exec seq-studio pipeline validate .\n seq-studio pipeline plan|deploy --repo <namespace>/<slug> --ref <sha|branch>\n [--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]\n For an existing target release unit, source-env selects a separately\n authenticated canonical repository from banksouth, staging, or production.\n Source identity must be adopted and belong to the destination tenant.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Reviewed pipeline.config.yml source_paths can select runtime files and\n directories, retaining pipeline metadata, release identity and size limits.\n Not compatible with --dir, existing IDs, or coordinated migrations.\n Rollback uses retained snapshots; historical source commits can be re-planned\n explicitly with deploy --ref <sha> --source-env <env>.\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]\n poll an existing durable plan without enqueueing or attaching credentials\n seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--stages <slugs>] [--json]\n preview the whole pipeline, or comma-separated stages omitted from its\n latest published source collection. Approve the same scope with\n --plan-hash <hash> --yes. Deletes supported execution resources and archives\n stages; retains data and history. Live synced-table configurations block.\n Inspect with --retirement-id <id>; resume a stopped failure with\n --retirement-id <id> --resume --yes (omit --stages; the scope is immutable).\n Requires a human pipeline administrator and staff destructive-operation access.\n Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now\n executes producers in the managed worker; local polling may disconnect.\n\n Discovery requires staff access. Use list for pipeline repositories, assets\n for declared assets, and search/describe for active deployment metadata;\n use schema to verify physical columns. -e chooses the environment and\n --target chooses a logical target when the environment has more than one.\n Help is available offline.\n";
2
+ export declare const PIPELINE_HELP = "usage:\n seq-studio pipeline list -e <env> [--limit 1..200] [--offset N] [--json]\n list pipeline repository rollups (not assets)\n seq-studio pipeline assets -e <env> [--repo <namespace>/<slug>] [--json]\n list asset declarations, including assets that may not be deployed\n seq-studio pipeline search <query> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--limit N] [--offset N] [--json]\n seq-studio pipeline show <asset-id> -e <env> [--target <id>] [--repo <namespace>/<slug>] [--json]\n seq-studio pipeline schema|sample <asset-id> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline query <asset-id> --sql <read-only-sql> -e <env> [--target <id>] [--limit N] [--json]\n seq-studio pipeline init|validate|plan|deploy|status|migrate|adopt|unbind|run-now|promote|rollback ...\n For local validation, run from the pipeline tooling/app directory:\n pnpm add --save-dev @sequenceholdings/studio-cli @sequenceholdings/pipeline-spec\n pnpm exec seq-studio pipeline validate .\n seq-studio pipeline plan|deploy --repo <namespace>/<slug> --ref <sha|branch>\n [--root <directory>] [--source-env <first-party-env>] -e <env> [--target <id>]\n For an existing target release unit, source-env selects a separately\n authenticated canonical repository from banksouth, staging, or production.\n Source identity must be adopted and belong to the destination tenant.\n Registered OpCo source origins are not supported yet. The target verifies\n and snapshots source before planning; no target repository is created.\n Reviewed pipeline.config.yml source_paths can select runtime files and\n directories, retaining pipeline metadata, release identity and size limits.\n Not compatible with --dir, existing IDs, or coordinated migrations.\n Rollback uses retained snapshots; historical source commits can be re-planned\n explicitly with deploy --ref <sha> --source-env <env>.\n seq-studio pipeline plan --plan-request-id <id> -e <env> [--json]\n poll an existing durable plan without enqueueing or attaching credentials\n seq-studio pipeline retire --repo <release-unit> -e <env> [--target <id>] [--stages <slugs>] [--json]\n preview the whole pipeline, or comma-separated stages omitted from its\n latest published source collection. Approve the same scope with\n --plan-hash <hash> --yes. Deletes supported execution resources and archives\n stages; retains data and history. Live synced-table configurations block.\n Inspect with --retirement-id <id>; resume a stopped failure with\n --retirement-id <id> --resume --yes (omit --stages; the scope is immutable).\n Requires a human pipeline administrator and staff destructive-operation access.\n seq-studio pipeline handoff --from <unit>[,<unit>\u2026] --to <unit> -e <env> [--target <id>] [--json]\n preview moving whole live release units (jobs, DLT pipelines, workflow\n jobs, synced tables, views) into another unit without deleting, recreating\n or re-syncing anything. Approve with --plan-hash <hash> --yes. Inspect with\n --handoff-id <id>; resume a stopped failure with --handoff-id <id> --resume --yes.\n Afterwards the target's next deploy updates each moved stage in place.\n Requires admin on every unit and staff destructive-operation access.\n Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now\n executes producers in the managed worker; local polling may disconnect.\n\n Discovery requires staff access. Use list for pipeline repositories, assets\n for declared assets, and search/describe for active deployment metadata;\n use schema to verify physical columns. -e chooses the environment and\n --target chooses a logical target when the environment has more than one.\n Help is available offline.\n";
@@ -34,6 +34,13 @@ export const PIPELINE_HELP = `usage:
34
34
  Inspect with --retirement-id <id>; resume a stopped failure with
35
35
  --retirement-id <id> --resume --yes (omit --stages; the scope is immutable).
36
36
  Requires a human pipeline administrator and staff destructive-operation access.
37
+ seq-studio pipeline handoff --from <unit>[,<unit>…] --to <unit> -e <env> [--target <id>] [--json]
38
+ preview moving whole live release units (jobs, DLT pipelines, workflow
39
+ jobs, synced tables, views) into another unit without deleting, recreating
40
+ or re-syncing anything. Approve with --plan-hash <hash> --yes. Inspect with
41
+ --handoff-id <id>; resume a stopped failure with --handoff-id <id> --resume --yes.
42
+ Afterwards the target's next deploy updates each moved stage in place.
43
+ Requires admin on every unit and staff destructive-operation access.
37
44
  Lifecycle --json results use stdout; progress uses stderr. Deploy --run-now
38
45
  executes producers in the managed worker; local polling may disconnect.
39
46
 
@@ -126,10 +126,10 @@ export const COMMANDS = [
126
126
  },
127
127
  {
128
128
  name: 'pipeline',
129
- group: 'primitive', usage: 'pipeline <sub> [args] list | assets | search | show | schema | sample | query | init | validate | plan | adopt | unbind | retire | deploy | status | migrate | promote | rollback | run',
129
+ group: 'primitive', usage: 'pipeline <sub> [args] list | assets | search | show | schema | sample | query | init | validate | plan | adopt | unbind | retire | handoff | deploy | status | migrate | promote | rollback | run',
130
130
  description: 'Discover and operate Data Pipelines',
131
131
  lifecycle: 'preview', access: 'staff', checkSubcommands: true, telemetry: 'subcommand',
132
- subcommands: [...deprecate(subs(['list', 'assets', 'search', 'schema', 'sample', 'query', 'init', 'validate', 'plan', 'deploy', 'status', 'migrate', 'adopt', 'unbind', 'retire', 'promote', 'rollback']), { promote: PROMOTE_REPLACEMENT }),
132
+ subcommands: [...deprecate(subs(['list', 'assets', 'search', 'schema', 'sample', 'query', 'init', 'validate', 'plan', 'deploy', 'status', 'migrate', 'adopt', 'unbind', 'retire', 'handoff', 'promote', 'rollback']), { promote: PROMOTE_REPLACEMENT }),
133
133
  { name: 'show', renamedFrom: ['describe'], implementation: 'describe' },
134
134
  { name: 'run', renamedFrom: ['run-now'], implementation: 'run-now' },
135
135
  { name: 'build', renamedFrom: ['codegen'], implementation: 'codegen', listed: false }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.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": {
@@ -45,16 +45,16 @@
45
45
  "tsx": "^4.20.3",
46
46
  "yaml": "^2.8.4",
47
47
  "zod": "4.6.6",
48
- "@sequenceholdings/agent-spec": "0.1.6",
49
- "@sequenceholdings/artifact-studio": "0.11.27",
48
+ "@sequenceholdings/agent-spec": "0.1.7",
50
49
  "@sequenceholdings/lattice": "0.1.9",
51
50
  "@sequenceholdings/managed-functions": "0.5.17",
52
51
  "@sequenceholdings/storage": "0.1.8",
53
- "@sequenceholdings/platform": "0.1.5"
52
+ "@sequenceholdings/platform": "0.1.5",
53
+ "@sequenceholdings/artifact-studio": "0.11.27"
54
54
  },
55
55
  "peerDependencies": {
56
- "@sequenceholdings/orm": "2.12.2",
57
- "@sequenceholdings/pipeline-spec": "0.3.16"
56
+ "@sequenceholdings/pipeline-spec": "0.3.16",
57
+ "@sequenceholdings/orm": "2.12.2"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@sequenceholdings/orm": {
@@ -17,5 +17,6 @@
17
17
  "1.0.3": "Artifact builds now use Atlas UI 4.2.0, including the shared SideNav and SideNavLayout components, through Artifact Studio 0.11.25.",
18
18
  "1.0.4": "Fixes Windows: artifact builds and dev no longer fail with a 400 on the Atlas UI stylesheet path (dist\\tokens.css), and pnpm, npx and gcloud calls now run on Windows.",
19
19
  "1.0.5": "Includes ORM 2.12.2: a policy- or capability-only change now registers its statement-less committed migration, so environments that apply only committed migrations accept it. Registered SQL operations also push filters into row-policy and proven synced tables.",
20
- "1.0.6": "The README now shows how to check the installed CLI version in an agent sandbox with seq-studio --version."
20
+ "1.0.6": "The README now shows how to check the installed CLI version in an agent sandbox with seq-studio --version.",
21
+ "1.0.7": "Updates agent definition validation for optional tool approval policies. Tools without a review policy keep their existing behavior."
21
22
  }