Skip to content

AI-generated rule documentation #895

Description

@bmish

With the AI provider infrastructure from #889 and the --ai flag, we can leverage AI to generate rule documentation.

Behavior

--ai (combined with the normal generate flow) would use AI to generate or improve documentation for all rules:

  • Rules without docs get a full draft generated from the rule's source code, meta object, and schema/options.
  • Rules with existing docs get improvements -- filling in missing sections, adding examples of correct/incorrect code, improving descriptions.

The tool writes the results like it normally does. Users review the diff and discard any changes they don't want via their normal git workflow.

What we'd reuse from #889

  • Provider resolution (resolveAiProviderConfig) and multi-provider support (OpenAI, Anthropic, Groq, etc.)
  • --ai, --ai-provider, and --ai-model CLI options
  • Error handling, timeout logic

What we'd need to add

  • A requestAiText() function for free-form text/markdown responses (the current requestAiJsonObject is JSON-only)
  • Parameterized max_tokens and temperature in the request builders (currently hardcoded for short JSON responses)
  • Conditional response_format (skip json_object mode for text responses)
  • Prompt engineering: passing rule source code, meta object, schema, existing doc content, and plugin context

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions