Add comprehensive GitHub Copilot instructions for the repository - #375
Conversation
|
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
|
@copilot This Ruby library in this repo is consumed by OpenProject. You're currently in the process of adding information to that repo over here: Octicons are over here: opf/openproject-octicons#127 (but perhaps you already know that?) |
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
Added a "Related Repositories" section to the copilot instructions documenting the OpenProject main application, upstream Primer ViewComponents, and OpenProject Octicons repositories. This provides better context about the ecosystem for AI tools. (5c0a9f8) |
| - **Ruby**: 3.2.0+ | ||
| - **Rails**: 7.2.0+ | ||
| - **ViewComponent**: 3.1+ to 5.0 | ||
| - **JavaScript/TypeScript**: Component behaviors using Catalyst controllers |
There was a problem hiding this comment.
using custom elements (often via Catalyst controllers)
There was a problem hiding this comment.
Updated to clarify "using custom elements (often via Catalyst controllers)" (e4fab1d)
| if (!window.customElements.get('my-component')) { | ||
| window.MyComponentElement = MyComponentElement | ||
| window.customElements.define('my-component', MyComponentElement) | ||
| } |
There was a problem hiding this comment.
@copilot although prevalent in the existing code, this boilerplate shouldn't be necessary. Catalyst takes care of defining the custom element automatically.
There was a problem hiding this comment.
Removed the custom element registration boilerplate and updated the note to clarify that Catalyst automatically handles this. (e4fab1d)
|
|
||
| ### Playwright Visual Regression Tests | ||
|
|
||
| Add component previews to `static/previews.json`: |
There was a problem hiding this comment.
@copilot This file does not need to be modified manually. There is a Rake task to generate this JSON:
bundle exec rake static:dump
This rake task is invoked by the GitHub workflow: .github/workflows/static-files.yml
There was a problem hiding this comment.
Updated to document that static/previews.json is auto-generated by bundle exec rake static:dump (run automatically by the static-files.yml workflow). Removed the manual JSON example. (e4fab1d)
| - Use `status :open_project` for OpenProject components | ||
| - Document all public APIs with YARD | ||
| - Restrict HTML tags appropriately | ||
| - Use `system_arguments` for HTML attributes |
There was a problem hiding this comment.
@copilot for HTML attributes and styling (via utility classes). Full reference here: https://primer.style/view-components/lookbook/pages/system_arguments/
There was a problem hiding this comment.
Added the system arguments reference link to the Ruby guidelines section. (e4fab1d)
| - Follow ViewComponent best practices | ||
|
|
||
| ### JavaScript/TypeScript | ||
| - Use Catalyst for interactive components |
There was a problem hiding this comment.
Use Web Components for interactive components (consider using Catalyst to DRY up boilerplate involved in creating custom elements)
There was a problem hiding this comment.
Updated to emphasize Web Components as the primary approach, with Catalyst as a tool to reduce boilerplate. (e4fab1d)
|
@HDinger @bsatarnejad would you mind taking a look to see if the instructions are accurate? |
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
|
@copilot general note to add somewhere: we follow coding standards defined by the upstream project (i.e. GitHub), not the guidelines used by OpenProject core. This is both to facilitate upstreaming of our changes and reduce the overhead of maintaining two sets of rules within one repo. Concretely, this means:
|
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
Added a "Coding Standards" section that clarifies we follow upstream GitHub conventions (not OpenProject core), including Minitest (not RSpec) and GitHub's CSS/TypeScript formatting rules. The section explains this facilitates upstreaming and reduces maintenance overhead. (b8ff9e6) |
| - Use TypeScript for type safety | ||
|
|
||
| ### CSS | ||
| - Use BEM-like naming: `.ComponentName-element--modifier` |
| ./script/dev # Start Lookbook on localhost:4000 | ||
| ``` | ||
|
|
||
| ### Creating New Components |
There was a problem hiding this comment.
There's also this page from GitHub, but it's more geared to GitHub staff and to the product/process than technical details.
https://primer.style/product/contribute/adding-new-components/
.github/copilot-instructions.mdfilestatic/previews.jsonis auto-generated viarake static:dumpSummary
Created comprehensive GitHub Copilot instructions at
.github/copilot-instructions.mdthat cover:Repository Context:
Coding Standards:
Component Development:
Testing:
static/previews.jsonis auto-generated bybundle exec rake static:dumpWorkflows:
Code Style:
Quick Reference:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.