@benzotti/jedi 0.1.31 → 0.1.33
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/dist/index.js +190 -5
- package/framework/agents/jdi-planner.md +26 -15
- package/framework/commands/create-plan.md +10 -4
- package/framework/commands/implement-plan.md +9 -9
- package/framework/commands/pr-review.md +18 -0
- package/framework/components/meta/StateUpdate.md +7 -1
- package/framework/components/quality/PRReview.md +12 -1
- package/framework/templates/CLAUDE-SHARED.md +19 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9355,7 +9355,7 @@ Recognise natural language JDI intents and invoke the matching skill via the Ski
|
|
|
9355
9355
|
|
|
9356
9356
|
Extract flags from context: "in a worktree" \u2192 \`--worktree\`, "lightweight" \u2192 \`--worktree-lightweight\`, "single agent" \u2192 \`--single\`, "use teams" \u2192 \`--team\`. If the intent is unclear, ask. Never guess.
|
|
9357
9357
|
|
|
9358
|
-
Planning and implementation are separate
|
|
9358
|
+
Planning and implementation are separate human-gated phases \u2014 NEVER auto-proceed to implementation after plan approval. When a plan is approved, STOP and wait for an explicit implementation request.
|
|
9359
9359
|
|
|
9360
9360
|
## Iterative Refinement
|
|
9361
9361
|
|
|
@@ -9379,7 +9379,7 @@ Recognise natural language JDI intents and invoke the matching skill via the Ski
|
|
|
9379
9379
|
|
|
9380
9380
|
Extract flags from context: "in a worktree" \u2192 \`--worktree\`, "lightweight" \u2192 \`--worktree-lightweight\`, "single agent" \u2192 \`--single\`, "use teams" \u2192 \`--team\`. If the intent is unclear, ask. Never guess.
|
|
9381
9381
|
|
|
9382
|
-
Planning and implementation are separate
|
|
9382
|
+
Planning and implementation are separate human-gated phases \u2014 NEVER auto-proceed to implementation after plan approval. When a plan is approved, STOP and wait for an explicit implementation request.
|
|
9383
9383
|
|
|
9384
9384
|
## Iterative Refinement
|
|
9385
9385
|
|
|
@@ -9873,6 +9873,24 @@ function buildProjectContext(ctx) {
|
|
|
9873
9873
|
}
|
|
9874
9874
|
return lines;
|
|
9875
9875
|
}
|
|
9876
|
+
function buildLearningsBlock(techStack) {
|
|
9877
|
+
const lower = techStack.toLowerCase();
|
|
9878
|
+
const base = ".jdi/framework/learnings";
|
|
9879
|
+
const files = [`${base}/general.md`];
|
|
9880
|
+
if (/php|laravel/.test(lower))
|
|
9881
|
+
files.push(`${base}/backend.md`);
|
|
9882
|
+
if (/react|typescript|\.ts|frontend|vite/.test(lower))
|
|
9883
|
+
files.push(`${base}/frontend.md`);
|
|
9884
|
+
if (/test|vitest|pest/.test(lower))
|
|
9885
|
+
files.push(`${base}/testing.md`);
|
|
9886
|
+
if (/docker|ci|deploy/.test(lower))
|
|
9887
|
+
files.push(`${base}/devops.md`);
|
|
9888
|
+
return [
|
|
9889
|
+
`## Learnings`,
|
|
9890
|
+
`Read these learnings files and follow any conventions found (learnings override defaults):`,
|
|
9891
|
+
...files.map((f3) => `- ${f3}`)
|
|
9892
|
+
];
|
|
9893
|
+
}
|
|
9876
9894
|
function agentPaths(cwd) {
|
|
9877
9895
|
return {
|
|
9878
9896
|
baseProtocol: resolve3(cwd, ".jdi/framework/components/meta/AgentBase.md"),
|
|
@@ -9905,6 +9923,8 @@ function buildImplementPrompt(ctx, planPath, overrideFlag) {
|
|
|
9905
9923
|
``,
|
|
9906
9924
|
...buildProjectContext(ctx),
|
|
9907
9925
|
``,
|
|
9926
|
+
...buildLearningsBlock(ctx.techStack),
|
|
9927
|
+
``,
|
|
9908
9928
|
`## Task`,
|
|
9909
9929
|
`Execute implementation plan: ${resolve3(ctx.cwd, planPath)}${overrideFlag ? `
|
|
9910
9930
|
Override: ${overrideFlag}` : ""}`,
|
|
@@ -9934,6 +9954,8 @@ function buildQuickPrompt(ctx, description) {
|
|
|
9934
9954
|
`- Working directory: ${ctx.cwd}`,
|
|
9935
9955
|
`- Project type: ${ctx.projectType}`,
|
|
9936
9956
|
``,
|
|
9957
|
+
...buildLearningsBlock(ctx.techStack),
|
|
9958
|
+
``,
|
|
9937
9959
|
`## Instructions`,
|
|
9938
9960
|
`1. Make the minimal change needed to accomplish the task`,
|
|
9939
9961
|
`2. Keep changes focused \u2014 do not refactor surrounding code`,
|
|
@@ -9953,6 +9975,9 @@ function buildReviewPrompt(ctx, prNum, meta, diff) {
|
|
|
9953
9975
|
``,
|
|
9954
9976
|
meta,
|
|
9955
9977
|
``,
|
|
9978
|
+
...buildLearningsBlock(ctx.techStack),
|
|
9979
|
+
`Cross-reference learnings against every change \u2014 flag violations and praise adherence.`,
|
|
9980
|
+
``,
|
|
9956
9981
|
`## Diff`,
|
|
9957
9982
|
"```diff",
|
|
9958
9983
|
diff,
|
|
@@ -9970,6 +9995,7 @@ function buildReviewPrompt(ctx, prNum, meta, diff) {
|
|
|
9970
9995
|
`- Does it follow the project's existing patterns?`,
|
|
9971
9996
|
`- Are naming conventions consistent?`,
|
|
9972
9997
|
`- Is the code well-organised?`,
|
|
9998
|
+
`- Does it follow the team's documented learnings?`,
|
|
9973
9999
|
``,
|
|
9974
10000
|
`### Security`,
|
|
9975
10001
|
`- Any injection risks (SQL, XSS, command)?`,
|
|
@@ -10058,6 +10084,34 @@ async function writeState(cwd, state) {
|
|
|
10058
10084
|
}
|
|
10059
10085
|
|
|
10060
10086
|
// src/utils/state-handlers.ts
|
|
10087
|
+
async function transitionToPlanReady(cwd, planPath, planName) {
|
|
10088
|
+
const state = await readState(cwd) ?? {};
|
|
10089
|
+
state.position = {
|
|
10090
|
+
...state.position,
|
|
10091
|
+
plan: planPath,
|
|
10092
|
+
plan_name: planName,
|
|
10093
|
+
status: "planning"
|
|
10094
|
+
};
|
|
10095
|
+
state.current_plan = {
|
|
10096
|
+
...state.current_plan,
|
|
10097
|
+
path: planPath
|
|
10098
|
+
};
|
|
10099
|
+
state.review = {
|
|
10100
|
+
...state.review,
|
|
10101
|
+
status: "in_review",
|
|
10102
|
+
scope: "plan"
|
|
10103
|
+
};
|
|
10104
|
+
await updateSessionActivity(cwd, state);
|
|
10105
|
+
}
|
|
10106
|
+
async function transitionToApproved(cwd) {
|
|
10107
|
+
const state = await readState(cwd) ?? {};
|
|
10108
|
+
state.review = {
|
|
10109
|
+
...state.review,
|
|
10110
|
+
status: "approved",
|
|
10111
|
+
approved_at: new Date().toISOString()
|
|
10112
|
+
};
|
|
10113
|
+
await updateSessionActivity(cwd, state);
|
|
10114
|
+
}
|
|
10061
10115
|
async function transitionToExecuting(cwd, taskId, taskName) {
|
|
10062
10116
|
const state = await readState(cwd) ?? {};
|
|
10063
10117
|
state.position = {
|
|
@@ -10076,6 +10130,23 @@ async function transitionToComplete(cwd) {
|
|
|
10076
10130
|
};
|
|
10077
10131
|
await updateSessionActivity(cwd, state);
|
|
10078
10132
|
}
|
|
10133
|
+
async function advanceTask(cwd, completedTaskId) {
|
|
10134
|
+
const state = await readState(cwd) ?? {};
|
|
10135
|
+
if (state.current_plan) {
|
|
10136
|
+
const completed = state.current_plan.completed_tasks ?? [];
|
|
10137
|
+
if (!completed.includes(completedTaskId)) {
|
|
10138
|
+
completed.push(completedTaskId);
|
|
10139
|
+
}
|
|
10140
|
+
state.current_plan.completed_tasks = completed;
|
|
10141
|
+
const tasks = state.current_plan.tasks ?? [];
|
|
10142
|
+
const nextIndex = completed.length;
|
|
10143
|
+
state.current_plan.current_task_index = nextIndex < tasks.length ? nextIndex : null;
|
|
10144
|
+
}
|
|
10145
|
+
if (state.progress) {
|
|
10146
|
+
state.progress.tasks_completed = (state.progress.tasks_completed ?? 0) + 1;
|
|
10147
|
+
}
|
|
10148
|
+
await updateSessionActivity(cwd, state);
|
|
10149
|
+
}
|
|
10079
10150
|
async function updateSessionActivity(cwd, state) {
|
|
10080
10151
|
state.session = {
|
|
10081
10152
|
...state.session,
|
|
@@ -10599,7 +10670,8 @@ ${data.body}` : ""
|
|
|
10599
10670
|
meta = metaResult.stdout;
|
|
10600
10671
|
}
|
|
10601
10672
|
}
|
|
10602
|
-
const
|
|
10673
|
+
const ctx = await gatherPromptContext(process.cwd());
|
|
10674
|
+
const prompt2 = buildReviewPrompt(ctx, String(prNum), meta, diffResult.stdout);
|
|
10603
10675
|
if (args.output) {
|
|
10604
10676
|
await Bun.write(resolve7(process.cwd(), args.output), prompt2);
|
|
10605
10677
|
consola.success(`Review prompt written to ${args.output}`);
|
|
@@ -11709,6 +11781,8 @@ Say **\`Hey Jedi implement\`** when you're ready to go.`;
|
|
|
11709
11781
|
``,
|
|
11710
11782
|
...contextLines,
|
|
11711
11783
|
``,
|
|
11784
|
+
...buildLearningsBlock(techStack),
|
|
11785
|
+
``,
|
|
11712
11786
|
fenceUserInput("conversation-history", conversationHistory),
|
|
11713
11787
|
``,
|
|
11714
11788
|
`## Feedback on Implementation`,
|
|
@@ -11836,6 +11910,8 @@ Use the ClickUp ticket above as the primary requirements source.` : ``,
|
|
|
11836
11910
|
`Read ${resolve11(cwd, ".jdi/framework/components/meta/AgentTeamsOrchestration.md")} for Agent Teams orchestration (if needed).`,
|
|
11837
11911
|
``,
|
|
11838
11912
|
...contextLines,
|
|
11913
|
+
``,
|
|
11914
|
+
...buildLearningsBlock(techStack),
|
|
11839
11915
|
historyBlock,
|
|
11840
11916
|
`## Task`,
|
|
11841
11917
|
`Execute the current implementation plan. Read state.yaml for the active plan path.`,
|
|
@@ -11856,6 +11932,8 @@ Use the ClickUp ticket above as the primary requirements source.` : ``,
|
|
|
11856
11932
|
`Read ${baseProtocol} for the base agent protocol.`,
|
|
11857
11933
|
``,
|
|
11858
11934
|
...contextLines,
|
|
11935
|
+
``,
|
|
11936
|
+
...buildLearningsBlock(techStack),
|
|
11859
11937
|
historyBlock,
|
|
11860
11938
|
`## Task`,
|
|
11861
11939
|
`Make this quick change:`,
|
|
@@ -11931,6 +12009,8 @@ Use the ClickUp ticket above as the primary requirements source.` : ``,
|
|
|
11931
12009
|
``,
|
|
11932
12010
|
...contextLines,
|
|
11933
12011
|
``,
|
|
12012
|
+
...buildLearningsBlock(techStack),
|
|
12013
|
+
``,
|
|
11934
12014
|
`## Task`,
|
|
11935
12015
|
`Execute the most recently created implementation plan in .jdi/plans/.`,
|
|
11936
12016
|
`Follow the implement-plan orchestration.`,
|
|
@@ -12063,10 +12143,114 @@ var setupActionCommand = defineCommand({
|
|
|
12063
12143
|
`));
|
|
12064
12144
|
}
|
|
12065
12145
|
});
|
|
12146
|
+
|
|
12147
|
+
// src/commands/state.ts
|
|
12148
|
+
var planReadyCommand = defineCommand({
|
|
12149
|
+
meta: {
|
|
12150
|
+
name: "plan-ready",
|
|
12151
|
+
description: "Transition state after plan creation"
|
|
12152
|
+
},
|
|
12153
|
+
args: {
|
|
12154
|
+
"plan-path": {
|
|
12155
|
+
type: "string",
|
|
12156
|
+
description: "Path to the plan file",
|
|
12157
|
+
required: true
|
|
12158
|
+
},
|
|
12159
|
+
"plan-name": {
|
|
12160
|
+
type: "string",
|
|
12161
|
+
description: "Human-readable plan name",
|
|
12162
|
+
required: true
|
|
12163
|
+
}
|
|
12164
|
+
},
|
|
12165
|
+
async run({ args }) {
|
|
12166
|
+
const cwd = process.cwd();
|
|
12167
|
+
await transitionToPlanReady(cwd, args["plan-path"], args["plan-name"]);
|
|
12168
|
+
consola.success(`State \u2192 plan-ready (${args["plan-name"]})`);
|
|
12169
|
+
}
|
|
12170
|
+
});
|
|
12171
|
+
var approvedCommand = defineCommand({
|
|
12172
|
+
meta: {
|
|
12173
|
+
name: "approved",
|
|
12174
|
+
description: "Transition state after plan approval"
|
|
12175
|
+
},
|
|
12176
|
+
async run() {
|
|
12177
|
+
const cwd = process.cwd();
|
|
12178
|
+
await transitionToApproved(cwd);
|
|
12179
|
+
consola.success("State \u2192 approved");
|
|
12180
|
+
}
|
|
12181
|
+
});
|
|
12182
|
+
var executingCommand = defineCommand({
|
|
12183
|
+
meta: {
|
|
12184
|
+
name: "executing",
|
|
12185
|
+
description: "Transition state when implementation starts"
|
|
12186
|
+
},
|
|
12187
|
+
args: {
|
|
12188
|
+
"task-id": {
|
|
12189
|
+
type: "string",
|
|
12190
|
+
description: "Current task ID",
|
|
12191
|
+
required: false
|
|
12192
|
+
},
|
|
12193
|
+
"task-name": {
|
|
12194
|
+
type: "string",
|
|
12195
|
+
description: "Current task name",
|
|
12196
|
+
required: false
|
|
12197
|
+
}
|
|
12198
|
+
},
|
|
12199
|
+
async run({ args }) {
|
|
12200
|
+
const cwd = process.cwd();
|
|
12201
|
+
await transitionToExecuting(cwd, args["task-id"], args["task-name"]);
|
|
12202
|
+
consola.success("State \u2192 executing");
|
|
12203
|
+
}
|
|
12204
|
+
});
|
|
12205
|
+
var completeCommand = defineCommand({
|
|
12206
|
+
meta: {
|
|
12207
|
+
name: "complete",
|
|
12208
|
+
description: "Transition state after implementation finishes"
|
|
12209
|
+
},
|
|
12210
|
+
async run() {
|
|
12211
|
+
const cwd = process.cwd();
|
|
12212
|
+
await transitionToComplete(cwd);
|
|
12213
|
+
consola.success("State \u2192 complete");
|
|
12214
|
+
}
|
|
12215
|
+
});
|
|
12216
|
+
var advanceTaskCommand = defineCommand({
|
|
12217
|
+
meta: {
|
|
12218
|
+
name: "advance-task",
|
|
12219
|
+
description: "Mark a task as completed and advance to next"
|
|
12220
|
+
},
|
|
12221
|
+
args: {
|
|
12222
|
+
"task-id": {
|
|
12223
|
+
type: "positional",
|
|
12224
|
+
description: "ID of the completed task",
|
|
12225
|
+
required: true
|
|
12226
|
+
}
|
|
12227
|
+
},
|
|
12228
|
+
async run({ args }) {
|
|
12229
|
+
const cwd = process.cwd();
|
|
12230
|
+
await advanceTask(cwd, args["task-id"]);
|
|
12231
|
+
const state = await readState(cwd);
|
|
12232
|
+
const completed = state?.current_plan?.completed_tasks?.length ?? 0;
|
|
12233
|
+
const total = state?.current_plan?.tasks?.length ?? 0;
|
|
12234
|
+
consola.success(`Task ${args["task-id"]} completed (${completed}/${total})`);
|
|
12235
|
+
}
|
|
12236
|
+
});
|
|
12237
|
+
var stateCommand = defineCommand({
|
|
12238
|
+
meta: {
|
|
12239
|
+
name: "state",
|
|
12240
|
+
description: "Manage JDI state transitions"
|
|
12241
|
+
},
|
|
12242
|
+
subCommands: {
|
|
12243
|
+
"plan-ready": planReadyCommand,
|
|
12244
|
+
approved: approvedCommand,
|
|
12245
|
+
executing: executingCommand,
|
|
12246
|
+
complete: completeCommand,
|
|
12247
|
+
"advance-task": advanceTaskCommand
|
|
12248
|
+
}
|
|
12249
|
+
});
|
|
12066
12250
|
// package.json
|
|
12067
12251
|
var package_default = {
|
|
12068
12252
|
name: "@benzotti/jedi",
|
|
12069
|
-
version: "0.1.
|
|
12253
|
+
version: "0.1.33",
|
|
12070
12254
|
description: "JDI - Context-efficient AI development framework for Claude Code",
|
|
12071
12255
|
type: "module",
|
|
12072
12256
|
bin: {
|
|
@@ -12128,7 +12312,8 @@ var main = defineCommand({
|
|
|
12128
12312
|
"plan-review": planReviewCommand,
|
|
12129
12313
|
"plan-approve": planApproveCommand,
|
|
12130
12314
|
action: actionCommand,
|
|
12131
|
-
"setup-action": setupActionCommand
|
|
12315
|
+
"setup-action": setupActionCommand,
|
|
12316
|
+
state: stateCommand
|
|
12132
12317
|
}
|
|
12133
12318
|
});
|
|
12134
12319
|
runMain(main);
|
|
@@ -15,14 +15,16 @@ You create executable implementation plans with proper task sizing, dependency m
|
|
|
15
15
|
|
|
16
16
|
## CRITICAL: Scope Discipline
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Do not add unrelated extras (tooling, testing, linting, CI) unless the user explicitly requests them. But you MUST thoroughly investigate the full scope of what WAS requested — including implicit requirements.
|
|
19
19
|
|
|
20
20
|
**Rules:**
|
|
21
|
-
1. **
|
|
22
|
-
2. **
|
|
23
|
-
3. **
|
|
24
|
-
4. **
|
|
25
|
-
5. **
|
|
21
|
+
1. **Do not add unrelated extras.** If the user says "react app with vite and typescript", plan scaffold and config — not linting, CI, or testing unless asked.
|
|
22
|
+
2. **DO investigate the full scope of the request.** "Scope discipline" means no unrelated additions — it does NOT mean ignoring requirements that are clearly implied by the request. If the user asks for a UI view with specific columns, you must verify those columns exist in the backend response, and plan to add them if they don't.
|
|
23
|
+
3. **When reference PRs/tickets are provided, analyse them thoroughly.** Read the actual diff, files changed, patterns used, columns/fields added, routes created, and data flow. The user provides reference PRs so you follow the same pattern — extract the full pattern, don't just skim.
|
|
24
|
+
4. **When the user says "backend is already done", verify it.** Read the actual API endpoint, check what fields it returns, and confirm they match the frontend requirements. If there's a gap, include it in the plan.
|
|
25
|
+
5. **Do not make subjective decisions.** If something is ambiguous (e.g. folder structure, routing library, state management), list it as an open question and ask the user — do not guess.
|
|
26
|
+
6. **Suggest optional additions separately.** After presenting the plan, list 3-5 common additions the user might want. These are suggestions, NOT part of the plan.
|
|
27
|
+
7. **Same request = same plan.** Two identical requests must produce structurally identical plans. Achieve this by following the templates exactly and not improvising.
|
|
26
28
|
|
|
27
29
|
## CRITICAL: Read Learnings First
|
|
28
30
|
|
|
@@ -38,10 +40,11 @@ You MUST write files using Write/Edit tools. Returning plan content as text is N
|
|
|
38
40
|
Required files:
|
|
39
41
|
1. `.jdi/plans/{phase}-{plan}-{slug}.plan.md` (index file)
|
|
40
42
|
2. `.jdi/plans/{phase}-{plan}-{slug}.T{n}.md` (one per task)
|
|
41
|
-
3. `.jdi/config/
|
|
42
|
-
4. `.jdi/
|
|
43
|
-
5. `.jdi/
|
|
44
|
-
|
|
43
|
+
3. `.jdi/config/variables.yaml`
|
|
44
|
+
4. `.jdi/ROADMAP.yaml` (add plan entry)
|
|
45
|
+
5. `.jdi/REQUIREMENTS.yaml` (add traceability)
|
|
46
|
+
|
|
47
|
+
**Do NOT manually edit `.jdi/config/state.yaml`** — state transitions are handled via CLI commands (e.g. `npx jdi state plan-ready`).
|
|
45
48
|
|
|
46
49
|
## File Naming
|
|
47
50
|
|
|
@@ -87,6 +90,15 @@ Never use time estimates. Use S/M/L sizing in task manifests and plan summaries.
|
|
|
87
90
|
4. Research: standard stack, architecture patterns, common pitfalls
|
|
88
91
|
5. Findings feed directly into planning (no separate RESEARCH.md)
|
|
89
92
|
|
|
93
|
+
### Step 0b: Reference Analysis (when provided)
|
|
94
|
+
|
|
95
|
+
If the user provides reference PRs, tickets, or example implementations:
|
|
96
|
+
|
|
97
|
+
1. **Reference PRs**: Fetch each PR's diff (`gh pr diff {number}`), list of changed files (`gh pr view {number} --json files`), and description. Analyse the **complete pattern**: what files were changed, what columns/fields were added, what routes were created, what data transformations were applied. The reference PR defines the pattern you must follow — extract every detail.
|
|
98
|
+
2. **Existing backend/API work**: When the user states "backend is already done" or implies API endpoints exist, verify by reading the actual route files, controllers, and response shapes. Confirm the API returns all fields the frontend will need. If fields are missing, include them in the plan.
|
|
99
|
+
3. **ClickUp/ticket context**: If a ticket URL is provided, read the ticket's description, acceptance criteria, and any attached specifications. Cross-reference against what the plan covers.
|
|
100
|
+
4. **Data requirements for UI work**: When planning a view/page/table, explicitly list every column/field the UI needs, verify each one exists in the API response, and plan to add any that are missing (both backend and frontend).
|
|
101
|
+
|
|
90
102
|
### Step 1: Discovery
|
|
91
103
|
|
|
92
104
|
<JDI:TaskBreakdown source="requirements" />
|
|
@@ -94,6 +106,8 @@ Never use time estimates. Use S/M/L sizing in task manifests and plan summaries.
|
|
|
94
106
|
#### Mandatory Verification (never skip)
|
|
95
107
|
- **Bug fixes**: Grep the symptom across entire codebase. Trace every occurrence through all layers. Do not stop at first match.
|
|
96
108
|
- **API boundaries**: Read backend route, controller, and request validation (or frontend consumer). Never assume endpoint fields.
|
|
109
|
+
- **UI views/tables**: List every column from the requirements. Verify each column's data source exists in the backend response. Plan to add missing fields end-to-end (backend + frontend).
|
|
110
|
+
- **Reference PR patterns**: If reference PRs were provided, verify the plan covers every layer those PRs touched (routes, controllers, types, components, hooks, etc.).
|
|
97
111
|
|
|
98
112
|
### Step 2: Scope Estimation
|
|
99
113
|
If >4 tasks or >3 hours, split into multiple plans.
|
|
@@ -133,12 +147,9 @@ Types: `checkpoint:human-verify`, `checkpoint:decision`, `checkpoint:human-actio
|
|
|
133
147
|
|
|
134
148
|
### Step 7: Generate Plan Document and Update Scaffolding (WRITE FILES)
|
|
135
149
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
#### 7-pre: Update State Files
|
|
139
|
-
Read `.jdi/config/state.yaml` (create from template if missing). Update: `position.phase`, `position.plan`, `position.status` → `"planning"`, `progress.plans_total`, `progress.tasks_total`, `current_plan.path`, `current_plan.tasks`. Each task entry must include `file:` field pointing to the task file path.
|
|
150
|
+
**Do NOT manually edit `.jdi/config/state.yaml`** — use `npx jdi state` CLI commands for transitions. Only record decisions, deviations, or blockers via `<JDI:StateUpdate />`.
|
|
140
151
|
|
|
141
|
-
#### 7-pre
|
|
152
|
+
#### 7-pre: Update Variables
|
|
142
153
|
Read `.jdi/config/variables.yaml` (create from template if missing). Update: `feature.name`, `feature.description`, `feature.type`.
|
|
143
154
|
|
|
144
155
|
#### 7a: Write Plan Files (Split Format)
|
|
@@ -22,10 +22,16 @@ Create an implementation plan using a single planner agent (includes research).
|
|
|
22
22
|
4. Quick Mode Detection — suggest /jdi:quick for trivial tasks
|
|
23
23
|
5. Spawn `jdi-planner` agent (subagent_type="general-purpose") — creates PLAN.md with tasks, deps, waves
|
|
24
24
|
6. Collect and execute deferred ops
|
|
25
|
-
7. Update state
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
7. **Update state via CLI** — do NOT manually edit state.yaml. Run:
|
|
26
|
+
```bash
|
|
27
|
+
npx jdi state plan-ready --plan-path ".jdi/plans/{plan-file}" --plan-name "{plan name}"
|
|
28
|
+
```
|
|
29
|
+
8. **Present summary** (name, objective, task table, files) then ask: _"Provide feedback to refine, or say **approved** to finalise."_
|
|
30
|
+
9. **Review loop**: Feedback → revise plan in-place, increment revision, re-present summary. Repeat until approved. Approval → run `npx jdi state approved`, then **STOP**.
|
|
31
|
+
|
|
32
|
+
## HARD STOP — Planning Gate
|
|
33
|
+
|
|
34
|
+
After the user approves the plan, your work is **DONE**. Output: _"Plan approved and finalised. Run `/jdi:implement-plan` when ready to execute."_ Then **STOP completely**. Do NOT invoke `/jdi:implement-plan`, do NOT spawn implementation agents, do NOT begin writing source code. Planning and implementation are separate human-gated phases.
|
|
29
35
|
|
|
30
36
|
Agent base (read FIRST for cache): .jdi/framework/components/meta/AgentBase.md | Agent spec: .jdi/framework/agents/jdi-planner.md
|
|
31
37
|
|
|
@@ -15,18 +15,18 @@ Execute a PLAN.md with complexity-based routing.
|
|
|
15
15
|
|
|
16
16
|
1. Read codebase context (`.jdi/codebase/SUMMARY.md` if exists)
|
|
17
17
|
2. Read plan index file and state.yaml — parse frontmatter for tasks, deps, waves, tech_stack
|
|
18
|
-
3. **
|
|
19
|
-
4. **
|
|
20
|
-
5. **
|
|
21
|
-
6.
|
|
18
|
+
3. **Read learnings:** Always read `.jdi/framework/learnings/general.md`. Then read domain-specific learnings based on tech_stack from plan frontmatter: PHP → `backend.md`, TS/React → `frontend.md`. Follow any conventions found — learnings override defaults.
|
|
19
|
+
4. **Format detection:** If frontmatter contains `task_files:`, this is a split plan — task details are in separate files. If absent, legacy monolithic plan — all tasks inline.
|
|
20
|
+
5. **Complexity routing** (`<JDI:ComplexityRouter />`): Simple (≤3 tasks, single stack/wave) → single agent. Complex → Agent Teams swarm. Override: `--team` / `--single`
|
|
21
|
+
6. **Tech routing**: PHP → jdi-backend | TS/React → jdi-frontend | Full-stack → both
|
|
22
|
+
7. Execute:
|
|
22
23
|
- **Single agent:** Pass `PLAN: {index-path}`. For split plans, agent reads task files one at a time via `file:` field in state.yaml.
|
|
23
24
|
- **Agent Teams:** For split plans, pass `TASK_FILE: {task-file-path}` in each agent's spawn prompt so they load only their assigned task file(s). For legacy plans, pass `PLAN: {plan-path}` as before.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
10. Initialise review: `review.status` → `"draft"`, `review.revision` → 1, `review.scope` → `"implementation"`
|
|
25
|
+
8. Collect and execute deferred ops (files, commits)
|
|
26
|
+
9. Run verification (tests, lint, typecheck)
|
|
27
|
+
10. **Update state via CLI** — do NOT manually edit state.yaml. Run `npx jdi state executing` before execution and `npx jdi state complete` after. Use `npx jdi state advance-task {task-id}` after each task completes.
|
|
28
28
|
11. **Present summary** (tasks completed, files changed, verification results, deviations) then ask: _"Provide feedback to adjust, or say **approved** to finalise."_
|
|
29
|
-
12. **Review loop**:
|
|
29
|
+
12. **Review loop**: Feedback → apply code changes, run tests, increment revision, re-present. Approval → suggest commit/PR. Natural conversation — no separate command needed.
|
|
30
30
|
|
|
31
31
|
Agent base (read FIRST for cache): .jdi/framework/components/meta/AgentBase.md | Agent specs: .jdi/framework/agents/jdi-backend.md, .jdi/framework/agents/jdi-frontend.md
|
|
32
32
|
Orchestration: .jdi/framework/components/meta/AgentTeamsOrchestration.md | Routing: .jdi/framework/components/meta/ComplexityRouter.md
|
|
@@ -5,11 +5,29 @@ description: "JDI: Review pull request"
|
|
|
5
5
|
|
|
6
6
|
# /jdi:pr-review
|
|
7
7
|
|
|
8
|
+
Review a pull request with learnings-aware analysis.
|
|
9
|
+
|
|
10
|
+
## Flags
|
|
11
|
+
|
|
12
|
+
- `--no-comments` — Do not post comments to GitHub. Write review to `.jdi/reviews/PR-{number}-review.md` instead.
|
|
13
|
+
|
|
8
14
|
## Delegation
|
|
9
15
|
|
|
16
|
+
Parse flags from $ARGUMENTS. Map `--no-comments` to `post="false"`.
|
|
17
|
+
|
|
10
18
|
Use Task tool with subagent_type="general-purpose" and prompt:
|
|
11
19
|
|
|
12
20
|
Read ./.jdi/framework/components/meta/AgentBase.md for the base protocol.
|
|
21
|
+
|
|
22
|
+
Read learnings before reviewing — these represent the team's coding standards and MUST be cross-referenced during review:
|
|
23
|
+
- Always read: `.jdi/framework/learnings/general.md`
|
|
24
|
+
- For PHP/Laravel PRs: also read `.jdi/framework/learnings/backend.md`
|
|
25
|
+
- For React/TypeScript PRs: also read `.jdi/framework/learnings/frontend.md`
|
|
26
|
+
- For test changes: also read `.jdi/framework/learnings/testing.md`
|
|
27
|
+
- For CI/Docker changes: also read `.jdi/framework/learnings/devops.md`
|
|
28
|
+
Apply learnings as additional review criteria — flag violations and praise adherence.
|
|
29
|
+
|
|
13
30
|
Read ./.jdi/framework/components/quality/PRReview.md for review instructions.
|
|
31
|
+
{If --no-comments flag was present: Include `post="false"` parameter — invoke as `<JDI:PRReview post="false" />`}
|
|
14
32
|
|
|
15
33
|
Review PR: $ARGUMENTS
|
|
@@ -6,7 +6,13 @@ description: Record decisions, deviations, and blockers in state.yaml
|
|
|
6
6
|
|
|
7
7
|
# StateUpdate
|
|
8
8
|
|
|
9
|
-
> **Status transitions are handled
|
|
9
|
+
> **Status transitions are handled via CLI commands.** Do NOT manually edit `position`, `progress`, `current_plan`, `review`, or `session` fields in state.yaml. Use these commands instead:
|
|
10
|
+
>
|
|
11
|
+
> - `npx jdi state plan-ready --plan-path "{path}" --plan-name "{name}"`
|
|
12
|
+
> - `npx jdi state approved`
|
|
13
|
+
> - `npx jdi state executing`
|
|
14
|
+
> - `npx jdi state complete`
|
|
15
|
+
> - `npx jdi state advance-task {task-id}`
|
|
10
16
|
|
|
11
17
|
Use state.yaml ONLY to record decisions, deviations, or blockers:
|
|
12
18
|
|
|
@@ -74,9 +74,20 @@ If context provided:
|
|
|
74
74
|
|
|
75
75
|
Read each changed file in its entirety (not just the diff). **NEVER** use limit/offset.
|
|
76
76
|
|
|
77
|
+
### Step 5b: Cross-Reference Learnings (MANDATORY)
|
|
78
|
+
|
|
79
|
+
If learnings files were loaded (via the command stub or agent prompt), cross-reference every changed file against the team's learnings:
|
|
80
|
+
|
|
81
|
+
1. For each finding from the review checklist, check if a learning exists that addresses it — cite the learning in your comment.
|
|
82
|
+
2. Flag any code that **violates** a documented learning (e.g. a learning says "always use path aliases" but the PR uses relative imports).
|
|
83
|
+
3. **Praise** code that follows learnings the team has documented — this reinforces good patterns.
|
|
84
|
+
4. If no learnings were loaded, skip this step (but note it in your review summary as a gap).
|
|
85
|
+
|
|
86
|
+
Learnings-based findings should use the same severity classification as other findings. A violation of a documented team convention is at minimum a **minor** finding.
|
|
87
|
+
|
|
77
88
|
### Step 6: Perform Code Review
|
|
78
89
|
|
|
79
|
-
Apply <JDI:PRReview:Checklist /> to analyse each change.
|
|
90
|
+
Apply <JDI:PRReview:Checklist /> to analyse each change. Include learnings violations alongside standard checklist findings.
|
|
80
91
|
|
|
81
92
|
### Step 7: Categorise Findings (Internal)
|
|
82
93
|
|
|
@@ -30,13 +30,27 @@ When you learn something new from a review or feedback, update the appropriate c
|
|
|
30
30
|
|
|
31
31
|
## Scope Discipline
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Do not add unrelated extras, tooling, or features the user did not ask for. But DO investigate the full scope of what was requested — including implicit requirements that are clearly part of the ask (e.g. if a UI view needs columns, verify the backend provides them).
|
|
34
34
|
If something is ambiguous, ask — do not guess.
|
|
35
35
|
NEVER use time estimates (minutes, hours, etc). Use S/M/L t-shirt sizing for all task and plan sizing.
|
|
36
36
|
Follow response templates exactly as instructed in the prompt — do not improvise the layout or structure.
|
|
37
37
|
|
|
38
|
-
## Approval Gate
|
|
38
|
+
## Approval Gate — HARD STOP
|
|
39
39
|
|
|
40
|
-
Planning and implementation are separate
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
Planning and implementation are **separate human-gated phases**. NEVER auto-proceed to implementation after planning or plan refinement.
|
|
41
|
+
|
|
42
|
+
- When the user says "approved" / "lgtm" / "looks good" to a **plan**: this means the plan is finalised. It does NOT mean "go implement it." Finalise the plan review, output _"Plan approved. Run `/jdi:implement-plan` when ready."_, then **STOP**.
|
|
43
|
+
- When the user provides refinement feedback on a plan, ONLY update the plan files in `.jdi/plans/`. Do NOT implement code.
|
|
44
|
+
- Implementation ONLY happens when the user explicitly requests it: "implement", "build", "execute", or `/jdi:implement-plan`.
|
|
45
|
+
|
|
46
|
+
## State Management
|
|
47
|
+
|
|
48
|
+
Do NOT manually edit `.jdi/config/state.yaml` for status transitions. Use the CLI instead:
|
|
49
|
+
|
|
50
|
+
- `npx jdi state plan-ready --plan-path "{path}" --plan-name "{name}"` — after plan creation
|
|
51
|
+
- `npx jdi state approved` — after plan approval
|
|
52
|
+
- `npx jdi state executing` — before implementation starts
|
|
53
|
+
- `npx jdi state complete` — after implementation finishes
|
|
54
|
+
- `npx jdi state advance-task {task-id}` — after each task completes
|
|
55
|
+
|
|
56
|
+
You may only append to `decisions`, `deviations`, or `blockers` arrays in state.yaml directly via `<JDI:StateUpdate />`.
|