@skyramp/mcp 0.4.2-rc.1 → 0.4.2-rc.3
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/commands/localDevTestChangesCommand.js +1 -1
- package/build/commands/recommendTestsAndExecuteCommand.js +10 -1
- package/build/commands/testThisEndpointCommand.js +19 -2
- package/build/execution/wrapperConfig.d.ts +56 -0
- package/build/execution/wrapperConfig.js +155 -0
- package/build/index.js +6 -6
- package/build/playwright/registerPlaywrightTools.js +14 -0
- package/build/playwright/traceExportStore.d.ts +22 -0
- package/build/playwright/traceExportStore.js +81 -0
- package/build/playwright/traceRecordingPrompt.js +2 -1
- package/build/prompts/code-reuse.js +24 -21
- package/build/prompts/local-dev/local-dev-plan.js +6 -23
- package/build/prompts/local-dev/local-dev-prompts.js +1 -1
- package/build/prompts/shared-helper-policy.d.ts +36 -0
- package/build/prompts/shared-helper-policy.js +33 -1
- package/build/prompts/startTraceCollectionPrompts.js +1 -1
- package/build/prompts/sut-setup/modes/adaptWorkflowPrompt.js +6 -7
- package/build/prompts/sut-setup/shared.d.ts +1 -1
- package/build/prompts/sut-setup/shared.js +5 -3
- package/build/prompts/test-maintenance/drift-analysis-prompt.d.ts +16 -8
- package/build/prompts/test-maintenance/drift-analysis-prompt.js +90 -36
- package/build/prompts/test-maintenance/uiDriftAnalysisSections.js +1 -1
- package/build/prompts/test-recommendation/recommendationShared.d.ts +1 -1
- package/build/prompts/test-recommendation/recommendationShared.js +0 -1
- package/build/prompts/testbot/testbot-prompts.js +11 -9
- package/build/services/TestDiscoveryService.js +32 -4
- package/build/skills/runTestSkill.d.ts +6 -0
- package/build/skills/runTestSkill.js +17 -0
- package/build/tool-phases.js +0 -1
- package/build/tools/budgetExcuse.d.ts +15 -0
- package/build/tools/budgetExcuse.js +113 -0
- package/build/tools/code-refactor/utils-verify-gates.js +17 -3
- package/build/tools/executeSkyrampTestTool.d.ts +97 -48
- package/build/tools/executeSkyrampTestTool.js +775 -449
- package/build/tools/generate-tests/generateE2ERestTool.d.ts +0 -1
- package/build/tools/generate-tests/generateE2ERestTool.js +1 -9
- package/build/tools/generate-tests/generateUIRestTool.d.ts +0 -2
- package/build/tools/generate-tests/generateUIRestTool.js +1 -9
- package/build/tools/submitReportTool.js +128 -0
- package/build/tools/test-management/actionsTool.js +31 -0
- package/build/tools/test-management/analyzeChangesTool.d.ts +4 -4
- package/build/tools/test-management/analyzeTestHealthTool.d.ts +0 -11
- package/build/tools/test-management/analyzeTestHealthTool.js +7 -63
- package/build/tools/test-management/testsOwedBeforeRun.d.ts +28 -0
- package/build/tools/test-management/testsOwedBeforeRun.js +53 -0
- package/build/tools/trace/stopTraceCollectionTool.js +1 -1
- package/build/types/RepositoryAnalysis.d.ts +32 -32
- package/build/types/ReuseOutcome.d.ts +4 -3
- package/build/types/TestExecution.d.ts +2 -2
- package/build/types/TestTypes.d.ts +3 -7
- package/build/types/TestTypes.js +6 -20
- package/build/utils/AnalysisStateManager.d.ts +0 -7
- package/build/utils/AnalysisStateManager.js +1 -1
- package/build/utils/connectionErrors.d.ts +10 -0
- package/build/utils/connectionErrors.js +10 -0
- package/build/utils/language-helper.js +24 -3
- package/build/utils/progress.d.ts +1 -1
- package/build/utils/progress.js +1 -1
- package/build/utils/rebaselineSnapshots.d.ts +1 -1
- package/build/utils/rebaselineSnapshots.js +6 -16
- package/build/utils/reuseRouting.d.ts +10 -0
- package/build/utils/reuseRouting.js +15 -0
- package/build/utils/runContextGauge.d.ts +27 -0
- package/build/utils/runContextGauge.js +181 -0
- package/build/utils/skyrampMdContent.d.ts +1 -1
- package/build/utils/skyrampMdContent.js +1 -1
- package/build/utils/skyrampSdkVersion.d.ts +9 -0
- package/build/utils/skyrampSdkVersion.js +16 -0
- package/build/utils/testDependencyPolicy.js +21 -0
- package/build/utils/testExecutionRecord.d.ts +5 -1
- package/build/utils/testExecutionRecord.js +3 -1
- package/build/utils/testFileClassification.d.ts +8 -0
- package/build/utils/testFileClassification.js +36 -3
- package/build/utils/utils-verify/action-key.d.ts +42 -0
- package/build/utils/utils-verify/action-key.js +118 -36
- package/build/utils/utils-verify/action-sites.d.ts +32 -0
- package/build/utils/utils-verify/action-sites.js +202 -0
- package/build/utils/utils-verify/body-reach.js +2 -4
- package/build/utils/utils-verify/call-sites.d.ts +25 -6
- package/build/utils/utils-verify/call-sites.js +8 -5
- 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 +25 -0
- package/build/utils/utils-verify/language-spec.js +16 -2
- package/build/utils/utils-verify/parse.d.ts +10 -1
- package/build/utils/utils-verify/parse.js +19 -2
- package/build/utils/utils-verify/verify.d.ts +3 -2
- package/build/utils/utils-verify/verify.js +16 -18
- package/build/workspace/workspace.d.ts +72 -52
- package/build/workspace/workspace.js +12 -8
- package/package.json +1 -1
- package/plugin/prompts/testbot-task1.md +0 -2
- package/plugin/skills/enhance-assertions/reference/shared-rules.md +1 -1
- package/plugin/skills/enhance-assertions/reference/ui.md +1 -1
- package/plugin/skills/fix-test-import-errors/SKILL.md +2 -1
- package/plugin/skills/run-test/SKILL.md +16 -0
- package/build/adapters/jestAdapter.d.ts +0 -14
- package/build/adapters/jestAdapter.js +0 -131
- package/build/adapters/mochaAdapter.d.ts +0 -13
- package/build/adapters/mochaAdapter.js +0 -93
- package/build/adapters/playwrightAdapter.d.ts +0 -17
- package/build/adapters/playwrightAdapter.js +0 -184
- package/build/adapters/pytestAdapter.d.ts +0 -15
- package/build/adapters/pytestAdapter.js +0 -119
- package/build/tools/runExistingTestsTool.d.ts +0 -138
- package/build/tools/runExistingTestsTool.js +0 -666
- package/build/types/ExternalTestExecution.d.ts +0 -67
- package/build/types/ExternalTestExecution.js +0 -8
- package/build/workspace/testSuites.d.ts +0 -20
- package/build/workspace/testSuites.js +0 -17
|
@@ -927,15 +927,15 @@ export declare const chainingRefSchema: z.ZodObject<{
|
|
|
927
927
|
}, "strip", z.ZodTypeAny, {
|
|
928
928
|
sourceStep: number;
|
|
929
929
|
sourceField: string;
|
|
930
|
-
sourceLocation: "
|
|
930
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
931
931
|
targetParam: string;
|
|
932
|
-
targetLocation: "path" | "
|
|
932
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
933
933
|
}, {
|
|
934
934
|
sourceStep: number;
|
|
935
935
|
sourceField: string;
|
|
936
|
-
sourceLocation: "
|
|
936
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
937
937
|
targetParam: string;
|
|
938
|
-
targetLocation: "path" | "
|
|
938
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
939
939
|
}>;
|
|
940
940
|
export declare const scenarioStepSchema: z.ZodObject<{
|
|
941
941
|
order: z.ZodNumber;
|
|
@@ -957,15 +957,15 @@ export declare const scenarioStepSchema: z.ZodObject<{
|
|
|
957
957
|
}, "strip", z.ZodTypeAny, {
|
|
958
958
|
sourceStep: number;
|
|
959
959
|
sourceField: string;
|
|
960
|
-
sourceLocation: "
|
|
960
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
961
961
|
targetParam: string;
|
|
962
|
-
targetLocation: "path" | "
|
|
962
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
963
963
|
}, {
|
|
964
964
|
sourceStep: number;
|
|
965
965
|
sourceField: string;
|
|
966
|
-
sourceLocation: "
|
|
966
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
967
967
|
targetParam: string;
|
|
968
|
-
targetLocation: "path" | "
|
|
968
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
969
969
|
}>, z.ZodArray<z.ZodObject<{
|
|
970
970
|
sourceStep: z.ZodNumber;
|
|
971
971
|
sourceField: z.ZodString;
|
|
@@ -975,15 +975,15 @@ export declare const scenarioStepSchema: z.ZodObject<{
|
|
|
975
975
|
}, "strip", z.ZodTypeAny, {
|
|
976
976
|
sourceStep: number;
|
|
977
977
|
sourceField: string;
|
|
978
|
-
sourceLocation: "
|
|
978
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
979
979
|
targetParam: string;
|
|
980
|
-
targetLocation: "path" | "
|
|
980
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
981
981
|
}, {
|
|
982
982
|
sourceStep: number;
|
|
983
983
|
sourceField: string;
|
|
984
|
-
sourceLocation: "
|
|
984
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
985
985
|
targetParam: string;
|
|
986
|
-
targetLocation: "path" | "
|
|
986
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
987
987
|
}>, "many">]>>;
|
|
988
988
|
bodyMustInclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
989
989
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1000,15 +1000,15 @@ export declare const scenarioStepSchema: z.ZodObject<{
|
|
|
1000
1000
|
chainsFrom?: {
|
|
1001
1001
|
sourceStep: number;
|
|
1002
1002
|
sourceField: string;
|
|
1003
|
-
sourceLocation: "
|
|
1003
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
1004
1004
|
targetParam: string;
|
|
1005
|
-
targetLocation: "path" | "
|
|
1005
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
1006
1006
|
} | {
|
|
1007
1007
|
sourceStep: number;
|
|
1008
1008
|
sourceField: string;
|
|
1009
|
-
sourceLocation: "
|
|
1009
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
1010
1010
|
targetParam: string;
|
|
1011
|
-
targetLocation: "path" | "
|
|
1011
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
1012
1012
|
}[] | undefined;
|
|
1013
1013
|
bodyMustInclude?: string[] | undefined;
|
|
1014
1014
|
}, {
|
|
@@ -1025,15 +1025,15 @@ export declare const scenarioStepSchema: z.ZodObject<{
|
|
|
1025
1025
|
chainsFrom?: {
|
|
1026
1026
|
sourceStep: number;
|
|
1027
1027
|
sourceField: string;
|
|
1028
|
-
sourceLocation: "
|
|
1028
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
1029
1029
|
targetParam: string;
|
|
1030
|
-
targetLocation: "path" | "
|
|
1030
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
1031
1031
|
} | {
|
|
1032
1032
|
sourceStep: number;
|
|
1033
1033
|
sourceField: string;
|
|
1034
|
-
sourceLocation: "
|
|
1034
|
+
sourceLocation: "cookie" | "body" | "header";
|
|
1035
1035
|
targetParam: string;
|
|
1036
|
-
targetLocation: "path" | "
|
|
1036
|
+
targetLocation: "path" | "cookie" | "body" | "header" | "query";
|
|
1037
1037
|
}[] | undefined;
|
|
1038
1038
|
bodyMustInclude?: string[] | undefined;
|
|
1039
1039
|
}>;
|
|
@@ -1184,14 +1184,14 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1184
1184
|
path: string;
|
|
1185
1185
|
version: string;
|
|
1186
1186
|
authType: string;
|
|
1187
|
-
endpointCount: number;
|
|
1188
1187
|
baseUrl: string;
|
|
1188
|
+
endpointCount: number;
|
|
1189
1189
|
}, {
|
|
1190
1190
|
path: string;
|
|
1191
1191
|
version: string;
|
|
1192
1192
|
authType: string;
|
|
1193
|
-
endpointCount: number;
|
|
1194
1193
|
baseUrl: string;
|
|
1194
|
+
endpointCount: number;
|
|
1195
1195
|
}>, "many">;
|
|
1196
1196
|
playwrightRecordings: z.ZodArray<z.ZodObject<{
|
|
1197
1197
|
path: z.ZodString;
|
|
@@ -1225,8 +1225,8 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1225
1225
|
path: string;
|
|
1226
1226
|
version: string;
|
|
1227
1227
|
authType: string;
|
|
1228
|
-
endpointCount: number;
|
|
1229
1228
|
baseUrl: string;
|
|
1229
|
+
endpointCount: number;
|
|
1230
1230
|
}[];
|
|
1231
1231
|
playwrightRecordings: {
|
|
1232
1232
|
path: string;
|
|
@@ -1244,8 +1244,8 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1244
1244
|
path: string;
|
|
1245
1245
|
version: string;
|
|
1246
1246
|
authType: string;
|
|
1247
|
-
endpointCount: number;
|
|
1248
1247
|
baseUrl: string;
|
|
1248
|
+
endpointCount: number;
|
|
1249
1249
|
}[];
|
|
1250
1250
|
playwrightRecordings: {
|
|
1251
1251
|
path: string;
|
|
@@ -1389,6 +1389,9 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1389
1389
|
scanDepth: "quick" | "full";
|
|
1390
1390
|
analysisScope?: AnalysisScope | undefined;
|
|
1391
1391
|
};
|
|
1392
|
+
workspace: {
|
|
1393
|
+
baseUrl: string;
|
|
1394
|
+
};
|
|
1392
1395
|
projectClassification: {
|
|
1393
1396
|
projectType: "rest-api" | "frontend" | "full-stack" | "microservices" | "library" | "cli" | "other";
|
|
1394
1397
|
primaryLanguage: string;
|
|
@@ -1416,8 +1419,8 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1416
1419
|
path: string;
|
|
1417
1420
|
version: string;
|
|
1418
1421
|
authType: string;
|
|
1419
|
-
endpointCount: number;
|
|
1420
1422
|
baseUrl: string;
|
|
1423
|
+
endpointCount: number;
|
|
1421
1424
|
}[];
|
|
1422
1425
|
playwrightRecordings: {
|
|
1423
1426
|
path: string;
|
|
@@ -1431,9 +1434,6 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1431
1434
|
}[];
|
|
1432
1435
|
notFound: string[];
|
|
1433
1436
|
};
|
|
1434
|
-
workspace: {
|
|
1435
|
-
baseUrl: string;
|
|
1436
|
-
};
|
|
1437
1437
|
authentication: {
|
|
1438
1438
|
method: string;
|
|
1439
1439
|
configLocation: string;
|
|
@@ -1477,6 +1477,9 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1477
1477
|
scanDepth: "quick" | "full";
|
|
1478
1478
|
analysisScope?: AnalysisScope | undefined;
|
|
1479
1479
|
};
|
|
1480
|
+
workspace: {
|
|
1481
|
+
baseUrl: string;
|
|
1482
|
+
};
|
|
1480
1483
|
projectClassification: {
|
|
1481
1484
|
projectType: "rest-api" | "frontend" | "full-stack" | "microservices" | "library" | "cli" | "other";
|
|
1482
1485
|
primaryLanguage: string;
|
|
@@ -1504,8 +1507,8 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1504
1507
|
path: string;
|
|
1505
1508
|
version: string;
|
|
1506
1509
|
authType: string;
|
|
1507
|
-
endpointCount: number;
|
|
1508
1510
|
baseUrl: string;
|
|
1511
|
+
endpointCount: number;
|
|
1509
1512
|
}[];
|
|
1510
1513
|
playwrightRecordings: {
|
|
1511
1514
|
path: string;
|
|
@@ -1519,9 +1522,6 @@ export declare const repositoryAnalysisSchema: z.ZodObject<{
|
|
|
1519
1522
|
}[];
|
|
1520
1523
|
notFound: string[];
|
|
1521
1524
|
};
|
|
1522
|
-
workspace: {
|
|
1523
|
-
baseUrl: string;
|
|
1524
|
-
};
|
|
1525
1525
|
authentication: {
|
|
1526
1526
|
method: string;
|
|
1527
1527
|
configLocation: string;
|
|
@@ -154,9 +154,10 @@ export interface HelperReuseOutcome {
|
|
|
154
154
|
* TODO: remove `helpersImported` once the testbot renderer reads this field. The
|
|
155
155
|
* two carry one fact; the count stays only because testbot#349 reads it today. */
|
|
156
156
|
helperNames: string[];
|
|
157
|
-
/** Inline request calls
|
|
158
|
-
*
|
|
159
|
-
* Omitted at zero. Informational,
|
|
157
|
+
/** Inline request calls (integration) or inline action sequences (UI) in OTHER
|
|
158
|
+
* Skyramp-generated tests beside this one that a helper in `utilsFile` already
|
|
159
|
+
* wraps — reuse that was available and not taken. Omitted at zero. Informational,
|
|
160
|
+
* like {@link ReuseOutcome.missedReuse}. */
|
|
160
161
|
siblingInlineCallSites?: number;
|
|
161
162
|
/** Whether the delivered utils file holds the shared-helper invariants: one helper
|
|
162
163
|
* per method+path, status-code-only assertions, method+resource names — with
|
|
@@ -41,8 +41,8 @@ export interface TestExecutionRecord {
|
|
|
41
41
|
executedAt: string;
|
|
42
42
|
duration: number;
|
|
43
43
|
/** The process's real exit code, or -1 when none was produced — a timeout
|
|
44
|
-
* kill or a
|
|
45
|
-
* see
|
|
44
|
+
* kill or a spawn error before the process exited (an Error-status run;
|
|
45
|
+
* see runTest in skyramp_execute_test). Never a real exit
|
|
46
46
|
* code, which is always 0-255. */
|
|
47
47
|
exitCode: number;
|
|
48
48
|
errors: string[];
|
|
@@ -7,6 +7,9 @@ export declare enum ProgrammingLanguage {
|
|
|
7
7
|
JAVASCRIPT = "javascript",
|
|
8
8
|
JAVA = "java"
|
|
9
9
|
}
|
|
10
|
+
/** The languages skyramp_execute_test accepts, as prose for a prompt. Rendered from
|
|
11
|
+
* the enum so the text and the gate that reads it cannot disagree. */
|
|
12
|
+
export declare function runnableLanguagesText(): string;
|
|
10
13
|
export declare enum TestType {
|
|
11
14
|
SMOKE = "smoke",
|
|
12
15
|
FUZZ = "fuzz",
|
|
@@ -252,13 +255,6 @@ export declare const codeRefactoringSchema: z.ZodObject<{
|
|
|
252
255
|
codeReuse?: boolean | undefined;
|
|
253
256
|
modularizeCode?: boolean | undefined;
|
|
254
257
|
}>;
|
|
255
|
-
/** The `testName` field for a recording-driven generation tool.
|
|
256
|
-
*
|
|
257
|
-
* Single-sourced because the description is prompt text: it is the only thing
|
|
258
|
-
* steering the agent's choice of title, it gets re-tuned against eval results,
|
|
259
|
-
* and two copies would let the UI and E2E tools drift apart silently. Each
|
|
260
|
-
* tool passes the title its own generator falls back to (SKYR-4468). */
|
|
261
|
-
export declare const testNameField: (fallbackTitle: string) => z.ZodOptional<z.ZodString>;
|
|
262
258
|
/** Test types skyramp_enhance_assertions supports — single-sourced so the
|
|
263
259
|
* tool's schema enum and generation-time baseline seeding cannot drift
|
|
264
260
|
* (contract additionally requires provider mode at the seeding site). */
|
package/build/types/TestTypes.js
CHANGED
|
@@ -9,6 +9,12 @@ export var ProgrammingLanguage;
|
|
|
9
9
|
ProgrammingLanguage["JAVASCRIPT"] = "javascript";
|
|
10
10
|
ProgrammingLanguage["JAVA"] = "java";
|
|
11
11
|
})(ProgrammingLanguage || (ProgrammingLanguage = {}));
|
|
12
|
+
/** The languages skyramp_execute_test accepts, as prose for a prompt. Rendered from
|
|
13
|
+
* the enum so the text and the gate that reads it cannot disagree. */
|
|
14
|
+
export function runnableLanguagesText() {
|
|
15
|
+
const names = Object.values(ProgrammingLanguage);
|
|
16
|
+
return `${names.slice(0, -1).join(", ")} or ${names[names.length - 1]}`;
|
|
17
|
+
}
|
|
12
18
|
export var TestType;
|
|
13
19
|
(function (TestType) {
|
|
14
20
|
TestType["SMOKE"] = "smoke";
|
|
@@ -285,26 +291,6 @@ export const codeRefactoringSchema = z.object({
|
|
|
285
291
|
.default(false)
|
|
286
292
|
.describe("Whether to modularize the code"),
|
|
287
293
|
});
|
|
288
|
-
/** The `testName` field for a recording-driven generation tool.
|
|
289
|
-
*
|
|
290
|
-
* Single-sourced because the description is prompt text: it is the only thing
|
|
291
|
-
* steering the agent's choice of title, it gets re-tuned against eval results,
|
|
292
|
-
* and two copies would let the UI and E2E tools drift apart silently. Each
|
|
293
|
-
* tool passes the title its own generator falls back to (SKYR-4468). */
|
|
294
|
-
export const testNameField = (fallbackTitle) => z
|
|
295
|
-
.string()
|
|
296
|
-
// .trim() normalises incidental whitespace and, combined with .min(1),
|
|
297
|
-
// rejects a whitespace-only title, which would otherwise produce a
|
|
298
|
-
// meaningless test title and identifier (SKYR-4468).
|
|
299
|
-
.trim()
|
|
300
|
-
.min(1)
|
|
301
|
-
.optional()
|
|
302
|
-
.describe("Title for the generated test. Name the BEHAVIOUR this recording verifies, " +
|
|
303
|
-
"taken from the recommendation the recording came from — not the page it happens on. " +
|
|
304
|
-
'Example: "Add to cart from search results", not "Search page". ' +
|
|
305
|
-
"Skyramp emits it verbatim as the Playwright test title for TypeScript/JavaScript, " +
|
|
306
|
-
"and as a snake_case `def test_<name>` identifier for Python. " +
|
|
307
|
-
`Omit it and the test stays titled \`${fallbackTitle}\`, which claims nothing.`);
|
|
308
294
|
/** Test types skyramp_enhance_assertions supports — single-sourced so the
|
|
309
295
|
* tool's schema enum and generation-time baseline seeding cannot drift
|
|
310
296
|
* (contract additionally requires provider mode at the seeding site). */
|
|
@@ -5,7 +5,6 @@ import { TestAnalysisResult, MaintenanceActionCore } from "../types/TestAnalysis
|
|
|
5
5
|
import { RepositoryAnalysis, AnalysisScope } from "../types/RepositoryAnalysis.js";
|
|
6
6
|
import { PRTestContext } from "./pr-comment-parser.js";
|
|
7
7
|
import type { RemovedUiElement } from "./removedUiElements.js";
|
|
8
|
-
import type { ExternalTestRunRecord } from "../types/ExternalTestExecution.js";
|
|
9
8
|
import type { TestExecutionRecord, VideoRecord } from "../types/TestExecution.js";
|
|
10
9
|
import type { RepoCheckout } from "./reportVerification.js";
|
|
11
10
|
import type { Plan } from "../recommendation/registerPlan.js";
|
|
@@ -209,12 +208,6 @@ export interface UnifiedAnalysisState {
|
|
|
209
208
|
/** Maintenance actions applied via skyramp_actions — skyramp_submit_report derives
|
|
210
209
|
* testMaintenance from this. */
|
|
211
210
|
maintenanceVerdicts?: MaintenanceActionCore[];
|
|
212
|
-
/**
|
|
213
|
-
* External (repo-owned) test runs recorded by skyramp_run_existing_tests, one
|
|
214
|
-
* record per confirm/verify invocation. Drift analysis and the report fold in
|
|
215
|
-
* CONFIRMED failures from here instead of guessing. Absent until the tool runs.
|
|
216
|
-
*/
|
|
217
|
-
externalTestResults?: ExternalTestRunRecord[];
|
|
218
211
|
/** POM code-reuse outcome per generated UI spec, keyed by test-file BASENAME
|
|
219
212
|
* (what `newTestsCreated[].fileName` carries). Written by skyramp_reuse_code,
|
|
220
213
|
* which computes every value in-process; skyramp_submit_report merges it into
|
|
@@ -603,7 +603,7 @@ export class StateManager {
|
|
|
603
603
|
updatedAt: new Date().toISOString(),
|
|
604
604
|
// Preserve the prior step when the caller omits one (matches
|
|
605
605
|
// repositoryPath/repository/createdAt above) so a metadata-agnostic
|
|
606
|
-
// write — e.g.
|
|
606
|
+
// write — e.g. skyramp_execute_test recording an execution —
|
|
607
607
|
// does not wipe the pipeline step recorded by an earlier phase.
|
|
608
608
|
step: options?.step ?? existingMetadata?.step,
|
|
609
609
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place a connection-level failure is spelled. Three callers match these
|
|
3
|
+
* and each reads them for its own purpose — a transient MCP error, an executor
|
|
4
|
+
* retry, and the drift prompt's "the application was unreachable" verdict — so
|
|
5
|
+
* they are kept here rather than written out three times and drifting apart.
|
|
6
|
+
*/
|
|
7
|
+
/** Refused, reset, or the socket dropped mid-request. */
|
|
8
|
+
export declare const CONNECTION_DROPPED: RegExp;
|
|
9
|
+
/** The application never answered in time. */
|
|
10
|
+
export declare const CONNECTION_TIMED_OUT: RegExp;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place a connection-level failure is spelled. Three callers match these
|
|
3
|
+
* and each reads them for its own purpose — a transient MCP error, an executor
|
|
4
|
+
* retry, and the drift prompt's "the application was unreachable" verdict — so
|
|
5
|
+
* they are kept here rather than written out three times and drifting apart.
|
|
6
|
+
*/
|
|
7
|
+
/** Refused, reset, or the socket dropped mid-request. */
|
|
8
|
+
export const CONNECTION_DROPPED = /\bECONNREFUSED\b|\bECONNRESET\b|\bconnection refused\b|\bconnection reset\b|\bsocket hang up\b/i;
|
|
9
|
+
/** The application never answered in time. */
|
|
10
|
+
export const CONNECTION_TIMED_OUT = /\bETIMEDOUT\b|\bDEADLINE_EXCEEDED\b|\bconnect(?:ion)? timed? ?out\b/i;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { SKYRAMP_SDK_VERSION } from "./skyrampSdkVersion.js";
|
|
2
|
+
/** The SDK spec the generated JavaScript and TypeScript tests need. */
|
|
3
|
+
const npmSdkSpec = `@skyramp/skyramp@${SKYRAMP_SDK_VERSION}`;
|
|
1
4
|
const pythonDependencyGuidance = `
|
|
2
5
|
Persist each missing approved package in the development manifest:
|
|
3
6
|
- Use \`uv add --dev <package>\` for a project using \`[dependency-groups].dev\`.
|
|
4
7
|
- Use \`poetry add --group dev <package>\` for a Poetry project.
|
|
5
8
|
- Add it to \`requirements-dev.txt\`, then run \`python3 -m pip install -r requirements-dev.txt\`.
|
|
6
9
|
If no Python manifest exists at the test project root, create requirements-dev.txt and seed it with the missing approved package. Do not create it alongside pyproject.toml.
|
|
10
|
+
If the repository commits poetry.lock or uv.lock, update it in the same change. Use \`poetry lock\` or \`uv lock\`; both keep the versions already locked.
|
|
7
11
|
`;
|
|
8
12
|
const javascriptDependencyGuidance = `
|
|
9
13
|
Inspect package.json before installing anything.
|
|
@@ -11,19 +15,36 @@ Inspect package.json before installing anything.
|
|
|
11
15
|
- If no JavaScript/TypeScript manifest exists at the test project root, create package.json with only \`{ "devDependencies": {} }\` before adding the missing approved package.
|
|
12
16
|
- If an approved package is missing, add it as a devDependency with the repository's package manager. The npm equivalent is \`npm install --save-dev --legacy-peer-deps <package>\`.
|
|
13
17
|
- Never add, upgrade, or downgrade Playwright or @playwright/test when either is already declared.
|
|
18
|
+
- If the repository commits a lockfile, update it in the same change. Use \`npm install --package-lock-only\`, \`yarn install --mode update-lockfile\`, \`pnpm install --lockfile-only\`, or \`bun install --lockfile-only\` for the package manager the repository uses.
|
|
19
|
+
- Do not change \`allowScripts\`, \`pnpm.onlyBuiltDependencies\`, or \`trustedDependencies\`.
|
|
14
20
|
`;
|
|
15
21
|
const javaDependencyGuidance = `
|
|
16
22
|
Inspect existing Java build signals before adding a dependency. Use an existing manifest when present.
|
|
17
23
|
- For Maven wrapper or settings signals, create a minimal pom.xml only when it is absent, and add approved dependencies with <scope>test</scope>.
|
|
18
24
|
- For Gradle wrapper or settings signals, create the matching build.gradle or build.gradle.kts only when it is absent, and use testImplementation or testRuntimeOnly.
|
|
19
25
|
- Do not introduce a competing build system. If neither build system is identified, keep the standalone runner instead of inventing one.
|
|
26
|
+
- If the repository commits gradle.lockfile, update it in the same change with the repository's Gradle wrapper (\`./gradlew dependencies --write-locks\`), or \`gradle\` only when there is no wrapper.
|
|
20
27
|
`;
|
|
21
28
|
function getJavascriptSteps(extension) {
|
|
22
|
-
return `${javascriptDependencyGuidance}
|
|
29
|
+
return `${javascriptDependencyGuidance}${sdkDeclaration("javascript")}
|
|
23
30
|
# Execute the test file
|
|
24
31
|
npx playwright test <test-file>.spec.${extension} --reporter=list
|
|
25
32
|
`;
|
|
26
33
|
}
|
|
34
|
+
/** How to declare the Skyramp SDK, per language. Kept out of the shared
|
|
35
|
+
* dependency guidance because that guidance is also returned for `mock`, and
|
|
36
|
+
* a mock is deployed rather than run as a test — it needs no SDK. */
|
|
37
|
+
const SDK_DECLARATION = {
|
|
38
|
+
python: "Declare `skyramp` in the same development manifest.",
|
|
39
|
+
javascript: `If @skyramp/skyramp is not already declared, add ${npmSdkSpec} as a devDependency. If it is declared, leave its version alone and report the mismatch if the verifier refuses it.`,
|
|
40
|
+
java: "Declare `dev.skyramp:skyramp-library` with test scope. An existing manifest resolves the version through its own dependency management; a manifest you created has none, so give a concrete version there.",
|
|
41
|
+
};
|
|
42
|
+
/** The SDK line for a language, or nothing when the language has none. */
|
|
43
|
+
function sdkDeclaration(language) {
|
|
44
|
+
const key = language === "typescript" ? "javascript" : language;
|
|
45
|
+
const line = SDK_DECLARATION[key];
|
|
46
|
+
return line ? `\n${line}\n` : "";
|
|
47
|
+
}
|
|
27
48
|
export function getLanguageSteps(params) {
|
|
28
49
|
const { language, testType } = params;
|
|
29
50
|
if (testType === "mock") {
|
|
@@ -50,7 +71,7 @@ node <mock-file>.js
|
|
|
50
71
|
let steps = "";
|
|
51
72
|
switch (language) {
|
|
52
73
|
case "python":
|
|
53
|
-
steps = pythonDependencyGuidance;
|
|
74
|
+
steps = pythonDependencyGuidance + sdkDeclaration("python");
|
|
54
75
|
// e2e and ui tests
|
|
55
76
|
if (testType === "e2e" || testType === "ui") {
|
|
56
77
|
steps += `
|
|
@@ -80,7 +101,7 @@ python3 -m robot <robot-file>.robot
|
|
|
80
101
|
steps = getJavascriptSteps("ts");
|
|
81
102
|
break;
|
|
82
103
|
case "java":
|
|
83
|
-
steps = `${javaDependencyGuidance}
|
|
104
|
+
steps = `${javaDependencyGuidance}${sdkDeclaration("java")}
|
|
84
105
|
# Prerequisites
|
|
85
106
|
# Compile the test file
|
|
86
107
|
javac -cp "./lib/*" -d target <test-file>.java
|
|
@@ -11,6 +11,6 @@ export type ProgressReporter = (progress: number, total: number, message: string
|
|
|
11
11
|
* otherwise silently no-ops.
|
|
12
12
|
*
|
|
13
13
|
* Consolidates the identical closure that previously lived inline in multiple
|
|
14
|
-
* progress-emitting tools (analyzeChanges,
|
|
14
|
+
* progress-emitting tools (analyzeChanges, startTraceCollection).
|
|
15
15
|
*/
|
|
16
16
|
export declare function makeProgressReporter(extra: RequestHandlerExtra<ServerRequest, ServerNotification>): ProgressReporter;
|
package/build/utils/progress.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* otherwise silently no-ops.
|
|
5
5
|
*
|
|
6
6
|
* Consolidates the identical closure that previously lived inline in multiple
|
|
7
|
-
* progress-emitting tools (analyzeChanges,
|
|
7
|
+
* progress-emitting tools (analyzeChanges, startTraceCollection).
|
|
8
8
|
*/
|
|
9
9
|
export function makeProgressReporter(extra) {
|
|
10
10
|
return async (progress, total, message) => {
|
|
@@ -6,7 +6,7 @@ import { z } from "zod";
|
|
|
6
6
|
*
|
|
7
7
|
* Bare filename only: no path separators, and no commas or whitespace, because the
|
|
8
8
|
* list is joined with commas into `SKYRAMP_UPDATE_SNAPSHOTS` and split again in the
|
|
9
|
-
*
|
|
9
|
+
* test runtime, where `a,b.png` would read as two baselines. One definition shared by
|
|
10
10
|
* both tools so they can never drift apart.
|
|
11
11
|
*/
|
|
12
12
|
export declare const REBASELINE_SNAPSHOT_NAME_RE: RegExp;
|
|
@@ -7,7 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
*
|
|
8
8
|
* Bare filename only: no path separators, and no commas or whitespace, because the
|
|
9
9
|
* list is joined with commas into `SKYRAMP_UPDATE_SNAPSHOTS` and split again in the
|
|
10
|
-
*
|
|
10
|
+
* test runtime, where `a,b.png` would read as two baselines. One definition shared by
|
|
11
11
|
* both tools so they can never drift apart.
|
|
12
12
|
*/
|
|
13
13
|
export const REBASELINE_SNAPSHOT_NAME_RE = /^[^/\\,\s]+\.png$/i;
|
|
@@ -22,21 +22,11 @@ export function baselineStem(name) {
|
|
|
22
22
|
return path.basename(name).replace(/\.png$/i, "");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Playwright's default snapshot layout
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `snapshotPathTemplate`
|
|
29
|
-
*
|
|
30
|
-
* relocate its snapshots out from under this rule.
|
|
31
|
-
*
|
|
32
|
-
* The executor's generated config declares no `projects`, but runner.sh passes
|
|
33
|
-
* `--browser=chromium`, so Playwright names the implicit project "chromium" and a
|
|
34
|
-
* refresh writes `<stem>-chromium-linux.png` (observed end to end on demoshop).
|
|
35
|
-
* Baselines the Skyramp executor produced therefore round-trip exactly. A baseline
|
|
36
|
-
* a repo's own CI wrote under another project name (`<stem>-Desktop-Chrome-linux.png`)
|
|
37
|
-
* is a different file: the executor's refresh adds its own and leaves that one as
|
|
38
|
-
* it was — the tool reports what it rewrote, and the repo's own suite is out of
|
|
39
|
-
* scope for skyramp_execute_test (which never runs it).
|
|
25
|
+
* Playwright's default snapshot layout: the baseline for `<stem>.png` lives in
|
|
26
|
+
* `<spec>-snapshots/` as `<stem>-<project>-<platform>.png` (or `<stem>-<platform>.png`
|
|
27
|
+
* with no project, or `<stem>.png` under a custom `snapshotPathTemplate`). A repo
|
|
28
|
+
* config that sets another `snapshotPathTemplate` moves its baselines out from under
|
|
29
|
+
* this rule; the tool then reports them as not refreshed rather than claim a refresh.
|
|
40
30
|
*
|
|
41
31
|
* Anchored so a longer baseline cannot vouch for a shorter one: `page-001-wide-chromium-linux.png`
|
|
42
32
|
* belongs to `page-001-wide.png` and must not satisfy a claim on `page-001.png`.
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
export declare function isBrowserTestType(testType?: string): boolean;
|
|
2
2
|
export declare function isModularizeFirstTarget(testType?: string, language?: string): boolean;
|
|
3
3
|
export declare function isPomAwareTarget(language: string, framework?: string, testType?: string): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Which family's inline call-site rule and sibling scan a test gets — the ONE gate
|
|
6
|
+
* for both. `api` for integration, whatever the flags (the rule is stated in API
|
|
7
|
+
* terms and predates the flag); `browser` for the seeded UI flow, where a Skyramp
|
|
8
|
+
* browser module exists to call into; `undefined` everywhere else (`contract`, `load`,
|
|
9
|
+
* e2e, an absent type, UI with the flag off or page-object reuse on), where an
|
|
10
|
+
* advisory would describe reuse the feature could not have taken. The prompt renders
|
|
11
|
+
* the rule and STEP 5c on it; the verify pass runs the scan on it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function inlineCallSiteFamily(testType?: string, language?: string): "api" | "browser" | undefined;
|
|
@@ -52,3 +52,18 @@ export function isPomAwareTarget(language, framework, testType) {
|
|
|
52
52
|
return ((lang === "typescript" || lang === "javascript") &&
|
|
53
53
|
framework?.toLowerCase() === "playwright");
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Which family's inline call-site rule and sibling scan a test gets — the ONE gate
|
|
57
|
+
* for both. `api` for integration, whatever the flags (the rule is stated in API
|
|
58
|
+
* terms and predates the flag); `browser` for the seeded UI flow, where a Skyramp
|
|
59
|
+
* browser module exists to call into; `undefined` everywhere else (`contract`, `load`,
|
|
60
|
+
* e2e, an absent type, UI with the flag off or page-object reuse on), where an
|
|
61
|
+
* advisory would describe reuse the feature could not have taken. The prompt renders
|
|
62
|
+
* the rule and STEP 5c on it; the verify pass runs the scan on it.
|
|
63
|
+
*/
|
|
64
|
+
export function inlineCallSiteFamily(testType, language) {
|
|
65
|
+
if (testType?.toLowerCase() === "integration")
|
|
66
|
+
return "api";
|
|
67
|
+
// A modularize-first target that is not integration is the seeded UI flow.
|
|
68
|
+
return isModularizeFirstTarget(testType, language) ? "browser" : undefined;
|
|
69
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ContextReading {
|
|
2
|
+
/** Tokens the last request actually carried: fresh input, cache reads and cache
|
|
3
|
+
* writes together. This is the number that fills the window. */
|
|
4
|
+
tokens: number;
|
|
5
|
+
window: number;
|
|
6
|
+
/** `tokens` as a whole percentage of `window`, for printing. */
|
|
7
|
+
percent: number;
|
|
8
|
+
}
|
|
9
|
+
/** This run's context usage, or undefined when it cannot be read.
|
|
10
|
+
*
|
|
11
|
+
* Undefined is ORDINARY, not an error: a local or IDE run has no `RUNNER_TEMP`
|
|
12
|
+
* and no agent log, and an agent whose CLI writes no NDJSON log never produces
|
|
13
|
+
* one. Every caller prints nothing and carries on. */
|
|
14
|
+
export declare function readRunContext(): ContextReading | undefined;
|
|
15
|
+
/** One sentence naming the measurement, for a refusal that has already told the
|
|
16
|
+
* agent not to stop on a context it believes it is short of. Empty when there is
|
|
17
|
+
* no reading — the refusal reads correctly without it.
|
|
18
|
+
*
|
|
19
|
+
* It states the reading and nothing else. It does not say the run has room: the
|
|
20
|
+
* reading can be 95% and the refusal still stands on its own grounds, and a
|
|
21
|
+
* sentence that argued headroom would be wrong exactly when it mattered most.
|
|
22
|
+
*
|
|
23
|
+
* CARRIES ITS OWN TRAILING SPACE, so a caller concatenates it unconditionally
|
|
24
|
+
* and an empty reading leaves no gap. */
|
|
25
|
+
export declare function contextGaugeSentence(): string;
|
|
26
|
+
/** Test seam: drop the per-run window cache. */
|
|
27
|
+
export declare function resetRunContextGaugeForTests(): void;
|