@testchimp/cli 0.1.9 → 0.1.10
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/dist/cli/program.js +25 -0
- package/dist/core/schemas.d.ts +26 -0
- package/dist/core/schemas.js +13 -0
- package/dist/core/tools.js +26 -0
- package/package.json +1 -1
package/dist/cli/program.js
CHANGED
|
@@ -508,6 +508,31 @@ export function buildCliProgram() {
|
|
|
508
508
|
const out = await runTool("upsert-screen-states", merged, { postMcp });
|
|
509
509
|
console.log(out);
|
|
510
510
|
});
|
|
511
|
+
program
|
|
512
|
+
.command("list-semantic-similar-tests")
|
|
513
|
+
.description(TOOL_DEFINITIONS.find((t) => t.kebab === "list-semantic-similar-tests").description)
|
|
514
|
+
.addOption(jsonInputOption())
|
|
515
|
+
.option("--folder-path <path>", "folder under tests root, slash-separated")
|
|
516
|
+
.action(async (opts) => {
|
|
517
|
+
const body = {};
|
|
518
|
+
const scope = {};
|
|
519
|
+
if (opts.folderPath)
|
|
520
|
+
scope.folderPath = opts.folderPath;
|
|
521
|
+
if (Object.keys(scope).length)
|
|
522
|
+
body.scope = scope;
|
|
523
|
+
const merged = mergeBodies(body, opts.jsonInput);
|
|
524
|
+
const out = await runTool("list-semantic-similar-tests", merged, { postMcp });
|
|
525
|
+
console.log(out);
|
|
526
|
+
});
|
|
527
|
+
program
|
|
528
|
+
.command("mark-semantic-tests-distinct")
|
|
529
|
+
.description(TOOL_DEFINITIONS.find((t) => t.kebab === "mark-semantic-tests-distinct").description)
|
|
530
|
+
.addOption(jsonInputOption())
|
|
531
|
+
.action(async (opts) => {
|
|
532
|
+
const merged = mergeBodies({}, opts.jsonInput);
|
|
533
|
+
const out = await runTool("mark-semantic-tests-distinct", merged, { postMcp });
|
|
534
|
+
console.log(out);
|
|
535
|
+
});
|
|
511
536
|
program.on("--help", () => {
|
|
512
537
|
/* default */
|
|
513
538
|
});
|
package/dist/core/schemas.d.ts
CHANGED
|
@@ -123,3 +123,29 @@ export declare const upsertScreenStatesInput: z.ZodObject<{
|
|
|
123
123
|
states: z.ZodArray<z.ZodString>;
|
|
124
124
|
}, z.core.$strip>>;
|
|
125
125
|
}, z.core.$strip>;
|
|
126
|
+
export declare const testLocatorSchema: z.ZodObject<{
|
|
127
|
+
folderPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
|
+
fileName: z.ZodString;
|
|
129
|
+
testSuite: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
130
|
+
testName: z.ZodString;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
export declare const listSemanticSimilarTestsInput: z.ZodObject<{
|
|
133
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
filePaths: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
135
|
+
folderPath: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
export declare const markSemanticTestsDistinctInput: z.ZodObject<{
|
|
139
|
+
focusTest: z.ZodObject<{
|
|
140
|
+
folderPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
141
|
+
fileName: z.ZodString;
|
|
142
|
+
testSuite: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
143
|
+
testName: z.ZodString;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
distinctTest: z.ZodObject<{
|
|
146
|
+
folderPath: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
147
|
+
fileName: z.ZodString;
|
|
148
|
+
testSuite: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
149
|
+
testName: z.ZodString;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
}, z.core.$strip>;
|
package/dist/core/schemas.js
CHANGED
|
@@ -125,3 +125,16 @@ const screenStatesEntrySchema = z.object({
|
|
|
125
125
|
export const upsertScreenStatesInput = z.object({
|
|
126
126
|
screenStates: z.array(screenStatesEntrySchema).min(1),
|
|
127
127
|
});
|
|
128
|
+
export const testLocatorSchema = z.object({
|
|
129
|
+
folderPath: z.array(z.string()).optional(),
|
|
130
|
+
fileName: z.string().min(1),
|
|
131
|
+
testSuite: z.array(z.string()).optional(),
|
|
132
|
+
testName: z.string().min(1),
|
|
133
|
+
});
|
|
134
|
+
export const listSemanticSimilarTestsInput = z.object({
|
|
135
|
+
scope: scopeSchema,
|
|
136
|
+
});
|
|
137
|
+
export const markSemanticTestsDistinctInput = z.object({
|
|
138
|
+
focusTest: testLocatorSchema,
|
|
139
|
+
distinctTest: testLocatorSchema,
|
|
140
|
+
});
|
package/dist/core/tools.js
CHANGED
|
@@ -396,6 +396,32 @@ export const TOOL_DEFINITIONS = [
|
|
|
396
396
|
return postMcp("/api/mcp/upsert_screen_states", { screenStates: a.screenStates });
|
|
397
397
|
},
|
|
398
398
|
},
|
|
399
|
+
{
|
|
400
|
+
kebab: "list-semantic-similar-tests",
|
|
401
|
+
description: "List semantically similar SmartTest pairs in scope using TestLocators (no test_id). " +
|
|
402
|
+
"Pairs are deduped (A→B only when A.testId < B.testId). Distinct-marked pairs are excluded.",
|
|
403
|
+
inputSchema: S.listSemanticSimilarTestsInput,
|
|
404
|
+
execute: async (args, { postMcp }) => {
|
|
405
|
+
const a = args;
|
|
406
|
+
const body = {};
|
|
407
|
+
if (a.scope != null)
|
|
408
|
+
body.scope = normalizeScope(a.scope);
|
|
409
|
+
return postMcp("/api/mcp/list_semantic_similar_tests", body);
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
kebab: "mark-semantic-tests-distinct",
|
|
414
|
+
description: "Mark two SmartTests as legitimately distinct (symmetric) using TestLocators. " +
|
|
415
|
+
"Agent/API calls use marked_by_user_id = 0.",
|
|
416
|
+
inputSchema: S.markSemanticTestsDistinctInput,
|
|
417
|
+
execute: async (args, { postMcp }) => {
|
|
418
|
+
const a = args;
|
|
419
|
+
return postMcp("/api/mcp/mark_semantic_tests_distinct", {
|
|
420
|
+
focusTest: a.focusTest,
|
|
421
|
+
distinctTest: a.distinctTest,
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
},
|
|
399
425
|
];
|
|
400
426
|
const TOOL_BY_KEBAB = new Map(TOOL_DEFINITIONS.map((t) => [t.kebab, t]));
|
|
401
427
|
export function getToolDefinition(kebab) {
|