@eliceio/cdk-cli 0.1.0-alpha.2 → 0.1.0-alpha.3
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 +158 -138
- package/es/cli.js +88 -33
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +16 -6
- package/es/commands/check/index.d.ts +8 -2
- package/es/commands/check/index.js +45 -5
- package/es/commands/create/index.d.ts +2 -0
- package/es/commands/create/index.js +28 -3
- package/es/commands/create/scaffold.d.ts +2 -0
- package/es/commands/create/scaffold.js +10 -6
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +6 -2
- package/es/commands/doctor/index.d.ts +11 -0
- package/es/commands/doctor/index.js +155 -26
- package/es/commands/mcp/index.d.ts +134 -0
- package/es/commands/mcp/index.js +399 -0
- package/es/commands/setup/index.d.ts +40 -0
- package/es/commands/setup/index.js +157 -0
- package/es/commands/skill/index.d.ts +2 -5
- package/es/commands/skill/index.js +1 -29
- package/es/core/config.d.ts +63 -19
- package/es/core/config.js +108 -32
- package/es/core/prepare.js +3 -5
- package/es/core/project-check.d.ts +15 -0
- package/es/core/project-check.js +26 -0
- package/es/core/templates.d.ts +25 -0
- package/es/core/templates.js +41 -0
- package/es/dev/grading.d.ts +14 -7
- package/es/dev/grading.js +27 -13
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +33 -33
- package/es/dev/mock-api.d.ts +20 -4
- package/es/dev/mock-api.js +70 -9
- package/es/dev/server.d.ts +7 -0
- package/es/dev/server.js +84 -23
- package/es/rules/check.js +56 -7
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +23 -9
- package/es/rules/manifest.js +60 -35
- package/es/rules/node.js +3 -1
- package/es/rules/semver.d.ts +5 -0
- package/es/rules/semver.js +32 -0
- package/es/rules/types.d.ts +27 -6
- package/es/rules.json.js +1 -1
- package/guides/content-development.md +136 -49
- package/package.json +2 -2
- package/rules.json +62 -7
- package/skills/_shared/always.md +3 -1
- package/skills/elice-content-check/SKILL.md +1 -1
- package/skills/elice-content-create/SKILL.md +4 -4
- package/skills/elice-content-migrate/SKILL.md +1 -1
- package/skills/elice-content-publish/SKILL.md +22 -0
- package/templates/_shared/lib/cdk-mock.d.ts +21 -3
- package/templates/_shared/lib/cdk-mock.js +239 -80
- package/templates/_shared/lib/cdk.js +2 -2
- package/templates/_shared/lib/elice-content.css +196 -0
- package/templates/_shared/lib/elice-content.d.ts +110 -5
- package/templates/_shared/lib/elice-content.js +643 -38
- package/templates/blank/README.md +12 -3
- package/templates/blank/completion.html +15 -0
- package/templates/blank/elice.config.json +3 -5
- package/templates/blank/gitignore +1 -0
- package/templates/blank/screens/completion.js +7 -0
- package/templates/blank/screens/edit.js +3 -0
- package/templates/blank/template.json +6 -0
- package/templates/quiz/README.md +35 -28
- package/templates/quiz/content.json +17 -63
- package/templates/quiz/core/behaviors.d.ts +5 -0
- package/templates/quiz/core/behaviors.js +12 -0
- package/templates/quiz/core/model.d.ts +27 -1
- package/templates/quiz/core/model.js +199 -4
- package/templates/quiz/elice.config.json +1 -6
- package/templates/quiz/gitignore +1 -0
- package/templates/quiz/grading.json +1 -10
- package/templates/quiz/screens/edit.js +105 -31
- package/templates/quiz/screens/learn.js +7 -8
- package/templates/quiz/template.json +6 -0
- package/templates/quiz/ui/templates/edit.d.ts +2 -0
- package/templates/quiz/ui/templates/edit.js +16 -9
- package/templates/quiz/ui/texts.js +52 -27
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { access, readFile, appendFile } from 'node:fs/promises';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { resolve, join, dirname } from 'node:path';
|
|
4
|
+
import { loadConfig, CONFIG_FILE, loadGradingFile, legacyGradingTypesWarning, loadGrading, GRADING_DATA_FILE } from '../../core/config.js';
|
|
4
5
|
import { prepareContent } from '../../core/prepare.js';
|
|
6
|
+
import { projectCheckOptions } from '../../core/project-check.js';
|
|
7
|
+
import { parseTemplateRef, listTemplates } from '../../core/templates.js';
|
|
5
8
|
import { checkFiles } from '../../rules/check.js';
|
|
6
9
|
import { lineSkipper } from '../../rules/skip.js';
|
|
7
10
|
import { RULES_VERSION } from '../../rules/spec.js';
|
|
8
11
|
import 'fflate';
|
|
9
12
|
import { VERSION } from '../../version.js';
|
|
13
|
+
import { defaultMcpEnv, detectTargets, claudeRegistration, helpyRegisteredUrl, envOfUrl, MCP_NAME } from '../mcp/index.js';
|
|
10
14
|
import { skillsDir, skillNames, inspectSkill } from '../skill/index.js';
|
|
15
|
+
import { compareVersions } from '../../rules/semver.js';
|
|
11
16
|
|
|
12
17
|
const usage = `사용법: ecdk doctor [프로젝트 폴더] [--fix] [--json]
|
|
13
18
|
|
|
@@ -87,21 +92,27 @@ async function checkGitignore(dir, config) {
|
|
|
87
92
|
/** Claude Code 스킬: 프로젝트(.claude/skills) 또는 홈(~/.claude/skills)에 모두 있고 CLI와 같은 버전인지 */
|
|
88
93
|
function checkSkills(dir, home) {
|
|
89
94
|
const fix = {
|
|
90
|
-
description: '스킬 설치 · 갱신',
|
|
91
|
-
command: 'ecdk
|
|
95
|
+
description: '스킬 설치 · 갱신 (MCP 등록까지 한 번에)',
|
|
96
|
+
command: 'ecdk setup',
|
|
92
97
|
auto: false
|
|
93
98
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
cwd: dir
|
|
97
|
-
});
|
|
99
|
+
// 프로젝트 폴더부터 위로(홈 · 루트까지) .claude/skills를 찾고, 없으면 홈(~/.claude/skills).
|
|
100
|
+
// Claude Code는 세션을 연 폴더의 .claude/skills를 읽으므로 ecdk create로 만든 하위 폴더에서도 상위 설치를 인정한다
|
|
98
101
|
const user = skillsDir({
|
|
99
102
|
project: false,
|
|
100
103
|
home
|
|
101
104
|
});
|
|
105
|
+
const dirs = [...projectSkillDirs(dir, home), user];
|
|
106
|
+
const where = new Set();
|
|
102
107
|
const statuses = skillNames().map(name => {
|
|
103
|
-
const
|
|
104
|
-
|
|
108
|
+
for (const d of dirs) {
|
|
109
|
+
const s = inspectSkill(d, name);
|
|
110
|
+
if (s.state !== 'missing') {
|
|
111
|
+
where.add(d);
|
|
112
|
+
return s;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return inspectSkill(user, name);
|
|
105
116
|
});
|
|
106
117
|
const missing = statuses.filter(s => s.state === 'missing').map(s => s.name);
|
|
107
118
|
const outdated = statuses.filter(s => s.state === 'outdated').map(s => s.name);
|
|
@@ -121,33 +132,90 @@ function checkSkills(dir, home) {
|
|
|
121
132
|
return {
|
|
122
133
|
id: 'skill.installed',
|
|
123
134
|
level: 'ok',
|
|
124
|
-
message: newer.length > 0 ? `Claude Code 스킬 ${statuses.length}개 · CLI(${VERSION})보다 새 버전: ${newer.join(', ')}` : `Claude Code 스킬 ${statuses.length}
|
|
135
|
+
message: newer.length > 0 ? `Claude Code 스킬 ${statuses.length}개 (${[...where].join(', ')}) · CLI(${VERSION})보다 새 버전: ${newer.join(', ')}` : `Claude Code 스킬 ${statuses.length}개 (${[...where].join(', ')})`
|
|
125
136
|
};
|
|
126
137
|
}
|
|
127
|
-
/**
|
|
138
|
+
/** 프로젝트를 만든 템플릿 · 버전 (elice.config.json template). 이 CLI에 더 새 버전이 있으면 알리기만 한다 (자동 갱신 없음) */
|
|
139
|
+
function checkTemplate(config) {
|
|
140
|
+
const id = 'project.template';
|
|
141
|
+
if (!config.template) return {
|
|
142
|
+
id,
|
|
143
|
+
level: 'skip',
|
|
144
|
+
message: '템플릿 정보 없음 (ecdk create 없이 만들었거나 옛 프로젝트)'
|
|
145
|
+
};
|
|
146
|
+
const {
|
|
147
|
+
name,
|
|
148
|
+
version
|
|
149
|
+
} = parseTemplateRef(config.template);
|
|
150
|
+
const shipped = listTemplates().find(t => t.name === name);
|
|
151
|
+
if (!shipped) return {
|
|
152
|
+
id,
|
|
153
|
+
level: 'ok',
|
|
154
|
+
message: `${config.template} (이 ecdk에는 없는 템플릿)`
|
|
155
|
+
};
|
|
156
|
+
const newer = version !== undefined && (compareVersions(shipped.version, version) ?? 0) > 0;
|
|
157
|
+
return {
|
|
158
|
+
id,
|
|
159
|
+
level: 'ok',
|
|
160
|
+
message: newer ? `${config.template} · 이 ecdk에는 ${name}@${shipped.version}이 있습니다 (자동으로 바꾸지 않음. 바뀐 점은 ecdk create --list와 템플릿 README)` : config.template
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** dir부터 위로 올라가며 <폴더>/.claude/skills 목록. 홈 폴더나 파일 시스템 루트에서 멈춘다 (홈은 사용자 위치라 따로) */
|
|
164
|
+
function projectSkillDirs(dir, home = homedir()) {
|
|
165
|
+
const out = [];
|
|
166
|
+
const stop = resolve(home);
|
|
167
|
+
let cur = resolve(dir);
|
|
168
|
+
for (;;) {
|
|
169
|
+
if (cur === stop) break;
|
|
170
|
+
out.push(skillsDir({
|
|
171
|
+
project: true,
|
|
172
|
+
cwd: cur
|
|
173
|
+
}));
|
|
174
|
+
const parent = dirname(cur);
|
|
175
|
+
if (parent === cur) break;
|
|
176
|
+
cur = parent;
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* grading.json: 편집 화면이 만드는 settings.grading 모양({ type: pattern | rubric }, 2026-11-11)인지. 옛 elice.config.json
|
|
182
|
+
* gradingTypes는 경고. 로컬 완료 정책은 .ecdk/completion.json(ecdk dev 완료 정책 화면, completionPolicies 안일 때) · 첫 값.
|
|
183
|
+
* 채점해 완료(on_graded)인데 grading.json이 없으면 ecdk dev 학생 보기가 답을 비교할 수 없다 (내용 편집에서 답을 저장하면 생김)
|
|
184
|
+
*/
|
|
128
185
|
async function checkGrading(dir, config) {
|
|
129
186
|
const id = 'project.grading';
|
|
130
|
-
if (
|
|
187
|
+
if (config.kind === 'description') return {
|
|
131
188
|
id,
|
|
132
189
|
level: 'skip',
|
|
133
|
-
message: '채점
|
|
190
|
+
message: '채점 없음 (문제 설명)'
|
|
134
191
|
};
|
|
192
|
+
const legacy = legacyGradingTypesWarning(config);
|
|
135
193
|
try {
|
|
136
194
|
const grading = await loadGrading(dir, config);
|
|
137
|
-
|
|
138
|
-
if (needsAnswers && !(await exists(join(dir, GRADING_DATA_FILE)))) return {
|
|
195
|
+
if (legacy) return {
|
|
139
196
|
id,
|
|
140
197
|
level: 'warn',
|
|
141
|
-
message:
|
|
198
|
+
message: legacy,
|
|
142
199
|
fix: {
|
|
143
|
-
description:
|
|
200
|
+
description: `${CONFIG_FILE}에서 gradingTypes 지우기`,
|
|
144
201
|
auto: false
|
|
145
202
|
}
|
|
146
203
|
};
|
|
204
|
+
const graded = grading?.completion_policy === 'on_graded';
|
|
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 ?? '-';
|
|
147
215
|
return {
|
|
148
216
|
id,
|
|
149
217
|
level: 'ok',
|
|
150
|
-
message:
|
|
218
|
+
message: `로컬 완료 정책 ${policy}${grading?.grading ? ` · ${GRADING_DATA_FILE} ${grading.grading.type}` : ''}`
|
|
151
219
|
};
|
|
152
220
|
} catch (e) {
|
|
153
221
|
return {
|
|
@@ -161,6 +229,63 @@ async function checkGrading(dir, config) {
|
|
|
161
229
|
};
|
|
162
230
|
}
|
|
163
231
|
}
|
|
232
|
+
/** 학습자료 서버 MCP(elice-material)가 찾은 도구 중 하나에라도 등록돼 있는지 (읽기만) */
|
|
233
|
+
function checkMcp(env) {
|
|
234
|
+
const id = 'mcp.material';
|
|
235
|
+
const fix = {
|
|
236
|
+
description: 'MCP 등록 (자료를 LXP에 올릴 때 필요)',
|
|
237
|
+
command: 'ecdk setup',
|
|
238
|
+
auto: false
|
|
239
|
+
};
|
|
240
|
+
const targets = detectTargets(env);
|
|
241
|
+
if (targets.length === 0) return {
|
|
242
|
+
id,
|
|
243
|
+
level: 'skip',
|
|
244
|
+
message: 'Claude Code · Helpy Code를 찾지 못함'
|
|
245
|
+
};
|
|
246
|
+
const found = [];
|
|
247
|
+
const notes = [];
|
|
248
|
+
const envs = new Set();
|
|
249
|
+
for (const t of targets) {
|
|
250
|
+
let url;
|
|
251
|
+
if (t === 'claude') {
|
|
252
|
+
const reg = claudeRegistration(env);
|
|
253
|
+
if (reg.state === 'unknown') {
|
|
254
|
+
notes.push(`Claude Code 확인 못 함 (${reg.reason})`);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (reg.state === 'other-scope') {
|
|
258
|
+
notes.push(`Claude Code는 ${reg.scope} 범위에만 있음 (이 폴더 전용, 다른 폴더에서는 없음)`);
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
url = reg.state === 'user' ? reg.url : null;
|
|
262
|
+
} else url = helpyRegisteredUrl(env);
|
|
263
|
+
if (!url) continue;
|
|
264
|
+
const name = envOfUrl(url);
|
|
265
|
+
envs.add(name);
|
|
266
|
+
found.push(`${t === 'claude' ? 'Claude Code' : 'Helpy Code'}(${name})`);
|
|
267
|
+
}
|
|
268
|
+
const extra = notes.length > 0 ? ` · ${notes.join(' · ')}` : '';
|
|
269
|
+
const notProd = [...envs].filter(e => e !== 'prod');
|
|
270
|
+
const note = notProd.length > 0 ? ` — ${notProd.map(e => e === 'custom' ? '직접 지정한 서버' : `QA 환경(${e})`).join(' · ')}에 연결됨, 운영 자료를 올리지 마세요` : '';
|
|
271
|
+
if (found.length > 0) return {
|
|
272
|
+
id,
|
|
273
|
+
level: 'ok',
|
|
274
|
+
message: `${MCP_NAME} 등록: ${found.join(', ')}${note}${extra}`
|
|
275
|
+
};
|
|
276
|
+
// 확인만 못 한 경우는 경고하지 않는다 (등록돼 있는데 느린 것일 수 있음)
|
|
277
|
+
if (notes.length > 0 && notes.every(n => n.includes('확인 못 함'))) return {
|
|
278
|
+
id,
|
|
279
|
+
level: 'skip',
|
|
280
|
+
message: `${MCP_NAME} 등록 ${notes.join(' · ')}`
|
|
281
|
+
};
|
|
282
|
+
return {
|
|
283
|
+
id,
|
|
284
|
+
level: 'warn',
|
|
285
|
+
message: `${MCP_NAME} MCP가 사용자 범위에 등록돼 있지 않습니다${extra}`,
|
|
286
|
+
fix
|
|
287
|
+
};
|
|
288
|
+
}
|
|
164
289
|
async function doctor(target, opts) {
|
|
165
290
|
const dir = resolve(target);
|
|
166
291
|
const checks = [checkNode(opts.nodeVersion ?? process.version), await checkPackageManager(dir)];
|
|
@@ -179,7 +304,7 @@ async function doctor(target, opts) {
|
|
|
179
304
|
message: `${CONFIG_FILE}을 읽을 수 없습니다: ${e.message}`
|
|
180
305
|
});
|
|
181
306
|
}
|
|
182
|
-
if (config) checks.push(await checkGrading(dir, config));
|
|
307
|
+
if (config) checks.push(checkTemplate(config), await checkGrading(dir, config));
|
|
183
308
|
if (config) {
|
|
184
309
|
const srcDir = resolve(dir, config.root);
|
|
185
310
|
if (!(await exists(srcDir))) {
|
|
@@ -226,10 +351,11 @@ async function doctor(target, opts) {
|
|
|
226
351
|
level: 'ok',
|
|
227
352
|
message: '콘텐츠가 정답·설정 파일을 참조하지 않음'
|
|
228
353
|
});
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
354
|
+
// grading.json 형식 오류는 project.grading이 알리므로 여기서는 없는 것으로 본다
|
|
355
|
+
const grading = config.kind === 'description' ? undefined : await loadGradingFile(dir).catch(() => undefined);
|
|
356
|
+
const result = checkFiles(files, projectCheckOptions(config, {
|
|
357
|
+
grading
|
|
358
|
+
}));
|
|
233
359
|
const errors = result.issues.filter(i => i.level === 'error');
|
|
234
360
|
const warns = result.issues.length - errors.length;
|
|
235
361
|
checks.push(errors.length > 0 ? {
|
|
@@ -257,6 +383,8 @@ async function doctor(target, opts) {
|
|
|
257
383
|
if (await exists(join(dir, 'package.json'))) checks.push(await checkGitignore(dir, config));
|
|
258
384
|
}
|
|
259
385
|
checks.push(checkSkills(dir, opts.home));
|
|
386
|
+
// MCP는 도구 설정을 읽으므로 실행 환경을 받았을 때만 (run은 실제 환경, 테스트는 가짜 환경)
|
|
387
|
+
if (opts.mcp) checks.push(checkMcp(opts.mcp));
|
|
260
388
|
// 서버 API(D8)가 정해지면 규칙·프로토콜 버전을 서버와 비교
|
|
261
389
|
checks.push({
|
|
262
390
|
id: 'compat.server',
|
|
@@ -294,7 +422,8 @@ function formatText(r) {
|
|
|
294
422
|
}
|
|
295
423
|
async function run(args) {
|
|
296
424
|
const result = await doctor(args.target, {
|
|
297
|
-
fix: args.fix
|
|
425
|
+
fix: args.fix,
|
|
426
|
+
mcp: defaultMcpEnv()
|
|
298
427
|
});
|
|
299
428
|
return {
|
|
300
429
|
exitCode: result.ok ? 0 : 1,
|
|
@@ -308,4 +437,4 @@ function referencesAnswerFile(text) {
|
|
|
308
437
|
return skip.lines.some((line, i) => ANSWER_FILE.test(line) && !skip.isSkipped(i + 1, 'project.answer-import'));
|
|
309
438
|
}
|
|
310
439
|
|
|
311
|
-
export { checkNode, doctor, formatText, referencesAnswerFile, run, usage };
|
|
440
|
+
export { checkMcp, checkNode, checkSkills, checkTemplate, doctor, formatText, projectSkillDirs, referencesAnswerFile, run, usage };
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
export declare const MCP_NAME = "elice-material";
|
|
4
|
+
/**
|
|
5
|
+
* 서버 환경 → MCP 주소. 표는 여기 하나만 둔다.
|
|
6
|
+
* prod는 material API 주소(api-material.elice.io)에 /mcp를 붙인 **가정**이다: 2026-11-10 운영에는 아직 MCP가 없고
|
|
7
|
+
* (GET 405), 백엔드가 주소를 확정해 주기로 함 (백엔드 요청 B1). 그래서 등록 전에 probe로 확인한다.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MCP_ENVS: Record<string, string>;
|
|
10
|
+
export declare const DEFAULT_ENV = "prod";
|
|
11
|
+
export type McpTarget = 'claude' | 'helpycode';
|
|
12
|
+
/** 바깥 세계(HOME · PATH · 명령 실행)를 바꿔 끼울 수 있게 (테스트는 실제 설정을 건드리지 않음) */
|
|
13
|
+
export interface McpEnv {
|
|
14
|
+
home: string;
|
|
15
|
+
platform: NodeJS.Platform;
|
|
16
|
+
/** PATH에서 명령을 찾는다 (없으면 null) */
|
|
17
|
+
which(command: string): string | null;
|
|
18
|
+
/** 명령 실행 (시간 제한 ms) */
|
|
19
|
+
/** timedOut: 시간 초과 · 실행 실패 (결과를 알 수 없음) */
|
|
20
|
+
exec(command: string, args: string[], timeoutMs: number): {
|
|
21
|
+
code: number;
|
|
22
|
+
stdout: string;
|
|
23
|
+
timedOut?: boolean;
|
|
24
|
+
};
|
|
25
|
+
exists(path: string): boolean;
|
|
26
|
+
/** 이 주소에 MCP 서버가 있는지 (로그인을 요구하는 401 + OAuth 안내면 ok) */
|
|
27
|
+
probe(url: string): Promise<{
|
|
28
|
+
ok: boolean;
|
|
29
|
+
detail: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** 환경 변수 ECDK_ENV */
|
|
32
|
+
envVar?: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
/** MCP initialize를 POST해 본다. 로그인 전이면 401과 www-authenticate(resource_metadata)가 와야 한다 */
|
|
35
|
+
export declare function probeMcp(url: string): Promise<{
|
|
36
|
+
ok: boolean;
|
|
37
|
+
detail: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function defaultMcpEnv(): McpEnv;
|
|
40
|
+
export declare const helpyConfigPath: (env: McpEnv) => string;
|
|
41
|
+
export declare function detectTargets(env: McpEnv): McpTarget[];
|
|
42
|
+
/** 주소로 환경 이름 (표에 없으면 custom) */
|
|
43
|
+
export declare const envOfUrl: (url: string) => string;
|
|
44
|
+
export type ClaudeRegistration = {
|
|
45
|
+
state: 'user';
|
|
46
|
+
url: string;
|
|
47
|
+
} | {
|
|
48
|
+
state: 'other-scope';
|
|
49
|
+
url: string;
|
|
50
|
+
scope: string;
|
|
51
|
+
} | {
|
|
52
|
+
state: 'none';
|
|
53
|
+
} | {
|
|
54
|
+
state: 'unknown';
|
|
55
|
+
reason: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Claude Code 등록 상태. `claude mcp get`은 서버 연결 상태까지 확인해 느릴 수 있으므로
|
|
59
|
+
* 시간 초과 · 실행 실패는 "없음"이 아니라 "확인 못 함"으로 본다.
|
|
60
|
+
* 범위(Scope) 줄이 User가 아니면 이 폴더 전용(local · project) 등록이라 다른 폴더에서는 없다.
|
|
61
|
+
* Scope 줄이 없으면(옛 Claude CLI) 사용자 범위로 본다.
|
|
62
|
+
*/
|
|
63
|
+
export declare function claudeRegistration(env: McpEnv): ClaudeRegistration;
|
|
64
|
+
/** Claude Code 사용자 범위에 등록된 주소 (없거나 확인 못 하면 null) */
|
|
65
|
+
export declare function claudeRegisteredUrl(env: McpEnv): string | null;
|
|
66
|
+
type HelpyConfig = {
|
|
67
|
+
kind: 'missing';
|
|
68
|
+
} | {
|
|
69
|
+
kind: 'json';
|
|
70
|
+
data: Record<string, unknown>;
|
|
71
|
+
text: string;
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'jsonc';
|
|
74
|
+
text: string;
|
|
75
|
+
};
|
|
76
|
+
/** 주석 · 끝 쉼표가 있으면 다시 쓰지 않는다 (지우면 사람이 적은 설명이 사라짐) */
|
|
77
|
+
export declare function readHelpyConfig(path: string): HelpyConfig;
|
|
78
|
+
/** Helpy Code 설정에 등록된 주소 (없으면 null, 읽을 수 없으면 undefined) */
|
|
79
|
+
export declare function helpyRegisteredUrl(env: McpEnv): string | null | undefined;
|
|
80
|
+
export type SetupAction = 'added' | 'replaced' | 'skipped' | 'would-add' | 'would-replace' | 'conflict' | 'manual' | 'unreachable' | 'failed';
|
|
81
|
+
export interface SetupStep {
|
|
82
|
+
target: McpTarget;
|
|
83
|
+
action: SetupAction;
|
|
84
|
+
message: string;
|
|
85
|
+
/** 사람이 붙여 넣을 내용 (주석이 있는 설정 파일일 때) */
|
|
86
|
+
paste?: string | undefined;
|
|
87
|
+
}
|
|
88
|
+
export interface SetupResult {
|
|
89
|
+
env: string;
|
|
90
|
+
probe: {
|
|
91
|
+
ok: boolean;
|
|
92
|
+
detail: string;
|
|
93
|
+
} | 'skipped';
|
|
94
|
+
url: string;
|
|
95
|
+
targets: McpTarget[];
|
|
96
|
+
steps: SetupStep[];
|
|
97
|
+
login: string[];
|
|
98
|
+
}
|
|
99
|
+
export declare function setup(opts: {
|
|
100
|
+
env: McpEnv;
|
|
101
|
+
envName: string;
|
|
102
|
+
url: string;
|
|
103
|
+
target: 'claude' | 'helpycode' | 'all';
|
|
104
|
+
dryRun: boolean;
|
|
105
|
+
force: boolean;
|
|
106
|
+
}): Promise<SetupResult>;
|
|
107
|
+
export declare const NEEDS_PERSON: SetupAction[];
|
|
108
|
+
export type ResolvedUrl = {
|
|
109
|
+
ok: true;
|
|
110
|
+
envName: string;
|
|
111
|
+
source: string;
|
|
112
|
+
url: string;
|
|
113
|
+
} | {
|
|
114
|
+
ok: false;
|
|
115
|
+
error: string;
|
|
116
|
+
};
|
|
117
|
+
/** 주소: --url > --env > ECDK_ENV > prod */
|
|
118
|
+
export declare function resolveUrl(args: {
|
|
119
|
+
envName: string | undefined;
|
|
120
|
+
url: string | undefined;
|
|
121
|
+
}, env: McpEnv): ResolvedUrl;
|
|
122
|
+
/** 사람용 출력의 MCP 부분 (환경 · 서버 확인 · 도구별 결과) */
|
|
123
|
+
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
|
+
export {};
|