@eliceio/cdk-cli 0.1.0-alpha.5 → 0.1.0-alpha.7

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.
Files changed (87) hide show
  1. package/README.md +110 -84
  2. package/es/cli.js +7 -22
  3. package/es/commands/build/index.d.ts +5 -3
  4. package/es/commands/build/index.js +20 -11
  5. package/es/commands/create/scaffold.d.ts +2 -0
  6. package/es/commands/create/scaffold.js +15 -1
  7. package/es/commands/dev/index.d.ts +1 -1
  8. package/es/commands/dev/index.js +1 -1
  9. package/es/commands/doctor/index.d.ts +1 -1
  10. package/es/commands/doctor/index.js +5 -6
  11. package/es/commands/setup/index.d.ts +4 -7
  12. package/es/commands/setup/index.js +41 -70
  13. package/es/commands/uninstall/index.d.ts +9 -8
  14. package/es/commands/uninstall/index.js +41 -47
  15. package/es/commands/update/index.d.ts +4 -2
  16. package/es/commands/update/index.js +27 -18
  17. package/es/core/collect.js +1 -1
  18. package/es/core/config.d.ts +1 -1
  19. package/es/core/config.js +3 -3
  20. package/es/{commands/mcp/index.d.ts → core/mcp.d.ts} +11 -18
  21. package/es/{commands/mcp/index.js → core/mcp.js} +29 -51
  22. package/es/core/minify.js +31 -2
  23. package/es/core/prepare.js +1 -1
  24. package/es/core/sandbox.d.ts +25 -0
  25. package/es/core/sandbox.js +110 -8
  26. package/es/{commands/skill/index.d.ts → core/skills.d.ts} +1 -17
  27. package/es/{commands/skill/index.js → core/skills.js} +6 -22
  28. package/es/dev/grading.d.ts +1 -1
  29. package/es/dev/grading.js +1 -1
  30. package/es/dev/host-page.js +20 -5
  31. package/es/dev/inject.d.ts +6 -0
  32. package/es/dev/inject.js +16 -1
  33. package/es/dev/mock-api.js +0 -16
  34. package/es/dev/server.d.ts +4 -2
  35. package/es/dev/server.js +11 -3
  36. package/es/rules/check.js +71 -8
  37. package/es/rules/csp.d.ts +26 -0
  38. package/es/rules/csp.js +42 -0
  39. package/es/rules/index.d.ts +2 -1
  40. package/es/rules/index.js +2 -1
  41. package/es/rules/refs.d.ts +12 -2
  42. package/es/rules/refs.js +50 -18
  43. package/es/rules/types.d.ts +5 -0
  44. package/es/rules/unused.d.ts +2 -0
  45. package/es/rules/unused.js +4 -3
  46. package/es/rules.json.js +2 -2
  47. package/package.json +2 -2
  48. package/rules.json +37 -15
  49. package/skills/_shared/always.md +2 -1
  50. package/skills/elice-content-create/SKILL.md +2 -1
  51. package/skills/elice-content-guide/SKILL.md +1 -1
  52. package/skills/elice-content-guide/topics/01-check-the-environment.md +2 -2
  53. package/skills/elice-content-guide/topics/02-design-the-material.md +2 -0
  54. package/skills/elice-content-guide/topics/03-create-the-project.md +2 -2
  55. package/skills/elice-content-guide/topics/04-rules.md +3 -1
  56. package/skills/elice-content-guide/topics/05-screen-code.md +44 -13
  57. package/skills/elice-content-guide/topics/07-move-existing-html.md +1 -1
  58. package/skills/elice-content-guide/topics/08-fix-check-errors.md +21 -18
  59. package/skills/elice-content-guide/topics/09-check.md +1 -0
  60. package/skills/elice-content-guide/topics/10-build.md +1 -1
  61. package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +2 -2
  62. package/skills/elice-content-migrate/SKILL.md +4 -3
  63. package/skills/elice-content-publish/SKILL.md +1 -1
  64. package/templates/_shared/lib/cdk-mock.js +3 -3
  65. package/templates/_shared/lib/elice-content-editor.d.ts +80 -0
  66. package/templates/_shared/lib/elice-content-editor.js +1062 -0
  67. package/templates/_shared/lib/elice-content.css +354 -1
  68. package/templates/_shared/lib/elice-content.js +10 -3
  69. package/templates/blank/README.md +27 -2
  70. package/templates/blank/commentary.txt +5 -0
  71. package/templates/blank/screens/edit.js +38 -17
  72. package/templates/blank/screens/instructor.js +20 -8
  73. package/templates/blank/screens/learn.js +151 -13
  74. package/templates/blank/styles.css +171 -0
  75. package/templates/blank/template.json +2 -2
  76. package/templates/quiz/README.md +2 -2
  77. package/templates/quiz/core/editor.d.ts +2 -0
  78. package/templates/quiz/core/editor.js +16 -6
  79. package/templates/quiz/core/model.js +1 -1
  80. package/templates/quiz/screens/edit.js +117 -24
  81. package/templates/quiz/styles.css +86 -12
  82. package/templates/quiz/template.json +1 -1
  83. package/templates/quiz/ui/templates/edit.d.ts +4 -0
  84. package/templates/quiz/ui/templates/edit.js +46 -10
  85. package/templates/quiz/ui/templates/page.js +1 -2
  86. package/templates/quiz/ui/templates/text.js +10 -7
  87. package/templates/quiz/ui/texts.js +13 -9
@@ -1,20 +1,23 @@
1
1
  import { copyFileSync, writeFileSync, unlinkSync, readdirSync, statSync, rmdirSync } from 'node:fs';
2
2
  import { dirname, sep, join, basename } from 'node:path';
3
- import { defaultMcpEnv, MCP_NAME, claudeRegistration, helpyConfigPath, readHelpyConfig, helpyRegisteredUrl } from '../mcp/index.js';
4
- import { skillsDir, skillNames, markedSkillNames, inspectSkill, skillFiles, removeSkillFiles, isDotPath } from '../skill/index.js';
3
+ import { defaultMcpEnv, MCP_NAME, claudeRegistration, helpyConfigPath, readHelpyConfig, helpyRegisteredUrl } from '../../core/mcp.js';
4
+ import { skillsDir, skillNames, markedSkillNames, inspectSkill, skillFiles, removeSkillFiles, isDotPath } from '../../core/skills.js';
5
5
 
6
- const usage = `사용법: ecdk uninstall [--project] [--target claude|helpycode|all] [--dry-run] [--force] [--json]
6
+ const usage = `사용법: ecdk uninstall [--only skills|mcp] [--project] [--target claude|helpycode|all] [--force] [--json]
7
7
 
8
8
  ecdk setup이 설치한 것을 지운다: 스킬 5개(elice-content-create · -migrate · -check · -publish · elice-content-guide),
9
9
  옛 ecdk가 지금은 없는 이름으로 설치한 스킬(SKILL.md 끝에 ecdk 설치 표시가 있는 것)과
10
10
  학습자료 서버 MCP 등록(elice-material, Claude Code 사용자 설정 · Helpy Code 설정).
11
- --project 현재 폴더의 .claude/skills/에 설치한 스킬만 지운다 (MCP 등록은 모든 프로젝트가 같이 써서 건드리지 않음)
12
- --target MCP를 지울 도구 claude · helpycode · all(기본). 스킬은 한 곳(~/.claude/skills/)을 같이 써서 늘 지운다
13
- --dry-run 지울 것을 보여 주기만 한다
14
- --force 손으로 고친 스킬 · 손으로 고친 Helpy Code 항목도 지운다
15
11
  다른 스킬 · 다른 MCP 서버 · 프로젝트 · .ecdk/는 건드리지 않는다. CLI 자체는 지우지 않는다 (끝에 명령을 알려 줌).
16
12
 
17
- 종료 코드: 0 지움(또는 지울 것 없음) · 1 남긴 것 · 직접 할 일이 있음(손으로 고친 스킬, 주석이 있는 설정 파일) · 2 잘못된 사용`;
13
+ --only skills: 스킬만 지운다 (~/.claude/skills/)
14
+ mcp: 학습자료 서버 MCP 등록만 지운다
15
+ --project 현재 폴더의 .claude/skills/에 설치한 스킬을 지운다 (--only skills에서만)
16
+ --target MCP 등록을 지울 도구 claude · helpycode · all(기본). MCP 등록에만
17
+ --force 손으로 고친 스킬 · 손으로 고친 Helpy Code 항목도 지운다
18
+
19
+ 종료 코드: 0 지움(또는 지울 것 없음) · 1 남긴 것 · 직접 할 일이 있음(손으로 고친 스킬, 주석이 있는 설정 파일)
20
+ 2 잘못된 사용 (모르는 --only 값, --only skills에 --target, --project를 --only skills 없이)`;
18
21
  const NEXT = ['CLI 지우기: npm uninstall -g @eliceio/cdk-cli (npx로만 실행했다면 지울 것 없음)', '옛 Claude 플러그인 elice-content를 설치했었다면 Claude Code에서: /plugin uninstall elice-content@elice-content → /plugin marketplace remove elice-content'];
19
22
  /**
20
23
  * SKILL.md와 ecdk가 같이 설치한 파일(files)만 지우고, 폴더는 비었을 때만 지운다 (사람이 더한 파일은 남김)
@@ -57,10 +60,6 @@ function uninstallSkills(opts) {
57
60
  ...base,
58
61
  action: 'kept'
59
62
  };
60
- if (opts.dryRun) return {
61
- ...base,
62
- action: 'would-remove'
63
- };
64
63
  // 지문이 맞으면 같이 설치한 파일(가이드 topics/)도 지운다. 손으로 고친 스킬(--force)은 이 CLI가 설치하는 이름의 파일만
65
64
  const files = status.files ?? (skillNames(opts.root).includes(name) ? skillFiles(name, opts.root) : []);
66
65
  const extra = removeSkill(status.path, files);
@@ -74,7 +73,7 @@ function uninstallSkills(opts) {
74
73
  });
75
74
  }
76
75
  const CLAUDE_TIMEOUT_MS = 30000;
77
- function uninstallClaude(env, dryRun, explicit) {
76
+ function uninstallClaude(env, explicit) {
78
77
  if (!env.which('claude')) return explicit ? {
79
78
  target: 'claude',
80
79
  action: 'not-found',
@@ -99,11 +98,6 @@ function uninstallClaude(env, dryRun, explicit) {
99
98
  message: `사용자 범위 등록 없음. ${reg.scope} 범위 등록(${reg.url})은 ecdk가 만든 것이 아니라 그대로 둠 (지우려면 이 폴더에서 claude mcp remove ${MCP_NAME})`
100
99
  };
101
100
  const rm = ['mcp', 'remove', MCP_NAME, '--scope', 'user'];
102
- if (dryRun) return {
103
- target: 'claude',
104
- action: 'would-remove',
105
- message: `claude ${rm.join(' ')} (${reg.url})`
106
- };
107
101
  const r = env.exec('claude', rm, CLAUDE_TIMEOUT_MS);
108
102
  if (r.code !== 0 || r.timedOut) return {
109
103
  target: 'claude',
@@ -122,7 +116,7 @@ function isOurHelpyEntry(entry) {
122
116
  const e = entry;
123
117
  return Object.keys(e).every(k => k === 'type' || k === 'url' || k === 'enabled') && e.type === 'remote' && typeof e.url === 'string';
124
118
  }
125
- function uninstallHelpy(env, dryRun, force, explicit) {
119
+ function uninstallHelpy(env, force, explicit) {
126
120
  const path = helpyConfigPath(env);
127
121
  const config = readHelpyConfig(path);
128
122
  if (config.kind === 'missing') return explicit ? {
@@ -161,11 +155,6 @@ function uninstallHelpy(env, dryRun, force, explicit) {
161
155
  message: `${path}의 mcp.${MCP_NAME}가 ecdk가 쓴 모양과 달라(손으로 고침) 그대로 둠. 지우려면 --force`
162
156
  };
163
157
  const bakExists = env.exists(`${path}.bak`);
164
- if (dryRun) return {
165
- target: 'helpycode',
166
- action: 'would-remove',
167
- message: `${path}의 mcp.${MCP_NAME}${bakExists ? ' (.bak은 이미 있어 그대로 둠)' : ' (원본은 .bak)'}`
168
- };
169
158
  delete mcp[MCP_NAME];
170
159
  if (Object.keys(mcp).length === 0) delete data.mcp;else data.mcp = mcp;
171
160
  // .bak은 처음 한 번만 (ecdk setup이 만든 원본을 덮지 않게)
@@ -186,21 +175,20 @@ function uninstall(opts) {
186
175
  cwd: opts.cwd,
187
176
  home: env.home
188
177
  });
189
- const skills = uninstallSkills({
178
+ const skills = opts.only === 'mcp' ? [] : uninstallSkills({
190
179
  dir,
191
- dryRun: opts.dryRun,
192
180
  force: opts.force,
193
181
  root: opts.root
194
182
  });
195
183
  const mcp = [];
196
- // --project는 그 폴더의 스킬만. MCP 등록은 사용자 범위라 모든 프로젝트가 같이 씀
197
- if (!opts.project) {
184
+ // MCP 등록은 사용자 범위라 모든 프로젝트가 같이 씀 (--project는 --only skills에서만)
185
+ if (opts.only !== 'skills') {
198
186
  if (opts.target !== 'helpycode') {
199
- const s = uninstallClaude(env, opts.dryRun, opts.target === 'claude');
187
+ const s = uninstallClaude(env, opts.target === 'claude');
200
188
  if (s) mcp.push(s);
201
189
  }
202
190
  if (opts.target !== 'claude') {
203
- const s = uninstallHelpy(env, opts.dryRun, opts.force, opts.target === 'helpycode');
191
+ const s = uninstallHelpy(env, opts.force, opts.target === 'helpycode');
204
192
  if (s) mcp.push(s);
205
193
  }
206
194
  }
@@ -235,7 +223,6 @@ function uninstall(opts) {
235
223
  }
236
224
  const nothing = skills.every(s => s.action === 'missing') && mcp.every(s => s.action === 'none' || s.action === 'not-found' || s.action === 'other-scope');
237
225
  return {
238
- dryRun: opts.dryRun,
239
226
  dir,
240
227
  skills,
241
228
  mcp,
@@ -246,25 +233,28 @@ function uninstall(opts) {
246
233
  }
247
234
  const SKILL_ACTION = {
248
235
  removed: '지움',
249
- 'would-remove': '지울 예정',
250
236
  kept: '손으로 고친 스킬이라 그대로 둠 (--force로 지움)',
251
237
  missing: '없음'
252
238
  };
239
+ const usageError = message => ({
240
+ exitCode: 2,
241
+ output: `${message}\n\n${usage}`
242
+ });
253
243
  async function run(args) {
244
+ // 옵션 조합은 ecdk setup과 같게
245
+ const {
246
+ only
247
+ } = args;
248
+ if (only !== undefined && only !== 'skills' && only !== 'mcp') return usageError(`--only는 skills · mcp 중 하나입니다: ${only}`);
249
+ if (only === 'skills' && args.target !== undefined) return usageError('--target은 MCP 등록 옵션이라 --only skills와 같이 쓸 수 없습니다 (--only mcp 또는 --only 없이).');
250
+ if (args.project && only !== 'skills') return usageError('--project는 --only skills와 같이 씁니다 (MCP 등록 · 전체 uninstall은 모든 프로젝트가 같이 쓰는 사용자 범위).');
254
251
  const target = args.target ?? 'all';
255
- if (target !== 'claude' && target !== 'helpycode' && target !== 'all') return {
256
- exitCode: 2,
257
- output: `--target은 claude · helpycode · all 중 하나입니다.\n\n${usage}`
258
- };
259
- if (args.project && args.target !== undefined) return {
260
- exitCode: 2,
261
- output: `--project는 그 폴더의 스킬만 지워 --target(MCP)과 같이 쓸 수 없습니다.\n\n${usage}`
262
- };
252
+ if (target !== 'claude' && target !== 'helpycode' && target !== 'all') return usageError('--target은 claude · helpycode · all 중 하나입니다.');
263
253
  const result = uninstall({
264
254
  env: args.env ?? defaultMcpEnv(),
255
+ only,
265
256
  project: args.project,
266
257
  target,
267
- dryRun: args.dryRun,
268
258
  force: args.force,
269
259
  cwd: args.cwd
270
260
  });
@@ -273,14 +263,18 @@ async function run(args) {
273
263
  exitCode,
274
264
  output: JSON.stringify(result, null, 2)
275
265
  };
266
+ const what = only === 'skills' ? '스킬' : only === 'mcp' ? 'MCP 등록' : '스킬 · MCP 등록';
276
267
  const lines = [];
277
268
  if (result.nothing) {
278
- lines.push(`ecdk가 설치한 스킬 · MCP 등록이 없습니다 (스킬 위치: ${result.dir}).`, ...result.mcp.filter(s => s.action === 'other-scope').map(s => ` ${s.target}: ${s.message}`));
269
+ lines.push(`ecdk가 설치한 ${what}이 없습니다${only === 'mcp' ? '' : ` (스킬 위치: ${result.dir})`}.`, ...result.mcp.filter(s => s.action === 'other-scope').map(s => ` ${s.target}: ${s.message}`));
279
270
  } else {
280
- lines.push(`스킬${result.dryRun ? ' (미리보기, 아무것도 바꾸지 않음)' : ''}: ${result.dir}`);
281
- for (const s of result.skills) lines.push(` ${s.name}: ${SKILL_ACTION[s.action]}`);
282
- if (!args.project) {
283
- lines.push('', `학습자료 서버 MCP (${MCP_NAME})`);
271
+ if (only !== 'mcp') {
272
+ lines.push(`스킬: ${result.dir}`);
273
+ for (const s of result.skills) lines.push(` ${s.name}: ${SKILL_ACTION[s.action]}`);
274
+ }
275
+ if (only !== 'skills') {
276
+ if (lines.length > 0) lines.push('');
277
+ lines.push(`학습자료 서버 MCP (${MCP_NAME})`);
284
278
  if (result.mcp.length === 0) lines.push(' Claude Code · Helpy Code 등록 없음');
285
279
  for (const s of result.mcp) {
286
280
  lines.push(` ${s.target}: ${s.message}`);
@@ -291,7 +285,7 @@ async function run(args) {
291
285
  lines.push('', '남긴 것 · 직접 할 일');
292
286
  for (const i of result.issues) lines.push(` - ${i.message}`);
293
287
  }
294
- if (!result.dryRun) lines.push('', 'Claude Code · Helpy Code를 새로 열면 적용됩니다.');
288
+ lines.push('', 'Claude Code · Helpy Code를 새로 열면 적용됩니다.');
295
289
  }
296
290
  lines.push('', '그 밖에');
297
291
  for (const n of result.next) lines.push(` - ${n}`);
@@ -1,6 +1,6 @@
1
1
  import { type LatestResult } from '../../core/latest.js';
2
2
  import type { CommandResult } from '../../types.js';
3
- export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk update [--check] [--yes] [--json]\n\n npm latest \uD0DC\uADF8\uC758 ecdk\uB85C \uC62C\uB9B0\uB2E4. \uCC28\uB840\uB85C:\n 1. CLI \uC124\uCE58: npm install -g @eliceio/cdk-cli@<latest> (npx\uB85C \uC2E4\uD589 \uC911\uC774\uBA74 \uAC74\uB108\uB700)\n 2. \uC2A4\uD0AC \uAC31\uC2E0: \uC0C8\uB85C \uC124\uCE58\uD55C ecdk\uB85C ecdk setup --only skills (npx\uBA74 npx -y @eliceio/cdk-cli@<latest> setup --only skills)\n \uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC\uC740 \uADF8\uB300\uB85C \uB460, \uBC14\uAFB8\uB824\uBA74 ecdk setup --only skills --force\n 3. \uD504\uB85C\uC81D\uD2B8 SDK: \uD604\uC7AC \uD3F4\uB354\uAC00 @eliceio/cdk\uB97C \uC4F0\uB294 \uD504\uB85C\uC81D\uD2B8\uBA74 npm update @eliceio/cdk (\uD654\uBA74 \u00B7 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uB294 \uBC14\uAFB8\uC9C0 \uC54A\uC74C)\n \uC9C0\uAE08 \uBC84\uC804\uC774 latest\uC640 \uAC19\uAC70\uB098 \uB354 \uC0C8 \uBC84\uC804\uC774\uBA74 \uC544\uBB34\uAC83\uB3C4 \uD558\uC9C0 \uC54A\uB294\uB2E4 (\uB0B4\uB9AC\uC9C0 \uC54A\uC74C).\n --check \uD655\uC778\uB9CC (\uC9C0\uAE08 \u00B7 \uCD5C\uC2E0 \uBC84\uC804\uACFC \uC2E4\uD589\uD560 \uBA85\uB839)\n --yes \uBB3B\uC9C0 \uC54A\uACE0 \uC2E4\uD589 (\uC9C0\uAE08\uC740 \uB298 \uBB3B\uC9C0 \uC54A\uC74C, \uC2A4\uD06C\uB9BD\uD2B8\uC6A9)\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uCD5C\uC2E0\uC774\uAC70\uB098 \uC5C5\uB370\uC774\uD2B8\uD568 \u00B7 1 \uCD5C\uC2E0 \uBC84\uC804 \uD655\uC778 \uC2E4\uD328 \u00B7 \uB2E8\uACC4 \uC2E4\uD328 \u00B7 2 \uC798\uBABB\uB41C \uC0AC\uC6A9";
3
+ export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk update [--project] [--check] [--json]\n\n npm latest \uD0DC\uADF8\uC758 ecdk\uB85C \uC62C\uB9B0\uB2E4. \uCC28\uB840\uB85C:\n 1. CLI \uC124\uCE58: npm install -g @eliceio/cdk-cli@<latest> (npx\uB85C \uC2E4\uD589 \uC911\uC774\uBA74 \uAC74\uB108\uB700)\n 2. \uC2A4\uD0AC \uAC31\uC2E0: \uC0C8\uB85C \uC124\uCE58\uD55C ecdk\uB85C ecdk setup --only skills (npx\uBA74 npx -y @eliceio/cdk-cli@<latest> setup --only skills)\n \uC190\uC73C\uB85C \uACE0\uCE5C \uC2A4\uD0AC\uC740 \uADF8\uB300\uB85C \uB460, \uBC14\uAFB8\uB824\uBA74 ecdk setup --only skills --force\n 3. \uD504\uB85C\uC81D\uD2B8 SDK: \uD604\uC7AC \uD3F4\uB354\uAC00 @eliceio/cdk\uB97C \uC4F0\uB294 \uD504\uB85C\uC81D\uD2B8\uBA74 npm update @eliceio/cdk (\uD654\uBA74 \u00B7 \uD15C\uD50C\uB9BF \uCF54\uB4DC\uB294 \uBC14\uAFB8\uC9C0 \uC54A\uC74C)\n \uC9C0\uAE08 \uBC84\uC804\uC774 latest\uC640 \uAC19\uAC70\uB098 \uB354 \uC0C8 \uBC84\uC804\uC774\uBA74 \uC544\uBB34\uAC83\uB3C4 \uD558\uC9C0 \uC54A\uB294\uB2E4 (\uB0B4\uB9AC\uC9C0 \uC54A\uC74C).\n\n --project ~/.claude/skills/ \uB300\uC2E0 \uD604\uC7AC \uD3F4\uB354\uC758 .claude/skills/\uB97C \uAC31\uC2E0\uD55C\uB2E4 (2\uB2E8\uACC4\uB97C setup --only skills --project\uB85C)\n --check \uD655\uC778\uB9CC (\uC9C0\uAE08 \u00B7 \uCD5C\uC2E0 \uBC84\uC804\uACFC \uC2E4\uD589\uD560 \uBA85\uB839)\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uCD5C\uC2E0\uC774\uAC70\uB098 \uC5C5\uB370\uC774\uD2B8\uD568 \u00B7 1 \uCD5C\uC2E0 \uBC84\uC804 \uD655\uC778 \uC2E4\uD328 \u00B7 \uB2E8\uACC4 \uC2E4\uD328 \u00B7 2 \uC798\uBABB\uB41C \uC0AC\uC6A9";
4
4
  export type StepId = 'cli.install' | 'skill.install' | 'project.sdk';
5
5
  export type StepStatus = 'planned' | 'done' | 'warn' | 'skipped' | 'failed' | 'not-run';
6
6
  export interface UpdateStep {
@@ -20,7 +20,7 @@ export interface UpdateResult {
20
20
  npx: boolean;
21
21
  steps: UpdateStep[];
22
22
  notes: string[];
23
- /** 스킬 갱신 전에 ~/.claude/skills가 없어 이번에 만듦 (이미 열린 Claude Code 세션은 /reload-skills 한 번) */
23
+ /** 스킬 갱신 전에 스킬 폴더(~/.claude/skills, --project면 현재 폴더)가 없어 이번에 만듦 (이미 열린 Claude Code 세션은 /reload-skills 한 번) */
24
24
  skillsDirCreated: boolean;
25
25
  error?: string | undefined;
26
26
  }
@@ -50,10 +50,12 @@ export declare const isNpx: (scriptPath: string) => boolean;
50
50
  export declare const PERMISSION_HINT = "`sudo` \uB300\uC2E0 `npx`\uB85C \uC2E4\uD589, \uB610\uB294 fnm \u00B7 Homebrew\uB85C Node.js \uC7AC\uC124\uCE58";
51
51
  export declare function update(env: UpdateEnv, opts: {
52
52
  check: boolean;
53
+ project?: boolean | undefined;
53
54
  current?: string | undefined;
54
55
  }): Promise<UpdateResult>;
55
56
  export declare function formatText(r: UpdateResult, check: boolean): string;
56
57
  export declare function run(args: {
58
+ project?: boolean | undefined;
57
59
  check: boolean;
58
60
  json: boolean;
59
61
  }, env?: UpdateEnv, current?: string): Promise<CommandResult>;
@@ -5,12 +5,12 @@ import { fileURLToPath } from 'node:url';
5
5
  import { loadConfig } from '../../core/config.js';
6
6
  import { CLI_PACKAGE, LATEST_UPDATE_TIMEOUT_MS, isNewer, npmLatest } from '../../core/latest.js';
7
7
  import { SDK_PACKAGE, UPDATE_COMMAND, readProjectSdk } from '../../core/sdk.js';
8
+ import { skillsDir, reloadNotes } from '../../core/skills.js';
8
9
  import { listTemplates } from '../../core/templates.js';
9
10
  import { VERSION } from '../../version.js';
10
11
  import { templateNotice } from '../doctor/index.js';
11
- import { skillsDir, reloadNotes } from '../skill/index.js';
12
12
 
13
- const usage = `사용법: ecdk update [--check] [--yes] [--json]
13
+ const usage = `사용법: ecdk update [--project] [--check] [--json]
14
14
 
15
15
  npm latest 태그의 ecdk로 올린다. 차례로:
16
16
  1. CLI 설치: npm install -g ${CLI_PACKAGE}@<latest> (npx로 실행 중이면 건너뜀)
@@ -18,8 +18,9 @@ const usage = `사용법: ecdk update [--check] [--yes] [--json]
18
18
  손으로 고친 스킬은 그대로 둠, 바꾸려면 ecdk setup --only skills --force
19
19
  3. 프로젝트 SDK: 현재 폴더가 ${SDK_PACKAGE}를 쓰는 프로젝트면 ${UPDATE_COMMAND} (화면 · 템플릿 코드는 바꾸지 않음)
20
20
  지금 버전이 latest와 같거나 더 새 버전이면 아무것도 하지 않는다 (내리지 않음).
21
- --check 확인만 (지금 · 최신 버전과 실행할 명령)
22
- --yes 묻지 않고 실행 (지금은 늘 묻지 않음, 스크립트용)
21
+
22
+ --project ~/.claude/skills/ 대신 현재 폴더의 .claude/skills/를 갱신한다 (2단계를 setup --only skills --project로)
23
+ --check 확인만 (지금 · 최신 버전과 실행할 명령)
23
24
 
24
25
  종료 코드: 0 최신이거나 업데이트함 · 1 최신 버전 확인 실패 · 단계 실패 · 2 잘못된 사용`;
25
26
  /** 실행 못 함(명령 없음 등)은 code -1 */
@@ -62,14 +63,15 @@ const PERMISSION = /\bEACCES\b|\bEPERM\b|permission denied/i;
62
63
  const PERMISSION_HINT = '`sudo` 대신 `npx`로 실행, 또는 fnm · Homebrew로 Node.js 재설치';
63
64
  const HELPY_NOTE = "Helpy Code 데스크톱(macOS)에서 ecdk · npm을 찾지 못하면 로그인 셸로 실행합니다: zsh -ilc 'ecdk update'";
64
65
  const cliCommand = latest => `npm install -g ${CLI_PACKAGE}@${latest}`;
65
- const SKILL_ARGS = ['setup', '--only', 'skills'];
66
- const SKILL_COMMAND = `ecdk ${SKILL_ARGS.join(' ')}`;
66
+ /** --project면 현재 폴더의 .claude/skills/ */
67
+ const skillArgs = project => ['setup', '--only', 'skills', ...(project ? ['--project'] : [])];
68
+ const skillCommandOf = project => `ecdk ${skillArgs(project).join(' ')}`;
67
69
  /**
68
70
  * npx로 실행 중이면 이 프로세스(옛 캐시일 수 있음)가 아니라 latest 버전으로 스킬을 설치한다.
69
71
  * 옛 ecdk의 update도 새로 설치한 ecdk를 실행하므로 새 명령(setup --only skills)을 써도 된다
70
72
  */
71
- const npxSkillArgs = latest => ['-y', `${CLI_PACKAGE}@${latest}`, ...SKILL_ARGS];
72
- const skillCommand = (latest, npx) => npx ? ['npx', ...npxSkillArgs(latest)].join(' ') : SKILL_COMMAND;
73
+ const npxSkillArgs = (latest, project) => ['-y', `${CLI_PACKAGE}@${latest}`, ...skillArgs(project)];
74
+ const skillCommand = (latest, npx, project) => npx ? ['npx', ...npxSkillArgs(latest, project)].join(' ') : skillCommandOf(project);
73
75
  /** 프로젝트 SDK 단계: 현재 폴더 package.json에 @eliceio/cdk가 있을 때만 */
74
76
  async function projectStep(cwd) {
75
77
  if (!(await readProjectSdk(cwd))) return {
@@ -84,7 +86,7 @@ async function projectStep(cwd) {
84
86
  };
85
87
  }
86
88
  /** 할 일 (아직 실행하지 않음) */
87
- async function plan(env, latest, npx) {
89
+ async function plan(env, latest, npx, project) {
88
90
  return [npx ? {
89
91
  id: 'cli.install',
90
92
  status: 'skipped',
@@ -96,7 +98,7 @@ async function plan(env, latest, npx) {
96
98
  }, {
97
99
  id: 'skill.install',
98
100
  status: 'planned',
99
- command: skillCommand(latest, npx),
101
+ command: skillCommand(latest, npx, project),
100
102
  message: npx ? `npx로 ${latest} ecdk를 받아 설치` : '새로 설치한 ecdk로 설치'
101
103
  }, await projectStep(env.cwd)];
102
104
  }
@@ -141,7 +143,8 @@ async function update(env, opts) {
141
143
  latest: latest.version,
142
144
  upToDate: true
143
145
  });
144
- const steps = await plan(env, latest.version, npx);
146
+ const projectSkills = opts.project ?? false;
147
+ const steps = await plan(env, latest.version, npx, projectSkills);
145
148
  const result = make({
146
149
  ok: true,
147
150
  latest: latest.version,
@@ -168,24 +171,29 @@ async function update(env, opts) {
168
171
  } else env.log(`[1/3] CLI 설치 건너뜀: ${cli.message}`);
169
172
  // 2. 스킬: 새 스킬은 새 버전에 들어 있으므로 새 ecdk로 설치한다 (PATH의 새 ecdk, npx면 npx로 latest를 받아서)
170
173
  // 이 프로세스(npx 옛 캐시일 수 있음)에서 설치하면 옛 스킬을 깔고 완료로 알리게 되므로 하지 않는다
171
- const skillCmd = skills.command ?? SKILL_COMMAND;
174
+ const skillCmd = skills.command ?? skillCommandOf(projectSkills);
172
175
  // 새 ecdk가 쓰기 전에 본다 (새 ecdk의 안내는 옛 ecdk와 다를 수 있어 여기서 다시 알린다)
173
- const userSkills = skillsDir({
174
- project: false,
176
+ const skillsPath = skillsDir({
177
+ project: projectSkills,
178
+ cwd: env.cwd,
175
179
  home: env.home
176
180
  });
177
- const skillsDirExisted = existsSync(userSkills);
181
+ const skillsDirExisted = existsSync(skillsPath);
178
182
  env.log(`[2/3] 스킬 갱신: ${skillCmd}`);
179
- const sr = npx ? await env.run('npx', npxSkillArgs(latest.version)) : await env.run('ecdk', SKILL_ARGS);
183
+ // --project는 현재 폴더에 설치하므로 그 폴더에서 실행
184
+ const skillOpts = projectSkills ? {
185
+ cwd: env.cwd
186
+ } : {};
187
+ const sr = npx ? await env.run('npx', npxSkillArgs(latest.version, projectSkills), skillOpts) : await env.run('ecdk', skillArgs(projectSkills), skillOpts);
180
188
  if (sr.code === 0) skills.status = 'done';else if (sr.code === 1) {
181
189
  skills.status = 'warn';
182
- skills.message = `손으로 고친 스킬은 그대로 둠 (바꾸려면 ${SKILL_COMMAND} --force)`;
190
+ skills.message = `손으로 고친 스킬은 그대로 둠 (바꾸려면 ${skillCommandOf(projectSkills)} --force)`;
183
191
  } else {
184
192
  skills.status = 'failed';
185
193
  const why = PERMISSION.test(sr.output) ? `권한이 없어 설치하지 못했습니다 (EACCES). ${PERMISSION_HINT}` : `새 ecdk를 실행하지 못했습니다 (${sr.code < 0 ? sr.output.trim() : `종료 코드 ${sr.code}`})`;
186
194
  skills.message = npx ? `${why}. 직접 실행해 주세요: ${skillCmd}` : `${why}. 터미널을 새로 연 뒤 ${skillCmd}`;
187
195
  }
188
- result.skillsDirCreated = skills.status !== 'failed' && !skillsDirExisted && existsSync(userSkills);
196
+ result.skillsDirCreated = skills.status !== 'failed' && !skillsDirExisted && existsSync(skillsPath);
189
197
  // 3. 프로젝트 SDK (화면 · 템플릿 코드는 건드리지 않고 안내만)
190
198
  if (project.status === 'planned') {
191
199
  env.log(`[3/3] 프로젝트 SDK: ${UPDATE_COMMAND} (${env.cwd})`);
@@ -240,6 +248,7 @@ async function run(args, env = defaultUpdateEnv(), current) {
240
248
  cwd: resolve(env.cwd)
241
249
  }, {
242
250
  check: args.check,
251
+ project: args.project,
243
252
  current
244
253
  });
245
254
  return {
@@ -1,8 +1,8 @@
1
1
  import { readdir, readFile } from 'node:fs/promises';
2
2
  import { join, relative, sep } from 'node:path';
3
3
  import 'fflate';
4
- import { globToRegExp } from '../rules/path.js';
5
4
  import { rules } from '../rules/spec.js';
5
+ import { globToRegExp } from '../rules/path.js';
6
6
 
7
7
  /** 콘텐츠가 아니라 프로젝트 도구가 쓰는 파일. 원본 폴더가 프로젝트 루트일 때 빠진다. */
8
8
  const PROJECT_FILES = ['package.json', 'package-lock.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'yarn.lock', 'bun.lockb', 'tsconfig*.json', '*.d.ts',
@@ -51,7 +51,7 @@ export interface ContentConfig {
51
51
  outDir: string;
52
52
  /** 추가로 뺄 파일·폴더 (basename glob `*` 또는 프로젝트 기준 경로 접두사) */
53
53
  exclude: string[];
54
- /** true면 build가 JS · CSS · JSON을 줄여 zip에 넣는다 (용량 줄이기). 기본 false */
54
+ /** build가 JS · CSS · JSON을 줄여(주석 빼고) zip에 넣는다. 기본 true, false면 끈다 */
55
55
  minify?: boolean;
56
56
  /** minify와 함께: 줄인 JS · CSS마다 .map을 zip에 넣어 운영에서도 원본 위치로 오류를 본다 (용량이 늘어남) */
57
57
  sourcemap?: boolean;
package/es/core/config.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { readFile, writeFile, unlink } from 'node:fs/promises';
2
2
  import { join, resolve, basename } from 'node:path';
3
3
  import 'fflate';
4
- import { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_SCREENS, LEGACY_COMPLETION_FIELDS, parseManifest, serializeManifest, graderTypeError } from '../rules/manifest.js';
5
4
  import { rules } from '../rules/spec.js';
5
+ import { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_SCREENS, LEGACY_COMPLETION_FIELDS, parseManifest, serializeManifest, graderTypeError } from '../rules/manifest.js';
6
6
 
7
7
  /**
8
8
  * 채점 방식 = `settings.grading.type`. 원본은 rules.json `manifest.graderTypes`.
@@ -100,7 +100,7 @@ function parseBuildOptions(json, fail) {
100
100
  if (json.exclude !== undefined && !(Array.isArray(json.exclude) && json.exclude.every(x => typeof x === 'string'))) throw fail('exclude는 문자열 배열이어야 합니다.');
101
101
  if (json.minify !== undefined && typeof json.minify !== 'boolean') throw fail('minify는 true 또는 false여야 합니다.');
102
102
  if (json.sourcemap !== undefined && typeof json.sourcemap !== 'boolean') throw fail('sourcemap은 true 또는 false여야 합니다.');
103
- if (json.sourcemap && !json.minify) throw fail('sourcemap은 minify와 함께 씁니다 ("minify": true). 줄이지 않으면 원본 그대로라 필요 없습니다.');
103
+ if (json.sourcemap && json.minify === false) throw fail('sourcemap은 minify와 함께 씁니다 ("minify": false를 지우세요). 줄이지 않으면 원본 그대로라 필요 없습니다.');
104
104
  if (json.template !== undefined && typeof json.template !== 'string') throw fail('template은 문자열이어야 합니다 (ecdk create가 적는 값).');
105
105
  const out = {};
106
106
  for (const key of BUILD_OPTION_KEYS) if (json[key] !== undefined) out[key] = json[key];
@@ -109,7 +109,7 @@ function parseBuildOptions(json, fail) {
109
109
  /** package.json "ecdk": 빌드 옵션만. 플랫폼 필드는 metadata.json으로 안내한다 */
110
110
  function parsePackageOptions(value) {
111
111
  const fail = msg => new Error(`${PACKAGE_FILE} "${PACKAGE_CONFIG_KEY}": ${msg}`);
112
- if (!isRecord(value)) throw fail(`객체여야 합니다. 예: { "template": "quiz@1.0.0", "minify": true }`);
112
+ if (!isRecord(value)) throw fail(`객체여야 합니다. 예: { "template": "quiz@1.0.0", "minify": false }`);
113
113
  rejectAnswers(value, fail);
114
114
  const platform = Object.keys(value).filter(k => PLATFORM_KEYS.includes(k));
115
115
  if (platform.length > 0) throw fail(`${platform.join(' · ')}는 원본의 metadata.json에 적습니다 (ADR 0011). package.json "ecdk"에는 빌드 옵션(${BUILD_OPTION_KEYS.join(' · ')})만.`);
@@ -1,11 +1,10 @@
1
1
  export declare const MCP_NAME = "elice-material";
2
2
  /**
3
- * 서버 환경 → MCP 주소. 표는 여기 하나만 둔다.
4
- * prod는 material API 주소(api-material.elice.io)에 /mcp를 붙인 **가정**이다: 2026-11-10 운영에는 아직 MCP가 없고
5
- * (GET 405), 백엔드가 주소를 확정해 주기로 함 (백엔드 요청 B1). 그래서 등록 전에 probe로 확인한다.
3
+ * 운영 서버 MCP 주소. 그 밖의 서버는 --url로 준다 (사내 서버 주소는 패키지에 두지 않음).
4
+ * material API 주소(api-material.elice.io)에 /mcp를 붙인 **가정**이다: 2026-11-10 운영에는 아직 MCP가 없고
5
+ * (GET 405), 백엔드가 주소를 확정해 주기로 함. 그래서 등록 전에 probe로 확인한다.
6
6
  */
7
- export declare const MCP_ENVS: Record<string, string>;
8
- export declare const DEFAULT_ENV = "prod";
7
+ export declare const MCP_URL = "https://api-material.elice.io/mcp";
9
8
  export type McpTarget = 'claude' | 'helpycode';
10
9
  /** 바깥 세계(HOME · PATH · 명령 실행)를 바꿔 끼울 수 있게 (테스트는 실제 설정을 건드리지 않음) */
11
10
  export interface McpEnv {
@@ -26,8 +25,6 @@ export interface McpEnv {
26
25
  ok: boolean;
27
26
  detail: string;
28
27
  }>;
29
- /** 환경 변수 ECDK_ENV */
30
- envVar?: string | undefined;
31
28
  }
32
29
  /** MCP initialize를 POST해 본다. 로그인 전이면 401과 www-authenticate(resource_metadata)가 와야 한다 */
33
30
  export declare function probeMcp(url: string): Promise<{
@@ -37,8 +34,8 @@ export declare function probeMcp(url: string): Promise<{
37
34
  export declare function defaultMcpEnv(): McpEnv;
38
35
  export declare const helpyConfigPath: (env: McpEnv) => string;
39
36
  export declare function detectTargets(env: McpEnv): McpTarget[];
40
- /** 주소로 환경 이름 (표에 없으면 custom) */
41
- export declare const envOfUrl: (url: string) => string;
37
+ /** 주소로 환경 이름: 운영 주소면 prod, 아니면 custom (--url로 준 주소) */
38
+ export declare const envOfUrl: (url: string) => "prod" | "custom";
42
39
  export type ClaudeRegistration = {
43
40
  state: 'user';
44
41
  url: string;
@@ -59,8 +56,6 @@ export type ClaudeRegistration = {
59
56
  * Scope 줄이 없으면(옛 Claude CLI) 사용자 범위로 본다.
60
57
  */
61
58
  export declare function claudeRegistration(env: McpEnv): ClaudeRegistration;
62
- /** Claude Code 사용자 범위에 등록된 주소 (없거나 확인 못 하면 null) */
63
- export declare function claudeRegisteredUrl(env: McpEnv): string | null;
64
59
  type HelpyConfig = {
65
60
  kind: 'missing';
66
61
  } | {
@@ -75,7 +70,7 @@ type HelpyConfig = {
75
70
  export declare function readHelpyConfig(path: string): HelpyConfig;
76
71
  /** Helpy Code 설정에 등록된 주소 (없으면 null, 읽을 수 없으면 undefined) */
77
72
  export declare function helpyRegisteredUrl(env: McpEnv): string | null | undefined;
78
- export type SetupAction = 'added' | 'replaced' | 'skipped' | 'would-add' | 'would-replace' | 'conflict' | 'manual' | 'unreachable' | 'failed';
73
+ export type SetupAction = 'added' | 'replaced' | 'skipped' | 'conflict' | 'manual' | 'unreachable' | 'failed';
79
74
  export interface SetupStep {
80
75
  target: McpTarget;
81
76
  action: SetupAction;
@@ -88,7 +83,7 @@ export interface SetupResult {
88
83
  probe: {
89
84
  ok: boolean;
90
85
  detail: string;
91
- } | 'skipped';
86
+ };
92
87
  url: string;
93
88
  targets: McpTarget[];
94
89
  steps: SetupStep[];
@@ -99,7 +94,6 @@ export declare function setup(opts: {
99
94
  envName: string;
100
95
  url: string;
101
96
  target: 'claude' | 'helpycode' | 'all';
102
- dryRun: boolean;
103
97
  force: boolean;
104
98
  }): Promise<SetupResult>;
105
99
  export declare const NEEDS_PERSON: SetupAction[];
@@ -112,11 +106,10 @@ export type ResolvedUrl = {
112
106
  ok: false;
113
107
  error: string;
114
108
  };
115
- /** 주소: --url > --env > ECDK_ENV > prod */
109
+ /** 주소: --url, 없으면 운영 */
116
110
  export declare function resolveUrl(args: {
117
- envName: string | undefined;
118
111
  url: string | undefined;
119
- }, env: McpEnv): ResolvedUrl;
112
+ }): ResolvedUrl;
120
113
  /** 사람용 출력의 MCP 부분 (환경 · 서버 확인 · 도구별 결과) */
121
- export declare function formatSetupLines(result: SetupResult, source: string, dryRun: boolean): string[];
114
+ export declare function formatSetupLines(result: SetupResult, source: string): string[];
122
115
  export {};