orizu 0.5.49 → 0.5.50
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/dist/account-directory.d.ts +2 -2
- package/dist/account-directory.d.ts.map +1 -1
- package/dist/account-directory.js +7 -32
- package/dist/auth-commands.d.ts.map +1 -1
- package/dist/auth-commands.js +22 -30
- package/dist/credentials.d.ts +5 -0
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +84 -3
- package/dist/dataset-transfer-upload.d.ts.map +1 -1
- package/dist/dataset-transfer-upload.js +6 -1
- package/dist/directory-list-read.d.ts +37 -0
- package/dist/directory-list-read.d.ts.map +1 -0
- package/dist/directory-list-read.js +87 -0
- package/dist/hosted-boot.d.ts.map +1 -1
- package/dist/hosted-boot.js +59 -41
- package/dist/hosted-harness-opencode.d.ts +31 -0
- package/dist/hosted-harness-opencode.d.ts.map +1 -1
- package/dist/hosted-harness-opencode.js +45 -7
- package/dist/hosted-loop.d.ts +39 -2
- package/dist/hosted-loop.d.ts.map +1 -1
- package/dist/hosted-loop.js +127 -18
- package/dist/hosted-session-seed.d.ts +2 -0
- package/dist/hosted-session-seed.d.ts.map +1 -1
- package/dist/hosted-session-seed.js +27 -10
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +39 -234
- package/dist/keyboard-select.d.ts.map +1 -1
- package/dist/keyboard-select.js +23 -45
- package/dist/project-create-workflow.d.ts +18 -0
- package/dist/project-create-workflow.d.ts.map +1 -0
- package/dist/project-create-workflow.js +121 -0
- package/dist/self-update-command.d.ts +8 -0
- package/dist/self-update-command.d.ts.map +1 -0
- package/dist/self-update-command.js +390 -0
- package/dist/self-update.d.ts +29 -16
- package/dist/self-update.d.ts.map +1 -1
- package/dist/self-update.js +55 -244
- package/dist/setup-account.d.ts.map +1 -1
- package/dist/setup-account.js +4 -1
- package/dist/setup-and-skills-commands.d.ts.map +1 -1
- package/dist/setup-and-skills-commands.js +88 -102
- package/dist/skill-install-workflow.d.ts +23 -0
- package/dist/skill-install-workflow.d.ts.map +1 -0
- package/dist/skill-install-workflow.js +184 -0
- package/dist/skill-installer.d.ts +8 -3
- package/dist/skill-installer.d.ts.map +1 -1
- package/dist/skill-installer.js +26 -33
- package/dist/stored-session-requests.d.ts +27 -0
- package/dist/stored-session-requests.d.ts.map +1 -0
- package/dist/stored-session-requests.js +264 -0
- package/dist/terminal-key-session.d.ts +23 -0
- package/dist/terminal-key-session.d.ts.map +1 -0
- package/dist/terminal-key-session.js +74 -0
- package/package.json +1 -1
- package/src/account-directory.ts +8 -42
- package/src/auth-commands.ts +20 -29
- package/src/credentials.ts +83 -3
- package/src/dataset-transfer-upload.ts +7 -1
- package/src/directory-list-read.ts +123 -0
- package/src/hosted-boot.ts +65 -43
- package/src/hosted-harness-opencode.ts +65 -9
- package/src/hosted-loop.ts +152 -18
- package/src/hosted-session-seed.ts +25 -8
- package/src/http.ts +39 -317
- package/src/keyboard-select.ts +18 -55
- package/src/project-create-workflow.ts +139 -0
- package/src/self-update-command.ts +419 -0
- package/src/self-update.ts +70 -266
- package/src/setup-account.ts +4 -1
- package/src/setup-and-skills-commands.ts +89 -121
- package/src/skill-install-workflow.ts +215 -0
- package/src/skill-installer.ts +31 -38
- package/src/stored-session-requests.ts +316 -0
- package/src/terminal-key-session.ts +88 -0
package/dist/self-update.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { spawn
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
2
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync, } from 'fs';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
4
|
import { basename, dirname, join } from 'path';
|
|
5
|
-
import { stderr as errorOutput, stdout as output } from 'process';
|
|
6
5
|
import { parseGlobalFlags } from './global-flags.js';
|
|
7
|
-
import { sanitizeTerminalText } from './json-response.js';
|
|
8
6
|
import { findUnknownOption } from './option-validation.js';
|
|
9
|
-
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000, CHECK_TIMEOUT_MS = 5_000
|
|
7
|
+
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000, CHECK_TIMEOUT_MS = 5_000;
|
|
10
8
|
// A claim file outliving this window belongs to a process that died mid-claim;
|
|
11
9
|
// treating it as live would silently disable the daily refresh forever.
|
|
12
10
|
const ABANDONED_CLAIM_MS = 60_000;
|
|
13
|
-
const
|
|
14
|
-
const MANUAL_INSTALL_COMMAND = 'npm i -g orizu@latest';
|
|
11
|
+
export const MANUAL_INSTALL_COMMAND = 'npm i -g orizu@latest';
|
|
15
12
|
const UPDATE_OPTIONS = new Set(['--dry-run', '--json', '--refresh-cache']);
|
|
16
13
|
const UPDATE_USAGE = 'Usage: orizu update [--dry-run] [--json]';
|
|
17
14
|
export const defaultPassiveUpdateIo = { exit: process.exit, spawn };
|
|
@@ -106,7 +103,7 @@ function writeCache(latest) {
|
|
|
106
103
|
writeFileSync(temporary, `${JSON.stringify({ checkedAt: new Date().toISOString(), latest }, null, 2)}\n`);
|
|
107
104
|
renameSync(temporary, path);
|
|
108
105
|
}
|
|
109
|
-
function tryWriteCache(latest) {
|
|
106
|
+
export function tryWriteCache(latest) {
|
|
110
107
|
try {
|
|
111
108
|
writeCache(latest);
|
|
112
109
|
}
|
|
@@ -164,7 +161,7 @@ function claimPassiveRefresh(previousCache) {
|
|
|
164
161
|
}
|
|
165
162
|
}
|
|
166
163
|
}
|
|
167
|
-
function resolveUpdateRegistry() {
|
|
164
|
+
export function resolveUpdateRegistry() {
|
|
168
165
|
const registry = process.env.ORIZU_UPDATE_REGISTRY ?? 'https://registry.npmjs.org';
|
|
169
166
|
let parsed;
|
|
170
167
|
try {
|
|
@@ -178,7 +175,7 @@ function resolveUpdateRegistry() {
|
|
|
178
175
|
}
|
|
179
176
|
return registry.replace(/\/+$/u, '');
|
|
180
177
|
}
|
|
181
|
-
async function resolveLatest(registry = resolveUpdateRegistry()) {
|
|
178
|
+
export async function resolveLatest(registry = resolveUpdateRegistry()) {
|
|
182
179
|
const response = await fetch(`${registry}/orizu/latest`, {
|
|
183
180
|
headers: { accept: 'application/json' },
|
|
184
181
|
signal: AbortSignal.timeout(CHECK_TIMEOUT_MS),
|
|
@@ -191,247 +188,14 @@ async function resolveLatest(registry = resolveUpdateRegistry()) {
|
|
|
191
188
|
parseSemver(body.version);
|
|
192
189
|
return body.version;
|
|
193
190
|
}
|
|
194
|
-
function npmInvocation() {
|
|
191
|
+
export function npmInvocation() {
|
|
195
192
|
// Windows is refused in detectNpmGlobalInstall, so only the POSIX layout is reachable here.
|
|
196
193
|
const sibling = join(dirname(process.execPath), 'npm');
|
|
197
194
|
return { command: existsSync(sibling) ? sibling : 'npm', args: [] };
|
|
198
195
|
}
|
|
199
|
-
function cliInvocation(install, args) {
|
|
196
|
+
export function cliInvocation(install, args) {
|
|
200
197
|
return { command: install.binPath, args };
|
|
201
198
|
}
|
|
202
|
-
function verifyTimeoutMs() {
|
|
203
|
-
const override = process.env.ORIZU_UPDATE_TEST_VERIFY_TIMEOUT_MS;
|
|
204
|
-
if (override === undefined)
|
|
205
|
-
return CHILD_TIMEOUT_MS;
|
|
206
|
-
const parsed = Number(override);
|
|
207
|
-
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : CHILD_TIMEOUT_MS;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Refresh managed skills through the given CLI binary and classify the outcome
|
|
211
|
-
* from the child's --json report, never from its human text: an install with
|
|
212
|
-
* no skill targets reports 'none', the one state a caller of `update --json`
|
|
213
|
-
* most needs to see (ADR-001 coupling).
|
|
214
|
-
*/
|
|
215
|
-
async function refreshManagedSkills(command, args, io) {
|
|
216
|
-
const child = await runStreaming(command, [...args, 'skills', 'update', '--json'], io, CHILD_TIMEOUT_MS, undefined, true);
|
|
217
|
-
if (child.status !== 0)
|
|
218
|
-
return { status: child.status, timedOut: child.timedOut, skills: 'none' };
|
|
219
|
-
let updates;
|
|
220
|
-
try {
|
|
221
|
-
const parsed = JSON.parse(child.stdout || '');
|
|
222
|
-
if (!Array.isArray(parsed.updates))
|
|
223
|
-
throw new Error('missing updates');
|
|
224
|
-
updates = parsed.updates;
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
return { status: 1, timedOut: false, skills: 'none' };
|
|
228
|
-
}
|
|
229
|
-
if (!io.json) {
|
|
230
|
-
if (updates.length === 0)
|
|
231
|
-
io.printLine('No Orizu skill installs found. Run `orizu install-skill` first.');
|
|
232
|
-
for (const update of updates) {
|
|
233
|
-
const path = sanitizeTerminalText(String(update.path ?? ''));
|
|
234
|
-
if (update.action === 'already-current')
|
|
235
|
-
io.printLine(`Current ${path}`);
|
|
236
|
-
else if (update.action === 'relinked')
|
|
237
|
-
io.printLine(`Relinked ${path}`);
|
|
238
|
-
else
|
|
239
|
-
io.printLine(`Updated ${path}`);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
if (updates.length === 0)
|
|
243
|
-
return { status: 0, timedOut: false, skills: 'none' };
|
|
244
|
-
const refreshed = updates.some(update => update.action !== 'already-current');
|
|
245
|
-
return { status: 0, timedOut: false, skills: refreshed ? 'refreshed' : 'already-current' };
|
|
246
|
-
}
|
|
247
|
-
function runStreaming(command, args, io, timeoutMs, onStdout, captureStdout = false) {
|
|
248
|
-
return new Promise(resolve => {
|
|
249
|
-
let stderr = '';
|
|
250
|
-
let stdout = '';
|
|
251
|
-
let settled = false;
|
|
252
|
-
let timedOut = false;
|
|
253
|
-
let timer;
|
|
254
|
-
const finish = (status) => {
|
|
255
|
-
if (settled)
|
|
256
|
-
return;
|
|
257
|
-
settled = true;
|
|
258
|
-
if (timer)
|
|
259
|
-
clearTimeout(timer);
|
|
260
|
-
resolve({ status, stderr: stderr.slice(-STDERR_TAIL_CHARS), stdout, timedOut });
|
|
261
|
-
};
|
|
262
|
-
const child = spawn(command, args, {
|
|
263
|
-
env: { ...process.env, ORIZU_NO_UPDATE_CHECK: '1' },
|
|
264
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
265
|
-
});
|
|
266
|
-
if (timeoutMs !== undefined) {
|
|
267
|
-
timer = setTimeout(() => {
|
|
268
|
-
timedOut = true;
|
|
269
|
-
child.kill('SIGKILL');
|
|
270
|
-
}, timeoutMs);
|
|
271
|
-
}
|
|
272
|
-
child.stdout?.on('data', chunk => {
|
|
273
|
-
const text = sanitizeTerminalText(chunk);
|
|
274
|
-
onStdout?.(text);
|
|
275
|
-
if (captureStdout) {
|
|
276
|
-
stdout = `${stdout}${text}`;
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (io.json)
|
|
280
|
-
errorOutput.write(text);
|
|
281
|
-
else
|
|
282
|
-
output.write(text);
|
|
283
|
-
});
|
|
284
|
-
child.stderr?.on('data', chunk => {
|
|
285
|
-
const text = sanitizeTerminalText(chunk);
|
|
286
|
-
stderr = `${stderr}${text}`.slice(-STDERR_TAIL_CHARS);
|
|
287
|
-
errorOutput.write(text);
|
|
288
|
-
});
|
|
289
|
-
child.once('error', error => {
|
|
290
|
-
stderr = `${stderr}${sanitizeTerminalText(error.message)}`;
|
|
291
|
-
finish(1);
|
|
292
|
-
});
|
|
293
|
-
child.once('close', code => finish(code ?? 1));
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
function emit(io, result) {
|
|
297
|
-
if (io.json)
|
|
298
|
-
io.printLine(JSON.stringify(result));
|
|
299
|
-
}
|
|
300
|
-
function fail(io, code, detail, result) {
|
|
301
|
-
io.printError(`${code}: ${detail}`);
|
|
302
|
-
emit(io, result);
|
|
303
|
-
return 1;
|
|
304
|
-
}
|
|
305
|
-
export async function selfUpdateCommand(io) {
|
|
306
|
-
if (io.refreshCache) {
|
|
307
|
-
const oldCache = readCache();
|
|
308
|
-
try {
|
|
309
|
-
writeCache(await resolveLatest());
|
|
310
|
-
}
|
|
311
|
-
catch {
|
|
312
|
-
tryWriteCache(oldCache?.latest ?? null);
|
|
313
|
-
}
|
|
314
|
-
return 0;
|
|
315
|
-
}
|
|
316
|
-
const install = detectNpmGlobalInstall();
|
|
317
|
-
if (!install) {
|
|
318
|
-
return fail(io, 'update_unsupported_install', `orizu is not installed npm-globally. Run \`${MANUAL_INSTALL_COMMAND}\`.`, {
|
|
319
|
-
installed: io.installed, latest: null, action: 'unsupported', prefix: null, skills: 'not-run',
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
let latest;
|
|
323
|
-
let registry;
|
|
324
|
-
try {
|
|
325
|
-
registry = resolveUpdateRegistry();
|
|
326
|
-
latest = await resolveLatest(registry);
|
|
327
|
-
tryWriteCache(latest);
|
|
328
|
-
}
|
|
329
|
-
catch (error) {
|
|
330
|
-
return fail(io, 'update_check_failed', sanitizeTerminalText(error instanceof Error ? error.message : error), {
|
|
331
|
-
installed: io.installed, latest: null, action: 'check-failed', prefix: install.prefix, skills: 'not-run',
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
if (compareSemver(io.installed, latest) >= 0) {
|
|
335
|
-
if (!io.json)
|
|
336
|
-
io.printLine(`orizu ${io.installed} is already the latest.`);
|
|
337
|
-
if (io.dryRun) {
|
|
338
|
-
emit(io, { installed: io.installed, latest, action: 'already-latest', prefix: install.prefix, skills: 'not-run' });
|
|
339
|
-
return 0;
|
|
340
|
-
}
|
|
341
|
-
const skills = await refreshManagedSkills(install.binPath, [], io);
|
|
342
|
-
if (skills.status !== 0) {
|
|
343
|
-
const detail = skills.timedOut
|
|
344
|
-
? 'orizu is already the latest, but its managed skills refresh timed out.'
|
|
345
|
-
: 'orizu is already the latest, but its managed skills could not be refreshed.';
|
|
346
|
-
return fail(io, 'update_skills_refresh_failed', detail, {
|
|
347
|
-
installed: io.installed, latest, action: 'already-latest', prefix: install.prefix, skills: 'refresh-failed',
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
emit(io, { installed: io.installed, latest, action: 'already-latest', prefix: install.prefix, skills: skills.skills });
|
|
351
|
-
return 0;
|
|
352
|
-
}
|
|
353
|
-
if (io.dryRun) {
|
|
354
|
-
if (!io.json)
|
|
355
|
-
io.printLine(`Would update orizu ${io.installed} → ${latest} in ${install.prefix}.`);
|
|
356
|
-
emit(io, { installed: io.installed, latest, action: 'would-update', prefix: install.prefix, skills: 'would-refresh' });
|
|
357
|
-
return 0;
|
|
358
|
-
}
|
|
359
|
-
const npmCommand = npmInvocation();
|
|
360
|
-
const registryArgs = process.env.ORIZU_UPDATE_REGISTRY !== undefined
|
|
361
|
-
? ['--registry', registry]
|
|
362
|
-
: [];
|
|
363
|
-
const npm = await runStreaming(npmCommand.command, [...npmCommand.args,
|
|
364
|
-
'install', '-g', `orizu@${latest}`, '--prefix', install.prefix, '--no-audit', '--no-fund',
|
|
365
|
-
...registryArgs,
|
|
366
|
-
], io);
|
|
367
|
-
if (npm.status !== 0) {
|
|
368
|
-
const tail = npm.stderr.trim() ? ` npm stderr tail: ${npm.stderr.trim()}` : '';
|
|
369
|
-
return fail(io, 'update_install_failed', `${tail} Run \`${MANUAL_INSTALL_COMMAND}\`.`, {
|
|
370
|
-
installed: io.installed, latest, action: 'install-failed', prefix: install.prefix, skills: 'not-run',
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
const verifyCommand = cliInvocation(install, ['--version']);
|
|
374
|
-
const verificationTimeoutMs = verifyTimeoutMs();
|
|
375
|
-
const verified = spawnSync(verifyCommand.command, verifyCommand.args, {
|
|
376
|
-
encoding: 'utf8',
|
|
377
|
-
env: { ...process.env, ORIZU_NO_UPDATE_CHECK: '1' },
|
|
378
|
-
killSignal: 'SIGKILL',
|
|
379
|
-
timeout: verificationTimeoutMs,
|
|
380
|
-
});
|
|
381
|
-
const observed = sanitizeTerminalText(verified.stdout || '').trim();
|
|
382
|
-
if (verified.error?.code === 'ETIMEDOUT') {
|
|
383
|
-
return fail(io, 'update_verify_mismatch', `verification timed out after ${verificationTimeoutMs} ms.`, {
|
|
384
|
-
installed: io.installed, latest, action: 'verify-mismatch', prefix: install.prefix, skills: 'not-run',
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
if (verified.status !== 0 || observed !== `orizu ${latest}`) {
|
|
388
|
-
const launchError = verified.error ? ` launch error: ${sanitizeTerminalText(verified.error.message)}.` : '';
|
|
389
|
-
const exit = verified.status === null ? `signal ${verified.signal ?? 'unknown'}` : `exit ${verified.status}`;
|
|
390
|
-
const errorTail = sanitizeTerminalText(verified.stderr || '').trim().split('\n').slice(-3).join(' ');
|
|
391
|
-
const detail = `expected orizu ${latest}, observed ${observed || '<no version>'} (${exit}).${launchError}${errorTail ? ` ${errorTail}` : ''}`;
|
|
392
|
-
return fail(io, 'update_verify_mismatch', `${detail} Run \`${MANUAL_INSTALL_COMMAND}\` to reinstall.`, {
|
|
393
|
-
installed: io.installed, latest, action: 'verify-mismatch', prefix: install.prefix, skills: 'not-run',
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
if (!io.json)
|
|
397
|
-
io.printLine(`orizu ${latest} installed.`);
|
|
398
|
-
const skillsCommand = cliInvocation(install, []);
|
|
399
|
-
const skills = await refreshManagedSkills(skillsCommand.command, skillsCommand.args, io);
|
|
400
|
-
if (skills.status !== 0) {
|
|
401
|
-
const detail = skills.timedOut
|
|
402
|
-
? 'the CLI was updated, but its managed skills refresh timed out.'
|
|
403
|
-
: 'the CLI was updated, but its managed skills could not be refreshed.';
|
|
404
|
-
return fail(io, 'update_skills_refresh_failed', detail, {
|
|
405
|
-
installed: io.installed, latest, action: 'updated', prefix: install.prefix, skills: 'refresh-failed',
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
emit(io, { installed: io.installed, latest, action: 'updated', prefix: install.prefix, skills: skills.skills });
|
|
409
|
-
return 0;
|
|
410
|
-
}
|
|
411
|
-
export async function runUpdateCommand(rawArgs, io) {
|
|
412
|
-
const commandIndex = rawArgs.indexOf('update');
|
|
413
|
-
const args = commandIndex === -1
|
|
414
|
-
? rawArgs
|
|
415
|
-
: [...rawArgs.slice(0, commandIndex), ...rawArgs.slice(commandIndex + 1)];
|
|
416
|
-
const unknownOption = findUnknownOption(args, UPDATE_OPTIONS);
|
|
417
|
-
if (unknownOption) {
|
|
418
|
-
io.printError(`unknown option ${unknownOption}\n${UPDATE_USAGE}`);
|
|
419
|
-
return 1;
|
|
420
|
-
}
|
|
421
|
-
const positional = args.find(argument => argument === '-' || !argument.startsWith('-'));
|
|
422
|
-
if (positional) {
|
|
423
|
-
io.printError(`unexpected argument ${positional}\n${UPDATE_USAGE}`);
|
|
424
|
-
return 1;
|
|
425
|
-
}
|
|
426
|
-
return selfUpdateCommand({
|
|
427
|
-
dryRun: args.includes('--dry-run'),
|
|
428
|
-
installed: io.getCliVersion(),
|
|
429
|
-
json: io.json,
|
|
430
|
-
printLine: io.printLine,
|
|
431
|
-
printError: io.printError,
|
|
432
|
-
refreshCache: args.includes('--refresh-cache'),
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
199
|
function isPassiveUpdateDisabled() {
|
|
436
200
|
return process.env.ORIZU_NO_UPDATE_CHECK !== undefined || process.env.CI !== undefined ||
|
|
437
201
|
process.env.NO_UPDATE_NOTIFIER !== undefined;
|
|
@@ -504,3 +268,50 @@ export function finishPassiveUpdate(state, printError, io = defaultPassiveUpdate
|
|
|
504
268
|
// Passive update checks never affect the command that just completed.
|
|
505
269
|
}
|
|
506
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* `orizu update`. Checking the arguments, the daily background cache refresh
|
|
273
|
+
* and refusing an install npm doesn't own stay plain code; only an update of
|
|
274
|
+
* an npm-global install loads the Effect workflow (ORI-2424).
|
|
275
|
+
*/
|
|
276
|
+
export async function runUpdateCommand(rawArgs, io) {
|
|
277
|
+
const commandIndex = rawArgs.indexOf('update');
|
|
278
|
+
const args = commandIndex === -1
|
|
279
|
+
? rawArgs
|
|
280
|
+
: [...rawArgs.slice(0, commandIndex), ...rawArgs.slice(commandIndex + 1)];
|
|
281
|
+
const unknownOption = findUnknownOption(args, UPDATE_OPTIONS);
|
|
282
|
+
if (unknownOption) {
|
|
283
|
+
io.printError(`unknown option ${unknownOption}\n${UPDATE_USAGE}`);
|
|
284
|
+
return 1;
|
|
285
|
+
}
|
|
286
|
+
const positional = args.find(argument => argument === '-' || !argument.startsWith('-'));
|
|
287
|
+
if (positional) {
|
|
288
|
+
io.printError(`unexpected argument ${positional}\n${UPDATE_USAGE}`);
|
|
289
|
+
return 1;
|
|
290
|
+
}
|
|
291
|
+
if (args.includes('--refresh-cache')) {
|
|
292
|
+
const oldCache = readCache();
|
|
293
|
+
try {
|
|
294
|
+
writeCache(await resolveLatest());
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
tryWriteCache(oldCache?.latest ?? null);
|
|
298
|
+
}
|
|
299
|
+
return 0;
|
|
300
|
+
}
|
|
301
|
+
const installed = io.getCliVersion();
|
|
302
|
+
const install = detectNpmGlobalInstall();
|
|
303
|
+
if (!install) {
|
|
304
|
+
io.printError(`update_unsupported_install: orizu is not installed npm-globally. Run \`${MANUAL_INSTALL_COMMAND}\`.`);
|
|
305
|
+
if (io.json)
|
|
306
|
+
io.printLine(JSON.stringify({ installed, latest: null, action: 'unsupported', prefix: null, skills: 'not-run' }));
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
309
|
+
const { runSelfUpdate } = await import('./self-update-command.js');
|
|
310
|
+
return runSelfUpdate({
|
|
311
|
+
dryRun: args.includes('--dry-run'),
|
|
312
|
+
installed,
|
|
313
|
+
json: io.json,
|
|
314
|
+
printLine: io.printLine,
|
|
315
|
+
printError: io.printError,
|
|
316
|
+
}, install);
|
|
317
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-account.d.ts","sourceRoot":"","sources":["../src/setup-account.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-account.d.ts","sourceRoot":"","sources":["../src/setup-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,WAAW,CAAA;AAElB,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,GAAG,YAAY,CAAA;IACjC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,sBAAsB,IAAI,cAAc,CAOvD;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA2BjE;AA8DD,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,2BAA2B,EACpC,aAAa,EAAE,CAAC,eAAe,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,EAC1E,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAClC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC,CAgBnC"}
|
package/dist/setup-account.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hasResolvableAuth } from './credentials.js';
|
|
2
|
+
import { datasetTransferTimeoutMs } from './dataset-transfer-policy.js';
|
|
2
3
|
import { getBaseUrl, } from './http.js';
|
|
3
4
|
export function describeSetupAuthState() {
|
|
4
5
|
const baseUrl = getBaseUrl();
|
|
@@ -58,9 +59,11 @@ function isCredentialStoreError(error) {
|
|
|
58
59
|
return error instanceof Error && /^ORIZU_CREDENTIALS_[A-Z_]+:/.test(error.message);
|
|
59
60
|
}
|
|
60
61
|
async function fetchSetupDisplayIdentity(context) {
|
|
62
|
+
// One limit covers the request and reading its reply.
|
|
63
|
+
const signal = AbortSignal.timeout(datasetTransferTimeoutMs());
|
|
61
64
|
let response;
|
|
62
65
|
try {
|
|
63
|
-
response = await context.fetch('/api/cli/auth/whoami');
|
|
66
|
+
response = await context.fetch('/api/cli/auth/whoami', { signal });
|
|
64
67
|
}
|
|
65
68
|
catch (error) {
|
|
66
69
|
if (isCredentialStoreError(error))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-and-skills-commands.d.ts","sourceRoot":"","sources":["../src/setup-and-skills-commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-and-skills-commands.d.ts","sourceRoot":"","sources":["../src/setup-and-skills-commands.ts"],"names":[],"mappings":"AAqFA,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAW,MAAM,wBAAwB,CAAA;AAMjF,iBAAe,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAY/E;AAqZD,iBAAe,mBAAmB,kBAwCjC;AA6FD,iBAAS,mBAAmB,SA0D3B;AAED,iBAAe,mBAAmB,kBAoGjC;AAED,iBAAS,iBAAiB,SAgBzB;AAMD,iBAAe,gBAAgB,CAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,EACf,iBAAiB,EAAE,MAAM,GAAG,IAAI,EAChC,OAAO,GAAE,oBAAkC,GAC1C,OAAO,CAAC,IAAI,CAAC,CA6Cf;AA4ID,iBAAe,YAAY,kBAwX1B;AAED,iBAAS,kBAAkB,SAS1B;AAED,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,QAAQ,GACT,CAAA"}
|