codepolicy addition

This commit is contained in:
2025-12-30 23:46:08 +09:00
parent 526e17d5c8
commit 4ce1e3f813
3 changed files with 671 additions and 13 deletions

560
codepolicy/index.php Normal file
View File

@@ -0,0 +1,560 @@
<?php
/**
* SAM System - Code Development Policy Guide
* Final Update: 2025-12-19
*/
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAM Code Development Policy</title>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
<!-- Icons -->
<script src="https://unpkg.com/lucide@latest"></script>
<style>
:root {
--bg: #030712;
--glass: rgba(17, 24, 39, 0.7);
--glass-border: rgba(255, 255, 255, 0.1);
--primary: #3b82f6;
--primary-glow: rgba(59, 130, 246, 0.5);
--secondary: #10b981;
--accent: #8b5cf6;
--danger: #ef4444;
--text-main: #f3f4f6;
--text-muted: #9ca3af;
--code-bg: #111827;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-color: var(--bg);
color: var(--text-main);
font-family: 'Inter', sans-serif;
line-height: 1.6;
overflow-x: hidden;
background-image:
radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
/* Hero Section */
.hero {
padding: 4rem 0 2rem;
text-align: center;
}
.hero h1 {
font-family: 'Outfit', sans-serif;
font-size: 3.5rem;
background: linear-gradient(135deg, #fff 0%, #3b82f6 50%, #8b5cf6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 1rem;
letter-spacing: -0.02em;
}
.hero p {
color: var(--text-muted);
font-size: 1.1rem;
max-width: 600px;
margin: 0 auto;
}
.update-badge {
display: inline-block;
padding: 0.5rem 1rem;
background: rgba(59, 130, 246, 0.1);
border: 1px solid rgba(59, 130, 246, 0.2);
border-radius: 20px;
color: var(--primary);
font-size: 0.85rem;
margin-bottom: 2rem;
}
/* Section Layout */
.section {
margin-bottom: 4rem;
opacity: 0;
transform: translateY(20px);
transition: all 0.6s ease-out;
}
.section.visible {
opacity: 1;
transform: translateY(0);
}
.section-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 2rem;
}
.section-header i {
color: var(--primary);
}
.section-header h2 {
font-family: 'Outfit', sans-serif;
font-size: 2rem;
color: #fff;
}
/* Glass Cards */
.glass-card {
background: var(--glass);
backdrop-filter: blur(12px);
border: 1px solid var(--glass-border);
border-radius: 24px;
padding: 2.5rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
position: relative;
overflow: hidden;
height: 100%;
}
.glass-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, var(--primary), transparent);
opacity: 0.3;
}
/* Content Styles */
h3 {
font-family: 'Outfit', sans-serif;
font-size: 1.4rem;
margin-bottom: 1.5rem;
color: #fff;
display: flex;
align-items: center;
gap: 0.5rem;
}
.grid-2 {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
gap: 2rem;
}
.rule-box {
border-radius: 16px;
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.rule-box.prohibited {
background: rgba(239, 68, 68, 0.05);
border: 1px solid rgba(239, 68, 68, 0.2);
}
.rule-box.prohibited h4 {
color: var(--danger);
margin-bottom: 0.75rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.rule-box.mandatory {
background: rgba(16, 185, 129, 0.05);
border: 1px solid rgba(16, 185, 129, 0.2);
}
.rule-box.mandatory h4 {
color: var(--secondary);
margin-bottom: 0.75rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Table Styles */
.table-container {
width: 100%;
overflow-x: auto;
margin-top: 1rem;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.95rem;
}
th {
text-align: left;
padding: 1rem;
background: rgba(255, 255, 255, 0.03);
color: var(--text-muted);
font-weight: 600;
border-bottom: 2px solid var(--glass-border);
}
td {
padding: 1rem;
border-bottom: 1px solid var(--glass-border);
}
tr:last-child td {
border-bottom: none;
}
/* Code Block */
pre {
background: var(--code-bg);
padding: 1.5rem;
border-radius: 12px;
font-family: 'Fira Code', monospace;
font-size: 0.9rem;
color: #d1d5db;
overflow-x: auto;
margin: 1rem 0;
border: 1px solid rgba(255, 255, 255, 0.05);
}
code {
color: #818cf8;
}
/* Flow Diagrams */
.flow-diagram {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
margin: 2rem 0;
}
.flow-box {
padding: 1rem 2rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--glass-border);
border-radius: 12px;
width: 100%;
max-width: 500px;
text-align: center;
}
.flow-arrow {
font-size: 1.5rem;
color: var(--primary);
}
/* List Styles */
ul, ol {
padding-left: 1.5rem;
margin-bottom: 1.5rem;
}
li {
margin-bottom: 0.5rem;
}
/* Tags */
.tag {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
margin-right: 0.5rem;
}
.tag-red { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.tag-green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.tag-blue { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
/* Animation class */
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.animate-up {
animation: fadeInUp 0.8s ease forwards;
}
footer {
padding: 4rem 2rem;
text-align: center;
color: var(--text-muted);
border-top: 1px solid var(--glass-border);
}
/* Responsive */
@media (max-width: 768px) {
.hero h1 { font-size: 2.5rem; }
.grid-2 { grid-template-columns: 1fr; }
.container { padding: 1rem; }
}
</style>
</head>
<body>
<div class="container">
<!-- Hero Section -->
<header class="hero scale-in">
<span class="update-badge">Last Updated: 2025-12-19</span>
<h1>SAM Code Development Policy</h1>
<p>SAM 시스템의 견적, 수주, 생산, 출하, 품질 등 모든 MES 기능 개발에 적용되는 핵심 가이드라인 및 공통 정책입니다.</p>
</header>
<!-- Section 1: Overview -->
<section class="section">
<div class="section-header">
<i data-lucide="info"></i>
<h2>📋 개요</h2>
</div>
<div class="glass-card">
<p>이 문서는 SAM 시스템의 모든 기능 개발에 공통으로 적용되는 정책을 정의합니다. 각 기능별 개발 문서(MASTER_PLAN.md)는 반드시 이 공통 정책 문서를 참조하며, 정책 준수 여부가 품질 검증의 최우선 순위입니다.</p>
</div>
</section>
<!-- Section 2: Core Rules -->
<section class="section">
<div class="section-header">
<i data-lucide="alert-octagon"></i>
<h2>🚨 필수 준수 규칙</h2>
</div>
<div class="grid-2">
<!-- Table Policy -->
<div class="glass-card">
<h3><i data-lucide="database"></i> 1. 테이블 정책</h3>
<div class="rule-box prohibited">
<h4>❌ 절대 금지</h4>
<ul>
<li>새로운 테이블을 임의로 생성 (price_new, order_items_v2 등)</li>
<li>기존 테이블 구조를 사용자 승인 없이 변경</li>
<li>mng 프로젝트에서 마이그레이션 실행</li>
</ul>
</div>
<div class="rule-box mandatory">
<h4>✅ 필수 사항</h4>
<ul>
<li>기존 테이블을 최우선으로 분석하여 활용</li>
<li>테이블 추가가 필요한 경우 반드시 사용자 승인 획득</li>
<li>DB 마이그레이션은 오직 <strong>api</strong> 프로젝트에서만 실행</li>
</ul>
</div>
</div>
<!-- Tech Stack -->
<div class="glass-card">
<h3><i data-lucide="layers"></i> 2. 프로젝트 스택</h3>
<div class="table-container">
<table>
<thead>
<tr>
<th>프로젝트</th>
<th>기술 스택</th>
<th>주의사항</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>mng</strong></td>
<td>Laravel 12 + Plain Blade + Tailwind + Filament</td>
<td><span class="tag tag-red">❌ Alpine.js 금지</span></td>
</tr>
<tr>
<td><strong>api</strong></td>
<td>Laravel 12 REST API + Swagger</td>
<td><span class="tag tag-green">Multi-tenant 필수</span></td>
</tr>
<tr>
<td><strong>5130</strong></td>
<td>PHP + jQuery + Legacy JS</td>
<td>분석 및 참조용</td>
</tr>
<tr>
<td><strong>react</strong></td>
<td>Next.js 15</td>
<td>프론트엔드 전담</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Code Convention -->
<div class="glass-card" style="margin-top: 2rem;">
<h3><i data-lucide="code-2"></i> 3. 코드 컨벤션 (추측 금지 원칙)</h3>
<p style="margin-bottom: 1.5rem;"><span class="tag tag-red">🔴 핵심: 모든 코드 요소는 실제 확인 후 사용</span></p>
<div class="grid-2">
<div class="rule-box prohibited">
<h4>❌ 절대 금지 - 추측/할루시네이션</h4>
<ul style="font-size: 0.9rem;">
<li>컬럼명 추측 (tenant.name → 실제는 tenant.company_name)</li>
<li>관계명 추측 (user.roles → 실제는 user.userRoles)</li>
<li>경로 및 메서드명 추측 (getName() → getCompanyName() 확인 필요)</li>
<li>테이블명 확인 (users → sam_users 여부 확인)</li>
</ul>
</div>
<div class="rule-box mandatory">
<h4>✅ 필수 사항 - 확인 프로세스</h4>
<ul style="font-size: 0.9rem;">
<li>모델 파일(app/Models/*.php)에서 컬럼/관계 직접 확인</li>
<li>마이그레이션 파일에서 원본 데이터 구조 대조</li>
<li>기존 컨트롤러/서비스의 실제 구현 패턴 확인</li>
<li>불확실한 경우 주저하지 말고 사용자에게 질문</li>
</ul>
</div>
</div>
</div>
</section>
<!-- Section 3: DB Policy -->
<section class="section">
<div class="section-header">
<i data-lucide="table"></i>
<h2>🗄️ DB 테이블 상세 정책</h2>
</div>
<div class="glass-card">
<h3>테이블 설계 정책 (Hybrid EAV)</h3>
<div class="grid-2" style="margin-top: 2rem;">
<div class="rule-box" style="background: rgba(59, 130, 246, 0.05); border: 1px solid rgba(59, 130, 246, 0.2);">
<h4 style="color: var(--primary);"><span class="tag tag-red">🔴</span> 필수 컬럼 (일반 컬럼 생성)</h4>
<ul style="font-size: 0.9rem;">
<li>조인에 사용되는 필드 (FK: tenant_id, product_id 등)</li>
<li>인덱싱이 필요한 검색/정렬 필드 (status, created_at)</li>
<li>고빈도 쿼리 WHERE 조건 필드</li>
<li>유니크 제약이 필요한 고유 필드 (code, slug)</li>
</ul>
</div>
<div class="rule-box" style="background: rgba(139, 92, 246, 0.05); border: 1px solid rgba(139, 92, 246, 0.2);">
<h4 style="color: var(--accent);"><span class="tag tag-green">🟢</span> 가변 컬럼 (options JSON 통합)</h4>
<ul style="font-size: 0.9rem;">
<li>순수 비즈니스 로직용 데이터</li>
<li>설정값, 부가 옵션 정보</li>
<li>향후 확장 가능성이 높은 데이터</li>
<li>조인이나 검색 필터로 사용되지 않는 필드</li>
</ul>
</div>
</div>
<div style="margin-top: 2rem;">
<h4>⚠️ Enum 지양 정책</h4>
<pre>
// ❌ 지양: DB Enum (변경 시 마이그레이션 복잡)
$table->enum('status',['pending','approved','rejected']);
// ✅ 권장: string + 코드 테이블 (common_codes)
$table->string('status', 20)->default('pending');
// ✅ 허용: boolean (명확한 2가지 상태)
$table->boolean('is_active')->default(true);
</pre>
</div>
</div>
</section>
<!-- Section 4: Workflow -->
<section class="section">
<div class="section-header">
<i data-lucide="refresh-cw"></i>
<h2>🔄 Phase 진행 및 커밋 정책</h2>
</div>
<div class="grid-2">
<div class="glass-card">
<h3>Phase 워크플로우</h3>
<div class="flow-diagram">
<div class="flow-box"><strong>Step 1: 5130 리서치</strong><br>원본 데이터 구조 분석</div>
<div class="flow-arrow">↓</div>
<div class="flow-box"><strong>Step 2: SAM 매핑</strong><br>기존 확인 및 신규 설계</div>
<div class="flow-arrow">↓</div>
<div class="flow-box"><strong>Step 3: 필수/가변 분류</strong><br>JSON 통합 필드 식별</div>
<div class="flow-arrow">↓</div>
<div class="flow-box"><strong>Step 4: 사용자 승인</strong><br>설계 확정 후 구현 시작</div>
</div>
</div>
<div class="glass-card">
<h3>세션 및 커밋 원칙</h3>
<ul style="margin-top: 1rem;">
<li><strong>롤백 포인트</strong>: 각 Phase 완료 시 Git 태그 생성 필수</li>
<li><strong>세션 중단 대응</strong>: PROGRESS.md를 통해 컨텍스트 실시간 복구</li>
<li><strong>커밋 메시지</strong>: 반드시 <strong>한글</strong>로 작성하며 단계별 커밋</li>
<li><strong>푸시 정책</strong>: 커밋 후 푸시 여부는 묻지 않으며 사용자 수동 진행</li>
</ul>
</div>
</div>
</section>
<!-- Section 5: Changlog -->
<section class="section">
<div class="section-header">
<i data-lucide="history"></i>
<h2>📝 변경 이력</h2>
</div>
<div class="glass-card">
<div class="table-container">
<table>
<thead>
<tr>
<th>날짜</th>
<th>변경 내용</th>
<th>작성자</th>
</tr>
</thead>
<tbody>
<tr>
<td>2025-12-19</td>
<td>초기 공통 정책 문서 작성 (MES 통합 가이드)</td>
<td>Claude</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
</div>
<footer>
<p>&copy; 2025 SAM MES Development Group. All Rights Reserved.</p>
<p style="margin-top: 10px; font-size: 0.8rem; opacity: 0.5;">이 문서는 SAM 시스템의 공식 개발 정책을 따릅니다.</p>
</footer>
<script>
// Initialize Lucide Icons
lucide.createIcons();
// Intersection Observer for Scroll Animations
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, observerOptions);
document.querySelectorAll('.section').forEach(section => {
observer.observe(section);
});
</script>
</body>
</html>