whitemagic-mcp 9.1.8 → 9.2.0

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 CHANGED
@@ -28,13 +28,13 @@ opencode) at:
28
28
  Or try it directly:
29
29
 
30
30
  ```bash
31
- npx whitemagic-mcp --version # wm 9.0.0
31
+ npx whitemagic-mcp --version # wm 9.2.0
32
32
  npx whitemagic-mcp doctor # environment health check
33
33
  ```
34
34
 
35
35
  The binary is cached under `~/.cache/whitemagic/bin/<release-tag>/`
36
36
  (respects `XDG_CACHE_HOME`); the package version's major tracks the
37
- release tag (9.0.0 → `v9`). Pin a different release with
37
+ release tag (the `v9` tag line). Pin a different release with
38
38
  `WHITEMAGIC_RELEASE`.
39
39
 
40
40
  ## Platforms
package/bin/cli.mjs CHANGED
@@ -15,7 +15,7 @@
15
15
  import { readFileSync } from "node:fs";
16
16
  import { platform } from "node:os";
17
17
  import { spawnSync } from "node:child_process";
18
- import { ensureBinary } from "./lib.mjs";
18
+ import { childEnvironment, ensureBinary } from "./lib.mjs";
19
19
 
20
20
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
21
21
 
@@ -28,5 +28,9 @@ try {
28
28
  }
29
29
 
30
30
  const isWin = platform() === "win32";
31
- const result = spawnSync(bin, process.argv.slice(2), { stdio: "inherit", shell: isWin });
31
+ const result = spawnSync(bin, process.argv.slice(2), {
32
+ stdio: "inherit",
33
+ shell: isWin,
34
+ env: childEnvironment(),
35
+ });
32
36
  process.exit(result.status ?? 1);
package/bin/lib.mjs CHANGED
@@ -28,6 +28,32 @@ export function releaseTag(pkgVersion, env = process.env) {
28
28
  return env.WHITEMAGIC_RELEASE ?? `v${pkgVersion}`;
29
29
  }
30
30
 
31
+ /**
32
+ * Sanitize an install ref exactly as `scripts/install.sh` and the site
33
+ * middleware do: lowercase, `[a-z0-9_-]`, capped at 24 chars. Anything that
34
+ * sanitizes to empty means "no ref".
35
+ */
36
+ export function sanitizeRef(raw) {
37
+ if (typeof raw !== "string") return "";
38
+ return raw
39
+ .toLowerCase()
40
+ .replace(/[^a-z0-9_-]/g, "")
41
+ .slice(0, 24);
42
+ }
43
+
44
+ /**
45
+ * Environment for the spawned `wm` child. Marks the install channel so the
46
+ * binary's local install funnel can attribute this launch (recorded
47
+ * on-device only). A `WM_INSTALL_REF` in the caller's environment rides the
48
+ * channel (`npm:<ref>`) so wrapper scripts and directory listings can tag
49
+ * npm installs the same way `install.sh?ref=` does.
50
+ * Returns a copy: the caller's environment is never mutated.
51
+ */
52
+ export function childEnvironment(env = process.env) {
53
+ const ref = sanitizeRef(env.WM_INSTALL_REF ?? "");
54
+ return { ...env, WM_INSTALL_CHANNEL: ref ? `npm:${ref}` : "npm" };
55
+ }
56
+
31
57
  export function assetFor(p = platform(), a = arch()) {
32
58
  if (p === "linux" && a === "x64") return "wm-linux-x86_64-musl";
33
59
  if (p === "darwin" && a === "arm64") return "wm-macos-aarch64";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitemagic-mcp",
3
- "version": "9.1.8",
3
+ "version": "9.2.0",
4
4
  "description": "WhiteMagic MCP server \u2014 local-first memory and session continuity for AI coding agents. Installs and runs the wm binary; no telemetry by default, no cloud.",
5
5
  "license": "MIT",
6
6
  "bin": {