@eliceio/cdk-cli 0.1.0-alpha.4 → 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.
Files changed (94) hide show
  1. package/README.md +182 -146
  2. package/es/cli.js +65 -66
  3. package/es/commands/build/index.js +17 -4
  4. package/es/commands/create/index.d.ts +1 -1
  5. package/es/commands/create/index.js +5 -9
  6. package/es/commands/dev/index.d.ts +1 -1
  7. package/es/commands/dev/index.js +4 -4
  8. package/es/commands/doctor/index.d.ts +18 -1
  9. package/es/commands/doctor/index.js +136 -26
  10. package/es/commands/mcp/index.d.ts +0 -12
  11. package/es/commands/mcp/index.js +6 -57
  12. package/es/commands/setup/index.d.ts +11 -3
  13. package/es/commands/setup/index.js +112 -37
  14. package/es/commands/skill/index.d.ts +46 -8
  15. package/es/commands/skill/index.js +151 -35
  16. package/es/commands/uninstall/index.d.ts +54 -0
  17. package/es/commands/uninstall/index.js +304 -0
  18. package/es/commands/update/index.d.ts +59 -0
  19. package/es/commands/update/index.js +251 -0
  20. package/es/commands/{check → validate}/index.d.ts +1 -1
  21. package/es/commands/{check → validate}/index.js +1 -1
  22. package/es/core/config.d.ts +20 -37
  23. package/es/core/config.js +36 -89
  24. package/es/core/latest.d.ts +21 -0
  25. package/es/core/latest.js +43 -0
  26. package/es/core/prepare.js +3 -2
  27. package/es/core/project-check.d.ts +2 -2
  28. package/es/core/project-check.js +2 -2
  29. package/es/core/templates.d.ts +1 -3
  30. package/es/core/templates.js +1 -4
  31. package/es/dev/grading.d.ts +7 -8
  32. package/es/dev/grading.js +6 -16
  33. package/es/dev/host-page.d.ts +1 -1
  34. package/es/dev/host-page.js +11 -9
  35. package/es/dev/mock-api.d.ts +8 -12
  36. package/es/dev/mock-api.js +50 -65
  37. package/es/dev/server.js +7 -26
  38. package/es/rules/check.js +11 -35
  39. package/es/rules/index.d.ts +1 -1
  40. package/es/rules/index.js +1 -1
  41. package/es/rules/manifest.d.ts +28 -20
  42. package/es/rules/manifest.js +58 -55
  43. package/es/rules/types.d.ts +1 -13
  44. package/es/rules.json.js +1 -1
  45. package/package.json +2 -3
  46. package/rules.json +12 -43
  47. package/skills/_shared/always.md +3 -3
  48. package/skills/elice-content-check/SKILL.md +10 -9
  49. package/skills/elice-content-create/SKILL.md +7 -7
  50. package/skills/elice-content-guide/SKILL.md +42 -0
  51. package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
  52. package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
  53. package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
  54. package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
  55. package/skills/elice-content-guide/topics/04-rules.md +12 -0
  56. package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
  57. package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
  58. package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
  59. package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
  60. package/skills/elice-content-guide/topics/09-check.md +10 -0
  61. package/skills/elice-content-guide/topics/10-build.md +8 -0
  62. package/skills/elice-content-guide/topics/11-more.md +4 -0
  63. package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
  64. package/skills/elice-content-migrate/SKILL.md +8 -7
  65. package/skills/elice-content-publish/SKILL.md +8 -8
  66. package/templates/_shared/lib/cdk-mock.d.ts +5 -13
  67. package/templates/_shared/lib/cdk-mock.js +40 -135
  68. package/templates/_shared/lib/elice-content.css +60 -1
  69. package/templates/_shared/lib/elice-content.d.ts +6 -37
  70. package/templates/_shared/lib/elice-content.js +23 -236
  71. package/templates/blank/README.md +5 -6
  72. package/templates/blank/metadata.json +1 -3
  73. package/templates/blank/package.json +2 -2
  74. package/templates/blank/screens/edit.js +1 -1
  75. package/templates/blank/template.json +2 -2
  76. package/templates/quiz/README.md +3 -3
  77. package/templates/quiz/core/behaviors.js +4 -1
  78. package/templates/quiz/core/editor.d.ts +9 -9
  79. package/templates/quiz/core/editor.js +16 -26
  80. package/templates/quiz/core/model.js +3 -3
  81. package/templates/quiz/metadata.json +1 -3
  82. package/templates/quiz/package.json +2 -2
  83. package/templates/quiz/screens/edit.js +17 -6
  84. package/templates/quiz/screens/learn.js +5 -2
  85. package/templates/quiz/styles.css +23 -27
  86. package/templates/quiz/template.json +2 -2
  87. package/templates/quiz/ui/templates/edit.js +29 -15
  88. package/templates/quiz/ui/templates/group.js +10 -2
  89. package/templates/quiz/ui/texts.js +4 -6
  90. package/es/commands/guide/index.d.ts +0 -29
  91. package/es/commands/guide/index.js +0 -120
  92. package/guides/content-development.md +0 -302
  93. package/templates/blank/completion.html +0 -15
  94. package/templates/blank/screens/completion.js +0 -7
@@ -2,22 +2,20 @@
2
2
  * @eliceio/cdk 1.x(EliceCDK)와 같은 공개 인터페이스를 가진 mock · 템플릿이 제공 (고치지 마세요)
3
3
  *
4
4
  * 서버 없이 화면을 시험할 때 키트가 대신 씁니다. 실제 SDK와 다른 점:
5
- * - 채점: 편집 화면이 저장한 채점 설정(settings.grading { type: pattern | rubric })과 완료 정책으로 로컬 채점.
5
+ * - 채점: 편집 화면이 저장한 채점 설정(settings.grading { type: pattern | rubric })이 있으면 로컬 채점, 없으면 제출만 받음.
6
6
  * pattern 답은 정규식 하나, 답 문자열 전체 일치. 프로젝트 폴더를 그대로 열면 ecdk dev가 저장한 .ecdk/settings.json으로 시작
7
- * - 완료 정책: material.completionPolicy · completionPolicies와 saveCompletionPolicy를 흉내 낸다. 지원하는 정책은
8
- * metadata completionPolicies(프로젝트의 metadata.json · ecdk dev가 주는 값)이고, 처음 값은
9
- * .ecdk/completion.json(그 안에 있을 때) · 없으면 첫 값(서버가 업로드 때 정하는 값). 바꾼 값은 이 브라우저에만
7
+ * - 완료 정책: 흉내 내지 않는다 (LXP에 올린 뒤 설정 탭에서 교육자가 고름, ADR 0012). material.completionPolicy는 null
10
8
  * - 저장: 설정 화면이 저장한 내용과 제출 기록을 브라우저에 남겨 다른 화면에서도 보임
11
9
  * (sandbox라 저장소가 막히면 이 페이지 안에서만)
12
10
  * - 보는 사람: 주소에 #viewer=student | instructor | tutor (mock 전용, 기본 student)
13
11
  * #preview=1 · #edit=1은 실제 SDK처럼 토큰 없는 draft (viewer는 instructor, 편집 저장은 draft_not_saved)
14
- * - 편집 화면: #scope=edit (mock 전용) = 저장된 버전을 edit 토큰으로 연 편집 화면. saveSettings가 저장된다
12
+ * - 편집 화면: #scope=edit (mock 전용) = edit 토큰으로 연 편집 화면. saveSettings가 저장된다 (실제는 자료의 draft에,
13
+ * 학생에게는 LXP 편집 페이지의 저장 뒤. mock은 이 브라우저의 다른 화면에 바로 보임)
14
+ * 실제 SDK처럼 account · result는 null (edit 토큰은 /me를 부르지 않음)
15
15
  * 편집 화면이 넣은 settings.grading은 학생 화면의 material.settings에서 서버처럼 빼고 준다
16
- * - 완료 정책 화면: #scope=edit&screen=completionPolicy (mock 전용). saveCompletionPolicy가 저장된다.
17
- * #completionPolicy=1은 토큰 없는 draft (저장은 draft_not_saved)
18
16
  * - 수업 페이지 이동: 아무 데도 가지 않고, 이전·다음 페이지는 없음(false)
19
17
  * - 시나리오: 주소에 ?mock=session_expired | rate_limited | request_failed | external_service_error
20
- * | slow | content_not_ready | unauthorized | material_changed
18
+ * | slow | content_not_ready | unauthorized | draft_not_ready
21
19
  *
22
20
  * 실제 SDK: @eliceio/cdk 1.x (eliceio-cdk-v2 feat/PLAT-4973-monorepo) 기준
23
21
  */
@@ -59,7 +57,6 @@ const DEFAULT_ENTRIES = Object.freeze({
59
57
  learn: 'index.html',
60
58
  instructor: 'instructor.html',
61
59
  edit: 'edit.html',
62
- completionPolicy: 'completion.html',
63
60
  });
64
61
  /** rubric(AI) 채점 흉내 점수 */
65
62
  const RUBRIC_MOCK_SCORE = 80;
@@ -99,7 +96,6 @@ function parseHash(hash) {
99
96
  token: params.get('token'),
100
97
  preview: params.get('preview'),
101
98
  edit: params.get('edit'),
102
- completionPolicy: params.get('completionPolicy'),
103
99
  viewer: params.get('viewer'),
104
100
  scope: params.get('scope'),
105
101
  screen: params.get('screen'),
@@ -110,9 +106,6 @@ function parseHash(hash) {
110
106
  const answerText = answer =>
111
107
  typeof answer === 'string' ? answer.trim() : JSON.stringify(answer ?? null);
112
108
 
113
- /** 완료 정책 값 (서버 material_version.completion_policy) */
114
- const POLICIES = Object.freeze(['on_access', 'on_submit', 'on_graded']);
115
-
116
109
  /**
117
110
  * 채점 설정을 서버 모양(2026-11-11 결정)으로: `{ type: 'pattern', answer_key }` · `{ type: 'rubric', rubric }`.
118
111
  * camelCase(answerKey)도 받는다. 채점 방식이 아니면 null
@@ -129,20 +122,16 @@ export function normalizeGradingSettings(grading) {
129
122
  }
130
123
 
131
124
  /**
132
- * elice-material 채점 흉내 (완료 정책 → 채점 방식 → 점수). 실제 서버처럼 요청 안에서 바로 채점한
133
- * `{ isCorrect, score }`만 돌려준다. isCorrect는 완료(통과) 여부.
134
- * - on_access: 점수 없음(null) · on_submit: 100
135
- * - on_graded + pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞으면 100, 아니면 0
136
- * - on_graded + rubric: 바로 80점으로 흉내, 통과로 봄 (통과 기준 pass_threshold는 정해지지 않음, G136)
125
+ * elice-material 채점 흉내 (채점 방식 → 점수). 실제 서버처럼 요청 안에서 바로 채점한 `{ isCorrect, score }`만
126
+ * 돌려준다. 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012): 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
127
+ * - pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞으면 100, 아니면 0
128
+ * - rubric: 바로 80점으로 흉내, 통과로 봄 (통과 기준 pass_threshold는 정해지지 않음, G136)
129
+ * - 채점 설정 없음: 점수 없음 `{ isCorrect: null, score: null }`
137
130
  * @param {object | null} grading settings.grading
138
131
  * @param {unknown} answer
139
- * @param {string} [policy] 완료 정책. 없으면 채점 설정이 있으면 on_graded, 없으면 on_submit
140
132
  */
141
- export function gradeLocally(grading, answer, policy) {
133
+ export function gradeLocally(grading, answer) {
142
134
  const g = normalizeGradingSettings(grading);
143
- const p = policy ?? (g ? 'on_graded' : 'on_submit');
144
- if (p === 'on_submit') return { isCorrect: true, score: 100 };
145
- if (p !== 'on_graded') return { isCorrect: null, score: null };
146
135
  if (g?.type === 'pattern') {
147
136
  let ok = false;
148
137
  try {
@@ -165,8 +154,6 @@ const sleep = ms => new Promise(r => setTimeout(r, ms));
165
154
  * @property {() => void} [onSessionExpired]
166
155
  * @property {string} [scenario] ?mock= 대신 직접 지정
167
156
  * @property {object} [grading] 채점 설정 직접 지정 (settings.grading 모양, 테스트용)
168
- * @property {'on_access' | 'on_submit' | 'on_graded'} [completionPolicy] 로컬 완료 정책 대신 직접 지정
169
- * @property {Array<'on_access' | 'on_submit' | 'on_graded'>} [completionPolicies] metadata completionPolicies 대신 직접 지정
170
157
  * @property {Record<string, unknown>} [settings] 처음 저장된 내용
171
158
  * @property {(url: string) => Promise<unknown>} [loadJson] 테스트용
172
159
  * @property {number} [delayMs] 응답 지연 (scenario=slow면 1500)
@@ -183,9 +170,6 @@ export class MockEliceCDK {
183
170
  #screen = null;
184
171
  #entries = DEFAULT_ENTRIES;
185
172
  #grading = null;
186
- #policy = null;
187
- /** metadata completionPolicies (없으면 null) */
188
- #policies = null;
189
173
  #account = null;
190
174
  #metadata = null;
191
175
  #isDraft = false;
@@ -261,12 +245,12 @@ export class MockEliceCDK {
261
245
  description: { type: 'text', text: '' },
262
246
  entries: this.#entries,
263
247
  settings: this.#scope === 'edit' && effective ? { ...rest, grading: effective } : rest,
264
- completionPolicy: this.#effectivePolicy(),
265
- completionPolicies: this.#policies,
248
+ // 완료 정책은 LXP 설정 (로컬에는 없음)
249
+ completionPolicy: null,
266
250
  };
267
251
  }
268
252
  get result() {
269
- if (!this.initialized || this.#isDraft) return null;
253
+ if (!this.initialized || this.#isDraft || this.#scope === 'edit') return null;
270
254
  return this.#store.get('result', null);
271
255
  }
272
256
  /** mock 전용: 저장소가 브라우저에 남는지 (sandbox면 false) */
@@ -286,15 +270,9 @@ export class MockEliceCDK {
286
270
  if (this.#scenario === 'unauthorized')
287
271
  throw new EliceCDKError(ErrorCode.Unauthorized, 'Invalid token (mock).');
288
272
 
289
- const isDraft =
290
- params.token == null &&
291
- (params.preview === '1' || params.edit === '1' || params.completionPolicy === '1');
273
+ const isDraft = params.token == null && (params.preview === '1' || params.edit === '1');
292
274
  // 실제 SDK: draft는 instructor가 본다. 토큰이 있는 경우를 흉내 낼 때만 #viewer=로 고른다
293
- const editScope =
294
- params.edit === '1' || params.completionPolicy === '1' || params.scope === 'edit';
295
- const completionScreen =
296
- params.completionPolicy === '1' ||
297
- (params.scope === 'edit' && params.screen === 'completionPolicy');
275
+ const editScope = params.edit === '1' || params.scope === 'edit';
298
276
  const viewer = isDraft || editScope ? 'instructor' : (params.viewer ?? 'student');
299
277
  if (!VIEWERS.includes(viewer))
300
278
  throw new EliceCDKError(ErrorCode.InvalidParam, `Unknown viewer: ${viewer}`);
@@ -305,17 +283,6 @@ export class MockEliceCDK {
305
283
  if (local.settings && Object.keys(this.#store.get('settings', {})).length === 0)
306
284
  this.#store.set('settings', local.settings);
307
285
  this.#grading = normalizeGradingSettings(this.#options.grading) ?? local.grading;
308
- const policies = this.#options.completionPolicies ?? local.policies;
309
- this.#policies = policies;
310
- // 이 브라우저에 저장한 값은 지원하는 정책 안에 있을 때만. null이면 채점 설정이 있으면 on_graded,
311
- // 없으면 on_submit (#effectivePolicy)
312
- const stored = this.#store.get('completionPolicy', null);
313
- this.#policy =
314
- this.#options.completionPolicy ??
315
- (POLICIES.includes(stored) && (!policies || policies.includes(stored)) ? stored : null) ??
316
- local.policy ??
317
- policies?.[0] ??
318
- null;
319
286
  this.#entries = DEFAULT_ENTRIES;
320
287
 
321
288
  this.#isDraft = isDraft;
@@ -327,16 +294,18 @@ export class MockEliceCDK {
327
294
  // draft는 fragment가 화면을 알려 준다 (#edit=1이면 edit, 아니면 learn)
328
295
  this.#screen =
329
296
  this.#scope === 'edit'
330
- ? completionScreen
331
- ? 'completionPolicy'
332
- : 'edit'
297
+ ? 'edit'
333
298
  : !isDraft && viewer === 'instructor' && this.#entries.instructor
334
299
  ? 'instructor'
335
300
  : 'learn';
336
- this.#account = {
337
- anonymousId: isDraft ? 'preview' : 'mock-student',
338
- fullname: viewer === 'tutor' ? '김하늘 (mock)' : null,
339
- };
301
+ // Like the real SDK: an edit token does not call /me, so there is no account.
302
+ this.#account =
303
+ editScope && !isDraft
304
+ ? null
305
+ : {
306
+ anonymousId: isDraft ? 'preview' : 'mock-student',
307
+ fullname: viewer === 'tutor' ? '김하늘 (mock)' : null,
308
+ };
340
309
  this.#metadata = {
341
310
  materialId: '00000000-0000-0000-0000-000000000000',
342
311
  lecturePageId: null,
@@ -344,18 +313,6 @@ export class MockEliceCDK {
344
313
  };
345
314
 
346
315
  this.initialized = true;
347
- // "들어오면 완료": 학생이 처음 열면 서버가 100점으로 기록한다
348
- if (
349
- this.#effectivePolicy() === 'on_access' &&
350
- viewer === 'student' &&
351
- !isDraft &&
352
- this.#store.get('result', null) === null
353
- )
354
- this.#store.set('result', {
355
- score: 100,
356
- submitCount: 0,
357
- completedAt: new Date().toISOString(),
358
- });
359
316
  if (this.#scenario === 'session_expired') {
360
317
  setTimeout(
361
318
  () => {
@@ -387,7 +344,7 @@ export class MockEliceCDK {
387
344
  throw new EliceCDKError(ErrorCode.InvalidInput, 'Answer is over 64KB.');
388
345
  await this.#delay();
389
346
 
390
- const res = gradeLocally(this.#effectiveGrading(), answer, this.#effectivePolicy());
347
+ const res = gradeLocally(this.#effectiveGrading(), answer);
391
348
  if (this.#isDraft) this.#draftSubmissions.unshift(this.#submission(answer, res, 'preview'));
392
349
  else if (this.#viewer === 'student') this.#record(res, answer);
393
350
  return res;
@@ -401,46 +358,11 @@ export class MockEliceCDK {
401
358
  return submissions.slice(offset, offset + limit);
402
359
  }
403
360
 
404
- /**
405
- * 완료 정책 화면(screen completionPolicy)에서만. 실제 SDK처럼 지금 버전의 완료 정책을 바꾸고(mock은 이 브라우저에만)
406
- * 결과를 편집 페이지에 `settings-saved`로 알린다. 토큰 없는 draft(#completionPolicy=1)는 draft_not_saved,
407
- * 채점 설정 없는 on_graded는 서버처럼 MATERIAL_GRADING_REQUIRED(request_failed의 cause)로 거절
408
- * @param {'on_access' | 'on_submit' | 'on_graded'} policy
409
- */
410
- async saveCompletionPolicy(policy) {
411
- this.#assertReady();
412
- this.#assertScreen('completionPolicy');
413
- await this.#delay();
414
- try {
415
- if (this.#isDraft)
416
- throw new EliceCDKError(
417
- ErrorCode.DraftNotSaved,
418
- 'The completion policy of an unsaved upload cannot be saved (mock).'
419
- );
420
- if (!POLICIES.includes(policy))
421
- throw new EliceCDKError(ErrorCode.InvalidInput, `Unknown completion policy: ${policy}`);
422
- if (policy === 'on_graded' && !this.#effectiveGrading())
423
- throw new EliceCDKError(ErrorCode.RequestFailed, 'Grading is required (mock).', {
424
- cause: { code: 'MATERIAL_GRADING_REQUIRED' },
425
- });
426
- if (this.#scenario === 'material_changed')
427
- throw new EliceCDKError(ErrorCode.RequestFailed, 'Material changed (mock).', {
428
- cause: { code: 'MATERIAL_CHANGED' },
429
- });
430
- this.#policy = policy;
431
- this.#store.set('completionPolicy', policy);
432
- this.#postSettingsSaved({ status: 'saved' });
433
- } catch (err) {
434
- const code = err.cause?.cause?.code ?? err.code;
435
- this.#postSettingsSaved({ status: 'failed', code });
436
- throw err;
437
- }
438
- }
439
-
440
361
  /**
441
362
  * 편집 화면(screen edit)에서만. 실제 SDK처럼 저장하고(mock은 브라우저에 남겨 다른 화면의 `material.settings`로 보임)
442
363
  * 결과를 편집 페이지(부모 창)에 `settings-saved`로 알린다. 토큰 없는 draft(#edit=1)는 `draft_not_saved`로 거절.
443
- * 시나리오 ?mock=material_changed면 다른 사람이 먼저 저장한 것처럼 실패한다 (실제 SDK: request_failed, 서버 코드는 cause)
364
+ * 시나리오 ?mock=draft_not_ready면 업로드한 draft를 아직 처리 중인 것처럼 실패한다 (실제 SDK: content_not_ready, 서버 코드
365
+ * MATERIAL_DRAFT_NOT_READY는 cause)
444
366
  */
445
367
  async saveSettings(settings) {
446
368
  this.#assertReady();
@@ -452,9 +374,9 @@ export class MockEliceCDK {
452
374
  ErrorCode.DraftNotSaved,
453
375
  'Settings of an unsaved upload cannot be saved (mock).'
454
376
  );
455
- if (this.#scenario === 'material_changed')
456
- throw new EliceCDKError(ErrorCode.RequestFailed, 'Material changed (mock).', {
457
- cause: { code: 'MATERIAL_CHANGED' },
377
+ if (this.#scenario === 'draft_not_ready')
378
+ throw new EliceCDKError(ErrorCode.ContentNotReady, 'Draft is still processing (mock).', {
379
+ cause: { code: 'MATERIAL_DRAFT_NOT_READY' },
458
380
  });
459
381
  if (this.#scenario === 'request_failed')
460
382
  throw new EliceCDKError(ErrorCode.RequestFailed, 'Network error (mock).');
@@ -491,7 +413,6 @@ export class MockEliceCDK {
491
413
  this.#store.set('settings', {});
492
414
  this.#store.set('submissions', []);
493
415
  this.#store.set('result', null);
494
- this.#store.set('completionPolicy', null);
495
416
  this.#draftSubmissions = [];
496
417
  }
497
418
 
@@ -500,11 +421,6 @@ export class MockEliceCDK {
500
421
  return normalizeGradingSettings(this.#store.get('settings', {}).grading) ?? this.#grading;
501
422
  }
502
423
 
503
- /** 정해진 완료 정책, 없으면 채점 설정이 있으면 on_graded · 없으면 on_submit */
504
- #effectivePolicy() {
505
- return this.#policy ?? (this.#effectiveGrading() ? 'on_graded' : 'on_submit');
506
- }
507
-
508
424
  #assertReady() {
509
425
  if (!this.initialized) throw new EliceCDKError(ErrorCode.NotInitialized, 'Call init() first.');
510
426
  if (this.#isSessionExpired)
@@ -538,8 +454,9 @@ export class MockEliceCDK {
538
454
  this.#store.set('submissions', submissions);
539
455
  const prev = this.#store.get('result', null);
540
456
  const score = res.score ?? prev?.score ?? null;
541
- // 완료는 통과(isCorrect)로: on_submit · pattern 100점 · rubric 흉내 점수
542
- const completed = res.isCorrect === true;
457
+ // 기록의 완료 시각: 채점 설정이 있으면 통과(pattern 100점 · rubric 흉내 점수)해야, 없으면 제출만으로
458
+ // (운영에서 완료 여부는 LXP 설정 탭의 완료 정책이 정한다)
459
+ const completed = res.isCorrect === true || !this.#effectiveGrading();
543
460
  this.#store.set('result', {
544
461
  score,
545
462
  submitCount: (prev?.submitCount ?? 0) + 1,
@@ -548,35 +465,23 @@ export class MockEliceCDK {
548
465
  }
549
466
 
550
467
  /**
551
- * 로컬 채점 설정 · 완료 정책. ecdk dev의 콘텐츠 주소를 직접 열면 dev가 주는 값을, 프로젝트 폴더를 그대로 열면
552
- * .ecdk/settings.json(ecdk dev 편집 화면이 저장한 내용 + 답) · .ecdk/completion.json과 completionPolicies(metadata.json)를
553
- * 읽는다 (.ecdk는 zip에서 빠짐, 로컬 채점용으로 일부러 읽음). 완료 정책은 .ecdk(목록 안일 때) > 첫 값
554
- * @returns {Promise<{ grading: object | null, policy: string | null, policies: string[] | null, settings?: object | null }>}
468
+ * 로컬 채점 설정. ecdk dev의 콘텐츠 주소를 직접 열면 dev가 주는 값을, 프로젝트 폴더를 그대로 열면
469
+ * .ecdk/settings.json(ecdk dev 편집 화면이 저장한 내용 + 답)을 읽는다 (.ecdk는 zip에서 빠짐, 로컬 채점용으로 일부러 읽음)
470
+ * @returns {Promise<{ grading: object | null, settings?: object | null }>}
555
471
  */
556
472
  async #loadLocal() {
557
473
  const loadJson =
558
474
  this.#options.loadJson ?? (url => fetch(url).then(r => (r.ok ? r.json() : null)));
559
- const listOf = v => (Array.isArray(v) && v.length > 0 && v.every(p => POLICIES.includes(p)) ? v : null);
560
475
  const devGrading = globalThis.__ECDK_DEV__?.grading;
561
476
  if (typeof devGrading === 'string') {
562
477
  const dev = await loadJson(devGrading).catch(() => null);
563
- return {
564
- grading: normalizeGradingSettings(dev?.grading),
565
- policy: POLICIES.includes(dev?.completion_policy) ? dev.completion_policy : null,
566
- policies: listOf(dev?.completion_policies),
567
- };
478
+ return { grading: normalizeGradingSettings(dev?.grading) };
568
479
  }
569
- if (this.#options.grading) return { grading: null, policy: null, policies: null };
480
+ if (this.#options.grading) return { grading: null };
570
481
  // ecdk-ignore-next-line project.answer-import
571
482
  const saved = await loadJson('.ecdk/settings.json').catch(() => null);
572
- const local = await loadJson('.ecdk/completion.json').catch(() => null);
573
- const manifest = await loadJson('metadata.json').catch(() => null);
574
- const policies = listOf(manifest?.completionPolicies);
575
- const savedPolicy = local?.completion_policy;
576
483
  return {
577
484
  grading: null,
578
- policy: policies?.includes(savedPolicy) ? savedPolicy : (policies?.[0] ?? null),
579
- policies,
580
485
  settings: saved && typeof saved === 'object' && !Array.isArray(saved) ? saved : null,
581
486
  };
582
487
  }
@@ -265,7 +265,7 @@ button:disabled {
265
265
  max-width: 720px;
266
266
  margin-inline: auto;
267
267
  }
268
- /* 완료 정책 화면 (useCompletion) · 편집 화면 채점 방식 블록 (useGradingBlock): LXP 편집 › 설정 탭과 같은 모양.
268
+ /* 편집 화면 채점 방식 블록 (useGradingBlock): LXP 편집 › 설정 탭과 같은 모양.
269
269
  제목 h6 · 설명 body2 secondary, 방식마다 EDS 라디오 카드(테두리 1px, 고르면 primary 테두리 · primary-opacity02 바탕) */
270
270
  .ec-grading {
271
271
  display: flex;
@@ -351,6 +351,65 @@ button:disabled {
351
351
  outline: 2px solid var(--ec-accent);
352
352
  outline-offset: -1px;
353
353
  }
354
+ /* 아이콘 버튼 (EDS IconButton, 테두리 없음): 목록 · 카드의 ↑ · ↓ · 삭제처럼 반복되는 동작.
355
+ 누르는 영역 40px, 아이콘(svg 18~22px, stroke="currentColor")은 가운데. aria-label을 꼭 붙인다 */
356
+ button.ec-icon-button {
357
+ display: inline-flex;
358
+ align-items: center;
359
+ justify-content: center;
360
+ flex: none;
361
+ width: 40px;
362
+ min-height: 40px;
363
+ padding: 0;
364
+ border: 0;
365
+ background: none;
366
+ color: var(--eds-text-secondary);
367
+ }
368
+ button.ec-icon-button svg {
369
+ display: block;
370
+ }
371
+ button.ec-icon-button:hover {
372
+ background: var(--eds-action-hover);
373
+ }
374
+ /* 목록 안 항목 하나 빼기(보기 · 그룹 삭제): 빨간 원 안의 − . 묶음 전체 삭제(문항 카드)는 휴지통 + 기본 색 */
375
+ button.ec-icon-button.ec-danger {
376
+ color: var(--ec-no);
377
+ border-radius: 50%;
378
+ }
379
+ button.ec-icon-button.ec-danger:hover {
380
+ background: var(--ec-no-bg);
381
+ }
382
+ button.ec-icon-button:disabled {
383
+ background: none;
384
+ color: var(--eds-text-disabled);
385
+ }
386
+ /* 비어 있는 놓기 칸 (끌어 놓기 대상이 비었을 때): 파일 올리기 칸처럼 점선 상자 + 아이콘 + 굵은 안내 + 보조 안내 */
387
+ .ec-dropzone {
388
+ flex: 1;
389
+ display: flex;
390
+ flex-direction: column;
391
+ align-items: center;
392
+ justify-content: center;
393
+ gap: 4px;
394
+ min-height: 96px;
395
+ padding: 12px;
396
+ border: 1px dashed var(--ec-border);
397
+ border-radius: 12px;
398
+ background: var(--ec-surface);
399
+ color: var(--eds-text-tertiary);
400
+ font-size: var(--eds-fs-caption);
401
+ text-align: center;
402
+ /* 한국어는 어절 단위로 줄바꿈 */
403
+ word-break: keep-all;
404
+ }
405
+ .ec-dropzone p {
406
+ margin: 0;
407
+ }
408
+ .ec-dropzone-title {
409
+ color: var(--ec-muted);
410
+ font-size: var(--eds-fs-body2);
411
+ font-weight: var(--eds-fw-semibold);
412
+ }
354
413
  /* EDS Button text small */
355
414
  button.ec-text-button {
356
415
  min-height: 32px;
@@ -1,6 +1,6 @@
1
1
  // 편집기 자동완성용 타입. lib/elice-content.js와 같이 고치지 않습니다.
2
2
 
3
- export type Screen = 'learn' | 'instructor' | 'edit' | 'completionPolicy';
3
+ export type Screen = 'learn' | 'instructor' | 'edit';
4
4
  export type Scope = 'learn' | 'edit';
5
5
  export type Viewer = 'student' | 'instructor' | 'tutor';
6
6
 
@@ -61,8 +61,6 @@ export interface SaveOptions<C> {
61
61
  label?: string;
62
62
  }
63
63
 
64
- /** 완료 정책 (서버 material_version.completion_policy). 지원하는 정책은 metadata completionPolicies */
65
- export type CompletionPolicy = 'on_access' | 'on_submit' | 'on_graded';
66
64
  /** 채점 방식 (settings.grading.type) */
67
65
  export type GraderType = 'pattern' | 'rubric';
68
66
 
@@ -74,16 +72,6 @@ export type Grading =
74
72
  /** @deprecated Grading을 쓴다 */
75
73
  export type GradingPart = Grading;
76
74
 
77
- /** 완료 정책 읽기 · 바꾸기 (SDK material.completionPolicy · saveCompletionPolicy) */
78
- export interface CompletionApi {
79
- /** metadata completionPolicies (서버가 돌려주지 않으면 null, G132) */
80
- readonly policies: CompletionPolicy[] | null;
81
- /** 값 이름은 서버 material_version.completion_policy와 같다 */
82
- get(): Promise<{ completion_policy: CompletionPolicy | null; policies: CompletionPolicy[] | null }>;
83
- /** 완료 정책 화면에서만. policies 밖의 값 · 채점 설정 없는 on_graded는 거절 */
84
- set(policy: CompletionPolicy): Promise<void>;
85
- }
86
-
87
75
  export interface GradingBlockOptions {
88
76
  /** 고를 수 있는 채점 방식 (기본 둘 다) */
89
77
  graders?: GraderType[];
@@ -93,18 +81,6 @@ export interface GradingBlockOptions {
93
81
  root?: Element;
94
82
  }
95
83
 
96
- export interface CompletionOptions {
97
- /** 고를 수 있는 완료 정책 (기본 metadata completionPolicies, 서버가 주지 않으면 셋 다) */
98
- policies?: CompletionPolicy[];
99
- /** 넣을 곳. 없으면 화면 영역(#app)을 완료 정책 영역으로 채운다 ("불러오는 중"을 지움) */
100
- root?: Element;
101
- label?: string;
102
- }
103
-
104
- /** 완료 정책 문구 (열람 · 제출은 LXP 설정 탭 문구 그대로) */
105
- export declare const COMPLETION_POLICIES: Readonly<
106
- Record<CompletionPolicy, { label: string; description: string }>
107
- >;
108
84
  /** 채점 방식 문구 (LXP 설정 탭 문구 그대로) */
109
85
  export declare const GRADER_TYPES: Readonly<Record<GraderType, { label: string; description: string }>>;
110
86
  /** '작성 예시 보기' 기본 예시 [정규식, 뜻] */
@@ -138,6 +114,7 @@ export interface ContentApp<C = Record<string, unknown>> {
138
114
  scope: Scope;
139
115
  viewer: Viewer;
140
116
  readOnly: boolean;
117
+ /** 편집기의 draft 미리보기(#preview=1) · 저장 전 업로드의 편집 화면(#edit=1). 제출을 기록하지 않음 */
141
118
  isDraft: boolean;
142
119
  navigation: Navigation | null;
143
120
  isLocal: boolean;
@@ -158,10 +135,11 @@ export interface ContentApp<C = Record<string, unknown>> {
158
135
  lastSubmission(): Promise<
159
136
  (SubmitResult & { id: string; answer: unknown; createdAt: string }) | null
160
137
  >;
161
- /** 내용 저장 (편집 화면). grading을 주면 settings.grading으로 같이 저장, 없으면 저장된 채점 설정 그대로 */
138
+ /**
139
+ * 내용 저장 (편집 화면). 자료의 draft에 저장하고, 학생에게는 LXP 편집 페이지에서 저장(새 버전)한 뒤 보인다.
140
+ * grading을 주면 settings.grading으로 같이 저장, 없으면 저장된 채점 설정 그대로
141
+ */
162
142
  saveContent(content: C, grading?: Grading): Promise<void>;
163
- /** 완료 정책 (SDK material.completionPolicy · saveCompletionPolicy) */
164
- readonly completion: CompletionApi;
165
143
  /** 학생 화면 제출 영역 (보는 사람별 처리는 키트가) */
166
144
  useSubmit<A = unknown>(
167
145
  options: SubmitOptions<A>
@@ -189,15 +167,6 @@ export interface ContentApp<C = Record<string, unknown>> {
189
167
  readonly grader: GraderType;
190
168
  getGrading(): Grading | string;
191
169
  };
192
- /** 완료 정책 화면 (LXP 설정 탭의 완료 정책 영역) */
193
- useCompletion(options?: CompletionOptions): {
194
- element: Element;
195
- /** 지금 완료 정책을 불러온 뒤 끝남 */
196
- ready: Promise<void>;
197
- readonly policy: CompletionPolicy;
198
- markDirty(): void;
199
- readonly dirty: boolean;
200
- };
201
170
  }
202
171
 
203
172
  export interface StartOptions {