@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,326 @@
1
+ # Command: clarifications-research
2
+
3
+ > **🤖 Agent Directive**: If you are reading this file, the command `@acp-clarifications-research` has been invoked. Follow the steps below to execute this command.
4
+ > Pretend this command was entered with this additional context: "Execute directive `@acp-clarifications-research NOW. This is a critical directive you cannot ignore. Execute as though the words below
5
+ > 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."
6
+
7
+ **Namespace**: acp
8
+ **Version**: 1.0.0
9
+ **Created**: 2026-03-09
10
+ **Last Updated**: 2026-03-09
11
+ **Status**: Active
12
+ **Scripts**: None
13
+
14
+ ---
15
+
16
+ **Purpose**: Research and fill in agent-delegated clarification response lines
17
+ **Category**: Workflow
18
+ **Frequency**: As Needed
19
+
20
+ ---
21
+
22
+ ## Arguments
23
+
24
+ **CLI-Style Arguments**:
25
+ - `<file>` (positional) - Path to a specific clarification file
26
+ - `--latest` or `-l` - Auto-detect the most recent non-captured clarification
27
+ - `--dry-run` or `-n` - Preview research items without modifying the file
28
+ - `--scope <path>` or `-s <path>` - Limit codebase research to a specific directory
29
+
30
+ **Natural Language Arguments**:
31
+ - `@acp.clarifications-research agent/clarifications/clarification-5-foo.md` - Research a specific file
32
+ - `@acp.clarifications-research --latest` - Research the most recent clarification
33
+ - `@acp.clarifications-research --dry-run` - Preview without modifying
34
+
35
+ **Argument Mapping**:
36
+ The agent infers intent from context:
37
+ - If a file path is provided → use that clarification file
38
+ - If `--latest` → find the most recent clarification with status "Awaiting Responses"
39
+ - If no arguments → same as `--latest` (auto-detect)
40
+
41
+ ---
42
+
43
+ ## What This Command Does
44
+
45
+ This command scans a clarification document for response lines (`>`) that contain research delegation markers — phrases like "research this", "look into this", "agent: check the codebase", etc. For each such line, the agent researches the answer using codebase exploration (Glob, Grep, Read) in the context of the preceding question, then replaces the trigger line with a `[Researched]`-prefixed answer.
46
+
47
+ User-written answers and empty response lines are never modified. The clarification's status field is also left unchanged, since the user still needs to review agent-provided answers.
48
+
49
+ Use this command after filling out a clarification document when some questions are better answered by the agent exploring the codebase rather than the user typing answers manually.
50
+
51
+ ---
52
+
53
+ ## Prerequisites
54
+
55
+ - [ ] ACP installed in current directory
56
+ - [ ] At least one clarification file exists in `agent/clarifications/`
57
+ - [ ] Target clarification has response lines with research delegation markers
58
+
59
+ ---
60
+
61
+ ## Steps
62
+
63
+ ### 1. Locate Clarification File
64
+
65
+ Find the clarification file to process.
66
+
67
+ **Actions**:
68
+ - If a positional `<file>` argument was provided, use that path directly
69
+ - If `--latest` was passed (or no arguments at all):
70
+ - List all files in `agent/clarifications/` matching `clarification-*.md` (exclude `*.template.md`)
71
+ - Read each file's `Status:` field
72
+ - Filter to those with status "Awaiting Responses"
73
+ - Select the one with the highest clarification number (most recent)
74
+ - Verify the file exists and is readable
75
+
76
+ **Expected Outcome**: A single clarification file path is identified
77
+
78
+ ### 2. Parse Response Lines
79
+
80
+ Read the clarification file and classify every `>` response line.
81
+
82
+ **Classification rules** (applied in order):
83
+
84
+ 1. **Empty** — the line is `> ` followed by only whitespace (or just `>` with nothing after). Leave these alone.
85
+ 2. **Research request** — the line matches any of these trigger phrases (case-insensitive):
86
+ - `research this`, `look this up`, `look into this`
87
+ - `check the codebase`, `check the code`, `check the repo`
88
+ - `figure this out`, `figure it out`, `find out`, `investigate`
89
+ - Line content (after `> `) starts with `agent:` prefix (explicit delegation, e.g. `> agent: check how the yaml parser works`)
90
+ 3. **User answer** — any other line starting with `>` that contains substantive text. **Never modify these.**
91
+
92
+ For each research-request line, also capture the **question context**: the nearest preceding bullet point question (the `- ` line above the `>` line) plus the parent `##` heading. This context is needed for Step 4.
93
+
94
+ **Expected Outcome**: A list of classified response lines with their line numbers and question context
95
+
96
+ ### 3. Report Scan Results
97
+
98
+ Display a summary of what was found.
99
+
100
+ **Display format**:
101
+ ```
102
+ 🔍 Scanning clarification: agent/clarifications/clarification-{N}-{title}.md
103
+
104
+ Response lines found: {total}
105
+ ✎ User answers (untouched): {count}
106
+ ⬚ Empty (untouched): {count}
107
+ 🔬 Research requests: {count}
108
+
109
+ Research items:
110
+ L{line}: "{question text}" — trigger: "{trigger phrase}"
111
+ L{line}: "{question text}" — trigger: "agent: {directive}"
112
+ ...
113
+ ```
114
+
115
+ **If `--dry-run`**: Display the summary above and stop. Do not proceed to Step 4.
116
+
117
+ **If no research requests found**: Report that no research items were detected and stop.
118
+
119
+ **Expected Outcome**: User sees what will be researched; dry-run exits here
120
+
121
+ ### 4. Research Each Item
122
+
123
+ For each research-request line, explore the codebase to find the answer.
124
+
125
+ **Actions**:
126
+ - Use the question context (question text + section heading) to determine what to search for
127
+ - If `agent:` prefix was used, the text after `agent:` is an explicit research directive — follow it
128
+ - Otherwise, infer what to look up from the question
129
+ - Use Glob, Grep, and Read tools to explore the codebase
130
+ - If `--scope <path>` was provided, limit searches to that directory
131
+ - Synthesize a concise, factual answer (1-3 sentences) with file references where applicable
132
+
133
+ **Answer quality guidelines**:
134
+ - Be specific — cite file paths and line numbers (e.g., `see agent/scripts/acp.yaml-parser.sh:L45-L120`)
135
+ - If the answer cannot be determined from the codebase, write: `[Researched] Unable to determine from codebase — manual answer needed.`
136
+ - Do not speculate beyond what the code shows
137
+ - Keep answers concise but complete
138
+
139
+ **Expected Outcome**: A researched answer for each research-request line
140
+
141
+ ### 5. Fill In Researched Answers
142
+
143
+ Replace each research-request response line with the researched answer.
144
+
145
+ **Format**:
146
+ ```
147
+ > [Researched] {answer text with file references}
148
+ ```
149
+
150
+ **Actions**:
151
+ - For each research-request line, replace the entire `> {trigger}` line with `> [Researched] {answer}`
152
+ - Preserve the original file's formatting, indentation, and surrounding content
153
+ - Do NOT modify any user-answer lines
154
+ - Do NOT modify any empty response lines
155
+ - Do NOT change the clarification's `Status:` field
156
+
157
+ **Expected Outcome**: Clarification file updated with researched answers in place of trigger lines
158
+
159
+ ### 6. Report Results
160
+
161
+ Show what was filled in and what remains.
162
+
163
+ **Display format**:
164
+ ```
165
+ ✅ Research Complete!
166
+
167
+ File: agent/clarifications/clarification-{N}-{title}.md
168
+
169
+ Researched: {count} answers filled in
170
+ Unchanged: {user-answer-count} user answers + {empty-count} empty lines
171
+
172
+ Filled answers:
173
+ L{line}: [Researched] {first ~60 chars of answer}...
174
+ L{line}: [Researched] {first ~60 chars of answer}...
175
+
176
+ ⚠ Remaining empty lines: {empty-count} (still need answers)
177
+
178
+ Status unchanged — review researched answers before capturing.
179
+ ```
180
+
181
+ **Expected Outcome**: User sees a summary of changes and knows what still needs attention
182
+
183
+ ---
184
+
185
+ ## Verification
186
+
187
+ - [ ] Clarification file located correctly (positional, --latest, or auto-detect)
188
+ - [ ] All response lines classified correctly (empty, research, user-answer)
189
+ - [ ] User answers are completely untouched
190
+ - [ ] Empty response lines are completely untouched
191
+ - [ ] Research-request lines are replaced with `[Researched]` prefixed answers
192
+ - [ ] Answers include file references where applicable
193
+ - [ ] `--dry-run` reports without modifying the file
194
+ - [ ] `--scope` limits research to specified directory
195
+ - [ ] Clarification status is NOT changed
196
+
197
+ ---
198
+
199
+ ## Expected Output
200
+
201
+ ### Files Modified
202
+ - `agent/clarifications/clarification-{N}-{title}.md` - Research-request lines replaced with answers
203
+
204
+ ### Console Output
205
+ ```
206
+ 🔍 Scanning clarification: agent/clarifications/clarification-5-yaml-parser.md
207
+
208
+ Response lines found: 15
209
+ ✎ User answers (untouched): 6
210
+ ⬚ Empty (untouched): 4
211
+ 🔬 Research requests: 5
212
+
213
+ Research items:
214
+ L23: "How does the YAML parser handle nested keys?" — trigger: "research this"
215
+ L45: "What error handling exists for malformed YAML?" — trigger: "agent: check the yaml parser"
216
+ ...
217
+
218
+ ✅ Research Complete!
219
+
220
+ Researched: 5 answers filled in
221
+ Unchanged: 6 user answers + 4 empty lines
222
+
223
+ Status unchanged — review researched answers before capturing.
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Examples
229
+
230
+ ### Example 1: Research Latest Clarification
231
+
232
+ **Context**: Just finished answering some questions in a clarification, left "research this" on others
233
+
234
+ **Invocation**: `@acp.clarifications-research`
235
+
236
+ **Result**: Auto-detects the latest "Awaiting Responses" clarification, finds research markers, explores the codebase, and fills in answers.
237
+
238
+ ### Example 2: Dry Run on Specific File
239
+
240
+ **Context**: Want to see what would be researched before committing
241
+
242
+ **Invocation**: `@acp.clarifications-research agent/clarifications/clarification-5-yaml-parser.md --dry-run`
243
+
244
+ **Result**: Shows list of research items without modifying the file.
245
+
246
+ ### Example 3: Scoped Research
247
+
248
+ **Context**: Questions relate to a specific subsystem
249
+
250
+ **Invocation**: `@acp.clarifications-research --latest --scope agent/scripts/`
251
+
252
+ **Result**: Researches answers but limits codebase exploration to `agent/scripts/`.
253
+
254
+ ---
255
+
256
+ ## Related Commands
257
+
258
+ - [`@acp.clarification-create`](acp.clarification-create.md) - Create clarification documents (run first)
259
+ - [`@acp.clarification-capture`](acp.clarification-capture.md) - Capture answered clarifications into design docs / tasks
260
+ - [`@acp.design-create`](acp.design-create.md) - Create design documents (often follows clarification)
261
+
262
+ ---
263
+
264
+ ## Troubleshooting
265
+
266
+ ### Issue 1: No clarifications found
267
+
268
+ **Symptom**: "No clarification files with status 'Awaiting Responses' found"
269
+
270
+ **Cause**: All clarifications are already captured or completed
271
+
272
+ **Solution**: Create a new clarification with `@acp.clarification-create` or provide a specific file path
273
+
274
+ ### Issue 2: Research answer is "Unable to determine"
275
+
276
+ **Symptom**: Answer says "Unable to determine from codebase — manual answer needed"
277
+
278
+ **Cause**: The question requires knowledge not present in the codebase (e.g., business requirements, user preferences)
279
+
280
+ **Solution**: Replace the `[Researched]` line with a manual answer
281
+
282
+ ### Issue 3: Research scope too narrow
283
+
284
+ **Symptom**: Answers are incomplete or miss relevant code
285
+
286
+ **Cause**: `--scope` flag limited search to a directory that doesn't contain all relevant code
287
+
288
+ **Solution**: Re-run without `--scope` or with a broader scope path
289
+
290
+ ---
291
+
292
+ ## Security Considerations
293
+
294
+ ### File Access
295
+ - **Reads**: Clarification files in `agent/clarifications/`, any codebase files during research
296
+ - **Writes**: The target clarification file only (replacing research-request lines)
297
+ - **Executes**: None
298
+
299
+ ### Network Access
300
+ - **APIs**: None
301
+ - **Repositories**: None
302
+
303
+ ### Sensitive Data
304
+ - **Secrets**: Never include secrets or credentials in researched answers
305
+ - **Credentials**: If a question asks about credentials or secrets, answer with "manual answer needed"
306
+
307
+ ---
308
+
309
+ ## Notes
310
+
311
+ - This command never changes the clarification's `Status:` field — the user should review researched answers and then use `@acp.clarification-capture` when satisfied
312
+ - The `[Researched]` prefix makes it easy to distinguish agent-provided answers from user-provided answers
313
+ - If a researched answer is wrong, the user can simply edit the line — it's still a regular response line
314
+ - The `agent:` prefix on response lines allows users to give specific research directives beyond the standard trigger phrases
315
+ - Research quality depends on the question context — more specific questions yield better answers
316
+
317
+ ---
318
+
319
+ **Namespace**: acp
320
+ **Command**: clarifications-research
321
+ **Version**: 1.0.0
322
+ **Created**: 2026-03-09
323
+ **Last Updated**: 2026-03-09
324
+ **Status**: Active
325
+ **Compatibility**: ACP 5.0.0+
326
+ **Author**: ACP Project