shoplazza-ai-dev-cli 0.1.20 → 0.1.21-snapshot.0

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.
@@ -1291,6 +1291,59 @@ async function runKBMRs(client, args, json) {
1291
1291
  process.exitCode = 2;
1292
1292
  }
1293
1293
  }
1294
+ const STATUS_OUTDATED = "outdated";
1295
+ const STATUS_UP_TO_DATE = "up_to_date";
1296
+ const REASON_TEXT = {
1297
+ no_source_case_set: "这个计划没有来源用例集(回归计划 / 历史计划),核对不了",
1298
+ no_requirement: "来源用例集没关联需求,核对不了",
1299
+ no_feishu_ticket: "关联需求没挂飞书工单,对不上集中仓里的任何工单",
1300
+ not_in_api_docs: "集中仓里还没有这个工单的接口文档",
1301
+ never_synced: "这个用例集从没同步过用例,平台没记过它照的是第几版",
1302
+ lookup_failed: "读集中仓失败(权限或网络),这次没核对上",
1303
+ unspecified: "核对不成,原因未知"
1304
+ };
1305
+ async function runAPIDocStatus(client, args, json) {
1306
+ const { positional } = parseNamedArgs(args);
1307
+ const target = positional[0];
1308
+ const id = positional[1];
1309
+ if (!id) {
1310
+ printError("Usage: test api-doc-status plan <plan_id> | test api-doc-status case-set <set_id>");
1311
+ process.exitCode = 2;
1312
+ return;
1313
+ }
1314
+ let path;
1315
+ if (target === "plan") path = `/api/test/plans/${encodeURIComponent(id)}/api-doc-status`;
1316
+ else if (target === "case-set") path = `/api/test/case-sets/${encodeURIComponent(id)}/api-doc-status`;
1317
+ else {
1318
+ printError(`Unknown target "${target}": must be plan|case-set`);
1319
+ process.exitCode = 2;
1320
+ return;
1321
+ }
1322
+ const data = await client.get(path);
1323
+ const status = String(data["status"] ?? "");
1324
+ if (json) printJson(data);
1325
+ else printStatus(data, status);
1326
+ if (status === STATUS_OUTDATED) process.exitCode = 1;
1327
+ }
1328
+ function printStatus(data, status) {
1329
+ const latest = data["latest_version"];
1330
+ const synced = data["synced_version"];
1331
+ if (status === STATUS_OUTDATED) {
1332
+ printError(`接口文档已更新到 v${String(latest)},本用例集是照 v${String(synced)} 写的——用例可能已过时`);
1333
+ printKV([
1334
+ ["工单", data["ticket"] ?? "—"],
1335
+ ["产品线", data["product_line"] ?? "—"],
1336
+ ["改了什么", data["changes_path"] ?? "—"]
1337
+ ]);
1338
+ return;
1339
+ }
1340
+ if (status === STATUS_UP_TO_DATE) {
1341
+ printSuccess(`接口文档是最新的(v${String(latest)})`);
1342
+ return;
1343
+ }
1344
+ const reason = String(data["reason"] ?? "unspecified");
1345
+ printKV([["状态", `unknown(未核对上,不代表没问题)`], ["原因", `${REASON_TEXT[reason] ?? reason}(${reason})`]]);
1346
+ }
1294
1347
  const RESOURCES = {
1295
1348
  taxonomy: runTaxonomy,
1296
1349
  requirements: runRequirements,
@@ -1298,7 +1351,8 @@ const RESOURCES = {
1298
1351
  "case-sets": runCaseSets,
1299
1352
  plans: runPlans,
1300
1353
  results: runResults,
1301
- "kb-mrs": runKBMRs
1354
+ "kb-mrs": runKBMRs,
1355
+ "api-doc-status": runAPIDocStatus
1302
1356
  };
1303
1357
  const HELP = `Testing platform commands (Scenario A & B).
1304
1358
 
@@ -1310,6 +1364,7 @@ Resources:
1310
1364
  plans Test plans & execution
1311
1365
  results Test results (batch)
1312
1366
  kb-mrs Knowledge-base MR links (case set / plan)
1367
+ api-doc-status Whether the cases were written against the latest API docs
1313
1368
 
1314
1369
  Run: shoplazza-ai-dev-cli test <resource> --help`;
1315
1370
  async function runTest(rawArgs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-ai-dev-cli",
3
- "version": "0.1.20",
3
+ "version": "0.1.21-snapshot.0",
4
4
  "description": "Shoplazza AI Dev CLI: install, publish and manage AI agent skills/rules",
5
5
  "type": "module",
6
6
  "bin": {