@testchimp/cli 0.1.29 → 0.1.30

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.
@@ -55,7 +55,9 @@ function addAgentTraceabilityOptions(cmd) {
55
55
  .option("--actor-type <type>", "LOCAL_AGENT | CLOUD_AGENT")
56
56
  .option("--user-id <id>", "Optional user id")
57
57
  .option("--branch-name <name>", "Git branch name")
58
- .option("--agent-model <model>", "Optional agent model id (agent/CLI only)");
58
+ .option("--agent-model <model>", "Optional agent model id (agent/CLI only)")
59
+ .option("--skill-version <semver>", "TestChimp skill version from SKILL.md frontmatter")
60
+ .option("--cli-version <semver>", "CLI version (defaults to this package version)");
59
61
  }
60
62
  function collectAgentTraceabilityFlags(opts) {
61
63
  const body = {};
@@ -77,6 +79,10 @@ function collectAgentTraceabilityFlags(opts) {
77
79
  body.branchName = String(opts.branchName).trim();
78
80
  if (opts.agentModel)
79
81
  body.agentModel = String(opts.agentModel).trim();
82
+ if (opts.skillVersion)
83
+ body.skillVersion = String(opts.skillVersion).trim();
84
+ if (opts.cliVersion)
85
+ body.cliVersion = String(opts.cliVersion).trim();
80
86
  return body;
81
87
  }
82
88
  function stderrProgress(msg) {
@@ -1119,6 +1125,8 @@ export function buildCliProgram() {
1119
1125
  .option("--user-id <id>", "Optional user id for traceability")
1120
1126
  .option("--branch-name <name>", "Git branch")
1121
1127
  .option("--agent-model <model>", "Optional agent model id (agent/CLI only)")
1128
+ .option("--skill-version <semver>", "TestChimp skill version from SKILL.md frontmatter")
1129
+ .option("--cli-version <semver>", "CLI version (defaults to this package version)")
1122
1130
  .requiredOption("--entity-type <type>", "USER_STORY|SCENARIO|SMART_TEST|POLICY|ISSUE|TEST_EXECUTION|TEST_INVOCATION_BATCH|EXPLORATION|EVENT|WORKFLOW")
1123
1131
  .option("--entity-identity <ordinal>", "Project-scoped ordinal id (mutually exclusive with --test-json)")
1124
1132
  .option("--test-json <json>", "TestLocator JSON (folderPath/fileName/testSuite/testName)")
@@ -1144,6 +1152,10 @@ export function buildCliProgram() {
1144
1152
  body.branchName = String(opts.branchName);
1145
1153
  if (opts.agentModel)
1146
1154
  body.agentModel = String(opts.agentModel).trim();
1155
+ if (opts.skillVersion)
1156
+ body.skillVersion = String(opts.skillVersion).trim();
1157
+ if (opts.cliVersion)
1158
+ body.cliVersion = String(opts.cliVersion).trim();
1147
1159
  if (opts.entityIdentity)
1148
1160
  body.entityIdentity = String(opts.entityIdentity);
1149
1161
  if (opts.testJson)
@@ -9,9 +9,23 @@ export type AgentTraceabilityFields = {
9
9
  userId?: string;
10
10
  branchName?: string;
11
11
  agentModel?: string;
12
+ skillVersion?: string;
13
+ cliVersion?: string;
12
14
  /** Nested form (wins over flat when both present and non-empty). */
13
15
  agentTraceability?: Record<string, unknown>;
14
16
  };
17
+ /**
18
+ * Resolve skill / CLI versions for traceability payloads.
19
+ * CLI version defaults to this package's version; skill version from flag/env only.
20
+ */
21
+ export declare function resolveToolchainVersions(a: {
22
+ skillVersion?: string;
23
+ cliVersion?: string;
24
+ nested?: Record<string, unknown> | null;
25
+ }): {
26
+ skillVersion?: string;
27
+ cliVersion?: string;
28
+ };
15
29
  /**
16
30
  * Build camelCase AgentActionTraceability for MCP JSON bodies.
17
31
  * Returns undefined unless the caller supplied explicit traceability intent
@@ -19,7 +33,7 @@ export type AgentTraceabilityFields = {
19
33
  * For Activity/timeline attachment the server also requires workflowExecutionId
20
34
  * (stable Plan ULID for the whole run) — omit it and the mutation still succeeds
21
35
  * but no workflow_executions / Activity row is recorded (server does not auto-mint).
22
- * Auto-fills gitSha / agentModel / userId only after the workflowId bar is met.
36
+ * Auto-fills gitSha / agentModel / userId / cliVersion only after the workflowId bar is met.
23
37
  * Non-empty nested `agentTraceability` wins over flat for overlapping keys.
24
38
  */
25
39
  export declare function buildAgentTraceabilityPayload(a: AgentTraceabilityFields): Record<string, unknown> | undefined;
@@ -1,4 +1,5 @@
1
1
  import { resolveGitHeadSha } from "./gitSha.js";
2
+ import { PACKAGE_VERSION } from "./version.js";
2
3
  function nonEmptyString(v) {
3
4
  if (v == null)
4
5
  return undefined;
@@ -24,6 +25,10 @@ function hasExplicitTraceabilityIntent(a) {
24
25
  return true;
25
26
  if (nonEmptyString(a.agentModel))
26
27
  return true;
28
+ if (nonEmptyString(a.skillVersion))
29
+ return true;
30
+ if (nonEmptyString(a.cliVersion))
31
+ return true;
27
32
  if (a.agentTraceability && typeof a.agentTraceability === "object") {
28
33
  return Object.keys(a.agentTraceability).some((k) => nonEmptyString(a.agentTraceability[k]) != null);
29
34
  }
@@ -39,6 +44,20 @@ function normalizeActorType(raw) {
39
44
  return "LOCAL_AGENT";
40
45
  return undefined;
41
46
  }
47
+ /**
48
+ * Resolve skill / CLI versions for traceability payloads.
49
+ * CLI version defaults to this package's version; skill version from flag/env only.
50
+ */
51
+ export function resolveToolchainVersions(a) {
52
+ const skillVersion = nonEmptyString(a.nested?.skillVersion) ??
53
+ nonEmptyString(a.skillVersion) ??
54
+ nonEmptyString(process.env.TESTCHIMP_SKILL_VERSION);
55
+ const cliVersion = nonEmptyString(a.nested?.cliVersion) ??
56
+ nonEmptyString(a.cliVersion) ??
57
+ nonEmptyString(process.env.TESTCHIMP_CLI_VERSION) ??
58
+ PACKAGE_VERSION;
59
+ return { skillVersion, cliVersion };
60
+ }
42
61
  /**
43
62
  * Build camelCase AgentActionTraceability for MCP JSON bodies.
44
63
  * Returns undefined unless the caller supplied explicit traceability intent
@@ -46,7 +65,7 @@ function normalizeActorType(raw) {
46
65
  * For Activity/timeline attachment the server also requires workflowExecutionId
47
66
  * (stable Plan ULID for the whole run) — omit it and the mutation still succeeds
48
67
  * but no workflow_executions / Activity row is recorded (server does not auto-mint).
49
- * Auto-fills gitSha / agentModel / userId only after the workflowId bar is met.
68
+ * Auto-fills gitSha / agentModel / userId / cliVersion only after the workflowId bar is met.
50
69
  * Non-empty nested `agentTraceability` wins over flat for overlapping keys.
51
70
  */
52
71
  export function buildAgentTraceabilityPayload(a) {
@@ -72,6 +91,11 @@ export function buildAgentTraceabilityPayload(a) {
72
91
  const agentModel = nonEmptyString(nested?.agentModel) ??
73
92
  nonEmptyString(a.agentModel) ??
74
93
  nonEmptyString(process.env.TESTCHIMP_AGENT_MODEL);
94
+ const { skillVersion, cliVersion } = resolveToolchainVersions({
95
+ skillVersion: a.skillVersion,
96
+ cliVersion: a.cliVersion,
97
+ nested,
98
+ });
75
99
  // Server requires workflow_id for inline mutation Activity — do not send orphan payloads.
76
100
  if (!workflowId) {
77
101
  return undefined;
@@ -94,5 +118,9 @@ export function buildAgentTraceabilityPayload(a) {
94
118
  out.branchName = branchName;
95
119
  if (agentModel)
96
120
  out.agentModel = agentModel;
121
+ if (skillVersion)
122
+ out.skillVersion = skillVersion;
123
+ if (cliVersion)
124
+ out.cliVersion = cliVersion;
97
125
  return out;
98
126
  }
@@ -105,6 +105,8 @@ export declare const agentActionTraceabilitySchema: z.ZodObject<{
105
105
  userId: z.ZodOptional<z.ZodString>;
106
106
  branchName: z.ZodOptional<z.ZodString>;
107
107
  agentModel: z.ZodOptional<z.ZodString>;
108
+ skillVersion: z.ZodOptional<z.ZodString>;
109
+ cliVersion: z.ZodOptional<z.ZodString>;
108
110
  }, z.core.$strict>;
109
111
  /** Flat + nested traceability fields shared by create/update MCP tools. */
110
112
  export declare const agentTraceabilityFieldsSchema: z.ZodObject<{
@@ -122,6 +124,8 @@ export declare const agentTraceabilityFieldsSchema: z.ZodObject<{
122
124
  userId: z.ZodOptional<z.ZodString>;
123
125
  branchName: z.ZodOptional<z.ZodString>;
124
126
  agentModel: z.ZodOptional<z.ZodString>;
127
+ skillVersion: z.ZodOptional<z.ZodString>;
128
+ cliVersion: z.ZodOptional<z.ZodString>;
125
129
  agentTraceability: z.ZodOptional<z.ZodObject<{
126
130
  workflowId: z.ZodOptional<z.ZodString>;
127
131
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -137,6 +141,8 @@ export declare const agentTraceabilityFieldsSchema: z.ZodObject<{
137
141
  userId: z.ZodOptional<z.ZodString>;
138
142
  branchName: z.ZodOptional<z.ZodString>;
139
143
  agentModel: z.ZodOptional<z.ZodString>;
144
+ skillVersion: z.ZodOptional<z.ZodString>;
145
+ cliVersion: z.ZodOptional<z.ZodString>;
140
146
  }, z.core.$strict>>;
141
147
  }, z.core.$strip>;
142
148
  export declare const createUserStoryInput: z.ZodObject<{
@@ -156,6 +162,8 @@ export declare const createUserStoryInput: z.ZodObject<{
156
162
  userId: z.ZodOptional<z.ZodString>;
157
163
  branchName: z.ZodOptional<z.ZodString>;
158
164
  agentModel: z.ZodOptional<z.ZodString>;
165
+ skillVersion: z.ZodOptional<z.ZodString>;
166
+ cliVersion: z.ZodOptional<z.ZodString>;
159
167
  agentTraceability: z.ZodOptional<z.ZodObject<{
160
168
  workflowId: z.ZodOptional<z.ZodString>;
161
169
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -171,6 +179,8 @@ export declare const createUserStoryInput: z.ZodObject<{
171
179
  userId: z.ZodOptional<z.ZodString>;
172
180
  branchName: z.ZodOptional<z.ZodString>;
173
181
  agentModel: z.ZodOptional<z.ZodString>;
182
+ skillVersion: z.ZodOptional<z.ZodString>;
183
+ cliVersion: z.ZodOptional<z.ZodString>;
174
184
  }, z.core.$strict>>;
175
185
  }, z.core.$strip>;
176
186
  export declare const createTestScenarioInput: z.ZodObject<{
@@ -191,6 +201,8 @@ export declare const createTestScenarioInput: z.ZodObject<{
191
201
  userId: z.ZodOptional<z.ZodString>;
192
202
  branchName: z.ZodOptional<z.ZodString>;
193
203
  agentModel: z.ZodOptional<z.ZodString>;
204
+ skillVersion: z.ZodOptional<z.ZodString>;
205
+ cliVersion: z.ZodOptional<z.ZodString>;
194
206
  agentTraceability: z.ZodOptional<z.ZodObject<{
195
207
  workflowId: z.ZodOptional<z.ZodString>;
196
208
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -206,6 +218,8 @@ export declare const createTestScenarioInput: z.ZodObject<{
206
218
  userId: z.ZodOptional<z.ZodString>;
207
219
  branchName: z.ZodOptional<z.ZodString>;
208
220
  agentModel: z.ZodOptional<z.ZodString>;
221
+ skillVersion: z.ZodOptional<z.ZodString>;
222
+ cliVersion: z.ZodOptional<z.ZodString>;
209
223
  }, z.core.$strict>>;
210
224
  }, z.core.$strip>;
211
225
  export declare const updatePlanMarkdownInput: z.ZodObject<{
@@ -224,6 +238,8 @@ export declare const updatePlanMarkdownInput: z.ZodObject<{
224
238
  userId: z.ZodOptional<z.ZodString>;
225
239
  branchName: z.ZodOptional<z.ZodString>;
226
240
  agentModel: z.ZodOptional<z.ZodString>;
241
+ skillVersion: z.ZodOptional<z.ZodString>;
242
+ cliVersion: z.ZodOptional<z.ZodString>;
227
243
  agentTraceability: z.ZodOptional<z.ZodObject<{
228
244
  workflowId: z.ZodOptional<z.ZodString>;
229
245
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -239,6 +255,8 @@ export declare const updatePlanMarkdownInput: z.ZodObject<{
239
255
  userId: z.ZodOptional<z.ZodString>;
240
256
  branchName: z.ZodOptional<z.ZodString>;
241
257
  agentModel: z.ZodOptional<z.ZodString>;
258
+ skillVersion: z.ZodOptional<z.ZodString>;
259
+ cliVersion: z.ZodOptional<z.ZodString>;
242
260
  }, z.core.$strict>>;
243
261
  }, z.core.$strip>;
244
262
  export declare const markPlanItemsImplementationDoneInput: z.ZodObject<{
@@ -297,6 +315,8 @@ export declare const updateIssueStatusInput: z.ZodObject<{
297
315
  userId: z.ZodOptional<z.ZodString>;
298
316
  branchName: z.ZodOptional<z.ZodString>;
299
317
  agentModel: z.ZodOptional<z.ZodString>;
318
+ skillVersion: z.ZodOptional<z.ZodString>;
319
+ cliVersion: z.ZodOptional<z.ZodString>;
300
320
  agentTraceability: z.ZodOptional<z.ZodObject<{
301
321
  workflowId: z.ZodOptional<z.ZodString>;
302
322
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -312,6 +332,8 @@ export declare const updateIssueStatusInput: z.ZodObject<{
312
332
  userId: z.ZodOptional<z.ZodString>;
313
333
  branchName: z.ZodOptional<z.ZodString>;
314
334
  agentModel: z.ZodOptional<z.ZodString>;
335
+ skillVersion: z.ZodOptional<z.ZodString>;
336
+ cliVersion: z.ZodOptional<z.ZodString>;
315
337
  }, z.core.$strict>>;
316
338
  }, z.core.$strip>;
317
339
  export declare const createIssueInput: z.ZodObject<{
@@ -393,6 +415,8 @@ export declare const createIssueInput: z.ZodObject<{
393
415
  userId: z.ZodOptional<z.ZodString>;
394
416
  branchName: z.ZodOptional<z.ZodString>;
395
417
  agentModel: z.ZodOptional<z.ZodString>;
418
+ skillVersion: z.ZodOptional<z.ZodString>;
419
+ cliVersion: z.ZodOptional<z.ZodString>;
396
420
  agentTraceability: z.ZodOptional<z.ZodObject<{
397
421
  workflowId: z.ZodOptional<z.ZodString>;
398
422
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -408,6 +432,8 @@ export declare const createIssueInput: z.ZodObject<{
408
432
  userId: z.ZodOptional<z.ZodString>;
409
433
  branchName: z.ZodOptional<z.ZodString>;
410
434
  agentModel: z.ZodOptional<z.ZodString>;
435
+ skillVersion: z.ZodOptional<z.ZodString>;
436
+ cliVersion: z.ZodOptional<z.ZodString>;
411
437
  }, z.core.$strict>>;
412
438
  }, z.core.$strip>;
413
439
  export declare const emptyInput: z.ZodObject<{}, z.core.$strip>;
@@ -1364,6 +1390,8 @@ export declare const reportAgentActionInput: z.ZodObject<{
1364
1390
  userId: z.ZodOptional<z.ZodString>;
1365
1391
  branchName: z.ZodOptional<z.ZodString>;
1366
1392
  agentModel: z.ZodOptional<z.ZodString>;
1393
+ skillVersion: z.ZodOptional<z.ZodString>;
1394
+ cliVersion: z.ZodOptional<z.ZodString>;
1367
1395
  traceability: z.ZodOptional<z.ZodObject<{
1368
1396
  workflowId: z.ZodOptional<z.ZodString>;
1369
1397
  workflowExecutionId: z.ZodOptional<z.ZodString>;
@@ -1379,6 +1407,8 @@ export declare const reportAgentActionInput: z.ZodObject<{
1379
1407
  userId: z.ZodOptional<z.ZodString>;
1380
1408
  branchName: z.ZodOptional<z.ZodString>;
1381
1409
  agentModel: z.ZodOptional<z.ZodString>;
1410
+ skillVersion: z.ZodOptional<z.ZodString>;
1411
+ cliVersion: z.ZodOptional<z.ZodString>;
1382
1412
  }, z.core.$strict>>;
1383
1413
  entityType: z.ZodEnum<{
1384
1414
  SMART_TEST: "SMART_TEST";
@@ -82,6 +82,8 @@ export const agentActionTraceabilitySchema = z
82
82
  userId: z.string().optional(),
83
83
  branchName: z.string().optional(),
84
84
  agentModel: z.string().optional(),
85
+ skillVersion: z.string().optional(),
86
+ cliVersion: z.string().optional(),
85
87
  })
86
88
  .strict();
87
89
  /** Flat + nested traceability fields shared by create/update MCP tools. */
@@ -95,6 +97,8 @@ export const agentTraceabilityFieldsSchema = z.object({
95
97
  userId: z.string().optional(),
96
98
  branchName: z.string().optional(),
97
99
  agentModel: z.string().optional(),
100
+ skillVersion: z.string().optional(),
101
+ cliVersion: z.string().optional(),
98
102
  agentTraceability: agentActionTraceabilitySchema.optional(),
99
103
  });
100
104
  export const createUserStoryInput = z.object({
@@ -687,6 +691,8 @@ export const reportAgentActionInput = z
687
691
  userId: z.string().optional(),
688
692
  branchName: z.string().optional(),
689
693
  agentModel: z.string().optional(),
694
+ skillVersion: z.string().optional(),
695
+ cliVersion: z.string().optional(),
690
696
  traceability: agentActionTraceabilitySchema.optional(),
691
697
  entityType: agentActionEntityTypeSchema,
692
698
  /** Project-scoped ordinal id (or explicitly provided execution/batch id). Mutually exclusive with `test`. */
@@ -2,7 +2,7 @@ import { normalizeScope } from "./normalize.js";
2
2
  import { runProvisionEphemeralEnvironmentAndWait } from "./ephemeralWait.js";
3
3
  import * as S from "./schemas.js";
4
4
  import { resolveGitHeadSha } from "./gitSha.js";
5
- import { buildAgentTraceabilityPayload } from "./agentTraceability.js";
5
+ import { buildAgentTraceabilityPayload, resolveToolchainVersions } from "./agentTraceability.js";
6
6
  function platformToProtoEnum(platform) {
7
7
  switch (platform) {
8
8
  case "ios":
@@ -1040,7 +1040,15 @@ export const TOOL_DEFINITIONS = [
1040
1040
  body.userId = process.env.TESTCHIMP_USER_ID;
1041
1041
  if (a.branchName)
1042
1042
  body.branchName = a.branchName;
1043
- // Nested traceability wins for agentModel; only fill from flat/env when nested omits it.
1043
+ // Nested traceability wins for agentModel / skillVersion / cliVersion;
1044
+ // fill from flat/env/package when nested omits them.
1045
+ const { skillVersion, cliVersion } = resolveToolchainVersions({
1046
+ skillVersion: a.skillVersion,
1047
+ cliVersion: a.cliVersion,
1048
+ nested: a.traceability && typeof a.traceability === "object"
1049
+ ? a.traceability
1050
+ : null,
1051
+ });
1044
1052
  if (a.traceability && typeof a.traceability === "object") {
1045
1053
  const nested = { ...a.traceability };
1046
1054
  const nestedModel = nested.agentModel != null && String(nested.agentModel).trim() !== ""
@@ -1053,12 +1061,23 @@ export const TOOL_DEFINITIONS = [
1053
1061
  else if (flatModel) {
1054
1062
  nested.agentModel = flatModel;
1055
1063
  }
1064
+ if (skillVersion)
1065
+ nested.skillVersion = skillVersion;
1066
+ if (cliVersion)
1067
+ nested.cliVersion = cliVersion;
1056
1068
  body.traceability = nested;
1057
1069
  }
1058
1070
  else {
1059
1071
  const model = a.agentModel?.trim() || process.env.TESTCHIMP_AGENT_MODEL?.trim();
1060
- if (model) {
1061
- body.traceability = { agentModel: model };
1072
+ const nested = {};
1073
+ if (model)
1074
+ nested.agentModel = model;
1075
+ if (skillVersion)
1076
+ nested.skillVersion = skillVersion;
1077
+ if (cliVersion)
1078
+ nested.cliVersion = cliVersion;
1079
+ if (Object.keys(nested).length > 0) {
1080
+ body.traceability = nested;
1062
1081
  }
1063
1082
  }
1064
1083
  if (a.test) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testchimp/cli",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "TestChimp CLI and MCP server — coverage, plans, EaaS, TrueCoverage, API operations (calls /api/mcp/*)",
5
5
  "type": "module",
6
6
  "main": "dist/bin/testchimp.js",