Skip to content

Commit 3026ba6

Browse files
lukaszlenartclaude
andcommitted
Update Claude API implementation plan with technical corrections
- Add missing anthropic-version header requirement for authentication - Fix request/response models to match actual Claude API structure: * ContentBlock arrays instead of simple strings * System parameter support for Claude-specific system messages * Claude-specific tool calling format * Image content support via ContentBlock structure - Update build configuration with Scala 3 priority and projectMatrix integration - Refine testing strategy to focus on Claude-specific functionality - Update implementation phases with Claude-specific technical details - Add mandatory code formatting workflow documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 2dbd879 commit 3026ba6

File tree

2 files changed

+508
-11
lines changed

2 files changed

+508
-11
lines changed

CLAUDE.md

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,47 @@ sbt compileDocumentation
125125
sbt scalafmtAll
126126
```
127127

128+
### ⚠️ CRITICAL: Code Formatting Workflow
129+
130+
**ALWAYS run `sbt scalafmt` after implementing each step or phase!**
131+
132+
The project uses Scalafmt for consistent code formatting. You MUST run formatting after:
133+
- Creating new files
134+
- Modifying existing files
135+
- Adding new functionality
136+
- Completing any implementation phase
137+
138+
```bash
139+
# Check formatting (will show warnings for improperly formatted files)
140+
sbt scalafmtCheck
141+
sbt Test/scalafmtCheck
142+
143+
# Fix formatting issues (run this after each implementation step)
144+
sbt scalafmt
145+
146+
# ALSO format test files (MANDATORY for test code)
147+
sbt Test/scalafmt
148+
149+
# Verify all issues are resolved
150+
sbt scalafmtCheck
151+
sbt Test/scalafmtCheck
152+
```
153+
154+
**Workflow Example:**
155+
1. Implement feature/fix
156+
2. Run `sbt scalafmt` ← NEVER SKIP THIS STEP
157+
3. Run `sbt Test/scalafmt` ← ALSO MANDATORY FOR TEST FILES
158+
4. Run `sbt scalafmtCheck` and `sbt Test/scalafmtCheck` to verify
159+
5. Run `sbt compile` to verify compilation
160+
6. Run tests
161+
7. Commit changes
162+
163+
**Why this matters:**
164+
- CI/CD pipeline will fail if code is not properly formatted
165+
- Maintains consistent code style across the entire codebase
166+
- Prevents formatting-related merge conflicts
167+
- Required before any PR can be merged
168+
128169
### Cross-platform Building
129170
The project uses sbt-projectmatrix for cross-building:
130171
- Scala 2.13.16 and Scala 3.3.6 support
@@ -148,11 +189,11 @@ The project uses sbt-projectmatrix for cross-building:
148189

149190
### Key Components
150191
- **Requests Package**: Contains all API endpoint definitions organized by OpenAI API categories
151-
- `completions.chat` - Chat completions API
152-
- `audio` - Speech synthesis, transcriptions, translations
153-
- `images` - Image generation, editing, variations
154-
- `embeddings` - Text embeddings
155-
- `files`, `assistants`, `threads` - OpenAI platform features
192+
- `completions.chat` - Chat completions API
193+
- `audio` - Speech synthesis, transcriptions, translations
194+
- `images` - Image generation, editing, variations
195+
- `embeddings` - Text embeddings
196+
- `files`, `assistants`, `threads` - OpenAI platform features
156197
- **JSON Handling**: Uses uPickle with SnakePickle for snake_case conversion
157198
- **Error Handling**: Comprehensive OpenAIException hierarchy for different API errors
158199

@@ -173,12 +214,12 @@ The project includes automated scripts for updating OpenAI model definitions:
173214

174215
### Model Update Workflow
175216
1. **Scrape Models**: `scala-cli model_update_scripts/scrape_models.scala`
176-
- Uses Playwright + Firefox to scrape OpenAI docs
177-
- Generates `models.json` with current model mappings
217+
- Uses Playwright + Firefox to scrape OpenAI docs
218+
- Generates `models.json` with current model mappings
178219
2. **Update Code**: `scala-cli model_update_scripts/update_code_with_new_models.scala --apply`
179-
- Updates Scala case objects with new models
180-
- Maintains alphabetical ordering
181-
- Only adds models (manual removal required)
220+
- Updates Scala case objects with new models
221+
- Maintains alphabetical ordering
222+
- Only adds models (manual removal required)
182223
3. **Format**: Run `sbt scalafmtAll` after updates
183224

184225
## Code Style
@@ -221,4 +262,38 @@ Integration tests require a real OpenAI API key but are designed to be cost-effi
221262
- Automatic skipping when API key unavailable
222263
- 30-second timeouts
223264
- Rate limiting handling
224-
- See `INTEGRATION_TESTING.md` for detailed setup
265+
- See `INTEGRATION_TESTING.md` for detailed setup
266+
267+
# 🚨 IMPORTANT DEVELOPMENT REMINDERS
268+
269+
## Code Formatting is MANDATORY
270+
271+
**NEVER forget to run `sbt scalafmt` AND `sbt Test/scalafmt` after ANY code changes!**
272+
273+
This is not optional - it's a required part of the development workflow:
274+
275+
1. **After creating new files**`sbt scalafmt` + `sbt Test/scalafmt`
276+
2. **After modifying existing files**`sbt scalafmt` + `sbt Test/scalafmt`
277+
3. **After implementing any feature**`sbt scalafmt` + `sbt Test/scalafmt`
278+
4. **After writing/modifying tests**`sbt Test/scalafmt` (CRITICAL!)
279+
5. **Before committing changes**`sbt scalafmt` + `sbt Test/scalafmt`
280+
6. **Before creating PRs**`sbt scalafmt` + `sbt Test/scalafmt`
281+
282+
**Memory aid:** Think of `sbt scalafmt` + `sbt Test/scalafmt` as part of the "save" operation - you haven't properly completed your work until ALL code (including tests) is formatted.
283+
284+
## Development Checklist
285+
286+
For every implementation phase:
287+
- [ ] Write/modify code
288+
- [ ] Run `sbt scalafmt` (CRITICAL - never skip)
289+
- [ ] Run `sbt Test/scalafmt` (CRITICAL - formats test files)
290+
- [ ] Run `sbt scalafmtCheck` and `sbt Test/scalafmtCheck` (verify formatting)
291+
- [ ] Run `sbt compile`
292+
- [ ] Run relevant tests
293+
- [ ] Commit changes
294+
295+
**Why this is critical:**
296+
- Unformatted code will cause CI failures
297+
- Inconsistent formatting creates merge conflicts
298+
- Team productivity suffers from formatting inconsistencies
299+
- PRs cannot be merged with formatting violations

0 commit comments

Comments
 (0)