universal-dev-standards 5.17.0 → 6.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/bin/uds.js +13 -135
- package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +13 -4
- package/bundled/ai/standards/accessibility-standards.ai.yaml +1 -1
- package/bundled/ai/standards/ai-response-navigation.ai.yaml +15 -2
- package/bundled/ai/standards/api-design-standards.ai.yaml +27 -4
- package/bundled/ai/standards/behavior-snapshot.ai.yaml +86 -9
- package/bundled/ai/standards/checkin-standards.ai.yaml +2 -2
- package/bundled/ai/standards/code-review.ai.yaml +2 -2
- package/bundled/ai/standards/context-aware-loading.ai.yaml +3 -3
- package/bundled/ai/standards/data-migration-testing.ai.yaml +79 -3
- package/bundled/ai/standards/deprecation-standards.ai.yaml +10 -2
- package/bundled/ai/standards/developer-memory.ai.yaml +4 -3
- package/bundled/ai/standards/flow-based-testing.ai.yaml +2 -2
- package/bundled/ai/standards/forward-derivation-standards.ai.yaml +26 -2
- package/bundled/ai/standards/full-coverage-testing.ai.yaml +34 -2
- package/bundled/ai/standards/git-worktree.ai.yaml +3 -3
- package/bundled/ai/standards/logging.ai.yaml +97 -3
- package/bundled/ai/standards/mock-boundary.ai.yaml +48 -2
- package/bundled/ai/standards/model-provenance.ai.yaml +297 -0
- package/bundled/ai/standards/model-selection.ai.yaml +11 -2
- package/bundled/ai/standards/observability-standards.ai.yaml +10 -0
- package/bundled/ai/standards/performance-standards.ai.yaml +46 -1
- package/bundled/ai/standards/pii-classification.ai.yaml +15 -1
- package/bundled/ai/standards/pipeline-security-gates.ai.yaml +10 -0
- package/bundled/ai/standards/privacy-standards.ai.yaml +2 -2
- package/bundled/ai/standards/project-context-memory.ai.yaml +2 -2
- package/bundled/ai/standards/refactoring-standards.ai.yaml +68 -3
- package/bundled/ai/standards/resource-cost-boundary.ai.yaml +279 -0
- package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +55 -2
- package/bundled/ai/standards/security-testing.ai.yaml +13 -2
- package/bundled/ai/standards/skill-standard-alignment-check.ai.yaml +37 -2
- package/bundled/ai/standards/user-journey-testing.ai.yaml +107 -0
- package/bundled/ai/standards/verification-oracle.ai.yaml +278 -0
- package/bundled/ai/standards/versioning.ai.yaml +32 -38
- package/bundled/core/acceptance-criteria-traceability.md +15 -5
- package/bundled/core/accessibility-standards.md +8 -4
- package/bundled/core/ai-friendly-architecture.md +1 -1
- package/bundled/core/ai-response-navigation.md +31 -3
- package/bundled/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/core/api-design-standards.md +92 -7
- package/bundled/core/audit-trail.md +119 -0
- package/bundled/core/behavior-snapshot.md +94 -7
- package/bundled/core/browser-compatibility-standards.md +15 -2
- package/bundled/core/checkin-standards.md +9 -2
- package/bundled/core/code-review-checklist.md +10 -2
- package/bundled/core/container-image-standards.md +97 -0
- package/bundled/core/context-aware-loading.md +2 -2
- package/bundled/core/cost-budget-test.md +1 -1
- package/bundled/core/cross-flow-regression.md +3 -2
- package/bundled/core/data-contract.md +104 -0
- package/bundled/core/data-migration-testing.md +90 -0
- package/bundled/core/data-pipeline.md +113 -0
- package/bundled/core/deprecation-standards.md +16 -2
- package/bundled/core/developer-memory.md +13 -8
- package/bundled/core/documentation-writing-standards.md +1 -1
- package/bundled/core/error-code-standards.md +4 -3
- package/bundled/core/flaky-test-management.md +1 -1
- package/bundled/core/flow-based-testing.md +3 -3
- package/bundled/core/forward-derivation-standards.md +33 -5
- package/bundled/core/full-coverage-testing.md +72 -0
- package/bundled/core/git-worktree.md +4 -4
- package/bundled/core/guides/performance-guide.md +1 -1
- package/bundled/core/guides/security-guide.md +1 -1
- package/bundled/core/health-check-standards.md +2 -2
- package/bundled/core/iac-design-principles.md +97 -0
- package/bundled/core/incident-response.md +119 -0
- package/bundled/core/license-compliance.md +2 -0
- package/bundled/core/logging-standards.md +78 -2
- package/bundled/core/mock-boundary.md +54 -2
- package/bundled/core/model-provenance.md +181 -0
- package/bundled/core/model-selection.md +27 -2
- package/bundled/core/packaging-standards.md +1 -0
- package/bundled/core/performance-standards.md +96 -2
- package/bundled/core/pii-classification.md +148 -0
- package/bundled/core/pipeline-security-gates.md +22 -2
- package/bundled/core/postmortem-standards.md +2 -0
- package/bundled/core/prd-standards.md +91 -0
- package/bundled/core/privacy-standards.md +14 -3
- package/bundled/core/product-metrics-standards.md +100 -0
- package/bundled/core/project-context-memory.md +8 -2
- package/bundled/core/prompt-regression.md +1 -1
- package/bundled/core/refactoring-standards.md +44 -3
- package/bundled/core/replay-test.md +1 -1
- package/bundled/core/resource-cost-boundary.md +180 -0
- package/bundled/core/reverse-engineering-standards.md +66 -2
- package/bundled/core/runbook.md +113 -0
- package/bundled/core/schema-evolution.md +105 -0
- package/bundled/core/secret-management-standards.md +110 -0
- package/bundled/core/security-testing.md +26 -2
- package/bundled/core/self-review-protocol.md +2 -2
- package/bundled/core/skill-standard-alignment-check.md +53 -0
- package/bundled/core/slo-sli.md +109 -0
- package/bundled/core/smoke-test.md +1 -1
- package/bundled/core/tech-debt-standards.md +1 -1
- package/bundled/core/test-data-standards.md +2 -2
- package/bundled/core/user-journey-testing.md +102 -0
- package/bundled/core/user-story-mapping.md +96 -0
- package/bundled/core/verification-oracle.md +167 -0
- package/bundled/core/versioning.md +133 -109
- package/bundled/locales/COVERAGE.md +84 -73
- package/bundled/locales/zh-CN/CHANGELOG.md +71 -6
- package/bundled/locales/zh-CN/CLAUDE.md +1 -1
- package/bundled/locales/zh-CN/README.md +22 -9
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +4 -6
- package/bundled/locales/zh-CN/core/accessibility-standards.md +1 -1
- package/bundled/locales/zh-CN/core/adversarial-test.md +226 -0
- package/bundled/locales/zh-CN/core/agent-behavior-discipline.md +187 -0
- package/bundled/locales/zh-CN/core/ai-response-navigation.md +32 -6
- package/bundled/locales/zh-CN/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/locales/zh-CN/core/api-design-standards.md +1 -1
- package/bundled/locales/zh-CN/core/behavior-snapshot.md +335 -0
- package/bundled/locales/zh-CN/core/browser-compatibility-standards.md +229 -0
- package/bundled/locales/zh-CN/core/cd-deployment-strategies.md +135 -0
- package/bundled/locales/zh-CN/core/chaos-injection-tests.md +130 -0
- package/bundled/locales/zh-CN/core/checkin-standards.md +1 -1
- package/bundled/locales/zh-CN/core/code-review-checklist.md +1 -1
- package/bundled/locales/zh-CN/core/container-security.md +535 -0
- package/bundled/locales/zh-CN/core/context-aware-loading.md +1 -1
- package/bundled/locales/zh-CN/core/contract-testing-standards.md +191 -0
- package/bundled/locales/zh-CN/core/cost-budget-test.md +86 -0
- package/bundled/locales/zh-CN/core/cross-flow-regression.md +199 -0
- package/bundled/locales/zh-CN/core/data-migration-testing.md +217 -0
- package/bundled/locales/zh-CN/core/deployment-standards.md +328 -9
- package/bundled/locales/zh-CN/core/deprecation-standards.md +1 -1
- package/bundled/locales/zh-CN/core/developer-memory.md +2 -2
- package/bundled/locales/zh-CN/core/disaster-recovery-drill.md +87 -0
- package/bundled/locales/zh-CN/core/documentation-structure.md +1 -1
- package/bundled/locales/zh-CN/core/documentation-writing-standards.md +1 -1
- package/bundled/locales/zh-CN/core/error-code-standards.md +2 -2
- package/bundled/locales/zh-CN/core/feature-manifest-standard.md +222 -0
- package/bundled/locales/zh-CN/core/flaky-test-management.md +87 -0
- package/bundled/locales/zh-CN/core/flow-based-testing.md +284 -0
- package/bundled/locales/zh-CN/core/forward-derivation-standards.md +3 -4
- package/bundled/locales/zh-CN/core/full-coverage-testing.md +197 -0
- package/bundled/locales/zh-CN/core/git-worktree.md +1 -1
- package/bundled/locales/zh-CN/core/governance-layer.md +160 -0
- package/bundled/locales/zh-CN/core/guides/performance-guide.md +515 -0
- package/bundled/locales/zh-CN/core/guides/security-guide.md +494 -0
- package/bundled/locales/zh-CN/core/knowledge-graph-memory.md +128 -0
- package/bundled/locales/zh-CN/core/license-compliance.md +129 -0
- package/bundled/locales/zh-CN/core/llm-output-validation.md +192 -0
- package/bundled/locales/zh-CN/core/logging-standards.md +130 -8
- package/bundled/locales/zh-CN/core/mock-boundary.md +109 -0
- package/bundled/locales/zh-CN/core/model-selection.md +28 -5
- package/bundled/locales/zh-CN/core/mutation-testing.md +106 -0
- package/bundled/locales/zh-CN/core/no-cicd-deployment.md +219 -0
- package/bundled/locales/zh-CN/core/packaging-standards.md +76 -5
- package/bundled/locales/zh-CN/core/pipeline-security-gates.md +126 -0
- package/bundled/locales/zh-CN/core/policy-as-code-testing.md +203 -0
- package/bundled/locales/zh-CN/core/privacy-standards.md +1 -1
- package/bundled/locales/zh-CN/core/project-context-memory.md +1 -1
- package/bundled/locales/zh-CN/core/prompt-regression.md +88 -0
- package/bundled/locales/zh-CN/core/property-based-testing.md +87 -0
- package/bundled/locales/zh-CN/core/release-quality-manifest.md +207 -0
- package/bundled/locales/zh-CN/core/release-readiness-gate.md +193 -0
- package/bundled/locales/zh-CN/core/replay-test.md +102 -0
- package/bundled/locales/zh-CN/core/reverse-engineering-standards.md +46 -1
- package/bundled/locales/zh-CN/core/rollback-standards.md +120 -0
- package/bundled/locales/zh-CN/core/sast-advanced.md +309 -0
- package/bundled/locales/zh-CN/core/secure-op.md +328 -0
- package/bundled/locales/zh-CN/core/security-testing.md +96 -0
- package/bundled/locales/zh-CN/core/self-review-protocol.md +167 -0
- package/bundled/locales/zh-CN/core/server-ops-security.md +507 -0
- package/bundled/locales/zh-CN/core/smoke-test.md +79 -0
- package/bundled/locales/zh-CN/core/spec-driven-development.md +39 -3
- package/bundled/locales/zh-CN/core/supply-chain-attestation.md +131 -0
- package/bundled/locales/zh-CN/core/versioning.md +1 -1
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +31 -6
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +61 -34
- package/bundled/locales/zh-CN/docs/MIGRATION-v6.md +88 -0
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +2 -2
- package/bundled/locales/zh-CN/docs/USER-MANUAL.md +14 -14
- package/bundled/locales/zh-CN/docs/specs/system/memory-adoption-strategy.md +105 -0
- package/bundled/locales/zh-CN/docs/user/FAQ.md +132 -0
- package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +144 -0
- package/bundled/locales/zh-CN/docs/user/GLOSSARY.md +178 -0
- package/bundled/locales/zh-CN/docs/user/README.md +70 -0
- package/bundled/locales/zh-CN/docs/user/TROUBLESHOOTING.md +190 -0
- package/bundled/locales/zh-CN/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +1 -1
- package/bundled/locales/zh-CN/integrations/github-copilot/README.md +1 -1
- package/bundled/locales/zh-CN/integrations/github-copilot/skills-mapping.md +3 -3
- package/bundled/locales/zh-CN/integrations/opencode/skills-mapping.md +3 -3
- package/bundled/locales/zh-CN/methodologies/guides/sdd-guide.md +836 -0
- package/bundled/locales/zh-CN/options/changelog/auto-generated.md +166 -0
- package/bundled/locales/zh-CN/options/changelog/keep-a-changelog.md +140 -0
- package/bundled/locales/zh-CN/options/code-review/automated-review.md +214 -0
- package/bundled/locales/zh-CN/options/code-review/pair-programming.md +166 -0
- package/bundled/locales/zh-CN/options/code-review/pr-review.md +167 -0
- package/bundled/locales/zh-CN/options/documentation/api-docs.md +191 -0
- package/bundled/locales/zh-CN/options/documentation/markdown-docs.md +150 -0
- package/bundled/locales/zh-CN/options/documentation/wiki-style.md +131 -0
- package/bundled/locales/zh-CN/options/project-structure/kotlin.md +144 -0
- package/bundled/locales/zh-CN/options/project-structure/php.md +168 -0
- package/bundled/locales/zh-CN/options/project-structure/ruby.md +156 -0
- package/bundled/locales/zh-CN/options/project-structure/rust.md +136 -0
- package/bundled/locales/zh-CN/options/project-structure/swift.md +165 -0
- package/bundled/locales/zh-CN/options/testing/contract-testing.md +237 -0
- package/bundled/locales/zh-CN/options/testing/industry-pyramid.md +200 -0
- package/bundled/locales/zh-CN/options/testing/istqb-framework.md +144 -0
- package/bundled/locales/zh-CN/options/testing/performance-testing.md +251 -0
- package/bundled/locales/zh-CN/options/testing/security-testing.md +192 -0
- package/bundled/locales/zh-CN/skills/README.md +89 -126
- package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +5 -7
- package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/agents/code-architect.md +263 -0
- package/bundled/locales/zh-CN/skills/agents/doc-writer.md +410 -0
- package/bundled/locales/zh-CN/skills/agents/reviewer.md +357 -0
- package/bundled/locales/zh-CN/skills/agents/spec-analyst.md +410 -0
- package/bundled/locales/zh-CN/skills/agents/test-specialist.md +368 -0
- package/bundled/locales/zh-CN/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/atdd-workflow.md +3 -4
- package/bundled/locales/zh-CN/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/bdd-assistant/guide.md +1 -2
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +109 -13
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +30 -8
- package/bundled/locales/zh-CN/skills/checkin-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/ci-cd-assistant/SKILL.md +50 -0
- package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +5 -5
- package/bundled/locales/zh-CN/skills/commands/ac-coverage.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/atdd.md +3 -3
- package/bundled/locales/zh-CN/skills/commands/bdd.md +2 -2
- package/bundled/locales/zh-CN/skills/commands/brainstorm.md +26 -17
- package/bundled/locales/zh-CN/skills/commands/{review.md → code-review.md} +4 -4
- package/bundled/locales/zh-CN/skills/commands/derive-all.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive-atdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive-bdd.md +2 -3
- package/bundled/locales/zh-CN/skills/commands/derive-tdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/dev-workflow.md +2 -2
- package/bundled/locales/zh-CN/skills/commands/methodology.md +4 -4
- package/bundled/locales/zh-CN/skills/commands/pr.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/tdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/dev-methodology/create-methodology.md +456 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +6 -6
- package/bundled/locales/zh-CN/skills/dev-methodology/runtime.md +296 -0
- package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +5 -5
- package/bundled/locales/zh-CN/skills/docs-generator/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/e2e-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/logging-guide/SKILL.md +146 -142
- package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/pr-automation-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/project-discovery/guide.md +2 -2
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/security-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +3 -3
- package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +8 -9
- package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/sweep/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/testing-guide/testing-theory.md +2298 -0
- package/bundled/locales/zh-CN/skills/workflows/README.md +451 -0
- package/bundled/locales/zh-TW/CHANGELOG.md +71 -6
- package/bundled/locales/zh-TW/CLAUDE.md +1 -1
- package/bundled/locales/zh-TW/MAINTENANCE.md +25 -2
- package/bundled/locales/zh-TW/README.md +22 -9
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-TW/ai/standards/versioning.ai.yaml +8 -48
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +4 -6
- package/bundled/locales/zh-TW/core/accessibility-standards.md +1 -1
- package/bundled/locales/zh-TW/core/adversarial-test.md +226 -0
- package/bundled/locales/zh-TW/core/agent-behavior-discipline.md +187 -0
- package/bundled/locales/zh-TW/core/ai-response-navigation.md +32 -6
- package/bundled/locales/zh-TW/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/locales/zh-TW/core/api-design-standards.md +91 -9
- package/bundled/locales/zh-TW/core/audit-trail.md +110 -0
- package/bundled/locales/zh-TW/core/behavior-snapshot.md +335 -0
- package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +1 -0
- package/bundled/locales/zh-TW/core/cd-deployment-strategies.md +135 -0
- package/bundled/locales/zh-TW/core/chaos-injection-tests.md +130 -0
- package/bundled/locales/zh-TW/core/checkin-standards.md +1 -1
- package/bundled/locales/zh-TW/core/code-review-checklist.md +1 -1
- package/bundled/locales/zh-TW/core/container-image-standards.md +93 -0
- package/bundled/locales/zh-TW/core/container-security.md +535 -0
- package/bundled/locales/zh-TW/core/cost-budget-test.md +86 -0
- package/bundled/locales/zh-TW/core/cross-flow-regression.md +1 -0
- package/bundled/locales/zh-TW/core/data-contract.md +101 -0
- package/bundled/locales/zh-TW/core/data-migration-testing.md +217 -0
- package/bundled/locales/zh-TW/core/data-pipeline.md +105 -0
- package/bundled/locales/zh-TW/core/deployment-standards.md +363 -25
- package/bundled/locales/zh-TW/core/deprecation-standards.md +17 -4
- package/bundled/locales/zh-TW/core/developer-memory.md +2 -2
- package/bundled/locales/zh-TW/core/disaster-recovery-drill.md +87 -0
- package/bundled/locales/zh-TW/core/documentation-writing-standards.md +1 -1
- package/bundled/locales/zh-TW/core/error-code-standards.md +2 -2
- package/bundled/locales/zh-TW/core/feature-manifest-standard.md +222 -0
- package/bundled/locales/zh-TW/core/flaky-test-management.md +87 -0
- package/bundled/locales/zh-TW/core/flow-based-testing.md +284 -0
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +3 -4
- package/bundled/locales/zh-TW/core/full-coverage-testing.md +250 -0
- package/bundled/locales/zh-TW/core/git-worktree.md +1 -1
- package/bundled/locales/zh-TW/core/guides/performance-guide.md +515 -0
- package/bundled/locales/zh-TW/core/guides/security-guide.md +494 -0
- package/bundled/locales/zh-TW/core/iac-design-principles.md +90 -0
- package/bundled/locales/zh-TW/core/incident-response.md +111 -0
- package/bundled/locales/zh-TW/core/license-compliance.md +129 -0
- package/bundled/locales/zh-TW/core/llm-output-validation.md +192 -0
- package/bundled/locales/zh-TW/core/logging-standards.md +208 -4
- package/bundled/locales/zh-TW/core/mock-boundary.md +161 -0
- package/bundled/locales/zh-TW/core/model-provenance.md +173 -0
- package/bundled/locales/zh-TW/core/model-selection.md +28 -5
- package/bundled/locales/zh-TW/core/mutation-testing.md +106 -0
- package/bundled/locales/zh-TW/core/no-cicd-deployment.md +219 -0
- package/bundled/locales/zh-TW/core/packaging-standards.md +76 -5
- package/bundled/locales/zh-TW/core/performance-standards.md +84 -5
- package/bundled/locales/zh-TW/core/pii-classification.md +102 -0
- package/bundled/locales/zh-TW/core/pipeline-security-gates.md +126 -0
- package/bundled/locales/zh-TW/core/policy-as-code-testing.md +203 -0
- package/bundled/locales/zh-TW/core/prd-standards.md +88 -0
- package/bundled/locales/zh-TW/core/privacy-standards.md +1 -1
- package/bundled/locales/zh-TW/core/product-metrics-standards.md +96 -0
- package/bundled/locales/zh-TW/core/project-context-memory.md +1 -1
- package/bundled/locales/zh-TW/core/prompt-regression.md +88 -0
- package/bundled/locales/zh-TW/core/property-based-testing.md +87 -0
- package/bundled/locales/zh-TW/core/refactoring-standards.md +43 -6
- package/bundled/locales/zh-TW/core/release-quality-manifest.md +207 -0
- package/bundled/locales/zh-TW/core/replay-test.md +102 -0
- package/bundled/locales/zh-TW/core/resource-cost-boundary.md +175 -0
- package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +64 -5
- package/bundled/locales/zh-TW/core/rollback-standards.md +120 -0
- package/bundled/locales/zh-TW/core/runbook.md +110 -0
- package/bundled/locales/zh-TW/core/sast-advanced.md +309 -0
- package/bundled/locales/zh-TW/core/schema-evolution.md +98 -0
- package/bundled/locales/zh-TW/core/secret-management-standards.md +101 -0
- package/bundled/locales/zh-TW/core/secure-op.md +328 -0
- package/bundled/locales/zh-TW/core/security-testing.md +96 -0
- package/bundled/locales/zh-TW/core/self-review-protocol.md +2 -2
- package/bundled/locales/zh-TW/core/server-ops-security.md +507 -0
- package/bundled/locales/zh-TW/core/slo-sli.md +108 -0
- package/bundled/locales/zh-TW/core/smoke-test.md +79 -0
- package/bundled/locales/zh-TW/core/spec-driven-development.md +19 -11
- package/bundled/locales/zh-TW/core/supply-chain-attestation.md +131 -0
- package/bundled/locales/zh-TW/core/user-journey-testing.md +111 -0
- package/bundled/locales/zh-TW/core/user-story-mapping.md +94 -0
- package/bundled/locales/zh-TW/core/verification-oracle.md +159 -0
- package/bundled/locales/zh-TW/core/versioning.md +112 -112
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +31 -6
- package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +6 -6
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +61 -34
- package/bundled/locales/zh-TW/docs/MIGRATION-v6.md +88 -0
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +2 -2
- package/bundled/locales/zh-TW/docs/USER-MANUAL.md +14 -14
- package/bundled/locales/zh-TW/docs/specs/system/memory-adoption-strategy.md +105 -0
- package/bundled/locales/zh-TW/docs/user/FAQ.md +132 -0
- package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +144 -0
- package/bundled/locales/zh-TW/docs/user/GLOSSARY.md +178 -0
- package/bundled/locales/zh-TW/docs/user/README.md +70 -0
- package/bundled/locales/zh-TW/docs/user/TROUBLESHOOTING.md +190 -0
- package/bundled/locales/zh-TW/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +1 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/README.md +1 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/skills-mapping.md +3 -3
- package/bundled/locales/zh-TW/integrations/opencode/skills-mapping.md +3 -3
- package/bundled/locales/zh-TW/methodologies/guides/sdd-guide.md +523 -26
- package/bundled/locales/zh-TW/options/changelog/auto-generated.md +166 -0
- package/bundled/locales/zh-TW/options/changelog/keep-a-changelog.md +140 -0
- package/bundled/locales/zh-TW/options/code-review/automated-review.md +214 -0
- package/bundled/locales/zh-TW/options/code-review/pair-programming.md +166 -0
- package/bundled/locales/zh-TW/options/code-review/pr-review.md +167 -0
- package/bundled/locales/zh-TW/options/documentation/api-docs.md +191 -0
- package/bundled/locales/zh-TW/options/documentation/markdown-docs.md +150 -0
- package/bundled/locales/zh-TW/options/documentation/wiki-style.md +131 -0
- package/bundled/locales/zh-TW/options/project-structure/kotlin.md +144 -0
- package/bundled/locales/zh-TW/options/project-structure/php.md +168 -0
- package/bundled/locales/zh-TW/options/project-structure/ruby.md +156 -0
- package/bundled/locales/zh-TW/options/project-structure/rust.md +136 -0
- package/bundled/locales/zh-TW/options/project-structure/swift.md +165 -0
- package/bundled/locales/zh-TW/options/testing/contract-testing.md +237 -0
- package/bundled/locales/zh-TW/options/testing/industry-pyramid.md +200 -0
- package/bundled/locales/zh-TW/options/testing/istqb-framework.md +144 -0
- package/bundled/locales/zh-TW/options/testing/performance-testing.md +251 -0
- package/bundled/locales/zh-TW/options/testing/security-testing.md +192 -0
- package/bundled/locales/zh-TW/skills/README.md +91 -128
- package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +4 -6
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/agents/code-architect.md +263 -0
- package/bundled/locales/zh-TW/skills/agents/doc-writer.md +410 -0
- package/bundled/locales/zh-TW/skills/agents/reviewer.md +357 -0
- package/bundled/locales/zh-TW/skills/agents/spec-analyst.md +410 -0
- package/bundled/locales/zh-TW/skills/agents/test-specialist.md +368 -0
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/atdd-workflow.md +3 -4
- package/bundled/locales/zh-TW/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/guide.md +1 -2
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +110 -14
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +31 -7
- package/bundled/locales/zh-TW/skills/checkin-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/ci-cd-assistant/SKILL.md +50 -0
- package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +7 -5
- package/bundled/locales/zh-TW/skills/commands/ac-coverage.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/atdd.md +3 -3
- package/bundled/locales/zh-TW/skills/commands/bdd.md +2 -2
- package/bundled/locales/zh-TW/skills/commands/brainstorm.md +26 -17
- package/bundled/locales/zh-TW/skills/commands/{review.md → code-review.md} +5 -5
- package/bundled/locales/zh-TW/skills/commands/derive-all.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive-atdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive-bdd.md +2 -3
- package/bundled/locales/zh-TW/skills/commands/derive-tdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/dev-workflow.md +2 -2
- package/bundled/locales/zh-TW/skills/commands/methodology.md +4 -4
- package/bundled/locales/zh-TW/skills/commands/pr.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/tdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/dev-methodology/create-methodology.md +456 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +5 -5
- package/bundled/locales/zh-TW/skills/dev-methodology/runtime.md +296 -0
- package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +5 -5
- package/bundled/locales/zh-TW/skills/docs-generator/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/e2e-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/logging-guide/SKILL.md +29 -27
- package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/pr-automation-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/project-discovery/guide.md +2 -2
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/security-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +7 -8
- package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/testing-guide/testing-theory.md +2298 -0
- package/bundled/locales/zh-TW/skills/workflows/README.md +451 -0
- package/bundled/skills/README.md +1 -1
- package/bundled/skills/ac-coverage/SKILL.md +17 -7
- package/bundled/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/skills/agents/code-architect.md +1 -1
- package/bundled/skills/agents/doc-writer.md +1 -1
- package/bundled/skills/agents/reviewer.md +2 -2
- package/bundled/skills/agents/spec-analyst.md +1 -1
- package/bundled/skills/agents/test-specialist.md +1 -1
- package/bundled/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/skills/atdd-assistant/SKILL.md +7 -0
- package/bundled/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/skills/atdd-assistant/atdd-workflow.md +6 -8
- package/bundled/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/skills/bdd-assistant/SKILL.md +7 -0
- package/bundled/skills/bdd-assistant/guide.md +1 -2
- package/bundled/skills/brainstorm-assistant/SKILL.md +133 -11
- package/bundled/skills/brainstorm-assistant/guide.md +33 -5
- package/bundled/skills/checkin-assistant/SKILL.md +8 -1
- package/bundled/skills/ci-cd-assistant/SKILL.md +57 -0
- package/bundled/skills/code-review-assistant/SKILL.md +15 -8
- package/bundled/skills/commands/COMMAND-FAMILY-OVERVIEW.md +2 -2
- package/bundled/skills/commands/COMMAND-INDEX.json +3 -3
- package/bundled/skills/commands/README.md +2 -2
- package/bundled/skills/commands/ac-coverage.md +1 -1
- package/bundled/skills/commands/atdd.md +2 -2
- package/bundled/skills/commands/bdd.md +2 -2
- package/bundled/skills/commands/brainstorm.md +25 -14
- package/bundled/skills/commands/{review.md → code-review.md} +6 -6
- package/bundled/skills/commands/derive-all.md +1 -1
- package/bundled/skills/commands/derive-atdd.md +1 -1
- package/bundled/skills/commands/derive-bdd.md +2 -3
- package/bundled/skills/commands/derive-tdd.md +1 -1
- package/bundled/skills/commands/derive.md +1 -1
- package/bundled/skills/commands/dev-workflow.md +1 -1
- package/bundled/skills/commands/journey-test.md +45 -0
- package/bundled/skills/commands/methodology.md +4 -4
- package/bundled/skills/commands/pr.md +1 -1
- package/bundled/skills/commands/skill-builder.md +42 -0
- package/bundled/skills/commands/tdd.md +1 -1
- package/bundled/skills/dev-methodology/create-methodology.md +1 -1
- package/bundled/skills/dev-methodology/guide.md +1 -1
- package/bundled/skills/dev-methodology/runtime.md +1 -1
- package/bundled/skills/dev-workflow-guide/SKILL.md +3 -3
- package/bundled/skills/dev-workflow-guide/workflow-phases.md +3 -3
- package/bundled/skills/docs-generator/SKILL.md +3 -3
- package/bundled/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/skills/logging-guide/SKILL.md +38 -2
- package/bundled/skills/migration-assistant/SKILL.md +226 -0
- package/bundled/skills/observability-assistant/SKILL.md +74 -0
- package/bundled/skills/pr-automation-assistant/SKILL.md +5 -1
- package/bundled/skills/project-discovery/guide.md +2 -2
- package/bundled/skills/push/SKILL.md +1 -1
- package/bundled/skills/release-standards/SKILL.md +19 -5
- package/bundled/skills/security-assistant/SKILL.md +1 -1
- package/bundled/skills/skill-builder/SKILL.md +1 -1
- package/bundled/skills/spec-derivation/guide.md +3 -4
- package/bundled/skills/spec-driven-dev/SKILL.md +2 -2
- package/bundled/skills/sweep/SKILL.md +1 -1
- package/bundled/skills/tdd-assistant/SKILL.md +8 -1
- package/bundled/skills/testing-guide/SKILL.md +1 -1
- package/bundled/skills/testing-guide/testing-theory.md +1 -1
- package/bundled/skills/workflows/README.md +2 -2
- package/package.json +3 -3
- package/src/commands/audit.js +30 -9
- package/src/commands/config.js +33 -2
- package/src/commands/hitl.js +14 -1
- package/src/commands/init.js +110 -58
- package/src/commands/quickstart.js +1 -2
- package/src/commands/release.js +51 -6
- package/src/commands/run-intent.js +9 -0
- package/src/commands/spec-split.js +27 -2
- package/src/commands/update.js +22 -6
- package/src/config/ai-agent-paths.js +3 -1
- package/src/i18n/messages.js +3 -102
- package/src/missions/MissionManager.js +44 -12
- package/src/utils/build-manifest.js +35 -3
- package/src/utils/friction-detector.js +71 -22
- package/src/utils/health-checker.js +29 -2
- package/src/utils/transaction.js +111 -0
- package/src/utils/version-promote.js +16 -0
- package/standards-registry.json +58 -146
- package/bundled/ai/standards/agent-communication-protocol.ai.yaml +0 -42
- package/bundled/ai/standards/agent-dispatch.ai.yaml +0 -42
- package/bundled/ai/standards/branch-completion.ai.yaml +0 -44
- package/bundled/ai/standards/change-batching-standards.ai.yaml +0 -44
- package/bundled/ai/standards/execution-history.ai.yaml +0 -42
- package/bundled/ai/standards/pipeline-integration-standards.ai.yaml +0 -42
- package/bundled/ai/standards/workflow-enforcement.ai.yaml +0 -44
- package/bundled/ai/standards/workflow-state-protocol.ai.yaml +0 -43
- package/src/commands/flow.js +0 -260
- package/src/commands/start.js +0 -372
- package/src/commands/sweep.js +0 -151
- package/src/commands/workflow.js +0 -681
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/license-compliance.md
|
|
3
|
+
source_version: 2.1.0
|
|
4
|
+
translation_version: 2.1.0
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
|
+
source_hash: 8a754039a2b5
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 许可证合规标准
|
|
11
|
+
|
|
12
|
+
> **语言**: [English](../../../core/license-compliance.md) | [繁體中文](../../zh-TW/core/license-compliance.md) | 简体中文
|
|
13
|
+
|
|
14
|
+
> **版本**: 2.1.0 | **状态**: Active | **更新日期**: 2026-05-16
|
|
15
|
+
> **AI 优化版本**: `ai/standards/license-compliance.ai.yaml`
|
|
16
|
+
> **Agent Spec**: ASPEC-001 (cross-project/aspec/ASPEC-001-license-compliance-agent.md)
|
|
17
|
+
|
|
18
|
+
## 概述
|
|
19
|
+
|
|
20
|
+
面向 AI 增强开发的完整许可证合规标准,涵盖通用 OSS 实践(Tier 1)以及针对 AI 生成代码的 AI 专属规则(Tier 2)。
|
|
21
|
+
|
|
22
|
+
## Tier 1 — 通用 OSS 合规实践
|
|
23
|
+
|
|
24
|
+
适用于所有项目,无论是否使用 AI。
|
|
25
|
+
|
|
26
|
+
| ID | 规则 | 级别 |
|
|
27
|
+
|----|------|------|
|
|
28
|
+
| REQ-001 | 许可证分类与允许列表(allowlist) | MUST |
|
|
29
|
+
| REQ-002 | CI 中的自动化许可证扫描 | MUST |
|
|
30
|
+
| REQ-003 | SBOM 生成(CycloneDX 1.5 或 SPDX 2.3) | MUST |
|
|
31
|
+
| REQ-004 | 许可证署名与 NOTICES 文件 | MUST |
|
|
32
|
+
| REQ-005 | 许可证违规整改(5 个工作日) | MUST |
|
|
33
|
+
| REQ-006 | 采用新技术时的许可证评审 | SHOULD |
|
|
34
|
+
|
|
35
|
+
### 许可证分级
|
|
36
|
+
|
|
37
|
+
| 分级 | 许可证 | 动作 |
|
|
38
|
+
|------|--------|------|
|
|
39
|
+
| APPROVED | MIT, Apache 2.0, BSD-2/3-Clause, ISC, CC0 | 自动批准 |
|
|
40
|
+
| REVIEW-REQUIRED | LGPL-2.1/3.0, MPL-2.0, CDDL | 采用前须法务评审 |
|
|
41
|
+
| PROHIBITED | GPL-2.0/3.0, AGPL-3.0, SSPL-1.0, BUSL-1.1 | 立即阻断 PR |
|
|
42
|
+
|
|
43
|
+
## Tier 2 — AI 专属规则
|
|
44
|
+
|
|
45
|
+
对生成代码的 AI Agent(VibeOps Generator Agent 及同等者)具有约束力。
|
|
46
|
+
|
|
47
|
+
| ID | 规则 | 严重度 |
|
|
48
|
+
|----|------|--------|
|
|
49
|
+
| LC-001 | 必须查询 SPDX ID | Blocking |
|
|
50
|
+
| LC-002 | 阻止列表(blocklist)自动阻断 | Blocking |
|
|
51
|
+
| LC-003 | 允许列表(allowlist)自动批准 | Informational |
|
|
52
|
+
| LC-004 | 灰名单(greylist)人工评审 | Review required |
|
|
53
|
+
| LC-005 | SBOM 强制生成 | Blocking |
|
|
54
|
+
| LC-006 | 版权相似度阈值(≥0.85 阻断) | Blocking |
|
|
55
|
+
| LC-007 | PII 模式检测 | Review required |
|
|
56
|
+
| LC-008 | EU AI Act 透明度标记 | Blocking |
|
|
57
|
+
| LC-009 | 客户策略上限 | Informational |
|
|
58
|
+
|
|
59
|
+
## v2.1.0 增强(XSPEC-193 Phase 2)
|
|
60
|
+
|
|
61
|
+
### ClearlyDefined API(LC-001)
|
|
62
|
+
|
|
63
|
+
- 主要许可证查询来源:`https://api.clearlydefined.io/definitions/{type}/{provider}/{namespace}/{name}/{revision}`
|
|
64
|
+
- 知名包的置信度 ≥ 0.95(score.total ≥ 80)
|
|
65
|
+
- 24h TTL LRU 缓存(cap=500)+ 404 negative cache
|
|
66
|
+
- Token bucket:10 req/s,burst 20
|
|
67
|
+
- 重试策略:5xx → exponential backoff × 3(200ms/1s/3s);429 → batch fallback
|
|
68
|
+
- DEC-064 缓存键隔离:`sha256(client_salt + ':' + purl)`
|
|
69
|
+
|
|
70
|
+
### AST PII 分析(LC-007)
|
|
71
|
+
|
|
72
|
+
- Tree-sitter 支持:TypeScript、JavaScript、Python
|
|
73
|
+
- 上下文分类:
|
|
74
|
+
- `hardcoded_value` → 严重度升级为 `critical`
|
|
75
|
+
- `comment` → 严重度降级为 `info`
|
|
76
|
+
- `schema_field` → 加注,严重度不变
|
|
77
|
+
- `// pii:ignore` pragma:抑制同一行的发现
|
|
78
|
+
- 可选字段:`PIIPattern.confidence`、`PIIPattern.ast_context`
|
|
79
|
+
- tree-sitter 不可用时优雅降级(graceful fallback)为 regex
|
|
80
|
+
|
|
81
|
+
### EmbeddingProvider 策略(LC-006)
|
|
82
|
+
|
|
83
|
+
- `provider='onnx-minilm'`:ONNX 本地推理(all-MiniLM-L6-v2)
|
|
84
|
+
- `provider='ollama-bge-m3'`:Ollama 本地 API(localhost:11434)
|
|
85
|
+
- `provider='jaccard'`:Jaccard token 相似度(Phase 1 基线,默认)
|
|
86
|
+
- 内存中的 snippet 索引(`buildSnippetIndex()`)按客户隔离(DEC-064 salt)
|
|
87
|
+
- 外部搜索:通过 `enableExternalSearch=true` opt-in(默认=false)
|
|
88
|
+
|
|
89
|
+
## 原则
|
|
90
|
+
|
|
91
|
+
| ID | 原则 |
|
|
92
|
+
|----|------|
|
|
93
|
+
| P-1 | SPDX 优先 — 所有许可证 ID 必须是 SPDX 标准 |
|
|
94
|
+
| P-2 | 独立评估者 — 与 Generator 使用不同的模型类别 |
|
|
95
|
+
| P-3 | 证据导向决策 — 每个阻断都附带可追溯的证据 |
|
|
96
|
+
| P-4 | 默认透明 — 必须有 EU AI Act Article 50 标记 |
|
|
97
|
+
| P-5 | 客户主权 — 策略可在 EULA §9 限制内定制 |
|
|
98
|
+
|
|
99
|
+
## 工具序列(XSPEC-193 §2)
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
1. dependency_reader
|
|
103
|
+
2. license_lookup ← ClearlyDefined API (v2.1.0)
|
|
104
|
+
3. license_blocklist_check
|
|
105
|
+
4. sbom_generator
|
|
106
|
+
5. pii_pattern_detector ← AST-enhanced (v2.1.0)
|
|
107
|
+
6. copyright_similarity_check ← EmbeddingProvider (v2.1.0)
|
|
108
|
+
7. eu_ai_act_classifier
|
|
109
|
+
8. transparency_marker
|
|
110
|
+
9. block_pr
|
|
111
|
+
10. suggest_alternative
|
|
112
|
+
11. escalate_to_human
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## 相关规格
|
|
116
|
+
|
|
117
|
+
- XSPEC-193 — License Compliance Agent 完整规格
|
|
118
|
+
- XSPEC-066 — Wave 3 Compliance Pack(v1.0.0 基线)
|
|
119
|
+
- DEC-063 — VibeOps 法务与合规策略
|
|
120
|
+
- DEC-064 — 客户 IP 隔离(cache salt)
|
|
121
|
+
- ASPEC-001 — License Compliance Agent SPEC(XSPEC-205 §REQ-2 格式)
|
|
122
|
+
|
|
123
|
+
## 变更记录
|
|
124
|
+
|
|
125
|
+
| 版本 | 日期 | 变更 |
|
|
126
|
+
|------|------|------|
|
|
127
|
+
| v1.0.0 | 2026-04-30 | 初版 — REQ-001~006 通用 OSS 实践 |
|
|
128
|
+
| v2.0.0 | 2026-05-14 | 新增 Tier 2 LC-001~009 AI 专属规则 |
|
|
129
|
+
| v2.1.0 | 2026-05-16 | ClearlyDefined API + AST PII + EmbeddingProvider + ASPEC-001 引用 |
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/llm-output-validation.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
|
+
source_hash: 8b7fc8543760
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# LLM 输出验证标准
|
|
11
|
+
|
|
12
|
+
> **语言**: [English](../../../core/llm-output-validation.md) | [繁體中文](../../zh-TW/core/llm-output-validation.md) | 简体中文
|
|
13
|
+
|
|
14
|
+
> 标准 ID:`llm-output-validation`
|
|
15
|
+
> 版本:v1.0.0
|
|
16
|
+
> 最后更新:2026-05-05
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 为什么需要 LLM 输出验证?
|
|
21
|
+
|
|
22
|
+
LLM 输出具有**不确定性**:同一个 prompt 在不同时间、不同模型版本下可能产生格式不一致的输出。如果不加以验证,这些输出可能在下游管线中造成静默失败(silent failure)——不是报错,而是用了一个错误的默认值或 `undefined`。
|
|
23
|
+
|
|
24
|
+
LLM 输出验证包含三个层次:
|
|
25
|
+
|
|
26
|
+
| 层次 | 问题 | 工具 |
|
|
27
|
+
|------|------|------|
|
|
28
|
+
| 结构验证 | 输出格式是否正确? | JSON Schema、Zod、Pydantic |
|
|
29
|
+
| 语义验证 | 声称的事实是否有依据? | NLI probe、Grounding check |
|
|
30
|
+
| 行为验证 | Agent 是否正确拒绝越界请求? | 红队语料库、拒绝评估 |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 一、Schema Contract Test(结构验证)
|
|
35
|
+
|
|
36
|
+
### 核心概念
|
|
37
|
+
|
|
38
|
+
每个 AI Agent 应声明一份 `output-schema.json`(JSON Schema 格式),并提供对应的 contract test。
|
|
39
|
+
|
|
40
|
+
**Contract test 的目的**:
|
|
41
|
+
- 确认 schema 本身是合法的 JSON Schema
|
|
42
|
+
- 确认 valid fixtures 通过验证
|
|
43
|
+
- 确认 invalid fixtures(缺少必填字段、类型错误、enum 违规)被拒绝
|
|
44
|
+
|
|
45
|
+
### 推荐目录结构
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
agents/<agent-name>/
|
|
49
|
+
output-schema.json ← JSON Schema 定義
|
|
50
|
+
__tests__/
|
|
51
|
+
contract.test.ts ← Contract test suite
|
|
52
|
+
__fixtures__/
|
|
53
|
+
valid.json ← 真實 LLM 輸出 golden fixture
|
|
54
|
+
invalid-missing-id.json ← 缺少必填欄位的 fixture
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### TypeScript 示例(使用 Ajv)
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import Ajv from "ajv"
|
|
61
|
+
import schema from "../output-schema.json"
|
|
62
|
+
import validFixture from "../__fixtures__/valid.json"
|
|
63
|
+
|
|
64
|
+
const ajv = new Ajv({ strict: false })
|
|
65
|
+
const validate = ajv.compile(schema)
|
|
66
|
+
|
|
67
|
+
// 測試 1:Schema 本身是合法的 JSON Schema
|
|
68
|
+
it("schema is valid JSON Schema", () => {
|
|
69
|
+
expect(ajv.validateSchema(schema)).toBe(true)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// 測試 2:Valid fixture 通過驗證
|
|
73
|
+
it("valid fixture passes schema", () => {
|
|
74
|
+
expect(validate(validFixture)).toBe(true)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// 測試 3:空 object 被拒絕
|
|
78
|
+
it("empty object is rejected", () => {
|
|
79
|
+
expect(validate({})).toBe(false)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
// 測試 4:缺少 source_agent 被拒絕
|
|
83
|
+
it("object missing source_agent is rejected", () => {
|
|
84
|
+
const { source_agent, ...without } = validFixture
|
|
85
|
+
expect(validate(without)).toBe(false)
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Python 示例(使用 Pydantic)
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from pydantic import ValidationError
|
|
93
|
+
from your_module import AgentOutput
|
|
94
|
+
|
|
95
|
+
# 測試 valid fixture
|
|
96
|
+
valid_data = { "version": "1.0.0", "source_agent": "planner", ... }
|
|
97
|
+
output = AgentOutput(**valid_data) # 不拋出 exception
|
|
98
|
+
|
|
99
|
+
# 測試 invalid fixture
|
|
100
|
+
try:
|
|
101
|
+
AgentOutput(version="bad-format", source_agent="planner")
|
|
102
|
+
assert False, "Should have raised"
|
|
103
|
+
except ValidationError:
|
|
104
|
+
pass # 預期行為
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 二、幻觉检测(Semantic Validation)
|
|
110
|
+
|
|
111
|
+
### 什么是幻觉?
|
|
112
|
+
|
|
113
|
+
LLM 产生「听起来正确但实际上没有依据」的内容。例如:
|
|
114
|
+
- 虚构的 API 文档 URL
|
|
115
|
+
- 不存在的数据库字段名称
|
|
116
|
+
- 未在 context 中出现的 dependency 版本
|
|
117
|
+
|
|
118
|
+
### 检测策略
|
|
119
|
+
|
|
120
|
+
| 策略 | 适用场景 | 自动化程度 |
|
|
121
|
+
|------|---------|-----------|
|
|
122
|
+
| **Schema 结构化输出** | Agent 输出 JSON,enum 限制可能值 | 高(自动) |
|
|
123
|
+
| **Grounding Check** | RAG 系统,回答需引用 context | 中(需 NLI 模型) |
|
|
124
|
+
| **置信度标记** | Agent 在输出中包含 `confidence` 分数 | 中(需 prompt 设计) |
|
|
125
|
+
| **红队语料库** | 主动测试越界请求的拒绝行为 | 高(自动) |
|
|
126
|
+
|
|
127
|
+
### 幻觉率目标
|
|
128
|
+
|
|
129
|
+
| Agent 类型 | Schema 合规率 | 事实幻觉率 |
|
|
130
|
+
|-----------|-------------|----------|
|
|
131
|
+
| 结构化 JSON Agent | ≥ 99% | ≤ 5% |
|
|
132
|
+
| RAG Agent | ≥ 95% | ≤ 5% |
|
|
133
|
+
| 对话 Agent | ≥ 90% | ≤ 10% |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 三、Prompt 回归测试
|
|
138
|
+
|
|
139
|
+
### 何时需要跑 Prompt 回归测试?
|
|
140
|
+
|
|
141
|
+
- 修改任何 `agents/*/prompt.md`
|
|
142
|
+
- 模型版本升级(相同 prompt,不同 model)
|
|
143
|
+
- Schema 新增 required field
|
|
144
|
+
|
|
145
|
+
### 回归测试流程
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 1. 修改前:用 temperature=0 記錄 golden output
|
|
149
|
+
ai-agent run planner --input fixtures/planner-input.json --temp 0 > golden.json
|
|
150
|
+
|
|
151
|
+
# 2. 修改後:重跑並比對
|
|
152
|
+
ai-agent run planner --input fixtures/planner-input.json --temp 0 > after.json
|
|
153
|
+
|
|
154
|
+
# 3. 用 contract test 驗證 after.json 仍符合 schema
|
|
155
|
+
npx vitest run agents/__tests__/contract.test.ts
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 四、质量门禁(Quality Gates)
|
|
161
|
+
|
|
162
|
+
| 门禁 | 阈值 | 强制程度 |
|
|
163
|
+
|------|------|---------|
|
|
164
|
+
| Schema 合规(CI) | 100% | Block merge |
|
|
165
|
+
| 空 object 拒绝(CI)| 100% | Block merge |
|
|
166
|
+
| Prompt 修改后回归(CI)| schema 合规维持 | Block merge |
|
|
167
|
+
| 幻觉率(pre-release)| ≤ 5% | Advisory |
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## 五、工具推荐
|
|
172
|
+
|
|
173
|
+
| 工具 | 语言 | 用途 |
|
|
174
|
+
|------|------|------|
|
|
175
|
+
| [Ajv](https://ajv.js.org/) | TypeScript/JS | JSON Schema contract test |
|
|
176
|
+
| [Zod](https://zod.dev/) | TypeScript | Runtime type validation |
|
|
177
|
+
| [Pydantic](https://docs.pydantic.dev/) | Python | Schema + type validation |
|
|
178
|
+
| [DeepEval](https://deepeval.com/) | Python | LLM 幻觉率、faithfulness 评分 |
|
|
179
|
+
| [Ragas](https://docs.ragas.io/) | Python | RAG grounded answer rate |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 参考标准
|
|
184
|
+
|
|
185
|
+
- NIST AI RMF (AI 100-1, 2023) — AI 风险管理框架
|
|
186
|
+
- OWASP Top 10 for LLM Applications v1.1 — LLM01: Prompt Injection
|
|
187
|
+
- ISO/IEC 42001:2023 — AI 管理体系
|
|
188
|
+
- [UDS `security-testing.ai.yaml`](../../../core/security-testing.md) — SAST + DAST 集成
|
|
189
|
+
- [UDS `adversarial-test.ai.yaml`](../../../core/adversarial-test.md) — Prompt injection 红队标准
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
**Scope**: universal
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../core/logging-standards.md
|
|
3
|
-
source_version: 1.
|
|
4
|
-
translation_version: 1.
|
|
5
|
-
last_synced: 2026-
|
|
6
|
-
|
|
3
|
+
source_version: 1.3.0
|
|
4
|
+
translation_version: 1.3.0
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
|
+
source_hash: 7853d510d681
|
|
7
|
+
status: stale
|
|
7
8
|
---
|
|
8
9
|
|
|
9
|
-
> **语言**: [English](../../../core/logging-standards.md) |
|
|
10
|
+
> **语言**: [English](../../../core/logging-standards.md) | 简体中文
|
|
10
11
|
|
|
11
12
|
# 日志标准
|
|
12
13
|
|
|
13
|
-
**版本**: 1.
|
|
14
|
-
**最后更新**:
|
|
15
|
-
**适用范围**:
|
|
14
|
+
**版本**: 1.3.0
|
|
15
|
+
**最后更新**: 2026-05-26
|
|
16
|
+
**适用范围**: 所有软件项目
|
|
17
|
+
**范围**: universal
|
|
18
|
+
**行业标准**: RFC 5424, OpenTelemetry, W3C Trace Context
|
|
19
|
+
**参考**: [opentelemetry.io](https://opentelemetry.io/)
|
|
16
20
|
|
|
17
21
|
---
|
|
18
22
|
|
|
@@ -311,6 +315,123 @@ tracestate: vendor=value
|
|
|
311
315
|
- [ ] 永不记录信用卡
|
|
312
316
|
- [ ] 已配置保留策略
|
|
313
317
|
|
|
318
|
+
### 轮转检查清单
|
|
319
|
+
|
|
320
|
+
- [ ] 已设置时间轮转(`rollingInterval: Day` 或同等配置)
|
|
321
|
+
- [ ] 已设置大小轮转,`rollOnFileSizeLimit: true`(或同等配置)
|
|
322
|
+
- [ ] 已显式配置 `fileSizeLimitBytes`(默认上限会造成危害)
|
|
323
|
+
- [ ] `retainedFileCountLimit` ≥ N×7,以覆盖窗口内的轮转文件
|
|
324
|
+
- [ ] 已定义 90% 大小 SOP:调查噪声根因,不要盲目提高上限
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## 日志文件轮转策略
|
|
329
|
+
|
|
330
|
+
### 轮转策略——必须同时设置两者
|
|
331
|
+
|
|
332
|
+
基于文件的日志接收器配置**必须**包含**两个**触发器:
|
|
333
|
+
|
|
334
|
+
1. **基于时间的轮转**(`rollingInterval: Day` 或同等配置)——按时间分区
|
|
335
|
+
2. **基于大小的轮转**,`rollOnFileSizeLimit: true`(或同等配置)——应对流量峰值
|
|
336
|
+
|
|
337
|
+
> **为何必须:** 大多数日志库默认带有静默的大小上限。当文件达到上限时,后续的日志写入会被**静默丢弃**——无任何警告或错误提示。应用程序继续运行,而半天的日志就此消失。同时显式设置两个触发器可避开这个陷阱。
|
|
338
|
+
|
|
339
|
+
### 生产环境中的默认上限危害
|
|
340
|
+
|
|
341
|
+
| 库 | 默认大小上限 | 达到上限时的行为 |
|
|
342
|
+
|---|---|---|
|
|
343
|
+
| Serilog File sink (.NET) | 1 GB | **静默停止写入**(`RollOnFileSizeLimit = false` 为默认值) |
|
|
344
|
+
| log4j RollingFileAppender | 未设置则无上限 | 同上——不轮转即丢弃 |
|
|
345
|
+
| Python `RotatingFileHandler` | 未设置 `maxBytes` 则无限 | 无限增长 |
|
|
346
|
+
| Winston `winston-daily-rotate-file` | 未设置 `maxSize` 则无上限 | 同上——不轮转即丢弃 |
|
|
347
|
+
|
|
348
|
+
若未显式配置基于大小的轮转,即是接受上述某种失败模式。
|
|
349
|
+
|
|
350
|
+
### 推荐初始值
|
|
351
|
+
|
|
352
|
+
| 参数 | 取值 | 说明 |
|
|
353
|
+
|---|---|---|
|
|
354
|
+
| `fileSizeLimitBytes` | 100 MB | 平衡:足够小以便编辑器打开,足够大以避免过多轮转 |
|
|
355
|
+
| `rollOnFileSizeLimit` | `true` | 达到上限时创建 `*-001.txt`、`*-002.txt`;**不要**丢弃 |
|
|
356
|
+
| `retainedFileCountLimit` | ≥ N×7(N = 每天最大预期轮转次数) | 避免过早删除窗口内的日志 |
|
|
357
|
+
|
|
358
|
+
### 各语言配置示例
|
|
359
|
+
|
|
360
|
+
**.NET / Serilog**(`appsettings.json`):
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{
|
|
364
|
+
"Serilog": {
|
|
365
|
+
"WriteTo": [{
|
|
366
|
+
"Name": "File",
|
|
367
|
+
"Args": {
|
|
368
|
+
"path": "logs/app-.txt",
|
|
369
|
+
"rollingInterval": "Day",
|
|
370
|
+
"fileSizeLimitBytes": 104857600,
|
|
371
|
+
"rollOnFileSizeLimit": true,
|
|
372
|
+
"retainedFileCountLimit": 90
|
|
373
|
+
}
|
|
374
|
+
}]
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Python**(`logging.handlers`):
|
|
380
|
+
|
|
381
|
+
```python
|
|
382
|
+
from logging.handlers import RotatingFileHandler
|
|
383
|
+
|
|
384
|
+
handler = RotatingFileHandler(
|
|
385
|
+
filename="logs/app.log",
|
|
386
|
+
maxBytes=104857600, # 100 MB
|
|
387
|
+
backupCount=90 # 低基数时约保留 3 个月的轮转文件
|
|
388
|
+
)
|
|
389
|
+
# 如需时间+大小组合轮转,可组合使用 TimedRotatingFileHandler 并检查大小,
|
|
390
|
+
# 或使用第三方库如 concurrent-log-handler。
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
**Java / log4j2**(`log4j2.xml`):
|
|
394
|
+
|
|
395
|
+
```xml
|
|
396
|
+
<RollingFile name="App" fileName="logs/app.log"
|
|
397
|
+
filePattern="logs/app-%d{yyyy-MM-dd}-%i.log.gz">
|
|
398
|
+
<PatternLayout pattern="%d %-5p %c{1.} - %m%n"/>
|
|
399
|
+
<Policies>
|
|
400
|
+
<TimeBasedTriggeringPolicy interval="1"/>
|
|
401
|
+
<SizeBasedTriggeringPolicy size="100 MB"/>
|
|
402
|
+
</Policies>
|
|
403
|
+
<DefaultRolloverStrategy max="90"/>
|
|
404
|
+
</RollingFile>
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
**Node / Winston**(`winston-daily-rotate-file`):
|
|
408
|
+
|
|
409
|
+
```javascript
|
|
410
|
+
import DailyRotateFile from "winston-daily-rotate-file";
|
|
411
|
+
|
|
412
|
+
new DailyRotateFile({
|
|
413
|
+
filename: "logs/app-%DATE%.log",
|
|
414
|
+
datePattern: "YYYY-MM-DD",
|
|
415
|
+
maxSize: "100m",
|
|
416
|
+
maxFiles: "90d"
|
|
417
|
+
});
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### 运营 SOP——调查根因,不要仅提高上限
|
|
421
|
+
|
|
422
|
+
若日志文件大小在预计当天结束时达到 `fileSizeLimitBytes` 的 ≥ 90%,**在提高上限之前先调查原因**。典型根因:
|
|
423
|
+
|
|
424
|
+
- 在 INFO 级别记录每次重试的嘈杂重试循环(应改为 WARN 摘要)
|
|
425
|
+
- 意外在生产环境启用的无限制 debug 日志
|
|
426
|
+
- 单个上游故障引发的堆栈跟踪洪流
|
|
427
|
+
- 健康探针 / sidecar 污染业务日志
|
|
428
|
+
|
|
429
|
+
提高上限只会掩盖底层噪声问题,并将下一次故障推迟到更远的未来。
|
|
430
|
+
|
|
431
|
+
### 失败模式参考(真实事故)
|
|
432
|
+
|
|
433
|
+
某生产 .NET Worker 仅使用 `rollingInterval: Day`(未设置大小限制,Serilog 默认 1 GB 上限),在 07:31 触达上限后静默丢弃了所有日志条目,直到 13:00+ 运维人员发现日志尾部已停止更新。连续 5 个日志文件均显示 `~1,073,741,8XX 字节`(= 1 GiB,Serilog 默认值)。半天的生产诊断数据就此丢失。同时设置 `fileSizeLimitBytes` 和 `rollOnFileSizeLimit: true` 本可在保留所有事件的情况下将文件轮转为 `worker-YYYYMMDD_001.txt`。
|
|
434
|
+
|
|
314
435
|
---
|
|
315
436
|
|
|
316
437
|
## 相关标准
|
|
@@ -324,6 +445,7 @@ tracestate: vendor=value
|
|
|
324
445
|
|
|
325
446
|
| 版本 | 日期 | 变更 |
|
|
326
447
|
|-----|------|------|
|
|
448
|
+
| 1.3.0 | 2026-05-26 | 新增:日志文件轮转策略——强制双触发器(时间 + 大小)轮转,含默认上限危害警告、各语言(.NET/Python/Java/Node)配置示例、运营 SOP(XSPEC-232 / 关闭 issue #111) |
|
|
327
449
|
| 1.2.0 | 2026-01-24 | 新增:OpenTelemetry 语义规范、可观测性三支柱整合、基于日志的告警、进阶关联模式 |
|
|
328
450
|
| 1.1.0 | 2026-01-05 | 新增:参考标准章节,包含 OWASP、RFC 5424、OpenTelemetry 和 12 Factor App |
|
|
329
451
|
| 1.0.0 | 2025-12-30 | 初始日志标准 |
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/mock-boundary.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
|
+
source_hash: d2648ad3d869
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Mock 边界标准
|
|
11
|
+
|
|
12
|
+
> **语言**: [English](../../../core/mock-boundary.md) | [繁體中文](../../zh-TW/core/mock-boundary.md) | 简体中文
|
|
13
|
+
|
|
14
|
+
**版本**: 1.0.0
|
|
15
|
+
**最后更新**: 2026-05-04
|
|
16
|
+
**适用性**: 所有具备单元测试与集成测试的软件项目
|
|
17
|
+
**范围**: universal
|
|
18
|
+
**行业标准**: ISTQB Foundation(Test Doubles), xUnit Patterns(Gerard Meszaros)
|
|
19
|
+
**参考**: "Working Effectively with Legacy Code"(Feathers), "Growing Object-Oriented Software"(Freeman & Pryce)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 目的
|
|
24
|
+
|
|
25
|
+
本文档定义测试中哪些东西可以 mock、哪些不可以。其目标是防止**空心测试(hollow tests)**——永远通过却无法检测真实 bug 的测试,因为它们用 stub 取代了系统的逻辑。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 空心测试问题
|
|
30
|
+
|
|
31
|
+
空心测试 mock 掉系统的大部分内容,使测试变成 mock 接线的规格说明,而非系统行为的规格说明。经典症状:你可以删掉实现文件,测试仍然通过。
|
|
32
|
+
|
|
33
|
+
**真实案例(Multi-agent pipeline SPEC-002.test.ts)**:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
vi.mock('../../src/runner/agent-runner.js') // Core logic replaced
|
|
37
|
+
vi.mock('../../src/runner/guardian-hooks.js') // Core logic replaced
|
|
38
|
+
vi.mock('../../src/runner/prototyper.js') // Core logic replaced
|
|
39
|
+
vi.mock('../../src/runner/iteration-report.js') // Core logic replaced
|
|
40
|
+
vi.mock('../../src/memory/memory-store.js') // Core logic replaced
|
|
41
|
+
vi.mock('node:fs/promises', ...) // I/O replaced
|
|
42
|
+
|
|
43
|
+
// All assertions verify mock call counts — not actual outputs.
|
|
44
|
+
// runPipeline() touches zero real code.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 可以 Mock 的项目
|
|
50
|
+
|
|
51
|
+
| 类别 | 示例 | 理由 |
|
|
52
|
+
|------|------|------|
|
|
53
|
+
| 外部 HTTP 服务 | LLM API、支付网关、email 服务 | 防止不稳定(flaky)测试;可控制响应场景 |
|
|
54
|
+
| 时间函数 | `Date.now()`、`new Date()`、`setTimeout` | 使测试具确定性 |
|
|
55
|
+
| 环境变量 | `process.env.NODE_ENV`、`process.env.LICENSE_KEY` | 支持配置变化 |
|
|
56
|
+
| 文件系统(仅限单元测试) | `fs.readFile`、`fs.writeFile` | 让快速单元测试避免 I/O |
|
|
57
|
+
| 跨模块边界(须有对应 IT) | 其他模块的 public API | 隔离被测单元 |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 不可 Mock 的项目
|
|
62
|
+
|
|
63
|
+
| 类别 | 违规示例 | 禁止原因 |
|
|
64
|
+
|------|---------|---------|
|
|
65
|
+
| 自身模块的核心逻辑 | 在 pipeline-runner 测试中 `vi.mock('./pipeline-runner.js')` | 使测试形同虚设 |
|
|
66
|
+
| IT/flow/E2E 测试中的数据库 | 在集成测试中 `vi.mock('./db/client.js')` | 隐藏查询 bug、schema 问题 |
|
|
67
|
+
| HTTP 框架内部 | `vi.mock('express')` | 真实路由可能已坏 |
|
|
68
|
+
| 安全控制 | 永远通过的 auth middleware stub | 安全性回归不可见 |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 空心测试检测
|
|
73
|
+
|
|
74
|
+
提交测试文件之前,请检查:
|
|
75
|
+
|
|
76
|
+
1. **Mock 数量 ≥ import 数量** → 评审:至少要有一个断言验证实际输出
|
|
77
|
+
2. **所有断言都是 `.toHaveBeenCalled()` 系列** → 加入输出值断言
|
|
78
|
+
3. **Mock 路径与被测对象目录相同** → 自我引用 mock;移除之
|
|
79
|
+
4. **Mock 设置行数多于断言行数** → 很可能是空心测试
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 反模式
|
|
84
|
+
|
|
85
|
+
- **Total Mock Isolation**:所有 import 都被 mock;只断言 mock 交互
|
|
86
|
+
- **Mock the World**:外部 + 内部 + DB + FS 在同一个测试中全部 mock
|
|
87
|
+
- **Orphan Mock**:跨模块 mock 却没有对应的集成测试
|
|
88
|
+
- **Security Bypass Mock**:auth/权限逻辑被换成直接放行的 stub
|
|
89
|
+
- **Database Mock Cascade**:DB 返回硬编码的数据,隐藏真实查询错误
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 规则摘要
|
|
94
|
+
|
|
95
|
+
| 规则 | 触发条件 | 动作 |
|
|
96
|
+
|------|---------|------|
|
|
97
|
+
| 禁止 self-mock | 测试文件 mock 自己的模块 | 移除 mock;让真实代码运行 |
|
|
98
|
+
| IT/flow 用真实 DB | 编写 IT 或 flow 测试 | 使用 in-memory SQLite 或测试 schema |
|
|
99
|
+
| IT 对应测试 | mock 跨模块边界 | 确保有对应的 IT 存在 |
|
|
100
|
+
| 禁止 mock 安全机制 | 测试涉及 auth/权限 | 使用真实测试用户 + 真实 token |
|
|
101
|
+
| 空心评审 | Mock 数量 ≥ import 数量 | 加入输出值断言 |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 与其他标准的关系
|
|
106
|
+
|
|
107
|
+
- **testing**:Mock 边界规则适用于测试金字塔的所有测试级别
|
|
108
|
+
- **test-completeness-dimensions**:维度 8(AI 测试质量)引用了这些规则
|
|
109
|
+
- **flow-based-testing**:Flow 测试必须遵循 mock 边界规则
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../core/model-selection.md
|
|
3
|
-
source_version: 1.0.
|
|
4
|
-
translation_version: 1.0.
|
|
5
|
-
last_synced: 2026-
|
|
3
|
+
source_version: 1.0.1
|
|
4
|
+
translation_version: 1.0.1
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
6
|
status: current
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,8 +10,8 @@ status: current
|
|
|
10
10
|
|
|
11
11
|
# AI 模型选择策略
|
|
12
12
|
|
|
13
|
-
**版本**: 1.0.
|
|
14
|
-
**最后更新**: 2026-
|
|
13
|
+
**版本**: 1.0.1
|
|
14
|
+
**最后更新**: 2026-06-10
|
|
15
15
|
**适用范围**: 使用多层级模型的 AI 辅助开发
|
|
16
16
|
**范围**: universal
|
|
17
17
|
**灵感来源**: [Superpowers](https://github.com/obra/superpowers) — subagent-driven-development (MIT)
|
|
@@ -100,6 +100,20 @@ status: current
|
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
|
+
## 与下一步建议整合
|
|
104
|
+
|
|
105
|
+
[ai-response-navigation](ai-response-navigation.md) 标准(规则 R6,可选)允许每个「建议下一步」选项携带级别标注。本标准的复杂度信号即为判断依据。
|
|
106
|
+
|
|
107
|
+
**与厂商无关原则**:级别名称(Fast/Standard/Capable)是工具无关的泛称。各平台自行将级别映射到可用模型。
|
|
108
|
+
|
|
109
|
+
| 级别 | 典型能力定位 |
|
|
110
|
+
|------|-------------|
|
|
111
|
+
| Fast | 轻量级 / 指令遵循 |
|
|
112
|
+
| Standard | 均衡推理 + 代码生成 |
|
|
113
|
+
| Capable | 高级推理、架构分析 |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
103
117
|
## 相关标准
|
|
104
118
|
|
|
105
119
|
- [代理派遣与并行协调](agent-dispatch.md)
|
|
@@ -107,6 +121,15 @@ status: current
|
|
|
107
121
|
|
|
108
122
|
---
|
|
109
123
|
|
|
124
|
+
## 版本历史
|
|
125
|
+
|
|
126
|
+
| 版本 | 日期 | 变更 |
|
|
127
|
+
|------|------|------|
|
|
128
|
+
| 1.0.1 | 2026-06-10 | 新增「与下一步建议整合」节(R6 交叉引用;与厂商无关原则) |
|
|
129
|
+
| 1.0.0 | 2026-03-20 | 初始版本 |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
110
133
|
## 许可证
|
|
111
134
|
|
|
112
135
|
本标准采用 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) 发布。
|