@skyramp/mcp 0.3.6 → 0.3.7
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/build/prompts/code-reuse.js +17 -2
- package/build/prompts/enhance-assertions/sharedAssertionRules.js +1 -1
- package/build/prompts/modularization/ui-test-modularization.js +9 -6
- package/build/prompts/pom-aware-code-reuse.js +1 -1
- package/build/prompts/shared-helper-policy.js +5 -5
- package/build/services/TestGenerationService.js +15 -1
- package/build/tools/code-refactor/assertion-state.d.ts +91 -0
- package/build/tools/code-refactor/assertion-state.js +375 -0
- package/build/tools/code-refactor/codeReuseTool.js +6 -4
- package/build/tools/code-refactor/enhanceAssertionsTool.js +73 -18
- package/build/tools/code-refactor/retrofit-state.d.ts +53 -0
- package/build/tools/code-refactor/retrofit-state.js +162 -0
- package/build/tools/code-refactor/reuse-outcome.d.ts +7 -0
- package/build/tools/code-refactor/reuse-state.d.ts +9 -0
- package/build/tools/code-refactor/reuse-state.js +42 -4
- package/build/tools/code-refactor/utils-verify-gates.js +69 -15
- package/build/tools/executeSkyrampTestTool.js +19 -14
- package/build/tools/submitReportTool.js +81 -8
- package/build/types/AssertionOutcome.d.ts +68 -0
- package/build/types/AssertionOutcome.js +1 -0
- package/build/types/ReuseOutcome.d.ts +16 -0
- package/build/types/TestTypes.d.ts +4 -0
- package/build/types/TestTypes.js +8 -0
- package/build/types/TestbotReport.d.ts +13 -0
- package/build/types/index.d.ts +1 -1
- package/build/utils/AnalysisStateManager.d.ts +20 -7
- package/build/utils/assertion-verify/api-shared-lints.d.ts +5 -0
- package/build/utils/assertion-verify/api-shared-lints.js +315 -0
- package/build/utils/assertion-verify/contract-lints.d.ts +3 -0
- package/build/utils/assertion-verify/contract-lints.js +87 -0
- package/build/utils/assertion-verify/format.d.ts +5 -0
- package/build/utils/assertion-verify/format.js +65 -0
- package/build/utils/assertion-verify/helper-imports.d.ts +6 -0
- package/build/utils/assertion-verify/helper-imports.js +178 -0
- package/build/utils/assertion-verify/index.d.ts +3 -0
- package/build/utils/assertion-verify/index.js +7 -0
- package/build/utils/assertion-verify/integration-lints.d.ts +3 -0
- package/build/utils/assertion-verify/integration-lints.js +36 -0
- package/build/utils/assertion-verify/js-regex-blank.d.ts +1 -0
- package/build/utils/assertion-verify/js-regex-blank.js +153 -0
- package/build/utils/assertion-verify/lint-types.d.ts +33 -0
- package/build/utils/assertion-verify/lint-types.js +57 -0
- package/build/utils/assertion-verify/marker.d.ts +27 -0
- package/build/utils/assertion-verify/marker.js +61 -0
- package/build/utils/assertion-verify/metrics.d.ts +30 -0
- package/build/utils/assertion-verify/metrics.js +341 -0
- package/build/utils/assertion-verify/python-strip.d.ts +6 -0
- package/build/utils/assertion-verify/python-strip.js +75 -0
- package/build/utils/assertion-verify/strip-dispatch.d.ts +19 -0
- package/build/utils/assertion-verify/strip-dispatch.js +42 -0
- package/build/utils/assertion-verify/ui-lints.d.ts +8 -0
- package/build/utils/assertion-verify/ui-lints.js +244 -0
- package/build/utils/assertion-verify/verify.d.ts +61 -0
- package/build/utils/assertion-verify/verify.js +215 -0
- package/build/utils/featureFlags.d.ts +12 -2
- package/build/utils/featureFlags.js +33 -3
- package/build/utils/reportVerification.d.ts +4 -0
- package/build/utils/reportVerification.js +32 -4
- package/build/utils/utils-verify/allow.d.ts +22 -4
- package/build/utils/utils-verify/allow.js +8 -2
- package/build/utils/utils-verify/call-sites.d.ts +40 -1
- package/build/utils/utils-verify/call-sites.js +196 -30
- package/build/utils/utils-verify/importers.d.ts +31 -0
- package/build/utils/utils-verify/importers.js +78 -0
- package/build/utils/utils-verify/index.d.ts +1 -0
- package/build/utils/utils-verify/index.js +1 -0
- package/build/utils/utils-verify/language-spec.d.ts +13 -2
- package/build/utils/utils-verify/language-spec.js +12 -2
- package/build/utils/utils-verify/parse.d.ts +31 -3
- package/build/utils/utils-verify/parse.js +190 -9
- package/build/utils/utils-verify/retrofit-equivalence.d.ts +43 -0
- package/build/utils/utils-verify/retrofit-equivalence.js +218 -0
- package/build/utils/utils-verify/stage.d.ts +6 -0
- package/build/utils/utils-verify/stage.js +12 -2
- package/build/utils/utils-verify/verify.d.ts +54 -4
- package/build/utils/utils-verify/verify.js +224 -12
- package/node_modules/playwright/node_modules/playwright-core/lib/generated/injectedScriptSource.js +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-CZfp96qZ.js → codeMirrorModule-LNgEKtdV.js} +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{defaultSettingsView-gpLo02E0.js → defaultSettingsView-Bwr1eMKC.js} +135 -135
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{index.Bq1r1URj.js → index.-Id052Lr.js} +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{uiMode.VEfqi1qN.js → uiMode.BPopbasy.js} +1 -1
- package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
- package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
- package/node_modules/playwright/node_modules/playwright-core/src/generated/injectedScriptSource.ts +1 -1
- package/node_modules/playwright/package.json +1 -1
- package/package.json +2 -2
- package/build/tools/code-refactor/enhance-state.d.ts +0 -49
- package/build/tools/code-refactor/enhance-state.js +0 -109
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyramp/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./build/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"fast-glob": "^3.3.3",
|
|
76
76
|
"js-yaml": "^4.1.1",
|
|
77
77
|
"picomatch": "^4.0.5",
|
|
78
|
-
"playwright": "file:vendor/skyramp-playwright-1.58.2-skyramp.8.14.
|
|
78
|
+
"playwright": "file:vendor/skyramp-playwright-1.58.2-skyramp.8.14.6.tgz",
|
|
79
79
|
"simple-git": "^3.30.0",
|
|
80
80
|
"ts-is-record": "^3.0.5",
|
|
81
81
|
"typescript": "^5.8.3",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SKYR-4262 — enforcement for the assertion-enhancement step.
|
|
3
|
-
*
|
|
4
|
-
* `skyramp_enhance_assertions` is prompt-returning: it hands the agent
|
|
5
|
-
* instructions and relies on it to Read + Edit the spec. Nothing verified that
|
|
6
|
-
* the file actually changed, and one production run showed an agent calling the
|
|
7
|
-
* tool for 9 generated specs back-to-back, declaring the assertions adequate
|
|
8
|
-
* without reading a single file, and shipping specs whose named behavior
|
|
9
|
-
* (disabled-state checks) was asserted nowhere.
|
|
10
|
-
*
|
|
11
|
-
* Same enforcement shape as SKYR-4115's pendingReuseVerification: record an
|
|
12
|
-
* obligation when the instructions are handed out, check it at the next tool
|
|
13
|
-
* that touches the same spec, fail open on any state error, and make the
|
|
14
|
-
* clearing action one the agent can always perform:
|
|
15
|
-
* - edit the spec (any content change clears the debt), or
|
|
16
|
-
* - document a deliberate no-change decision with a
|
|
17
|
-
* `// assertions reviewed:` comment in the spec — which is itself an edit,
|
|
18
|
-
* so the hash check is the only gate and the marker is the documentation.
|
|
19
|
-
*/
|
|
20
|
-
/** Snapshot of a spec at the moment enhancement instructions were handed out. */
|
|
21
|
-
export interface EnhanceRecord {
|
|
22
|
-
/** Absolute path, for basename-collision detection in multi-repo runs. */
|
|
23
|
-
testFilePath?: string;
|
|
24
|
-
/** sha256 of the file content at handout time. */
|
|
25
|
-
sha256?: string;
|
|
26
|
-
/** Number of `expect(` occurrences at handout time — for the block message. */
|
|
27
|
-
expectCount?: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Record that enhancement instructions were handed out for `testFile`.
|
|
31
|
-
* Best-effort: a missing run state (non-Testbot use) or unreadable file
|
|
32
|
-
* degrades to "no enforcement", never to a failed tool call.
|
|
33
|
-
*/
|
|
34
|
-
export declare function recordEnhanceObligation(testFile: string, explicitStateFile?: string): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Was this spec handed assertion-enhancement instructions it never acted on?
|
|
37
|
-
*
|
|
38
|
-
* Returns an actionable message when the file is byte-identical to its state at
|
|
39
|
-
* handout time, `undefined` otherwise. The debt clears through the file itself:
|
|
40
|
-
* any edit — adding the missing assertions, or documenting a deliberate
|
|
41
|
-
* no-change decision with a `// assertions reviewed: <reason>` comment —
|
|
42
|
-
* changes the hash. Enforcing "the file changed" rather than "the assertions
|
|
43
|
-
* are good" keeps this a checkpoint, not a judge: assertion quality stays where
|
|
44
|
-
* it belongs, in the enhancement instructions and the report.
|
|
45
|
-
*
|
|
46
|
-
* Fails open on every error path: an unreadable state file or spec is not
|
|
47
|
-
* evidence the agent skipped anything.
|
|
48
|
-
*/
|
|
49
|
-
export declare function pendingAssertionEnhancement(testFile: string, explicitStateFile?: string): Promise<string | undefined>;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import * as path from "path";
|
|
2
|
-
import { createHash } from "crypto";
|
|
3
|
-
import { readFile } from "fs/promises";
|
|
4
|
-
import { logger } from "../../utils/logger.js";
|
|
5
|
-
import { resolveRunStatePath, StateManager, } from "../../utils/AnalysisStateManager.js";
|
|
6
|
-
const REVIEW_MARKER = "// assertions reviewed:";
|
|
7
|
-
async function fileSnapshot(testFile) {
|
|
8
|
-
try {
|
|
9
|
-
const content = await readFile(testFile, "utf8");
|
|
10
|
-
return {
|
|
11
|
-
content,
|
|
12
|
-
sha256: createHash("sha256").update(content).digest("hex"),
|
|
13
|
-
expectCount: (content.match(/\bexpect\s*\(/g) ?? []).length,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
catch {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Record that enhancement instructions were handed out for `testFile`.
|
|
22
|
-
* Best-effort: a missing run state (non-Testbot use) or unreadable file
|
|
23
|
-
* degrades to "no enforcement", never to a failed tool call.
|
|
24
|
-
*/
|
|
25
|
-
export async function recordEnhanceObligation(testFile, explicitStateFile) {
|
|
26
|
-
const stateFile = resolveRunStatePath(explicitStateFile);
|
|
27
|
-
if (!stateFile)
|
|
28
|
-
return;
|
|
29
|
-
const snapshot = await fileSnapshot(testFile);
|
|
30
|
-
if (!snapshot)
|
|
31
|
-
return;
|
|
32
|
-
try {
|
|
33
|
-
const manager = StateManager.fromStatePath(stateFile);
|
|
34
|
-
const data = await manager.readData();
|
|
35
|
-
if (!data)
|
|
36
|
-
return;
|
|
37
|
-
const key = path.basename(testFile);
|
|
38
|
-
await manager.writeData({
|
|
39
|
-
...data,
|
|
40
|
-
enhanceOutcomes: {
|
|
41
|
-
...data.enhanceOutcomes,
|
|
42
|
-
[key]: {
|
|
43
|
-
testFilePath: testFile,
|
|
44
|
-
sha256: snapshot.sha256,
|
|
45
|
-
expectCount: snapshot.expectCount,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
logger.warning("Could not record the assertion-enhancement obligation — proceeding", {
|
|
52
|
-
testFile,
|
|
53
|
-
error: String(err),
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Was this spec handed assertion-enhancement instructions it never acted on?
|
|
59
|
-
*
|
|
60
|
-
* Returns an actionable message when the file is byte-identical to its state at
|
|
61
|
-
* handout time, `undefined` otherwise. The debt clears through the file itself:
|
|
62
|
-
* any edit — adding the missing assertions, or documenting a deliberate
|
|
63
|
-
* no-change decision with a `// assertions reviewed: <reason>` comment —
|
|
64
|
-
* changes the hash. Enforcing "the file changed" rather than "the assertions
|
|
65
|
-
* are good" keeps this a checkpoint, not a judge: assertion quality stays where
|
|
66
|
-
* it belongs, in the enhancement instructions and the report.
|
|
67
|
-
*
|
|
68
|
-
* Fails open on every error path: an unreadable state file or spec is not
|
|
69
|
-
* evidence the agent skipped anything.
|
|
70
|
-
*/
|
|
71
|
-
export async function pendingAssertionEnhancement(testFile, explicitStateFile) {
|
|
72
|
-
try {
|
|
73
|
-
const stateFile = resolveRunStatePath(explicitStateFile);
|
|
74
|
-
if (!stateFile)
|
|
75
|
-
return undefined;
|
|
76
|
-
const data = await StateManager.fromStatePath(stateFile).readData();
|
|
77
|
-
const record = data?.enhanceOutcomes?.[path.basename(testFile)];
|
|
78
|
-
if (!record?.sha256)
|
|
79
|
-
return undefined;
|
|
80
|
-
// enhanceOutcomes is keyed by basename across the whole run; in a multi-repo
|
|
81
|
-
// run two specs can share one record. Blocking a tool on another spec's debt
|
|
82
|
-
// is worse than missing this one, so a mismatch fails open.
|
|
83
|
-
if (record.testFilePath && record.testFilePath !== testFile)
|
|
84
|
-
return undefined;
|
|
85
|
-
const snapshot = await fileSnapshot(testFile);
|
|
86
|
-
if (!snapshot)
|
|
87
|
-
return undefined;
|
|
88
|
-
if (snapshot.sha256 !== record.sha256)
|
|
89
|
-
return undefined;
|
|
90
|
-
if (snapshot.content.includes(REVIEW_MARKER))
|
|
91
|
-
return undefined;
|
|
92
|
-
const spec = path.basename(testFile);
|
|
93
|
-
const countNote = record.expectCount !== undefined
|
|
94
|
-
? ` It still has the same ${record.expectCount} expect() call${record.expectCount === 1 ? "" : "s"} it was generated with.`
|
|
95
|
-
: "";
|
|
96
|
-
return (`skyramp_enhance_assertions handed out instructions for ${spec} and the file has not changed since.${countNote} ` +
|
|
97
|
-
`Read the file and apply the enhancement instructions — in particular, add expect() assertions for the specific ` +
|
|
98
|
-
`behavior this test is named for (state checks like toBeDisabled/toBeEnabled/toHaveCount, not just replayed text ` +
|
|
99
|
-
`assertions). If after actually reading the file you determine no change is needed, document that in the spec with ` +
|
|
100
|
-
`a \`${REVIEW_MARKER} <what you checked and why it is sufficient>\` comment near the top of the test.`);
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
logger.warning("Could not check for a pending assertion enhancement — proceeding", {
|
|
104
|
-
testFile,
|
|
105
|
-
error: String(err),
|
|
106
|
-
});
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
}
|