@kleber.mottajr/juninho 1.3.0 → 2.0.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/README.md +14 -15
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +57 -3
- package/dist/config.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +159 -53
- package/dist/installer.js.map +1 -1
- package/dist/project-types.d.ts.map +1 -1
- package/dist/project-types.js +6 -0
- package/dist/project-types.js.map +1 -1
- package/dist/templates/agents.d.ts.map +1 -1
- package/dist/templates/agents.js +925 -162
- package/dist/templates/agents.js.map +1 -1
- package/dist/templates/commands.d.ts.map +1 -1
- package/dist/templates/commands.js +747 -626
- package/dist/templates/commands.js.map +1 -1
- package/dist/templates/docs.d.ts.map +1 -1
- package/dist/templates/docs.js +49 -24
- package/dist/templates/docs.js.map +1 -1
- package/dist/templates/lib.d.ts +2 -0
- package/dist/templates/lib.d.ts.map +1 -0
- package/dist/templates/lib.js +506 -0
- package/dist/templates/lib.js.map +1 -0
- package/dist/templates/plugins.d.ts.map +1 -1
- package/dist/templates/plugins.js +2530 -856
- package/dist/templates/plugins.js.map +1 -1
- package/dist/templates/skills.d.ts.map +1 -1
- package/dist/templates/skills.js +30 -0
- package/dist/templates/skills.js.map +1 -1
- package/dist/templates/state.d.ts.map +1 -1
- package/dist/templates/state.js +159 -186
- package/dist/templates/state.js.map +1 -1
- package/dist/templates/support-scripts.d.ts.map +1 -1
- package/dist/templates/support-scripts.js +1014 -249
- package/dist/templates/support-scripts.js.map +1 -1
- package/package.json +8 -2
|
@@ -12,7 +12,6 @@ function writeCommands(projectDir) {
|
|
|
12
12
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.spec.md"), SPEC);
|
|
13
13
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.implement.md"), IMPLEMENT);
|
|
14
14
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.sync-docs.md"), SYNC_DOCS);
|
|
15
|
-
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.init-deep.md"), INIT_DEEP);
|
|
16
15
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.start-work.md"), START_WORK);
|
|
17
16
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.handoff.md"), HANDOFF);
|
|
18
17
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.ulw-loop.md"), ULW_LOOP);
|
|
@@ -25,656 +24,778 @@ function writeCommands(projectDir) {
|
|
|
25
24
|
(0, fs_1.writeFileSync)(path_1.default.join(commandsDir, "j.finish-setup.md"), FINISH_SETUP);
|
|
26
25
|
}
|
|
27
26
|
// ─── /plan ────────────────────────────────────────────────────────────────────
|
|
28
|
-
const PLAN = `# /plan — Strategic Planning
|
|
29
|
-
|
|
30
|
-
Invoke the \`@j.planner\` agent to create an actionable plan from a goal.
|
|
31
|
-
|
|
32
|
-
## Usage
|
|
33
|
-
|
|
34
|
-
\`\`\`
|
|
35
|
-
/j.plan <goal or task description>
|
|
36
|
-
\`\`\`
|
|
37
|
-
|
|
38
|
-
## Examples
|
|
39
|
-
|
|
40
|
-
\`\`\`
|
|
41
|
-
/j.plan add user authentication with email and Google OAuth
|
|
42
|
-
/j.plan fix the N+1 query bug in the appointments list
|
|
43
|
-
/j.plan refactor the service layer to use the repository pattern
|
|
44
|
-
\`\`\`
|
|
45
|
-
|
|
46
|
-
## What happens
|
|
47
|
-
|
|
48
|
-
1. \`@j.planner\` classifies your intent
|
|
49
|
-
2. Explores the codebase for context
|
|
50
|
-
3.
|
|
51
|
-
4.
|
|
52
|
-
5.
|
|
53
|
-
6.
|
|
54
|
-
7.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
27
|
+
const PLAN = `# /plan — Strategic Planning
|
|
28
|
+
|
|
29
|
+
Invoke the \`@j.planner\` agent to create an actionable plan from a goal.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
\`\`\`
|
|
34
|
+
/j.plan <goal or task description>
|
|
35
|
+
\`\`\`
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
\`\`\`
|
|
40
|
+
/j.plan add user authentication with email and Google OAuth
|
|
41
|
+
/j.plan fix the N+1 query bug in the appointments list
|
|
42
|
+
/j.plan refactor the service layer to use the repository pattern
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
## What happens
|
|
46
|
+
|
|
47
|
+
1. \`@j.planner\` classifies your intent
|
|
48
|
+
2. Explores the codebase for context across all involved repositories
|
|
49
|
+
3. Uses project rules, domain docs, and principle docs relevant to the goal before fixing the plan
|
|
50
|
+
4. Classifies repositories into **write targets** (repos with code changes) and **reference projects** (read-only context)
|
|
51
|
+
5. Interviews you (proportional to complexity)
|
|
52
|
+
6. Writes \`plan.md\` and \`CONTEXT.md\` into each write target project's \`\$REPO_ROOT/docs/specs/{feature-slug}/\`
|
|
53
|
+
7. Writes \`active-plan.json\` with all \`writeTargets\` and their \`targetRepoRoot\` paths
|
|
54
|
+
8. Spawns \`@j.plan-reviewer\` for automated quality check
|
|
55
|
+
9. **Presents the plan to you for explicit approval**
|
|
56
|
+
10. Marks plan as ready for \`/j.implement\` (only after your approval)
|
|
57
|
+
11. If a later \`/j.check\` pass finds required changes after a task is already COMPLETE, the planner should express that work as a new follow-up task instead of reopening the completed one
|
|
58
|
+
|
|
59
|
+
## Delegation Rule (MANDATORY)
|
|
60
|
+
|
|
61
|
+
You MUST delegate this task to \`@j.planner\` using the \`task()\` tool.
|
|
62
|
+
Do NOT perform the planning yourself — you are the orchestrator, not the executor.
|
|
63
|
+
|
|
64
|
+
When ANY sub-agent returns output:
|
|
65
|
+
- NEVER dismiss it as "incomplete" or "the agent didn't do what was asked"
|
|
66
|
+
- NEVER say "I'll continue myself" and take over the sub-agent's job
|
|
67
|
+
- Sub-agent unknowns/ambiguities are VALUABLE DATA — forward them to the user via \`question\` tool
|
|
68
|
+
- If the sub-agent's report has gaps, pass those gaps to the user as questions — do NOT fill them yourself
|
|
69
|
+
|
|
70
|
+
## After planning
|
|
71
|
+
|
|
72
|
+
Run \`/j.implement\` to execute the plan, or \`/j.spec\` first for complex features.
|
|
70
73
|
`;
|
|
71
74
|
// ─── /spec ────────────────────────────────────────────────────────────────────
|
|
72
|
-
const SPEC = `# /spec — Feature Specification
|
|
73
|
-
|
|
74
|
-
Invoke the \`@j.spec-writer\` agent to create a detailed spec before implementation.
|
|
75
|
-
|
|
76
|
-
## Usage
|
|
77
|
-
|
|
78
|
-
\`\`\`
|
|
79
|
-
/j.spec <feature name or description>
|
|
80
|
-
\`\`\`
|
|
81
|
-
|
|
82
|
-
## Examples
|
|
83
|
-
|
|
84
|
-
\`\`\`
|
|
85
|
-
/j.spec user profile with avatar upload
|
|
86
|
-
/j.spec appointment booking flow
|
|
87
|
-
/j.spec payment integration with Stripe
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
## What happens
|
|
91
|
-
|
|
92
|
-
1. \`@j.spec-writer\` spawns \`@j.explore\` for codebase pre-research
|
|
93
|
-
2. Uses explore findings to inform a 5-phase interview:
|
|
94
|
-
- Discovery: problem and users
|
|
95
|
-
- Requirements: functional and non-functional
|
|
96
|
-
- Contract: API and interface definitions
|
|
97
|
-
- Data: schema and migration strategy
|
|
98
|
-
- Review: **presents spec for your explicit approval**
|
|
99
|
-
3.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
75
|
+
const SPEC = `# /spec — Feature Specification
|
|
76
|
+
|
|
77
|
+
Invoke the \`@j.spec-writer\` agent to create a detailed spec before implementation.
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
\`\`\`
|
|
82
|
+
/j.spec <feature name or description>
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
## Examples
|
|
86
|
+
|
|
87
|
+
\`\`\`
|
|
88
|
+
/j.spec user profile with avatar upload
|
|
89
|
+
/j.spec appointment booking flow
|
|
90
|
+
/j.spec payment integration with Stripe
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
## What happens
|
|
94
|
+
|
|
95
|
+
1. \`@j.spec-writer\` spawns \`@j.explore\` for codebase pre-research
|
|
96
|
+
2. Uses explore findings plus relevant project/domain/principle context to inform a 5-phase interview:
|
|
97
|
+
- Discovery: problem and users
|
|
98
|
+
- Requirements: functional and non-functional
|
|
99
|
+
- Contract: API and interface definitions
|
|
100
|
+
- Data: schema and migration strategy
|
|
101
|
+
- Review: **presents spec for your explicit approval**
|
|
102
|
+
3. Classifies repositories into **write targets** (repos with code changes) and **reference projects** (read-only context)
|
|
103
|
+
4. Writes spec to each write target project's \`\$REPO_ROOT/docs/specs/{feature-slug}/spec.md\` (only after your approval)
|
|
104
|
+
5. Never creates \`docs/specs/\` artifacts in reference projects unless explicitly stated
|
|
105
|
+
|
|
106
|
+
The session does NOT need to call \`@j.explore\` separately — \`@j.spec-writer\` handles its own research internally.
|
|
107
|
+
|
|
108
|
+
## Delegation Rule (MANDATORY)
|
|
109
|
+
|
|
110
|
+
You MUST delegate this task to \`@j.spec-writer\` using the \`task()\` tool.
|
|
111
|
+
Do NOT perform the spec writing yourself — you are the orchestrator, not the executor.
|
|
112
|
+
|
|
113
|
+
When ANY sub-agent returns output:
|
|
114
|
+
- NEVER dismiss it as "incomplete" or "the agent didn't do what was asked"
|
|
115
|
+
- NEVER say "I'll continue myself" and take over the sub-agent's job
|
|
116
|
+
- Sub-agent unknowns/ambiguities are VALUABLE DATA — forward them to the user via \`question\` tool
|
|
117
|
+
- If the sub-agent's report has gaps, pass those gaps to the user as questions — do NOT fill them yourself
|
|
118
|
+
|
|
119
|
+
## After spec
|
|
120
|
+
|
|
121
|
+
Run \`/j.plan\` to create an execution plan, then \`/j.implement\` to build.
|
|
117
122
|
`;
|
|
118
123
|
// ─── /implement ───────────────────────────────────────────────────────────────
|
|
119
|
-
const IMPLEMENT = `# /implement — Execute Plan or Spec
|
|
120
|
-
|
|
121
|
-
Invoke the \`@j.implementer\` agent to build what was planned or specified.
|
|
122
|
-
|
|
123
|
-
## Usage
|
|
124
|
-
|
|
125
|
-
\`\`\`
|
|
126
|
-
/j.implement
|
|
127
|
-
/j.implement <specific task or file>
|
|
128
|
-
\`\`\`
|
|
129
|
-
|
|
130
|
-
## Examples
|
|
131
|
-
|
|
132
|
-
\`\`\`
|
|
133
|
-
/j.implement
|
|
134
|
-
/j.implement the authentication middleware
|
|
135
|
-
/j.implement docs/specs/user-profile.md
|
|
136
|
-
\`\`\`
|
|
137
|
-
|
|
138
|
-
## What happens
|
|
139
|
-
|
|
140
|
-
1. \`@j.implementer\` reads the active \`plan.md\` (auto-loaded by plan-autoload plugin)
|
|
141
|
-
2. Reads \`.opencode/
|
|
142
|
-
3.
|
|
143
|
-
4.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
##
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
124
|
+
const IMPLEMENT = `# /implement — Execute Plan or Spec
|
|
125
|
+
|
|
126
|
+
Invoke the \`@j.implementer\` agent to build what was planned or specified.
|
|
127
|
+
|
|
128
|
+
## Usage
|
|
129
|
+
|
|
130
|
+
\`\`\`
|
|
131
|
+
/j.implement
|
|
132
|
+
/j.implement <specific task or file>
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
## Examples
|
|
136
|
+
|
|
137
|
+
\`\`\`
|
|
138
|
+
/j.implement
|
|
139
|
+
/j.implement the authentication middleware
|
|
140
|
+
/j.implement docs/specs/user-profile.md
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
## What happens
|
|
144
|
+
|
|
145
|
+
1. \`@j.implementer\` reads the active \`plan.md\` (auto-loaded by plan-autoload plugin).
|
|
146
|
+
2. Reads \`.opencode/juninho-config.json\` (\`workflow\` section) to understand implement, watchdog, handoff, and UNIFY behavior.
|
|
147
|
+
3. If \`/j.implement\` receives no specific task/file, it executes against the whole active plan. For multi-project plans, it must iterate all \`writeTargets\`, using each target project's own \`docs/specs/{feature-slug}/plan.md\` plus local state artifacts.
|
|
148
|
+
4. If a specific task/file is provided, it narrows scope to that target while still respecting dependencies and the latest \`check-review.md\` findings.
|
|
149
|
+
5. Creates or switches to a single canonical plan branch \`feature/{feature-slug}\` for the entire run.
|
|
150
|
+
6. Delegates each implementation task to its own task-scoped \`@j.implementer\` subagent so every task starts with a fresh context window.
|
|
151
|
+
7. Because all commits land on the same plan branch, task workers commit sequentially even when the plan has multiple tasks in the same wave.
|
|
152
|
+
8. Each task writes and refreshes its own execution lease in \`docs/specs/{feature-slug}/state/tasks/task-{id}/execution-state.md\`.
|
|
153
|
+
9. If \`workflow.implement.watchdogSessionStale\` is enabled and a spawned task never writes state or its heartbeat goes stale, the watchdog/orchestrator may launch one retry attempt for that task.
|
|
154
|
+
10. Uses the fast pre-commit path while implementing:
|
|
155
|
+
- \`.opencode/scripts/lint-structure.sh\`
|
|
156
|
+
- \`.opencode/scripts/build-verify.sh\`
|
|
157
|
+
- \`.opencode/scripts/test-related.sh\`
|
|
158
|
+
- focused test execution is routed through \`.opencode/scripts/run-test-scope.sh\`
|
|
159
|
+
11. Spawns \`@j.validator\` after each task commit to validate the just-implemented task against spec/plan intent, QA expectations, and code quality expectations within task scope.
|
|
160
|
+
12. Task state, validator state, implementer log, retry budget, and runtime metadata all live under \`docs/specs/{feature-slug}/state/\` in each task's target project repo root. Multi-project runs must keep state isolated per write target.
|
|
161
|
+
13. Canonical task commit bookkeeping is tracked in \`docs/specs/{feature-slug}/state/integration-state.json\`.
|
|
162
|
+
14. A task is only marked COMPLETE after its commit succeeds, validator approval is written, and the task bookkeeping for that commit is recorded successfully.
|
|
163
|
+
15. The task commit must include the task's updated state files when those files change as part of the successful loop.
|
|
164
|
+
16. If \`workflow.implement.watchdogSessionStale\` is enabled, watchdog notifications may surface stalled sessions, but notifications never block the run.
|
|
165
|
+
17. Before final exit on a successful whole-feature run, request a feature-level validator pass for each write target to write that target project's \`docs/specs/{feature-slug}/state/functional-validation-plan.md\`.
|
|
166
|
+
18. Exit only when code changes, task-level tests, and target-local functional validation plans are complete for every write target on \`feature/{feature-slug}\`.
|
|
167
|
+
19. The caller then runs \`.opencode/scripts/check-all.sh\` or \`/j.check\`, which validate the canonical plan branch using \`check-review.md\` plus \`functional-validation-plan.md\`.
|
|
168
|
+
20. If the repo-wide check fails, delegate back to \`@j.implementer\` with the failing output and those generated artifacts.
|
|
169
|
+
21. If that reentry requires changing work from a task that is already COMPLETE, the harness should create a new follow-up task instead of reopening the completed one.
|
|
170
|
+
|
|
171
|
+
## History Rules
|
|
172
|
+
|
|
173
|
+
- A task must commit directly on the canonical plan branch \`feature/{feature-slug}\`.
|
|
174
|
+
- The preferred history is one commit per task; one commit per wave is acceptable only when the workflow owner explicitly decides to bundle a wave.
|
|
175
|
+
- If a task needs earlier task code to exist, that relationship must be expressed via \`depends\` in \`plan.md\`.
|
|
176
|
+
- Closeout docs that should land in git history must be explicit plan tasks, not post-hoc UNIFY-only commits.
|
|
177
|
+
|
|
178
|
+
## Delegation Rule (MANDATORY)
|
|
179
|
+
|
|
180
|
+
You MUST delegate this task to \`@j.implementer\` using the \`task()\` tool.
|
|
181
|
+
Do NOT implement code yourself — you are the orchestrator, not the executor.
|
|
182
|
+
|
|
183
|
+
The first delegated \`@j.implementer\` session is the workflow owner.
|
|
184
|
+
It must not immediately delegate the same whole implementation workflow to another generic \`@j.implementer\`.
|
|
185
|
+
Only explicit task-worker prompts such as \`Execute task {id} ...\` may create child \`@j.implementer\` sessions.
|
|
186
|
+
|
|
187
|
+
When ANY sub-agent returns output:
|
|
188
|
+
- NEVER dismiss it as "incomplete" or "the agent didn't do what was asked"
|
|
189
|
+
- NEVER say "I'll continue myself" and take over the sub-agent's job
|
|
190
|
+
- Sub-agent unknowns/ambiguities are VALUABLE DATA — forward them to the user via \`question\` tool
|
|
191
|
+
- If the sub-agent's report has gaps, pass those gaps to the user as questions — do NOT fill them yourself
|
|
192
|
+
|
|
193
|
+
## After implementation
|
|
194
|
+
|
|
195
|
+
Run \`/j.check\` for repo-wide verification.
|
|
196
|
+
If \`/j.check\` fails, invoke \`/j.implement\` again with the failing output, \`check-review.md\`, and \`functional-validation-plan.md\`.
|
|
197
|
+
Treat the \`## Reentry Contract\` section inside \`check-review.md\` as the authoritative next-action contract when it is present.
|
|
198
|
+
If the correction applies to already completed work, create a new follow-up task first and implement that task forward-only.
|
|
199
|
+
Run \`/j.unify\` only after the full check passes and \`juninho-config.json\` enables UNIFY.
|
|
171
200
|
`;
|
|
172
201
|
// ─── /sync-docs ───────────────────────────────────────────────────────────────
|
|
173
|
-
const SYNC_DOCS = `# /sync-docs — Refresh AGENTS and Documentation
|
|
174
|
-
|
|
175
|
-
Generate or update \`AGENTS.md\`, domain docs, and principle docs using the current code as source of truth.
|
|
176
|
-
|
|
177
|
-
## Usage
|
|
178
|
-
|
|
179
|
-
\`\`\`
|
|
180
|
-
/j.sync-docs
|
|
181
|
-
/j.sync-docs <path or domain>
|
|
182
|
-
\`\`\`
|
|
183
|
-
|
|
184
|
-
## What happens
|
|
185
|
-
|
|
186
|
-
1. Read \`.opencode/
|
|
187
|
-
2.
|
|
188
|
-
3.
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
4.
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
##
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
## Usage
|
|
220
|
-
|
|
221
|
-
\`\`\`
|
|
222
|
-
/j.init-deep
|
|
223
|
-
\`\`\`
|
|
224
|
-
|
|
225
|
-
## What happens
|
|
226
|
-
|
|
227
|
-
### 1. Generate hierarchical AGENTS.md files
|
|
228
|
-
|
|
229
|
-
Scans the directory tree and generates \`AGENTS.md\` files at each significant level:
|
|
230
|
-
|
|
231
|
-
- **Root \`AGENTS.md\`** (already exists): stack summary, build/test commands, critical rules — keep under 200 lines
|
|
232
|
-
- **\`src/AGENTS.md\`**: source-tree architecture, directory layout, barrel export conventions, import rules
|
|
233
|
-
- **\`src/{module}/AGENTS.md\`**: module-specific rules, business invariants, known pitfalls, integration contracts
|
|
234
|
-
|
|
235
|
-
Each file contains only context relevant to its directory — no duplication.
|
|
236
|
-
The \`directory-agents-injector\` plugin automatically injects the relevant levels when an agent reads any file.
|
|
237
|
-
|
|
238
|
-
### 2. Populate domain documentation
|
|
239
|
-
|
|
240
|
-
Writes to \`docs/domain/INDEX.md\`:
|
|
241
|
-
- Domain entity catalog with CARL Keywords and Files entries
|
|
242
|
-
- API route inventory
|
|
243
|
-
- Service layer patterns
|
|
244
|
-
|
|
245
|
-
### 3. Update principles manifest
|
|
246
|
-
|
|
247
|
-
Adds entries to \`docs/principles/manifest\` (KEY=VALUE format):
|
|
248
|
-
- Canonical code patterns discovered
|
|
249
|
-
- Architectural directives
|
|
250
|
-
- Technology decisions
|
|
251
|
-
|
|
252
|
-
### 4. Refresh local automation stubs
|
|
253
|
-
|
|
254
|
-
- Validate \`.opencode/scripts/lint-structure.sh\`
|
|
255
|
-
- Validate \`.opencode/scripts/test-related.sh\`
|
|
256
|
-
- Validate \`.opencode/scripts/check-all.sh\`
|
|
257
|
-
- Align commands in \`AGENTS.md\` with the actual repository scripts
|
|
258
|
-
|
|
259
|
-
## When to use
|
|
260
|
-
|
|
261
|
-
- First time setting up the framework on an existing project
|
|
262
|
-
- After major refactors that change module structure
|
|
263
|
-
- When onboarding agents to a new area of the codebase
|
|
264
|
-
- After \`/j.init-deep\` generates files, review and augment them with non-obvious domain knowledge
|
|
265
|
-
|
|
266
|
-
## Result
|
|
267
|
-
|
|
268
|
-
\`\`\`
|
|
269
|
-
project/
|
|
270
|
-
├── AGENTS.md # Updated with stack summary
|
|
271
|
-
├── src/
|
|
272
|
-
│ ├── AGENTS.md # Generated: src-level architecture context
|
|
273
|
-
│ └── payments/
|
|
274
|
-
│ └── AGENTS.md # Generated: payments-specific context
|
|
275
|
-
└── docs/domain/INDEX.md # Populated with CARL entries
|
|
276
|
-
\`\`\`
|
|
277
|
-
|
|
278
|
-
The CARL plugin uses \`INDEX.md\` to inject domain context automatically.
|
|
279
|
-
The \`directory-agents-injector\` plugin injects the right \`AGENTS.md\` layers per file read.
|
|
202
|
+
const SYNC_DOCS = `# /sync-docs — Refresh AGENTS and Documentation
|
|
203
|
+
|
|
204
|
+
Generate or update \`AGENTS.md\`, domain docs, and principle docs using the current code as source of truth.
|
|
205
|
+
|
|
206
|
+
## Usage
|
|
207
|
+
|
|
208
|
+
\`\`\`
|
|
209
|
+
/j.sync-docs
|
|
210
|
+
/j.sync-docs <path or domain>
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
## What happens
|
|
214
|
+
|
|
215
|
+
1. Read \`.opencode/juninho-config.json\` to understand documentation-related workflow defaults
|
|
216
|
+
2. Read \`.opencode/state/active-plan.json\` to discover write targets (if active)
|
|
217
|
+
3. Resolve the target project:
|
|
218
|
+
- If a path/domain argument is provided, resolve the containing project root
|
|
219
|
+
- If an active plan exists, operate on all write target projects
|
|
220
|
+
- Otherwise, operate on the single discovered project or ask the user
|
|
221
|
+
4. For each target project (\`\$PROJECT_ROOT\`):
|
|
222
|
+
- Identify key files for the requested scope
|
|
223
|
+
- Update \`\$PROJECT_ROOT/AGENTS.md\` and directory-level \`AGENTS.md\` files
|
|
224
|
+
- Update \`\$PROJECT_ROOT/docs/domain/*\` for business behavior and invariants
|
|
225
|
+
- Update \`\$PROJECT_ROOT/docs/principles/*\` for cross-cutting technical patterns
|
|
226
|
+
- Add or refresh sync markers such as:
|
|
227
|
+
- \`<!-- juninho:sync source=src/payments/service.ts hash=abc123 -->\`
|
|
228
|
+
- Update \`\$PROJECT_ROOT/docs/domain/INDEX.md\` and \`\$PROJECT_ROOT/docs/principles/manifest\` when new docs are added or renamed
|
|
229
|
+
|
|
230
|
+
## Rules
|
|
231
|
+
|
|
232
|
+
- Prefer small, high-signal \`AGENTS.md\` files close to the code they describe
|
|
233
|
+
- Keep business behavior out of \`AGENTS.md\`; put it in \`docs/domain/*\`
|
|
234
|
+
- Keep technical principles reusable; do not bury them in a module-specific doc
|
|
235
|
+
- Use key-file sync markers so doc drift is visible during later updates
|
|
236
|
+
|
|
237
|
+
## Delegation Rule (MANDATORY)
|
|
238
|
+
|
|
239
|
+
You MUST delegate this task to \`@j.implementer\` using the \`task()\` tool.
|
|
240
|
+
Do NOT rewrite the docs yourself when the harness workflow asks for agent execution.
|
|
241
|
+
|
|
242
|
+
## When to use
|
|
243
|
+
|
|
244
|
+
- After finishing a feature before human review
|
|
245
|
+
- After major refactors that changed local rules or business behavior
|
|
246
|
+
- When CARL recall quality degrades because docs or manifests are stale
|
|
280
247
|
`;
|
|
281
248
|
// ─── /start-work ─────────────────────────────────────────────────────────────
|
|
282
|
-
const START_WORK = `# /start-work — Begin a Work Session
|
|
283
|
-
|
|
284
|
-
Initialize context for a focused work session on a specific task.
|
|
285
|
-
|
|
286
|
-
## Usage
|
|
287
|
-
|
|
288
|
-
\`\`\`
|
|
289
|
-
/j.start-work <task description or issue number>
|
|
290
|
-
\`\`\`
|
|
291
|
-
|
|
292
|
-
## Examples
|
|
293
|
-
|
|
294
|
-
\`\`\`
|
|
295
|
-
/j.start-work issue #42 — fix login redirect loop
|
|
296
|
-
/j.start-work implement the dashboard analytics widget
|
|
297
|
-
/j.start-work #123
|
|
298
|
-
\`\`\`
|
|
299
|
-
|
|
300
|
-
## What happens
|
|
301
|
-
|
|
302
|
-
1.
|
|
303
|
-
2.
|
|
304
|
-
3.
|
|
305
|
-
4. If
|
|
306
|
-
5.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
249
|
+
const START_WORK = `# /start-work — Begin a Work Session
|
|
250
|
+
|
|
251
|
+
Initialize context for a focused work session on a specific task.
|
|
252
|
+
|
|
253
|
+
## Usage
|
|
254
|
+
|
|
255
|
+
\`\`\`
|
|
256
|
+
/j.start-work <task description or issue number>
|
|
257
|
+
\`\`\`
|
|
258
|
+
|
|
259
|
+
## Examples
|
|
260
|
+
|
|
261
|
+
\`\`\`
|
|
262
|
+
/j.start-work issue #42 — fix login redirect loop
|
|
263
|
+
/j.start-work implement the dashboard analytics widget
|
|
264
|
+
/j.start-work #123
|
|
265
|
+
\`\`\`
|
|
266
|
+
|
|
267
|
+
## What happens
|
|
268
|
+
|
|
269
|
+
1. Reads \`.opencode/state/active-plan.json\` to discover write targets
|
|
270
|
+
2. For each write target project, loads \`docs/domain/INDEX.md\` for domain context
|
|
271
|
+
3. Checks per-target \`docs/specs/{feature-slug}/state/\` for any in-progress work
|
|
272
|
+
4. If a \`plan.md\` exists in any target: loads it and presents next steps
|
|
273
|
+
5. If no plan: asks whether to \`/j.plan\` first or jump straight to \`/j.implement\`
|
|
274
|
+
6. Sets up execution state for the current task
|
|
275
|
+
|
|
276
|
+
In multi-repo mode, shows status across all write targets so you can see which projects have pending work.
|
|
277
|
+
|
|
278
|
+
## After starting work
|
|
279
|
+
|
|
280
|
+
The session is now focused. Use \`/j.implement\` to build, \`@j.validator\` to check, \`/j.handoff\` when done.
|
|
311
281
|
`;
|
|
312
282
|
// ─── /handoff ─────────────────────────────────────────────────────────────────
|
|
313
|
-
const HANDOFF = `# /handoff — End-of-Session Handoff
|
|
314
|
-
|
|
315
|
-
Prepare a handoff document for the next session or team member.
|
|
316
|
-
|
|
317
|
-
## Usage
|
|
318
|
-
|
|
319
|
-
\`\`\`
|
|
320
|
-
/j.handoff
|
|
321
|
-
\`\`\`
|
|
322
|
-
|
|
323
|
-
## What happens
|
|
324
|
-
|
|
325
|
-
1. Reads
|
|
326
|
-
2.
|
|
327
|
-
-
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
-
|
|
344
|
-
|
|
345
|
-
##
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
283
|
+
const HANDOFF = `# /handoff — End-of-Session Handoff
|
|
284
|
+
|
|
285
|
+
Prepare a handoff document for the next session or team member.
|
|
286
|
+
|
|
287
|
+
## Usage
|
|
288
|
+
|
|
289
|
+
\`\`\`
|
|
290
|
+
/j.handoff
|
|
291
|
+
\`\`\`
|
|
292
|
+
|
|
293
|
+
## What happens
|
|
294
|
+
|
|
295
|
+
1. Reads \`.opencode/state/active-plan.json\` to discover all write targets
|
|
296
|
+
2. For each write target project (\`\$REPO_ROOT\`):
|
|
297
|
+
- Reads per-task state from \`\$REPO_ROOT/docs/specs/{feature-slug}/state/tasks/task-*/execution-state.md\`
|
|
298
|
+
- Reads the feature-local implementer log from \`\$REPO_ROOT/docs/specs/{feature-slug}/state/implementer-work.md\`
|
|
299
|
+
- Reads \`\$REPO_ROOT/docs/specs/{feature-slug}/state/integration-state.json\` for validated SHAs and commit bookkeeping/cleanup status
|
|
300
|
+
- Reads session runtime metadata from \`\$REPO_ROOT/docs/specs/{feature-slug}/state/sessions/\` when session ownership/context is relevant
|
|
301
|
+
3. Summarizes (across all write targets):
|
|
302
|
+
- What was completed this session
|
|
303
|
+
- What is in progress (with file names, attempt number, and last heartbeat)
|
|
304
|
+
- What is blocked and why
|
|
305
|
+
- What was retried and why
|
|
306
|
+
- What is already committed into \`feature/{feature-slug}\` and which commit represents each task
|
|
307
|
+
- What still needs bookkeeping or cleanup
|
|
308
|
+
- Exact next step to continue
|
|
309
|
+
|
|
310
|
+
6. Updates local execution state with handoff notes
|
|
311
|
+
|
|
312
|
+
7. Optionally commits the state files:
|
|
313
|
+
\`git add .opencode/state/ docs/specs/*/state/ && git commit -m "chore: session handoff"\`
|
|
314
|
+
|
|
315
|
+
## Output format
|
|
316
|
+
|
|
317
|
+
\`\`\`markdown
|
|
318
|
+
# Session Handoff — {date}
|
|
319
|
+
|
|
320
|
+
## Completed
|
|
321
|
+
- [x] Task description
|
|
322
|
+
|
|
323
|
+
## In Progress
|
|
324
|
+
- [ ] Task description
|
|
325
|
+
- Last state: {what was done}
|
|
326
|
+
- Next step: {exactly what to do next}
|
|
327
|
+
- Files: {relevant files}
|
|
328
|
+
|
|
329
|
+
## Blocked
|
|
330
|
+
- [ ] Task description
|
|
331
|
+
- Blocker: {what's blocking}
|
|
332
|
+
- Resolution needed: {what needs to happen}
|
|
333
|
+
|
|
334
|
+
## Next Session: Start with
|
|
335
|
+
{single, clear action to take first}
|
|
336
|
+
\`\`\`
|
|
359
337
|
`;
|
|
360
338
|
// ─── /ulw-loop ────────────────────────────────────────────────────────────────
|
|
361
|
-
const ULW_LOOP = `# /ulw-loop — Ultra Work Loop
|
|
362
|
-
|
|
363
|
-
Activate
|
|
364
|
-
|
|
365
|
-
## Usage
|
|
366
|
-
|
|
367
|
-
\`\`\`
|
|
368
|
-
/j.ulw-loop
|
|
369
|
-
/j.ulw-loop <task or goal>
|
|
370
|
-
\`\`\`
|
|
371
|
-
|
|
372
|
-
## What happens
|
|
373
|
-
|
|
374
|
-
1. Reads \`
|
|
375
|
-
2.
|
|
376
|
-
3.
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
-
|
|
409
|
-
|
|
410
|
-
|
|
339
|
+
const ULW_LOOP = `# /ulw-loop — Ultra Work Loop
|
|
340
|
+
|
|
341
|
+
Activate high-throughput mode — work until all tasks in the plan are complete.
|
|
342
|
+
|
|
343
|
+
## Usage
|
|
344
|
+
|
|
345
|
+
\`\`\`
|
|
346
|
+
/j.ulw-loop
|
|
347
|
+
/j.ulw-loop <task or goal>
|
|
348
|
+
\`\`\`
|
|
349
|
+
|
|
350
|
+
## What happens
|
|
351
|
+
|
|
352
|
+
1. Reads task list from the active \`plan.md\` (auto-loaded by plan-autoload plugin for all write targets)
|
|
353
|
+
2. Reads \`.opencode/state/active-plan.json\` to discover all write targets
|
|
354
|
+
3. For multi-project plans, iterates all write targets — each target has its own \`plan.md\` and \`docs/specs/{feature-slug}/state/\` tree
|
|
355
|
+
4. Reads feature-local state from each target's \`docs/specs/{feature-slug}/state/\`, especially \`implementer-work.md\` and prior task execution files
|
|
356
|
+
5. Identifies tasks that can run in parallel (no dependencies)
|
|
357
|
+
6. Creates or switches to the shared implementation branch \`feature/{feature-slug}\` in each target repo
|
|
358
|
+
7. Delegates each task to its own task-scoped \`@j.implementer\` subagent with the task's \`targetRepoRoot\` so every task gets a fresh context window scoped to its target project
|
|
359
|
+
8. Executes those task workers sequentially on the shared branch
|
|
360
|
+
9. Each task reads dependency execution/validator state before coding and writes state to its target repo root (\`\$REPO_ROOT/docs/specs/{feature-slug}/state/\`)
|
|
361
|
+
10. Each task maintains a heartbeat in \`tasks/task-{id}/execution-state.md\`
|
|
362
|
+
- Retry budget is tracked per task in \`tasks/task-{id}/retry-state.json\`
|
|
363
|
+
11. If \`workflow.implement.watchdogSessionStale\` is enabled and a task never starts or its heartbeat goes stale, the loop may launch one retry attempt for that task
|
|
364
|
+
12. If \`workflow.implement.watchdogSessionStale\` is enabled, a watchdog notification may surface stalled sessions without blocking the run
|
|
365
|
+
13. \`@j.validator\` runs after each task, writing results to the target's \`docs/specs/{feature-slug}/state/tasks/task-{id}/validator-work.md\`
|
|
366
|
+
14. Loop continues until all tasks across all write targets are marked complete
|
|
367
|
+
15. Record each APPROVED task commit in the target's \`docs/specs/{feature-slug}/state/integration-state.json\`
|
|
368
|
+
16. Run \`/j.check\` once task-level work is done; this must validate the canonical plan branch in every target repo
|
|
369
|
+
17. \`@j.unify\` runs only if closeout is enabled in \`.opencode/juninho-config.json\` under \`workflow.unify.enabled\` and should only do closeout/cleanup/PR work
|
|
370
|
+
|
|
371
|
+
## When to use
|
|
372
|
+
|
|
373
|
+
- Many independent tasks in the backlog
|
|
374
|
+
- Large feature that can be parallelized
|
|
375
|
+
- When you want the highest safe throughput
|
|
376
|
+
|
|
377
|
+
## Execution model
|
|
378
|
+
|
|
379
|
+
\`\`\`
|
|
380
|
+
Wave 1:
|
|
381
|
+
task-worker-1: implement service layer → commit on feature/{slug}
|
|
382
|
+
task-worker-2: implement API routes → commit on feature/{slug}
|
|
383
|
+
task-worker-3: implement UI components → commit on feature/{slug}
|
|
384
|
+
|
|
385
|
+
Wave 2:
|
|
386
|
+
task-worker-4: wire everything together → commit on feature/{slug}
|
|
387
|
+
|
|
388
|
+
Wave 3:
|
|
389
|
+
task-worker-5: unit tests → commit on feature/{slug}
|
|
390
|
+
task-worker-6: integration tests → commit on feature/{slug}
|
|
391
|
+
\`\`\`
|
|
392
|
+
|
|
393
|
+
## Safety
|
|
394
|
+
|
|
395
|
+
- Each task gets a fresh task-scoped subagent session
|
|
396
|
+
- All state files go to repo root, so the orchestrator always has visibility
|
|
397
|
+
- Shared-branch execution keeps commit history linear and predictable
|
|
398
|
+
- Each task carries its own lease and heartbeat in feature-local state
|
|
399
|
+
- Stale tasks can be retried once without allowing two attempts to commit concurrently
|
|
400
|
+
- Cleanup applies only to harness bookkeeping artifacts, not task worktrees
|
|
401
|
+
- Code integration happens immediately because each task commits directly into the canonical feature branch
|
|
402
|
+
- UNIFY performs cleanup only; it must not be responsible for first-time code integration
|
|
403
|
+
- If any wave fails, the loop pauses and reports blockers — read \`docs/specs/{slug}/state/\` for details
|
|
411
404
|
`;
|
|
412
405
|
// ─── /check ───────────────────────────────────────────────────────────────────
|
|
413
|
-
const CHECK = `# /check — Run All Quality Gates
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
## Usage
|
|
418
|
-
|
|
419
|
-
\`\`\`
|
|
420
|
-
/j.check
|
|
421
|
-
\`\`\`
|
|
422
|
-
|
|
423
|
-
## What runs
|
|
424
|
-
|
|
425
|
-
\`.opencode/
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
406
|
+
const CHECK = `# /check — Run All Quality Gates
|
|
407
|
+
|
|
408
|
+
Invoke the \`@j.checker\` agent to run the full repository verification after \`@j.implementer\` exits, then perform a detailed PR-style review pass.
|
|
409
|
+
|
|
410
|
+
## Usage
|
|
411
|
+
|
|
412
|
+
\`\`\`
|
|
413
|
+
/j.check
|
|
414
|
+
\`\`\`
|
|
415
|
+
|
|
416
|
+
## What runs
|
|
417
|
+
|
|
418
|
+
1. \`@j.checker\` reads \`.opencode/state/active-plan.json\` to discover all write targets
|
|
419
|
+
2. \`@j.checker\` runs \`.opencode/scripts/check-all.sh\`, which iterates every target repo from the active multi-project plan
|
|
420
|
+
3. For each write target (\`\$REPO_ROOT\`), \`@j.checker\` reads \`\$REPO_ROOT/docs/specs/{feature-slug}/state/functional-validation-plan.md\` when it exists
|
|
421
|
+
4. \`@j.checker\` delegates a detailed read-only multi-pass review to \`@j.reviewer\` covering all write targets
|
|
422
|
+
|
|
423
|
+
This script is expected to run the repository-wide checks for the current stack.
|
|
424
|
+
Typical examples:
|
|
425
|
+
- \`npm run typecheck && npm run lint && npm test\`
|
|
426
|
+
- \`./gradlew ktlintCheck && ./gradlew compileKotlin compileTestKotlin && ./gradlew test\`
|
|
427
|
+
- \`./mvnw spotless:check && ./mvnw -DskipTests compile test-compile && ./mvnw test\`
|
|
428
|
+
|
|
429
|
+
The review pass must inspect the resulting integrated branch like a real PR review and look for:
|
|
430
|
+
- bugs and missed edge cases
|
|
431
|
+
- spec or plan intent drift
|
|
432
|
+
- business-rule/domain-rule violations
|
|
433
|
+
- project pattern or AGENTS violations
|
|
434
|
+
- unnecessary complexity, over-engineering, abstraction inflation, or code bloat
|
|
435
|
+
- maintainability or safety concerns worth correcting before closeout
|
|
436
|
+
|
|
437
|
+
The review must be performed in multiple passes, not one shallow pass:
|
|
438
|
+
- Pass 1: correctness, bugs, edge cases, failure paths
|
|
439
|
+
- Pass 2: spec/plan/domain/rule alignment and runtime blind spots
|
|
440
|
+
- Pass 3: project patterns, simplicity, bloat, and maintainability
|
|
441
|
+
|
|
442
|
+
If a feature slug is active, persist the report to each write target:
|
|
443
|
+
- \`\$REPO_ROOT/docs/specs/{feature-slug}/state/check-review.md\`
|
|
444
|
+
|
|
445
|
+
Operational rule:
|
|
446
|
+
- delegate the review to \`@j.reviewer\`
|
|
447
|
+
- provide \`functional-validation-plan.md\` to the reviewer when it exists
|
|
448
|
+
- persist the full verification transcript to \`docs/specs/{feature-slug}/state/check-all-output.txt\`
|
|
449
|
+
- then write the returned markdown review to \`docs/specs/{feature-slug}/state/check-review.md\`
|
|
450
|
+
- then summarize whether the repository is blocked by failing checks, review findings, or both
|
|
451
|
+
|
|
452
|
+
The report should contain Critical / Important / Minor findings plus intent-coverage and domain-risk sections.
|
|
453
|
+
The persisted \`check-review.md\` must also contain a \`## Reentry Contract\` section with exact artifact paths and the expected next action for \`/j.implement\`.
|
|
454
|
+
|
|
455
|
+
If \`check-all.sh\` fails, still produce the review report when enough context exists. The report should mention whether failures came from verification, code review findings, or both.
|
|
456
|
+
If \`functional-validation-plan.md\` exists, the review must also call out runtime or integration risks that remain unproven or unsupported by the current implementation.
|
|
457
|
+
|
|
458
|
+
## When to use
|
|
459
|
+
|
|
460
|
+
- After \`/j.implement\` returns control to the caller
|
|
461
|
+
- Before \`/j.unify\`
|
|
462
|
+
- After a refactor that touched many files or workflows
|
|
463
|
+
|
|
464
|
+
## Notes
|
|
465
|
+
|
|
466
|
+
This is intentionally broader than the pre-commit hook.
|
|
467
|
+
The pre-commit hook stays fast and runs synchronous, blocking gates for structure lint, build verification, and tests related to staged files.
|
|
468
|
+
|
|
469
|
+
If the check script fails or the review report contains Critical or Important findings, invoke \`/j.implement\` again with:
|
|
470
|
+
- the failing verification output
|
|
471
|
+
- the path to \`docs/specs/{feature-slug}/state/check-review.md\`
|
|
472
|
+
- the path to \`docs/specs/{feature-slug}/state/check-all-output.txt\`
|
|
473
|
+
- the path to \`docs/specs/{feature-slug}/state/functional-validation-plan.md\` when it exists
|
|
474
|
+
|
|
475
|
+
Forward-only correction rule:
|
|
476
|
+
- if a required correction targets work from a task already marked COMPLETE, create a new follow-up task instead of reopening the completed task
|
|
477
|
+
- \`check-review.md\` should make that explicit when it applies
|
|
478
|
+
|
|
479
|
+
\`@j.implementer\` must treat that review report as actionable correction input for the next pass.
|
|
480
|
+
\`@j.implementer\` must also treat \`functional-validation-plan.md\` as the validation contract for the next \`/j.check\` pass.
|
|
481
|
+
|
|
482
|
+
## Delegation Rule (MANDATORY)
|
|
483
|
+
|
|
484
|
+
You MUST delegate this command to \`@j.checker\` using the \`task()\` tool.
|
|
485
|
+
Do NOT run the full \`/j.check\` logic yourself — you are the orchestrator, not the checker.
|
|
486
|
+
|
|
487
|
+
\`@j.checker\` is responsible for running \`.opencode/scripts/check-all.sh\`, invoking \`@j.reviewer\`, and persisting \`check-review.md\`.
|
|
488
|
+
|
|
489
|
+
When ANY sub-agent returns output:
|
|
490
|
+
- NEVER dismiss it as "incomplete" or "the agent didn't do what was asked"
|
|
491
|
+
- NEVER say "I'll continue myself" and take over the sub-agent's job
|
|
492
|
+
- If the checker or reviewer needs more context, provide that context and re-delegate
|
|
493
|
+
- If checks or review findings block progress, route the result back into \`/j.implement\` with the generated artifacts
|
|
443
494
|
`;
|
|
444
495
|
// ─── /lint ────────────────────────────────────────────────────────────────────
|
|
445
|
-
const LINT = `# /lint — Run Linter
|
|
446
|
-
|
|
447
|
-
Run the structure lint used by the pre-commit path.
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
\`\`\`
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
-
|
|
496
|
+
const LINT = `# /lint — Run Linter
|
|
497
|
+
|
|
498
|
+
Run the structure lint used by the pre-commit path.
|
|
499
|
+
|
|
500
|
+
This command is only the lint gate. The pre-commit hook then runs \`.opencode/scripts/build-verify.sh\` and \`.opencode/scripts/test-related.sh\`, waiting for each one to succeed before continuing.
|
|
501
|
+
|
|
502
|
+
## Usage
|
|
503
|
+
|
|
504
|
+
\`\`\`
|
|
505
|
+
/j.lint
|
|
506
|
+
\`\`\`
|
|
507
|
+
|
|
508
|
+
## What runs
|
|
509
|
+
|
|
510
|
+
\`.opencode/scripts/lint-structure.sh\`
|
|
511
|
+
|
|
512
|
+
## When to use
|
|
513
|
+
|
|
514
|
+
- During active implementation, to catch structural issues quickly
|
|
515
|
+
- When the pre-commit hook fails on lint and you want the same check on demand
|
|
516
|
+
- After editing docs, scripts, or config files that need non-test validation
|
|
464
517
|
`;
|
|
465
518
|
// ─── /test ────────────────────────────────────────────────────────────────────
|
|
466
|
-
const TEST = `# /test — Run Test Suite
|
|
467
|
-
|
|
468
|
-
Run fast, change-scoped tests during implementation.
|
|
469
|
-
|
|
470
|
-
## Usage
|
|
471
|
-
|
|
472
|
-
\`\`\`
|
|
473
|
-
/j.test
|
|
474
|
-
/j.test <pattern>
|
|
475
|
-
\`\`\`
|
|
476
|
-
|
|
477
|
-
## Examples
|
|
478
|
-
|
|
479
|
-
\`\`\`
|
|
480
|
-
/j.test
|
|
481
|
-
/j.test src/payments
|
|
482
|
-
/j.test --watch
|
|
483
|
-
\`\`\`
|
|
484
|
-
|
|
485
|
-
## What runs
|
|
486
|
-
|
|
487
|
-
\`.opencode/scripts/test-related.sh\`
|
|
488
|
-
|
|
489
|
-
If the repository defines \`test:related\`, that script is preferred.
|
|
490
|
-
Otherwise the default fallback tries tools such as \`jest --findRelatedTests\` or \`vitest related\`.
|
|
491
|
-
|
|
492
|
-
## When to use
|
|
493
|
-
|
|
494
|
-
- During implementation, before leaving \`@j.implementer\`
|
|
495
|
-
- When the pre-commit hook fails on related tests and you want to rerun the same scope
|
|
496
|
-
-
|
|
519
|
+
const TEST = `# /test — Run Test Suite
|
|
520
|
+
|
|
521
|
+
Run fast, change-scoped tests during implementation after lint/build gates are green.
|
|
522
|
+
|
|
523
|
+
## Usage
|
|
524
|
+
|
|
525
|
+
\`\`\`
|
|
526
|
+
/j.test
|
|
527
|
+
/j.test <pattern>
|
|
528
|
+
\`\`\`
|
|
529
|
+
|
|
530
|
+
## Examples
|
|
531
|
+
|
|
532
|
+
\`\`\`
|
|
533
|
+
/j.test
|
|
534
|
+
/j.test src/payments
|
|
535
|
+
/j.test --watch
|
|
536
|
+
\`\`\`
|
|
537
|
+
|
|
538
|
+
## What runs
|
|
539
|
+
|
|
540
|
+
\`.opencode/scripts/test-related.sh\`
|
|
541
|
+
|
|
542
|
+
If the repository defines \`test:related\`, that script is preferred.
|
|
543
|
+
Otherwise the default fallback tries tools such as \`jest --findRelatedTests\` or \`vitest related\`.
|
|
544
|
+
|
|
545
|
+
## When to use
|
|
546
|
+
|
|
547
|
+
- During implementation, before leaving \`@j.implementer\`
|
|
548
|
+
- When the pre-commit hook fails on related tests and you want to rerun the same scope
|
|
549
|
+
- After \`.opencode/scripts/build-verify.sh\` passes when you need the same local gating order as pre-commit
|
|
550
|
+
- Use \`/j.check\` for the full repository suite after implementation
|
|
497
551
|
`;
|
|
498
552
|
// ─── /pr-review ───────────────────────────────────────────────────────────────
|
|
499
|
-
const PR_REVIEW = `# /pr-review — Advisory PR Review
|
|
500
|
-
|
|
501
|
-
Launch the \`@j.reviewer\` agent to perform an advisory code review on the current branch diff.
|
|
502
|
-
|
|
503
|
-
## Usage
|
|
504
|
-
|
|
505
|
-
\`\`\`
|
|
506
|
-
/j.pr-review
|
|
507
|
-
\`\`\`
|
|
508
|
-
|
|
509
|
-
## What happens
|
|
510
|
-
|
|
511
|
-
1. \`@j.reviewer\` reads all files changed in the current branch (vs main)
|
|
512
|
-
2. Reviews for:
|
|
513
|
-
3. Returns a structured report: Critical / Important / Minor / Positive Notes
|
|
514
|
-
4. Report is **advisory only** — does not block any merge or pipeline step
|
|
515
|
-
|
|
516
|
-
## When to use
|
|
517
|
-
|
|
518
|
-
- After \`/j.unify\` creates the PR, before human review
|
|
519
|
-
- When you want a second opinion on the implementation quality
|
|
520
|
-
- For pre-merge quality assurance
|
|
521
|
-
|
|
522
|
-
## Distinction from @j.validator
|
|
523
|
-
|
|
524
|
-
| \`@j.reviewer\` | \`@j.validator\` |
|
|
525
|
-
|---|---|
|
|
526
|
-
| Post-PR, advisory | During implementation loop |
|
|
527
|
-
| "Is this good code?" | "Does this satisfy the spec?" |
|
|
528
|
-
| Never blocks | Gates the pipeline |
|
|
529
|
-
| Read-only | Can fix issues directly |
|
|
530
|
-
|
|
531
|
-
## Quality target
|
|
532
|
-
|
|
533
|
-
Aim for PR artifacts with the same quality bar as a strong human-authored engineering PR:
|
|
534
|
-
- state the purpose and problem clearly
|
|
535
|
-
- summarize the solution in reviewer-friendly steps
|
|
536
|
-
- map changed files to responsibilities
|
|
537
|
-
- provide runnable validation steps with expected outcomes
|
|
553
|
+
const PR_REVIEW = `# /pr-review — Advisory PR Review
|
|
554
|
+
|
|
555
|
+
Launch the \`@j.reviewer\` agent to perform an advisory code review on the current branch diff.
|
|
556
|
+
|
|
557
|
+
## Usage
|
|
558
|
+
|
|
559
|
+
\`\`\`
|
|
560
|
+
/j.pr-review
|
|
561
|
+
\`\`\`
|
|
562
|
+
|
|
563
|
+
## What happens
|
|
564
|
+
|
|
565
|
+
1. \`@j.reviewer\` reads all files changed in the current branch (vs main)
|
|
566
|
+
2. Reviews for: bugs, edge cases, intent drift, business-rule risk, clarity, security, performance, maintainability
|
|
567
|
+
3. Returns a structured report: Critical / Important / Minor / Positive Notes / Intent Coverage / Domain Rule Risks
|
|
568
|
+
4. Report is **advisory only** — does not block any merge or pipeline step
|
|
569
|
+
|
|
570
|
+
## When to use
|
|
571
|
+
|
|
572
|
+
- After \`/j.unify\` creates the PR, before human review
|
|
573
|
+
- When you want a second opinion on the implementation quality
|
|
574
|
+
- For pre-merge quality assurance
|
|
575
|
+
|
|
576
|
+
## Distinction from @j.validator
|
|
577
|
+
|
|
578
|
+
| \`@j.reviewer\` | \`@j.validator\` |
|
|
579
|
+
|---|---|
|
|
580
|
+
| Post-PR, advisory | During implementation loop |
|
|
581
|
+
| "Is this good code?" | "Does this satisfy the spec?" |
|
|
582
|
+
| Never blocks | Gates the pipeline |
|
|
583
|
+
| Read-only | Can fix issues directly |
|
|
584
|
+
|
|
585
|
+
## Quality target
|
|
586
|
+
|
|
587
|
+
Aim for PR artifacts with the same quality bar as a strong human-authored engineering PR:
|
|
588
|
+
- state the purpose and problem clearly
|
|
589
|
+
- summarize the solution in reviewer-friendly steps
|
|
590
|
+
- map changed files to responsibilities
|
|
591
|
+
- provide runnable validation steps with expected outcomes
|
|
538
592
|
`;
|
|
539
593
|
// ─── /status ──────────────────────────────────────────────────────────────────
|
|
540
|
-
const STATUS = `# /status — Show Current Work Status
|
|
541
|
-
|
|
542
|
-
Display
|
|
543
|
-
|
|
544
|
-
## Usage
|
|
545
|
-
|
|
546
|
-
\`\`\`
|
|
547
|
-
/j.status
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
-
|
|
554
|
-
-
|
|
555
|
-
-
|
|
556
|
-
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
594
|
+
const STATUS = `# /status — Show Current Work Status
|
|
595
|
+
|
|
596
|
+
Display session summary and per-task state — tasks, progress, and blockers.
|
|
597
|
+
|
|
598
|
+
## Usage
|
|
599
|
+
|
|
600
|
+
\`\`\`
|
|
601
|
+
/j.status
|
|
602
|
+
/j.status <feature-slug>
|
|
603
|
+
\`\`\`
|
|
604
|
+
|
|
605
|
+
## What shows
|
|
606
|
+
|
|
607
|
+
- Current goal and active plan path (from global session state)
|
|
608
|
+
- Task table: ID / description / agent / status / attempt
|
|
609
|
+
- Integration table details from \`integration-state.json\`: validated commit on the shared feature branch and bookkeeping status
|
|
610
|
+
- In-progress items with last known state and heartbeat
|
|
611
|
+
- Blocked items with blocker descriptions
|
|
612
|
+
- Retried or stale items visible from per-task execution state
|
|
613
|
+
- Session log (recent actions)
|
|
614
|
+
|
|
615
|
+
## When to use
|
|
616
|
+
|
|
617
|
+
- At the start of a session to orient yourself
|
|
618
|
+
- After resuming work to see what's left
|
|
619
|
+
- To check if all tasks are complete before running \`/j.unify\`
|
|
620
|
+
|
|
621
|
+
## Source
|
|
622
|
+
|
|
623
|
+
Reads state from \`.opencode/state/active-plan.json\` to discover all write targets, then reads per-target artifacts:
|
|
624
|
+
|
|
625
|
+
1. **Active plan**: \`.opencode/state/active-plan.json\` — identifies write targets and their \`targetRepoRoot\` paths
|
|
626
|
+
2. **Per-target task state**: \`{targetRepoRoot}/docs/specs/{feature-slug}/state/tasks/task-{id}/execution-state.md\` — detailed task progress, attempts, heartbeats, blockers, and validated commit
|
|
627
|
+
3. **Per-target integration manifest**: \`{targetRepoRoot}/docs/specs/{feature-slug}/state/integration-state.json\` — canonical feature branch, task validated SHAs, and commit bookkeeping/cleanup status
|
|
628
|
+
|
|
629
|
+
In multi-repo mode, show a section for each write target project so it's clear which tasks belong to which repo.
|
|
630
|
+
|
|
631
|
+
If a \`<feature-slug>\` argument is provided, only show per-task state for that feature.
|
|
632
|
+
If omitted, infer the slug from the active plan.
|
|
633
|
+
|
|
634
|
+
No agent needed — this is a direct state file read.
|
|
568
635
|
`;
|
|
569
636
|
// ─── /unify ───────────────────────────────────────────────────────────────────
|
|
570
|
-
const UNIFY_CMD = `# /unify — Close the Loop
|
|
571
|
-
|
|
572
|
-
Invoke the \`@j.unify\` agent to reconcile plan vs delivery and execute only the enabled closeout steps.
|
|
573
|
-
|
|
574
|
-
## Usage
|
|
575
|
-
|
|
576
|
-
\`\`\`
|
|
577
|
-
/j.unify
|
|
578
|
-
\`\`\`
|
|
579
|
-
|
|
580
|
-
## What happens
|
|
581
|
-
|
|
582
|
-
1. Read \`.opencode/
|
|
583
|
-
2.
|
|
584
|
-
3.
|
|
585
|
-
|
|
586
|
-
-
|
|
587
|
-
-
|
|
588
|
-
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
637
|
+
const UNIFY_CMD = `# /unify — Close the Loop
|
|
638
|
+
|
|
639
|
+
Invoke the \`@j.unify\` agent to reconcile plan vs delivery and execute only the enabled closeout steps.
|
|
640
|
+
|
|
641
|
+
## Usage
|
|
642
|
+
|
|
643
|
+
\`\`\`
|
|
644
|
+
/j.unify
|
|
645
|
+
\`\`\`
|
|
646
|
+
|
|
647
|
+
## What happens
|
|
648
|
+
|
|
649
|
+
1. Read \`.opencode/juninho-config.json\` (\`workflow\` section)
|
|
650
|
+
2. Read \`.opencode/state/active-plan.json\` to discover all write targets
|
|
651
|
+
3. For each write target (\`\$REPO_ROOT\`), reconcile \`\$REPO_ROOT/docs/specs/{feature-slug}/plan.md\` vs actual git diff — mark tasks DONE/PARTIAL/SKIPPED
|
|
652
|
+
4. Run only the enabled closeout steps per target, such as:
|
|
653
|
+
- reconcile \`persistent-context.md\`
|
|
654
|
+
- reconcile \`\$REPO_ROOT/docs/domain/\` or \`\$REPO_ROOT/docs/domain/INDEX.md\`
|
|
655
|
+
- cleanup integration bookkeeping using \`\$REPO_ROOT/docs/specs/{feature-slug}/state/integration-state.json\`
|
|
656
|
+
- create a PR (per target repo when applicable)
|
|
657
|
+
4. If PR creation is enabled, draft a rich PR body with purpose, problem, solution, changed files, and validation steps
|
|
658
|
+
5. Treat forward-only follow-up tasks created after \`/j.check\` as first-class delivery units when reconciling plan vs delivery
|
|
659
|
+
6. Use the latest \`check-review.md\` reentry contract, when present, to explain what was corrected before closeout
|
|
660
|
+
|
|
661
|
+
## When to use
|
|
662
|
+
|
|
663
|
+
After \`@j.implementer\` exits, \`/j.check\` passes, and \`@j.validator\` has approved the required work.
|
|
664
|
+
By this point, code must already be committed into \`feature/{feature-slug}\`.
|
|
665
|
+
|
|
666
|
+
## Prerequisites
|
|
667
|
+
|
|
668
|
+
- All tasks in \`execution-state.md\` should be marked complete
|
|
669
|
+
- All validator passes should return APPROVED or APPROVED_WITH_NOTES
|
|
670
|
+
- \`gh\` CLI must be authenticated (\`gh auth login\`)
|
|
671
|
+
|
|
672
|
+
## Note
|
|
673
|
+
|
|
674
|
+
UNIFY behavior is controlled by \`.opencode/juninho-config.json\` under \`workflow\`.
|
|
675
|
+
If PR creation or doc updates are disabled there, \`@j.unify\` should skip those steps and report what was intentionally not executed.
|
|
676
|
+
UNIFY is no longer responsible for first-time code integration.
|
|
677
|
+
UNIFY should also avoid creating a final synthetic git commit; history should already reflect the planned task commits by the time \`/j.unify\` runs.
|
|
678
|
+
If review-driven follow-up tasks were added after completed work, UNIFY should report them as forward-only corrections, not reopened task ownership.
|
|
605
679
|
`;
|
|
606
680
|
// ─── /finish-setup ───────────────────────────────────────────────────────────
|
|
607
|
-
const FINISH_SETUP = `# /finish-setup —
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
\`\`\`
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
-
|
|
643
|
-
-
|
|
644
|
-
-
|
|
645
|
-
|
|
646
|
-
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
-
|
|
669
|
-
-
|
|
670
|
-
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
-
|
|
676
|
-
-
|
|
677
|
-
-
|
|
678
|
-
-
|
|
681
|
+
const FINISH_SETUP = `# /finish-setup — Bootstrap Repository Knowledge
|
|
682
|
+
|
|
683
|
+
This is the canonical repository bootstrap command after installing the harness.
|
|
684
|
+
|
|
685
|
+
Scan a project codebase, generate hierarchical AGENTS.md files, discover recurring file patterns, generate dynamic skills, and populate domain/principles documentation.
|
|
686
|
+
|
|
687
|
+
## Usage
|
|
688
|
+
|
|
689
|
+
\`\`\`
|
|
690
|
+
/j.finish-setup
|
|
691
|
+
/j.finish-setup <project-path-or-name>
|
|
692
|
+
\`\`\`
|
|
693
|
+
|
|
694
|
+
When a project argument is provided, all artifacts are generated **inside that project's root**, not at the workspace root.
|
|
695
|
+
When no argument is provided and the harness runs from a workspace root with multiple discovered projects, ask which project to bootstrap.
|
|
696
|
+
|
|
697
|
+
## Multi-Repo Behavior
|
|
698
|
+
|
|
699
|
+
The harness can run from a workspace root (e.g., \`~/repos/\`) that contains multiple project repositories.
|
|
700
|
+
In this mode, \`/j.finish-setup\` must resolve the **target project root** before starting any phase.
|
|
701
|
+
|
|
702
|
+
**Target resolution order:**
|
|
703
|
+
1. Explicit argument: \`/j.finish-setup olxbr/trp-partner-api\` or \`/j.finish-setup /absolute/path/to/repo\`
|
|
704
|
+
2. Single project in workspace: use it automatically
|
|
705
|
+
3. Active plan target: if \`active-plan.json\` exists, offer to bootstrap each write target that lacks docs
|
|
706
|
+
4. Multiple projects, no argument: list discovered projects and ask the user to choose
|
|
707
|
+
|
|
708
|
+
**All generated paths below are relative to the resolved \`\$PROJECT_ROOT\`, not the workspace root.**
|
|
709
|
+
|
|
710
|
+
## What happens
|
|
711
|
+
|
|
712
|
+
### Phase 1 — Structural Scan (via @j.explore)
|
|
713
|
+
|
|
714
|
+
1. Invoke \`@j.explore\` to scan the **target project codebase** at \`\$PROJECT_ROOT\`
|
|
715
|
+
2. Identify significant directory boundaries for local instructions:
|
|
716
|
+
- root project context for the main \`AGENTS.md\`
|
|
717
|
+
- source-tree boundaries such as \`src/\`, \`app/\`, \`internal/\`, \`pkg/\`, \`services/\`, \`modules/\`
|
|
718
|
+
- major domain/module directories that deserve their own local \`AGENTS.md\`
|
|
719
|
+
3. Identify recurring file patterns by suffix/convention:
|
|
720
|
+
- \`*Repository.ts\`, \`*Repository.java\`, \`*Repository.kt\`, \`*_repository.py\` → pattern "repository"
|
|
721
|
+
- \`*Service.ts\`, \`*Service.java\`, \`*Service.kt\`, \`*_service.py\` → pattern "service"
|
|
722
|
+
- \`*Controller.ts\`, \`*Controller.java\`, \`*Controller.kt\` → pattern "controller"
|
|
723
|
+
- \`*Handler.go\`, \`*handler.go\` → pattern "handler"
|
|
724
|
+
- \`*Middleware.*\` → pattern "middleware"
|
|
725
|
+
- \`*Schema.*\`, \`*Model.*\` → pattern "model/schema"
|
|
726
|
+
- \`*DTO.*\`, \`*Request.*\`, \`*Response.*\` → pattern "dto"
|
|
727
|
+
- \`*Factory.*\`, \`*Builder.*\` → pattern "factory/builder"
|
|
728
|
+
- Any other recurring naming pattern (\`*Hook.ts\`, \`*Composable.ts\`, \`*Store.ts\`, etc.)
|
|
729
|
+
4. For each pattern found, read 2-3 exemplar files and extract:
|
|
730
|
+
- Common structure (imports, exports, class vs function)
|
|
731
|
+
- Naming conventions
|
|
732
|
+
- Dependency patterns (what it injects, what it returns)
|
|
733
|
+
- Error handling patterns
|
|
734
|
+
- Validation patterns
|
|
735
|
+
|
|
736
|
+
### Phase 2 — Generate Hierarchical AGENTS.md
|
|
737
|
+
|
|
738
|
+
5. Generate or refresh hierarchical \`AGENTS.md\` files inside \`\$PROJECT_ROOT\`:
|
|
739
|
+
- Root \`\$PROJECT_ROOT/AGENTS.md\`: stack summary, real build/test commands, directory layout, critical repo rules
|
|
740
|
+
- Directory-level \`AGENTS.md\`: local architecture, invariants, module boundaries, integration contracts
|
|
741
|
+
6. Keep each generated \`AGENTS.md\` scoped to its directory only:
|
|
742
|
+
- no copy-pasting the entire root file into child directories
|
|
743
|
+
- no business-domain detail that belongs in \`docs/domain/*\`
|
|
744
|
+
- commands must match the actual repository scripts and build tools
|
|
745
|
+
|
|
746
|
+
### Phase 3 — Generate Dynamic Skills
|
|
747
|
+
|
|
748
|
+
7. For each discovered pattern, create a skill in \`.opencode/skills/j.{pattern}-writing/SKILL.md\` (at the **harness root**, not the project root — skills are shared across projects):
|
|
749
|
+
- Frontmatter with \`name\`, \`description\`
|
|
750
|
+
- "When this skill activates" with the glob patterns from the project
|
|
751
|
+
- "Required Steps" extracted from the exemplar file analysis
|
|
752
|
+
- "Anti-patterns to avoid" based on what the exemplars do NOT do
|
|
753
|
+
- Canonical example copied/adapted from a real project file
|
|
754
|
+
- Before finalizing or revising any skill, load and apply the local \`skill-creator\` skill so the description, trigger criteria, and eval hooks are explicit
|
|
755
|
+
8. Update \`.opencode/skill-map.json\` (at the harness root) with new regex patterns for each skill
|
|
756
|
+
9. For every created or changed skill, add intelligent eval coverage that proves:
|
|
757
|
+
- the skill triggers under realistic prompts
|
|
758
|
+
- near-miss prompts do not trigger it
|
|
759
|
+
- the skill changes agent behavior on at least one implementation task
|
|
760
|
+
|
|
761
|
+
### Phase 4 — Generate Documentation
|
|
762
|
+
|
|
763
|
+
10. Generate initial docs in \`\$PROJECT_ROOT/docs/domain/\` (subdirectories by discovered domain)
|
|
764
|
+
11. Generate initial docs in \`\$PROJECT_ROOT/docs/principles/\` based on patterns found
|
|
765
|
+
12. Populate \`\$PROJECT_ROOT/docs/principles/manifest\` with real keywords
|
|
766
|
+
13. Populate \`\$PROJECT_ROOT/docs/domain/INDEX.md\` with real entries and CARL keywords
|
|
767
|
+
|
|
768
|
+
### Phase 5 — Refresh Local Automation Stubs
|
|
769
|
+
|
|
770
|
+
14. Validate \`.opencode/scripts/lint-structure.sh\` (at harness root)
|
|
771
|
+
15. Validate \`.opencode/scripts/test-related.sh\` (at harness root)
|
|
772
|
+
16. Validate \`.opencode/scripts/check-all.sh\` (at harness root)
|
|
773
|
+
17. Align commands documented in generated \`AGENTS.md\` files with the actual repository scripts and build tools found in \`\$PROJECT_ROOT\`
|
|
774
|
+
|
|
775
|
+
## Delegation Rule (MANDATORY)
|
|
776
|
+
|
|
777
|
+
You MUST use \`@j.explore\` for Phase 1. Do NOT try to scan the codebase yourself.
|
|
778
|
+
|
|
779
|
+
When \`@j.explore\` returns its report:
|
|
780
|
+
- Read the FULL report
|
|
781
|
+
- Extract all file patterns and structural findings
|
|
782
|
+
- Use them to generate AGENTS, skills, and docs
|
|
783
|
+
|
|
784
|
+
## When to use
|
|
785
|
+
|
|
786
|
+
- Right after \`juninho setup\` on an existing project
|
|
787
|
+
- After major structural refactors that introduce new file patterns
|
|
788
|
+
- When onboarding a new project to the framework
|
|
789
|
+
- In multi-repo workspaces, to bootstrap a target project that lacks context artifacts (AGENTS.md, docs/domain, docs/principles)
|
|
790
|
+
- After \`/j.finish-setup\` generates files, review and augment them with non-obvious domain knowledge
|
|
791
|
+
|
|
792
|
+
## Result
|
|
793
|
+
|
|
794
|
+
After completion, the target project will have:
|
|
795
|
+
- Hierarchical \`AGENTS.md\` files aligned to the real directory structure
|
|
796
|
+
- Custom skills registered in the harness that match the project's file patterns and conventions
|
|
797
|
+
- Domain documentation populated with real business domains at \`\$PROJECT_ROOT/docs/domain/\`
|
|
798
|
+
- Principles documentation reflecting actual codebase patterns at \`\$PROJECT_ROOT/docs/principles/\`
|
|
799
|
+
- Updated local automation stubs and command references
|
|
679
800
|
`;
|
|
680
801
|
//# sourceMappingURL=commands.js.map
|