docs: consolidate all rules and specs into absolute sources of truth v1.2.8

This commit is contained in:
Daniel Bedeleanu
2026-04-11 12:03:27 +03:00
parent 432cd28ca5
commit 0a9ea0f575
10 changed files with 112 additions and 215 deletions

View File

@@ -1,3 +1,16 @@
### [2026-04-11 12:25] v1.2.8: Absolute Documentation Consolidation
**Purpose:** Restructured all project documentation to completely eliminate redundancy and establish clear "Single Source of Truth" boundaries for humans and AI agents.
**Actions:**
- Created `PROJECT_ARCHITECTURE.md` uniting business requirements, tech stack, data models, and specific OCR algorithms.
- Unified all AI operational rules, constraints, and UI fidelities strictly inside `AI_RULES.md`.
- Removed redundant, overlapping files (`GEMINI.md`, `requirements.md`, `TECH_STACK.md`, `UI_FIDELITY_SPEC.md`, `SCANNER_LOGIC_SPEC.md`).
- Stripped `PLAN.md` down to just the active checklist.
**Modified Files:**
- `PROJECT_ARCHITECTURE.md` (New)
- `AI_RULES.md`
- `PLAN.md`
- `VERSION.json`
### [2026-04-11 12:15] v1.2.7: Documentation Refactor & Portability
**Purpose:** Consolidated technical stack information into a single source of truth (`dev_docs/TECH_STACK.md`) and removed absolute paths from all AI-facing documents to ensure the project can be moved across environments without breaking references.
**Modified Files:**

View File

@@ -1,36 +0,0 @@
# TFM aInventory - Scanner Technical Specification (v1.2)
This document defines the "Frozen" parameters for the scanner component. Do NOT modify these values without explicit user approval.
## 1. Hardware Access
- **API**: Direct `MediaStreamTrack` access for high-performance camera control.
- **Zoom**: Dynamic detection of `capabilities.zoom.max`.
- **Zoom Cycle**: 1x -> 2x -> Max/2 -> Max.
## 2. Image Pre-processing (The OCR "Secret Sauce")
Before being sent to Tesseract.js, every frame undergoes these transformations:
- **Rescaling**: Fixed canvas width of **1200px** (Optimal for Mobile RAM/Accuracy).
- **Cropping**: **60% Center Crop** of the video stream (forces focus & removes peripheral noise).
- **Filters**: `grayscale(100%) contrast(180%) brightness(105%)`.
- **Format**: High-quality JPEG (`0.85` quality) via `toDataURL`.
## 3. OCR Matching Engine (page.tsx)
- **Sanitization**: Text normalized to UPPERCASE, non-alphanumeric replaced with spaces.
- **Noise Filtering**:
- Tokens < 3 chars ignored.
- Decimals (e.g., `0.11`, `0.18`) ignored via regex: `/^\d+\.\d+$/`.
- Dates (e.g., `2024-07-25`) ignored via regex: `/^\d{2,4}-\d{2}-\d{2}$/`.
- **Scoring System**:
- **Exact Serial Number Match**: +500 points (Instant Match).
- **Exact Part Number Match**: +200 points.
- **Token match (e.g., "LC" in "LC/UPC")**: +50 points.
- **Category Match**: +20 points.
- **Threshold**: Minimum **40 points** required for automatic match without user intervention.
## 4. UI/UX Flow
1. **Auto-Match**: Attempt to identify item immediately from raw text.
2. **Interactive Selection (Fallback)**: If match confidence is low, freeze frame and show clickable bounding boxes for manual word selection.
---
*Created: 2026-04-10*
*Status: FROZEN*

View File

@@ -1,25 +0,0 @@
# TECHNICAL STACK - SINGLE SOURCE OF TRUTH
This document defines the official technology stack for the Inventory System. All components must adhere to these versions and libraries.
## 🟢 Backend (API & Data)
- **Language:** Python 3.12+ (Optimized for performance and type safety)
- **Framework:** [FastAPI](https://fastapi.tiangolo.com/) (Async ASGI)
- **Database:** SQLite (SQLAlchemy) - Local file-based persistence
- **Validation:** Pydantic v2
- **Auth:** Hybrid LDAP (python-ldap) + PBKDF2 local password hash caching (v1.2.4)
- **AI Engine:** Google GenAI SDK (Gemini 2.0 Flash) - Location: `backend/ai/`
## 🔵 Frontend (Web & PWA)
- **Architecture:** [Next.js](https://nextjs.org/) 15+ (App Router)
- **Styling:** Tailwind CSS (Readability-first config: No uppercase/tracking-widest)
- **Icons:** [Lucide Icons](https://lucide.dev/) (React components)
- **Offline persistence:** [Dexie.js](https://dexie.org/) (IndexedDB wrapper)
- **Scanner:** `html5-qrcode` (Client-side, offline-only)
- **Sync:** Axios with bulk-sync idempotency (UUID-based)
## 🏗 Operations & Tooling
- **PWA Deployment:** `next-pwa` (Service Workers + Manifest.json)
- **HTTPS Proxy:** `local-ssl-proxy` (Required for mobile camera access)
- **Version Control:** Git (Local-first, path in `.git_path`)
- **Isolation:** Python `.venv` and Node `node_modules`

View File

@@ -1,12 +0,0 @@
# UI Fidelity Specification
This document details the mandatory visual and structural specifications for UI components (headers, banners, cards, buttons) in the unified PWA interface.
## 1. General Principles
- Use TailwindCSS (or equivalent local vanilla CSS framework established).
- No emojis; strictly Bootstrap Icons.
- Standard spacing, consistent font weight (Inter or Roboto).
- Responsive: Viewport scaling for both Desktop dashboard and Mobile full-screen scanning modes.
## 2. Specific Components
*(To be populated as components are developed)*