|
2 | 2 |
|
3 | 3 | A Java SDK for programmatic control of GitHub Copilot CLI. This is a community-driven port of the official .NET SDK, targeting Java 17+. |
4 | 4 |
|
| 5 | +## About These Instructions |
| 6 | + |
| 7 | +These instructions guide GitHub Copilot when assisting with this repository. They cover: |
| 8 | + |
| 9 | +- **Tech Stack**: Java 17+, Maven, Jackson for JSON, JUnit for testing |
| 10 | +- **Purpose**: Provide a Java SDK for programmatic control of GitHub Copilot CLI |
| 11 | +- **Architecture**: JSON-RPC client communicating with Copilot CLI over stdio |
| 12 | +- **Key Goals**: Maintain parity with upstream .NET SDK while following Java idioms |
| 13 | + |
5 | 14 | ## Build & Test Commands |
6 | 15 |
|
7 | 16 | ```bash |
@@ -170,3 +179,73 @@ Test method names are converted to lowercase snake_case for snapshot filenames t |
170 | 179 | - Update `src/site/site.xml` when adding new documentation pages |
171 | 180 | - Javadoc required for public APIs except `json` and `events` packages (self-documenting DTOs) |
172 | 181 | - **Copilot CLI Version**: When updating the required Copilot CLI version in `README.md`, also update it in `src/site/markdown/index.md` to keep them in sync |
| 182 | + |
| 183 | +## Boundaries and Restrictions |
| 184 | + |
| 185 | +### What NOT to Modify |
| 186 | + |
| 187 | +- **DO NOT** edit `.github/agents/` directory - these contain instructions for other agents |
| 188 | +- **DO NOT** modify `target/` directory - this contains build artifacts |
| 189 | +- **DO NOT** edit `pom.xml` dependencies without careful consideration - this SDK has minimal dependencies by design |
| 190 | +- **DO NOT** change the Jackson version without testing against all serialization patterns |
| 191 | +- **DO NOT** modify test snapshots in `target/copilot-sdk/test/snapshots/` - these come from upstream |
| 192 | +- **DO NOT** alter the Eclipse formatter configuration in `pom.xml` without team consensus |
| 193 | +- **DO NOT** remove or skip Checkstyle or Spotless checks |
| 194 | + |
| 195 | +### Security Guidelines |
| 196 | + |
| 197 | +- **NEVER** commit secrets, API keys, tokens, or credentials to the repository |
| 198 | +- **NEVER** commit `.env` files or any files containing sensitive configuration |
| 199 | +- **NEVER** log sensitive data in code (API keys, tokens, user data) |
| 200 | +- Always use `try-with-resources` for streams and readers to prevent resource leaks |
| 201 | +- Always use `StandardCharsets.UTF_8` when creating InputStreamReader/OutputStreamWriter |
| 202 | +- Review any new dependencies for known security vulnerabilities before adding them |
| 203 | +- When handling user input in tools or handlers, consider injection risks |
| 204 | + |
| 205 | +## Dependency Management |
| 206 | + |
| 207 | +This SDK is designed to be **lightweight with minimal dependencies**: |
| 208 | + |
| 209 | +- Core dependencies: Jackson (JSON), JUnit (tests only) |
| 210 | +- Before adding new dependencies: |
| 211 | + 1. Consider if the functionality can be implemented without a new dependency |
| 212 | + 2. Check if Jackson already provides the needed functionality |
| 213 | + 3. Ensure the dependency is actively maintained and widely used |
| 214 | + 4. Verify compatibility with Java 17+ |
| 215 | + 5. Check for security vulnerabilities |
| 216 | + 6. Get team approval for non-trivial additions |
| 217 | + |
| 218 | +## Commit and PR Guidelines |
| 219 | + |
| 220 | +### Commit Messages |
| 221 | + |
| 222 | +- Use clear, descriptive commit messages |
| 223 | +- Start with a verb in present tense (e.g., "Add", "Fix", "Update", "Refactor") |
| 224 | +- Keep the first line under 72 characters |
| 225 | +- Add details in the body if needed |
| 226 | +- Examples: |
| 227 | + - `Add support for streaming responses` |
| 228 | + - `Fix resource leak in JsonRpcClient` |
| 229 | + - `Update documentation for tool handlers` |
| 230 | + - `Refactor event handling to use sealed classes` |
| 231 | + |
| 232 | +### Pull Requests |
| 233 | + |
| 234 | +- Keep PRs focused and minimal - one feature/fix per PR |
| 235 | +- Ensure all tests pass before requesting review |
| 236 | +- Run `mvn spotless:apply` before committing |
| 237 | +- Include tests for new functionality |
| 238 | +- Update documentation if adding/changing public APIs |
| 239 | +- Reference related issues using `#issue-number` |
| 240 | +- For upstream merges, follow the `agentic-merge-upstream` skill workflow |
| 241 | + |
| 242 | +## Development Workflow |
| 243 | + |
| 244 | +1. **Setup**: Enable git hooks with `git config core.hooksPath .githooks` |
| 245 | +2. **Branch**: Create feature branches from `main` |
| 246 | +3. **Code**: Write code following the conventions above |
| 247 | +4. **Format**: Run `mvn spotless:apply` to format code |
| 248 | +5. **Test**: Run `mvn clean verify` to ensure all tests pass |
| 249 | +6. **Commit**: Make focused commits with clear messages |
| 250 | +7. **Push**: Push your branch and create a PR |
| 251 | +8. **Review**: Address review feedback and iterate |
0 commit comments