@openprd/cli 0.1.0
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/README.md +82 -0
- package/.openprd/benchmarks/evidence/milvus-io-ai-code-review-gets-better-when-models-debate-claude-vs-gemini-vs-code.md +14 -0
- package/.openprd/benchmarks/evidence/nolanlawson-com-using-ai-to-write-better-code-more-slowly.md +14 -0
- package/.openprd/benchmarks/index.md +37 -0
- package/.openprd/benchmarks/sources.yaml +56 -0
- package/.openprd/config.yaml +50 -0
- package/.openprd/discovery/config.json +21 -0
- package/.openprd/engagements/active/flows.md +30 -0
- package/.openprd/engagements/active/handoff.md +9 -0
- package/.openprd/engagements/active/intake.md +15 -0
- package/.openprd/engagements/active/prd.md +161 -0
- package/.openprd/engagements/active/review.html +61 -0
- package/.openprd/engagements/active/roles.md +21 -0
- package/.openprd/engagements/work-units/wu-20260524015648-6d33ded7.json +23 -0
- package/.openprd/exports/.gitkeep +0 -0
- package/.openprd/knowledge/index.json +7 -0
- package/.openprd/quality/config.json +229 -0
- package/.openprd/reviews/v0001.html +1256 -0
- package/.openprd/schema/diagram-architecture.schema.yaml +49 -0
- package/.openprd/schema/diagram-product-flow.schema.yaml +52 -0
- package/.openprd/schema/prd.schema.yaml +121 -0
- package/.openprd/sessions/.gitkeep +0 -0
- package/.openprd/standards/config.json +88 -0
- package/.openprd/standards/file-manual-template.md +28 -0
- package/.openprd/standards/folder-readme-template.md +28 -0
- package/.openprd/state/.gitkeep +0 -0
- package/.openprd/state/changes.json +12 -0
- package/.openprd/state/current.json +169 -0
- package/.openprd/state/version-index.json +15 -0
- package/.openprd/state/versions/.gitkeep +0 -0
- package/.openprd/state/versions/v0001.json +121 -0
- package/.openprd/state/versions/v0001.md +161 -0
- package/.openprd/templates/agent/intake.md +6 -0
- package/.openprd/templates/agent/prd.md +21 -0
- package/.openprd/templates/b2b/intake.md +6 -0
- package/.openprd/templates/b2b/prd.md +24 -0
- package/.openprd/templates/base/intake.md +18 -0
- package/.openprd/templates/base/prd.md +67 -0
- package/.openprd/templates/company/README.md +10 -0
- package/.openprd/templates/consumer/intake.md +6 -0
- package/.openprd/templates/consumer/prd.md +19 -0
- package/.openprd/templates/diagram/architecture.contract.json +53 -0
- package/.openprd/templates/diagram/product-flow.contract.json +76 -0
- package/.openprd/templates/industry/README.md +16 -0
- package/.openprd/templates/manifest.yaml +27 -0
- package/.openprd/templates/project/README.md +14 -0
- package/.openprd/templates/session/README.md +14 -0
- package/AGENTS.md +44 -0
- package/CONTRIBUTING.md +30 -0
- package/LICENSE +21 -0
- package/README.md +727 -0
- package/README_CN.md +583 -0
- package/SECURITY.md +23 -0
- package/bin/openprd.js +5 -0
- package/docs/assets/openprd-capability-overview-en.png +0 -0
- package/docs/assets/openprd-capability-overview-zh.png +0 -0
- package/docs/assets/openprd-learning-html.png +0 -0
- package/docs/assets/openprd-quality-html.png +0 -0
- package/docs/assets/openprd-review-html.png +0 -0
- package/docs/assets/openprd-scenario-overview.png +0 -0
- package/docs/assets/openprd-scenario-overview.svg +114 -0
- package/docs/assets/openprd-self-evolving-mechanisms-en.png +0 -0
- package/docs/assets/openprd-self-evolving-mechanisms-zh.png +0 -0
- package/docs/assets/openprd-visual-compare-case-study-en.png +0 -0
- package/docs/assets/openprd-visual-compare-case-study-zh.png +0 -0
- package/package.json +59 -0
- package/scripts/openprd-dev-check.mjs +5 -0
- package/scripts/openprd-review-presentation.mjs +82 -0
- package/skills/openprd-benchmark-router/SKILL.md +92 -0
- package/skills/openprd-benchmark-router/agents/openai.yaml +4 -0
- package/skills/openprd-benchmark-router/references/benchmark-sources.md +74 -0
- package/skills/openprd-benchmark-router/references/evaluation-lenses.md +66 -0
- package/skills/openprd-benchmark-router/references/source-policy.md +35 -0
- package/skills/openprd-diagram-review/SKILL.md +91 -0
- package/skills/openprd-diagram-review/agents/openai.yaml +4 -0
- package/skills/openprd-diagram-review/examples/architecture-zh.md +8 -0
- package/skills/openprd-diagram-review/examples/product-flow-zh.md +7 -0
- package/skills/openprd-diagram-review/references/cocoon-patterns.md +17 -0
- package/skills/openprd-diagram-review/references/diagram-contracts.md +126 -0
- package/skills/openprd-diagram-review/references/review-checklist.md +10 -0
- package/skills/openprd-discovery-loop/SKILL.md +196 -0
- package/skills/openprd-discovery-loop/agents/openai.yaml +3 -0
- package/skills/openprd-harness/SKILL.md +179 -0
- package/skills/openprd-harness/agents/openai.yaml +4 -0
- package/skills/openprd-harness/examples/full-workflow-zh.md +9 -0
- package/skills/openprd-harness/references/command-map.md +71 -0
- package/skills/openprd-harness/references/examples.md +26 -0
- package/skills/openprd-harness/references/usage-guide.md +335 -0
- package/skills/openprd-harness/references/workflow-gates.md +51 -0
- package/skills/openprd-learning-review/SKILL.md +75 -0
- package/skills/openprd-learning-review/agents/openai.yaml +4 -0
- package/skills/openprd-learning-review/references/content-contract.md +125 -0
- package/skills/openprd-learning-review/references/ebook-reader.md +46 -0
- package/skills/openprd-learning-review/references/evidence-manifest.md +55 -0
- package/skills/openprd-learning-review/references/genre-library.md +43 -0
- package/skills/openprd-learning-review/references/prompt-engineering.md +71 -0
- package/skills/openprd-learning-review/references/quality-rubric.md +28 -0
- package/skills/openprd-learning-review/references/retrieval-worked-example.md +40 -0
- package/skills/openprd-learning-review/references/style-packs/xianxia-cultivation.prompt.md +67 -0
- package/skills/openprd-quality/SKILL.md +101 -0
- package/skills/openprd-requirement-intake/SKILL.md +76 -0
- package/skills/openprd-requirement-intake/agents/openai.yaml +4 -0
- package/skills/openprd-requirement-intake/references/prd-template-lenses.md +105 -0
- package/skills/openprd-requirement-intake/references/routing-rubric.md +64 -0
- package/skills/openprd-router/SKILL.md +40 -0
- package/skills/openprd-shared/SKILL.md +142 -0
- package/skills/openprd-shared/agents/openai.yaml +4 -0
- package/skills/openprd-shared/references/language-and-review.md +50 -0
- package/skills/openprd-shared/references/operating-rules.md +65 -0
- package/skills/openprd-shared/references/skill-architecture.md +70 -0
- package/skills/openprd-standards/SKILL.md +79 -0
- package/skills/openprd-standards/agents/openai.yaml +4 -0
- package/src/agent-integration.js +1717 -0
- package/src/benchmark.js +873 -0
- package/src/cli/args.js +460 -0
- package/src/cli/print.js +1423 -0
- package/src/codex-hook-runner-template.mjs +2422 -0
- package/src/dev-standards.js +372 -0
- package/src/diagram-core.js +1047 -0
- package/src/diagram-workspace.js +262 -0
- package/src/discovery.js +709 -0
- package/src/fleet.js +531 -0
- package/src/fs-utils.js +83 -0
- package/src/growth.js +545 -0
- package/src/html-artifacts.js +3803 -0
- package/src/knowledge.js +668 -0
- package/src/language-policy.js +142 -0
- package/src/learning-review.js +1655 -0
- package/src/loop.js +1290 -0
- package/src/openprd.js +1136 -0
- package/src/openspec/change-lifecycle.js +359 -0
- package/src/openspec/change-validate.js +248 -0
- package/src/openspec/constants.js +12 -0
- package/src/openspec/execute.js +300 -0
- package/src/openspec/generate.js +692 -0
- package/src/openspec/paths.js +111 -0
- package/src/openspec/tasks.js +352 -0
- package/src/prd-core.js +656 -0
- package/src/quality-html-artifact.js +1414 -0
- package/src/quality-learning.js +658 -0
- package/src/quality.js +1262 -0
- package/src/review-presentation.js +240 -0
- package/src/run-harness.js +1470 -0
- package/src/self-update.js +329 -0
- package/src/session-binding.js +140 -0
- package/src/source-inventory.js +224 -0
- package/src/standards.js +914 -0
- package/src/time.js +33 -0
- package/src/visual-compare.js +216 -0
- package/src/work-unit-migration.js +232 -0
- package/src/work-unit.js +88 -0
- package/src/workspace-core.js +1706 -0
- package/src/workspace-registry.js +162 -0
- package/src/workspace-workflow.js +1797 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const OPENPRD_CONTENT_LOCALE = 'zh-CN';
|
|
2
|
+
|
|
3
|
+
export const OPENPRD_LANGUAGE_POLICY =
|
|
4
|
+
'OpenPrd 生成的用户可见内容默认使用简体中文;PRD、OpenPrd、OpenSpec、API、SDK、CLI、TypeScript、JSON、HTTP、WebSocket、字段 key、命令名、产品名和协议名等专有名词按原文保留。';
|
|
5
|
+
|
|
6
|
+
export const TBD_ZH = '待补充';
|
|
7
|
+
|
|
8
|
+
const CJK_RE = /[\u3400-\u9fff]/;
|
|
9
|
+
const STRUCTURAL_OPENPRD_TERMS = [
|
|
10
|
+
'ADDED',
|
|
11
|
+
'MODIFIED',
|
|
12
|
+
'REMOVED',
|
|
13
|
+
'Requirements',
|
|
14
|
+
'Requirement',
|
|
15
|
+
'Scenario',
|
|
16
|
+
'WHEN',
|
|
17
|
+
'THEN',
|
|
18
|
+
'AND',
|
|
19
|
+
'GIVEN',
|
|
20
|
+
];
|
|
21
|
+
const ALLOWED_TECHNICAL_TERMS = [
|
|
22
|
+
'OpenPrd',
|
|
23
|
+
'OpenSpec',
|
|
24
|
+
'PRD',
|
|
25
|
+
'API',
|
|
26
|
+
'SDK',
|
|
27
|
+
'CLI',
|
|
28
|
+
'TypeScript',
|
|
29
|
+
'JavaScript',
|
|
30
|
+
'JSON',
|
|
31
|
+
'YAML',
|
|
32
|
+
'Agent',
|
|
33
|
+
'HTTP',
|
|
34
|
+
'HTTPS',
|
|
35
|
+
'WebSocket',
|
|
36
|
+
'URL',
|
|
37
|
+
'URI',
|
|
38
|
+
'ID',
|
|
39
|
+
'UID',
|
|
40
|
+
'UUID',
|
|
41
|
+
'OSS',
|
|
42
|
+
'NSIS',
|
|
43
|
+
'DMG',
|
|
44
|
+
'RPM',
|
|
45
|
+
'DEB',
|
|
46
|
+
'macOS',
|
|
47
|
+
'Windows',
|
|
48
|
+
'Linux',
|
|
49
|
+
'Node',
|
|
50
|
+
'Node.js',
|
|
51
|
+
'npm',
|
|
52
|
+
'pnpm',
|
|
53
|
+
'Electron',
|
|
54
|
+
'React',
|
|
55
|
+
'Vite',
|
|
56
|
+
'Vitest',
|
|
57
|
+
'Playwright',
|
|
58
|
+
];
|
|
59
|
+
const DISALLOWED_SPEC_MODAL_WORDS = /\b(SHALL|MUST|SHOULD|MAY)\b/;
|
|
60
|
+
|
|
61
|
+
export function scalarZh(value, fallback = TBD_ZH) {
|
|
62
|
+
if (value === null || value === undefined) {
|
|
63
|
+
return fallback;
|
|
64
|
+
}
|
|
65
|
+
const text = String(value).trim();
|
|
66
|
+
return text || fallback;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function hasSimplifiedChinese(value) {
|
|
70
|
+
return CJK_RE.test(String(value ?? ''));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function preferSimplifiedChinese(value, fallback = TBD_ZH) {
|
|
74
|
+
const text = scalarZh(value, '');
|
|
75
|
+
return hasSimplifiedChinese(text) ? text : fallback;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function escapeRegExp(value) {
|
|
79
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function stripAllowedEnglishTerms(text) {
|
|
83
|
+
let next = text;
|
|
84
|
+
for (const term of [...STRUCTURAL_OPENPRD_TERMS, ...ALLOWED_TECHNICAL_TERMS]) {
|
|
85
|
+
next = next.replace(new RegExp(`\\b${escapeRegExp(term)}\\b`, 'g'), ' ');
|
|
86
|
+
}
|
|
87
|
+
return next
|
|
88
|
+
.replace(/\b[A-Z][A-Za-z0-9]*(?:\s*(?:&|and)\s*|\s+)[A-Z][A-Za-z0-9]*(?:(?:\s*(?:&|and)\s*|\s+)[A-Z][A-Za-z0-9]*)*\b/g, ' ')
|
|
89
|
+
.replace(/`[^`]*`/g, ' ')
|
|
90
|
+
.replace(/https?:\/\/\S+/g, ' ')
|
|
91
|
+
.replace(/\b[A-Za-z0-9_.-]+\.(?:md|json|ya?ml|toml|txt|html|js|ts|tsx|jsx|mjs|cjs|yml|exe|dmg|rpm|deb|zip|gz|xz|blockmap)\b/g, ' ')
|
|
92
|
+
.replace(/\b[A-Za-z0-9_.-]*[/-][A-Za-z0-9_.-]+\b/g, ' ')
|
|
93
|
+
.replace(/\b[A-Z][A-Za-z0-9]*[A-Z][A-Za-z0-9]*\b/g, ' ');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function specContentFragment(line) {
|
|
97
|
+
const trimmed = String(line ?? '').trim();
|
|
98
|
+
if (!trimmed || /^```/.test(trimmed)) {
|
|
99
|
+
return '';
|
|
100
|
+
}
|
|
101
|
+
if (/^##\s+(?:(ADDED|MODIFIED|REMOVED)\s+Requirements|(?:新增|修改|移除)需求)\s*$/i.test(trimmed)) {
|
|
102
|
+
return '';
|
|
103
|
+
}
|
|
104
|
+
return trimmed
|
|
105
|
+
.replace(/^#{3,4}\s+(Requirement|Scenario|需求|场景)[::]\s*/i, '')
|
|
106
|
+
.replace(/^-\s+\*\*(WHEN|THEN|AND|GIVEN|当|则|那么|并且|假如)\*\*\s*/i, '')
|
|
107
|
+
.replace(/^[-*]\s+/, '')
|
|
108
|
+
.replace(/[*_#[\]()]/g, ' ')
|
|
109
|
+
.trim();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function findOpenPrdSpecLanguageViolations(text) {
|
|
113
|
+
const violations = [];
|
|
114
|
+
const lines = String(text ?? '').split(/\r?\n/);
|
|
115
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
116
|
+
const fragment = specContentFragment(lines[index]);
|
|
117
|
+
if (!fragment) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (DISALLOWED_SPEC_MODAL_WORDS.test(fragment)) {
|
|
121
|
+
violations.push({ line: index + 1, text: fragment, reason: '包含 SHALL/MUST/SHOULD/MAY 等英文规范词' });
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const stripped = stripAllowedEnglishTerms(fragment);
|
|
125
|
+
const englishWords = stripped.match(/[A-Za-z]{2,}/g) ?? [];
|
|
126
|
+
if (!hasSimplifiedChinese(fragment) && englishWords.length > 0) {
|
|
127
|
+
violations.push({ line: index + 1, text: fragment, reason: '正文缺少简体中文表达' });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (englishWords.length > 1) {
|
|
131
|
+
violations.push({ line: index + 1, text: fragment, reason: '正文包含过多非必要英文' });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return violations;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function languagePolicyLines() {
|
|
138
|
+
return [
|
|
139
|
+
'> 语言规则:除 PRD、OpenPrd、OpenSpec、API、SDK、CLI、TypeScript、JSON、HTTP、WebSocket、字段 key、命令名、产品名和协议名等必要专有名词外,用户可见内容应使用简体中文。',
|
|
140
|
+
'',
|
|
141
|
+
];
|
|
142
|
+
}
|