v7.0.0-beta.1 release
This commit is contained in:
commit
6595fd0eb5
3967 files changed
+1875383
No files matched your search
@@ -0,0 +1,204 @@
|
||||
/**
|
||||
* 버그 수정 워크플로우
|
||||
* TDD 기반: 버그 재현 테스트 → 수정 → 테스트 통과
|
||||
*/
|
||||
import { Coordinator } from '../coordinator/Coordinator.js';
|
||||
import { createWorkflowLogger } from '../utils/logger.js';
|
||||
import type { WorkflowResult } from '../types/index.js';
|
||||
|
||||
const workflowLogger = createWorkflowLogger('bugfix');
|
||||
|
||||
export type AffectedArea = 'backend' | 'frontend' | 'layout' | 'template' | 'unknown';
|
||||
|
||||
export interface BugfixOptions {
|
||||
cwd?: string;
|
||||
affectedAreas?: AffectedArea[];
|
||||
skipTroubleshooting?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 버그 수정 워크플로우 실행
|
||||
*/
|
||||
export async function bugfixWorkflow(
|
||||
bugDescription: string,
|
||||
options: BugfixOptions = {}
|
||||
): Promise<WorkflowResult> {
|
||||
workflowLogger.info(`Starting bugfix: ${bugDescription}`);
|
||||
|
||||
const { affectedAreas = ['unknown'], skipTroubleshooting = false } = options;
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
// 영향 영역에 따른 에이전트 선택
|
||||
const agentInstructions = getAgentInstructions(affectedAreas);
|
||||
|
||||
const prompt = `
|
||||
버그를 수정해주세요: ${bugDescription}
|
||||
|
||||
## 작업 순서 (TDD 기반)
|
||||
|
||||
### 1. 트러블슈팅 가이드 확인
|
||||
${skipTroubleshooting ? '(건너뛰기)' : `
|
||||
- search-docs 도구로 유사 사례 검색
|
||||
- docs/frontend/troubleshooting-guide.md 확인
|
||||
- docs/frontend/troubleshooting-state.md (상태 관련)
|
||||
- docs/frontend/troubleshooting-cache.md (캐시 관련)
|
||||
- docs/frontend/troubleshooting-components.md (컴포넌트 관련)
|
||||
`}
|
||||
|
||||
### 2. 버그 분석
|
||||
- 버그 재현 조건 파악
|
||||
- 영향 받는 파일 식별
|
||||
- 근본 원인 분석
|
||||
|
||||
### 3. 버그 재현 테스트 작성 (TDD - RED)
|
||||
- 버그를 재현하는 테스트 케이스 작성
|
||||
- 테스트 실행하여 실패 확인
|
||||
|
||||
### 4. 버그 수정 (TDD - GREEN)
|
||||
- 최소한의 변경으로 버그 수정
|
||||
- 그누보드7 규정 준수
|
||||
|
||||
### 5. 테스트 실행 (TDD - REFACTOR)
|
||||
- 작성한 테스트 통과 확인
|
||||
- 기존 테스트도 모두 통과 확인
|
||||
- 필요시 코드 정리
|
||||
|
||||
### 6. 검수
|
||||
- 규정 준수 확인
|
||||
- 부작용 없는지 확인
|
||||
- 문서화
|
||||
|
||||
${agentInstructions}
|
||||
|
||||
## 중요 규칙
|
||||
- 버그 재현 테스트 먼저 작성 (TDD)
|
||||
- 최소한의 변경으로 수정
|
||||
- 모든 테스트 통과 필수
|
||||
- 유사 버그 재발 방지 고려
|
||||
|
||||
## 참조 문서
|
||||
- docs/frontend/troubleshooting-guide.md
|
||||
- docs/testing-guide.md
|
||||
`;
|
||||
|
||||
try {
|
||||
const result = await coordinator.orchestrate(prompt);
|
||||
|
||||
if (result.success) {
|
||||
workflowLogger.info('Bugfix completed successfully');
|
||||
} else {
|
||||
workflowLogger.error(`Bugfix failed: ${result.errors?.join(', ')}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
} catch (error: any) {
|
||||
workflowLogger.error(`Bugfix error: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
steps: [],
|
||||
totalCost: 0,
|
||||
errors: [error.message],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 영향 영역에 따른 에이전트 지시사항 생성
|
||||
*/
|
||||
function getAgentInstructions(areas: AffectedArea[]): string {
|
||||
const instructions: string[] = [];
|
||||
|
||||
if (areas.includes('backend') || areas.includes('unknown')) {
|
||||
instructions.push(`
|
||||
### [backend] 백엔드 수정 시
|
||||
- Service-Repository 패턴 준수
|
||||
- 훅 실행 확인
|
||||
- FormRequest 검증
|
||||
- 테스트: php artisan test --filter=TestName
|
||||
`);
|
||||
}
|
||||
|
||||
if (areas.includes('frontend') || areas.includes('unknown')) {
|
||||
instructions.push(`
|
||||
### [frontend] 프론트엔드 수정 시
|
||||
- HTML 태그 직접 사용 금지
|
||||
- 다크 모드 클래스 쌍 확인
|
||||
- G7Core.t() 다국어 처리
|
||||
- 테스트: powershell -Command "npm run test:run"
|
||||
`);
|
||||
}
|
||||
|
||||
if (areas.includes('layout') || areas.includes('unknown')) {
|
||||
instructions.push(`
|
||||
### [layout] 레이아웃 수정 시
|
||||
- text 속성 사용 (props.children 금지)
|
||||
- 데이터 바인딩 문법 확인
|
||||
- 다국어 키 형식 확인
|
||||
- 갱신: php artisan template:refresh-layout
|
||||
`);
|
||||
}
|
||||
|
||||
if (areas.includes('template')) {
|
||||
instructions.push(`
|
||||
### [template] 템플릿 수정 시
|
||||
- components.json 확인
|
||||
- index.ts export 확인
|
||||
- 빌드: php artisan template:build sirsoft-admin_basic
|
||||
`);
|
||||
}
|
||||
|
||||
return instructions.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 상태 관련 버그 수정 (특화)
|
||||
*/
|
||||
export async function stateRelatedBugfix(
|
||||
bugDescription: string,
|
||||
options: { cwd?: string } = {}
|
||||
): Promise<WorkflowResult> {
|
||||
workflowLogger.info(`Starting state-related bugfix: ${bugDescription}`);
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
const prompt = `
|
||||
상태 관리 관련 버그를 수정해주세요: ${bugDescription}
|
||||
|
||||
## 필수 확인 사항 (troubleshooting-state.md 참조)
|
||||
|
||||
### 1. Stale Closure 문제
|
||||
- setState 호출 후 즉시 상태 참조 시 이전 값 문제
|
||||
- 해결: getter 함수, useRef, 또는 콜백 패턴 사용
|
||||
|
||||
### 2. sequence 내 setState 병합 문제
|
||||
- 여러 setState가 하나로 병합되는 문제
|
||||
- 해결: 별도 sequence로 분리 또는 직접 상태 조합
|
||||
|
||||
### 3. dot notation 충돌
|
||||
- 깊은 경로 업데이트 시 데이터 손실
|
||||
- 해결: 전체 객체 업데이트 또는 _merge 옵션
|
||||
|
||||
### 4. 타이밍 이슈
|
||||
- API 응답과 setState 타이밍 불일치
|
||||
- 해결: onSuccess/onError 콜백 사용
|
||||
|
||||
## 작업 순서
|
||||
1. docs/frontend/troubleshooting-state.md 읽기
|
||||
2. 유사 사례 확인
|
||||
3. 버그 재현 테스트 작성
|
||||
4. 수정 구현
|
||||
5. 테스트 통과 확인
|
||||
`;
|
||||
|
||||
return coordinator.orchestrate(prompt);
|
||||
}
|
||||
|
||||
export default bugfixWorkflow;
|
||||
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* 기능 개발 워크플로우
|
||||
* Backend → Layout → Frontend → Template → Reviewer 순서로 실행
|
||||
*/
|
||||
import { Coordinator } from '../coordinator/Coordinator.js';
|
||||
import { logger, createWorkflowLogger } from '../utils/logger.js';
|
||||
import type { WorkflowResult } from '../types/index.js';
|
||||
|
||||
const workflowLogger = createWorkflowLogger('feature');
|
||||
|
||||
/**
|
||||
* 기능 개발 워크플로우 실행
|
||||
*/
|
||||
export async function featureDevelopmentWorkflow(
|
||||
featureDescription: string,
|
||||
options: {
|
||||
cwd?: string;
|
||||
skipReview?: boolean;
|
||||
} = {}
|
||||
): Promise<WorkflowResult> {
|
||||
workflowLogger.info(`Starting feature development: ${featureDescription}`);
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
const prompt = `
|
||||
새로운 기능을 개발해주세요: ${featureDescription}
|
||||
|
||||
## 작업 순서 (순차 실행)
|
||||
|
||||
### 1. [backend] 백엔드 구현
|
||||
- 필요한 마이그레이션 생성 (php artisan make:migration)
|
||||
- Model 생성/수정
|
||||
- RepositoryInterface 및 Repository 구현
|
||||
- Service 클래스 구현 (훅 실행 포함)
|
||||
- FormRequest 검증 클래스
|
||||
- Controller 구현
|
||||
- 라우트 등록
|
||||
|
||||
### 2. [layout] 레이아웃 JSON 작성
|
||||
- 데이터 소스 정의 (API 엔드포인트 연결)
|
||||
- 컴포넌트 구조 설계
|
||||
- 데이터 바인딩 설정
|
||||
- 다국어 키 사용
|
||||
|
||||
### 3. [frontend] 컴포넌트 개발 (필요한 경우)
|
||||
- 기존 컴포넌트로 해결 가능한지 먼저 확인
|
||||
- 필요시 새 컴포넌트 개발
|
||||
- 다크 모드 지원
|
||||
- G7Core.t() 다국어 처리
|
||||
|
||||
### 4. [template] 템플릿 등록 및 빌드
|
||||
- components.json 등록 (새 컴포넌트인 경우)
|
||||
- index.ts export 추가
|
||||
- 빌드 실행: php artisan template:build sirsoft-admin_basic
|
||||
|
||||
### 5. [reviewer] 최종 검수
|
||||
- 백엔드 규정 준수 확인
|
||||
- 프론트엔드 규정 준수 확인
|
||||
- 테스트 실행 및 통과 확인
|
||||
- 문서화 확인
|
||||
|
||||
## 중요 규칙
|
||||
- 각 단계 완료 후 다음 에이전트에게 필요한 컨텍스트 전달
|
||||
- 모든 작업은 그누보드7 프로젝트 규정(docs/) 준수
|
||||
- 테스트 통과가 완료 조건
|
||||
- 문서화 필수
|
||||
|
||||
## 참조 문서
|
||||
- 백엔드: docs/backend/
|
||||
- 프론트엔드: docs/frontend/
|
||||
- 확장 시스템: docs/extension/
|
||||
`;
|
||||
|
||||
try {
|
||||
const result = await coordinator.orchestrate(prompt);
|
||||
|
||||
if (result.success) {
|
||||
workflowLogger.info('Feature development completed successfully');
|
||||
} else {
|
||||
workflowLogger.error(`Feature development failed: ${result.errors?.join(', ')}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
} catch (error: any) {
|
||||
workflowLogger.error(`Feature development error: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
steps: [],
|
||||
totalCost: 0,
|
||||
errors: [error.message],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 간단한 기능 추가 (단일 도메인)
|
||||
*/
|
||||
export async function simpleFeatureWorkflow(
|
||||
featureDescription: string,
|
||||
options: {
|
||||
cwd?: string;
|
||||
area: 'backend' | 'frontend' | 'layout' | 'template';
|
||||
}
|
||||
): Promise<WorkflowResult> {
|
||||
const { area } = options;
|
||||
workflowLogger.info(`Starting simple feature (${area}): ${featureDescription}`);
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
const areaPrompts: Record<string, string> = {
|
||||
backend: `
|
||||
백엔드 기능을 구현해주세요: ${featureDescription}
|
||||
|
||||
작업 내용:
|
||||
1. 필요한 파일 생성/수정
|
||||
2. 그누보드7 백엔드 규정 준수 (Service-Repository 패턴, FormRequest, 훅)
|
||||
3. 테스트 작성 및 실행
|
||||
4. 문서화
|
||||
|
||||
참조: docs/backend/
|
||||
`,
|
||||
frontend: `
|
||||
프론트엔드 컴포넌트를 개발해주세요: ${featureDescription}
|
||||
|
||||
작업 내용:
|
||||
1. 컴포넌트 파일 생성
|
||||
2. 그누보드7 프론트엔드 규정 준수 (기본 컴포넌트 사용, 다크 모드, 다국어)
|
||||
3. components.json 등록
|
||||
4. 테스트 작성 및 실행
|
||||
|
||||
참조: docs/frontend/components.md
|
||||
`,
|
||||
layout: `
|
||||
레이아웃 JSON을 작성해주세요: ${featureDescription}
|
||||
|
||||
작업 내용:
|
||||
1. 레이아웃 JSON 파일 생성
|
||||
2. 그누보드7 레이아웃 규정 준수 (text 속성, 다국어, 다크 모드 클래스)
|
||||
3. 데이터 소스 및 바인딩 설정
|
||||
4. 레이아웃 갱신: php artisan template:refresh-layout
|
||||
|
||||
참조: docs/frontend/layout-json.md
|
||||
`,
|
||||
template: `
|
||||
템플릿 컴포넌트를 등록하고 빌드해주세요: ${featureDescription}
|
||||
|
||||
작업 내용:
|
||||
1. components.json에 컴포넌트 등록
|
||||
2. index.ts에 export 추가
|
||||
3. 빌드 실행: php artisan template:build sirsoft-admin_basic
|
||||
|
||||
참조: docs/frontend/template-development.md
|
||||
`,
|
||||
};
|
||||
|
||||
const result = await coordinator.orchestrate(areaPrompts[area]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export default featureDevelopmentWorkflow;
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 워크플로우 모듈 export
|
||||
*/
|
||||
export { featureDevelopmentWorkflow, simpleFeatureWorkflow } from './feature.js';
|
||||
export { bugfixWorkflow, stateRelatedBugfix } from './bugfix.js';
|
||||
export { prReviewWorkflow, reviewFiles } from './pr-review.js';
|
||||
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* PR 검수 워크플로우
|
||||
* 변경된 파일 유형에 따라 적절한 에이전트가 검수
|
||||
*/
|
||||
import { Coordinator } from '../coordinator/Coordinator.js';
|
||||
import { createWorkflowLogger } from '../utils/logger.js';
|
||||
import type { WorkflowResult } from '../types/index.js';
|
||||
|
||||
const workflowLogger = createWorkflowLogger('pr-review');
|
||||
|
||||
export interface PRReviewOptions {
|
||||
cwd?: string;
|
||||
baseBranch?: string;
|
||||
skipTests?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* PR 검수 워크플로우 실행
|
||||
*/
|
||||
export async function prReviewWorkflow(
|
||||
prIdentifier: string | number,
|
||||
options: PRReviewOptions = {}
|
||||
): Promise<WorkflowResult> {
|
||||
workflowLogger.info(`Starting PR review: ${prIdentifier}`);
|
||||
|
||||
const { baseBranch = 'master', skipTests = false } = options;
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
const prompt = `
|
||||
PR을 검수해주세요: ${prIdentifier}
|
||||
|
||||
## 작업 순서
|
||||
|
||||
### 1. 변경 사항 분석
|
||||
\`\`\`bash
|
||||
# 변경된 파일 목록 확인
|
||||
git diff --name-only ${baseBranch}...HEAD
|
||||
|
||||
# 변경 내용 확인
|
||||
git diff ${baseBranch}...HEAD
|
||||
\`\`\`
|
||||
|
||||
### 2. 파일 유형별 검수 할당
|
||||
|
||||
변경된 파일 확장자/경로에 따라 적절한 에이전트에게 검수 요청:
|
||||
|
||||
| 파일 패턴 | 담당 에이전트 |
|
||||
|----------|--------------|
|
||||
| app/**/*.php | [backend] |
|
||||
| database/migrations/*.php | [backend] |
|
||||
| templates/**/src/**/*.tsx | [frontend] |
|
||||
| templates/**/layouts/**/*.json | [layout] |
|
||||
| resources/layouts/**/*.json | [layout] |
|
||||
| templates/**/components.json | [template] |
|
||||
|
||||
### 3. [backend] 백엔드 검수 (해당 시)
|
||||
- [ ] RepositoryInterface 주입 확인
|
||||
- [ ] Service 훅 실행 확인
|
||||
- [ ] FormRequest 검증 규칙
|
||||
- [ ] ResponseHelper 사용
|
||||
- [ ] 마이그레이션 down() 구현
|
||||
- [ ] 다국어 처리 (__())
|
||||
|
||||
### 4. [frontend] 프론트엔드 검수 (해당 시)
|
||||
- [ ] HTML 태그 직접 사용 금지
|
||||
- [ ] 다크 모드 클래스 쌍 지정
|
||||
- [ ] G7Core.t() 다국어 처리
|
||||
- [ ] Font Awesome 아이콘만 사용
|
||||
- [ ] components.json 등록
|
||||
|
||||
### 5. [layout] 레이아웃 검수 (해당 시)
|
||||
- [ ] text 속성 사용 (props.children 금지)
|
||||
- [ ] 데이터 바인딩 문법 정확성
|
||||
- [ ] 다국어 키 형식 ($t:)
|
||||
- [ ] 다크 모드 클래스 쌍
|
||||
|
||||
### 6. [reviewer] 최종 검수
|
||||
${skipTests ? '(테스트 건너뛰기)' : `
|
||||
- 백엔드 테스트: php artisan test
|
||||
- 프론트엔드 테스트: powershell -Command "npm run test:run"
|
||||
`}
|
||||
- 규정 준수 종합 확인
|
||||
- 문서화 확인
|
||||
|
||||
## 검수 결과 형식
|
||||
|
||||
### 승인 시
|
||||
\`\`\`
|
||||
## 검수 결과: ✅ 승인
|
||||
|
||||
### 검증 항목
|
||||
- [x] 백엔드 규정 준수
|
||||
- [x] 프론트엔드 규정 준수
|
||||
- [x] 테스트 통과
|
||||
- [x] 문서화 완료
|
||||
|
||||
### 테스트 결과
|
||||
- 백엔드: X passed
|
||||
- 프론트엔드: Y passed
|
||||
|
||||
### 특이사항
|
||||
- 없음
|
||||
\`\`\`
|
||||
|
||||
### 변경 요청 시
|
||||
\`\`\`
|
||||
## 검수 결과: ❌ 변경 요청
|
||||
|
||||
### 발견된 문제점
|
||||
1. [파일:라인] 문제 설명
|
||||
- 규정: docs/...
|
||||
- 해결: 구체적인 수정 방법
|
||||
|
||||
### 수정 권고사항
|
||||
1. ...
|
||||
|
||||
### 참조 문서
|
||||
- docs/...
|
||||
\`\`\`
|
||||
`;
|
||||
|
||||
try {
|
||||
const result = await coordinator.orchestrate(prompt);
|
||||
|
||||
if (result.success) {
|
||||
workflowLogger.info('PR review completed');
|
||||
} else {
|
||||
workflowLogger.error(`PR review failed: ${result.errors?.join(', ')}`);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
} catch (error: any) {
|
||||
workflowLogger.error(`PR review error: ${error.message}`);
|
||||
return {
|
||||
success: false,
|
||||
steps: [],
|
||||
totalCost: 0,
|
||||
errors: [error.message],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 파일만 검수
|
||||
*/
|
||||
export async function reviewFiles(
|
||||
files: string[],
|
||||
options: { cwd?: string } = {}
|
||||
): Promise<WorkflowResult> {
|
||||
workflowLogger.info(`Reviewing files: ${files.join(', ')}`);
|
||||
|
||||
const coordinator = new Coordinator({
|
||||
cwd: options.cwd,
|
||||
model: 'sonnet',
|
||||
});
|
||||
|
||||
const fileList = files.map(f => `- ${f}`).join('\n');
|
||||
|
||||
const prompt = `
|
||||
다음 파일들을 검수해주세요:
|
||||
|
||||
${fileList}
|
||||
|
||||
## 검수 항목
|
||||
|
||||
각 파일 유형에 맞는 그누보드7 규정 준수 여부를 확인하세요:
|
||||
|
||||
### PHP 파일
|
||||
- validate-code 도구 사용
|
||||
- Service-Repository 패턴
|
||||
- FormRequest 검증
|
||||
- 훅 시스템
|
||||
|
||||
### TSX 파일
|
||||
- validate-frontend 도구 사용
|
||||
- HTML 태그 사용 금지
|
||||
- 다크 모드 클래스
|
||||
- 다국어 처리
|
||||
|
||||
### JSON 레이아웃 파일
|
||||
- validate-frontend 도구 사용
|
||||
- text 속성 사용
|
||||
- 데이터 바인딩 문법
|
||||
- 다국어 키 형식
|
||||
|
||||
## 결과 형식
|
||||
각 파일별로 검수 결과를 정리해주세요.
|
||||
`;
|
||||
|
||||
return coordinator.orchestrate(prompt);
|
||||
}
|
||||
|
||||
export default prReviewWorkflow;
|
||||
Reference in new issue
Block a user