claude-task-master 0.1.6__tar.gz → 0.1.8__tar.gz
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.
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/PKG-INFO +1 -1
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/pyproject.toml +1 -1
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/__init__.py +1 -1
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent.py +28 -2
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_phases.py +56 -3
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/orchestrator.py +4 -0
- claude_task_master-0.1.8/src/claude_task_master/core/planner.py +84 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts.py +8 -0
- claude_task_master-0.1.8/src/claude_task_master/core/prompts_coding_style.py +160 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts_planning.py +30 -6
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts_working.py +70 -16
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state_backup.py +11 -3
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state_file_ops.py +20 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/task_runner.py +13 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/workflow_stages.py +50 -8
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/PKG-INFO +1 -1
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/SOURCES.txt +1 -0
- claude_task_master-0.1.6/src/claude_task_master/core/planner.py +0 -46
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/README.md +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/setup.cfg +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/models.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/routes.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/routes_config.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/routes_control.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/routes_repo.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/routes_webhooks.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/api/server.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/auth/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/auth/middleware.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/auth/password.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/bin/claudetm +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/ci_helpers.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/config.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/control.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/fix_pr.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/fix_session.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/github.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/info.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/mailbox.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/cli_commands/workflow.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_exceptions.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_message.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_models.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_query.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/checkpoint.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/circuit_breaker.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/config.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/config_loader.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/console.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/context_accumulator.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/control.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/conversation.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/credentials.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/hooks.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/key_listener.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/logger.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/parallel.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/plan_updater.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/pr_context.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/progress_tracker.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts_base.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts_plan_update.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts_verification.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/rate_limit.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/shutdown.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state_exceptions.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state_pr.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/state_recovery.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/subagents.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/task_group.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/client.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/client_ci.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/client_pr.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/exceptions.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/github/pr_cycle.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mailbox/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mailbox/merger.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mailbox/models.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mailbox/storage.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mcp/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mcp/auth.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mcp/server.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/mcp/tools.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/server.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/utils/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/utils/debug_claude_md.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/utils/doctor.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/webhooks/__init__.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/webhooks/client.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/webhooks/config.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/webhooks/events.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/wrapper.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/dependency_links.txt +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/entry_points.txt +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/requires.txt +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master.egg-info/top_level.txt +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/tests/test_server.py +0 -0
- {claude_task_master-0.1.6 → claude_task_master-0.1.8}/tests/test_wrapper.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "claude-task-master"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.8"
|
|
8
8
|
description = "Autonomous task orchestration system that keeps Claude working until a goal is achieved"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -170,15 +170,35 @@ class AgentWrapper:
|
|
|
170
170
|
ValueError("query must be callable"),
|
|
171
171
|
)
|
|
172
172
|
|
|
173
|
-
def run_planning_phase(
|
|
173
|
+
def run_planning_phase(
|
|
174
|
+
self, goal: str, context: str = "", coding_style: str | None = None
|
|
175
|
+
) -> dict[str, Any]:
|
|
174
176
|
"""Run planning phase with read-only tools.
|
|
175
177
|
|
|
176
178
|
Always uses Opus (smartest model) for planning to ensure
|
|
177
179
|
high-quality task breakdown and complexity classification.
|
|
178
180
|
|
|
181
|
+
Args:
|
|
182
|
+
goal: The goal to plan for.
|
|
183
|
+
context: Additional context for planning.
|
|
184
|
+
coding_style: Optional coding style guide to inject into prompt.
|
|
185
|
+
|
|
186
|
+
Delegates to AgentPhaseExecutor for implementation.
|
|
187
|
+
"""
|
|
188
|
+
return self._phase_executor.run_planning_phase(goal, context, coding_style)
|
|
189
|
+
|
|
190
|
+
def generate_coding_style(self) -> dict[str, Any]:
|
|
191
|
+
"""Generate a coding style guide by analyzing the codebase.
|
|
192
|
+
|
|
193
|
+
Analyzes CLAUDE.md, convention files, and codebase to create a
|
|
194
|
+
concise coding style guide with workflow and conventions.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Dict with 'coding_style' and 'raw_output' keys.
|
|
198
|
+
|
|
179
199
|
Delegates to AgentPhaseExecutor for implementation.
|
|
180
200
|
"""
|
|
181
|
-
return self._phase_executor.
|
|
201
|
+
return self._phase_executor.generate_coding_style()
|
|
182
202
|
|
|
183
203
|
def run_work_session(
|
|
184
204
|
self,
|
|
@@ -189,6 +209,8 @@ class AgentWrapper:
|
|
|
189
209
|
required_branch: str | None = None,
|
|
190
210
|
create_pr: bool = True,
|
|
191
211
|
pr_group_info: dict | None = None,
|
|
212
|
+
target_branch: str = "main",
|
|
213
|
+
coding_style: str | None = None,
|
|
192
214
|
) -> dict[str, Any]:
|
|
193
215
|
"""Run a work session with full tools.
|
|
194
216
|
|
|
@@ -201,6 +223,8 @@ class AgentWrapper:
|
|
|
201
223
|
required_branch: Optional branch name the agent should be on.
|
|
202
224
|
create_pr: If True, instruct agent to create PR. If False, commit only.
|
|
203
225
|
pr_group_info: Optional dict with PR group context (name, completed_tasks, etc).
|
|
226
|
+
target_branch: The target branch for rebasing (default: "main").
|
|
227
|
+
coding_style: Optional coding style guide to inject into prompt.
|
|
204
228
|
|
|
205
229
|
Returns:
|
|
206
230
|
Dict with 'output', 'success', and 'model_used' keys.
|
|
@@ -215,6 +239,8 @@ class AgentWrapper:
|
|
|
215
239
|
required_branch=required_branch,
|
|
216
240
|
create_pr=create_pr,
|
|
217
241
|
pr_group_info=pr_group_info,
|
|
242
|
+
target_branch=target_branch,
|
|
243
|
+
coding_style=coding_style,
|
|
218
244
|
)
|
|
219
245
|
|
|
220
246
|
def verify_success_criteria(self, criteria: str, context: str = "") -> dict[str, Any]:
|
{claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/agent_phases.py
RENAMED
|
@@ -13,7 +13,13 @@ from typing import TYPE_CHECKING, Any, TypeVar
|
|
|
13
13
|
|
|
14
14
|
from . import console
|
|
15
15
|
from .agent_models import ModelType, get_tools_for_phase
|
|
16
|
-
from .prompts import
|
|
16
|
+
from .prompts import (
|
|
17
|
+
build_coding_style_prompt,
|
|
18
|
+
build_planning_prompt,
|
|
19
|
+
build_verification_prompt,
|
|
20
|
+
build_work_prompt,
|
|
21
|
+
extract_coding_style,
|
|
22
|
+
)
|
|
17
23
|
|
|
18
24
|
if TYPE_CHECKING:
|
|
19
25
|
from .agent_query import AgentQueryExecutor
|
|
@@ -104,7 +110,9 @@ class AgentPhaseExecutor:
|
|
|
104
110
|
self.get_agents_func = get_agents_func
|
|
105
111
|
self.process_message_func = process_message_func
|
|
106
112
|
|
|
107
|
-
def run_planning_phase(
|
|
113
|
+
def run_planning_phase(
|
|
114
|
+
self, goal: str, context: str = "", coding_style: str | None = None
|
|
115
|
+
) -> dict[str, Any]:
|
|
108
116
|
"""Run planning phase with read-only tools.
|
|
109
117
|
|
|
110
118
|
Always uses Opus (smartest model) for planning to ensure
|
|
@@ -113,12 +121,17 @@ class AgentPhaseExecutor:
|
|
|
113
121
|
Args:
|
|
114
122
|
goal: The goal to plan for.
|
|
115
123
|
context: Additional context for planning.
|
|
124
|
+
coding_style: Optional coding style guide to inject into prompt.
|
|
116
125
|
|
|
117
126
|
Returns:
|
|
118
127
|
Dict with 'plan', 'criteria', and 'raw_output' keys.
|
|
119
128
|
"""
|
|
120
129
|
# Build prompt for planning
|
|
121
|
-
prompt = build_planning_prompt(
|
|
130
|
+
prompt = build_planning_prompt(
|
|
131
|
+
goal=goal,
|
|
132
|
+
context=context if context else None,
|
|
133
|
+
coding_style=coding_style,
|
|
134
|
+
)
|
|
122
135
|
|
|
123
136
|
# Always use Opus for planning (smartest model)
|
|
124
137
|
console.info("Planning with Opus (smartest model)...")
|
|
@@ -151,6 +164,8 @@ class AgentPhaseExecutor:
|
|
|
151
164
|
required_branch: str | None = None,
|
|
152
165
|
create_pr: bool = True,
|
|
153
166
|
pr_group_info: dict | None = None,
|
|
167
|
+
target_branch: str = "main",
|
|
168
|
+
coding_style: str | None = None,
|
|
154
169
|
) -> dict[str, Any]:
|
|
155
170
|
"""Run a work session with full tools.
|
|
156
171
|
|
|
@@ -163,6 +178,8 @@ class AgentPhaseExecutor:
|
|
|
163
178
|
required_branch: Optional branch name the agent should be on.
|
|
164
179
|
create_pr: If True, instruct agent to create PR. If False, commit only.
|
|
165
180
|
pr_group_info: Optional dict with PR group context (name, completed_tasks, etc).
|
|
181
|
+
target_branch: The target branch for rebasing (default: "main").
|
|
182
|
+
coding_style: Optional coding style guide to inject into prompt.
|
|
166
183
|
|
|
167
184
|
Returns:
|
|
168
185
|
Dict with 'output', 'success', and 'model_used' keys.
|
|
@@ -175,6 +192,8 @@ class AgentPhaseExecutor:
|
|
|
175
192
|
required_branch=required_branch,
|
|
176
193
|
create_pr=create_pr,
|
|
177
194
|
pr_group_info=pr_group_info,
|
|
195
|
+
target_branch=target_branch,
|
|
196
|
+
coding_style=coding_style,
|
|
178
197
|
)
|
|
179
198
|
|
|
180
199
|
# Run async query with optional model override
|
|
@@ -325,3 +344,37 @@ class AgentPhaseExecutor:
|
|
|
325
344
|
|
|
326
345
|
# Default criteria if none specified
|
|
327
346
|
return "All tasks in the task list are completed successfully."
|
|
347
|
+
|
|
348
|
+
def generate_coding_style(self) -> dict[str, Any]:
|
|
349
|
+
"""Generate a coding style guide by analyzing the codebase.
|
|
350
|
+
|
|
351
|
+
Analyzes CLAUDE.md, convention files, and sample source files
|
|
352
|
+
to create a concise coding style guide.
|
|
353
|
+
|
|
354
|
+
Returns:
|
|
355
|
+
Dict with 'coding_style' and 'raw_output' keys.
|
|
356
|
+
"""
|
|
357
|
+
# Build prompt for coding style generation
|
|
358
|
+
prompt = build_coding_style_prompt()
|
|
359
|
+
|
|
360
|
+
console.info("Generating coding style guide with Opus...")
|
|
361
|
+
|
|
362
|
+
# Run with planning tools (read-only) and Opus for quality
|
|
363
|
+
result = run_async_with_cleanup(
|
|
364
|
+
self.query_executor.run_query(
|
|
365
|
+
prompt=prompt,
|
|
366
|
+
tools=self.get_tools_for_phase("planning"),
|
|
367
|
+
model_override=ModelType.OPUS, # Use Opus for quality
|
|
368
|
+
get_model_name_func=self.get_model_name_func,
|
|
369
|
+
get_agents_func=self.get_agents_func,
|
|
370
|
+
process_message_func=self.process_message_func,
|
|
371
|
+
)
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
# Extract the coding style content
|
|
375
|
+
coding_style = extract_coding_style(result)
|
|
376
|
+
|
|
377
|
+
return {
|
|
378
|
+
"coding_style": coding_style,
|
|
379
|
+
"raw_output": result,
|
|
380
|
+
}
|
{claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/orchestrator.py
RENAMED
|
@@ -1337,11 +1337,15 @@ After fixing everything, run the tests again to confirm they pass.
|
|
|
1337
1337
|
After completing your fixes, end with: TASK COMPLETE"""
|
|
1338
1338
|
|
|
1339
1339
|
try:
|
|
1340
|
+
# Load coding style for consistent style in fix session
|
|
1341
|
+
coding_style = self.state_manager.load_coding_style()
|
|
1342
|
+
|
|
1340
1343
|
self.agent.run_work_session(
|
|
1341
1344
|
task_description=task_description,
|
|
1342
1345
|
context=context,
|
|
1343
1346
|
model_override=ModelType.OPUS,
|
|
1344
1347
|
create_pr=True,
|
|
1348
|
+
coding_style=coding_style,
|
|
1345
1349
|
)
|
|
1346
1350
|
state.session_count += 1
|
|
1347
1351
|
self.state_manager.save_state(state)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Planner - Orchestrates initial planning phase (read-only tools)."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from . import console
|
|
6
|
+
from .agent import AgentWrapper
|
|
7
|
+
from .state import StateManager
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Planner:
|
|
11
|
+
"""Handles the initial planning phase."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, agent: AgentWrapper, state_manager: StateManager):
|
|
14
|
+
"""Initialize planner."""
|
|
15
|
+
self.agent = agent
|
|
16
|
+
self.state_manager = state_manager
|
|
17
|
+
|
|
18
|
+
def ensure_coding_style(self) -> str | None:
|
|
19
|
+
"""Ensure coding style guide exists, generating it if needed.
|
|
20
|
+
|
|
21
|
+
Checks if coding-style.md exists. If not, generates it by analyzing
|
|
22
|
+
CLAUDE.md and convention files in the codebase.
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
The coding style guide content, or None if generation failed.
|
|
26
|
+
"""
|
|
27
|
+
# Check if coding style already exists
|
|
28
|
+
coding_style = self.state_manager.load_coding_style()
|
|
29
|
+
if coding_style:
|
|
30
|
+
console.info("Using existing coding style guide")
|
|
31
|
+
return coding_style
|
|
32
|
+
|
|
33
|
+
# Generate coding style by analyzing codebase
|
|
34
|
+
console.info("Generating coding style guide from codebase...")
|
|
35
|
+
result = self.agent.generate_coding_style()
|
|
36
|
+
|
|
37
|
+
coding_style_content: str = result.get("coding_style", "")
|
|
38
|
+
if coding_style_content:
|
|
39
|
+
self.state_manager.save_coding_style(coding_style_content)
|
|
40
|
+
console.success("Coding style guide generated and saved")
|
|
41
|
+
return coding_style_content
|
|
42
|
+
|
|
43
|
+
console.warning("Could not generate coding style guide")
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
def create_plan(self, goal: str) -> dict[str, Any]:
|
|
47
|
+
"""Create initial task plan using read-only tools.
|
|
48
|
+
|
|
49
|
+
First generates coding style guide if it doesn't exist, then
|
|
50
|
+
runs planning phase with the coding style injected.
|
|
51
|
+
"""
|
|
52
|
+
# Ensure coding style exists (generate if needed)
|
|
53
|
+
coding_style = self.ensure_coding_style()
|
|
54
|
+
|
|
55
|
+
# Load any existing context
|
|
56
|
+
context = self.state_manager.load_context()
|
|
57
|
+
|
|
58
|
+
# Run planning phase with Claude (with coding style)
|
|
59
|
+
result = self.agent.run_planning_phase(
|
|
60
|
+
goal=goal, context=context, coding_style=coding_style
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
# Extract plan and criteria from result
|
|
64
|
+
plan = result.get("plan", "")
|
|
65
|
+
criteria = result.get("criteria", "")
|
|
66
|
+
|
|
67
|
+
# Save to state
|
|
68
|
+
if plan:
|
|
69
|
+
self.state_manager.save_plan(plan)
|
|
70
|
+
if criteria:
|
|
71
|
+
self.state_manager.save_criteria(criteria)
|
|
72
|
+
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
def update_plan_progress(self, task_index: int, completed: bool) -> None:
|
|
76
|
+
"""Update task completion status in plan."""
|
|
77
|
+
plan = self.state_manager.load_plan()
|
|
78
|
+
if not plan:
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
# TODO: Parse markdown checkboxes and update status
|
|
82
|
+
# This will require parsing the plan.md file and toggling checkboxes
|
|
83
|
+
|
|
84
|
+
self.state_manager.save_plan(plan)
|
{claude_task_master-0.1.6 → claude_task_master-0.1.8}/src/claude_task_master/core/prompts.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Prompt Templates - Centralized, maintainable prompt generation.
|
|
2
2
|
|
|
3
3
|
This module provides structured prompt templates for different agent phases:
|
|
4
|
+
- Coding Style: Generate concise coding style guide from codebase analysis
|
|
4
5
|
- Planning: Initial codebase analysis and task creation
|
|
5
6
|
- Plan Update: Modifying existing plans based on change requests
|
|
6
7
|
- Working: Task execution with verification
|
|
@@ -12,6 +13,7 @@ All prompts are designed to be concise, structured, and token-efficient.
|
|
|
12
13
|
This module re-exports all prompt functions for backward compatibility.
|
|
13
14
|
The actual implementations are in:
|
|
14
15
|
- prompts_base.py: PromptSection, PromptBuilder
|
|
16
|
+
- prompts_coding_style.py: build_coding_style_prompt, extract_coding_style
|
|
15
17
|
- prompts_planning.py: build_planning_prompt
|
|
16
18
|
- prompts_plan_update.py: build_plan_update_prompt
|
|
17
19
|
- prompts_working.py: build_work_prompt
|
|
@@ -24,6 +26,9 @@ from __future__ import annotations
|
|
|
24
26
|
# Re-export base classes
|
|
25
27
|
from .prompts_base import PromptBuilder, PromptSection
|
|
26
28
|
|
|
29
|
+
# Re-export coding style prompts
|
|
30
|
+
from .prompts_coding_style import build_coding_style_prompt, extract_coding_style
|
|
31
|
+
|
|
27
32
|
# Re-export planning prompts
|
|
28
33
|
from .prompts_plan_update import build_plan_update_prompt
|
|
29
34
|
from .prompts_planning import build_planning_prompt
|
|
@@ -43,6 +48,9 @@ __all__ = [
|
|
|
43
48
|
# Base classes
|
|
44
49
|
"PromptSection",
|
|
45
50
|
"PromptBuilder",
|
|
51
|
+
# Coding Style
|
|
52
|
+
"build_coding_style_prompt",
|
|
53
|
+
"extract_coding_style",
|
|
46
54
|
# Planning
|
|
47
55
|
"build_planning_prompt",
|
|
48
56
|
"build_plan_update_prompt",
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"""Coding Style Generation Prompt for Claude Task Master.
|
|
2
|
+
|
|
3
|
+
This module contains the prompt for generating a concise coding style guide
|
|
4
|
+
by analyzing CLAUDE.md and convention files. The generated guide captures:
|
|
5
|
+
- Coding workflow (TDD, development process)
|
|
6
|
+
- Code style conventions (naming, formatting)
|
|
7
|
+
- Project-specific requirements
|
|
8
|
+
|
|
9
|
+
The guide is saved to coding-style.md and injected into planning and work
|
|
10
|
+
prompts to save tokens while ensuring consistent code quality.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from .prompts_base import PromptBuilder
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def build_coding_style_prompt() -> str:
|
|
19
|
+
"""Build the prompt for generating a coding style guide.
|
|
20
|
+
|
|
21
|
+
This prompt instructs Claude to analyze CLAUDE.md and convention files
|
|
22
|
+
to create a concise coding style guide that captures the project's
|
|
23
|
+
workflow (TDD, development process) and code conventions.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Complete coding style generation prompt.
|
|
27
|
+
"""
|
|
28
|
+
builder = PromptBuilder(
|
|
29
|
+
intro="""You are analyzing a codebase to extract its coding workflow and style guide.
|
|
30
|
+
|
|
31
|
+
Your mission: **Create a CONCISE coding guide (under 600 words).**
|
|
32
|
+
|
|
33
|
+
Focus on extracting:
|
|
34
|
+
1. **Development workflow** (TDD, test-first, iteration patterns)
|
|
35
|
+
2. **Code conventions** (naming, formatting, imports)
|
|
36
|
+
3. **Project-specific requirements** (from CLAUDE.md)
|
|
37
|
+
|
|
38
|
+
This guide will be injected into every coding task, so keep it SHORT and ACTIONABLE.
|
|
39
|
+
|
|
40
|
+
## TOOL RESTRICTIONS (MANDATORY)
|
|
41
|
+
|
|
42
|
+
**ALLOWED TOOLS (use ONLY these):**
|
|
43
|
+
- `Read` - Read files to understand patterns
|
|
44
|
+
- `Glob` - Find files by pattern
|
|
45
|
+
- `Grep` - Search for code patterns
|
|
46
|
+
- `Bash` - Run commands (check configs, linters, etc.)
|
|
47
|
+
|
|
48
|
+
**FORBIDDEN TOOLS (NEVER use):**
|
|
49
|
+
- `Write` - Do NOT write any files
|
|
50
|
+
- `Edit` - Do NOT edit any files
|
|
51
|
+
- `Task` - Do NOT launch any agents"""
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
builder.add_section(
|
|
55
|
+
"Step 1: Read CLAUDE.md (PRIORITY)",
|
|
56
|
+
"""**Start by reading `CLAUDE.md` at the repository root.**
|
|
57
|
+
|
|
58
|
+
This file contains the project's coding requirements and workflow instructions.
|
|
59
|
+
Extract:
|
|
60
|
+
- Development workflow (TDD, test-driven, iteration patterns)
|
|
61
|
+
- Code quality requirements
|
|
62
|
+
- Testing approach (test first? mock patterns?)
|
|
63
|
+
- Any specific coding rules or constraints
|
|
64
|
+
|
|
65
|
+
Also check these if CLAUDE.md doesn't exist:
|
|
66
|
+
- `.claude/instructions.md`
|
|
67
|
+
- `CONTRIBUTING.md`
|
|
68
|
+
- `.cursorrules`, `.github/copilot-instructions.md`""",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
builder.add_section(
|
|
72
|
+
"Step 2: Check Configs",
|
|
73
|
+
"""Quickly scan linter/formatter configs for conventions:
|
|
74
|
+
|
|
75
|
+
- Python: `pyproject.toml` [tool.ruff], `ruff.toml`
|
|
76
|
+
- JS/TS: `.eslintrc`, `.prettierrc`, `biome.json`
|
|
77
|
+
- General: `.editorconfig`
|
|
78
|
+
|
|
79
|
+
Note line length, quote style, import ordering rules.""",
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
builder.add_section(
|
|
83
|
+
"Step 3: Generate Coding Guide",
|
|
84
|
+
"""Create a CONCISE guide with these sections (skip if not applicable):
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Coding Style
|
|
88
|
+
|
|
89
|
+
## Workflow
|
|
90
|
+
- [TDD approach? Test-first? Iteration pattern?]
|
|
91
|
+
- [Required checks before commit: tests, lint, types?]
|
|
92
|
+
|
|
93
|
+
## Code Style
|
|
94
|
+
- [Naming: snake_case, camelCase, etc.]
|
|
95
|
+
- [Formatting: line length, quotes, indentation]
|
|
96
|
+
- [Imports: ordering, grouping]
|
|
97
|
+
|
|
98
|
+
## Types
|
|
99
|
+
- [Type annotations required? Strictness level?]
|
|
100
|
+
|
|
101
|
+
## Testing
|
|
102
|
+
- [Test file naming, location]
|
|
103
|
+
- [Assertion style, mock patterns]
|
|
104
|
+
- [Coverage requirements?]
|
|
105
|
+
|
|
106
|
+
## Error Handling
|
|
107
|
+
- [Exception patterns, logging approach]
|
|
108
|
+
|
|
109
|
+
## Project-Specific
|
|
110
|
+
- [Any unique requirements from CLAUDE.md]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Rules:**
|
|
114
|
+
- Each section: 2-4 bullet points MAX
|
|
115
|
+
- Be SPECIFIC and ACTIONABLE: "Run `pytest` before commit" not "Test your code"
|
|
116
|
+
- Capture the WORKFLOW, not just style
|
|
117
|
+
- Include actual commands where relevant
|
|
118
|
+
- Total guide: under 600 words""",
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
builder.add_section(
|
|
122
|
+
"Output Format",
|
|
123
|
+
"""Output ONLY the coding guide in markdown format.
|
|
124
|
+
|
|
125
|
+
Start with `# Coding Style` and include only relevant sections.
|
|
126
|
+
|
|
127
|
+
Do NOT include explanations or meta-commentary - just the guide itself.
|
|
128
|
+
|
|
129
|
+
End with:
|
|
130
|
+
```
|
|
131
|
+
CODING_STYLE_COMPLETE
|
|
132
|
+
```""",
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
return builder.build()
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def extract_coding_style(result: str) -> str:
|
|
139
|
+
"""Extract the coding style guide from the generation result.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
result: The raw output from the coding style generation.
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
The extracted coding style guide content.
|
|
146
|
+
"""
|
|
147
|
+
# Remove the completion marker if present
|
|
148
|
+
content = result.replace("CODING_STYLE_COMPLETE", "").strip()
|
|
149
|
+
|
|
150
|
+
# If it starts with markdown header, return as-is
|
|
151
|
+
if content.startswith("# Coding Style") or content.startswith("# coding style"):
|
|
152
|
+
return content
|
|
153
|
+
|
|
154
|
+
# Try to find the coding style section
|
|
155
|
+
if "# Coding Style" in content:
|
|
156
|
+
idx = content.index("# Coding Style")
|
|
157
|
+
return content[idx:].strip()
|
|
158
|
+
|
|
159
|
+
# Fallback: wrap the content
|
|
160
|
+
return f"# Coding Style\n\n{content}"
|
|
@@ -9,12 +9,15 @@ from __future__ import annotations
|
|
|
9
9
|
from .prompts_base import PromptBuilder
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def build_planning_prompt(
|
|
12
|
+
def build_planning_prompt(
|
|
13
|
+
goal: str, context: str | None = None, coding_style: str | None = None
|
|
14
|
+
) -> str:
|
|
13
15
|
"""Build the planning phase prompt.
|
|
14
16
|
|
|
15
17
|
Args:
|
|
16
18
|
goal: The user's goal to achieve.
|
|
17
19
|
context: Optional accumulated context from previous sessions.
|
|
20
|
+
coding_style: Optional coding style guide to inject.
|
|
18
21
|
|
|
19
22
|
Returns:
|
|
20
23
|
Complete planning prompt.
|
|
@@ -65,16 +68,37 @@ You just need to OUTPUT the plan as TEXT in your response.
|
|
|
65
68
|
if context:
|
|
66
69
|
builder.add_section("Previous Context", context.strip())
|
|
67
70
|
|
|
71
|
+
# Coding style section if available (generated from codebase analysis)
|
|
72
|
+
if coding_style:
|
|
73
|
+
builder.add_section(
|
|
74
|
+
"Project Coding Style",
|
|
75
|
+
f"""The following coding style guide was extracted from this codebase.
|
|
76
|
+
**Tasks you create MUST respect these conventions.**
|
|
77
|
+
|
|
78
|
+
{coding_style.strip()}""",
|
|
79
|
+
)
|
|
80
|
+
|
|
68
81
|
# Exploration phase - READ ONLY
|
|
69
82
|
builder.add_section(
|
|
70
83
|
"Step 1: Explore Codebase (READ ONLY)",
|
|
71
84
|
"""Thoroughly analyze the codebase using READ-ONLY operations:
|
|
72
|
-
1. **Read** key files (README, configs, main modules)
|
|
73
|
-
2. **Glob** to find patterns (`**/*.py`, `src/**/*.ts`)
|
|
74
|
-
3. **Grep** for specific code (class definitions, imports)
|
|
75
|
-
4. **Identify** tests, CI config, and coding standards
|
|
76
85
|
|
|
77
|
-
|
|
86
|
+
**CRITICAL: Read Project Conventions FIRST**
|
|
87
|
+
1. **Read `CLAUDE.md`** (if exists) - Contains coding requirements, project instructions,
|
|
88
|
+
and conventions that MUST be followed. This file defines how code should be written.
|
|
89
|
+
2. Also check: `.claude/instructions.md`, `CONTRIBUTING.md`, `.cursorrules`, `.github/copilot-instructions.md`
|
|
90
|
+
|
|
91
|
+
**Then explore the codebase:**
|
|
92
|
+
3. **Read** key files (README, configs, main modules)
|
|
93
|
+
4. **Glob** to find patterns (`**/*.py`, `src/**/*.ts`)
|
|
94
|
+
5. **Grep** for specific code (class definitions, imports)
|
|
95
|
+
6. **Identify** tests, CI config, and existing code patterns
|
|
96
|
+
|
|
97
|
+
**Remember:** Any coding requirements found in `CLAUDE.md` or similar convention files
|
|
98
|
+
MUST be respected when creating tasks. Include relevant requirements in task descriptions
|
|
99
|
+
so the working phase follows project standards.
|
|
100
|
+
|
|
101
|
+
Understand the architecture AND coding standards before creating tasks.""",
|
|
78
102
|
)
|
|
79
103
|
|
|
80
104
|
# Task creation phase - organized by PR
|