Commit Graph

6 Commits

Author SHA1 Message Date
Cheffromspace
295c182351 fix: Improve production deployment configuration (#155)
* fix: Improve production deployment configuration

- Update default port from 3003 to 3002 for consistency
- Make port configurable via environment variable in docker-compose
- Add .env file loading support in start-api.sh
- Optimize startup.sh for production (skip builds, expect pre-built dist)
- Make Claude Code image build conditional on Dockerfile availability
- Fix rate limiting configuration for proxy environments
- Remove jest types from tsconfig (not needed in production)

These changes improve deployment flexibility and production readiness.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Address PR review feedback

- Fix port inconsistency: Change hardcoded 3003 to 3002 in src/index.ts
- Fix security risk: Replace unsafe export command with set -a/source/set +a
- Remove unnecessary Dockerfile.claudecode volume mount from docker-compose
  (The Dockerfile already copies all necessary files during build)

These changes address all critical issues identified in the PR review.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-01 13:10:15 -05:00
Jonathan
f42017f2a5 fix: resolve PR check failures for TypeScript and ESLint issues
- Remove unnecessary conditional checks in githubController.ts that caused TypeScript lint warnings
- Fix ESLint configuration to properly handle mixed JavaScript and TypeScript test files
- Update Jest configuration to remove deprecated isolatedModules option
- Add isolatedModules: true to tsconfig.json as recommended by ts-jest
- Ensure all tests pass and build succeeds

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-31 11:47:24 -05:00
Jonathan Flatt
3a56ee0499 feat: improve test coverage for TypeScript files
- Add comprehensive tests for index.ts (91.93% coverage)
- Add tests for routes/claude.ts (91.66% coverage)
- Add tests for routes/github.ts (100% coverage)
- Add tests for utils/startup-metrics.ts (100% coverage)
- Add tests for utils/sanitize.ts with actual exported functions
- Add tests for routes/chatbot.js
- Update test configuration to exclude test files from TypeScript build
- Fix linting issues in test files
- Install @types/supertest for TypeScript test support
- Update .gitignore to exclude compiled TypeScript test artifacts

Overall test coverage improved from ~65% to 76.5%

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-28 15:49:30 +00:00
Jonathan Flatt
a6383dacf1 feat: complete Phase 2 TypeScript source code conversion
Convert all 11 JavaScript source files to TypeScript with comprehensive
type definitions and maintain existing functionality.

## Major Changes
- **Type System**: Created comprehensive src/types/ directory with 7 type definition files
- **File Conversions**: All 11 source files (.js → .ts) with proper TypeScript typing
- **Interface Definitions**: Complete GitHub, Claude, AWS, Express, and Config interfaces
- **Type Safety**: Enhanced security-critical components with strong typing
- **Backward Compatibility**: Maintained existing CommonJS module structure

## Type Definitions Created
- `github.ts` - GitHub webhook payloads, API responses, interfaces
- `claude.ts` - Claude API interfaces, command structures, operation types
- `aws.ts` - AWS credential types, configuration interfaces
- `express.ts` - Custom Express request/response types, middleware interfaces
- `config.ts` - Environment variables, application configuration types
- `metrics.ts` - Performance metrics, monitoring, health check types
- `index.ts` - Central export file with type guards and utilities

## Converted Files
**Controllers**: githubController.js → githubController.ts
**Services**: claudeService.js → claudeService.ts, githubService.js → githubService.ts
**Utilities**: All 5 utility files converted with enhanced type safety
**Routes & Entry**: claude.js → claude.ts, github.js → github.ts, index.js → index.ts

## Configuration Updates
- Relaxed TypeScript strict settings for pragmatic migration
- Maintained existing functionality and behavior
- Enhanced security-critical components with proper typing

## Success Criteria Met
 All source files converted to TypeScript
 Comprehensive type definitions created
 Existing functionality preserved
 Security-critical components strongly typed
 Docker container builds successfully
 No runtime behavior changes

This establishes the complete TypeScript foundation for the project while
maintaining full backward compatibility and operational functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-27 20:40:34 -05:00
Jonathan Flatt
3bb2dfda12 feat: implement TypeScript infrastructure enhancements
## Optimizations Implemented

### 🐳 Dockerfile Optimization
- Replace double `npm ci` with `npm prune --omit=dev` for efficiency
- Reduces build time and eliminates redundant package installation

### 🔧 TypeScript Configuration
- Add `noErrorTruncation: true` to tsconfig for better error visibility
- Improves debugging experience with full error messages

### 🧪 Jest Configuration Enhancement
- Add @jest/globals package for modern Jest imports
- Document preferred import pattern for TypeScript tests:
  `import { describe, it, expect } from '@jest/globals'`

### 📁 Build Artifacts Management
- Add `dist/` and `*.tsbuildinfo` to .gitignore
- Remove tracked build artifacts from repository
- Ensure clean separation of source and compiled code

## Verification
 TypeScript compilation works correctly
 Type checking functions properly
 ESLint passes with all configurations
 All 67 tests pass (2 skipped)
 Build artifacts properly excluded from git

These enhancements improve developer experience, build efficiency, and
repository cleanliness while maintaining full backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-27 19:49:16 -05:00
Jonathan Flatt
a38ed85924 feat: setup TypeScript infrastructure for Phase 1 migration
## Overview
Establishes comprehensive TypeScript infrastructure and tooling for
the claude-github-webhook project as specified in issue #101.

## Dependencies Added
- Core TypeScript: typescript, @types/node, @types/express, @types/body-parser
- Development: ts-node for dev execution
- ESLint: @typescript-eslint/parser, @typescript-eslint/eslint-plugin
- Testing: ts-jest, babel-jest for Jest TypeScript support

## Configuration Files
- tsconfig.json: Strict TypeScript config targeting ES2022/CommonJS
- eslint.config.js: Updated with TypeScript support and strict rules
- jest.config.js: Configured for both .js and .ts test files
- babel.config.js: Babel configuration for JavaScript transformation

## Build Scripts
- npm run build: Compile TypeScript to dist/
- npm run build Watch mode compilation
- npm run typecheck: Type checking without compilation
- npm run clean: Clean build artifacts
- npm run dev: Development with ts-node
- npm run dev Development with nodemon + ts-node

## Infrastructure Verified
 TypeScript compilation works
 ESLint supports TypeScript files
 Jest runs tests with TypeScript support
 All existing tests pass (67 tests, 2 skipped)
 Docker build process updated for TypeScript

## Documentation
- CLAUDE.md updated with TypeScript build commands and architecture
- Migration strategy documented (Phase 1: Infrastructure, Phase 2: Code conversion)
- TypeScript coding guidelines added

## Backward Compatibility
- Existing JavaScript files continue to work during transition
- Support for both .js and .ts files in tests and linting
- No breaking changes to existing functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-27 19:35:54 -05:00