devcouncil 0.1.0 → 0.1.1

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 (128) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +62 -543
  3. package/package.json +1 -1
  4. package/pyproject.toml +29 -26
  5. package/src/devcouncil/__main__.py +4 -4
  6. package/src/devcouncil/app/__init__.py +28 -28
  7. package/src/devcouncil/app/config.py +135 -108
  8. package/src/devcouncil/app/errors.py +23 -23
  9. package/src/devcouncil/app/events.py +44 -44
  10. package/src/devcouncil/app/orchestrator.py +67 -67
  11. package/src/devcouncil/app/project_status.py +29 -0
  12. package/src/devcouncil/app/run_context.py +39 -39
  13. package/src/devcouncil/app/state_machine.py +108 -108
  14. package/src/devcouncil/artifacts/__init__.py +1 -1
  15. package/src/devcouncil/artifacts/coverage.py +96 -96
  16. package/src/devcouncil/artifacts/graph.py +143 -143
  17. package/src/devcouncil/artifacts/migrations.py +20 -20
  18. package/src/devcouncil/artifacts/schemas.py +23 -23
  19. package/src/devcouncil/artifacts/serializer.py +21 -21
  20. package/src/devcouncil/artifacts/validators.py +27 -27
  21. package/src/devcouncil/cli/commands/artifacts.py +51 -48
  22. package/src/devcouncil/cli/commands/ast.py +22 -0
  23. package/src/devcouncil/cli/commands/baseline.py +35 -32
  24. package/src/devcouncil/cli/commands/config.py +76 -54
  25. package/src/devcouncil/cli/commands/dashboard.py +26 -0
  26. package/src/devcouncil/cli/commands/doctor.py +86 -42
  27. package/src/devcouncil/cli/commands/go.py +237 -0
  28. package/src/devcouncil/cli/commands/hook.py +96 -29
  29. package/src/devcouncil/cli/commands/init.py +67 -56
  30. package/src/devcouncil/cli/commands/integrate.py +320 -14
  31. package/src/devcouncil/cli/commands/lsp.py +20 -0
  32. package/src/devcouncil/cli/commands/map.py +25 -21
  33. package/src/devcouncil/cli/commands/plan.py +257 -206
  34. package/src/devcouncil/cli/commands/prompt.py +36 -33
  35. package/src/devcouncil/cli/commands/repair.py +72 -69
  36. package/src/devcouncil/cli/commands/report.py +112 -54
  37. package/src/devcouncil/cli/commands/reset_demo_state.py +31 -28
  38. package/src/devcouncil/cli/commands/rollback.py +49 -47
  39. package/src/devcouncil/cli/commands/run.py +252 -207
  40. package/src/devcouncil/cli/commands/setup.py +159 -18
  41. package/src/devcouncil/cli/commands/show.py +76 -57
  42. package/src/devcouncil/cli/commands/status.py +117 -105
  43. package/src/devcouncil/cli/commands/tasks.py +55 -41
  44. package/src/devcouncil/cli/commands/trace.py +2 -1
  45. package/src/devcouncil/cli/commands/verify.py +158 -128
  46. package/src/devcouncil/cli/commands/version.py +20 -20
  47. package/src/devcouncil/cli/commands/watch.py +574 -0
  48. package/src/devcouncil/cli/main.py +42 -24
  49. package/src/devcouncil/council/prompts/arbiter.md +19 -19
  50. package/src/devcouncil/council/prompts/critic_a.md +10 -10
  51. package/src/devcouncil/council/prompts/critic_b.md +10 -10
  52. package/src/devcouncil/council/prompts/implementation_reviewer.md +16 -16
  53. package/src/devcouncil/council/prompts/planner_a.md +16 -16
  54. package/src/devcouncil/council/prompts/planner_b.md +16 -16
  55. package/src/devcouncil/council/prompts/rebuttal.md +10 -10
  56. package/src/devcouncil/council/prompts/spec_writer.md +12 -12
  57. package/src/devcouncil/domain/assumption.py +17 -17
  58. package/src/devcouncil/domain/critique.py +32 -32
  59. package/src/devcouncil/domain/evidence.py +27 -27
  60. package/src/devcouncil/domain/gap.py +26 -26
  61. package/src/devcouncil/domain/requirement.py +22 -22
  62. package/src/devcouncil/domain/task.py +26 -26
  63. package/src/devcouncil/execution/__init__.py +1 -1
  64. package/src/devcouncil/execution/context_builder.py +54 -54
  65. package/src/devcouncil/execution/executor.py +15 -15
  66. package/src/devcouncil/execution/hook_policy.py +24 -3
  67. package/src/devcouncil/execution/patch.py +28 -28
  68. package/src/devcouncil/execution/permissions.py +44 -44
  69. package/src/devcouncil/execution/prompt_builder.py +23 -23
  70. package/src/devcouncil/execution/task_runner.py +63 -63
  71. package/src/devcouncil/executors/__init__.py +1 -1
  72. package/src/devcouncil/executors/coding_cli.py +112 -0
  73. package/src/devcouncil/executors/mini_swe.py +63 -63
  74. package/src/devcouncil/executors/native/agent.py +81 -81
  75. package/src/devcouncil/executors/openhands.py +56 -56
  76. package/src/devcouncil/gating/__init__.py +1 -1
  77. package/src/devcouncil/gating/checks/clean_git.py +50 -45
  78. package/src/devcouncil/gating/checks/planned_files_check.py +32 -32
  79. package/src/devcouncil/gating/checks/requirement_coverage.py +26 -26
  80. package/src/devcouncil/gating/checks/secret_scan_check.py +34 -34
  81. package/src/devcouncil/gating/policy.py +157 -157
  82. package/src/devcouncil/indexing/__init__.py +1 -1
  83. package/src/devcouncil/indexing/ast_matcher.py +168 -0
  84. package/src/devcouncil/indexing/graph_index.py +48 -48
  85. package/src/devcouncil/indexing/lsp.py +120 -0
  86. package/src/devcouncil/indexing/repo_mapper.py +208 -204
  87. package/src/devcouncil/integrations/github.py +35 -35
  88. package/src/devcouncil/integrations/gitnexus.py +27 -27
  89. package/src/devcouncil/integrations/graphify.py +34 -34
  90. package/src/devcouncil/integrations/mcp/server.py +549 -96
  91. package/src/devcouncil/integrations/pr_comments.py +62 -0
  92. package/src/devcouncil/live/__init__.py +2 -0
  93. package/src/devcouncil/live/cards.py +207 -0
  94. package/src/devcouncil/live/models.py +63 -0
  95. package/src/devcouncil/live/repair_prompt.py +83 -0
  96. package/src/devcouncil/live/reviewer.py +70 -0
  97. package/src/devcouncil/live/signals.py +135 -0
  98. package/src/devcouncil/live/summary.py +34 -0
  99. package/src/devcouncil/live/tasks.py +18 -0
  100. package/src/devcouncil/live/transcripts.py +138 -0
  101. package/src/devcouncil/llm/__init__.py +1 -1
  102. package/src/devcouncil/llm/cache.py +38 -38
  103. package/src/devcouncil/llm/provider.py +146 -125
  104. package/src/devcouncil/llm/router.py +111 -111
  105. package/src/devcouncil/planning/__init__.py +1 -1
  106. package/src/devcouncil/planning/arbiter_service.py +57 -57
  107. package/src/devcouncil/planning/critique_service.py +66 -66
  108. package/src/devcouncil/planning/plan_service.py +46 -46
  109. package/src/devcouncil/planning/prompt_enhancer_service.py +86 -0
  110. package/src/devcouncil/planning/repair_service.py +39 -39
  111. package/src/devcouncil/planning/spec_service.py +44 -44
  112. package/src/devcouncil/reporting/github_check.py +32 -32
  113. package/src/devcouncil/reporting/json_report.py +20 -17
  114. package/src/devcouncil/reporting/markdown_report.py +68 -46
  115. package/src/devcouncil/reporting/report_builder.py +14 -14
  116. package/src/devcouncil/storage/db.py +66 -66
  117. package/src/devcouncil/storage/models.py +83 -83
  118. package/src/devcouncil/storage/repositories.py +299 -222
  119. package/src/devcouncil/telemetry/cost.py +34 -34
  120. package/src/devcouncil/telemetry/tracker.py +49 -49
  121. package/src/devcouncil/ui/__init__.py +1 -0
  122. package/src/devcouncil/ui/dashboard.py +122 -0
  123. package/src/devcouncil/utils/__init__.py +1 -1
  124. package/src/devcouncil/utils/redaction.py +141 -141
  125. package/src/devcouncil/verification/__init__.py +1 -1
  126. package/src/devcouncil/verification/implementation_reviewer.py +55 -55
  127. package/src/devcouncil/verification/verifier.py +319 -302
  128. package/uv.lock +1 -1
@@ -1,19 +1,19 @@
1
- Goal: {goal}
2
-
3
- Initial Requirements:
4
- {requirements_json}
5
-
6
- Plan A: {plan_a_json}
7
- Plan B: {plan_b_json}
8
-
9
- Critique of Plan B by Critic A: {critique_a_json}
10
- Critique of Plan A by Critic B: {critique_b_json}
11
-
12
- Rebuttal of Critic B by Planner A: {rebuttal_a_json}
13
- Rebuttal of Critic A by Planner B: {rebuttal_b_json}
14
-
15
- You are the arbiter engineering manager. Your goal is to produce the final, definitive set of requirements and tasks.
16
- - You do not decide by vibes.
17
- - High-severity unrefuted findings from critics must be incorporated into the final requirements or tasks.
18
- - If a planner successfully rebutted a finding, you may skip it.
19
- - Produce a single, coherent task graph.
1
+ Goal: {goal}
2
+
3
+ Initial Requirements:
4
+ {requirements_json}
5
+
6
+ Plan A: {plan_a_json}
7
+ Plan B: {plan_b_json}
8
+
9
+ Critique of Plan B by Critic A: {critique_a_json}
10
+ Critique of Plan A by Critic B: {critique_b_json}
11
+
12
+ Rebuttal of Critic B by Planner A: {rebuttal_a_json}
13
+ Rebuttal of Critic A by Planner B: {rebuttal_b_json}
14
+
15
+ You are the arbiter engineering manager. Your goal is to produce the final, definitive set of requirements and tasks.
16
+ - You do not decide by vibes.
17
+ - High-severity unrefuted findings from critics must be incorporated into the final requirements or tasks.
18
+ - If a planner successfully rebutted a finding, you may skip it.
19
+ - Produce a single, coherent task graph.
@@ -1,10 +1,10 @@
1
- Requirements:
2
- {requirements_json}
3
-
4
- Target Plan:
5
- {target_plan_json}
6
-
7
- You are a hostile staff engineer reviewing another team's implementation plan.
8
- Find missing requirements, bad assumptions, missing tests, security risks, migration risks, and unverifiable claims.
9
- Do not praise. Do not rewrite the plan.
10
- Every finding must include a falsifiable_check.
1
+ Requirements:
2
+ {requirements_json}
3
+
4
+ Target Plan:
5
+ {target_plan_json}
6
+
7
+ You are a hostile staff engineer reviewing another team's implementation plan.
8
+ Find missing requirements, bad assumptions, missing tests, security risks, migration risks, and unverifiable claims.
9
+ Do not praise. Do not rewrite the plan.
10
+ Every finding must include a falsifiable_check.
@@ -1,10 +1,10 @@
1
- Requirements:
2
- {requirements_json}
3
-
4
- Target Plan:
5
- {target_plan_json}
6
-
7
- You are a hostile staff engineer reviewing another team's implementation plan.
8
- Find missing requirements, bad assumptions, missing tests, security risks, migration risks, and unverifiable claims.
9
- Do not praise. Do not rewrite the plan.
10
- Every finding must include a falsifiable_check.
1
+ Requirements:
2
+ {requirements_json}
3
+
4
+ Target Plan:
5
+ {target_plan_json}
6
+
7
+ You are a hostile staff engineer reviewing another team's implementation plan.
8
+ Find missing requirements, bad assumptions, missing tests, security risks, migration risks, and unverifiable claims.
9
+ Do not praise. Do not rewrite the plan.
10
+ Every finding must include a falsifiable_check.
@@ -1,16 +1,16 @@
1
- You are an expert software reviewer. Review the following code changes against the task requirements.
2
- Task: {task.title}
3
- Description: {task.description}
4
-
5
- Requirements:
6
- {requirements_json}
7
-
8
- Code Diff:
9
- {diff}
10
-
11
- Your task is to identify if the implementation is complete, correct, and follows best practices.
12
- - Identify missing edge cases.
13
- - Identify architectural drift.
14
- - Identify security risks not caught by static scans.
15
-
16
- Return a JSON object with 'is_satisfactory' and a list of 'findings' (as Gap objects).
1
+ You are an expert software reviewer. Review the following code changes against the task requirements.
2
+ Task: {task.title}
3
+ Description: {task.description}
4
+
5
+ Requirements:
6
+ {requirements_json}
7
+
8
+ Code Diff:
9
+ {diff}
10
+
11
+ Your task is to identify if the implementation is complete, correct, and follows best practices.
12
+ - Identify missing edge cases.
13
+ - Identify architectural drift.
14
+ - Identify security risks not caught by static scans.
15
+
16
+ Return a JSON object with 'is_satisfactory' and a list of 'findings' (as Gap objects).
@@ -1,16 +1,16 @@
1
- Goal: {goal}
2
-
3
- Requirements:
4
- {requirements_json}
5
-
6
- Repository Map:
7
- {repo_map_json}
8
-
9
- Your task is to create a detailed implementation plan.
10
- - Break down the requirements into atomic implementation tasks.
11
- - For each task, specify which files will be created or modified.
12
- - Specify which tests are expected to verify the task.
13
- - Ensure each task maps back to at least one requirement.
14
-
15
- Role-specific instructions:
16
- You are the pragmatic tech lead. Optimize for simplicity and minimal dependencies.
1
+ Goal: {goal}
2
+
3
+ Requirements:
4
+ {requirements_json}
5
+
6
+ Repository Map:
7
+ {repo_map_json}
8
+
9
+ Your task is to create a detailed implementation plan.
10
+ - Break down the requirements into atomic implementation tasks.
11
+ - For each task, specify which files will be created or modified.
12
+ - Specify which tests are expected to verify the task.
13
+ - Ensure each task maps back to at least one requirement.
14
+
15
+ Role-specific instructions:
16
+ You are the pragmatic tech lead. Optimize for simplicity and minimal dependencies.
@@ -1,16 +1,16 @@
1
- Goal: {goal}
2
-
3
- Requirements:
4
- {requirements_json}
5
-
6
- Repository Map:
7
- {repo_map_json}
8
-
9
- Your task is to create a detailed implementation plan.
10
- - Break down the requirements into atomic implementation tasks.
11
- - For each task, specify which files will be created or modified.
12
- - Specify which tests are expected to verify the task.
13
- - Ensure each task maps back to at least one requirement.
14
-
15
- Role-specific instructions:
16
- You are the production-readiness architect. Optimize for security, performance, edge cases, failure modes, and maintainability. Assume the first plan will miss subtle requirements.
1
+ Goal: {goal}
2
+
3
+ Requirements:
4
+ {requirements_json}
5
+
6
+ Repository Map:
7
+ {repo_map_json}
8
+
9
+ Your task is to create a detailed implementation plan.
10
+ - Break down the requirements into atomic implementation tasks.
11
+ - For each task, specify which files will be created or modified.
12
+ - Specify which tests are expected to verify the task.
13
+ - Ensure each task maps back to at least one requirement.
14
+
15
+ Role-specific instructions:
16
+ You are the production-readiness architect. Optimize for security, performance, edge cases, failure modes, and maintainability. Assume the first plan will miss subtle requirements.
@@ -1,10 +1,10 @@
1
- Original Plan:
2
- {original_plan_json}
3
-
4
- Critique Findings:
5
- {findings_json}
6
-
7
- You are the planner who created the original plan. Review the critique findings.
8
- - A finding can be rejected only with artifact evidence or strong justification.
9
- - A finding can be accepted and converted into a requirement/task/test.
10
- - No hand-wavy rebuttals.
1
+ Original Plan:
2
+ {original_plan_json}
3
+
4
+ Critique Findings:
5
+ {findings_json}
6
+
7
+ You are the planner who created the original plan. Review the critique findings.
8
+ - A finding can be rejected only with artifact evidence or strong justification.
9
+ - A finding can be accepted and converted into a requirement/task/test.
10
+ - No hand-wavy rebuttals.
@@ -1,12 +1,12 @@
1
- Goal: {goal}
2
-
3
- Repository Map:
4
- {repo_map_json}
5
-
6
- Your task is to draft the initial software specification for this goal.
7
- 1. Identify functional and non-functional requirements.
8
- 2. Extract any assumptions you are making about the codebase or architecture.
9
- 3. List any blocking questions that the user must answer before implementation can proceed.
10
-
11
- Each requirement MUST have clear acceptance criteria with verification methods.
12
- Each assumption MUST have a confidence and impact level.
1
+ Goal: {goal}
2
+
3
+ Repository Map:
4
+ {repo_map_json}
5
+
6
+ Your task is to draft the initial software specification for this goal.
7
+ 1. Identify functional and non-functional requirements.
8
+ 2. Extract any assumptions you are making about the codebase or architecture.
9
+ 3. List any blocking questions that the user must answer before implementation can proceed.
10
+
11
+ Each requirement MUST have clear acceptance criteria with verification methods.
12
+ Each assumption MUST have a confidence and impact level.
@@ -1,17 +1,17 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Literal, List
3
-
4
- class Assumption(BaseModel):
5
- id: str
6
- statement: str
7
- confidence: Literal["low", "medium", "high"]
8
- impact: Literal["low", "medium", "high"]
9
- reversible: bool
10
- requires_user_confirmation: bool
11
- linked_requirement_ids: List[str] = Field(default_factory=list)
12
- status: Literal[
13
- "open",
14
- "confirmed",
15
- "rejected",
16
- "converted_to_requirement"
17
- ] = "open"
1
+ from pydantic import BaseModel, Field
2
+ from typing import Literal, List
3
+
4
+ class Assumption(BaseModel):
5
+ id: str
6
+ statement: str
7
+ confidence: Literal["low", "medium", "high"]
8
+ impact: Literal["low", "medium", "high"]
9
+ reversible: bool
10
+ requires_user_confirmation: bool
11
+ linked_requirement_ids: List[str] = Field(default_factory=list)
12
+ status: Literal[
13
+ "open",
14
+ "confirmed",
15
+ "rejected",
16
+ "converted_to_requirement"
17
+ ] = "open"
@@ -1,32 +1,32 @@
1
- from pydantic import BaseModel
2
- from typing import Literal, Optional
3
-
4
- class CritiqueFinding(BaseModel):
5
- id: str
6
- source_agent: str
7
- target_plan_id: str
8
- severity: Literal["low", "medium", "high", "critical"]
9
- finding_type: Literal[
10
- "missing_requirement",
11
- "missing_task",
12
- "missing_test",
13
- "bad_assumption",
14
- "architecture_risk",
15
- "security_risk",
16
- "performance_risk",
17
- "dependency_risk",
18
- "migration_risk",
19
- "unverifiable_acceptance_criteria"
20
- ]
21
- claim: str
22
- linked_requirement_id: Optional[str] = None
23
- suggested_requirement: Optional[str] = None
24
- suggested_task: Optional[str] = None
25
- falsifiable_check: str
26
- status: Literal[
27
- "open",
28
- "accepted",
29
- "rejected",
30
- "converted",
31
- "needs_user"
32
- ] = "open"
1
+ from pydantic import BaseModel
2
+ from typing import Literal, Optional
3
+
4
+ class CritiqueFinding(BaseModel):
5
+ id: str
6
+ source_agent: str
7
+ target_plan_id: str
8
+ severity: Literal["low", "medium", "high", "critical"]
9
+ finding_type: Literal[
10
+ "missing_requirement",
11
+ "missing_task",
12
+ "missing_test",
13
+ "bad_assumption",
14
+ "architecture_risk",
15
+ "security_risk",
16
+ "performance_risk",
17
+ "dependency_risk",
18
+ "migration_risk",
19
+ "unverifiable_acceptance_criteria"
20
+ ]
21
+ claim: str
22
+ linked_requirement_id: Optional[str] = None
23
+ suggested_requirement: Optional[str] = None
24
+ suggested_task: Optional[str] = None
25
+ falsifiable_check: str
26
+ status: Literal[
27
+ "open",
28
+ "accepted",
29
+ "rejected",
30
+ "converted",
31
+ "needs_user"
32
+ ] = "open"
@@ -1,27 +1,27 @@
1
- from pydantic import BaseModel
2
- from typing import Literal, List
3
-
4
- class CommandResult(BaseModel):
5
- command: str
6
- exit_code: int
7
- stdout_path: str
8
- stderr_path: str
9
- summary: str
10
-
11
- class DiffEvidence(BaseModel):
12
- task_id: str
13
- changed_files: List[str]
14
- added_files: List[str]
15
- deleted_files: List[str]
16
- diff_summary: str
17
-
18
- class VerificationEvidence(BaseModel):
19
- __test__ = False # Prevent pytest from collecting this as a test class
20
- requirement_id: str
21
- acceptance_criterion_id: str
22
- command: str
23
- status: Literal["passed", "failed", "not_run"]
24
- evidence_summary: str
25
-
26
- # Backward-compatible alias
27
- TestEvidence = VerificationEvidence
1
+ from pydantic import BaseModel
2
+ from typing import Literal, List
3
+
4
+ class CommandResult(BaseModel):
5
+ command: str
6
+ exit_code: int
7
+ stdout_path: str
8
+ stderr_path: str
9
+ summary: str
10
+
11
+ class DiffEvidence(BaseModel):
12
+ task_id: str
13
+ changed_files: List[str]
14
+ added_files: List[str]
15
+ deleted_files: List[str]
16
+ diff_summary: str
17
+
18
+ class VerificationEvidence(BaseModel):
19
+ __test__ = False # Prevent pytest from collecting this as a test class
20
+ requirement_id: str
21
+ acceptance_criterion_id: str
22
+ command: str
23
+ status: Literal["passed", "failed", "not_run"]
24
+ evidence_summary: str
25
+
26
+ # Backward-compatible alias
27
+ TestEvidence = VerificationEvidence
@@ -1,26 +1,26 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Literal, List, Optional
3
-
4
- class Gap(BaseModel):
5
- id: str
6
- severity: Literal["low", "medium", "high", "critical"]
7
- gap_type: Literal[
8
- "requirement_not_planned",
9
- "task_not_implemented",
10
- "planned_file_not_changed",
11
- "orphan_diff",
12
- "missing_test",
13
- "test_failed",
14
- "acceptance_criteria_unproven",
15
- "assumption_violated",
16
- "architecture_drift",
17
- "security_risk",
18
- "dependency_risk",
19
- "migration_gap"
20
- ]
21
- requirement_id: Optional[str] = None
22
- task_id: Optional[str] = None
23
- description: str
24
- evidence: List[str] = Field(default_factory=list)
25
- recommended_fix: str
26
- blocking: bool
1
+ from pydantic import BaseModel, Field
2
+ from typing import Literal, List, Optional
3
+
4
+ class Gap(BaseModel):
5
+ id: str
6
+ severity: Literal["low", "medium", "high", "critical"]
7
+ gap_type: Literal[
8
+ "requirement_not_planned",
9
+ "task_not_implemented",
10
+ "planned_file_not_changed",
11
+ "orphan_diff",
12
+ "missing_test",
13
+ "test_failed",
14
+ "acceptance_criteria_unproven",
15
+ "assumption_violated",
16
+ "architecture_drift",
17
+ "security_risk",
18
+ "dependency_risk",
19
+ "migration_gap"
20
+ ]
21
+ requirement_id: Optional[str] = None
22
+ task_id: Optional[str] = None
23
+ description: str
24
+ evidence: List[str] = Field(default_factory=list)
25
+ recommended_fix: str
26
+ blocking: bool
@@ -1,22 +1,22 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Literal, List
3
-
4
- class AcceptanceCriterion(BaseModel):
5
- id: str
6
- description: str
7
- verification_method: Literal[
8
- "unit_test",
9
- "integration_test",
10
- "manual",
11
- "static_check",
12
- "llm_review"
13
- ]
14
- required: bool = True
15
-
16
- class Requirement(BaseModel):
17
- id: str
18
- title: str
19
- description: str
20
- priority: Literal["low", "medium", "high", "critical"]
21
- source: Literal["user", "planner", "critic", "arbiter"]
22
- acceptance_criteria: List[AcceptanceCriterion] = Field(default_factory=list)
1
+ from pydantic import BaseModel, Field
2
+ from typing import Literal, List
3
+
4
+ class AcceptanceCriterion(BaseModel):
5
+ id: str
6
+ description: str
7
+ verification_method: Literal[
8
+ "unit_test",
9
+ "integration_test",
10
+ "manual",
11
+ "static_check",
12
+ "llm_review"
13
+ ]
14
+ required: bool = True
15
+
16
+ class Requirement(BaseModel):
17
+ id: str
18
+ title: str
19
+ description: str
20
+ priority: Literal["low", "medium", "high", "critical"]
21
+ source: Literal["user", "planner", "critic", "arbiter"]
22
+ acceptance_criteria: List[AcceptanceCriterion] = Field(default_factory=list)
@@ -1,26 +1,26 @@
1
- from pydantic import BaseModel, Field
2
- from typing import Literal, List
3
-
4
- class PlannedFile(BaseModel):
5
- path: str
6
- reason: str
7
- allowed_change: Literal["create", "modify", "delete", "read_only"]
8
-
9
- class Task(BaseModel):
10
- id: str
11
- title: str
12
- description: str
13
- requirement_ids: List[str] = Field(default_factory=list)
14
- acceptance_criterion_ids: List[str] = Field(default_factory=list)
15
- planned_files: List[PlannedFile] = Field(default_factory=list)
16
- expected_tests: List[str] = Field(default_factory=list)
17
- allowed_commands: List[str] = Field(default_factory=list)
18
- forbidden_changes: List[str] = Field(default_factory=list)
19
- status: Literal[
20
- "planned",
21
- "ready",
22
- "running",
23
- "blocked",
24
- "verified",
25
- "done"
26
- ] = "planned"
1
+ from pydantic import BaseModel, Field
2
+ from typing import Literal, List
3
+
4
+ class PlannedFile(BaseModel):
5
+ path: str
6
+ reason: str
7
+ allowed_change: Literal["create", "modify", "delete", "read_only"]
8
+
9
+ class Task(BaseModel):
10
+ id: str
11
+ title: str
12
+ description: str
13
+ requirement_ids: List[str] = Field(default_factory=list)
14
+ acceptance_criterion_ids: List[str] = Field(default_factory=list)
15
+ planned_files: List[PlannedFile] = Field(default_factory=list)
16
+ expected_tests: List[str] = Field(default_factory=list)
17
+ allowed_commands: List[str] = Field(default_factory=list)
18
+ forbidden_changes: List[str] = Field(default_factory=list)
19
+ status: Literal[
20
+ "planned",
21
+ "ready",
22
+ "running",
23
+ "blocked",
24
+ "verified",
25
+ "done"
26
+ ] = "planned"
@@ -1 +1 @@
1
-
1
+
@@ -1,60 +1,60 @@
1
- from pathlib import Path
2
- from typing import List
3
- from devcouncil.domain.task import Task
4
- from devcouncil.domain.requirement import Requirement
5
- from devcouncil.utils.redaction import redact_string
6
- import json
7
-
8
- class ContextBuilder:
9
- """Gathers repo-level and task-level context for agent prompts."""
10
-
11
- def __init__(self, project_root: Path):
12
- self.project_root = project_root
13
-
14
- def build_task_context(self, task: Task, requirements: List[Requirement]) -> str:
15
- """Collects all relevant information for implementing a task."""
16
-
17
- # 1. Map requirements relevant to this task
18
- req_map = {r.id: r for r in requirements}
19
- task_reqs = [req_map[rid] for rid in task.requirement_ids if rid in req_map]
20
-
21
- # 2. Gather content of planned files (if they exist)
22
- file_contents = {}
23
- for pf in task.planned_files:
24
- file_path = self.project_root / pf.path
25
- if file_path.exists() and file_path.is_file():
26
- try:
27
- raw = file_path.read_text(encoding="utf-8")
28
- file_contents[pf.path] = redact_string(raw)
29
- except Exception:
30
- file_contents[pf.path] = "[Error reading file]"
31
- else:
32
- file_contents[pf.path] = "[New file - does not exist yet]"
33
-
34
- # 3. Assemble the context string
35
- context = {
36
- "task": task.model_dump(),
37
- "relevant_requirements": [r.model_dump() for r in task_reqs],
38
- "file_contents": file_contents,
39
- "project_structure": self.get_structure_summary(task)
40
- }
41
-
42
- return json.dumps(context, indent=2)
43
-
44
- def get_structure_summary(self, task: Task = None) -> List[str]:
45
- """Simple list of files in the project for context."""
46
- try:
1
+ from pathlib import Path
2
+ from typing import List
3
+ from devcouncil.domain.task import Task
4
+ from devcouncil.domain.requirement import Requirement
5
+ from devcouncil.utils.redaction import redact_string
6
+ import json
7
+
8
+ class ContextBuilder:
9
+ """Gathers repo-level and task-level context for agent prompts."""
10
+
11
+ def __init__(self, project_root: Path):
12
+ self.project_root = project_root
13
+
14
+ def build_task_context(self, task: Task, requirements: List[Requirement]) -> str:
15
+ """Collects all relevant information for implementing a task."""
16
+
17
+ # 1. Map requirements relevant to this task
18
+ req_map = {r.id: r for r in requirements}
19
+ task_reqs = [req_map[rid] for rid in task.requirement_ids if rid in req_map]
20
+
21
+ # 2. Gather content of planned files (if they exist)
22
+ file_contents = {}
23
+ for pf in task.planned_files:
24
+ file_path = self.project_root / pf.path
25
+ if file_path.exists() and file_path.is_file():
26
+ try:
27
+ raw = file_path.read_text(encoding="utf-8")
28
+ file_contents[pf.path] = redact_string(raw)
29
+ except Exception:
30
+ file_contents[pf.path] = "[Error reading file]"
31
+ else:
32
+ file_contents[pf.path] = "[New file - does not exist yet]"
33
+
34
+ # 3. Assemble the context string
35
+ context = {
36
+ "task": task.model_dump(),
37
+ "relevant_requirements": [r.model_dump() for r in task_reqs],
38
+ "file_contents": file_contents,
39
+ "project_structure": self.get_structure_summary(task)
40
+ }
41
+
42
+ return json.dumps(context, indent=2)
43
+
44
+ def get_structure_summary(self, task: Task = None) -> List[str]:
45
+ """Simple list of files in the project for context."""
46
+ try:
47
47
  import subprocess
48
48
  output = subprocess.check_output(
49
49
  ["git", "ls-files", "--cached", "--others", "--exclude-standard"],
50
50
  cwd=self.project_root,
51
51
  stderr=subprocess.DEVNULL
52
52
  ).decode().splitlines()
53
-
54
- if task and task.planned_files:
55
- planned_paths = {pf.path for pf in task.planned_files}
56
- output = [p for p in output if p in planned_paths] + [p for p in output if p not in planned_paths]
57
-
58
- return output[:100] # Limit to avoid context overflow
59
- except Exception:
60
- return []
53
+
54
+ if task and task.planned_files:
55
+ planned_paths = {pf.path for pf in task.planned_files}
56
+ output = [p for p in output if p in planned_paths] + [p for p in output if p not in planned_paths]
57
+
58
+ return output[:100] # Limit to avoid context overflow
59
+ except Exception:
60
+ return []