Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 4 additions & 35 deletions .agents/rules/commits.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
# Commit and History Rules
# Commit and history rules

## Commit Units

- 하나의 commit은 하나의 목적만 담고, 독립적으로 리뷰·revert 가능해야 한다.
- 큰 작업도 작은 commit으로 나눈다. 단, 의미 있는 작업 단위가 깨질 정도로 쪼개지 않는다.
- 각 commit 시점에 빌드와 테스트가 통과해야 한다. 일반 게이트는 루트 `AGENTS.md`가 가리키는 `docs/getting-started.md`에 있고, 훅이 이 원칙을 대신 지키지는 않는다.
훅은 이것을 강제하지 않는다 — `pre-commit`은 형식만 보고, `pre-push`는 통합 기준점 대비
변경 범위의 tip만 검사한다(문서만 바꾼 push는 Rust 게이트를 건너뛴다). 따라서 이 항목은
도구가 아니라 작성자가 지키는 규칙이며, 깨지면 `git bisect`가 못 쓰게 된다. 범위 전체를 검증하려면
`NIGHTCROW_VERIFY_EACH_COMMIT=1 git push`.

## Feature-scoped Workflow

- 구현을 먼저 커밋하고 테스트는 별도 commit으로 분리할 수 있다. 단, 인터페이스를 바꿀 때는
인터페이스 정의와 그 contract test를 같은 commit에 넣는다 (`testing.md`의 선행 규칙).
- 기능 단위 간 의존성이 있으면 의존되는 쪽을 먼저 커밋한다.
- 코드와 직접 연결된 문서 변경은 같은 commit 또는 바로 이어지는 commit에 넣는다.

## Message Format

- `type: message` 또는 `type(scope): message`. type은 `feat`, `fix`, `refactor`, `test`, `docs`, `chore`.
- 무엇을 바꿨는지 짧고 구체적으로 쓴다.
- 작업 과정이나 도구 이름을 메시지에 쓰지 않는다
(✗ "codex review 반영", ✗ "리뷰 수정", ✓ "리뷰 중단 기준에 순환 판단 조건 추가").

## History

- 작업이 끝나기 전에도 의미 있는 milestone마다 commit을 남긴다.
- commit history만 읽어도 구현 순서와 의도를 따라갈 수 있어야 한다.
- 나중에 squash할 생각의 임시 잡탕 commit보다 읽히는 history를 우선한다.

## Branch

- 브랜치 네이밍: `type/short-description` (예: `feat/user-auth`, `fix/token-expiry`). type set은 위와 같다.
- 기본 브랜치(`dev`)에 직접 커밋은 문서·설정 등 단순 변경에 한한다.
- Each commit must pass the applicable build and tests independently. The [push hook](../../.githooks/pre-push) normally verifies only the tip, not every intermediate commit.
- Commit interface definitions and their contract tests together. Include related documentation in the same commit or the immediately following commit.
- Direct commits to `dev` are limited to simple documentation or configuration changes.
15 changes: 0 additions & 15 deletions .agents/rules/dependencies.md

This file was deleted.

15 changes: 0 additions & 15 deletions .agents/rules/docs.md

This file was deleted.

41 changes: 5 additions & 36 deletions .agents/rules/guardrails.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,7 @@
# Guardrails

## File Size

- 모든 소스·테스트 파일(Rust, TypeScript, TSX, JavaScript)은 300줄 이하다. 테스트 파일도 예외 없다.
- 200줄 이상은 code smell이며 분할을 검토한다.
- 분할은 동작을 바꾸지 않는 순수 리팩토링이어야 한다. 모듈, 순수 함수, 컴포넌트/훅으로 쪼갠다.
- 생성물(`target/`, `viewer-ui/dist/`)과 벤더링한 서드파티는 제외한다.

## Platforms

- macOS, Linux, Windows 세 곳 모두에서 도는 것을 목표로 한다. 한 곳에서만 도는 코드는 기능이 아니라 미완성이다. CI도 세 OS를 모두 돈다 (`.github/workflows/ci.yml`).
- 플랫폼 분기는 호출부에 흩지 않고 seam 한 곳에 모은다 — 경로·시그널·스레드·로깅은 `src/platform/`, 소켓 타입은 `src/daemon/transport.rs`. 새 분기가 필요하면 seam을 늘리기 전에 기존 것에 들어갈 수 있는지 먼저 본다.
- 한쪽에만 있는 API(`PermissionsExt`, `setsid`, ConPTY 동작 차이)는 대응물을 찾거나 seam 뒤에 감춘다. 대응물이 없어 동작이 달라지면 무엇을 포기했는지 문서에 남긴다.
- 테스트를 `#[cfg(unix)]`로 막는 것은 최후 수단이다. 막는 순간 그 동작은 나머지 플랫폼에서 검증되지 않으므로, 왜 막았는지 주석으로 남긴다.
- Windows에서 작업 중이면 Unix 게이트는 `docker compose run --rm unix-gate`로 돌린다 (`docs/getting-started.md`).

## Architecture

- `docs/architecture.md`가 설계 결정의 기준이다. 구현이 문서와 어긋나면 문서를 먼저 고치거나 구현을 조정한다.

## Code Quality

- 가장 단순한 해결책을 먼저 시도한다. 추상화는 반복이 실제로 발생한 후에 도입한다.
- 하나의 함수/모듈은 하나의 책임만 갖는다.
- 매직 넘버와 하드코딩 문자열은 이름 있는 상수로 뽑는다.
- 코드 내부 주석은 영어로만 작성하고 핵심적인 "why"만 설명한다. 코드·타입·이름만 보고 알 수 있는 동작은 주석으로 반복하지 않는다.

## Error Handling

- 에러는 처리하거나 명시적으로 전파한다. 조용히 삼키지 않는다.
- 에러 메시지에 무엇이 실패했고 입력이 무엇이었는지를 담는다.
- 복구 가능/불가능을 구분하고, 외부 호출 실패는 재시도 여부를 명시적으로 결정한다.

## Externals

- 외부 라이브러리·SDK의 동작이 불확실하면 추측하지 말고 공식 문서와 소스를 직접 확인한다.
- 렌더 루프 등 hot path에서는 할당·복사·변환을 최소화한다. 그 밖의 최적화는 측정 후에 한다.
- Keep Rust, TypeScript, TSX, and JavaScript source and test files at or below 300 lines; generated files and vendored third-party code are exempt.
- Support macOS, Linux, and Windows. Keep platform differences behind the [platform seams](../../docs/architecture.md#cross-cutting-invariants), and document limitations without an equivalent on another platform.
- Record why platform-specific tests exclude other platforms. For Unix verification from Windows, follow [Building and testing](../../docs/getting-started.md#building-and-testing).
- Write code comments in English.
- Handle or propagate errors. Never report external-call failures or malformed/truncated input as success; mark truncated results explicitly, as required by the [resource and error invariants](../../docs/architecture.md#cross-cutting-invariants).
13 changes: 5 additions & 8 deletions .agents/rules/releases.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Release policy

- `origin` is the fork and PR head; `upstream/dev` is the development line; `upstream/main` is the only release line.
- The only supported public series is `0.1.x`. Every application package version must agree, and each official tag must advance the patch by exactly one.
- The only no-tag bootstrap is `0.1.1`. Major and minor changes require an explicit maintainer decision and a policy change reviewed by `@code0xff`.
- Run `node scripts/prepare-release.mjs` for a dry-run. Use `--execute` only on a clean release branch, then review and commit all five version-file changes together. The version itself lives once, in the root manifest's `[workspace.package]`, and every crate inherits it.
- A release preparation PR targets `upstream/dev`. A separate promotion PR targets `upstream/main`; a push to the official `code0xff/nightcrow` `main` creates the tag and Release only after all platform builds and tests pass.
- The release workflow must never publish from a fork, a non-`main` branch, a reused tag pointing at another SHA, or an incomplete asset set. A draft may be resumed only by adding missing files after digest/size checks; published assets are immutable.

The operational runbook is [docs/releasing.md](../../docs/releasing.md). The machine-readable policy is [.github/release-policy.json](../../.github/release-policy.json).
- Support only `0.1.x`, with matching application package versions. The no-tag bootstrap is `0.1.1`; later official tags advance exactly one patch. Major/minor changes require an explicit maintainer decision and a policy change reviewed by `@code0xff`.
- Change versions with [`prepare-release.mjs`](../../scripts/prepare-release.mjs) and commit the related files together. Follow [releasing.md](../../docs/releasing.md) and the machine-readable [release-policy.json](../../.github/release-policy.json).
- Release policy and automation changes require `@code0xff` review under [CODEOWNERS](../../.github/CODEOWNERS).
- Publish only from official `main` after all platform builds and tests pass. Reject other repositories/branches, an existing tag at another SHA, and incomplete asset sets.
- Resume drafts only by adding missing assets after checking existing digests and sizes. Published assets are immutable.
21 changes: 0 additions & 21 deletions .agents/rules/security.md

This file was deleted.

24 changes: 3 additions & 21 deletions .agents/rules/testing.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# Testing

## Which Layer

- 변경 유형에 맞는 테스트를 추가한다: 모듈 간 계약(인터페이스)은 **contract test**, 순수 함수·개별 모듈 로직은 unit test, API endpoint·전체 요청 흐름(web viewer·daemon protocol)은 integration test, 사용자 관점 시나리오는 end-to-end test. 하나의 변경이 여러 유형에 걸치면 각각 작성한다.

## Rules

- contract test를 먼저 갱신하지 않고 인터페이스를 바꾸지 않는다.
- 테스트는 구현 세부사항이 아니라 계약과 동작을 검증한다.
- 성공 경로만이 아니라 실패 경로와 경계 조건(null, empty, 범위 초과, 잘못된 타입)도 명시적으로 테스트한다.
- mock은 외부 시스템 경계에만 쓴다.
- 각 테스트는 독립 실행 가능해야 한다. 테스트 간 상태 공유 금지.
- 테스트 이름은 `무엇을_하면_어떤_결과가_나온다` 패턴으로 의도를 드러낸다.
- 단위 테스트는 구현 파일에 크게 inline하지 않고 sibling `*_tests.rs` 또는 인접 `tests/`로 분리한다. crate 공개 API 통합 테스트는 루트 `tests/`에 둔다.
- TS/TSX 테스트는 sibling `*.test.ts(x)` 파일에 둔다.
- 그 밖의 배치·네이밍은 기존 컨벤션을 따른다. 공유 fixture/helper는 공통 위치에 둔다 (`src/test_util.rs`).

## Flaky Tests

- 실패하면 원인을 먼저 분류한다: 코드 결함 vs 환경/타이밍.
- flaky를 발견하면 즉시 고치거나, 고치기 전까지 skip하고 이슈로 남긴다.
- flaky를 이유로 전체 테스트 결과를 무시하지 않는다.
- Update contract tests before changing interfaces, including failure paths and boundary conditions.
- Keep Rust unit tests in sibling `*_tests.rs` files or adjacent `tests/` directories, crate public-API integration tests in root `tests/`, and TS/TSX tests in sibling `*.test.ts(x)` files.
- Fix flaky tests or temporarily skip them with a linked issue; do not suppress unrelated failures.
61 changes: 0 additions & 61 deletions .agents/skills/_shared/review-protocol.md

This file was deleted.

53 changes: 0 additions & 53 deletions .agents/skills/plan/SKILL.md

This file was deleted.

Loading
Loading