lycheedev 1.2.0 → 2.0.1
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/LICENSE +49 -0
- package/README.md +45 -0
- package/THIRD_PARTY_NOTICES +812 -0
- package/bin/lycheedev.mjs +56 -0
- package/native/windows-amd64/lycheedev.exe +0 -0
- package/package.json +12 -33
- package/payload/addon/Bridge/CaptureWriter.lua +154 -0
- package/payload/addon/Bridge/Definitions.lua +3 -0
- package/payload/addon/Bridge/Identity.lua +127 -0
- package/{vendor/addon/Libs/AutomationQR.lua → payload/addon/Bridge/MatrixSymbol.lua} +23 -30
- package/payload/addon/Bridge/ProbeQueue.lua +136 -0
- package/payload/addon/Bridge/ProbeRunner.lua +128 -0
- package/payload/addon/Bridge/ReceiptView.lua +160 -0
- package/payload/addon/Bridge/Reentry.lua +192 -0
- package/payload/addon/Bridge/ReportStore.lua +153 -0
- package/payload/addon/Bridge/Session.lua +163 -0
- package/payload/addon/Clients/Evergreen.lua +2 -0
- package/payload/addon/Clients/Live.lua +2 -0
- package/payload/addon/Clients/Pandaria.lua +2 -0
- package/payload/addon/Clients/Titan.lua +2 -0
- package/payload/addon/Core/Compat.lua +59 -0
- package/payload/addon/Core/Controls.lua +168 -0
- package/{vendor/addon/Core/Bootstrap.lua → payload/addon/Core/Execute.lua} +12 -23
- package/{vendor → payload}/addon/Core/Inspector.lua +19 -235
- package/{vendor → payload}/addon/Core/Locale.lua +128 -93
- package/{vendor → payload}/addon/Core/Locale_enUS.lua +128 -95
- package/payload/addon/Core/Persistence.lua +58 -0
- package/payload/addon/Core/Platform.lua +58 -0
- package/payload/addon/Core/Runtime.lua +25 -0
- package/payload/addon/Core/Safety.lua +56 -0
- package/{vendor → payload}/addon/Core/Serializer.lua +18 -6
- package/payload/addon/Core/Stores.lua +611 -0
- package/payload/addon/Lychee Dev_Forever.toc +52 -0
- package/payload/addon/Lychee Dev_Mainline.toc +52 -0
- package/payload/addon/Lychee Dev_Mists.toc +52 -0
- package/payload/addon/Lychee Dev_Wrath.toc +52 -0
- package/payload/addon/Modules/AutomationView.lua +393 -0
- package/{vendor → payload}/addon/Modules/Diagnostics.lua +92 -36
- package/{vendor → payload}/addon/Modules/Events/Catalog.lua +9 -0
- package/{vendor → payload}/addon/Modules/Events/Monitor.lua +45 -5
- package/payload/addon/Modules/FunctionTrace.lua +150 -0
- package/{vendor → payload}/addon/Modules/ObjectInspector.lua +105 -31
- package/{vendor → payload}/addon/UI/Export.lua +64 -34
- package/{vendor → payload}/addon/UI/Pages/About.lua +26 -14
- package/payload/addon/UI/Pages/Automation.lua +446 -0
- package/payload/addon/UI/Pages/Diagnostics.lua +402 -0
- package/{vendor/addon/UI/Features.lua → payload/addon/UI/Pages/Events.lua} +192 -302
- package/{vendor → payload}/addon/UI/Pages/ExportRecords.lua +213 -132
- package/{vendor → payload}/addon/UI/Pages/Object.lua +229 -121
- package/payload/addon/UI/Pages/Run.lua +423 -0
- package/payload/addon/UI/Pages/Trace.lua +314 -0
- package/payload/addon/UI/TreeView.lua +246 -0
- package/{vendor/addon/UI/MainWindow.lua → payload/addon/UI/Widgets.lua} +89 -529
- package/payload/addon/UI/Window.lua +425 -0
- package/payload/skill/SKILL.md +87 -0
- package/payload/skill/agents/openai.yaml +7 -0
- package/payload/skill/references/addon-validation.md +42 -0
- package/payload/skill/references/asset-export.md +109 -0
- package/payload/skill/references/commands.md +169 -0
- package/payload/skill/references/data-investigation.md +242 -0
- package/payload/skill/references/error-diagnosis.md +41 -0
- package/payload/skill/references/installation.md +18 -0
- package/payload/skill/references/live-investigation.md +129 -0
- package/payload/skill/references/source-research.md +82 -0
- package/payload/skill/scripts/lycheedev.mjs +59 -0
- package/release.json +346 -0
- package/bin/lycheedev.js +0 -746
- package/src/addon.js +0 -95
- package/src/config.js +0 -68
- package/src/doctor.js +0 -126
- package/src/install.js +0 -145
- package/src/paths.js +0 -93
- package/src/py/instances.py +0 -165
- package/src/python.js +0 -111
- package/src/skill.js +0 -48
- package/src/wow.js +0 -541
- package/vendor/addon/Core/Clients/Forever.lua +0 -9
- package/vendor/addon/Core/Clients/Mainline.lua +0 -9
- package/vendor/addon/Core/Clients/Mists.lua +0 -9
- package/vendor/addon/Core/Clients/Titan.lua +0 -9
- package/vendor/addon/Core/Compatibility.lua +0 -43
- package/vendor/addon/Core/Database.lua +0 -859
- package/vendor/addon/Core/Safety.lua +0 -42
- package/vendor/addon/Lychee Dev_Forever.toc +0 -44
- package/vendor/addon/Lychee Dev_Mainline.toc +0 -44
- package/vendor/addon/Lychee Dev_Mists.toc +0 -44
- package/vendor/addon/Lychee Dev_Wrath.toc +0 -44
- package/vendor/addon/Modules/Automation/Controller.lua +0 -896
- package/vendor/addon/Modules/Automation/Reload.lua +0 -101
- package/vendor/addon/Modules/Automation/Report.lua +0 -409
- package/vendor/addon/Modules/Automation/auto/auto.lua +0 -12
- package/vendor/addon/Modules/FunctionTrace.lua +0 -85
- package/vendor/addon/UI/AutomationOverlay.lua +0 -253
- package/vendor/addon/UI/Pages/Automation.lua +0 -417
- package/vendor/addon/UI/Pages/Diagnostics.lua +0 -289
- package/vendor/addon/UI/Pages/Trace.lua +0 -165
- package/vendor/skill/SKILL.md +0 -44
- package/vendor/skill/agents/openai.yaml +0 -4
- package/vendor/skill/references/automation.md +0 -130
- package/vendor/skill/references/clients.md +0 -51
- package/vendor/skill/references/runtime-investigations.md +0 -104
- package/vendor/skill/scripts/automation/__init__.py +0 -1
- package/vendor/skill/scripts/automation/registry.py +0 -516
- package/vendor/skill/scripts/automation/reload.py +0 -121
- package/vendor/skill/scripts/automation/saved_variables.py +0 -438
- package/vendor/skill/scripts/automation/session.py +0 -207
- package/vendor/skill/scripts/automation/windows.py +0 -792
- package/vendor/skill/scripts/automation.py +0 -1067
- package/vendor/skill/scripts/requirements.txt +0 -13
- package/vendor/skill/scripts/selftest_offline.py +0 -1061
- package/vendor/skill/scripts/test_input_safety.py +0 -132
- package/vendor/skill/scripts/test_reload.py +0 -120
- /package/{vendor → payload}/addon/Media/GitHub.png +0 -0
- /package/{vendor → payload}/addon/Media/Logo.png +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Forever.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mainline.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Mists.lua +0 -0
- /package/{vendor → payload}/addon/Modules/Events/CatalogData_Titan.lua +0 -0
package/bin/lycheedev.js
DELETED
|
@@ -1,746 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/** lycheedev command line entry. */
|
|
3
|
-
|
|
4
|
-
import { readFileSync } from 'node:fs';
|
|
5
|
-
import fs from 'node:fs';
|
|
6
|
-
import os from 'node:os';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import { randomBytes } from 'node:crypto';
|
|
9
|
-
|
|
10
|
-
import { runDoctor } from '../src/doctor.js';
|
|
11
|
-
import { runInstall } from '../src/install.js';
|
|
12
|
-
import { loadConfig, updateConfig } from '../src/config.js';
|
|
13
|
-
import { runAutomation } from '../src/python.js';
|
|
14
|
-
import {
|
|
15
|
-
describeAmbiguity,
|
|
16
|
-
findInstances,
|
|
17
|
-
findSavedVariablesCandidates,
|
|
18
|
-
formatInstance,
|
|
19
|
-
identityKey,
|
|
20
|
-
identityLabel,
|
|
21
|
-
matchIdentity,
|
|
22
|
-
matchPinned,
|
|
23
|
-
resolveInstance,
|
|
24
|
-
scanClients,
|
|
25
|
-
} from '../src/wow.js';
|
|
26
|
-
import { addonFolderName, exists } from '../src/paths.js';
|
|
27
|
-
|
|
28
|
-
const HELP = `lycheedev - Lychee Dev installer and World of Warcraft automation driver
|
|
29
|
-
|
|
30
|
-
usage: lycheedev <command> [options]
|
|
31
|
-
|
|
32
|
-
commands
|
|
33
|
-
install install python dependencies, the skill and the addon
|
|
34
|
-
update refresh dependencies, skill and addon to this version
|
|
35
|
-
doctor report what is installed and what is missing
|
|
36
|
-
clients list every detected build and its addon state
|
|
37
|
-
instances list running game clients (build, pid, window)
|
|
38
|
-
instances --identify also read each window's character and build marker
|
|
39
|
-
use [index] pin one running client as the default target
|
|
40
|
-
use --character <n> pin the window that reports character <n>
|
|
41
|
-
use --clear drop the pin
|
|
42
|
-
send <text> type one slash command into the running game
|
|
43
|
-
reload reload and locally confirm readiness; --resume <nonce> resumes without reloading
|
|
44
|
-
capture poll the game window and decode the completion notice
|
|
45
|
-
run --task <id> deliver, decode, reload once and read the result ticket
|
|
46
|
-
bugs --count <n> snapshot recent errors and read the result ticket
|
|
47
|
-
ack --ticket <t> report that a ticket was read (received|failed)
|
|
48
|
-
task <sub> manage the in-game task registry (upsert/list/remove)
|
|
49
|
-
sv <sub> discover SavedVariables and read a ticket (find/read)
|
|
50
|
-
profile <sub> bind a client install for direct automation.py use
|
|
51
|
-
status summarize the local session log
|
|
52
|
-
recover show reload intents that were never confirmed
|
|
53
|
-
|
|
54
|
-
options
|
|
55
|
-
--wow-root <path> folder that contains _retail_/_classic_/_classic_titan_
|
|
56
|
-
--client <id> retail | classic | titan | forever (default: the configured one)
|
|
57
|
-
--instance <index> which running client to target when several are open
|
|
58
|
-
--character <name> target the window reporting that character (Name or Name-Realm)
|
|
59
|
-
--identify also read each window's character marker (instances, use)
|
|
60
|
-
--hwnd <handle> target one window directly, skipping instance lookup
|
|
61
|
-
--pid <pid> expected process id for the target window
|
|
62
|
-
--python <bin> python interpreter to use
|
|
63
|
-
--force redo work that is already present
|
|
64
|
-
--reset-registry install the addon with an empty task registry
|
|
65
|
-
--json machine-readable output where supported
|
|
66
|
-
-h, --help show this help
|
|
67
|
-
-v, --version show the version
|
|
68
|
-
|
|
69
|
-
Every non-retail client runs as WowClassic.exe, so a running client is matched
|
|
70
|
-
by its install path, not its process name. A folder is only a location: the CLI
|
|
71
|
-
also reads each client's own .flavor.info product code and version.txt build, so
|
|
72
|
-
a reused test folder (such as _classic_beta_ carrying WoW: Forever) is still
|
|
73
|
-
identified correctly. With several clients open, run "lycheedev instances" then
|
|
74
|
-
"lycheedev use <index>" to pin one as the target; the pin stores the build, so it
|
|
75
|
-
survives a restart even though the pid and window handle change. Pass
|
|
76
|
-
--instance <index> to override it for one command.
|
|
77
|
-
|
|
78
|
-
When several windows share one build, they are told apart by the character each
|
|
79
|
-
window reports: run "/dev auto identify" in each game window, then
|
|
80
|
-
"lycheedev instances --identify" to read them, and pin by name with
|
|
81
|
-
"lycheedev use --character <name>". Windows that report the same character, or
|
|
82
|
-
that show no marker, remain ambiguous and the CLI asks for one window to be
|
|
83
|
-
closed rather than risking a command in the wrong game.
|
|
84
|
-
|
|
85
|
-
The automation subcommands are thin wrappers over the bundled python helper, so
|
|
86
|
-
the same arguments it accepts are forwarded unchanged.`;
|
|
87
|
-
|
|
88
|
-
const SHORT_FLAGS = { '-h': 'help', '-v': 'version' };
|
|
89
|
-
|
|
90
|
-
function parse(argv) {
|
|
91
|
-
const flags = {};
|
|
92
|
-
const rest = [];
|
|
93
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
94
|
-
const token = argv[index];
|
|
95
|
-
if (token === '--') {
|
|
96
|
-
rest.push(...argv.slice(index + 1));
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (SHORT_FLAGS[token]) {
|
|
100
|
-
flags[SHORT_FLAGS[token]] = true;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (token.startsWith('--')) {
|
|
104
|
-
const [name, inline] = token.slice(2).split('=');
|
|
105
|
-
if (inline !== undefined) {
|
|
106
|
-
flags[name] = inline;
|
|
107
|
-
} else if (argv[index + 1] && !argv[index + 1].startsWith('-')) {
|
|
108
|
-
flags[name] = argv[index + 1];
|
|
109
|
-
index += 1;
|
|
110
|
-
} else {
|
|
111
|
-
flags[name] = true;
|
|
112
|
-
}
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
rest.push(token);
|
|
116
|
-
}
|
|
117
|
-
return { flags, rest };
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** hwnd/pid/exe-path derived from config so the automation commands line up. */
|
|
121
|
-
function targetArgs(client) {
|
|
122
|
-
const args = [];
|
|
123
|
-
if (client && client.hwnd) args.push('--hwnd', String(client.hwnd));
|
|
124
|
-
if (client && client.pid) args.push('--pid', String(client.pid));
|
|
125
|
-
const exePath = client?.exePath || client?.instance?.exePath;
|
|
126
|
-
if (exePath) args.push('--exe-path', exePath);
|
|
127
|
-
return args;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function requireClient(flags) {
|
|
131
|
-
const config = loadConfig();
|
|
132
|
-
const ids = Object.keys(config.clients);
|
|
133
|
-
const requested = flags.client;
|
|
134
|
-
if (requested) {
|
|
135
|
-
if (!config.clients[requested]) {
|
|
136
|
-
console.error(`error: unknown client '${requested}'; known: ${ids.join(', ') || 'none'}`);
|
|
137
|
-
return { error: true };
|
|
138
|
-
}
|
|
139
|
-
return { config, client: config.clients[requested], id: requested };
|
|
140
|
-
}
|
|
141
|
-
if (ids.length === 0) {
|
|
142
|
-
console.error('error: no client configured; run `lycheedev install --wow-root <path>`');
|
|
143
|
-
return { error: true };
|
|
144
|
-
}
|
|
145
|
-
if (ids.length === 1) {
|
|
146
|
-
return { config, client: config.clients[ids[0]], id: ids[0] };
|
|
147
|
-
}
|
|
148
|
-
// Several clients are installed; the one recorded at install time is the
|
|
149
|
-
// default so routine commands stay short, and --client overrides it.
|
|
150
|
-
const fallback = config.defaultClient;
|
|
151
|
-
if (fallback && config.clients[fallback]) {
|
|
152
|
-
return { config, client: config.clients[fallback], id: fallback };
|
|
153
|
-
}
|
|
154
|
-
console.error(`error: several clients configured (${ids.join(', ')}); pass --client <id>`);
|
|
155
|
-
return { error: true };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function runClients(flags) {
|
|
159
|
-
const config = loadConfig();
|
|
160
|
-
const root = flags['wow-root'] || config.wowRoot;
|
|
161
|
-
if (!root || !exists(root)) {
|
|
162
|
-
console.error('error: no World of Warcraft root; run `lycheedev install --wow-root <path>`');
|
|
163
|
-
return 1;
|
|
164
|
-
}
|
|
165
|
-
console.log(root);
|
|
166
|
-
for (const client of scanClients(root)) {
|
|
167
|
-
const version = client.version ? `v${client.version}` : 'unknown version';
|
|
168
|
-
// The product is the client's own identity; the folder is only where it
|
|
169
|
-
// lives, and one folder can serve different products over time.
|
|
170
|
-
const product = client.folderProduct && client.folderProduct !== client.product
|
|
171
|
-
? `[${client.folderProduct}] `
|
|
172
|
-
: '';
|
|
173
|
-
const state = !client.toc
|
|
174
|
-
? 'not served by the addon'
|
|
175
|
-
: (client.installed ? 'addon installed' : 'addon missing');
|
|
176
|
-
console.log(` ${client.id.padEnd(12)} ${client.folder.padEnd(18)} `
|
|
177
|
-
+ `${(product + version).padEnd(18)} ${state}`);
|
|
178
|
-
}
|
|
179
|
-
return 0;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/** `lycheedev instances`: which game clients are running right now. */
|
|
183
|
-
function runInstances(flags) {
|
|
184
|
-
const config = loadConfig();
|
|
185
|
-
let instances = findInstances({ pythonBin: flags.python || null });
|
|
186
|
-
if (instances.length === 0) {
|
|
187
|
-
console.log('no World of Warcraft instance is running');
|
|
188
|
-
return 0;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// `--identify` asks each window to report the character and build it holds.
|
|
192
|
-
// Capture reads the window surface directly, so no window needs the
|
|
193
|
-
// foreground and nothing is typed into the game.
|
|
194
|
-
let identifyNote = null;
|
|
195
|
-
if (flags.identify) {
|
|
196
|
-
const supported = instances.filter((item) => item.supported);
|
|
197
|
-
if (supported.length === 0) {
|
|
198
|
-
identifyNote = 'no served build is running, so there is nothing to identify';
|
|
199
|
-
} else {
|
|
200
|
-
const probed = probeIdentities(supported, flags);
|
|
201
|
-
if (probed.error) {
|
|
202
|
-
identifyNote = probed.error;
|
|
203
|
-
} else {
|
|
204
|
-
const byHwnd = new Map(probed.list.map((entry) => [String(entry.hwnd), entry]));
|
|
205
|
-
instances = instances.map((instance) => {
|
|
206
|
-
const entry = byHwnd.get(String(instance.hwnd));
|
|
207
|
-
if (!entry || !entry.identity) return instance;
|
|
208
|
-
return { ...instance, identity: entry.identity };
|
|
209
|
-
});
|
|
210
|
-
const unidentified = probed.list.filter((entry) => !entry.identity);
|
|
211
|
-
if (unidentified.length) {
|
|
212
|
-
identifyNote = `${unidentified.length} window(s) show no identity marker; `
|
|
213
|
-
+ 'run `/dev auto identify` in each game window you care about, then retry';
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const pinned = matchPinned(instances, config.pinnedInstance);
|
|
220
|
-
console.log('running instances:');
|
|
221
|
-
instances.forEach((instance, index) => {
|
|
222
|
-
console.log(formatInstance(instance, index));
|
|
223
|
-
});
|
|
224
|
-
const supported = instances.filter((item) => item.supported);
|
|
225
|
-
console.log('');
|
|
226
|
-
if (pinned) {
|
|
227
|
-
const label = pinned.flavorLabel || pinned.flavorFolder;
|
|
228
|
-
console.log(`pinned: ${label} (pid ${pinned.pid}), pid ${pinned.pid} - commands target it`);
|
|
229
|
-
} else if (config.pinnedInstance) {
|
|
230
|
-
console.log('pinned client is not running; run `lycheedev use` to repin');
|
|
231
|
-
}
|
|
232
|
-
if (supported.length === 0) {
|
|
233
|
-
console.log('none of these builds are served by the addon');
|
|
234
|
-
} else if (!pinned && supported.length > 1) {
|
|
235
|
-
const shape = describeAmbiguity(instances);
|
|
236
|
-
if (shape.sameBuildCollision) {
|
|
237
|
-
// Do not suggest `use <index>` here: pinning is refused for windows that
|
|
238
|
-
// cannot be told apart, so pointing at it would send the user in a circle.
|
|
239
|
-
console.log('several clients are running and cannot be told apart: run '
|
|
240
|
-
+ '`/dev auto identify` in each game window, then `lycheedev use --character <name>`');
|
|
241
|
-
} else {
|
|
242
|
-
console.log('several clients are running: `lycheedev use <index>` pins one, '
|
|
243
|
-
+ 'or pass --instance <index> per command');
|
|
244
|
-
}
|
|
245
|
-
} else if (!pinned) {
|
|
246
|
-
console.log('commands target this instance automatically');
|
|
247
|
-
}
|
|
248
|
-
if (identifyNote) console.log(identifyNote);
|
|
249
|
-
return 0;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Ask the Python helper to read the identity marker from each window.
|
|
254
|
-
*
|
|
255
|
-
* The instance list is handed over as a file rather than arguments, because
|
|
256
|
-
* every field has to survive the trip and a command line is a fragile place to
|
|
257
|
-
* put it. The name is unpredictable and the file is created exclusively, so a
|
|
258
|
-
* pre-existing file at that path cannot be followed or silently overwritten.
|
|
259
|
-
*/
|
|
260
|
-
function probeIdentities(supported, flags) {
|
|
261
|
-
const windowsFile = path.join(os.tmpdir(),
|
|
262
|
-
`lycheedev-windows-${process.pid}-${randomBytes(8).toString('hex')}.json`);
|
|
263
|
-
try {
|
|
264
|
-
fs.writeFileSync(windowsFile, JSON.stringify(supported), { encoding: 'utf8', flag: 'wx' });
|
|
265
|
-
const args = ['identify', '--windows-json', windowsFile];
|
|
266
|
-
if (flags.timeout) args.push('--timeout', String(flags.timeout));
|
|
267
|
-
const result = runAutomation(args, {
|
|
268
|
-
pythonBin: flags.python || null,
|
|
269
|
-
inherit: false,
|
|
270
|
-
});
|
|
271
|
-
if (!result.ok) {
|
|
272
|
-
return { error: `could not read identity markers: ${result.stderr || 'helper failed'}` };
|
|
273
|
-
}
|
|
274
|
-
return { list: JSON.parse(result.stdout || '[]') };
|
|
275
|
-
} catch (error) {
|
|
276
|
-
return { error: `could not read identity markers: ${error.message}` };
|
|
277
|
-
} finally {
|
|
278
|
-
try {
|
|
279
|
-
fs.unlinkSync(windowsFile);
|
|
280
|
-
} catch {
|
|
281
|
-
// A leftover temp file is harmless.
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Resolve the live game window a command should type into.
|
|
288
|
-
*
|
|
289
|
-
* Precedence: an explicit `--hwnd`/`--pid`, then `--instance <index>`, then
|
|
290
|
-
* `--character <name>`, then the saved pin, then `--client`, and finally the only
|
|
291
|
-
* running instance when there is exactly one. `WowClassic.exe` looks identical
|
|
292
|
-
* for every classic build, so an ambiguous choice fails loudly instead of typing
|
|
293
|
-
* into the wrong game.
|
|
294
|
-
*
|
|
295
|
-
* Windows of one build are distinguishable when each reports a different
|
|
296
|
-
* character; only windows that report the same character (or no marker at all)
|
|
297
|
-
* are genuinely ambiguous, and those still fail loudly.
|
|
298
|
-
*/
|
|
299
|
-
function resolveRuntime(flags) {
|
|
300
|
-
if (flags.hwnd || flags.pid) {
|
|
301
|
-
return { hwnd: flags.hwnd, pid: flags.pid };
|
|
302
|
-
}
|
|
303
|
-
const instances = findInstances({ pythonBin: flags.python || null });
|
|
304
|
-
const supported = instances.filter((item) => item.supported);
|
|
305
|
-
|
|
306
|
-
if (flags.instance !== undefined) {
|
|
307
|
-
const chosen = supported[Number(flags.instance)];
|
|
308
|
-
if (!chosen) {
|
|
309
|
-
console.error(`error: --instance ${flags.instance} is out of range (0..${supported.length - 1})`);
|
|
310
|
-
supported.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
311
|
-
return { error: true };
|
|
312
|
-
}
|
|
313
|
-
return toTarget(chosen);
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
if (flags.character) {
|
|
317
|
-
// A named character is only findable if the window showed its marker, so
|
|
318
|
-
// probe first; this is read-only capture and types nothing.
|
|
319
|
-
const named = resolveByCharacter(instances, flags.character, flags);
|
|
320
|
-
if (named.error) return { error: true };
|
|
321
|
-
return toTarget(named.instance);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (!flags.client) {
|
|
325
|
-
const config = loadConfig();
|
|
326
|
-
const pinned = matchPinned(instances, config.pinnedInstance);
|
|
327
|
-
if (pinned) {
|
|
328
|
-
return toTarget(pinned);
|
|
329
|
-
}
|
|
330
|
-
if (config.pinnedInstance) {
|
|
331
|
-
console.error('error: the pinned client is not running; run `lycheedev use` again '
|
|
332
|
-
+ 'or pass --instance <index>');
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const resolved = resolveInstance(instances, { clientId: flags.client || null, index: null });
|
|
337
|
-
if (resolved.error) {
|
|
338
|
-
const shape = describeAmbiguity(instances);
|
|
339
|
-
if (shape.sameBuildCollision) {
|
|
340
|
-
// Same build and no way to separate the windows: no flag can pick the right
|
|
341
|
-
// one reliably, so ask for a single window rather than inviting a wrong guess.
|
|
342
|
-
for (const entry of shape.collisions) {
|
|
343
|
-
for (const group of entry.sameCharacter) {
|
|
344
|
-
const label = group[0].flavorLabel || entry.flavorId;
|
|
345
|
-
console.error(`error: ${group.length} ${label} clients report the same character `
|
|
346
|
-
+ `and cannot be told apart`);
|
|
347
|
-
console.error(` close all but one, or close these pids: `
|
|
348
|
-
+ group.map((i) => i.pid).join(', '));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
if (!shape.sameBuildNamed) {
|
|
352
|
-
console.error(' run `/dev auto identify` in each game window, then retry '
|
|
353
|
-
+ 'with --identify');
|
|
354
|
-
}
|
|
355
|
-
} else if (supported.length > 1) {
|
|
356
|
-
// Several windows of one build, and the caller filtered to that build. They
|
|
357
|
-
// may well be separable by character, so say how rather than just failing.
|
|
358
|
-
console.error(`error: ${resolved.error}`);
|
|
359
|
-
console.error(' if each window shows a different character, run '
|
|
360
|
-
+ '`/dev auto identify` in each, then pass --character <name>; '
|
|
361
|
-
+ 'otherwise pass --instance <index>');
|
|
362
|
-
} else {
|
|
363
|
-
console.error(`error: ${resolved.error}`);
|
|
364
|
-
}
|
|
365
|
-
if (resolved.candidates) {
|
|
366
|
-
resolved.candidates.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
367
|
-
}
|
|
368
|
-
if (supported.length === 0 && instances.length > 0) {
|
|
369
|
-
instances.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
370
|
-
}
|
|
371
|
-
return { error: true };
|
|
372
|
-
}
|
|
373
|
-
return toTarget(resolved.instance);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Find the window reporting a named character, probing the markers first.
|
|
378
|
-
*
|
|
379
|
-
* Names only exist inside the marker, so read it when the caller has not already
|
|
380
|
-
* supplied it. Returns `{ instance }` or `{ error: true }` after explaining why.
|
|
381
|
-
*/
|
|
382
|
-
function resolveByCharacter(instances, query, flags) {
|
|
383
|
-
const supported = instances.filter((item) => item.supported);
|
|
384
|
-
if (supported.length === 0) {
|
|
385
|
-
console.error('error: no served build is running');
|
|
386
|
-
return { error: true };
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
let probed = supported;
|
|
390
|
-
if (!supported.some((item) => item.identity)) {
|
|
391
|
-
const result = probeIdentities(supported, flags);
|
|
392
|
-
if (result.error) {
|
|
393
|
-
console.error('error: could not read identity markers; run '
|
|
394
|
-
+ '`lycheedev instances --identify` after `/dev auto identify` in each game window');
|
|
395
|
-
return { error: true };
|
|
396
|
-
}
|
|
397
|
-
const byHwnd = new Map(result.list.map((entry) => [String(entry.hwnd), entry]));
|
|
398
|
-
probed = supported.map((instance) => {
|
|
399
|
-
const entry = byHwnd.get(String(instance.hwnd));
|
|
400
|
-
return entry && entry.identity ? { ...instance, identity: entry.identity } : instance;
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const matched = matchIdentity(probed, query);
|
|
405
|
-
if (matched.error) {
|
|
406
|
-
console.error(`error: ${matched.error}`);
|
|
407
|
-
(matched.candidates || probed).forEach((item, index) => console.log(formatInstance(item, index)));
|
|
408
|
-
return { error: true };
|
|
409
|
-
}
|
|
410
|
-
return { instance: matched.instance };
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
function toTarget(instance) {
|
|
414
|
-
return {
|
|
415
|
-
hwnd: instance.hwnd ? `0x${instance.hwnd.toString(16)}` : null,
|
|
416
|
-
pid: instance.pid ? String(instance.pid) : null,
|
|
417
|
-
instance,
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* `lycheedev use [index|--character <name>]`: keep one running client as the
|
|
423
|
-
* default target.
|
|
424
|
-
*
|
|
425
|
-
* The pin stores the build, the instance ordinal and — when the window showed
|
|
426
|
-
* its identity marker — the character. The character is the durable half: pids
|
|
427
|
-
* and window handles change every launch, and an ordinal shifts as soon as the
|
|
428
|
-
* windows are opened in a different order.
|
|
429
|
-
*/
|
|
430
|
-
function runUse(flags, rest) {
|
|
431
|
-
let instances = findInstances({ pythonBin: flags.python || null });
|
|
432
|
-
let shape = describeAmbiguity(instances);
|
|
433
|
-
let supported = shape.supported;
|
|
434
|
-
|
|
435
|
-
if (flags.clear) {
|
|
436
|
-
updateConfig({ pinnedInstance: null });
|
|
437
|
-
console.log('cleared the pinned client');
|
|
438
|
-
return 0;
|
|
439
|
-
}
|
|
440
|
-
if (supported.length === 0) {
|
|
441
|
-
console.error('error: no supported World of Warcraft instance is running');
|
|
442
|
-
if (instances.length > 0) {
|
|
443
|
-
instances.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
444
|
-
}
|
|
445
|
-
return 1;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
// Probing is read-only capture that types nothing, so do it whenever it could
|
|
449
|
-
// resolve an ambiguity. An explicit index or character already is the decision,
|
|
450
|
-
// so probing then would only add seconds of waiting for no new information.
|
|
451
|
-
const decided = Boolean(flags.character) || rest.length > 0 || flags.instance !== undefined;
|
|
452
|
-
const wantsIdentity = Boolean(flags.character) || Boolean(flags.identify)
|
|
453
|
-
|| (shape.sameBuildCollision && !decided);
|
|
454
|
-
if (wantsIdentity) {
|
|
455
|
-
const probed = probeIdentities(supported, flags);
|
|
456
|
-
if (probed.error) {
|
|
457
|
-
if (flags.character) {
|
|
458
|
-
console.error(`error: ${probed.error}`);
|
|
459
|
-
return 1;
|
|
460
|
-
}
|
|
461
|
-
// Without an explicit name request the pin can still be taken by ordinal.
|
|
462
|
-
} else {
|
|
463
|
-
const byHwnd = new Map(probed.list.map((entry) => [String(entry.hwnd), entry]));
|
|
464
|
-
instances = instances.map((instance) => {
|
|
465
|
-
const entry = byHwnd.get(String(instance.hwnd));
|
|
466
|
-
return entry && entry.identity ? { ...instance, identity: entry.identity } : instance;
|
|
467
|
-
});
|
|
468
|
-
supported = instances.filter((item) => item.supported);
|
|
469
|
-
shape = describeAmbiguity(instances);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Pinning by name is the recommended path when several windows share a build.
|
|
474
|
-
if (flags.character) {
|
|
475
|
-
const matched = matchIdentity(supported, flags.character);
|
|
476
|
-
if (matched.error) {
|
|
477
|
-
console.error(`error: ${matched.error}`);
|
|
478
|
-
(matched.candidates || supported).forEach((item, index) => console.log(formatInstance(item, index)));
|
|
479
|
-
return 1;
|
|
480
|
-
}
|
|
481
|
-
return savePin(matched.instance);
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
// Only windows that report the same character (or no marker at all) are
|
|
485
|
-
// genuinely indistinguishable; those still get asked for a single window.
|
|
486
|
-
if (shape.sameBuildCollision) {
|
|
487
|
-
for (const entry of shape.collisions) {
|
|
488
|
-
for (const group of entry.sameCharacter) {
|
|
489
|
-
const label = group[0].flavorLabel || entry.flavorId;
|
|
490
|
-
console.error(`error: ${group.length} ${label} clients cannot be told apart`);
|
|
491
|
-
console.error(` close all but one, or close these pids: `
|
|
492
|
-
+ group.map((i) => i.pid).join(', '));
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
console.error(' or run `/dev auto identify` in each game window and then '
|
|
496
|
-
+ '`lycheedev use --character <name>`');
|
|
497
|
-
supported.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
498
|
-
return 1;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const requested = rest.length > 0
|
|
502
|
-
? Number(rest[0])
|
|
503
|
-
: (flags.instance !== undefined ? Number(flags.instance) : null);
|
|
504
|
-
let chosen;
|
|
505
|
-
let ordinal;
|
|
506
|
-
if (requested !== null) {
|
|
507
|
-
chosen = supported[requested];
|
|
508
|
-
if (!chosen) {
|
|
509
|
-
console.error(`error: instance ${requested} is out of range (0..${supported.length - 1})`);
|
|
510
|
-
supported.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
511
|
-
return 1;
|
|
512
|
-
}
|
|
513
|
-
ordinal = supported
|
|
514
|
-
.slice(0, requested)
|
|
515
|
-
.filter((item) => item.flavorId === chosen.flavorId)
|
|
516
|
-
.length;
|
|
517
|
-
} else {
|
|
518
|
-
if (supported.length > 1) {
|
|
519
|
-
console.error('error: several clients are running; pass an index, e.g. `lycheedev use 0`');
|
|
520
|
-
supported.forEach((item, index) => console.log(formatInstance(item, index)));
|
|
521
|
-
return 1;
|
|
522
|
-
}
|
|
523
|
-
[chosen] = supported;
|
|
524
|
-
ordinal = 0;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
return savePin(chosen, ordinal);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/** Persist a pin, preferring the character when the window reported one. */
|
|
531
|
-
function savePin(chosen, ordinal = 0) {
|
|
532
|
-
const pin = { flavor: chosen.flavorId, ordinal };
|
|
533
|
-
// The character is the durable half of the pin; the ordinal stays as a
|
|
534
|
-
// fallback for a build whose windows never showed a marker.
|
|
535
|
-
const character = identityKey(chosen);
|
|
536
|
-
if (character) pin.character = character;
|
|
537
|
-
|
|
538
|
-
updateConfig({ pinnedInstance: pin });
|
|
539
|
-
const label = chosen.flavorLabel || chosen.flavorFolder;
|
|
540
|
-
const name = identityLabel(chosen);
|
|
541
|
-
console.log(`pinned ${label}${name ? ` (${name})` : ''} (pid ${chosen.pid})`);
|
|
542
|
-
console.log('commands now target it; pass --instance <index> or --character <name> to override');
|
|
543
|
-
return 0;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function main(argv) {
|
|
547
|
-
const { flags, rest } = parse(argv);
|
|
548
|
-
const command = rest.shift();
|
|
549
|
-
|
|
550
|
-
// Help and version are answers, not errors: they must not depend on whether a
|
|
551
|
-
// command was supplied.
|
|
552
|
-
if (flags.help) {
|
|
553
|
-
console.log(HELP);
|
|
554
|
-
return 0;
|
|
555
|
-
}
|
|
556
|
-
if (flags.version) {
|
|
557
|
-
const pkg = JSON.parse(
|
|
558
|
-
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
|
|
559
|
-
);
|
|
560
|
-
console.log(pkg.version || 'unknown');
|
|
561
|
-
return 0;
|
|
562
|
-
}
|
|
563
|
-
if (!command) {
|
|
564
|
-
console.log(HELP);
|
|
565
|
-
return 1;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
switch (command) {
|
|
569
|
-
case 'install':
|
|
570
|
-
return runInstall({ flags });
|
|
571
|
-
case 'update':
|
|
572
|
-
return runInstall({ flags: { ...flags, force: true } });
|
|
573
|
-
case 'doctor':
|
|
574
|
-
return runDoctor({ flags });
|
|
575
|
-
case 'clients':
|
|
576
|
-
return runClients(flags);
|
|
577
|
-
case 'instances':
|
|
578
|
-
return runInstances(flags);
|
|
579
|
-
case 'use':
|
|
580
|
-
return runUse(flags, rest);
|
|
581
|
-
case 'help':
|
|
582
|
-
console.log(HELP);
|
|
583
|
-
return 0;
|
|
584
|
-
default:
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// Everything else is forwarded to the bundled python helper.
|
|
589
|
-
const target = requireClient(flags);
|
|
590
|
-
if (target.error) return 1;
|
|
591
|
-
|
|
592
|
-
const forwarded = [];
|
|
593
|
-
const client = target.client || {};
|
|
594
|
-
// The python helper wants the installed addon directory itself, not the
|
|
595
|
-
// AddOns folder that contains it.
|
|
596
|
-
if (client.addonsDir) forwarded.push('--install-dir', path.join(client.addonsDir, addonFolderName));
|
|
597
|
-
|
|
598
|
-
// Commands that type into the game must target a live window, and the
|
|
599
|
-
// executable name cannot tell two instances apart, so resolve which running
|
|
600
|
-
// instance to use before forwarding.
|
|
601
|
-
const runtime = ['send', 'capture', 'run', 'bugs', 'reload'].includes(command)
|
|
602
|
-
? resolveRuntime(flags)
|
|
603
|
-
: null;
|
|
604
|
-
if (runtime && runtime.error) return 1;
|
|
605
|
-
const live = runtime && runtime.hwnd
|
|
606
|
-
? runtime
|
|
607
|
-
: null;
|
|
608
|
-
|
|
609
|
-
switch (command) {
|
|
610
|
-
case 'send': {
|
|
611
|
-
const text = rest.join(' ');
|
|
612
|
-
if (!text) {
|
|
613
|
-
console.error('error: send needs the command text, e.g. `lycheedev send "/dev auto status x"`');
|
|
614
|
-
return 1;
|
|
615
|
-
}
|
|
616
|
-
if (!live) return 1;
|
|
617
|
-
return forward(['send', ...targetArgs(live), '--text', text, ...passthrough(flags)]);
|
|
618
|
-
}
|
|
619
|
-
case 'reload':
|
|
620
|
-
if (!live) return 1;
|
|
621
|
-
return forward(['reload', ...targetArgs(live), ...passthrough(flags)]);
|
|
622
|
-
case 'capture':
|
|
623
|
-
if (!live) return 1;
|
|
624
|
-
return forward(['capture', ...targetArgs(live), ...passthrough(flags)]);
|
|
625
|
-
case 'run':
|
|
626
|
-
if (!flags.task) {
|
|
627
|
-
console.error('error: run needs --task <id>');
|
|
628
|
-
return 1;
|
|
629
|
-
}
|
|
630
|
-
if (!live) return 1;
|
|
631
|
-
if (!client.svPath) {
|
|
632
|
-
console.error('error: no SavedVariables path recorded for this client; re-run `lycheedev install`');
|
|
633
|
-
return 1;
|
|
634
|
-
}
|
|
635
|
-
return forward(['run', ...forwarded, ...targetArgs(live), '--task', flags.task, '--sv', client.svPath,
|
|
636
|
-
...passthrough(flags)]);
|
|
637
|
-
case 'bugs':
|
|
638
|
-
if (!flags.count) {
|
|
639
|
-
console.error('error: bugs needs --count <1-100>');
|
|
640
|
-
return 1;
|
|
641
|
-
}
|
|
642
|
-
if (!live) return 1;
|
|
643
|
-
if (!client.svPath) {
|
|
644
|
-
console.error('error: no SavedVariables path recorded for this client; re-run `lycheedev install`');
|
|
645
|
-
return 1;
|
|
646
|
-
}
|
|
647
|
-
return forward(['bugs', ...targetArgs(live), '--count', String(flags.count), '--sv', client.svPath,
|
|
648
|
-
...passthrough(flags)]);
|
|
649
|
-
case 'ack': {
|
|
650
|
-
if (!flags.ticket || !flags.status) {
|
|
651
|
-
console.error('error: ack needs --ticket <t> --status received|failed');
|
|
652
|
-
return 1;
|
|
653
|
-
}
|
|
654
|
-
// An acknowledgement also has to reach a live window.
|
|
655
|
-
const ackTarget = resolveRuntime(flags);
|
|
656
|
-
if (ackTarget.error) return 1;
|
|
657
|
-
return forward(['ack', ...targetArgs(ackTarget), '--ticket', flags.ticket,
|
|
658
|
-
'--status', flags.status, ...passthrough(flags)]);
|
|
659
|
-
}
|
|
660
|
-
case 'task': {
|
|
661
|
-
const sub = rest.shift();
|
|
662
|
-
if (!sub) {
|
|
663
|
-
console.error('error: task needs a subcommand: upsert, list or remove');
|
|
664
|
-
return 1;
|
|
665
|
-
}
|
|
666
|
-
return forward(['task', sub, ...forwarded, ...passthrough(flags)]);
|
|
667
|
-
}
|
|
668
|
-
case 'sv': {
|
|
669
|
-
const sub = rest.shift();
|
|
670
|
-
if (sub === 'find') {
|
|
671
|
-
// The wrapper already knows the plaintext install and can enumerate the
|
|
672
|
-
// account folders itself, so `sv find` needs no profile binding.
|
|
673
|
-
const config = loadConfig();
|
|
674
|
-
const root = flags['wow-root'] || config.wowRoot;
|
|
675
|
-
if (!root || !exists(root)) {
|
|
676
|
-
console.error('error: no World of Warcraft root; run `lycheedev install --wow-root <path>`');
|
|
677
|
-
return 1;
|
|
678
|
-
}
|
|
679
|
-
const candidates = findSavedVariablesCandidates(root, client.flavorFolder);
|
|
680
|
-
if (candidates.length === 0) {
|
|
681
|
-
console.error(`no account-level '${addonFolderName}.lua' found under ${root}`);
|
|
682
|
-
return 1;
|
|
683
|
-
}
|
|
684
|
-
for (const candidate of candidates) console.log(candidate.path);
|
|
685
|
-
return 0;
|
|
686
|
-
}
|
|
687
|
-
if (sub === 'read') {
|
|
688
|
-
if (!flags.ticket) {
|
|
689
|
-
console.error('error: sv read needs --ticket <t>');
|
|
690
|
-
return 1;
|
|
691
|
-
}
|
|
692
|
-
const svPath = flags.sv || client.svPath;
|
|
693
|
-
if (!svPath) {
|
|
694
|
-
console.error('error: no SavedVariables path known for this client; '
|
|
695
|
-
+ 'run `lycheedev install`, or pass --sv <path>');
|
|
696
|
-
return 1;
|
|
697
|
-
}
|
|
698
|
-
return forward(['sv', 'read', '--sv', svPath, '--ticket', flags.ticket,
|
|
699
|
-
...passthrough(flags)]);
|
|
700
|
-
}
|
|
701
|
-
console.error('error: sv needs a subcommand: find or read');
|
|
702
|
-
return 1;
|
|
703
|
-
}
|
|
704
|
-
case 'profile':
|
|
705
|
-
case 'status':
|
|
706
|
-
case 'recover':
|
|
707
|
-
return forward([command, ...rest, ...passthrough(flags)]);
|
|
708
|
-
default:
|
|
709
|
-
console.error(`error: unknown command '${command}'`);
|
|
710
|
-
console.log(HELP);
|
|
711
|
-
return 1;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
function passthrough(all) {
|
|
715
|
-
const out = [];
|
|
716
|
-
// These are either handled by the wrapper itself or are global python
|
|
717
|
-
// options that `forward()` places before the subcommand.
|
|
718
|
-
const handled = ['wow-root', 'client', 'python', 'force', 'reset-registry', 'task', 'count',
|
|
719
|
-
'ticket', 'status', 'json', 'help', 'version', 'data-dir', 'installation', 'instance'];
|
|
720
|
-
for (const [name, value] of Object.entries(all)) {
|
|
721
|
-
if (handled.includes(name)) continue;
|
|
722
|
-
if (value === true) out.push(`--${name}`);
|
|
723
|
-
else out.push(`--${name}`, String(value));
|
|
724
|
-
}
|
|
725
|
-
return out;
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
function forward(args) {
|
|
729
|
-
// `--data-dir` and `--installation` are global options of the python helper,
|
|
730
|
-
// so they must precede the subcommand or argparse rejects them. Everything
|
|
731
|
-
// else stays where the caller put it.
|
|
732
|
-
const globals = [];
|
|
733
|
-
if (flags['data-dir']) globals.push('--data-dir', String(flags['data-dir']));
|
|
734
|
-
if (flags.installation) globals.push('--installation', String(flags.installation));
|
|
735
|
-
const finalArgs = [...globals, ...args];
|
|
736
|
-
if (process.env.LYCHEEDEV_DEBUG) {
|
|
737
|
-
console.error(`[debug] python automation.py ${finalArgs.join(' ')}`);
|
|
738
|
-
}
|
|
739
|
-
const result = runAutomation(finalArgs, {
|
|
740
|
-
pythonBin: flags.python || (target.config || {}).pythonBin,
|
|
741
|
-
});
|
|
742
|
-
return typeof result.status === 'number' ? result.status : 1;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
process.exitCode = main(process.argv.slice(2));
|