# Repository ERD ## What this is A topology map of `icat_app` — what calls what at runtime, where code lives, and how a change reaches the production Hugging Face Space. ## Runtime topology (one Streamlit process) ``` Hugging Face Space DecodeMarketing/decode_tools (Streamlit 1.32.2, Python 3.12) ^ | (git push, see Deploy pipe) | +-------------------------------+-----------------------------+ | app.py | | Streamlit entry point. st.set_page_config, | | st.tabs([...]) wires 8 tabs into one page. | +--+----+----+----+----+----+----+----+-----------------------+ | | | | | | | | v v v v v v v v tab1 tab2 tab3 tab4 tab5 tab6 tab7 tab8 | | | | | | | | +----+----+----+----+----+----+----+ | v helper.py (1293 LOC shared utility module — see docs/architecture/active-surface.md) ``` ## File map | Path | Role | |---------------------------------------|-----------------------------------------------------------------------------------------------| | `app.py` (55 LOC) | Streamlit entry. Imports one function per tab, wires them into `st.tabs([...])`. | | `tab1.py` (179 LOC) | Tool: Extract Images from Excel. Exports `excel_extractor_tool`. | | `tab2.py` (141 LOC) | Tool: Name Assets by Brand. Exports `file_renamer_tool`. | | `tab3.py` (160 LOC) | Tool: Canvas White to Transparent. Exports `white_to_transparent_tool`. | | `tab4.py` (152 LOC) | Tool: Asset Overview (PDF). Exports `pdf_generator_tool`. | | `tab5.py` (302 LOC) | Tool: Name Stims by Block + create output files. Exports `brand_renamer_tool`. | | `tab6.py` (784 LOC) | Tool: Re-run Matrix. Exports `updated_file_processor_tab`. Largest tab — owns its own logic. | | `tab7.py` (163 LOC) | Tool: Resize (with transparent canvas). Exports `center_on_canvas_tool` (name misleading — exported function is the resize tool entry). | | `tab8.py` (179 LOC) | Tool: Place on Canvas. Exports `resize_with_transparent_canvas_tool` (name misleading — exported function is the canvas-placement entry). | | `helper.py` (1293 LOC) | Shared utilities. Constants (allowed extensions, brand index helpers), zip extraction, image processing, Excel image extraction, PDF generation. See `active-surface.md`. | | `requirements.txt` | Source of truth for Python dependencies installed by HF Spaces. | | `runtime.txt` | HF Spaces Python version pin (`python-3.12`). | | `.streamlit/config.toml` | Streamlit server config. | | `README.md` | HF Spaces frontmatter (title, sdk, sdk_version, app_file) + human description. | | `CLAUDE.md` | Repo-level AI base rules and reviewer procedure. | ## Deploy pipe (the protected boundary) ``` developer --PR--> main --push trigger--> .github/workflows/main.yml | | (uses HF_TOKEN secret) v git push https://DecodeMarketing:$HF_TOKEN@... | v Hugging Face Space rebuild & redeploy ``` Trigger: `push` to `main` (also `workflow_dispatch` manually from the Actions tab). There is no staging / canary step. There is no pre-deploy approval. **Therefore every merge to main is a production deploy.** This is documented in `docs/guides/protected-boundary-policy.md`. ## PR-side CI ``` PR opened/updated against main | +---> .github/workflows/check-file-size.yml (ActionsDesk/lfs-warning, >10MB) | +---> .github/workflows/gate.yml (ruff lint on changed Python; override-audit) | +---> .github/workflows/repo_validate.yml (py_compile sweep + manifest sanity) <-- added in slice 1 ``` `gate.yml` also fires on push to `main`. On push-to-main failure, it auto-files a CI-failure incident issue into `decode-claude-wiki`. ## Local gates (when `scripts/setup.sh` has wired `core.hooksPath = .githooks`) ``` git commit | +---> .githooks/pre-commit --calls--> scripts/language-gate.sh (ruff lint on staged) | +---> .githooks/commit-msg (reviewer-marker check OR override-reviewer string) ``` When working through Claude Code, the `.claude/hooks/` layer adds: SessionStart wires `.githooks` automatically; PreToolUse blocks dangerous git ops and writes to secret files; Stop blocks session end without a fresh reviewer marker. ## What this ERD intentionally omits - The internal call graph inside `helper.py`. That belongs in `active-surface.md`. - The Streamlit widget tree per tab. Each `tab*.py` owns that locally. - Any data persistence. There is none — all uploads are in-memory or in temp dirs on the HF Space and discarded at session end.