designpaca 초기 구현 — 스킬 · 설치 CLI · 배포 파이프라인

웹 디자인 파이프라인 스킬과 이를 5개 에이전트에 설치하는 CLI 를 담은 모노레포.

스킬 (packages/skill)
- SKILL.md 261줄 + 참조 문서 16개 3,349줄. progressive disclosure 로
  본문은 절차와 인덱스만, 지식은 references/ 로 분리
- 0~6단계 파이프라인. 규모에 따라 전체·연장·국소 세 경로로 분기
- 하드 게이트 12개는 grep·카운트로 검증 가능한 것만. 취향 판단은 제외
- 미학 프리셋 5종, AI 슬롭 지문 목록, 한글 조판 규칙,
  SVG 필터·three.js·인터랙티브 모션·HTML-in-Canvas 실전 지침

설치 CLI (packages/cli, packages/core)
- npx designpaca 온보딩 TUI. Claude Code · Codex · Cursor · Windsurf · AGENTS.md
- 매니페스트에 설치 시점 해시를 기록해 사용자가 고친 파일은 update 가 건너뛴다
- 타깃별로 본문의 references/ 경로를 실제 설치 위치로 재작성
- AGENTS.md 는 항상 로드되므로 본문 대신 303자 포인터만 주입
- Windsurf 는 12,000자 상한 초과 시 설치를 차단

배포 (build/ci, .forgejo/workflows)
- 태그 v* → 검사·테스트·빌드 → npmjs 배포 + Forgejo 레지스트리 미러
  → draft 릴리스 → Cloudflare Pages. 재실행 멱등

근거 (research/)
- 약 250개 웹 소스 조사 결과와 도그푸딩 검증 2건. 스킬의 모든 수치는 여기서 나온다

테스트 22개 통과 (core 16 · cli 6)
This commit is contained in:
Yun Chan 2026-08-20 10:48:00 +09:00
commit 8808c672dc
135 changed files with 38838 additions and 0 deletions

View file

@ -0,0 +1,105 @@
import fs from "node:fs/promises";
import path from "node:path";
import { manifestPath } from "./paths.ts";
import { readIfExists, sha256, writeAtomic } from "./fsx.ts";
import { extractBlock } from "./marker.ts";
import type { DriftReport, InstallRecord, Manifest, Scope, TargetId } from "./types.ts";
const EMPTY: Manifest = { schema: 1, installs: [] };
export async function readManifest(home?: string): Promise<Manifest> {
const raw = await readIfExists(manifestPath(home));
if (!raw) return structuredClone(EMPTY);
try {
const parsed = JSON.parse(raw) as Manifest;
if (parsed.schema !== 1 || !Array.isArray(parsed.installs)) return structuredClone(EMPTY);
return parsed;
} catch {
// 손상된 매니페스트로 설치 전체가 막히지 않도록 빈 것으로 되돌린다
return structuredClone(EMPTY);
}
}
export async function writeManifest(m: Manifest, home?: string): Promise<void> {
await writeAtomic(manifestPath(home), JSON.stringify(m, null, 2) + "\n");
}
function sameInstall(a: InstallRecord, target: TargetId, scope: Scope, root: string): boolean {
return a.target === target && a.scope === scope && path.resolve(a.root) === path.resolve(root);
}
export function findInstall(
m: Manifest,
target: TargetId,
scope: Scope,
root: string,
): InstallRecord | undefined {
return m.installs.find((i) => sameInstall(i, target, scope, root));
}
export async function upsertInstall(record: InstallRecord, home?: string): Promise<void> {
const m = await readManifest(home);
const idx = m.installs.findIndex((i) => sameInstall(i, record.target, record.scope, record.root));
if (idx >= 0) m.installs[idx] = record;
else m.installs.push(record);
await writeManifest(m, home);
}
export async function dropInstall(
target: TargetId,
scope: Scope,
root: string,
home?: string,
): Promise<void> {
const m = await readManifest(home);
m.installs = m.installs.filter((i) => !sameInstall(i, target, scope, root));
await writeManifest(m, home);
}
/**
* 설치 당시 해시와 현재 내용을 비교한다.
* 마커 방식 파일은 문서 전체가 아니라 블록 안쪽만 비교한다 — 사용자가 문서의 다른 부분을
* 고치는 것은 정상이고, 그걸 드리프트로 잡으면 update 가 영영 못 돈다.
*/
export async function inspectDrift(record: InstallRecord): Promise<DriftReport> {
const files: DriftReport["files"] = [];
for (const f of record.files) {
const cur = await readIfExists(f.path);
if (cur === null) {
files.push({ path: f.path, status: "missing" });
continue;
}
const target = f.marker ? (extractBlock(cur, f.marker) ?? "") : cur;
files.push({ path: f.path, status: sha256(target) === f.sha256 ? "ok" : "modified" });
}
return {
record,
files,
modified: files.filter((f) => f.status === "modified").map((f) => f.path),
};
}
/** 매니페스트가 가리키는 경로가 실제로 살아있는지 확인한다 */
export async function pruneDeadInstalls(home?: string): Promise<number> {
const m = await readManifest(home);
const before = m.installs.length;
const alive: InstallRecord[] = [];
for (const rec of m.installs) {
const anyAlive = await Promise.all(
rec.files.map(async (f) => {
try {
await fs.access(f.path);
return true;
} catch {
return false;
}
}),
);
if (anyAlive.some(Boolean)) alive.push(rec);
}
if (alive.length !== before) {
m.installs = alive;
await writeManifest(m, home);
}
return before - alive.length;
}