chore: .gitignore에 Python 캐시 및 가상환경 무시 규칙 추가
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"mcpServers": {}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
# GLM-4.7-Flash 코드 작업 규칙 (ExperionCrawler)
|
||||
|
||||
## 필수 준수 사항
|
||||
|
||||
### 작업 전
|
||||
- 반드시 `task_state.md`를 먼저 읽어 진행 상태 파악
|
||||
- 파일 수정 전 반드시 `read_file`로 전체 내용 확인 후 수정
|
||||
|
||||
### 코드 수정 원칙
|
||||
- 요청된 범위만 수정 — 관련 없는 코드 리팩토링 금지
|
||||
- 빌드 검증: 각 파일 수정 후 `dotnet build src/Web/ExperionCrawler.csproj --no-restore -v q` 실행
|
||||
- 빌드 실패 시 즉시 원인 수정 후 재빌드, 다음 항목으로 넘어가지 않음
|
||||
|
||||
### issues.md 작성 형식
|
||||
```
|
||||
| # | 파일 | 심각도 | 분류 | 내용 | 상태 |
|
||||
|---|------|--------|------|------|------|
|
||||
| 1 | src/... | HIGH/MED/LOW | bug/perf/quality/security | 설명 | pending/fixed |
|
||||
```
|
||||
심각도 기준:
|
||||
- HIGH: 런타임 예외, 데이터 손실, 보안 취약점
|
||||
- MED: 성능 저하, 잘못된 동작, 예외 미처리
|
||||
- LOW: 코드 품질, 불필요한 코드, 명명 불일치
|
||||
|
||||
### 클로드 검수를 위한 커밋 규칙
|
||||
- 각 이슈 수정 완료 시: `git add -p` 후 이슈 번호 포함 커밋
|
||||
예: `fix(#3): ExperionDbContext null 참조 예외 방어 처리`
|
||||
- 전체 완료 후 `REVIEW_REQUEST.md` 생성하여 검수 요청
|
||||
|
||||
### MCP 도구 활용
|
||||
- `search_codebase`: 관련 코드 패턴 검색에 적극 활용
|
||||
- `ask_iiot_llm`: IIoT/OPC UA 도메인 판단이 필요할 때 사용
|
||||
|
||||
---
|
||||
|
||||
## [CRITICAL] ASP.NET Core 컨트롤러 JSON 직렬화 규칙
|
||||
|
||||
### 배경 (반드시 숙지)
|
||||
|
||||
`src/Web/Program.cs`에 다음 설정이 있다:
|
||||
```csharp
|
||||
opt.JsonSerializerOptions.PropertyNamingPolicy = null; // PascalCase 그대로 직렬화
|
||||
```
|
||||
|
||||
이로 인해 C# 속성명이 **그대로** JSON 키가 된다.
|
||||
프론트엔드(`app.js`)는 **모든 JSON 필드를 camelCase**로 접근하므로,
|
||||
PascalCase 키가 오면 **모든 값이 `undefined`** 가 된다.
|
||||
|
||||
### 금지 패턴 (절대 사용 금지)
|
||||
|
||||
```csharp
|
||||
// ❌ shorthand 익명 객체 — C# 속성명(PascalCase)이 JSON 키로 그대로 사용됨
|
||||
return Ok(new { x.Id, x.TagName, x.NodeId, x.LiveValue });
|
||||
|
||||
// ❌ typed 객체를 Ok()에 직접 전달 — PascalCase 직렬화됨
|
||||
return Ok(result);
|
||||
return Ok(new MyDto { Id = 1, TagName = "abc" });
|
||||
```
|
||||
|
||||
### 올바른 패턴 (항상 명시적 camelCase 매핑)
|
||||
|
||||
```csharp
|
||||
// ✅ 항상 명시적으로 소문자 키 지정
|
||||
return Ok(new
|
||||
{
|
||||
id = x.Id,
|
||||
tagName = x.TagName,
|
||||
nodeId = x.NodeId,
|
||||
liveValue = x.LiveValue,
|
||||
timestamp = x.Timestamp
|
||||
});
|
||||
|
||||
// ✅ 컬렉션 포함 응답
|
||||
return Ok(new
|
||||
{
|
||||
total = r.Total,
|
||||
items = r.Items.Select(x => new
|
||||
{
|
||||
id = x.Id,
|
||||
tagName = x.TagName,
|
||||
nodeId = x.NodeId
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
### C# 예약어 처리
|
||||
|
||||
`class`는 C# 예약어이므로 `@class`를 사용한다. System.Text.Json이 `"class"`로 정상 직렬화한다:
|
||||
|
||||
```csharp
|
||||
// ✅ @class → JSON "class"
|
||||
return Ok(new { id = x.Id, @class = x.Class, name = x.Name });
|
||||
```
|
||||
|
||||
### 점검 체크리스트
|
||||
|
||||
컨트롤러에서 `Ok(...)` 또는 `return` 사용 시:
|
||||
- [ ] 익명 객체의 모든 키가 소문자(camelCase)인가?
|
||||
- [ ] `new { x.SomeProp }` 형태(shorthand)가 없는가?
|
||||
- [ ] typed record/class를 그대로 반환하지 않는가?
|
||||
- [ ] C# 예약어(`class`, `string` 등)에 `@` 접두사를 붙였는가?
|
||||
@@ -1,97 +0,0 @@
|
||||
# roo-rules.md
|
||||
|
||||
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
|
||||
|
||||
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
|
||||
|
||||
## 1. Think Before Coding
|
||||
|
||||
**Don't assume. Don't hide confusion. Surface tradeoffs.**
|
||||
|
||||
Before implementing:
|
||||
- State your assumptions explicitly. If uncertain, ask.
|
||||
- If multiple interpretations exist, present them - don't pick silently.
|
||||
- If a simpler approach exists, say so. Push back when warranted.
|
||||
- If something is unclear, stop. Name what's confusing. Ask.
|
||||
|
||||
## 2. Simplicity First
|
||||
|
||||
**Minimum code that solves the problem. Nothing speculative.**
|
||||
|
||||
- No features beyond what was asked.
|
||||
- No abstractions for single-use code.
|
||||
- No "flexibility" or "configurability" that wasn't requested.
|
||||
- No error handling for impossible scenarios.
|
||||
- If you write 200 lines and it could be 50, rewrite it.
|
||||
|
||||
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
|
||||
|
||||
## 3. Surgical Changes
|
||||
|
||||
**Touch only what you must. Clean up only your own mess.**
|
||||
|
||||
When editing existing code:
|
||||
- Don't "improve" adjacent code, comments, or formatting.
|
||||
- Don't refactor things that aren't broken.
|
||||
- Match existing style, even if you'd do it differently.
|
||||
- If you notice unrelated dead code, mention it - don't delete it.
|
||||
|
||||
When your changes create orphans:
|
||||
- Remove imports/variables/functions that YOUR changes made unused.
|
||||
- Don't remove pre-existing dead code unless asked.
|
||||
|
||||
The test: Every changed line should trace directly to the user's request.
|
||||
|
||||
## 4. Goal-Driven Execution
|
||||
|
||||
**Define success criteria. Loop until verified.**
|
||||
|
||||
Transform tasks into verifiable goals:
|
||||
- "Add validation" → "Write tests for invalid inputs, then make them pass"
|
||||
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
|
||||
- "Refactor X" → "Ensure tests pass before and after"
|
||||
|
||||
For multi-step tasks, state a brief plan:
|
||||
```
|
||||
1. [Step] → verify: [check]
|
||||
2. [Step] → verify: [check]
|
||||
3. [Step] → verify: [check]
|
||||
```
|
||||
|
||||
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
|
||||
|
||||
## 5. Save the token & time - Roo code must keep this rule not API
|
||||
- "Do not summarize the code or changes after completing a task"
|
||||
- "Once the code is written, do not repeat the explanation"
|
||||
- "Only output the final file content if necessary"
|
||||
|
||||
## 6. Backup + Diff Before Edit
|
||||
|
||||
**기존 파일을 수정하기 전에 반드시 다음 두 단계를 수행할 것.**
|
||||
|
||||
### Step 1 — 백업
|
||||
수정 대상 파일을 `.rooBackup/` 폴더에 현재날짜와 시간으로 폴더를 만들고 그 폴더에 수정전 원본 그대로 저장한다.
|
||||
|
||||
- 저장 경로: `.rooBackup/<날짜-시간>/<원본경로>/<파일명>`
|
||||
- 예: `src/Web/wwwroot/js/app.js` → `.rooBackup/src/Web/wwwroot/js/app.js`
|
||||
- 백업 후 "백업 완료: `.rooBackup/...`" 를 출력할 것
|
||||
|
||||
### Step 2 — Diff 제시
|
||||
변경 내용을 diff 형식으로 보여주고, 사용자 확인 후 실제 수정 진행.
|
||||
|
||||
```diff
|
||||
- 기존 코드
|
||||
+ 변경된 코드
|
||||
```
|
||||
|
||||
변경 이유를 한 줄로 함께 설명할 것.
|
||||
|
||||
### 예외 (백업/diff 생략 가능)
|
||||
- 신규 파일 생성
|
||||
- 공백/포맷팅만 바뀌는 경우
|
||||
|
||||
**위반 사례 (금지):** 백업·diff 없이 바로 파일을 덮어쓰는 것 — roo가 이전에 fastRecord 섹션 전체를 날린 것이 이 케이스에 해당.
|
||||
|
||||
---
|
||||
|
||||
**These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes.
|
||||
Reference in New Issue
Block a user