aegisone 1.0.20 → 1.0.21
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 +1 -1
- package/package.json +2 -1
- package/scripts/predist.mjs +13 -2
- package/vendor/cli/bin/aegiscode.js +12 -0
- package/vendor/cli/package.json +2 -1
- package/vendor/cli/scripts/predist.mjs +6 -3
- package/vendor/cli/src/app.js +102 -1
- package/vendor/cli/src/commands.js +45 -5
- package/vendor/cli/src/limits.js +1 -1
- package/vendor/cli/src/provenance.lock.json +2 -2
- package/vendor/cli/src/update.js +103 -12
- package/vendor/cli/vendor/client/aegis.js +169 -3
- package/vendor/cli/vendor/client/drive-connect.js +87 -0
- package/vendor/cli/vendor/client/drive-upload.js +176 -0
- package/vendor/cli/vendor/client/update.js +100 -8
- package/vendor/cli/vendor/desktop/lib/local/engine.js +64 -1
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +67 -37
- package/vendor/cli/vendor/desktop/lib/local/tools.js +49 -13
- package/vendor/desktop/lib/google-connect.js +171 -0
- package/vendor/desktop/lib/local/engine.js +64 -1
- package/vendor/desktop/lib/local/prompt.js +67 -37
- package/vendor/desktop/lib/local/tools.js +49 -13
- package/vendor/desktop/main.js +191 -12
- package/vendor/desktop/package.json +2 -1
- package/vendor/desktop/preload.js +14 -0
- package/vendor/desktop/renderer/app.js +15 -5
- package/vendor/desktop/renderer/fingerprint.js +75 -1
- package/vendor/desktop/renderer/index.html +17 -0
- package/vendor/desktop/vendor/aegis.js +169 -3
- package/vendor/desktop/vendor/drive-connect.js +87 -0
- package/vendor/desktop/vendor/drive-upload.js +176 -0
- package/vendor/desktop/vendor/update.js +100 -8
|
@@ -399,19 +399,21 @@ function updateNotice({
|
|
|
399
399
|
*
|
|
400
400
|
* @param {{current: string, latest: ?string, behind: boolean, channel?: 'npm'|'desktop', pkg?: string}} input
|
|
401
401
|
*/
|
|
402
|
-
function updatePlan({ current, latest, behind, channel = 'npm', pkg = PKG } = {}) {
|
|
402
|
+
function updatePlan({ current, latest, behind, channel = 'npm', pkg = PKG, method = 'npm' } = {}) {
|
|
403
403
|
const currentText = String(current == null ? '' : current);
|
|
404
404
|
const latestText = latest ? String(latest) : null;
|
|
405
405
|
const pending = Boolean(behind) && Boolean(latestText);
|
|
406
406
|
if (!pending) {
|
|
407
407
|
return {
|
|
408
408
|
channel,
|
|
409
|
+
method,
|
|
409
410
|
current: currentText,
|
|
410
411
|
latest: latestText,
|
|
411
412
|
behind: false,
|
|
412
413
|
action: 'none',
|
|
413
414
|
applier: 'none',
|
|
414
415
|
instruction: null,
|
|
416
|
+
apply: null,
|
|
415
417
|
};
|
|
416
418
|
}
|
|
417
419
|
if (channel === 'desktop') {
|
|
@@ -420,25 +422,101 @@ function updatePlan({ current, latest, behind, channel = 'npm', pkg = PKG } = {}
|
|
|
420
422
|
// beside the running app. The applier is the app's own updater.
|
|
421
423
|
return {
|
|
422
424
|
channel,
|
|
425
|
+
method,
|
|
423
426
|
current: currentText,
|
|
424
427
|
latest: latestText,
|
|
425
428
|
behind: true,
|
|
426
429
|
action: 'desktop-update',
|
|
427
430
|
applier: 'electron-updater',
|
|
428
431
|
instruction: 'Aegis Desktop → Check for Updates…',
|
|
432
|
+
apply: null,
|
|
429
433
|
};
|
|
430
434
|
}
|
|
435
|
+
|
|
436
|
+
// Which installer owns this copy. The command is not cosmetic: `npm i -g`
|
|
437
|
+
// against a pip-installed `aegiscode` writes a second copy beside the one the
|
|
438
|
+
// user actually runs, and the "upgrade" appears to do nothing. Same for an
|
|
439
|
+
// `npx` run, which has nothing installed to upgrade at all.
|
|
440
|
+
const applier = APPLIERS[method] || APPLIERS.npm;
|
|
431
441
|
return {
|
|
432
442
|
channel,
|
|
443
|
+
method,
|
|
433
444
|
current: currentText,
|
|
434
445
|
latest: latestText,
|
|
435
446
|
behind: true,
|
|
436
|
-
action:
|
|
437
|
-
applier:
|
|
438
|
-
instruction:
|
|
447
|
+
action: applier.action,
|
|
448
|
+
applier: applier.name,
|
|
449
|
+
instruction: applier.instruction(pkg),
|
|
450
|
+
apply: applier.apply ? applier.apply(pkg) : null,
|
|
439
451
|
};
|
|
440
452
|
}
|
|
441
453
|
|
|
454
|
+
/**
|
|
455
|
+
* The ways this product reaches a machine, and what "update it" means for each.
|
|
456
|
+
*
|
|
457
|
+
* `apply` names argv to run — it is what the window's Update button and the
|
|
458
|
+
* CLI's `/upgrade apply` execute. `null` means there is nothing to install:
|
|
459
|
+
* `npx` fetches `latest` on every launch by definition, and a source checkout
|
|
460
|
+
* belongs to its owner's git remote.
|
|
461
|
+
*/
|
|
462
|
+
const APPLIERS = Object.freeze({
|
|
463
|
+
npm: Object.freeze({
|
|
464
|
+
name: 'npm',
|
|
465
|
+
action: 'npm-update',
|
|
466
|
+
instruction: (pkg) => `npm i -g ${pkg}@latest`,
|
|
467
|
+
apply: (pkg) => ({ command: 'npm', args: ['i', '-g', `${pkg}@latest`] }),
|
|
468
|
+
}),
|
|
469
|
+
pip: Object.freeze({
|
|
470
|
+
name: 'pip',
|
|
471
|
+
action: 'pip-update',
|
|
472
|
+
// The published pip package is a launcher for the npm one, so this is
|
|
473
|
+
// genuinely a different command — not an npm call with a different word.
|
|
474
|
+
instruction: (pkg) => `pip install -U ${pkg}`,
|
|
475
|
+
apply: (pkg) => ({ command: process.platform === 'win32' ? 'python' : 'python3',
|
|
476
|
+
args: ['-m', 'pip', 'install', '-U', pkg] }),
|
|
477
|
+
}),
|
|
478
|
+
npx: Object.freeze({
|
|
479
|
+
name: 'none',
|
|
480
|
+
action: 'npx-update',
|
|
481
|
+
instruction: () => 'already fetched fresh on every run — restart to pick up the new version',
|
|
482
|
+
apply: null,
|
|
483
|
+
}),
|
|
484
|
+
source: Object.freeze({
|
|
485
|
+
name: 'git',
|
|
486
|
+
action: 'source-update',
|
|
487
|
+
instruction: () => 'git pull && npm ci (this copy is a source checkout)',
|
|
488
|
+
apply: null,
|
|
489
|
+
}),
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Which installer owns the copy that is running — so the sentence names a
|
|
494
|
+
* command that actually changes THIS binary.
|
|
495
|
+
*
|
|
496
|
+
* Order matters. An explicit declaration wins (the pip launcher sets
|
|
497
|
+
* `AEGIS_INSTALL_METHOD=pip` before exec'ing the real CLI, which is the only
|
|
498
|
+
* way the npm package can know a Python install is driving it). Then npx, which
|
|
499
|
+
* is detectable from the argv it builds. Then a source checkout, then npm.
|
|
500
|
+
*
|
|
501
|
+
* Pure and injectable: `env`, `argv` and a file probe, no `process` reads, so a
|
|
502
|
+
* test can assert every branch without npm or pip being installed.
|
|
503
|
+
*/
|
|
504
|
+
function detectInstallMethod({
|
|
505
|
+
env = {}, argv = [], pkg = PKG, fileExists = () => false, entry = '',
|
|
506
|
+
} = {}) {
|
|
507
|
+
const declared = String((env && env.AEGIS_INSTALL_METHOD) || '').trim().toLowerCase();
|
|
508
|
+
if (declared && Object.prototype.hasOwnProperty.call(APPLIERS, declared)) return declared;
|
|
509
|
+
|
|
510
|
+
const joined = argv.map((a) => String(a)).join(' ');
|
|
511
|
+
if (/\bnpx\b/.test(joined) || /_npx[\\/]/.test(joined) || /_npx[\\/]/.test(entry)) return 'npx';
|
|
512
|
+
if (/[\\/]pipx[\\/]venvs[\\/]/.test(entry) || /[\\/]site-packages[\\/]/.test(entry)) return 'pip';
|
|
513
|
+
if (/[\\/]node_modules[\\/]/.test(entry)) return 'npm';
|
|
514
|
+
// A git checkout has the repo's own marker files; a global npm install does
|
|
515
|
+
// not (they are not in the package's `files` list).
|
|
516
|
+
if (fileExists('.git') && fileExists('client/update.js')) return 'source';
|
|
517
|
+
return 'npm';
|
|
518
|
+
}
|
|
519
|
+
|
|
442
520
|
/**
|
|
443
521
|
* The same once-a-day check as `updateNotice`, but *awaited* and detailed.
|
|
444
522
|
*
|
|
@@ -518,11 +596,23 @@ async function checkPublished({
|
|
|
518
596
|
* Rendered from `updatePlan`, not from a second copy of the sentence: the
|
|
519
597
|
* command the terminal tells the user to run and the command the window's
|
|
520
598
|
* banner offers are the same string produced by the same verdict.
|
|
599
|
+
*
|
|
600
|
+
* `method` is the install channel the caller detected (see
|
|
601
|
+
* `detectInstallMethod`). It is threaded through rather than assumed to be npm
|
|
602
|
+
* because the previous version returned `null` — silence — for every channel
|
|
603
|
+
* that was not npm, so a pip install and an npx run were never told a release
|
|
604
|
+
* existed. A host that knows how it was installed should say so.
|
|
521
605
|
*/
|
|
522
|
-
function updateLine({ current, latest, behind, pkg = PKG }) {
|
|
523
|
-
const plan = updatePlan({ current, latest, behind, channel: 'npm', pkg });
|
|
524
|
-
if (plan.
|
|
525
|
-
|
|
606
|
+
function updateLine({ current, latest, behind, pkg = PKG, method = 'npm' }) {
|
|
607
|
+
const plan = updatePlan({ current, latest, behind, channel: 'npm', pkg, method });
|
|
608
|
+
if (!plan.behind) return null;
|
|
609
|
+
const head = `Update available: ${plan.current} → ${plan.latest}`;
|
|
610
|
+
// `apply` is null for the two channels with nothing to install, whose
|
|
611
|
+
// instruction is already a sentence — prefixing those with "run:" would read
|
|
612
|
+
// as a command that does not exist.
|
|
613
|
+
return plan.apply
|
|
614
|
+
? `${head} run: ${plan.instruction}`
|
|
615
|
+
: `${head} ${plan.instruction}`;
|
|
526
616
|
}
|
|
527
617
|
|
|
528
618
|
/**
|
|
@@ -607,6 +697,8 @@ module.exports = {
|
|
|
607
697
|
checkPublished,
|
|
608
698
|
updatePlan,
|
|
609
699
|
updateLine,
|
|
700
|
+
detectInstallMethod,
|
|
701
|
+
APPLIERS,
|
|
610
702
|
PKG,
|
|
611
703
|
CHECK_INTERVAL_MS,
|
|
612
704
|
REASONS,
|