@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,7 +2,7 @@ import { DEV_MATERIAL_ID } from './mock-api.js';
2
2
 
3
3
  /**
4
4
  * LXP 학습 · 편집 페이지 흉내. 보기를 바꾸고 콘텐츠를 sandbox iframe으로 띄우며,
5
- * @eliceio/cdk가 보내는 postMessage(settings-saved · navigate-*)를 받아 처리한다
5
+ * @eliceio/cdk가 보내는 postMessage(status · settings-saved · navigate-*)를 받아 처리한다
6
6
  */
7
7
  function hostPage(opts) {
8
8
  return `<!doctype html>
@@ -85,9 +85,7 @@ function hostPage(opts) {
85
85
  ['tutor', '튜터링', 'learn', 'token'],
86
86
  ['instructor', '교육자 화면', 'instructor', 'token'],
87
87
  ['edit', '내용 편집', 'edit', 'token'],
88
- // 완료 정책 화면 (ADR 0009): LXP 설정 탭처럼 edit 토큰 + screen=completionPolicy. screens.completionPolicy를 켠
89
- // 자료에서만 보인다 (퀴즈처럼 completionPolicies가 하나면 없음). 저장하면 .ecdk/completion.json, 채점 방식 · 답은 내용 편집
90
- ['completionPolicy', '완료 정책', 'completionPolicy', 'token'],
88
+ // 완료 정책 보기는 없다: 완료 정책은 LXP에 올린 뒤 설정 탭에서 교육자가 고른다 (ADR 0012)
91
89
  ];
92
90
  // 토큰 없는 미리보기(#preview=1)는 settings가 비고 늘 100점이라 학생 보기와 구분이 안 돼 보기 버튼에서 빼고,
93
91
  // SDK 기능 안의 도구로만 연다 (SDK · 키트는 이 상태를 따로 다룸: isDraftPreview, "기록되지 않음" 안내)
@@ -129,7 +127,7 @@ function hostPage(opts) {
129
127
  const url = state.contentBase + entry + '?ecdk=' + Date.now();
130
128
  if (fragment === 'token') {
131
129
  const { token } = await (await fetch('/__ecdk/token?scenario=' + scenario)).json();
132
- frame.src = url + '#token=' + token + '&baseUrl=' + BASE_URL + (screen === 'completionPolicy' ? '&screen=completionPolicy' : '');
130
+ frame.src = url + '#token=' + token + '&baseUrl=' + BASE_URL;
133
131
  } else {
134
132
  frame.src = url + '#' + fragment + '&baseUrl=' + BASE_URL;
135
133
  }
@@ -137,7 +135,7 @@ function hostPage(opts) {
137
135
  (state.kind === 'description' ? '문제 설명 · ' : '') + entry + ' · ' + (TOOLS.some((t) => t[0] === scenario) ? label : scenario);
138
136
  }
139
137
 
140
- // 화면(learn · instructor · edit · completionPolicy)은 검사기가 kindModes로 이미 걸러 state.entries에 켠 것만 온다.
138
+ // 화면(learn · instructor · edit)은 검사기가 kindModes로 이미 걸러 state.entries에 켠 것만 온다.
141
139
  // 문제 설명에는 학생 보기만 둔다: 다른 보기가 있는지는 서버 · LXP와 아직 정하지 않았다 (progress G81)
142
140
  const available = (s) => entryOf(s[2]) && (state.kind !== 'description' || s[0] === 'student');
143
141
  function renderScenarios() {
@@ -169,11 +167,15 @@ function hostPage(opts) {
169
167
  // 편집 화면의 saveSettings 결과. 저장은 콘텐츠가 edit 토큰으로 이미 했고, 편집 페이지는 표시만 한다
170
168
  case 'settings-saved':
171
169
  note(payload.status === 'saved'
172
- ? (current === 'completionPolicy'
173
- ? 'settings-saved: 완료 정책을 저장했습니다 (.ecdk/completion.json). 학생 보기가 이 정책으로 완료 · 채점합니다'
174
- : 'settings-saved: 저장했습니다. 다른 보기에서 material.settings로 받습니다 (내용 · 채점 방식 · 답은 .ecdk/settings.json)')
170
+ ? 'settings-saved: 저장했습니다. 다른 보기에서 material.settings로 받습니다 (내용 · 채점 방식 · 답은 .ecdk/settings.json)'
175
171
  : 'settings-saved: 저장 실패 (' + payload.code + ')');
176
172
  return;
173
+ // init의 불러오기 상태 (PLAT-5246). loading · ready는 매번 오므로 적지 않고, 실패만 적는다
174
+ // (LXP는 failed를 받으면 자기 실패 화면을 띄움: reason network · auth · config)
175
+ case 'status':
176
+ if (payload.state === 'failed')
177
+ note('status: 불러오기 실패 (' + payload.reason + ', ' + payload.code + ') — LXP는 실패 화면을 보여 줍니다');
178
+ return;
177
179
  case 'navigate-prev':
178
180
  note('navigate-prev: 이전 차시로 이동 (dev는 이동하지 않음)');
179
181
  return;
@@ -1,4 +1,4 @@
1
- import { type CompletionPolicy, type LocalGrading } from '../core/config.js';
1
+ import { type LocalGrading } from '../core/config.js';
2
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
3
  /**
4
4
  * elice-material API 흉내 (서버 설계 v25, @eliceio/cdk 1.x가 부르는 것만).
@@ -20,14 +20,14 @@ export type MaterialViewer = 'student' | 'instructor' | 'tutor';
20
20
  /**
21
21
  * dev 호스트 화면의 보기 (dev 전용). 토큰은 scope + viewer로 바뀐다.
22
22
  * - student · instructor · tutor: `#token=…` (scope learn)
23
- * - edit: `#token=…` (scope edit). LXP 편집 페이지처럼 저장된 버전의 편집 화면을 edit 토큰으로 열고,
24
- * 콘텐츠의 `saveSettings`가 이 토큰으로 바로 PATCH한다 (토큰 없는 `#edit=1` draft는 저장할 수 없음)
25
- * - completionPolicy: `#token=…&screen=completionPolicy` (scope edit). 완료 정책 화면 (ADR 0009). SDK
26
- * `saveCompletionPolicy`가 보낸 `PATCH { completion_policy }`를 `.ecdk/completion.json`에 쓴다 (운영은 material_version)
23
+ * - edit: `#token=…` (scope edit). LXP 편집 페이지처럼 편집 화면을 edit 토큰으로 열고,
24
+ * 콘텐츠의 `saveSettings`가 이 토큰으로 `PATCH /materials/{id}/draft`를 부른다 (토큰 없는 `#edit=1` draft는 저장할 수 없음).
25
+ * dev에는 draft 발행 단계가 없어 draft에 저장한 settings가 바로 지금 버전 settings가 된다
26
+ * 완료 정책은 LXP 설정이라 (ADR 0012) 흉내 내지 않는다: 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
27
27
  * 편집 화면의 `saveSettings`가 보낸 settings(내용 + `grading` { type: pattern | rubric })는 통째로 `.ecdk/settings.json`에 쓰고,
28
28
  * edit 범위 응답에는 `grading`까지, 학생 · 튜터 · 교육자(learn scope) 응답에는 서버처럼 `grading`을 빼고 준다
29
29
  */
30
- export type DevScenario = 'student' | 'instructor' | 'tutor' | 'edit' | 'completionPolicy';
30
+ export type DevScenario = 'student' | 'instructor' | 'tutor' | 'edit';
31
31
  /** 토큰을 발급하는 보기 */
32
32
  export type TokenScenario = DevScenario;
33
33
  export declare const TOKEN_SCENARIOS: Readonly<Record<DevScenario, {
@@ -53,7 +53,7 @@ interface Result {
53
53
  export interface MockState {
54
54
  /** 저장된 settings 전체 (내용 + grading). ecdk dev는 `.ecdk/settings.json`에서 읽고 저장할 때 씀 */
55
55
  settings: Record<string, unknown>;
56
- /** 저장할 때마다 올라가는 버전 번호. 응답의 `current_version.id`는 `dev-{n}` */
56
+ /** 버전 번호. 응답의 `current_version.id`는 `dev-{n}` */
57
57
  version: number;
58
58
  submissions: Submission[];
59
59
  /** 계정별 결과. 자료당 하나이고 버전이 바뀌어도 지우지 않는다 */
@@ -64,15 +64,11 @@ export interface MockState {
64
64
  export declare const createState: () => MockState;
65
65
  export interface MockApiOptions {
66
66
  state: MockState;
67
- /** 채점에 쓰는 값 (로컬 완료 정책 + 저장한 settings.grading) */
67
+ /** 채점에 쓰는 값 (저장한 settings.grading) */
68
68
  getGrading: () => LocalGrading | undefined;
69
69
  /** 편집 화면이 저장한 settings 전체(내용 + grading)를 `.ecdk/settings.json`에 쓴다 */
70
70
  saveSettings?: (settings: Record<string, unknown>) => Promise<void>;
71
71
  getEntries: () => Record<string, string>;
72
- /** metadata completionPolicies (서버가 metadata를 그대로 돌려준다고 보고 응답에 넣는다, G132) */
73
- getCompletionPolicies?: () => string[];
74
- /** 완료 정책 화면이 저장한 completion_policy를 .ecdk/completion.json에 쓴다 */
75
- saveCompletionPolicy?: (policy: CompletionPolicy) => Promise<void>;
76
72
  onEvent?: (message: string) => void;
77
73
  }
78
74
  /** `/api` 아래 요청을 처리한다 */
@@ -1,4 +1,4 @@
1
- import { COMPLETION_POLICIES, parseGrading } from '../core/config.js';
1
+ import { parseGrading } from '../core/config.js';
2
2
  import { grade } from './grading.js';
3
3
 
4
4
  /**
@@ -21,10 +21,6 @@ const TOKEN_SCENARIOS = Object.freeze({
21
21
  scope: 'edit',
22
22
  viewer: 'instructor'
23
23
  },
24
- completionPolicy: {
25
- scope: 'edit',
26
- viewer: 'instructor'
27
- },
28
24
  instructor: {
29
25
  scope: 'learn',
30
26
  viewer: 'instructor'
@@ -136,7 +132,7 @@ function record(state, accountId, change, completed) {
136
132
  const now = new Date().toISOString();
137
133
  state.results.set(accountId, {
138
134
  score: change.score ?? prev.score,
139
- submit_count: prev.submit_count + (change.submit_count ?? 0),
135
+ submit_count: prev.submit_count + (change.submit_count),
140
136
  completed_at: prev.completed_at ?? (completed ? now : null)
141
137
  });
142
138
  }
@@ -162,7 +158,7 @@ async function handleMockApi(req, res, path, opts) {
162
158
  expires_at: new Date(exp * 1000).toISOString()
163
159
  });
164
160
  }
165
- const m = path.match(/^\/materials\/([0-9a-f-]{36})(\/me|\/submissions|\/submissions\/me)?$/);
161
+ const m = path.match(/^\/materials\/([0-9a-f-]{36})(\/me|\/draft|\/submissions|\/submissions\/me)?$/);
166
162
  if (!m) return fail(res, 404, 'RESOURCE_NOT_FOUND', `no route: ${method} ${path}`);
167
163
  const claims = readClaims(req);
168
164
  if (!claims) return fail(res, 401, 'AUTHENTICATION_INVALID', 'missing or expired token (dev)');
@@ -195,82 +191,70 @@ async function handleMockApi(req, res, path, opts) {
195
191
  screens: Object.fromEntries(Object.entries(opts.getEntries()).map(([screen, entry]) => [screen, {
196
192
  entry,
197
193
  enabled: true
198
- }])),
199
- completionPolicies: opts.getCompletionPolicies?.() ?? []
194
+ }]))
200
195
  },
201
196
  file_tree: [],
202
- settings: withGrading(settings),
203
- completion_policy: opts.getGrading()?.completion_policy ?? 'on_access'
197
+ settings: withGrading(settings)
204
198
  }
205
199
  });
206
200
  if (method === 'GET' && sub === '') return send(res, 200, material(state.settings));
207
- // 편집 화면의 saveSettings · 완료 정책 화면의 saveCompletionPolicy: edit 토큰으로 지금 버전을 바로 고침.
208
- // 기준 버전이 다르면 409 (그 사이 다른 저장)
201
+ // 서버처럼 PATCH /materials/{id}는 settings를 받지 않는다 (422 extra_forbidden). dev는 발행 · 복원을 흉내 내지 않는다
209
202
  if (method === 'PATCH' && sub === '') {
203
+ if (claims.scope !== 'edit') return fail(res, 403, 'AUTH_PERMISSION_DENIED', 'save only with an edit token');
204
+ const {
205
+ json
206
+ } = await body(req);
207
+ if (json && typeof json === 'object' && 'settings' in json) return fail(res, 422, 'VALIDATION_ERROR', 'settings: use PATCH /materials/{id}/draft', [{
208
+ type: 'extra_forbidden',
209
+ loc: ['body', 'settings']
210
+ }]);
211
+ return fail(res, 400, 'INVALID_INPUT', 'empty_patch');
212
+ }
213
+ // 편집 화면의 saveSettings: edit 토큰으로 draft의 settings를 고침 (dev에서는 바로 지금 버전 settings)
214
+ if (method === 'PATCH' && sub === '/draft') {
210
215
  if (claims.scope !== 'edit') return fail(res, 403, 'AUTH_PERMISSION_DENIED', 'settings only with an edit token');
211
216
  const {
212
217
  json
213
218
  } = await body(req);
214
- const request = json;
215
- const settings = request?.settings;
216
- const rawPolicy = request?.completion_policy;
217
- if (settings === undefined && rawPolicy === undefined) return fail(res, 400, 'INVALID_INPUT', 'empty_patch');
218
- if (settings !== undefined && (!settings || typeof settings !== 'object')) return fail(res, 400, 'INVALID_INPUT', 'settings must be an object');
219
- if (rawPolicy !== undefined && !COMPLETION_POLICIES.includes(rawPolicy)) return fail(res, 400, 'INVALID_INPUT', `unknown completion_policy: ${JSON.stringify(rawPolicy)}`);
220
- const policy = rawPolicy;
221
- const expected = request?.expected_current_version_id;
222
- if (expected != null && expected !== `dev-${state.version}`) return fail(res, 409, 'MATERIAL_CHANGED', `current version is dev-${state.version}`);
223
- if (policy !== undefined) {
224
- // 서버는 enum만 본다. dev는 metadata completionPolicies 밖의 값도 알려 준다 (완료 정책 화면은 그 안에서만 고름)
225
- const allowed = opts.getCompletionPolicies?.() ?? [];
226
- if (allowed.length > 0 && !allowed.includes(policy)) return fail(res, 400, 'INVALID_INPUT', `completion_policy ${policy} is not in metadata completionPolicies (${allowed.join(', ')})`);
227
- // 서버처럼 채점 설정이 없는 on_graded는 거절 (편집 화면에서 답을 먼저 저장)
228
- if (policy === 'on_graded' && !state.settings.grading) return fail(res, 422, 'MATERIAL_GRADING_REQUIRED', 'on_graded needs settings.grading');
229
- }
219
+ const settings = json?.settings;
220
+ if (settings === undefined) return fail(res, 400, 'INVALID_INPUT', 'empty_patch');
221
+ if (!settings || typeof settings !== 'object') return fail(res, 400, 'INVALID_INPUT', 'settings must be an object');
230
222
  // 편집 화면이 보낸 settings는 통째로 .ecdk/settings.json으로 (dev 전용 저장 위치). grading이 없으면 저장된 채점 설정은 그대로
231
- if (settings !== undefined) {
232
- const {
233
- grading,
234
- ...rest
235
- } = settings;
236
- let next = rest;
237
- if (grading !== undefined && grading !== null) {
238
- const parsed = parseGrading(grading);
239
- if (typeof parsed === 'string') return fail(res, 400, 'INVALID_INPUT', `grading: ${parsed}`);
240
- next = {
241
- ...rest,
242
- grading: parsed
243
- };
244
- } else if (state.settings.grading !== undefined) next = {
223
+ const {
224
+ grading,
225
+ ...rest
226
+ } = settings;
227
+ let next = rest;
228
+ if (grading !== undefined && grading !== null) {
229
+ const parsed = parseGrading(grading);
230
+ if (typeof parsed === 'string') return fail(res, 400, 'INVALID_INPUT', `grading: ${parsed}`);
231
+ next = {
245
232
  ...rest,
246
- grading: state.settings.grading
233
+ grading: parsed
247
234
  };
248
- state.settings = next;
249
- await opts.saveSettings?.(next);
250
- log(`내용을 .ecdk/settings.json에 저장했습니다${next.grading ? ` (채점 설정 ${next.grading.type})` : ''}`);
251
- }
252
- if (policy !== undefined) {
253
- await opts.saveCompletionPolicy?.(policy);
254
- log(`완료 정책을 .ecdk/completion.json에 저장했습니다 (${policy})`);
255
- }
256
- state.version += 1;
257
- log(`자료를 저장했습니다 (${settings !== undefined ? 'settings' : 'completion_policy'}, 버전 dev-${state.version})`);
258
- return send(res, 200, material(state.settings));
235
+ } else if (state.settings.grading !== undefined) next = {
236
+ ...rest,
237
+ grading: state.settings.grading
238
+ };
239
+ state.settings = next;
240
+ await opts.saveSettings?.(next);
241
+ log(`내용을 .ecdk/settings.json에 저장했습니다${next.grading ? ` (채점 설정 ${next.grading.type})` : ''}`);
242
+ const {
243
+ metadata
244
+ } = material(state.settings).current_version;
245
+ return send(res, 200, {
246
+ id: 'dev-draft',
247
+ status: 'ready',
248
+ metadata,
249
+ file_tree: [],
250
+ settings: state.settings
251
+ });
259
252
  }
260
253
  if (method === 'GET' && sub === '/me') {
261
254
  const user = claims.viewer === 'instructor' ? MANAGER : STUDENT;
262
- if (claims.scope === 'learn' && claims.viewer === 'student' && opts.getGrading()?.completion_policy === 'on_access' && !state.results.has(subject)) {
263
- record(state, subject, {
264
- score: 100
265
- }, true);
266
- log('열람 완료로 100점 (on_access)');
267
- }
268
- const local = opts.getGrading();
269
255
  return send(res, 200, {
270
256
  scope: claims.scope,
271
257
  viewer: claims.viewer,
272
- completion_policy: local?.completion_policy ?? 'on_access',
273
- grading_type: local?.completion_policy === 'on_graded' ? local.grading?.type ?? null : null,
274
258
  user: {
275
259
  anonymous_id: user.anonymous_id,
276
260
  fullname: user.fullname
@@ -319,10 +303,11 @@ async function handleMockApi(req, res, path, opts) {
319
303
  is_correct: isCorrect,
320
304
  score
321
305
  });
306
+ // 채점 설정이 있으면 통과해야, 없으면 제출만으로 기록에 완료 시각을 남긴다 (운영 완료 여부는 LXP 완료 정책이 정함)
322
307
  record(state, subject, {
323
308
  score,
324
309
  submit_count: 1
325
- }, isCorrect === true);
310
+ }, isCorrect === true || !opts.getGrading()?.grading);
326
311
  log(`학생 제출: ${score ?? '-'}점 (${isCorrect === null ? '채점 없음' : isCorrect ? '정답' : '오답'})`);
327
312
  return send(res, 200, {
328
313
  is_correct: isCorrect,
package/es/dev/server.js CHANGED
@@ -2,7 +2,7 @@ import { watch } from 'node:fs';
2
2
  import { rm, mkdir, writeFile } from 'node:fs/promises';
3
3
  import { createServer } from 'node:http';
4
4
  import { resolve, extname, join, basename, relative, sep, dirname } from 'node:path';
5
- import { loadConfig, loadSavedSettings, savedGrading, loadCompletionPolicy, SETTINGS_DATA_FILE, PACKAGE_FILE, CONFIG_FILE, COMPLETION_DATA_FILE } from '../core/config.js';
5
+ import { loadConfig, loadSavedSettings, savedGrading, SETTINGS_DATA_FILE, PACKAGE_FILE, CONFIG_FILE } from '../core/config.js';
6
6
  import { prepareContent } from '../core/prepare.js';
7
7
  import { projectCheckOptions } from '../core/project-check.js';
8
8
  import { inlineModuleScripts } from '../core/sandbox.js';
@@ -49,7 +49,7 @@ function summarize(check) {
49
49
  const warns = check.issues.length - errors.length;
50
50
  const head = `${check.ok ? '[ok]' : '[fail]'} 검사 오류 ${errors.length} · 경고 ${warns} (규칙 ${check.rulesVersion})`;
51
51
  const lines = check.issues.slice(0, 5).map(i => ` [${i.level}] ${i.id}${i.path ? ` ${i.path}${i.line ? `:${i.line}` : ''}` : ''} ${i.message}`);
52
- if (check.issues.length > 5) lines.push(` … 외 ${check.issues.length - 5}개 (ecdk check로 전체 보기)`);
52
+ if (check.issues.length > 5) lines.push(` … 외 ${check.issues.length - 5}개 (ecdk validate로 전체 보기)`);
53
53
  return [head, ...lines].join('\n');
54
54
  }
55
55
  /** 포트가 이미 쓰일 때: 어느 포트(호스트 · 콘텐츠)인지 알린다 */
@@ -97,10 +97,8 @@ async function startDevServer(opts) {
97
97
  // 편집 화면이 저장한 settings(내용 + grading)는 .ecdk/settings.json에 남겨 dev를 다시 열어도 그대로 (운영은 서버 settings)
98
98
  state.settings = await loadSavedSettings(dir);
99
99
  savedGrading(state.settings); // grading 형식이 틀리면 시작할 때 알린다
100
- let policy = await loadCompletionPolicy(dir, config);
101
- /** 로컬 채점 흉내: 완료 정책 + 저장한 settings.grading. 문제 설명은 채점 없음 */
100
+ /** 로컬 채점 흉내: 저장한 settings.grading (없으면 제출만 받음). 문제 설명은 채점 없음 */
102
101
  const localGrading = () => config.kind === 'description' ? undefined : {
103
- completion_policy: policy,
104
102
  grading: savedGrading(state.settings)
105
103
  };
106
104
  async function writeJson(file, data) {
@@ -111,20 +109,10 @@ async function startDevServer(opts) {
111
109
  await writeFile(path, `${JSON.stringify(data, null, 2)}\n`);
112
110
  }
113
111
  /**
114
- * 편집 화면의 saveSettings(PATCH settings)를 흉내 서버가 받으면 settings 전체(내용 + grading)를 `.ecdk/settings.json`에 쓴다
112
+ * 편집 화면의 saveSettings(PATCH /draft settings)를 흉내 서버가 받으면 settings 전체(내용 + grading)를 `.ecdk/settings.json`에 쓴다
115
113
  * (운영은 material_version.settings). 값 검사는 흉내 서버가 한다. 점(.) 폴더라 감시 · zip에서 빠진다
116
114
  */
117
115
  const saveSettings = settings => writeJson(SETTINGS_DATA_FILE, settings);
118
- /**
119
- * 완료 정책 화면의 saveCompletionPolicy(PATCH completion_policy)를 흉내 서버가 받으면 `.ecdk/completion.json`에 쓴다
120
- * (운영은 material_version.completion_policy). 값 검사는 흉내 서버가 한다
121
- */
122
- async function saveCompletionPolicy(next) {
123
- await writeJson(COMPLETION_DATA_FILE, {
124
- completion_policy: next
125
- });
126
- policy = await loadCompletionPolicy(dir, config);
127
- }
128
116
  // SDK를 설치하기 전에도 mock으로는 열린다 (실제 SDK 모드 ?sdk=real만 lib/cdk.js가 없어 실패, 아래에서 알림)
129
117
  let prepared = await prepareContent(dir, config, {
130
118
  requireSdk: false
@@ -205,13 +193,11 @@ async function startDevServer(opts) {
205
193
  getGrading: localGrading,
206
194
  saveSettings,
207
195
  getEntries: entries,
208
- getCompletionPolicies: () => check.manifest?.completionPolicies ?? [],
209
- saveCompletionPolicy,
210
196
  onEvent: m => log(`[api] ${m}`)
211
197
  });
212
198
  return;
213
199
  }
214
- // 콘텐츠 주소를 직접 열어 mock으로 돌 때: .ecdk(저장한 settings · 완료 정책)는 zip에 없어 콘텐츠 서버가 주지 않으므로
200
+ // 콘텐츠 주소를 직접 열어 mock으로 돌 때: .ecdk(저장한 settings)는 zip에 없어 콘텐츠 서버가 주지 않으므로
215
201
  // 흉내 서버가 채점에 쓰는 것과 같은 로컬 채점 설정을 여기서 준다 (dev 전용)
216
202
  // CORS *로 둔다: ecdk dev는 작성자 PC에서만 돌고 내주는 값도 작성자 본인이 저장한 답이라, 막아도 지킬 대상이 없다
217
203
  // (실행마다 열쇠를 두는 방식은 콘텐츠 주소가 예측 가능해 열쇠까지 읽혀 효과가 없어서 되돌림, !19 리뷰)
@@ -220,12 +206,8 @@ async function startDevServer(opts) {
220
206
  ...cors,
221
207
  'Content-Type': 'application/json; charset=utf-8'
222
208
  });
223
- // { completion_policy, grading, completion_policies }: 콘텐츠를 직접 연 mock이 로컬 채점 · 완료 정책 흉내에 쓴다
224
- const local = localGrading();
225
- res.end(JSON.stringify(local ? {
226
- ...local,
227
- completion_policies: check.manifest?.completionPolicies ?? []
228
- } : null));
209
+ // { grading }: 콘텐츠를 직접 연 mock이 로컬 채점 흉내에 쓴다
210
+ res.end(JSON.stringify(localGrading() ?? null));
229
211
  return;
230
212
  }
231
213
  if (url.pathname === '/favicon.ico') {
@@ -328,7 +310,6 @@ async function startDevServer(opts) {
328
310
  async function reload() {
329
311
  try {
330
312
  config = await loadConfig(dir);
331
- policy = await loadCompletionPolicy(dir, config);
332
313
  // 손으로 고친 .ecdk/settings.json도 다시 읽는다 (편집 화면 저장은 흉내 서버가 이미 state에 넣음)
333
314
  const saved = await loadSavedSettings(dir);
334
315
  savedGrading(saved);
package/es/rules/check.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { zipSync } from 'fflate';
2
- import { parseManifest, COMPLETION_POLICIES_EXAMPLE } from './manifest.js';
2
+ import { parseManifest } from './manifest.js';
3
3
  import { isUnsafePath, extname, globToRegExp, resolveRef } from './path.js';
4
4
  import { lineAt, parseTags, extractRefs, classifyRef } from './refs.js';
5
5
  import { compareVersions } from './semver.js';
@@ -52,9 +52,9 @@ function answerKeyPath(value, path = []) {
52
52
  return null;
53
53
  }
54
54
  /**
55
- * 화면 코드가 완료 정책 · 편집 화면과 맞는지 (ADR 0009, 키트 lib/는 빼고 콘텐츠 코드에서 함수 이름을 찾는 방식이라 경고만).
56
- * 제출 · 채점으로 완료할 수 있는데 제출이 없으면 학생이 완료할 수 없고, 채점(on_graded)인데 편집 화면이 채점 설정을
57
- * 저장하지 않으면 답을 정할 곳이 없고, 편집 · 완료 정책 화면인데 저장이 없으면 바꾼 내용이 LXP로 넘어가지 않는다.
55
+ * 화면 코드가 편집 화면 · 채점 설정과 맞는지 (키트 lib/는 빼고 콘텐츠 코드에서 함수 이름을 찾는 방식이라 경고만).
56
+ * 완료 정책은 LXP 설정이라 (ADR 0012) 정책으로는 판단하지 않는다. 편집 화면이 채점 설정을 저장하는데 제출이 없으면
57
+ * 그 채점 설정을 쓸 곳이 없고, 편집 화면인데 저장이 없으면 바꾼 내용이 LXP로 넘어가지 않는다.
58
58
  */
59
59
  function checkScreenCode(files, manifest, add) {
60
60
  const decoder = new TextDecoder();
@@ -63,15 +63,10 @@ function checkScreenCode(files, manifest, add) {
63
63
  // 이런 zip은 판단하지 않는다: build가 묶기 전 원본으로 이미 검사했다
64
64
  if (texts.some(t => /<script\b[^>]*\sdata-ecdk-bundle\b/i.test(t))) return;
65
65
  const code = texts.join('\n');
66
- // completionPolicies 안에 제출 · 채점이 있으면 (첫 값이든 완료 정책 화면에서 고를 수 있는 값이든) 제출이 있어야 한다
67
- const policies = manifest.completionPolicies ?? [];
68
- const submitting = policies.filter(p => p !== 'on_access');
69
- if (submitting.length > 0 && !/\buseSubmit\b|\.submit\s*\(/.test(code)) add('completion.no-submit', `completionPolicies에 ${submitting.join(' · ')}가 있는데 화면 코드에 제출(app.useSubmit · sdk.submit)이 없습니다. 그 정책이면 학생이 완료할 수 없습니다. 제출을 넣거나 completionPolicies를 ["on_access"]로 바꿔 주세요.`);
70
66
  // 채점 방식 · 답은 편집 화면이 settings.grading으로 저장한다. 주석은 빼고 본다 (blank 템플릿 주석에 예시가 있음)
71
67
  const uncommented = code.replace(/\/\*[\s\S]*?\*\/|(^|[^:])\/\/.*$/gm, '$1');
72
- if (policies.includes('on_graded') && manifest.entries.edit && !/\buseGradingBlock\b|\bgetGrading\b|\bgrading\s*:/.test(uncommented)) add('completion.no-grading', `completionPolicies에 채점해 완료(on_graded)가 있는데 편집 화면 코드가 채점 설정을 저장하지 않습니다. app.useGradingBlock()을 붙이고 useSave({ getGrading })에 넘겨 주세요 (퀴즈처럼 문항이 있으면 문항별 정답으로 { type: 'pattern', answer_key }를 만듦, ecdk guide 5).`);
73
- const screen = manifest.entries.completionPolicy;
74
- if (screen && !/\buseCompletion\b|\bsaveCompletionPolicy\s*\(/.test(code)) add('completion.no-save', `완료 정책 화면(${screen})을 켰는데 저장(app.useCompletion · sdk.saveCompletionPolicy)이 없습니다. 교육자가 고른 완료 정책이 저장되지 않습니다.`);
68
+ const savesGrading = /\buseGradingBlock\b|\bgetGrading\b|\bgrading\s*:/.test(uncommented);
69
+ if (manifest.entries.edit && savesGrading && !/\buseSubmit\b|\.submit\s*\(/.test(uncommented)) add('grading.no-submit', `편집 화면(${manifest.entries.edit})이 채점 설정(settings.grading)을 저장하는데 화면 코드에 제출(app.useSubmit · sdk.submit)이 없습니다. 학생이 제출할 수 없어 채점 설정을 쓸 곳이 없고, LXP에서 '제출하면 완료' · '채점해 완료'를 골라도 학생이 완료할 수 없습니다. 학생 화면에 제출을 넣거나, 채점하지 않는 자료면 편집 화면에서 채점 설정(useGradingBlock · getGrading)을 빼 주세요.`);
75
70
  if (manifest.entries.edit && !/\buseSave\b|\bsaveSettings\s*\(|\bsaveContent\s*\(/.test(code)) add('edit.no-save', `편집 화면(${manifest.entries.edit})을 켰는데 저장(app.useSave · sdk.saveSettings)이 없습니다. 편집한 내용이 LXP로 넘어가지 않습니다.`);
76
71
  }
77
72
  /**
@@ -91,30 +86,12 @@ function checkTemplate(manifest, opts, add) {
91
86
  }
92
87
  if (version !== undefined && (compareVersions(version, known) ?? 0) > 0) add(`${ref}은 이 ecdk가 가진 ${name}@${known}보다 새 템플릿 버전입니다. 검사 · 가이드가 새 템플릿의 변경을 모를 수 있으니 ecdk를 올려 주세요.`);
93
88
  }
94
- /**
95
- * 완료 정책 · 채점 설정 (ADR 0009 2026-11-11 결정 2). 자료 본문은 completionPolicies가 필수(서버가 첫 값으로 완료 정책을
96
- * 정함)이고, 그 안에 채점해 완료(on_graded)가 있으면 채점 방식 · 답을 정할 편집 화면이 있어야 한다 (운영에서
97
- * settings.grading은 편집 화면만 저장). 여럿이면 완료 정책 화면이 있어야 고를 수 있다.
98
- */
99
- function checkCompletion(manifest, spec, add) {
100
- if ((manifest.kind ?? spec.manifest.defaultKind) === 'description') return;
101
- const policies = manifest.completionPolicies ?? [];
102
- if (policies.length === 0) {
103
- add('manifest.completion-policies-missing', `${spec.manifest.file}에 completionPolicies(이 자료가 지원하는 완료 정책)가 ${manifest.completionPolicies ? '비어 있습니다' : '없습니다'}. 서버가 첫 값으로 완료 정책을 정하므로 자료 본문에는 꼭 적습니다. ${COMPLETION_POLICIES_EXAMPLE}. ecdk 프로젝트는 원본의 metadata.json에 적습니다.`, spec.manifest.file);
104
- return;
105
- }
106
- const screen = manifest.entries.completionPolicy;
107
- if (policies.length > 1 && !screen) add('completion.no-screen', `completionPolicies가 ${policies.join(' · ')}인데 완료 정책 화면(screens.completionPolicy)이 없어 첫 값(${policies[0]})만 쓰입니다. 교육자가 고르게 하려면 완료 정책 화면을 켜고(app.useCompletion), 아니면 ["${policies[0]}"] 하나만 적어 주세요.`, spec.manifest.file);
108
- if (policies.length === 1 && screen) add('completion.screen-unused', `completionPolicies가 ${policies[0]} 하나(고정)인데 완료 정책 화면(${screen})이 켜져 있습니다. 고를 것이 없으니 화면을 끄거나 고를 정책을 더 적어 주세요.`, spec.manifest.file);
109
- if (!policies.includes('on_graded')) return;
110
- if (!manifest.entries.edit) add('completion.no-edit', `completionPolicies에 채점해 완료(on_graded)가 있는데 편집 화면이 없습니다. 채점 방식 · 답(settings.grading)은 편집 화면만 저장할 수 있어, 이대로면 LXP에서 정답을 정할 곳이 없습니다 (서버는 채점 설정 없는 on_graded를 MATERIAL_GRADING_REQUIRED로 거절). 편집 화면(screens.edit)을 켜거나 on_graded를 빼 주세요.`, spec.manifest.file);
111
- }
112
89
  /**
113
90
  * 프로젝트에 남은 옛 파일 (ADR 0011, 프로젝트 검사만). 옮기는 법을 알려 준다. 내용 · 정답은 옮기지 않고
114
91
  * 편집 화면에서 다시 넣는다
115
92
  */
116
93
  const LEGACY_FILE_MESSAGES = {
117
- 'elice.config.json': 'elice.config.json은 더 쓰지 않습니다 (ADR 0011). 화면 · 완료 정책 · 학습 참고 내용(kind · screens · completionPolicies · commentary)은 원본의 metadata.json에, 빌드 옵션 · template은 package.json "ecdk"에 둡니다. ecdk doctor --fix가 옮기고 elice.config.json을 지웁니다 (옮기기 전까지는 지금처럼 빌드됨).',
94
+ 'elice.config.json': 'elice.config.json은 더 쓰지 않습니다 (ADR 0011). 화면 · 학습 참고 내용(kind · screens · commentary)은 원본의 metadata.json에, 빌드 옵션 · template은 package.json "ecdk"에 둡니다. ecdk doctor --fix가 옮기고 elice.config.json을 지웁니다 (옮기기 전까지는 지금처럼 빌드됨).',
118
95
  'content.json': 'content.json은 더 쓰지 않습니다 (기본 내용 파일 없음, ADR 0011). 화면은 편집 화면이 저장한 내용만 읽고, 저장하기 전에는 "아직 내용이 없습니다" 안내를 보입니다. 그 내용은 LXP에 올린 뒤 편집 화면에서 다시 넣고 파일을 지워 주세요. 화면 코드가 직접 fetch하는 데이터 파일이면 다른 이름(예: data.json)으로 바꿔 주세요.',
119
96
  'grading.json': "grading.json은 더 쓰지 않습니다 (ADR 0011). 채점 방식 · 답은 LXP에 올린 뒤 편집 화면에서 정합니다 (ecdk dev의 '내용 편집'에 넣은 답은 로컬 견본, .ecdk/settings.json). 파일은 지워 주세요 (zip에는 들어가지 않음)."
120
97
  };
@@ -128,7 +105,7 @@ function checkLegacyFiles(opts, add) {
128
105
  const SDK_UPDATE_COMMAND = 'npm update @eliceio/cdk';
129
106
  /**
130
107
  * SDK 버전 (ADR 0010). metadata.json build.sdk가 rules.json minVersions.sdk보다 낮으면 오류:
131
- * LXP 프로토콜과 맞지 않아 저장 · 제출이 안 될 수 있다. 옛 lib/cdk.js 복사본 프로젝트는 sdk.lib-copy 경고로 알린다
108
+ * LXP 프로토콜과 맞지 않아 저장 · 제출이 안 될 수 있다 (G163: alpha.3 이하는 LXP 편집 화면 초안 저장이 422). 옛 lib/cdk.js 복사본 프로젝트는 sdk.lib-copy 경고로 알린다
132
109
  */
133
110
  function checkSdk(manifest, spec, opts, add) {
134
111
  // 옛 머리말은 "1.0.0 (브랜치@커밋)"일 수 있어 첫 낱말만 비교한다
@@ -139,10 +116,10 @@ function checkSdk(manifest, spec, opts, add) {
139
116
  if (opts.legacySdkCopy) {
140
117
  add('sdk.lib-copy', `${opts.legacySdkCopy}는 옛 ecdk create가 복사한 SDK${version ? ` ${version}` : ''}입니다${below ? ` (최소 ${min}보다 낮음)` : ''}. 이제 SDK는 package.json 의존성입니다: ecdk doctor --fix(또는 package.json dependencies에 "@eliceio/cdk": "^${min}")로 넣고 npm install 하면 ecdk build가 node_modules에서 넣습니다. 그다음 ${opts.legacySdkCopy}는 지워도 됩니다.`, opts.legacySdkCopy);
141
118
  // 옛 복사본도 최소 미만이면 오류 (zip 검사와 같은 판정, 옛 SDK로 올리는 것을 막음)
142
- if (below) add('sdk.outdated', `${opts.legacySdkCopy}의 SDK ${version}은 최소 버전 ${min}보다 낮아 LXP에서 저장 · 제출 · 교육자 화면이 안 될 수 있습니다. ecdk doctor --fix && npm install 후 다시 빌드해 주세요.`, opts.legacySdkCopy);
119
+ if (below) add('sdk.outdated', `${opts.legacySdkCopy}의 SDK ${version}은 최소 버전 ${min}보다 낮아 LXP 편집 화면 저장(초안 저장, alpha.3 이하는 실패) · 제출 · 교육자 화면이 안 될 수 있습니다. ecdk doctor --fix && npm install 후 다시 빌드해 주세요.`, opts.legacySdkCopy);
143
120
  return;
144
121
  }
145
- if (below) add('sdk.outdated', `@eliceio/cdk(SDK) ${version}은 최소 버전 ${min}보다 낮아 LXP에서 저장 · 제출이 안 될 수 있습니다. 프로젝트 폴더에서 ${SDK_UPDATE_COMMAND} 후 다시 빌드해 주세요.`, spec.manifest.file);
122
+ if (below) add('sdk.outdated', `@eliceio/cdk(SDK) ${version}은 최소 버전 ${min}보다 낮아 LXP 편집 화면에서 저장(초안 저장)이 안 됩니다 (alpha.3 이하). 프로젝트 폴더에서 ${SDK_UPDATE_COMMAND} 후 다시 빌드해 주세요.`, spec.manifest.file);
146
123
  }
147
124
  /** `<script type="module" data-ecdk-bundle>` 본문을 줄 수만 남기고 비운다 (줄 번호 유지) */
148
125
  function blankBundles(html) {
@@ -195,7 +172,7 @@ function checkFiles(input, opts = {}) {
195
172
  const parsed = parseManifest(decoder.decode(mfile.data), spec);
196
173
  if (parsed.ok) {
197
174
  manifest = parsed.manifest;
198
- for (const w of parsed.warnings ?? []) add('manifest.grading-types', `${spec.manifest.file}: ${w}`, spec.manifest.file);
175
+ for (const w of parsed.warnings ?? []) add(w.id, `${spec.manifest.file}: ${w.message}`, spec.manifest.file);
199
176
  } else add('manifest.invalid', `${spec.manifest.file}: ${parsed.error}`, spec.manifest.file);
200
177
  } else if (kind !== 'html' && !nestedRoot) {
201
178
  add('manifest.missing', `최상위에 ${spec.manifest.file}이 없습니다. 학생 화면·교육자 화면 등 어떤 화면이 있는지 적어 주세요 (ecdk build가 만들어 줍니다).`);
@@ -220,7 +197,6 @@ function checkFiles(input, opts = {}) {
220
197
  // 메모장 등이 붙이는 BOM은 학습 참고 내용 칸에 보이지 않는 글자로 들어간다
221
198
  if (startsWithBom(commentaryFile.data)) add('file.bom', `학습 참고 내용 파일 맨 앞에 BOM(보이지 않는 글자)이 있습니다: ${commentaryFile.path}. "UTF-8(BOM 없음)"으로 다시 저장해 주세요.`, commentaryFile.path);
222
199
  }
223
- checkCompletion(manifest, spec, (id, message, path) => add(id, message, path));
224
200
  checkTemplate(manifest, opts, message => add('build.template-unknown', message, spec.manifest.file));
225
201
  checkScreenCode(files, manifest, (id, message) => add(id, message, spec.manifest.file));
226
202
  }
@@ -1,5 +1,5 @@
1
1
  export { checkFiles } from './check.js';
2
- export { COMPLETION_POLICIES_EXAMPLE, completionPolicyError, graderTypeError, parseCompletionPolicies, parseManifest, serializeManifest, } from './manifest.js';
2
+ export { COMPLETION_POLICIES_IGNORED, graderTypeError, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, type ManifestWarning, parseManifest, serializeManifest, stripCompletionPolicy, } from './manifest.js';
3
3
  export { globToRegExp } from './path.js';
4
4
  export { commentOnlyLines, lineSkipper } from './skip.js';
5
5
  export { rules, RULES_VERSION } from './spec.js';
package/es/rules/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { checkFiles } from './check.js';
2
- export { COMPLETION_POLICIES_EXAMPLE, completionPolicyError, graderTypeError, parseCompletionPolicies, parseManifest, serializeManifest } from './manifest.js';
2
+ export { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, graderTypeError, parseManifest, serializeManifest, stripCompletionPolicy } from './manifest.js';
3
3
  export { globToRegExp } from './path.js';
4
4
  export { commentOnlyLines, lineSkipper } from './skip.js';
5
5
  export { RULES_VERSION, rules } from './spec.js';
@@ -1,28 +1,38 @@
1
1
  import type { Manifest, RulesSpec } from './types.js';
2
- /** `warnings`: 받아 주지만 고쳐야 할 것 (예: 옛 `gradingTypes`). 없으면 필드도 없음 */
2
+ /** 받아 주지만 고쳐야 할 것 (예: 옛 `gradingTypes`). `id`는 검사 규칙 id */
3
+ export interface ManifestWarning {
4
+ id: 'manifest.grading-types' | 'manifest.completion-policies-ignored';
5
+ message: string;
6
+ }
7
+ /** `warnings`: 받아 주지만 고쳐야 할 것. 없으면 필드도 없음 */
3
8
  export type ParsedManifest = {
4
9
  ok: true;
5
10
  manifest: Manifest;
6
- warnings?: string[];
11
+ warnings?: ManifestWarning[];
7
12
  } | {
8
13
  ok: false;
9
14
  error: string;
10
15
  };
11
16
  /**
12
- * 완료 정책 하나 검사 (metadata `completionPolicies`의 값 · 로컬 `.ecdk/completion.json`, ADR 0009).
13
- * 문제가 없으면 null. 수동 채점(manual) · 채점 없음(none)은 Custom HTML에서 쓰지 않는다.
17
+ * 완료 정책 화면의 옛 이름들 (2026-11-12 없앰, ADR 0012). metadata.json screens에 있으면 오류 대신 경고하고 무시한다
18
+ * (completion · grading은 2026-11-11 completionPolicy로 바뀌기 전 이름)
14
19
  */
15
- export declare function completionPolicyError(value: unknown, allowed: readonly string[]): string | null;
16
- /** 채점 방식 하나 검사 (on_graded일 때 `settings.grading.type`: pattern · rubric). 문제가 없으면 null */
17
- export declare function graderTypeError(value: unknown, allowed: readonly string[]): string | null;
18
- /** completionPolicies 예시 (오류 문구에 같이 보인다) */
19
- export declare const COMPLETION_POLICIES_EXAMPLE = "\uC608: \"completionPolicies\": [\"on_submit\"] \u00B7 \uACE0\uB97C \uC218 \uC788\uAC8C [\"on_submit\", \"on_access\"] \u00B7 \uCC44\uC810\uD558\uB294 \uD034\uC988 [\"on_graded\"]";
20
+ export declare const LEGACY_COMPLETION_SCREENS: readonly ["completionPolicy", "completion", "grading"];
21
+ /** 완료 정책은 LXP 설정 (ADR 0012): metadata.json에 남은 완료 정책 필드 · 화면 안내 */
22
+ export declare const COMPLETION_POLICIES_IGNORED = "\uC644\uB8CC \uC815\uCC45\uC740 LXP\uC5D0 \uC62C\uB9B0 \uB4A4 \uC124\uC815 \uD0ED\uC5D0\uC11C \uAD50\uC721\uC790\uAC00 \uACE0\uB985\uB2C8\uB2E4 (2026-11-12, ADR 0012). metadata.json\uC5D0\uC11C \uC9C0\uC6CC \uC8FC\uC138\uC694 (ecdk build\uB294 zip\uC5D0\uC11C \uBE8D\uB2C8\uB2E4)";
23
+ /**
24
+ * metadata.json에 적는 파일 이름(진입 파일 · 학습 참고 내용): zip 최상위, 영문 · 숫자 · `.` · `_` · `-`만.
25
+ * LXP가 배포 주소 뒤에 그대로 붙여 열므로 공백 · 한글 · `?` · `#` · `%`처럼 URL 인코딩이 필요한 글자는 받지 않는다.
26
+ */
27
+ /** metadata.json에 남은 옛 완료 정책 필드 (ADR 0012에서 없앰, completion은 2026-11-11 전 이름) */
28
+ export declare const LEGACY_COMPLETION_FIELDS: readonly ["completionPolicies", "completion"];
20
29
  /**
21
- * `completionPolicies` 검사 (metadata.json · 옛 elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
22
- * 같은 값 두 번 없음. 문제가 있으면 문장, 없으면 배열. 빈 배열은 여기서 통과시키고 검사 규칙
23
- * manifest.completion-policies-missing이 알린다 (없는 것과 같은 문제)
30
+ * build가 zip의 metadata.json에서 빼는 옛 완료 정책 필드 · 화면 (ADR 0012). 작성자 metadata.json(JSON 객체)을 받아
31
+ * 뺀 사본을 돌려준다. 뺄 것이 없으면 같은 객체
24
32
  */
25
- export declare function parseCompletionPolicies(value: unknown, spec: RulesSpec): string[] | string;
33
+ export declare function stripCompletionPolicy(raw: Record<string, unknown>): Record<string, unknown>;
34
+ /** 채점 방식 하나 검사 (`settings.grading.type`: pattern · rubric). 문제가 없으면 null */
35
+ export declare function graderTypeError(value: unknown, allowed: readonly string[]): string | null;
26
36
  /**
27
37
  * metadata.json (zip 최상위): 용도, 화면(모드)별 사용 여부와 진입 파일, 빌드 정보. 정답은 넣지 않는다.
28
38
  *
@@ -31,23 +41,21 @@ export declare function parseCompletionPolicies(value: unknown, spec: RulesSpec)
31
41
  * "screens": { // 알려진 화면을 적는다. 적지 않은 화면은 꺼짐
32
42
  * "learn": { "enabled": true, "entry": "index.html" },
33
43
  * "instructor": { "enabled": true, "entry": "instructor.html" },
34
- * "edit": { "enabled": true, "entry": "edit.html" }, // 내용 편집 + 채점 방식 · 답 (ADR 0009)
35
- * "completionPolicy": { "enabled": false } // 완료 정책 화면 (ADR 0009)
44
+ * "edit": { "enabled": true, "entry": "edit.html" } // 내용 편집 + 채점 방식 · 답 (ADR 0009)
36
45
  * },
37
- * // 자료 본문은 필수: 지원하는 완료 정책, 서버는 첫 값으로 정한다. 하나면 고정(퀴즈 ["on_graded"]),
38
- * // 여럿이면 완료 정책 화면이 그 안에서 바꾼다
39
- * "completionPolicies": ["on_submit", "on_access"],
40
46
  * "commentary": "commentary.txt", // 선택. 학습 참고 내용 파일 (zip 최상위, 일반 텍스트)
41
47
  * "build": { "cli": "0.1.0", "rules": "0.2.0", "protocol": 1, "engine": "static" } // 선택
42
48
  * }
43
49
  *
44
50
  * 파싱 결과의 `entries`는 켠 화면만 담는다. 서버 `material_draft.manifest`(JSONB) · SDK `MaterialManifest`의
45
51
  * `{ entries }`가 이 모양이라 서버는 그대로 저장할 수 있다. 형식은 서버·디자인과 확정 전 제안안 (ADR 0004).
46
- * `gradingTypes`(2026-11-10 삭제, ADR 0008)가 있으면 받아 주고 경고만 낸다: 완료 정책은 completionPolicies · 완료 정책 화면, 채점 방식은 편집 화면이 정한다.
52
+ * `gradingTypes`(2026-11-10 삭제, ADR 0008)가 있으면 받아 주고 경고만 낸다: 채점 방식은 편집 화면이 정한다.
53
+ * 완료 정책은 LXP 설정이라 metadata에 없다 (ADR 0012). 옛 `completionPolicies` · `completion`과 완료 정책 화면
54
+ * (`screens.completionPolicy`)은 받아 주고 경고만 낸다 (manifest.completion-policies-ignored, build가 zip에서 뺌).
47
55
  */
48
56
  export declare function parseManifest(text: string, spec: RulesSpec): ParsedManifest;
49
57
  /**
50
- * 알려진 화면의 사용 여부(enabled)를 모두 적는다. 필드 순서(kind · screens · completionPolicies · commentary · build)와 화면 순서(learn · instructor · edit · completionPolicy)를
58
+ * 알려진 화면의 사용 여부(enabled)를 모두 적는다. 필드 순서(kind · screens · commentary · build)와 화면 순서(learn · instructor · edit)를
51
59
  * 고정해 같은 입력이면 같은 파일이 나오게 한다. kind가 없으면 기본값을 적는다.
52
60
  */
53
61
  export declare function serializeManifest(manifest: Manifest, spec: RulesSpec): string;