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:
commit
8808c672dc
135 changed files with 38838 additions and 0 deletions
177
packages/cli/src/index.ts
Normal file
177
packages/cli/src/index.ts
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
import { ADAPTERS, type Scope, type TargetId } from "@designpaca/core";
|
||||
import { getVersion } from "./skill.ts";
|
||||
import { checkForUpdate } from "./update-check.ts";
|
||||
import { printNextSteps, printOutcomes, runInstall } from "./commands/install.ts";
|
||||
import { runDoctor } from "./commands/doctor.ts";
|
||||
import { runUpdate } from "./commands/update.ts";
|
||||
import { runUninstall } from "./commands/uninstall.ts";
|
||||
import { runList } from "./commands/list.ts";
|
||||
import { onboard } from "./tui/onboard.ts";
|
||||
import { accent, bad, bold, dim, warn } from "./ui.ts";
|
||||
|
||||
const VALID_TARGETS = ADAPTERS.map((a) => a.id) as string[];
|
||||
|
||||
interface Args {
|
||||
command: string;
|
||||
targets: TargetId[];
|
||||
scope: Scope;
|
||||
yes: boolean;
|
||||
force: boolean;
|
||||
dryRun: boolean;
|
||||
help: boolean;
|
||||
version: boolean;
|
||||
}
|
||||
|
||||
function parse(argv: string[]): Args {
|
||||
const out: Args = {
|
||||
command: "",
|
||||
targets: [],
|
||||
scope: "user",
|
||||
yes: false,
|
||||
force: false,
|
||||
dryRun: false,
|
||||
help: false,
|
||||
version: false,
|
||||
};
|
||||
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const a = argv[i] as string;
|
||||
if (a === "--help" || a === "-h") out.help = true;
|
||||
else if (a === "--version" || a === "-v") out.version = true;
|
||||
else if (a === "--yes" || a === "-y") out.yes = true;
|
||||
else if (a === "--force" || a === "-f") out.force = true;
|
||||
else if (a === "--dry-run") out.dryRun = true;
|
||||
else if (a === "--no-update-check") process.env["DESIGNPACA_NO_UPDATE_CHECK"] = "1";
|
||||
else if (a === "--target" || a === "-t") {
|
||||
const v = argv[++i];
|
||||
if (v) out.targets.push(...(v.split(",") as TargetId[]));
|
||||
} else if (a.startsWith("--target=")) {
|
||||
out.targets.push(...(a.slice(9).split(",") as TargetId[]));
|
||||
} else if (a === "--scope" || a === "-s") {
|
||||
const v = argv[++i];
|
||||
if (v) out.scope = v as Scope;
|
||||
} else if (a.startsWith("--scope=")) {
|
||||
out.scope = a.slice(8) as Scope;
|
||||
} else if (!a.startsWith("-") && !out.command) {
|
||||
out.command = a;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function usage(version: string): string {
|
||||
return `
|
||||
${accent("designpaca")} ${dim(`v${version}`)} — 웹 디자인 파이프라인 스킬 설치기
|
||||
|
||||
${bold("사용법")}
|
||||
npx designpaca 대화형 온보딩 (권장)
|
||||
npx designpaca install 설치
|
||||
npx designpaca update 최신 스킬로 갱신
|
||||
npx designpaca uninstall 제거
|
||||
npx designpaca doctor 설치 상태 진단
|
||||
npx designpaca list 설치 가능 대상과 현재 설치 목록
|
||||
|
||||
${bold("옵션")}
|
||||
-t, --target <id[,id]> 설치 대상: ${VALID_TARGETS.join(", ")}
|
||||
-s, --scope <범위> user | project ${dim("(기본: user)")}
|
||||
-y, --yes 확인 없이 진행
|
||||
-f, --force 직접 수정한 파일도 덮어쓴다 ${dim("(.orig 로 백업)")}
|
||||
--dry-run 쓰지 않고 계획만 출력
|
||||
--no-update-check 새 버전 확인을 건너뛴다
|
||||
-h, --help 이 도움말
|
||||
-v, --version 버전
|
||||
|
||||
${bold("예시")}
|
||||
${dim("npx designpaca install -t claude-code,codex -s user -y")}
|
||||
${dim("npx designpaca install -t cursor -s project")}
|
||||
${dim("npx designpaca update --force")}
|
||||
`.trimStart();
|
||||
}
|
||||
|
||||
async function main(): Promise<number> {
|
||||
const args = parse(process.argv.slice(2));
|
||||
const version = await getVersion();
|
||||
|
||||
if (args.version) {
|
||||
console.log(version);
|
||||
return 0;
|
||||
}
|
||||
if (args.help) {
|
||||
console.log(usage(version));
|
||||
return 0;
|
||||
}
|
||||
|
||||
const bad_ = args.targets.filter((t) => !VALID_TARGETS.includes(t));
|
||||
if (bad_.length > 0) {
|
||||
console.error(bad(`알 수 없는 대상: ${bad_.join(", ")}`));
|
||||
console.error(dim(` 가능한 값: ${VALID_TARGETS.join(", ")}`));
|
||||
return 2;
|
||||
}
|
||||
if (args.scope !== "user" && args.scope !== "project") {
|
||||
console.error(bad(`알 수 없는 범위: ${args.scope} (user | project)`));
|
||||
return 2;
|
||||
}
|
||||
|
||||
// 대화형으로 쓸 수 있는 환경이면 인자 없이 실행했을 때 온보딩으로 보낸다
|
||||
const interactive = process.stdout.isTTY && !args.yes;
|
||||
if (!args.command || args.command === "onboard") {
|
||||
if (interactive) return onboard();
|
||||
console.log(usage(version));
|
||||
return 0;
|
||||
}
|
||||
|
||||
let code = 0;
|
||||
switch (args.command) {
|
||||
case "install": {
|
||||
const targets = args.targets.length > 0 ? args.targets : (["claude-code"] as TargetId[]);
|
||||
if (interactive && args.targets.length === 0) return onboard();
|
||||
const outcomes = await runInstall({
|
||||
targets,
|
||||
scope: args.scope,
|
||||
force: args.force,
|
||||
dryRun: args.dryRun,
|
||||
});
|
||||
printOutcomes(outcomes, args.dryRun);
|
||||
if (!args.dryRun) printNextSteps(targets);
|
||||
code = outcomes.some((o) => o.blocked) ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
case "update":
|
||||
code = await runUpdate({ force: args.force });
|
||||
break;
|
||||
case "uninstall":
|
||||
case "remove":
|
||||
code = await runUninstall({ targets: args.targets, force: args.force });
|
||||
break;
|
||||
case "doctor":
|
||||
code = await runDoctor();
|
||||
break;
|
||||
case "list":
|
||||
case "ls":
|
||||
code = await runList();
|
||||
break;
|
||||
default:
|
||||
console.error(bad(`알 수 없는 명령: ${args.command}`));
|
||||
console.log(usage(version));
|
||||
return 2;
|
||||
}
|
||||
|
||||
// 명령을 마친 뒤에만 알린다 — 시작을 지연시키지 않는다
|
||||
const latest = await checkForUpdate(version);
|
||||
if (latest) {
|
||||
console.log(
|
||||
"\n" + warn(`새 버전 ${bold(`v${latest}`)} 이 있다 — ${dim("npx designpaca@latest update")}`),
|
||||
);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
main()
|
||||
.then((code) => {
|
||||
process.exitCode = code;
|
||||
})
|
||||
.catch((err: unknown) => {
|
||||
console.error(bad(err instanceof Error ? err.message : String(err)));
|
||||
if (process.env["DESIGNPACA_DEBUG"] === "1" && err instanceof Error) console.error(err.stack);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue