Coverage for src / moai_adk / project / schema.py: 55.56%

9 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-11-20 20:52 +0900

1""" 

2Tab schema v3.0.0 definition and loading 

3 

4Defines the 3-tab configuration schema with: 

5- Tab 1: Quick Start (10 questions in 4 batches) 

6- Tab 2: Documentation (1-2 questions, conditional) 

7- Tab 3: Git Automation (0-4 questions, conditional based on mode) 

8""" 

9 

10from typing import Any, Dict 

11 

12 

13def load_tab_schema() -> Dict[str, Any]: 

14 """Load and return the tab schema v3.0.0""" 

15 return { 

16 'version': '3.0.0', 

17 'tabs': [ 

18 _create_tab1_quick_start(), 

19 _create_tab2_documentation(), 

20 _create_tab3_git_automation(), 

21 ], 

22 } 

23 

24 

25def _create_tab1_quick_start() -> Dict[str, Any]: 

26 """ 

27 Tab 1: Quick Start 

28 4 batches, 10 questions total 

29 """ 

30 return { 

31 'id': 'tab_1_quick_start', 

32 'label': 'Essential Setup', 

33 'description': 'Configure project basics', 

34 'batches': [ 

35 # Batch 1.1: Identity & Language (3 questions) 

36 { 

37 'id': 'batch_1_1_identity', 

38 'header': 'Identity', 

39 'batch_number': 1, 

40 'total_batches': 4, 

41 'questions': [ 

42 { 

43 'id': 'user_name', 

44 'question': 'What name should Alfred use?', 

45 'type': 'text_input', 

46 'required': True, 

47 'smart_default': 'User', 

48 'options': [ 

49 {'label': 'Enter Name', 'value': 'custom'}, 

50 {'label': 'Use Default', 'value': 'default'}, 

51 ], 

52 }, 

53 { 

54 'id': 'conversation_language', 

55 'question': 'Conversation language?', 

56 'type': 'select_single', 

57 'required': True, 

58 'options': [ 

59 { 

60 'label': 'Korean (ko)', 

61 'value': 'ko', 

62 'description': 'Korean language', 

63 }, 

64 { 

65 'label': 'English (en)', 

66 'value': 'en', 

67 'description': 'English language', 

68 }, 

69 { 

70 'label': 'Japanese (ja)', 

71 'value': 'ja', 

72 'description': 'Japanese language', 

73 }, 

74 { 

75 'label': 'Chinese (zh)', 

76 'value': 'zh', 

77 'description': 'Chinese language', 

78 }, 

79 ], 

80 }, 

81 { 

82 'id': 'agent_prompt_language', 

83 'question': 'Agent prompt language?', 

84 'type': 'select_single', 

85 'required': True, 

86 'smart_default': 'en', 

87 'options': [ 

88 { 

89 'label': 'English', 

90 'value': 'en', 

91 'description': 'Recommended for best results', 

92 }, 

93 { 

94 'label': 'Korean', 

95 'value': 'ko', 

96 'description': 'Korean language', 

97 }, 

98 ], 

99 }, 

100 ], 

101 }, 

102 # Batch 1.2: Project Basics (3 questions) 

103 { 

104 'id': 'batch_1_2_project_basics', 

105 'header': 'Project', 

106 'batch_number': 2, 

107 'total_batches': 4, 

108 'questions': [ 

109 { 

110 'id': 'project_name', 

111 'question': 'Project Name?', 

112 'type': 'text_input', 

113 'required': True, 

114 'smart_default': 'my-project', 

115 'options': [ 

116 {'label': 'Enter Name', 'value': 'custom'}, 

117 {'label': 'Use Default', 'value': 'default'}, 

118 ], 

119 }, 

120 { 

121 'id': 'project_owner', 

122 'question': 'Project Owner?', 

123 'type': 'text_input', 

124 'required': True, 

125 'smart_default': '{{user.name}}', 

126 'options': [ 

127 {'label': 'Enter Owner', 'value': 'custom'}, 

128 {'label': 'Use User Name', 'value': 'default'}, 

129 ], 

130 }, 

131 { 

132 'id': 'project_description', 

133 'question': 'Project Description?', 

134 'type': 'text_input', 

135 'required': False, 

136 'smart_default': '', 

137 'options': [ 

138 {'label': 'Enter Description', 'value': 'custom'}, 

139 {'label': 'Skip', 'value': 'skip'}, 

140 ], 

141 }, 

142 ], 

143 }, 

144 # Batch 1.3: Development Mode (2 questions) 

145 { 

146 'id': 'batch_1_3_development_mode', 

147 'header': 'Development', 

148 'batch_number': 3, 

149 'total_batches': 4, 

150 'questions': [ 

151 { 

152 'id': 'git_strategy_mode', 

153 'question': 'Git workflow mode?', 

154 'type': 'select_single', 

155 'required': True, 

156 'options': [ 

157 { 

158 'label': 'Personal', 

159 'value': 'personal', 

160 'description': 'Solo development', 

161 }, 

162 { 

163 'label': 'Team', 

164 'value': 'team', 

165 'description': 'Team collaboration', 

166 }, 

167 { 

168 'label': 'Hybrid', 

169 'value': 'hybrid', 

170 'description': 'Solo + Team flexible', 

171 }, 

172 ], 

173 }, 

174 { 

175 'id': 'git_strategy_workflow', 

176 'question': 'Branching workflow type?', 

177 'type': 'select_single', 

178 'required': True, 

179 'conditional_mapping': { 

180 'personal': ['github-flow', 'trunk-based'], 

181 'team': ['git-flow', 'github-flow'], 

182 'hybrid': ['github-flow', 'git-flow'], 

183 }, 

184 'smart_default_mapping': { 

185 'personal': 'github-flow', 

186 'team': 'git-flow', 

187 'hybrid': 'github-flow', 

188 }, 

189 'options': [ 

190 { 

191 'label': 'GitHub Flow', 

192 'value': 'github-flow', 

193 'description': 'Simple flow', 

194 }, 

195 { 

196 'label': 'Git Flow', 

197 'value': 'git-flow', 

198 'description': 'Complex flow', 

199 }, 

200 { 

201 'label': 'Trunk-Based', 

202 'value': 'trunk-based', 

203 'description': 'Continuous delivery', 

204 }, 

205 ], 

206 }, 

207 ], 

208 }, 

209 # Batch 1.4: Quality Standards (2 questions) 

210 { 

211 'id': 'batch_1_4_quality_standards', 

212 'header': 'Quality', 

213 'batch_number': 4, 

214 'total_batches': 4, 

215 'questions': [ 

216 { 

217 'id': 'test_coverage_target', 

218 'question': 'Test coverage target?', 

219 'type': 'number_input', 

220 'required': True, 

221 'smart_default': 90, 

222 'min': 0, 

223 'max': 100, 

224 'options': [], 

225 }, 

226 { 

227 'id': 'enforce_tdd', 

228 'question': 'Enforce TDD?', 

229 'type': 'select_single', 

230 'required': True, 

231 'smart_default': True, 

232 'options': [ 

233 { 

234 'label': 'Yes', 

235 'value': True, 

236 'description': 'Strict TDD', 

237 }, 

238 { 

239 'label': 'No', 

240 'value': False, 

241 'description': 'Optional TDD', 

242 }, 

243 ], 

244 }, 

245 ], 

246 }, 

247 ], 

248 } 

249 

250 

251def _create_tab2_documentation() -> Dict[str, Any]: 

252 """ 

253 Tab 2: Documentation 

254 2 batches, 1 required + 1 conditional question 

255 """ 

256 return { 

257 'id': 'tab_2_documentation', 

258 'label': 'Documentation', 

259 'description': 'Project document generation', 

260 'batches': [ 

261 # Batch 2.1: Documentation Choice (1 question) 

262 { 

263 'id': 'batch_2_1_documentation_choice', 

264 'header': 'Docs', 

265 'batch_number': 1, 

266 'total_batches': 2, 

267 'questions': [ 

268 { 

269 'id': 'documentation_mode', 

270 'question': 'Documentation strategy?', 

271 'type': 'select_single', 

272 'required': True, 

273 'options': [ 

274 { 

275 'label': 'Quick Start - Skip for Now', 

276 'value': 'skip', 

277 'description': '30 seconds - No docs now', 

278 }, 

279 { 

280 'label': 'Full Documentation - Now', 

281 'value': 'full_now', 

282 'description': '5-30min - Generate docs now', 

283 }, 

284 { 

285 'label': 'Minimal - Auto-generate', 

286 'value': 'minimal', 

287 'description': '1 min - Auto templates', 

288 }, 

289 ], 

290 }, 

291 ], 

292 }, 

293 # Batch 2.2: Documentation Depth (1 conditional question) 

294 { 

295 'id': 'batch_2_2_documentation_depth', 

296 'header': 'Depth', 

297 'batch_number': 2, 

298 'total_batches': 2, 

299 'show_if': "documentation_mode == 'full_now'", 

300 'questions': [ 

301 { 

302 'id': 'documentation_depth', 

303 'question': 'Brainstorming depth?', 

304 'type': 'select_single', 

305 'required': True, 

306 'show_if': "documentation_mode == 'full_now'", 

307 'options': [ 

308 { 

309 'label': 'Quick', 

310 'value': 'quick', 

311 'description': '5-10 min brainstorming', 

312 }, 

313 { 

314 'label': 'Standard', 

315 'value': 'standard', 

316 'description': '10-15 min brainstorming', 

317 }, 

318 { 

319 'label': 'Deep', 

320 'value': 'deep', 

321 'description': '25-30 min brainstorming', 

322 }, 

323 ], 

324 }, 

325 ], 

326 }, 

327 ], 

328 } 

329 

330 

331def _create_tab3_git_automation() -> Dict[str, Any]: 

332 """ 

333 Tab 3: Git Automation 

334 2 conditional batches based on git_strategy.mode 

335 """ 

336 return { 

337 'id': 'tab_3_git_automation', 

338 'label': 'Git', 

339 'description': 'Git automation settings', 

340 'batches': [ 

341 # Batch 3.1: Personal Git Settings (conditional) 

342 { 

343 'id': 'batch_3_1_personal', 

344 'header': 'Personal', 

345 'batch_number': 1, 

346 'total_batches': 2, 

347 'show_if': "git_strategy_mode == 'personal' OR git_strategy_mode == 'hybrid'", 

348 'questions': [ 

349 { 

350 'id': 'git_personal_auto_checkpoint', 

351 'question': 'Auto checkpoint?', 

352 'type': 'select_single', 

353 'required': True, 

354 'show_if': "git_strategy_mode == 'personal' OR git_strategy_mode == 'hybrid'", 

355 'smart_default': 'disabled', 

356 'options': [ 

357 { 

358 'label': 'Disabled', 

359 'value': 'disabled', 

360 'description': 'No auto checkpoints', 

361 }, 

362 { 

363 'label': 'Event-Driven', 

364 'value': 'event-driven', 

365 'description': 'Auto save on events', 

366 }, 

367 { 

368 'label': 'Manual', 

369 'value': 'manual', 

370 'description': 'Manual saves only', 

371 }, 

372 ], 

373 }, 

374 { 

375 'id': 'git_personal_push_remote', 

376 'question': 'Push to remote?', 

377 'type': 'select_single', 

378 'required': True, 

379 'show_if': "git_strategy_mode == 'personal' OR git_strategy_mode == 'hybrid'", 

380 'smart_default': False, 

381 'options': [ 

382 { 

383 'label': 'Yes', 

384 'value': True, 

385 'description': 'Auto push', 

386 }, 

387 { 

388 'label': 'No', 

389 'value': False, 

390 'description': 'Manual push', 

391 }, 

392 ], 

393 }, 

394 ], 

395 }, 

396 # Batch 3.2: Team Git Settings (conditional) 

397 { 

398 'id': 'batch_3_1_team', 

399 'header': 'Team', 

400 'batch_number': 2, 

401 'total_batches': 2, 

402 'show_if': "git_strategy_mode == 'team'", 

403 'questions': [ 

404 { 

405 'id': 'git_team_auto_pr', 

406 'question': 'Auto PR?', 

407 'type': 'select_single', 

408 'required': True, 

409 'show_if': "git_strategy_mode == 'team'", 

410 'smart_default': False, 

411 'options': [ 

412 { 

413 'label': 'Yes', 

414 'value': True, 

415 'description': 'Auto create PR', 

416 }, 

417 { 

418 'label': 'No', 

419 'value': False, 

420 'description': 'Manual PR', 

421 }, 

422 ], 

423 }, 

424 { 

425 'id': 'git_team_draft_pr', 

426 'question': 'Draft PR?', 

427 'type': 'select_single', 

428 'required': True, 

429 'show_if': "git_strategy_mode == 'team'", 

430 'smart_default': False, 

431 'options': [ 

432 { 

433 'label': 'Yes', 

434 'value': True, 

435 'description': 'Draft PR mode', 

436 }, 

437 { 

438 'label': 'No', 

439 'value': False, 

440 'description': 'Ready for review', 

441 }, 

442 ], 

443 }, 

444 ], 

445 }, 

446 ], 

447 }