@orderful/droid 0.37.0 → 0.38.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 (97) hide show
  1. package/.claude-plugin/marketplace.json +1 -118
  2. package/.claude-plugin/plugin.json +49 -0
  3. package/AGENTS.md +4 -0
  4. package/CHANGELOG.md +43 -0
  5. package/README.md +53 -39
  6. package/dist/bin/droid.js +525 -212
  7. package/dist/commands/setup.d.ts.map +1 -1
  8. package/dist/commands/tui/components/PlatformBadges.d.ts.map +1 -1
  9. package/dist/commands/tui/components/SettingsDetails.d.ts.map +1 -1
  10. package/dist/commands/tui/hooks/useAppUpdate.d.ts.map +1 -1
  11. package/dist/commands/tui/views/SetupScreen.d.ts.map +1 -1
  12. package/dist/commands/update.d.ts.map +1 -1
  13. package/dist/index.js +345 -186
  14. package/dist/lib/agents.d.ts +4 -2
  15. package/dist/lib/agents.d.ts.map +1 -1
  16. package/dist/lib/migrations.d.ts.map +1 -1
  17. package/dist/lib/platform.codex.d.ts +36 -0
  18. package/dist/lib/platform.codex.d.ts.map +1 -0
  19. package/dist/lib/platforms.d.ts +30 -24
  20. package/dist/lib/platforms.d.ts.map +1 -1
  21. package/dist/lib/skills.d.ts +4 -2
  22. package/dist/lib/skills.d.ts.map +1 -1
  23. package/dist/lib/types.d.ts +2 -1
  24. package/dist/lib/types.d.ts.map +1 -1
  25. package/dist/tools/brain/.claude-plugin/plugin.json +8 -1
  26. package/dist/tools/brain/TOOL.yaml +1 -1
  27. package/dist/tools/brain/skills/brain/SKILL.md +6 -3
  28. package/dist/tools/brain/skills/brain/references/workflows.md +9 -5
  29. package/dist/tools/brain/skills/brain-obsidian/SKILL.md +2 -0
  30. package/dist/tools/coach/.claude-plugin/plugin.json +6 -0
  31. package/dist/tools/coach/skills/coach/SKILL.md +3 -0
  32. package/dist/tools/code-review/.claude-plugin/plugin.json +12 -0
  33. package/dist/tools/code-review/skills/code-review/SKILL.md +2 -0
  34. package/dist/tools/codex/.claude-plugin/plugin.json +9 -0
  35. package/dist/tools/codex/skills/codex/SKILL.md +3 -0
  36. package/dist/tools/comments/.claude-plugin/plugin.json +6 -0
  37. package/dist/tools/comments/skills/comments/SKILL.md +5 -0
  38. package/dist/tools/droid/.claude-plugin/plugin.json +8 -1
  39. package/dist/tools/droid/TOOL.yaml +4 -2
  40. package/dist/tools/droid/commands/setup.md +125 -0
  41. package/dist/tools/droid/skills/droid/SKILL.md +117 -2
  42. package/dist/tools/plan/.claude-plugin/plugin.json +6 -0
  43. package/dist/tools/plan/skills/plan/SKILL.md +2 -0
  44. package/dist/tools/project/.claude-plugin/plugin.json +6 -0
  45. package/dist/tools/project/skills/project/SKILL.md +3 -0
  46. package/dist/tools/tech-design/.claude-plugin/plugin.json +7 -1
  47. package/dist/tools/tech-design/TOOL.yaml +1 -1
  48. package/dist/tools/tech-design/commands/tech-design.md +2 -0
  49. package/dist/tools/tech-design/skills/tech-design/SKILL.md +39 -9
  50. package/dist/tools/tech-design/skills/tech-design/references/publish.md +272 -216
  51. package/dist/tools/tech-design/skills/tech-design/references/start.md +50 -20
  52. package/dist/tools/wrapup/.claude-plugin/plugin.json +6 -0
  53. package/dist/tools/wrapup/skills/wrapup/SKILL.md +2 -0
  54. package/package.json +1 -1
  55. package/scripts/build-plugins.ts +154 -6
  56. package/src/bin/droid.ts +16 -0
  57. package/src/commands/setup.ts +107 -2
  58. package/src/commands/tui/components/PlatformBadges.tsx +1 -0
  59. package/src/commands/tui/components/SettingsDetails.tsx +1 -0
  60. package/src/commands/tui/hooks/useAppUpdate.ts +21 -1
  61. package/src/commands/tui/views/SetupScreen.tsx +10 -1
  62. package/src/commands/update.ts +21 -1
  63. package/src/lib/agents.ts +13 -2
  64. package/src/lib/migrations.ts +81 -9
  65. package/src/lib/platform.codex.ts +131 -0
  66. package/src/lib/platforms.ts +127 -6
  67. package/src/lib/skills.ts +53 -6
  68. package/src/lib/types.ts +1 -0
  69. package/src/tools/brain/.claude-plugin/plugin.json +8 -1
  70. package/src/tools/brain/TOOL.yaml +1 -1
  71. package/src/tools/brain/skills/brain/SKILL.md +6 -3
  72. package/src/tools/brain/skills/brain/references/workflows.md +9 -5
  73. package/src/tools/brain/skills/brain-obsidian/SKILL.md +2 -0
  74. package/src/tools/coach/.claude-plugin/plugin.json +6 -0
  75. package/src/tools/coach/skills/coach/SKILL.md +3 -0
  76. package/src/tools/code-review/.claude-plugin/plugin.json +12 -0
  77. package/src/tools/code-review/skills/code-review/SKILL.md +2 -0
  78. package/src/tools/codex/.claude-plugin/plugin.json +9 -0
  79. package/src/tools/codex/skills/codex/SKILL.md +3 -0
  80. package/src/tools/comments/.claude-plugin/plugin.json +6 -0
  81. package/src/tools/comments/skills/comments/SKILL.md +5 -0
  82. package/src/tools/droid/.claude-plugin/plugin.json +8 -1
  83. package/src/tools/droid/TOOL.yaml +4 -2
  84. package/src/tools/droid/commands/setup.md +125 -0
  85. package/src/tools/droid/skills/droid/SKILL.md +117 -2
  86. package/src/tools/plan/.claude-plugin/plugin.json +6 -0
  87. package/src/tools/plan/skills/plan/SKILL.md +2 -0
  88. package/src/tools/project/.claude-plugin/plugin.json +6 -0
  89. package/src/tools/project/skills/project/SKILL.md +3 -0
  90. package/src/tools/tech-design/.claude-plugin/plugin.json +7 -1
  91. package/src/tools/tech-design/TOOL.yaml +1 -1
  92. package/src/tools/tech-design/commands/tech-design.md +2 -0
  93. package/src/tools/tech-design/skills/tech-design/SKILL.md +39 -9
  94. package/src/tools/tech-design/skills/tech-design/references/publish.md +272 -216
  95. package/src/tools/tech-design/skills/tech-design/references/start.md +50 -20
  96. package/src/tools/wrapup/.claude-plugin/plugin.json +6 -0
  97. package/src/tools/wrapup/skills/wrapup/SKILL.md +2 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Trigger:** `/tech-design publish` or user wants to create PR for review
4
4
 
5
- **Goal:** Generate clean roll-up from thought doc, publish thought doc + roll-up to codex. Research doc stays in brain.
5
+ **Goal:** Generate rollup and publish to codex. Draft = skip completeness checks + GitHub draft PR. Ready = run completeness checks + regular PR. Files published are always the same.
6
6
 
7
7
  **Security Note:** Project names and all user input must be validated/sanitized before use in file paths, git commands, or PR content to prevent command injection and path traversal.
8
8
 
@@ -15,16 +15,17 @@
15
15
  if [ ! -f "$thought_doc_path" ]; then
16
16
  echo "Error: No active tech design found."
17
17
  echo "Start one with: /tech-design start --from codex:{project}"
18
+ echo "Or resume with: /tech-design search {term}"
18
19
  exit 1
19
20
  fi
20
21
 
21
- # Research doc should exist (not required but helpful)
22
+ # Research doc should exist (optional but helpful)
22
23
  if [ ! -f "$research_doc_path" ]; then
23
- echo "⚠️ Warning: Research doc not found."
24
+ echo "⚠️ Warning: Research doc not found in same folder."
24
25
  echo "This is unusual - research doc is typically created during /tech-design start"
25
26
  fi
26
27
 
27
- # Codex repo must be configured (read from codex skill config)
28
+ # Codex repo must be configured
28
29
  codex_repo=$(droid config --get tools.codex | grep -o '"codex_repo": *"[^"]*"' | cut -d'"' -f4)
29
30
  if [ -z "$codex_repo" ]; then
30
31
  echo "Error: Codex not configured."
@@ -39,35 +40,17 @@ if ! git -C "$codex_repo" status &>/dev/null; then
39
40
  fi
40
41
  ```
41
42
 
42
- ### 2. Check Completeness
43
-
44
- Run gap analysis and warn if critical sections missing:
43
+ ### 2. Extract Project Name
45
44
 
46
45
  ```bash
47
- # Check critical sections
48
- missing_critical=$(check_critical_sections "$thought_doc_path")
49
-
50
- if [ -n "$missing_critical" ]; then
51
- echo "⚠️ Warning: Critical sections are missing:"
52
- echo "$missing_critical"
53
- echo ""
54
- echo "You can publish anyway, but reviewers may ask for these."
55
- echo ""
56
- echo "Continue publishing? (y/n)"
57
- # Get user confirmation
58
- fi
59
- ```
60
-
61
- ### 3. Extract Project Name
62
-
63
- ```bash
64
- # Get project name from thought doc path or metadata
65
- # e.g., {brain_dir}/1-Projects/transaction-templates/tech-design-transaction-templates.md
46
+ # Get project name from design folder
47
+ # e.g., {brain_dir}/0-Inbox/tech-designs/transaction-templates/
66
48
  # → transaction-templates
67
49
 
68
- project=$(basename "$(dirname "$thought_doc_path")")
50
+ design_folder=$(dirname "$thought_doc_path")
51
+ project=$(basename "$design_folder")
69
52
 
70
- # Verify project exists in codex
53
+ # Verify project exists in codex or offer to create
71
54
  if [ ! -d "$codex_repo/projects/$project" ]; then
72
55
  echo "⚠️ Project not found in codex: $project"
73
56
  echo ""
@@ -76,138 +59,198 @@ if [ ! -d "$codex_repo/projects/$project" ]; then
76
59
  echo " 2. Specify different project name"
77
60
  echo ""
78
61
  echo "Which project should this go to?"
79
- # Get user input
62
+ # Get user input for project name
80
63
  fi
81
64
  ```
82
65
 
83
- ### 4. Generate Roll-up
66
+ ### 3. Determine Publish Type and Check for Existing PR
84
67
 
85
- **Read thought doc and synthesize into roll-up template:**
68
+ Check if this is first publish or update:
86
69
 
87
70
  ```bash
88
- # Read template
89
- rollup_template=$(cat references/rollup-template.md)
90
-
91
- # Extract content from thought doc
92
- background=$(extract_section "$thought_doc_path" "Background")
93
- proposal=$(extract_section "$thought_doc_path" "Proposal")
94
- scope=$(extract_section "$thought_doc_path" "Scope")
95
- decisions=$(extract_section "$thought_doc_path" "Key Decisions")
96
- risks=$(extract_section "$thought_doc_path" "Risks")
97
- rollout=$(extract_section "$thought_doc_path" "Rollout")
98
- implementation=$(extract_section "$thought_doc_path" "Implementation")
99
-
100
- # Generate TL;DR (2-3 sentence summary)
101
- # Use AI to synthesize from Background + Proposal
102
- tldr=$(generate_tldr "$background" "$proposal")
103
-
104
- # Generate Problem statement
105
- # Extract from Background, focus on "what's broken/missing"
106
- problem=$(extract_problem "$background")
107
-
108
- # Generate Solution
109
- # From Proposal, assuming decisions are accepted
110
- solution=$(synthesize_solution "$proposal" "$decisions")
111
-
112
- # Populate template
113
- rollup=$(echo "$rollup_template" | \
114
- sed "s/{Feature Name}/$project/g" | \
115
- sed "s/{2-3 sentence summary}/$tldr/g" | \
116
- sed "s/{What we're solving}/$problem/g")
117
- # ... continue for all sections
118
- ```
119
-
120
- **Roll-up generation guidelines:**
121
-
122
- - **TL;DR**: Concise, jargon-free, answers "what and why"
123
- - **Problem**: Focus on current pain, not solution
124
- - **Scope**: Clear in/out boundaries
125
- - **Solution**: Assumes recommended decisions accepted, omits rejected alternatives
126
- - **Key Decisions**: Show options with pros/cons, mark recommended vs rejected
127
- - **Risks**: Table format, each risk with mitigation
128
- - **Rollout**: Phases with risk mitigation per phase
129
- - **Implementation**: High-level phases, not detailed tasks
130
-
131
- ### 5. Create Git Branch
132
-
133
- Use codex git scripts for safety:
134
-
135
- ```bash
136
- # Use codex skill's git-start-write script
137
- droid config --get tools.codex | droid exec droid-codex git-start-write \
138
- --config - \
139
- --branch "codex/tech-design-$project"
140
- ```
141
-
142
- ### 6. Write Files to Codex
143
-
144
- ```bash
145
- # Write roll-up
146
- rollup_path="$codex_repo/projects/$project/TECH-DESIGN.md"
147
- echo "$rollup" > "$rollup_path"
148
-
149
- # Write thought doc to artifacts
150
- artifacts_dir="$codex_repo/projects/$project/artifacts"
151
- mkdir -p "$artifacts_dir"
152
- cp "$thought_doc_path" "$artifacts_dir/thought-doc.md"
153
-
154
- # Update frontmatter in both files
155
- add_frontmatter "$rollup_path" "tech-design" "$project"
156
- add_frontmatter "$artifacts_dir/thought-doc.md" "tech-design-thought" "$project"
157
- ```
158
-
159
- **Frontmatter for roll-up:**
160
-
161
- ```yaml
162
- ---
163
- title: "[Tech Design] $project"
164
- type: tech-design
165
- status: draft
166
- created: $(date +%Y-%m-%d)
167
- updated: $(date +%Y-%m-%d)
168
- confidence: medium
169
- ---
170
- ```
171
-
172
- **Frontmatter for thought doc:**
71
+ # Check if project folder exists in codex
72
+ project_exists=false
73
+ if [ -d "$codex_repo/projects/$project" ]; then
74
+ project_exists=true
75
+ fi
173
76
 
174
- ```yaml
175
- ---
176
- title: "[Tech Design Thought Doc] $project"
177
- type: tech-design-thought
178
- status: draft
179
- created: $(date +%Y-%m-%d)
180
- updated: $(date +%Y-%m-%d)
181
- confidence: medium
182
- note: "Working document with full context, exploration, and @mentions"
183
- ---
77
+ # Check for existing PR
78
+ existing_pr=$(gh pr list --repo "$codex_repo" --head "tech-design/$project" --json number --jq '.[0].number')
79
+ pr_is_draft=false
80
+ if [ -n "$existing_pr" ]; then
81
+ pr_is_draft=$(gh pr view "$existing_pr" --repo "$codex_repo" --json isDraft --jq '.isDraft')
82
+ fi
184
83
  ```
185
84
 
186
- ### 7. Create PR
187
-
188
- ```bash
189
- # Commit message
190
- commit_msg="Add tech design for $project
191
-
192
- Roll-up: projects/$project/TECH-DESIGN.md
193
- Thought doc: projects/$project/artifacts/thought-doc.md"
194
-
195
- # PR title
196
- pr_title="Tech Design: $project"
197
-
198
- # PR body
199
- pr_body="## Summary
200
-
201
- Technical design for **$project**.
85
+ **First publish (no existing project/PR):**
86
+ - Ask: "Draft (WIP for early feedback) or Ready (complete design for review)?"
87
+ - Proceed to step 4
88
+
89
+ **Update existing PR:**
90
+ - Show current PR status (draft or ready)
91
+ - Ask: "Keep as [current status] or change to [other status]?"
92
+ - Proceed to step 4
93
+ - Will regenerate rollup and update all files
94
+
95
+ ### 4. Unified Publish Workflow
96
+
97
+ **This workflow is the same for both draft and ready publish. The only differences are:**
98
+ - Draft: Skip completeness checks
99
+ - Ready: Run completeness checks (warn if issues, allow proceed)
100
+ - PR status: Draft PR vs regular PR
101
+
102
+ **Steps:**
103
+
104
+ 1. **Completeness checks (Ready only):**
105
+
106
+ If publishing as "Ready", check critical sections in thought doc:
107
+
108
+ ```bash
109
+ # Check critical sections in thought doc
110
+ missing_critical=$(check_critical_sections "$thought_doc_path")
111
+
112
+ if [ -n "$missing_critical" ]; then
113
+ echo "⚠️ Warning: Critical sections are missing or empty:"
114
+ echo "$missing_critical"
115
+ echo ""
116
+ echo "Common missing sections:"
117
+ echo " - Background / Problem statement"
118
+ echo " - Proposal / Solution"
119
+ echo " - Key Decisions"
120
+ echo " - Risks & Mitigations"
121
+ echo ""
122
+ echo "Continue publishing anyway? (y/n)"
123
+ # Get user confirmation
124
+ fi
125
+ ```
126
+
127
+ If publishing as "Draft", skip this step entirely.
128
+
129
+ 2. **Ask about research doc:**
130
+ ```
131
+ Include research doc in tech-design/ folder? (helps reviewers/LLMs understand context)
132
+ - Yes: Copy research.md
133
+ - No: Only rollup and thought-doc
134
+ ```
135
+
136
+ 3. **Generate rollup from thought-doc:**
137
+
138
+ Read the template from `references/rollup-template.md` and populate it by extracting sections from thought-doc.md.
139
+
140
+ ```bash
141
+ # Read the canonical template structure
142
+ rollup_template=$(cat references/rollup-template.md)
143
+
144
+ # Extract sections from thought doc
145
+ background=$(extract_section "$thought_doc_path" "Background")
146
+ proposal=$(extract_section "$thought_doc_path" "Proposal")
147
+ scope=$(extract_section "$thought_doc_path" "Scope")
148
+ decisions=$(extract_section "$thought_doc_path" "Key Decisions")
149
+ risks=$(extract_section "$thought_doc_path" "Risks")
150
+ rollout=$(extract_section "$thought_doc_path" "Rollout")
151
+ implementation=$(extract_section "$thought_doc_path" "Implementation")
152
+ ```
153
+
154
+ **Rollup generation logic:**
155
+
156
+ - **TL;DR**: Synthesize 2-3 sentences from Background + Proposal
157
+ - **Problem**: Extract from Background, focus on current pain
158
+ - **Solution**: From Proposal, assuming recommended decisions accepted
159
+ - **Scope**: Extract Scope section or infer from Proposal
160
+ - **Key Decisions**: Transform from thought doc format:
161
+ - Show options with pros/cons
162
+ - Mark recommended vs rejected
163
+ - Format: `(Recommended) Option A:` and `(Rejected) Option B:`
164
+ - **Risks**: Extract Risks section, ensure mitigations present
165
+ - **Rollout**: Extract Rollout section, phases with risk mitigation
166
+ - **Implementation**: High-level phases from Implementation section
167
+ - **Preserve visual elements**: Mermaid diagrams, tables, code blocks from sections should be included in rollup
168
+
169
+ See "Roll-up Generation Details" below for detailed examples.
170
+
171
+ 4. **Copy files to codex:**
172
+ ```bash
173
+ # Write rollup
174
+ rollup_path="$codex_repo/projects/$project/TECH-DESIGN.md"
175
+ echo "$rollup_content" > "$rollup_path"
176
+
177
+ # Create/update tech-design folder
178
+ mkdir -p "$codex_repo/projects/$project/tech-design"
179
+ cp "$thought_doc_path" "$codex_repo/projects/$project/tech-design/thought-doc.md"
180
+
181
+ if [ "$include_research" = "yes" ]; then
182
+ cp "$research_doc_path" "$codex_repo/projects/$project/tech-design/research.md"
183
+ fi
184
+
185
+ # Copy diagrams and additional files
186
+ for file in "$design_folder"/*.{png,jpg,svg,pdf} 2>/dev/null; do
187
+ [ -f "$file" ] && cp "$file" "$codex_repo/projects/$project/tech-design/"
188
+ done
189
+ ```
190
+
191
+ 5. **Add frontmatter:**
192
+
193
+ **Rollup frontmatter:**
194
+ ```yaml
195
+ ---
196
+ title: "[Tech Design] $project"
197
+ type: tech-design
198
+ status: $(if draft: "draft", if ready: "ready")
199
+ created: $(date +%Y-%m-%d)
200
+ updated: $(date +%Y-%m-%d)
201
+ confidence: medium
202
+ ---
203
+ ```
204
+
205
+ **Thought doc frontmatter:**
206
+ ```yaml
207
+ ---
208
+ title: "[Tech Design - Working Doc] $project"
209
+ type: tech-design-working
210
+ status: $(if draft: "draft", if ready: "ready")
211
+ created: $(date +%Y-%m-%d)
212
+ updated: $(date +%Y-%m-%d)
213
+ note: $(if draft: "Work-in-progress", if ready: "Full working document with context and exploration")
214
+ ---
215
+ ```
216
+
217
+ 6. **Create or update branch and PR:**
218
+
219
+ **If first publish (no existing PR):**
220
+ ```bash
221
+ cd "$codex_repo"
222
+ git checkout -b "tech-design/$project"
223
+ git add "projects/$project"
224
+ git commit -m "$(if draft: "Draft tech design" else "Tech design") for $project
225
+
226
+ $(if draft: "Sharing work-in-progress for early feedback." else: "Complete technical design ready for review.")
227
+
228
+ Files:
229
+ - TECH-DESIGN.md - Clean rollup for reviewers
230
+ - tech-design/thought-doc.md - Full working document
231
+ $([ "$include_research" = "yes" ] && echo "- tech-design/research.md - Context and research")
232
+ "
233
+
234
+ git push -u origin "tech-design/$project"
235
+
236
+ # Create PR (draft or regular based on user choice)
237
+ gh pr create \
238
+ $(if draft: "--draft") \
239
+ --title "$(if draft: "[Draft] ")Tech Design: $project" \
240
+ --body "$(cat <<'EOF'
241
+ ## Summary
242
+
243
+ $(if draft: "🚧 **Work-in-progress** - sharing for early feedback." else: "Technical design for **$project**.")
202
244
 
203
245
  ## Documents
204
246
 
205
- - **TECH-DESIGN.md**: Clean, reviewable roll-up (start here)
206
- - **artifacts/thought-doc.md**: Full working document with exploration and context
247
+ - **TECH-DESIGN.md**: Clean, reviewable rollup (start here)
248
+ - **tech-design/thought-doc.md**: Full working document with exploration and context
249
+ $([ "$include_research" = "yes" ] && echo "- **tech-design/research.md**: Codebase discoveries and research")
207
250
 
208
251
  ## Two-Document Approach
209
252
 
210
- The roll-up synthesizes the thought doc into a clean, decision-focused format for reviewers.
253
+ The rollup (TECH-DESIGN.md) synthesizes the thought doc into a clean, decision-focused format for reviewers.
211
254
 
212
255
  The thought doc contains the full exploration, research findings, @mentions, and working notes.
213
256
 
@@ -217,44 +260,77 @@ Both are included for full transparency.
217
260
 
218
261
  **For quick review:**
219
262
  - Read TECH-DESIGN.md only
220
- - Use GitHub's suggested reviewers
263
+ - Comment on high-level approach and decisions
221
264
 
222
265
  **For deep review:**
223
266
  - Read TECH-DESIGN.md first
224
267
  - Reference thought-doc.md for context on decisions
225
- - Comment on either file as appropriate
268
+ - Check research.md to understand codebase discoveries
226
269
 
227
270
  ## Next Steps
228
271
 
229
272
  After approval:
230
273
  - [ ] Create implementation tickets
231
274
  - [ ] Add key decisions to DECISIONS.md
232
- - [ ] Begin implementation"
233
-
234
- # Use codex skill's git-finish-write script with needs-review label
235
- droid config --get tools.codex | droid exec droid-codex git-finish-write \
236
- --config - \
237
- --message "$commit_msg" \
238
- --pr-title "$pr_title" \
239
- --pr-body "$pr_body" \
240
- --labels "needs-review"
241
- ```
275
+ - [ ] Begin implementation
242
276
 
243
- ### 8. Output Success
277
+ ---
278
+
279
+ 🤖 Created with [droid](https://github.com/Orderful/droid)
280
+ EOF
281
+ )"
282
+ ```
283
+
284
+ **If updating existing PR:**
285
+ ```bash
286
+ # Update files
287
+ git add "projects/$project"
288
+ git commit -m "Update tech design for $project
289
+
290
+ Regenerated rollup and updated working files."
291
+ git push
292
+
293
+ # If changing draft status
294
+ if [ "$change_status" = "yes" ]; then
295
+ if [ "$new_status" = "ready" ]; then
296
+ gh pr ready "$existing_pr"
297
+ gh pr edit "$existing_pr" --title "Tech Design: $project"
298
+ else
299
+ # GitHub doesn't support marking ready → draft via CLI
300
+ echo "⚠️ To mark PR as draft, do it manually in GitHub UI"
301
+ fi
302
+ fi
303
+ ```
304
+
305
+ 7. **Output:**
306
+ ```
307
+ ✓ Tech design published!
308
+
309
+ PR $(if new: "created" else: "updated"): {pr_url}
310
+ $(if changed_to_ready: "✓ Marked PR as ready for review")
311
+
312
+ Files in PR:
313
+ • projects/$project/TECH-DESIGN.md (reviewable rollup)
314
+ • projects/$project/tech-design/thought-doc.md (full working doc)
315
+ $([ "$include_research" = "yes" ] && echo " • projects/$project/tech-design/research.md (context and research)")
316
+
317
+ Next steps:
318
+ • $(if draft: "Share PR with teammates for early feedback" else: "Share PR with reviewers")
319
+ • Continue iterating in brain folder: {design_folder}
320
+ • Run /tech-design publish again to update PR with latest changes
321
+ • $(if draft: "When ready: change publish type to 'Ready' to mark PR ready for formal review")
322
+ ```
323
+
324
+ ### 6. Never Delete Brain Files
325
+
326
+ **CRITICAL:** Brain folder is the working copy. Codex is the published copy.
244
327
 
245
328
  ```bash
246
- echo "✓ Tech design published!"
247
- echo ""
248
- echo "PR created: $pr_url"
249
- echo ""
250
- echo "Files in PR:"
251
- echo " • projects/$project/TECH-DESIGN.md (reviewable roll-up)"
252
- echo " • projects/$project/artifacts/thought-doc.md (full working doc)"
253
- echo ""
254
- echo "Next steps:"
255
- echo " • Share PR with reviewers"
256
- echo " • Address feedback with: /tech-design respond \"question\""
257
- echo " • After approval: /codex decision to capture key decisions"
329
+ # NEVER do this:
330
+ # rm -rf "$design_folder"
331
+
332
+ # Brain files stay untouched after publish
333
+ # User can continue iterating and republish
258
334
  ```
259
335
 
260
336
  ## Roll-up Generation Details
@@ -285,7 +361,7 @@ We're building reusable transaction templates that partners can customize for th
285
361
 
286
362
  - Solution discussion (save for Solution section)
287
363
  - Historical context (save for artifacts if needed)
288
- - Excessive detail (roll-up is concise)
364
+ - Excessive detail (rollup is concise)
289
365
 
290
366
  ### Solution Synthesis
291
367
 
@@ -345,54 +421,17 @@ Services poll the database for status changes every 5 seconds.
345
421
 
346
422
  ## Error Handling
347
423
 
348
- - **Thought doc not found:** Remind to run `/tech-design start` first
349
- - **Critical sections missing:** Warn, get confirmation to proceed
424
+ - **Thought doc not found:** Remind to run `/tech-design start` or `/tech-design search` first
425
+ - **Critical sections missing (ready only):** Warn, get confirmation to proceed
350
426
  - **Project not in codex:** Offer to create or specify different project
351
- - **Git operations fail:** Use codex skill's error handling (auto-recover)
352
- - **PR creation fails:** Show error, suggest manual PR creation
427
+ - **Git operations fail:** Show error, leave partial state with clear error message for manual fix
428
+ - **PR creation fails:** Show error, provide git commands for manual PR creation
353
429
  - **Roll-up generation fails:** Fallback to template with placeholders, note what needs manual editing
430
+ - **No changes to commit:** "No changes detected. Update files in brain folder first."
354
431
 
355
- ## Example Output
356
-
357
- ```
358
- Analyzing thought doc...
359
- ✓ All critical sections present
360
- ✓ Project exists in codex: transaction-templates
361
-
362
- Generating roll-up...
363
- ✓ Synthesized TL;DR from Background + Proposal
364
- ✓ Extracted Problem statement
365
- ✓ Synthesized Solution (assuming recommended decisions)
366
- ✓ Formatted 3 Key Decisions with recommendations
367
- ✓ Generated Risk mitigation table
368
- ✓ Formatted 3-phase rollout plan
369
-
370
- Writing to codex...
371
- ✓ Created: projects/transaction-templates/TECH-DESIGN.md
372
- ✓ Created: projects/transaction-templates/artifacts/thought-doc.md
373
-
374
- Creating PR...
375
- ✓ Branch: codex/tech-design-transaction-templates
376
- ✓ Commit: Add tech design for transaction-templates
377
- ✓ PR: {git_repo_link}/pull/42
378
-
379
- ✓ Tech design published!
380
-
381
- PR created: {git_repo_link}/pull/42
382
-
383
- Files in PR:
384
- • projects/transaction-templates/TECH-DESIGN.md (reviewable roll-up)
385
- • projects/transaction-templates/artifacts/thought-doc.md (full working doc)
386
-
387
- Next steps:
388
- • Share PR with reviewers
389
- • Address feedback (v2 feature: /tech-design respond)
390
- • After approval: /codex decision to capture key decisions
391
- ```
392
-
393
- ## Roll-up Quality Checklist
432
+ ## Roll-up Quality Checklist (Ready Publish Only)
394
433
 
395
- Before creating PR, verify roll-up:
434
+ Before creating PR, verify rollup:
396
435
 
397
436
  - [ ] TL;DR is 2-3 sentences, jargon-free
398
437
  - [ ] Problem is clear, focused on pain (not solution)
@@ -404,7 +443,24 @@ Before creating PR, verify roll-up:
404
443
  - [ ] Risks have concrete mitigations (not just "monitor closely")
405
444
  - [ ] Rollout has phases with specific risk mitigation per phase
406
445
  - [ ] Implementation phases are high-level milestones, not tasks
407
- - [ ] No @mentions in roll-up (those stay in thought doc)
446
+ - [ ] No @droid/@user mentions in rollup (those stay in thought doc)
408
447
  - [ ] No exploratory content (those stay in thought doc)
409
448
 
410
449
  If any fail, note in output and offer to refine before PR.
450
+
451
+ ## Directory Structure Summary
452
+
453
+ **Published structure (same for both draft and ready):**
454
+ ```
455
+ projects/{name}/
456
+ ├── TECH-DESIGN.md (rollup - always generated)
457
+ └── tech-design/
458
+ ├── thought-doc.md (full working document)
459
+ └── research.md (optional - if user chose to include)
460
+ ```
461
+
462
+ **Key points:**
463
+ - Rollup is always generated (it's a build artifact from thought-doc)
464
+ - Draft vs Ready is indicated by GitHub PR status only
465
+ - File structure is consistent regardless of draft/ready status
466
+ - `artifacts/` folder is separate and not managed by tech-design (used for transcripts, meeting notes, etc.)