@openprd/cli 0.1.10 → 0.1.11
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/.openprd/benchmarks/index.md +17 -15
- package/.openprd/benchmarks/sources.yaml +53 -1
- package/.openprd/schema/prd.schema.yaml +15 -0
- package/.openprd/templates/base/intake.md +13 -0
- package/.openprd/templates/base/prd.md +15 -0
- package/AGENTS.md +1 -1
- package/package.json +1 -1
- package/skills/openprd-benchmark-router/SKILL.md +2 -1
- package/skills/openprd-requirement-intake/SKILL.md +3 -3
- package/skills/openprd-requirement-intake/references/prd-template-lenses.md +2 -2
- package/skills/openprd-requirement-intake/references/startup-validation-lens.md +98 -13
- package/skills/openprd-shared/SKILL.md +1 -1
- package/src/agent-integration.js +6 -6
- package/src/brainstorm-artifacts.js +156 -8
- package/src/brainstorm-presentation.js +14 -4
- package/src/brainstorm.js +165 -2
- package/src/cli/quality-print.js +9 -3
- package/src/codex-hook-runner-template.mjs +6 -6
- package/src/diagram-core.js +384 -151
- package/src/html-artifacts.js +403 -50
- package/src/knowledge.js +59 -12
- package/src/prd-core.js +101 -2
- package/src/quality-html-artifact.js +30 -5
- package/src/quality.js +20 -10
- package/src/workspace-core.js +38 -0
- package/src/workspace-workflow.js +126 -9
package/src/knowledge.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
1
2
|
import fs from 'node:fs/promises';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { appendJsonl, cjoin, exists, readJson, readJsonl, writeJson, writeText } from './fs-utils.js';
|
|
@@ -858,16 +859,55 @@ function deriveKnowledgeNames(source, options = {}) {
|
|
|
858
859
|
return { incidentId, patternId, skillName };
|
|
859
860
|
}
|
|
860
861
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
862
|
+
const LOW_SIGNAL_TITLE_PATTERN = /^(只回复|回复|继续|可以|好的|没问题|嗯|哦|行|是|对|确认|同意|执行|开始|ok|okay|yes|done|go)([\s,。,.!!??]|$)/i;
|
|
863
|
+
|
|
864
|
+
function titleLooksLikeRawInstruction(text) {
|
|
865
|
+
const value = String(text ?? '').trim();
|
|
866
|
+
if (!value) return true;
|
|
867
|
+
if (value.length < 8) return true;
|
|
868
|
+
return LOW_SIGNAL_TITLE_PATTERN.test(value);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
function describeTouchedFilesTitle(touchedFiles) {
|
|
872
|
+
const files = [...new Set((touchedFiles ?? []).map((file) => String(file ?? '').trim()).filter(Boolean))];
|
|
873
|
+
if (files.length === 0) return null;
|
|
874
|
+
const primary = files[0].split('/').filter(Boolean).at(-1);
|
|
875
|
+
return files.length > 1
|
|
876
|
+
? `围绕 ${primary} 等 ${files.length} 个文件的实现经验`
|
|
877
|
+
: `围绕 ${primary} 的实现经验`;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function buildTurnReviewTitle(raw, source, touchedFiles = []) {
|
|
881
|
+
const structured = firstString(raw?.title, raw?.summary?.title, source.title);
|
|
882
|
+
if (structured && !titleLooksLikeRawInstruction(structured)) return structured;
|
|
883
|
+
const rootCause = source.rootCauseCandidates?.[0]?.title;
|
|
884
|
+
if (rootCause && !titleLooksLikeRawInstruction(rootCause)) return rootCause;
|
|
885
|
+
const prompt = firstString(raw?.promptPreview, raw?.prompt);
|
|
886
|
+
if (prompt && !titleLooksLikeRawInstruction(prompt)) return prompt;
|
|
887
|
+
return describeTouchedFilesTitle(touchedFiles)
|
|
888
|
+
?? firstString(structured, source.sourceId, '项目经验草案')
|
|
889
|
+
?? '项目经验草案';
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
function knowledgeCandidateFingerprint(categories = [], touchedFiles = []) {
|
|
893
|
+
const normalizedCategories = [...new Set((categories ?? []).map((item) => String(item ?? '').trim()).filter(Boolean))].sort();
|
|
894
|
+
const normalizedFiles = [...new Set((touchedFiles ?? []).map((item) => String(item ?? '').trim()).filter(Boolean))].sort();
|
|
895
|
+
return crypto.createHash('sha256').update(JSON.stringify([normalizedCategories, normalizedFiles])).digest('hex').slice(0, 16);
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
async function findPendingCandidateByFingerprint(projectRoot, fingerprint, excludeId) {
|
|
899
|
+
const index = await readKnowledgeIndex(projectRoot);
|
|
900
|
+
for (const entry of index.candidates ?? []) {
|
|
901
|
+
if (!entry?.candidateId || entry.candidateId === excludeId) continue;
|
|
902
|
+
const candidate = await readCandidateById(projectRoot, entry.candidateId);
|
|
903
|
+
if (!candidate || !isPendingKnowledgeCandidateStatus(normalizeCandidateStatus(candidate.status))) continue;
|
|
904
|
+
const existingFingerprint = candidate.fingerprint
|
|
905
|
+
?? knowledgeCandidateFingerprint(candidate.categories, candidate.touchedFiles);
|
|
906
|
+
if (existingFingerprint === fingerprint) {
|
|
907
|
+
return candidate;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return null;
|
|
871
911
|
}
|
|
872
912
|
|
|
873
913
|
async function loadRawReviewInput(projectRoot, from) {
|
|
@@ -1432,11 +1472,16 @@ export async function reviewKnowledgeWorkspace(projectRoot, options = {}) {
|
|
|
1432
1472
|
};
|
|
1433
1473
|
}
|
|
1434
1474
|
|
|
1435
|
-
const title = buildTurnReviewTitle(raw, source);
|
|
1475
|
+
const title = buildTurnReviewTitle(raw, source, substantiveTouchedFiles);
|
|
1436
1476
|
const rawCandidateRef = firstString(raw.knowledgeCandidateId, raw.id);
|
|
1437
|
-
|
|
1477
|
+
let candidateId = rawCandidateRef
|
|
1438
1478
|
? (rawCandidateRef.startsWith('candidate-') ? rawCandidateRef : `candidate-${slugify(rawCandidateRef, 'knowledge')}`)
|
|
1439
1479
|
: `candidate-${slugify(source.sourceId ?? title, 'knowledge')}`;
|
|
1480
|
+
const fingerprint = knowledgeCandidateFingerprint(categories, substantiveTouchedFiles);
|
|
1481
|
+
const duplicateCandidate = await findPendingCandidateByFingerprint(projectRoot, fingerprint, candidateId);
|
|
1482
|
+
if (duplicateCandidate?.candidateId) {
|
|
1483
|
+
candidateId = duplicateCandidate.candidateId;
|
|
1484
|
+
}
|
|
1440
1485
|
const promotedSource = { ...source, sourceId: candidateId };
|
|
1441
1486
|
const names = deriveKnowledgeNames(promotedSource, { stablePattern: false });
|
|
1442
1487
|
const candidateDir = knowledgePath(projectRoot, cjoin(KNOWLEDGE_CANDIDATES_DIR, candidateId));
|
|
@@ -1482,6 +1527,8 @@ export async function reviewKnowledgeWorkspace(projectRoot, options = {}) {
|
|
|
1482
1527
|
const candidate = {
|
|
1483
1528
|
...draftCandidate,
|
|
1484
1529
|
abstraction,
|
|
1530
|
+
fingerprint,
|
|
1531
|
+
occurrences: (readJsonObject(existingCandidate)?.occurrences ?? 0) + 1,
|
|
1485
1532
|
};
|
|
1486
1533
|
const userFacingExperience = buildKnowledgeUserFacingExperience({
|
|
1487
1534
|
candidate,
|
package/src/prd-core.js
CHANGED
|
@@ -242,11 +242,26 @@ export function buildPrdSnapshot(ws, options = {}) {
|
|
|
242
242
|
validation: {
|
|
243
243
|
community: normalizeArray(pickValue(options.community, state.community)),
|
|
244
244
|
seedUsers: normalizeArray(pickValue(options.seedUsers, state.seedUsers)),
|
|
245
|
+
communityFit: normalizeArray(pickValue(options.communityFit, state.communityFit)),
|
|
245
246
|
currentAlternative: pickValue(options.currentAlternative, state.currentAlternative, state.asIs),
|
|
247
|
+
painEvidence: normalizeArray(pickValue(options.painEvidence, state.painEvidence)),
|
|
246
248
|
manualPath: normalizeArray(pickValue(options.manualPath, state.manualPath)),
|
|
249
|
+
manualPlaybook: normalizeArray(pickValue(options.manualPlaybook, state.manualPlaybook)),
|
|
247
250
|
commitmentSignals: normalizeArray(pickValue(options.commitmentSignals, state.commitmentSignals)),
|
|
248
251
|
firstValidationStep: pickValue(options.firstValidationStep, state.firstValidationStep, state.nextStep),
|
|
249
252
|
defaultAlivePlan: normalizeArray(pickValue(options.defaultAlivePlan, state.defaultAlivePlan)),
|
|
253
|
+
paymentProof: normalizeArray(pickValue(options.paymentProof, state.paymentProof)),
|
|
254
|
+
mvpSlice: pickValue(options.mvpSlice, state.mvpSlice),
|
|
255
|
+
weekendTest: pickValue(options.weekendTest, state.weekendTest),
|
|
256
|
+
smallestExecution: normalizeArray(pickValue(options.smallestExecution, state.smallestExecution)),
|
|
257
|
+
productizeGate: normalizeArray(pickValue(options.productizeGate, state.productizeGate)),
|
|
258
|
+
firstCustomerPath: normalizeArray(pickValue(options.firstCustomerPath, state.firstCustomerPath)),
|
|
259
|
+
pricingHypothesis: pickValue(options.pricingHypothesis, state.pricingHypothesis),
|
|
260
|
+
customerOneProfitability: pickValue(options.customerOneProfitability, state.customerOneProfitability),
|
|
261
|
+
growthDiscipline: normalizeArray(pickValue(options.growthDiscipline, state.growthDiscipline)),
|
|
262
|
+
reversibility: pickValue(options.reversibility, state.reversibility),
|
|
263
|
+
customerTruth: pickValue(options.customerTruth, state.customerTruth),
|
|
264
|
+
valuesFit: pickValue(options.valuesFit, state.valuesFit),
|
|
250
265
|
},
|
|
251
266
|
scope: {
|
|
252
267
|
inScope: normalizeArray(pickValue(options.inScope, state.inScope)),
|
|
@@ -379,11 +394,26 @@ export function renderPrdMarkdown(snapshot) {
|
|
|
379
394
|
renderSection('验证与创业闭环', [
|
|
380
395
|
['可触达社区', sections.validation.community],
|
|
381
396
|
['第一批种子用户', sections.validation.seedUsers],
|
|
397
|
+
['社区契合与触达依据', sections.validation.communityFit],
|
|
382
398
|
['当前替代方案', sections.validation.currentAlternative],
|
|
399
|
+
['痛点与替代证据', sections.validation.painEvidence],
|
|
383
400
|
['手工交付路径', sections.validation.manualPath],
|
|
401
|
+
['手工作战卡', sections.validation.manualPlaybook],
|
|
384
402
|
['承诺信号', sections.validation.commitmentSignals],
|
|
385
403
|
['首个低成本验证', sections.validation.firstValidationStep],
|
|
386
404
|
['先活下来方案', sections.validation.defaultAlivePlan],
|
|
405
|
+
['付费验证信号', sections.validation.paymentProof],
|
|
406
|
+
['第一版只做一件事', sections.validation.mvpSlice],
|
|
407
|
+
['周末级验证', sections.validation.weekendTest],
|
|
408
|
+
['最小工具桥接', sections.validation.smallestExecution],
|
|
409
|
+
['产品化门槛', sections.validation.productizeGate],
|
|
410
|
+
['第一批客户路径', sections.validation.firstCustomerPath],
|
|
411
|
+
['初始收费假设', sections.validation.pricingHypothesis],
|
|
412
|
+
['客户 1 盈利路径', sections.validation.customerOneProfitability],
|
|
413
|
+
['销售与增长纪律', sections.validation.growthDiscipline],
|
|
414
|
+
['可逆性判断', sections.validation.reversibility],
|
|
415
|
+
['客户真问题校验', sections.validation.customerTruth],
|
|
416
|
+
['价值观一致性', sections.validation.valuesFit],
|
|
387
417
|
]),
|
|
388
418
|
renderSection('范围与非目标', [
|
|
389
419
|
['范围内', sections.scope.inScope],
|
|
@@ -477,6 +507,32 @@ const BUSINESS_GUARDRAIL_FIELD_DESCRIPTORS = [
|
|
|
477
507
|
{ section: 'businessGuardrails', path: 'businessGuardrails.stopLossActions', label: '止损动作', prompt: '触发异常后,应该降级、暂停、关闭哪些能力,谁来处理?' },
|
|
478
508
|
];
|
|
479
509
|
|
|
510
|
+
|
|
511
|
+
const VALIDATION_REQUIRED_FIELD_DESCRIPTORS = [
|
|
512
|
+
{ section: 'validation', path: 'validation.community', label: '第一批可触达人群', prompt: '第一批最容易触达的社区、渠道或人群是谁?' },
|
|
513
|
+
{ section: 'validation', path: 'validation.seedUsers', label: '种子用户', prompt: '至少 3 到 10 个最该先找的人是谁?' },
|
|
514
|
+
{ section: 'validation', path: 'validation.communityFit', label: '社区契合', prompt: '你为什么算这个社区里的自己人?你现在是否已经在真实参与或贡献,他们为什么愿意先相信你?' },
|
|
515
|
+
{ section: 'validation', path: 'validation.currentAlternative', label: '当前替代方案', prompt: '用户现在主要靠什么替代方案、流程或人工方式在解决?' },
|
|
516
|
+
{ section: 'validation', path: 'validation.painEvidence', label: '痛点证据', prompt: '这个问题到底有多痛,用户已经在为更差的办法花什么时间或金钱?' },
|
|
517
|
+
{ section: 'validation', path: 'validation.manualPath', label: '手工交付路径', prompt: '如果先不做完整产品,怎么靠手工服务或半自动流程把价值跑出来?' },
|
|
518
|
+
{ section: 'validation', path: 'validation.manualPlaybook', label: '手工作战卡', prompt: '触发条件、步骤、工具、耗时和交接点分别是什么?' },
|
|
519
|
+
{ section: 'validation', path: 'validation.commitmentSignals', label: '承诺信号', prompt: '什么真实承诺最能证明这不是口头兴趣?' },
|
|
520
|
+
{ section: 'validation', path: 'validation.firstValidationStep', label: '最低成本验证', prompt: '最低成本先验证哪一步最关键?' },
|
|
521
|
+
{ section: 'validation', path: 'validation.defaultAlivePlan', label: '先活下来方案', prompt: '验证阶段怎样不把成本、复杂度和维护负担一下子做爆?' },
|
|
522
|
+
{ section: 'validation', path: 'validation.paymentProof', label: '付费验证信号', prompt: '有没有 10 个样本、3/10 付费意愿或更强交易信号?' },
|
|
523
|
+
{ section: 'validation', path: 'validation.mvpSlice', label: '一件事 MVP', prompt: '第一版到底只做哪一件事?' },
|
|
524
|
+
{ section: 'validation', path: 'validation.weekendTest', label: '周末级验证', prompt: '能不能压成周末级 MVP、顾问式试跑或更轻验证?' },
|
|
525
|
+
{ section: 'validation', path: 'validation.smallestExecution', label: '最小工具桥接', prompt: '能不能先用 spreadsheet、表单或 no-code 工具把第一版跑起来?如果必须开始做产品,也只自动化最重复的一步并先压成 forms / lists / CRUD 骨架;不要先为假想中的未来客户造复杂能力。' },
|
|
526
|
+
{ section: 'validation', path: 'validation.productizeGate', label: '产品化门槛', prompt: '达到什么条件才允许继续产品化或加功能?先服务今天已经存在的重复需求,不要提前为未来规模开壳。' },
|
|
527
|
+
{ section: 'validation', path: 'validation.firstCustomerPath', label: '第一批客户路径', prompt: '第一批客户最现实的触达顺序是什么?' },
|
|
528
|
+
{ section: 'validation', path: 'validation.pricingHypothesis', label: '初始收费假设', prompt: '从第一个客户开始准备怎么收费?' },
|
|
529
|
+
{ section: 'validation', path: 'validation.customerOneProfitability', label: '客户 1 盈利路径', prompt: '第一个客户如何覆盖时间和交付成本?' },
|
|
530
|
+
{ section: 'validation', path: 'validation.growthDiscipline', label: '增长纪律', prompt: '销售、launch 和增长阶段准备守哪些纪律?' },
|
|
531
|
+
{ section: 'validation', path: 'validation.reversibility', label: '可逆性', prompt: '如果结果一般,这条路是否容易回退?是否在逼你做重招聘、长期绑定或重平台化这类不可逆决策?' },
|
|
532
|
+
{ section: 'validation', path: 'validation.customerTruth', label: '客户真问题', prompt: '这更像在解决客户真问题,还是满足内部冲动?' },
|
|
533
|
+
{ section: 'validation', path: 'validation.valuesFit', label: '价值观一致性', prompt: '这条路是否符合团队想坚持的价值观和长期经营方式?如果连续这样做 3 到 5 年,你还愿意住在这套业务里吗?' },
|
|
534
|
+
];
|
|
535
|
+
|
|
480
536
|
const TYPE_REQUIRED_FIELD_DESCRIPTORS = {
|
|
481
537
|
consumer: [
|
|
482
538
|
{ section: 'consumer', path: 'typeSpecific.fields.persona', label: '用户画像', prompt: '目标用户画像是什么?' },
|
|
@@ -535,8 +591,49 @@ function isMissingPrdValue(value) {
|
|
|
535
591
|
return false;
|
|
536
592
|
}
|
|
537
593
|
|
|
538
|
-
|
|
594
|
+
function needsValidationLoop(snapshot) {
|
|
595
|
+
const sections = snapshot?.sections ?? {};
|
|
596
|
+
const validation = sections.validation ?? {};
|
|
597
|
+
const explicitValidationSignals = [
|
|
598
|
+
validation.community,
|
|
599
|
+
validation.seedUsers,
|
|
600
|
+
validation.communityFit,
|
|
601
|
+
validation.painEvidence,
|
|
602
|
+
validation.manualPath,
|
|
603
|
+
validation.manualPlaybook,
|
|
604
|
+
validation.commitmentSignals,
|
|
605
|
+
validation.defaultAlivePlan,
|
|
606
|
+
validation.paymentProof,
|
|
607
|
+
validation.mvpSlice,
|
|
608
|
+
validation.weekendTest,
|
|
609
|
+
validation.smallestExecution,
|
|
610
|
+
validation.productizeGate,
|
|
611
|
+
validation.firstCustomerPath,
|
|
612
|
+
validation.pricingHypothesis,
|
|
613
|
+
validation.customerOneProfitability,
|
|
614
|
+
validation.growthDiscipline,
|
|
615
|
+
validation.reversibility,
|
|
616
|
+
validation.customerTruth,
|
|
617
|
+
validation.valuesFit,
|
|
618
|
+
];
|
|
619
|
+
if (explicitValidationSignals.some((value) => !isMissingPrdValue(value))) {
|
|
620
|
+
return true;
|
|
621
|
+
}
|
|
622
|
+
const text = flattenForSearch({
|
|
623
|
+
problem: sections.problem,
|
|
624
|
+
goals: sections.goals,
|
|
625
|
+
scope: sections.scope,
|
|
626
|
+
requirements: sections.requirements,
|
|
627
|
+
risks: sections.risks,
|
|
628
|
+
});
|
|
629
|
+
return /(创业|脑暴|brainstorm|0\s*(到|to)\s*1|值不值得|worth doing|种子用户|第一批(客户|用户)|社区|workaround|手工交付|顾问式|一件事\s*mvp|周末级|首批成交|default alive|productize|no-code|spreadsheet|first customer)/iu.test(text);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
export function getRequiredFieldDescriptors(productType, options = {}) {
|
|
539
633
|
const descriptors = [...BASE_REQUIRED_FIELD_DESCRIPTORS];
|
|
634
|
+
if (options.includeValidation) {
|
|
635
|
+
descriptors.push(...VALIDATION_REQUIRED_FIELD_DESCRIPTORS);
|
|
636
|
+
}
|
|
540
637
|
if (TYPE_REQUIRED_FIELD_DESCRIPTORS[productType]) {
|
|
541
638
|
descriptors.push(...TYPE_REQUIRED_FIELD_DESCRIPTORS[productType]);
|
|
542
639
|
}
|
|
@@ -568,7 +665,8 @@ export function needsBusinessGuardrails(snapshot) {
|
|
|
568
665
|
|
|
569
666
|
export function analyzePrdSnapshot(snapshot) {
|
|
570
667
|
const productType = snapshot.productType ?? null;
|
|
571
|
-
const
|
|
668
|
+
const includeValidation = needsValidationLoop(snapshot);
|
|
669
|
+
const descriptors = getRequiredFieldDescriptors(productType, { includeValidation });
|
|
572
670
|
if (needsBusinessGuardrails(snapshot)) {
|
|
573
671
|
descriptors.push(...BUSINESS_GUARDRAIL_FIELD_DESCRIPTORS);
|
|
574
672
|
}
|
|
@@ -596,6 +694,7 @@ export function analyzePrdSnapshot(snapshot) {
|
|
|
596
694
|
|
|
597
695
|
return {
|
|
598
696
|
productType,
|
|
697
|
+
includeValidation,
|
|
599
698
|
totalRequiredFields,
|
|
600
699
|
completedRequiredFields,
|
|
601
700
|
missingRequiredFields: missingFields.length,
|
|
@@ -517,13 +517,38 @@ function exceptionItems(report) {
|
|
|
517
517
|
}));
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
const EVIDENCE_SOURCE_LABELS = {
|
|
521
|
+
'openprd-tasks': '任务清单',
|
|
522
|
+
'project-scan': '项目扫描',
|
|
523
|
+
'openprd-knowledge': '项目经验库',
|
|
524
|
+
'openprd-knowledge-candidate': '待确认经验草案',
|
|
525
|
+
'openprd-growth-ledger': '成长记录',
|
|
526
|
+
'openprd-test-report': '测试报告',
|
|
527
|
+
'openprd-visual-review': '视觉对比记录',
|
|
528
|
+
evidence: '证据文件',
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
const EVIDENCE_PATH_LABELS = {
|
|
532
|
+
'no-active-change': '当前没有进行中的需求改动',
|
|
533
|
+
'no-cost-risk-detected': '本次没有发现成本相关风险',
|
|
534
|
+
'business-guardrails-evidence': '成本与滥用护栏证据',
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
function evidenceSourceLabel(source) {
|
|
538
|
+
return EVIDENCE_SOURCE_LABELS[source] ?? source;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function evidencePathLabel(path) {
|
|
542
|
+
return EVIDENCE_PATH_LABELS[path] ?? path;
|
|
543
|
+
}
|
|
544
|
+
|
|
520
545
|
function evidenceItems(report) {
|
|
521
546
|
return evidenceRows(report)
|
|
522
547
|
.filter((row) => !row.empty)
|
|
523
548
|
.slice(0, 5)
|
|
524
549
|
.map((row) => ({
|
|
525
550
|
summary: gateDisplay(row.gate),
|
|
526
|
-
detail: `${row.source},${row.path}`,
|
|
551
|
+
detail: `${evidenceSourceLabel(row.source)},${evidencePathLabel(row.path)}`,
|
|
527
552
|
}));
|
|
528
553
|
}
|
|
529
554
|
|
|
@@ -573,8 +598,8 @@ function environmentItems(report) {
|
|
|
573
598
|
{
|
|
574
599
|
summary: '成长账本',
|
|
575
600
|
detail: Number(growth.summary?.eventCount ?? 0) > 0
|
|
576
|
-
? `已记录 ${growth.summary.eventCount}
|
|
577
|
-
: '
|
|
601
|
+
? `已记录 ${growth.summary.eventCount} 条成长事件,其中收尾检查记录 ${growth.summary.completionCheckpoints ?? 0} 条`
|
|
602
|
+
: '当前还没有成长记录;收尾前至少应留下一条收尾检查记录或经验草案',
|
|
578
603
|
},
|
|
579
604
|
];
|
|
580
605
|
}
|
|
@@ -692,8 +717,8 @@ function tableRowsForEvidence(report) {
|
|
|
692
717
|
return evidenceRows(report).map((row) => `
|
|
693
718
|
<tr>
|
|
694
719
|
<td>${escapeHtml(gateDisplay(row.gate))}</td>
|
|
695
|
-
<td>${escapeHtml(row.source)}</td>
|
|
696
|
-
<td><code>${escapeHtml(row.path)}</code></td>
|
|
720
|
+
<td>${escapeHtml(evidenceSourceLabel(row.source))}</td>
|
|
721
|
+
<td><code>${escapeHtml(evidencePathLabel(row.path))}</code></td>
|
|
697
722
|
<td>${row.gate.required ? '本期必测' : '按风险确认'}</td>
|
|
698
723
|
</tr>
|
|
699
724
|
`).join('\n');
|
package/src/quality.js
CHANGED
|
@@ -115,6 +115,13 @@ const EVIDENCE_TOKENS = {
|
|
|
115
115
|
growth: ['growth ledger', 'completion checkpoint', 'openprd grow', 'workflow-gotcha', 'code-extension', '自我成长', '账本', '候选'],
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
+
const DIAGNOSTIC_SURFACE_LABELS = {
|
|
119
|
+
'runtime-events': '运行事件记录',
|
|
120
|
+
timeline: '问题时间线',
|
|
121
|
+
'root-cause-candidates': '根因排查线索',
|
|
122
|
+
'diagnostic-report': '诊断报告',
|
|
123
|
+
};
|
|
124
|
+
|
|
118
125
|
function qualityPath(projectRoot, relativePath) {
|
|
119
126
|
return cjoin(projectRoot, relativePath);
|
|
120
127
|
}
|
|
@@ -606,18 +613,21 @@ function buildEvidenceLedger({ evidenceFiles, activeTasks, observability, busine
|
|
|
606
613
|
};
|
|
607
614
|
}
|
|
608
615
|
if (observability.status === 'pass') {
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
616
|
+
const toolCount = observability.centralizedTools.length;
|
|
617
|
+
const surfaceLabels = (observability.diagnosticSurfaces ?? [])
|
|
618
|
+
.map((surface) => DIAGNOSTIC_SURFACE_LABELS[surface] ?? surface);
|
|
619
|
+
const signalSummary = [
|
|
620
|
+
toolCount > 0 ? `${toolCount} 类日志或追踪工具` : '',
|
|
621
|
+
surfaceLabels.length > 0 ? `${surfaceLabels.length} 类诊断记录` : '',
|
|
622
|
+
].filter(Boolean).join('和');
|
|
613
623
|
ledger.traceability = {
|
|
614
624
|
...ledger.traceability,
|
|
615
625
|
present: true,
|
|
616
626
|
sources: [
|
|
617
627
|
...ledger.traceability.sources,
|
|
618
|
-
{ path: '
|
|
628
|
+
{ path: '项目内的日志与追踪配置', source: signalSummary ? `检测到${signalSummary}` : '日志追踪检查' },
|
|
619
629
|
].slice(0, 12),
|
|
620
|
-
summary:
|
|
630
|
+
summary: `出问题时可以追查:检测到 ${observability.correlationFields.length} 个追踪线索${surfaceLabels.length > 0 ? `,并留有${surfaceLabels.join('、')}` : ''}`,
|
|
621
631
|
};
|
|
622
632
|
}
|
|
623
633
|
if (!businessGuardrails.riskDetected || businessGuardrails.status === 'pass') {
|
|
@@ -641,8 +651,8 @@ function buildEvidenceLedger({ evidenceFiles, activeTasks, observability, busine
|
|
|
641
651
|
...knowledge.candidates.slice(0, 3).map((candidate) => ({ path: candidate, source: 'openprd-knowledge-candidate' })),
|
|
642
652
|
].slice(0, 12),
|
|
643
653
|
summary: knowledge.candidates.length > 0
|
|
644
|
-
?
|
|
645
|
-
:
|
|
654
|
+
? `已沉淀 ${knowledge.skills.length} 条项目经验,近期被实际复用 ${knowledge.adoption?.totals?.referenced ?? 0} 次,另有 ${knowledge.candidates.length} 条经验草案等确认`
|
|
655
|
+
: `已沉淀 ${knowledge.skills.length} 条项目经验,近期被实际复用 ${knowledge.adoption?.totals?.referenced ?? 0} 次`,
|
|
646
656
|
};
|
|
647
657
|
} else if (knowledge.candidates.length > 0) {
|
|
648
658
|
ledger.knowledge = {
|
|
@@ -652,7 +662,7 @@ function buildEvidenceLedger({ evidenceFiles, activeTasks, observability, busine
|
|
|
652
662
|
...ledger.knowledge.sources,
|
|
653
663
|
...knowledge.candidates.slice(0, 6).map((candidate) => ({ path: candidate, source: 'openprd-knowledge-candidate' })),
|
|
654
664
|
].slice(0, 12),
|
|
655
|
-
summary: `已有 ${knowledge.candidates.length}
|
|
665
|
+
summary: `已有 ${knowledge.candidates.length} 条经验草案等确认,确认后会成为可复用的项目经验`,
|
|
656
666
|
};
|
|
657
667
|
}
|
|
658
668
|
if (growth?.summary) {
|
|
@@ -666,7 +676,7 @@ function buildEvidenceLedger({ evidenceFiles, activeTasks, observability, busine
|
|
|
666
676
|
...ledger.growth.sources,
|
|
667
677
|
{ path: growth.ledgerPath ?? OPENPRD_GROWTH_LEDGER, source: 'openprd-growth-ledger' },
|
|
668
678
|
].slice(0, 12),
|
|
669
|
-
summary:
|
|
679
|
+
summary: `成长记录已有 ${growth.summary.eventCount ?? 0} 条,其中收尾检查记录 ${completionCheckpoints} 条`,
|
|
670
680
|
};
|
|
671
681
|
}
|
|
672
682
|
}
|
package/src/workspace-core.js
CHANGED
|
@@ -1238,11 +1238,26 @@ const USER_CLARIFICATION_PATHS = new Set([
|
|
|
1238
1238
|
'users.primaryUsers',
|
|
1239
1239
|
'validation.community',
|
|
1240
1240
|
'validation.seedUsers',
|
|
1241
|
+
'validation.communityFit',
|
|
1241
1242
|
'validation.currentAlternative',
|
|
1243
|
+
'validation.painEvidence',
|
|
1242
1244
|
'validation.manualPath',
|
|
1245
|
+
'validation.manualPlaybook',
|
|
1243
1246
|
'validation.commitmentSignals',
|
|
1244
1247
|
'validation.firstValidationStep',
|
|
1245
1248
|
'validation.defaultAlivePlan',
|
|
1249
|
+
'validation.paymentProof',
|
|
1250
|
+
'validation.mvpSlice',
|
|
1251
|
+
'validation.weekendTest',
|
|
1252
|
+
'validation.smallestExecution',
|
|
1253
|
+
'validation.productizeGate',
|
|
1254
|
+
'validation.firstCustomerPath',
|
|
1255
|
+
'validation.pricingHypothesis',
|
|
1256
|
+
'validation.customerOneProfitability',
|
|
1257
|
+
'validation.growthDiscipline',
|
|
1258
|
+
'validation.reversibility',
|
|
1259
|
+
'validation.customerTruth',
|
|
1260
|
+
'validation.valuesFit',
|
|
1246
1261
|
'goals.goals',
|
|
1247
1262
|
'goals.successMetrics',
|
|
1248
1263
|
'scope.inScope',
|
|
@@ -1285,11 +1300,26 @@ const FIELD_PATH_TO_STATE_KEY = {
|
|
|
1285
1300
|
'users.stakeholders': 'stakeholders',
|
|
1286
1301
|
'validation.community': 'community',
|
|
1287
1302
|
'validation.seedUsers': 'seedUsers',
|
|
1303
|
+
'validation.communityFit': 'communityFit',
|
|
1288
1304
|
'validation.currentAlternative': 'currentAlternative',
|
|
1305
|
+
'validation.painEvidence': 'painEvidence',
|
|
1289
1306
|
'validation.manualPath': 'manualPath',
|
|
1307
|
+
'validation.manualPlaybook': 'manualPlaybook',
|
|
1290
1308
|
'validation.commitmentSignals': 'commitmentSignals',
|
|
1291
1309
|
'validation.firstValidationStep': 'firstValidationStep',
|
|
1292
1310
|
'validation.defaultAlivePlan': 'defaultAlivePlan',
|
|
1311
|
+
'validation.paymentProof': 'paymentProof',
|
|
1312
|
+
'validation.mvpSlice': 'mvpSlice',
|
|
1313
|
+
'validation.weekendTest': 'weekendTest',
|
|
1314
|
+
'validation.smallestExecution': 'smallestExecution',
|
|
1315
|
+
'validation.productizeGate': 'productizeGate',
|
|
1316
|
+
'validation.firstCustomerPath': 'firstCustomerPath',
|
|
1317
|
+
'validation.pricingHypothesis': 'pricingHypothesis',
|
|
1318
|
+
'validation.customerOneProfitability': 'customerOneProfitability',
|
|
1319
|
+
'validation.growthDiscipline': 'growthDiscipline',
|
|
1320
|
+
'validation.reversibility': 'reversibility',
|
|
1321
|
+
'validation.customerTruth': 'customerTruth',
|
|
1322
|
+
'validation.valuesFit': 'valuesFit',
|
|
1293
1323
|
'goals.goals': 'goals',
|
|
1294
1324
|
'goals.successMetrics': 'successMetrics',
|
|
1295
1325
|
'goals.acceptanceGoals': 'acceptanceGoals',
|
|
@@ -1728,9 +1758,17 @@ function coerceCapturedValue(pathString, rawValue, append = false) {
|
|
|
1728
1758
|
'users.stakeholders',
|
|
1729
1759
|
'validation.community',
|
|
1730
1760
|
'validation.seedUsers',
|
|
1761
|
+
'validation.communityFit',
|
|
1762
|
+
'validation.painEvidence',
|
|
1731
1763
|
'validation.manualPath',
|
|
1764
|
+
'validation.manualPlaybook',
|
|
1732
1765
|
'validation.commitmentSignals',
|
|
1733
1766
|
'validation.defaultAlivePlan',
|
|
1767
|
+
'validation.paymentProof',
|
|
1768
|
+
'validation.smallestExecution',
|
|
1769
|
+
'validation.productizeGate',
|
|
1770
|
+
'validation.firstCustomerPath',
|
|
1771
|
+
'validation.growthDiscipline',
|
|
1734
1772
|
'goals.goals',
|
|
1735
1773
|
'goals.successMetrics',
|
|
1736
1774
|
'goals.acceptanceGoals',
|