@eliceio/cdk-cli 0.1.0-alpha.4 → 0.1.0-alpha.6

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 (107) hide show
  1. package/README.md +215 -152
  2. package/es/cli.js +65 -66
  3. package/es/commands/build/index.d.ts +1 -1
  4. package/es/commands/build/index.js +20 -7
  5. package/es/commands/create/index.d.ts +1 -1
  6. package/es/commands/create/index.js +5 -9
  7. package/es/commands/dev/index.d.ts +1 -1
  8. package/es/commands/dev/index.js +5 -5
  9. package/es/commands/doctor/index.d.ts +18 -1
  10. package/es/commands/doctor/index.js +137 -27
  11. package/es/commands/mcp/index.d.ts +0 -12
  12. package/es/commands/mcp/index.js +6 -57
  13. package/es/commands/setup/index.d.ts +11 -3
  14. package/es/commands/setup/index.js +112 -37
  15. package/es/commands/skill/index.d.ts +46 -8
  16. package/es/commands/skill/index.js +151 -35
  17. package/es/commands/uninstall/index.d.ts +54 -0
  18. package/es/commands/uninstall/index.js +304 -0
  19. package/es/commands/update/index.d.ts +59 -0
  20. package/es/commands/update/index.js +251 -0
  21. package/es/commands/{check → validate}/index.d.ts +1 -1
  22. package/es/commands/{check → validate}/index.js +1 -1
  23. package/es/core/collect.js +1 -1
  24. package/es/core/config.d.ts +20 -37
  25. package/es/core/config.js +36 -89
  26. package/es/core/latest.d.ts +21 -0
  27. package/es/core/latest.js +43 -0
  28. package/es/core/prepare.js +4 -3
  29. package/es/core/project-check.d.ts +2 -2
  30. package/es/core/project-check.js +2 -2
  31. package/es/core/sandbox.js +6 -3
  32. package/es/core/templates.d.ts +1 -3
  33. package/es/core/templates.js +1 -4
  34. package/es/dev/grading.d.ts +7 -8
  35. package/es/dev/grading.js +6 -16
  36. package/es/dev/host-page.d.ts +1 -1
  37. package/es/dev/host-page.js +29 -12
  38. package/es/dev/inject.d.ts +6 -0
  39. package/es/dev/inject.js +16 -1
  40. package/es/dev/mock-api.d.ts +8 -12
  41. package/es/dev/mock-api.js +50 -81
  42. package/es/dev/server.d.ts +4 -2
  43. package/es/dev/server.js +18 -29
  44. package/es/rules/check.js +80 -41
  45. package/es/rules/csp.d.ts +26 -0
  46. package/es/rules/csp.js +42 -0
  47. package/es/rules/index.d.ts +2 -1
  48. package/es/rules/index.js +2 -1
  49. package/es/rules/manifest.d.ts +28 -20
  50. package/es/rules/manifest.js +58 -55
  51. package/es/rules/refs.d.ts +12 -2
  52. package/es/rules/refs.js +50 -18
  53. package/es/rules/types.d.ts +6 -13
  54. package/es/rules.json.js +2 -2
  55. package/package.json +2 -3
  56. package/rules.json +48 -57
  57. package/skills/_shared/always.md +5 -4
  58. package/skills/elice-content-check/SKILL.md +10 -9
  59. package/skills/elice-content-create/SKILL.md +7 -7
  60. package/skills/elice-content-guide/SKILL.md +42 -0
  61. package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
  62. package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
  63. package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
  64. package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
  65. package/skills/elice-content-guide/topics/04-rules.md +14 -0
  66. package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
  67. package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
  68. package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
  69. package/skills/elice-content-guide/topics/08-fix-check-errors.md +27 -0
  70. package/skills/elice-content-guide/topics/09-check.md +11 -0
  71. package/skills/elice-content-guide/topics/10-build.md +8 -0
  72. package/skills/elice-content-guide/topics/11-more.md +4 -0
  73. package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
  74. package/skills/elice-content-migrate/SKILL.md +10 -8
  75. package/skills/elice-content-publish/SKILL.md +8 -8
  76. package/templates/_shared/lib/cdk-mock.d.ts +5 -13
  77. package/templates/_shared/lib/cdk-mock.js +41 -136
  78. package/templates/_shared/lib/elice-content.css +81 -1
  79. package/templates/_shared/lib/elice-content.d.ts +6 -37
  80. package/templates/_shared/lib/elice-content.js +23 -236
  81. package/templates/blank/README.md +5 -6
  82. package/templates/blank/metadata.json +1 -3
  83. package/templates/blank/package.json +2 -2
  84. package/templates/blank/screens/edit.js +1 -1
  85. package/templates/blank/template.json +2 -2
  86. package/templates/quiz/README.md +4 -4
  87. package/templates/quiz/core/behaviors.js +4 -1
  88. package/templates/quiz/core/editor.d.ts +11 -9
  89. package/templates/quiz/core/editor.js +32 -32
  90. package/templates/quiz/core/model.js +3 -3
  91. package/templates/quiz/metadata.json +1 -3
  92. package/templates/quiz/package.json +2 -2
  93. package/templates/quiz/screens/edit.js +121 -29
  94. package/templates/quiz/screens/learn.js +5 -2
  95. package/templates/quiz/styles.css +96 -37
  96. package/templates/quiz/template.json +2 -2
  97. package/templates/quiz/ui/templates/edit.d.ts +4 -0
  98. package/templates/quiz/ui/templates/edit.js +69 -19
  99. package/templates/quiz/ui/templates/group.js +10 -2
  100. package/templates/quiz/ui/templates/page.js +1 -2
  101. package/templates/quiz/ui/templates/text.js +10 -7
  102. package/templates/quiz/ui/texts.js +14 -12
  103. package/es/commands/guide/index.d.ts +0 -29
  104. package/es/commands/guide/index.js +0 -120
  105. package/guides/content-development.md +0 -302
  106. package/templates/blank/completion.html +0 -15
  107. package/templates/blank/screens/completion.js +0 -7
@@ -4,16 +4,26 @@ export interface Ref {
4
4
  value: string;
5
5
  line: number;
6
6
  role: RefRole;
7
+ /** 스타일시트로 불러옴 (`<link rel="stylesheet">` · CSS `@import`): CSP style-src 허용 목록과 비교 */
8
+ as?: 'style';
7
9
  }
8
10
  export interface HtmlTag {
9
11
  name: string;
10
12
  attrs: Map<string, string>;
11
13
  line: number;
12
14
  }
15
+ /** 다른 문서를 안에 띄우는 태그: 외부 주소는 html.iframe이 따로 알린다 (안 파일은 ref.missing만 봄) */
16
+ export declare const FRAME_TAGS: Set<string>;
13
17
  declare function lineAt(text: string, index: number): number;
14
18
  export declare function parseTags(html: string): HtmlTag[];
15
- /** HTML 태그 속성, CSS url()·@import, JS 정적·동적 import의 문자열 리터럴 참조. 스크립트가 만든 경로(fetch 등)는 못 잡는다. */
16
- export declare function extractRefs(kind: 'html' | 'css' | 'js', text: string, tags?: HtmlTag[]): Ref[];
19
+ /**
20
+ * HTML 태그 속성, CSS url()·@import, JS 정적·동적 import의 문자열 리터럴 참조, JS가 외부 리소스를 넣는 흔한 모양
21
+ * (JS_RESOURCE, 외부 주소만). 스크립트가 만든 경로(fetch 등)는 못 잡는다.
22
+ * `jsResources: false`: 라이브러리 파일은 외부 리소스 모양을 보지 않는다 (ref.vendor-external-url 경고가 맡음)
23
+ */
24
+ export declare function extractRefs(kind: 'html' | 'css' | 'js', text: string, tags?: HtmlTag[], { jsResources }?: {
25
+ jsResources?: boolean | undefined;
26
+ }): Ref[];
17
27
  export type RefKind = 'local' | 'root' | 'external' | 'skip';
18
28
  export declare function classifyRef(value: string): RefKind;
19
29
  export { lineAt };
package/es/rules/refs.js CHANGED
@@ -1,23 +1,41 @@
1
1
  const TAG = /<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g;
2
2
  const ATTR = /([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;
3
3
  const RAW_BLOCK = /<(script|style)\b[^>]*>([\s\S]*?)<\/\1\s*>/gi;
4
- const CSS_URL = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)'"\s]+))\s*\)|@import\s+(?:"([^"]*)"|'([^']*)')/g;
4
+ const CSS_URL = /(?<!@import\s*)url\(\s*(?:"([^"]*)"|'([^']*)'|([^)'"\s]+))\s*\)/g;
5
+ const CSS_IMPORT = /@import\s+(?:url\(\s*)?(?:"([^"]*)"|'([^']*)'|([^)'"\s;]+))/g;
6
+ /**
7
+ * JS가 외부 리소스를 불러오는 흔한 모양 (외부 주소만): `.src = 'https://…'` · `setAttribute('src', 'https://…')` ·
8
+ * `new Audio('https://…')` · 문자열 안 CSS `url(https://…)`. 이동 링크(`.href`)와 fetch(api.external-send)는 뺀다
9
+ */
10
+ const JS_RESOURCE = /(?:\.(?:src|poster)\s*=\s*|\bsetAttribute\(\s*['"](?:src|poster)['"]\s*,\s*|\bnew\s+Audio\(\s*)['"`]((?:https?:)?\/\/[^'"`\s]+)|\burl\(\s*['"]?((?:https?:)?\/\/[^'"`\s)]+)/g;
11
+ /** 다른 문서를 안에 띄우는 태그: 외부 주소는 html.iframe이 따로 알린다 (안 파일은 ref.missing만 봄) */
12
+ const FRAME_TAGS = new Set(['iframe', 'frame', 'object', 'embed']);
13
+ /** `<link rel>` 중 연결만 미리 여는 힌트 (리소스를 받지 않음) */
14
+ const CONNECTION_HINTS = new Set(['preconnect', 'dns-prefetch']);
5
15
  const JS_IMPORT = /\b(?:import|export)\b[^'"`;]*?\bfrom\s*(?:"([^"]*)"|'([^']*)')|\bimport\s+(?:"([^"]*)"|'([^']*)')|\bimport\s*\(\s*(?:"([^"]*)"|'([^']*)')\s*\)/g;
6
16
  function lineAt(text, index) {
7
17
  let n = 1;
8
18
  for (let i = 0; i < index; i++) if (text.charCodeAt(i) === 10) n++;
9
19
  return n;
10
20
  }
11
- function collect(text, re, role, out, lineBase = 0) {
21
+ function collect(text, re, role, out, lineBase = 0, as) {
12
22
  for (const m of text.matchAll(re)) {
13
23
  const raw = m.slice(1).find(g => g !== undefined);
14
24
  if (raw !== undefined) out.push({
15
25
  value: raw.trim(),
16
26
  line: lineAt(text, m.index) + lineBase,
17
- role
27
+ role,
28
+ ...(as ? {
29
+ as
30
+ } : {})
18
31
  });
19
32
  }
20
33
  }
34
+ /** CSS의 url() · @import */
35
+ function cssRefs(text, out, lineBase = 0) {
36
+ collect(text, CSS_URL, 'resource', out, lineBase);
37
+ collect(text, CSS_IMPORT, 'resource', out, lineBase, 'style');
38
+ }
21
39
  /** <script>·<style> 본문을 같은 줄 수의 빈 칸으로 바꾼다. 스크립트 안의 `a<b` 같은 글자를 태그로 읽지 않도록. */
22
40
  function blankRawBlocks(html) {
23
41
  return html.replace(RAW_BLOCK, (all, _tag, body) => all.replace(body, body.replace(/[^\n]/g, ' ')));
@@ -41,10 +59,13 @@ function parseTags(html) {
41
59
  const RESOURCE_ATTRS = ['src', 'poster', 'data'];
42
60
  function tagRefs(tags, out) {
43
61
  for (const t of tags) {
44
- const push = (value, role) => out.push({
62
+ const push = (value, role, as) => out.push({
45
63
  value: value.trim(),
46
64
  line: t.line,
47
- role
65
+ role,
66
+ ...(as ? {
67
+ as
68
+ } : {})
48
69
  });
49
70
  if (t.name === 'script') {
50
71
  const src = t.attrs.get('src');
@@ -55,12 +76,15 @@ function tagRefs(tags, out) {
55
76
  if (href !== undefined) {
56
77
  if (t.name === 'a' || t.name === 'area') push(href, 'link');else if (t.name === 'link') {
57
78
  const rel = t.attrs.get('rel') ?? '';
58
- push(href, /\bmodulepreload\b/i.test(rel) ? 'script' : 'resource');
79
+ const rels = rel.toLowerCase().split(/\s+/).filter(Boolean);
80
+ // 연결 힌트(preconnect · dns-prefetch)는 리소스를 받지 않는다: 참조로 보지 않음 (Google Fonts 스니펫 등)
81
+ if (rels.length > 0 && rels.every(r => CONNECTION_HINTS.has(r))) continue;
82
+ if (/\bmodulepreload\b/i.test(rel)) push(href, 'script');else push(href, 'resource', /\bstylesheet\b/i.test(rel) ? 'style' : undefined);
59
83
  }
60
84
  }
61
85
  for (const a of RESOURCE_ATTRS) {
62
86
  const v = t.attrs.get(a);
63
- if (v !== undefined) push(v, 'resource');
87
+ if (v !== undefined) push(v, FRAME_TAGS.has(t.name) ? 'link' : 'resource');
64
88
  }
65
89
  const srcset = t.attrs.get('srcset');
66
90
  if (srcset !== undefined) {
@@ -69,7 +93,7 @@ function tagRefs(tags, out) {
69
93
  const style = t.attrs.get('style');
70
94
  if (style !== undefined) {
71
95
  const inner = [];
72
- collect(style, CSS_URL, 'resource', inner);
96
+ cssRefs(style, inner);
73
97
  out.push(...inner.map(r => ({
74
98
  ...r,
75
99
  line: t.line
@@ -77,28 +101,36 @@ function tagRefs(tags, out) {
77
101
  }
78
102
  }
79
103
  }
80
- /** HTML 태그 속성, CSS url()·@import, JS 정적·동적 import의 문자열 리터럴 참조. 스크립트가 만든 경로(fetch 등)는 못 잡는다. */
81
- function extractRefs(kind, text, tags) {
104
+ /**
105
+ * HTML 태그 속성, CSS url()·@import, JS 정적·동적 import의 문자열 리터럴 참조, JS가 외부 리소스를 넣는 흔한 모양
106
+ * (JS_RESOURCE, 외부 주소만). 스크립트가 만든 경로(fetch 등)는 못 잡는다.
107
+ * `jsResources: false`: 라이브러리 파일은 외부 리소스 모양을 보지 않는다 (ref.vendor-external-url 경고가 맡음)
108
+ */
109
+ function extractRefs(kind, text, tags, {
110
+ jsResources = true
111
+ } = {}) {
82
112
  const out = [];
83
113
  if (kind === 'css') {
84
- collect(text, CSS_URL, 'resource', out);
114
+ cssRefs(text, out);
85
115
  return out;
86
116
  }
87
- if (kind === 'js') return jsRefs(text, 0);
117
+ if (kind === 'js') return jsRefs(text, 0, jsResources);
88
118
  tagRefs(tags ?? parseTags(text), out);
89
119
  for (const m of text.matchAll(RAW_BLOCK)) {
90
120
  const [all, tag, body] = m;
91
121
  if (body === undefined) continue;
92
122
  const base = lineAt(text, m.index + all.indexOf(body)) - 1;
93
- if (tag?.toLowerCase() === 'style') collect(body, CSS_URL, 'resource', out, base);else out.push(...jsRefs(body, base));
123
+ if (tag?.toLowerCase() === 'style') cssRefs(body, out, base);else out.push(...jsRefs(body, base, jsResources));
94
124
  }
95
125
  return out;
96
126
  }
97
127
  /** 상대경로와 외부 주소 import만. bare specifier('lodash')는 import map이 있을 수 있어 건너뜀 */
98
- function jsRefs(text, lineBase) {
99
- const out = [];
100
- collect(text, JS_IMPORT, 'script', out, lineBase);
101
- return out.filter(r => /^(?:\.{0,2}\/|https?:)/i.test(r.value));
128
+ function jsRefs(text, lineBase, resources = true) {
129
+ const imports = [];
130
+ collect(text, JS_IMPORT, 'script', imports, lineBase);
131
+ const out = imports.filter(r => /^(?:\.{0,2}\/|https?:)/i.test(r.value));
132
+ if (resources) collect(text, JS_RESOURCE, 'resource', out, lineBase);
133
+ return out;
102
134
  }
103
135
  function classifyRef(value) {
104
136
  if (value === '' || value.startsWith('#') || value.includes('{{') || value.includes('${')) return 'skip';
@@ -108,4 +140,4 @@ function classifyRef(value) {
108
140
  return 'local';
109
141
  }
110
142
 
111
- export { classifyRef, extractRefs, lineAt, parseTags };
143
+ export { FRAME_TAGS, classifyRef, extractRefs, lineAt, parseTags };
@@ -26,13 +26,7 @@ export interface RulesSpec {
26
26
  required: string[];
27
27
  /** 용도별로 지원할 수 있는 화면. 문제 설명은 학생 화면만 */
28
28
  kindModes: Record<string, string[]>;
29
- /**
30
- * metadata `completionPolicies`에 쓸 수 있는 완료 정책 (2026-11-11 결정 2). 서버는 그 첫 값으로 완료 정책을 정하고,
31
- * 완료 정책 화면 · SDK `saveCompletionPolicy`가 그 안에서 바꾼다.
32
- * on_access(열면 완료) · on_submit(제출하면 완료) · on_graded(채점해 통과하면 완료)
33
- */
34
- completionPolicies: string[];
35
- /** 채점 방식 (on_graded일 때만): `settings.grading.type`. code_exec는 이번 범위 밖 */
29
+ /** 채점 방식: `settings.grading.type`. code_exec는 이번 범위 밖. 완료 정책은 LXP 설정이라 여기 없다 (ADR 0012) */
36
30
  graderTypes: string[];
37
31
  /** 학습 참고 내용(commentary) 파일의 기본 이름 (zip 최상위, 일반 텍스트). metadata.json `commentary`가 가리킨다 */
38
32
  commentaryFile: string;
@@ -69,6 +63,11 @@ export interface RulesSpec {
69
63
  minVersions: {
70
64
  sdk: string;
71
65
  };
66
+ /**
67
+ * 콘텐츠 CSP가 허용하는 외부 출처 (지시어 → 출처 목록, 서버 CSP 허용 목록과 같게 유지). 검사는 여기 있는 출처를
68
+ * 오류(ref.external-request) 대신 경고(ref.external-font)로, `ecdk dev`는 CSP 해당 지시어에 더한다 (csp.ts)
69
+ */
70
+ externalAllow?: Partial<Record<'style-src' | 'font-src', string[]>>;
72
71
  }
73
72
  /**
74
73
  * 비밀 값 탐지 (`sec.secret`). 사내 SAST(semgrep p/secrets + security/semgrep custom)를 옮긴 것.
@@ -146,12 +145,6 @@ export interface Manifest {
146
145
  kind?: string | undefined;
147
146
  /** 켠 화면 → 진입 파일 (metadata.json `screens`에서 enabled: true인 것만) */
148
147
  entries: Record<string, string>;
149
- /**
150
- * 이 자료가 지원하는 완료 정책 (ADR 0009 2026-11-11 결정 2). 서버는 첫 값으로 완료 정책을 정한다.
151
- * 하나면 고정(퀴즈: ["on_graded"]), 여럿이면 완료 정책 화면(`screens.completionPolicy`)이 그 안에서 바꾼다.
152
- * 자료 본문은 필수(검사 규칙 manifest.completion-policies-missing), 문제 설명에는 넣지 않는다
153
- */
154
- completionPolicies?: string[] | undefined;
155
148
  /** 학습 참고 내용 파일 (zip 최상위 .txt). LXP "AI헬피 설정 → 학습 참고 내용"(lecture page `commentary`)으로 들어간다 */
156
149
  commentary?: string | undefined;
157
150
  /** ecdk build가 채움. 직접 만든 zip에는 없어도 됨 */
package/es/rules.json.js CHANGED
@@ -1,3 +1,3 @@
1
- const version="0.7.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit","completionPolicy"],required:["learn"],kindModes:{material:["learn","instructor","edit","completionPolicy"],description:["learn"]},completionPolicies:["on_access","on_submit","on_graded"],graderTypes:["pattern","rubric"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const minVersions={sdk:"1.0.0-alpha.3"};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:"쿠키 사용 (sandbox에서 예외가 남)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (sandbox에서 예외가 남, 입력값 저장은 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로 읽음 (LXP sandbox에서 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 (완료 정책은 completionPolicies · 완료 정책 화면, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-missing",level:"error",scope:"server",title:"자료 본문인데 completionPolicies(지원하는 완료 정책)가 없거나 비어 있음"},{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:"completion.no-submit",level:"warn",scope:"client",title:"제출 · 채점으로 완료하는데 화면 코드에 제출이 없음"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"completion.no-save",level:"warn",scope:"client",title:"완료 정책 화면인데 저장(useCompletion · saveCompletionPolicy)이 없음"},{id:"completion.no-screen",level:"warn",scope:"client",title:"완료 정책이 여럿인데 완료 정책 화면(completionPolicy)이 없어 첫 값만 쓰임"},{id:"completion.screen-unused",level:"warn",scope:"client",title:"완료 정책이 하나(고정)인데 완료 정책 화면(completionPolicy)이 켜져 있음"},{id:"completion.no-edit",level:"error",scope:"server",title:"채점(on_graded)으로 완료하는데 채점 방식 · 답을 정할 편집 화면이 없음"},{id:"completion.no-grading",level:"warn",scope:"client",title:"채점(on_graded)으로 완료하는데 편집 화면 코드가 채점 설정(getGrading · useGradingBlock)을 저장하지 않음"},{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:"warn",scope:"client",title:"외부 리소스 요청 (글꼴·이미지 등이 막힐 수 있음)"},{id:"ref.insecure",level:"warn",scope:"client",title:"http:// 외부 리소스 (https 페이지에서 막힘)"},{id:"sandbox.module-src",level:"error",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): LXP sandbox에서 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"error",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: LXP sandbox에서 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox에서 막힘, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"error",scope:"client",title:"쿠키 사용"},{id:"api.storage",level:"error",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, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"warn",scope:"client",title:"옛 lib/cdk.js 복사본 (package.json에 @eliceio/cdk가 없음, 프로젝트 검사만. SDK를 package.json 의존성으로 옮기기)"}];var rulesJson = {version:version,manifest:manifest,minVersions:minVersions,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
1
+ const version="0.11.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:"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:"warn",scope:"client",title:"옛 lib/cdk.js 복사본 (package.json에 @eliceio/cdk가 없음, 프로젝트 검사만. SDK를 package.json 의존성으로 옮기기)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
2
2
 
3
- export { allowedExtensions, rulesJson as default, excluded, forbiddenApis, imageExtensions, limits, manifest, minVersions, rules, secretPatterns, version };
3
+ export { allowedExtensions, rulesJson as default, excluded, externalAllow, forbiddenApis, imageExtensions, limits, manifest, minVersions, rules, secretPatterns, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliceio/cdk-cli",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.6",
4
4
  "description": "교육자용 Custom HTML 콘텐츠 CLI",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -15,7 +15,6 @@
15
15
  },
16
16
  "files": [
17
17
  "es",
18
- "guides",
19
18
  "rules.json",
20
19
  "skills",
21
20
  "templates"
@@ -41,7 +40,7 @@
41
40
  "rollup": "^4.0.0",
42
41
  "tslib": "^2.6.1",
43
42
  "typescript": "~5.9.3",
44
- "@eliceio/cdk": "^1.0.0-alpha.3"
43
+ "@eliceio/cdk": "^1.0.0-alpha.6"
45
44
  },
46
45
  "scripts": {
47
46
  "prebuild": "del-cli \"buildcache/*\" \"es/*\"",
package/rules.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
- "version": "0.7.0",
2
+ "version": "0.11.0",
3
3
  "manifest": {
4
4
  "file": "metadata.json",
5
5
  "kinds": ["material", "description"],
6
6
  "defaultKind": "material",
7
- "modes": ["learn", "instructor", "edit", "completionPolicy"],
7
+ "modes": ["learn", "instructor", "edit"],
8
8
  "required": ["learn"],
9
9
  "kindModes": {
10
- "material": ["learn", "instructor", "edit", "completionPolicy"],
10
+ "material": ["learn", "instructor", "edit"],
11
11
  "description": ["learn"]
12
12
  },
13
- "completionPolicies": ["on_access", "on_submit", "on_graded"],
14
13
  "graderTypes": ["pattern", "rubric"],
15
14
  "commentaryFile": "commentary.txt",
16
15
  "defaultEntry": "index.html"
17
16
  },
17
+ "externalAllow": {
18
+ "style-src": [],
19
+ "font-src": []
20
+ },
18
21
  "minVersions": {
19
- "sdk": "1.0.0-alpha.3"
22
+ "sdk": "1.0.0-alpha.4"
20
23
  },
21
24
  "limits": {
22
25
  "maxZipBytes": 20971520,
@@ -91,12 +94,12 @@
91
94
  {
92
95
  "id": "api.cookie",
93
96
  "pattern": "\\bdocument\\.cookie\\b",
94
- "title": "쿠키 사용 (sandbox에서 예외가 남)"
97
+ "title": "쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"
95
98
  },
96
99
  {
97
100
  "id": "api.storage",
98
101
  "pattern": "\\b(?:localStorage|sessionStorage|indexedDB)\\b",
99
- "title": "브라우저 저장소 사용 (sandbox에서 예외가 남, 입력값 저장은 SDK 사용)"
102
+ "title": "브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"
100
103
  },
101
104
  {
102
105
  "id": "api.eval",
@@ -136,7 +139,7 @@
136
139
  {
137
140
  "id": "sandbox.fetch-local",
138
141
  "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+.-]*:|//)",
139
- "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (LXP sandbox에서 CORS로 막힘)"
142
+ "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"
140
143
  }
141
144
  ],
142
145
  "secretPatterns": [
@@ -366,13 +369,13 @@
366
369
  "id": "manifest.grading-types",
367
370
  "level": "warn",
368
371
  "scope": "server",
369
- "title": "쓰지 않는 gradingTypes (완료 정책은 completionPolicies · 완료 정책 화면, 채점 방식은 편집 화면)"
372
+ "title": "쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"
370
373
  },
371
374
  {
372
- "id": "manifest.completion-policies-missing",
373
- "level": "error",
374
- "scope": "server",
375
- "title": "자료 본문인데 completionPolicies(지원하는 완료 정책)가 없거나 비어 있음"
375
+ "id": "manifest.completion-policies-ignored",
376
+ "level": "warn",
377
+ "scope": "client",
378
+ "title": "쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"
376
379
  },
377
380
  {
378
381
  "id": "entry.missing",
@@ -483,10 +486,10 @@
483
486
  "title": "학생에게 내려가는 JSON에 정답처럼 보이는 키"
484
487
  },
485
488
  {
486
- "id": "completion.no-submit",
489
+ "id": "grading.no-submit",
487
490
  "level": "warn",
488
491
  "scope": "client",
489
- "title": "제출 · 채점으로 완료하는데 화면 코드에 제출이 없음"
492
+ "title": "편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"
490
493
  },
491
494
  {
492
495
  "id": "edit.no-save",
@@ -494,36 +497,6 @@
494
497
  "scope": "client",
495
498
  "title": "편집 화면인데 저장이 없음"
496
499
  },
497
- {
498
- "id": "completion.no-save",
499
- "level": "warn",
500
- "scope": "client",
501
- "title": "완료 정책 화면인데 저장(useCompletion · saveCompletionPolicy)이 없음"
502
- },
503
- {
504
- "id": "completion.no-screen",
505
- "level": "warn",
506
- "scope": "client",
507
- "title": "완료 정책이 여럿인데 완료 정책 화면(completionPolicy)이 없어 첫 값만 쓰임"
508
- },
509
- {
510
- "id": "completion.screen-unused",
511
- "level": "warn",
512
- "scope": "client",
513
- "title": "완료 정책이 하나(고정)인데 완료 정책 화면(completionPolicy)이 켜져 있음"
514
- },
515
- {
516
- "id": "completion.no-edit",
517
- "level": "error",
518
- "scope": "server",
519
- "title": "채점(on_graded)으로 완료하는데 채점 방식 · 답을 정할 편집 화면이 없음"
520
- },
521
- {
522
- "id": "completion.no-grading",
523
- "level": "warn",
524
- "scope": "client",
525
- "title": "채점(on_graded)으로 완료하는데 편집 화면 코드가 채점 설정(getGrading · useGradingBlock)을 저장하지 않음"
526
- },
527
500
  {
528
501
  "id": "project.legacy-file",
529
502
  "level": "warn",
@@ -562,27 +535,39 @@
562
535
  },
563
536
  {
564
537
  "id": "ref.external-request",
538
+ "level": "error",
539
+ "scope": "client",
540
+ "title": "외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"
541
+ },
542
+ {
543
+ "id": "ref.external-font",
565
544
  "level": "warn",
566
545
  "scope": "client",
567
- "title": "외부 리소스 요청 (글꼴·이미지 등이 막힐 수 있음)"
546
+ "title": "허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"
568
547
  },
569
548
  {
570
549
  "id": "ref.insecure",
550
+ "level": "error",
551
+ "scope": "client",
552
+ "title": "http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"
553
+ },
554
+ {
555
+ "id": "ref.vendor-external-url",
571
556
  "level": "warn",
572
557
  "scope": "client",
573
- "title": "http:// 외부 리소스 (https 페이지에서 막힘)"
558
+ "title": "라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"
574
559
  },
575
560
  {
576
561
  "id": "sandbox.module-src",
577
- "level": "error",
562
+ "level": "warn",
578
563
  "scope": "client",
579
- "title": "모듈 스크립트 파일(<script type=\"module\" src>): LXP sandbox에서 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"
564
+ "title": "모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"
580
565
  },
581
566
  {
582
567
  "id": "sandbox.fetch-local",
583
- "level": "error",
568
+ "level": "warn",
584
569
  "scope": "client",
585
- "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음: LXP sandbox에서 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"
570
+ "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"
586
571
  },
587
572
  {
588
573
  "id": "html.img-alt",
@@ -590,11 +575,17 @@
590
575
  "scope": "client",
591
576
  "title": "대체 텍스트 없는 이미지"
592
577
  },
578
+ {
579
+ "id": "html.iframe",
580
+ "level": "error",
581
+ "scope": "client",
582
+ "title": "src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기는 통과)"
583
+ },
593
584
  {
594
585
  "id": "html.form",
595
586
  "level": "warn",
596
587
  "scope": "client",
597
- "title": "form 제출 (sandbox에서 막힘, 버튼 click으로 처리)"
588
+ "title": "form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"
598
589
  },
599
590
  {
600
591
  "id": "api.external-send",
@@ -610,15 +601,15 @@
610
601
  },
611
602
  {
612
603
  "id": "api.cookie",
613
- "level": "error",
604
+ "level": "warn",
614
605
  "scope": "client",
615
- "title": "쿠키 사용"
606
+ "title": "쿠키 사용 (학습 기록이 아님)"
616
607
  },
617
608
  {
618
609
  "id": "api.storage",
619
- "level": "error",
610
+ "level": "warn",
620
611
  "scope": "client",
621
- "title": "브라우저 저장소 사용"
612
+ "title": "브라우저 저장소 사용 (학습 기록이 아님)"
622
613
  },
623
614
  {
624
615
  "id": "api.eval",
@@ -666,7 +657,7 @@
666
657
  "id": "sdk.outdated",
667
658
  "level": "error",
668
659
  "scope": "client",
669
- "title": "SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk, npm update @eliceio/cdk)"
660
+ "title": "SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"
670
661
  },
671
662
  {
672
663
  "id": "sdk.lib-copy",
@@ -1,9 +1,10 @@
1
1
  ## Always
2
2
 
3
3
  - Never put correct answers in the content zip. The edit screen saves them to `settings.grading` (locally `.ecdk/settings.json` from `ecdk dev`).
4
- - The content runs in a sandboxed iframe on another origin: use the SDK (`app.useSubmit`, `app.useSave`) instead of storage, cookies, `alert`/`confirm`, new windows, the parent window or external requests.
4
+ - The content runs in a sandboxed iframe on its own origin: use the SDK (`app.useSubmit`, `app.useSave`) for anything that must be kept (storage and cookies stay only in that browser), and in-page UI instead of `alert`/`confirm`, new windows, the parent window or external requests.
5
+ - The content CSP blocks external images, fonts, video, CSS, `<iframe>` and external APIs: put everything in the zip (fonts as files or data URIs). If a library calls outside hosts while running, that is blocked too → check the `ecdk dev` log for "막힌 외부 요청".
5
6
  - If `ecdk`, `node` or `npm` is "command not found", the app started without the person's shell PATH (macOS desktop apps such as Helpy Code Desktop). Run each command through their login shell instead: `"$SHELL" -ilc 'ecdk build --json'` (use `zsh -ilc` when `$SHELL` is empty). With `--json`, read only the last JSON block of the output (a login shell may print other text first). If that also fails, ask the person how Node was installed.
6
- - Fix every `ecdk check` / `ecdk build` error before you report. Do not edit `lib/` (the screen kit). The SDK comes from npm through `package.json` (`npm update @eliceio/cdk`); `ecdk build` adds it to the zip as `lib/cdk.js`.
7
- - Ask the person before you settle correct answers, install anything globally, or upload or save to LXP (a saved version is visible to learners at once).
8
- - LXP draws its own 이전 · 다음 bar under the material to move between lecture pages. For steps inside a material use the kit's `app.usePaging` (side chevrons, `n / N`; on the first and last step they become "이전 자료" · "다음 자료" to the previous / next lecture page, `ecdk guide 2`), never a look-alike bottom 이전 · 다음 bar.
7
+ - Fix every `ecdk validate` / `ecdk build` error before you report. Do not edit `lib/` (the screen kit). The SDK comes from npm through `package.json` (`npm update @eliceio/cdk`); `ecdk build` adds it to the zip as `lib/cdk.js`.
8
+ - Ask the person before you settle correct answers, install anything globally, or upload or save to LXP (a saved version is visible to learners at once). Before uploading, confirm the exact target page (기관 · 과목 · 수업 · 페이지) with the person.
9
+ - LXP draws its own 이전 · 다음 bar under the material to move between lecture pages. For steps inside a material use the kit's `app.usePaging` (side chevrons, `n / N`; on the first and last step they become "이전 자료" · "다음 자료" to the previous / next lecture page, `../elice-content-guide/topics/02-design-the-material.md`), never a look-alike bottom 이전 · 다음 bar.
9
10
  - Answer the person in their language. The guide is in English.
@@ -1,24 +1,25 @@
1
1
  ---
2
2
  name: elice-content-check
3
- description: Find and fix problems in an Elice Custom HTML learning material - ecdk check or ecdk build errors, blocked browser APIs, missing or wrongly cased files, a zip that LXP rejects, or a material that stays on "Loading" or shows nothing in LXP. Use when the person reports an error with an Elice or LXP material or with ecdk.
3
+ description: Find and fix problems in an Elice Custom HTML learning material - ecdk validate or ecdk build errors, blocked browser APIs, missing or wrongly cased files, a zip that LXP rejects, or a material that stays on "Loading" or shows nothing in LXP. Use when the person reports an error with an Elice or LXP material or with ecdk.
4
4
  ---
5
5
 
6
6
  # Fix an Elice learning material
7
7
 
8
- The full guide ships with the CLI: `ecdk guide 8` (fix check errors), `ecdk guide 4` (rules), `ecdk guide 9` (check).
8
+ Read guide topics with the Read tool from the sibling `elice-content-guide` skill folder (same parent folder as this skill), e.g. `../elice-content-guide/topics/05-screen-code.md`; its `SKILL.md` lists every topic. If that folder is missing, ask the person to run `ecdk setup --only skills` (it installs all five skills together; when these skills are in a project's `.claude/skills/`, run `ecdk setup --only skills --project` in that project folder instead), then continue. Topics for this skill: `../elice-content-guide/topics/08-fix-check-errors.md`, `../elice-content-guide/topics/04-rules.md`, `../elice-content-guide/topics/09-check.md`.
9
9
 
10
10
  {{always}}
11
11
 
12
12
  ## Steps
13
13
 
14
- 1. **Reproduce with the CLI.** In the project, `ecdk doctor --json` and `ecdk check --json`. For a zip someone made, `ecdk check <file>.zip --json`. Each issue has an id, a file and a line.
15
- 2. **Fix by the guide.** Look the id up in `ecdk guide 8`. Fix the cause in the source, not in `dist/`. Do not silence a rule with an `ecdk-ignore` comment unless the guide says so.
14
+ 1. **Reproduce with the CLI.** In the project, `ecdk doctor --json` and `ecdk validate --json`. For a zip someone made, `ecdk validate <file>.zip --json`. Each issue has an id, a file and a line.
15
+ 2. **Fix by the guide.** Look the id up in `../elice-content-guide/topics/08-fix-check-errors.md`. Fix the cause in the source, not in `dist/`. Do not silence a rule with an `ecdk-ignore` comment unless the guide says so.
16
16
  3. **Problems that show only in LXP.**
17
- - Stays on "Loading" or shows nothing: rebuild with the current `ecdk build` (it adapts the pages to the LXP sandbox) and check the built zip with `ecdk check dist/content.zip`. Ask the person for the browser console error.
18
- - Upload rejected: check `ecdk check dist/content.zip`; a material needs `commentary.txt` and every file named in `metadata.json`.
17
+ - Stays on "Loading" or shows nothing: rebuild with the current `ecdk build` (it adapts the pages to the LXP sandbox) and check the built zip with `ecdk validate dist/content.zip`. Ask the person for the browser console error.
18
+ - Upload rejected: check `ecdk validate dist/content.zip`; a material needs `commentary.txt` and every file named in `metadata.json`.
19
19
  - Screens show "아직 내용이 없습니다": nothing is saved yet; create the content in the edit screen (there is no default content file). `project.legacy-file`: an old `content.json` · `grading.json`; re-enter it in the edit screen and delete the file. An old `elice.config.json`, or `sdk.lib-copy` (an old `lib/cdk.js` copy): `ecdk doctor --fix`, then `npm install`.
20
- - Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `.ecdk/settings.json`) and `completionPolicies` (its first value is the default; the completion policy view writes `.ecdk/completion.json`) and that the submitted answer string matches the regex (`ecdk guide 2`, `ecdk guide 6`).
21
- - `@eliceio/cdk 패키지를 찾지 못했습니다` or doctor `project.deps` fails: run `npm install` in the project. `sdk.outdated`: `npm update @eliceio/cdk` (on an old `lib/cdk.js` copy: `ecdk doctor --fix && npm install`), then build again.
22
- 4. **Confirm.** `ecdk check` has no errors, `ecdk dev` works, and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
20
+ - Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `.ecdk/settings.json`) and that the submitted answer string matches the regex (`../elice-content-guide/topics/02-design-the-material.md`, `../elice-content-guide/topics/06-using-the-quiz-template.md`). In `ecdk dev` a submission is graded only when grading is saved; otherwise it is only accepted. Completing at the wrong time is the completion policy: 완료 정책은 LXP에 올린 뒤 설정 탭에서 교육자가 고른다 (not in the project; an old `completionPolicies` in `metadata.json` is ignored with `manifest.completion-policies-ignored`).
21
+ - doctor `cli.latest` warns: a newer ecdk is out and fixes may depend on it. Tell the person and, after they agree, run `ecdk update` (it installs the CLI globally, refreshes the skills and runs `npm update @eliceio/cdk` in a project); afterwards relay its closing note (Claude Code picks up changed skills in open sessions; `/reload-skills` only when it says the skills folder was just created; Helpy Code desktop needs a restart).
22
+ - `@eliceio/cdk 패키지를 찾지 못했습니다` or doctor `project.deps` fails: run `npm install` in the project. `sdk.outdated` (SDK 1.0.0-alpha.3 or older: saving in the LXP edit screen - draft save - fails): `npm update @eliceio/cdk` (on an old `lib/cdk.js` copy: `ecdk doctor --fix && npm install`), then build again.
23
+ 4. **Confirm.** `ecdk validate` has no errors, `ecdk dev` works, and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
23
24
 
24
25
  {{version}}