tapps-agents 3.5.39__py3-none-any.whl → 3.5.41__py3-none-any.whl

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 (71) hide show
  1. tapps_agents/__init__.py +2 -2
  2. tapps_agents/agents/enhancer/agent.py +2728 -2728
  3. tapps_agents/agents/implementer/agent.py +35 -13
  4. tapps_agents/agents/reviewer/agent.py +43 -10
  5. tapps_agents/agents/reviewer/scoring.py +59 -68
  6. tapps_agents/agents/reviewer/tools/__init__.py +24 -0
  7. tapps_agents/agents/reviewer/tools/ruff_grouping.py +250 -0
  8. tapps_agents/agents/reviewer/tools/scoped_mypy.py +284 -0
  9. tapps_agents/beads/__init__.py +11 -0
  10. tapps_agents/beads/hydration.py +213 -0
  11. tapps_agents/beads/specs.py +206 -0
  12. tapps_agents/cli/commands/health.py +19 -3
  13. tapps_agents/cli/commands/simple_mode.py +842 -676
  14. tapps_agents/cli/commands/task.py +227 -0
  15. tapps_agents/cli/commands/top_level.py +13 -0
  16. tapps_agents/cli/main.py +658 -651
  17. tapps_agents/cli/parsers/top_level.py +1978 -1881
  18. tapps_agents/core/config.py +1622 -1622
  19. tapps_agents/core/init_project.py +3012 -2897
  20. tapps_agents/epic/markdown_sync.py +105 -0
  21. tapps_agents/epic/orchestrator.py +1 -2
  22. tapps_agents/epic/parser.py +427 -423
  23. tapps_agents/experts/adaptive_domain_detector.py +0 -2
  24. tapps_agents/experts/knowledge/api-design-integration/api-security-patterns.md +15 -15
  25. tapps_agents/experts/knowledge/api-design-integration/external-api-integration.md +19 -44
  26. tapps_agents/health/checks/outcomes.backup_20260204_064058.py +324 -0
  27. tapps_agents/health/checks/outcomes.backup_20260204_064256.py +324 -0
  28. tapps_agents/health/checks/outcomes.backup_20260204_064600.py +324 -0
  29. tapps_agents/health/checks/outcomes.py +134 -46
  30. tapps_agents/health/orchestrator.py +12 -4
  31. tapps_agents/hooks/__init__.py +33 -0
  32. tapps_agents/hooks/config.py +140 -0
  33. tapps_agents/hooks/events.py +135 -0
  34. tapps_agents/hooks/executor.py +128 -0
  35. tapps_agents/hooks/manager.py +143 -0
  36. tapps_agents/session/__init__.py +19 -0
  37. tapps_agents/session/manager.py +256 -0
  38. tapps_agents/simple_mode/code_snippet_handler.py +382 -0
  39. tapps_agents/simple_mode/intent_parser.py +29 -4
  40. tapps_agents/simple_mode/orchestrators/base.py +185 -59
  41. tapps_agents/simple_mode/orchestrators/build_orchestrator.py +2667 -2642
  42. tapps_agents/simple_mode/orchestrators/fix_orchestrator.py +2 -2
  43. tapps_agents/simple_mode/workflow_suggester.py +37 -3
  44. tapps_agents/workflow/agent_handlers/implementer_handler.py +18 -3
  45. tapps_agents/workflow/cursor_executor.py +2337 -2118
  46. tapps_agents/workflow/direct_execution_fallback.py +16 -3
  47. tapps_agents/workflow/message_formatter.py +2 -1
  48. tapps_agents/workflow/models.py +38 -1
  49. tapps_agents/workflow/parallel_executor.py +43 -4
  50. tapps_agents/workflow/parser.py +375 -357
  51. tapps_agents/workflow/rules_generator.py +337 -337
  52. tapps_agents/workflow/skill_invoker.py +9 -3
  53. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/METADATA +5 -1
  54. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/RECORD +58 -54
  55. tapps_agents/agents/analyst/SKILL.md +0 -85
  56. tapps_agents/agents/architect/SKILL.md +0 -80
  57. tapps_agents/agents/debugger/SKILL.md +0 -66
  58. tapps_agents/agents/designer/SKILL.md +0 -78
  59. tapps_agents/agents/documenter/SKILL.md +0 -95
  60. tapps_agents/agents/enhancer/SKILL.md +0 -189
  61. tapps_agents/agents/implementer/SKILL.md +0 -117
  62. tapps_agents/agents/improver/SKILL.md +0 -55
  63. tapps_agents/agents/ops/SKILL.md +0 -64
  64. tapps_agents/agents/orchestrator/SKILL.md +0 -238
  65. tapps_agents/agents/planner/story_template.md +0 -37
  66. tapps_agents/agents/reviewer/templates/quality-dashboard.html.j2 +0 -150
  67. tapps_agents/agents/tester/SKILL.md +0 -71
  68. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/WHEEL +0 -0
  69. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/entry_points.txt +0 -0
  70. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/licenses/LICENSE +0 -0
  71. {tapps_agents-3.5.39.dist-info → tapps_agents-3.5.41.dist-info}/top_level.txt +0 -0
@@ -1,1881 +1,1978 @@
1
- """
2
- Top-level command parser definitions
3
- """
4
- import argparse
5
- from pathlib import Path
6
-
7
- # Constants for skill-template command
8
- AGENT_TYPES = [
9
- "analyst",
10
- "architect",
11
- "debugger",
12
- "designer",
13
- "documenter",
14
- "enhancer",
15
- "evaluator",
16
- "implementer",
17
- "improver",
18
- "ops",
19
- "orchestrator",
20
- "planner",
21
- "reviewer",
22
- "tester",
23
- ]
24
-
25
- TOOL_OPTIONS = [
26
- "Read",
27
- "Write",
28
- "Edit",
29
- "Grep",
30
- "Glob",
31
- "Bash",
32
- "CodebaseSearch",
33
- "Terminal",
34
- ]
35
-
36
- CAPABILITY_CATEGORIES = [
37
- "code_generation",
38
- "code_review",
39
- "testing",
40
- "documentation",
41
- "debugging",
42
- "refactoring",
43
- "analysis",
44
- "architecture",
45
- "design",
46
- "planning",
47
- ]
48
-
49
-
50
- def add_top_level_parsers(subparsers: argparse._SubParsersAction) -> None:
51
- """Add all top-level command parsers"""
52
-
53
- # Workflow preset commands
54
- workflow_parser = subparsers.add_parser(
55
- "workflow",
56
- help="Run preset workflows (short commands) or custom workflow files",
57
- description="""Execute predefined workflow presets or custom workflow YAML files.
58
-
59
- Workflows orchestrate multiple agents in sequence to complete complex tasks:
60
- • Rapid/Feature: Fast development for sprint work and new features
61
- • Full/Enterprise: Complete SDLC pipeline with all quality gates
62
- • Fix/Refactor: Maintenance workflows for bug fixes and technical debt
63
- • Quality/Improve: Code review and quality improvement cycles
64
- • Hotfix/Urgent: Quick fixes for production-critical issues
65
-
66
- You can use preset names (rapid, full, fix, etc.) or provide a path to a custom workflow YAML file.
67
- Each workflow can be run with --auto for fully automated execution or interactively.
68
-
69
- Examples:
70
- tapps-agents workflow rapid --prompt "Add feature"
71
- tapps-agents workflow workflows/custom/my-workflow.yaml --prompt "Build API"
72
- """,
73
- )
74
- workflow_subparsers = workflow_parser.add_subparsers(
75
- dest="preset",
76
- help="Workflow preset name or file path (use 'list' to see all available presets)",
77
- )
78
-
79
- # Common workflow options (apply to all presets)
80
- common_workflow_args = argparse.ArgumentParser(add_help=False)
81
- common_workflow_args.add_argument(
82
- "--file",
83
- help="Target file or directory path for workflows that operate on existing code (e.g., bug fixes, refactoring). For hotfix workflow, defaults to example_bug.py if present in project root.",
84
- )
85
- common_workflow_args.add_argument(
86
- "--prompt", "-p",
87
- help="Natural language description of what to build or implement. Required for greenfield workflows (full, rapid, feature). Describes the project, feature, or task in plain English.",
88
- )
89
- common_workflow_args.add_argument(
90
- "--auto",
91
- action="store_true",
92
- help="Enable fully automated execution mode. Skips all interactive prompts and uses default decisions. Recommended for CI/CD pipelines and batch processing. Without this flag, workflow will prompt for confirmation at key decision points.",
93
- )
94
- # Issue fix: Explicit CLI/Cursor mode flags to avoid confusion
95
- common_workflow_args.add_argument(
96
- "--cli-mode",
97
- action="store_true",
98
- help="Force CLI/headless mode for workflow execution. Uses direct LLM calls instead of Cursor Skills. Useful when running from terminal outside Cursor or in CI/CD pipelines.",
99
- )
100
- common_workflow_args.add_argument(
101
- "--cursor-mode",
102
- action="store_true",
103
- help="Force Cursor mode for workflow execution. Uses Cursor Skills for LLM operations. This is the default when running inside Cursor IDE.",
104
- )
105
- # Issue fix: Dry-run validation before execution
106
- common_workflow_args.add_argument(
107
- "--dry-run",
108
- action="store_true",
109
- help="Validate workflow without executing. Shows what steps would run, checks for existing artifacts, validates environment, and reports potential issues. Use before running to catch problems early.",
110
- )
111
- # Issue fix: Continue from specific step
112
- common_workflow_args.add_argument(
113
- "--continue-from",
114
- metavar="STEP",
115
- help="Continue workflow from a specific step (e.g., 'implement', 'review'). Skips earlier steps. Useful when earlier steps completed but workflow failed later. Use 'tapps-agents workflow state list' to see available steps.",
116
- )
117
- # Issue fix: Skip specific steps
118
- common_workflow_args.add_argument(
119
- "--skip-steps",
120
- metavar="STEPS",
121
- help="Comma-separated list of steps to skip (e.g., 'enhance,plan'). Useful when those steps were already completed manually or are not needed.",
122
- )
123
- # Issue fix: Print artifact paths after each step
124
- common_workflow_args.add_argument(
125
- "--print-paths",
126
- action="store_true",
127
- default=True,
128
- help="Print artifact file paths after each step completes (default: True). Shows where workflow outputs are saved.",
129
- )
130
- common_workflow_args.add_argument(
131
- "--no-print-paths",
132
- action="store_false",
133
- dest="print_paths",
134
- help="Disable printing artifact paths after each step.",
135
- )
136
- common_workflow_args.add_argument(
137
- "--autonomous",
138
- action="store_true",
139
- help="Enable autonomous execution mode. Runs workflow in a loop until completion or max iterations reached. Perfect for overnight execution. Requires --max-iterations to be set (default: 10).",
140
- )
141
- common_workflow_args.add_argument(
142
- "--max-iterations",
143
- type=int,
144
- default=10,
145
- metavar="N",
146
- help="Maximum number of iterations for autonomous execution (default: 10). Only used with --autonomous flag.",
147
- )
148
-
149
- # Short aliases
150
- full_parser = workflow_subparsers.add_parser(
151
- "full",
152
- help="Full SDLC Pipeline (enterprise, complete lifecycle)",
153
- description="""Complete software development lifecycle workflow for enterprise projects.
154
-
155
- Executes all phases: requirements analysis, architecture design, implementation,
156
- testing, code review, documentation, and deployment planning. Includes all quality
157
- gates and compliance checks. Best for greenfield projects or major features.
158
-
159
- Example: tapps-agents workflow full --prompt "Build a microservices e-commerce platform" --auto""",
160
- parents=[common_workflow_args],
161
- )
162
- rapid_parser = workflow_subparsers.add_parser(
163
- "rapid",
164
- help="Rapid Development (feature, sprint work)",
165
- description="""Fast-paced development workflow for sprint work and feature development.
166
-
167
- Optimized for speed while maintaining code quality. Skips some documentation
168
- and uses lighter review processes. Best for well-understood features and tight deadlines.
169
-
170
- Example: tapps-agents workflow rapid --prompt "Add user profile editing" --auto""",
171
- parents=[common_workflow_args],
172
- )
173
- fix_parser = workflow_subparsers.add_parser(
174
- "fix",
175
- help="Maintenance & Bug Fixing (refactor, technical debt)",
176
- description="""Workflow focused on bug fixes, refactoring, and technical debt reduction.
177
-
178
- Emphasizes code analysis, targeted fixes, and regression testing. Includes
179
- duplication detection and quality improvement steps. Best for maintenance work.
180
-
181
- Example: tapps-agents workflow fix --file src/buggy_module.py --auto""",
182
- parents=[common_workflow_args],
183
- )
184
- quality_parser = workflow_subparsers.add_parser(
185
- "quality",
186
- help="Quality Improvement (code review cycle)",
187
- description="""Comprehensive code quality improvement workflow.
188
-
189
- Runs full code analysis, scoring, linting, type checking, and generates
190
- detailed quality reports. Focuses on improving existing code without adding features.
191
-
192
- Example: tapps-agents workflow quality --file src/legacy_code.py --auto""",
193
- parents=[common_workflow_args],
194
- )
195
- # Simple Mode workflow aliases
196
- new_feature_parser = workflow_subparsers.add_parser(
197
- "new-feature",
198
- help="Simple New Feature (build new features quickly)",
199
- description="""Simplified workflow for building new features with automatic quality checks.
200
-
201
- Coordinates: Enhancer → Planner → Implementer → Reviewer → Tester
202
- Quality gates: Overall ≥65, Security ≥6.5
203
-
204
- Example: tapps-agents workflow new-feature --prompt "Add user authentication" --auto""",
205
- parents=[common_workflow_args],
206
- )
207
- improve_parser = workflow_subparsers.add_parser(
208
- "improve",
209
- help="Simple Improve Quality (code quality improvement)",
210
- description="""Simplified workflow for improving code quality through review and refactoring.
211
-
212
- Coordinates: Reviewer → Improver → Reviewer → Tester
213
- Quality gates: Overall ≥75, Maintainability ≥8.0
214
-
215
- Example: tapps-agents workflow improve --file src/legacy_code.py --auto""",
216
- parents=[common_workflow_args],
217
- )
218
- hotfix_parser = workflow_subparsers.add_parser(
219
- "hotfix",
220
- help="Quick Fix (urgent, production bugs)",
221
- description="""Minimal workflow for urgent production bug fixes.
222
-
223
- Fastest execution path with essential testing only. Skips documentation and
224
- extensive reviews. Use only for critical production issues requiring immediate fixes.
225
-
226
- Example: tapps-agents workflow hotfix --file example_bug.py --auto""",
227
- parents=[common_workflow_args],
228
- )
229
-
230
- # Voice-friendly aliases
231
- workflow_subparsers.add_parser(
232
- "enterprise",
233
- help="Full SDLC Pipeline (alias for 'full' workflow)",
234
- description="Alias for 'full' workflow - executes complete enterprise software development lifecycle pipeline with all quality gates, documentation, and compliance checks. Best for mission-critical projects requiring comprehensive oversight.",
235
- parents=[common_workflow_args],
236
- )
237
- workflow_subparsers.add_parser(
238
- "feature",
239
- help="Rapid Development (alias for 'rapid' workflow)",
240
- description="Alias for 'rapid' workflow - optimized for fast feature development in sprint cycles. Maintains code quality while prioritizing speed and delivery. Ideal for well-understood features with clear requirements.",
241
- parents=[common_workflow_args],
242
- )
243
- workflow_subparsers.add_parser(
244
- "refactor",
245
- help="Maintenance & Bug Fixing (alias for 'fix' workflow)",
246
- description="Alias for 'fix' workflow - focused on code maintenance, bug fixes, and technical debt reduction. Emphasizes targeted analysis, safe refactoring, and regression testing. Use for improving existing code without adding new features.",
247
- parents=[common_workflow_args],
248
- )
249
- # Note: "improve" parser already added above (line 145), skipping duplicate
250
- workflow_subparsers.add_parser(
251
- "urgent",
252
- help="Quick Fix (alias for 'hotfix' workflow)",
253
- description="Alias for 'hotfix' workflow - minimal workflow for urgent production bug fixes requiring immediate resolution. Fastest execution path with essential testing only. Use only for critical production issues that cannot wait for full workflow.",
254
- parents=[common_workflow_args],
255
- )
256
-
257
- # List command
258
- list_parser = workflow_subparsers.add_parser(
259
- "list",
260
- help="List all available workflow presets with descriptions",
261
- description="""Display all available workflow presets with detailed descriptions.
262
-
263
- Shows both primary names and their aliases, along with:
264
- • Purpose and use cases for each workflow
265
- • When to use each workflow type
266
- • Key differences between workflows
267
- • Recommended scenarios for each preset
268
-
269
- Use this command to discover which workflow best fits your current task.""",
270
- )
271
-
272
- # State management commands (Epic 12)
273
- state_parser = workflow_subparsers.add_parser(
274
- "state",
275
- help="Workflow state management (list, show, cleanup, resume)",
276
- description="""Manage workflow state persistence and resume capabilities.
277
-
278
- Workflows can save their state at checkpoints, allowing you to:
279
- • Resume interrupted workflows from the last checkpoint
280
- • Inspect workflow state for debugging
281
- • Clean up old or completed workflow states
282
- • Track workflow execution history
283
-
284
- Use state management to recover from failures or pause/resume long-running workflows.""",
285
- )
286
- state_subparsers = state_parser.add_subparsers(
287
- dest="state_command", help="State management subcommand (list, show, cleanup, resume)", required=True
288
- )
289
-
290
- state_list_parser = state_subparsers.add_parser(
291
- "list",
292
- help="List all persisted workflow states with metadata",
293
- description="Display all saved workflow states with their IDs, timestamps, status, and workflow type. Use --workflow-id to filter by specific workflow.",
294
- )
295
- state_list_parser.add_argument(
296
- "--workflow-id",
297
- help="Filter results to show only states for a specific workflow ID",
298
- )
299
- state_list_parser.add_argument(
300
- "--format",
301
- choices=["json", "text"],
302
- default="text",
303
- help="Output format: 'text' for human-readable, 'json' for programmatic use (default: text)",
304
- )
305
-
306
- state_show_parser = state_subparsers.add_parser(
307
- "show",
308
- help="Show detailed information about a specific workflow state",
309
- description="Display complete details of a saved workflow state including all checkpoint data, execution context, and current step information. Useful for debugging or understanding workflow progress.",
310
- )
311
- state_show_parser.add_argument(
312
- "workflow_id",
313
- help="The workflow ID to inspect (obtain from 'workflow state list')",
314
- )
315
- state_show_parser.add_argument(
316
- "--format",
317
- choices=["json", "text"],
318
- default="text",
319
- help="Output format: 'text' for human-readable, 'json' for programmatic use (default: text)",
320
- )
321
-
322
- state_cleanup_parser = state_subparsers.add_parser(
323
- "cleanup",
324
- help="Remove old or completed workflow states to free up disk space",
325
- description="""Clean up persisted workflow states based on retention policies.
326
-
327
- Removes workflow states that are:
328
- • Older than the retention period
329
- • Exceed the maximum count per workflow
330
- • Completed (if --remove-completed is set)
331
-
332
- Use --dry-run first to preview what will be removed without making changes.""",
333
- )
334
- state_cleanup_parser.add_argument(
335
- "--retention-days",
336
- type=int,
337
- default=30,
338
- help="Keep workflow states newer than this many days. States older than this will be removed (default: 30 days)",
339
- )
340
- state_cleanup_parser.add_argument(
341
- "--max-states-per-workflow",
342
- type=int,
343
- default=10,
344
- help="Maximum number of states to keep per workflow. Older states beyond this limit will be removed (default: 10)",
345
- )
346
- state_cleanup_parser.add_argument(
347
- "--remove-completed",
348
- action="store_true",
349
- default=True,
350
- help="Remove states for workflows that have completed successfully (default: True). Set to False to keep completed workflow states for historical reference.",
351
- )
352
- state_cleanup_parser.add_argument(
353
- "--dry-run",
354
- action="store_true",
355
- help="Preview what would be removed without actually deleting any states. Recommended before running actual cleanup.",
356
- )
357
-
358
- state_resume_parser = workflow_subparsers.add_parser(
359
- "resume",
360
- help="Resume a workflow from its last saved checkpoint",
361
- description="""Resume workflow execution from the last saved checkpoint.
362
-
363
- Recovers workflow state and continues execution from where it left off. Useful for:
364
- • Recovering from interruptions or failures
365
- • Resuming long-running workflows after system restarts
366
- • Continuing workflows that were manually paused
367
-
368
- If --workflow-id is not specified, resumes the most recent workflow. Use --validate to ensure state integrity before resuming.""",
369
- )
370
- state_resume_parser.add_argument(
371
- "--workflow-id",
372
- help="Specific workflow ID to resume. If not provided, resumes the most recently saved workflow state",
373
- )
374
- state_resume_parser.add_argument(
375
- "--validate",
376
- action="store_true",
377
- default=True,
378
- help="Validate state integrity and dependencies before resuming. Checks that all required files and context are still available (default: True).",
379
- )
380
- state_resume_parser.add_argument(
381
- "--no-validate",
382
- action="store_false",
383
- dest="validate",
384
- help="Skip state validation before resuming. Use only if you're certain the state is valid.",
385
- )
386
- state_resume_parser.add_argument(
387
- "--max-steps",
388
- type=int,
389
- default=50,
390
- help="Maximum number of steps to execute during resume (default: 50). Use to limit execution for testing or debugging.",
391
- )
392
-
393
- # Recommend command
394
- recommend_parser = workflow_subparsers.add_parser(
395
- "recommend",
396
- help="Get AI-powered workflow recommendation based on project analysis",
397
- description="""Analyze your project context and recommend the most appropriate workflow preset.
398
-
399
- The system examines:
400
- • Project structure and codebase state
401
- • Recent changes and git history
402
- • File types and complexity
403
- • Existing tests and documentation
404
- • Project size and maturity
405
-
406
- In interactive mode, asks clarifying questions for ambiguous cases. Use --non-interactive for CI/CD or programmatic usage. Use --auto-load to automatically start the recommended workflow after confirmation.""",
407
- )
408
- recommend_parser.add_argument(
409
- "--non-interactive",
410
- action="store_true",
411
- help="Non-interactive mode: return structured recommendation without prompting for user input. Recommended for CI/CD pipelines and automated scripts. Uses defaults for ambiguous cases.",
412
- )
413
- # Cleanup branches command
414
- cleanup_branches_parser = workflow_subparsers.add_parser(
415
- "cleanup-branches",
416
- help="Clean up orphaned Git branches from workflow worktrees",
417
- description="Detect and optionally delete orphaned Git branches that were created for workflow worktrees but no longer have associated worktrees.",
418
- )
419
- cleanup_branches_parser.add_argument(
420
- "--dry-run",
421
- action="store_true",
422
- help="Preview which branches would be deleted without actually deleting them",
423
- )
424
- cleanup_branches_parser.add_argument(
425
- "--retention-days",
426
- type=int,
427
- help="Override retention period (default: from config)",
428
- )
429
- cleanup_branches_parser.add_argument(
430
- "--pattern",
431
- type=str,
432
- help="Branch pattern to match (e.g., 'workflow/*' or 'agent/*')",
433
- )
434
- cleanup_branches_parser.add_argument(
435
- "--force",
436
- action="store_true",
437
- help="Skip confirmation prompt",
438
- )
439
- cleanup_branches_parser.add_argument(
440
- "--format",
441
- choices=["json", "text"],
442
- default="text",
443
- help="Output format (default: text)",
444
- )
445
-
446
- recommend_parser.add_argument(
447
- "--format",
448
- choices=["json", "text"],
449
- default="text",
450
- help="Output format: 'text' for human-readable recommendation, 'json' for structured data suitable for programmatic use (default: text)",
451
- )
452
- recommend_parser.add_argument(
453
- "--auto-load",
454
- action="store_true",
455
- help="Automatically start the recommended workflow after displaying the recommendation. Prompts for confirmation unless --non-interactive is also set.",
456
- )
457
-
458
- # Brownfield system review command
459
- brownfield_parser = subparsers.add_parser(
460
- "brownfield",
461
- help="Brownfield system analysis and expert creation",
462
- description="""Analyze existing brownfield systems and automatically create experts with RAG knowledge bases.
463
-
464
- This command performs:
465
- • Codebase analysis (languages, frameworks, dependencies)
466
- • Domain detection using DomainStackDetector
467
- • Automatic expert configuration generation
468
- • RAG knowledge base population from project docs and Context7
469
-
470
- Examples:
471
- tapps-agents brownfield review --auto
472
- tapps-agents brownfield review --dry-run
473
- tapps-agents brownfield review --no-context7
474
- """,
475
- )
476
- brownfield_subparsers = brownfield_parser.add_subparsers(
477
- dest="brownfield_command",
478
- help="Brownfield command",
479
- required=True,
480
- )
481
-
482
- review_parser = brownfield_subparsers.add_parser(
483
- "review",
484
- help="Review brownfield system and create experts",
485
- description="""Perform complete brownfield review: analyze codebase, detect domains,
486
- create expert configurations, and populate RAG knowledge bases.""",
487
- )
488
- review_parser.add_argument(
489
- "--auto",
490
- action="store_true",
491
- help="Fully automated execution (skip prompts)",
492
- )
493
- review_parser.add_argument(
494
- "--dry-run",
495
- action="store_true",
496
- help="Preview changes without applying",
497
- )
498
- review_parser.add_argument(
499
- "--output-dir",
500
- type=Path,
501
- help="Output directory for reports (default: .tapps-agents/brownfield-review/)",
502
- )
503
- review_parser.add_argument(
504
- "--no-context7",
505
- action="store_true",
506
- help="Skip Context7 library documentation fetching",
507
- )
508
- review_parser.add_argument(
509
- "--resume",
510
- action="store_true",
511
- help="Resume from last saved state",
512
- )
513
- review_parser.add_argument(
514
- "--resume-from",
515
- choices=["analyze", "create_experts", "populate_rag"],
516
- help="Resume from specific step",
517
- )
518
-
519
- # Short command for primary use case: create new project from prompt
520
- create_parser = subparsers.add_parser(
521
- "create",
522
- help="Create a new project from description (PRIMARY USE CASE)",
523
- description="""Create a complete, tested application from a natural language description.
524
-
525
- This is the PRIMARY USE CASE for TappsCodingAgents. It's a shortcut for
526
- 'workflow full --auto --prompt' that executes a fully automated SDLC pipeline.
527
-
528
- The workflow will:
529
- 1. Analyze requirements and gather specifications
530
- 2. Design system architecture
531
- 3. Generate implementation code
532
- 4. Create comprehensive tests
533
- 5. Review code quality
534
- 6. Generate documentation
535
- 7. Provide deployment guidance
536
-
537
- Example:
538
- tapps-agents create "Build a REST API for a todo app with user authentication"
539
- tapps-agents create "Create a React dashboard with data visualization" --workflow rapid""",
540
- )
541
- create_parser.add_argument(
542
- "prompt",
543
- help="Natural language description of the project or application you want to build. Be as specific as possible about features, technologies, and requirements. Example: 'Build a REST API for a todo app with user authentication using FastAPI and PostgreSQL'",
544
- )
545
- create_parser.add_argument(
546
- "--workflow",
547
- default="full",
548
- choices=["full", "rapid", "enterprise", "feature"],
549
- help="Workflow preset to use: 'full' for complete SDLC (default), 'rapid'/'feature' for faster development, 'enterprise' for full pipeline with extra compliance checks (default: full)",
550
- )
551
- create_parser.add_argument(
552
- "--cursor-mode",
553
- action="store_true",
554
- help="(Deprecated) Force Cursor mode for workflow execution. Cursor-first is now the default for workflows unless TAPPS_AGENTS_MODE is explicitly set (e.g., TAPPS_AGENTS_MODE=headless).",
555
- )
556
-
557
- # Cleanup command
558
- cleanup_parser = subparsers.add_parser(
559
- "cleanup",
560
- help="Clean up TappsCodingAgents artifacts and data",
561
- description="""Clean up various TappsCodingAgents artifacts to free disk space and reduce clutter.
562
-
563
- Available cleanup operations:
564
- • workflow-docs: Clean up old workflow documentation directories
565
- • sessions: Clean up .tapps-agents/sessions (enhancer + long-running agent sessions)
566
- • all: Run workflow-docs then sessions (all available cleanups)
567
- """,
568
- )
569
- cleanup_subparsers = cleanup_parser.add_subparsers(
570
- dest="cleanup_type",
571
- help="Type of cleanup to perform",
572
- )
573
-
574
- # Workflow docs cleanup
575
- workflow_docs_cleanup_parser = cleanup_subparsers.add_parser(
576
- "workflow-docs",
577
- help="Clean up old workflow documentation directories",
578
- description="""Clean up old workflow documentation directories from docs/workflows/simple-mode/.
579
-
580
- Keeps the N most recent workflows visible and archives workflows older than the retention period.
581
- Archived workflows are moved to .tapps-agents/archives/workflows/ for reference.
582
- """,
583
- )
584
- workflow_docs_cleanup_parser.add_argument(
585
- "--keep-latest",
586
- type=int,
587
- default=None,
588
- help="Keep N most recent workflows visible (default: from config, typically 5)",
589
- )
590
- workflow_docs_cleanup_parser.add_argument(
591
- "--retention-days",
592
- type=int,
593
- default=None,
594
- help="Archive workflows older than N days (default: from config, typically 30)",
595
- )
596
- workflow_docs_cleanup_parser.add_argument(
597
- "--archive",
598
- action="store_true",
599
- default=None,
600
- help="Enable archival of old workflows (default: from config)",
601
- )
602
- workflow_docs_cleanup_parser.add_argument(
603
- "--no-archive",
604
- action="store_true",
605
- help="Disable archival (workflows will be kept visible)",
606
- )
607
- workflow_docs_cleanup_parser.add_argument(
608
- "--dry-run",
609
- action="store_true",
610
- help="Preview changes without making them",
611
- )
612
-
613
- # Sessions cleanup (enhancer + SessionManager)
614
- sessions_cleanup_parser = cleanup_subparsers.add_parser(
615
- "sessions",
616
- help="Clean up .tapps-agents/sessions (enhancer and long-running agent sessions)",
617
- description="""Clean up session files in .tapps-agents/sessions/.
618
-
619
- Removes zero-byte files, then prunes enhancer session JSONs by age and count.
620
- Also runs SessionManager cleanup for long-running agent sessions (completed/failed older than max-age).
621
- """,
622
- )
623
- sessions_cleanup_parser.add_argument(
624
- "--keep-latest",
625
- type=int,
626
- default=None,
627
- help="Keep N most recent enhancer session files (default: from config, typically 50)",
628
- )
629
- sessions_cleanup_parser.add_argument(
630
- "--max-age-days",
631
- type=int,
632
- default=None,
633
- help="Remove sessions older than N days (default: from config, typically 30)",
634
- )
635
- sessions_cleanup_parser.add_argument(
636
- "--dry-run",
637
- action="store_true",
638
- help="Preview changes without making them",
639
- )
640
-
641
- # All cleanup (workflow-docs + sessions)
642
- all_cleanup_parser = cleanup_subparsers.add_parser(
643
- "all",
644
- help="Run all cleanup operations (workflow-docs, then sessions)",
645
- description="Run workflow-docs cleanup then sessions cleanup with config defaults.\nEquivalent to: cleanup workflow-docs && cleanup sessions",
646
- )
647
- all_cleanup_parser.add_argument(
648
- "--dry-run",
649
- action="store_true",
650
- help="Preview changes without making them",
651
- )
652
-
653
- # Continuous bug fix command
654
- continuous_bug_fix_parser = subparsers.add_parser(
655
- "continuous-bug-fix",
656
- aliases=["bug-fix-continuous"],
657
- help="Continuously find and fix bugs (test-based or proactive)",
658
- description="""Find bugs (from test failures or via code analysis), fix them using bug-fix-agent,
659
- and commit fixes automatically. Stops when no bugs are found or max iterations reached.
660
-
661
- Modes:
662
- - Test-based (default): Run tests and fix failures
663
- - Proactive (--proactive): Analyze code to find potential bugs without tests
664
-
665
- Examples:
666
- # Test-based discovery (default)
667
- tapps-agents continuous-bug-fix
668
- tapps-agents continuous-bug-fix --test-path tests/unit/ --max-iterations 5
669
-
670
- # Proactive discovery (analyze code)
671
- tapps-agents continuous-bug-fix --proactive --target-path src/
672
- tapps-agents continuous-bug-fix --proactive --max-bugs 20 --max-iterations 10
673
-
674
- # Batch commits
675
- tapps-agents continuous-bug-fix --commit-strategy batch --no-commit""",
676
- )
677
- continuous_bug_fix_parser.add_argument(
678
- "--test-path",
679
- type=str,
680
- default=None,
681
- help="Test directory or file to run (default: tests/)",
682
- )
683
- continuous_bug_fix_parser.add_argument(
684
- "--max-iterations",
685
- type=int,
686
- default=10,
687
- help="Maximum loop iterations (default: 10)",
688
- )
689
- continuous_bug_fix_parser.add_argument(
690
- "--commit-strategy",
691
- choices=["one-per-bug", "batch"],
692
- default="one-per-bug",
693
- help="Commit strategy: one-per-bug (default) or batch",
694
- )
695
- continuous_bug_fix_parser.add_argument(
696
- "--no-commit",
697
- action="store_true",
698
- help="Skip commits (dry-run mode)",
699
- )
700
- continuous_bug_fix_parser.add_argument(
701
- "--format",
702
- choices=["json", "text"],
703
- default="text",
704
- help="Output format (default: text)",
705
- )
706
- continuous_bug_fix_parser.add_argument(
707
- "--proactive",
708
- action="store_true",
709
- help="Use proactive bug discovery (code analysis) instead of test-based discovery",
710
- )
711
- continuous_bug_fix_parser.add_argument(
712
- "--target-path",
713
- type=str,
714
- default=None,
715
- help="Directory or file to analyze (for proactive discovery, default: project root)",
716
- )
717
- continuous_bug_fix_parser.add_argument(
718
- "--max-bugs",
719
- type=int,
720
- default=20,
721
- help="Maximum bugs to find per iteration (for proactive discovery, default: 20)",
722
- )
723
-
724
- # Project initialization command
725
- init_parser = subparsers.add_parser(
726
- "init",
727
- help="Initialize project: Set up Cursor Rules and workflow presets",
728
- description="""Initialize a new project with TappsCodingAgents configuration.
729
-
730
- Sets up all integration components for Cursor AI:
731
- • Cursor Rules (.cursor/rules/) - Natural language workflow commands and project context
732
- • Workflow Presets (workflows/presets/) - Reusable workflow definitions
733
- • Configuration (.tapps-agents/config.yaml) - Project settings
734
- • Cursor Skills (.claude/skills/) - Agent skill definitions
735
- • Claude Desktop Commands (.claude/commands/) - Command definitions for Claude Desktop
736
- • Context7 Cache - Pre-populated knowledge base cache
737
- • .cursorignore - Exclude patterns for Cursor indexing
738
-
739
- This command is safe to run multiple times - it won't overwrite existing files
740
- unless you use --overwrite flags. Use --no-<component> to skip specific setups.
741
-
742
- Important: Run init from your project root, not from the TappsCodingAgents framework
743
- directory. Correct: cd /path/to/your-project && tapps-agents init. Wrong: cd .../TappsCodingAgents && tapps-agents init (creates config in the wrong place).
744
-
745
- Upgrade/Reset Mode:
746
- Use --reset or --upgrade to reset framework-managed files to the latest version
747
- while preserving user data and customizations. Creates a backup by default.
748
-
749
- Examples:
750
- tapps-agents init # Initial setup
751
- tapps-agents init --reset # Upgrade/reset framework files
752
- tapps-agents init --reset --dry-run # Preview changes without making them
753
- tapps-agents init --rollback <path> # Rollback from backup""",
754
- )
755
- init_parser.add_argument(
756
- "--no-rules", action="store_true", help="Skip creating/updating .cursor/rules/ directory with natural language workflow commands and project context"
757
- )
758
- init_parser.add_argument(
759
- "--no-presets", action="store_true", help="Skip creating workflow presets directory (workflows/presets/) with reusable workflow definitions"
760
- )
761
- init_parser.add_argument(
762
- "--no-config", action="store_true", help="Skip creating .tapps-agents/config.yaml configuration file with project settings"
763
- )
764
- init_parser.add_argument(
765
- "--no-skills",
766
- action="store_true",
767
- help="Skip installing Cursor Skills definitions in .claude/skills/ directory. Skills enable agent capabilities in Cursor AI.",
768
- )
769
- init_parser.add_argument(
770
- "--no-cache",
771
- action="store_true",
772
- help="Skip pre-populating Context7 knowledge base cache. Cache speeds up library documentation lookups.",
773
- )
774
- # Generate rules command
775
- generate_rules_parser = subparsers.add_parser(
776
- "generate-rules",
777
- help="Generate Cursor Rules documentation from workflow YAML files",
778
- description="""Generate .cursor/rules/workflow-presets.mdc from workflow YAML definitions.
779
-
780
- This command automatically generates Cursor Rules documentation by parsing workflow YAML files
781
- and extracting metadata, steps, and quality gates. The generated documentation stays in sync
782
- with workflow definitions, eliminating documentation drift.
783
-
784
- Example: tapps-agents generate-rules""",
785
- )
786
- generate_rules_parser.add_argument(
787
- "--output",
788
- type=str,
789
- help="Output file path (defaults to .cursor/rules/workflow-presets.mdc)",
790
- )
791
- generate_rules_parser.add_argument(
792
- "--no-backup",
793
- action="store_true",
794
- help="Skip backing up existing rules file",
795
- )
796
-
797
- init_parser.add_argument(
798
- "--no-cursorignore",
799
- action="store_true",
800
- help="Skip creating .cursorignore file to exclude patterns from Cursor AI indexing (e.g., node_modules, .git, build artifacts)",
801
- )
802
- init_parser.add_argument(
803
- "--reset",
804
- action="store_true",
805
- help="Reset framework-managed files to latest version (upgrade mode). Detects existing installation and resets framework files while preserving user data and customizations.",
806
- )
807
- init_parser.add_argument(
808
- "--upgrade",
809
- action="store_true",
810
- help="Upgrade installation (alias for --reset). Resets framework-managed files to latest version while preserving user data.",
811
- )
812
- init_parser.add_argument(
813
- "--no-backup",
814
- action="store_true",
815
- help="Skip backup before reset (not recommended). Use with caution as this prevents rollback capability.",
816
- )
817
- init_parser.add_argument(
818
- "--reset-mcp",
819
- action="store_true",
820
- help="Also reset .cursor/mcp.json to framework version. By default, MCP config is preserved.",
821
- )
822
- init_parser.add_argument(
823
- "--preserve-custom",
824
- action="store_true",
825
- default=True,
826
- help="Preserve custom Skills, Rules, and presets (default: True). Custom files not in framework whitelist are always preserved.",
827
- )
828
- init_parser.add_argument(
829
- "--rollback",
830
- type=str,
831
- metavar="BACKUP_PATH",
832
- help="Rollback an init reset from a backup. Provide path to backup directory (e.g., .tapps-agents/backups/init-reset-20250116-143022).",
833
- )
834
- init_parser.add_argument(
835
- "--yes",
836
- "-y",
837
- action="store_true",
838
- help="Automatically answer 'yes' to all confirmation prompts. Useful for CI/CD pipelines.",
839
- )
840
- init_parser.add_argument(
841
- "--dry-run",
842
- action="store_true",
843
- help="Preview what would be reset without actually making changes. Shows framework files that would be deleted and files that would be preserved.",
844
- )
845
-
846
- # Environment diagnostics
847
- doctor_parser = subparsers.add_parser(
848
- "doctor",
849
- help="Validate local environment and tools",
850
- description="""Diagnose and validate your local development environment.
851
-
852
- Checks for:
853
- • Python version and dependencies
854
- Required tools (ruff, mypy, pytest, etc.)
855
- Configuration files (.tapps-agents/config.yaml)
856
- • Cursor integration components
857
- Cursor Skills configuration
858
- File permissions and directory structure
859
-
860
- By default, soft-degrades with warnings for missing optional components.
861
- Use --format json for programmatic checking.
862
-
863
- Example: tapps-agents doctor""",
864
- )
865
- doctor_parser.add_argument(
866
- "--format", choices=["json", "text"], default="text", help="Output format: 'text' for human-readable diagnostics, 'json' for structured data suitable for programmatic checking (default: text)"
867
- )
868
- doctor_parser.add_argument(
869
- "--config-path", help="Explicit path to .tapps-agents/config.yaml file if not in default location. Useful when running doctor from outside project root."
870
- )
871
- doctor_parser.add_argument(
872
- "--full",
873
- action="store_true",
874
- help="Run both doctor checks and health checks for comprehensive diagnostics",
875
- )
876
- doctor_parser.add_argument(
877
- "--suggest-fixes",
878
- action="store_true",
879
- help="Print suggested fix commands for warnings and errors (does not apply fixes)",
880
- )
881
-
882
- # Docs: print URL and optionally open in browser
883
- docs_parser = subparsers.add_parser(
884
- "docs",
885
- help="Show documentation URL and optionally open in browser",
886
- description="Print the TappsCodingAgents documentation URL. Use --open to open in the default browser.",
887
- )
888
- docs_parser.add_argument(
889
- "--open",
890
- action="store_true",
891
- help="Open documentation in the default browser",
892
- )
893
-
894
- # Commands index (plan 4.1): list (command, skill, execution_path) from SkillAgentRegistry
895
- commands_parser = subparsers.add_parser(
896
- "commands",
897
- help="List or export command index from SkillAgentRegistry",
898
- )
899
- commands_sub = commands_parser.add_subparsers(dest="command", help="Subcommand")
900
- commands_list_parser = commands_sub.add_parser("list", help="List (command, skill, execution_path)")
901
- commands_list_parser.add_argument("--format", choices=["json", "text"], default="text")
902
- commands_list_parser.add_argument("--output", help="Write to file (e.g. docs/COMMAND_INDEX.md); format=text writes Markdown")
903
-
904
- # Health check command
905
- health_parser = subparsers.add_parser(
906
- "health",
907
- help="Comprehensive health checks for TappsCodingAgents",
908
- description="""Run comprehensive health checks across all system dimensions.
909
-
910
- Checks:
911
- • Environment readiness (Python, tools, config)
912
- Execution reliability (workflow success rates, performance)
913
- Context7 cache effectiveness (hit rate, response time)
914
- • Knowledge base population (RAG/KB status)
915
- • Governance safety (filtering)
916
- Outcome trends (quality scores, improvements)
917
-
918
- Use this to ensure tapps-agents is working at 100% capacity.
919
- Health metrics are stored persistently for trend analysis.
920
-
921
- Example: tapps-agents health check""",
922
- )
923
- health_subparsers = health_parser.add_subparsers(
924
- dest="command", help="Health subcommand (check, dashboard, overview, metrics, trends, usage)", required=True
925
- )
926
-
927
- health_check_parser = health_subparsers.add_parser(
928
- "check",
929
- help="Run health checks",
930
- description="Run all health checks or specific checks. Results are saved to metrics storage for trend analysis.",
931
- )
932
- health_check_parser.add_argument(
933
- "--check",
934
- choices=["environment", "automation", "execution", "context7_cache", "knowledge_base", "outcomes"],
935
- help="Run a specific health check (default: all checks)",
936
- )
937
- health_check_parser.add_argument(
938
- "--format",
939
- choices=["json", "text"],
940
- default="text",
941
- help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
942
- )
943
- health_check_parser.add_argument(
944
- "--save",
945
- action="store_true",
946
- default=True,
947
- help="Save results to metrics storage (default: True)",
948
- )
949
- health_check_parser.add_argument(
950
- "--no-save",
951
- action="store_false",
952
- dest="save",
953
- help="Don't save results to metrics storage",
954
- )
955
-
956
- health_dashboard_parser = health_subparsers.add_parser(
957
- "dashboard",
958
- aliases=["show"],
959
- help="Display health dashboard",
960
- description="Show comprehensive health dashboard with all checks, overall status, and remediation actions.",
961
- )
962
- health_dashboard_parser.add_argument(
963
- "--format",
964
- choices=["json", "text"],
965
- default="text",
966
- help="Output format: 'text' for human-readable dashboard, 'json' for structured data (default: text)",
967
- )
968
-
969
- health_overview_parser = health_subparsers.add_parser(
970
- "overview",
971
- aliases=["summary"],
972
- help="1000-foot view: health + usage for all subsystems (recommended)",
973
- description="Single rolled-up report: overall health, each subsystem one line, then usage at a glance (system, top agents, top workflows). Easy to read, great for status at a glance.",
974
- )
975
- health_overview_parser.add_argument(
976
- "--format",
977
- choices=["json", "text"],
978
- default="text",
979
- help="Output format: 'text' for human-readable overview, 'json' for structured data (default: text)",
980
- )
981
-
982
- health_metrics_parser = health_subparsers.add_parser(
983
- "metrics",
984
- help="Show stored health metrics",
985
- description="Display stored health metrics from previous checks. Supports filtering by check name, status, and time range.",
986
- )
987
- health_metrics_parser.add_argument(
988
- "--check-name",
989
- help="Filter by check name (e.g., 'environment', 'execution')",
990
- )
991
- health_metrics_parser.add_argument(
992
- "--status",
993
- choices=["healthy", "degraded", "unhealthy"],
994
- help="Filter by status",
995
- )
996
- health_metrics_parser.add_argument(
997
- "--days",
998
- type=int,
999
- default=30,
1000
- help="Number of days to look back (default: 30)",
1001
- )
1002
- health_metrics_parser.add_argument(
1003
- "--format",
1004
- choices=["json", "text"],
1005
- default="text",
1006
- help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
1007
- )
1008
-
1009
- health_trends_parser = health_subparsers.add_parser(
1010
- "trends",
1011
- help="Show health trends over time",
1012
- description="Display health trends for specific checks over time. Helps identify improving or degrading health patterns.",
1013
- )
1014
- health_trends_parser.add_argument(
1015
- "--check-name",
1016
- required=True,
1017
- help="Check name to analyze trends for (e.g., 'environment', 'execution')",
1018
- )
1019
- health_trends_parser.add_argument(
1020
- "--days",
1021
- type=int,
1022
- default=7,
1023
- help="Number of days to analyze (default: 7)",
1024
- )
1025
- health_trends_parser.add_argument(
1026
- "--format",
1027
- choices=["json", "text"],
1028
- default="text",
1029
- help="Output format: 'text' for human-readable trends, 'json' for structured data (default: text)",
1030
- )
1031
-
1032
- # Usage/analytics (formerly top-level analytics)
1033
- usage_parser = health_subparsers.add_parser(
1034
- "usage",
1035
- help="Usage and analytics (agent/workflow metrics, trends, system status)",
1036
- description="View usage and performance metrics for agents and workflows. Formerly available as 'tapps-agents analytics'. Use 'health usage dashboard' for a full overview.",
1037
- )
1038
- usage_subparsers = usage_parser.add_subparsers(
1039
- dest="usage_subcommand",
1040
- help="Usage subcommand (dashboard, agents, workflows, system, trends)",
1041
- required=True,
1042
- )
1043
- usage_dashboard_p = usage_subparsers.add_parser(
1044
- "dashboard",
1045
- aliases=["show"],
1046
- help="Display usage/analytics dashboard",
1047
- )
1048
- usage_dashboard_p.add_argument(
1049
- "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1050
- )
1051
- usage_agents_p = usage_subparsers.add_parser("agents", help="Agent performance metrics")
1052
- usage_agents_p.add_argument("--agent-id", help="Filter to a specific agent")
1053
- usage_agents_p.add_argument(
1054
- "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1055
- )
1056
- usage_workflows_p = usage_subparsers.add_parser("workflows", help="Workflow performance metrics")
1057
- usage_workflows_p.add_argument("--workflow-id", help="Filter to a specific workflow")
1058
- usage_workflows_p.add_argument(
1059
- "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1060
- )
1061
- usage_trends_p = usage_subparsers.add_parser("trends", help="Historical trends")
1062
- usage_trends_p.add_argument(
1063
- "--metric-type",
1064
- choices=["agent_duration", "workflow_duration", "agent_success_rate", "workflow_success_rate"],
1065
- default="agent_duration",
1066
- help="Metric to analyze (default: agent_duration)",
1067
- )
1068
- usage_trends_p.add_argument("--days", type=int, default=30, help="Days to look back (default: 30)")
1069
- usage_trends_p.add_argument(
1070
- "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1071
- )
1072
- usage_system_p = usage_subparsers.add_parser("system", help="System status and resource usage")
1073
- usage_system_p.add_argument(
1074
- "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1075
- )
1076
-
1077
- # Observability command
1078
- observability_parser = subparsers.add_parser(
1079
- "observability",
1080
- help="Workflow observability: execution graphs, metrics, traces, and logs",
1081
- description="""Comprehensive observability for workflow execution.
1082
-
1083
- Provides:
1084
- • Execution graphs (DOT, Mermaid, HTML)
1085
- Metrics, traces, and logs correlation
1086
- OpenTelemetry export
1087
- • Performance bottleneck identification
1088
-
1089
- Examples:
1090
- tapps-agents observability dashboard --workflow-id workflow-123
1091
- tapps-agents observability graph workflow-123 --format mermaid
1092
- tapps-agents observability otel workflow-123""",
1093
- )
1094
- observability_subparsers = observability_parser.add_subparsers(
1095
- dest="observability_command",
1096
- help="Observability subcommand (dashboard, graph, otel)",
1097
- required=True,
1098
- )
1099
-
1100
- observability_dashboard_parser = observability_subparsers.add_parser(
1101
- "dashboard",
1102
- help="Generate observability dashboard",
1103
- description="Generate comprehensive dashboard correlating metrics, traces, and logs.",
1104
- )
1105
- observability_dashboard_parser.add_argument(
1106
- "--workflow-id",
1107
- help="Workflow ID (if not provided, shows overview of all workflows)",
1108
- )
1109
- observability_dashboard_parser.add_argument(
1110
- "--format",
1111
- choices=["json", "text", "html"],
1112
- default="text",
1113
- help="Output format (default: text)",
1114
- )
1115
- observability_dashboard_parser.add_argument(
1116
- "--output",
1117
- type=Path,
1118
- help="Output file path (default: stdout for text/json, .tapps-agents/observability/ for html)",
1119
- )
1120
-
1121
- observability_graph_parser = observability_subparsers.add_parser(
1122
- "graph",
1123
- help="Generate execution graph",
1124
- description="Generate execution graph for a workflow in various formats.",
1125
- )
1126
- observability_graph_parser.add_argument(
1127
- "workflow_id",
1128
- help="Workflow ID (required)",
1129
- )
1130
- observability_graph_parser.add_argument(
1131
- "--format",
1132
- choices=["dot", "mermaid", "html", "summary"],
1133
- default="dot",
1134
- help="Output format (default: dot)",
1135
- )
1136
- observability_graph_parser.add_argument(
1137
- "--output",
1138
- type=Path,
1139
- help="Output file path (default: .tapps-agents/observability/graphs/)",
1140
- )
1141
-
1142
- observability_otel_parser = observability_subparsers.add_parser(
1143
- "otel",
1144
- help="Export OpenTelemetry trace",
1145
- description="Export workflow execution trace to OpenTelemetry format for external tools.",
1146
- )
1147
- observability_otel_parser.add_argument(
1148
- "workflow_id",
1149
- help="Workflow ID (required)",
1150
- )
1151
- observability_otel_parser.add_argument(
1152
- "--output",
1153
- type=Path,
1154
- help="Output file path (default: .tapps-agents/observability/otel/)",
1155
- )
1156
-
1157
- # Install dev tools command
1158
- install_dev_parser = subparsers.add_parser(
1159
- "install-dev",
1160
- help="Install development tools and dependencies required by TappsCodingAgents",
1161
- description="""Install all development dependencies via pip including:
1162
- ruff - Fast Python linter and formatter
1163
- mypy - Static type checker
1164
- • pytest - Testing framework
1165
- pip-audit - Security vulnerability scanner for dependencies
1166
- pipdeptree - Dependency tree visualization
1167
-
1168
- Automatically detects if you're in a development context (has pyproject.toml) or using the installed package. Use --dry-run to preview what will be installed.""",
1169
- )
1170
- install_dev_parser.add_argument(
1171
- "--dry-run",
1172
- action="store_true",
1173
- help="Preview what packages would be installed without actually installing them. Useful for checking compatibility or reviewing dependencies before installation.",
1174
- )
1175
-
1176
- # Quick shortcuts for common commands
1177
- score_parser = subparsers.add_parser(
1178
- "score",
1179
- help="Quick shortcut: Score a code file (same as 'reviewer score')",
1180
- description="""Quick shortcut to score code files for quality metrics.
1181
-
1182
- Equivalent to 'reviewer score <file>'. Calculates objective quality scores
1183
- including complexity, security, maintainability, and test coverage metrics.
1184
-
1185
- Returns scores from 0-100 for:
1186
- • Overall Quality Score
1187
- Complexity Score (lower is better)
1188
- Security Score
1189
- • Maintainability Score
1190
- Test Coverage (if tests exist)
1191
-
1192
- Example:
1193
- tapps-agents score src/main.py
1194
- tapps-agents score src/main.py --format json""",
1195
- )
1196
- score_parser.add_argument("file", help="Path to the Python code file to analyze and score. Can be a relative or absolute path.")
1197
- score_parser.add_argument(
1198
- "--format", choices=["json", "text"], default="text", help="Output format: 'text' for human-readable scores, 'json' for structured data (default: text)"
1199
- )
1200
-
1201
- # Unified status command
1202
- status_parser = subparsers.add_parser(
1203
- "status",
1204
- help="Unified status command for workflows and system",
1205
- description="""Consolidated status command showing workflow activity and system status.
1206
-
1207
- Shows:
1208
- • Active worktrees and their status
1209
- Progress files and execution status
1210
- Recent results
1211
-
1212
- Use --detailed for full information, --worktrees-only for worktree info only.
1213
-
1214
- Examples:
1215
- tapps-agents status
1216
- tapps-agents status --detailed
1217
- tapps-agents status --worktrees-only
1218
- tapps-agents status --format json""",
1219
- )
1220
- status_parser.add_argument(
1221
- "--detailed",
1222
- action="store_true",
1223
- help="Show detailed information including full progress data and workflow state",
1224
- )
1225
- status_parser.add_argument(
1226
- "--worktrees-only",
1227
- action="store_true",
1228
- help="Show only worktree information",
1229
- )
1230
- status_parser.add_argument(
1231
- "--format",
1232
- choices=["json", "text"],
1233
- default="text",
1234
- help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
1235
- )
1236
-
1237
- # Expert setup wizard commands
1238
- setup_experts_parser = subparsers.add_parser(
1239
- "setup-experts",
1240
- help="Interactive wizard for configuring Industry Experts",
1241
- description="""Configure Industry Experts for domain-specific knowledge and decision-making.
1242
-
1243
- Industry Experts provide specialized knowledge in specific domains (e.g., AI frameworks, code quality, architecture, DevOps). They enhance agent decision-making with weighted expertise. Use this wizard to:
1244
- Initialize expert configuration for your project
1245
- Add new domain experts
1246
- Remove experts that are no longer needed
1247
- • List currently configured experts
1248
-
1249
- Experts are configured in .tapps-agents/experts.yaml and can be referenced by agents during execution.""",
1250
- )
1251
- setup_experts_parser.add_argument(
1252
- "-y",
1253
- "--yes",
1254
- action="store_true",
1255
- help="Automatically answer 'yes' to all confirmation prompts. Useful for Cursor AI integration and CI/CD pipelines where user interaction is not possible.",
1256
- )
1257
- setup_experts_parser.add_argument(
1258
- "--non-interactive",
1259
- action="store_true",
1260
- help="Non-interactive mode: use default values where possible and error if user input is required. Prevents any prompts from appearing.",
1261
- )
1262
- setup_experts_subparsers = setup_experts_parser.add_subparsers(
1263
- dest="command", help="Expert setup subcommand (init, add, remove, list)"
1264
- )
1265
-
1266
- setup_experts_subparsers.add_parser(
1267
- "init", aliases=["initialize"], help="Initialize project with expert configuration setup", description="Set up initial expert configuration for your project. Creates .tapps-agents/experts.yaml with default or recommended experts based on project analysis."
1268
- )
1269
- setup_experts_subparsers.add_parser("add", help="Add a new Industry Expert to the project", description="Add a new domain expert to your project configuration. Prompts for expert name, domain, knowledge base location, and weight.")
1270
- setup_experts_subparsers.add_parser("remove", help="Remove an expert from the project configuration", description="Remove an Industry Expert from .tapps-agents/experts.yaml. The expert will no longer be consulted by agents.")
1271
- setup_experts_subparsers.add_parser("list", help="List all currently configured experts", description="Display all Industry Experts currently configured in the project, including their domains, weights, and knowledge base locations.")
1272
-
1273
- # Background Agent configuration commands removed - Background Agents no longer used
1274
- # All parser code for background-agent-config command has been removed
1275
-
1276
- # Customization template generator command
1277
- customize_parser = subparsers.add_parser(
1278
- "customize",
1279
- help="Generate agent customization file templates",
1280
- description="""Generate customization file templates for agents to override default behaviors.
1281
-
1282
- Customizations allow you to modify agent behavior without changing the base framework code:
1283
- • Override default prompts and instructions
1284
- Customize tool selection preferences
1285
- Adjust model selection criteria
1286
- • Add project-specific guidelines
1287
-
1288
- Customization files are stored in .tapps-agents/customizations/ and take precedence over default agent definitions.""",
1289
- )
1290
- customize_subparsers = customize_parser.add_subparsers(
1291
- dest="command", help="Customization subcommand (init/generate)"
1292
- )
1293
-
1294
- init_customize_parser = customize_subparsers.add_parser(
1295
- "init",
1296
- aliases=["generate"],
1297
- help="Generate a customization file template for a specific agent",
1298
- description="Create a customization template file for the specified agent. The template includes all customizable aspects with comments explaining each option. Edit the generated file to customize agent behavior for your project.",
1299
- )
1300
- init_customize_parser.add_argument(
1301
- "agent_id",
1302
- help="Agent ID to customize (e.g., 'implementer', 'reviewer', 'tester', 'planner'). Must be a valid agent type from the framework.",
1303
- )
1304
- init_customize_parser.add_argument(
1305
- "--overwrite",
1306
- action="store_true",
1307
- help="Overwrite existing customization file if one already exists. Without this flag, the command will fail if a customization file for this agent already exists.",
1308
- )
1309
-
1310
- # Custom Skill commands
1311
- skill_parser = subparsers.add_parser(
1312
- "skill",
1313
- help="Custom Skill management commands",
1314
- description="""Manage custom Skills for extending framework capabilities.
1315
-
1316
- Skills are domain-specific agent extensions that can be used in Cursor AI. They define:
1317
- • Agent capabilities and tools
1318
- Domain-specific knowledge
1319
- Custom instructions and prompts
1320
- • Model profiles and configurations
1321
-
1322
- Use this command to validate existing Skills or generate new Skill templates.""",
1323
- )
1324
- skill_subparsers = skill_parser.add_subparsers(
1325
- dest="skill_command",
1326
- help="Skill management subcommand (validate, template)",
1327
- )
1328
-
1329
- # Skill validation command
1330
- skill_validate_parser = skill_subparsers.add_parser(
1331
- "validate",
1332
- help="Validate custom Skills for correctness and completeness",
1333
- description="""Validate custom Skills for format, schema, and capability correctness.
1334
-
1335
- Checks:
1336
- • SKILL.md format and required sections
1337
- Valid agent type references
1338
- Tool capability definitions
1339
- • Model profile configurations
1340
- • File structure and organization
1341
-
1342
- Use --skill to validate a specific Skill, or validate all Skills in .claude/skills/ by default. Use --no-warnings to show only errors.""",
1343
- )
1344
- skill_validate_parser.add_argument(
1345
- "--skill",
1346
- help="Path to a specific Skill directory (e.g., .claude/skills/my-skill/) or SKILL.md file to validate. If not provided, validates all Skills in .claude/skills/",
1347
- )
1348
- skill_validate_parser.add_argument(
1349
- "--no-warnings",
1350
- action="store_true",
1351
- help="Show only errors and hide warnings. Useful for strict validation in CI/CD pipelines.",
1352
- )
1353
- skill_validate_parser.add_argument(
1354
- "--format",
1355
- choices=["text", "json"],
1356
- default="text",
1357
- help="Output format: 'text' for human-readable validation results, 'json' for structured error data (default: text)",
1358
- )
1359
-
1360
- # Custom Skill template generator command (as subcommand)
1361
- skill_template_parser = skill_subparsers.add_parser(
1362
- "template",
1363
- help="Generate a custom Skill template for Cursor AI integration",
1364
- description="""Generate a custom Skill template that can be used in Cursor AI.
1365
-
1366
- Skills extend the framework's capabilities with domain-specific agents. The template includes:
1367
- • SKILL.md with agent definition
1368
- Capability descriptions
1369
- Tool access configurations
1370
- • Model profile settings
1371
- Example usage patterns
1372
-
1373
- Use --interactive for guided setup, or provide options directly via command-line arguments.""",
1374
- )
1375
-
1376
- # Also keep the old skill-template command for backward compatibility
1377
- skill_template_legacy_parser = subparsers.add_parser(
1378
- "skill-template",
1379
- help="Generate custom Skill template for Cursor Skills (legacy command, use 'skill template')",
1380
- description="""Generate a custom Skill template that can be used in Cursor AI. Skills extend the framework's capabilities with domain-specific agents.
1381
-
1382
- NOTE: This is a legacy command. For new code, use 'skill template' instead. This command is maintained for backward compatibility.""",
1383
- )
1384
- # Copy arguments to legacy parser
1385
- skill_template_legacy_parser.add_argument(
1386
- "skill_name",
1387
- help="Name of the Skill (e.g., 'my-custom-skill', 'data-science-helper'). Must be a valid directory name. Will be created in .claude/skills/",
1388
- )
1389
- skill_template_legacy_parser.add_argument(
1390
- "--type",
1391
- choices=AGENT_TYPES,
1392
- help="Base agent type for template defaults. Determines default capabilities and tool access. Choose from: analyst, architect, debugger, designer, documenter, enhancer, evaluator, implementer, improver, ops, orchestrator, planner, reviewer, tester",
1393
- )
1394
- skill_template_legacy_parser.add_argument(
1395
- "--description",
1396
- help="Custom description of what the Skill does and when to use it. This appears in Cursor AI's Skill selection interface.",
1397
- )
1398
- skill_template_legacy_parser.add_argument(
1399
- "--tools",
1400
- nargs="+",
1401
- choices=TOOL_OPTIONS,
1402
- help="Space-separated list of tools the Skill can access. Available tools: Read, Write, Edit, Grep, Glob, Bash, CodebaseSearch, Terminal. Omit to use defaults for the agent type.",
1403
- )
1404
- skill_template_legacy_parser.add_argument(
1405
- "--capabilities",
1406
- nargs="+",
1407
- choices=CAPABILITY_CATEGORIES,
1408
- help="Space-separated list of capability categories. Available: code_generation, code_review, testing, documentation, debugging, refactoring, analysis, architecture, design, planning. Omit to use defaults for the agent type.",
1409
- )
1410
- skill_template_legacy_parser.add_argument(
1411
- "--model-profile",
1412
- help="Model profile name to use for this Skill. If not provided, defaults to '{skill_name}_profile'. Model profiles define which LLM models to use and their configurations.",
1413
- )
1414
- skill_template_legacy_parser.add_argument(
1415
- "--overwrite",
1416
- action="store_true",
1417
- help="Overwrite existing Skill directory and files if they already exist. Without this flag, the command will fail if the Skill already exists.",
1418
- )
1419
- skill_template_legacy_parser.add_argument(
1420
- "--interactive",
1421
- action="store_true",
1422
- help="Interactive mode: prompt for all options with helpful descriptions. Recommended for first-time Skill creation. If not set, uses provided arguments or defaults.",
1423
- )
1424
-
1425
- skill_template_parser.add_argument(
1426
- "skill_name",
1427
- help="Name of the Skill (e.g., 'my-custom-skill', 'data-science-helper'). Must be a valid directory name. Will be created in .claude/skills/",
1428
- )
1429
- skill_template_parser.add_argument(
1430
- "--type",
1431
- choices=AGENT_TYPES,
1432
- help="Base agent type for template defaults. Determines default capabilities and tool access. Choose from: analyst, architect, debugger, designer, documenter, enhancer, evaluator, implementer, improver, ops, orchestrator, planner, reviewer, tester",
1433
- )
1434
- skill_template_parser.add_argument(
1435
- "--description",
1436
- help="Custom description of what the Skill does and when to use it. This appears in Cursor AI's Skill selection interface.",
1437
- )
1438
- skill_template_parser.add_argument(
1439
- "--tools",
1440
- nargs="+",
1441
- choices=TOOL_OPTIONS,
1442
- help="Space-separated list of tools the Skill can access. Available tools: Read, Write, Edit, Grep, Glob, Bash, CodebaseSearch, Terminal. Omit to use defaults for the agent type.",
1443
- )
1444
- skill_template_parser.add_argument(
1445
- "--capabilities",
1446
- nargs="+",
1447
- choices=CAPABILITY_CATEGORIES,
1448
- help="Space-separated list of capability categories. Available: code_generation, code_review, testing, documentation, debugging, refactoring, analysis, architecture, design, planning. Omit to use defaults for the agent type.",
1449
- )
1450
- skill_template_parser.add_argument(
1451
- "--model-profile",
1452
- help="Model profile name to use for this Skill. If not provided, defaults to '{skill_name}_profile'. Model profiles define which LLM models to use and their configurations.",
1453
- )
1454
- skill_template_parser.add_argument(
1455
- "--overwrite",
1456
- action="store_true",
1457
- help="Overwrite existing Skill directory and files if they already exist. Without this flag, the command will fail if the Skill already exists.",
1458
- )
1459
- skill_template_parser.add_argument(
1460
- "--interactive",
1461
- action="store_true",
1462
- help="Interactive mode: prompt for all options with helpful descriptions. Recommended for first-time Skill creation. If not set, uses provided arguments or defaults.",
1463
- )
1464
-
1465
- # Cursor integration verification command
1466
- cursor_parser = subparsers.add_parser(
1467
- "cursor",
1468
- help="Cursor AI integration verification and management",
1469
- description="""Verify and manage Cursor AI integration components.
1470
-
1471
- Checks the status of:
1472
- • Cursor Skills (.claude/skills/) - Agent capability definitions
1473
- Cursor Rules (.cursor/rules/) - Natural language workflow commands and project context
1474
- Configuration files and directory structure
1475
-
1476
- Use this to ensure all Cursor integration components are properly installed and configured for your project.""",
1477
- )
1478
- cursor_subparsers = cursor_parser.add_subparsers(
1479
- dest="cursor_command",
1480
- help="Cursor integration subcommand (verify/check)",
1481
- required=True,
1482
- )
1483
-
1484
- cursor_verify_parser = cursor_subparsers.add_parser(
1485
- "verify",
1486
- aliases=["check"],
1487
- help="Verify all Cursor AI integration components are properly configured",
1488
- description="""Verify that all Cursor AI integration components are properly installed and configured.
1489
-
1490
- Performs comprehensive checks:
1491
- • Validates Skills directory structure and files
1492
- Checks Cursor Rules file presence and format
1493
- Verifies required directories exist
1494
- • Checks file permissions and accessibility
1495
-
1496
- Reports any missing components, configuration errors, or issues that would prevent Cursor from using TappsCodingAgents features.""",
1497
- )
1498
- cursor_verify_parser.add_argument(
1499
- "--format",
1500
- choices=["json", "text"],
1501
- default="text",
1502
- help="Output format: 'text' for human-readable verification report, 'json' for structured validation data (default: text)",
1503
- )
1504
-
1505
- # Beads (bd) passthrough
1506
- beads_parser = subparsers.add_parser(
1507
- "beads",
1508
- help="Forward to Beads (bd) for task tracking. Requires bd in tools/bd or on PATH.",
1509
- description="Run bd (Beads) for dependency-aware task tracking. See docs/BEADS_INTEGRATION.md.",
1510
- )
1511
- beads_parser.add_argument(
1512
- "bd_args",
1513
- nargs=argparse.REMAINDER,
1514
- help='Arguments passed to bd (e.g. ready, create "Title" -p 0)',
1515
- )
1516
-
1517
- # Simple Mode commands
1518
- simple_mode_parser = subparsers.add_parser(
1519
- "simple-mode",
1520
- help="Simple Mode commands (toggle, status)",
1521
- description="""Manage Simple Mode - a simplified interface that hides complexity while showcasing power.
1522
-
1523
- Simple Mode provides intent-based agent orchestration:
1524
- • Build: Create new features (planner → architect → designer → implementer)
1525
- Review: Code review and quality checks (reviewer improver)
1526
- Fix: Debug and fix issues (debugger implementer tester)
1527
- • Test: Generate and run tests (tester)
1528
-
1529
- Use natural language commands instead of agent-specific syntax.""",
1530
- )
1531
- simple_mode_subparsers = simple_mode_parser.add_subparsers(
1532
- dest="command",
1533
- help="Simple Mode command",
1534
- required=True,
1535
- metavar="COMMAND",
1536
- )
1537
-
1538
- # Simple Mode: on/off
1539
- simple_mode_on_parser = simple_mode_subparsers.add_parser(
1540
- "on",
1541
- help="Enable Simple Mode",
1542
- )
1543
- simple_mode_off_parser = simple_mode_subparsers.add_parser(
1544
- "off",
1545
- help="Disable Simple Mode",
1546
- )
1547
- simple_mode_status_parser = simple_mode_subparsers.add_parser(
1548
- "status",
1549
- help="Check Simple Mode status",
1550
- )
1551
- simple_mode_status_parser.add_argument(
1552
- "--format",
1553
- choices=["json", "text"],
1554
- default="text",
1555
- help="Output format (default: text)",
1556
- )
1557
- simple_mode_init_parser = simple_mode_subparsers.add_parser(
1558
- "init",
1559
- help="Initialize Simple Mode with guided onboarding",
1560
- description="""Run the Simple Mode onboarding wizard to get started quickly.
1561
-
1562
- The wizard will:
1563
- Detect your project type automatically
1564
- Configure Simple Mode settings
1565
- Suggest your first command
1566
- • Show a quick demonstration
1567
- Celebrate your success! 🎉
1568
- """,
1569
- )
1570
- simple_mode_configure_parser = simple_mode_subparsers.add_parser(
1571
- "configure",
1572
- aliases=["config"],
1573
- help="Configure Simple Mode settings interactively",
1574
- description="""Run the configuration wizard to customize Simple Mode settings.
1575
-
1576
- The wizard will guide you through:
1577
- Basic settings (enable/disable, natural language, etc.)
1578
- • Quality thresholds
1579
- Advanced options
1580
- """,
1581
- )
1582
- simple_mode_progress_parser = simple_mode_subparsers.add_parser(
1583
- "progress",
1584
- help="Show your Simple Mode learning progression",
1585
- description="""Display your learning progression, usage statistics, and unlocked features.
1586
-
1587
- Shows:
1588
- • Current level (Beginner, Intermediate, Advanced)
1589
- • Total commands used
1590
- • Commands to next level
1591
- Features unlocked
1592
- • Usage breakdown by command type
1593
- """,
1594
- )
1595
- simple_mode_full_parser = simple_mode_subparsers.add_parser(
1596
- "full",
1597
- help="Run full lifecycle workflow with adaptive checkpoints and quality loopbacks",
1598
- description="""Execute the complete development lifecycle with automatic quality loopbacks and adaptive checkpoints.
1599
-
1600
- This workflow runs the full SDLC pipeline (5-9 steps, adaptive):
1601
- Requirements gathering
1602
- Planning and story creation
1603
- Checkpoint 2: May switch to simpler workflow if task complexity is low
1604
- Architecture design
1605
- API design
1606
- • Implementation
1607
- • Code review with quality gates
1608
- Test generation and execution
1609
- ✓ Checkpoint 3: May skip security/docs if quality score ≥ 80
1610
- • Security scanning (optional)
1611
- Documentation generation (optional)
1612
-
1613
- Features:
1614
- Automatic loopbacks if code quality scores aren't good enough
1615
- Test execution with retry logic
1616
- Security validation with remediation
1617
- Adaptive checkpoints optimize workflow (saves 20K-40K tokens)
1618
- • Final quality review before completion
1619
-
1620
- Checkpoints:
1621
- • After Enhance: Early mismatch detection (70% confidence)
1622
- After Planning: Task complexity analysis (85% confidence)
1623
- After Test: Quality gate for early termination (90% confidence)
1624
-
1625
- The workflow will automatically retry and improve code until quality thresholds are met.
1626
- Use --no-auto-checkpoint to disable checkpoint optimization.""",
1627
- )
1628
- simple_mode_full_parser.add_argument(
1629
- "--prompt", "-p",
1630
- help="Natural language description of what to build or implement. Required for greenfield workflows.",
1631
- )
1632
- simple_mode_full_parser.add_argument(
1633
- "--file",
1634
- help="Target file or directory path for workflows that operate on existing code.",
1635
- )
1636
- simple_mode_full_parser.add_argument(
1637
- "--auto",
1638
- action="store_true",
1639
- help="Enable fully automated execution mode. Skips all interactive prompts.",
1640
- )
1641
- simple_mode_full_parser.add_argument(
1642
- "--no-auto-checkpoint",
1643
- action="store_true",
1644
- help="Disable automatic workflow checkpoint detection and switching.",
1645
- )
1646
- simple_mode_full_parser.add_argument(
1647
- "--checkpoint-debug",
1648
- action="store_true",
1649
- help="Enable verbose checkpoint logging for debugging.",
1650
- )
1651
-
1652
- # Simple Mode: build
1653
- simple_mode_build_parser = simple_mode_subparsers.add_parser(
1654
- "build",
1655
- help="Build new features with adaptive checkpoints and Simple Mode workflow",
1656
- description="""Build new features using the Simple Mode build workflow with adaptive checkpoints.
1657
-
1658
- This workflow executes (3-7 steps, adaptive):
1659
- Step 1: Enhance prompt (requirements analysis)
1660
- Checkpoint 1: Early validation - may switch to simpler workflow
1661
- Step 2: Create user stories
1662
- • Step 3: Design architecture
1663
- Checkpoint 2: Task complexity analysis - may switch to *fix if simple
1664
- Step 4: Design API/data models
1665
- • Step 5: Implement code
1666
- • Step 6: Review code quality
1667
- Step 7: Generate tests
1668
- Checkpoint 3: Quality gate - may skip optional steps if quality ≥ 80
1669
-
1670
- Checkpoints:
1671
- • Automatically detect when task is simpler than expected
1672
- Switch to appropriate workflow with user confirmation
1673
- • Skip optional steps when quality is excellent
1674
- • Save 20K-40K tokens per optimization
1675
-
1676
- Use --fast to skip documentation steps (1-4) for faster iteration.
1677
- Use --no-auto-checkpoint to disable checkpoint optimization.""",
1678
- )
1679
- simple_mode_build_parser.add_argument(
1680
- "--prompt", "-p",
1681
- required=True,
1682
- help="Natural language description of the feature to build",
1683
- )
1684
- simple_mode_build_parser.add_argument(
1685
- "--file",
1686
- help="Target file path for implementation",
1687
- )
1688
- simple_mode_build_parser.add_argument(
1689
- "--fast",
1690
- action="store_true",
1691
- help="Skip documentation steps (1-4) for 50-70%% faster execution",
1692
- )
1693
- simple_mode_build_parser.add_argument(
1694
- "--preset",
1695
- choices=["minimal", "standard", "comprehensive"],
1696
- help="Workflow depth: minimal (enhance->implement->test), standard (all 7 steps), comprehensive (full design). If omitted and --fast not set, preset is auto-suggested from prompt scope.",
1697
- )
1698
- simple_mode_build_parser.add_argument(
1699
- "--auto",
1700
- action="store_true",
1701
- help="Enable fully automated execution mode",
1702
- )
1703
- simple_mode_build_parser.add_argument(
1704
- "--no-auto-checkpoint",
1705
- action="store_true",
1706
- help="Disable automatic workflow checkpoint detection and switching.",
1707
- )
1708
- simple_mode_build_parser.add_argument(
1709
- "--checkpoint-debug",
1710
- action="store_true",
1711
- help="Enable verbose checkpoint logging for debugging.",
1712
- )
1713
-
1714
- # Simple Mode: resume
1715
- simple_mode_resume_parser = simple_mode_subparsers.add_parser(
1716
- "resume",
1717
- help="Resume a failed or paused workflow",
1718
- description="""Resume a workflow from the last completed step.
1719
-
1720
- Use this command to continue a workflow that was interrupted or failed.
1721
- The workflow will resume from the last successfully completed step.""",
1722
- )
1723
- simple_mode_resume_parser.add_argument(
1724
- "workflow_id",
1725
- nargs="?",
1726
- help="Workflow ID to resume (use --list to see available workflows)",
1727
- )
1728
- simple_mode_resume_parser.add_argument(
1729
- "--list",
1730
- action="store_true",
1731
- help="List available workflows that can be resumed",
1732
- )
1733
- simple_mode_resume_parser.add_argument(
1734
- "--validate",
1735
- action="store_true",
1736
- help="Validate state before resuming",
1737
- )
1738
-
1739
- # Simple Mode: enhance (§3.4)
1740
- simple_mode_enhance_parser = simple_mode_subparsers.add_parser(
1741
- "enhance",
1742
- help="Enhance a prompt (EnhancerAgent); §3.4",
1743
- )
1744
- simple_mode_enhance_parser.add_argument("--prompt", "-p", required=True, help="Prompt to enhance")
1745
- simple_mode_enhance_parser.add_argument("--quick", action="store_true", help="Use enhance-quick (stages 1-3)")
1746
-
1747
- # Simple Mode: breakdown (§3.4)
1748
- simple_mode_breakdown_parser = simple_mode_subparsers.add_parser(
1749
- "breakdown",
1750
- help="Break down into tasks (PlannerAgent); §3.4",
1751
- )
1752
- simple_mode_breakdown_parser.add_argument("--prompt", "-p", required=True, help="Goal to break down")
1753
-
1754
- # Simple Mode: todo (§3.5) – forwards to bd
1755
- simple_mode_todo_parser = simple_mode_subparsers.add_parser(
1756
- "todo",
1757
- help="Task/todo via Beads (bd): create, list, close, dep add; §3.5",
1758
- )
1759
- simple_mode_todo_parser.add_argument(
1760
- "args",
1761
- nargs=argparse.REMAINDER,
1762
- default=[],
1763
- help="bd arguments: create 'Title', ready, close ID, dep add C P",
1764
- )
1765
-
1766
- # Learning export commands
1767
- learning_parser = subparsers.add_parser(
1768
- "learning",
1769
- help="Export and view learning system data",
1770
- description="""Export and view learning data from the self-improvement system.
1771
-
1772
- The learning system tracks agent capabilities, patterns, and effectiveness metrics.
1773
- This command allows you to:
1774
- View learning dashboard with current metrics
1775
- • Export learning data for framework feedback
1776
- • Submit anonymized data to framework maintainers
1777
-
1778
- All exports are automatically anonymized to protect privacy.""",
1779
- )
1780
- learning_subparsers = learning_parser.add_subparsers(
1781
- dest="command",
1782
- help="Learning command",
1783
- required=True,
1784
- )
1785
- learning_subparsers.add_parser("help", aliases=["*help"], help="Show learning commands")
1786
-
1787
- # Learning: export
1788
- learning_export_parser = learning_subparsers.add_parser(
1789
- "export",
1790
- help="Export learning data",
1791
- description="""Export learning data in a standardized, anonymized format.
1792
-
1793
- The export includes:
1794
- • Capability metrics (success rates, quality scores)
1795
- Pattern statistics (learned patterns, anti-patterns)
1796
- • Learning effectiveness data (ROI, improvement trends)
1797
- • Analytics data (agent performance, workflow metrics)
1798
-
1799
- All data is automatically anonymized:
1800
- • Project paths are removed
1801
- Task IDs are hashed
1802
- • Code snippets are excluded
1803
- • Sensitive context is removed
1804
-
1805
- Use this to share learning data with framework maintainers for framework improvement.""",
1806
- )
1807
- learning_export_parser.add_argument(
1808
- "--output",
1809
- help="Output file path (default: .tapps-agents/exports/learning-export-{timestamp}.json)",
1810
- )
1811
- learning_export_parser.add_argument(
1812
- "--no-anonymize",
1813
- action="store_true",
1814
- help="Disable anonymization (NOT RECOMMENDED - requires explicit confirmation)",
1815
- )
1816
- learning_export_parser.add_argument(
1817
- "--compress",
1818
- action="store_true",
1819
- help="Compress export with gzip",
1820
- )
1821
- learning_export_parser.add_argument(
1822
- "--format",
1823
- choices=["json", "yaml"],
1824
- default="json",
1825
- help="Export format (default: json)",
1826
- )
1827
- learning_export_parser.add_argument(
1828
- "--yes",
1829
- "-y",
1830
- action="store_true",
1831
- help="Skip confirmation prompt",
1832
- )
1833
-
1834
- # Learning: dashboard
1835
- learning_dashboard_parser = learning_subparsers.add_parser(
1836
- "dashboard",
1837
- help="View learning dashboard",
1838
- description="""Display learning system dashboard with current metrics.
1839
-
1840
- Shows:
1841
- • Capability metrics (success rates, quality scores)
1842
- Pattern statistics (total patterns, by type)
1843
- Security metrics (secure vs insecure patterns)
1844
- • Learning trends (if available)
1845
- Failure analysis (if available)
1846
-
1847
- Use this to verify the self-improvement system is working.""",
1848
- )
1849
- learning_dashboard_parser.add_argument(
1850
- "--capability",
1851
- help="Filter by capability ID",
1852
- )
1853
- learning_dashboard_parser.add_argument(
1854
- "--format",
1855
- choices=["text", "json"],
1856
- default="text",
1857
- help="Output format (default: text)",
1858
- )
1859
- learning_dashboard_parser.add_argument(
1860
- "--include-trends",
1861
- action="store_true",
1862
- help="Include trend data",
1863
- )
1864
- learning_dashboard_parser.add_argument(
1865
- "--include-failures",
1866
- action="store_true",
1867
- help="Include failure analysis",
1868
- )
1869
-
1870
- # Learning: submit (future)
1871
- learning_submit_parser = learning_subparsers.add_parser(
1872
- "submit",
1873
- help="Submit learning data to framework (future)",
1874
- description="""Submit exported learning data to framework maintainers (not yet implemented).
1875
-
1876
- This command will prepare submission package and provide instructions for manual submission.""",
1877
- )
1878
- learning_submit_parser.add_argument(
1879
- "--export-file",
1880
- help="Path to export file (default: latest export)",
1881
- )
1
+ """
2
+ Top-level command parser definitions
3
+ """
4
+ import argparse
5
+ from pathlib import Path
6
+
7
+ # Constants for skill-template command
8
+ AGENT_TYPES = [
9
+ "analyst",
10
+ "architect",
11
+ "debugger",
12
+ "designer",
13
+ "documenter",
14
+ "enhancer",
15
+ "evaluator",
16
+ "implementer",
17
+ "improver",
18
+ "ops",
19
+ "orchestrator",
20
+ "planner",
21
+ "reviewer",
22
+ "tester",
23
+ ]
24
+
25
+ TOOL_OPTIONS = [
26
+ "Read",
27
+ "Write",
28
+ "Edit",
29
+ "Grep",
30
+ "Glob",
31
+ "Bash",
32
+ "CodebaseSearch",
33
+ "Terminal",
34
+ ]
35
+
36
+ CAPABILITY_CATEGORIES = [
37
+ "code_generation",
38
+ "code_review",
39
+ "testing",
40
+ "documentation",
41
+ "debugging",
42
+ "refactoring",
43
+ "analysis",
44
+ "architecture",
45
+ "design",
46
+ "planning",
47
+ ]
48
+
49
+
50
+ def add_top_level_parsers(subparsers: argparse._SubParsersAction) -> None:
51
+ """Add all top-level command parsers"""
52
+
53
+ # Workflow preset commands
54
+ workflow_parser = subparsers.add_parser(
55
+ "workflow",
56
+ help="Run preset workflows (short commands) or custom workflow files",
57
+ description="""Execute predefined workflow presets or custom workflow YAML files.
58
+
59
+ Workflows orchestrate multiple agents in sequence to complete complex tasks:
60
+ • Rapid/Feature: Fast development for sprint work and new features
61
+ • Full/Enterprise: Complete SDLC pipeline with all quality gates
62
+ • Fix/Refactor: Maintenance workflows for bug fixes and technical debt
63
+ • Quality/Improve: Code review and quality improvement cycles
64
+ • Hotfix/Urgent: Quick fixes for production-critical issues
65
+
66
+ You can use preset names (rapid, full, fix, etc.) or provide a path to a custom workflow YAML file.
67
+ Each workflow can be run with --auto for fully automated execution or interactively.
68
+
69
+ Examples:
70
+ tapps-agents workflow rapid --prompt "Add feature"
71
+ tapps-agents workflow workflows/custom/my-workflow.yaml --prompt "Build API"
72
+ """,
73
+ )
74
+ workflow_subparsers = workflow_parser.add_subparsers(
75
+ dest="preset",
76
+ help="Workflow preset name or file path (use 'list' to see all available presets)",
77
+ )
78
+
79
+ # Common workflow options (apply to all presets)
80
+ common_workflow_args = argparse.ArgumentParser(add_help=False)
81
+ common_workflow_args.add_argument(
82
+ "--file",
83
+ help="Target file or directory path for workflows that operate on existing code (e.g., bug fixes, refactoring). For hotfix workflow, defaults to example_bug.py if present in project root.",
84
+ )
85
+ common_workflow_args.add_argument(
86
+ "--prompt", "-p",
87
+ help="Natural language description of what to build or implement. Required for greenfield workflows (full, rapid, feature). Describes the project, feature, or task in plain English.",
88
+ )
89
+ common_workflow_args.add_argument(
90
+ "--auto",
91
+ action="store_true",
92
+ help="Enable fully automated execution mode. Skips all interactive prompts and uses default decisions. Recommended for CI/CD pipelines and batch processing. Without this flag, workflow will prompt for confirmation at key decision points.",
93
+ )
94
+ # Issue fix: Explicit CLI/Cursor mode flags to avoid confusion
95
+ common_workflow_args.add_argument(
96
+ "--cli-mode",
97
+ action="store_true",
98
+ help="Force CLI/headless mode for workflow execution. Uses direct LLM calls instead of Cursor Skills. Useful when running from terminal outside Cursor or in CI/CD pipelines.",
99
+ )
100
+ common_workflow_args.add_argument(
101
+ "--cursor-mode",
102
+ action="store_true",
103
+ help="Force Cursor mode for workflow execution. Uses Cursor Skills for LLM operations. This is the default when running inside Cursor IDE.",
104
+ )
105
+ # Issue fix: Dry-run validation before execution
106
+ common_workflow_args.add_argument(
107
+ "--dry-run",
108
+ action="store_true",
109
+ help="Validate workflow without executing. Shows what steps would run, checks for existing artifacts, validates environment, and reports potential issues. Use before running to catch problems early.",
110
+ )
111
+ # Issue fix: Continue from specific step
112
+ common_workflow_args.add_argument(
113
+ "--continue-from",
114
+ metavar="STEP",
115
+ help="Continue workflow from a specific step (e.g., 'implement', 'review'). Skips earlier steps. Useful when earlier steps completed but workflow failed later. Use 'tapps-agents workflow state list' to see available steps.",
116
+ )
117
+ # Issue fix: Skip specific steps
118
+ common_workflow_args.add_argument(
119
+ "--skip-steps",
120
+ metavar="STEPS",
121
+ help="Comma-separated list of steps to skip (e.g., 'enhance,plan'). Useful when those steps were already completed manually or are not needed.",
122
+ )
123
+ # Issue fix: Print artifact paths after each step
124
+ common_workflow_args.add_argument(
125
+ "--print-paths",
126
+ action="store_true",
127
+ default=True,
128
+ help="Print artifact file paths after each step completes (default: True). Shows where workflow outputs are saved.",
129
+ )
130
+ common_workflow_args.add_argument(
131
+ "--no-print-paths",
132
+ action="store_false",
133
+ dest="print_paths",
134
+ help="Disable printing artifact paths after each step.",
135
+ )
136
+ common_workflow_args.add_argument(
137
+ "--autonomous",
138
+ action="store_true",
139
+ help="Enable autonomous execution mode. Runs workflow in a loop until completion or max iterations reached. Perfect for overnight execution. Requires --max-iterations to be set (default: 10).",
140
+ )
141
+ common_workflow_args.add_argument(
142
+ "--max-iterations",
143
+ type=int,
144
+ default=10,
145
+ metavar="N",
146
+ help="Maximum number of iterations for autonomous execution (default: 10). Only used with --autonomous flag.",
147
+ )
148
+
149
+ # Short aliases
150
+ full_parser = workflow_subparsers.add_parser(
151
+ "full",
152
+ help="Full SDLC Pipeline (enterprise, complete lifecycle)",
153
+ description="""Complete software development lifecycle workflow for enterprise projects.
154
+
155
+ Executes all phases: requirements analysis, architecture design, implementation,
156
+ testing, code review, documentation, and deployment planning. Includes all quality
157
+ gates and compliance checks. Best for greenfield projects or major features.
158
+
159
+ Example: tapps-agents workflow full --prompt "Build a microservices e-commerce platform" --auto""",
160
+ parents=[common_workflow_args],
161
+ )
162
+ rapid_parser = workflow_subparsers.add_parser(
163
+ "rapid",
164
+ help="Rapid Development (feature, sprint work)",
165
+ description="""Fast-paced development workflow for sprint work and feature development.
166
+
167
+ Optimized for speed while maintaining code quality. Skips some documentation
168
+ and uses lighter review processes. Best for well-understood features and tight deadlines.
169
+
170
+ Example: tapps-agents workflow rapid --prompt "Add user profile editing" --auto""",
171
+ parents=[common_workflow_args],
172
+ )
173
+ fix_parser = workflow_subparsers.add_parser(
174
+ "fix",
175
+ help="Maintenance & Bug Fixing (refactor, technical debt)",
176
+ description="""Workflow focused on bug fixes, refactoring, and technical debt reduction.
177
+
178
+ Emphasizes code analysis, targeted fixes, and regression testing. Includes
179
+ duplication detection and quality improvement steps. Best for maintenance work.
180
+
181
+ Example: tapps-agents workflow fix --file src/buggy_module.py --auto""",
182
+ parents=[common_workflow_args],
183
+ )
184
+ quality_parser = workflow_subparsers.add_parser(
185
+ "quality",
186
+ help="Quality Improvement (code review cycle)",
187
+ description="""Comprehensive code quality improvement workflow.
188
+
189
+ Runs full code analysis, scoring, linting, type checking, and generates
190
+ detailed quality reports. Focuses on improving existing code without adding features.
191
+
192
+ Example: tapps-agents workflow quality --file src/legacy_code.py --auto""",
193
+ parents=[common_workflow_args],
194
+ )
195
+ # Simple Mode workflow aliases
196
+ new_feature_parser = workflow_subparsers.add_parser(
197
+ "new-feature",
198
+ help="Simple New Feature (build new features quickly)",
199
+ description="""Simplified workflow for building new features with automatic quality checks.
200
+
201
+ Coordinates: Enhancer → Planner → Implementer → Reviewer → Tester
202
+ Quality gates: Overall ≥65, Security ≥6.5
203
+
204
+ Example: tapps-agents workflow new-feature --prompt "Add user authentication" --auto""",
205
+ parents=[common_workflow_args],
206
+ )
207
+ improve_parser = workflow_subparsers.add_parser(
208
+ "improve",
209
+ help="Simple Improve Quality (code quality improvement)",
210
+ description="""Simplified workflow for improving code quality through review and refactoring.
211
+
212
+ Coordinates: Reviewer → Improver → Reviewer → Tester
213
+ Quality gates: Overall ≥75, Maintainability ≥8.0
214
+
215
+ Example: tapps-agents workflow improve --file src/legacy_code.py --auto""",
216
+ parents=[common_workflow_args],
217
+ )
218
+ hotfix_parser = workflow_subparsers.add_parser(
219
+ "hotfix",
220
+ help="Quick Fix (urgent, production bugs)",
221
+ description="""Minimal workflow for urgent production bug fixes.
222
+
223
+ Fastest execution path with essential testing only. Skips documentation and
224
+ extensive reviews. Use only for critical production issues requiring immediate fixes.
225
+
226
+ Example: tapps-agents workflow hotfix --file example_bug.py --auto""",
227
+ parents=[common_workflow_args],
228
+ )
229
+
230
+ # Voice-friendly aliases
231
+ workflow_subparsers.add_parser(
232
+ "enterprise",
233
+ help="Full SDLC Pipeline (alias for 'full' workflow)",
234
+ description="Alias for 'full' workflow - executes complete enterprise software development lifecycle pipeline with all quality gates, documentation, and compliance checks. Best for mission-critical projects requiring comprehensive oversight.",
235
+ parents=[common_workflow_args],
236
+ )
237
+ workflow_subparsers.add_parser(
238
+ "feature",
239
+ help="Rapid Development (alias for 'rapid' workflow)",
240
+ description="Alias for 'rapid' workflow - optimized for fast feature development in sprint cycles. Maintains code quality while prioritizing speed and delivery. Ideal for well-understood features with clear requirements.",
241
+ parents=[common_workflow_args],
242
+ )
243
+ workflow_subparsers.add_parser(
244
+ "refactor",
245
+ help="Maintenance & Bug Fixing (alias for 'fix' workflow)",
246
+ description="Alias for 'fix' workflow - focused on code maintenance, bug fixes, and technical debt reduction. Emphasizes targeted analysis, safe refactoring, and regression testing. Use for improving existing code without adding new features.",
247
+ parents=[common_workflow_args],
248
+ )
249
+ # Note: "improve" parser already added above (line 145), skipping duplicate
250
+ workflow_subparsers.add_parser(
251
+ "urgent",
252
+ help="Quick Fix (alias for 'hotfix' workflow)",
253
+ description="Alias for 'hotfix' workflow - minimal workflow for urgent production bug fixes requiring immediate resolution. Fastest execution path with essential testing only. Use only for critical production issues that cannot wait for full workflow.",
254
+ parents=[common_workflow_args],
255
+ )
256
+
257
+ # List command
258
+ list_parser = workflow_subparsers.add_parser(
259
+ "list",
260
+ help="List all available workflow presets with descriptions",
261
+ description="""Display all available workflow presets with detailed descriptions.
262
+
263
+ Shows both primary names and their aliases, along with:
264
+ • Purpose and use cases for each workflow
265
+ • When to use each workflow type
266
+ • Key differences between workflows
267
+ • Recommended scenarios for each preset
268
+
269
+ Use this command to discover which workflow best fits your current task.""",
270
+ )
271
+
272
+ # State management commands (Epic 12)
273
+ state_parser = workflow_subparsers.add_parser(
274
+ "state",
275
+ help="Workflow state management (list, show, cleanup, resume)",
276
+ description="""Manage workflow state persistence and resume capabilities.
277
+
278
+ Workflows can save their state at checkpoints, allowing you to:
279
+ • Resume interrupted workflows from the last checkpoint
280
+ • Inspect workflow state for debugging
281
+ • Clean up old or completed workflow states
282
+ • Track workflow execution history
283
+
284
+ Use state management to recover from failures or pause/resume long-running workflows.""",
285
+ )
286
+ state_subparsers = state_parser.add_subparsers(
287
+ dest="state_command", help="State management subcommand (list, show, cleanup, resume)", required=True
288
+ )
289
+
290
+ state_list_parser = state_subparsers.add_parser(
291
+ "list",
292
+ help="List all persisted workflow states with metadata",
293
+ description="Display all saved workflow states with their IDs, timestamps, status, and workflow type. Use --workflow-id to filter by specific workflow.",
294
+ )
295
+ state_list_parser.add_argument(
296
+ "--workflow-id",
297
+ help="Filter results to show only states for a specific workflow ID",
298
+ )
299
+ state_list_parser.add_argument(
300
+ "--format",
301
+ choices=["json", "text"],
302
+ default="text",
303
+ help="Output format: 'text' for human-readable, 'json' for programmatic use (default: text)",
304
+ )
305
+
306
+ state_show_parser = state_subparsers.add_parser(
307
+ "show",
308
+ help="Show detailed information about a specific workflow state",
309
+ description="Display complete details of a saved workflow state including all checkpoint data, execution context, and current step information. Useful for debugging or understanding workflow progress.",
310
+ )
311
+ state_show_parser.add_argument(
312
+ "workflow_id",
313
+ help="The workflow ID to inspect (obtain from 'workflow state list')",
314
+ )
315
+ state_show_parser.add_argument(
316
+ "--format",
317
+ choices=["json", "text"],
318
+ default="text",
319
+ help="Output format: 'text' for human-readable, 'json' for programmatic use (default: text)",
320
+ )
321
+
322
+ state_cleanup_parser = state_subparsers.add_parser(
323
+ "cleanup",
324
+ help="Remove old or completed workflow states to free up disk space",
325
+ description="""Clean up persisted workflow states based on retention policies.
326
+
327
+ Removes workflow states that are:
328
+ • Older than the retention period
329
+ • Exceed the maximum count per workflow
330
+ • Completed (if --remove-completed is set)
331
+
332
+ Use --dry-run first to preview what will be removed without making changes.""",
333
+ )
334
+ state_cleanup_parser.add_argument(
335
+ "--retention-days",
336
+ type=int,
337
+ default=30,
338
+ help="Keep workflow states newer than this many days. States older than this will be removed (default: 30 days)",
339
+ )
340
+ state_cleanup_parser.add_argument(
341
+ "--max-states-per-workflow",
342
+ type=int,
343
+ default=10,
344
+ help="Maximum number of states to keep per workflow. Older states beyond this limit will be removed (default: 10)",
345
+ )
346
+ state_cleanup_parser.add_argument(
347
+ "--remove-completed",
348
+ action="store_true",
349
+ default=True,
350
+ help="Remove states for workflows that have completed successfully (default: True). Set to False to keep completed workflow states for historical reference.",
351
+ )
352
+ state_cleanup_parser.add_argument(
353
+ "--dry-run",
354
+ action="store_true",
355
+ help="Preview what would be removed without actually deleting any states. Recommended before running actual cleanup.",
356
+ )
357
+
358
+ state_resume_parser = workflow_subparsers.add_parser(
359
+ "resume",
360
+ help="Resume a workflow from its last saved checkpoint",
361
+ description="""Resume workflow execution from the last saved checkpoint.
362
+
363
+ Recovers workflow state and continues execution from where it left off. Useful for:
364
+ • Recovering from interruptions or failures
365
+ • Resuming long-running workflows after system restarts
366
+ • Continuing workflows that were manually paused
367
+
368
+ If --workflow-id is not specified, resumes the most recent workflow. Use --validate to ensure state integrity before resuming.""",
369
+ )
370
+ state_resume_parser.add_argument(
371
+ "--workflow-id",
372
+ help="Specific workflow ID to resume. If not provided, resumes the most recently saved workflow state",
373
+ )
374
+ state_resume_parser.add_argument(
375
+ "--validate",
376
+ action="store_true",
377
+ default=True,
378
+ help="Validate state integrity and dependencies before resuming. Checks that all required files and context are still available (default: True).",
379
+ )
380
+ state_resume_parser.add_argument(
381
+ "--no-validate",
382
+ action="store_false",
383
+ dest="validate",
384
+ help="Skip state validation before resuming. Use only if you're certain the state is valid.",
385
+ )
386
+ state_resume_parser.add_argument(
387
+ "--max-steps",
388
+ type=int,
389
+ default=50,
390
+ help="Maximum number of steps to execute during resume (default: 50). Use to limit execution for testing or debugging.",
391
+ )
392
+
393
+ # Recommend command
394
+ recommend_parser = workflow_subparsers.add_parser(
395
+ "recommend",
396
+ help="Get AI-powered workflow recommendation based on project analysis",
397
+ description="""Analyze your project context and recommend the most appropriate workflow preset.
398
+
399
+ The system examines:
400
+ • Project structure and codebase state
401
+ • Recent changes and git history
402
+ • File types and complexity
403
+ • Existing tests and documentation
404
+ • Project size and maturity
405
+
406
+ In interactive mode, asks clarifying questions for ambiguous cases. Use --non-interactive for CI/CD or programmatic usage. Use --auto-load to automatically start the recommended workflow after confirmation.""",
407
+ )
408
+ recommend_parser.add_argument(
409
+ "--non-interactive",
410
+ action="store_true",
411
+ help="Non-interactive mode: return structured recommendation without prompting for user input. Recommended for CI/CD pipelines and automated scripts. Uses defaults for ambiguous cases.",
412
+ )
413
+ # Cleanup branches command
414
+ cleanup_branches_parser = workflow_subparsers.add_parser(
415
+ "cleanup-branches",
416
+ help="Clean up orphaned Git branches from workflow worktrees",
417
+ description="Detect and optionally delete orphaned Git branches that were created for workflow worktrees but no longer have associated worktrees.",
418
+ )
419
+ cleanup_branches_parser.add_argument(
420
+ "--dry-run",
421
+ action="store_true",
422
+ help="Preview which branches would be deleted without actually deleting them",
423
+ )
424
+ cleanup_branches_parser.add_argument(
425
+ "--retention-days",
426
+ type=int,
427
+ help="Override retention period (default: from config)",
428
+ )
429
+ cleanup_branches_parser.add_argument(
430
+ "--pattern",
431
+ type=str,
432
+ help="Branch pattern to match (e.g., 'workflow/*' or 'agent/*')",
433
+ )
434
+ cleanup_branches_parser.add_argument(
435
+ "--force",
436
+ action="store_true",
437
+ help="Skip confirmation prompt",
438
+ )
439
+ cleanup_branches_parser.add_argument(
440
+ "--format",
441
+ choices=["json", "text"],
442
+ default="text",
443
+ help="Output format (default: text)",
444
+ )
445
+
446
+ recommend_parser.add_argument(
447
+ "--format",
448
+ choices=["json", "text"],
449
+ default="text",
450
+ help="Output format: 'text' for human-readable recommendation, 'json' for structured data suitable for programmatic use (default: text)",
451
+ )
452
+ recommend_parser.add_argument(
453
+ "--auto-load",
454
+ action="store_true",
455
+ help="Automatically start the recommended workflow after displaying the recommendation. Prompts for confirmation unless --non-interactive is also set.",
456
+ )
457
+
458
+ # Brownfield system review command
459
+ brownfield_parser = subparsers.add_parser(
460
+ "brownfield",
461
+ help="Brownfield system analysis and expert creation",
462
+ description="""Analyze existing brownfield systems and automatically create experts with RAG knowledge bases.
463
+
464
+ This command performs:
465
+ • Codebase analysis (languages, frameworks, dependencies)
466
+ • Domain detection using DomainStackDetector
467
+ • Automatic expert configuration generation
468
+ • RAG knowledge base population from project docs and Context7
469
+
470
+ Examples:
471
+ tapps-agents brownfield review --auto
472
+ tapps-agents brownfield review --dry-run
473
+ tapps-agents brownfield review --no-context7
474
+ """,
475
+ )
476
+ brownfield_subparsers = brownfield_parser.add_subparsers(
477
+ dest="brownfield_command",
478
+ help="Brownfield command",
479
+ required=True,
480
+ )
481
+
482
+ review_parser = brownfield_subparsers.add_parser(
483
+ "review",
484
+ help="Review brownfield system and create experts",
485
+ description="""Perform complete brownfield review: analyze codebase, detect domains,
486
+ create expert configurations, and populate RAG knowledge bases.""",
487
+ )
488
+ review_parser.add_argument(
489
+ "--auto",
490
+ action="store_true",
491
+ help="Fully automated execution (skip prompts)",
492
+ )
493
+ review_parser.add_argument(
494
+ "--dry-run",
495
+ action="store_true",
496
+ help="Preview changes without applying",
497
+ )
498
+ review_parser.add_argument(
499
+ "--output-dir",
500
+ type=Path,
501
+ help="Output directory for reports (default: .tapps-agents/brownfield-review/)",
502
+ )
503
+ review_parser.add_argument(
504
+ "--no-context7",
505
+ action="store_true",
506
+ help="Skip Context7 library documentation fetching",
507
+ )
508
+ review_parser.add_argument(
509
+ "--resume",
510
+ action="store_true",
511
+ help="Resume from last saved state",
512
+ )
513
+ review_parser.add_argument(
514
+ "--resume-from",
515
+ choices=["analyze", "create_experts", "populate_rag"],
516
+ help="Resume from specific step",
517
+ )
518
+
519
+ # Short command for primary use case: create new project from prompt
520
+ create_parser = subparsers.add_parser(
521
+ "create",
522
+ help="Create a new project from description (PRIMARY USE CASE)",
523
+ description="""Create a complete, tested application from a natural language description.
524
+
525
+ This is the PRIMARY USE CASE for TappsCodingAgents. It's a shortcut for
526
+ 'workflow full --auto --prompt' that executes a fully automated SDLC pipeline.
527
+
528
+ The workflow will:
529
+ 1. Analyze requirements and gather specifications
530
+ 2. Design system architecture
531
+ 3. Generate implementation code
532
+ 4. Create comprehensive tests
533
+ 5. Review code quality
534
+ 6. Generate documentation
535
+ 7. Provide deployment guidance
536
+
537
+ Example:
538
+ tapps-agents create "Build a REST API for a todo app with user authentication"
539
+ tapps-agents create "Create a React dashboard with data visualization" --workflow rapid""",
540
+ )
541
+ create_parser.add_argument(
542
+ "prompt",
543
+ help="Natural language description of the project or application you want to build. Be as specific as possible about features, technologies, and requirements. Example: 'Build a REST API for a todo app with user authentication using FastAPI and PostgreSQL'",
544
+ )
545
+ create_parser.add_argument(
546
+ "--workflow",
547
+ default="full",
548
+ choices=["full", "rapid", "enterprise", "feature"],
549
+ help="Workflow preset to use: 'full' for complete SDLC (default), 'rapid'/'feature' for faster development, 'enterprise' for full pipeline with extra compliance checks (default: full)",
550
+ )
551
+ create_parser.add_argument(
552
+ "--cursor-mode",
553
+ action="store_true",
554
+ help="(Deprecated) Force Cursor mode for workflow execution. Cursor-first is now the default for workflows unless TAPPS_AGENTS_MODE is explicitly set (e.g., TAPPS_AGENTS_MODE=headless).",
555
+ )
556
+
557
+ # Cleanup command
558
+ cleanup_parser = subparsers.add_parser(
559
+ "cleanup",
560
+ help="Clean up TappsCodingAgents artifacts and data",
561
+ description="""Clean up various TappsCodingAgents artifacts to free disk space and reduce clutter.
562
+
563
+ Available cleanup operations:
564
+ • workflow-docs: Clean up old workflow documentation directories
565
+ • sessions: Clean up .tapps-agents/sessions (enhancer + long-running agent sessions)
566
+ • all: Run workflow-docs then sessions (all available cleanups)
567
+ """,
568
+ )
569
+ cleanup_subparsers = cleanup_parser.add_subparsers(
570
+ dest="cleanup_type",
571
+ help="Type of cleanup to perform",
572
+ )
573
+
574
+ # Workflow docs cleanup
575
+ workflow_docs_cleanup_parser = cleanup_subparsers.add_parser(
576
+ "workflow-docs",
577
+ help="Clean up old workflow documentation directories",
578
+ description="""Clean up old workflow documentation directories from docs/workflows/simple-mode/.
579
+
580
+ Keeps the N most recent workflows visible and archives workflows older than the retention period.
581
+ Archived workflows are moved to .tapps-agents/archives/workflows/ for reference.
582
+ """,
583
+ )
584
+ workflow_docs_cleanup_parser.add_argument(
585
+ "--keep-latest",
586
+ type=int,
587
+ default=None,
588
+ help="Keep N most recent workflows visible (default: from config, typically 5)",
589
+ )
590
+ workflow_docs_cleanup_parser.add_argument(
591
+ "--retention-days",
592
+ type=int,
593
+ default=None,
594
+ help="Archive workflows older than N days (default: from config, typically 30)",
595
+ )
596
+ workflow_docs_cleanup_parser.add_argument(
597
+ "--archive",
598
+ action="store_true",
599
+ default=None,
600
+ help="Enable archival of old workflows (default: from config)",
601
+ )
602
+ workflow_docs_cleanup_parser.add_argument(
603
+ "--no-archive",
604
+ action="store_true",
605
+ help="Disable archival (workflows will be kept visible)",
606
+ )
607
+ workflow_docs_cleanup_parser.add_argument(
608
+ "--dry-run",
609
+ action="store_true",
610
+ help="Preview changes without making them",
611
+ )
612
+
613
+ # Sessions cleanup (enhancer + SessionManager)
614
+ sessions_cleanup_parser = cleanup_subparsers.add_parser(
615
+ "sessions",
616
+ help="Clean up .tapps-agents/sessions (enhancer and long-running agent sessions)",
617
+ description="""Clean up session files in .tapps-agents/sessions/.
618
+
619
+ Removes zero-byte files, then prunes enhancer session JSONs by age and count.
620
+ Also runs SessionManager cleanup for long-running agent sessions (completed/failed older than max-age).
621
+ """,
622
+ )
623
+ sessions_cleanup_parser.add_argument(
624
+ "--keep-latest",
625
+ type=int,
626
+ default=None,
627
+ help="Keep N most recent enhancer session files (default: from config, typically 50)",
628
+ )
629
+ sessions_cleanup_parser.add_argument(
630
+ "--max-age-days",
631
+ type=int,
632
+ default=None,
633
+ help="Remove sessions older than N days (default: from config, typically 30)",
634
+ )
635
+ sessions_cleanup_parser.add_argument(
636
+ "--dry-run",
637
+ action="store_true",
638
+ help="Preview changes without making them",
639
+ )
640
+
641
+ # All cleanup (workflow-docs + sessions)
642
+ all_cleanup_parser = cleanup_subparsers.add_parser(
643
+ "all",
644
+ help="Run all cleanup operations (workflow-docs, then sessions)",
645
+ description="Run workflow-docs cleanup then sessions cleanup with config defaults.\nEquivalent to: cleanup workflow-docs && cleanup sessions",
646
+ )
647
+ all_cleanup_parser.add_argument(
648
+ "--dry-run",
649
+ action="store_true",
650
+ help="Preview changes without making them",
651
+ )
652
+
653
+ # Continuous bug fix command
654
+ continuous_bug_fix_parser = subparsers.add_parser(
655
+ "continuous-bug-fix",
656
+ aliases=["bug-fix-continuous"],
657
+ help="Continuously find and fix bugs (test-based or proactive)",
658
+ description="""Find bugs (from test failures or via code analysis), fix them using bug-fix-agent,
659
+ and commit fixes automatically. Stops when no bugs are found or max iterations reached.
660
+
661
+ Modes:
662
+ - Test-based (default): Run tests and fix failures
663
+ - Proactive (--proactive): Analyze code to find potential bugs without tests
664
+
665
+ Examples:
666
+ # Test-based discovery (default)
667
+ tapps-agents continuous-bug-fix
668
+ tapps-agents continuous-bug-fix --test-path tests/unit/ --max-iterations 5
669
+
670
+ # Proactive discovery (analyze code)
671
+ tapps-agents continuous-bug-fix --proactive --target-path src/
672
+ tapps-agents continuous-bug-fix --proactive --max-bugs 20 --max-iterations 10
673
+
674
+ # Batch commits
675
+ tapps-agents continuous-bug-fix --commit-strategy batch --no-commit""",
676
+ )
677
+ continuous_bug_fix_parser.add_argument(
678
+ "--test-path",
679
+ type=str,
680
+ default=None,
681
+ help="Test directory or file to run (default: tests/)",
682
+ )
683
+ continuous_bug_fix_parser.add_argument(
684
+ "--max-iterations",
685
+ type=int,
686
+ default=10,
687
+ help="Maximum loop iterations (default: 10)",
688
+ )
689
+ continuous_bug_fix_parser.add_argument(
690
+ "--commit-strategy",
691
+ choices=["one-per-bug", "batch"],
692
+ default="one-per-bug",
693
+ help="Commit strategy: one-per-bug (default) or batch",
694
+ )
695
+ continuous_bug_fix_parser.add_argument(
696
+ "--no-commit",
697
+ action="store_true",
698
+ help="Skip commits (dry-run mode)",
699
+ )
700
+ continuous_bug_fix_parser.add_argument(
701
+ "--format",
702
+ choices=["json", "text"],
703
+ default="text",
704
+ help="Output format (default: text)",
705
+ )
706
+ continuous_bug_fix_parser.add_argument(
707
+ "--proactive",
708
+ action="store_true",
709
+ help="Use proactive bug discovery (code analysis) instead of test-based discovery",
710
+ )
711
+ continuous_bug_fix_parser.add_argument(
712
+ "--target-path",
713
+ type=str,
714
+ default=None,
715
+ help="Directory or file to analyze (for proactive discovery, default: project root)",
716
+ )
717
+ continuous_bug_fix_parser.add_argument(
718
+ "--max-bugs",
719
+ type=int,
720
+ default=20,
721
+ help="Maximum bugs to find per iteration (for proactive discovery, default: 20)",
722
+ )
723
+
724
+ # Project initialization command
725
+ init_parser = subparsers.add_parser(
726
+ "init",
727
+ help="Initialize project: Set up Cursor Rules and workflow presets",
728
+ description="""Initialize a new project with TappsCodingAgents configuration.
729
+
730
+ Sets up all integration components for Cursor AI:
731
+ • Cursor Rules (.cursor/rules/) - Natural language workflow commands and project context
732
+ • Workflow Presets (workflows/presets/) - Reusable workflow definitions
733
+ • Configuration (.tapps-agents/config.yaml) - Project settings
734
+ • Cursor Skills (.claude/skills/) - Agent skill definitions
735
+ • Claude Desktop Commands (.claude/commands/) - Command definitions for Claude Desktop
736
+ • Context7 Cache - Pre-populated knowledge base cache
737
+ • .cursorignore - Exclude patterns for Cursor indexing
738
+
739
+ This command is safe to run multiple times - it won't overwrite existing files
740
+ unless you use --overwrite flags. Use --no-<component> to skip specific setups.
741
+
742
+ Important: Run init from your project root, not from the TappsCodingAgents framework
743
+ directory. Correct: cd /path/to/your-project && tapps-agents init. Wrong: cd .../TappsCodingAgents && tapps-agents init (creates config in the wrong place).
744
+
745
+ Upgrade/Reset Mode:
746
+ Use --reset or --upgrade to reset framework-managed files to the latest version
747
+ while preserving user data and customizations. Creates a backup by default.
748
+
749
+ Examples:
750
+ tapps-agents init # Initial setup
751
+ tapps-agents init --reset # Upgrade/reset framework files
752
+ tapps-agents init --reset --dry-run # Preview changes without making them
753
+ tapps-agents init --rollback <path> # Rollback from backup""",
754
+ )
755
+ init_parser.add_argument(
756
+ "--no-rules", action="store_true", help="Skip creating/updating .cursor/rules/ directory with natural language workflow commands and project context"
757
+ )
758
+ init_parser.add_argument(
759
+ "--no-presets", action="store_true", help="Skip creating workflow presets directory (workflows/presets/) with reusable workflow definitions"
760
+ )
761
+ init_parser.add_argument(
762
+ "--no-config", action="store_true", help="Skip creating .tapps-agents/config.yaml configuration file with project settings"
763
+ )
764
+ init_parser.add_argument(
765
+ "--no-skills",
766
+ action="store_true",
767
+ help="Skip installing Cursor Skills definitions in .claude/skills/ directory. Skills enable agent capabilities in Cursor AI.",
768
+ )
769
+ init_parser.add_argument(
770
+ "--no-cache",
771
+ action="store_true",
772
+ help="Skip pre-populating Context7 knowledge base cache. Cache speeds up library documentation lookups.",
773
+ )
774
+ # Generate rules command
775
+ generate_rules_parser = subparsers.add_parser(
776
+ "generate-rules",
777
+ help="Generate Cursor Rules documentation from workflow YAML files",
778
+ description="""Generate .cursor/rules/workflow-presets.mdc from workflow YAML definitions.
779
+
780
+ This command automatically generates Cursor Rules documentation by parsing workflow YAML files
781
+ and extracting metadata, steps, and quality gates. The generated documentation stays in sync
782
+ with workflow definitions, eliminating documentation drift.
783
+
784
+ Example: tapps-agents generate-rules""",
785
+ )
786
+ generate_rules_parser.add_argument(
787
+ "--output",
788
+ type=str,
789
+ help="Output file path (defaults to .cursor/rules/workflow-presets.mdc)",
790
+ )
791
+ generate_rules_parser.add_argument(
792
+ "--no-backup",
793
+ action="store_true",
794
+ help="Skip backing up existing rules file",
795
+ )
796
+
797
+ init_parser.add_argument(
798
+ "--no-cursorignore",
799
+ action="store_true",
800
+ help="Skip creating .cursorignore file to exclude patterns from Cursor AI indexing (e.g., node_modules, .git, build artifacts)",
801
+ )
802
+ init_parser.add_argument(
803
+ "--reset",
804
+ action="store_true",
805
+ help="Reset framework-managed files to latest version (upgrade mode). Detects existing installation and resets framework files while preserving user data and customizations.",
806
+ )
807
+ init_parser.add_argument(
808
+ "--upgrade",
809
+ action="store_true",
810
+ help="Upgrade installation (alias for --reset). Resets framework-managed files to latest version while preserving user data.",
811
+ )
812
+ init_parser.add_argument(
813
+ "--no-backup",
814
+ action="store_true",
815
+ help="Skip backup before reset (not recommended). Use with caution as this prevents rollback capability.",
816
+ )
817
+ init_parser.add_argument(
818
+ "--reset-mcp",
819
+ action="store_true",
820
+ help="Also reset .cursor/mcp.json to framework version. By default, MCP config is preserved.",
821
+ )
822
+ init_parser.add_argument(
823
+ "--preserve-custom",
824
+ action="store_true",
825
+ default=True,
826
+ help="Preserve custom Skills, Rules, and presets (default: True). Custom files not in framework whitelist are always preserved.",
827
+ )
828
+ init_parser.add_argument(
829
+ "--rollback",
830
+ type=str,
831
+ metavar="BACKUP_PATH",
832
+ help="Rollback an init reset from a backup. Provide path to backup directory (e.g., .tapps-agents/backups/init-reset-20250116-143022).",
833
+ )
834
+ init_parser.add_argument(
835
+ "--yes",
836
+ "-y",
837
+ action="store_true",
838
+ help="Automatically answer 'yes' to all confirmation prompts. Useful for CI/CD pipelines.",
839
+ )
840
+ init_parser.add_argument(
841
+ "--dry-run",
842
+ action="store_true",
843
+ help="Preview what would be reset without actually making changes. Shows framework files that would be deleted and files that would be preserved.",
844
+ )
845
+ init_parser.add_argument(
846
+ "--hooks",
847
+ action="store_true",
848
+ help="Create .tapps-agents/hooks.yaml from hook templates (all disabled) and .tapps-agents/context/ with template files. Without this, init creates minimal empty hooks.yaml only.",
849
+ )
850
+
851
+ # Environment diagnostics
852
+ doctor_parser = subparsers.add_parser(
853
+ "doctor",
854
+ help="Validate local environment and tools",
855
+ description="""Diagnose and validate your local development environment.
856
+
857
+ Checks for:
858
+ Python version and dependencies
859
+ • Required tools (ruff, mypy, pytest, etc.)
860
+ Configuration files (.tapps-agents/config.yaml)
861
+ Cursor integration components
862
+ • Cursor Skills configuration
863
+ File permissions and directory structure
864
+
865
+ By default, soft-degrades with warnings for missing optional components.
866
+ Use --format json for programmatic checking.
867
+
868
+ Example: tapps-agents doctor""",
869
+ )
870
+ doctor_parser.add_argument(
871
+ "--format", choices=["json", "text"], default="text", help="Output format: 'text' for human-readable diagnostics, 'json' for structured data suitable for programmatic checking (default: text)"
872
+ )
873
+ doctor_parser.add_argument(
874
+ "--config-path", help="Explicit path to .tapps-agents/config.yaml file if not in default location. Useful when running doctor from outside project root."
875
+ )
876
+ doctor_parser.add_argument(
877
+ "--full",
878
+ action="store_true",
879
+ help="Run both doctor checks and health checks for comprehensive diagnostics",
880
+ )
881
+ doctor_parser.add_argument(
882
+ "--suggest-fixes",
883
+ action="store_true",
884
+ help="Print suggested fix commands for warnings and errors (does not apply fixes)",
885
+ )
886
+
887
+ # Docs: print URL and optionally open in browser
888
+ docs_parser = subparsers.add_parser(
889
+ "docs",
890
+ help="Show documentation URL and optionally open in browser",
891
+ description="Print the TappsCodingAgents documentation URL. Use --open to open in the default browser.",
892
+ )
893
+ docs_parser.add_argument(
894
+ "--open",
895
+ action="store_true",
896
+ help="Open documentation in the default browser",
897
+ )
898
+
899
+ # Commands index (plan 4.1): list (command, skill, execution_path) from SkillAgentRegistry
900
+ commands_parser = subparsers.add_parser(
901
+ "commands",
902
+ help="List or export command index from SkillAgentRegistry",
903
+ )
904
+ commands_sub = commands_parser.add_subparsers(dest="command", help="Subcommand")
905
+ commands_list_parser = commands_sub.add_parser("list", help="List (command, skill, execution_path)")
906
+ commands_list_parser.add_argument("--format", choices=["json", "text"], default="text")
907
+ commands_list_parser.add_argument("--output", help="Write to file (e.g. docs/COMMAND_INDEX.md); format=text writes Markdown")
908
+
909
+ # Health check command
910
+ health_parser = subparsers.add_parser(
911
+ "health",
912
+ help="Comprehensive health checks for TappsCodingAgents",
913
+ description="""Run comprehensive health checks across all system dimensions.
914
+
915
+ Checks:
916
+ Environment readiness (Python, tools, config)
917
+ • Execution reliability (workflow success rates, performance)
918
+ Context7 cache effectiveness (hit rate, response time)
919
+ Knowledge base population (RAG/KB status)
920
+ • Governance safety (filtering)
921
+ Outcome trends (quality scores, improvements)
922
+
923
+ Use this to ensure tapps-agents is working at 100% capacity.
924
+ Health metrics are stored persistently for trend analysis.
925
+
926
+ Example: tapps-agents health check""",
927
+ )
928
+ health_subparsers = health_parser.add_subparsers(
929
+ dest="command", help="Health subcommand (check, dashboard, overview, metrics, trends, usage)", required=True
930
+ )
931
+
932
+ health_check_parser = health_subparsers.add_parser(
933
+ "check",
934
+ help="Run health checks",
935
+ description="Run all health checks or specific checks. Results are saved to metrics storage for trend analysis.",
936
+ )
937
+ health_check_parser.add_argument(
938
+ "--check",
939
+ choices=["environment", "automation", "execution", "context7_cache", "knowledge_base", "outcomes"],
940
+ help="Run a specific health check (default: all checks)",
941
+ )
942
+ health_check_parser.add_argument(
943
+ "--format",
944
+ choices=["json", "text"],
945
+ default="text",
946
+ help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
947
+ )
948
+ health_check_parser.add_argument(
949
+ "--save",
950
+ action="store_true",
951
+ default=True,
952
+ help="Save results to metrics storage (default: True)",
953
+ )
954
+ health_check_parser.add_argument(
955
+ "--no-save",
956
+ action="store_false",
957
+ dest="save",
958
+ help="Don't save results to metrics storage",
959
+ )
960
+
961
+ health_dashboard_parser = health_subparsers.add_parser(
962
+ "dashboard",
963
+ aliases=["show"],
964
+ help="Display health dashboard",
965
+ description="Show comprehensive health dashboard with all checks, overall status, and remediation actions.",
966
+ )
967
+ health_dashboard_parser.add_argument(
968
+ "--format",
969
+ choices=["json", "text"],
970
+ default="text",
971
+ help="Output format: 'text' for human-readable dashboard, 'json' for structured data (default: text)",
972
+ )
973
+
974
+ health_overview_parser = health_subparsers.add_parser(
975
+ "overview",
976
+ aliases=["summary"],
977
+ help="1000-foot view: health + usage for all subsystems (recommended)",
978
+ description="Single rolled-up report: overall health, each subsystem one line, then usage at a glance (system, top agents, top workflows). Easy to read, great for status at a glance.",
979
+ )
980
+ health_overview_parser.add_argument(
981
+ "--format",
982
+ choices=["json", "text"],
983
+ default="text",
984
+ help="Output format: 'text' for human-readable overview, 'json' for structured data (default: text)",
985
+ )
986
+
987
+ health_metrics_parser = health_subparsers.add_parser(
988
+ "metrics",
989
+ help="Show stored health metrics",
990
+ description="Display stored health metrics from previous checks. Supports filtering by check name, status, and time range.",
991
+ )
992
+ health_metrics_parser.add_argument(
993
+ "--check-name",
994
+ help="Filter by check name (e.g., 'environment', 'execution')",
995
+ )
996
+ health_metrics_parser.add_argument(
997
+ "--status",
998
+ choices=["healthy", "degraded", "unhealthy"],
999
+ help="Filter by status",
1000
+ )
1001
+ health_metrics_parser.add_argument(
1002
+ "--days",
1003
+ type=int,
1004
+ default=30,
1005
+ help="Number of days to look back (default: 30)",
1006
+ )
1007
+ health_metrics_parser.add_argument(
1008
+ "--format",
1009
+ choices=["json", "text"],
1010
+ default="text",
1011
+ help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
1012
+ )
1013
+
1014
+ health_trends_parser = health_subparsers.add_parser(
1015
+ "trends",
1016
+ help="Show health trends over time",
1017
+ description="Display health trends for specific checks over time. Helps identify improving or degrading health patterns.",
1018
+ )
1019
+ health_trends_parser.add_argument(
1020
+ "--check-name",
1021
+ required=True,
1022
+ help="Check name to analyze trends for (e.g., 'environment', 'execution')",
1023
+ )
1024
+ health_trends_parser.add_argument(
1025
+ "--days",
1026
+ type=int,
1027
+ default=7,
1028
+ help="Number of days to analyze (default: 7)",
1029
+ )
1030
+ health_trends_parser.add_argument(
1031
+ "--format",
1032
+ choices=["json", "text"],
1033
+ default="text",
1034
+ help="Output format: 'text' for human-readable trends, 'json' for structured data (default: text)",
1035
+ )
1036
+
1037
+ # Usage/analytics (formerly top-level analytics)
1038
+ usage_parser = health_subparsers.add_parser(
1039
+ "usage",
1040
+ help="Usage and analytics (agent/workflow metrics, trends, system status)",
1041
+ description="View usage and performance metrics for agents and workflows. Formerly available as 'tapps-agents analytics'. Use 'health usage dashboard' for a full overview.",
1042
+ )
1043
+ usage_subparsers = usage_parser.add_subparsers(
1044
+ dest="usage_subcommand",
1045
+ help="Usage subcommand (dashboard, agents, workflows, system, trends)",
1046
+ required=True,
1047
+ )
1048
+ usage_dashboard_p = usage_subparsers.add_parser(
1049
+ "dashboard",
1050
+ aliases=["show"],
1051
+ help="Display usage/analytics dashboard",
1052
+ )
1053
+ usage_dashboard_p.add_argument(
1054
+ "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1055
+ )
1056
+ usage_agents_p = usage_subparsers.add_parser("agents", help="Agent performance metrics")
1057
+ usage_agents_p.add_argument("--agent-id", help="Filter to a specific agent")
1058
+ usage_agents_p.add_argument(
1059
+ "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1060
+ )
1061
+ usage_workflows_p = usage_subparsers.add_parser("workflows", help="Workflow performance metrics")
1062
+ usage_workflows_p.add_argument("--workflow-id", help="Filter to a specific workflow")
1063
+ usage_workflows_p.add_argument(
1064
+ "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1065
+ )
1066
+ usage_trends_p = usage_subparsers.add_parser("trends", help="Historical trends")
1067
+ usage_trends_p.add_argument(
1068
+ "--metric-type",
1069
+ choices=["agent_duration", "workflow_duration", "agent_success_rate", "workflow_success_rate"],
1070
+ default="agent_duration",
1071
+ help="Metric to analyze (default: agent_duration)",
1072
+ )
1073
+ usage_trends_p.add_argument("--days", type=int, default=30, help="Days to look back (default: 30)")
1074
+ usage_trends_p.add_argument(
1075
+ "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1076
+ )
1077
+ usage_system_p = usage_subparsers.add_parser("system", help="System status and resource usage")
1078
+ usage_system_p.add_argument(
1079
+ "--format", choices=["json", "text"], default="text", help="Output format (default: text)",
1080
+ )
1081
+
1082
+ # Observability command
1083
+ observability_parser = subparsers.add_parser(
1084
+ "observability",
1085
+ help="Workflow observability: execution graphs, metrics, traces, and logs",
1086
+ description="""Comprehensive observability for workflow execution.
1087
+
1088
+ Provides:
1089
+ • Execution graphs (DOT, Mermaid, HTML)
1090
+ Metrics, traces, and logs correlation
1091
+ OpenTelemetry export
1092
+ Performance bottleneck identification
1093
+
1094
+ Examples:
1095
+ tapps-agents observability dashboard --workflow-id workflow-123
1096
+ tapps-agents observability graph workflow-123 --format mermaid
1097
+ tapps-agents observability otel workflow-123""",
1098
+ )
1099
+ observability_subparsers = observability_parser.add_subparsers(
1100
+ dest="observability_command",
1101
+ help="Observability subcommand (dashboard, graph, otel)",
1102
+ required=True,
1103
+ )
1104
+
1105
+ observability_dashboard_parser = observability_subparsers.add_parser(
1106
+ "dashboard",
1107
+ help="Generate observability dashboard",
1108
+ description="Generate comprehensive dashboard correlating metrics, traces, and logs.",
1109
+ )
1110
+ observability_dashboard_parser.add_argument(
1111
+ "--workflow-id",
1112
+ help="Workflow ID (if not provided, shows overview of all workflows)",
1113
+ )
1114
+ observability_dashboard_parser.add_argument(
1115
+ "--format",
1116
+ choices=["json", "text", "html"],
1117
+ default="text",
1118
+ help="Output format (default: text)",
1119
+ )
1120
+ observability_dashboard_parser.add_argument(
1121
+ "--output",
1122
+ type=Path,
1123
+ help="Output file path (default: stdout for text/json, .tapps-agents/observability/ for html)",
1124
+ )
1125
+
1126
+ observability_graph_parser = observability_subparsers.add_parser(
1127
+ "graph",
1128
+ help="Generate execution graph",
1129
+ description="Generate execution graph for a workflow in various formats.",
1130
+ )
1131
+ observability_graph_parser.add_argument(
1132
+ "workflow_id",
1133
+ help="Workflow ID (required)",
1134
+ )
1135
+ observability_graph_parser.add_argument(
1136
+ "--format",
1137
+ choices=["dot", "mermaid", "html", "summary"],
1138
+ default="dot",
1139
+ help="Output format (default: dot)",
1140
+ )
1141
+ observability_graph_parser.add_argument(
1142
+ "--output",
1143
+ type=Path,
1144
+ help="Output file path (default: .tapps-agents/observability/graphs/)",
1145
+ )
1146
+
1147
+ observability_otel_parser = observability_subparsers.add_parser(
1148
+ "otel",
1149
+ help="Export OpenTelemetry trace",
1150
+ description="Export workflow execution trace to OpenTelemetry format for external tools.",
1151
+ )
1152
+ observability_otel_parser.add_argument(
1153
+ "workflow_id",
1154
+ help="Workflow ID (required)",
1155
+ )
1156
+ observability_otel_parser.add_argument(
1157
+ "--output",
1158
+ type=Path,
1159
+ help="Output file path (default: .tapps-agents/observability/otel/)",
1160
+ )
1161
+
1162
+ # Install dev tools command
1163
+ install_dev_parser = subparsers.add_parser(
1164
+ "install-dev",
1165
+ help="Install development tools and dependencies required by TappsCodingAgents",
1166
+ description="""Install all development dependencies via pip including:
1167
+ • ruff - Fast Python linter and formatter
1168
+ mypy - Static type checker
1169
+ • pytest - Testing framework
1170
+ • pip-audit - Security vulnerability scanner for dependencies
1171
+ • pipdeptree - Dependency tree visualization
1172
+
1173
+ Automatically detects if you're in a development context (has pyproject.toml) or using the installed package. Use --dry-run to preview what will be installed.""",
1174
+ )
1175
+ install_dev_parser.add_argument(
1176
+ "--dry-run",
1177
+ action="store_true",
1178
+ help="Preview what packages would be installed without actually installing them. Useful for checking compatibility or reviewing dependencies before installation.",
1179
+ )
1180
+
1181
+ # Quick shortcuts for common commands
1182
+ score_parser = subparsers.add_parser(
1183
+ "score",
1184
+ help="Quick shortcut: Score a code file (same as 'reviewer score')",
1185
+ description="""Quick shortcut to score code files for quality metrics.
1186
+
1187
+ Equivalent to 'reviewer score <file>'. Calculates objective quality scores
1188
+ including complexity, security, maintainability, and test coverage metrics.
1189
+
1190
+ Returns scores from 0-100 for:
1191
+ • Overall Quality Score
1192
+ • Complexity Score (lower is better)
1193
+ Security Score
1194
+ Maintainability Score
1195
+ • Test Coverage (if tests exist)
1196
+
1197
+ Example:
1198
+ tapps-agents score src/main.py
1199
+ tapps-agents score src/main.py --format json""",
1200
+ )
1201
+ score_parser.add_argument("file", help="Path to the Python code file to analyze and score. Can be a relative or absolute path.")
1202
+ score_parser.add_argument(
1203
+ "--format", choices=["json", "text"], default="text", help="Output format: 'text' for human-readable scores, 'json' for structured data (default: text)"
1204
+ )
1205
+
1206
+ # Unified status command
1207
+ status_parser = subparsers.add_parser(
1208
+ "status",
1209
+ help="Unified status command for workflows and system",
1210
+ description="""Consolidated status command showing workflow activity and system status.
1211
+
1212
+ Shows:
1213
+ • Active worktrees and their status
1214
+ • Progress files and execution status
1215
+ Recent results
1216
+
1217
+ Use --detailed for full information, --worktrees-only for worktree info only.
1218
+
1219
+ Examples:
1220
+ tapps-agents status
1221
+ tapps-agents status --detailed
1222
+ tapps-agents status --worktrees-only
1223
+ tapps-agents status --format json""",
1224
+ )
1225
+ status_parser.add_argument(
1226
+ "--detailed",
1227
+ action="store_true",
1228
+ help="Show detailed information including full progress data and workflow state",
1229
+ )
1230
+ status_parser.add_argument(
1231
+ "--worktrees-only",
1232
+ action="store_true",
1233
+ help="Show only worktree information",
1234
+ )
1235
+ status_parser.add_argument(
1236
+ "--format",
1237
+ choices=["json", "text"],
1238
+ default="text",
1239
+ help="Output format: 'text' for human-readable, 'json' for structured data (default: text)",
1240
+ )
1241
+
1242
+ # Expert setup wizard commands
1243
+ setup_experts_parser = subparsers.add_parser(
1244
+ "setup-experts",
1245
+ help="Interactive wizard for configuring Industry Experts",
1246
+ description="""Configure Industry Experts for domain-specific knowledge and decision-making.
1247
+
1248
+ Industry Experts provide specialized knowledge in specific domains (e.g., AI frameworks, code quality, architecture, DevOps). They enhance agent decision-making with weighted expertise. Use this wizard to:
1249
+ Initialize expert configuration for your project
1250
+ • Add new domain experts
1251
+ • Remove experts that are no longer needed
1252
+ • List currently configured experts
1253
+
1254
+ Experts are configured in .tapps-agents/experts.yaml and can be referenced by agents during execution.""",
1255
+ )
1256
+ setup_experts_parser.add_argument(
1257
+ "-y",
1258
+ "--yes",
1259
+ action="store_true",
1260
+ help="Automatically answer 'yes' to all confirmation prompts. Useful for Cursor AI integration and CI/CD pipelines where user interaction is not possible.",
1261
+ )
1262
+ setup_experts_parser.add_argument(
1263
+ "--non-interactive",
1264
+ action="store_true",
1265
+ help="Non-interactive mode: use default values where possible and error if user input is required. Prevents any prompts from appearing.",
1266
+ )
1267
+ setup_experts_subparsers = setup_experts_parser.add_subparsers(
1268
+ dest="command", help="Expert setup subcommand (init, add, remove, list)"
1269
+ )
1270
+
1271
+ setup_experts_subparsers.add_parser(
1272
+ "init", aliases=["initialize"], help="Initialize project with expert configuration setup", description="Set up initial expert configuration for your project. Creates .tapps-agents/experts.yaml with default or recommended experts based on project analysis."
1273
+ )
1274
+ setup_experts_subparsers.add_parser("add", help="Add a new Industry Expert to the project", description="Add a new domain expert to your project configuration. Prompts for expert name, domain, knowledge base location, and weight.")
1275
+ setup_experts_subparsers.add_parser("remove", help="Remove an expert from the project configuration", description="Remove an Industry Expert from .tapps-agents/experts.yaml. The expert will no longer be consulted by agents.")
1276
+ setup_experts_subparsers.add_parser("list", help="List all currently configured experts", description="Display all Industry Experts currently configured in the project, including their domains, weights, and knowledge base locations.")
1277
+
1278
+ # Background Agent configuration commands removed - Background Agents no longer used
1279
+ # All parser code for background-agent-config command has been removed
1280
+
1281
+ # Customization template generator command
1282
+ customize_parser = subparsers.add_parser(
1283
+ "customize",
1284
+ help="Generate agent customization file templates",
1285
+ description="""Generate customization file templates for agents to override default behaviors.
1286
+
1287
+ Customizations allow you to modify agent behavior without changing the base framework code:
1288
+ Override default prompts and instructions
1289
+ • Customize tool selection preferences
1290
+ Adjust model selection criteria
1291
+ Add project-specific guidelines
1292
+
1293
+ Customization files are stored in .tapps-agents/customizations/ and take precedence over default agent definitions.""",
1294
+ )
1295
+ customize_subparsers = customize_parser.add_subparsers(
1296
+ dest="command", help="Customization subcommand (init/generate)"
1297
+ )
1298
+
1299
+ init_customize_parser = customize_subparsers.add_parser(
1300
+ "init",
1301
+ aliases=["generate"],
1302
+ help="Generate a customization file template for a specific agent",
1303
+ description="Create a customization template file for the specified agent. The template includes all customizable aspects with comments explaining each option. Edit the generated file to customize agent behavior for your project.",
1304
+ )
1305
+ init_customize_parser.add_argument(
1306
+ "agent_id",
1307
+ help="Agent ID to customize (e.g., 'implementer', 'reviewer', 'tester', 'planner'). Must be a valid agent type from the framework.",
1308
+ )
1309
+ init_customize_parser.add_argument(
1310
+ "--overwrite",
1311
+ action="store_true",
1312
+ help="Overwrite existing customization file if one already exists. Without this flag, the command will fail if a customization file for this agent already exists.",
1313
+ )
1314
+
1315
+ # Custom Skill commands
1316
+ skill_parser = subparsers.add_parser(
1317
+ "skill",
1318
+ help="Custom Skill management commands",
1319
+ description="""Manage custom Skills for extending framework capabilities.
1320
+
1321
+ Skills are domain-specific agent extensions that can be used in Cursor AI. They define:
1322
+ Agent capabilities and tools
1323
+ • Domain-specific knowledge
1324
+ Custom instructions and prompts
1325
+ • Model profiles and configurations
1326
+
1327
+ Use this command to validate existing Skills or generate new Skill templates.""",
1328
+ )
1329
+ skill_subparsers = skill_parser.add_subparsers(
1330
+ dest="skill_command",
1331
+ help="Skill management subcommand (validate, template)",
1332
+ )
1333
+
1334
+ # Skill validation command
1335
+ skill_validate_parser = skill_subparsers.add_parser(
1336
+ "validate",
1337
+ help="Validate custom Skills for correctness and completeness",
1338
+ description="""Validate custom Skills for format, schema, and capability correctness.
1339
+
1340
+ Checks:
1341
+ • SKILL.md format and required sections
1342
+ Valid agent type references
1343
+ • Tool capability definitions
1344
+ • Model profile configurations
1345
+ • File structure and organization
1346
+
1347
+ Use --skill to validate a specific Skill, or validate all Skills in .claude/skills/ by default. Use --no-warnings to show only errors.""",
1348
+ )
1349
+ skill_validate_parser.add_argument(
1350
+ "--skill",
1351
+ help="Path to a specific Skill directory (e.g., .claude/skills/my-skill/) or SKILL.md file to validate. If not provided, validates all Skills in .claude/skills/",
1352
+ )
1353
+ skill_validate_parser.add_argument(
1354
+ "--no-warnings",
1355
+ action="store_true",
1356
+ help="Show only errors and hide warnings. Useful for strict validation in CI/CD pipelines.",
1357
+ )
1358
+ skill_validate_parser.add_argument(
1359
+ "--format",
1360
+ choices=["text", "json"],
1361
+ default="text",
1362
+ help="Output format: 'text' for human-readable validation results, 'json' for structured error data (default: text)",
1363
+ )
1364
+
1365
+ # Custom Skill template generator command (as subcommand)
1366
+ skill_template_parser = skill_subparsers.add_parser(
1367
+ "template",
1368
+ help="Generate a custom Skill template for Cursor AI integration",
1369
+ description="""Generate a custom Skill template that can be used in Cursor AI.
1370
+
1371
+ Skills extend the framework's capabilities with domain-specific agents. The template includes:
1372
+ • SKILL.md with agent definition
1373
+ Capability descriptions
1374
+ • Tool access configurations
1375
+ • Model profile settings
1376
+ Example usage patterns
1377
+
1378
+ Use --interactive for guided setup, or provide options directly via command-line arguments.""",
1379
+ )
1380
+
1381
+ # Also keep the old skill-template command for backward compatibility
1382
+ skill_template_legacy_parser = subparsers.add_parser(
1383
+ "skill-template",
1384
+ help="Generate custom Skill template for Cursor Skills (legacy command, use 'skill template')",
1385
+ description="""Generate a custom Skill template that can be used in Cursor AI. Skills extend the framework's capabilities with domain-specific agents.
1386
+
1387
+ NOTE: This is a legacy command. For new code, use 'skill template' instead. This command is maintained for backward compatibility.""",
1388
+ )
1389
+ # Copy arguments to legacy parser
1390
+ skill_template_legacy_parser.add_argument(
1391
+ "skill_name",
1392
+ help="Name of the Skill (e.g., 'my-custom-skill', 'data-science-helper'). Must be a valid directory name. Will be created in .claude/skills/",
1393
+ )
1394
+ skill_template_legacy_parser.add_argument(
1395
+ "--type",
1396
+ choices=AGENT_TYPES,
1397
+ help="Base agent type for template defaults. Determines default capabilities and tool access. Choose from: analyst, architect, debugger, designer, documenter, enhancer, evaluator, implementer, improver, ops, orchestrator, planner, reviewer, tester",
1398
+ )
1399
+ skill_template_legacy_parser.add_argument(
1400
+ "--description",
1401
+ help="Custom description of what the Skill does and when to use it. This appears in Cursor AI's Skill selection interface.",
1402
+ )
1403
+ skill_template_legacy_parser.add_argument(
1404
+ "--tools",
1405
+ nargs="+",
1406
+ choices=TOOL_OPTIONS,
1407
+ help="Space-separated list of tools the Skill can access. Available tools: Read, Write, Edit, Grep, Glob, Bash, CodebaseSearch, Terminal. Omit to use defaults for the agent type.",
1408
+ )
1409
+ skill_template_legacy_parser.add_argument(
1410
+ "--capabilities",
1411
+ nargs="+",
1412
+ choices=CAPABILITY_CATEGORIES,
1413
+ help="Space-separated list of capability categories. Available: code_generation, code_review, testing, documentation, debugging, refactoring, analysis, architecture, design, planning. Omit to use defaults for the agent type.",
1414
+ )
1415
+ skill_template_legacy_parser.add_argument(
1416
+ "--model-profile",
1417
+ help="Model profile name to use for this Skill. If not provided, defaults to '{skill_name}_profile'. Model profiles define which LLM models to use and their configurations.",
1418
+ )
1419
+ skill_template_legacy_parser.add_argument(
1420
+ "--overwrite",
1421
+ action="store_true",
1422
+ help="Overwrite existing Skill directory and files if they already exist. Without this flag, the command will fail if the Skill already exists.",
1423
+ )
1424
+ skill_template_legacy_parser.add_argument(
1425
+ "--interactive",
1426
+ action="store_true",
1427
+ help="Interactive mode: prompt for all options with helpful descriptions. Recommended for first-time Skill creation. If not set, uses provided arguments or defaults.",
1428
+ )
1429
+
1430
+ skill_template_parser.add_argument(
1431
+ "skill_name",
1432
+ help="Name of the Skill (e.g., 'my-custom-skill', 'data-science-helper'). Must be a valid directory name. Will be created in .claude/skills/",
1433
+ )
1434
+ skill_template_parser.add_argument(
1435
+ "--type",
1436
+ choices=AGENT_TYPES,
1437
+ help="Base agent type for template defaults. Determines default capabilities and tool access. Choose from: analyst, architect, debugger, designer, documenter, enhancer, evaluator, implementer, improver, ops, orchestrator, planner, reviewer, tester",
1438
+ )
1439
+ skill_template_parser.add_argument(
1440
+ "--description",
1441
+ help="Custom description of what the Skill does and when to use it. This appears in Cursor AI's Skill selection interface.",
1442
+ )
1443
+ skill_template_parser.add_argument(
1444
+ "--tools",
1445
+ nargs="+",
1446
+ choices=TOOL_OPTIONS,
1447
+ help="Space-separated list of tools the Skill can access. Available tools: Read, Write, Edit, Grep, Glob, Bash, CodebaseSearch, Terminal. Omit to use defaults for the agent type.",
1448
+ )
1449
+ skill_template_parser.add_argument(
1450
+ "--capabilities",
1451
+ nargs="+",
1452
+ choices=CAPABILITY_CATEGORIES,
1453
+ help="Space-separated list of capability categories. Available: code_generation, code_review, testing, documentation, debugging, refactoring, analysis, architecture, design, planning. Omit to use defaults for the agent type.",
1454
+ )
1455
+ skill_template_parser.add_argument(
1456
+ "--model-profile",
1457
+ help="Model profile name to use for this Skill. If not provided, defaults to '{skill_name}_profile'. Model profiles define which LLM models to use and their configurations.",
1458
+ )
1459
+ skill_template_parser.add_argument(
1460
+ "--overwrite",
1461
+ action="store_true",
1462
+ help="Overwrite existing Skill directory and files if they already exist. Without this flag, the command will fail if the Skill already exists.",
1463
+ )
1464
+ skill_template_parser.add_argument(
1465
+ "--interactive",
1466
+ action="store_true",
1467
+ help="Interactive mode: prompt for all options with helpful descriptions. Recommended for first-time Skill creation. If not set, uses provided arguments or defaults.",
1468
+ )
1469
+
1470
+ # Cursor integration verification command
1471
+ cursor_parser = subparsers.add_parser(
1472
+ "cursor",
1473
+ help="Cursor AI integration verification and management",
1474
+ description="""Verify and manage Cursor AI integration components.
1475
+
1476
+ Checks the status of:
1477
+ • Cursor Skills (.claude/skills/) - Agent capability definitions
1478
+ Cursor Rules (.cursor/rules/) - Natural language workflow commands and project context
1479
+ • Configuration files and directory structure
1480
+
1481
+ Use this to ensure all Cursor integration components are properly installed and configured for your project.""",
1482
+ )
1483
+ cursor_subparsers = cursor_parser.add_subparsers(
1484
+ dest="cursor_command",
1485
+ help="Cursor integration subcommand (verify/check)",
1486
+ required=True,
1487
+ )
1488
+
1489
+ cursor_verify_parser = cursor_subparsers.add_parser(
1490
+ "verify",
1491
+ aliases=["check"],
1492
+ help="Verify all Cursor AI integration components are properly configured",
1493
+ description="""Verify that all Cursor AI integration components are properly installed and configured.
1494
+
1495
+ Performs comprehensive checks:
1496
+ Validates Skills directory structure and files
1497
+ • Checks Cursor Rules file presence and format
1498
+ • Verifies required directories exist
1499
+ • Checks file permissions and accessibility
1500
+
1501
+ Reports any missing components, configuration errors, or issues that would prevent Cursor from using TappsCodingAgents features.""",
1502
+ )
1503
+ cursor_verify_parser.add_argument(
1504
+ "--format",
1505
+ choices=["json", "text"],
1506
+ default="text",
1507
+ help="Output format: 'text' for human-readable verification report, 'json' for structured validation data (default: text)",
1508
+ )
1509
+
1510
+ # Beads (bd) passthrough
1511
+ beads_parser = subparsers.add_parser(
1512
+ "beads",
1513
+ help="Forward to Beads (bd) for task tracking. Requires bd in tools/bd or on PATH.",
1514
+ description="Run bd (Beads) for dependency-aware task tracking. See docs/BEADS_INTEGRATION.md.",
1515
+ )
1516
+ beads_parser.add_argument(
1517
+ "bd_args",
1518
+ nargs=argparse.REMAINDER,
1519
+ help='Arguments passed to bd (e.g. ready, create "Title" -p 0)',
1520
+ )
1521
+
1522
+ # Task management (task specs, hydration, run workflow from spec)
1523
+ task_parser = subparsers.add_parser(
1524
+ "task",
1525
+ help="Task management: create, list, show, update, close, hydrate, dehydrate, run",
1526
+ description="Manage task specs in .tapps-agents/task-specs/ and sync with Beads. Hydrate creates Beads issues from specs; dehydrate updates specs from Beads.",
1527
+ )
1528
+ task_subparsers = task_parser.add_subparsers(
1529
+ dest="task_command",
1530
+ help="Task subcommand",
1531
+ required=True,
1532
+ )
1533
+ task_create_p = task_subparsers.add_parser("create", help="Create a task spec (and optionally Beads issue)")
1534
+ task_create_p.add_argument("id", help="Task ID (e.g. enh-002-s1)")
1535
+ task_create_p.add_argument("--title", "-t", required=True, help="Task title")
1536
+ task_create_p.add_argument("--description", "-d", default="", help="Task description")
1537
+ task_create_p.add_argument("--workflow", default="build", help="Workflow to run (default: build)")
1538
+ task_create_p.add_argument("--beads", action="store_true", help="Also create Beads issue (hydrate)")
1539
+ task_list_p = task_subparsers.add_parser("list", help="List task specs with optional status filter")
1540
+ task_list_p.add_argument("--status", choices=["todo", "in-progress", "done", "blocked"], help="Filter by status")
1541
+ task_list_p.add_argument("--format", choices=["json", "text"], default="text", help="Output format (default: text)")
1542
+ task_show_p = task_subparsers.add_parser("show", help="Show a task spec and Beads status")
1543
+ task_show_p.add_argument("id", help="Task ID")
1544
+ task_update_p = task_subparsers.add_parser("update", help="Update task spec (e.g. status)")
1545
+ task_update_p.add_argument("id", help="Task ID")
1546
+ task_update_p.add_argument("--status", choices=["todo", "in-progress", "done", "blocked"], help="Set status")
1547
+ task_close_p = task_subparsers.add_parser("close", help="Close task (set status to done)")
1548
+ task_close_p.add_argument("id", help="Task ID")
1549
+ task_hydrate_p = task_subparsers.add_parser("hydrate", help="Create Beads issues from task specs")
1550
+ task_hydrate_p.add_argument("--force", action="store_true", help="Re-create or update Beads issues")
1551
+ task_dehydrate_p = task_subparsers.add_parser("dehydrate", help="Update task specs from Beads status")
1552
+ task_run_p = task_subparsers.add_parser("run", help="Run workflow from task spec and update spec on completion")
1553
+ task_run_p.add_argument("id", help="Task ID")
1554
+
1555
+ # Simple Mode commands
1556
+ simple_mode_parser = subparsers.add_parser(
1557
+ "simple-mode",
1558
+ help="Simple Mode commands (toggle, status)",
1559
+ description="""Manage Simple Mode - a simplified interface that hides complexity while showcasing power.
1560
+
1561
+ Simple Mode provides intent-based agent orchestration:
1562
+ Build: Create new features (planner → architect → designer → implementer)
1563
+ Review: Code review and quality checks (reviewer → improver)
1564
+ Fix: Debug and fix issues (debugger → implementer → tester)
1565
+ Test: Generate and run tests (tester)
1566
+
1567
+ Use natural language commands instead of agent-specific syntax.""",
1568
+ )
1569
+ simple_mode_subparsers = simple_mode_parser.add_subparsers(
1570
+ dest="command",
1571
+ help="Simple Mode command",
1572
+ required=True,
1573
+ metavar="COMMAND",
1574
+ )
1575
+
1576
+ # Simple Mode: on/off
1577
+ simple_mode_on_parser = simple_mode_subparsers.add_parser(
1578
+ "on",
1579
+ help="Enable Simple Mode",
1580
+ )
1581
+ simple_mode_off_parser = simple_mode_subparsers.add_parser(
1582
+ "off",
1583
+ help="Disable Simple Mode",
1584
+ )
1585
+ simple_mode_status_parser = simple_mode_subparsers.add_parser(
1586
+ "status",
1587
+ help="Check Simple Mode status",
1588
+ )
1589
+ simple_mode_status_parser.add_argument(
1590
+ "--format",
1591
+ choices=["json", "text"],
1592
+ default="text",
1593
+ help="Output format (default: text)",
1594
+ )
1595
+ simple_mode_init_parser = simple_mode_subparsers.add_parser(
1596
+ "init",
1597
+ help="Initialize Simple Mode with guided onboarding",
1598
+ description="""Run the Simple Mode onboarding wizard to get started quickly.
1599
+
1600
+ The wizard will:
1601
+ Detect your project type automatically
1602
+ Configure Simple Mode settings
1603
+ Suggest your first command
1604
+ Show a quick demonstration
1605
+ Celebrate your success! 🎉
1606
+ """,
1607
+ )
1608
+ simple_mode_configure_parser = simple_mode_subparsers.add_parser(
1609
+ "configure",
1610
+ aliases=["config"],
1611
+ help="Configure Simple Mode settings interactively",
1612
+ description="""Run the configuration wizard to customize Simple Mode settings.
1613
+
1614
+ The wizard will guide you through:
1615
+ Basic settings (enable/disable, natural language, etc.)
1616
+ Quality thresholds
1617
+ Advanced options
1618
+ """,
1619
+ )
1620
+ simple_mode_progress_parser = simple_mode_subparsers.add_parser(
1621
+ "progress",
1622
+ help="Show your Simple Mode learning progression",
1623
+ description="""Display your learning progression, usage statistics, and unlocked features.
1624
+
1625
+ Shows:
1626
+ Current level (Beginner, Intermediate, Advanced)
1627
+ • Total commands used
1628
+ • Commands to next level
1629
+ Features unlocked
1630
+ Usage breakdown by command type
1631
+ """,
1632
+ )
1633
+ simple_mode_full_parser = simple_mode_subparsers.add_parser(
1634
+ "full",
1635
+ help="Run full lifecycle workflow with adaptive checkpoints and quality loopbacks",
1636
+ description="""Execute the complete development lifecycle with automatic quality loopbacks and adaptive checkpoints.
1637
+
1638
+ This workflow runs the full SDLC pipeline (5-9 steps, adaptive):
1639
+ Requirements gathering
1640
+ • Planning and story creation
1641
+ ✓ Checkpoint 2: May switch to simpler workflow if task complexity is low
1642
+ • Architecture design
1643
+ • API design
1644
+ Implementation
1645
+ • Code review with quality gates
1646
+ • Test generation and execution
1647
+ ✓ Checkpoint 3: May skip security/docs if quality score ≥ 80
1648
+ • Security scanning (optional)
1649
+ Documentation generation (optional)
1650
+
1651
+ Features:
1652
+ Automatic loopbacks if code quality scores aren't good enough
1653
+ Test execution with retry logic
1654
+ • Security validation with remediation
1655
+ Adaptive checkpoints optimize workflow (saves 20K-40K tokens)
1656
+ Final quality review before completion
1657
+
1658
+ Checkpoints:
1659
+ After Enhance: Early mismatch detection (70% confidence)
1660
+ After Planning: Task complexity analysis (85% confidence)
1661
+ After Test: Quality gate for early termination (90% confidence)
1662
+
1663
+ The workflow will automatically retry and improve code until quality thresholds are met.
1664
+ Use --no-auto-checkpoint to disable checkpoint optimization.""",
1665
+ )
1666
+ simple_mode_full_parser.add_argument(
1667
+ "--prompt", "-p",
1668
+ help="Natural language description of what to build or implement. Required for greenfield workflows.",
1669
+ )
1670
+ simple_mode_full_parser.add_argument(
1671
+ "--file",
1672
+ help="Target file or directory path for workflows that operate on existing code.",
1673
+ )
1674
+ simple_mode_full_parser.add_argument(
1675
+ "--auto",
1676
+ action="store_true",
1677
+ help="Enable fully automated execution mode. Skips all interactive prompts.",
1678
+ )
1679
+ simple_mode_full_parser.add_argument(
1680
+ "--no-auto-checkpoint",
1681
+ action="store_true",
1682
+ help="Disable automatic workflow checkpoint detection and switching.",
1683
+ )
1684
+ simple_mode_full_parser.add_argument(
1685
+ "--checkpoint-debug",
1686
+ action="store_true",
1687
+ help="Enable verbose checkpoint logging for debugging.",
1688
+ )
1689
+
1690
+ # Simple Mode: build
1691
+ simple_mode_build_parser = simple_mode_subparsers.add_parser(
1692
+ "build",
1693
+ help="Build new features with adaptive checkpoints and Simple Mode workflow",
1694
+ description="""Build new features using the Simple Mode build workflow with adaptive checkpoints.
1695
+
1696
+ This workflow executes (3-7 steps, adaptive):
1697
+ • Step 1: Enhance prompt (requirements analysis)
1698
+ ✓ Checkpoint 1: Early validation - may switch to simpler workflow
1699
+ • Step 2: Create user stories
1700
+ • Step 3: Design architecture
1701
+ Checkpoint 2: Task complexity analysis - may switch to *fix if simple
1702
+ • Step 4: Design API/data models
1703
+ • Step 5: Implement code
1704
+ • Step 6: Review code quality
1705
+ • Step 7: Generate tests
1706
+ Checkpoint 3: Quality gate - may skip optional steps if quality ≥ 80
1707
+
1708
+ Checkpoints:
1709
+ • Automatically detect when task is simpler than expected
1710
+ • Switch to appropriate workflow with user confirmation
1711
+ Skip optional steps when quality is excellent
1712
+ • Save 20K-40K tokens per optimization
1713
+
1714
+ Use --fast to skip documentation steps (1-4) for faster iteration.
1715
+ Use --no-auto-checkpoint to disable checkpoint optimization.""",
1716
+ )
1717
+ simple_mode_build_parser.add_argument(
1718
+ "--prompt", "-p",
1719
+ required=True,
1720
+ help="Natural language description of the feature to build",
1721
+ )
1722
+ simple_mode_build_parser.add_argument(
1723
+ "--file",
1724
+ help="Target file path for implementation",
1725
+ )
1726
+ simple_mode_build_parser.add_argument(
1727
+ "--fast",
1728
+ action="store_true",
1729
+ help="Skip documentation steps (1-4) for 50-70%% faster execution",
1730
+ )
1731
+ simple_mode_build_parser.add_argument(
1732
+ "--preset",
1733
+ choices=["minimal", "standard", "comprehensive"],
1734
+ help="Workflow depth: minimal (enhance->implement->test), standard (all 7 steps), comprehensive (full design). If omitted and --fast not set, preset is auto-suggested from prompt scope.",
1735
+ )
1736
+ simple_mode_build_parser.add_argument(
1737
+ "--auto",
1738
+ action="store_true",
1739
+ help="Enable fully automated execution mode",
1740
+ )
1741
+ simple_mode_build_parser.add_argument(
1742
+ "--no-auto-checkpoint",
1743
+ action="store_true",
1744
+ help="Disable automatic workflow checkpoint detection and switching.",
1745
+ )
1746
+ simple_mode_build_parser.add_argument(
1747
+ "--checkpoint-debug",
1748
+ action="store_true",
1749
+ help="Enable verbose checkpoint logging for debugging.",
1750
+ )
1751
+
1752
+ # Simple Mode: resume
1753
+ simple_mode_resume_parser = simple_mode_subparsers.add_parser(
1754
+ "resume",
1755
+ help="Resume a failed or paused workflow",
1756
+ description="""Resume a workflow from the last completed step.
1757
+
1758
+ Use this command to continue a workflow that was interrupted or failed.
1759
+ The workflow will resume from the last successfully completed step.""",
1760
+ )
1761
+ simple_mode_resume_parser.add_argument(
1762
+ "workflow_id",
1763
+ nargs="?",
1764
+ help="Workflow ID to resume (use --list to see available workflows)",
1765
+ )
1766
+ simple_mode_resume_parser.add_argument(
1767
+ "--list",
1768
+ action="store_true",
1769
+ help="List available workflows that can be resumed",
1770
+ )
1771
+ simple_mode_resume_parser.add_argument(
1772
+ "--validate",
1773
+ action="store_true",
1774
+ help="Validate state before resuming",
1775
+ )
1776
+
1777
+ # Simple Mode: enhance (§3.4)
1778
+ simple_mode_enhance_parser = simple_mode_subparsers.add_parser(
1779
+ "enhance",
1780
+ help="Enhance a prompt (EnhancerAgent); §3.4",
1781
+ )
1782
+ simple_mode_enhance_parser.add_argument("--prompt", "-p", required=True, help="Prompt to enhance")
1783
+ simple_mode_enhance_parser.add_argument("--quick", action="store_true", help="Use enhance-quick (stages 1-3)")
1784
+
1785
+ # Simple Mode: breakdown (§3.4)
1786
+ simple_mode_breakdown_parser = simple_mode_subparsers.add_parser(
1787
+ "breakdown",
1788
+ help="Break down into tasks (PlannerAgent); §3.4",
1789
+ )
1790
+ simple_mode_breakdown_parser.add_argument("--prompt", "-p", required=True, help="Goal to break down")
1791
+
1792
+ # Simple Mode: todo (§3.5) – forwards to bd
1793
+ simple_mode_todo_parser = simple_mode_subparsers.add_parser(
1794
+ "todo",
1795
+ help="Task/todo via Beads (bd): create, list, close, dep add; §3.5",
1796
+ )
1797
+ simple_mode_todo_parser.add_argument(
1798
+ "args",
1799
+ nargs=argparse.REMAINDER,
1800
+ default=[],
1801
+ help="bd arguments: create 'Title', ready, close ID, dep add C P",
1802
+ )
1803
+
1804
+ # Simple Mode: epic – execute Epic document
1805
+ simple_mode_epic_parser = simple_mode_subparsers.add_parser(
1806
+ "epic",
1807
+ help="Execute Epic document – all stories in dependency order",
1808
+ description="""Execute all stories in an Epic markdown document in dependency order.
1809
+
1810
+ Loads the Epic document, resolves story dependencies (topological sort), and runs
1811
+ each story through the build workflow (enhance → plan → implement → review → test)
1812
+ with quality gates. Progress is tracked and a completion report is saved.""",
1813
+ )
1814
+ simple_mode_epic_parser.add_argument(
1815
+ "epic_path",
1816
+ nargs="?",
1817
+ help="Path to Epic markdown file (e.g. stories/enh-002-critical-enhancements.md)",
1818
+ )
1819
+ simple_mode_epic_parser.add_argument(
1820
+ "--quality-threshold",
1821
+ type=float,
1822
+ default=70.0,
1823
+ help="Minimum quality score for stories (default: 70)",
1824
+ )
1825
+ simple_mode_epic_parser.add_argument(
1826
+ "--critical-service-threshold",
1827
+ type=float,
1828
+ default=80.0,
1829
+ help="Minimum quality for critical services (default: 80)",
1830
+ )
1831
+ simple_mode_epic_parser.add_argument(
1832
+ "--auto",
1833
+ action="store_true",
1834
+ help="Fully automated execution (no interactive prompts)",
1835
+ )
1836
+ simple_mode_epic_parser.add_argument(
1837
+ "--no-quality-gates",
1838
+ action="store_true",
1839
+ help="Skip quality gate enforcement",
1840
+ )
1841
+
1842
+ # Simple Mode: epic-status sync report status into epic .md
1843
+ simple_mode_epic_status_parser = simple_mode_subparsers.add_parser(
1844
+ "epic-status",
1845
+ help="Update epic markdown with execution status from report JSON",
1846
+ description="""Update the epic .md file with execution status from the last run.
1847
+
1848
+ Reads stories/epic-N-report.json (or --report path) and adds or updates
1849
+ **Execution status:** done | failed for each story in the markdown.
1850
+ Run after 'simple-mode epic' to keep the epic document in sync with the report.""",
1851
+ )
1852
+ simple_mode_epic_status_parser.add_argument(
1853
+ "epic_path",
1854
+ nargs="?",
1855
+ help="Path to Epic markdown file (e.g. stories/enh-002-critical-enhancements.md)",
1856
+ )
1857
+ simple_mode_epic_status_parser.add_argument(
1858
+ "--report",
1859
+ type=Path,
1860
+ help="Path to epic-N-report.json (default: same dir as epic, epic-{N}-report.json)",
1861
+ )
1862
+
1863
+ # Learning export commands
1864
+ learning_parser = subparsers.add_parser(
1865
+ "learning",
1866
+ help="Export and view learning system data",
1867
+ description="""Export and view learning data from the self-improvement system.
1868
+
1869
+ The learning system tracks agent capabilities, patterns, and effectiveness metrics.
1870
+ This command allows you to:
1871
+ View learning dashboard with current metrics
1872
+ • Export learning data for framework feedback
1873
+ Submit anonymized data to framework maintainers
1874
+
1875
+ All exports are automatically anonymized to protect privacy.""",
1876
+ )
1877
+ learning_subparsers = learning_parser.add_subparsers(
1878
+ dest="command",
1879
+ help="Learning command",
1880
+ required=True,
1881
+ )
1882
+ learning_subparsers.add_parser("help", aliases=["*help"], help="Show learning commands")
1883
+
1884
+ # Learning: export
1885
+ learning_export_parser = learning_subparsers.add_parser(
1886
+ "export",
1887
+ help="Export learning data",
1888
+ description="""Export learning data in a standardized, anonymized format.
1889
+
1890
+ The export includes:
1891
+ • Capability metrics (success rates, quality scores)
1892
+ • Pattern statistics (learned patterns, anti-patterns)
1893
+ • Learning effectiveness data (ROI, improvement trends)
1894
+ • Analytics data (agent performance, workflow metrics)
1895
+
1896
+ All data is automatically anonymized:
1897
+ • Project paths are removed
1898
+ • Task IDs are hashed
1899
+ • Code snippets are excluded
1900
+ • Sensitive context is removed
1901
+
1902
+ Use this to share learning data with framework maintainers for framework improvement.""",
1903
+ )
1904
+ learning_export_parser.add_argument(
1905
+ "--output",
1906
+ help="Output file path (default: .tapps-agents/exports/learning-export-{timestamp}.json)",
1907
+ )
1908
+ learning_export_parser.add_argument(
1909
+ "--no-anonymize",
1910
+ action="store_true",
1911
+ help="Disable anonymization (NOT RECOMMENDED - requires explicit confirmation)",
1912
+ )
1913
+ learning_export_parser.add_argument(
1914
+ "--compress",
1915
+ action="store_true",
1916
+ help="Compress export with gzip",
1917
+ )
1918
+ learning_export_parser.add_argument(
1919
+ "--format",
1920
+ choices=["json", "yaml"],
1921
+ default="json",
1922
+ help="Export format (default: json)",
1923
+ )
1924
+ learning_export_parser.add_argument(
1925
+ "--yes",
1926
+ "-y",
1927
+ action="store_true",
1928
+ help="Skip confirmation prompt",
1929
+ )
1930
+
1931
+ # Learning: dashboard
1932
+ learning_dashboard_parser = learning_subparsers.add_parser(
1933
+ "dashboard",
1934
+ help="View learning dashboard",
1935
+ description="""Display learning system dashboard with current metrics.
1936
+
1937
+ Shows:
1938
+ • Capability metrics (success rates, quality scores)
1939
+ • Pattern statistics (total patterns, by type)
1940
+ • Security metrics (secure vs insecure patterns)
1941
+ • Learning trends (if available)
1942
+ • Failure analysis (if available)
1943
+
1944
+ Use this to verify the self-improvement system is working.""",
1945
+ )
1946
+ learning_dashboard_parser.add_argument(
1947
+ "--capability",
1948
+ help="Filter by capability ID",
1949
+ )
1950
+ learning_dashboard_parser.add_argument(
1951
+ "--format",
1952
+ choices=["text", "json"],
1953
+ default="text",
1954
+ help="Output format (default: text)",
1955
+ )
1956
+ learning_dashboard_parser.add_argument(
1957
+ "--include-trends",
1958
+ action="store_true",
1959
+ help="Include trend data",
1960
+ )
1961
+ learning_dashboard_parser.add_argument(
1962
+ "--include-failures",
1963
+ action="store_true",
1964
+ help="Include failure analysis",
1965
+ )
1966
+
1967
+ # Learning: submit (future)
1968
+ learning_submit_parser = learning_subparsers.add_parser(
1969
+ "submit",
1970
+ help="Submit learning data to framework (future)",
1971
+ description="""Submit exported learning data to framework maintainers (not yet implemented).
1972
+
1973
+ This command will prepare submission package and provide instructions for manual submission.""",
1974
+ )
1975
+ learning_submit_parser.add_argument(
1976
+ "--export-file",
1977
+ help="Path to export file (default: latest export)",
1978
+ )