doit-toolkit-cli 0.1.10__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.

Potentially problematic release.


This version of doit-toolkit-cli might be problematic. Click here for more details.

Files changed (135) hide show
  1. doit_cli/__init__.py +1356 -0
  2. doit_cli/cli/__init__.py +26 -0
  3. doit_cli/cli/analytics_command.py +616 -0
  4. doit_cli/cli/context_command.py +213 -0
  5. doit_cli/cli/diagram_command.py +304 -0
  6. doit_cli/cli/fixit_command.py +641 -0
  7. doit_cli/cli/hooks_command.py +211 -0
  8. doit_cli/cli/init_command.py +613 -0
  9. doit_cli/cli/memory_command.py +293 -0
  10. doit_cli/cli/roadmapit_command.py +10 -0
  11. doit_cli/cli/status_command.py +117 -0
  12. doit_cli/cli/sync_prompts_command.py +248 -0
  13. doit_cli/cli/validate_command.py +196 -0
  14. doit_cli/cli/verify_command.py +204 -0
  15. doit_cli/cli/workflow_mixin.py +224 -0
  16. doit_cli/cli/xref_command.py +555 -0
  17. doit_cli/formatters/__init__.py +8 -0
  18. doit_cli/formatters/base.py +38 -0
  19. doit_cli/formatters/json_formatter.py +126 -0
  20. doit_cli/formatters/markdown_formatter.py +97 -0
  21. doit_cli/formatters/rich_formatter.py +257 -0
  22. doit_cli/main.py +51 -0
  23. doit_cli/models/__init__.py +139 -0
  24. doit_cli/models/agent.py +74 -0
  25. doit_cli/models/analytics_models.py +384 -0
  26. doit_cli/models/context_config.py +464 -0
  27. doit_cli/models/crossref_models.py +182 -0
  28. doit_cli/models/diagram_models.py +363 -0
  29. doit_cli/models/fixit_models.py +355 -0
  30. doit_cli/models/hook_config.py +125 -0
  31. doit_cli/models/project.py +91 -0
  32. doit_cli/models/results.py +121 -0
  33. doit_cli/models/search_models.py +228 -0
  34. doit_cli/models/status_models.py +195 -0
  35. doit_cli/models/sync_models.py +146 -0
  36. doit_cli/models/template.py +77 -0
  37. doit_cli/models/validation_models.py +175 -0
  38. doit_cli/models/workflow_models.py +319 -0
  39. doit_cli/prompts/__init__.py +5 -0
  40. doit_cli/prompts/fixit_prompts.py +344 -0
  41. doit_cli/prompts/interactive.py +390 -0
  42. doit_cli/rules/__init__.py +5 -0
  43. doit_cli/rules/builtin_rules.py +160 -0
  44. doit_cli/services/__init__.py +79 -0
  45. doit_cli/services/agent_detector.py +168 -0
  46. doit_cli/services/analytics_service.py +218 -0
  47. doit_cli/services/architecture_generator.py +290 -0
  48. doit_cli/services/backup_service.py +204 -0
  49. doit_cli/services/config_loader.py +113 -0
  50. doit_cli/services/context_loader.py +1123 -0
  51. doit_cli/services/coverage_calculator.py +142 -0
  52. doit_cli/services/crossref_service.py +237 -0
  53. doit_cli/services/cycle_time_calculator.py +134 -0
  54. doit_cli/services/date_inferrer.py +349 -0
  55. doit_cli/services/diagram_service.py +337 -0
  56. doit_cli/services/drift_detector.py +109 -0
  57. doit_cli/services/entity_parser.py +301 -0
  58. doit_cli/services/er_diagram_generator.py +197 -0
  59. doit_cli/services/fixit_service.py +699 -0
  60. doit_cli/services/github_service.py +192 -0
  61. doit_cli/services/hook_manager.py +258 -0
  62. doit_cli/services/hook_validator.py +528 -0
  63. doit_cli/services/input_validator.py +322 -0
  64. doit_cli/services/memory_search.py +527 -0
  65. doit_cli/services/mermaid_validator.py +334 -0
  66. doit_cli/services/prompt_transformer.py +91 -0
  67. doit_cli/services/prompt_writer.py +133 -0
  68. doit_cli/services/query_interpreter.py +428 -0
  69. doit_cli/services/report_exporter.py +219 -0
  70. doit_cli/services/report_generator.py +256 -0
  71. doit_cli/services/requirement_parser.py +112 -0
  72. doit_cli/services/roadmap_summarizer.py +209 -0
  73. doit_cli/services/rule_engine.py +443 -0
  74. doit_cli/services/scaffolder.py +215 -0
  75. doit_cli/services/score_calculator.py +172 -0
  76. doit_cli/services/section_parser.py +204 -0
  77. doit_cli/services/spec_scanner.py +327 -0
  78. doit_cli/services/state_manager.py +355 -0
  79. doit_cli/services/status_reporter.py +143 -0
  80. doit_cli/services/task_parser.py +347 -0
  81. doit_cli/services/template_manager.py +710 -0
  82. doit_cli/services/template_reader.py +158 -0
  83. doit_cli/services/user_journey_generator.py +214 -0
  84. doit_cli/services/user_story_parser.py +232 -0
  85. doit_cli/services/validation_service.py +188 -0
  86. doit_cli/services/validator.py +232 -0
  87. doit_cli/services/velocity_tracker.py +173 -0
  88. doit_cli/services/workflow_engine.py +405 -0
  89. doit_cli/templates/agent-file-template.md +28 -0
  90. doit_cli/templates/checklist-template.md +39 -0
  91. doit_cli/templates/commands/doit.checkin.md +363 -0
  92. doit_cli/templates/commands/doit.constitution.md +187 -0
  93. doit_cli/templates/commands/doit.documentit.md +485 -0
  94. doit_cli/templates/commands/doit.fixit.md +181 -0
  95. doit_cli/templates/commands/doit.implementit.md +265 -0
  96. doit_cli/templates/commands/doit.planit.md +262 -0
  97. doit_cli/templates/commands/doit.reviewit.md +355 -0
  98. doit_cli/templates/commands/doit.roadmapit.md +389 -0
  99. doit_cli/templates/commands/doit.scaffoldit.md +458 -0
  100. doit_cli/templates/commands/doit.specit.md +521 -0
  101. doit_cli/templates/commands/doit.taskit.md +304 -0
  102. doit_cli/templates/commands/doit.testit.md +277 -0
  103. doit_cli/templates/config/context.yaml +134 -0
  104. doit_cli/templates/config/hooks.yaml +93 -0
  105. doit_cli/templates/config/validation-rules.yaml +64 -0
  106. doit_cli/templates/github-issue-templates/epic.yml +78 -0
  107. doit_cli/templates/github-issue-templates/feature.yml +116 -0
  108. doit_cli/templates/github-issue-templates/task.yml +129 -0
  109. doit_cli/templates/hooks/.gitkeep +0 -0
  110. doit_cli/templates/hooks/post-commit.sh +25 -0
  111. doit_cli/templates/hooks/post-merge.sh +75 -0
  112. doit_cli/templates/hooks/pre-commit.sh +17 -0
  113. doit_cli/templates/hooks/pre-push.sh +18 -0
  114. doit_cli/templates/memory/completed_roadmap.md +50 -0
  115. doit_cli/templates/memory/constitution.md +125 -0
  116. doit_cli/templates/memory/roadmap.md +61 -0
  117. doit_cli/templates/plan-template.md +146 -0
  118. doit_cli/templates/scripts/bash/check-prerequisites.sh +166 -0
  119. doit_cli/templates/scripts/bash/common.sh +156 -0
  120. doit_cli/templates/scripts/bash/create-new-feature.sh +297 -0
  121. doit_cli/templates/scripts/bash/setup-plan.sh +61 -0
  122. doit_cli/templates/scripts/bash/update-agent-context.sh +675 -0
  123. doit_cli/templates/scripts/powershell/check-prerequisites.ps1 +148 -0
  124. doit_cli/templates/scripts/powershell/common.ps1 +137 -0
  125. doit_cli/templates/scripts/powershell/create-new-feature.ps1 +283 -0
  126. doit_cli/templates/scripts/powershell/setup-plan.ps1 +61 -0
  127. doit_cli/templates/scripts/powershell/update-agent-context.ps1 +406 -0
  128. doit_cli/templates/spec-template.md +159 -0
  129. doit_cli/templates/tasks-template.md +313 -0
  130. doit_cli/templates/vscode-settings.json +14 -0
  131. doit_toolkit_cli-0.1.10.dist-info/METADATA +324 -0
  132. doit_toolkit_cli-0.1.10.dist-info/RECORD +135 -0
  133. doit_toolkit_cli-0.1.10.dist-info/WHEEL +4 -0
  134. doit_toolkit_cli-0.1.10.dist-info/entry_points.txt +2 -0
  135. doit_toolkit_cli-0.1.10.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env bash
2
+ # Post-merge hook installed by doit
3
+ # This hook auto-completes fixit workflows when fix branches are merged
4
+
5
+ # Exit on error
6
+ set -e
7
+
8
+ # Check if doit is available
9
+ if ! command -v doit &> /dev/null; then
10
+ exit 0
11
+ fi
12
+
13
+ # Get the name of the branch that was merged
14
+ # SQUASH_MSG contains the branch name for squash merges
15
+ # Otherwise we need to check reflog
16
+
17
+ # Check if we have a squash commit message file
18
+ if [ -f ".git/SQUASH_MSG" ]; then
19
+ # Try to extract branch name from squash message
20
+ MERGED_BRANCH=$(head -1 .git/SQUASH_MSG | grep -oE "fix/[0-9]+-[a-z0-9-]+" || true)
21
+ fi
22
+
23
+ # Fallback: check git reflog for recent merge
24
+ if [ -z "$MERGED_BRANCH" ]; then
25
+ # Get the most recent merge line from reflog
26
+ REFLOG_MERGE=$(git reflog --grep-reflog="merge" -1 2>/dev/null || true)
27
+ if [ -n "$REFLOG_MERGE" ]; then
28
+ MERGED_BRANCH=$(echo "$REFLOG_MERGE" | grep -oE "fix/[0-9]+-[a-z0-9-]+" || true)
29
+ fi
30
+ fi
31
+
32
+ # Fallback: Check ORIG_HEAD which points to the tip before the merge
33
+ if [ -z "$MERGED_BRANCH" ]; then
34
+ # Get the branch that was merged using the second parent of HEAD
35
+ PARENT2=$(git rev-parse HEAD^2 2>/dev/null || true)
36
+ if [ -n "$PARENT2" ]; then
37
+ # Find branch containing this commit
38
+ MERGED_BRANCH=$(git branch -a --contains "$PARENT2" 2>/dev/null | grep -oE "fix/[0-9]+-[a-z0-9-]+" | head -1 || true)
39
+ fi
40
+ fi
41
+
42
+ # If we found a fix branch, complete the workflow
43
+ if [ -n "$MERGED_BRANCH" ]; then
44
+ # Extract issue ID from branch name (fix/{issue_id}-{slug})
45
+ ISSUE_ID=$(echo "$MERGED_BRANCH" | grep -oE "fix/([0-9]+)" | sed 's/fix\///')
46
+
47
+ if [ -n "$ISSUE_ID" ]; then
48
+ echo "🔧 Detected merge of fix branch: $MERGED_BRANCH"
49
+ echo "📋 Auto-completing workflow for issue #$ISSUE_ID..."
50
+
51
+ # Call doit to complete the workflow
52
+ # This will close the GitHub issue and mark the workflow as completed
53
+ python -c "
54
+ from doit_cli.services.fixit_service import FixitService
55
+ from doit_cli.services.github_service import GitHubService
56
+ from doit_cli.services.state_manager import StateManager
57
+
58
+ try:
59
+ service = FixitService()
60
+ workflow = service.get_workflow($ISSUE_ID)
61
+ if workflow:
62
+ success = service.complete_workflow($ISSUE_ID, close_issue=True)
63
+ if success:
64
+ print('✅ Workflow completed and issue #$ISSUE_ID closed!')
65
+ else:
66
+ print('⚠️ Could not complete workflow (may already be completed)')
67
+ else:
68
+ print('ℹ️ No active workflow found for issue #$ISSUE_ID')
69
+ except Exception as e:
70
+ print(f'⚠️ Could not auto-complete workflow: {e}')
71
+ " 2>/dev/null || echo "⚠️ Fixit workflow completion skipped (doit-cli not in environment)"
72
+ fi
73
+ fi
74
+
75
+ exit 0
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bash
2
+ # Pre-commit hook installed by doit
3
+ # This hook validates workflow compliance before allowing commits
4
+
5
+ # Exit on error
6
+ set -e
7
+
8
+ # Check if doit is available
9
+ if ! command -v doit &> /dev/null; then
10
+ echo "Warning: doit command not found in PATH"
11
+ echo "Skipping pre-commit validation"
12
+ exit 0
13
+ fi
14
+
15
+ # Run pre-commit validation
16
+ # Note: The doit validate command only needs the hook type, not shell arguments.
17
+ exec doit hooks validate pre-commit
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env bash
2
+ # Pre-push hook installed by doit
3
+ # This hook validates workflow artifacts before allowing pushes
4
+
5
+ # Exit on error
6
+ set -e
7
+
8
+ # Check if doit is available
9
+ if ! command -v doit &> /dev/null; then
10
+ echo "Warning: doit command not found in PATH"
11
+ echo "Skipping pre-push validation"
12
+ exit 0
13
+ fi
14
+
15
+ # Run pre-push validation
16
+ # Note: Git passes remote name and URL as arguments, and ref info via stdin.
17
+ # The doit validate command only needs the hook type, not git's arguments.
18
+ exec doit hooks validate pre-push
@@ -0,0 +1,50 @@
1
+ # Completed Roadmap Items
2
+
3
+ **Project**: [PROJECT_NAME]
4
+ **Created**: [DATE]
5
+ **Purpose**: Historical record of completed roadmap items for AI context and project history
6
+
7
+ ---
8
+
9
+ ## Recently Completed
10
+
11
+ <!-- Last 20 completed items - older items are archived below -->
12
+
13
+ | Item | Original Priority | Completed Date | Feature Branch | Notes |
14
+ |------|-------------------|----------------|----------------|-------|
15
+ | [COMPLETED_ITEM] | [P1-P4] | [DATE] | `[###-feature-name]` | [NOTES] |
16
+
17
+ ---
18
+
19
+ ## Archive
20
+
21
+ <!-- Older completed items (beyond 20 most recent) -->
22
+
23
+ <details>
24
+ <summary>Archived Items (click to expand)</summary>
25
+
26
+ | Item | Original Priority | Completed Date | Feature Branch |
27
+ |------|-------------------|----------------|----------------|
28
+ <!-- Older items will be moved here automatically -->
29
+
30
+ </details>
31
+
32
+ ---
33
+
34
+ ## Statistics
35
+
36
+ - **Total Items Completed**: [COUNT]
37
+ - **P1 Items Completed**: [P1_COUNT]
38
+ - **P2 Items Completed**: [P2_COUNT]
39
+ - **P3 Items Completed**: [P3_COUNT]
40
+ - **P4 Items Completed**: [P4_COUNT]
41
+
42
+ ---
43
+
44
+ ## Notes
45
+
46
+ - This file is maintained automatically by `/doit.checkin` when features complete
47
+ - Items are matched by feature branch reference `[###-feature-name]`
48
+ - Only the 20 most recent items are kept in "Recently Completed"
49
+ - Older items are moved to the Archive section
50
+ - Use this history to understand project evolution and past decisions
@@ -0,0 +1,125 @@
1
+ # [PROJECT_NAME] Constitution
2
+
3
+ <!-- Example: Spec Constitution, TaskFlow Constitution, etc. -->
4
+
5
+ ## Purpose & Goals
6
+
7
+ ### Project Purpose
8
+
9
+ [PROJECT_PURPOSE]
10
+ <!-- Example: A CLI tool for managing feature specifications and task tracking -->
11
+
12
+ ### Success Criteria
13
+
14
+ [SUCCESS_CRITERIA]
15
+ <!-- Example:
16
+ - Reduce feature specification time by 50%
17
+ - Enable consistent task breakdown across teams
18
+ - Support multiple AI assistants for development -->
19
+
20
+ ## Tech Stack
21
+
22
+ ### Languages
23
+
24
+ [PRIMARY_LANGUAGE]
25
+ <!-- Example: Python 3.11+ (primary), TypeScript (frontend) -->
26
+
27
+ ### Frameworks
28
+
29
+ [FRAMEWORKS]
30
+ <!-- Example: FastAPI (API), React (frontend), pytest (testing) -->
31
+
32
+ ### Libraries
33
+
34
+ [KEY_LIBRARIES]
35
+ <!-- Example: Pydantic (validation), SQLAlchemy (ORM), Rich (CLI) -->
36
+
37
+ ## Infrastructure
38
+
39
+ ### Hosting
40
+
41
+ [HOSTING_PLATFORM]
42
+ <!-- Example: AWS ECS, Google Cloud Run, Azure Container Apps, Self-hosted -->
43
+
44
+ ### Cloud Provider
45
+
46
+ [CLOUD_PROVIDER]
47
+ <!-- Example: AWS, GCP, Azure, Multi-cloud, On-premises -->
48
+
49
+ ### Database
50
+
51
+ [DATABASE]
52
+ <!-- Example: PostgreSQL (primary), Redis (cache), none -->
53
+
54
+ ## Deployment
55
+
56
+ ### CI/CD Pipeline
57
+
58
+ [CICD_PIPELINE]
59
+ <!-- Example: GitHub Actions, GitLab CI, Jenkins, CircleCI -->
60
+
61
+ ### Deployment Strategy
62
+
63
+ [DEPLOYMENT_STRATEGY]
64
+ <!-- Example: Blue-green, Rolling, Canary, Manual -->
65
+
66
+ ### Environments
67
+
68
+ [ENVIRONMENTS]
69
+ <!-- Example: dev, staging, production -->
70
+
71
+ ## Core Principles
72
+
73
+ ### [PRINCIPLE_1_NAME]
74
+
75
+ <!-- Example: I. Library-First -->
76
+ [PRINCIPLE_1_DESCRIPTION]
77
+ <!-- Example: Every feature starts as a standalone library; Libraries must be self-contained, independently testable, documented; Clear purpose required - no organizational-only libraries -->
78
+
79
+ ### [PRINCIPLE_2_NAME]
80
+
81
+ <!-- Example: II. CLI Interface -->
82
+ [PRINCIPLE_2_DESCRIPTION]
83
+ <!-- Example: Every library exposes functionality via CLI; Text in/out protocol: stdin/args → stdout, errors → stderr; Support JSON + human-readable formats -->
84
+
85
+ ### [PRINCIPLE_3_NAME]
86
+
87
+ <!-- Example: III. Test-First (NON-NEGOTIABLE) -->
88
+ [PRINCIPLE_3_DESCRIPTION]
89
+ <!-- Example: TDD mandatory: Tests written → User approved → Tests fail → Then implement; Red-Green-Refactor cycle strictly enforced -->
90
+
91
+ ### [PRINCIPLE_4_NAME]
92
+
93
+ <!-- Example: IV. Integration Testing -->
94
+ [PRINCIPLE_4_DESCRIPTION]
95
+ <!-- Example: Focus areas requiring integration tests: New library contract tests, Contract changes, Inter-service communication, Shared schemas -->
96
+
97
+ ### [PRINCIPLE_5_NAME]
98
+
99
+ <!-- Example: V. Observability, VI. Versioning & Breaking Changes, VII. Simplicity -->
100
+ [PRINCIPLE_5_DESCRIPTION]
101
+ <!-- Example: Text I/O ensures debuggability; Structured logging required; Or: MAJOR.MINOR.BUILD format; Or: Start simple, YAGNI principles -->
102
+
103
+ ## [SECTION_2_NAME]
104
+
105
+ <!-- Example: Additional Constraints, Security Requirements, Performance Standards, etc. -->
106
+
107
+ [SECTION_2_CONTENT]
108
+ <!-- Example: Technology stack requirements, compliance standards, deployment policies, etc. -->
109
+
110
+ ## [SECTION_3_NAME]
111
+
112
+ <!-- Example: Development Workflow, Review Process, Quality Gates, etc. -->
113
+
114
+ [SECTION_3_CONTENT]
115
+ <!-- Example: Code review requirements, testing gates, deployment approval process, etc. -->
116
+
117
+ ## Governance
118
+
119
+ <!-- Example: Constitution supersedes all other practices; Amendments require documentation, approval, migration plan -->
120
+
121
+ [GOVERNANCE_RULES]
122
+ <!-- Example: All PRs/reviews must verify compliance; Complexity must be justified; Use [GUIDANCE_FILE] for runtime development guidance -->
123
+
124
+ **Version**: [CONSTITUTION_VERSION] | **Ratified**: [RATIFICATION_DATE] | **Last Amended**: [LAST_AMENDED_DATE]
125
+ <!-- Example: Version: 2.1.1 | Ratified: 2025-06-13 | Last Amended: 2025-07-16 -->
@@ -0,0 +1,61 @@
1
+ # Project Roadmap
2
+
3
+ **Project**: [PROJECT_NAME]
4
+ **Last Updated**: [DATE]
5
+ **Managed by**: `/doit.roadmapit`
6
+
7
+ ## Vision
8
+
9
+ [PROJECT_VISION]
10
+
11
+ ---
12
+
13
+ ## Active Requirements
14
+
15
+ ### P1 - Critical (Must Have for MVP)
16
+
17
+ <!-- Items that are essential for minimum viable product or blocking other work -->
18
+
19
+ - [ ] [P1_ITEM_1] `[feature-branch-reference]`
20
+ - **Rationale**: [Why this is critical]
21
+
22
+ ### P2 - High Priority (Significant Business Value)
23
+
24
+ <!-- Items with high business value, scheduled for near-term delivery -->
25
+
26
+ - [ ] [P2_ITEM_1] `[feature-branch-reference]`
27
+ - **Rationale**: [Why this is high priority]
28
+
29
+ ### P3 - Medium Priority (Valuable)
30
+
31
+ <!-- Items that add value but can wait for later iterations -->
32
+
33
+ - [ ] [P3_ITEM_1] `[feature-branch-reference]`
34
+ - **Rationale**: [Why this is medium priority]
35
+
36
+ ### P4 - Low Priority (Nice to Have)
37
+
38
+ <!-- Items in the backlog, considered for future development -->
39
+
40
+ - [ ] [P4_ITEM_1] `[feature-branch-reference]`
41
+ - **Rationale**: [Why this is low priority]
42
+
43
+ ---
44
+
45
+ ## Deferred Items
46
+
47
+ <!-- Items that were considered but intentionally deferred with reason -->
48
+
49
+ | Item | Original Priority | Deferred Date | Reason |
50
+ |------|-------------------|---------------|--------|
51
+ | [DEFERRED_ITEM] | [P1-P4] | [DATE] | [REASON] |
52
+
53
+ ---
54
+
55
+ ## Notes
56
+
57
+ - Items marked with `[###-feature-name]` reference link to feature branches for tracking
58
+ - When a feature completes via `/doit.checkin`, matching items are moved to `completed_roadmap.md`
59
+ - Use `/doit.roadmapit add [item]` to add new items
60
+ - Use `/doit.roadmapit defer [item]` to move items to deferred section
61
+ - Use `/doit.roadmapit reprioritize` to change item priorities
@@ -0,0 +1,146 @@
1
+ # Implementation Plan: [FEATURE]
2
+
3
+ **Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link]
4
+ **Input**: Feature specification from `/specs/[###-feature-name]/spec.md`
5
+
6
+ **Note**: This template is filled in by the `/doit.planit` command. See `.claude/commands/doit.planit.md` for the execution workflow.
7
+
8
+ ## Summary
9
+
10
+ [Extract from feature spec: primary requirement + technical approach from research]
11
+
12
+ ## Technical Context
13
+
14
+ <!--
15
+ ACTION REQUIRED: Replace the content in this section with the technical details
16
+ for the project. The structure here is presented in advisory capacity to guide
17
+ the iteration process.
18
+ -->
19
+
20
+ **Language/Version**: [e.g., Python 3.11, Swift 5.9, Rust 1.75 or NEEDS CLARIFICATION]
21
+ **Primary Dependencies**: [e.g., FastAPI, UIKit, LLVM or NEEDS CLARIFICATION]
22
+ **Storage**: [if applicable, e.g., PostgreSQL, CoreData, files or N/A]
23
+ **Testing**: [e.g., pytest, XCTest, cargo test or NEEDS CLARIFICATION]
24
+ **Target Platform**: [e.g., Linux server, iOS 15+, WASM or NEEDS CLARIFICATION]
25
+ **Project Type**: [single/web/mobile - determines source structure]
26
+ **Performance Goals**: [domain-specific, e.g., 1000 req/s, 10k lines/sec, 60 fps or NEEDS CLARIFICATION]
27
+ **Constraints**: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
28
+ **Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
29
+
30
+ ## Architecture Overview
31
+
32
+ <!--
33
+ AUTO-GENERATED: This section is populated by /doit.planit based on Technical Context above.
34
+ Shows the high-level system architecture with component layers.
35
+ Regenerate by running /doit.planit again.
36
+ -->
37
+
38
+ <!-- BEGIN:AUTO-GENERATED section="architecture" -->
39
+ ```mermaid
40
+ flowchart TD
41
+ subgraph "Presentation"
42
+ UI[UI Layer]
43
+ end
44
+ subgraph "Application"
45
+ API[API Layer]
46
+ SVC[Service Layer]
47
+ end
48
+ subgraph "Data"
49
+ DB[(Database)]
50
+ end
51
+ UI --> API --> SVC --> DB
52
+ ```
53
+ <!-- END:AUTO-GENERATED -->
54
+
55
+ ## Component Dependencies *(include if multiple services/components)*
56
+
57
+ <!--
58
+ AUTO-GENERATED: This section is populated by /doit.planit when multiple services are defined.
59
+ Shows dependencies between services and components.
60
+ If only one service, this section should be omitted.
61
+ -->
62
+
63
+ <!-- BEGIN:AUTO-GENERATED section="component-dependencies" -->
64
+ ```mermaid
65
+ flowchart TD
66
+ AUTH[Auth Service] --> USER[User Service]
67
+ CORE[Core Service] --> USER
68
+ CORE --> DATA[Data Service]
69
+ ```
70
+ <!-- END:AUTO-GENERATED -->
71
+
72
+ ## Constitution Check
73
+
74
+ *GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
75
+
76
+ [Gates determined based on constitution file]
77
+
78
+ ## Project Structure
79
+
80
+ ### Documentation (this feature)
81
+
82
+ ```text
83
+ specs/[###-feature]/
84
+ ├── plan.md # This file (/doit.planit command output)
85
+ ├── research.md # Phase 0 output (/doit.planit command)
86
+ ├── data-model.md # Phase 1 output (/doit.planit command)
87
+ ├── quickstart.md # Phase 1 output (/doit.planit command)
88
+ ├── contracts/ # Phase 1 output (/doit.planit command)
89
+ └── tasks.md # Phase 2 output (/doit.taskit command - NOT created by /doit.planit)
90
+ ```
91
+
92
+ ### Source Code (repository root)
93
+ <!--
94
+ ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
95
+ for this feature. Delete unused options and expand the chosen structure with
96
+ real paths (e.g., apps/admin, packages/something). The delivered plan must
97
+ not include Option labels.
98
+ -->
99
+
100
+ ```text
101
+ # [REMOVE IF UNUSED] Option 1: Single project (DEFAULT)
102
+ src/
103
+ ├── models/
104
+ ├── services/
105
+ ├── cli/
106
+ └── lib/
107
+
108
+ tests/
109
+ ├── contract/
110
+ ├── integration/
111
+ └── unit/
112
+
113
+ # [REMOVE IF UNUSED] Option 2: Web application (when "frontend" + "backend" detected)
114
+ backend/
115
+ ├── src/
116
+ │ ├── models/
117
+ │ ├── services/
118
+ │ └── api/
119
+ └── tests/
120
+
121
+ frontend/
122
+ ├── src/
123
+ │ ├── components/
124
+ │ ├── pages/
125
+ │ └── services/
126
+ └── tests/
127
+
128
+ # [REMOVE IF UNUSED] Option 3: Mobile + API (when "iOS/Android" detected)
129
+ api/
130
+ └── [same as backend above]
131
+
132
+ ios/ or android/
133
+ └── [platform-specific structure: feature modules, UI flows, platform tests]
134
+ ```
135
+
136
+ **Structure Decision**: [Document the selected structure and reference the real
137
+ directories captured above]
138
+
139
+ ## Complexity Tracking
140
+
141
+ > **Fill ONLY if Constitution Check has violations that must be justified**
142
+
143
+ | Violation | Why Needed | Simpler Alternative Rejected Because |
144
+ |-----------|------------|-------------------------------------|
145
+ | [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
146
+ | [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Consolidated prerequisite checking script
4
+ #
5
+ # This script provides unified prerequisite checking for Spec-Driven Development workflow.
6
+ # It replaces the functionality previously spread across multiple scripts.
7
+ #
8
+ # Usage: ./check-prerequisites.sh [OPTIONS]
9
+ #
10
+ # OPTIONS:
11
+ # --json Output in JSON format
12
+ # --require-tasks Require tasks.md to exist (for implementation phase)
13
+ # --include-tasks Include tasks.md in AVAILABLE_DOCS list
14
+ # --paths-only Only output path variables (no validation)
15
+ # --help, -h Show help message
16
+ #
17
+ # OUTPUTS:
18
+ # JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
19
+ # Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
20
+ # Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
21
+
22
+ set -e
23
+
24
+ # Parse command line arguments
25
+ JSON_MODE=false
26
+ REQUIRE_TASKS=false
27
+ INCLUDE_TASKS=false
28
+ PATHS_ONLY=false
29
+
30
+ for arg in "$@"; do
31
+ case "$arg" in
32
+ --json)
33
+ JSON_MODE=true
34
+ ;;
35
+ --require-tasks)
36
+ REQUIRE_TASKS=true
37
+ ;;
38
+ --include-tasks)
39
+ INCLUDE_TASKS=true
40
+ ;;
41
+ --paths-only)
42
+ PATHS_ONLY=true
43
+ ;;
44
+ --help|-h)
45
+ cat << 'EOF'
46
+ Usage: check-prerequisites.sh [OPTIONS]
47
+
48
+ Consolidated prerequisite checking for Spec-Driven Development workflow.
49
+
50
+ OPTIONS:
51
+ --json Output in JSON format
52
+ --require-tasks Require tasks.md to exist (for implementation phase)
53
+ --include-tasks Include tasks.md in AVAILABLE_DOCS list
54
+ --paths-only Only output path variables (no prerequisite validation)
55
+ --help, -h Show this help message
56
+
57
+ EXAMPLES:
58
+ # Check task prerequisites (plan.md required)
59
+ ./check-prerequisites.sh --json
60
+
61
+ # Check implementation prerequisites (plan.md + tasks.md required)
62
+ ./check-prerequisites.sh --json --require-tasks --include-tasks
63
+
64
+ # Get feature paths only (no validation)
65
+ ./check-prerequisites.sh --paths-only
66
+
67
+ EOF
68
+ exit 0
69
+ ;;
70
+ *)
71
+ echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
72
+ exit 1
73
+ ;;
74
+ esac
75
+ done
76
+
77
+ # Source common functions
78
+ SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
79
+ source "$SCRIPT_DIR/common.sh"
80
+
81
+ # Get feature paths and validate branch
82
+ eval $(get_feature_paths)
83
+ check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
84
+
85
+ # If paths-only mode, output paths and exit (support JSON + paths-only combined)
86
+ if $PATHS_ONLY; then
87
+ if $JSON_MODE; then
88
+ # Minimal JSON paths payload (no validation performed)
89
+ printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
90
+ "$REPO_ROOT" "$CURRENT_BRANCH" "$FEATURE_DIR" "$FEATURE_SPEC" "$IMPL_PLAN" "$TASKS"
91
+ else
92
+ echo "REPO_ROOT: $REPO_ROOT"
93
+ echo "BRANCH: $CURRENT_BRANCH"
94
+ echo "FEATURE_DIR: $FEATURE_DIR"
95
+ echo "FEATURE_SPEC: $FEATURE_SPEC"
96
+ echo "IMPL_PLAN: $IMPL_PLAN"
97
+ echo "TASKS: $TASKS"
98
+ fi
99
+ exit 0
100
+ fi
101
+
102
+ # Validate required directories and files
103
+ if [[ ! -d "$FEATURE_DIR" ]]; then
104
+ echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
105
+ echo "Run /doit.doit first to create the feature structure." >&2
106
+ exit 1
107
+ fi
108
+
109
+ if [[ ! -f "$IMPL_PLAN" ]]; then
110
+ echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
111
+ echo "Run /doit.plan first to create the implementation plan." >&2
112
+ exit 1
113
+ fi
114
+
115
+ # Check for tasks.md if required
116
+ if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
117
+ echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
118
+ echo "Run /doit.tasks first to create the task list." >&2
119
+ exit 1
120
+ fi
121
+
122
+ # Build list of available documents
123
+ docs=()
124
+
125
+ # Always check these optional docs
126
+ [[ -f "$RESEARCH" ]] && docs+=("research.md")
127
+ [[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
128
+
129
+ # Check contracts directory (only if it exists and has files)
130
+ if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
131
+ docs+=("contracts/")
132
+ fi
133
+
134
+ [[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
135
+
136
+ # Include tasks.md if requested and it exists
137
+ if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
138
+ docs+=("tasks.md")
139
+ fi
140
+
141
+ # Output results
142
+ if $JSON_MODE; then
143
+ # Build JSON array of documents
144
+ if [[ ${#docs[@]} -eq 0 ]]; then
145
+ json_docs="[]"
146
+ else
147
+ json_docs=$(printf '"%s",' "${docs[@]}")
148
+ json_docs="[${json_docs%,}]"
149
+ fi
150
+
151
+ printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$FEATURE_DIR" "$json_docs"
152
+ else
153
+ # Text output
154
+ echo "FEATURE_DIR:$FEATURE_DIR"
155
+ echo "AVAILABLE_DOCS:"
156
+
157
+ # Show status of each potential document
158
+ check_file "$RESEARCH" "research.md"
159
+ check_file "$DATA_MODEL" "data-model.md"
160
+ check_dir "$CONTRACTS_DIR" "contracts/"
161
+ check_file "$QUICKSTART" "quickstart.md"
162
+
163
+ if $INCLUDE_TASKS; then
164
+ check_file "$TASKS" "tasks.md"
165
+ fi
166
+ fi