Add scripts/report_module_sizes.py - report-only LOC bands per layer from the TeamHUB module-size guardrail (CONVENTIONS.md, module contract p.6). Always exits 0: split-review stays a human decision. Wire it into CI as a non-blocking step and into the AGENTS.md baseline checks. Document data/input + data/work as the deliberate compatibility exception to the var/ rule of 18_REPO_LAYOUT_STANDARD.md in docs/structure-map.md (compose mounts and APP_*_DIR depend on the paths) and ignore var/ for new local runtime output. Verified: script runs clean on the repo (159 files in scope, zero flagged); ruff and compileall pass; adversarial review fixed two classification bugs (frontend shell under frontend/src/app/, app/api/security.py as infra helper). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
73 lines
2.5 KiB
Markdown
73 lines
2.5 KiB
Markdown
# LegacyHUB structure map
|
|
|
|
Status: current mapping · 2026-07-06.
|
|
|
|
Canonical target: `C:\Users\manag\TeamHUB\TeamHUB-Platform\docs\submodules\18_REPO_LAYOUT_STANDARD.md`.
|
|
|
|
## Current layout
|
|
|
|
```text
|
|
legacy-knowledge-indexer/
|
|
AGENTS.md
|
|
README.md
|
|
RUNBOOK.md
|
|
app/
|
|
main.py
|
|
config.py
|
|
api/
|
|
common/
|
|
db/
|
|
indexing/
|
|
ingestion/
|
|
integrations/
|
|
storage/
|
|
utils/
|
|
workers/
|
|
frontend/src/
|
|
scripts/
|
|
tests/
|
|
docker/
|
|
docs/
|
|
```
|
|
|
|
## Target mapping
|
|
|
|
| Current path | Target layer | Notes |
|
|
|---|---|---|
|
|
| `app/main.py` | backend composition shell | Current mature runtime shell. |
|
|
| `app/api/` | `backend/app/api/` | Route and schema layer. |
|
|
| `app/db/` | `backend/app/models` + `repositories` | Current DB/session/models/migrations boundary. |
|
|
| `app/ingestion/` | services/use cases | OCR/extract/chunk pipeline; do not rename without extraction plan. |
|
|
| `app/indexing/` | services/integrations | Search/vector/rerank runtime; shared parts move through Engines. |
|
|
| `app/storage/` | integrations/storage + repositories | MinIO and artifact persistence. |
|
|
| `app/integrations/` | integrations | Identity/dispatch/reference adapters should live here. |
|
|
| `app/workers/` | workers | Celery tasks. |
|
|
| `frontend/src/` | frontend target | React/Vite/Tailwind app. |
|
|
|
|
## Compatibility surfaces
|
|
|
|
- Root `app/` is accepted current backend root.
|
|
- `ingestion`, `indexing` and `storage` are mature domain layers; do not flatten
|
|
or rename only for symmetry.
|
|
- Shared OCR/document-recognition logic should move through `Engines`, leaving
|
|
thin app adapters.
|
|
- `data/input/` and `data/work/` are the accepted ignored runtime-state dirs
|
|
(deliberate exception to the `var/` rule of `18_REPO_LAYOUT_STANDARD.md`):
|
|
docker-compose mounts `./data/input:/data/input` and `./data/work:/data/work`,
|
|
and `APP_INPUT_DIR`/`APP_WORK_DIR` point there. Moving them under `var/`
|
|
needs a scoped migration touching compose, config defaults and RUNBOOK.
|
|
New kinds of local runtime output (logs, exports, reports) go to the
|
|
ignored `var/` directory.
|
|
|
|
## Module-size guardrail
|
|
|
|
`python scripts/report_module_sizes.py` prints the report-only LOC bands per
|
|
layer (CONVENTIONS.md module-size guardrail). It runs in CI as a non-blocking
|
|
step; split-review stays a human decision.
|
|
|
|
## Next safe steps
|
|
|
|
1. Add new platform adapters in `app/integrations`.
|
|
2. Document current layer mapping instead of moving ingestion/search.
|
|
3. Use focused pytest/compileall and frontend build checks for touched runtime.
|