jdi-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/AGENTS.md +209 -0
  2. package/ARCHITECTURE.md +210 -0
  3. package/COMMANDS.md +241 -0
  4. package/CREATE-EXAMPLE.md +385 -0
  5. package/CREATE.md +315 -0
  6. package/EXTENSION.md +141 -0
  7. package/LICENSE +21 -0
  8. package/MEMORY.md +471 -0
  9. package/PORTABILITY.md +438 -0
  10. package/README.md +789 -0
  11. package/bin/git-hooks/post-commit +16 -0
  12. package/bin/git-hooks/pre-commit +21 -0
  13. package/bin/jdi-build.ps1 +381 -0
  14. package/bin/jdi-build.sh +332 -0
  15. package/bin/jdi-doctor.ps1 +403 -0
  16. package/bin/jdi-doctor.sh +400 -0
  17. package/bin/jdi-install-caveman.ps1 +97 -0
  18. package/bin/jdi-install-caveman.sh +99 -0
  19. package/bin/jdi-install-playwright.ps1 +319 -0
  20. package/bin/jdi-install-playwright.sh +284 -0
  21. package/bin/jdi-install.ps1 +154 -0
  22. package/bin/jdi-install.sh +132 -0
  23. package/bin/jdi-uninstall.ps1 +309 -0
  24. package/bin/jdi-uninstall.sh +264 -0
  25. package/bin/jdi-update.ps1 +215 -0
  26. package/bin/jdi-update.sh +209 -0
  27. package/bin/jdi.js +460 -0
  28. package/bin/lib/jdi-monitor.ps1 +66 -0
  29. package/bin/lib/jdi-monitor.sh +74 -0
  30. package/bin/lib/jdi-truncate.ps1 +96 -0
  31. package/bin/lib/jdi-truncate.sh +99 -0
  32. package/bin/lib/ui.js +197 -0
  33. package/core/agents/jdi-adopter.md +465 -0
  34. package/core/agents/jdi-architect.md +894 -0
  35. package/core/agents/jdi-asker.md +153 -0
  36. package/core/agents/jdi-bootstrap.md +247 -0
  37. package/core/agents/jdi-planner.md +254 -0
  38. package/core/agents/jdi-researcher.md +303 -0
  39. package/core/commands/jdi-adopt.md +155 -0
  40. package/core/commands/jdi-bootstrap.md +81 -0
  41. package/core/commands/jdi-create.md +80 -0
  42. package/core/commands/jdi-discuss.md +80 -0
  43. package/core/commands/jdi-do.md +200 -0
  44. package/core/commands/jdi-loop.md +315 -0
  45. package/core/commands/jdi-new.md +131 -0
  46. package/core/commands/jdi-plan.md +73 -0
  47. package/core/commands/jdi-ship.md +146 -0
  48. package/core/commands/jdi-verify.md +159 -0
  49. package/core/skills/clean-code/SKILL.md +261 -0
  50. package/core/skills/dry/SKILL.md +150 -0
  51. package/core/skills/frontend-rules/SKILL.md +386 -0
  52. package/core/skills/frontend-validator/SKILL.md +567 -0
  53. package/core/skills/kiss/SKILL.md +178 -0
  54. package/core/skills/solid/SKILL.md +281 -0
  55. package/core/skills/yagni/SKILL.md +207 -0
  56. package/core/templates/agent.md +72 -0
  57. package/core/templates/doer-specialist.md +216 -0
  58. package/core/templates/reviewer-specialist.md +405 -0
  59. package/core/templates/skill.md +66 -0
  60. package/package.json +70 -0
  61. package/runtimes/antigravity/agents.md +74 -0
  62. package/runtimes/antigravity/skills/clean-code/SKILL.md +252 -0
  63. package/runtimes/antigravity/skills/dry/SKILL.md +141 -0
  64. package/runtimes/antigravity/skills/frontend-rules/SKILL.md +376 -0
  65. package/runtimes/antigravity/skills/frontend-validator/SKILL.md +559 -0
  66. package/runtimes/antigravity/skills/jdi-adopt/SKILL.md +155 -0
  67. package/runtimes/antigravity/skills/jdi-adopter/SKILL.md +436 -0
  68. package/runtimes/antigravity/skills/jdi-architect/SKILL.md +872 -0
  69. package/runtimes/antigravity/skills/jdi-asker/SKILL.md +125 -0
  70. package/runtimes/antigravity/skills/jdi-asker/references/context-template.md +34 -0
  71. package/runtimes/antigravity/skills/jdi-asker/references/decision-format.md +19 -0
  72. package/runtimes/antigravity/skills/jdi-asker/scripts/find_phase_dir.sh +25 -0
  73. package/runtimes/antigravity/skills/jdi-bootstrap/SKILL.md +81 -0
  74. package/runtimes/antigravity/skills/jdi-create/SKILL.md +80 -0
  75. package/runtimes/antigravity/skills/jdi-discuss/SKILL.md +80 -0
  76. package/runtimes/antigravity/skills/jdi-discuss/scripts/run_command.sh +62 -0
  77. package/runtimes/antigravity/skills/jdi-do/SKILL.md +200 -0
  78. package/runtimes/antigravity/skills/jdi-loop/SKILL.md +315 -0
  79. package/runtimes/antigravity/skills/jdi-new/SKILL.md +131 -0
  80. package/runtimes/antigravity/skills/jdi-plan/SKILL.md +73 -0
  81. package/runtimes/antigravity/skills/jdi-planner/SKILL.md +225 -0
  82. package/runtimes/antigravity/skills/jdi-researcher/SKILL.md +274 -0
  83. package/runtimes/antigravity/skills/jdi-ship/SKILL.md +146 -0
  84. package/runtimes/antigravity/skills/jdi-verify/SKILL.md +159 -0
  85. package/runtimes/antigravity/skills/kiss/SKILL.md +169 -0
  86. package/runtimes/antigravity/skills/solid/SKILL.md +272 -0
  87. package/runtimes/antigravity/skills/yagni/SKILL.md +198 -0
  88. package/runtimes/claude/CLAUDE.md +91 -0
  89. package/runtimes/claude/agents/jdi-adopter.md +430 -0
  90. package/runtimes/claude/agents/jdi-architect.md +864 -0
  91. package/runtimes/claude/agents/jdi-asker.md +119 -0
  92. package/runtimes/claude/agents/jdi-bootstrap.md +213 -0
  93. package/runtimes/claude/agents/jdi-planner.md +221 -0
  94. package/runtimes/claude/agents/jdi-researcher.md +269 -0
  95. package/runtimes/claude/commands/jdi-adopt.md +155 -0
  96. package/runtimes/claude/commands/jdi-bootstrap.md +81 -0
  97. package/runtimes/claude/commands/jdi-create.md +80 -0
  98. package/runtimes/claude/commands/jdi-discuss.md +80 -0
  99. package/runtimes/claude/commands/jdi-do.md +200 -0
  100. package/runtimes/claude/commands/jdi-loop.md +315 -0
  101. package/runtimes/claude/commands/jdi-new.md +131 -0
  102. package/runtimes/claude/commands/jdi-plan.md +73 -0
  103. package/runtimes/claude/commands/jdi-ship.md +146 -0
  104. package/runtimes/claude/commands/jdi-verify.md +159 -0
  105. package/runtimes/claude/settings.example.json +132 -0
  106. package/runtimes/claude/skills/clean-code/SKILL.md +247 -0
  107. package/runtimes/claude/skills/dry/SKILL.md +136 -0
  108. package/runtimes/claude/skills/frontend-rules/SKILL.md +369 -0
  109. package/runtimes/claude/skills/frontend-validator/SKILL.md +553 -0
  110. package/runtimes/claude/skills/kiss/SKILL.md +164 -0
  111. package/runtimes/claude/skills/solid/SKILL.md +267 -0
  112. package/runtimes/claude/skills/yagni/SKILL.md +193 -0
  113. package/runtimes/copilot/agents/jdi-adopter.agent.md +430 -0
  114. package/runtimes/copilot/agents/jdi-architect.agent.md +864 -0
  115. package/runtimes/copilot/agents/jdi-asker.agent.md +119 -0
  116. package/runtimes/copilot/agents/jdi-bootstrap.agent.md +213 -0
  117. package/runtimes/copilot/agents/jdi-planner.agent.md +221 -0
  118. package/runtimes/copilot/agents/jdi-researcher.agent.md +269 -0
  119. package/runtimes/copilot/copilot-instructions.md +80 -0
  120. package/runtimes/copilot/prompts/jdi-adopt.prompt.md +155 -0
  121. package/runtimes/copilot/prompts/jdi-bootstrap.prompt.md +81 -0
  122. package/runtimes/copilot/prompts/jdi-create.prompt.md +80 -0
  123. package/runtimes/copilot/prompts/jdi-discuss.prompt.md +80 -0
  124. package/runtimes/copilot/prompts/jdi-do.prompt.md +200 -0
  125. package/runtimes/copilot/prompts/jdi-loop.prompt.md +315 -0
  126. package/runtimes/copilot/prompts/jdi-new.prompt.md +131 -0
  127. package/runtimes/copilot/prompts/jdi-plan.prompt.md +73 -0
  128. package/runtimes/copilot/prompts/jdi-ship.prompt.md +146 -0
  129. package/runtimes/copilot/prompts/jdi-verify.prompt.md +159 -0
  130. package/runtimes/opencode/AGENTS.md +87 -0
  131. package/runtimes/opencode/agents/jdi-adopter.md +434 -0
  132. package/runtimes/opencode/agents/jdi-architect.md +861 -0
  133. package/runtimes/opencode/agents/jdi-asker.md +123 -0
  134. package/runtimes/opencode/agents/jdi-bootstrap.md +217 -0
  135. package/runtimes/opencode/agents/jdi-planner.md +225 -0
  136. package/runtimes/opencode/agents/jdi-researcher.md +273 -0
  137. package/runtimes/opencode/commands/jdi-adopt.md +155 -0
  138. package/runtimes/opencode/commands/jdi-bootstrap.md +81 -0
  139. package/runtimes/opencode/commands/jdi-create.md +80 -0
  140. package/runtimes/opencode/commands/jdi-discuss.md +80 -0
  141. package/runtimes/opencode/commands/jdi-do.md +200 -0
  142. package/runtimes/opencode/commands/jdi-loop.md +315 -0
  143. package/runtimes/opencode/commands/jdi-new.md +131 -0
  144. package/runtimes/opencode/commands/jdi-plan.md +73 -0
  145. package/runtimes/opencode/commands/jdi-ship.md +146 -0
  146. package/runtimes/opencode/commands/jdi-verify.md +159 -0
  147. package/runtimes/opencode/opencode.example.jsonc +169 -0
  148. package/runtimes/opencode/skills/clean-code/SKILL.md +247 -0
  149. package/runtimes/opencode/skills/dry/SKILL.md +136 -0
  150. package/runtimes/opencode/skills/frontend-rules/SKILL.md +369 -0
  151. package/runtimes/opencode/skills/frontend-validator/SKILL.md +553 -0
  152. package/runtimes/opencode/skills/kiss/SKILL.md +164 -0
  153. package/runtimes/opencode/skills/solid/SKILL.md +267 -0
  154. package/runtimes/opencode/skills/yagni/SKILL.md +193 -0
  155. package/templates-jdi-folder/config.json +18 -0
  156. package/templates-jdi-folder/registry.md +31 -0
  157. package/templates-jdi-folder/reviewers.md +33 -0
  158. package/templates-jdi-folder/skills-registry.md +32 -0
  159. package/templates-jdi-folder/specialists.md +39 -0
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: jdi-new
3
+ description: Entry point for new project. Runs research + asker, generates PROJECT.md + ROADMAP.md.
4
+ argument_hint: "<short project description>"
5
+ runtime_intent:
6
+ invokes_agent: jdi-researcher
7
+ runtime_overrides:
8
+ claude:
9
+ allowed-tools: [Read, Write, Bash, Grep, Glob, AskUserQuestion, WebSearch, WebFetch, Agent]
10
+ copilot:
11
+ tools: [read, write, grep, glob, terminal]
12
+ opencode:
13
+ agent: jdi-researcher
14
+ subtask: true
15
+ model: anthropic/claude-sonnet-4-20250514
16
+ antigravity:
17
+ triggers:
18
+ - "/jdi-new"
19
+ - "create project"
20
+ - "new app"
21
+ ---
22
+
23
+ <objective>
24
+ Initializes new JDI project. Runs research + key questions + generates PROJECT.md, ROADMAP.md, STATE.md, DECISIONS.md.
25
+ </objective>
26
+
27
+ <arguments>
28
+ - `description` (optional but recommended): short text of what to build.
29
+
30
+ Examples:
31
+ - `/jdi-new "TODO app .NET 10 + React 19"`
32
+ - `/jdi-new "Inventory REST API in Python + FastAPI"`
33
+ - `/jdi-new "Go CLI tool for log parsing"`
34
+ - `/jdi-new` (asker starts from scratch)
35
+ </arguments>
36
+
37
+ <process>
38
+
39
+ ### Step 1: Validation
40
+ ```bash
41
+ test -d .jdi/ && {
42
+ echo ".jdi/ already exists. Use /jdi-new --reset to start over (CAUTION: wipes state)."
43
+ exit 1
44
+ }
45
+
46
+ # Suggest /jdi-adopt if directory is NOT empty (likely brownfield)
47
+ file_count=$(find . -maxdepth 3 -type f \
48
+ -not -path './.git/*' -not -path './node_modules/*' \
49
+ -not -path './.venv/*' -not -path './venv/*' \
50
+ -not -path './target/*' -not -path './dist/*' -not -path './build/*' \
51
+ -not -path './bin/*' -not -path './obj/*' \
52
+ 2>/dev/null | wc -l)
53
+
54
+ if [ "$file_count" -ge 3 ]; then
55
+ # Ask before continuing — could be greenfield in monorepo
56
+ echo "Directory has $file_count code files. Looks like existing project."
57
+ echo "For brownfield projects, /jdi-adopt detects stack/code-design automatically."
58
+ echo "Continue with /jdi-new anyway? (recommended: /jdi-adopt)"
59
+ # AskUserQuestion: [Continue /jdi-new] / [Switch to /jdi-adopt] / [Cancel]
60
+ fi
61
+ ```
62
+
63
+ PowerShell:
64
+ ```powershell
65
+ if (Test-Path .jdi) { Write-Error ".jdi/ already exists. Use /jdi-new --reset."; exit 1 }
66
+ $files = Get-ChildItem -Recurse -File -Depth 3 -ErrorAction SilentlyContinue |
67
+ Where-Object { $_.FullName -notmatch '\\(\.git|node_modules|\.venv|venv|target|dist|build|bin|obj)\\' }
68
+ if ($files.Count -ge 3) {
69
+ Write-Host "Directory has $($files.Count) files. Consider /jdi-adopt instead of /jdi-new."
70
+ # Sequential AskUserQuestion
71
+ }
72
+ ```
73
+
74
+ If `--reset` passed, AskUserQuestion confirms + wipes `.jdi/`.
75
+
76
+ ### Step 2: Spawn researcher
77
+ Invoke `jdi-researcher` passing description. Wait.
78
+
79
+ ### Step 3: Verify outputs
80
+ ```bash
81
+ test -f .jdi/PROJECT.md || { echo "PROJECT.md not created"; exit 1; }
82
+ test -f .jdi/ROADMAP.md || { echo "ROADMAP.md not created"; exit 1; }
83
+ test -f .jdi/STATE.md || { echo "STATE.md not created"; exit 1; }
84
+ ```
85
+
86
+ ### Step 4: Create config.json (token/context budget)
87
+
88
+ If `.jdi/config.json` does not yet exist, write the default below. Defaults (200k context, 60/70% warn/critical, coverage 80%) cover 95% of cases. User edits if running a 1M-window model or wanting tighter thresholds.
89
+
90
+ ```json
91
+ {
92
+ "$schema_version": "1.1",
93
+ "context_window": 200000,
94
+ "thresholds": {
95
+ "warn_pct": 60,
96
+ "critical_pct": 70
97
+ },
98
+ "budgets": {
99
+ "max_context_chars": 6000,
100
+ "max_plan_chars": 12000,
101
+ "max_summary_chars": 8192
102
+ },
103
+ "compaction": {
104
+ "keep_phases": 2,
105
+ "archive_after": 5
106
+ },
107
+ "coverage_min": 80
108
+ }
109
+ ```
110
+
111
+ Canonical reference for the default also lives in `templates-jdi-folder/config.json` (shipped by npm package) — for users wanting to regenerate manually.
112
+
113
+ ### Step 5: Confirm
114
+
115
+ ```
116
+ {project_name} initialized. {N} phases planned in .jdi/.
117
+ Next: /jdi-bootstrap
118
+ ```
119
+
120
+ </process>
121
+
122
+ <gates>
123
+ - pre: directory without existing `.jdi/` (or `--reset`)
124
+ - post: PROJECT.md + ROADMAP.md + STATE.md + DECISIONS.md + config.json created, initial commit made
125
+ </gates>
126
+
127
+ <errors>
128
+ - `.jdi/` already exists -> suggest `--reset` or use current project
129
+ - Researcher cancelled -> exit clean
130
+ - Researcher failed -> show error, no commit
131
+ </errors>
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: jdi-plan
3
+ description: Generates phase PLAN.md. Decomposes into tasks with files_modified, acceptance, parallelism waves.
4
+ argument_hint: "<phase_number> [--review]"
5
+ runtime_intent:
6
+ invokes_agent: jdi-planner
7
+ runtime_overrides:
8
+ claude:
9
+ allowed-tools: [Read, Write, Bash, Grep, Glob, AskUserQuestion, Agent]
10
+ copilot:
11
+ tools: [read, write, grep, glob]
12
+ opencode:
13
+ agent: jdi-planner
14
+ subtask: true
15
+ model: anthropic/claude-sonnet-4-20250514
16
+ antigravity:
17
+ triggers:
18
+ - "/jdi-plan"
19
+ - "plan phase {N}"
20
+ ---
21
+
22
+ <objective>
23
+ Generates PLAN.md for the given phase. Decomposes into tasks (max 8), groups into parallelism waves, maps files_modified and acceptance.
24
+ </objective>
25
+
26
+ <arguments>
27
+ - `phase_number` (required): phase number, e.g. `1`, `2`
28
+ - `--review` (optional): show preview and ask for approval before saving
29
+ </arguments>
30
+
31
+ <process>
32
+
33
+ ### Step 1: Validation
34
+ ```bash
35
+ test -d .jdi/ || { echo "Not a JDI project. Run /jdi-new."; exit 1; }
36
+ test -f .jdi/PROJECT.md || { echo "PROJECT.md missing."; exit 1; }
37
+ ```
38
+
39
+ Verify phase CONTEXT.md exists:
40
+ ```bash
41
+ ls .jdi/phases/{NN}*/CONTEXT.md 2>/dev/null || { echo "CONTEXT.md missing. Run /jdi-discuss {N}"; exit 1; }
42
+
43
+ # Context budget warm-up (does not block)
44
+ JDI_LIB="$(dirname "$(command -v jdi 2>/dev/null || echo /usr/local/bin/jdi)")/../lib"
45
+ if [ -f "$JDI_LIB/jdi-monitor.sh" ]; then
46
+ bash "$JDI_LIB/jdi-monitor.sh" .jdi/PROJECT.md .jdi/DECISIONS.md .jdi/phases/{NN}*/CONTEXT.md || true
47
+ fi
48
+ # Windows: pwsh -File "$JDI_LIB/jdi-monitor.ps1" -Paths @(...)
49
+ ```
50
+
51
+ ### Step 2: Spawn planner
52
+ Invoke `jdi-planner` with phase_number. Wait.
53
+
54
+ ### Step 3: Verify
55
+ ```bash
56
+ test -f .jdi/phases/{NN}*/PLAN.md || { echo "PLAN.md not created"; exit 1; }
57
+ ```
58
+
59
+ ### Step 4: Confirm
60
+ Show plan summary + suggest `/jdi-do {N}`.
61
+
62
+ </process>
63
+
64
+ <gates>
65
+ - pre: `.jdi/PROJECT.md` + `.jdi/phases/{NN-slug}/CONTEXT.md` exist
66
+ - post: PLAN.md created + STATE.md updated + commit
67
+ </gates>
68
+
69
+ <errors>
70
+ - CONTEXT.md missing -> suggest `/jdi-discuss {N}`
71
+ - Phase does not exist in ROADMAP -> error
72
+ - Planner cancelled -> exit clean
73
+ </errors>
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: jdi-ship
3
+ description: Finalizes phase after verify. Updates ROADMAP.md, marks phase as done, advances pointer to next.
4
+ argument_hint: "<phase_number>"
5
+ runtime_intent:
6
+ invokes_agent: none
7
+ runtime_overrides:
8
+ claude:
9
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion]
10
+ copilot:
11
+ tools: [read, write, edit, grep, glob, terminal]
12
+ opencode:
13
+ subtask: true
14
+ antigravity:
15
+ triggers:
16
+ - "/jdi-ship"
17
+ - "finalize phase {N}"
18
+ ---
19
+
20
+ <objective>
21
+ Finalizes phase after /jdi-verify approves. Updates ROADMAP.md (phase: done), advances STATE to next phase, final commit.
22
+ </objective>
23
+
24
+ <arguments>
25
+ - `phase_number` (required)
26
+ </arguments>
27
+
28
+ <process>
29
+
30
+ ### Step 1: Validation
31
+ ```bash
32
+ test -d .jdi/ || { echo "Not a JDI project."; exit 1; }
33
+
34
+ # Verify REVIEW.md exists
35
+ ls .jdi/phases/{NN}*/REVIEW.md 2>/dev/null || {
36
+ echo "REVIEW.md missing. /jdi-verify {N}."
37
+ exit 1
38
+ }
39
+
40
+ # Read verdict
41
+ VERDICT=$(grep -oE 'Verdict:\*\* (APPROVED|APPROVED_WITH_WARNINGS|BLOCKED)' .jdi/phases/{NN}*/REVIEW.md | awk '{print $2}')
42
+
43
+ if [ "$VERDICT" = "BLOCKED" ]; then
44
+ echo "Phase {N} BLOCKED. Fix before ship."
45
+ exit 1
46
+ fi
47
+ ```
48
+
49
+ ### Step 2: Confirm with user (only if WITH_WARNINGS)
50
+
51
+ If `VERDICT=APPROVED_WITH_WARNINGS`:
52
+ ```
53
+ Phase {N} has uncorrected warnings. Ship anyway?
54
+ - Yes, ship (warnings remain in REVIEW.md)
55
+ - No, fix first
56
+ ```
57
+
58
+ If "No" -> exit clean.
59
+
60
+ ### Step 3: Update ROADMAP.md
61
+
62
+ Edit `.jdi/ROADMAP.md`:
63
+ - Phase {N}: `status: done`
64
+ - Phase {N+1}: `status: ready` (if exists)
65
+
66
+ If no phase {N+1}:
67
+ ```
68
+ All phases complete.
69
+ Project delivered.
70
+ ```
71
+
72
+ ### Step 4: Update STATE.md
73
+
74
+ ```markdown
75
+ current_phase: {N+1 or done}
76
+ phase_status: ready (if {N+1} exists) or complete
77
+ next_step: /jdi-discuss {N+1} or done
78
+ ```
79
+
80
+ ### Step 5: Archive old phases (compaction)
81
+
82
+ Read `archive_after` from `.jdi/config.json` (default 5). If current phase advances to `N+1`, and a phase exists with number `<= (N+1) - archive_after`, move to `.jdi/archive/`.
83
+
84
+ ```bash
85
+ ARCHIVE_AFTER=5
86
+ if [ -f .jdi/config.json ]; then
87
+ if command -v jq >/dev/null 2>&1; then
88
+ ARCHIVE_AFTER=$(jq -r '.compaction.archive_after // 5' .jdi/config.json)
89
+ fi
90
+ fi
91
+
92
+ NEXT=$((N + 1))
93
+ THRESHOLD=$((NEXT - ARCHIVE_AFTER))
94
+
95
+ if [ "$THRESHOLD" -ge 1 ]; then
96
+ mkdir -p .jdi/archive
97
+ test -f .jdi/archive/index.md || echo "# Archive index" > .jdi/archive/index.md
98
+
99
+ for dir in .jdi/phases/*/; do
100
+ NN=$(basename "$dir" | grep -oE '^[0-9]+' || true)
101
+ [ -z "$NN" ] && continue
102
+ NN_NUM=$((10#$NN)) # force decimal
103
+ if [ "$NN_NUM" -le "$THRESHOLD" ]; then
104
+ VERDICT_OLD=$(grep -oE 'Verdict:\*\* (APPROVED|APPROVED_WITH_WARNINGS|BLOCKED)' "$dir/REVIEW.md" 2>/dev/null | awk '{print $2}' || echo "UNKNOWN")
105
+ mv "$dir" .jdi/archive/
106
+ echo "- $(basename "$dir"): ${VERDICT_OLD} (archived $(date -u +%F))" >> .jdi/archive/index.md
107
+ fi
108
+ done
109
+ fi
110
+ # Windows: equivalent in PowerShell — Move-Item + Add-Content
111
+ ```
112
+
113
+ Archived phases remain accessible via `.jdi/archive/` but exit the default read-path. Read-depth rule (`ARCHITECTURE.md > Read-depth scaling`) treats archive as `<= current - 2`.
114
+
115
+ ### Step 6: Final commit
116
+
117
+ ```bash
118
+ git add .jdi/ROADMAP.md .jdi/STATE.md .jdi/archive/ 2>/dev/null
119
+ git commit -m "feat({NN-slug}): ship phase {N} ({VERDICT})"
120
+ ```
121
+
122
+ Optional tag (if PROJECT.md has `tag_phases: true`):
123
+ ```bash
124
+ git tag "phase-{N}-{slug}"
125
+ ```
126
+
127
+ ### Step 7: Confirm
128
+
129
+ ```
130
+ Phase {N} shipped.
131
+ {if more phases:} Next: /jdi-discuss {N+1}
132
+ {if last:} Project delivered. Tag: phase-{N}-{slug}
133
+ ```
134
+
135
+ </process>
136
+
137
+ <gates>
138
+ - pre: REVIEW.md exists + verdict != BLOCKED
139
+ - post: ROADMAP.md + STATE.md updated + old phases archived (if applicable) + commit (+ optional tag)
140
+ </gates>
141
+
142
+ <errors>
143
+ - REVIEW missing -> /jdi-verify
144
+ - Verdict BLOCKED -> abort
145
+ - Already shipped -> abort with warning
146
+ </errors>
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: jdi-verify
3
+ description: Runs phase quality gates via reviewer specialist. Build, tests, coverage, lint, security checks. Verdict APPROVED / APPROVED_WITH_WARNINGS / BLOCKED.
4
+ argument_hint: "<phase_number>"
5
+ runtime_intent:
6
+ invokes_agent: dynamic
7
+ runtime_overrides:
8
+ claude:
9
+ allowed-tools: [Read, Bash, Grep, Glob, Agent]
10
+ copilot:
11
+ tools: [read, grep, glob, terminal]
12
+ opencode:
13
+ subtask: true
14
+ model: anthropic/claude-sonnet-4-20250514
15
+ antigravity:
16
+ triggers:
17
+ - "/jdi-verify"
18
+ - "verify phase {N}"
19
+ ---
20
+
21
+ <objective>
22
+ Verifies the phase was delivered correctly. Runs gates defined in the project's reviewer specialist. Verdict blocks or releases the ship.
23
+ </objective>
24
+
25
+ <arguments>
26
+ - `phase_number` (required)
27
+ </arguments>
28
+
29
+ <process>
30
+
31
+ ### Step 1: Validation
32
+ ```bash
33
+ test -d .jdi/ || { echo "Not a JDI project."; exit 1; }
34
+
35
+ # Verify reviewer exists
36
+ ls .jdi/agents/jdi-reviewer-*.md 2>/dev/null | head -1 || {
37
+ echo "Reviewer missing. /jdi-bootstrap."
38
+ exit 1
39
+ }
40
+
41
+ # Verify phase was executed
42
+ ls .jdi/phases/{NN}*/SUMMARY.md 2>/dev/null || {
43
+ echo "Phase {N} not executed. /jdi-do {N}."
44
+ exit 1
45
+ }
46
+
47
+ # Context budget warm-up (does not block)
48
+ JDI_LIB="$(dirname "$(command -v jdi 2>/dev/null || echo /usr/local/bin/jdi)")/../lib"
49
+ if [ -f "$JDI_LIB/jdi-monitor.sh" ]; then
50
+ bash "$JDI_LIB/jdi-monitor.sh" .jdi/PROJECT.md .jdi/DECISIONS.md .jdi/phases/{NN}*/PLAN.md .jdi/phases/{NN}*/SUMMARY.md || true
51
+ fi
52
+ # Windows: pwsh -File "$JDI_LIB/jdi-monitor.ps1" -Paths @(...)
53
+ ```
54
+
55
+ ### Step 2: Resolve reviewer specialist(s)
56
+
57
+ ```bash
58
+ REVIEWERS=$(grep -oE 'jdi-reviewer-[a-z0-9-]+' .jdi/reviewers.md | sort -u)
59
+ REVIEWER_COUNT=$(echo "$REVIEWERS" | wc -l)
60
+ echo "Reviewers registered: $REVIEWER_COUNT"
61
+ ```
62
+
63
+ **Single-stack** (`REVIEWER_COUNT == 1`): one reviewer, normal flow.
64
+ **Multi-stack** (`REVIEWER_COUNT > 1`): chain reviewers in registry order. Each writes its own REVIEW segment; aggregate verdict = worst-case (1 BLOCK = overall BLOCK).
65
+
66
+ ### Step 3: Spawn reviewer(s)
67
+
68
+ **Single-stack:**
69
+ ```
70
+ Agent(
71
+ subagent_type="${REVIEWERS}",
72
+ description="Verify phase {N}",
73
+ prompt="phase={N}, mode=verify"
74
+ )
75
+ ```
76
+
77
+ **Multi-stack:** spawn each reviewer in sequence (NOT parallel — build/test commands may conflict on ports, locks, output dirs):
78
+
79
+ ```
80
+ for REVIEWER in $REVIEWERS:
81
+ Agent(
82
+ subagent_type="$REVIEWER",
83
+ description="Verify phase {N} ({REVIEWER})",
84
+ prompt="phase={N}, mode=verify, reviewer_segment=${REVIEWER}"
85
+ )
86
+ # Each reviewer appends to .jdi/phases/{NN-slug}/REVIEW.md under section
87
+ # "## Reviewer: {REVIEWER}" with its own gate results and verdict
88
+ ```
89
+
90
+ Each reviewer scopes its gates to its `file_glob` (from frontmatter `scope.file_glob`). Coverage threshold enforced only on files matching the glob.
91
+
92
+ Reviewers are read-only. Wait for completion before next.
93
+
94
+ ### Step 4: Read aggregate verdict
95
+
96
+ ```bash
97
+ test -f .jdi/phases/{NN}*/REVIEW.md || { echo "REVIEW.md not created"; exit 1; }
98
+
99
+ # Collect all per-reviewer verdicts
100
+ VERDICTS=$(grep -oE 'Verdict:\*\* (APPROVED|APPROVED_WITH_WARNINGS|BLOCKED)' .jdi/phases/{NN}*/REVIEW.md | awk '{print $2}')
101
+
102
+ # Worst-case wins: BLOCK > WARNINGS > APPROVED
103
+ if echo "$VERDICTS" | grep -q BLOCKED; then
104
+ VERDICT=BLOCKED
105
+ elif echo "$VERDICTS" | grep -q APPROVED_WITH_WARNINGS; then
106
+ VERDICT=APPROVED_WITH_WARNINGS
107
+ else
108
+ VERDICT=APPROVED
109
+ fi
110
+
111
+ # For single-stack, this collapses to the single reviewer's verdict — backward compatible.
112
+ ```
113
+
114
+ ### Step 5: Update STATE
115
+
116
+ ```markdown
117
+ current_phase: {N}
118
+ phase_status: {verified|blocked}
119
+ phase_verdict: {APPROVED|APPROVED_WITH_WARNINGS|BLOCKED}
120
+ next_step: {if APPROVED or WITH_WARNINGS: /jdi-ship {N}; if BLOCKED: fix and /jdi-do {N} again}
121
+ ```
122
+
123
+ ```bash
124
+ git add .jdi/phases/{NN-slug}/REVIEW.md .jdi/STATE.md
125
+ git commit -m "docs({NN-slug}): verify phase ({VERDICT})"
126
+ ```
127
+
128
+ ### Step 6: Confirm
129
+
130
+ **APPROVED:**
131
+ ```
132
+ Phase {N}: APPROVED. Next: /jdi-ship {N}
133
+ ```
134
+
135
+ **APPROVED_WITH_WARNINGS:**
136
+ ```
137
+ Phase {N}: APPROVED_WITH_WARNINGS ({count} warnings).
138
+ REVIEW.md: .jdi/phases/{NN-slug}/REVIEW.md
139
+ Next: /jdi-ship {N} (or fix first)
140
+ ```
141
+
142
+ **BLOCKED:**
143
+ ```
144
+ Phase {N}: BLOCKED ({count} blockers). REVIEW.md: .jdi/phases/{NN-slug}/REVIEW.md
145
+ Fix → /jdi-do {N} → /jdi-verify {N}
146
+ ```
147
+
148
+ </process>
149
+
150
+ <gates>
151
+ - pre: SUMMARY.md exists + reviewer registered in .jdi/reviewers.md
152
+ - post: REVIEW.md created + STATE updated
153
+ </gates>
154
+
155
+ <errors>
156
+ - Reviewer missing -> /jdi-bootstrap
157
+ - SUMMARY missing -> /jdi-do
158
+ - Reviewer fails -> show error, keep state, suggest retry
159
+ </errors>
@@ -0,0 +1,87 @@
1
+ # AGENTS.md — JDI workflow (OpenCode)
2
+
3
+ Este projeto usa **JDI (Just Do It)** como workflow de desenvolvimento. JDI eh um workflow enxuto: 6 comandos + 5 agents core + 2 specialists per-project.
4
+
5
+ ## Loop canonico
6
+
7
+ ```
8
+ /jdi-new "<descricao>" -> research + PROJECT.md + ROADMAP.md
9
+ /jdi-bootstrap -> cria specialists per-project
10
+ /jdi-discuss <N> -> captura decisoes locked
11
+ /jdi-plan <N> -> decompoe em tasks com waves
12
+ /jdi-do <N> -> executa via doer specialist
13
+ /jdi-verify <N> -> gates via reviewer specialist
14
+ /jdi-ship <N> -> finaliza phase
15
+ ```
16
+
17
+ `/jdi-create [desc]` cria agents/skills genericos no `core/` (so dentro do repo JDI).
18
+
19
+ ## Comandos disponiveis
20
+
21
+ Em `.opencode/commands/`. Invoque via `/` no TUI.
22
+
23
+ ## Subagents (em `.opencode/agents/`)
24
+
25
+ Invoque via `@` no chat ou via comandos:
26
+
27
+ | Agent | Modelo | Funcao |
28
+ |---|---|---|
29
+ | `@jdi-researcher` | sonnet | Research pre-roadmap |
30
+ | `@jdi-bootstrap` | sonnet | Cria per-project specialists via architect |
31
+ | `@jdi-asker` | sonnet | Loop de perguntas pra CONTEXT.md |
32
+ | `@jdi-planner` | sonnet | Gera PLAN.md com waves |
33
+ | `@jdi-architect` | sonnet | Meta-agent: cria agents/skills/specialists |
34
+
35
+ ## Specialists per-project (em `.opencode/agents/` apos bootstrap)
36
+
37
+ `/jdi-bootstrap` gera `.jdi/agents/jdi-doer-{slug}.md` + `.jdi/agents/jdi-reviewer-{slug}.md` baseado no PROJECT.md.
38
+
39
+ Pra OpenCode reconhecer, copie ou symlink `.jdi/agents/*.md` pra `.opencode/agents/` (ou rode `jdi-install.sh opencode` apos bootstrap).
40
+
41
+ ## Permissions
42
+
43
+ Frontmatter `permission:` por agent:
44
+
45
+ | Agent | edit | bash | write |
46
+ |---|---|---|---|
47
+ | jdi-researcher | deny | deny | allow |
48
+ | jdi-bootstrap | allow | allow | allow |
49
+ | jdi-asker | deny | deny | allow |
50
+ | jdi-planner | deny | deny | allow |
51
+ | jdi-architect | allow | allow | allow |
52
+ | jdi-doer-{slug} | allow | allow | allow |
53
+ | jdi-reviewer-{slug} | deny | allow | deny |
54
+
55
+ Reviewer eh read-only por design (so roda gates).
56
+
57
+ ## Memoria — files em `.jdi/`
58
+
59
+ ```
60
+ .jdi/
61
+ PROJECT.md, ROADMAP.md, DECISIONS.md, STATE.md
62
+ specialists.md, reviewers.md, registry.md
63
+ agents/ <- per-project specialists
64
+ phases/{NN-slug}/{CONTEXT,PLAN,SUMMARY,REVIEW}.md
65
+ ```
66
+
67
+ ## Skills
68
+
69
+ OpenCode tambem le `.claude/skills/`. Skills do Claude reutilizadas automaticamente em mesmo projeto.
70
+
71
+ ## Convencoes
72
+
73
+ - Conventional Commits — scope = phase slug
74
+ - Atomic commits — 1 task = 1 commit
75
+ - 80% cobertura minima
76
+ - Code design locked no `/jdi-new`
77
+
78
+ ## Idioma
79
+
80
+ - Codigo/commits/PRs: ingles
81
+ - Discussao/docs em `.jdi/`: pt-BR
82
+
83
+ ## Prioridade quando conflita
84
+
85
+ 1. Seguranca
86
+ 2. Performance
87
+ 3. Boas praticas