|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +This file provides guidance for AI agents (e.g., GitHub Copilot, Model Context Protocol servers, or other LLM-based assistants) interacting with the Azure SDK for Java repository. |
| 4 | + |
| 5 | +## Repository Purpose |
| 6 | + |
| 7 | +The Azure SDK for Java provides developers with libraries for accessing Azure services. The SDK is organized into client libraries, with each library corresponding to an Azure service. The repository follows a specific structure: |
| 8 | + |
| 9 | +- **Client Libraries**: Located in `/sdk` directory, containing individual service clients |
| 10 | +- **Data plane Libraries**: Libraries with Maven group `com.azure` |
| 11 | +- **Management Libraries**: Libraries with Maven group `com.azure.resourcemanager` |
| 12 | +- **Spring Libraries**: Libraries with Maven group `com.azure.spring` |
| 13 | + |
| 14 | +## Repository Structure |
| 15 | + |
| 16 | +``` |
| 17 | +/sdk/ # Individual service client libraries |
| 18 | +/eng/ # Engineering system files and automation |
| 19 | +/doc/ # Documentation |
| 20 | +/samples/ # Sample code and tutorials |
| 21 | +/.github/ # GitHub-specific configuration |
| 22 | + /copilot-instructions.md # Detailed Copilot-specific instructions |
| 23 | +``` |
| 24 | + |
| 25 | +## Agent Capabilities |
| 26 | + |
| 27 | +### Supported Actions |
| 28 | + |
| 29 | +AI agents interacting with this repository can assist with: |
| 30 | + |
| 31 | +1. **Code Generation and Modification** |
| 32 | + - Creating new client libraries following Azure SDK design guidelines |
| 33 | + - Adding features to existing libraries |
| 34 | + - Writing unit and integration tests |
| 35 | + - Refactoring code while maintaining backward compatibility |
| 36 | + |
| 37 | +2. **Documentation** |
| 38 | + - Writing and updating README files |
| 39 | + - Creating JavaDoc comments for public APIs |
| 40 | + - Updating CHANGELOG files |
| 41 | + - Creating code samples and snippets |
| 42 | + |
| 43 | +3. **Issue Triage and PR Review** |
| 44 | + - Analyzing and categorizing issues |
| 45 | + - Suggesting labels and assignees |
| 46 | + - Reviewing pull requests for adherence to guidelines |
| 47 | + - Identifying potential breaking changes |
| 48 | + |
| 49 | +4. **Build and Test Automation** |
| 50 | + - Running Maven builds |
| 51 | + - Executing unit tests |
| 52 | + - Analyzing test failures |
| 53 | + - Checking code style with Checkstyle and SpotBugs |
| 54 | + |
| 55 | +5. **SDK Release Support** |
| 56 | + - Checking package release readiness |
| 57 | + - Updating version numbers following semantic versioning |
| 58 | + - Verifying API review status |
| 59 | + |
| 60 | +### Boundaries and Limitations |
| 61 | + |
| 62 | +Agents should **NOT**: |
| 63 | + |
| 64 | +- Disable or modify Checkstyle or SpotBugs rules to resolve linting issues |
| 65 | +- Re-record tests as a fix to failing tests |
| 66 | +- Make breaking changes to GA'd APIs without explicit approval |
| 67 | +- Turn off security checks or introduce security vulnerabilities |
| 68 | +- Suggest third-party alternatives to Azure SDK packages in official samples |
| 69 | + |
| 70 | +## Key Workflows |
| 71 | + |
| 72 | +### Building the SDK |
| 73 | + |
| 74 | +```bash |
| 75 | +# Build all modules |
| 76 | +mvn clean install -DskipTests |
| 77 | + |
| 78 | +# Build a specific module |
| 79 | +mvn -f sdk/{service}/pom.xml clean install -DskipTests |
| 80 | + |
| 81 | +# Run tests for a specific module |
| 82 | +mvn -f sdk/{service}/pom.xml test |
| 83 | +``` |
| 84 | + |
| 85 | +### Running Code Quality Checks |
| 86 | + |
| 87 | +```bash |
| 88 | +# Run Checkstyle |
| 89 | +mvn checkstyle:check |
| 90 | + |
| 91 | +# Run SpotBugs |
| 92 | +mvn spotbugs:check |
| 93 | + |
| 94 | +# Run both style checks |
| 95 | +mvn checkstyle:check spotbugs:check |
| 96 | +``` |
| 97 | + |
| 98 | +### Testing |
| 99 | + |
| 100 | +```bash |
| 101 | +# Run unit tests |
| 102 | +mvn test |
| 103 | + |
| 104 | +# Run live tests (requires Azure resources and environment variables) |
| 105 | +mvn -Dmaven.wagon.http.pool=false --batch-mode --fail-at-end test |
| 106 | + |
| 107 | +# See eng/common/TestResources/New-TestResources.ps1 for setting up test resources |
| 108 | +``` |
| 109 | + |
| 110 | +### Versioning |
| 111 | + |
| 112 | +- Version files are located in `/eng/versioning/` |
| 113 | +- Follow semantic versioning: `major.minor.patch[-beta.N]` |
| 114 | +- Use the `update_versions.py` script for version updates |
| 115 | +- See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed versioning guidelines |
| 116 | + |
| 117 | +### SDK Generation |
| 118 | + |
| 119 | +Many client libraries are generated from OpenAPI specifications using AutoRest: |
| 120 | + |
| 121 | +```bash |
| 122 | +# Typical codegen command |
| 123 | +autorest --version=3.9.7 --java --use=@autorest/java@4.1.59 \ |
| 124 | + --input-file=<spec-file> --namespace=<namespace> --output-folder=<output> |
| 125 | +``` |
| 126 | + |
| 127 | +## Design Guidelines |
| 128 | + |
| 129 | +All contributions must follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). |
| 130 | + |
| 131 | +### Core Principles |
| 132 | + |
| 133 | +- **Idiomatic**: Use natural Java patterns (try-with-resources, Streams, Optional) |
| 134 | +- **Consistent**: Follow consistent naming and design patterns across all libraries |
| 135 | +- **Approachable**: Provide clear documentation and intuitive APIs |
| 136 | +- **Diagnosable**: Include comprehensive logging and telemetry |
| 137 | +- **Dependable**: Ensure reliability through robust error handling and retries |
| 138 | + |
| 139 | +### API Design Requirements |
| 140 | + |
| 141 | +- Service client classes with "Client" suffix |
| 142 | +- Fluent builder patterns for client instantiation |
| 143 | +- Synchronous and asynchronous clients (async suffixed with "AsyncClient") |
| 144 | +- Options bags for additional parameters (e.g., `<MethodName>Options`) |
| 145 | +- Standard verbs: create, upsert, set, get, list, delete |
| 146 | +- Comprehensive JavaDoc for all public APIs |
| 147 | + |
| 148 | +### Java Compatibility |
| 149 | + |
| 150 | +- **Baseline**: Java 8 |
| 151 | +- **Testing**: Up to latest Java LTS (currently Java 21) |
| 152 | +- **Best Practices**: Use modern Java features where appropriate |
| 153 | + |
| 154 | +## CI/CD Pipeline |
| 155 | + |
| 156 | +The repository uses Azure Pipelines for continuous integration: |
| 157 | + |
| 158 | +- Each service has a `ci.yml` file defining its build pipeline |
| 159 | +- PRs must pass all CI checks before merging |
| 160 | +- Daily builds publish to the dev feed at [Azure Artifacts](https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-java) |
| 161 | + |
| 162 | +## Security and Compliance |
| 163 | + |
| 164 | +- Never commit secrets or credentials |
| 165 | +- Use Azure Identity for authentication in samples |
| 166 | +- Follow secure coding practices |
| 167 | +- Report security issues to <secure@microsoft.com> |
| 168 | +- See [SECURITY.md](SECURITY.md) for more information |
| 169 | + |
| 170 | +## Contributing |
| 171 | + |
| 172 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines, including: |
| 173 | + |
| 174 | +- Pull request requirements |
| 175 | +- Code review process |
| 176 | +- Testing requirements |
| 177 | +- Documentation standards |
| 178 | +- Version management |
| 179 | + |
| 180 | +## Agent-Specific Instructions |
| 181 | + |
| 182 | +For detailed GitHub Copilot-specific instructions, including behavior guidelines, data sources, and SDK-specific patterns, see [.github/copilot-instructions.md](.github/copilot-instructions.md). |
| 183 | + |
| 184 | +## Resources |
| 185 | + |
| 186 | +### Documentation |
| 187 | + |
| 188 | +- [Azure SDK for Java Documentation](https://aka.ms/java-docs) |
| 189 | +- [Azure for Java Developers](https://docs.microsoft.com/java/azure/) |
| 190 | +- [Azure SDK Design Guidelines](https://azure.github.io/azure-sdk/) |
| 191 | +- [Java Guidelines](https://azure.github.io/azure-sdk/java_introduction.html) |
| 192 | +- [Building the SDK](https://github.com/Azure/azure-sdk-for-java/wiki/Building) |
| 193 | + |
| 194 | +### Repository Links |
| 195 | + |
| 196 | +- [Latest Releases](https://azure.github.io/azure-sdk/releases/latest/java.html) |
| 197 | +- [GitHub Issues](https://github.com/Azure/azure-sdk-for-java/issues) |
| 198 | +- [Stack Overflow](https://stackoverflow.com/questions/tagged/azure-java-sdk) |
| 199 | +- [Support](SUPPORT.md) |
| 200 | + |
| 201 | +### External References |
| 202 | + |
| 203 | +- [Maven](https://maven.apache.org/) |
| 204 | +- [JUnit 5](https://junit.org/junit5/) |
| 205 | +- [Semantic Versioning](https://semver.org/) |
| 206 | +- [Azure Artifacts Dev Feed](https://dev.azure.com/azure-sdk/public/_packaging?_a=feed&feed=azure-sdk-for-java) |
| 207 | + |
| 208 | +## Feedback and Questions |
| 209 | + |
| 210 | +- For issues or feature requests, file a [GitHub Issue](https://github.com/Azure/azure-sdk-for-java/issues/new/choose) |
| 211 | +- For questions, use [Stack Overflow with the `azure-java-sdk` tag](https://stackoverflow.com/questions/tagged/azure-java-sdk) |
| 212 | +- For contributions, see [CONTRIBUTING.md](CONTRIBUTING.md) |
| 213 | + |
| 214 | +--- |
| 215 | + |
| 216 | +This file aligns with the [AGENTS.md standard](https://agents.md) and provides a comprehensive guide for AI agents interacting with the Azure SDK for Java repository. |
0 commit comments