Skip to content

Commit c0ca7ec

Browse files
authored
docs: add comprehensive contributing guide and refactor AGENTS.md (#14)
* test(preview): update tests for new action button structure - Update i18n mock to include new translation keys for retry and more actions - Change mock failed task to use PARTIAL_FAILED status (8) instead of FAILED (0) - Refactor tests to verify "More Actions" dropdown instead of individual action buttons - Update test descriptions to reflect new UI structure with primary/dropdown actions - Add verification for dropdown trigger elements in button tests chore: add .codebuddy to .gitignore * docs: add comprehensive contributing guide and refactor AGENTS.md Add detailed CONTRIBUTING.md file with: - Code of conduct and community guidelines - Complete development setup instructions - Step-by-step feature development workflow - Code style guidelines and naming conventions - Commit message and PR process documentation - Testing guidelines and help resources Refactor AGENTS.md to remove duplicated feature development instructions and reference the new CONTRIBUTING.md guide instead, improving documentation organization and maintainability.
1 parent 53a71a3 commit c0ca7ec

File tree

4 files changed

+462
-126
lines changed

4 files changed

+462
-126
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ files
3030
coverage
3131

3232
settings.local.json
33+
.codebuddy
3334

3435
# Environment variables
3536
.env

AGENTS.md

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -280,109 +280,8 @@ The domain layer contains **only interfaces and pure business logic** with no ex
280280
- `release.yml` - Builds and uploads assets on release, publishes to npm
281281

282282
### Adding New Features
283-
1. Create Prisma schema changes in `src/core/infrastructure/db/schema.prisma`
284-
2. Run `npm run migrate:dev` to create migration
285-
3. Run `npm run generate` to update Prisma client
286-
4. Add Repository in `src/core/domain/repositories/`:
287-
```typescript
288-
// Example: src/core/domain/repositories/FeatureRepository.ts
289-
import { prisma } from '../../infrastructure/db/index.js';
290-
291-
const featureRepository = {
292-
findAll: () => prisma.feature.findMany(),
293-
findById: (id: number) => prisma.feature.findUnique({ where: { id } }),
294-
create: (data) => prisma.feature.create({ data }),
295-
update: (id, data) => prisma.feature.update({ where: { id }, data }),
296-
remove: (id) => prisma.feature.delete({ where: { id } }),
297-
};
298-
299-
export default featureRepository;
300-
```
301-
5. **Add tests for Repository** in `src/core/domain/repositories/__tests__/`:
302-
```typescript
303-
// Example: FeatureRepository.test.ts
304-
import { describe, it, expect, beforeEach, vi } from 'vitest'
305-
import { mockDeep, mockReset } from 'vitest-mock-extended'
306-
import { PrismaClient } from '@prisma/client'
307-
import featureRepository from '../FeatureRepository.js'
308-
309-
const prismaMock = mockDeep<PrismaClient>()
310-
vi.mock('../../../infrastructure/db/index.js', () => ({ prisma: prismaMock }))
311-
312-
describe('featureRepository', () => {
313-
beforeEach(() => { mockReset(prismaMock) })
314-
315-
it('should create feature', async () => {
316-
prismaMock.feature.create.mockResolvedValue({ id: 1, name: 'test' })
317-
const result = await featureRepository.create({ name: 'test' })
318-
expect(result.id).toBe(1)
319-
})
320-
})
321-
```
322-
6. Add application services in `src/core/application/services/` if needed
323-
7. **Add tests for services** in `src/core/application/services/__tests__/` if applicable
324-
8. **Add IPC handler** in `src/main/ipc/handlers/feature.handler.ts`:
325-
```typescript
326-
import { ipcMain } from 'electron';
327-
import featureRepository from '../../../core/domain/repositories/FeatureRepository.js';
328-
329-
export function registerFeatureHandlers() {
330-
ipcMain.handle('feature:action', async (_, params) => {
331-
try {
332-
const result = await featureRepository.action(params);
333-
return { success: true, data: result };
334-
} catch (error: any) {
335-
return { success: false, error: error.message };
336-
}
337-
});
338-
console.log('[IPC] Feature handlers registered');
339-
}
340-
```
341-
9. Register handler in `src/main/ipc/handlers/index.ts`
342-
10. **Add tests for IPC handler** in `src/main/ipc/__tests__/handlers.test.ts`:
343-
```typescript
344-
it('should handle feature:action', async () => {
345-
const mockData = { id: 1, name: 'test' }
346-
vi.mocked(featureRepository.action).mockResolvedValue(mockData)
347-
348-
const result = await handlers.get('feature:action')!(null, params)
349-
350-
expect(result.success).toBe(true)
351-
expect(result.data).toEqual(mockData)
352-
})
353-
```
354-
11. **Add preload API** in `src/preload/index.ts`:
355-
```typescript
356-
feature: {
357-
action: (params) => ipcRenderer.invoke('feature:action', params)
358-
}
359-
```
360-
12. **Update TypeScript types** in `src/renderer/electron.d.ts`
361-
13. Update React frontend components to use `window.api.feature.action()`
362-
14. **Add component tests** in `src/renderer/components/__tests__/` (if new component):
363-
```typescript
364-
import { render, screen, waitFor } from '@testing-library/react'
365-
import userEvent from '@testing-library/user-event'
366-
import FeatureComponent from '../FeatureComponent'
367-
368-
describe('FeatureComponent', () => {
369-
it('should render and interact', async () => {
370-
window.api.feature.action = vi.fn().mockResolvedValue({ success: true })
371-
render(<FeatureComponent />)
372-
const button = screen.getByRole('button')
373-
await userEvent.click(button)
374-
expect(window.api.feature.action).toHaveBeenCalled()
375-
})
376-
})
377-
```
378-
15. **Add i18n translations** (if UI changes)
379-
16. **Run tests** to ensure everything works:
380-
```bash
381-
npm run test:unit # Run unit tests
382-
npm run test:renderer # Run component tests (if applicable)
383-
npm run test:coverage # Check coverage
384-
```
385-
17. Run `npm run lint` and `npm run typecheck` and `npm run dev` to test
283+
284+
For detailed instructions on adding new features, including step-by-step development workflow, code examples, and testing guidelines, please refer to **[CONTRIBUTING.md](./CONTRIBUTING.md#adding-new-features)**.
386285

387286

388287
### Electron Build Configuration

0 commit comments

Comments
 (0)