lycheedev 1.0.4 → 1.0.6

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/bin/lycheedev.js CHANGED
@@ -9,6 +9,7 @@ import { runInstall } from '../src/install.js';
9
9
  import { loadConfig, updateConfig } from '../src/config.js';
10
10
  import { runAutomation } from '../src/python.js';
11
11
  import {
12
+ describeAmbiguity,
12
13
  findInstances,
13
14
  findSavedVariablesCandidates,
14
15
  formatInstance,
@@ -220,7 +221,18 @@ function resolveRuntime(flags) {
220
221
 
221
222
  const resolved = resolveInstance(instances, { clientId: flags.client || null, index: null });
222
223
  if (resolved.error) {
223
- console.error(`error: ${resolved.error}`);
224
+ const shape = describeAmbiguity(instances);
225
+ // Several windows of one build: no flag can pick the right one reliably, so
226
+ // ask for a single window rather than inviting a wrong guess.
227
+ if (shape.sameBuildCollision) {
228
+ for (const [flavorId, list] of shape.duplicates) {
229
+ const label = list[0].flavorLabel || flavorId;
230
+ console.error(`error: ${list.length} ${label} clients are running and cannot be told apart`);
231
+ console.error(` close all but one, or close these pids: ${list.map((i) => i.pid).join(', ')}`);
232
+ }
233
+ } else {
234
+ console.error(`error: ${resolved.error}`);
235
+ }
224
236
  if (resolved.candidates) {
225
237
  resolved.candidates.forEach((item, index) => console.log(formatInstance(item, index)));
226
238
  }
@@ -248,7 +260,8 @@ function toTarget(instance) {
248
260
  */
249
261
  function runUse(flags, rest) {
250
262
  const instances = findInstances({ pythonBin: flags.python || null });
251
- const supported = instances.filter((item) => item.supported);
263
+ const shape = describeAmbiguity(instances);
264
+ const supported = shape.supported;
252
265
 
253
266
  if (flags.clear) {
254
267
  updateConfig({ pinnedInstance: null });
@@ -263,7 +276,23 @@ function runUse(flags, rest) {
263
276
  return 1;
264
277
  }
265
278
 
266
- const requested = rest.length > 0 ? Number(rest[0]) : (flags.instance !== undefined ? Number(flags.instance) : null);
279
+ // Several windows of one build cannot be told apart from outside the game, so
280
+ // pinning one of them would only look precise. Ask for a single window instead.
281
+ if (shape.sameBuildCollision) {
282
+ for (const [flavorId, list] of shape.duplicates) {
283
+ const label = list[0].flavorLabel || flavorId;
284
+ console.error(`error: ${list.length} ${label} clients are running and cannot be told apart`);
285
+ console.error(` close all but one, or close these pids: ${list.map((i) => i.pid).join(', ')}`);
286
+ }
287
+ console.error(' nothing observable from outside the game identifies which character');
288
+ console.error(' is behind which window, so pinning one would risk typing into the wrong game');
289
+ supported.forEach((item, index) => console.log(formatInstance(item, index)));
290
+ return 1;
291
+ }
292
+
293
+ const requested = rest.length > 0
294
+ ? Number(rest[0])
295
+ : (flags.instance !== undefined ? Number(flags.instance) : null);
267
296
  let chosen;
268
297
  let ordinal;
269
298
  if (requested !== null) {
@@ -289,7 +318,7 @@ function runUse(flags, rest) {
289
318
 
290
319
  updateConfig({ pinnedInstance: { flavor: chosen.flavorId, ordinal } });
291
320
  const label = chosen.flavorLabel || chosen.flavorFolder;
292
- console.log(`pinned ${label}${ordinal > 0 ? ` instance ${ordinal}` : ''} (pid ${chosen.pid})`);
321
+ console.log(`pinned ${label} (pid ${chosen.pid})`);
293
322
  console.log('commands now target it; pass --instance <index> to override');
294
323
  return 0;
295
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lycheedev",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "lycheedev: install the World of Warcraft inspection addon, its in-game automation tooling, and drive it from the command line.",
5
5
  "keywords": [
6
6
  "wow",
package/src/wow.js CHANGED
@@ -256,3 +256,32 @@ export function formatInstance(instance, index) {
256
256
  return ` [${index}] ${flavor.padEnd(14)} pid=${String(instance.pid).padEnd(8)} `
257
257
  + `hwnd=${hwnd.padEnd(12)}${title}${suffix}`;
258
258
  }
259
+
260
+ /**
261
+ * Decide whether several running instances can be told apart.
262
+ *
263
+ * Different builds are safe: the install path identifies them, so `--client`
264
+ * picks one. Several instances of the *same* build are not, because nothing
265
+ * observable from outside the game says which character is behind which pid —
266
+ * only a build-specific memory reader could, and none ships here. Rather than
267
+ * let the user pin an ordinal that may point at the wrong window, the caller is
268
+ * told to close the extras.
269
+ */
270
+ export function describeAmbiguity(instances) {
271
+ const supported = instances.filter((item) => item.supported);
272
+ const byBuild = new Map();
273
+ for (const instance of supported) {
274
+ if (!byBuild.has(instance.flavorId)) byBuild.set(instance.flavorId, []);
275
+ byBuild.get(instance.flavorId).push(instance);
276
+ }
277
+ const duplicates = [...byBuild.entries()].filter(([, list]) => list.length > 1);
278
+ const distinct = byBuild.size;
279
+ return {
280
+ supported,
281
+ duplicates,
282
+ // Several builds open: picking one is unambiguous.
283
+ multipleBuilds: distinct > 1,
284
+ // Several windows of one build: nothing can tell them apart.
285
+ sameBuildCollision: duplicates.length > 0,
286
+ };
287
+ }
@@ -6,7 +6,7 @@
6
6
  ## Notes-zhCN: 运行 Lua,检查对象与事件,追踪函数并查看错误。
7
7
  ## Notes-zhTW: 執行 Lua,檢查物件與事件,追蹤函式並檢視錯誤。
8
8
  ## Author: Follen
9
- ## Version: 1.0.4
9
+ ## Version: 1.0.6
10
10
  ## Dependencies: !BugGrabber
11
11
  ## SavedVariables: LycheeDevDB, DumperDB
12
12
  ## IconTexture: Interface\AddOns\Lychee Dev\Media\Logo.png
@@ -6,7 +6,7 @@
6
6
  ## Notes-zhCN: 运行 Lua,检查对象与事件,追踪函数并查看错误。
7
7
  ## Notes-zhTW: 執行 Lua,檢查物件與事件,追蹤函式並檢視錯誤。
8
8
  ## Author: Follen
9
- ## Version: 1.0.4
9
+ ## Version: 1.0.6
10
10
  ## Dependencies: !BugGrabber
11
11
  ## SavedVariables: LycheeDevDB, DumperDB
12
12
  ## IconTexture: Interface\AddOns\Lychee Dev\Media\Logo.png
@@ -6,7 +6,7 @@
6
6
  ## Notes-zhCN: 运行 Lua,检查对象与事件,追踪函数并查看错误。
7
7
  ## Notes-zhTW: 執行 Lua,檢查物件與事件,追蹤函式並檢視錯誤。
8
8
  ## Author: Follen
9
- ## Version: 1.0.4
9
+ ## Version: 1.0.6
10
10
  ## Dependencies: !BugGrabber
11
11
  ## SavedVariables: LycheeDevDB, DumperDB
12
12
  ## IconTexture: Interface\AddOns\Lychee Dev\Media\Logo.png
@@ -7,6 +7,14 @@ description: Use when working with the Lychee Dev WoW addon to read persisted ru
7
7
 
8
8
  Use this skill as the operational guide for Lychee Dev, an in-game evidence workbench. The desired output is either (a) an evidence-backed diagnosis from SavedVariables or (b) a command/workflow the user can paste into WoW and report back.
9
9
 
10
+ Detail lives in `references/`. Read the one that matches the task instead of guessing:
11
+
12
+ | Reference | Read it when |
13
+ | --- | --- |
14
+ | [references/clients.md](references/clients.md) | Any command that types into the game, or the user has several builds or instances open |
15
+ | [references/automation.md](references/automation.md) | Authorized scripted task delivery: task blocks, run, notice, reload, receipt |
16
+ | [references/runtime-investigations.md](references/runtime-investigations.md) | Designing a memory/CPU probe |
17
+
10
18
  ## Choose the workflow
11
19
 
12
20
  - **Persisted evidence:** locate the WoW `WTF` SavedVariables file, find the exact Ticket, and read the complete payload.
@@ -18,6 +26,20 @@ Use this skill as the operational guide for Lychee Dev, an in-game evidence work
18
26
 
19
27
  The Performance page, automatic capture, health scan and function benchmark have been removed. Run, Objects, Events, Trace, Errors and Saved Records remain available. Do not route a new investigation to the removed UI. There are no separate `/object` or `/event` slash commands. Do not invent them; give the `/dev` UI steps instead.
20
28
 
29
+ ## Know which client you are driving
30
+
31
+ Three builds are supported: Retail `12.1.0` (`_retail_`), Classic `5.5.4` (`_classic_`) and Classic Titan `3.80.2` (`_classic_titan_`). Other folders may exist on disk but the addon does not serve them. Never infer the build from the window title, and never assume `WowClassic.exe` means Classic — every non-retail build uses that name.
32
+
33
+ Before a command that types into the game, confirm the target:
34
+
35
+ ```text
36
+ lycheedev clients # every build on disk, its version, and install state
37
+ lycheedev instances # what is running now, with pid and window handle
38
+ lycheedev use [index] # pin one as the default target
39
+ ```
40
+
41
+ With several clients open, `--instance <index>` overrides the pin for one command and `--client` filters by build. Different builds can stay open together because the install path separates them. Two windows of the **same** build cannot be told apart from outside the game, so the CLI refuses and names the pids to close — ask the user to close all but one instead of picking for them. Full rules and the precedence order are in [references/clients.md](references/clients.md).
42
+
21
43
  ## Read SavedVariables
22
44
 
23
45
  1. Search the user's WoW installation for the global SavedVariables file, normally `WTF/Account/<account>/SavedVariables/Lychee Dev.lua`. The exact account/realm path is installation-specific. Use a filename search or `rg` for `LycheeDevDB`/the Ticket rather than assuming a path.
@@ -0,0 +1,135 @@
1
+ # Clients, builds and instances
2
+
3
+ How to tell which World of Warcraft client you are driving, and how to target
4
+ one when several are running. Read this before any command that types into the
5
+ game (`send`, `run`, `bugs`, `capture`, `ack`).
6
+
7
+ ## Supported builds
8
+
9
+ The addon ships one catalog per supported build. Nothing else loads it.
10
+
11
+ | Build | Version | Interface | Catalog | Install folder |
12
+ | --- | --- | --- | --- | --- |
13
+ | Retail | `12.1.0` | `120100` | `Lychee Dev_Mainline.toc` | `_retail_` |
14
+ | Classic | `5.5.4` | `50504` | `Lychee Dev_Mists.toc` | `_classic_` |
15
+ | Classic Titan | `3.80.2` | `38002` | `Lychee Dev_Wrath.toc` | `_classic_titan_` |
16
+
17
+ Other folders may exist on a machine (`_classic_era_`, `_anniversary_`,
18
+ `_beta_`). They are reported as **not served by the addon** and are deliberately
19
+ skipped. Do not install into them and do not tell the user they are supported.
20
+
21
+ The Titan folder is `_classic_titan_`. An earlier release used
22
+ `_classic_arena_`, which does not exist; that made an installed Titan client
23
+ invisible to both `install` and `doctor`. If a user reports "Titan was never
24
+ installed", check the folder name before anything else.
25
+
26
+ ## The executable name does not identify the build
27
+
28
+ Every non-retail client ships as `WowClassic.exe`. `Wow.exe` is retail,
29
+ `WowB.exe` is beta, and `WowVoiceProxy.exe` is a helper, not a client.
30
+
31
+ The **install path** does identify the build, because each one lives under a
32
+ `_build_` directory:
33
+
34
+ ```text
35
+ D:\Game\World of Warcraft\_retail_\Wow.exe -> retail
36
+ D:\Game\World of Warcraft\_classic_\WowClassic.exe -> classic
37
+ D:\Game\World of Warcraft\_classic_titan_\WowClassic.exe -> titan
38
+ ```
39
+
40
+ Never infer the build from the window title. Retail's title is localized (for
41
+ example `魔兽世界`) and gives no build information.
42
+
43
+ ## Commands
44
+
45
+ ### `lycheedev clients`
46
+
47
+ Every build on disk, with its real version read from the executable, and whether
48
+ the addon is installed:
49
+
50
+ ```text
51
+ retail _retail_ v12.1.0.69587 addon installed
52
+ classic _classic_ v5.5.4.69585 addon installed
53
+ titan _classic_titan_ v3.80.2.69496 addon installed
54
+ classicEra _classic_era_ v1.15.9.69547 not served by the addon
55
+ ```
56
+
57
+ ### `lycheedev instances`
58
+
59
+ Which clients are running right now, with the pid, window handle and build:
60
+
61
+ ```text
62
+ running instances:
63
+ [0] Retail pid=62460 hwnd=0x12410c7a "魔兽世界"
64
+
65
+ commands target this instance automatically
66
+ ```
67
+
68
+ The `[index]` is what you pass to `--instance` and to `use`.
69
+
70
+ ### `lycheedev use [index]`
71
+
72
+ Pin one running client as the default target, so later commands need no flag:
73
+
74
+ ```text
75
+ lycheedev use # the only running client
76
+ lycheedev use 1 # the instance at index 1, when the builds differ
77
+ lycheedev use --clear
78
+ ```
79
+
80
+ Only the build and the instance ordinal are stored, because pids and window
81
+ handles change on every launch. The pin therefore survives a restart: it
82
+ re-resolves against whatever is running now. If the pinned build is not
83
+ running, commands fail with a clear message instead of typing into the wrong
84
+ game.
85
+
86
+ Pinning is for choosing **between builds**. If two windows of the same build are
87
+ open, `use` refuses and asks for one window to be closed — see the ambiguity rule
88
+ below.
89
+
90
+ ## Choosing a target: precedence
91
+
92
+ 1. `--hwnd` / `--pid` — explicit, for scripted use
93
+ 2. `--instance <index>` — one command only, overrides the pin
94
+ 3. the saved pin from `use`
95
+ 4. `--client retail|classic|titan` — filter by build
96
+ 5. the single running instance, when there is exactly one
97
+
98
+ Several instances of **different** builds are safe to keep open: the install path
99
+ separates them, so `--client` picks one.
100
+
101
+ Several instances of the **same** build cannot be told apart. Nothing observable
102
+ from outside the game says which character is behind which window — only a
103
+ build-specific memory reader could, and none ships here. Pinning an ordinal would
104
+ only look precise while risking a slash command in the wrong game. The CLI
105
+ therefore refuses and tells the user to close the extras:
106
+
107
+ ```text
108
+ error: 2 Retail clients are running and cannot be told apart
109
+ close all but one, or close these pids: 62460, 71824
110
+ ```
111
+
112
+ **Ask the user to close all but one window of that build.** Do not invent a way
113
+ to pick between them, and do not offer to pin one.
114
+
115
+ ## Multiple installations
116
+
117
+ A machine can hold more than one WoW root. `--wow-root <path>` selects which one
118
+ to install into and is remembered in `~/.lycheedev/config.json`. `doctor`
119
+ reports the root it is using. Run `lycheedev clients --wow-root <other>` to
120
+ inspect a second root without changing the saved one.
121
+
122
+ ## What cannot be done from outside the game
123
+
124
+ - The **character** on a running client is not readable without a
125
+ build-specific memory reader. Nothing here guesses it. Two instances of the
126
+ same build can only be told apart by pid, window handle or index.
127
+ - The **account** behind a running client is likewise not exposed. SavedVariables
128
+ files are per account, and the newest file is not necessarily the live
129
+ session's account when several accounts are configured.
130
+ - WoW ignores posted window messages, so keyboard delivery needs the window in
131
+ the foreground. That is why targeting the right window matters.
132
+
133
+ If the user must be certain which client is which, ask them to run a trivial
134
+ in-game command (`/dev auto status <task>`) in the window they mean, or to close
135
+ the others.