rules and planning finalize for docs to be standrd always

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-27 00:55:50 +00:00
parent 7a9fa8fd8f
commit 7af4190e6d
5 changed files with 228 additions and 247 deletions

103
.rules
View File

@@ -1,6 +1,6 @@
# IGNY8 AI Agent Rules
**Version:** 1.1.0 | **Updated:** December 27, 2025
**Version:** 1.1.3 | **Updated:** December 27, 2025
---
@@ -26,6 +26,25 @@
---
## ⚠️ Module Status
| Module | Status | Notes |
|--------|--------|-------|
| Planner | ✅ Active | Keywords, Clusters, Ideas |
| Writer | ✅ Active | Tasks, Content, Images |
| Automation | ✅ Active | 7-stage pipeline |
| Billing | ✅ Active | Credits, Plans |
| Publisher | ✅ Active | WordPress publishing |
| **Linker** | ⏸️ Inactive | Exists but disabled - Phase 2 |
| **Optimizer** | ⏸️ Inactive | Exists but disabled - Phase 2 |
| **SiteBuilder** | ❌ Removed | Code exists but NOT part of app - mark for removal in TODOS.md |
**Important:**
- Do NOT work on Linker/Optimizer unless specifically requested
- SiteBuilder code is deprecated - if found, add to `TODOS.md` for cleanup
---
## 🐳 Docker Commands (IMPORTANT!)
**Container Names:**
@@ -57,26 +76,44 @@ docker logs igny8_celery_worker -f
---
## 📊 Data Scoping (CRITICAL!)
**Understand which data is scoped where:**
| Scope | Models | Notes |
|-------|--------|-------|
| **Global (Platform-wide)** | `GlobalIntegrationSettings`, `GlobalAIPrompt`, `GlobalAuthorProfile`, `GlobalStrategy`, `GlobalModuleSettings`, `Industry`, `SeedKeyword` | Admin-only, shared by ALL accounts |
| **Account-scoped** | `Account`, `User`, `Plan`, `IntegrationSettings`, `ModuleEnableSettings`, `AISettings`, `AIPrompt`, `AuthorProfile` | Filter by `account` |
| **Site+Sector-scoped** | `Keywords`, `Clusters`, `ContentIdeas`, `Tasks`, `Content`, `Images` | Filter by `site` AND optionally `sector` |
**Key Rules:**
- Global settings: NO account filtering (platform-wide, admin managed)
- Account models: Use `AccountBaseModel`, filter by `request.user.account`
- Site/Sector models: Use `SiteSectorBaseModel`, filter by `site` and `sector`
---
## ✅ Rules (One Line Each)
### Before Coding
1. **Read docs first** - Always read the relevant module doc from `docs/10-MODULES/` before changing code
2. **Check existing patterns** - Search codebase for similar implementations before creating new ones
3. **Use existing components** - Never duplicate; reuse components from `frontend/src/components/`
4. **Check data scope** - Know if your model is Global, Account, or Site/Sector scoped (see table above)
### During Coding
4. **Scope by account** - Every query must filter by `account` (use `AccountBaseModel` or `SiteSectorBaseModel`)
5. **Use AI framework** - Use `backend/igny8_core/ai/` for AI operations, NOT legacy `utils/ai_processor.py`
6. **Follow service pattern** - Business logic in `backend/igny8_core/business/*/services/`
7. **Check permissions** - Use `IsAuthenticatedAndActive`, `HasTenantAccess` in views
8. **Use TypeScript types** - All frontend code must be typed
9. **Use TailwindCSS** - No inline styles; follow `frontend/DESIGN_SYSTEM.md`
5. **Use correct base class** - Global: `models.Model`, Account: `AccountBaseModel`, Site: `SiteSectorBaseModel`
6. **Use AI framework** - Use `backend/igny8_core/ai/` for AI operations, NOT legacy `utils/ai_processor.py`
7. **Follow service pattern** - Business logic in `backend/igny8_core/business/*/services/`
8. **Check permissions** - Use `IsAuthenticatedAndActive`, `HasTenantAccess` in views
9. **Use TypeScript types** - All frontend code must be typed
10. **Use TailwindCSS** - No inline styles; follow `frontend/DESIGN_SYSTEM.md`
### After Coding
10. **Update CHANGELOG.md** - Every commit needs a changelog entry with git reference
11. **Increment version** - PATCH for fixes, MINOR for features, MAJOR for breaking changes
12. **Update docs** - If you changed APIs or architecture, update relevant docs in `docs/`
13. **Run migrations** - After model changes: `docker exec -it igny8_backend python manage.py makemigrations`
11. **Update CHANGELOG.md** - Every commit needs a changelog entry with git reference
12. **Increment version** - PATCH for fixes, MINOR for features, MAJOR for breaking changes
13. **Update docs** - If you changed APIs or architecture, update relevant docs in `docs/`
14. **Run migrations** - After model changes: `docker exec -it igny8_backend python manage.py makemigrations`
---
@@ -117,10 +154,13 @@ docker logs igny8_celery_worker -f
- ❌ Create duplicate components
- ❌ Use `docker-compose` for exec commands (use `docker exec`)
- ❌ Use legacy `utils/ai_processor.py`
- ❌ Skip account scoping in queries
- ❌ Add account filtering to Global models (they're platform-wide!)
- ❌ Forget site/sector filtering on content models
- ❌ Forget to update CHANGELOG
- ❌ Use inline styles (use TailwindCSS)
- ❌ Hardcode values (use settings/constants)
- ❌ Work on Linker/Optimizer (inactive modules - Phase 2)
- ❌ Use any SiteBuilder code (deprecated - mark for removal)
---
@@ -134,9 +174,42 @@ docker logs igny8_celery_worker -f
| Billing | `/api/v1/billing/` |
| Integration | `/api/v1/integration/` |
| System | `/api/v1/system/` |
| Publisher | `/api/v1/publisher/` |
**API Docs:** http://localhost:8000/api/docs/
**API Docs:** https://api.igny8.com/api/docs/
**Admin:** https://api.igny8.com/admin/
**App:** https://app.igny8.com/
---
## 📄 Documentation Rules
**Root folder MD files allowed:**
- `CHANGELOG.md` - Version history
- `README.md` - Project quickstart
- `IGNY8-APP.md` - Executive summary
- `TODOS.md` - Cleanup tracking
**All other docs go in `/docs/` folder:**
```
docs/
├── INDEX.md # Master navigation
├── 00-SYSTEM/ # Architecture, auth, tenancy
├── 10-MODULES/ # One file per module
├── 20-API/ # API endpoints
├── 30-FRONTEND/ # Pages, stores
├── 40-WORKFLOWS/ # Cross-module flows
└── 90-REFERENCE/ # Models, AI functions
```
**When updating docs:**
| Change Type | Update These Files |
|-------------|-------------------|
| New endpoint | Module doc + `docs/20-API/ENDPOINTS.md` |
| New model | Module doc + `docs/90-REFERENCE/MODELS.md` |
| New page | Module doc + `docs/30-FRONTEND/PAGES.md` |
| New module | Create module doc + update `docs/INDEX.md` |
**DO NOT** create random MD files - update existing docs instead.
---
@@ -144,7 +217,7 @@ docker logs igny8_celery_worker -f
- [ ] Read relevant module docs
- [ ] Used existing components/patterns
- [ ] Account scoped all queries
- [ ] Correct data scope (Global/Account/Site)
- [ ] Updated CHANGELOG.md with git reference
- [ ] Updated version number
- [ ] Ran migrations if model changed