@revealui/mcp 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/LICENSE.commercial +111 -0
- package/README.md +3 -0
- package/dist/{packages/mcp/src/adapters → adapters}/db.d.ts +1 -1
- package/dist/adapters/db.d.ts.map +1 -0
- package/dist/adapters/db.js.map +1 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js.map +1 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js.map +1 -0
- package/dist/{packages/mcp/src/hypervisor.d.ts → hypervisor.d.ts} +56 -0
- package/dist/hypervisor.d.ts.map +1 -0
- package/dist/{packages/mcp/src/hypervisor.js → hypervisor.js} +209 -1
- package/dist/hypervisor.js.map +1 -0
- package/dist/{packages/mcp/src/index.d.ts → index.d.ts} +9 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/{packages/mcp/src/index.js → index.js} +8 -4
- package/dist/index.js.map +1 -0
- package/dist/{packages/mcp/src/servers → servers}/adapter.d.ts +11 -1
- package/dist/servers/adapter.d.ts.map +1 -0
- package/dist/{packages/mcp/src/servers → servers}/adapter.js +20 -4
- package/dist/servers/adapter.js.map +1 -0
- package/dist/servers/revealui-content.d.ts +21 -0
- package/dist/servers/revealui-content.d.ts.map +1 -0
- package/dist/servers/revealui-content.js +211 -0
- package/dist/servers/revealui-content.js.map +1 -0
- package/dist/servers/revealui-email.d.ts +18 -0
- package/dist/servers/revealui-email.d.ts.map +1 -0
- package/dist/servers/revealui-email.js +190 -0
- package/dist/servers/revealui-email.js.map +1 -0
- package/dist/servers/revealui-stripe.d.ts +19 -0
- package/dist/servers/revealui-stripe.d.ts.map +1 -0
- package/dist/servers/revealui-stripe.js +228 -0
- package/dist/servers/revealui-stripe.js.map +1 -0
- package/package.json +50 -11
- package/.env.example +0 -9
- package/MCP_MAINTENANCE.md +0 -265
- package/__tests__/crdt.integration.test.ts +0 -156
- package/configs/README.md +0 -77
- package/configs/claude-template.json +0 -54
- package/dist/packages/core/src/database/ssl-config.d.ts +0 -9
- package/dist/packages/core/src/database/ssl-config.d.ts.map +0 -1
- package/dist/packages/core/src/database/ssl-config.js +0 -8
- package/dist/packages/core/src/database/ssl-config.js.map +0 -1
- package/dist/packages/core/src/features.d.ts +0 -86
- package/dist/packages/core/src/features.d.ts.map +0 -1
- package/dist/packages/core/src/features.js +0 -93
- package/dist/packages/core/src/features.js.map +0 -1
- package/dist/packages/core/src/license.d.ts +0 -75
- package/dist/packages/core/src/license.d.ts.map +0 -1
- package/dist/packages/core/src/license.js +0 -174
- package/dist/packages/core/src/license.js.map +0 -1
- package/dist/packages/core/src/monitoring/alerts.d.ts +0 -118
- package/dist/packages/core/src/monitoring/alerts.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/alerts.js +0 -325
- package/dist/packages/core/src/monitoring/alerts.js.map +0 -1
- package/dist/packages/core/src/monitoring/cleanup-manager.d.ts +0 -71
- package/dist/packages/core/src/monitoring/cleanup-manager.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/cleanup-manager.js +0 -227
- package/dist/packages/core/src/monitoring/cleanup-manager.js.map +0 -1
- package/dist/packages/core/src/monitoring/health-monitor.d.ts +0 -22
- package/dist/packages/core/src/monitoring/health-monitor.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/health-monitor.js +0 -143
- package/dist/packages/core/src/monitoring/health-monitor.js.map +0 -1
- package/dist/packages/core/src/monitoring/index.d.ts +0 -14
- package/dist/packages/core/src/monitoring/index.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/index.js +0 -18
- package/dist/packages/core/src/monitoring/index.js.map +0 -1
- package/dist/packages/core/src/monitoring/process-registry.d.ts +0 -97
- package/dist/packages/core/src/monitoring/process-registry.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/process-registry.js +0 -223
- package/dist/packages/core/src/monitoring/process-registry.js.map +0 -1
- package/dist/packages/core/src/monitoring/types.d.ts +0 -231
- package/dist/packages/core/src/monitoring/types.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/types.js +0 -43
- package/dist/packages/core/src/monitoring/types.js.map +0 -1
- package/dist/packages/core/src/monitoring/zombie-detector.d.ts +0 -81
- package/dist/packages/core/src/monitoring/zombie-detector.d.ts.map +0 -1
- package/dist/packages/core/src/monitoring/zombie-detector.js +0 -232
- package/dist/packages/core/src/monitoring/zombie-detector.js.map +0 -1
- package/dist/packages/core/src/observability/logger.d.ts +0 -47
- package/dist/packages/core/src/observability/logger.d.ts.map +0 -1
- package/dist/packages/core/src/observability/logger.js +0 -141
- package/dist/packages/core/src/observability/logger.js.map +0 -1
- package/dist/packages/core/src/utils/logger-server.d.ts +0 -32
- package/dist/packages/core/src/utils/logger-server.d.ts.map +0 -1
- package/dist/packages/core/src/utils/logger-server.js +0 -69
- package/dist/packages/core/src/utils/logger-server.js.map +0 -1
- package/dist/packages/core/src/utils/request-context.d.ts +0 -143
- package/dist/packages/core/src/utils/request-context.d.ts.map +0 -1
- package/dist/packages/core/src/utils/request-context.js +0 -169
- package/dist/packages/core/src/utils/request-context.js.map +0 -1
- package/dist/packages/dev/src/code-validator/index.d.ts +0 -20
- package/dist/packages/dev/src/code-validator/index.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/index.js +0 -20
- package/dist/packages/dev/src/code-validator/index.js.map +0 -1
- package/dist/packages/dev/src/code-validator/types.d.ts +0 -67
- package/dist/packages/dev/src/code-validator/types.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/types.js +0 -7
- package/dist/packages/dev/src/code-validator/types.js.map +0 -1
- package/dist/packages/dev/src/code-validator/validator.d.ts +0 -48
- package/dist/packages/dev/src/code-validator/validator.d.ts.map +0 -1
- package/dist/packages/dev/src/code-validator/validator.js +0 -176
- package/dist/packages/dev/src/code-validator/validator.js.map +0 -1
- package/dist/packages/mcp/src/adapters/db.d.ts.map +0 -1
- package/dist/packages/mcp/src/adapters/db.js.map +0 -1
- package/dist/packages/mcp/src/config/index.d.ts.map +0 -1
- package/dist/packages/mcp/src/config/index.js.map +0 -1
- package/dist/packages/mcp/src/contracts.d.ts.map +0 -1
- package/dist/packages/mcp/src/contracts.js.map +0 -1
- package/dist/packages/mcp/src/hypervisor.d.ts.map +0 -1
- package/dist/packages/mcp/src/hypervisor.js.map +0 -1
- package/dist/packages/mcp/src/index.d.ts.map +0 -1
- package/dist/packages/mcp/src/index.js.map +0 -1
- package/dist/packages/mcp/src/servers/adapter.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/adapter.js.map +0 -1
- package/dist/packages/mcp/src/servers/code-validator.d.ts +0 -24
- package/dist/packages/mcp/src/servers/code-validator.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/code-validator.js +0 -156
- package/dist/packages/mcp/src/servers/code-validator.js.map +0 -1
- package/dist/packages/mcp/src/servers/neon.d.ts +0 -11
- package/dist/packages/mcp/src/servers/neon.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/neon.js +0 -90
- package/dist/packages/mcp/src/servers/neon.js.map +0 -1
- package/dist/packages/mcp/src/servers/next-devtools.d.ts +0 -11
- package/dist/packages/mcp/src/servers/next-devtools.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/next-devtools.js +0 -215
- package/dist/packages/mcp/src/servers/next-devtools.js.map +0 -1
- package/dist/packages/mcp/src/servers/playwright.d.ts +0 -11
- package/dist/packages/mcp/src/servers/playwright.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/playwright.js +0 -68
- package/dist/packages/mcp/src/servers/playwright.js.map +0 -1
- package/dist/packages/mcp/src/servers/stripe.d.ts +0 -11
- package/dist/packages/mcp/src/servers/stripe.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/stripe.js +0 -86
- package/dist/packages/mcp/src/servers/stripe.js.map +0 -1
- package/dist/packages/mcp/src/servers/supabase.d.ts +0 -11
- package/dist/packages/mcp/src/servers/supabase.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/supabase.js +0 -144
- package/dist/packages/mcp/src/servers/supabase.js.map +0 -1
- package/dist/packages/mcp/src/servers/vercel.d.ts +0 -11
- package/dist/packages/mcp/src/servers/vercel.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/vercel.js +0 -87
- package/dist/packages/mcp/src/servers/vercel.js.map +0 -1
- package/dist/packages/mcp/src/servers/vultr-test.d.ts +0 -3
- package/dist/packages/mcp/src/servers/vultr-test.d.ts.map +0 -1
- package/dist/packages/mcp/src/servers/vultr-test.js +0 -82
- package/dist/packages/mcp/src/servers/vultr-test.js.map +0 -1
- package/dist/scripts/lib/analyzers/console-analyzer.d.ts +0 -188
- package/dist/scripts/lib/analyzers/console-analyzer.d.ts.map +0 -1
- package/dist/scripts/lib/analyzers/console-analyzer.js +0 -432
- package/dist/scripts/lib/analyzers/console-analyzer.js.map +0 -1
- package/dist/scripts/lib/analyzers/index.d.ts +0 -11
- package/dist/scripts/lib/analyzers/index.d.ts.map +0 -1
- package/dist/scripts/lib/analyzers/index.js +0 -11
- package/dist/scripts/lib/analyzers/index.js.map +0 -1
- package/dist/scripts/lib/args.d.ts +0 -104
- package/dist/scripts/lib/args.d.ts.map +0 -1
- package/dist/scripts/lib/args.js +0 -304
- package/dist/scripts/lib/args.js.map +0 -1
- package/dist/scripts/lib/cache.d.ts +0 -185
- package/dist/scripts/lib/cache.d.ts.map +0 -1
- package/dist/scripts/lib/cache.js +0 -390
- package/dist/scripts/lib/cache.js.map +0 -1
- package/dist/scripts/lib/cli/dispatch.d.ts +0 -116
- package/dist/scripts/lib/cli/dispatch.d.ts.map +0 -1
- package/dist/scripts/lib/cli/dispatch.js +0 -206
- package/dist/scripts/lib/cli/dispatch.js.map +0 -1
- package/dist/scripts/lib/cli/index.d.ts +0 -10
- package/dist/scripts/lib/cli/index.d.ts.map +0 -1
- package/dist/scripts/lib/cli/index.js +0 -10
- package/dist/scripts/lib/cli/index.js.map +0 -1
- package/dist/scripts/lib/database/ssl-config.d.ts +0 -26
- package/dist/scripts/lib/database/ssl-config.d.ts.map +0 -1
- package/dist/scripts/lib/database/ssl-config.js +0 -47
- package/dist/scripts/lib/database/ssl-config.js.map +0 -1
- package/dist/scripts/lib/errors.d.ts +0 -218
- package/dist/scripts/lib/errors.d.ts.map +0 -1
- package/dist/scripts/lib/errors.js +0 -543
- package/dist/scripts/lib/errors.js.map +0 -1
- package/dist/scripts/lib/exec.d.ts +0 -107
- package/dist/scripts/lib/exec.d.ts.map +0 -1
- package/dist/scripts/lib/exec.js +0 -232
- package/dist/scripts/lib/exec.js.map +0 -1
- package/dist/scripts/lib/index.d.ts +0 -50
- package/dist/scripts/lib/index.d.ts.map +0 -1
- package/dist/scripts/lib/index.js +0 -65
- package/dist/scripts/lib/index.js.map +0 -1
- package/dist/scripts/lib/logger.d.ts +0 -50
- package/dist/scripts/lib/logger.d.ts.map +0 -1
- package/dist/scripts/lib/logger.js +0 -159
- package/dist/scripts/lib/logger.js.map +0 -1
- package/dist/scripts/lib/output.d.ts +0 -149
- package/dist/scripts/lib/output.d.ts.map +0 -1
- package/dist/scripts/lib/output.js +0 -263
- package/dist/scripts/lib/output.js.map +0 -1
- package/dist/scripts/lib/parallel.d.ts +0 -164
- package/dist/scripts/lib/parallel.d.ts.map +0 -1
- package/dist/scripts/lib/parallel.js +0 -355
- package/dist/scripts/lib/parallel.js.map +0 -1
- package/dist/scripts/lib/paths.d.ts +0 -92
- package/dist/scripts/lib/paths.d.ts.map +0 -1
- package/dist/scripts/lib/paths.js +0 -171
- package/dist/scripts/lib/paths.js.map +0 -1
- package/dist/scripts/lib/state/adapters/memory.d.ts +0 -42
- package/dist/scripts/lib/state/adapters/memory.d.ts.map +0 -1
- package/dist/scripts/lib/state/adapters/memory.js +0 -110
- package/dist/scripts/lib/state/adapters/memory.js.map +0 -1
- package/dist/scripts/lib/state/adapters/pglite.d.ts +0 -46
- package/dist/scripts/lib/state/adapters/pglite.d.ts.map +0 -1
- package/dist/scripts/lib/state/adapters/pglite.js +0 -256
- package/dist/scripts/lib/state/adapters/pglite.js.map +0 -1
- package/dist/scripts/lib/state/index.d.ts +0 -16
- package/dist/scripts/lib/state/index.d.ts.map +0 -1
- package/dist/scripts/lib/state/index.js +0 -16
- package/dist/scripts/lib/state/index.js.map +0 -1
- package/dist/scripts/lib/state/types.d.ts +0 -111
- package/dist/scripts/lib/state/types.d.ts.map +0 -1
- package/dist/scripts/lib/state/types.js +0 -8
- package/dist/scripts/lib/state/types.js.map +0 -1
- package/dist/scripts/lib/state/workflow-state.d.ts +0 -110
- package/dist/scripts/lib/state/workflow-state.d.ts.map +0 -1
- package/dist/scripts/lib/state/workflow-state.js +0 -331
- package/dist/scripts/lib/state/workflow-state.js.map +0 -1
- package/dist/scripts/lib/telemetry.d.ts +0 -194
- package/dist/scripts/lib/telemetry.d.ts.map +0 -1
- package/dist/scripts/lib/telemetry.js +0 -394
- package/dist/scripts/lib/telemetry.js.map +0 -1
- package/dist/scripts/lib/utils.d.ts +0 -270
- package/dist/scripts/lib/utils.d.ts.map +0 -1
- package/dist/scripts/lib/utils.js +0 -473
- package/dist/scripts/lib/utils.js.map +0 -1
- package/dist/scripts/lib/validation/database.d.ts +0 -83
- package/dist/scripts/lib/validation/database.d.ts.map +0 -1
- package/dist/scripts/lib/validation/database.js +0 -199
- package/dist/scripts/lib/validation/database.js.map +0 -1
- package/dist/scripts/lib/validation/env.d.ts +0 -80
- package/dist/scripts/lib/validation/env.d.ts.map +0 -1
- package/dist/scripts/lib/validation/env.js +0 -246
- package/dist/scripts/lib/validation/env.js.map +0 -1
- package/dist/scripts/lib/validation/index.d.ts +0 -16
- package/dist/scripts/lib/validation/index.d.ts.map +0 -1
- package/dist/scripts/lib/validation/index.js +0 -16
- package/dist/scripts/lib/validation/index.js.map +0 -1
- package/dist/scripts/lib/validation/post-execution.d.ts +0 -74
- package/dist/scripts/lib/validation/post-execution.d.ts.map +0 -1
- package/dist/scripts/lib/validation/post-execution.js +0 -110
- package/dist/scripts/lib/validation/post-execution.js.map +0 -1
- package/dist/scripts/lib/validation/pre-execution.d.ts +0 -165
- package/dist/scripts/lib/validation/pre-execution.d.ts.map +0 -1
- package/dist/scripts/lib/validation/pre-execution.js +0 -466
- package/dist/scripts/lib/validation/pre-execution.js.map +0 -1
- package/dist/scripts/lib/validators/documentation-validator.d.ts +0 -242
- package/dist/scripts/lib/validators/documentation-validator.d.ts.map +0 -1
- package/dist/scripts/lib/validators/documentation-validator.js +0 -584
- package/dist/scripts/lib/validators/documentation-validator.js.map +0 -1
- package/dist/scripts/lib/validators/index.d.ts +0 -11
- package/dist/scripts/lib/validators/index.d.ts.map +0 -1
- package/dist/scripts/lib/validators/index.js +0 -11
- package/dist/scripts/lib/validators/index.js.map +0 -1
- package/docker-compose.yml +0 -46
- package/docs/INDEX.md +0 -88
- package/docs/README.md +0 -774
- package/docs/SETUP.md +0 -264
- package/docs/servers/code-validator.md +0 -586
- package/eslint.config.js +0 -7
- package/migrations/0001_add_crdt_columns.sql +0 -8
- package/migrations/0001_rollback.sql +0 -6
- package/migrations/005_performance_indexes.sql +0 -190
- package/migrations/backfill_crdt_meta.js +0 -45
- package/src/__tests__/hypervisor.test.ts +0 -212
- package/src/adapters/db.ts +0 -180
- package/src/config/config.json +0 -49
- package/src/config/index.ts +0 -30
- package/src/contracts.ts +0 -221
- package/src/hypervisor.ts +0 -464
- package/src/index.ts +0 -87
- package/src/servers/adapter.ts +0 -643
- package/src/servers/code-validator.ts +0 -188
- package/src/servers/neon.ts +0 -103
- package/src/servers/next-devtools.ts +0 -230
- package/src/servers/playwright.ts +0 -77
- package/src/servers/stripe.ts +0 -99
- package/src/servers/supabase.ts +0 -161
- package/src/servers/vercel.ts +0 -100
- package/src/servers/vultr-test.ts +0 -97
- package/tsconfig.json +0 -12
- package/vitest.config.ts +0 -22
- /package/dist/{packages/mcp/src/adapters → adapters}/db.js +0 -0
- /package/dist/{packages/mcp/src/config → config}/index.d.ts +0 -0
- /package/dist/{packages/mcp/src/config → config}/index.js +0 -0
- /package/dist/{packages/mcp/src/contracts.d.ts → contracts.d.ts} +0 -0
- /package/dist/{packages/mcp/src/contracts.js → contracts.js} +0 -0
|
@@ -1,586 +0,0 @@
|
|
|
1
|
-
# AI Code Standards Enforcer
|
|
2
|
-
|
|
3
|
-
**Prevents AI-generated technical debt before it enters the codebase**
|
|
4
|
-
|
|
5
|
-
## Problem Statement
|
|
6
|
-
|
|
7
|
-
AI assistants (including Claude) have a pattern of generating code with anti-patterns like `console.log`, `any` types, and `TODO` comments without issue references, then later identifying these same patterns as technical debt that needs cleanup.
|
|
8
|
-
|
|
9
|
-
This creates a cycle of:
|
|
10
|
-
1. AI generates code with console.log
|
|
11
|
-
2. Code gets committed
|
|
12
|
-
3. AI audits codebase, finds 11k-62k console statements
|
|
13
|
-
4. AI recommends cleanup (60-80 hours of work)
|
|
14
|
-
|
|
15
|
-
**Solution:** Validate code at creation time, not cleanup time.
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Architecture
|
|
20
|
-
|
|
21
|
-
### Three-Layer Defense
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
┌─────────────────────────────────────────────┐
|
|
25
|
-
│ Layer 1: MCP Tool (Real-time validation) │
|
|
26
|
-
│ Claude calls validate_code before Write │
|
|
27
|
-
└──────────────┬──────────────────────────────┘
|
|
28
|
-
│
|
|
29
|
-
▼
|
|
30
|
-
┌─────────────────────────────────────────────┐
|
|
31
|
-
│ Layer 2: Pre-commit Hook (Safety net) │
|
|
32
|
-
│ Validates staged files before commit │
|
|
33
|
-
└──────────────┬──────────────────────────────┘
|
|
34
|
-
│
|
|
35
|
-
▼
|
|
36
|
-
┌─────────────────────────────────────────────┐
|
|
37
|
-
│ Layer 3: CI/CD (Final gate) │
|
|
38
|
-
│ Validates all code in pull requests │
|
|
39
|
-
└─────────────────────────────────────────────┘
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Components
|
|
43
|
-
|
|
44
|
-
1. **Validation Rules** (`.revealui/code-standards.json`)
|
|
45
|
-
- Defines what patterns are violations
|
|
46
|
-
- Severity levels (error, warning, info)
|
|
47
|
-
- Exemptions (test files, scripts, etc.)
|
|
48
|
-
- Suggested fixes
|
|
49
|
-
|
|
50
|
-
2. **Core Validator** (`packages/dev/src/code-validator`)
|
|
51
|
-
- Pattern matching engine
|
|
52
|
-
- Context extraction
|
|
53
|
-
- Auto-fix capabilities
|
|
54
|
-
- Exemption handling
|
|
55
|
-
|
|
56
|
-
3. **MCP Server** (`packages/mcp/src/servers/code-validator.ts`)
|
|
57
|
-
- Exposes `validate_code` tool to Claude
|
|
58
|
-
- Integrates with Model Context Protocol
|
|
59
|
-
- Real-time validation during code generation
|
|
60
|
-
|
|
61
|
-
4. **Pre-commit Hook** (`scripts/git-hooks/pre-commit`)
|
|
62
|
-
- Validates staged files before commit
|
|
63
|
-
- Safety net for anything MCP layer missed
|
|
64
|
-
- Can be bypassed with `--no-verify` (emergencies only)
|
|
65
|
-
|
|
66
|
-
5. **CLI Tool** (`scripts/validation/validate-code.ts`)
|
|
67
|
-
- Manual validation
|
|
68
|
-
- Testing and debugging
|
|
69
|
-
- CI/CD integration
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Installation
|
|
74
|
-
|
|
75
|
-
### 1. Install Git Hook (Required)
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
pnpm hooks:install
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
This creates a symlink from `.git/hooks/pre-commit` to `scripts/git-hooks/pre-commit`.
|
|
82
|
-
|
|
83
|
-
### 2. Configure Claude Code MCP (Optional but Recommended)
|
|
84
|
-
|
|
85
|
-
Add to your Claude Code MCP configuration:
|
|
86
|
-
|
|
87
|
-
**`~/.config/claude-code/mcp_config.json`** (or equivalent):
|
|
88
|
-
|
|
89
|
-
```json
|
|
90
|
-
{
|
|
91
|
-
"mcpServers": {
|
|
92
|
-
"revealui-code-validator": {
|
|
93
|
-
"command": "tsx",
|
|
94
|
-
"args": ["./packages/mcp/src/servers/code-validator.ts"],
|
|
95
|
-
"cwd": "/path/to/RevealUI",
|
|
96
|
-
"description": "Code validation server - prevents technical debt",
|
|
97
|
-
"enabled": true
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Or copy from `.revealui/mcp-config.json`.
|
|
104
|
-
|
|
105
|
-
### 3. Install Dependencies
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
# Install minimatch (core validator dependency)
|
|
109
|
-
pnpm install
|
|
110
|
-
|
|
111
|
-
# Build packages/dev
|
|
112
|
-
pnpm --filter dev build
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Usage
|
|
118
|
-
|
|
119
|
-
### Manual Validation
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Validate a single file
|
|
123
|
-
pnpm validate:code src/foo.ts
|
|
124
|
-
|
|
125
|
-
# Validate from stdin (useful for pipes)
|
|
126
|
-
cat src/foo.ts | pnpm validate:code:stdin
|
|
127
|
-
|
|
128
|
-
# Auto-fix violations
|
|
129
|
-
pnpm validate:code:fix src/foo.ts
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### MCP Tool (for Claude)
|
|
133
|
-
|
|
134
|
-
When MCP is configured, Claude can call:
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
// Claude calls this before Write/Edit
|
|
138
|
-
const result = await validate_code({
|
|
139
|
-
code: "console.log('debug')",
|
|
140
|
-
filePath: "src/foo.ts",
|
|
141
|
-
autoFix: false
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
if (!result.valid) {
|
|
145
|
-
// Claude sees violations and can fix them before writing
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Pre-commit Hook (Automatic)
|
|
150
|
-
|
|
151
|
-
The hook runs automatically on `git commit`:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
# Normal commit (hook validates)
|
|
155
|
-
git commit -m "feat: add feature"
|
|
156
|
-
|
|
157
|
-
# Emergency bypass (use sparingly!)
|
|
158
|
-
git commit --no-verify -m "hotfix: emergency"
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Validation Rules
|
|
164
|
-
|
|
165
|
-
Current rules (see `.revealui/code-standards.json`):
|
|
166
|
-
|
|
167
|
-
### 1. No console.log (ERROR)
|
|
168
|
-
**Pattern:** `console.(log|debug|info|warn|error)`
|
|
169
|
-
|
|
170
|
-
**Message:** Use logger instead of console.* - console statements create technical debt
|
|
171
|
-
|
|
172
|
-
**Fix:**
|
|
173
|
-
```typescript
|
|
174
|
-
// ❌ Bad
|
|
175
|
-
console.log('User created', userId)
|
|
176
|
-
|
|
177
|
-
// ✅ Good
|
|
178
|
-
import { logger } from '@revealui/core/logger'
|
|
179
|
-
logger.info('User created', { userId })
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
**Exemptions:** Test files, scripts, examples
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
### 2. No any types (WARNING)
|
|
187
|
-
**Pattern:** `: any` (explicit any types)
|
|
188
|
-
|
|
189
|
-
**Message:** Avoid explicit 'any' types - use proper TypeScript types
|
|
190
|
-
|
|
191
|
-
**Fix:**
|
|
192
|
-
```typescript
|
|
193
|
-
// ❌ Bad
|
|
194
|
-
function foo(data: any) { }
|
|
195
|
-
|
|
196
|
-
// ✅ Good
|
|
197
|
-
function foo(data: User) { }
|
|
198
|
-
function foo(data: unknown) { } // if truly unknown
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**Exemptions:** Test files, scripts
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
### 3. TODO requires issue reference (WARNING)
|
|
206
|
-
**Pattern:** `// TODO` without `#123` or URL
|
|
207
|
-
|
|
208
|
-
**Message:** TODO comments must reference an issue
|
|
209
|
-
|
|
210
|
-
**Fix:**
|
|
211
|
-
```typescript
|
|
212
|
-
// ❌ Bad
|
|
213
|
-
// TODO fix this later
|
|
214
|
-
|
|
215
|
-
// ✅ Good
|
|
216
|
-
// TODO #123: Implement error handling
|
|
217
|
-
// TODO https://github.com/org/repo/issues/456
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
**Exemptions:** Test files, examples
|
|
221
|
-
|
|
222
|
-
---
|
|
223
|
-
|
|
224
|
-
### 4. No debugger statements (ERROR)
|
|
225
|
-
**Pattern:** `debugger`
|
|
226
|
-
|
|
227
|
-
**Message:** Remove debugger statements before committing
|
|
228
|
-
|
|
229
|
-
**Fix:** Remove the `debugger;` statement
|
|
230
|
-
|
|
231
|
-
**Exemptions:** Test files
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
### 5. No skipped tests (WARNING)
|
|
236
|
-
**Pattern:** `describe.skip(` or `it.skip(`
|
|
237
|
-
|
|
238
|
-
**Message:** Tests should not be skipped without issue reference
|
|
239
|
-
|
|
240
|
-
**Fix:** Either fix the test or add comment explaining why it's skipped
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
// ❌ Bad
|
|
244
|
-
it.skip('should work', () => { })
|
|
245
|
-
|
|
246
|
-
// ✅ Good
|
|
247
|
-
// TODO #789: Re-enable after fixing flaky test
|
|
248
|
-
it.skip('should work', () => { })
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
## Exemptions
|
|
254
|
-
|
|
255
|
-
### By File Path (Glob Patterns)
|
|
256
|
-
|
|
257
|
-
```json
|
|
258
|
-
{
|
|
259
|
-
"exemptions": {
|
|
260
|
-
"paths": [
|
|
261
|
-
"**/*.test.ts", // Test files
|
|
262
|
-
"**/*.spec.ts", // Test files
|
|
263
|
-
"**/scripts/**", // Scripts directory
|
|
264
|
-
"**/examples/**", // Example code
|
|
265
|
-
"**/__tests__/**" // Test directories
|
|
266
|
-
]
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### By Comment
|
|
272
|
-
|
|
273
|
-
```typescript
|
|
274
|
-
// console.log allowed in this section
|
|
275
|
-
console.log('This is OK') // ai-validator-ignore
|
|
276
|
-
|
|
277
|
-
function debug() {
|
|
278
|
-
// any-allowed: Legacy code being migrated
|
|
279
|
-
const data: any = getLegacyData()
|
|
280
|
-
}
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Supported exemption comments:
|
|
284
|
-
- `ai-validator-ignore` - Ignore all rules for this line
|
|
285
|
-
- `console-allowed` - Allow console.* for this line
|
|
286
|
-
- `any-allowed` - Allow any types for this line
|
|
287
|
-
- `skip-allowed` - Allow .skip tests for this line
|
|
288
|
-
|
|
289
|
-
---
|
|
290
|
-
|
|
291
|
-
## Configuration
|
|
292
|
-
|
|
293
|
-
### Adding New Rules
|
|
294
|
-
|
|
295
|
-
Edit `.revealui/code-standards.json`:
|
|
296
|
-
|
|
297
|
-
```json
|
|
298
|
-
{
|
|
299
|
-
"rules": [
|
|
300
|
-
{
|
|
301
|
-
"id": "my-new-rule",
|
|
302
|
-
"name": "Rule description",
|
|
303
|
-
"pattern": "regex pattern",
|
|
304
|
-
"severity": "error",
|
|
305
|
-
"message": "What's wrong and why",
|
|
306
|
-
"suggestedFix": "How to fix it",
|
|
307
|
-
"exemptions": {
|
|
308
|
-
"paths": ["**/test/**"],
|
|
309
|
-
"comments": ["my-rule-ignore"]
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Severity Levels
|
|
317
|
-
|
|
318
|
-
- **error** - Blocks commit (exit code 1)
|
|
319
|
-
- **warning** - Allows commit but shows warning
|
|
320
|
-
- **info** - Informational only
|
|
321
|
-
|
|
322
|
-
### Auto-Fix Rules
|
|
323
|
-
|
|
324
|
-
```json
|
|
325
|
-
{
|
|
326
|
-
"autoFix": {
|
|
327
|
-
"enabled": true,
|
|
328
|
-
"rules": [
|
|
329
|
-
{
|
|
330
|
-
"id": "no-console-log",
|
|
331
|
-
"find": "console\\.log\\(([^)]*)\\)",
|
|
332
|
-
"replace": "// FIXME: Replace with logger.info($1)"
|
|
333
|
-
}
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Testing
|
|
342
|
-
|
|
343
|
-
### Test the Validator
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
# Create test file
|
|
347
|
-
cat > /tmp/test.ts << 'EOF'
|
|
348
|
-
console.log('test')
|
|
349
|
-
const foo: any = {}
|
|
350
|
-
// TODO fix this
|
|
351
|
-
EOF
|
|
352
|
-
|
|
353
|
-
# Validate it
|
|
354
|
-
pnpm validate:code /tmp/test.ts
|
|
355
|
-
|
|
356
|
-
# Expected output:
|
|
357
|
-
# ✗ Code violations found
|
|
358
|
-
#
|
|
359
|
-
# ERROR [no-console-log] No console.log statements
|
|
360
|
-
# at line 1:1
|
|
361
|
-
# Use logger instead of console.*
|
|
362
|
-
#
|
|
363
|
-
# WARNING [no-any-type] No explicit any types
|
|
364
|
-
# at line 2:11
|
|
365
|
-
# Avoid explicit 'any' types
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### Test Pre-commit Hook
|
|
369
|
-
|
|
370
|
-
```bash
|
|
371
|
-
# Create a file with violations
|
|
372
|
-
echo "console.log('test')" > src/test.ts
|
|
373
|
-
|
|
374
|
-
# Stage it
|
|
375
|
-
git add src/test.ts
|
|
376
|
-
|
|
377
|
-
# Try to commit (should fail)
|
|
378
|
-
git commit -m "test"
|
|
379
|
-
|
|
380
|
-
# Expected: Hook blocks commit with violation details
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### Test MCP Server
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
# Start MCP server manually
|
|
387
|
-
tsx packages/mcp/src/servers/code-validator.ts
|
|
388
|
-
|
|
389
|
-
# Use MCP client to call validate_code
|
|
390
|
-
# (Or configure Claude Code and let Claude call it)
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
|
-
## CI/CD Integration
|
|
396
|
-
|
|
397
|
-
### GitHub Actions
|
|
398
|
-
|
|
399
|
-
```yaml
|
|
400
|
-
name: Code Validation
|
|
401
|
-
|
|
402
|
-
on: [pull_request]
|
|
403
|
-
|
|
404
|
-
jobs:
|
|
405
|
-
validate:
|
|
406
|
-
runs-on: ubuntu-latest
|
|
407
|
-
steps:
|
|
408
|
-
- uses: actions/checkout@v4
|
|
409
|
-
- uses: pnpm/action-setup@v2
|
|
410
|
-
- uses: actions/setup-node@v4
|
|
411
|
-
with:
|
|
412
|
-
node-version: '24'
|
|
413
|
-
|
|
414
|
-
- run: pnpm install
|
|
415
|
-
- run: pnpm --filter dev build
|
|
416
|
-
|
|
417
|
-
# Validate all TypeScript files
|
|
418
|
-
- run: |
|
|
419
|
-
find . -name "*.ts" -o -name "*.tsx" | \
|
|
420
|
-
while read file; do
|
|
421
|
-
pnpm validate:code "$file" || exit 1
|
|
422
|
-
done
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
---
|
|
426
|
-
|
|
427
|
-
## Workflow for Claude
|
|
428
|
-
|
|
429
|
-
When Claude Code has MCP configured:
|
|
430
|
-
|
|
431
|
-
### Before (Without Validator)
|
|
432
|
-
```
|
|
433
|
-
1. Claude generates code with console.log
|
|
434
|
-
2. Claude calls Write tool
|
|
435
|
-
3. Code written to disk with violations
|
|
436
|
-
4. Later: Claude audits, finds violations, recommends cleanup
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### After (With Validator)
|
|
440
|
-
```
|
|
441
|
-
1. Claude generates code
|
|
442
|
-
2. Claude calls validate_code MCP tool
|
|
443
|
-
3. Validator returns violations
|
|
444
|
-
4. Claude fixes violations
|
|
445
|
-
5. Claude calls validate_code again (passes)
|
|
446
|
-
6. Claude calls Write tool
|
|
447
|
-
7. Clean code written to disk
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
---
|
|
451
|
-
|
|
452
|
-
## Metrics & Reporting
|
|
453
|
-
|
|
454
|
-
### Validation Result Format
|
|
455
|
-
|
|
456
|
-
```json
|
|
457
|
-
{
|
|
458
|
-
"valid": false,
|
|
459
|
-
"violations": [
|
|
460
|
-
{
|
|
461
|
-
"ruleId": "no-console-log",
|
|
462
|
-
"ruleName": "No console.log statements",
|
|
463
|
-
"severity": "error",
|
|
464
|
-
"message": "Use logger instead of console.*",
|
|
465
|
-
"line": 42,
|
|
466
|
-
"column": 5,
|
|
467
|
-
"lineContent": " console.log('debug')",
|
|
468
|
-
"context": [
|
|
469
|
-
" 40 | function processUser() {",
|
|
470
|
-
" 41 | const user = getUser()",
|
|
471
|
-
" > 42 | console.log('debug')",
|
|
472
|
-
" 43 | return user",
|
|
473
|
-
" 44 | }"
|
|
474
|
-
],
|
|
475
|
-
"suggestedFix": "import { logger } from '@revealui/core/logger'\nlogger.info('message', { data })"
|
|
476
|
-
}
|
|
477
|
-
],
|
|
478
|
-
"errors": 1,
|
|
479
|
-
"warnings": 0,
|
|
480
|
-
"info": 0,
|
|
481
|
-
"stats": {
|
|
482
|
-
"linesScanned": 156,
|
|
483
|
-
"rulesApplied": 5,
|
|
484
|
-
"exemptionsApplied": 2
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
```
|
|
488
|
-
|
|
489
|
-
---
|
|
490
|
-
|
|
491
|
-
## Troubleshooting
|
|
492
|
-
|
|
493
|
-
### Hook Not Running
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
# Check hook is installed
|
|
497
|
-
ls -la .git/hooks/pre-commit
|
|
498
|
-
|
|
499
|
-
# Should show symlink to scripts/git-hooks/pre-commit
|
|
500
|
-
# If not, reinstall:
|
|
501
|
-
pnpm hooks:install
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### Validator Not Found
|
|
505
|
-
|
|
506
|
-
```bash
|
|
507
|
-
# Ensure packages/dev is built
|
|
508
|
-
pnpm --filter dev build
|
|
509
|
-
|
|
510
|
-
# Check validator exports
|
|
511
|
-
ls -la packages/dev/src/code-validator/
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
### MCP Server Not Connecting
|
|
515
|
-
|
|
516
|
-
```bash
|
|
517
|
-
# Test MCP server manually
|
|
518
|
-
tsx packages/mcp/src/servers/code-validator.ts
|
|
519
|
-
|
|
520
|
-
# Check Claude Code MCP config
|
|
521
|
-
cat ~/.config/claude-code/mcp_config.json
|
|
522
|
-
|
|
523
|
-
# Ensure correct paths in config
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
### False Positives
|
|
527
|
-
|
|
528
|
-
Add exemption comment:
|
|
529
|
-
|
|
530
|
-
```typescript
|
|
531
|
-
// ai-validator-ignore
|
|
532
|
-
console.log('This console.log is intentional')
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
Or add path exemption to `.revealui/code-standards.json`.
|
|
536
|
-
|
|
537
|
-
---
|
|
538
|
-
|
|
539
|
-
## Future Enhancements
|
|
540
|
-
|
|
541
|
-
### Planned Features
|
|
542
|
-
|
|
543
|
-
1. **Auto-fix on pre-commit**
|
|
544
|
-
- `git commit --fix` to automatically fix violations
|
|
545
|
-
|
|
546
|
-
2. **IDE Integration**
|
|
547
|
-
- VS Code extension
|
|
548
|
-
- Real-time validation as you type
|
|
549
|
-
|
|
550
|
-
3. **Statistics Dashboard**
|
|
551
|
-
- Track violations over time
|
|
552
|
-
- Measure reduction in technical debt
|
|
553
|
-
|
|
554
|
-
4. **Custom Rule Plugins**
|
|
555
|
-
- Allow packages to define their own rules
|
|
556
|
-
- Plugin system for extensibility
|
|
557
|
-
|
|
558
|
-
5. **AI Training Feedback Loop**
|
|
559
|
-
- Send validation results back to Claude
|
|
560
|
-
- Learn from violations to improve future code generation
|
|
561
|
-
|
|
562
|
-
---
|
|
563
|
-
|
|
564
|
-
## Related Documentation
|
|
565
|
-
|
|
566
|
-
- [Code Standards](../STANDARDS.md) - Overall coding standards
|
|
567
|
-
- [MCP Guide](../MCP.md) - MCP server configuration
|
|
568
|
-
- [Git Hooks](../../scripts/git-hooks/README.md) - Git hooks documentation
|
|
569
|
-
- [Master Plan](../../../../docs/MASTER_PLAN.md) - Current project status and roadmap
|
|
570
|
-
|
|
571
|
-
---
|
|
572
|
-
|
|
573
|
-
## Contributing
|
|
574
|
-
|
|
575
|
-
To add new validation rules:
|
|
576
|
-
|
|
577
|
-
1. Add rule to `.revealui/code-standards.json`
|
|
578
|
-
2. Test with `pnpm validate:code`
|
|
579
|
-
3. Add exemptions as needed
|
|
580
|
-
4. Document in this file
|
|
581
|
-
5. Submit PR
|
|
582
|
-
|
|
583
|
-
---
|
|
584
|
-
|
|
585
|
-
**Last Updated:** 2026-02-04
|
|
586
|
-
**Version:** 1.0.0
|
package/eslint.config.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
3
|
-
import { baseConfig, createTypeCheckedConfig } from '../dev/src/eslint/index.js'
|
|
4
|
-
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
6
|
-
|
|
7
|
-
export default [...baseConfig, createTypeCheckedConfig({ tsconfigRootDir: __dirname })]
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
-- Add CRDT metadata columns for MCP tables
|
|
2
|
-
ALTER TABLE IF EXISTS documents
|
|
3
|
-
ADD COLUMN IF NOT EXISTS _electric_meta jsonb DEFAULT '{}'::jsonb;
|
|
4
|
-
|
|
5
|
-
ALTER TABLE IF EXISTS subscription_state
|
|
6
|
-
ADD COLUMN IF NOT EXISTS _electric_meta jsonb DEFAULT '{}'::jsonb;
|
|
7
|
-
|
|
8
|
-
-- Add more tables here as needed
|