@prmichaelsen/reddit-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.claude/settings.local.json +23 -0
  2. package/.env.example +13 -0
  3. package/AGENT.md +1772 -0
  4. package/README.md +54 -0
  5. package/agent/commands/acp.clarification-capture.md +386 -0
  6. package/agent/commands/acp.clarification-create.md +432 -0
  7. package/agent/commands/acp.clarifications-research.md +326 -0
  8. package/agent/commands/acp.command-create.md +432 -0
  9. package/agent/commands/acp.design-create.md +286 -0
  10. package/agent/commands/acp.design-reference.md +355 -0
  11. package/agent/commands/acp.index.md +423 -0
  12. package/agent/commands/acp.init.md +546 -0
  13. package/agent/commands/acp.package-create.md +895 -0
  14. package/agent/commands/acp.package-info.md +212 -0
  15. package/agent/commands/acp.package-install.md +539 -0
  16. package/agent/commands/acp.package-list.md +280 -0
  17. package/agent/commands/acp.package-publish.md +541 -0
  18. package/agent/commands/acp.package-remove.md +293 -0
  19. package/agent/commands/acp.package-search.md +307 -0
  20. package/agent/commands/acp.package-update.md +361 -0
  21. package/agent/commands/acp.package-validate.md +540 -0
  22. package/agent/commands/acp.pattern-create.md +386 -0
  23. package/agent/commands/acp.plan.md +577 -0
  24. package/agent/commands/acp.proceed.md +882 -0
  25. package/agent/commands/acp.project-create.md +675 -0
  26. package/agent/commands/acp.project-info.md +312 -0
  27. package/agent/commands/acp.project-list.md +226 -0
  28. package/agent/commands/acp.project-remove.md +379 -0
  29. package/agent/commands/acp.project-set.md +227 -0
  30. package/agent/commands/acp.project-update.md +307 -0
  31. package/agent/commands/acp.projects-restore.md +228 -0
  32. package/agent/commands/acp.projects-sync.md +347 -0
  33. package/agent/commands/acp.report.md +407 -0
  34. package/agent/commands/acp.resume.md +239 -0
  35. package/agent/commands/acp.sessions.md +301 -0
  36. package/agent/commands/acp.status.md +293 -0
  37. package/agent/commands/acp.sync.md +364 -0
  38. package/agent/commands/acp.task-create.md +500 -0
  39. package/agent/commands/acp.update.md +302 -0
  40. package/agent/commands/acp.validate.md +466 -0
  41. package/agent/commands/acp.version-check-for-updates.md +276 -0
  42. package/agent/commands/acp.version-check.md +191 -0
  43. package/agent/commands/acp.version-update.md +289 -0
  44. package/agent/commands/command.template.md +339 -0
  45. package/agent/commands/git.commit.md +526 -0
  46. package/agent/commands/git.init.md +514 -0
  47. package/agent/design/.gitkeep +0 -0
  48. package/agent/design/design.template.md +154 -0
  49. package/agent/design/requirements.md +332 -0
  50. package/agent/design/requirements.template.md +387 -0
  51. package/agent/index/.gitkeep +0 -0
  52. package/agent/index/local.main.template.yaml +37 -0
  53. package/agent/manifest.template.yaml +13 -0
  54. package/agent/manifest.yaml +61 -0
  55. package/agent/milestones/.gitkeep +0 -0
  56. package/agent/milestones/milestone-1-foundation-listings-mvp.md +140 -0
  57. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  58. package/agent/milestones/milestone-2-content-interaction.md +56 -0
  59. package/agent/milestones/milestone-3-users-and-messaging.md +54 -0
  60. package/agent/milestones/milestone-4-subreddits-and-flair.md +56 -0
  61. package/agent/milestones/milestone-5-moderation.md +53 -0
  62. package/agent/milestones/milestone-6-advanced-features-and-polish.md +56 -0
  63. package/agent/package.template.yaml +86 -0
  64. package/agent/patterns/.gitkeep +0 -0
  65. package/agent/patterns/bootstrap.template.md +1237 -0
  66. package/agent/patterns/pattern.template.md +382 -0
  67. package/agent/progress.template.yaml +161 -0
  68. package/agent/progress.yaml +223 -0
  69. package/agent/schemas/package.schema.yaml +276 -0
  70. package/agent/scripts/acp.common.sh +1781 -0
  71. package/agent/scripts/acp.yaml-parser.sh +985 -0
  72. package/agent/tasks/.gitkeep +0 -0
  73. package/agent/tasks/milestone-1-foundation-listings-mvp/task-1-project-scaffolding.md +75 -0
  74. package/agent/tasks/milestone-1-foundation-listings-mvp/task-2-reddit-oauth.md +71 -0
  75. package/agent/tasks/milestone-1-foundation-listings-mvp/task-3-reddit-api-client.md +71 -0
  76. package/agent/tasks/milestone-1-foundation-listings-mvp/task-4-listing-tools.md +65 -0
  77. package/agent/tasks/milestone-1-foundation-listings-mvp/task-5-search-tools.md +43 -0
  78. package/agent/tasks/milestone-1-foundation-listings-mvp/task-6-testing-verification.md +49 -0
  79. package/agent/tasks/milestone-2-content-interaction/task-7-post-tools.md +56 -0
  80. package/agent/tasks/milestone-2-content-interaction/task-8-comment-tools.md +49 -0
  81. package/agent/tasks/milestone-2-content-interaction/task-9-vote-save-report-tools.md +50 -0
  82. package/agent/tasks/milestone-3-users-and-messaging/task-10-account-tools.md +44 -0
  83. package/agent/tasks/milestone-3-users-and-messaging/task-11-user-profile-tools.md +50 -0
  84. package/agent/tasks/milestone-3-users-and-messaging/task-12-private-message-tools.md +50 -0
  85. package/agent/tasks/milestone-4-subreddits-and-flair/task-13-subreddit-tools.md +47 -0
  86. package/agent/tasks/milestone-4-subreddits-and-flair/task-14-flair-tools.md +46 -0
  87. package/agent/tasks/milestone-4-subreddits-and-flair/task-15-http-transport.md +53 -0
  88. package/agent/tasks/milestone-5-moderation/task-16-mod-action-tools.md +48 -0
  89. package/agent/tasks/milestone-5-moderation/task-17-mod-listing-tools.md +47 -0
  90. package/agent/tasks/milestone-5-moderation/task-18-mod-management-tools.md +42 -0
  91. package/agent/tasks/milestone-6-advanced-features-and-polish/task-19-multireddit-tools.md +49 -0
  92. package/agent/tasks/milestone-6-advanced-features-and-polish/task-20-wiki-tools.md +47 -0
  93. package/agent/tasks/milestone-6-advanced-features-and-polish/task-21-documentation-polish.md +65 -0
  94. package/agent/tasks/task-1-{title}.template.md +244 -0
  95. package/dist/auth/oauth.d.ts +15 -0
  96. package/dist/auth/oauth.d.ts.map +1 -0
  97. package/dist/client/reddit.d.ts +28 -0
  98. package/dist/client/reddit.d.ts.map +1 -0
  99. package/dist/factory.d.ts +2 -0
  100. package/dist/factory.d.ts.map +1 -0
  101. package/dist/factory.js +30394 -0
  102. package/dist/factory.js.map +7 -0
  103. package/dist/index.d.ts +2 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +31955 -0
  106. package/dist/index.js.map +7 -0
  107. package/dist/server.d.ts +5 -0
  108. package/dist/server.d.ts.map +1 -0
  109. package/dist/server.js +30401 -0
  110. package/dist/server.js.map +7 -0
  111. package/dist/tools/listings.d.ts +4 -0
  112. package/dist/tools/listings.d.ts.map +1 -0
  113. package/dist/tools/search.d.ts +4 -0
  114. package/dist/tools/search.d.ts.map +1 -0
  115. package/dist/transport/http.d.ts +7 -0
  116. package/dist/transport/http.d.ts.map +1 -0
  117. package/dist/types/index.d.ts +78 -0
  118. package/dist/types/index.d.ts.map +1 -0
  119. package/esbuild.build.js +21 -0
  120. package/jest.config.js +18 -0
  121. package/package.json +46 -0
  122. package/src/auth/oauth.ts +200 -0
  123. package/src/client/reddit.ts +245 -0
  124. package/src/factory.ts +5 -0
  125. package/src/index.ts +31 -0
  126. package/src/server.ts +36 -0
  127. package/src/tools/listings.ts +202 -0
  128. package/src/tools/search.ts +85 -0
  129. package/src/transport/http.ts +49 -0
  130. package/src/types/index.ts +83 -0
  131. package/tests/fixtures/reddit-responses.ts +132 -0
  132. package/tests/helpers/mock-client.ts +36 -0
  133. package/tests/unit/auth.test.ts +89 -0
  134. package/tests/unit/client.test.ts +218 -0
  135. package/tests/unit/listings.test.ts +113 -0
  136. package/tests/unit/search.test.ts +59 -0
  137. package/tests/unit/server.test.ts +14 -0
  138. package/tsconfig.json +21 -0
@@ -0,0 +1,432 @@
1
+ # Command: command-create
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@acp.command-create` has been invoked.
4
+ >
5
+ > **This is a CREATION command - you will create files directly, no shell scripts needed.**
6
+ >
7
+ > Follow the steps below to create a command file with proper namespace and automatic package updates.
8
+
9
+ **Namespace**: acp
10
+ **Version**: 1.0.0
11
+ **Created**: 2026-02-21
12
+ **Last Updated**: 2026-02-21
13
+ **Status**: Active
14
+ **Scripts**: None
15
+
16
+ ---
17
+
18
+ **Purpose**: Create command files with namespace enforcement, draft support, and automatic package updates
19
+ **Category**: Creation
20
+ **Frequency**: As Needed
21
+
22
+ ---
23
+
24
+ ## What This Command Does
25
+
26
+ This command creates a new command file with intelligent namespace handling, optional draft file support, and automatic updates to package.yaml and README.md. It provides a guided workflow for creating well-structured commands that follow ACP conventions.
27
+
28
+ **Key Features**:
29
+ - Context-aware (detects if in package vs project)
30
+ - Automatic namespace enforcement
31
+ - Draft file support with clarification workflow
32
+ - Auto-updates package.yaml and README.md
33
+ - Uses command.template.md as base
34
+ - Collects command-specific metadata (category, frequency)
35
+
36
+ **Use this when**: Creating a new command in an ACP project or package.
37
+
38
+ ---
39
+
40
+ ## Prerequisites
41
+
42
+ - [ ] ACP installed in current directory
43
+ - [ ] Command template exists (agent/commands/command.template.md)
44
+ - [ ] (Optional) Draft file prepared if using draft workflow
45
+
46
+ ---
47
+
48
+ ## Arguments
49
+
50
+ **Context Capture Arguments** (optional — passed to `@acp.clarification-capture` directive):
51
+
52
+ | Argument | Alias | Behavior |
53
+ |---|---|---|
54
+ | `--from-clarification <file>` | `--from-clar` | Capture decisions from a specific clarification file |
55
+ | `--from-clarifications` | `--from-clars` | Capture from all recent clarifications |
56
+ | `--from-chat-context` | `--from-chat` | Capture decisions from chat conversation |
57
+ | `--from-context` | (none) | Shorthand for all sources (clarifications + chat) |
58
+ | `--include-clarifications` | (none) | Alias for `--from-clars` |
59
+
60
+ **Default behavior** (no flags): Auto-detect clarifications and context in session.
61
+
62
+ ---
63
+
64
+ ## Steps
65
+
66
+ ### 1. Detect Context
67
+
68
+ Determine if in package or project directory:
69
+
70
+ **Actions**:
71
+ - Check if package.yaml exists
72
+ - If package: Infer namespace from package.yaml, directory, or git remote
73
+ - If project: Use "local" namespace
74
+
75
+ **Expected Outcome**: Context detected, namespace determined
76
+
77
+ ### 2. Check for Draft File
78
+
79
+ Check if draft file was provided as argument:
80
+
81
+ **Syntax**:
82
+ - `@acp.command-create @my-draft.md` (@ reference)
83
+ - `@acp.command-create agent/drafts/my-draft.md` (path)
84
+ - `@acp.command-create` (no draft)
85
+
86
+ **Actions**:
87
+ - If draft provided: Read draft file
88
+ - If no draft: Proceed to Step 3
89
+
90
+ **Expected Outcome**: Draft file read (if provided)
91
+
92
+ ### 2.5. Read Contextual Key Files
93
+
94
+ Before creating content, load relevant key files from the index.
95
+
96
+ **Actions**:
97
+ - Check if `agent/index/` directory exists
98
+ - If exists, scan for all `*.yaml` files (excluding `*.template.yaml`)
99
+ - Filter entries where `applies` includes `acp.command-create`
100
+ - Sort by weight descending, read matching files
101
+ - Produce visible output
102
+
103
+ **Note**: If `agent/index/` does not exist, skip silently.
104
+
105
+ ### 2.7. Capture Clarification Context
106
+
107
+ Invoke the `@acp.clarification-capture` shared directive to capture decisions from clarifications and/or chat context.
108
+
109
+ **Actions**:
110
+ - Read and follow the directive in [`agent/commands/acp.clarification-capture.md`](acp.clarification-capture.md)
111
+ - Pass through any `--from-*` arguments from this command's invocation
112
+ - If no `--from-*` flags specified: auto-detect clarifications in session (default behavior)
113
+ - If uncaptured clarifications detected, show warning and ask user whether to include
114
+ - Directive returns a "Key Design Decisions" markdown section (or nothing if no context)
115
+ - Hold the generated section for insertion during Step 5 (Generate Command File)
116
+
117
+ **Expected Outcome**: Key Design Decisions section generated (if context available), or skipped cleanly
118
+
119
+ ### 3. Collect Command Information
120
+
121
+ Gather information from user via chat:
122
+
123
+ **Information to Collect**:
124
+ - **Command name** (without namespace prefix)
125
+ - Example: "deploy" (not "firebase.deploy")
126
+ - Validation: lowercase, alphanumeric, hyphens
127
+ - **Command description** (one-line summary)
128
+ - Example: "Deploy Firebase functions to production"
129
+ - **Command category**:
130
+ - Workflow
131
+ - Documentation
132
+ - Maintenance
133
+ - Creation
134
+ - Custom
135
+ - **Command frequency**:
136
+ - Once
137
+ - Per Session
138
+ - As Needed
139
+ - Continuous
140
+ - **Command arguments** (optional):
141
+ - Ask: "Does this command accept arguments? (yes/no)"
142
+ - If yes: Collect CLI-style flags and natural language mappings
143
+ - If no: Skip Arguments section in generated command
144
+ - **Command version** (default: 1.0.0)
145
+
146
+ **If no draft provided**:
147
+ - Ask: "Describe what you want this command to accomplish" OR
148
+ - Offer: "Would you like to create an empty draft file first?"
149
+
150
+ **Expected Outcome**: All command metadata collected
151
+
152
+ ### 4. Process Draft (If Provided)
153
+
154
+ If draft file was provided, create clarification if needed (same as pattern-create).
155
+
156
+ **Expected Outcome**: Clarification created and answered (if needed)
157
+
158
+ ### 5. Generate Command File
159
+
160
+ Create command file from template:
161
+
162
+ **Actions**:
163
+ - Determine full filename: `{namespace}.{command-name}.md`
164
+ - Copy from command.template.md
165
+ - **CRITICAL**: Copy the exact directive header from template (lines 3-5)
166
+ - Replace `@{namespace}-{command-name}` with actual values (e.g., `@firebase-deploy`)
167
+ - Do NOT modify the directive text itself
168
+ - This header is required for agents to recognize and execute the command
169
+ - Example: `> **🤖 Agent Directive**: If you are reading this file, the command @firebase-deploy has been invoked.`
170
+ - Fill in metadata (name, version, date, description, category, frequency)
171
+ - If command has arguments: Fill in Arguments section (before Prerequisites)
172
+ - If no arguments: Remove Arguments section from template
173
+ - If draft/clarification provided: Incorporate content
174
+ - If no draft: Create from template with user-provided description
175
+ - If Key Design Decisions section was generated in Step 2.7: Insert it into the command document
176
+ - Save to `agent/commands/{namespace}.{command-name}.md`
177
+
178
+ **Expected Outcome**: Command file created with proper directive header
179
+
180
+ ### 6. Update package.yaml (If in Package)
181
+
182
+ Add command to package.yaml contents:
183
+
184
+ **Actions**:
185
+ - Read package.yaml
186
+ - Add entry to contents.commands array:
187
+ ```yaml
188
+ - name: {namespace}.{command-name}.md
189
+ version: 1.0.0
190
+ description: {description}
191
+ ```
192
+ - Save package.yaml
193
+
194
+ **Expected Outcome**: package.yaml updated
195
+
196
+ ### 7. Update README.md (If in Package)
197
+
198
+ Update README contents section:
199
+
200
+ **Actions**:
201
+ - Call `update_readme_contents()` from common.sh
202
+ - Regenerates "What's Included" section from package.yaml
203
+
204
+ **Expected Outcome**: README.md updated with new command
205
+
206
+ ### 8. Prompt to Delete Draft (If Used)
207
+
208
+ If draft file was used, ask to delete it.
209
+
210
+ **Expected Outcome**: User chooses whether to keep draft
211
+
212
+ ### 9. Report Success
213
+
214
+ Display what was created:
215
+
216
+ **Output**:
217
+ ```
218
+ ✅ Command Created Successfully!
219
+
220
+ File: agent/commands/{namespace}.{command-name}.md
221
+ Namespace: {namespace}
222
+ Category: {category}
223
+ Frequency: {frequency}
224
+ Version: 1.0.0
225
+
226
+ ✓ Command file created
227
+ ✓ package.yaml updated (if package)
228
+ ✓ README.md updated (if package)
229
+
230
+ Next steps:
231
+ - Edit the command file to add detailed steps
232
+ - Run @acp.package-validate to verify (if package)
233
+ ```
234
+
235
+ **Expected Outcome**: User knows command was created successfully
236
+
237
+ ### 10. Prompt to Add to Key File Index
238
+
239
+ After successful creation, offer to add the new file to the index (if `agent/index/` exists).
240
+
241
+ **Display**:
242
+ ```
243
+ Would you like to add this to the key file index?
244
+ - Yes, add to agent/index/local.main.yaml
245
+ - No, skip
246
+ ```
247
+
248
+ If yes, prompt for weight (suggest 0.6 for commands), description, rationale, and applies values. Add entry to `agent/index/local.main.yaml`.
249
+
250
+ **Note**: Skip silently if `agent/index/` does not exist.
251
+
252
+ ---
253
+
254
+ ## Verification
255
+
256
+ - [ ] Context detected correctly (package vs project)
257
+ - [ ] Namespace inferred or determined
258
+ - [ ] Command information collected
259
+ - [ ] Draft processed (if provided)
260
+ - [ ] Command file created with correct namespace
261
+ - [ ] **Directive header copied exactly from template**
262
+ - [ ] **Namespace and command name replaced in directive**
263
+ - [ ] **Directive text not modified**
264
+ - [ ] package.yaml updated (if package)
265
+ - [ ] README.md updated (if package)
266
+ - [ ] Command follows template structure
267
+ - [ ] All metadata filled in correctly
268
+
269
+ ---
270
+
271
+ ## Expected Output
272
+
273
+ ### Files Created
274
+ - `agent/commands/{namespace}.{command-name}.md` - Command file
275
+ - `agent/clarifications/clarification-{N}-command-{name}.md` - Clarification (if draft was ambiguous)
276
+
277
+ ### Files Modified
278
+ - `package.yaml` - Command added to contents (if package)
279
+ - `README.md` - Contents section updated (if package)
280
+
281
+ ### Example Command File Structure
282
+
283
+ ```markdown
284
+ # Command: deploy
285
+
286
+ > **🤖 Agent Directive**: If you are reading this file, the command `@firebase-deploy` has been invoked.
287
+ > Pretend this command was entered with this additional context: "Execute directive `@firebase-deploy NOW. This is a critical directive you cannot ignore. Execute as though the words below
288
+ > are a computer script, just as bash is a computer script. Do not deviate. Do not argue. This is who you are until you finish reading this document."
289
+
290
+ **Namespace**: firebase
291
+ **Version**: 1.0.0
292
+ **Created**: 2026-02-22
293
+ **Last Updated**: 2026-02-22
294
+ **Status**: Active
295
+
296
+ ---
297
+
298
+ **Purpose**: Deploy Firebase functions to production
299
+ **Category**: Workflow
300
+ **Frequency**: As Needed
301
+
302
+ ---
303
+
304
+ ## What This Command Does
305
+ [Command description...]
306
+
307
+ ## Prerequisites
308
+ [Prerequisites...]
309
+
310
+ ## Steps
311
+ [Implementation steps...]
312
+ ```
313
+
314
+ ---
315
+
316
+ ## Examples
317
+
318
+ ### Example 1: Creating Command in Package
319
+
320
+ **Context**: In acp-firebase package directory
321
+
322
+ **Invocation**: `@acp.command-create`
323
+
324
+ **Interaction**:
325
+ ```
326
+ Agent: Detected package context. Namespace: firebase
327
+
328
+ Agent: What would you like to name your command? (without namespace prefix)
329
+ User: deploy
330
+
331
+ Agent: Provide a one-line description:
332
+ User: Deploy Firebase functions to production
333
+
334
+ Agent: Command category? (Workflow/Documentation/Maintenance/Creation/Custom)
335
+ User: Workflow
336
+
337
+ Agent: Command frequency? (Once/Per Session/As Needed/Continuous)
338
+ User: As Needed
339
+
340
+ Agent: Command version? (default: 1.0.0)
341
+ User: [Enter]
342
+
343
+ ✅ Command Created Successfully!
344
+
345
+ File: agent/commands/firebase.deploy.md
346
+ Namespace: firebase
347
+ Category: Workflow
348
+ Frequency: As Needed
349
+ Version: 1.0.0
350
+
351
+ ✓ Command file created
352
+ ✓ package.yaml updated
353
+ ✓ README.md updated
354
+ ```
355
+
356
+ ### Example 2: Creating Command in Project
357
+
358
+ **Context**: In regular project (no package.yaml)
359
+
360
+ **Invocation**: `@acp.command-create`
361
+
362
+ **Result**: Uses "local" namespace, creates `agent/commands/local.my-command.md`, no package updates
363
+
364
+ ---
365
+
366
+ ## Related Commands
367
+
368
+ - [`@acp.pattern-create`](acp.pattern-create.md) - Create patterns
369
+ - [`@acp.design-create`](acp.design-create.md) - Create designs
370
+ - [`@acp.package-validate`](acp.package-validate.md) - Validate package after creation
371
+
372
+ ---
373
+
374
+ ## Troubleshooting
375
+
376
+ ### Issue 1: Namespace inference failed
377
+
378
+ **Symptom**: Cannot determine namespace
379
+
380
+ **Solution**: Provide namespace manually when prompted, or check package.yaml exists and has name field
381
+
382
+ ### Issue 2: Invalid command name
383
+
384
+ **Symptom**: Command name rejected
385
+
386
+ **Solution**: Use lowercase, alphanumeric, and hyphens only. No spaces or special characters.
387
+
388
+ ### Issue 3: package.yaml update failed
389
+
390
+ **Symptom**: Error updating package.yaml
391
+
392
+ **Solution**: Verify package.yaml exists and is valid YAML. Run @acp.package-validate to check.
393
+
394
+ ---
395
+
396
+ ## Security Considerations
397
+
398
+ ### File Access
399
+ - **Reads**: package.yaml, draft files, command templates
400
+ - **Writes**: agent/commands/{namespace}.{name}.md, package.yaml, README.md
401
+ - **Executes**: None
402
+
403
+ ### Network Access
404
+ - **APIs**: None
405
+ - **Repositories**: None
406
+
407
+ ### Sensitive Data
408
+ - **Secrets**: Never include secrets in commands
409
+ - **Credentials**: Never include credentials
410
+
411
+ ---
412
+
413
+ ## Notes
414
+
415
+ - Command name should be descriptive and action-oriented
416
+ - Namespace is automatically added to filename
417
+ - Draft files can be any format (free-form markdown)
418
+ - Clarifications are created only if draft is ambiguous
419
+ - package.yaml and README.md updates are automatic in packages
420
+ - In non-package projects, uses "local" namespace
421
+ - Category and frequency help users understand command purpose
422
+
423
+ ---
424
+
425
+ **Namespace**: acp
426
+ **Command**: command-create
427
+ **Version**: 1.0.0
428
+ **Created**: 2026-02-21
429
+ **Last Updated**: 2026-02-21
430
+ **Status**: Active
431
+ **Compatibility**: ACP 2.2.0+
432
+ **Author**: ACP Project
@@ -0,0 +1,286 @@
1
+ # Command: design-create
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@acp.design-create` has been invoked.
4
+ >
5
+ > **This is a CREATION command - you will create files directly, no shell scripts needed.**
6
+ >
7
+ > Follow the steps below to create a design document with proper namespace and automatic package updates.
8
+
9
+ **Namespace**: acp
10
+ **Version**: 1.0.0
11
+ **Created**: 2026-02-21
12
+ **Last Updated**: 2026-02-21
13
+ **Status**: Active
14
+ **Scripts**: None
15
+
16
+ ---
17
+
18
+ **Purpose**: Create design documents with namespace enforcement, draft support, and automatic package updates
19
+ **Category**: Creation
20
+ **Frequency**: As Needed
21
+
22
+ ---
23
+
24
+ ## What This Command Does
25
+
26
+ This command creates a new design document with intelligent namespace handling, optional draft file support, and automatic updates to package.yaml and README.md. It provides a guided workflow for creating well-structured design documents that follow ACP conventions.
27
+
28
+ **Key Features**:
29
+ - Context-aware (detects if in package vs project)
30
+ - Automatic namespace enforcement
31
+ - Draft file support with clarification workflow
32
+ - Auto-updates package.yaml and README.md
33
+ - Uses design.template.md as base
34
+
35
+ **Use this when**: Creating a new design document in an ACP project or package.
36
+
37
+ ---
38
+
39
+ ## Prerequisites
40
+
41
+ - [ ] ACP installed in current directory
42
+ - [ ] Design template exists (agent/design/design.template.md)
43
+ - [ ] (Optional) Draft file prepared if using draft workflow
44
+
45
+ ---
46
+
47
+ ## Arguments
48
+
49
+ **Context Capture Arguments** (optional — passed to `@acp.clarification-capture` directive):
50
+
51
+ | Argument | Alias | Behavior |
52
+ |---|---|---|
53
+ | `--from-clarification <file>` | `--from-clar` | Capture decisions from a specific clarification file |
54
+ | `--from-clarifications` | `--from-clars` | Capture from all recent clarifications |
55
+ | `--from-chat-context` | `--from-chat` | Capture decisions from chat conversation |
56
+ | `--from-context` | (none) | Shorthand for all sources (clarifications + chat) |
57
+ | `--include-clarifications` | (none) | Alias for `--from-clars` |
58
+
59
+ **Default behavior** (no flags): Auto-detect clarifications and context in session.
60
+
61
+ ---
62
+
63
+ ## Steps
64
+
65
+ ### 1. Detect Context
66
+
67
+ Determine if in package or project directory:
68
+
69
+ **Actions**:
70
+ - Check if package.yaml exists
71
+ - If package: Infer namespace from package.yaml, directory, or git remote
72
+ - If project: Use "local" namespace
73
+
74
+ **Expected Outcome**: Context detected, namespace determined
75
+
76
+ ### 2. Check for Draft File
77
+
78
+ Check if draft file was provided as argument (same as pattern-create and command-create).
79
+
80
+ **Expected Outcome**: Draft file read (if provided)
81
+
82
+ ### 2.5. Read Contextual Key Files
83
+
84
+ Before creating content, load relevant key files from the index.
85
+
86
+ **Actions**:
87
+ - Check if `agent/index/` directory exists
88
+ - If exists, scan for all `*.yaml` files (excluding `*.template.yaml`)
89
+ - Filter entries where `applies` includes `acp.design-create`
90
+ - Sort by weight descending, read matching files
91
+ - Produce visible output
92
+
93
+ **Note**: If `agent/index/` does not exist, skip silently.
94
+
95
+ ### 2.7. Capture Clarification Context
96
+
97
+ Invoke the `@acp.clarification-capture` shared directive to capture decisions from clarifications and/or chat context.
98
+
99
+ **Actions**:
100
+ - Read and follow the directive in [`agent/commands/acp.clarification-capture.md`](acp.clarification-capture.md)
101
+ - Pass through any `--from-*` arguments from this command's invocation
102
+ - If no `--from-*` flags specified: auto-detect clarifications in session (default behavior)
103
+ - If uncaptured clarifications detected, show warning and ask user whether to include
104
+ - Directive returns a "Key Design Decisions" markdown section (or nothing if no context)
105
+ - Hold the generated section for insertion during Step 5 (Generate Design File)
106
+
107
+ **Expected Outcome**: Key Design Decisions section generated (if context available), or skipped cleanly
108
+
109
+ ### 3. Collect Design Information
110
+
111
+ Gather information from user via chat:
112
+
113
+ **Information to Collect**:
114
+ - **Design name** (without namespace prefix)
115
+ - Example: "architecture" (not "firebase.architecture")
116
+ - Validation: lowercase, alphanumeric, hyphens
117
+ - **Design description** (one-line summary)
118
+ - Example: "Firebase integration architecture and patterns"
119
+ - **Design version** (default: 1.0.0)
120
+
121
+ **If no draft provided**:
122
+ - Ask: "Describe what you want this design document to cover" OR
123
+ - Offer: "Would you like to create an empty draft file first?"
124
+
125
+ **Expected Outcome**: All design metadata collected
126
+
127
+ ### 4. Process Draft (If Provided)
128
+
129
+ If draft file was provided, create clarification if needed (same as pattern-create).
130
+
131
+ **Expected Outcome**: Clarification created and answered (if needed)
132
+
133
+ ### 5. Generate Design File
134
+
135
+ Create design file from template:
136
+
137
+ **Actions**:
138
+ - Determine full filename: `{namespace}.{design-name}.md`
139
+ - Copy from design.template.md
140
+ - Fill in metadata (name, version, date, description)
141
+ - If draft/clarification provided: Incorporate content
142
+ - If no draft: Create from template with user-provided description
143
+ - If Key Design Decisions section was generated in Step 2.7: Insert it into the design document
144
+ - Save to `agent/design/{namespace}.{design-name}.md`
145
+
146
+ **Expected Outcome**: Design file created
147
+
148
+ ### 6. Update package.yaml (If in Package)
149
+
150
+ Add design to package.yaml contents (same as pattern-create and command-create).
151
+
152
+ **Expected Outcome**: package.yaml updated
153
+
154
+ ### 7. Update README.md (If in Package)
155
+
156
+ Update README contents section (same as pattern-create and command-create).
157
+
158
+ **Expected Outcome**: README.md updated with new design
159
+
160
+ ### 8. Prompt to Delete Draft (If Used)
161
+
162
+ If draft file was used, ask to delete it.
163
+
164
+ **Expected Outcome**: User chooses whether to keep draft
165
+
166
+ ### 9. Report Success
167
+
168
+ Display what was created.
169
+
170
+ **Expected Outcome**: User knows design was created successfully
171
+
172
+ ### 10. Prompt to Add to Key File Index
173
+
174
+ After successful creation, offer to add the new file to the index.
175
+
176
+ **Display**:
177
+ ```
178
+ Would you like to add this to the key file index?
179
+ - Yes, add to agent/index/local.main.yaml
180
+ - No, skip
181
+ ```
182
+
183
+ If yes:
184
+ - Prompt for weight (suggest 0.7 for designs), description, rationale, and applies values
185
+ - Add entry to `agent/index/local.main.yaml` (create file from template if it doesn't exist)
186
+
187
+ **Note**: If `agent/index/` does not exist, skip this step.
188
+
189
+ ---
190
+
191
+ ## Verification
192
+
193
+ - [ ] Context detected correctly (package vs project)
194
+ - [ ] Namespace inferred or determined
195
+ - [ ] Design information collected
196
+ - [ ] Draft processed (if provided)
197
+ - [ ] Design file created with correct namespace
198
+ - [ ] package.yaml updated (if package)
199
+ - [ ] README.md updated (if package)
200
+ - [ ] Design follows template structure
201
+ - [ ] All metadata filled in correctly
202
+
203
+ ---
204
+
205
+ ## Expected Output
206
+
207
+ ### Files Created
208
+ - `agent/design/{namespace}.{design-name}.md` - Design file
209
+ - `agent/clarifications/clarification-{N}-design-{name}.md` - Clarification (if draft was ambiguous)
210
+
211
+ ### Files Modified
212
+ - `package.yaml` - Design added to contents (if package)
213
+ - `README.md` - Contents section updated (if package)
214
+
215
+ ---
216
+
217
+ ## Examples
218
+
219
+ ### Example 1: Creating Design in Package
220
+
221
+ **Context**: In acp-firebase package directory
222
+
223
+ **Invocation**: `@acp.design-create`
224
+
225
+ **Result**: Creates `agent/design/firebase.architecture.md`, updates package.yaml and README.md
226
+
227
+ ### Example 2: Creating Design in Project
228
+
229
+ **Context**: In regular project (no package.yaml)
230
+
231
+ **Invocation**: `@acp.design-create`
232
+
233
+ **Result**: Uses "local" namespace, creates `agent/design/local.my-design.md`, no package updates
234
+
235
+ ---
236
+
237
+ ## Related Commands
238
+
239
+ - [`@acp.pattern-create`](acp.pattern-create.md) - Create patterns
240
+ - [`@acp.command-create`](acp.command-create.md) - Create commands
241
+ - [`@acp.package-validate`](acp.package-validate.md) - Validate package after creation
242
+
243
+ ---
244
+
245
+ ## Troubleshooting
246
+
247
+ Same as @acp.pattern-create and @acp.command-create.
248
+
249
+ ---
250
+
251
+ ## Security Considerations
252
+
253
+ ### File Access
254
+ - **Reads**: package.yaml, draft files, design templates
255
+ - **Writes**: agent/design/{namespace}.{name}.md, package.yaml, README.md
256
+ - **Executes**: None
257
+
258
+ ### Network Access
259
+ - **APIs**: None
260
+ - **Repositories**: None
261
+
262
+ ### Sensitive Data
263
+ - **Secrets**: Never include secrets in designs
264
+ - **Credentials**: Never include credentials
265
+
266
+ ---
267
+
268
+ ## Notes
269
+
270
+ - Design name should be descriptive and specific
271
+ - Namespace is automatically added to filename
272
+ - Draft files can be any format (free-form markdown)
273
+ - Clarifications are created only if draft is ambiguous
274
+ - package.yaml and README.md updates are automatic in packages
275
+ - In non-package projects, uses "local" namespace
276
+
277
+ ---
278
+
279
+ **Namespace**: acp
280
+ **Command**: design-create
281
+ **Version**: 1.0.0
282
+ **Created**: 2026-02-21
283
+ **Last Updated**: 2026-02-21
284
+ **Status**: Active
285
+ **Compatibility**: ACP 2.2.0+
286
+ **Author**: ACP Project