universal-dev-standards 5.2.0 → 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.
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: deploy
3
+ source: ../../../../skills/deploy-assistant/SKILL.md
4
+ source_version: 1.0.0
5
+ translation_version: 1.0.0
6
+ last_synced: 2026-04-26
7
+ status: current
8
+ description: "[UDS] 引導無 CI/CD 平台下的可靠部署 — 生成 deploy.sh、verify.sh、rollback.sh、Makefile"
9
+ allowed-tools: Read, Bash(cat VERSION:*), Bash(git describe:*), Bash(which nginx:*), Bash(which rsync:*)
10
+ argument-hint: "[project type | 專案類型: node/python/docker/go]"
11
+ ---
12
+
13
+ # 無 CI/CD 部署助手
14
+
15
+ > **語言**: [English](../../../../skills/deploy-assistant/SKILL.md) | 繁體中文
16
+
17
+ 在沒有 GitHub Actions 或 GitLab CI 的環境中,引導建立可靠的部署腳本組。採用三層架構:防錯、驗證、回復。
18
+
19
+ ## 三層部署架構
20
+
21
+ ```
22
+ Layer 1: 防止錯誤部署
23
+ └─ set -euo pipefail + 版本 tag 強制 + deploy.lock
24
+
25
+ Layer 2: 驗證部署正確
26
+ └─ Smoke Test + /health 端點 + 版本號比對 + 自動 rollback
27
+
28
+ Layer 3: 快速回復能力
29
+ └─ Blue-Green 切換(Nginx)+ rollback.sh(< 30 秒)
30
+ ```
31
+
32
+ ## 引導式問答
33
+
34
+ Skill 啟動後,AI 助手應詢問:
35
+
36
+ | 問題 | 選項 | 影響 |
37
+ |------|------|------|
38
+ | 專案類型 | node / python / go / docker | 建置命令 |
39
+ | 部署目標 | SSH+rsync / Docker Compose | 傳輸方式 |
40
+ | 是否支援 Blue-Green | yes / no | 生成 rollback.sh |
41
+ | 健康檢查 URL | 輸入 URL | verify.sh 目標 |
42
+ | 版本來源 | VERSION 檔案 / package.json / git tag | 版本比對邏輯 |
43
+
44
+ ## 生成的腳本組
45
+
46
+ ### deploy.sh(主部署腳本)
47
+
48
+ ```bash
49
+ #!/usr/bin/env bash
50
+ set -euo pipefail
51
+
52
+ LOCK_FILE="/tmp/deploy.lock"
53
+ trap "rm -f $LOCK_FILE" EXIT
54
+
55
+ # 防並發
56
+ if [ -f "$LOCK_FILE" ]; then
57
+ echo "❌ 部署進行中(PID: $(cat $LOCK_FILE))"
58
+ exit 1
59
+ fi
60
+ echo $$ > "$LOCK_FILE"
61
+
62
+ # 版本 tag 強制
63
+ CURRENT_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "")
64
+ if [ -z "$CURRENT_TAG" ]; then
65
+ echo "❌ 請先建立版本 tag:git tag vX.Y.Z && git push --tags"
66
+ exit 1
67
+ fi
68
+
69
+ echo "[1/4] 執行測試..."
70
+ # {TEST_COMMAND}
71
+
72
+ echo "[2/4] 建置產物..."
73
+ # {BUILD_COMMAND}
74
+
75
+ echo "[3/4] 推送到伺服器..."
76
+ rsync -avz --delete ./dist/ {USER}@{SERVER}:/app/
77
+
78
+ echo "[4/4] 驗證部署..."
79
+ ./verify.sh || { echo "驗證失敗,執行 rollback..."; ./rollback.sh; exit 1; }
80
+
81
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"version\":\"$CURRENT_TAG\",\"operator\":\"$(whoami)\",\"result\":\"success\"}" >> /var/log/deployments.jsonl
82
+ echo "✅ 部署成功:$CURRENT_TAG"
83
+ ```
84
+
85
+ ### verify.sh(Smoke Test)
86
+
87
+ ```bash
88
+ #!/usr/bin/env bash
89
+ set -euo pipefail
90
+
91
+ HEALTH_URL="${HEALTH_URL:-{HEALTH_URL}}"
92
+ EXPECTED_VERSION=$(cat VERSION)
93
+
94
+ for i in $(seq 1 3); do
95
+ RESPONSE=$(curl -sf --max-time 10 "$HEALTH_URL" 2>/dev/null) && break
96
+ echo "健康檢查嘗試 $i/3 失敗,等待 5s..."
97
+ sleep 5
98
+ done
99
+
100
+ ACTUAL_VERSION=$(echo "$RESPONSE" | python3 -c "import json,sys; print(json.load(sys.stdin)['version'])")
101
+
102
+ if [ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]; then
103
+ echo "❌ 版本不符!預期 $EXPECTED_VERSION,實際 $ACTUAL_VERSION"
104
+ exit 1
105
+ fi
106
+
107
+ echo "✅ 版本驗證通過:$ACTUAL_VERSION"
108
+ ```
109
+
110
+ ### rollback.sh(Blue-Green 回滾)
111
+
112
+ ```bash
113
+ #!/usr/bin/env bash
114
+ set -euo pipefail
115
+
116
+ CURRENT=$(readlink /app/current 2>/dev/null || echo "/app/blue")
117
+ TARGET=$([[ "$CURRENT" == *"green"* ]] && echo "/app/blue" || echo "/app/green")
118
+
119
+ ln -sfn "$TARGET" /app/current
120
+ nginx -s reload
121
+
122
+ echo "✅ 已切回 $TARGET($(date -u +%Y-%m-%dT%H:%M:%SZ))"
123
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"rollback\",\"from\":\"$CURRENT\",\"to\":\"$TARGET\",\"operator\":\"$(whoami)\"}" >> /var/log/deployments.jsonl
124
+ ```
125
+
126
+ ### Makefile
127
+
128
+ ```makefile
129
+ .PHONY: deploy rollback verify status
130
+
131
+ deploy:
132
+ @./deploy.sh
133
+
134
+ rollback:
135
+ @./rollback.sh
136
+
137
+ verify:
138
+ @./verify.sh
139
+
140
+ status:
141
+ @echo "Current slot: $$(readlink /app/current 2>/dev/null || echo 'N/A')"
142
+ @curl -s $${HEALTH_URL:-http://localhost/health} | python3 -m json.tool 2>/dev/null || echo "Health check failed"
143
+ ```
144
+
145
+ ## 使用方式
146
+
147
+ ```bash
148
+ /deploy # 互動式引導,自動偵測專案類型
149
+ /deploy node # 指定 Node.js 專案直接生成
150
+ /deploy docker # Docker Compose 部署模式
151
+ /deploy --verify-only # 只生成 verify.sh
152
+ ```
153
+
154
+ ## 輸出確認清單
155
+
156
+ 生成後,AI 助手必須確認:
157
+
158
+ - [ ] `deploy.sh` 包含 `set -euo pipefail`
159
+ - [ ] `deploy.sh` 包含 deploy.lock 防並發邏輯
160
+ - [ ] `verify.sh` 比對版本號(不只檢查 HTTP 200)
161
+ - [ ] `rollback.sh` 在驗證失敗時自動觸發
162
+ - [ ] `Makefile` 提供 `make deploy / make rollback / make status`
163
+
164
+ ## 下一步引導
165
+
166
+ `/deploy` 完成後,AI 助手應建議:
167
+
168
+ > **部署腳本已生成。建議下一步:**
169
+ > - `chmod +x deploy.sh verify.sh rollback.sh` — 設定執行權限
170
+ > - `make verify` — 測試健康檢查設定
171
+ > - `git tag v1.0.0 && git push --tags` — 建立版本 tag
172
+ > - `make deploy` — 執行第一次部署
173
+
174
+ ## 參考
175
+
176
+ - 核心標準:[no-cicd-deployment.md](../../../../core/no-cicd-deployment.md)
177
+ - 核心標準:[deployment-standards.md](../../../../core/deployment-standards.md)
178
+ - 相關 Skill:[ci-cd-assistant](../../skills/ci-cd-assistant/SKILL.md) — 有 CI/CD 平台的場景
@@ -0,0 +1,183 @@
1
+ ---
2
+ name: deploy
3
+ scope: universal
4
+ description: |
5
+ Guide reliable deployments without CI/CD platforms (GitHub Actions / GitLab CI).
6
+ Use when: deploying to VPS, air-gapped servers, or environments without CI/CD infrastructure.
7
+ Keywords: deployment, no-cicd, shell script, blue-green, smoke test, rollback, 無CI/CD, 部署.
8
+ allowed-tools: Read, Bash(cat VERSION:*), Bash(git describe:*), Bash(which nginx:*), Bash(which rsync:*)
9
+ argument-hint: "[project type | 專案類型: node/python/docker/go]"
10
+ ---
11
+
12
+ # No-CI/CD Deploy Assistant | 無 CI/CD 部署助手
13
+
14
+ > **Language**: English | [繁體中文](../../locales/zh-TW/skills/deploy-assistant/SKILL.md)
15
+
16
+ Guide reliable deployments in environments without GitHub Actions or GitLab CI, using a three-layer architecture: prevent errors, verify correctness, recover fast.
17
+
18
+ 引導無 CI/CD 平台環境下的可靠部署,採用三層架構:防錯、驗證、快速回復。
19
+
20
+ ## Three-Layer Architecture | 三層部署架構
21
+
22
+ ```
23
+ Layer 1: Prevent Wrong Deployments Layer 2: Verify Correctness Layer 3: Fast Recovery
24
+ set -euo pipefail Smoke Test + /health Blue-Green switching
25
+ Version tag enforcement Version number comparison rollback.sh < 30s
26
+ deploy.lock concurrency guard Auto-rollback on failure
27
+ ```
28
+
29
+ ## Interactive Questionnaire | 引導式問答
30
+
31
+ | Question | Options | Impact |
32
+ |----------|---------|--------|
33
+ | Project type | node / python / go / docker | Build command |
34
+ | Deploy target | SSH+rsync / Docker Compose | Transfer method |
35
+ | Blue-Green support | yes / no | rollback.sh generation |
36
+ | Health check URL | URL input | verify.sh target |
37
+ | Version source | VERSION file / package.json / git tag | Version comparison logic |
38
+
39
+ ## Generated Script Set | 生成的腳本組
40
+
41
+ ### deploy.sh — Main Deploy Script
42
+
43
+ ```bash
44
+ #!/usr/bin/env bash
45
+ set -euo pipefail
46
+
47
+ LOCK_FILE="/tmp/deploy.lock"
48
+ trap "rm -f $LOCK_FILE" EXIT
49
+
50
+ # Concurrency guard | 防並發
51
+ if [ -f "$LOCK_FILE" ]; then
52
+ echo "❌ Deploy in progress (PID: $(cat $LOCK_FILE))"
53
+ exit 1
54
+ fi
55
+ echo $$ > "$LOCK_FILE"
56
+
57
+ # Version tag enforcement | 版本 tag 強制
58
+ CURRENT_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null || echo "")
59
+ if [ -z "$CURRENT_TAG" ]; then
60
+ echo "❌ No version tag on HEAD. Run: git tag vX.Y.Z && git push --tags"
61
+ exit 1
62
+ fi
63
+
64
+ echo "[1/4] Running tests..."
65
+ # {TEST_COMMAND}
66
+
67
+ echo "[2/4] Building artifact..."
68
+ # {BUILD_COMMAND}
69
+
70
+ echo "[3/4] Syncing to server..."
71
+ rsync -avz --delete ./dist/ {USER}@{SERVER}:/app/
72
+
73
+ echo "[4/4] Verifying deployment..."
74
+ ./verify.sh || { echo "Verification failed, rolling back..."; ./rollback.sh; exit 1; }
75
+
76
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"version\":\"$CURRENT_TAG\",\"operator\":\"$(whoami)\",\"result\":\"success\"}" >> /var/log/deployments.jsonl
77
+ echo "✅ Deploy successful: $CURRENT_TAG"
78
+ ```
79
+
80
+ ### verify.sh — Smoke Test
81
+
82
+ ```bash
83
+ #!/usr/bin/env bash
84
+ set -euo pipefail
85
+
86
+ HEALTH_URL="${HEALTH_URL:-{HEALTH_URL}}"
87
+ EXPECTED_VERSION=$(cat VERSION)
88
+
89
+ for i in $(seq 1 3); do
90
+ RESPONSE=$(curl -sf --max-time 10 "$HEALTH_URL" 2>/dev/null) && break
91
+ echo "Health check attempt $i/3 failed, retrying in 5s..."
92
+ sleep 5
93
+ done
94
+
95
+ ACTUAL_VERSION=$(echo "$RESPONSE" | python3 -c "import json,sys; print(json.load(sys.stdin)['version'])")
96
+
97
+ if [ "$ACTUAL_VERSION" != "$EXPECTED_VERSION" ]; then
98
+ echo "❌ Version mismatch! Expected $EXPECTED_VERSION, got $ACTUAL_VERSION"
99
+ exit 1
100
+ fi
101
+
102
+ echo "✅ Version verified: $ACTUAL_VERSION"
103
+ ```
104
+
105
+ ### rollback.sh — Blue-Green Rollback
106
+
107
+ ```bash
108
+ #!/usr/bin/env bash
109
+ set -euo pipefail
110
+
111
+ CURRENT=$(readlink /app/current 2>/dev/null || echo "/app/blue")
112
+ TARGET=$([[ "$CURRENT" == *"green"* ]] && echo "/app/blue" || echo "/app/green")
113
+
114
+ ln -sfn "$TARGET" /app/current
115
+ nginx -s reload
116
+
117
+ echo "✅ Rolled back to $TARGET ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
118
+ echo "{\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"event\":\"rollback\",\"from\":\"$CURRENT\",\"to\":\"$TARGET\",\"operator\":\"$(whoami)\"}" >> /var/log/deployments.jsonl
119
+ ```
120
+
121
+ ### Makefile
122
+
123
+ ```makefile
124
+ .PHONY: deploy rollback verify status
125
+
126
+ deploy:
127
+ @./deploy.sh
128
+
129
+ rollback:
130
+ @./rollback.sh
131
+
132
+ verify:
133
+ @./verify.sh
134
+
135
+ status:
136
+ @echo "Current slot: $$(readlink /app/current 2>/dev/null || echo 'N/A')"
137
+ @curl -s $${HEALTH_URL:-http://localhost/health} | python3 -m json.tool 2>/dev/null || echo "Health check failed"
138
+ ```
139
+
140
+ ## Output Checklist | 輸出確認清單
141
+
142
+ After generation, AI assistant must confirm:
143
+
144
+ - [ ] `deploy.sh` includes `set -euo pipefail`
145
+ - [ ] `deploy.sh` includes deploy.lock concurrency guard
146
+ - [ ] `verify.sh` compares version number (not just HTTP 200)
147
+ - [ ] `rollback.sh` triggers automatically on verify failure
148
+ - [ ] `Makefile` provides `make deploy / make rollback / make status`
149
+
150
+ ## Usage | 使用方式
151
+
152
+ ```bash
153
+ /deploy # Interactive mode — auto-detect project type
154
+ /deploy node # Node.js project, generate directly
155
+ /deploy docker # Docker Compose deploy mode
156
+ /deploy --verify-only # Generate verify.sh only
157
+ ```
158
+
159
+ ## Next Steps Guidance | 下一步引導
160
+
161
+ After `/deploy` completes, the AI assistant should suggest:
162
+
163
+ > **Deploy scripts generated. Suggested next steps / 部署腳本已生成,建議下一步:**
164
+ > - `chmod +x deploy.sh verify.sh rollback.sh` — Set executable permissions | 設定執行權限
165
+ > - `make verify` — Test health check configuration | 測試健康檢查設定
166
+ > - `git tag v1.0.0 && git push --tags` — Create version tag | 建立版本 tag
167
+ > - `make deploy` — First deployment | 執行第一次部署
168
+
169
+ ## Reference | 參考
170
+
171
+ - Core standard: [no-cicd-deployment.md](../../core/no-cicd-deployment.md)
172
+ - Core standard: [deployment-standards.md](../../core/deployment-standards.md)
173
+ - Related: [ci-cd-assistant](../ci-cd-assistant/SKILL.md) — For environments WITH CI/CD
174
+
175
+ ## Version History | 版本歷史
176
+
177
+ | Version | Date | Changes | 變更說明 |
178
+ |---------|------|---------|----------|
179
+ | 1.0.0 | 2026-04-26 | Initial release — XSPEC-085 Phase 1b | 初始版本 |
180
+
181
+ ## License | 授權
182
+
183
+ CC BY 4.0 — Documentation content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "universal-dev-standards",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "description": "CLI tool for adopting Universal Development Standards",
5
5
  "keywords": [
6
6
  "documentation",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "5.2.0",
3
+ "version": "5.3.0",
4
4
  "lastUpdated": "2026-04-16",
5
5
  "description": "Standards registry for universal-dev-standards with integrated skills and AI-optimized formats",
6
6
  "formats": {
@@ -58,14 +58,14 @@
58
58
  "standards": {
59
59
  "name": "universal-dev-standards",
60
60
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
61
- "version": "5.2.0"
61
+ "version": "5.3.0"
62
62
  },
63
63
  "skills": {
64
64
  "name": "universal-dev-standards",
65
65
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
66
66
  "localPath": "skills",
67
67
  "rawUrl": "https://raw.githubusercontent.com/AsiaOstrich/universal-dev-standards/main/skills",
68
- "version": "5.2.0",
68
+ "version": "5.3.0",
69
69
  "note": "Skills are now included in the main repository under skills/"
70
70
  }
71
71
  },
@@ -2062,6 +2062,62 @@
2062
2062
  },
2063
2063
  "category": "core",
2064
2064
  "description": "MISSING vs OUTDATED distinction, semver-aware severity (PATCH/MINOR/MAJOR), and automation integration (pre-commit hook, release gate) for multi-locale documentation"
2065
+ },
2066
+ {
2067
+ "id": "push-standards",
2068
+ "name": "Git Push Safety Gates",
2069
+ "nameZh": "Git Push 安全閘門標準",
2070
+ "source": {
2071
+ "human": "skills/push/SKILL.md",
2072
+ "ai": "ai/standards/push-standards.ai.yaml"
2073
+ },
2074
+ "category": "skill",
2075
+ "skillName": "push",
2076
+ "description": "Git push safety gates, protected branch detection, force-push guardrails, pre-push quality gate enforcement, and push receipt audit trail"
2077
+ },
2078
+ {
2079
+ "id": "no-cicd-deployment",
2080
+ "name": "No-CI/CD Deployment Strategy",
2081
+ "nameZh": "無 CI/CD 部署策略",
2082
+ "source": {
2083
+ "human": "core/no-cicd-deployment.md",
2084
+ "ai": "ai/standards/no-cicd-deployment.ai.yaml"
2085
+ },
2086
+ "category": "core",
2087
+ "description": "Reliable deployment strategy without CI/CD platforms: shell scripts with fail-fast, smoke test verification, Blue-Green rollback"
2088
+ },
2089
+ {
2090
+ "id": "rollback-standards",
2091
+ "name": "Rollback Standards",
2092
+ "nameZh": "回滾標準",
2093
+ "source": {
2094
+ "human": "core/rollback-standards.md",
2095
+ "ai": "ai/standards/rollback-standards.ai.yaml"
2096
+ },
2097
+ "category": "core",
2098
+ "description": "Rollback trigger conditions, auto vs manual decisions, and error budget integration"
2099
+ },
2100
+ {
2101
+ "id": "cd-deployment-strategies",
2102
+ "name": "CD Deployment Strategies",
2103
+ "nameZh": "CD 部署策略",
2104
+ "source": {
2105
+ "human": "core/cd-deployment-strategies.md",
2106
+ "ai": "ai/standards/cd-deployment-strategies.ai.yaml"
2107
+ },
2108
+ "category": "core",
2109
+ "description": "Strategy selection matrix for blue-green, canary, rolling, and recreate deployments"
2110
+ },
2111
+ {
2112
+ "id": "pipeline-security-gates",
2113
+ "name": "Pipeline Security Gates",
2114
+ "nameZh": "CI Pipeline 安全閘門",
2115
+ "source": {
2116
+ "human": "core/pipeline-security-gates.md",
2117
+ "ai": "ai/standards/pipeline-security-gates.ai.yaml"
2118
+ },
2119
+ "category": "core",
2120
+ "description": "Security checkpoints embedded in CI pipeline — SAST, DAST, SCA, secrets scan with block/warn/log behavior"
2065
2121
  }
2066
2122
  ]
2067
2123
  }