@muggleai/works 5.22.0-staging.158 → 5.22.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/.claude-plugin/marketplace.json +1 -1
- package/README.md +3 -1
- package/dist/{chunk-E3T2RN6R.js → chunk-M2PJRVCC.js} +16 -0
- package/dist/{chunk-X75TJAYX.js → chunk-SF75W2SV.js} +209 -46
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/config/preference-defaults.json +1 -0
- package/dist/plugin/skills/_shared/ci-check-to-command.md +2 -1
- package/dist/plugin/skills/_shared/vcs/github/pr-checks.md +9 -0
- package/dist/plugin/skills/do/fix-ci.md +14 -4
- package/dist/plugin/skills/do/open-prs/forward.md +2 -0
- package/dist/plugin/skills/do/pre-flight.md +2 -0
- package/dist/plugin/skills/muggle-do/SKILL.md +1 -0
- package/dist/plugin/skills/muggle-preferences/ops/configure.md +1 -0
- package/dist/plugin/skills/muggle-preferences/preference-gates/autoInstallCiWorkflow.md +13 -0
- package/dist/release-manifest.json +3 -3
- package/dist/{src-V245RV7L.js → src-5QO7XTIG.js} +1 -1
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/config/preference-defaults.json +1 -0
- package/plugin/skills/_shared/ci-check-to-command.md +2 -1
- package/plugin/skills/_shared/vcs/github/pr-checks.md +9 -0
- package/plugin/skills/do/fix-ci.md +14 -4
- package/plugin/skills/do/open-prs/forward.md +2 -0
- package/plugin/skills/do/pre-flight.md +2 -0
- package/plugin/skills/muggle-do/SKILL.md +1 -0
- package/plugin/skills/muggle-preferences/ops/configure.md +1 -0
- package/plugin/skills/muggle-preferences/preference-gates/autoInstallCiWorkflow.md +13 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"name": "muggleai",
|
|
10
10
|
"source": "./plugin",
|
|
11
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
|
|
12
|
+
"version": "5.22.0"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
}
|
package/README.md
CHANGED
|
@@ -167,7 +167,9 @@ Nested GitLab namespaces of any depth are handled — the project path is everyt
|
|
|
167
167
|
|
|
168
168
|
When a PR is opened from a session running this plugin, Muggle reserves a comment for the acceptance walkthrough and holds the turn open until it's settled — by the walkthrough, or by a stated reason acceptance testing doesn't apply.
|
|
169
169
|
|
|
170
|
-
A PR opened any other way — the web UI, a teammate without the plugin — never passes through that session, so the same check also runs in GitHub Actions.
|
|
170
|
+
A PR opened any other way — the web UI, a teammate without the plugin — never passes through that session, so the same check also runs in GitHub Actions. It fails while the comment is still empty, and whenever the walkthrough reports a failed or inconclusive test case; the check's summary names each one with its failing step and a link to the run. When the Muggle PR watcher sees it red, it repairs the cases, re-runs the whole suite, and re-settles the comment.
|
|
171
|
+
|
|
172
|
+
The `autoInstallCiWorkflow` preference, chosen during `muggle init`, decides whether Muggle adds the workflow itself: `always` installs it in the repository `muggle init` runs in and in any repository `/muggle-do` opens a PR from, `ask` (the default) asks first, `never` leaves CI alone. To add it to a repository by hand:
|
|
171
173
|
|
|
172
174
|
```bash
|
|
173
175
|
muggle ci-install
|
|
@@ -2446,6 +2446,7 @@ var PreferenceKey = /* @__PURE__ */ ((PreferenceKey2) => {
|
|
|
2446
2446
|
PreferenceKey2["AutoReuseValidationContext"] = "autoReuseValidationContext";
|
|
2447
2447
|
PreferenceKey2["AutoRouteBuildToMuggleDo"] = "autoRouteBuildToMuggleDo";
|
|
2448
2448
|
PreferenceKey2["AutoWatchPR"] = "autoWatchPR";
|
|
2449
|
+
PreferenceKey2["AutoInstallCiWorkflow"] = "autoInstallCiWorkflow";
|
|
2449
2450
|
PreferenceKey2["WatcherLifetime"] = "watcherLifetime";
|
|
2450
2451
|
PreferenceKey2["MaxCatchUpRebases"] = "maxCatchUpRebases";
|
|
2451
2452
|
PreferenceKey2["ReusePreparePlan"] = "reusePreparePlan";
|
|
@@ -2491,6 +2492,7 @@ var DEFAULT_PREFERENCES = {
|
|
|
2491
2492
|
["autoReuseValidationContext" /* AutoReuseValidationContext */]: "always" /* Always */,
|
|
2492
2493
|
["autoRouteBuildToMuggleDo" /* AutoRouteBuildToMuggleDo */]: "always" /* Always */,
|
|
2493
2494
|
["autoWatchPR" /* AutoWatchPR */]: "always" /* Always */,
|
|
2495
|
+
["autoInstallCiWorkflow" /* AutoInstallCiWorkflow */]: "ask" /* Ask */,
|
|
2494
2496
|
["reusePreparePlan" /* ReusePreparePlan */]: "always" /* Always */,
|
|
2495
2497
|
["watcherLifetime" /* WatcherLifetime */]: "7d" /* SevenDays */,
|
|
2496
2498
|
["maxCatchUpRebases" /* MaxCatchUpRebases */]: "20" /* TwentyRebases */
|
|
@@ -2542,6 +2544,7 @@ var PREFERENCE_ALLOWED_VALUES = {
|
|
|
2542
2544
|
["autoReuseValidationContext" /* AutoReuseValidationContext */]: ALWAYS_ASK_NEVER,
|
|
2543
2545
|
["autoRouteBuildToMuggleDo" /* AutoRouteBuildToMuggleDo */]: ALWAYS_ASK_NEVER,
|
|
2544
2546
|
["autoWatchPR" /* AutoWatchPR */]: ALWAYS_ASK_NEVER,
|
|
2547
|
+
["autoInstallCiWorkflow" /* AutoInstallCiWorkflow */]: ALWAYS_ASK_NEVER,
|
|
2545
2548
|
["reusePreparePlan" /* ReusePreparePlan */]: ALWAYS_ASK_NEVER,
|
|
2546
2549
|
["watcherLifetime" /* WatcherLifetime */]: WATCHER_LIFETIMES,
|
|
2547
2550
|
["maxCatchUpRebases" /* MaxCatchUpRebases */]: CATCH_UP_REBASE_BUDGETS
|
|
@@ -2610,6 +2613,9 @@ var PREFERENCES_SCHEMA = {
|
|
|
2610
2613
|
["autoWatchPR" /* AutoWatchPR */]: {
|
|
2611
2614
|
description: "After a test run opens a PR, start a muggle-pr-followup watcher that polls for new reviews and hands them to /muggle-do"
|
|
2612
2615
|
},
|
|
2616
|
+
["autoInstallCiWorkflow" /* AutoInstallCiWorkflow */]: {
|
|
2617
|
+
description: "When muggle init runs in a repository, or /muggle-do opens a PR in one, that lacks .github/workflows/muggle-walkthrough.yml, add it \u2014 the CI check that fails a PR whose E2E walkthrough is missing or reports a failed or inconclusive test case"
|
|
2618
|
+
},
|
|
2613
2619
|
["reusePreparePlan" /* ReusePreparePlan */]: {
|
|
2614
2620
|
description: "Reuse the saved prepare plan for this stack (skip discovery, jump to check-running + smoke-test) instead of rediscovering from scratch"
|
|
2615
2621
|
},
|
|
@@ -8530,6 +8536,16 @@ var ONBOARDING_CHOICE_GROUPS = [
|
|
|
8530
8536
|
{ value: "ask" /* Ask */, label: "Ask each time" }
|
|
8531
8537
|
]
|
|
8532
8538
|
},
|
|
8539
|
+
{
|
|
8540
|
+
header: "CI check",
|
|
8541
|
+
key: "autoInstallCiWorkflow" /* AutoInstallCiWorkflow */,
|
|
8542
|
+
prompt: "Add the Muggle E2E check to a repository's CI? It fails a pull request whose walkthrough is missing or reports a failed test.",
|
|
8543
|
+
optionLabels: [
|
|
8544
|
+
{ value: "always" /* Always */, label: "Always \u2014 add it to every repo Muggle works in" },
|
|
8545
|
+
{ value: "ask" /* Ask */, label: "Ask in each repo" },
|
|
8546
|
+
{ value: "never" /* Never */, label: "Never \u2014 I'll run muggle ci-install myself" }
|
|
8547
|
+
]
|
|
8548
|
+
},
|
|
8533
8549
|
{
|
|
8534
8550
|
header: "PR watcher",
|
|
8535
8551
|
key: "watcherLifetime" /* WatcherLifetime */,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, toolRequiresAuth, getCallerCredentials, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, OnboardingBlanketChoice, PreferenceKey } from './chunk-
|
|
1
|
+
import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, toolRequiresAuth, getCallerCredentials, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, OnboardingBlanketChoice, PreferenceKey, resolvePreferences } from './chunk-M2PJRVCC.js';
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
import { v4 } from 'uuid';
|
|
@@ -370,6 +370,111 @@ var STEP_THUMBNAIL_QUALITY = 70;
|
|
|
370
370
|
var STEP_PAIR_IMAGE_WIDTH = 420;
|
|
371
371
|
var MAX_COMMENT_BYTES = 64e3;
|
|
372
372
|
|
|
373
|
+
// src/e2e-result/types.ts
|
|
374
|
+
var UnpassedCaseStatus = /* @__PURE__ */ ((UnpassedCaseStatus2) => {
|
|
375
|
+
UnpassedCaseStatus2["Failed"] = "failed";
|
|
376
|
+
UnpassedCaseStatus2["Inconclusive"] = "inconclusive";
|
|
377
|
+
return UnpassedCaseStatus2;
|
|
378
|
+
})(UnpassedCaseStatus || {});
|
|
379
|
+
|
|
380
|
+
// src/e2e-result/constants.ts
|
|
381
|
+
var E2E_RESULT_MARKER_PREFIX = "<!-- muggle-e2e-result:v1 ";
|
|
382
|
+
var E2E_RESULT_MARKER_SUFFIX = " -->";
|
|
383
|
+
var UNPASSED_DETAIL_MAX_CHARS = 300;
|
|
384
|
+
var UNPASSED_STATUS_EMOJI = {
|
|
385
|
+
["failed" /* Failed */]: "\u274C",
|
|
386
|
+
["inconclusive" /* Inconclusive */]: "\u26A0\uFE0F"
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// src/e2e-result/format.ts
|
|
390
|
+
function escapeHtml(s) {
|
|
391
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
392
|
+
}
|
|
393
|
+
function describeUnpassedCase(unpassed) {
|
|
394
|
+
const outcome = unpassed.status === "failed" /* Failed */ && unpassed.failedStep !== void 0 ? `failed at step ${unpassed.failedStep}` : unpassed.status;
|
|
395
|
+
return `${outcome}: ${escapeHtml(unpassed.detail)}`;
|
|
396
|
+
}
|
|
397
|
+
function renderUnpassedCaseBullet(unpassed, linkText, linkTarget) {
|
|
398
|
+
return `- ${UNPASSED_STATUS_EMOJI[unpassed.status]} **${escapeHtml(unpassed.name)}** \u2014 ${describeUnpassedCase(unpassed)} \xB7 [${linkText}](${linkTarget})`;
|
|
399
|
+
}
|
|
400
|
+
var UnpassedCaseSchema = z.object({
|
|
401
|
+
name: z.string(),
|
|
402
|
+
testCaseId: z.string(),
|
|
403
|
+
status: z.enum(UnpassedCaseStatus),
|
|
404
|
+
failedStep: z.number().int().positive().optional(),
|
|
405
|
+
detail: z.string(),
|
|
406
|
+
viewUrl: z.string()
|
|
407
|
+
});
|
|
408
|
+
var E2eResultRecordSchema = z.object({
|
|
409
|
+
total: z.number().int().nonnegative(),
|
|
410
|
+
passed: z.number().int().nonnegative(),
|
|
411
|
+
unpassed: z.array(UnpassedCaseSchema)
|
|
412
|
+
});
|
|
413
|
+
function renderE2eResultMarker(record) {
|
|
414
|
+
const json = JSON.stringify(record).replace(/</g, "\\u003c").replace(/>/g, "\\u003e");
|
|
415
|
+
return `${E2E_RESULT_MARKER_PREFIX}${json}${E2E_RESULT_MARKER_SUFFIX}`;
|
|
416
|
+
}
|
|
417
|
+
function parseE2eResultMarker(body) {
|
|
418
|
+
const start = body.indexOf(E2E_RESULT_MARKER_PREFIX);
|
|
419
|
+
if (start === -1) return null;
|
|
420
|
+
const jsonStart = start + E2E_RESULT_MARKER_PREFIX.length;
|
|
421
|
+
const end = body.indexOf(E2E_RESULT_MARKER_SUFFIX, jsonStart);
|
|
422
|
+
if (end === -1) return null;
|
|
423
|
+
try {
|
|
424
|
+
const parsed = E2eResultRecordSchema.safeParse(JSON.parse(body.slice(jsonStart, end)));
|
|
425
|
+
return parsed.success ? parsed.data : null;
|
|
426
|
+
} catch {
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function latestE2eResult(bodies) {
|
|
431
|
+
for (let i = bodies.length - 1; i >= 0; i--) {
|
|
432
|
+
const record = parseE2eResultMarker(bodies[i]);
|
|
433
|
+
if (record) return record;
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// src/cli/pr-section/result-record.ts
|
|
439
|
+
function failureOrdinal(test, failureStepIndex) {
|
|
440
|
+
const position = test.steps.findIndex((s) => s.stepIndex === failureStepIndex);
|
|
441
|
+
return position === -1 ? failureStepIndex : position + 1;
|
|
442
|
+
}
|
|
443
|
+
function oneLineDetail(text) {
|
|
444
|
+
const flat = text.replace(/\s+/g, " ").trim();
|
|
445
|
+
return flat.length > UNPASSED_DETAIL_MAX_CHARS ? `${flat.slice(0, UNPASSED_DETAIL_MAX_CHARS - 1)}\u2026` : flat;
|
|
446
|
+
}
|
|
447
|
+
function toUnpassedCase(test) {
|
|
448
|
+
if (test.status === "failed") {
|
|
449
|
+
return {
|
|
450
|
+
name: test.name,
|
|
451
|
+
testCaseId: test.testCaseId,
|
|
452
|
+
status: "failed" /* Failed */,
|
|
453
|
+
failedStep: failureOrdinal(test, test.failureStepIndex),
|
|
454
|
+
detail: oneLineDetail(test.error),
|
|
455
|
+
viewUrl: test.viewUrl
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
if (test.status === "inconclusive") {
|
|
459
|
+
return {
|
|
460
|
+
name: test.name,
|
|
461
|
+
testCaseId: test.testCaseId,
|
|
462
|
+
status: "inconclusive" /* Inconclusive */,
|
|
463
|
+
detail: oneLineDetail(test.reason),
|
|
464
|
+
viewUrl: test.viewUrl
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
function buildE2eResultRecord(latestTests) {
|
|
470
|
+
const unpassed = latestTests.map(toUnpassedCase).filter((entry) => entry !== null);
|
|
471
|
+
return {
|
|
472
|
+
total: latestTests.length,
|
|
473
|
+
passed: latestTests.filter((test) => test.status === "passed").length,
|
|
474
|
+
unpassed
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
373
478
|
// src/cli/pr-section/resolve-urls-types.ts
|
|
374
479
|
var GS_SCHEME = "gs://";
|
|
375
480
|
var PUBLIC_URL_PATH = "/v1/protected/storage/publicUrl";
|
|
@@ -505,10 +610,6 @@ function endingScreenshot(test) {
|
|
|
505
610
|
}
|
|
506
611
|
return test.steps[test.steps.length - 1];
|
|
507
612
|
}
|
|
508
|
-
function failureOrdinal(test, failureStepIndex) {
|
|
509
|
-
const position = test.steps.findIndex((s) => s.stepIndex === failureStepIndex);
|
|
510
|
-
return position === -1 ? failureStepIndex : position + 1;
|
|
511
|
-
}
|
|
512
613
|
function defaultEndingCaption(test) {
|
|
513
614
|
if (test.status === "failed") {
|
|
514
615
|
return `Failure at step ${failureOrdinal(test, test.failureStepIndex)}`;
|
|
@@ -537,9 +638,6 @@ function endingFrame(test) {
|
|
|
537
638
|
function fullSizeImage(url, alt) {
|
|
538
639
|
return `<a href="${url}"><img src="${url}" width="${DETAIL_IMAGE_WIDTH}" alt="${escapeHtml(alt).replace(/"/g, """)}"></a>`;
|
|
539
640
|
}
|
|
540
|
-
function escapeHtml(s) {
|
|
541
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
542
|
-
}
|
|
543
641
|
function tableCell(s) {
|
|
544
642
|
return s.replace(/\s*\n\s*/g, " ").replace(/\|/g, "\\|");
|
|
545
643
|
}
|
|
@@ -564,8 +662,9 @@ function renderOverview(report) {
|
|
|
564
662
|
lines.push("", "_No tests were executed._");
|
|
565
663
|
return lines.join("\n");
|
|
566
664
|
}
|
|
567
|
-
lines.push("");
|
|
568
665
|
const numbering = buildTestNumbering(latestRuns);
|
|
666
|
+
lines.push(...renderNeedsAttention(buildE2eResultRecord(latestRuns.map((entry) => entry.test))));
|
|
667
|
+
lines.push("");
|
|
569
668
|
const anyGrouped = latestRuns.some((entry) => Boolean(entry.test.useCaseName));
|
|
570
669
|
if (!anyGrouped) {
|
|
571
670
|
for (const entry of latestRuns) {
|
|
@@ -582,6 +681,15 @@ function renderOverview(report) {
|
|
|
582
681
|
}
|
|
583
682
|
return lines.join("\n");
|
|
584
683
|
}
|
|
684
|
+
function renderNeedsAttention(record) {
|
|
685
|
+
if (record.unpassed.length === 0) return [];
|
|
686
|
+
return [
|
|
687
|
+
"",
|
|
688
|
+
"**Needs attention**",
|
|
689
|
+
"",
|
|
690
|
+
...record.unpassed.map((unpassed) => renderUnpassedCaseBullet(unpassed, "see details", `#${testAnchor(unpassed.testCaseId)}`))
|
|
691
|
+
];
|
|
692
|
+
}
|
|
585
693
|
function renderUseCaseGroup(useCaseName, members, numbering) {
|
|
586
694
|
const groupCounts = countTests(members);
|
|
587
695
|
const isAllPassed = groupCounts.passed === groupCounts.total;
|
|
@@ -606,7 +714,7 @@ function buildTestNumbering(latestRuns) {
|
|
|
606
714
|
}
|
|
607
715
|
function renderOverviewBullet(entry, numbering, indent) {
|
|
608
716
|
const rerunNote = entry.attempts > 1 ? ` _(${entry.attempts} runs)_` : "";
|
|
609
|
-
const detailsLink = ` \xB7 [see details](#${testAnchor(entry.test)})`;
|
|
717
|
+
const detailsLink = ` \xB7 [see details](#${testAnchor(entry.test.testCaseId)})`;
|
|
610
718
|
return `${indent}- ${statusEmoji(entry.test)} **${numbering.get(entry.test.testCaseId)}.** ${entry.test.name}${rerunNote}${detailsLink}`;
|
|
611
719
|
}
|
|
612
720
|
function buildGroupedLayout(latestRuns) {
|
|
@@ -631,7 +739,7 @@ function buildGroupedLayout(latestRuns) {
|
|
|
631
739
|
}
|
|
632
740
|
function renderTestDetails(entry, projectId, testNumber, dashboardBaseUrl = DASHBOARD_URL_BASE, screenshotDetail = "before-and-after" /* BeforeAndAfter */) {
|
|
633
741
|
const { test } = entry;
|
|
634
|
-
const lines = [`<a name="${testAnchor(test)}"></a>`, "", `#### ${statusEmoji(test)} ${testNumber}. ${test.name}`, ""];
|
|
742
|
+
const lines = [`<a name="${testAnchor(test.testCaseId)}"></a>`, "", `#### ${statusEmoji(test)} ${testNumber}. ${test.name}`, ""];
|
|
635
743
|
if (test.description && !isSameText(test.description, test.name)) {
|
|
636
744
|
lines.push(`_${test.description.replace(/\s*\n\s*/g, " ")}_`, "");
|
|
637
745
|
}
|
|
@@ -647,8 +755,8 @@ function renderTestDetails(entry, projectId, testNumber, dashboardBaseUrl = DASH
|
|
|
647
755
|
function indented(content) {
|
|
648
756
|
return ["<dl><dd>", "", ...content, "", "</dd></dl>"];
|
|
649
757
|
}
|
|
650
|
-
function testAnchor(
|
|
651
|
-
return `${TEST_DETAILS_ANCHOR_PREFIX}${
|
|
758
|
+
function testAnchor(testCaseId) {
|
|
759
|
+
return `${TEST_DETAILS_ANCHOR_PREFIX}${testCaseId}`;
|
|
652
760
|
}
|
|
653
761
|
function evidenceToggleLabel(test, screenshotDetail) {
|
|
654
762
|
const count = test.steps.length;
|
|
@@ -743,7 +851,11 @@ ${TEST_DETAILS_DIVIDER}
|
|
|
743
851
|
`);
|
|
744
852
|
}
|
|
745
853
|
function renderBody(report, opts) {
|
|
746
|
-
const
|
|
854
|
+
const resultMarker = renderE2eResultMarker(
|
|
855
|
+
buildE2eResultRecord(resolveLatestRuns(report.tests).map((entry) => entry.test))
|
|
856
|
+
);
|
|
857
|
+
const overview = `${resultMarker}
|
|
858
|
+
${renderOverview(report)}`;
|
|
747
859
|
if (report.tests.length === 0) {
|
|
748
860
|
return overview;
|
|
749
861
|
}
|
|
@@ -915,7 +1027,7 @@ async function resolveGsScreenshotUrls(report, opts) {
|
|
|
915
1027
|
if (gsUrls.length === 0) {
|
|
916
1028
|
return report;
|
|
917
1029
|
}
|
|
918
|
-
const mcps = await import('./src-
|
|
1030
|
+
const mcps = await import('./src-5QO7XTIG.js');
|
|
919
1031
|
const credentials = await mcps.getCallerCredentialsAsync();
|
|
920
1032
|
if (!credentials.bearerToken && !credentials.apiKey) {
|
|
921
1033
|
stderrWrite(
|
|
@@ -968,7 +1080,7 @@ var withSentinel = (s) => s ? `${REPORT_SECTION_SENTINEL}
|
|
|
968
1080
|
${s}` : s;
|
|
969
1081
|
async function resolveDashboardBaseUrl(stderrWrite) {
|
|
970
1082
|
try {
|
|
971
|
-
const mcps = await import('./src-
|
|
1083
|
+
const mcps = await import('./src-5QO7XTIG.js');
|
|
972
1084
|
return mcps.resolveActiveProfile().dashboardBaseUrl;
|
|
973
1085
|
} catch (err) {
|
|
974
1086
|
stderrWrite(
|
|
@@ -1064,7 +1176,9 @@ function renderUserWorkflow() {
|
|
|
1064
1176
|
return `name: muggle-walkthrough
|
|
1065
1177
|
|
|
1066
1178
|
# Every PR owes a settled Muggle AI walkthrough comment: the E2E acceptance
|
|
1067
|
-
# result, or a stated reason E2E does not apply. The
|
|
1179
|
+
# result, or a stated reason E2E does not apply. The check fails while that
|
|
1180
|
+
# comment is empty, and whenever the walkthrough reports a failed or
|
|
1181
|
+
# inconclusive test case \u2014 its summary names each one. The verdict rides a check run
|
|
1068
1182
|
# against the PR head SHA rather than this job's own status, because the
|
|
1069
1183
|
# issue_comment trigger runs against the default branch \u2014 only a head-SHA check
|
|
1070
1184
|
# reaches the PR from there, which is what lets settling the comment turn the
|
|
@@ -1958,12 +2072,16 @@ function getHelpGuidance() {
|
|
|
1958
2072
|
function helpCommand() {
|
|
1959
2073
|
console.log(getHelpGuidance());
|
|
1960
2074
|
}
|
|
1961
|
-
var QUESTION = "Make E2E acceptance a CI check in this repo? It adds a GitHub Actions workflow
|
|
1962
|
-
async function
|
|
2075
|
+
var QUESTION = "Make E2E acceptance a CI check in this repo? It adds a GitHub Actions workflow that fails a pull request\nwhose Muggle walkthrough is missing or reports a failed test. [y/N]: ";
|
|
2076
|
+
async function applyCiWorkflowPreference(preference, cwd, ask) {
|
|
1963
2077
|
if (!existsSync(join(cwd, ".git"))) return "not-applicable" /* NotApplicable */;
|
|
1964
2078
|
if (existsSync(join(cwd, USER_WORKFLOW_PATH))) return "already-installed" /* AlreadyInstalled */;
|
|
1965
|
-
|
|
1966
|
-
if (
|
|
2079
|
+
if (preference === "never" /* Never */) return "turned-off" /* TurnedOff */;
|
|
2080
|
+
if (preference !== "always" /* Always */) {
|
|
2081
|
+
if (!ask) return "deferred" /* Deferred */;
|
|
2082
|
+
const answer = (await ask(QUESTION)).trim().toLowerCase();
|
|
2083
|
+
if (answer !== "y" && answer !== "yes") return "declined" /* Declined */;
|
|
2084
|
+
}
|
|
1967
2085
|
installCiWorkflow({ cwd, force: false });
|
|
1968
2086
|
return "installed" /* Installed */;
|
|
1969
2087
|
}
|
|
@@ -2109,19 +2227,25 @@ function reportOutcome(result) {
|
|
|
2109
2227
|
console.log(summary);
|
|
2110
2228
|
}
|
|
2111
2229
|
var CI_OFFER_REPORT = {
|
|
2112
|
-
["installed" /* Installed */]: `Added ${USER_WORKFLOW_PATH} \u2014 commit it, and every pull request here will owe a
|
|
2230
|
+
["installed" /* Installed */]: `Added ${USER_WORKFLOW_PATH} \u2014 commit it, and every pull request here will owe a passing walkthrough comment.`,
|
|
2113
2231
|
["declined" /* Declined */]: "Left CI alone. Run `muggle ci-install` whenever you want it.",
|
|
2232
|
+
["deferred" /* Deferred */]: "This repo has no Muggle E2E check in CI yet \u2014 run `muggle ci-install` to add it.",
|
|
2233
|
+
["turned-off" /* TurnedOff */]: null,
|
|
2114
2234
|
["already-installed" /* AlreadyInstalled */]: null,
|
|
2115
2235
|
["not-applicable" /* NotApplicable */]: null
|
|
2116
2236
|
};
|
|
2117
|
-
async function runCiOffer() {
|
|
2237
|
+
async function runCiOffer(ask) {
|
|
2238
|
+
const preference = resolvePreferences()["autoInstallCiWorkflow" /* AutoInstallCiWorkflow */];
|
|
2239
|
+
const line = CI_OFFER_REPORT[await applyCiWorkflowPreference(preference, process.cwd(), ask)];
|
|
2240
|
+
if (line) {
|
|
2241
|
+
console.log("");
|
|
2242
|
+
console.log(line);
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
async function runInteractiveCiOffer() {
|
|
2118
2246
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
2119
2247
|
try {
|
|
2120
|
-
|
|
2121
|
-
if (line) {
|
|
2122
|
-
console.log("");
|
|
2123
|
-
console.log(line);
|
|
2124
|
-
}
|
|
2248
|
+
await runCiOffer((q) => rl.question(q));
|
|
2125
2249
|
} finally {
|
|
2126
2250
|
rl.close();
|
|
2127
2251
|
}
|
|
@@ -2137,7 +2261,9 @@ async function initCommand(options) {
|
|
|
2137
2261
|
} catch (error) {
|
|
2138
2262
|
console.error(error instanceof Error ? error.message : String(error));
|
|
2139
2263
|
process.exitCode = 1;
|
|
2264
|
+
return;
|
|
2140
2265
|
}
|
|
2266
|
+
await runCiOffer(null);
|
|
2141
2267
|
return;
|
|
2142
2268
|
}
|
|
2143
2269
|
if (!process.stdin.isTTY) {
|
|
@@ -2151,7 +2277,7 @@ async function initCommand(options) {
|
|
|
2151
2277
|
console.log("Muggle is already set up. Re-running the walkthrough \u2014 your current values are pre-selected.");
|
|
2152
2278
|
}
|
|
2153
2279
|
reportOutcome(applyOnboardingAnswers(await runTerminalWalkthrough()));
|
|
2154
|
-
await
|
|
2280
|
+
await runInteractiveCiOffer();
|
|
2155
2281
|
}
|
|
2156
2282
|
|
|
2157
2283
|
// src/cli/login.ts
|
|
@@ -2335,25 +2461,61 @@ function reserveComment(pr, comments, run) {
|
|
|
2335
2461
|
return postPrComment(pr, renderReservedComment(), run);
|
|
2336
2462
|
}
|
|
2337
2463
|
|
|
2338
|
-
// src/cli/pr-walkthrough/
|
|
2464
|
+
// src/cli/pr-walkthrough/constants.ts
|
|
2339
2465
|
var CHECK_RUN_NAME = "muggle-walkthrough";
|
|
2340
|
-
var
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
["
|
|
2466
|
+
var CHECK_RUN_TITLE = "Muggle AI PR visual walkthrough";
|
|
2467
|
+
var CHECK_SUMMARY_MAX_CASES = 50;
|
|
2468
|
+
var OUTCOME_CONCLUSIONS = {
|
|
2469
|
+
["settled" /* Settled */]: "success" /* Success */,
|
|
2470
|
+
["e2e-not-passing" /* E2eNotPassing */]: "failure" /* Failure */,
|
|
2471
|
+
["unsettled" /* Unsettled */]: "failure" /* Failure */,
|
|
2472
|
+
["unreadable" /* Unreadable */]: "neutral" /* Neutral */
|
|
2344
2473
|
};
|
|
2345
|
-
|
|
2346
|
-
|
|
2474
|
+
var FIXED_SUMMARIES = {
|
|
2475
|
+
["settled" /* Settled */]: "This PR's Muggle AI walkthrough comment is settled \u2014 every E2E acceptance case passed, or it states why E2E does not apply.",
|
|
2476
|
+
["unsettled" /* Unsettled */]: "This PR's Muggle AI walkthrough comment is still empty. Run the E2E acceptance suite and post the walkthrough into it (/muggle:muggle-test), or record why E2E does not apply to this change.",
|
|
2477
|
+
["unreadable" /* Unreadable */]: "The PR's comments could not be read, so the walkthrough duty could not be judged."
|
|
2478
|
+
};
|
|
2479
|
+
|
|
2480
|
+
// src/cli/pr-walkthrough/summary.ts
|
|
2481
|
+
function countLabel(count, status) {
|
|
2482
|
+
return count > 0 ? `${count} ${status}` : null;
|
|
2483
|
+
}
|
|
2484
|
+
function renderNotPassingSummary(record) {
|
|
2485
|
+
const failed = record.unpassed.filter((c) => c.status === "failed" /* Failed */).length;
|
|
2486
|
+
const tally = [
|
|
2487
|
+
countLabel(failed, "failed" /* Failed */),
|
|
2488
|
+
countLabel(record.unpassed.length - failed, "inconclusive" /* Inconclusive */)
|
|
2489
|
+
].filter((part) => part !== null).join(", ");
|
|
2490
|
+
const listed = record.unpassed.slice(0, CHECK_SUMMARY_MAX_CASES).map((unpassed) => renderUnpassedCaseBullet(unpassed, "open run", unpassed.viewUrl));
|
|
2491
|
+
const hidden = record.unpassed.length - listed.length;
|
|
2492
|
+
return [
|
|
2493
|
+
`E2E acceptance did not pass \u2014 ${tally} of ${record.total} test ${record.total === 1 ? "case" : "cases"}. Fix them, re-run the whole suite, and update the walkthrough comment; editing it re-runs this check.`,
|
|
2494
|
+
"",
|
|
2495
|
+
...listed,
|
|
2496
|
+
...hidden > 0 ? [`- \u2026and ${hidden} more \u2014 see the walkthrough comment.`] : []
|
|
2497
|
+
].join("\n");
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
// src/cli/pr-walkthrough/check.ts
|
|
2501
|
+
function judgeComments(pr, comments, run) {
|
|
2502
|
+
if (comments === null) {
|
|
2503
|
+
return { outcome: "unreadable" /* Unreadable */, summary: FIXED_SUMMARIES["unreadable" /* Unreadable */] };
|
|
2504
|
+
}
|
|
2505
|
+
const bodies = comments.map((comment) => comment.body);
|
|
2506
|
+
const verdict = walkthroughVerdict(bodies);
|
|
2507
|
+
if (verdict === "missing" /* Missing */) reserveComment(pr, comments, run);
|
|
2508
|
+
const record = latestE2eResult(bodies);
|
|
2509
|
+
if (record && record.unpassed.length > 0) {
|
|
2510
|
+
return { outcome: "e2e-not-passing" /* E2eNotPassing */, summary: renderNotPassingSummary(record) };
|
|
2511
|
+
}
|
|
2512
|
+
const outcome = verdict === "satisfied" /* Satisfied */ ? "settled" /* Settled */ : "unsettled" /* Unsettled */;
|
|
2513
|
+
return { outcome, summary: FIXED_SUMMARIES[outcome] };
|
|
2347
2514
|
}
|
|
2348
2515
|
async function runPrWalkthroughCheck(options, run = defaultGhRunner) {
|
|
2349
2516
|
const pr = { repo: options.repo, prNumber: options.prNumber };
|
|
2350
|
-
const
|
|
2351
|
-
|
|
2352
|
-
if (comments !== null) {
|
|
2353
|
-
const verdict = walkthroughVerdict(comments.map((comment) => comment.body));
|
|
2354
|
-
if (verdict === "missing" /* Missing */) reserveComment(pr, comments, run);
|
|
2355
|
-
conclusion = conclusionFor(verdict);
|
|
2356
|
-
}
|
|
2517
|
+
const { outcome, summary } = judgeComments(pr, listPrComments(pr, run), run);
|
|
2518
|
+
const conclusion = OUTCOME_CONCLUSIONS[outcome];
|
|
2357
2519
|
if (options.publishCheckRun) {
|
|
2358
2520
|
createCheckRun(
|
|
2359
2521
|
options.repo,
|
|
@@ -2361,17 +2523,18 @@ async function runPrWalkthroughCheck(options, run = defaultGhRunner) {
|
|
|
2361
2523
|
name: CHECK_RUN_NAME,
|
|
2362
2524
|
headSha: options.headSha,
|
|
2363
2525
|
conclusion,
|
|
2364
|
-
title:
|
|
2365
|
-
summary
|
|
2526
|
+
title: CHECK_RUN_TITLE,
|
|
2527
|
+
summary
|
|
2366
2528
|
},
|
|
2367
2529
|
run
|
|
2368
2530
|
);
|
|
2369
2531
|
}
|
|
2370
2532
|
const failsLocally = conclusion === "failure" /* Failure */ && !options.publishCheckRun;
|
|
2371
2533
|
return {
|
|
2534
|
+
outcome,
|
|
2372
2535
|
conclusion,
|
|
2373
2536
|
exitCode: failsLocally ? 1 : 0,
|
|
2374
|
-
summary
|
|
2537
|
+
summary
|
|
2375
2538
|
};
|
|
2376
2539
|
}
|
|
2377
2540
|
function readEvent(eventPath) {
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-
|
|
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-
|
|
1
|
+
export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-SF75W2SV.js';
|
|
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-M2PJRVCC.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
|
|
4
|
+
"version": "5.22.0",
|
|
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
|
|
3
|
+
"version": "5.22.0",
|
|
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
|
|
5
|
+
"version": "5.22.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
|
@@ -7,4 +7,5 @@ Map a red CI check to the local command that reproduces and fixes it. Repo-agnos
|
|
|
7
7
|
| lint / format | Run the repo's lint `--fix` / formatter; restage. |
|
|
8
8
|
| typecheck | Run the typecheck script; read the errors; edit the types. |
|
|
9
9
|
| unit / test | Run the suite; read the failures; fix the code or the test. |
|
|
10
|
-
|
|
|
10
|
+
| `muggle-walkthrough` — the Muggle E2E walkthrough check | In scope. Its check-run summary names each failed or inconclusive case with the failing step and a link to the run; the walkthrough comment's hidden `muggle-e2e-result` record carries the same cases with their test case ids. Repair each, re-run the **whole** E2E suite, and settle the walkthrough comment with the new result — editing the comment re-runs the check. A summary saying the comment is still empty means no run was ever posted: run the suite and post it. |
|
|
11
|
+
| out of scope — any other E2E-in-CI, build/deploy infra, flaky / non-deterministic, or unknown | Do **not** attempt; record for escalation. |
|
|
@@ -20,3 +20,12 @@ Classify for the watcher:
|
|
|
20
20
|
- **green** — every row `pass` / `skipping`, or no rows at all.
|
|
21
21
|
|
|
22
22
|
The fix-ci dispatch carries the `name`s of the red rows. `gh pr checks` exits non-zero when any check fails — capture output regardless of exit code.
|
|
23
|
+
|
|
24
|
+
A check that publishes its own verdict (the `muggle-walkthrough` check run) says why it failed in its output, not in a job log. Read the newest one on the head SHA:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
gh api "repos/<owner>/<repo>/commits/<head-sha>/check-runs?check_name=<name>" \
|
|
28
|
+
--jq '.check_runs | sort_by(.completed_at) | last | {conclusion, completed_at, summary: .output.summary}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`completed_at` is how a caller tells a fresh verdict from the one it is repairing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fix-CI (watcher-dispatched)
|
|
2
2
|
|
|
3
|
-
Resolve red CI on a PR's head — lint/format, typecheck,
|
|
3
|
+
Resolve red CI on a PR's head — lint/format, typecheck, failing unit tests, and a red Muggle E2E walkthrough check — verifying green before re-push. A dumb-pipe dispatch like address-reviews: the executor receives a PR URL, slug, and the failing check names, and fixes them — it owns the fix, not the decision to dispatch.
|
|
4
4
|
|
|
5
5
|
## Turn preamble
|
|
6
6
|
|
|
@@ -24,12 +24,22 @@ Check out the PR branch in the session's working tree (per `state.md`). Capture
|
|
|
24
24
|
|
|
25
25
|
### Step 2 — Map each failing check to a local command
|
|
26
26
|
|
|
27
|
-
Per [`../_shared/ci-check-to-command.md`](../_shared/ci-check-to-command.md). Fix the in-scope checks in the working tree; record out-of-scope checks for escalation (Step 6).
|
|
27
|
+
Per [`../_shared/ci-check-to-command.md`](../_shared/ci-check-to-command.md). Fix the in-scope checks in the working tree; record out-of-scope checks for escalation (Step 6). A red `muggle-walkthrough` check takes Step 2.5.
|
|
28
|
+
|
|
29
|
+
### Step 2.5 — Red E2E walkthrough check
|
|
30
|
+
|
|
31
|
+
1. **Read why.** Fetch the check run's summary per [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md) and record its `completed_at`. It names every failed or inconclusive case, its failing step, and its run. Take the test case ids from the walkthrough comment's hidden `<!-- muggle-e2e-result:v1 {…} -->` record — the newest comment carrying one.
|
|
32
|
+
2. **Repair each case** per [`e2e-repair.md`](e2e-repair.md) Steps 1–3: root-cause to a bucket, then retry, regenerate, or repair the code. This stage is unattended, so a case whose disposition is `ask` is out of scope — record it for Step 6 and never open a picker.
|
|
33
|
+
3. **Re-run the whole suite** through [`e2e-acceptance.md`](e2e-acceptance.md) — every test case the walkthrough listed, passing ones included. The walkthrough is replaced wholesale and the check judges all of it, so a re-run scoped to the failures would post a walkthrough that drops the cases that passed.
|
|
34
|
+
4. **Order the settle after the push.** If Step 2 changed code, run Steps 3–4 below first, so the new head carries the fix. Then settle the walkthrough comment with the re-run's report via [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A; editing the comment re-runs the check against the head. With no code change (only retries and regenerations) there is nothing to push — the comment edit alone re-runs the check.
|
|
35
|
+
5. **Wait for the fresh verdict** before Step 5's respawn: poll the check run until one completes later than the `completed_at` recorded in item 1, for up to 5 minutes. A watcher respawned sooner reads the stale red verdict and spends a fix attempt on a run already repaired. On timeout, respawn anyway — the per-SHA budget still bounds it.
|
|
36
|
+
|
|
37
|
+
An empty-comment failure (no run ever posted) skips items 1–2: run the suite and settle the comment. Under a `unit-only` or `skip` validation in `state.md`, settle it with the verified skip code instead.
|
|
28
38
|
|
|
29
39
|
### Step 3 — Verify before push
|
|
30
40
|
|
|
31
41
|
- Build (typecheck + lint on the changed surface) + unit suite must pass.
|
|
32
|
-
- Run E2E (per [`../muggle-preferences/preference-gates/autoE2ETest.md`](../muggle-preferences/preference-gates/autoE2ETest.md)) only if the fix touched app logic; lint/format-only fixes skip E2E.
|
|
42
|
+
- Run E2E (per [`../muggle-preferences/preference-gates/autoE2ETest.md`](../muggle-preferences/preference-gates/autoE2ETest.md)) only if the fix touched app logic; lint/format-only fixes skip E2E. A Step 2.5 repair always runs the full suite.
|
|
33
43
|
|
|
34
44
|
A fix that can't be made green locally is not pushed → Step 6.
|
|
35
45
|
|
|
@@ -57,5 +67,5 @@ Emit one `muggle-do:cycle` event ([`../_shared/telemetry-events/muggle-do-cycle.
|
|
|
57
67
|
|
|
58
68
|
## Guardrails
|
|
59
69
|
|
|
60
|
-
- Max 3 fix attempts per SHA; out-of-scope checks escalate immediately rather than churn.
|
|
70
|
+
- Max 3 fix attempts per SHA; out-of-scope checks escalate immediately rather than churn. A walkthrough repair that pushes nothing keeps the head SHA, so the same budget bounds it.
|
|
61
71
|
- No PR replies; the fix commit is the response.
|
|
@@ -20,6 +20,8 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
|
|
|
20
20
|
|
|
21
21
|
1. **Sync with the base:** run [`../../_shared/sync-branch-with-base.md`](../../_shared/sync-branch-with-base.md) with `base` set to the PR target recorded in `state.md` — gated by [`autoRebase`](../../muggle-preferences/preference-gates/autoRebase.md), fires only when `behind > 0`. The branch is not on the remote yet, so the rebase lands without a force-push. Sync here rather than trusting stage 6: a `unit-only` or `skip` run never reaches the E2E stage's sync at all, and on a run that does, the base moves freely while stages 3–6 build and test. If the sync escalates — conflicts under `autoResolveConflicts=never`, or a resolution that fails the verify-or-rollback gate — stop and report; never open a PR on a tree that did not verify.
|
|
22
22
|
|
|
23
|
+
1.5. **CI check:** gate [`autoInstallCiWorkflow`](../../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) — fires only on a GitHub repo whose tree lacks `.github/workflows/muggle-walkthrough.yml`. On `always`, or `CI check: add` recorded by pre-flight, run `muggle ci-install` in the working tree and commit the workflow as `ci: add the Muggle E2E walkthrough check`, so it ships in this PR. On `never` or `CI check: skip`, leave CI alone.
|
|
24
|
+
|
|
23
25
|
2. **Push:** Execute per [`../../_shared/vcs/common/push-to-branch.md`](../../_shared/vcs/common/push-to-branch.md) — the tool-agnostic instruction for pushing commits (handles the signing gate and directs to provider-specific recipes).
|
|
24
26
|
|
|
25
27
|
3. **Title** (under 70 chars):
|
|
@@ -36,6 +36,7 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
36
36
|
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
37
37
|
- How many commits behind `origin/<default>`? `git -C <repo> fetch origin && git -C <repo> rev-list --count "HEAD..origin/$(git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short | sed 's|origin/||')"`.
|
|
38
38
|
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
39
|
+
11. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
39
40
|
|
|
40
41
|
## The consolidated questionnaire
|
|
41
42
|
|
|
@@ -58,6 +59,7 @@ Present **one `AskUserQuestion`** (or the platform's structured-selection equiva
|
|
|
58
59
|
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
59
60
|
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
60
61
|
13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
|
|
62
|
+
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 11 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
61
63
|
|
|
62
64
|
If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
|
|
63
65
|
|
|
@@ -67,6 +67,7 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
67
67
|
| `autoE2ETest` | Stage 6 — run E2E every cycle (default `always`), or fold into pre-flight |
|
|
68
68
|
| `autoResolveConflicts` | On rebase conflict — `always` resolves autonomously behind a verify-or-rollback gate, `never` aborts + escalates; resolve from the configured preference (don't assume a default) |
|
|
69
69
|
| `autoRouteBuildToMuggleDo` | Front-door guardrail — route build/implement/fix requests through this pipeline (build delegated to superpowers); fired by the UserPromptSubmit guardrail, default `ask` |
|
|
70
|
+
| `autoInstallCiWorkflow` | Stage 7 — add the `muggle-walkthrough` CI check to a GitHub repo that lacks it, shipped in the PR; `ask` folds into pre-flight, default `ask` |
|
|
70
71
|
|
|
71
72
|
`autoUseWorktree`, `autoRebase`, `autoResolveConflicts`, `autoCreatePR`, `autoCleanup`, `postPRVisualWalkthrough` fire from per-stage files.
|
|
72
73
|
|
|
@@ -31,6 +31,7 @@ For each option: label = key name, description = first paragraph of `preference-
|
|
|
31
31
|
- `multiSelect: true`, `header: "Suggestions"` — `suggestRelatedUseCases`, `suggestRelatedTestCases`
|
|
32
32
|
- `multiSelect: true`, `header: "PR"` — `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `autoRouteBuildToMuggleDo`
|
|
33
33
|
- `multiSelect: true`, `header: "Branch hygiene"` — `autoUseWorktree`, `autoRebase`, `autoCleanup`, `autoResolveConflicts`
|
|
34
|
+
- `multiSelect: false`, `header: "CI check"` — `autoInstallCiWorkflow`. Options: `Always — add it to every repo Muggle works in` (`always`), `Ask in each repo` (`ask` — default), `Never` (`never`).
|
|
34
35
|
- `multiSelect: false`, `header: "E2E acceptance"` — `autoE2ETest`. Options: `Always run Stage 6 at the end` (`always` — default), `Ask each cycle` (`ask`). No `never` option.
|
|
35
36
|
- `multiSelect: false`, `header: "Default mode"` — `defaultExecutionMode`. Options: `Local — run on my computer` (`local`), `Remote — run in the Muggle Test cloud` (`remote`), `Ask each time` (don't change).
|
|
36
37
|
- `multiSelect: false`, `header: "PR watcher"` — `watcherLifetime`. Options: `Retire after 1 day` (`1d`), `Retire after 7 days` (`7d` — default), `Never retire` (`never`).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# `autoInstallCiWorkflow`
|
|
2
|
+
|
|
3
|
+
Controls whether Muggle adds `.github/workflows/muggle-walkthrough.yml` — the CI check that fails a pull request whose E2E walkthrough is missing or reports a failed or inconclusive test case — to a GitHub repository that lacks it. Fires when `muggle init` runs inside such a repository, and when `/muggle-do` is about to open a PR from one. Never fires where the workflow already exists or the repository is not on GitHub. Substitute `{repo}`.
|
|
4
|
+
|
|
5
|
+
**Picker 1** — header `CI check`, question `"Add the Muggle E2E check to {repo}'s CI? Pull requests then fail while their walkthrough is missing or reports a failed test."`
|
|
6
|
+
- `Add it` — `Run muggle ci-install and ship the workflow with this change.` → `always`
|
|
7
|
+
- `Ask me next time` — `Decide per repository.` → `ask`
|
|
8
|
+
- `Skip — leave CI alone` — `Don't add the workflow; muggle ci-install adds it later.` → `never`
|
|
9
|
+
|
|
10
|
+
**Silent action**
|
|
11
|
+
- `always` → `Adding the Muggle E2E check to {repo}'s CI`
|
|
12
|
+
- `ask` → `Asking about the Muggle E2E check for {repo}`
|
|
13
|
+
- `never` → `Leaving {repo}'s CI without the Muggle E2E check`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"release": "5.18.0",
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
5
|
-
"buildTime": "2026-10-
|
|
3
|
+
"buildId": "run-160-1",
|
|
4
|
+
"commitSha": "46b3c06be1814b0f1bc345d0070fa2ad75e90b6f",
|
|
5
|
+
"buildTime": "2026-10-21T18:46:51Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-
|
|
1
|
+
export { ACTION_SCRIPT_FILE_NAME, DEFAULT_PREFERENCES, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildOnboardingPlan, calculateFileChecksum, completeOnboarding, createApiKeyWithToken, createChildLogger, deleteApiKeyData, deleteCredentials, e2e_exports as e2e, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isFirstRun, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, mcp_exports as mcp, needsOnboarding, openBrowserUrl, performLogin, performLogout, pollDeviceCode, e2e_exports as qa, readPreferencesMetadata, readRunView, reconcileProjectPreferences, recordOnboardingSkip, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppPathOrNull, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, toolRequiresAuth, validatePreference, verifyFileChecksum, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-M2PJRVCC.js';
|
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
|
|
4
|
+
"version": "5.22.0",
|
|
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",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"muggleConfig": {
|
|
60
60
|
"electronAppVersion": "1.10.6",
|
|
61
61
|
"downloadBaseUrl": "https://github.com/multiplex-ai/muggle-ai-works/releases/download",
|
|
62
|
-
"runtimeTargetDefault": "
|
|
62
|
+
"runtimeTargetDefault": "production",
|
|
63
63
|
"checksumsByStream": {
|
|
64
64
|
"production": {
|
|
65
65
|
"win32-x64": "c20acdc2fd7a05039c62f9e5b079e3068d1b3a23a1b3b37b75e2a650b5401de6",
|
|
@@ -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
|
|
4
|
+
"version": "5.22.0",
|
|
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
|
|
3
|
+
"version": "5.22.0",
|
|
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
|
|
5
|
+
"version": "5.22.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
|
@@ -7,4 +7,5 @@ Map a red CI check to the local command that reproduces and fixes it. Repo-agnos
|
|
|
7
7
|
| lint / format | Run the repo's lint `--fix` / formatter; restage. |
|
|
8
8
|
| typecheck | Run the typecheck script; read the errors; edit the types. |
|
|
9
9
|
| unit / test | Run the suite; read the failures; fix the code or the test. |
|
|
10
|
-
|
|
|
10
|
+
| `muggle-walkthrough` — the Muggle E2E walkthrough check | In scope. Its check-run summary names each failed or inconclusive case with the failing step and a link to the run; the walkthrough comment's hidden `muggle-e2e-result` record carries the same cases with their test case ids. Repair each, re-run the **whole** E2E suite, and settle the walkthrough comment with the new result — editing the comment re-runs the check. A summary saying the comment is still empty means no run was ever posted: run the suite and post it. |
|
|
11
|
+
| out of scope — any other E2E-in-CI, build/deploy infra, flaky / non-deterministic, or unknown | Do **not** attempt; record for escalation. |
|
|
@@ -20,3 +20,12 @@ Classify for the watcher:
|
|
|
20
20
|
- **green** — every row `pass` / `skipping`, or no rows at all.
|
|
21
21
|
|
|
22
22
|
The fix-ci dispatch carries the `name`s of the red rows. `gh pr checks` exits non-zero when any check fails — capture output regardless of exit code.
|
|
23
|
+
|
|
24
|
+
A check that publishes its own verdict (the `muggle-walkthrough` check run) says why it failed in its output, not in a job log. Read the newest one on the head SHA:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
gh api "repos/<owner>/<repo>/commits/<head-sha>/check-runs?check_name=<name>" \
|
|
28
|
+
--jq '.check_runs | sort_by(.completed_at) | last | {conclusion, completed_at, summary: .output.summary}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`completed_at` is how a caller tells a fresh verdict from the one it is repairing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Fix-CI (watcher-dispatched)
|
|
2
2
|
|
|
3
|
-
Resolve red CI on a PR's head — lint/format, typecheck,
|
|
3
|
+
Resolve red CI on a PR's head — lint/format, typecheck, failing unit tests, and a red Muggle E2E walkthrough check — verifying green before re-push. A dumb-pipe dispatch like address-reviews: the executor receives a PR URL, slug, and the failing check names, and fixes them — it owns the fix, not the decision to dispatch.
|
|
4
4
|
|
|
5
5
|
## Turn preamble
|
|
6
6
|
|
|
@@ -24,12 +24,22 @@ Check out the PR branch in the session's working tree (per `state.md`). Capture
|
|
|
24
24
|
|
|
25
25
|
### Step 2 — Map each failing check to a local command
|
|
26
26
|
|
|
27
|
-
Per [`../_shared/ci-check-to-command.md`](../_shared/ci-check-to-command.md). Fix the in-scope checks in the working tree; record out-of-scope checks for escalation (Step 6).
|
|
27
|
+
Per [`../_shared/ci-check-to-command.md`](../_shared/ci-check-to-command.md). Fix the in-scope checks in the working tree; record out-of-scope checks for escalation (Step 6). A red `muggle-walkthrough` check takes Step 2.5.
|
|
28
|
+
|
|
29
|
+
### Step 2.5 — Red E2E walkthrough check
|
|
30
|
+
|
|
31
|
+
1. **Read why.** Fetch the check run's summary per [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md) and record its `completed_at`. It names every failed or inconclusive case, its failing step, and its run. Take the test case ids from the walkthrough comment's hidden `<!-- muggle-e2e-result:v1 {…} -->` record — the newest comment carrying one.
|
|
32
|
+
2. **Repair each case** per [`e2e-repair.md`](e2e-repair.md) Steps 1–3: root-cause to a bucket, then retry, regenerate, or repair the code. This stage is unattended, so a case whose disposition is `ask` is out of scope — record it for Step 6 and never open a picker.
|
|
33
|
+
3. **Re-run the whole suite** through [`e2e-acceptance.md`](e2e-acceptance.md) — every test case the walkthrough listed, passing ones included. The walkthrough is replaced wholesale and the check judges all of it, so a re-run scoped to the failures would post a walkthrough that drops the cases that passed.
|
|
34
|
+
4. **Order the settle after the push.** If Step 2 changed code, run Steps 3–4 below first, so the new head carries the fix. Then settle the walkthrough comment with the re-run's report via [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A; editing the comment re-runs the check against the head. With no code change (only retries and regenerations) there is nothing to push — the comment edit alone re-runs the check.
|
|
35
|
+
5. **Wait for the fresh verdict** before Step 5's respawn: poll the check run until one completes later than the `completed_at` recorded in item 1, for up to 5 minutes. A watcher respawned sooner reads the stale red verdict and spends a fix attempt on a run already repaired. On timeout, respawn anyway — the per-SHA budget still bounds it.
|
|
36
|
+
|
|
37
|
+
An empty-comment failure (no run ever posted) skips items 1–2: run the suite and settle the comment. Under a `unit-only` or `skip` validation in `state.md`, settle it with the verified skip code instead.
|
|
28
38
|
|
|
29
39
|
### Step 3 — Verify before push
|
|
30
40
|
|
|
31
41
|
- Build (typecheck + lint on the changed surface) + unit suite must pass.
|
|
32
|
-
- Run E2E (per [`../muggle-preferences/preference-gates/autoE2ETest.md`](../muggle-preferences/preference-gates/autoE2ETest.md)) only if the fix touched app logic; lint/format-only fixes skip E2E.
|
|
42
|
+
- Run E2E (per [`../muggle-preferences/preference-gates/autoE2ETest.md`](../muggle-preferences/preference-gates/autoE2ETest.md)) only if the fix touched app logic; lint/format-only fixes skip E2E. A Step 2.5 repair always runs the full suite.
|
|
33
43
|
|
|
34
44
|
A fix that can't be made green locally is not pushed → Step 6.
|
|
35
45
|
|
|
@@ -57,5 +67,5 @@ Emit one `muggle-do:cycle` event ([`../_shared/telemetry-events/muggle-do-cycle.
|
|
|
57
67
|
|
|
58
68
|
## Guardrails
|
|
59
69
|
|
|
60
|
-
- Max 3 fix attempts per SHA; out-of-scope checks escalate immediately rather than churn.
|
|
70
|
+
- Max 3 fix attempts per SHA; out-of-scope checks escalate immediately rather than churn. A walkthrough repair that pushes nothing keeps the head SHA, so the same budget bounds it.
|
|
61
71
|
- No PR replies; the fix commit is the response.
|
|
@@ -20,6 +20,8 @@ Forward pipeline's Stage 7. Invoked by `/muggle-do` after stages 1–6 of a fres
|
|
|
20
20
|
|
|
21
21
|
1. **Sync with the base:** run [`../../_shared/sync-branch-with-base.md`](../../_shared/sync-branch-with-base.md) with `base` set to the PR target recorded in `state.md` — gated by [`autoRebase`](../../muggle-preferences/preference-gates/autoRebase.md), fires only when `behind > 0`. The branch is not on the remote yet, so the rebase lands without a force-push. Sync here rather than trusting stage 6: a `unit-only` or `skip` run never reaches the E2E stage's sync at all, and on a run that does, the base moves freely while stages 3–6 build and test. If the sync escalates — conflicts under `autoResolveConflicts=never`, or a resolution that fails the verify-or-rollback gate — stop and report; never open a PR on a tree that did not verify.
|
|
22
22
|
|
|
23
|
+
1.5. **CI check:** gate [`autoInstallCiWorkflow`](../../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) — fires only on a GitHub repo whose tree lacks `.github/workflows/muggle-walkthrough.yml`. On `always`, or `CI check: add` recorded by pre-flight, run `muggle ci-install` in the working tree and commit the workflow as `ci: add the Muggle E2E walkthrough check`, so it ships in this PR. On `never` or `CI check: skip`, leave CI alone.
|
|
24
|
+
|
|
23
25
|
2. **Push:** Execute per [`../../_shared/vcs/common/push-to-branch.md`](../../_shared/vcs/common/push-to-branch.md) — the tool-agnostic instruction for pushing commits (handles the signing gate and directs to provider-specific recipes).
|
|
24
26
|
|
|
25
27
|
3. **Title** (under 70 chars):
|
|
@@ -36,6 +36,7 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
36
36
|
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
37
37
|
- How many commits behind `origin/<default>`? `git -C <repo> fetch origin && git -C <repo> rev-list --count "HEAD..origin/$(git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short | sed 's|origin/||')"`.
|
|
38
38
|
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
39
|
+
11. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
39
40
|
|
|
40
41
|
## The consolidated questionnaire
|
|
41
42
|
|
|
@@ -58,6 +59,7 @@ Present **one `AskUserQuestion`** (or the platform's structured-selection equiva
|
|
|
58
59
|
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
59
60
|
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
60
61
|
13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
|
|
62
|
+
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 11 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
61
63
|
|
|
62
64
|
If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
|
|
63
65
|
|
|
@@ -67,6 +67,7 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
67
67
|
| `autoE2ETest` | Stage 6 — run E2E every cycle (default `always`), or fold into pre-flight |
|
|
68
68
|
| `autoResolveConflicts` | On rebase conflict — `always` resolves autonomously behind a verify-or-rollback gate, `never` aborts + escalates; resolve from the configured preference (don't assume a default) |
|
|
69
69
|
| `autoRouteBuildToMuggleDo` | Front-door guardrail — route build/implement/fix requests through this pipeline (build delegated to superpowers); fired by the UserPromptSubmit guardrail, default `ask` |
|
|
70
|
+
| `autoInstallCiWorkflow` | Stage 7 — add the `muggle-walkthrough` CI check to a GitHub repo that lacks it, shipped in the PR; `ask` folds into pre-flight, default `ask` |
|
|
70
71
|
|
|
71
72
|
`autoUseWorktree`, `autoRebase`, `autoResolveConflicts`, `autoCreatePR`, `autoCleanup`, `postPRVisualWalkthrough` fire from per-stage files.
|
|
72
73
|
|
|
@@ -31,6 +31,7 @@ For each option: label = key name, description = first paragraph of `preference-
|
|
|
31
31
|
- `multiSelect: true`, `header: "Suggestions"` — `suggestRelatedUseCases`, `suggestRelatedTestCases`
|
|
32
32
|
- `multiSelect: true`, `header: "PR"` — `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `autoRouteBuildToMuggleDo`
|
|
33
33
|
- `multiSelect: true`, `header: "Branch hygiene"` — `autoUseWorktree`, `autoRebase`, `autoCleanup`, `autoResolveConflicts`
|
|
34
|
+
- `multiSelect: false`, `header: "CI check"` — `autoInstallCiWorkflow`. Options: `Always — add it to every repo Muggle works in` (`always`), `Ask in each repo` (`ask` — default), `Never` (`never`).
|
|
34
35
|
- `multiSelect: false`, `header: "E2E acceptance"` — `autoE2ETest`. Options: `Always run Stage 6 at the end` (`always` — default), `Ask each cycle` (`ask`). No `never` option.
|
|
35
36
|
- `multiSelect: false`, `header: "Default mode"` — `defaultExecutionMode`. Options: `Local — run on my computer` (`local`), `Remote — run in the Muggle Test cloud` (`remote`), `Ask each time` (don't change).
|
|
36
37
|
- `multiSelect: false`, `header: "PR watcher"` — `watcherLifetime`. Options: `Retire after 1 day` (`1d`), `Retire after 7 days` (`7d` — default), `Never retire` (`never`).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# `autoInstallCiWorkflow`
|
|
2
|
+
|
|
3
|
+
Controls whether Muggle adds `.github/workflows/muggle-walkthrough.yml` — the CI check that fails a pull request whose E2E walkthrough is missing or reports a failed or inconclusive test case — to a GitHub repository that lacks it. Fires when `muggle init` runs inside such a repository, and when `/muggle-do` is about to open a PR from one. Never fires where the workflow already exists or the repository is not on GitHub. Substitute `{repo}`.
|
|
4
|
+
|
|
5
|
+
**Picker 1** — header `CI check`, question `"Add the Muggle E2E check to {repo}'s CI? Pull requests then fail while their walkthrough is missing or reports a failed test."`
|
|
6
|
+
- `Add it` — `Run muggle ci-install and ship the workflow with this change.` → `always`
|
|
7
|
+
- `Ask me next time` — `Decide per repository.` → `ask`
|
|
8
|
+
- `Skip — leave CI alone` — `Don't add the workflow; muggle ci-install adds it later.` → `never`
|
|
9
|
+
|
|
10
|
+
**Silent action**
|
|
11
|
+
- `always` → `Adding the Muggle E2E check to {repo}'s CI`
|
|
12
|
+
- `ask` → `Asking about the Muggle E2E check for {repo}`
|
|
13
|
+
- `never` → `Leaving {repo}'s CI without the Muggle E2E check`
|