Skip to content

Conversation

akrista
Copy link

@akrista akrista commented Oct 5, 2025

fix: update Copilot instructions generation to output .github/instructions/laravel-boost.instructions.md with frontmatter support

Summary

This PR is kinda duplicate from #284 and refactors how we generate GitHub Copilot instructions.
Instead of using copilot-instructions.md, we now:

  • Mirror the existing .cursor/rules/laravel-boost.mdc behavior for consistency using .github/instructions/laravel-boost.instructions.md

Changes

  1. Copilot.php

    • Updated the path to reflect the .github/instructions/… directory structure and added frontmatter support so you can pass metadata (like applyTo) into the generated instructions.
  2. GuidelineWriter.php

    • Introduced an instanceof Copilot check to route Copilot-specific guideline frontmatter generation appropriately.
  3. CodeEnvironmentsDetectorTest.php

    • Updated test paths to reflect the .github/instructions/… directory structure.

Affected files

  • tests/Unit/Install/CodeEnvironmentsDetectorTest.php
  • src/Install/CodeEnvironment/Copilot.php
  • src/Install/GuidelineWriter.php

Honestly, for GuidelineWriter.php I just added a simple check instanceof Copilot using AI, so please let me know if these changes don't fit the contribution guidelines or anything.

References

…ions/laravel-boost.instructions.md with frontmatter support
@pushpak1300
Copy link
Member

Mirror the existing .cursor/rules/laravel-boost.mdc behavior for consistency using .github/instructions/laravel-boost.instructions.md.

Cursor doesn’t currently support applying rules globally, so having them defined by name makes sense.
In contrast, GitHub Copilot does provide a way to apply rules globally through a single file:

A single [.github/copilot-instructions.md](https://code.visualstudio.com/docs/copilot/customization/custom-instructions#_use-a-githubcopilotinstructionsmd-file)
Automatically applies to all chat requests in the workspace
Stored within the workspace

Hence, Copilot can handle global rule application natively.

What are the benefits of using instruction folder vs global rules as in the MR the rules are being applied globally ?

@akrista
Copy link
Author

akrista commented Oct 5, 2025

What are the benefits of using instruction folder vs global rules as in the MR the rules are being applied globally ?

none tbh, essentially:

.github\copilot-instructions.md

<laravel-boost-guidelines>
=== foundation rules ===
...

is functionally the same as:

.github\instructions\laravel-boost.instructions.md

---
applyTo: "**"
---
<laravel-boost-guidelines>
=== foundation rules ===
...

Cursor doesn’t currently support applying rules globally, so having them defined by name makes sense.

Cursor and other IDEs have used global rules files before (e.g. .cursorrules, .windsurfrules, .clinerules).

.cursorrules is still supported, but it will be deprecated. In theory, we could use .cursorrules instead of laravel-boost.mdc, right?

However, I don’t think a single file should hold all AI guidelines/rules. While you could group Laravel-specific rules with business or app rules in one global file, each rule set—like Laravel Boost—deserves its own dedicated file rather than being mixed into the global one.

I understand that other AI coding agents like Junie only handles one guideline file (if I’m not mistaken), but I suspect Cursor chose to split rules into multiple folders/files so you can control exactly when and how much context the AI receives.

For example, Windsurf rules only support up to 12,000 characters per file:
https://docs.windsurf.com/windsurf/cascade/memories#rules-storage-locations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants