@eliceio/cdk-cli 0.1.0-alpha.6 → 0.1.0-alpha.8
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 +110 -104
- package/es/cli.js +7 -22
- package/es/commands/build/index.d.ts +3 -21
- package/es/commands/build/index.js +17 -140
- package/es/commands/create/scaffold.d.ts +2 -0
- package/es/commands/create/scaffold.js +15 -1
- package/es/commands/doctor/index.d.ts +4 -3
- package/es/commands/doctor/index.js +14 -14
- package/es/commands/setup/index.d.ts +4 -7
- package/es/commands/setup/index.js +41 -70
- package/es/commands/uninstall/index.d.ts +9 -8
- package/es/commands/uninstall/index.js +41 -47
- package/es/commands/update/index.d.ts +4 -2
- package/es/commands/update/index.js +27 -18
- package/es/commands/validate/index.js +3 -1
- package/es/core/collect.d.ts +1 -1
- package/es/core/collect.js +3 -1
- package/es/core/config.d.ts +2 -2
- package/es/core/config.js +3 -3
- package/es/core/manifest.d.ts +3 -3
- package/es/core/manifest.js +4 -8
- package/es/{commands/mcp/index.d.ts → core/mcp.d.ts} +11 -18
- package/es/{commands/mcp/index.js → core/mcp.js} +29 -51
- package/es/core/prepare.d.ts +15 -10
- package/es/core/prepare.js +35 -35
- package/es/core/project-check.d.ts +6 -5
- package/es/core/project-check.js +9 -9
- package/es/core/sandbox.d.ts +6 -5
- package/es/core/sandbox.js +30 -8
- package/es/core/sdk.d.ts +7 -18
- package/es/core/sdk.js +8 -38
- package/es/{commands/skill/index.d.ts → core/skills.d.ts} +1 -17
- package/es/{commands/skill/index.js → core/skills.js} +6 -22
- package/es/dev/grading.d.ts +1 -1
- package/es/dev/grading.js +1 -1
- package/es/dev/host-page.js +2 -2
- package/es/dev/server.d.ts +6 -4
- package/es/dev/server.js +47 -77
- package/es/engines/vite/index.d.ts +2 -2
- package/es/engines/vite/index.js +2 -4
- package/es/engines/vite/plugin.d.ts +58 -0
- package/es/engines/vite/plugin.js +286 -0
- package/es/engines/vite/run.d.ts +15 -0
- package/es/engines/vite/run.js +92 -0
- package/es/rules/check.js +10 -12
- package/es/rules/csp.d.ts +1 -1
- package/es/rules/csp.js +1 -1
- package/es/rules/types.d.ts +8 -3
- package/es/rules.json.js +1 -1
- package/es/test-packages.d.ts +3 -1
- package/package.json +8 -3
- package/rules.json +9 -3
- package/skills/_shared/always.md +1 -1
- package/skills/elice-content-create/SKILL.md +2 -1
- package/skills/elice-content-guide/topics/01-check-the-environment.md +2 -2
- package/skills/elice-content-guide/topics/02-design-the-material.md +2 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +3 -3
- package/skills/elice-content-guide/topics/04-rules.md +1 -1
- package/skills/elice-content-guide/topics/05-screen-code.md +44 -13
- package/skills/elice-content-guide/topics/07-move-existing-html.md +2 -2
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +21 -21
- package/skills/elice-content-guide/topics/10-build.md +1 -1
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +2 -2
- package/skills/elice-content-publish/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.js +2 -2
- package/templates/_shared/lib/elice-content-editor.d.ts +80 -0
- package/templates/_shared/lib/elice-content-editor.js +1062 -0
- package/templates/_shared/lib/elice-content.css +332 -0
- package/templates/_shared/lib/elice-content.js +18 -15
- package/templates/blank/README.md +29 -5
- package/templates/blank/commentary.txt +5 -0
- package/templates/blank/screens/edit.js +38 -17
- package/templates/blank/screens/instructor.js +20 -8
- package/templates/blank/screens/learn.js +151 -13
- package/templates/blank/styles.css +171 -0
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +2 -3
- package/templates/quiz/core/model.js +1 -1
- package/templates/quiz/screens/edit.js +14 -2
- package/templates/quiz/styles.css +11 -0
- package/templates/quiz/template.json +1 -1
- package/templates/quiz/ui/texts.js +1 -1
- package/es/core/minify.d.ts +0 -18
- package/es/core/minify.js +0 -93
- package/es/engines/static/index.d.ts +0 -3
- package/es/engines/static/index.js +0 -11
- package/es/engines/types.d.ts +0 -12
|
@@ -1,148 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { minifyFiles } from '../../core/minify.js';
|
|
6
|
-
import { prepareContent } from '../../core/prepare.js';
|
|
7
|
-
import { projectCheckOptions } from '../../core/project-check.js';
|
|
8
|
-
import { inlineModuleScripts } from '../../core/sandbox.js';
|
|
9
|
-
import { createZip } from '../../core/zip.js';
|
|
10
|
-
import { checkFiles } from '../../rules/check.js';
|
|
11
|
-
import { rules } from '../../rules/spec.js';
|
|
12
|
-
import { stripCompletionPolicy } from '../../rules/manifest.js';
|
|
13
|
-
import { findUnreferenced } from '../../rules/unused.js';
|
|
14
|
-
import 'fflate';
|
|
1
|
+
import { join, relative } from 'node:path';
|
|
2
|
+
import { ENGINE } from '../../core/prepare.js';
|
|
3
|
+
import '../../engines/vite/plugin.js';
|
|
4
|
+
import { viteBuild } from '../../engines/vite/run.js';
|
|
15
5
|
import { formatIssues } from '../validate/index.js';
|
|
16
6
|
|
|
17
7
|
const usage = `사용법: ecdk build [프로젝트 폴더] [--json]
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
9
|
+
Vite로 빌드한다 (vite build + ecdk 플러그인). 프로젝트에 vite.config.*가 있으면 그 설정 위에서 돌고,
|
|
10
|
+
거기에 ecdk 플러그인(@eliceio/cdk-cli/vite)이 없으면 더한다.
|
|
11
|
+
package.json "ecdk"의 root(기본 .)의 HTML을 입력으로 묶고, SDK(@eliceio/cdk)는 package.json 의존성을 번들에 넣는다
|
|
12
|
+
(SDK 파일을 따로 넣지 않음). 번들에 쓰이지 않은 원본 파일은 정답·비밀·프로젝트 파일을 빼고 그대로 넣고,
|
|
13
|
+
원본의 metadata.json(화면 · 학습 참고 내용)에 build를 채운 뒤, 검사를 통과하면 <outDir>/content.zip을 만든다
|
|
14
|
+
(outDir 기본 dist). 정답은 편집 화면이 정하므로 zip에 없고, ecdk dev가 저장한 .ecdk/(settings)도 빠진다.
|
|
22
15
|
옛 elice.config.json이 남아 있으면 지금처럼 빌드하고 옮기는 법을 경고한다 (ecdk doctor --fix).
|
|
23
|
-
|
|
24
|
-
"
|
|
16
|
+
zip은 학생 브라우저가 받으므로 묶은 JS · CSS를 줄여서(주석 빼고) 넣는다 (검사는 줄이기 전 원본으로).
|
|
17
|
+
package.json "ecdk"에 "minify": false면 줄이지 않고, "sourcemap": true면 묶은 스크립트에 inline map을 붙인다.
|
|
18
|
+
metadata.json build에 버전과 내용 지문(digest)을 적는다.
|
|
25
19
|
콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 모듈 스크립트 파일 · fetch가 막히므로,
|
|
26
20
|
어느 쪽이든 화면이 뜨도록 HTML의 <script type="module" src>를 묶어 HTML 안에 넣고 zip 안 JSON도 페이지에 넣는다.
|
|
27
21
|
|
|
28
22
|
종료 코드: 0 성공 · 1 검사 오류 (zip 만들지 않음) · 2 잘못된 사용`;
|
|
29
23
|
async function build(projectDir) {
|
|
30
|
-
const config = await loadConfig(projectDir);
|
|
31
|
-
const {
|
|
32
|
-
outDir,
|
|
33
|
-
engine,
|
|
34
|
-
files: sources,
|
|
35
|
-
excluded
|
|
36
|
-
} = await prepareContent(projectDir, config);
|
|
37
|
-
// minify는 zip에 넣을 내용만 바꾼다. 검사는 원본으로: 줄이면 ecdk-ignore 주석이 사라지고 줄 번호가 바뀐다.
|
|
38
|
-
// 용량 한도는 실제로 올릴 zip 크기로 본다
|
|
39
|
-
// 콘텐츠 출처가 null인 LXP에서는 모듈 스크립트 파일 · fetch가 CORS로 막힌다: HTML마다 모듈을 묶어 넣고 JSON도 넣는다 (core/sandbox.ts)
|
|
40
|
-
const sandboxed = await inlineModuleScripts(sources, {
|
|
41
|
-
minify: config.minify === true
|
|
42
|
-
});
|
|
43
|
-
const minified = config.minify ? await minifyFiles(sandboxed.files, {
|
|
44
|
-
sourcemap: config.sourcemap === true
|
|
45
|
-
}) : null;
|
|
46
|
-
// metadata.json build에 minify 여부와 최종 내용의 지문을 적는다 (지문은 metadata.json을 뺀 파일로)
|
|
47
|
-
const digest = contentDigest(minified?.files ?? sandboxed.files);
|
|
48
|
-
const files = withBuildStamp(minified?.files ?? sandboxed.files, {
|
|
49
|
-
...(minified ? {
|
|
50
|
-
minify: true
|
|
51
|
-
} : {}),
|
|
52
|
-
digest
|
|
53
|
-
});
|
|
54
|
-
const zip = createZip(files);
|
|
55
|
-
// 프로젝트 검사: 남은 옛 파일(content.json · grading.json)도 알린다. ecdk dev 상태(.ecdk)는 보지 않는다
|
|
56
|
-
const check = checkFiles(sources, await projectCheckOptions(projectDir, config, {
|
|
57
|
-
zipBytes: zip.byteLength
|
|
58
|
-
}));
|
|
59
|
-
// .map을 더했으면 파일 수 한도는 실제 zip으로 다시 본다
|
|
60
|
-
const realCount = files.filter(f => !f.path.endsWith('/')).length;
|
|
61
|
-
if (realCount > rules.limits.maxFiles && !check.issues.some(i => i.id === 'limit.file-count')) {
|
|
62
|
-
check.issues.unshift({
|
|
63
|
-
id: 'limit.file-count',
|
|
64
|
-
level: 'error',
|
|
65
|
-
message: `sourcemap을 더하면 파일이 ${realCount}개라 한도 ${rules.limits.maxFiles}개를 넘습니다. sourcemap을 끄거나 파일을 줄여 주세요.`
|
|
66
|
-
});
|
|
67
|
-
check.ok = false;
|
|
68
|
-
}
|
|
69
|
-
// 옛 elice.config.json gradingTypes: 옮기지 않고 지워 달라고만 알린다 (ADR 0008 · 0009)
|
|
70
|
-
const legacy = legacyGradingTypesWarning(config);
|
|
71
|
-
if (legacy) check.issues.push({
|
|
72
|
-
id: 'manifest.grading-types',
|
|
73
|
-
level: 'warn',
|
|
74
|
-
message: legacy,
|
|
75
|
-
path: CONFIG_FILE
|
|
76
|
-
});
|
|
77
|
-
// 옛 elice.config.json 완료 정책: 옮기지 않는다 (완료 정책은 LXP 설정, ADR 0012)
|
|
78
|
-
const legacyCompletion = legacyCompletionWarning(config);
|
|
79
|
-
if (legacyCompletion) check.issues.push({
|
|
80
|
-
id: 'manifest.completion-policies-ignored',
|
|
81
|
-
level: 'warn',
|
|
82
|
-
message: legacyCompletion,
|
|
83
|
-
path: CONFIG_FILE
|
|
84
|
-
});
|
|
85
|
-
// 산출물은 <outDir>/content/ 와 <outDir>/content.zip만 건드린다
|
|
86
|
-
const contentDir = join(outDir, 'content');
|
|
87
|
-
const zipPath = join(outDir, 'content.zip');
|
|
88
|
-
await rm(contentDir, {
|
|
89
|
-
recursive: true,
|
|
90
|
-
force: true
|
|
91
|
-
});
|
|
92
|
-
await rm(zipPath, {
|
|
93
|
-
force: true
|
|
94
|
-
});
|
|
95
|
-
for (const f of files) {
|
|
96
|
-
const target = join(contentDir, ...f.path.split('/'));
|
|
97
|
-
await mkdir(dirname(target), {
|
|
98
|
-
recursive: true
|
|
99
|
-
});
|
|
100
|
-
await writeFile(target, f.data);
|
|
101
|
-
}
|
|
102
|
-
if (check.ok) await writeFile(zipPath, zip);
|
|
103
|
-
const zipBytes = zip.byteLength;
|
|
104
24
|
return {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
outDir,
|
|
108
|
-
zip: check.ok ? zipPath : null,
|
|
109
|
-
zipBytes,
|
|
110
|
-
files: files.map(f => f.path),
|
|
111
|
-
excluded,
|
|
112
|
-
minify: minified?.report,
|
|
113
|
-
sandbox: sandboxed.report,
|
|
114
|
-
unreferenced: findUnreferenced(sources, check.manifest),
|
|
115
|
-
digest,
|
|
116
|
-
check
|
|
25
|
+
engine: ENGINE,
|
|
26
|
+
...(await viteBuild(projectDir))
|
|
117
27
|
};
|
|
118
28
|
}
|
|
119
|
-
/**
|
|
120
|
-
* metadata.json(원본에 직접 쓴 것 포함)의 build에 값을 더한다. 옛 완료 정책 필드 · 화면은 zip에서 뺀다 (완료 정책은
|
|
121
|
-
* LXP 설정, ADR 0012. 원본에 남은 것은 검사가 manifest.completion-policies-ignored로 알림). 형식이 틀리면 그대로 두고
|
|
122
|
-
* 검사가 알려 준다
|
|
123
|
-
*/
|
|
124
|
-
function withBuildStamp(files, stamp) {
|
|
125
|
-
return files.map(f => {
|
|
126
|
-
if (f.path !== rules.manifest.file) return f;
|
|
127
|
-
try {
|
|
128
|
-
const raw = JSON.parse(new TextDecoder().decode(f.data));
|
|
129
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return f;
|
|
130
|
-
const next = {
|
|
131
|
-
...stripCompletionPolicy(raw),
|
|
132
|
-
build: {
|
|
133
|
-
...raw.build,
|
|
134
|
-
...stamp
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
...f,
|
|
139
|
-
data: new TextEncoder().encode(`${JSON.stringify(next, null, 2)}\n`)
|
|
140
|
-
};
|
|
141
|
-
} catch {
|
|
142
|
-
return f;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
29
|
const REASON = {
|
|
147
30
|
secret: '정답·비밀',
|
|
148
31
|
dev: '개발용',
|
|
@@ -150,7 +33,7 @@ const REASON = {
|
|
|
150
33
|
project: '프로젝트 파일',
|
|
151
34
|
link: '심볼릭 링크 · 특수 파일: 따라가지 않음. 실제 파일로 복사해 넣어 주세요',
|
|
152
35
|
config: '설정 exclude',
|
|
153
|
-
sdk: '
|
|
36
|
+
sdk: 'SDK 복사본: SDK는 package.json 의존성을 번들로 묶음. 지워 주세요'
|
|
154
37
|
};
|
|
155
38
|
function formatText(projectDir, r) {
|
|
156
39
|
const lines = [];
|
|
@@ -159,19 +42,13 @@ function formatText(projectDir, r) {
|
|
|
159
42
|
for (const e of r.excluded) lines.push(` - ${e.path} (${REASON[e.reason]})`);
|
|
160
43
|
lines.push('');
|
|
161
44
|
}
|
|
162
|
-
const kb = n => `${(n / 1024).toFixed(1)}KB`;
|
|
163
|
-
if (r.minify) {
|
|
164
|
-
lines.push(`minify: 파일 ${r.minify.files}개 ${kb(r.minify.before)} → ${kb(r.minify.after)} (zip에 넣는 내용만, 검사는 원본으로)`);
|
|
165
|
-
if (r.minify.maps) lines.push(`sourcemap: .map ${r.minify.maps.files}개 ${kb(r.minify.maps.bytes)} 추가`);
|
|
166
|
-
lines.push('');
|
|
167
|
-
}
|
|
168
45
|
if (r.unreferenced.length > 0) {
|
|
169
46
|
lines.push(`참고: 어디서도 이름이 나오지 않는 파일 ${r.unreferenced.length}개 (쓰지 않으면 빼서 용량을 줄이세요)`, ...r.unreferenced.map(p => ` - ${p}`), '');
|
|
170
47
|
}
|
|
171
48
|
lines.push(...formatIssues(r.check));
|
|
172
49
|
if (r.check.issues.length > 0) lines.push('');
|
|
173
50
|
const rel = p => relative(projectDir, p) || '.';
|
|
174
|
-
lines.push(r.ok && r.zip ? `[ok] ${rel(r.zip)} · 파일 ${r.files.length}개 · ${(r.zipBytes / 1024).toFixed(1)}KB (엔진 ${r.engine}, 규칙 ${r.check.rulesVersion})` : `[fail] 검사 오류가 있어 zip을 만들지 않았습니다. 결과물 확인: ${rel(join(r.outDir, 'content'))}`);
|
|
51
|
+
lines.push(r.ok && r.zip ? `[ok] ${rel(r.zip)} · 파일 ${r.files.length}개 · ${(r.zipBytes / 1024).toFixed(1)}KB (엔진 ${r.engine}${r.minify ? ' · minify' : ''}, 규칙 ${r.check.rulesVersion})` : `[fail] 검사 오류가 있어 zip을 만들지 않았습니다. 결과물 확인: ${rel(join(r.outDir, 'content'))}`);
|
|
175
52
|
return lines.join('\n');
|
|
176
53
|
}
|
|
177
54
|
async function run(args) {
|
|
@@ -21,6 +21,8 @@ export interface CreateResult {
|
|
|
21
21
|
theme: ThemeName;
|
|
22
22
|
files: string[];
|
|
23
23
|
}
|
|
24
|
+
/** 키트 내용 편집기 파일 (편집 화면이 useContentEditor를 쓰는 템플릿에만 복사) */
|
|
25
|
+
export declare const CONTENT_EDITOR_FILES: string[];
|
|
24
26
|
/**
|
|
25
27
|
* 템플릿(화면 · metadata.json · package.json)과 공통 lib/(화면 키트 · 기본 스타일 · 로컬 mock)를 새 폴더에 복사한다.
|
|
26
28
|
* SDK(@eliceio/cdk)는 package.json 의존성이라 복사하지 않는다 (설치는 create 명령이 npm install로, build가 zip lib/cdk.js로 넣음).
|
|
@@ -20,6 +20,15 @@ async function listFiles(dir, base = '') {
|
|
|
20
20
|
}
|
|
21
21
|
return out.sort();
|
|
22
22
|
}
|
|
23
|
+
/** 키트 내용 편집기 파일 (편집 화면이 useContentEditor를 쓰는 템플릿에만 복사) */
|
|
24
|
+
const CONTENT_EDITOR_FILES = ['lib/elice-content-editor.js', 'lib/elice-content-editor.d.ts'];
|
|
25
|
+
/** 템플릿 화면 코드(screens/)가 키트 내용 편집기를 부르는지 */
|
|
26
|
+
async function usesContentEditor(templateDir) {
|
|
27
|
+
const screens = join(templateDir, 'screens');
|
|
28
|
+
const files = await readdir(screens).catch(() => []);
|
|
29
|
+
for (const f of files.filter(n => n.endsWith('.js'))) if ((await readFile(join(screens, f), 'utf8')).includes('elice-content-editor.js')) return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
23
32
|
/**
|
|
24
33
|
* 템플릿(화면 · metadata.json · package.json)과 공통 lib/(화면 키트 · 기본 스타일 · 로컬 mock)를 새 폴더에 복사한다.
|
|
25
34
|
* SDK(@eliceio/cdk)는 package.json 의존성이라 복사하지 않는다 (설치는 create 명령이 npm install로, build가 zip lib/cdk.js로 넣음).
|
|
@@ -44,6 +53,11 @@ async function createProject(options) {
|
|
|
44
53
|
await cp(join(TEMPLATE_ROOT, options.template), dir, {
|
|
45
54
|
recursive: true
|
|
46
55
|
});
|
|
56
|
+
// 키트 내용 편집기(lib/elice-content-editor.js, 약 40KB)는 템플릿 화면이 부를 때만 둔다.
|
|
57
|
+
// zip에 그대로 들어가므로, 쓰지 않는 템플릿(quiz는 자기 편집 화면)의 zip을 키우지 않게
|
|
58
|
+
if (!(await usesContentEditor(join(TEMPLATE_ROOT, options.template)))) for (const f of CONTENT_EDITOR_FILES) await rm(join(dir, f), {
|
|
59
|
+
force: true
|
|
60
|
+
});
|
|
47
61
|
// template.json은 CLI가 템플릿을 고를 때만 쓴다 (프로젝트 · zip에는 넣지 않음)
|
|
48
62
|
await rm(join(dir, 'template.json'), {
|
|
49
63
|
force: true
|
|
@@ -89,4 +103,4 @@ async function createProject(options) {
|
|
|
89
103
|
};
|
|
90
104
|
}
|
|
91
105
|
|
|
92
|
-
export { TEMPLATES, THEMES, createProject };
|
|
106
|
+
export { CONTENT_EDITOR_FILES, TEMPLATES, THEMES, createProject };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ContentConfig } from '../../core/config.js';
|
|
2
2
|
import { type LatestResult } from '../../core/latest.js';
|
|
3
|
+
import { type McpEnv } from '../../core/mcp.js';
|
|
3
4
|
import { type TemplateInfo } from '../../core/templates.js';
|
|
4
|
-
import { type McpEnv } from '../mcp/index.js';
|
|
5
5
|
import type { CommandResult } from '../../types.js';
|
|
6
6
|
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk doctor [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] [--fix] [--json]\n\n \uD658\uACBD(Node, \uD328\uD0A4\uC9C0 \uB9E4\uB2C8\uC800)\uACFC \uD504\uB85C\uC81D\uD2B8(\uC124\uC815, \uC6D0\uBCF8, \uC815\uB2F5 \uC720\uCD9C, \uAC80\uC0AC)\uB97C \uC810\uAC80\uD55C\uB2E4.\n --fix \uC790\uB3D9\uC73C\uB85C \uACE0\uCE60 \uC218 \uC788\uB294 \uD56D\uBAA9(auto)\uC744 \uACE0\uCE5C\uB2E4\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uC2E4\uD328 \uC5C6\uC74C \u00B7 1 \uC2E4\uD328 \uC788\uC74C \u00B7 2 \uC798\uBABB\uB41C \uC0AC\uC6A9";
|
|
7
7
|
export type DoctorLevel = 'ok' | 'warn' | 'fail' | 'skip';
|
|
@@ -47,8 +47,9 @@ export declare function checkLatest(latest: LatestResult, current?: string): Doc
|
|
|
47
47
|
/** dir부터 위로 올라가며 <폴더>/.claude/skills 목록. 홈 폴더나 파일 시스템 루트에서 멈춘다 (홈은 사용자 위치라 따로) */
|
|
48
48
|
export declare function projectSkillDirs(dir: string, home?: string): string[];
|
|
49
49
|
/**
|
|
50
|
-
* SDK 의존성 (ADR 0010
|
|
51
|
-
* package.json에 없고 옛 lib/cdk.js
|
|
50
|
+
* SDK 의존성 (ADR 0010): package.json의 @eliceio/cdk가 설치됐는지, rules.json minVersions.sdk 이상인지.
|
|
51
|
+
* package.json에 없고 SDK 복사본(옛 lib/cdk.js)만 있으면 실패로 알리고 (build가 복사본을 넣지 않음),
|
|
52
|
+
* --fix가 package.json dependencies에 넣는다 (npm install · 키트 바꾸기는 직접)
|
|
52
53
|
*/
|
|
53
54
|
export declare function checkDeps(dir: string, config: ContentConfig): Promise<Pending>;
|
|
54
55
|
/** 학습자료 서버 MCP(elice-material)가 찾은 도구 중 하나에라도 등록돼 있는지 (읽기만) */
|
|
@@ -4,17 +4,17 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { resolve, join, dirname } from 'node:path';
|
|
5
5
|
import { loadConfig, CONFIG_FILE, planLegacyMigration, applyLegacyMigration, PACKAGE_FILE, PACKAGE_CONFIG_KEY, legacyGradingTypesWarning, legacyCompletionWarning, loadGrading, SETTINGS_DATA_FILE } from '../../core/config.js';
|
|
6
6
|
import { NO_UPDATE_CHECK_ENV, npmLatest, isNewer, LATEST_DOCTOR_TIMEOUT_MS } from '../../core/latest.js';
|
|
7
|
+
import { defaultMcpEnv, detectTargets, claudeRegistration, helpyRegisteredUrl, MCP_NAME, envOfUrl } from '../../core/mcp.js';
|
|
7
8
|
import { prepareContent } from '../../core/prepare.js';
|
|
8
9
|
import { projectCheckOptions, findLegacySdkCopy } from '../../core/project-check.js';
|
|
9
10
|
import { readProjectSdk, SDK_PACKAGE, INSTALL_COMMAND, UPDATE_COMMAND } from '../../core/sdk.js';
|
|
11
|
+
import { skillsDir, skillNames, inspectSkill, GUIDE_SKILL } from '../../core/skills.js';
|
|
10
12
|
import { parseTemplateRef, listTemplates } from '../../core/templates.js';
|
|
11
13
|
import { checkFiles } from '../../rules/check.js';
|
|
12
14
|
import { RULES_VERSION, rules } from '../../rules/spec.js';
|
|
13
15
|
import { lineSkipper } from '../../rules/skip.js';
|
|
14
16
|
import 'fflate';
|
|
15
17
|
import { VERSION } from '../../version.js';
|
|
16
|
-
import { defaultMcpEnv, detectTargets, claudeRegistration, helpyRegisteredUrl, envOfUrl, MCP_NAME } from '../mcp/index.js';
|
|
17
|
-
import { skillsDir, skillNames, inspectSkill, GUIDE_SKILL } from '../skill/index.js';
|
|
18
18
|
import { compareVersions } from '../../rules/semver.js';
|
|
19
19
|
|
|
20
20
|
const usage = `사용법: ecdk doctor [프로젝트 폴더] [--fix] [--json]
|
|
@@ -92,7 +92,7 @@ async function checkGitignore(dir, config) {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
/** 없어진 명령(ecdk check → ecdk validate)을 부르는 package.json scripts (옛 ecdk create로 만든
|
|
95
|
+
/** 없어진 명령(ecdk check → ecdk validate)을 부르는 package.json scripts (옛 ecdk create로 만든 프로젝트) */
|
|
96
96
|
const STALE_SCRIPT = /\becdk check\b/;
|
|
97
97
|
async function checkScripts(dir) {
|
|
98
98
|
const path = join(dir, PACKAGE_FILE);
|
|
@@ -354,8 +354,9 @@ async function checkConfig(dir, config) {
|
|
|
354
354
|
};
|
|
355
355
|
}
|
|
356
356
|
/**
|
|
357
|
-
* SDK 의존성 (ADR 0010
|
|
358
|
-
* package.json에 없고 옛 lib/cdk.js
|
|
357
|
+
* SDK 의존성 (ADR 0010): package.json의 @eliceio/cdk가 설치됐는지, rules.json minVersions.sdk 이상인지.
|
|
358
|
+
* package.json에 없고 SDK 복사본(옛 lib/cdk.js)만 있으면 실패로 알리고 (build가 복사본을 넣지 않음),
|
|
359
|
+
* --fix가 package.json dependencies에 넣는다 (npm install · 키트 바꾸기는 직접)
|
|
359
360
|
*/
|
|
360
361
|
async function checkDeps(dir, config) {
|
|
361
362
|
const id = 'project.deps';
|
|
@@ -370,10 +371,10 @@ async function checkDeps(dir, config) {
|
|
|
370
371
|
};
|
|
371
372
|
return {
|
|
372
373
|
id,
|
|
373
|
-
level: '
|
|
374
|
-
message:
|
|
374
|
+
level: 'fail',
|
|
375
|
+
message: `${copy}(SDK 복사본)만 있고 package.json에 ${SDK_PACKAGE}가 없습니다. SDK는 package.json 의존성을 ecdk build가 번들로 묶습니다 (복사본은 zip에 넣지 않음). --fix로 넣은 뒤 ${INSTALL_COMMAND}을 실행해 주세요.`,
|
|
375
376
|
fix: {
|
|
376
|
-
description: `package.json dependencies에 "${SDK_PACKAGE}": "^${min}" 넣기 (그다음 ${INSTALL_COMMAND}, ${copy}
|
|
377
|
+
description: `package.json dependencies에 "${SDK_PACKAGE}": "^${min}" 넣기 (그다음 ${INSTALL_COMMAND}, 키트를 새 lib/elice-content.js로 바꾸고 ${copy} 지우기)`,
|
|
377
378
|
auto: true
|
|
378
379
|
},
|
|
379
380
|
apply: async () => {
|
|
@@ -457,8 +458,7 @@ function checkMcp(env) {
|
|
|
457
458
|
found.push(`${t === 'claude' ? 'Claude Code' : 'Helpy Code'}(${name})`);
|
|
458
459
|
}
|
|
459
460
|
const extra = notes.length > 0 ? ` · ${notes.join(' · ')}` : '';
|
|
460
|
-
const
|
|
461
|
-
const note = notProd.length > 0 ? ` — ${notProd.map(e => e === 'custom' ? '직접 지정한 서버' : `QA 환경(${e})`).join(' · ')}에 연결됨, 운영 자료를 올리지 마세요` : '';
|
|
461
|
+
const note = envs.has('custom') ? ' — 직접 지정한 서버(--url)에 연결됨, 운영 자료를 올리지 마세요' : '';
|
|
462
462
|
if (found.length > 0) return {
|
|
463
463
|
id,
|
|
464
464
|
level: 'ok',
|
|
@@ -505,9 +505,7 @@ async function doctor(target, opts) {
|
|
|
505
505
|
let prepared = null;
|
|
506
506
|
try {
|
|
507
507
|
// SDK 설치 여부는 project.deps가 알린다
|
|
508
|
-
prepared = await prepareContent(dir, config
|
|
509
|
-
requireSdk: false
|
|
510
|
-
});
|
|
508
|
+
prepared = await prepareContent(dir, config);
|
|
511
509
|
} catch (e) {
|
|
512
510
|
checks.push({
|
|
513
511
|
id: 'project.root',
|
|
@@ -542,7 +540,9 @@ async function doctor(target, opts) {
|
|
|
542
540
|
level: 'ok',
|
|
543
541
|
message: '콘텐츠가 정답·설정 파일을 참조하지 않음'
|
|
544
542
|
});
|
|
545
|
-
const result = checkFiles(files, await projectCheckOptions(dir, config
|
|
543
|
+
const result = checkFiles(files, await projectCheckOptions(dir, config, {
|
|
544
|
+
publicFiles: prepared.publicFiles
|
|
545
|
+
}));
|
|
546
546
|
const errors = result.issues.filter(i => i.level === 'error');
|
|
547
547
|
const warns = result.issues.length - errors.length;
|
|
548
548
|
checks.push(errors.length > 0 ? {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { type McpEnv, type SetupResult } from '../../core/mcp.js';
|
|
1
2
|
import { type DoctorCheck } from '../doctor/index.js';
|
|
2
|
-
import { type McpEnv, type SetupResult } from '../mcp/index.js';
|
|
3
3
|
import type { CommandResult } from '../../types.js';
|
|
4
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk setup [--only skills|mcp] [--project] [--
|
|
4
|
+
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk setup [--only skills|mcp] [--project] [--url <\uC8FC\uC18C>] [--target claude|helpycode|all] [--force] [--json]\n\n \uCC98\uC74C \uD55C \uBC88 \uC2E4\uD589\uD55C\uB2E4 (\uB2E4\uC2DC \uC2E4\uD589\uD574\uB3C4 \uB41C\uB2E4: \uC788\uB294 \uAC83\uC740 \uAC74\uB108\uB6F0\uACE0 \uC61B \uAC83 \u00B7 \uBE60\uC9C4 \uAC83\uB9CC \uACE0\uCE5C\uB2E4). --only \uC5C6\uC774\uB294 \uCC28\uB840\uB85C:\n 1. \uC2A4\uD0AC \uC124\uCE58 (--only skills\uC640 \uAC19\uC74C, ~/.claude/skills/)\n 2. \uD559\uC2B5\uC790\uB8CC \uC11C\uBC84 MCP \uB4F1\uB85D (--only mcp\uC640 \uAC19\uC74C, \uC635\uC158\uB3C4 \uAC19\uC74C)\n 3. \uC810\uAC80 \uC694\uC57D (Node \u00B7 \uC2A4\uD0AC \u00B7 MCP)\n 4. \uB3C4\uAD6C\uBCC4 \uB85C\uADF8\uC778 \uC548\uB0B4\n MCP\uB294 \uC544\uC9C1 \uBC30\uD3EC\uB418\uC9C0 \uC54A\uC558\uAC70\uB098 \uC9C1\uC811 \uD560 \uC77C\uC774 \uC788\uC5B4\uB3C4 \uC2E4\uD328\uB85C \uCE58\uC9C0 \uC54A\uB294\uB2E4 (\"\uC9C1\uC811 \uD560 \uC77C\"\uC5D0 \uC801\uC74C, \uC2A4\uD0AC\uC774 \uC4F8 \uC218 \uC788\uC73C\uBA74 \uC885\uB8CC \uCF54\uB4DC 0).\n\n --only skills: Claude Code \uC2A4\uD0AC(stub)\uACFC \uACF5\uC720 \uAC1C\uBC1C \uAC00\uC774\uB4DC \uC2A4\uD0AC(elice-content-guide)\uB9CC \uC124\uCE58 \u00B7 \uAC31\uC2E0\uD55C\uB2E4\n \uAC19\uC740 \uBC84\uC804\uC774\uBA74 \uAC74\uB108\uB6F0\uACE0, \uC61B \uBC84\uC804\uC774\uBA74 \uBC14\uAFBC\uB2E4\n mcp: Elice \uD559\uC2B5\uC790\uB8CC \uC11C\uBC84 MCP(elice-material)\uB9CC AI \uB3C4\uAD6C\uC5D0 \uB4F1\uB85D\uD55C\uB2E4. \uC790\uB8CC\uB97C LXP\uC5D0 \uC62C\uB9AC\uB294 \uC2A4\uD0AC\uC774 \uC4F4\uB2E4\n \uB4F1\uB85D \uC804\uC5D0 \uC11C\uBC84\uC5D0 MCP\uAC00 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uACE0, \uB85C\uADF8\uC778\uC740 \uB4F1\uB85D \uB4A4 \uAC01 \uB3C4\uAD6C\uC5D0\uC11C \uD55C\uB2E4 (\uC548\uB0B4\uB97C \uCD9C\uB825\uD568)\n --project \uD604\uC7AC \uD3F4\uB354\uC758 .claude/skills/\uC5D0 \uC124\uCE58 (--only skills\uC5D0\uC11C\uB9CC)\n --url \uC11C\uBC84 MCP \uC8FC\uC18C (https, \uAE30\uBCF8\uC740 \uC6B4\uC601). MCP \uB4F1\uB85D\uC5D0\uB9CC\n --target MCP\uB97C \uB4F1\uB85D\uD560 \uB3C4\uAD6C claude(Claude Code) \u00B7 helpycode(Helpy Code \uB370\uC2A4\uD06C\uD1B1 \u00B7 CLI) \u00B7 all(\uCC3E\uC740 \uB3C4\uAD6C \uBAA8\uB450, \uAE30\uBCF8). MCP \uB4F1\uB85D\uC5D0\uB9CC\n --force --only skills: CLI\uBCF4\uB2E4 \uC0C8 \uBC84\uC804\uC774\uAC70\uB098 \uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC\uB3C4 \uBC14\uAFBC\uB2E4\n MCP \uB4F1\uB85D: \uC774\uBBF8 \uB2E4\uB978 \uC8FC\uC18C\uB85C \uB4F1\uB85D\uB3FC \uC788\uAC70\uB098 \uC11C\uBC84\uC5D0 MCP\uAC00 \uC5C6\uC5B4 \uBCF4\uC5EC\uB3C4 \uB4F1\uB85D\uD55C\uB2E4 (--only \uC5C6\uC774\uB294 MCP\uC5D0\uB9CC)\n\n\uC885\uB8CC \uCF54\uB4DC:\n --only \uC5C6\uC774 0 \uC2A4\uD0AC \uC124\uCE58\uB428(MCP\uB294 \uC9C1\uC811 \uD560 \uC77C\uC774 \uB0A8\uC544\uB3C4) \u00B7 1 \uC2A4\uD0AC\uC744 \uC124\uCE58\uD558\uC9C0 \uBABB\uD568\n --only skills 0 \uC131\uACF5 \u00B7 1 \uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC\uC774 \uC788\uC5B4 \uAC74\uB108\uB700\n --only mcp 0 \uC131\uACF5 \u00B7 1 \uC9C1\uC811 \uD560 \uC77C\uC774 \uC788\uC74C(\uC11C\uBC84\uC5D0 MCP \uC5C6\uC74C, \uC8FC\uC11D\uC774 \uC788\uB294 \uC124\uC815 \uD30C\uC77C, \uB2E4\uB978 \uC8FC\uC18C\uB85C \uB4F1\uB85D\uB428, \uB3C4\uAD6C\uB97C \uCC3E\uC9C0 \uBABB\uD568)\n \uBAA8\uB450 2 \uC798\uBABB\uB41C \uC0AC\uC6A9 (\uBAA8\uB974\uB294 --only \uAC12, --only skills\uC5D0 MCP \uC635\uC158, --project\uB97C --only skills \uC5C6\uC774)";
|
|
5
5
|
export interface SetupAllResult {
|
|
6
6
|
skills: {
|
|
7
7
|
ok: true;
|
|
8
8
|
dir: string;
|
|
9
9
|
version: string;
|
|
10
|
-
/** 설치 전에 스킬 폴더가 없어 이번에 만듦
|
|
10
|
+
/** 설치 전에 스킬 폴더가 없어 이번에 만듦 */
|
|
11
11
|
skillsDirCreated: boolean;
|
|
12
12
|
items: {
|
|
13
13
|
name: string;
|
|
@@ -26,7 +26,6 @@ export declare function setupAll(opts: {
|
|
|
26
26
|
envName: string;
|
|
27
27
|
url: string;
|
|
28
28
|
target: 'claude' | 'helpycode' | 'all';
|
|
29
|
-
dryRun: boolean;
|
|
30
29
|
force: boolean;
|
|
31
30
|
nodeVersion?: string | undefined;
|
|
32
31
|
}): Promise<SetupAllResult>;
|
|
@@ -34,10 +33,8 @@ export interface SetupArgs {
|
|
|
34
33
|
/** undefined: 스킬 + MCP + 점검. skills · mcp: 그것만 */
|
|
35
34
|
only: string | undefined;
|
|
36
35
|
project: boolean;
|
|
37
|
-
target: string | undefined;
|
|
38
|
-
envName: string | undefined;
|
|
39
36
|
url: string | undefined;
|
|
40
|
-
|
|
37
|
+
target: string | undefined;
|
|
41
38
|
force: boolean;
|
|
42
39
|
json: boolean;
|
|
43
40
|
env?: McpEnv | undefined;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
+
import { defaultMcpEnv, formatSetupLines, NEEDS_PERSON, resolveUrl, setup } from '../../core/mcp.js';
|
|
2
|
+
import { reloadNotes, install } from '../../core/skills.js';
|
|
1
3
|
import { checkNode, checkSkills, checkMcp } from '../doctor/index.js';
|
|
2
|
-
import { defaultMcpEnv, resolveUrl, formatSetupLines, NEEDS_PERSON, setup } from '../mcp/index.js';
|
|
3
|
-
import { reloadNotes, planInstall, install } from '../skill/index.js';
|
|
4
4
|
|
|
5
|
-
const usage = `사용법: ecdk setup [--only skills|mcp] [--project] [--
|
|
5
|
+
const usage = `사용법: ecdk setup [--only skills|mcp] [--project] [--url <주소>] [--target claude|helpycode|all] [--force] [--json]
|
|
6
6
|
|
|
7
|
-
처음 한 번
|
|
7
|
+
처음 한 번 실행한다 (다시 실행해도 된다: 있는 것은 건너뛰고 옛 것 · 빠진 것만 고친다). --only 없이는 차례로:
|
|
8
8
|
1. 스킬 설치 (--only skills와 같음, ~/.claude/skills/)
|
|
9
9
|
2. 학습자료 서버 MCP 등록 (--only mcp와 같음, 옵션도 같음)
|
|
10
10
|
3. 점검 요약 (Node · 스킬 · MCP)
|
|
11
11
|
4. 도구별 로그인 안내
|
|
12
12
|
MCP는 아직 배포되지 않았거나 직접 할 일이 있어도 실패로 치지 않는다 ("직접 할 일"에 적음, 스킬이 쓸 수 있으면 종료 코드 0).
|
|
13
|
-
--force는 MCP 등록에만 쓴다. 손으로 고친 스킬까지 바꾸려면 ecdk setup --only skills --force.
|
|
14
13
|
|
|
15
|
-
--only
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
--dry-run 무엇을 바꿀지 보여 주기만 한다 (서버 확인도 하지 않음)
|
|
14
|
+
--only skills: Claude Code 스킬(stub)과 공유 개발 가이드 스킬(elice-content-guide)만 설치 · 갱신한다
|
|
15
|
+
같은 버전이면 건너뛰고, 옛 버전이면 바꾼다
|
|
16
|
+
mcp: Elice 학습자료 서버 MCP(elice-material)만 AI 도구에 등록한다. 자료를 LXP에 올리는 스킬이 쓴다
|
|
17
|
+
등록 전에 서버에 MCP가 있는지 확인하고, 로그인은 등록 뒤 각 도구에서 한다 (안내를 출력함)
|
|
18
|
+
--project 현재 폴더의 .claude/skills/에 설치 (--only skills에서만)
|
|
19
|
+
--url 서버 MCP 주소 (https, 기본은 운영). MCP 등록에만
|
|
20
|
+
--target MCP를 등록할 도구 claude(Claude Code) · helpycode(Helpy Code 데스크톱 · CLI) · all(찾은 도구 모두, 기본). MCP 등록에만
|
|
21
|
+
--force --only skills: CLI보다 새 버전이거나 손으로 고친 스킬도 바꾼다
|
|
22
|
+
MCP 등록: 이미 다른 주소로 등록돼 있거나 서버에 MCP가 없어 보여도 등록한다 (--only 없이는 MCP에만)
|
|
25
23
|
|
|
26
24
|
종료 코드:
|
|
27
25
|
--only 없이 0 스킬 설치됨(MCP는 직접 할 일이 남아도) · 1 스킬을 설치하지 못함
|
|
@@ -33,58 +31,40 @@ const SKILL_ACTION = {
|
|
|
33
31
|
updated: '바꿈',
|
|
34
32
|
skipped: '최신이라 건너뜀',
|
|
35
33
|
kept: '손으로 고친 스킬이라 그대로 둠',
|
|
36
|
-
newer: 'CLI보다 새 버전이라 그대로 둠'
|
|
37
|
-
'would-install': '설치할 예정',
|
|
38
|
-
'would-update': '바꿀 예정'
|
|
34
|
+
newer: 'CLI보다 새 버전이라 그대로 둠'
|
|
39
35
|
};
|
|
40
36
|
async function setupAll(opts) {
|
|
41
37
|
const {
|
|
42
38
|
env
|
|
43
39
|
} = opts;
|
|
44
40
|
let skills;
|
|
45
|
-
|
|
46
|
-
const
|
|
41
|
+
try {
|
|
42
|
+
const r = await install({
|
|
47
43
|
project: false,
|
|
48
44
|
force: false,
|
|
49
45
|
home: env.home
|
|
50
46
|
});
|
|
51
47
|
skills = {
|
|
52
48
|
ok: true,
|
|
53
|
-
dir:
|
|
54
|
-
version:
|
|
55
|
-
skillsDirCreated:
|
|
56
|
-
items:
|
|
49
|
+
dir: r.dir,
|
|
50
|
+
version: r.version,
|
|
51
|
+
skillsDirCreated: r.skillsDirCreated,
|
|
52
|
+
items: r.skills.map(s => ({
|
|
53
|
+
name: s.name,
|
|
54
|
+
action: s.action
|
|
55
|
+
}))
|
|
56
|
+
};
|
|
57
|
+
} catch (e) {
|
|
58
|
+
skills = {
|
|
59
|
+
ok: false,
|
|
60
|
+
error: e.message
|
|
57
61
|
};
|
|
58
|
-
} else {
|
|
59
|
-
try {
|
|
60
|
-
const r = await install({
|
|
61
|
-
project: false,
|
|
62
|
-
force: false,
|
|
63
|
-
home: env.home
|
|
64
|
-
});
|
|
65
|
-
skills = {
|
|
66
|
-
ok: true,
|
|
67
|
-
dir: r.dir,
|
|
68
|
-
version: r.version,
|
|
69
|
-
skillsDirCreated: r.skillsDirCreated,
|
|
70
|
-
items: r.skills.map(s => ({
|
|
71
|
-
name: s.name,
|
|
72
|
-
action: s.action
|
|
73
|
-
}))
|
|
74
|
-
};
|
|
75
|
-
} catch (e) {
|
|
76
|
-
skills = {
|
|
77
|
-
ok: false,
|
|
78
|
-
error: e.message
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
62
|
}
|
|
82
63
|
const mcp = await setup({
|
|
83
64
|
env,
|
|
84
65
|
envName: opts.envName,
|
|
85
66
|
url: opts.url,
|
|
86
67
|
target: opts.target,
|
|
87
|
-
dryRun: opts.dryRun,
|
|
88
68
|
force: opts.force
|
|
89
69
|
});
|
|
90
70
|
const checks = [checkNode(opts.nodeVersion ?? process.version), checkSkills(env.home, env.home), checkMcp(env)];
|
|
@@ -93,7 +73,7 @@ async function setupAll(opts) {
|
|
|
93
73
|
{
|
|
94
74
|
if (mcp.targets.length === 0) todo.push('MCP: Claude Code나 Helpy Code를 찾지 못했습니다. 설치한 뒤 ecdk setup을 다시 실행하세요.');
|
|
95
75
|
for (const s of mcp.steps) {
|
|
96
|
-
if (s.action === 'unreachable') todo.push(`MCP(${s.target}): 아직 배포되지 않아 건너뜀 (배포 뒤 ecdk setup 다시 실행)
|
|
76
|
+
if (s.action === 'unreachable') todo.push(`MCP(${s.target}): 아직 배포되지 않아 건너뜀 (배포 뒤 ecdk setup 다시 실행)`);else if (NEEDS_PERSON.includes(s.action)) todo.push(`MCP(${s.target}): ${s.message}`);
|
|
97
77
|
}
|
|
98
78
|
}
|
|
99
79
|
return {
|
|
@@ -109,14 +89,14 @@ const usageError = message => ({
|
|
|
109
89
|
});
|
|
110
90
|
async function run(args) {
|
|
111
91
|
if (args.only !== undefined && args.only !== 'skills' && args.only !== 'mcp') return usageError(`--only는 skills · mcp 중 하나입니다: ${args.only}`);
|
|
112
|
-
const mcpOptions = [args.
|
|
92
|
+
const mcpOptions = [args.url !== undefined && '--url', args.target !== undefined && '--target'].filter(Boolean);
|
|
113
93
|
if (args.only === 'skills' && mcpOptions.length > 0) return usageError(`${mcpOptions.join(' · ')}은 MCP 등록 옵션이라 --only skills와 같이 쓸 수 없습니다 (--only mcp 또는 --only 없이).`);
|
|
114
94
|
if (args.project && args.only !== 'skills') return usageError('--project는 --only skills와 같이 씁니다 (MCP 등록 · 전체 setup은 모든 프로젝트가 같이 쓰는 사용자 범위).');
|
|
115
95
|
if (args.only === 'skills') return runSkills(args);
|
|
116
96
|
const target = args.target ?? 'all';
|
|
117
97
|
if (target !== 'claude' && target !== 'helpycode' && target !== 'all') return usageError('--target은 claude · helpycode · all 중 하나입니다.');
|
|
118
98
|
const env = args.env ?? defaultMcpEnv();
|
|
119
|
-
const resolved = resolveUrl(args
|
|
99
|
+
const resolved = resolveUrl(args);
|
|
120
100
|
if (!resolved.ok) return usageError(resolved.error);
|
|
121
101
|
if (args.only === 'mcp') return runMcp(args, env, target, resolved);
|
|
122
102
|
const result = await setupAll({
|
|
@@ -124,7 +104,6 @@ async function run(args) {
|
|
|
124
104
|
envName: resolved.envName,
|
|
125
105
|
url: resolved.url,
|
|
126
106
|
target,
|
|
127
|
-
dryRun: args.dryRun,
|
|
128
107
|
force: args.force,
|
|
129
108
|
nodeVersion: args.nodeVersion
|
|
130
109
|
});
|
|
@@ -135,18 +114,18 @@ async function run(args) {
|
|
|
135
114
|
output: JSON.stringify(result, null, 2)
|
|
136
115
|
};
|
|
137
116
|
const lines = [];
|
|
138
|
-
lines.push(
|
|
117
|
+
lines.push('1. 스킬');
|
|
139
118
|
if (result.skills.ok) {
|
|
140
119
|
lines.push(` 위치: ${result.skills.dir}${result.skills.version ? ` (ecdk ${result.skills.version})` : ''}`);
|
|
141
120
|
for (const s of result.skills.items) lines.push(` ${s.name}: ${SKILL_ACTION[s.action] ?? s.action}`);
|
|
142
121
|
} else lines.push(` 설치하지 못함: ${result.skills.error}`);
|
|
143
122
|
lines.push('', '2. 학습자료 서버 MCP');
|
|
144
123
|
{
|
|
145
|
-
if (result.mcp.targets.length === 0) lines.push(' Claude Code · Helpy Code를 찾지 못함');else lines.push(...formatSetupLines(result.mcp, resolved.source
|
|
124
|
+
if (result.mcp.targets.length === 0) lines.push(' Claude Code · Helpy Code를 찾지 못함');else lines.push(...formatSetupLines(result.mcp, resolved.source).map(l => ` ${l}`));
|
|
146
125
|
}
|
|
147
126
|
lines.push('', '3. 점검');
|
|
148
127
|
for (const c of result.checks) lines.push(` [${c.level}] ${c.id.padEnd(16)} ${c.message}`);
|
|
149
|
-
// 등록했거나
|
|
128
|
+
// 등록했거나 이미 등록된 도구가 있을 때만 로그인 안내 (배포 전이면 할 수 없음)
|
|
150
129
|
if (result.mcp.steps.some(s => !NEEDS_PERSON.includes(s.action))) {
|
|
151
130
|
lines.push('', '4. 로그인 (MCP를 등록한 도구에서, 자료를 LXP에 올릴 때 필요)');
|
|
152
131
|
for (const l of result.mcp.login) lines.push(` - ${l}`);
|
|
@@ -156,7 +135,7 @@ async function run(args) {
|
|
|
156
135
|
for (const t of result.todo) lines.push(` - ${t}`);
|
|
157
136
|
}
|
|
158
137
|
lines.push('');
|
|
159
|
-
if (!result.skills.ok) lines.push('스킬 설치가 끝나지 않았습니다. 위 오류를 확인하세요.');else
|
|
138
|
+
if (!result.skills.ok) lines.push('스킬 설치가 끝나지 않았습니다. 위 오류를 확인하세요.');else lines.push(...reloadNotes(result.skills.skillsDirCreated));
|
|
160
139
|
return {
|
|
161
140
|
exitCode,
|
|
162
141
|
output: lines.join('\n')
|
|
@@ -169,17 +148,13 @@ const SKILLS_ONLY_ACTION = {
|
|
|
169
148
|
};
|
|
170
149
|
/** --only skills: 스킬만 설치 · 갱신 (손으로 고친 스킬 · 더 새 스킬은 --force일 때만) */
|
|
171
150
|
async function runSkills(args) {
|
|
172
|
-
const
|
|
151
|
+
const r = await install({
|
|
173
152
|
project: args.project,
|
|
174
153
|
force: args.force,
|
|
175
154
|
cwd: args.cwd,
|
|
176
155
|
home: args.env?.home
|
|
177
|
-
};
|
|
178
|
-
const result =
|
|
179
|
-
...planInstall(where),
|
|
180
|
-
version: '',
|
|
181
|
-
skillsDirCreated: false
|
|
182
|
-
} : await install(where).then(r => ({
|
|
156
|
+
});
|
|
157
|
+
const result = {
|
|
183
158
|
dir: r.dir,
|
|
184
159
|
version: r.version,
|
|
185
160
|
skillsDirCreated: r.skillsDirCreated,
|
|
@@ -187,12 +162,9 @@ async function runSkills(args) {
|
|
|
187
162
|
name: s.name,
|
|
188
163
|
action: s.action
|
|
189
164
|
}))
|
|
190
|
-
}
|
|
165
|
+
};
|
|
191
166
|
const kept = result.skills.some(s => s.action === 'kept');
|
|
192
|
-
const output = args.json ? JSON.stringify({
|
|
193
|
-
dryRun: args.dryRun,
|
|
194
|
-
...result
|
|
195
|
-
}, null, 2) : [`스킬 위치: ${result.dir}${result.version ? ` (ecdk ${result.version})` : ''}${args.dryRun ? ' · 미리보기(--dry-run)' : ''}`, ...result.skills.map(s => ` ${s.name}: ${SKILLS_ONLY_ACTION[s.action] ?? s.action}`), '', ...(args.dryRun ? ['--dry-run이라 아무것도 쓰지 않았습니다.'] : reloadNotes(result.skillsDirCreated))].join('\n');
|
|
167
|
+
const output = args.json ? JSON.stringify(result, null, 2) : [`스킬 위치: ${result.dir} (ecdk ${result.version})`, ...result.skills.map(s => ` ${s.name}: ${SKILLS_ONLY_ACTION[s.action] ?? s.action}`), '', ...reloadNotes(result.skillsDirCreated)].join('\n');
|
|
196
168
|
return {
|
|
197
169
|
exitCode: kept ? 1 : 0,
|
|
198
170
|
output
|
|
@@ -210,7 +182,6 @@ async function runMcp(args, env, target, resolved) {
|
|
|
210
182
|
envName,
|
|
211
183
|
url,
|
|
212
184
|
target,
|
|
213
|
-
dryRun: args.dryRun,
|
|
214
185
|
force: args.force
|
|
215
186
|
});
|
|
216
187
|
const needsPerson = result.steps.some(s => NEEDS_PERSON.includes(s.action));
|
|
@@ -222,7 +193,7 @@ async function runMcp(args, env, target, resolved) {
|
|
|
222
193
|
exitCode: 1,
|
|
223
194
|
output: 'Claude Code나 Helpy Code를 찾지 못했습니다. 설치한 뒤 다시 실행하거나 --target을 지정하세요.'
|
|
224
195
|
};
|
|
225
|
-
const lines = [...formatSetupLines(result, source
|
|
196
|
+
const lines = [...formatSetupLines(result, source), '', '다음: 각 도구에서 로그인', ...result.login.map(l => ` - ${l}`)];
|
|
226
197
|
return {
|
|
227
198
|
exitCode: needsPerson ? 1 : 0,
|
|
228
199
|
output: lines.join('\n')
|