@eliceio/cdk-cli 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -38
- package/es/cli.js +35 -2
- package/es/commands/create/index.js +2 -2
- package/es/commands/dev/index.d.ts +8 -3
- package/es/commands/dev/index.js +72 -3
- package/es/commands/doctor/index.d.ts +1 -1
- package/es/commands/doctor/index.js +10 -13
- package/es/commands/setup/index.d.ts +1 -1
- package/es/commands/setup/index.js +4 -3
- package/es/commands/uninstall/index.d.ts +1 -1
- package/es/commands/uninstall/index.js +7 -30
- package/es/core/config.d.ts +2 -2
- package/es/core/config.js +2 -2
- package/es/core/skills.d.ts +22 -4
- package/es/core/skills.js +89 -17
- package/es/dev/browser.d.ts +22 -0
- package/es/dev/browser.js +105 -0
- package/es/dev/check.d.ts +84 -0
- package/es/dev/check.js +326 -0
- package/es/dev/host-page.js +10 -0
- package/es/dev/mock-api.js +1 -1
- package/es/dev/server.d.ts +2 -0
- package/es/dev/server.js +1 -0
- package/es/rules/check.js +1 -1
- package/es/rules/manifest.d.ts +1 -1
- package/es/rules/manifest.js +2 -2
- package/es/test-old-skill.d.ts +5 -0
- package/package.json +3 -2
- package/skills/_shared/always.md +13 -5
- package/skills/{elice-content-guide/topics → _shared/references}/00-what-the-person-decides.md +2 -2
- package/skills/{elice-content-guide/topics → _shared/references}/02-design-the-material.md +13 -4
- package/skills/{elice-content-guide/topics → _shared/references}/03-create-the-project.md +2 -2
- package/skills/_shared/references/05-screen-code.md +169 -0
- package/skills/{elice-content-guide/topics → _shared/references}/06-using-the-quiz-template.md +4 -3
- package/skills/{elice-content-guide/topics → _shared/references}/07-move-existing-html.md +1 -1
- package/skills/_shared/references/08-fix-check-errors.md +28 -0
- package/skills/_shared/references/09-check.md +29 -0
- package/skills/_shared/references/10-build.md +8 -0
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +83 -0
- package/skills/elice-content-check/SKILL.md +7 -9
- package/skills/elice-content-create/SKILL.md +12 -10
- package/skills/elice-content-migrate/SKILL.md +10 -8
- package/skills/elice-content-publish/SKILL.md +10 -8
- package/templates/_shared/lib/cdk-mock.d.ts +1 -1
- package/templates/_shared/lib/cdk-mock.js +2 -2
- package/templates/_shared/lib/elice-content.css +1 -1
- package/templates/_shared/lib/elice-content.d.ts +1 -1
- package/templates/_shared/lib/elice-content.js +35 -18
- package/templates/blank/README.md +24 -21
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/template.json +1 -1
- package/templates/quiz/README.md +8 -7
- package/templates/quiz/core/editor.js +141 -4
- package/templates/quiz/core/model.js +4 -3
- package/templates/quiz/metadata.json +1 -1
- package/templates/quiz/screens/edit.js +673 -162
- package/templates/quiz/screens/learn.js +1 -1
- package/templates/quiz/styles.css +557 -73
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -1
- package/templates/quiz/ui/templates/edit.js +417 -76
- package/templates/quiz/ui/templates/page.js +2 -17
- package/templates/quiz/ui/templates/question.js +1 -1
- package/templates/quiz/ui/texts.js +40 -27
- package/skills/elice-content-guide/SKILL.md +0 -42
- package/skills/elice-content-guide/topics/05-screen-code.md +0 -132
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +0 -27
- package/skills/elice-content-guide/topics/09-check.md +0 -11
- package/skills/elice-content-guide/topics/10-build.md +0 -8
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +0 -41
- package/templates/quiz/instructor.html +0 -17
- package/templates/quiz/screens/instructor.js +0 -33
- /package/skills/{elice-content-guide/topics → _shared/references}/01-check-the-environment.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/04-rules.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/11-more.md +0 -0
|
@@ -11,8 +11,8 @@ const usage = `사용법: ecdk setup [--only skills|mcp] [--project] [--url <주
|
|
|
11
11
|
4. 도구별 로그인 안내
|
|
12
12
|
MCP는 아직 배포되지 않았거나 직접 할 일이 있어도 실패로 치지 않는다 ("직접 할 일"에 적음, 스킬이 쓸 수 있으면 종료 코드 0).
|
|
13
13
|
|
|
14
|
-
--only skills: Claude Code 스킬(
|
|
15
|
-
같은
|
|
14
|
+
--only skills: Claude Code 스킬 4개(각 스킬 폴더에 참고 문서 references/ 포함)만 설치 · 갱신한다
|
|
15
|
+
같은 버전 · 같은 내용이면 건너뛰고, 옛 버전이거나 내용이 다르면 바꾼다. 옛 ecdk가 설치한 옛 이름 스킬(elice-content-guide)은 지운다
|
|
16
16
|
mcp: Elice 학습자료 서버 MCP(elice-material)만 AI 도구에 등록한다. 자료를 LXP에 올리는 스킬이 쓴다
|
|
17
17
|
등록 전에 서버에 MCP가 있는지 확인하고, 로그인은 등록 뒤 각 도구에서 한다 (안내를 출력함)
|
|
18
18
|
--project 현재 폴더의 .claude/skills/에 설치 (--only skills에서만)
|
|
@@ -31,7 +31,8 @@ const SKILL_ACTION = {
|
|
|
31
31
|
updated: '바꿈',
|
|
32
32
|
skipped: '최신이라 건너뜀',
|
|
33
33
|
kept: '손으로 고친 스킬이라 그대로 둠',
|
|
34
|
-
newer: 'CLI보다 새 버전이라 그대로 둠'
|
|
34
|
+
newer: 'CLI보다 새 버전이라 그대로 둠',
|
|
35
|
+
removed: '옛 스킬이라 지움'
|
|
35
36
|
};
|
|
36
37
|
async function setupAll(opts) {
|
|
37
38
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type McpEnv, type McpTarget } from '../../core/mcp.js';
|
|
2
2
|
import { type SkillState } from '../../core/skills.js';
|
|
3
3
|
import type { CommandResult } from '../../types.js';
|
|
4
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk uninstall [--only skills|mcp] [--project] [--target claude|helpycode|all] [--force] [--json]\n\n ecdk setup\uC774 \uC124\uCE58\uD55C \uAC83\uC744 \uC9C0\uC6B4\uB2E4: \uC2A4\uD0AC
|
|
4
|
+
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk uninstall [--only skills|mcp] [--project] [--target claude|helpycode|all] [--force] [--json]\n\n ecdk setup\uC774 \uC124\uCE58\uD55C \uAC83\uC744 \uC9C0\uC6B4\uB2E4: \uC2A4\uD0AC 4\uAC1C(elice-content-create \u00B7 -migrate \u00B7 -check \u00B7 -publish, \uAC01 references/ \uD3EC\uD568),\n \uC61B ecdk\uAC00 \uC9C0\uAE08\uC740 \uC5C6\uB294 \uC774\uB984\uC73C\uB85C \uC124\uCE58\uD55C \uC2A4\uD0AC(elice-content-guide \uB4F1, SKILL.md \uB05D\uC5D0 ecdk \uC124\uCE58 \uD45C\uC2DC\uAC00 \uC788\uB294 \uAC83)\uACFC\n \uD559\uC2B5\uC790\uB8CC \uC11C\uBC84 MCP \uB4F1\uB85D(elice-material, Claude Code \uC0AC\uC6A9\uC790 \uC124\uC815 \u00B7 Helpy Code \uC124\uC815).\n \uB2E4\uB978 \uC2A4\uD0AC \u00B7 \uB2E4\uB978 MCP \uC11C\uBC84 \u00B7 \uD504\uB85C\uC81D\uD2B8 \u00B7 .ecdk/\uB294 \uAC74\uB4DC\uB9AC\uC9C0 \uC54A\uB294\uB2E4. CLI \uC790\uCCB4\uB294 \uC9C0\uC6B0\uC9C0 \uC54A\uB294\uB2E4 (\uB05D\uC5D0 \uBA85\uB839\uC744 \uC54C\uB824 \uC90C).\n\n --only skills: \uC2A4\uD0AC\uB9CC \uC9C0\uC6B4\uB2E4 (~/.claude/skills/)\n mcp: \uD559\uC2B5\uC790\uB8CC \uC11C\uBC84 MCP \uB4F1\uB85D\uB9CC \uC9C0\uC6B4\uB2E4\n --project \uD604\uC7AC \uD3F4\uB354\uC758 .claude/skills/\uC5D0 \uC124\uCE58\uD55C \uC2A4\uD0AC\uC744 \uC9C0\uC6B4\uB2E4 (--only skills\uC5D0\uC11C\uB9CC)\n --target MCP \uB4F1\uB85D\uC744 \uC9C0\uC6B8 \uB3C4\uAD6C claude \u00B7 helpycode \u00B7 all(\uAE30\uBCF8). MCP \uB4F1\uB85D\uC5D0\uB9CC\n --force \uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC \u00B7 \uC190\uC73C\uB85C \uACE0\uCE5C Helpy Code \uD56D\uBAA9\uB3C4 \uC9C0\uC6B4\uB2E4\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uC9C0\uC6C0(\uB610\uB294 \uC9C0\uC6B8 \uAC83 \uC5C6\uC74C) \u00B7 1 \uB0A8\uAE34 \uAC83 \u00B7 \uC9C1\uC811 \uD560 \uC77C\uC774 \uC788\uC74C(\uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC, \uC8FC\uC11D\uC774 \uC788\uB294 \uC124\uC815 \uD30C\uC77C)\n 2 \uC798\uBABB\uB41C \uC0AC\uC6A9 (\uBAA8\uB974\uB294 --only \uAC12, --only skills\uC5D0 --target, --project\uB97C --only skills \uC5C6\uC774)";
|
|
5
5
|
export type SkillRemoveAction = 'removed' | 'kept' | 'missing';
|
|
6
6
|
export interface SkillRemoveStep {
|
|
7
7
|
name: string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { copyFileSync, writeFileSync
|
|
2
|
-
import { dirname, sep, join, basename } from 'node:path';
|
|
1
|
+
import { copyFileSync, writeFileSync } from 'node:fs';
|
|
3
2
|
import { defaultMcpEnv, MCP_NAME, claudeRegistration, helpyConfigPath, readHelpyConfig, helpyRegisteredUrl } from '../../core/mcp.js';
|
|
4
|
-
import { skillsDir, skillNames, markedSkillNames, inspectSkill, skillFiles,
|
|
3
|
+
import { skillsDir, skillNames, markedSkillNames, inspectSkill, skillFiles, oldSkillFiles, removeInstalledSkill } from '../../core/skills.js';
|
|
5
4
|
|
|
6
5
|
const usage = `사용법: ecdk uninstall [--only skills|mcp] [--project] [--target claude|helpycode|all] [--force] [--json]
|
|
7
6
|
|
|
8
|
-
ecdk setup이 설치한 것을 지운다: 스킬
|
|
9
|
-
옛 ecdk가 지금은 없는 이름으로 설치한 스킬(SKILL.md 끝에 ecdk 설치 표시가 있는 것)과
|
|
7
|
+
ecdk setup이 설치한 것을 지운다: 스킬 4개(elice-content-create · -migrate · -check · -publish, 각 references/ 포함),
|
|
8
|
+
옛 ecdk가 지금은 없는 이름으로 설치한 스킬(elice-content-guide 등, SKILL.md 끝에 ecdk 설치 표시가 있는 것)과
|
|
10
9
|
학습자료 서버 MCP 등록(elice-material, Claude Code 사용자 설정 · Helpy Code 설정).
|
|
11
10
|
다른 스킬 · 다른 MCP 서버 · 프로젝트 · .ecdk/는 건드리지 않는다. CLI 자체는 지우지 않는다 (끝에 명령을 알려 줌).
|
|
12
11
|
|
|
@@ -19,28 +18,6 @@ const usage = `사용법: ecdk uninstall [--only skills|mcp] [--project] [--targ
|
|
|
19
18
|
종료 코드: 0 지움(또는 지울 것 없음) · 1 남긴 것 · 직접 할 일이 있음(손으로 고친 스킬, 주석이 있는 설정 파일)
|
|
20
19
|
2 잘못된 사용 (모르는 --only 값, --only skills에 --target, --project를 --only skills 없이)`;
|
|
21
20
|
const NEXT = ['CLI 지우기: npm uninstall -g @eliceio/cdk-cli (npx로만 실행했다면 지울 것 없음)', '옛 Claude 플러그인 elice-content를 설치했었다면 Claude Code에서: /plugin uninstall elice-content@elice-content → /plugin marketplace remove elice-content'];
|
|
22
|
-
/**
|
|
23
|
-
* SKILL.md와 ecdk가 같이 설치한 파일(files)만 지우고, 폴더는 비었을 때만 지운다 (사람이 더한 파일은 남김)
|
|
24
|
-
*/
|
|
25
|
-
function removeSkill(path, files) {
|
|
26
|
-
unlinkSync(path);
|
|
27
|
-
const dir = dirname(path);
|
|
28
|
-
removeSkillFiles(dir, files);
|
|
29
|
-
let rest = readdirSync(dir, {
|
|
30
|
-
recursive: true,
|
|
31
|
-
encoding: 'utf8'
|
|
32
|
-
}).map(p => p.split(sep).join('/'));
|
|
33
|
-
// 남은 것이 점 파일(.DS_Store 같은 OS 파일)과 빈 폴더뿐이면 그것도 지우고 폴더를 지운다. 숨김 폴더 안은 건드리지 않음
|
|
34
|
-
const dirs = rest.filter(p => statSync(join(dir, p)).isDirectory());
|
|
35
|
-
const osFile = p => basename(p).startsWith('.') && !isDotPath(dirname(p).replace(/^\.$/, ''));
|
|
36
|
-
if (rest.every(p => dirs.includes(p) || osFile(p))) {
|
|
37
|
-
for (const p of rest.filter(p => !dirs.includes(p))) unlinkSync(join(dir, p));
|
|
38
|
-
for (const p of dirs.sort().reverse()) rmdirSync(join(dir, p));
|
|
39
|
-
rest = [];
|
|
40
|
-
}
|
|
41
|
-
if (rest.length === 0) rmdirSync(dir);
|
|
42
|
-
return rest.sort();
|
|
43
|
-
}
|
|
44
21
|
function uninstallSkills(opts) {
|
|
45
22
|
// 지금 CLI의 스킬 + 옛 CLI가 지금은 없는 이름으로 설치한 스킬(설치 표시로 알아봄). 표시 없는 남의 스킬은 건드리지 않음
|
|
46
23
|
const names = [...new Set([...skillNames(opts.root), ...markedSkillNames(opts.dir)])].sort();
|
|
@@ -60,9 +37,9 @@ function uninstallSkills(opts) {
|
|
|
60
37
|
...base,
|
|
61
38
|
action: 'kept'
|
|
62
39
|
};
|
|
63
|
-
// 지문이 맞으면 같이 설치한 파일(가이드 topics/)도 지운다. 손으로 고친 스킬(--force)은 이 CLI가 설치하는 이름의 파일만
|
|
64
|
-
const files = status.files ?? (skillNames(opts.root).includes(name) ? skillFiles(name, opts.root) :
|
|
65
|
-
const extra =
|
|
40
|
+
// 지문이 맞으면 같이 설치한 파일(references/, 옛 가이드 스킬은 topics/)도 지운다. 손으로 고친 스킬(--force)은 이 CLI가 설치하는 이름의 파일만
|
|
41
|
+
const files = status.files ?? (skillNames(opts.root).includes(name) ? skillFiles(name, opts.root) : oldSkillFiles(name, opts.root));
|
|
42
|
+
const extra = removeInstalledSkill(status.path, files);
|
|
66
43
|
return {
|
|
67
44
|
...base,
|
|
68
45
|
action: 'removed',
|
package/es/core/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 채점 방식 = `settings.grading.type`. 원본은 rules.json `manifest.graderTypes`.
|
|
3
3
|
* pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖.
|
|
4
|
-
* 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 설정
|
|
4
|
+
* 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 자료 편집 화면의 '설정'에서 교육자가 고른다 (ADR 0012). 패키지 · CLI는 다루지 않는다
|
|
5
5
|
*/
|
|
6
6
|
export declare const GRADER_TYPES: readonly ["pattern", "rubric"];
|
|
7
7
|
export type GraderType = (typeof GRADER_TYPES)[number];
|
|
@@ -12,7 +12,7 @@ export type GraderType = (typeof GRADER_TYPES)[number];
|
|
|
12
12
|
* { "type": "pattern", "answer_key": "^q1=b;q2=a,d$" } // 정규식 하나. 답 문자열 앞뒤 공백을 자르고 전체 일치
|
|
13
13
|
* { "type": "rubric", "rubric": "핵심 개념 2개 이상 언급하면 만점" }
|
|
14
14
|
*
|
|
15
|
-
* 완료 정책(on_access · on_submit · on_graded)은 grading에 없다: LXP 설정
|
|
15
|
+
* 완료 정책(on_access · on_submit · on_graded)은 grading에 없다: LXP 자료 편집 화면의 '설정'에서 교육자가 고른다 (ADR 0012).
|
|
16
16
|
*/
|
|
17
17
|
export interface GradingConfig {
|
|
18
18
|
type: GraderType;
|
package/es/core/config.js
CHANGED
|
@@ -7,7 +7,7 @@ import { LEGACY_COMPLETION_SCREENS, LEGACY_COMPLETION_FIELDS, parseManifest, ser
|
|
|
7
7
|
/**
|
|
8
8
|
* 채점 방식 = `settings.grading.type`. 원본은 rules.json `manifest.graderTypes`.
|
|
9
9
|
* pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖.
|
|
10
|
-
* 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 설정
|
|
10
|
+
* 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 자료 편집 화면의 '설정'에서 교육자가 고른다 (ADR 0012). 패키지 · CLI는 다루지 않는다
|
|
11
11
|
*/
|
|
12
12
|
const GRADER_TYPES = ['pattern', 'rubric'];
|
|
13
13
|
/** 완료 정책 값 (LXP 설정). grading에 잘못 적었을 때 알려 주려고만 쓴다 */
|
|
@@ -26,7 +26,7 @@ function parseGrading(data) {
|
|
|
26
26
|
const example = '예: { "type": "pattern", "answer_key": "^q1=b$" } · { "type": "rubric", "rubric": "…" }';
|
|
27
27
|
if (typeof data !== 'object' || data === null || Array.isArray(data)) return `객체여야 합니다. ${example}`;
|
|
28
28
|
const record = data;
|
|
29
|
-
if (COMPLETION_POLICY_VALUES.includes(record.type)) return `완료 정책(${String(record.type)})은 grading에 적지 않습니다. 완료 정책은 LXP에 올린 뒤 설정
|
|
29
|
+
if (COMPLETION_POLICY_VALUES.includes(record.type)) return `완료 정책(${String(record.type)})은 grading에 적지 않습니다. 완료 정책은 LXP에 올린 뒤 자료 편집 화면의 '설정'에서 교육자가 고릅니다 (ADR 0012). grading은 { "type": "pattern" | "rubric" }만.`;
|
|
30
30
|
if (record.completion_policy !== undefined || record.grader_type !== undefined) return `completion_policy · grader_type은 쓰지 않습니다 (2026-11-11 결정: grading은 type 모양 그대로). ${example}`;
|
|
31
31
|
if (record.match !== undefined || record.answer_key !== undefined && typeof record.answer_key !== 'string') return `옛 형식입니다 (match · 객체 정답). 정답은 정규식 문자열 하나입니다: { "type": "pattern", "answer_key": "^q1=b;q2=a,d$" }. 퀴즈는 ecdk dev의 내용 편집에서 정답을 다시 고르면 새 형식으로 저장됩니다.`;
|
|
32
32
|
const unknown = Object.keys(record).filter(k => !GRADING_DATA_KEYS.includes(k));
|
package/es/core/skills.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { compareVersions } from '../rules/semver.js';
|
|
2
2
|
export { compareVersions };
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* 옛 CLI가 설치했고 지금은 없는 스킬. setup --only skills(update도 이것을 실행)가 설치 표시가 있는 것을 지운다.
|
|
5
|
+
* elice-content-guide: 가이드 주제를 각 스킬의 references/로 옮기며 없앴다
|
|
6
|
+
*/
|
|
7
|
+
export declare const OLD_SKILLS: string[];
|
|
8
|
+
/**
|
|
9
|
+
* 옛 이름 스킬이 SKILL.md와 같이 설치한 파일 (손으로 고친 것을 --force로 지울 때 이것만 지운다).
|
|
10
|
+
* elice-content-guide는 지금 references/와 같은 이름의 주제를 topics/에 두었다
|
|
11
|
+
*/
|
|
12
|
+
export declare function oldSkillFiles(name: string, root?: string): string[];
|
|
5
13
|
export type SkillState = 'missing' | 'current' | 'outdated' | 'newer' | 'modified';
|
|
6
14
|
export interface SkillStatus {
|
|
7
15
|
name: string;
|
|
@@ -16,7 +24,7 @@ export interface SkillStatus {
|
|
|
16
24
|
export declare function skillNames(root?: string): string[];
|
|
17
25
|
/** 점으로 시작하는 이름(.DS_Store 같은 OS 파일, 편집기 스왑 파일, 숨김 폴더)이 경로에 있으면 true */
|
|
18
26
|
export declare function isDotPath(path: string): boolean;
|
|
19
|
-
/** 스킬과 같이 설치하는 파일 (
|
|
27
|
+
/** 스킬과 같이 설치하는 파일 (스킬 폴더 기준, 정렬). 예: references/05-screen-code.md */
|
|
20
28
|
export declare function skillFiles(name: string, root?: string): string[];
|
|
21
29
|
/** 원본에 공통 규칙과 버전 줄을 넣는다. 지문은 버전 줄을 뺀 본문으로. 같이 설치하는 파일이 있으면 그 지문 줄도 본문에 */
|
|
22
30
|
export declare function renderSkill(name: string, root?: string, version?: string): string;
|
|
@@ -42,13 +50,23 @@ export declare function inspectSkill(dir: string, name: string, version?: string
|
|
|
42
50
|
* 남은 파일(SKILL.md 제외) 목록을 돌려준다
|
|
43
51
|
*/
|
|
44
52
|
export declare function removeSkillFiles(skillDir: string, files: string[]): string[];
|
|
53
|
+
/**
|
|
54
|
+
* 설치한 스킬 하나를 지운다: SKILL.md와 ecdk가 같이 설치한 파일(files)만 지우고, 폴더는 비었을 때만 지운다
|
|
55
|
+
* (사람이 더한 파일은 남김). 남은 파일 목록을 돌려준다 (ecdk uninstall · 옛 스킬 정리)
|
|
56
|
+
*/
|
|
57
|
+
export declare function removeInstalledSkill(path: string, files: string[]): string[];
|
|
58
|
+
export type InstallAction = 'installed' | 'updated' | 'skipped' | 'kept' | 'newer' | 'removed';
|
|
45
59
|
export interface InstallResult {
|
|
46
60
|
dir: string;
|
|
47
61
|
version: string;
|
|
48
62
|
/** 설치 전에 스킬 폴더가 없어서 이번에 만들었다 (이미 열린 Claude Code 세션은 /reload-skills가 한 번 필요) */
|
|
49
63
|
skillsDirCreated: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 지금 스킬 + 옛 CLI가 설치한 옛 이름 스킬(OLD_SKILLS, 있을 때만). 옛 스킬은 removed(지움) · kept(손으로 고쳐서 둠,
|
|
66
|
+
* --force면 지움)
|
|
67
|
+
*/
|
|
50
68
|
skills: (SkillStatus & {
|
|
51
|
-
action:
|
|
69
|
+
action: InstallAction;
|
|
52
70
|
})[];
|
|
53
71
|
}
|
|
54
72
|
export declare function install(opts: {
|
package/es/core/skills.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { readFileSync, existsSync, readdirSync, unlinkSync, rmdirSync } from 'node:fs';
|
|
2
|
+
import { readFileSync, existsSync, readdirSync, unlinkSync, statSync, rmdirSync } from 'node:fs';
|
|
3
3
|
import { mkdir, copyFile, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
|
-
import { join, resolve, dirname, relative,
|
|
5
|
+
import { join, resolve, dirname, sep, relative, basename } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { compareVersions } from '../rules/semver.js';
|
|
8
8
|
|
|
@@ -12,18 +12,30 @@ import { compareVersions } from '../rules/semver.js';
|
|
|
12
12
|
*/
|
|
13
13
|
/** CLI 패키지의 skills/ (es/core/와 src/core/ 모두 두 단계 위) */
|
|
14
14
|
const SKILLS_ROOT = fileURLToPath(new URL('../../skills', import.meta.url));
|
|
15
|
-
/** 모든 스킬에 끼워 넣는 공통 규칙 */
|
|
15
|
+
/** 모든 스킬에 끼워 넣는 공통 규칙(always.md)과 모든 스킬에 복사하는 참고 문서(references/) */
|
|
16
16
|
const SHARED_DIR = '_shared';
|
|
17
|
+
/** 스킬마다 복사하는 참고 문서 폴더 (_shared/references/ → 설치한 스킬/references/) */
|
|
18
|
+
const REFERENCES_DIR = 'references';
|
|
17
19
|
const PACKAGE_VERSION = JSON.parse(readFileSync(fileURLToPath(new URL('../../package.json', import.meta.url)), 'utf8')).version;
|
|
18
20
|
/** 설치한 스킬 맨 끝 줄. 버전 · 내용 지문으로 오래됨 · 손으로 고침을 알아본다 */
|
|
19
21
|
const STAMP = /<!-- ecdk-skill: (\S+) (\S+) (sha256-[A-Za-z0-9+/=]+) -->\s*$/;
|
|
20
22
|
/**
|
|
21
|
-
* SKILL.md 말고 같이 설치하는 파일(
|
|
23
|
+
* SKILL.md 말고 같이 설치하는 파일(references/*.md 등)의 개수 · 지문. 본문 안(맨 끝 줄 위)에 두어
|
|
22
24
|
* 맨 끝 줄 지문이 이 줄까지 덮는다. 그래서 이 줄을 모르는 옛 CLI도 SKILL.md는 그대로 알아보고, 새 CLI는 파일까지 대조한다
|
|
23
25
|
*/
|
|
24
26
|
const FILES_LINE = /^<!-- ecdk-skill-files: (\d+) (sha256-[A-Za-z0-9+/=]+) -->$/m;
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
+
/**
|
|
28
|
+
* 옛 CLI가 설치했고 지금은 없는 스킬. setup --only skills(update도 이것을 실행)가 설치 표시가 있는 것을 지운다.
|
|
29
|
+
* elice-content-guide: 가이드 주제를 각 스킬의 references/로 옮기며 없앴다
|
|
30
|
+
*/
|
|
31
|
+
const OLD_SKILLS = ['elice-content-guide'];
|
|
32
|
+
/**
|
|
33
|
+
* 옛 이름 스킬이 SKILL.md와 같이 설치한 파일 (손으로 고친 것을 --force로 지울 때 이것만 지운다).
|
|
34
|
+
* elice-content-guide는 지금 references/와 같은 이름의 주제를 topics/에 두었다
|
|
35
|
+
*/
|
|
36
|
+
function oldSkillFiles(name, root = SKILLS_ROOT) {
|
|
37
|
+
return name === 'elice-content-guide' ? listFiles(join(root, SHARED_DIR, REFERENCES_DIR)).map(f => `topics/${f}`) : [];
|
|
38
|
+
}
|
|
27
39
|
const sha = text => `sha256-${createHash('sha256').update(text).digest('base64')}`;
|
|
28
40
|
/** 패키지에 든 스킬 이름 (공통 폴더 제외) */
|
|
29
41
|
function skillNames(root = SKILLS_ROOT) {
|
|
@@ -52,22 +64,33 @@ function listFiles(dir) {
|
|
|
52
64
|
}
|
|
53
65
|
return entries.filter(e => e.isFile()).map(e => relative(dir, join(e.parentPath, e.name)).split(sep).join('/')).filter(p => p !== 'SKILL.md' && !isDotPath(p)).sort();
|
|
54
66
|
}
|
|
55
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* 스킬과 같이 설치하는 파일 (스킬 폴더 기준 경로 → 원본 경로). 공통 참고 문서 _shared/references/는 모든 스킬의
|
|
69
|
+
* references/로, 원본 스킬 폴더의 다른 파일(SKILL.md 말고)은 그대로. 같은 경로면 스킬 폴더의 것
|
|
70
|
+
*/
|
|
71
|
+
function skillSources(name, root = SKILLS_ROOT) {
|
|
72
|
+
const sources = new Map();
|
|
73
|
+
const shared = join(root, SHARED_DIR, REFERENCES_DIR);
|
|
74
|
+
for (const f of listFiles(shared)) sources.set(`${REFERENCES_DIR}/${f}`, join(shared, f));
|
|
75
|
+
for (const f of listFiles(join(root, name))) sources.set(f, join(root, name, f));
|
|
76
|
+
return new Map([...sources].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0));
|
|
77
|
+
}
|
|
78
|
+
/** 스킬과 같이 설치하는 파일 (스킬 폴더 기준, 정렬). 예: references/05-screen-code.md */
|
|
56
79
|
function skillFiles(name, root = SKILLS_ROOT) {
|
|
57
|
-
return
|
|
80
|
+
return [...skillSources(name, root).keys()];
|
|
58
81
|
}
|
|
59
|
-
/** 파일 목록 · 내용의 지문 (경로와 내용을 차례로) */
|
|
60
|
-
function filesDigest(
|
|
82
|
+
/** 파일 목록 · 내용의 지문 (경로와 내용을 차례로). path는 상대 경로 → 읽을 파일 */
|
|
83
|
+
function filesDigest(files, path) {
|
|
61
84
|
const hash = createHash('sha256');
|
|
62
|
-
for (const f of files) hash.update(`${f}\0${readFileSync(
|
|
85
|
+
for (const f of files) hash.update(`${f}\0${readFileSync(path(f), 'utf8')}\0`);
|
|
63
86
|
return `sha256-${hash.digest('base64')}`;
|
|
64
87
|
}
|
|
65
88
|
/** 원본에 공통 규칙과 버전 줄을 넣는다. 지문은 버전 줄을 뺀 본문으로. 같이 설치하는 파일이 있으면 그 지문 줄도 본문에 */
|
|
66
89
|
function renderSkill(name, root = SKILLS_ROOT, version = PACKAGE_VERSION) {
|
|
67
90
|
const always = readFileSync(join(root, SHARED_DIR, 'always.md'), 'utf8').trim();
|
|
68
91
|
let body = readFileSync(join(root, name, 'SKILL.md'), 'utf8').replace('{{always}}', always).replace(/\n*\{\{version\}\}\s*$/, '').trimEnd();
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
92
|
+
const sources = skillSources(name, root);
|
|
93
|
+
if (sources.size > 0) body += `\n\n<!-- ecdk-skill-files: ${sources.size} ${filesDigest([...sources.keys()], f => sources.get(f) ?? f)} -->`;
|
|
71
94
|
return `${body}\n\n<!-- ecdk-skill: ${name} ${version} ${sha(body)} -->\n`;
|
|
72
95
|
}
|
|
73
96
|
/** 설치 위치: --project면 현재 폴더, 아니면 홈 */
|
|
@@ -125,7 +148,7 @@ function inspectSkill(dir, name, version = PACKAGE_VERSION) {
|
|
|
125
148
|
let files;
|
|
126
149
|
if (filesLine) {
|
|
127
150
|
const installedFiles = listFiles(join(dir, name));
|
|
128
|
-
if (installedFiles.length !== Number(filesLine[1]) || filesDigest(join(dir, name
|
|
151
|
+
if (installedFiles.length !== Number(filesLine[1]) || filesDigest(installedFiles, f => join(dir, name, f)) !== filesLine[2]) return {
|
|
129
152
|
name,
|
|
130
153
|
path,
|
|
131
154
|
state: 'modified',
|
|
@@ -170,6 +193,29 @@ function removeSkillFiles(skillDir, files) {
|
|
|
170
193
|
}
|
|
171
194
|
return listFiles(skillDir);
|
|
172
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* 설치한 스킬 하나를 지운다: SKILL.md와 ecdk가 같이 설치한 파일(files)만 지우고, 폴더는 비었을 때만 지운다
|
|
198
|
+
* (사람이 더한 파일은 남김). 남은 파일 목록을 돌려준다 (ecdk uninstall · 옛 스킬 정리)
|
|
199
|
+
*/
|
|
200
|
+
function removeInstalledSkill(path, files) {
|
|
201
|
+
unlinkSync(path);
|
|
202
|
+
const dir = dirname(path);
|
|
203
|
+
removeSkillFiles(dir, files);
|
|
204
|
+
let rest = readdirSync(dir, {
|
|
205
|
+
recursive: true,
|
|
206
|
+
encoding: 'utf8'
|
|
207
|
+
}).map(p => p.split(sep).join('/'));
|
|
208
|
+
// 남은 것이 점 파일(.DS_Store 같은 OS 파일)과 빈 폴더뿐이면 그것도 지우고 폴더를 지운다. 숨김 폴더 안은 건드리지 않음
|
|
209
|
+
const dirs = rest.filter(p => statSync(join(dir, p)).isDirectory());
|
|
210
|
+
const osFile = p => basename(p).startsWith('.') && !isDotPath(dirname(p).replace(/^\.$/, ''));
|
|
211
|
+
if (rest.every(p => dirs.includes(p) || osFile(p))) {
|
|
212
|
+
for (const p of rest.filter(p => !dirs.includes(p))) unlinkSync(join(dir, p));
|
|
213
|
+
for (const p of dirs.sort().reverse()) rmdirSync(join(dir, p));
|
|
214
|
+
rest = [];
|
|
215
|
+
}
|
|
216
|
+
if (rest.length === 0) rmdirSync(dir);
|
|
217
|
+
return rest.sort();
|
|
218
|
+
}
|
|
173
219
|
async function install(opts) {
|
|
174
220
|
const root = opts.root ?? SKILLS_ROOT;
|
|
175
221
|
const version = opts.version ?? PACKAGE_VERSION;
|
|
@@ -181,7 +227,8 @@ async function install(opts) {
|
|
|
181
227
|
const status = inspectSkill(dir, name, version);
|
|
182
228
|
const write = async () => {
|
|
183
229
|
const target = join(dir, name);
|
|
184
|
-
const
|
|
230
|
+
const sources = skillSources(name, root);
|
|
231
|
+
const files = [...sources.keys()];
|
|
185
232
|
await mkdir(target, {
|
|
186
233
|
recursive: true
|
|
187
234
|
});
|
|
@@ -193,7 +240,7 @@ async function install(opts) {
|
|
|
193
240
|
await mkdir(dirname(join(target, f)), {
|
|
194
241
|
recursive: true
|
|
195
242
|
});
|
|
196
|
-
await copyFile(
|
|
243
|
+
await copyFile(sources.get(f) ?? f, join(target, f));
|
|
197
244
|
}
|
|
198
245
|
await writeFile(status.path, renderSkill(name, root, version));
|
|
199
246
|
};
|
|
@@ -203,6 +250,13 @@ async function install(opts) {
|
|
|
203
250
|
...status,
|
|
204
251
|
action: 'installed'
|
|
205
252
|
});
|
|
253
|
+
} else if (status.state === 'current' && readFileSync(status.path, 'utf8') !== renderSkill(name, root, version)) {
|
|
254
|
+
// 같은 버전인데 내용이 다르면(배포 전 빌드, 같이 설치하는 파일이 없던 옛 모양) 이 CLI의 내용으로 바꾼다
|
|
255
|
+
await write();
|
|
256
|
+
skills.push({
|
|
257
|
+
...status,
|
|
258
|
+
action: 'updated'
|
|
259
|
+
});
|
|
206
260
|
} else if (status.state === 'current') {
|
|
207
261
|
skills.push({
|
|
208
262
|
...status,
|
|
@@ -226,6 +280,24 @@ async function install(opts) {
|
|
|
226
280
|
});
|
|
227
281
|
}
|
|
228
282
|
}
|
|
283
|
+
// 옛 이름 스킬: ecdk 설치 표시가 있는 것만 (표시 없는 같은 이름 폴더는 남의 것이라 건드리지 않음).
|
|
284
|
+
// 지문이 맞으면(버전과 상관없이) 지우고, 손으로 고친 것은 --force일 때만
|
|
285
|
+
const marked = markedSkillNames(dir);
|
|
286
|
+
for (const name of OLD_SKILLS.filter(n => marked.includes(n) && !skillNames(root).includes(n))) {
|
|
287
|
+
const status = inspectSkill(dir, name, version);
|
|
288
|
+
if (status.state === 'modified' && !opts.force) {
|
|
289
|
+
skills.push({
|
|
290
|
+
...status,
|
|
291
|
+
action: 'kept'
|
|
292
|
+
});
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
removeInstalledSkill(status.path, status.files ?? oldSkillFiles(name, root));
|
|
296
|
+
skills.push({
|
|
297
|
+
...status,
|
|
298
|
+
action: 'removed'
|
|
299
|
+
});
|
|
300
|
+
}
|
|
229
301
|
return {
|
|
230
302
|
dir,
|
|
231
303
|
version,
|
|
@@ -242,4 +314,4 @@ function reloadNotes(skillsDirCreated) {
|
|
|
242
314
|
return [skillsDirCreated ? 'Claude Code: 이미 열려 있던 Claude Code 세션에서는 /reload-skills를 한 번 입력하세요 (새로 여는 세션은 필요 없음).' : 'Claude Code: 열려 있는 세션에도 바뀐 스킬이 자동으로 적용됩니다.', 'Helpy Code 데스크톱은 다시 시작하세요.'];
|
|
243
315
|
}
|
|
244
316
|
|
|
245
|
-
export {
|
|
317
|
+
export { OLD_SKILLS, compareVersions, inspectSkill, install, isDotPath, markedSkillNames, oldSkillFiles, reloadNotes, removeInstalledSkill, removeSkillFiles, renderSkill, skillFiles, skillNames, skillsDir };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Browser } from 'playwright-core';
|
|
2
|
+
/** 소프트웨어 GL: GPU 없는 헤드리스에서도 WebGL(three.js 등)이 그려지게 */
|
|
3
|
+
export declare const BROWSER_ARGS: string[];
|
|
4
|
+
/** 브라우저를 찾지 못했을 때 (종료 코드 3) */
|
|
5
|
+
export declare class NoBrowserError extends Error {
|
|
6
|
+
readonly tried: string[];
|
|
7
|
+
constructor(tried: string[]);
|
|
8
|
+
}
|
|
9
|
+
/** playwright가 받은 브라우저를 두는 폴더 (PLAYWRIGHT_BROWSERS_PATH가 있으면 그것) */
|
|
10
|
+
export declare function playwrightCacheDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, home?: string): string;
|
|
11
|
+
/** 캐시의 chromium(전체판 먼저, 그다음 headless shell) 중 가장 새 판의 실행 파일 */
|
|
12
|
+
export declare function findCachedChromium(dir: string): string | undefined;
|
|
13
|
+
export interface LaunchedBrowser {
|
|
14
|
+
browser: Browser;
|
|
15
|
+
/** 사람이 읽는 이름: "ECDK_BROWSER (…)" · "Google Chrome" · "playwright chromium (…)" */
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 찾는 순서: ECDK_BROWSER(경로) → 설치된 Chrome · Edge(playwright channel) → playwright 캐시의 chromium.
|
|
20
|
+
* playwright-core는 무거워 --check일 때만 불러온다
|
|
21
|
+
*/
|
|
22
|
+
export declare function launchBrowser(env?: NodeJS.ProcessEnv): Promise<LaunchedBrowser>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
|
|
5
|
+
/** 소프트웨어 GL: GPU 없는 헤드리스에서도 WebGL(three.js 등)이 그려지게 */
|
|
6
|
+
const BROWSER_ARGS = ['--use-angle=swiftshader', '--enable-unsafe-swiftshader'];
|
|
7
|
+
/** 브라우저를 찾지 못했을 때 (종료 코드 3) */
|
|
8
|
+
class NoBrowserError extends Error {
|
|
9
|
+
tried;
|
|
10
|
+
constructor(tried) {
|
|
11
|
+
super(['화면을 열 브라우저를 찾지 못했습니다.', '- Google Chrome(또는 Microsoft Edge)을 설치하거나,', '- 환경 변수 ECDK_BROWSER에 Chrome · Chromium 실행 파일 경로를 주거나,', '- ecdk dev로 서버를 띄워 화면을 직접 열어 확인하세요.', `찾아본 곳: ${tried.join(' · ')}`].join('\n'));
|
|
12
|
+
this.tried = tried;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** playwright가 받은 브라우저를 두는 폴더 (PLAYWRIGHT_BROWSERS_PATH가 있으면 그것) */
|
|
16
|
+
function playwrightCacheDir(env = process.env, platform = process.platform, home = homedir()) {
|
|
17
|
+
const custom = env.PLAYWRIGHT_BROWSERS_PATH;
|
|
18
|
+
if (custom && custom !== '0') return custom;
|
|
19
|
+
if (platform === 'darwin') return join(home, 'Library', 'Caches', 'ms-playwright');
|
|
20
|
+
if (platform === 'win32') return join(env.LOCALAPPDATA ?? join(home, 'AppData', 'Local'), 'ms-playwright');
|
|
21
|
+
return join(env.XDG_CACHE_HOME ?? join(home, '.cache'), 'ms-playwright');
|
|
22
|
+
}
|
|
23
|
+
/** 받은 폴더 안 실행 파일 이름 (판마다 폴더 이름이 달라 하위 폴더를 훑는다) */
|
|
24
|
+
const EXECUTABLES = ['Chromium.app/Contents/MacOS/Chromium', 'Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing', 'chrome-headless-shell', 'chrome', 'chrome.exe', 'chrome-headless-shell.exe'];
|
|
25
|
+
/** 캐시의 chromium(전체판 먼저, 그다음 headless shell) 중 가장 새 판의 실행 파일 */
|
|
26
|
+
function findCachedChromium(dir) {
|
|
27
|
+
let names;
|
|
28
|
+
try {
|
|
29
|
+
names = readdirSync(dir);
|
|
30
|
+
} catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const rev = n => Number(n.split('-').pop());
|
|
34
|
+
const pick = prefix => names.filter(n => n.startsWith(prefix) && Number.isFinite(rev(n))).sort((a, b) => rev(b) - rev(a));
|
|
35
|
+
for (const name of [...pick('chromium-'), ...pick('chromium_headless_shell-')]) {
|
|
36
|
+
let subs;
|
|
37
|
+
try {
|
|
38
|
+
subs = readdirSync(join(dir, name)).filter(s => s.startsWith('chrome'));
|
|
39
|
+
} catch {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
for (const sub of subs) for (const exe of EXECUTABLES) {
|
|
43
|
+
const path = join(dir, name, sub, exe);
|
|
44
|
+
if (existsSync(path)) return path;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 찾는 순서: ECDK_BROWSER(경로) → 설치된 Chrome · Edge(playwright channel) → playwright 캐시의 chromium.
|
|
51
|
+
* playwright-core는 무거워 --check일 때만 불러온다
|
|
52
|
+
*/
|
|
53
|
+
async function launchBrowser(env = process.env) {
|
|
54
|
+
const {
|
|
55
|
+
chromium
|
|
56
|
+
} = await import('playwright-core');
|
|
57
|
+
const tried = [];
|
|
58
|
+
const base = {
|
|
59
|
+
headless: true,
|
|
60
|
+
args: BROWSER_ARGS
|
|
61
|
+
};
|
|
62
|
+
const custom = env.ECDK_BROWSER;
|
|
63
|
+
if (custom) {
|
|
64
|
+
// 직접 준 경로가 틀리면 다른 브라우저로 넘어가지 않고 알린다
|
|
65
|
+
if (!existsSync(custom)) throw new NoBrowserError([`ECDK_BROWSER (${custom}: 파일 없음)`]);
|
|
66
|
+
return {
|
|
67
|
+
browser: await chromium.launch({
|
|
68
|
+
...base,
|
|
69
|
+
executablePath: custom
|
|
70
|
+
}),
|
|
71
|
+
name: `ECDK_BROWSER (${custom})`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
for (const [channel, name] of [['chrome', 'Google Chrome'], ['msedge', 'Microsoft Edge']]) {
|
|
75
|
+
try {
|
|
76
|
+
return {
|
|
77
|
+
browser: await chromium.launch({
|
|
78
|
+
...base,
|
|
79
|
+
channel
|
|
80
|
+
}),
|
|
81
|
+
name
|
|
82
|
+
};
|
|
83
|
+
} catch {
|
|
84
|
+
tried.push(name);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const cacheDir = playwrightCacheDir(env);
|
|
88
|
+
const cached = findCachedChromium(cacheDir);
|
|
89
|
+
if (cached) {
|
|
90
|
+
try {
|
|
91
|
+
return {
|
|
92
|
+
browser: await chromium.launch({
|
|
93
|
+
...base,
|
|
94
|
+
executablePath: cached
|
|
95
|
+
}),
|
|
96
|
+
name: `playwright chromium (${cached})`
|
|
97
|
+
};
|
|
98
|
+
} catch {
|
|
99
|
+
tried.push(`playwright chromium (${cached}: 실행 실패)`);
|
|
100
|
+
}
|
|
101
|
+
} else tried.push(`playwright 캐시 (${cacheDir})`);
|
|
102
|
+
throw new NoBrowserError(tried);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { BROWSER_ARGS, NoBrowserError, findCachedChromium, launchBrowser, playwrightCacheDir };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** ecdk dev --check가 여는 화면. tutoring은 학생 화면(learn)을 튜터링 보기로 연 것 */
|
|
2
|
+
export declare const CHECK_SCREENS: readonly ["learn", "tutoring", "instructor", "edit"];
|
|
3
|
+
export type CheckScreen = (typeof CHECK_SCREENS)[number];
|
|
4
|
+
/** 폭 → dev 화면의 폭 버튼 값 (host-page.ts data-w). 브라우저 창은 늘 1280×860 */
|
|
5
|
+
export declare const CHECK_VIEWPORTS: {
|
|
6
|
+
readonly desktop: "100%";
|
|
7
|
+
readonly mobile: "360px";
|
|
8
|
+
};
|
|
9
|
+
export type CheckViewport = keyof typeof CHECK_VIEWPORTS;
|
|
10
|
+
/** 화면 하나를 기다리는 최대 시간. 넘으면 그때 모습으로 기록한다 */
|
|
11
|
+
export declare const SCREEN_WAIT_MS = 8000;
|
|
12
|
+
export interface ScreenResult {
|
|
13
|
+
screen: CheckScreen;
|
|
14
|
+
viewport: CheckViewport;
|
|
15
|
+
/** 콘텐츠 문서의 실제 폭(px) */
|
|
16
|
+
width: number;
|
|
17
|
+
/** 글이나 canvas · 그림이 보이고 불러오는 중 문구가 없음 */
|
|
18
|
+
rendered: boolean;
|
|
19
|
+
/** 기다린 뒤에도 남은 불러오는 중 문구 (없으면 null) */
|
|
20
|
+
loading: string | null;
|
|
21
|
+
consoleErrors: string[];
|
|
22
|
+
pageErrors: string[];
|
|
23
|
+
/** 콘텐츠 CSP가 막은 요청 "주소 (지시어)" */
|
|
24
|
+
blocked: string[];
|
|
25
|
+
/** 콘텐츠 · 흉내 API의 4xx · 5xx "상태 경로" */
|
|
26
|
+
failedRequests: string[];
|
|
27
|
+
overflowX: boolean;
|
|
28
|
+
/** 프로젝트 기준 경로 (/ 구분). 찍지 못했으면 null */
|
|
29
|
+
screenshot: string | null;
|
|
30
|
+
ms: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CheckReport {
|
|
33
|
+
ok: boolean;
|
|
34
|
+
project: string;
|
|
35
|
+
browser: string;
|
|
36
|
+
durationMs: number;
|
|
37
|
+
screenshotsDir: string;
|
|
38
|
+
screens: ScreenResult[];
|
|
39
|
+
validate: {
|
|
40
|
+
errors: number;
|
|
41
|
+
warnings: number;
|
|
42
|
+
issues: {
|
|
43
|
+
level: string;
|
|
44
|
+
id: string;
|
|
45
|
+
path?: string;
|
|
46
|
+
message: string;
|
|
47
|
+
}[];
|
|
48
|
+
};
|
|
49
|
+
/** dev 서버 안내 (SDK 미설치 등) */
|
|
50
|
+
notes: string[];
|
|
51
|
+
}
|
|
52
|
+
/** 기본 화면: metadata.json에서 켠 화면 + 학생 화면이 있으면 튜터링. 문제 설명은 학생 화면만 (dev 화면과 같음) */
|
|
53
|
+
export declare function defaultScreens(entries: Record<string, string>, kind: string): CheckScreen[];
|
|
54
|
+
/** "a,b" → 목록. 모르는 값이 있으면 오류 문구 */
|
|
55
|
+
export declare function parseList<T extends string>(value: string, allowed: readonly T[], label: string): {
|
|
56
|
+
values: T[];
|
|
57
|
+
} | {
|
|
58
|
+
error: string;
|
|
59
|
+
};
|
|
60
|
+
export type Finding = {
|
|
61
|
+
level: 'fail' | 'warn';
|
|
62
|
+
message: string;
|
|
63
|
+
};
|
|
64
|
+
/** 화면 하나의 문제. fail: 오류 · 막힘 · 빈 화면, warn: 불러오는 중이 남음 · 가로 넘침 */
|
|
65
|
+
export declare function findingsOf(r: ScreenResult): Finding[];
|
|
66
|
+
export declare function statusOf(r: ScreenResult): 'ok' | 'warn' | 'fail';
|
|
67
|
+
/** 0: 모든 화면 문제 없음 · 검사 오류 없음, 1: 문제 있음 (경고 포함). 브라우저 없음(3) · 사용법(2)은 명령에서 */
|
|
68
|
+
export declare function exitCodeOf(report: Pick<CheckReport, 'screens' | 'validate'>): 0 | 1;
|
|
69
|
+
export declare function formatText(report: CheckReport): string;
|
|
70
|
+
export interface RunCheckOptions {
|
|
71
|
+
dir: string;
|
|
72
|
+
port?: number;
|
|
73
|
+
/** 없으면 defaultScreens */
|
|
74
|
+
screens?: CheckScreen[];
|
|
75
|
+
viewports?: CheckViewport[];
|
|
76
|
+
}
|
|
77
|
+
/** 프로젝트에 없는 화면을 고른 경우 (사용법 오류) */
|
|
78
|
+
export declare class ScreenNotFoundError extends Error {
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* ecdk dev와 같은 서버를 띄우고 화면 × 폭마다 헤드리스 브라우저로 열어 확인한 뒤 서버를 닫는다.
|
|
82
|
+
* 그림은 <프로젝트>/.ecdk/screens/<화면>-<폭>.png (매번 덮어씀, .ecdk는 zip에서 빠짐)
|
|
83
|
+
*/
|
|
84
|
+
export declare function runCheck(opts: RunCheckOptions): Promise<CheckReport>;
|