- code-inventory.ts:全量符号索引,注入实现类维度,AI 可见100%文件清单 - code-signals.ts:代码信号检测器(TODO密度/空壳率/硬编码返回/死导入),修复TODO检测顺序bug - ai-log-audit.ts:AI日志确定性审计(占位率/git一致率/覆盖广度),占位>50%→≤30%、git一致<30%→≤20%封顶 - standard-utils.ts:isQualitativeDesignDim 定性设计维度豁免C档 - review.service.ts:注入三个模块+定向追踪模板+日志封顶+分支提醒+Map-Reduce功能发现轮 - 预算 15000→40000;新增 review-authenticity.test.ts(14用例) - 实测:净码特攻b3 81分(118功能全量识别),六边形50~62分(Mock被识别)
106 lines
4.7 KiB
TypeScript
106 lines
4.7 KiB
TypeScript
export const REVIEW_CONSTANTS = {
|
|
MAX_CONCURRENT: 3,
|
|
MAX_OVERVIEW_CHARS: 30000,
|
|
MAX_FILE_CHARS_NORMAL: 40000,
|
|
MAX_FILE_CHARS_BUILD: 40000,
|
|
DUP_CAP_SCORE: 3,
|
|
NO_README_CAP: 2,
|
|
NO_ROOT_README_CAP: 3,
|
|
BUILD_FAIL_CAP_RATIO: 0.33,
|
|
TEST_FAIL_CAP_RATIO: 0.5,
|
|
EFFECT_DATA_BUILD_FAIL_RATIO: 0.3,
|
|
DUP_RATIO_CAP_TRIGGER: 0.5,
|
|
L2_PASS_RATIO: 0.6,
|
|
L3_RATIO: 0.8,
|
|
DEFAULT_LATE_PENALTY: 5,
|
|
MAX_LATE_DAYS: 7,
|
|
CAL_ANOMALY_STDDEV: 2.0,
|
|
CAL_L2_LIMIT: 4,
|
|
CAL_L1_LIMIT: 2,
|
|
CAL_UNSTABLE_WEIGHT: 0.8,
|
|
} as const;
|
|
|
|
export const BUILD_RELATED_KEYWORDS = [
|
|
'实现完整度与稳定性',
|
|
'实现完整度',
|
|
'稳定性与易用性',
|
|
'功能完整性',
|
|
] as const;
|
|
|
|
export function isBuildRelatedDim(name: string): boolean {
|
|
if (name.includes('功能完整性')) return true;
|
|
return BUILD_RELATED_KEYWORDS.some(k => name.includes(k)) || (name.includes('稳定') && name.length >= 4);
|
|
}
|
|
|
|
// A/B 两阶段拆分(2026-08-16):B 部分=构建后评的维度,当前只按赛道一实现(赛道二/L2考核全归 A)
|
|
export const B_STAGE_DIMENSION_KEYWORDS = [
|
|
'实现完整度',
|
|
'效果与数据',
|
|
] as const;
|
|
|
|
export function isBStageDim(name: string): boolean {
|
|
return B_STAGE_DIMENSION_KEYWORDS.some(k => name.includes(k));
|
|
}
|
|
|
|
export const UNSTABLE_DIM_KEYWORDS = [
|
|
'Agent核心能力',
|
|
'核心能力',
|
|
'规模与功能点',
|
|
'效果与数据',
|
|
'效果评估与数据',
|
|
] as const;
|
|
|
|
export function isUnstableDim(name: string): boolean {
|
|
return UNSTABLE_DIM_KEYWORDS.some(k => name.includes(k));
|
|
}
|
|
|
|
export const EVIDENCE_DIM_KEYWORDS = [
|
|
'Agent核心能力',
|
|
'核心能力',
|
|
'效果与数据',
|
|
'效果评估与数据',
|
|
'规模与功能点',
|
|
'功能点',
|
|
] as const;
|
|
|
|
/**
|
|
* 需要"文件+行号"证据的维度:标准要求评分必须引用具体代码位置。
|
|
* 这些维度允许在评语中输出简短的文件路径:行号 引用(其他维度仍禁止贴代码)。
|
|
*/
|
|
export function isEvidenceDim(name: string): boolean {
|
|
return EVIDENCE_DIM_KEYWORDS.some(k => name.includes(k));
|
|
}
|
|
|
|
const isWinBuild = process.platform === 'win32';
|
|
|
|
export const BUILD_SYSTEMS: { file: string; check: string; install: string; build: string; test?: string }[] = [
|
|
{ file: 'package.json', check: 'npm --version', install: 'npm install', build: 'npm run build', test: 'npm test' },
|
|
{ file: 'pom.xml', check: 'mvn --version', install: 'mvn dependency:resolve -q', build: 'mvn compile -q', test: 'mvn test -q' },
|
|
{ file: 'build.gradle', check: 'gradle --version', install: 'gradle dependencies -q', build: 'gradle build -x test', test: 'gradle test' },
|
|
{ file: 'makefile', check: isWinBuild ? 'sh --version' : 'make --version', install: '', build: isWinBuild ? 'sh -c "make"' : 'make', test: isWinBuild ? 'sh -c "make test"' : 'make test' },
|
|
{ file: 'cargo.toml', check: 'cargo --version', install: '', build: 'cargo build', test: 'cargo test' },
|
|
{ file: 'go.mod', check: 'go version', install: '', build: 'go build ./...', test: 'go test ./...' },
|
|
{ file: 'pyproject.toml', check: 'python --version', install: 'pip install -e .', build: 'python -m build --wheel --no-isolation', test: 'python -m pytest' },
|
|
] as const;
|
|
|
|
export const FILE_PRIORITY_RULES: { test: (name: string, rel: string) => boolean; toFront?: boolean }[] = [
|
|
{ test: (n) => n === 'readme.md', toFront: true },
|
|
{ test: (n, rel) => rel.startsWith('docs') },
|
|
{ test: (n) => ['agents.md', 'claude.md'].includes(n), toFront: true },
|
|
{ test: (n) => n.includes('agent') || n.includes('ai-log') || n.includes('ai_usage') || n.includes('usage_log') || n.includes('claude') || n.includes('日志') || n.includes('開発記録') },
|
|
{ test: (n) => n.includes('design') || n.includes('architect') || n.includes('仕様') || n.includes('设计') || n.includes('架构') || n.includes('模块') || n.includes('数据流') },
|
|
{ test: (n) => n.includes('test') || n.startsWith('test') || n.includes('spec') || n.includes('report') },
|
|
{ test: (n, rel) =>
|
|
['package.json', 'pom.xml', 'build.gradle', 'makefile', 'dockerfile', 'go.mod', 'cargo.toml', 'gemfile', 'requirements.txt', 'pyproject.toml', 'setup.py', 'cmakelists.txt'].includes(n) ||
|
|
['.github/workflows', '.gitlab-ci.yml'].some(x => rel.includes(x)) },
|
|
{ test: (n) => ['.eslintrc', '.eslintrc.json', '.eslintrc.js', '.prettierrc', 'ruff.toml', '.pylintrc', 'tsconfig.json', '.editorconfig'].includes(n) },
|
|
{ test: (n) => n.startsWith('.speckit') || n === '.cursorrules' || n.includes('rule') },
|
|
];
|
|
|
|
export const CODE_FILE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.py', '.java', '.go', '.rs', '.rb', '.php', '.cs', '.swift', '.kt'];
|
|
|
|
export const BUILD_ROOT_FILES = [
|
|
'package.json', 'pom.xml', 'build.gradle', 'makefile', 'cargo.toml', 'go.mod',
|
|
'requirements.txt', 'setup.py', 'pyproject.toml', 'gemfile', 'cmakelists.txt',
|
|
];
|