@benzotti/jdi 0.1.46

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.
Files changed (89) hide show
  1. package/README.md +431 -0
  2. package/action/action.yml +116 -0
  3. package/action/workflow-template.yml +242 -0
  4. package/dist/index.js +12860 -0
  5. package/framework/adapters/generic.yaml +23 -0
  6. package/framework/adapters/laravel.yaml +46 -0
  7. package/framework/adapters/nextjs.yaml +36 -0
  8. package/framework/adapters/node.yaml +29 -0
  9. package/framework/agents/jdi-architect.md +147 -0
  10. package/framework/agents/jdi-backend.md +79 -0
  11. package/framework/agents/jdi-codebase-mapper.md +59 -0
  12. package/framework/agents/jdi-committer.md +83 -0
  13. package/framework/agents/jdi-debugger.md +73 -0
  14. package/framework/agents/jdi-devops.md +78 -0
  15. package/framework/agents/jdi-feedback-learner.md +93 -0
  16. package/framework/agents/jdi-frontend.md +78 -0
  17. package/framework/agents/jdi-head-engineering.md +30 -0
  18. package/framework/agents/jdi-perf-analyst.md +116 -0
  19. package/framework/agents/jdi-phase-researcher.md +59 -0
  20. package/framework/agents/jdi-plan-checker.md +80 -0
  21. package/framework/agents/jdi-planner.md +271 -0
  22. package/framework/agents/jdi-pr-feedback.md +120 -0
  23. package/framework/agents/jdi-pr-generator.md +100 -0
  24. package/framework/agents/jdi-producer.md +196 -0
  25. package/framework/agents/jdi-product-lead.md +44 -0
  26. package/framework/agents/jdi-programmer.md +104 -0
  27. package/framework/agents/jdi-qa-tester.md +113 -0
  28. package/framework/agents/jdi-quality.md +106 -0
  29. package/framework/agents/jdi-researcher.md +70 -0
  30. package/framework/agents/jdi-security.md +118 -0
  31. package/framework/agents/jdi-ux-designer.md +78 -0
  32. package/framework/agents/jdi-verifier.md +80 -0
  33. package/framework/commands/build.md +148 -0
  34. package/framework/commands/commit.md +71 -0
  35. package/framework/commands/create-plan.md +192 -0
  36. package/framework/commands/generate-pr.md +91 -0
  37. package/framework/commands/implement-plan.md +218 -0
  38. package/framework/commands/init.md +65 -0
  39. package/framework/commands/pr-feedback.md +75 -0
  40. package/framework/commands/pr-review.md +92 -0
  41. package/framework/commands/quick.md +124 -0
  42. package/framework/commands/status.md +13 -0
  43. package/framework/commands/worktree-remove.md +32 -0
  44. package/framework/commands/worktree.md +52 -0
  45. package/framework/components/execution/CodebaseContext.md +36 -0
  46. package/framework/components/execution/Commit.md +121 -0
  47. package/framework/components/execution/Verify.md +140 -0
  48. package/framework/components/execution/VerifyAdvanced.md +43 -0
  49. package/framework/components/meta/AgentBase.md +121 -0
  50. package/framework/components/meta/AgentRouter.md +318 -0
  51. package/framework/components/meta/AgentTeamsOrchestration.md +115 -0
  52. package/framework/components/meta/ComplexityRouter.md +116 -0
  53. package/framework/components/meta/SilentDiscovery.md +79 -0
  54. package/framework/components/meta/StateUpdate.md +56 -0
  55. package/framework/components/meta/StrictnessProtocol.md +60 -0
  56. package/framework/components/meta/TeamRouter.md +86 -0
  57. package/framework/components/planning/TaskBreakdown.md +95 -0
  58. package/framework/components/planning/WaveComputation.md +59 -0
  59. package/framework/components/quality/PRReview.md +225 -0
  60. package/framework/config/jdi-config.yaml +159 -0
  61. package/framework/config/state.yaml +72 -0
  62. package/framework/config/variables.yaml +43 -0
  63. package/framework/hooks/checkpoint.md +196 -0
  64. package/framework/hooks/jdi-worktree-cleanup.md +123 -0
  65. package/framework/hooks/lint-fix-frontend.md +59 -0
  66. package/framework/hooks/on-pause.md +213 -0
  67. package/framework/hooks/pre-commit.md +143 -0
  68. package/framework/jdi.md +336 -0
  69. package/framework/learnings/backend.md +3 -0
  70. package/framework/learnings/devops.md +3 -0
  71. package/framework/learnings/frontend.md +3 -0
  72. package/framework/learnings/general.md +3 -0
  73. package/framework/learnings/testing.md +3 -0
  74. package/framework/rules/commit-rules.md +24 -0
  75. package/framework/rules/deviation-rules.md +221 -0
  76. package/framework/teams/devops.md +26 -0
  77. package/framework/teams/engineering.md +29 -0
  78. package/framework/teams/micro-management.md +26 -0
  79. package/framework/teams/product-research.md +29 -0
  80. package/framework/teams/quality-assurance.md +27 -0
  81. package/framework/templates/CLAUDE-SHARED.md +60 -0
  82. package/framework/templates/PLAN-TASK.md +35 -0
  83. package/framework/templates/PLAN.md +158 -0
  84. package/framework/templates/PROJECT.yaml +16 -0
  85. package/framework/templates/REQUIREMENTS.yaml +27 -0
  86. package/framework/templates/ROADMAP.yaml +24 -0
  87. package/framework/templates/SUMMARY.md +201 -0
  88. package/framework/workflows/README.md +87 -0
  89. package/package.json +40 -0
@@ -0,0 +1,36 @@
1
+ # CodebaseContext Component
2
+
3
+ Cache-first codebase context loading. Reads existing analysis — never spawns mapper automatically.
4
+
5
+ ---
6
+
7
+ ## Cache-First Loading
8
+
9
+ 1. If `.jdi/codebase/SUMMARY.md` exists → **read it directly** (regardless of age)
10
+ 2. If `.jdi/codebase/CONVENTIONS.md` exists → read it when writing code
11
+ 3. If neither exists → **inform user** to run `/jdi:map-codebase` first, then proceed without codebase context
12
+
13
+ **Never spawn codebase mapper automatically.** The mapper is expensive (~30% of session budget). Only run it via explicit `/jdi:map-codebase` command.
14
+
15
+ **Skip entirely if:** `--skip-codebase` flag is present in command arguments.
16
+
17
+ ---
18
+
19
+ ## Context Files
20
+
21
+ | File | Purpose | When to Read |
22
+ |------|---------|--------------|
23
+ | `.jdi/codebase/SUMMARY.md` | Architecture overview, file locations, tech stack | Always (if exists) |
24
+ | `.jdi/codebase/CONVENTIONS.md` | Coding standards (mapper output only) | When writing code (if exists) |
25
+ | `.claude/rules/*.md` | Auto-loaded patterns (no explicit read needed) | Automatic |
26
+ | `.jdi/config/state.yaml` | Current phase, plan, position | Always |
27
+
28
+ ---
29
+
30
+ ## Usage in Commands
31
+
32
+ ```
33
+ <JDI:CodebaseContext />
34
+ ```
35
+
36
+ This component reads cached context files. If no codebase analysis exists, it proceeds without it — agents can still analyse relevant source files directly.
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: Commit
3
+ category: execution
4
+ description: Create atomic commits with proper formatting and state tracking
5
+ params:
6
+ - name: scope
7
+ type: string
8
+ required: false
9
+ default: "task"
10
+ options: ["task", "plan", "phase", "docs", "fix"]
11
+ description: What level of work is being committed
12
+ - name: type
13
+ type: string
14
+ required: false
15
+ default: null
16
+ options: ["feat", "fix", "refactor", "docs", "test", "chore", "perf", "style"]
17
+ description: Override commit type (auto-detected if not provided)
18
+ - name: files
19
+ type: array
20
+ required: false
21
+ default: null
22
+ description: Specific files to stage (auto-detected if not provided)
23
+ ---
24
+
25
+ # Commit
26
+
27
+ Create an atomic commit with proper formatting, staging, and state tracking.
28
+
29
+ ---
30
+
31
+ ## Default Behaviour
32
+
33
+ When invoked as `<JDI:Commit />`:
34
+
35
+ 1. **Check for changes** — `git status --porcelain`. If none, skip.
36
+
37
+ 2. **Identify modified files** — Parse git status, group by change type.
38
+
39
+ 3. **Determine commit type** — `feat` (new), `fix` (bug), `refactor` (cleanup), `docs` (documentation), `test` (tests). Override with `type` param.
40
+
41
+ 4. **Stage files individually**
42
+ ```bash
43
+ git add path/to/file1
44
+ git add path/to/file2
45
+ ```
46
+ **NEVER** use `git add .` or `git add -A`
47
+
48
+ **EXCLUDED DIRECTORIES** (never stage):
49
+ - `.worktrees/**` — Git worktrees
50
+ - `.jdi/**` — JDI runtime state
51
+
52
+ ```bash
53
+ if [[ "$file" == .worktrees/* ]] || [[ "$file" == .jdi/* ]]; then
54
+ echo "SKIP (excluded): $file"
55
+ continue
56
+ fi
57
+ ```
58
+
59
+ 5. **Create commit message** — Use <JDI:Commit:MessageFormat />
60
+
61
+ 6. **Execute commit**
62
+ ```bash
63
+ git commit -m "$(cat <<'EOF'
64
+ {message}
65
+ EOF
66
+ )"
67
+ ```
68
+
69
+ 7. **Record commit hash** — `git rev-parse --short HEAD`
70
+
71
+ 8. **Update state** — Add commit to `state.yaml` session_commits array.
72
+
73
+ ---
74
+
75
+ <section name="MessageFormat">
76
+
77
+ ## Message Format
78
+
79
+ ```
80
+ {type}({scope}): {description}
81
+
82
+ - {change 1}
83
+ - {change 2}
84
+ - {change 3}
85
+ ```
86
+
87
+ ### Type Selection
88
+
89
+ | Type | When to Use |
90
+ |------|-------------|
91
+ | `feat` | New feature, endpoint, component |
92
+ | `fix` | Bug fix, error correction |
93
+ | `test` | Test-only changes |
94
+ | `refactor` | Code cleanup, no behaviour change |
95
+ | `perf` | Performance improvement |
96
+ | `docs` | Documentation changes |
97
+ | `style` | Formatting, linting fixes |
98
+ | `chore` | Config, tooling, dependencies |
99
+
100
+ ### Rules
101
+ - **Scope**: In a plan: `{phase}-{plan}` (e.g., `01-02`). Standalone: feature name or file area.
102
+ - **Description**: Imperative mood, no capital start, no period, max 72 chars.
103
+ - **Body**: 3-5 bullet points of WHAT changed.
104
+
105
+ </section>
106
+
107
+ ---
108
+
109
+ ## Scope Reference
110
+
111
+ | Scope | Message Format |
112
+ |-------|----------------|
113
+ | `task` | `{type}({phase}-{plan}): task {N} - {desc}` |
114
+ | `plan` | `docs({phase}-{plan}): complete {plan-name}` |
115
+ | `phase` | `docs({phase}): complete {phase-name}` |
116
+ | `docs` | `docs: {description}` |
117
+ | `fix` | `fix: {description}` |
118
+
119
+ ## State Updates
120
+
121
+ After commit: append to `commits.session_commits` in state.yaml, update `last_commit_hash`. Append to `implementation.files_modified` in variables.yaml.
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: Verify
3
+ category: execution
4
+ description: Verify completion of tasks, plans, phases, or requirements
5
+ params:
6
+ - name: scope
7
+ type: string
8
+ required: false
9
+ options: ["task", "plan", "phase", "requirements"]
10
+ default: "task"
11
+ description: What level to verify
12
+ - name: strict
13
+ type: boolean
14
+ required: false
15
+ default: false
16
+ description: Fail on any unmet criteria (vs warn)
17
+ - name: include_tests
18
+ type: boolean
19
+ required: false
20
+ default: true
21
+ description: Run tests as part of verification
22
+ ---
23
+
24
+ # Verify
25
+
26
+ Verify completion of work at various levels of granularity.
27
+
28
+ ---
29
+
30
+ ## Default Behaviour
31
+
32
+ When invoked as `<JDI:Verify />`:
33
+
34
+ 1. **Determine scope** — Check current position from state.yaml, default to task-level
35
+ 2. **Load verification criteria** — task: PLAN.md verification section; plan: PLAN.md success_criteria; phase: ROADMAP.yaml must_haves
36
+ 3. **Execute verification** — Run each check, record pass/fail
37
+ 4. **Report results** — Output summary, update state
38
+
39
+ ---
40
+
41
+ <section name="Task">
42
+
43
+ ## Task Verification (`scope="task"`)
44
+
45
+ 1. **Load task verification criteria** from PLAN.md `**Verification:**` checklist
46
+ 2. **Execute each check**: file existence, code patterns, test gates (see TestRunner), manual inspection
47
+ 3. **Load done criteria** from `**Done when:**`
48
+ 4. **Report result**:
49
+ ```markdown
50
+ ## Task Verification: Task {N}
51
+ **Status:** PASS | FAIL
52
+
53
+ ### Verification Checks
54
+ - [x] {check 1} - PASS
55
+ - [ ] {check 2} - FAIL: {reason}
56
+
57
+ ### Done Criteria
58
+ - [x] {criterion} - Met
59
+
60
+ ### Issues
61
+ - {issue description if any}
62
+ ```
63
+
64
+ </section>
65
+
66
+ ---
67
+
68
+ <section name="Plan">
69
+
70
+ ## Plan Verification (`scope="plan"`)
71
+
72
+ 1. **Verify all tasks complete** — check status and commits
73
+ 2. **Load plan success criteria** from `<success_criteria>` block
74
+ 3. **Execute plan-level checks** — test suite, lint/type errors, integration points
75
+ 4. **Generate SUMMARY.md preview** — draft with deviations
76
+ 5. **Report result**:
77
+ ```markdown
78
+ ## Plan Verification: {phase}-{plan}
79
+ **Status:** PASS | FAIL
80
+
81
+ ### Task Completion
82
+ - [x] Task 1: {name} - {commit}
83
+
84
+ ### Success Criteria
85
+ - [x] {criterion 1} - Met
86
+ - [ ] {criterion 2} - NOT MET: {reason}
87
+
88
+ ### Tests
89
+ - Suite: {test suite} | Result: {pass/fail} | Coverage: {percentage}
90
+
91
+ ### Ready for SUMMARY.md: YES | NO
92
+ ```
93
+
94
+ </section>
95
+
96
+ ---
97
+
98
+ ## Advanced Verification (Phase & Requirements)
99
+
100
+ For `scope="phase"` or `scope="requirements"`, load `<JDI:VerifyAdvanced />`.
101
+
102
+ ---
103
+
104
+ <section name="TestRunner">
105
+
106
+ ## Test Execution (`include_tests="true"`)
107
+
108
+ 1. **Detect changed files**
109
+ ```bash
110
+ # Task-level
111
+ git diff --cached --name-only
112
+ git diff --name-only
113
+ # Plan-level
114
+ git diff master --name-only
115
+ ```
116
+
117
+ 2. **Backend test gate (MANDATORY if ANY `*.php` files changed)**
118
+ ```bash
119
+ composer test
120
+ ```
121
+ If fails: verification FAILS. Do not proceed. Fix tests first.
122
+
123
+ 3. **Frontend tests (if `*.ts`, `*.tsx`, `*.js`, `*.jsx` changed)**
124
+ ```bash
125
+ bun run test:vitest
126
+ ```
127
+
128
+ 4. **Parse results** — total, passed, failed, skipped, coverage
129
+
130
+ 5. **Report**: For each stack (Backend/Frontend), include: ran (yes/no), command, result, counts, and any failed test details.
131
+
132
+ </section>
133
+
134
+ ---
135
+
136
+ ## State Updates
137
+
138
+ After verification, set `position.status` to `verified` or `verification_failed`. If gaps found, add to `blockers` array with `type: verification_gap`.
139
+
140
+ Gap severity: Critical (goal blocked → closure plan), High (requirement unmet → targeted fix), Medium (partially met → note), Low (enhancement → document).
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: VerifyAdvanced
3
+ category: execution
4
+ description: Advanced verification for phase and requirements scope
5
+ ---
6
+
7
+ # VerifyAdvanced
8
+
9
+ Lazy-loaded verification for `scope="phase"` and `scope="requirements"`. See `<JDI:Verify />` for task and plan verification.
10
+
11
+ ---
12
+
13
+ <section name="Phase">
14
+
15
+ ## Phase Verification
16
+
17
+ When `scope="phase"`:
18
+
19
+ 1. **Verify all plans complete** — Check SUMMARY.md exists for each plan, verify success criteria met
20
+ 2. **Load phase must_haves from ROADMAP.yaml**
21
+ 3. **Verify against codebase (not claims)** — Actually check the codebase, run the functionality
22
+ 4. **Create VERIFICATION.md** with must-haves status table, plans completed, gaps found, human verification needed
23
+ 5. **Route by status:**
24
+ - `PASSED` → Continue to next phase
25
+ - `GAPS_FOUND` → Create gap closure plans
26
+ - `HUMAN_NEEDED` → Present checklist to user
27
+
28
+ </section>
29
+
30
+ ---
31
+
32
+ <section name="Requirements">
33
+
34
+ ## Requirements Verification
35
+
36
+ When `scope="requirements"`:
37
+
38
+ 1. **Load REQUIREMENTS.yaml** — Get all v1 requirements with REQ-IDs
39
+ 2. **For each requirement** — Find which phase/plan claimed to implement it, verify implementation exists, check acceptance criteria
40
+ 3. **Cross-reference evidence** — Link to test files, code implementing the requirement, note partial implementations
41
+ 4. **Generate report** with total/verified/failed/not-implemented counts, verification results table, failed requirements details, recommendations
42
+
43
+ </section>
@@ -0,0 +1,121 @@
1
+ # AgentBase Component
2
+
3
+ Standards inherited by all JDI agents via `<JDI:AgentBase />`. Default loads Core only.
4
+
5
+ ## Standards
6
+
7
+ - Use **Australian English** spelling in all outputs.
8
+ - Follow `CLAUDE.md` and `.claude/rules/` conventions.
9
+ - Read `.jdi/config/state.yaml` once at task start for context. Do NOT update state.yaml for status transitions — the framework handles this. Only use state.yaml to record decisions, deviations, or blockers via `<JDI:StateUpdate />`.
10
+ - Use the Read tool before editing any file.
11
+ - Batch file reads: issue all Read calls in a single turn rather than sequentially.
12
+ - Batch git operations: combine related commands into a single Bash call where possible.
13
+
14
+ ## Budget Discipline
15
+
16
+ You have a finite per-invocation budget (tokens, tool calls, wall time). Long runs can be terminated mid-task before you produce your final report. To survive:
17
+
18
+ 1. **Batch reads in parallel** — one turn with all Read calls, not sequential.
19
+ 2. **Cap exploration** — read only the files your spawn prompt names. If more are needed, report what you need and stop rather than wandering.
20
+ 3. **Write fixes before verifying** — Edit calls persist even if you are later truncated. Save the report for last.
21
+ 4. **Short reports (<400 words)** — terse file list + one sentence per change. Long formal reports are where truncation bites.
22
+ 5. **One concern per invocation** — address what was asked, do not expand scope.
23
+ 6. **Don't re-read files you just edited** — the harness tracks state.
24
+
25
+ If your work exceeds one invocation, complete what you can, return a progress report naming exactly what remains, and let the orchestrator re-spawn you.
26
+
27
+ ## Component Resolution
28
+
29
+ When a spec contains `<JDI:*>` tags:
30
+ 1. Read the file from `.jdi/framework/components/` (execution/, planning/, quality/, meta/).
31
+ 2. If a section is specified (`<JDI:X:Section />`), execute only that section.
32
+ 3. Apply tag parameters as constraints. Return to agent spec and continue.
33
+
34
+ If your spec has a `requires_components` frontmatter field, read ALL listed components before starting execution.
35
+
36
+ Do NOT skip `<JDI:*>` tags — they contain essential instructions.
37
+
38
+ ## Activation Protocol
39
+
40
+ On activation, announce and begin immediately:
41
+ ```
42
+ You are now active as {agent-name}. {Action verb} as requested.
43
+ ```
44
+
45
+ ## Structured Returns
46
+
47
+ Return a YAML block with `status`, agent-specific fields, and `next_action` after all work is complete.
48
+
49
+ ## Boundaries
50
+
51
+ - **Will Do**: Actions within agent responsibility. Prioritise these.
52
+ - **Will Not**: Actions outside scope. Delegate or escalate, never attempt.
53
+
54
+ ---
55
+
56
+ <section name="Sandbox">
57
+
58
+ ## Sandbox Awareness
59
+
60
+ You run in a sandboxed environment. Key constraints:
61
+
62
+ | Operation | Tool / Method | Persists? | Notes |
63
+ |-----------|--------------|-----------|-------|
64
+ | Edit existing files | Edit tool | **Yes** | Primary way to modify code |
65
+ | Delete files | Bash `rm` | **Yes** | Destructive — use with care |
66
+ | Create new files | Write tool / Bash `cat >` | **No** | Silently fails — report in `files_to_create` |
67
+ | Git commits | Bash `git commit` | **No** | Silently fails — report in `commits_pending` |
68
+ | Read files | Read tool | **Yes** | Works reliably |
69
+ | Run commands | Bash tool | **Yes** | Output is real; side-effects vary |
70
+
71
+ **Key Rules:**
72
+ 1. **NEVER attempt `git commit`** — it will appear to succeed but produces no real commit.
73
+ 2. **NEVER create new files** via Write tool or Bash redirection — they will not persist.
74
+ 3. **ALWAYS use the Edit tool** to modify existing files.
75
+ 4. **Report pending work** in structured returns using `files_to_create` and `commits_pending`.
76
+
77
+ ### Structured Returns for Sandbox-Limited Operations
78
+
79
+ ```yaml
80
+ files_to_create:
81
+ - path: "path/to/new/file.md"
82
+ content: |
83
+ Full file content here...
84
+ files_modified:
85
+ - path/to/edited/file1.ts
86
+ commits_pending:
87
+ - message: |
88
+ feat(01-01-T1): implement feature X
89
+ files:
90
+ - path/to/modified/file1.ts
91
+ ```
92
+
93
+ ### Orchestrator Post-Agent Handling
94
+
95
+ After a sandboxed agent completes, the orchestrator must:
96
+ 1. Create files from `files_to_create` using Write tool
97
+ 2. Execute commits from `commits_pending` via `git add` + `git commit`
98
+ 3. Record real commit hashes in `.jdi/config/state.yaml`
99
+
100
+ </section>
101
+
102
+ ---
103
+
104
+ <section name="TeamMode">
105
+
106
+ ## Communication (Team Mode)
107
+
108
+ When operating within an Agent Team (spawned by coordinator):
109
+
110
+ 1. **Claim tasks**: Call TaskList, find tasks assigned to you
111
+ 2. **Execute**: Read task description, implement using Edit tool
112
+ 3. **Report**: SendMessage to coordinator with structured return (include `files_modified`, `files_to_create`, `commits_pending`)
113
+ 4. **Complete**: TaskUpdate(status: "completed") AFTER sending results
114
+ 5. **Next**: Check TaskList for more assigned tasks. If none, go idle.
115
+
116
+ **Team Mode Rules:**
117
+ - NEVER write to state.yaml (coordinator handles this)
118
+ - ALWAYS SendMessage results to coordinator before TaskUpdate(completed)
119
+ - Use **SendMessage** to communicate — plain text is not visible to teammates.
120
+
121
+ </section>