57 lines
2.9 KiB
Markdown
57 lines
2.9 KiB
Markdown
---
|
|
name: gitea-repository-cache-bootstrap
|
|
description: 새 Gitea repository cache를 안전하게 초기화한다.
|
|
version: 0.1.0
|
|
author: genichin, Hermes Agent
|
|
license: MIT
|
|
platforms: [linux]
|
|
metadata:
|
|
hermes:
|
|
tags: [gitea, repository, cache, bootstrap]
|
|
related_skills: []
|
|
---
|
|
|
|
# Gitea Repository Cache Bootstrap
|
|
|
|
새 Gitea repository cache를 생성하거나 기존 cache가 초기화됐는지 검증한다. 모든 경로, lock, Git 및 credential 규칙은 [Repository cache 운영 지침](../../../../operations/repository-cache.md)만 정본으로 사용하며 이 스킬에 복제하거나 완화하지 않는다.
|
|
|
|
## 사용 시점
|
|
|
|
- `/opt/data/gitea-agent/repositories/<owner>/<repository>/repository.git`이 없을 때
|
|
- 정확한 `owner/repository`의 cache 초기화를 요청받았을 때
|
|
- 기존 cache가 해당 Gitea repository의 유효한 bare mirror인지 확인할 때
|
|
|
|
Issue 본문 변경, comment 작성, checkout, worktree 생성 또는 source 수정에는 사용하지 않는다.
|
|
|
|
## 절차
|
|
|
|
1. `read_file`로 linked canonical 문서 `operations/repository-cache.md`를 새로 읽는다.
|
|
2. 요청에서 exact `owner/repository`를 추출하고 canonical 지침의 identifier·path 검증을 수행한다.
|
|
3. Gitea MCP로 authenticated role, exact repository metadata, clone URL, default branch와 SHA를 읽는다.
|
|
4. canonical bootstrap lock을 획득하고 target 상태를 다시 확인한다.
|
|
5. target이 없으면 canonical 신규 cache 초기화 절차를 그대로 수행한다. target이 있으면 삭제하거나 덮어쓰지 않고 canonical 기존 cache 검증 절차를 수행한다.
|
|
6. final target을 새로 읽어 path safety, bare 상태, remote identity, default branch와 SHA를 검증한다.
|
|
7. credential helper와 현재 run의 staging이 남지 않았는지 확인하고 lock을 역순으로 해제한다.
|
|
8. local 결과와 Gitea authoritative evidence를 분리해 보고한다.
|
|
|
|
## 실패 처리
|
|
|
|
- canonical 지침을 읽을 수 없거나 대상이 불명확하면 아무것도 생성하지 않는다.
|
|
- malformed, symlink, identity drift 또는 SHA drift 상태를 자동 수정하지 않는다.
|
|
- clone/fetch 결과가 불확실하면 completed로 보고하지 않는다.
|
|
- 현재 run 소유임을 증명할 수 없는 staging이나 target을 삭제하지 않는다.
|
|
- credential을 inherited environment나 다른 role에서 fallback하지 않는다.
|
|
|
|
## 검증
|
|
|
|
완료 전에 다음을 모두 확인한다.
|
|
|
|
- 현재 작업에서 `operations/repository-cache.md`를 읽었다.
|
|
- Gitea identity와 exact repository metadata가 확인됐다.
|
|
- final `repository.git`이 bare mirror다.
|
|
- remote identity가 exact `owner/repository`와 일치한다.
|
|
- Gitea와 local default-branch SHA가 일치한다.
|
|
- final path의 유형, ownership과 permissions가 canonical 지침을 충족한다.
|
|
- staging, credential helper와 획득한 advisory lock이 남지 않았다.
|
|
- Gitea external write가 발생하지 않았다.
|