liteagents 2.4.0
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/CHANGELOG.md +441 -0
- package/LICENSE +21 -0
- package/README.md +179 -0
- package/cli.js +230 -0
- package/docs/.gitkeep +1 -0
- package/docs/CONTRIBUTING.md +739 -0
- package/docs/DUAL_PUBLISH_SUMMARY.md +177 -0
- package/docs/ERROR_HANDLING_IMPLEMENTATION.md +327 -0
- package/docs/GITHUB_PACKAGES.md +181 -0
- package/docs/GITHUB_SETUP.md +158 -0
- package/docs/INSTALLATION_DEMO.md +691 -0
- package/docs/INSTALLATION_LOCATIONS.md +299 -0
- package/docs/INSTALLER_GUIDE.md +1586 -0
- package/docs/INTEGRATION_ISSUES_9.1.md +341 -0
- package/docs/KNOWLEDGE_BASE.md +727 -0
- package/docs/MIGRATION.md +384 -0
- package/docs/PACKAGE_BASELINE.md +557 -0
- package/docs/PACKAGE_VALIDATION_REPORT.md +427 -0
- package/docs/PASS_INTEGRATION.md +307 -0
- package/docs/PASS_QUICK_START.md +150 -0
- package/docs/PRIVACY.md +203 -0
- package/docs/PUBLISHING.md +494 -0
- package/docs/QUICK-START.md +318 -0
- package/docs/RELEASE_NOTES_1.2.0.md +323 -0
- package/docs/SECURITY.md +317 -0
- package/docs/SILENT_MODE_GUIDE.md +526 -0
- package/docs/SKILLS_CONVERSION.md +154 -0
- package/docs/TESTING.md +582 -0
- package/docs/TEST_COVERAGE.md +347 -0
- package/docs/TROUBLESHOOTING.md +788 -0
- package/docs/UPDATED_VARIANT_CONFIGURATION.md +274 -0
- package/docs/VARIANT_CONFIGURATION.md +440 -0
- package/installer/cli.js +761 -0
- package/installer/installation-engine.js +1536 -0
- package/installer/package-manager.js +640 -0
- package/installer/path-manager.js +427 -0
- package/installer/report-template.js +298 -0
- package/installer/verification-system.js +274 -0
- package/package.json +83 -0
- package/packages/ampcode/AGENT.md +58 -0
- package/packages/ampcode/README.md +17 -0
- package/packages/ampcode/agents/1-create-prd.md +175 -0
- package/packages/ampcode/agents/2-generate-tasks.md +190 -0
- package/packages/ampcode/agents/3-process-task-list.md +225 -0
- package/packages/ampcode/agents/code-developer.md +198 -0
- package/packages/ampcode/agents/context-builder.md +142 -0
- package/packages/ampcode/agents/feature-planner.md +199 -0
- package/packages/ampcode/agents/market-researcher.md +89 -0
- package/packages/ampcode/agents/orchestrator.md +116 -0
- package/packages/ampcode/agents/quality-assurance.md +115 -0
- package/packages/ampcode/agents/system-architect.md +135 -0
- package/packages/ampcode/agents/ui-designer.md +184 -0
- package/packages/ampcode/commands/brainstorming.md +56 -0
- package/packages/ampcode/commands/code-review.md +107 -0
- package/packages/ampcode/commands/condition-based-waiting/example.ts +158 -0
- package/packages/ampcode/commands/condition-based-waiting.md +122 -0
- package/packages/ampcode/commands/debug.md +20 -0
- package/packages/ampcode/commands/docs-builder/templates.md +572 -0
- package/packages/ampcode/commands/docs-builder.md +106 -0
- package/packages/ampcode/commands/explain.md +18 -0
- package/packages/ampcode/commands/git-commit.md +14 -0
- package/packages/ampcode/commands/optimize.md +20 -0
- package/packages/ampcode/commands/refactor.md +21 -0
- package/packages/ampcode/commands/review.md +18 -0
- package/packages/ampcode/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/ampcode/commands/root-cause-tracing.md +176 -0
- package/packages/ampcode/commands/security.md +21 -0
- package/packages/ampcode/commands/ship.md +18 -0
- package/packages/ampcode/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/ampcode/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/ampcode/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/ampcode/commands/skill-creator.md +211 -0
- package/packages/ampcode/commands/stash.md +45 -0
- package/packages/ampcode/commands/systematic-debugging.md +297 -0
- package/packages/ampcode/commands/test-driven-development.md +390 -0
- package/packages/ampcode/commands/test-generate.md +18 -0
- package/packages/ampcode/commands/testing-anti-patterns.md +304 -0
- package/packages/ampcode/commands/verification-before-completion.md +152 -0
- package/packages/ampcode/settings.json +13 -0
- package/packages/ampcode/variants.json +8 -0
- package/packages/claude/CLAUDE.md +58 -0
- package/packages/claude/README.md +23 -0
- package/packages/claude/agents/1-create-prd.md +175 -0
- package/packages/claude/agents/2-generate-tasks.md +190 -0
- package/packages/claude/agents/3-process-task-list.md +225 -0
- package/packages/claude/agents/code-developer.md +198 -0
- package/packages/claude/agents/context-builder.md +142 -0
- package/packages/claude/agents/feature-planner.md +199 -0
- package/packages/claude/agents/market-researcher.md +89 -0
- package/packages/claude/agents/orchestrator.md +117 -0
- package/packages/claude/agents/quality-assurance.md +115 -0
- package/packages/claude/agents/system-architect.md +135 -0
- package/packages/claude/agents/ui-designer.md +184 -0
- package/packages/claude/commands/debug.md +20 -0
- package/packages/claude/commands/explain.md +18 -0
- package/packages/claude/commands/git-commit.md +14 -0
- package/packages/claude/commands/optimize.md +20 -0
- package/packages/claude/commands/refactor.md +21 -0
- package/packages/claude/commands/review.md +18 -0
- package/packages/claude/commands/security.md +21 -0
- package/packages/claude/commands/ship.md +18 -0
- package/packages/claude/commands/stash.md +45 -0
- package/packages/claude/commands/test-generate.md +18 -0
- package/packages/claude/skills/brainstorming/SKILL.md +56 -0
- package/packages/claude/skills/code-review/SKILL.md +107 -0
- package/packages/claude/skills/code-review/code-reviewer.md +146 -0
- package/packages/claude/skills/condition-based-waiting/SKILL.md +122 -0
- package/packages/claude/skills/condition-based-waiting/example.ts +158 -0
- package/packages/claude/skills/docs-builder/SKILL.md +106 -0
- package/packages/claude/skills/docs-builder/references/templates.md +572 -0
- package/packages/claude/skills/root-cause-tracing/SKILL.md +176 -0
- package/packages/claude/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/claude/skills/skill-creator/LICENSE.txt +202 -0
- package/packages/claude/skills/skill-creator/SKILL.md +211 -0
- package/packages/claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/packages/claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/packages/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/packages/claude/skills/systematic-debugging/SKILL.md +296 -0
- package/packages/claude/skills/systematic-debugging/test-academic.md +14 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/packages/claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/packages/claude/skills/test-driven-development/SKILL.md +392 -0
- package/packages/claude/skills/testing-anti-patterns/SKILL.md +304 -0
- package/packages/claude/skills/verification-before-completion/SKILL.md +152 -0
- package/packages/claude/variants.json +9 -0
- package/packages/droid/AGENTS.md +52 -0
- package/packages/droid/README.md +17 -0
- package/packages/droid/change_settings.json +61 -0
- package/packages/droid/commands/brainstorming.md +56 -0
- package/packages/droid/commands/code-review.md +107 -0
- package/packages/droid/commands/condition-based-waiting/example.ts +158 -0
- package/packages/droid/commands/condition-based-waiting.md +122 -0
- package/packages/droid/commands/debug.md +20 -0
- package/packages/droid/commands/docs-builder/templates.md +572 -0
- package/packages/droid/commands/docs-builder.md +106 -0
- package/packages/droid/commands/explain.md +18 -0
- package/packages/droid/commands/git-commit.md +14 -0
- package/packages/droid/commands/optimize.md +20 -0
- package/packages/droid/commands/refactor.md +21 -0
- package/packages/droid/commands/review.md +18 -0
- package/packages/droid/commands/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/droid/commands/root-cause-tracing.md +176 -0
- package/packages/droid/commands/security.md +21 -0
- package/packages/droid/commands/ship.md +18 -0
- package/packages/droid/commands/skill-creator/scripts/init_skill.py +303 -0
- package/packages/droid/commands/skill-creator/scripts/package_skill.py +110 -0
- package/packages/droid/commands/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/droid/commands/skill-creator.md +211 -0
- package/packages/droid/commands/stash.md +45 -0
- package/packages/droid/commands/systematic-debugging.md +297 -0
- package/packages/droid/commands/test-driven-development.md +390 -0
- package/packages/droid/commands/test-generate.md +18 -0
- package/packages/droid/commands/testing-anti-patterns.md +304 -0
- package/packages/droid/commands/verification-before-completion.md +152 -0
- package/packages/droid/droids/1-create-prd.md +170 -0
- package/packages/droid/droids/2-generate-tasks.md +190 -0
- package/packages/droid/droids/3-process-task-list.md +225 -0
- package/packages/droid/droids/code-developer.md +198 -0
- package/packages/droid/droids/context-builder.md +142 -0
- package/packages/droid/droids/feature-planner.md +199 -0
- package/packages/droid/droids/market-researcher.md +89 -0
- package/packages/droid/droids/orchestrator.md +116 -0
- package/packages/droid/droids/quality-assurance.md +115 -0
- package/packages/droid/droids/system-architect.md +135 -0
- package/packages/droid/droids/ui-designer.md +184 -0
- package/packages/droid/variants.json +8 -0
- package/packages/opencode/AGENTS.md +52 -0
- package/packages/opencode/README.md +17 -0
- package/packages/opencode/agent/1-create-prd.md +179 -0
- package/packages/opencode/agent/2-generate-tasks.md +194 -0
- package/packages/opencode/agent/3-process-task-list.md +229 -0
- package/packages/opencode/agent/code-developer.md +202 -0
- package/packages/opencode/agent/context-builder.md +146 -0
- package/packages/opencode/agent/feature-planner.md +203 -0
- package/packages/opencode/agent/market-researcher.md +93 -0
- package/packages/opencode/agent/orchestrator.md +120 -0
- package/packages/opencode/agent/quality-assurance.md +119 -0
- package/packages/opencode/agent/system-architect.md +139 -0
- package/packages/opencode/agent/ui-designer.md +188 -0
- package/packages/opencode/command/brainstorming.md +56 -0
- package/packages/opencode/command/code-review.md +107 -0
- package/packages/opencode/command/condition-based-waiting/example.ts +158 -0
- package/packages/opencode/command/condition-based-waiting.md +122 -0
- package/packages/opencode/command/debug.md +20 -0
- package/packages/opencode/command/docs-builder/templates.md +572 -0
- package/packages/opencode/command/docs-builder.md +106 -0
- package/packages/opencode/command/explain.md +18 -0
- package/packages/opencode/command/git-commit.md +14 -0
- package/packages/opencode/command/optimize.md +20 -0
- package/packages/opencode/command/refactor.md +21 -0
- package/packages/opencode/command/review.md +18 -0
- package/packages/opencode/command/root-cause-tracing/find-polluter.sh +63 -0
- package/packages/opencode/command/root-cause-tracing.md +176 -0
- package/packages/opencode/command/security.md +21 -0
- package/packages/opencode/command/ship.md +18 -0
- package/packages/opencode/command/skill-creator/scripts/init_skill.py +303 -0
- package/packages/opencode/command/skill-creator/scripts/package_skill.py +110 -0
- package/packages/opencode/command/skill-creator/scripts/quick_validate.py +65 -0
- package/packages/opencode/command/skill-creator.md +211 -0
- package/packages/opencode/command/stash.md +45 -0
- package/packages/opencode/command/systematic-debugging.md +297 -0
- package/packages/opencode/command/test-driven-development.md +390 -0
- package/packages/opencode/command/test-generate.md +18 -0
- package/packages/opencode/command/testing-anti-patterns.md +304 -0
- package/packages/opencode/command/verification-before-completion.md +152 -0
- package/packages/opencode/opencode.jsonc +201 -0
- package/packages/opencode/variants.json +8 -0
- package/packages/subagentic-manual.md +349 -0
- package/postinstall.js +21 -0
- package/tools/ampcode/manifest-template.json +14 -0
- package/tools/claude/manifest-template.json +14 -0
- package/tools/droid/manifest-template.json +14 -0
- package/tools/opencode/manifest-template.json +14 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ship
|
|
3
|
+
description: Check pre-deployment
|
|
4
|
+
usage: /ship
|
|
5
|
+
allowed-tools: Bash(npm *), Bash(git *)
|
|
6
|
+
---
|
|
7
|
+
Pre-deploy checklist:
|
|
8
|
+
|
|
9
|
+
- [ ] Tests pass (`npm test`)
|
|
10
|
+
- [ ] Lint clean (`npm run lint`)
|
|
11
|
+
- [ ] Build succeeds (`npm run build`)
|
|
12
|
+
- [ ] No console.log/debugger statements
|
|
13
|
+
- [ ] Env vars documented
|
|
14
|
+
- [ ] No hardcoded secrets
|
|
15
|
+
- [ ] Error handling complete
|
|
16
|
+
- [ ] Migrations ready
|
|
17
|
+
|
|
18
|
+
Run checks and report: Ready 🚀 or Blocked 🛑 with issues.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: stash
|
|
3
|
+
description: Stash session context [name]
|
|
4
|
+
usage: /stash ["optional-name"]
|
|
5
|
+
argument-hint: [optional stash name]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Save session context for compaction recovery or handoffs.
|
|
9
|
+
|
|
10
|
+
**Guardrails**
|
|
11
|
+
- Favor straightforward, minimal implementations first and add complexity only when requested or clearly required.
|
|
12
|
+
- Keep changes tightly scoped to the requested outcome.
|
|
13
|
+
|
|
14
|
+
**What it does**
|
|
15
|
+
1. Captures current conversation context and key decisions
|
|
16
|
+
2. Records active work in progress
|
|
17
|
+
3. Stores important findings and insights
|
|
18
|
+
4. Creates stash file in `.claude/stash/`
|
|
19
|
+
5. Enables context restoration after compaction
|
|
20
|
+
|
|
21
|
+
**When to use**
|
|
22
|
+
- Before long-running tasks that may trigger compaction
|
|
23
|
+
- When handing off work to another agent or session
|
|
24
|
+
- After completing major investigation or analysis
|
|
25
|
+
- Before taking a break from complex multi-step work
|
|
26
|
+
|
|
27
|
+
**Commands**
|
|
28
|
+
```bash
|
|
29
|
+
# Stash with auto-generated name
|
|
30
|
+
/stash
|
|
31
|
+
|
|
32
|
+
# Stash with custom name
|
|
33
|
+
/stash "feature-auth-investigation"
|
|
34
|
+
|
|
35
|
+
# List available stashes
|
|
36
|
+
ls .claude/stash/
|
|
37
|
+
|
|
38
|
+
# Restore from stash
|
|
39
|
+
cat .claude/stash/<name>.md
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Reference**
|
|
43
|
+
- Stashes stored in `.claude/stash/` (project-local)
|
|
44
|
+
- Automatically includes: timestamp, active plan, recent decisions
|
|
45
|
+
- Maximum context retention with minimal token usage
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-generate
|
|
3
|
+
description: Generate tests [file]
|
|
4
|
+
usage: /test-generate <code-section>
|
|
5
|
+
argument-hint: [file-to-test]
|
|
6
|
+
---
|
|
7
|
+
Generate tests for $ARGUMENTS.
|
|
8
|
+
|
|
9
|
+
## Include
|
|
10
|
+
- Happy path (expected usage)
|
|
11
|
+
- Edge cases (empty, null, boundaries)
|
|
12
|
+
- Error scenarios (invalid input, failures)
|
|
13
|
+
- Integration points (mocks for external deps)
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
- Match existing test patterns in this project
|
|
17
|
+
- Use the testing framework already in use
|
|
18
|
+
- Clear test names: "should [expected] when [condition]"
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: Use when creating or developing, before writing code or implementation plans - refines rough ideas into fully-formed designs through collaborative questioning, alternative exploration, and incremental validation. Don't use during clear 'mechanical' processes
|
|
4
|
+
usage: /brainstorming <session-type> <topic>
|
|
5
|
+
auto_trigger: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Brainstorming Ideas Into Designs
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
|
|
13
|
+
|
|
14
|
+
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design in small sections (200-300 words), checking after each section whether it looks right so far.
|
|
15
|
+
|
|
16
|
+
## The Process
|
|
17
|
+
|
|
18
|
+
**Understanding the idea:**
|
|
19
|
+
- Check out the current project state first (files, docs, recent commits)
|
|
20
|
+
- Ask questions one at a time to refine the idea
|
|
21
|
+
- Prefer multiple choice questions when possible, but open-ended is fine too
|
|
22
|
+
- Only one question per message - if a topic needs more exploration, break it into multiple questions
|
|
23
|
+
- Focus on understanding: purpose, constraints, success criteria
|
|
24
|
+
|
|
25
|
+
**Exploring approaches:**
|
|
26
|
+
- Propose 2-3 different approaches with trade-offs
|
|
27
|
+
- Present options conversationally with your recommendation and reasoning
|
|
28
|
+
- Lead with your recommended option and explain why
|
|
29
|
+
|
|
30
|
+
**Presenting the design:**
|
|
31
|
+
- Once you believe you understand what you're building, present the design
|
|
32
|
+
- Break it into sections of 200-300 words
|
|
33
|
+
- Ask after each section whether it looks right so far
|
|
34
|
+
- Cover: architecture, components, data flow, error handling, testing
|
|
35
|
+
- Be ready to go back and clarify if something doesn't make sense
|
|
36
|
+
|
|
37
|
+
## After the Design
|
|
38
|
+
|
|
39
|
+
**Documentation:**
|
|
40
|
+
- Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
41
|
+
- Use elements-of-style:writing-clearly-and-concisely skill if available
|
|
42
|
+
- Commit the design document to git
|
|
43
|
+
|
|
44
|
+
**Implementation (if continuing):**
|
|
45
|
+
- Ask: "Ready to set up for implementation?"
|
|
46
|
+
- Create isolated workspace for implementation
|
|
47
|
+
- Create detailed implementation plan
|
|
48
|
+
|
|
49
|
+
## Key Principles
|
|
50
|
+
|
|
51
|
+
- **One question at a time** - Don't overwhelm with multiple questions
|
|
52
|
+
- **Multiple choice preferred** - Easier to answer than open-ended when possible
|
|
53
|
+
- **YAGNI ruthlessly** - Remove unnecessary features from all designs
|
|
54
|
+
- **Explore alternatives** - Always propose 2-3 approaches before settling
|
|
55
|
+
- **Incremental validation** - Present design in sections, validate each
|
|
56
|
+
- **Be flexible** - Go back and clarify when something doesn't make sense
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Use when completing tasks, implementing major features, or before merging to verify work meets requirements - reviews implementation against plan or requirements before proceeding
|
|
4
|
+
usage: /code-review <review-scope> <focus-areas>
|
|
5
|
+
auto_trigger: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Requesting Code Review
|
|
9
|
+
|
|
10
|
+
Review code thoroughly to catch issues before they cascade.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Review early, review often.
|
|
13
|
+
|
|
14
|
+
## When to Request Review
|
|
15
|
+
|
|
16
|
+
**Mandatory:**
|
|
17
|
+
- After each task in subagent-driven development
|
|
18
|
+
- After completing major feature
|
|
19
|
+
- Before merge to main
|
|
20
|
+
|
|
21
|
+
**Optional but valuable:**
|
|
22
|
+
- When stuck (fresh perspective)
|
|
23
|
+
- Before refactoring (baseline check)
|
|
24
|
+
- After fixing complex bug
|
|
25
|
+
|
|
26
|
+
## How to Request
|
|
27
|
+
|
|
28
|
+
**1. Get git SHAs:**
|
|
29
|
+
```bash
|
|
30
|
+
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
31
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**2. Conduct code review:**
|
|
35
|
+
|
|
36
|
+
Review implementation against requirements and plan
|
|
37
|
+
|
|
38
|
+
**Placeholders:**
|
|
39
|
+
- `{WHAT_WAS_IMPLEMENTED}` - What you just built
|
|
40
|
+
- `{PLAN_OR_REQUIREMENTS}` - What it should do
|
|
41
|
+
- `{BASE_SHA}` - Starting commit
|
|
42
|
+
- `{HEAD_SHA}` - Ending commit
|
|
43
|
+
- `{DESCRIPTION}` - Brief summary
|
|
44
|
+
|
|
45
|
+
**3. Act on feedback:**
|
|
46
|
+
- Fix Critical issues immediately
|
|
47
|
+
- Fix Important issues before proceeding
|
|
48
|
+
- Note Minor issues for later
|
|
49
|
+
- Push back if reviewer is wrong (with reasoning)
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
[Just completed Task 2: Add verification function]
|
|
55
|
+
|
|
56
|
+
You: Let me request code review before proceeding.
|
|
57
|
+
|
|
58
|
+
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
|
|
59
|
+
HEAD_SHA=$(git rev-parse HEAD)
|
|
60
|
+
|
|
61
|
+
[Conduct code review]
|
|
62
|
+
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
|
|
63
|
+
PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
|
|
64
|
+
BASE_SHA: a7981ec
|
|
65
|
+
HEAD_SHA: 3df7661
|
|
66
|
+
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
|
|
67
|
+
|
|
68
|
+
[Subagent returns]:
|
|
69
|
+
Strengths: Clean architecture, real tests
|
|
70
|
+
Issues:
|
|
71
|
+
Important: Missing progress indicators
|
|
72
|
+
Minor: Magic number (100) for reporting interval
|
|
73
|
+
Assessment: Ready to proceed
|
|
74
|
+
|
|
75
|
+
You: [Fix progress indicators]
|
|
76
|
+
[Continue to Task 3]
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Integration with Workflows
|
|
80
|
+
|
|
81
|
+
**Subagent-Driven Development:**
|
|
82
|
+
- Review after EACH task
|
|
83
|
+
- Catch issues before they compound
|
|
84
|
+
- Fix before moving to next task
|
|
85
|
+
|
|
86
|
+
**Executing Plans:**
|
|
87
|
+
- Review after each batch (3 tasks)
|
|
88
|
+
- Get feedback, apply, continue
|
|
89
|
+
|
|
90
|
+
**Ad-Hoc Development:**
|
|
91
|
+
- Review before merge
|
|
92
|
+
- Review when stuck
|
|
93
|
+
|
|
94
|
+
## Red Flags
|
|
95
|
+
|
|
96
|
+
**Never:**
|
|
97
|
+
- Skip review because "it's simple"
|
|
98
|
+
- Ignore Critical issues
|
|
99
|
+
- Proceed with unfixed Important issues
|
|
100
|
+
- Argue with valid technical feedback
|
|
101
|
+
|
|
102
|
+
**If reviewer wrong:**
|
|
103
|
+
- Push back with technical reasoning
|
|
104
|
+
- Show code/tests that prove it works
|
|
105
|
+
- Request clarification
|
|
106
|
+
|
|
107
|
+
See template at: requesting-code-review/code-reviewer.md
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Code Review Agent
|
|
2
|
+
|
|
3
|
+
You are reviewing code changes for production readiness.
|
|
4
|
+
|
|
5
|
+
**Your task:**
|
|
6
|
+
1. Review {WHAT_WAS_IMPLEMENTED}
|
|
7
|
+
2. Compare against {PLAN_OR_REQUIREMENTS}
|
|
8
|
+
3. Check code quality, architecture, testing
|
|
9
|
+
4. Categorize issues by severity
|
|
10
|
+
5. Assess production readiness
|
|
11
|
+
|
|
12
|
+
## What Was Implemented
|
|
13
|
+
|
|
14
|
+
{DESCRIPTION}
|
|
15
|
+
|
|
16
|
+
## Requirements/Plan
|
|
17
|
+
|
|
18
|
+
{PLAN_REFERENCE}
|
|
19
|
+
|
|
20
|
+
## Git Range to Review
|
|
21
|
+
|
|
22
|
+
**Base:** {BASE_SHA}
|
|
23
|
+
**Head:** {HEAD_SHA}
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git diff --stat {BASE_SHA}..{HEAD_SHA}
|
|
27
|
+
git diff {BASE_SHA}..{HEAD_SHA}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Review Checklist
|
|
31
|
+
|
|
32
|
+
**Code Quality:**
|
|
33
|
+
- Clean separation of concerns?
|
|
34
|
+
- Proper error handling?
|
|
35
|
+
- Type safety (if applicable)?
|
|
36
|
+
- DRY principle followed?
|
|
37
|
+
- Edge cases handled?
|
|
38
|
+
|
|
39
|
+
**Architecture:**
|
|
40
|
+
- Sound design decisions?
|
|
41
|
+
- Scalability considerations?
|
|
42
|
+
- Performance implications?
|
|
43
|
+
- Security concerns?
|
|
44
|
+
|
|
45
|
+
**Testing:**
|
|
46
|
+
- Tests actually test logic (not mocks)?
|
|
47
|
+
- Edge cases covered?
|
|
48
|
+
- Integration tests where needed?
|
|
49
|
+
- All tests passing?
|
|
50
|
+
|
|
51
|
+
**Requirements:**
|
|
52
|
+
- All plan requirements met?
|
|
53
|
+
- Implementation matches spec?
|
|
54
|
+
- No scope creep?
|
|
55
|
+
- Breaking changes documented?
|
|
56
|
+
|
|
57
|
+
**Production Readiness:**
|
|
58
|
+
- Migration strategy (if schema changes)?
|
|
59
|
+
- Backward compatibility considered?
|
|
60
|
+
- Documentation complete?
|
|
61
|
+
- No obvious bugs?
|
|
62
|
+
|
|
63
|
+
## Output Format
|
|
64
|
+
|
|
65
|
+
### Strengths
|
|
66
|
+
[What's well done? Be specific.]
|
|
67
|
+
|
|
68
|
+
### Issues
|
|
69
|
+
|
|
70
|
+
#### Critical (Must Fix)
|
|
71
|
+
[Bugs, security issues, data loss risks, broken functionality]
|
|
72
|
+
|
|
73
|
+
#### Important (Should Fix)
|
|
74
|
+
[Architecture problems, missing features, poor error handling, test gaps]
|
|
75
|
+
|
|
76
|
+
#### Minor (Nice to Have)
|
|
77
|
+
[Code style, optimization opportunities, documentation improvements]
|
|
78
|
+
|
|
79
|
+
**For each issue:**
|
|
80
|
+
- File:line reference
|
|
81
|
+
- What's wrong
|
|
82
|
+
- Why it matters
|
|
83
|
+
- How to fix (if not obvious)
|
|
84
|
+
|
|
85
|
+
### Recommendations
|
|
86
|
+
[Improvements for code quality, architecture, or process]
|
|
87
|
+
|
|
88
|
+
### Assessment
|
|
89
|
+
|
|
90
|
+
**Ready to merge?** [Yes/No/With fixes]
|
|
91
|
+
|
|
92
|
+
**Reasoning:** [Technical assessment in 1-2 sentences]
|
|
93
|
+
|
|
94
|
+
## Critical Rules
|
|
95
|
+
|
|
96
|
+
**DO:**
|
|
97
|
+
- Categorize by actual severity (not everything is Critical)
|
|
98
|
+
- Be specific (file:line, not vague)
|
|
99
|
+
- Explain WHY issues matter
|
|
100
|
+
- Acknowledge strengths
|
|
101
|
+
- Give clear verdict
|
|
102
|
+
|
|
103
|
+
**DON'T:**
|
|
104
|
+
- Say "looks good" without checking
|
|
105
|
+
- Mark nitpicks as Critical
|
|
106
|
+
- Give feedback on code you didn't review
|
|
107
|
+
- Be vague ("improve error handling")
|
|
108
|
+
- Avoid giving a clear verdict
|
|
109
|
+
|
|
110
|
+
## Example Output
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
### Strengths
|
|
114
|
+
- Clean database schema with proper migrations (db.ts:15-42)
|
|
115
|
+
- Comprehensive test coverage (18 tests, all edge cases)
|
|
116
|
+
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
117
|
+
|
|
118
|
+
### Issues
|
|
119
|
+
|
|
120
|
+
#### Important
|
|
121
|
+
1. **Missing help text in CLI wrapper**
|
|
122
|
+
- File: index-conversations:1-31
|
|
123
|
+
- Issue: No --help flag, users won't discover --concurrency
|
|
124
|
+
- Fix: Add --help case with usage examples
|
|
125
|
+
|
|
126
|
+
2. **Date validation missing**
|
|
127
|
+
- File: search.ts:25-27
|
|
128
|
+
- Issue: Invalid dates silently return no results
|
|
129
|
+
- Fix: Validate ISO format, throw error with example
|
|
130
|
+
|
|
131
|
+
#### Minor
|
|
132
|
+
1. **Progress indicators**
|
|
133
|
+
- File: indexer.ts:130
|
|
134
|
+
- Issue: No "X of Y" counter for long operations
|
|
135
|
+
- Impact: Users don't know how long to wait
|
|
136
|
+
|
|
137
|
+
### Recommendations
|
|
138
|
+
- Add progress reporting for user experience
|
|
139
|
+
- Consider config file for excluded projects (portability)
|
|
140
|
+
|
|
141
|
+
### Assessment
|
|
142
|
+
|
|
143
|
+
**Ready to merge: With fixes**
|
|
144
|
+
|
|
145
|
+
**Reasoning:** Core implementation is solid with good architecture and tests. Important issues (help text, date validation) are easily fixed and don't affect core functionality.
|
|
146
|
+
```
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: condition-based-waiting
|
|
3
|
+
description: Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses
|
|
4
|
+
usage: /condition-based-waiting <condition-type> <timeout-specs>
|
|
5
|
+
auto_trigger: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Condition-Based Waiting
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI.
|
|
13
|
+
|
|
14
|
+
**Core principle:** Wait for the actual condition you care about, not a guess about how long it takes.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
```dot
|
|
19
|
+
digraph when_to_use {
|
|
20
|
+
"Test uses setTimeout/sleep?" [shape=diamond];
|
|
21
|
+
"Testing timing behavior?" [shape=diamond];
|
|
22
|
+
"Document WHY timeout needed" [shape=box];
|
|
23
|
+
"Use condition-based waiting" [shape=box];
|
|
24
|
+
|
|
25
|
+
"Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
|
|
26
|
+
"Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
|
|
27
|
+
"Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Use when:**
|
|
32
|
+
- Tests have arbitrary delays (`setTimeout`, `sleep`, `time.sleep()`)
|
|
33
|
+
- Tests are flaky (pass sometimes, fail under load)
|
|
34
|
+
- Tests timeout when run in parallel
|
|
35
|
+
- Waiting for async operations to complete
|
|
36
|
+
|
|
37
|
+
**Don't use when:**
|
|
38
|
+
- Testing actual timing behavior (debounce, throttle intervals)
|
|
39
|
+
- Always document WHY if using arbitrary timeout
|
|
40
|
+
|
|
41
|
+
## Core Pattern
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// ❌ BEFORE: Guessing at timing
|
|
45
|
+
await new Promise(r => setTimeout(r, 50));
|
|
46
|
+
const result = getResult();
|
|
47
|
+
expect(result).toBeDefined();
|
|
48
|
+
|
|
49
|
+
// ✅ AFTER: Waiting for condition
|
|
50
|
+
await waitFor(() => getResult() !== undefined);
|
|
51
|
+
const result = getResult();
|
|
52
|
+
expect(result).toBeDefined();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Patterns
|
|
56
|
+
|
|
57
|
+
| Scenario | Pattern |
|
|
58
|
+
|----------|---------|
|
|
59
|
+
| Wait for event | `waitFor(() => events.find(e => e.type === 'DONE'))` |
|
|
60
|
+
| Wait for state | `waitFor(() => machine.state === 'ready')` |
|
|
61
|
+
| Wait for count | `waitFor(() => items.length >= 5)` |
|
|
62
|
+
| Wait for file | `waitFor(() => fs.existsSync(path))` |
|
|
63
|
+
| Complex condition | `waitFor(() => obj.ready && obj.value > 10)` |
|
|
64
|
+
|
|
65
|
+
## Implementation
|
|
66
|
+
|
|
67
|
+
Generic polling function:
|
|
68
|
+
```typescript
|
|
69
|
+
async function waitFor<T>(
|
|
70
|
+
condition: () => T | undefined | null | false,
|
|
71
|
+
description: string,
|
|
72
|
+
timeoutMs = 5000
|
|
73
|
+
): Promise<T> {
|
|
74
|
+
const startTime = Date.now();
|
|
75
|
+
|
|
76
|
+
while (true) {
|
|
77
|
+
const result = condition();
|
|
78
|
+
if (result) return result;
|
|
79
|
+
|
|
80
|
+
if (Date.now() - startTime > timeoutMs) {
|
|
81
|
+
throw new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
await new Promise(r => setTimeout(r, 10)); // Poll every 10ms
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See @example.ts for complete implementation with domain-specific helpers (`waitForEvent`, `waitForEventCount`, `waitForEventMatch`) from actual debugging session.
|
|
90
|
+
|
|
91
|
+
## Common Mistakes
|
|
92
|
+
|
|
93
|
+
**❌ Polling too fast:** `setTimeout(check, 1)` - wastes CPU
|
|
94
|
+
**✅ Fix:** Poll every 10ms
|
|
95
|
+
|
|
96
|
+
**❌ No timeout:** Loop forever if condition never met
|
|
97
|
+
**✅ Fix:** Always include timeout with clear error
|
|
98
|
+
|
|
99
|
+
**❌ Stale data:** Cache state before loop
|
|
100
|
+
**✅ Fix:** Call getter inside loop for fresh data
|
|
101
|
+
|
|
102
|
+
## When Arbitrary Timeout IS Correct
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// Tool ticks every 100ms - need 2 ticks to verify partial output
|
|
106
|
+
await waitForEvent(manager, 'TOOL_STARTED'); // First: wait for condition
|
|
107
|
+
await new Promise(r => setTimeout(r, 200)); // Then: wait for timed behavior
|
|
108
|
+
// 200ms = 2 ticks at 100ms intervals - documented and justified
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Requirements:**
|
|
112
|
+
1. First wait for triggering condition
|
|
113
|
+
2. Based on known timing (not guessing)
|
|
114
|
+
3. Comment explaining WHY
|
|
115
|
+
|
|
116
|
+
## Real-World Impact
|
|
117
|
+
|
|
118
|
+
From debugging session (2025-10-03):
|
|
119
|
+
- Fixed 15 flaky tests across 3 files
|
|
120
|
+
- Pass rate: 60% → 100%
|
|
121
|
+
- Execution time: 40% faster
|
|
122
|
+
- No more race conditions
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Complete implementation of condition-based waiting utilities
|
|
2
|
+
// From: Lace test infrastructure improvements (2025-10-03)
|
|
3
|
+
// Context: Fixed 15 flaky tests by replacing arbitrary timeouts
|
|
4
|
+
|
|
5
|
+
import type { ThreadManager } from '~/threads/thread-manager';
|
|
6
|
+
import type { LaceEvent, LaceEventType } from '~/threads/types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Wait for a specific event type to appear in thread
|
|
10
|
+
*
|
|
11
|
+
* @param threadManager - The thread manager to query
|
|
12
|
+
* @param threadId - Thread to check for events
|
|
13
|
+
* @param eventType - Type of event to wait for
|
|
14
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
15
|
+
* @returns Promise resolving to the first matching event
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* await waitForEvent(threadManager, agentThreadId, 'TOOL_RESULT');
|
|
19
|
+
*/
|
|
20
|
+
export function waitForEvent(
|
|
21
|
+
threadManager: ThreadManager,
|
|
22
|
+
threadId: string,
|
|
23
|
+
eventType: LaceEventType,
|
|
24
|
+
timeoutMs = 5000
|
|
25
|
+
): Promise<LaceEvent> {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const startTime = Date.now();
|
|
28
|
+
|
|
29
|
+
const check = () => {
|
|
30
|
+
const events = threadManager.getEvents(threadId);
|
|
31
|
+
const event = events.find((e) => e.type === eventType);
|
|
32
|
+
|
|
33
|
+
if (event) {
|
|
34
|
+
resolve(event);
|
|
35
|
+
} else if (Date.now() - startTime > timeoutMs) {
|
|
36
|
+
reject(new Error(`Timeout waiting for ${eventType} event after ${timeoutMs}ms`));
|
|
37
|
+
} else {
|
|
38
|
+
setTimeout(check, 10); // Poll every 10ms for efficiency
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
check();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Wait for a specific number of events of a given type
|
|
48
|
+
*
|
|
49
|
+
* @param threadManager - The thread manager to query
|
|
50
|
+
* @param threadId - Thread to check for events
|
|
51
|
+
* @param eventType - Type of event to wait for
|
|
52
|
+
* @param count - Number of events to wait for
|
|
53
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
54
|
+
* @returns Promise resolving to all matching events once count is reached
|
|
55
|
+
*
|
|
56
|
+
* Example:
|
|
57
|
+
* // Wait for 2 AGENT_MESSAGE events (initial response + continuation)
|
|
58
|
+
* await waitForEventCount(threadManager, agentThreadId, 'AGENT_MESSAGE', 2);
|
|
59
|
+
*/
|
|
60
|
+
export function waitForEventCount(
|
|
61
|
+
threadManager: ThreadManager,
|
|
62
|
+
threadId: string,
|
|
63
|
+
eventType: LaceEventType,
|
|
64
|
+
count: number,
|
|
65
|
+
timeoutMs = 5000
|
|
66
|
+
): Promise<LaceEvent[]> {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const startTime = Date.now();
|
|
69
|
+
|
|
70
|
+
const check = () => {
|
|
71
|
+
const events = threadManager.getEvents(threadId);
|
|
72
|
+
const matchingEvents = events.filter((e) => e.type === eventType);
|
|
73
|
+
|
|
74
|
+
if (matchingEvents.length >= count) {
|
|
75
|
+
resolve(matchingEvents);
|
|
76
|
+
} else if (Date.now() - startTime > timeoutMs) {
|
|
77
|
+
reject(
|
|
78
|
+
new Error(
|
|
79
|
+
`Timeout waiting for ${count} ${eventType} events after ${timeoutMs}ms (got ${matchingEvents.length})`
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
} else {
|
|
83
|
+
setTimeout(check, 10);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
check();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Wait for an event matching a custom predicate
|
|
93
|
+
* Useful when you need to check event data, not just type
|
|
94
|
+
*
|
|
95
|
+
* @param threadManager - The thread manager to query
|
|
96
|
+
* @param threadId - Thread to check for events
|
|
97
|
+
* @param predicate - Function that returns true when event matches
|
|
98
|
+
* @param description - Human-readable description for error messages
|
|
99
|
+
* @param timeoutMs - Maximum time to wait (default 5000ms)
|
|
100
|
+
* @returns Promise resolving to the first matching event
|
|
101
|
+
*
|
|
102
|
+
* Example:
|
|
103
|
+
* // Wait for TOOL_RESULT with specific ID
|
|
104
|
+
* await waitForEventMatch(
|
|
105
|
+
* threadManager,
|
|
106
|
+
* agentThreadId,
|
|
107
|
+
* (e) => e.type === 'TOOL_RESULT' && e.data.id === 'call_123',
|
|
108
|
+
* 'TOOL_RESULT with id=call_123'
|
|
109
|
+
* );
|
|
110
|
+
*/
|
|
111
|
+
export function waitForEventMatch(
|
|
112
|
+
threadManager: ThreadManager,
|
|
113
|
+
threadId: string,
|
|
114
|
+
predicate: (event: LaceEvent) => boolean,
|
|
115
|
+
description: string,
|
|
116
|
+
timeoutMs = 5000
|
|
117
|
+
): Promise<LaceEvent> {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const startTime = Date.now();
|
|
120
|
+
|
|
121
|
+
const check = () => {
|
|
122
|
+
const events = threadManager.getEvents(threadId);
|
|
123
|
+
const event = events.find(predicate);
|
|
124
|
+
|
|
125
|
+
if (event) {
|
|
126
|
+
resolve(event);
|
|
127
|
+
} else if (Date.now() - startTime > timeoutMs) {
|
|
128
|
+
reject(new Error(`Timeout waiting for ${description} after ${timeoutMs}ms`));
|
|
129
|
+
} else {
|
|
130
|
+
setTimeout(check, 10);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
check();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Usage example from actual debugging session:
|
|
139
|
+
//
|
|
140
|
+
// BEFORE (flaky):
|
|
141
|
+
// ---------------
|
|
142
|
+
// const messagePromise = agent.sendMessage('Execute tools');
|
|
143
|
+
// await new Promise(r => setTimeout(r, 300)); // Hope tools start in 300ms
|
|
144
|
+
// agent.abort();
|
|
145
|
+
// await messagePromise;
|
|
146
|
+
// await new Promise(r => setTimeout(r, 50)); // Hope results arrive in 50ms
|
|
147
|
+
// expect(toolResults.length).toBe(2); // Fails randomly
|
|
148
|
+
//
|
|
149
|
+
// AFTER (reliable):
|
|
150
|
+
// ----------------
|
|
151
|
+
// const messagePromise = agent.sendMessage('Execute tools');
|
|
152
|
+
// await waitForEventCount(threadManager, threadId, 'TOOL_CALL', 2); // Wait for tools to start
|
|
153
|
+
// agent.abort();
|
|
154
|
+
// await messagePromise;
|
|
155
|
+
// await waitForEventCount(threadManager, threadId, 'TOOL_RESULT', 2); // Wait for results
|
|
156
|
+
// expect(toolResults.length).toBe(2); // Always succeeds
|
|
157
|
+
//
|
|
158
|
+
// Result: 60% pass rate → 100%, 40% faster execution
|