@just-every/manager 0.1.3 → 0.1.5
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 -0
- package/bin/justevery-manager.js +10 -1
- package/lib/installer.js +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,3 +26,4 @@ Use `--download-only` to cache the installer without launching it, and
|
|
|
26
26
|
- `JE_AGENT_ASSET` – override the installer filename.
|
|
27
27
|
- `JE_AGENT_GITHUB_TOKEN` – optional GitHub token for private releases (also supports `GH_TOKEN` / `GITHUB_TOKEN`).
|
|
28
28
|
- `JE_AGENT_SKIP_DOWNLOAD=1` – skip the postinstall download/caching step.
|
|
29
|
+
- `JE_AGENT_SKIP_LAUNCH=1` – skip launching the installer after download (also supports `JE_MANAGER_SKIP_LAUNCH`).
|
package/bin/justevery-manager.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { ensureInstaller, launchInstaller } from '../lib/installer.js';
|
|
3
|
+
import { platform as osPlatform } from 'os';
|
|
3
4
|
|
|
4
5
|
const args = process.argv.slice(2);
|
|
5
6
|
const wantsHelp = args.includes('--help') || args.includes('-h');
|
|
6
|
-
const
|
|
7
|
+
const skipLaunchEnv = process.env.JE_AGENT_SKIP_LAUNCH === '1' || process.env.JE_MANAGER_SKIP_LAUNCH === '1';
|
|
8
|
+
const sessionType = (process.env.XDG_SESSION_TYPE || '').toLowerCase();
|
|
9
|
+
const isSsh = Boolean(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
|
|
10
|
+
const hasDisplay = Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
|
|
11
|
+
const hasGuiSession = Boolean(sessionType) && sessionType !== 'tty';
|
|
12
|
+
const isHeadlessLinux = osPlatform() === 'linux' && (!hasDisplay || !hasGuiSession || isSsh);
|
|
13
|
+
const downloadOnly = args.includes('--download-only') || args.includes('--no-open') || skipLaunchEnv || isHeadlessLinux;
|
|
7
14
|
const printPath = args.includes('--print-path');
|
|
8
15
|
|
|
9
16
|
if (wantsHelp) {
|
|
@@ -35,6 +42,8 @@ try {
|
|
|
35
42
|
}
|
|
36
43
|
if (!downloadOnly) {
|
|
37
44
|
await launchInstaller(result.path);
|
|
45
|
+
} else if (isHeadlessLinux) {
|
|
46
|
+
console.log('No desktop session detected. Run the installer on a machine with a GUI.');
|
|
38
47
|
}
|
|
39
48
|
} catch (error) {
|
|
40
49
|
console.error(`Failed to prepare installer: ${error.message}`);
|
package/lib/installer.js
CHANGED
|
@@ -316,6 +316,18 @@ function ensureExecutable(path) {
|
|
|
316
316
|
} catch {}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
function shouldSkipLaunch() {
|
|
320
|
+
if (process.env.JE_AGENT_SKIP_LAUNCH === '1' || process.env.JE_MANAGER_SKIP_LAUNCH === '1') {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
if (osPlatform() !== 'linux') return false;
|
|
324
|
+
const hasDisplay = Boolean(process.env.DISPLAY || process.env.WAYLAND_DISPLAY);
|
|
325
|
+
const sessionType = (process.env.XDG_SESSION_TYPE || '').toLowerCase();
|
|
326
|
+
const hasGuiSession = Boolean(sessionType) && sessionType !== 'tty';
|
|
327
|
+
const isSsh = Boolean(process.env.SSH_CONNECTION || process.env.SSH_TTY || process.env.SSH_CLIENT);
|
|
328
|
+
return !hasDisplay || !hasGuiSession || isSsh;
|
|
329
|
+
}
|
|
330
|
+
|
|
319
331
|
export async function resolveAgentVersion() {
|
|
320
332
|
if (process.env.JE_AGENT_VERSION) {
|
|
321
333
|
return process.env.JE_AGENT_VERSION.trim();
|
|
@@ -366,6 +378,12 @@ export async function ensureInstaller({ allowDownload = true } = {}) {
|
|
|
366
378
|
|
|
367
379
|
export function launchInstaller(installerPath) {
|
|
368
380
|
const platform = osPlatform();
|
|
381
|
+
if (shouldSkipLaunch()) {
|
|
382
|
+
console.log('Every Manager installer downloaded. Launch skipped in this environment.');
|
|
383
|
+
console.log(`Installer path: ${installerPath}`);
|
|
384
|
+
console.log('Run the installer from a desktop session, or pass --download-only to skip launching.');
|
|
385
|
+
return Promise.resolve();
|
|
386
|
+
}
|
|
369
387
|
if (platform === 'darwin') {
|
|
370
388
|
return runCommand('open', [installerPath]);
|
|
371
389
|
}
|