codeforge-dev 1.5.8 → 1.8.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 (176) hide show
  1. package/.devcontainer/.env +4 -5
  2. package/.devcontainer/.env.example +29 -0
  3. package/.devcontainer/.gitignore +8 -0
  4. package/.devcontainer/.secrets.example +12 -0
  5. package/.devcontainer/CHANGELOG.md +186 -0
  6. package/.devcontainer/CLAUDE.md +108 -21
  7. package/.devcontainer/README.md +173 -57
  8. package/.devcontainer/config/defaults/keybindings.json +5 -0
  9. package/.devcontainer/config/{main-system-prompt.md → defaults/main-system-prompt.md} +135 -2
  10. package/.devcontainer/config/{settings.json → defaults/settings.json} +25 -6
  11. package/.devcontainer/config/file-manifest.json +20 -0
  12. package/.devcontainer/devcontainer.json +38 -2
  13. package/.devcontainer/docs/configuration-reference.md +90 -0
  14. package/.devcontainer/docs/keybindings.md +100 -0
  15. package/.devcontainer/docs/optional-features.md +129 -0
  16. package/.devcontainer/docs/plugins.md +154 -0
  17. package/.devcontainer/docs/troubleshooting.md +128 -0
  18. package/.devcontainer/features/README.md +21 -7
  19. package/.devcontainer/features/agent-browser/install.sh +6 -0
  20. package/.devcontainer/features/ast-grep/install.sh +6 -0
  21. package/.devcontainer/features/biome/README.md +27 -0
  22. package/.devcontainer/features/biome/install.sh +6 -0
  23. package/.devcontainer/features/ccburn/README.md +60 -0
  24. package/.devcontainer/features/ccburn/devcontainer-feature.json +38 -0
  25. package/.devcontainer/features/ccburn/install.sh +180 -0
  26. package/.devcontainer/features/ccstatusline/README.md +22 -21
  27. package/.devcontainer/features/ccstatusline/devcontainer-feature.json +6 -1
  28. package/.devcontainer/features/ccstatusline/install.sh +55 -16
  29. package/.devcontainer/features/ccusage/install.sh +6 -0
  30. package/.devcontainer/features/claude-monitor/install.sh +6 -0
  31. package/.devcontainer/features/dprint/README.md +30 -0
  32. package/.devcontainer/features/dprint/devcontainer-feature.json +18 -0
  33. package/.devcontainer/features/dprint/install.sh +131 -0
  34. package/.devcontainer/features/hadolint/README.md +35 -0
  35. package/.devcontainer/features/hadolint/devcontainer-feature.json +13 -0
  36. package/.devcontainer/features/hadolint/install.sh +86 -0
  37. package/.devcontainer/features/lsp-servers/devcontainer-feature.json +5 -0
  38. package/.devcontainer/features/lsp-servers/install.sh +7 -0
  39. package/.devcontainer/features/mcp-qdrant/devcontainer-feature.json +6 -1
  40. package/.devcontainer/features/mcp-qdrant/install.sh +13 -6
  41. package/.devcontainer/features/mcp-reasoner/devcontainer-feature.json +6 -1
  42. package/.devcontainer/features/mcp-reasoner/install.sh +8 -1
  43. package/.devcontainer/features/notify-hook/devcontainer-feature.json +5 -0
  44. package/.devcontainer/features/notify-hook/install.sh +7 -0
  45. package/.devcontainer/features/ruff/README.md +26 -0
  46. package/.devcontainer/features/ruff/devcontainer-feature.json +21 -0
  47. package/.devcontainer/features/ruff/install.sh +74 -0
  48. package/.devcontainer/features/shellcheck/README.md +38 -0
  49. package/.devcontainer/features/shellcheck/devcontainer-feature.json +13 -0
  50. package/.devcontainer/features/shellcheck/install.sh +24 -0
  51. package/.devcontainer/features/shfmt/README.md +37 -0
  52. package/.devcontainer/features/shfmt/devcontainer-feature.json +13 -0
  53. package/.devcontainer/features/shfmt/install.sh +85 -0
  54. package/.devcontainer/features/splitrail/devcontainer-feature.json +5 -0
  55. package/.devcontainer/features/splitrail/install.sh +7 -0
  56. package/.devcontainer/features/tmux/install.sh +8 -0
  57. package/.devcontainer/features/tree-sitter/install.sh +6 -0
  58. package/.devcontainer/plugins/devs-marketplace/.claude-plugin/marketplace.json +3 -10
  59. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/.claude-plugin/plugin.json +1 -1
  60. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/__pycache__/format-on-stop.cpython-314.pyc +0 -0
  61. package/.devcontainer/plugins/devs-marketplace/plugins/auto-formatter/scripts/format-on-stop.py +133 -13
  62. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/.claude-plugin/plugin.json +1 -1
  63. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/hooks/hooks.json +4 -5
  64. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/__pycache__/lint-file.cpython-314.pyc +0 -0
  65. package/.devcontainer/plugins/devs-marketplace/plugins/auto-linter/scripts/lint-file.py +477 -78
  66. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/.claude-plugin/plugin.json +1 -1
  67. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/AGENT-REDIRECTION.md +226 -0
  68. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/REVIEW-RUBRIC.md +440 -0
  69. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/architect.md +207 -0
  70. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/bash-exec.md +173 -0
  71. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/claude-guide.md +146 -0
  72. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/debug-logs.md +2 -0
  73. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/dependency-analyst.md +250 -0
  74. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/doc-writer.md +246 -0
  75. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/explorer.md +237 -0
  76. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/generalist.md +134 -0
  77. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/git-archaeologist.md +242 -0
  78. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/migrator.md +201 -0
  79. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/perf-profiler.md +265 -0
  80. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/refactorer.md +213 -0
  81. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/researcher.md +195 -0
  82. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/security-auditor.md +289 -0
  83. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/spec-writer.md +297 -0
  84. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/statusline-config.md +188 -0
  85. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/agents/test-writer.md +248 -0
  86. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/hooks/hooks.json +51 -0
  87. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/advisory-test-runner.cpython-314.pyc +0 -0
  88. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/collect-edited-files.cpython-314.pyc +0 -0
  89. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/commit-reminder.cpython-314.pyc +0 -0
  90. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/git-state-injector.cpython-314.pyc +0 -0
  91. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/guard-readonly-bash.cpython-314.pyc +0 -0
  92. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/redirect-builtin-agents.cpython-314.pyc +0 -0
  93. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/skill-suggester.cpython-314.pyc +0 -0
  94. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/syntax-validator.cpython-314.pyc +0 -0
  95. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/ticket-linker.cpython-314.pyc +0 -0
  96. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/todo-harvester.cpython-314.pyc +0 -0
  97. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-no-regression.cpython-314.pyc +0 -0
  98. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/__pycache__/verify-tests-pass.cpython-314.pyc +0 -0
  99. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/advisory-test-runner.py +174 -0
  100. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/collect-edited-files.py +8 -6
  101. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/commit-reminder.py +90 -0
  102. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/git-state-injector.py +114 -0
  103. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/guard-readonly-bash.py +611 -0
  104. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/redirect-builtin-agents.py +83 -0
  105. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/skill-suggester.py +146 -2
  106. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/syntax-validator.py +9 -4
  107. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/ticket-linker.py +137 -0
  108. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/todo-harvester.py +130 -0
  109. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-no-regression.py +221 -0
  110. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/scripts/verify-tests-pass.py +176 -0
  111. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/SKILL.md +224 -0
  112. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/error-handling.md +166 -0
  113. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/api-design/references/rest-conventions.md +215 -0
  114. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/SKILL.md +211 -0
  115. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/ast-grep-patterns/references/language-patterns.md +327 -0
  116. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/SKILL.md +599 -0
  117. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/claude-agent-sdk/references/sdk-typescript-reference.md +954 -0
  118. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/SKILL.md +134 -0
  119. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/ecosystem-commands.md +264 -0
  120. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/dependency-management/references/license-compliance.md +80 -0
  121. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/SKILL.md +153 -0
  122. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/api-doc-templates.md +221 -0
  123. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/documentation-patterns/references/docstring-formats.md +296 -0
  124. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/SKILL.md +276 -0
  125. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/advanced-commands.md +332 -0
  126. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/git-forensics/references/investigation-playbooks.md +319 -0
  127. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/SKILL.md +150 -0
  128. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/javascript-migrations.md +179 -0
  129. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/migration-patterns/references/python-migrations.md +141 -0
  130. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/SKILL.md +341 -0
  131. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/interpreting-results.md +235 -0
  132. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/performance-profiling/references/tool-commands.md +395 -0
  133. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/SKILL.md +344 -0
  134. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/safe-transformations.md +247 -0
  135. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/refactoring-patterns/references/smell-catalog.md +332 -0
  136. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/SKILL.md +277 -0
  137. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/owasp-patterns.md +269 -0
  138. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/security-checklist/references/secrets-patterns.md +253 -0
  139. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/SKILL.md +320 -0
  140. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/criteria-patterns.md +245 -0
  141. package/.devcontainer/plugins/devs-marketplace/plugins/code-directive/skills/specification-writing/references/ears-templates.md +239 -0
  142. package/.devcontainer/plugins/devs-marketplace/plugins/dangerous-command-blocker/scripts/__pycache__/block-dangerous.cpython-314.pyc +0 -0
  143. package/.devcontainer/plugins/devs-marketplace/plugins/notify-hook/hooks/hooks.json +1 -1
  144. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/__pycache__/guard-protected.cpython-314.pyc +0 -0
  145. package/.devcontainer/plugins/devs-marketplace/plugins/protected-files-guard/scripts/guard-protected.py +40 -39
  146. package/.devcontainer/scripts/check-setup.sh +72 -0
  147. package/.devcontainer/scripts/setup-aliases.sh +51 -6
  148. package/.devcontainer/scripts/setup-auth.sh +74 -0
  149. package/.devcontainer/scripts/setup-config.sh +112 -20
  150. package/.devcontainer/scripts/setup-plugins.sh +38 -46
  151. package/.devcontainer/scripts/setup-projects.sh +175 -0
  152. package/.devcontainer/scripts/setup-symlink-claude.sh +36 -0
  153. package/.devcontainer/scripts/setup-update-claude.sh +19 -8
  154. package/.devcontainer/scripts/setup.sh +49 -14
  155. package/README.md +23 -190
  156. package/package.json +1 -1
  157. package/setup.js +245 -71
  158. package/.devcontainer/features/claude-code/README.md +0 -498
  159. package/.devcontainer/features/claude-code/config/settings.json +0 -36
  160. package/.devcontainer/features/claude-code/config/system-prompt.md +0 -118
  161. package/.devcontainer/features/claude-code/config/world-building-sp.md +0 -1432
  162. package/.devcontainer/features/claude-code/devcontainer-feature.json +0 -42
  163. package/.devcontainer/features/claude-code/install.sh +0 -466
  164. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/.claude-plugin/plugin.json +0 -7
  165. package/.devcontainer/plugins/devs-marketplace/plugins/planning-reminder/hooks/hooks.json +0 -17
  166. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/.claude-plugin/plugin.json +0 -6
  167. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/config/planning-instructions.md +0 -14
  168. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/functional-conjuring-map.md +0 -989
  169. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/hooks/hooks.json +0 -33
  170. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/__pycache__/post-enhance-task.cpython-314.pyc +0 -0
  171. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhance-planning.py +0 -71
  172. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-plan.sh +0 -68
  173. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/enhancers/enhance-task.sh +0 -120
  174. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-plan.py +0 -133
  175. package/.devcontainer/plugins/devs-marketplace/plugins/workflow-enhancer/scripts/post-enhance-task.py +0 -253
  176. package/.devcontainer/scripts/setup-irie-claude.sh +0 -32
@@ -0,0 +1,221 @@
1
+ # API Documentation Templates
2
+
3
+ ## REST Endpoint Documentation
4
+
5
+ Use this template for each API endpoint:
6
+
7
+ ### Template
8
+
9
+ ```markdown
10
+ ## [Method] [Path]
11
+
12
+ [One-sentence description of what this endpoint does.]
13
+
14
+ ### Request
15
+
16
+ **URL Parameters:**
17
+
18
+ | Name | Type | Required | Description |
19
+ |------|------|----------|-------------|
20
+ | `id` | string | Yes | The resource identifier |
21
+
22
+ **Query Parameters:**
23
+
24
+ | Name | Type | Required | Default | Description |
25
+ |------|------|----------|---------|-------------|
26
+ | `limit` | integer | No | 20 | Maximum results to return (1-100) |
27
+ | `cursor` | string | No | — | Pagination cursor from previous response |
28
+
29
+ **Request Body:**
30
+
31
+ | Field | Type | Required | Description | Constraints |
32
+ |-------|------|----------|-------------|-------------|
33
+ | `name` | string | Yes | Display name | 1-100 characters |
34
+ | `email` | string | Yes | Email address | Valid email format |
35
+
36
+ **Example Request:**
37
+
38
+ \```bash
39
+ curl -X POST https://api.example.com/v1/users \
40
+ -H "Authorization: Bearer sk-abc123" \
41
+ -H "Content-Type: application/json" \
42
+ -d '{
43
+ "name": "Jane Doe",
44
+ "email": "jane@example.com"
45
+ }'
46
+ \```
47
+
48
+ ### Response
49
+
50
+ **Success (201 Created):**
51
+
52
+ \```json
53
+ {
54
+ "id": "usr_abc123",
55
+ "name": "Jane Doe",
56
+ "email": "jane@example.com",
57
+ "created_at": "2024-01-15T10:30:00Z"
58
+ }
59
+ \```
60
+
61
+ **Error Responses:**
62
+
63
+ | Status | Type | When |
64
+ |--------|------|------|
65
+ | 400 | validation-error | Invalid request body |
66
+ | 401 | authentication-required | Missing or expired token |
67
+ | 409 | resource-conflict | Email already registered |
68
+ | 429 | rate-limit-exceeded | Too many requests |
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Parameter Table Format
74
+
75
+ Always include these columns for parameters:
76
+
77
+ | Column | Purpose |
78
+ |--------|---------|
79
+ | **Name** | Parameter name as it appears in code |
80
+ | **Type** | Data type (string, integer, boolean, array, object) |
81
+ | **Required** | Yes / No |
82
+ | **Default** | Default value if optional (— if none) |
83
+ | **Description** | What this parameter does |
84
+ | **Constraints** | Validation rules (min/max, regex, enum values) |
85
+
86
+ ### Example
87
+
88
+ | Name | Type | Required | Default | Description | Constraints |
89
+ |------|------|----------|---------|-------------|-------------|
90
+ | `page_size` | integer | No | 20 | Results per page | 1–100 |
91
+ | `status` | string | No | — | Filter by status | `active`, `inactive`, `pending` |
92
+ | `created_after` | string | No | — | Filter by creation date | ISO 8601 format |
93
+
94
+ ---
95
+
96
+ ## Request / Response Examples
97
+
98
+ ### curl
99
+
100
+ ```bash
101
+ curl -X GET "https://api.example.com/v1/users?status=active&limit=10" \
102
+ -H "Authorization: Bearer sk-abc123" \
103
+ -H "Accept: application/json"
104
+ ```
105
+
106
+ ### httpie
107
+
108
+ ```bash
109
+ http GET https://api.example.com/v1/users \
110
+ status==active limit==10 \
111
+ Authorization:"Bearer sk-abc123"
112
+ ```
113
+
114
+ ### Python (requests)
115
+
116
+ ```python
117
+ import requests
118
+
119
+ response = requests.get(
120
+ "https://api.example.com/v1/users",
121
+ params={"status": "active", "limit": 10},
122
+ headers={"Authorization": "Bearer sk-abc123"},
123
+ )
124
+ data = response.json()
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Error Response Documentation
130
+
131
+ Document every error code an endpoint can return:
132
+
133
+ ```markdown
134
+ ### Errors
135
+
136
+ | Status | Error Type | Description | Example Detail |
137
+ |--------|-----------|-------------|---------------|
138
+ | 400 | `validation-error` | Request body is malformed | "Missing required field: 'name'" |
139
+ | 401 | `authentication-required` | Token missing or expired | "Access token has expired" |
140
+ | 403 | `insufficient-permissions` | Valid token, wrong scope | "Requires 'admin' scope" |
141
+ | 404 | `resource-not-found` | Resource doesn't exist | "No user with ID 'usr_999'" |
142
+ | 409 | `resource-conflict` | Duplicate or state conflict | "Email already registered" |
143
+ | 422 | `unprocessable-entity` | Valid syntax, invalid data | "Age must be positive" |
144
+ | 429 | `rate-limit-exceeded` | Too many requests | "Retry after 30 seconds" |
145
+ ```
146
+
147
+ ---
148
+
149
+ ## OpenAPI / Swagger Annotations
150
+
151
+ ### Python (FastAPI)
152
+
153
+ ```python
154
+ @router.post(
155
+ "/users",
156
+ response_model=UserResponse,
157
+ status_code=201,
158
+ summary="Create a new user",
159
+ description="Registers a new user account with the provided details.",
160
+ responses={
161
+ 409: {"description": "Email already registered"},
162
+ 422: {"description": "Validation error"},
163
+ },
164
+ )
165
+ async def create_user(user: UserCreate) -> UserResponse:
166
+ ```
167
+
168
+ ### TypeScript (NestJS / Swagger)
169
+
170
+ ```typescript
171
+ @ApiOperation({ summary: 'Create a new user' })
172
+ @ApiResponse({ status: 201, description: 'User created', type: UserResponse })
173
+ @ApiResponse({ status: 409, description: 'Email already registered' })
174
+ @Post('users')
175
+ async createUser(@Body() dto: CreateUserDto): Promise<UserResponse> {
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Mermaid Diagram Quick Reference
181
+
182
+ ### Sequence Diagram
183
+
184
+ ```mermaid
185
+ sequenceDiagram
186
+ participant C as Client
187
+ participant A as API
188
+ participant D as Database
189
+ C->>A: POST /users
190
+ A->>D: INSERT user
191
+ D-->>A: user record
192
+ A-->>C: 201 Created
193
+ ```
194
+
195
+ ### Flowchart
196
+
197
+ ```mermaid
198
+ flowchart TD
199
+ A[Request] --> B{Authenticated?}
200
+ B -->|No| C[401 Unauthorized]
201
+ B -->|Yes| D{Valid Input?}
202
+ D -->|No| E[422 Validation Error]
203
+ D -->|Yes| F[Process Request]
204
+ F --> G[200 OK]
205
+ ```
206
+
207
+ ### Entity Relationship
208
+
209
+ ```mermaid
210
+ erDiagram
211
+ USER ||--o{ ORDER : places
212
+ ORDER ||--|{ LINE_ITEM : contains
213
+ PRODUCT ||--o{ LINE_ITEM : "ordered in"
214
+ ```
215
+
216
+ ### Tips
217
+
218
+ - Keep diagrams **under 10 nodes**. Split complex flows into multiple diagrams.
219
+ - Use descriptive labels on arrows (not just `-->` but `-->|description|`).
220
+ - Mermaid renders in GitHub, VS Code preview, and most documentation platforms.
221
+ - For architecture diagrams, prefer `flowchart` over `graph` (flowchart is the newer syntax).
@@ -0,0 +1,296 @@
1
+ # Docstring Format Reference
2
+
3
+ Complete templates for inline documentation across languages. Detect the project's existing style before adding new docstrings.
4
+
5
+ ---
6
+
7
+ ## Python
8
+
9
+ ### Google-Style (Recommended Default)
10
+
11
+ Detection pattern: `Grep: "Args:"` or `Grep: "Returns:"` in `.py` files.
12
+
13
+ ```python
14
+ def process_payment(amount: float, currency: str, customer_id: str) -> PaymentResult:
15
+ """Process a payment for the given customer.
16
+
17
+ Validates the amount, charges the customer's default payment method,
18
+ and records the transaction in the payment ledger.
19
+
20
+ Args:
21
+ amount: Payment amount in the smallest currency unit (e.g., cents).
22
+ Must be positive.
23
+ currency: ISO 4217 currency code (e.g., "usd", "eur").
24
+ customer_id: The unique customer identifier from the auth system.
25
+
26
+ Returns:
27
+ PaymentResult with transaction ID, status, and timestamp.
28
+
29
+ Raises:
30
+ InvalidAmountError: If amount is negative or zero.
31
+ CustomerNotFoundError: If customer_id doesn't match any customer.
32
+ PaymentGatewayError: If the external payment provider is unreachable.
33
+
34
+ Example:
35
+ >>> result = process_payment(1500, "usd", "cust_abc123")
36
+ >>> result.status
37
+ 'completed'
38
+ """
39
+ ```
40
+
41
+ ### NumPy-Style
42
+
43
+ Detection pattern: `Grep: "Parameters\n----------"` (multiline) or `Grep: "----------"` in docstrings.
44
+
45
+ ```python
46
+ def interpolate(x, y, method="linear"):
47
+ """Interpolate data points using the specified method.
48
+
49
+ Parameters
50
+ ----------
51
+ x : array_like
52
+ The x-coordinates of the data points.
53
+ y : array_like
54
+ The y-coordinates of the data points. Must have the same length as `x`.
55
+ method : str, optional
56
+ Interpolation method. One of 'linear', 'cubic', 'nearest'.
57
+ Default is 'linear'.
58
+
59
+ Returns
60
+ -------
61
+ callable
62
+ An interpolation function that accepts x values and returns
63
+ interpolated y values.
64
+
65
+ Raises
66
+ ------
67
+ ValueError
68
+ If `x` and `y` have different lengths.
69
+
70
+ Examples
71
+ --------
72
+ >>> f = interpolate([0, 1, 2], [0, 1, 4], method='cubic')
73
+ >>> f(1.5)
74
+ 2.25
75
+ """
76
+ ```
77
+
78
+ ### Sphinx / reStructuredText
79
+
80
+ Detection pattern: `Grep: ":param "` or `Grep: ":type "` in `.py` files.
81
+
82
+ ```python
83
+ def connect(host, port, timeout=30):
84
+ """Connect to the remote server.
85
+
86
+ Establishes a TCP connection with configurable timeout.
87
+
88
+ :param host: Server hostname or IP address.
89
+ :type host: str
90
+ :param port: Server port number (1-65535).
91
+ :type port: int
92
+ :param timeout: Connection timeout in seconds. Defaults to 30.
93
+ :type timeout: int
94
+ :returns: Active connection handle.
95
+ :rtype: Connection
96
+ :raises ConnectionError: If the server is unreachable.
97
+ :raises ValueError: If port is out of valid range.
98
+ """
99
+ ```
100
+
101
+ ### Module and Class Docstrings
102
+
103
+ ```python
104
+ """Payment processing module.
105
+
106
+ Handles payment creation, validation, and gateway communication.
107
+ Supports Stripe and PayPal providers via the adapter pattern.
108
+
109
+ See `src/payments/adapters/` for provider implementations.
110
+ """
111
+
112
+
113
+ class PaymentProcessor:
114
+ """Orchestrates payment workflows across multiple providers.
115
+
116
+ Manages provider selection, retry logic, and transaction recording.
117
+ Uses the strategy pattern to delegate provider-specific logic.
118
+
119
+ Attributes:
120
+ default_provider: Name of the fallback payment provider.
121
+ max_retries: Maximum retry attempts for failed transactions.
122
+ """
123
+ ```
124
+
125
+ ---
126
+
127
+ ## TypeScript / JavaScript
128
+
129
+ ### JSDoc
130
+
131
+ Detection pattern: `Grep: "@param "` or `Grep: "@returns"` in `.ts` or `.js` files.
132
+
133
+ ```typescript
134
+ /**
135
+ * Process a payment for the given customer.
136
+ *
137
+ * Validates the amount, charges the customer's default payment method,
138
+ * and records the transaction.
139
+ *
140
+ * @param amount - Payment amount in cents (must be positive)
141
+ * @param currency - ISO 4217 currency code (e.g., "usd", "eur")
142
+ * @param customerId - The unique customer identifier
143
+ * @returns Payment result with transaction ID and status
144
+ * @throws {InvalidAmountError} If amount is negative or zero
145
+ * @throws {CustomerNotFoundError} If customerId doesn't match any customer
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const result = await processPayment(1500, "usd", "cust_abc123");
150
+ * console.log(result.status); // "completed"
151
+ * ```
152
+ */
153
+ async function processPayment(
154
+ amount: number,
155
+ currency: string,
156
+ customerId: string
157
+ ): Promise<PaymentResult> {
158
+ ```
159
+
160
+ ### TSDoc
161
+
162
+ TSDoc is a stricter subset of JSDoc used by TypeScript-focused projects.
163
+
164
+ Key differences from JSDoc:
165
+ - Uses `{@link ClassName}` for references (not `{@see}`)
166
+ - `@param name -` format (with dash separator)
167
+ - `@throws` without type braces (types are in TypeScript)
168
+
169
+ ```typescript
170
+ /**
171
+ * Fetches user data from the API.
172
+ *
173
+ * @param userId - The user's unique identifier
174
+ * @param options - Request configuration
175
+ * @returns The user object, or `undefined` if not found
176
+ *
177
+ * @remarks
178
+ * This method caches results for 5 minutes. Use {@link invalidateCache}
179
+ * to force a fresh fetch.
180
+ */
181
+ ```
182
+
183
+ ### Module / File Headers
184
+
185
+ ```typescript
186
+ /**
187
+ * @module payments
188
+ *
189
+ * Payment processing module handling Stripe and PayPal integrations.
190
+ * Entry point: {@link PaymentProcessor.process}
191
+ */
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Go (godoc)
197
+
198
+ Detection pattern: Comments starting with the function/type name: `Grep: "^// [A-Z]"` before `func` or `type` declarations.
199
+
200
+ ```go
201
+ // ProcessPayment charges the customer's default payment method.
202
+ // Amount is in the smallest currency unit (e.g., cents for USD).
203
+ // Currency must be a valid ISO 4217 code.
204
+ //
205
+ // Returns the transaction result or an error if the charge fails.
206
+ // Possible errors: ErrInvalidAmount, ErrCustomerNotFound, ErrGatewayUnavailable.
207
+ func ProcessPayment(amount int64, currency string, customerID string) (*PaymentResult, error) {
208
+ ```
209
+
210
+ ### Package Comments
211
+
212
+ ```go
213
+ // Package payments provides payment processing across multiple providers.
214
+ //
215
+ // It supports Stripe and PayPal via pluggable adapters. Use NewProcessor
216
+ // to create a processor with the desired provider configuration.
217
+ //
218
+ // Example:
219
+ //
220
+ // p := payments.NewProcessor(payments.WithStripe(apiKey))
221
+ // result, err := p.Process(ctx, 1500, "usd", "cust_123")
222
+ package payments
223
+ ```
224
+
225
+ ### godoc Conventions
226
+
227
+ - First sentence starts with the name being documented: "ProcessPayment charges..."
228
+ - Use complete sentences with proper punctuation.
229
+ - Code examples use tab-indented blocks (no triple backticks).
230
+ - Document exported (capitalized) identifiers only.
231
+
232
+ ---
233
+
234
+ ## Rust (rustdoc)
235
+
236
+ Detection pattern: `Grep: "/// "` or `Grep: "//! "` in `.rs` files.
237
+
238
+ ```rust
239
+ /// Process a payment for the given customer.
240
+ ///
241
+ /// Validates the amount, charges the customer's default payment method,
242
+ /// and records the transaction in the payment ledger.
243
+ ///
244
+ /// # Arguments
245
+ ///
246
+ /// * `amount` - Payment amount in cents (must be positive)
247
+ /// * `currency` - ISO 4217 currency code (e.g., "usd", "eur")
248
+ /// * `customer_id` - The unique customer identifier
249
+ ///
250
+ /// # Returns
251
+ ///
252
+ /// A `PaymentResult` with transaction ID, status, and timestamp.
253
+ ///
254
+ /// # Errors
255
+ ///
256
+ /// Returns `PaymentError::InvalidAmount` if the amount is zero or negative.
257
+ /// Returns `PaymentError::CustomerNotFound` if the customer ID is invalid.
258
+ ///
259
+ /// # Examples
260
+ ///
261
+ /// ```
262
+ /// let result = process_payment(1500, "usd", "cust_abc123")?;
263
+ /// assert_eq!(result.status, PaymentStatus::Completed);
264
+ /// ```
265
+ ///
266
+ /// # Panics
267
+ ///
268
+ /// Panics if the payment gateway client is not initialized. Call
269
+ /// `init_gateway()` before using this function.
270
+ pub fn process_payment(amount: u64, currency: &str, customer_id: &str) -> Result<PaymentResult, PaymentError> {
271
+ ```
272
+
273
+ ### Module Documentation
274
+
275
+ ```rust
276
+ //! Payment processing module.
277
+ //!
278
+ //! Handles payment creation, validation, and gateway communication.
279
+ //! Supports Stripe and PayPal providers via the adapter pattern.
280
+ //!
281
+ //! # Overview
282
+ //!
283
+ //! Use [`PaymentProcessor::new`] to create a processor, then call
284
+ //! [`PaymentProcessor::process`] to execute a payment.
285
+ ```
286
+
287
+ ### Sections Convention
288
+
289
+ | Section | When to Use |
290
+ |---------|------------|
291
+ | `# Arguments` | All public functions with parameters |
292
+ | `# Returns` | Functions that return non-unit types |
293
+ | `# Errors` | Functions that return `Result` |
294
+ | `# Panics` | Functions that can panic |
295
+ | `# Safety` | Unsafe functions — document invariants |
296
+ | `# Examples` | Always for public API |