@orderful/droid 0.18.0 → 0.20.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 (41) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/bin/droid.js +189 -82
  3. package/dist/index.js +175 -72
  4. package/dist/lib/config.d.ts.map +1 -1
  5. package/dist/lib/migrations.d.ts +30 -0
  6. package/dist/lib/migrations.d.ts.map +1 -0
  7. package/dist/lib/skill-config.d.ts.map +1 -1
  8. package/dist/lib/skills.d.ts.map +1 -1
  9. package/dist/lib/types.d.ts +10 -0
  10. package/dist/lib/types.d.ts.map +1 -1
  11. package/dist/tools/brain/TOOL.yaml +1 -1
  12. package/dist/tools/coach/TOOL.yaml +1 -1
  13. package/dist/tools/codex/TOOL.yaml +32 -0
  14. package/dist/tools/codex/commands/codex.md +70 -0
  15. package/dist/tools/codex/skills/droid-codex/SKILL.md +266 -0
  16. package/dist/tools/codex/skills/droid-codex/references/creating.md +150 -0
  17. package/dist/tools/codex/skills/droid-codex/references/decisions.md +128 -0
  18. package/dist/tools/codex/skills/droid-codex/references/loading.md +163 -0
  19. package/dist/tools/codex/skills/droid-codex/references/topics.md +213 -0
  20. package/dist/tools/comments/TOOL.yaml +1 -1
  21. package/dist/tools/droid/skills/droid/SKILL.md +8 -0
  22. package/dist/tools/project/TOOL.yaml +1 -1
  23. package/package.json +1 -1
  24. package/src/lib/config.ts +13 -2
  25. package/src/lib/migrations.test.ts +163 -0
  26. package/src/lib/migrations.ts +182 -0
  27. package/src/lib/skill-config.ts +3 -1
  28. package/src/lib/skills.ts +10 -1
  29. package/src/lib/types.ts +11 -0
  30. package/src/tools/brain/TOOL.yaml +1 -1
  31. package/src/tools/coach/TOOL.yaml +1 -1
  32. package/src/tools/codex/TOOL.yaml +32 -0
  33. package/src/tools/codex/commands/codex.md +70 -0
  34. package/src/tools/codex/skills/droid-codex/SKILL.md +266 -0
  35. package/src/tools/codex/skills/droid-codex/references/creating.md +150 -0
  36. package/src/tools/codex/skills/droid-codex/references/decisions.md +128 -0
  37. package/src/tools/codex/skills/droid-codex/references/loading.md +163 -0
  38. package/src/tools/codex/skills/droid-codex/references/topics.md +213 -0
  39. package/src/tools/comments/TOOL.yaml +1 -1
  40. package/src/tools/droid/skills/droid/SKILL.md +8 -0
  41. package/src/tools/project/TOOL.yaml +1 -1
@@ -0,0 +1,163 @@
1
+ # Loading Codex Entries
2
+
3
+ Detailed procedure for loading entries from the codex.
4
+
5
+ ## Search and Match
6
+
7
+ 1. **Get codex repo path** from `~/.droid/skills/codex/overrides.yaml`
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}
15
+
16
+ # Search topics
17
+ ls {codex_repo}/topics/ | grep -i {name}
18
+ ```
19
+ 3. **Handle matches:**
20
+ - No matches → "No codex entry found for '{name}'. Did you mean one of these?" + list recent entries
21
+ - Single match → proceed to load
22
+ - Multiple matches → show list with category, let user pick
23
+
24
+ ## Loading a Project
25
+
26
+ Projects are folders with multiple files:
27
+
28
+ ```
29
+ projects/transaction-templates/
30
+ ├── PRD.md
31
+ ├── TECH-DESIGN.md
32
+ ├── DESIGN.md # Optional
33
+ ├── CONTEXT.md # Optional, auto-generated
34
+ └── DECISIONS.md
35
+ ```
36
+
37
+ **Procedure:**
38
+
39
+ 1. List files in project folder
40
+ 2. Show file list to user:
41
+ ```
42
+ Found transaction-templates with:
43
+ - PRD.md (updated 2026-01-05)
44
+ - TECH-DESIGN.md (updated 2026-01-03)
45
+ - DECISIONS.md (updated 2026-01-07)
46
+
47
+ Which files should I load? (or 'all' for everything)
48
+ ```
49
+ 3. Load selected file(s)
50
+ 4. Set project as **active** for scoped operations
51
+ 5. Check freshness (see below)
52
+
53
+ ## Loading a Pattern or Topic
54
+
55
+ Patterns and topics are single files:
56
+
57
+ ```
58
+ patterns/api-design.md
59
+ topics/organization-hierarchy.md
60
+ ```
61
+
62
+ **Procedure:**
63
+
64
+ 1. Read the file
65
+ 2. Check freshness
66
+ 3. Output content
67
+
68
+ ## Auto-Generating CONTEXT.md
69
+
70
+ If loading a project and no CONTEXT.md exists:
71
+
72
+ 1. **Inform user:** "No CONTEXT.md found. I'll synthesise one from the available artifacts."
73
+ 2. **Read all available files:** PRD.md, TECH-DESIGN.md, DECISIONS.md
74
+ 3. **Generate unified summary:**
75
+ ```markdown
76
+ ---
77
+ title: {Project Name}
78
+ type: context
79
+ created: {today}
80
+ updated: {today}
81
+ confidence: high
82
+ source: implementation
83
+ ---
84
+
85
+ # {Project Name} - Context
86
+
87
+ ## Overview
88
+ {Synthesised from PRD problem statement + goals}
89
+
90
+ ## Technical Approach
91
+ {Synthesised from TECH-DESIGN architecture + key decisions}
92
+
93
+ ## Key Decisions
94
+ {Summarised from DECISIONS.md}
95
+
96
+ ## Current Status
97
+ {Inferred from most recent updates}
98
+
99
+ ---
100
+ *Auto-generated from PRD.md, TECH-DESIGN.md, and DECISIONS.md*
101
+ ```
102
+ 4. **Create PR:**
103
+ ```bash
104
+ cd {codex_repo}
105
+ git checkout -b auto/context-{project-name}
106
+ # Write CONTEXT.md
107
+ git add projects/{project}/CONTEXT.md
108
+ git commit -F - <<EOF
109
+ feat: auto-generate CONTEXT.md for {project}
110
+ EOF
111
+ git push -u origin auto/context-{project-name}
112
+ gh pr create --title "Auto-generated CONTEXT.md for {project}" --body "Synthesised from PRD, TECH-DESIGN, and DECISIONS."
113
+ ```
114
+ 5. **Inform user:** "Created PR #{number} with auto-generated CONTEXT.md"
115
+
116
+ ## Freshness Checking
117
+
118
+ After loading any file:
119
+
120
+ 1. **Parse frontmatter** for `updated` date
121
+ 2. **Calculate age:**
122
+ ```
123
+ days_old = today - updated
124
+ ```
125
+ 3. **Check against threshold** (`freshness_days` from config, default 30):
126
+ - If `days_old > freshness_days`:
127
+ ```
128
+ ⚠️ This doc was last updated {updated} ({days_old} days ago).
129
+ Want me to verify it's still accurate?
130
+ ```
131
+ 4. **Check codebase changes** (if `codebase_paths` present):
132
+ ```bash
133
+ cd {workspace}
134
+ git log --oneline --since="{updated}" -- {codebase_paths}
135
+ ```
136
+ - If commits found:
137
+ ```
138
+ ⚠️ Files in {paths} have changed since this doc was updated.
139
+ Recent commits: {list}
140
+ Want me to review for needed updates?
141
+ ```
142
+ 5. **Note confidence** (if `confidence: low`):
143
+ ```
144
+ ℹ️ This was a quick exploration and may be incomplete.
145
+ ```
146
+
147
+ ## Output Format
148
+
149
+ After loading, output:
150
+
151
+ ```
152
+ 📚 Loaded: {category}/{name}
153
+ Updated: {updated} ({days_old} days ago)
154
+ Confidence: {confidence}
155
+
156
+ ---
157
+
158
+ {file content}
159
+
160
+ ---
161
+
162
+ {freshness warnings if any}
163
+ ```
@@ -0,0 +1,213 @@
1
+ # Adding Topics
2
+
3
+ Detailed procedure for capturing explored codebase areas as institutional knowledge.
4
+
5
+ ## When to Use
6
+
7
+ - After a deep exploration of a codebase area
8
+ - User asks to save/capture exploration
9
+ - `/codex add topic {name}` command
10
+ - Converting ad-hoc research into persistent knowledge
11
+
12
+ ## The Value
13
+
14
+ Topics turn ephemeral exploration into institutional memory:
15
+ - Next time someone needs to understand this area, context is ready
16
+ - AI can load it instantly instead of re-exploring
17
+ - Freshness tracking ensures it stays current
18
+
19
+ ## Procedure
20
+
21
+ ### 1. Determine Topic Name
22
+
23
+ From user input or infer from exploration:
24
+ - Use kebab-case: `organization-hierarchy`, `webhook-processing`
25
+ - Be specific but concise
26
+
27
+ ### 2. Gather Content
28
+
29
+ From the current conversation/exploration, extract:
30
+ - **Overview:** What is this area of the codebase?
31
+ - **Key Concepts:** Important terms, patterns, relationships
32
+ - **Architecture:** How components fit together
33
+ - **Key Files:** Important files and their purposes
34
+ - **Common Patterns:** Recurring patterns in this area
35
+ - **Gotchas:** Things to watch out for
36
+
37
+ ### 3. Determine Metadata
38
+
39
+ Ask user or infer:
40
+ - **Confidence:** How thorough was the exploration?
41
+ - `high` - Comprehensive, covered most aspects
42
+ - `medium` - Good coverage but may have gaps
43
+ - `low` - Quick exploration, definitely incomplete
44
+ - **Codebase paths:** Which directories/files were explored?
45
+
46
+ ### 4. Read Template
47
+
48
+ ```bash
49
+ cat {codex_repo}/templates/TOPIC.md
50
+ ```
51
+
52
+ ### 5. Create Topic File
53
+
54
+ ```bash
55
+ # Create the file
56
+ touch {codex_repo}/topics/{name}.md
57
+ ```
58
+
59
+ Fill in content:
60
+
61
+ ```markdown
62
+ ---
63
+ title: {Topic Title}
64
+ type: topic
65
+ created: {today}
66
+ updated: {today}
67
+ confidence: {high|medium|low}
68
+ source: exploration
69
+ codebase_paths:
70
+ - {path/explored/1}
71
+ - {path/explored/2}
72
+ ---
73
+
74
+ # {Topic Title}
75
+
76
+ ## Overview
77
+
78
+ {Brief description of this area of the codebase}
79
+
80
+ ## Key Concepts
81
+
82
+ ### {Concept 1}
83
+
84
+ {Explanation}
85
+
86
+ ### {Concept 2}
87
+
88
+ {Explanation}
89
+
90
+ ## Architecture
91
+
92
+ {How components fit together}
93
+
94
+ ```
95
+ {Diagram or structure if helpful}
96
+ ```
97
+
98
+ ## Key Files
99
+
100
+ | File | Purpose |
101
+ |------|---------|
102
+ | `{path/to/file}` | {What it does} |
103
+
104
+ ## Common Patterns
105
+
106
+ {Patterns used in this area}
107
+
108
+ ## Gotchas
109
+
110
+ - {Thing to watch out for}
111
+ - {Another gotcha}
112
+
113
+ ## Related
114
+
115
+ - {Links to related topics, PRDs, or external docs}
116
+ ```
117
+
118
+ ### 6. Create Branch and PR
119
+
120
+ ```bash
121
+ cd {codex_repo}
122
+ git checkout -b codex/topic-{name}
123
+ git add topics/{name}.md
124
+ git commit -F - <<EOF
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"
129
+ ```
130
+
131
+ ### 7. Confirm to User
132
+
133
+ ```
134
+ ✅ Added topic: {name}
135
+
136
+ 📚 {codex_repo}/topics/{name}.md
137
+ Confidence: {confidence}
138
+ Paths covered: {codebase_paths}
139
+
140
+ PR: {pr_url}
141
+ (Auto-merges for new files)
142
+
143
+ Next time someone asks about {topic}, I can load this context instantly.
144
+ ```
145
+
146
+ ## Example
147
+
148
+ **User:** (after exploring organization hierarchy) `/codex add topic organization-hierarchy`
149
+
150
+ **Result:**
151
+
152
+ ```markdown
153
+ ---
154
+ title: Organization Hierarchy
155
+ type: topic
156
+ created: 2026-01-07
157
+ updated: 2026-01-07
158
+ confidence: high
159
+ source: exploration
160
+ codebase_paths:
161
+ - apps/platform-api/src/modules/organization/
162
+ - libs/shared/src/types/organization.ts
163
+ ---
164
+
165
+ # Organization Hierarchy
166
+
167
+ ## Overview
168
+
169
+ Orderful's multi-tenant organization structure with parent-child relationships, enabling enterprise customers to manage multiple business units under a single account.
170
+
171
+ ## Key Concepts
172
+
173
+ ### Organization
174
+
175
+ The top-level entity. Has settings, billing, users.
176
+
177
+ ### Child Organizations
178
+
179
+ Organizations can have children, creating a hierarchy. Children inherit some settings from parents.
180
+
181
+ ### Organization Context
182
+
183
+ Request-scoped context determining which org's data to access.
184
+
185
+ ## Architecture
186
+
187
+ ```
188
+ Organization (parent)
189
+ ├── Organization (child 1)
190
+ │ └── Organization (grandchild)
191
+ └── Organization (child 2)
192
+ ```
193
+
194
+ ## Key Files
195
+
196
+ | File | Purpose |
197
+ |------|---------|
198
+ | `organization.entity.ts` | TypeORM entity with parent/child relations |
199
+ | `organization.service.ts` | Business logic for org operations |
200
+ | `organization-context.middleware.ts` | Sets org context from request |
201
+
202
+ ## Common Patterns
203
+
204
+ - Always check org context before data access
205
+ - Use `organizationId` foreign key on tenant-scoped entities
206
+ - Hierarchy queries use recursive CTEs
207
+
208
+ ## Gotchas
209
+
210
+ - Child orgs don't automatically inherit all parent settings
211
+ - Deleting a parent doesn't cascade to children (soft delete)
212
+ - API keys are scoped to single org, not hierarchy
213
+ ```
@@ -1,6 +1,6 @@
1
1
  name: comments
2
2
  description: "Enable inline conversations using @droid/@user markers. Tag @droid to ask the AI, AI responds with @{your-name}. Use /comments check to address markers, /comments cleanup to remove resolved threads. Ideal for code review notes and async collaboration."
3
- version: 0.2.5
3
+ version: 0.2.6
4
4
  status: beta
5
5
 
6
6
  includes:
@@ -147,6 +147,7 @@ for f in $(npm root -g)/@orderful/droid/dist/tools/*/TOOL.yaml; do echo "---"; c
147
147
  | **brain** | Collaborative scratchpad for planning and research |
148
148
  | **coach** | Learning-mode AI - scaffolds don't implement, questions don't fix |
149
149
  | **code-review** | Code review with specialized agents and confidence scoring |
150
+ | **codex** | Shared organizational knowledge - PRDs, tech designs, patterns, topics |
150
151
  | **comments** | Inline conversations using @droid/@user markers |
151
152
  | **project** | Project context for persistent AI memory across sessions |
152
153
 
@@ -170,6 +171,12 @@ Comprehensive code review using specialized agents. Reviews PRs, staged changes,
170
171
  **Commands:** `/code-review`
171
172
  **Agents:** edi-standards-reviewer, error-handling-reviewer, test-coverage-analyzer, type-reviewer
172
173
 
174
+ #### codex
175
+ Shared organizational knowledge - PRDs, tech designs, patterns, and explored topics. Load project context, search across the codex, capture decisions during implementation.
176
+
177
+ **Commands:** `/codex`, `/codex projects`, `/codex search`, `/codex decision`, `/codex add topic`
178
+ **Requires:** gh CLI, orderful-codex repo cloned locally
179
+
173
180
  #### comments
174
181
  Enable inline conversations using @droid/@user markers. Tag @droid to ask the AI, AI responds with @{your-name}. Ideal for code review notes and async collaboration.
175
182
 
@@ -215,6 +222,7 @@ Run `droid` to see all available tools or install new ones.
215
222
  | brain | Planning and research scratchpad with `/brain` commands |
216
223
  | coach | Learning-mode AI that asks questions instead of giving answers |
217
224
  | code-review | PR review with specialized agents |
225
+ | codex | Shared knowledge - PRDs, tech designs, patterns, topics |
218
226
  | comments | Inline @droid/@user conversations in any file |
219
227
  | project | Persistent project context across sessions |
220
228
 
@@ -1,6 +1,6 @@
1
1
  name: project
2
2
  description: "Manage project context files for persistent AI memory across sessions. Load, update, or create project context before working on multi-session features."
3
- version: 0.1.4
3
+ version: 0.1.5
4
4
  status: beta
5
5
 
6
6
  includes: