aegisone 1.0.32 → 1.0.34
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/bin/aegis.js +322 -1
- package/package.json +5 -4
- package/scripts/bump.mjs +211 -1
- package/scripts/bundle.js +129 -1
- package/scripts/predist.mjs +976 -1
- package/src/child.js +285 -1
- package/src/dispatch.js +269 -1
- package/src/doctor.js +639 -1
- package/src/host.js +111 -1
- package/src/permissions.js +383 -1
- package/src/probes.js +159 -1
- package/src/release.js +409 -1
- package/vendor/cli/package.json +7 -3
- package/vendor/cli/scripts/check.mjs +52 -1
- package/vendor/cli/scripts/demo.mjs +94 -1
- package/vendor/cli/scripts/predist.mjs +75 -1
- package/vendor/cli/scripts/runtests.mjs +56 -1
- package/vendor/cli/scripts/seal-gate.mjs +74 -1
- package/vendor/cli/src/agents.js +139 -1
- package/vendor/cli/src/app.js +2957 -1
- package/vendor/cli/src/art.js +289 -1
- package/vendor/cli/src/chatflow.js +3023 -1
- package/vendor/cli/src/checkpoint.js +90 -1
- package/vendor/cli/src/clipboard.js +424 -1
- package/vendor/cli/src/cloudsync.js +528 -1
- package/vendor/cli/src/commands.js +4089 -1
- package/vendor/cli/src/config.js +581 -1
- package/vendor/cli/src/connect.js +349 -1
- package/vendor/cli/src/credentials.js +33 -1
- package/vendor/cli/src/deps.js +232 -1
- package/vendor/cli/src/devrun.js +187 -1
- package/vendor/cli/src/diff.js +333 -1
- package/vendor/cli/src/diffview.js +296 -1
- package/vendor/cli/src/engine.js +297 -1
- package/vendor/cli/src/entitlement.js +355 -1
- package/vendor/cli/src/events.js +707 -1
- package/vendor/cli/src/export.js +67 -1
- package/vendor/cli/src/filepreview.js +153 -1
- package/vendor/cli/src/fingerprint.js +592 -1
- package/vendor/cli/src/format.js +259 -1
- package/vendor/cli/src/fuzzy.js +119 -1
- package/vendor/cli/src/history.js +423 -1
- package/vendor/cli/src/init.js +175 -1
- package/vendor/cli/src/input.js +139 -1
- package/vendor/cli/src/keys.js +183 -1
- package/vendor/cli/src/markdown.js +306 -1
- package/vendor/cli/src/models.js +507 -1
- package/vendor/cli/src/naming.js +57 -1
- package/vendor/cli/src/overlays.js +462 -1
- package/vendor/cli/src/panels.js +1418 -1
- package/vendor/cli/src/ping.js +226 -1
- package/vendor/cli/src/presence.js +238 -1
- package/vendor/cli/src/render.js +516 -1
- package/vendor/cli/src/screen.js +518 -1
- package/vendor/cli/src/screens.js +896 -1
- package/vendor/cli/src/secret.js +59 -1
- package/vendor/cli/src/securefs.js +359 -1
- package/vendor/cli/src/settings.js +155 -1
- package/vendor/cli/src/shared.js +52 -1
- package/vendor/cli/src/sharedpaths.js +53 -1
- package/vendor/cli/src/signup.js +156 -1
- package/vendor/cli/src/summarize.js +95 -1
- package/vendor/cli/src/sysdiag.js +585 -1
- package/vendor/cli/src/system.js +40 -1
- package/vendor/cli/src/theme.js +570 -1
- package/vendor/cli/src/title.js +220 -1
- package/vendor/cli/src/todos.js +115 -1
- package/vendor/cli/src/tokens.js +263 -1
- package/vendor/cli/src/topup.js +210 -1
- package/vendor/cli/src/update.js +191 -1
- package/vendor/cli/vendor/client/aegis.js +2441 -1
- package/vendor/cli/vendor/client/attest.js +518 -1
- package/vendor/cli/vendor/client/authorship-key.js +410 -1
- package/vendor/cli/vendor/client/auto-provision.js +134 -1
- package/vendor/cli/vendor/client/brain-catalog.js +268 -1
- package/vendor/cli/vendor/client/byok-catalog.js +199 -1
- package/vendor/cli/vendor/client/catalog-client.js +487 -1
- package/vendor/cli/vendor/client/conversation-export.js +177 -1
- package/vendor/cli/vendor/client/credentials.js +494 -1
- package/vendor/cli/vendor/client/device-fingerprint.js +141 -1
- package/vendor/cli/vendor/client/drive-connect.js +110 -1
- package/vendor/cli/vendor/client/drive-upload.js +234 -1
- package/vendor/cli/vendor/client/env-file.js +1273 -1
- package/vendor/cli/vendor/client/fingerprint.js +1064 -1
- package/vendor/cli/vendor/client/foreign-memory.js +669 -1
- package/vendor/cli/vendor/client/google-signin.js +133 -1
- package/vendor/cli/vendor/client/hooks.js +430 -1
- package/vendor/cli/vendor/client/model-discovery.js +373 -1
- package/vendor/cli/vendor/client/naming.js +283 -1
- package/vendor/cli/vendor/client/platform.js +937 -1
- package/vendor/cli/vendor/client/prefs.js +351 -1
- package/vendor/cli/vendor/client/presence-constants.js +107 -1
- package/vendor/cli/vendor/client/presence.js +438 -1
- package/vendor/cli/vendor/client/record-vault.js +1055 -3
- package/vendor/cli/vendor/client/session-store.js +575 -1
- package/vendor/cli/vendor/client/topup.js +297 -1
- package/vendor/cli/vendor/client/touch.js +458 -1
- package/vendor/cli/vendor/client/update.js +763 -1
- package/vendor/cli/vendor/client/user-models.js +381 -1
- package/vendor/cli/vendor/desktop/lib/local/agents.js +105 -1
- package/vendor/cli/vendor/desktop/lib/local/attachments.js +276 -1
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +1045 -1
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1028 -1
- package/vendor/cli/vendor/desktop/lib/local/context.js +125 -1
- package/vendor/cli/vendor/desktop/lib/local/engine.js +3666 -1
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +660 -1
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +228 -1
- package/vendor/cli/vendor/desktop/lib/local/local.js +2145 -1
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +280 -1
- package/vendor/cli/vendor/desktop/lib/local/queue.js +560 -1
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +238 -1
- package/vendor/cli/vendor/desktop/lib/local/spill.js +75 -1
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +300 -1
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +235 -1
- package/vendor/cli/vendor/desktop/lib/settings.js +890 -1
- package/vendor/cli/vendor/desktop/renderer/usage.js +1239 -1
- package/vendor/cli/vendor/hosts/install.js +638 -1
- package/vendor/cli/vendor/hosts/openai-shim.js +515 -1
- package/vendor/cli/vendor/hosts/spec.js +164 -1
- package/vendor/cli/vendor/hosts/targets.js +346 -1
- package/vendor/cli/vendor/mcp/server.js +221 -1
- package/vendor/cli/vendor/mcp/tools.js +408 -1
- package/vendor/cli/vendor/one/src/child.js +285 -1
- package/vendor/cli/vendor/one/src/permissions.js +383 -1
- package/vendor/desktop/bin/aegis.js +32 -1
- package/vendor/desktop/lib/account-key.js +56 -1
- package/vendor/desktop/lib/auto.js +461 -1
- package/vendor/desktop/lib/avatar/companion.js +698 -1
- package/vendor/desktop/lib/avatar/cosmetics.js +532 -1
- package/vendor/desktop/lib/avatar/events.js +344 -1
- package/vendor/desktop/lib/avatar/holder-turn.js +350 -1
- package/vendor/desktop/lib/avatar/holders.js +612 -1
- package/vendor/desktop/lib/avatar/identity.js +641 -1
- package/vendor/desktop/lib/avatar/level.js +368 -1
- package/vendor/desktop/lib/avatar/mirror.js +524 -1
- package/vendor/desktop/lib/avatar/persona.js +388 -1
- package/vendor/desktop/lib/avatar/profile.js +977 -1
- package/vendor/desktop/lib/avatar/register.js +307 -1
- package/vendor/desktop/lib/avatar/store.js +472 -1
- package/vendor/desktop/lib/avatar/tiers.js +38 -1
- package/vendor/desktop/lib/avatar/transfer.js +415 -1
- package/vendor/desktop/lib/avatar/turn.js +216 -1
- package/vendor/desktop/lib/avatar/voice.js +328 -1
- package/vendor/desktop/lib/avatar/xp.js +404 -1
- package/vendor/desktop/lib/deep-link.js +120 -1
- package/vendor/desktop/lib/fingerprint.js +347 -2
- package/vendor/desktop/lib/google-connect.js +323 -1
- package/vendor/desktop/lib/local/agents.js +105 -1
- package/vendor/desktop/lib/local/attachments.js +276 -1
- package/vendor/desktop/lib/local/autonomous.js +1045 -1
- package/vendor/desktop/lib/local/claude-pro.js +1028 -1
- package/vendor/desktop/lib/local/context.js +125 -1
- package/vendor/desktop/lib/local/engine.js +3666 -1
- package/vendor/desktop/lib/local/entitlement.js +660 -1
- package/vendor/desktop/lib/local/git-scope.js +228 -1
- package/vendor/desktop/lib/local/local.js +2145 -1
- package/vendor/desktop/lib/local/prompt.js +280 -1
- package/vendor/desktop/lib/local/queue.js +560 -1
- package/vendor/desktop/lib/local/session-rounds.js +238 -1
- package/vendor/desktop/lib/local/spill.js +75 -1
- package/vendor/desktop/lib/local/telemetry.js +470 -1
- package/vendor/desktop/lib/local/turn-guard.js +300 -1
- package/vendor/desktop/lib/local/worktree-lock.js +235 -1
- package/vendor/desktop/lib/provider-key-mirror.js +252 -1
- package/vendor/desktop/lib/quick-launcher.js +84 -1
- package/vendor/desktop/lib/settings.js +890 -1
- package/vendor/desktop/lib/sync/memory-queue.js +60 -1
- package/vendor/desktop/lib/sync/persist-gate.js +148 -1
- package/vendor/desktop/lib/sync/sessions.js +106 -1
- package/vendor/desktop/lib/window-state.js +66 -1
- package/vendor/desktop/package.json +5 -3
- package/vendor/desktop/preload.js +679 -1
- package/vendor/desktop/renderer/app.js +7250 -1
- package/vendor/desktop/renderer/avatar/assemble.js +335 -1
- package/vendor/desktop/renderer/avatar/avatar.js +380 -1
- package/vendor/desktop/renderer/avatar/cards.js +141 -1
- package/vendor/desktop/renderer/avatar/hud.js +206 -1
- package/vendor/desktop/renderer/avatar/machine.js +213 -1
- package/vendor/desktop/renderer/avatar/pane.js +439 -1
- package/vendor/desktop/renderer/avatar/parts.js +437 -1
- package/vendor/desktop/renderer/budget.js +172 -1
- package/vendor/desktop/renderer/companion.js +223 -1
- package/vendor/desktop/renderer/diff.js +359 -1
- package/vendor/desktop/renderer/diffview.js +336 -1
- package/vendor/desktop/renderer/filepreview.js +211 -1
- package/vendor/desktop/renderer/fingerprint.js +789 -3
- package/vendor/desktop/renderer/markdown.js +168 -1
- package/vendor/desktop/renderer/provider-mark.js +311 -1
- package/vendor/desktop/renderer/provider-toolbar.js +134 -1
- package/vendor/desktop/renderer/providers.js +259 -1
- package/vendor/desktop/renderer/quick.js +285 -1
- package/vendor/desktop/renderer/stream-policy.js +387 -1
- package/vendor/desktop/renderer/transcript-view.js +323 -1
- package/vendor/desktop/renderer/usage.js +1239 -1
- package/vendor/desktop/vendor/aegis.js +2441 -1
- package/vendor/desktop/vendor/attest.js +518 -1
- package/vendor/desktop/vendor/authorship-key.js +410 -1
- package/vendor/desktop/vendor/auto-provision.js +134 -1
- package/vendor/desktop/vendor/brain-catalog.js +268 -1
- package/vendor/desktop/vendor/byok-catalog.js +199 -1
- package/vendor/desktop/vendor/catalog-client.js +487 -1
- package/vendor/desktop/vendor/conversation-export.js +177 -1
- package/vendor/desktop/vendor/credentials.js +494 -1
- package/vendor/desktop/vendor/device-fingerprint.js +141 -1
- package/vendor/desktop/vendor/drive-connect.js +110 -1
- package/vendor/desktop/vendor/drive-upload.js +234 -1
- package/vendor/desktop/vendor/env-file.js +1273 -1
- package/vendor/desktop/vendor/fingerprint.js +1064 -1
- package/vendor/desktop/vendor/foreign-memory.js +669 -1
- package/vendor/desktop/vendor/google-signin.js +133 -1
- package/vendor/desktop/vendor/hooks.js +430 -1
- package/vendor/desktop/vendor/model-discovery.js +373 -1
- package/vendor/desktop/vendor/naming.js +283 -1
- package/vendor/desktop/vendor/platform.js +937 -1
- package/vendor/desktop/vendor/prefs.js +351 -1
- package/vendor/desktop/vendor/presence-constants.js +107 -1
- package/vendor/desktop/vendor/presence.js +438 -1
- package/vendor/desktop/vendor/record-vault.js +1055 -3
- package/vendor/desktop/vendor/session-store.js +575 -1
- package/vendor/desktop/vendor/topup.js +297 -1
- package/vendor/desktop/vendor/touch.js +458 -1
- package/vendor/desktop/vendor/update.js +763 -1
- package/vendor/desktop/vendor/user-models.js +381 -1
- package/LICENSE +0 -661
- package/SOURCE-OFFER.txt +0 -9
package/README.md
CHANGED
package/bin/aegis.js
CHANGED
|
@@ -1,4 +1,325 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
-
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* AEGISONE — the `aegis` command.
|
|
11
|
+
*
|
|
12
|
+
* This file is deliberately thin, and deliberately boring. It does exactly
|
|
13
|
+
* three things, in this order:
|
|
14
|
+
*
|
|
15
|
+
* 1. gather the process facts (`src/probes.js`) — the only impure read in
|
|
16
|
+
* the product's dispatch path;
|
|
17
|
+
* 2. ask the pure rule which face runs (`src/dispatch.js`);
|
|
18
|
+
* 3. hand off to that face, forwarding argv untouched and exiting with the
|
|
19
|
+
* child's status.
|
|
20
|
+
*
|
|
21
|
+
* There is no third behaviour hiding in here. If you are looking for the
|
|
22
|
+
* decision, it is not in this file — that is the point of it not being here:
|
|
23
|
+
* everything decided in `run()` is a line a test cannot reach on a headless
|
|
24
|
+
* box, and this product is authored on one.
|
|
25
|
+
*
|
|
26
|
+
* `aegiscode` is wired to this same bin and is forwarded verbatim as the
|
|
27
|
+
* compatibility spelling; see the first rule in `dispatch.js`.
|
|
28
|
+
*
|
|
29
|
+
* Debugging: `AEGISONE_PRINT_DECISION=1 aegis …` prints the decision as one
|
|
30
|
+
* JSON line on stderr and continues. It never changes the face.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const fs = require('node:fs');
|
|
34
|
+
const path = require('node:path');
|
|
35
|
+
const { spawnSync, spawn } = require('node:child_process');
|
|
36
|
+
const { decide, FACE } = require('../src/dispatch.js');
|
|
37
|
+
const probes = require('../src/probes.js');
|
|
38
|
+
const release = require('../src/release.js');
|
|
39
|
+
|
|
40
|
+
const EXIT_USAGE = 2;
|
|
41
|
+
const PRODUCT = require('../package.json');
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Where a face manifest can be, nearest to furthest:
|
|
45
|
+
*
|
|
46
|
+
* 1. `vendor/<face>/package.json` — inside the published product tarball,
|
|
47
|
+
* which vendors both faces (plan D6);
|
|
48
|
+
* 2. `../<face>/package.json` — a checkout of this repo, where the faces are
|
|
49
|
+
* siblings of `one/`.
|
|
50
|
+
*
|
|
51
|
+
* Both are tried, in that order, because the answer differs between an installed
|
|
52
|
+
* product and the tree it was built from, and `--version --verbose` must report
|
|
53
|
+
* what is actually there rather than what the derivation says should be.
|
|
54
|
+
*/
|
|
55
|
+
function faceManifestPaths(face, dir) {
|
|
56
|
+
const binDir = dir || __dirname;
|
|
57
|
+
return [
|
|
58
|
+
path.join(binDir, '..', 'vendor', face.dir, 'package.json'),
|
|
59
|
+
path.join(binDir, '..', '..', face.dir, 'package.json')
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The version each face actually carries beside this product (`null` if none). */
|
|
64
|
+
function readFaceVersions(dir) {
|
|
65
|
+
return release.FACE_LINES.map((face) => {
|
|
66
|
+
for (const candidate of faceManifestPaths(face, dir)) {
|
|
67
|
+
try {
|
|
68
|
+
return { package: face.package, version: JSON.parse(fs.readFileSync(candidate, 'utf8')).version, source: candidate };
|
|
69
|
+
} catch {
|
|
70
|
+
/* try the next layout */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return { package: face.package, version: null, source: null };
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function write(stream, line) {
|
|
78
|
+
try {
|
|
79
|
+
stream.write(line.endsWith('\n') ? line : line + '\n');
|
|
80
|
+
} catch {
|
|
81
|
+
/* a closed pipe is not our problem to report */
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Exit status for a finished child, in shell terms (128 + n when signalled). */
|
|
86
|
+
function statusOf(res) {
|
|
87
|
+
if (typeof res.status === 'number') return res.status;
|
|
88
|
+
if (res.signal === 'SIGINT') return 130;
|
|
89
|
+
if (res.signal === 'SIGTERM') return 143;
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Decide, report, hand off.
|
|
95
|
+
*
|
|
96
|
+
* @param {string[]} argv arguments after the program name
|
|
97
|
+
* @param {object} [deps] injected for tests: { input, spawnSync, spawn, env,
|
|
98
|
+
* stderr, stdout }
|
|
99
|
+
* @returns {number} the process exit code
|
|
100
|
+
*/
|
|
101
|
+
function run(argv, deps) {
|
|
102
|
+
const d = deps || {};
|
|
103
|
+
const stderr = d.stderr || process.stderr;
|
|
104
|
+
const stdout = d.stdout || process.stdout;
|
|
105
|
+
const base = d.input || probes.collect({ argv });
|
|
106
|
+
// The `argv` parameter wins over whatever an injected input carries. It used
|
|
107
|
+
// to be silently ignored when `deps.input` was present, which meant a caller
|
|
108
|
+
// could hand in arguments and have a completely different set decided on —
|
|
109
|
+
// and a test found it. One source of truth: the argv you pass is the argv
|
|
110
|
+
// that is decided on.
|
|
111
|
+
const input = Array.isArray(argv) ? { ...base, argv } : base;
|
|
112
|
+
|
|
113
|
+
// ── D4: `aegis --version` is the PRODUCT's version, not the face's. ───────
|
|
114
|
+
// ON1 left this branch open on purpose: `--version` reached the dispatcher as
|
|
115
|
+
// a terminal-face verb, so `aegis --version` printed the CLI face's `6.x`
|
|
116
|
+
// version and the product had no version of its own to print. It is answered
|
|
117
|
+
// here, before the decision, because it is not a question about which face
|
|
118
|
+
// runs — and only in the two shapes `release.versionRequest` accepts, so no
|
|
119
|
+
// prompt or flag can be swallowed by it.
|
|
120
|
+
const asked = release.versionRequest(input.argv);
|
|
121
|
+
if (asked) {
|
|
122
|
+
const faces = asked.verbose
|
|
123
|
+
? (d.readFaceVersions ? d.readFaceVersions() : readFaceVersions(d.binDir))
|
|
124
|
+
: null;
|
|
125
|
+
write(stdout, release.renderVersion({ product: { name: PRODUCT.name, version: PRODUCT.version }, faces }));
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ── D7: `doctor` is answered here, before the face decision. ─────────────
|
|
130
|
+
// It is a *product* verb: `aegis doctor` is a question about this install,
|
|
131
|
+
// not about which face runs, and it must answer on a machine with no display
|
|
132
|
+
// (ON1 routes `doctor` to the terminal face so it can never open a window —
|
|
133
|
+
// but going through the CLI would mean the report only exists when the
|
|
134
|
+
// terminal face is installed). The answer plus its exit code is the product's
|
|
135
|
+
// own (0 healthy / 1 warn / 2 broken), and scripts branch on it, so it is
|
|
136
|
+
// returned unmodified — never merged with a child's status.
|
|
137
|
+
const doctorAt = (input.argv || []).indexOf('doctor');
|
|
138
|
+
if (doctorAt !== -1 && !(input.argv || []).slice(0, doctorAt).some((a) => !a.startsWith('-'))) {
|
|
139
|
+
const doctor = d.doctor || require('../src/doctor.js');
|
|
140
|
+
const code = doctor.main((input.argv || []).slice(doctorAt + 1), Object.assign({ env: input.env, stdout }, d.doctorDeps || {}));
|
|
141
|
+
return typeof code === 'number' ? code : EXIT_USAGE;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const decision = decide(input);
|
|
145
|
+
|
|
146
|
+
// ── D8: the permission posture, resolved ONCE, before any hand-off. ───────
|
|
147
|
+
//
|
|
148
|
+
// `--dangerously-skip-permissions` is a product flag, not a face flag: it is
|
|
149
|
+
// answered HERE (like `--version` and `doctor` above) because its effect
|
|
150
|
+
// spans both faces — the confirmation gate the user is about to run inside,
|
|
151
|
+
// and the Claude child whose prompt nobody can answer (D8 rules 3–5).
|
|
152
|
+
//
|
|
153
|
+
// Three things happen, in this order, and nothing else:
|
|
154
|
+
//
|
|
155
|
+
// 1. the posture is resolved from the flag, the environment and whether a
|
|
156
|
+
// human is present (rule 5 lives in `cli/src/permissions.js`
|
|
157
|
+
// `resolveSkip()`, so this face and the terminal face share it);
|
|
158
|
+
// 2. a skip prints the one line rule 3 requires, naming the classes; a
|
|
159
|
+
// rule-5 refusal prints its warning and the run stays gated;
|
|
160
|
+
// 3. the flag is STRIPPED from the arguments forwarded to a face (the CLI's
|
|
161
|
+
// parser has never heard of it, and silently eating a flag is its own
|
|
162
|
+
// small lie), and the resolved decision is handed to the child through
|
|
163
|
+
// `AEGISONE_SKIP_PERMISSIONS` — the product's own spelling, which the
|
|
164
|
+
// face reads. The user-facing `AEGIS_SKIP_PERMISSIONS` is never
|
|
165
|
+
// forwarded as an authorisation: rule 5's check has already been applied
|
|
166
|
+
// to it here, and re-applying it one process down would be a second
|
|
167
|
+
// place to get it wrong.
|
|
168
|
+
const perms = d.permissions || require('../src/permissions.js');
|
|
169
|
+
const skipFlagAt = (input.argv || []).indexOf(perms.SKIP_FLAG || '--dangerously-skip-permissions');
|
|
170
|
+
const ttyInteractive = Boolean(input.tty && input.tty.stdin && input.tty.stdout);
|
|
171
|
+
const childKind = ttyInteractive ? 'interactive' : 'headless';
|
|
172
|
+
// The store's answer, read through the faces' OWN module (cli/src/config.js
|
|
173
|
+
// `confirmPosture()`, resolved by layout exactly like the evaluator), never by
|
|
174
|
+
// cracking `preferences.json` open here: that key has one reader per face and
|
|
175
|
+
// a third would be the split brain ON8 removed. `d.stored` is injectable for
|
|
176
|
+
// tests; a store that cannot be read answers `undefined`, which leaves the
|
|
177
|
+
// gate exactly as it was.
|
|
178
|
+
const stored = d.stored || perms.storedPermissionFacts(d.storedOpts || {});
|
|
179
|
+
const posture = perms.resolvePosture({
|
|
180
|
+
// `d.rules` still wins when a caller set it (tests, embedding); otherwise
|
|
181
|
+
// the rule set the user actually wrote. It was never filled in before, so
|
|
182
|
+
// rule 4's `--allowedTools`/`--disallowedTools` — "the child's policy
|
|
183
|
+
// tracks ours" — were built from an empty set.
|
|
184
|
+
rules: d.rules !== undefined ? d.rules : stored.rules,
|
|
185
|
+
// The stored posture: a user who already ran `/automode` (or flipped the
|
|
186
|
+
// window's switch) is NOT asked again one process down. This is the half
|
|
187
|
+
// that was missing — the flag resolved here, the setting did not.
|
|
188
|
+
gate: d.gate !== undefined ? d.gate : stored.confirmationsOn,
|
|
189
|
+
flag: skipFlagAt !== -1,
|
|
190
|
+
env: input.env,
|
|
191
|
+
interactive: ttyInteractive,
|
|
192
|
+
childKind,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
if (posture.warning) write(stderr, `aegis: ${posture.warning}`);
|
|
196
|
+
// Rule 3's report is for a FLAG typed for one run. A stored posture is a
|
|
197
|
+
// setting the user can see and undo in both faces' own UI, so it is not
|
|
198
|
+
// announced on every launch (see resolvePosture's `skipFromFlag`).
|
|
199
|
+
if (posture.skip && posture.skipFromFlag) write(stderr, perms.skipReport(posture));
|
|
200
|
+
|
|
201
|
+
const faceArgs = skipFlagAt === -1
|
|
202
|
+
? decision.args
|
|
203
|
+
: decision.args.filter((a) => a !== (perms.SKIP_FLAG || '--dangerously-skip-permissions'));
|
|
204
|
+
// Forwarded only for a skip that was ASKED for (the flag, or the product's own
|
|
205
|
+
// env spelling). Deliberately NOT for the stored posture: `AEGISONE_SKIP_
|
|
206
|
+
// PERMISSIONS` short-circuits the face's own read on every tool round, so
|
|
207
|
+
// forwarding a setting through it would freeze a live, toggleable posture for
|
|
208
|
+
// the whole process — `/automode on` inside the session could then never
|
|
209
|
+
// restore confirmations. The face reads the same store the window writes and
|
|
210
|
+
// gets the same answer on its own; the child's argv is what needed the fix.
|
|
211
|
+
const postureEnv = posture.skipFromFlag ? { AEGISONE_SKIP_PERMISSIONS: '1' } : {};
|
|
212
|
+
|
|
213
|
+
if ((input.env || {}).AEGISONE_PRINT_DECISION === '1') { write(
|
|
214
|
+
stderr,
|
|
215
|
+
'aegis: decision ' +
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
face: decision.face,
|
|
218
|
+
kind: decision.kind,
|
|
219
|
+
reason: decision.reason,
|
|
220
|
+
args: faceArgs,
|
|
221
|
+
skip: posture.skip,
|
|
222
|
+
})
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ── Refused outright: an explicit request the machine cannot honour. ──────
|
|
227
|
+
if (decision.face === null) {
|
|
228
|
+
write(stderr, `aegis: ${decision.error}`);
|
|
229
|
+
if (decision.hint) write(stderr, `aegis: ${decision.hint}`);
|
|
230
|
+
return decision.code || EXIT_USAGE;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ── One line explaining a fallback. Never silence, never a question. ─────
|
|
234
|
+
if (decision.notice) write(stderr, `aegis: ${decision.notice} — running the terminal face.`);
|
|
235
|
+
|
|
236
|
+
const doSpawn = d.spawnSync || spawnSync;
|
|
237
|
+
const doSpawnAsync = d.spawn || spawn;
|
|
238
|
+
const spawnEnv = Object.assign({}, process.env, d.env || {});
|
|
239
|
+
|
|
240
|
+
if (decision.face === FACE.TUI) {
|
|
241
|
+
const bin = input._cliBin || d.cliBin;
|
|
242
|
+
if (!bin) {
|
|
243
|
+
write(stderr, 'aegis: the terminal face is not installed beside aegisone.');
|
|
244
|
+
write(stderr, 'aegis: reinstall aegisone, or set AEGISONE_CLI_BIN to bin/aegiscode.js.');
|
|
245
|
+
return 127;
|
|
246
|
+
}
|
|
247
|
+
const res = doSpawn(process.execPath, [bin, ...faceArgs], {
|
|
248
|
+
stdio: 'inherit',
|
|
249
|
+
env: Object.assign({}, spawnEnv, postureEnv),
|
|
250
|
+
argv0: 'aegiscode',
|
|
251
|
+
});
|
|
252
|
+
return statusOf(res || {});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ── GUI ──────────────────────────────────────────────────────────────────
|
|
256
|
+
// The dispatch rule already refused this path unless Electron resolved, so a
|
|
257
|
+
// miss here means the tree changed under us; say so rather than fall back to
|
|
258
|
+
// a terminal, because the user did ask for the window.
|
|
259
|
+
const electron = input._electron || d.electron;
|
|
260
|
+
const main = input._desktopMain || d.desktopMain;
|
|
261
|
+
if (!electron || !main) {
|
|
262
|
+
write(
|
|
263
|
+
stderr,
|
|
264
|
+
'aegis: cannot open the window — Electron or the desktop entry point went missing after the check.'
|
|
265
|
+
);
|
|
266
|
+
write(stderr, 'aegis: Use --tui for the terminal face.');
|
|
267
|
+
return EXIT_USAGE;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Handed to **Node**, not to Electron — and this was a live bug, not a
|
|
271
|
+
// preference. `desktop/bin/aegis.js` is a launcher: under Node it does
|
|
272
|
+
// `require('electron')` and gets the path to the binary, then spawns it with
|
|
273
|
+
// the app dir. Running that file *inside* Electron instead makes the same
|
|
274
|
+
// require return the Electron module object, and `spawn(object, …)` dies with
|
|
275
|
+
// ERR_INVALID_ARG_TYPE inside the app's own bootstrap. The desktop package
|
|
276
|
+
// already owns "find Electron and launch it"; AEGISONE delegates to it
|
|
277
|
+
// rather than keeping a second, divergent copy of that logic. The resolved
|
|
278
|
+
// Electron path is still what the *probe* consumes — capability to open a
|
|
279
|
+
// window is one question, and who does the opening is another.
|
|
280
|
+
//
|
|
281
|
+
// ELECTRON_RUN_AS_NODE would make Electron behave as plain node and never
|
|
282
|
+
// open a window — the classic silent-no-op, removed rather than inherited.
|
|
283
|
+
delete spawnEnv.ELECTRON_RUN_AS_NODE;
|
|
284
|
+
|
|
285
|
+
// `spawn`, not `spawnSync`: the window should not hold the shell's tty
|
|
286
|
+
// hostage. The parent waits only so the exit code is still the child's.
|
|
287
|
+
const child = doSpawnAsync(process.execPath, [main, ...faceArgs], {
|
|
288
|
+
stdio: 'inherit',
|
|
289
|
+
env: Object.assign({}, spawnEnv, postureEnv),
|
|
290
|
+
detached: false,
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
return new Promise((resolve) => {
|
|
294
|
+
child.on('error', (err) => {
|
|
295
|
+
write(stderr, `aegis: could not start the window: ${err && err.message}`);
|
|
296
|
+
resolve(1);
|
|
297
|
+
});
|
|
298
|
+
child.on('exit', (code, signal) => resolve(statusOf({ status: code, signal })));
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** Synchronous wrapper for the entry point: returns a code or a Promise. */
|
|
303
|
+
function main(argv) {
|
|
304
|
+
const outcome = run(argv);
|
|
305
|
+
if (typeof outcome === 'number') {
|
|
306
|
+
process.exitCode = outcome;
|
|
307
|
+
return outcome;
|
|
308
|
+
}
|
|
309
|
+
return outcome.then((code) => {
|
|
310
|
+
process.exitCode = code;
|
|
311
|
+
return code;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
module.exports = { main, run, statusOf, EXIT_USAGE };
|
|
316
|
+
|
|
317
|
+
if (require.main === module) {
|
|
318
|
+
const result = main(process.argv.slice(2));
|
|
319
|
+
if (result && typeof result.then === 'function') {
|
|
320
|
+
result.catch((err) => {
|
|
321
|
+
write(process.stderr, `aegis: ${(err && err.stack) || err}`);
|
|
322
|
+
process.exitCode = 1;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegisone",
|
|
3
3
|
"productName": "AEGISONE",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.34",
|
|
5
5
|
"description": "AEGISONE — one product, two faces. `aegis` opens the window when there is nothing else to do and runs the terminal otherwise; `aegiscode` keeps behaving exactly as it always has.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AEGIS Code",
|
|
@@ -19,14 +19,15 @@
|
|
|
19
19
|
"install.sh",
|
|
20
20
|
"install.ps1",
|
|
21
21
|
"vendor",
|
|
22
|
-
"README.md"
|
|
23
|
-
"SOURCE-OFFER.txt",
|
|
24
|
-
"LICENSE"
|
|
22
|
+
"README.md"
|
|
25
23
|
],
|
|
26
24
|
"engines": {
|
|
27
25
|
"node": ">=22.0.0"
|
|
28
26
|
},
|
|
29
27
|
"scripts": {
|
|
28
|
+
"predist": "node scripts/predist.mjs",
|
|
29
|
+
"prepack": "node scripts/predist.mjs --quiet",
|
|
30
|
+
"prepublishOnly": "npm run predist",
|
|
30
31
|
"bump": "node scripts/bump.mjs",
|
|
31
32
|
"compat": "node test/one-compat.test.mjs",
|
|
32
33
|
"size": "node scripts/bundle.mjs --json"
|
package/scripts/bump.mjs
CHANGED
|
@@ -1,4 +1,214 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
-
|
|
4
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
5
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
6
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
7
|
+
/**
|
|
8
|
+
* AEGISONE — the bump: ONE command, ONE version, three manifests, one README
|
|
9
|
+
* line (plan D4, ON3 step 1).
|
|
10
|
+
*
|
|
11
|
+
* The commit this replaces read
|
|
12
|
+
* `chore(release): aegis-desktop 0.8.28, aegiscode 6.8.30` — three hand-typed
|
|
13
|
+
* numbers, kept in step by whoever was cutting the release. Every failure mode
|
|
14
|
+
* of that was real: a face bumped but not the product, a product tag with a
|
|
15
|
+
* stale face, a desktop version that disagrees with the README the tag ships
|
|
16
|
+
* with. This script computes all four from `one/package.json` and the
|
|
17
|
+
* derivation in `one/src/release.js`, so there is nothing left to remember.
|
|
18
|
+
*
|
|
19
|
+
* node one/scripts/bump.mjs 1.0.1 # set the product version
|
|
20
|
+
* node one/scripts/bump.mjs patch # ...or let it do the arithmetic
|
|
21
|
+
* node one/scripts/bump.mjs 1.0.1 --dry-run # print the diff, write nothing
|
|
22
|
+
*
|
|
23
|
+
* It REFUSES to bump a tree that is already inconsistent with the product
|
|
24
|
+
* version it carries: a bump is not a repair, and silently overwriting drift
|
|
25
|
+
* would destroy the evidence of how it happened. Fix the drift, then bump.
|
|
26
|
+
*
|
|
27
|
+
* Everything under `one/` obeys the Phase 30.1 seam rule: no `process.*` read
|
|
28
|
+
* at module scope, all IO behind `main(argv, io)`, so importing this file in a
|
|
29
|
+
* test stages and writes nothing.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import fs from 'node:fs';
|
|
33
|
+
import path from 'node:path';
|
|
34
|
+
import { fileURLToPath } from 'node:url';
|
|
35
|
+
import { createRequire } from 'node:module';
|
|
36
|
+
|
|
37
|
+
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
38
|
+
const require = createRequire(import.meta.url);
|
|
39
|
+
const release = require('../src/release.js');
|
|
40
|
+
|
|
41
|
+
/** Repo root — `one/scripts/` -> `one/` -> repo. */
|
|
42
|
+
export const ROOT = path.join(HERE, '..', '..');
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The four documents a bump writes, in the order a reviewer reads them: the
|
|
46
|
+
* source of truth first, then the line in the product README that ships with
|
|
47
|
+
* the tag, then the two derived faces.
|
|
48
|
+
*/
|
|
49
|
+
export function bumpTargets(root) {
|
|
50
|
+
const dir = root || ROOT;
|
|
51
|
+
return [
|
|
52
|
+
{ file: 'one/package.json', kind: 'json', abs: path.join(dir, 'one', 'package.json') },
|
|
53
|
+
{ file: 'one/README.md', kind: 'readme', abs: path.join(dir, 'one', 'README.md') },
|
|
54
|
+
{ file: 'cli/package.json', kind: 'json', abs: path.join(dir, 'cli', 'package.json') },
|
|
55
|
+
{ file: 'desktop/package.json', kind: 'json', abs: path.join(dir, 'desktop', 'package.json') }
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Build the plan for a bump: read the four documents, compute every new version
|
|
61
|
+
* from the derivation, and hand back the exact new contents.
|
|
62
|
+
*
|
|
63
|
+
* @param {{root?: string, version: string, io?: object, read?: Function, repair?: boolean}} input
|
|
64
|
+
* @returns {{version: string, faces: object, files: Array<object>, changed: number}}
|
|
65
|
+
*/
|
|
66
|
+
export function plan(input) {
|
|
67
|
+
const src = input || {};
|
|
68
|
+
const root = src.root || ROOT;
|
|
69
|
+
const read = src.read || ((abs) => fs.readFileSync(abs, 'utf8'));
|
|
70
|
+
const version = release.parseVersion(src.version).text;
|
|
71
|
+
const repair = src.repair === true;
|
|
72
|
+
|
|
73
|
+
const targets = bumpTargets(root);
|
|
74
|
+
const faces = release.deriveFaceVersions(version);
|
|
75
|
+
// Who gets which number: the product manifest and the README carry the
|
|
76
|
+
// product version; each face carries the version derived for it.
|
|
77
|
+
const versionFor = (file) => {
|
|
78
|
+
if (file === 'one/package.json' || file === 'one/README.md') return version;
|
|
79
|
+
if (file === 'cli/package.json') return faces.aegiscode.version;
|
|
80
|
+
if (file === 'desktop/package.json') return faces['aegis-desktop'].version;
|
|
81
|
+
throw new Error(`no version rule for ${file}`);
|
|
82
|
+
};
|
|
83
|
+
const documents = targets.map((t) => ({
|
|
84
|
+
file: t.file,
|
|
85
|
+
kind: t.kind,
|
|
86
|
+
content: read(t.abs),
|
|
87
|
+
version: versionFor(t.file)
|
|
88
|
+
}));
|
|
89
|
+
|
|
90
|
+
// Refuse a tree that is already drifting: the manifests must equal what the
|
|
91
|
+
// derivation says for the product version they carry today, or a bump would
|
|
92
|
+
// launder the drift into "the new version".
|
|
93
|
+
//
|
|
94
|
+
// `repair: true` is the one exception, and it is narrow on purpose. It exists
|
|
95
|
+
// for the case that has actually happened: a face was bumped by hand and
|
|
96
|
+
// PUBLISHED (`aegiscode 7.0.11`) without the product moving, so the tree can
|
|
97
|
+
// only be made consistent going FORWARD — product 1.0.19 is what derives
|
|
98
|
+
// 7.0.11 again. Refusing here would leave the drift unreachable, since the
|
|
99
|
+
// script also refuses to run from it. What a repair may never do is move a
|
|
100
|
+
// face BACKWARDS: that would re-cut a published version, so each face's new
|
|
101
|
+
// number is checked against the one already on disk, not just against the
|
|
102
|
+
// derivation.
|
|
103
|
+
const currentProduct = JSON.parse(documents[0].content).version;
|
|
104
|
+
const expected = release.deriveFaceVersions(currentProduct);
|
|
105
|
+
for (const doc of documents.slice(2)) {
|
|
106
|
+
const name = JSON.parse(doc.content).name;
|
|
107
|
+
const want = expected[name];
|
|
108
|
+
if (!want) throw new Error(`${doc.file}: unexpected package name ${JSON.stringify(name)}`);
|
|
109
|
+
const got = JSON.parse(doc.content).version;
|
|
110
|
+
if (got !== want.version && !repair) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
`${doc.file} carries ${name} ${got}, but product ${currentProduct} derives ${want.version} — ` +
|
|
113
|
+
'the tree is already inconsistent; run `node test/one-version.test.mjs` to see all of it, ' +
|
|
114
|
+
'then bump from a clean state'
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (repair) {
|
|
118
|
+
// A published number is never rewritten, by a bump or a repair.
|
|
119
|
+
const to = release.deriveFaceVersion(version, release.FACE_LINES.find((f) => f.package === name));
|
|
120
|
+
const gotCounter = release.releaseCounter(got);
|
|
121
|
+
if (release.releaseCounter(to) < gotCounter) {
|
|
122
|
+
throw new Error(
|
|
123
|
+
`repair would move ${name} backwards: ${got} -> ${to} — a published version is never re-cut`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const files = release.planBump({ version, documents });
|
|
130
|
+
return {
|
|
131
|
+
version,
|
|
132
|
+
from: currentProduct,
|
|
133
|
+
faces,
|
|
134
|
+
files,
|
|
135
|
+
changed: files.filter((f) => !f.unchanged).length
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* CLI entry. `argv` and the streams are parameters; the process is read here and
|
|
141
|
+
* nowhere at module scope.
|
|
142
|
+
*/
|
|
143
|
+
export function main(argv, io) {
|
|
144
|
+
const o = io || {};
|
|
145
|
+
const out = o.stdout || process.stdout;
|
|
146
|
+
const errOut = o.stderr || process.stderr;
|
|
147
|
+
const args = (Array.isArray(argv) ? argv : []).map(String);
|
|
148
|
+
const dryRun = args.includes('--dry-run');
|
|
149
|
+
// `--repair` is the escape hatch for a tree whose face was bumped and
|
|
150
|
+
// published by hand. It is not implied by anything: without it, drift is
|
|
151
|
+
// still a hard error.
|
|
152
|
+
const repair = args.includes('--repair');
|
|
153
|
+
const positional = args.filter((a) => !a.startsWith('--'));
|
|
154
|
+
if (positional.length !== 1) {
|
|
155
|
+
errOut.write('usage: node one/scripts/bump.mjs <major|minor|patch|X.Y.Z> [--dry-run] [--repair]\n');
|
|
156
|
+
return 2;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
let built;
|
|
160
|
+
try {
|
|
161
|
+
const current = JSON.parse(fs.readFileSync(path.join(ROOT, 'one', 'package.json'), 'utf8')).version;
|
|
162
|
+
built = plan({ root: ROOT, version: release.nextVersion(current, positional[0]), repair });
|
|
163
|
+
} catch (error) {
|
|
164
|
+
errOut.write(`bump: ${(error && error.message) || error}\n`);
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let written = 0;
|
|
169
|
+
for (const file of built.files) {
|
|
170
|
+
if (file.unchanged) continue;
|
|
171
|
+
if (dryRun) {
|
|
172
|
+
out.write(release.unifiedDiff(file.before, file.content, file.file));
|
|
173
|
+
} else {
|
|
174
|
+
fs.writeFileSync(path.join(ROOT, file.file), file.content);
|
|
175
|
+
written++;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (dryRun) {
|
|
180
|
+
out.write(
|
|
181
|
+
`bump: dry run — ${built.from} -> ${built.version}; ` +
|
|
182
|
+
`aegiscode ${built.faces.aegiscode.version}, aegis-desktop ${built.faces['aegis-desktop'].version}; ` +
|
|
183
|
+
'nothing written\n'
|
|
184
|
+
);
|
|
185
|
+
} else {
|
|
186
|
+
out.write(
|
|
187
|
+
`bump: ${built.from} -> ${built.version} (aegiscode ${built.faces.aegiscode.version}, ` +
|
|
188
|
+
`aegis-desktop ${built.faces['aegis-desktop'].version}) — ${written} file(s) written\n`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Run when — and only when — this file was started directly. The process reads
|
|
196
|
+
* live inside a function on purpose: `one/`'s seam rule forbids them at module
|
|
197
|
+
* scope, and this is the file that would have broken it.
|
|
198
|
+
*/
|
|
199
|
+
function runIfDirect() {
|
|
200
|
+
const entry = process.argv[1];
|
|
201
|
+
let direct = false;
|
|
202
|
+
if (entry) {
|
|
203
|
+
try {
|
|
204
|
+
direct = path.resolve(entry) === fileURLToPath(import.meta.url);
|
|
205
|
+
} catch {
|
|
206
|
+
direct = false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!direct) return false;
|
|
210
|
+
process.exitCode = main(process.argv.slice(2));
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
runIfDirect();
|