Skip to content

Add comprehensive GitHub Copilot instructions for the repository - #375

Merged
myabc merged 5 commits into
mainfrom
copilot/add-copilot-instructions
Oct 31, 2025
Merged

Add comprehensive GitHub Copilot instructions for the repository#375
myabc merged 5 commits into
mainfrom
copilot/add-copilot-instructions

Conversation

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
  • Create comprehensive .github/copilot-instructions.md file
  • Include repository context (fork of GitHub's Primer ViewComponents)
  • Document component architecture (Alpha, Beta, Stable, OpenProject statuses)
  • Document development workflow and setup
  • Include testing guidelines (unit tests, system tests, Playwright)
  • Document component generation and contribution guidelines
  • Include linting, building, and code style guidelines
  • Document release process with changesets
  • Include fork update process
  • Add JavaScript/TypeScript guidelines (Catalyst controllers)
  • Add related repositories section (OpenProject main repo, upstream, octicons)
  • Add coding standards section (GitHub conventions, not OpenProject core)
  • Update based on code review feedback:
    • Clarified that Web Components are used (often via Catalyst)
    • Removed unnecessary custom element registration boilerplate (Catalyst handles this)
    • Documented that static/previews.json is auto-generated via rake static:dump
    • Added system arguments documentation reference
    • Updated JavaScript/TypeScript guidelines to emphasize Web Components

Summary

Created comprehensive GitHub Copilot instructions at .github/copilot-instructions.md that cover:

Repository Context:

  • Explains this is a fork of GitHub's Primer ViewComponents
  • Describes our OpenProject-specific extensions
  • Documents the relationship with upstream
  • Added related repositories section linking to OpenProject main application, upstream Primer ViewComponents, and OpenProject Octicons

Coding Standards:

  • Emphasizes following upstream GitHub coding standards, not OpenProject core guidelines
  • Explains rationale: facilitates upstreaming changes and reduces maintenance overhead
  • Specifies: Minitest (not RSpec), GitHub's CSS and TypeScript formatting rules

Component Development:

  • Component status levels (alpha, beta, stable, openproject)
  • Component generator usage with examples
  • Ruby, JavaScript/TypeScript, and CSS guidelines
  • YARD documentation requirements
  • Tag restrictions and system arguments
  • Updated: Clarified Web Components usage and Catalyst's automatic custom element registration

Testing:

  • Unit tests with Minitest
  • System tests
  • Playwright visual regression testing
  • Updated: Documented that static/previews.json is auto-generated by bundle exec rake static:dump

Workflows:

  • Setup and development commands
  • Linting and building
  • Changeset usage for versioning
  • Updating from upstream repository

Code Style:

Quick Reference:

  • Common tasks and commands
  • Naming conventions
  • Resources and documentation links
Original prompt

Add comprehensive copilot instructions for this repo.

Bear in mind that this repo is a fork of GitHub's repo: we extend GitHub's implementation of the Primer Design System with additional components to meet our needs.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot

changeset-bot Bot commented Oct 21, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3c6cde1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@myabc myabc added the skip changeset For PRs that contain no relevant release data (e.g. documentation only) label Oct 21, 2025
Co-authored-by: myabc <755+myabc@users.noreply.github.com>
@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

@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:

opf/openproject#20618

Octicons are over here:

opf/openproject-octicons#127
https://github.com/opf/openproject-octicons

(but perhaps you already know that?)

Copilot AI changed the title [WIP] Add comprehensive Copilot instructions for repository Add comprehensive GitHub Copilot instructions for the repository Oct 21, 2025
Copilot AI requested a review from myabc October 21, 2025 13:43
Co-authored-by: myabc <755+myabc@users.noreply.github.com>

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Author

@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:

opf/openproject#20618
...

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)

Comment thread .github/copilot-instructions.md Outdated
- **Ruby**: 3.2.0+
- **Rails**: 7.2.0+
- **ViewComponent**: 3.1+ to 5.0
- **JavaScript/TypeScript**: Component behaviors using Catalyst controllers

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using custom elements (often via Catalyst controllers)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to clarify "using custom elements (often via Catalyst controllers)" (e4fab1d)

Comment thread .github/copilot-instructions.md Outdated
Comment on lines +142 to +145
if (!window.customElements.get('my-component')) {
window.MyComponentElement = MyComponentElement
window.customElements.define('my-component', MyComponentElement)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot although prevalent in the existing code, this boilerplate shouldn't be necessary. Catalyst takes care of defining the custom element automatically.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the custom element registration boilerplate and updated the note to clarify that Catalyst automatically handles this. (e4fab1d)

Comment thread .github/copilot-instructions.md Outdated

### Playwright Visual Regression Tests

Add component previews to `static/previews.json`:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread .github/copilot-instructions.md Outdated
- Use `status :open_project` for OpenProject components
- Document all public APIs with YARD
- Restrict HTML tags appropriately
- Use `system_arguments` for HTML attributes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot for HTML attributes and styling (via utility classes). Full reference here: https://primer.style/view-components/lookbook/pages/system_arguments/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the system arguments reference link to the Ruby guidelines section. (e4fab1d)

Comment thread .github/copilot-instructions.md Outdated
- Follow ViewComponent best practices

### JavaScript/TypeScript
- Use Catalyst for interactive components

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Web Components for interactive components (consider using Catalyst to DRY up boilerplate involved in creating custom elements)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to emphasize Web Components as the primary approach, with Catalyst as a tool to reduce boilerplate. (e4fab1d)

@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

@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 AI requested a review from myabc October 21, 2025 14:07
@myabc
myabc requested a review from HDinger October 21, 2025 14:13
@myabc

myabc commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

@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:

  • minitest not RSpec
  • GitHub's CSS and TypeScript formatting rules

Co-authored-by: myabc <755+myabc@users.noreply.github.com>

Copilot AI commented Oct 21, 2025

Copy link
Copy Markdown
Author

@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. Thi...

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)

Copilot AI requested a review from myabc October 21, 2025 14:23
- Use TypeScript for type safety

### CSS
- Use BEM-like naming: `.ComponentName-element--modifier`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HDinger does Primer use proper BEM?

./script/dev # Start Lookbook on localhost:4000
```

### Creating New Components

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/

@myabc
myabc marked this pull request as ready for review October 21, 2025 14:28
@myabc
myabc requested a review from bsatarnejad October 21, 2025 14:28
@myabc
myabc merged commit 88fcfa2 into main Oct 31, 2025
24 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changeset For PRs that contain no relevant release data (e.g. documentation only)

Development

Successfully merging this pull request may close these issues.

3 participants