Files
alla-allaos-fullstack/plans/task-a.md
2026-06-11 16:55:45 +07:00

146 lines
4.0 KiB
Markdown

# Task A: Template Audit + Convention Freeze
## ALLA OS CRM vNext / Organization-based
คุณคือ Senior Full-stack Engineer + System Architect
ให้สำรวจ template project ปัจจุบันก่อนเริ่ม production code สำหรับ ALLA OS CRM vNext
## Context สำคัญ
ระบบนี้ต้องยึด **organization-based / workspace-based** เป็นแกนหลัก
```txt
organizationId = tenant / workspace / company group scope
membership = user role + permissions ภายใน organization
branchId = business branch / document scope ภายใน organization
```
ห้ามตีความ `branchId` เป็น tenant หลัก
ห้ามออกแบบแบบ branch-first
## ไฟล์/Skill ที่ต้องอ่านก่อน
ก่อนสรุป convention ต้องอ่าน:
```txt
.agents/skills/kiranism-shadcn-dashboard
Layout.md
AGENTS.md
README.md
package.json
src/db/schema.ts
src/lib/auth
src/app/dashboard
src/features
src/components
```
ถ้า path บางรายการไม่มี ให้ระบุใน audit ว่า “not found” ห้ามเดา
## เป้าหมาย
สร้างเอกสาร audit เพื่อ freeze convention ก่อนทำ Task B
## สิ่งที่ต้องตรวจ
1. Project structure
2. App Router structure
3. Dashboard layout
4. Layout rule จาก `Layout.md`
5. Skill rule จาก `.agents/skills/kiranism-shadcn-dashboard`
6. Sidebar / navigation pattern
7. PageContainer pattern
8. Server component / client component pattern
9. Data fetching pattern
10. TanStack Query / Hydration pattern
11. Form pattern
12. DataTable pattern
13. Sheet / Dialog / Drawer pattern
14. Drizzle schema convention
15. API route / server action convention
16. Feature folder convention
17. Auth convention
18. Organization context
19. Membership / permission / RBAC pattern
20. Active organization handling
21. Existing dashboard visual tone
22. Design token / theme usage
23. Files that should not be touched
24. Risk before Task B
## ข้อกำหนดสำคัญ
* ห้าม implement feature
* ห้าม refactor
* ห้ามเปลี่ยน config
* ห้ามเพิ่ม dependency
* ห้าม run build/test/lint จนกว่าจะได้รับคำสั่ง
* ห้ามสร้าง design system ใหม่
* ห้ามสร้าง layout ใหม่ถ้า template มีอยู่แล้ว
* ต้องยึด `Layout.md` และ dashboard skill เป็น source of truth ด้าน UI
## Output
สร้างไฟล์:
```txt
docs/implementation/task-a-template-audit.md
```
โครงสร้างเอกสาร:
```md
# Task A Template Audit
## 1. Executive Summary
## 2. Project Structure
## 3. Layout.md Findings
## 4. kiranism-shadcn-dashboard Skill Findings
## 5. Routing Convention
## 6. Dashboard Layout Convention
## 7. Feature Folder Convention
## 8. Component Convention
## 9. Form Convention
## 10. Table Convention
## 11. API / Server Action Convention
## 12. Drizzle / Database Convention
## 13. Auth Convention
## 14. Organization / Membership / Permission Convention
## 15. Branch Scope Convention
## 16. UI / Design Token Convention
## 17. CRM vNext Recommended Convention
## 18. Files That Should Not Be Touched
## 19. Risks / Concerns
## 20. Task B Implementation Plan
```
## Definition of Done
Task A ถือว่าเสร็จเมื่อ:
* มี audit document ครบ
* ยืนยันว่า organization-based เป็นแกนหลัก
* ยืนยันว่า branch เป็น sub-scope ภายใน organization
* ระบุ path สำหรับวาง Task B ได้ชัดเจน
* ระบุ convention UI จาก Layout.md และ dashboard skill แล้ว
* ยังไม่มี production feature ถูก implement