pdd-skills 3.0.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/README.md +1478 -0
- package/bin/pdd.js +354 -0
- package/config/bpmn-rules.yaml +166 -0
- package/config/checkstyle.xml +105 -0
- package/config/eslint.config.js +48 -0
- package/config/pmd.xml +91 -0
- package/config/prd-rules.yaml +113 -0
- package/config/ruff.toml +45 -0
- package/config/sqlfluff.cfg +82 -0
- package/hooks/hook-executor.js +332 -0
- package/index.js +43 -0
- package/lib/api-routes.js +750 -0
- package/lib/api-server.js +408 -0
- package/lib/cache/cache-config.js +209 -0
- package/lib/cache/system-cache.js +852 -0
- package/lib/config-manager.js +373 -0
- package/lib/generate.js +528 -0
- package/lib/grpc/grpc-routes.js +1134 -0
- package/lib/grpc/grpc-server.js +912 -0
- package/lib/grpc/proto-definitions.js +1033 -0
- package/lib/init.js +172 -0
- package/lib/iteration/auto-fixer.js +1025 -0
- package/lib/iteration/auto-reviewer.js +923 -0
- package/lib/iteration/controller.js +577 -0
- package/lib/list.js +130 -0
- package/lib/mcp-server.js +548 -0
- package/lib/openclaw/api-integration.js +535 -0
- package/lib/openclaw/cli-integration.js +567 -0
- package/lib/openclaw/data-sync.js +845 -0
- package/lib/openclaw/openclaw-adapter.js +783 -0
- package/lib/plugin/example-plugins/code-stats/index.js +332 -0
- package/lib/plugin/example-plugins/code-stats/plugin.json +1 -0
- package/lib/plugin/example-plugins/custom-linter/index.js +472 -0
- package/lib/plugin/example-plugins/custom-linter/plugin.json +1 -0
- package/lib/plugin/example-plugins/hello-world/index.js +86 -0
- package/lib/plugin/example-plugins/hello-world/plugin.json +1 -0
- package/lib/plugin/plugin-manager.js +655 -0
- package/lib/plugin/plugin-sdk.js +565 -0
- package/lib/plugin/sandbox.js +627 -0
- package/lib/quality/rules/maintainability.js +418 -0
- package/lib/quality/rules/performance.js +498 -0
- package/lib/quality/rules/readability.js +441 -0
- package/lib/quality/rules/robustness.js +504 -0
- package/lib/quality/rules/security.js +444 -0
- package/lib/quality/scorer.js +576 -0
- package/lib/report.js +669 -0
- package/lib/sdk-base.js +301 -0
- package/lib/sdk-js.js +446 -0
- package/lib/sdk-python/README.md +546 -0
- package/lib/sdk-python/examples/basic_usage.py +450 -0
- package/lib/sdk-python/pdd_sdk/__init__.py +180 -0
- package/lib/sdk-python/pdd_sdk/client.py +1170 -0
- package/lib/sdk-python/pdd_sdk/events.py +423 -0
- package/lib/sdk-python/pdd_sdk/exceptions.py +158 -0
- package/lib/sdk-python/pdd_sdk/models.py +518 -0
- package/lib/sdk-python/pdd_sdk/utils.py +759 -0
- package/lib/token/budget-alert.js +367 -0
- package/lib/token/budget-manager.js +485 -0
- package/lib/update.js +54 -0
- package/lib/utils/logger.js +88 -0
- package/lib/verify.js +741 -0
- package/lib/version.js +52 -0
- package/lib/vm/README.md +102 -0
- package/lib/vm/dashboard/api-routes.js +669 -0
- package/lib/vm/dashboard/server.js +391 -0
- package/lib/vm/dashboard/sse.js +358 -0
- package/lib/vm/dashboard/static/css/dashboard.css +1378 -0
- package/lib/vm/dashboard/static/index.html +118 -0
- package/lib/vm/dashboard/static/js/app.js +949 -0
- package/lib/vm/dashboard/static/js/charts.js +913 -0
- package/lib/vm/dashboard/static/js/kanban-view.js +1053 -0
- package/lib/vm/dashboard/static/js/pipeline-view.js +463 -0
- package/lib/vm/dashboard/static/js/quality-view.js +598 -0
- package/lib/vm/dashboard/static/js/system-view.js +1021 -0
- package/lib/vm/data-provider.js +1191 -0
- package/lib/vm/event-bus.js +402 -0
- package/lib/vm/hooks/extract-hook.js +307 -0
- package/lib/vm/hooks/generate-hook.js +374 -0
- package/lib/vm/hooks/hook-interface.js +458 -0
- package/lib/vm/hooks/report-hook.js +331 -0
- package/lib/vm/hooks/verify-hook.js +454 -0
- package/lib/vm/models.js +1003 -0
- package/lib/vm/reconciler.js +855 -0
- package/lib/vm/scanner.js +988 -0
- package/lib/vm/state-schema.js +955 -0
- package/lib/vm/state-store.js +733 -0
- package/lib/vm/tui/components/card.js +339 -0
- package/lib/vm/tui/components/progress-bar.js +368 -0
- package/lib/vm/tui/components/sparkline.js +327 -0
- package/lib/vm/tui/components/status-light.js +294 -0
- package/lib/vm/tui/components/table.js +370 -0
- package/lib/vm/tui/input.js +335 -0
- package/lib/vm/tui/renderer.js +548 -0
- package/lib/vm/tui/screens/kanban-screen.js +397 -0
- package/lib/vm/tui/screens/overview-screen.js +357 -0
- package/lib/vm/tui/screens/quality-screen.js +336 -0
- package/lib/vm/tui/screens/system-screen.js +379 -0
- package/lib/vm/tui/tui.js +805 -0
- package/package.json +1 -0
- package/scripts/cso-analyzer.js +198 -0
- package/scripts/eval-runner.js +359 -0
- package/scripts/i18n-checker.js +109 -0
- package/scripts/linter/activiti-linter.js +272 -0
- package/scripts/linter/prd-linter.js +162 -0
- package/scripts/linter/report-generator.js +207 -0
- package/scripts/linter/run-linters.js +285 -0
- package/scripts/linter/sql-linter.js +166 -0
- package/scripts/token-analyzer.js +162 -0
- package/scripts/vm-test.js +180 -0
- package/skills/core/official-doc-writer/LICENSE +21 -0
- package/skills/core/official-doc-writer/README.md +232 -0
- package/skills/core/official-doc-writer/SKILL.md +475 -0
- package/skills/core/official-doc-writer/_meta.json +1 -0
- package/skills/core/official-doc-writer/document_generator.py +580 -0
- package/skills/core/official-doc-writer/evals/default-evals.json +1 -0
- package/skills/core/official-doc-writer/examples.md +150 -0
- package/skills/core/official-doc-writer/fonts/FONTS_LIST.md +45 -0
- package/skills/core/official-doc-writer/fonts/README.md +141 -0
- package/skills/core/official-doc-writer/fonts/SIMFANG.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMHEI.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMKAI.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMSUN.TTC +0 -0
- package/skills/core/official-doc-writer/fonts//346/226/271/346/255/243/345/260/217/346/240/207/345/256/213GBK.TTF +0 -0
- package/skills/core/official-doc-writer/references/GBT_9704-2012_/345/205/232/346/224/277/346/234/272/345/205/263/345/205/254/346/226/207/346/240/274/345/274/217.md +422 -0
- package/skills/core/official-doc-writer/scripts/__pycache__/generate_official_doc.cpython-313.pyc +0 -0
- package/skills/core/official-doc-writer/scripts/dialog_manager.py +564 -0
- package/skills/core/official-doc-writer/scripts/generate_official_doc.py +252 -0
- package/skills/core/official-doc-writer/scripts/install_fonts.py +390 -0
- package/skills/core/official-doc-writer/scripts/smart_prompts.py +363 -0
- package/skills/core/pdd-ba/SKILL.md +305 -0
- package/skills/core/pdd-ba/_meta.json +1 -0
- package/skills/core/pdd-ba/evals/default-evals.json +1 -0
- package/skills/core/pdd-code-reviewer/SKILL.md +378 -0
- package/skills/core/pdd-code-reviewer/_meta.json +1 -0
- package/skills/core/pdd-code-reviewer/evals/default-evals.json +1 -0
- package/skills/core/pdd-doc-change/SKILL.md +350 -0
- package/skills/core/pdd-doc-change/_meta.json +1 -0
- package/skills/core/pdd-doc-change/evals/default-evals.json +1 -0
- package/skills/core/pdd-doc-gardener/SKILL.md +248 -0
- package/skills/core/pdd-doc-gardener/_meta.json +1 -0
- package/skills/core/pdd-doc-gardener/evals/default-evals.json +1 -0
- package/skills/core/pdd-entropy-reduction/SKILL.md +360 -0
- package/skills/core/pdd-entropy-reduction/_meta.json +1 -0
- package/skills/core/pdd-entropy-reduction/evals/default-evals.json +1 -0
- package/skills/core/pdd-entropy-reduction/references/entropy-report-template.md +287 -0
- package/skills/core/pdd-entropy-reduction/references/golden-principles.md +573 -0
- package/skills/core/pdd-entropy-reduction/scripts/entropy_scan.py +712 -0
- package/skills/core/pdd-extract-features/SKILL.md +320 -0
- package/skills/core/pdd-extract-features/_meta.json +1 -0
- package/skills/core/pdd-extract-features/evals/default-evals.json +1 -0
- package/skills/core/pdd-generate-spec/SKILL.md +418 -0
- package/skills/core/pdd-generate-spec/_meta.json +1 -0
- package/skills/core/pdd-generate-spec/evals/default-evals.json +1 -0
- package/skills/core/pdd-implement-feature/SKILL.md +332 -0
- package/skills/core/pdd-implement-feature/_meta.json +1 -0
- package/skills/core/pdd-implement-feature/evals/default-evals.json +1 -0
- package/skills/core/pdd-main/SKILL.md +540 -0
- package/skills/core/pdd-main/_meta.json +1 -0
- package/skills/core/pdd-main/evals/default-evals.json +1 -0
- package/skills/core/pdd-main/evals/evals.json +215 -0
- package/skills/core/pdd-verify-feature/SKILL.md +474 -0
- package/skills/core/pdd-verify-feature/_meta.json +1 -0
- package/skills/core/pdd-verify-feature/evals/default-evals.json +1 -0
- package/skills/core/pdd-vm/evals/default-evals.json +1 -0
- package/skills/core/traffic-accident-assessor/LICENSE +29 -0
- package/skills/core/traffic-accident-assessor/SKILL.md +439 -0
- package/skills/core/traffic-accident-assessor/evals/evals.json +1 -0
- package/skills/core/traffic-accident-assessor/references/accident-types.md +369 -0
- package/skills/core/traffic-accident-assessor/references/liability-rules.md +287 -0
- package/skills/core/traffic-accident-assessor/references/traffic-laws.md +226 -0
- package/skills/core/traffic-accident-assessor/references//351/253/230/345/260/224/345/244/253/350/257/264/346/230/216/344/271/246.pdf +32576 -106
- package/skills/core/traffic-accident-assessor/scripts/generate_official_statement.py +588 -0
- package/skills/core/traffic-accident-assessor/scripts/generate_report.py +495 -0
- package/skills/core/traffic-accident-assessor/scripts/generate_statement.py +528 -0
- package/skills/core/traffic-accident-assessor.zip +0 -0
- package/skills/entropy/expert-arch-enforcer/SKILL.md +292 -0
- package/skills/entropy/expert-arch-enforcer/_meta.json +1 -0
- package/skills/entropy/expert-arch-enforcer/evals/default-evals.json +1 -0
- package/skills/entropy/expert-auto-refactor/SKILL.md +327 -0
- package/skills/entropy/expert-auto-refactor/_meta.json +1 -0
- package/skills/entropy/expert-auto-refactor/evals/default-evals.json +1 -0
- package/skills/entropy/expert-code-quality/SKILL.md +468 -0
- package/skills/entropy/expert-code-quality/_meta.json +1 -0
- package/skills/entropy/expert-code-quality/evals/default-evals.json +1 -0
- package/skills/entropy/expert-code-quality/evals/evals.json +109 -0
- package/skills/entropy/expert-code-quality/references/code-smells.md +605 -0
- package/skills/entropy/expert-code-quality/references/design-patterns.md +1111 -0
- package/skills/entropy/expert-code-quality/references/refactoring-catalog.md +1281 -0
- package/skills/entropy/expert-code-quality/references/solid-principles.md +524 -0
- package/skills/entropy/expert-entropy-auditor/SKILL.md +276 -0
- package/skills/entropy/expert-entropy-auditor/_meta.json +1 -0
- package/skills/entropy/expert-entropy-auditor/evals/default-evals.json +1 -0
- package/skills/expert/expert-activiti/SKILL.md +497 -0
- package/skills/expert/expert-activiti/_meta.json +1 -0
- package/skills/expert/expert-mysql/SKILL.md +832 -0
- package/skills/expert/expert-mysql/_meta.json +1 -0
- package/skills/expert/expert-performance/SKILL.md +379 -0
- package/skills/expert/expert-performance/_meta.json +1 -0
- package/skills/expert/expert-performance/evals/default-evals.json +1 -0
- package/skills/expert/expert-ruoyi/SKILL.md +472 -0
- package/skills/expert/expert-ruoyi/_meta.json +1 -0
- package/skills/expert/expert-security/SKILL.md +1341 -0
- package/skills/expert/expert-security/_meta.json +1 -0
- package/skills/expert/expert-security/evals/default-evals.json +1 -0
- package/skills/expert/software-architect/SKILL.md +350 -0
- package/skills/expert/software-architect/_meta.json +1 -0
- package/skills/expert/software-engineer/SKILL.md +437 -0
- package/skills/expert/software-engineer/_meta.json +1 -0
- package/skills/expert/software-engineer/architecture.md +130 -0
- package/skills/expert/software-engineer/patterns.md +151 -0
- package/skills/expert/software-engineer/testing.md +135 -0
- package/skills/expert/system-architect/SKILL.md +628 -0
- package/skills/expert/system-architect/_meta.json +1 -0
- package/skills/expert/system-architect/assets/templates/ARCHITECTURE.md +25 -0
- package/skills/expert/system-architect/assets/templates/README.md +44 -0
- package/skills/expert/system-architect/references/js-ts-standards.md +18 -0
- package/skills/expert/system-architect/references/python-standards.md +19 -0
- package/skills/expert/system-architect/references/scaffolding.md +61 -0
- package/skills/expert/system-architect/references/security-checklist.md +21 -0
- package/skills/openspec/openspec-apply-change/SKILL.md +156 -0
- package/skills/openspec/openspec-apply-change/_meta.json +1 -0
- package/skills/openspec/openspec-archive-change/SKILL.md +114 -0
- package/skills/openspec/openspec-archive-change/_meta.json +1 -0
- package/skills/openspec/openspec-bulk-archive-change/SKILL.md +246 -0
- package/skills/openspec/openspec-bulk-archive-change/_meta.json +1 -0
- package/skills/openspec/openspec-continue-change/SKILL.md +118 -0
- package/skills/openspec/openspec-continue-change/_meta.json +1 -0
- package/skills/openspec/openspec-explore/SKILL.md +288 -0
- package/skills/openspec/openspec-explore/_meta.json +1 -0
- package/skills/openspec/openspec-ff-change/SKILL.md +101 -0
- package/skills/openspec/openspec-ff-change/_meta.json +1 -0
- package/skills/openspec/openspec-new-change/SKILL.md +74 -0
- package/skills/openspec/openspec-new-change/_meta.json +1 -0
- package/skills/openspec/openspec-onboard/SKILL.md +554 -0
- package/skills/openspec/openspec-onboard/_meta.json +1 -0
- package/skills/openspec/openspec-sync-specs/SKILL.md +138 -0
- package/skills/openspec/openspec-sync-specs/_meta.json +1 -0
- package/skills/openspec/openspec-verify-change/SKILL.md +168 -0
- package/skills/openspec/openspec-verify-change/_meta.json +1 -0
- package/skills/pr/pdd-multi-review/SKILL.md +534 -0
- package/skills/pr/pdd-multi-review/_meta.json +1 -0
- package/skills/pr/pdd-pr-batch/SKILL.md +303 -0
- package/skills/pr/pdd-pr-batch/_meta.json +1 -0
- package/skills/pr/pdd-pr-create/SKILL.md +344 -0
- package/skills/pr/pdd-pr-create/_meta.json +1 -0
- package/skills/pr/pdd-pr-merge/SKILL.md +286 -0
- package/skills/pr/pdd-pr-merge/_meta.json +1 -0
- package/skills/pr/pdd-pr-review/SKILL.md +217 -0
- package/skills/pr/pdd-pr-review/_meta.json +1 -0
- package/skills/pr/pdd-task-manager/SKILL.md +636 -0
- package/skills/pr/pdd-task-manager/_meta.json +1 -0
- package/skills/pr/pdd-template-engine/SKILL.md +306 -0
- package/skills/pr/pdd-template-engine/_meta.json +1 -0
- package/templates/behavior-shaping/iron-law-template.md +87 -0
- package/templates/behavior-shaping/rationalization-template.md +62 -0
- package/templates/behavior-shaping/red-flags-template.md +70 -0
- package/templates/bilingual-template.md +139 -0
- package/templates/config/default.yaml +47 -0
- package/templates/project/default/README.md +31 -0
- package/templates/project/frontend/README.md +46 -0
- package/templates/project/java/README.md +48 -0
package/bin/pdd.js
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { initProject } from '../lib/init.js';
|
|
6
|
+
import { updateSkills } from '../lib/update.js';
|
|
7
|
+
import { listSkills } from '../lib/list.js';
|
|
8
|
+
import { showVersion } from '../lib/version.js';
|
|
9
|
+
|
|
10
|
+
const program = new Command();
|
|
11
|
+
|
|
12
|
+
program
|
|
13
|
+
.name('pdd')
|
|
14
|
+
.description('PDD-Skills - PRD Driven Development Skills')
|
|
15
|
+
.version(await showVersion());
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.command('init [path]')
|
|
19
|
+
.description('初始化PDD项目目录结构')
|
|
20
|
+
.option('-f, --force', '强制覆盖现有目录')
|
|
21
|
+
.option('-t, --template <name>', '使用指定模板', 'default')
|
|
22
|
+
.option('--no-skills', '不复制技能文件')
|
|
23
|
+
.action(async (path = '.', options) => {
|
|
24
|
+
console.log(chalk.blue('\n🚀 初始化PDD项目...\n'));
|
|
25
|
+
await initProject(path, options);
|
|
26
|
+
console.log(chalk.green('\n✅ PDD项目初始化完成!'));
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
program
|
|
30
|
+
.command('update')
|
|
31
|
+
.description('更新PDD技能到最新版本')
|
|
32
|
+
.option('-v, --version <version>', '指定版本号')
|
|
33
|
+
.option('--check', '仅检查是否有更新')
|
|
34
|
+
.action(async (options) => {
|
|
35
|
+
await updateSkills(options);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
program
|
|
39
|
+
.command('list')
|
|
40
|
+
.description('列出所有可用技能')
|
|
41
|
+
.option('-c, --category <name>', '按分类筛选')
|
|
42
|
+
.option('--json', 'JSON格式输出')
|
|
43
|
+
.action(async (options) => {
|
|
44
|
+
await listSkills(options);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
program
|
|
48
|
+
.command('linter')
|
|
49
|
+
.description('运行代码质量门禁检查')
|
|
50
|
+
.option('-t, --type <type>', 'linter类型: java/js/python/sql/prd/skill/all', 'all')
|
|
51
|
+
.option('-f, --file <path>', '指定文件或目录')
|
|
52
|
+
.option('--incremental', '增量检查模式')
|
|
53
|
+
.option('-o, --output <format>', '输出格式: text/json/html', 'text')
|
|
54
|
+
.action(async (options) => {
|
|
55
|
+
const linterModule = await import('../scripts/linter/run-linters.js');
|
|
56
|
+
await linterModule.default(options);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
program
|
|
60
|
+
.command('generate')
|
|
61
|
+
.description('基于开发规格生成代码')
|
|
62
|
+
.option('-s, --spec <path>', '规格文件路径', 'dev-specs/spec.md')
|
|
63
|
+
.option('-o, --output <dir>', '输出目录', './generated')
|
|
64
|
+
.option('-f, --feature <name>', '指定功能点名称')
|
|
65
|
+
.option('--dry-run', '仅显示将要执行的操作,不实际生成')
|
|
66
|
+
.action(async (options) => {
|
|
67
|
+
const { generateCode } = await import('../lib/generate.js');
|
|
68
|
+
console.log(chalk.blue('\n🔨 基于开发规格生成代码...\n'));
|
|
69
|
+
await generateCode(options);
|
|
70
|
+
console.log(chalk.green('\n✅ 代码生成完成!'));
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
program
|
|
74
|
+
.command('verify')
|
|
75
|
+
.description('验证功能实现是否符合规格和验收标准')
|
|
76
|
+
.option('-s, --spec <path>', '规格文件路径')
|
|
77
|
+
.option('-c, --code <dir>', '代码目录', './src')
|
|
78
|
+
.option('-v, --verbose', '显示详细验证信息')
|
|
79
|
+
.option('--json', '输出JSON格式的验证报告')
|
|
80
|
+
.action(async (options) => {
|
|
81
|
+
const { verifyFeature } = await import('../lib/verify.js');
|
|
82
|
+
console.log(chalk.blue('\n🔍 验证功能实现...\n'));
|
|
83
|
+
await verifyFeature(options);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
program
|
|
87
|
+
.command('report')
|
|
88
|
+
.description('生成分析报告(MD/JSON/HTML)')
|
|
89
|
+
.option('-t, --type <type>', '报告类型: md/json/html', 'md')
|
|
90
|
+
.option('-o, --output <path>', '输出路径', './reports/pdd-report')
|
|
91
|
+
.option('--include-stats', '包含统计信息')
|
|
92
|
+
.option('--include-charts', '包含图表(仅HTML)')
|
|
93
|
+
.action(async (options) => {
|
|
94
|
+
const { generateReport } = await import('../lib/report.js');
|
|
95
|
+
console.log(chalk.blue('\n📊 生成分析报告...\n'));
|
|
96
|
+
await generateReport(options);
|
|
97
|
+
console.log(chalk.green('\n✅ 报告生成完成!'));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
program
|
|
101
|
+
.command('config')
|
|
102
|
+
.description('管理PDD配置')
|
|
103
|
+
.option('-l, --list', '列出当前配置')
|
|
104
|
+
.option('-s, --set <key=value>', '设置配置项')
|
|
105
|
+
.option('-g, --get <key>', '获取指定配置项')
|
|
106
|
+
.option('--reset', '重置为默认配置')
|
|
107
|
+
.action(async (options) => {
|
|
108
|
+
const configManager = await import('../lib/config-manager.js');
|
|
109
|
+
await configManager.default(options);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
program
|
|
113
|
+
.command('cso')
|
|
114
|
+
.description('CSO分析 - 评估技能触发准确率和Token效率')
|
|
115
|
+
.option('-c, --category <name>', '分析指定分类')
|
|
116
|
+
.option('--token-analyze', 'Token效率分析模式')
|
|
117
|
+
.option('--fix', '自动优化description和triggers')
|
|
118
|
+
.action(async (options) => {
|
|
119
|
+
const { analyzeAllSkills, printCSOReport } = await import('../scripts/cso-analyzer.js');
|
|
120
|
+
const results = await analyzeAllSkills(options.category);
|
|
121
|
+
printCSOReport(results);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
program
|
|
125
|
+
.command('eval')
|
|
126
|
+
.description('运行技能评估测试')
|
|
127
|
+
.option('-s, --skill <name>', '测试指定技能')
|
|
128
|
+
.option('-c, --category <name>', '测试指定分类的所有技能')
|
|
129
|
+
.option('--verbose', '显示详细输出')
|
|
130
|
+
.action(async (options) => {
|
|
131
|
+
const { runEvals } = await import('../scripts/eval-runner.js');
|
|
132
|
+
await runEvals(options);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
program
|
|
136
|
+
.command('token')
|
|
137
|
+
.description('Token效率分析')
|
|
138
|
+
.option('-c, --category <name>', '分析指定分类')
|
|
139
|
+
.action(async (options) => {
|
|
140
|
+
const { analyzeTokenEfficiency } = await import('../scripts/token-analyzer.js');
|
|
141
|
+
await analyzeTokenEfficiency(options.category);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
program
|
|
145
|
+
.command('i18n')
|
|
146
|
+
.description('i18n双语化检查 - 验证技能的中英文双语覆盖')
|
|
147
|
+
.option('-c, --category <name>', '检查指定分类', 'core')
|
|
148
|
+
.action(async (options) => {
|
|
149
|
+
const { analyzeAllI18N, printI18NReport } = await import('../scripts/i18n-checker.js');
|
|
150
|
+
const results = await analyzeAllI18N(options.category);
|
|
151
|
+
printI18NReport(results);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
program
|
|
155
|
+
.command('api')
|
|
156
|
+
.description('启动PDD API服务器')
|
|
157
|
+
.option('-p, --port <port>', '监听端口号', '3000')
|
|
158
|
+
.option('-h, --host <host>', '绑定地址', 'localhost')
|
|
159
|
+
.option('--cors', '启用CORS跨域支持')
|
|
160
|
+
.action(async (options) => {
|
|
161
|
+
const { startApiServer } = await import('../lib/api-server.js');
|
|
162
|
+
await startApiServer({
|
|
163
|
+
port: parseInt(options.port, 10),
|
|
164
|
+
host: options.host,
|
|
165
|
+
cors: options.cors
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
program
|
|
170
|
+
.command('openclaw [command]')
|
|
171
|
+
.description('OpenClaw AI Agent 编排平台集成')
|
|
172
|
+
.addCommand(
|
|
173
|
+
new Command()
|
|
174
|
+
.name('start')
|
|
175
|
+
.description('启动 OpenClaw 服务')
|
|
176
|
+
.option('-p, --port <port>', '监听端口号', '8080')
|
|
177
|
+
.option('-t, --token <token>', '认证令牌')
|
|
178
|
+
.option('--daemon', '以守护进程模式运行')
|
|
179
|
+
.action(async (options) => {
|
|
180
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
181
|
+
const cli = createCLI();
|
|
182
|
+
await cli.execute('start', options);
|
|
183
|
+
})
|
|
184
|
+
)
|
|
185
|
+
.addCommand(
|
|
186
|
+
new Command()
|
|
187
|
+
.name('stop')
|
|
188
|
+
.description('停止 OpenClaw 服务')
|
|
189
|
+
.action(async () => {
|
|
190
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
191
|
+
const cli = createCLI();
|
|
192
|
+
await cli.execute('stop');
|
|
193
|
+
})
|
|
194
|
+
)
|
|
195
|
+
.addCommand(
|
|
196
|
+
new Command()
|
|
197
|
+
.name('status')
|
|
198
|
+
.description('查看 OpenClaw 连接状态')
|
|
199
|
+
.action(async () => {
|
|
200
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
201
|
+
const cli = createCLI();
|
|
202
|
+
await cli.execute('status');
|
|
203
|
+
})
|
|
204
|
+
)
|
|
205
|
+
.addCommand(
|
|
206
|
+
new Command()
|
|
207
|
+
.name('list-tools')
|
|
208
|
+
.description('列出已暴露给 OpenClaw 的工具')
|
|
209
|
+
.action(async () => {
|
|
210
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
211
|
+
const cli = createCLI();
|
|
212
|
+
await cli.execute('list-tools');
|
|
213
|
+
})
|
|
214
|
+
)
|
|
215
|
+
.addCommand(
|
|
216
|
+
new Command()
|
|
217
|
+
.name('test')
|
|
218
|
+
.description('测试工具调用')
|
|
219
|
+
.option('-n, --tool-name <name>', '指定要测试的工具名称', 'pdd_list_skills')
|
|
220
|
+
.action(async (options) => {
|
|
221
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
222
|
+
const cli = createCLI();
|
|
223
|
+
await cli.execute('test', options);
|
|
224
|
+
})
|
|
225
|
+
)
|
|
226
|
+
.addCommand(
|
|
227
|
+
new Command()
|
|
228
|
+
.name('logs')
|
|
229
|
+
.description('查看 OpenClaw 通信日志')
|
|
230
|
+
.option('--tail', '持续跟踪输出')
|
|
231
|
+
.option('-l, --limit <number>', '显示条数', '50')
|
|
232
|
+
.action(async (options) => {
|
|
233
|
+
const { createCLI } = await import('../lib/openclaw/cli-integration.js');
|
|
234
|
+
const cli = createCLI();
|
|
235
|
+
await cli.execute('logs', options);
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
// === dashboard 子命令 (VM-D001) ===
|
|
240
|
+
program
|
|
241
|
+
.command('dashboard')
|
|
242
|
+
.description('启动 PDD Web 可视化管理面板')
|
|
243
|
+
.option('-p, --port <port>', '监听端口号', '3001')
|
|
244
|
+
.option('--no-browser', '不自动打开浏览器')
|
|
245
|
+
.option('--no-open', '不自动打开浏览器(别名)')
|
|
246
|
+
.option('-r, --refresh <sec>', '自动刷新间隔(秒)', '30')
|
|
247
|
+
.action(async (options) => {
|
|
248
|
+
const { DashboardServer } = await import('../lib/vm/dashboard/server.js');
|
|
249
|
+
const server = new DashboardServer();
|
|
250
|
+
await server.start(parseInt(options.port, 10), {
|
|
251
|
+
open: !options.noBrowser && !options.noOpen,
|
|
252
|
+
refreshInterval: parseInt(options.refresh, 10) * 1000
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
process.on('SIGINT', async () => {
|
|
256
|
+
console.log(chalk.yellow('\n\n 正在关闭 Dashboard...'));
|
|
257
|
+
await server.stop();
|
|
258
|
+
process.exit(0);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// === tui 子命令 (VM-D002) ===
|
|
263
|
+
program
|
|
264
|
+
.command('tui')
|
|
265
|
+
.description('启动 PDD 终端可视化管理界面')
|
|
266
|
+
.option('-r, --refresh <sec>', '自动刷新间隔(秒)', '5')
|
|
267
|
+
.option('-t, --theme <theme>', '颜色主题', 'auto') // auto/dark/light
|
|
268
|
+
.action(async (options) => {
|
|
269
|
+
const { TUIApp } = await import('../lib/vm/tui/tui.js');
|
|
270
|
+
const app = new TUIApp(process.cwd(), {
|
|
271
|
+
refresh: parseInt(options.refresh, 10),
|
|
272
|
+
theme: options.theme
|
|
273
|
+
});
|
|
274
|
+
await app.start();
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// === vm 子命令组 (VM-D003) ===
|
|
278
|
+
const vmCmd = new Command()
|
|
279
|
+
.name('vm')
|
|
280
|
+
.description('PDD Visual Manager 状态查询命令');
|
|
281
|
+
|
|
282
|
+
vmCmd
|
|
283
|
+
.command('status')
|
|
284
|
+
.description('查看项目状态摘要')
|
|
285
|
+
.option('--json', 'JSON格式输出')
|
|
286
|
+
.action(async (options) => {
|
|
287
|
+
const { PDDDataProvider } = await import('../lib/vm/data-provider.js');
|
|
288
|
+
const provider = new PDDDataProvider(process.cwd());
|
|
289
|
+
await provider.init();
|
|
290
|
+
const summary = provider.getSummary();
|
|
291
|
+
if (options.json) {
|
|
292
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
293
|
+
} else {
|
|
294
|
+
// 终端表格输出
|
|
295
|
+
console.log(chalk.bold('\n📊 PDD 项目状态\n'));
|
|
296
|
+
console.log(` 项目名: ${summary.name}`);
|
|
297
|
+
console.log(` 总功能点: ${summary.totalFeatures}`);
|
|
298
|
+
console.log(` 整体进度: ${summary.overallProgress}%`);
|
|
299
|
+
console.log(` 平均质量分: ${summary.avgQualityScore}`);
|
|
300
|
+
console.log(` Token消耗: ${summary.totalTokens}`);
|
|
301
|
+
console.log(` 平均迭代: ${summary.avgIterations}`);
|
|
302
|
+
console.log(`\n 阶段分布:`);
|
|
303
|
+
Object.entries(summary.stageDistribution || {}).forEach(([stage, count]) => {
|
|
304
|
+
console.log(` ${stage.padEnd(12)} ${count} 个功能点`);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
vmCmd
|
|
310
|
+
.command('features')
|
|
311
|
+
.description('列出所有功能点')
|
|
312
|
+
.option('--stage <stage>', '按阶段筛选')
|
|
313
|
+
.option('--json', 'JSON格式输出')
|
|
314
|
+
.action(async (options) => {
|
|
315
|
+
const { PDDDataProvider } = await import('../lib/vm/data-provider.js');
|
|
316
|
+
const provider = new PDDDataProvider(process.cwd());
|
|
317
|
+
await provider.init();
|
|
318
|
+
let features = options.stage ? provider.getFeaturesByStage(options.stage) : provider.getFeatures();
|
|
319
|
+
if (options.json) {
|
|
320
|
+
console.log(JSON.stringify(features.map(f => f.toJSON()), null, 2));
|
|
321
|
+
} else {
|
|
322
|
+
console.log(chalk.bold(`\n📋 功能点列表 (${features.length}个)\n`));
|
|
323
|
+
features.forEach((f, i) => {
|
|
324
|
+
const stageColor = { prd:'magenta', extracted:'blue', spec:'green', implementing:'yellow', verifying:'red', done:'cyan' }[f.stage] || 'white';
|
|
325
|
+
console.log(` ${String(i+1).padStart(2)}. ${chalk[stageColor](f.name.padEnd(30))} [${f.stage.toUpperCase().padEnd(12)}] ${f.quality?.score ? chalk.bold(f.quality.score+'('+f.quality.grade+')') : '-'} tok:${f.tokens?.used||0}`);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
vmCmd
|
|
331
|
+
.command('export')
|
|
332
|
+
.description('导出项目数据')
|
|
333
|
+
.option('-f, --format <format>', '导出格式: json/md/csv', 'json')
|
|
334
|
+
.option('-o, --output <path>', '输出路径')
|
|
335
|
+
.action(async (options) => {
|
|
336
|
+
const { PDDDataProvider } = await import('../lib/vm/data-provider.js');
|
|
337
|
+
const fs = await import('fs');
|
|
338
|
+
const path_mod = await import('path');
|
|
339
|
+
const provider = new PDDDataProvider(process.cwd());
|
|
340
|
+
await provider.init();
|
|
341
|
+
let content = '';
|
|
342
|
+
const ext = options.format;
|
|
343
|
+
if (ext === 'json') content = provider.exportJSON({ mode: 'full' });
|
|
344
|
+
else if (ext === 'md') content = provider.exportMarkdown();
|
|
345
|
+
else if (ext === 'csv') content = provider.exportCSV();
|
|
346
|
+
else { console.error(chalk.red(`不支持格式: ${ext}`)); return; }
|
|
347
|
+
const outPath = options.output || `pdd-vm-export.${ext}`;
|
|
348
|
+
fs.writeFileSync(outPath, content, 'utf-8');
|
|
349
|
+
console.log(chalk.green(`✅ 已导出到: ${outPath} (${content.length} bytes)`));
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
program.addCommand(vmCmd);
|
|
353
|
+
|
|
354
|
+
program.parse();
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Activiti BPMN Linter 规则配置
|
|
2
|
+
#
|
|
3
|
+
# 用于检查BPMN流程文件的规范性和最佳实践
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
structure:
|
|
7
|
+
enabled: true
|
|
8
|
+
checks:
|
|
9
|
+
- id: bpmn-has-start-event
|
|
10
|
+
name: "流程必须有开始事件"
|
|
11
|
+
severity: error
|
|
12
|
+
message: "BPMN流程缺少开始事件(StartEvent)"
|
|
13
|
+
xpath: "//*[local-name()='process']"
|
|
14
|
+
condition: "count(//*[local-name()='startEvent']) > 0"
|
|
15
|
+
|
|
16
|
+
- id: bpmn-has-end-event
|
|
17
|
+
name: "流程必须有结束事件"
|
|
18
|
+
severity: error
|
|
19
|
+
message: "BPMN流程缺少结束事件(EndEvent)"
|
|
20
|
+
xpath: "//*[local-name()='process']"
|
|
21
|
+
condition: "count(//*[local-name()='endEvent']) > 0"
|
|
22
|
+
|
|
23
|
+
- id: bpmn-single-start-event
|
|
24
|
+
name: "建议只有一个开始事件"
|
|
25
|
+
severity: warn
|
|
26
|
+
message: "建议每个流程只包含一个开始事件"
|
|
27
|
+
max_count: 1
|
|
28
|
+
|
|
29
|
+
- id: bpmn-process-id-required
|
|
30
|
+
name: "流程ID必须存在且有效"
|
|
31
|
+
severity: error
|
|
32
|
+
pattern: "^[a-zA-Z][a-zA-Z0-9_]*$"
|
|
33
|
+
message: "流程ID格式无效,应以字母开头,仅包含字母数字下划线"
|
|
34
|
+
|
|
35
|
+
- id: bpmn-process-name-required
|
|
36
|
+
name: "流程必须有名称"
|
|
37
|
+
severity: error
|
|
38
|
+
message: "BPMN流程缺少name属性"
|
|
39
|
+
|
|
40
|
+
connectivity:
|
|
41
|
+
enabled: true
|
|
42
|
+
checks:
|
|
43
|
+
- id: bpmn-no-orphan-nodes
|
|
44
|
+
name: "无孤立节点"
|
|
45
|
+
severity: error
|
|
46
|
+
message: "检测到未连接的孤立节点,所有节点应有入边或出边"
|
|
47
|
+
|
|
48
|
+
- id: bpmn-no-dangling-flows
|
|
49
|
+
name: "无悬空流"
|
|
50
|
+
severity: warn
|
|
51
|
+
message: "检测到未连接到目标节点的序列流"
|
|
52
|
+
|
|
53
|
+
- id: bpmn-gateway-balance
|
|
54
|
+
name: "网关进出平衡"
|
|
55
|
+
severity: error
|
|
56
|
+
message: "网关的流入和流出数量不匹配(排他/并行网关应平衡)"
|
|
57
|
+
|
|
58
|
+
- id: bpmn-all-paths-to-end
|
|
59
|
+
name: "所有路径通向结束节点"
|
|
60
|
+
severity: error
|
|
61
|
+
message: "存在无法到达结束事件的执行路径"
|
|
62
|
+
|
|
63
|
+
naming:
|
|
64
|
+
enabled: true
|
|
65
|
+
checks:
|
|
66
|
+
- id: bpmn-task-id-convention
|
|
67
|
+
name: "任务ID命名规范"
|
|
68
|
+
severity: info
|
|
69
|
+
pattern: "^task_[a-z][a-z0-9_]*$"
|
|
70
|
+
message: "任务ID建议使用 task_xxx 格式的小写蛇形命名"
|
|
71
|
+
|
|
72
|
+
- id: bpmn-gateway-id-convention
|
|
73
|
+
name: "网关ID命名规范"
|
|
74
|
+
severity: info
|
|
75
|
+
pattern: "^gateway_[a-z][a-z0-9_]*$"
|
|
76
|
+
message: "网关ID建议使用 gateway_xxx 格式"
|
|
77
|
+
|
|
78
|
+
- id: bpmn-sequence-flow-id-convention
|
|
79
|
+
name: "序列流ID命名规范"
|
|
80
|
+
severity: info
|
|
81
|
+
pattern: "^flow_[a-z][a-z0-9_]*$"
|
|
82
|
+
message: "序列流ID建议使用 flow_xxx 格式"
|
|
83
|
+
|
|
84
|
+
- id: bpmn-chinese-name-required
|
|
85
|
+
name: "节点名称使用中文"
|
|
86
|
+
severity: warn
|
|
87
|
+
message: "节点名称建议使用中文以便业务理解"
|
|
88
|
+
|
|
89
|
+
best_practices:
|
|
90
|
+
enabled: true
|
|
91
|
+
checks:
|
|
92
|
+
- id: bpmn-no-deep-nesting
|
|
93
|
+
name: "避免过深嵌套"
|
|
94
|
+
severity: warn
|
|
95
|
+
max_depth: 5
|
|
96
|
+
message: "流程嵌套层级超过5层,建议拆分子流程"
|
|
97
|
+
|
|
98
|
+
- id: bpmn-reasonable-size
|
|
99
|
+
name: "流程规模合理"
|
|
100
|
+
severity: warn
|
|
101
|
+
max_nodes: 50
|
|
102
|
+
message: "流程节点数过多(>50),建议拆分为子流程"
|
|
103
|
+
|
|
104
|
+
- id: bpmn-user-task-has-assignee
|
|
105
|
+
name: "用户任务需指定处理人"
|
|
106
|
+
severity: error
|
|
107
|
+
message: "用户任务(UserTask)必须指定assignee或candidateUsers"
|
|
108
|
+
|
|
109
|
+
- id: bpmn-service-task-has-class
|
|
110
|
+
name: "服务任务需指定实现类"
|
|
111
|
+
severity: error
|
|
112
|
+
message: "服务任务(ServiceTask)必须指定class或expression"
|
|
113
|
+
|
|
114
|
+
- id: bpmn-timer-event-valid
|
|
115
|
+
name: "定时器配置有效性"
|
|
116
|
+
severity: error
|
|
117
|
+
message: "定时器边界事件的配置不完整或格式无效"
|
|
118
|
+
|
|
119
|
+
- id: bpmn-signal-event-defined
|
|
120
|
+
name: "信号事件已定义"
|
|
121
|
+
severity: warn
|
|
122
|
+
message: "引用了未定义的信号(Signal)"
|
|
123
|
+
|
|
124
|
+
- id: bpmn-no-inline-scripts
|
|
125
|
+
name: "避免内联脚本"
|
|
126
|
+
severity: warn
|
|
127
|
+
message: "不建议在流程中使用内联脚本,建议使用ServiceTask委托"
|
|
128
|
+
|
|
129
|
+
- id: bpmn-form-key-configured
|
|
130
|
+
name: "表单Key已配置"
|
|
131
|
+
severity: info
|
|
132
|
+
message: "用户任务建议配置formKey以支持动态表单"
|
|
133
|
+
|
|
134
|
+
security:
|
|
135
|
+
enabled: true
|
|
136
|
+
checks:
|
|
137
|
+
- id: bpmn-no-hardcoded-passwords
|
|
138
|
+
name: "禁止硬编码密码"
|
|
139
|
+
severity: error
|
|
140
|
+
pattern: "(password|passwd|pwd)\s*[:=]\s*['\"][^'\"]+['\"]"
|
|
141
|
+
message: "检测到可能的硬编码密码"
|
|
142
|
+
|
|
143
|
+
- id: bpmn-no-sql-injection-risk
|
|
144
|
+
name: "SQL注入风险检查"
|
|
145
|
+
severity: error
|
|
146
|
+
pattern: "\\$\\{.*(?:SELECT|INSERT|UPDATE|DELETE|DROP)"
|
|
147
|
+
message: "检测到潜在的SQL注入风险,请使用参数化查询"
|
|
148
|
+
|
|
149
|
+
- id: bpmn-permission-check-before-approval
|
|
150
|
+
name: "审批前权限检查"
|
|
151
|
+
severity: warn
|
|
152
|
+
message: "审批节点前建议添加权限校验步骤"
|
|
153
|
+
|
|
154
|
+
documentation:
|
|
155
|
+
enabled: true
|
|
156
|
+
checks:
|
|
157
|
+
- id: bpmn-process-documentation
|
|
158
|
+
name: "流程文档说明"
|
|
159
|
+
severity: info
|
|
160
|
+
message: "建议为流程添加documentation文档说明"
|
|
161
|
+
|
|
162
|
+
- id: bpmn-task-documentation
|
|
163
|
+
name: "关键任务文档说明"
|
|
164
|
+
severity: info
|
|
165
|
+
min_priority_tasks: true
|
|
166
|
+
message: "关键任务建议添加documentation说明用途"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
|
|
3
|
+
<module name="Checker">
|
|
4
|
+
<property name="charset" value="UTF-8"/>
|
|
5
|
+
<property name="fileExtensions" value="java"/>
|
|
6
|
+
<property name="severity" value="warning"/>
|
|
7
|
+
|
|
8
|
+
<module name="TreeWalker">
|
|
9
|
+
<property name="severity" value="warning"/>
|
|
10
|
+
|
|
11
|
+
<module name="JavadocMethod">
|
|
12
|
+
<property name="scope" value="public"/>
|
|
13
|
+
<property name="allowMissingParamTags" value="true"/>
|
|
14
|
+
<property name="allowMissingReturnTag" value="true"/>
|
|
15
|
+
</module>
|
|
16
|
+
|
|
17
|
+
<module name="JavadocType">
|
|
18
|
+
<property name="scope" value="public"/>
|
|
19
|
+
</module>
|
|
20
|
+
|
|
21
|
+
<module name="JavadocStyle">
|
|
22
|
+
<property name="scope" value="public"/>
|
|
23
|
+
<property name="checkEmptyJavadoc" value="true"/>
|
|
24
|
+
</module>
|
|
25
|
+
|
|
26
|
+
<module name="ConstantName"/>
|
|
27
|
+
<module name="LocalFinalVariableName"/>
|
|
28
|
+
<module name="LocalVariableName"/>
|
|
29
|
+
<module name="MemberName"/>
|
|
30
|
+
<module name="MethodName"/>
|
|
31
|
+
<module name="PackageName"/>
|
|
32
|
+
<module name="ParameterName"/>
|
|
33
|
+
<module name="StaticVariableName"/>
|
|
34
|
+
<module name="TypeName"/>
|
|
35
|
+
|
|
36
|
+
<module name="AvoidStarImport"/>
|
|
37
|
+
<module name="IllegalImport"/>
|
|
38
|
+
<module name="RedundantImport"/>
|
|
39
|
+
<module name="UnusedImports">
|
|
40
|
+
<property name="processJavadoc" value="true"/>
|
|
41
|
+
</module>
|
|
42
|
+
|
|
43
|
+
<module name="LineLength">
|
|
44
|
+
<property name="max" value="120"/>
|
|
45
|
+
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
|
46
|
+
</module>
|
|
47
|
+
|
|
48
|
+
<module name="MethodLength">
|
|
49
|
+
<property name="max" value="80"/>
|
|
50
|
+
</module>
|
|
51
|
+
|
|
52
|
+
<module name="FileLength">
|
|
53
|
+
<property name="max" value="800"/>
|
|
54
|
+
</module>
|
|
55
|
+
|
|
56
|
+
<module name="ParameterNumber">
|
|
57
|
+
<property name="max" value="7"/>
|
|
58
|
+
</module>
|
|
59
|
+
|
|
60
|
+
<module name="EmptyBlock">
|
|
61
|
+
<property name="option" value="TEXT"/>
|
|
62
|
+
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
|
63
|
+
</module>
|
|
64
|
+
|
|
65
|
+
<module name="NeedBraces">
|
|
66
|
+
<property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
|
|
67
|
+
</module>
|
|
68
|
+
|
|
69
|
+
<module name="EmptyCatchBlock">
|
|
70
|
+
<property name="exceptionVariableName" value="expected|ignore"/>
|
|
71
|
+
</module>
|
|
72
|
+
|
|
73
|
+
<module name="AvoidNestedBlocks">
|
|
74
|
+
<property name="allowInSwitchCase" value="true"/>
|
|
75
|
+
</module>
|
|
76
|
+
|
|
77
|
+
<module name="UpperEll"/>
|
|
78
|
+
<module name="ArrayTrailingComma"/>
|
|
79
|
+
<module name="DefaultComesLast"/>
|
|
80
|
+
|
|
81
|
+
<module name="SimplifyBooleanReturn"/>
|
|
82
|
+
<module name="StringLiteralEquality"/>
|
|
83
|
+
<module name="NestedIfDepth">
|
|
84
|
+
<property name="max" value="4"/>
|
|
85
|
+
</module>
|
|
86
|
+
<module name="MethodCount">
|
|
87
|
+
<property name="max" value="30"/>
|
|
88
|
+
<property name="maxPrivate" value="25"/>
|
|
89
|
+
</module>
|
|
90
|
+
</module>
|
|
91
|
+
|
|
92
|
+
<module name="FileTabCharacter">
|
|
93
|
+
<property name="eachLine" value="true"/>
|
|
94
|
+
</module>
|
|
95
|
+
|
|
96
|
+
<module name="NewlineAtEndOfFile">
|
|
97
|
+
<property name="lineSeparator" value="lf"/>
|
|
98
|
+
</module>
|
|
99
|
+
|
|
100
|
+
<module name="RegexpSingleline">
|
|
101
|
+
<property name="format" value="\s+$"/>
|
|
102
|
+
<property name="minimum" value="0"/>
|
|
103
|
+
<property name="message" value="行尾有多余空格"/>
|
|
104
|
+
</module>
|
|
105
|
+
</module>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
ignores: ['**/node_modules/**', '**/dist/**', '**/.pdd/**', '**/coverage/**'],
|
|
4
|
+
files: ['**/*.{js,mjs,cjs,jsx,vue,ts,tsx}']
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
{
|
|
8
|
+
rules: {
|
|
9
|
+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
10
|
+
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
11
|
+
'no-debugger': 'error',
|
|
12
|
+
'no-duplicate-imports': 'error',
|
|
13
|
+
'no-var': 'error',
|
|
14
|
+
'prefer-const': 'warn',
|
|
15
|
+
'eqeqeq': ['warn', 'always'],
|
|
16
|
+
'curly': ['warn', 'multi-line'],
|
|
17
|
+
|
|
18
|
+
'complexity': ['warn', { max: 15 }],
|
|
19
|
+
'max-lines-per-function': ['warn', { max: 80, skipBlankLines: true, skipComments: true }],
|
|
20
|
+
'max-depth': ['warn', { max: 4 }],
|
|
21
|
+
'max-params': ['warn', { max: 5 }],
|
|
22
|
+
'max-lines': ['warn', { max: 300, skipBlankLines: true, skipComments: true }],
|
|
23
|
+
|
|
24
|
+
'padding-line-between-statements': [
|
|
25
|
+
'warn',
|
|
26
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
27
|
+
{ blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
|
|
28
|
+
{ blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] }
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
{
|
|
34
|
+
files: ['**/*.vue'],
|
|
35
|
+
rules: {
|
|
36
|
+
'vue/multi-word-component-names': 'off',
|
|
37
|
+
'vue/no-unused-components': 'warn'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
files: ['**/*.test.{js,ts}', '**/*.spec.{js,ts}'],
|
|
43
|
+
rules: {
|
|
44
|
+
'no-unused-vars': 'off',
|
|
45
|
+
'max-lines-per-function': 'off'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|