@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
@@ -1,16 +1,9 @@
1
1
  /**
2
- * 완료 정책 (ADR 0009). 원본은 rules.json `manifest.completionPolicies`이고, 타입 검사를 위해 여기 리터럴로 둔다.
3
- * 둘이 같은지는 docs.test.ts가 대조한다. 수동 채점 manual · 채점 없음 none은 Custom HTML에서 쓰지 않음.
4
- * 자료가 지원하는 완료 정책은 metadata `completionPolicies`(서버가 첫 값으로 정함), 바꾸기는 완료 정책 화면 · SDK
5
- * `saveCompletionPolicy`(PATCH completion_policy). settings.grading에는 없다
6
- */
7
- export declare const COMPLETION_POLICIES: readonly ["on_access", "on_submit", "on_graded"];
8
- /**
9
- * 채점 방식 = `settings.grading.type` (on_graded일 때만). 원본은 rules.json `manifest.graderTypes`.
10
- * pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖
2
+ * 채점 방식 = `settings.grading.type`. 원본은 rules.json `manifest.graderTypes`.
3
+ * pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖.
4
+ * 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 설정 탭에서 교육자가 고른다 (ADR 0012). 패키지 · CLI는 다루지 않는다
11
5
  */
12
6
  export declare const GRADER_TYPES: readonly ["pattern", "rubric"];
13
- export type CompletionPolicy = (typeof COMPLETION_POLICIES)[number];
14
7
  export type GraderType = (typeof GRADER_TYPES)[number];
15
8
  /**
16
9
  * 채점 설정 = 운영 `settings.grading` (서버 §5.1 스키마, 2026-11-11 결정). 편집 화면이 saveSettings로 저장한다.
@@ -19,7 +12,7 @@ export type GraderType = (typeof GRADER_TYPES)[number];
19
12
  * { "type": "pattern", "answer_key": "^q1=b;q2=a,d$" } // 정규식 하나. 답 문자열 앞뒤 공백을 자르고 전체 일치
20
13
  * { "type": "rubric", "rubric": "핵심 개념 2개 이상 언급하면 만점" }
21
14
  *
22
- * on_access · on_submit은 grading에서 빠졌다 (완료 정책은 completion_policy, 2026-11-11).
15
+ * 완료 정책(on_access · on_submit · on_graded)은 grading에 없다: LXP 설정 탭에서 교육자가 고른다 (ADR 0012).
23
16
  */
24
17
  export interface GradingConfig {
25
18
  type: GraderType;
@@ -28,33 +21,28 @@ export interface GradingConfig {
28
21
  /** rubric: 평가 기준 */
29
22
  rubric?: string;
30
23
  }
31
- /** 로컬 채점 흉내에 쓰는 값: 완료 정책(로컬 `.ecdk/completion.json` · completionPolicies 첫 값)과 채점 설정(`.ecdk/settings.json` grading) */
24
+ /**
25
+ * 로컬 채점 흉내에 쓰는 값: 저장한 settings의 채점 설정(`.ecdk/settings.json` grading). 채점 설정이 있으면 채점하고,
26
+ * 없으면 제출만 받는다 (완료 정책은 LXP 설정이라 dev는 흉내 내지 않는다, ADR 0012)
27
+ */
32
28
  export interface LocalGrading {
33
- completion_policy: CompletionPolicy;
34
29
  /** `ecdk dev` 편집 화면이 저장한 settings.grading (없으면 null) */
35
30
  grading: GradingConfig | null;
36
31
  }
37
32
  /**
38
- * 로컬 settings (dev 전용): `ecdk dev` 편집 화면의 saveSettings(PATCH settings)를 흉내 서버가 통째로(내용 + grading) 여기에 쓴다.
33
+ * 로컬 settings (dev 전용): `ecdk dev` 편집 화면의 saveSettings(PATCH /draft settings)를 흉내 서버가 통째로(내용 + grading) 여기에 쓴다.
39
34
  * 운영은 서버 material_version.settings. 프로젝트의 점(.) 폴더라 zip에 들어가지 않는다. build · check는 읽지 않는다
40
35
  */
41
36
  export declare const SETTINGS_DATA_FILE = ".ecdk/settings.json";
42
- /**
43
- * 로컬 완료 정책 (dev 전용): `ecdk dev` 완료 정책 화면의 saveCompletionPolicy를 흉내 서버가 여기에 쓴다.
44
- * 운영은 서버 material_version.completion_policy. 프로젝트의 점(.) 폴더라 zip에 들어가지 않는다
45
- */
46
- export declare const COMPLETION_DATA_FILE = ".ecdk/completion.json";
47
- /** completionPolicies가 없을 때(검사 오류) ecdk dev가 흉내 내는 정책 (제출하면 완료) */
48
- export declare const DEFAULT_COMPLETION_POLICY: CompletionPolicy;
49
37
  /**
50
38
  * 채점 설정 값 검사 (편집 화면이 저장한 settings.grading). 문제가 있으면 문장, 없으면 GradingConfig.
51
39
  * 옛 모양(`type: on_access · on_submit`, `completion_policy` · `grader_type`, `match` · 객체 정답)은 바꾸는 법을 알려 준다.
52
40
  */
53
41
  export declare function parseGrading(data: unknown): GradingConfig | string;
54
42
  /**
55
- * 프로젝트 설정 (ADR 0011). 빌드 옵션은 package.json `"ecdk"` 키, 플랫폼 필드(kind · screens · completionPolicies ·
56
- * commentary)는 작성자가 쓰는 원본의 metadata.json(build가 그대로 복사하고 build만 채움)에 둔다.
57
- * kind · completionPolicies는 dev · doctor가 쓰도록 metadata.json에서 읽어 둔 값이다 (옛 프로젝트는 elice.config.json에서).
43
+ * 프로젝트 설정 (ADR 0011). 빌드 옵션은 package.json `"ecdk"` 키, 플랫폼 필드(kind · screens · commentary)는 작성자가
44
+ * 쓰는 원본의 metadata.json(build가 그대로 복사하고 build만 채움)에 둔다.
45
+ * kind는 dev · doctor가 쓰도록 metadata.json에서 읽어 둔 값이다 (옛 프로젝트는 elice.config.json에서).
58
46
  */
59
47
  export interface ContentConfig {
60
48
  /** 콘텐츠 원본 폴더 (프로젝트 기준). 기본 '.' */
@@ -73,8 +61,6 @@ export interface ContentConfig {
73
61
  configFile?: typeof PACKAGE_FILE | typeof CONFIG_FILE;
74
62
  /** metadata.json `kind` (dev · doctor용으로 읽어 둔 값). material: 자료 본문(기본) · description: 문제 설명 */
75
63
  kind?: 'material' | 'description';
76
- /** metadata.json `completionPolicies` (dev · doctor용으로 읽어 둔 값, 첫 값이 기본) */
77
- completionPolicies?: CompletionPolicy[];
78
64
  /**
79
65
  * 옛 elice.config.json에서 읽은 플랫폼 필드 (ADR 0011 전). 있으면 build가 이것으로 metadata.json을 만들고
80
66
  * project.legacy-file이 옮기는 법을 알린다 (`ecdk doctor --fix`). 새 프로젝트에는 없다
@@ -86,11 +72,12 @@ export interface LegacyPlatformFields {
86
72
  kind?: 'material' | 'description';
87
73
  /** 켤 화면만 파일 이름으로: { "learn": "index.html" } */
88
74
  screens?: Record<string, string>;
89
- completionPolicies?: CompletionPolicy[];
90
75
  /** 학습 참고 내용 파일 이름. 없으면 commentary.txt가 있을 때 그것 */
91
76
  commentary?: string;
92
77
  /** @deprecated 2026-11-10 삭제 (ADR 0008 · 0009). 경고만 하고 옮기지 않는다 */
93
78
  gradingTypes?: unknown;
79
+ /** @deprecated 2026-11-12 삭제 (ADR 0012). 남아 있던 완료 정책 필드 · 화면 이름. 경고만 하고 옮기지 않는다 */
80
+ completion?: string[];
94
81
  }
95
82
  /** 옛 설정 파일 (ADR 0011에서 없앰). 있으면 경고하고 `ecdk doctor --fix`가 옮긴다. zip에는 들어가지 않는다 */
96
83
  export declare const CONFIG_FILE = "elice.config.json";
@@ -100,12 +87,12 @@ export declare const PACKAGE_CONFIG_KEY = "ecdk";
100
87
  /** package.json "ecdk"에 적을 수 있는 키 */
101
88
  export declare const BUILD_OPTION_KEYS: readonly ["template", "root", "outDir", "exclude", "minify", "sourcemap"];
102
89
  /** metadata.json에 적는 플랫폼 필드 (package.json "ecdk" · 옛 elice.config.json에 있으면 옮기라고 알림) */
103
- export declare const PLATFORM_KEYS: readonly ["kind", "screens", "completionPolicies", "commentary"];
90
+ export declare const PLATFORM_KEYS: readonly ["kind", "screens", "commentary"];
104
91
  /** package.json을 읽는다 (없으면 null). JSON 형식이 틀리면 오류 */
105
92
  export declare function readPackageJson(projectDir: string): Promise<Record<string, unknown> | null>;
106
93
  /**
107
94
  * 프로젝트 설정 (ADR 0011): package.json "ecdk"(빌드 옵션) → 없으면 옛 elice.config.json → 없으면 기본값.
108
- * kind · completionPolicies는 원본 metadata.json에서 읽는다 (옛 elice.config.json이면 거기서).
95
+ * kind는 원본 metadata.json에서 읽는다 (옛 elice.config.json이면 거기서).
109
96
  * 둘 다 있으면 package.json "ecdk"를 쓰고 elice.config.json은 남은 옛 파일로 경고만 한다
110
97
  */
111
98
  export declare function loadConfig(projectDir: string): Promise<ContentConfig>;
@@ -121,7 +108,7 @@ export interface LegacyMigration {
121
108
  path: string;
122
109
  text: string;
123
110
  } | null;
124
- /** 옮기지 않고 버리는 것 (gradingTypes) */
111
+ /** 옮기지 않고 버리는 것 (gradingTypes · 완료 정책) */
125
112
  dropped: string[];
126
113
  }
127
114
  /**
@@ -137,12 +124,8 @@ export declare function planLegacyMigration(projectDir: string): Promise<LegacyM
137
124
  export declare function applyLegacyMigration(projectDir: string, plan: LegacyMigration): Promise<string[]>;
138
125
  /** elice.config.json에 옛 `gradingTypes`가 남아 있을 때 build · doctor가 보여 줄 경고. 없으면 null */
139
126
  export declare function legacyGradingTypesWarning(config: ContentConfig): string | null;
140
- /**
141
- * 로컬 완료 정책 (ecdk dev 흉내): `.ecdk/completion.json`(ecdk dev 완료 정책 화면이 저장)이 completionPolicies 안에
142
- * 있으면 그것, 아니면 completionPolicies 첫 값(서버가 업로드 때 정하는 값), 없으면 on_submit.
143
- * completionPolicies가 바뀌어 저장해 둔 값이 목록에서 빠졌으면 첫 값으로 돌아간다
144
- */
145
- export declare function loadCompletionPolicy(projectDir: string, config: ContentConfig): Promise<CompletionPolicy>;
127
+ /** elice.config.json에 옛 완료 정책 필드 · 화면이 남아 있을 때 build · doctor가 보여 줄 경고. 없으면 null */
128
+ export declare function legacyCompletionWarning(config: ContentConfig): string | null;
146
129
  /**
147
130
  * `ecdk dev` 편집 화면이 저장한 settings (`.ecdk/settings.json`, 없으면 {}). 흉내 서버가 시작할 때 읽어 다시 열어도 남는다.
148
131
  * 형식이 틀리면 오류
@@ -151,7 +134,7 @@ export declare function loadSavedSettings(projectDir: string): Promise<Record<st
151
134
  /** 저장한 settings의 grading (없으면 null). 형식이 틀리면 오류 */
152
135
  export declare function savedGrading(settings: Record<string, unknown>): GradingConfig | null;
153
136
  /**
154
- * 로컬 채점 흉내용 값: 완료 정책 + `.ecdk/settings.json`의 grading. 문제 설명(채점 없음)은 undefined
137
+ * 로컬 채점 흉내용 값: `.ecdk/settings.json`의 grading. 문제 설명(채점 없음)은 undefined
155
138
  */
156
139
  export declare function loadGrading(projectDir: string, config: ContentConfig): Promise<LocalGrading | undefined>;
157
140
  /**
package/es/core/config.js CHANGED
@@ -1,34 +1,23 @@
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 { completionPolicyError, parseCompletionPolicies, parseManifest, serializeManifest, graderTypeError, COMPLETION_POLICIES_EXAMPLE } from '../rules/manifest.js';
4
+ import { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_SCREENS, LEGACY_COMPLETION_FIELDS, parseManifest, serializeManifest, graderTypeError } from '../rules/manifest.js';
5
5
  import { rules } from '../rules/spec.js';
6
6
 
7
7
  /**
8
- * 완료 정책 (ADR 0009). 원본은 rules.json `manifest.completionPolicies`이고, 타입 검사를 위해 여기 리터럴로 둔다.
9
- * 둘이 같은지는 docs.test.ts가 대조한다. 수동 채점 manual · 채점 없음 none은 Custom HTML에서 쓰지 않음.
10
- * 자료가 지원하는 완료 정책은 metadata `completionPolicies`(서버가 첫 값으로 정함), 바꾸기는 완료 정책 화면 · SDK
11
- * `saveCompletionPolicy`(PATCH completion_policy). settings.grading에는 없다
12
- */
13
- const COMPLETION_POLICIES = ['on_access', 'on_submit', 'on_graded'];
14
- /**
15
- * 채점 방식 = `settings.grading.type` (on_graded일 때만). 원본은 rules.json `manifest.graderTypes`.
16
- * pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖
8
+ * 채점 방식 = `settings.grading.type`. 원본은 rules.json `manifest.graderTypes`.
9
+ * pattern: 정답 정규식 · rubric: AI 평가 기준. code_exec는 이번 범위 밖.
10
+ * 완료 정책(on_access · on_submit · on_graded)은 LXP에 올린 뒤 설정 탭에서 교육자가 고른다 (ADR 0012). 패키지 · CLI는 다루지 않는다
17
11
  */
18
12
  const GRADER_TYPES = ['pattern', 'rubric'];
13
+ /** 완료 정책 값 (LXP 설정). grading에 잘못 적었을 때 알려 주려고만 쓴다 */
14
+ const COMPLETION_POLICY_VALUES = ['on_access', 'on_submit', 'on_graded', 'manual', 'none'];
19
15
  /**
20
- * 로컬 settings (dev 전용): `ecdk dev` 편집 화면의 saveSettings(PATCH settings)를 흉내 서버가 통째로(내용 + grading) 여기에 쓴다.
16
+ * 로컬 settings (dev 전용): `ecdk dev` 편집 화면의 saveSettings(PATCH /draft settings)를 흉내 서버가 통째로(내용 + grading) 여기에 쓴다.
21
17
  * 운영은 서버 material_version.settings. 프로젝트의 점(.) 폴더라 zip에 들어가지 않는다. build · check는 읽지 않는다
22
18
  */
23
19
  const SETTINGS_DATA_FILE = '.ecdk/settings.json';
24
- /**
25
- * 로컬 완료 정책 (dev 전용): `ecdk dev` 완료 정책 화면의 saveCompletionPolicy를 흉내 서버가 여기에 쓴다.
26
- * 운영은 서버 material_version.completion_policy. 프로젝트의 점(.) 폴더라 zip에 들어가지 않는다
27
- */
28
- const COMPLETION_DATA_FILE = '.ecdk/completion.json';
29
20
  const GRADING_DATA_KEYS = ['type', 'answer_key', 'rubric'];
30
- /** completionPolicies가 없을 때(검사 오류) ecdk dev가 흉내 내는 정책 (제출하면 완료) */
31
- const DEFAULT_COMPLETION_POLICY = 'on_submit';
32
21
  /**
33
22
  * 채점 설정 값 검사 (편집 화면이 저장한 settings.grading). 문제가 있으면 문장, 없으면 GradingConfig.
34
23
  * 옛 모양(`type: on_access · on_submit`, `completion_policy` · `grader_type`, `match` · 객체 정답)은 바꾸는 법을 알려 준다.
@@ -37,8 +26,7 @@ function parseGrading(data) {
37
26
  const example = '예: { "type": "pattern", "answer_key": "^q1=b$" } · { "type": "rubric", "rubric": "…" }';
38
27
  if (typeof data !== 'object' || data === null || Array.isArray(data)) return `객체여야 합니다. ${example}`;
39
28
  const record = data;
40
- if (record.type === 'manual' || record.type === 'none') return completionPolicyError(record.type, COMPLETION_POLICIES) ?? '';
41
- if (record.type === 'on_access' || record.type === 'on_submit') return `완료 정책(${record.type})은 grading에 적지 않습니다 (2026-11-11). 운영은 completion_policy(metadata completionPolicies 첫 값 · 완료 정책 화면), ecdk dev에서는 completionPolicies 첫 값 · 완료 정책 화면(${COMPLETION_DATA_FILE})으로 정합니다. grading은 { "type": "pattern" | "rubric" }만.`;
29
+ if (COMPLETION_POLICY_VALUES.includes(record.type)) return `완료 정책(${String(record.type)})은 grading에 적지 않습니다. 완료 정책은 LXP에 올린 뒤 설정 탭에서 교육자가 고릅니다 (ADR 0012). grading은 { "type": "pattern" | "rubric" }만.`;
42
30
  if (record.completion_policy !== undefined || record.grader_type !== undefined) return `completion_policy · grader_type은 쓰지 않습니다 (2026-11-11 결정: grading은 type 모양 그대로). ${example}`;
43
31
  if (record.match !== undefined || record.answer_key !== undefined && typeof record.answer_key !== 'string') return `옛 형식입니다 (match · 객체 정답). 정답은 정규식 문자열 하나입니다: { "type": "pattern", "answer_key": "^q1=b;q2=a,d$" }. 퀴즈는 ecdk dev의 내용 편집에서 정답을 다시 고르면 새 형식으로 저장됩니다.`;
44
32
  const unknown = Object.keys(record).filter(k => !GRADING_DATA_KEYS.includes(k));
@@ -76,7 +64,7 @@ const PACKAGE_CONFIG_KEY = 'ecdk';
76
64
  /** package.json "ecdk"에 적을 수 있는 키 */
77
65
  const BUILD_OPTION_KEYS = ['template', 'root', 'outDir', 'exclude', 'minify', 'sourcemap'];
78
66
  /** metadata.json에 적는 플랫폼 필드 (package.json "ecdk" · 옛 elice.config.json에 있으면 옮기라고 알림) */
79
- const PLATFORM_KEYS = ['kind', 'screens', 'completionPolicies', 'commentary'];
67
+ const PLATFORM_KEYS = ['kind', 'screens', 'commentary'];
80
68
  /** JSON 형식 오류에 파일 이름을 붙인다 (SyntaxError만 나오면 어느 파일인지 모름) */
81
69
  function parseJson(raw, fail) {
82
70
  try {
@@ -100,10 +88,9 @@ async function readOptional(path) {
100
88
  throw e;
101
89
  }
102
90
  }
103
- /** 정답 · 옛 completion은 어느 설정 파일에서든 같은 문구로 막는다 */
104
- function rejectAnswersAndOldFields(json, fail) {
91
+ /** 정답은 어느 설정 파일에서든 같은 문구로 막는다 */
92
+ function rejectAnswers(json, fail) {
105
93
  if (json.answers !== undefined || json.grading !== undefined) throw fail(`${json.answers !== undefined ? 'answers' : 'grading'}(정답 · 채점 설정)는 파일에 적지 않습니다. 채점 방식 · 답은 편집 화면에서 정합니다 (ecdk dev의 '내용 편집'에서 저장하면 ${SETTINGS_DATA_FILE}).`);
106
- if (json.completion !== undefined) throw fail(`completion 대신 completionPolicies(지원하는 완료 정책 배열, 첫 값이 기본)를 metadata.json에 적어 주세요 (2026-11-11). ${COMPLETION_POLICIES_EXAMPLE}`);
107
94
  }
108
95
  /** 빌드 옵션 (package.json "ecdk" · 옛 elice.config.json 공통) */
109
96
  function parseBuildOptions(json, fail) {
@@ -123,7 +110,7 @@ function parseBuildOptions(json, fail) {
123
110
  function parsePackageOptions(value) {
124
111
  const fail = msg => new Error(`${PACKAGE_FILE} "${PACKAGE_CONFIG_KEY}": ${msg}`);
125
112
  if (!isRecord(value)) throw fail(`객체여야 합니다. 예: { "template": "quiz@1.0.0", "minify": true }`);
126
- rejectAnswersAndOldFields(value, fail);
113
+ rejectAnswers(value, fail);
127
114
  const platform = Object.keys(value).filter(k => PLATFORM_KEYS.includes(k));
128
115
  if (platform.length > 0) throw fail(`${platform.join(' · ')}는 원본의 metadata.json에 적습니다 (ADR 0011). package.json "ecdk"에는 빌드 옵션(${BUILD_OPTION_KEYS.join(' · ')})만.`);
129
116
  const unknown = Object.keys(value).filter(k => !BUILD_OPTION_KEYS.includes(k));
@@ -140,24 +127,18 @@ function parseLegacyConfig(raw) {
140
127
  const parsed = parseJson(raw, fail);
141
128
  if (!isRecord(parsed)) throw fail('객체여야 합니다.');
142
129
  const json = parsed;
143
- rejectAnswersAndOldFields(json, fail);
130
+ rejectAnswers(json, fail);
144
131
  const options = parseBuildOptions(json, fail);
145
132
  // metadata.json의 screens({ learn: { enabled, entry } })와 달리 켤 화면만 파일 이름으로 적는다 (ADR 0004)
146
133
  if (json.screens !== undefined && !isStringRecord(json.screens)) throw fail('screens는 켤 화면만 파일 이름으로 적습니다: { "learn": "index.html", "instructor": "..." } (metadata.json의 { "enabled", "entry" } 모양과 다름).');
147
- const screens = json.screens;
134
+ // 옛 완료 정책 화면은 옮기지 않고 버린다 (완료 정책은 LXP 설정, ADR 0012). legacyCompletion이 경고한다
135
+ const screens = json.screens ? Object.fromEntries(Object.entries(json.screens).filter(([m]) => !LEGACY_COMPLETION_SCREENS.includes(m))) : undefined;
148
136
  // 오타는 metadata.json 파서와 같은 문구로 막는다 (조용히 빠지면 그 화면이 꺼진 채로 만들어짐)
149
137
  const unknownScreen = Object.keys(screens ?? {}).find(m => !rules.manifest.modes.includes(m));
150
- if (unknownScreen === 'completion' || unknownScreen === 'grading') throw fail(`완료 정책 화면의 이름은 completionPolicy입니다 (2026-11-11): screens.${unknownScreen} → "completionPolicy": "${screens?.[unknownScreen] ?? 'completion.html'}"`);
151
138
  if (unknownScreen) throw fail(`알 수 없는 화면입니다: ${unknownScreen} (가능: ${rules.manifest.modes.join(', ')})`);
152
139
  const kind = json.kind;
153
140
  if (kind !== undefined && kind !== 'material' && kind !== 'description') throw fail('kind는 material(자료 본문) 또는 description(문제 설명)이어야 합니다.');
154
- let completionPolicies;
155
- if (json.completionPolicies !== undefined) {
156
- if (kind === 'description') throw fail('문제 설명(kind: description)은 완료 · 채점하지 않으므로 completionPolicies를 넣지 않습니다.');
157
- const policies = parseCompletionPolicies(json.completionPolicies, rules);
158
- if (typeof policies === 'string') throw fail(policies);
159
- completionPolicies = policies;
160
- }
141
+ const legacyCompletion = [...LEGACY_COMPLETION_FIELDS.filter(k => json[k] !== undefined), ...Object.keys(json.screens ?? {}).filter(m => LEGACY_COMPLETION_SCREENS.includes(m)).map(m => `screens.${m}`)];
161
142
  if (json.commentary !== undefined && typeof json.commentary !== 'string') throw fail('commentary는 학습 참고 내용 파일 이름(문자열)이어야 합니다. 예: "commentary.txt"');
162
143
  // 용도별로 켤 수 있는 화면은 rules.json manifest.kindModes (문제 설명은 학생 화면만)
163
144
  if (kind && screens) {
@@ -172,14 +153,14 @@ function parseLegacyConfig(raw) {
172
153
  ...(screens ? {
173
154
  screens
174
155
  } : {}),
175
- ...(completionPolicies ? {
176
- completionPolicies
177
- } : {}),
178
156
  ...(typeof json.commentary === 'string' ? {
179
157
  commentary: json.commentary
180
158
  } : {}),
181
159
  ...(json.gradingTypes !== undefined ? {
182
160
  gradingTypes: json.gradingTypes
161
+ } : {}),
162
+ ...(legacyCompletion.length > 0 ? {
163
+ completion: legacyCompletion
183
164
  } : {})
184
165
  };
185
166
  return {
@@ -189,30 +170,21 @@ function parseLegacyConfig(raw) {
189
170
  legacy,
190
171
  ...(kind ? {
191
172
  kind
192
- } : {}),
193
- ...(completionPolicies ? {
194
- completionPolicies
195
173
  } : {})
196
174
  };
197
175
  }
198
- /** 원본 metadata.json의 kind · completionPolicies (dev · doctor용). 없거나 형식이 틀리면 비워 두고 검사가 알린다 */
176
+ /** 원본 metadata.json의 kind (dev · doctor용). 없거나 형식이 틀리면 비워 두고 검사가 알린다 */
199
177
  async function readManifestInfo(srcDir) {
200
178
  const raw = await readOptional(join(srcDir, rules.manifest.file));
201
179
  if (raw === null) return {};
202
180
  const parsed = parseManifest(raw, rules);
203
181
  if (!parsed.ok) return {};
204
182
  const {
205
- kind,
206
- completionPolicies
183
+ kind
207
184
  } = parsed.manifest;
208
- return {
209
- ...(kind === 'material' || kind === 'description' ? {
210
- kind
211
- } : {}),
212
- ...(completionPolicies ? {
213
- completionPolicies: completionPolicies
214
- } : {})
215
- };
185
+ return kind === 'material' || kind === 'description' ? {
186
+ kind
187
+ } : {};
216
188
  }
217
189
  /** package.json을 읽는다 (없으면 null). JSON 형식이 틀리면 오류 */
218
190
  async function readPackageJson(projectDir) {
@@ -223,7 +195,7 @@ async function readPackageJson(projectDir) {
223
195
  }
224
196
  /**
225
197
  * 프로젝트 설정 (ADR 0011): package.json "ecdk"(빌드 옵션) → 없으면 옛 elice.config.json → 없으면 기본값.
226
- * kind · completionPolicies는 원본 metadata.json에서 읽는다 (옛 elice.config.json이면 거기서).
198
+ * kind는 원본 metadata.json에서 읽는다 (옛 elice.config.json이면 거기서).
227
199
  * 둘 다 있으면 package.json "ecdk"를 쓰고 elice.config.json은 남은 옛 파일로 경고만 한다
228
200
  */
229
201
  async function loadConfig(projectDir) {
@@ -257,7 +229,7 @@ async function planLegacyMigration(projectDir) {
257
229
  const root = typeof current.root === 'string' ? current.root : config.root;
258
230
  const srcDir = resolve(projectDir, root);
259
231
  const legacy = config.legacy ?? {};
260
- const dropped = legacy.gradingTypes !== undefined ? ['gradingTypes'] : [];
232
+ const dropped = [...(legacy.gradingTypes !== undefined ? ['gradingTypes'] : []), ...(legacy.completion ?? [])];
261
233
  const hasPlatform = PLATFORM_KEYS.some(k => legacy[k] !== undefined);
262
234
  const existing = await readOptional(join(srcDir, rules.manifest.file));
263
235
  if (existing !== null) return hasPlatform ? {
@@ -279,7 +251,6 @@ async function planLegacyMigration(projectDir) {
279
251
  entries: legacy.screens ?? {
280
252
  learn: rules.manifest.defaultEntry
281
253
  },
282
- completionPolicies: legacy.completionPolicies,
283
254
  commentary: hasCommentary ? commentaryName : undefined
284
255
  }, rules);
285
256
  return {
@@ -319,42 +290,20 @@ async function applyLegacyMigration(projectDir, plan) {
319
290
  }
320
291
  /** elice.config.json에 옛 `gradingTypes`가 남아 있을 때 build · doctor가 보여 줄 경고. 없으면 null */
321
292
  function legacyGradingTypesWarning(config) {
322
- return config.legacy?.gradingTypes === undefined ? null : `${CONFIG_FILE}의 gradingTypes는 더 쓰지 않습니다 (2026-11-10, 지워 주세요). 완료 정책은 completionPolicies · 완료 정책 화면(screens.completionPolicy)이, 채점 방식 · 답은 편집 화면(settings.grading)이 정합니다 (ADR 0009).`;
293
+ return config.legacy?.gradingTypes === undefined ? null : `${CONFIG_FILE}의 gradingTypes는 더 쓰지 않습니다 (2026-11-10, 지워 주세요). 채점 방식 · 답은 편집 화면(settings.grading)이 정합니다 (ADR 0009).`;
323
294
  }
324
- /**
325
- * 로컬 완료 정책 (ecdk dev 흉내): `.ecdk/completion.json`(ecdk dev 완료 정책 화면이 저장)이 completionPolicies 안에
326
- * 있으면 그것, 아니면 completionPolicies 첫 값(서버가 업로드 때 정하는 값), 없으면 on_submit.
327
- * completionPolicies가 바뀌어 저장해 둔 값이 목록에서 빠졌으면 첫 값으로 돌아간다
328
- */
329
- async function loadCompletionPolicy(projectDir, config) {
330
- const policies = config.completionPolicies ?? [];
331
- const first = policies[0] ?? DEFAULT_COMPLETION_POLICY;
332
- try {
333
- const raw = await readFile(join(projectDir, COMPLETION_DATA_FILE), 'utf8');
334
- const fail = msg => new Error(`${COMPLETION_DATA_FILE}: ${msg}`);
335
- // 값 이름은 서버 material_version.completion_policy와 같게
336
- const json = parseJson(raw, fail);
337
- const policyError = completionPolicyError(json?.completion_policy, COMPLETION_POLICIES);
338
- if (policyError) throw fail(policyError);
339
- const saved = json?.completion_policy;
340
- return policies.includes(saved) ? saved : first;
341
- } catch (e) {
342
- if (e.code !== 'ENOENT') throw e;
343
- }
344
- return first;
295
+ /** elice.config.json에 옛 완료 정책 필드 · 화면이 남아 있을 때 build · doctor가 보여 줄 경고. 없으면 null */
296
+ function legacyCompletionWarning(config) {
297
+ const fields = config.legacy?.completion;
298
+ return fields === undefined || fields.length === 0 ? null : `${CONFIG_FILE}의 ${fields.join(' · ')}는 더 쓰지 않습니다. ${COMPLETION_POLICIES_IGNORED.replace('metadata.json에서', `${CONFIG_FILE}에서`)}.`;
345
299
  }
346
300
  /**
347
301
  * `ecdk dev` 편집 화면이 저장한 settings (`.ecdk/settings.json`, 없으면 {}). 흉내 서버가 시작할 때 읽어 다시 열어도 남는다.
348
302
  * 형식이 틀리면 오류
349
303
  */
350
304
  async function loadSavedSettings(projectDir) {
351
- let raw;
352
- try {
353
- raw = await readFile(join(projectDir, SETTINGS_DATA_FILE), 'utf8');
354
- } catch (e) {
355
- if (e.code === 'ENOENT') return {};
356
- throw e;
357
- }
305
+ const raw = await readOptional(join(projectDir, SETTINGS_DATA_FILE));
306
+ if (raw === null) return {};
358
307
  const fail = msg => new Error(`${SETTINGS_DATA_FILE}: ${msg}`);
359
308
  const json = parseJson(raw, fail);
360
309
  if (typeof json !== 'object' || json === null || Array.isArray(json)) throw fail('객체여야 합니다 (ecdk dev의 내용 편집이 저장한 settings).');
@@ -368,14 +317,12 @@ function savedGrading(settings) {
368
317
  return parsed;
369
318
  }
370
319
  /**
371
- * 로컬 채점 흉내용 값: 완료 정책 + `.ecdk/settings.json`의 grading. 문제 설명(채점 없음)은 undefined
320
+ * 로컬 채점 흉내용 값: `.ecdk/settings.json`의 grading. 문제 설명(채점 없음)은 undefined
372
321
  */
373
322
  async function loadGrading(projectDir, config) {
374
323
  if (config.kind === 'description') return undefined;
375
- const grading = savedGrading(await loadSavedSettings(projectDir));
376
324
  return {
377
- completion_policy: await loadCompletionPolicy(projectDir, config),
378
- grading
325
+ grading: savedGrading(await loadSavedSettings(projectDir))
379
326
  };
380
327
  }
381
328
  /**
@@ -388,4 +335,4 @@ const LEGACY_FILES = Object.freeze({
388
335
  grading: 'grading.json'
389
336
  });
390
337
 
391
- export { BUILD_OPTION_KEYS, COMPLETION_DATA_FILE, COMPLETION_POLICIES, CONFIG_FILE, DEFAULT_COMPLETION_POLICY, GRADER_TYPES, LEGACY_FILES, PACKAGE_CONFIG_KEY, PACKAGE_FILE, PLATFORM_KEYS, SETTINGS_DATA_FILE, applyLegacyMigration, legacyGradingTypesWarning, loadCompletionPolicy, loadConfig, loadGrading, loadSavedSettings, parseGrading, planLegacyMigration, readPackageJson, savedGrading };
338
+ export { BUILD_OPTION_KEYS, CONFIG_FILE, GRADER_TYPES, LEGACY_FILES, PACKAGE_CONFIG_KEY, PACKAGE_FILE, PLATFORM_KEYS, SETTINGS_DATA_FILE, applyLegacyMigration, legacyCompletionWarning, legacyGradingTypesWarning, loadConfig, loadGrading, loadSavedSettings, parseGrading, planLegacyMigration, readPackageJson, savedGrading };
@@ -0,0 +1,21 @@
1
+ /** 업데이트는 npm latest 태그를 따른다 (prerelease 태그는 보지 않음, 사용자 결정 2026-11-12) */
2
+ export declare const CLI_PACKAGE = "@eliceio/cdk-cli";
3
+ /** 이 환경 변수가 있으면 doctor가 npm에 묻지 않는다 (오프라인 · CI · 테스트) */
4
+ export declare const NO_UPDATE_CHECK_ENV = "ECDK_NO_UPDATE_CHECK";
5
+ /** doctor는 오래 기다리지 않는다 (확인 못 하면 건너뜀) */
6
+ export declare const LATEST_DOCTOR_TIMEOUT_MS = 3000;
7
+ export declare const LATEST_UPDATE_TIMEOUT_MS = 10000;
8
+ export type LatestResult = {
9
+ ok: true;
10
+ version: string;
11
+ } | {
12
+ ok: false;
13
+ error: string;
14
+ };
15
+ /**
16
+ * npm latest 태그 버전. 사용자의 .npmrc · 프록시가 그대로 적용되게 npm을 실행한다 (fetch 아님).
17
+ * Windows의 npm은 npm.cmd라 셸로 실행한다
18
+ */
19
+ export declare function npmLatest(timeoutMs: number): LatestResult;
20
+ /** latest가 current보다 새 버전인지 (prerelease 포함 semver). 같거나 current가 새 버전이면 false: 내리지 않는다 */
21
+ export declare function isNewer(latest: string, current: string): boolean;
@@ -0,0 +1,43 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { compareVersions } from '../rules/semver.js';
3
+
4
+ /** 업데이트는 npm latest 태그를 따른다 (prerelease 태그는 보지 않음, 사용자 결정 2026-11-12) */
5
+ const CLI_PACKAGE = '@eliceio/cdk-cli';
6
+ /** 이 환경 변수가 있으면 doctor가 npm에 묻지 않는다 (오프라인 · CI · 테스트) */
7
+ const NO_UPDATE_CHECK_ENV = 'ECDK_NO_UPDATE_CHECK';
8
+ /** doctor는 오래 기다리지 않는다 (확인 못 하면 건너뜀) */
9
+ const LATEST_DOCTOR_TIMEOUT_MS = 3000;
10
+ const LATEST_UPDATE_TIMEOUT_MS = 10000;
11
+ /**
12
+ * npm latest 태그 버전. 사용자의 .npmrc · 프록시가 그대로 적용되게 npm을 실행한다 (fetch 아님).
13
+ * Windows의 npm은 npm.cmd라 셸로 실행한다
14
+ */
15
+ function npmLatest(timeoutMs) {
16
+ const r = spawnSync('npm', ['view', CLI_PACKAGE, 'dist-tags.latest'], {
17
+ encoding: 'utf8',
18
+ timeout: timeoutMs,
19
+ shell: process.platform === 'win32'
20
+ });
21
+ if (r.error || r.signal) return {
22
+ ok: false,
23
+ error: r.error?.code === 'ETIMEDOUT' || r.signal ? `${timeoutMs / 1000}초 안에 응답 없음` : r.error?.message ?? '실행 실패'
24
+ };
25
+ const version = (r.stdout ?? '').trim();
26
+ if (r.status !== 0 || compareVersions(version, version) === undefined) {
27
+ const detail = `${r.stderr ?? ''}`.trim().split('\n').find(l => /ERR!|error/i.test(l));
28
+ return {
29
+ ok: false,
30
+ error: detail ?? `npm view 종료 코드 ${r.status ?? '-'}`
31
+ };
32
+ }
33
+ return {
34
+ ok: true,
35
+ version
36
+ };
37
+ }
38
+ /** latest가 current보다 새 버전인지 (prerelease 포함 semver). 같거나 current가 새 버전이면 false: 내리지 않는다 */
39
+ function isNewer(latest, current) {
40
+ return (compareVersions(latest, current) ?? 0) > 0;
41
+ }
42
+
43
+ export { CLI_PACKAGE, LATEST_DOCTOR_TIMEOUT_MS, LATEST_UPDATE_TIMEOUT_MS, NO_UPDATE_CHECK_ENV, isNewer, npmLatest };
@@ -82,6 +82,8 @@ async function prepareContent(projectDir, config, options = {}) {
82
82
  } catch {
83
83
  raw = null;
84
84
  }
85
+ // 옛 완료 정책 필드 · 화면(completionPolicies · screens.completionPolicy)은 여기서는 두고 검사가 경고한다
86
+ // (manifest.completion-policies-ignored). zip에 쓸 때 build가 뺀다 (ADR 0012)
85
87
  if (raw && typeof raw === 'object' && !Array.isArray(raw)) authored.data = new TextEncoder().encode(`${JSON.stringify({
86
88
  ...raw,
87
89
  build
@@ -94,9 +96,8 @@ async function prepareContent(projectDir, config, options = {}) {
94
96
  path: rules.manifest.file,
95
97
  data: new TextEncoder().encode(serializeManifest({
96
98
  kind: legacy.kind,
97
- // 정답은 metadata에 넣지 않는다: 편집 화면이 settings.grading에 저장. 지원하는 완료 정책만 적는다 (ADR 0009)
99
+ // 정답은 metadata에 넣지 않는다: 편집 화면이 settings.grading에 저장. 완료 정책은 LXP 설정 (ADR 0012)
98
100
  entries,
99
- completionPolicies: legacy.completionPolicies,
100
101
  commentary,
101
102
  build
102
103
  }, rules))
@@ -14,9 +14,9 @@ export declare function findLegacySdkCopy(projectDir: string, config: ContentCon
14
14
  * 프로젝트(ecdk 프로젝트 폴더)를 검사할 때 build · dev · doctor · check가 함께 쓰는 검사 옵션.
15
15
  * 파일은 prepareContent가 만든 zip 내용(원본)이고, 모듈 묶기는 build가 하므로 module-src는 보지 않는다.
16
16
  * 프로젝트에만 있는 정보(예: 남은 옛 파일, 템플릿 목록)를 검사에 더할 때는 이 함수에만 더한다.
17
- * 그래야 `ecdk check <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
17
+ * 그래야 `ecdk validate <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
18
18
  *
19
- * `ecdk dev`가 쓰는 상태(.ecdk/settings.json · completion.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
19
+ * `ecdk dev`가 쓰는 상태(.ecdk/settings.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
20
20
  * 저장했는지에 따라 달라지지 않게. templates: 이 CLI가 가진 템플릿 · 버전 (build.template-unknown).
21
21
  * legacyFiles: 남은 옛 파일 (project.legacy-file, elice.config.json · content.json · grading.json).
22
22
  * legacySdkCopy: 옛 lib/cdk.js 복사본 (sdk.lib-copy)
@@ -30,9 +30,9 @@ async function findLegacySdkCopy(projectDir, config) {
30
30
  * 프로젝트(ecdk 프로젝트 폴더)를 검사할 때 build · dev · doctor · check가 함께 쓰는 검사 옵션.
31
31
  * 파일은 prepareContent가 만든 zip 내용(원본)이고, 모듈 묶기는 build가 하므로 module-src는 보지 않는다.
32
32
  * 프로젝트에만 있는 정보(예: 남은 옛 파일, 템플릿 목록)를 검사에 더할 때는 이 함수에만 더한다.
33
- * 그래야 `ecdk check <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
33
+ * 그래야 `ecdk validate <프로젝트>`와 `ecdk build` 결과가 어긋나지 않는다.
34
34
  *
35
- * `ecdk dev`가 쓰는 상태(.ecdk/settings.json · completion.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
35
+ * `ecdk dev`가 쓰는 상태(.ecdk/settings.json)는 보지 않는다: build · check 결과가 dev에서 무엇을
36
36
  * 저장했는지에 따라 달라지지 않게. templates: 이 CLI가 가진 템플릿 · 버전 (build.template-unknown).
37
37
  * legacyFiles: 남은 옛 파일 (project.legacy-file, elice.config.json · content.json · grading.json).
38
38
  * legacySdkCopy: 옛 lib/cdk.js 복사본 (sdk.lib-copy)
@@ -2,7 +2,7 @@
2
2
  export declare const TEMPLATE_ROOT: string;
3
3
  /**
4
4
  * 템플릿 한 개의 정보 (`templates/<이름>/template.json`). 템플릿마다 버전을 따로 올린다 (CLI 버전과 별개).
5
- * 화면 구성 · 완료 정책은 template.json에 다시 적지 않고 템플릿의 metadata.json을 그대로 읽는다 (한 곳만 고치게).
5
+ * 화면 구성은 template.json에 다시 적지 않고 템플릿의 metadata.json을 그대로 읽는다 (한 곳만 고치게).
6
6
  */
7
7
  export interface TemplateInfo {
8
8
  name: string;
@@ -11,8 +11,6 @@ export interface TemplateInfo {
11
11
  description: string;
12
12
  /** 템플릿 metadata.json에서 켠 화면 */
13
13
  screens: string[];
14
- /** 템플릿 metadata.json의 completionPolicies (첫 값이 기본, 하나면 고정) */
15
- completionPolicies?: string[] | undefined;
16
14
  }
17
15
  /** 이 CLI가 가진 템플릿 (이름 순, 공통 폴더 `_shared` 제외) */
18
16
  export declare function listTemplates(root?: string): TemplateInfo[];
@@ -16,10 +16,7 @@ function listTemplates(root = TEMPLATE_ROOT) {
16
16
  version: meta.version,
17
17
  title: meta.title,
18
18
  description: meta.description,
19
- screens: Object.entries(manifest.screens ?? {}).filter(([, s]) => s.enabled === true).map(([name]) => name),
20
- ...(manifest.completionPolicies ? {
21
- completionPolicies: manifest.completionPolicies
22
- } : {})
19
+ screens: Object.entries(manifest.screens ?? {}).filter(([, s]) => s.enabled === true).map(([name]) => name)
23
20
  };
24
21
  }).sort((a, b) => a.name.localeCompare(b.name));
25
22
  }
@@ -1,5 +1,5 @@
1
1
  import type { LocalGrading } from '../core/config.js';
2
- /** 제출 응답 `{ is_correct, score }` (서버 설계 v25). 채점하지 않는 정책은 둘 다 null */
2
+ /** 제출 응답 `{ is_correct, score }` (서버 설계 v25). 채점하지 않으면 둘 다 null */
3
3
  export interface GradeResult {
4
4
  isCorrect: boolean | null;
5
5
  score: number | null;
@@ -11,12 +11,11 @@ export declare const answerText: (answer: unknown) => string;
11
11
  /** pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞는지. 정규식이 틀리거나 없으면 오답 */
12
12
  export declare function matchesPattern(answerKey: unknown, answer: unknown): boolean;
13
13
  /**
14
- * elice-material 채점 흉내 (ADR 0009: 완료 정책 → 채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
15
- * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다.
16
- * - on_access: 열면 완료, 제출은 점수 없음 `{ null, null }`
17
- * - on_submit: 제출하면 100
18
- * - on_graded + pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
19
- * - on_graded + rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
20
- * - on_graded인데 답(편집 화면이 저장하는 settings.grading)이 아직 없으면 채점할 수 없어 `{ null, null }`
14
+ * elice-material 채점 흉내 (채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
15
+ * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다. 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012):
16
+ * 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
17
+ * - pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
18
+ * - rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
19
+ * - 채점 설정(편집 화면이 저장하는 settings.grading)이 없으면 제출만 받고 `{ null, null }`
21
20
  */
22
21
  export declare function grade(local: LocalGrading | undefined, answer: unknown): GradeResult;
package/es/dev/grading.js CHANGED
@@ -12,24 +12,14 @@ function matchesPattern(answerKey, answer) {
12
12
  }
13
13
  }
14
14
  /**
15
- * elice-material 채점 흉내 (ADR 0009: 완료 정책 → 채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
16
- * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다.
17
- * - on_access: 열면 완료, 제출은 점수 없음 `{ null, null }`
18
- * - on_submit: 제출하면 100
19
- * - on_graded + pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
20
- * - on_graded + rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
21
- * - on_graded인데 답(편집 화면이 저장하는 settings.grading)이 아직 없으면 채점할 수 없어 `{ null, null }`
15
+ * elice-material 채점 흉내 (채점 방식 → 점수). 채점은 모두 요청 안에서 끝난다.
16
+ * 템플릿 mock(`lib/cdk-mock.js`의 gradeLocally)과 같은 판정이다. 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012):
17
+ * 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
18
+ * - pattern: 답 문자열 전체를 정규식 하나로 비교 0 / 100
19
+ * - rubric: 흉내 점수 RUBRIC_DEV_SCORE, 통과로 본다 (통과 기준 pass_threshold는 정해지지 않음, G136)
20
+ * - 채점 설정(편집 화면이 저장하는 settings.grading)이 없으면 제출만 받고 `{ null, null }`
22
21
  */
23
22
  function grade(local, answer) {
24
- const policy = local?.completion_policy ?? 'on_submit';
25
- if (policy === 'on_access') return {
26
- isCorrect: null,
27
- score: null
28
- };
29
- if (policy === 'on_submit') return {
30
- isCorrect: true,
31
- score: 100
32
- };
33
23
  const grading = local?.grading;
34
24
  if (grading?.type === 'pattern') {
35
25
  const ok = matchesPattern(grading.answer_key, answer);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * LXP 학습 · 편집 페이지 흉내. 보기를 바꾸고 콘텐츠를 sandbox iframe으로 띄우며,
3
- * @eliceio/cdk가 보내는 postMessage(settings-saved · navigate-*)를 받아 처리한다
3
+ * @eliceio/cdk가 보내는 postMessage(status · settings-saved · navigate-*)를 받아 처리한다
4
4
  */
5
5
  export declare function hostPage(opts: {
6
6
  title: string;