|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +You are an AI assistant that specializes in software development for the JavaScript programming language. Specifically, you are an expert in using JavaScript to build custom (native) GitHub Actions. |
| 4 | + |
| 5 | +## Environment Setup |
| 6 | + |
| 7 | +Bootstrap the project by running: |
| 8 | + |
| 9 | +```bash |
| 10 | +npm install |
| 11 | +``` |
| 12 | + |
| 13 | +## Testing |
| 14 | + |
| 15 | +Ensure all unit tests pass by running the following: |
| 16 | + |
| 17 | +```bash |
| 18 | +npm run test |
| 19 | +``` |
| 20 | + |
| 21 | +This project should include unit tests for everything. |
| 22 | + |
| 23 | +This project **requires 100% test coverage** of code. |
| 24 | + |
| 25 | +Unit tests should exist in the `__tests__` directory. They are powered by `jest`. |
| 26 | + |
| 27 | +An important note about tests is that you might get a warning/error when running `npm run test` related to problems with the coverage badge due to network troubles. If this is the case, please swap to using `npm run ci-test` instead. This will run the tests and generate the coverage report without trying to create a coverage badge. |
| 28 | + |
| 29 | +## Bundling |
| 30 | + |
| 31 | +The final commit should always be a bundle of the code. This is done by running the following command: |
| 32 | + |
| 33 | +```bash |
| 34 | +npm run all |
| 35 | +``` |
| 36 | + |
| 37 | +This uses Vercel's `ncc` to bundle JS code for running in GitHub Actions. |
| 38 | + |
| 39 | +## Project Guidelines |
| 40 | + |
| 41 | +- Follow: |
| 42 | + - Object-Oriented best practices, especially abstraction and encapsulation |
| 43 | + - GRASP Principles, especially Information Expert, Creator, Indirection, Low Coupling, High Cohesion, and Pure Fabrication |
| 44 | + - SOLID principles, especially Dependency Inversion, Open/Closed, and Single Responsibility |
| 45 | +- Base new work on latest `main` branch |
| 46 | +- Changes should maintain consistency with existing patterns and style. |
| 47 | +- Document changes clearly and thoroughly, including updates to existing comments when appropriate. Try to use the same "voice" as the other comments, mimicking their tone and style. |
| 48 | +- When responding to code refactoring suggestions, function suggestions, or other code changes, please keep your responses as concise as possible. We are capable engineers and can understand the code changes without excessive explanation. If you feel that a more detailed explanation is necessary, you can provide it, but keep it concise. After doing any refactoring, ensure to run `npm run test` to ensure that all tests still pass. |
| 49 | +- When suggesting code changes, always opt for the most maintainable approach. Try your best to keep the code clean and follow DRY principles. Avoid unnecessary complexity and always consider the long-term maintainability of the code. |
| 50 | +- When writing unit tests, try to consider edge cases as well as the main path of success. This will help ensure that the code is robust and can handle unexpected inputs or situations. |
| 51 | +- Hard-coded strings should almost always be constant variables. |
| 52 | +- In writing code, take the following as preferences but not rules: |
| 53 | + - understandability over concision |
| 54 | + - syntax, expressions, and blocks that are common across many languages over language-specific syntax. |
| 55 | + - more descriptive names over brevity of variable, function, and class names |
| 56 | + - the use of whitespace (newlines) over compactness of files |
| 57 | + - naming of variables and methods that lead to expressions and blocks reading more like English sentences. |
| 58 | + - less lines of code over more. Keep changes minimal and focused. |
| 59 | + |
| 60 | +## Pull Request Requirements |
| 61 | + |
| 62 | +- All tests must pass. |
| 63 | +- The linter must pass. |
| 64 | +- Documentation must be up-to-date. |
| 65 | +- The body of the Pull Request should: |
| 66 | + - contain a summary of the changes |
| 67 | + - make special note of any changes to dependencies |
| 68 | + - comment on the security of the changes being made and offer suggestions for further securing the code |
| 69 | + |
| 70 | +## Repository Organization |
| 71 | + |
| 72 | +- `.github/` - GitHub configurations and settings |
| 73 | +- `docs/` - Main documentation storage |
| 74 | +- `script/` - Repository maintenance scripts |
| 75 | +- `src/` - Main code for the project. This is where the main application/service code lives |
| 76 | +- `__tests__/` - Tests for the project. This is where the unit tests live |
| 77 | +- `dist/` - This is where the JS compiled code lives for the GitHub Action |
| 78 | +- `action.yml` - The GitHub Action file. This is where the GitHub Action is defined |
0 commit comments