@eliceio/cdk-cli 1.2.1 → 1.3.0-contenttypes.1

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 (169) hide show
  1. package/README.md +63 -53
  2. package/es/cli.js +11 -2
  3. package/es/commands/build/index.js +12 -0
  4. package/es/commands/create/index.js +2 -0
  5. package/es/commands/create/scaffold.d.ts +2 -2
  6. package/es/commands/create/scaffold.js +3 -3
  7. package/es/commands/dev/index.d.ts +10 -1
  8. package/es/commands/dev/index.js +47 -7
  9. package/es/commands/doctor/index.js +6 -2
  10. package/es/core/config.d.ts +42 -9
  11. package/es/core/config.js +217 -12
  12. package/es/core/project-check.d.ts +3 -2
  13. package/es/core/project-check.js +14 -3
  14. package/es/core/regex.d.ts +11 -0
  15. package/es/core/regex.js +41 -0
  16. package/es/core/sandbox.d.ts +26 -0
  17. package/es/core/sandbox.js +240 -30
  18. package/es/dev/assets.d.ts +80 -0
  19. package/es/dev/assets.js +240 -0
  20. package/es/dev/check.d.ts +30 -0
  21. package/es/dev/check.js +224 -34
  22. package/es/dev/grading.d.ts +49 -14
  23. package/es/dev/grading.js +109 -29
  24. package/es/dev/host-page.js +27 -3
  25. package/es/dev/inject.d.ts +2 -1
  26. package/es/dev/inject.js +10 -2
  27. package/es/dev/mock-api.d.ts +26 -3
  28. package/es/dev/mock-api.js +219 -40
  29. package/es/dev/server.d.ts +12 -1
  30. package/es/dev/server.js +115 -9
  31. package/es/engines/vite/index.js +1 -1
  32. package/es/engines/vite/plugin.d.ts +2 -0
  33. package/es/engines/vite/plugin.js +33 -5
  34. package/es/rules/answers.d.ts +13 -0
  35. package/es/rules/answers.js +94 -0
  36. package/es/rules/check.js +70 -1
  37. package/es/rules/index.d.ts +1 -0
  38. package/es/rules/index.js +1 -0
  39. package/es/rules/size.d.ts +31 -0
  40. package/es/rules/size.js +58 -0
  41. package/es/rules/types.d.ts +12 -0
  42. package/es/rules.json.js +2 -2
  43. package/package.json +2 -2
  44. package/rules.json +34 -5
  45. package/skills/_shared/always.md +3 -3
  46. package/skills/_shared/references/00-what-the-person-decides.md +1 -1
  47. package/skills/_shared/references/02-design-the-material.md +10 -7
  48. package/skills/_shared/references/03-create-the-project.md +10 -8
  49. package/skills/_shared/references/04-rules.md +1 -1
  50. package/skills/_shared/references/05-screen-code.md +52 -23
  51. package/skills/_shared/references/06-using-the-quiz-template.md +7 -6
  52. package/skills/_shared/references/08-fix-check-errors.md +23 -22
  53. package/skills/_shared/references/09-check.md +8 -6
  54. package/skills/_shared/references/12-upload-with-the-material-mcp.md +13 -13
  55. package/skills/_shared/references/13-edit-screen-design.md +122 -0
  56. package/skills/_shared/references/14-layouts.md +96 -0
  57. package/skills/elice-content-check/SKILL.md +2 -2
  58. package/skills/elice-content-create/SKILL.md +1 -1
  59. package/skills/elice-content-migrate/SKILL.md +1 -1
  60. package/skills/elice-content-publish/SKILL.md +1 -1
  61. package/templates/_shared/lib/cdk-mock.d.ts +47 -3
  62. package/templates/_shared/lib/cdk-mock.js +293 -15
  63. package/templates/_shared/lib/elice-content-editor.js +89 -58
  64. package/templates/_shared/lib/elice-content.css +1313 -126
  65. package/templates/_shared/lib/elice-content.d.ts +222 -23
  66. package/templates/_shared/lib/elice-content.js +1176 -88
  67. package/templates/_shared/lib/icons/empty-content.d.ts +2 -0
  68. package/templates/_shared/lib/icons/empty-content.js +11 -0
  69. package/templates/_shared/lib/icons/file-video.d.ts +2 -0
  70. package/templates/_shared/lib/icons/file-video.js +11 -0
  71. package/templates/_shared/lib/icons/file.d.ts +2 -0
  72. package/templates/_shared/lib/icons/file.js +11 -0
  73. package/templates/blank/README.md +6 -4
  74. package/templates/blank/edit.html +8 -2
  75. package/templates/blank/index.html +6 -1
  76. package/templates/blank/instructor.html +6 -1
  77. package/templates/blank/screens/instructor.js +8 -2
  78. package/templates/blank/screens/learn.js +1 -1
  79. package/templates/blank/template.json +1 -1
  80. package/templates/document/README.md +92 -0
  81. package/templates/document/commentary.txt +2 -0
  82. package/templates/document/core/dom.d.ts +13 -0
  83. package/templates/document/core/dom.js +83 -0
  84. package/templates/document/core/file-type.d.ts +21 -0
  85. package/templates/document/core/file-type.js +85 -0
  86. package/templates/document/core/group-3d.d.ts +20 -0
  87. package/templates/document/core/group-3d.js +256 -0
  88. package/templates/document/core/inline-edit.d.ts +15 -0
  89. package/templates/document/core/inline-edit.js +377 -0
  90. package/templates/document/core/load.d.ts +13 -0
  91. package/templates/document/core/load.js +40 -0
  92. package/templates/document/core/pdf-options.d.ts +9 -0
  93. package/templates/document/core/pdf-options.js +36 -0
  94. package/templates/document/core/pdf-worker.d.ts +24 -0
  95. package/templates/document/core/pdf-worker.js +122 -0
  96. package/templates/document/core/pdf.d.ts +12 -0
  97. package/templates/document/core/pdf.js +190 -0
  98. package/templates/document/core/pptx-edit.d.ts +14 -0
  99. package/templates/document/core/pptx-edit.js +137 -0
  100. package/templates/document/core/pptx-fonts.d.ts +5 -0
  101. package/templates/document/core/pptx-fonts.js +115 -0
  102. package/templates/document/core/pptx-media.d.ts +18 -0
  103. package/templates/document/core/pptx-media.js +83 -0
  104. package/templates/document/core/pptx-view.d.ts +5 -0
  105. package/templates/document/core/pptx-view.js +185 -0
  106. package/templates/document/core/settings.d.ts +25 -0
  107. package/templates/document/core/settings.js +86 -0
  108. package/templates/document/core/slide-edges.d.ts +3 -0
  109. package/templates/document/core/slide-edges.js +82 -0
  110. package/templates/document/core/viewer.d.ts +28 -0
  111. package/templates/document/core/viewer.js +159 -0
  112. package/templates/document/edit.html +17 -0
  113. package/templates/document/gitignore +4 -0
  114. package/templates/document/index.html +18 -0
  115. package/templates/document/metadata.json +9 -0
  116. package/templates/document/package.json +17 -0
  117. package/templates/document/public/fonts/OFL-Caladea.txt +93 -0
  118. package/templates/document/public/fonts/OFL-Carlito.txt +93 -0
  119. package/templates/document/public/fonts/caladea-latin-400-normal.woff2 +0 -0
  120. package/templates/document/public/fonts/caladea-latin-700-normal.woff2 +0 -0
  121. package/templates/document/public/fonts/carlito-latin-400-normal.woff2 +0 -0
  122. package/templates/document/public/fonts/carlito-latin-700-normal.woff2 +0 -0
  123. package/templates/document/screens/edit.js +574 -0
  124. package/templates/document/screens/learn.js +61 -0
  125. package/templates/document/styles.css +644 -0
  126. package/templates/document/template.json +6 -0
  127. package/templates/document/ui/templates/edit.js +82 -0
  128. package/templates/document/ui/templates/page.js +11 -0
  129. package/templates/document/ui/templates/viewer.js +41 -0
  130. package/templates/document/ui/texts.d.ts +3 -0
  131. package/templates/document/ui/texts.js +62 -0
  132. package/templates/document/ui/theme.css +69 -0
  133. package/templates/quiz/README.md +32 -14
  134. package/templates/quiz/core/behaviors.d.ts +17 -7
  135. package/templates/quiz/core/behaviors.js +40 -53
  136. package/templates/quiz/core/editor.d.ts +27 -2
  137. package/templates/quiz/core/editor.js +412 -11
  138. package/templates/quiz/core/markdown.d.ts +19 -0
  139. package/templates/quiz/core/markdown.js +225 -11
  140. package/templates/quiz/core/model.d.ts +40 -3
  141. package/templates/quiz/core/model.js +112 -5
  142. package/templates/quiz/core/rich-text.d.ts +18 -0
  143. package/templates/quiz/core/rich-text.js +469 -0
  144. package/templates/quiz/edit.html +12 -3
  145. package/templates/quiz/index.html +12 -3
  146. package/templates/quiz/public/img/mascot-half.webp +0 -0
  147. package/templates/quiz/screens/edit.js +331 -49
  148. package/templates/quiz/screens/learn.js +147 -15
  149. package/templates/quiz/styles.css +1244 -622
  150. package/templates/quiz/template.json +9 -2
  151. package/templates/quiz/ui/templates/edit.d.ts +19 -5
  152. package/templates/quiz/ui/templates/edit.js +371 -77
  153. package/templates/quiz/ui/templates/group.js +19 -8
  154. package/templates/quiz/ui/templates/order.js +25 -24
  155. package/templates/quiz/ui/templates/page.js +33 -8
  156. package/templates/quiz/ui/templates/question.js +6 -4
  157. package/templates/quiz/ui/texts.js +91 -26
  158. package/templates/quiz/ui/theme.css +8 -9
  159. package/templates/steps/README.md +77 -0
  160. package/templates/steps/commentary.txt +7 -0
  161. package/templates/steps/edit.html +21 -0
  162. package/templates/steps/gitignore +4 -0
  163. package/templates/steps/index.html +69 -0
  164. package/templates/steps/metadata.json +9 -0
  165. package/templates/steps/package.json +13 -0
  166. package/templates/steps/screens/edit.js +32 -0
  167. package/templates/steps/screens/learn.js +108 -0
  168. package/templates/steps/styles.css +54 -0
  169. package/templates/steps/template.json +6 -0
@@ -12,11 +12,14 @@ import { injectDevScript } from '../../dev/inject.js';
12
12
  import { checkFiles } from '../../rules/check.js';
13
13
  import { rules } from '../../rules/spec.js';
14
14
  import { stripCompletionPolicy } from '../../rules/manifest.js';
15
+ import { screenSizeIssues, screenSizes } from '../../rules/size.js';
15
16
  import { findUnreferenced } from '../../rules/unused.js';
16
17
  import 'fflate';
17
18
 
18
19
  /** Plugin name. `ecdk build` / `ecdk dev` add the plugin only when the Vite config has none with this name */
19
20
  const ECDK_PLUGIN_NAME = 'ecdk';
21
+ /** 키트가 흉내 SDK를 넣을지 보는 전역 이름. build만 false로 바꾼다 (정의하지 않으면 넣음: ecdk dev · 테스트) */
22
+ const MOCK_SDK_FLAG = '__ECDK_MOCK_SDK__';
20
23
  const encoder = new TextEncoder();
21
24
  const decoder = new TextDecoder();
22
25
  /**
@@ -127,6 +130,13 @@ function ecdk(options = {}) {
127
130
  ...(isBuild ? {
128
131
  base: './'
129
132
  } : {}),
133
+ // 키트(lib/elice-content.js)의 흉내 SDK 분기를 build에서 지운다 (운영 zip에 cdk-mock.js가 들어가지 않게).
134
+ // ecdk dev는 바꾸지 않아 흉내 SDK를 그대로 쓴다
135
+ ...(isBuild ? {
136
+ define: {
137
+ [MOCK_SDK_FLAG]: 'false'
138
+ }
139
+ } : {}),
130
140
  appType: 'mpa',
131
141
  cacheDir: join(projectDir, 'node_modules', '.vite'),
132
142
  build: {
@@ -147,7 +157,11 @@ function ecdk(options = {}) {
147
157
  // chunk hashes depend on the absolute project path, so chunks get stable names for reproducible zips
148
158
  output: {
149
159
  entryFileNames: 'assets/[name].js',
150
- chunkFileNames: 'assets/[name].js'
160
+ chunkFileNames: 'assets/[name].js',
161
+ // minify해도 라이선스 주석(/*! · @license)은 남긴다 (넣은 아이콘 · 라이브러리의 고지 의무, Vite 8 기본은 지움)
162
+ comments: {
163
+ legal: true
164
+ }
151
165
  }
152
166
  }
153
167
  }
@@ -180,12 +194,20 @@ function ecdk(options = {}) {
180
194
  const emitted = new Set(output.map(f => f.path));
181
195
  for (const f of prepared.files) if (!emitted.has(f.path) && (prepared.publicFiles.has(f.path) || f.path === commentary)) output.push(f);
182
196
  // Inline each page's module scripts (chunks) so pages load even when the LXP content origin is null
197
+ // Chunks reached only through import() can stay as separate files loaded on demand (core/sandbox.ts)
198
+ const graph = new Map();
199
+ for (const item of Object.values(bundle)) if (item.type === 'chunk') graph.set(item.fileName, {
200
+ imports: item.imports,
201
+ dynamicImports: item.dynamicImports
202
+ });
183
203
  const sandboxed = await inlineModuleScripts(output, {
184
204
  minify: config.minify !== false,
185
- sourcemap: config.sourcemap === true
205
+ sourcemap: config.sourcemap === true,
206
+ chunks: graph
186
207
  });
187
- const chunks = new Set(Object.values(bundle).filter(item => item.type === 'chunk').map(item => item.fileName));
188
- const content = sandboxed.files.filter(f => !chunks.has(f.path));
208
+ // Inlined chunks are dropped; chunks emitted as lazy files stay (rewritten as classic scripts)
209
+ const lazy = new Set(sandboxed.report.lazyFiles);
210
+ const content = sandboxed.files.filter(f => !graph.has(f.path) || lazy.has(f.path));
189
211
  if (manifest) content.push(manifest);
190
212
  // metadata.json build gets the minify flag and the digest of the final files (metadata.json excluded)
191
213
  const digest = contentDigest(content);
@@ -209,6 +231,12 @@ function ecdk(options = {}) {
209
231
  }
210
232
  const zip = createZip(files);
211
233
  const check = await checkBuild(projectDir, config, prepared, files, zip.byteLength);
234
+ // Screen sizes are known only after bundling: checks read the sources, so add limit.screen-size from the output
235
+ const flagged = new Set(check.issues.filter(i => i.id === 'limit.screen-size').map(i => i.path));
236
+ for (const issue of screenSizeIssues(screenSizes(files), rules)) if (!flagged.has(issue.path)) check.issues.push({
237
+ ...issue,
238
+ level: rules.rules.find(r => r.id === issue.id)?.level ?? 'warn'
239
+ });
212
240
  pendingZip = zip;
213
241
  api.result = {
214
242
  ok: check.ok,
@@ -283,4 +311,4 @@ async function flattenPlugins(plugins) {
283
311
  return value && typeof value === 'object' && 'name' in value ? [value] : [];
284
312
  }
285
313
 
286
- export { ECDK_PLUGIN_NAME, ecdk, flattenPlugins };
314
+ export { ECDK_PLUGIN_NAME, MOCK_SDK_FLAG, ecdk, flattenPlugins };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 정답 노출 검사(sec.answer-in-bundle)에 쓸 글: 편집 화면이 저장한 채점 설정(settings.grading)에서 그대로 찾을 수 있는 정답 글.
3
+ * 정답은 zip에 넣지 않는다 (ADR 0009). 화면 코드 · 학습 참고 내용에 같은 글이 있으면 학생이 zip에서 읽을 수 있다.
4
+ *
5
+ * - pattern: 정답 정규식 `^…$`에서 앞뒤 ^ · $와 바깥 묶음을 떼고, 맨 위 `|`로 나눈 갈래 중 정규식 기호가 없는 글만
6
+ * (`\.` 같은 이스케이프는 풀어서). `^(서울|Seoul)$` → 서울 · Seoul. `^\d+$`처럼 글이 아닌 갈래는 건너뜀
7
+ * - partial_pattern: 문항마다 정답 정규식 배열이라 원소마다 위와 같이
8
+ * - rubric: 평가 기준 글 전체
9
+ * 흔한 글과 겹치는 짧은 글은 뺀다: 한글이 든 글은 2자 미만, 그 밖(영문 · 숫자 등)은 3자 미만, 숫자만 3자 이하(100 · 0.5)
10
+ */
11
+ export declare function answerNeedles(grading: unknown): string[];
12
+ /** 정규식에서 그대로 찾을 수 있는 글 갈래 */
13
+ export declare function regexLiterals(regex: string): string[];
@@ -0,0 +1,94 @@
1
+ /**
2
+ * 정답 노출 검사(sec.answer-in-bundle)에 쓸 글: 편집 화면이 저장한 채점 설정(settings.grading)에서 그대로 찾을 수 있는 정답 글.
3
+ * 정답은 zip에 넣지 않는다 (ADR 0009). 화면 코드 · 학습 참고 내용에 같은 글이 있으면 학생이 zip에서 읽을 수 있다.
4
+ *
5
+ * - pattern: 정답 정규식 `^…$`에서 앞뒤 ^ · $와 바깥 묶음을 떼고, 맨 위 `|`로 나눈 갈래 중 정규식 기호가 없는 글만
6
+ * (`\.` 같은 이스케이프는 풀어서). `^(서울|Seoul)$` → 서울 · Seoul. `^\d+$`처럼 글이 아닌 갈래는 건너뜀
7
+ * - partial_pattern: 문항마다 정답 정규식 배열이라 원소마다 위와 같이
8
+ * - rubric: 평가 기준 글 전체
9
+ * 흔한 글과 겹치는 짧은 글은 뺀다: 한글이 든 글은 2자 미만, 그 밖(영문 · 숫자 등)은 3자 미만, 숫자만 3자 이하(100 · 0.5)
10
+ */
11
+ function answerNeedles(grading) {
12
+ if (typeof grading !== 'object' || grading === null) return [];
13
+ const g = grading;
14
+ const out = [];
15
+ const key = g.answer_key ?? g.answerKey;
16
+ const keys = Array.isArray(key) ? key : [key];
17
+ for (const k of keys) if (typeof k === 'string') out.push(...regexLiterals(k));
18
+ if (typeof g.rubric === 'string') out.push(g.rubric.trim());
19
+ return [...new Set(out)].filter(s => s.length >= (/[가-힣]/.test(s) ? 2 : 3) && !/^\d{1,3}$/.test(s));
20
+ }
21
+ /** 정규식에서 그대로 찾을 수 있는 글 갈래 */
22
+ function regexLiterals(regex) {
23
+ let s = regex.trim();
24
+ if (s.startsWith('^')) s = s.slice(1);
25
+ if (s.endsWith('$') && !s.endsWith('\\$')) s = s.slice(0, -1);
26
+ s = stripOuterGroup(trimSpaces(s));
27
+ return splitTopLevel(s).map(trimSpaces).map(unescapeLiteral).filter(x => x !== null).map(x => x.trim());
28
+ }
29
+ /** 앞뒤 공백 허용(`\\s*` · `\\s+` · `\\s?`)을 뗀다 */
30
+ function trimSpaces(s) {
31
+ return s.replace(/^(?:\\s[*+?]?)+|(?:\\s[*+?]?)+$/g, '');
32
+ }
33
+ /** `(…)` · `(?:…)`가 전체를 감싸면 벗긴다 */
34
+ function stripOuterGroup(s) {
35
+ const open = s.startsWith('(?:') ? 3 : s.startsWith('(') && !s.startsWith('(?') ? 1 : 0;
36
+ if (!open || !s.endsWith(')')) return s;
37
+ let depth = 0;
38
+ for (let i = 0; i < s.length; i++) {
39
+ const c = s[i];
40
+ if (c === '\\') {
41
+ i++;
42
+ continue;
43
+ }
44
+ if (c === '(') depth++;else if (c === ')') {
45
+ depth--;
46
+ if (depth === 0 && i < s.length - 1) return s; // 끝나기 전에 닫힘: 전체를 감싸지 않음
47
+ }
48
+ }
49
+ return s.slice(open, -1);
50
+ }
51
+ /** 맨 위(괄호 · [] 밖)의 | 로 나눈다 */
52
+ function splitTopLevel(s) {
53
+ const parts = [];
54
+ let depth = 0;
55
+ let inClass = false;
56
+ let cur = '';
57
+ for (let i = 0; i < s.length; i++) {
58
+ const c = s[i] ?? '';
59
+ if (c === '\\') {
60
+ cur += c + (s[i + 1] ?? '');
61
+ i++;
62
+ continue;
63
+ }
64
+ if (inClass) {
65
+ if (c === ']') inClass = false;
66
+ } else if (c === '[') inClass = true;else if (c === '(') depth++;else if (c === ')') depth--;else if (c === '|' && depth === 0) {
67
+ parts.push(cur);
68
+ cur = '';
69
+ continue;
70
+ }
71
+ cur += c;
72
+ }
73
+ parts.push(cur);
74
+ return parts;
75
+ }
76
+ /** 정규식 기호가 없는 글이면 이스케이프를 풀어 돌려주고, 기호(. * + ? ( ) [ ] { } | ^ $ \d 등)가 있으면 null */
77
+ function unescapeLiteral(alt) {
78
+ let out = '';
79
+ for (let i = 0; i < alt.length; i++) {
80
+ const c = alt[i] ?? '';
81
+ if (c === '\\') {
82
+ const n = alt[i + 1] ?? '';
83
+ if (/[A-Za-z0-9]/.test(n)) return null; // \d \s \w \b 같은 기호
84
+ out += n;
85
+ i++;
86
+ continue;
87
+ }
88
+ if ('.*+?()[]{}|^$'.includes(c)) return null;
89
+ out += c;
90
+ }
91
+ return out;
92
+ }
93
+
94
+ export { answerNeedles, regexLiterals };
package/es/rules/check.js CHANGED
@@ -4,6 +4,7 @@ import { parseManifest } from './manifest.js';
4
4
  import { isUnsafePath, extname, resolveRef, globToRegExp } from './path.js';
5
5
  import { lineAt, parseTags, extractRefs, classifyRef, FRAME_TAGS } from './refs.js';
6
6
  import { compareVersions } from './semver.js';
7
+ import { screenSizeIssues, screenSizes, isLazyBundleFile } from './size.js';
7
8
  import { lineSkipper } from './skip.js';
8
9
  import { rules } from './spec.js';
9
10
 
@@ -70,6 +71,69 @@ function checkScreenCode(files, manifest, add) {
70
71
  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)을 빼 주세요.`);
71
72
  if (manifest.entries.edit && !/\buseSave\b|\bsaveSettings\s*\(|\bsaveContent\s*\(/.test(code)) add('edit.no-save', `편집 화면(${manifest.entries.edit})을 켰는데 저장(app.useSave · sdk.saveSettings)이 없습니다. 편집한 내용이 LXP로 넘어가지 않습니다.`);
72
73
  }
74
+ /** 레이아웃 값을 적는 곳: HTML 속성 · JS 문자열 속 속성, dataset.ecLayout, setAttribute('data-ec-layout', …) */
75
+ const LAYOUT_VALUE_RES = [/data-ec-(layout|region)\s*=\s*(["'])([^"'\n]*)\2/g, /\.dataset\.ec(Layout|Region)\s*=\s*(["'`])([^"'`\n]*)\2/g, /setAttribute\(\s*["']data-ec-(layout|region)["']\s*,\s*(["'`])([^"'`\n]*)\2/g];
76
+ /** 자작 단계 이동 버튼 글: "이전" · "‹ 이전" · "이전 단계"와 "다음" · "다음 ›" · "다음 단계" (글 전체가 이것뿐인 것만) */
77
+ const OWN_PREV_RES = [/>\s*(?:[◀‹←]\s*|&lt;\s*)?이전(?:\s*단계)?\s*</g, /(["'`])\s*(?:[◀‹←<]\s*)?이전(?:\s*단계)?\s*\1/g];
78
+ const OWN_NEXT_RES = [/>\s*다음(?:\s*단계)?\s*(?:[▶›→]|&gt;)?\s*</g, /(["'`])\s*다음(?:\s*단계)?\s*(?:[▶›→>]\s*)?\1/g];
79
+ /**
80
+ * 키트 레이아웃 · 스테퍼 규칙 (화면 HTML · JS, lib/ 밖). 묶은 모듈 본문은 원본으로 이미 검사해 건너뛴다.
81
+ * - layout.unknown: data-ec-layout · data-ec-region에 키트가 모르는 값 (CSS가 없어 배치가 안 됨)
82
+ * - layout.own-step-nav: 한 파일에 "이전" · "다음" 버튼 글이 같이 있음 (LXP 이전 · 다음 막대와 헷갈림, app.useStepper)
83
+ */
84
+ function checkLayouts(files, spec, add) {
85
+ const decoder = new TextDecoder();
86
+ const known = {
87
+ layout: spec.layouts.content,
88
+ region: spec.layouts.regions
89
+ };
90
+ for (const f of files) {
91
+ if (!/\.(?:m?js|html?)$/i.test(f.path) || f.path.startsWith('lib/')) continue;
92
+ const raw = decoder.decode(f.data);
93
+ const text = /\.html?$/i.test(f.path) ? blankBundles(raw) : raw;
94
+ const skip = lineSkipper(text);
95
+ const found = (res, id) => {
96
+ for (const re of res) for (const m of text.matchAll(re)) {
97
+ const line = lineAt(text, m.index);
98
+ if (!skip.isSkipped(line, id)) return {
99
+ m,
100
+ line
101
+ };
102
+ }
103
+ return null;
104
+ };
105
+ for (const re of LAYOUT_VALUE_RES) for (const m of text.matchAll(re)) {
106
+ const kind = (m[1] ?? '').toLowerCase();
107
+ const value = (m[3] ?? '').trim();
108
+ if (value === '' || value.includes('${') || known[kind].includes(value)) continue;
109
+ const line = lineAt(text, m.index);
110
+ if (skip.isSkipped(line, 'layout.unknown')) continue;
111
+ add('layout.unknown', `data-ec-${kind}="${value}"는 키트가 모르는 값입니다 (가능: ${known[kind].join(' · ')}). 키트 CSS가 배치하지 않아 칸이 그냥 쌓입니다.`, f.path, line);
112
+ }
113
+ const prev = found(OWN_PREV_RES, 'layout.own-step-nav');
114
+ const next = prev && found(OWN_NEXT_RES, 'layout.own-step-nav');
115
+ if (prev && next) add('layout.own-step-nav', '화면 코드가 "이전" · "다음" 버튼을 직접 그리는 것 같습니다. LXP가 자료 아래에 수업 자료 사이 이전 · 다음 막대를 그려 학생이 헷갈립니다. 자료 안 단계는 키트 스테퍼(app.useStepper, 단계마다 <section data-ec-step>)를 써 주세요.', f.path, prev.line);
116
+ }
117
+ }
118
+ /**
119
+ * 저장한 정답 글이 zip에 들어갈 파일(화면 HTML · JS · JSON · 학습 참고 내용 등 텍스트, 키트 lib/ 제외)에 그대로 있으면 경고.
120
+ * 파일마다 처음 한 곳만, 정답 값은 메시지에 싣지 않는다 (터미널 · JSON 출력이 기록으로 남을 수 있음)
121
+ */
122
+ function checkAnswerLeak(files, needles, add) {
123
+ if (needles.length === 0) return;
124
+ const decoder = new TextDecoder();
125
+ for (const f of files) {
126
+ if (!/\.(?:m?js|html?|json|txt|md|csv|xml|svg|vtt)$/i.test(f.path) || f.path.startsWith('lib/')) continue;
127
+ if (f.path === 'metadata.json') continue;
128
+ const text = decoder.decode(f.data);
129
+ for (const needle of needles) {
130
+ const at = text.indexOf(needle);
131
+ if (at < 0) continue;
132
+ add('sec.answer-in-bundle', `편집 화면에 저장한 정답(채점 설정, ${needle.length}자)과 같은 글이 이 파일에 있습니다. zip 안 파일은 학생도 읽을 수 있으니 화면 코드 · 데이터 · 학습 참고 내용에서 빼 주세요 (정답은 편집 화면의 채점 설정에만).`, f.path, lineAt(text, at));
133
+ break;
134
+ }
135
+ }
136
+ }
73
137
  /**
74
138
  * metadata.json build.template("quiz@1.0.0")이 이 CLI가 아는 템플릿 · 버전인지. 모르는 이름이거나 더 새 버전이면
75
139
  * 이 CLI의 검사 · 가이드가 그 템플릿을 모를 수 있다 (경고만, 옛 zip · 템플릿 없이 만든 zip은 build.template이 없음)
@@ -93,7 +157,7 @@ function checkTemplate(manifest, opts, add) {
93
157
  */
94
158
  const LEGACY_FILE_MESSAGES = {
95
159
  'elice.config.json': 'elice.config.json은 더 쓰지 않습니다 (ADR 0011). 화면 · 학습 참고 내용(kind · screens · commentary)은 원본의 metadata.json에, 빌드 옵션 · template은 package.json "ecdk"에 둡니다. ecdk doctor --fix가 옮기고 elice.config.json을 지웁니다 (옮기기 전까지는 지금처럼 빌드됨).',
96
- 'content.json': 'content.json은 더 쓰지 않습니다 (기본 내용 파일 없음, ADR 0011). 화면은 편집 화면이 저장한 내용만 읽고, 저장하기 전에는 "아직 내용이 없습니다" 안내를 보입니다. 그 내용은 LXP에 올린 뒤 편집 화면에서 다시 넣고 파일을 지워 주세요. 화면 코드가 직접 fetch하는 데이터 파일이면 다른 이름(예: data.json)으로 바꿔 주세요.',
160
+ 'content.json': 'content.json은 더 쓰지 않습니다 (기본 내용 파일 없음, ADR 0011). 화면은 편집 화면이 저장한 내용만 읽고, 저장하기 전에는 "학습 자료를 준비하고 있어요" 안내를 보입니다. 그 내용은 LXP에 올린 뒤 편집 화면에서 다시 넣고 파일을 지워 주세요. 화면 코드가 직접 fetch하는 데이터 파일이면 다른 이름(예: data.json)으로 바꿔 주세요.',
97
161
  'grading.json': "grading.json은 더 쓰지 않습니다 (ADR 0011). 채점 방식 · 답은 LXP에 올린 뒤 편집 화면에서 정합니다 (ecdk dev의 '내용 편집'에 넣은 답은 .ecdk/settings.json, publish 스킬이 동의를 받아 업로드와 함께 보낼 수 있음). 파일은 지워 주세요 (zip에는 들어가지 않음)."
98
162
  };
99
163
  function checkLegacyFiles(opts, add) {
@@ -244,6 +308,8 @@ function checkFiles(input, opts = {}) {
244
308
  checkTemplate(manifest, opts, message => add('build.template-unknown', message, spec.manifest.file));
245
309
  checkScreenCode(files, manifest, (id, message) => add(id, message, spec.manifest.file));
246
310
  }
311
+ checkLayouts(files, spec, add);
312
+ checkAnswerLeak(files, opts.answerNeedles ?? [], add);
247
313
  checkLegacyFiles(opts, (message, path) => add('project.legacy-file', message, path));
248
314
  checkSdk(manifest, spec, opts, add);
249
315
  const entry = manifest?.entries.learn ?? spec.manifest.defaultEntry;
@@ -259,6 +325,7 @@ function checkFiles(input, opts = {}) {
259
325
  const zipBytes = opts.zipBytes ?? estimateZipBytes(files);
260
326
  if (files.length > maxFiles) add('limit.file-count', `파일이 ${files.length}개입니다 (한도 ${maxFiles}개).`);else if (files.length >= maxFiles * warnRatio) add('limit.near', `파일 ${files.length}개 · 한도 ${maxFiles}개에 가깝습니다.`);
261
327
  if (zipBytes > maxZipBytes) add('limit.zip-size', `zip 크기가 ${fmtMB(zipBytes)}입니다 (한도 ${fmtMB(maxZipBytes)}). 영상은 비디오 자료로 따로 올리고 이미지는 줄여 주세요.`);else if (zipBytes >= maxZipBytes * warnRatio) add('limit.near', `zip ${fmtMB(zipBytes)} · 한도 ${fmtMB(maxZipBytes)}에 가깝습니다.`);
328
+ for (const issue of screenSizeIssues(screenSizes(files), spec)) add(issue.id, issue.message, issue.path);
262
329
  // 경로 · 파일 종류
263
330
  const byLower = new Map();
264
331
  for (const f of files) {
@@ -344,6 +411,8 @@ function checkFiles(input, opts = {}) {
344
411
  const kindOf = textKind(f.path);
345
412
  if (!kindOf || matchExclude(f.path, spec.excluded.dev)) continue;
346
413
  const text = decoder.decode(f.data);
414
+ // ecdk build가 나중에 받는 파일로 낸 묶음(npm 라이브러리 포함)은 HTML 안 묶음처럼 원본으로 이미 검사했다
415
+ if (kindOf === 'js' && isLazyBundleFile(text)) continue;
347
416
  const tags = kindOf === 'html' ? parseTags(text) : [];
348
417
  const vendor = isVendorFile(f.path);
349
418
  // ecdk build가 묶은 모듈 본문(npm 라이브러리 포함)은 원본으로 이미 검사했다 (줄 번호는 그대로)
@@ -2,6 +2,7 @@ export { checkFiles } from './check.js';
2
2
  export { allowedOrigins, CONTENT_CSP, contentCsp, type CspValues, isAllowedExternal, } from './csp.js';
3
3
  export { COMPLETION_POLICIES_IGNORED, graderTypeError, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, type ManifestWarning, parseManifest, serializeManifest, stripCompletionPolicy, } from './manifest.js';
4
4
  export { globToRegExp } from './path.js';
5
+ export { isLazyBundleFile, LAZY_FILE_MARK, type ScreenSize, screenSizeIssues, screenSizes, } from './size.js';
5
6
  export { commentOnlyLines, lineSkipper } from './skip.js';
6
7
  export { rules, RULES_VERSION } from './spec.js';
7
8
  export { findUnreferenced } from './unused.js';
package/es/rules/index.js CHANGED
@@ -2,6 +2,7 @@ export { checkFiles } from './check.js';
2
2
  export { CONTENT_CSP, allowedOrigins, contentCsp, isAllowedExternal } from './csp.js';
3
3
  export { COMPLETION_POLICIES_IGNORED, LEGACY_COMPLETION_FIELDS, LEGACY_COMPLETION_SCREENS, graderTypeError, parseManifest, serializeManifest, stripCompletionPolicy } from './manifest.js';
4
4
  export { globToRegExp } from './path.js';
5
+ export { LAZY_FILE_MARK, isLazyBundleFile, screenSizeIssues, screenSizes } from './size.js';
5
6
  export { commentOnlyLines, lineSkipper } from './skip.js';
6
7
  export { RULES_VERSION, rules } from './spec.js';
7
8
  export { findUnreferenced } from './unused.js';
@@ -0,0 +1,31 @@
1
+ import type { ContentFile } from './types.js';
2
+ /**
3
+ * ecdk build가 나중에 받는 파일(동적 import()로만 닿는 chunk)로 낸 일반 스크립트의 첫 글자.
4
+ * 검사는 HTML 안 묶음(`data-ecdk-bundle`)처럼 이 파일 본문을 건너뛴다 (원본으로 이미 검사함)
5
+ */
6
+ export declare const LAZY_FILE_MARK = "/*ecdk-lazy*/";
7
+ /** ecdk build가 나중에 받는 파일로 낸 스크립트인지 */
8
+ export declare function isLazyBundleFile(text: string): boolean;
9
+ /** 화면(HTML) 하나를 열 때 받는 JS · CSS 크기 (바이트) */
10
+ export interface ScreenSize {
11
+ page: string;
12
+ /** HTML 안 `<script>` 본문 + `<script src>`로 받는 zip 안 파일 */
13
+ scriptBytes: number;
14
+ /** HTML 안 `<style>` 본문 + `<link rel="stylesheet">`로 받는 zip 안 파일 */
15
+ styleBytes: number;
16
+ }
17
+ /**
18
+ * HTML마다 열 때 받는 JS · CSS. 나중에 받는 파일(import()로 부를 때 받음)은 넣지 않는다.
19
+ * 같은 파일을 여러 번 가리켜도 한 번만 센다
20
+ */
21
+ export declare function screenSizes(files: ContentFile[]): ScreenSize[];
22
+ /** 화면을 열 때 받는 JS · CSS가 rules.json `limits.maxScreenBytes`를 넘으면 limit.screen-size 경고 */
23
+ export declare function screenSizeIssues(sizes: ScreenSize[], spec: {
24
+ limits: {
25
+ maxScreenBytes: number;
26
+ };
27
+ }): {
28
+ id: 'limit.screen-size';
29
+ message: string;
30
+ path: string;
31
+ }[];
@@ -0,0 +1,58 @@
1
+ import { resolveRef } from './path.js';
2
+ import { parseTags, classifyRef } from './refs.js';
3
+
4
+ /**
5
+ * ecdk build가 나중에 받는 파일(동적 import()로만 닿는 chunk)로 낸 일반 스크립트의 첫 글자.
6
+ * 검사는 HTML 안 묶음(`data-ecdk-bundle`)처럼 이 파일 본문을 건너뛴다 (원본으로 이미 검사함)
7
+ */
8
+ const LAZY_FILE_MARK = '/*ecdk-lazy*/';
9
+ /** ecdk build가 나중에 받는 파일로 낸 스크립트인지 */
10
+ function isLazyBundleFile(text) {
11
+ return text.startsWith(LAZY_FILE_MARK);
12
+ }
13
+ const BODY = tag => new RegExp(`<${tag}\\b[^>]*>([\\s\\S]*?)<\\/${tag}\\s*>`, 'gi');
14
+ const byteLength = text => new TextEncoder().encode(text).byteLength;
15
+ /**
16
+ * HTML마다 열 때 받는 JS · CSS. 나중에 받는 파일(import()로 부를 때 받음)은 넣지 않는다.
17
+ * 같은 파일을 여러 번 가리켜도 한 번만 센다
18
+ */
19
+ function screenSizes(files) {
20
+ const decoder = new TextDecoder();
21
+ const byPath = new Map(files.filter(f => !f.dir).map(f => [f.path, f]));
22
+ const sizes = [];
23
+ for (const f of files) {
24
+ if (f.dir || !/\.html?$/i.test(f.path)) continue;
25
+ const html = decoder.decode(f.data);
26
+ const inline = tag => [...html.replace(/<!--[\s\S]*?-->/g, '').matchAll(BODY(tag))].reduce((n, m) => n + byteLength(m[1] ?? ''), 0);
27
+ const linked = {
28
+ script: new Set(),
29
+ style: new Set()
30
+ };
31
+ for (const t of parseTags(html)) {
32
+ const ref = t.name === 'script' ? t.attrs.get('src') : t.name === 'link' && /\bstylesheet\b/i.test(t.attrs.get('rel') ?? '') ? t.attrs.get('href') : undefined;
33
+ if (!ref || classifyRef(ref.trim()) !== 'local') continue;
34
+ const path = resolveRef(f.path, ref.trim().replace(/[?#].*$/, ''));
35
+ if (path !== null && byPath.has(path)) linked[t.name === 'script' ? 'script' : 'style'].add(path);
36
+ }
37
+ const sum = paths => [...paths].reduce((n, p) => n + (byPath.get(p)?.data.byteLength ?? 0), 0);
38
+ sizes.push({
39
+ page: f.path,
40
+ scriptBytes: inline('script') + sum(linked.script),
41
+ styleBytes: inline('style') + sum(linked.style)
42
+ });
43
+ }
44
+ return sizes;
45
+ }
46
+ const MB = 1024 * 1024;
47
+ const fmt = n => n >= MB ? `${(n / MB).toFixed(1)}MB` : `${(n / 1024).toFixed(1)}KB`;
48
+ /** 화면을 열 때 받는 JS · CSS가 rules.json `limits.maxScreenBytes`를 넘으면 limit.screen-size 경고 */
49
+ function screenSizeIssues(sizes, spec) {
50
+ const max = spec.limits.maxScreenBytes;
51
+ return sizes.filter(s => s.scriptBytes + s.styleBytes > max).map(s => ({
52
+ id: 'limit.screen-size',
53
+ path: s.page,
54
+ message: `${s.page}를 열 때 받는 JS · CSS가 ${fmt(s.scriptBytes + s.styleBytes)}입니다 (JS ${fmt(s.scriptBytes)} · CSS ${fmt(s.styleBytes)}, 기준 ${fmt(max)}). 학생 화면이 늦게 열립니다. 큰 라이브러리는 쓸 때 import()로 부르면 ecdk build가 나중에 받는 파일로 따로 냅니다. 쓰지 않는 라이브러리 · 편집 화면에만 쓰는 코드는 이 화면에서 빼 주세요.`
55
+ }));
56
+ }
57
+
58
+ export { LAZY_FILE_MARK, isLazyBundleFile, screenSizeIssues, screenSizes };
@@ -41,6 +41,8 @@ export interface RulesSpec {
41
41
  maxEntries: number;
42
42
  warnRatio: number;
43
43
  maxImageBytes: number;
44
+ /** 화면(HTML) 하나를 열 때 받는 JS · CSS 합계. 넘으면 limit.screen-size 경고 */
45
+ maxScreenBytes: number;
44
46
  };
45
47
  allowedExtensions: string[];
46
48
  imageExtensions: string[];
@@ -63,6 +65,11 @@ export interface RulesSpec {
63
65
  minVersions: {
64
66
  sdk: string;
65
67
  };
68
+ /** 키트 레이아웃 값 (lib/elice-content.css "레이아웃" 절과 같게). 다른 값은 layout.unknown */
69
+ layouts: {
70
+ content: string[];
71
+ regions: string[];
72
+ };
66
73
  /**
67
74
  * 콘텐츠 CSP가 허용하는 외부 출처 (지시어 → 출처 목록, 서버 CSP 허용 목록과 같게 유지). 검사는 여기 있는 출처를
68
75
  * 오류(ref.external-request) 대신 경고(ref.external-font)로, `ecdk dev`는 CSP 해당 지시어에 더한다 (csp.ts)
@@ -126,6 +133,11 @@ export interface CheckOptions {
126
133
  * (build.template-unknown). 없으면(서버 · 라이브러리 사용) 보지 않는다
127
134
  */
128
135
  templates?: Record<string, string> | undefined;
136
+ /**
137
+ * 프로젝트 검사일 때: 편집 화면(ecdk dev 내용 편집)이 저장한 정답 글 (.ecdk/settings.json grading, answerNeedles).
138
+ * 화면 코드 · JSON · 학습 참고 내용에 같은 글이 있으면 sec.answer-in-bundle 경고. 값은 메시지에 싣지 않는다
139
+ */
140
+ answerNeedles?: string[] | undefined;
129
141
  }
130
142
  /** metadata.json의 build: 어떤 도구·규칙으로 만들었는지. 서버가 "오래된 규칙" 같은 안내에 쓴다 */
131
143
  export interface BuildInfo {
package/es/rules.json.js CHANGED
@@ -1,3 +1,3 @@
1
- const version="0.12.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","rubric"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[]};const minVersions={sdk:"1.0.0-alpha.4"};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"새 창 열기 (sandbox에서 막힘)"},{id:"api.external-send",pattern:"\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기는 통과)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"새 창 열기"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
1
+ const version="0.18.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","partial_pattern","rubric"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[]};const minVersions={sdk:"1.0.0-alpha.4"};const layouts={content:["single","split","stage","media"],regions:["main","aside","stage","controls","readout","actions"]};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576,maxScreenBytes:1572864};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"새 창 열기 (sandbox에서 막힘)"},{id:"api.external-send",pattern:"(?<!\\bmlapi\\??\\.)\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"(?<!\\bmlapi\\??\\.)\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"limit.screen-size",level:"warn",scope:"client",title:"화면 하나를 열 때 받는 JS · CSS가 큼 (기준 limits.maxScreenBytes, 큰 라이브러리는 import()로)"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"layout.unknown",level:"warn",scope:"client",title:"data-ec-layout · data-ec-region에 키트가 모르는 값 (single · split · stage · media, main · aside · stage · controls · readout · actions)"},{id:"layout.own-step-nav",level:"warn",scope:"client",title:"화면 코드가 이전 · 다음 버튼을 직접 그림 (LXP 이전 · 다음 막대와 헷갈림, 키트 app.useStepper)"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기는 통과)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"새 창 열기"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.answer-in-bundle",level:"warn",scope:"client",title:"편집 화면에 저장한 정답(.ecdk/settings.json 채점 설정)과 같은 글이 zip에 들어갈 파일에 있음 (프로젝트 검사만)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,layouts:layouts,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
2
2
 
3
- export { allowedExtensions, rulesJson as default, excluded, externalAllow, forbiddenApis, imageExtensions, limits, manifest, minVersions, rules, secretPatterns, version };
3
+ export { allowedExtensions, rulesJson as default, excluded, externalAllow, forbiddenApis, imageExtensions, layouts, limits, manifest, minVersions, rules, secretPatterns, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliceio/cdk-cli",
3
- "version": "1.2.1",
3
+ "version": "1.3.0-contenttypes.1",
4
4
  "description": "교육자용 Custom HTML 콘텐츠 CLI",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "rollup": "^4.0.0",
47
47
  "tslib": "^2.6.1",
48
48
  "typescript": "~5.9.3",
49
- "@eliceio/cdk": "^1.2.1"
49
+ "@eliceio/cdk": "^1.3.0-contenttypes.1"
50
50
  },
51
51
  "scripts": {
52
52
  "prebuild": "del-cli \"buildcache/*\" \"es/*\"",