@cobusgreyling/loop-init 1.2.3 → 1.3.2
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 +2 -0
- package/dist/cli.js +133 -31
- package/package.json +6 -2
- package/starters/README.md +8 -1
- package/starters/changelog-drafter-opencode/AGENTS.md +15 -0
- package/starters/changelog-drafter-opencode/LOOP.md +26 -0
- package/starters/changelog-drafter-opencode/README.md +44 -0
- package/starters/changelog-drafter-opencode/changelog-drafter-state.md.example +10 -0
- package/starters/changelog-drafter-opencode/opencode.json.example +35 -0
- package/starters/changelog-drafter-opencode/skills/changelog-scan/SKILL.md +38 -0
- package/starters/ci-sweeper-opencode/AGENTS.md +17 -0
- package/starters/ci-sweeper-opencode/LOOP.md +26 -0
- package/starters/ci-sweeper-opencode/README.md +43 -0
- package/starters/ci-sweeper-opencode/ci-sweeper-state.md.example +10 -0
- package/starters/ci-sweeper-opencode/opencode.json.example +35 -0
- package/starters/ci-sweeper-opencode/skills/ci-triage/SKILL.md +32 -0
- package/starters/dependency-sweeper-opencode/AGENTS.md +15 -0
- package/starters/dependency-sweeper-opencode/LOOP.md +27 -0
- package/starters/dependency-sweeper-opencode/README.md +44 -0
- package/starters/dependency-sweeper-opencode/dependency-sweeper-state.md.example +11 -0
- package/starters/dependency-sweeper-opencode/opencode.json.example +35 -0
- package/starters/dependency-sweeper-opencode/skills/dependency-triage/SKILL.md +35 -0
- package/starters/issue-triage-opencode/AGENTS.md +16 -0
- package/starters/issue-triage-opencode/LOOP.md +21 -0
- package/starters/issue-triage-opencode/README.md +43 -0
- package/starters/issue-triage-opencode/issue-triage-state.md.example +11 -0
- package/starters/issue-triage-opencode/opencode.json.example +35 -0
- package/starters/issue-triage-opencode/skills/issue-triage/SKILL.md +33 -0
- package/starters/minimal-loop-opencode/AGENTS.md +23 -0
- package/starters/minimal-loop-opencode/LOOP.md +33 -0
- package/starters/minimal-loop-opencode/README.md +50 -0
- package/starters/minimal-loop-opencode/STATE.md.example +12 -0
- package/starters/minimal-loop-opencode/opencode.json.example +35 -0
- package/starters/minimal-loop-opencode/skills/loop-triage/SKILL.md +59 -0
- package/starters/post-merge-cleanup-opencode/AGENTS.md +15 -0
- package/starters/post-merge-cleanup-opencode/LOOP.md +26 -0
- package/starters/post-merge-cleanup-opencode/README.md +44 -0
- package/starters/post-merge-cleanup-opencode/opencode.json.example +35 -0
- package/starters/post-merge-cleanup-opencode/post-merge-state.md.example +10 -0
- package/starters/post-merge-cleanup-opencode/skills/post-merge-scan/SKILL.md +34 -0
- package/starters/pr-babysitter-opencode/AGENTS.md +18 -0
- package/starters/pr-babysitter-opencode/LOOP.md +27 -0
- package/starters/pr-babysitter-opencode/README.md +44 -0
- package/starters/pr-babysitter-opencode/opencode.json.example +35 -0
- package/starters/pr-babysitter-opencode/pr-babysitter-state.md.example +10 -0
- package/starters/pr-babysitter-opencode/skills/pr-review-triage/SKILL.md +33 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Post-Merge Cleanup — Opencode Starter
|
|
2
|
+
|
|
3
|
+
Clone-and-run scaffold for the **Post-Merge Cleanup** pattern with opencode. Follow-up tech debt after merges land on main.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cobusgreyling/loop-init . --pattern post-merge-cleanup --tool opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or copy manually:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp -r starters/post-merge-cleanup-opencode/skills .
|
|
15
|
+
cp starters/post-merge-cleanup-opencode/AGENTS.md .
|
|
16
|
+
cp starters/post-merge-cleanup-opencode/LOOP.md .
|
|
17
|
+
cp starters/post-merge-cleanup-opencode/post-merge-state.md.example post-merge-state.md
|
|
18
|
+
cp starters/post-merge-cleanup-opencode/opencode.json.example opencode.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start (report-only, week 1):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencode run \
|
|
25
|
+
"Run skills/post-merge-scan/SKILL.md. Scan merges to main in the last 48h. Propose small doc/lint/comment fixes only — ticket anything architectural. Update post-merge-state.md. Do not edit source code." \
|
|
26
|
+
--title "Post-merge cleanup"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What's Included
|
|
30
|
+
|
|
31
|
+
| File | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `post-merge-state.md.example` | State spine template |
|
|
34
|
+
| `skills/post-merge-scan/SKILL.md` | Merge-focused scan skill |
|
|
35
|
+
| `AGENTS.md` | Always-on safety rules |
|
|
36
|
+
| `LOOP.md` | Cadence, gates, budget |
|
|
37
|
+
| `opencode.json.example` | Named agent definitions |
|
|
38
|
+
|
|
39
|
+
## Next Steps
|
|
40
|
+
|
|
41
|
+
- [patterns/post-merge-cleanup.md](../../patterns/post-merge-cleanup.md)
|
|
42
|
+
- [examples/opencode/post-merge-cleanup.md](../../examples/opencode/post-merge-cleanup.md)
|
|
43
|
+
- [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
|
|
44
|
+
- [stories/post-merge-cleanup-honest-win.md](../../stories/post-merge-cleanup-honest-win.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"post-merge-scan": {
|
|
5
|
+
"name": "post-merge-scan",
|
|
6
|
+
"description": "Post-merge scan loop. Reads post-merge-state.md, scans recent merges, and proposes small cleanup fixes.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, post-merge-state.md, and skills/post-merge-scan/SKILL.md. Scan merges to main in the last 48h. Propose small doc/lint/comment fixes. Ticket architectural debt. Do not edit code in L1 mode.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer for small cleanup fixes inside an isolated worktree.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Implement only the requested single-file cleanup inside the supplied worktree. Run tests. Never touch denylist paths. Output the diff.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for cleanup diffs. APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Review the cleanup diff against project rules. Verify scope is small and doesn't touch denylisted paths. Do not edit files. APPROVE or REJECT.",
|
|
29
|
+
"permission": {
|
|
30
|
+
"bash": "ask",
|
|
31
|
+
"edit": "deny"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: post-merge-scan
|
|
3
|
+
description: >
|
|
4
|
+
Scan recent merges to main for tech debt, TODOs, debug code, and
|
|
5
|
+
small cleanup opportunities. Produces a prioritized fix list.
|
|
6
|
+
user_invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Post-Merge Scan Skill
|
|
10
|
+
|
|
11
|
+
You are a post-merge cleanup agent. Scan recent merges for follow-up work.
|
|
12
|
+
|
|
13
|
+
## Scan Sources
|
|
14
|
+
|
|
15
|
+
- Recent commits and PRs merged to main
|
|
16
|
+
- `git diff HEAD~10` for left-behind debug code
|
|
17
|
+
- TODO/FIXME/HACK comments in changed files
|
|
18
|
+
- Lint warnings introduced by recent changes
|
|
19
|
+
|
|
20
|
+
## Classification
|
|
21
|
+
|
|
22
|
+
- **Small fix**: doc/comment/lint/debug — auto-fix candidate
|
|
23
|
+
- **Architectural debt**: ticket for human
|
|
24
|
+
- **Denylist path**: escalate to human
|
|
25
|
+
|
|
26
|
+
## Output
|
|
27
|
+
|
|
28
|
+
Update `post-merge-state.md` with prioritized cleanup list.
|
|
29
|
+
|
|
30
|
+
## Rules
|
|
31
|
+
|
|
32
|
+
- Run off-peak (evening).
|
|
33
|
+
- Never auto-fix architectural debt.
|
|
34
|
+
- Max 2 fix attempts per run.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# AGENTS.md — PR Babysitter (Opencode)
|
|
2
|
+
|
|
3
|
+
## Loop Mode
|
|
4
|
+
- Start in L1 report-only mode.
|
|
5
|
+
- Read `pr-babysitter-state.md` before any triage.
|
|
6
|
+
- Do not edit source code until the human explicitly enables L2.
|
|
7
|
+
|
|
8
|
+
## Safety
|
|
9
|
+
- Never force-push without explicit human opt-in.
|
|
10
|
+
- Draft PRs by default; humans mark ready for review.
|
|
11
|
+
- Do not resolve review threads without approval.
|
|
12
|
+
- Security, auth, payments, infra, or public API changes always escalate.
|
|
13
|
+
- Max 3 fix attempts per PR before handoff.
|
|
14
|
+
|
|
15
|
+
## Verification
|
|
16
|
+
- For L2+ changes, dispatch verifier sub-agent after implementation.
|
|
17
|
+
- Run the project's documented tests before proposing a fix.
|
|
18
|
+
- Check for existing PR on the same intent before pushing.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Loop Configuration — PR Babysitter (Opencode)
|
|
2
|
+
|
|
3
|
+
## Active Loops
|
|
4
|
+
|
|
5
|
+
| Pattern | Cadence | Status | Command |
|
|
6
|
+
|---------|---------|--------|---------|
|
|
7
|
+
| PR Babysitter | 10-15m | L1 report-only | `opencode run "Run PR babysitter triage" --agent loop-triage` via cron/systemd |
|
|
8
|
+
|
|
9
|
+
## Human Gates
|
|
10
|
+
- No auto-fix until L2 checklist complete.
|
|
11
|
+
- Draft PRs by default; humans mark ready for review.
|
|
12
|
+
- Do not resolve review threads without approval.
|
|
13
|
+
- Security, auth, payments, infra changes: always human.
|
|
14
|
+
|
|
15
|
+
## Worktrees
|
|
16
|
+
- One worktree per fix attempt; discard after verifier REJECT.
|
|
17
|
+
- Run implementer with `--dir <worktree>`.
|
|
18
|
+
|
|
19
|
+
## Budget
|
|
20
|
+
- Max sub-agent spawns per run: 0 (L1).
|
|
21
|
+
- Max 3 fix attempts per PR before handoff.
|
|
22
|
+
- Pause if token budget exceeded.
|
|
23
|
+
|
|
24
|
+
## Links
|
|
25
|
+
- Pattern: [pr-babysitter](../../patterns/pr-babysitter.md)
|
|
26
|
+
- Example: [examples/opencode/pr-babysitter.md](../../examples/opencode/pr-babysitter.md)
|
|
27
|
+
- Safety: [docs/safety.md](../../docs/safety.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# PR Babysitter — Opencode Starter
|
|
2
|
+
|
|
3
|
+
Clone-and-run scaffold for the **PR Babysitter** pattern with opencode. Watch open PRs, surface blockers, and act only on safe obvious maintenance tasks.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @cobusgreyling/loop-init . --pattern pr-babysitter --tool opencode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or copy manually:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cp -r starters/pr-babysitter-opencode/skills .
|
|
15
|
+
cp starters/pr-babysitter-opencode/AGENTS.md .
|
|
16
|
+
cp starters/pr-babysitter-opencode/LOOP.md .
|
|
17
|
+
cp starters/pr-babysitter-opencode/pr-babysitter-state.md.example pr-babysitter-state.md
|
|
18
|
+
cp starters/pr-babysitter-opencode/opencode.json.example opencode.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start (report-only, week 1):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
opencode run \
|
|
25
|
+
"Run PR babysitter triage. Read pr-babysitter-state.md first. List PRs with red CI, stale review, merge conflicts, or unanswered review comments. Do not edit code. Update pr-babysitter-state.md." \
|
|
26
|
+
--title "PR babysitter"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What's Included
|
|
30
|
+
|
|
31
|
+
| File | Purpose |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `pr-babysitter-state.md.example` | State spine template |
|
|
34
|
+
| `skills/pr-review-triage/SKILL.md` | PR-focused triage skill |
|
|
35
|
+
| `AGENTS.md` | Always-on safety rules |
|
|
36
|
+
| `LOOP.md` | Cadence, gates, budget |
|
|
37
|
+
| `opencode.json.example` | Named agent definitions |
|
|
38
|
+
|
|
39
|
+
## Next Steps
|
|
40
|
+
|
|
41
|
+
- [patterns/pr-babysitter.md](../../patterns/pr-babysitter.md)
|
|
42
|
+
- [examples/opencode/pr-babysitter.md](../../examples/opencode/pr-babysitter.md)
|
|
43
|
+
- [docs/loop-design-checklist.md](../../docs/loop-design-checklist.md)
|
|
44
|
+
- [stories/pr-babysitter-week-one.md](../../stories/pr-babysitter-week-one.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://opencode.ai/config.json",
|
|
3
|
+
"agent": {
|
|
4
|
+
"pr-babysitter": {
|
|
5
|
+
"name": "pr-babysitter",
|
|
6
|
+
"description": "PR-focused triage loop. Reads pr-babysitter-state.md, watches open PRs, and reports blockers without editing code.",
|
|
7
|
+
"mode": "primary",
|
|
8
|
+
"prompt": "Read AGENTS.md, LOOP.md, pr-babysitter-state.md, and skills/pr-review-triage/SKILL.md. Watch open PRs, check CI status, review staleness, and surface blockers. Do not edit source code unless L2 is explicitly enabled.",
|
|
9
|
+
"permission": {
|
|
10
|
+
"bash": "ask",
|
|
11
|
+
"edit": "ask"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"implementer": {
|
|
15
|
+
"name": "implementer",
|
|
16
|
+
"description": "L2 implementer for minimal PR fixes inside an isolated worktree.",
|
|
17
|
+
"mode": "subagent",
|
|
18
|
+
"prompt": "Implement only the requested minimal fix inside the supplied worktree. Respect AGENTS.md and LOOP.md. Run documented tests. Never force-push. Draft PR by default.",
|
|
19
|
+
"permission": {
|
|
20
|
+
"bash": "ask",
|
|
21
|
+
"edit": "ask"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"verifier": {
|
|
25
|
+
"name": "verifier",
|
|
26
|
+
"description": "Checker agent for PR fix diffs. APPROVE or REJECT only.",
|
|
27
|
+
"mode": "subagent",
|
|
28
|
+
"prompt": "Review the supplied diff against project rules, tests, and docs/safety.md. Do not edit files. Respond with APPROVE or REJECT and concise evidence.",
|
|
29
|
+
"permission": {
|
|
30
|
+
"bash": "ask",
|
|
31
|
+
"edit": "deny"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-triage
|
|
3
|
+
description: >
|
|
4
|
+
Watch open PRs, check CI status, review staleness, merge conflicts,
|
|
5
|
+
and unanswered review comments. Produces a prioritized watchlist.
|
|
6
|
+
user_invocable: true
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# PR Review Triage Skill
|
|
10
|
+
|
|
11
|
+
You are a PR babysitter agent. Your job is to track open PRs and surface blockers.
|
|
12
|
+
|
|
13
|
+
## Inputs
|
|
14
|
+
|
|
15
|
+
- Open PRs (from `gh pr list` or GitHub MCP)
|
|
16
|
+
- Prior state in `pr-babysitter-state.md`
|
|
17
|
+
- CI status for each PR
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
Update `pr-babysitter-state.md` with:
|
|
22
|
+
|
|
23
|
+
- PRs with red CI
|
|
24
|
+
- PRs with merge conflicts
|
|
25
|
+
- PRs waiting >48h for review
|
|
26
|
+
- PRs with unanswered review comments
|
|
27
|
+
- Top 3 actions for a human
|
|
28
|
+
|
|
29
|
+
## Rules
|
|
30
|
+
|
|
31
|
+
- Do not edit code in L1 mode.
|
|
32
|
+
- Always check for existing PR on the same intent before pushing.
|
|
33
|
+
- Security/auth/payments changes: flag for human.
|