@pieerry/harness-kit 3.1.2 → 3.3.1
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/.hk-version +1 -0
- package/.claude/agents/product-manager.md +2 -2
- package/.claude/agents/staff-software-engineer.md +2 -2
- package/.claude/commands/pipeline/continue.md +8 -8
- package/.claude/commands/pipeline/reset.md +4 -4
- package/.claude/commands/product-manager/prd.md +4 -4
- package/.claude/commands/product-manager/prp.md +7 -7
- package/.claude/commands/product-manager/run.md +9 -5
- package/.claude/commands/sse/dev.md +18 -13
- package/.claude/commands/sse/plan.md +8 -8
- package/.claude/commands/sse/pr-monitor.md +56 -0
- package/.claude/commands/sse/pr.md +22 -12
- package/.claude/commands/sse/run.md +15 -8
- package/.claude/commands/sse/test.md +16 -10
- package/.claude/conventions/README.md +12 -0
- package/.claude/hooks/activity-pre-read.sh +18 -0
- package/.claude/hooks/pipeline-session-start.sh +26 -2
- package/.claude/hooks/status-line.sh +17 -1
- package/.claude/plugins/product-manager/evals/prd-quality.md +3 -3
- package/.claude/plugins/product-manager/evals/prd-readiness.md +1 -1
- package/.claude/plugins/product-manager/evals/prp-context-readiness.md +5 -5
- package/.claude/plugins/product-manager/evals/prp-quality.md +1 -1
- package/.claude/plugins/product-manager/guides/pipeline.md +14 -14
- package/.claude/plugins/product-manager/guides/prd-guidelines.md +4 -4
- package/.claude/plugins/product-manager/guides/product-guidelines.md +16 -16
- package/.claude/plugins/product-manager/guides/prp-guidelines.md +16 -16
- package/.claude/plugins/product-manager/guides/writing-style.md +9 -9
- package/.claude/plugins/product-manager/sensors/prd-acceptance-criteria.md +6 -6
- package/.claude/plugins/product-manager/sensors/prd-structure.md +2 -2
- package/.claude/plugins/product-manager/sensors/prp-context-quality.md +6 -6
- package/.claude/plugins/product-manager/sensors/prp-links.md +2 -2
- package/.claude/plugins/product-manager/sensors/prp-structure.md +1 -1
- package/.claude/plugins/staff-software-engineer/evals/dev-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/evals/plan-quality.md +6 -6
- package/.claude/plugins/staff-software-engineer/evals/pr-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/evals/test-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/guides/coding-style.md +7 -7
- package/.claude/plugins/staff-software-engineer/guides/commit-style.md +3 -3
- package/.claude/plugins/staff-software-engineer/guides/conventions-override.md +13 -13
- package/.claude/plugins/staff-software-engineer/guides/pipeline.md +19 -15
- package/.claude/plugins/staff-software-engineer/hooks/post-eval-sse.sh +65 -0
- package/.claude/plugins/staff-software-engineer/hooks/post-write-sse.sh +60 -0
- package/.claude/plugins/staff-software-engineer/sensors/code-conventions.md +4 -4
- package/.claude/plugins/staff-software-engineer/sensors/dev-structure.md +46 -0
- package/.claude/plugins/staff-software-engineer/sensors/pr-structure.md +49 -0
- package/.claude/plugins/staff-software-engineer/sensors/test-coverage.md +6 -6
- package/.claude/plugins/staff-software-engineer/sensors/test-structure.md +46 -0
- package/.claude/plugins/staff-software-engineer/skills/backend/SKILL.md +8 -8
- package/.claude/plugins/staff-software-engineer/skills/devops/SKILL.md +3 -3
- package/.claude/plugins/staff-software-engineer/skills/mobile/SKILL.md +3 -3
- package/.claude/plugins/staff-software-engineer/skills/web/SKILL.md +2 -2
- package/.claude/scripts/activity.py +68 -0
- package/.claude/scripts/pr-monitor.py +113 -0
- package/.claude/scripts/stage-card.md +37 -34
- package/.claude/settings.json +74 -0
- package/.claude/settings.local.json +13 -1
- package/CLAUDE.md +6 -0
- package/README.md +161 -61
- package/VERSION +1 -1
- package/bin/hk.js +6 -1
- package/package.json +1 -1
- package/setup/install.sh +16 -8
- package/.claude/plugins/staff-software-engineer/hooks/post-eval-plan.sh +0 -43
- package/.claude/plugins/staff-software-engineer/hooks/post-write-plan.sh +0 -49
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Eval: Test Quality
|
|
2
|
+
|
|
3
|
+
Type: LLM-judge
|
|
4
|
+
Mode: quality gate
|
|
5
|
+
Threshold: weighted total >= 8.0
|
|
6
|
+
|
|
7
|
+
Score each dimension 0-10. Cite test names or output lines when below 7. Weighted total = sum(score x weight%) / 100.
|
|
8
|
+
|
|
9
|
+
## Rubric
|
|
10
|
+
|
|
11
|
+
### Result accuracy (weight 25%)
|
|
12
|
+
Does Result field (pass | fail) match exit code and counts? No misreporting.
|
|
13
|
+
|
|
14
|
+
### Failure detail (weight 25%)
|
|
15
|
+
If failures occurred, failing test names listed with enough context (file:line, assertion message)? If pass, Failures explicitly `none`?
|
|
16
|
+
|
|
17
|
+
### Coverage of changes (weight 20%)
|
|
18
|
+
Tests run cover files changed in dev phase? Gaps called out?
|
|
19
|
+
|
|
20
|
+
### Command reproducibility (weight 15%)
|
|
21
|
+
Command field real shell command another engineer could run as-is? Includes filters or args if used.
|
|
22
|
+
|
|
23
|
+
### Duration sanity (weight 10%)
|
|
24
|
+
Duration reported with unit? Plausible for suite size?
|
|
25
|
+
|
|
26
|
+
### Regression risk callouts (weight 5%)
|
|
27
|
+
Flakes or slow tests flagged for follow-up?
|
|
28
|
+
|
|
29
|
+
## On failure (total below 8.0)
|
|
30
|
+
|
|
31
|
+
Retry. Regenerate weakest section only. Max 3 attempts.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"scores": {
|
|
38
|
+
"result_accuracy": 0,
|
|
39
|
+
"failure_detail": 0,
|
|
40
|
+
"coverage_of_changes": 0,
|
|
41
|
+
"command_reproducibility": 0,
|
|
42
|
+
"duration_sanity": 0,
|
|
43
|
+
"regression_risk": 0
|
|
44
|
+
},
|
|
45
|
+
"weighted_total": 0.0,
|
|
46
|
+
"feedback": ["dimension: specific issue with test name or output ref"]
|
|
47
|
+
}
|
|
48
|
+
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# Coding Style
|
|
2
2
|
|
|
3
|
-
How code reads
|
|
3
|
+
How code reads. Applies to all areas unless `{repo}/.claude/conventions/{area}.md` says otherwise.
|
|
4
4
|
|
|
5
5
|
## Principles
|
|
6
6
|
|
|
7
|
-
- Read before write. At least 3 similar files in
|
|
8
|
-
- Match repo conventions.
|
|
7
|
+
- Read before write. At least 3 similar files in repo before producing new code.
|
|
8
|
+
- Match repo conventions. No mixing stacks (no JPA in repos using AbstractRepository, no Composition API in Vue 2 repos).
|
|
9
9
|
- Pragmatic over perfect. Small PRs, 1-4 files, under 100 lines ideal.
|
|
10
10
|
- Test service logic always. Feature or bugfix without tests is incomplete.
|
|
11
|
-
- Clean dead code when touching related files.
|
|
11
|
+
- Clean dead code when touching related files. No commented-out blocks.
|
|
12
12
|
- Temp code marked: `// please remove me` so reviewers catch it.
|
|
13
13
|
- Revert if issues, investigate second.
|
|
14
14
|
- Defensive: null-safe, guards, edge cases.
|
|
@@ -16,7 +16,7 @@ How code reads . Applies to all areas unless a `{repo}/.claude/conventions/{area
|
|
|
16
16
|
|
|
17
17
|
## Never invent
|
|
18
18
|
|
|
19
|
-
If
|
|
19
|
+
If class, helper, or pattern not in repo, do not fabricate.
|
|
20
20
|
|
|
21
21
|
Java/Kotlin:
|
|
22
22
|
```java
|
|
@@ -28,7 +28,7 @@ Vue:
|
|
|
28
28
|
<!-- TBD - verify with tech lead: {what is missing} -->
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
TODO with context beats fabricated code.
|
|
32
32
|
|
|
33
33
|
## Backend defaults (Java/Kotlin/team)
|
|
34
34
|
|
|
@@ -48,4 +48,4 @@ See skills/devops/SKILL.md.
|
|
|
48
48
|
|
|
49
49
|
## Project overrides
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Repo can override any rule via `.claude/conventions/{area}.md`. See guides/conventions-override.md.
|
|
@@ -24,7 +24,7 @@ Examples:
|
|
|
24
24
|
|
|
25
25
|
## Body (optional)
|
|
26
26
|
|
|
27
|
-
- Why, not what. Diff
|
|
27
|
+
- Why, not what. Diff shows what.
|
|
28
28
|
- Reference linked tickets or related PRs.
|
|
29
29
|
- Mention breaking changes explicitly with `BREAKING CHANGE:` footer.
|
|
30
30
|
|
|
@@ -32,12 +32,12 @@ Examples:
|
|
|
32
32
|
|
|
33
33
|
- "WIP", "fixes", "more changes", "asdf"
|
|
34
34
|
- Ticket missing
|
|
35
|
-
- Description
|
|
35
|
+
- Description repeats type ("fix(...): fix the bug")
|
|
36
36
|
- Multi-line title
|
|
37
37
|
|
|
38
38
|
## Co-author
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Pairing or AI-assisted:
|
|
41
41
|
|
|
42
42
|
```
|
|
43
43
|
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Conventions Override
|
|
2
2
|
|
|
3
|
-
How project-specific conventions override
|
|
3
|
+
How project-specific conventions override plugin defaults.
|
|
4
4
|
|
|
5
5
|
## Path
|
|
6
6
|
|
|
7
|
-
Each repo can have
|
|
7
|
+
Each repo can have own conventions file per area:
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
{repo-root}/
|
|
@@ -16,21 +16,21 @@ Each repo can have its own conventions file per area:
|
|
|
16
16
|
└── devops.md
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Only
|
|
19
|
+
Only files you need. No web work in repo, no web.md.
|
|
20
20
|
|
|
21
21
|
## How it works
|
|
22
22
|
|
|
23
|
-
When
|
|
23
|
+
When skill or command generates code:
|
|
24
24
|
|
|
25
|
-
1. Read
|
|
25
|
+
1. Read plugin default conventions from `skills/{area}/SKILL.md`.
|
|
26
26
|
2. Check if `cwd/.claude/conventions/{area}.md` exists.
|
|
27
|
-
3. If yes, read it. Rules
|
|
28
|
-
4.
|
|
29
|
-
5.
|
|
27
|
+
3. If yes, read it. Rules override or add to defaults.
|
|
28
|
+
4. On conflict, project wins.
|
|
29
|
+
5. No project file, use plugin defaults only.
|
|
30
30
|
|
|
31
|
-
## What goes in
|
|
31
|
+
## What goes in project conventions file
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
DIFFERENCES from defaults, not full rule set. Examples:
|
|
34
34
|
|
|
35
35
|
```markdown
|
|
36
36
|
# Backend conventions for recon-service
|
|
@@ -54,15 +54,15 @@ Forbidden in this repo:
|
|
|
54
54
|
- @Component annotation on classes (always @Service, @Repository, @Configuration)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Keep
|
|
57
|
+
Keep short. Document what is DIFFERENT, not what is shared with defaults.
|
|
58
58
|
|
|
59
59
|
## Avoiding drift
|
|
60
60
|
|
|
61
|
-
If
|
|
61
|
+
If convention you wrote for repo applies to others, consider promoting to plugin defaults (skills/{area}/SKILL.md). Per-repo files hold genuine repo-specific decisions.
|
|
62
62
|
|
|
63
63
|
## Versioning
|
|
64
64
|
|
|
65
|
-
Track conventions changes in git. When
|
|
65
|
+
Track conventions changes in git. When rule changes, commit message and PR description explain why.
|
|
66
66
|
|
|
67
67
|
## Example structure for recon-service
|
|
68
68
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Pipeline
|
|
2
2
|
|
|
3
|
-
Shared rules for plan, dev, test, pr stages. Edit retry, approval, publish,
|
|
3
|
+
Shared rules for plan, dev, test, pr stages. Edit retry, approval, publish, token accounting here.
|
|
4
4
|
|
|
5
5
|
## Stages
|
|
6
6
|
|
|
7
|
-
1. plan: generate
|
|
8
|
-
2. dev: implement
|
|
9
|
-
3. test: run
|
|
10
|
-
4. pr: open
|
|
7
|
+
1. plan: generate technical plan from source PRP. Apply sensors, eval, retry up to 3.
|
|
8
|
+
2. dev: implement plan in code. Run lint and convention gates after each step. Retry until clean.
|
|
9
|
+
3. test: run project test suite. Capture results.
|
|
10
|
+
4. pr: open draft PR with standard template.
|
|
11
11
|
|
|
12
12
|
## Retry policy
|
|
13
13
|
|
|
@@ -19,8 +19,8 @@ Trigger on:
|
|
|
19
19
|
- test command exit code != 0 (dev/test only)
|
|
20
20
|
|
|
21
21
|
Strategy:
|
|
22
|
-
1. Read
|
|
23
|
-
2. Regenerate or fix only
|
|
22
|
+
1. Read feedback.
|
|
23
|
+
2. Regenerate or fix only failed parts.
|
|
24
24
|
3. Re-run gates.
|
|
25
25
|
|
|
26
26
|
Hard stop after 3 attempts: return blocker, do not proceed.
|
|
@@ -38,17 +38,21 @@ Triggers hooks/post-eval-{stage}.sh.
|
|
|
38
38
|
|
|
39
39
|
## Token accounting
|
|
40
40
|
|
|
41
|
-
Phases tracked per feature_id (matches PRD/PRP feature_id from
|
|
41
|
+
Phases tracked per feature_id (matches PRD/PRP feature_id from PM plugin):
|
|
42
42
|
- plan-generate, plan-validate
|
|
43
|
-
- dev
|
|
44
|
-
- test
|
|
45
|
-
- pr
|
|
43
|
+
- dev-generate, dev-validate
|
|
44
|
+
- test-generate, test-validate
|
|
45
|
+
- pr-generate, pr-validate
|
|
46
46
|
|
|
47
|
-
Markers in outputs/.markers/{feature_id}.{phase}.{start|end}, each `{"timestamp": ISO, "session_id": ""}`.
|
|
47
|
+
Markers in outputs/.markers/{feature_id}.{phase}.{start|end}, each `{"timestamp": ISO, "session_id": ""}`.
|
|
48
|
+
Flow per stage:
|
|
49
|
+
1. Skill writes `{stage}-generate.start` before drafting artifact.
|
|
50
|
+
2. Write tool fires post-write-sse.sh → writes `{stage}-generate.end` + `{stage}-validate.start`.
|
|
51
|
+
3. Skill appends approval marker via Edit → fires post-eval-sse.sh → writes `{stage}-validate.end` + runs scripts/token-phase.py for both phases.
|
|
48
52
|
|
|
49
|
-
Tokens land in
|
|
53
|
+
Tokens land in shared file with PM plugin: `outputs/tokens/{feature_id}.json`. Same file collects PM phases (prd-generate, prd-validate, prp-generate, prp-validate) and SSE phases (plan-generate, plan-validate, dev, test, pr). Totals cover full feature lifecycle.
|
|
50
54
|
|
|
51
|
-
To merge with
|
|
55
|
+
To merge with PM tokens file, SSE token-phase.py writes to same path under this plugin's outputs/tokens/, then small step in commands/run.md syncs (or symlinks) with PM tokens dir. v1: SSE keeps own outputs/tokens/{feature_id}.json. v2: merge.
|
|
52
56
|
|
|
53
57
|
## Orchestrator order
|
|
54
58
|
|
|
@@ -59,7 +63,7 @@ To merge with the PM tokens file, the SSE token-phase.py writes to the same path
|
|
|
59
63
|
|
|
60
64
|
## Stop conditions
|
|
61
65
|
|
|
62
|
-
- 3 failed attempts on
|
|
66
|
+
- 3 failed attempts on same stage
|
|
63
67
|
- tests fail after dev
|
|
64
68
|
- gh CLI not available for pr stage
|
|
65
69
|
- missing required input after one clarification
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generic SSE post-eval hook. Handles plan/dev/test/pr phases:
|
|
3
|
+
# - detects approved marker
|
|
4
|
+
# - closes validate.end marker
|
|
5
|
+
# - runs token-phase.py for both generate and validate phases
|
|
6
|
+
# - appends published marker + inline tokens reference
|
|
7
|
+
#
|
|
8
|
+
# Registered in .claude/settings.json under PostToolUse > Edit.
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
FILE_PATH="${CLAUDE_TOOL_FILE_PATH:-}"
|
|
13
|
+
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
14
|
+
|
|
15
|
+
PHASE=""
|
|
16
|
+
case "$FILE_PATH" in
|
|
17
|
+
*.claude/plugins/staff-software-engineer/outputs/plan/*.md) PHASE=plan ;;
|
|
18
|
+
*.claude/plugins/staff-software-engineer/outputs/dev/*.md) PHASE=dev ;;
|
|
19
|
+
*.claude/plugins/staff-software-engineer/outputs/test/*.md) PHASE=test ;;
|
|
20
|
+
*.claude/plugins/staff-software-engineer/outputs/pr/*.md) PHASE=pr ;;
|
|
21
|
+
*) exit 0 ;;
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
if ! grep -q "<!-- approved:" "$FILE_PATH"; then
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if grep -q "<!-- published:" "$FILE_PATH"; then
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
FEATURE_ID="$(basename "$FILE_PATH" .md)"
|
|
33
|
+
MARKERS_DIR="$PLUGIN_DIR/outputs/.markers"
|
|
34
|
+
mkdir -p "$MARKERS_DIR"
|
|
35
|
+
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
36
|
+
|
|
37
|
+
if [ -f "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-validate.start" ]; then
|
|
38
|
+
printf '{"timestamp":"%s"}\n' "$NOW" > "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-validate.end"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
python3 "$PLUGIN_DIR/scripts/token-phase.py" \
|
|
42
|
+
--feature-id "$FEATURE_ID" \
|
|
43
|
+
--phase "${PHASE}-generate" \
|
|
44
|
+
--plugin-dir "$PLUGIN_DIR" >&2 || true
|
|
45
|
+
|
|
46
|
+
python3 "$PLUGIN_DIR/scripts/token-phase.py" \
|
|
47
|
+
--feature-id "$FEATURE_ID" \
|
|
48
|
+
--phase "${PHASE}-validate" \
|
|
49
|
+
--plugin-dir "$PLUGIN_DIR" >&2 || true
|
|
50
|
+
|
|
51
|
+
TOKENS_FILE="$PLUGIN_DIR/outputs/tokens/${FEATURE_ID}.json"
|
|
52
|
+
if [ -f "$TOKENS_FILE" ]; then
|
|
53
|
+
TOKENS_LINE=$(python3 -c "
|
|
54
|
+
import json
|
|
55
|
+
with open('$TOKENS_FILE') as f:
|
|
56
|
+
d=json.load(f)
|
|
57
|
+
t=d.get('totals',{})
|
|
58
|
+
print(f'<!-- tokens: outputs/tokens/${FEATURE_ID}.json in={t.get(\"input\",0)} out={t.get(\"output\",0)} cache_r={t.get(\"cache_read\",0)} -->')
|
|
59
|
+
")
|
|
60
|
+
printf '\n%s\n' "$TOKENS_LINE" >> "$FILE_PATH"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
printf '\n<!-- published: %s -->\n' "$NOW" >> "$FILE_PATH"
|
|
64
|
+
echo "[hook] ${PHASE} approved + token accounting done" >&2
|
|
65
|
+
exit 0
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generic SSE post-write hook. Handles plan/dev/test/pr phases:
|
|
3
|
+
# - runs sensors matching sensors/{phase}-*.md (if any)
|
|
4
|
+
# - writes phase generate.end + validate.start markers
|
|
5
|
+
#
|
|
6
|
+
# Registered in .claude/settings.json under PostToolUse > Write.
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
FILE_PATH="${CLAUDE_TOOL_FILE_PATH:-}"
|
|
11
|
+
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
12
|
+
|
|
13
|
+
PHASE=""
|
|
14
|
+
case "$FILE_PATH" in
|
|
15
|
+
*.claude/plugins/staff-software-engineer/outputs/plan/*.md) PHASE=plan ;;
|
|
16
|
+
*.claude/plugins/staff-software-engineer/outputs/dev/*.md) PHASE=dev ;;
|
|
17
|
+
*.claude/plugins/staff-software-engineer/outputs/test/*.md) PHASE=test ;;
|
|
18
|
+
*.claude/plugins/staff-software-engineer/outputs/pr/*.md) PHASE=pr ;;
|
|
19
|
+
*) exit 0 ;;
|
|
20
|
+
esac
|
|
21
|
+
|
|
22
|
+
if grep -q "<!-- approved:" "$FILE_PATH" 2>/dev/null; then
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
ACTIVITY="$(cd "$PLUGIN_DIR/../../.." && pwd)/.claude/scripts/activity.py"
|
|
27
|
+
set_activity() { [ -x "$ACTIVITY" ] && python3 "$ACTIVITY" set "$1" "$2" 2>/dev/null || true; }
|
|
28
|
+
clear_activity() { [ -x "$ACTIVITY" ] && python3 "$ACTIVITY" clear 2>/dev/null || true; }
|
|
29
|
+
|
|
30
|
+
FAILURES=()
|
|
31
|
+
for sensor in "$PLUGIN_DIR"/sensors/${PHASE}-*.md; do
|
|
32
|
+
[ -f "$sensor" ] || continue
|
|
33
|
+
sname="$(basename "$sensor" .md)"
|
|
34
|
+
set_activity sensor "$sname"
|
|
35
|
+
if ! python3 "$PLUGIN_DIR/scripts/sensor-runner.py" \
|
|
36
|
+
--sensor "$sensor" \
|
|
37
|
+
--artifact "$FILE_PATH" >&2; then
|
|
38
|
+
FAILURES+=("$sname")
|
|
39
|
+
fi
|
|
40
|
+
clear_activity
|
|
41
|
+
done
|
|
42
|
+
|
|
43
|
+
if [ ${#FAILURES[@]} -gt 0 ]; then
|
|
44
|
+
echo "[hook] ${PHASE} sensor failures: ${FAILURES[*]}" >&2
|
|
45
|
+
exit 2
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
FEATURE_ID="$(basename "$FILE_PATH" .md)"
|
|
49
|
+
MARKERS_DIR="$PLUGIN_DIR/outputs/.markers"
|
|
50
|
+
mkdir -p "$MARKERS_DIR"
|
|
51
|
+
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
52
|
+
|
|
53
|
+
if [ ! -f "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-validate.start" ]; then
|
|
54
|
+
if [ -f "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-generate.start" ]; then
|
|
55
|
+
printf '{"timestamp":"%s"}\n' "$NOW" > "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-generate.end"
|
|
56
|
+
printf '{"timestamp":"%s","session_id":"%s"}\n' "$NOW" "${CLAUDE_SESSION_ID:-}" > "$MARKERS_DIR/${FEATURE_ID}.${PHASE}-validate.start"
|
|
57
|
+
fi
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
exit 0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Type: deterministic (via project-specific tooling)
|
|
4
4
|
Mode: hard gate
|
|
5
5
|
|
|
6
|
-
Run lint and format checks for
|
|
6
|
+
Run lint and format checks for area being touched.
|
|
7
7
|
|
|
8
8
|
## Backend (Java/Kotlin)
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ Detect via build file:
|
|
|
11
11
|
- Maven: `mvn -q checkstyle:check` or `mvn -q spotless:check` if configured
|
|
12
12
|
- Gradle: `./gradlew detekt` or `./gradlew checkstyleMain`
|
|
13
13
|
|
|
14
|
-
If no linter
|
|
14
|
+
If no linter configured, skip and emit warning.
|
|
15
15
|
|
|
16
16
|
## Web (Vue/JS)
|
|
17
17
|
|
|
@@ -30,8 +30,8 @@ If no linter is configured, skip and emit a warning.
|
|
|
30
30
|
|
|
31
31
|
## On failure
|
|
32
32
|
|
|
33
|
-
Block. Surface
|
|
33
|
+
Block. Surface linter output. Agent fixes and re-runs.
|
|
34
34
|
|
|
35
35
|
## On warning (no linter configured)
|
|
36
36
|
|
|
37
|
-
Note in
|
|
37
|
+
Note in output, do not block. Suggest adding linter to repo.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Sensor: Dev Structure
|
|
2
|
+
|
|
3
|
+
Type: deterministic
|
|
4
|
+
Mode: hard gate
|
|
5
|
+
|
|
6
|
+
Validates dev summary doc at `outputs/dev/{feature_id}.md`.
|
|
7
|
+
|
|
8
|
+
## Required sections
|
|
9
|
+
|
|
10
|
+
- Summary
|
|
11
|
+
- Files changed
|
|
12
|
+
- Commits
|
|
13
|
+
- Sensors
|
|
14
|
+
- Blockers
|
|
15
|
+
|
|
16
|
+
## Forbidden tokens
|
|
17
|
+
|
|
18
|
+
- lorem
|
|
19
|
+
- TODO without ticket reference
|
|
20
|
+
- placeholder
|
|
21
|
+
- XXX
|
|
22
|
+
- FIXME without ticket reference
|
|
23
|
+
|
|
24
|
+
## Markdown rules
|
|
25
|
+
|
|
26
|
+
- exactly 1 H1 heading
|
|
27
|
+
- no em-dash
|
|
28
|
+
- no ASCII box-drawing
|
|
29
|
+
|
|
30
|
+
## Required metadata
|
|
31
|
+
|
|
32
|
+
Header must declare:
|
|
33
|
+
- Source plan (path to `outputs/plan/{feature_id}.md`)
|
|
34
|
+
- Branch
|
|
35
|
+
- Area (backend | web | mobile | devops)
|
|
36
|
+
- Date
|
|
37
|
+
|
|
38
|
+
## Content rules
|
|
39
|
+
|
|
40
|
+
- Files changed must list at least 1 real file path (not placeholder).
|
|
41
|
+
- Commits section must list at least 1 short SHA (7+ hex chars).
|
|
42
|
+
- Sensors section must report `code-conventions` and `test-coverage` outcomes (ok | failed).
|
|
43
|
+
|
|
44
|
+
## On failure
|
|
45
|
+
|
|
46
|
+
Block publish. Return missing sections and rule violations. Agent regenerates failed parts only.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Sensor: PR Structure
|
|
2
|
+
|
|
3
|
+
Type: deterministic
|
|
4
|
+
Mode: hard gate
|
|
5
|
+
|
|
6
|
+
Validates PR record at `outputs/pr/{feature_id}.md`.
|
|
7
|
+
|
|
8
|
+
## Required sections
|
|
9
|
+
|
|
10
|
+
- URL
|
|
11
|
+
- Title
|
|
12
|
+
- Draft
|
|
13
|
+
- Summary
|
|
14
|
+
- Test plan
|
|
15
|
+
- Refs
|
|
16
|
+
|
|
17
|
+
## Forbidden tokens
|
|
18
|
+
|
|
19
|
+
- lorem
|
|
20
|
+
- placeholder
|
|
21
|
+
- TBD
|
|
22
|
+
|
|
23
|
+
## Markdown rules
|
|
24
|
+
|
|
25
|
+
- exactly 1 H1 heading
|
|
26
|
+
- no em-dash
|
|
27
|
+
- no ASCII box-drawing
|
|
28
|
+
|
|
29
|
+
## Required metadata
|
|
30
|
+
|
|
31
|
+
Header must declare:
|
|
32
|
+
- Source plan (path to `outputs/plan/{feature_id}.md`)
|
|
33
|
+
- Source dev (path to `outputs/dev/{feature_id}.md`)
|
|
34
|
+
- Branch
|
|
35
|
+
- Date
|
|
36
|
+
|
|
37
|
+
## Content rules
|
|
38
|
+
|
|
39
|
+
- URL must match `https://github.com/{owner}/{repo}/pull/{number}` shape.
|
|
40
|
+
- Title must start with Conventional Commits prefix (`feat`, `fix`, `chore`, `refactor`, `docs`, `test`, `perf`, `build`, `ci`, `style`, `revert`) followed by optional scope and `:`.
|
|
41
|
+
- Title length <= 70 chars.
|
|
42
|
+
- Draft must be `yes` or `no`.
|
|
43
|
+
- Summary must have at least 1 bullet.
|
|
44
|
+
- Test plan must be markdown checklist with at least 1 item.
|
|
45
|
+
- Refs section must reference both source plan and source dev paths.
|
|
46
|
+
|
|
47
|
+
## On failure
|
|
48
|
+
|
|
49
|
+
Block publish. Return missing sections and rule violations.
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Type: heuristic
|
|
4
4
|
Mode: hard gate
|
|
5
5
|
|
|
6
|
-
Every feature or bugfix must include tests for
|
|
6
|
+
Every feature or bugfix must include tests for changed code.
|
|
7
7
|
|
|
8
8
|
## Check
|
|
9
9
|
|
|
10
|
-
For each changed source file in
|
|
11
|
-
-
|
|
12
|
-
- OR
|
|
10
|
+
For each changed source file in dev commit set, look for:
|
|
11
|
+
- corresponding test file (e.g., `Foo.java` -> `FooTest.java`, `bar.ts` -> `bar.test.ts`)
|
|
12
|
+
- OR test file modified in same commit exercising the change
|
|
13
13
|
|
|
14
14
|
Patterns recognized:
|
|
15
15
|
- `**/test/**`, `**/tests/**`, `**/__tests__/**`, `**/spec/**`, `**/specs/**`
|
|
@@ -17,7 +17,7 @@ Patterns recognized:
|
|
|
17
17
|
|
|
18
18
|
## Exclusions
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Following do not need test in same commit:
|
|
21
21
|
- README and docs
|
|
22
22
|
- migration files (V*.sql)
|
|
23
23
|
- pure config (yaml, json)
|
|
@@ -25,4 +25,4 @@ The following do not need a test in the same commit:
|
|
|
25
25
|
|
|
26
26
|
## On failure
|
|
27
27
|
|
|
28
|
-
Block. List
|
|
28
|
+
Block. List source files without tests. Agent adds missing tests.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Sensor: Test Structure
|
|
2
|
+
|
|
3
|
+
Type: deterministic
|
|
4
|
+
Mode: hard gate
|
|
5
|
+
|
|
6
|
+
Validates test report at `outputs/test/{feature_id}.md`.
|
|
7
|
+
|
|
8
|
+
## Required sections
|
|
9
|
+
|
|
10
|
+
- Command
|
|
11
|
+
- Result
|
|
12
|
+
- Counts
|
|
13
|
+
- Failures
|
|
14
|
+
- Duration
|
|
15
|
+
|
|
16
|
+
## Forbidden tokens
|
|
17
|
+
|
|
18
|
+
- lorem
|
|
19
|
+
- placeholder
|
|
20
|
+
- TBD
|
|
21
|
+
|
|
22
|
+
## Markdown rules
|
|
23
|
+
|
|
24
|
+
- exactly 1 H1 heading
|
|
25
|
+
- no em-dash
|
|
26
|
+
- no ASCII box-drawing
|
|
27
|
+
|
|
28
|
+
## Required metadata
|
|
29
|
+
|
|
30
|
+
Header must declare:
|
|
31
|
+
- Source dev (path to `outputs/dev/{feature_id}.md`)
|
|
32
|
+
- Framework (maven | gradle | npm | pytest | other)
|
|
33
|
+
- Date
|
|
34
|
+
|
|
35
|
+
## Content rules
|
|
36
|
+
|
|
37
|
+
- Command must be real shell command (not placeholder).
|
|
38
|
+
- Result must be `pass` or `fail`.
|
|
39
|
+
- Counts must include numeric `passed` and `failed` values.
|
|
40
|
+
- If Result is `fail`, Failures section must list at least 1 failing test name.
|
|
41
|
+
- If Result is `pass`, Failures section must be `none`.
|
|
42
|
+
- Duration must include unit (s | ms | m).
|
|
43
|
+
|
|
44
|
+
## On failure
|
|
45
|
+
|
|
46
|
+
Block publish. Return missing sections and rule violations.
|
|
@@ -6,11 +6,11 @@ user_invocable: false
|
|
|
6
6
|
|
|
7
7
|
Backend conventions, team default.
|
|
8
8
|
|
|
9
|
-
Project override: if `{repo}/.claude/conventions/backend.md` exists,
|
|
9
|
+
Project override: if `{repo}/.claude/conventions/backend.md` exists, overrides any rule here. See guides/conventions-override.md.
|
|
10
10
|
|
|
11
11
|
## Defaults
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Illustrative defaults for JVM-leaning backend. Override per repo via `.claude/conventions/backend.md`.
|
|
14
14
|
|
|
15
15
|
Stack:
|
|
16
16
|
- Java or Kotlin (check pom.xml or build.gradle.kts)
|
|
@@ -20,7 +20,7 @@ Stack:
|
|
|
20
20
|
- Package prefix: match repo convention
|
|
21
21
|
|
|
22
22
|
Persistence:
|
|
23
|
-
- Custom JDBC AbstractRepository + SQL templates. Avoid JPA except where
|
|
23
|
+
- Custom JDBC AbstractRepository + SQL templates. Avoid JPA except where repo already uses it.
|
|
24
24
|
- Migrations via Flyway, naming `V{YYYYMMDD}__{description}.sql`.
|
|
25
25
|
|
|
26
26
|
Mapping:
|
|
@@ -37,7 +37,7 @@ Null handling:
|
|
|
37
37
|
|
|
38
38
|
Streams:
|
|
39
39
|
- Fluent: `.stream().filter(...).findAny().orElseThrow(...)`.
|
|
40
|
-
- Avoid stream-of-stream when
|
|
40
|
+
- Avoid stream-of-stream when guard would do.
|
|
41
41
|
|
|
42
42
|
Transactions:
|
|
43
43
|
- `@Transactional` on service methods, not repositories.
|
|
@@ -46,12 +46,12 @@ Tests:
|
|
|
46
46
|
- JUnit 4 + Mockito legacy; JUnit 5 + Mockito for newer.
|
|
47
47
|
- `@RunWith(MockitoJUnitRunner.class)` (JUnit 4) or `@ExtendWith(MockitoExtension.class)` (JUnit 5).
|
|
48
48
|
- Naming: `givenX_WhenY_ShouldZ` or `shouldDoSomethingWhenCondition`.
|
|
49
|
-
- Cover positive, negative,
|
|
49
|
+
- Cover positive, negative, edge cases.
|
|
50
50
|
- `verify()` with `never()`, `times()`, arg matchers.
|
|
51
51
|
|
|
52
52
|
## Before writing code
|
|
53
53
|
|
|
54
|
-
Read at least 3 similar files in
|
|
54
|
+
Read at least 3 similar files in target repo to confirm:
|
|
55
55
|
- framework version
|
|
56
56
|
- build tool
|
|
57
57
|
- package layout
|
|
@@ -71,10 +71,10 @@ Never assume. Stack varies per repo.
|
|
|
71
71
|
|
|
72
72
|
## Mark gaps
|
|
73
73
|
|
|
74
|
-
If you cannot find
|
|
74
|
+
If you cannot find pattern in repo, do not invent:
|
|
75
75
|
|
|
76
76
|
```java
|
|
77
77
|
// TBD - verify with tech lead: {what you searched, what is missing}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Read actual code first.
|
|
80
|
+
Read actual code first. TODO with context beats fabricated code.
|
|
@@ -6,7 +6,7 @@ user_invocable: false
|
|
|
6
6
|
|
|
7
7
|
DevOps conventions, team default.
|
|
8
8
|
|
|
9
|
-
Project override: if `{repo}/.claude/conventions/devops.md` exists,
|
|
9
|
+
Project override: if `{repo}/.claude/conventions/devops.md` exists, overrides any rule here. See guides/conventions-override.md.
|
|
10
10
|
|
|
11
11
|
## Defaults
|
|
12
12
|
|
|
@@ -32,12 +32,12 @@ Observability:
|
|
|
32
32
|
- Log structure: JSON, with `trace_id`, `service`, `level`, `msg`.
|
|
33
33
|
|
|
34
34
|
Secrets:
|
|
35
|
-
- Never commit secrets. Use
|
|
35
|
+
- Never commit secrets. Use secret manager.
|
|
36
36
|
- Pre-commit hook to scan for accidental secrets.
|
|
37
37
|
|
|
38
38
|
## Before writing code
|
|
39
39
|
|
|
40
|
-
Read at least 3 similar workflows or terraform modules in
|
|
40
|
+
Read at least 3 similar workflows or terraform modules in repo. Confirm:
|
|
41
41
|
- runner type (ubuntu-latest, self-hosted)
|
|
42
42
|
- secret naming convention
|
|
43
43
|
- environments (dev, staging, prod)
|