@testchimp/cli 0.1.6 → 0.1.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.
- package/dist/cli/program.d.ts +1 -1
- package/dist/cli/program.js +33 -2
- package/dist/core/schemas.d.ts +6 -0
- package/dist/core/schemas.js +8 -0
- package/dist/core/tools.js +23 -5
- package/dist/core/truecoverageScope.d.ts +16 -0
- package/dist/core/truecoverageScope.js +74 -0
- package/dist/mcp/server.js +1 -1
- package/package.json +1 -1
package/dist/cli/program.d.ts
CHANGED
package/dist/cli/program.js
CHANGED
|
@@ -5,7 +5,26 @@ import { DEFAULT_BACKEND, postMcp } from "../core/client.js";
|
|
|
5
5
|
import { deepMerge } from "../core/merge.js";
|
|
6
6
|
import { runTool } from "../core/tools.js";
|
|
7
7
|
import { TOOL_DEFINITIONS } from "../core/tools.js";
|
|
8
|
-
export const PACKAGE_VERSION = "0.1.
|
|
8
|
+
export const PACKAGE_VERSION = "0.1.7";
|
|
9
|
+
function parseRecordTypesCsv(raw) {
|
|
10
|
+
return String(raw)
|
|
11
|
+
.split(",")
|
|
12
|
+
.map((s) => s.trim())
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.map((s) => s.toLowerCase())
|
|
15
|
+
.map((s) => {
|
|
16
|
+
if (s === "automated")
|
|
17
|
+
return "smart_test";
|
|
18
|
+
if (s === "smarttest")
|
|
19
|
+
return "smart_test";
|
|
20
|
+
if (s === "smart_test")
|
|
21
|
+
return "smart_test";
|
|
22
|
+
if (s === "manual")
|
|
23
|
+
return "manual";
|
|
24
|
+
return s;
|
|
25
|
+
})
|
|
26
|
+
.filter((v) => v === "smart_test" || v === "manual");
|
|
27
|
+
}
|
|
9
28
|
function parseJsonInput(raw) {
|
|
10
29
|
if (raw == null || raw.trim() === "")
|
|
11
30
|
return {};
|
|
@@ -47,6 +66,9 @@ export function buildCliProgram() {
|
|
|
47
66
|
.option("--environment <s>")
|
|
48
67
|
.option("--branch-name <s>")
|
|
49
68
|
.option("--platform <web|ios|android>")
|
|
69
|
+
.option("--record-types <csv>", "coverage sources: smart_test,manual (aliases: automated,smarttest)")
|
|
70
|
+
.option("--include-manual", "include manual sessions in addition to automated (default)")
|
|
71
|
+
.option("--manual-only", "manual-only coverage (no automated)")
|
|
50
72
|
.option("--file-paths <csv>", "comma-separated paths under platform tests root")
|
|
51
73
|
.option("--folder-path <path>", "folder under tests root, slash-separated")
|
|
52
74
|
.action(async (opts) => {
|
|
@@ -59,6 +81,15 @@ export function buildCliProgram() {
|
|
|
59
81
|
body.branchName = opts.branchName;
|
|
60
82
|
if (opts.platform)
|
|
61
83
|
body.platform = opts.platform;
|
|
84
|
+
let recordTypes;
|
|
85
|
+
if (opts.recordTypes)
|
|
86
|
+
recordTypes = parseRecordTypesCsv(String(opts.recordTypes));
|
|
87
|
+
if (opts.includeManual)
|
|
88
|
+
recordTypes = Array.from(new Set([...(recordTypes ?? ["smart_test"]), "manual"]));
|
|
89
|
+
if (opts.manualOnly)
|
|
90
|
+
recordTypes = ["manual"];
|
|
91
|
+
if (recordTypes && recordTypes.length > 0)
|
|
92
|
+
body.recordTypes = recordTypes;
|
|
62
93
|
const scope = {};
|
|
63
94
|
if (opts.filePaths)
|
|
64
95
|
scope.filePaths = String(opts.filePaths).split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -341,7 +372,7 @@ export function buildCliProgram() {
|
|
|
341
372
|
const out = await runTool("list-rum-environments", merged, { postMcp });
|
|
342
373
|
console.log(out);
|
|
343
374
|
});
|
|
344
|
-
const truecoverageHelp = "
|
|
375
|
+
const truecoverageHelp = "Use --json-input with full request JSON (proto-shaped; set platform inside each ExecutionScope).";
|
|
345
376
|
program
|
|
346
377
|
.command("get-truecoverage-events")
|
|
347
378
|
.description(TOOL_DEFINITIONS.find((t) => t.kebab === "get-truecoverage-events").description + " " + truecoverageHelp)
|
package/dist/core/schemas.d.ts
CHANGED
|
@@ -22,6 +22,12 @@ export declare const listCoverageInput: z.ZodObject<{
|
|
|
22
22
|
ios: "ios";
|
|
23
23
|
android: "android";
|
|
24
24
|
}>>;
|
|
25
|
+
recordTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
26
|
+
smart_test: "smart_test";
|
|
27
|
+
manual: "manual";
|
|
28
|
+
SMART_TEST: "SMART_TEST";
|
|
29
|
+
MANUAL: "MANUAL";
|
|
30
|
+
}>>>;
|
|
25
31
|
}, z.core.$strip>;
|
|
26
32
|
export declare const listExecutionInput: z.ZodObject<{
|
|
27
33
|
release: z.ZodOptional<z.ZodString>;
|
package/dist/core/schemas.js
CHANGED
|
@@ -6,6 +6,7 @@ export const scopeSchema = z
|
|
|
6
6
|
})
|
|
7
7
|
.optional();
|
|
8
8
|
const executionPlatformSchema = z.enum(["web", "ios", "android"]);
|
|
9
|
+
const requirementCoverageRecordTypeSchema = z.enum(["smart_test", "manual", "SMART_TEST", "MANUAL"]);
|
|
9
10
|
export const executionJobDimensionFilterSchema = z.object({
|
|
10
11
|
dimension: z.string().min(1),
|
|
11
12
|
values: z.array(z.string()).min(1),
|
|
@@ -18,6 +19,13 @@ export const listCoverageInput = z.object({
|
|
|
18
19
|
includeNonCoveredTestScenarios: z.boolean().optional(),
|
|
19
20
|
branchName: z.string().optional(),
|
|
20
21
|
platform: executionPlatformSchema.optional(),
|
|
22
|
+
/**
|
|
23
|
+
* Which coverage sources to include.
|
|
24
|
+
*
|
|
25
|
+
* Omit for legacy default: SMART_TEST only.
|
|
26
|
+
* When provided, send proto enum names ("SMART_TEST", "MANUAL") or CLI-friendly aliases ("smart_test", "manual").
|
|
27
|
+
*/
|
|
28
|
+
recordTypes: z.array(requirementCoverageRecordTypeSchema).optional(),
|
|
21
29
|
});
|
|
22
30
|
export const listExecutionInput = z.object({
|
|
23
31
|
release: z.string().optional(),
|
package/dist/core/tools.js
CHANGED
|
@@ -28,6 +28,17 @@ function listCoverageBody(args) {
|
|
|
28
28
|
body.branchName = args.branchName.trim();
|
|
29
29
|
if (args.platform != null)
|
|
30
30
|
body.platform = platformToProtoEnum(args.platform);
|
|
31
|
+
if (args.recordTypes != null && args.recordTypes.length > 0) {
|
|
32
|
+
const normalized = args.recordTypes.map((t) => {
|
|
33
|
+
const raw = String(t).trim();
|
|
34
|
+
if (raw === "manual")
|
|
35
|
+
return "MANUAL";
|
|
36
|
+
if (raw === "smart_test")
|
|
37
|
+
return "SMART_TEST";
|
|
38
|
+
return raw;
|
|
39
|
+
});
|
|
40
|
+
body.recordTypes = normalized;
|
|
41
|
+
}
|
|
31
42
|
return body;
|
|
32
43
|
}
|
|
33
44
|
function listExecutionBody(args) {
|
|
@@ -273,31 +284,38 @@ export const TOOL_DEFINITIONS = [
|
|
|
273
284
|
},
|
|
274
285
|
{
|
|
275
286
|
kebab: "get-truecoverage-events",
|
|
276
|
-
description: "TrueCoverage event funnel summaries (ListEventsRequest JSON: baseExecutionScope, comparisonExecutionScope)."
|
|
287
|
+
description: "TrueCoverage event funnel summaries (ListEventsRequest JSON: baseExecutionScope, comparisonExecutionScope). " +
|
|
288
|
+
"Optional ExecutionScope.platform: WEB_EXECUTION_PLATFORM | IOS_EXECUTION_PLATFORM | ANDROID_EXECUTION_PLATFORM " +
|
|
289
|
+
"(filters RUM rows stamped via testchimp-rum-platform header: web=1, ios=2, android=3). " +
|
|
290
|
+
"Use automationEmitsOnly on comparisonExecutionScope for test-tagged emits only.",
|
|
277
291
|
inputSchema: S.truecoverageJsonInput,
|
|
278
292
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_list_events", args ?? {}),
|
|
279
293
|
},
|
|
280
294
|
{
|
|
281
295
|
kebab: "get-truecoverage-event-details",
|
|
282
|
-
description: "TrueCoverage drill-down for one event title (GetEventDetailsRequest JSON)."
|
|
296
|
+
description: "TrueCoverage drill-down for one event title (GetEventDetailsRequest JSON). " +
|
|
297
|
+
"Optional platform on baseExecutionScope / comparisonExecutionScope (WEB_EXECUTION_PLATFORM, IOS_EXECUTION_PLATFORM, ANDROID_EXECUTION_PLATFORM).",
|
|
283
298
|
inputSchema: S.truecoverageJsonInput,
|
|
284
299
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_event_details", args ?? {}),
|
|
285
300
|
},
|
|
286
301
|
{
|
|
287
302
|
kebab: "get-truecoverage-child-event-tree",
|
|
288
|
-
description: "TrueCoverage next-event tree for an event (ListChildEventTreeRequest JSON)."
|
|
303
|
+
description: "TrueCoverage next-event tree for an event (ListChildEventTreeRequest JSON). " +
|
|
304
|
+
"Optional platform on baseScope / coverageScope (inside each ExecutionScope).",
|
|
289
305
|
inputSchema: S.truecoverageJsonInput,
|
|
290
306
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_list_child_event_tree", args ?? {}),
|
|
291
307
|
},
|
|
292
308
|
{
|
|
293
309
|
kebab: "get-truecoverage-event-transition",
|
|
294
|
-
description: "TrueCoverage detailed transition summary between events (GetDetailedEventTransitionSummaryRequest JSON)."
|
|
310
|
+
description: "TrueCoverage detailed transition summary between events (GetDetailedEventTransitionSummaryRequest JSON). " +
|
|
311
|
+
"Optional platform on baseScope / coverageScope (inside each ExecutionScope).",
|
|
295
312
|
inputSchema: S.truecoverageJsonInput,
|
|
296
313
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_detailed_event_transition", args ?? {}),
|
|
297
314
|
},
|
|
298
315
|
{
|
|
299
316
|
kebab: "get-truecoverage-event-time-series",
|
|
300
|
-
description: "TrueCoverage time series for sessions or metrics (EventTimeSeriesRequest JSON)."
|
|
317
|
+
description: "TrueCoverage time series for sessions or metrics (EventTimeSeriesRequest JSON). " +
|
|
318
|
+
"Optional platform on baseExecutionScope.",
|
|
301
319
|
inputSchema: S.truecoverageJsonInput,
|
|
302
320
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_event_time_series", args ?? {}),
|
|
303
321
|
},
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Maps CLI/MCP shorthand to {@code com.aware.common.ExecutionPlatform} JSON enum names. */
|
|
2
|
+
export declare function platformToProtoEnum(platform: "web" | "ios" | "android"): string;
|
|
3
|
+
export type TruecoveragePlatformCli = "web" | "ios" | "android";
|
|
4
|
+
export interface TruecoveragePlatformOpts {
|
|
5
|
+
base?: TruecoveragePlatformCli;
|
|
6
|
+
/** Secondary / coverage-aligned scope (`comparisonExecutionScope` or `coverageScope` per endpoint). */
|
|
7
|
+
comparison?: TruecoveragePlatformCli;
|
|
8
|
+
}
|
|
9
|
+
/** MCP/CLI top-level shortcuts (`basePlatform`, …) stripped before POST. */
|
|
10
|
+
export declare function parseTruecoveragePlatformArgs(args: unknown): TruecoveragePlatformOpts | undefined;
|
|
11
|
+
export declare function stripTruecoveragePlatformShortcuts(body: Record<string, unknown>): Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Apply CLI/MCP platform shortcuts onto nested execution scopes (scope.platform in JSON wins).
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyTruecoveragePlatforms(body: Record<string, unknown>, opts?: TruecoveragePlatformOpts): Record<string, unknown>;
|
|
16
|
+
export declare function prepareTruecoverageRequestBody(args: unknown): Record<string, unknown>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** Maps CLI/MCP shorthand to {@code com.aware.common.ExecutionPlatform} JSON enum names. */
|
|
2
|
+
export function platformToProtoEnum(platform) {
|
|
3
|
+
switch (platform) {
|
|
4
|
+
case "ios":
|
|
5
|
+
return "IOS_EXECUTION_PLATFORM";
|
|
6
|
+
case "android":
|
|
7
|
+
return "ANDROID_EXECUTION_PLATFORM";
|
|
8
|
+
default:
|
|
9
|
+
return "WEB_EXECUTION_PLATFORM";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function setScopePlatform(scope, platform) {
|
|
13
|
+
if (!scope)
|
|
14
|
+
return;
|
|
15
|
+
scope.platform = platformToProtoEnum(platform);
|
|
16
|
+
}
|
|
17
|
+
function pickPlatformCli(v) {
|
|
18
|
+
if (v === "web" || v === "ios" || v === "android")
|
|
19
|
+
return v;
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/** MCP/CLI top-level shortcuts (`basePlatform`, …) stripped before POST. */
|
|
23
|
+
export function parseTruecoveragePlatformArgs(args) {
|
|
24
|
+
if (args == null || typeof args !== "object")
|
|
25
|
+
return undefined;
|
|
26
|
+
const a = args;
|
|
27
|
+
const base = pickPlatformCli(a.basePlatform);
|
|
28
|
+
const comparison = pickPlatformCli(a.comparisonPlatform) ?? pickPlatformCli(a.coveragePlatform);
|
|
29
|
+
if (base == null && comparison == null)
|
|
30
|
+
return undefined;
|
|
31
|
+
return { base, comparison };
|
|
32
|
+
}
|
|
33
|
+
export function stripTruecoveragePlatformShortcuts(body) {
|
|
34
|
+
const { basePlatform: _b, comparisonPlatform: _c, coveragePlatform: _v, ...rest } = body;
|
|
35
|
+
return rest;
|
|
36
|
+
}
|
|
37
|
+
function mergeScopePlatform(scope, platform) {
|
|
38
|
+
if (scope == null || scope.platform != null)
|
|
39
|
+
return scope;
|
|
40
|
+
const next = { ...scope };
|
|
41
|
+
setScopePlatform(next, platform);
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Apply CLI/MCP platform shortcuts onto nested execution scopes (scope.platform in JSON wins).
|
|
46
|
+
*/
|
|
47
|
+
export function applyTruecoveragePlatforms(body, opts) {
|
|
48
|
+
if (!opts)
|
|
49
|
+
return body;
|
|
50
|
+
const out = { ...body };
|
|
51
|
+
if (opts.base != null) {
|
|
52
|
+
const nextBase = mergeScopePlatform(out.baseExecutionScope, opts.base);
|
|
53
|
+
if (nextBase != null)
|
|
54
|
+
out.baseExecutionScope = nextBase;
|
|
55
|
+
const nextBaseScope = mergeScopePlatform(out.baseScope, opts.base);
|
|
56
|
+
if (nextBaseScope != null)
|
|
57
|
+
out.baseScope = nextBaseScope;
|
|
58
|
+
}
|
|
59
|
+
if (opts.comparison != null) {
|
|
60
|
+
const nextComp = mergeScopePlatform(out.comparisonExecutionScope, opts.comparison);
|
|
61
|
+
if (nextComp != null)
|
|
62
|
+
out.comparisonExecutionScope = nextComp;
|
|
63
|
+
const nextCov = mergeScopePlatform(out.coverageScope, opts.comparison);
|
|
64
|
+
if (nextCov != null)
|
|
65
|
+
out.coverageScope = nextCov;
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
export function prepareTruecoverageRequestBody(args) {
|
|
70
|
+
const raw = args ?? {};
|
|
71
|
+
const platformOpts = parseTruecoveragePlatformArgs(raw);
|
|
72
|
+
const stripped = stripTruecoveragePlatformShortcuts({ ...raw });
|
|
73
|
+
return applyTruecoveragePlatforms(stripped, platformOpts);
|
|
74
|
+
}
|
package/dist/mcp/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { postMcp } from "../core/client.js";
|
|
4
4
|
import { TOOL_DEFINITIONS, runTool } from "../core/tools.js";
|
|
5
|
-
const PACKAGE_VERSION = "0.1.
|
|
5
|
+
const PACKAGE_VERSION = "0.1.7";
|
|
6
6
|
function textResult(json) {
|
|
7
7
|
return {
|
|
8
8
|
content: [{ type: "text", text: json }],
|