@orderful/droid 0.34.0 → 0.35.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +24 -0
- package/dist/bin/droid.js +25 -10
- package/dist/index.js +16 -9
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/tools/codex/.claude-plugin/plugin.json +1 -1
- package/dist/tools/codex/TOOL.yaml +1 -1
- package/dist/tools/codex/skills/codex/SKILL.md +17 -2
- package/dist/tools/codex/skills/codex/references/review/tech-design.md +34 -0
- package/dist/tools/codex/skills/codex/references/review/workflow.md +250 -0
- package/package.json +1 -1
- package/src/commands/tui/views/SkillConfigScreen.tsx +2 -2
- package/src/lib/config.ts +25 -13
- package/src/tools/codex/.claude-plugin/plugin.json +1 -1
- package/src/tools/codex/TOOL.yaml +1 -1
- package/src/tools/codex/skills/codex/SKILL.md +17 -2
- package/src/tools/codex/skills/codex/references/review/tech-design.md +34 -0
- package/src/tools/codex/skills/codex/references/review/workflow.md +250 -0
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
{
|
|
62
62
|
"name": "droid-codex",
|
|
63
63
|
"description": "Shared organizational knowledge - PRDs, tech designs, domains, proposals, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or creating new entries.",
|
|
64
|
-
"version": "0.
|
|
64
|
+
"version": "0.2.0",
|
|
65
65
|
"source": {
|
|
66
66
|
"source": "github",
|
|
67
67
|
"repo": "orderful/droid",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @orderful/droid
|
|
2
2
|
|
|
3
|
+
## 0.35.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#209](https://github.com/Orderful/droid/pull/209) [`74cbdbb`](https://github.com/Orderful/droid/commit/74cbdbba131741412f3a5d490472ff8b4c22e286) Thanks [@frytyler](https://github.com/frytyler)! - feat(codex): add review skill for conversational document reviews
|
|
8
|
+
|
|
9
|
+
New capability for reviewing structured documents (tech designs, PRDs) conversationally in the CLI.
|
|
10
|
+
|
|
11
|
+
Features:
|
|
12
|
+
- Generic review workflow for structured docs
|
|
13
|
+
- Tech design document type support
|
|
14
|
+
- Section-based navigation ("Show me the rollout section")
|
|
15
|
+
- Context search in thought docs ("Why was X rejected?")
|
|
16
|
+
- MVP scope (read-only, CLI navigation)
|
|
17
|
+
|
|
18
|
+
Commands:
|
|
19
|
+
- `/codex review {type} --pr {number}` - Load and review a PR
|
|
20
|
+
|
|
21
|
+
## 0.34.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#207](https://github.com/Orderful/droid/pull/207) [`1bb9dab`](https://github.com/Orderful/droid/commit/1bb9dab3079c32ecfa6069c074cbc6b076273f68) Thanks [@frytyler](https://github.com/frytyler)! - Fix config migration and TUI config persistence. Migration now properly re-runs if incomplete, and TUI tool config updates now persist to the consolidated config location instead of old override files.
|
|
26
|
+
|
|
3
27
|
## 0.34.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/dist/bin/droid.js
CHANGED
|
@@ -75,11 +75,15 @@ function migrateConfig(config) {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
function migrateToolConfigs(config) {
|
|
78
|
-
if (config.migrations?.tools_consolidated) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
78
|
const skillsDir = join(CONFIG_DIR, "skills");
|
|
82
79
|
if (!existsSync(skillsDir)) {
|
|
80
|
+
if (!config.migrations) {
|
|
81
|
+
config.migrations = {};
|
|
82
|
+
}
|
|
83
|
+
if (!config.migrations.tools_consolidated) {
|
|
84
|
+
config.migrations.tools_consolidated = true;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
83
87
|
return false;
|
|
84
88
|
}
|
|
85
89
|
let migrated = false;
|
|
@@ -97,18 +101,21 @@ function migrateToolConfigs(config) {
|
|
|
97
101
|
if (!config.tools) {
|
|
98
102
|
config.tools = {};
|
|
99
103
|
}
|
|
100
|
-
config.tools[skillName]
|
|
101
|
-
|
|
104
|
+
if (!config.tools[skillName]) {
|
|
105
|
+
config.tools[skillName] = overrides;
|
|
106
|
+
migrated = true;
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
} catch {
|
|
104
110
|
continue;
|
|
105
111
|
}
|
|
106
112
|
}
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
if (!config.migrations) {
|
|
114
|
+
config.migrations = {};
|
|
115
|
+
}
|
|
116
|
+
if (!config.migrations.tools_consolidated) {
|
|
111
117
|
config.migrations.tools_consolidated = true;
|
|
118
|
+
migrated = true;
|
|
112
119
|
}
|
|
113
120
|
return migrated;
|
|
114
121
|
} catch {
|
|
@@ -218,6 +225,14 @@ function getToolSettings(name) {
|
|
|
218
225
|
const config = loadConfig();
|
|
219
226
|
return config.tools?.[name] ?? {};
|
|
220
227
|
}
|
|
228
|
+
function setToolSettings(name, settings) {
|
|
229
|
+
const config = loadConfig();
|
|
230
|
+
if (!config.tools) {
|
|
231
|
+
config.tools = {};
|
|
232
|
+
}
|
|
233
|
+
config.tools[name] = settings;
|
|
234
|
+
saveConfig(config);
|
|
235
|
+
}
|
|
221
236
|
function getAutoUpdateConfig() {
|
|
222
237
|
const config = loadConfig();
|
|
223
238
|
return {
|
|
@@ -3219,7 +3234,7 @@ function SkillConfigScreen({ skill, onComplete, onCancel }) {
|
|
|
3219
3234
|
const [selectOptionIndex, setSelectOptionIndex] = useState6(0);
|
|
3220
3235
|
const totalItems = configKeys.length + 1;
|
|
3221
3236
|
const handleSave = () => {
|
|
3222
|
-
|
|
3237
|
+
setToolSettings(skill.name, values);
|
|
3223
3238
|
onComplete();
|
|
3224
3239
|
};
|
|
3225
3240
|
const handleSubmitEdit = () => {
|
package/dist/index.js
CHANGED
|
@@ -87,11 +87,15 @@ function migrateConfig(config) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
function migrateToolConfigs(config) {
|
|
90
|
-
if (config.migrations?.tools_consolidated) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
90
|
const skillsDir = join(CONFIG_DIR, "skills");
|
|
94
91
|
if (!existsSync(skillsDir)) {
|
|
92
|
+
if (!config.migrations) {
|
|
93
|
+
config.migrations = {};
|
|
94
|
+
}
|
|
95
|
+
if (!config.migrations.tools_consolidated) {
|
|
96
|
+
config.migrations.tools_consolidated = true;
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
95
99
|
return false;
|
|
96
100
|
}
|
|
97
101
|
let migrated = false;
|
|
@@ -109,18 +113,21 @@ function migrateToolConfigs(config) {
|
|
|
109
113
|
if (!config.tools) {
|
|
110
114
|
config.tools = {};
|
|
111
115
|
}
|
|
112
|
-
config.tools[skillName]
|
|
113
|
-
|
|
116
|
+
if (!config.tools[skillName]) {
|
|
117
|
+
config.tools[skillName] = overrides;
|
|
118
|
+
migrated = true;
|
|
119
|
+
}
|
|
114
120
|
}
|
|
115
121
|
} catch {
|
|
116
122
|
continue;
|
|
117
123
|
}
|
|
118
124
|
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
if (!config.migrations) {
|
|
126
|
+
config.migrations = {};
|
|
127
|
+
}
|
|
128
|
+
if (!config.migrations.tools_consolidated) {
|
|
123
129
|
config.migrations.tools_consolidated = true;
|
|
130
|
+
migrated = true;
|
|
124
131
|
}
|
|
125
132
|
return migrated;
|
|
126
133
|
} catch {
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AA2HjB;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAItC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,WAAW,CAgCxC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAKpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAanD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAiBhE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAWD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAsBpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,cAAc,GACxB,IAAI,CAWN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAGxD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI,CAOxE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAI9E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,gBAAgB,CAMtD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAQ5E;AAYD;;GAEG;AACH,wBAAgB,QAAQ,IAAI,UAAU,EAAE,CAGvC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAG5D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM5D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAiB9C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAchD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "droid-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared organizational knowledge - PRDs, tech designs, domains, proposals, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or creating new entries.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Orderful",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name: codex
|
|
2
2
|
description: "Shared organizational knowledge - PRDs, tech designs, domains, proposals, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or creating new entries."
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.2.0
|
|
4
4
|
status: beta
|
|
5
5
|
|
|
6
6
|
includes:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codex
|
|
3
|
-
description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context ('load transaction-templates'), searching codex ('search webhook'), capturing decisions ('codex decision'), or adding explored topics ('add topic'). User prompts like 'check the codex', 'what's in the codex about X', 'load the PRD for Y'."
|
|
4
|
-
argument-hint: "[projects | domains | proposals | patterns | topics | {name} | search {query} | new {type} {name} | decision {text}]"
|
|
3
|
+
description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context ('load transaction-templates'), searching codex ('search webhook'), reviewing documents ('review tech-design'), capturing decisions ('codex decision'), or adding explored topics ('add topic'). User prompts like 'check the codex', 'what's in the codex about X', 'load the PRD for Y'."
|
|
4
|
+
argument-hint: "[projects | domains | proposals | patterns | topics | {name} | search {query} | review {type} | new {type} {name} | decision {text}]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
[
|
|
7
7
|
Read,
|
|
@@ -173,6 +173,7 @@ The codex has five categories:
|
|
|
173
173
|
| `/codex search {query}` | Search and load entry (searches all categories) |
|
|
174
174
|
| `/codex search {query} -- {instruction}` | Search, load, then execute follow-up instruction |
|
|
175
175
|
| `/codex {category} search {query}` | Search within a specific category only |
|
|
176
|
+
| `/codex review {type} --pr {number}` | Conversational review of a document PR |
|
|
176
177
|
| `/codex new {category} {name}` | Scaffold new entry (project/domain/proposal/pattern/topic) |
|
|
177
178
|
| `/codex decision {text}` | Append to active project's DECISIONS.md |
|
|
178
179
|
| `/codex snapshot {type} {file} {name}` | Import PDF/markdown to codex (uses agent) |
|
|
@@ -360,6 +361,20 @@ Artifacts are supplementary documents that support a project but aren't core doc
|
|
|
360
361
|
|
|
361
362
|
Artifacts get lighter frontmatter with `type: artifact` and source like `interview`, `transcript`, `notes`, `meeting`, `research`, `spike`, or `analysis`.
|
|
362
363
|
|
|
364
|
+
## Reviewing Documents
|
|
365
|
+
|
|
366
|
+
**Trigger:** `/codex review {type} --pr {number}`
|
|
367
|
+
|
|
368
|
+
**Procedure:**
|
|
369
|
+
|
|
370
|
+
1. **Run preamble:** `droid config --get tools.codex | droid exec codex git-preamble --config -`
|
|
371
|
+
2. **Fetch PR info:** `gh pr view {number} --json files,title`
|
|
372
|
+
3. **Filter & Load:** Identify the primary document (e.g., `TECH-DESIGN.md`) and context (e.g., `thought-doc.md`) based on the `{type}` definition.
|
|
373
|
+
4. **Interactive Review:** Guide the user through the document sections.
|
|
374
|
+
|
|
375
|
+
Full procedure: `references/review/workflow.md`
|
|
376
|
+
Type definitions: `references/review/{type}.md`
|
|
377
|
+
|
|
363
378
|
## Creating New Entries
|
|
364
379
|
|
|
365
380
|
**Trigger:** `/codex new {category} {name}`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Tech Design Document Type
|
|
2
|
+
|
|
3
|
+
Configuration for reviewing Tech Design documents via `/codex review tech-design`.
|
|
4
|
+
|
|
5
|
+
## File Patterns
|
|
6
|
+
|
|
7
|
+
| Role | Pattern | Description |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| **Primary** | `**/TECH-DESIGN.md` | The main document being reviewed. Sections are parsed from here. |
|
|
10
|
+
| **Context** | `**/thought-doc.md` | Backstory, alternatives, and trade-offs. Used for "why" questions. |
|
|
11
|
+
|
|
12
|
+
*Note: In the MVP, we assume a single TECH-DESIGN.md per PR.*
|
|
13
|
+
|
|
14
|
+
## Section Parsing
|
|
15
|
+
Sections in `TECH-DESIGN.md` are defined by H2 headers (`## `). H3 headers (`###`) are treated as content within sections for MVP.
|
|
16
|
+
|
|
17
|
+
**The tool dynamically discovers ALL sections present in the document.** It does not filter for specific section names.
|
|
18
|
+
|
|
19
|
+
**Common sections** (examples, not exhaustive):
|
|
20
|
+
- TL;DR
|
|
21
|
+
- Problem
|
|
22
|
+
- Scope
|
|
23
|
+
- Solution
|
|
24
|
+
- Key Decisions
|
|
25
|
+
- Risks
|
|
26
|
+
- Rollout
|
|
27
|
+
- Implementation Phases
|
|
28
|
+
|
|
29
|
+
Authors may include additional sections (e.g., "Security", "Performance", "Alternatives Considered") and the tool will present them for navigation.
|
|
30
|
+
|
|
31
|
+
## Consistency Checks (Deferred)
|
|
32
|
+
*Future feature: Rules to automatically check consistency.*
|
|
33
|
+
- "Risks" section must list mitigations
|
|
34
|
+
- "Implementation Phases" must match "Rollout" steps
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Generic Document Review Workflow
|
|
2
|
+
|
|
3
|
+
The `/codex review` command provides a conversational interface for reviewing structured documents (tech designs, PRDs, etc.) directly in the CLI.
|
|
4
|
+
|
|
5
|
+
## 1. Loading the PR
|
|
6
|
+
|
|
7
|
+
**Trigger:** `/codex review {type} --pr {number}`
|
|
8
|
+
|
|
9
|
+
**Step 1: Preamble**
|
|
10
|
+
Run the git preamble to ensure we are on a clean state (though we're mostly reading).
|
|
11
|
+
```bash
|
|
12
|
+
droid config --get tools.codex | droid exec codex git-preamble --config -
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Step 2: Fetch PR Details**
|
|
16
|
+
Get the PR metadata to validate it exists and get the file list.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Get codex repo path from config
|
|
20
|
+
codex_repo=$(droid config --get tools.codex.codex_dir)
|
|
21
|
+
|
|
22
|
+
# Fetch PR info
|
|
23
|
+
gh pr view {number} --json files,title,url,headRefName --repo "$codex_repo"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check exit code: if non-zero, PR not found (see Error Handling below).
|
|
27
|
+
|
|
28
|
+
**Step 3: Checkout PR Branch**
|
|
29
|
+
Check out the PR to read files easily.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd "$codex_repo"
|
|
33
|
+
gh pr checkout {number}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates/switches to the PR branch locally.
|
|
37
|
+
|
|
38
|
+
**Step 4: Identify Files**
|
|
39
|
+
Match the file list against patterns in `references/review/{type}.md`.
|
|
40
|
+
|
|
41
|
+
For tech-design:
|
|
42
|
+
- **Primary:** `**/TECH-DESIGN.md`
|
|
43
|
+
- **Context:** `**/thought-doc.md` (optional)
|
|
44
|
+
|
|
45
|
+
Find files using:
|
|
46
|
+
```bash
|
|
47
|
+
find . -name "TECH-DESIGN.md" -type f
|
|
48
|
+
find . -name "thought-doc.md" -type f
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Step 5: Read Content**
|
|
52
|
+
Read identified files using the Read tool. Count lines for display.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
wc -l {path_to_primary} # Get line count
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Error Handling:**
|
|
59
|
+
|
|
60
|
+
**PR not found:**
|
|
61
|
+
```bash
|
|
62
|
+
gh pr view {number} --repo "$codex_repo"
|
|
63
|
+
# Check exit code
|
|
64
|
+
if [ $? -ne 0 ]; then
|
|
65
|
+
echo "❌ PR #{number} not found in codex repo"
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**TECH-DESIGN.md not found:**
|
|
71
|
+
If `find . -name "TECH-DESIGN.md"` returns nothing:
|
|
72
|
+
```
|
|
73
|
+
❌ No TECH-DESIGN.md found in PR #{number}
|
|
74
|
+
|
|
75
|
+
This PR doesn't appear to contain a tech design document.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**thought-doc.md missing (optional):**
|
|
79
|
+
If not found, continue without it:
|
|
80
|
+
```
|
|
81
|
+
⚠️ No thought-doc.md found - context search will be limited
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**gh CLI fails:**
|
|
85
|
+
```
|
|
86
|
+
❌ Failed to fetch PR details. Is gh CLI authenticated?
|
|
87
|
+
|
|
88
|
+
Try: gh auth status
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 2. Parsing Structure
|
|
92
|
+
|
|
93
|
+
**Step 1: Parse Sections**
|
|
94
|
+
Read the **Primary** document and extract H2 headers (lines starting with `## `).
|
|
95
|
+
|
|
96
|
+
Extract using pattern: `^##\s+(.+)$`
|
|
97
|
+
- Match lines starting with `##` followed by whitespace
|
|
98
|
+
- Capture everything after as the section name
|
|
99
|
+
- Strip leading/trailing whitespace
|
|
100
|
+
- Ignore H3 headers (`###`) for MVP - treat as content within sections
|
|
101
|
+
|
|
102
|
+
Example parsing:
|
|
103
|
+
```
|
|
104
|
+
## TL;DR → Section: "TL;DR"
|
|
105
|
+
## Problem → Section: "Problem"
|
|
106
|
+
### Sub-problem → (ignored, part of Problem section)
|
|
107
|
+
## Solution → Section: "Solution"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 2: Display Overview**
|
|
111
|
+
Output a dynamic summary based on the actual PR content:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
📋 Review: {PR Title} (PR #{number})
|
|
115
|
+
|
|
116
|
+
Documents loaded:
|
|
117
|
+
✓ {path_to_primary} ({line_count} lines)
|
|
118
|
+
✓ {path_to_context} ({line_count} lines) [if found]
|
|
119
|
+
|
|
120
|
+
Structure ({count} sections):
|
|
121
|
+
1. {First section name}
|
|
122
|
+
2. {Second section name}
|
|
123
|
+
...
|
|
124
|
+
{N}. {Last section name}
|
|
125
|
+
|
|
126
|
+
What would you like to do?
|
|
127
|
+
- Show me a specific section (e.g., "show me the {example section}")
|
|
128
|
+
- Ask questions about decisions (e.g., "why was X rejected?")
|
|
129
|
+
- Walk through section by section
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Note:** All values are dynamic:
|
|
133
|
+
- PR title comes from `gh pr view`
|
|
134
|
+
- File paths come from what's actually in the PR
|
|
135
|
+
- Section count and names come from parsing the TECH-DESIGN.md H2 headers
|
|
136
|
+
- If thought-doc.md not found, only show the primary document
|
|
137
|
+
|
|
138
|
+
**Example output:**
|
|
139
|
+
```
|
|
140
|
+
📋 Review: Transaction Templates Tech Design (PR #128)
|
|
141
|
+
|
|
142
|
+
Documents loaded:
|
|
143
|
+
✓ projects/transaction-templates/TECH-DESIGN.md (250 lines)
|
|
144
|
+
✓ projects/transaction-templates/artifacts/thought-doc.md (380 lines)
|
|
145
|
+
|
|
146
|
+
Structure (8 sections):
|
|
147
|
+
1. TL;DR
|
|
148
|
+
2. Problem
|
|
149
|
+
3. Scope
|
|
150
|
+
4. Solution
|
|
151
|
+
5. Key Decisions
|
|
152
|
+
6. Risks
|
|
153
|
+
7. Rollout
|
|
154
|
+
8. Implementation Phases
|
|
155
|
+
|
|
156
|
+
What would you like to do?
|
|
157
|
+
- Show me a specific section (e.g., "show me the rollout")
|
|
158
|
+
- Ask questions about decisions (e.g., "why was X rejected?")
|
|
159
|
+
- Walk through section by section
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Step 3: Wait for User Request**
|
|
163
|
+
User can now navigate conversationally.
|
|
164
|
+
|
|
165
|
+
## 3. Conversational Navigation
|
|
166
|
+
|
|
167
|
+
Map user requests to actions:
|
|
168
|
+
|
|
169
|
+
**"Show me {section}"**
|
|
170
|
+
1. Match the section name (see Section Matching below)
|
|
171
|
+
2. Read the Primary file
|
|
172
|
+
3. Extract content between `## {Match}` and the next `## ` header
|
|
173
|
+
4. Display the section content
|
|
174
|
+
|
|
175
|
+
**Section Matching Algorithm:**
|
|
176
|
+
|
|
177
|
+
Use case-insensitive substring matching:
|
|
178
|
+
|
|
179
|
+
1. Normalize user input and section names to lowercase
|
|
180
|
+
2. Check if user input is substring of any section name
|
|
181
|
+
3. If single match: use it
|
|
182
|
+
4. If multiple matches: pick the first one (or ask user to clarify)
|
|
183
|
+
5. If no matches: list available sections
|
|
184
|
+
|
|
185
|
+
**Examples:**
|
|
186
|
+
- User: "show rollout" → matches "Rollout"
|
|
187
|
+
- User: "security" → matches "Security Considerations"
|
|
188
|
+
- User: "risks" → matches "Risks"
|
|
189
|
+
- User: "key decisions" → matches "Key Decisions"
|
|
190
|
+
|
|
191
|
+
**"Walk me through it"**
|
|
192
|
+
1. Start with the first section
|
|
193
|
+
2. Display content
|
|
194
|
+
3. Ask "Continue to {Next Section}?"
|
|
195
|
+
4. Repeat until user stops or end of document
|
|
196
|
+
|
|
197
|
+
**"Jump to {section}"**
|
|
198
|
+
Same as "Show me {section}".
|
|
199
|
+
|
|
200
|
+
## 4. Contextual Search (Thought Docs)
|
|
201
|
+
|
|
202
|
+
**Trigger Detection:**
|
|
203
|
+
|
|
204
|
+
If user query contains any of: "why", "rejected", "alternative", "decision", "reason", "chose", "didn't"
|
|
205
|
+
→ Enter context search mode
|
|
206
|
+
|
|
207
|
+
**Term Extraction:**
|
|
208
|
+
|
|
209
|
+
Extract key phrases from the question:
|
|
210
|
+
- Strip question words: "why was", "why did we", "what about"
|
|
211
|
+
- Extract 2-4 word phrases: "event-based approach", "webhook pattern", "async processing"
|
|
212
|
+
- If user mentions specific terms in quotes, use those exactly
|
|
213
|
+
|
|
214
|
+
**Examples:**
|
|
215
|
+
- "Why was event-based rejected?" → search for "event-based"
|
|
216
|
+
- "Why did we choose sync over async?" → search for "sync" and "async"
|
|
217
|
+
- "What about the webhook approach?" → search for "webhook"
|
|
218
|
+
|
|
219
|
+
**Search Process:**
|
|
220
|
+
|
|
221
|
+
1. Search the **Context** document (e.g., `thought-doc.md`) first:
|
|
222
|
+
```bash
|
|
223
|
+
grep -C 5 -i "{term}" {path_to_context}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
2. Display results with context (5 lines before/after)
|
|
227
|
+
|
|
228
|
+
3. If multiple matches found: show first 3 matches
|
|
229
|
+
|
|
230
|
+
4. If no match in context doc: search Primary document
|
|
231
|
+
|
|
232
|
+
5. If still no match: "No mentions of '{term}' found in design docs"
|
|
233
|
+
|
|
234
|
+
**Display Format:**
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
Searching thought doc for "event-based"...
|
|
238
|
+
|
|
239
|
+
Found in Key Decisions section:
|
|
240
|
+
|
|
241
|
+
> Event-based was rejected because of complexity in guaranteeing
|
|
242
|
+
> order and handling failures. The synchronous API approach is
|
|
243
|
+
> simpler and sufficient for the MVP requirements. We considered
|
|
244
|
+
> event streaming but decided it was premature optimization.
|
|
245
|
+
|
|
246
|
+
Anything else?
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 5. Posting Feedback (MVP: Deferred)
|
|
250
|
+
*For MVP, we just display content. Users can use `gh pr comment` manually if they want, but the tool focuses on reading.*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, Text, useInput } from 'ink';
|
|
2
2
|
import TextInput from 'ink-text-input';
|
|
3
3
|
import { useState, useMemo } from 'react';
|
|
4
|
-
import { loadSkillOverrides,
|
|
4
|
+
import { loadSkillOverrides, setToolSettings } from '../../../lib/config';
|
|
5
5
|
import { ConfigOptionType, type SkillManifest, type SkillOverrides } from '../../../lib/types';
|
|
6
6
|
import { colors, MAX_VISIBLE_CONFIG_ITEMS } from '../constants';
|
|
7
7
|
|
|
@@ -38,7 +38,7 @@ export function SkillConfigScreen({ skill, onComplete, onCancel }: SkillConfigSc
|
|
|
38
38
|
const totalItems = configKeys.length + 1;
|
|
39
39
|
|
|
40
40
|
const handleSave = () => {
|
|
41
|
-
|
|
41
|
+
setToolSettings(skill.name, values);
|
|
42
42
|
onComplete();
|
|
43
43
|
};
|
|
44
44
|
|
package/src/lib/config.ts
CHANGED
|
@@ -71,15 +71,22 @@ function migrateConfig(
|
|
|
71
71
|
/**
|
|
72
72
|
* Migrate tool configs from old override files to config.tools.*
|
|
73
73
|
* Keeps old files as backup (will be removed in follow-up PR)
|
|
74
|
+
*
|
|
75
|
+
* Always checks for unmigrated override files, even if migration flag is set.
|
|
76
|
+
* This ensures migration runs if it was previously incomplete.
|
|
74
77
|
*/
|
|
75
78
|
function migrateToolConfigs(config: DroidConfig): boolean {
|
|
76
|
-
// Skip if already migrated
|
|
77
|
-
if (config.migrations?.tools_consolidated) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
79
|
const skillsDir = join(CONFIG_DIR, 'skills');
|
|
82
80
|
if (!existsSync(skillsDir)) {
|
|
81
|
+
// No skills directory means nothing to migrate
|
|
82
|
+
// Mark as complete to avoid future checks
|
|
83
|
+
if (!config.migrations) {
|
|
84
|
+
config.migrations = {};
|
|
85
|
+
}
|
|
86
|
+
if (!config.migrations.tools_consolidated) {
|
|
87
|
+
config.migrations.tools_consolidated = true;
|
|
88
|
+
return true; // Config changed (flag added)
|
|
89
|
+
}
|
|
83
90
|
return false;
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -101,12 +108,16 @@ function migrateToolConfigs(config: DroidConfig): boolean {
|
|
|
101
108
|
const overrides = YAML.parse(content) as SkillOverrides;
|
|
102
109
|
|
|
103
110
|
if (overrides && Object.keys(overrides).length > 0) {
|
|
104
|
-
//
|
|
111
|
+
// Check if already migrated to new location
|
|
105
112
|
if (!config.tools) {
|
|
106
113
|
config.tools = {};
|
|
107
114
|
}
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
|
|
116
|
+
// Only migrate if not already in new location
|
|
117
|
+
if (!config.tools[skillName]) {
|
|
118
|
+
config.tools[skillName] = overrides;
|
|
119
|
+
migrated = true;
|
|
120
|
+
}
|
|
110
121
|
}
|
|
111
122
|
} catch {
|
|
112
123
|
// Skip files that can't be parsed
|
|
@@ -114,12 +125,13 @@ function migrateToolConfigs(config: DroidConfig): boolean {
|
|
|
114
125
|
}
|
|
115
126
|
}
|
|
116
127
|
|
|
117
|
-
if
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
// Mark migration as complete if not already marked
|
|
129
|
+
if (!config.migrations) {
|
|
130
|
+
config.migrations = {};
|
|
131
|
+
}
|
|
132
|
+
if (!config.migrations.tools_consolidated) {
|
|
122
133
|
config.migrations.tools_consolidated = true;
|
|
134
|
+
migrated = true;
|
|
123
135
|
}
|
|
124
136
|
|
|
125
137
|
return migrated;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "droid-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared organizational knowledge - PRDs, tech designs, domains, proposals, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or creating new entries.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Orderful",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
name: codex
|
|
2
2
|
description: "Shared organizational knowledge - PRDs, tech designs, domains, proposals, patterns, and explored topics. Use when loading project context, searching codex, capturing decisions, or creating new entries."
|
|
3
|
-
version: 0.
|
|
3
|
+
version: 0.2.0
|
|
4
4
|
status: beta
|
|
5
5
|
|
|
6
6
|
includes:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codex
|
|
3
|
-
description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context ('load transaction-templates'), searching codex ('search webhook'), capturing decisions ('codex decision'), or adding explored topics ('add topic'). User prompts like 'check the codex', 'what's in the codex about X', 'load the PRD for Y'."
|
|
4
|
-
argument-hint: "[projects | domains | proposals | patterns | topics | {name} | search {query} | new {type} {name} | decision {text}]"
|
|
3
|
+
description: "Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Use when loading project context ('load transaction-templates'), searching codex ('search webhook'), reviewing documents ('review tech-design'), capturing decisions ('codex decision'), or adding explored topics ('add topic'). User prompts like 'check the codex', 'what's in the codex about X', 'load the PRD for Y'."
|
|
4
|
+
argument-hint: "[projects | domains | proposals | patterns | topics | {name} | search {query} | review {type} | new {type} {name} | decision {text}]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
[
|
|
7
7
|
Read,
|
|
@@ -173,6 +173,7 @@ The codex has five categories:
|
|
|
173
173
|
| `/codex search {query}` | Search and load entry (searches all categories) |
|
|
174
174
|
| `/codex search {query} -- {instruction}` | Search, load, then execute follow-up instruction |
|
|
175
175
|
| `/codex {category} search {query}` | Search within a specific category only |
|
|
176
|
+
| `/codex review {type} --pr {number}` | Conversational review of a document PR |
|
|
176
177
|
| `/codex new {category} {name}` | Scaffold new entry (project/domain/proposal/pattern/topic) |
|
|
177
178
|
| `/codex decision {text}` | Append to active project's DECISIONS.md |
|
|
178
179
|
| `/codex snapshot {type} {file} {name}` | Import PDF/markdown to codex (uses agent) |
|
|
@@ -360,6 +361,20 @@ Artifacts are supplementary documents that support a project but aren't core doc
|
|
|
360
361
|
|
|
361
362
|
Artifacts get lighter frontmatter with `type: artifact` and source like `interview`, `transcript`, `notes`, `meeting`, `research`, `spike`, or `analysis`.
|
|
362
363
|
|
|
364
|
+
## Reviewing Documents
|
|
365
|
+
|
|
366
|
+
**Trigger:** `/codex review {type} --pr {number}`
|
|
367
|
+
|
|
368
|
+
**Procedure:**
|
|
369
|
+
|
|
370
|
+
1. **Run preamble:** `droid config --get tools.codex | droid exec codex git-preamble --config -`
|
|
371
|
+
2. **Fetch PR info:** `gh pr view {number} --json files,title`
|
|
372
|
+
3. **Filter & Load:** Identify the primary document (e.g., `TECH-DESIGN.md`) and context (e.g., `thought-doc.md`) based on the `{type}` definition.
|
|
373
|
+
4. **Interactive Review:** Guide the user through the document sections.
|
|
374
|
+
|
|
375
|
+
Full procedure: `references/review/workflow.md`
|
|
376
|
+
Type definitions: `references/review/{type}.md`
|
|
377
|
+
|
|
363
378
|
## Creating New Entries
|
|
364
379
|
|
|
365
380
|
**Trigger:** `/codex new {category} {name}`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Tech Design Document Type
|
|
2
|
+
|
|
3
|
+
Configuration for reviewing Tech Design documents via `/codex review tech-design`.
|
|
4
|
+
|
|
5
|
+
## File Patterns
|
|
6
|
+
|
|
7
|
+
| Role | Pattern | Description |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| **Primary** | `**/TECH-DESIGN.md` | The main document being reviewed. Sections are parsed from here. |
|
|
10
|
+
| **Context** | `**/thought-doc.md` | Backstory, alternatives, and trade-offs. Used for "why" questions. |
|
|
11
|
+
|
|
12
|
+
*Note: In the MVP, we assume a single TECH-DESIGN.md per PR.*
|
|
13
|
+
|
|
14
|
+
## Section Parsing
|
|
15
|
+
Sections in `TECH-DESIGN.md` are defined by H2 headers (`## `). H3 headers (`###`) are treated as content within sections for MVP.
|
|
16
|
+
|
|
17
|
+
**The tool dynamically discovers ALL sections present in the document.** It does not filter for specific section names.
|
|
18
|
+
|
|
19
|
+
**Common sections** (examples, not exhaustive):
|
|
20
|
+
- TL;DR
|
|
21
|
+
- Problem
|
|
22
|
+
- Scope
|
|
23
|
+
- Solution
|
|
24
|
+
- Key Decisions
|
|
25
|
+
- Risks
|
|
26
|
+
- Rollout
|
|
27
|
+
- Implementation Phases
|
|
28
|
+
|
|
29
|
+
Authors may include additional sections (e.g., "Security", "Performance", "Alternatives Considered") and the tool will present them for navigation.
|
|
30
|
+
|
|
31
|
+
## Consistency Checks (Deferred)
|
|
32
|
+
*Future feature: Rules to automatically check consistency.*
|
|
33
|
+
- "Risks" section must list mitigations
|
|
34
|
+
- "Implementation Phases" must match "Rollout" steps
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Generic Document Review Workflow
|
|
2
|
+
|
|
3
|
+
The `/codex review` command provides a conversational interface for reviewing structured documents (tech designs, PRDs, etc.) directly in the CLI.
|
|
4
|
+
|
|
5
|
+
## 1. Loading the PR
|
|
6
|
+
|
|
7
|
+
**Trigger:** `/codex review {type} --pr {number}`
|
|
8
|
+
|
|
9
|
+
**Step 1: Preamble**
|
|
10
|
+
Run the git preamble to ensure we are on a clean state (though we're mostly reading).
|
|
11
|
+
```bash
|
|
12
|
+
droid config --get tools.codex | droid exec codex git-preamble --config -
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Step 2: Fetch PR Details**
|
|
16
|
+
Get the PR metadata to validate it exists and get the file list.
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Get codex repo path from config
|
|
20
|
+
codex_repo=$(droid config --get tools.codex.codex_dir)
|
|
21
|
+
|
|
22
|
+
# Fetch PR info
|
|
23
|
+
gh pr view {number} --json files,title,url,headRefName --repo "$codex_repo"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Check exit code: if non-zero, PR not found (see Error Handling below).
|
|
27
|
+
|
|
28
|
+
**Step 3: Checkout PR Branch**
|
|
29
|
+
Check out the PR to read files easily.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd "$codex_repo"
|
|
33
|
+
gh pr checkout {number}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates/switches to the PR branch locally.
|
|
37
|
+
|
|
38
|
+
**Step 4: Identify Files**
|
|
39
|
+
Match the file list against patterns in `references/review/{type}.md`.
|
|
40
|
+
|
|
41
|
+
For tech-design:
|
|
42
|
+
- **Primary:** `**/TECH-DESIGN.md`
|
|
43
|
+
- **Context:** `**/thought-doc.md` (optional)
|
|
44
|
+
|
|
45
|
+
Find files using:
|
|
46
|
+
```bash
|
|
47
|
+
find . -name "TECH-DESIGN.md" -type f
|
|
48
|
+
find . -name "thought-doc.md" -type f
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Step 5: Read Content**
|
|
52
|
+
Read identified files using the Read tool. Count lines for display.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
wc -l {path_to_primary} # Get line count
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Error Handling:**
|
|
59
|
+
|
|
60
|
+
**PR not found:**
|
|
61
|
+
```bash
|
|
62
|
+
gh pr view {number} --repo "$codex_repo"
|
|
63
|
+
# Check exit code
|
|
64
|
+
if [ $? -ne 0 ]; then
|
|
65
|
+
echo "❌ PR #{number} not found in codex repo"
|
|
66
|
+
exit 1
|
|
67
|
+
fi
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**TECH-DESIGN.md not found:**
|
|
71
|
+
If `find . -name "TECH-DESIGN.md"` returns nothing:
|
|
72
|
+
```
|
|
73
|
+
❌ No TECH-DESIGN.md found in PR #{number}
|
|
74
|
+
|
|
75
|
+
This PR doesn't appear to contain a tech design document.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**thought-doc.md missing (optional):**
|
|
79
|
+
If not found, continue without it:
|
|
80
|
+
```
|
|
81
|
+
⚠️ No thought-doc.md found - context search will be limited
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**gh CLI fails:**
|
|
85
|
+
```
|
|
86
|
+
❌ Failed to fetch PR details. Is gh CLI authenticated?
|
|
87
|
+
|
|
88
|
+
Try: gh auth status
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## 2. Parsing Structure
|
|
92
|
+
|
|
93
|
+
**Step 1: Parse Sections**
|
|
94
|
+
Read the **Primary** document and extract H2 headers (lines starting with `## `).
|
|
95
|
+
|
|
96
|
+
Extract using pattern: `^##\s+(.+)$`
|
|
97
|
+
- Match lines starting with `##` followed by whitespace
|
|
98
|
+
- Capture everything after as the section name
|
|
99
|
+
- Strip leading/trailing whitespace
|
|
100
|
+
- Ignore H3 headers (`###`) for MVP - treat as content within sections
|
|
101
|
+
|
|
102
|
+
Example parsing:
|
|
103
|
+
```
|
|
104
|
+
## TL;DR → Section: "TL;DR"
|
|
105
|
+
## Problem → Section: "Problem"
|
|
106
|
+
### Sub-problem → (ignored, part of Problem section)
|
|
107
|
+
## Solution → Section: "Solution"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 2: Display Overview**
|
|
111
|
+
Output a dynamic summary based on the actual PR content:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
📋 Review: {PR Title} (PR #{number})
|
|
115
|
+
|
|
116
|
+
Documents loaded:
|
|
117
|
+
✓ {path_to_primary} ({line_count} lines)
|
|
118
|
+
✓ {path_to_context} ({line_count} lines) [if found]
|
|
119
|
+
|
|
120
|
+
Structure ({count} sections):
|
|
121
|
+
1. {First section name}
|
|
122
|
+
2. {Second section name}
|
|
123
|
+
...
|
|
124
|
+
{N}. {Last section name}
|
|
125
|
+
|
|
126
|
+
What would you like to do?
|
|
127
|
+
- Show me a specific section (e.g., "show me the {example section}")
|
|
128
|
+
- Ask questions about decisions (e.g., "why was X rejected?")
|
|
129
|
+
- Walk through section by section
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Note:** All values are dynamic:
|
|
133
|
+
- PR title comes from `gh pr view`
|
|
134
|
+
- File paths come from what's actually in the PR
|
|
135
|
+
- Section count and names come from parsing the TECH-DESIGN.md H2 headers
|
|
136
|
+
- If thought-doc.md not found, only show the primary document
|
|
137
|
+
|
|
138
|
+
**Example output:**
|
|
139
|
+
```
|
|
140
|
+
📋 Review: Transaction Templates Tech Design (PR #128)
|
|
141
|
+
|
|
142
|
+
Documents loaded:
|
|
143
|
+
✓ projects/transaction-templates/TECH-DESIGN.md (250 lines)
|
|
144
|
+
✓ projects/transaction-templates/artifacts/thought-doc.md (380 lines)
|
|
145
|
+
|
|
146
|
+
Structure (8 sections):
|
|
147
|
+
1. TL;DR
|
|
148
|
+
2. Problem
|
|
149
|
+
3. Scope
|
|
150
|
+
4. Solution
|
|
151
|
+
5. Key Decisions
|
|
152
|
+
6. Risks
|
|
153
|
+
7. Rollout
|
|
154
|
+
8. Implementation Phases
|
|
155
|
+
|
|
156
|
+
What would you like to do?
|
|
157
|
+
- Show me a specific section (e.g., "show me the rollout")
|
|
158
|
+
- Ask questions about decisions (e.g., "why was X rejected?")
|
|
159
|
+
- Walk through section by section
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Step 3: Wait for User Request**
|
|
163
|
+
User can now navigate conversationally.
|
|
164
|
+
|
|
165
|
+
## 3. Conversational Navigation
|
|
166
|
+
|
|
167
|
+
Map user requests to actions:
|
|
168
|
+
|
|
169
|
+
**"Show me {section}"**
|
|
170
|
+
1. Match the section name (see Section Matching below)
|
|
171
|
+
2. Read the Primary file
|
|
172
|
+
3. Extract content between `## {Match}` and the next `## ` header
|
|
173
|
+
4. Display the section content
|
|
174
|
+
|
|
175
|
+
**Section Matching Algorithm:**
|
|
176
|
+
|
|
177
|
+
Use case-insensitive substring matching:
|
|
178
|
+
|
|
179
|
+
1. Normalize user input and section names to lowercase
|
|
180
|
+
2. Check if user input is substring of any section name
|
|
181
|
+
3. If single match: use it
|
|
182
|
+
4. If multiple matches: pick the first one (or ask user to clarify)
|
|
183
|
+
5. If no matches: list available sections
|
|
184
|
+
|
|
185
|
+
**Examples:**
|
|
186
|
+
- User: "show rollout" → matches "Rollout"
|
|
187
|
+
- User: "security" → matches "Security Considerations"
|
|
188
|
+
- User: "risks" → matches "Risks"
|
|
189
|
+
- User: "key decisions" → matches "Key Decisions"
|
|
190
|
+
|
|
191
|
+
**"Walk me through it"**
|
|
192
|
+
1. Start with the first section
|
|
193
|
+
2. Display content
|
|
194
|
+
3. Ask "Continue to {Next Section}?"
|
|
195
|
+
4. Repeat until user stops or end of document
|
|
196
|
+
|
|
197
|
+
**"Jump to {section}"**
|
|
198
|
+
Same as "Show me {section}".
|
|
199
|
+
|
|
200
|
+
## 4. Contextual Search (Thought Docs)
|
|
201
|
+
|
|
202
|
+
**Trigger Detection:**
|
|
203
|
+
|
|
204
|
+
If user query contains any of: "why", "rejected", "alternative", "decision", "reason", "chose", "didn't"
|
|
205
|
+
→ Enter context search mode
|
|
206
|
+
|
|
207
|
+
**Term Extraction:**
|
|
208
|
+
|
|
209
|
+
Extract key phrases from the question:
|
|
210
|
+
- Strip question words: "why was", "why did we", "what about"
|
|
211
|
+
- Extract 2-4 word phrases: "event-based approach", "webhook pattern", "async processing"
|
|
212
|
+
- If user mentions specific terms in quotes, use those exactly
|
|
213
|
+
|
|
214
|
+
**Examples:**
|
|
215
|
+
- "Why was event-based rejected?" → search for "event-based"
|
|
216
|
+
- "Why did we choose sync over async?" → search for "sync" and "async"
|
|
217
|
+
- "What about the webhook approach?" → search for "webhook"
|
|
218
|
+
|
|
219
|
+
**Search Process:**
|
|
220
|
+
|
|
221
|
+
1. Search the **Context** document (e.g., `thought-doc.md`) first:
|
|
222
|
+
```bash
|
|
223
|
+
grep -C 5 -i "{term}" {path_to_context}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
2. Display results with context (5 lines before/after)
|
|
227
|
+
|
|
228
|
+
3. If multiple matches found: show first 3 matches
|
|
229
|
+
|
|
230
|
+
4. If no match in context doc: search Primary document
|
|
231
|
+
|
|
232
|
+
5. If still no match: "No mentions of '{term}' found in design docs"
|
|
233
|
+
|
|
234
|
+
**Display Format:**
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
Searching thought doc for "event-based"...
|
|
238
|
+
|
|
239
|
+
Found in Key Decisions section:
|
|
240
|
+
|
|
241
|
+
> Event-based was rejected because of complexity in guaranteeing
|
|
242
|
+
> order and handling failures. The synchronous API approach is
|
|
243
|
+
> simpler and sufficient for the MVP requirements. We considered
|
|
244
|
+
> event streaming but decided it was premature optimization.
|
|
245
|
+
|
|
246
|
+
Anything else?
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 5. Posting Feedback (MVP: Deferred)
|
|
250
|
+
*For MVP, we just display content. Users can use `gh pr comment` manually if they want, but the tool focuses on reading.*
|