speccore 8.3.340 → 8.3.345
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/.agents/skills/speccore-router/SKILL.md +0 -2
- package/README.en.md +3 -11
- package/README.md +3 -13
- package/dist/cli.js +1 -187
- package/dist/cli.js.map +1 -1
- package/dist/commands/analyze.d.ts.map +1 -1
- package/dist/commands/analyze.js +583 -502
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/ask.d.ts +1 -0
- package/dist/commands/ask.d.ts.map +1 -1
- package/dist/commands/ask.js +5 -18
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +9 -7
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/done.js +1 -5
- package/dist/commands/done.js.map +1 -1
- package/dist/commands/execute.js +2 -2
- package/dist/commands/execute.js.map +1 -1
- package/dist/commands/help.js +5 -54
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -31
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/iteration/taskify.d.ts.map +1 -1
- package/dist/commands/iteration/taskify.js +5 -147
- package/dist/commands/iteration/taskify.js.map +1 -1
- package/dist/commands/pr.d.ts.map +1 -1
- package/dist/commands/pr.js +3 -5
- package/dist/commands/pr.js.map +1 -1
- package/dist/commands/search.js +1 -1
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/update-env-configs.d.ts.map +1 -1
- package/dist/commands/update-env-configs.js +2 -1
- package/dist/commands/update-env-configs.js.map +1 -1
- package/dist/commands/update.d.ts +4 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +41 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/welcome.d.ts.map +1 -1
- package/dist/commands/welcome.js +37 -36
- package/dist/commands/welcome.js.map +1 -1
- package/dist/core/analyze-engine.js +3 -3
- package/dist/core/analyze-engine.js.map +1 -1
- package/dist/core/arbitration/l3-human-arbiter.js +1 -1
- package/dist/core/arbitration/l3-human-arbiter.js.map +1 -1
- package/dist/core/arbitration/verdict-generator.js +1 -1
- package/dist/core/arbitration/verdict-generator.js.map +1 -1
- package/dist/core/ask-engine.d.ts.map +1 -1
- package/dist/core/ask-engine.js +16 -42
- package/dist/core/ask-engine.js.map +1 -1
- package/dist/core/code-graph/reporter.d.ts.map +1 -1
- package/dist/core/code-graph/reporter.js +3 -12
- package/dist/core/code-graph/reporter.js.map +1 -1
- package/dist/core/code-graph/requirement-linker.js +1 -1
- package/dist/core/code-graph/requirement-linker.js.map +1 -1
- package/dist/core/code-scanner.js +1 -1
- package/dist/core/code-scanner.js.map +1 -1
- package/dist/core/deploy/engine.d.ts.map +1 -1
- package/dist/core/deploy/engine.js +58 -44
- package/dist/core/deploy/engine.js.map +1 -1
- package/dist/core/environment-config.d.ts +2 -0
- package/dist/core/environment-config.d.ts.map +1 -1
- package/dist/core/environment-config.js +6 -1
- package/dist/core/environment-config.js.map +1 -1
- package/dist/core/error-diagnosis.js +2 -2
- package/dist/core/error-diagnosis.js.map +1 -1
- package/dist/core/function-map.d.ts +49 -0
- package/dist/core/function-map.d.ts.map +1 -0
- package/dist/core/function-map.js +280 -0
- package/dist/core/function-map.js.map +1 -0
- package/dist/core/git-integration.d.ts +6 -0
- package/dist/core/git-integration.d.ts.map +1 -1
- package/dist/core/git-integration.js +11 -0
- package/dist/core/git-integration.js.map +1 -1
- package/dist/core/global-knowledge.js +1 -1
- package/dist/core/index-guard.d.ts.map +1 -1
- package/dist/core/index-guard.js +4 -26
- package/dist/core/index-guard.js.map +1 -1
- package/dist/core/intent-recognition.d.ts +1 -1
- package/dist/core/intent-recognition.d.ts.map +1 -1
- package/dist/core/intent-recognition.js +5 -63
- package/dist/core/intent-recognition.js.map +1 -1
- package/dist/core/page-bundle.d.ts +25 -0
- package/dist/core/page-bundle.d.ts.map +1 -0
- package/dist/core/page-bundle.js +144 -0
- package/dist/core/page-bundle.js.map +1 -0
- package/dist/core/prompt-builder.d.ts +9 -0
- package/dist/core/prompt-builder.d.ts.map +1 -1
- package/dist/core/prompt-builder.js +135 -3
- package/dist/core/prompt-builder.js.map +1 -1
- package/dist/core/prompt-plugins/analyze-graph-plugin.js +1 -1
- package/dist/core/prompt-plugins/analyze-graph-plugin.js.map +1 -1
- package/dist/core/structured-extractor.d.ts +6 -0
- package/dist/core/structured-extractor.d.ts.map +1 -1
- package/dist/core/structured-extractor.js +6 -0
- package/dist/core/structured-extractor.js.map +1 -1
- package/dist/core/unified-config.d.ts.map +1 -1
- package/dist/core/unified-config.js +29 -19
- package/dist/core/unified-config.js.map +1 -1
- package/dist/core/usage-analytics.js +1 -1
- package/dist/core/usage-analytics.js.map +1 -1
- package/package.json +1 -1
- package/templates/html/speccore-ask-guide.html +1 -1
- package/templates/html/speccore-ask-pipeline.html +1 -1
- package/templates/html/speccore-ask-result.html +1 -1
- package/templates/html/speccore-help.html +2 -2
- package/templates/speccore-yml-example.yml +24 -24
- package/dist/commands/audit.d.ts +0 -12
- package/dist/commands/audit.d.ts.map +0 -1
- package/dist/commands/audit.js +0 -540
- package/dist/commands/audit.js.map +0 -1
- package/dist/commands/backup.d.ts +0 -18
- package/dist/commands/backup.d.ts.map +0 -1
- package/dist/commands/backup.js +0 -102
- package/dist/commands/backup.js.map +0 -1
- package/dist/commands/baseline.d.ts +0 -13
- package/dist/commands/baseline.d.ts.map +0 -1
- package/dist/commands/baseline.js +0 -227
- package/dist/commands/baseline.js.map +0 -1
- package/dist/commands/chain.d.ts +0 -55
- package/dist/commands/chain.d.ts.map +0 -1
- package/dist/commands/chain.js +0 -501
- package/dist/commands/chain.js.map +0 -1
- package/dist/commands/clarify.d.ts +0 -17
- package/dist/commands/clarify.d.ts.map +0 -1
- package/dist/commands/clarify.js +0 -351
- package/dist/commands/clarify.js.map +0 -1
- package/dist/commands/code-index.d.ts +0 -21
- package/dist/commands/code-index.d.ts.map +0 -1
- package/dist/commands/code-index.js +0 -193
- package/dist/commands/code-index.js.map +0 -1
- package/dist/commands/context.d.ts +0 -10
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -213
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/current.d.ts +0 -10
- package/dist/commands/current.d.ts.map +0 -1
- package/dist/commands/current.js +0 -53
- package/dist/commands/current.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -18
- package/dist/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev.js +0 -854
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/diff.d.ts +0 -10
- package/dist/commands/diff.d.ts.map +0 -1
- package/dist/commands/diff.js +0 -160
- package/dist/commands/diff.js.map +0 -1
- package/dist/commands/global-status.d.ts +0 -9
- package/dist/commands/global-status.d.ts.map +0 -1
- package/dist/commands/global-status.js +0 -135
- package/dist/commands/global-status.js.map +0 -1
- package/dist/commands/graph.d.ts +0 -25
- package/dist/commands/graph.d.ts.map +0 -1
- package/dist/commands/graph.js +0 -523
- package/dist/commands/graph.js.map +0 -1
- package/dist/commands/handover.d.ts +0 -11
- package/dist/commands/handover.d.ts.map +0 -1
- package/dist/commands/handover.js +0 -170
- package/dist/commands/handover.js.map +0 -1
- package/dist/commands/health.d.ts +0 -7
- package/dist/commands/health.d.ts.map +0 -1
- package/dist/commands/health.js +0 -80
- package/dist/commands/health.js.map +0 -1
- package/dist/commands/history.d.ts +0 -9
- package/dist/commands/history.d.ts.map +0 -1
- package/dist/commands/history.js +0 -117
- package/dist/commands/history.js.map +0 -1
- package/dist/commands/impact.d.ts +0 -12
- package/dist/commands/impact.d.ts.map +0 -1
- package/dist/commands/impact.js +0 -238
- package/dist/commands/impact.js.map +0 -1
- package/dist/commands/import.d.ts +0 -19
- package/dist/commands/import.d.ts.map +0 -1
- package/dist/commands/import.js +0 -673
- package/dist/commands/import.js.map +0 -1
- package/dist/commands/knowledge.d.ts +0 -6
- package/dist/commands/knowledge.d.ts.map +0 -1
- package/dist/commands/knowledge.js +0 -94
- package/dist/commands/knowledge.js.map +0 -1
- package/dist/commands/lifecycle.d.ts +0 -9
- package/dist/commands/lifecycle.d.ts.map +0 -1
- package/dist/commands/lifecycle.js +0 -288
- package/dist/commands/lifecycle.js.map +0 -1
- package/dist/commands/merge-check.d.ts +0 -10
- package/dist/commands/merge-check.d.ts.map +0 -1
- package/dist/commands/merge-check.js +0 -183
- package/dist/commands/merge-check.js.map +0 -1
- package/dist/commands/notify.d.ts +0 -13
- package/dist/commands/notify.d.ts.map +0 -1
- package/dist/commands/notify.js +0 -63
- package/dist/commands/notify.js.map +0 -1
- package/dist/commands/rag-index.d.ts +0 -19
- package/dist/commands/rag-index.d.ts.map +0 -1
- package/dist/commands/rag-index.js +0 -286
- package/dist/commands/rag-index.js.map +0 -1
- package/dist/commands/recommend.d.ts +0 -13
- package/dist/commands/recommend.d.ts.map +0 -1
- package/dist/commands/recommend.js +0 -37
- package/dist/commands/recommend.js.map +0 -1
- package/dist/commands/refresh.d.ts +0 -21
- package/dist/commands/refresh.d.ts.map +0 -1
- package/dist/commands/refresh.js +0 -211
- package/dist/commands/refresh.js.map +0 -1
- package/dist/commands/rollback.d.ts +0 -8
- package/dist/commands/rollback.d.ts.map +0 -1
- package/dist/commands/rollback.js +0 -113
- package/dist/commands/rollback.js.map +0 -1
- package/dist/commands/status.d.ts +0 -7
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -262
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/trace.d.ts +0 -12
- package/dist/commands/trace.d.ts.map +0 -1
- package/dist/commands/trace.js +0 -163
- package/dist/commands/trace.js.map +0 -1
- package/dist/commands/tracker.d.ts +0 -2
- package/dist/commands/tracker.d.ts.map +0 -1
- package/dist/commands/tracker.js +0 -28
- package/dist/commands/tracker.js.map +0 -1
- package/dist/commands/verdict.d.ts +0 -16
- package/dist/commands/verdict.d.ts.map +0 -1
- package/dist/commands/verdict.js +0 -189
- package/dist/commands/verdict.js.map +0 -1
- package/dist/commands/workspace.d.ts +0 -20
- package/dist/commands/workspace.d.ts.map +0 -1
- package/dist/commands/workspace.js +0 -142
- package/dist/commands/workspace.js.map +0 -1
- package/dist/core/constraint-set.d.ts +0 -67
- package/dist/core/constraint-set.d.ts.map +0 -1
- package/dist/core/constraint-set.js +0 -151
- package/dist/core/constraint-set.js.map +0 -1
- package/dist/core/smart-recommend.d.ts +0 -16
- package/dist/core/smart-recommend.d.ts.map +0 -1
- package/dist/core/smart-recommend.js +0 -149
- package/dist/core/smart-recommend.js.map +0 -1
- package/dist/core/task-type-registry.d.ts +0 -110
- package/dist/core/task-type-registry.d.ts.map +0 -1
- package/dist/core/task-type-registry.js +0 -334
- package/dist/core/task-type-registry.js.map +0 -1
- package/dist/utils/mermaid-render.d.ts +0 -39
- package/dist/utils/mermaid-render.d.ts.map +0 -1
- package/dist/utils/mermaid-render.js +0 -284
- package/dist/utils/mermaid-render.js.map +0 -1
|
@@ -44,6 +44,7 @@ exports.outputNeedsInfo = outputNeedsInfo;
|
|
|
44
44
|
exports.resetAssetAudit = resetAssetAudit;
|
|
45
45
|
exports.getAssetAuditText = getAssetAuditText;
|
|
46
46
|
exports.processMarkdownContent = processMarkdownContent;
|
|
47
|
+
exports.collectIterationMediaAssets = collectIterationMediaAssets;
|
|
47
48
|
/**
|
|
48
49
|
* prompt-builder — 统一的 Spec → AI Prompt 构建引擎
|
|
49
50
|
*
|
|
@@ -2122,7 +2123,7 @@ async function buildPrompt(command, options) {
|
|
|
2122
2123
|
listLines.push(`| ${priority} | \`${match.file}\` | ${reasons.join(' / ')} (score:${match.score}) | ${clues.join(';') || '—'} |`);
|
|
2123
2124
|
}
|
|
2124
2125
|
if (sortedMatches.length > 15) {
|
|
2125
|
-
listLines.push(`| … | 其余 ${sortedMatches.length - 15} 个关联文件 | 运行 \`speccore
|
|
2126
|
+
listLines.push(`| … | 其余 ${sortedMatches.length - 15} 个关联文件 | 运行 \`speccore reindex\` 查看全量索引 | — |`);
|
|
2126
2127
|
}
|
|
2127
2128
|
listLines.push('');
|
|
2128
2129
|
listLines.push('### 🔍 深读协议(宿主 AI 执行)');
|
|
@@ -2189,6 +2190,22 @@ async function buildPrompt(command, options) {
|
|
|
2189
2190
|
}
|
|
2190
2191
|
catch { /* 忽略读取失败 */ }
|
|
2191
2192
|
}
|
|
2193
|
+
// v8.3.344+: 注入迭代素材资产(原型 HTML + 参考截图/设计稿)。
|
|
2194
|
+
// 补齐盲区:010-requirements/prototypes/ 与 assets/ 下未被文档引用的素材此前完全无通道。
|
|
2195
|
+
if ((command === 'execute' || command === 'analyze') && options.iteration) {
|
|
2196
|
+
try {
|
|
2197
|
+
const mediaIterDir = await (0, context_1.getIterationDir)(options.iteration);
|
|
2198
|
+
if (mediaIterDir) {
|
|
2199
|
+
const mediaVision = await (0, vision_engine_1.loadVisionConfig)(cwd);
|
|
2200
|
+
const mediaSpec = await collectIterationMediaAssets(mediaIterDir, mediaVision);
|
|
2201
|
+
if (mediaSpec) {
|
|
2202
|
+
extraSpecs.push(mediaSpec);
|
|
2203
|
+
logger_1.logger?.info?.(` 🖼️ 迭代素材: 原型/截图已注入上下文(${Math.round(mediaSpec.content.length / 1000)}K 字符)`);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
catch { /* 素材扫描失败不阻断 */ }
|
|
2208
|
+
}
|
|
2192
2209
|
// 加载全局上下文(智能注入)
|
|
2193
2210
|
const globalContext = await loadGlobalContext(cwd, command, options.platform);
|
|
2194
2211
|
// 加载知识图谱 → 生成任务关联链(< 500 tokens)
|
|
@@ -2240,8 +2257,11 @@ async function buildPrompt(command, options) {
|
|
|
2240
2257
|
};
|
|
2241
2258
|
const rawPrompt = await buildMultiDocPrompt('analyze', ctx, options.analyzeOptions);
|
|
2242
2259
|
// v8.3.3xx+: rawPrompt 路由会丢弃常规 extraSpecs,阅读清单(CLI 导航 + 宿主 AI 深读)单独追加
|
|
2243
|
-
|
|
2244
|
-
const
|
|
2260
|
+
// v8.3.344+: 素材资产(原型/截图)同样随路由追加,保证 analyze 阶段也能看到视觉素材
|
|
2261
|
+
const carryOver = extraSpecs.filter(s => s.name === '📖 相关源码阅读清单' || s.name.startsWith('🖼️ 迭代素材资产'));
|
|
2262
|
+
const finalRawPrompt = carryOver.length > 0
|
|
2263
|
+
? `${rawPrompt}\n\n${carryOver.map(s => s.content).join('\n\n')}`
|
|
2264
|
+
: rawPrompt;
|
|
2245
2265
|
return {
|
|
2246
2266
|
marker: '[SPECCORE_PROMPT]',
|
|
2247
2267
|
version: '1.0',
|
|
@@ -3004,6 +3024,118 @@ async function processMarkdownContent(content, filePath, seenPaths, visionConfig
|
|
|
3004
3024
|
processed = await inlineMarkdownImages(processed, baseDir, seenPaths, visionConfig, options?.maxSvgChars ?? 2000);
|
|
3005
3025
|
return processed;
|
|
3006
3026
|
}
|
|
3027
|
+
/**
|
|
3028
|
+
* v8.3.344+: 扫描迭代素材资产(原型 HTML + 参考截图/设计稿/提取图片)。
|
|
3029
|
+
* 补齐盲区:此前只有「被已加载文档以 Markdown 链接引用」的资产会进入上下文,
|
|
3030
|
+
* 010-requirements/prototypes/ 与 assets/ 下未被引用的原型/截图完全无通道。
|
|
3031
|
+
* 策略:CLI 渲染 HTML 原型语义结构(ARIA 树 + 截图)与视觉描述关键图片,
|
|
3032
|
+
* 其余列路径清单——宿主 AI 按需打开原文件。限额防撑爆上下文。
|
|
3033
|
+
* 导出供单测直接调用(构造临时迭代目录即可验证注入行为)。
|
|
3034
|
+
*/
|
|
3035
|
+
async function collectIterationMediaAssets(iterDir, visionConfig) {
|
|
3036
|
+
const reqDir = (0, path_1.join)(iterDir, '010-requirements');
|
|
3037
|
+
const scanRoots = [
|
|
3038
|
+
(0, path_1.join)(reqDir, 'prototypes'),
|
|
3039
|
+
(0, path_1.join)(reqDir, 'assets'),
|
|
3040
|
+
];
|
|
3041
|
+
const htmlFiles = [];
|
|
3042
|
+
const imageFiles = [];
|
|
3043
|
+
for (const root of scanRoots) {
|
|
3044
|
+
if (!(await (0, fs_extra_1.pathExists)(root)))
|
|
3045
|
+
continue;
|
|
3046
|
+
await walkMediaFiles(root, htmlFiles, imageFiles, 3);
|
|
3047
|
+
}
|
|
3048
|
+
if (htmlFiles.length === 0 && imageFiles.length === 0)
|
|
3049
|
+
return null;
|
|
3050
|
+
const lines = [];
|
|
3051
|
+
lines.push('## 🖼️ 迭代素材资产(原型 HTML + 参考截图/设计稿)');
|
|
3052
|
+
lines.push('');
|
|
3053
|
+
lines.push('> 以下素材来自迭代需求目录(010-requirements/prototypes/ 与 assets/)。');
|
|
3054
|
+
lines.push('> CLI 已渲染 HTML 原型语义结构与截图、描述关键图片;');
|
|
3055
|
+
lines.push('> 宿主 AI 请按需打开原文件/截图查看完整视觉细节(多模态宿主可直接读截图 PNG)。');
|
|
3056
|
+
lines.push('');
|
|
3057
|
+
// 1. HTML 原型:ARIA 语义树 + 截图路径,渲染失败降级纯文本
|
|
3058
|
+
const MAX_HTML = 3;
|
|
3059
|
+
const MAX_ARIA_CHARS = 1200;
|
|
3060
|
+
for (const htmlPath of htmlFiles.slice(0, MAX_HTML)) {
|
|
3061
|
+
const rel = (0, path_1.relative)(iterDir, htmlPath);
|
|
3062
|
+
const proto = await (0, html_prototype_1.renderHtmlPrototype)(htmlPath);
|
|
3063
|
+
lines.push(`### 原型: \`${rel}\``);
|
|
3064
|
+
lines.push('');
|
|
3065
|
+
if (proto?.accessibilityTree) {
|
|
3066
|
+
const tree = proto.accessibilityTree.length > MAX_ARIA_CHARS
|
|
3067
|
+
? proto.accessibilityTree.slice(0, MAX_ARIA_CHARS) + '\n…(结构截断)'
|
|
3068
|
+
: proto.accessibilityTree;
|
|
3069
|
+
lines.push('```yaml');
|
|
3070
|
+
lines.push(tree);
|
|
3071
|
+
lines.push('```');
|
|
3072
|
+
if (proto.screenshotPath) {
|
|
3073
|
+
lines.push(`> 📷 截图: \`${proto.screenshotPath}\`(多模态宿主可直接查看)`);
|
|
3074
|
+
}
|
|
3075
|
+
recordAssetAudit(rel, '原型已渲染(ARIA 结构 + 截图)');
|
|
3076
|
+
}
|
|
3077
|
+
else {
|
|
3078
|
+
const htmlContent = await (0, fs_extra_1.readFile)(htmlPath, 'utf-8').catch(() => '');
|
|
3079
|
+
lines.push('> ⚠️ Playwright 渲染失败,以下为纯文本降级提取;宿主 AI 请直接打开 HTML 查看。');
|
|
3080
|
+
lines.push('');
|
|
3081
|
+
lines.push((0, rag_engine_1.extractHtmlText)(htmlContent).slice(0, MAX_ARIA_CHARS));
|
|
3082
|
+
recordAssetAudit(rel, '原型纯文本降级(请宿主打开原文件)');
|
|
3083
|
+
}
|
|
3084
|
+
lines.push('');
|
|
3085
|
+
}
|
|
3086
|
+
if (htmlFiles.length > MAX_HTML) {
|
|
3087
|
+
const rest = htmlFiles.slice(MAX_HTML).map(p => `\`${(0, path_1.relative)(iterDir, p)}\``).join(', ');
|
|
3088
|
+
lines.push(`> 其余 ${htmlFiles.length - MAX_HTML} 个原型未注入(宿主 AI 可按需打开): ${rest}`);
|
|
3089
|
+
lines.push('');
|
|
3090
|
+
}
|
|
3091
|
+
// 2. 参考图片:视觉模型描述前 N 张,其余列路径 + 大小
|
|
3092
|
+
const MAX_IMAGES = 10;
|
|
3093
|
+
const MAX_VISION = 3;
|
|
3094
|
+
lines.push('### 参考图片(截图/设计稿/提取素材)');
|
|
3095
|
+
lines.push('');
|
|
3096
|
+
let visionUsed = 0;
|
|
3097
|
+
for (const imgPath of imageFiles.slice(0, MAX_IMAGES)) {
|
|
3098
|
+
const rel = (0, path_1.relative)(iterDir, imgPath);
|
|
3099
|
+
if ((0, vision_engine_1.isVisionEnabled)(visionConfig) && visionUsed < MAX_VISION) {
|
|
3100
|
+
const result = await (0, vision_engine_1.describeImage)(imgPath, visionConfig);
|
|
3101
|
+
if (result.success) {
|
|
3102
|
+
visionUsed++;
|
|
3103
|
+
lines.push(`- **${rel}**(视觉描述): ${result.description.slice(0, 300)}`);
|
|
3104
|
+
recordAssetAudit(rel, '视觉模型已描述');
|
|
3105
|
+
continue;
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
const size = await (0, fs_extra_1.stat)(imgPath).then(s => `${(s.size / 1024).toFixed(1)}KB`).catch(() => '?');
|
|
3109
|
+
lines.push(`- \`${rel}\`(${size},宿主 AI 请打开查看)`);
|
|
3110
|
+
recordAssetAudit(rel, '图片已列入清单(宿主 AI 请打开查看)');
|
|
3111
|
+
}
|
|
3112
|
+
if (imageFiles.length > MAX_IMAGES) {
|
|
3113
|
+
lines.push(`> 其余 ${imageFiles.length - MAX_IMAGES} 张图片未列出。`);
|
|
3114
|
+
}
|
|
3115
|
+
return {
|
|
3116
|
+
name: '🖼️ 迭代素材资产(原型/截图/设计稿)',
|
|
3117
|
+
path: 'iteration-media-assets.md',
|
|
3118
|
+
content: lines.join('\n'),
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
/** 递归收集素材文件(HTML 原型 + 图片),限深度防爆炸 */
|
|
3122
|
+
async function walkMediaFiles(dir, htmlOut, imgOut, maxDepth, depth = 0) {
|
|
3123
|
+
if (depth > maxDepth)
|
|
3124
|
+
return;
|
|
3125
|
+
const entries = await (0, fs_extra_1.readdir)(dir, { withFileTypes: true }).catch(() => []);
|
|
3126
|
+
for (const e of entries) {
|
|
3127
|
+
const p = (0, path_1.join)(dir, e.name);
|
|
3128
|
+
if (e.isDirectory()) {
|
|
3129
|
+
await walkMediaFiles(p, htmlOut, imgOut, maxDepth, depth + 1);
|
|
3130
|
+
}
|
|
3131
|
+
else if (/\.html?$/i.test(e.name)) {
|
|
3132
|
+
htmlOut.push(p);
|
|
3133
|
+
}
|
|
3134
|
+
else if (/\.(png|jpe?g|gif|webp|svg)$/i.test(e.name)) {
|
|
3135
|
+
imgOut.push(p);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3007
3139
|
function generateExamples(command, req) {
|
|
3008
3140
|
const iter = req.provided.iteration || 'Q1';
|
|
3009
3141
|
const task = req.availableOptions?.tasks?.[0] || 'Task-001';
|