ace-docs 0.31.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 (91) hide show
  1. checksums.yaml +7 -0
  2. data/.ace-defaults/docs/config.yml +169 -0
  3. data/.ace-defaults/docs/multi-subject-example.md +130 -0
  4. data/.ace-defaults/docs/single-subject-example.md +150 -0
  5. data/.ace-defaults/nav/protocols/guide-sources/ace-docs.yml +10 -0
  6. data/.ace-defaults/nav/protocols/prompt-sources/ace-docs.yml +34 -0
  7. data/.ace-defaults/nav/protocols/tmpl-sources/ace-docs.yml +10 -0
  8. data/.ace-defaults/nav/protocols/wfi-sources/ace-docs.yml +19 -0
  9. data/CHANGELOG.md +1082 -0
  10. data/LICENSE +21 -0
  11. data/README.md +40 -0
  12. data/Rakefile +14 -0
  13. data/exe/ace-docs +14 -0
  14. data/handbook/guides/documentation/ruby.md +16 -0
  15. data/handbook/guides/documentation/rust.md +35 -0
  16. data/handbook/guides/documentation/typescript.md +18 -0
  17. data/handbook/guides/documentation.g.md +437 -0
  18. data/handbook/guides/documents-embedded-sync.g.md +473 -0
  19. data/handbook/guides/documents-embedding.g.md +276 -0
  20. data/handbook/guides/markdown-style.g.md +290 -0
  21. data/handbook/prompts/ace-change-analyzer.system.md +113 -0
  22. data/handbook/prompts/ace-change-analyzer.user.md +95 -0
  23. data/handbook/prompts/document-analysis.md +74 -0
  24. data/handbook/prompts/document-analysis.system.md +129 -0
  25. data/handbook/prompts/markdown-style.system.md +113 -0
  26. data/handbook/skills/as-docs-create-adr/SKILL.md +35 -0
  27. data/handbook/skills/as-docs-create-api/SKILL.md +35 -0
  28. data/handbook/skills/as-docs-create-user/SKILL.md +35 -0
  29. data/handbook/skills/as-docs-maintain-adrs/SKILL.md +35 -0
  30. data/handbook/skills/as-docs-squash-changelog/SKILL.md +42 -0
  31. data/handbook/skills/as-docs-update/SKILL.md +36 -0
  32. data/handbook/skills/as-docs-update-blueprint/SKILL.md +28 -0
  33. data/handbook/skills/as-docs-update-roadmap/SKILL.md +24 -0
  34. data/handbook/skills/as-docs-update-tools/SKILL.md +36 -0
  35. data/handbook/skills/as-docs-update-usage/SKILL.md +26 -0
  36. data/handbook/templates/code-docs/javascript-jsdoc.template.md +102 -0
  37. data/handbook/templates/code-docs/ruby-yard.template.md +85 -0
  38. data/handbook/templates/project-docs/README.template.md +73 -0
  39. data/handbook/templates/project-docs/architecture.template.md +300 -0
  40. data/handbook/templates/project-docs/blueprint.template.md +165 -0
  41. data/handbook/templates/project-docs/context/ownership.yml +160 -0
  42. data/handbook/templates/project-docs/decisions/adr.template.md +60 -0
  43. data/handbook/templates/project-docs/prd.template.md +144 -0
  44. data/handbook/templates/project-docs/roadmap/roadmap.template.md +47 -0
  45. data/handbook/templates/project-docs/vision.template.md +233 -0
  46. data/handbook/templates/user-docs/user-guide.template.md +107 -0
  47. data/handbook/workflow-instructions/docs/create-adr.wf.md +334 -0
  48. data/handbook/workflow-instructions/docs/create-api.wf.md +448 -0
  49. data/handbook/workflow-instructions/docs/create-cookbook.wf.md +434 -0
  50. data/handbook/workflow-instructions/docs/create-user.wf.md +399 -0
  51. data/handbook/workflow-instructions/docs/maintain-adrs.wf.md +589 -0
  52. data/handbook/workflow-instructions/docs/squash-changelog.wf.md +246 -0
  53. data/handbook/workflow-instructions/docs/update-blueprint.wf.md +361 -0
  54. data/handbook/workflow-instructions/docs/update-context.wf.md +336 -0
  55. data/handbook/workflow-instructions/docs/update-roadmap.wf.md +421 -0
  56. data/handbook/workflow-instructions/docs/update-tools.wf.md +307 -0
  57. data/handbook/workflow-instructions/docs/update-usage.wf.md +710 -0
  58. data/handbook/workflow-instructions/docs/update.wf.md +418 -0
  59. data/lib/ace/docs/atoms/diff_filterer.rb +131 -0
  60. data/lib/ace/docs/atoms/frontmatter_free_matcher.rb +20 -0
  61. data/lib/ace/docs/atoms/git_date_resolver.rb +16 -0
  62. data/lib/ace/docs/atoms/readme_metadata_inferrer.rb +60 -0
  63. data/lib/ace/docs/atoms/terminology_extractor.rb +308 -0
  64. data/lib/ace/docs/atoms/time_range_calculator.rb +96 -0
  65. data/lib/ace/docs/atoms/timestamp_parser.rb +106 -0
  66. data/lib/ace/docs/atoms/type_inferrer.rb +70 -0
  67. data/lib/ace/docs/cli/commands/analyze.rb +351 -0
  68. data/lib/ace/docs/cli/commands/analyze_consistency.rb +185 -0
  69. data/lib/ace/docs/cli/commands/discover.rb +75 -0
  70. data/lib/ace/docs/cli/commands/scope_options.rb +71 -0
  71. data/lib/ace/docs/cli/commands/status.rb +241 -0
  72. data/lib/ace/docs/cli/commands/update.rb +198 -0
  73. data/lib/ace/docs/cli/commands/validate.rb +225 -0
  74. data/lib/ace/docs/cli.rb +60 -0
  75. data/lib/ace/docs/models/analysis_report.rb +120 -0
  76. data/lib/ace/docs/models/consistency_report.rb +259 -0
  77. data/lib/ace/docs/models/document.rb +354 -0
  78. data/lib/ace/docs/molecules/change_detector.rb +389 -0
  79. data/lib/ace/docs/molecules/document_loader.rb +133 -0
  80. data/lib/ace/docs/molecules/frontmatter_manager.rb +85 -0
  81. data/lib/ace/docs/molecules/git_date_resolver.rb +30 -0
  82. data/lib/ace/docs/organisms/cross_document_analyzer.rb +274 -0
  83. data/lib/ace/docs/organisms/document_registry.rb +318 -0
  84. data/lib/ace/docs/organisms/validator.rb +164 -0
  85. data/lib/ace/docs/prompts/compact_diff_prompt.rb +119 -0
  86. data/lib/ace/docs/prompts/consistency_prompt.rb +286 -0
  87. data/lib/ace/docs/prompts/document_analysis_prompt.rb +389 -0
  88. data/lib/ace/docs/version.rb +7 -0
  89. data/lib/ace/docs.rb +82 -0
  90. data/lib/test.rb +4 -0
  91. metadata +347 -0
@@ -0,0 +1,448 @@
1
+ ---
2
+ doc-type: workflow
3
+ title: Create API Documentation Workflow Instruction
4
+ purpose: Documentation for ace-docs/handbook/workflow-instructions/docs/create-api.wf.md
5
+ ace-docs:
6
+ last-updated: 2026-02-23
7
+ last-checked: 2026-03-21
8
+ ---
9
+
10
+ # Create API Documentation Workflow Instruction
11
+
12
+ ## Goal
13
+
14
+ Generate or update API documentation for public interfaces (classes, modules, methods) using standard documentation
15
+ tools and following consistent documentation patterns.
16
+
17
+ ## Prerequisites
18
+
19
+ * Code with public interfaces that need documentation
20
+ * Documentation generation tool configured (e.g., YARD for Ruby, JSDoc for JavaScript)
21
+ * Understanding of the code's functionality and intended usage
22
+
23
+ ## Project Context Loading
24
+
25
+ * Read and follow: `ace-bundle wfi://bundle`
26
+
27
+ ## High-Level Execution Plan
28
+
29
+ ### Planning Steps
30
+
31
+ * Identify target code requiring API
32
+ documentation
33
+ * Analyze code structure to understand
34
+ interfaces and functionality
35
+ * Determine appropriate documentation
36
+ standards for the project's technology stack
37
+
38
+
39
+ ### Execution Steps
40
+
41
+ * Write comprehensive documentation
42
+ comments for all public APIs
43
+ * Include usage examples and parameter
44
+ descriptions
45
+ * Generate and review documentation output
46
+ * Fix any formatting or content issues
47
+ * Commit documentation updates to version
48
+ control
49
+
50
+
51
+ ## Process Steps
52
+
53
+ 1. **Identify Target Code:**
54
+ * Determine which code needs documentation:
55
+ * New classes, modules, or methods
56
+ * Modified public APIs
57
+ * Undocumented public interfaces
58
+ * Code with outdated documentation
59
+ * Priority order:
60
+ * Public APIs used by external consumers
61
+ * Core domain models and services
62
+ * Utility classes and helpers
63
+ * Internal implementation details (lower priority)
64
+ 2. **Analyze Code Structure:**
65
+ * Review the code to understand:
66
+ * Purpose and responsibility
67
+ * Input parameters and their types
68
+ * Return values and types
69
+ * Possible exceptions or errors
70
+ * Side effects or state changes
71
+ * Usage patterns and examples
72
+ * Performance characteristics
73
+ * Thread safety considerations
74
+ 3. **Write Documentation Comments:**
75
+
76
+ **Ruby/YARD Example:**
77
+
78
+ Use the Ruby YARD template:
79
+
80
+ **JavaScript/JSDoc Example:**
81
+
82
+ Use the JavaScript JSDoc template:
83
+
84
+ 4. **Documentation Standards:**
85
+
86
+ **Required Elements:**
87
+
88
+ * **Description**: Clear, concise explanation of what the code does
89
+ * **Parameters**: All parameters with types and descriptions
90
+ * **Return Value**: Type and description of what's returned
91
+ * **Exceptions**: All possible exceptions/errors that can be thrown
92
+ * **Examples**: At least one realistic usage example **Optional Elements:**
93
+
94
+ * **Notes**: Important behaviors, constraints, or warnings
95
+ * **See Also**: Links to related classes, methods, or docs
96
+ * **Since**: Version when added (for public APIs)
97
+ * **Deprecated**: Deprecation notices with migration path
98
+ * **Todo**: Known limitations or future improvements
99
+ 5. **Common Documentation Patterns:**
100
+
101
+ **Class/Module Documentation:**
102
+
103
+ # Handles user authentication and session management
104
+ #
105
+ # This module provides methods for authenticating users,
106
+ # managing sessions, and handling authentication tokens.
107
+ # It supports multiple authentication strategies including
108
+ # password-based and OAuth.
109
+ #
110
+ # @example Basic authentication
111
+ # include Authentication
112
+ #
113
+ # if authenticate_user(email, password)
114
+ # # User authenticated successfully
115
+ # end
116
+ #
117
+ # @see AuthenticationStrategy
118
+ # @see SessionManager
119
+ module Authentication
120
+ {: .language-ruby}
121
+
122
+ **Configuration/Options Documentation:**
123
+
124
+ # @param options [Hash] Configuration options
125
+ # @option options [Integer] :timeout (30) Request timeout in seconds
126
+ # @option options [Integer] :retries (3) Number of retry attempts
127
+ # @option options [Boolean] :ssl_verify (true) Whether to verify SSL
128
+ # @option options [Logger] :logger (Rails.logger) Logger instance
129
+ {: .language-ruby}
130
+
131
+ **Callback/Block Documentation:**
132
+
133
+ # @yield [item] Gives each item to the block
134
+ # @yieldparam item [Item] The current item being processed
135
+ # @yieldreturn [Boolean] Whether to include the item
136
+ {: .language-ruby}
137
+
138
+ 6. **Generate and Review Documentation:**
139
+
140
+ # Ruby/YARD
141
+ bundle exec yard doc
142
+ bundle exec yard server # View at http://localhost:8808
143
+
144
+ # JavaScript/JSDoc
145
+ npx jsdoc -c jsdoc.json
146
+
147
+ # Python/Sphinx
148
+ sphinx-build -b html source build
149
+ {: .language-bash}
150
+
151
+ **Review Checklist:**
152
+
153
+ * All public methods are documented
154
+ * Parameter types are accurate
155
+ * Examples are correct and runnable
156
+ * Links are not broken
157
+ * Formatting renders correctly
158
+ * No spelling/grammar errors
159
+ {: .task-list}
160
+
161
+ 7. **Common Issues and Fixes:**
162
+
163
+ **Missing Types:**
164
+
165
+ # Bad - missing type information
166
+ # @param user The user to process
167
+
168
+ # Good - includes type
169
+ # @param user [User] The user to process
170
+ {: .language-ruby}
171
+
172
+ **Vague Descriptions:**
173
+
174
+ # Bad - too vague
175
+ # Processes the data
176
+
177
+ # Good - specific and helpful
178
+ # Validates and transforms user input data into a normalized format
179
+ # suitable for database storage
180
+ {: .language-ruby}
181
+
182
+ **No Examples:**
183
+
184
+ # Bad - no usage example
185
+ # @return [Hash] The result
186
+
187
+ # Good - shows how to use
188
+ # @return [Hash] The result containing :status and :data
189
+ # @example
190
+ # result = process_data(input)
191
+ # puts result[:status] # => :success
192
+ # puts result[:data] # => { processed: true }
193
+ {: .language-ruby}
194
+
195
+ 8. **Commit Documentation Updates:**
196
+
197
+ git add -A
198
+ git commit -m "docs(api): update documentation for PaymentService
199
+
200
+ - Add comprehensive YARD documentation
201
+ - Include usage examples
202
+ - Document all exceptions
203
+ - Add parameter type information"
204
+ {: .language-bash}
205
+
206
+ ## Success Criteria
207
+
208
+ * All public APIs have complete documentation comments
209
+ * Documentation includes all required elements (description, params, returns, examples)
210
+ * Generated documentation is accurate and renders correctly
211
+ * No broken links or formatting errors
212
+ * Examples are realistic and helpful
213
+ * Documentation follows consistent style and format
214
+
215
+ ## Best Practices
216
+
217
+ **DO:**
218
+
219
+ * Write documentation as you code
220
+ * Include real-world examples
221
+ * Document edge cases and gotchas
222
+ * Keep descriptions concise but complete
223
+ * Update docs when code changes
224
+ * Use consistent terminology
225
+
226
+ **DON'T:**
227
+
228
+ * Leave TODOs in public API docs
229
+ * Include implementation details
230
+ * Copy-paste without reviewing
231
+ * Use ambiguous language
232
+ * Document obvious things
233
+ * Forget to document exceptions
234
+
235
+ ## Documentation Tools by Language
236
+
237
+ * **Ruby**: YARD (`yard doc`)
238
+ * **JavaScript**: JSDoc (`jsdoc`)
239
+ * **TypeScript**: TypeDoc (`typedoc`)
240
+ * **Python**: Sphinx (`sphinx-build`)
241
+ * **Java**: Javadoc (`javadoc`)
242
+ * **C#**: XML Documentation (`///`)
243
+
244
+ ## Common Patterns
245
+
246
+ ### New Feature API Documentation
247
+
248
+ Document public interfaces when adding new features or capabilities to existing modules.
249
+
250
+ ### Refactoring Documentation Updates
251
+
252
+ Update API documentation when refactoring changes method signatures or behavior.
253
+
254
+ ### Legacy Code Documentation
255
+
256
+ Add comprehensive documentation to existing code that lacks proper API documentation.
257
+
258
+ ### Documentation Generation Integration
259
+
260
+ Integrate API documentation generation into the build process for automatic updates.
261
+
262
+ ## Usage Example
263
+
264
+ > "I've added new public methods to the PaymentService class. Help me create proper API documentation for these
265
+ > methods."
266
+
267
+ * * *
268
+
269
+ This workflow ensures comprehensive, consistent API documentation that helps developers understand and use your code
270
+ effectively.
271
+
272
+ <documents>
273
+ <template name="ruby-yard"># Ruby YARD Documentation Template
274
+
275
+ ```ruby
276
+ # [Brief description of what this method/class does]
277
+ #
278
+ # [Detailed description including purpose, behavior, and context.
279
+ # Explain what the method/class does, why it's useful, and how it fits
280
+ # into the larger system.]
281
+ #
282
+ # @example [Example title]
283
+ # [code example showing basic usage]
284
+ #
285
+ # @example [Another example title]
286
+ # [code example showing advanced usage or error handling]
287
+ #
288
+ # @param [parameter_name] [Type] [Description of parameter]
289
+ # @param [another_param] [Type] [Description with constraints/validation]
290
+ # @param [options] [Hash] [Description of options hash]
291
+ # @option options [Type] :option_name (default_value) [Description]
292
+ # @option options [Type] :another_option [Description]
293
+ #
294
+ # @return [ReturnType] [Description of what is returned]
295
+ #
296
+ # @raise [ExceptionClass] [Description of when this exception is raised]
297
+ # @raise [AnotherException] [Description of another exception condition]
298
+ #
299
+ # @note [Important note about usage, threading, performance, etc.]
300
+ # @note [Another important note]
301
+ #
302
+ # @see [RelatedClass]
303
+ # @see [RelatedMethod]
304
+ # @see [URL to external documentation]
305
+ #
306
+ # @since [version when this was added]
307
+ # @deprecated [version when deprecated] Use [alternative] instead
308
+ #
309
+ def method_name(parameter_name:, another_param:, **options)
310
+ # Implementation
311
+ end
312
+ ```
313
+
314
+ ## YARD Tag Reference
315
+
316
+ ### Basic Tags
317
+
318
+ - `@param` - Parameter documentation
319
+ - `@return` - Return value documentation
320
+ - `@raise` - Exception documentation
321
+ - `@example` - Code examples
322
+ - `@note` - Important notes
323
+ - `@see` - Cross-references
324
+
325
+ ### Metadata Tags
326
+
327
+ - `@since` - Version when added
328
+ - `@deprecated` - Deprecation notice
329
+ - `@author` - Author information
330
+ - `@version` - Version information
331
+
332
+ ### Advanced Tags
333
+
334
+ - `@option` - Hash option documentation
335
+ - `@overload` - Method overloads
336
+ - `@yield` - Block documentation
337
+ - `@yieldparam` - Block parameter documentation
338
+ - `@yieldreturn` - Block return documentation
339
+
340
+ ## Documentation Guidelines
341
+
342
+ 1. **Start with a brief one-line summary**
343
+ 2. **Follow with detailed description if needed**
344
+ 3. **Provide realistic examples**
345
+ 4. **Document all parameters and return values**
346
+ 5. **Include exception conditions**
347
+ 6. **Add notes for important behavior**
348
+ 7. **Use cross-references for related code**
349
+ </template>
350
+
351
+ <template name="javascript-jsdoc"># JavaScript JSDoc Documentation Template
352
+
353
+ ```javascript
354
+ /**
355
+ * [Brief description of what this function/class does]
356
+ *
357
+ * @description [Detailed description including purpose, behavior, and context.
358
+ * Explain what the function/class does, why it's useful, and how it fits
359
+ * into the larger system.]
360
+ *
361
+ * @param {Type} parameterName - [Description of parameter]
362
+ * @param {Type} anotherParam - [Description with constraints/validation]
363
+ * @param {Object} [options={}] - [Description of options object]
364
+ * @param {Type} [options.optionName=defaultValue] - [Description of option]
365
+ * @param {Type} [options.anotherOption] - [Description of another option]
366
+ *
367
+ * @returns {Type|Promise<Type>} [Description of what is returned]
368
+ *
369
+ * @throws {ErrorClass} [Description of when this error is thrown]
370
+ * @throws {AnotherError} [Description of another error condition]
371
+ *
372
+ * @example
373
+ * // [Example title - basic usage]
374
+ * const result = functionName(param1, param2);
375
+ *
376
+ * @example
377
+ * // [Example title - advanced usage]
378
+ * try {
379
+ * const result = await functionName({
380
+ * param: 'value',
381
+ * options: { setting: true }
382
+ * });
383
+ * } catch (error) {
384
+ * console.error('Error:', error.message);
385
+ * }
386
+ *
387
+ * @since [version when added]
388
+ * @deprecated [version when deprecated] Use [alternative] instead
389
+ */
390
+ function functionName(parameterName, anotherParam, options = {}) {
391
+ // Implementation
392
+ }
393
+ ```
394
+
395
+ ## JSDoc Tag Reference
396
+
397
+ ### Basic Tags
398
+
399
+ - `@param {Type} name - description` - Parameter documentation
400
+ - `@returns {Type} description` - Return value documentation
401
+ - `@throws {ErrorType} description` - Exception documentation
402
+ - `@example` - Code examples
403
+ - `@description` - Detailed description
404
+
405
+ ### Type Annotations
406
+
407
+ - `{string}` - String type
408
+ - `{number}` - Number type
409
+ - `{boolean}` - Boolean type
410
+ - `{Object}` - Object type
411
+ - `{Array<Type>}` - Array of specific type
412
+ - `{Type|null}` - Union types
413
+ - `{Promise<Type>}` - Promise types
414
+
415
+ ### Optional Parameters
416
+
417
+ - `{Type} [paramName]` - Optional parameter
418
+ - `{Type} [paramName=defaultValue]` - Optional with default
419
+
420
+ ### Metadata Tags
421
+
422
+ - `@since` - Version when added
423
+ - `@deprecated` - Deprecation notice
424
+ - `@author` - Author information
425
+ - `@version` - Version information
426
+
427
+ ### Advanced Tags
428
+
429
+ - `@namespace` - Namespace documentation
430
+ - `@class` - Class documentation
431
+ - `@module` - Module documentation
432
+ - `@async` - Async function marker
433
+ - `@static` - Static method marker
434
+
435
+ ## Documentation Guidelines
436
+
437
+ 1. **Use TypeScript-style type annotations**
438
+ 2. **Provide clear parameter descriptions**
439
+ 3. **Include realistic examples**
440
+ 4. **Document all possible exceptions**
441
+ 5. **Use @description for complex explanations**
442
+ 6. **Mark optional parameters clearly**
443
+ 7. **Include version information for new features**
444
+ </template>
445
+
446
+ </documents>
447
+ </Type></Type></Type></template></documents>
448
+