@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +288 -200
- package/es/cli.js +70 -66
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +27 -15
- package/es/commands/create/index.d.ts +5 -1
- package/es/commands/create/index.js +34 -15
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +4 -1
- package/es/commands/create/scaffold.js +19 -13
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +5 -5
- package/es/commands/doctor/index.d.ts +29 -2
- package/es/commands/doctor/index.js +253 -55
- package/es/commands/mcp/index.d.ts +0 -12
- package/es/commands/mcp/index.js +6 -57
- package/es/commands/setup/index.d.ts +11 -3
- package/es/commands/setup/index.js +112 -37
- package/es/commands/skill/index.d.ts +46 -8
- package/es/commands/skill/index.js +151 -35
- package/es/commands/uninstall/index.d.ts +54 -0
- package/es/commands/uninstall/index.js +304 -0
- package/es/commands/update/index.d.ts +59 -0
- package/es/commands/update/index.js +251 -0
- package/es/commands/validate/index.d.ts +18 -0
- package/es/commands/{check → validate}/index.js +16 -10
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +99 -50
- package/es/core/config.js +244 -91
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +48 -16
- package/es/core/project-check.d.ts +19 -8
- package/es/core/project-check.js +36 -9
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +2 -4
- package/es/core/templates.js +2 -5
- package/es/dev/grading.d.ts +7 -8
- package/es/dev/grading.js +6 -16
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +12 -10
- package/es/dev/mock-api.d.ts +13 -18
- package/es/dev/mock-api.js +56 -66
- package/es/dev/server.js +52 -52
- package/es/rules/check.js +43 -31
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/types.d.ts +18 -20
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/package.json +3 -4
- package/rules.json +27 -43
- package/skills/_shared/always.md +4 -4
- package/skills/elice-content-check/SKILL.md +11 -8
- package/skills/elice-content-create/SKILL.md +8 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +12 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
- package/skills/elice-content-guide/topics/09-check.md +10 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +8 -7
- package/skills/elice-content-publish/SKILL.md +8 -7
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +49 -144
- package/templates/_shared/lib/elice-content.css +68 -1
- package/templates/_shared/lib/elice-content.d.ts +11 -38
- package/templates/_shared/lib/elice-content.js +43 -248
- package/templates/blank/README.md +12 -10
- package/templates/blank/metadata.json +9 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +15 -12
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +21 -10
- package/templates/quiz/core/editor.js +44 -31
- package/templates/quiz/core/model.d.ts +14 -0
- package/templates/quiz/core/model.js +76 -4
- package/templates/quiz/metadata.json +9 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +101 -34
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +45 -36
- package/templates/quiz/styles.css +65 -22
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +65 -19
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/texts.js +11 -11
- package/es/commands/check/index.d.ts +0 -15
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -294
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/completion.html +0 -15
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -10
- package/templates/blank/screens/completion.js +0 -7
- package/templates/quiz/content.json +0 -35
- package/templates/quiz/elice.config.json +0 -9
- package/templates/quiz/grading.json +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CommandResult } from '../../types.js';
|
|
2
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] [--port 4170]\n\n \uB85C\uCEEC\uC5D0\uC11C \uC6B4\uC601\uACFC \uAC19\uC740 \uC870\uAC74\uC73C\uB85C \uCF58\uD150\uCE20\uB97C \uB744\uC6B4\uB2E4.\n - http://localhost:<port> LXP \uD749\uB0B4 \uD654\uBA74: \uD559\uC0DD \u00B7 \uD29C\uD130\uB9C1 \u00B7 \uAD50\uC721\uC790 \uD654\uBA74 \u00B7 \uB0B4\uC6A9 \uD3B8\uC9D1
|
|
2
|
+
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk dev [\uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354] [--port 4170]\n\n \uB85C\uCEEC\uC5D0\uC11C \uC6B4\uC601\uACFC \uAC19\uC740 \uC870\uAC74\uC73C\uB85C \uCF58\uD150\uCE20\uB97C \uB744\uC6B4\uB2E4.\n - http://localhost:<port> LXP \uD749\uB0B4 \uD654\uBA74: \uD559\uC0DD \u00B7 \uD29C\uD130\uB9C1 \u00B7 \uAD50\uC721\uC790 \uD654\uBA74 \u00B7 \uB0B4\uC6A9 \uD3B8\uC9D1\n - \uCF58\uD150\uCE20\uB294 \uB2E4\uB978 \uCD9C\uCC98(127.0.0.1:<port+1>)\uC5D0\uC11C \uC6B4\uC601 \uD5E4\uB354(CSP sandbox allow-scripts)\uB85C\n - \uD3EC\uD2B8\uB97C \uB450 \uAC1C(N \u00B7 N+1) \uC4F4\uB2E4. --port \uC5C6\uC774 \uC5F4 \uB54C 4170 \u00B7 4171\uC774 \uC4F0\uC774\uACE0 \uC788\uC73C\uBA74 \uB2E4\uC74C \uC30D(4172 \u00B7 4173 \u2026)\uC744 \uC4F4\uB2E4\n - \uC2E4\uC81C @eliceio/cdk\uAC00 elice-material \uD749\uB0B4 API\uC640 \uD1B5\uC2E0. \uB0B4\uC6A9 \uD3B8\uC9D1\uC5D0\uC11C \uC800\uC7A5\uD55C settings(\uB0B4\uC6A9 + \uCC44\uC810 \uBC29\uC2DD \u00B7 \uB2F5)\uB294\n .ecdk/settings.json\uC5D0 \uC4F4\uB2E4. \uB2E4\uC2DC \uC5F4\uC5B4\uB3C4 \uB0A8\uACE0, zip\uC5D0\uB294 \uB4E4\uC5B4\uAC00\uC9C0 \uC54A\uB294\uB2E4 (\uC6B4\uC601\uC740 SDK saveSettings \u2192 \uC11C\uBC84 settings)\n - \uD559\uC0DD \uBCF4\uAE30 \uC81C\uCD9C: \uC800\uC7A5\uD55C \uCC44\uC810 \uC124\uC815\uC774 \uC788\uC73C\uBA74 \uCC44\uC810\uD558\uACE0, \uC5C6\uC73C\uBA74 \uC81C\uCD9C\uB9CC \uBC1B\uB294\uB2E4\n (\uC644\uB8CC \uC815\uCC45\uC740 LXP\uC5D0 \uC62C\uB9B0 \uB4A4 \uC124\uC815 \uD0ED\uC5D0\uC11C \uAD50\uC721\uC790\uAC00 \uACE0\uB974\uBBC0\uB85C dev\uB294 \uD749\uB0B4 \uB0B4\uC9C0 \uC54A\uB294\uB2E4)\n - \uD30C\uC77C\uC744 \uACE0\uCE58\uBA74 \uB2E4\uC2DC \uAC80\uC0AC\uD558\uACE0 \uD654\uBA74\uC744 \uC0C8\uB85C \uB744\uC6C0, \uCF58\uD150\uCE20\uC758 \uCF58\uC194 \uC624\uB958\uC640 404\uB97C \uC5EC\uAE30\uC5D0 \uD45C\uC2DC\n\n\uB05D\uB0B4\uAE30: Ctrl+C";
|
|
3
3
|
export declare function run(args: {
|
|
4
4
|
target: string;
|
|
5
5
|
port?: string;
|
package/es/commands/dev/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import { startDevServer } from '../../dev/server.js';
|
|
|
3
3
|
const usage = `사용법: ecdk dev [프로젝트 폴더] [--port 4170]
|
|
4
4
|
|
|
5
5
|
로컬에서 운영과 같은 조건으로 콘텐츠를 띄운다.
|
|
6
|
-
- http://localhost:<port> LXP 흉내 화면: 학생 · 튜터링 · 교육자 화면 · 내용 편집
|
|
6
|
+
- http://localhost:<port> LXP 흉내 화면: 학생 · 튜터링 · 교육자 화면 · 내용 편집
|
|
7
7
|
- 콘텐츠는 다른 출처(127.0.0.1:<port+1>)에서 운영 헤더(CSP sandbox allow-scripts)로
|
|
8
8
|
- 포트를 두 개(N · N+1) 쓴다. --port 없이 열 때 4170 · 4171이 쓰이고 있으면 다음 쌍(4172 · 4173 …)을 쓴다
|
|
9
|
-
- 실제 @eliceio/cdk가 elice-material 흉내 API와 통신.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
- 실제 @eliceio/cdk가 elice-material 흉내 API와 통신. 내용 편집에서 저장한 settings(내용 + 채점 방식 · 답)는
|
|
10
|
+
.ecdk/settings.json에 쓴다. 다시 열어도 남고, zip에는 들어가지 않는다 (운영은 SDK saveSettings → 서버 settings)
|
|
11
|
+
- 학생 보기 제출: 저장한 채점 설정이 있으면 채점하고, 없으면 제출만 받는다
|
|
12
|
+
(완료 정책은 LXP에 올린 뒤 설정 탭에서 교육자가 고르므로 dev는 흉내 내지 않는다)
|
|
13
13
|
- 파일을 고치면 다시 검사하고 화면을 새로 띄움, 콘텐츠의 콘솔 오류와 404를 여기에 표시
|
|
14
14
|
|
|
15
15
|
끝내기: Ctrl+C`;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ContentConfig } from '../../core/config.js';
|
|
2
|
+
import { type LatestResult } from '../../core/latest.js';
|
|
3
|
+
import { type TemplateInfo } from '../../core/templates.js';
|
|
2
4
|
import { type McpEnv } from '../mcp/index.js';
|
|
3
5
|
import type { CommandResult } from '../../types.js';
|
|
4
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";
|
|
@@ -14,6 +16,10 @@ export interface DoctorCheck {
|
|
|
14
16
|
} | undefined;
|
|
15
17
|
fixed?: boolean | undefined;
|
|
16
18
|
}
|
|
19
|
+
/** 자동 고침 동작은 출력(JSON)에 싣지 않고 점검 항목 옆에만 둔다. */
|
|
20
|
+
type Pending = DoctorCheck & {
|
|
21
|
+
apply?: () => Promise<void>;
|
|
22
|
+
};
|
|
17
23
|
export interface DoctorResult {
|
|
18
24
|
ok: boolean;
|
|
19
25
|
cli: string;
|
|
@@ -21,12 +27,30 @@ export interface DoctorResult {
|
|
|
21
27
|
checks: DoctorCheck[];
|
|
22
28
|
}
|
|
23
29
|
export declare function checkNode(version: string): DoctorCheck;
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Claude Code 스킬: 프로젝트(.claude/skills) 또는 홈(~/.claude/skills)에 모두 있고 CLI와 같은 버전인지.
|
|
32
|
+
* 다른 스킬은 가이드를 옆 폴더(../elice-content-guide/topics/)에서 읽으므로 스킬이 있는 폴더마다 가이드 스킬도 있어야 한다
|
|
33
|
+
*/
|
|
25
34
|
export declare function checkSkills(dir: string, home?: string): DoctorCheck;
|
|
26
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* 프로젝트를 만든 템플릿보다 templates(기본: 이 CLI에 든 템플릿)에 더 새 버전이 있으면 안내 문구, 아니면 undefined.
|
|
37
|
+
* ecdk update는 새로 설치한 ecdk의 템플릿 목록(ecdk create --list --json)을 넘긴다
|
|
38
|
+
*/
|
|
39
|
+
export declare function templateNotice(config: ContentConfig, templates?: Pick<TemplateInfo, 'name' | 'version'>[]): string | undefined;
|
|
40
|
+
/** 프로젝트를 만든 템플릿 · 버전 (package.json "ecdk".template). 이 CLI에 더 새 버전이 있으면 알리기만 한다 (자동 갱신 없음) */
|
|
27
41
|
export declare function checkTemplate(config: ContentConfig): DoctorCheck;
|
|
42
|
+
/**
|
|
43
|
+
* npm latest 태그의 CLI가 지금 실행 중인 것보다 새 버전이면 경고 (ecdk update). 오프라인 · 시간 초과는 doctor를
|
|
44
|
+
* 실패시키지 않고 건너뛴다. 지금 버전이 latest보다 새 버전이면(배포 전 · prerelease) 최신으로 본다
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkLatest(latest: LatestResult, current?: string): DoctorCheck;
|
|
28
47
|
/** dir부터 위로 올라가며 <폴더>/.claude/skills 목록. 홈 폴더나 파일 시스템 루트에서 멈춘다 (홈은 사용자 위치라 따로) */
|
|
29
48
|
export declare function projectSkillDirs(dir: string, home?: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* SDK 의존성 (ADR 0010 최종 결정): package.json의 @eliceio/cdk가 설치됐는지, rules.json minVersions.sdk 이상인지.
|
|
51
|
+
* package.json에 없고 옛 lib/cdk.js 복사본만 있으면 경고하고, --fix가 package.json dependencies에 넣는다 (npm install은 직접)
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkDeps(dir: string, config: ContentConfig): Promise<Pending>;
|
|
30
54
|
/** 학습자료 서버 MCP(elice-material)가 찾은 도구 중 하나에라도 등록돼 있는지 (읽기만) */
|
|
31
55
|
export declare function checkMcp(env: McpEnv): DoctorCheck;
|
|
32
56
|
export declare function doctor(target: string, opts: {
|
|
@@ -34,6 +58,8 @@ export declare function doctor(target: string, opts: {
|
|
|
34
58
|
nodeVersion?: string;
|
|
35
59
|
home?: string | undefined;
|
|
36
60
|
mcp?: McpEnv | undefined;
|
|
61
|
+
/** npm latest 조회. 받았을 때만 cli.latest를 본다 (run은 npm view, 테스트는 가짜 결과) */
|
|
62
|
+
latest?: (() => LatestResult) | undefined;
|
|
37
63
|
}): Promise<DoctorResult>;
|
|
38
64
|
export declare function formatText(r: DoctorResult): string;
|
|
39
65
|
export declare function run(args: {
|
|
@@ -43,3 +69,4 @@ export declare function run(args: {
|
|
|
43
69
|
}): Promise<CommandResult>;
|
|
44
70
|
/** 주석뿐이 아닌 줄에서 정답·설정 파일 이름이 나오는지. 줄 건너뛰기는 금지 API 검사와 같은 규칙(content-rules lineSkipper) */
|
|
45
71
|
export declare function referencesAnswerFile(text: string): boolean;
|
|
72
|
+
export {};
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile, writeFile, access, appendFile } from 'node:fs/promises';
|
|
2
3
|
import { homedir } from 'node:os';
|
|
3
4
|
import { resolve, join, dirname } from 'node:path';
|
|
4
|
-
import { loadConfig, CONFIG_FILE,
|
|
5
|
+
import { loadConfig, CONFIG_FILE, planLegacyMigration, applyLegacyMigration, PACKAGE_FILE, PACKAGE_CONFIG_KEY, legacyGradingTypesWarning, legacyCompletionWarning, loadGrading, SETTINGS_DATA_FILE } from '../../core/config.js';
|
|
6
|
+
import { NO_UPDATE_CHECK_ENV, npmLatest, isNewer, LATEST_DOCTOR_TIMEOUT_MS } from '../../core/latest.js';
|
|
5
7
|
import { prepareContent } from '../../core/prepare.js';
|
|
6
|
-
import { projectCheckOptions } from '../../core/project-check.js';
|
|
8
|
+
import { projectCheckOptions, findLegacySdkCopy } from '../../core/project-check.js';
|
|
9
|
+
import { readProjectSdk, SDK_PACKAGE, INSTALL_COMMAND, UPDATE_COMMAND } from '../../core/sdk.js';
|
|
7
10
|
import { parseTemplateRef, listTemplates } from '../../core/templates.js';
|
|
8
11
|
import { checkFiles } from '../../rules/check.js';
|
|
9
12
|
import { lineSkipper } from '../../rules/skip.js';
|
|
10
|
-
import { RULES_VERSION } from '../../rules/spec.js';
|
|
13
|
+
import { RULES_VERSION, rules } from '../../rules/spec.js';
|
|
11
14
|
import 'fflate';
|
|
12
15
|
import { VERSION } from '../../version.js';
|
|
13
16
|
import { defaultMcpEnv, detectTargets, claudeRegistration, helpyRegisteredUrl, envOfUrl, MCP_NAME } from '../mcp/index.js';
|
|
14
|
-
import { skillsDir, skillNames, inspectSkill } from '../skill/index.js';
|
|
17
|
+
import { skillsDir, skillNames, inspectSkill, GUIDE_SKILL } from '../skill/index.js';
|
|
15
18
|
import { compareVersions } from '../../rules/semver.js';
|
|
16
19
|
|
|
17
20
|
const usage = `사용법: ecdk doctor [프로젝트 폴더] [--fix] [--json]
|
|
@@ -89,11 +92,42 @@ async function checkGitignore(dir, config) {
|
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
}
|
|
92
|
-
/**
|
|
95
|
+
/** 없어진 명령(ecdk check → ecdk validate)을 부르는 package.json scripts (옛 ecdk create로 만든 프로젝트, G162) */
|
|
96
|
+
const STALE_SCRIPT = /\becdk check\b/;
|
|
97
|
+
async function checkScripts(dir) {
|
|
98
|
+
const path = join(dir, PACKAGE_FILE);
|
|
99
|
+
let pkg;
|
|
100
|
+
try {
|
|
101
|
+
pkg = JSON.parse(await readFile(path, 'utf8'));
|
|
102
|
+
} catch {
|
|
103
|
+
return null; // package.json 형식 오류는 project.config가 알린다
|
|
104
|
+
}
|
|
105
|
+
const stale = Object.entries(pkg.scripts ?? {}).filter(e => typeof e[1] === 'string' && STALE_SCRIPT.test(e[1]));
|
|
106
|
+
if (stale.length === 0) return null;
|
|
107
|
+
return {
|
|
108
|
+
id: 'project.scripts',
|
|
109
|
+
level: 'warn',
|
|
110
|
+
message: `package.json scripts가 없어진 명령 ecdk check를 부릅니다: ${stale.map(([k]) => k).join(', ')} (지금은 ecdk validate)`,
|
|
111
|
+
fix: {
|
|
112
|
+
description: 'scripts의 ecdk check를 ecdk validate로 바꾸기',
|
|
113
|
+
auto: true
|
|
114
|
+
},
|
|
115
|
+
apply: async () => {
|
|
116
|
+
// 파일 모양(들여쓰기 · 순서)은 그대로 두고 그 값만 바꾼다
|
|
117
|
+
let text = await readFile(path, 'utf8');
|
|
118
|
+
for (const [, value] of stale) text = text.replace(JSON.stringify(value), JSON.stringify(value.replace(new RegExp(STALE_SCRIPT.source, 'g'), 'ecdk validate')));
|
|
119
|
+
await writeFile(path, text);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Claude Code 스킬: 프로젝트(.claude/skills) 또는 홈(~/.claude/skills)에 모두 있고 CLI와 같은 버전인지.
|
|
125
|
+
* 다른 스킬은 가이드를 옆 폴더(../elice-content-guide/topics/)에서 읽으므로 스킬이 있는 폴더마다 가이드 스킬도 있어야 한다
|
|
126
|
+
*/
|
|
93
127
|
function checkSkills(dir, home) {
|
|
94
128
|
const fix = {
|
|
95
|
-
description: '스킬 설치 · 갱신
|
|
96
|
-
command: 'ecdk setup',
|
|
129
|
+
description: '스킬 설치 · 갱신',
|
|
130
|
+
command: 'ecdk setup --only skills',
|
|
97
131
|
auto: false
|
|
98
132
|
};
|
|
99
133
|
// 프로젝트 폴더부터 위로(홈 · 루트까지) .claude/skills를 찾고, 없으면 홈(~/.claude/skills).
|
|
@@ -104,29 +138,57 @@ function checkSkills(dir, home) {
|
|
|
104
138
|
});
|
|
105
139
|
const dirs = [...projectSkillDirs(dir, home), user];
|
|
106
140
|
const where = new Set();
|
|
141
|
+
const found = [];
|
|
107
142
|
const statuses = skillNames().map(name => {
|
|
108
143
|
for (const d of dirs) {
|
|
109
144
|
const s = inspectSkill(d, name);
|
|
110
145
|
if (s.state !== 'missing') {
|
|
111
146
|
where.add(d);
|
|
147
|
+
found.push({
|
|
148
|
+
dir: d,
|
|
149
|
+
status: s
|
|
150
|
+
});
|
|
112
151
|
return s;
|
|
113
152
|
}
|
|
114
153
|
}
|
|
115
154
|
return inspectSkill(user, name);
|
|
116
155
|
});
|
|
156
|
+
// 고칠 스킬이 프로젝트 폴더(.claude/skills)에 있으면 홈에 설치하는 ecdk setup --only skills로는 고쳐지지 않는다
|
|
157
|
+
const fixFor = skillDirs => {
|
|
158
|
+
const roots = [...new Set(skillDirs.filter(d => d !== user).map(d => dirname(dirname(d))))];
|
|
159
|
+
if (roots.length === 0) return fix;
|
|
160
|
+
const elsewhere = roots.some(r => r !== resolve(dir));
|
|
161
|
+
return {
|
|
162
|
+
description: `프로젝트 스킬 다시 설치${elsewhere ? ` (${roots.join(', ')}에서)` : ''}${roots.length < skillDirs.length ? ' · 홈 스킬은 ecdk setup --only skills' : ''}`,
|
|
163
|
+
command: 'ecdk setup --only skills --project',
|
|
164
|
+
auto: false
|
|
165
|
+
};
|
|
166
|
+
};
|
|
117
167
|
const missing = statuses.filter(s => s.state === 'missing').map(s => s.name);
|
|
118
168
|
const outdated = statuses.filter(s => s.state === 'outdated').map(s => s.name);
|
|
119
169
|
if (missing.length > 0) return {
|
|
120
170
|
id: 'skill.installed',
|
|
121
171
|
level: 'warn',
|
|
122
172
|
message: `Claude Code 스킬 없음: ${missing.join(', ')}`,
|
|
123
|
-
|
|
173
|
+
// 일부가 프로젝트 폴더에 있으면 빠진 스킬도 거기에 (ecdk setup --only skills --project)
|
|
174
|
+
fix: fixFor([...new Set(found.map(f => f.dir))])
|
|
124
175
|
};
|
|
176
|
+
// 스킬이 있는 폴더에 가이드 스킬(topics/)이 없으면 그 스킬의 가이드 경로가 깨진다
|
|
177
|
+
const broken = found.filter(f => f.status.name !== GUIDE_SKILL && !existsSync(join(f.dir, GUIDE_SKILL, 'topics')));
|
|
178
|
+
if (broken.length > 0) {
|
|
179
|
+
const dirsBroken = [...new Set(broken.map(f => f.dir))];
|
|
180
|
+
return {
|
|
181
|
+
id: 'skill.installed',
|
|
182
|
+
level: 'warn',
|
|
183
|
+
message: `${dirsBroken.join(', ')}에 가이드 스킬 ${GUIDE_SKILL}(topics/)이 없어 ${broken.map(f => f.status.name).join(', ')}이 가이드(../${GUIDE_SKILL}/topics/)를 읽지 못합니다`,
|
|
184
|
+
fix: fixFor(dirsBroken)
|
|
185
|
+
};
|
|
186
|
+
}
|
|
125
187
|
if (outdated.length > 0) return {
|
|
126
188
|
id: 'skill.installed',
|
|
127
189
|
level: 'warn',
|
|
128
190
|
message: `Claude Code 스킬이 CLI보다 오래됨: ${outdated.join(', ')}`,
|
|
129
|
-
fix
|
|
191
|
+
fix: fixFor([...new Set(found.filter(f => f.status.state === 'outdated').map(f => f.dir))])
|
|
130
192
|
};
|
|
131
193
|
const newer = statuses.filter(s => s.state === 'newer').map(s => `${s.name}(${s.version})`);
|
|
132
194
|
return {
|
|
@@ -135,7 +197,21 @@ function checkSkills(dir, home) {
|
|
|
135
197
|
message: newer.length > 0 ? `Claude Code 스킬 ${statuses.length}개 (${[...where].join(', ')}) · CLI(${VERSION})보다 새 버전: ${newer.join(', ')}` : `Claude Code 스킬 ${statuses.length}개 (${[...where].join(', ')})`
|
|
136
198
|
};
|
|
137
199
|
}
|
|
138
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* 프로젝트를 만든 템플릿보다 templates(기본: 이 CLI에 든 템플릿)에 더 새 버전이 있으면 안내 문구, 아니면 undefined.
|
|
202
|
+
* ecdk update는 새로 설치한 ecdk의 템플릿 목록(ecdk create --list --json)을 넘긴다
|
|
203
|
+
*/
|
|
204
|
+
function templateNotice(config, templates = listTemplates()) {
|
|
205
|
+
if (!config.template) return undefined;
|
|
206
|
+
const {
|
|
207
|
+
name,
|
|
208
|
+
version
|
|
209
|
+
} = parseTemplateRef(config.template);
|
|
210
|
+
const shipped = templates.find(t => t.name === name);
|
|
211
|
+
if (!shipped || version === undefined || (compareVersions(shipped.version, version) ?? 0) <= 0) return undefined;
|
|
212
|
+
return `${config.template} · 이 ecdk에는 ${name}@${shipped.version}이 있습니다 (자동으로 바꾸지 않음. 바뀐 점은 ecdk create --list와 템플릿 README)`;
|
|
213
|
+
}
|
|
214
|
+
/** 프로젝트를 만든 템플릿 · 버전 (package.json "ecdk".template). 이 CLI에 더 새 버전이 있으면 알리기만 한다 (자동 갱신 없음) */
|
|
139
215
|
function checkTemplate(config) {
|
|
140
216
|
const id = 'project.template';
|
|
141
217
|
if (!config.template) return {
|
|
@@ -144,20 +220,44 @@ function checkTemplate(config) {
|
|
|
144
220
|
message: '템플릿 정보 없음 (ecdk create 없이 만들었거나 옛 프로젝트)'
|
|
145
221
|
};
|
|
146
222
|
const {
|
|
147
|
-
name
|
|
148
|
-
version
|
|
223
|
+
name
|
|
149
224
|
} = parseTemplateRef(config.template);
|
|
150
|
-
|
|
151
|
-
if (!shipped) return {
|
|
225
|
+
if (!listTemplates().some(t => t.name === name)) return {
|
|
152
226
|
id,
|
|
153
227
|
level: 'ok',
|
|
154
228
|
message: `${config.template} (이 ecdk에는 없는 템플릿)`
|
|
155
229
|
};
|
|
156
|
-
const newer = version !== undefined && (compareVersions(shipped.version, version) ?? 0) > 0;
|
|
157
230
|
return {
|
|
158
231
|
id,
|
|
159
232
|
level: 'ok',
|
|
160
|
-
message:
|
|
233
|
+
message: templateNotice(config) ?? config.template
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* npm latest 태그의 CLI가 지금 실행 중인 것보다 새 버전이면 경고 (ecdk update). 오프라인 · 시간 초과는 doctor를
|
|
238
|
+
* 실패시키지 않고 건너뛴다. 지금 버전이 latest보다 새 버전이면(배포 전 · prerelease) 최신으로 본다
|
|
239
|
+
*/
|
|
240
|
+
function checkLatest(latest, current = VERSION) {
|
|
241
|
+
const id = 'cli.latest';
|
|
242
|
+
if (!latest.ok) return {
|
|
243
|
+
id,
|
|
244
|
+
level: 'skip',
|
|
245
|
+
message: `npm 최신 버전을 확인하지 못함 (${latest.error})`
|
|
246
|
+
};
|
|
247
|
+
if (!isNewer(latest.version, current)) return {
|
|
248
|
+
id,
|
|
249
|
+
level: 'ok',
|
|
250
|
+
message: `ecdk ${current} (npm latest ${latest.version})`
|
|
251
|
+
};
|
|
252
|
+
return {
|
|
253
|
+
id,
|
|
254
|
+
level: 'warn',
|
|
255
|
+
message: `ecdk ${latest.version}이 나왔습니다 (지금 ${current}).`,
|
|
256
|
+
fix: {
|
|
257
|
+
description: 'CLI · 스킬 · 프로젝트 SDK 업데이트',
|
|
258
|
+
command: 'ecdk update',
|
|
259
|
+
auto: false
|
|
260
|
+
}
|
|
161
261
|
};
|
|
162
262
|
}
|
|
163
263
|
/** dir부터 위로 올라가며 <폴더>/.claude/skills 목록. 홈 폴더나 파일 시스템 루트에서 멈춘다 (홈은 사용자 위치라 따로) */
|
|
@@ -178,9 +278,9 @@ function projectSkillDirs(dir, home = homedir()) {
|
|
|
178
278
|
return out;
|
|
179
279
|
}
|
|
180
280
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
281
|
+
* 로컬 채점 흉내 (ecdk dev): 채점 설정은 ecdk dev 내용 편집이 저장한 .ecdk/settings.json의 grading. 있으면 채점하고
|
|
282
|
+
* 없으면 제출만 받는다. 답이 아직 없어도 정상이다 (편집 화면에서 정함). 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012).
|
|
283
|
+
* 옛 elice.config.json gradingTypes · 완료 정책은 경고, .ecdk/settings.json 형식이 틀리면 실패
|
|
184
284
|
*/
|
|
185
285
|
async function checkGrading(dir, config) {
|
|
186
286
|
const id = 'project.grading';
|
|
@@ -190,32 +290,23 @@ async function checkGrading(dir, config) {
|
|
|
190
290
|
message: '채점 없음 (문제 설명)'
|
|
191
291
|
};
|
|
192
292
|
const legacy = legacyGradingTypesWarning(config);
|
|
293
|
+
const legacyCompletion = legacyCompletionWarning(config);
|
|
193
294
|
try {
|
|
194
295
|
const grading = await loadGrading(dir, config);
|
|
195
|
-
if (legacy) return {
|
|
296
|
+
if (legacy || legacyCompletion) return {
|
|
196
297
|
id,
|
|
197
298
|
level: 'warn',
|
|
198
|
-
message: legacy,
|
|
299
|
+
message: [legacy, legacyCompletion].filter(Boolean).join(' '),
|
|
199
300
|
fix: {
|
|
200
|
-
description: `${CONFIG_FILE}에서
|
|
301
|
+
description: `${CONFIG_FILE}에서 쓰지 않는 필드 지우기 (ecdk doctor --fix로 옮기면 빠짐)`,
|
|
201
302
|
auto: false
|
|
202
303
|
}
|
|
203
304
|
};
|
|
204
|
-
const
|
|
205
|
-
if (graded && !grading?.grading) return {
|
|
206
|
-
id,
|
|
207
|
-
level: 'warn',
|
|
208
|
-
message: `채점해 완료(on_graded)하는데 ${GRADING_DATA_FILE}이 없어 ecdk dev 학생 보기가 채점할 수 없습니다 (답이 없음)`,
|
|
209
|
-
fix: {
|
|
210
|
-
description: `ecdk dev의 '내용 편집'에서 채점 방식 · 답을 저장 (${GRADING_DATA_FILE}에 씀, zip에는 들어가지 않음)`,
|
|
211
|
-
auto: false
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const policy = grading?.completion_policy ?? '-';
|
|
305
|
+
const message = grading?.grading ? `로컬 채점 ${grading.grading.type} (${SETTINGS_DATA_FILE})` : "로컬 채점 설정 없음: 제출만 받음 (ecdk dev의 '내용 편집'에서 답을 저장하면 학생 보기가 채점)";
|
|
215
306
|
return {
|
|
216
307
|
id,
|
|
217
308
|
level: 'ok',
|
|
218
|
-
message
|
|
309
|
+
message
|
|
219
310
|
};
|
|
220
311
|
} catch (e) {
|
|
221
312
|
return {
|
|
@@ -223,18 +314,118 @@ async function checkGrading(dir, config) {
|
|
|
223
314
|
level: 'fail',
|
|
224
315
|
message: e.message,
|
|
225
316
|
fix: {
|
|
226
|
-
description: `${
|
|
317
|
+
description: `${SETTINGS_DATA_FILE}을 지우고 ecdk dev의 '내용 편집'에서 다시 저장`,
|
|
318
|
+
auto: false
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* 프로젝트 설정 (ADR 0011): package.json "ecdk"(빌드 옵션) + 원본 metadata.json(화면 · 완료 정책). 옛 elice.config.json이
|
|
325
|
+
* 남아 있으면 경고하고, --fix가 metadata.json · package.json "ecdk"로 옮긴 뒤 지운다 (내용 · 답 파일은 옮기지 않음)
|
|
326
|
+
*/
|
|
327
|
+
async function checkConfig(dir, config) {
|
|
328
|
+
const id = 'project.config';
|
|
329
|
+
if (await exists(join(dir, CONFIG_FILE))) {
|
|
330
|
+
const plan = await planLegacyMigration(dir);
|
|
331
|
+
const dropped = plan.dropped.length > 0 ? ` (${plan.dropped.join(' · ')}는 버림)` : '';
|
|
332
|
+
return {
|
|
333
|
+
id,
|
|
334
|
+
level: 'warn',
|
|
335
|
+
message: `옛 ${CONFIG_FILE}이 있습니다 (ADR 0011). 화면 · 완료 정책은 원본의 metadata.json, 빌드 옵션 · template은 package.json "ecdk"에 둡니다.${plan.ok ? '' : ` ${plan.reason}`}`,
|
|
336
|
+
fix: plan.ok ? {
|
|
337
|
+
description: `${plan.metadata ? `${plan.metadata.path} 만들기 · ` : ''}package.json "ecdk"로 옮기고 ${CONFIG_FILE} 지우기${dropped}`,
|
|
338
|
+
auto: true
|
|
339
|
+
} : {
|
|
340
|
+
description: plan.reason ?? '',
|
|
227
341
|
auto: false
|
|
342
|
+
},
|
|
343
|
+
...(plan.ok ? {
|
|
344
|
+
apply: async () => {
|
|
345
|
+
await applyLegacyMigration(dir, plan);
|
|
346
|
+
}
|
|
347
|
+
} : {})
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
id,
|
|
352
|
+
level: 'ok',
|
|
353
|
+
message: config.configFile === PACKAGE_FILE ? `${PACKAGE_FILE} "${PACKAGE_CONFIG_KEY}" 읽음` : `${PACKAGE_FILE} "${PACKAGE_CONFIG_KEY}" 없음 (기본값 사용)`
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* SDK 의존성 (ADR 0010 최종 결정): package.json의 @eliceio/cdk가 설치됐는지, rules.json minVersions.sdk 이상인지.
|
|
358
|
+
* package.json에 없고 옛 lib/cdk.js 복사본만 있으면 경고하고, --fix가 package.json dependencies에 넣는다 (npm install은 직접)
|
|
359
|
+
*/
|
|
360
|
+
async function checkDeps(dir, config) {
|
|
361
|
+
const id = 'project.deps';
|
|
362
|
+
const min = rules.minVersions.sdk;
|
|
363
|
+
const sdk = await readProjectSdk(dir);
|
|
364
|
+
if (!sdk) {
|
|
365
|
+
const copy = await findLegacySdkCopy(dir, config);
|
|
366
|
+
if (!copy) return {
|
|
367
|
+
id,
|
|
368
|
+
level: 'skip',
|
|
369
|
+
message: `package.json에 ${SDK_PACKAGE} 없음 (SDK를 쓰지 않는 자료)`
|
|
370
|
+
};
|
|
371
|
+
return {
|
|
372
|
+
id,
|
|
373
|
+
level: 'warn',
|
|
374
|
+
message: `옛 ${copy} 복사본을 씁니다. SDK는 package.json 의존성으로 받습니다 (ecdk build가 node_modules에서 zip lib/cdk.js로 넣음). --fix로 넣은 뒤 ${INSTALL_COMMAND}을 실행해 주세요.`,
|
|
375
|
+
fix: {
|
|
376
|
+
description: `package.json dependencies에 "${SDK_PACKAGE}": "^${min}" 넣기 (그다음 ${INSTALL_COMMAND}, ${copy}는 지워도 됨)`,
|
|
377
|
+
auto: true
|
|
378
|
+
},
|
|
379
|
+
apply: async () => {
|
|
380
|
+
const path = join(dir, PACKAGE_FILE);
|
|
381
|
+
const raw = await readFile(path, 'utf8').catch(() => null);
|
|
382
|
+
const pkg = raw ? JSON.parse(raw) : {
|
|
383
|
+
private: true
|
|
384
|
+
};
|
|
385
|
+
const deps = pkg.dependencies ?? {};
|
|
386
|
+
pkg.dependencies = {
|
|
387
|
+
...deps,
|
|
388
|
+
[SDK_PACKAGE]: `^${min}`
|
|
389
|
+
};
|
|
390
|
+
await writeFile(path, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
228
391
|
}
|
|
229
392
|
};
|
|
230
393
|
}
|
|
394
|
+
if (!sdk.installed) return {
|
|
395
|
+
id,
|
|
396
|
+
level: 'fail',
|
|
397
|
+
message: `${SDK_PACKAGE}(${sdk.range})가 설치되지 않았습니다 (node_modules에 없음).`,
|
|
398
|
+
fix: {
|
|
399
|
+
description: '의존성 설치',
|
|
400
|
+
command: INSTALL_COMMAND,
|
|
401
|
+
auto: false
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
const {
|
|
405
|
+
version
|
|
406
|
+
} = sdk.installed;
|
|
407
|
+
if ((compareVersions(version, min) ?? 0) < 0) return {
|
|
408
|
+
id,
|
|
409
|
+
level: 'fail',
|
|
410
|
+
message: `${SDK_PACKAGE} ${version}은 최소 버전 ${min}보다 낮습니다 (LXP에서 저장 · 제출이 안 될 수 있음).`,
|
|
411
|
+
fix: {
|
|
412
|
+
description: 'SDK 올리기',
|
|
413
|
+
command: UPDATE_COMMAND,
|
|
414
|
+
auto: false
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
return {
|
|
418
|
+
id,
|
|
419
|
+
level: 'ok',
|
|
420
|
+
message: `${SDK_PACKAGE} ${version} (최소 ${min})`
|
|
421
|
+
};
|
|
231
422
|
}
|
|
232
423
|
/** 학습자료 서버 MCP(elice-material)가 찾은 도구 중 하나에라도 등록돼 있는지 (읽기만) */
|
|
233
424
|
function checkMcp(env) {
|
|
234
425
|
const id = 'mcp.material';
|
|
235
426
|
const fix = {
|
|
236
427
|
description: 'MCP 등록 (자료를 LXP에 올릴 때 필요)',
|
|
237
|
-
command: 'ecdk setup',
|
|
428
|
+
command: 'ecdk setup --only mcp',
|
|
238
429
|
auto: false
|
|
239
430
|
};
|
|
240
431
|
const targets = detectTargets(env);
|
|
@@ -289,22 +480,19 @@ function checkMcp(env) {
|
|
|
289
480
|
async function doctor(target, opts) {
|
|
290
481
|
const dir = resolve(target);
|
|
291
482
|
const checks = [checkNode(opts.nodeVersion ?? process.version), await checkPackageManager(dir)];
|
|
483
|
+
if (opts.latest) checks.push(checkLatest(opts.latest()));
|
|
292
484
|
let config = null;
|
|
293
485
|
try {
|
|
294
486
|
config = await loadConfig(dir);
|
|
295
|
-
checks.push(
|
|
296
|
-
id: 'project.config',
|
|
297
|
-
level: 'ok',
|
|
298
|
-
message: (await exists(join(dir, CONFIG_FILE))) ? `${CONFIG_FILE} 읽음` : `${CONFIG_FILE} 없음 (기본값 사용)`
|
|
299
|
-
});
|
|
487
|
+
checks.push(await checkConfig(dir, config));
|
|
300
488
|
} catch (e) {
|
|
301
489
|
checks.push({
|
|
302
490
|
id: 'project.config',
|
|
303
491
|
level: 'fail',
|
|
304
|
-
message:
|
|
492
|
+
message: `설정을 읽을 수 없습니다: ${e.message}`
|
|
305
493
|
});
|
|
306
494
|
}
|
|
307
|
-
if (config) checks.push(checkTemplate(config), await checkGrading(dir, config));
|
|
495
|
+
if (config) checks.push(await checkDeps(dir, config), checkTemplate(config), await checkGrading(dir, config));
|
|
308
496
|
if (config) {
|
|
309
497
|
const srcDir = resolve(dir, config.root);
|
|
310
498
|
if (!(await exists(srcDir))) {
|
|
@@ -316,7 +504,10 @@ async function doctor(target, opts) {
|
|
|
316
504
|
} else {
|
|
317
505
|
let prepared = null;
|
|
318
506
|
try {
|
|
319
|
-
|
|
507
|
+
// SDK 설치 여부는 project.deps가 알린다
|
|
508
|
+
prepared = await prepareContent(dir, config, {
|
|
509
|
+
requireSdk: false
|
|
510
|
+
});
|
|
320
511
|
} catch (e) {
|
|
321
512
|
checks.push({
|
|
322
513
|
id: 'project.root',
|
|
@@ -335,7 +526,7 @@ async function doctor(target, opts) {
|
|
|
335
526
|
});
|
|
336
527
|
// 빌드에서 빠지는 정답·설정 파일을 콘텐츠가 참조하면: 배포본에서 깨지고, 정답을 콘텐츠로 가져오려 한 신호.
|
|
337
528
|
// 주석 줄은 보지 않고, 일부러 참조하는 줄은 `ecdk-ignore project.answer-import`로 끈다
|
|
338
|
-
// (
|
|
529
|
+
// (키트 mock SDK는 프로젝트 폴더에서 열 때 로컬 채점용으로 .ecdk/settings.json을 읽는다)
|
|
339
530
|
const decoder = new TextDecoder();
|
|
340
531
|
const leaks = files.filter(f => /\.(html?|m?js|css)$/i.test(f.path)).filter(f => referencesAnswerFile(decoder.decode(f.data))).map(f => f.path);
|
|
341
532
|
checks.push(leaks.length > 0 ? {
|
|
@@ -351,11 +542,7 @@ async function doctor(target, opts) {
|
|
|
351
542
|
level: 'ok',
|
|
352
543
|
message: '콘텐츠가 정답·설정 파일을 참조하지 않음'
|
|
353
544
|
});
|
|
354
|
-
|
|
355
|
-
const grading = config.kind === 'description' ? undefined : await loadGradingFile(dir).catch(() => undefined);
|
|
356
|
-
const result = checkFiles(files, projectCheckOptions(config, {
|
|
357
|
-
grading
|
|
358
|
-
}));
|
|
545
|
+
const result = checkFiles(files, await projectCheckOptions(dir, config));
|
|
359
546
|
const errors = result.issues.filter(i => i.level === 'error');
|
|
360
547
|
const warns = result.issues.length - errors.length;
|
|
361
548
|
checks.push(errors.length > 0 ? {
|
|
@@ -380,7 +567,11 @@ async function doctor(target, opts) {
|
|
|
380
567
|
});
|
|
381
568
|
}
|
|
382
569
|
}
|
|
383
|
-
if (await exists(join(dir, 'package.json')))
|
|
570
|
+
if (await exists(join(dir, 'package.json'))) {
|
|
571
|
+
checks.push(await checkGitignore(dir, config));
|
|
572
|
+
const scripts = await checkScripts(dir);
|
|
573
|
+
if (scripts) checks.push(scripts);
|
|
574
|
+
}
|
|
384
575
|
}
|
|
385
576
|
checks.push(checkSkills(dir, opts.home));
|
|
386
577
|
// MCP는 도구 설정을 읽으므로 실행 환경을 받았을 때만 (run은 실제 환경, 테스트는 가짜 환경)
|
|
@@ -421,20 +612,27 @@ function formatText(r) {
|
|
|
421
612
|
return lines.join('\n');
|
|
422
613
|
}
|
|
423
614
|
async function run(args) {
|
|
615
|
+
// ECDK_NO_UPDATE_CHECK=1이면 npm에 묻지 않는다 (오프라인 · CI · 테스트)
|
|
616
|
+
const latest = process.env[NO_UPDATE_CHECK_ENV] ? () => ({
|
|
617
|
+
ok: false,
|
|
618
|
+
error: `${NO_UPDATE_CHECK_ENV}로 끔`
|
|
619
|
+
}) : () => npmLatest(LATEST_DOCTOR_TIMEOUT_MS);
|
|
424
620
|
const result = await doctor(args.target, {
|
|
425
621
|
fix: args.fix,
|
|
426
|
-
mcp: defaultMcpEnv()
|
|
622
|
+
mcp: defaultMcpEnv(),
|
|
623
|
+
latest
|
|
427
624
|
});
|
|
428
625
|
return {
|
|
429
626
|
exitCode: result.ok ? 0 : 1,
|
|
430
627
|
output: args.json ? JSON.stringify(result, null, 2) : formatText(result)
|
|
431
628
|
};
|
|
432
629
|
}
|
|
433
|
-
|
|
630
|
+
// 옛 정답 · 설정 파일과 ecdk dev가 저장한 settings(정답 포함)
|
|
631
|
+
const ANSWER_FILE = /\b(?:answers\.[a-z]+|elice\.config\.[a-z]+|grading\.json)\b|\.ecdk\/settings\.json\b/i;
|
|
434
632
|
/** 주석뿐이 아닌 줄에서 정답·설정 파일 이름이 나오는지. 줄 건너뛰기는 금지 API 검사와 같은 규칙(content-rules lineSkipper) */
|
|
435
633
|
function referencesAnswerFile(text) {
|
|
436
634
|
const skip = lineSkipper(text);
|
|
437
635
|
return skip.lines.some((line, i) => ANSWER_FILE.test(line) && !skip.isSkipped(i + 1, 'project.answer-import'));
|
|
438
636
|
}
|
|
439
637
|
|
|
440
|
-
export { checkMcp, checkNode, checkSkills, checkTemplate, doctor, formatText, projectSkillDirs, referencesAnswerFile, run, usage };
|
|
638
|
+
export { checkDeps, checkLatest, checkMcp, checkNode, checkSkills, checkTemplate, doctor, formatText, projectSkillDirs, referencesAnswerFile, run, templateNotice, usage };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { CommandResult } from '../../types.js';
|
|
2
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk mcp setup [--target claude|helpycode|all] [--env prod|qa5] [--url <\uC8FC\uC18C>] [--dry-run] [--force] [--json]\n\n Elice \uD559\uC2B5\uC790\uB8CC \uC11C\uBC84 MCP(elice-material)\uB97C AI \uB3C4\uAD6C\uC5D0 \uB4F1\uB85D\uD55C\uB2E4. \uB098\uC911\uC5D0 \uC790\uB8CC\uB97C LXP\uC5D0 \uC62C\uB9AC\uB294 \uC2A4\uD0AC\uC774 \uC4F4\uB2E4.\n --target claude(Claude Code) \u00B7 helpycode(Helpy Code \uB370\uC2A4\uD06C\uD1B1 \u00B7 CLI) \u00B7 all(\uCC3E\uC740 \uB3C4\uAD6C \uBAA8\uB450, \uAE30\uBCF8)\n --env \uC11C\uBC84 \uD658\uACBD prod(\uC6B4\uC601, \uAE30\uBCF8) \u00B7 qa5. \uD658\uACBD \uBCC0\uC218 ECDK_ENV\uB85C\uB3C4 \uC815\uD560 \uC218 \uC788\uB2E4 (\uC635\uC158\uC774 \uBA3C\uC800)\n --url \uADF8 \uBC16\uC758 \uC11C\uBC84 MCP \uC8FC\uC18C (https, --env\uBCF4\uB2E4 \uBA3C\uC800)\n --dry-run \uBB34\uC5C7\uC744 \uBC14\uAFC0\uC9C0 \uBCF4\uC5EC \uC8FC\uAE30\uB9CC \uD55C\uB2E4 (\uC11C\uBC84 \uD655\uC778\uB3C4 \uD558\uC9C0 \uC54A\uC74C)\n --force \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\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\n\uC885\uB8CC \uCF54\uB4DC: 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) \u00B7 2 \uC798\uBABB\uB41C \uC0AC\uC6A9";
|
|
3
1
|
export declare const MCP_NAME = "elice-material";
|
|
4
2
|
/**
|
|
5
3
|
* 서버 환경 → MCP 주소. 표는 여기 하나만 둔다.
|
|
@@ -121,14 +119,4 @@ export declare function resolveUrl(args: {
|
|
|
121
119
|
}, env: McpEnv): ResolvedUrl;
|
|
122
120
|
/** 사람용 출력의 MCP 부분 (환경 · 서버 확인 · 도구별 결과) */
|
|
123
121
|
export declare function formatSetupLines(result: SetupResult, source: string, dryRun: boolean): string[];
|
|
124
|
-
export declare function run(args: {
|
|
125
|
-
sub: string | undefined;
|
|
126
|
-
target: string | undefined;
|
|
127
|
-
envName: string | undefined;
|
|
128
|
-
url: string | undefined;
|
|
129
|
-
dryRun: boolean;
|
|
130
|
-
force: boolean;
|
|
131
|
-
json: boolean;
|
|
132
|
-
env?: McpEnv | undefined;
|
|
133
|
-
}): Promise<CommandResult>;
|
|
134
122
|
export {};
|