@muggleai/works 5.33.0 → 5.34.0-staging.307
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/dist/{chunk-KPTUNKJI.js → chunk-C4L5SKOX.js} +50 -15
- package/dist/{chunk-ZLDRK3M4.js → chunk-L4ZDHFEJ.js} +2 -2
- 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-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/hooks/README.md +1 -1
- package/dist/plugin/scripts/ensure-electron-app.sh +4 -18
- package/dist/plugin/scripts/guardrail-lib.sh +31 -0
- package/dist/plugin/scripts/guardrail-skill-stages.sh +5 -0
- package/dist/plugin/scripts/guardrails.mjs +69 -35
- package/dist/plugin/scripts/session-maintenance.sh +32 -11
- package/dist/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +2 -2
- package/dist/release-manifest.json +4 -4
- package/dist/{src-M4ASSV4W.js → src-Z5YREWY6.js} +1 -1
- package/package.json +3 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/hooks/README.md +1 -1
- package/plugin/scripts/ensure-electron-app.sh +4 -18
- package/plugin/scripts/guardrail-lib.sh +31 -0
- package/plugin/scripts/guardrail-skill-stages.sh +5 -0
- package/plugin/scripts/guardrails.mjs +69 -35
- package/plugin/scripts/session-maintenance.sh +32 -11
- package/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +2 -2
- package/scripts/postinstall.mjs +2 -0
- package/scripts/upgrade-notice-cache.mjs +22 -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.
|
|
12
|
+
"version": "5.34.0-staging.307"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
}
|
|
@@ -515,7 +515,9 @@ function getMuggleConfig() {
|
|
|
515
515
|
electronAppVersion: config.electronAppVersion,
|
|
516
516
|
downloadBaseUrl: config.downloadBaseUrl,
|
|
517
517
|
checksumsByStream: config.checksumsByStream || {},
|
|
518
|
-
runtimeTargetDefault
|
|
518
|
+
runtimeTargetDefault,
|
|
519
|
+
electronAppSignedFromVersion: config.electronAppSignedFromVersion,
|
|
520
|
+
signerIdentityUri: config.signerIdentityUri
|
|
519
521
|
};
|
|
520
522
|
return muggleConfigCache;
|
|
521
523
|
}
|
|
@@ -1006,9 +1008,9 @@ var HealthStatus = /* @__PURE__ */ ((HealthStatus2) => {
|
|
|
1006
1008
|
})(HealthStatus || {});
|
|
1007
1009
|
var StudioVerdict = /* @__PURE__ */ ((StudioVerdict2) => {
|
|
1008
1010
|
StudioVerdict2["Success"] = "success";
|
|
1009
|
-
StudioVerdict2["Active"] = "active";
|
|
1010
1011
|
StudioVerdict2["BugDetected"] = "bug_detected";
|
|
1011
1012
|
StudioVerdict2["GoalNotAchievable"] = "goal_not_achievable";
|
|
1013
|
+
StudioVerdict2["GoalUnachievable"] = "goal_unachievable";
|
|
1012
1014
|
StudioVerdict2["Failure"] = "failure";
|
|
1013
1015
|
StudioVerdict2["Failed"] = "failed";
|
|
1014
1016
|
StudioVerdict2["Timeout"] = "timeout";
|
|
@@ -2848,7 +2850,7 @@ var PREFERENCES_SCHEMA = {
|
|
|
2848
2850
|
description: "At the end of the muggle-do dev cycle (or when a test needs an open PR to post results to), push the branch and open a PR without prompting"
|
|
2849
2851
|
},
|
|
2850
2852
|
["checkForUpdates" /* CheckForUpdates */]: {
|
|
2851
|
-
description: "
|
|
2853
|
+
description: "Check daily for a newer Muggle Test version on the installed release lane, and remind at session start and on every skill call"
|
|
2852
2854
|
},
|
|
2853
2855
|
["verboseOutput" /* VerboseOutput */]: {
|
|
2854
2856
|
description: "Show detailed progress logs during skill and tool execution"
|
|
@@ -3689,6 +3691,14 @@ function extractStudioCloudRefs(studioReturnedResult) {
|
|
|
3689
3691
|
if (cloudRunSettingsId !== void 0) refs.cloudRunSettingsId = cloudRunSettingsId;
|
|
3690
3692
|
return refs;
|
|
3691
3693
|
}
|
|
3694
|
+
function buildGenerationStudioResult(params) {
|
|
3695
|
+
const { recordedScript, studioCloudRefs } = params;
|
|
3696
|
+
if (typeof recordedScript !== "object" || recordedScript === null) {
|
|
3697
|
+
return studioCloudRefs;
|
|
3698
|
+
}
|
|
3699
|
+
const reportedVerdict = studioCloudRefs?.status;
|
|
3700
|
+
return typeof reportedVerdict === "string" && reportedVerdict.length > 0 ? { ...recordedScript, status: reportedVerdict } : recordedScript;
|
|
3701
|
+
}
|
|
3692
3702
|
async function readCloudRefsFile(inputFilePath) {
|
|
3693
3703
|
const cloudRefsPath = path17.join(
|
|
3694
3704
|
path17.dirname(inputFilePath),
|
|
@@ -4180,15 +4190,18 @@ async function runTestGenerationLocked(params) {
|
|
|
4180
4190
|
});
|
|
4181
4191
|
} catch {
|
|
4182
4192
|
}
|
|
4183
|
-
const
|
|
4193
|
+
const failedCloudRefsContent = await readCloudRefsFile(inputFilePath);
|
|
4184
4194
|
storage.updateRunResult(runId, {
|
|
4185
4195
|
status: resolveFailedRunStatus(executionResult),
|
|
4186
4196
|
testScriptId: localTestScript.id,
|
|
4187
4197
|
executionTimeMs,
|
|
4188
4198
|
errorMessage: failureMessage,
|
|
4189
4199
|
artifactsDir: artifactsDir2,
|
|
4190
|
-
studioReturnedResult:
|
|
4191
|
-
|
|
4200
|
+
studioReturnedResult: buildGenerationStudioResult({
|
|
4201
|
+
recordedScript: failedStudioResult,
|
|
4202
|
+
studioCloudRefs: failedCloudRefsContent
|
|
4203
|
+
}),
|
|
4204
|
+
...extractStudioCloudRefs(failedCloudRefsContent),
|
|
4192
4205
|
localExecutionContext: {
|
|
4193
4206
|
...localExecutionContextBase,
|
|
4194
4207
|
localExecutionCompletedAt: completedAt
|
|
@@ -4227,14 +4240,17 @@ async function runTestGenerationLocked(params) {
|
|
|
4227
4240
|
runId,
|
|
4228
4241
|
generatedScriptPath
|
|
4229
4242
|
});
|
|
4230
|
-
const
|
|
4243
|
+
const cloudRefsContent = await readCloudRefsFile(inputFilePath);
|
|
4231
4244
|
storage.updateRunResult(runId, {
|
|
4232
4245
|
status: "passed",
|
|
4233
4246
|
testScriptId: localTestScript.id,
|
|
4234
4247
|
executionTimeMs,
|
|
4235
4248
|
artifactsDir,
|
|
4236
|
-
studioReturnedResult:
|
|
4237
|
-
|
|
4249
|
+
studioReturnedResult: buildGenerationStudioResult({
|
|
4250
|
+
recordedScript: generatedScript,
|
|
4251
|
+
studioCloudRefs: cloudRefsContent
|
|
4252
|
+
}),
|
|
4253
|
+
...extractStudioCloudRefs(cloudRefsContent),
|
|
4238
4254
|
localExecutionContext: {
|
|
4239
4255
|
...localExecutionContextBase,
|
|
4240
4256
|
localExecutionCompletedAt: completedAt
|
|
@@ -10406,28 +10422,44 @@ function formatLlmTierLine(isLightMode) {
|
|
|
10406
10422
|
// packages/mcps/src/mcp/tools/local/studio-verdict-line-constants.ts
|
|
10407
10423
|
var STUDIO_VERDICT_LABELS = {
|
|
10408
10424
|
["success" /* Success */]: "Passed",
|
|
10409
|
-
["active" /* Active */]: "Passed",
|
|
10410
10425
|
["bug_detected" /* BugDetected */]: "Bug Detected",
|
|
10411
10426
|
["goal_not_achievable" /* GoalNotAchievable */]: "Goal Not Achievable",
|
|
10427
|
+
["goal_unachievable" /* GoalUnachievable */]: "Goal Not Achievable",
|
|
10412
10428
|
["failure" /* Failure */]: "Failed",
|
|
10413
10429
|
["failed" /* Failed */]: "Failed",
|
|
10414
10430
|
["timeout" /* Timeout */]: "Timed Out",
|
|
10415
10431
|
["insufficient_balance" /* InsufficientBalance */]: "Insufficient Balance"
|
|
10416
10432
|
};
|
|
10433
|
+
var RECORDED_SCRIPT_LIFECYCLE_STATUS = "active";
|
|
10417
10434
|
|
|
10418
10435
|
// packages/mcps/src/mcp/tools/local/studio-verdict-line.ts
|
|
10419
10436
|
function isStudioVerdict(rawStatus) {
|
|
10420
10437
|
return Object.values(StudioVerdict).includes(rawStatus);
|
|
10421
10438
|
}
|
|
10422
|
-
function
|
|
10439
|
+
function readNonEmptyString(candidate) {
|
|
10440
|
+
return typeof candidate === "string" && candidate.length > 0 ? candidate : void 0;
|
|
10441
|
+
}
|
|
10442
|
+
function resolveVerdictStatus(studioReturnedResult) {
|
|
10443
|
+
const reportedStatus = readNonEmptyString(studioReturnedResult.status);
|
|
10444
|
+
if (reportedStatus !== void 0 && reportedStatus !== RECORDED_SCRIPT_LIFECYCLE_STATUS) {
|
|
10445
|
+
return reportedStatus;
|
|
10446
|
+
}
|
|
10447
|
+
const summaryStep = studioReturnedResult.summaryStep;
|
|
10448
|
+
return readNonEmptyString(summaryStep?.structuredSummary?.status);
|
|
10449
|
+
}
|
|
10450
|
+
function formatStudioVerdictLine(params) {
|
|
10451
|
+
const { studioReturnedResult, runStatus } = params;
|
|
10423
10452
|
if (typeof studioReturnedResult !== "object" || studioReturnedResult === null) {
|
|
10424
10453
|
return "";
|
|
10425
10454
|
}
|
|
10426
|
-
const
|
|
10427
|
-
if (
|
|
10455
|
+
const verdictStatus = resolveVerdictStatus(studioReturnedResult);
|
|
10456
|
+
if (verdictStatus === void 0) {
|
|
10457
|
+
return "";
|
|
10458
|
+
}
|
|
10459
|
+
if (verdictStatus === "success" /* Success */ && runStatus !== "passed") {
|
|
10428
10460
|
return "";
|
|
10429
10461
|
}
|
|
10430
|
-
const verdictText = isStudioVerdict(
|
|
10462
|
+
const verdictText = isStudioVerdict(verdictStatus) ? `${STUDIO_VERDICT_LABELS[verdictStatus]} (${verdictStatus})` : verdictStatus;
|
|
10431
10463
|
return `**Studio Verdict:** ${verdictText}`;
|
|
10432
10464
|
}
|
|
10433
10465
|
|
|
@@ -10615,7 +10647,10 @@ var runResultGetTool = {
|
|
|
10615
10647
|
`**ID:** ${storedRunResult.id}`,
|
|
10616
10648
|
`**Type:** ${storedRunResult.runType}`,
|
|
10617
10649
|
`**Status:** ${storedRunResult.status}`,
|
|
10618
|
-
formatStudioVerdictLine(
|
|
10650
|
+
formatStudioVerdictLine({
|
|
10651
|
+
studioReturnedResult: storedRunResult.studioReturnedResult,
|
|
10652
|
+
runStatus: storedRunResult.status
|
|
10653
|
+
}),
|
|
10619
10654
|
`**Cloud Test Case:** ${storedRunResult.cloudTestCaseId}`,
|
|
10620
10655
|
`**Duration:** ${storedRunResult.executionTimeMs ?? 0}ms`,
|
|
10621
10656
|
storedRunResult.errorMessage ? `**Error:** ${storedRunResult.errorMessage}` : "",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __export, getLogger, TelemetryEnvironment, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, LlmSource, applyLlmSourceSelection, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl, local_exports } from './chunk-
|
|
1
|
+
import { __export, getLogger, TelemetryEnvironment, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, LlmSource, applyLlmSourceSelection, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl, local_exports } from './chunk-C4L5SKOX.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';
|
|
@@ -1255,7 +1255,7 @@ async function resolveGsScreenshotUrls(report, opts) {
|
|
|
1255
1255
|
if (gsUrls.length === 0) {
|
|
1256
1256
|
return report;
|
|
1257
1257
|
}
|
|
1258
|
-
const mcps = await import('./src-
|
|
1258
|
+
const mcps = await import('./src-Z5YREWY6.js');
|
|
1259
1259
|
const credentials = await mcps.getCallerCredentialsAsync();
|
|
1260
1260
|
if (!credentials.bearerToken && !credentials.apiKey) {
|
|
1261
1261
|
stderrWrite(
|
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-L4ZDHFEJ.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-C4L5SKOX.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.
|
|
4
|
+
"version": "5.34.0-staging.307",
|
|
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.
|
|
3
|
+
"version": "5.34.0-staging.307",
|
|
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.
|
|
5
|
+
"version": "5.34.0-staging.307",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -41,7 +41,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
|
|
|
41
41
|
| `PostToolUse` (Bash) | `guardrail-pr-terminal.sh` | advise | a PR just went terminal — a `gh pr merge`/`gh pr close` success line or the `TERMINAL pr=N` line the watch scripts print in a shell result (never bare `"state":"MERGED"` metadata). Not registered on `Monitor`: a Monitor call returns before its script prints anything, so its result never carries that line | — | record `terminalPending`, direct the post-merge handoff: finalize the watcher slot, tear down per `autoCleanup`, offer next options via AskUserQuestion — or as text in the closing message while the session still owns an open PR's watch slot, since a pending AskUserQuestion holds the turn and that watcher with it |
|
|
42
42
|
| `PostToolUse` (AskUserQuestion) | `guardrail-offer-ran.sh` | record | a next-options offer ran while a terminal PR was pending | — | clear `terminalPending` — the only exit for the post-merge Stop gate |
|
|
43
43
|
| `PostToolUse` (Agent, Task) | `guardrail-record-delegation.sh` | record | a `muggle:acceptance-tester` was launched into the background — its response carries no finished report yet | — | append to `e2eDelegations` with the PR URLs its brief names; for a bounded window the E2E and debug-path gates hold off, and the walkthrough gate sets those PRs aside, so the session is never steered into a second browser run alongside the agent's. Shares the AskUserQuestion group's dispatch |
|
|
44
|
-
| `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone, so the skill, its stages and the run land in one commit; a write that cannot take the session's lock in time is saved beside the state file and committed by a detached job once the lock frees | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
|
|
44
|
+
| `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone, so the skill, its stages and the run land in one commit; a write that cannot take the session's lock in time is saved beside the state file and committed by a detached job once the lock frees | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use. While `upgrade-available` holds an upgrade and `checkForUpdates` is not `never`, also tell the user to upgrade, once per invocation and never inside the upgrade skill itself. Starts the detached upkeep once its stamp comes due, so a long session's version lookup stays current |
|
|
45
45
|
| `PostToolUse` (Read) | `guardrail-record-stage-read.sh` | record | a markdown file under a `skills/` directory was opened | — | append to `stagesRead` — how the stage gate tells a stage that was read from one that was skipped; a route entry file in the plugin's skills tree, opened while a skill runs, also adds the `mandatoryStages` its frontmatter declares |
|
|
46
46
|
| `PostToolUse` (Bash + muggle telemetry-event-emit / user-feedback-create) | `guardrail-record-stage-signals.sh` | record | a Step 6f `pre-execution-classification` emit, debug-path evidence for a failed run (a `*-failure-classified\|resolved` emit or feedback naming it), or a `MUGGLE_STAGE_SKIP` / `MUGGLE_CLASSIFY_SKIP` / `MUGGLE_DEBUG_SKIP` marker | — | set `classifiedTestCaseIds` / `debuggedRuns` / the matching skip flag |
|
|
47
47
|
| `PostToolUse` (Bash) | `guardrail-record-comment-replies.sh` | record | an unresolved-thread fetch named review threads still awaiting an answer (classified by the `<!-- muggle-do:bot -->` marker, never the author login), a threaded reply the provider **confirmed** answered comments in one, or a `MUGGLE_REPLY_SKIP` marker deferred them | — | claim each thread and cover the comments answered, in the per-PR ledger beside the muggle-do slot |
|
|
@@ -20,23 +20,7 @@ if [ -f "$GUARDRAIL_STATE_FILE" ]; then
|
|
|
20
20
|
touch "$GUARDRAIL_STATE_FILE" 2>/dev/null || true
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
# window launches nothing. Without EPOCHSECONDS (bash before 5) it always
|
|
25
|
-
# launches and the upkeep's own markers decide. Every stream is redirected so the
|
|
26
|
-
# harness sees this hook finish without waiting on it, and it runs at the lowest
|
|
27
|
-
# priority so its npm and install work never starves the hooks of the turn it
|
|
28
|
-
# overlaps.
|
|
29
|
-
upkeep_priority=""
|
|
30
|
-
command -v nice >/dev/null 2>&1 && upkeep_priority="nice -n 19"
|
|
31
|
-
maintenance_due_at=0
|
|
32
|
-
maintenance_stamp="${HOME}/.cache/muggle/session-maintenance-due"
|
|
33
|
-
if [ -f "$maintenance_stamp" ]; then
|
|
34
|
-
read -r maintenance_due_at <"$maintenance_stamp" || true
|
|
35
|
-
fi
|
|
36
|
-
case "$maintenance_due_at" in ''|*[!0-9]*) maintenance_due_at=0 ;; esac
|
|
37
|
-
if [ -z "${EPOCHSECONDS:-}" ] || [ "$EPOCHSECONDS" -ge "$maintenance_due_at" ]; then
|
|
38
|
-
${upkeep_priority} bash "${hook_dir}/session-maintenance.sh" <<<"$GUARDRAIL_PAYLOAD" >/dev/null 2>&1 &
|
|
39
|
-
fi
|
|
23
|
+
guardrail_start_due_upkeep "$hook_dir"
|
|
40
24
|
|
|
41
25
|
escape_for_json() {
|
|
42
26
|
local s="$1"
|
|
@@ -50,9 +34,11 @@ escape_for_json() {
|
|
|
50
34
|
|
|
51
35
|
# --- Upgrade notice ---
|
|
52
36
|
# session-maintenance.sh leaves "installed|latest" here only while latest is newer.
|
|
37
|
+
# The preference is read here too, so turning the check off silences the notice at
|
|
38
|
+
# once rather than at the next upkeep.
|
|
53
39
|
upgrade_notice=""
|
|
54
40
|
upgrade_available="${HOME}/.cache/muggle/upgrade-available"
|
|
55
|
-
if [ -f "$upgrade_available" ]; then
|
|
41
|
+
if [ -f "$upgrade_available" ] && ! guardrail_updates_disabled; then
|
|
56
42
|
installed_version=""
|
|
57
43
|
latest_version=""
|
|
58
44
|
IFS='|' read -r installed_version latest_version <"$upgrade_available" || true
|
|
@@ -79,6 +79,37 @@ guardrail_resolve_home() {
|
|
|
79
79
|
fi
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
# Whether the user turned the update check off. Only their own file can: the shipped default is `always`.
|
|
83
|
+
guardrail_updates_disabled() {
|
|
84
|
+
guardrail_resolve_home
|
|
85
|
+
local preferences_file="$GUARDRAIL_HOME/.muggle-ai/preferences.json"
|
|
86
|
+
[[ -f $preferences_file ]] || return 1
|
|
87
|
+
local preferences=""
|
|
88
|
+
read -r -d '' preferences <"$preferences_file" || true
|
|
89
|
+
local disabled_pattern='"checkForUpdates"[[:space:]]*:[[:space:]]*"never"'
|
|
90
|
+
[[ $preferences =~ $disabled_pattern ]]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Starts session-maintenance.sh, found beside the calling hook in $1, once its stamp comes due. The upkeep stamps the
|
|
94
|
+
# epoch second it next comes due, so a call inside that window launches nothing. Without EPOCHSECONDS (bash before 5)
|
|
95
|
+
# it always launches and the upkeep's own markers decide. Every stream is redirected so the harness sees the hook
|
|
96
|
+
# finish without waiting on it, and it runs at the lowest priority so its npm and install work never starves the hooks
|
|
97
|
+
# of the turn it overlaps.
|
|
98
|
+
guardrail_start_due_upkeep() {
|
|
99
|
+
local hook_dir="$1"
|
|
100
|
+
local upkeep_priority=""
|
|
101
|
+
command -v nice >/dev/null 2>&1 && upkeep_priority="nice -n 19"
|
|
102
|
+
local maintenance_due_at=0
|
|
103
|
+
local maintenance_stamp="${HOME}/.cache/muggle/session-maintenance-due"
|
|
104
|
+
if [[ -f $maintenance_stamp ]]; then
|
|
105
|
+
read -r maintenance_due_at <"$maintenance_stamp" || true
|
|
106
|
+
fi
|
|
107
|
+
case "$maintenance_due_at" in '' | *[!0-9]*) maintenance_due_at=0 ;; esac
|
|
108
|
+
if [[ -z ${EPOCHSECONDS:-} ]] || ((EPOCHSECONDS >= maintenance_due_at)); then
|
|
109
|
+
${upkeep_priority} bash "${hook_dir}/session-maintenance.sh" <<<"$GUARDRAIL_PAYLOAD" >/dev/null 2>&1 &
|
|
110
|
+
fi
|
|
111
|
+
}
|
|
112
|
+
|
|
82
113
|
# Sets GUARDRAIL_STATE_FILE to this session's guardrail state file, named as sessionState.ts names it.
|
|
83
114
|
guardrail_resolve_state_file() {
|
|
84
115
|
local session_id_pattern='"session_id"[[:space:]]*:[[:space:]]*"([^"]*)"'
|
|
@@ -43,4 +43,9 @@ guardrail_wants() {
|
|
|
43
43
|
|
|
44
44
|
if guardrail_is_hook_script; then
|
|
45
45
|
guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
|
|
46
|
+
# A session open for days would otherwise never refresh the upgrade reminder's lookup. Session start owns the first
|
|
47
|
+
# run, so a home with no stamp waits for it, and bash before 5 has no clock to read the stamp against.
|
|
48
|
+
if [[ -n ${EPOCHSECONDS:-} && -f ${HOME}/.cache/muggle/session-maintenance-due ]]; then
|
|
49
|
+
guardrail_start_due_upkeep "$guardrail_script_dir"
|
|
50
|
+
fi
|
|
46
51
|
fi
|
|
@@ -111,6 +111,9 @@ var E2E_STOP_VERDICT_SUFFIX = ".e2e-stop-verdict";
|
|
|
111
111
|
var E2E_SHELL_BLOCKS_SUFFIX = ".e2e-shell-blocks";
|
|
112
112
|
var AUTO_E2E_TEST_PREFERENCE_KEY = "autoE2ETest";
|
|
113
113
|
var POST_PR_VISUAL_WALKTHROUGH_PREFERENCE_KEY = "postPRVisualWalkthrough";
|
|
114
|
+
var CHECK_FOR_UPDATES_PREFERENCE_KEY = "checkForUpdates";
|
|
115
|
+
var UPGRADE_AVAILABLE_PATH_SEGMENTS = [".cache", "muggle", "upgrade-available"];
|
|
116
|
+
var UPGRADE_SKILL_NAMES = ["muggle-upgrade", "mupgrade"];
|
|
114
117
|
var REWAKE_HOOK_EVENTS = ["Stop", "UserPromptSubmit"];
|
|
115
118
|
var REWAKE_SUBCOMMAND = "rewake";
|
|
116
119
|
var REWAKE_HOOK_SCRIPT = "guardrail-rewake.sh";
|
|
@@ -2063,6 +2066,63 @@ function lastAssistantText(transcriptJsonl) {
|
|
|
2063
2066
|
}
|
|
2064
2067
|
return "";
|
|
2065
2068
|
}
|
|
2069
|
+
function parseMaxCatchUpRebases(configuredValue) {
|
|
2070
|
+
if (configuredValue === UNBOUNDED_PREFERENCE_VALUE) return null;
|
|
2071
|
+
const spelled = typeof configuredValue === "number" ? String(configuredValue) : configuredValue;
|
|
2072
|
+
return typeof spelled === "string" && POSITIVE_INTEGER.test(spelled) ? Number(spelled) : void 0;
|
|
2073
|
+
}
|
|
2074
|
+
var readUserPreferences = (homeDir) => asRecord(readJsonRecord(join(homeDir, ...USER_PREFERENCES_PATH_SEGMENTS)).preferences);
|
|
2075
|
+
function readPreferenceLayers(homeDir, pluginRoot) {
|
|
2076
|
+
return [readUserPreferences(homeDir), readJsonRecord(join(pluginRoot, ...PREFERENCE_DEFAULTS_PATH_SEGMENTS))];
|
|
2077
|
+
}
|
|
2078
|
+
function pickPreferenceValue(preferenceLayers, preferenceKey) {
|
|
2079
|
+
const configuredValue = preferenceLayers.map((layer) => layer[preferenceKey]).find((layerValue) => layerValue != null);
|
|
2080
|
+
return typeof configuredValue === "string" ? configuredValue : void 0;
|
|
2081
|
+
}
|
|
2082
|
+
function resolvePreferenceValue(preferenceKey, homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2083
|
+
return pickPreferenceValue(readPreferenceLayers(homeDir, pluginRoot), preferenceKey);
|
|
2084
|
+
}
|
|
2085
|
+
function resolveUserPreferenceValue(preferenceKey, homeDir = homedir()) {
|
|
2086
|
+
return pickPreferenceValue([readUserPreferences(homeDir)], preferenceKey);
|
|
2087
|
+
}
|
|
2088
|
+
function resolveWatchPreferences(homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2089
|
+
const preferenceLayers = readPreferenceLayers(homeDir, pluginRoot);
|
|
2090
|
+
const [userPreferences, shippedDefaults] = preferenceLayers;
|
|
2091
|
+
const autoRebase = pickPreferenceValue(preferenceLayers, AUTO_REBASE_PREFERENCE_KEY);
|
|
2092
|
+
const userCap = parseMaxCatchUpRebases(userPreferences[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2093
|
+
const shippedCap = parseMaxCatchUpRebases(shippedDefaults[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2094
|
+
const lifetimeSecondsOf = (configuredValue) => typeof configuredValue === "string" ? WATCHER_LIFETIME_SECONDS[configuredValue] : void 0;
|
|
2095
|
+
return {
|
|
2096
|
+
autoRebase,
|
|
2097
|
+
maxCatchUpRebases: userCap !== void 0 ? userCap : shippedCap ?? null,
|
|
2098
|
+
watcherLifetimeSeconds: lifetimeSecondsOf(userPreferences[WATCHER_LIFETIME_PREFERENCE_KEY]) ?? lifetimeSecondsOf(shippedDefaults[WATCHER_LIFETIME_PREFERENCE_KEY])
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
// src/guardrails/upgradeReminder.ts
|
|
2103
|
+
function readAvailableUpgrade(homeDir = homedir()) {
|
|
2104
|
+
let recordedVersions;
|
|
2105
|
+
try {
|
|
2106
|
+
recordedVersions = readFileSync(join(homeDir, ...UPGRADE_AVAILABLE_PATH_SEGMENTS), "utf-8").trim();
|
|
2107
|
+
} catch {
|
|
2108
|
+
return void 0;
|
|
2109
|
+
}
|
|
2110
|
+
const [installedVersion, latestVersion, ...extraFields] = recordedVersions.split("|");
|
|
2111
|
+
if (!installedVersion || !latestVersion || extraFields.length > 0) return void 0;
|
|
2112
|
+
return { installedVersion, latestVersion };
|
|
2113
|
+
}
|
|
2114
|
+
function isUpgradeReminderDue(announcement) {
|
|
2115
|
+
if (UPGRADE_SKILL_NAMES.includes(announcement.skillName)) return false;
|
|
2116
|
+
const isTelemetryEmit = MUGGLE_SKILL_EMIT_TOOL.test(announcement.toolName ?? "");
|
|
2117
|
+
return !isTelemetryEmit || announcement.previousSkillName !== announcement.skillName;
|
|
2118
|
+
}
|
|
2119
|
+
function resolveUpgradeReminder(announcement, homeDir = homedir()) {
|
|
2120
|
+
if (!isUpgradeReminderDue(announcement)) return void 0;
|
|
2121
|
+
const availableUpgrade = readAvailableUpgrade(homeDir);
|
|
2122
|
+
if (!availableUpgrade) return void 0;
|
|
2123
|
+
if (resolvePreferenceValue(CHECK_FOR_UPDATES_PREFERENCE_KEY, homeDir) === UNBOUNDED_PREFERENCE_VALUE) return void 0;
|
|
2124
|
+
return `A newer @muggleai/works is available (${availableUpgrade.installedVersion} \u2192 ${availableUpgrade.latestVersion}). Tell the user to run \`/muggle:muggle-upgrade\` to update.`;
|
|
2125
|
+
}
|
|
2066
2126
|
|
|
2067
2127
|
// src/guardrails/testsGreen.ts
|
|
2068
2128
|
var FAIL = /\b\d+\s+failed\b|\bFAIL\b|✗/;
|
|
@@ -2137,38 +2197,6 @@ function buildE2eOwedReason(input2) {
|
|
|
2137
2197
|
}
|
|
2138
2198
|
return owedSentence + `Run change-driven E2E now via ${input2.muggleTestSkill}${walkthroughStep}, then finish. ${skipClause} Only when no verifiable code fits and a browser run genuinely cannot exercise the change, cite ${"NOT_APPLICABLE" /* NotApplicable */} with the reason \u2014 the PR shows it as your unverified judgment.`;
|
|
2139
2199
|
}
|
|
2140
|
-
function parseMaxCatchUpRebases(configuredValue) {
|
|
2141
|
-
if (configuredValue === UNBOUNDED_PREFERENCE_VALUE) return null;
|
|
2142
|
-
const spelled = typeof configuredValue === "number" ? String(configuredValue) : configuredValue;
|
|
2143
|
-
return typeof spelled === "string" && POSITIVE_INTEGER.test(spelled) ? Number(spelled) : void 0;
|
|
2144
|
-
}
|
|
2145
|
-
var readUserPreferences = (homeDir) => asRecord(readJsonRecord(join(homeDir, ...USER_PREFERENCES_PATH_SEGMENTS)).preferences);
|
|
2146
|
-
function readPreferenceLayers(homeDir, pluginRoot) {
|
|
2147
|
-
return [readUserPreferences(homeDir), readJsonRecord(join(pluginRoot, ...PREFERENCE_DEFAULTS_PATH_SEGMENTS))];
|
|
2148
|
-
}
|
|
2149
|
-
function pickPreferenceValue(preferenceLayers, preferenceKey) {
|
|
2150
|
-
const configuredValue = preferenceLayers.map((layer) => layer[preferenceKey]).find((layerValue) => layerValue != null);
|
|
2151
|
-
return typeof configuredValue === "string" ? configuredValue : void 0;
|
|
2152
|
-
}
|
|
2153
|
-
function resolvePreferenceValue(preferenceKey, homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2154
|
-
return pickPreferenceValue(readPreferenceLayers(homeDir, pluginRoot), preferenceKey);
|
|
2155
|
-
}
|
|
2156
|
-
function resolveUserPreferenceValue(preferenceKey, homeDir = homedir()) {
|
|
2157
|
-
return pickPreferenceValue([readUserPreferences(homeDir)], preferenceKey);
|
|
2158
|
-
}
|
|
2159
|
-
function resolveWatchPreferences(homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2160
|
-
const preferenceLayers = readPreferenceLayers(homeDir, pluginRoot);
|
|
2161
|
-
const [userPreferences, shippedDefaults] = preferenceLayers;
|
|
2162
|
-
const autoRebase = pickPreferenceValue(preferenceLayers, AUTO_REBASE_PREFERENCE_KEY);
|
|
2163
|
-
const userCap = parseMaxCatchUpRebases(userPreferences[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2164
|
-
const shippedCap = parseMaxCatchUpRebases(shippedDefaults[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2165
|
-
const lifetimeSecondsOf = (configuredValue) => typeof configuredValue === "string" ? WATCHER_LIFETIME_SECONDS[configuredValue] : void 0;
|
|
2166
|
-
return {
|
|
2167
|
-
autoRebase,
|
|
2168
|
-
maxCatchUpRebases: userCap !== void 0 ? userCap : shippedCap ?? null,
|
|
2169
|
-
watcherLifetimeSeconds: lifetimeSecondsOf(userPreferences[WATCHER_LIFETIME_PREFERENCE_KEY]) ?? lifetimeSecondsOf(shippedDefaults[WATCHER_LIFETIME_PREFERENCE_KEY])
|
|
2170
|
-
};
|
|
2171
|
-
}
|
|
2172
2200
|
|
|
2173
2201
|
// src/guardrails/finishedRun.ts
|
|
2174
2202
|
function detectFinishedRun(input2) {
|
|
@@ -3298,9 +3326,15 @@ function skillStages() {
|
|
|
3298
3326
|
});
|
|
3299
3327
|
startWalkthroughScanOnGateArming(stateBefore, next);
|
|
3300
3328
|
const unread = unreadMandatoryStages(next);
|
|
3301
|
-
|
|
3302
|
-
const
|
|
3303
|
-
|
|
3329
|
+
const stageContext = unread.length === 0 ? void 0 : `The ${skillName} skill declares required reading: ${unread.map(stageLabel).join(", ")}. Read those files now, before working through the skill's steps \u2014 they carry mandatory steps SKILL.md only links to, and treating them as optional elaboration is how those steps get silently dropped. A Stop gate holds the turn open until they are opened.`;
|
|
3330
|
+
const upgradeReminder = resolveUpgradeReminder({
|
|
3331
|
+
skillName,
|
|
3332
|
+
toolName: input.tool_name,
|
|
3333
|
+
previousSkillName: stateBefore.lastInvokedSkillName
|
|
3334
|
+
});
|
|
3335
|
+
const contextParts = [stageContext, upgradeReminder].filter((contextPart) => contextPart !== void 0);
|
|
3336
|
+
if (contextParts.length === 0) return "{}";
|
|
3337
|
+
return envelope("PostToolUse", contextParts.join("\n\n"), host);
|
|
3304
3338
|
}
|
|
3305
3339
|
function recordStageRead() {
|
|
3306
3340
|
const filePath = input.tool_input?.file_path;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
set -uo pipefail
|
|
4
4
|
|
|
5
|
-
# The slow
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# The slow upkeep, launched detached at most once a day so no hook waits on it: state
|
|
6
|
+
# GC, the Electron runner install and the npm version lookup. ensure-electron-app.sh
|
|
7
|
+
# launches it at session start and guardrail-skill-stages.sh on a skill call, so a
|
|
8
|
+
# session open for days still gets it. The due stamp and the install's marker are
|
|
9
|
+
# claimed before the work starts, so sessions opening together run it once rather
|
|
9
10
|
# than once each. The hook payload arrives on stdin and is handed on to gc-state.sh.
|
|
10
11
|
|
|
11
12
|
# Epoch mtime of a file, or 0 if unreadable. GNU coreutils (Linux/WSL/Git Bash)
|
|
@@ -22,7 +23,17 @@ file_mtime() {
|
|
|
22
23
|
printf '0\n'
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
#
|
|
26
|
+
# The dist-tag of the release lane a version sits on: a prerelease is staging, a plain
|
|
27
|
+
# release stable. Semver orders 5.15.0-staging.106 below 5.15.0, so a staging build
|
|
28
|
+
# measured against `latest` reads as out of date and a newer staging build goes unseen.
|
|
29
|
+
release_lane_tag() {
|
|
30
|
+
case "$1" in
|
|
31
|
+
*-*) printf 'staging\n' ;;
|
|
32
|
+
*) printf 'latest\n' ;;
|
|
33
|
+
esac
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Sourcing with MUGGLE_SESSION_MAINTENANCE_LIB_ONLY=1 exposes the helpers above
|
|
26
37
|
# without running the upkeep — used by the unit test.
|
|
27
38
|
if [ -n "${MUGGLE_SESSION_MAINTENANCE_LIB_ONLY:-}" ]; then
|
|
28
39
|
return 0 2>/dev/null || exit 0
|
|
@@ -30,11 +41,12 @@ fi
|
|
|
30
41
|
|
|
31
42
|
maintenance_dir="${BASH_SOURCE[0]%/*}"
|
|
32
43
|
[ "$maintenance_dir" = "${BASH_SOURCE[0]}" ] && maintenance_dir=.
|
|
44
|
+
. "${maintenance_dir}/guardrail-lib.sh"
|
|
33
45
|
cache_dir="${HOME}/.cache/muggle"
|
|
34
46
|
electron_marker="${cache_dir}/electron-app-checked"
|
|
35
47
|
electron_ttl=$((24 * 60 * 60))
|
|
36
48
|
version_cache="${cache_dir}/version-check"
|
|
37
|
-
version_ttl=$((
|
|
49
|
+
version_ttl=$((24 * 60 * 60))
|
|
38
50
|
upgrade_available="${cache_dir}/upgrade-available"
|
|
39
51
|
|
|
40
52
|
maintenance_stamp="${cache_dir}/session-maintenance-due"
|
|
@@ -70,18 +82,27 @@ if is_due "$electron_marker" "$electron_ttl"; then
|
|
|
70
82
|
fi
|
|
71
83
|
fi
|
|
72
84
|
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
if guardrail_updates_disabled; then
|
|
86
|
+
rm -f "$upgrade_available" 2>/dev/null || true
|
|
87
|
+
exit 0
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# The cache holds "installed|latest", latest being the head of the installed build's
|
|
91
|
+
# own lane. It is not claimed up front: a failed lookup leaves it due, so the next
|
|
92
|
+
# start retries rather than waiting out the TTL.
|
|
75
93
|
if is_due "$version_cache" "$version_ttl"; then
|
|
76
94
|
installed=$(muggle --version 2>/dev/null | tr -d '[:space:]' || true)
|
|
77
|
-
latest
|
|
95
|
+
latest=""
|
|
96
|
+
if [ -n "$installed" ]; then
|
|
97
|
+
latest=$(npm view @muggleai/works "dist-tags.$(release_lane_tag "$installed")" 2>/dev/null | tr -d '[:space:]' || true)
|
|
98
|
+
fi
|
|
78
99
|
if [ -n "$installed" ] && [ -n "$latest" ]; then
|
|
79
100
|
printf '%s|%s' "$installed" "$latest" > "$version_cache" 2>/dev/null || true
|
|
80
101
|
fi
|
|
81
102
|
fi
|
|
82
103
|
|
|
83
|
-
#
|
|
84
|
-
#
|
|
104
|
+
# The hooks announce an upgrade only while this file exists, so the version comparison
|
|
105
|
+
# (sort -V) never runs on a hook's own path.
|
|
85
106
|
cached_versions=$(cat "$version_cache" 2>/dev/null || true)
|
|
86
107
|
installed="${cached_versions%%|*}"
|
|
87
108
|
latest="${cached_versions##*|}"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# `checkForUpdates`
|
|
2
2
|
|
|
3
|
-
Check npm for a newer Muggle Test version at session start.
|
|
3
|
+
Check npm daily for a newer Muggle Test version on the installed release lane, and remind at session start and on every skill call. `never` stops the check and the reminders; `ask` still reminds, since a reminder asks nothing.
|
|
4
4
|
|
|
5
5
|
**Picker 1** — header `Update check`, question `"Check for a newer Muggle Test version (one quick network call)?"`
|
|
6
6
|
- `Check now` — `Flags if you're behind.` → `always`
|
|
7
|
-
- `Skip check` — `
|
|
7
|
+
- `Skip check` — `No version check, no upgrade reminders.` → `never`
|
|
8
8
|
|
|
9
9
|
**Silent action**
|
|
10
10
|
- `always` → `Checked for updates`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release": "5.
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
5
|
-
"buildTime": "2026-11-
|
|
2
|
+
"release": "5.34.0-staging.307",
|
|
3
|
+
"buildId": "run-307-1",
|
|
4
|
+
"commitSha": "d5845b0cff2fbe9807cd46208653a5d37313153a",
|
|
5
|
+
"buildTime": "2026-11-05T18:49:15Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CLAUDE_CODE_AUTH_STATUS_ARGS, CLAUDE_CODE_CHECK_TIMEOUT_MS, CLAUDE_CODE_EXECUTABLE, CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE, CLAUDE_CODE_SESSION_LINK_ENV_VARS, CLAUDE_CODE_VERSION_ARGS, CheckoutFreshnessVerdict, ClaudeCodeReadiness, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ELECTRON_APP_RESOURCES_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, MAX_LISTED_INHERITED_COMMITS, 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, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackLeaseEndReason, StackMismatchKind, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, compareQueuePlaces, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackReap, decideStackRelease, decideStackRunEnd, decideStackRunStart, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports as e2e, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports as localQa, lookUpCheckoutPullRequest, markOnboardingCompleted, maskLlmApiKey, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reapServiceStack, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveElectronAppResourcesDir, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-
|
|
1
|
+
export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CLAUDE_CODE_AUTH_STATUS_ARGS, CLAUDE_CODE_CHECK_TIMEOUT_MS, CLAUDE_CODE_EXECUTABLE, CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE, CLAUDE_CODE_SESSION_LINK_ENV_VARS, CLAUDE_CODE_VERSION_ARGS, CheckoutFreshnessVerdict, ClaudeCodeReadiness, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ELECTRON_APP_RESOURCES_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, MAX_LISTED_INHERITED_COMMITS, 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, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackLeaseEndReason, StackMismatchKind, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, compareQueuePlaces, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackReap, decideStackRelease, decideStackRunEnd, decideStackRunStart, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports as e2e, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports as localQa, lookUpCheckoutPullRequest, markOnboardingCompleted, maskLlmApiKey, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reapServiceStack, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveElectronAppResourcesDir, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-C4L5SKOX.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.
|
|
4
|
+
"version": "5.34.0-staging.307",
|
|
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",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"scripts/claude-marketplace-sync.mjs",
|
|
19
19
|
"scripts/electron-app-install-dir.mjs",
|
|
20
20
|
"scripts/onboarding-backfill.mjs",
|
|
21
|
+
"scripts/upgrade-notice-cache.mjs",
|
|
21
22
|
"scripts/running-studio-installs.mjs",
|
|
22
23
|
"scripts/release-integrity",
|
|
23
24
|
"scripts/muggle-watch",
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
"muggleConfig": {
|
|
66
67
|
"electronAppVersion": "1.24.6",
|
|
67
68
|
"downloadBaseUrl": "https://github.com/multiplex-ai/muggle-ai-works/releases/download",
|
|
68
|
-
"runtimeTargetDefault": "
|
|
69
|
+
"runtimeTargetDefault": "staging",
|
|
69
70
|
"checksumsByStream": {
|
|
70
71
|
"production": {
|
|
71
72
|
"win32-x64": "16d6eceb3ff2030776ac0b10bc510347849f3d264388d4215535ee11895e1247",
|
|
@@ -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.
|
|
4
|
+
"version": "5.34.0-staging.307",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
package/plugin/.codex-mcp.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.34.0-staging.307",
|
|
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.
|
|
5
|
+
"version": "5.34.0-staging.307",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
package/plugin/hooks/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
|
|
|
41
41
|
| `PostToolUse` (Bash) | `guardrail-pr-terminal.sh` | advise | a PR just went terminal — a `gh pr merge`/`gh pr close` success line or the `TERMINAL pr=N` line the watch scripts print in a shell result (never bare `"state":"MERGED"` metadata). Not registered on `Monitor`: a Monitor call returns before its script prints anything, so its result never carries that line | — | record `terminalPending`, direct the post-merge handoff: finalize the watcher slot, tear down per `autoCleanup`, offer next options via AskUserQuestion — or as text in the closing message while the session still owns an open PR's watch slot, since a pending AskUserQuestion holds the turn and that watcher with it |
|
|
42
42
|
| `PostToolUse` (AskUserQuestion) | `guardrail-offer-ran.sh` | record | a next-options offer ran while a terminal PR was pending | — | clear `terminalPending` — the only exit for the post-merge Stop gate |
|
|
43
43
|
| `PostToolUse` (Agent, Task) | `guardrail-record-delegation.sh` | record | a `muggle:acceptance-tester` was launched into the background — its response carries no finished report yet | — | append to `e2eDelegations` with the PR URLs its brief names; for a bounded window the E2E and debug-path gates hold off, and the walkthrough gate sets those PRs aside, so the session is never steered into a second browser run alongside the agent's. Shares the AskUserQuestion group's dispatch |
|
|
44
|
-
| `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone, so the skill, its stages and the run land in one commit; a write that cannot take the session's lock in time is saved beside the state file and committed by a detached job once the lock frees | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use |
|
|
44
|
+
| `PostToolUse` (Skill + muggle telemetry-skill-emit) | `guardrail-skill-stages.sh` | advise | a skill this plugin ships was invoked; its `SKILL.md` frontmatter may declare `mandatoryStages`. Registered on the skill's own MCP announcement too, so the declaration still lands if the Skill payload ever stops carrying a name. A muggle-test announcement is also an E2E run (the clean SKIP verdict), recorded here alone, so the skill, its stages and the run land in one commit; a write that cannot take the session's lock in time is saved beside the state file and committed by a detached job once the lock frees | — | record `lastInvokedSkillName` + `mandatoryStages` (and `e2eRun` for a muggle-test announcement), and name the declared files as required reading at the moment of use. While `upgrade-available` holds an upgrade and `checkForUpdates` is not `never`, also tell the user to upgrade, once per invocation and never inside the upgrade skill itself. Starts the detached upkeep once its stamp comes due, so a long session's version lookup stays current |
|
|
45
45
|
| `PostToolUse` (Read) | `guardrail-record-stage-read.sh` | record | a markdown file under a `skills/` directory was opened | — | append to `stagesRead` — how the stage gate tells a stage that was read from one that was skipped; a route entry file in the plugin's skills tree, opened while a skill runs, also adds the `mandatoryStages` its frontmatter declares |
|
|
46
46
|
| `PostToolUse` (Bash + muggle telemetry-event-emit / user-feedback-create) | `guardrail-record-stage-signals.sh` | record | a Step 6f `pre-execution-classification` emit, debug-path evidence for a failed run (a `*-failure-classified\|resolved` emit or feedback naming it), or a `MUGGLE_STAGE_SKIP` / `MUGGLE_CLASSIFY_SKIP` / `MUGGLE_DEBUG_SKIP` marker | — | set `classifiedTestCaseIds` / `debuggedRuns` / the matching skip flag |
|
|
47
47
|
| `PostToolUse` (Bash) | `guardrail-record-comment-replies.sh` | record | an unresolved-thread fetch named review threads still awaiting an answer (classified by the `<!-- muggle-do:bot -->` marker, never the author login), a threaded reply the provider **confirmed** answered comments in one, or a `MUGGLE_REPLY_SKIP` marker deferred them | — | claim each thread and cover the comments answered, in the per-PR ledger beside the muggle-do slot |
|
|
@@ -20,23 +20,7 @@ if [ -f "$GUARDRAIL_STATE_FILE" ]; then
|
|
|
20
20
|
touch "$GUARDRAIL_STATE_FILE" 2>/dev/null || true
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
# window launches nothing. Without EPOCHSECONDS (bash before 5) it always
|
|
25
|
-
# launches and the upkeep's own markers decide. Every stream is redirected so the
|
|
26
|
-
# harness sees this hook finish without waiting on it, and it runs at the lowest
|
|
27
|
-
# priority so its npm and install work never starves the hooks of the turn it
|
|
28
|
-
# overlaps.
|
|
29
|
-
upkeep_priority=""
|
|
30
|
-
command -v nice >/dev/null 2>&1 && upkeep_priority="nice -n 19"
|
|
31
|
-
maintenance_due_at=0
|
|
32
|
-
maintenance_stamp="${HOME}/.cache/muggle/session-maintenance-due"
|
|
33
|
-
if [ -f "$maintenance_stamp" ]; then
|
|
34
|
-
read -r maintenance_due_at <"$maintenance_stamp" || true
|
|
35
|
-
fi
|
|
36
|
-
case "$maintenance_due_at" in ''|*[!0-9]*) maintenance_due_at=0 ;; esac
|
|
37
|
-
if [ -z "${EPOCHSECONDS:-}" ] || [ "$EPOCHSECONDS" -ge "$maintenance_due_at" ]; then
|
|
38
|
-
${upkeep_priority} bash "${hook_dir}/session-maintenance.sh" <<<"$GUARDRAIL_PAYLOAD" >/dev/null 2>&1 &
|
|
39
|
-
fi
|
|
23
|
+
guardrail_start_due_upkeep "$hook_dir"
|
|
40
24
|
|
|
41
25
|
escape_for_json() {
|
|
42
26
|
local s="$1"
|
|
@@ -50,9 +34,11 @@ escape_for_json() {
|
|
|
50
34
|
|
|
51
35
|
# --- Upgrade notice ---
|
|
52
36
|
# session-maintenance.sh leaves "installed|latest" here only while latest is newer.
|
|
37
|
+
# The preference is read here too, so turning the check off silences the notice at
|
|
38
|
+
# once rather than at the next upkeep.
|
|
53
39
|
upgrade_notice=""
|
|
54
40
|
upgrade_available="${HOME}/.cache/muggle/upgrade-available"
|
|
55
|
-
if [ -f "$upgrade_available" ]; then
|
|
41
|
+
if [ -f "$upgrade_available" ] && ! guardrail_updates_disabled; then
|
|
56
42
|
installed_version=""
|
|
57
43
|
latest_version=""
|
|
58
44
|
IFS='|' read -r installed_version latest_version <"$upgrade_available" || true
|
|
@@ -79,6 +79,37 @@ guardrail_resolve_home() {
|
|
|
79
79
|
fi
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
# Whether the user turned the update check off. Only their own file can: the shipped default is `always`.
|
|
83
|
+
guardrail_updates_disabled() {
|
|
84
|
+
guardrail_resolve_home
|
|
85
|
+
local preferences_file="$GUARDRAIL_HOME/.muggle-ai/preferences.json"
|
|
86
|
+
[[ -f $preferences_file ]] || return 1
|
|
87
|
+
local preferences=""
|
|
88
|
+
read -r -d '' preferences <"$preferences_file" || true
|
|
89
|
+
local disabled_pattern='"checkForUpdates"[[:space:]]*:[[:space:]]*"never"'
|
|
90
|
+
[[ $preferences =~ $disabled_pattern ]]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Starts session-maintenance.sh, found beside the calling hook in $1, once its stamp comes due. The upkeep stamps the
|
|
94
|
+
# epoch second it next comes due, so a call inside that window launches nothing. Without EPOCHSECONDS (bash before 5)
|
|
95
|
+
# it always launches and the upkeep's own markers decide. Every stream is redirected so the harness sees the hook
|
|
96
|
+
# finish without waiting on it, and it runs at the lowest priority so its npm and install work never starves the hooks
|
|
97
|
+
# of the turn it overlaps.
|
|
98
|
+
guardrail_start_due_upkeep() {
|
|
99
|
+
local hook_dir="$1"
|
|
100
|
+
local upkeep_priority=""
|
|
101
|
+
command -v nice >/dev/null 2>&1 && upkeep_priority="nice -n 19"
|
|
102
|
+
local maintenance_due_at=0
|
|
103
|
+
local maintenance_stamp="${HOME}/.cache/muggle/session-maintenance-due"
|
|
104
|
+
if [[ -f $maintenance_stamp ]]; then
|
|
105
|
+
read -r maintenance_due_at <"$maintenance_stamp" || true
|
|
106
|
+
fi
|
|
107
|
+
case "$maintenance_due_at" in '' | *[!0-9]*) maintenance_due_at=0 ;; esac
|
|
108
|
+
if [[ -z ${EPOCHSECONDS:-} ]] || ((EPOCHSECONDS >= maintenance_due_at)); then
|
|
109
|
+
${upkeep_priority} bash "${hook_dir}/session-maintenance.sh" <<<"$GUARDRAIL_PAYLOAD" >/dev/null 2>&1 &
|
|
110
|
+
fi
|
|
111
|
+
}
|
|
112
|
+
|
|
82
113
|
# Sets GUARDRAIL_STATE_FILE to this session's guardrail state file, named as sessionState.ts names it.
|
|
83
114
|
guardrail_resolve_state_file() {
|
|
84
115
|
local session_id_pattern='"session_id"[[:space:]]*:[[:space:]]*"([^"]*)"'
|
|
@@ -43,4 +43,9 @@ guardrail_wants() {
|
|
|
43
43
|
|
|
44
44
|
if guardrail_is_hook_script; then
|
|
45
45
|
guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
|
|
46
|
+
# A session open for days would otherwise never refresh the upgrade reminder's lookup. Session start owns the first
|
|
47
|
+
# run, so a home with no stamp waits for it, and bash before 5 has no clock to read the stamp against.
|
|
48
|
+
if [[ -n ${EPOCHSECONDS:-} && -f ${HOME}/.cache/muggle/session-maintenance-due ]]; then
|
|
49
|
+
guardrail_start_due_upkeep "$guardrail_script_dir"
|
|
50
|
+
fi
|
|
46
51
|
fi
|
|
@@ -111,6 +111,9 @@ var E2E_STOP_VERDICT_SUFFIX = ".e2e-stop-verdict";
|
|
|
111
111
|
var E2E_SHELL_BLOCKS_SUFFIX = ".e2e-shell-blocks";
|
|
112
112
|
var AUTO_E2E_TEST_PREFERENCE_KEY = "autoE2ETest";
|
|
113
113
|
var POST_PR_VISUAL_WALKTHROUGH_PREFERENCE_KEY = "postPRVisualWalkthrough";
|
|
114
|
+
var CHECK_FOR_UPDATES_PREFERENCE_KEY = "checkForUpdates";
|
|
115
|
+
var UPGRADE_AVAILABLE_PATH_SEGMENTS = [".cache", "muggle", "upgrade-available"];
|
|
116
|
+
var UPGRADE_SKILL_NAMES = ["muggle-upgrade", "mupgrade"];
|
|
114
117
|
var REWAKE_HOOK_EVENTS = ["Stop", "UserPromptSubmit"];
|
|
115
118
|
var REWAKE_SUBCOMMAND = "rewake";
|
|
116
119
|
var REWAKE_HOOK_SCRIPT = "guardrail-rewake.sh";
|
|
@@ -2063,6 +2066,63 @@ function lastAssistantText(transcriptJsonl) {
|
|
|
2063
2066
|
}
|
|
2064
2067
|
return "";
|
|
2065
2068
|
}
|
|
2069
|
+
function parseMaxCatchUpRebases(configuredValue) {
|
|
2070
|
+
if (configuredValue === UNBOUNDED_PREFERENCE_VALUE) return null;
|
|
2071
|
+
const spelled = typeof configuredValue === "number" ? String(configuredValue) : configuredValue;
|
|
2072
|
+
return typeof spelled === "string" && POSITIVE_INTEGER.test(spelled) ? Number(spelled) : void 0;
|
|
2073
|
+
}
|
|
2074
|
+
var readUserPreferences = (homeDir) => asRecord(readJsonRecord(join(homeDir, ...USER_PREFERENCES_PATH_SEGMENTS)).preferences);
|
|
2075
|
+
function readPreferenceLayers(homeDir, pluginRoot) {
|
|
2076
|
+
return [readUserPreferences(homeDir), readJsonRecord(join(pluginRoot, ...PREFERENCE_DEFAULTS_PATH_SEGMENTS))];
|
|
2077
|
+
}
|
|
2078
|
+
function pickPreferenceValue(preferenceLayers, preferenceKey) {
|
|
2079
|
+
const configuredValue = preferenceLayers.map((layer) => layer[preferenceKey]).find((layerValue) => layerValue != null);
|
|
2080
|
+
return typeof configuredValue === "string" ? configuredValue : void 0;
|
|
2081
|
+
}
|
|
2082
|
+
function resolvePreferenceValue(preferenceKey, homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2083
|
+
return pickPreferenceValue(readPreferenceLayers(homeDir, pluginRoot), preferenceKey);
|
|
2084
|
+
}
|
|
2085
|
+
function resolveUserPreferenceValue(preferenceKey, homeDir = homedir()) {
|
|
2086
|
+
return pickPreferenceValue([readUserPreferences(homeDir)], preferenceKey);
|
|
2087
|
+
}
|
|
2088
|
+
function resolveWatchPreferences(homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2089
|
+
const preferenceLayers = readPreferenceLayers(homeDir, pluginRoot);
|
|
2090
|
+
const [userPreferences, shippedDefaults] = preferenceLayers;
|
|
2091
|
+
const autoRebase = pickPreferenceValue(preferenceLayers, AUTO_REBASE_PREFERENCE_KEY);
|
|
2092
|
+
const userCap = parseMaxCatchUpRebases(userPreferences[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2093
|
+
const shippedCap = parseMaxCatchUpRebases(shippedDefaults[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2094
|
+
const lifetimeSecondsOf = (configuredValue) => typeof configuredValue === "string" ? WATCHER_LIFETIME_SECONDS[configuredValue] : void 0;
|
|
2095
|
+
return {
|
|
2096
|
+
autoRebase,
|
|
2097
|
+
maxCatchUpRebases: userCap !== void 0 ? userCap : shippedCap ?? null,
|
|
2098
|
+
watcherLifetimeSeconds: lifetimeSecondsOf(userPreferences[WATCHER_LIFETIME_PREFERENCE_KEY]) ?? lifetimeSecondsOf(shippedDefaults[WATCHER_LIFETIME_PREFERENCE_KEY])
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
// src/guardrails/upgradeReminder.ts
|
|
2103
|
+
function readAvailableUpgrade(homeDir = homedir()) {
|
|
2104
|
+
let recordedVersions;
|
|
2105
|
+
try {
|
|
2106
|
+
recordedVersions = readFileSync(join(homeDir, ...UPGRADE_AVAILABLE_PATH_SEGMENTS), "utf-8").trim();
|
|
2107
|
+
} catch {
|
|
2108
|
+
return void 0;
|
|
2109
|
+
}
|
|
2110
|
+
const [installedVersion, latestVersion, ...extraFields] = recordedVersions.split("|");
|
|
2111
|
+
if (!installedVersion || !latestVersion || extraFields.length > 0) return void 0;
|
|
2112
|
+
return { installedVersion, latestVersion };
|
|
2113
|
+
}
|
|
2114
|
+
function isUpgradeReminderDue(announcement) {
|
|
2115
|
+
if (UPGRADE_SKILL_NAMES.includes(announcement.skillName)) return false;
|
|
2116
|
+
const isTelemetryEmit = MUGGLE_SKILL_EMIT_TOOL.test(announcement.toolName ?? "");
|
|
2117
|
+
return !isTelemetryEmit || announcement.previousSkillName !== announcement.skillName;
|
|
2118
|
+
}
|
|
2119
|
+
function resolveUpgradeReminder(announcement, homeDir = homedir()) {
|
|
2120
|
+
if (!isUpgradeReminderDue(announcement)) return void 0;
|
|
2121
|
+
const availableUpgrade = readAvailableUpgrade(homeDir);
|
|
2122
|
+
if (!availableUpgrade) return void 0;
|
|
2123
|
+
if (resolvePreferenceValue(CHECK_FOR_UPDATES_PREFERENCE_KEY, homeDir) === UNBOUNDED_PREFERENCE_VALUE) return void 0;
|
|
2124
|
+
return `A newer @muggleai/works is available (${availableUpgrade.installedVersion} \u2192 ${availableUpgrade.latestVersion}). Tell the user to run \`/muggle:muggle-upgrade\` to update.`;
|
|
2125
|
+
}
|
|
2066
2126
|
|
|
2067
2127
|
// src/guardrails/testsGreen.ts
|
|
2068
2128
|
var FAIL = /\b\d+\s+failed\b|\bFAIL\b|✗/;
|
|
@@ -2137,38 +2197,6 @@ function buildE2eOwedReason(input2) {
|
|
|
2137
2197
|
}
|
|
2138
2198
|
return owedSentence + `Run change-driven E2E now via ${input2.muggleTestSkill}${walkthroughStep}, then finish. ${skipClause} Only when no verifiable code fits and a browser run genuinely cannot exercise the change, cite ${"NOT_APPLICABLE" /* NotApplicable */} with the reason \u2014 the PR shows it as your unverified judgment.`;
|
|
2139
2199
|
}
|
|
2140
|
-
function parseMaxCatchUpRebases(configuredValue) {
|
|
2141
|
-
if (configuredValue === UNBOUNDED_PREFERENCE_VALUE) return null;
|
|
2142
|
-
const spelled = typeof configuredValue === "number" ? String(configuredValue) : configuredValue;
|
|
2143
|
-
return typeof spelled === "string" && POSITIVE_INTEGER.test(spelled) ? Number(spelled) : void 0;
|
|
2144
|
-
}
|
|
2145
|
-
var readUserPreferences = (homeDir) => asRecord(readJsonRecord(join(homeDir, ...USER_PREFERENCES_PATH_SEGMENTS)).preferences);
|
|
2146
|
-
function readPreferenceLayers(homeDir, pluginRoot) {
|
|
2147
|
-
return [readUserPreferences(homeDir), readJsonRecord(join(pluginRoot, ...PREFERENCE_DEFAULTS_PATH_SEGMENTS))];
|
|
2148
|
-
}
|
|
2149
|
-
function pickPreferenceValue(preferenceLayers, preferenceKey) {
|
|
2150
|
-
const configuredValue = preferenceLayers.map((layer) => layer[preferenceKey]).find((layerValue) => layerValue != null);
|
|
2151
|
-
return typeof configuredValue === "string" ? configuredValue : void 0;
|
|
2152
|
-
}
|
|
2153
|
-
function resolvePreferenceValue(preferenceKey, homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2154
|
-
return pickPreferenceValue(readPreferenceLayers(homeDir, pluginRoot), preferenceKey);
|
|
2155
|
-
}
|
|
2156
|
-
function resolveUserPreferenceValue(preferenceKey, homeDir = homedir()) {
|
|
2157
|
-
return pickPreferenceValue([readUserPreferences(homeDir)], preferenceKey);
|
|
2158
|
-
}
|
|
2159
|
-
function resolveWatchPreferences(homeDir = homedir(), pluginRoot = resolvePluginRoot()) {
|
|
2160
|
-
const preferenceLayers = readPreferenceLayers(homeDir, pluginRoot);
|
|
2161
|
-
const [userPreferences, shippedDefaults] = preferenceLayers;
|
|
2162
|
-
const autoRebase = pickPreferenceValue(preferenceLayers, AUTO_REBASE_PREFERENCE_KEY);
|
|
2163
|
-
const userCap = parseMaxCatchUpRebases(userPreferences[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2164
|
-
const shippedCap = parseMaxCatchUpRebases(shippedDefaults[MAX_CATCH_UP_REBASES_PREFERENCE_KEY]);
|
|
2165
|
-
const lifetimeSecondsOf = (configuredValue) => typeof configuredValue === "string" ? WATCHER_LIFETIME_SECONDS[configuredValue] : void 0;
|
|
2166
|
-
return {
|
|
2167
|
-
autoRebase,
|
|
2168
|
-
maxCatchUpRebases: userCap !== void 0 ? userCap : shippedCap ?? null,
|
|
2169
|
-
watcherLifetimeSeconds: lifetimeSecondsOf(userPreferences[WATCHER_LIFETIME_PREFERENCE_KEY]) ?? lifetimeSecondsOf(shippedDefaults[WATCHER_LIFETIME_PREFERENCE_KEY])
|
|
2170
|
-
};
|
|
2171
|
-
}
|
|
2172
2200
|
|
|
2173
2201
|
// src/guardrails/finishedRun.ts
|
|
2174
2202
|
function detectFinishedRun(input2) {
|
|
@@ -3298,9 +3326,15 @@ function skillStages() {
|
|
|
3298
3326
|
});
|
|
3299
3327
|
startWalkthroughScanOnGateArming(stateBefore, next);
|
|
3300
3328
|
const unread = unreadMandatoryStages(next);
|
|
3301
|
-
|
|
3302
|
-
const
|
|
3303
|
-
|
|
3329
|
+
const stageContext = unread.length === 0 ? void 0 : `The ${skillName} skill declares required reading: ${unread.map(stageLabel).join(", ")}. Read those files now, before working through the skill's steps \u2014 they carry mandatory steps SKILL.md only links to, and treating them as optional elaboration is how those steps get silently dropped. A Stop gate holds the turn open until they are opened.`;
|
|
3330
|
+
const upgradeReminder = resolveUpgradeReminder({
|
|
3331
|
+
skillName,
|
|
3332
|
+
toolName: input.tool_name,
|
|
3333
|
+
previousSkillName: stateBefore.lastInvokedSkillName
|
|
3334
|
+
});
|
|
3335
|
+
const contextParts = [stageContext, upgradeReminder].filter((contextPart) => contextPart !== void 0);
|
|
3336
|
+
if (contextParts.length === 0) return "{}";
|
|
3337
|
+
return envelope("PostToolUse", contextParts.join("\n\n"), host);
|
|
3304
3338
|
}
|
|
3305
3339
|
function recordStageRead() {
|
|
3306
3340
|
const filePath = input.tool_input?.file_path;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
set -uo pipefail
|
|
4
4
|
|
|
5
|
-
# The slow
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# The slow upkeep, launched detached at most once a day so no hook waits on it: state
|
|
6
|
+
# GC, the Electron runner install and the npm version lookup. ensure-electron-app.sh
|
|
7
|
+
# launches it at session start and guardrail-skill-stages.sh on a skill call, so a
|
|
8
|
+
# session open for days still gets it. The due stamp and the install's marker are
|
|
9
|
+
# claimed before the work starts, so sessions opening together run it once rather
|
|
9
10
|
# than once each. The hook payload arrives on stdin and is handed on to gc-state.sh.
|
|
10
11
|
|
|
11
12
|
# Epoch mtime of a file, or 0 if unreadable. GNU coreutils (Linux/WSL/Git Bash)
|
|
@@ -22,7 +23,17 @@ file_mtime() {
|
|
|
22
23
|
printf '0\n'
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
#
|
|
26
|
+
# The dist-tag of the release lane a version sits on: a prerelease is staging, a plain
|
|
27
|
+
# release stable. Semver orders 5.15.0-staging.106 below 5.15.0, so a staging build
|
|
28
|
+
# measured against `latest` reads as out of date and a newer staging build goes unseen.
|
|
29
|
+
release_lane_tag() {
|
|
30
|
+
case "$1" in
|
|
31
|
+
*-*) printf 'staging\n' ;;
|
|
32
|
+
*) printf 'latest\n' ;;
|
|
33
|
+
esac
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Sourcing with MUGGLE_SESSION_MAINTENANCE_LIB_ONLY=1 exposes the helpers above
|
|
26
37
|
# without running the upkeep — used by the unit test.
|
|
27
38
|
if [ -n "${MUGGLE_SESSION_MAINTENANCE_LIB_ONLY:-}" ]; then
|
|
28
39
|
return 0 2>/dev/null || exit 0
|
|
@@ -30,11 +41,12 @@ fi
|
|
|
30
41
|
|
|
31
42
|
maintenance_dir="${BASH_SOURCE[0]%/*}"
|
|
32
43
|
[ "$maintenance_dir" = "${BASH_SOURCE[0]}" ] && maintenance_dir=.
|
|
44
|
+
. "${maintenance_dir}/guardrail-lib.sh"
|
|
33
45
|
cache_dir="${HOME}/.cache/muggle"
|
|
34
46
|
electron_marker="${cache_dir}/electron-app-checked"
|
|
35
47
|
electron_ttl=$((24 * 60 * 60))
|
|
36
48
|
version_cache="${cache_dir}/version-check"
|
|
37
|
-
version_ttl=$((
|
|
49
|
+
version_ttl=$((24 * 60 * 60))
|
|
38
50
|
upgrade_available="${cache_dir}/upgrade-available"
|
|
39
51
|
|
|
40
52
|
maintenance_stamp="${cache_dir}/session-maintenance-due"
|
|
@@ -70,18 +82,27 @@ if is_due "$electron_marker" "$electron_ttl"; then
|
|
|
70
82
|
fi
|
|
71
83
|
fi
|
|
72
84
|
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
if guardrail_updates_disabled; then
|
|
86
|
+
rm -f "$upgrade_available" 2>/dev/null || true
|
|
87
|
+
exit 0
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# The cache holds "installed|latest", latest being the head of the installed build's
|
|
91
|
+
# own lane. It is not claimed up front: a failed lookup leaves it due, so the next
|
|
92
|
+
# start retries rather than waiting out the TTL.
|
|
75
93
|
if is_due "$version_cache" "$version_ttl"; then
|
|
76
94
|
installed=$(muggle --version 2>/dev/null | tr -d '[:space:]' || true)
|
|
77
|
-
latest
|
|
95
|
+
latest=""
|
|
96
|
+
if [ -n "$installed" ]; then
|
|
97
|
+
latest=$(npm view @muggleai/works "dist-tags.$(release_lane_tag "$installed")" 2>/dev/null | tr -d '[:space:]' || true)
|
|
98
|
+
fi
|
|
78
99
|
if [ -n "$installed" ] && [ -n "$latest" ]; then
|
|
79
100
|
printf '%s|%s' "$installed" "$latest" > "$version_cache" 2>/dev/null || true
|
|
80
101
|
fi
|
|
81
102
|
fi
|
|
82
103
|
|
|
83
|
-
#
|
|
84
|
-
#
|
|
104
|
+
# The hooks announce an upgrade only while this file exists, so the version comparison
|
|
105
|
+
# (sort -V) never runs on a hook's own path.
|
|
85
106
|
cached_versions=$(cat "$version_cache" 2>/dev/null || true)
|
|
86
107
|
installed="${cached_versions%%|*}"
|
|
87
108
|
latest="${cached_versions##*|}"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# `checkForUpdates`
|
|
2
2
|
|
|
3
|
-
Check npm for a newer Muggle Test version at session start.
|
|
3
|
+
Check npm daily for a newer Muggle Test version on the installed release lane, and remind at session start and on every skill call. `never` stops the check and the reminders; `ask` still reminds, since a reminder asks nothing.
|
|
4
4
|
|
|
5
5
|
**Picker 1** — header `Update check`, question `"Check for a newer Muggle Test version (one quick network call)?"`
|
|
6
6
|
- `Check now` — `Flags if you're behind.` → `always`
|
|
7
|
-
- `Skip check` — `
|
|
7
|
+
- `Skip check` — `No version check, no upgrade reminders.` → `never`
|
|
8
8
|
|
|
9
9
|
**Silent action**
|
|
10
10
|
- `always` → `Checked for updates`
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
shouldKeepVersionOverride,
|
|
33
33
|
} from "./electron-app-install-dir.mjs";
|
|
34
34
|
import { backfillOnboardingStamp } from "./onboarding-backfill.mjs";
|
|
35
|
+
import { clearUpgradeNoticeCache } from "./upgrade-notice-cache.mjs";
|
|
35
36
|
import { listRunningInstallDirectoryNames, normalizeInstallDirectoryName } from "./running-studio-installs.mjs";
|
|
36
37
|
import {
|
|
37
38
|
SIGNATURE_BUNDLE_SUFFIX,
|
|
@@ -1050,6 +1051,7 @@ function logOnboardingBackfill() {
|
|
|
1050
1051
|
// Windows) keeps the event loop alive — see issue #167.
|
|
1051
1052
|
initLogFile();
|
|
1052
1053
|
logOnboardingBackfill();
|
|
1054
|
+
clearUpgradeNoticeCache(join(homedir(), ".cache", "muggle"));
|
|
1053
1055
|
resetStaleVersionOverrideFile();
|
|
1054
1056
|
syncCursorSkills();
|
|
1055
1057
|
syncClaudeMarketplace();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { rmSync } from "fs";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
|
|
4
|
+
const UPGRADE_NOTICE_CACHE_FILE_NAMES = ["version-check", "upgrade-available"];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Forget the cached version lookup, so a reminder to upgrade never outlives the upgrade.
|
|
8
|
+
*
|
|
9
|
+
* The cache names the build that was installed when it was written, which this install just replaced. A file that
|
|
10
|
+
* cannot be removed is left for the next upkeep: a stale notice must not fail an install.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} cacheDir - The ~/.cache/muggle directory.
|
|
13
|
+
*/
|
|
14
|
+
export function clearUpgradeNoticeCache(cacheDir) {
|
|
15
|
+
for (const cacheFileName of UPGRADE_NOTICE_CACHE_FILE_NAMES) {
|
|
16
|
+
try {
|
|
17
|
+
rmSync(join(cacheDir, cacheFileName), { force: true });
|
|
18
|
+
} catch {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|