create-ax-project 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +374 -0
  2. package/bin/create.js +193 -0
  3. package/package.json +38 -0
  4. package/template/.claude/CLAUDE.md +7 -0
  5. package/template/.claude/commands/CLAUDE.md +0 -0
  6. package/template/.claude/commands/benchmark.md +103 -0
  7. package/template/.claude/commands/brainstorm.md +67 -0
  8. package/template/.claude/commands/checkpoint.md +93 -0
  9. package/template/.claude/commands/codex.md +107 -0
  10. package/template/.claude/commands/collaborate.md +85 -0
  11. package/template/.claude/commands/context.md +154 -0
  12. package/template/.claude/commands/deploy.md +102 -0
  13. package/template/.claude/commands/fork.md +142 -0
  14. package/template/.claude/commands/gemini.md +84 -0
  15. package/template/.claude/commands/handoff.md +80 -0
  16. package/template/.claude/commands/implement.md +82 -0
  17. package/template/.claude/commands/init-project.md +49 -0
  18. package/template/.claude/commands/next.md +125 -0
  19. package/template/.claude/commands/planning.md +69 -0
  20. package/template/.claude/commands/qa.md +81 -0
  21. package/template/.claude/commands/refactor.md +95 -0
  22. package/template/.claude/commands/research.md +60 -0
  23. package/template/.claude/commands/restore.md +113 -0
  24. package/template/.claude/commands/run-stage.md +78 -0
  25. package/template/.claude/commands/stages.md +109 -0
  26. package/template/.claude/commands/status.md +73 -0
  27. package/template/.claude/commands/tasks.md +80 -0
  28. package/template/.claude/commands/test.md +93 -0
  29. package/template/.claude/commands/ui-ux.md +61 -0
  30. package/template/.claude/commands/validate.md +174 -0
  31. package/template/.claude/hooks/CLAUDE.md +0 -0
  32. package/template/.claude/hooks/ai-selector.sh +223 -0
  33. package/template/.claude/hooks/auto-checkpoint.sh +187 -0
  34. package/template/.claude/hooks/output-validator.sh +289 -0
  35. package/template/.claude/hooks/post-stage.sh +123 -0
  36. package/template/.claude/hooks/pre-stage.sh +186 -0
  37. package/template/.claude/hooks/session-start.sh +90 -0
  38. package/template/.claude/hooks/statusline.sh +115 -0
  39. package/template/.claude/hooks/stop.sh +104 -0
  40. package/template/.claude/settings.json +149 -0
  41. package/template/.claude/skills/ai-collaboration/CLAUDE.md +0 -0
  42. package/template/.claude/skills/ai-collaboration/README.md +61 -0
  43. package/template/.claude/skills/ai-collaboration/debate.md +148 -0
  44. package/template/.claude/skills/ai-collaboration/parallel.md +96 -0
  45. package/template/.claude/skills/ai-collaboration/prompts/CLAUDE.md +107 -0
  46. package/template/.claude/skills/auto-checkpoint/CLAUDE.md +0 -0
  47. package/template/.claude/skills/auto-checkpoint/README.md +77 -0
  48. package/template/.claude/skills/auto-checkpoint/prompts/CLAUDE.md +113 -0
  49. package/template/.claude/skills/auto-checkpoint/rollback.md +152 -0
  50. package/template/.claude/skills/auto-checkpoint/trigger.md +122 -0
  51. package/template/.claude/skills/context-compression/CLAUDE.md +0 -0
  52. package/template/.claude/skills/context-compression/README.md +121 -0
  53. package/template/.claude/skills/context-compression/analyze.md +114 -0
  54. package/template/.claude/skills/context-compression/compress.md +175 -0
  55. package/template/.claude/skills/context-compression/prompts/CLAUDE.md +0 -0
  56. package/template/.claude/skills/context-compression/prompts/compression.md +172 -0
  57. package/template/.claude/skills/output-validator/CLAUDE.md +0 -0
  58. package/template/.claude/skills/output-validator/README.md +86 -0
  59. package/template/.claude/skills/output-validator/prompts/CLAUDE.md +119 -0
  60. package/template/.claude/skills/output-validator/validate.md +182 -0
  61. package/template/.claude/skills/smart-handoff/CLAUDE.md +0 -0
  62. package/template/.claude/skills/smart-handoff/README.md +59 -0
  63. package/template/.claude/skills/smart-handoff/extract.md +76 -0
  64. package/template/.claude/skills/smart-handoff/prompts/CLAUDE.md +86 -0
  65. package/template/.claude/skills/smart-handoff/summarize.md +94 -0
  66. package/template/.claude/skills/stage-transition/CLAUDE.md +0 -0
  67. package/template/.claude/skills/stage-transition/README.md +84 -0
  68. package/template/.claude/skills/stage-transition/handoff-gen.md +160 -0
  69. package/template/.claude/skills/stage-transition/prompts/CLAUDE.md +0 -0
  70. package/template/.claude/skills/stage-transition/prompts/transition.md +145 -0
  71. package/template/.claude/skills/stage-transition/validate.md +108 -0
  72. package/template/CLAUDE.md +528 -0
  73. package/template/config/CLAUDE.md +0 -0
  74. package/template/config/ai_benchmarking.yaml +184 -0
  75. package/template/config/ai_collaboration.yaml +159 -0
  76. package/template/config/ai_logging.yaml +129 -0
  77. package/template/config/auto_checkpoint.yaml +189 -0
  78. package/template/config/context.yaml +78 -0
  79. package/template/config/git.yaml +161 -0
  80. package/template/config/handoff_intelligence.yaml +229 -0
  81. package/template/config/implementation.yaml.template +181 -0
  82. package/template/config/mcp_fallbacks.yaml +252 -0
  83. package/template/config/memory_integration.yaml +200 -0
  84. package/template/config/model_enforcement.yaml +141 -0
  85. package/template/config/models.yaml +242 -0
  86. package/template/config/output_validation.yaml +352 -0
  87. package/template/config/pipeline.yaml +357 -0
  88. package/template/config/pipeline_forking.yaml +236 -0
  89. package/template/config/qa_logging.yaml +166 -0
  90. package/template/config/smart_rollback.yaml +209 -0
  91. package/template/config/stage_personas.yaml +354 -0
  92. package/template/config/workflow.yaml +54 -0
  93. package/template/scripts/CLAUDE.md +0 -0
  94. package/template/scripts/ai-benchmark.sh +272 -0
  95. package/template/scripts/codex-wrapper.sh +97 -0
  96. package/template/scripts/context-manager.sh +528 -0
  97. package/template/scripts/create-checkpoint.sh +116 -0
  98. package/template/scripts/gemini-wrapper.sh +96 -0
  99. package/template/scripts/init-project.sh +109 -0
  100. package/template/scripts/list-stages.sh +245 -0
  101. package/template/scripts/next-stage.sh +228 -0
  102. package/template/scripts/output-validate.sh +12 -0
  103. package/template/scripts/pipeline-fork.sh +293 -0
  104. package/template/scripts/pre-run-check.sh +361 -0
  105. package/template/scripts/restore-checkpoint.sh +247 -0
  106. package/template/scripts/run-stage.sh +139 -0
  107. package/template/scripts/show-status.sh +185 -0
  108. package/template/scripts/smart-handoff.sh +254 -0
  109. package/template/stages/01-brainstorm/CLAUDE.md +103 -0
  110. package/template/stages/01-brainstorm/HANDOFF.md +110 -0
  111. package/template/stages/01-brainstorm/HANDOFF.md.template +112 -0
  112. package/template/stages/01-brainstorm/README.md +97 -0
  113. package/template/stages/01-brainstorm/config.yaml +92 -0
  114. package/template/stages/01-brainstorm/inputs/.gitkeep +0 -0
  115. package/template/stages/01-brainstorm/inputs/CLAUDE.md +0 -0
  116. package/template/stages/01-brainstorm/inputs/project_brief.md +40 -0
  117. package/template/stages/01-brainstorm/outputs/.gitkeep +0 -0
  118. package/template/stages/01-brainstorm/outputs/CLAUDE.md +0 -0
  119. package/template/stages/01-brainstorm/outputs/ideas.md +159 -0
  120. package/template/stages/01-brainstorm/outputs/requirements_analysis.md +222 -0
  121. package/template/stages/01-brainstorm/prompts/CLAUDE.md +0 -0
  122. package/template/stages/01-brainstorm/prompts/collaboration.md +46 -0
  123. package/template/stages/01-brainstorm/prompts/ideation.md +62 -0
  124. package/template/stages/01-brainstorm/prompts/persona.md +73 -0
  125. package/template/stages/01-brainstorm/prompts/requirements.md +73 -0
  126. package/template/stages/01-brainstorm/prompts/validation.md +50 -0
  127. package/template/stages/01-brainstorm/templates/CLAUDE.md +0 -0
  128. package/template/stages/01-brainstorm/templates/ideas.md +91 -0
  129. package/template/stages/01-brainstorm/templates/requirements_analysis.md +129 -0
  130. package/template/stages/02-research/CLAUDE.md +101 -0
  131. package/template/stages/02-research/HANDOFF.md +158 -0
  132. package/template/stages/02-research/HANDOFF.md.template +102 -0
  133. package/template/stages/02-research/config.yaml +68 -0
  134. package/template/stages/02-research/inputs/.gitkeep +0 -0
  135. package/template/stages/02-research/outputs/.gitkeep +0 -0
  136. package/template/stages/02-research/outputs/CLAUDE.md +0 -0
  137. package/template/stages/02-research/outputs/feasibility_report.md +176 -0
  138. package/template/stages/02-research/outputs/tech_research.md +403 -0
  139. package/template/stages/02-research/prompts/CLAUDE.md +0 -0
  140. package/template/stages/02-research/prompts/collaboration.md +51 -0
  141. package/template/stages/02-research/prompts/feasibility.md +73 -0
  142. package/template/stages/02-research/prompts/market_analysis.md +58 -0
  143. package/template/stages/02-research/prompts/tech_stack.md +60 -0
  144. package/template/stages/02-research/prompts/validation.md +51 -0
  145. package/template/stages/02-research/templates/.gitkeep +0 -0
  146. package/template/stages/03-planning/CLAUDE.md +98 -0
  147. package/template/stages/03-planning/HANDOFF.md +168 -0
  148. package/template/stages/03-planning/HANDOFF.md.template +91 -0
  149. package/template/stages/03-planning/config.yaml +64 -0
  150. package/template/stages/03-planning/inputs/.gitkeep +0 -0
  151. package/template/stages/03-planning/outputs/.gitkeep +0 -0
  152. package/template/stages/03-planning/outputs/CLAUDE.md +0 -0
  153. package/template/stages/03-planning/outputs/architecture.md +400 -0
  154. package/template/stages/03-planning/outputs/implementation.yaml +209 -0
  155. package/template/stages/03-planning/outputs/project_plan.md +204 -0
  156. package/template/stages/03-planning/outputs/tech_stack.md +176 -0
  157. package/template/stages/03-planning/prompts/CLAUDE.md +0 -0
  158. package/template/stages/03-planning/prompts/architecture.md +62 -0
  159. package/template/stages/03-planning/prompts/collaboration.md +57 -0
  160. package/template/stages/03-planning/prompts/validation.md +59 -0
  161. package/template/stages/03-planning/templates/.gitkeep +0 -0
  162. package/template/stages/04-ui-ux/CLAUDE.md +88 -0
  163. package/template/stages/04-ui-ux/HANDOFF.md +165 -0
  164. package/template/stages/04-ui-ux/HANDOFF.md.template +92 -0
  165. package/template/stages/04-ui-ux/config.yaml +57 -0
  166. package/template/stages/04-ui-ux/inputs/.gitkeep +0 -0
  167. package/template/stages/04-ui-ux/outputs/.gitkeep +0 -0
  168. package/template/stages/04-ui-ux/outputs/CLAUDE.md +0 -0
  169. package/template/stages/04-ui-ux/outputs/design_system.md +449 -0
  170. package/template/stages/04-ui-ux/outputs/user_flows.md +321 -0
  171. package/template/stages/04-ui-ux/outputs/wireframes.md +241 -0
  172. package/template/stages/04-ui-ux/prompts/.gitkeep +0 -0
  173. package/template/stages/04-ui-ux/prompts/CLAUDE.md +0 -0
  174. package/template/stages/04-ui-ux/prompts/collaboration.md +56 -0
  175. package/template/stages/04-ui-ux/prompts/validation.md +54 -0
  176. package/template/stages/04-ui-ux/templates/.gitkeep +0 -0
  177. package/template/stages/05-task-management/CLAUDE.md +105 -0
  178. package/template/stages/05-task-management/HANDOFF.md +187 -0
  179. package/template/stages/05-task-management/HANDOFF.md.template +97 -0
  180. package/template/stages/05-task-management/config.yaml +81 -0
  181. package/template/stages/05-task-management/inputs/.gitkeep +0 -0
  182. package/template/stages/05-task-management/outputs/.gitkeep +0 -0
  183. package/template/stages/05-task-management/outputs/CLAUDE.md +0 -0
  184. package/template/stages/05-task-management/outputs/milestones.md +253 -0
  185. package/template/stages/05-task-management/outputs/sprint_plan.md +203 -0
  186. package/template/stages/05-task-management/outputs/tasks.md +402 -0
  187. package/template/stages/05-task-management/prompts/.gitkeep +0 -0
  188. package/template/stages/05-task-management/prompts/CLAUDE.md +0 -0
  189. package/template/stages/05-task-management/prompts/collaboration.md +54 -0
  190. package/template/stages/05-task-management/prompts/validation.md +66 -0
  191. package/template/stages/05-task-management/templates/CLAUDE.md +0 -0
  192. package/template/stages/05-task-management/templates/notion_integration.md +176 -0
  193. package/template/stages/05-task-management/templates/parallel_groups.yaml +153 -0
  194. package/template/stages/05-task-management/templates/task_schema.yaml +154 -0
  195. package/template/stages/06-implementation/CLAUDE.md +163 -0
  196. package/template/stages/06-implementation/HANDOFF.md +184 -0
  197. package/template/stages/06-implementation/HANDOFF.md.template +192 -0
  198. package/template/stages/06-implementation/config.yaml +62 -0
  199. package/template/stages/06-implementation/inputs/.gitkeep +0 -0
  200. package/template/stages/06-implementation/outputs/.gitkeep +0 -0
  201. package/template/stages/06-implementation/prompts/.gitkeep +0 -0
  202. package/template/stages/06-implementation/prompts/CLAUDE.md +0 -0
  203. package/template/stages/06-implementation/prompts/collaboration.md +64 -0
  204. package/template/stages/06-implementation/prompts/validation.md +65 -0
  205. package/template/stages/06-implementation/templates/.gitkeep +0 -0
  206. package/template/stages/07-refactoring/CLAUDE.md +180 -0
  207. package/template/stages/07-refactoring/HANDOFF.md +82 -0
  208. package/template/stages/07-refactoring/HANDOFF.md.template +97 -0
  209. package/template/stages/07-refactoring/config.yaml +68 -0
  210. package/template/stages/07-refactoring/inputs/.gitkeep +0 -0
  211. package/template/stages/07-refactoring/outputs/.gitkeep +0 -0
  212. package/template/stages/07-refactoring/outputs/refactoring_report.md +102 -0
  213. package/template/stages/07-refactoring/prompts/.gitkeep +0 -0
  214. package/template/stages/07-refactoring/prompts/CLAUDE.md +0 -0
  215. package/template/stages/07-refactoring/prompts/collaboration.md +71 -0
  216. package/template/stages/07-refactoring/prompts/validation.md +76 -0
  217. package/template/stages/07-refactoring/templates/.gitkeep +0 -0
  218. package/template/stages/08-qa/CLAUDE.md +93 -0
  219. package/template/stages/08-qa/HANDOFF.md +114 -0
  220. package/template/stages/08-qa/HANDOFF.md.template +96 -0
  221. package/template/stages/08-qa/config.yaml +56 -0
  222. package/template/stages/08-qa/inputs/.gitkeep +0 -0
  223. package/template/stages/08-qa/outputs/.gitkeep +0 -0
  224. package/template/stages/08-qa/outputs/qa_report.md +138 -0
  225. package/template/stages/08-qa/prompts/.gitkeep +0 -0
  226. package/template/stages/08-qa/prompts/CLAUDE.md +0 -0
  227. package/template/stages/08-qa/prompts/collaboration.md +65 -0
  228. package/template/stages/08-qa/prompts/validation.md +71 -0
  229. package/template/stages/08-qa/templates/.gitkeep +0 -0
  230. package/template/stages/09-testing/CLAUDE.md +124 -0
  231. package/template/stages/09-testing/HANDOFF.md +118 -0
  232. package/template/stages/09-testing/HANDOFF.md.template +113 -0
  233. package/template/stages/09-testing/config.yaml +65 -0
  234. package/template/stages/09-testing/inputs/.gitkeep +0 -0
  235. package/template/stages/09-testing/outputs/.gitkeep +0 -0
  236. package/template/stages/09-testing/outputs/test_report.md +146 -0
  237. package/template/stages/09-testing/prompts/.gitkeep +0 -0
  238. package/template/stages/09-testing/prompts/CLAUDE.md +0 -0
  239. package/template/stages/09-testing/prompts/collaboration.md +77 -0
  240. package/template/stages/09-testing/prompts/validation.md +83 -0
  241. package/template/stages/09-testing/templates/.gitkeep +0 -0
  242. package/template/stages/10-deployment/CLAUDE.md +117 -0
  243. package/template/stages/10-deployment/HANDOFF.md +141 -0
  244. package/template/stages/10-deployment/HANDOFF.md.template +148 -0
  245. package/template/stages/10-deployment/config.yaml +61 -0
  246. package/template/stages/10-deployment/inputs/.gitkeep +0 -0
  247. package/template/stages/10-deployment/outputs/.gitkeep +0 -0
  248. package/template/stages/10-deployment/prompts/.gitkeep +0 -0
  249. package/template/stages/10-deployment/prompts/CLAUDE.md +0 -0
  250. package/template/stages/10-deployment/prompts/collaboration.md +80 -0
  251. package/template/stages/10-deployment/prompts/validation.md +93 -0
  252. package/template/stages/10-deployment/templates/CLAUDE.md +0 -0
  253. package/template/stages/10-deployment/templates/github-actions-cd.yaml +118 -0
  254. package/template/stages/10-deployment/templates/github-actions-ci.yaml +136 -0
  255. package/template/state/progress.json.template +111 -0
  256. package/template/state/templates/CLAUDE.md +0 -0
  257. package/template/state/templates/handoff_base.md.template +187 -0
  258. package/template/state/templates/phase_state.md.template +97 -0
@@ -0,0 +1,361 @@
1
+ #!/bin/bash
2
+ # pre-run-check.sh - 파이프라인 실행 전 사전 점검 스크립트
3
+ # ax-templates workflow pipeline
4
+ #
5
+ # 이 스크립트는 파이프라인 실행 전에 모든 필수 도구와 설정이 올바른지 확인합니다.
6
+
7
+ # 색상 정의
8
+ RED='\033[0;31m'
9
+ GREEN='\033[0;32m'
10
+ YELLOW='\033[1;33m'
11
+ BLUE='\033[0;34m'
12
+ CYAN='\033[0;36m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # 카운터
16
+ PASS_COUNT=0
17
+ FAIL_COUNT=0
18
+ WARN_COUNT=0
19
+
20
+ # 결과 저장
21
+ RESULTS=()
22
+
23
+ # 헤더 출력
24
+ print_header() {
25
+ echo ""
26
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
27
+ echo -e "${CYAN} 🔍 ax-templates Pre-Run Checklist${NC}"
28
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
29
+ echo ""
30
+ }
31
+
32
+ # 섹션 헤더
33
+ print_section() {
34
+ echo ""
35
+ echo -e "${BLUE}▸ $1${NC}"
36
+ echo -e "${BLUE}──────────────────────────────────────${NC}"
37
+ }
38
+
39
+ # 결과 출력 함수
40
+ check_pass() {
41
+ echo -e " ${GREEN}✓${NC} $1"
42
+ PASS_COUNT=$((PASS_COUNT + 1))
43
+ RESULTS+=("PASS: $1")
44
+ }
45
+
46
+ check_fail() {
47
+ echo -e " ${RED}✗${NC} $1"
48
+ FAIL_COUNT=$((FAIL_COUNT + 1))
49
+ RESULTS+=("FAIL: $1")
50
+ }
51
+
52
+ check_warn() {
53
+ echo -e " ${YELLOW}⚠${NC} $1"
54
+ WARN_COUNT=$((WARN_COUNT + 1))
55
+ RESULTS+=("WARN: $1")
56
+ }
57
+
58
+ # =============================================================================
59
+ # 1. AI CLI 설치 확인
60
+ # =============================================================================
61
+ check_ai_cli() {
62
+ print_section "AI CLI 설치 확인"
63
+
64
+ # Gemini CLI
65
+ if command -v gemini &> /dev/null; then
66
+ GEMINI_PATH=$(which gemini)
67
+ check_pass "Gemini CLI 설치됨: $GEMINI_PATH"
68
+ else
69
+ check_fail "Gemini CLI 미설치 - 01, 03, 04 스테이지에서 문제 발생 예상"
70
+ fi
71
+
72
+ # Codex CLI
73
+ if command -v codex &> /dev/null; then
74
+ CODEX_PATH=$(which codex)
75
+ check_pass "Codex CLI 설치됨: $CODEX_PATH"
76
+ else
77
+ check_fail "Codex CLI 미설치 - 07, 09 스테이지에서 문제 발생 예상"
78
+ fi
79
+
80
+ # Claude Code (현재 환경)
81
+ check_pass "Claude Code: 현재 실행 중"
82
+ }
83
+
84
+ # =============================================================================
85
+ # 2. tmux 확인
86
+ # =============================================================================
87
+ check_tmux() {
88
+ print_section "tmux 환경 확인"
89
+
90
+ if command -v tmux &> /dev/null; then
91
+ TMUX_VERSION=$(tmux -V)
92
+ check_pass "tmux 설치됨: $TMUX_VERSION"
93
+ else
94
+ check_fail "tmux 미설치 - 외부 AI 호출 불가"
95
+ return
96
+ fi
97
+
98
+ # 기존 세션 확인
99
+ if tmux has-session -t ax-gemini 2>/dev/null; then
100
+ check_pass "tmux 세션 'ax-gemini' 활성"
101
+ else
102
+ check_warn "tmux 세션 'ax-gemini' 없음 - 필요시 자동 생성됨"
103
+ fi
104
+
105
+ if tmux has-session -t ax-codex 2>/dev/null; then
106
+ check_pass "tmux 세션 'ax-codex' 활성"
107
+ else
108
+ check_warn "tmux 세션 'ax-codex' 없음 - 필요시 자동 생성됨"
109
+ fi
110
+ }
111
+
112
+ # =============================================================================
113
+ # 3. 래퍼 스크립트 확인
114
+ # =============================================================================
115
+ check_wrapper_scripts() {
116
+ print_section "래퍼 스크립트 확인"
117
+
118
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
119
+
120
+ # gemini-wrapper.sh
121
+ if [[ -x "$SCRIPT_DIR/gemini-wrapper.sh" ]]; then
122
+ check_pass "gemini-wrapper.sh 실행 가능"
123
+ elif [[ -f "$SCRIPT_DIR/gemini-wrapper.sh" ]]; then
124
+ check_warn "gemini-wrapper.sh 존재하나 실행 권한 없음"
125
+ echo -e " ${YELLOW}해결: chmod +x $SCRIPT_DIR/gemini-wrapper.sh${NC}"
126
+ else
127
+ check_fail "gemini-wrapper.sh 없음"
128
+ fi
129
+
130
+ # codex-wrapper.sh
131
+ if [[ -x "$SCRIPT_DIR/codex-wrapper.sh" ]]; then
132
+ check_pass "codex-wrapper.sh 실행 가능"
133
+ elif [[ -f "$SCRIPT_DIR/codex-wrapper.sh" ]]; then
134
+ check_warn "codex-wrapper.sh 존재하나 실행 권한 없음"
135
+ echo -e " ${YELLOW}해결: chmod +x $SCRIPT_DIR/codex-wrapper.sh${NC}"
136
+ else
137
+ check_fail "codex-wrapper.sh 없음"
138
+ fi
139
+ }
140
+
141
+ # =============================================================================
142
+ # 4. 설정 파일 확인
143
+ # =============================================================================
144
+ check_config_files() {
145
+ print_section "설정 파일 확인"
146
+
147
+ CONFIG_DIR="$(dirname "$(dirname "${BASH_SOURCE[0]}")")/config"
148
+
149
+ required_configs=(
150
+ "pipeline.yaml"
151
+ "models.yaml"
152
+ "ai_collaboration.yaml"
153
+ "mcp_fallbacks.yaml"
154
+ "output_validation.yaml"
155
+ )
156
+
157
+ for config in "${required_configs[@]}"; do
158
+ if [[ -f "$CONFIG_DIR/$config" ]]; then
159
+ check_pass "$config 존재"
160
+ else
161
+ check_fail "$config 없음"
162
+ fi
163
+ done
164
+ }
165
+
166
+ # =============================================================================
167
+ # 5. 상태 파일 확인
168
+ # =============================================================================
169
+ check_state_files() {
170
+ print_section "상태 파일 확인"
171
+
172
+ STATE_DIR="$(dirname "$(dirname "${BASH_SOURCE[0]}")")/state"
173
+
174
+ if [[ -f "$STATE_DIR/progress.json" ]]; then
175
+ CURRENT_STAGE=$(grep -o '"current_stage"[^,]*' "$STATE_DIR/progress.json" 2>/dev/null | cut -d'"' -f4)
176
+ check_pass "progress.json 존재 (현재 스테이지: ${CURRENT_STAGE:-알 수 없음})"
177
+ else
178
+ check_warn "progress.json 없음 - 새 파이프라인으로 시작"
179
+ fi
180
+
181
+ # 체크포인트 디렉토리
182
+ if [[ -d "$STATE_DIR/checkpoints" ]]; then
183
+ CP_COUNT=$(ls -1 "$STATE_DIR/checkpoints" 2>/dev/null | wc -l | tr -d ' ')
184
+ check_pass "체크포인트 디렉토리 존재 ($CP_COUNT개 체크포인트)"
185
+ else
186
+ check_warn "체크포인트 디렉토리 없음"
187
+ fi
188
+ }
189
+
190
+ # =============================================================================
191
+ # 6. 스테이지 파일 확인
192
+ # =============================================================================
193
+ check_stage_files() {
194
+ print_section "스테이지 파일 확인"
195
+
196
+ STAGES_DIR="$(dirname "$(dirname "${BASH_SOURCE[0]}")")/stages"
197
+
198
+ stages=(
199
+ "01-brainstorm"
200
+ "02-research"
201
+ "03-planning"
202
+ "04-ui-ux"
203
+ "05-task-management"
204
+ "06-implementation"
205
+ "07-refactoring"
206
+ "08-qa"
207
+ "09-testing"
208
+ "10-deployment"
209
+ )
210
+
211
+ for stage in "${stages[@]}"; do
212
+ if [[ -f "$STAGES_DIR/$stage/CLAUDE.md" ]]; then
213
+ check_pass "$stage/CLAUDE.md"
214
+ else
215
+ check_fail "$stage/CLAUDE.md 없음"
216
+ fi
217
+ done
218
+ }
219
+
220
+ # =============================================================================
221
+ # 7. AI CLI 간단 테스트 (선택적)
222
+ # =============================================================================
223
+ test_ai_cli() {
224
+ print_section "AI CLI 연결 테스트 (선택적)"
225
+
226
+ echo -e " ${YELLOW}이 테스트는 실제 API 호출을 수행합니다.${NC}"
227
+ echo -e " ${YELLOW}건너뛰려면 Enter, 실행하려면 'y' 입력:${NC}"
228
+ read -r -t 10 response
229
+
230
+ if [[ "$response" != "y" ]]; then
231
+ check_warn "AI 연결 테스트 건너뜀"
232
+ return
233
+ fi
234
+
235
+ # Gemini 테스트
236
+ if command -v gemini &> /dev/null; then
237
+ echo -e " ${BLUE}Gemini 테스트 중...${NC}"
238
+ if timeout 30 gemini "Say 'Hello'" &>/dev/null; then
239
+ check_pass "Gemini API 연결 성공"
240
+ else
241
+ check_fail "Gemini API 연결 실패"
242
+ fi
243
+ fi
244
+
245
+ # Codex 테스트
246
+ if command -v codex &> /dev/null; then
247
+ echo -e " ${BLUE}Codex 테스트 중...${NC}"
248
+ if timeout 30 codex --help &>/dev/null; then
249
+ check_pass "Codex CLI 정상"
250
+ else
251
+ check_fail "Codex CLI 오류"
252
+ fi
253
+ fi
254
+ }
255
+
256
+ # =============================================================================
257
+ # 결과 요약
258
+ # =============================================================================
259
+ print_summary() {
260
+ echo ""
261
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
262
+ echo -e "${CYAN} 📊 점검 결과 요약${NC}"
263
+ echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
264
+ echo ""
265
+ echo -e " ${GREEN}통과: $PASS_COUNT${NC}"
266
+ echo -e " ${YELLOW}경고: $WARN_COUNT${NC}"
267
+ echo -e " ${RED}실패: $FAIL_COUNT${NC}"
268
+ echo ""
269
+
270
+ if [[ $FAIL_COUNT -eq 0 ]]; then
271
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
272
+ echo -e "${GREEN} ✅ 모든 필수 점검 통과! 파이프라인 실행 준비 완료${NC}"
273
+ echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
274
+ else
275
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
276
+ echo -e "${RED} ❌ $FAIL_COUNT개 항목 실패. 위의 문제를 해결하세요.${NC}"
277
+ echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
278
+ fi
279
+
280
+ # 실패 항목 상세
281
+ if [[ $FAIL_COUNT -gt 0 ]]; then
282
+ echo ""
283
+ echo -e "${RED}실패 항목 상세:${NC}"
284
+ for result in "${RESULTS[@]}"; do
285
+ if [[ $result == FAIL:* ]]; then
286
+ echo -e " ${RED}•${NC} ${result#FAIL: }"
287
+ fi
288
+ done
289
+ fi
290
+
291
+ echo ""
292
+ }
293
+
294
+ # =============================================================================
295
+ # 권장 조치 출력
296
+ # =============================================================================
297
+ print_recommendations() {
298
+ if [[ $FAIL_COUNT -gt 0 || $WARN_COUNT -gt 0 ]]; then
299
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
300
+ echo -e "${BLUE} 💡 권장 조치${NC}"
301
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
302
+ echo ""
303
+
304
+ # Gemini 미설치 시
305
+ if ! command -v gemini &> /dev/null; then
306
+ echo -e " ${YELLOW}Gemini CLI 설치:${NC}"
307
+ echo " pip install google-generativeai"
308
+ echo " # 또는 공식 문서 참조"
309
+ echo ""
310
+ fi
311
+
312
+ # Codex 미설치 시
313
+ if ! command -v codex &> /dev/null; then
314
+ echo -e " ${YELLOW}Codex CLI 설치:${NC}"
315
+ echo " npm install -g @openai/codex-cli"
316
+ echo ""
317
+ fi
318
+
319
+ # tmux 미설치 시
320
+ if ! command -v tmux &> /dev/null; then
321
+ echo -e " ${YELLOW}tmux 설치:${NC}"
322
+ echo " brew install tmux # macOS"
323
+ echo " apt install tmux # Ubuntu"
324
+ echo ""
325
+ fi
326
+
327
+ echo ""
328
+ fi
329
+ }
330
+
331
+ # =============================================================================
332
+ # 메인 실행
333
+ # =============================================================================
334
+ main() {
335
+ print_header
336
+
337
+ check_ai_cli
338
+ check_tmux
339
+ check_wrapper_scripts
340
+ check_config_files
341
+ check_state_files
342
+ check_stage_files
343
+
344
+ # 선택적 테스트
345
+ if [[ "$1" == "--test" ]]; then
346
+ test_ai_cli
347
+ fi
348
+
349
+ print_summary
350
+ print_recommendations
351
+
352
+ # 종료 코드
353
+ if [[ $FAIL_COUNT -gt 0 ]]; then
354
+ exit 1
355
+ else
356
+ exit 0
357
+ fi
358
+ }
359
+
360
+ # 실행
361
+ main "$@"
@@ -0,0 +1,247 @@
1
+ #!/bin/bash
2
+ # restore-checkpoint.sh - 체크포인트 복구
3
+ # ax-templates workflow pipeline
4
+
5
+ set -e
6
+
7
+ PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
8
+ PROGRESS_FILE="$PROJECT_ROOT/state/progress.json"
9
+ CHECKPOINTS_DIR="$PROJECT_ROOT/state/checkpoints"
10
+
11
+ # 색상 정의
12
+ RED='\033[0;31m'
13
+ GREEN='\033[0;32m'
14
+ YELLOW='\033[1;33m'
15
+ BLUE='\033[0;34m'
16
+ CYAN='\033[0;36m'
17
+ WHITE='\033[1;37m'
18
+ GRAY='\033[0;90m'
19
+ NC='\033[0m' # No Color
20
+
21
+ # 옵션 처리
22
+ LIST_MODE=false
23
+ LATEST_MODE=false
24
+ FORCE_MODE=false
25
+ BACKUP_MODE=false
26
+ DRY_RUN=false
27
+ CP_ID=""
28
+
29
+ while [[ "$#" -gt 0 ]]; do
30
+ case $1 in
31
+ --list) LIST_MODE=true ;;
32
+ --latest) LATEST_MODE=true ;;
33
+ --force) FORCE_MODE=true ;;
34
+ --backup) BACKUP_MODE=true ;;
35
+ --dry-run) DRY_RUN=true ;;
36
+ CP-*) CP_ID="$1" ;;
37
+ *) ;;
38
+ esac
39
+ shift
40
+ done
41
+
42
+ # jq 확인
43
+ if ! command -v jq &> /dev/null; then
44
+ echo -e "${RED}오류:${NC} jq가 필요합니다."
45
+ exit 1
46
+ fi
47
+
48
+ # 체크포인트 목록 함수
49
+ list_checkpoints() {
50
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
51
+ echo -e "💾 ${WHITE}Checkpoint List${NC}"
52
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
53
+
54
+ if [ ! -d "$CHECKPOINTS_DIR" ] || [ -z "$(ls -A "$CHECKPOINTS_DIR" 2>/dev/null)" ]; then
55
+ echo ""
56
+ echo -e " ${GRAY}체크포인트가 없습니다.${NC}"
57
+ echo -e " ${GRAY}/checkpoint 명령어로 생성하세요.${NC}"
58
+ echo ""
59
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
60
+ return 0
61
+ fi
62
+
63
+ printf " ${GRAY}%-22s %-18s %-20s${NC}\n" "ID" "Stage" "Created"
64
+ echo "─────────────────────────────────────────────────────────"
65
+
66
+ COUNT=0
67
+ for cp_dir in "$CHECKPOINTS_DIR"/CP-*; do
68
+ if [ -d "$cp_dir" ]; then
69
+ CP_NAME=$(basename "$cp_dir")
70
+ META_FILE="$cp_dir/metadata.json"
71
+
72
+ if [ -f "$META_FILE" ]; then
73
+ STAGE=$(jq -r '.stage // "unknown"' "$META_FILE")
74
+ CREATED=$(jq -r '.created_at // "unknown"' "$META_FILE")
75
+ DESC=$(jq -r '.description // ""' "$META_FILE")
76
+
77
+ # 날짜 포맷팅
78
+ if [[ "$OSTYPE" == "darwin"* ]]; then
79
+ CREATED_FMT=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$CREATED" "+%Y-%m-%d %H:%M" 2>/dev/null || echo "$CREATED")
80
+ else
81
+ CREATED_FMT=$(date -d "$CREATED" "+%Y-%m-%d %H:%M" 2>/dev/null || echo "$CREATED")
82
+ fi
83
+
84
+ printf " %-22s %-18s %s\n" "$CP_NAME" "$STAGE" "$CREATED_FMT"
85
+ if [ -n "$DESC" ] && [ "$DESC" != "null" ]; then
86
+ printf " ${GRAY}└─ %s${NC}\n" "$DESC"
87
+ fi
88
+ ((COUNT++))
89
+ fi
90
+ fi
91
+ done
92
+
93
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
94
+ echo -e "총 ${CYAN}${COUNT}개${NC} 체크포인트 | ${GREEN}/restore [ID]${NC}로 복구"
95
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
96
+ }
97
+
98
+ # 최신 체크포인트 찾기
99
+ find_latest_checkpoint() {
100
+ local latest=""
101
+ local latest_time=0
102
+
103
+ for cp_dir in "$CHECKPOINTS_DIR"/CP-*; do
104
+ if [ -d "$cp_dir" ]; then
105
+ META_FILE="$cp_dir/metadata.json"
106
+ if [ -f "$META_FILE" ]; then
107
+ CREATED=$(jq -r '.created_at // ""' "$META_FILE")
108
+ if [ -n "$CREATED" ]; then
109
+ # 타임스탬프 비교 (간단히 문자열 비교)
110
+ if [[ "$CREATED" > "$latest_time" ]]; then
111
+ latest_time="$CREATED"
112
+ latest=$(basename "$cp_dir")
113
+ fi
114
+ fi
115
+ fi
116
+ fi
117
+ done
118
+
119
+ echo "$latest"
120
+ }
121
+
122
+ # 복구 함수
123
+ restore_checkpoint() {
124
+ local cp_id=$1
125
+ local cp_dir="$CHECKPOINTS_DIR/$cp_id"
126
+
127
+ if [ ! -d "$cp_dir" ]; then
128
+ echo -e "${RED}오류:${NC} 체크포인트를 찾을 수 없습니다: $cp_id"
129
+ echo " /restore --list 로 목록을 확인하세요."
130
+ exit 1
131
+ fi
132
+
133
+ META_FILE="$cp_dir/metadata.json"
134
+ STAGE=$(jq -r '.stage // "unknown"' "$META_FILE")
135
+ DESC=$(jq -r '.description // ""' "$META_FILE")
136
+ CREATED=$(jq -r '.created_at // "unknown"' "$META_FILE")
137
+
138
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
139
+ echo -e "⚠️ ${WHITE}체크포인트 복구${NC}"
140
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
141
+ echo -e "체크포인트: ${CYAN}$cp_id${NC}"
142
+ echo -e "스테이지: ${CYAN}$STAGE${NC}"
143
+ if [ -n "$DESC" ] && [ "$DESC" != "null" ]; then
144
+ echo -e "설명: $DESC"
145
+ fi
146
+ echo -e "생성일: $CREATED"
147
+ echo ""
148
+
149
+ if [ "$DRY_RUN" = true ]; then
150
+ echo -e "${YELLOW}[DRY-RUN] 실제 복구를 실행하지 않습니다.${NC}"
151
+ echo ""
152
+ echo "복구될 파일:"
153
+ find "$cp_dir" -type f | while read -r f; do
154
+ echo " - $(basename "$f")"
155
+ done
156
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
157
+ return 0
158
+ fi
159
+
160
+ if [ "$FORCE_MODE" = false ]; then
161
+ echo -e "${YELLOW}⚠️ 경고: 현재 상태가 해당 시점으로 복구됩니다.${NC}"
162
+ echo -e " 현재 변경사항이 손실될 수 있습니다."
163
+ echo ""
164
+ read -p "복구를 진행하시겠습니까? [y/N] " -n 1 -r
165
+ echo
166
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
167
+ echo -e "${YELLOW}취소되었습니다.${NC}"
168
+ exit 0
169
+ fi
170
+ fi
171
+
172
+ echo ""
173
+ echo "복구 중..."
174
+
175
+ # 현재 상태 백업 (옵션)
176
+ if [ "$BACKUP_MODE" = true ]; then
177
+ BACKUP_ID="BACKUP-$(date +%Y%m%d-%H%M%S)"
178
+ BACKUP_DIR="$CHECKPOINTS_DIR/$BACKUP_ID"
179
+ mkdir -p "$BACKUP_DIR"
180
+ cp "$PROGRESS_FILE" "$BACKUP_DIR/progress.json" 2>/dev/null || true
181
+ echo -e "${GREEN}✓${NC} 현재 상태 백업됨: $BACKUP_ID"
182
+ fi
183
+
184
+ # progress.json 복원
185
+ if [ -f "$cp_dir/progress.json" ]; then
186
+ cp "$cp_dir/progress.json" "$PROGRESS_FILE"
187
+ echo -e "${GREEN}✓${NC} progress.json 복원됨"
188
+ fi
189
+
190
+ # outputs 복원
191
+ STAGE_DIR="$PROJECT_ROOT/stages/$STAGE"
192
+ if [ -d "$cp_dir/outputs" ]; then
193
+ rm -rf "$STAGE_DIR/outputs" 2>/dev/null || true
194
+ cp -r "$cp_dir/outputs" "$STAGE_DIR/"
195
+ FILE_COUNT=$(find "$cp_dir/outputs" -type f | wc -l | tr -d ' ')
196
+ echo -e "${GREEN}✓${NC} outputs 파일 복원됨 (${FILE_COUNT}개)"
197
+ fi
198
+
199
+ # HANDOFF.md 복원
200
+ if [ -f "$cp_dir/HANDOFF.md" ]; then
201
+ cp "$cp_dir/HANDOFF.md" "$STAGE_DIR/"
202
+ echo -e "${GREEN}✓${NC} HANDOFF.md 복원됨"
203
+ fi
204
+
205
+ # progress.json에서 현재 스테이지 업데이트
206
+ jq ".current_stage = \"$STAGE\" | .stages.\"$STAGE\".status = \"in_progress\"" \
207
+ "$PROGRESS_FILE" > "${PROGRESS_FILE}.tmp" && mv "${PROGRESS_FILE}.tmp" "$PROGRESS_FILE"
208
+
209
+ echo ""
210
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
211
+ echo -e "${GREEN}✅${NC} 체크포인트 복구 완료!"
212
+ echo -e "현재 스테이지: ${CYAN}$STAGE${NC}"
213
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
214
+ }
215
+
216
+ # 메인 로직
217
+ if [ "$LIST_MODE" = true ]; then
218
+ list_checkpoints
219
+ exit 0
220
+ fi
221
+
222
+ if [ "$LATEST_MODE" = true ]; then
223
+ CP_ID=$(find_latest_checkpoint)
224
+ if [ -z "$CP_ID" ]; then
225
+ echo -e "${RED}오류:${NC} 복구할 체크포인트가 없습니다."
226
+ exit 1
227
+ fi
228
+ echo -e "최신 체크포인트: ${CYAN}$CP_ID${NC}"
229
+ restore_checkpoint "$CP_ID"
230
+ exit 0
231
+ fi
232
+
233
+ if [ -n "$CP_ID" ]; then
234
+ restore_checkpoint "$CP_ID"
235
+ exit 0
236
+ fi
237
+
238
+ # 인자 없으면 도움말
239
+ echo "사용법:"
240
+ echo " /restore --list 체크포인트 목록 보기"
241
+ echo " /restore --latest 최신 체크포인트로 복구"
242
+ echo " /restore [CP-ID] 특정 체크포인트로 복구"
243
+ echo ""
244
+ echo "옵션:"
245
+ echo " --force 확인 없이 복구"
246
+ echo " --backup 복구 전 현재 상태 백업"
247
+ echo " --dry-run 실제 복구 없이 미리보기"