steroids-cli 0.4.47
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.
- package/LICENSE +21 -0
- package/README.md +640 -0
- package/dist/cli/colors.d.ts +110 -0
- package/dist/cli/colors.d.ts.map +1 -0
- package/dist/cli/colors.js +228 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/env.d.ts +159 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +227 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/errors.d.ts +166 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +244 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/flags.d.ts +75 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +232 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/help.d.ts +97 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +275 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/interactive.d.ts +58 -0
- package/dist/cli/interactive.d.ts.map +1 -0
- package/dist/cli/interactive.js +127 -0
- package/dist/cli/interactive.js.map +1 -0
- package/dist/cli/output.d.ts +116 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +178 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/commands/about.d.ts +7 -0
- package/dist/commands/about.d.ts.map +1 -0
- package/dist/commands/about.js +259 -0
- package/dist/commands/about.js.map +1 -0
- package/dist/commands/ai.d.ts +6 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +382 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/backup.d.ts +3 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +528 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/completion.d.ts +3 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +405 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +665 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/disputes.d.ts +3 -0
- package/dist/commands/disputes.d.ts.map +1 -0
- package/dist/commands/disputes.js +499 -0
- package/dist/commands/disputes.js.map +1 -0
- package/dist/commands/gc.d.ts +3 -0
- package/dist/commands/gc.d.ts.map +1 -0
- package/dist/commands/gc.js +300 -0
- package/dist/commands/gc.js.map +1 -0
- package/dist/commands/git.d.ts +3 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +458 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +604 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/hooks.d.ts +6 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +529 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +200 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/llm.d.ts +7 -0
- package/dist/commands/llm.d.ts.map +1 -0
- package/dist/commands/llm.js +285 -0
- package/dist/commands/llm.js.map +1 -0
- package/dist/commands/locks.d.ts +3 -0
- package/dist/commands/locks.d.ts.map +1 -0
- package/dist/commands/locks.js +431 -0
- package/dist/commands/locks.js.map +1 -0
- package/dist/commands/logs.d.ts +3 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +487 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/loop-phases.d.ts +11 -0
- package/dist/commands/loop-phases.d.ts.map +1 -0
- package/dist/commands/loop-phases.js +204 -0
- package/dist/commands/loop-phases.js.map +1 -0
- package/dist/commands/loop.d.ts +3 -0
- package/dist/commands/loop.d.ts.map +1 -0
- package/dist/commands/loop.js +396 -0
- package/dist/commands/loop.js.map +1 -0
- package/dist/commands/projects.d.ts +6 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +362 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/purge.d.ts +3 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +516 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/runners.d.ts +3 -0
- package/dist/commands/runners.d.ts.map +1 -0
- package/dist/commands/runners.js +1076 -0
- package/dist/commands/runners.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +291 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/sections-commands.d.ts +9 -0
- package/dist/commands/sections-commands.d.ts.map +1 -0
- package/dist/commands/sections-commands.js +282 -0
- package/dist/commands/sections-commands.js.map +1 -0
- package/dist/commands/sections-graph.d.ts +25 -0
- package/dist/commands/sections-graph.d.ts.map +1 -0
- package/dist/commands/sections-graph.js +180 -0
- package/dist/commands/sections-graph.js.map +1 -0
- package/dist/commands/sections.d.ts +3 -0
- package/dist/commands/sections.d.ts.map +1 -0
- package/dist/commands/sections.js +376 -0
- package/dist/commands/sections.js.map +1 -0
- package/dist/commands/stats.d.ts +6 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +324 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/tasks.d.ts +3 -0
- package/dist/commands/tasks.d.ts.map +1 -0
- package/dist/commands/tasks.js +1115 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/web.d.ts +7 -0
- package/dist/commands/web.d.ts.map +1 -0
- package/dist/commands/web.js +204 -0
- package/dist/commands/web.js.map +1 -0
- package/dist/config/ai-setup.d.ts +27 -0
- package/dist/config/ai-setup.d.ts.map +1 -0
- package/dist/config/ai-setup.js +432 -0
- package/dist/config/ai-setup.js.map +1 -0
- package/dist/config/browser.d.ts +9 -0
- package/dist/config/browser.d.ts.map +1 -0
- package/dist/config/browser.js +200 -0
- package/dist/config/browser.js.map +1 -0
- package/dist/config/json-schema.d.ts +28 -0
- package/dist/config/json-schema.d.ts.map +1 -0
- package/dist/config/json-schema.js +84 -0
- package/dist/config/json-schema.js.map +1 -0
- package/dist/config/loader.d.ts +152 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +270 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +34 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +437 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +32 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +187 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/database/connection.d.ts +35 -0
- package/dist/database/connection.d.ts.map +1 -0
- package/dist/database/connection.js +208 -0
- package/dist/database/connection.js.map +1 -0
- package/dist/database/queries.d.ts +218 -0
- package/dist/database/queries.d.ts.map +1 -0
- package/dist/database/queries.js +613 -0
- package/dist/database/queries.js.map +1 -0
- package/dist/database/schema.d.ts +8 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +160 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/disputes/behavior.d.ts +106 -0
- package/dist/disputes/behavior.d.ts.map +1 -0
- package/dist/disputes/behavior.js +150 -0
- package/dist/disputes/behavior.js.map +1 -0
- package/dist/disputes/create.d.ts +59 -0
- package/dist/disputes/create.d.ts.map +1 -0
- package/dist/disputes/create.js +222 -0
- package/dist/disputes/create.js.map +1 -0
- package/dist/disputes/index.d.ts +21 -0
- package/dist/disputes/index.d.ts.map +1 -0
- package/dist/disputes/index.js +76 -0
- package/dist/disputes/index.js.map +1 -0
- package/dist/disputes/markdown.d.ts +41 -0
- package/dist/disputes/markdown.d.ts.map +1 -0
- package/dist/disputes/markdown.js +261 -0
- package/dist/disputes/markdown.js.map +1 -0
- package/dist/disputes/queries.d.ts +83 -0
- package/dist/disputes/queries.d.ts.map +1 -0
- package/dist/disputes/queries.js +180 -0
- package/dist/disputes/queries.js.map +1 -0
- package/dist/disputes/resolve.d.ts +57 -0
- package/dist/disputes/resolve.d.ts.map +1 -0
- package/dist/disputes/resolve.js +171 -0
- package/dist/disputes/resolve.js.map +1 -0
- package/dist/disputes/stale.d.ts +98 -0
- package/dist/disputes/stale.d.ts.map +1 -0
- package/dist/disputes/stale.js +205 -0
- package/dist/disputes/stale.js.map +1 -0
- package/dist/disputes/types.d.ts +92 -0
- package/dist/disputes/types.d.ts.map +1 -0
- package/dist/disputes/types.js +100 -0
- package/dist/disputes/types.js.map +1 -0
- package/dist/git/push.d.ts +26 -0
- package/dist/git/push.d.ts.map +1 -0
- package/dist/git/push.js +97 -0
- package/dist/git/push.js.map +1 -0
- package/dist/git/status.d.ts +61 -0
- package/dist/git/status.d.ts.map +1 -0
- package/dist/git/status.js +251 -0
- package/dist/git/status.js.map +1 -0
- package/dist/hooks/events.d.ts +72 -0
- package/dist/hooks/events.d.ts.map +1 -0
- package/dist/hooks/events.js +120 -0
- package/dist/hooks/events.js.map +1 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +48 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/integration.d.ts +69 -0
- package/dist/hooks/integration.d.ts.map +1 -0
- package/dist/hooks/integration.js +179 -0
- package/dist/hooks/integration.js.map +1 -0
- package/dist/hooks/merge.d.ts +115 -0
- package/dist/hooks/merge.d.ts.map +1 -0
- package/dist/hooks/merge.js +161 -0
- package/dist/hooks/merge.js.map +1 -0
- package/dist/hooks/orchestrator.d.ts +115 -0
- package/dist/hooks/orchestrator.d.ts.map +1 -0
- package/dist/hooks/orchestrator.js +226 -0
- package/dist/hooks/orchestrator.js.map +1 -0
- package/dist/hooks/payload.d.ts +294 -0
- package/dist/hooks/payload.d.ts.map +1 -0
- package/dist/hooks/payload.js +267 -0
- package/dist/hooks/payload.js.map +1 -0
- package/dist/hooks/script-runner.d.ts +63 -0
- package/dist/hooks/script-runner.d.ts.map +1 -0
- package/dist/hooks/script-runner.js +221 -0
- package/dist/hooks/script-runner.js.map +1 -0
- package/dist/hooks/templates.d.ts +104 -0
- package/dist/hooks/templates.d.ts.map +1 -0
- package/dist/hooks/templates.js +327 -0
- package/dist/hooks/templates.js.map +1 -0
- package/dist/hooks/webhook-runner.d.ts +69 -0
- package/dist/hooks/webhook-runner.d.ts.map +1 -0
- package/dist/hooks/webhook-runner.js +208 -0
- package/dist/hooks/webhook-runner.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +281 -0
- package/dist/index.js.map +1 -0
- package/dist/locking/cleanup.d.ts +70 -0
- package/dist/locking/cleanup.d.ts.map +1 -0
- package/dist/locking/cleanup.js +157 -0
- package/dist/locking/cleanup.js.map +1 -0
- package/dist/locking/queries.d.ts +116 -0
- package/dist/locking/queries.d.ts.map +1 -0
- package/dist/locking/queries.js +255 -0
- package/dist/locking/queries.js.map +1 -0
- package/dist/locking/section-lock.d.ts +74 -0
- package/dist/locking/section-lock.d.ts.map +1 -0
- package/dist/locking/section-lock.js +207 -0
- package/dist/locking/section-lock.js.map +1 -0
- package/dist/locking/task-lock.d.ts +92 -0
- package/dist/locking/task-lock.d.ts.map +1 -0
- package/dist/locking/task-lock.js +246 -0
- package/dist/locking/task-lock.js.map +1 -0
- package/dist/migrations/index.d.ts +7 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +37 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifest.d.ts +92 -0
- package/dist/migrations/manifest.d.ts.map +1 -0
- package/dist/migrations/manifest.js +270 -0
- package/dist/migrations/manifest.js.map +1 -0
- package/dist/migrations/runner.d.ts +84 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +351 -0
- package/dist/migrations/runner.js.map +1 -0
- package/dist/orchestrator/coder.d.ts +32 -0
- package/dist/orchestrator/coder.d.ts.map +1 -0
- package/dist/orchestrator/coder.js +174 -0
- package/dist/orchestrator/coder.js.map +1 -0
- package/dist/orchestrator/coordinator.d.ts +28 -0
- package/dist/orchestrator/coordinator.d.ts.map +1 -0
- package/dist/orchestrator/coordinator.js +256 -0
- package/dist/orchestrator/coordinator.js.map +1 -0
- package/dist/orchestrator/reviewer.d.ts +35 -0
- package/dist/orchestrator/reviewer.d.ts.map +1 -0
- package/dist/orchestrator/reviewer.js +241 -0
- package/dist/orchestrator/reviewer.js.map +1 -0
- package/dist/orchestrator/task-selector.d.ts +102 -0
- package/dist/orchestrator/task-selector.d.ts.map +1 -0
- package/dist/orchestrator/task-selector.js +341 -0
- package/dist/orchestrator/task-selector.js.map +1 -0
- package/dist/prompts/coder.d.ts +36 -0
- package/dist/prompts/coder.d.ts.map +1 -0
- package/dist/prompts/coder.js +315 -0
- package/dist/prompts/coder.js.map +1 -0
- package/dist/prompts/prompt-helpers.d.ts +51 -0
- package/dist/prompts/prompt-helpers.d.ts.map +1 -0
- package/dist/prompts/prompt-helpers.js +312 -0
- package/dist/prompts/prompt-helpers.js.map +1 -0
- package/dist/prompts/reviewer.d.ts +40 -0
- package/dist/prompts/reviewer.d.ts.map +1 -0
- package/dist/prompts/reviewer.js +438 -0
- package/dist/prompts/reviewer.js.map +1 -0
- package/dist/providers/api-models.d.ts +65 -0
- package/dist/providers/api-models.d.ts.map +1 -0
- package/dist/providers/api-models.js +323 -0
- package/dist/providers/api-models.js.map +1 -0
- package/dist/providers/claude.d.ts +53 -0
- package/dist/providers/claude.d.ts.map +1 -0
- package/dist/providers/claude.js +229 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex.d.ts +53 -0
- package/dist/providers/codex.d.ts.map +1 -0
- package/dist/providers/codex.js +214 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/gemini.d.ts +58 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +242 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/interface.d.ts +173 -0
- package/dist/providers/interface.d.ts.map +1 -0
- package/dist/providers/interface.js +96 -0
- package/dist/providers/interface.js.map +1 -0
- package/dist/providers/invocation-logger.d.ts +114 -0
- package/dist/providers/invocation-logger.d.ts.map +1 -0
- package/dist/providers/invocation-logger.js +298 -0
- package/dist/providers/invocation-logger.js.map +1 -0
- package/dist/providers/openai.d.ts +53 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +232 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/registry.d.ts +100 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +178 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/runners/activity-log.d.ts +65 -0
- package/dist/runners/activity-log.d.ts.map +1 -0
- package/dist/runners/activity-log.js +148 -0
- package/dist/runners/activity-log.js.map +1 -0
- package/dist/runners/cron.d.ts +26 -0
- package/dist/runners/cron.d.ts.map +1 -0
- package/dist/runners/cron.js +176 -0
- package/dist/runners/cron.js.map +1 -0
- package/dist/runners/daemon.d.ts +71 -0
- package/dist/runners/daemon.d.ts.map +1 -0
- package/dist/runners/daemon.js +245 -0
- package/dist/runners/daemon.js.map +1 -0
- package/dist/runners/global-db.d.ts +31 -0
- package/dist/runners/global-db.d.ts.map +1 -0
- package/dist/runners/global-db.js +230 -0
- package/dist/runners/global-db.js.map +1 -0
- package/dist/runners/hang-detector.d.ts +38 -0
- package/dist/runners/hang-detector.d.ts.map +1 -0
- package/dist/runners/hang-detector.js +136 -0
- package/dist/runners/hang-detector.js.map +1 -0
- package/dist/runners/heartbeat.d.ts +39 -0
- package/dist/runners/heartbeat.d.ts.map +1 -0
- package/dist/runners/heartbeat.js +79 -0
- package/dist/runners/heartbeat.js.map +1 -0
- package/dist/runners/lock.d.ts +47 -0
- package/dist/runners/lock.d.ts.map +1 -0
- package/dist/runners/lock.js +150 -0
- package/dist/runners/lock.js.map +1 -0
- package/dist/runners/orchestrator-loop.d.ts +20 -0
- package/dist/runners/orchestrator-loop.d.ts.map +1 -0
- package/dist/runners/orchestrator-loop.js +285 -0
- package/dist/runners/orchestrator-loop.js.map +1 -0
- package/dist/runners/projects.d.ts +96 -0
- package/dist/runners/projects.d.ts.map +1 -0
- package/dist/runners/projects.js +255 -0
- package/dist/runners/projects.js.map +1 -0
- package/dist/runners/wakeup.d.ts +34 -0
- package/dist/runners/wakeup.d.ts.map +1 -0
- package/dist/runners/wakeup.js +291 -0
- package/dist/runners/wakeup.js.map +1 -0
- package/migrations/001_initial_schema.sql +106 -0
- package/migrations/002_add_commit_sha.sql +12 -0
- package/migrations/003_add_section_priority.sql +13 -0
- package/migrations/004_add_section_dependencies.sql +18 -0
- package/migrations/005_add_audit_actor_model.sql +10 -0
- package/migrations/006_add_task_invocations.sql +33 -0
- package/migrations/007_add_file_anchor.sql +14 -0
- package/migrations/manifest.json +62 -0
- package/package.json +49 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Coder prompt templates
|
|
4
|
+
* Following the exact templates from PROMPTS.md
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.generateCoderPrompt = generateCoderPrompt;
|
|
8
|
+
exports.generateBatchCoderPrompt = generateBatchCoderPrompt;
|
|
9
|
+
exports.generateResumingCoderPrompt = generateResumingCoderPrompt;
|
|
10
|
+
const prompt_helpers_js_1 = require("./prompt-helpers.js");
|
|
11
|
+
/**
|
|
12
|
+
* Generate the coder prompt for a new task
|
|
13
|
+
*/
|
|
14
|
+
function generateCoderPrompt(context) {
|
|
15
|
+
const { task, projectPath, previousStatus, rejectionNotes, rejectionHistory, coordinatorGuidance } = context;
|
|
16
|
+
const agentsMd = (0, prompt_helpers_js_1.getAgentsMd)(projectPath);
|
|
17
|
+
const sourceContent = (0, prompt_helpers_js_1.getSourceFileContent)(projectPath, task.source_file);
|
|
18
|
+
// Build rejection section with full history and coordinator guidance
|
|
19
|
+
const rejectionSection = (0, prompt_helpers_js_1.formatRejectionHistoryForCoder)(task.id, rejectionHistory, rejectionNotes, coordinatorGuidance);
|
|
20
|
+
// Build file scope section
|
|
21
|
+
const fileScopeSection = (0, prompt_helpers_js_1.buildFileScopeSection)(task, sourceContent);
|
|
22
|
+
const fileAnchorSection = (0, prompt_helpers_js_1.buildFileAnchorSection)(task);
|
|
23
|
+
return `# TASK: ${task.id.substring(0, 8)} - ${task.title}
|
|
24
|
+
# Status: ${previousStatus} → in_progress | Rejections: ${task.rejection_count}/15
|
|
25
|
+
|
|
26
|
+
You are a CODER in an automated task execution system. Your job is to implement the task below according to the specification.
|
|
27
|
+
|
|
28
|
+
**Follow the project's existing architecture and patterns.** Read AGENTS.md and existing code to understand how things are structured before making changes.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Task Information
|
|
33
|
+
|
|
34
|
+
**Task ID:** ${task.id}
|
|
35
|
+
**Title:** ${task.title}
|
|
36
|
+
**Rejection Count:** ${task.rejection_count}/15
|
|
37
|
+
**Project:** ${projectPath}
|
|
38
|
+
${fileScopeSection}${fileAnchorSection}
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Specification
|
|
42
|
+
|
|
43
|
+
The full specification is in: ${task.source_file ?? '(not specified)'}
|
|
44
|
+
|
|
45
|
+
${sourceContent}
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Project Guidelines
|
|
50
|
+
|
|
51
|
+
${agentsMd}
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Existing Code Context
|
|
56
|
+
|
|
57
|
+
Review relevant project files as needed for your implementation.
|
|
58
|
+
${rejectionSection}
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## FIRST: Check If Work Is Already Done
|
|
62
|
+
|
|
63
|
+
**Before implementing anything, check if the work already exists:**
|
|
64
|
+
|
|
65
|
+
1. Search for files/code that match the specification requirements
|
|
66
|
+
2. Run \`git log --oneline -20\` to see recent commits
|
|
67
|
+
3. If the implementation already exists:
|
|
68
|
+
- Identify which commit contains the work (you NEED the hash)
|
|
69
|
+
- Verify it matches the specification with \`git show <hash>\`
|
|
70
|
+
- **Do NOT create duplicate code**
|
|
71
|
+
- Submit for review with a note including the commit hash AND file list
|
|
72
|
+
|
|
73
|
+
\`\`\`bash
|
|
74
|
+
# Example: If work exists in commit abc1234
|
|
75
|
+
git log --oneline -20 # Find commits
|
|
76
|
+
git show abc1234 --stat # Verify it matches spec, note the files
|
|
77
|
+
|
|
78
|
+
# IMPORTANT: Include commit hash and files in your notes
|
|
79
|
+
steroids tasks update ${task.id} --status review --notes "Work exists in commit abc1234. Files: src/foo.ts, src/bar.ts. Verified against spec."
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
The reviewer will check the commit you reference. Be precise about the hash and files.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Your Instructions (If Work Is NOT Already Done)
|
|
87
|
+
|
|
88
|
+
1. Read the specification carefully
|
|
89
|
+
2. Implement the feature/fix as specified
|
|
90
|
+
3. Write tests if the project has a test directory
|
|
91
|
+
4. Keep files under 500 lines
|
|
92
|
+
5. Follow the coding standards in AGENTS.md
|
|
93
|
+
|
|
94
|
+
### Security Notes
|
|
95
|
+
|
|
96
|
+
- When executing shell commands with user-controlled arguments, use array-based APIs (e.g., \`execFileSync(cmd, [args])\`). Add a comment like \`// hardcoded command, no user input\` when using \`execSync\` intentionally for fixed commands or shell features.
|
|
97
|
+
- If you make a security-relevant decision (e.g., choosing \`execSync\` over \`execFileSync\` because you need pipes), explain your reasoning in your submission notes with \`--notes\`.
|
|
98
|
+
- If you notice a pre-existing security concern or something a human should review, create a feedback task:
|
|
99
|
+
\`\`\`bash
|
|
100
|
+
steroids tasks add "Description of the concern" --feedback
|
|
101
|
+
\`\`\`
|
|
102
|
+
This goes to a skipped section for human review and will NOT block the pipeline.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Attempt Before Skip (IMPORTANT)
|
|
107
|
+
|
|
108
|
+
**You MUST attempt any task that can be run locally, even if it might fail.**
|
|
109
|
+
|
|
110
|
+
Many tasks look like they need external setup, but they're actually runnable commands. Your job is to TRY them first.
|
|
111
|
+
|
|
112
|
+
**The rule is simple:** If you can type a command and hit Enter, ATTEMPT IT.
|
|
113
|
+
|
|
114
|
+
Even if it fails, that failure is valuable information. The reviewer wants to see that you tried.
|
|
115
|
+
|
|
116
|
+
**Only skip when the task TRULY requires external action you cannot perform** (e.g., cloud console access, DNS configuration, account creation).
|
|
117
|
+
|
|
118
|
+
**BEFORE skipping, check the spec section for:**
|
|
119
|
+
- \`> SKIP\` markers, "manual setup", "handled manually", "external setup"
|
|
120
|
+
- Cloud infrastructure tasks with NO automation scripts provided
|
|
121
|
+
|
|
122
|
+
**If you must skip:**
|
|
123
|
+
\`\`\`bash
|
|
124
|
+
steroids tasks skip ${task.id} --notes "SKIP REASON: <why>. WHAT'S NEEDED: <human action>. BLOCKING: <dependent tasks>."
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## CRITICAL RULES
|
|
130
|
+
|
|
131
|
+
1. **NEVER touch .steroids/ directory** (no .db, .yaml, .yml files)
|
|
132
|
+
2. **BUILD MUST PASS before submitting** (run build and tests, fix errors)
|
|
133
|
+
3. **Use CLI for status updates:** \`steroids tasks update ${task.id} --status review\`
|
|
134
|
+
4. **Commit your work** with a meaningful message before submitting
|
|
135
|
+
5. **Never modify TODO.md directly** - the CLI manages task status
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## When You Are Done
|
|
140
|
+
|
|
141
|
+
**Verify the project builds AND tests pass, then:**
|
|
142
|
+
|
|
143
|
+
\`\`\`bash
|
|
144
|
+
git add <your-changed-files>
|
|
145
|
+
git commit -m "<type>: <descriptive message>"
|
|
146
|
+
steroids tasks update ${task.id} --status review
|
|
147
|
+
\`\`\`
|
|
148
|
+
|
|
149
|
+
If you do NOT run \`steroids tasks update\`, your work will not be submitted.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
${task.rejection_count > 0 ? `
|
|
153
|
+
## THIS TASK HAS BEEN REJECTED ${task.rejection_count} TIME(S)
|
|
154
|
+
|
|
155
|
+
**You MUST address the reviewer's feedback before submitting again.**
|
|
156
|
+
Extract every test case from the rejection notes, run each one, fix issues at the source, then test again.
|
|
157
|
+
|
|
158
|
+
` : ''}---
|
|
159
|
+
|
|
160
|
+
## Start Now
|
|
161
|
+
|
|
162
|
+
Begin by reading ${task.source_file ?? 'the specification above'} and implementing the task.
|
|
163
|
+
`;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Generate the coder prompt for a batch of tasks
|
|
167
|
+
*/
|
|
168
|
+
function generateBatchCoderPrompt(context) {
|
|
169
|
+
const { tasks, projectPath, sectionName } = context;
|
|
170
|
+
const agentsMd = (0, prompt_helpers_js_1.getAgentsMd)(projectPath);
|
|
171
|
+
// Build task specs for each task
|
|
172
|
+
const taskSpecs = tasks.map((task, index) => {
|
|
173
|
+
const sourceContent = (0, prompt_helpers_js_1.getSourceFileContent)(projectPath, task.source_file);
|
|
174
|
+
return `
|
|
175
|
+
### Task ${index + 1}: ${task.title}
|
|
176
|
+
**Task ID:** ${task.id}
|
|
177
|
+
**Spec File:** ${task.source_file ?? '(not specified)'}
|
|
178
|
+
|
|
179
|
+
${sourceContent}
|
|
180
|
+
`;
|
|
181
|
+
}).join('\n---\n');
|
|
182
|
+
const taskIds = tasks.map(t => t.id);
|
|
183
|
+
return `# STEROIDS BATCH CODER TASK
|
|
184
|
+
|
|
185
|
+
You are a CODER assigned MULTIPLE tasks from section "${sectionName}".
|
|
186
|
+
|
|
187
|
+
**IMPORTANT:** Implement each task IN ORDER, committing after each one.
|
|
188
|
+
|
|
189
|
+
## Section: ${sectionName}
|
|
190
|
+
**Total Tasks:** ${tasks.length}
|
|
191
|
+
**Project:** ${projectPath}
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Project Guidelines
|
|
196
|
+
|
|
197
|
+
${agentsMd}
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## TASKS TO IMPLEMENT
|
|
202
|
+
|
|
203
|
+
${taskSpecs}
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## YOUR WORKFLOW
|
|
208
|
+
|
|
209
|
+
For EACH task:
|
|
210
|
+
1. Read the specification
|
|
211
|
+
2. Implement the feature/fix
|
|
212
|
+
3. Run tests if applicable
|
|
213
|
+
4. Commit: \`git add <files> && git commit -m "<type>: <message>"\`
|
|
214
|
+
5. Update status: \`steroids tasks update <task-id> --status review\`
|
|
215
|
+
6. Move to next task
|
|
216
|
+
|
|
217
|
+
**CRITICAL:** Each task MUST have its own commit and status update.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## CRITICAL RULES
|
|
222
|
+
|
|
223
|
+
1. **NEVER touch .steroids/ directory**
|
|
224
|
+
2. **BUILD MUST PASS after each task**
|
|
225
|
+
3. **Commit after EACH task** with a descriptive message
|
|
226
|
+
4. **Update status after EACH commit**
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## TASK IDS
|
|
231
|
+
|
|
232
|
+
${taskIds.map((id, i) => `- Task ${i + 1}: ${id}`).join('\n')}
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Start Now
|
|
237
|
+
|
|
238
|
+
Begin with Task 1 and work through each task in order.
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Generate the coder prompt for resuming partial work
|
|
243
|
+
*/
|
|
244
|
+
function generateResumingCoderPrompt(context) {
|
|
245
|
+
const { task, projectPath, gitStatus, gitDiff, rejectionHistory, coordinatorGuidance } = context;
|
|
246
|
+
const sourceContent = (0, prompt_helpers_js_1.getSourceFileContent)(projectPath, task.source_file);
|
|
247
|
+
const fileAnchorSection = (0, prompt_helpers_js_1.buildFileAnchorSection)(task);
|
|
248
|
+
// Build rejection section with full history and coordinator guidance (same as normal prompt)
|
|
249
|
+
const rejectionSection = (0, prompt_helpers_js_1.formatRejectionHistoryForCoder)(task.id, rejectionHistory, undefined, coordinatorGuidance);
|
|
250
|
+
return `# TASK: ${task.id.substring(0, 8)} - ${task.title} (RESUMING)
|
|
251
|
+
# Status: resuming | Rejections: ${task.rejection_count}/15
|
|
252
|
+
|
|
253
|
+
You are a CODER resuming work on a partially completed task.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Task Information
|
|
258
|
+
|
|
259
|
+
**Task ID:** ${task.id}
|
|
260
|
+
**Title:** ${task.title}
|
|
261
|
+
**Status:** in_progress (resuming)
|
|
262
|
+
**Rejection Count:** ${task.rejection_count}/15
|
|
263
|
+
**Project:** ${projectPath}
|
|
264
|
+
${fileAnchorSection}
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Previous Work Detected
|
|
268
|
+
|
|
269
|
+
A previous coder started this task but did not complete it. You may find:
|
|
270
|
+
- Uncommitted changes in the working directory
|
|
271
|
+
- Partial implementations in progress
|
|
272
|
+
|
|
273
|
+
**Git Status:**
|
|
274
|
+
\`\`\`
|
|
275
|
+
${gitStatus ?? 'No uncommitted changes'}
|
|
276
|
+
\`\`\`
|
|
277
|
+
|
|
278
|
+
**Uncommitted Changes:**
|
|
279
|
+
\`\`\`diff
|
|
280
|
+
${gitDiff ?? 'No changes'}
|
|
281
|
+
\`\`\`
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Your Instructions
|
|
286
|
+
|
|
287
|
+
1. Review what the previous coder did
|
|
288
|
+
2. If the work looks good, complete it
|
|
289
|
+
3. If the work looks wrong, you may start fresh
|
|
290
|
+
4. Commit all changes when done
|
|
291
|
+
${rejectionSection}
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Specification
|
|
295
|
+
|
|
296
|
+
${sourceContent}
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## CRITICAL RULES
|
|
301
|
+
|
|
302
|
+
1. **NEVER touch .steroids/ directory**
|
|
303
|
+
2. **Commit your work before submitting**
|
|
304
|
+
3. **Run \`steroids tasks update ${task.id} --status review\` when done**
|
|
305
|
+
|
|
306
|
+
If you do NOT update the task status, you will be restarted.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Complete the Task Now
|
|
311
|
+
|
|
312
|
+
Review the existing work and finish the implementation.
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=coder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coder.js","sourceRoot":"","sources":["../../src/prompts/coder.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared prompt helper functions
|
|
3
|
+
* Used by coder, reviewer, and coordinator prompts
|
|
4
|
+
*/
|
|
5
|
+
import type { Task, RejectionEntry } from '../database/queries.js';
|
|
6
|
+
/**
|
|
7
|
+
* Read AGENTS.md content if present
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAgentsMd(projectPath: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Read source file content if specified
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSourceFileContent(projectPath: string, sourceFile?: string | null): string;
|
|
14
|
+
/**
|
|
15
|
+
* Extract first line of rejection notes as a title/summary
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractRejectionTitle(notes: string | null | undefined): string;
|
|
18
|
+
/**
|
|
19
|
+
* Detect repeated patterns in rejection history
|
|
20
|
+
* Uses normalized fuzzy matching to catch similar (not just identical) issues
|
|
21
|
+
*/
|
|
22
|
+
export declare function detectRejectionPatterns(rejectionHistory: RejectionEntry[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* Extract file paths mentioned in text (task title, spec content)
|
|
25
|
+
* Language-agnostic: matches any path-like pattern with directory separators and file extensions
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractFileHints(title: string, specContent: string): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Build a file scope section for the prompt
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildFileScopeSection(task: Task, specContent: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format rejection history for coder prompt
|
|
34
|
+
* Shows ALL rejection titles for pattern visibility, full details of last 3
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatRejectionHistoryForCoder(taskId: string, rejectionHistory?: RejectionEntry[], latestNotes?: string, coordinatorGuidance?: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Build a file anchor section for the prompt
|
|
39
|
+
* Directs the coder/reviewer to a specific file and line
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildFileAnchorSection(task: Task): string;
|
|
42
|
+
export interface SectionTask {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
status: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Format other tasks in the same section for context
|
|
49
|
+
*/
|
|
50
|
+
export declare function formatSectionTasks(currentTaskId: string, sectionTasks?: SectionTask[]): string;
|
|
51
|
+
//# sourceMappingURL=prompt-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-helpers.d.ts","sourceRoot":"","sources":["../../src/prompts/prompt-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAWvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAK9E;AAUD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,gBAAgB,EAAE,cAAc,EAAE,GAAG,MAAM,CA6DlF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAgB7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAe7E;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,cAAc,EAAE,EACnC,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,MAAM,CAqFR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAkBzD;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAID;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,WAAW,EAAE,GAAG,MAAM,CAwC9F"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared prompt helper functions
|
|
4
|
+
* Used by coder, reviewer, and coordinator prompts
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getAgentsMd = getAgentsMd;
|
|
8
|
+
exports.getSourceFileContent = getSourceFileContent;
|
|
9
|
+
exports.extractRejectionTitle = extractRejectionTitle;
|
|
10
|
+
exports.detectRejectionPatterns = detectRejectionPatterns;
|
|
11
|
+
exports.extractFileHints = extractFileHints;
|
|
12
|
+
exports.buildFileScopeSection = buildFileScopeSection;
|
|
13
|
+
exports.formatRejectionHistoryForCoder = formatRejectionHistoryForCoder;
|
|
14
|
+
exports.buildFileAnchorSection = buildFileAnchorSection;
|
|
15
|
+
exports.formatSectionTasks = formatSectionTasks;
|
|
16
|
+
const node_fs_1 = require("node:fs");
|
|
17
|
+
const node_path_1 = require("node:path");
|
|
18
|
+
/**
|
|
19
|
+
* Read AGENTS.md content if present
|
|
20
|
+
*/
|
|
21
|
+
function getAgentsMd(projectPath) {
|
|
22
|
+
const agentsPath = (0, node_path_1.join)(projectPath, 'AGENTS.md');
|
|
23
|
+
if ((0, node_fs_1.existsSync)(agentsPath)) {
|
|
24
|
+
const content = (0, node_fs_1.readFileSync)(agentsPath, 'utf-8');
|
|
25
|
+
// Truncate if too long (max 5000 chars per spec)
|
|
26
|
+
if (content.length > 5000) {
|
|
27
|
+
return content.substring(0, 5000) + '\n\n[Content truncated]';
|
|
28
|
+
}
|
|
29
|
+
return content;
|
|
30
|
+
}
|
|
31
|
+
return 'No AGENTS.md found. Follow standard coding practices.';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read source file content if specified
|
|
35
|
+
*/
|
|
36
|
+
function getSourceFileContent(projectPath, sourceFile) {
|
|
37
|
+
if (!sourceFile) {
|
|
38
|
+
return 'No specification file linked.';
|
|
39
|
+
}
|
|
40
|
+
const fullPath = (0, node_path_1.join)(projectPath, sourceFile);
|
|
41
|
+
if (!(0, node_fs_1.existsSync)(fullPath)) {
|
|
42
|
+
return `Specification file not found: ${sourceFile}`;
|
|
43
|
+
}
|
|
44
|
+
const content = (0, node_fs_1.readFileSync)(fullPath, 'utf-8');
|
|
45
|
+
// Truncate if too long (max 10000 chars per spec)
|
|
46
|
+
if (content.length > 10000) {
|
|
47
|
+
return content.substring(0, 10000) + `\n\n[Content truncated. Full file at: ${sourceFile}]`;
|
|
48
|
+
}
|
|
49
|
+
return content;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Extract first line of rejection notes as a title/summary
|
|
53
|
+
*/
|
|
54
|
+
function extractRejectionTitle(notes) {
|
|
55
|
+
if (!notes)
|
|
56
|
+
return '(no notes)';
|
|
57
|
+
const firstLine = notes.split('\n').find(l => l.trim().length > 0) || '(no notes)';
|
|
58
|
+
// Strip markdown formatting for summary
|
|
59
|
+
return firstLine.replace(/^[-*#\s[\]]+/, '').trim().substring(0, 100);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Normalize text for fuzzy comparison
|
|
63
|
+
* Strips punctuation, lowercases, collapses whitespace
|
|
64
|
+
*/
|
|
65
|
+
function normalizeForComparison(text) {
|
|
66
|
+
return text.toLowerCase().replace(/[^a-z0-9\s]/g, '').replace(/\s+/g, ' ').trim();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Detect repeated patterns in rejection history
|
|
70
|
+
* Uses normalized fuzzy matching to catch similar (not just identical) issues
|
|
71
|
+
*/
|
|
72
|
+
function detectRejectionPatterns(rejectionHistory) {
|
|
73
|
+
if (rejectionHistory.length < 3)
|
|
74
|
+
return '';
|
|
75
|
+
// Extract titles and normalize for comparison
|
|
76
|
+
const entries = rejectionHistory.map(r => ({
|
|
77
|
+
title: extractRejectionTitle(r.notes),
|
|
78
|
+
normalized: normalizeForComparison(extractRejectionTitle(r.notes)),
|
|
79
|
+
}));
|
|
80
|
+
// Group by normalized title (catches minor wording variations)
|
|
81
|
+
const groups = new Map();
|
|
82
|
+
for (const entry of entries) {
|
|
83
|
+
const existing = groups.get(entry.normalized);
|
|
84
|
+
if (existing) {
|
|
85
|
+
existing.count++;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
groups.set(entry.normalized, { title: entry.title, count: 1 });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Also check for keyword-level overlap between non-identical entries
|
|
92
|
+
// If 3+ rejections share significant keywords, flag it
|
|
93
|
+
const allNotes = rejectionHistory.map(r => r.notes || '');
|
|
94
|
+
const keywordCounts = new Map();
|
|
95
|
+
for (const note of allNotes) {
|
|
96
|
+
// Extract significant words (4+ chars, not common words)
|
|
97
|
+
const words = new Set(normalizeForComparison(note)
|
|
98
|
+
.split(' ')
|
|
99
|
+
.filter(w => w.length >= 4));
|
|
100
|
+
for (const word of words) {
|
|
101
|
+
keywordCounts.set(word, (keywordCounts.get(word) || 0) + 1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const hotKeywords = [...keywordCounts.entries()]
|
|
105
|
+
.filter(([, count]) => count >= 3)
|
|
106
|
+
.filter(([word]) => !['task', 'file', 'code', 'this', 'that', 'should', 'must', 'need'].includes(word))
|
|
107
|
+
.map(([word]) => word);
|
|
108
|
+
const repeated = [...groups.values()].filter(g => g.count >= 3);
|
|
109
|
+
if (repeated.length === 0 && hotKeywords.length === 0)
|
|
110
|
+
return '';
|
|
111
|
+
const lines = [];
|
|
112
|
+
for (const { title, count } of repeated) {
|
|
113
|
+
lines.push(`- "${title}" - raised ${count} times`);
|
|
114
|
+
}
|
|
115
|
+
if (hotKeywords.length > 0 && repeated.length === 0) {
|
|
116
|
+
lines.push(`- Recurring themes: ${hotKeywords.slice(0, 5).join(', ')}`);
|
|
117
|
+
}
|
|
118
|
+
return `
|
|
119
|
+
**PATTERN DETECTED - The following issues keep repeating:**
|
|
120
|
+
|
|
121
|
+
${lines.join('\n')}
|
|
122
|
+
|
|
123
|
+
If you cannot resolve these, DISPUTE the task instead of resubmitting the same work:
|
|
124
|
+
\`\`\`bash
|
|
125
|
+
steroids dispute create <task-id> --reason "Cannot resolve: <explain why>" --type coder
|
|
126
|
+
\`\`\`
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Extract file paths mentioned in text (task title, spec content)
|
|
131
|
+
* Language-agnostic: matches any path-like pattern with directory separators and file extensions
|
|
132
|
+
*/
|
|
133
|
+
function extractFileHints(title, specContent) {
|
|
134
|
+
const combined = `${title}\n${specContent}`;
|
|
135
|
+
// Match any path with at least one directory separator and a file extension (1-10 chars)
|
|
136
|
+
// Examples: src/foo.ts, lib/utils/helpers.py, app/models/user.rb, pkg/api/handler.go
|
|
137
|
+
const filePattern = /(?:^|\s|`|"|'|\()([\w][\w.-]*(?:\/[\w.-]+)+\.\w{1,10})/gm;
|
|
138
|
+
const matches = new Set();
|
|
139
|
+
let match;
|
|
140
|
+
while ((match = filePattern.exec(combined)) !== null) {
|
|
141
|
+
const path = match[1];
|
|
142
|
+
// Filter out URLs, version numbers, and common false positives
|
|
143
|
+
if (path.includes('://') || /^\d+\.\d+\.\d+/.test(path) || path.includes('node_modules/')) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
matches.add(path);
|
|
147
|
+
}
|
|
148
|
+
return [...matches];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Build a file scope section for the prompt
|
|
152
|
+
*/
|
|
153
|
+
function buildFileScopeSection(task, specContent) {
|
|
154
|
+
const fileHints = extractFileHints(task.title, specContent);
|
|
155
|
+
if (fileHints.length === 0)
|
|
156
|
+
return '';
|
|
157
|
+
return `
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## FILE SCOPE
|
|
161
|
+
|
|
162
|
+
Based on the task specification, these files are likely relevant:
|
|
163
|
+
${fileHints.map(f => `- \`${f}\``).join('\n')}
|
|
164
|
+
|
|
165
|
+
**Focus your changes on these files.** If you find yourself modifying unrelated files, STOP and re-read the specification.
|
|
166
|
+
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Format rejection history for coder prompt
|
|
171
|
+
* Shows ALL rejection titles for pattern visibility, full details of last 3
|
|
172
|
+
*/
|
|
173
|
+
function formatRejectionHistoryForCoder(taskId, rejectionHistory, latestNotes, coordinatorGuidance) {
|
|
174
|
+
if (!rejectionHistory || rejectionHistory.length === 0) {
|
|
175
|
+
return '';
|
|
176
|
+
}
|
|
177
|
+
const latest = rejectionHistory[rejectionHistory.length - 1];
|
|
178
|
+
const latestCommitRef = latest.commit_sha ? ` (commit: ${latest.commit_sha.substring(0, 7)})` : '';
|
|
179
|
+
// Show ALL rejection titles for pattern visibility
|
|
180
|
+
const rejectionTitlesList = rejectionHistory.map(r => `${r.rejection_number}. ${extractRejectionTitle(r.notes)}`).join('\n');
|
|
181
|
+
// Show full details of last 3 rejections
|
|
182
|
+
const detailedRejections = rejectionHistory.length > 3
|
|
183
|
+
? rejectionHistory.slice(-3)
|
|
184
|
+
: rejectionHistory;
|
|
185
|
+
const detailedLines = detailedRejections.map(r => {
|
|
186
|
+
const commitRef = r.commit_sha ? ` (commit: ${r.commit_sha.substring(0, 7)})` : '';
|
|
187
|
+
return `### Rejection #${r.rejection_number}${commitRef}
|
|
188
|
+
${r.notes || '(no detailed notes)'}
|
|
189
|
+
`;
|
|
190
|
+
});
|
|
191
|
+
// Detect patterns
|
|
192
|
+
const patternWarning = detectRejectionPatterns(rejectionHistory);
|
|
193
|
+
// Coordinator guidance section (injected after 2nd rejection)
|
|
194
|
+
const coordinatorSection = coordinatorGuidance ? `
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## COORDINATOR GUIDANCE
|
|
198
|
+
|
|
199
|
+
A coordinator has reviewed the rejection history and provides this guidance:
|
|
200
|
+
|
|
201
|
+
${coordinatorGuidance}
|
|
202
|
+
|
|
203
|
+
**Follow the coordinator's guidance above. It takes priority over conflicting reviewer feedback.**
|
|
204
|
+
|
|
205
|
+
` : '';
|
|
206
|
+
return `
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## REJECTION HISTORY (${rejectionHistory.length} total, max 15)
|
|
210
|
+
|
|
211
|
+
${rejectionTitlesList}
|
|
212
|
+
|
|
213
|
+
${patternWarning}
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## LATEST REJECTION${latestCommitRef}
|
|
217
|
+
|
|
218
|
+
**ADDRESS EACH CHECKBOX BELOW:**
|
|
219
|
+
|
|
220
|
+
${latest.notes || '(no notes)'}
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
${detailedLines.length > 1 ? `## Previous Rejections (for context)\n\n${detailedLines.slice(0, -1).join('\n---\n')}` : ''}
|
|
224
|
+
${coordinatorSection}---
|
|
225
|
+
|
|
226
|
+
## BEFORE SUBMITTING
|
|
227
|
+
|
|
228
|
+
1. For each \`- [ ]\` item in the rejection:
|
|
229
|
+
- Open the file mentioned
|
|
230
|
+
- Make the exact change requested
|
|
231
|
+
- Verify the fix works
|
|
232
|
+
|
|
233
|
+
2. Run the build and tests:
|
|
234
|
+
- The project must build successfully
|
|
235
|
+
- Tests must pass (if the project has tests)
|
|
236
|
+
|
|
237
|
+
3. Only THEN submit for review:
|
|
238
|
+
\`\`\`bash
|
|
239
|
+
steroids tasks update ${taskId} --status review
|
|
240
|
+
\`\`\`
|
|
241
|
+
|
|
242
|
+
**DO NOT submit until you have addressed EVERY checkbox in the rejection notes.**
|
|
243
|
+
|
|
244
|
+
If you believe the reviewer is wrong or the requirement is impossible, dispute:
|
|
245
|
+
\`\`\`bash
|
|
246
|
+
steroids dispute create ${taskId} --reason "explanation" --type coder
|
|
247
|
+
\`\`\`
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Build a file anchor section for the prompt
|
|
252
|
+
* Directs the coder/reviewer to a specific file and line
|
|
253
|
+
*/
|
|
254
|
+
function buildFileAnchorSection(task) {
|
|
255
|
+
if (!task.file_path)
|
|
256
|
+
return '';
|
|
257
|
+
const lineRef = task.file_line ? `:${task.file_line}` : '';
|
|
258
|
+
const commitShort = task.file_commit_sha?.substring(0, 7) ?? 'unknown';
|
|
259
|
+
return `
|
|
260
|
+
## FILE ANCHOR
|
|
261
|
+
|
|
262
|
+
**This task is anchored to a specific location in the codebase:**
|
|
263
|
+
|
|
264
|
+
- **File:** \`${task.file_path}${lineRef}\`
|
|
265
|
+
${task.file_line ? `- **Line:** ${task.file_line}\n` : ''}- **Commit:** \`${commitShort}\`
|
|
266
|
+
|
|
267
|
+
Start your investigation at this file${task.file_line ? ' and line' : ''}. Use \`git show ${commitShort}:${task.file_path}\` to see the version when this task was created.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
`;
|
|
271
|
+
}
|
|
272
|
+
const MAX_SECTION_TASKS = 15;
|
|
273
|
+
/**
|
|
274
|
+
* Format other tasks in the same section for context
|
|
275
|
+
*/
|
|
276
|
+
function formatSectionTasks(currentTaskId, sectionTasks) {
|
|
277
|
+
if (!sectionTasks || sectionTasks.length <= 1) {
|
|
278
|
+
return '';
|
|
279
|
+
}
|
|
280
|
+
const statusEmoji = {
|
|
281
|
+
'pending': '\u23F3',
|
|
282
|
+
'in_progress': '\uD83D\uDD04',
|
|
283
|
+
'review': '\uD83D\uDC40',
|
|
284
|
+
'completed': '\u2705',
|
|
285
|
+
};
|
|
286
|
+
const otherTasks = sectionTasks.filter(t => t.id !== currentTaskId);
|
|
287
|
+
const tasksToShow = otherTasks.slice(0, MAX_SECTION_TASKS);
|
|
288
|
+
const remainingCount = otherTasks.length - tasksToShow.length;
|
|
289
|
+
const lines = tasksToShow.map(t => {
|
|
290
|
+
const emoji = statusEmoji[t.status] || '\u2753';
|
|
291
|
+
const marker = t.status === 'completed' ? ' (done)' : t.status === 'pending' ? ' (pending)' : '';
|
|
292
|
+
return `- ${emoji} ${t.title}${marker}`;
|
|
293
|
+
});
|
|
294
|
+
if (remainingCount > 0) {
|
|
295
|
+
lines.push(`- ... and ${remainingCount} more task${remainingCount > 1 ? 's' : ''}`);
|
|
296
|
+
}
|
|
297
|
+
if (lines.length === 0)
|
|
298
|
+
return '';
|
|
299
|
+
return `
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Other Tasks in This Section
|
|
303
|
+
|
|
304
|
+
**IMPORTANT:** The task you are reviewing is ONE of several tasks implementing this feature.
|
|
305
|
+
Do NOT reject this task for issues that are explicitly listed as separate tasks below.
|
|
306
|
+
Focus ONLY on whether THIS task's scope is correctly implemented.
|
|
307
|
+
|
|
308
|
+
${lines.join('\n')}
|
|
309
|
+
|
|
310
|
+
`;
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=prompt-helpers.js.map
|