@testchimp/cli 0.1.6 → 0.1.7
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
CHANGED
|
@@ -341,7 +341,7 @@ export function buildCliProgram() {
|
|
|
341
341
|
const out = await runTool("list-rum-environments", merged, { postMcp });
|
|
342
342
|
console.log(out);
|
|
343
343
|
});
|
|
344
|
-
const truecoverageHelp = "
|
|
344
|
+
const truecoverageHelp = "Use --json-input with full request JSON (proto-shaped; set platform inside each ExecutionScope).";
|
|
345
345
|
program
|
|
346
346
|
.command("get-truecoverage-events")
|
|
347
347
|
.description(TOOL_DEFINITIONS.find((t) => t.kebab === "get-truecoverage-events").description + " " + truecoverageHelp)
|
package/dist/core/tools.js
CHANGED
|
@@ -273,31 +273,38 @@ export const TOOL_DEFINITIONS = [
|
|
|
273
273
|
},
|
|
274
274
|
{
|
|
275
275
|
kebab: "get-truecoverage-events",
|
|
276
|
-
description: "TrueCoverage event funnel summaries (ListEventsRequest JSON: baseExecutionScope, comparisonExecutionScope)."
|
|
276
|
+
description: "TrueCoverage event funnel summaries (ListEventsRequest JSON: baseExecutionScope, comparisonExecutionScope). " +
|
|
277
|
+
"Optional ExecutionScope.platform: WEB_EXECUTION_PLATFORM | IOS_EXECUTION_PLATFORM | ANDROID_EXECUTION_PLATFORM " +
|
|
278
|
+
"(filters RUM rows stamped via testchimp-rum-platform header: web=1, ios=2, android=3). " +
|
|
279
|
+
"Use automationEmitsOnly on comparisonExecutionScope for test-tagged emits only.",
|
|
277
280
|
inputSchema: S.truecoverageJsonInput,
|
|
278
281
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_list_events", args ?? {}),
|
|
279
282
|
},
|
|
280
283
|
{
|
|
281
284
|
kebab: "get-truecoverage-event-details",
|
|
282
|
-
description: "TrueCoverage drill-down for one event title (GetEventDetailsRequest JSON)."
|
|
285
|
+
description: "TrueCoverage drill-down for one event title (GetEventDetailsRequest JSON). " +
|
|
286
|
+
"Optional platform on baseExecutionScope / comparisonExecutionScope (WEB_EXECUTION_PLATFORM, IOS_EXECUTION_PLATFORM, ANDROID_EXECUTION_PLATFORM).",
|
|
283
287
|
inputSchema: S.truecoverageJsonInput,
|
|
284
288
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_event_details", args ?? {}),
|
|
285
289
|
},
|
|
286
290
|
{
|
|
287
291
|
kebab: "get-truecoverage-child-event-tree",
|
|
288
|
-
description: "TrueCoverage next-event tree for an event (ListChildEventTreeRequest JSON)."
|
|
292
|
+
description: "TrueCoverage next-event tree for an event (ListChildEventTreeRequest JSON). " +
|
|
293
|
+
"Optional platform on baseScope / coverageScope (inside each ExecutionScope).",
|
|
289
294
|
inputSchema: S.truecoverageJsonInput,
|
|
290
295
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_list_child_event_tree", args ?? {}),
|
|
291
296
|
},
|
|
292
297
|
{
|
|
293
298
|
kebab: "get-truecoverage-event-transition",
|
|
294
|
-
description: "TrueCoverage detailed transition summary between events (GetDetailedEventTransitionSummaryRequest JSON)."
|
|
299
|
+
description: "TrueCoverage detailed transition summary between events (GetDetailedEventTransitionSummaryRequest JSON). " +
|
|
300
|
+
"Optional platform on baseScope / coverageScope (inside each ExecutionScope).",
|
|
295
301
|
inputSchema: S.truecoverageJsonInput,
|
|
296
302
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_detailed_event_transition", args ?? {}),
|
|
297
303
|
},
|
|
298
304
|
{
|
|
299
305
|
kebab: "get-truecoverage-event-time-series",
|
|
300
|
-
description: "TrueCoverage time series for sessions or metrics (EventTimeSeriesRequest JSON)."
|
|
306
|
+
description: "TrueCoverage time series for sessions or metrics (EventTimeSeriesRequest JSON). " +
|
|
307
|
+
"Optional platform on baseExecutionScope.",
|
|
301
308
|
inputSchema: S.truecoverageJsonInput,
|
|
302
309
|
execute: async (args, { postMcp }) => postMcp("/api/mcp/truecoverage_event_time_series", args ?? {}),
|
|
303
310
|
},
|
|
@@ -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
|
+
}
|