feat(aipro): format scopes command output as pure json with index and scope
This commit is contained in:
1 parent
62025cb6f1
commit
8d203fc230
1 file changed
+5
-38
+5
-38
@@ -73,28 +73,11 @@ export async function runAiProCli(rawArgs: string[]): Promise<{ stdout: string;
|
||||
case "rule":
|
||||
case "index":
|
||||
case "indexes": {
|
||||
const scopes = repo.listScopes();
|
||||
if (runtime.jsonMode) {
|
||||
return {
|
||||
stdout: printJson({ count: scopes.length, scopes }),
|
||||
stderr: "",
|
||||
exitCode: 0,
|
||||
};
|
||||
}
|
||||
const headers = ["索引号", "适用场景 (Scope)", "有效规则数", "包含规则编号"];
|
||||
const rows = scopes.map((s) => [
|
||||
s.index,
|
||||
s.scope,
|
||||
s.ruleCount,
|
||||
s.ruleCodes.map((c) => `#${c}`).join(", "),
|
||||
]);
|
||||
const table = printTable(headers, rows);
|
||||
const title = `====== [AI PRO] 规约场景索引列表 (共 ${scopes.length} 个适用场景) ======\n`;
|
||||
const tip =
|
||||
`\n提示:\n` +
|
||||
` • 查看场景审核要点 (纯规则元数据,与单据无关): hose-aipro points <索引号|场景名称> (例如: hose-aipro points 1)\n` +
|
||||
` • 绑定单据发起审核: hose-aipro bind <单号> <索引号> (例如: hose-aipro bind S26000001 1)\n`;
|
||||
return { stdout: title + table + tip, stderr: "", exitCode: 0 };
|
||||
const scopes = repo.listScopes().map((s) => ({
|
||||
index: s.index,
|
||||
scope: s.scope,
|
||||
}));
|
||||
return { stdout: JSON.stringify(scopes, null, 2) + "\n", stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
// ── 2. 查看审核要点清单(纯规则元数据,与具体单据无关)────────────────
|
||||
@@ -530,22 +513,6 @@ export async function runAiProCli(rawArgs: string[]): Promise<{ stdout: string;
|
||||
return { stdout: title + table, stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
// ── 6. 规约快捷查看 ───────────────────────────────────────────────────
|
||||
case "rules":
|
||||
case "rule":
|
||||
case "scopes": {
|
||||
const scopes = repo.listScopes();
|
||||
const headers = ["索引号", "适用场景 (Scope)", "有效规则数", "包含规则编号"];
|
||||
const rows = scopes.map((s) => [
|
||||
s.index,
|
||||
s.scope,
|
||||
s.ruleCount,
|
||||
s.ruleCodes.map((c) => `#${c}`).join(", "),
|
||||
]);
|
||||
const table = printTable(headers, rows);
|
||||
const title = `====== [AI PRO] 规约场景索引库 (共 ${scopes.length} 个场景) ======\n`;
|
||||
return { stdout: title + table, stderr: "", exitCode: 0 };
|
||||
}
|
||||
|
||||
// ── 7. 帮助 ───────────────────────────────────────────────────────────
|
||||
case "help":
|
||||
|
||||
Reference in new issue
Block a user