-
Notifications
You must be signed in to change notification settings - Fork 1
Tailwind Plugin #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…bbfd-f65e309b2cf7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive Tailwind CSS detection and documentation plugin. The plugin scans repositories for Tailwind usage through multiple detection strategies and generates a detailed Markdown summary for inclusion in AGENTS.md.
Key Changes
- Implements robust multi-strategy Tailwind detection (package.json, config files, PostCSS configs, CSS directives)
- Adds comprehensive compile method that generates actionable Markdown documentation
- Includes detailed code documentation explaining detection strategies and output format
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| * suggestions an AI agent can act on immediately. | ||
| * | ||
| * Example | ||
| * const plugin = new TailwindPlugin({ cwd: process.cwd() }); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example shows passing { cwd: process.cwd() } as the context, but the constructor expects a Context type. The example should clarify the expected structure of the Context object to match the actual type definition.
| * const plugin = new TailwindPlugin({ cwd: process.cwd() }); | |
| * // Context type: { cwd: string } | |
| * const context: Context = { cwd: process.cwd() }; | |
| * const plugin = new TailwindPlugin(context); |
| async detect(): Promise<boolean> { | ||
| console.log('✅ Found Tailwind CSS 3.4.0.'); | ||
| return true; | ||
| const cwd = (this.context && (this.context as any).cwd) || process.cwd(); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion (this.context as any).cwd is repeated in both detect() and compile() methods. Consider adding a private helper method getCwd() to centralize this logic and improve maintainability.
| found = true; | ||
| version = deps['tailwindcss']; | ||
| } | ||
| } catch (e) {} |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty catch blocks throughout the file (lines 83, 93, 103, 120, 141, 194, 204, 215, 230, 246, 285) silently swallow errors. Consider logging errors at debug level to aid troubleshooting while maintaining the defensive behavior.
| nodir: true, | ||
| ignore: ['node_modules/**', '.git/**', 'dist/**'], | ||
| }); | ||
| const sample = files.slice(0, 200); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The magic number 200 for sampling CSS files in detect() differs from the 500 limit used in compile() (line 239). Consider extracting these as named constants (e.g., MAX_CSS_FILES_TO_SCAN_DETECT and MAX_CSS_FILES_TO_SCAN_COMPILE) to make the difference intentional and documented.
| : configContent; | ||
| md.push(`- **Tailwind config (first match)**: \`${configPath}\``); | ||
| md.push(''); | ||
| md.push('```js'); |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code block is hard-coded to use 'js' syntax highlighting, but the config file could be TypeScript (.ts extension). Consider using conditional syntax highlighting based on the file extension from configPath.
Another try with another tool @joshmanders