282 lines
11 KiB
Markdown
282 lines
11 KiB
Markdown
# PR-37 Domain Intelligence & Delivery Planning
|
||
|
||
> **Version:** 1.0 | **Date:** 2026-06-05 | **Status:** ✅ Complete
|
||
>
|
||
> 增强 SF-02 的行业知识能力和交付规划能力,使之从通用需求工厂升级为行业级需求工厂。
|
||
|
||
---
|
||
|
||
## Architecture Overview
|
||
|
||
```
|
||
PR-37
|
||
┌─────────────────────────────────┐
|
||
│ │
|
||
│ ┌─ Domain Intelligence ──────┐ │
|
||
SF-01 ──┤ │ A. Domain Registry │ │
|
||
│ │ │ B. Domain Classifier │ │
|
||
SF-02 ──┤ │ C. Industry Epic Gen │ │
|
||
│ │ │ D. Industry Feature Gen │ │
|
||
│ │ │ E. Domain Validator │ │
|
||
│ │ └────────────────────────────┘ │
|
||
│ │ │
|
||
└─────┤ ┌─ Delivery Planning ────────┐ │
|
||
│ │ F. Sprint Planner │ │
|
||
│ │ G. Release Planner │ │
|
||
│ │ H. Batch Planner │ │──► SF-03
|
||
│ │ I. Capacity Planner │ │
|
||
│ │ J. Roadmap Aligner │ │
|
||
│ └────────────────────────────┘ │
|
||
│ │
|
||
│ K. Factory Integration │
|
||
│ (PR-35/PR-36/SF-01/SF-02) │
|
||
└─────────────────────────────────┘
|
||
```
|
||
|
||
## Module Map
|
||
|
||
| Part | Module | File | Lines |
|
||
|------|--------|------|-------|
|
||
| A | Domain Registry | `domain-registry.mjs` | 1,278 |
|
||
| B | Domain Classifier | `domain-classifier.mjs` | 456 |
|
||
| C | Industry Epic Generator | `industry-epic-generator.mjs` | 265 |
|
||
| D | Industry Feature Generator | `industry-feature-generator.mjs` | 263 |
|
||
| E | Domain Validator | `domain-validator.mjs` | 290 |
|
||
| F | Sprint Planner | `sprint-planner.mjs` | 472 |
|
||
| G | Release Planner | `release-planner.mjs` | 385 |
|
||
| H | Batch Planner | `batch-planner.mjs` | 284 |
|
||
| I | Capacity Planner | `capacity-planner.mjs` | 276 |
|
||
| J | Roadmap Aligner | `roadmap-aligner.mjs` | 384 |
|
||
| — | Index (Domain Int.) | `index.mjs` | 179 |
|
||
| — | Index (Delivery) | `index.mjs` | 178 |
|
||
| **Total** | | **12 files** | **4,710** |
|
||
|
||
## Domain Registry (Part A)
|
||
|
||
16 个行业领域,每个行业 10 个知识维度:
|
||
|
||
| Domain | 中文名 | Epics | Features | Category |
|
||
|--------|--------|-------|----------|----------|
|
||
| ERP | 企业资源计划 | 10 | 67 | enterprise-software |
|
||
| MES | 制造执行系统 | 10 | 67 | industrial |
|
||
| CRM | 客户关系管理 | 9 | 63 | enterprise-software |
|
||
| WMS | 仓库管理系统 | 7 | 49 | enterprise-software |
|
||
| SCM | 供应链管理 | 7 | 42 | enterprise-software |
|
||
| HRM | 人力资源管理 | 8 | 56 | management |
|
||
| PLM | 产品生命周期管理 | 7 | 42 | engineering |
|
||
| CAD | CAD设计平台 | 8 | 56 | engineering |
|
||
| EDA | 电子设计自动化 | 8 | 56 | engineering |
|
||
| AI Platform | AI平台 | 8 | 56 | intelligence |
|
||
| E-Commerce | 电子商务平台 | 10 | 80 | commerce |
|
||
| SaaS | SaaS平台 | 8 | 56 | platform |
|
||
| Project Management | 项目管理 | 8 | 56 | management |
|
||
| Knowledge Base | 知识管理平台 | 8 | 56 | management |
|
||
| BI | 商业智能平台 | 8 | 56 | intelligence |
|
||
| IoT Platform | 物联网/工业互联网 | 9 | 72 | industrial |
|
||
|
||
### Knowledge Dimensions per Domain
|
||
|
||
每个行业包含:
|
||
1. `name` / `displayName` — 中英文名
|
||
2. `description` — 行业描述
|
||
3. `coreProcesses` — 核心业务流程 (3-8)
|
||
4. `coreEntities` — 核心业务实体 (10-30)
|
||
5. `coreEpics` — 核心Epic模板 (7-10)
|
||
6. `coreFeatures` — 核心Feature模板 (40-80 features)
|
||
7. `coreKPIs` — 核心KPI (5-10)
|
||
8. `coreRoles` — 核心角色 (5-12)
|
||
9. `terminology` — 行业术语表 (5-10)
|
||
10. `constraints` — 行业约束
|
||
11. `regulations` — 行业法规
|
||
|
||
## Domain Classification (Part B)
|
||
|
||
### Algorithm
|
||
|
||
1. 从产品名称和描述中提取关键词
|
||
2. 过滤停用词(系统、平台、管理 等)
|
||
3. 与 16 个领域的 `keywords` / `aliases` 匹配
|
||
4. 对每个领域计算匹配分:关键词 × 3 + 别名 × 5 + 名称直接匹配 × 10
|
||
5. 应用交叉匹配映射(如 "跨境电商" → E-Commerce/SCM)
|
||
6. 返回 primaryDomain(最高分)、secondaryDomain(次高分)、confidenceScore
|
||
|
||
### Examples
|
||
|
||
| Input | Primary | Secondary | Confidence |
|
||
|-------|---------|-----------|------------|
|
||
| AI客服平台 | AI Platform | E-Commerce | 75% |
|
||
| ERP系统 | ERP | — | 48% |
|
||
| 工业MES系统 | MES | — | 75% |
|
||
| 跨境电商平台 | E-Commerce | SCM | 83% |
|
||
| 工业AI质检 | MES | AI Platform | 87% |
|
||
|
||
## Delivery Planning (Parts F-J)
|
||
|
||
### Sprint Planning (Part F)
|
||
|
||
输入 SF-02 的 stories / dependencies / priorities → 输出 Sprint Plan:
|
||
|
||
```
|
||
Sprint 1: Week 1-2, 7 stories, 20 pts, "Sprint 1: 浏览用户注册列表 / ..."
|
||
Sprint 2: Week 3-4, 11 stories, 25 pts, "Sprint 2: ..."
|
||
Sprint 3: Week 5-6, 8 stories, 20 pts, "Sprint 3: ..."
|
||
```
|
||
|
||
- 基于拓扑排序的依赖约束(依赖的先执行)
|
||
- Sprint 容量控制(velocity / maxStoryPointsPerSprint)
|
||
- 自动计算 metrics(totalSprints, avgPointsPerSprint, estimatedDurationWeeks)
|
||
|
||
### Release Planning (Part G)
|
||
|
||
MVP/V1/V2/Enterprise/Global → 5 个 Release:
|
||
|
||
```
|
||
Release 1.0.0 (MVP): 10 stories, 验证门禁 x5
|
||
Release 1.1.0 (MVP Polish): important patches
|
||
Release 2.0.0 (V1): 20 stories
|
||
Release 3.0.0 (V2): 30 stories
|
||
Release 4.0.0 (Global): Global features
|
||
```
|
||
|
||
每个 Release 包含:features, validationGates, releaseGoals, dependencyCheck, releaseDate
|
||
|
||
### Batch Planning (Part H)
|
||
|
||
按依赖层级分组:
|
||
- **DevelopmentBatch L0** — 无依赖,可并行开发
|
||
- **DevelopmentBatch L1** — 依赖 L0,第二批开发
|
||
- **TestingBatch** — 开发完成的批次进入测试
|
||
- **ReleaseBatch** — 测试通过的进入发布
|
||
- **DeliveryBatch** — 客户交付批次
|
||
|
||
### Capacity Planning (Part I)
|
||
|
||
- 复杂度因子(high/medium/low)调整工作量
|
||
- 团队容量计算:teamSize × velocity × sprintCount × availabilityFactor
|
||
- 容量利用率百分比
|
||
- 风险缓冲(riskBufferPercent)
|
||
- 交付预测(乐观/现实/悲观)
|
||
|
||
### Roadmap Alignment (Part J)
|
||
|
||
验证 SF-01 Roadmap 与 PR-37 计划一致性:
|
||
- Phase coverage check
|
||
- Story coverage check
|
||
- Timeline consistency
|
||
- Budget alignment
|
||
- Dependency integrity
|
||
- Alignment Score 0-100
|
||
|
||
## Factory Integration (Part K)
|
||
|
||
### createDomainIntelligenceFactory(strategyPackage, options?)
|
||
|
||
Returns: `{ classification, epics, features, validation, warnings }`
|
||
|
||
Options: `{ domainOverride, includeValidation }`
|
||
|
||
### createDeliveryPlanningFactory(upstreamArtifacts, config?)
|
||
|
||
Accepts SF-02 output as upstreamArtifacts.
|
||
Returns: `{ factoryId, status, sprintPlan, releasePlan, batchPlan, capacityPlan, alignmentReport, warnings, metadata }`
|
||
|
||
Config: `{ sprint: {...}, capacity: {...} }`
|
||
|
||
## Artifacts (Part L)
|
||
|
||
```js
|
||
PR37_ARTIFACTS = {
|
||
SPRINT_PLAN: "sprint-plan",
|
||
RELEASE_PLAN: "release-plan",
|
||
BATCH_PLAN: "batch-plan",
|
||
CAPACITY_PLAN: "capacity-plan",
|
||
ALIGNMENT_REPORT: "alignment-report",
|
||
}
|
||
|
||
SF02_ARTIFACTS (新增,from Domain Intelligence):
|
||
DOMAIN_REGISTRY
|
||
INDUSTRY_EPIC_CATALOG
|
||
INDUSTRY_FEATURE_CATALOG
|
||
DOMAIN_VALIDATION_REPORT
|
||
```
|
||
|
||
## Testing (Part M)
|
||
|
||
57 个测试,12 个 suites,0 个失败:
|
||
|
||
| Suite | Tests | Coverage |
|
||
|-------|-------|----------|
|
||
| Part A — Domain Registry | 9 | 16 domains, 10 dims each |
|
||
| Part B — Domain Classifier | 9 | All test products + edge cases |
|
||
| Part C — Industry Epic Gen | 5 | ERP/MES/AI/fallback |
|
||
| Part D — Industry Feature Gen | 4 | ERP features + type detection |
|
||
| Part E — Domain Validator | 5 | ERP/MES/generic/unknown |
|
||
| Part F — Sprint Planner | 6 | Capacity, deps, edge cases |
|
||
| Part G — Release Planner | 4 | 5 releases, gates, null |
|
||
| Part H — Batch Planner | 2 | Dep levels, batch types |
|
||
| Part I — Capacity Planner | 3 | Effort, forecast, empty |
|
||
| Part J — Roadmap Aligner | 1 | Full alignment |
|
||
| Part K — Factory Integration | 5 | DI + DP factories |
|
||
| Part Z — Regression | 4 | SF-01, SF-02, pipeline, topo |
|
||
| **Total** | **57** | **0 failures** |
|
||
|
||
### Regression Suite
|
||
|
||
- SF-01: 77 tests → all pass
|
||
- SF-02: 89 tests → all pass
|
||
- PR-37: 57 tests → all pass
|
||
- **Total: 223 tests, 0 failures**
|
||
|
||
## Quick Start
|
||
|
||
```js
|
||
import { classifyProduct, createDomainIntelligenceFactory } from './src/pr-37-domain-intelligence/index.mjs';
|
||
import { createDeliveryPlanningFactory } from './src/pr-37-delivery-planning/index.mjs';
|
||
|
||
// 1. Classify product
|
||
const classification = classifyProduct({ productName: 'ERP系统' });
|
||
console.log(classification.primaryDomain); // "ERP"
|
||
|
||
// 2. Generate industry-specific epics and features
|
||
const diFactory = createDomainIntelligenceFactory({ productName: 'ERP系统' });
|
||
console.log(diFactory.epics.length); // 10 (vs 6 generic)
|
||
console.log(diFactory.features.length); // 67 (vs 21 generic)
|
||
console.log(diFactory.validation.overallVerdict); // "pass"
|
||
|
||
// 3. Generate delivery plans from SF-02 output
|
||
const dpFactory = createDeliveryPlanningFactory(sf02Output, {
|
||
sprint: { teamVelocity: 20 },
|
||
capacity: { teamSize: 5 },
|
||
});
|
||
console.log(dpFactory.sprintPlan.sprints.length); // e.g., 6
|
||
console.log(dpFactory.releasePlan.releases.length); // 5
|
||
console.log(dpFactory.alignmentReport.overallVerdict); // "aligned" / "partial"
|
||
```
|
||
|
||
## Files
|
||
|
||
```
|
||
src/pr-37-domain-intelligence/
|
||
├── domain-registry.mjs # Part A: 16 industry domain definitions
|
||
├── domain-classifier.mjs # Part B: product-to-domain classification
|
||
├── industry-epic-generator.mjs # Part C: domain-specific epic generation
|
||
├── industry-feature-generator.mjs # Part D: domain-specific feature generation
|
||
├── domain-validator.mjs # Part E: domain coverage validation
|
||
└── index.mjs # Barrel + createDomainIntelligenceFactory()
|
||
|
||
src/pr-37-delivery-planning/
|
||
├── sprint-planner.mjs # Part F: Sprint plan from stories + deps
|
||
├── release-planner.mjs # Part G: Release plan from MVP scope
|
||
├── batch-planner.mjs # Part H: Dev/Test/Release/Delivery batches
|
||
├── capacity-planner.mjs # Part I: Team capacity + delivery forecast
|
||
├── roadmap-aligner.mjs # Part J: Sprint/Release/Roadmap alignment
|
||
└── index.mjs # Barrel + createDeliveryPlanningFactory()
|
||
|
||
test/
|
||
└── pr-37-domain-intelligence-delivery-planning.test.mjs # 57 tests
|
||
|
||
docs/pr-37/
|
||
├── pr-37-domain-intelligence.md # This doc
|
||
└── pr-37-delivery-planning.md # Delivery planning details
|
||
```
|