DEVELOPMENT.mdโข4.12 kB
# ZigNet Development Guide
## ๐ ๏ธ Configurazione Ambiente
### Prerequisiti
- Node.js >= 18.0.0
- pnpm (o npm)
### Installazione
```bash
pnpm install
```
## ๐ Script Disponibili
### Build
```bash
pnpm build # Compila TypeScript โ JavaScript
pnpm build:watch # Watch mode per sviluppo
pnpm clean # Pulisce la directory dist/
```
### Testing
```bash
pnpm test # Esegue tutti i test
pnpm test:watch # Watch mode per i test
pnpm test:coverage # Test con coverage report
```
### Linting & Formatting
```bash
pnpm lint # Controlla errori ESLint
pnpm lint:fix # Corregge errori ESLint automaticamente
pnpm format # Formatta il codice con Prettier
pnpm format:check # Verifica formattazione senza modificare
pnpm typecheck # Controlla i tipi TypeScript senza compilare
```
## ๐ Struttura del Progetto
```
zignet/
โโโ src/
โ โโโ lexer.ts โ
Lexer completo (100% coverage)
โ โโโ parser.ts โณ TODO
โ โโโ type-checker.ts โณ TODO
โ โโโ codegen.ts โณ TODO
โ โโโ llm-integration.ts โณ TODO
โโโ tests/
โ โโโ lexer.test.ts โ
33 test passati
โ โโโ parser.test.ts โณ TODO
โโโ dist/ # Output compilato (gitignored)
โโโ coverage/ # Report coverage (gitignored)
โโโ docs/
โโโ ARCHITECTURE.md
```
## ๐งช Test Coverage
**Lexer: 100% Stmts | 99.02% Branch | 100% Funcs | 100% Lines**
```
File | % Stmts | % Branch | % Funcs | % Lines
----------|---------|----------|---------|--------
lexer.ts | 100 | 99.02 | 100 | 100
```
## ๐ง Configurazione
### TypeScript (`tsconfig.json`)
- Target: ES2022
- Strict mode abilitato
- Output: `dist/`
- Source maps: โ
### ESLint (`eslint.config.js`)
- Parser: `@typescript-eslint/parser`
- Regole: TypeScript + Prettier
- Type-aware linting: โ
### Prettier (`.prettierrc.json`)
- Single quotes: โ
- Semicolons: โ
- Print width: 100
- Tab width: 2 spazi
### Jest (`jest.config.js`)
- Preset: ts-jest
- Coverage: lcov + html
- Test match: `**/*.test.ts`, `**/*.spec.ts`
## ๐ Workflow di Sviluppo
### 1. Sviluppo con Watch Mode
```bash
# Terminal 1: Build automatico
pnpm build:watch
# Terminal 2: Test automatici
pnpm test:watch
```
### 2. Prima di Committare
```bash
pnpm typecheck # Controlla tipi
pnpm lint:fix # Corregge linting
pnpm format # Formatta codice
pnpm test # Esegue test
```
### 3. Workflow Completo
```bash
pnpm clean && pnpm build && pnpm lint && pnpm test:coverage
```
## ๐ Test Metrics
### Lexer Tests (33 total)
- โ
Keywords (2 tests)
- โ
Types (1 test)
- โ
Literals (7 tests)
- โ
Operators (6 tests)
- โ
Punctuation (3 tests)
- โ
Comments (2 tests)
- โ
Complex Code (3 tests)
- โ
Line/Column Tracking (2 tests)
- โ
Error Handling (2 tests)
- โ
Edge Cases (3 tests)
- โ
Token toString (1 test)
## ๐ฏ Prossimi Passi
### Phase 3.2: Parser
- [ ] Creare `src/parser.ts`
- [ ] Implementare AST nodes
- [ ] Parser per funzioni
- [ ] Parser per structs
- [ ] Parser per espressioni
- [ ] Test unitari parser
- [ ] Coverage > 95%
### Phase 3.3: Type Checker
- [ ] Creare `src/type-checker.ts`
- [ ] Validazione tipi base
- [ ] Gestione generics
- [ ] Error reporting
- [ ] Test unitari
### Phase 4: LLM Integration
- [ ] Creare `src/llm-integration.ts`
- [ ] Integrazione Ollama
- [ ] Prompt engineering
- [ ] Error suggestion system
## ๐ Risorse
- [TypeScript Handbook](https://www.typescriptlang.org/docs/)
- [Jest Documentation](https://jestjs.io/)
- [ESLint Rules](https://eslint.org/docs/rules/)
- [Zig Language Reference](https://ziglang.org/documentation/master/)
## ๐ Troubleshooting
### Jest non trova i moduli
```bash
pnpm clean
pnpm install
pnpm build
```
### ESLint errori strani
```bash
rm -rf node_modules/.cache
pnpm lint:fix
```
### TypeScript errori di tipo
```bash
pnpm typecheck
```
---
**Status**: โ
Lexer completo, TypeScript configurato, test suite attiva
**Last Updated**: 2025-10-26