Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Determine Bun version
id: bun-version
run: echo "BUN_VERSION=$(cat package.json | grep 'bun-types' | head -1 | awk -F'"' '{print $4}')" >> $GITHUB_OUTPUT
run: echo "BUN_VERSION=$(jq -r '.engines."bun"' package.json)" >> $GITHUB_OUTPUT

- name: Setup Bun
uses: oven-sh/setup-bun@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Determine Bun version
id: bun-version
run: echo "BUN_VERSION=$(cat package.json | grep 'bun-types' | head -1 | awk -F'"' '{print $4}')" >> $GITHUB_OUTPUT
run: echo "BUN_VERSION=$(jq -r '.engines."bun"' package.json)" >> $GITHUB_OUTPUT

- name: Setup Bun
uses: oven-sh/setup-bun@v2
Expand Down
1 change: 0 additions & 1 deletion .trae/rules/code-conventions.md

This file was deleted.

182 changes: 182 additions & 0 deletions .trae/rules/code-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Coding Guidelines

## General Standards

- **Function Declarations**: Always use arrow functions (`const fn = () => {}`) instead of function declarations (`function fn() {}`)
- **TypeScript**: Use strict typing throughout the codebase
- **Path Aliases**: Always use `@frontend/` and `@backend/` instead of relative paths

## Testing Standards

### Test Framework

- **Bun Test**: Use Bun's native test runner for all tests
- **Import Pattern**: `import { describe, test, expect } from 'bun:test'`
- **File Naming**: Tests must use `.test.ts` or `.spec.ts` suffix

### Test Structure

- **Frontend Tests**: Place in `src/**/__tests__/` directories
- **Backend Tests**: Place in `tests/` directory mirroring `src/` structure
- **Test Organization**: Group related tests using `describe` blocks
- **Test Naming**: Use descriptive names that explain the behavior being tested

### Testing Approach

- **Logic Testing**: Focus on testing component logic, business rules, and data transformations
- **Type Validation**: Test TypeScript interfaces and type definitions
- **State Management**: Test store interactions and state mutations
- **Integration**: Test composable interactions and data flow
- **Avoid DOM Testing**: Prefer logic testing over complex DOM manipulation tests

### Test Examples

```typescript
import { describe, test, expect } from 'bun:test'

describe('Component Logic', () => {
test('should compute values correctly', () => {
const input = 'test'
const result = processInput(input)
expect(result).toBe('expected')
})

test('should handle edge cases', () => {
const emptyInput = ''
const result = processInput(emptyInput)
expect(result).toBe('default')
})
})
```

## Vue Component Standards

### Single File Component Structure

Vue components MUST follow this exact order:

1. **`<script setup lang="ts">`** - Always at the top
2. **`<template>`** - In the middle
3. **`<style scoped>`** - Should not be used

### Styling Guidelines

- **Tailwind Only**: Always use Tailwind CSS utility classes instead of custom CSS
- **No Custom CSS**: `<style>` sections should not be used
- **Custom CSS Exception**: Only use `<style scoped>` for complex animations or styles that cannot be achieved with Tailwind utilities

### Component Best Practices

- Use `<script setup lang="ts">` syntax exclusively
- Define props with `defineProps<Props>()` and `withDefaults()`
- Define emits with `defineEmits<{}>()`
- Use computed properties for reactive derived state
- Leverage auto-imports for Vue APIs and PrimeVue components

### Variable Naming Restrictions

- **Avoid Reserved Names**: Never use `column`, `message, `row` as variable names in frontend code
- **PrimeVue Conflicts**: These names trigger PrimeVue auto-imports and cause runtime errors
- **Alternative Names**: Use a similar descriptive name

## Auto-Import Configuration

The frontend uses `unplugin-auto-import` and `unplugin-vue-components` for automatic imports.

### Auto-Import Rules

- **Framework APIs**: All Vue, Vue Router, and Pinia APIs are automatically imported
- **Third-party Libraries**: VueUse composables and PrimeVue utilities are auto-imported
- **Custom Code**: All files in `src/**` (all subdirectories under src) are auto-imported
- **Components**: All PrimeVue components and custom components in `src/*` (direct subdirectories) are auto-imported

### Usage Guidelines

- No need to import Vue APIs, VueUse composables, or PrimeVue components
- All exported functions from any file under `src/` are automatically available
- Components from direct subdirectories of `src/` are automatically available
- Type definitions are generated in `auto-imports.d.ts` and `components.d.ts`
- ESLint configuration is automatically updated for auto-imports
- Avoid manual imports for auto-imported items to prevent conflicts

## Path Aliasing

The project uses TypeScript path mapping for clean imports across the monorepo.

### Path Mapping Rules

- `@backend` → `./backend/src`
- `@backend/*` → `./backend/src/*`
- `@backend/tests/*` → `./backend/tests/*`
- `@frontend` → `./frontend/src`
- `@frontend/*` → `./frontend/src/*`

### Best Practices

- Always use path aliases `@frontend/` and `@backend/` instead of relative paths
- Use aliases consistently across both TypeScript and test files
- Path aliases work in both development and build environments

## Code Review Checklist

When reviewing code for compliance, check in this order:

### 1. Basic Structure (Check First)

- [ ] `<script setup lang="ts">` is at the top (Vue components)
- [ ] `<template>` is in the middle (Vue components)
- [ ] `<style scoped>` is at bottom (if present in exception cases)
- [ ] All functions use arrow function syntax

### 2. Styling Compliance

- [ ] No custom CSS that can be replaced with Tailwind utilities
- [ ] All styling uses Tailwind classes where possible
- [ ] `<style>` section only exists for complex animations or unavoidable custom styles

### 3. TypeScript & Composition API

- [ ] Uses `<script setup lang="ts">` syntax (Vue components)
- [ ] Props defined with `defineProps<Props>()` and `withDefaults()` (Vue components)
- [ ] Emits defined with `defineEmits<{}>()` (Vue components)
- [ ] Proper TypeScript typing throughout

### 4. Auto-Imports & Path Aliases

- [ ] No manual imports for auto-imported Vue APIs or PrimeVue components
- [ ] Uses `@frontend/` and `@backend/` path aliases instead of relative paths
- [ ] No import conflicts with auto-import system

## Backend Coding Standards

### API Development

- Use Elysia framework patterns and conventions
- Implement proper error handling with Elysia plugins
- Define schemas in `schemas.ts` files
- Group routes by domain (e.g., `/api/project/*`)

### Database Operations

- Use DuckDB for data processing operations
- Use SQLite for project persistence
- Implement proper connection management
- Use prepared statements for security

## Testing Standards

### Test Structure

- Backend tests mirror `src/` structure
- Frontend tests in `__tests__/` subdirectories
- Integration tests for API endpoints
- Unit tests for composables and utilities
- Do not mock, but test real implementation
- Do not create any logic in tests, only test behavior
- Do not create unit tests for Vue components

### Test Naming

- Descriptive test names that explain the behavior being tested
- Group related tests using `describe` blocks
- Use `it` or `test` for individual test cases
1 change: 0 additions & 1 deletion .trae/rules/product.md

This file was deleted.

19 changes: 19 additions & 0 deletions .trae/rules/product.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Product Overview

DataForge is a specialized data processing tool tailored for working with large datasets. While inspired by OpenRefine's approach to data cleaning and transformation, this is not a replacement or alternative to OpenRefine itself. Instead, it focuses on providing high-performance data processing capabilities specifically optimized for large-scale data operations with Wikibase integration.

## Core Features

- **Data Import & Management**: Create and manage data projects with file upload capabilities
- **Wikibase Integration**: Schema mapping and reconciliation with Wikibase instances
- **Data Transformation**: Column operations, row manipulation, and data cleaning tools
- **Project Persistence**: SQLite-based storage with DuckDB for data processing
- **REST API**: Complete API coverage for all data operations and project management

## Target Users

Data analysts, researchers, and developers who need to clean, transform, and reconcile structured data with knowledge bases like Wikidata.

## Architecture Philosophy

Modern web application with clear separation between frontend (Vue 3) and backend (Elysia), emphasizing type safety, developer experience, and performance.
1 change: 0 additions & 1 deletion .trae/rules/structure.md

This file was deleted.

81 changes: 81 additions & 0 deletions .trae/rules/structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Project Structure

## Root Level Organization

```
dataforge/
├── backend/ # Elysia API server
├── frontend/ # Vue 3 web application
├── guidelines/ # Development documentation
├── prompts/ # AI assistant prompts
├── package.json # Workspace configuration
└── bun.lock # Dependency lock file
```

## Backend Structure (`backend/`)

```
backend/
├── src/
│ ├── api/ # API route handlers
│ │ ├── project/ # Project-related endpoints
│ │ └── health.ts # Health check endpoint
│ ├── plugins/ # Elysia plugins (database, error handling)
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions
├── tests/ # Test files mirroring src structure
└── package.json # Backend dependencies
```

## Frontend Structure (`frontend/`)

```
frontend/
├── src/
│ ├── components/ # Reusable Vue components
│ ├── composables/ # Vue composition functions
│ ├── pages/ # Page-level components
│ ├── stores/ # Pinia state stores
│ ├── types/ # Frontend-specific types
│ ├── plugins/ # Vue plugins (API client)
│ └── views/ # Route view components
├── public/ # Static assets
└── package.json # Frontend dependencies
```

## Key Architectural Patterns

### API Organization

- Routes grouped by domain (`/api/project/*`)
- Schema definitions in `schemas.ts` files
- Separate files for each major operation
- Tests mirror the API structure

### Frontend Organization

- **Components**: Reusable UI components (PrimeVue-based)
- **Composables**: Business logic and state management
- **Stores**: Global state with Pinia
- **Pages**: Route-level components
- **Types**: Frontend-specific type definitions

### Configuration Files

- **Root**: Workspace and shared configuration
- **Backend**: Elysia-specific TypeScript config
- **Frontend**: Vite and Vue-specific configuration
- **Shared**: Base TypeScript config with path aliases

### Testing Structure

- Backend tests mirror `src/` structure
- Frontend tests in `__tests__/` subdirectories
- Integration tests for API endpoints
- Unit tests for composables and utilities

### Development Guidelines Location

- **guidelines/core/**: Essential development standards
- **guidelines/reference/**: Detailed implementation guides
- **.kiro/steering/**: AI assistant guidance rules
1 change: 0 additions & 1 deletion .trae/rules/tech.md

This file was deleted.

Loading