Custom Linting & Semantics
Relevant source files
The following files were used as context for generating this wiki page:
The Custom Linting & Semantics system within the TAMV project serves as a "Constitutional Quality Control" framework (QC-TAMV-01). Its primary purpose is to enforce structural invariants, architectural boundaries, and ethical/legal semantic patterns across the codebase. This system ensures that the software maintains its "technical validity" by preventing non-negotiable architectural violations and ensuring that both human developers and Operational AIs adhere to the project's constitutional principles.
Sources: 02_MODULOS/M05_IA_TAMVAI/INTERNO/QC-TAMV-01-v1.1.md:1-25, eslint-plugin-tamv/index.js:1-7
Architectural Shielding (QC-TAMV-01)
The project implements a multi-layered validation pipeline to protect the "Civilizatory Client" architecture. This is enforced through custom ESLint rules and a specialized architecture checker that validates the dependency graph against defined "Laws" (L1–L9).
Invariant Laws and Enforcement
The system enforces several critical structural laws to ensure determinism and separation of responsibilities:
| Law | Definition | Enforcement Mechanism |
|---|---|---|
| L1: Unique Root | createRoot must only exist in src/main.tsx. | tamv/no-reactdom-outside-main |
| L2: Unique Router | BrowserRouter must only exist in src/App.tsx. | tamv/no-router-outside-app |
| L3: Unique Layout | Layout.tsx must be mounted only in App.tsx. | tamv/no-layout-outside-app |
| L4: Route-Page Map | Pages cannot import other pages. | tamv/no-page-to-page-import |
| L6: Agnostic Modules | Modules cannot import navigation (router) or pages. | tamv/no-router-in-modules |
| L7: Controlled Init | Services (Supabase/AI) must be initialized in specific layers. | check:architecture script |
Sources: 02_MODULOS/M05_IA_TAMVAI/INTERNO/QC-TAMV-01-v1.1.md:55-88, eslint-plugin-tamv/index.js:12-250
Architecture Graph Validation
The scripts/check-architecture.ts utility performs static analysis on the source directory to build a dependency graph. It identifies violations that standard linters might miss, such as circular dependencies between pages or domain isolation breaches.
The architecture checker analyzes file types (page, module, domain, core, integration) and flags direct imports of Supabase within pages as warnings, suggesting they be moved to the integrations layer.
Sources: scripts/check-architecture.ts:15-100, scripts/check-architecture.ts:215-260
Semantic Scanning
The Constitutional Semantic Scanner (scripts/scan-semantics.ts) is designed to detect "intentions" rather than just keywords. It prevents the introduction of patterns that violate the constitutional framework, such as camouflaged DAO structures or cognitive manipulation designs.
Protected Semantic Patterns
The scanner monitors for several categories of violations:
- DAO-related: Governance tokens, community treasuries, and decentralized governance without a custodian.
- Economic Exploitation: Hidden fees, predatory pricing, and automatic renewals without consent.
- Cognitive Manipulation: Dark patterns, misleading UIs, and coercive designs.
- AI Sovereignty: Autonomous AI decision-making or AI governance patterns.
Sources: scripts/scan-semantics.ts:15-46
Scanner Logic
The scanner traverses the repository (excluding node_modules, dist, etc.) and examines .ts, .tsx, .js, .jsx, and .md files. It allows for "historical" or "external" mentions if they are explicitly marked with [HISTORICAL], [EXTERNAL], or [LEGACY] tags.
Sources: scripts/scan-semantics.js:55-75, scripts/scan-semantics.ts:50-70
ESLint Constitutional Plugin
The eslint-plugin-tamv implements the core rules defined in the QC-TAMV-01 document. It is integrated into the project's eslint.config.js and categorized under "Constitutional Quality Control."
Core Custom Rules
no-dao: Prohibits the term "DAO" unless marked as legacy, requiring the use of "SCAO" (Sovereign Constitutional Autonomous Organization) instead.no-hidden-economy: Detects economic functions (e.g.,processPayment,calculateFee) that lack corresponding UI transparency markers like "tooltip" or "notification".no-unaudited-ai: Mandates that AI-related imports (OpenAI, Anthropic, etc.) must be accompanied by logging or audit trail implementations.
Sources: eslint-plugin-tamv/index.js:315-410, eslint.config.js:25-35
Validation Sequence (CI/CD)
The project utilizes a strict "Shield" or "Deca-V" audit protocol that must pass before any deployment or merge into protected branches.
Conclusion
The Custom Linting & Semantics system is a cornerstone of the TAMV project's governance. By treating technical architecture as a "Constitution," the project ensures that its structural integrity and ethical boundaries are enforced programmatically. This automated governance applies equally to human contributors and operational AI agents, maintaining a predictable and traceable technical state.
Sources: 02_MODULOS/M05_IA_TAMVAI/INTERNO/QC-TAMV-01-v1.1.md:120-135