bpmax-cli 0.1.44-beta.25 → 0.1.44-beta.27

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/bin.js CHANGED
@@ -469,7 +469,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
469
469
  // package.json
470
470
  var package_default = {
471
471
  name: "bpmax-cli",
472
- version: "0.1.44-beta.25",
472
+ version: "0.1.44-beta.27",
473
473
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
474
474
  type: "module",
475
475
  bin: {
@@ -5978,6 +5978,11 @@ function buildNavConfigSubmitPayload(work, raw, options = {}) {
5978
5978
  submitConfigs[type] = payload;
5979
5979
  const rawConfig = isRecord3(rawConfigs[type]) ? rawConfigs[type] : null;
5980
5980
  const rawPayload = rawConfig ? navConfigToSubmitRecord(type, rawConfig) : null;
5981
+ if (rawPayload && navConfigItemCount(rawPayload) > 0 && navConfigItemCount(payload) === 0) {
5982
+ throw new Error(
5983
+ `nav-config ${type} \u9632\u6E05\u7A7A\u95E8\u7981\u5931\u8D25\uFF1A\u8FDC\u7AEF\u539F\u914D\u7F6E\u6709 ${navConfigItemCount(rawPayload)} \u4E2A\u5165\u53E3\uFF0C\u4F46\u672C\u6B21\u63D0\u4EA4\u4F1A\u5199\u6210\u7A7A\u6570\u7EC4\u3002\u8BF7\u91CD\u65B0 export \u5F53\u524D\u8FDC\u7AEF\u914D\u7F6E\u540E\u5408\u5E76\u4FEE\u6539\uFF0C\u4E0D\u8981\u7EE7\u7EED\u63D0\u4EA4\u65E7 payload\u3002`
5984
+ );
5985
+ }
5981
5986
  const changed = options.allRecords || !rawPayload || hashJson(rawPayload) !== hashJson(payload);
5982
5987
  const hasId = payload.id !== void 0 && payload.id !== null && payload.id !== "";
5983
5988
  const operation = {
@@ -13919,11 +13924,19 @@ function hasDomainWriteEvidence(domain, evidenceText, patterns) {
13919
13924
  const shorthand = new RegExp(`bpmax-cli config ${domain} (?:export/)?lint/build/submit/verify`);
13920
13925
  return shorthand.test(evidenceText) || patterns.every((pattern) => pattern.test(evidenceText));
13921
13926
  }
13922
- function uuidErrors(text5, target) {
13923
- const values = [...new Set([...text5.matchAll(UUID_PATTERN)].map((match) => match[0]))];
13924
- return values.map(
13925
- (value) => `UUID values are not allowed in BPMAX configuration ${target}: ${value}. Use platform-returned numeric ids or flow<number>; use new-flow:<name> before creation.`
13926
- );
13927
+ function uuidValues(text5) {
13928
+ return [...new Set([...text5.matchAll(UUID_PATTERN)].map((match) => match[0]))];
13929
+ }
13930
+ function addUuidIssues(text5, issues, path14) {
13931
+ for (const value of uuidValues(text5)) {
13932
+ addTaskbookIssue(
13933
+ issues,
13934
+ "uuid_not_allowed",
13935
+ "taskbook.config.no_uuid",
13936
+ `BPMAX \u914D\u7F6E\u4EFB\u52A1\u4E0D\u80FD\u4F7F\u7528 UUID\uFF1A${value}\u3002`,
13937
+ { path: path14, suggestion: "\u4F7F\u7528\u5E73\u53F0\u8FD4\u56DE\u7684\u6570\u5B57 ID \u6216 flow<number>\uFF1B\u521B\u5EFA\u524D\u4F7F\u7528 new-flow:<name>\uFF0C\u521B\u5EFA\u540E\u56DE\u586B\u771F\u5B9E flow_type\u3002" }
13938
+ );
13939
+ }
13927
13940
  }
13928
13941
  async function readTaskbookText(file) {
13929
13942
  const raw = await readFile14(file, "utf8");
@@ -13953,17 +13966,35 @@ function findNavigationStrategy(text5) {
13953
13966
  const matches = [...text5.matchAll(/导航入口策略\s*[::]\s*(nav-config:(?:included|skipped:[^\s|,。]+|deferred:[^\s|,。]+))/gi)];
13954
13967
  return matches.at(-1)?.[1] || null;
13955
13968
  }
13956
- function validateNavigationStrategy(text5, errors, prefix = "") {
13969
+ function validateNavigationStrategy(text5, issues, path14, subject) {
13957
13970
  const strategy = findNavigationStrategy(text5);
13958
13971
  if (!strategy) {
13959
- errors.push(`${prefix}missing concrete navigation strategy: use \u5BFC\u822A\u5165\u53E3\u7B56\u7565\uFF1Anav-config:included, nav-config:skipped:<reason>, or nav-config:deferred:<reason>`);
13972
+ addTaskbookIssue(
13973
+ issues,
13974
+ "missing_navigation_strategy",
13975
+ "taskbook.nav.strategy",
13976
+ `${subject}\u7F3A\u5C11\u660E\u786E\u7684\u5BFC\u822A\u5165\u53E3\u7B56\u7565\u3002`,
13977
+ { path: path14, suggestion: "\u5199\u660E \u5BFC\u822A\u5165\u53E3\u7B56\u7565\uFF1Anav-config:included\u3001nav-config:skipped:<reason> \u6216 nav-config:deferred:<reason>\u3002" }
13978
+ );
13960
13979
  return null;
13961
13980
  }
13962
13981
  if (/nav-config:(skipped|deferred):$/i.test(strategy)) {
13963
- errors.push(`${prefix}navigation strategy requires a non-empty reason when skipped or deferred.`);
13982
+ addTaskbookIssue(
13983
+ issues,
13984
+ "empty_navigation_strategy_reason",
13985
+ "taskbook.nav.strategy_reason",
13986
+ `${subject}\u5BFC\u822A\u5165\u53E3\u7B56\u7565\u8DF3\u8FC7\u6216\u5EF6\u540E\u65F6\u5FC5\u987B\u5199\u660E\u539F\u56E0\u3002`,
13987
+ { path: path14, suggestion: "\u4F7F\u7528 nav-config:skipped:<\u771F\u5B9E\u539F\u56E0> \u6216 nav-config:deferred:<\u771F\u5B9E\u539F\u56E0>\u3002" }
13988
+ );
13964
13989
  }
13965
13990
  if (/(待完成范围确认后回填|待确认|TODO|TBD|占位)/i.test(strategy)) {
13966
- errors.push(`${prefix}navigation strategy is still a placeholder; replace it with included, skipped:<real reason>, or deferred:<real reason>.`);
13991
+ addTaskbookIssue(
13992
+ issues,
13993
+ "placeholder_navigation_strategy",
13994
+ "taskbook.nav.strategy_placeholder",
13995
+ `${subject}\u5BFC\u822A\u5165\u53E3\u7B56\u7565\u4ECD\u662F\u5360\u4F4D\u5185\u5BB9\u3002`,
13996
+ { path: path14, suggestion: "\u66FF\u6362\u4E3A included\u3001skipped:<\u771F\u5B9E\u539F\u56E0> \u6216 deferred:<\u771F\u5B9E\u539F\u56E0>\u3002" }
13997
+ );
13967
13998
  }
13968
13999
  return strategy;
13969
14000
  }
@@ -13974,28 +14005,60 @@ function promptObjectLockText(text5) {
13974
14005
  function hasStrongListEvidence(value) {
13975
14006
  return /bpmax-cli config list-template lint/.test(value) && /(真实列表页|浏览器|runtime|E2E|渲染)/i.test(value);
13976
14007
  }
13977
- function validateTaskbookNavigationAndListGates(text5, errors) {
13978
- const strategy = validateNavigationStrategy(text5, errors);
14008
+ function validateTaskbookNavigationAndListGates(text5, issues) {
14009
+ const strategy = validateNavigationStrategy(text5, issues, "navigation_strategy", "\u4EFB\u52A1\u4E66");
13979
14010
  const rows = extractTaskRows(text5);
13980
14011
  const navRows = rows.filter((row) => /bpmax-nav-config-editor/.test(row.required_skills || ""));
13981
14012
  const listRows = rows.filter((row) => /bpmax-list-template-editor/.test(row.required_skills || ""));
13982
14013
  if (strategy === "nav-config:included" && navRows.length === 0) {
13983
- errors.push("navigation strategy is included but AI task table has no bpmax-nav-config-editor task.");
14014
+ addTaskbookIssue(
14015
+ issues,
14016
+ "missing_nav_config_task",
14017
+ "taskbook.nav.required_task",
14018
+ "\u5BFC\u822A\u5165\u53E3\u7B56\u7565\u4E3A included\uFF0C\u4F46\u4EFB\u52A1\u8868\u7F3A\u5C11 bpmax-nav-config-editor \u4EFB\u52A1\u3002",
14019
+ { domain: "nav-config", path: "tasks", suggestion: "\u8865\u5145\u5BFC\u822A\u914D\u7F6E\u4EFB\u52A1\uFF0C\u6216\u628A\u5BFC\u822A\u5165\u53E3\u7B56\u7565\u6539\u4E3A skipped/deferred \u5E76\u5199\u660E\u771F\u5B9E\u539F\u56E0\u3002" }
14020
+ );
13984
14021
  }
13985
14022
  navRows.forEach((row) => {
14023
+ const taskId = row.task_id || "<unknown>";
13986
14024
  if (!/nav-config:[A-Za-z0-9_-]+/.test(row.object_lock || "")) {
13987
- errors.push(`navigation task ${row.task_id || "<unknown>"} must use object_lock nav-config:<workspace>.`);
14025
+ addTaskbookIssue(
14026
+ issues,
14027
+ "invalid_nav_object_lock",
14028
+ "taskbook.nav.object_lock",
14029
+ `\u5BFC\u822A\u4EFB\u52A1 ${taskId} \u5FC5\u987B\u4F7F\u7528 nav-config:<workspace> \u5BF9\u8C61\u9501\u3002`,
14030
+ { domain: "nav-config", path: `tasks.${taskId}.object_lock` }
14031
+ );
13988
14032
  }
13989
14033
  if (!/(入口|导航).*(浏览器|点击|打开|可见|readback|回读)/i.test(row.evidence || "")) {
13990
- errors.push(`navigation task ${row.task_id || "<unknown>"} evidence must include readback and browser navigation-entry proof.`);
14034
+ addTaskbookIssue(
14035
+ issues,
14036
+ "missing_nav_browser_proof",
14037
+ "taskbook.nav.browser_proof",
14038
+ `\u5BFC\u822A\u4EFB\u52A1 ${taskId} \u7F3A\u5C11\u56DE\u8BFB\u548C\u6D4F\u89C8\u5668\u5165\u53E3\u9A8C\u8BC1\u8BC1\u636E\u3002`,
14039
+ { domain: "nav-config", path: `tasks.${taskId}.evidence`, suggestion: "evidence \u5FC5\u987B\u5305\u542B readback/\u56DE\u8BFB\uFF0C\u4EE5\u53CA\u771F\u5B9E\u6D4F\u89C8\u5668\u6253\u5F00\u6216\u70B9\u51FB\u5BFC\u822A\u5165\u53E3\u7684 proof\u3002" }
14040
+ );
13991
14041
  }
13992
14042
  });
13993
14043
  listRows.forEach((row) => {
14044
+ const taskId = row.task_id || "<unknown>";
13994
14045
  if (!/list-template:(?:\d+|new-[A-Za-z0-9_-]+)/.test(row.object_lock || "")) {
13995
- errors.push(`list-template task ${row.task_id || "<unknown>"} must use object_lock list-template:<id> or list-template:new-<name>.`);
14046
+ addTaskbookIssue(
14047
+ issues,
14048
+ "invalid_list_object_lock",
14049
+ "taskbook.list.object_lock",
14050
+ `\u5217\u8868\u6A21\u677F\u4EFB\u52A1 ${taskId} \u5FC5\u987B\u4F7F\u7528 list-template:<id> \u6216 list-template:new-<name> \u5BF9\u8C61\u9501\u3002`,
14051
+ { domain: "list-template", path: `tasks.${taskId}.object_lock` }
14052
+ );
13996
14053
  }
13997
14054
  if (!hasStrongListEvidence(row.evidence || "")) {
13998
- errors.push(`list-template task ${row.task_id || "<unknown>"} evidence must include bpmax-cli config list-template lint and real browser list-page verification.`);
14055
+ addTaskbookIssue(
14056
+ issues,
14057
+ "missing_list_runtime_proof",
14058
+ "taskbook.list.runtime_proof",
14059
+ `\u5217\u8868\u6A21\u677F\u4EFB\u52A1 ${taskId} \u7F3A\u5C11 list-template lint \u548C\u771F\u5B9E\u5217\u8868\u9875\u9A8C\u8BC1\u8BC1\u636E\u3002`,
14060
+ { domain: "list-template", path: `tasks.${taskId}.evidence`, suggestion: "evidence \u5FC5\u987B\u5305\u542B bpmax-cli config list-template lint \u548C\u771F\u5B9E\u6D4F\u89C8\u5668\u5217\u8868\u9875 proof\u3002" }
14061
+ );
13999
14062
  }
14000
14063
  });
14001
14064
  }
@@ -14009,13 +14072,32 @@ function rowText(row) {
14009
14072
  row.parallel_type
14010
14073
  ].filter(Boolean).join(" ");
14011
14074
  }
14012
- function validateConfigRuleForTaskRow(row, rule, errors) {
14075
+ function addTaskbookIssue(issues, code, ruleId, message, options = {}) {
14076
+ issues.push({
14077
+ code,
14078
+ rule_id: ruleId,
14079
+ domain: options.domain,
14080
+ path: options.path,
14081
+ message,
14082
+ suggestion: options.suggestion
14083
+ });
14084
+ }
14085
+ function issueMessages(issues) {
14086
+ return issues.map((issue3) => issue3.suggestion ? `${issue3.message} \u5EFA\u8BAE\uFF1A${issue3.suggestion}` : issue3.message);
14087
+ }
14088
+ function validateConfigRuleForTaskRow(row, rule, issues) {
14013
14089
  const taskId = row.task_id || "<unknown>";
14014
14090
  const combined = rowText(row);
14015
14091
  const hasSkill = (row.required_skills || "").includes(rule.skill);
14016
14092
  const mentionsDomain = rule.mentionPattern.test(combined) || rule.lockPattern.test(row.object_lock || "");
14017
14093
  if (mentionsDomain && !hasSkill) {
14018
- errors.push(`${rule.domain} task ${taskId} mentions ${rule.domain} work but missing required skill ${rule.skill}.`);
14094
+ addTaskbookIssue(
14095
+ issues,
14096
+ "missing_required_skill",
14097
+ "taskbook.config.required_skill",
14098
+ `\u4EFB\u52A1 ${taskId} \u63D0\u5230\u4E86 ${rule.domain} \u914D\u7F6E\uFF0C\u4F46\u7F3A\u5C11\u5FC5\u9700 skill\uFF1A${rule.skill}\u3002`,
14099
+ { domain: rule.domain, path: `tasks.${taskId}.required_skills` }
14100
+ );
14019
14101
  return;
14020
14102
  }
14021
14103
  if (!hasSkill) {
@@ -14023,52 +14105,106 @@ function validateConfigRuleForTaskRow(row, rule, errors) {
14023
14105
  }
14024
14106
  const writeMode = isWriteMode(row);
14025
14107
  if (writeMode && !rule.lockPattern.test(row.object_lock || "")) {
14026
- errors.push(`${rule.domain} task ${taskId} must use object_lock matching ${rule.domain}:<id> or its documented lock pattern.`);
14108
+ addTaskbookIssue(
14109
+ issues,
14110
+ "invalid_object_lock",
14111
+ "taskbook.config.object_lock",
14112
+ `\u4EFB\u52A1 ${taskId} \u662F ${rule.domain} \u5199\u4EFB\u52A1\uFF0C\u4F46\u5BF9\u8C61\u9501\u4E0D\u7B26\u5408\u8BE5\u914D\u7F6E\u57DF\u8981\u6C42\u3002`,
14113
+ { domain: rule.domain, path: `tasks.${taskId}.object_lock`, suggestion: `\u4F7F\u7528 ${rule.domain}:<id>\u3001new-* \u6216\u8BE5\u914D\u7F6E\u57DF\u6587\u6863\u6307\u5B9A\u7684\u5BF9\u8C61\u9501\u683C\u5F0F\u3002` }
14114
+ );
14027
14115
  }
14028
14116
  if (!writeMode && !/^readonly:[A-Za-z0-9_-]+/.test(row.object_lock || "") && !rule.lockPattern.test(row.object_lock || "")) {
14029
- errors.push(`${rule.domain} readonly task ${taskId} must use readonly:<scope> or the ${rule.domain} object lock.`);
14117
+ addTaskbookIssue(
14118
+ issues,
14119
+ "invalid_readonly_lock",
14120
+ "taskbook.config.readonly_lock",
14121
+ `\u4EFB\u52A1 ${taskId} \u662F ${rule.domain} \u53EA\u8BFB\u4EFB\u52A1\uFF0C\u4F46\u7F3A\u5C11 readonly:<scope> \u6216\u5BF9\u5E94\u5BF9\u8C61\u9501\u3002`,
14122
+ { domain: rule.domain, path: `tasks.${taskId}.object_lock` }
14123
+ );
14030
14124
  }
14031
14125
  const evidenceText = `${row.evidence || ""} ${row.notes || ""}`;
14032
14126
  const hasRequiredEvidence = writeMode ? hasDomainWriteEvidence(rule.domain, evidenceText, rule.writeEvidence) : rule.readonlyEvidence.some((pattern) => pattern.test(evidenceText));
14033
14127
  if (!hasRequiredEvidence) {
14034
14128
  const expected = writeMode ? `bpmax-cli config ${rule.domain} lint/build/submit/verify evidence` : `bpmax-cli config ${rule.domain} export/readback evidence`;
14035
- errors.push(`${rule.domain} task ${taskId} missing ${expected}.`);
14129
+ addTaskbookIssue(
14130
+ issues,
14131
+ "missing_typed_cli_evidence",
14132
+ "taskbook.config.typed_cli_evidence",
14133
+ `\u4EFB\u52A1 ${taskId} \u7F3A\u5C11 ${rule.domain} \u7684 typed CLI \u8BC1\u636E\u3002`,
14134
+ { domain: rule.domain, path: `tasks.${taskId}.evidence`, suggestion: expected }
14135
+ );
14036
14136
  }
14037
14137
  if (!rule.constraintEvidence.test(evidenceText)) {
14038
- errors.push(`${rule.domain} task ${taskId} missing domain-specific constraints from ${rule.skill}.`);
14138
+ addTaskbookIssue(
14139
+ issues,
14140
+ "missing_domain_constraints",
14141
+ "taskbook.config.domain_constraints",
14142
+ `\u4EFB\u52A1 ${taskId} \u7F3A\u5C11\u6765\u81EA ${rule.skill} \u7684 ${rule.domain} \u4E13\u9879\u7EA6\u675F\u8BF4\u660E\u3002`,
14143
+ { domain: rule.domain, path: `tasks.${taskId}.notes` }
14144
+ );
14039
14145
  }
14040
14146
  if (writeMode && !hasConfigAdaptersEvidence(evidenceText)) {
14041
- errors.push(`${rule.domain} task ${taskId} is write-capable but missing bpmax-cli config adapters --format json capability/adapters evidence.`);
14147
+ addTaskbookIssue(
14148
+ issues,
14149
+ "missing_config_adapters_evidence",
14150
+ "taskbook.config.adapters_evidence",
14151
+ `\u4EFB\u52A1 ${taskId} \u662F\u5199\u4EFB\u52A1\uFF0C\u4F46\u7F3A\u5C11 config adapters/capability \u68C0\u67E5\u8BC1\u636E\u3002`,
14152
+ { domain: rule.domain, path: `tasks.${taskId}.evidence`, suggestion: "\u5199\u4EFB\u52A1\u5FC5\u987B\u5305\u542B bpmax-cli config adapters --format json \u7684\u68C0\u67E5\u7ED3\u679C\u3002" }
14153
+ );
14042
14154
  }
14043
14155
  }
14044
- function validateTaskbookConfigSkillGates(text5, errors) {
14156
+ function validateTaskbookConfigSkillGates(text5, issues) {
14045
14157
  const rows = extractTaskRows(text5);
14046
14158
  for (const row of rows) {
14047
14159
  for (const rule of CONFIG_TASK_RULES) {
14048
- validateConfigRuleForTaskRow(row, rule, errors);
14160
+ validateConfigRuleForTaskRow(row, rule, issues);
14049
14161
  }
14050
14162
  }
14051
14163
  }
14052
- function validatePromptNavigationAndListGates(text5, errors) {
14053
- const strategy = validateNavigationStrategy(text5, errors, "prompt ");
14164
+ function validatePromptNavigationAndListGates(text5, issues) {
14165
+ const strategy = validateNavigationStrategy(text5, issues, "prompt.navigation_strategy", "Prompt ");
14054
14166
  const hasNavSkill = /bpmax-nav-config-editor/.test(text5);
14055
14167
  const objectLock = promptObjectLockText(text5);
14056
14168
  if ((strategy === "nav-config:included" || hasNavSkill) && !/nav-config:[A-Za-z0-9_-]+/.test(objectLock)) {
14057
- errors.push("prompt navigation work must include object lock nav-config:<workspace>.");
14169
+ addTaskbookIssue(
14170
+ issues,
14171
+ "invalid_nav_object_lock",
14172
+ "taskbook.nav.object_lock",
14173
+ "Prompt \u4E2D\u7684\u5BFC\u822A\u914D\u7F6E\u4EFB\u52A1\u5FC5\u987B\u5305\u542B nav-config:<workspace> \u5BF9\u8C61\u9501\u3002",
14174
+ { domain: "nav-config", path: "prompt.object_lock" }
14175
+ );
14058
14176
  }
14059
14177
  if ((strategy === "nav-config:included" || hasNavSkill) && !/(入口|导航).*(浏览器|点击|打开|可见|readback|回读)/i.test(text5)) {
14060
- errors.push("prompt navigation work must require readback and browser navigation-entry proof.");
14178
+ addTaskbookIssue(
14179
+ issues,
14180
+ "missing_nav_browser_proof",
14181
+ "taskbook.nav.browser_proof",
14182
+ "Prompt \u4E2D\u7684\u5BFC\u822A\u914D\u7F6E\u4EFB\u52A1\u5FC5\u987B\u8981\u6C42\u56DE\u8BFB\u548C\u6D4F\u89C8\u5668\u5165\u53E3\u9A8C\u8BC1\u3002",
14183
+ { domain: "nav-config", path: "prompt.evidence", suggestion: "\u5199\u660E readback/\u56DE\u8BFB\uFF0C\u4EE5\u53CA\u771F\u5B9E\u6D4F\u89C8\u5668\u6253\u5F00\u6216\u70B9\u51FB\u5BFC\u822A\u5165\u53E3\u7684 proof\u3002" }
14184
+ );
14061
14185
  }
14062
14186
  if (/bpmax-list-template-editor/.test(text5)) {
14063
14187
  if (!/list-template:(?:\d+|new-[A-Za-z0-9_-]+)/.test(objectLock)) {
14064
- errors.push("prompt list-template work must include object lock list-template:<id> or list-template:new-<name>.");
14188
+ addTaskbookIssue(
14189
+ issues,
14190
+ "invalid_list_object_lock",
14191
+ "taskbook.list.object_lock",
14192
+ "Prompt \u4E2D\u7684\u5217\u8868\u6A21\u677F\u4EFB\u52A1\u5FC5\u987B\u5305\u542B list-template:<id> \u6216 list-template:new-<name> \u5BF9\u8C61\u9501\u3002",
14193
+ { domain: "list-template", path: "prompt.object_lock" }
14194
+ );
14065
14195
  }
14066
14196
  if (!hasStrongListEvidence(text5)) {
14067
- errors.push("prompt list-template work must include bpmax-cli config list-template lint and real browser list-page verification.");
14197
+ addTaskbookIssue(
14198
+ issues,
14199
+ "missing_list_runtime_proof",
14200
+ "taskbook.list.runtime_proof",
14201
+ "Prompt \u4E2D\u7684\u5217\u8868\u6A21\u677F\u4EFB\u52A1\u5FC5\u987B\u8981\u6C42 list-template lint \u548C\u771F\u5B9E\u5217\u8868\u9875\u9A8C\u8BC1\u3002",
14202
+ { domain: "list-template", path: "prompt.evidence", suggestion: "\u5199\u660E bpmax-cli config list-template lint \u548C\u771F\u5B9E\u6D4F\u89C8\u5668\u5217\u8868\u9875 proof\u3002" }
14203
+ );
14068
14204
  }
14069
14205
  }
14070
14206
  }
14071
- function validatePromptConfigSkillGates(text5, errors) {
14207
+ function validatePromptConfigSkillGates(text5, issues) {
14072
14208
  const objectLock = promptObjectLockText(text5);
14073
14209
  const writeMode = isWriteMode(text5);
14074
14210
  const actionableText = text5.split(/\r?\n/).filter((line) => !/^\s*(导航入口策略|列表 lint)\s*[::]/.test(line)).join("\n");
@@ -14076,84 +14212,146 @@ function validatePromptConfigSkillGates(text5, errors) {
14076
14212
  const hasSkill = text5.includes(rule.skill);
14077
14213
  const mentionsDomain = rule.mentionPattern.test(actionableText) || rule.lockPattern.test(objectLock);
14078
14214
  if (mentionsDomain && !hasSkill) {
14079
- errors.push(`prompt mentions ${rule.domain} work but missing required skill ${rule.skill}.`);
14215
+ addTaskbookIssue(
14216
+ issues,
14217
+ "missing_required_skill",
14218
+ "taskbook.config.required_skill",
14219
+ `Prompt \u63D0\u5230\u4E86 ${rule.domain} \u914D\u7F6E\uFF0C\u4F46\u7F3A\u5C11\u5FC5\u9700 skill\uFF1A${rule.skill}\u3002`,
14220
+ { domain: rule.domain, path: "prompt.required_skills" }
14221
+ );
14080
14222
  continue;
14081
14223
  }
14082
14224
  if (!hasSkill) {
14083
14225
  continue;
14084
14226
  }
14085
14227
  if (writeMode && !rule.lockPattern.test(objectLock)) {
14086
- errors.push(`prompt ${rule.domain} work must include object lock matching ${rule.domain}:<id> or its documented lock pattern.`);
14228
+ addTaskbookIssue(
14229
+ issues,
14230
+ "invalid_object_lock",
14231
+ "taskbook.config.object_lock",
14232
+ `Prompt \u662F ${rule.domain} \u5199\u4EFB\u52A1\uFF0C\u4F46\u5BF9\u8C61\u9501\u4E0D\u7B26\u5408\u8BE5\u914D\u7F6E\u57DF\u8981\u6C42\u3002`,
14233
+ { domain: rule.domain, path: "prompt.object_lock", suggestion: `\u4F7F\u7528 ${rule.domain}:<id>\u3001new-* \u6216\u8BE5\u914D\u7F6E\u57DF\u6587\u6863\u6307\u5B9A\u7684\u5BF9\u8C61\u9501\u683C\u5F0F\u3002` }
14234
+ );
14087
14235
  }
14088
14236
  if (!writeMode && !/^readonly:[A-Za-z0-9_-]+/.test(objectLock) && !rule.lockPattern.test(objectLock)) {
14089
- errors.push(`prompt ${rule.domain} readonly work must include readonly:<scope> or the ${rule.domain} object lock.`);
14237
+ addTaskbookIssue(
14238
+ issues,
14239
+ "invalid_readonly_lock",
14240
+ "taskbook.config.readonly_lock",
14241
+ `Prompt \u662F ${rule.domain} \u53EA\u8BFB\u4EFB\u52A1\uFF0C\u4F46\u7F3A\u5C11 readonly:<scope> \u6216\u5BF9\u5E94\u5BF9\u8C61\u9501\u3002`,
14242
+ { domain: rule.domain, path: "prompt.object_lock" }
14243
+ );
14090
14244
  }
14091
14245
  const hasRequiredEvidence = writeMode ? hasDomainWriteEvidence(rule.domain, text5, rule.writeEvidence) : rule.readonlyEvidence.some((pattern) => pattern.test(text5));
14092
14246
  if (!hasRequiredEvidence) {
14093
14247
  const expected = writeMode ? `bpmax-cli config ${rule.domain} lint/build/submit/verify evidence` : `bpmax-cli config ${rule.domain} export/readback evidence`;
14094
- errors.push(`prompt ${rule.domain} work missing ${expected}.`);
14248
+ addTaskbookIssue(
14249
+ issues,
14250
+ "missing_typed_cli_evidence",
14251
+ "taskbook.config.typed_cli_evidence",
14252
+ `Prompt \u7F3A\u5C11 ${rule.domain} \u7684 typed CLI \u8BC1\u636E\u8981\u6C42\u3002`,
14253
+ { domain: rule.domain, path: "prompt.evidence", suggestion: expected }
14254
+ );
14095
14255
  }
14096
14256
  if (!rule.constraintEvidence.test(text5)) {
14097
- errors.push(`prompt ${rule.domain} work missing domain-specific constraints from ${rule.skill}.`);
14257
+ addTaskbookIssue(
14258
+ issues,
14259
+ "missing_domain_constraints",
14260
+ "taskbook.config.domain_constraints",
14261
+ `Prompt \u7F3A\u5C11\u6765\u81EA ${rule.skill} \u7684 ${rule.domain} \u4E13\u9879\u7EA6\u675F\u8BF4\u660E\u3002`,
14262
+ { domain: rule.domain, path: "prompt.notes" }
14263
+ );
14098
14264
  }
14099
14265
  if (writeMode && !hasConfigAdaptersEvidence(text5)) {
14100
- errors.push(`prompt ${rule.domain} write work missing bpmax-cli config adapters --format json capability/adapters evidence.`);
14266
+ addTaskbookIssue(
14267
+ issues,
14268
+ "missing_config_adapters_evidence",
14269
+ "taskbook.config.adapters_evidence",
14270
+ `Prompt \u662F ${rule.domain} \u5199\u4EFB\u52A1\uFF0C\u4F46\u7F3A\u5C11 config adapters/capability \u68C0\u67E5\u8981\u6C42\u3002`,
14271
+ { domain: rule.domain, path: "prompt.evidence", suggestion: "\u5199\u4EFB\u52A1\u5FC5\u987B\u8981\u6C42 bpmax-cli config adapters --format json \u68C0\u67E5\u3002" }
14272
+ );
14101
14273
  }
14102
14274
  }
14103
14275
  }
14104
14276
  async function lintTaskbook(file, options = {}) {
14105
14277
  const text5 = await readTaskbookText(file);
14106
- const errors = [
14107
- ...missingTermErrors(text5, REQUIRED_TASKBOOK_TERMS, "missing required term"),
14108
- ...missingTermErrors(text5, options.requireTerms || [], "missing required term")
14109
- ];
14278
+ const issues = [];
14279
+ for (const message of missingTermErrors(text5, REQUIRED_TASKBOOK_TERMS, "missing required term")) {
14280
+ addTaskbookIssue(issues, "missing_required_term", "taskbook.required_term", `\u4EFB\u52A1\u4E66\u7F3A\u5C11\u5FC5\u9700\u5185\u5BB9\uFF1A${message.replace(/^missing required term: /, "")}\u3002`);
14281
+ }
14282
+ for (const message of missingTermErrors(text5, options.requireTerms || [], "missing required term")) {
14283
+ addTaskbookIssue(issues, "missing_required_term", "taskbook.required_term", `\u4EFB\u52A1\u4E66\u7F3A\u5C11\u5FC5\u9700\u5185\u5BB9\uFF1A${message.replace(/^missing required term: /, "")}\u3002`);
14284
+ }
14110
14285
  for (const term of options.forbidTerms || []) {
14111
14286
  if (term && text5.includes(term)) {
14112
- errors.push(`forbidden term present: ${term}`);
14287
+ addTaskbookIssue(issues, "forbidden_term_present", "taskbook.forbidden_term", `\u4EFB\u52A1\u4E66\u5305\u542B\u7981\u7528\u8BCD\uFF1A${term}\u3002`);
14113
14288
  }
14114
14289
  }
14115
14290
  if (!options.allowGeneratedFlowTypeMissing) {
14116
- errors.push(...missingTermErrors(text5, GENERATED_FLOW_TYPE_TERMS, "missing generated flow_type rule term"));
14291
+ for (const message of missingTermErrors(text5, GENERATED_FLOW_TYPE_TERMS, "missing generated flow_type rule term")) {
14292
+ addTaskbookIssue(issues, "missing_generated_flow_type_rule", "taskbook.generated_flow_type", `\u4EFB\u52A1\u4E66\u7F3A\u5C11\u65B0\u6D41\u7A0B\u771F\u5B9E flow_type \u56DE\u586B\u89C4\u5219\uFF1A${message.replace(/^missing generated flow_type rule term: /, "")}\u3002`);
14293
+ }
14294
+ }
14295
+ addUuidIssues(text5, issues, "taskbook");
14296
+ for (const message of missingTermErrors(text5, SUBAGENT_TERMS, "missing subagent rule term")) {
14297
+ addTaskbookIssue(issues, "missing_subagent_rule", "taskbook.subagent_rule", `\u4EFB\u52A1\u4E66\u7F3A\u5C11 subagent \u89C4\u5219\uFF1A${message.replace(/^missing subagent rule term: /, "")}\u3002`);
14117
14298
  }
14118
- errors.push(...uuidErrors(text5, "taskbooks"));
14119
- errors.push(...missingTermErrors(text5, SUBAGENT_TERMS, "missing subagent rule term"));
14120
- validateTaskbookNavigationAndListGates(text5, errors);
14121
- validateTaskbookConfigSkillGates(text5, errors);
14299
+ validateTaskbookNavigationAndListGates(text5, issues);
14300
+ validateTaskbookConfigSkillGates(text5, issues);
14122
14301
  for (const match of text5.matchAll(FLOW_LOCK_PATTERN)) {
14123
14302
  const value = match[1] || "";
14124
14303
  if (value.startsWith("flow") && /^flow\d+$/.test(value)) {
14125
14304
  continue;
14126
14305
  }
14127
- errors.push(`possible self-defined flow_type object lock: flow:${value}; use new-flow:<name> before creation, then flow:<generated flow_type>`);
14306
+ addTaskbookIssue(
14307
+ issues,
14308
+ "self_defined_flow_type_lock",
14309
+ "taskbook.flow_type.generated_id",
14310
+ `\u5BF9\u8C61\u9501 flow:${value} \u7591\u4F3C\u81EA\u9020 flow_type\u3002`,
14311
+ { path: "object_lock", suggestion: "\u65B0\u6D41\u7A0B\u521B\u5EFA\u524D\u4F7F\u7528 new-flow:<name>\uFF0C\u521B\u5EFA\u540E\u56DE\u586B BPMAX \u751F\u6210\u7684\u771F\u5B9E flow_type\u3002" }
14312
+ );
14128
14313
  }
14314
+ const errors = uniqueErrors(issueMessages(issues));
14129
14315
  return {
14130
14316
  ok: errors.length === 0,
14131
14317
  file,
14132
- errors: uniqueErrors(errors),
14318
+ errors,
14319
+ issues,
14133
14320
  checked_at: (/* @__PURE__ */ new Date()).toISOString()
14134
14321
  };
14135
14322
  }
14136
14323
  async function lintTaskPrompt(file, options = {}) {
14137
14324
  const text5 = await readTaskbookText(file);
14138
- const errors = [
14139
- ...missingTermErrors(text5, PROMPT_REQUIRED_TERMS, "prompt missing required term"),
14140
- ...missingTermErrors(text5, options.requireTerms || [], "prompt missing required term")
14141
- ];
14325
+ const issues = [];
14326
+ for (const message of missingTermErrors(text5, PROMPT_REQUIRED_TERMS, "prompt missing required term")) {
14327
+ addTaskbookIssue(issues, "missing_prompt_required_term", "taskbook.prompt.required_term", `Prompt \u7F3A\u5C11\u5FC5\u9700\u5185\u5BB9\uFF1A${message.replace(/^prompt missing required term: /, "")}\u3002`);
14328
+ }
14329
+ for (const message of missingTermErrors(text5, options.requireTerms || [], "prompt missing required term")) {
14330
+ addTaskbookIssue(issues, "missing_prompt_required_term", "taskbook.prompt.required_term", `Prompt \u7F3A\u5C11\u5FC5\u9700\u5185\u5BB9\uFF1A${message.replace(/^prompt missing required term: /, "")}\u3002`);
14331
+ }
14142
14332
  if (!BPMAX_SKILL_PATTERN.test(text5)) {
14143
- errors.push("prompt missing BPMAX related skill name in required_skills");
14333
+ addTaskbookIssue(
14334
+ issues,
14335
+ "missing_bpmax_skill",
14336
+ "taskbook.prompt.required_skill",
14337
+ "Prompt \u7F3A\u5C11 BPMAX \u76F8\u5173 skill \u540D\u79F0\u3002",
14338
+ { path: "prompt.required_skills", suggestion: "\u5728 required_skills \u4E2D\u5199\u660E\u5BF9\u5E94\u7684 bpmax-* \u914D\u7F6E skill\u3002" }
14339
+ );
14144
14340
  }
14145
- errors.push(...uuidErrors(text5, "task prompts"));
14146
- validatePromptNavigationAndListGates(text5, errors);
14147
- validatePromptConfigSkillGates(text5, errors);
14341
+ addUuidIssues(text5, issues, "prompt");
14342
+ validatePromptNavigationAndListGates(text5, issues);
14343
+ validatePromptConfigSkillGates(text5, issues);
14148
14344
  for (const term of options.forbidTerms || []) {
14149
14345
  if (term && text5.includes(term)) {
14150
- errors.push(`prompt forbidden term present: ${term}`);
14346
+ addTaskbookIssue(issues, "forbidden_term_present", "taskbook.prompt.forbidden_term", `Prompt \u5305\u542B\u7981\u7528\u8BCD\uFF1A${term}\u3002`);
14151
14347
  }
14152
14348
  }
14349
+ const errors = uniqueErrors(issueMessages(issues));
14153
14350
  return {
14154
14351
  ok: errors.length === 0,
14155
14352
  file,
14156
- errors: uniqueErrors(errors),
14353
+ errors,
14354
+ issues,
14157
14355
  checked_at: (/* @__PURE__ */ new Date()).toISOString()
14158
14356
  };
14159
14357
  }
@@ -14479,6 +14677,17 @@ var IDENTITY_MOCK_CASE_RE = /(非处理人|越权|只读|多角色|角色隔离|
14479
14677
  var IDENTITY_MOCK_VALUE_RE = /(mock|模拟).*(unmock|退出模拟|恢复)|bpmax-user-mock-operator/;
14480
14678
  var E2E_REUSABLE_ASSET_RE = /bpmax-cli\s+e2e|record-from-evidence|create-page-submit|step-run|browser-template|scenario\s+plan|data\s+profile|reusable\s+step|复用模板|可复用|首次运行沉淀|沉淀模板/;
14481
14679
  var TestSuiteError = class extends Error {
14680
+ code;
14681
+ rule_id;
14682
+ path;
14683
+ suggestion;
14684
+ constructor(message, options = {}) {
14685
+ super(message);
14686
+ this.code = options.code || "test_suite_lint_failed";
14687
+ this.rule_id = options.rule_id || "test_suite.general";
14688
+ this.path = options.path;
14689
+ this.suggestion = options.suggestion;
14690
+ }
14482
14691
  };
14483
14692
  async function exists3(filePath) {
14484
14693
  try {
@@ -14491,8 +14700,8 @@ async function exists3(filePath) {
14491
14700
  async function readText(filePath) {
14492
14701
  return readFile15(filePath, "utf8");
14493
14702
  }
14494
- function fail(message) {
14495
- throw new TestSuiteError(message);
14703
+ function fail(message, options = {}) {
14704
+ throw new TestSuiteError(message, options);
14496
14705
  }
14497
14706
  function reviewSchemaExample(scenarioId = "example-scenario", latestProof = null) {
14498
14707
  return {
@@ -14544,12 +14753,20 @@ function reviewSchemaExplanation() {
14544
14753
  }
14545
14754
  function reviewFail(reviewPath, message) {
14546
14755
  const scenarioId = path12.basename(path12.dirname(reviewPath));
14547
- fail([
14548
- message,
14549
- `Run \`bpmax-cli test-suite review explain --format json\` for the full schema.`,
14550
- `Run \`bpmax-cli test-suite review repair --scenario ${scenarioId} --draft-root ${path12.dirname(path12.dirname(reviewPath))} --latest-proof <proof.json> --format json\` to fill missing fields.`,
14551
- `Minimal review.json example: ${JSON.stringify(reviewSchemaExample(scenarioId))}`
14552
- ].join("\n"));
14756
+ fail(
14757
+ [
14758
+ message,
14759
+ "\u8FD0\u884C `bpmax-cli test-suite review explain --format json` \u67E5\u770B\u5B8C\u6574 schema\u3002",
14760
+ `\u8FD0\u884C \`bpmax-cli test-suite review repair --scenario ${scenarioId} --draft-root ${path12.dirname(path12.dirname(reviewPath))} --latest-proof <proof.json> --format json\` \u4FEE\u8865\u7F3A\u5931\u5B57\u6BB5\u3002`,
14761
+ `\u6700\u5C0F review.json \u793A\u4F8B\uFF1A${JSON.stringify(reviewSchemaExample(scenarioId))}`
14762
+ ].join("\n"),
14763
+ {
14764
+ code: "invalid_review_json",
14765
+ rule_id: "test_suite.review_schema",
14766
+ path: reviewPath,
14767
+ suggestion: "\u5148\u7528 review init/repair \u751F\u6210\u6216\u4FEE\u590D review.json\uFF0C\u518D\u6267\u884C promote\u3002"
14768
+ }
14769
+ );
14553
14770
  }
14554
14771
  function splitCsvLine(line) {
14555
14772
  const values = [];
@@ -15937,10 +16154,15 @@ function commandEndpointHint(argv) {
15937
16154
  }
15938
16155
  function printCommandError(error) {
15939
16156
  const message = error instanceof Error ? error.message : String(error);
16157
+ const structured = error && typeof error === "object" ? error : {};
15940
16158
  if (formatFromArgv(process.argv) === "json") {
15941
16159
  console.log(JSON.stringify({
15942
16160
  ok: false,
15943
16161
  error: message,
16162
+ ...typeof structured.code === "string" ? { code: structured.code } : {},
16163
+ ...typeof structured.rule_id === "string" ? { rule_id: structured.rule_id } : {},
16164
+ ...typeof structured.path === "string" ? { path: structured.path } : {},
16165
+ ...typeof structured.suggestion === "string" ? { suggestion: structured.suggestion } : {},
15944
16166
  ...commandDomainFromArgv(process.argv) ? { domain: commandDomainFromArgv(process.argv) } : {},
15945
16167
  ...commandEndpointHint(process.argv) ? { endpoint: commandEndpointHint(process.argv) } : {}
15946
16168
  }, null, 2));