@sequenceholdings/studio-cli 0.6.1 → 0.6.4
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 +186 -21
- package/dist/app/commands.d.ts +1 -1
- package/dist/app/commands.js +11 -6
- package/dist/app/deploy.js +4 -3
- package/dist/app/env-bindings.d.ts +3 -4
- package/dist/app/env-bindings.js +14 -77
- package/dist/app/readme.js +2 -2
- package/dist/app/repository-admission.d.ts +5 -0
- package/dist/app/repository-admission.js +32 -0
- package/dist/app/scaffold-files.js +8 -1
- package/dist/artifact/delegate.d.ts +4 -0
- package/dist/artifact/delegate.js +18 -8
- package/dist/artifact/sandbox.d.ts +29 -0
- package/dist/artifact/sandbox.js +109 -0
- package/dist/atlas-client.d.ts +1 -0
- package/dist/atlas-client.js +11 -2
- package/dist/auth-cmds/commands.js +3 -0
- package/dist/command-contract.d.ts +8 -2
- package/dist/command-contract.js +3 -2
- package/dist/command-help.d.ts +7 -4
- package/dist/command-help.js +43 -3
- package/dist/env-flags.d.ts +6 -0
- package/dist/env-flags.js +23 -1
- package/dist/envs/commands.js +30 -4
- package/dist/feedback/commands.d.ts +3 -0
- package/dist/feedback/commands.js +108 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +14 -16
- package/dist/orm/delegate.js +30 -11
- package/dist/orm/discover-schema.d.ts +196 -0
- package/dist/orm/discover-schema.js +84 -0
- package/dist/orm/discover.d.ts +13 -0
- package/dist/orm/discover.js +289 -0
- package/dist/pipeline/lifecycle.js +2 -1
- package/dist/pipeline/repin-orm.js +8 -1
- package/dist/pipeline/source.js +3 -0
- package/dist/repos/commands.js +9 -0
- package/dist/repos/identity-file.d.ts +17 -0
- package/dist/repos/identity-file.js +39 -0
- package/dist/repos/identity.d.ts +2 -0
- package/dist/repos/identity.js +69 -0
- package/dist/sandbox-auth.d.ts +11 -0
- package/dist/sandbox-auth.js +22 -0
- package/dist/update-check.d.ts +3 -1
- package/dist/update-check.js +38 -12
- package/package.json +3 -3
package/dist/update-check.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
2
3
|
import { mkdir, readFile, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
4
|
import { readFileSync } from 'node:fs';
|
|
4
5
|
import { homedir } from 'node:os';
|
|
5
6
|
import { dirname, join } from 'node:path';
|
|
6
7
|
import { fileURLToPath } from 'node:url';
|
|
7
8
|
/**
|
|
8
|
-
* Update notice: tell
|
|
9
|
-
* on npm, and strongly recommend upgrading.
|
|
9
|
+
* Update notice: tell CLI users and agents when a newer version is on npm.
|
|
10
10
|
*
|
|
11
11
|
* Zero foreground latency is the design constraint. The command path only
|
|
12
12
|
* ever *reads* the on-disk cache (~/.config/lattice/update-check.json) and
|
|
@@ -15,10 +15,12 @@ import { fileURLToPath } from 'node:url';
|
|
|
15
15
|
* record their attempt time so a downed registry doesn't retry on every
|
|
16
16
|
* command. An exclusive claim file elects a single refresher even across
|
|
17
17
|
* concurrent CLI invocations. The notice is therefore at most one
|
|
18
|
-
* invocation stale,
|
|
18
|
+
* invocation stale. A separate, exclusive receipt records one notice per
|
|
19
|
+
* installed/available version pair for this local user. Its write is the
|
|
20
|
+
* notification claim, so concurrent invocations cannot print duplicates.
|
|
19
21
|
*
|
|
20
|
-
* The notice goes to stderr
|
|
21
|
-
*
|
|
22
|
+
* The structured notice goes to stderr, leaving JSON stdout intact. CI and
|
|
23
|
+
* explicitly offline commands skip discovery. Opt out entirely with
|
|
22
24
|
* SEQ_STUDIO_NO_UPDATE_CHECK=1. Everything is best-effort: failures are
|
|
23
25
|
* silent and never affect the command's exit code.
|
|
24
26
|
*/
|
|
@@ -41,6 +43,11 @@ export function updateCheckCachePath() {
|
|
|
41
43
|
export function updateCheckClaimPath() {
|
|
42
44
|
return updateCheckCachePath() + '.claim';
|
|
43
45
|
}
|
|
46
|
+
/** Receipt is scoped to the local user cache and installed/available pair. */
|
|
47
|
+
export function updateNoticeReceiptPath(installed, available) {
|
|
48
|
+
const installation = createHash('sha256').update(dirname(fileURLToPath(import.meta.url))).digest('hex').slice(0, 16);
|
|
49
|
+
return join(dirname(updateCheckCachePath()), 'update-notices', installation, `${encodeURIComponent(installed)}--${encodeURIComponent(available)}.receipt`);
|
|
50
|
+
}
|
|
44
51
|
/**
|
|
45
52
|
* True when `candidate` is a strictly newer semver than `current`.
|
|
46
53
|
* Prerelease suffixes are ignored — the published channel is plain
|
|
@@ -162,8 +169,25 @@ function spawnBackgroundRefresh() {
|
|
|
162
169
|
child.on('error', () => { });
|
|
163
170
|
child.unref();
|
|
164
171
|
}
|
|
172
|
+
/** Exclusive creation is also the cross-process notice election. */
|
|
173
|
+
async function tryRecordNotice(installed, available) {
|
|
174
|
+
// Version strings originate in package metadata and the npm response. Keep
|
|
175
|
+
// their use as local path components conservative even though encoded.
|
|
176
|
+
if (!/^[0-9A-Za-z.+-]{1,80}$/.test(installed) || !/^[0-9A-Za-z.+-]{1,80}$/.test(available))
|
|
177
|
+
return false;
|
|
178
|
+
const path = updateNoticeReceiptPath(installed, available);
|
|
179
|
+
try {
|
|
180
|
+
await mkdir(dirname(path), { recursive: true });
|
|
181
|
+
await writeFile(path, JSON.stringify({ installedVersion: installed, availableVersion: available }) + '\n', { flag: 'wx' });
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
// Existing receipt or read-only cache: never interrupt the actual command.
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
165
189
|
/**
|
|
166
|
-
* Print
|
|
190
|
+
* Print one structured upgrade notice to stderr when the cached registry
|
|
167
191
|
* state says a newer version is published, and kick off a detached refresh
|
|
168
192
|
* when the cache is stale. Reads only local state — adds no network latency
|
|
169
193
|
* to the command. Never throws.
|
|
@@ -174,8 +198,6 @@ export async function maybeNotifyUpdate() {
|
|
|
174
198
|
return;
|
|
175
199
|
if (isCiEnvironment())
|
|
176
200
|
return;
|
|
177
|
-
if (!process.stderr.isTTY)
|
|
178
|
-
return;
|
|
179
201
|
const cache = await readCache();
|
|
180
202
|
if (!cache || Date.now() - cache.lastCheckedAt > CHECK_INTERVAL_MS) {
|
|
181
203
|
// Exactly one process refreshes: the exclusive claim file elects a
|
|
@@ -189,10 +211,14 @@ export async function maybeNotifyUpdate() {
|
|
|
189
211
|
const current = currentVersion();
|
|
190
212
|
if (!latest || !isNewerVersion(latest, current))
|
|
191
213
|
return;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
214
|
+
if (!await tryRecordNotice(current, latest))
|
|
215
|
+
return;
|
|
216
|
+
process.stderr.write('SEQ_STUDIO_UPDATE_NOTICE ' + JSON.stringify({
|
|
217
|
+
installedVersion: current,
|
|
218
|
+
availableVersion: latest,
|
|
219
|
+
package: PACKAGE_NAME,
|
|
220
|
+
guidance: 'Check project pins and permissions before updating; then verify seq-studio version and relevant --help.',
|
|
221
|
+
}) + '\n');
|
|
196
222
|
}
|
|
197
223
|
catch {
|
|
198
224
|
// Best-effort by design — an update notice must never break a command.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequenceholdings/studio-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"tsx": "^4.20.3",
|
|
43
43
|
"zod": "^4.1.13",
|
|
44
44
|
"yaml": "^2.8.4",
|
|
45
|
-
"@sequenceholdings/artifact-studio": "0.9.1",
|
|
46
|
-
"@sequenceholdings/lattice": "0.1.6",
|
|
47
45
|
"@sequenceholdings/agent-spec": "0.1.4",
|
|
46
|
+
"@sequenceholdings/artifact-studio": "0.9.2",
|
|
47
|
+
"@sequenceholdings/lattice": "0.1.6",
|
|
48
48
|
"@sequenceholdings/managed-functions": "0.4.3",
|
|
49
49
|
"@sequenceholdings/storage": "0.1.2"
|
|
50
50
|
},
|