universal-dev-standards 5.17.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/uds.js +13 -135
- package/bundled/ai/options/commit-message/bilingual.ai.yaml +19 -1
- 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 +3 -3
- 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/documentation-writing-standards.ai.yaml +1 -1
- 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/frontend-design-standards.ai.yaml +33 -3
- 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/push-standards.ai.yaml +14 -3
- package/bundled/ai/standards/refactoring-standards.ai.yaml +68 -3
- package/bundled/ai/standards/requirement-engineering.ai.yaml +42 -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/self-review-protocol.ai.yaml +15 -10
- 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-evidence.ai.yaml +88 -5
- 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 +10 -3
- 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 +2 -2
- package/bundled/core/error-code-standards.md +4 -3
- package/bundled/core/feature-discovery-standards.md +191 -0
- 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/frontend-design-standards.md +93 -4
- 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/multi-environment-e2e-testing.md +195 -0
- 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/push-standards.md +82 -0
- package/bundled/core/refactoring-standards.md +44 -3
- package/bundled/core/replay-test.md +1 -1
- package/bundled/core/requirement-engineering.md +2 -2
- 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 +15 -10
- 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-evidence.md +170 -10
- package/bundled/core/verification-oracle.md +167 -0
- package/bundled/core/versioning.md +133 -109
- package/bundled/locales/COVERAGE.md +94 -77
- package/bundled/locales/zh-CN/CHANGELOG.md +94 -6
- package/bundled/locales/zh-CN/CLAUDE.md +1 -1
- package/bundled/locales/zh-CN/MAINTENANCE.md +42 -661
- package/bundled/locales/zh-CN/README.md +25 -12
- package/bundled/locales/zh-CN/SECURITY.md +2 -2
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-CN/ai/options/commit-message/bilingual.ai.yaml +6 -1
- 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 +239 -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 +200 -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/frontend-design-standards.md +1 -1
- package/bundled/locales/zh-CN/core/full-coverage-testing.md +269 -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 +131 -0
- package/bundled/locales/zh-CN/core/llm-output-validation.md +192 -0
- package/bundled/locales/zh-CN/core/logging-standards.md +205 -7
- package/bundled/locales/zh-CN/core/mock-boundary.md +161 -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 +77 -5
- package/bundled/locales/zh-CN/core/pipeline-security-gates.md +146 -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/requirement-engineering.md +1 -1
- 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 +113 -0
- package/bundled/locales/zh-CN/core/self-review-protocol.md +172 -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/verification-evidence.md +252 -41
- package/bundled/locales/zh-CN/core/versioning.md +1 -1
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +36 -7
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +71 -53
- 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/commit-message/bilingual.md +10 -3
- 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 +115 -17
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +37 -12
- 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 +169 -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 +94 -6
- package/bundled/locales/zh-TW/CLAUDE.md +1 -1
- package/bundled/locales/zh-TW/MAINTENANCE.md +51 -4
- package/bundled/locales/zh-TW/README.md +25 -12
- package/bundled/locales/zh-TW/SECURITY.md +2 -2
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-TW/ai/options/commit-message/bilingual.ai.yaml +6 -1
- 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/frontend-design-standards.md +1 -1
- 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 +131 -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 +77 -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 +146 -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/requirement-engineering.md +1 -1
- 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 +113 -0
- package/bundled/locales/zh-TW/core/self-review-protocol.md +18 -13
- 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-evidence.md +260 -31
- 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 +36 -7
- package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +6 -6
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +71 -53
- 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/commit-message/bilingual.md +10 -3
- 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 +116 -18
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +38 -11
- 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 +52 -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 +139 -15
- package/bundled/skills/brainstorm-assistant/guide.md +39 -8
- 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 +13 -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 +4 -4
- 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 +168 -75
- 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 +61 -149
- 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,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/incident-response.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-17
|
|
6
|
+
source_hash: b1c1a516710b
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 事件回應標準
|
|
11
|
+
|
|
12
|
+
> **Language**: [English](../../../core/incident-response.md) | 繁體中文
|
|
13
|
+
|
|
14
|
+
> **版本**: 1.0.0 | **狀態**: Active | **更新日期**: 2026-06-17
|
|
15
|
+
> **AI 最佳化版本**: `ai/standards/incident-response.ai.yaml`
|
|
16
|
+
> **規格**: XSPEC-063(cross-project/specs/XSPEC-063-uds-sre-standards-pack.md)
|
|
17
|
+
|
|
18
|
+
## 概觀
|
|
19
|
+
|
|
20
|
+
本標準定義端到端的**事件回應生命週期(incident response lifecycle)**:severity
|
|
21
|
+
分類、回應時間 SLA、角色與職責、溝通協定、升級路徑,以及 blameless postmortem
|
|
22
|
+
要求。設計目標為降低 MTTR、確保事件期間對利害關係人的一致溝通,並透過結構化
|
|
23
|
+
postmortem 推動系統性可靠性改善。
|
|
24
|
+
|
|
25
|
+
本標準屬於 **SRE/運維標準包**(XSPEC-063),是與 `slo-sli`(error budget 觸發)
|
|
26
|
+
與 `runbook`(可執行修復步驟)並列的事件處理成員。它與
|
|
27
|
+
`virtual-organization-standards` 組合——SEV-1 事件會啟動事件 virtual organization
|
|
28
|
+
(IC、Communications Lead、Operations Lead)——並餵養 XSPEC-251(Operator)所述的
|
|
29
|
+
主動可靠性責任。
|
|
30
|
+
|
|
31
|
+
> **範圍**:本標準定義「事件如何分類、協調、溝通與學習」。paging 工具(PagerDuty、
|
|
32
|
+
> Opsgenie)、status-page 產品與 ticketing 系統屬採用者的選擇,不在本標準範圍內。
|
|
33
|
+
|
|
34
|
+
## 需求
|
|
35
|
+
|
|
36
|
+
| ID | 規則 | 等級 |
|
|
37
|
+
|----|------|------|
|
|
38
|
+
| REQ-001 | Severity 分類(4 級 SEV 量表搭配回應 SLA) | MUST |
|
|
39
|
+
| REQ-002 | Incident Commander 角色(SEV-1/2 須於 10 分鐘內指派) | MUST |
|
|
40
|
+
| REQ-003 | 利害關係人溝通協定(定義節奏 + status page) | MUST |
|
|
41
|
+
| REQ-004 | Blameless postmortem 要求(5 Whys、action item 追蹤) | MUST |
|
|
42
|
+
| REQ-005 | On-call 輪值與交接(≥2 名工程師、書面交接) | MUST |
|
|
43
|
+
| REQ-006 | 事件回顧指標(MTTD/MTTR 每月檢視) | SHOULD |
|
|
44
|
+
|
|
45
|
+
### REQ-001 — Severity 分類
|
|
46
|
+
|
|
47
|
+
每起事件 MUST 在宣告時以 4 級 severity 量表分類。**SEV-1**(Critical):影響所有
|
|
48
|
+
使用者的完全服務中斷或資料外洩,15 分鐘內回應、通報 C-suite。**SEV-2**(High):
|
|
49
|
+
主要功能無法使用或顯著效能劣化、影響 >25% 使用者,30 分鐘內回應。**SEV-3**
|
|
50
|
+
(Medium):次要功能無法使用或影響 <25% 使用者的劣化,4 小時內回應。**SEV-4**
|
|
51
|
+
(Low):外觀問題或極輕微影響,24 小時內回應。
|
|
52
|
+
|
|
53
|
+
### REQ-002 — Incident Commander 角色
|
|
54
|
+
|
|
55
|
+
每起 SEV-1 與 SEV-2 事件 MUST 在宣告後 10 分鐘內指派一名 Incident Commander(IC)。
|
|
56
|
+
IC 負責協調回應 bridge、指派角色(scribe、comms lead、技術 lead)、推動時間軸、
|
|
57
|
+
對修復做出 go/no-go 決策,以及啟動 postmortem。IC NOT 直接進行除錯——其唯一焦點
|
|
58
|
+
是協調。
|
|
59
|
+
|
|
60
|
+
### REQ-003 — 利害關係人溝通協定
|
|
61
|
+
|
|
62
|
+
在 SEV-1/SEV-2 事件期間,對利害關係人的更新 MUST 依定義節奏發送:宣告後 15 分鐘內
|
|
63
|
+
首次通知、直到解決前每 30 分鐘更新一次,並在任何 severity 變更或重大進展時立即
|
|
64
|
+
更新。更新 MUST 包含目前狀態、已知影響、正在進行的處置,以及下次更新時間。status
|
|
65
|
+
page MUST 與內部溝通同步更新。
|
|
66
|
+
|
|
67
|
+
### REQ-004 — Blameless Postmortem 要求
|
|
68
|
+
|
|
69
|
+
每起 SEV-1 事件 MUST 在 5 個工作天內完成 blameless postmortem;SEV-2 事件則於 10 個
|
|
70
|
+
工作天內。Postmortem MUST 為 blameless——聚焦系統性成因,而非個人錯誤。必備章節:
|
|
71
|
+
時間軸、影響、root cause(5 Whys)、contributing factors、附負責人與到期日的 action
|
|
72
|
+
item,以及 lessons learned。Action item MUST 追蹤至完成。
|
|
73
|
+
|
|
74
|
+
### REQ-005 — On-Call 輪值與交接
|
|
75
|
+
|
|
76
|
+
每個 production 服務 MUST 具備文件化的 on-call 輪值,至少 2 名工程師。輪值排程 MUST
|
|
77
|
+
至少提前 2 週發布。On-call 交接 MUST 包含書面摘要:進行中的事件、仍在調查的近期
|
|
78
|
+
事件、已知的 flaky alert、即將到來的計畫性維護,以及任何服務健康疑慮。交接 MUST
|
|
79
|
+
由接班 on-call 確認接收。
|
|
80
|
+
|
|
81
|
+
### REQ-006 — 事件回顧指標
|
|
82
|
+
|
|
83
|
+
團隊 SHOULD 每月追蹤並檢視事件指標:MTTD(Mean Time To Detect)、MTTR(Mean Time
|
|
84
|
+
To Resolve)、各 severity 的事件頻率、重複事件(90 天內相同 root cause),以及
|
|
85
|
+
postmortem action-item 完成率。這些指標 SHOULD 在與工程領導層的每月可靠性檢視中
|
|
86
|
+
檢討。
|
|
87
|
+
|
|
88
|
+
## 與既有標準的整合
|
|
89
|
+
|
|
90
|
+
- **`runbook`**——IC 與 on-call 工程師在 mitigate 階段執行 typed runbook;SEV
|
|
91
|
+
runbook 依 `runbook` 節奏演練。
|
|
92
|
+
- **`slo-sli`**——error budget 燃燒常觸發事件宣告;SLO 影響於 postmortem 中摘要。
|
|
93
|
+
- **`postmortem-standards`**——REQ-004 與 blameless postmortem 模板對齊;本標準
|
|
94
|
+
設定觸發條件與時程。
|
|
95
|
+
- **`virtual-organization-standards`**——SEV-1 事件實例化事件 virtual organization
|
|
96
|
+
(IC、Communications Lead、Operations Lead)。
|
|
97
|
+
- **`alerting-standards`**——告警啟動偵測與 severity 評估。
|
|
98
|
+
- **`execution-history`**——自動化緩解動作記錄為 execution history。
|
|
99
|
+
|
|
100
|
+
## 相關規格
|
|
101
|
+
|
|
102
|
+
- XSPEC-063 — UDS SRE/運維標準包(本標準來源)
|
|
103
|
+
- XSPEC-251 — Operator 主動可靠性(事件上游的主動責任)
|
|
104
|
+
- DEC-041 — EU AI Act 2026 合規(可稽核性需要 postmortem)
|
|
105
|
+
- DEC-042 — Guardian / Governance Agent 模式(agent 驅動 runbook 執行)
|
|
106
|
+
|
|
107
|
+
## 變更紀錄
|
|
108
|
+
|
|
109
|
+
| 版本 | 日期 | 變更 |
|
|
110
|
+
|------|------|------|
|
|
111
|
+
| v1.0.0 | 2026-06-17 | 初版——REQ-001~006:severity 分類、incident commander、溝通協定、blameless postmortem、on-call 輪值/交接、回顧指標(XSPEC-063) |
|
|
@@ -0,0 +1,131 @@
|
|
|
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: 8ac1763bd1a1
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 授權合規標準
|
|
11
|
+
|
|
12
|
+
> **Language**: [English](../../../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
|
+
**Scope**: universal
|
|
19
|
+
|
|
20
|
+
## 概述
|
|
21
|
+
|
|
22
|
+
針對 AI 增強開發的完整授權合規標準,涵蓋一般 OSS 實務(Tier 1)以及針對 AI 生成程式碼的 AI 專屬規則(Tier 2)。
|
|
23
|
+
|
|
24
|
+
## Tier 1 — 一般 OSS 合規實務
|
|
25
|
+
|
|
26
|
+
適用於所有專案,無論是否使用 AI。
|
|
27
|
+
|
|
28
|
+
| ID | 規則 | 等級 |
|
|
29
|
+
|----|------|------|
|
|
30
|
+
| REQ-001 | 授權分類與允許清單(allowlist) | MUST |
|
|
31
|
+
| REQ-002 | CI 中的自動化授權掃描 | MUST |
|
|
32
|
+
| REQ-003 | SBOM 產生(CycloneDX 1.5 或 SPDX 2.3) | MUST |
|
|
33
|
+
| REQ-004 | 授權署名與 NOTICES 檔案 | MUST |
|
|
34
|
+
| REQ-005 | 授權違規補救(5 個工作天) | MUST |
|
|
35
|
+
| REQ-006 | 採用新技術時的授權審查 | SHOULD |
|
|
36
|
+
|
|
37
|
+
### 授權分級
|
|
38
|
+
|
|
39
|
+
| 分級 | 授權 | 動作 |
|
|
40
|
+
|------|------|------|
|
|
41
|
+
| APPROVED | MIT, Apache 2.0, BSD-2/3-Clause, ISC, CC0 | 自動核准 |
|
|
42
|
+
| REVIEW-REQUIRED | LGPL-2.1/3.0, MPL-2.0, CDDL | 採用前須法務審查 |
|
|
43
|
+
| PROHIBITED | GPL-2.0/3.0, AGPL-3.0, SSPL-1.0, BUSL-1.1 | 立即封鎖 PR |
|
|
44
|
+
|
|
45
|
+
## Tier 2 — AI 專屬規則
|
|
46
|
+
|
|
47
|
+
對產生程式碼的 AI Agent(VibeOps Generator Agent 及同等者)具有約束力。
|
|
48
|
+
|
|
49
|
+
| ID | 規則 | 嚴重度 |
|
|
50
|
+
|----|------|--------|
|
|
51
|
+
| LC-001 | 必須查詢 SPDX ID | Blocking |
|
|
52
|
+
| LC-002 | 封鎖清單(blocklist)自動封鎖 | Blocking |
|
|
53
|
+
| LC-003 | 允許清單(allowlist)自動核准 | Informational |
|
|
54
|
+
| LC-004 | 灰名單(greylist)人工審查 | Review required |
|
|
55
|
+
| LC-005 | SBOM 強制產生 | Blocking |
|
|
56
|
+
| LC-006 | 著作權相似度閾值(≥0.85 封鎖) | Blocking |
|
|
57
|
+
| LC-007 | PII 樣式偵測 | Review required |
|
|
58
|
+
| LC-008 | EU AI Act 透明度標記 | Blocking |
|
|
59
|
+
| LC-009 | 客戶政策上限 | Informational |
|
|
60
|
+
|
|
61
|
+
## v2.1.0 增強(XSPEC-193 Phase 2)
|
|
62
|
+
|
|
63
|
+
### ClearlyDefined API(LC-001)
|
|
64
|
+
|
|
65
|
+
- 主要授權查詢來源:`https://api.clearlydefined.io/definitions/{type}/{provider}/{namespace}/{name}/{revision}`
|
|
66
|
+
- 知名套件的信賴度 ≥ 0.95(score.total ≥ 80)
|
|
67
|
+
- 24h TTL LRU 快取(cap=500)+ 404 negative cache
|
|
68
|
+
- Token bucket:10 req/s,burst 20
|
|
69
|
+
- 重試策略:5xx → exponential backoff × 3(200ms/1s/3s);429 → batch fallback
|
|
70
|
+
- DEC-064 快取金鑰隔離:`sha256(client_salt + ':' + purl)`
|
|
71
|
+
|
|
72
|
+
### AST PII 分析(LC-007)
|
|
73
|
+
|
|
74
|
+
- Tree-sitter 支援:TypeScript、JavaScript、Python
|
|
75
|
+
- 上下文分類:
|
|
76
|
+
- `hardcoded_value` → 嚴重度升級為 `critical`
|
|
77
|
+
- `comment` → 嚴重度降級為 `info`
|
|
78
|
+
- `schema_field` → 加註,嚴重度不變
|
|
79
|
+
- `// pii:ignore` pragma:抑制同一行的發現
|
|
80
|
+
- 選填欄位:`PIIPattern.confidence`、`PIIPattern.ast_context`
|
|
81
|
+
- tree-sitter 不可用時優雅降級(graceful fallback)為 regex
|
|
82
|
+
|
|
83
|
+
### EmbeddingProvider 策略(LC-006)
|
|
84
|
+
|
|
85
|
+
- `provider='onnx-minilm'`:ONNX 本機推論(all-MiniLM-L6-v2)
|
|
86
|
+
- `provider='ollama-bge-m3'`:Ollama 本機 API(localhost:11434)
|
|
87
|
+
- `provider='jaccard'`:Jaccard token 相似度(Phase 1 基準線,預設)
|
|
88
|
+
- 記憶體內 snippet 索引(`buildSnippetIndex()`)依客戶隔離(DEC-064 salt)
|
|
89
|
+
- 外部搜尋:透過 `enableExternalSearch=true` opt-in(預設=false)
|
|
90
|
+
|
|
91
|
+
## 原則
|
|
92
|
+
|
|
93
|
+
| ID | 原則 |
|
|
94
|
+
|----|------|
|
|
95
|
+
| P-1 | SPDX 優先 — 所有授權 ID 必須是 SPDX 標準 |
|
|
96
|
+
| P-2 | 獨立評估者 — 與 Generator 使用不同的模型類別 |
|
|
97
|
+
| P-3 | 證據導向決策 — 每個封鎖都附帶可追溯的證據 |
|
|
98
|
+
| P-4 | 預設透明 — 必須有 EU AI Act Article 50 標記 |
|
|
99
|
+
| P-5 | 客戶主權 — 政策可在 EULA §9 限制內客製化 |
|
|
100
|
+
|
|
101
|
+
## 工具序列(XSPEC-193 §2)
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
1. dependency_reader
|
|
105
|
+
2. license_lookup ← ClearlyDefined API (v2.1.0)
|
|
106
|
+
3. license_blocklist_check
|
|
107
|
+
4. sbom_generator
|
|
108
|
+
5. pii_pattern_detector ← AST-enhanced (v2.1.0)
|
|
109
|
+
6. copyright_similarity_check ← EmbeddingProvider (v2.1.0)
|
|
110
|
+
7. eu_ai_act_classifier
|
|
111
|
+
8. transparency_marker
|
|
112
|
+
9. block_pr
|
|
113
|
+
10. suggest_alternative
|
|
114
|
+
11. escalate_to_human
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 相關規格
|
|
118
|
+
|
|
119
|
+
- XSPEC-193 — License Compliance Agent 完整規格
|
|
120
|
+
- XSPEC-066 — Wave 3 Compliance Pack(v1.0.0 基準線)
|
|
121
|
+
- DEC-063 — VibeOps 法務與合規策略
|
|
122
|
+
- DEC-064 — 客戶 IP 隔離(cache salt)
|
|
123
|
+
- ASPEC-001 — License Compliance Agent SPEC(XSPEC-205 §REQ-2 格式)
|
|
124
|
+
|
|
125
|
+
## 變更紀錄
|
|
126
|
+
|
|
127
|
+
| 版本 | 日期 | 變更 |
|
|
128
|
+
|------|------|------|
|
|
129
|
+
| v1.0.0 | 2026-04-30 | 初版 — REQ-001~006 一般 OSS 實務 |
|
|
130
|
+
| v2.0.0 | 2026-05-14 | 新增 Tier 2 LC-001~009 AI 專屬規則 |
|
|
131
|
+
| 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
|
+
> **Language**: [English](../../../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,19 +1,102 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../core/logging-standards.md
|
|
3
|
-
source_version: 1.
|
|
4
|
-
translation_version: 1.
|
|
5
|
-
last_synced: 2026-
|
|
3
|
+
source_version: 1.4.0
|
|
4
|
+
translation_version: 1.4.0
|
|
5
|
+
last_synced: 2026-07-08
|
|
6
|
+
source_hash: 732277ef939f
|
|
6
7
|
status: current
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
# 日誌標準
|
|
10
11
|
|
|
11
|
-
>
|
|
12
|
+
> **語言**: [English](../../../core/logging-standards.md) | 繁體中文
|
|
13
|
+
|
|
14
|
+
**版本**: 1.4.0
|
|
15
|
+
**最後更新**: 2026-06-17
|
|
16
|
+
**適用性**: 所有軟體專案
|
|
17
|
+
**範圍**: 通用 (Universal)
|
|
18
|
+
**業界標準**: RFC 5424、OpenTelemetry、W3C Trace Context
|
|
19
|
+
**參考**: [opentelemetry.io](https://opentelemetry.io/)
|
|
12
20
|
|
|
13
21
|
## 概述
|
|
14
22
|
|
|
15
23
|
本文件定義日誌標準,確保所有環境中的應用程式日誌具有一致性、結構化且可操作。
|
|
16
24
|
|
|
25
|
+
## 強制事件 (Mandatory Events)
|
|
26
|
+
|
|
27
|
+
> **結案** UDS issue [#108](https://github.com/AsiaOstrich/universal-dev-standards/issues/108)(XSPEC-234)。本標準其餘部分定義**如何**寫一條 log(等級/欄位/PII 遮罩/輪替);本章定義**何時必須寫**——把「規範上合格但實質沉默」的 logging 排除在外。
|
|
28
|
+
|
|
29
|
+
遵守所有格式規則卻**在關鍵時刻從不觸發**的 logging 比沒有還糟:它在事故當下給人虛假的安全感。以下事件是**必須**寫 log 的 canonical 時機,每個宣告 `when`/`must_log`/`must_NOT_log`/`level`/`rationale`。
|
|
30
|
+
|
|
31
|
+
### 為何需要(真實事故)
|
|
32
|
+
|
|
33
|
+
某 PHP→.NET 遷移耗 2 天診斷「send failed、沒 log」,因為**四層皆沉默**:
|
|
34
|
+
|
|
35
|
+
1. **負載平衡器將 backend 標 DOWN**(503)——health probe 逾時;backend 只記 probe 噪音,零業務事件。
|
|
36
|
+
2. **Framework 驗證 reject**(如 ModelState/DTO 501)——在任何 handler 執行前就返回,**payload 完全未 log**。
|
|
37
|
+
3. **Auth 失敗**只記「Account or password error」——**無 uid、無 source IP** → 無法調查。
|
|
38
|
+
4. **背景 worker 還活著但 log 檔 0 bytes**——無機制偵測沉默。
|
|
39
|
+
|
|
40
|
+
這些都無法靠格式規則捕捉,強制事件補上此缺口。
|
|
41
|
+
|
|
42
|
+
### 類目(9 個 canonical 事件)
|
|
43
|
+
|
|
44
|
+
| id | when 時機 | level | 核心必填欄位(`must_log`)| `must_NOT_log` |
|
|
45
|
+
|----|-----------|-------|---------------------------|----------------|
|
|
46
|
+
| `application_startup` | process boot 後,**接受請求前** | INFO | app_name, version, git_sha, environment, hostname, pid, listening_endpoints | secrets、完整連線字串 |
|
|
47
|
+
| `request_received` | HTTP middleware 首次看到 request | INFO / DEBUG | method, path, source_ip, request_id | request body、auth headers |
|
|
48
|
+
| `validation_failure` | schema / ModelState / DTO 驗證 reject | WARN | request_id, path, missing_fields[], payload_shape(僅 keys)| 欄位**值**、PII |
|
|
49
|
+
| `authentication_failure` | login / token 驗證失敗 | WARN | uid(嘗試), source_ip, failure_reason | password、token value |
|
|
50
|
+
| `outbound_call_start` | 對外 HTTP/RPC call 發起 | INFO | target_url(host+path), request_id propagated, timeout_ms | credentials、bearer tokens |
|
|
51
|
+
| `outbound_call_complete` | 外部 call 返回或失敗 | INFO / WARN / ERROR | status_code **或** failure_phase(dns/tcp/tls/http), elapsed_ms, retries | 含 PII 的 response body |
|
|
52
|
+
| `business_event` | state-changing 業務操作完成 | INFO | operation_name, actor, target ids, outcome | 完整 record payload、PII |
|
|
53
|
+
| `heartbeat` | 長期背景服務,≥ 1 次 / 60 秒 | INFO | service_name, queue_depth, items_processed_since_last_heartbeat | — |
|
|
54
|
+
| `shutdown` | process 退出(graceful 或 fatal)| INFO / ERROR | app_name, signal/reason, uptime_seconds, pending_work_count | — |
|
|
55
|
+
|
|
56
|
+
每個事件的 `rationale` 對應真實失效模式:`validation_failure` ⇒ 事故 #2(payload 未記);`authentication_failure` 欄位要求 ⇒ 事故 #3(無 uid/IP);`heartbeat` + 沉默偵測 ⇒ 事故 #4(0-byte log);`application_startup`/`shutdown` ⇒ 生命週期盲區;`outbound_call_*` ⇒「send failed」卻無 call 痕跡。
|
|
57
|
+
|
|
58
|
+
### 場景
|
|
59
|
+
|
|
60
|
+
#### Scenario:驗證失敗時必須有 log
|
|
61
|
+
|
|
62
|
+
- **GIVEN** API endpoint 收到缺 `[Required]` 欄位的 payload
|
|
63
|
+
- **WHEN** framework 在 handler 執行前自動 reject(如 400/501)
|
|
64
|
+
- **THEN** 必須寫一條 WARN log,含 `request_id`、`path`、`missing_fields[]`、`payload_shape`(僅 keys)
|
|
65
|
+
- **AND** post-mortem 可直接從 log 重現失敗原因
|
|
66
|
+
|
|
67
|
+
#### Scenario:背景服務必須 heartbeat
|
|
68
|
+
|
|
69
|
+
- **GIVEN** worker process 啟動
|
|
70
|
+
- **WHEN** 60 秒內無 INFO/WARN/ERROR 寫入
|
|
71
|
+
- **THEN** 必須寫一條 `heartbeat` log,含當前 queue depth 與累計處理量
|
|
72
|
+
- **AND** 若連續 ≥ 2× 心跳間隔(≥ 120 秒)無 heartbeat,silence detector 必須 alert
|
|
73
|
+
|
|
74
|
+
### Compliant startup log 範例
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"timestamp": "2026-06-17T08:00:00.000Z",
|
|
79
|
+
"level": "INFO",
|
|
80
|
+
"message": "application_startup",
|
|
81
|
+
"event": "application_startup",
|
|
82
|
+
"app_name": "payment-service",
|
|
83
|
+
"version": "2.3.1",
|
|
84
|
+
"git_sha": "a1b2c3d",
|
|
85
|
+
"environment": "production",
|
|
86
|
+
"hostname": "pod-abc123",
|
|
87
|
+
"pid": 4711,
|
|
88
|
+
"listening_endpoints": ["0.0.0.0:8080", "0.0.0.0:9090/metrics"]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Follow-on 規則
|
|
93
|
+
|
|
94
|
+
1. **Access log 分離**——health probe/liveness 流量不應污染業務事件 log。將 probe 導向獨立 sink/檔案,避免淹沒或輪替掉業務事件(見事故 #1)。
|
|
95
|
+
2. **Log 沉默偵測 SLA**——服務應於 N 分鐘無事件時 alert,N ≤ 2× `heartbeat` 間隔。缺少預期 log 本身就是可告警條件(見下方「Absence of Expected Logs」告警模式)。
|
|
96
|
+
3. **OPS-facing log 可發現性**——回給 client 的錯誤回應應帶 `request_id`,讓支援能將使用者回報的失敗對應到 backend log,免於來回詢問 log 存取。
|
|
97
|
+
|
|
98
|
+
> **Cross-ref**:`heartbeat`/沉默偵測與[日誌檔案輪替政策](#日誌檔案輪替政策)互補(0-byte/靜默丟棄的 log 是同一盲區的兩個方向),並與 migration-assistant 的背景作業/副作用完整性互補(這些事件即可觀測的「已執行」證據)。
|
|
99
|
+
|
|
17
100
|
## 日誌等級
|
|
18
101
|
|
|
19
102
|
### 標準日誌等級
|
|
@@ -417,6 +500,117 @@ tracestate: vendor=value
|
|
|
417
500
|
| WARN | 90 天 |
|
|
418
501
|
| ERROR/FATAL | 1 年 |
|
|
419
502
|
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## 日誌檔案輪替政策
|
|
506
|
+
|
|
507
|
+
### 輪替政策——必須同時設定兩者
|
|
508
|
+
|
|
509
|
+
基於檔案的 log sink 設定**必須**包含以下**兩種**觸發器:
|
|
510
|
+
|
|
511
|
+
1. **時間輪替**(`rollingInterval: Day` 或等效設定)——用於按時間分區
|
|
512
|
+
2. **大小輪替**,且 `rollOnFileSizeLimit: true`(或等效設定)——用於處理流量突增
|
|
513
|
+
|
|
514
|
+
> **為何強制要求:** 大多數日誌函式庫預設有靜默的大小上限。當檔案達到上限,後續的日誌寫入會被**靜默丟棄**——沒有警告、沒有錯誤。應用程式繼續運行,而半天的日誌就此消失。同時明確設定兩種觸發器可避免這個陷阱。
|
|
515
|
+
|
|
516
|
+
### 生產環境的預設上限是危險的
|
|
517
|
+
|
|
518
|
+
| 函式庫 | 預設大小上限 | 達到上限時的行為 |
|
|
519
|
+
|---|---|---|
|
|
520
|
+
| Serilog File sink (.NET) | 1 GB | **靜默停止寫入**(`RollOnFileSizeLimit = false` 為預設值) |
|
|
521
|
+
| log4j RollingFileAppender | 除非設定否則無限制 | 相同——不輪替 = 丟棄 |
|
|
522
|
+
| Python `RotatingFileHandler` | 除非設定 `maxBytes` 否則無限制 | 無限制增長 |
|
|
523
|
+
| Winston `winston-daily-rotate-file` | 除非設定 `maxSize` 否則無限制 | 相同——不輪替 = 丟棄 |
|
|
524
|
+
|
|
525
|
+
若未明確設定基於大小的輪替,即等同接受上述其中一種失敗模式。
|
|
526
|
+
|
|
527
|
+
### 建議的起始值
|
|
528
|
+
|
|
529
|
+
| 參數 | 值 | 理由 |
|
|
530
|
+
|---|---|---|
|
|
531
|
+
| `fileSizeLimitBytes` | 100 MB | 平衡:小到可用編輯器開啟,大到不會過度輪替 |
|
|
532
|
+
| `rollOnFileSizeLimit` | `true` | 達到上限時,建立 `*-001.txt`、`*-002.txt`;**不要**丟棄 |
|
|
533
|
+
| `retainedFileCountLimit` | ≥ N×7,N = 每日最大預期輪替次數 | 避免過早刪除時間窗口內的日誌 |
|
|
534
|
+
|
|
535
|
+
### 各語言設定範例
|
|
536
|
+
|
|
537
|
+
**.NET / Serilog** (`appsettings.json`):
|
|
538
|
+
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"Serilog": {
|
|
542
|
+
"WriteTo": [{
|
|
543
|
+
"Name": "File",
|
|
544
|
+
"Args": {
|
|
545
|
+
"path": "logs/app-.txt",
|
|
546
|
+
"rollingInterval": "Day",
|
|
547
|
+
"fileSizeLimitBytes": 104857600,
|
|
548
|
+
"rollOnFileSizeLimit": true,
|
|
549
|
+
"retainedFileCountLimit": 90
|
|
550
|
+
}
|
|
551
|
+
}]
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
**Python** (`logging.handlers`):
|
|
557
|
+
|
|
558
|
+
```python
|
|
559
|
+
from logging.handlers import RotatingFileHandler
|
|
560
|
+
|
|
561
|
+
handler = RotatingFileHandler(
|
|
562
|
+
filename="logs/app.log",
|
|
563
|
+
maxBytes=104857600, # 100 MB
|
|
564
|
+
backupCount=90 # ~3 個月的輪替,假設低基數
|
|
565
|
+
)
|
|
566
|
+
# 若需要時間+大小的組合輪替,可搭配 TimedRotatingFileHandler 與大小檢查
|
|
567
|
+
# 或使用第三方函式庫如 concurrent-log-handler。
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
**Java / log4j2** (`log4j2.xml`):
|
|
571
|
+
|
|
572
|
+
```xml
|
|
573
|
+
<RollingFile name="App" fileName="logs/app.log"
|
|
574
|
+
filePattern="logs/app-%d{yyyy-MM-dd}-%i.log.gz">
|
|
575
|
+
<PatternLayout pattern="%d %-5p %c{1.} - %m%n"/>
|
|
576
|
+
<Policies>
|
|
577
|
+
<TimeBasedTriggeringPolicy interval="1"/>
|
|
578
|
+
<SizeBasedTriggeringPolicy size="100 MB"/>
|
|
579
|
+
</Policies>
|
|
580
|
+
<DefaultRolloverStrategy max="90"/>
|
|
581
|
+
</RollingFile>
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
**Node / Winston** (`winston-daily-rotate-file`):
|
|
585
|
+
|
|
586
|
+
```javascript
|
|
587
|
+
import DailyRotateFile from "winston-daily-rotate-file";
|
|
588
|
+
|
|
589
|
+
new DailyRotateFile({
|
|
590
|
+
filename: "logs/app-%DATE%.log",
|
|
591
|
+
datePattern: "YYYY-MM-DD",
|
|
592
|
+
maxSize: "100m",
|
|
593
|
+
maxFiles: "90d"
|
|
594
|
+
});
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### 操作 SOP——調查根因,勿只提高上限
|
|
598
|
+
|
|
599
|
+
若日誌檔案大小在預期的每日結束時達到 `fileSizeLimitBytes` 的 ≥ 90%,**在提高上限前先調查原因**。常見根本原因:
|
|
600
|
+
|
|
601
|
+
- 嘈雜的重試迴圈將每次嘗試以 INFO 記錄,而非 WARN 摘要
|
|
602
|
+
- 在正式環境中意外啟用了不受限制的 debug 日誌
|
|
603
|
+
- 一個上游失敗造成 stack trace 洪流
|
|
604
|
+
- 健康探針 / sidecar 污染了業務日誌
|
|
605
|
+
|
|
606
|
+
提高上限只是掩蓋了底層的噪音問題,並將下次中斷推遲。
|
|
607
|
+
|
|
608
|
+
### 失敗模式參考(真實事故)
|
|
609
|
+
|
|
610
|
+
一個正式 .NET Worker 只使用 `rollingInterval: Day`(未設定大小限制,Serilog 預設 1 GB 上限),在 07:31 達到上限,靜默丟棄所有日誌條目直到 13:00+,操作員才注意到 tail 停滯。連續五個每日檔案顯示 `~1,073,741,8XX bytes`(= 1 GiB,Serilog 預設值)。半天的正式診斷資料就此消失。若設定 `fileSizeLimitBytes` + `rollOnFileSizeLimit: true`,就會輪替至 `worker-YYYYMMDD_001.txt` 並保留這些事件。
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
420
614
|
## 快速參考卡
|
|
421
615
|
|
|
422
616
|
### 日誌等級選擇
|
|
@@ -445,6 +639,14 @@ tracestate: vendor=value
|
|
|
445
639
|
- [ ] 永不記錄信用卡
|
|
446
640
|
- [ ] 已設定保留政策
|
|
447
641
|
|
|
642
|
+
### 輪替清單
|
|
643
|
+
|
|
644
|
+
- [ ] 已設定時間輪替(`rollingInterval: Day` 或等效設定)
|
|
645
|
+
- [ ] 已設定大小輪替,且 `rollOnFileSizeLimit: true`(或等效設定)
|
|
646
|
+
- [ ] `fileSizeLimitBytes` 已明確設定(預設上限是危險的)
|
|
647
|
+
- [ ] `retainedFileCountLimit` ≥ N×7 以涵蓋時間窗口內的輪替
|
|
648
|
+
- [ ] 已定義 90% 大小 SOP:調查噪音根因,勿只提高上限
|
|
649
|
+
|
|
448
650
|
---
|
|
449
651
|
|
|
450
652
|
**相關標準:**
|
|
@@ -457,6 +659,8 @@ tracestate: vendor=value
|
|
|
457
659
|
|
|
458
660
|
| 版本 | 日期 | 變更 |
|
|
459
661
|
|-----|------|------|
|
|
662
|
+
| 1.4.0 | 2026-06-17 | 新增:強制事件類目——9 個 canonical「何時必須寫 log」事件(when/must_log/must_NOT_log/level/rationale)、驗證失敗 + heartbeat 場景、compliant startup 範例、follow-on 規則(access log 分離、沉默偵測 SLA、request_id 可發現性)(XSPEC-234 / 關閉 issue #108) |
|
|
663
|
+
| 1.3.0 | 2026-05-26 | 新增:日誌檔案輪替政策——強制雙觸發器(時間 + 大小)輪替及危險預設警告、.NET/Python/Java/Node 各語言設定範例、操作 SOP(XSPEC-232 / 關閉 issue #111) |
|
|
460
664
|
| 1.2.0 | 2026-01-24 | 新增:OpenTelemetry 語義慣例、可觀測性三支柱整合、基於日誌的告警、進階關聯模式 |
|
|
461
665
|
| 1.1.0 | 2026-01-05 | 新增:參考標準章節,包含 OWASP、RFC 5424、OpenTelemetry 和 12 Factor App |
|
|
462
666
|
| 1.0.0 | 2025-12-30 | 初始日誌標準 |
|