|
2 | 2 |
|
3 | 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | 4 |
|
5 | | -## Documentation Strategy |
6 | | - |
7 | | -This repository uses two complementary approaches for AI agent guidance: |
8 | | - |
9 | | -- **AGENTS.md**: Generic AI agent instructions using include directives to force documentation indexing. Contains canonical standards references, shared skills loading, and user override support. |
10 | | -- **CLAUDE.md** (this file): Claude Code-specific guidance with prescriptive commands, architecture details, and development workflows optimized for `/init`. |
11 | | - |
12 | | -### Integration Approach |
13 | | - |
14 | | -**For Claude Code** (`/init` command): |
15 | | -1. Read CLAUDE.md (this file) first for optimized quick-start guidance |
16 | | -2. Process include directives to load repository standards |
17 | | -3. Reference AGENTS.md for shared skills and canonical standards location |
18 | | -4. Apply layered standards: canonical → project-specific → user overrides |
19 | | - |
20 | | -**For other AI agents** (Codex, generic LLMs): |
21 | | -1. Read AGENTS.md first as the primary entry point |
22 | | -2. Process include directives to load all referenced documentation |
23 | | -3. Resolve canonical standards repo path (local or GitHub) |
24 | | -4. Load shared skills from standards repo |
25 | | -5. Apply user overrides from `~/AGENTS.md` if present |
26 | | - |
27 | | -**Key differences**: |
28 | | -- **CLAUDE.md**: Prescriptive, command-focused, optimized for `/init` |
29 | | -- **AGENTS.md**: Declarative, include-directive-driven, forces full documentation indexing |
30 | | - |
31 | | -Both files share the same underlying standards via include directives, ensuring consistency across all AI agents working in this repository. |
32 | | - |
33 | | -### Best Practices for Dual-File Approach |
34 | | - |
35 | | -**What goes in AGENTS.md**: |
36 | | -- Include directives for documentation indexing |
37 | | -- Canonical standards repository references |
38 | | -- Shared skills loading instructions |
39 | | -- User override mechanisms |
40 | | -- Minimal, declarative content |
41 | | - |
42 | | -**What goes in CLAUDE.md**: |
43 | | -- Claude Code-specific quick-start commands |
44 | | -- Detailed architecture and design patterns |
45 | | -- Implementation notes and common workflows |
46 | | -- Integration guidance between the two files |
47 | | -- More verbose, prescriptive content |
48 | | - |
49 | | -**What goes in neither (use includes instead)**: |
50 | | -- Repository standards (keep in `docs/repository-standards.md`) |
51 | | -- Canonical standards (reference external repo) |
52 | | -- Project-specific conventions (keep in referenced docs) |
53 | | - |
54 | | -**Maintenance strategy**: |
55 | | -- Update standards in source files, not in AGENTS.md or CLAUDE.md |
56 | | -- Use include directives to pull in shared content |
57 | | -- Keep AGENTS.md minimal and CLAUDE.md focused on Claude Code workflows |
58 | | -- Test both entry points when updating documentation structure |
59 | | - |
60 | 5 | <!-- include: docs/standards-and-conventions.md --> |
61 | 6 | <!-- include: docs/repository-standards.md --> |
62 | 7 |
|
63 | 8 | ## Project Overview |
64 | 9 |
|
65 | | -This is a Java port of `pymqrest`, providing a Java wrapper for the IBM MQ administrative REST API. The project will provide a Java mapping layer for MQ REST API attribute translations and command metadata. |
66 | | - |
67 | | -**Project name**: mq-rest-admin |
68 | | - |
69 | | -**Status**: Pre-alpha (initial setup) |
| 10 | +Java wrapper for the IBM MQ administrative REST API, ported from `pymqrest` (Python). Provides method-per-command API (`displayQueue()`, `defineQlocal()`, etc.) with attribute mapping between snake_case and MQSC parameter names. |
70 | 11 |
|
71 | | -**Build coordinates**: `io.github.wphillipmoore:mq-rest-admin:0.1.0-SNAPSHOT` |
| 12 | +**Build coordinates**: `io.github.wphillipmoore:mq-rest-admin:1.1.1` |
72 | 13 |
|
73 | 14 | **Java package**: `io.github.wphillipmoore.mq.rest.admin` |
74 | 15 |
|
75 | | -**Canonical Standards**: This repository follows standards at https://github.com/wphillipmoore/standards-and-conventions (local path: `../standards-and-conventions` if available) |
| 16 | +**Canonical Standards**: https://github.com/wphillipmoore/standards-and-conventions (local: `../standards-and-conventions`) |
| 17 | + |
| 18 | +**Reference implementation**: `../mq-rest-admin-python` |
76 | 19 |
|
77 | 20 | ## Development Commands |
78 | 21 |
|
79 | | -### Environment Setup |
| 22 | +### Environment |
80 | 23 |
|
81 | 24 | - **Java**: 17+ (install via `brew install openjdk@17` or SDKMAN) |
82 | 25 | - **Maven**: Provided by Maven Wrapper (`./mvnw`), no separate install needed |
83 | 26 |
|
84 | | -### Build |
85 | | - |
86 | | -```bash |
87 | | -./mvnw compile # Compile sources |
88 | | -./mvnw clean # Remove target/ |
89 | | -./mvnw clean compile # Clean rebuild |
90 | | -./mvnw package # Compile and package JAR |
91 | | -``` |
92 | | - |
93 | | -### Validation |
94 | | - |
95 | | -```bash |
96 | | -./mvnw verify # Run entire validation pipeline (single command) |
97 | | -``` |
98 | | - |
99 | | -The `verify` lifecycle runs in order: formatting check (Spotless) → style check |
100 | | -(Checkstyle) → compile → unit tests (Surefire) → integration tests (Failsafe) → |
101 | | -coverage enforcement (JaCoCo 100% line + branch) → bug analysis (SpotBugs) → |
102 | | -code smell detection (PMD). |
103 | | - |
104 | | -Individual tools can also be run standalone: |
| 27 | +### Build and Validate |
105 | 28 |
|
106 | 29 | ```bash |
107 | | -./mvnw spotless:check # Check formatting |
108 | | -./mvnw spotless:apply # Auto-format code |
109 | | -./mvnw checkstyle:check # Check style rules |
110 | | -./mvnw spotbugs:check # Check for bug patterns |
111 | | -./mvnw pmd:check # Check for code smells |
| 30 | +./mvnw compile # Compile sources |
| 31 | +./mvnw verify # Full pipeline: Spotless → Checkstyle → compile → unit tests → |
| 32 | + # integration tests → JaCoCo (100% line+branch) → SpotBugs → PMD |
| 33 | +./mvnw spotless:apply # Auto-format code (run before committing) |
112 | 34 | ``` |
113 | 35 |
|
114 | 36 | ### Testing |
115 | 37 |
|
116 | 38 | ```bash |
117 | | -./mvnw test # Unit tests only (*Test.java) |
118 | | -./mvnw verify # Unit + integration tests (*IT.java) |
| 39 | +./mvnw test # All unit tests (*Test.java) |
| 40 | +./mvnw test -Dtest=MqRestSessionTest # Single test class |
| 41 | +./mvnw test -Dtest="MqRestSessionTest#testMethod" # Single test method |
| 42 | +./mvnw verify # Unit + integration tests (*IT.java) |
119 | 43 | ``` |
120 | 44 |
|
121 | 45 | - **Framework**: JUnit 5 (Jupiter) |
122 | 46 | - **Mocking**: Mockito 5 with `@ExtendWith(MockitoExtension.class)` |
123 | 47 | - **Assertions**: AssertJ (`assertThat(x).isEqualTo(y)`) |
124 | 48 | - **Coverage**: JaCoCo — 100% line and branch coverage enforced at BUNDLE level |
125 | 49 |
|
126 | | -### Linting and Formatting |
127 | | - |
128 | | -- **Formatter**: Spotless + google-java-format (2-space indent, opinionated) |
129 | | -- **Style**: Checkstyle with `google_checks.xml` (bundled) |
130 | | -- **Bug analysis**: SpotBugs (`effort=Max`, `threshold=Low`) |
131 | | -- **Code smells**: PMD (default ruleset) |
132 | | - |
133 | | -Run `./mvnw spotless:apply` to auto-format before committing. |
134 | | - |
135 | | -## Architecture |
136 | | - |
137 | | -Direct port of `pymqrest`'s architecture, adapted to Java idioms. |
138 | | - |
139 | | -### Technology Stack |
140 | | - |
141 | | -- **HTTP client**: `java.net.http.HttpClient` (JDK built-in, zero runtime dependencies) |
142 | | -- **JSON library**: Gson (`com.google.code.gson:gson`, single JAR, zero transitive deps) |
143 | | -- **Runtime dependencies**: 1 (Gson ~280KB) |
| 50 | +### Individual Lint Tools |
144 | 51 |
|
145 | | -### API Surface |
| 52 | +```bash |
| 53 | +./mvnw spotless:check # Check formatting (google-java-format, 2-space indent) |
| 54 | +./mvnw checkstyle:check # Check style (google_checks.xml) |
| 55 | +./mvnw spotbugs:check # Bug patterns (effort=Max, threshold=Low) |
| 56 | +./mvnw pmd:check # Code smell detection |
| 57 | +``` |
146 | 58 |
|
147 | | -- **Style**: Method-per-command mirroring pymqrest (`displayQueue()`, `defineQlocal()`, etc.) |
148 | | -- **Parameters/results**: `Map<String, Object>` for MQ attributes (dynamic attribute sets, permissive mode) |
149 | | -- **Fixed-schema types**: Java records for `TransportResponse`, `SyncConfig`, `SyncResult`, `EnsureResult`, `MappingIssue`, credential types |
150 | | -- **Credentials**: Sealed interface (`Credentials permits BasicAuth, LtpaAuth, CertificateAuth`) |
151 | | -- **Session**: Single `MqRestSession` class (no mixin decomposition) |
| 59 | +## Git Conventions |
152 | 60 |
|
153 | | -### Transport Layer |
| 61 | +### Pre-flight Checklist |
154 | 62 |
|
155 | | -- `MqRestTransport` interface (mirrors pymqrest's Protocol) — enables Mockito-based testing |
156 | | -- `HttpClientTransport` implementation behind that interface |
157 | | -- Supports TLS/mTLS via `SSLContext`, timeouts via `Duration`, custom headers |
| 63 | +1. Check current branch: `git status -sb` |
| 64 | +2. If on `develop` or `main`, create a `feature/*`, `bugfix/*`, or `hotfix/*` branch first |
| 65 | +3. Enable git hooks: `git config core.hooksPath scripts/git-hooks` |
158 | 66 |
|
159 | | -### Attribute Mapping |
| 67 | +### Branching Model (`library-release`) |
160 | 68 |
|
161 | | -- Direct port of pymqrest's 3-layer pipeline: key map, value map, key-value map |
162 | | -- Two directions: request and response |
163 | | -- Strict/permissive modes with `MappingIssue` tracking |
164 | | -- Mapping data stored as JSON resource file in `src/main/resources/` (loaded by Gson) |
165 | | -- Override mechanism with merge/replace modes |
| 69 | +- **`develop`**: Integration branch — PRs target here (squash merge) |
| 70 | +- **`main`**: Release branch — release PRs merge here (regular merge) |
| 71 | +- Allowed branch prefixes: `feature/*`, `bugfix/*`, `hotfix/*` |
166 | 72 |
|
167 | | -### Exception Hierarchy |
| 73 | +### Commit Message Rules (enforced by hooks) |
168 | 74 |
|
169 | | -Unchecked (`RuntimeException`), sealed: |
| 75 | +Conventional Commits format required: |
170 | 76 |
|
171 | 77 | ``` |
172 | | -MqRestException (sealed, extends RuntimeException) |
173 | | -├── MqRestTransportException (network/connection failures) |
174 | | -├── MqRestResponseException (malformed JSON, unexpected structure) |
175 | | -├── MqRestAuthException (authentication/authorization failures) |
176 | | -├── MqRestCommandException (MQSC command returned error codes) |
177 | | -└── MqRestTimeoutException (polling timeout exceeded) |
178 | | -
|
179 | | -MappingException (separate hierarchy, data-transformation errors) |
180 | | -``` |
181 | | - |
182 | | -### Package Structure |
| 78 | +<type>(optional-scope): <description> |
183 | 79 |
|
184 | | -``` |
185 | | -io.github.wphillipmoore.mq.rest.admin |
186 | | - MqRestSession, MqRestTransport, HttpClientTransport, TransportResponse |
187 | | -io.github.wphillipmoore.mq.rest.admin.auth |
188 | | - Credentials, BasicAuth, LtpaAuth, CertificateAuth |
189 | | -io.github.wphillipmoore.mq.rest.admin.exception |
190 | | - MqRestException, MqRest{Transport,Response,Auth,Command,Timeout}Exception |
191 | | -io.github.wphillipmoore.mq.rest.admin.mapping |
192 | | - AttributeMapper, MappingData, MappingIssue, MappingException, MappingOverrideMode |
193 | | -io.github.wphillipmoore.mq.rest.admin.sync |
194 | | - SyncConfig, SyncResult, SyncOperation |
195 | | -io.github.wphillipmoore.mq.rest.admin.ensure |
196 | | - EnsureResult, EnsureAction |
| 80 | +Co-Authored-By: wphillipmoore-claude <255925739+wphillipmoore-claude@users.noreply.github.com> |
197 | 81 | ``` |
198 | 82 |
|
199 | | -## Repository Standards Quick Reference |
| 83 | +Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore` |
200 | 84 |
|
201 | | -The include directives at the top of this file load the full repository standards. Key highlights for quick reference: |
| 85 | +The co-author hook validates trailers against approved identities in `docs/repository-standards.md`. Only use the approved co-author lines listed there. |
202 | 86 |
|
203 | | -**Pre-flight Checklist**: |
204 | | -- Check current branch: `git status -sb` |
205 | | -- If on `develop`, create `feature/*` branch or get explicit approval |
206 | | -- Enable git hooks: `git config core.hooksPath scripts/git-hooks` |
207 | | - |
208 | | -See `docs/repository-standards.md` for complete details. |
209 | | - |
210 | | -## Documentation Indexing Strategy |
| 87 | +## Architecture |
211 | 88 |
|
212 | | -This repository uses `<!-- include: path/to/file.md -->` directives to force documentation indexing. When you encounter these directives: |
| 89 | +Direct port of pymqrest's architecture, adapted to Java idioms. |
213 | 90 |
|
214 | | -1. **Read the referenced files** to understand the full context |
215 | | -2. **Apply layered standards** in order: |
216 | | - - Canonical standards (from `standards-and-conventions` repo) |
217 | | - - Project-specific standards (`docs/repository-standards.md`) |
218 | | - - User overrides (`~/AGENTS.md` if present) |
219 | | -3. **Load shared skills** from `<standards-repo-path>/skills/**/SKILL.md` |
| 91 | +### Key Design Decisions |
220 | 92 |
|
221 | | -The include directives appear in: |
222 | | -- `AGENTS.md` - Includes repository standards and conventions |
223 | | -- `CLAUDE.md` - Includes same standards for Claude Code |
224 | | -- `docs/standards-and-conventions.md` - Includes canonical standards reference |
| 93 | +- **Zero runtime deps** beyond Gson (~280KB) — HTTP via `java.net.http.HttpClient` |
| 94 | +- **Sealed types**: `MqRestException` hierarchy (unchecked) and `Credentials` interface |
| 95 | +- **Nullability**: JSpecify `@Nullable` annotations; Error Prone + NullAway enforced on JDK 21+ (auto-activated `error-prone` profile) |
| 96 | +- **Dynamic attributes**: `Map<String, Object>` for MQ attributes; Java records for fixed-schema types (`TransportResponse`, `SyncConfig`, `SyncResult`, `EnsureResult`, `MappingIssue`) |
| 97 | +- **Testability**: `MqRestTransport` interface enables Mockito-based testing without HTTP |
225 | 98 |
|
226 | | -This approach ensures all AI agents (Codex, Claude, etc.) have access to the same foundational documentation. |
| 99 | +### Attribute Mapping Pipeline |
227 | 100 |
|
228 | | -## Documentation Structure |
| 101 | +3-layer pipeline (key map → value map → key-value map) with request/response directions. Strict mode throws `MappingException`; permissive mode records `MappingIssue` entries. Mapping data in `src/main/resources/.../mapping/mapping-data.json`. |
229 | 102 |
|
230 | | -- `README.md` - Project overview and quick start |
231 | | -- `AGENTS.md` - Generic AI agent instructions with include directives |
232 | | -- `CLAUDE.md` - This file, Claude Code-specific guidance |
233 | | -- `docs/repository-standards.md` - Project-specific standards (included from AGENTS.md) |
234 | | -- `docs/standards-and-conventions.md` - Canonical standards reference (includes external repo) |
| 103 | +### Exception Hierarchy |
235 | 104 |
|
236 | | -## Key References |
| 105 | +``` |
| 106 | +MqRestException (sealed, RuntimeException) |
| 107 | +├── MqRestTransportException (network/connection) |
| 108 | +├── MqRestResponseException (malformed JSON) |
| 109 | +├── MqRestAuthException (auth failures) |
| 110 | +├── MqRestCommandException (MQSC errors) |
| 111 | +└── MqRestTimeoutException (polling timeout) |
| 112 | +
|
| 113 | +MappingException (separate, data-transformation errors) |
| 114 | +``` |
237 | 115 |
|
238 | | -**Canonical Standards**: https://github.com/wphillipmoore/standards-and-conventions |
239 | | -- Local path (preferred): `../standards-and-conventions` |
240 | | -- Load all skills from: `<standards-repo-path>/skills/**/SKILL.md` |
| 116 | +### Package Layout |
241 | 117 |
|
242 | | -**Reference implementation**: `../mq-rest-admin-python` (Python version) |
| 118 | +``` |
| 119 | +.admin — MqRestSession (Builder pattern), MqRestTransport, HttpClientTransport, TransportResponse |
| 120 | +.admin.auth — Credentials (sealed), BasicAuth, LtpaAuth, CertificateAuth |
| 121 | +.admin.exception — Sealed exception hierarchy |
| 122 | +.admin.mapping — AttributeMapper, MappingData, MappingIssue, MappingDirection, MappingOverrideMode |
| 123 | +.admin.sync — SyncConfig, SyncResult, SyncOperation |
| 124 | +.admin.ensure — EnsureResult, EnsureAction |
| 125 | +``` |
243 | 126 |
|
244 | | -**External Documentation**: |
245 | | -- IBM MQ 9.4 administrative REST API |
246 | | -- MQSC command reference |
247 | | -- PCF command formats |
| 127 | +## Documentation and Standards |
248 | 128 |
|
249 | | -**User Overrides**: `~/AGENTS.md` (optional, applied if present and readable) |
| 129 | +- `AGENTS.md` — Generic AI agent instructions with include directives |
| 130 | +- `docs/repository-standards.md` — Project-specific standards (branching, co-authors, naming) |
| 131 | +- `docs/standards-and-conventions.md` — Canonical standards reference |
0 commit comments