@sequenceholdings/studio-cli 0.9.13 → 0.9.15

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
@@ -1166,7 +1166,7 @@ datasets before adopting this path for latency-sensitive reads.
1166
1166
  | `seq-studio process apply --repo <namespace>/<name> [--ref <r>] -e <env> [--only <id1,id2>]` | Same as above, but materializes the source from a platform git-service repo in `processes`, `apps`, or your own namespace. Pinned commit SHA is injected as bundle provenance. Uses your `seq-studio login` (or the target realm's M2M JSON source path for CI) |
1167
1167
  | `seq-studio process test [--dir <path>] -e <env> [--offline]` | CI wrapper: lint + plan, non-zero exit on errors or BREAKING diffs; see the offline limitation below |
1168
1168
  | `seq-studio process simulate <id> [--dir <path>]` | Isolated child-process walk with stubbed runners and hardened JSONata data-flow mapper evaluation (offline) |
1169
- | `seq-studio process bundle build [--dir <path>] [-o file.json]` | Build a bundle locally |
1169
+ | `seq-studio process bundle build [--dir <path>] [-o file.json] [-e <env>] [--offline]` | Build a bundle locally; subprocess children from other roots need `-e` to pin, or `--offline` to leave them unpinned for validation |
1170
1170
  | `seq-studio process bundle pull <hash> [-e <env>] [-o file.json]` | Fetch a stored bundle |
1171
1171
  | `seq-studio process bundle inspect <bundle.json>` | Show a saved bundle's summary |
1172
1172
  | `seq-studio process bundle list [-e <env>] [--limit N] [--cursor <hash>]` | List registered bundles (paginated; CLI auto-fetches all pages) |
@@ -2386,7 +2386,16 @@ seq-studio repos ci show artifacts/my-app -e staging --pr 4
2386
2386
  ```
2387
2387
 
2388
2388
  The generated file selects the platform's native lint, type-check, test and build
2389
- defaults for the repository inventory:
2389
+ checks for the repository inventory. For lint, type-check and test, repository CI
2390
+ runs the primitive's own `package.json` script of that name (`typecheck` also
2391
+ counts) and falls back to a platform default only when the script is missing;
2392
+ Next.js artifacts have no fallback and must define all three. The build is always
2393
+ the platform build for the primitive's kind, except that a managed function's
2394
+ `build` script runs when present. New ORM namespace, managed-function, Lattice
2395
+ process and React/Vite Artifact Studio scaffolds define `lint`, `type-check` and
2396
+ `test`, so
2397
+ after `pnpm install` you can run `pnpm run lint`, `pnpm run type-check` and
2398
+ `pnpm run test` in the primitive's directory to reproduce those CI phases:
2390
2399
 
2391
2400
  ```yaml
2392
2401
  schema_version: 2
@@ -3376,6 +3385,7 @@ seq-studio repos pulls resolve <namespace/name> <number> <root-comment-id> -e <e
3376
3385
  seq-studio repos pulls unresolve <namespace/name> <number> <root-comment-id> -e <env>
3377
3386
  seq-studio repos pulls review <namespace/name> <number> --request-changes --body-file review.md -e <env>
3378
3387
  seq-studio repos pulls checks <namespace/name> <number> -e <env>
3388
+ seq-studio repos pulls edit <namespace/name> <number> --title "Build task app v2" --body-file review.md -e <env>
3379
3389
  seq-studio repos pulls close <namespace/name> <number> -e <env>
3380
3390
  ```
3381
3391
 
@@ -3396,7 +3406,10 @@ login and require repository read access; the server rejects reply IDs.
3396
3406
  optional `--body`/`--body-file`, and records the review against the commit the Pull's
3397
3407
  branch points at now unless `--commit` names another. `checks` returns one object with the Pull's check
3398
3408
  runs, CI plan and runs, and merge gates (mergeability, review, code-owner, and check
3399
- gates). `close` needs authorship or repository write and is idempotent.
3409
+ gates). `edit` changes an open Pull's title (`--title`) and/or description (`--body` or
3410
+ `--body-file`), needs authorship or repository write, refuses
3411
+ merged and closed Pulls, and prints the updated Pull like `show` (with `url`).
3412
+ `close` needs authorship or repository write and is idempotent.
3400
3413
  `repos pull` remains the singular source-snapshot command.
3401
3414
 
3402
3415
  ## Agent feedback
@@ -1,4 +1,5 @@
1
1
  import { PlatformError } from '@sequenceholdings/platform';
2
+ import { recordTerminalCommandError } from './command-telemetry.js';
2
3
  import { AtlasApiError } from './atlas-client.js';
3
4
  export const LOG = '[seq-studio]';
4
5
  /** Map common apply failure reasons to clearer copy (original reason is preserved). */
@@ -84,7 +85,10 @@ export function formatCliError(error) {
84
85
  }
85
86
  return [`${LOG} ${error instanceof Error ? error.message : String(error)}`];
86
87
  }
88
+ // Terminal command catches use this before returning a failure exit code.
89
+ // Formatting alone remains side-effect free.
87
90
  export function printCliError(error) {
91
+ recordTerminalCommandError(error);
88
92
  for (const line of formatCliError(error)) {
89
93
  console.error(line);
90
94
  }
@@ -8,7 +8,7 @@ export declare const ORM_HELP = "usage:\n seq-studio orm init <dir> [--repo <ns
8
8
  export declare const ARTIFACT_SANDBOX_HELP = " In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), build, plan\n and deploy take --repo: push the app to a Git Service repository and deploy\n from it. Atlas builds Next.js applications; static applications are bundled\n from the repository and must declare no package.json dependencies or\n optionalDependencies, because the sandbox cannot reach a package registry.\n dev, login, logout, --git-url, --source-env, --pr and --env-url are\n unavailable there, and -e is ignored.\n";
9
9
  export declare const ARTIFACT_HELP = "usage:\n seq-studio artifact init <dir> [--template react-vite|nextjs] [--repo <namespace>/<name>]\n seq-studio artifact whoami -e <env>\n seq-studio artifact link [dir] -e <env> [--project <id>]\n seq-studio artifact env list|use <env>\n seq-studio artifact status [-e <env>]\n seq-studio artifact list -e <env> [--json]\n seq-studio artifact show <slug-or-id> -e <env> [--json]\n seq-studio artifact validate [dir]\n seq-studio artifact build|plan|deploy [dir | --repo <namespace>/<name> | --git-url <url>] [--ref <ref>] -e <env>\n seq-studio artifact dev [dir] -e <env> [--once] [--key <name>] [--link <package-dir>] [--port <port>] [--secret-source local|hosted|none] [--local-secrets <bindings.json>] [--bundler turbopack|webpack]\n seq-studio artifact pull <project-id> -e <env> --out <dir>\n seq-studio artifact promote|rollback <deployment-id> -e <env>\n\n Help is available offline. Authenticate with seq-studio login. Build and deploy\n sources may be local, a platform git-service repo, or a public HTTPS Git URL;\n deployments target a named environment with -e. Local, preview, and official\n deployment workflows have different source and approval rules; see the public\n CLI README.\n\n Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n In a git-service checkout (with or without --repo), orm init, functions init\n and artifact init also declare the scaffold under resources in\n .seq/repository.yml, so repository CI checks and deploys it. A scaffold inside\n a declared application is not declared; add it to that app with seq-studio add.\n\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), build, plan\n and deploy take --repo: push the app to a Git Service repository and deploy\n from it. Atlas builds Next.js applications; static applications are bundled\n from the repository and must declare no package.json dependencies or\n optionalDependencies, because the sandbox cannot reach a package registry.\n dev, login, logout, --git-url, --source-env, --pr and --env-url are\n unavailable there, and -e is ignored.\n";
10
10
  export declare const FUNCTIONS_USAGE = "usage:\n seq-studio functions init <dir> [--repo <ns>/<name>] scaffold manifest, TypeScript handler, and docs pointers;\n --repo scaffolds into a git-service repo (see Init into a repo)\n seq-studio functions build [--dir d] local pre-flight (manifest, lockfile, SDK timeout cap)\n seq-studio functions register -e <env> [--dir d] register a shell + initial secret declarations; no deploy\n seq-studio functions deploy -e <env> [-m msg] preflight, upload, then show version and lifecycle progress\n seq-studio functions list -e <env> [--match-local] functions visible on the environment\n seq-studio functions show -e <env> [--fn slug] detail for one function (input/output schemas, versions, secrets)\n [--schema] function identity plus input/output JSON Schemas, as JSON (any caller who can see it)\n [--json] [--version id|name] reader-gated release provenance\n seq-studio functions limits [-e <env>] [--json] bundled defaults/caps, or deployed policy\n [--fn slug] also show effective runtime limits (requires -e)\n seq-studio functions dev [--dir path] [--port 8080] local HTTP server with cache context\n seq-studio functions invoke -e <env> [--data JSON | --data @file | --stdin]\n invoke a function and print its response\n seq-studio functions logs -e <env> [--limit N] [--since t] function logs (reader-gated)\n seq-studio functions promote <version> -e <env> [--fn <slug>]\n make a version live\n seq-studio functions rollback [<version>] -e <env> [--fn <slug>]\n redeploy a prior version\n seq-studio functions delete -e <env> [--fn <slug>] [--yes]\n archive function + tear down its runtime\n (version history is retained)\n\n Flags: -e/--env <env|preview:<slug>> (required for network commands; see: seq-studio envs list) \u00B7 --fn <slug> \u00B7 --dir <path>\n --fn selects a deployed function without a local manifest; otherwise the manifest in --dir (default .) supplies its slug\n --path <repo-subdirectory> (remote build/deploy only) select one function in a multi-function repo\n --from-env-file <path> (default: .env) source file for secret values\n --no-wait \u00B7 --yes\n --no-provision (deploy) update-only: error instead of registering a new\n shell, writing secret values, or attaching secrets (CI sweep)\n\n Local Atlas builds and runs deployed functions on this computer, including teardown.\n \"functions dev\" runs a standalone handler without Atlas registration.\n\n Configure per-function CPU and concurrency in managed-function.yml under limits.\n Run \"functions limits\" for valid settings; redeploy to apply manifest changes.\n Invocation rates are shared across Atlas replicas; 429 includes Retry-After.\n If the shared rate limiter is unavailable, invocation fails closed with 503.\n\n Source for build/deploy: a local --dir (default .), a platform git-service\n repo (--repo <ns>/<name>), or a public HTTPS git URL (--git-url <url>). --path selects\n a function directory within a remote repo; omit it for the existing root-manifest\n layout. --ref selects a branch/tag/commit (default: the repo's default branch).\n Remote sources record the pinned commit as provenance (never dirty) and NEVER\n read a repo-committed .env for secret values \u2014 provision secrets server-side\n or pass a local --from-env-file (resolved against your cwd).\n Local deploys record repository-wide gitDirty, including unignored files\n outside --dir. Check git status at the repository root before deploying.\n\n Workspace dependencies are compiled from packages declared in a containing\n sequence.app.yml, within the source repository. Only the selected function is\n deployed: no sibling primitives or Application registration. Shared Node packages\n can set package.json seqStudio.source to a root source entry for clean builds.\n Package build scripts are not run. Local secret paths remain relative to --dir.\n\n Interactive --repo builds clone over smart-HTTP using your seq-studio login\n and repository read access. No PAT is needed. Headless M2M builds use JSON\n materialize and accept only platform-managed --repo sources. Use --env to\n select the same environment for source and deployment.\n\n Init into a repo: --repo <ns>/<name> on an init command creates that platform\n git-service repo if missing (same name rules as repos create), then clones it\n into <dir> and scaffolds there, or, when <dir> is inside a Git checkout, sets\n it as that checkout's origin (a different existing origin is refused). It\n needs -e <env>, or an agent sandbox. Nothing is committed or pushed; the\n command prints the git add, commit, and push to run.\n In a git-service checkout (with or without --repo), orm init, functions init\n and artifact init also declare the scaffold under resources in\n .seq/repository.yml, so repository CI checks and deploys it. A scaffold inside\n a declared application is not declared; add it to that app with seq-studio add.\n";
11
- export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos identity <ns>/<name> -e <env> [--write --dir .] show/install the server-issued identity receipt\n --adopt --write --yes admin-only legacy binding; commit the receipt via PR\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write. Returns once\n the repo resolves by name, so clone can follow\n at once. The init commands take --repo\n <ns>/<name> to create, clone, and scaffold\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n real Git clone using seq-studio login;\n configures login for subsequent git pull/push\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge|close|comment|comments|resolve|unresolve|review|reviews|checks> [args]\n review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults\n seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone uses your login token (never written into the remote URL or Git config).\n A repository-local credential helper reads your current login for git pull/push.\n After expiry, run seq-studio login --env <env> again.\n --transport auto (default) and git both create a real Git checkout.\n Personal access tokens are retired; ATLAS_GIT_PAT is ignored.\n --transport json downloads files without .git; requires\n <ns>/<name>. repos pull also provides this files-only workflow.\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: seq-studio login --env <env>\n";
11
+ export declare const REPOS_USAGE = "usage:\n seq-studio repos list -e <env> [--namespace <slug>] [--mine] repos visible on the environment\n seq-studio repos namespaces [create <slug>] -e <env> list or create namespaces\n seq-studio repos show <ns>/<name> -e <env> repo detail (branches, clone URL)\n seq-studio repos identity <ns>/<name> -e <env> [--write --dir .] show/install the server-issued identity receipt\n --adopt --write --yes admin-only legacy binding; commit the receipt via PR\n seq-studio repos create <ns>/<name> -e <env> [--default-branch b] [--git-backend walgit]\n create a repo seeded with a README; --git-backend\n walgit creates it empty (for pushing existing\n history); needs namespace write. Returns once\n the repo resolves by name, so clone can follow\n at once. The init commands take --repo\n <ns>/<name> to create, clone, and scaffold\n seq-studio repos clone <ns>/<name> -e <env> [--ref r] [--output dir] [--force] [--full] [--transport auto|git|json]\n seq-studio repos clone --url <https://\u2026/repos/<id>/git> -e <env> [--ref r] [--output dir] [--full]\n seq-studio repos clone --id <uuid> -e <env> [--ref r] [--output dir] [--full]\n real Git clone using seq-studio login;\n configures login for subsequent git pull/push\n seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]\n materialize the tree at a ref (JSON API)\n seq-studio repos pulls <list|show|create|diff|merge|edit|close|comment|comments|resolve|unresolve|review|reviews|checks> [args]\n review requests (see pulls --help)\n seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)\n seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults\n seq-studio repos ci show <ns>/<name> -e <env> --pr <number> [--json] inspect the server CI plan and runs\n seq-studio repos ci show <ns>/<name> -e <env> [--ref r] preview pipeline discovery or legacy checks\n seq-studio repos ci require <ns>/<name> --check <name> -e <env> disabled legacy control\n seq-studio repos ci import <ns>/<name> -e <env> [--ref r] disabled legacy control\n\n Flags: -e/--env <env> (required; see: seq-studio envs list)\n\n clone uses your login token (never written into the remote URL or Git config).\n A repository-local credential helper reads your current login for git pull/push.\n After expiry, run seq-studio login --env <env> again.\n --transport auto (default) and git both create a real Git checkout.\n Personal access tokens are retired; ATLAS_GIT_PAT is ignored.\n --transport json downloads files without .git; requires\n <ns>/<name>. repos pull also provides this files-only workflow.\n --ref accepts a branch, tag, or commit SHA (SHA \u2192 full clone, then checkout).\n Branch and tag clones are shallow (--depth 1). Pass --full for history.\n --output selects the clone directory (--out remains an alias).\n\n Authenticate JSON API calls with: seq-studio login\n Authenticate git clone/push with: seq-studio login --env <env>\n";
12
12
  export declare const PROCESS_RUNS_USAGE = "usage:\n seq-studio process runs start <process-id> -e <env> [--version <v>] [--run-id <id>]\n [--metadata-file <file.json>] [--title <text>] [--entity <type>:<id>] [--json]\n seq-studio process runs retry <run-id> -e <env> [--run-id <new-id>] [--json]\n seq-studio process runs list -e <env> [--process <id>] [--status <status>]\n [--entity-type <type>] [--entity-id <id>] [--archived] [--limit 1..500] [--json]\n seq-studio process runs show <run-id> -e <env> [--wait [--timeout <seconds>]]\n [--steps [--node <node-id>] [--full]] [--json]\n seq-studio process runs cancel <run-id> -e <env> [--json]\n\n Runs start and are read as you: start and retry need invoker on the process,\n show and list return only runs you can view, and cancel needs invoker on the\n process.\n start prints the new run's id. Omit --run-id for a fresh id on every start.\n --run-id names exactly one run: repeating it for the same process returns that\n run, whatever its status, instead of starting another. To run a failed run\n again, retry it rather than inventing a new id.\n --version pins a published process version; omitted, the active version runs.\n --metadata-file is a JSON object stored on the run.\n retry (CLI 0.9.0+) starts a new run of a failed, cancelled or timed_out run's\n process version with the same metadata, entity and title, linked to the\n original in its lineage, and prints the new id. Other statuses are refused.\n Like start, a retry waits queued while the process is at its concurrent-run\n limit.\n --run-id on retry names the new run, so repeating the retry returns it.\n list returns the newest runs first, up to --limit (default 50, max 500); the run\n API has no cursor, so narrow with filters to reach older runs.\n --status: pending, running, completed, failed, cancelled, timed_out.\n show --wait polls until the run finishes (default timeout 600s); the run keeps\n going if the wait times out. show prints the run's error when it failed.\n show --steps (CLI 0.9.1+) prints each step's status, edge, error, input and\n output, with the same viewer permission as show. Inputs, outputs and errors\n over 2000 characters are cut to a preview; --full prints them whole.\n --node narrows to one node. With --json, --steps returns { run, steps } with\n the same bounds; each step's truncated map names its cut fields and their full\n length. A failure in a node's input mapper happens before its step\n starts, so it shows only as the run's error.\n";
13
13
  export declare const ORM_DISCOVER_HELP = "usage:\n seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]\n seq-studio orm describe <namespace> [<table> | --operations] -e <env> [--json]\n seq-studio orm operation show <namespace> <name> -e <env> [--json]\n\n Find the ORM data you can read, then query it with orm read or orm sql.\n namespaces lists only namespaces you can read, ordered by name: format (v2 or\n v1), table and persisted-operation counts. It pages with --limit (default 50)\n and --offset; the total and the next page go to stderr.\n describe <namespace> lists its tables and views and the persisted operations\n it serves, with what each requires and the variables it declares (name: type,\n ! when required). --operations prints only the operations, ready for\n orm execute <namespace> <operation>. describe <namespace> <table> lists the\n table's columns (types, nullability, keys), enum values, links, actions, and\n the persisted operations that write it. Column names are the ones orm read and\n orm sql accept.\n A namespace you cannot read reports not found, the same as a missing one.\n --json omits SDL, adds active set/schema IDs and ops hash; retry on a mismatch.\n operation show prints one active persisted operation's registered GraphQL\n document; --json includes its hash, declared variables, and requirements.\n Missing and unreadable operations both report not found.\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), -e is not needed.\n";
14
14
  export declare const ORM_EXECUTE_HELP = "usage:\n seq-studio orm execute <namespace> <operation> -e <env> [--variables-file <file>] [--var <name>=<value>]...\n seq-studio orm execute <operation> [dir] --variables-file <file> -e <env>\n\n Run one persisted operation as you. The server applies the operation's\n required capability or role and the namespace's row policies.\n By name: execute <namespace> <operation> looks the operation up in the\n namespace's deployed version and runs it. No checkout is needed, so it runs\n what is deployed even when a local clone is behind. List what you can run:\n seq-studio orm describe <namespace> --operations\n From a checkout: execute <operation> [dir] delegates to the installed ORM\n package using the directory's operations.manifest.json (default dir: .).\n Updated ORM packages validate the name and kind, then call the active named\n operation. Older packages may still select the manifest hash. Confirm the\n installed package and platform support name selection before upgrading.\n The form is chosen by the second argument: an existing directory means a\n checkout; otherwise it is <namespace> <operation>.\n --variables-file takes a JSON object; - or /dev/stdin reads UTF-8 stdin until EOF\n (the checkout form requires an ORM package with stdin support).\n --var <name>=<value> (repeatable, by\n name only) sets one variable and wins over the file: numbers and booleans\n parse by the declared type, lists, filter inputs and jsonb take JSON, and other\n types take the text as is. Use the file for null.\n Output is the JSON response: {\"data\": ...}.\n In an agent sandbox (SEQ_STUDIO_BASE_URL + SEQ_STUDIO_TOKEN_FILE), -e is not needed.\n";
@@ -195,7 +195,7 @@ export const REPOS_USAGE = `usage:
195
195
  configures login for subsequent git pull/push
196
196
  seq-studio repos pull <ns>/<name> -e <env> [--ref r] [--out dir] [--force]
197
197
  materialize the tree at a ref (JSON API)
198
- seq-studio repos pulls <list|show|create|diff|merge|close|comment|comments|resolve|unresolve|review|reviews|checks> [args]
198
+ seq-studio repos pulls <list|show|create|diff|merge|edit|close|comment|comments|resolve|unresolve|review|reviews|checks> [args]
199
199
  review requests (see pulls --help)
200
200
  seq-studio repos delete <ns>/<name> -e <env> [--yes] delete a repo (confirm prompt)
201
201
  seq-studio repos ci init [--dir <repository>] create a native pipeline using platform defaults
@@ -1,3 +1,7 @@
1
+ /** Preserve only finite metadata when a terminal catch prints an error and returns an exit code.
2
+ * Never call from HTTP retries or recoverable request failures; completion alone emits the event.
3
+ */
4
+ export declare function recordTerminalCommandError(error: unknown): void;
1
5
  /** Called only after the existing auth path has verified the token and target. */
2
6
  export declare function recordAuthenticatedCliTarget(baseUrl: string, token: string): void;
3
7
  export declare function beginCommandTelemetry(): number;
@@ -7,6 +7,7 @@ import { edgeAuthHeaders } from './edge-auth-headers.js';
7
7
  const preferencePath = () => join(homedir(), '.config', 'lattice', 'telemetry.json');
8
8
  const targets = new Map();
9
9
  let active = false;
10
+ let terminalFailure;
10
11
  function commandOutcome(exitCode, error) {
11
12
  if (exitCode === 0)
12
13
  return 'success';
@@ -41,6 +42,21 @@ function commandErrorCategory(error, status) {
41
42
  return 'network';
42
43
  return 'unknown';
43
44
  }
45
+ function failureMetadata(error) {
46
+ const httpStatus = commandHttpStatus(error);
47
+ return {
48
+ httpStatus,
49
+ errorCategory: commandErrorCategory(error, httpStatus),
50
+ cancelled: error instanceof Error && error.name === 'AbortError',
51
+ };
52
+ }
53
+ /** Preserve only finite metadata when a terminal catch prints an error and returns an exit code.
54
+ * Never call from HTTP retries or recoverable request failures; completion alone emits the event.
55
+ */
56
+ export function recordTerminalCommandError(error) {
57
+ if (active)
58
+ terminalFailure = failureMetadata(error);
59
+ }
44
60
  /** Called only after the existing auth path has verified the token and target. */
45
61
  export function recordAuthenticatedCliTarget(baseUrl, token) {
46
62
  if (!active)
@@ -49,6 +65,7 @@ export function recordAuthenticatedCliTarget(baseUrl, token) {
49
65
  }
50
66
  export function beginCommandTelemetry() {
51
67
  targets.clear();
68
+ terminalFailure = undefined;
52
69
  active = true;
53
70
  return performance.now();
54
71
  }
@@ -69,15 +86,17 @@ export async function setTelemetryEnabled(enabled) {
69
86
  }
70
87
  export async function finishCommandTelemetry(input) {
71
88
  active = false;
89
+ const failure = input.error === undefined ? terminalFailure : failureMetadata(input.error);
90
+ terminalFailure = undefined;
72
91
  const target = targets.size === 1 ? [...targets][0] : null;
73
92
  targets.clear();
74
93
  if (!input.command || !target || !(await telemetryEnabled()))
75
94
  return;
76
95
  const [baseUrl, token] = target;
77
96
  const durationMs = Math.max(0, Math.min(86_400_000, Math.round(performance.now() - input.startedAt)));
78
- const httpStatus = commandHttpStatus(input.error);
79
- const outcome = commandOutcome(input.exitCode, input.error);
80
- const errorCategory = outcome === 'failure' ? commandErrorCategory(input.error, httpStatus) : undefined;
97
+ const outcome = input.exitCode !== 0 && failure?.cancelled ? 'cancelled' : commandOutcome(input.exitCode, input.error);
98
+ const httpStatus = outcome === 'success' ? undefined : failure?.httpStatus;
99
+ const errorCategory = outcome === 'failure' ? failure?.errorCategory ?? 'unknown' : undefined;
81
100
  try {
82
101
  await fetch(new URL('/api/platform/cli-command-events', baseUrl), {
83
102
  method: 'POST', redirect: 'error', signal: AbortSignal.timeout(1_500),
@@ -355,8 +355,13 @@ const TEMPLATE_PACKAGE_JSON = (id) => JSON.stringify({
355
355
  // The deploy worker compiles index.ts -> dist/index.js; `main` points at
356
356
  // the compiled output Cloud Functions loads.
357
357
  main: 'dist/index.js',
358
+ // Repository CI runs lint, type-check and test as these scripts; without
359
+ // them it substitutes platform defaults a checkout cannot run locally.
358
360
  scripts: {
359
361
  build: 'tsc',
362
+ lint: 'tsc --noEmit --noUnusedLocals --noUnusedParameters',
363
+ 'type-check': 'tsc --noEmit',
364
+ test: 'node --test',
360
365
  },
361
366
  dependencies: {
362
367
  '@google-cloud/functions-framework': '^3.4.0',
package/dist/main.js CHANGED
@@ -85,7 +85,7 @@ const PROCESS_USAGE = `usage:
85
85
  seq-studio process runs start|retry|list|show|cancel [args] -e <env> (see process runs --help)
86
86
  seq-studio process test [-e <env>] [--offline]
87
87
  seq-studio process simulate <process-id>
88
- seq-studio process bundle build [-o file.json]
88
+ seq-studio process bundle build [-o file.json] [-e <env>] [--offline]
89
89
  seq-studio process bundle pull <hash> [-o file.json] [-e <env>]
90
90
  seq-studio process bundle archive <hash> [-e <env>]
91
91
  seq-studio process bundle inspect <bundle.json>
@@ -116,6 +116,7 @@ const SUBCOMMANDS = {
116
116
  const TELEMETRY_EXCLUDED = new Set(['validate', 'telemetry', 'version', 'capabilities', 'help', 'login', 'logout', 'envs']);
117
117
  const TELEMETRY_TOP_LEVEL = new Set(['init', 'add', 'deploy', 'doctor']);
118
118
  const TELEMETRY_NESTED = {
119
+ 'repos pulls': new Set(['list', 'show', 'create', 'diff', 'merge', 'edit', 'close', 'comment', 'comments', 'resolve', 'unresolve', 'review', 'reviews', 'checks']),
119
120
  'process runs': new Set(['start', 'retry', 'list', 'show', 'cancel']),
120
121
  'process bundle': new Set(['build', 'pull', 'archive', 'inspect', 'list', 'publish']),
121
122
  };
@@ -220,8 +220,11 @@ async function lintCompiledProcessSource({ compiled, loadAgentSchemaEdgeIdEnum,
220
220
  warnings: [...compiled.lint.warnings, ...agentLint.warnings, ...limitLint.warnings],
221
221
  };
222
222
  }
223
+ function isOffline(args) {
224
+ return args.flags.offline === true || args.flags.offline === 'true';
225
+ }
223
226
  async function tryBuildAgentLoader(args) {
224
- if (args.flags.offline === true || args.flags.offline === 'true')
227
+ if (isOffline(args))
225
228
  return undefined;
226
229
  // Agent loader is only meaningful when we have a target env + token.
227
230
  // If either fails to resolve, skip the check; lint will emit a warning
@@ -250,6 +253,12 @@ async function buildBundleForPublish(args, compiled) {
250
253
  }
251
254
  if (!hasSubprocess)
252
255
  return compiled.bundle;
256
+ if (isOffline(args)) {
257
+ // Children in this bundle are already pinned by the SDK; children from
258
+ // other roots keep their unresolved reference, which apply resolves.
259
+ console.log('(subprocess children outside this bundle left unpinned — --offline flag set)');
260
+ return compiled.bundle;
261
+ }
253
262
  try {
254
263
  const { env, token } = await getEnvAndToken(args);
255
264
  const resolveProcessPin = buildResolveProcessPinFromEnv(env, token);
@@ -345,7 +354,7 @@ export async function testCommand(args) {
345
354
  }
346
355
  console.log(`\nlint ok — ${compiled.bundle.processes.length} process(es) checked, ${lintResult.warnings.length} warning(s)`);
347
356
  const bundle = await buildBundleForPublish(args, compiled);
348
- const offline = args.flags.offline === true;
357
+ const offline = isOffline(args);
349
358
  const loadActiveProcess = await tryBuildActiveProcessLoader(args);
350
359
  if (!loadActiveProcess) {
351
360
  // `process test` is the CI gate — silently skipping the diff would
@@ -1,5 +1,5 @@
1
1
  import type { ParsedArgs } from '../process/commands.js';
2
- export declare const PULLS_USAGE = "usage:\n seq-studio repos pulls list <ns>/<name> -e <env> [--state open|closed|merged] [--limit N] [--cursor <cursor>]\n seq-studio repos pulls show <ns>/<name> <number> -e <env>\n seq-studio repos pulls create <ns>/<name> --head <branch> --base <branch> --title <title> -e <env> [--body-file <path>]\n seq-studio repos pulls diff <ns>/<name> <number> -e <env> [--max-files N]\n seq-studio repos pulls merge <ns>/<name> <number> -e <env> [--method squash|merge|ff] [--message <text>] [--yes]\n seq-studio repos pulls close <ns>/<name> <number> -e <env>\n seq-studio repos pulls comment <ns>/<name> <number> -e <env> (--body <text> | --body-file <path>)\n [--path <file> --line N [--side LEFT|RIGHT] [--commit <sha>]] [--reply-to <comment-id>]\n seq-studio repos pulls comments <ns>/<name> <number> -e <env> [--limit N] [--cursor <cursor>]\n seq-studio repos pulls resolve <ns>/<name> <number> <root-comment-id> -e <env>\n seq-studio repos pulls unresolve <ns>/<name> <number> <root-comment-id> -e <env>\n seq-studio repos pulls review <ns>/<name> <number> -e <env> (--approve | --request-changes | --comment)\n [--body <text> | --body-file <path>] [--commit <sha>]\n seq-studio repos pulls reviews <ns>/<name> <number> -e <env> [--limit N] [--cursor <cursor>]\n seq-studio repos pulls checks <ns>/<name> <number> -e <env> [--head <sha>]\n\n All results are JSON (--json is accepted). Authenticate: seq-studio login --env <env>.\n create needs repository write; merge needs merge/admin authority and passing server\n review/check policy. There is no policy bypass. Review show and diff before merging.\n Merge operates on the current branch head under server policy. When repository CI\n checks the branch, merge sends the checked head and base revisions; a newer push\n makes the server refuse until checks rerun. Default merge method: squash.\n list returns one page with nextCursor; pass --cursor to continue.\n create, show and list add a web url field to each Pull (<env>/repositories/<ns>/<name>/pull/<n>).\n diff compares live base/head branches for open Pulls, recorded SHAs for terminal\n Pulls, and reports truncated when its file\n limit is reached (default 100, maximum 500).\n close needs to be the Pull's author or have repository write; it is idempotent.\n comment adds a Pull comment; --path and --line anchor it to a diff line (side RIGHT\n and the branch's current commit unless --side/--commit say otherwise), and\n --reply-to answers an existing thread. review records approve, request-changes, or\n comment against the commit the Pull's branch points at now (or --commit). checks prints the check runs,\n CI plan and runs, and merge gates (mergeability, reviews, code owners) in one object.\n resolve and unresolve require repository read access and a root comment UUID from\n comments; the server rejects replies. They return the updated comment as JSON.\n repos pull (singular) materializes files; repos pulls manages review requests.\n";
2
+ export declare const PULLS_USAGE = "usage:\n seq-studio repos pulls list <ns>/<name> -e <env> [--state open|closed|merged] [--limit N] [--cursor <cursor>]\n seq-studio repos pulls show <ns>/<name> <number> -e <env>\n seq-studio repos pulls create <ns>/<name> --head <branch> --base <branch> --title <title> -e <env> [--body-file <path>]\n seq-studio repos pulls diff <ns>/<name> <number> -e <env> [--max-files N]\n seq-studio repos pulls merge <ns>/<name> <number> -e <env> [--method squash|merge|ff] [--message <text>] [--yes]\n seq-studio repos pulls edit <ns>/<name> <number> -e <env> [--title <title>] [--body <text> | --body-file <path>]\n seq-studio repos pulls close <ns>/<name> <number> -e <env>\n seq-studio repos pulls comment <ns>/<name> <number> -e <env> (--body <text> | --body-file <path>)\n [--path <file> --line N [--side LEFT|RIGHT] [--commit <sha>]] [--reply-to <comment-id>]\n seq-studio repos pulls comments <ns>/<name> <number> -e <env> [--limit N] [--cursor <cursor>]\n seq-studio repos pulls resolve <ns>/<name> <number> <root-comment-id> -e <env>\n seq-studio repos pulls unresolve <ns>/<name> <number> <root-comment-id> -e <env>\n seq-studio repos pulls review <ns>/<name> <number> -e <env> (--approve | --request-changes | --comment)\n [--body <text> | --body-file <path>] [--commit <sha>]\n seq-studio repos pulls reviews <ns>/<name> <number> -e <env> [--limit N] [--cursor <cursor>]\n seq-studio repos pulls checks <ns>/<name> <number> -e <env> [--head <sha>]\n\n All results are JSON (--json is accepted). Authenticate: seq-studio login --env <env>.\n create needs repository write; merge needs merge/admin authority and passing server\n review/check policy. There is no policy bypass. Review show and diff before merging.\n Merge operates on the current branch head under server policy. When repository CI\n checks the branch, merge sends the checked head and base revisions; a newer push\n makes the server refuse until checks rerun. Default merge method: squash.\n list returns one page with nextCursor; pass --cursor to continue.\n create, show and list add a web url field to each Pull (<env>/repositories/<ns>/<name>/pull/<n>).\n diff compares live base/head branches for open Pulls, recorded SHAs for terminal\n Pulls, and reports truncated when its file\n limit is reached (default 100, maximum 500).\n edit changes an open Pull's title and/or description (at least one). It needs the\n Pull's author or repository write; merged and closed Pulls cannot be edited. It\n prints the updated Pull like show.\n close needs to be the Pull's author or have repository write; it is idempotent.\n comment adds a Pull comment; --path and --line anchor it to a diff line (side RIGHT\n and the branch's current commit unless --side/--commit say otherwise), and\n --reply-to answers an existing thread. review records approve, request-changes, or\n comment against the commit the Pull's branch points at now (or --commit). checks prints the check runs,\n CI plan and runs, and merge gates (mergeability, reviews, code owners) in one object.\n resolve and unresolve require repository read access and a root comment UUID from\n comments; the server rejects replies. They return the updated comment as JSON.\n repos pull (singular) materializes files; repos pulls manages review requests.\n";
3
3
  /** Only the revisions this command needs from GET .../pulls/<n>/ci. */
4
4
  interface PullCiStatus {
5
5
  plan?: {
@@ -23,7 +23,7 @@ export declare function pullWebUrl({ baseUrl, repoPath, number }: {
23
23
  repoPath: string;
24
24
  number: number | string;
25
25
  }): string;
26
- /** Adds `url` to a Pull (create), `pullRequest` (show), or each `items` entry (list). */
26
+ /** Adds `url` to a Pull (create), `pullRequest` (show, edit), or each `items` entry (list). */
27
27
  export declare function addPullUrls({ action, result, baseUrl, repoPath }: {
28
28
  action: string;
29
29
  result: unknown;
@@ -31,6 +31,11 @@ export declare function addPullUrls({ action, result, baseUrl, repoPath }: {
31
31
  repoPath: string;
32
32
  }): unknown;
33
33
  export declare function commentBody(args: ParsedArgs): Promise<object>;
34
+ /** PATCH body for edit: a new title and/or description, bounded like the server. */
35
+ export declare function editBody(args: ParsedArgs): Promise<{
36
+ title?: string;
37
+ body?: string;
38
+ }>;
34
39
  export declare function reviewInput(args: ParsedArgs): Promise<{
35
40
  state: string;
36
41
  body?: string;
@@ -12,6 +12,7 @@ export const PULLS_USAGE = `usage:
12
12
  seq-studio repos pulls create <ns>/<name> --head <branch> --base <branch> --title <title> -e <env> [--body-file <path>]
13
13
  seq-studio repos pulls diff <ns>/<name> <number> -e <env> [--max-files N]
14
14
  seq-studio repos pulls merge <ns>/<name> <number> -e <env> [--method squash|merge|ff] [--message <text>] [--yes]
15
+ seq-studio repos pulls edit <ns>/<name> <number> -e <env> [--title <title>] [--body <text> | --body-file <path>]
15
16
  seq-studio repos pulls close <ns>/<name> <number> -e <env>
16
17
  seq-studio repos pulls comment <ns>/<name> <number> -e <env> (--body <text> | --body-file <path>)
17
18
  [--path <file> --line N [--side LEFT|RIGHT] [--commit <sha>]] [--reply-to <comment-id>]
@@ -34,6 +35,9 @@ export const PULLS_USAGE = `usage:
34
35
  diff compares live base/head branches for open Pulls, recorded SHAs for terminal
35
36
  Pulls, and reports truncated when its file
36
37
  limit is reached (default 100, maximum 500).
38
+ edit changes an open Pull's title and/or description (at least one). It needs the
39
+ Pull's author or repository write; merged and closed Pulls cannot be edited. It
40
+ prints the updated Pull like show.
37
41
  close needs to be the Pull's author or have repository write; it is idempotent.
38
42
  comment adds a Pull comment; --path and --line anchor it to a diff line (side RIGHT
39
43
  and the branch's current commit unless --side/--commit say otherwise), and
@@ -70,6 +74,7 @@ function actionFlags(action) {
70
74
  case 'create': return { head: 'string', base: 'string', title: 'string', 'body-file': 'string' };
71
75
  case 'diff': return { 'max-files': 'string' };
72
76
  case 'merge': return { method: 'string', message: 'string', yes: 'boolean' };
77
+ case 'edit': return { title: 'string', body: 'string', 'body-file': 'string' };
73
78
  case 'close': return {};
74
79
  case 'comment': return { body: 'string', 'body-file': 'string', path: 'string', line: 'string', side: 'string', commit: 'string', 'reply-to': 'string' };
75
80
  case 'comments':
@@ -102,7 +107,7 @@ function withPullUrl({ pull, baseUrl, repoPath }) {
102
107
  return pull;
103
108
  return { ...pull, url: pullWebUrl({ baseUrl, repoPath, number }) };
104
109
  }
105
- /** Adds `url` to a Pull (create), `pullRequest` (show), or each `items` entry (list). */
110
+ /** Adds `url` to a Pull (create), `pullRequest` (show, edit), or each `items` entry (list). */
106
111
  export function addPullUrls({ action, result, baseUrl, repoPath }) {
107
112
  const add = (pull) => withPullUrl({ pull, baseUrl, repoPath });
108
113
  const record = result;
@@ -110,13 +115,14 @@ export function addPullUrls({ action, result, baseUrl, repoPath }) {
110
115
  return result;
111
116
  if (action === 'create')
112
117
  return add(record);
113
- if (action === 'show' && record.pullRequest)
118
+ if ((action === 'show' || action === 'edit') && record.pullRequest)
114
119
  return { ...record, pullRequest: add(record.pullRequest) };
115
120
  if (action === 'list' && Array.isArray(record.items))
116
121
  return { ...record, items: record.items.map(add) };
117
122
  return result;
118
123
  }
119
124
  const MAX_BODY_LENGTH = 65_536;
125
+ const MAX_TITLE_LENGTH = 512;
120
126
  const COMMIT_SHA = /^[0-9a-f]{40}$/i;
121
127
  const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
122
128
  const REVIEW_STATES = { approve: 'approved', 'request-changes': 'changes_requested', comment: 'commented' };
@@ -168,6 +174,16 @@ export async function commentBody(args) {
168
174
  ...(typeof replyTo === 'string' ? { parentId: replyTo } : {}),
169
175
  };
170
176
  }
177
+ /** PATCH body for edit: a new title and/or description, bounded like the server. */
178
+ export async function editBody(args) {
179
+ const title = args.flags.title;
180
+ if (typeof title === 'string' && title.length > MAX_TITLE_LENGTH)
181
+ throw new Error('--title exceeds 512 characters.');
182
+ const body = await bodyText(args);
183
+ if (title === undefined && body === undefined)
184
+ throw new Error('edit requires --title <title>, --body <text>, or --body-file <path>.');
185
+ return { ...(typeof title === 'string' ? { title } : {}), ...(body !== undefined ? { body } : {}) };
186
+ }
171
187
  export async function reviewInput(args) {
172
188
  const chosen = Object.keys(REVIEW_STATES).filter((flag) => args.flags[flag] === true);
173
189
  if (chosen.length !== 1)
@@ -230,6 +246,8 @@ async function pullInput({ action, args }) {
230
246
  return { body: await createBody(args) };
231
247
  if (action === 'comment')
232
248
  return { body: await commentBody(args) };
249
+ if (action === 'edit')
250
+ return { body: await editBody(args) };
233
251
  if (action === 'review')
234
252
  return { review: await reviewInput(args) };
235
253
  if (action === 'checks')
@@ -259,6 +277,8 @@ async function reviewActionResult({ action, ctx, path, repoId, input }) {
259
277
  const options = clientOptions(ctx);
260
278
  if (action === 'close')
261
279
  return postJson({ ...options, path: `${path}/close` });
280
+ if (action === 'edit')
281
+ return patchJson({ ...options, path, body: input.body });
262
282
  if (action === 'checks')
263
283
  return pullChecks({ ctx, path, head: input.head });
264
284
  if (action === 'resolve' || action === 'unresolve') {
@@ -294,7 +314,7 @@ async function pullRead({ action, args, ctx, path, state, limit }) {
294
314
  const listPath = action === 'comments' || action === 'reviews' ? `${path}/${action}` : path;
295
315
  return getJson({ ...clientOptions(ctx), path: `${listPath}${query.size ? `?${query}` : ''}` });
296
316
  }
297
- const REVIEW_ACTIONS = new Set(['close', 'comment', 'review', 'checks', 'resolve', 'unresolve']);
317
+ const REVIEW_ACTIONS = new Set(['edit', 'close', 'comment', 'review', 'checks', 'resolve', 'unresolve']);
298
318
  export async function reposPullsCommand(input) {
299
319
  const [action, ...positional] = input.positional;
300
320
  if (!action || wantsHelp({ sub: action, args: input })) {
@@ -16,6 +16,8 @@
16
16
  },
17
17
  "scripts": {
18
18
  "lint": "seq-studio process lint",
19
+ "type-check": "tsc --noEmit",
20
+ "test": "node --test",
19
21
  "plan": "seq-studio process plan",
20
22
  "apply": "seq-studio process apply",
21
23
  "simulate": "seq-studio process simulate"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequenceholdings/studio-cli",
3
- "version": "0.9.13",
3
+ "version": "0.9.15",
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,15 +45,15 @@
45
45
  "yaml": "^2.8.4",
46
46
  "zod": "4.6.6",
47
47
  "@sequenceholdings/agent-spec": "0.1.5",
48
- "@sequenceholdings/artifact-studio": "0.11.12",
49
48
  "@sequenceholdings/lattice": "0.1.8",
50
- "@sequenceholdings/managed-functions": "0.5.9",
49
+ "@sequenceholdings/managed-functions": "0.5.10",
50
+ "@sequenceholdings/artifact-studio": "0.11.14",
51
51
  "@sequenceholdings/storage": "0.1.7",
52
52
  "@sequenceholdings/platform": "0.1.4"
53
53
  },
54
54
  "peerDependencies": {
55
- "@sequenceholdings/orm": "2.8.5",
56
- "@sequenceholdings/pipeline-spec": "0.3.8"
55
+ "@sequenceholdings/pipeline-spec": "0.3.9",
56
+ "@sequenceholdings/orm": "2.9.0"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@sequenceholdings/orm": {
@@ -68,9 +68,9 @@
68
68
  "@types/node": "^22.0.0",
69
69
  "@types/semver": "^7.8.0",
70
70
  "typescript": "^5.6.0",
71
- "vitest": "^4.1.11",
72
- "@sequenceholdings/orm": "2.8.5",
73
- "@sequenceholdings/pipeline-spec": "0.3.8"
71
+ "vitest": "^4.1.12",
72
+ "@sequenceholdings/orm": "2.9.0",
73
+ "@sequenceholdings/pipeline-spec": "0.3.9"
74
74
  },
75
75
  "engines": {
76
76
  "node": ">=20"
@@ -16,6 +16,8 @@
16
16
  },
17
17
  "scripts": {
18
18
  "lint": "seq-studio process lint",
19
+ "type-check": "tsc --noEmit",
20
+ "test": "node --test",
19
21
  "plan": "seq-studio process plan",
20
22
  "apply": "seq-studio process apply",
21
23
  "simulate": "seq-studio process simulate"