@muggleai/works 5.22.0-staging.155 → 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
+ }
@@ -362,6 +362,80 @@ var STEP_LIST_ELISION_THRESHOLD = 20;
362
362
  var STEP_LIST_HEAD_COUNT = 12;
363
363
  var STEP_LIST_TAIL_COUNT = 8;
364
364
  var STEP_ELEMENT_ID_SUFFIX = /\s*with element id (?:\[\d+\]|#\d+)/g;
365
+ var STEP_SCREENSHOT_MARKER = "\u{1F4F7}";
366
+ var TEST_DETAILS_DIVIDER = "---";
367
+ var TEST_DETAILS_ANCHOR_PREFIX = "muggle-test-";
368
+ var STEP_THUMBNAIL_WIDTH_PX = 840;
369
+ var STEP_THUMBNAIL_QUALITY = 70;
370
+ var STEP_PAIR_IMAGE_WIDTH = 420;
371
+ var MAX_COMMENT_BYTES = 64e3;
372
+
373
+ // src/cli/pr-section/resolve-urls-types.ts
374
+ var GS_SCHEME = "gs://";
375
+ var PUBLIC_URL_PATH = "/v1/protected/storage/publicUrl";
376
+ var RESOLVE_TIMEOUT_MS = 1e4;
377
+ var LOG_PREFIX = "build-pr-section";
378
+ var IMAGE_PROXY_PREFIX = "https://images.weserv.nl/?url=";
379
+ var StepSchema = z.object({
380
+ stepIndex: z.number().int().nonnegative(),
381
+ action: z.string().min(1),
382
+ description: z.string().min(1).optional(),
383
+ screenshotUrl: z.string().url(),
384
+ afterScreenshotUrl: z.string().url().optional()
385
+ });
386
+ var PassedTestSchema = z.object({
387
+ name: z.string().min(1),
388
+ testCaseId: z.string().min(1),
389
+ testScriptId: z.string().min(1).optional(),
390
+ runId: z.string().min(1),
391
+ viewUrl: z.string().url(),
392
+ status: z.literal("passed"),
393
+ steps: z.array(StepSchema),
394
+ useCaseName: z.string().min(1).optional(),
395
+ description: z.string().min(1).optional(),
396
+ endingScreenshotUrl: z.string().url().optional(),
397
+ endingScreenshotCaption: z.string().min(1).optional()
398
+ });
399
+ var FailedTestSchema = z.object({
400
+ name: z.string().min(1),
401
+ testCaseId: z.string().min(1),
402
+ testScriptId: z.string().min(1).optional(),
403
+ runId: z.string().min(1),
404
+ viewUrl: z.string().url(),
405
+ status: z.literal("failed"),
406
+ steps: z.array(StepSchema),
407
+ failureStepIndex: z.number().int().nonnegative(),
408
+ error: z.string().min(1),
409
+ artifactsDir: z.string().min(1).optional(),
410
+ useCaseName: z.string().min(1).optional(),
411
+ description: z.string().min(1).optional(),
412
+ endingScreenshotUrl: z.string().url().optional(),
413
+ endingScreenshotCaption: z.string().min(1).optional()
414
+ });
415
+ var InconclusiveTestSchema = z.object({
416
+ name: z.string().min(1),
417
+ testCaseId: z.string().min(1),
418
+ testScriptId: z.string().min(1).optional(),
419
+ runId: z.string().min(1),
420
+ viewUrl: z.string().url(),
421
+ status: z.literal("inconclusive"),
422
+ steps: z.array(StepSchema),
423
+ reason: z.string().min(1),
424
+ artifactsDir: z.string().min(1).optional(),
425
+ useCaseName: z.string().min(1).optional(),
426
+ description: z.string().min(1).optional(),
427
+ endingScreenshotUrl: z.string().url().optional(),
428
+ endingScreenshotCaption: z.string().min(1).optional()
429
+ });
430
+ var TestResultSchema = z.discriminatedUnion("status", [
431
+ PassedTestSchema,
432
+ FailedTestSchema,
433
+ InconclusiveTestSchema
434
+ ]);
435
+ var E2eReportSchema = z.object({
436
+ projectId: z.string().min(1),
437
+ tests: z.array(TestResultSchema)
438
+ });
365
439
 
366
440
  // src/cli/pr-section/render.ts
367
441
  function resolveLatestRuns(tests) {
@@ -503,14 +577,26 @@ function renderOverview(report) {
503
577
  if (entry.type === "test") {
504
578
  lines.push(renderOverviewBullet(entry.entry, numbering, ""));
505
579
  } else {
506
- lines.push(`- **${entry.key}**`);
507
- for (const member of entry.members) {
508
- lines.push(renderOverviewBullet(member, numbering, " "));
509
- }
580
+ lines.push(...renderUseCaseGroup(entry.key, entry.members, numbering));
510
581
  }
511
582
  }
512
583
  return lines.join("\n");
513
584
  }
585
+ function renderUseCaseGroup(useCaseName, members, numbering) {
586
+ const groupCounts = countTests(members);
587
+ const isAllPassed = groupCounts.passed === groupCounts.total;
588
+ const tally = [
589
+ groupCounts.passed > 0 ? `\u2705 ${groupCounts.passed} passed` : null,
590
+ groupCounts.failed > 0 ? `\u274C ${groupCounts.failed} failed` : null,
591
+ groupCounts.inconclusive > 0 ? `\u26A0\uFE0F ${groupCounts.inconclusive} inconclusive` : null
592
+ ].filter((part) => part !== null).join(" \xB7 ");
593
+ return [
594
+ "",
595
+ `<details${isAllPassed ? "" : " open"}><summary><b>${escapeHtml(useCaseName)}</b> \u2014 ${tally}</summary>`,
596
+ ...indented(members.map((member) => renderOverviewBullet(member, numbering, ""))),
597
+ "</details>"
598
+ ];
599
+ }
514
600
  function buildTestNumbering(latestRuns) {
515
601
  const map = /* @__PURE__ */ new Map();
516
602
  latestRuns.forEach((entry, i) => {
@@ -520,7 +606,8 @@ function buildTestNumbering(latestRuns) {
520
606
  }
521
607
  function renderOverviewBullet(entry, numbering, indent) {
522
608
  const rerunNote = entry.attempts > 1 ? ` _(${entry.attempts} runs)_` : "";
523
- return `${indent}- ${statusEmoji(entry.test)} **${numbering.get(entry.test.testCaseId)}.** ${entry.test.name}${rerunNote}`;
609
+ const detailsLink = ` \xB7 [see details](#${testAnchor(entry.test)})`;
610
+ return `${indent}- ${statusEmoji(entry.test)} **${numbering.get(entry.test.testCaseId)}.** ${entry.test.name}${rerunNote}${detailsLink}`;
524
611
  }
525
612
  function buildGroupedLayout(latestRuns) {
526
613
  const groups = /* @__PURE__ */ new Map();
@@ -542,21 +629,39 @@ function buildGroupedLayout(latestRuns) {
542
629
  }
543
630
  return layout;
544
631
  }
545
- function renderTestDetails(entry, projectId, testNumber, dashboardBaseUrl = DASHBOARD_URL_BASE) {
632
+ function renderTestDetails(entry, projectId, testNumber, dashboardBaseUrl = DASHBOARD_URL_BASE, screenshotDetail = "before-and-after" /* BeforeAndAfter */) {
546
633
  const { test } = entry;
547
- const lines = [`#### ${statusEmoji(test)} ${testNumber}. ${test.name}`, ""];
548
- if (test.description) {
634
+ const lines = [`<a name="${testAnchor(test)}"></a>`, "", `#### ${statusEmoji(test)} ${testNumber}. ${test.name}`, ""];
635
+ if (test.description && !isSameText(test.description, test.name)) {
549
636
  lines.push(`_${test.description.replace(/\s*\n\s*/g, " ")}_`, "");
550
637
  }
551
638
  lines.push(...renderResultTable(entry, projectId, dashboardBaseUrl));
552
- const steps = renderSteps(test, projectId, dashboardBaseUrl) ?? [];
639
+ const steps = renderSteps(test, projectId, dashboardBaseUrl, screenshotDetail) ?? [];
553
640
  const frame = renderEndingFrame(test) ?? [];
554
641
  const evidence = [...steps, ...steps.length > 0 && frame.length > 0 ? [""] : [], ...frame];
555
642
  if (evidence.length > 0) {
556
- lines.push("", "<details><summary><b>Steps and screenshots</b></summary>", "", ...evidence, "", "</details>");
643
+ lines.push("", `<details><summary>${evidenceToggleLabel(test, screenshotDetail)}</summary>`, ...indented(evidence), "</details>");
557
644
  }
558
645
  return lines.join("\n");
559
646
  }
647
+ function indented(content) {
648
+ return ["<dl><dd>", "", ...content, "", "</dd></dl>"];
649
+ }
650
+ function testAnchor(test) {
651
+ return `${TEST_DETAILS_ANCHOR_PREFIX}${test.testCaseId}`;
652
+ }
653
+ function evidenceToggleLabel(test, screenshotDetail) {
654
+ const count = test.steps.length;
655
+ if (count === 0) {
656
+ return "<kbd>Show the ending screen</kbd>";
657
+ }
658
+ const stepCount = `${count} ${count === 1 ? "step" : "steps"}`;
659
+ return screenshotDetail === "none" /* None */ ? `<kbd>Show ${stepCount}</kbd>` : `<kbd>Show ${stepCount} and screenshots</kbd>`;
660
+ }
661
+ function isSameText(left, right) {
662
+ const normalize = (text) => text.trim().replace(/[\s.!?]+$/, "").replace(/\s+/g, " ").toLowerCase();
663
+ return normalize(left) === normalize(right);
664
+ }
560
665
  function renderEndingFrame(test) {
561
666
  const frame = endingFrame(test);
562
667
  if (!frame) {
@@ -568,17 +673,35 @@ function renderEndingFrame(test) {
568
673
  fullSizeImage(frame.url, test.name)
569
674
  ];
570
675
  }
571
- function renderSteps(test, projectId, dashboardBaseUrl) {
676
+ function renderStepScreenshots(step, position, screenshotDetail) {
677
+ if (!step.afterScreenshotUrl || screenshotDetail === "before-only" /* BeforeOnly */) {
678
+ return [thumbnailImage(step.screenshotUrl, STEP_IMAGE_WIDTH, `Step ${position}`)];
679
+ }
680
+ return [
681
+ "| Before | After |",
682
+ "|:--|:--|",
683
+ `| ${thumbnailImage(step.screenshotUrl, STEP_PAIR_IMAGE_WIDTH, `Step ${position} before`)} | ${thumbnailImage(step.afterScreenshotUrl, STEP_PAIR_IMAGE_WIDTH, `Step ${position} after`)} |`
684
+ ];
685
+ }
686
+ function thumbnailImage(url, displayWidth, alt) {
687
+ return `<img src="${thumbnailUrl(url)}" width="${displayWidth}" alt="${alt}">`;
688
+ }
689
+ function thumbnailUrl(url) {
690
+ const proxied = url.startsWith(IMAGE_PROXY_PREFIX) ? url : `${IMAGE_PROXY_PREFIX}${encodeURIComponent(url)}`;
691
+ return `${proxied}&amp;w=${STEP_THUMBNAIL_WIDTH_PX}&amp;q=${STEP_THUMBNAIL_QUALITY}&amp;output=jpg`;
692
+ }
693
+ function renderSteps(test, projectId, dashboardBaseUrl, screenshotDetail) {
572
694
  const { steps } = test;
573
695
  if (steps.length === 0) {
574
696
  return null;
575
697
  }
576
- const collapsible = (step, position) => `<details><summary>${position} \xB7 ${stepText(step)}</summary>
577
-
578
- <img src="${step.screenshotUrl}" width="${STEP_IMAGE_WIDTH}" alt="Step ${position}">
579
-
580
- </details>`;
581
- const heading = ["**Steps** \u2014 click a step to see its screenshot", ""];
698
+ const isTextOnly = screenshotDetail === "none" /* None */;
699
+ const collapsible = (step, position) => isTextOnly ? `- ${position} \xB7 ${stepText(step)}` : [
700
+ `<details><summary>${STEP_SCREENSHOT_MARKER} ${position} \xB7 ${stepText(step)}</summary>`,
701
+ ...indented(renderStepScreenshots(step, position, screenshotDetail)),
702
+ "</details>"
703
+ ].join("\n");
704
+ const heading = isTextOnly ? ["**Steps**", ""] : ["**Steps** \u2014 click a step to see its screenshots", ""];
582
705
  if (steps.length <= STEP_LIST_ELISION_THRESHOLD) {
583
706
  return [...heading, ...steps.map((step, i) => collapsible(step, i + 1))];
584
707
  }
@@ -595,14 +718,14 @@ function renderSteps(test, projectId, dashboardBaseUrl) {
595
718
  }
596
719
  function renderResultTable(entry, projectId, dashboardBaseUrl) {
597
720
  const { test } = entry;
598
- const rows = ["| | |", "|:--|:--|"];
721
+ const rows = [];
599
722
  if (test.status === "passed") {
600
- rows.push("| **Result** | \u2705 Passed |");
723
+ rows.push("| **Result** | \u2705 Passed |", "|:--|:--|");
601
724
  } else if (test.status === "failed") {
602
- rows.push(`| **Result** | \u274C Failed at step ${failureOrdinal(test, test.failureStepIndex)} |`);
725
+ rows.push(`| **Result** | \u274C Failed at step ${failureOrdinal(test, test.failureStepIndex)} |`, "|:--|:--|");
603
726
  rows.push(`| **Why** | ${tableCell(escapeHtml(test.error))} |`);
604
727
  } else {
605
- rows.push("| **Result** | \u26A0\uFE0F Inconclusive |");
728
+ rows.push("| **Result** | \u26A0\uFE0F Inconclusive |", "|:--|:--|");
606
729
  rows.push(`| **Why** | ${tableCell(escapeHtml(test.reason))} |`);
607
730
  }
608
731
  if (entry.attempts > 1) {
@@ -612,8 +735,12 @@ function renderResultTable(entry, projectId, dashboardBaseUrl) {
612
735
  rows.push(`| **Run** | ${count} browser ${count === 1 ? "step" : "steps"} \xB7 ${dashboardLink(test, projectId, dashboardBaseUrl)} |`);
613
736
  return rows;
614
737
  }
615
- function renderDetailBlocks(report, dashboardBaseUrl) {
616
- return resolveLatestRuns(report.tests).map((entry, i) => renderTestDetails(entry, report.projectId, i + 1, dashboardBaseUrl ?? DASHBOARD_URL_BASE)).join("\n\n");
738
+ function renderDetailBlocks(report, dashboardBaseUrl, screenshotDetail = "before-and-after" /* BeforeAndAfter */) {
739
+ return resolveLatestRuns(report.tests).map((entry, i) => renderTestDetails(entry, report.projectId, i + 1, dashboardBaseUrl ?? DASHBOARD_URL_BASE, screenshotDetail)).join(`
740
+
741
+ ${TEST_DETAILS_DIVIDER}
742
+
743
+ `);
617
744
  }
618
745
  function renderBody(report, opts) {
619
746
  const overview = renderOverview(report);
@@ -643,14 +770,16 @@ function renderComment(report, opts = {}) {
643
770
  if (report.tests.length === 0) {
644
771
  return "";
645
772
  }
773
+ const screenshotDetail = opts.screenshotDetail ?? "before-and-after" /* BeforeAndAfter */;
646
774
  return [
647
775
  "## E2E acceptance evidence (overflow)",
648
776
  "",
649
777
  "_This comment was posted because the full per-test details did not fit in the PR description._",
778
+ ...screenshotDetail === "before-and-after" /* BeforeAndAfter */ ? [] : ["", "_Step screenshots are trimmed to fit GitHub's comment size limit \u2014 open a run on Muggle AI for all of them._"],
650
779
  "",
651
780
  "### Test details",
652
781
  "",
653
- renderDetailBlocks(report, opts.dashboardBaseUrl)
782
+ renderDetailBlocks(report, opts.dashboardBaseUrl, screenshotDetail)
654
783
  ].join("\n");
655
784
  }
656
785
 
@@ -665,85 +794,32 @@ function splitWithOverflow(report, opts) {
665
794
  return { body: inlineBody, comment: null };
666
795
  }
667
796
  const spilledBody = renderBody(report, { inlineDetails: false, dashboardBaseUrl: opts.dashboardBaseUrl });
668
- const comment = renderComment(report, { dashboardBaseUrl: opts.dashboardBaseUrl });
797
+ const comment = renderFittingComment(report, opts.dashboardBaseUrl);
669
798
  return {
670
799
  body: spilledBody,
671
800
  comment: comment.length > 0 ? comment : null
672
801
  };
673
802
  }
674
- var StepSchema = z.object({
675
- stepIndex: z.number().int().nonnegative(),
676
- action: z.string().min(1),
677
- description: z.string().min(1).optional(),
678
- screenshotUrl: z.string().url()
679
- });
680
- var PassedTestSchema = z.object({
681
- name: z.string().min(1),
682
- testCaseId: z.string().min(1),
683
- testScriptId: z.string().min(1).optional(),
684
- runId: z.string().min(1),
685
- viewUrl: z.string().url(),
686
- status: z.literal("passed"),
687
- steps: z.array(StepSchema),
688
- useCaseName: z.string().min(1).optional(),
689
- description: z.string().min(1).optional(),
690
- endingScreenshotUrl: z.string().url().optional(),
691
- endingScreenshotCaption: z.string().min(1).optional()
692
- });
693
- var FailedTestSchema = z.object({
694
- name: z.string().min(1),
695
- testCaseId: z.string().min(1),
696
- testScriptId: z.string().min(1).optional(),
697
- runId: z.string().min(1),
698
- viewUrl: z.string().url(),
699
- status: z.literal("failed"),
700
- steps: z.array(StepSchema),
701
- failureStepIndex: z.number().int().nonnegative(),
702
- error: z.string().min(1),
703
- artifactsDir: z.string().min(1).optional(),
704
- useCaseName: z.string().min(1).optional(),
705
- description: z.string().min(1).optional(),
706
- endingScreenshotUrl: z.string().url().optional(),
707
- endingScreenshotCaption: z.string().min(1).optional()
708
- });
709
- var InconclusiveTestSchema = z.object({
710
- name: z.string().min(1),
711
- testCaseId: z.string().min(1),
712
- testScriptId: z.string().min(1).optional(),
713
- runId: z.string().min(1),
714
- viewUrl: z.string().url(),
715
- status: z.literal("inconclusive"),
716
- steps: z.array(StepSchema),
717
- reason: z.string().min(1),
718
- artifactsDir: z.string().min(1).optional(),
719
- useCaseName: z.string().min(1).optional(),
720
- description: z.string().min(1).optional(),
721
- endingScreenshotUrl: z.string().url().optional(),
722
- endingScreenshotCaption: z.string().min(1).optional()
723
- });
724
- var TestResultSchema = z.discriminatedUnion("status", [
725
- PassedTestSchema,
726
- FailedTestSchema,
727
- InconclusiveTestSchema
728
- ]);
729
- var E2eReportSchema = z.object({
730
- projectId: z.string().min(1),
731
- tests: z.array(TestResultSchema)
732
- });
803
+ function renderFittingComment(report, dashboardBaseUrl) {
804
+ const ladder = [
805
+ "before-and-after" /* BeforeAndAfter */,
806
+ "before-only" /* BeforeOnly */,
807
+ "none" /* None */
808
+ ];
809
+ let comment = "";
810
+ for (const screenshotDetail of ladder) {
811
+ comment = renderComment(report, { dashboardBaseUrl, screenshotDetail });
812
+ if (Buffer.byteLength(comment, "utf-8") <= MAX_COMMENT_BYTES) {
813
+ return comment;
814
+ }
815
+ }
816
+ return comment;
817
+ }
733
818
 
734
819
  // src/cli/pr-section/index.ts
735
820
  function buildPrSection(report, opts) {
736
821
  return splitWithOverflow(report, opts);
737
822
  }
738
-
739
- // src/cli/pr-section/resolve-urls-types.ts
740
- var GS_SCHEME = "gs://";
741
- var PUBLIC_URL_PATH = "/v1/protected/storage/publicUrl";
742
- var RESOLVE_TIMEOUT_MS = 1e4;
743
- var LOG_PREFIX = "build-pr-section";
744
- var IMAGE_PROXY_PREFIX = "https://images.weserv.nl/?url=";
745
-
746
- // src/cli/pr-section/resolve-urls.ts
747
823
  function errMsg(e) {
748
824
  return e instanceof Error ? e.message : String(e);
749
825
  }
@@ -773,6 +849,9 @@ function collectGsUrls(report) {
773
849
  if (isGsUrl(step.screenshotUrl)) {
774
850
  seen.add(step.screenshotUrl);
775
851
  }
852
+ if (step.afterScreenshotUrl && isGsUrl(step.afterScreenshotUrl)) {
853
+ seen.add(step.afterScreenshotUrl);
854
+ }
776
855
  }
777
856
  if (test.endingScreenshotUrl && isGsUrl(test.endingScreenshotUrl)) {
778
857
  seen.add(test.endingScreenshotUrl);
@@ -805,11 +884,16 @@ async function resolveOne(gsUrl, baseUrl, headers, stderrWrite) {
805
884
  }
806
885
  }
807
886
  function remapStep(step, urlMap) {
808
- const resolved = urlMap.get(step.screenshotUrl);
809
- if (!resolved) {
887
+ const resolvedBefore = urlMap.get(step.screenshotUrl);
888
+ const resolvedAfter = step.afterScreenshotUrl ? urlMap.get(step.afterScreenshotUrl) : void 0;
889
+ if (!resolvedBefore && !resolvedAfter) {
810
890
  return step;
811
891
  }
812
- return { ...step, screenshotUrl: resolved };
892
+ return {
893
+ ...step,
894
+ ...resolvedBefore ? { screenshotUrl: resolvedBefore } : {},
895
+ ...resolvedAfter ? { afterScreenshotUrl: resolvedAfter } : {}
896
+ };
813
897
  }
814
898
  function remapTest(test, urlMap) {
815
899
  const remapped = {
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-6ROSBSNR.js';
2
+ import { runCli } from './chunk-DLBPRPUN.js';
3
3
  import './chunk-E3T2RN6R.js';
4
4
 
5
5
  // src/cli/main.ts
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-6ROSBSNR.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-DLBPRPUN.js';
2
2
  export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-E3T2RN6R.js';
@@ -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.155",
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.155",
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.155",
5
+ "version": "5.22.0-staging.157",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -6,4 +6,4 @@ The studio publishes every completed run — pass or fail — to the cloud durin
6
6
 
7
7
  ## Screenshots
8
8
 
9
- Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. When `cloudTestScriptId` is absent — every failed generation, per above — call `muggle-remote-action-script-get` with `cloudActionScriptId` instead; it returns the same `steps[]` shape, so a non-passing run keeps its per-step screenshots rather than collapsing to a single ending frame. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
9
+ Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl, afterScreenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. `afterScreenshotUrl` is the page after the step acted: the next step's `operation.screenshotUrl` among steps that have one, and for the last such step the `summaryStep.operation.screenshotUrl` (rule and skipped operations in [`../../muggle-pr-visual-walkthrough/e2e-report-assembly.md`](../../muggle-pr-visual-walkthrough/e2e-report-assembly.md)). When `cloudTestScriptId` is absent — every failed generation, per above — call `muggle-remote-action-script-get` with `cloudActionScriptId` instead; it returns the same `steps[]` shape, so a non-passing run keeps its per-step screenshots rather than collapsing to a single ending frame. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
@@ -24,6 +24,7 @@ Fetch step screenshots in parallel — pick the right tool per run result:
24
24
  For each result:
25
25
 
26
26
  1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, description: steps[i].briefExplanation, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. `action` is only the operation verb (`navigate`, `click`); `description` is the agent's readable account of the step and is what the walkthrough shows — omit it only when the step has no `briefExplanation`. A non-passing run carries its steps too: fetch them with the fallback above rather than sending `[]`, which collapses its walkthrough entry to a single ending frame. Send `[]` only when the run genuinely produced no steps; those still render the failure summary header.
27
+ Add each step's `afterScreenshotUrl` — the page after the step acted, which the action script does not store. It is the `operation.screenshotUrl` of the next step that has one, skipping steps without a screenshot (`noOp`, `proceed`, `proposeStep`, `curl`, `secretSave`, `generateManagedProfile`), and for the last such step the `summaryStep.operation.screenshotUrl`. Omit it when neither exists; the walkthrough then shows the before screenshot alone. This is the same pairing the Muggle AI dashboard shows.
27
28
  2. `viewUrl` — from the run result (deep-links to the specific run).
28
29
  3. `status` — from `muggle-local-run-result-get`.
29
30
  4. If failed: also capture `failureStepIndex`, `error`, `artifactsDir` from the run result.
@@ -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-155-1",
4
- "commitSha": "ba63ca4b26455ee3ab8cf79d2293777f8192dda0",
5
- "buildTime": "2026-10-21T04:17:25Z",
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.155",
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.155",
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.155",
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.155",
5
+ "version": "5.22.0-staging.157",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -6,4 +6,4 @@ The studio publishes every completed run — pass or fail — to the cloud durin
6
6
 
7
7
  ## Screenshots
8
8
 
9
- Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. When `cloudTestScriptId` is absent — every failed generation, per above — call `muggle-remote-action-script-get` with `cloudActionScriptId` instead; it returns the same `steps[]` shape, so a non-passing run keeps its per-step screenshots rather than collapsing to a single ending frame. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
9
+ Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl, afterScreenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. `afterScreenshotUrl` is the page after the step acted: the next step's `operation.screenshotUrl` among steps that have one, and for the last such step the `summaryStep.operation.screenshotUrl` (rule and skipped operations in [`../../muggle-pr-visual-walkthrough/e2e-report-assembly.md`](../../muggle-pr-visual-walkthrough/e2e-report-assembly.md)). When `cloudTestScriptId` is absent — every failed generation, per above — call `muggle-remote-action-script-get` with `cloudActionScriptId` instead; it returns the same `steps[]` shape, so a non-passing run keeps its per-step screenshots rather than collapsing to a single ending frame. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
@@ -24,6 +24,7 @@ Fetch step screenshots in parallel — pick the right tool per run result:
24
24
  For each result:
25
25
 
26
26
  1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, description: steps[i].briefExplanation, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. `action` is only the operation verb (`navigate`, `click`); `description` is the agent's readable account of the step and is what the walkthrough shows — omit it only when the step has no `briefExplanation`. A non-passing run carries its steps too: fetch them with the fallback above rather than sending `[]`, which collapses its walkthrough entry to a single ending frame. Send `[]` only when the run genuinely produced no steps; those still render the failure summary header.
27
+ Add each step's `afterScreenshotUrl` — the page after the step acted, which the action script does not store. It is the `operation.screenshotUrl` of the next step that has one, skipping steps without a screenshot (`noOp`, `proceed`, `proposeStep`, `curl`, `secretSave`, `generateManagedProfile`), and for the last such step the `summaryStep.operation.screenshotUrl`. Omit it when neither exists; the walkthrough then shows the before screenshot alone. This is the same pairing the Muggle AI dashboard shows.
27
28
  2. `viewUrl` — from the run result (deep-links to the specific run).
28
29
  3. `status` — from `muggle-local-run-result-get`.
29
30
  4. If failed: also capture `failureStepIndex`, `error`, `artifactsDir` from the run result.
@@ -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)