universal-dev-standards 5.1.1 → 5.3.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.
Files changed (65) hide show
  1. package/bundled/ai/options/push/single-owner-mode.ai.yaml +60 -0
  2. package/bundled/ai/options/push/team-mode.ai.yaml +64 -0
  3. package/bundled/ai/options/release/publish-mode-github-actions.ai.yaml +65 -0
  4. package/bundled/ai/standards/agent-behavior-discipline.ai.yaml +142 -0
  5. package/bundled/ai/standards/cd-deployment-strategies.ai.yaml +73 -0
  6. package/bundled/ai/standards/no-cicd-deployment.ai.yaml +134 -0
  7. package/bundled/ai/standards/pipeline-security-gates.ai.yaml +71 -0
  8. package/bundled/ai/standards/push-standards.ai.yaml +105 -0
  9. package/bundled/ai/standards/rollback-standards.ai.yaml +68 -0
  10. package/bundled/core/agent-behavior-discipline.md +178 -0
  11. package/bundled/core/cd-deployment-strategies.md +121 -0
  12. package/bundled/core/no-cicd-deployment.md +205 -0
  13. package/bundled/core/pipeline-security-gates.md +109 -0
  14. package/bundled/core/rollback-standards.md +104 -0
  15. package/bundled/core/versioning.md +1 -1
  16. package/bundled/locales/zh-CN/CHANGELOG.md +34 -3
  17. package/bundled/locales/zh-CN/README.md +54 -7
  18. package/bundled/locales/zh-CN/SECURITY.md +8 -0
  19. package/bundled/locales/zh-CN/core/ai-friendly-architecture.md +8 -0
  20. package/bundled/locales/zh-CN/core/workflow-enforcement.md +8 -0
  21. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +8 -0
  22. package/bundled/locales/zh-CN/docs/CLI-FLOW.md +8 -0
  23. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +8 -0
  24. package/bundled/locales/zh-CN/docs/STANDARDS-REFERENCE.md +8 -0
  25. package/bundled/locales/zh-CN/skills/commands/requirement.md +8 -0
  26. package/bundled/locales/zh-CN/skills/commands/reverse-bdd.md +8 -0
  27. package/bundled/locales/zh-CN/skills/commands/reverse-sdd.md +8 -0
  28. package/bundled/locales/zh-CN/skills/commands/reverse-tdd.md +8 -0
  29. package/bundled/locales/zh-CN/skills/commands/reverse.md +8 -0
  30. package/bundled/locales/zh-CN/skills/commands/review.md +8 -0
  31. package/bundled/locales/zh-CN/skills/commands/sdd-retro.md +8 -0
  32. package/bundled/locales/zh-CN/skills/commands/sdd.md +8 -0
  33. package/bundled/locales/zh-CN/skills/commands/tdd.md +8 -0
  34. package/bundled/locales/zh-CN/skills/commands/update.md +8 -0
  35. package/bundled/locales/zh-TW/CHANGELOG.md +34 -3
  36. package/bundled/locales/zh-TW/MAINTENANCE.md +17 -6
  37. package/bundled/locales/zh-TW/README.md +53 -6
  38. package/bundled/locales/zh-TW/SECURITY.md +8 -0
  39. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +1 -1
  40. package/bundled/locales/zh-TW/core/ai-friendly-architecture.md +8 -0
  41. package/bundled/locales/zh-TW/core/anti-hallucination.md +8 -0
  42. package/bundled/locales/zh-TW/core/git-workflow.md +8 -0
  43. package/bundled/locales/zh-TW/core/refactoring-standards.md +8 -0
  44. package/bundled/locales/zh-TW/core/spec-driven-development.md +8 -0
  45. package/bundled/locales/zh-TW/core/structured-task-definition.md +8 -0
  46. package/bundled/locales/zh-TW/core/test-driven-development.md +8 -0
  47. package/bundled/locales/zh-TW/core/versioning.md +1 -1
  48. package/bundled/locales/zh-TW/core/workflow-enforcement.md +8 -0
  49. package/bundled/locales/zh-TW/core/workflow-state-protocol.md +8 -0
  50. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +8 -0
  51. package/bundled/locales/zh-TW/docs/CLI-FLOW.md +8 -0
  52. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +8 -0
  53. package/bundled/locales/zh-TW/docs/MIGRATION-V5.md +8 -0
  54. package/bundled/locales/zh-TW/docs/STANDARDS-REFERENCE.md +8 -0
  55. package/bundled/locales/zh-TW/integrations/claude-code/README.md +8 -0
  56. package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +178 -0
  57. package/bundled/skills/deploy-assistant/SKILL.md +183 -0
  58. package/bundled/skills/push/SKILL.md +203 -0
  59. package/package.json +1 -1
  60. package/src/config/ai-agent-paths.js +0 -1
  61. package/standards-registry.json +71 -4
  62. package/bundled/locales/zh-CN/docs/AI-AGENT-ROADMAP.md +0 -410
  63. package/bundled/locales/zh-CN/docs/OPERATION-WORKFLOW.md +0 -1074
  64. package/bundled/locales/zh-TW/docs/AI-AGENT-ROADMAP.md +0 -410
  65. package/bundled/locales/zh-TW/docs/OPERATION-WORKFLOW.md +0 -1074
@@ -0,0 +1,60 @@
1
+ # Push Option: Single Owner Mode - AI Optimized
2
+ # Parent: push-standards (XSPEC-081)
3
+ # Source: options/push/single-owner-mode.md
4
+
5
+ id: single-owner-mode
6
+ meta:
7
+ parent: push-standards
8
+ version: "1.0.0"
9
+ updated: "2026-04-24"
10
+ source: options/push/single-owner-mode.md
11
+ description: Reduced-friction push mode for personal/solo repositories — removes collaboration guardrails while keeping essential safety checks
12
+
13
+ best_for:
14
+ - Personal repositories with sole ownership
15
+ - Solo open source projects with no external contributors
16
+ - Forked repositories for personal experimentation
17
+
18
+ configuration:
19
+ repo_mode: single-owner
20
+ protected_branches: [main, master, "release/*", "hotfix/*"]
21
+ push_gates:
22
+ default: [lint, test]
23
+ receipt:
24
+ output: console
25
+ auto_pr: false
26
+
27
+ behaviors:
28
+ protected_branch_detection:
29
+ enabled: true
30
+ confirmation_required: false
31
+ action: warning_only
32
+ note: Shows branch name and pending commit count; user proceeds without typing confirmation string
33
+
34
+ force_push_guardrail:
35
+ enabled: true
36
+ confirmation_required: false
37
+ action: warning_only
38
+ shows: commits_count_only
39
+ note: No author breakdown; records force_push=true in receipt
40
+
41
+ pre_push_gates:
42
+ gates: [lint, test]
43
+ execution: sequential
44
+ skip_flag: "--skip-gates"
45
+ skip_records: gates_skipped=true
46
+
47
+ pr_automation:
48
+ enabled: false
49
+ auto_pr: false
50
+ note: No PR prompts after push; use 'gh pr create' manually if needed
51
+
52
+ push_receipt:
53
+ output: console
54
+ fields: [branch, commit_sha, gates_passed, gates_skipped, force_push, timestamp, target_remote]
55
+
56
+ comparison_with_team_mode:
57
+ protected_branch_detection: warning_only # team: full + confirmation required
58
+ force_push_guardrail: warning_only # team: confirmation text required
59
+ pre_push_gates: identical # both: lint + test
60
+ pr_automation: disabled # team: enabled
@@ -0,0 +1,64 @@
1
+ # Push Option: Team Mode - AI Optimized
2
+ # Parent: push-standards (XSPEC-081)
3
+ # Source: options/push/team-mode.md
4
+
5
+ id: team-mode
6
+ meta:
7
+ parent: push-standards
8
+ version: "1.0.0"
9
+ updated: "2026-04-24"
10
+ source: options/push/team-mode.md
11
+ description: Default push mode with full collaboration guardrails for multi-contributor repositories
12
+
13
+ best_for:
14
+ - Team projects with 2+ contributors
15
+ - Open source repositories accepting external contributions
16
+ - Projects using protected branch policies
17
+ - Any repository requiring code review before merge
18
+
19
+ configuration:
20
+ repo_mode: team
21
+ protected_branches: [main, master, "release/*", "hotfix/*"]
22
+ push_gates:
23
+ default: [lint, test]
24
+ receipt:
25
+ output: console
26
+ auto_pr: true
27
+
28
+ behaviors:
29
+ protected_branch_detection:
30
+ enabled: true
31
+ confirmation_required: true
32
+ action: full_guardrail
33
+ note: Displays warning banner; user must explicitly confirm before proceeding
34
+
35
+ force_push_guardrail:
36
+ enabled: true
37
+ confirmation_required: true
38
+ confirmation_text: "yes, force push"
39
+ shows: [commits_count, authors]
40
+ note: User must type confirmation string; records force_push=true in receipt
41
+
42
+ pre_push_gates:
43
+ gates: [lint, test]
44
+ execution: sequential
45
+ failure_message: includes_suggested_fix
46
+ skip_flag: "--skip-gates"
47
+ skip_records: gates_skipped=true
48
+
49
+ pr_automation:
50
+ enabled: true
51
+ trigger: push_to_non_protected_branch
52
+ checks_existing_pr: true
53
+ no_pr_action: prompt_pr_automation_assistant
54
+ skip_flag: "--no-pr"
55
+
56
+ push_receipt:
57
+ output: console
58
+ fields: [branch, commit_sha, gates_passed, gates_skipped, force_push, timestamp, target_remote]
59
+
60
+ comparison_with_single_owner_mode:
61
+ protected_branch_detection: full_confirmation_required # single-owner: warning only
62
+ force_push_guardrail: confirmation_text_required # single-owner: warning only
63
+ pre_push_gates: identical # both: lint + test
64
+ pr_automation: enabled # single-owner: disabled
@@ -0,0 +1,65 @@
1
+ # Release Option: GitHub Actions Publish Mode - AI Optimized
2
+ # Parent: release-standards
3
+ # Source: options/release/publish-mode-github-actions.md
4
+
5
+ id: publish-mode-github-actions
6
+ meta:
7
+ parent: release-standards
8
+ version: "1.0.0"
9
+ updated: "2026-04-24"
10
+ source: options/release/publish-mode-github-actions.md
11
+ description: CD publish pattern for npm packages — publish is triggered automatically by GitHub Release, not by manual `npm publish`
12
+
13
+ best_for:
14
+ - npm packages hosted in GitHub repositories
15
+ - Projects with GitHub Actions publish workflow (publish.yml or similar)
16
+ - Single-owner or small-team repos using GitHub Actions CD
17
+ - Projects where NPM_TOKEN is stored as a GitHub Actions secret
18
+
19
+ configuration:
20
+ publish_mode: github-actions
21
+ publish_trigger: gh_release_create
22
+ publish_command: none # npm publish is handled by GitHub Actions
23
+ tag_format: "v{semver}"
24
+
25
+ behaviors:
26
+ release_finish_sequence:
27
+ steps:
28
+ - bump_version # scripts/bump-version.sh or npm version
29
+ - update_changelog # add [X.Y.Z] section, remove from [Unreleased]
30
+ - commit_and_tag # git commit + git tag vX.Y.Z
31
+ - push_with_tag # git push origin main vX.Y.Z
32
+ - create_gh_release # gh release create vX.Y.Z --title "vX.Y.Z" --notes "..."
33
+ note: >
34
+ DO NOT run `npm publish` manually. The `gh release create` command triggers
35
+ the publish workflow via `release: published` event. GitHub Actions handles
36
+ the actual npm publish using NPM_TOKEN stored as a repository secret.
37
+
38
+ gh_release_create:
39
+ command: 'gh release create v{version} --title "v{version}" --notes "{changelog_entry}"'
40
+ triggers: publish_workflow
41
+ publishes_to_npm_tag:
42
+ stable: latest # versions without pre-release suffix (e.g. 5.2.0)
43
+ prerelease: next # versions with beta/alpha/rc suffix (e.g. 5.2.0-beta.1)
44
+
45
+ publish_workflow:
46
+ trigger_event: "release: published"
47
+ secret_required: NPM_TOKEN
48
+ runs_on: github_actions
49
+ note: >
50
+ Workflow file is typically `.github/workflows/publish.yml`.
51
+ It runs `npm publish` with `NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}`.
52
+
53
+ local_verification:
54
+ before_release:
55
+ - run_tests # npm test / vitest
56
+ - verify_build # npm run build (if applicable)
57
+ - check_version # confirm package.json version matches intended tag
58
+ note: All local gates must pass before `gh release create`
59
+
60
+ comparison_with_manual_mode:
61
+ publish_command: "not run locally" # manual: npm publish
62
+ publish_trigger: gh_release_create # manual: direct npm publish
63
+ npm_token_location: github_secret # manual: local .npmrc or env var
64
+ audit_trail: github_actions_log # manual: none (local terminal)
65
+ reproducibility: full_ci_isolation # manual: depends on local environment
@@ -0,0 +1,142 @@
1
+ # Agent Behavior Discipline Standards - AI Optimized
2
+ # Source: core/agent-behavior-discipline.md
3
+ # Inspired by: Karpathy X post 2026-01 + andrej-karpathy-skills CLAUDE.md (MIT)
4
+
5
+ id: agent-behavior-discipline
6
+ meta:
7
+ version: "1.0.0"
8
+ updated: "2026-04-24"
9
+ source: core/agent-behavior-discipline.md
10
+ description: Four behavioral disciplines for AI agents to elevate from functional to excellent — Ask, Simple, Precision, Test
11
+ related:
12
+ - anti-hallucination
13
+ - anti-sycophancy-prompting
14
+ - test-driven-development
15
+ - change-batching-standards
16
+
17
+ principles:
18
+ ask:
19
+ summary: Surface assumptions before executing, not after
20
+ rule: Before any non-trivial task, explicitly state assumptions and wait for confirmation
21
+ triggers:
22
+ - Task has ambiguous requirements or multiple valid interpretations
23
+ - Confidence score < 0.7 (see epistemic-calibration)
24
+ - Task involves architecture changes, refactors, or multi-file modifications
25
+ do:
26
+ - State all assumptions explicitly before starting
27
+ - Present multiple interpretations when the prompt is ambiguous
28
+ - Propose simpler alternatives and challenge requests when appropriate
29
+ - Name confusion explicitly instead of proceeding with a guess
30
+ - Push back when a simpler path exists
31
+ do_not:
32
+ - Assume silently and proceed
33
+ - Use "I understand you want..." phrasing to paper over ambiguity
34
+ - Start executing to demonstrate effort before confirming direction
35
+ disclosure_format: |
36
+ My assumptions: [list]
37
+ Approach considered: [A] vs [B] — choosing A because [reason]
38
+ If my understanding is incorrect, please redirect before I proceed.
39
+
40
+ simple:
41
+ summary: Minimum code that solves the problem, nothing speculative
42
+ rule: Solve with the least code required. Never add unrequested functionality.
43
+ triggers:
44
+ - Any code generation task
45
+ do:
46
+ - Write only what the task requires
47
+ - Rewrite if the solution could be significantly shorter without loss of clarity
48
+ - Inline logic that is only used once (no premature abstraction)
49
+ do_not:
50
+ - Add features "that might be needed later"
51
+ - Create single-use abstractions or helper classes
52
+ - Add speculative flexibility or configuration hooks nobody asked for
53
+ - Add error handling for scenarios that cannot happen
54
+ three_strikes_rule: Abstract only when the same logic appears 3+ times (DRY threshold)
55
+
56
+ precision:
57
+ summary: Touch only what the task requires — clean up only your own mess
58
+ rule: Scope modifications to the minimum set of files and lines required
59
+ triggers:
60
+ - Any edit or refactor task
61
+ do:
62
+ - Declare scope before editing ("I will modify: X. I will not touch: Y.")
63
+ - Match the local code style rather than enforcing personal preferences
64
+ - Flag pre-existing issues found out-of-scope with a verbal note only
65
+ do_not:
66
+ - Improve unrelated code, formatting, or comments while on a scoped task
67
+ - Remove pre-existing dead code outside task scope
68
+ - Rename symbols not involved in the current change
69
+ - Remove imports or variables orphaned by someone else's previous change
70
+ scope_declaration_format: |
71
+ Modifying: [file list]
72
+ Not touching: [related but out-of-scope areas]
73
+ Out-of-scope observation (action deferred): [optional]
74
+
75
+ test:
76
+ summary: Define verifiable success criteria before executing; loop until verified
77
+ rule: Transform every task into a measurable success criterion before implementation
78
+ triggers:
79
+ - Any implementation or bug-fix task
80
+ - Long-running autonomous agent loops
81
+ do:
82
+ - Ask for or define quantifiable success criteria before starting
83
+ - Write a failing test first (TDD red phase), then implement, then refactor
84
+ - State multi-step plans with explicit verification checkpoints
85
+ - Loop autonomously toward the verified goal, recording each iteration's failureSource
86
+ do_not:
87
+ - Accept subjective criteria ("make it better", "improve search quality")
88
+ - Proceed without a stopping condition for autonomous loops
89
+ - Report completion without demonstrating the success criterion was met
90
+ vague_criteria_escalation: |
91
+ If the task uses subjective success language, ask:
92
+ "What specific metric or observable outcome defines success here?"
93
+ loop_protocol:
94
+ max_retries: 5
95
+ on_stuck: escalate to human with failureSource summary
96
+ record: failureSource per iteration (see failure-source-taxonomy)
97
+
98
+ prohibited_behaviors:
99
+ - id: silent-assumption
100
+ description: Do NOT make assumptions about ambiguous requirements without stating them
101
+ correct_action: Use ask.disclosure_format before proceeding
102
+
103
+ - id: speculative-feature
104
+ description: Do NOT implement features that were not explicitly requested
105
+ correct_action: Implement only the requested scope; mention potential extensions verbally
106
+
107
+ - id: scope-creep
108
+ description: Do NOT modify code outside the declared scope of the task
109
+ correct_action: Use precision.scope_declaration_format and flag out-of-scope observations verbally
110
+
111
+ - id: subjective-success
112
+ description: Do NOT accept vague success criteria ("better", "improved", "successful")
113
+ correct_action: Use test.vague_criteria_escalation to obtain a quantifiable criterion
114
+
115
+ - id: open-ended-loop
116
+ description: Do NOT run autonomous correction loops without a defined stopping condition
117
+ correct_action: Define max_retries and escalation path before starting the loop
118
+
119
+ agent_application:
120
+ implementation_tasks:
121
+ apply: [ask, simple, precision, test]
122
+ notes: All four principles apply to every non-trivial implementation task
123
+ refactoring_tasks:
124
+ apply: [ask, precision, test]
125
+ notes: Simplicity is a refactor outcome, not a separate check; Precision is critical
126
+ bug_fix_tasks:
127
+ apply: [ask, precision, test]
128
+ notes: Ask to confirm reproduction steps; Precision to avoid scope creep; Test to define "fixed"
129
+ autonomous_loops:
130
+ apply: [test]
131
+ notes: test.loop_protocol is mandatory for any multi-iteration autonomous agent task
132
+ trivial_tasks:
133
+ apply: []
134
+ threshold: confidence >= 0.9 AND task is single-file AND lines_changed < 5
135
+ notes: Trivial tasks (e.g., adding a comment) may skip ask confirmation
136
+
137
+ checklist:
138
+ - Assumptions stated before execution starts
139
+ - Code solves the problem with minimum required lines
140
+ - Only declared-scope files were modified
141
+ - Success criterion is quantifiable and verified
142
+ - Autonomous loops have max_retries and escalation path defined
@@ -0,0 +1,73 @@
1
+ # CD Deployment Strategies (AI-Optimized v1)
2
+ # Source: core/cd-deployment-strategies.md
3
+
4
+ standard:
5
+ id: cd-deployment-strategies
6
+ name: CD Deployment Strategies
7
+ description: Strategy selection matrix for blue-green, canary, rolling, and recreate deployments
8
+ guidelines:
9
+ - "Choose strategy based on: traffic volume × risk tolerance × infrastructure cost"
10
+ - "High traffic + low risk tolerance → blue-green (instant rollback)"
11
+ - "Medium traffic + medium risk → canary (progressive validation)"
12
+ - "Low traffic + low risk → rolling (resource efficient)"
13
+ - "Dev/internal only → recreate (simplest, acceptable downtime)"
14
+ - "Never deploy directly to production without staging validation"
15
+
16
+ meta:
17
+ version: "1.0.0"
18
+ updated: "2026-04-26"
19
+ source: core/cd-deployment-strategies.md
20
+ parent: deployment-standards.ai.yaml
21
+
22
+ strategy_matrix:
23
+ blue_green:
24
+ traffic: high
25
+ risk_tolerance: low
26
+ infrastructure_cost: high
27
+ downtime: zero
28
+ rollback_time: "<30s"
29
+ use_cases: ["stateful services", "database-compatible changes", "high-SLA APIs"]
30
+ prerequisites: ["dual environment", "load balancer", "health checks"]
31
+ canary:
32
+ traffic: medium_to_high
33
+ risk_tolerance: medium
34
+ infrastructure_cost: medium
35
+ downtime: zero
36
+ rollback_time: "<2min"
37
+ use_cases: ["feature validation", "A/B testing", "high-risk changes"]
38
+ traffic_stages: ["1%", "5%", "25%", "50%", "100%"]
39
+ prerequisites: ["traffic splitting", "observability", "auto-promotion rules"]
40
+ rolling:
41
+ traffic: any
42
+ risk_tolerance: medium
43
+ infrastructure_cost: low
44
+ downtime: minimal
45
+ rollback_time: "minutes"
46
+ use_cases: ["stateless services", "standard updates", "batch workers"]
47
+ prerequisites: ["multiple instances", "health checks"]
48
+ recreate:
49
+ traffic: low
50
+ risk_tolerance: high
51
+ infrastructure_cost: minimal
52
+ downtime: "seconds to minutes"
53
+ rollback_time: "minutes"
54
+ use_cases: ["dev/staging", "internal tools", "single-instance services"]
55
+ prerequisites: ["none"]
56
+
57
+ decision_tree:
58
+ step_1: "Is zero-downtime required? No → recreate; Yes → continue"
59
+ step_2: "Is traffic > 10k req/min? Yes → blue-green or canary; No → rolling"
60
+ step_3: "Is change high-risk? Yes → canary; No → blue-green or rolling"
61
+ step_4: "Is infrastructure budget constrained? Yes → rolling; No → blue-green"
62
+
63
+ no_cicd_compatibility:
64
+ blue_green: "See no-cicd-deployment.ai.yaml for script-based implementation"
65
+ canary: "Requires Nginx split_clients or HAProxy for script-based canary"
66
+ rolling: "Achievable with sequential rsync + health check loop"
67
+ recreate: "Simplest — stop, deploy, start"
68
+
69
+ physical_spec:
70
+ type: custom_script
71
+ validator:
72
+ command: "grep -r 'deployment_strategy\\|deploy.*strategy' . --include='*.yaml' --include='*.json' -l 2>/dev/null | head -1"
73
+ rule: "deployment_strategy_documented"
@@ -0,0 +1,134 @@
1
+ # No-CI/CD Deployment Strategy (AI-Optimized v1)
2
+ # Source: core/no-cicd-deployment.md
3
+
4
+ standard:
5
+ id: no-cicd-deployment
6
+ name: No-CI/CD Deployment Strategy
7
+ description: Reliable deployment without CI/CD platforms using shell scripts, smoke tests, Blue-Green switching, and deploy.lock protection
8
+ guidelines:
9
+ - "Use set -euo pipefail in all deploy scripts — fail fast, stop on first error"
10
+ - "Always verify deployment after completion — check version endpoint, never assume success"
11
+ - "Maintain Blue-Green slots for instant rollback — recovery time must be <30 seconds"
12
+ - "Enforce deploy.lock to prevent concurrent deployments"
13
+ - "Only deploy commits with semantic version tags — no untagged HEAD deployments"
14
+ - "Log every deployment with timestamp, version, operator, and result (JSON Lines)"
15
+
16
+ meta:
17
+ version: "1.0.0"
18
+ updated: "2026-04-26"
19
+ source: core/no-cicd-deployment.md
20
+ description: Reliable deployment strategy for environments without CI/CD platforms
21
+ complements: deployment-standards.ai.yaml
22
+
23
+ principles:
24
+ core:
25
+ - fail_fast: "set -euo pipefail stops execution at first failure — no silent partial deploys"
26
+ - verify_always: "Post-deploy smoke test is mandatory, not optional"
27
+ - instant_recovery: "Blue-Green rollback must complete in <30 seconds"
28
+ - concurrent_protection: "deploy.lock prevents race conditions from simultaneous deployments"
29
+ - version_discipline: "Only semver-tagged commits are deployable"
30
+ - audit_trail: "Every deploy produces a machine-readable log entry"
31
+
32
+ architecture:
33
+ three_layer:
34
+ layer_1_prevent:
35
+ name: "Prevent Wrong Deployments"
36
+ mechanisms:
37
+ - "set -euo pipefail in deploy.sh"
38
+ - "Mandatory test pass before deploy"
39
+ - "Semver tag enforcement"
40
+ - "deploy.lock concurrency guard"
41
+ layer_2_verify:
42
+ name: "Verify Deployment Correctness"
43
+ mechanisms:
44
+ - "HTTP /health endpoint check"
45
+ - "Version number comparison with VERSION file"
46
+ - "Auto-rollback on verification failure"
47
+ layer_3_recover:
48
+ name: "Fast Recovery Capability"
49
+ mechanisms:
50
+ - "Blue-Green slot switching"
51
+ - "Nginx upstream pointer swap"
52
+ - "Single-command rollback.sh"
53
+
54
+ deploy_script:
55
+ required_header: "#!/usr/bin/env bash\nset -euo pipefail"
56
+ mandatory_steps:
57
+ - step: test
58
+ order: 1
59
+ description: "Run full test suite before any deployment"
60
+ - step: build
61
+ order: 2
62
+ description: "Produce deployment artifact"
63
+ - step: deploy
64
+ order: 3
65
+ description: "Transfer artifact to target server"
66
+ - step: verify
67
+ order: 4
68
+ description: "Run smoke test; auto-rollback on failure"
69
+ lock_pattern:
70
+ file: "/tmp/deploy.lock"
71
+ create: "echo $$ > $LOCK_FILE"
72
+ cleanup: "trap 'rm -f $LOCK_FILE' EXIT"
73
+ check: "[ -f $LOCK_FILE ] && echo 'Deploy in progress' && exit 1"
74
+ version_enforcement:
75
+ command: "git describe --exact-match --tags HEAD"
76
+ format: "v[0-9]+\\.[0-9]+\\.[0-9]+"
77
+ failure_message: "No semver tag on HEAD — tag before deploying"
78
+
79
+ smoke_test:
80
+ endpoint: "/health"
81
+ required_fields:
82
+ - field: "version"
83
+ source: "VERSION file"
84
+ comparison: "exact match"
85
+ - field: "status"
86
+ expected: "ok"
87
+ failure_action: "auto_rollback"
88
+ timeout_seconds: 30
89
+
90
+ blue_green:
91
+ slots:
92
+ - name: blue
93
+ port: 3001
94
+ state: "active (stable)"
95
+ - name: green
96
+ port: 3002
97
+ state: "inactive (staging)"
98
+ switch_mechanism: "nginx upstream pointer"
99
+ rollback_time_sla: "30 seconds"
100
+ rollback_command: "./rollback.sh"
101
+
102
+ deployment_log:
103
+ format: "JSON Lines"
104
+ required_fields:
105
+ - "timestamp (ISO 8601)"
106
+ - "version"
107
+ - "git_commit"
108
+ - "operator (whoami)"
109
+ - "result (success|failure)"
110
+ - "duration_seconds"
111
+ location: "/var/log/deployments.jsonl"
112
+
113
+ checklist:
114
+ pre_deploy:
115
+ - "Tests pass"
116
+ - "Artifact built successfully"
117
+ - "No deploy.lock present"
118
+ - "HEAD has semver tag"
119
+ - "Previous deployment log reviewed"
120
+ post_deploy:
121
+ - "Health check HTTP 200"
122
+ - "Version matches expected"
123
+ - "Service responds to basic requests"
124
+ - "Deployment log entry written"
125
+ rollback_readiness:
126
+ - "Blue slot running previous stable version"
127
+ - "rollback.sh tested and functional"
128
+ - "Nginx upstream reload works"
129
+
130
+ physical_spec:
131
+ type: custom_script
132
+ validator:
133
+ command: "test -f deploy.sh && grep -q 'set -euo pipefail' deploy.sh && test -f rollback.sh && test -f verify.sh"
134
+ rule: "no_cicd_deployment_scripts_configured"
@@ -0,0 +1,71 @@
1
+ # Pipeline Security Gates (AI-Optimized v1)
2
+ # Source: core/pipeline-security-gates.md
3
+
4
+ standard:
5
+ id: pipeline-security-gates
6
+ name: Pipeline Security Gates
7
+ description: Security checkpoints embedded in CI pipeline — SAST, DAST, SCA, secrets scan with block/warn/log behavior
8
+ guidelines:
9
+ - "Secrets scan at pre-commit — block ALL commits containing secrets"
10
+ - "SAST after build — block Critical/High findings"
11
+ - "SCA + SBOM generation at package stage"
12
+ - "DAST after staging deploy — warn on findings, require approval for Critical"
13
+ - "Never skip security gates with --force or emergency bypass without audit trail"
14
+ - "Treat security gate failures as pipeline failures, not warnings"
15
+
16
+ meta:
17
+ version: "1.0.0"
18
+ updated: "2026-04-26"
19
+ source: core/pipeline-security-gates.md
20
+ complements: security-standards.ai.yaml
21
+
22
+ gate_positions:
23
+ pre_commit:
24
+ type: secrets_scan
25
+ tools: ["gitleaks", "trufflehog", "detect-secrets"]
26
+ scope: "staged files"
27
+ block_on: ["any secret pattern match"]
28
+ never_skip: true
29
+ post_build:
30
+ type: sast
31
+ tools: ["semgrep", "codeql", "sonarqube"]
32
+ scope: "source code + build output"
33
+ block_on: ["Critical", "High"]
34
+ warn_on: ["Medium"]
35
+ log_only: ["Low", "Info"]
36
+ post_staging_deploy:
37
+ type: dast
38
+ tools: ["zap", "nuclei", "burpsuite-enterprise"]
39
+ scope: "running staging application"
40
+ block_on: ["Critical"]
41
+ require_approval: ["High"]
42
+ warn_on: ["Medium"]
43
+ package_stage:
44
+ type: sca_and_sbom
45
+ tools: ["trivy", "syft", "grype", "dependabot"]
46
+ scope: "dependencies + container image"
47
+ block_on: ["Critical CVE with fix available"]
48
+ warn_on: ["High CVE", "outdated dependencies"]
49
+ sbom_format: ["spdx", "cyclonedx"]
50
+
51
+ bypass_policy:
52
+ allowed: false
53
+ exception_process: "written security approval + audit log entry"
54
+ emergency_bypass: "time-limited token + mandatory post-incident review"
55
+
56
+ failure_behavior:
57
+ Critical: {action: "block pipeline", notify: "security-team", sla: "immediate"}
58
+ High: {action: "block pipeline", notify: "team-lead", sla: "same-day"}
59
+ Medium: {action: "warn + require approval", notify: "developer", sla: "next-sprint"}
60
+ Low: {action: "log only", notify: "none", sla: "backlog"}
61
+
62
+ integration_points:
63
+ secrets_vault: "Integrate with HashiCorp Vault or AWS Secrets Manager for secrets injection"
64
+ sbom_registry: "Upload SBOM to dependency-track or grype-db for continuous monitoring"
65
+ incident_response: "Critical findings automatically create incident tickets"
66
+
67
+ physical_spec:
68
+ type: custom_script
69
+ validator:
70
+ command: "grep -r 'secrets\\|sast\\|sca\\|dast' .github/workflows/ .gitlab-ci.yml Jenkinsfile 2>/dev/null | head -1 || echo 'no-ci-pipeline'"
71
+ rule: "security_gates_in_pipeline"