|
| 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 code base context and verify the following scripts |
| 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 code base |
| 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 | +Git workflow is based on GitHub's 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 | +- `main` branch is currently a representation of 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 the use of [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> |
| 82 | + ``` |
| 83 | + Where |
| 84 | + - Type = The type of work the commit resolves. |
| 85 | + - Basic types include `feat` (feature), `fix`, `chore`, `build`, `refactor`, `docs`, `test`. |
| 86 | + - See [conventional commit types](https://www.conventionalcommits.org/) for additional types. |
| 87 | + - Scope = The optional area of code affected. It is acceptable to not include a scope. |
| 88 | + - Can be either a directory, or filenames, or a concept |
| 89 | + - Does not have to encompass all file names affected |
| 90 | + - Description = What the commit work encompasses |
| 91 | + |
| 92 | +> If your pull request contains multiple commits, they will be squashed into a single commit before merging and the messaging |
| 93 | +> altered to reflect current guidelines. |
| 94 | +
|
| 95 | +#### Pull request test failures |
| 96 | +Before any review takes place, all tests should pass. You may be asked to update your pull request to resolve any failing tests |
| 97 | +before a review. |
| 98 | + |
| 99 | +> If you are unsure why your tests are failing, you should [review testing documentation](#testing). |
| 100 | +
|
| 101 | + |
| 102 | +### Code style guidance and conventions |
| 103 | +Basic code style guidelines are generally enforced by ESLint, but there are additional guidelines. |
| 104 | + |
| 105 | +#### File structure |
| 106 | +- File names are lowerCamelCased and use dot notation, e.g. `server.http.ts`, `server.logger.ts` |
| 107 | +- Directory structure is currently flat, and all relevant files are maintained in the `src` directory. |
| 108 | + |
| 109 | +#### Functionality, testing |
| 110 | +- Functions should attempt to maintain a single responsibility. |
| 111 | +- Function annotations follow a minimal JSDoc style, descriptions are encouraged. |
| 112 | +- Tests should focus on functionality. |
| 113 | +- Tests should not be written for external packages. That is the responsibility of the external package, or it shouldn't be used. |
| 114 | + |
| 115 | +#### Typescript |
| 116 | +- Typings within the project may be generally loose for initial development but should be refined over time. |
| 117 | +- Typings exposed to consumers should always attempt to maintain consistency. |
| 118 | +- Typings for tests are less of a focus than functionality checks. |
| 119 | + |
| 120 | +### Testing |
| 121 | +Current testing is based on Jest. |
| 122 | + |
| 123 | +> A consideration for Vitest is being made for the near future after base functionality is complete. |
| 124 | +
|
| 125 | +#### Unit tests |
| 126 | + |
| 127 | +Unit tests are located in the `__tests__` directory. |
| 128 | + |
| 129 | +#### E2E tests |
| 130 | + |
| 131 | +E2E tests are located in the root `./tests` directory. |
| 132 | + |
| 133 | +## AI agent |
| 134 | + |
| 135 | +### User Section |
| 136 | + |
| 137 | +Current agent interaction can be triggered with the chat command |
| 138 | + |
| 139 | +- **`review the repo guidelines`** - Your agent should attempt to scan common markdown files and the guidelines directory |
| 140 | + |
| 141 | +For detailed information on agent interaction, see [guidelines/README.md](./guidelines/README.md). |
| 142 | + |
| 143 | +#### Customizing developer experience |
| 144 | + |
| 145 | +As developers, we often have our own flavor of working, and that includes working with AI agents. To that point we've added agent guidance |
| 146 | +to allow customization for your work environment through a tool agnostic git-ignored directory `./.agent` in the root of the project. |
| 147 | + |
| 148 | +#### Noting AI Agent contributions |
| 149 | + |
| 150 | +Please reference [PatternFly's AI-assisted development guidelines](https://github.com/patternfly/.github/blob/main/CONTRIBUTING.md) for guidance on how to |
| 151 | +acknowledge AI agent contributions. |
| 152 | + |
| 153 | +### Agent Only |
| 154 | +Agents: This repository contains a hierarchical guideline system. Agents should review agent-only comment blocks. |
| 155 | + |
| 156 | +<!-- |
| 157 | +Agents must analyze these files when asked for guidance: |
| 158 | +
|
| 159 | +**Guidelines review order:** |
| 160 | +1. **`./README.md`** - Main agent guidance and behavior standards (including agent-only comment block) |
| 161 | +2. **`./guidelines/README.md`** - Core agent guidance and behavior standards |
| 162 | +3. **`./guidelines/**/*.md`** - Specialized workflow and domain-specific instructions |
| 163 | +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 |
| 164 | +
|
| 165 | +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. |
| 166 | +
|
| 167 | +**Next Steps:** |
| 168 | +5. **Review guidance under the `./.agent/**/*.md` directory.** If the `./.agent` directory exists, the user may ask the agent about the guidance located here. |
| 169 | +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. |
| 170 | +--> |
0 commit comments