rdcstarr/docs-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rdcstarr/docs-generator

Composer 安装命令:

composer require rdcstarr/docs-generator

包简介

Generate AI-optimized Markdown documentation from Laravel-ecosystem docs sites for Claude, Cursor, and Copilot.

README 文档

README

Generate AI-optimized Markdown documentation from Laravel-ecosystem docs sites (Laravel, Flux UI, Livewire) for Claude Code, Cursor, and GitHub Copilot.

Latest Version on Packagist License

Why

When you work with AI coding assistants in Laravel projects, the model answers better when it has the official docs close at hand — sliced into small Markdown files you can load on demand. This package fetches the public docs, asks an LLM to rewrite each page as a clean, AI-friendly Markdown file, and writes it into the right folder for your IDE (.claude/, .cursor/rules/, or .github/instructions/).

Features

  • Three built-in sources: Laravel, Flux UI (with authentication for Flux Pro), and Livewire
  • Three IDE targets: Claude (with auto-sync of CLAUDE.md index), Cursor (.mdc with frontmatter), Copilot (.instructions.md)
  • Uses the native Laravel AI SDK (laravel/ai) — 10+ providers out of the box: DeepSeek, OpenAI, Anthropic, Gemini, Groq, xAI, Mistral, Ollama, Cohere, and more
  • Configurable per-project: enable only the sources you use
  • Smart retry with rate-limit backoff
  • Skip-existing with --force to regenerate
  • Filter with --only=routing,eloquent during development

Installation

composer require rdcstarr/docs-generator

Publish the Laravel AI SDK config and run its migrations (used internally by laravel/ai):

php artisan vendor:publish --provider="Laravel\Ai\AiServiceProvider"
php artisan migrate

Then publish this package's config:

php artisan vendor:publish --tag=docs-generator-config

Setup

Add the credentials for whichever AI provider and sources you use in .env. API keys are read by the Laravel AI SDK, so you can use any provider it supports:

# DeepSeek (default)
DEEPSEEK_API_KEY=sk-...

# OpenAI
OPENAI_API_KEY=sk-...

# Anthropic
ANTHROPIC_API_KEY=sk-ant-...

# Gemini
GEMINI_API_KEY=...

# Required only if you use the Flux UI source (for Flux Pro access)
FLUXUI_EMAIL=you@example.com
FLUXUI_PASSWORD=your-password

In config/docs-generator.php, keep only the sources you want to generate. For a plain Laravel project without Flux/Livewire:

'sources' => [
    'laravel' => [
        'driver'  => \Rdcstarr\DocsGenerator\Drivers\LaravelDriver::class,
        'version' => '13.x',
    ],
],

Usage

Generate docs for all enabled sources, for Claude (the default target):

php artisan docs:generate

Generate only one source:

php artisan docs:generate laravel
php artisan docs:generate flux
php artisan docs:generate livewire

Target Cursor or Copilot instead of Claude:

php artisan docs:generate --for=cursor
php artisan docs:generate laravel --for=copilot

Force regeneration of already-generated files:

php artisan docs:generate --force

Generate only specific pages (matches by slug, case-insensitive, substring):

php artisan docs:generate laravel --only=routing,eloquent

Use a different AI provider for this run (any key from config/docs-generator.php):

php artisan docs:generate --provider=openai
php artisan docs:generate --provider=anthropic
php artisan docs:generate --provider=gemini

Re-sync the CLAUDE.md index without generating any files:

php artisan docs:generate --sync-only
php artisan docs:generate laravel --sync-only

Output

Claude target (default)

.claude/
├── laravel/
│   ├── index.md         ← per-source index (filenames + H1 titles)
│   ├── routing.md
│   ├── eloquent.md
│   └── ...
├── flux/
│   ├── index.md
│   └── ...
└── livewire/
    ├── index.md
    └── ...
CLAUDE.md                ← single managed block pointing at the per-source indexes

Each source gets its own index.md listing every generated file with its H1 title. Your root CLAUDE.md is touched only between markers:

<!-- docs-generator:start -->
## Generated documentation

Indexes maintained by docs-generator. Load on demand:

- **Flux UI**`.claude/flux/index.md`
- **Laravel**`.claude/laravel/index.md`
- **Livewire**`.claude/livewire/index.md`
<!-- docs-generator:end -->

Anything outside <!-- docs-generator:start --><!-- docs-generator:end --> is preserved untouched, so it's safe to keep your own project instructions in the same file.

Cursor target

.cursor/rules/
├── laravel.routing.mdc       (with Cursor frontmatter)
├── fluxui.button.mdc
└── livewire.actions.mdc

Copilot target

.github/instructions/
├── laravel.routing.instructions.md
├── fluxui.button.instructions.md
└── livewire.actions.instructions.md

Extending

Add a new AI provider entry

Most providers you'd want are already available natively through the Laravel AI SDK (OpenAI, Anthropic, Gemini, Groq, xAI, Mistral, Ollama, Cohere, DeepSeek, …). To add another entry to config/docs-generator.php, point class at LaravelAiProvider and set the SDK provider key plus the model you want:

'providers' => [
    'groq' => [
        'class'    => \Rdcstarr\DocsGenerator\Providers\LaravelAiProvider::class,
        'provider' => 'groq',
        'model'    => env('GROQ_MODEL', 'llama-3.3-70b-versatile'),
        'timeout'  => env('GROQ_TIMEOUT', 60),
    ],
],

Then add GROQ_API_KEY=... to .env and run php artisan docs:generate --provider=groq.

Add a fully custom AI provider

If you need a service not supported by the Laravel AI SDK, implement Rdcstarr\DocsGenerator\Contracts\AIProvider:

namespace App\DocsGenerator;

use Rdcstarr\DocsGenerator\Contracts\AIProvider;

class MyCustomProvider implements AIProvider
{
    public function __construct(array $config) { /* ... */ }

    public function generate(string $prompt): ?string
    {
        // call your API, return Markdown
    }
}

Register it under providers and use it via --provider=mycustom.

Add a custom documentation source

Implement Rdcstarr\DocsGenerator\Contracts\DocsDriver — five methods:

namespace App\DocsGenerator;

use Rdcstarr\DocsGenerator\Contracts\DocsDriver;

class FilamentDriver implements DocsDriver
{
    public function __construct(array $config) { /* ... */ }

    public function name(): string          { return 'filament'; }
    public function indexSection(): string  { return '## Filament'; }
    public function discoverPages(): array  { /* fetch + parse sidebar */ }
    public function fetchPage(string $url): ?string { /* fetch + clean HTML */ }
    public function buildPrompt(string $url, string $html): string { /* prompt */ }
}

Register it under sources in the config. Helpers Rdcstarr\DocsGenerator\Support\HtmlExtractor and SidebarDiscovery are available to keep your driver small.

Add a custom IDE target

Implement Rdcstarr\DocsGenerator\Contracts\Target and register under targets.

Requirements

  • PHP 8.3+
  • Laravel 13+
  • laravel/ai (installed automatically as a dependency)

License

MIT © rdcstarr

rdcstarr/docs-generator 适用场景与选型建议

rdcstarr/docs-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「documentation」 「docs」 「laravel」 「cursor」 「ai」 「copilot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 rdcstarr/docs-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rdcstarr/docs-generator 我们能提供哪些服务?
定制开发 / 二次开发

基于 rdcstarr/docs-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 37
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-18