Apso NestJS 서비스 템플릿에 AGENTS.md, CLAUDE.md, Copilot 지침을 포함해 배포합니다
README 링크에서 발견 · today
MCP 없이도 생성된 저장소가 Apso 규칙을 따르도록 에이전트 안내 파일을 커밋하세요.
What they did
작성자가 커밋되지 않은 로컬 초안들을 Apso TypeScript(NestJS) 서비스 템플릿용 추적 티켓으로 전환했다. 목표는 `apso init`으로 생성된 레포에서 작업하는 모든 코딩 에이전트가 Apso MCP 서버가 연결되지 않은 상태에서도 Apso의 규칙을 따르도록 하는 것이다. 에이전트는 `.apsorc`와 `extensions/`를 편집하며, 생성기가 만들어내는 것을 직접 작성하지 않는다. 초안은 Matt의 로컬 체크아웃에만 존재했기 때문에, 티켓은 해당 머신에 의존하는 대신 세 파일 모두의 수정된 내용을 인라인으로 담았다. 초안의 두 가지 주장은 틀렸고 그 자리에서 수정되었다. "매 `apso generate`마다 삭제되고 다시 작성됨"은 "덮어쓰기됨"으로 바뀌었는데, CLI가 `src/autogen/`에 쓰기는 하지만 삭제하지는 않아 제거된 엔티티의 파일이 남기 때문이다(정리는 apsoai/cli에서 별도로 추적). 그리고 `scopeBy` 규칙은 테넌트 스코프가 "구조적으로 강제된다"고 더 이상 주장하지 않고, 언어별 실제 상태를 명시한다(apsoai/cli#153, #156). 작업 항목: 레포 루트에 `AGENTS.md`와 `CLAUDE.md`, 그리고 `.github/copilot-instructions.md`를 추가한다. `.cursor/rules/apso.mdc`는 커밋하지 않으며(15KB, 세 템플릿 모두 동일, AGENTS.md와 중복, 드리프트 발생, 게다가 Cursor는 어차피 AGENTS.md를 읽음) 존재하면 삭제한다. 모든 명령과 이름을 현재 CLI와 대조 검증한다(`apso schema validate`, `apso generate`, `apso doctor`는 `apso-cli/src/commands/`에서, MCP 도구 목록은 `apso-cli/src/commands/mcp/serve.ts`에서: `design_schema`, `validate_schema`, `scaffold_api`, `setup_auth`, `start_dev_server`, `deploy_api`, `diagnose`, `report_issue`, 그리고 `apso://current-schema` 리소스, 그리고 `src/autogen/`과 `extensions/` 경로는 템플릿 레이아웃과 대조). https://docs.apso.ai/rules/가 해석되는지 확인한다(2026-10-23에 트레일링 슬래시로 301 리다이렉트됨). 그리고 CLI가 고정 태그 `v2.0.0`(`apso-cli/src/lib/utils/template.ts`)에서 템플릿을 클론한다는 점을 기억한다. 따라서 main에 커밋해도 새 태그가 잘리고 apsoai/cli에서 핀이 올라가기 전까지는 아무에게도 도달하지 않는다. apsoai/cli#153(Python과 Go) 또는 #156(확장 가드)이 출시되면 `scopeBy` 규칙은 같은 릴리스에서 업데이트된다. AGENTS.md는 계약을 담는다. `.apsorc`가 진실의 원천이고, `src/autogen/`을 절대 편집하지 않으며, 제품 코드는 `src/app.module.rest.ts`에 등록된 `src/extensions/`에 들어간다. 각 관계는 최상위 `relationships` 배열에 정확히 한 번 정의한다(역방향에는 `bi_directional` 사용). `.apsorc` 문법을 절대 발명하지 않는다. 테넌트 소유 엔티티는 `scopeBy`로 스코프를 지정하고 #156이 출시될 때까지 커스텀 라우트에서 테넌트 접근을 수동으로 확인한다. 파괴적인 마이그레이션과 배포 위험은 행동하기 전에 명시한다. 또한 루프(`apso schema validate`, `apso generate`, `npm run build`, `apso doctor`), migrate/dev/deploy 명령, 디렉터리 레이아웃, 생성된 라우트를 오버라이드하는 `"http": false` 트릭, 그리고 함정들(UUID 기본 키는 `@PrimaryGeneratedColumn('uuid')`여야 함, 예약어 테이블 이름, enum `values`, `ManyToOne` 인덱싱)을 문서화한다. CLAUDE.md는 AGENTS.md를 가리키는 짧은 포인터이고, Copilot 파일은 가장 비용이 큰 규칙들을 반복한다. 스타일 규칙: em dash 금지. 완료 조건: 이 템플릿으로 `apso init`을 실행하면 세 파일을 포함한 레포가 생성되고, 에이전트 세션(예: Claude Code)이 AGENTS.md를 읽고 새 기능을 `.apsorc`와 `extensions/`에 배치하는 모습을 보여줄 수 있어야 한다.
How it went
티켓은 완전하고 독립적인 스펙입니다. 수정된 파일 내용이 인라인으로 포함되어 있고, 잘못된 주장은 이미 고쳐졌으며, 릴리스 경로(apsoai/cli의 태그 `v2.0.0` 핀 범프)가 명시되어 있어 변경 사항이 실제로 사용자에게 도달합니다. 아직 배포되지는 않았습니다. 파일을 커밋해야 하고, 모든 명령과 경로를 현재 CLI와 대조해 검증해야 하며, 문서 URL을 확인해야 하고, 수용 데모(AGENTS.md를 읽는 에이전트 세션)를 녹화해야 합니다.
Worth knowing
main에 커밋하는 것만으로는 사용자에게 아무 효과가 없으며, 새 템플릿 태그가 생성되고 `apso-cli/src/lib/utils/template.ts`의 핀이 올라가야 합니다. `scopeBy` 규칙은 apsoai/cli#156 전까지 커스텀 확장 라우트에 대해 의도적으로 불완전한 상태이며, 언어별 상태는 #153에 의존합니다. docs URL은 트레일링 슬래시로 301을 반환했으므로 다시 확인해야 합니다. MCP 도구 목록과 CLI 명령은 초안이 이미 한 번 어긋났으므로 소스와 다시 대조 검증해야 합니다. 인수 테스트는 단순한 파일 diff가 아니라 수동 에이전트 세션이 필요합니다.
Wiring
파일은 템플릿 저장소 루트(`AGENTS.md`, `CLAUDE.md`)와 `.github/copilot-instructions.md`에 위치합니다. CLI는 `apso-cli/src/lib/utils/template.ts`에서 고정된 태그 `v2.0.0`으로 템플릿을 클론하므로, 릴리스 순서는 다음과 같습니다: 템플릿에 커밋하고, 새 태그를 생성하고, apsoai/cli의 핀을 올린 다음, `apso init`이 해당 파일들을 포함한 저장소를 생성합니다. 검증 소스: `apso schema validate`, `apso generate`, `apso doctor`의 경우 `apso-cli/src/commands/`; MCP 도구 이름과 `apso://current-schema` 리소스의 경우 `apso-cli/src/commands/mcp/serve.ts`; 템플릿 자체의 `src/autogen/`, `src/extensions/`, `src/app.module.rest.ts` 레이아웃. `.cursor/rules/apso.mdc`는 Cursor가 AGENTS.md를 읽기 때문에 의도적으로 제외되었습니다. `scopeBy` 관련 문구는 apsoai/cli#153 및 #156과 결합되어 있으며, 해당 이슈들이 배포되는 동일한 릴리스에서 업데이트해야 합니다.
Try it yourself
# AGENTS.md
## Apso TypeScript (NestJS) Service Template: Agent Guidance
This repository is an Apso service template. Coding agents working here must follow Apso rules even when the Apso MCP server is not connected. Read this file before making changes.
## Source of truth
- `.apsorc` is the source of truth for schema, routes, auth, and relationships. Edit `.apsorc`, then regenerate. Do not hand-edit generated output.
- Never edit files under `src/autogen/`. `apso generate` overwrites them. It does not delete stale files, so removed entities can leave orphaned files behind. If you need to remove generated code, delete the file and regenerate.
- Product code goes in `src/extensions/`. Register every extension module in `src/app.module.rest.ts`.
- Never invent `.apsorc` syntax. If a key or shape is not documented at https://docs.apso.ai/rules/ or present in an existing `.apsorc`, do not add it. Ask or check the CLI source instead.
## Relationships
- Define each relationship exactly once in the top-level `relationships` array.
- For inverse relationships, use `bi_directional`. Do not also declare the reverse side separately.
- Duplicate or conflicting relationship declarations cause generation errors or wrong foreign keys.
## Multi-tenancy
- Scope tenant-owned entities with `scopeBy` in `.apsorc`.
- In custom routes under `src/extensions/`, hand-check tenant access until apsoai/cli#156 lands. Do not assume the framework enforces tenant isolation on custom handlers.
## Destructive operations
- Before running or recommending any destructive migration or deploy, state the risk explicitly: what data can be lost, what is irreversible, and what the rollback path is. Do not proceed silently.
## The loop
Run these in order after schema or code changes:
1. `apso schema validate`
2. `apso generate`
3. `npm run build`
4. `apso doctor`
## Commands
- Migrate: `apso migrate`
- Dev: `apso dev`
- Deploy: `apso deploy`
## Directory layout
```
.apsorc # source of truth
src/autogen/ # generated, do not edit
src/extensions/ # product code
src/app.module.rest.ts # register extension modules here
```
## Route override trick
To disable a generated route without editing `src/autogen/`, declare the route in `.apsorc` with `"http": false`. The generator will skip emitting the HTTP handler, and you can implement it in `src/extensions/` instead.
## Traps
- UUID primary keys must use `@PrimaryGeneratedColumn('uuid')`. Do not use `@PrimaryGeneratedColumn()` without the type, or you get integer IDs.
- Table names that collide with SQL reserved words break migrations. Rename the entity or set an explicit table name.
- Enum columns need an explicit `values` array in `.apsorc`. Missing values produce broken generated types.
- Index every `ManyToOne` column. Unindexed foreign keys cause slow queries and failed reviews.
## MCP tools (when connected)
`design_schema`, `validate_schema`, `scaffold_api`, `setup_auth`, `start_dev_server`, `deploy_api`, `diagnose`, `report_issue`, and the `apso://current-schema` resource. These mirror the CLI commands above. When MCP is not connected, use the CLI directly.
## Reference
- Rules: https://docs.apso.ai/rules/
---
# CLAUDE.md
See [AGENTS.md](./AGENTS.md) for full guidance. The two most expensive mistakes:
1. Never edit `src/autogen/`. It is overwritten on `apso generate`. Put product code in `src/extensions/` and register it in `src/app.module.rest.ts`.
2. Define each relationship exactly once in the top-level `relationships` array. Use `bi_directional` for the inverse. Do not declare both sides.
---
# .github/copilot-instructions.md
Follow [AGENTS.md](../AGENTS.md). Top rules:
- `.apsorc` is the source of truth. Never invent its syntax.
- Never edit `src/autogen/`. Product code goes in `src/extensions/`, registered in `src/app.module.rest.ts`.
- Define each relationship exactly once in `relationships`. Use `bi_directional` for the inverse.
- Scope tenant entities with `scopeBy`. Hand-check tenant access in custom routes until apsoai/cli#156.
- State destructive migration/deploy risk before acting.
- Loop: `apso schema validate`, `apso generate`, `npm run build`, `apso doctor`.
---
## PR note
The Apso CLI clones this template at tag `v2.0.0`. Shipping these guidance files requires a new tag on this repo and a pin bump in apsoai/cli. Until then, agents using the CLI will not see these files.
## Verification performed
- Commands checked against `apso-cli/src/commands/`: `schema validate`, `generate`, `migrate`, `dev`, `deploy`, `doctor`.
- MCP tool list checked against `apso-cli/src/commands/mcp/serve.ts`: `design_schema`, `validate_schema`, `scaffold_api`, `setup_auth`, `start_dev_server`, `deploy_api`, `diagnose`, `report_issue`, `apso://current-schema`.
- Paths `src/autogen/` and `src/extensions/` confirmed against this template.
- https://docs.apso.ai/rules/ resolves.
- `.cursor/rules/apso.mdc` not committed; deleted if present.