@skyramp/mcp 0.3.6 → 0.3.8

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.
Files changed (112) hide show
  1. package/build/prompts/code-reuse.js +17 -2
  2. package/build/prompts/enhance-assertions/sharedAssertionRules.js +1 -1
  3. package/build/prompts/modularization/ui-test-modularization.js +9 -6
  4. package/build/prompts/pom-aware-code-reuse.js +1 -1
  5. package/build/prompts/shared-helper-policy.js +5 -5
  6. package/build/prompts/test-recommendation/diffExecutionPlan.js +40 -9
  7. package/build/prompts/test-recommendation/fullRepoCatalog.js +3 -2
  8. package/build/prompts/test-recommendation/recommendationSections.js +3 -3
  9. package/build/prompts/test-recommendation/scopeAssessment.d.ts +2 -2
  10. package/build/prompts/test-recommendation/scopeAssessment.js +58 -76
  11. package/build/prompts/test-recommendation/test-recommendation-prompt.js +14 -1
  12. package/build/prompts/testbot/testbot-prompts.js +25 -8
  13. package/build/recommendation/budgeters/diversityBalancedBudgeter.js +39 -5
  14. package/build/recommendation/budgeters/shared.d.ts +21 -8
  15. package/build/recommendation/budgeters/shared.js +134 -56
  16. package/build/recommendation/planRanker.d.ts +5 -3
  17. package/build/recommendation/planRanker.js +1 -1
  18. package/build/services/TestGenerationService.js +15 -1
  19. package/build/tools/code-refactor/assertion-state.d.ts +91 -0
  20. package/build/tools/code-refactor/assertion-state.js +375 -0
  21. package/build/tools/code-refactor/codeReuseTool.js +6 -4
  22. package/build/tools/code-refactor/enhanceAssertionsTool.js +73 -18
  23. package/build/tools/code-refactor/retrofit-state.d.ts +53 -0
  24. package/build/tools/code-refactor/retrofit-state.js +162 -0
  25. package/build/tools/code-refactor/reuse-outcome.d.ts +7 -0
  26. package/build/tools/code-refactor/reuse-state.d.ts +9 -0
  27. package/build/tools/code-refactor/reuse-state.js +42 -4
  28. package/build/tools/code-refactor/utils-verify-gates.js +69 -15
  29. package/build/tools/executeSkyrampTestTool.js +19 -14
  30. package/build/tools/submitReportTool.js +87 -9
  31. package/build/tools/test-management/registerTestPlanTool.d.ts +3 -3
  32. package/build/tools/test-management/registerTestPlanTool.js +29 -8
  33. package/build/types/AssertionOutcome.d.ts +68 -0
  34. package/build/types/AssertionOutcome.js +1 -0
  35. package/build/types/RepositoryAnalysis.d.ts +10 -10
  36. package/build/types/ReuseOutcome.d.ts +16 -0
  37. package/build/types/TestRecommendation.d.ts +11 -1
  38. package/build/types/TestRecommendation.js +34 -0
  39. package/build/types/TestTypes.d.ts +4 -0
  40. package/build/types/TestTypes.js +8 -0
  41. package/build/types/TestbotReport.d.ts +13 -0
  42. package/build/types/index.d.ts +1 -1
  43. package/build/utils/AnalysisStateManager.d.ts +20 -7
  44. package/build/utils/assertion-verify/api-shared-lints.d.ts +5 -0
  45. package/build/utils/assertion-verify/api-shared-lints.js +315 -0
  46. package/build/utils/assertion-verify/contract-lints.d.ts +3 -0
  47. package/build/utils/assertion-verify/contract-lints.js +87 -0
  48. package/build/utils/assertion-verify/format.d.ts +5 -0
  49. package/build/utils/assertion-verify/format.js +65 -0
  50. package/build/utils/assertion-verify/helper-imports.d.ts +6 -0
  51. package/build/utils/assertion-verify/helper-imports.js +178 -0
  52. package/build/utils/assertion-verify/index.d.ts +3 -0
  53. package/build/utils/assertion-verify/index.js +7 -0
  54. package/build/utils/assertion-verify/integration-lints.d.ts +3 -0
  55. package/build/utils/assertion-verify/integration-lints.js +36 -0
  56. package/build/utils/assertion-verify/js-regex-blank.d.ts +1 -0
  57. package/build/utils/assertion-verify/js-regex-blank.js +153 -0
  58. package/build/utils/assertion-verify/lint-types.d.ts +33 -0
  59. package/build/utils/assertion-verify/lint-types.js +57 -0
  60. package/build/utils/assertion-verify/marker.d.ts +27 -0
  61. package/build/utils/assertion-verify/marker.js +61 -0
  62. package/build/utils/assertion-verify/metrics.d.ts +30 -0
  63. package/build/utils/assertion-verify/metrics.js +341 -0
  64. package/build/utils/assertion-verify/python-strip.d.ts +6 -0
  65. package/build/utils/assertion-verify/python-strip.js +75 -0
  66. package/build/utils/assertion-verify/strip-dispatch.d.ts +19 -0
  67. package/build/utils/assertion-verify/strip-dispatch.js +42 -0
  68. package/build/utils/assertion-verify/ui-lints.d.ts +8 -0
  69. package/build/utils/assertion-verify/ui-lints.js +244 -0
  70. package/build/utils/assertion-verify/verify.d.ts +61 -0
  71. package/build/utils/assertion-verify/verify.js +215 -0
  72. package/build/utils/featureFlags.d.ts +12 -2
  73. package/build/utils/featureFlags.js +33 -3
  74. package/build/utils/pathSignatures.d.ts +4 -1
  75. package/build/utils/pathSignatures.js +14 -2
  76. package/build/utils/planOnlyMode.d.ts +33 -0
  77. package/build/utils/planOnlyMode.js +40 -0
  78. package/build/utils/reportVerification.d.ts +9 -0
  79. package/build/utils/reportVerification.js +39 -6
  80. package/build/utils/scenarioDrafting.d.ts +1 -1
  81. package/build/utils/scenarioDrafting.js +1 -1
  82. package/build/utils/utils-verify/allow.d.ts +22 -4
  83. package/build/utils/utils-verify/allow.js +8 -2
  84. package/build/utils/utils-verify/call-sites.d.ts +40 -1
  85. package/build/utils/utils-verify/call-sites.js +196 -30
  86. package/build/utils/utils-verify/importers.d.ts +31 -0
  87. package/build/utils/utils-verify/importers.js +78 -0
  88. package/build/utils/utils-verify/index.d.ts +1 -0
  89. package/build/utils/utils-verify/index.js +1 -0
  90. package/build/utils/utils-verify/language-spec.d.ts +13 -2
  91. package/build/utils/utils-verify/language-spec.js +12 -2
  92. package/build/utils/utils-verify/parse.d.ts +31 -3
  93. package/build/utils/utils-verify/parse.js +190 -9
  94. package/build/utils/utils-verify/retrofit-equivalence.d.ts +43 -0
  95. package/build/utils/utils-verify/retrofit-equivalence.js +218 -0
  96. package/build/utils/utils-verify/stage.d.ts +6 -0
  97. package/build/utils/utils-verify/stage.js +12 -2
  98. package/build/utils/utils-verify/verify.d.ts +54 -4
  99. package/build/utils/utils-verify/verify.js +224 -12
  100. package/node_modules/playwright/node_modules/playwright-core/lib/generated/injectedScriptSource.js +1 -1
  101. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-CZfp96qZ.js → codeMirrorModule-LNgEKtdV.js} +1 -1
  102. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{defaultSettingsView-gpLo02E0.js → defaultSettingsView-Bwr1eMKC.js} +135 -135
  103. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{index.Bq1r1URj.js → index.-Id052Lr.js} +1 -1
  104. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
  105. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{uiMode.VEfqi1qN.js → uiMode.BPopbasy.js} +1 -1
  106. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
  107. package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
  108. package/node_modules/playwright/node_modules/playwright-core/src/generated/injectedScriptSource.ts +1 -1
  109. package/node_modules/playwright/package.json +1 -1
  110. package/package.json +2 -2
  111. package/build/tools/code-refactor/enhance-state.d.ts +0 -49
  112. package/build/tools/code-refactor/enhance-state.js +0 -109
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/playwright",
3
- "version": "1.58.2-skyramp.8.14.5",
3
+ "version": "1.58.2-skyramp.8.14.6",
4
4
  "description": "Skyramp's fork of Playwright with trace recording for UI test generation",
5
5
  "publishConfig": {
6
6
  "access": "public"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/mcp",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
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.5.tgz",
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
- }