planflow-ai 1.0.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/.claude/commands/create-contract.md +468 -0
- package/.claude/commands/create-plan.md +512 -0
- package/.claude/commands/discovery-plan.md +561 -0
- package/.claude/commands/execute-plan.md +682 -0
- package/.claude/commands/review-code.md +459 -0
- package/.claude/commands/review-pr.md +651 -0
- package/.claude/commands/setup.md +1609 -0
- package/.claude/commands/write-tests.md +543 -0
- package/.claude/rules/core/allowed-patterns.md +175 -0
- package/.claude/rules/core/complexity-scoring.md +225 -0
- package/.claude/rules/core/forbidden-patterns.md +253 -0
- package/.claude/rules/core/project-ledger.md +150 -0
- package/.claude/rules/languages/python-patterns.md +6 -0
- package/.claude/rules/languages/typescript-patterns.md +7 -0
- package/.claude/rules/patterns/contract-patterns.md +332 -0
- package/.claude/rules/patterns/discovery-patterns.md +342 -0
- package/.claude/rules/patterns/discovery-templates.md +319 -0
- package/.claude/rules/patterns/jest-patterns.md +482 -0
- package/.claude/rules/patterns/plans-patterns.md +225 -0
- package/.claude/rules/patterns/plans-templates.md +227 -0
- package/.claude/rules/patterns/pytest-patterns.md +457 -0
- package/.claude/rules/patterns/review-code-templates.md +305 -0
- package/.claude/rules/patterns/review-pr-patterns.md +360 -0
- package/.claude/rules/tools/auth-pr-tool.md +30 -0
- package/.claude/rules/tools/interactive-questions-tool.md +235 -0
- package/.claude/rules/tools/jest-testing-tool.md +73 -0
- package/.claude/rules/tools/plan-mode-tool.md +164 -0
- package/.claude/rules/tools/pytest-testing-tool.md +121 -0
- package/.claude/rules/tools/reference-expansion-tool.md +326 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +141 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/handlers/claude.d.ts +9 -0
- package/dist/cli/handlers/claude.d.ts.map +1 -0
- package/dist/cli/handlers/claude.js +119 -0
- package/dist/cli/handlers/claude.js.map +1 -0
- package/dist/cli/handlers/codex.d.ts +9 -0
- package/dist/cli/handlers/codex.d.ts.map +1 -0
- package/dist/cli/handlers/codex.js +100 -0
- package/dist/cli/handlers/codex.js.map +1 -0
- package/dist/cli/handlers/cursor.d.ts +9 -0
- package/dist/cli/handlers/cursor.d.ts.map +1 -0
- package/dist/cli/handlers/cursor.js +60 -0
- package/dist/cli/handlers/cursor.js.map +1 -0
- package/dist/cli/handlers/openclaw.d.ts +8 -0
- package/dist/cli/handlers/openclaw.d.ts.map +1 -0
- package/dist/cli/handlers/openclaw.js +34 -0
- package/dist/cli/handlers/openclaw.js.map +1 -0
- package/dist/cli/handlers/shared.d.ts +9 -0
- package/dist/cli/handlers/shared.d.ts.map +1 -0
- package/dist/cli/handlers/shared.js +126 -0
- package/dist/cli/handlers/shared.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +43 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/types.d.ts +26 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +5 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/utils/files.d.ts +37 -0
- package/dist/cli/utils/files.d.ts.map +1 -0
- package/dist/cli/utils/files.js +115 -0
- package/dist/cli/utils/files.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +11 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +34 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/cli/utils/prompts.d.ts +10 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +65 -0
- package/dist/cli/utils/prompts.js.map +1 -0
- package/dist/test/setup.d.ts +5 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +7 -0
- package/dist/test/setup.js.map +1 -0
- package/package.json +63 -0
- package/rules/core/_index.mdc +99 -0
- package/rules/core/allowed-patterns.mdc +185 -0
- package/rules/core/complexity-scoring.mdc +235 -0
- package/rules/core/forbidden-patterns.mdc +263 -0
- package/rules/core/project-ledger.mdc +155 -0
- package/rules/languages/_index.mdc +80 -0
- package/rules/languages/python-patterns.mdc +188 -0
- package/rules/languages/typescript-patterns.mdc +128 -0
- package/rules/patterns/_index.mdc +185 -0
- package/rules/patterns/contract-patterns.mdc +344 -0
- package/rules/patterns/discovery-patterns.mdc +354 -0
- package/rules/patterns/discovery-templates.mdc +329 -0
- package/rules/patterns/jest-patterns.mdc +492 -0
- package/rules/patterns/plans-patterns.mdc +237 -0
- package/rules/patterns/plans-templates.mdc +237 -0
- package/rules/patterns/pytest-patterns.mdc +467 -0
- package/rules/patterns/review-code-templates.mdc +315 -0
- package/rules/patterns/review-pr-patterns.mdc +370 -0
- package/rules/skills/_index.mdc +174 -0
- package/rules/skills/create-contract-skill.mdc +239 -0
- package/rules/skills/create-plan-skill.mdc +271 -0
- package/rules/skills/discovery-skill.mdc +295 -0
- package/rules/skills/execute-plan-skill.mdc +388 -0
- package/rules/skills/review-code-skill.mdc +308 -0
- package/rules/skills/review-pr-skill.mdc +496 -0
- package/rules/skills/setup-skill.mdc +923 -0
- package/rules/skills/write-tests-skill.mdc +294 -0
- package/rules/templates/index-template.mdc +126 -0
- package/rules/tools/_index.mdc +114 -0
- package/rules/tools/auth-pr-tool.mdc +362 -0
- package/rules/tools/interactive-questions-tool.mdc +337 -0
- package/rules/tools/jest-testing-tool.mdc +96 -0
- package/rules/tools/plan-mode-tool.mdc +229 -0
- package/rules/tools/pytest-testing-tool.mdc +144 -0
- package/rules/tools/reference-expansion-tool.mdc +338 -0
- package/skills/plan-flow/SKILL.md +116 -0
- package/skills/plan-flow/create-contract/SKILL.md +139 -0
- package/skills/plan-flow/create-plan/SKILL.md +93 -0
- package/skills/plan-flow/discovery/SKILL.md +85 -0
- package/skills/plan-flow/execute-plan/SKILL.md +89 -0
- package/skills/plan-flow/ledger/SKILL.md +70 -0
- package/skills/plan-flow/review-code/SKILL.md +100 -0
- package/skills/plan-flow/review-pr/SKILL.md +122 -0
- package/skills/plan-flow/setup/SKILL.md +73 -0
- package/skills/plan-flow/write-tests/SKILL.md +115 -0
- package/templates/shared/AGENTS.md.template +65 -0
- package/templates/shared/CLAUDE.md.template +67 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: discovery
|
|
3
|
+
description: Create a discovery document to gather and clarify requirements
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Discovery
|
|
9
|
+
|
|
10
|
+
Create a discovery document for gathering and clarifying requirements before creating an implementation plan.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Gathers functional and non-functional requirements
|
|
15
|
+
2. Documents constraints and dependencies
|
|
16
|
+
3. Identifies open questions that need answers
|
|
17
|
+
4. Proposes a high-level approach
|
|
18
|
+
5. Documents risks and unknowns
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/discovery <topic>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Arguments:**
|
|
27
|
+
- `topic` (required): The feature or topic to discover requirements for
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
|
|
31
|
+
Creates: `flow/discovery/discovery_<topic>_v<version>.md`
|
|
32
|
+
|
|
33
|
+
## Document Structure
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
# Discovery: [Topic]
|
|
37
|
+
|
|
38
|
+
## Context
|
|
39
|
+
Why this discovery is needed
|
|
40
|
+
|
|
41
|
+
## Requirements Gathered
|
|
42
|
+
### Functional Requirements
|
|
43
|
+
- [FR-1]: Description
|
|
44
|
+
|
|
45
|
+
### Non-Functional Requirements
|
|
46
|
+
- [NFR-1]: Description
|
|
47
|
+
|
|
48
|
+
### Constraints
|
|
49
|
+
- [C-1]: Description
|
|
50
|
+
|
|
51
|
+
## Open Questions
|
|
52
|
+
| # | Question | Status | Answer |
|
|
53
|
+
|---|----------|--------|--------|
|
|
54
|
+
| 1 | Question | Open | - |
|
|
55
|
+
|
|
56
|
+
## Technical Considerations
|
|
57
|
+
Architecture, dependencies, patterns
|
|
58
|
+
|
|
59
|
+
## Proposed Approach
|
|
60
|
+
High-level recommendation
|
|
61
|
+
|
|
62
|
+
## Risks and Unknowns
|
|
63
|
+
Identified risks with mitigation strategies
|
|
64
|
+
|
|
65
|
+
## Next Steps
|
|
66
|
+
Follow-up actions
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Example
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
/discovery user authentication with OAuth
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Creates:** `flow/discovery/discovery_user_authentication_with_oauth_v1.md`
|
|
76
|
+
|
|
77
|
+
## Critical Rules
|
|
78
|
+
|
|
79
|
+
- **No Code**: Discovery is for gathering requirements only. No implementation.
|
|
80
|
+
- **Ask Questions**: Use interactive questions to clarify unclear requirements.
|
|
81
|
+
- **Mark Assumptions**: Always explicitly mark assumptions for validation.
|
|
82
|
+
|
|
83
|
+
## Next Command
|
|
84
|
+
|
|
85
|
+
After discovery, run `/create-plan @flow/discovery/discovery_<topic>_v1.md` to create an implementation plan.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execute-plan
|
|
3
|
+
description: Execute phases from an implementation plan
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Execute Plan
|
|
9
|
+
|
|
10
|
+
Execute phases from an implementation plan, following complexity-based grouping.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Reads the plan file and identifies phases
|
|
15
|
+
2. Groups phases based on complexity scores
|
|
16
|
+
3. Presents phase details before implementation
|
|
17
|
+
4. Implements each phase following project patterns
|
|
18
|
+
5. Marks tasks as complete
|
|
19
|
+
6. Runs build verification
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/execute-plan <plan_file> [phase]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Arguments:**
|
|
28
|
+
- `plan_file` (required): Path to the plan file
|
|
29
|
+
- `phase` (optional): Phase number, range, or "next". Default: next incomplete phase
|
|
30
|
+
|
|
31
|
+
**Phase Options:**
|
|
32
|
+
- `1` - Execute phase 1
|
|
33
|
+
- `1-3` - Execute phases 1 through 3
|
|
34
|
+
- `next` - Execute next incomplete phase
|
|
35
|
+
- `all` - Execute all remaining phases
|
|
36
|
+
|
|
37
|
+
## Execution Strategy
|
|
38
|
+
|
|
39
|
+
Based on combined complexity scores:
|
|
40
|
+
|
|
41
|
+
| Combined Score | Strategy |
|
|
42
|
+
|----------------|----------|
|
|
43
|
+
| ≤ 6 | **Aggregate**: Execute multiple phases together |
|
|
44
|
+
| 7-10 | **Cautious**: Execute 1-2 phases, then verify |
|
|
45
|
+
| > 10 | **Sequential**: Execute one phase at a time |
|
|
46
|
+
|
|
47
|
+
## Phase Execution Flow
|
|
48
|
+
|
|
49
|
+
For each phase:
|
|
50
|
+
|
|
51
|
+
1. **Present**: Show phase details and approach
|
|
52
|
+
2. **Implement**: Write code following project patterns
|
|
53
|
+
3. **Update**: Mark tasks complete in plan file
|
|
54
|
+
4. **Verify**: Run build verification
|
|
55
|
+
|
|
56
|
+
## Example
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
/execute-plan @flow/plans/plan_user_auth_v1.md phase:1
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Output:**
|
|
63
|
+
```
|
|
64
|
+
Executing Phase 1: Types and Schemas
|
|
65
|
+
Complexity: 3/10
|
|
66
|
+
|
|
67
|
+
Tasks:
|
|
68
|
+
- [ ] Create User type definitions
|
|
69
|
+
- [ ] Create Zod validation schemas
|
|
70
|
+
|
|
71
|
+
Implementing...
|
|
72
|
+
|
|
73
|
+
✓ Phase 1 Complete
|
|
74
|
+
- Created src/types/user.ts
|
|
75
|
+
- Created src/schemas/user.ts
|
|
76
|
+
|
|
77
|
+
Build verification: npm run build ✓
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Critical Rules
|
|
81
|
+
|
|
82
|
+
- **Follow Patterns**: Always follow existing project patterns
|
|
83
|
+
- **Build After Each Phase**: Verify build passes before proceeding
|
|
84
|
+
- **Update Plan**: Mark completed tasks in the plan file
|
|
85
|
+
- **Tests Last**: Execute test phase only after all other phases complete
|
|
86
|
+
|
|
87
|
+
## Next Command
|
|
88
|
+
|
|
89
|
+
After executing all phases, run `/review-code` to review your changes before committing.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ledger
|
|
3
|
+
description: Persistent project learning journal that builds institutional memory across sessions
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Project Ledger
|
|
9
|
+
|
|
10
|
+
A persistent, project-specific learning journal maintained across sessions. Captures mistakes, corrections, discovered patterns, and hard-won knowledge about a specific codebase.
|
|
11
|
+
|
|
12
|
+
## How It Works
|
|
13
|
+
|
|
14
|
+
The ledger operates silently in the background:
|
|
15
|
+
|
|
16
|
+
1. **Session Start**: Read `flow/ledger.md` and apply learnings
|
|
17
|
+
2. **During Work**: Record new learnings as they happen
|
|
18
|
+
3. **Maintenance**: Periodically consolidate and prune entries
|
|
19
|
+
|
|
20
|
+
## File Location
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
flow/ledger.md
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## What Gets Recorded
|
|
27
|
+
|
|
28
|
+
- Project-specific quirks and gotchas
|
|
29
|
+
- Approaches that worked or didn't work
|
|
30
|
+
- User preferences beyond documented rules
|
|
31
|
+
- Domain context and business logic
|
|
32
|
+
- Environment and toolchain surprises
|
|
33
|
+
- Self-corrections and mistakes made
|
|
34
|
+
|
|
35
|
+
## What Doesn't Get Recorded
|
|
36
|
+
|
|
37
|
+
- Generic programming knowledge
|
|
38
|
+
- Patterns already in rules files
|
|
39
|
+
- Temporary one-off issues
|
|
40
|
+
- Content that belongs in discovery docs or plans
|
|
41
|
+
|
|
42
|
+
## Entry Style
|
|
43
|
+
|
|
44
|
+
Write lessons, not logs. Each entry should be concise and actionable.
|
|
45
|
+
|
|
46
|
+
**Examples:**
|
|
47
|
+
- "The `buildWidgets` script requires Node 18+ - fails silently on Node 16"
|
|
48
|
+
- "User prefers explicit error types over generic Error class"
|
|
49
|
+
- "Tests for streaming endpoints need a 3s timeout override"
|
|
50
|
+
|
|
51
|
+
## Sections
|
|
52
|
+
|
|
53
|
+
| Section | Purpose |
|
|
54
|
+
|---------|---------|
|
|
55
|
+
| Project Quirks | Surprising behaviors, undocumented constraints |
|
|
56
|
+
| What Works | Proven approaches for this project |
|
|
57
|
+
| What Didn't Work | Failed approaches with reasoning |
|
|
58
|
+
| User Preferences | How the user likes things done |
|
|
59
|
+
| Domain Context | Business logic and terminology |
|
|
60
|
+
|
|
61
|
+
## Maintenance
|
|
62
|
+
|
|
63
|
+
- Keep under 150 lines of high-signal content
|
|
64
|
+
- Consolidate every 8-10 sessions
|
|
65
|
+
- Remove stale entries when quirks get fixed
|
|
66
|
+
- Promote established patterns to rules files
|
|
67
|
+
|
|
68
|
+
## Integration
|
|
69
|
+
|
|
70
|
+
Learnings are naturally captured from all plan-flow activities (setup, discovery, execution, reviews). The ledger captures meta-learnings that span across individual artifacts.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-code
|
|
3
|
+
description: Review local uncommitted code changes
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Review Code
|
|
9
|
+
|
|
10
|
+
Review local uncommitted changes in the repository.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Gets git diff of changes (staged, unstaged, or all)
|
|
15
|
+
2. Identifies changed files and their patterns
|
|
16
|
+
3. Finds similar implementations in the codebase
|
|
17
|
+
4. Reviews against project patterns and rules
|
|
18
|
+
5. Provides findings with severity and fix suggestions
|
|
19
|
+
6. Generates a review document
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/review-code [path] [scope]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Arguments:**
|
|
28
|
+
- `path` (optional): Specific file or directory to review
|
|
29
|
+
- `scope` (optional): `staged`, `unstaged`, or `all` (default: all)
|
|
30
|
+
|
|
31
|
+
## Output
|
|
32
|
+
|
|
33
|
+
Creates: `flow/reviewed-code/review_<scope>.md`
|
|
34
|
+
|
|
35
|
+
## Review Categories
|
|
36
|
+
|
|
37
|
+
| Severity | Description | Action Required |
|
|
38
|
+
|----------|-------------|-----------------|
|
|
39
|
+
| Critical | Security issues, major bugs | Must fix before commit |
|
|
40
|
+
| Major | Significant problems | Should fix |
|
|
41
|
+
| Minor | Code quality issues | Consider fixing |
|
|
42
|
+
| Suggestion | Improvements | Optional |
|
|
43
|
+
|
|
44
|
+
## Review Document Structure
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
# Code Review: [Scope]
|
|
48
|
+
|
|
49
|
+
## Review Information
|
|
50
|
+
| Field | Value |
|
|
51
|
+
|-------|-------|
|
|
52
|
+
| Date | YYYY-MM-DD |
|
|
53
|
+
| Files Reviewed | N |
|
|
54
|
+
| Scope | all/staged/unstaged |
|
|
55
|
+
|
|
56
|
+
## Changed Files
|
|
57
|
+
| File | Status | Lines Changed |
|
|
58
|
+
|------|--------|---------------|
|
|
59
|
+
| path/to/file | modified | +10/-5 |
|
|
60
|
+
|
|
61
|
+
## Findings
|
|
62
|
+
|
|
63
|
+
### Finding 1: [Name]
|
|
64
|
+
| Field | Value |
|
|
65
|
+
|-------|-------|
|
|
66
|
+
| File | path/to/file |
|
|
67
|
+
| Line | 42 |
|
|
68
|
+
| Severity | Major |
|
|
69
|
+
| Fix Complexity | 3/10 |
|
|
70
|
+
|
|
71
|
+
**Description**: What's wrong
|
|
72
|
+
**Suggested Fix**: How to fix it
|
|
73
|
+
|
|
74
|
+
## Commit Readiness
|
|
75
|
+
| Status | Ready to Commit / Needs Changes |
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Example
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
/review-code
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Scoped review:**
|
|
85
|
+
```
|
|
86
|
+
/review-code src/components staged
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## What It Checks
|
|
90
|
+
|
|
91
|
+
- Pattern consistency with existing codebase
|
|
92
|
+
- Error handling completeness
|
|
93
|
+
- Type safety (for TypeScript)
|
|
94
|
+
- Security concerns (hardcoded secrets, injection risks)
|
|
95
|
+
- Performance considerations
|
|
96
|
+
- Code organization and naming
|
|
97
|
+
|
|
98
|
+
## Next Command
|
|
99
|
+
|
|
100
|
+
After fixing issues, commit your changes or run `/review-pr` after creating a PR.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: Review a Pull Request
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git","gh"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Review PR
|
|
9
|
+
|
|
10
|
+
Review a Pull Request by its number using the GitHub CLI.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Fetches PR information using `gh pr view`
|
|
15
|
+
2. Gets PR diff using `gh pr diff`
|
|
16
|
+
3. Analyzes changes against project patterns
|
|
17
|
+
4. Checks for security and performance issues
|
|
18
|
+
5. Provides detailed findings and recommendations
|
|
19
|
+
6. Generates a review document
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
/review-pr <pr_number>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Arguments:**
|
|
28
|
+
- `pr_number` (required): The PR number to review
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
|
|
32
|
+
- `gh` CLI must be installed and authenticated
|
|
33
|
+
- Run `gh auth login` if not authenticated
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
|
|
37
|
+
Creates: `flow/reviewed-pr/pr_<number>.md`
|
|
38
|
+
|
|
39
|
+
## Review Focus Areas
|
|
40
|
+
|
|
41
|
+
| Area | What's Checked |
|
|
42
|
+
|------|----------------|
|
|
43
|
+
| Code Quality | Pattern consistency, naming, organization |
|
|
44
|
+
| Security | Secrets, injection, authentication |
|
|
45
|
+
| Performance | N+1 queries, unnecessary loops, caching |
|
|
46
|
+
| Testing | Test coverage, edge cases |
|
|
47
|
+
| Documentation | Comments, README updates |
|
|
48
|
+
|
|
49
|
+
## Review Document Structure
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
# PR Review: #<number>
|
|
53
|
+
|
|
54
|
+
## PR Information
|
|
55
|
+
| Field | Value |
|
|
56
|
+
|-------|-------|
|
|
57
|
+
| Title | PR title |
|
|
58
|
+
| Author | username |
|
|
59
|
+
| Branch | feature -> main |
|
|
60
|
+
| Files Changed | N |
|
|
61
|
+
|
|
62
|
+
## Summary
|
|
63
|
+
What this PR does
|
|
64
|
+
|
|
65
|
+
## Findings
|
|
66
|
+
|
|
67
|
+
### Finding 1: [Name]
|
|
68
|
+
| Field | Value |
|
|
69
|
+
|-------|-------|
|
|
70
|
+
| File | path/to/file |
|
|
71
|
+
| Severity | Major |
|
|
72
|
+
|
|
73
|
+
**Description**: What's wrong
|
|
74
|
+
**Suggested Fix**: How to fix it
|
|
75
|
+
|
|
76
|
+
## Security Considerations
|
|
77
|
+
Any security concerns
|
|
78
|
+
|
|
79
|
+
## Performance Considerations
|
|
80
|
+
Any performance concerns
|
|
81
|
+
|
|
82
|
+
## Recommendation
|
|
83
|
+
| Status | Approve / Request Changes / Comment |
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
/review-pr 123
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Output:**
|
|
93
|
+
```
|
|
94
|
+
Reviewing PR #123...
|
|
95
|
+
|
|
96
|
+
Fetching PR information...
|
|
97
|
+
Fetching PR diff...
|
|
98
|
+
Analyzing changes...
|
|
99
|
+
|
|
100
|
+
PR #123 Review Complete!
|
|
101
|
+
|
|
102
|
+
Summary: Adds user authentication with OAuth
|
|
103
|
+
Files Changed: 12
|
|
104
|
+
Findings: 2 Major, 3 Minor
|
|
105
|
+
|
|
106
|
+
Review saved to: flow/reviewed-pr/pr_123.md
|
|
107
|
+
|
|
108
|
+
Recommendation: Request Changes
|
|
109
|
+
- Fix the 2 major issues before merging
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Authentication
|
|
113
|
+
|
|
114
|
+
If you get authentication errors:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Authenticate with GitHub
|
|
118
|
+
gh auth login
|
|
119
|
+
|
|
120
|
+
# Verify authentication
|
|
121
|
+
gh auth status
|
|
122
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup
|
|
3
|
+
description: Analyze project structure and create Plan-Flow configuration
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Setup
|
|
9
|
+
|
|
10
|
+
Analyze the current repository and generate Plan-Flow configuration files.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Scans project structure to detect languages and frameworks
|
|
15
|
+
2. Creates the `flow/` directory structure
|
|
16
|
+
3. Identifies existing patterns in the codebase
|
|
17
|
+
4. Generates initial configuration
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
/setup [path]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Arguments:**
|
|
26
|
+
- `path` (optional): Directory to analyze. Defaults to current directory.
|
|
27
|
+
|
|
28
|
+
## Output
|
|
29
|
+
|
|
30
|
+
Creates the following structure:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
flow/
|
|
34
|
+
├── archive/ # Completed/abandoned plans
|
|
35
|
+
├── contracts/ # Integration contracts
|
|
36
|
+
├── discovery/ # Discovery documents
|
|
37
|
+
├── plans/ # Active implementation plans
|
|
38
|
+
├── references/ # Reference materials
|
|
39
|
+
├── reviewed-code/ # Code review documents
|
|
40
|
+
└── reviewed-pr/ # PR review documents
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
/setup
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Output:**
|
|
50
|
+
```
|
|
51
|
+
Setup Complete!
|
|
52
|
+
|
|
53
|
+
Analyzed: /path/to/project
|
|
54
|
+
Files found: 156
|
|
55
|
+
Languages detected: TypeScript, JavaScript
|
|
56
|
+
Frameworks detected: Next.js, Jest
|
|
57
|
+
|
|
58
|
+
Created Directories:
|
|
59
|
+
- flow/discovery/
|
|
60
|
+
- flow/plans/
|
|
61
|
+
- flow/contracts/
|
|
62
|
+
- flow/references/
|
|
63
|
+
- flow/archive/
|
|
64
|
+
|
|
65
|
+
Next Steps:
|
|
66
|
+
1. Create .plan-flow.yml with your AI API key
|
|
67
|
+
2. Run /discovery to gather requirements for a feature
|
|
68
|
+
3. Run /create-plan to create an implementation plan
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Next Command
|
|
72
|
+
|
|
73
|
+
After setup, run `/discovery` to start gathering requirements for a new feature.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-tests
|
|
3
|
+
description: Generate tests to achieve coverage targets
|
|
4
|
+
metadata: {"openclaw":{"requires":{"bins":["git"]}}}
|
|
5
|
+
user-invocable: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Write Tests
|
|
9
|
+
|
|
10
|
+
Generate tests for specified code to achieve coverage targets.
|
|
11
|
+
|
|
12
|
+
## What It Does
|
|
13
|
+
|
|
14
|
+
1. Reads the target file(s)
|
|
15
|
+
2. Analyzes functions and classes to test
|
|
16
|
+
3. Identifies edge cases and error scenarios
|
|
17
|
+
4. Generates comprehensive test file(s)
|
|
18
|
+
5. Follows project testing patterns
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/write-tests <path> [coverage]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Arguments:**
|
|
27
|
+
- `path` (required): File or directory to generate tests for
|
|
28
|
+
- `coverage` (optional): Target coverage percentage (default: 80)
|
|
29
|
+
|
|
30
|
+
## Output
|
|
31
|
+
|
|
32
|
+
Creates test files following project conventions:
|
|
33
|
+
- `*.test.ts` for TypeScript
|
|
34
|
+
- `*.test.js` for JavaScript
|
|
35
|
+
- `test_*.py` for Python
|
|
36
|
+
|
|
37
|
+
## Test Coverage
|
|
38
|
+
|
|
39
|
+
| Coverage | Description |
|
|
40
|
+
|----------|-------------|
|
|
41
|
+
| 80% | Standard target (default) |
|
|
42
|
+
| 90% | High coverage for critical code |
|
|
43
|
+
| 100% | Complete coverage (edge cases included) |
|
|
44
|
+
|
|
45
|
+
## What Gets Tested
|
|
46
|
+
|
|
47
|
+
- **Exported Functions**: All public functions
|
|
48
|
+
- **Classes**: Constructor, public methods
|
|
49
|
+
- **Edge Cases**: Null, undefined, empty, boundary values
|
|
50
|
+
- **Error Scenarios**: Exception handling, validation errors
|
|
51
|
+
- **Async Code**: Promise resolution/rejection
|
|
52
|
+
|
|
53
|
+
## Test Structure (TypeScript/Jest)
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
describe('FunctionName', () => {
|
|
57
|
+
beforeEach(() => {
|
|
58
|
+
// Setup
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should handle normal input', () => {
|
|
62
|
+
// Arrange
|
|
63
|
+
// Act
|
|
64
|
+
// Assert
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should handle edge case', () => {
|
|
68
|
+
// Test edge case
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should throw error for invalid input', () => {
|
|
72
|
+
expect(() => fn(invalid)).toThrow();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Example
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
/write-tests src/utils/validator.ts 90
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Output:**
|
|
84
|
+
```
|
|
85
|
+
Generating tests for src/utils/validator.ts
|
|
86
|
+
Target coverage: 90%
|
|
87
|
+
|
|
88
|
+
Analyzing functions:
|
|
89
|
+
- validateEmail() - 3 test cases
|
|
90
|
+
- validatePassword() - 5 test cases
|
|
91
|
+
- validateUsername() - 4 test cases
|
|
92
|
+
|
|
93
|
+
Generated: src/utils/validator.test.ts
|
|
94
|
+
|
|
95
|
+
Test Summary:
|
|
96
|
+
- 12 test cases generated
|
|
97
|
+
- Estimated coverage: 92%
|
|
98
|
+
|
|
99
|
+
Run tests with: npm run test src/utils/validator.test.ts
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Test Patterns
|
|
103
|
+
|
|
104
|
+
The skill follows testing patterns from your project:
|
|
105
|
+
|
|
106
|
+
- **Jest** for JavaScript/TypeScript
|
|
107
|
+
- **Pytest** for Python
|
|
108
|
+
- Uses existing mock factories if available
|
|
109
|
+
- Follows AAA pattern (Arrange, Act, Assert)
|
|
110
|
+
|
|
111
|
+
## Next Command
|
|
112
|
+
|
|
113
|
+
After generating tests, run them with your test runner:
|
|
114
|
+
- `npm run test` for Jest
|
|
115
|
+
- `pytest` for Python
|