Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
82 lines
2.8 KiB
TypeScript
82 lines
2.8 KiB
TypeScript
/**
|
|
* Execute mode prompt — standard worker agent.
|
|
*/
|
|
|
|
import {
|
|
CONTEXT_MANAGEMENT,
|
|
DEVIATION_RULES,
|
|
GIT_WORKFLOW,
|
|
INPUT_FILES,
|
|
PROGRESS_TRACKING,
|
|
SESSION_STARTUP,
|
|
SIGNAL_FORMAT,
|
|
TEST_INTEGRITY,
|
|
} from './shared.js';
|
|
|
|
export function buildExecutePrompt(taskDescription?: string): string {
|
|
const taskSection = taskDescription
|
|
? `
|
|
<task>
|
|
${taskDescription}
|
|
|
|
Read \`.cw/input/task.md\` for the full structured task with metadata, priority, and dependencies.
|
|
</task>`
|
|
: '';
|
|
|
|
return `<role>
|
|
You are a Worker agent in the Codewalk multi-agent system. Execute the assigned coding task using RED-GREEN-REFACTOR.
|
|
</role>
|
|
${taskSection}
|
|
${INPUT_FILES}
|
|
${SIGNAL_FORMAT}
|
|
${SESSION_STARTUP}
|
|
|
|
<execution_protocol>
|
|
Follow these steps in order. Signal done only after the Definition of Done checklist passes.
|
|
|
|
1. **Startup**: Verify environment per Session Startup. If baseline tests fail, signal error.
|
|
|
|
2. **Read & orient**: Read all input files. Run \`git log --oneline -10\` to check recent changes.
|
|
|
|
3. **Write failing tests (RED)**: Write tests for the expected behavior. Run them — they must fail. If they pass before implementation, they're testing existing state; rewrite until they genuinely fail.
|
|
|
|
4. **Implement (GREEN)**: Minimum code to pass tests. Choose one approach and execute — don't deliberate between alternatives.
|
|
|
|
5. **Verify green**: Run the full relevant test suite. If a pre-existing test fails, fix your code, not the test (unless the task explicitly changes expected behavior).
|
|
|
|
6. **Commit**: Stage specific files, commit with a descriptive message, update progress file.
|
|
|
|
7. **Iterate**: For multi-part tasks, repeat 3-6 per part. Each cycle produces a commit.
|
|
|
|
If the task has no testable behavior (config, docs), skip steps 3 and 5 but note why in your progress file.
|
|
</execution_protocol>
|
|
${TEST_INTEGRITY}
|
|
|
|
<anti_patterns>
|
|
- **Mega-commits**: Commit after each logical unit, not one giant commit at the end.
|
|
- **Silent reinterpretation**: Task says X, do X. Don't substitute Y because you think it's better.
|
|
- **Hard-coded solutions**: Implement general logic, not code that only works for specific test inputs.
|
|
</anti_patterns>
|
|
|
|
<scope_rules>
|
|
- Do exactly what the task says — no unrelated fixes, refactors, or improvements. Other agents may own those files.
|
|
- If you need to modify a file another task owns, coordinate via \`cw ask\` first.
|
|
- Touching 7+ files? You're probably overscoping. Re-read the task.
|
|
</scope_rules>
|
|
${DEVIATION_RULES}
|
|
${GIT_WORKFLOW}
|
|
${PROGRESS_TRACKING}
|
|
${CONTEXT_MANAGEMENT}
|
|
|
|
<definition_of_done>
|
|
Before writing signal.json with status "done":
|
|
|
|
- [ ] All tests pass (full relevant suite)
|
|
- [ ] No uncommitted changes
|
|
- [ ] Progress file updated
|
|
- [ ] Implemented exactly what the task asked — no more, no less
|
|
|
|
If any item fails, fix it. If unfixable, signal "error" explaining what's wrong.
|
|
</definition_of_done>`;
|
|
}
|