iter(g172): 列表命令支持 JSON 输出
This commit is contained in:
@@ -125,6 +125,10 @@ function loadIndex() {
|
||||
function cmdList(args = []) {
|
||||
const { packages } = loadIndex();
|
||||
if (!packages.length) return console.log('(no packages indexed)');
|
||||
if (args.includes('--json')) { // 机器可读:包 + 组件 id 清单,脚本 / Agent 不必解析文本
|
||||
console.log(JSON.stringify(packages.map((p) => ({ name: p.name, version: p.version, type: p.type, description: p.description, components: (p.docs?.components ?? []).map((c) => c.id) })), null, 2));
|
||||
return;
|
||||
}
|
||||
if (args.includes('--components')) {
|
||||
let total = 0;
|
||||
for (const p of packages) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"entry": "bin/ua.js",
|
||||
"exports": [
|
||||
"ua index:扫描 packages/ 两层目录的 ua.manifest.json,生成 .ua/index.json 与 llms.txt",
|
||||
"ua list:列出注册表内所有包与组件数",
|
||||
"ua list:列出注册表内所有包与组件数;--json 输出「包 + 组件 id」结构化数组,--components 逐组件展开",
|
||||
"ua info <包名|组件id>:包名返回摘要,组件 id 返回 props 表 + 步骤 + 示例;--json 输出原始清单",
|
||||
"ua docs:生成人类文档站 apps/docs/index.html + demo.html 与 Agent 全量文档 llms-full.txt",
|
||||
"ua style:注释规范门禁(导出必须 /*** ***/、接口字段行尾注释、行注释中文),违规退出码 1",
|
||||
@@ -43,4 +43,4 @@
|
||||
],
|
||||
"components": []
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user