@skyramp/mcp 0.3.1 → 0.3.2-rc.pom-2

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 (177) hide show
  1. package/build/index.js +2 -1
  2. package/build/prompts/code-reuse.d.ts +7 -1
  3. package/build/prompts/code-reuse.js +8 -5
  4. package/build/prompts/code-reuse.test.d.ts +1 -0
  5. package/build/prompts/code-reuse.test.js +62 -0
  6. package/build/prompts/pom-aware-code-reuse.d.ts +6 -1
  7. package/build/prompts/pom-aware-code-reuse.js +100 -53
  8. package/build/prompts/pom-aware-code-reuse.test.d.ts +1 -0
  9. package/build/prompts/pom-aware-code-reuse.test.js +11 -0
  10. package/build/prompts/test-recommendation/diffExecutionPlan.d.ts +4 -2
  11. package/build/prompts/test-recommendation/diffExecutionPlan.js +11 -65
  12. package/build/prompts/test-recommendation/fullRepoCatalog.d.ts +2 -2
  13. package/build/prompts/test-recommendation/recommendationSections.js +5 -2
  14. package/build/prompts/test-recommendation/scopeAssessment.js +1 -1
  15. package/build/prompts/test-recommendation/test-recommendation-prompt.d.ts +26 -1
  16. package/build/prompts/test-recommendation/test-recommendation-prompt.js +68 -56
  17. package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +48 -11
  18. package/build/prompts/testbot/testbot-prompts.d.ts +1 -1
  19. package/build/prompts/testbot/testbot-prompts.js +67 -21
  20. package/build/prompts/testbot/testbot-prompts.test.js +44 -0
  21. package/build/recommendation/budgeters/diversityBalancedBudgeter.d.ts +7 -0
  22. package/build/recommendation/budgeters/diversityBalancedBudgeter.js +71 -0
  23. package/build/recommendation/budgeters/diversityBalancedBudgeter.test.d.ts +1 -0
  24. package/build/recommendation/budgeters/diversityBalancedBudgeter.test.js +75 -0
  25. package/build/recommendation/budgeters/fixedNBudgeter.d.ts +7 -0
  26. package/build/recommendation/budgeters/fixedNBudgeter.js +11 -0
  27. package/build/recommendation/budgeters/fixedNBudgeter.test.d.ts +1 -0
  28. package/build/recommendation/budgeters/fixedNBudgeter.test.js +66 -0
  29. package/build/recommendation/budgeters/shared.d.ts +19 -0
  30. package/build/recommendation/budgeters/shared.js +66 -0
  31. package/build/recommendation/discriminators.d.ts +31 -0
  32. package/build/recommendation/discriminators.js +355 -0
  33. package/build/recommendation/discriminators.test.d.ts +1 -0
  34. package/build/recommendation/discriminators.test.js +324 -0
  35. package/build/recommendation/diversity.d.ts +47 -0
  36. package/build/recommendation/diversity.js +101 -0
  37. package/build/recommendation/diversity.test.d.ts +1 -0
  38. package/build/recommendation/diversity.test.js +77 -0
  39. package/build/recommendation/planRanker.d.ts +50 -0
  40. package/build/recommendation/planRanker.js +67 -0
  41. package/build/recommendation/planRanker.test.d.ts +1 -0
  42. package/build/recommendation/planRanker.test.js +110 -0
  43. package/build/recommendation/testFixtures.d.ts +25 -0
  44. package/build/recommendation/testFixtures.js +45 -0
  45. package/build/resources/testbotResource.js +4 -1
  46. package/build/services/ScenarioGenerationService.d.ts +5 -0
  47. package/build/services/ScenarioGenerationService.js +16 -1
  48. package/build/services/ScenarioGenerationService.test.js +44 -0
  49. package/build/services/TestExecutionService.d.ts +15 -1
  50. package/build/services/TestExecutionService.js +210 -55
  51. package/build/services/TestExecutionService.test.js +397 -0
  52. package/build/services/TestGenerationService.js +19 -1
  53. package/build/services/TestGenerationService.test.js +58 -0
  54. package/build/tool-phases.js +1 -0
  55. package/build/toolNames.d.ts +19 -0
  56. package/build/toolNames.js +19 -0
  57. package/build/tools/code-refactor/codeReuseTool.d.ts +7 -0
  58. package/build/tools/code-refactor/codeReuseTool.js +130 -4
  59. package/build/tools/code-refactor/codeReuseTool.test.d.ts +1 -0
  60. package/build/tools/code-refactor/codeReuseTool.test.js +290 -0
  61. package/build/tools/executeSkyrampTestTool.js +8 -2
  62. package/build/tools/generate-tests/generateBatchScenarioRestTool.d.ts +6 -1
  63. package/build/tools/generate-tests/generateBatchScenarioRestTool.js +110 -17
  64. package/build/tools/generate-tests/generateBatchScenarioRestTool.test.js +147 -0
  65. package/build/tools/generate-tests/generateContractRestTool.js +11 -1
  66. package/build/tools/generate-tests/generateIntegrationRestTool.js +24 -1
  67. package/build/tools/generate-tests/generateIntegrationRestTool.test.d.ts +1 -0
  68. package/build/tools/generate-tests/generateIntegrationRestTool.test.js +159 -0
  69. package/build/tools/generate-tests/planGuard.d.ts +13 -0
  70. package/build/tools/generate-tests/planGuard.js +78 -0
  71. package/build/tools/generate-tests/planGuard.test.d.ts +1 -0
  72. package/build/tools/generate-tests/planGuard.test.js +185 -0
  73. package/build/tools/generate-tests/scenarioFileIdentity.d.ts +10 -0
  74. package/build/tools/generate-tests/scenarioFileIdentity.js +46 -0
  75. package/build/tools/generate-tests/scenarioLint.d.ts +30 -0
  76. package/build/tools/generate-tests/scenarioLint.js +150 -0
  77. package/build/tools/generate-tests/scenarioLint.test.d.ts +1 -0
  78. package/build/tools/generate-tests/scenarioLint.test.js +100 -0
  79. package/build/tools/submitReportTool.js +78 -0
  80. package/build/tools/submitReportTool.test.js +255 -0
  81. package/build/tools/test-management/analyzeChangesTool.js +55 -2
  82. package/build/tools/test-management/analyzeChangesTool.test.js +12 -0
  83. package/build/tools/test-management/index.d.ts +1 -0
  84. package/build/tools/test-management/index.js +1 -0
  85. package/build/tools/test-management/registerTestPlanTool.d.ts +2 -0
  86. package/build/tools/test-management/registerTestPlanTool.js +329 -0
  87. package/build/tools/test-management/registerTestPlanTool.test.d.ts +1 -0
  88. package/build/tools/test-management/registerTestPlanTool.test.js +296 -0
  89. package/build/types/Recommendation.d.ts +97 -0
  90. package/build/types/Recommendation.js +48 -0
  91. package/build/types/RepositoryAnalysis.d.ts +14 -14
  92. package/build/types/TestExecution.d.ts +2 -0
  93. package/build/types/TestRecommendation.d.ts +12 -1
  94. package/build/types/TestRecommendation.js +26 -11
  95. package/build/types/TestTypes.js +1 -1
  96. package/build/utils/AnalysisStateManager.d.ts +47 -0
  97. package/build/utils/docker.test.js +1 -1
  98. package/build/utils/planMatchKeys.d.ts +61 -0
  99. package/build/utils/planMatchKeys.js +125 -0
  100. package/build/utils/pom-scope/import-expansion.d.ts +5 -0
  101. package/build/utils/pom-scope/import-expansion.js +32 -0
  102. package/build/utils/pom-scope/index.d.ts +39 -0
  103. package/build/utils/pom-scope/index.js +120 -0
  104. package/build/utils/pom-scope/index.test.d.ts +1 -0
  105. package/build/utils/pom-scope/index.test.js +239 -0
  106. package/build/utils/pom-scope/pom-files.d.ts +3 -0
  107. package/build/utils/pom-scope/pom-files.js +48 -0
  108. package/build/utils/pom-scope/pom-files.test.d.ts +1 -0
  109. package/build/utils/pom-scope/pom-files.test.js +29 -0
  110. package/build/utils/pom-scope/scoring.d.ts +20 -0
  111. package/build/utils/pom-scope/scoring.js +45 -0
  112. package/build/utils/pom-scope/scoring.test.d.ts +1 -0
  113. package/build/utils/pom-scope/scoring.test.js +39 -0
  114. package/build/utils/pom-scope/selector-extractor.d.ts +7 -0
  115. package/build/utils/pom-scope/selector-extractor.js +57 -0
  116. package/build/utils/pom-scope/selector-extractor.test.d.ts +1 -0
  117. package/build/utils/pom-scope/selector-extractor.test.js +67 -0
  118. package/build/utils/pom-verify/__fixtures__/af-style/asset-list.page.d.ts +5 -0
  119. package/build/utils/pom-verify/__fixtures__/af-style/asset-list.page.js +5 -0
  120. package/build/utils/pom-verify/__fixtures__/af-style/pageobjects/asset-list-page.d.ts +5 -0
  121. package/build/utils/pom-verify/__fixtures__/af-style/pageobjects/asset-list-page.js +9 -0
  122. package/build/utils/pom-verify/__fixtures__/af-style/report.iframe.page.d.ts +4 -0
  123. package/build/utils/pom-verify/__fixtures__/af-style/report.iframe.page.js +4 -0
  124. package/build/utils/pom-verify/__fixtures__/af-style/workflow-footer.page.d.ts +4 -0
  125. package/build/utils/pom-verify/__fixtures__/af-style/workflow-footer.page.js +4 -0
  126. package/build/utils/pom-verify/bindings.d.ts +19 -0
  127. package/build/utils/pom-verify/bindings.js +161 -0
  128. package/build/utils/pom-verify/bindings.test.d.ts +1 -0
  129. package/build/utils/pom-verify/bindings.test.js +164 -0
  130. package/build/utils/pom-verify/calls.d.ts +16 -0
  131. package/build/utils/pom-verify/calls.js +42 -0
  132. package/build/utils/pom-verify/calls.test.d.ts +1 -0
  133. package/build/utils/pom-verify/calls.test.js +61 -0
  134. package/build/utils/pom-verify/index.d.ts +4 -0
  135. package/build/utils/pom-verify/index.js +4 -0
  136. package/build/utils/pom-verify/resolve.d.ts +7 -0
  137. package/build/utils/pom-verify/resolve.js +27 -0
  138. package/build/utils/pom-verify/resolve.test.d.ts +1 -0
  139. package/build/utils/pom-verify/resolve.test.js +68 -0
  140. package/build/utils/pom-verify/strip.d.ts +9 -0
  141. package/build/utils/pom-verify/strip.js +89 -0
  142. package/build/utils/pom-verify/verify.d.ts +14 -0
  143. package/build/utils/pom-verify/verify.js +158 -0
  144. package/build/utils/pom-verify/verify.test.d.ts +1 -0
  145. package/build/utils/pom-verify/verify.test.js +325 -0
  146. package/build/utils/reportVerification.d.ts +61 -0
  147. package/build/utils/reportVerification.js +104 -0
  148. package/build/utils/reportVerification.test.d.ts +1 -0
  149. package/build/utils/reportVerification.test.js +185 -0
  150. package/build/utils/scenarioDrafting.js +5 -5
  151. package/build/utils/versions.d.ts +3 -3
  152. package/build/utils/versions.js +1 -1
  153. package/build/utils/workspaceAuth.d.ts +9 -1
  154. package/build/utils/workspaceAuth.js +25 -5
  155. package/build/utils/workspaceAuth.test.js +48 -0
  156. package/build/workspace/workspace.d.ts +20 -0
  157. package/build/workspace/workspace.js +4 -0
  158. package/build/workspace/workspace.test.js +10 -0
  159. package/node_modules/playwright/lib/mcp/skyramp/traceRecordingBackend.js +77 -8
  160. package/node_modules/playwright/node_modules/playwright-core/lib/generated/injectedScriptSource.js +1 -1
  161. package/node_modules/playwright/node_modules/playwright-core/lib/generated/pollingRecorderSource.js +1 -1
  162. package/node_modules/playwright/node_modules/playwright-core/lib/utils/isomorphic/volatileDate.js +101 -0
  163. package/node_modules/playwright/node_modules/playwright-core/lib/utils.js +2 -0
  164. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{codeMirrorModule-aszq5EdG.js → codeMirrorModule-Bzd72-bG.js} +1 -1
  165. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/assets/{defaultSettingsView-BxS7Jm4s.js → defaultSettingsView-DzxTioTK.js} +101 -101
  166. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{index.D4JTTy4R.js → index.BGc30U3S.js} +1 -1
  167. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/index.html +2 -2
  168. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/{uiMode.DaRMQKOI.js → uiMode.IaDrb29A.js} +1 -1
  169. package/node_modules/playwright/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +2 -2
  170. package/node_modules/playwright/node_modules/playwright-core/package.json +1 -1
  171. package/node_modules/playwright/node_modules/playwright-core/src/generated/injectedScriptSource.ts +1 -1
  172. package/node_modules/playwright/node_modules/playwright-core/src/generated/pollingRecorderSource.ts +1 -1
  173. package/node_modules/playwright/node_modules/playwright-core/src/utils/isomorphic/volatileDate.ts +131 -0
  174. package/node_modules/playwright/node_modules/playwright-core/src/utils.ts +1 -0
  175. package/node_modules/playwright/package.json +1 -1
  176. package/package.json +3 -3
  177. package/node_modules/playwright/node_modules/playwright-core/.DS_Store +0 -0
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ // Volatile date-text detection and stripping, shared by the injected
18
+ // selectorGenerator, the recorder's ScopingHandler, and the MCP trace
19
+ // recording backend (via the playwright-core utils barrel). Lives in the
20
+ // isomorphic layer so browser bundles and node code compile the one source.
21
+ // Must stay stateless (pure functions + non-global regexes): each injected
22
+ // bundle gets its own copy, so module-level mutable state would diverge.
23
+
24
+ // Month-name dates ("Jul 05", "Apr 10, 2025", "5 July 2026" — a day number is
25
+ // required and the month must be a whole word, so stable names like
26
+ // "May reports" or "Marketing 4" are not flagged), relative modified-date
27
+ // words ("Today", "Yesterday", "2 days ago") that file lists and admin tables
28
+ // render next to the stable identifier, and numeric date(-time) forms
29
+ // ("2026-07-12 17:30:03"). All of these shift at replay.
30
+ const kMonthNamePattern = '(?:jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)';
31
+ export const kVolatileDateTokenRe = new RegExp([
32
+ // Numeric date(-time) form. Apps default-name new entities with a creation
33
+ // timestamp ("Untitled 2026-07-12 17:30:03"), and row names concatenate
34
+ // further cells after it, so the numeric form also sits MID-name — where
35
+ // the leading/trailing-only strips in hasStrippableDate never match.
36
+ // Deliberately NO leading word boundary: elementText glues adjacent cell
37
+ // texts without a separator ("data.csv2026/05/18 23:59"), so the year can
38
+ // start at a letter-digit seam. The required [-/] separators keep
39
+ // version-like number runs ("release 1.2.3") from being flagged.
40
+ '\\d{4}[-/]\\d{1,2}[-/]\\d{1,2}(?:[\\sT,]\\d{1,2}:\\d{1,2}(?::\\d{1,2})?)?',
41
+ `\\b${kMonthNamePattern}\\b\\.?\\s+\\d{1,2}(?:,?\\s*\\d{4})?\\b`,
42
+ // Day-month form ("10 Apr", "10 Apr 2025"). The (?!\s*\d) guard rejects a
43
+ // false parse where a stable name's trailing digit is read as the day —
44
+ // in "Marketing 4 Apr 19, 2024" the "4 Apr" is followed by the real day
45
+ // number, so the month-day branch above matches "Apr 19, 2024" instead.
46
+ `\\b\\d{1,2}\\s+${kMonthNamePattern}\\b\\.?(?:\\s+\\d{4}\\b)?(?!\\s*\\d)`,
47
+ // The (?!['’]) guard keeps possessive/stable labels ("Today's Deals",
48
+ // "Tomorrow's Agenda") from being flagged — the apostrophe continuation
49
+ // means the word is part of a larger noun phrase, not a date cell.
50
+ `\\b(?:today|yesterday|tomorrow|just now)\\b(?!['’])`,
51
+ // "a few" covers moment.js/dayjs's default smallest bucket ("a few seconds ago").
52
+ '\\b(?:a few|an?|\\d+)\\s+(?:second|minute|hour|day|week|month|year)s?\\s+ago\\b',
53
+ ].join('|'), 'i');
54
+
55
+ export function hasVolatileDateFragment(text: string): boolean {
56
+ return kVolatileDateTokenRe.test(text);
57
+ }
58
+
59
+ // Numeric date(-time) form ("2026/05/18 22:37") — leading/trailing strip only,
60
+ // with its own tuned behavior (no word-boundary requirement); used by the
61
+ // hasStrippableDate scoring guard below.
62
+ export const kStrippableDateRe = /\d{4}[-/]\d{1,2}[-/]\d{1,2}(?:[\sT,]\d{1,2}:\d{1,2}(?::\d{1,2})?)?/;
63
+
64
+ // Volatile fragments commonly sit mid-name because row/cell accessible names
65
+ // concatenate cells ("File doc-1.txt Today by Kolja Heck"). Truncate at the
66
+ // first volatile token and keep the stable lead — substring (non-exact)
67
+ // matching keeps the truncated name valid on replay, and volatile trailers
68
+ // like "by <user>" are dropped together with the date. Returns null when
69
+ // nothing stable would remain (e.g. a date-picker button legitimately named
70
+ // just "Today").
71
+ // Sticky (assign-lastIndex-before-every-use) variants for walking a leading
72
+ // token chain by index. The transient lastIndex is never read across calls,
73
+ // so these stay effectively stateless per the module contract above.
74
+ const kVolatileDateTokenStickyRe = new RegExp(kVolatileDateTokenRe.source, 'iy');
75
+ const kSeparatorStickyRe = /[\s,;:·|\-–—)]+/y;
76
+
77
+ export function stripVolatileDateFragment(text: string): string | null {
78
+ // Fast-forward past a leading CHAIN of volatile tokens by index — a
79
+ // pathological input can lead with thousands of them (a long date list's
80
+ // concatenated element text), so no recursion and no per-token string
81
+ // copies (either is quadratic-or-worse at that scale; see the SKYR-3957
82
+ // O(n²)-regex incident for why this class of input is taken seriously).
83
+ let pos = 0;
84
+ for (;;) {
85
+ kVolatileDateTokenStickyRe.lastIndex = pos;
86
+ const token = kVolatileDateTokenStickyRe.exec(text);
87
+ if (!token)
88
+ break;
89
+ // A token must be followed by a separator to strip; an embedded token
90
+ // ("Today's Deals") or one that ends the string leaves nothing stable.
91
+ kSeparatorStickyRe.lastIndex = pos + token[0].length;
92
+ const sep = kSeparatorStickyRe.exec(text);
93
+ if (!sep)
94
+ return null;
95
+ pos = pos + token[0].length + sep[0].length;
96
+ if (pos >= text.length)
97
+ return null;
98
+ }
99
+ const rest = pos ? text.substring(pos) : text;
100
+ const match = kVolatileDateTokenRe.exec(rest);
101
+ if (!match) {
102
+ // No further token: the remainder after a stripped leading chain is the
103
+ // stable content ("Yesterday board notes" → "board notes"); with no
104
+ // leading chain there was nothing volatile at all.
105
+ return pos ? rest.trim() || null : null;
106
+ }
107
+ // Mid-name token ("File doc-1.txt Today by Kolja Heck"): truncate at it
108
+ // and keep the stable lead.
109
+ const lead = rest.substring(0, match.index).replace(/[\s,;:·|\-–—(]+$/, '').trim();
110
+ return lead || null;
111
+ }
112
+
113
+ // Strip-or-original convenience for callers that always need SOME text back
114
+ // (snapshot-derived locator names, recorded assertion text).
115
+ export function stableTextLead(text: string): string {
116
+ return stripVolatileDateFragment(text) ?? text;
117
+ }
118
+
119
+ export function hasStrippableDate(text: string): boolean {
120
+ if (kStrippableDateRe.test(text)) {
121
+ // Only treat the date as "strippable" if removing leading/trailing date
122
+ // patterns leaves non-empty content to anchor on.
123
+ const stripped = text
124
+ .replace(/[\s,]*\d{4}[-/]\d{1,2}[-/]\d{1,2}(?:[\sT,]\d{1,2}:\d{1,2}(?::\d{1,2})?)?\s*$/, '')
125
+ .replace(/^\s*\d{4}[-/]\d{1,2}[-/]\d{1,2}(?:[\sT,]\d{1,2}:\d{1,2}(?::\d{1,2})?)?[\s,]+/, '')
126
+ .trim();
127
+ if (stripped.length > 0 && stripped.length < text.length)
128
+ return true;
129
+ }
130
+ return stripVolatileDateFragment(text) !== null;
131
+ }
@@ -31,6 +31,7 @@ export * from './utils/isomorphic/stringUtils';
31
31
  export * from './utils/isomorphic/time';
32
32
  export * from './utils/isomorphic/timeoutRunner';
33
33
  export * from './utils/isomorphic/urlMatch';
34
+ export * from './utils/isomorphic/volatileDate';
34
35
  export * from './utils/isomorphic/yaml';
35
36
 
36
37
  export * from './server/utils/ascii';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/playwright",
3
- "version": "1.58.2-skyramp.8.14.2",
3
+ "version": "1.58.2-skyramp.8.14.3",
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.1",
3
+ "version": "0.3.2-rc.pom-2",
4
4
  "main": "build/index.js",
5
5
  "exports": {
6
6
  ".": "./build/index.js",
@@ -67,11 +67,11 @@
67
67
  "dependencies": {
68
68
  "@modelcontextprotocol/sdk": "^1.24.3",
69
69
  "@playwright/test": "^1.55.0",
70
- "@skyramp/skyramp": "1.3.34",
70
+ "@skyramp/skyramp": "1.3.35",
71
71
  "dockerode": "^5.0.0",
72
72
  "fast-glob": "^3.3.3",
73
73
  "js-yaml": "^4.1.1",
74
- "playwright": "file:vendor/skyramp-playwright-1.58.2-skyramp.8.14.2.tgz",
74
+ "playwright": "file:vendor/skyramp-playwright-1.58.2-skyramp.8.14.3.tgz",
75
75
  "simple-git": "^3.30.0",
76
76
  "typescript": "^5.8.3",
77
77
  "zod": "^3.25.3"