@orderful/droid 0.23.0 → 0.25.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/.eslintrc.json +6 -4
- package/AGENTS.md +58 -0
- package/CHANGELOG.md +44 -0
- package/README.md +11 -6
- package/dist/bin/droid.js +384 -170
- package/dist/commands/config.d.ts +15 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/exec.d.ts +10 -0
- package/dist/commands/exec.d.ts.map +1 -0
- package/dist/commands/tui.d.ts.map +1 -1
- package/dist/index.js +171 -33
- package/dist/lib/migrations.d.ts.map +1 -1
- package/dist/lib/skills.d.ts.map +1 -1
- package/dist/tools/codex/TOOL.yaml +2 -2
- package/dist/tools/codex/agents/codex-document-processor.md +8 -4
- package/dist/tools/codex/commands/codex.md +18 -10
- package/dist/tools/codex/skills/droid-codex/SKILL.md +140 -67
- package/dist/tools/codex/skills/droid-codex/references/creating.md +13 -51
- package/dist/tools/codex/skills/droid-codex/references/decisions.md +15 -19
- package/dist/tools/codex/skills/droid-codex/references/loading.md +49 -13
- package/dist/tools/codex/skills/droid-codex/references/topics.md +14 -12
- package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.d.ts +31 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.d.ts.map +1 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-finish-write.ts +236 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.d.ts +20 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.d.ts.map +1 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-preamble.ts +156 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-scripts.test.ts +364 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.d.ts +23 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.d.ts.map +1 -0
- package/dist/tools/codex/skills/droid-codex/scripts/git-start-write.ts +172 -0
- package/package.json +1 -1
- package/src/bin/droid.ts +9 -0
- package/src/commands/config.ts +38 -4
- package/src/commands/exec.ts +96 -0
- package/src/commands/install.ts +1 -1
- package/src/commands/setup.ts +6 -6
- package/src/commands/tui.tsx +254 -175
- package/src/lib/migrations.ts +103 -10
- package/src/lib/quotes.ts +6 -6
- package/src/lib/skills.ts +168 -45
- package/src/tools/codex/TOOL.yaml +2 -2
- package/src/tools/codex/agents/codex-document-processor.md +8 -4
- package/src/tools/codex/commands/codex.md +18 -10
- package/src/tools/codex/skills/droid-codex/SKILL.md +140 -67
- package/src/tools/codex/skills/droid-codex/references/creating.md +13 -51
- package/src/tools/codex/skills/droid-codex/references/decisions.md +15 -19
- package/src/tools/codex/skills/droid-codex/references/loading.md +49 -13
- package/src/tools/codex/skills/droid-codex/references/topics.md +14 -12
- package/src/tools/codex/skills/droid-codex/scripts/git-finish-write.ts +236 -0
- package/src/tools/codex/skills/droid-codex/scripts/git-preamble.ts +156 -0
- package/src/tools/codex/skills/droid-codex/scripts/git-scripts.test.ts +364 -0
- package/src/tools/codex/skills/droid-codex/scripts/git-start-write.ts +172 -0
|
@@ -35,15 +35,54 @@ If prerequisites fail, guide user to fix:
|
|
|
35
35
|
- Repo missing: `git clone git@github.com:orderful/orderful-codex.git {path}`
|
|
36
36
|
- gh missing: `brew install gh && gh auth login`
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Git Hygiene (CRITICAL)
|
|
39
39
|
|
|
40
|
-
**
|
|
40
|
+
**Users should never see git complexity.** Use the deterministic scripts below - they handle all git operations silently and recover gracefully. Non-engineers use this tool - if they hit a git error, they're stuck.
|
|
41
|
+
|
|
42
|
+
### Scripts
|
|
43
|
+
|
|
44
|
+
The codex skill includes three git scripts. **Always use these instead of raw git commands.**
|
|
45
|
+
|
|
46
|
+
| Script | Purpose | When to use |
|
|
47
|
+
|--------|---------|-------------|
|
|
48
|
+
| `git-preamble` | Ensure clean main + pull latest | Before ANY operation |
|
|
49
|
+
| `git-start-write` | Preamble + create branch | Before write operations |
|
|
50
|
+
| `git-finish-write` | Commit + PR + return to main | After write operations |
|
|
51
|
+
|
|
52
|
+
### Read Operations (search, load, list)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
droid config codex | droid exec droid-codex git-preamble --config -
|
|
56
|
+
# Then proceed with the read
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Write Operations (new, decision, snapshot, artifact)
|
|
41
60
|
|
|
42
61
|
```bash
|
|
43
|
-
|
|
62
|
+
# 1. Start write (runs preamble + creates branch)
|
|
63
|
+
droid config codex | droid exec droid-codex git-start-write --config - --branch codex/{action}-{name}
|
|
64
|
+
|
|
65
|
+
# 2. Make your changes (write files)
|
|
66
|
+
|
|
67
|
+
# 3. Finish write (commit + PR + return to main)
|
|
68
|
+
droid config codex | droid exec droid-codex git-finish-write --config - \
|
|
69
|
+
--message "{commit message}" \
|
|
70
|
+
--pr-title "{PR title}" \
|
|
71
|
+
--pr-body "{PR description}"
|
|
44
72
|
```
|
|
45
73
|
|
|
46
|
-
|
|
74
|
+
The scripts return JSON with success/failure status. Check the result before proceeding.
|
|
75
|
+
|
|
76
|
+
### Error Handling
|
|
77
|
+
|
|
78
|
+
The scripts handle errors internally:
|
|
79
|
+
- Silent recovery for transient issues
|
|
80
|
+
- Clear error messages in JSON output
|
|
81
|
+
- Automatic return to main even on partial failure
|
|
82
|
+
|
|
83
|
+
If a script fails, check the JSON `error` field and report a user-friendly message:
|
|
84
|
+
- "I hit a sync issue with the codex. Let me try again..."
|
|
85
|
+
- Only escalate as last resort: "The codex repo needs manual attention."
|
|
47
86
|
|
|
48
87
|
## Security
|
|
49
88
|
|
|
@@ -102,11 +141,13 @@ fi
|
|
|
102
141
|
|
|
103
142
|
## Categories
|
|
104
143
|
|
|
105
|
-
The codex has
|
|
144
|
+
The codex has five categories:
|
|
106
145
|
|
|
107
146
|
| Category | Path | Purpose |
|
|
108
147
|
|----------|------|---------|
|
|
109
148
|
| `projects` | `{codex_repo}/projects/` | Feature/project context (PRD, tech design, decisions) |
|
|
149
|
+
| `domains` | `{codex_repo}/domains/` | Business domain knowledge - the "what" and "why" |
|
|
150
|
+
| `proposals` | `{codex_repo}/proposals/` | Ideas and future direction - not yet committed |
|
|
110
151
|
| `patterns` | `{codex_repo}/patterns/` | Cross-cutting technical patterns |
|
|
111
152
|
| `topics` | `{codex_repo}/topics/` | Explored codebase areas with freshness tracking |
|
|
112
153
|
|
|
@@ -116,15 +157,21 @@ The codex has three categories:
|
|
|
116
157
|
|---------|--------|
|
|
117
158
|
| `/codex` | Show categories overview |
|
|
118
159
|
| `/codex projects` | List all projects |
|
|
160
|
+
| `/codex domains` | List all domains |
|
|
161
|
+
| `/codex proposals` | List all proposals |
|
|
119
162
|
| `/codex patterns` | List all patterns |
|
|
120
163
|
| `/codex topics` | List all topics |
|
|
121
164
|
| `/codex {name}` | Load entry (searches all categories) |
|
|
122
165
|
| `/codex search {query}` | Search across everything |
|
|
123
|
-
| `/codex new {name}` | Scaffold new project
|
|
166
|
+
| `/codex new {name}` | Scaffold new project (shorthand) |
|
|
167
|
+
| `/codex new project {name}` | Scaffold new project from templates |
|
|
168
|
+
| `/codex new domain {name}` | Scaffold new domain entry |
|
|
169
|
+
| `/codex new proposal {name}` | Scaffold new proposal entry |
|
|
170
|
+
| `/codex new pattern {name}` | Scaffold new pattern entry |
|
|
171
|
+
| `/codex new topic {name}` | Scaffold new topic entry |
|
|
124
172
|
| `/codex decision {text}` | Append to active project's DECISIONS.md |
|
|
125
173
|
| `/codex snapshot {type} {file} {name}` | Import PDF/markdown to codex (uses agent) |
|
|
126
174
|
| `/codex artifact {file} {project}` | Add supporting artifact to project (uses agent) |
|
|
127
|
-
| `/codex add topic {name}` | Add explored topic with freshness metadata |
|
|
128
175
|
|
|
129
176
|
## Loading an Entry
|
|
130
177
|
|
|
@@ -132,12 +179,15 @@ The codex has three categories:
|
|
|
132
179
|
|
|
133
180
|
**Procedure:**
|
|
134
181
|
|
|
135
|
-
1.
|
|
136
|
-
2.
|
|
137
|
-
3. If
|
|
138
|
-
4.
|
|
139
|
-
5.
|
|
140
|
-
6.
|
|
182
|
+
1. **Read `{codex_repo}/index.yaml`** - this contains all entry names and aliases for fast lookup
|
|
183
|
+
2. Match `{name}` against index keys and aliases (case-insensitive, partial match)
|
|
184
|
+
3. If multiple matches → show list, let user pick
|
|
185
|
+
4. If single match → load directly from the matched path
|
|
186
|
+
5. For projects with multiple files → show file list, let user pick which to load
|
|
187
|
+
6. Check freshness (see below)
|
|
188
|
+
7. Output loaded content
|
|
189
|
+
|
|
190
|
+
**Why index?** Avoids expensive file-by-file searching. One read to find any entry by name or alias.
|
|
141
191
|
|
|
142
192
|
**If no CONTEXT.md exists for a project:**
|
|
143
193
|
- Synthesise unified context from PRD.md + TECH-DESIGN.md + DECISIONS.md
|
|
@@ -153,7 +203,7 @@ All codex files have frontmatter:
|
|
|
153
203
|
```yaml
|
|
154
204
|
---
|
|
155
205
|
title: Feature Name
|
|
156
|
-
type: prd | tech-design | context | decisions | pattern | topic
|
|
206
|
+
type: prd | tech-design | context | decisions | pattern | topic | domain | proposal
|
|
157
207
|
status: draft | active | complete | archived
|
|
158
208
|
created: 2026-01-07
|
|
159
209
|
updated: 2026-01-07
|
|
@@ -164,14 +214,12 @@ codebase_paths:
|
|
|
164
214
|
---
|
|
165
215
|
```
|
|
166
216
|
|
|
167
|
-
**Status values:**
|
|
217
|
+
**Status values (unified across all categories):**
|
|
168
218
|
- `draft` - Initial capture, not ready for consumption
|
|
169
219
|
- `active` - Current, being used for implementation
|
|
170
220
|
- `complete` - Project shipped, kept for reference
|
|
171
221
|
- `archived` - No longer relevant, kept for history
|
|
172
222
|
|
|
173
|
-
Note: Topics use `draft | active | archived` (no "complete"). Patterns use `active | archived` (no draft phase).
|
|
174
|
-
|
|
175
223
|
**When loading any file:**
|
|
176
224
|
|
|
177
225
|
1. Parse frontmatter for `updated` date
|
|
@@ -199,36 +247,24 @@ Scoped operations (`decision`, `snapshot`) require an active project:
|
|
|
199
247
|
**Procedure:**
|
|
200
248
|
|
|
201
249
|
1. Verify active project exists (if not, prompt to select)
|
|
202
|
-
2.
|
|
203
|
-
3.
|
|
204
|
-
```markdown
|
|
205
|
-
## {YYYY-MM-DD}: {Decision summary from text}
|
|
206
|
-
|
|
207
|
-
**Context:** {Extract from conversation}
|
|
208
|
-
|
|
209
|
-
**Decision:** {The decision}
|
|
210
|
-
|
|
211
|
-
**Rationale:** {Why this choice}
|
|
212
|
-
```
|
|
250
|
+
2. **Run `git-start-write`** with branch `codex/decision-{short-summary}`
|
|
251
|
+
3. Read and append to `{codex_repo}/projects/{active}/DECISIONS.md`
|
|
213
252
|
4. Update `updated` date in frontmatter
|
|
214
|
-
5.
|
|
253
|
+
5. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
215
254
|
|
|
216
255
|
Full procedure: `references/decisions.md`
|
|
217
256
|
|
|
218
257
|
## Adding Topics
|
|
219
258
|
|
|
220
|
-
**Trigger:** `/codex
|
|
259
|
+
**Trigger:** `/codex new topic {name}` or user wants to save exploration
|
|
221
260
|
|
|
222
261
|
**Procedure:**
|
|
223
262
|
|
|
224
|
-
1.
|
|
225
|
-
2.
|
|
226
|
-
3. Fill in frontmatter
|
|
227
|
-
- `explored`: today's date
|
|
228
|
-
- `confidence`: ask user or infer from exploration depth
|
|
229
|
-
- `codebase_paths`: paths that were explored
|
|
263
|
+
1. **Run `git-start-write`** with branch `codex/topic-{name}`
|
|
264
|
+
2. Create `{codex_repo}/topics/{name}.md` from template
|
|
265
|
+
3. Fill in frontmatter (explored, confidence, codebase_paths)
|
|
230
266
|
4. Fill in content from current exploration/conversation
|
|
231
|
-
5.
|
|
267
|
+
5. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
232
268
|
|
|
233
269
|
Full procedure: `references/topics.md`
|
|
234
270
|
|
|
@@ -241,21 +277,15 @@ Full procedure: `references/topics.md`
|
|
|
241
277
|
**Procedure:**
|
|
242
278
|
|
|
243
279
|
1. Determine the document type (required): `prd`, `tech-design`, `topic`, or `pattern`
|
|
244
|
-
2.
|
|
280
|
+
2. **Run `git-start-write`** with branch `codex/snapshot-{name}`
|
|
281
|
+
3. Spawn the `codex-document-processor` agent with:
|
|
245
282
|
- File path to the source document
|
|
246
283
|
- Document type
|
|
247
284
|
- Project/entry name
|
|
248
285
|
- Codex repo path from config
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
- Writes to correct location in codex repo
|
|
253
|
-
- Returns file path and summary
|
|
254
|
-
4. **Back in main conversation:** Handle git workflow
|
|
255
|
-
- Create branch: `codex/snapshot-{name}`
|
|
256
|
-
- Commit the new file
|
|
257
|
-
- Push and create PR via `gh pr create`
|
|
258
|
-
5. Share PR link with user
|
|
286
|
+
4. Agent writes the processed document to codex repo
|
|
287
|
+
5. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
288
|
+
6. Share PR link with user
|
|
259
289
|
|
|
260
290
|
**Example invocations:**
|
|
261
291
|
|
|
@@ -284,9 +314,10 @@ Artifacts are supplementary documents that support a project but aren't core doc
|
|
|
284
314
|
|
|
285
315
|
**Procedure:**
|
|
286
316
|
|
|
287
|
-
1.
|
|
288
|
-
2.
|
|
289
|
-
3.
|
|
317
|
+
1. **Run `git-start-write`** with branch `codex/artifact-{project}-{filename}`
|
|
318
|
+
2. Use the `codex-document-processor` agent with type `artifact`
|
|
319
|
+
3. Agent writes to `{codex_repo}/projects/{project}/artifacts/{filename}.md`
|
|
320
|
+
4. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
290
321
|
|
|
291
322
|
**Example invocations:**
|
|
292
323
|
|
|
@@ -297,19 +328,63 @@ Artifacts are supplementary documents that support a project but aren't core doc
|
|
|
297
328
|
|
|
298
329
|
Artifacts get lighter frontmatter with `type: artifact` and source like `interview`, `transcript`, `notes`, `meeting`, `research`, `spike`, or `analysis`.
|
|
299
330
|
|
|
300
|
-
## Creating New
|
|
331
|
+
## Creating New Entries
|
|
301
332
|
|
|
302
|
-
|
|
333
|
+
The `/codex new` command scaffolds new entries from templates:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
/codex new {name} # Shorthand for new project
|
|
337
|
+
/codex new project {name} # Explicit project creation
|
|
338
|
+
/codex new domain {name} # New domain entry
|
|
339
|
+
/codex new proposal {name} # New proposal entry
|
|
340
|
+
/codex new pattern {name} # New pattern entry
|
|
341
|
+
/codex new topic {name} # New topic entry
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Projects
|
|
345
|
+
|
|
346
|
+
**Trigger:** `/codex new {name}` or `/codex new project {name}`
|
|
347
|
+
|
|
348
|
+
**Procedure:**
|
|
349
|
+
|
|
350
|
+
1. **Run `git-start-write`** with branch `codex/new-{name}`
|
|
351
|
+
2. Create `{codex_repo}/projects/{name}/`
|
|
352
|
+
3. Copy templates: PRD.md, TECH-DESIGN.md, DECISIONS.md
|
|
353
|
+
4. Fill in frontmatter with today's date
|
|
354
|
+
5. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
355
|
+
|
|
356
|
+
### Domains
|
|
357
|
+
|
|
358
|
+
**Trigger:** `/codex new domain {name}`
|
|
303
359
|
|
|
304
360
|
**Procedure:**
|
|
305
361
|
|
|
306
|
-
1.
|
|
307
|
-
2.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
362
|
+
1. **Run `git-start-write`** with branch `codex/domain-{name}`
|
|
363
|
+
2. Create `{codex_repo}/domains/{name}.md` from template
|
|
364
|
+
3. Fill in frontmatter, guide user through sections
|
|
365
|
+
4. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
366
|
+
|
|
367
|
+
### Proposals
|
|
368
|
+
|
|
369
|
+
**Trigger:** `/codex new proposal {name}`
|
|
370
|
+
|
|
371
|
+
**Procedure:**
|
|
372
|
+
|
|
373
|
+
1. **Run `git-start-write`** with branch `codex/proposal-{name}`
|
|
374
|
+
2. Create `{codex_repo}/proposals/{name}.md` from template
|
|
375
|
+
3. Fill in frontmatter, guide user through sections
|
|
376
|
+
4. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
377
|
+
|
|
378
|
+
### Patterns and Topics
|
|
379
|
+
|
|
380
|
+
**Trigger:** `/codex new pattern {name}` or `/codex new topic {name}`
|
|
381
|
+
|
|
382
|
+
**Procedure:**
|
|
383
|
+
|
|
384
|
+
1. **Run `git-start-write`** with branch `codex/{pattern|topic}-{name}`
|
|
385
|
+
2. Create file from template
|
|
311
386
|
3. Fill in frontmatter with today's date
|
|
312
|
-
4.
|
|
387
|
+
4. **Run `git-finish-write`** with appropriate commit message and PR title
|
|
313
388
|
|
|
314
389
|
Full procedure: `references/creating.md`
|
|
315
390
|
|
|
@@ -330,12 +405,10 @@ When user runs `/project create --from codex:{name}`:
|
|
|
330
405
|
|
|
331
406
|
## Git Workflow
|
|
332
407
|
|
|
333
|
-
**All codex changes
|
|
334
|
-
|
|
335
|
-
1. Create branch: `codex/{action}-{name}` (e.g., `codex/decision-uuid-format`)
|
|
336
|
-
2. Make changes
|
|
337
|
-
3. Commit with descriptive message
|
|
338
|
-
4. Push and create PR via `gh pr create`
|
|
339
|
-
5. Share PR link with user
|
|
408
|
+
**See "Git Hygiene (CRITICAL)" section above.** All codex changes go through PRs (main branch is protected).
|
|
340
409
|
|
|
341
|
-
|
|
410
|
+
**Key points:**
|
|
411
|
+
- Always run the preamble before any operation (ensures clean main + latest)
|
|
412
|
+
- Write operations: branch → commit → PR → **return to main**
|
|
413
|
+
- Safe changes (new files, decision appends) auto-merge via GitHub Action
|
|
414
|
+
- Never leave the repo on a feature branch
|
|
@@ -28,15 +28,18 @@ A project named '{name}' already exists. Did you mean to load it?
|
|
|
28
28
|
→ /codex {name}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
### 3.
|
|
31
|
+
### 3. Start Write Operation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
|
|
34
|
+
droid config codex | droid exec droid-codex git-start-write --config - --branch codex/new-{name}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
This runs the git preamble (ensures clean main + pulls latest) and creates the branch.
|
|
38
|
+
|
|
39
|
+
### 4. Create Project Directory and Copy Templates
|
|
38
40
|
|
|
39
41
|
```bash
|
|
42
|
+
mkdir -p {codex_repo}/projects/{name}
|
|
40
43
|
cp {codex_repo}/templates/PRD.md {codex_repo}/projects/{name}/
|
|
41
44
|
cp {codex_repo}/templates/TECH-DESIGN.md {codex_repo}/projects/{name}/
|
|
42
45
|
cp {codex_repo}/templates/DECISIONS.md {codex_repo}/projects/{name}/
|
|
@@ -56,19 +59,17 @@ If user provides context, fill in what we know:
|
|
|
56
59
|
- TECH-DESIGN.md: Any architectural decisions mentioned
|
|
57
60
|
- DECISIONS.md: Leave as template (decisions come during impl)
|
|
58
61
|
|
|
59
|
-
### 7.
|
|
62
|
+
### 7. Finish Write Operation
|
|
60
63
|
|
|
61
64
|
```bash
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
feat(codex): scaffold {name} project
|
|
67
|
-
EOF
|
|
68
|
-
git push -u origin codex/new-{name}
|
|
69
|
-
gh pr create --title "New project: {name}" --body "Scaffold for {name} project"
|
|
65
|
+
droid config codex | droid exec droid-codex git-finish-write --config - \
|
|
66
|
+
--message "feat(codex): scaffold {name} project" \
|
|
67
|
+
--pr-title "New project: {name}" \
|
|
68
|
+
--pr-body "Scaffold for {name} project"
|
|
70
69
|
```
|
|
71
70
|
|
|
71
|
+
This commits, pushes, creates PR, and returns to main.
|
|
72
|
+
|
|
72
73
|
### 8. Confirm to User
|
|
73
74
|
|
|
74
75
|
```
|
|
@@ -109,42 +110,3 @@ Next steps:
|
|
|
109
110
|
|
|
110
111
|
Want me to help fill in any of these based on what we've discussed?
|
|
111
112
|
```
|
|
112
|
-
|
|
113
|
-
## With Pre-Existing Context
|
|
114
|
-
|
|
115
|
-
If the user has already discussed the feature:
|
|
116
|
-
|
|
117
|
-
**User:** "We're building audit logging to track all API changes for compliance. It'll use an event sourcing pattern."
|
|
118
|
-
|
|
119
|
-
**User:** `/codex new audit-logging`
|
|
120
|
-
|
|
121
|
-
**Result:** (PRD.md pre-filled with discussed context)
|
|
122
|
-
|
|
123
|
-
```markdown
|
|
124
|
-
---
|
|
125
|
-
title: Audit Logging
|
|
126
|
-
type: prd
|
|
127
|
-
created: 2026-01-07
|
|
128
|
-
updated: 2026-01-07
|
|
129
|
-
confidence: medium
|
|
130
|
-
source: implementation
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
# Audit Logging - PRD
|
|
134
|
-
|
|
135
|
-
## Problem Statement
|
|
136
|
-
|
|
137
|
-
Need to track all API changes for compliance requirements.
|
|
138
|
-
|
|
139
|
-
## Goals
|
|
140
|
-
|
|
141
|
-
- Track all API changes
|
|
142
|
-
- Support compliance auditing
|
|
143
|
-
- {More goals to be defined}
|
|
144
|
-
|
|
145
|
-
## Non-Goals
|
|
146
|
-
|
|
147
|
-
- {To be defined}
|
|
148
|
-
|
|
149
|
-
...
|
|
150
|
-
```
|
|
@@ -39,15 +39,19 @@ I'll add this decision. Can you clarify:
|
|
|
39
39
|
- Were there alternatives you considered?
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
### 3.
|
|
42
|
+
### 3. Start Write Operation
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
|
|
45
|
+
droid config codex | droid exec droid-codex git-start-write --config - --branch codex/decision-{short-summary}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
### 4.
|
|
48
|
+
### 4. Read and Update DECISIONS.md
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cat {codex_repo}/projects/{active}/DECISIONS.md
|
|
52
|
+
```
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
Append new decision at the end:
|
|
51
55
|
|
|
52
56
|
```markdown
|
|
53
57
|
---
|
|
@@ -68,26 +72,18 @@ Add at the end, before the template marker:
|
|
|
68
72
|
- {Expected outcomes, trade-offs}
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Update the `updated` field to today's date.
|
|
75
|
+
Update the `updated` field in frontmatter to today's date.
|
|
74
76
|
|
|
75
|
-
###
|
|
77
|
+
### 5. Finish Write Operation
|
|
76
78
|
|
|
77
79
|
```bash
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
decision({active}): {summary}
|
|
83
|
-
EOF
|
|
84
|
-
git push -u origin codex/decision-{short-summary}
|
|
85
|
-
gh pr create --title "Decision: {summary}" --body-file - <<EOF
|
|
86
|
-
{full decision text}
|
|
87
|
-
EOF
|
|
80
|
+
droid config codex | droid exec droid-codex git-finish-write --config - \
|
|
81
|
+
--message "decision({active}): {summary}" \
|
|
82
|
+
--pr-title "Decision: {summary}" \
|
|
83
|
+
--pr-body "{full decision text}"
|
|
88
84
|
```
|
|
89
85
|
|
|
90
|
-
###
|
|
86
|
+
### 6. Confirm to User
|
|
91
87
|
|
|
92
88
|
```
|
|
93
89
|
✅ Added decision to {active}/DECISIONS.md:
|
|
@@ -4,23 +4,44 @@ Detailed procedure for loading entries from the codex.
|
|
|
4
4
|
|
|
5
5
|
## Search and Match
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
2. **Search all categories** for `{name}`:
|
|
9
|
-
```bash
|
|
10
|
-
# Search projects
|
|
11
|
-
ls {codex_repo}/projects/ | grep -i {name}
|
|
12
|
-
|
|
13
|
-
# Search patterns
|
|
14
|
-
ls {codex_repo}/patterns/ | grep -i {name}
|
|
7
|
+
**IMPORTANT:** Use the index file for fast lookups. This avoids expensive file-by-file searching.
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
1. **Get codex repo path** from `~/.droid/skills/codex/overrides.yaml`
|
|
10
|
+
2. **Read the index file** at `{codex_repo}/index.yaml`:
|
|
11
|
+
```yaml
|
|
12
|
+
# index.yaml structure
|
|
13
|
+
projects:
|
|
14
|
+
partnership-automation:
|
|
15
|
+
title: "Partnership Automation & Sample Transaction Engine"
|
|
16
|
+
aliases: ["transaction-templates", "template-transactions"]
|
|
17
|
+
patterns:
|
|
18
|
+
jsdoc-config-directives:
|
|
19
|
+
title: "JSDoc @config Directives"
|
|
20
|
+
aliases: ["config-directives", "comment-directives"]
|
|
21
|
+
topics:
|
|
22
|
+
handlebars-template-security:
|
|
23
|
+
title: "Handlebars Template Security"
|
|
24
|
+
aliases: []
|
|
25
|
+
domains: {}
|
|
26
|
+
proposals: {}
|
|
18
27
|
```
|
|
19
|
-
3. **
|
|
20
|
-
-
|
|
21
|
-
-
|
|
28
|
+
3. **Match `{name}` against the index:**
|
|
29
|
+
- Check each entry's key (folder/file name)
|
|
30
|
+
- Check each entry's `aliases` array
|
|
31
|
+
- Match is case-insensitive and supports partial matching
|
|
32
|
+
- Example: "template transactions" matches `partnership-automation` via alias "template-transactions"
|
|
33
|
+
4. **Handle matches:**
|
|
34
|
+
- No matches → "No codex entry found for '{name}'. Did you mean one of these?" + suggest entries from index
|
|
35
|
+
- Single match → proceed to load from the matched category/path
|
|
22
36
|
- Multiple matches → show list with category, let user pick
|
|
23
37
|
|
|
38
|
+
**Fallback:** If `index.yaml` doesn't exist, fall back to directory scanning:
|
|
39
|
+
```bash
|
|
40
|
+
ls {codex_repo}/projects/ | grep -i {name}
|
|
41
|
+
ls {codex_repo}/domains/ | grep -i {name}
|
|
42
|
+
# ... etc
|
|
43
|
+
```
|
|
44
|
+
|
|
24
45
|
## Loading a Project
|
|
25
46
|
|
|
26
47
|
Projects are folders with multiple files:
|
|
@@ -50,6 +71,21 @@ projects/transaction-templates/
|
|
|
50
71
|
4. Set project as **active** for scoped operations
|
|
51
72
|
5. Check freshness (see below)
|
|
52
73
|
|
|
74
|
+
## Loading a Domain or Proposal
|
|
75
|
+
|
|
76
|
+
Domains and proposals are single files:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
domains/partnerships.md
|
|
80
|
+
proposals/caching-layer.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Procedure:**
|
|
84
|
+
|
|
85
|
+
1. Read the file
|
|
86
|
+
2. Check freshness
|
|
87
|
+
3. Output content
|
|
88
|
+
|
|
53
89
|
## Loading a Pattern or Topic
|
|
54
90
|
|
|
55
91
|
Patterns and topics are single files:
|
|
@@ -43,13 +43,19 @@ Ask user or infer:
|
|
|
43
43
|
- `low` - Quick exploration, definitely incomplete
|
|
44
44
|
- **Codebase paths:** Which directories/files were explored?
|
|
45
45
|
|
|
46
|
-
### 4.
|
|
46
|
+
### 4. Start Write Operation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
droid config codex | droid exec droid-codex git-start-write --config - --branch codex/topic-{name}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 5. Read Template
|
|
47
53
|
|
|
48
54
|
```bash
|
|
49
55
|
cat {codex_repo}/templates/TOPIC.md
|
|
50
56
|
```
|
|
51
57
|
|
|
52
|
-
###
|
|
58
|
+
### 6. Create Topic File
|
|
53
59
|
|
|
54
60
|
```bash
|
|
55
61
|
# Create the file
|
|
@@ -115,20 +121,16 @@ codebase_paths:
|
|
|
115
121
|
- {Links to related topics, PRDs, or external docs}
|
|
116
122
|
```
|
|
117
123
|
|
|
118
|
-
###
|
|
124
|
+
### 7. Finish Write Operation
|
|
119
125
|
|
|
120
126
|
```bash
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
topic: add {name}
|
|
126
|
-
EOF
|
|
127
|
-
git push -u origin codex/topic-{name}
|
|
128
|
-
gh pr create --title "Topic: {name}" --body "New topic from codebase exploration"
|
|
127
|
+
droid config codex | droid exec droid-codex git-finish-write --config - \
|
|
128
|
+
--message "topic: add {name}" \
|
|
129
|
+
--pr-title "Topic: {name}" \
|
|
130
|
+
--pr-body "New topic from codebase exploration"
|
|
129
131
|
```
|
|
130
132
|
|
|
131
|
-
###
|
|
133
|
+
### 8. Confirm to User
|
|
132
134
|
|
|
133
135
|
```
|
|
134
136
|
✅ Added topic: {name}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* codex git-finish-write
|
|
4
|
+
*
|
|
5
|
+
* Completes a write operation by committing, pushing, creating a PR,
|
|
6
|
+
* and returning to main.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* droid config codex | droid exec droid-codex git-finish-write --config - \
|
|
10
|
+
* --message "feat: add new topic" \
|
|
11
|
+
* --pr-title "New topic: caching" \
|
|
12
|
+
* --pr-body "Added exploration of caching patterns"
|
|
13
|
+
*
|
|
14
|
+
* Options:
|
|
15
|
+
* --config <json> Config with codex_repo path (required)
|
|
16
|
+
* --message <text> Commit message (required)
|
|
17
|
+
* --pr-title <text> PR title (required)
|
|
18
|
+
* --pr-body <text> PR body (optional, defaults to commit message)
|
|
19
|
+
*
|
|
20
|
+
* What it does:
|
|
21
|
+
* 1. Stage all changes
|
|
22
|
+
* 2. Commit with message
|
|
23
|
+
* 3. Push branch to origin
|
|
24
|
+
* 4. Create PR via gh CLI
|
|
25
|
+
* 5. Return to main branch
|
|
26
|
+
*
|
|
27
|
+
* Output (JSON):
|
|
28
|
+
* { "success": true, "pr_url": "https://github.com/...", "branch": "codex/topic-caching" }
|
|
29
|
+
*/
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=git-finish-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-finish-write.d.ts","sourceRoot":"","sources":["../../../../../../src/tools/codex/skills/droid-codex/scripts/git-finish-write.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG"}
|