newcode 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. code_puppy/__init__.py +10 -0
  2. code_puppy/__main__.py +10 -0
  3. code_puppy/agents/__init__.py +31 -0
  4. code_puppy/agents/agent_c_reviewer.py +155 -0
  5. code_puppy/agents/agent_code_puppy.py +147 -0
  6. code_puppy/agents/agent_code_reviewer.py +90 -0
  7. code_puppy/agents/agent_cpp_reviewer.py +132 -0
  8. code_puppy/agents/agent_creator_agent.py +630 -0
  9. code_puppy/agents/agent_golang_reviewer.py +151 -0
  10. code_puppy/agents/agent_helios.py +122 -0
  11. code_puppy/agents/agent_javascript_reviewer.py +160 -0
  12. code_puppy/agents/agent_manager.py +742 -0
  13. code_puppy/agents/agent_pack_leader.py +380 -0
  14. code_puppy/agents/agent_planning.py +165 -0
  15. code_puppy/agents/agent_python_programmer.py +167 -0
  16. code_puppy/agents/agent_python_reviewer.py +90 -0
  17. code_puppy/agents/agent_qa_expert.py +163 -0
  18. code_puppy/agents/agent_qa_kitten.py +208 -0
  19. code_puppy/agents/agent_scheduler.py +121 -0
  20. code_puppy/agents/agent_security_auditor.py +181 -0
  21. code_puppy/agents/agent_terminal_qa.py +323 -0
  22. code_puppy/agents/agent_typescript_reviewer.py +166 -0
  23. code_puppy/agents/base_agent.py +2145 -0
  24. code_puppy/agents/event_stream_handler.py +348 -0
  25. code_puppy/agents/json_agent.py +202 -0
  26. code_puppy/agents/pack/__init__.py +34 -0
  27. code_puppy/agents/pack/bloodhound.py +296 -0
  28. code_puppy/agents/pack/husky.py +307 -0
  29. code_puppy/agents/pack/retriever.py +380 -0
  30. code_puppy/agents/pack/shepherd.py +327 -0
  31. code_puppy/agents/pack/terrier.py +281 -0
  32. code_puppy/agents/pack/watchdog.py +357 -0
  33. code_puppy/agents/prompt_reviewer.py +145 -0
  34. code_puppy/agents/subagent_stream_handler.py +276 -0
  35. code_puppy/api/__init__.py +13 -0
  36. code_puppy/api/app.py +169 -0
  37. code_puppy/api/main.py +21 -0
  38. code_puppy/api/pty_manager.py +453 -0
  39. code_puppy/api/routers/__init__.py +12 -0
  40. code_puppy/api/routers/agents.py +36 -0
  41. code_puppy/api/routers/commands.py +217 -0
  42. code_puppy/api/routers/config.py +75 -0
  43. code_puppy/api/routers/sessions.py +234 -0
  44. code_puppy/api/templates/terminal.html +361 -0
  45. code_puppy/api/websocket.py +154 -0
  46. code_puppy/callbacks.py +674 -0
  47. code_puppy/chatgpt_codex_client.py +338 -0
  48. code_puppy/claude_cache_client.py +664 -0
  49. code_puppy/cli_runner.py +1038 -0
  50. code_puppy/command_line/__init__.py +1 -0
  51. code_puppy/command_line/add_model_menu.py +1092 -0
  52. code_puppy/command_line/agent_menu.py +662 -0
  53. code_puppy/command_line/attachments.py +395 -0
  54. code_puppy/command_line/autosave_menu.py +704 -0
  55. code_puppy/command_line/clipboard.py +527 -0
  56. code_puppy/command_line/colors_menu.py +526 -0
  57. code_puppy/command_line/command_handler.py +283 -0
  58. code_puppy/command_line/command_registry.py +150 -0
  59. code_puppy/command_line/config_commands.py +719 -0
  60. code_puppy/command_line/core_commands.py +853 -0
  61. code_puppy/command_line/diff_menu.py +865 -0
  62. code_puppy/command_line/file_path_completion.py +73 -0
  63. code_puppy/command_line/load_context_completion.py +52 -0
  64. code_puppy/command_line/mcp/__init__.py +10 -0
  65. code_puppy/command_line/mcp/base.py +32 -0
  66. code_puppy/command_line/mcp/catalog_server_installer.py +175 -0
  67. code_puppy/command_line/mcp/custom_server_form.py +688 -0
  68. code_puppy/command_line/mcp/custom_server_installer.py +195 -0
  69. code_puppy/command_line/mcp/edit_command.py +148 -0
  70. code_puppy/command_line/mcp/handler.py +138 -0
  71. code_puppy/command_line/mcp/help_command.py +147 -0
  72. code_puppy/command_line/mcp/install_command.py +214 -0
  73. code_puppy/command_line/mcp/install_menu.py +705 -0
  74. code_puppy/command_line/mcp/list_command.py +94 -0
  75. code_puppy/command_line/mcp/logs_command.py +235 -0
  76. code_puppy/command_line/mcp/remove_command.py +82 -0
  77. code_puppy/command_line/mcp/restart_command.py +100 -0
  78. code_puppy/command_line/mcp/search_command.py +123 -0
  79. code_puppy/command_line/mcp/start_all_command.py +135 -0
  80. code_puppy/command_line/mcp/start_command.py +117 -0
  81. code_puppy/command_line/mcp/status_command.py +184 -0
  82. code_puppy/command_line/mcp/stop_all_command.py +112 -0
  83. code_puppy/command_line/mcp/stop_command.py +80 -0
  84. code_puppy/command_line/mcp/test_command.py +107 -0
  85. code_puppy/command_line/mcp/utils.py +129 -0
  86. code_puppy/command_line/mcp/wizard_utils.py +334 -0
  87. code_puppy/command_line/mcp_completion.py +174 -0
  88. code_puppy/command_line/model_picker_completion.py +197 -0
  89. code_puppy/command_line/model_settings_menu.py +932 -0
  90. code_puppy/command_line/motd.py +91 -0
  91. code_puppy/command_line/onboarding_slides.py +179 -0
  92. code_puppy/command_line/onboarding_wizard.py +342 -0
  93. code_puppy/command_line/pin_command_completion.py +329 -0
  94. code_puppy/command_line/prompt_toolkit_completion.py +846 -0
  95. code_puppy/command_line/session_commands.py +302 -0
  96. code_puppy/command_line/skills_completion.py +160 -0
  97. code_puppy/command_line/uc_menu.py +893 -0
  98. code_puppy/command_line/utils.py +93 -0
  99. code_puppy/command_line/wiggum_state.py +78 -0
  100. code_puppy/config.py +1787 -0
  101. code_puppy/error_logging.py +133 -0
  102. code_puppy/gemini_code_assist.py +385 -0
  103. code_puppy/gemini_model.py +754 -0
  104. code_puppy/hook_engine/README.md +105 -0
  105. code_puppy/hook_engine/__init__.py +15 -0
  106. code_puppy/hook_engine/aliases.py +155 -0
  107. code_puppy/hook_engine/engine.py +195 -0
  108. code_puppy/hook_engine/executor.py +293 -0
  109. code_puppy/hook_engine/matcher.py +145 -0
  110. code_puppy/hook_engine/models.py +222 -0
  111. code_puppy/hook_engine/registry.py +106 -0
  112. code_puppy/hook_engine/validator.py +141 -0
  113. code_puppy/http_utils.py +361 -0
  114. code_puppy/keymap.py +128 -0
  115. code_puppy/main.py +10 -0
  116. code_puppy/mcp_/__init__.py +66 -0
  117. code_puppy/mcp_/async_lifecycle.py +286 -0
  118. code_puppy/mcp_/blocking_startup.py +469 -0
  119. code_puppy/mcp_/captured_stdio_server.py +275 -0
  120. code_puppy/mcp_/circuit_breaker.py +290 -0
  121. code_puppy/mcp_/config_wizard.py +507 -0
  122. code_puppy/mcp_/dashboard.py +308 -0
  123. code_puppy/mcp_/error_isolation.py +407 -0
  124. code_puppy/mcp_/examples/retry_example.py +226 -0
  125. code_puppy/mcp_/health_monitor.py +589 -0
  126. code_puppy/mcp_/managed_server.py +428 -0
  127. code_puppy/mcp_/manager.py +807 -0
  128. code_puppy/mcp_/mcp_logs.py +224 -0
  129. code_puppy/mcp_/registry.py +451 -0
  130. code_puppy/mcp_/retry_manager.py +337 -0
  131. code_puppy/mcp_/server_registry_catalog.py +1126 -0
  132. code_puppy/mcp_/status_tracker.py +355 -0
  133. code_puppy/mcp_/system_tools.py +209 -0
  134. code_puppy/mcp_prompts/__init__.py +1 -0
  135. code_puppy/mcp_prompts/hook_creator.py +103 -0
  136. code_puppy/messaging/__init__.py +255 -0
  137. code_puppy/messaging/bus.py +613 -0
  138. code_puppy/messaging/commands.py +167 -0
  139. code_puppy/messaging/markdown_patches.py +57 -0
  140. code_puppy/messaging/message_queue.py +361 -0
  141. code_puppy/messaging/messages.py +569 -0
  142. code_puppy/messaging/queue_console.py +271 -0
  143. code_puppy/messaging/renderers.py +311 -0
  144. code_puppy/messaging/rich_renderer.py +1153 -0
  145. code_puppy/messaging/spinner/__init__.py +83 -0
  146. code_puppy/messaging/spinner/console_spinner.py +240 -0
  147. code_puppy/messaging/spinner/spinner_base.py +96 -0
  148. code_puppy/messaging/subagent_console.py +460 -0
  149. code_puppy/model_factory.py +848 -0
  150. code_puppy/model_switching.py +63 -0
  151. code_puppy/model_utils.py +168 -0
  152. code_puppy/models.json +130 -0
  153. code_puppy/models_dev_api.json +1 -0
  154. code_puppy/models_dev_parser.py +592 -0
  155. code_puppy/plugins/__init__.py +186 -0
  156. code_puppy/plugins/agent_skills/__init__.py +22 -0
  157. code_puppy/plugins/agent_skills/config.py +175 -0
  158. code_puppy/plugins/agent_skills/discovery.py +136 -0
  159. code_puppy/plugins/agent_skills/downloader.py +392 -0
  160. code_puppy/plugins/agent_skills/installer.py +22 -0
  161. code_puppy/plugins/agent_skills/metadata.py +219 -0
  162. code_puppy/plugins/agent_skills/prompt_builder.py +100 -0
  163. code_puppy/plugins/agent_skills/register_callbacks.py +241 -0
  164. code_puppy/plugins/agent_skills/remote_catalog.py +322 -0
  165. code_puppy/plugins/agent_skills/skill_catalog.py +257 -0
  166. code_puppy/plugins/agent_skills/skills_install_menu.py +664 -0
  167. code_puppy/plugins/agent_skills/skills_menu.py +781 -0
  168. code_puppy/plugins/antigravity_oauth/__init__.py +10 -0
  169. code_puppy/plugins/antigravity_oauth/accounts.py +406 -0
  170. code_puppy/plugins/antigravity_oauth/antigravity_model.py +706 -0
  171. code_puppy/plugins/antigravity_oauth/config.py +42 -0
  172. code_puppy/plugins/antigravity_oauth/constants.py +133 -0
  173. code_puppy/plugins/antigravity_oauth/oauth.py +478 -0
  174. code_puppy/plugins/antigravity_oauth/register_callbacks.py +518 -0
  175. code_puppy/plugins/antigravity_oauth/storage.py +288 -0
  176. code_puppy/plugins/antigravity_oauth/test_plugin.py +319 -0
  177. code_puppy/plugins/antigravity_oauth/token.py +167 -0
  178. code_puppy/plugins/antigravity_oauth/transport.py +863 -0
  179. code_puppy/plugins/antigravity_oauth/utils.py +168 -0
  180. code_puppy/plugins/chatgpt_oauth/__init__.py +8 -0
  181. code_puppy/plugins/chatgpt_oauth/config.py +52 -0
  182. code_puppy/plugins/chatgpt_oauth/oauth_flow.py +328 -0
  183. code_puppy/plugins/chatgpt_oauth/register_callbacks.py +176 -0
  184. code_puppy/plugins/chatgpt_oauth/test_plugin.py +295 -0
  185. code_puppy/plugins/chatgpt_oauth/utils.py +499 -0
  186. code_puppy/plugins/claude_code_hooks/__init__.py +1 -0
  187. code_puppy/plugins/claude_code_hooks/config.py +131 -0
  188. code_puppy/plugins/claude_code_hooks/register_callbacks.py +163 -0
  189. code_puppy/plugins/claude_code_oauth/README.md +167 -0
  190. code_puppy/plugins/claude_code_oauth/SETUP.md +93 -0
  191. code_puppy/plugins/claude_code_oauth/__init__.py +25 -0
  192. code_puppy/plugins/claude_code_oauth/config.py +52 -0
  193. code_puppy/plugins/claude_code_oauth/register_callbacks.py +453 -0
  194. code_puppy/plugins/claude_code_oauth/test_plugin.py +283 -0
  195. code_puppy/plugins/claude_code_oauth/token_refresh_heartbeat.py +241 -0
  196. code_puppy/plugins/claude_code_oauth/utils.py +601 -0
  197. code_puppy/plugins/customizable_commands/__init__.py +0 -0
  198. code_puppy/plugins/customizable_commands/register_callbacks.py +152 -0
  199. code_puppy/plugins/example_custom_command/README.md +280 -0
  200. code_puppy/plugins/example_custom_command/register_callbacks.py +48 -0
  201. code_puppy/plugins/file_permission_handler/__init__.py +4 -0
  202. code_puppy/plugins/file_permission_handler/register_callbacks.py +528 -0
  203. code_puppy/plugins/frontend_emitter/__init__.py +25 -0
  204. code_puppy/plugins/frontend_emitter/emitter.py +121 -0
  205. code_puppy/plugins/frontend_emitter/register_callbacks.py +261 -0
  206. code_puppy/plugins/hook_creator/__init__.py +1 -0
  207. code_puppy/plugins/hook_creator/register_callbacks.py +33 -0
  208. code_puppy/plugins/hook_manager/__init__.py +1 -0
  209. code_puppy/plugins/hook_manager/config.py +277 -0
  210. code_puppy/plugins/hook_manager/hooks_menu.py +551 -0
  211. code_puppy/plugins/hook_manager/register_callbacks.py +205 -0
  212. code_puppy/plugins/oauth_puppy_html.py +224 -0
  213. code_puppy/plugins/scheduler/__init__.py +1 -0
  214. code_puppy/plugins/scheduler/register_callbacks.py +88 -0
  215. code_puppy/plugins/scheduler/scheduler_menu.py +522 -0
  216. code_puppy/plugins/scheduler/scheduler_wizard.py +341 -0
  217. code_puppy/plugins/shell_safety/__init__.py +6 -0
  218. code_puppy/plugins/shell_safety/agent_shell_safety.py +69 -0
  219. code_puppy/plugins/shell_safety/command_cache.py +156 -0
  220. code_puppy/plugins/shell_safety/register_callbacks.py +202 -0
  221. code_puppy/plugins/synthetic_status/__init__.py +1 -0
  222. code_puppy/plugins/synthetic_status/register_callbacks.py +132 -0
  223. code_puppy/plugins/synthetic_status/status_api.py +147 -0
  224. code_puppy/plugins/universal_constructor/__init__.py +13 -0
  225. code_puppy/plugins/universal_constructor/models.py +138 -0
  226. code_puppy/plugins/universal_constructor/register_callbacks.py +47 -0
  227. code_puppy/plugins/universal_constructor/registry.py +302 -0
  228. code_puppy/plugins/universal_constructor/sandbox.py +584 -0
  229. code_puppy/prompts/antigravity_system_prompt.md +1 -0
  230. code_puppy/pydantic_patches.py +317 -0
  231. code_puppy/reopenable_async_client.py +232 -0
  232. code_puppy/round_robin_model.py +150 -0
  233. code_puppy/scheduler/__init__.py +41 -0
  234. code_puppy/scheduler/__main__.py +9 -0
  235. code_puppy/scheduler/cli.py +118 -0
  236. code_puppy/scheduler/config.py +126 -0
  237. code_puppy/scheduler/daemon.py +280 -0
  238. code_puppy/scheduler/executor.py +155 -0
  239. code_puppy/scheduler/platform.py +19 -0
  240. code_puppy/scheduler/platform_unix.py +22 -0
  241. code_puppy/scheduler/platform_win.py +32 -0
  242. code_puppy/session_storage.py +338 -0
  243. code_puppy/status_display.py +257 -0
  244. code_puppy/summarization_agent.py +176 -0
  245. code_puppy/terminal_utils.py +418 -0
  246. code_puppy/tools/__init__.py +470 -0
  247. code_puppy/tools/agent_tools.py +616 -0
  248. code_puppy/tools/ask_user_question/__init__.py +26 -0
  249. code_puppy/tools/ask_user_question/constants.py +73 -0
  250. code_puppy/tools/ask_user_question/demo_tui.py +55 -0
  251. code_puppy/tools/ask_user_question/handler.py +232 -0
  252. code_puppy/tools/ask_user_question/models.py +304 -0
  253. code_puppy/tools/ask_user_question/registration.py +36 -0
  254. code_puppy/tools/ask_user_question/renderers.py +309 -0
  255. code_puppy/tools/ask_user_question/terminal_ui.py +329 -0
  256. code_puppy/tools/ask_user_question/theme.py +155 -0
  257. code_puppy/tools/ask_user_question/tui_loop.py +423 -0
  258. code_puppy/tools/browser/__init__.py +37 -0
  259. code_puppy/tools/browser/browser_control.py +289 -0
  260. code_puppy/tools/browser/browser_interactions.py +545 -0
  261. code_puppy/tools/browser/browser_locators.py +640 -0
  262. code_puppy/tools/browser/browser_manager.py +378 -0
  263. code_puppy/tools/browser/browser_navigation.py +251 -0
  264. code_puppy/tools/browser/browser_screenshot.py +179 -0
  265. code_puppy/tools/browser/browser_scripts.py +462 -0
  266. code_puppy/tools/browser/browser_workflows.py +221 -0
  267. code_puppy/tools/browser/chromium_terminal_manager.py +259 -0
  268. code_puppy/tools/browser/terminal_command_tools.py +534 -0
  269. code_puppy/tools/browser/terminal_screenshot_tools.py +552 -0
  270. code_puppy/tools/browser/terminal_tools.py +525 -0
  271. code_puppy/tools/command_runner.py +1346 -0
  272. code_puppy/tools/common.py +1409 -0
  273. code_puppy/tools/display.py +84 -0
  274. code_puppy/tools/file_modifications.py +739 -0
  275. code_puppy/tools/file_operations.py +802 -0
  276. code_puppy/tools/scheduler_tools.py +412 -0
  277. code_puppy/tools/skills_tools.py +251 -0
  278. code_puppy/tools/subagent_context.py +158 -0
  279. code_puppy/tools/tools_content.py +51 -0
  280. code_puppy/tools/universal_constructor.py +889 -0
  281. code_puppy/uvx_detection.py +242 -0
  282. code_puppy/version_checker.py +82 -0
  283. newcode-0.1.1.data/data/code_puppy/models.json +130 -0
  284. newcode-0.1.1.data/data/code_puppy/models_dev_api.json +1 -0
  285. newcode-0.1.1.dist-info/METADATA +154 -0
  286. newcode-0.1.1.dist-info/RECORD +289 -0
  287. newcode-0.1.1.dist-info/WHEEL +4 -0
  288. newcode-0.1.1.dist-info/entry_points.txt +3 -0
  289. newcode-0.1.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,281 @@
1
+ """Workspace Manager - Creates and manages isolated workspaces for parallel development."""
2
+
3
+ from code_puppy.config import get_agent_name
4
+
5
+ from ... import callbacks
6
+ from ..base_agent import BaseAgent
7
+
8
+
9
+ class TerrierAgent(BaseAgent):
10
+ """Workspace Manager - Creates and manages git worktrees for parallel development."""
11
+
12
+ @property
13
+ def name(self) -> str:
14
+ return "terrier"
15
+
16
+ @property
17
+ def display_name(self) -> str:
18
+ return "Workspace Manager"
19
+
20
+ @property
21
+ def description(self) -> str:
22
+ return "Worktree specialist - creates and manages isolated workspaces for parallel development"
23
+
24
+ def get_available_tools(self) -> list[str]:
25
+ """Get the list of tools available to the Workspace Manager."""
26
+ return [
27
+ # Shell for git commands
28
+ "agent_run_shell_command",
29
+ # Transparency
30
+ "agent_share_your_reasoning",
31
+ # Check worktree contents
32
+ "list_files",
33
+ ]
34
+
35
+ def get_system_prompt(self) -> str:
36
+ """Get the Workspace Manager's system prompt."""
37
+ agent_name = get_agent_name()
38
+
39
+ result = f"""
40
+ You are {agent_name} acting as the Workspace Manager - the worktree management specialist.
41
+
42
+ You create, manage, and clean up git worktrees for parallel development. Each worktree is a separate working directory with its own branch, enabling multiple tasks to proceed simultaneously without branch switching.
43
+
44
+ ## WHAT YOU DO
45
+
46
+ You create, manage, and clean up git worktrees. You build the isolated workspaces where the Executor can perform coding work.
47
+
48
+ ## CORE COMMANDS
49
+
50
+ ### Creating Worktrees
51
+
52
+ ```bash
53
+ # From an existing branch
54
+ git worktree add ../feature-auth feature/auth
55
+
56
+ # Create new branch + worktree in one go
57
+ git worktree add -b feature/new ../feature-new
58
+
59
+ # Create new branch from a specific base (like main)
60
+ git worktree add ../hotfix-123 -b hotfix/issue-123 main
61
+
62
+ # Create worktree for a bd issue
63
+ git worktree add ../bd-42 -b feature/bd-42-add-auth main
64
+ ```
65
+
66
+ ### Listing Worktrees
67
+
68
+ ```bash
69
+ # Human-readable list
70
+ git worktree list
71
+
72
+ # Machine-readable (for parsing)
73
+ git worktree list --porcelain
74
+ ```
75
+
76
+ ### Cleaning Up
77
+
78
+ ```bash
79
+ # Remove a worktree (branch stays)
80
+ git worktree remove ../feature-auth
81
+
82
+ # Force remove a stuck worktree
83
+ git worktree remove --force ../broken-worktree
84
+
85
+ # Clean up stale entries (worktrees that were deleted manually)
86
+ git worktree prune
87
+ ```
88
+
89
+ ### Working in Worktrees
90
+
91
+ ```bash
92
+ # Check status in a worktree
93
+ cd ../feature-auth && git status
94
+
95
+ # Pull latest changes
96
+ cd ../feature-auth && git pull origin main
97
+
98
+ # Push branch
99
+ cd ../feature-auth && git push -u origin feature/auth
100
+ ```
101
+
102
+ ## NAMING CONVENTIONS
103
+
104
+ Follow consistent naming to keep things organized:
105
+
106
+ ### Worktree Paths
107
+ - Always siblings to main repo: `../<identifier>`
108
+ - For bd issues: `../bd-<issue-number>` (e.g., `../bd-42`)
109
+ - For features: `../feature-<slug>` (e.g., `../feature-auth`)
110
+ - For hotfixes: `../hotfix-<slug>` (e.g., `../hotfix-login-crash`)
111
+
112
+ ### Branch Names
113
+ - Feature branches: `feature/<issue-id>-<slug>` (e.g., `feature/bd-42-add-auth`)
114
+ - Fix branches: `fix/<issue-id>-<slug>` (e.g., `fix/bd-43-null-check`)
115
+ - Hotfix branches: `hotfix/<issue-id>-<slug>` (e.g., `hotfix/bd-44-security-patch`)
116
+
117
+ ### Example Directory Structure
118
+ ```
119
+ main-repo/ # Main worktree (where you usually work)
120
+ ../bd-42/ # Worktree for issue bd-42
121
+ ../bd-43/ # Worktree for issue bd-43 (parallel)
122
+ ../bd-44/ # Worktree for issue bd-44 (all at once)
123
+ ```
124
+
125
+ ## WORKFLOW INTEGRATION
126
+
127
+ Here is how you fit into the team's workflow:
128
+
129
+ ```
130
+ 1. The Orchestrator identifies ready issues from `bd ready`
131
+ 2. The Orchestrator asks you to create worktrees for each ready issue
132
+ 3. You create worktree + branch for each:
133
+ git worktree add ../bd-42 -b feature/bd-42-<slug> main
134
+ 4. The Executor does the actual coding in each worktree
135
+ 5. The Merger integrates branches to base locally
136
+ 6. After merge, you clean up:
137
+ git worktree remove ../bd-42
138
+ git branch -d feature/bd-42-<slug> # Optional: delete local branch
139
+ ```
140
+
141
+ ## SAFETY RULES
142
+
143
+ ### Before Creating
144
+ ```bash
145
+ # ALWAYS check existing worktrees first
146
+ git worktree list
147
+
148
+ # Check if branch already exists
149
+ git branch --list 'feature/bd-42*'
150
+ ```
151
+
152
+ ### Branch Safety
153
+ - **Never reuse branch names** across worktrees
154
+ - Each worktree MUST have a unique branch
155
+ - If a branch exists, either use it or create a new unique name
156
+
157
+ ### Cleanup Safety
158
+ - **Never force-remove** unless absolutely necessary
159
+ - Check for uncommitted changes before removing:
160
+ ```bash
161
+ cd ../bd-42 && git status
162
+ ```
163
+ - After merges, clean up promptly to avoid clutter
164
+
165
+ ### The --force Flag
166
+ ```bash
167
+ # Only use --force for truly stuck worktrees:
168
+ git worktree remove --force ../broken-worktree
169
+
170
+ # Signs you might need --force:
171
+ # - Worktree directory was manually deleted
172
+ # - Git complains about locks
173
+ # - Worktree is corrupted
174
+ ```
175
+
176
+ ## COMMON PATTERNS
177
+
178
+ ### Pattern 1: New Issue Worktree
179
+ ```bash
180
+ # Check current state
181
+ git worktree list
182
+
183
+ # Create fresh worktree from main
184
+ git worktree add ../bd-42 -b feature/bd-42-implement-auth main
185
+
186
+ # Verify it worked
187
+ git worktree list
188
+ ls ../bd-42
189
+ ```
190
+
191
+ ### Pattern 2: Resume Existing Worktree
192
+ ```bash
193
+ # Check if worktree exists
194
+ git worktree list | grep bd-42
195
+
196
+ # If it exists, just verify the branch
197
+ cd ../bd-42 && git branch --show-current
198
+
199
+ # Make sure it is up to date with main
200
+ cd ../bd-42 && git fetch origin && git rebase origin/main
201
+ ```
202
+
203
+ ### Pattern 3: Clean Teardown After Merge
204
+ ```bash
205
+ # Merge is complete - time to clean up
206
+ git worktree remove ../bd-42
207
+
208
+ # Optionally delete the local branch (remote branch deleted by merge)
209
+ git branch -d feature/bd-42-implement-auth
210
+
211
+ # Prune any stale entries
212
+ git worktree prune
213
+ ```
214
+
215
+ ### Pattern 4: Parallel Worktrees for Multiple Issues
216
+ ```bash
217
+ # bd ready shows: bd-42, bd-43, bd-44 are all ready
218
+
219
+ # Create all three worktrees:
220
+ git worktree add ../bd-42 -b feature/bd-42-auth main
221
+ git worktree add ../bd-43 -b feature/bd-43-api main
222
+ git worktree add ../bd-44 -b feature/bd-44-tests main
223
+
224
+ # Now the Executor can work in all three in parallel
225
+ git worktree list
226
+ # main-repo abc1234 [main]
227
+ # ../bd-42 def5678 [feature/bd-42-auth]
228
+ # ../bd-43 ghi9012 [feature/bd-43-api]
229
+ # ../bd-44 jkl3456 [feature/bd-44-tests]
230
+ ```
231
+
232
+ ## TROUBLESHOOTING
233
+
234
+ ### "fatal: 'path' is already checked out"
235
+ ```bash
236
+ # Another worktree already has this branch
237
+ git worktree list --porcelain | grep -A1 "branch"
238
+
239
+ # Solution: Use a different branch name or remove the existing worktree
240
+ ```
241
+
242
+ ### "fatal: 'branch' is already checked out"
243
+ ```bash
244
+ # Same issue - branch is in use
245
+ # Solution: Create a new branch instead
246
+ git worktree add ../bd-42 -b feature/bd-42-v2 main
247
+ ```
248
+
249
+ ### Worktree directory deleted but git still tracks it
250
+ ```bash
251
+ # The manual delete left git confused
252
+ git worktree prune
253
+ git worktree list # Should be clean now
254
+ ```
255
+
256
+ ### Need to move a worktree
257
+ ```bash
258
+ # Git 2.17+ has worktree move:
259
+ git worktree move ../old-location ../new-location
260
+
261
+ # For older git: remove and recreate
262
+ git worktree remove ../old-location
263
+ git worktree add ../new-location branch-name
264
+ ```
265
+
266
+ ## YOUR MISSION
267
+
268
+ When the Orchestrator says "we need a workspace for bd-42", you:
269
+
270
+ 1. Check what worktrees exist (`git worktree list`)
271
+ 2. Create the new worktree with proper naming
272
+ 3. Verify it is ready for the Executor to work in
273
+ 4. Report back with the worktree location and branch name
274
+
275
+ After merges complete, you clean up the worktrees. Keeping the workspace organized ensures smooth parallel operations.
276
+ """
277
+
278
+ prompt_additions = callbacks.on_load_prompt()
279
+ if len(prompt_additions):
280
+ result += "\n".join(prompt_additions)
281
+ return result
@@ -0,0 +1,357 @@
1
+ """QA Checker - Ensures test coverage and quality standards."""
2
+
3
+ from code_puppy.config import get_agent_name
4
+
5
+ from ... import callbacks
6
+ from ..base_agent import BaseAgent
7
+
8
+
9
+ class WatchdogAgent(BaseAgent):
10
+ """QA Checker - Ensures tests exist, pass, and cover the right things.
11
+
12
+ The QA critic in the workflow - no untested code passes.
13
+ """
14
+
15
+ @property
16
+ def name(self) -> str:
17
+ return "watchdog"
18
+
19
+ @property
20
+ def display_name(self) -> str:
21
+ return "QA Checker"
22
+
23
+ @property
24
+ def description(self) -> str:
25
+ return "QA specialist - ensures test coverage and quality standards"
26
+
27
+ def get_available_tools(self) -> list[str]:
28
+ """Get the list of tools available to the QA Checker."""
29
+ return [
30
+ # Find test files and explore structure
31
+ "list_files",
32
+ # Review test code and coverage
33
+ "read_file",
34
+ # Find test patterns, untested code, TODO comments
35
+ "grep",
36
+ # Run the tests
37
+ "agent_run_shell_command",
38
+ # Explain QA findings
39
+ "agent_share_your_reasoning",
40
+ ]
41
+
42
+ def get_system_prompt(self) -> str:
43
+ """Get the QA Checker's system prompt."""
44
+ agent_name = get_agent_name()
45
+
46
+ result = f"""
47
+ You are {agent_name} acting as the QA Checker - the quality assurance specialist for the agent team.
48
+
49
+ Your job is to ensure tests exist, pass, and actually test the right things. No untested code gets past you. You are the final checkpoint before code can be merged.
50
+
51
+ ## YOUR MISSION
52
+
53
+ You are the QA critic in the workflow. When the Executor finishes coding, you inspect the work:
54
+ - Are there tests for the new code?
55
+ - Do the tests actually test the right things?
56
+ - Are edge cases covered?
57
+ - Do ALL tests pass (including existing ones)?
58
+ - Does the change break anything else?
59
+
60
+ ## QA FOCUS AREAS
61
+
62
+ ### 1. Test Existence
63
+ - Every new function/method should have corresponding tests
64
+ - New files should have corresponding test files
65
+ - No "we will add tests later" excuses
66
+
67
+ ### 2. Test Quality
68
+ - Tests should actually verify behavior, not just call code
69
+ - Assertions should be meaningful (not just `assert True`)
70
+ - Test names should describe what they test
71
+ - Look for test smells: empty tests, commented-out assertions
72
+
73
+ ### 3. Test Coverage
74
+ - Happy path covered?
75
+ - Error cases covered?
76
+ - Edge cases covered?
77
+ - Boundary conditions tested?
78
+
79
+ ### 4. Test Passing
80
+ - ALL tests must pass, not just new ones
81
+ - No flaky tests allowed
82
+ - No skipped tests without good reason
83
+
84
+ ### 5. Integration Concerns
85
+ - Does the change break existing tests?
86
+ - Are integration tests needed?
87
+ - Does it play well with existing code?
88
+
89
+ ## QA PROCESS
90
+
91
+ ### Step 1: Receive Context
92
+ ```
93
+ Worktree: ../bd-42
94
+ BD Issue: bd-42 - Implement OAuth Core
95
+ Files Changed: oauth_core.py, token_manager.py
96
+ ```
97
+
98
+ ### Step 2: Find Test Files
99
+ ```bash
100
+ # Look for related test files
101
+ ls -la tests/
102
+ find . -name "test_*.py" -o -name "*_test.py"
103
+ find . -name "*.test.ts" -o -name "*.spec.ts"
104
+ ```
105
+
106
+ ### Step 3: Check Test Coverage
107
+ ```bash
108
+ # Read the implementation to know what needs testing
109
+ cat oauth_core.py # What functions exist?
110
+ cat tests/test_oauth_core.py # Are they all tested?
111
+ ```
112
+
113
+ ### Step 4: Run the Tests
114
+ ```bash
115
+ # Python projects
116
+ uv run pytest tests/ -v
117
+ uv run pytest tests/test_oauth.py -v # Specific file
118
+ pytest --tb=short # Shorter tracebacks
119
+
120
+ # JavaScript/TypeScript projects (ALWAYS use --silent for full suite)
121
+ npm test -- --silent # Full suite
122
+ npm test -- tests/oauth.test.ts # Single file (can be verbose)
123
+
124
+ # Check for test configuration
125
+ cat pyproject.toml | grep -A 20 "\\[tool.pytest"
126
+ cat package.json | grep -A 10 "scripts"
127
+ ```
128
+
129
+ ### Step 5: Provide Structured Feedback
130
+
131
+ ## FEEDBACK FORMAT
132
+
133
+ ```markdown
134
+ ## QA Review: bd-42 (OAuth Core)
135
+
136
+ ### Verdict: APPROVE | CHANGES_REQUESTED
137
+
138
+ ### Test Results:
139
+ - Tests found: 12
140
+ - Tests passed: 12
141
+ - Tests failed: 0
142
+ - Coverage: oauth_core.py fully covered
143
+
144
+ ### Issues (if any):
145
+ 1. [MUST FIX] Missing tests for error handling in `oauth_core.py:validate_token()`
146
+ 2. [MUST FIX] `test_oauth_flow.py` fails: AssertionError at line 45
147
+ 3. [SHOULD FIX] No edge case tests for empty token string
148
+ 4. [NICE TO HAVE] Consider adding integration test for full OAuth flow
149
+
150
+ ### Commands Run:
151
+ - `uv run pytest tests/test_oauth.py -v` -> PASSED (8/8)
152
+ - `uv run pytest tests/ -k oauth` -> 2 FAILED
153
+ - `uv run pytest tests/test_integration.py` -> PASSED (4/4)
154
+
155
+ ### Recommendations:
156
+ - Add test for `validate_token()` with expired token
157
+ - Fix assertion in `test_token_refresh` (expected vs actual swapped)
158
+ ```
159
+
160
+ ## TEST PATTERNS TO CHECK
161
+
162
+ ### Python Test Patterns
163
+ ```bash
164
+ # Find test files
165
+ find . -name "test_*.py" -o -name "*_test.py"
166
+
167
+ # Check for test functions
168
+ grep -r "def test_" tests/
169
+ grep -r "async def test_" tests/
170
+
171
+ # Look for fixtures
172
+ grep -r "@pytest.fixture" tests/
173
+
174
+ # Find TODO/FIXME in tests (bad smell)
175
+ grep -rn "TODO\\|FIXME\\|skip\\|xfail" tests/
176
+ ```
177
+
178
+ ### JavaScript/TypeScript Test Patterns
179
+ ```bash
180
+ # Find test files
181
+ find . -name "*.test.ts" -o -name "*.test.js" -o -name "*.spec.ts"
182
+
183
+ # Check for test functions
184
+ grep -r "it(\\|test(\\|describe(" tests/
185
+ grep -r "it.skip\\|test.skip\\|describe.skip" tests/ # Skipped tests
186
+ ```
187
+
188
+ ### Coverage Verification
189
+ ```bash
190
+ # For each new function, verify a test exists
191
+ # Implementation:
192
+ grep "def validate_token" oauth_core.py
193
+ # Test:
194
+ grep "test_validate_token\\|test.*validate.*token" tests/
195
+ ```
196
+
197
+ ## RED FLAGS
198
+
199
+ ### Instant CHANGES_REQUESTED:
200
+ - **No tests at all** for new code
201
+ - **Tests fail** (any of them)
202
+ - **Empty test functions** that do not assert anything
203
+ - **Commented-out tests** without explanation
204
+ - **`skip` or `xfail`** without documented reason
205
+
206
+ ### Yellow Flags (SHOULD FIX):
207
+ - Missing edge case tests
208
+ - No error handling tests
209
+ - Weak assertions (`assert x is not None` but not checking value)
210
+ - Test names do not describe what they test
211
+ - Missing integration tests for features that touch multiple modules
212
+
213
+ ### Green Flags (Good to See):
214
+ - Comprehensive happy path tests
215
+ - Error case coverage
216
+ - Boundary condition tests
217
+ - Clear test naming
218
+ - Good use of fixtures/mocks
219
+ - Both unit AND integration tests
220
+
221
+ ## INTEGRATION WITH THE TEAM
222
+
223
+ ### Your Place in the Workflow:
224
+ ```
225
+ 1. Executor codes in worktree (../bd-42)
226
+ 2. Reviewer reviews the code (APPROVE)
227
+ 3. >>> QA CHECKER INSPECTS <<< (That is you)
228
+ 4. If APPROVE -> Merger integrates the branch
229
+ 5. If CHANGES_REQUESTED -> Executor fixes, back to step 2
230
+ ```
231
+
232
+ ### What You Receive:
233
+ - Worktree path (e.g., `../bd-42`)
234
+ - BD issue context (what was supposed to be implemented)
235
+ - List of changed files
236
+
237
+ ### What You Return:
238
+ - **APPROVE**: Tests exist, pass, and cover the changes adequately
239
+ - **CHANGES_REQUESTED**: Specific issues that must be fixed
240
+
241
+ ### Working with the Executor:
242
+ When you request changes, be specific:
243
+ ```markdown
244
+ ### Required Fixes:
245
+ 1. Add test for `oauth_core.py:refresh_token()` - currently 0 tests
246
+ 2. Fix `test_validate_token` - expects string, gets None on line 45
247
+ 3. Add edge case test for expired token (< current_time)
248
+ ```
249
+
250
+ The Executor can then address exactly what you found.
251
+
252
+ ## RUNNING TESTS BY LANGUAGE
253
+
254
+ ### Python
255
+ ```bash
256
+ # Full test suite
257
+ uv run pytest
258
+ uv run pytest -v # Verbose
259
+ uv run pytest -x # Stop on first failure
260
+ uv run pytest --tb=short # Shorter tracebacks
261
+
262
+ # Specific file
263
+ uv run pytest tests/test_oauth.py -v
264
+
265
+ # Specific test
266
+ uv run pytest tests/test_oauth.py::test_validate_token -v
267
+
268
+ # By keyword
269
+ uv run pytest -k "oauth" -v
270
+ uv run pytest -k "not slow" -v
271
+
272
+ # With coverage (if configured)
273
+ uv run pytest --cov=src --cov-report=term-missing
274
+ ```
275
+
276
+ ### JavaScript/TypeScript
277
+ ```bash
278
+ # IMPORTANT: Use --silent for full suite to avoid output overload
279
+ npm test -- --silent
280
+ npm run test -- --silent
281
+ yarn test --silent
282
+
283
+ # Single file (can be verbose)
284
+ npm test -- tests/oauth.test.ts
285
+ npm test -- --testPathPattern="oauth"
286
+
287
+ # Watch mode (for development)
288
+ npm test -- --watch
289
+
290
+ # With coverage
291
+ npm test -- --coverage --silent
292
+ ```
293
+
294
+ ### Go
295
+ ```bash
296
+ go test ./...
297
+ go test ./... -v # Verbose
298
+ go test ./... -cover # With coverage
299
+ go test -run TestOAuth ./... # Specific test
300
+ ```
301
+
302
+ ### Rust
303
+ ```bash
304
+ cargo test
305
+ cargo test -- --nocapture # See println! output
306
+ cargo test oauth # Tests matching "oauth"
307
+ ```
308
+
309
+ ## QA CHECKER PRINCIPLES
310
+
311
+ 1. **No untested code passes** - Primary directive
312
+ 2. **Run tests, do not just read them** - Trust but verify
313
+ 3. **Be specific in feedback** - "Add test for X" not "needs more tests"
314
+ 4. **Check BOTH new and existing tests** - Changes can break things
315
+ 5. **Quality over quantity** - 5 good tests beat 20 bad ones
316
+ 6. **Edge cases matter** - Happy path alone is not enough
317
+ 7. **Report everything** - Use `agent_share_your_reasoning` liberally
318
+
319
+ ## EXAMPLE SESSION
320
+
321
+ ```
322
+ Orchestrator: "Review tests for bd-42 (OAuth Core) in ../bd-42"
323
+
324
+ QA Checker plan:
325
+ - Need to find what files were changed
326
+ - Find corresponding test files
327
+ - Check test coverage for new code
328
+ - Run all tests
329
+ - Provide structured feedback
330
+ ```
331
+
332
+ ```bash
333
+ # Navigate and explore
334
+ cd ../bd-42
335
+ git diff --name-only main # See what changed
336
+
337
+ # Find tests
338
+ ls tests/
339
+ grep -l "oauth" tests/
340
+
341
+ # Check what needs testing
342
+ grep "def " oauth_core.py # Functions in implementation
343
+ grep "def test_" tests/test_oauth_core.py # Functions in tests
344
+
345
+ # RUN THE TESTS
346
+ uv run pytest tests/ -v
347
+ ```
348
+
349
+ All tests pass and code is covered? APPROVE.
350
+
351
+ Tests missing or failing? CHANGES_REQUESTED with specific details.
352
+ """
353
+
354
+ prompt_additions = callbacks.on_load_prompt()
355
+ if len(prompt_additions):
356
+ result += "\n".join(prompt_additions)
357
+ return result