@crewpilot/agent 2.0.0 → 3.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/README.md +131 -131
- package/dist-npm/cli.js +5 -5
- package/dist-npm/index.js +100 -100
- package/package.json +69 -69
- package/prompts/agent.md +282 -282
- package/prompts/copilot-instructions.md +36 -36
- package/prompts/{catalyst.config.json → crewpilot.config.json} +72 -72
- package/prompts/skills/assure-code-quality/SKILL.md +112 -112
- package/prompts/skills/assure-pr-intelligence/SKILL.md +148 -148
- package/prompts/skills/assure-review-functional/SKILL.md +114 -114
- package/prompts/skills/assure-review-standards/SKILL.md +106 -106
- package/prompts/skills/assure-threat-model/SKILL.md +182 -182
- package/prompts/skills/assure-vulnerability-scan/SKILL.md +146 -146
- package/prompts/skills/autopilot-meeting/SKILL.md +434 -434
- package/prompts/skills/autopilot-worker/SKILL.md +737 -737
- package/prompts/skills/daily-digest/SKILL.md +188 -188
- package/prompts/skills/deliver-change-management/SKILL.md +132 -132
- package/prompts/skills/deliver-deploy-guard/SKILL.md +144 -144
- package/prompts/skills/deliver-doc-governance/SKILL.md +130 -130
- package/prompts/skills/engineer-feature-builder/SKILL.md +270 -270
- package/prompts/skills/engineer-root-cause-analysis/SKILL.md +150 -150
- package/prompts/skills/engineer-test-first/SKILL.md +148 -148
- package/prompts/skills/insights-knowledge-base/SKILL.md +202 -202
- package/prompts/skills/insights-pattern-detection/SKILL.md +142 -142
- package/prompts/skills/strategize-architecture-planner/SKILL.md +141 -141
- package/prompts/skills/strategize-solution-design/SKILL.md +118 -118
- package/scripts/postinstall.js +108 -108
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
# PR Intelligence
|
|
2
|
-
|
|
3
|
-
> **Pillar**: Assure | **ID**: `assure-pr-intelligence`
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
Automated pull request analysis — generates structured summaries, risk assessments, reviewer guidance, and change impact analysis. Turns PRs from walls of diff into clear narratives.
|
|
8
|
-
|
|
9
|
-
## Activation Triggers
|
|
10
|
-
|
|
11
|
-
- "review this PR", "summarize PR", "PR summary", "pull request review"
|
|
12
|
-
- "what changed in this PR", "is this PR safe to merge"
|
|
13
|
-
- When a PR URL or branch diff is provided
|
|
14
|
-
|
|
15
|
-
## Methodology
|
|
16
|
-
|
|
17
|
-
### Process Flow
|
|
18
|
-
|
|
19
|
-
```dot
|
|
20
|
-
digraph pr_intelligence {
|
|
21
|
-
rankdir=LR;
|
|
22
|
-
node [shape=box];
|
|
23
|
-
|
|
24
|
-
inventory [label="Phase 1\nChange Inventory"];
|
|
25
|
-
narrative [label="Phase 2\nNarrative Summary"];
|
|
26
|
-
risk [label="Phase 3\nRisk Assessment"];
|
|
27
|
-
guidance [label="Phase 4\nReviewer Guidance"];
|
|
28
|
-
checklist [label="Phase 5\nMerge Readiness", shape=doublecircle];
|
|
29
|
-
|
|
30
|
-
inventory -> narrative;
|
|
31
|
-
narrative -> risk;
|
|
32
|
-
risk -> guidance;
|
|
33
|
-
guidance -> checklist;
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Phase 0 — Acceptance Criteria Verification
|
|
38
|
-
1. Fetch the linked issue/task (via `
|
|
39
|
-
2. Extract the acceptance criteria checklist from the issue description
|
|
40
|
-
3. For each criterion, verify whether the PR's changes satisfy it:
|
|
41
|
-
- **Met** — Code changes clearly implement the criterion
|
|
42
|
-
- **Partially met** — Some work done but incomplete
|
|
43
|
-
- **Not met** — No evidence of this criterion in the diff
|
|
44
|
-
4. Any **Not met** criteria are automatic blockers — the PR cannot be approved
|
|
45
|
-
5. Include the acceptance criteria verdict in the output:
|
|
46
|
-
```
|
|
47
|
-
### Acceptance Criteria
|
|
48
|
-
- [x] Criterion 1 — Met (implemented in file.py)
|
|
49
|
-
- [ ] Criterion 2 — Not met (missing from PR)
|
|
50
|
-
- [~] Criterion 3 — Partially met (needs X)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Phase 1 — Change Inventory
|
|
54
|
-
1. Get the diff (via git or GitHub API)
|
|
55
|
-
2. Categorize files changed:
|
|
56
|
-
- `core` — Business logic, domain models
|
|
57
|
-
- `api` — Endpoint changes, route modifications
|
|
58
|
-
- `infra` — CI/CD, Dockerfiles, IaC
|
|
59
|
-
- `test` — Test files
|
|
60
|
-
- `config` — Configuration, env vars
|
|
61
|
-
- `docs` — Documentation
|
|
62
|
-
3. Calculate change metrics: files changed, lines added/removed, churn
|
|
63
|
-
4. Identify new vs. modified vs. deleted files
|
|
64
|
-
|
|
65
|
-
### Phase 2 — Narrative Summary
|
|
66
|
-
Generate a human-readable summary:
|
|
67
|
-
1. **What**: One paragraph explaining what the PR accomplishes
|
|
68
|
-
2. **Why**: Inferred motivation (from commit messages, PR description, code context)
|
|
69
|
-
3. **How**: Key implementation decisions and patterns used
|
|
70
|
-
|
|
71
|
-
### Phase 3 — Risk Assessment
|
|
72
|
-
Evaluate each risk dimension:
|
|
73
|
-
|
|
74
|
-
| Dimension | Low | Medium | High |
|
|
75
|
-
|---|---|---|---|
|
|
76
|
-
| **Scope** | < 50 lines, 1-2 files | 50-200 lines, 3-5 files | > 200 lines or > 5 files |
|
|
77
|
-
| **Complexity** | Simple refactors | New logic paths | Algorithm/architecture changes |
|
|
78
|
-
| **Blast radius** | Isolated module | Shared utilities | Core framework, DB schema |
|
|
79
|
-
| **Test coverage** | Well-tested changes | Partial coverage | No tests for new code |
|
|
80
|
-
| **Reversibility** | Feature flag or easy revert | Rollback possible | DB migration, API contract |
|
|
81
|
-
|
|
82
|
-
Produce overall risk score: **Low / Medium / High / Critical**
|
|
83
|
-
|
|
84
|
-
### Phase 4 — Reviewer Guidance
|
|
85
|
-
1. List files to review first (highest risk → lowest)
|
|
86
|
-
2. Call out specific lines that need careful attention
|
|
87
|
-
3. Suggest questions the reviewer should ask
|
|
88
|
-
4. Identify what's NOT in the PR that probably should be (missing tests, missing docs, missing migration)
|
|
89
|
-
|
|
90
|
-
### Phase 5 — Merge Readiness Checklist
|
|
91
|
-
- [ ] Tests pass / test coverage adequate
|
|
92
|
-
- [ ] No security findings above medium
|
|
93
|
-
- [ ] Breaking changes documented
|
|
94
|
-
- [ ] PR description matches actual changes
|
|
95
|
-
- [ ] Dependencies updated safely
|
|
96
|
-
|
|
97
|
-
## Tools Required
|
|
98
|
-
|
|
99
|
-
- `githubRepo` — Fetch PR details, diff, commit history
|
|
100
|
-
- `codebase` — Understand impacted areas in the broader codebase
|
|
101
|
-
- `
|
|
102
|
-
- `
|
|
103
|
-
|
|
104
|
-
## Output Format
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
## [
|
|
108
|
-
|
|
109
|
-
### Summary
|
|
110
|
-
**What**: {one paragraph}
|
|
111
|
-
**Why**: {motivation}
|
|
112
|
-
**How**: {key decisions}
|
|
113
|
-
|
|
114
|
-
### Change Inventory
|
|
115
|
-
| Category | Files | Lines (+/-) |
|
|
116
|
-
|---|---|---|
|
|
117
|
-
| core | | |
|
|
118
|
-
| test | | |
|
|
119
|
-
| ... | | |
|
|
120
|
-
|
|
121
|
-
### Risk Assessment: {Low/Medium/High/Critical}
|
|
122
|
-
{risk table with evaluations}
|
|
123
|
-
|
|
124
|
-
### Review Guide
|
|
125
|
-
**Start with**: {ordered file list}
|
|
126
|
-
**Pay attention to**:
|
|
127
|
-
- {file}:{line} — {why}
|
|
128
|
-
- ...
|
|
129
|
-
|
|
130
|
-
**Missing from PR**:
|
|
131
|
-
- {what's absent}
|
|
132
|
-
|
|
133
|
-
### Merge Readiness
|
|
134
|
-
{checklist with status}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## Chains To
|
|
138
|
-
|
|
139
|
-
- `code-quality` — Deep review of flagged files
|
|
140
|
-
- `vulnerability-scan` — If risk assessment flags security-adjacent changes
|
|
141
|
-
- `change-management` — Verify commit message quality
|
|
142
|
-
|
|
143
|
-
## Anti-Patterns
|
|
144
|
-
|
|
145
|
-
- Do NOT rubber-stamp — always identify at least one concern or question
|
|
146
|
-
- Do NOT summarize the diff line-by-line — synthesize into a narrative
|
|
147
|
-
- Do NOT skip risk assessment for "small" PRs — small and dangerous is common
|
|
148
|
-
- Do NOT ignore test absence — explicitly call it out
|
|
1
|
+
# PR Intelligence
|
|
2
|
+
|
|
3
|
+
> **Pillar**: Assure | **ID**: `assure-pr-intelligence`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Automated pull request analysis — generates structured summaries, risk assessments, reviewer guidance, and change impact analysis. Turns PRs from walls of diff into clear narratives.
|
|
8
|
+
|
|
9
|
+
## Activation Triggers
|
|
10
|
+
|
|
11
|
+
- "review this PR", "summarize PR", "PR summary", "pull request review"
|
|
12
|
+
- "what changed in this PR", "is this PR safe to merge"
|
|
13
|
+
- When a PR URL or branch diff is provided
|
|
14
|
+
|
|
15
|
+
## Methodology
|
|
16
|
+
|
|
17
|
+
### Process Flow
|
|
18
|
+
|
|
19
|
+
```dot
|
|
20
|
+
digraph pr_intelligence {
|
|
21
|
+
rankdir=LR;
|
|
22
|
+
node [shape=box];
|
|
23
|
+
|
|
24
|
+
inventory [label="Phase 1\nChange Inventory"];
|
|
25
|
+
narrative [label="Phase 2\nNarrative Summary"];
|
|
26
|
+
risk [label="Phase 3\nRisk Assessment"];
|
|
27
|
+
guidance [label="Phase 4\nReviewer Guidance"];
|
|
28
|
+
checklist [label="Phase 5\nMerge Readiness", shape=doublecircle];
|
|
29
|
+
|
|
30
|
+
inventory -> narrative;
|
|
31
|
+
narrative -> risk;
|
|
32
|
+
risk -> guidance;
|
|
33
|
+
guidance -> checklist;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Phase 0 — Acceptance Criteria Verification
|
|
38
|
+
1. Fetch the linked issue/task (via `crewpilot_board_get` or the PR description's `Closes #N`)
|
|
39
|
+
2. Extract the acceptance criteria checklist from the issue description
|
|
40
|
+
3. For each criterion, verify whether the PR's changes satisfy it:
|
|
41
|
+
- **Met** — Code changes clearly implement the criterion
|
|
42
|
+
- **Partially met** — Some work done but incomplete
|
|
43
|
+
- **Not met** — No evidence of this criterion in the diff
|
|
44
|
+
4. Any **Not met** criteria are automatic blockers — the PR cannot be approved
|
|
45
|
+
5. Include the acceptance criteria verdict in the output:
|
|
46
|
+
```
|
|
47
|
+
### Acceptance Criteria
|
|
48
|
+
- [x] Criterion 1 — Met (implemented in file.py)
|
|
49
|
+
- [ ] Criterion 2 — Not met (missing from PR)
|
|
50
|
+
- [~] Criterion 3 — Partially met (needs X)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Phase 1 — Change Inventory
|
|
54
|
+
1. Get the diff (via git or GitHub API)
|
|
55
|
+
2. Categorize files changed:
|
|
56
|
+
- `core` — Business logic, domain models
|
|
57
|
+
- `api` — Endpoint changes, route modifications
|
|
58
|
+
- `infra` — CI/CD, Dockerfiles, IaC
|
|
59
|
+
- `test` — Test files
|
|
60
|
+
- `config` — Configuration, env vars
|
|
61
|
+
- `docs` — Documentation
|
|
62
|
+
3. Calculate change metrics: files changed, lines added/removed, churn
|
|
63
|
+
4. Identify new vs. modified vs. deleted files
|
|
64
|
+
|
|
65
|
+
### Phase 2 — Narrative Summary
|
|
66
|
+
Generate a human-readable summary:
|
|
67
|
+
1. **What**: One paragraph explaining what the PR accomplishes
|
|
68
|
+
2. **Why**: Inferred motivation (from commit messages, PR description, code context)
|
|
69
|
+
3. **How**: Key implementation decisions and patterns used
|
|
70
|
+
|
|
71
|
+
### Phase 3 — Risk Assessment
|
|
72
|
+
Evaluate each risk dimension:
|
|
73
|
+
|
|
74
|
+
| Dimension | Low | Medium | High |
|
|
75
|
+
|---|---|---|---|
|
|
76
|
+
| **Scope** | < 50 lines, 1-2 files | 50-200 lines, 3-5 files | > 200 lines or > 5 files |
|
|
77
|
+
| **Complexity** | Simple refactors | New logic paths | Algorithm/architecture changes |
|
|
78
|
+
| **Blast radius** | Isolated module | Shared utilities | Core framework, DB schema |
|
|
79
|
+
| **Test coverage** | Well-tested changes | Partial coverage | No tests for new code |
|
|
80
|
+
| **Reversibility** | Feature flag or easy revert | Rollback possible | DB migration, API contract |
|
|
81
|
+
|
|
82
|
+
Produce overall risk score: **Low / Medium / High / Critical**
|
|
83
|
+
|
|
84
|
+
### Phase 4 — Reviewer Guidance
|
|
85
|
+
1. List files to review first (highest risk → lowest)
|
|
86
|
+
2. Call out specific lines that need careful attention
|
|
87
|
+
3. Suggest questions the reviewer should ask
|
|
88
|
+
4. Identify what's NOT in the PR that probably should be (missing tests, missing docs, missing migration)
|
|
89
|
+
|
|
90
|
+
### Phase 5 — Merge Readiness Checklist
|
|
91
|
+
- [ ] Tests pass / test coverage adequate
|
|
92
|
+
- [ ] No security findings above medium
|
|
93
|
+
- [ ] Breaking changes documented
|
|
94
|
+
- [ ] PR description matches actual changes
|
|
95
|
+
- [ ] Dependencies updated safely
|
|
96
|
+
|
|
97
|
+
## Tools Required
|
|
98
|
+
|
|
99
|
+
- `githubRepo` — Fetch PR details, diff, commit history
|
|
100
|
+
- `codebase` — Understand impacted areas in the broader codebase
|
|
101
|
+
- `crewpilot_git_diff` — Get precise diff data
|
|
102
|
+
- `crewpilot_git_log` — Understand commit narrative
|
|
103
|
+
|
|
104
|
+
## Output Format
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
## [CrewPilot → PR Intelligence]
|
|
108
|
+
|
|
109
|
+
### Summary
|
|
110
|
+
**What**: {one paragraph}
|
|
111
|
+
**Why**: {motivation}
|
|
112
|
+
**How**: {key decisions}
|
|
113
|
+
|
|
114
|
+
### Change Inventory
|
|
115
|
+
| Category | Files | Lines (+/-) |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| core | | |
|
|
118
|
+
| test | | |
|
|
119
|
+
| ... | | |
|
|
120
|
+
|
|
121
|
+
### Risk Assessment: {Low/Medium/High/Critical}
|
|
122
|
+
{risk table with evaluations}
|
|
123
|
+
|
|
124
|
+
### Review Guide
|
|
125
|
+
**Start with**: {ordered file list}
|
|
126
|
+
**Pay attention to**:
|
|
127
|
+
- {file}:{line} — {why}
|
|
128
|
+
- ...
|
|
129
|
+
|
|
130
|
+
**Missing from PR**:
|
|
131
|
+
- {what's absent}
|
|
132
|
+
|
|
133
|
+
### Merge Readiness
|
|
134
|
+
{checklist with status}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Chains To
|
|
138
|
+
|
|
139
|
+
- `code-quality` — Deep review of flagged files
|
|
140
|
+
- `vulnerability-scan` — If risk assessment flags security-adjacent changes
|
|
141
|
+
- `change-management` — Verify commit message quality
|
|
142
|
+
|
|
143
|
+
## Anti-Patterns
|
|
144
|
+
|
|
145
|
+
- Do NOT rubber-stamp — always identify at least one concern or question
|
|
146
|
+
- Do NOT summarize the diff line-by-line — synthesize into a narrative
|
|
147
|
+
- Do NOT skip risk assessment for "small" PRs — small and dangerous is common
|
|
148
|
+
- Do NOT ignore test absence — explicitly call it out
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
# Code Review — Functional
|
|
2
|
-
|
|
3
|
-
> **Pillar**: Assure | **ID**: `assure-review-functional`
|
|
4
|
-
|
|
5
|
-
## Purpose
|
|
6
|
-
|
|
7
|
-
Focused code review that evaluates **correctness, security, and performance** — the functional aspects that determine whether code works safely and efficiently. Separated from standards review so each can be delegated to a specialized subagent or run independently.
|
|
8
|
-
|
|
9
|
-
## Activation Triggers
|
|
10
|
-
|
|
11
|
-
- "functional review", "correctness review", "does this code work", "security review", "performance review"
|
|
12
|
-
- Automatically invoked by autopilot-worker Phase 6 via subagent delegation (role: `code-reviewer`)
|
|
13
|
-
- Can be run standalone for targeted reviews
|
|
14
|
-
|
|
15
|
-
## Methodology
|
|
16
|
-
|
|
17
|
-
### Pass 1 — Correctness
|
|
18
|
-
|
|
19
|
-
1. Trace the primary execution path against acceptance criteria
|
|
20
|
-
2. Identify logic errors, off-by-one, null/undefined risks, race conditions
|
|
21
|
-
3. Check edge cases: empty inputs, boundary values, error paths
|
|
22
|
-
4. Verify resource cleanup (connections, file handles, subscriptions)
|
|
23
|
-
5. Verify error handling: are errors caught, logged, and surfaced appropriately?
|
|
24
|
-
6. Confidence-gate: only report findings ≥ threshold
|
|
25
|
-
|
|
26
|
-
### Pass 2 — Security (OWASP Top 10 Quick Check)
|
|
27
|
-
|
|
28
|
-
1. **Injection** (A03): SQL, NoSQL, OS command, LDAP injection vectors
|
|
29
|
-
2. **Broken Auth** (A07): hardcoded credentials, weak session management
|
|
30
|
-
3. **Sensitive Data Exposure** (A02): secrets in code, unencrypted PII, overly broad API responses
|
|
31
|
-
4. **XSS** (A03): unescaped user input in HTML/templates
|
|
32
|
-
5. **Insecure Deserialization** (A08): untrusted JSON/YAML parsing without validation
|
|
33
|
-
6. **Broken Access Control** (A01): missing authorization checks, IDOR vulnerabilities
|
|
34
|
-
7. **Security Misconfiguration** (A05): debug mode in prod, overly permissive CORS, default credentials
|
|
35
|
-
8. Flag any `eval()`, `dangerouslySetInnerHTML`, `exec()`, or equivalent patterns
|
|
36
|
-
|
|
37
|
-
### Pass 3 — Performance
|
|
38
|
-
|
|
39
|
-
1. Identify O(n²) or worse patterns in hot paths
|
|
40
|
-
2. Flag await-in-loops and N+1 query patterns
|
|
41
|
-
3. Check for unnecessary allocations in loops
|
|
42
|
-
4. Look for missing caching opportunities on repeated computations
|
|
43
|
-
5. Identify blocking calls that could be async
|
|
44
|
-
6. Run `
|
|
45
|
-
|
|
46
|
-
### Pass 4 — Requirements Alignment (optional, requires Work IQ)
|
|
47
|
-
|
|
48
|
-
If M365 context is available (via prior `analysis` artifact or direct query), validate the code changes against stated requirements:
|
|
49
|
-
|
|
50
|
-
1. Read the `analysis` artifact from the workflow (if running as subagent with a `workflow_id`) to retrieve M365 requirements context
|
|
51
|
-
2. If no artifact exists but `mcp_workiq_ask_work_iq` is available, query: "What requirements and acceptance criteria were stated for {feature/issue title} in recent meetings and emails?"
|
|
52
|
-
3. For each stated requirement, check the code changes:
|
|
53
|
-
- **Implemented**: requirement is fully addressed by the code ✓
|
|
54
|
-
- **Partial**: requirement is partially addressed — note what's missing
|
|
55
|
-
- **Not addressed**: requirement has no corresponding implementation
|
|
56
|
-
4. Cross-reference acceptance criteria from the board issue against the actual behavior of the code
|
|
57
|
-
5. Flag any requirement gaps as `medium` severity findings
|
|
58
|
-
|
|
59
|
-
> **Note**: This pass is skipped if no M365 context is available and no board issue acceptance criteria exist. It does not block the review.
|
|
60
|
-
|
|
61
|
-
### Synthesis
|
|
62
|
-
|
|
63
|
-
1. Rank all findings by severity: `critical > high > medium > low`
|
|
64
|
-
2. Filter by `severity_floor` from config
|
|
65
|
-
3. Group by file/function
|
|
66
|
-
4. Provide specific fix suggestions with code snippets
|
|
67
|
-
5. If invoked as subagent, write output as artifact via `
|
|
68
|
-
|
|
69
|
-
## Tools Required
|
|
70
|
-
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
75
|
-
- `mcp_workiq_ask_work_iq` — (optional) Query M365 for stated requirements when no analysis artifact exists
|
|
76
|
-
|
|
77
|
-
## Output Format
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
## [
|
|
81
|
-
|
|
82
|
-
### Summary
|
|
83
|
-
{N} findings across {files}: {critical} critical, {high} high, {medium} medium
|
|
84
|
-
|
|
85
|
-
### Correctness
|
|
86
|
-
| Severity | File:Line | Issue | Suggested Fix |
|
|
87
|
-
|----------|-----------|-------|---------------|
|
|
88
|
-
| ... | ... | ... | ... |
|
|
89
|
-
|
|
90
|
-
### Security
|
|
91
|
-
| Severity | OWASP Cat | File:Line | Issue | Mitigation |
|
|
92
|
-
|----------|-----------|-----------|-------|------------|
|
|
93
|
-
| ... | ... | ... | ... | ... |
|
|
94
|
-
|
|
95
|
-
### Performance
|
|
96
|
-
| Severity | File:Line | Issue | Suggested Fix |
|
|
97
|
-
|----------|-----------|-------|---------------|
|
|
98
|
-
| ... | ... | ... | ... |
|
|
99
|
-
|
|
100
|
-
### Requirements Alignment (if M365 context available)
|
|
101
|
-
| Requirement | Status | Evidence | Gap |
|
|
102
|
-
|-------------|--------|----------|-----|
|
|
103
|
-
| ... | ✓/⚠️/❌ | ... | ... |
|
|
104
|
-
|
|
105
|
-
### Verdict
|
|
106
|
-
{PASS | PASS_WITH_WARNINGS | FAIL}
|
|
107
|
-
Confidence: {N}/10
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Chains To
|
|
111
|
-
|
|
112
|
-
- `assure-review-standards` — Companion skill for conventions/consistency review
|
|
113
|
-
- `assure-code-quality` — Full 4-pass review (superset of this skill)
|
|
114
|
-
- `assure-vulnerability-scan` — Deep security audit (more thorough than Pass 2 here)
|
|
1
|
+
# Code Review — Functional
|
|
2
|
+
|
|
3
|
+
> **Pillar**: Assure | **ID**: `assure-review-functional`
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Focused code review that evaluates **correctness, security, and performance** — the functional aspects that determine whether code works safely and efficiently. Separated from standards review so each can be delegated to a specialized subagent or run independently.
|
|
8
|
+
|
|
9
|
+
## Activation Triggers
|
|
10
|
+
|
|
11
|
+
- "functional review", "correctness review", "does this code work", "security review", "performance review"
|
|
12
|
+
- Automatically invoked by autopilot-worker Phase 6 via subagent delegation (role: `code-reviewer`)
|
|
13
|
+
- Can be run standalone for targeted reviews
|
|
14
|
+
|
|
15
|
+
## Methodology
|
|
16
|
+
|
|
17
|
+
### Pass 1 — Correctness
|
|
18
|
+
|
|
19
|
+
1. Trace the primary execution path against acceptance criteria
|
|
20
|
+
2. Identify logic errors, off-by-one, null/undefined risks, race conditions
|
|
21
|
+
3. Check edge cases: empty inputs, boundary values, error paths
|
|
22
|
+
4. Verify resource cleanup (connections, file handles, subscriptions)
|
|
23
|
+
5. Verify error handling: are errors caught, logged, and surfaced appropriately?
|
|
24
|
+
6. Confidence-gate: only report findings ≥ threshold
|
|
25
|
+
|
|
26
|
+
### Pass 2 — Security (OWASP Top 10 Quick Check)
|
|
27
|
+
|
|
28
|
+
1. **Injection** (A03): SQL, NoSQL, OS command, LDAP injection vectors
|
|
29
|
+
2. **Broken Auth** (A07): hardcoded credentials, weak session management
|
|
30
|
+
3. **Sensitive Data Exposure** (A02): secrets in code, unencrypted PII, overly broad API responses
|
|
31
|
+
4. **XSS** (A03): unescaped user input in HTML/templates
|
|
32
|
+
5. **Insecure Deserialization** (A08): untrusted JSON/YAML parsing without validation
|
|
33
|
+
6. **Broken Access Control** (A01): missing authorization checks, IDOR vulnerabilities
|
|
34
|
+
7. **Security Misconfiguration** (A05): debug mode in prod, overly permissive CORS, default credentials
|
|
35
|
+
8. Flag any `eval()`, `dangerouslySetInnerHTML`, `exec()`, or equivalent patterns
|
|
36
|
+
|
|
37
|
+
### Pass 3 — Performance
|
|
38
|
+
|
|
39
|
+
1. Identify O(n²) or worse patterns in hot paths
|
|
40
|
+
2. Flag await-in-loops and N+1 query patterns
|
|
41
|
+
3. Check for unnecessary allocations in loops
|
|
42
|
+
4. Look for missing caching opportunities on repeated computations
|
|
43
|
+
5. Identify blocking calls that could be async
|
|
44
|
+
6. Run `crewpilot_metrics_complexity` on changed files — flag functions above threshold
|
|
45
|
+
|
|
46
|
+
### Pass 4 — Requirements Alignment (optional, requires Work IQ)
|
|
47
|
+
|
|
48
|
+
If M365 context is available (via prior `analysis` artifact or direct query), validate the code changes against stated requirements:
|
|
49
|
+
|
|
50
|
+
1. Read the `analysis` artifact from the workflow (if running as subagent with a `workflow_id`) to retrieve M365 requirements context
|
|
51
|
+
2. If no artifact exists but `mcp_workiq_ask_work_iq` is available, query: "What requirements and acceptance criteria were stated for {feature/issue title} in recent meetings and emails?"
|
|
52
|
+
3. For each stated requirement, check the code changes:
|
|
53
|
+
- **Implemented**: requirement is fully addressed by the code ✓
|
|
54
|
+
- **Partial**: requirement is partially addressed — note what's missing
|
|
55
|
+
- **Not addressed**: requirement has no corresponding implementation
|
|
56
|
+
4. Cross-reference acceptance criteria from the board issue against the actual behavior of the code
|
|
57
|
+
5. Flag any requirement gaps as `medium` severity findings
|
|
58
|
+
|
|
59
|
+
> **Note**: This pass is skipped if no M365 context is available and no board issue acceptance criteria exist. It does not block the review.
|
|
60
|
+
|
|
61
|
+
### Synthesis
|
|
62
|
+
|
|
63
|
+
1. Rank all findings by severity: `critical > high > medium > low`
|
|
64
|
+
2. Filter by `severity_floor` from config
|
|
65
|
+
3. Group by file/function
|
|
66
|
+
4. Provide specific fix suggestions with code snippets
|
|
67
|
+
5. If invoked as subagent, write output as artifact via `crewpilot_artifact_write` (phase: `review-functional`)
|
|
68
|
+
|
|
69
|
+
## Tools Required
|
|
70
|
+
|
|
71
|
+
- `crewpilot_metrics_complexity` — Get cyclomatic/cognitive complexity scores
|
|
72
|
+
- `crewpilot_metrics_coverage` — Check test coverage for reviewed code
|
|
73
|
+
- `crewpilot_artifact_write` — Persist review findings as artifact (when run as subagent)
|
|
74
|
+
- `crewpilot_artifact_read` — Read prior analysis artifacts for context (includes M365 requirements context)
|
|
75
|
+
- `mcp_workiq_ask_work_iq` — (optional) Query M365 for stated requirements when no analysis artifact exists
|
|
76
|
+
|
|
77
|
+
## Output Format
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
## [CrewPilot → Functional Review]
|
|
81
|
+
|
|
82
|
+
### Summary
|
|
83
|
+
{N} findings across {files}: {critical} critical, {high} high, {medium} medium
|
|
84
|
+
|
|
85
|
+
### Correctness
|
|
86
|
+
| Severity | File:Line | Issue | Suggested Fix |
|
|
87
|
+
|----------|-----------|-------|---------------|
|
|
88
|
+
| ... | ... | ... | ... |
|
|
89
|
+
|
|
90
|
+
### Security
|
|
91
|
+
| Severity | OWASP Cat | File:Line | Issue | Mitigation |
|
|
92
|
+
|----------|-----------|-----------|-------|------------|
|
|
93
|
+
| ... | ... | ... | ... | ... |
|
|
94
|
+
|
|
95
|
+
### Performance
|
|
96
|
+
| Severity | File:Line | Issue | Suggested Fix |
|
|
97
|
+
|----------|-----------|-------|---------------|
|
|
98
|
+
| ... | ... | ... | ... |
|
|
99
|
+
|
|
100
|
+
### Requirements Alignment (if M365 context available)
|
|
101
|
+
| Requirement | Status | Evidence | Gap |
|
|
102
|
+
|-------------|--------|----------|-----|
|
|
103
|
+
| ... | ✓/⚠️/❌ | ... | ... |
|
|
104
|
+
|
|
105
|
+
### Verdict
|
|
106
|
+
{PASS | PASS_WITH_WARNINGS | FAIL}
|
|
107
|
+
Confidence: {N}/10
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Chains To
|
|
111
|
+
|
|
112
|
+
- `assure-review-standards` — Companion skill for conventions/consistency review
|
|
113
|
+
- `assure-code-quality` — Full 4-pass review (superset of this skill)
|
|
114
|
+
- `assure-vulnerability-scan` — Deep security audit (more thorough than Pass 2 here)
|