learnship 1.9.22 → 2.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-plugin/plugin.json +2 -2
- package/.cursor-plugin/plugin.json +2 -2
- package/README.md +75 -21
- package/SKILL.md +17 -0
- package/agents/learnship-challenger.md +96 -0
- package/agents/learnship-code-reviewer.md +109 -0
- package/agents/learnship-executor.md +15 -0
- package/agents/learnship-ideation-agent.md +83 -0
- package/agents/learnship-solution-writer.md +140 -0
- package/bin/install.js +100 -48
- package/commands/learnship/challenge.md +22 -0
- package/commands/learnship/compound.md +22 -0
- package/commands/learnship/guard.md +21 -0
- package/commands/learnship/ideate.md +23 -0
- package/commands/learnship/review.md +23 -0
- package/commands/learnship/ship.md +21 -0
- package/commands/learnship/sync-docs.md +21 -0
- package/cursor-rules/learnship.mdc +7 -0
- package/gemini-extension.json +2 -2
- package/learnship/agents/challenger.md +52 -0
- package/learnship/agents/code-reviewer.md +81 -0
- package/learnship/agents/executor.md +15 -0
- package/learnship/agents/ideation-agent.md +54 -0
- package/learnship/agents/plan-checker.md +95 -0
- package/learnship/agents/solution-writer.md +64 -0
- package/learnship/references/model-profiles.md +41 -33
- package/learnship/references/planning-config.md +49 -0
- package/learnship/references/solution-schema.md +159 -0
- package/learnship/templates/agents.md +6 -1
- package/learnship/workflows/challenge.md +189 -0
- package/learnship/workflows/complete-milestone.md +9 -0
- package/learnship/workflows/compound.md +305 -0
- package/learnship/workflows/debug.md +7 -0
- package/learnship/workflows/discuss-milestone.md +5 -0
- package/learnship/workflows/execute-phase.md +24 -0
- package/learnship/workflows/guard.md +164 -0
- package/learnship/workflows/help.md +14 -2
- package/learnship/workflows/ideate.md +182 -0
- package/learnship/workflows/knowledge-base.md +8 -0
- package/learnship/workflows/ls.md +7 -3
- package/learnship/workflows/milestone-retrospective.md +45 -0
- package/learnship/workflows/new-project.md +5 -3
- package/learnship/workflows/next.md +3 -2
- package/learnship/workflows/plan-phase.md +23 -0
- package/learnship/workflows/progress.md +9 -3
- package/learnship/workflows/review.md +226 -0
- package/learnship/workflows/set-profile.md +6 -6
- package/learnship/workflows/settings.md +8 -8
- package/learnship/workflows/ship.md +219 -0
- package/learnship/workflows/sync-docs.md +159 -0
- package/learnship/workflows/sync-upstream-skills.md +10 -10
- package/learnship/workflows/validate-phase.md +4 -4
- package/learnship/workflows/verify-work.md +3 -0
- package/package.json +1 -1
- package/references/model-profiles.md +41 -33
- package/templates/config.json +13 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Multi-persona code review — correctness, testing, security, performance, maintainability
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Review
|
|
6
|
+
|
|
7
|
+
Multi-persona code review that examines changes through six lenses: correctness, testing, security, performance, maintainability, and adversarial. Produces a severity-ranked findings report with confidence scores.
|
|
8
|
+
|
|
9
|
+
**Usage:** `review` — review current branch changes
|
|
10
|
+
**Usage:** `review [mode]` — modes: `interactive` (default), `report-only`, `autofix`
|
|
11
|
+
|
|
12
|
+
**Sequencing:** Run after `verify-work` (spec compliance) and before `/ship` (deploy pipeline).
|
|
13
|
+
|
|
14
|
+
## Step 1: Determine Scope
|
|
15
|
+
|
|
16
|
+
Compute the diff:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Detect base branch
|
|
20
|
+
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
|
|
21
|
+
[ -z "$BASE_BRANCH" ] && BASE_BRANCH="main"
|
|
22
|
+
|
|
23
|
+
# Get current branch
|
|
24
|
+
CURRENT=$(git rev-parse --abbrev-ref HEAD)
|
|
25
|
+
|
|
26
|
+
# Compute diff
|
|
27
|
+
git fetch origin "$BASE_BRANCH" --quiet 2>/dev/null
|
|
28
|
+
BASE=$(git merge-base "origin/$BASE_BRANCH" HEAD 2>/dev/null || echo "origin/$BASE_BRANCH")
|
|
29
|
+
echo "FILES:" && git diff --name-only $BASE
|
|
30
|
+
echo "DIFF:" && git diff -U10 $BASE
|
|
31
|
+
echo "STATS:" && git diff --stat $BASE
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If no diff found: "Nothing to review — no changes against $BASE_BRANCH." Stop.
|
|
35
|
+
|
|
36
|
+
## Step 2: Discover Intent
|
|
37
|
+
|
|
38
|
+
Understand what the change is trying to accomplish:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
echo "BRANCH:" && git rev-parse --abbrev-ref HEAD
|
|
42
|
+
echo "COMMITS:" && git log --oneline ${BASE}..HEAD
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Combined with conversation context and any SUMMARY.md files from the current phase, write a 2-3 line intent summary:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Intent: [what the changes are trying to accomplish]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Step 3: Select Personas
|
|
52
|
+
|
|
53
|
+
Read the diff and file list. Select which review personas to activate:
|
|
54
|
+
|
|
55
|
+
**Always-on (every review):**
|
|
56
|
+
|
|
57
|
+
| Persona | Focus |
|
|
58
|
+
|---------|-------|
|
|
59
|
+
| **correctness** | Logic errors, edge cases, state bugs, error propagation |
|
|
60
|
+
| **testing** | Coverage gaps, weak assertions, brittle tests |
|
|
61
|
+
| **maintainability** | Coupling, complexity, naming, dead code, abstraction debt |
|
|
62
|
+
|
|
63
|
+
**Conditional (selected per diff):**
|
|
64
|
+
|
|
65
|
+
| Persona | Select when diff touches... |
|
|
66
|
+
|---------|---------------------------|
|
|
67
|
+
| **security** | Auth, public endpoints, user input, permissions, secrets |
|
|
68
|
+
| **performance** | DB queries, data transforms, caching, async, loops |
|
|
69
|
+
| **adversarial** | Diff ≥50 changed non-test lines, or auth/payments/data mutations |
|
|
70
|
+
|
|
71
|
+
**Brownfield enhancement:** If `.planning/codebase/CONVENTIONS.md` exists, the maintainability persona reads it for project-specific patterns.
|
|
72
|
+
|
|
73
|
+
Announce the review team:
|
|
74
|
+
```
|
|
75
|
+
Review team:
|
|
76
|
+
- correctness (always)
|
|
77
|
+
- testing (always)
|
|
78
|
+
- maintainability (always)
|
|
79
|
+
- security — [justification if selected]
|
|
80
|
+
- performance — [justification if selected]
|
|
81
|
+
- adversarial — [justification if selected]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Step 4: Run Review
|
|
85
|
+
|
|
86
|
+
Read `parallelization` from `.planning/config.json` (defaults to `false`).
|
|
87
|
+
|
|
88
|
+
**If `parallelization` is `true` (subagent mode — Claude Code, OpenCode, Codex):**
|
|
89
|
+
|
|
90
|
+
Spawn a dedicated code-reviewer agent for each selected persona:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Task(
|
|
94
|
+
subagent_type="learnship-code-reviewer",
|
|
95
|
+
prompt="
|
|
96
|
+
<objective>
|
|
97
|
+
Review the following diff as the [PERSONA] reviewer.
|
|
98
|
+
Focus: [persona-specific focus areas]
|
|
99
|
+
Return findings as structured text with severity (P0-P3) and confidence (0.0-1.0).
|
|
100
|
+
Do NOT edit any files. Read-only review.
|
|
101
|
+
</objective>
|
|
102
|
+
|
|
103
|
+
<context>
|
|
104
|
+
Intent: [intent summary]
|
|
105
|
+
Files: [file list]
|
|
106
|
+
Diff: [diff content]
|
|
107
|
+
[If maintainability + CONVENTIONS.md exists: include conventions]
|
|
108
|
+
</context>
|
|
109
|
+
"
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Wait for all personas to complete.
|
|
114
|
+
|
|
115
|
+
**If `parallelization` is `false` (sequential mode):**
|
|
116
|
+
|
|
117
|
+
Using `@./agents/code-reviewer.md` as your review persona, run each selected persona sequentially. For each persona:
|
|
118
|
+
|
|
119
|
+
1. Adopt the persona's focus lens
|
|
120
|
+
2. Read the diff through that lens
|
|
121
|
+
3. Record findings with severity and confidence
|
|
122
|
+
|
|
123
|
+
## Step 5: Merge & Deduplicate Findings
|
|
124
|
+
|
|
125
|
+
Combine findings from all personas:
|
|
126
|
+
|
|
127
|
+
1. **Confidence gate** — suppress findings below 0.60 confidence. Exception: P0 findings at 0.50+ survive.
|
|
128
|
+
2. **Deduplicate** — when multiple personas flag the same issue (same file + nearby lines + similar title), merge: keep highest severity, keep highest confidence, note which personas flagged it.
|
|
129
|
+
3. **Cross-persona agreement** — when 2+ personas flag the same issue, boost confidence by 0.10 (capped at 1.0).
|
|
130
|
+
4. **Sort** — order by severity (P0 first) → confidence (descending) → file path → line number.
|
|
131
|
+
|
|
132
|
+
## Step 6: Present Report
|
|
133
|
+
|
|
134
|
+
### Severity Scale
|
|
135
|
+
|
|
136
|
+
| Level | Meaning | Action |
|
|
137
|
+
|-------|---------|--------|
|
|
138
|
+
| **P0** | Critical breakage, exploitable vulnerability, data loss | Must fix before merge |
|
|
139
|
+
| **P1** | High-impact defect likely hit in normal usage | Should fix |
|
|
140
|
+
| **P2** | Moderate issue — edge case, perf regression, maintainability trap | Fix if straightforward |
|
|
141
|
+
| **P3** | Low-impact, minor improvement | Discretion |
|
|
142
|
+
|
|
143
|
+
Display:
|
|
144
|
+
```
|
|
145
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
146
|
+
learnship ► CODE REVIEW COMPLETE
|
|
147
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
148
|
+
|
|
149
|
+
Intent: [intent summary]
|
|
150
|
+
Reviewers: [list]
|
|
151
|
+
Mode: [interactive | report-only | autofix]
|
|
152
|
+
|
|
153
|
+
## Findings
|
|
154
|
+
|
|
155
|
+
### P0 — Critical
|
|
156
|
+
| # | File | Issue | Reviewer(s) | Confidence |
|
|
157
|
+
|---|------|-------|-------------|------------|
|
|
158
|
+
| 1 | [file:line] | [issue] | [personas] | [0.XX] |
|
|
159
|
+
|
|
160
|
+
### P1 — High
|
|
161
|
+
[table or "None"]
|
|
162
|
+
|
|
163
|
+
### P2 — Moderate
|
|
164
|
+
[table or "None"]
|
|
165
|
+
|
|
166
|
+
### P3 — Low
|
|
167
|
+
[table or "None"]
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Verdict
|
|
172
|
+
|
|
173
|
+
[PASS — no P0/P1 findings]
|
|
174
|
+
[PASS WITH CONCERNS — P1 findings present but manageable]
|
|
175
|
+
[FAIL — P0 findings must be resolved before merge]
|
|
176
|
+
|
|
177
|
+
Total: [N] findings ([P0 count] critical, [P1 count] high, [P2 count] moderate, [P3 count] low)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Step 7: Handle Mode
|
|
181
|
+
|
|
182
|
+
**Interactive (default):**
|
|
183
|
+
For each P0/P1 finding, ask: "Fix this now, or defer?"
|
|
184
|
+
- **Fix now** → apply the fix, commit
|
|
185
|
+
- **Defer** → note in report
|
|
186
|
+
|
|
187
|
+
**Report-only:**
|
|
188
|
+
Display the report. No edits, no commits. Stop.
|
|
189
|
+
|
|
190
|
+
**Autofix:**
|
|
191
|
+
Apply fixes for P0/P1 findings automatically where the fix is deterministic and safe. Commit each fix:
|
|
192
|
+
```bash
|
|
193
|
+
git add [files]
|
|
194
|
+
git commit -m "fix([scope]): [description from finding]"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Step 8: Suggest Next Steps
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
▶ Next steps:
|
|
201
|
+
- /ship — run the ship pipeline (test → lint → commit → push → PR)
|
|
202
|
+
- /compound — capture any notable patterns from the review
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Config Options
|
|
208
|
+
|
|
209
|
+
- `"workflow.review": true` — enable/disable the review workflow
|
|
210
|
+
- `"review.auto_after_verify": false` — automatically run review after verify-work passes
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Learning Checkpoint
|
|
215
|
+
|
|
216
|
+
Read `learning_mode` from `.planning/config.json`.
|
|
217
|
+
|
|
218
|
+
**If `auto`:** After review, offer:
|
|
219
|
+
|
|
220
|
+
> 💡 **Learning moment:** Code review is one of the highest-signal learning activities:
|
|
221
|
+
>
|
|
222
|
+
> `@agentic-learning learn [finding domain]` — Active retrieval on the concept behind the most significant finding. Why did it happen? How would you catch it earlier?
|
|
223
|
+
>
|
|
224
|
+
> `@agentic-learning quiz [codebase area]` — Test your understanding of the code area that had the most findings. Gaps in recall predict future bugs.
|
|
225
|
+
|
|
226
|
+
**If `manual`:** Add quietly: *"Tip: `@agentic-learning learn [domain]` to turn review findings into lasting patterns."*
|
|
@@ -15,9 +15,9 @@ If no argument provided:
|
|
|
15
15
|
Usage: set-profile [profile]
|
|
16
16
|
|
|
17
17
|
Profiles:
|
|
18
|
-
quality —
|
|
19
|
-
balanced —
|
|
20
|
-
budget —
|
|
18
|
+
quality — large-tier models for all agents (highest quality, highest cost)
|
|
19
|
+
balanced — large for planning, medium for execution (recommended)
|
|
20
|
+
budget — medium for writing, small for research/verification (lowest cost)
|
|
21
21
|
|
|
22
22
|
Current profile: [read from .planning/config.json]
|
|
23
23
|
```
|
|
@@ -70,9 +70,9 @@ git commit -m "chore(config): set model profile to [profile]"
|
|
|
70
70
|
```
|
|
71
71
|
Profile updated: [old] → [profile]
|
|
72
72
|
|
|
73
|
-
[quality] —
|
|
74
|
-
[balanced] —
|
|
75
|
-
[budget] —
|
|
73
|
+
[quality] — Large-tier agents for all tasks. Use for production milestones.
|
|
74
|
+
[balanced] — Large for planning, medium for execution. Best default.
|
|
75
|
+
[budget] — Medium/small tier. Use for prototyping or exploration.
|
|
76
76
|
|
|
77
77
|
Takes effect immediately on the next workflow run.
|
|
78
78
|
```
|
|
@@ -30,7 +30,7 @@ cp templates/config.json .planning/config.json 2>/dev/null || cat > .planning/co
|
|
|
30
30
|
"research": true,
|
|
31
31
|
"plan_check": true,
|
|
32
32
|
"verifier": true,
|
|
33
|
-
"
|
|
33
|
+
"validation": true
|
|
34
34
|
},
|
|
35
35
|
"git": {
|
|
36
36
|
"branching_strategy": "none",
|
|
@@ -67,7 +67,7 @@ Current configuration:
|
|
|
67
67
|
[5] Research agent: [on/off]
|
|
68
68
|
[6] Plan check agent: [on/off]
|
|
69
69
|
[7] Verifier agent: [on/off]
|
|
70
|
-
[8]
|
|
70
|
+
[8] Test validation: [on/off]
|
|
71
71
|
[9] Git branching: [current] (none | phase | milestone)
|
|
72
72
|
[10] Commit docs: [on/off]
|
|
73
73
|
|
|
@@ -102,9 +102,9 @@ Current: [current]. New value?
|
|
|
102
102
|
**[3] Model profile:**
|
|
103
103
|
```
|
|
104
104
|
Model profile controls which model tier each agent uses:
|
|
105
|
-
- quality:
|
|
106
|
-
- balanced:
|
|
107
|
-
- budget:
|
|
105
|
+
- quality: large-tier for all decision-making agents (highest cost, best results)
|
|
106
|
+
- balanced: large for planning, medium for execution (default — good balance)
|
|
107
|
+
- budget: medium for writing code, small for research/verification (lowest cost)
|
|
108
108
|
|
|
109
109
|
Current: [current]. New value?
|
|
110
110
|
```
|
|
@@ -127,9 +127,9 @@ Current: [current]. New value?
|
|
|
127
127
|
Current: [current]. New value? (on/off)
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
**[8]
|
|
130
|
+
**[8] Test validation:**
|
|
131
131
|
```
|
|
132
|
-
|
|
132
|
+
Test validation maps automated test coverage to requirements during plan-phase.
|
|
133
133
|
- on: plans include automated verify commands per task (recommended)
|
|
134
134
|
- off: skip validation research (good for rapid prototyping)
|
|
135
135
|
|
|
@@ -174,7 +174,7 @@ cat > .planning/config.json << EOF
|
|
|
174
174
|
"research": [true/false],
|
|
175
175
|
"plan_check": [true/false],
|
|
176
176
|
"verifier": [true/false],
|
|
177
|
-
"
|
|
177
|
+
"validation": [true/false]
|
|
178
178
|
},
|
|
179
179
|
"git": {
|
|
180
180
|
"branching_strategy": "[value]",
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Ship pipeline — test, lint, commit, push, PR
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Ship
|
|
6
|
+
|
|
7
|
+
End-to-end ship pipeline: detect test runner → run tests → lint → stage → conventional commit → push → create PR with auto-description. Closes the loop from verified code to production-ready PR.
|
|
8
|
+
|
|
9
|
+
**Usage:** `ship` — run the full ship pipeline
|
|
10
|
+
**Usage:** `ship --skip-tests` — skip test execution (use when tests were just run)
|
|
11
|
+
|
|
12
|
+
**Sequencing:** Run after `/review` (code quality) and before `/compound` (capture learnings).
|
|
13
|
+
|
|
14
|
+
## Step 1: Pre-flight Check
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Current branch
|
|
18
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
19
|
+
echo "Branch: $BRANCH"
|
|
20
|
+
|
|
21
|
+
# Check we're not on main/master
|
|
22
|
+
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
|
|
23
|
+
echo "ERROR: Cannot ship from $BRANCH. Create a feature branch first."
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Check for uncommitted changes
|
|
28
|
+
git status --porcelain
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If uncommitted changes exist, ask: "You have uncommitted changes. Stage and commit them as part of the ship, or stash first?"
|
|
32
|
+
|
|
33
|
+
## Step 2: Run Tests
|
|
34
|
+
|
|
35
|
+
**Skip if:** `--skip-tests` flag, or `ship.auto_test` is `false` in config.
|
|
36
|
+
|
|
37
|
+
Detect the test runner:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Check for common test runners
|
|
41
|
+
[ -f "package.json" ] && grep -q '"test"' package.json && echo "npm test"
|
|
42
|
+
[ -f "Makefile" ] && grep -q '^test:' Makefile && echo "make test"
|
|
43
|
+
[ -f "pytest.ini" ] || [ -f "setup.cfg" ] && echo "pytest"
|
|
44
|
+
[ -f "Cargo.toml" ] && echo "cargo test"
|
|
45
|
+
[ -f "go.mod" ] && echo "go test ./..."
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Run the detected test command:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
[detected test command]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If tests fail:
|
|
55
|
+
```
|
|
56
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
57
|
+
learnship ► TESTS FAILED — SHIP ABORTED
|
|
58
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
59
|
+
|
|
60
|
+
[test output]
|
|
61
|
+
|
|
62
|
+
Fix the failing tests, then run /ship again.
|
|
63
|
+
▶ Or: /debug [test failure description]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Stop. Do not proceed with a failing test suite.
|
|
67
|
+
|
|
68
|
+
## Step 3: Lint (Optional)
|
|
69
|
+
|
|
70
|
+
Detect and run the linter if available:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
[ -f "package.json" ] && grep -q '"lint"' package.json && echo "npm run lint"
|
|
74
|
+
[ -f ".eslintrc" ] || [ -f ".eslintrc.json" ] || [ -f ".eslintrc.js" ] && echo "npx eslint ."
|
|
75
|
+
[ -f "pyproject.toml" ] && grep -q "ruff" pyproject.toml && echo "ruff check ."
|
|
76
|
+
[ -f ".rubocop.yml" ] && echo "rubocop"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If linter found, run it. Report warnings but don't block on them. Block on errors.
|
|
80
|
+
|
|
81
|
+
## Step 4: Stage Changes
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Show what will be committed
|
|
85
|
+
git diff --stat
|
|
86
|
+
|
|
87
|
+
# Stage all tracked changes
|
|
88
|
+
git add -u
|
|
89
|
+
|
|
90
|
+
# Check for untracked files that should be included
|
|
91
|
+
UNTRACKED=$(git ls-files --others --exclude-standard)
|
|
92
|
+
if [ -n "$UNTRACKED" ]; then
|
|
93
|
+
echo "Untracked files found:"
|
|
94
|
+
echo "$UNTRACKED"
|
|
95
|
+
fi
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If untracked files exist, ask: "These files are new and untracked. Include them in the commit?"
|
|
99
|
+
- **Yes, include all** → `git add .`
|
|
100
|
+
- **Let me choose** → present list, user selects
|
|
101
|
+
- **No, skip them** → proceed with tracked only
|
|
102
|
+
|
|
103
|
+
## Step 5: Conventional Commit
|
|
104
|
+
|
|
105
|
+
**If `ship.conventional_commits` is `true` in config (default: `true`):**
|
|
106
|
+
|
|
107
|
+
Analyze the staged changes to determine the commit type:
|
|
108
|
+
|
|
109
|
+
| Type | When |
|
|
110
|
+
|------|------|
|
|
111
|
+
| `feat` | New feature or capability |
|
|
112
|
+
| `fix` | Bug fix |
|
|
113
|
+
| `docs` | Documentation only |
|
|
114
|
+
| `style` | Formatting, no logic change |
|
|
115
|
+
| `refactor` | Code restructuring, no behavior change |
|
|
116
|
+
| `test` | Adding or updating tests |
|
|
117
|
+
| `chore` | Build, config, tooling |
|
|
118
|
+
|
|
119
|
+
Generate the commit message:
|
|
120
|
+
```
|
|
121
|
+
[type]([scope]): [short description]
|
|
122
|
+
|
|
123
|
+
[optional body — what changed and why, max 3 lines]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Present the proposed commit message. Ask: "Use this commit message, or edit?"
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
git commit -m "[commit message]"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Step 6: Push
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
git push origin $BRANCH
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If this is the first push for the branch:
|
|
139
|
+
```bash
|
|
140
|
+
git push -u origin $BRANCH
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Step 7: Create PR
|
|
144
|
+
|
|
145
|
+
**If `ship.pr_template` is `true` in config (default: `true`):**
|
|
146
|
+
|
|
147
|
+
Auto-generate the PR description from:
|
|
148
|
+
- Commit messages on the branch
|
|
149
|
+
- SUMMARY.md files from the current phase (if exists)
|
|
150
|
+
- Test results from Step 2
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Get base branch
|
|
154
|
+
BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
|
|
155
|
+
[ -z "$BASE_BRANCH" ] && BASE_BRANCH="main"
|
|
156
|
+
|
|
157
|
+
# Get commit log for PR body
|
|
158
|
+
COMMITS=$(git log --oneline origin/$BASE_BRANCH..HEAD)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Create the PR using available tooling:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# GitHub CLI
|
|
165
|
+
gh pr create --base "$BASE_BRANCH" --head "$BRANCH" --title "[type]([scope]): [description]" --body "[auto-generated description]"
|
|
166
|
+
|
|
167
|
+
# Or if gh not available, output the PR URL
|
|
168
|
+
echo "Create PR: https://github.com/[org]/[repo]/compare/$BASE_BRANCH...$BRANCH"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Step 8: Confirm
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
175
|
+
learnship ► SHIPPED ✓
|
|
176
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
177
|
+
|
|
178
|
+
Branch: [branch]
|
|
179
|
+
Tests: passed ✓
|
|
180
|
+
Lint: passed ✓ | skipped
|
|
181
|
+
Commit: [hash] [type]([scope]): [description]
|
|
182
|
+
PR: [URL]
|
|
183
|
+
|
|
184
|
+
💡 Compound this work? Run `/compound` to capture any notable solutions
|
|
185
|
+
or patterns while context is fresh.
|
|
186
|
+
|
|
187
|
+
▶ Next steps:
|
|
188
|
+
- Review the PR and request reviews
|
|
189
|
+
- /compound — capture learnings from this work
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Config Options
|
|
195
|
+
|
|
196
|
+
- `"ship.auto_test": true` — run tests before shipping
|
|
197
|
+
- `"ship.conventional_commits": true` — use conventional commit format
|
|
198
|
+
- `"ship.pr_template": true` — auto-generate PR description
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Integration Points
|
|
203
|
+
|
|
204
|
+
- `verify-work` banner: "▶ Next: /ship" after UAT passes
|
|
205
|
+
- `complete-milestone`: "Did you /ship first?" if unshipped changes exist
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Learning Checkpoint
|
|
210
|
+
|
|
211
|
+
Read `learning_mode` from `.planning/config.json`.
|
|
212
|
+
|
|
213
|
+
**If `auto`:** After shipping, offer:
|
|
214
|
+
|
|
215
|
+
> 💡 **Learning moment:** Shipping is a natural reflection point:
|
|
216
|
+
>
|
|
217
|
+
> `@agentic-learning reflect` — What went well in this phase? What would you do differently? Reflection after shipping cements the lessons before context fades.
|
|
218
|
+
|
|
219
|
+
**If `manual`:** Add quietly: *"Tip: `@agentic-learning reflect` to consolidate lessons from this shipping cycle."*
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Detect stale documentation after code changes
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Sync Docs
|
|
6
|
+
|
|
7
|
+
Scan documentation against recent code changes to detect stale sections, outdated references, and drift between docs and implementation. Auto-update simple cases, flag complex ones for manual review.
|
|
8
|
+
|
|
9
|
+
**Usage:** `sync-docs` — scan all docs for staleness
|
|
10
|
+
**Usage:** `sync-docs [path]` — scan docs for a specific module or directory
|
|
11
|
+
|
|
12
|
+
## Step 1: Discover Documentation
|
|
13
|
+
|
|
14
|
+
Find all documentation files in the project:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# README and top-level docs
|
|
18
|
+
find . -maxdepth 1 -name "*.md" -type f 2>/dev/null
|
|
19
|
+
|
|
20
|
+
# Docs directory
|
|
21
|
+
find docs/ -name "*.md" -type f 2>/dev/null
|
|
22
|
+
|
|
23
|
+
# API docs, guides, etc.
|
|
24
|
+
find . -path "*/docs/*" -name "*.md" -type f 2>/dev/null | head -30
|
|
25
|
+
|
|
26
|
+
# Planning docs
|
|
27
|
+
find .planning/ -name "*.md" -type f 2>/dev/null | grep -v "phases\|debug\|milestones" | head -20
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If a path argument was provided, narrow the scan to docs related to that module.
|
|
31
|
+
|
|
32
|
+
## Step 2: Identify Recent Changes
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Get files changed in last 30 commits
|
|
36
|
+
git log --oneline -30 --format="" --name-only | sort -u
|
|
37
|
+
|
|
38
|
+
# Get files changed since last tag/release
|
|
39
|
+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
|
|
40
|
+
if [ -n "$LAST_TAG" ]; then
|
|
41
|
+
git diff --name-only "$LAST_TAG"..HEAD
|
|
42
|
+
fi
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Map changed source files to their documentation:
|
|
46
|
+
- `src/auth/` changes → check docs mentioning auth, authentication, login
|
|
47
|
+
- API route changes → check API documentation
|
|
48
|
+
- Config changes → check setup/installation docs
|
|
49
|
+
- Schema changes → check data model docs
|
|
50
|
+
|
|
51
|
+
## Step 3: Scan for Staleness
|
|
52
|
+
|
|
53
|
+
For each documentation file, check:
|
|
54
|
+
|
|
55
|
+
1. **Dead references** — does the doc reference files, functions, or APIs that no longer exist?
|
|
56
|
+
```bash
|
|
57
|
+
# Extract code references from doc (backtick-wrapped paths, function names)
|
|
58
|
+
grep -oE '`[^`]+\.(ts|js|py|rb|go)`' [doc_file] 2>/dev/null
|
|
59
|
+
# Check if referenced files exist
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. **Outdated descriptions** — does the doc describe behavior that's changed?
|
|
63
|
+
- Compare doc descriptions against actual code behavior
|
|
64
|
+
- Check version numbers, dependency names, command syntax
|
|
65
|
+
|
|
66
|
+
3. **Missing coverage** — are there new files/features with no documentation?
|
|
67
|
+
```bash
|
|
68
|
+
# Find source files with no corresponding doc mention
|
|
69
|
+
for file in $(git log --oneline -30 --format="" --name-only | sort -u | grep -E '\.(ts|js|py|rb|go)$'); do
|
|
70
|
+
BASENAME=$(basename "$file" | sed 's/\.[^.]*$//')
|
|
71
|
+
grep -ril "$BASENAME" docs/ 2>/dev/null | wc -l | tr -d ' '
|
|
72
|
+
done
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Step 4: Report Findings
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
79
|
+
learnship ► DOC SYNC REPORT
|
|
80
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
|
|
82
|
+
Scanned: [N] documentation files
|
|
83
|
+
Changes since: [last tag or last 30 commits]
|
|
84
|
+
|
|
85
|
+
## Stale Sections
|
|
86
|
+
|
|
87
|
+
| Doc | Section | Issue | Severity |
|
|
88
|
+
|-----|---------|-------|----------|
|
|
89
|
+
| [file] | [heading] | [what's wrong] | high/medium/low |
|
|
90
|
+
|
|
91
|
+
## Dead References
|
|
92
|
+
|
|
93
|
+
| Doc | Reference | Status |
|
|
94
|
+
|-----|-----------|--------|
|
|
95
|
+
| [file] | `[reference]` | removed / renamed to [new name] |
|
|
96
|
+
|
|
97
|
+
## Missing Documentation
|
|
98
|
+
|
|
99
|
+
| New File/Feature | Suggested Doc |
|
|
100
|
+
|------------------|---------------|
|
|
101
|
+
| [file] | Add to [existing doc] or create new |
|
|
102
|
+
|
|
103
|
+
## Auto-Fixable
|
|
104
|
+
|
|
105
|
+
[N] issues can be auto-fixed (renamed references, updated paths)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Step 5: Auto-Fix Simple Cases
|
|
109
|
+
|
|
110
|
+
For issues that can be fixed automatically (renamed files, updated paths, version numbers):
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Apply fixes
|
|
114
|
+
sed -i 's/old_reference/new_reference/g' [doc_file]
|
|
115
|
+
|
|
116
|
+
git add [fixed files]
|
|
117
|
+
git commit -m "docs: sync — fix [N] stale references"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
For complex issues (rewritten behavior, new feature descriptions), present to user:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
These [N] issues need manual review:
|
|
124
|
+
1. [doc]: [section] — [what needs updating and why]
|
|
125
|
+
2. [doc]: [section] — [what needs updating and why]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Step 6: Confirm
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
132
|
+
learnship ► DOC SYNC COMPLETE ✓
|
|
133
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
134
|
+
|
|
135
|
+
Auto-fixed: [N] issues
|
|
136
|
+
Manual review needed: [M] issues
|
|
137
|
+
Missing docs: [K] new features without documentation
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Integration Points
|
|
143
|
+
|
|
144
|
+
- `complete-milestone`: optionally run `/sync-docs` before releasing
|
|
145
|
+
- `release`: suggest `/sync-docs` as pre-release checklist item
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Learning Checkpoint
|
|
150
|
+
|
|
151
|
+
Read `learning_mode` from `.planning/config.json`.
|
|
152
|
+
|
|
153
|
+
**If `auto`:** After sync, offer:
|
|
154
|
+
|
|
155
|
+
> 💡 **Learning moment:** Documentation drift is a signal about process:
|
|
156
|
+
>
|
|
157
|
+
> `@agentic-learning reflect` — Why did these docs get stale? Is there a pattern (e.g., docs always lag behind API changes)? Reflecting on the drift pattern prevents it next time.
|
|
158
|
+
|
|
159
|
+
**If `manual`:** Add quietly: *"Tip: `@agentic-learning reflect` to understand why docs drifted and prevent it."*
|