|
| 1 | +# Contributing |
| 2 | +Interested in contributing to the project? Review the following guidelines and our [planned architecture](./docs/architecture.md) to make sure |
| 3 | +your contribution is aligned with the project's goals. |
| 4 | + |
| 5 | +## Development |
| 6 | + |
| 7 | +### Environment setup |
| 8 | + |
| 9 | +#### Tools |
| 10 | +- [Node.js](https://nodejs.org/en/download/package-manager) |
| 11 | +- NPM (or equivalent package manager) |
| 12 | +- Git configured with your GitHub account |
| 13 | + |
| 14 | +#### Project setup |
| 15 | +- Fork and clone the repository |
| 16 | +- Open your terminal, or equivalent, in the codebase context and run the following commands |
| 17 | + ```bash |
| 18 | + npm install |
| 19 | + npm run build |
| 20 | + npm test |
| 21 | + npm run test:integration |
| 22 | + npm start |
| 23 | + ``` |
| 24 | + All tests should pass, and the application should start successfully with confirmation messaging in the terminal. |
| 25 | + |
| 26 | +#### Development workflow |
| 27 | +- Make changes to the codebase |
| 28 | +- Run tests to verify your changes do not break existing functionality |
| 29 | +- Commit your changes and push them to your fork |
| 30 | +- Open a pull request |
| 31 | + |
| 32 | +### Using Git |
| 33 | + |
| 34 | +#### Workflow |
| 35 | +Our process follows the standard GitHub fork and pull request workflow. |
| 36 | + |
| 37 | +- Fork the repository |
| 38 | +- Create a branch for your changes |
| 39 | +- Submit a pull request towards the main repository default branch |
| 40 | + |
| 41 | +##### Main repository branches |
| 42 | +- The `main` branch currently represents both development and stable releases |
| 43 | + |
| 44 | +> In the future, a consideration for a `stable` branch may be made against an increase in contributions. |
| 45 | +> - `main` would be the default branch for development and feature work rebased from `stable` after release. |
| 46 | +> - `stable` would be a branch used for stable releases/hashes, reference links, and only updated with release commits. |
| 47 | +
|
| 48 | +#### Pull requests |
| 49 | + |
| 50 | +Development pull requests (PRs) should be opened against the default branch. |
| 51 | + |
| 52 | +> If your pull request work contains any of the following warning signs |
| 53 | +> - has no related issue |
| 54 | +> - ignores existing code style |
| 55 | +> - out of sync commits (not rebased against the default branch) |
| 56 | +> - poorly structured commits and messages |
| 57 | +> - any one commit relies on other commits to work (beyond "review requested updates") |
| 58 | +> - dramatic file restructures that attempt complex behavior |
| 59 | +> - missing, relaxed, or removed linting, typings, and tests |
| 60 | +> - overly complex TypeScript generics or generally over-the-top typings |
| 61 | +> - dramatic unit test snapshot updates |
| 62 | +> - affects any file not directly associated with the issue being resolved |
| 63 | +> - affects "many" files |
| 64 | +> - contains or is a minor grammatical fix |
| 65 | +> |
| 66 | +> You will be asked to either: |
| 67 | +> - open an issue instead of a PR |
| 68 | +> - restructure your commits |
| 69 | +> - break the work into multiple pull requests |
| 70 | +> - close the PR (typically, a last resort) |
| 71 | +
|
| 72 | +#### Pull request commits, messaging |
| 73 | + |
| 74 | +Your pull request should contain Git commit messaging that follows [conventional commit types](https://www.conventionalcommits.org/) |
| 75 | +to provide consistent history and help generate [CHANGELOG.md](./CHANGELOG.md) updates. |
| 76 | + |
| 77 | +Commit messages follow two basic guidelines: |
| 78 | +- No more than `65` characters for the first line. |
| 79 | +- Commit message formats follow the structure: |
| 80 | + ``` |
| 81 | + <type>(<optional scope>): <description> (#PR_NUMBER) |
| 82 | + ``` |
| 83 | + Where: |
| 84 | + - **Type**: The type of work the commit resolves (e.g., `feat`, `fix`, `chore`, `docs`, `refactor`, `test`). |
| 85 | + - **Scope**: The optional area of code affected (directory, filename, or concept). |
| 86 | + - **Description**: What the commit work encompasses. |
| 87 | + - **#PR_NUMBER**: The pull request number. Typically added automatically during merge/squash operations. Including it manually is optional. It can help with traceability during review. |
| 88 | + |
| 89 | +> If your **pull request contains multiple commits**, they will be squashed into a single commit before merging and the messaging |
| 90 | +> altered to reflect current guidelines. |
| 91 | +
|
| 92 | +#### Pull request test failures |
| 93 | +Before any review takes place, all tests should pass. You may be asked to update your pull request to resolve any failing tests |
| 94 | +before a review. |
| 95 | + |
| 96 | +> If you are unsure why your tests are failing, you should [review testing documentation](#testing). |
| 97 | +
|
| 98 | + |
| 99 | +### Code style guidance and conventions |
| 100 | +Basic code style guidelines are generally enforced by ESLint, but there are additional guidelines. |
| 101 | + |
| 102 | +#### File structure |
| 103 | +- File names use lowerCamelCase and dot notation (e.g., `server.http.ts`, `server.logger.ts`). |
| 104 | +- Directory structure is organized by function, with all relevant files maintained in the `src` directory. |
| 105 | + |
| 106 | +#### Functionality, testing |
| 107 | +- Functions should attempt to maintain a single responsibility. |
| 108 | +- Function annotations follow a minimal JSDoc style; descriptions are encouraged. |
| 109 | +- Tests should focus on functionality. |
| 110 | +- Tests should not be written for external packages. That is the responsibility of the external package, or it shouldn't be used. |
| 111 | + |
| 112 | +#### Typescript |
| 113 | +- Typings within the project may be generally loose for initial development but should be refined over time. |
| 114 | +- Typings exposed to consumers should always attempt to maintain consistency. |
| 115 | +- Typings for tests are less of a focus than functionality checks. |
| 116 | + |
| 117 | +### Testing |
| 118 | +Current testing is based on Jest. |
| 119 | + |
| 120 | +> A consideration for Vitest is being made for the near future after base functionality is complete. |
| 121 | +
|
| 122 | +#### Unit tests |
| 123 | + |
| 124 | +Unit tests are located in the `__tests__` directory. |
| 125 | + |
| 126 | +#### E2E tests |
| 127 | + |
| 128 | +E2E tests are located in the root `./tests` directory. |
| 129 | + |
| 130 | +## AI agent |
| 131 | + |
| 132 | +### User Section |
| 133 | + |
| 134 | +Current agent interaction can be triggered with the chat command |
| 135 | + |
| 136 | +- **`review the repo guidelines`** - Your agent should attempt to scan common markdown files and the guidelines directory |
| 137 | + |
| 138 | +For detailed information on agent interaction, see [guidelines/README.md](./guidelines/README.md). |
| 139 | + |
| 140 | +#### Customizing developer experience |
| 141 | + |
| 142 | +As developers, we often have our own preferred workflows, and that includes working with AI agents. To that point, we've added agent guidance |
| 143 | +to allow customization for your work environment through a tool-agnostic git-ignored directory `./.agent` in the root of the project. |
| 144 | + |
| 145 | +#### Noting AI Agent contributions |
| 146 | + |
| 147 | +Please reference [PatternFly's AI-assisted development guidelines](https://github.com/patternfly/.github/blob/main/CONTRIBUTING.md) for guidance on how to |
| 148 | +acknowledge AI agent contributions. |
| 149 | + |
| 150 | +### Agent Only |
| 151 | +Agents: This repository contains a hierarchical guideline system. Agents should review agent-only comment blocks. |
| 152 | + |
| 153 | +<!-- |
| 154 | +Agents must analyze these files when asked for guidance: |
| 155 | +
|
| 156 | +**Guidelines review order:** |
| 157 | +1. **`./README.md`** - Main agent guidance and behavior standards (including agent-only comment block) |
| 158 | +2. **`./guidelines/README.md`** - Core agent guidance and behavior standards |
| 159 | +3. **`./guidelines/**/*.md`** - Specialized workflow and domain-specific instructions |
| 160 | +4. **`./.agent/**/*.md`** - gitignored directory and local guidelines intended for agent-specific state and new agent-generated guidance, and user workflows that enhance the core guidelines |
| 161 | +
|
| 162 | +The guideline system should be processed in this order, with specialized guidelines taking precedence for their specific domains, and local guidelines overriding general guidelines when present. |
| 163 | +
|
| 164 | +**Next Steps:** |
| 165 | +5. **Review guidance under the `./.agent/**/*.md` directory.** If the `./.agent` directory exists, the user may ask the agent about the guidance located here. |
| 166 | +6. **If the `./.agent` directory does not exist, ask the user if they want to create it.** The agent should explain how it's going to be used. |
| 167 | +--> |
0 commit comments