feat: Install quality-rails for mechanical code quality enforcement
Quality Rails provides mechanical enforcement of code quality through pre-commit hooks and CI/CD pipelines, preventing ~70% of common issues. What's added: - Pre-commit hooks via husky (formatting enforcement enabled) - Enhanced ESLint rules (no-explicit-any, security plugin, etc.) - lint-staged configuration (currently formatting-only mode) - Woodpecker CI pipeline template (.woodpecker.yml) - eslint-plugin-security for vulnerability detection - Documentation (docs/quality-rails-status.md) Current status: - Strict enforcement DISABLED until existing violations are fixed - Found 1,226 violations (1,121 errors, 105 warnings) - Priority: Fix explicit 'any' types first - Pre-commit currently only enforces Prettier formatting Next steps: 1. Fix existing lint violations 2. Enable strict pre-commit enforcement 3. Configure CI/CD pipeline Based on quality-rails from ~/src/quality-rails (monorepo template) See docs/quality-rails-status.md for detailed roadmap. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -47,3 +47,6 @@ yarn-error.log*
|
|||||||
# Misc
|
# Misc
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
.pnpm-approve-builds
|
.pnpm-approve-builds
|
||||||
|
|
||||||
|
# Husky
|
||||||
|
.husky/_
|
||||||
|
|||||||
3
.husky/pre-commit
Executable file
3
.husky/pre-commit
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
npx lint-staged
|
||||||
|
npx git-secrets --scan || echo "Warning: git-secrets not installed"
|
||||||
16
.lintstagedrc.mjs
Normal file
16
.lintstagedrc.mjs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Monorepo-aware lint-staged configuration
|
||||||
|
// NOTE: Strict enforcement is disabled until existing violations are fixed.
|
||||||
|
// See docs/quality-rails-status.md for current status.
|
||||||
|
export default {
|
||||||
|
// TypeScript files - format only for now
|
||||||
|
'**/*.{ts,tsx}': (filenames) => {
|
||||||
|
return [
|
||||||
|
`prettier --write ${filenames.join(' ')}`,
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
|
// Format all other files
|
||||||
|
'**/*.{js,jsx,json,md,yml,yaml}': [
|
||||||
|
'prettier --write',
|
||||||
|
],
|
||||||
|
};
|
||||||
67
.woodpecker.yml
Normal file
67
.woodpecker.yml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# Woodpecker CI Quality Enforcement Pipeline - Monorepo
|
||||||
|
when:
|
||||||
|
- event: [push, pull_request, manual]
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- &node_image "node:20-alpine"
|
||||||
|
- &install_deps |
|
||||||
|
corepack enable
|
||||||
|
npm ci --ignore-scripts
|
||||||
|
|
||||||
|
steps:
|
||||||
|
install:
|
||||||
|
image: *node_image
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
|
||||||
|
security-audit:
|
||||||
|
image: *node_image
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
- npm audit --audit-level=high
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
|
||||||
|
lint:
|
||||||
|
image: *node_image
|
||||||
|
environment:
|
||||||
|
SKIP_ENV_VALIDATION: "true"
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
- npm run lint
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
image: *node_image
|
||||||
|
environment:
|
||||||
|
SKIP_ENV_VALIDATION: "true"
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
- npm run type-check
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
|
||||||
|
test:
|
||||||
|
image: *node_image
|
||||||
|
environment:
|
||||||
|
SKIP_ENV_VALIDATION: "true"
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
- npm run test -- --coverage --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80,"statements":80}}'
|
||||||
|
depends_on:
|
||||||
|
- install
|
||||||
|
|
||||||
|
build:
|
||||||
|
image: *node_image
|
||||||
|
environment:
|
||||||
|
SKIP_ENV_VALIDATION: "true"
|
||||||
|
NODE_ENV: "production"
|
||||||
|
commands:
|
||||||
|
- *install_deps
|
||||||
|
- npm run build
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
- typecheck
|
||||||
|
- test
|
||||||
|
- security-audit
|
||||||
675
CLAUDE.md
675
CLAUDE.md
@@ -1,400 +1,451 @@
|
|||||||
**Multi-tenant personal assistant platform with PostgreSQL backend, Authentik SSO, and MoltBot
|
**Multi-tenant personal assistant platform with PostgreSQL backend, Authentik SSO, and MoltBot
|
||||||
integration.**
|
integration.**
|
||||||
|
|
||||||
## Project Overview
|
## Project Overview
|
||||||
|
|
||||||
Mosaic Stack is a standalone platform that provides:
|
Mosaic Stack is a standalone platform that provides:
|
||||||
- Multi-user workspaces with team sharing
|
|
||||||
- Task, event, and project management
|
|
||||||
- Gantt charts and Kanban boards
|
|
||||||
- MoltBot integration via plugins (stock MoltBot + mosaic-plugin-*)
|
|
||||||
- PDA-friendly design throughout
|
|
||||||
|
|
||||||
**Repository:** git.mosaicstack.dev/mosaic/stack
|
- Multi-user workspaces with team sharing
|
||||||
**Versioning:** Start at 0.0.1, MVP = 0.1.0
|
- Task, event, and project management
|
||||||
|
- Gantt charts and Kanban boards
|
||||||
|
- MoltBot integration via plugins (stock MoltBot + mosaic-plugin-\*)
|
||||||
|
- PDA-friendly design throughout
|
||||||
|
|
||||||
## Technology Stack
|
**Repository:** git.mosaicstack.dev/mosaic/stack
|
||||||
|
**Versioning:** Start at 0.0.1, MVP = 0.1.0
|
||||||
|
|
||||||
| Layer | Technology |
|
## Technology Stack
|
||||||
|-------|------------|
|
|
||||||
| Frontend | Next.js 16 + React + TailwindCSS + Shadcn/ui |
|
|
||||||
| Backend | NestJS + Prisma ORM |
|
|
||||||
| Database | PostgreSQL 17 + pgvector |
|
|
||||||
| Cache | Valkey (Redis-compatible) |
|
|
||||||
| Auth | Authentik (OIDC) |
|
|
||||||
| AI | Ollama (configurable: local or remote) |
|
|
||||||
| Messaging | MoltBot (stock + Mosaic plugins) |
|
|
||||||
| Real-time | WebSockets (Socket.io) |
|
|
||||||
| Monorepo | pnpm workspaces + TurboRepo |
|
|
||||||
| Testing | Vitest + Playwright |
|
|
||||||
| Deployment | Docker + docker-compose |
|
|
||||||
|
|
||||||
## Repository Structure
|
| Layer | Technology |
|
||||||
|
| ---------- | -------------------------------------------- |
|
||||||
|
| Frontend | Next.js 16 + React + TailwindCSS + Shadcn/ui |
|
||||||
|
| Backend | NestJS + Prisma ORM |
|
||||||
|
| Database | PostgreSQL 17 + pgvector |
|
||||||
|
| Cache | Valkey (Redis-compatible) |
|
||||||
|
| Auth | Authentik (OIDC) |
|
||||||
|
| AI | Ollama (configurable: local or remote) |
|
||||||
|
| Messaging | MoltBot (stock + Mosaic plugins) |
|
||||||
|
| Real-time | WebSockets (Socket.io) |
|
||||||
|
| Monorepo | pnpm workspaces + TurboRepo |
|
||||||
|
| Testing | Vitest + Playwright |
|
||||||
|
| Deployment | Docker + docker-compose |
|
||||||
|
|
||||||
mosaic-stack/
|
## Repository Structure
|
||||||
├── apps/
|
|
||||||
│ ├── api/ # mosaic-api (NestJS)
|
|
||||||
│ │ ├── src/
|
|
||||||
│ │ │ ├── auth/ # Authentik OIDC
|
|
||||||
│ │ │ ├── tasks/ # Task management
|
|
||||||
│ │ │ ├── events/ # Calendar/events
|
|
||||||
│ │ │ ├── projects/ # Project management
|
|
||||||
│ │ │ ├── brain/ # MoltBot integration
|
|
||||||
│ │ │ └── activity/ # Activity logging
|
|
||||||
│ │ ├── prisma/
|
|
||||||
│ │ │ └── schema.prisma
|
|
||||||
│ │ └── Dockerfile
|
|
||||||
│ └── web/ # mosaic-web (Next.js 16)
|
|
||||||
│ ├── app/
|
|
||||||
│ ├── components/
|
|
||||||
│ └── Dockerfile
|
|
||||||
├── packages/
|
|
||||||
│ ├── shared/ # Shared types, utilities
|
|
||||||
│ ├── ui/ # Shared UI components
|
|
||||||
│ └── config/ # Shared configuration
|
|
||||||
├── plugins/
|
|
||||||
│ ├── mosaic-plugin-brain/ # MoltBot skill: API queries
|
|
||||||
│ ├── mosaic-plugin-calendar/ # MoltBot skill: Calendar
|
|
||||||
│ ├── mosaic-plugin-tasks/ # MoltBot skill: Tasks
|
|
||||||
│ └── mosaic-plugin-gantt/ # MoltBot skill: Gantt
|
|
||||||
├── docker/
|
|
||||||
│ ├── docker-compose.yml # Turnkey deployment
|
|
||||||
│ └── init-scripts/ # PostgreSQL init
|
|
||||||
├── docs/
|
|
||||||
│ ├── SETUP.md
|
|
||||||
│ ├── CONFIGURATION.md
|
|
||||||
│ └── DESIGN-PRINCIPLES.md
|
|
||||||
├── .env.example
|
|
||||||
├── turbo.json
|
|
||||||
├── pnpm-workspace.yaml
|
|
||||||
└── README.md
|
|
||||||
|
|
||||||
## Development Workflow
|
mosaic-stack/
|
||||||
|
├── apps/
|
||||||
|
│ ├── api/ # mosaic-api (NestJS)
|
||||||
|
│ │ ├── src/
|
||||||
|
│ │ │ ├── auth/ # Authentik OIDC
|
||||||
|
│ │ │ ├── tasks/ # Task management
|
||||||
|
│ │ │ ├── events/ # Calendar/events
|
||||||
|
│ │ │ ├── projects/ # Project management
|
||||||
|
│ │ │ ├── brain/ # MoltBot integration
|
||||||
|
│ │ │ └── activity/ # Activity logging
|
||||||
|
│ │ ├── prisma/
|
||||||
|
│ │ │ └── schema.prisma
|
||||||
|
│ │ └── Dockerfile
|
||||||
|
│ └── web/ # mosaic-web (Next.js 16)
|
||||||
|
│ ├── app/
|
||||||
|
│ ├── components/
|
||||||
|
│ └── Dockerfile
|
||||||
|
├── packages/
|
||||||
|
│ ├── shared/ # Shared types, utilities
|
||||||
|
│ ├── ui/ # Shared UI components
|
||||||
|
│ └── config/ # Shared configuration
|
||||||
|
├── plugins/
|
||||||
|
│ ├── mosaic-plugin-brain/ # MoltBot skill: API queries
|
||||||
|
│ ├── mosaic-plugin-calendar/ # MoltBot skill: Calendar
|
||||||
|
│ ├── mosaic-plugin-tasks/ # MoltBot skill: Tasks
|
||||||
|
│ └── mosaic-plugin-gantt/ # MoltBot skill: Gantt
|
||||||
|
├── docker/
|
||||||
|
│ ├── docker-compose.yml # Turnkey deployment
|
||||||
|
│ └── init-scripts/ # PostgreSQL init
|
||||||
|
├── docs/
|
||||||
|
│ ├── SETUP.md
|
||||||
|
│ ├── CONFIGURATION.md
|
||||||
|
│ └── DESIGN-PRINCIPLES.md
|
||||||
|
├── .env.example
|
||||||
|
├── turbo.json
|
||||||
|
├── pnpm-workspace.yaml
|
||||||
|
└── README.md
|
||||||
|
|
||||||
### Branch Strategy
|
## Development Workflow
|
||||||
- `main` — stable releases only
|
|
||||||
- `develop` — active development (default working branch)
|
|
||||||
- `feature/*` — feature branches from develop
|
|
||||||
- `fix/*` — bug fix branches
|
|
||||||
|
|
||||||
### Starting Work
|
### Branch Strategy
|
||||||
```bash
|
|
||||||
git checkout develop
|
|
||||||
git pull --rebase
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
Running Locally
|
- `main` — stable releases only
|
||||||
|
- `develop` — active development (default working branch)
|
||||||
|
- `feature/*` — feature branches from develop
|
||||||
|
- `fix/*` — bug fix branches
|
||||||
|
|
||||||
# Start all services (Docker)
|
### Starting Work
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
# Or run individually for development
|
````bash
|
||||||
pnpm dev # All apps
|
git checkout develop
|
||||||
pnpm dev:api # API only
|
git pull --rebase
|
||||||
pnpm dev:web # Web only
|
pnpm install
|
||||||
|
|
||||||
Testing
|
Running Locally
|
||||||
|
|
||||||
pnpm test # Run all tests
|
# Start all services (Docker)
|
||||||
pnpm test:api # API tests only
|
docker compose up -d
|
||||||
pnpm test:web # Web tests only
|
|
||||||
pnpm test:e2e # Playwright E2E
|
|
||||||
|
|
||||||
Building
|
# Or run individually for development
|
||||||
|
pnpm dev # All apps
|
||||||
|
pnpm dev:api # API only
|
||||||
|
pnpm dev:web # Web only
|
||||||
|
|
||||||
pnpm build # Build all
|
Testing
|
||||||
pnpm build:api # Build API
|
|
||||||
pnpm build:web # Build Web
|
|
||||||
|
|
||||||
Design Principles (NON-NEGOTIABLE)
|
pnpm test # Run all tests
|
||||||
|
pnpm test:api # API tests only
|
||||||
|
pnpm test:web # Web tests only
|
||||||
|
pnpm test:e2e # Playwright E2E
|
||||||
|
|
||||||
PDA-Friendly Language
|
Building
|
||||||
|
|
||||||
NEVER use demanding language. This is critical.
|
pnpm build # Build all
|
||||||
┌─────────────┬──────────────────────┐
|
pnpm build:api # Build API
|
||||||
│ ❌ NEVER │ ✅ ALWAYS │
|
pnpm build:web # Build Web
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ OVERDUE │ Target passed │
|
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ URGENT │ Approaching target │
|
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ MUST DO │ Scheduled for │
|
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ CRITICAL │ High priority │
|
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ YOU NEED TO │ Consider / Option to │
|
|
||||||
├─────────────┼──────────────────────┤
|
|
||||||
│ REQUIRED │ Recommended │
|
|
||||||
└─────────────┴──────────────────────┘
|
|
||||||
Visual Indicators
|
|
||||||
|
|
||||||
Use status indicators consistently:
|
Design Principles (NON-NEGOTIABLE)
|
||||||
- 🟢 On track / Active
|
|
||||||
- 🔵 Upcoming / Scheduled
|
|
||||||
- ⏸️ Paused / On hold
|
|
||||||
- 💤 Dormant / Inactive
|
|
||||||
- ⚪ Not started
|
|
||||||
|
|
||||||
Display Principles
|
PDA-Friendly Language
|
||||||
|
|
||||||
1. 10-second scannability — Key info visible immediately
|
NEVER use demanding language. This is critical.
|
||||||
2. Visual chunking — Clear sections with headers
|
┌─────────────┬──────────────────────┐
|
||||||
3. Single-line items — Compact, scannable lists
|
│ ❌ NEVER │ ✅ ALWAYS │
|
||||||
4. Date grouping — Today, Tomorrow, This Week headers
|
├─────────────┼──────────────────────┤
|
||||||
5. Progressive disclosure — Details on click, not upfront
|
│ OVERDUE │ Target passed │
|
||||||
6. Calm colors — No aggressive reds for status
|
├─────────────┼──────────────────────┤
|
||||||
|
│ URGENT │ Approaching target │
|
||||||
|
├─────────────┼──────────────────────┤
|
||||||
|
│ MUST DO │ Scheduled for │
|
||||||
|
├─────────────┼──────────────────────┤
|
||||||
|
│ CRITICAL │ High priority │
|
||||||
|
├─────────────┼──────────────────────┤
|
||||||
|
│ YOU NEED TO │ Consider / Option to │
|
||||||
|
├─────────────┼──────────────────────┤
|
||||||
|
│ REQUIRED │ Recommended │
|
||||||
|
└─────────────┴──────────────────────┘
|
||||||
|
Visual Indicators
|
||||||
|
|
||||||
Reference
|
Use status indicators consistently:
|
||||||
|
- 🟢 On track / Active
|
||||||
|
- 🔵 Upcoming / Scheduled
|
||||||
|
- ⏸️ Paused / On hold
|
||||||
|
- 💤 Dormant / Inactive
|
||||||
|
- ⚪ Not started
|
||||||
|
|
||||||
See docs/DESIGN-PRINCIPLES.md for complete guidelines.
|
Display Principles
|
||||||
For original patterns, see: jarvis-brain/docs/DESIGN-PRINCIPLES.md
|
|
||||||
|
|
||||||
API Conventions
|
1. 10-second scannability — Key info visible immediately
|
||||||
|
2. Visual chunking — Clear sections with headers
|
||||||
|
3. Single-line items — Compact, scannable lists
|
||||||
|
4. Date grouping — Today, Tomorrow, This Week headers
|
||||||
|
5. Progressive disclosure — Details on click, not upfront
|
||||||
|
6. Calm colors — No aggressive reds for status
|
||||||
|
|
||||||
Endpoints
|
Reference
|
||||||
|
|
||||||
GET /api/{resource} # List (with pagination, filters)
|
See docs/DESIGN-PRINCIPLES.md for complete guidelines.
|
||||||
GET /api/{resource}/:id # Get single
|
For original patterns, see: jarvis-brain/docs/DESIGN-PRINCIPLES.md
|
||||||
POST /api/{resource} # Create
|
|
||||||
PATCH /api/{resource}/:id # Update
|
|
||||||
DELETE /api/{resource}/:id # Delete
|
|
||||||
|
|
||||||
Response Format
|
API Conventions
|
||||||
|
|
||||||
// Success
|
Endpoints
|
||||||
{
|
|
||||||
data: T | T[],
|
GET /api/{resource} # List (with pagination, filters)
|
||||||
meta?: { total, page, limit }
|
GET /api/{resource}/:id # Get single
|
||||||
|
POST /api/{resource} # Create
|
||||||
|
PATCH /api/{resource}/:id # Update
|
||||||
|
DELETE /api/{resource}/:id # Delete
|
||||||
|
|
||||||
|
Response Format
|
||||||
|
|
||||||
|
// Success
|
||||||
|
{
|
||||||
|
data: T | T[],
|
||||||
|
meta?: { total, page, limit }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error
|
||||||
|
{
|
||||||
|
error: {
|
||||||
|
code: string,
|
||||||
|
message: string,
|
||||||
|
details?: any
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Error
|
Brain Query API
|
||||||
{
|
|
||||||
error: {
|
|
||||||
code: string,
|
|
||||||
message: string,
|
|
||||||
details?: any
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Brain Query API
|
POST /api/brain/query
|
||||||
|
{
|
||||||
|
query: "what's on my calendar",
|
||||||
|
context?: { view: "dashboard", workspace_id: "..." }
|
||||||
|
}
|
||||||
|
|
||||||
POST /api/brain/query
|
Database Conventions
|
||||||
{
|
|
||||||
query: "what's on my calendar",
|
|
||||||
context?: { view: "dashboard", workspace_id: "..." }
|
|
||||||
}
|
|
||||||
|
|
||||||
Database Conventions
|
Multi-Tenant (RLS)
|
||||||
|
|
||||||
Multi-Tenant (RLS)
|
All workspace-scoped tables use Row-Level Security:
|
||||||
|
- Always include workspace_id in queries
|
||||||
|
- RLS policies enforce isolation
|
||||||
|
- Set session context for current user
|
||||||
|
|
||||||
All workspace-scoped tables use Row-Level Security:
|
Prisma Commands
|
||||||
- Always include workspace_id in queries
|
|
||||||
- RLS policies enforce isolation
|
|
||||||
- Set session context for current user
|
|
||||||
|
|
||||||
Prisma Commands
|
pnpm prisma:generate # Generate client
|
||||||
|
pnpm prisma:migrate # Run migrations
|
||||||
|
pnpm prisma:studio # Open Prisma Studio
|
||||||
|
pnpm prisma:seed # Seed development data
|
||||||
|
|
||||||
pnpm prisma:generate # Generate client
|
MoltBot Plugin Development
|
||||||
pnpm prisma:migrate # Run migrations
|
|
||||||
pnpm prisma:studio # Open Prisma Studio
|
|
||||||
pnpm prisma:seed # Seed development data
|
|
||||||
|
|
||||||
MoltBot Plugin Development
|
Plugins live in plugins/mosaic-plugin-*/ and follow MoltBot skill format:
|
||||||
|
|
||||||
Plugins live in plugins/mosaic-plugin-*/ and follow MoltBot skill format:
|
# plugins/mosaic-plugin-brain/SKILL.md
|
||||||
|
---
|
||||||
|
name: mosaic-plugin-brain
|
||||||
|
description: Query Mosaic Stack for tasks, events, projects
|
||||||
|
version: 0.0.1
|
||||||
|
triggers:
|
||||||
|
- "what's on my calendar"
|
||||||
|
- "show my tasks"
|
||||||
|
- "morning briefing"
|
||||||
|
tools:
|
||||||
|
- mosaic_api
|
||||||
|
---
|
||||||
|
|
||||||
# plugins/mosaic-plugin-brain/SKILL.md
|
# Plugin instructions here...
|
||||||
---
|
|
||||||
name: mosaic-plugin-brain
|
|
||||||
description: Query Mosaic Stack for tasks, events, projects
|
|
||||||
version: 0.0.1
|
|
||||||
triggers:
|
|
||||||
- "what's on my calendar"
|
|
||||||
- "show my tasks"
|
|
||||||
- "morning briefing"
|
|
||||||
tools:
|
|
||||||
- mosaic_api
|
|
||||||
---
|
|
||||||
|
|
||||||
# Plugin instructions here...
|
Key principle: MoltBot remains stock. All customization via plugins only.
|
||||||
|
|
||||||
Key principle: MoltBot remains stock. All customization via plugins only.
|
Environment Variables
|
||||||
|
|
||||||
Environment Variables
|
See .env.example for all variables. Key ones:
|
||||||
|
|
||||||
See .env.example for all variables. Key ones:
|
# Database
|
||||||
|
DATABASE_URL=postgresql://mosaic:password@localhost:5432/mosaic
|
||||||
|
|
||||||
# Database
|
# Auth
|
||||||
DATABASE_URL=postgresql://mosaic:password@localhost:5432/mosaic
|
AUTHENTIK_URL=https://auth.example.com
|
||||||
|
AUTHENTIK_CLIENT_ID=mosaic-stack
|
||||||
|
AUTHENTIK_CLIENT_SECRET=...
|
||||||
|
|
||||||
# Auth
|
# Ollama
|
||||||
AUTHENTIK_URL=https://auth.example.com
|
OLLAMA_MODE=local|remote
|
||||||
AUTHENTIK_CLIENT_ID=mosaic-stack
|
OLLAMA_ENDPOINT=http://localhost:11434
|
||||||
AUTHENTIK_CLIENT_SECRET=...
|
|
||||||
|
|
||||||
# Ollama
|
# MoltBot
|
||||||
OLLAMA_MODE=local|remote
|
MOSAIC_API_TOKEN=...
|
||||||
OLLAMA_ENDPOINT=http://localhost:11434
|
|
||||||
|
|
||||||
# MoltBot
|
Issue Tracking
|
||||||
MOSAIC_API_TOKEN=...
|
|
||||||
|
|
||||||
Issue Tracking
|
Issues are tracked at: https://git.mosaicstack.dev/mosaic/stack/issues
|
||||||
|
|
||||||
Issues are tracked at: https://git.mosaicstack.dev/mosaic/stack/issues
|
Labels
|
||||||
|
|
||||||
Labels
|
- Priority: p0 (critical), p1 (high), p2 (medium), p3 (low)
|
||||||
|
- Type: api, web, database, auth, plugin, ai, devops, docs, migration, security, testing,
|
||||||
|
performance, setup
|
||||||
|
|
||||||
- Priority: p0 (critical), p1 (high), p2 (medium), p3 (low)
|
Milestones
|
||||||
- Type: api, web, database, auth, plugin, ai, devops, docs, migration, security, testing,
|
|
||||||
performance, setup
|
|
||||||
|
|
||||||
Milestones
|
- M1-Foundation (0.0.x)
|
||||||
|
- M2-MultiTenant (0.0.x)
|
||||||
|
- M3-Features (0.0.x)
|
||||||
|
- M4-MoltBot (0.0.x)
|
||||||
|
- M5-Migration (0.1.0 MVP)
|
||||||
|
|
||||||
- M1-Foundation (0.0.x)
|
Commit Format
|
||||||
- M2-MultiTenant (0.0.x)
|
|
||||||
- M3-Features (0.0.x)
|
|
||||||
- M4-MoltBot (0.0.x)
|
|
||||||
- M5-Migration (0.1.0 MVP)
|
|
||||||
|
|
||||||
Commit Format
|
<type>(#issue): Brief description
|
||||||
|
|
||||||
<type>(#issue): Brief description
|
Detailed explanation if needed.
|
||||||
|
|
||||||
Detailed explanation if needed.
|
Fixes #123
|
||||||
|
Types: feat, fix, docs, test, refactor, chore
|
||||||
|
|
||||||
Fixes #123
|
Test-Driven Development (TDD) - REQUIRED
|
||||||
Types: feat, fix, docs, test, refactor, chore
|
|
||||||
|
|
||||||
Test-Driven Development (TDD) - REQUIRED
|
**All code must follow TDD principles. This is non-negotiable.**
|
||||||
|
|
||||||
**All code must follow TDD principles. This is non-negotiable.**
|
TDD Workflow (Red-Green-Refactor)
|
||||||
|
|
||||||
TDD Workflow (Red-Green-Refactor)
|
1. **RED** — Write a failing test first
|
||||||
|
- Write the test for new functionality BEFORE writing any implementation code
|
||||||
|
- Run the test to verify it fails (proves the test works)
|
||||||
|
- Commit message: `test(#issue): add test for [feature]`
|
||||||
|
|
||||||
1. **RED** — Write a failing test first
|
2. **GREEN** — Write minimal code to make the test pass
|
||||||
- Write the test for new functionality BEFORE writing any implementation code
|
- Implement only enough code to pass the test
|
||||||
- Run the test to verify it fails (proves the test works)
|
- Run tests to verify they pass
|
||||||
- Commit message: `test(#issue): add test for [feature]`
|
- Commit message: `feat(#issue): implement [feature]`
|
||||||
|
|
||||||
2. **GREEN** — Write minimal code to make the test pass
|
3. **REFACTOR** — Clean up the code while keeping tests green
|
||||||
- Implement only enough code to pass the test
|
- Improve code quality, remove duplication, enhance readability
|
||||||
- Run tests to verify they pass
|
- Ensure all tests still pass after refactoring
|
||||||
- Commit message: `feat(#issue): implement [feature]`
|
- Commit message: `refactor(#issue): improve [component]`
|
||||||
|
|
||||||
3. **REFACTOR** — Clean up the code while keeping tests green
|
Testing Requirements
|
||||||
- Improve code quality, remove duplication, enhance readability
|
|
||||||
- Ensure all tests still pass after refactoring
|
|
||||||
- Commit message: `refactor(#issue): improve [component]`
|
|
||||||
|
|
||||||
Testing Requirements
|
- **Minimum 85% code coverage** for all new code
|
||||||
|
- **Write tests BEFORE implementation** — no exceptions
|
||||||
|
- Test files must be co-located with source files:
|
||||||
|
- `feature.service.ts` → `feature.service.spec.ts`
|
||||||
|
- `component.tsx` → `component.test.tsx`
|
||||||
|
- All tests must pass before creating a PR
|
||||||
|
- Use descriptive test names: `it("should return user when valid token provided")`
|
||||||
|
- Group related tests with `describe()` blocks
|
||||||
|
- Mock external dependencies (database, APIs, file system)
|
||||||
|
|
||||||
- **Minimum 85% code coverage** for all new code
|
Test Types
|
||||||
- **Write tests BEFORE implementation** — no exceptions
|
|
||||||
- Test files must be co-located with source files:
|
|
||||||
- `feature.service.ts` → `feature.service.spec.ts`
|
|
||||||
- `component.tsx` → `component.test.tsx`
|
|
||||||
- All tests must pass before creating a PR
|
|
||||||
- Use descriptive test names: `it("should return user when valid token provided")`
|
|
||||||
- Group related tests with `describe()` blocks
|
|
||||||
- Mock external dependencies (database, APIs, file system)
|
|
||||||
|
|
||||||
Test Types
|
- **Unit Tests** — Test individual functions/methods in isolation
|
||||||
|
- **Integration Tests** — Test module interactions (e.g., service + database)
|
||||||
|
- **E2E Tests** — Test complete user workflows with Playwright
|
||||||
|
|
||||||
- **Unit Tests** — Test individual functions/methods in isolation
|
Running Tests
|
||||||
- **Integration Tests** — Test module interactions (e.g., service + database)
|
|
||||||
- **E2E Tests** — Test complete user workflows with Playwright
|
|
||||||
|
|
||||||
Running Tests
|
```bash
|
||||||
|
pnpm test # Run all tests
|
||||||
|
pnpm test:watch # Watch mode for active development
|
||||||
|
pnpm test:coverage # Generate coverage report
|
||||||
|
pnpm test:api # API tests only
|
||||||
|
pnpm test:web # Web tests only
|
||||||
|
pnpm test:e2e # Playwright E2E tests
|
||||||
|
````
|
||||||
|
|
||||||
```bash
|
Coverage Verification
|
||||||
pnpm test # Run all tests
|
|
||||||
pnpm test:watch # Watch mode for active development
|
|
||||||
pnpm test:coverage # Generate coverage report
|
|
||||||
pnpm test:api # API tests only
|
|
||||||
pnpm test:web # Web tests only
|
|
||||||
pnpm test:e2e # Playwright E2E tests
|
|
||||||
```
|
|
||||||
|
|
||||||
Coverage Verification
|
After implementing a feature, verify coverage meets requirements:
|
||||||
|
|
||||||
After implementing a feature, verify coverage meets requirements:
|
```bash
|
||||||
```bash
|
pnpm test:coverage
|
||||||
pnpm test:coverage
|
# Check the coverage report in coverage/index.html
|
||||||
# Check the coverage report in coverage/index.html
|
# Ensure your files show ≥85% coverage
|
||||||
# Ensure your files show ≥85% coverage
|
```
|
||||||
```
|
|
||||||
|
|
||||||
TDD Anti-Patterns to Avoid
|
TDD Anti-Patterns to Avoid
|
||||||
|
|
||||||
❌ Writing implementation code before tests
|
❌ Writing implementation code before tests
|
||||||
❌ Writing tests after implementation is complete
|
❌ Writing tests after implementation is complete
|
||||||
❌ Skipping tests for "simple" code
|
❌ Skipping tests for "simple" code
|
||||||
❌ Testing implementation details instead of behavior
|
❌ Testing implementation details instead of behavior
|
||||||
❌ Writing tests that don't fail when they should
|
❌ Writing tests that don't fail when they should
|
||||||
❌ Committing code with failing tests
|
❌ Committing code with failing tests
|
||||||
|
|
||||||
Example TDD Session
|
Quality Rails - Mechanical Code Quality Enforcement
|
||||||
|
|
||||||
```bash
|
**Status:** Installed (2026-01-30) - Currently in formatting-only mode
|
||||||
# 1. RED - Write failing test
|
|
||||||
# Edit: feature.service.spec.ts
|
|
||||||
# Add test for getUserById()
|
|
||||||
pnpm test:watch # Watch it fail
|
|
||||||
git add feature.service.spec.ts
|
|
||||||
git commit -m "test(#42): add test for getUserById"
|
|
||||||
|
|
||||||
# 2. GREEN - Implement minimal code
|
Quality Rails provides mechanical enforcement of code quality standards through pre-commit hooks
|
||||||
# Edit: feature.service.ts
|
and CI/CD pipelines. See `docs/quality-rails-status.md` for full details.
|
||||||
# Add getUserById() method
|
|
||||||
pnpm test:watch # Watch it pass
|
|
||||||
git add feature.service.ts
|
|
||||||
git commit -m "feat(#42): implement getUserById"
|
|
||||||
|
|
||||||
# 3. REFACTOR - Improve code quality
|
What's Enforced (Once enabled):
|
||||||
# Edit: feature.service.ts
|
|
||||||
# Extract helper, improve naming
|
|
||||||
pnpm test:watch # Ensure still passing
|
|
||||||
git add feature.service.ts
|
|
||||||
git commit -m "refactor(#42): extract user mapping logic"
|
|
||||||
```
|
|
||||||
|
|
||||||
Docker Deployment
|
- ✅ **Type Safety** - Blocks explicit `any` types (@typescript-eslint/no-explicit-any: error)
|
||||||
|
- ✅ **Return Types** - Requires explicit return types on exported functions
|
||||||
|
- ✅ **Security** - Detects SQL injection, XSS, unsafe regex (eslint-plugin-security)
|
||||||
|
- ✅ **Promise Safety** - Blocks floating promises and misused promises
|
||||||
|
- ✅ **Code Formatting** - Auto-formats with Prettier on commit
|
||||||
|
- ✅ **Build Verification** - Type-checks before allowing commit
|
||||||
|
- ✅ **Secret Scanning** - Blocks hardcoded passwords/API keys (git-secrets)
|
||||||
|
|
||||||
Turnkey (includes everything)
|
Current Status:
|
||||||
|
|
||||||
docker compose up -d
|
- 🟡 **Pre-commit hooks**: Enabled (formatting only until violations fixed)
|
||||||
|
- 🔴 **Strict enforcement**: Disabled (1,226 existing violations to fix first)
|
||||||
|
- 🟡 **CI/CD pipeline**: Ready (.woodpecker.yml created, not yet configured)
|
||||||
|
|
||||||
Customized (external services)
|
Next Steps:
|
||||||
|
|
||||||
Create docker-compose.override.yml to:
|
1. Fix existing 1,226 lint violations (priority: explicit `any` types)
|
||||||
- Point to external PostgreSQL/Valkey/Ollama
|
2. Enable strict pre-commit enforcement in `.lintstagedrc.mjs`
|
||||||
- Disable bundled services
|
3. Configure Woodpecker CI to run quality gates on all PRs
|
||||||
|
|
||||||
See docs/DOCKER.md for details.
|
Why This Matters:
|
||||||
|
|
||||||
Key Documentation
|
Based on validation of 50 real production issues, Quality Rails mechanically prevents ~70%
|
||||||
┌───────────────────────────┬───────────────────────┐
|
of quality issues including:
|
||||||
│ Document │ Purpose │
|
|
||||||
├───────────────────────────┼───────────────────────┤
|
- Hardcoded passwords
|
||||||
│ docs/SETUP.md │ Installation guide │
|
- Type safety violations
|
||||||
├───────────────────────────┼───────────────────────┤
|
- SQL injection vulnerabilities
|
||||||
│ docs/CONFIGURATION.md │ All config options │
|
- Build failures
|
||||||
├───────────────────────────┼───────────────────────┤
|
- Test coverage gaps
|
||||||
│ docs/DESIGN-PRINCIPLES.md │ PDA-friendly patterns │
|
|
||||||
├───────────────────────────┼───────────────────────┤
|
**Mechanical enforcement works. Process compliance doesn't.**
|
||||||
│ docs/DOCKER.md │ Docker deployment │
|
|
||||||
├───────────────────────────┼───────────────────────┤
|
See `docs/quality-rails-status.md` for detailed roadmap and violation breakdown.
|
||||||
│ docs/API.md │ API documentation │
|
|
||||||
└───────────────────────────┴───────────────────────┘
|
Example TDD Session
|
||||||
Related Repositories
|
|
||||||
┌──────────────┬──────────────────────────────────────────────┐
|
```bash
|
||||||
│ Repo │ Purpose │
|
# 1. RED - Write failing test
|
||||||
├──────────────┼──────────────────────────────────────────────┤
|
# Edit: feature.service.spec.ts
|
||||||
│ jarvis-brain │ Original JSON-based brain (migration source) │
|
# Add test for getUserById()
|
||||||
├──────────────┼──────────────────────────────────────────────┤
|
pnpm test:watch # Watch it fail
|
||||||
│ MoltBot │ Stock messaging gateway │
|
git add feature.service.spec.ts
|
||||||
└──────────────┴──────────────────────────────────────────────┘
|
git commit -m "test(#42): add test for getUserById"
|
||||||
---
|
|
||||||
Mosaic Stack v0.0.x — Building the future of personal assistants.
|
# 2. GREEN - Implement minimal code
|
||||||
|
# Edit: feature.service.ts
|
||||||
|
# Add getUserById() method
|
||||||
|
pnpm test:watch # Watch it pass
|
||||||
|
git add feature.service.ts
|
||||||
|
git commit -m "feat(#42): implement getUserById"
|
||||||
|
|
||||||
|
# 3. REFACTOR - Improve code quality
|
||||||
|
# Edit: feature.service.ts
|
||||||
|
# Extract helper, improve naming
|
||||||
|
pnpm test:watch # Ensure still passing
|
||||||
|
git add feature.service.ts
|
||||||
|
git commit -m "refactor(#42): extract user mapping logic"
|
||||||
|
```
|
||||||
|
|
||||||
|
Docker Deployment
|
||||||
|
|
||||||
|
Turnkey (includes everything)
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
Customized (external services)
|
||||||
|
|
||||||
|
Create docker-compose.override.yml to:
|
||||||
|
|
||||||
|
- Point to external PostgreSQL/Valkey/Ollama
|
||||||
|
- Disable bundled services
|
||||||
|
|
||||||
|
See docs/DOCKER.md for details.
|
||||||
|
|
||||||
|
Key Documentation
|
||||||
|
┌───────────────────────────┬───────────────────────┐
|
||||||
|
│ Document │ Purpose │
|
||||||
|
├───────────────────────────┼───────────────────────┤
|
||||||
|
│ docs/SETUP.md │ Installation guide │
|
||||||
|
├───────────────────────────┼───────────────────────┤
|
||||||
|
│ docs/CONFIGURATION.md │ All config options │
|
||||||
|
├───────────────────────────┼───────────────────────┤
|
||||||
|
│ docs/DESIGN-PRINCIPLES.md │ PDA-friendly patterns │
|
||||||
|
├───────────────────────────┼───────────────────────┤
|
||||||
|
│ docs/DOCKER.md │ Docker deployment │
|
||||||
|
├───────────────────────────┼───────────────────────┤
|
||||||
|
│ docs/API.md │ API documentation │
|
||||||
|
└───────────────────────────┴───────────────────────┘
|
||||||
|
Related Repositories
|
||||||
|
┌──────────────┬──────────────────────────────────────────────┐
|
||||||
|
│ Repo │ Purpose │
|
||||||
|
├──────────────┼──────────────────────────────────────────────┤
|
||||||
|
│ jarvis-brain │ Original JSON-based brain (migration source) │
|
||||||
|
├──────────────┼──────────────────────────────────────────────┤
|
||||||
|
│ MoltBot │ Stock messaging gateway │
|
||||||
|
└──────────────┴──────────────────────────────────────────────┘
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Mosaic Stack v0.0.x — Building the future of personal assistants.
|
||||||
|
|||||||
197
docs/quality-rails-status.md
Normal file
197
docs/quality-rails-status.md
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
# Quality Rails Status
|
||||||
|
|
||||||
|
## Installation Date
|
||||||
|
|
||||||
|
2026-01-30
|
||||||
|
|
||||||
|
## Current Status: **INSTALLED - PARTIAL ENFORCEMENT**
|
||||||
|
|
||||||
|
Quality Rails has been successfully installed but is currently in **formatting-only mode** due to existing codebase violations.
|
||||||
|
|
||||||
|
## What's Installed
|
||||||
|
|
||||||
|
### ✅ Pre-Commit Hooks (.husky/)
|
||||||
|
|
||||||
|
- Runs lint-staged on every commit
|
||||||
|
- Currently only enforces Prettier formatting
|
||||||
|
- Ready to enable full enforcement once violations are fixed
|
||||||
|
|
||||||
|
### ✅ Enhanced ESLint Rules
|
||||||
|
|
||||||
|
Added to `packages/config/eslint/base.js`:
|
||||||
|
|
||||||
|
- `@typescript-eslint/no-explicit-any: "error"` - Block any types
|
||||||
|
- `@typescript-eslint/explicit-function-return-type: "warn"` - Require return types
|
||||||
|
- `@typescript-eslint/explicit-module-boundary-types: "error"` - Export type safety
|
||||||
|
- `eslint-plugin-security` - SQL injection, XSS detection
|
||||||
|
- Promise/async safety rules
|
||||||
|
- Code quality improvements
|
||||||
|
|
||||||
|
### ✅ CI/CD Pipeline (.woodpecker.yml)
|
||||||
|
|
||||||
|
Ready to use (not yet configured in CI system):
|
||||||
|
|
||||||
|
- npm audit (dependency security)
|
||||||
|
- eslint (code quality)
|
||||||
|
- tsc (type checking)
|
||||||
|
- vitest (tests + 80% coverage threshold)
|
||||||
|
- build (compilation)
|
||||||
|
|
||||||
|
### ✅ Dependencies Added
|
||||||
|
|
||||||
|
- husky@9.1.7 - Git hook management
|
||||||
|
- lint-staged@16.2.7 - Staged file checking
|
||||||
|
- eslint-plugin-security@3.0.1 - Security vulnerability detection
|
||||||
|
|
||||||
|
## Current Violations
|
||||||
|
|
||||||
|
**Total violations found: 1,226** (1,121 errors, 105 warnings)
|
||||||
|
|
||||||
|
### Breakdown by Category:
|
||||||
|
|
||||||
|
- **Explicit `any` types**: ~400+ violations
|
||||||
|
- **Unsafe member access**: ~300+ violations
|
||||||
|
- **Missing return types**: ~200+ violations
|
||||||
|
- **Code quality issues**: ~105 violations
|
||||||
|
- **Formatting issues**: ~200+ violations
|
||||||
|
|
||||||
|
### Most Common Violations:
|
||||||
|
|
||||||
|
1. `@typescript-eslint/no-explicit-any` - Unexpected any types
|
||||||
|
2. `@typescript-eslint/no-unsafe-member-access` - Unsafe any usage
|
||||||
|
3. `@typescript-eslint/no-unsafe-assignment` - Unsafe any assignment
|
||||||
|
4. `prettier/prettier` - Formatting inconsistencies
|
||||||
|
5. `@typescript-eslint/prefer-nullish-coalescing` - Use ?? instead of ||
|
||||||
|
|
||||||
|
## Roadmap to Full Enforcement
|
||||||
|
|
||||||
|
### Phase 1: Fix Existing Violations (Current)
|
||||||
|
|
||||||
|
**Goal**: Reduce violations to zero
|
||||||
|
|
||||||
|
**Priority order**:
|
||||||
|
|
||||||
|
1. Security issues (if any from eslint-plugin-security)
|
||||||
|
2. Explicit `any` types → Replace with proper types
|
||||||
|
3. Unsafe member access → Add type guards
|
||||||
|
4. Missing return types → Add explicit types
|
||||||
|
5. Code quality warnings → Refactor where beneficial
|
||||||
|
|
||||||
|
**Approach**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run lint to see all violations
|
||||||
|
pnpm turbo run lint
|
||||||
|
|
||||||
|
# Fix auto-fixable issues first
|
||||||
|
pnpm turbo run lint:fix
|
||||||
|
|
||||||
|
# Then manually fix remaining issues package by package
|
||||||
|
pnpm turbo run lint --filter=@mosaic/api
|
||||||
|
```
|
||||||
|
|
||||||
|
**Estimated effort**: 20-40 hours (depending on thoroughness)
|
||||||
|
|
||||||
|
### Phase 2: Enable Strict Pre-Commit Enforcement
|
||||||
|
|
||||||
|
Once violations are at zero, update `.lintstagedrc.mjs`:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
export default {
|
||||||
|
"**/*.{ts,tsx}": (filenames) => {
|
||||||
|
const packages = [
|
||||||
|
...new Set(
|
||||||
|
filenames.map((f) => {
|
||||||
|
const match = f.match(/^(apps|packages)\/([^/]+)\//);
|
||||||
|
return match ? `@mosaic/${match[2]}` : null;
|
||||||
|
})
|
||||||
|
),
|
||||||
|
].filter(Boolean);
|
||||||
|
|
||||||
|
if (packages.length === 0) return [];
|
||||||
|
|
||||||
|
// STRICT ENFORCEMENT - blocks commits with violations
|
||||||
|
return packages.map(
|
||||||
|
(pkg) => `pnpm turbo run lint typecheck --filter=@mosaic/${pkg} -- --max-warnings=0`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
"**/*.{js,jsx,ts,tsx,json,md,yml,yaml}": ["prettier --write"],
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### Phase 3: Enable CI/CD Enforcement
|
||||||
|
|
||||||
|
Configure Woodpecker CI (or GitHub Actions) to run `.woodpecker.yml` pipeline on every PR.
|
||||||
|
|
||||||
|
This will block PRs that:
|
||||||
|
|
||||||
|
- Have dependency vulnerabilities (npm audit)
|
||||||
|
- Don't pass linting (eslint)
|
||||||
|
- Don't pass type checking (tsc)
|
||||||
|
- Have test failures or <80% coverage
|
||||||
|
- Don't build successfully
|
||||||
|
|
||||||
|
## Testing Enforcement
|
||||||
|
|
||||||
|
### Test that pre-commit hooks work:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create a file with violations
|
||||||
|
echo 'export function bad(x: any) { return x; }' > test.ts
|
||||||
|
git add test.ts
|
||||||
|
git commit -m "test"
|
||||||
|
# Should be BLOCKED once strict enforcement is enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test that CI enforcement works:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Push a branch with violations
|
||||||
|
# CI should fail the build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benefits Once Fully Enabled
|
||||||
|
|
||||||
|
Based on Quality Rails validation of 50 real production issues:
|
||||||
|
|
||||||
|
| Issue Category | Current Status | After Full Enforcement |
|
||||||
|
| ------------------- | -------------------- | ----------------------------- |
|
||||||
|
| Hardcoded passwords | Possible | ✅ BLOCKED by git-secrets |
|
||||||
|
| SQL injection | Possible | ✅ BLOCKED by security plugin |
|
||||||
|
| Type safety (`any`) | **1,121 violations** | ✅ BLOCKED by no-explicit-any |
|
||||||
|
| Silent failures | Partial protection | ⚠️ Partially blocked |
|
||||||
|
| Test coverage gaps | Not enforced | ✅ BLOCKED by 80% threshold |
|
||||||
|
| Build failures | Not enforced | ✅ BLOCKED by pre-commit tsc |
|
||||||
|
| Dependency CVEs | Not enforced | ✅ BLOCKED by npm audit |
|
||||||
|
|
||||||
|
**Expected impact: ~70% of quality issues prevented mechanically**
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
### git-secrets (Optional)
|
||||||
|
|
||||||
|
The pre-commit hook tries to run `git-secrets` but falls back gracefully if not installed.
|
||||||
|
|
||||||
|
To install git-secrets for secret scanning:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install git-secrets (platform-specific)
|
||||||
|
# Then configure patterns:
|
||||||
|
git secrets --add 'password\s*=\s*["\'].*["\']'
|
||||||
|
git secrets --add 'api[_-]?key\s*=\s*["\'].*["\']'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Turbo Caching
|
||||||
|
|
||||||
|
Turbo caches lint and typecheck results, so repeated runs are fast. Only changed packages are re-checked.
|
||||||
|
|
||||||
|
### IDE Integration
|
||||||
|
|
||||||
|
ESLint rules are enforced in VSCode/other IDEs automatically. Developers will see errors in real-time before committing.
|
||||||
|
|
||||||
|
## Questions?
|
||||||
|
|
||||||
|
- See quality-rails documentation: `~/src/quality-rails/`
|
||||||
|
- See PHILOSOPHY.md for why mechanical enforcement matters
|
||||||
|
- Check existing issues for progress on fixing violations
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/.lintstagedrc.js
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-01-30 13:10:12
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-.lintstagedrc.js_20260130-1310_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/.lintstagedrc.mjs
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-01-30 13:12:00
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-.lintstagedrc.mjs_20260130-1312_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/.lintstagedrc.mjs
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 2
|
||||||
|
**Generated:** 2026-01-30 13:12:17
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-.lintstagedrc.mjs_20260130-1312_2_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/.lintstagedrc.mjs
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 3
|
||||||
|
**Generated:** 2026-01-30 13:12:44
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-.lintstagedrc.mjs_20260130-1312_3_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/.lintstagedrc.mjs
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 4
|
||||||
|
**Generated:** 2026-01-30 13:12:59
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-.lintstagedrc.mjs_20260130-1312_4_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /home/localadmin/src/mosaic-stack/packages/config/eslint/base.js
|
||||||
|
**Tool Used:** Edit
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-01-30 13:09:17
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-packages-config-eslint-base.js_20260130-1309_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# QA Remediation Report
|
||||||
|
|
||||||
|
**File:** /tmp/claude-1000/-home-localadmin-src-mosaic-stack/f3beb7a6-6cd5-4bee-8283-fac0798a92fa/scratchpad/test-violations.ts
|
||||||
|
**Tool Used:** Write
|
||||||
|
**Epic:** general
|
||||||
|
**Iteration:** 1
|
||||||
|
**Generated:** 2026-01-30 13:09:55
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
Pending QA validation
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
This report was created by the QA automation hook.
|
||||||
|
To process this report, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/tmp-claude-1000--home-localadmin-src-mosaic-stack-f3beb7a6-6cd5-4bee-8283-fac0798a92fa-scratchpad-test-violations.ts_20260130-1309_1_remediation_needed.md"
|
||||||
|
```
|
||||||
@@ -26,7 +26,8 @@
|
|||||||
"docker:logs": "docker compose logs -f",
|
"docker:logs": "docker compose logs -f",
|
||||||
"docker:ps": "docker compose ps",
|
"docker:ps": "docker compose ps",
|
||||||
"docker:build": "docker compose build",
|
"docker:build": "docker compose build",
|
||||||
"docker:restart": "docker compose restart"
|
"docker:restart": "docker compose restart",
|
||||||
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
||||||
@@ -35,6 +36,9 @@
|
|||||||
"eslint": "^9.21.0",
|
"eslint": "^9.21.0",
|
||||||
"eslint-config-prettier": "^10.1.0",
|
"eslint-config-prettier": "^10.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.3",
|
"eslint-plugin-prettier": "^5.2.3",
|
||||||
|
"eslint-plugin-security": "^3.0.1",
|
||||||
|
"husky": "^9.1.7",
|
||||||
|
"lint-staged": "^16.2.7",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"turbo": "^2.8.0",
|
"turbo": "^2.8.0",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import eslint from "@eslint/js";
|
|||||||
import tseslint from "typescript-eslint";
|
import tseslint from "typescript-eslint";
|
||||||
import prettierConfig from "eslint-config-prettier";
|
import prettierConfig from "eslint-config-prettier";
|
||||||
import prettierPlugin from "eslint-plugin-prettier";
|
import prettierPlugin from "eslint-plugin-prettier";
|
||||||
|
// @ts-expect-error - security plugin doesn't have types
|
||||||
|
import securityPlugin from "eslint-plugin-security";
|
||||||
|
|
||||||
export default tseslint.config(
|
export default tseslint.config(
|
||||||
eslint.configs.recommended,
|
eslint.configs.recommended,
|
||||||
@@ -11,19 +13,42 @@ export default tseslint.config(
|
|||||||
{
|
{
|
||||||
plugins: {
|
plugins: {
|
||||||
prettier: prettierPlugin,
|
prettier: prettierPlugin,
|
||||||
|
security: securityPlugin,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
|
// Prettier
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
|
|
||||||
|
// Type Safety - STRICT (Quality Rails)
|
||||||
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
|
"@typescript-eslint/explicit-function-return-type": "warn",
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": "error",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
"error",
|
"error",
|
||||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
||||||
],
|
],
|
||||||
"@typescript-eslint/consistent-type-imports": [
|
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
|
||||||
"error",
|
|
||||||
{ prefer: "type-imports" },
|
// Promise/Async Safety (Quality Rails)
|
||||||
],
|
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
"@typescript-eslint/no-misused-promises": "error",
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
|
"@typescript-eslint/await-thenable": "error",
|
||||||
|
|
||||||
|
// Code Quality (Quality Rails)
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
||||||
|
"@typescript-eslint/prefer-optional-chain": "warn",
|
||||||
|
|
||||||
|
// Security (Quality Rails)
|
||||||
|
"security/detect-object-injection": "off", // Too many false positives
|
||||||
|
"security/detect-non-literal-fs-filename": "warn",
|
||||||
|
"security/detect-non-literal-regexp": "warn",
|
||||||
|
"security/detect-unsafe-regex": "error",
|
||||||
|
"security/detect-buffer-noassert": "error",
|
||||||
|
"security/detect-eval-with-expression": "error",
|
||||||
|
"security/detect-no-csrf-before-method-override": "error",
|
||||||
|
"security/detect-possible-timing-attacks": "warn",
|
||||||
|
"security/detect-pseudoRandomBytes": "error",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"eslint": "^9.21.0",
|
"eslint": "^9.21.0",
|
||||||
"eslint-config-prettier": "^10.1.0",
|
"eslint-config-prettier": "^10.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.3",
|
"eslint-plugin-prettier": "^5.2.3",
|
||||||
|
"eslint-plugin-security": "^3.0.1",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"typescript-eslint": "^8.26.0"
|
"typescript-eslint": "^8.26.0"
|
||||||
},
|
},
|
||||||
|
|||||||
757
pnpm-lock.yaml
generated
757
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user