@mkterswingman/5mghost-wonder 0.0.8 → 0.0.10
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/dist/cli.js
CHANGED
|
@@ -9,6 +9,32 @@ import { createWonderTelemetryRuntime } from "./telemetry/runtime.js";
|
|
|
9
9
|
import { createWonderAuthSdk } from "./auth/runtime.js";
|
|
10
10
|
import { resolveTelemetryCommand, classifyUnhandledCliError, } from "./telemetry/policy.js";
|
|
11
11
|
import { buildCompletionTelemetry } from "./telemetry/events.js";
|
|
12
|
+
// How long to wait for in-flight telemetry flushes before exiting. Long
|
|
13
|
+
// enough to cover the SDK's full network roundtrip in the typical case
|
|
14
|
+
// (~1s on a healthy connection), short enough to not block a stuck
|
|
15
|
+
// upload behind the SDK's own 10s timeout. Events that miss the
|
|
16
|
+
// deadline stay in the outbox and are picked up by the next
|
|
17
|
+
// `wonder` invocation's startup flush.
|
|
18
|
+
const TELEMETRY_DRAIN_MS = 5000;
|
|
19
|
+
async function drainTelemetry(rt) {
|
|
20
|
+
if (!rt)
|
|
21
|
+
return;
|
|
22
|
+
const flightTask = rt.flushTask;
|
|
23
|
+
if (!flightTask)
|
|
24
|
+
return;
|
|
25
|
+
let timer;
|
|
26
|
+
const deadline = new Promise((resolve) => {
|
|
27
|
+
timer = setTimeout(resolve, TELEMETRY_DRAIN_MS);
|
|
28
|
+
timer.unref?.();
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
await Promise.race([flightTask.catch(() => undefined), deadline]);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
if (timer)
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
12
38
|
// ── Global error handlers (catch errors outside async dispatch) ─────────────
|
|
13
39
|
process.on("uncaughtException", (err) => {
|
|
14
40
|
process.stderr.write(`Unhandled exception: ${String(err)}\n`);
|
|
@@ -51,6 +77,7 @@ try {
|
|
|
51
77
|
// No arguments → show help, exit 0
|
|
52
78
|
if (argv.length === 0) {
|
|
53
79
|
const result = await runHelpCommand(io);
|
|
80
|
+
await drainTelemetry(telemetry);
|
|
54
81
|
process.exit(result.exitCode);
|
|
55
82
|
}
|
|
56
83
|
const result = await dispatchWonderCommand(argv, context);
|
|
@@ -62,6 +89,7 @@ try {
|
|
|
62
89
|
// Telemetry failure must never change the CLI exit code.
|
|
63
90
|
}
|
|
64
91
|
}
|
|
92
|
+
await drainTelemetry(telemetry);
|
|
65
93
|
process.exit(result.exitCode);
|
|
66
94
|
}
|
|
67
95
|
catch (err) {
|
|
@@ -79,5 +107,6 @@ catch (err) {
|
|
|
79
107
|
}
|
|
80
108
|
}
|
|
81
109
|
io.stderr(`Unhandled error: ${String(err)}`);
|
|
110
|
+
await drainTelemetry(telemetry);
|
|
82
111
|
process.exit(1);
|
|
83
112
|
}
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -44,6 +44,12 @@ try {
|
|
|
44
44
|
} else {
|
|
45
45
|
console.log("[wonder] No skill targets updated.");
|
|
46
46
|
}
|
|
47
|
+
// Always remind the user to restart their AI session — skill text loaded
|
|
48
|
+
// into a running session does not refresh after files on disk are replaced.
|
|
49
|
+
console.log("");
|
|
50
|
+
console.log("[wonder] ⚠️ IMPORTANT: Restart your AI session (Claude Code / Codex / Gemini / etc.)");
|
|
51
|
+
console.log("[wonder] before invoking any wonder skill. Open a new chat, or run /exit and re-enter.");
|
|
52
|
+
console.log("[wonder] The AI cannot pick up the newly installed skill text in this running session.");
|
|
47
53
|
} catch (err) {
|
|
48
54
|
// Skill install failure must never break npm install
|
|
49
55
|
console.log(`[wonder] Skill install failed (non-fatal): ${String(err)}`);
|
|
@@ -5,6 +5,16 @@ description: Use this skill when the user wants to install or set up wonder, say
|
|
|
5
5
|
|
|
6
6
|
# Setup wonder — 企微文档 CLI 安装向导
|
|
7
7
|
|
|
8
|
+
## Skill version
|
|
9
|
+
|
|
10
|
+
This skill matches **wonder 0.0.10**.
|
|
11
|
+
|
|
12
|
+
Once the CLI is installed in Step 1, run `wonder --version`. If the output does not equal `0.0.10`, the CLI on disk has drifted from the skill text loaded in this session. Ask the user to run `/update-5mghost-wonder`, then **start a fresh AI session** (`/exit` and re-enter, or open a new chat) — skill text already loaded into a running session does not refresh after `wonder update`, even though the file on disk has been replaced.
|
|
13
|
+
|
|
14
|
+
After a successful first install, also remind the user to start a fresh AI session before invoking `/use-5mghost-wonder` for the first time. The skill files were just written to disk; the current session never loaded them.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
8
18
|
You are guiding the user through installing and configuring `wonder`, the WeCom document reader CLI.
|
|
9
19
|
|
|
10
20
|
Execute each step in order using the Bash tool. Stop and ask for user interaction only when a step requires it (e.g., browser OAuth, QR code scan). After each detection step, only proceed to installation if the tool is missing.
|
|
@@ -5,6 +5,12 @@ description: Use this skill when the user wants to update or upgrade wonder, say
|
|
|
5
5
|
|
|
6
6
|
# Update wonder — 升级 5mghost-wonder CLI
|
|
7
7
|
|
|
8
|
+
## Skill version
|
|
9
|
+
|
|
10
|
+
This skill matches **wonder 0.0.10**.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
8
14
|
Run the CLI's built-in updater. It reinstalls the latest published version globally via npm.
|
|
9
15
|
|
|
10
16
|
```bash
|
|
@@ -17,7 +23,7 @@ When the command completes, verify the new version is in place:
|
|
|
17
23
|
wonder --version
|
|
18
24
|
```
|
|
19
25
|
|
|
20
|
-
After updating, **the bundled skills (`setup-5mghost-wonder`, `use-5mghost-wonder`, `update-5mghost-wonder`) on disk are refreshed by the package's `postinstall`**, but the AI session's already-loaded skill text is the old version. Tell the user
|
|
26
|
+
After updating, **the bundled skills (`setup-5mghost-wonder`, `use-5mghost-wonder`, `update-5mghost-wonder`) on disk are refreshed by the package's `postinstall`**, but the AI session's already-loaded skill text is the old version. **Tell the user — clearly and proactively — that they must start a new AI session before the new skill text takes effect**: open a fresh chat, restart the CLI, or run `/exit` and re-enter. Until they do, the AI is still operating on the old skill regardless of what `wonder --version` reports.
|
|
21
27
|
|
|
22
28
|
If `wonder update` exits non-zero, the most common cause is npm permission or registry issues. Re-run with the user's terminal so they can see the npm error directly:
|
|
23
29
|
|
|
@@ -5,6 +5,12 @@ description: Use this skill when the user shares a URL containing "doc.weixin.qq
|
|
|
5
5
|
|
|
6
6
|
# use-5mghost-wonder — 企微文档读取操作指南
|
|
7
7
|
|
|
8
|
+
## Skill version
|
|
9
|
+
|
|
10
|
+
This skill matches **wonder 0.0.10**.
|
|
11
|
+
|
|
12
|
+
In the Session Initialization step below, after running `wonder --version`, compare the output to `0.0.10`. If they differ, the loaded skill text and the CLI on disk are out of sync. Stop, tell the user to run `/update-5mghost-wonder`, and then **start a fresh AI session** (`/exit` and re-enter, or open a new chat) before trying again. `wonder update` rewrites the skill files on disk, but skill text already loaded into the current session does not auto-refresh.
|
|
13
|
+
|
|
8
14
|
## Session Initialization (first use only per session)
|
|
9
15
|
|
|
10
16
|
The **first time** you encounter a WeCom document URL in a session, run these checks before processing the document. Remember you have already done this — do not repeat in subsequent calls within the same session.
|
|
@@ -13,7 +19,10 @@ The **first time** you encounter a WeCom document URL in a session, run these ch
|
|
|
13
19
|
# 1. Check for updates
|
|
14
20
|
wonder update
|
|
15
21
|
|
|
16
|
-
# 2.
|
|
22
|
+
# 2. Confirm the CLI version matches this skill's expected version (0.0.10)
|
|
23
|
+
wonder --version
|
|
24
|
+
|
|
25
|
+
# 3. Check WeCom cookie status
|
|
17
26
|
wonder wecom status
|
|
18
27
|
```
|
|
19
28
|
|