@sequenceholdings/studio-cli 0.7.2 → 0.9.1
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 +414 -55
- package/dist/access/commands.d.ts +1 -1
- package/dist/access/commands.js +102 -55
- package/dist/access/custom-role-hosts.d.ts +3 -0
- package/dist/access/custom-role-hosts.js +88 -0
- package/dist/access/group-rosters.d.ts +6 -0
- package/dist/access/group-rosters.js +33 -0
- package/dist/access/host-contract.d.ts +55 -0
- package/dist/access/host-contract.js +33 -0
- package/dist/access/hosts.d.ts +4 -0
- package/dist/access/hosts.js +60 -0
- package/dist/access/principal.d.ts +16 -0
- package/dist/access/principal.js +36 -0
- package/dist/access/roles.d.ts +18 -0
- package/dist/access/roles.js +89 -0
- package/dist/access/tier-hosts.d.ts +12 -0
- package/dist/access/tier-hosts.js +206 -0
- package/dist/agents/commands.d.ts +1 -1
- package/dist/agents/commands.js +76 -16
- package/dist/agents/scaffold.js +8 -3
- package/dist/app/commands.js +37 -12
- package/dist/app/manifest.d.ts +2 -2
- package/dist/app/official-source.d.ts +4 -2
- package/dist/app/official-source.js +6 -4
- package/dist/app/readme.js +2 -2
- package/dist/app/repository-index.d.ts +6 -0
- package/dist/app/repository-index.js +2 -2
- package/dist/app/workspace-model.js +4 -0
- package/dist/app/workspace-scaffold.js +5 -3
- package/dist/app/workspace.d.ts +2 -0
- package/dist/app/workspace.js +1 -1
- package/dist/artifact/delegate.js +26 -3
- package/dist/artifact/sandbox.js +2 -1
- package/dist/atlas-client.d.ts +15 -8
- package/dist/atlas-client.js +140 -64
- package/dist/bin.js +9 -1
- package/dist/cli-errors.js +4 -0
- package/dist/command-contract.d.ts +8 -2
- package/dist/command-contract.js +3 -2
- package/dist/command-help.d.ts +8 -6
- package/dist/command-help.js +65 -14
- package/dist/env-flags.d.ts +7 -0
- package/dist/env-flags.js +23 -0
- package/dist/functions/commands.js +66 -11
- package/dist/functions/manifest.d.ts +5 -0
- package/dist/functions/manifest.js +44 -23
- package/dist/functions/service-account-guidance.d.ts +21 -0
- package/dist/functions/service-account-guidance.js +62 -0
- package/dist/functions/workspace.d.ts +11 -0
- package/dist/functions/workspace.js +52 -0
- package/dist/machine-output.d.ts +7 -0
- package/dist/machine-output.js +56 -0
- package/dist/main.d.ts +2 -1
- package/dist/main.js +32 -4
- package/dist/orm/delegate.js +49 -6
- package/dist/orm/execute.js +11 -5
- package/dist/orm/failures.d.ts +32 -0
- package/dist/orm/failures.js +75 -0
- package/dist/orm/read.js +3 -3
- package/dist/orm/version-guard.d.ts +3 -0
- package/dist/orm/version-guard.js +63 -0
- package/dist/pipeline/commands.js +4 -1
- package/dist/principals/commands.d.ts +3 -0
- package/dist/principals/commands.js +124 -0
- package/dist/process/commands.js +9 -3
- package/dist/process/human-input-probe.d.ts +23 -0
- package/dist/process/human-input-probe.js +118 -0
- package/dist/process/lint.d.ts +2 -0
- package/dist/process/lint.js +10 -0
- package/dist/process/run-steps.d.ts +112 -0
- package/dist/process/run-steps.js +123 -0
- package/dist/process/runs.d.ts +4 -3
- package/dist/process/runs.js +69 -21
- package/dist/release-age.d.ts +1 -1
- package/dist/release-age.js +1 -0
- package/dist/repos/commands.d.ts +57 -0
- package/dist/repos/commands.js +83 -15
- package/dist/repos/init-repo.d.ts +45 -0
- package/dist/repos/init-repo.js +257 -0
- package/dist/repos/primitive-declaration.d.ts +43 -0
- package/dist/repos/primitive-declaration.js +212 -0
- package/dist/sandbox-unpushed-warning.d.ts +23 -0
- package/dist/sandbox-unpushed-warning.js +86 -0
- package/dist/service-accounts/commands.js +15 -3
- package/dist/templates/commands.d.ts +14 -2
- package/dist/templates/commands.js +70 -16
- package/dist/templates/process/pnpm-workspace.yaml +1 -0
- package/package.json +15 -12
- package/templates/process/pnpm-workspace.yaml +1 -0
|
@@ -15,15 +15,27 @@ export declare function promotionTargetsFromRegistry(path: string, configuredUrl
|
|
|
15
15
|
}>): Promise<string[]>;
|
|
16
16
|
export declare function validateTemplateTree(entries: readonly TreeEntry[]): TreeEntry[];
|
|
17
17
|
export declare function verifyReleaseFiles(files: readonly RemoteFile[], release: TemplateRelease): void;
|
|
18
|
-
export declare function initFromTemplate({ selection, target, environment }: {
|
|
18
|
+
export declare function initFromTemplate({ selection, target, environment, intoCheckout }: {
|
|
19
19
|
selection: string;
|
|
20
20
|
target: string;
|
|
21
21
|
environment: string;
|
|
22
|
+
/** The target may be a git-service checkout prepared by `init --repo`; see writeTemplateToDirectory. */
|
|
23
|
+
intoCheckout?: boolean;
|
|
22
24
|
}): Promise<void>;
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Verify a release and write it to `target`, which must be new or empty.
|
|
27
|
+
* With `intoCheckout` (from `init --repo`), `target` may instead be a fresh
|
|
28
|
+
* git-service checkout. There `.git` is never written, the template's README
|
|
29
|
+
* replaces the seed README (the seed is a placeholder; its marker exists only to
|
|
30
|
+
* mark the clone as safe to fill), and the checkout's `.seq/identity.json` wins
|
|
31
|
+
* over any the template carries: that receipt is the server-issued identity of
|
|
32
|
+
* THIS repository, and the template's would bind it to the template's source.
|
|
33
|
+
*/
|
|
34
|
+
export declare function writeTemplateToDirectory({ files, release, target, intoCheckout }: {
|
|
24
35
|
files: RemoteFile[];
|
|
25
36
|
release: TemplateRelease;
|
|
26
37
|
target: string;
|
|
38
|
+
intoCheckout?: boolean;
|
|
27
39
|
}): Promise<void>;
|
|
28
40
|
export declare function runTemplatesCommand(sub: string | undefined, args: ParsedArgs): Promise<number>;
|
|
29
41
|
export {};
|
|
@@ -6,6 +6,7 @@ import { AtlasApiError, getJson, getJsonOr404, postJson } from '../atlas-client.
|
|
|
6
6
|
import { readConfig } from '../config.js';
|
|
7
7
|
import { readRegisteredEnvironmentUrls } from '../env-registry.js';
|
|
8
8
|
import { buildContext, clientOptions } from '../functions/commands.js';
|
|
9
|
+
import { isGitServiceSeedReadme } from '../app/readme.js';
|
|
9
10
|
import { stringFlag } from '../repos/commands.js';
|
|
10
11
|
import { TEMPLATE_CATALOG_REPO, TEMPLATE_METADATA_PATH, TEMPLATE_NAMESPACE, TEMPLATE_RELEASE_PATH, ledgerPath, parseTemplateSelection, releaseBranch, targetIncludesRelease, templateDigest, templateMetadataSchema, templateReleaseSchema, validateTemplatePublishRoute, } from './catalog.js';
|
|
11
12
|
const LOG = '[seq-studio]';
|
|
@@ -376,7 +377,7 @@ async function list(args) {
|
|
|
376
377
|
}
|
|
377
378
|
return 0;
|
|
378
379
|
}
|
|
379
|
-
export async function initFromTemplate({ selection, target, environment }) {
|
|
380
|
+
export async function initFromTemplate({ selection, target, environment, intoCheckout = false }) {
|
|
380
381
|
const { name, version } = parseTemplateSelection(selection);
|
|
381
382
|
const ctx = await contextFor(environment);
|
|
382
383
|
const catalog = await findRepo(ctx, TEMPLATE_CATALOG_REPO);
|
|
@@ -389,33 +390,86 @@ export async function initFromTemplate({ selection, target, environment }) {
|
|
|
389
390
|
if (!repo)
|
|
390
391
|
throw new Error(`${TEMPLATE_NAMESPACE}/${name} is missing on ${environment}.`);
|
|
391
392
|
const files = await readFiles(ctx, repo, releaseBranch(version));
|
|
392
|
-
await writeTemplateToDirectory({ files, release, target });
|
|
393
|
+
await writeTemplateToDirectory({ files, release, target, intoCheckout });
|
|
393
394
|
console.log(`${LOG} initialized ${resolve(target)} from ${selection} on ${environment}`);
|
|
394
395
|
console.log(`${LOG} source: ${release.source.repo}@${release.source.commit} sha256:${release.digest}`);
|
|
395
396
|
}
|
|
396
|
-
|
|
397
|
+
/** The server-issued repository receipt a git-service clone starts with. */
|
|
398
|
+
const REPOSITORY_IDENTITY_PATH = '.seq/identity.json';
|
|
399
|
+
/** What a fresh git-service clone may already hold before a template lands in it. */
|
|
400
|
+
const CHECKOUT_ENTRIES = new Set(['.git', '.DS_Store', 'README.md', '.seq']);
|
|
401
|
+
/**
|
|
402
|
+
* Whether `dest` is a fresh git-service checkout a template may populate:
|
|
403
|
+
* Git metadata, the seed README (with its marker), and at most the issued
|
|
404
|
+
* `.seq/identity.json`. Anything else means real content, so it is refused.
|
|
405
|
+
*/
|
|
406
|
+
async function assertFreshCheckout(dest) {
|
|
407
|
+
const entries = await readdir(dest);
|
|
408
|
+
const foreign = entries.find((name) => !CHECKOUT_ENTRIES.has(name));
|
|
409
|
+
if (foreign)
|
|
410
|
+
throw new Error(`${dest} is not empty (${foreign}); a template fills only a new directory or a fresh git-service clone.`);
|
|
411
|
+
if (entries.includes('README.md') && !isGitServiceSeedReadme(await readFile(join(dest, 'README.md'), 'utf8'))) {
|
|
412
|
+
throw new Error(`${dest} already has a README.md that is not a git-service seed; refusing to overwrite it.`);
|
|
413
|
+
}
|
|
414
|
+
if (entries.includes('.seq') && (await readdir(join(dest, '.seq'))).some((name) => name !== 'identity.json')) {
|
|
415
|
+
throw new Error(`${dest}/.seq holds more than the issued identity.json; refusing to write a template into it.`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
/** Write the release's source files under `temp`; returns the paths written. */
|
|
419
|
+
async function stageTemplateFiles({ files, temp, intoCheckout }) {
|
|
420
|
+
const written = [];
|
|
421
|
+
for (const file of files) {
|
|
422
|
+
if (file.path === TEMPLATE_RELEASE_PATH)
|
|
423
|
+
continue;
|
|
424
|
+
assertSafePath(file.path);
|
|
425
|
+
if (intoCheckout && (file.path === '.git' || file.path.startsWith('.git/')))
|
|
426
|
+
throw new Error(`Unsafe template file path: ${file.path}`);
|
|
427
|
+
if (intoCheckout && file.path === REPOSITORY_IDENTITY_PATH)
|
|
428
|
+
continue;
|
|
429
|
+
const output = resolve(temp, file.path);
|
|
430
|
+
if (!output.startsWith(temp + sep))
|
|
431
|
+
throw new Error(`Unsafe template file path: ${file.path}`);
|
|
432
|
+
await mkdir(dirname(output), { recursive: true });
|
|
433
|
+
await writeFile(output, Buffer.from(file.content, 'base64'), { mode: file.mode === '100755' ? 0o755 : 0o644 });
|
|
434
|
+
written.push(file.path);
|
|
435
|
+
}
|
|
436
|
+
return written;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Verify a release and write it to `target`, which must be new or empty.
|
|
440
|
+
* With `intoCheckout` (from `init --repo`), `target` may instead be a fresh
|
|
441
|
+
* git-service checkout. There `.git` is never written, the template's README
|
|
442
|
+
* replaces the seed README (the seed is a placeholder; its marker exists only to
|
|
443
|
+
* mark the clone as safe to fill), and the checkout's `.seq/identity.json` wins
|
|
444
|
+
* over any the template carries: that receipt is the server-issued identity of
|
|
445
|
+
* THIS repository, and the template's would bind it to the template's source.
|
|
446
|
+
*/
|
|
447
|
+
export async function writeTemplateToDirectory({ files, release, target, intoCheckout = false }) {
|
|
397
448
|
verifyReleaseFiles(files, release);
|
|
398
449
|
const dest = resolve(target);
|
|
399
450
|
if ((await lstat(dest).catch(() => null))?.isSymbolicLink())
|
|
400
451
|
throw new Error(`${dest} is a symlink.`);
|
|
401
|
-
|
|
452
|
+
const populated = existsSync(dest) && (await readdir(dest)).length > 0;
|
|
453
|
+
if (populated && !intoCheckout)
|
|
402
454
|
throw new Error(`${dest} is not empty.`);
|
|
455
|
+
if (populated)
|
|
456
|
+
await assertFreshCheckout(dest);
|
|
403
457
|
await mkdir(dirname(dest), { recursive: true });
|
|
404
458
|
const temp = await mkdtemp(join(dirname(dest), `.${basename(dest)}-template-`));
|
|
405
459
|
try {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
throw new Error(`Unsafe template file path: ${file.path}`);
|
|
413
|
-
await mkdir(dirname(output), { recursive: true });
|
|
414
|
-
await writeFile(output, Buffer.from(file.content, 'base64'), { mode: file.mode === '100755' ? 0o755 : 0o644 });
|
|
460
|
+
const written = await stageTemplateFiles({ files, temp, intoCheckout: populated });
|
|
461
|
+
if (!populated) {
|
|
462
|
+
if (existsSync(dest))
|
|
463
|
+
await rmdir(dest);
|
|
464
|
+
await rename(temp, dest);
|
|
465
|
+
return;
|
|
415
466
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
467
|
+
// Everything verified and staged; move it into the checkout file by file.
|
|
468
|
+
for (const path of written) {
|
|
469
|
+
await mkdir(dirname(join(dest, path)), { recursive: true });
|
|
470
|
+
await rename(join(temp, path), join(dest, path));
|
|
471
|
+
}
|
|
472
|
+
await rm(temp, { recursive: true, force: true });
|
|
419
473
|
}
|
|
420
474
|
catch (error) {
|
|
421
475
|
await rm(temp, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
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": {
|
|
@@ -36,22 +36,24 @@
|
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"drizzle-orm": "^0.45.2",
|
|
39
40
|
"esbuild": "^0.25.0",
|
|
40
41
|
"js-yaml": "^4.3.2",
|
|
42
|
+
"semver": "^7.8.5",
|
|
41
43
|
"smol-toml": "^1.9.0",
|
|
42
44
|
"tsx": "^4.20.3",
|
|
43
|
-
"zod": "^4.1.13",
|
|
44
|
-
"drizzle-orm": "^0.45.2",
|
|
45
45
|
"yaml": "^2.8.4",
|
|
46
|
-
"
|
|
47
|
-
"@sequenceholdings/
|
|
48
|
-
"@sequenceholdings/
|
|
49
|
-
"@sequenceholdings/
|
|
50
|
-
"@sequenceholdings/
|
|
46
|
+
"zod": "^4.1.13",
|
|
47
|
+
"@sequenceholdings/agent-spec": "0.1.5",
|
|
48
|
+
"@sequenceholdings/artifact-studio": "0.11.1",
|
|
49
|
+
"@sequenceholdings/lattice": "0.1.8",
|
|
50
|
+
"@sequenceholdings/managed-functions": "0.5.1",
|
|
51
|
+
"@sequenceholdings/storage": "0.1.3",
|
|
52
|
+
"@sequenceholdings/platform": "0.1.0"
|
|
51
53
|
},
|
|
52
54
|
"peerDependencies": {
|
|
53
|
-
"@sequenceholdings/orm": "2.
|
|
54
|
-
"@sequenceholdings/pipeline-spec": "0.3.
|
|
55
|
+
"@sequenceholdings/orm": "2.8.1",
|
|
56
|
+
"@sequenceholdings/pipeline-spec": "0.3.1"
|
|
55
57
|
},
|
|
56
58
|
"peerDependenciesMeta": {
|
|
57
59
|
"@sequenceholdings/orm": {
|
|
@@ -64,10 +66,11 @@
|
|
|
64
66
|
"devDependencies": {
|
|
65
67
|
"@types/js-yaml": "^4.0.9",
|
|
66
68
|
"@types/node": "^22.0.0",
|
|
69
|
+
"@types/semver": "^7.8.0",
|
|
67
70
|
"typescript": "^5.6.0",
|
|
68
71
|
"vitest": "^4.1.11",
|
|
69
|
-
"@sequenceholdings/orm": "2.
|
|
70
|
-
"@sequenceholdings/pipeline-spec": "0.3.
|
|
72
|
+
"@sequenceholdings/orm": "2.8.1",
|
|
73
|
+
"@sequenceholdings/pipeline-spec": "0.3.1"
|
|
71
74
|
},
|
|
72
75
|
"engines": {
|
|
73
76
|
"node": ">=20"
|