@muggleai/works 5.22.0-staging.156 → 5.22.0-staging.157

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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "muggle-works",
3
+ "owner": {
4
+ "name": "Muggle AI",
5
+ "email": "support@muggle-ai.com"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "muggleai",
10
+ "source": "./plugin",
11
+ "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
12
+ "version": "5.22.0-staging.157"
13
+ }
14
+ ]
15
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.22.0-staging.156",
4
+ "version": "5.22.0-staging.157",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.22.0-staging.156",
3
+ "version": "5.22.0-staging.157",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.22.0-staging.156",
5
+ "version": "5.22.0-staging.157",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -48,7 +48,7 @@ Two lanes ship on npm, each with its own dist-tag:
48
48
  - Note: `muggle upgrade` only manages the Electron runner — it does NOT upgrade the CLI npm package. That is why step 3 must run first.
49
49
  - The runner tracks published Studio releases only. When it reports "already on the latest version", that is the newest *released* runner — code merged to the Studio repo since that release is not in it, and no upgrade command can reach it until a new runner is published. Say so rather than implying the merge shipped.
50
50
 
51
- 5. **Reload plugins** — the npm install (step 3) triggers a postinstall script that updates the plugin cache at `~/.claude/plugins/cache/`, but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
51
+ 5. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
52
52
 
53
53
  > Run **`/reload-plugins`** to load the updated skills, agents, and hooks.
54
54
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-156-1",
4
- "commitSha": "5bd15d6cc0872de240bfbe041fac90c0b75d7f26",
5
- "buildTime": "2026-10-21T05:50:00Z",
3
+ "buildId": "run-157-1",
4
+ "commitSha": "981415e27e3c996535a0249c6a20dd74a9860c9d",
5
+ "buildTime": "2026-10-21T08:31:54Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@muggleai/works",
3
3
  "mcpName": "io.github.multiplex-ai/muggle",
4
- "version": "5.22.0-staging.156",
4
+ "version": "5.22.0-staging.157",
5
5
  "description": "13 years of Microsoft hyperscale engineering, packaged as a harness for your AI coding agent.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -12,7 +12,9 @@
12
12
  "dist",
13
13
  "plugin",
14
14
  "bin/muggle.js",
15
+ ".claude-plugin/marketplace.json",
15
16
  "scripts/postinstall.mjs",
17
+ "scripts/claude-marketplace-sync.mjs",
16
18
  "scripts/onboarding-backfill.mjs",
17
19
  "scripts/release-integrity",
18
20
  "config/runtime-targets.json"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.22.0-staging.156",
4
+ "version": "5.22.0-staging.157",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.22.0-staging.156",
3
+ "version": "5.22.0-staging.157",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.22.0-staging.156",
5
+ "version": "5.22.0-staging.157",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -48,7 +48,7 @@ Two lanes ship on npm, each with its own dist-tag:
48
48
  - Note: `muggle upgrade` only manages the Electron runner — it does NOT upgrade the CLI npm package. That is why step 3 must run first.
49
49
  - The runner tracks published Studio releases only. When it reports "already on the latest version", that is the newest *released* runner — code merged to the Studio repo since that release is not in it, and no upgrade command can reach it until a new runner is published. Say so rather than implying the merge shipped.
50
50
 
51
- 5. **Reload plugins** — the npm install (step 3) triggers a postinstall script that updates the plugin cache at `~/.claude/plugins/cache/`, but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
51
+ 5. **Reload plugins** — the global npm install (step 3) runs a postinstall script that points Claude Code's `muggle-works` marketplace at the installed package, so the plugin loads from the version just installed — but Claude Code only picks up new skills/agents/hooks after a reload. Tell the user:
52
52
 
53
53
  > Run **`/reload-plugins`** to load the updated skills, agents, and hooks.
54
54
 
@@ -0,0 +1,119 @@
1
+ import { existsSync, readFileSync, writeFileSync } from "fs";
2
+ import { join } from "path";
3
+
4
+ const PLUGIN_REGISTRY_KEY = "muggleai@muggle-works";
5
+ const MARKETPLACE_NAME = "muggle-works";
6
+ const USER_SCOPE = "user";
7
+
8
+ /**
9
+ * Outcome of pointing Claude Code at the installed package.
10
+ * @typedef {object} MarketplaceSyncResult
11
+ * @property {boolean} changed - Whether any Claude Code file was rewritten.
12
+ * @property {string} reason - Why the attempt ended the way it did.
13
+ */
14
+
15
+ /**
16
+ * Read a JSON file, or `fallback` when it does not exist.
17
+ *
18
+ * @param {string} filePath - File to read.
19
+ * @param {object | null} fallback - Value for a missing file.
20
+ * @returns {object | null} The parsed contents.
21
+ * @throws {Error} When the file exists but is not valid JSON.
22
+ */
23
+ function readJsonFile(filePath, fallback) {
24
+ if (!existsSync(filePath)) {
25
+ return fallback;
26
+ }
27
+ return JSON.parse(readFileSync(filePath, "utf-8"));
28
+ }
29
+
30
+ function writeJsonFile(filePath, contents) {
31
+ writeFileSync(filePath, `${JSON.stringify(contents, null, 2)}\n`, "utf-8");
32
+ }
33
+
34
+ /**
35
+ * Register the installed package as the `muggle-works` marketplace, so Claude Code loads the
36
+ * plugin in place from this install on the next session or `/reload-plugins`.
37
+ *
38
+ * A git-sourced marketplace resolves the plugin version from the remote's default branch, which
39
+ * never carries a staging build and goes stale between Claude Code's own refreshes; a directory
40
+ * source makes the npm-installed version the one Claude Code runs on either release lane. A
41
+ * marketplace declared in `settings.json` is re-applied at session start and wins over
42
+ * `known_marketplaces.json`, so an existing declaration is repointed too — one is never added.
43
+ *
44
+ * Only acts when the plugin is already installed in Claude Code; it never installs it.
45
+ *
46
+ * @param {object} options
47
+ * @param {string} options.claudeConfigDir - The ~/.claude directory.
48
+ * @param {string} options.packageRootDir - Root of the globally installed `@muggleai/works`.
49
+ * @param {Date} [options.now] - Timestamp for `lastUpdated`; defaults to the current time.
50
+ * @returns {MarketplaceSyncResult} What happened, for the caller to log.
51
+ */
52
+ export function pointClaudeMarketplaceAtPackage({ claudeConfigDir, packageRootDir, now = new Date() }) {
53
+ const pluginsDir = join(claudeConfigDir, "plugins");
54
+ const registryPath = join(pluginsDir, "installed_plugins.json");
55
+ const knownMarketplacesPath = join(pluginsDir, "known_marketplaces.json");
56
+ const settingsPath = join(claudeConfigDir, "settings.json");
57
+ const pluginDir = join(packageRootDir, "plugin");
58
+ const pluginManifestPath = join(pluginDir, ".claude-plugin", "plugin.json");
59
+
60
+ if (!existsSync(join(packageRootDir, ".claude-plugin", "marketplace.json")) || !existsSync(pluginManifestPath)) {
61
+ return { changed: false, reason: "package ships no Claude marketplace manifest" };
62
+ }
63
+
64
+ let registry;
65
+ let knownMarketplaces;
66
+ let settings;
67
+ let packageVersion;
68
+ try {
69
+ registry = readJsonFile(registryPath, null);
70
+ knownMarketplaces = readJsonFile(knownMarketplacesPath, {});
71
+ settings = readJsonFile(settingsPath, null);
72
+ packageVersion = readJsonFile(pluginManifestPath, null).version;
73
+ } catch (error) {
74
+ return { changed: false, reason: `unreadable Claude Code file: ${error.message}` };
75
+ }
76
+
77
+ const registryEntries = registry?.plugins?.[PLUGIN_REGISTRY_KEY];
78
+ if (!Array.isArray(registryEntries) || registryEntries.length === 0) {
79
+ return { changed: false, reason: "muggle plugin not installed in Claude Code" };
80
+ }
81
+
82
+ const directorySource = { source: "directory", path: packageRootDir };
83
+ const isDirectorySource = (source) => source?.source === directorySource.source && source?.path === directorySource.path;
84
+ const lastUpdated = now.toISOString();
85
+
86
+ const knownEntry = knownMarketplaces[MARKETPLACE_NAME];
87
+ const isKnownCurrent = isDirectorySource(knownEntry?.source) && knownEntry.installLocation === packageRootDir;
88
+
89
+ const declaredMarketplace = settings?.extraKnownMarketplaces?.[MARKETPLACE_NAME];
90
+ const isDeclarationCurrent = declaredMarketplace === undefined || isDirectorySource(declaredMarketplace.source);
91
+
92
+ const userEntry = registryEntries.find((entry) => entry.scope === USER_SCOPE);
93
+ const isUserEntryCurrent = userEntry === undefined || (userEntry.installPath === pluginDir && userEntry.version === packageVersion);
94
+
95
+ if (isKnownCurrent && isDeclarationCurrent && isUserEntryCurrent) {
96
+ return { changed: false, reason: `already loading ${packageVersion} from ${packageRootDir}` };
97
+ }
98
+
99
+ try {
100
+ if (!isDeclarationCurrent) {
101
+ declaredMarketplace.source = directorySource;
102
+ writeJsonFile(settingsPath, settings);
103
+ }
104
+ if (!isKnownCurrent) {
105
+ knownMarketplaces[MARKETPLACE_NAME] = { source: directorySource, installLocation: packageRootDir, lastUpdated: lastUpdated };
106
+ writeJsonFile(knownMarketplacesPath, knownMarketplaces);
107
+ }
108
+ if (!isUserEntryCurrent) {
109
+ userEntry.installPath = pluginDir;
110
+ userEntry.version = packageVersion;
111
+ userEntry.lastUpdated = lastUpdated;
112
+ writeJsonFile(registryPath, registry);
113
+ }
114
+ } catch (error) {
115
+ return { changed: false, reason: `could not write Claude Code file: ${error.message}` };
116
+ }
117
+
118
+ return { changed: true, reason: `loading ${packageVersion} from ${packageRootDir}` };
119
+ }
@@ -25,6 +25,7 @@ import { dirname, join } from "path";
25
25
  import { pipeline } from "stream/promises";
26
26
  import { createRequire } from "module";
27
27
  import { fileURLToPath } from "url";
28
+ import { pointClaudeMarketplaceAtPackage } from "./claude-marketplace-sync.mjs";
28
29
  import { backfillOnboardingStamp } from "./onboarding-backfill.mjs";
29
30
  import {
30
31
  SIGNATURE_BUNDLE_SUFFIX,
@@ -924,99 +925,33 @@ function upsertCursorMcpConfig() {
924
925
  log(`Cursor MCP config updated at ${cursorMcpConfigPath}`);
925
926
  }
926
927
 
927
- const CLAUDE_PLUGINS_DIRECTORY_NAME = ".claude";
928
- const CLAUDE_PLUGINS_SUBDIRECTORY_NAME = "plugins";
929
- const CLAUDE_INSTALLED_PLUGINS_FILE_NAME = "installed_plugins.json";
930
- const CLAUDE_PLUGIN_REGISTRY_KEY = "muggleai@muggle-works";
931
- const CLAUDE_MARKETPLACE_NAME = "muggle-works";
932
- const CLAUDE_PLUGIN_NAME = "muggleai";
933
-
934
928
  /**
935
- * Sync the Claude Code plugin cache after npm install.
936
- *
937
- * The Claude Code plugin system caches plugin files in
938
- * ~/.claude/plugins/cache/{marketplace}/{plugin}/{version}/
939
- * and tracks installations in ~/.claude/plugins/installed_plugins.json.
940
- *
941
- * npm install does not trigger a cache refresh, so users would need
942
- * to restart their session to pick up new skills/hooks. This function
943
- * copies the updated plugin directory into the cache and updates the
944
- * registry so `/reload-plugins` picks up the new version immediately.
929
+ * Point Claude Code's `muggle-works` marketplace at this install, so the next session or
930
+ * `/reload-plugins` loads the version npm just installed.
945
931
  *
946
- * Only runs when the muggle plugin is already installed (won't auto-install).
932
+ * Only a global install qualifies: `npx` and project-local copies (the plugin's own MCP server
933
+ * runs through `npx`) are not the install the user upgrades, and repointing at one would pin
934
+ * Claude Code to a throwaway or different version.
947
935
  */
948
- function syncClaudePluginCache() {
949
- const packageJson = require("../package.json");
950
- const packageVersion = packageJson.version;
951
-
952
- const pluginsDir = join(homedir(), CLAUDE_PLUGINS_DIRECTORY_NAME, CLAUDE_PLUGINS_SUBDIRECTORY_NAME);
953
- const registryPath = join(pluginsDir, CLAUDE_INSTALLED_PLUGINS_FILE_NAME);
954
-
955
- if (!existsSync(registryPath)) {
956
- log("Claude plugin sync skipped: no installed_plugins.json found.");
957
- return;
958
- }
959
-
960
- let registry;
961
- try {
962
- const raw = readFileSync(registryPath, "utf-8");
963
- registry = JSON.parse(raw);
964
- } catch (error) {
965
- log(`Claude plugin sync skipped: could not parse installed_plugins.json (${error.message})`);
966
- return;
967
- }
968
-
969
- if (!registry.plugins || !registry.plugins[CLAUDE_PLUGIN_REGISTRY_KEY]) {
970
- log("Claude plugin sync skipped: muggle plugin not installed in Claude Code.");
971
- return;
972
- }
973
-
974
- const entries = registry.plugins[CLAUDE_PLUGIN_REGISTRY_KEY];
975
- if (!Array.isArray(entries) || entries.length === 0) {
976
- log("Claude plugin sync skipped: no muggle plugin entries found.");
936
+ function syncClaudeMarketplace() {
937
+ if (process.env.npm_config_global !== "true") {
938
+ log("Claude plugin sync skipped: not a global install.");
977
939
  return;
978
940
  }
979
941
 
980
- const currentEntry = entries[0];
981
- if (currentEntry.version === packageVersion) {
982
- log(`Claude plugin cache already at ${packageVersion}, no sync needed.`);
983
- return;
984
- }
985
-
986
- const sourcePluginDir = join(getPackageRootDir(), "plugin");
987
- if (!existsSync(sourcePluginDir)) {
988
- log("Claude plugin sync skipped: plugin directory not found in package.");
989
- return;
990
- }
991
-
992
- const cacheDir = join(pluginsDir, "cache", CLAUDE_MARKETPLACE_NAME, CLAUDE_PLUGIN_NAME, packageVersion);
993
-
994
- const previousVersion = currentEntry.version;
995
-
996
- try {
997
- if (existsSync(cacheDir)) {
998
- rmSync(cacheDir, { recursive: true, force: true });
999
- }
1000
- cpSync(sourcePluginDir, cacheDir, { recursive: true });
1001
-
1002
- currentEntry.installPath = cacheDir;
1003
- currentEntry.version = packageVersion;
1004
- currentEntry.lastUpdated = new Date().toISOString();
1005
-
1006
- writeFileSync(registryPath, `${JSON.stringify(registry, null, 2)}\n`, "utf-8");
1007
-
1008
- log(`Claude plugin cache updated: ${previousVersion} → ${packageVersion} at ${cacheDir}`);
1009
- } catch (error) {
1010
- logError(`Claude plugin sync failed: ${error.message}`);
1011
- }
942
+ const marketplaceSync = pointClaudeMarketplaceAtPackage({
943
+ claudeConfigDir: join(homedir(), ".claude"),
944
+ packageRootDir: getPackageRootDir(),
945
+ });
946
+ log(`Claude plugin sync ${marketplaceSync.changed ? "updated" : "skipped"}: ${marketplaceSync.reason}.`);
1012
947
  }
1013
948
 
1014
949
  /**
1015
950
  * Run the onboarding backfill and log only when it actually stamps.
1016
951
  */
1017
952
  function logOnboardingBackfill() {
1018
- const result = backfillOnboardingStamp(join(homedir(), ".muggle-ai"));
1019
- if (result.stamped) {
953
+ const onboardingBackfill = backfillOnboardingStamp(join(homedir(), ".muggle-ai"));
954
+ if (onboardingBackfill.stamped) {
1020
955
  log("Existing installation: first-run walkthrough marked as already seen.");
1021
956
  }
1022
957
  }
@@ -1028,7 +963,7 @@ initLogFile();
1028
963
  logOnboardingBackfill();
1029
964
  removeVersionOverrideFile();
1030
965
  syncCursorSkills();
1031
- syncClaudePluginCache();
966
+ syncClaudeMarketplace();
1032
967
  upsertCursorMcpConfig();
1033
968
  downloadElectronApp()
1034
969
  .catch(logError)