# Tasks - Star Kitten

## Add New Discord Command

**Last performed:** Initial setup
**Files to modify:**

- `packages/eve-bot/src/commands/[command-name].command.ts` - New command file
- Global Discord client automatically registers new commands

**Steps:**

1. Create new command file following naming convention `[name].command.ts`
2. Export Discord command definition as default export
3. Add interaction handlers using global client event listeners
4. Include localization for command names and descriptions
5. Test command registration and interaction handling

**Important notes:**

- Commands are auto-discovered using glob patterns
- Each command handles its own interactions via global client
- Follow existing pattern from `appraise.command.ts`
- Include comprehensive error handling for all interactions

## Add New EVE ESI Integration

**Last performed:** Character and wallet integration
**Files to modify:**

- `packages/eve/src/esi/[module].ts` - New ESI module
- `packages/eve/src/esi/index.ts` - Export new module
- `packages/eve/src/esi/scopes.ts` - Add required scopes if needed
- `packages/eve/src/db/models/character.model.ts` - Add helper methods if needed

**Steps:**

1. Define required ESI scopes in scopes.ts
2. Create new ESI module with fetch functions
3. Add proper TypeScript interfaces for API responses
4. Implement caching where appropriate
5. Add character model helper methods for data access
6. Update exports in index.ts

**Important notes:**

- Always handle token refresh automatically
- Include comprehensive error handling for API failures
- Follow existing patterns from character.ts and wallet integrations
- Cache responses appropriately to respect rate limits

## Database Schema Migration

**Last performed:** Initial schema setup
**Files to modify:**

- `packages/eve/src/db/schema.ts` - Schema definitions
- `packages/eve/src/db/models/` - Model helpers if needed
- `packages/eve/src/db/index.ts` - Export new tables

**Steps:**

1. Update schema.ts with new tables/columns
2. Generate migration using `bun run generate-migrations`
3. Test migration with `bun run migrate`
4. Update model classes with new methods
5. Add exports to db/index.ts
6. Update database initialization in main applications

**Important notes:**

- Always backup database before migrations
- Test migrations on development database first
- Update all references to schema changes
- Consider data migration scripts for existing data

## Add New Web Component

**Last performed:** Skill queue and wallet components
**Files to modify:**

- `packages/eve-web/src/components/[category]/[component].tsx` - New component
- `packages/eve-web/src/pages/index.tsx` - Import and use component
- Related ESI integration if data source needed

**Steps:**

1. Create new component following existing patterns
2. Implement async data loading with suspense fallback
3. Add proper TypeScript interfaces for props
4. Style using Tailwind CSS and DaisyUI components
5. Import and integrate into appropriate page
6. Test with real data and loading states

**Important notes:**

- Always provide suspense fallback for loading states
- Follow existing component patterns from skill-queue.tsx and wallet.tsx
- Use server-side rendering capabilities of Brisa
- Ensure responsive design for mobile devices

## Add Third-Party API Integration

**Last performed:** Janice API integration
**Files to modify:**

- `packages/eve/src/third-party/[service].ts` - New API integration
- `packages/eve/src/third-party/index.ts` - Export new service
- Environment configuration for API keys

**Steps:**

1. Create new service module with TypeScript interfaces
2. Implement API client with proper error handling
3. Add caching layer for performance
4. Include comprehensive validation for inputs/outputs
5. Add tests for all API functions
6. Update exports and environment configuration

**Important notes:**

- Always implement proper rate limiting and caching
- Include comprehensive error handling and validation
- Follow existing patterns from janice.ts
- Add API key management through environment variables
- Test with real API to ensure compatibility

## Update Reference Data

**Last performed:** Initial data setup
**Files to modify:**

- `data/reference-data/` - Static reference files
- `data/hoboleaks/` - SDE data files
- `packages/eve/src/models/` - Data model updates if needed

**Steps:**

1. Run `bun get-data` to download latest reference data
2. Verify data integrity and format consistency
3. Update data models if schema changes detected
4. Test applications with new reference data
5. Commit updated data files to repository

**Important notes:**

- Reference data updates can be large (hundreds of MB)
- Always verify data integrity before committing
- Test critical functionality after data updates
- Consider data migration scripts for breaking changes
- Monitor for EVE Online patch changes that affect data structure
