Commit f24d1b6f authored by Admin's avatar Admin

docs: add generic platform roadmap, ideas, and decanifa audit report (Phase 0)

parent 45f3f2f7
This diff is collapsed.
This diff is collapsed.
# 🔍 Audit & De-Canifa Inventory (Phase 0)
This document contains a comprehensive audit of all branding, coupling, hardcoded configuration, and fashion-vertical specific logic across the codebase, mapping them to specific roadmap phases for clean, generic refactoring.
---
## 1. Canifa Brand & Platform Coupling (Phase 6)
The following references to "Canifa" exist in the core backend code and must be de-branded, genericized, or extracted into the `fashion-retail` blueprint/plugin pack in **Phase 6**:
| File Path | Line(s) | Description / Type of Coupling |
|---|---|---|
| [backend/agent/tools/mcp_client.py](file:///d:/a/ai_canifa_company/backend/agent/tools/mcp_client.py) | 134 | Hardcoded agent client name: `"canifa-company-agent-client"` |
| [backend/api/routes/agents.py](file:///d:/a/ai_canifa_company/backend/api/routes/agents.py) | 259 | Hardcoded HTML string `<title>CANIFA Premium</title>` |
| [backend/api/routes/run_logs.py](file:///d:/a/ai_canifa_company/backend/api/routes/run_logs.py) | 438, 551-553, 571, 628 | Hardcoded log descriptions and CEO report templates mentioning "Canifa Premium Landing Page" and "Canifa Magento 2 server sync" |
| [backend/auth/\_\_init\_\_.py](file:///d:/a/ai_canifa_company/backend/auth/__init__.py) | 11 | Default auth secret key `canifa-dashboard-secret-2024-change-me` |
| [backend/auth/models.py](file:///d:/a/ai_canifa_company/backend/auth/models.py) | 10 | Hardcoded schema name `dashboard_canifa` |
| [backend/common/cache.py](file:///d:/a/ai_canifa_company/backend/common/cache.py) | 27 | Docstring reference: `"Hybrid Cache Client for Canifa Chatbot"` |
| [backend/common/codex_auth.py](file:///d:/a/ai_canifa_company/backend/common/codex_auth.py) | 3 | Docstring reference: `"Codex OAuth Token Manager (Simplified for Canifa AI Platform)"` |
---
## 2. Hardcoded Configuration & Credentials (Phase 4)
These hardcoded settings and environment fallbacks must be migrated to tenant-level configuration or environment-driven variables in **Phase 4**:
| Code/Pattern | File Path | Line(s) | Impact / Cleanup Action |
|---|---|---|---|
| `"company_123"` | `backend/tests/test_agent_flow.py` & `backend/scratch/*.py` | Multiple | Keep in test suite (mocking), but remove from database initialization seed scripts in `seed_db.py` (replace with dynamic seed from blueprint). |
| `"PAP"` | [backend/models/companies.py](file:///d:/a/ai_canifa_company/backend/models/companies.py) | 23 | Default issue prefix. Should be read dynamically from the database row (which is seeded by the company blueprint). |
| `"http://localhost:13001"` | [backend/services/nocobase_connector.py](file:///d:/a/ai_canifa_company/backend/services/nocobase_connector.py) | 9, 12 | Default NocoBase host URL. Must be fetched dynamically from `CompanySecret` or company-scoped database configs. |
| `"admin@nocobase.com"` / `"admin123"` | [backend/services/nocobase_connector.py](file:///d:/a/ai_canifa_company/backend/services/nocobase_connector.py) | 21 | Default NocoBase administrator credentials. Must be loaded from secrets. |
| `"admin@paperclip.ai"` | `backend/scratch/*.py` | Multiple | Default admin email. Convert to a dynamic config parameter. |
---
## 3. Hardcoded Swarm Role Pipeline (Phase 1)
Swarm orchestration stages are currently hardcoded in [backend/services/project_orchestrator.py](file:///d:/a/ai_canifa_company/backend/services/project_orchestrator.py):
* **PIPELINE_STAGES** (Lines 28-34):
```python
PIPELINE_STAGES = [
["ceo", "pm"], # Stage 1: CEO strategy + PM spec
["rd", "designer", "finance", "hr"], # Stage 2: Independent departments (parallel)
["marketing", "ecom", "coder"], # Stage 3: Depends on design/spec output
["qa"], # Stage 4: QA reviews everything
["devops"], # Stage 5: DevOps deploys (optional)
]
```
* **ROLE_ORDER** (Line 37): Flattened version of the above.
**Phase 1 Action**: Refactor `ProjectOrchestrator` to accept a dynamic topological sorting of roles (pipeline DAG spec) loaded from the `CompanyBlueprint`. If none is specified, fall back to the default `PIPELINE_STAGES` list to maintain backward compatibility.
---
## 4. Chain-Reaction Issue Flow Verification (Phase 0/1)
We investigated the issue completion triggers in `backend/api/routes/issues.py` and `backend/tasks/agent_tasks.py`:
* **Current state**: There is **no automated chain-reaction issue auto-spawn logic** running inside the backend core when an issue transitions to `"completed"` or `"resolved"`.
* **Trigger structure**: Waking up agent checkout runs is handled via the explicit POST endpoint `/api/issues-checkout-wakeup` (in `backend/api/routes/issues_checkout_wakeup.py`) which inserts a queued `HeartbeatRun` record.
* **Conclusion**: Since there is no existing chain-reaction logic to refactor, we do not need to worry about breaking implicit triggers. Building a true auto-spawning rule engine is scheduled as an extension task (E3) in the roadmap rather than a core refactoring item.
---
## 5. Fashion-Vertical Specific Features (Phase 6)
The following modules contain business logic coupled directly to fashion retail, styling, and product description generation. These should be isolated as plugins or blueprints in **Phase 6**:
1. [backend/common/canifa_api.py](file:///d:/a/ai_canifa_company/backend/common/canifa_api.py): Magento client integration with Canifa customer and authentication APIs.
2. [backend/common/content_templates.py](file:///d:/a/ai_canifa_company/backend/common/content_templates.py): Custom social/marketing templates in Vietnamese specifically customized for Canifa clothing, outfit styling, and campaigns.
3. [backend/common/outfit_db.py](file:///d:/a/ai_canifa_company/backend/common/outfit_db.py): Helper classes and DB wrappers for outfit compositions and "stylist pins".
4. [backend/common/ultra_desc_db.py](file:///d:/a/ai_canifa_company/backend/common/ultra_desc_db.py): Special generator and database connector for ultra-long fashion marketing descriptions.
5. [backend/common/social/approval_gate.py](file:///d:/a/ai_canifa_company/backend/common/social/approval_gate.py): References to the AI stylist engine generating fashion suggestions.
---
## 6. Blueprint-Anchor Schema Mapping (Phase 2 & 3)
The following existing components provide structures that can be utilized to implement company-level blueprints:
* **Marketplace Templates**: [backend/data/marketplace_templates.json](file:///d:/a/ai_canifa_company/backend/data/marketplace_templates.json) defines an array of deployment templates (e.g., `landing-page-builder`, `mobile-app-team`) containing fields like `name`, `description`, and `agents` (with `role`, `name`, `skills`).
* **Deploy Logic**: [backend/api/routes/pipelines.py](file:///d:/a/ai_canifa_company/backend/api/routes/pipelines.py) (Lines 73-96) shows how agents are instantiated from templates.
* **Portability Exports**: [backend/api/routes/company_portability.py](file:///d:/a/ai_canifa_company/backend/api/routes/company_portability.py) defines how company data (agents, pipelines, secrets) is serialized/deserialized, serving as a base model for importing blueprints.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment