designpaca/packages/cli/test/cli.test.ts
Yun Chan 8808c672dc 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)
2026-08-20 10:48:00 +09:00

70 lines
2.5 KiB
TypeScript

import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { after, test } from "node:test";
const CLI = fileURLToPath(new URL("../dist/index.js", import.meta.url));
const built = await fs
.access(CLI)
.then(() => true)
.catch(() => false);
const home = await fs.mkdtemp(path.join(os.tmpdir(), "designpaca-cli-"));
after(async () => {
await fs.rm(home, { recursive: true, force: true });
});
/** 빌드 산출물을 사용자가 실행하는 방식 그대로 돌린다 */
function run(args: string[]): string {
return execFileSync(process.execPath, [CLI, ...args, "--no-update-check"], {
encoding: "utf8",
env: { ...process.env, HOME: home, USERPROFILE: home, FORCE_COLOR: "0" },
});
}
test("빌드 산출물이 있어야 한다", { skip: built ? false : "pnpm build 먼저 실행해라" }, () => {
assert.ok(built);
});
test("--version 은 스킬 버전과 같다", { skip: !built }, async () => {
const stamp = (
await fs.readFile(fileURLToPath(new URL("../dist/skill/.designpaca_version", import.meta.url)), "utf8")
).trim();
assert.equal(run(["--version"]).trim(), stamp);
});
test("도움말에 모든 명령이 나온다", { skip: !built }, () => {
const out = run(["--help"]);
for (const cmd of ["install", "update", "uninstall", "doctor", "list"]) {
assert.ok(out.includes(cmd), `도움말에 ${cmd} 가 없다`);
}
});
test("dry-run 은 아무 파일도 쓰지 않는다", { skip: !built }, async () => {
const before = await fs.readdir(home);
const out = run(["install", "-t", "claude-code", "-s", "user", "-y", "--dry-run"]);
assert.ok(out.includes("설치 계획"));
assert.deepEqual(await fs.readdir(home), before);
});
test("알 수 없는 대상은 종료 코드 2 로 거부한다", { skip: !built }, () => {
assert.throws(
() => run(["install", "-t", "emacs", "-y"]),
(err: { status?: number }) => err.status === 2,
);
});
test("설치 → doctor → 제거 왕복", { skip: !built }, async () => {
run(["install", "-t", "claude-code", "-s", "user", "-y"]);
const skillMd = path.join(home, ".claude", "skills", "designpaca", "SKILL.md");
assert.ok((await fs.readFile(skillMd, "utf8")).includes("name: designpaca"));
assert.ok(run(["doctor"]).includes("claude-code"));
run(["uninstall", "-y"]);
await assert.rejects(() => fs.access(skillMd));
});