@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.4
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.
- package/README.md +196 -144
- package/es/cli.js +6 -1
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +11 -12
- package/es/commands/check/index.d.ts +5 -2
- package/es/commands/check/index.js +15 -9
- package/es/commands/create/index.d.ts +4 -0
- package/es/commands/create/index.js +30 -7
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +4 -1
- package/es/commands/create/scaffold.js +19 -13
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +4 -4
- package/es/commands/doctor/index.d.ts +11 -1
- package/es/commands/doctor/index.js +124 -36
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +95 -29
- package/es/core/config.js +253 -47
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +46 -15
- package/es/core/project-check.d.ts +18 -7
- package/es/core/project-check.js +35 -8
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +3 -3
- package/es/core/templates.js +4 -4
- package/es/dev/grading.d.ts +1 -1
- package/es/dev/grading.js +1 -1
- package/es/dev/host-page.js +2 -2
- package/es/dev/mock-api.d.ts +7 -8
- package/es/dev/mock-api.js +18 -13
- package/es/dev/server.js +62 -43
- package/es/rules/check.js +45 -9
- package/es/rules/manifest.d.ts +1 -1
- package/es/rules/manifest.js +1 -1
- package/es/rules/types.d.ts +18 -8
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/guides/content-development.md +63 -55
- package/package.json +2 -2
- package/rules.json +18 -3
- package/skills/_shared/always.md +2 -2
- package/skills/elice-content-check/SKILL.md +3 -1
- package/skills/elice-content-create/SKILL.md +5 -4
- package/skills/elice-content-migrate/SKILL.md +2 -2
- package/skills/elice-content-publish/SKILL.md +4 -3
- package/templates/_shared/lib/cdk-mock.js +17 -17
- package/templates/_shared/lib/elice-content.css +8 -0
- package/templates/_shared/lib/elice-content.d.ts +5 -1
- package/templates/_shared/lib/elice-content.js +20 -12
- package/templates/blank/README.md +11 -8
- package/templates/blank/metadata.json +11 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/completion.js +2 -2
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/quiz/README.md +14 -11
- package/templates/quiz/core/editor.d.ts +12 -1
- package/templates/quiz/core/editor.js +28 -5
- package/templates/quiz/core/model.d.ts +14 -0
- package/templates/quiz/core/model.js +73 -1
- package/templates/quiz/metadata.json +11 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +85 -29
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +42 -36
- package/templates/quiz/styles.css +47 -0
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +37 -5
- package/templates/quiz/ui/texts.js +9 -7
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -10
- package/templates/quiz/content.json +0 -35
- package/templates/quiz/elice.config.json +0 -9
- package/templates/quiz/grading.json +0 -4
package/es/rules/check.js
CHANGED
|
@@ -86,7 +86,7 @@ function checkTemplate(manifest, opts, add) {
|
|
|
86
86
|
const version = at > 0 ? ref.slice(at + 1) : undefined;
|
|
87
87
|
const known = opts.templates[name];
|
|
88
88
|
if (known === undefined) {
|
|
89
|
-
add(`이 ecdk가 모르는 템플릿입니다: ${ref} (아는 템플릿: ${Object.entries(opts.templates).map(([n, v]) => `${n}@${v}`).join(', ')}). ecdk를 올리거나(npm i -g @eliceio/cdk-cli)
|
|
89
|
+
add(`이 ecdk가 모르는 템플릿입니다: ${ref} (아는 템플릿: ${Object.entries(opts.templates).map(([n, v]) => `${n}@${v}`).join(', ')}). ecdk를 올리거나(npm i -g @eliceio/cdk-cli) package.json "ecdk"의 template을 확인해 주세요.`);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
if (version !== undefined && (compareVersions(version, known) ?? 0) > 0) add(`${ref}은 이 ecdk가 가진 ${name}@${known}보다 새 템플릿 버전입니다. 검사 · 가이드가 새 템플릿의 변경을 모를 수 있으니 ecdk를 올려 주세요.`);
|
|
@@ -94,13 +94,13 @@ function checkTemplate(manifest, opts, add) {
|
|
|
94
94
|
/**
|
|
95
95
|
* 완료 정책 · 채점 설정 (ADR 0009 2026-11-11 결정 2). 자료 본문은 completionPolicies가 필수(서버가 첫 값으로 완료 정책을
|
|
96
96
|
* 정함)이고, 그 안에 채점해 완료(on_graded)가 있으면 채점 방식 · 답을 정할 편집 화면이 있어야 한다 (운영에서
|
|
97
|
-
* settings.grading은 편집 화면만 저장). 여럿이면 완료 정책 화면이 있어야 고를 수 있다.
|
|
97
|
+
* settings.grading은 편집 화면만 저장). 여럿이면 완료 정책 화면이 있어야 고를 수 있다.
|
|
98
98
|
*/
|
|
99
|
-
function checkCompletion(manifest, spec,
|
|
99
|
+
function checkCompletion(manifest, spec, add) {
|
|
100
100
|
if ((manifest.kind ?? spec.manifest.defaultKind) === 'description') return;
|
|
101
101
|
const policies = manifest.completionPolicies ?? [];
|
|
102
102
|
if (policies.length === 0) {
|
|
103
|
-
add('manifest.completion-policies-missing', `${spec.manifest.file}에 completionPolicies(이 자료가 지원하는 완료 정책)가 ${manifest.completionPolicies ? '비어 있습니다' : '없습니다'}. 서버가 첫 값으로 완료 정책을 정하므로 자료 본문에는 꼭 적습니다. ${COMPLETION_POLICIES_EXAMPLE}. ecdk 프로젝트는
|
|
103
|
+
add('manifest.completion-policies-missing', `${spec.manifest.file}에 completionPolicies(이 자료가 지원하는 완료 정책)가 ${manifest.completionPolicies ? '비어 있습니다' : '없습니다'}. 서버가 첫 값으로 완료 정책을 정하므로 자료 본문에는 꼭 적습니다. ${COMPLETION_POLICIES_EXAMPLE}. ecdk 프로젝트는 원본의 metadata.json에 적습니다.`, spec.manifest.file);
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
const screen = manifest.entries.completionPolicy;
|
|
@@ -108,7 +108,41 @@ function checkCompletion(manifest, spec, opts, add) {
|
|
|
108
108
|
if (policies.length === 1 && screen) add('completion.screen-unused', `completionPolicies가 ${policies[0]} 하나(고정)인데 완료 정책 화면(${screen})이 켜져 있습니다. 고를 것이 없으니 화면을 끄거나 고를 정책을 더 적어 주세요.`, spec.manifest.file);
|
|
109
109
|
if (!policies.includes('on_graded')) return;
|
|
110
110
|
if (!manifest.entries.edit) add('completion.no-edit', `completionPolicies에 채점해 완료(on_graded)가 있는데 편집 화면이 없습니다. 채점 방식 · 답(settings.grading)은 편집 화면만 저장할 수 있어, 이대로면 LXP에서 정답을 정할 곳이 없습니다 (서버는 채점 설정 없는 on_graded를 MATERIAL_GRADING_REQUIRED로 거절). 편집 화면(screens.edit)을 켜거나 on_graded를 빼 주세요.`, spec.manifest.file);
|
|
111
|
-
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* 프로젝트에 남은 옛 파일 (ADR 0011, 프로젝트 검사만). 옮기는 법을 알려 준다. 내용 · 정답은 옮기지 않고
|
|
114
|
+
* 편집 화면에서 다시 넣는다
|
|
115
|
+
*/
|
|
116
|
+
const LEGACY_FILE_MESSAGES = {
|
|
117
|
+
'elice.config.json': 'elice.config.json은 더 쓰지 않습니다 (ADR 0011). 화면 · 완료 정책 · 학습 참고 내용(kind · screens · completionPolicies · commentary)은 원본의 metadata.json에, 빌드 옵션 · template은 package.json "ecdk"에 둡니다. ecdk doctor --fix가 옮기고 elice.config.json을 지웁니다 (옮기기 전까지는 지금처럼 빌드됨).',
|
|
118
|
+
'content.json': 'content.json은 더 쓰지 않습니다 (기본 내용 파일 없음, ADR 0011). 화면은 편집 화면이 저장한 내용만 읽고, 저장하기 전에는 "아직 내용이 없습니다" 안내를 보입니다. 그 내용은 LXP에 올린 뒤 편집 화면에서 다시 넣고 파일을 지워 주세요. 화면 코드가 직접 fetch하는 데이터 파일이면 다른 이름(예: data.json)으로 바꿔 주세요.',
|
|
119
|
+
'grading.json': "grading.json은 더 쓰지 않습니다 (ADR 0011). 채점 방식 · 답은 LXP에 올린 뒤 편집 화면에서 정합니다 (ecdk dev의 '내용 편집'에 넣은 답은 로컬 견본, .ecdk/settings.json). 파일은 지워 주세요 (zip에는 들어가지 않음)."
|
|
120
|
+
};
|
|
121
|
+
function checkLegacyFiles(opts, add) {
|
|
122
|
+
for (const path of opts.legacyFiles ?? []) {
|
|
123
|
+
const name = path.split('/').pop() ?? path;
|
|
124
|
+
add(LEGACY_FILE_MESSAGES[name] ?? `${path}은 더 쓰지 않는 파일입니다 (ADR 0011).`, path);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** SDK를 올리는 명령 (ADR 0010) */
|
|
128
|
+
const SDK_UPDATE_COMMAND = 'npm update @eliceio/cdk';
|
|
129
|
+
/**
|
|
130
|
+
* SDK 버전 (ADR 0010). metadata.json build.sdk가 rules.json minVersions.sdk보다 낮으면 오류:
|
|
131
|
+
* LXP 프로토콜과 맞지 않아 저장 · 제출이 안 될 수 있다. 옛 lib/cdk.js 복사본 프로젝트는 sdk.lib-copy 경고로 알린다
|
|
132
|
+
*/
|
|
133
|
+
function checkSdk(manifest, spec, opts, add) {
|
|
134
|
+
// 옛 머리말은 "1.0.0 (브랜치@커밋)"일 수 있어 첫 낱말만 비교한다
|
|
135
|
+
const version = manifest?.build?.sdk?.split(' ')[0];
|
|
136
|
+
const min = spec.minVersions.sdk;
|
|
137
|
+
const order = version ? compareVersions(version, min) : undefined;
|
|
138
|
+
const below = order !== undefined && order < 0;
|
|
139
|
+
if (opts.legacySdkCopy) {
|
|
140
|
+
add('sdk.lib-copy', `${opts.legacySdkCopy}는 옛 ecdk create가 복사한 SDK${version ? ` ${version}` : ''}입니다${below ? ` (최소 ${min}보다 낮음)` : ''}. 이제 SDK는 package.json 의존성입니다: ecdk doctor --fix(또는 package.json dependencies에 "@eliceio/cdk": "^${min}")로 넣고 npm install 하면 ecdk build가 node_modules에서 넣습니다. 그다음 ${opts.legacySdkCopy}는 지워도 됩니다.`, opts.legacySdkCopy);
|
|
141
|
+
// 옛 복사본도 최소 미만이면 오류 (zip 검사와 같은 판정, 옛 SDK로 올리는 것을 막음)
|
|
142
|
+
if (below) add('sdk.outdated', `${opts.legacySdkCopy}의 SDK ${version}은 최소 버전 ${min}보다 낮아 LXP에서 저장 · 제출 · 교육자 화면이 안 될 수 있습니다. ecdk doctor --fix && npm install 후 다시 빌드해 주세요.`, opts.legacySdkCopy);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (below) add('sdk.outdated', `@eliceio/cdk(SDK) ${version}은 최소 버전 ${min}보다 낮아 LXP에서 저장 · 제출이 안 될 수 있습니다. 프로젝트 폴더에서 ${SDK_UPDATE_COMMAND} 후 다시 빌드해 주세요.`, spec.manifest.file);
|
|
112
146
|
}
|
|
113
147
|
/** `<script type="module" data-ecdk-bundle>` 본문을 줄 수만 남기고 비운다 (줄 번호 유지) */
|
|
114
148
|
function blankBundles(html) {
|
|
@@ -172,7 +206,7 @@ function checkFiles(input, opts = {}) {
|
|
|
172
206
|
}
|
|
173
207
|
const commentaryFile = manifest.commentary === undefined ? undefined : files.find(f => f.path === manifest.commentary);
|
|
174
208
|
// LXP 업로드는 학습 참고 내용이 없는 자료 본문을 거절한다 (qa5에서 확인. 스펙은 선택이었음)
|
|
175
|
-
if ((manifest.kind ?? spec.manifest.defaultKind) !== 'description' && manifest.commentary === undefined) add('manifest.commentary-missing', `학습 참고 내용 파일이 없어 LXP 업로드가 거절됩니다. 프로젝트 맨 위에 ${spec.manifest.commentaryFile}(이 자료의 핵심 개념 · 활동 · 문제 의도, 정답 제외)을
|
|
209
|
+
if ((manifest.kind ?? spec.manifest.defaultKind) !== 'description' && manifest.commentary === undefined) add('manifest.commentary-missing', `학습 참고 내용 파일이 없어 LXP 업로드가 거절됩니다. 프로젝트 맨 위에 ${spec.manifest.commentaryFile}(이 자료의 핵심 개념 · 활동 · 문제 의도, 정답 제외)을 만들고 ${spec.manifest.file}에 "commentary": "${spec.manifest.commentaryFile}"를 적어 주세요.`, spec.manifest.file);
|
|
176
210
|
if (manifest.commentary !== undefined && !commentaryFile) add('manifest.entry-missing', `${spec.manifest.file}에 적은 학습 참고 내용 파일이 없습니다: ${manifest.commentary}`, spec.manifest.file);
|
|
177
211
|
// LXP 학습 참고 내용 칸으로 옮길 텍스트라 UTF-8이어야 한다 (메모장 ANSI · EUC-KR 저장이면 깨짐)
|
|
178
212
|
if (commentaryFile) {
|
|
@@ -186,10 +220,12 @@ function checkFiles(input, opts = {}) {
|
|
|
186
220
|
// 메모장 등이 붙이는 BOM은 학습 참고 내용 칸에 보이지 않는 글자로 들어간다
|
|
187
221
|
if (startsWithBom(commentaryFile.data)) add('file.bom', `학습 참고 내용 파일 맨 앞에 BOM(보이지 않는 글자)이 있습니다: ${commentaryFile.path}. "UTF-8(BOM 없음)"으로 다시 저장해 주세요.`, commentaryFile.path);
|
|
188
222
|
}
|
|
189
|
-
checkCompletion(manifest, spec,
|
|
223
|
+
checkCompletion(manifest, spec, (id, message, path) => add(id, message, path));
|
|
190
224
|
checkTemplate(manifest, opts, message => add('build.template-unknown', message, spec.manifest.file));
|
|
191
225
|
checkScreenCode(files, manifest, (id, message) => add(id, message, spec.manifest.file));
|
|
192
226
|
}
|
|
227
|
+
checkLegacyFiles(opts, (message, path) => add('project.legacy-file', message, path));
|
|
228
|
+
checkSdk(manifest, spec, opts, add);
|
|
193
229
|
const entry = manifest?.entries.learn ?? spec.manifest.defaultEntry;
|
|
194
230
|
if (!manifest && !exact.has(entry)) add('entry.missing', `최상위에 ${entry} 파일이 없습니다.`);
|
|
195
231
|
// 한도
|
|
@@ -221,7 +257,7 @@ function checkFiles(input, opts = {}) {
|
|
|
221
257
|
add('file.encoding', `UTF-8이 아닌 파일입니다 (EUC-KR · ANSI로 저장하면 한글이 깨집니다): ${f.path}. UTF-8로 다시 저장해 주세요.`, f.path);
|
|
222
258
|
continue;
|
|
223
259
|
}
|
|
224
|
-
//
|
|
260
|
+
// zip 안 JSON(작성자가 넣은 데이터 파일)은 학생 브라우저로 그대로 내려간다. 파일 이름(answers.*)만 막아서는 파일 안의 정답을 못 잡는다
|
|
225
261
|
if (ext === 'json' && f.path !== spec.manifest.file) {
|
|
226
262
|
let data = null;
|
|
227
263
|
try {
|
|
@@ -230,7 +266,7 @@ function checkFiles(input, opts = {}) {
|
|
|
230
266
|
data = null;
|
|
231
267
|
}
|
|
232
268
|
const key = answerKeyPath(data);
|
|
233
|
-
if (key) add('content.answer-key', `학생에게 내려가는 JSON에 정답처럼 보이는 키가 있습니다: ${key}. 정답은
|
|
269
|
+
if (key) add('content.answer-key', `학생에게 내려가는 JSON에 정답처럼 보이는 키가 있습니다: ${key}. 정답은 편집 화면의 채점 설정(settings.grading)에 두고 zip에서 빼 주세요.`, f.path);
|
|
234
270
|
}
|
|
235
271
|
}
|
|
236
272
|
for (const paths of byLower.values()) {
|
package/es/rules/manifest.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function graderTypeError(value: unknown, allowed: readonly string
|
|
|
18
18
|
/** completionPolicies 예시 (오류 문구에 같이 보인다) */
|
|
19
19
|
export declare const COMPLETION_POLICIES_EXAMPLE = "\uC608: \"completionPolicies\": [\"on_submit\"] \u00B7 \uACE0\uB97C \uC218 \uC788\uAC8C [\"on_submit\", \"on_access\"] \u00B7 \uCC44\uC810\uD558\uB294 \uD034\uC988 [\"on_graded\"]";
|
|
20
20
|
/**
|
|
21
|
-
* `completionPolicies` 검사 (metadata.json · elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
|
|
21
|
+
* `completionPolicies` 검사 (metadata.json · 옛 elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
|
|
22
22
|
* 같은 값 두 번 없음. 문제가 있으면 문장, 없으면 배열. 빈 배열은 여기서 통과시키고 검사 규칙
|
|
23
23
|
* manifest.completion-policies-missing이 알린다 (없는 것과 같은 문제)
|
|
24
24
|
*/
|
package/es/rules/manifest.js
CHANGED
|
@@ -29,7 +29,7 @@ function graderTypeError(value, allowed) {
|
|
|
29
29
|
/** completionPolicies 예시 (오류 문구에 같이 보인다) */
|
|
30
30
|
const COMPLETION_POLICIES_EXAMPLE = '예: "completionPolicies": ["on_submit"] · 고를 수 있게 ["on_submit", "on_access"] · 채점하는 퀴즈 ["on_graded"]';
|
|
31
31
|
/**
|
|
32
|
-
* `completionPolicies` 검사 (metadata.json · elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
|
|
32
|
+
* `completionPolicies` 검사 (metadata.json · 옛 elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
|
|
33
33
|
* 같은 값 두 번 없음. 문제가 있으면 문장, 없으면 배열. 빈 배열은 여기서 통과시키고 검사 규칙
|
|
34
34
|
* manifest.completion-policies-missing이 알린다 (없는 것과 같은 문제)
|
|
35
35
|
*/
|
package/es/rules/types.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface RulesSpec {
|
|
|
32
32
|
* on_access(열면 완료) · on_submit(제출하면 완료) · on_graded(채점해 통과하면 완료)
|
|
33
33
|
*/
|
|
34
34
|
completionPolicies: string[];
|
|
35
|
-
/** 채점 방식 (on_graded일 때만): `settings.grading.type
|
|
35
|
+
/** 채점 방식 (on_graded일 때만): `settings.grading.type`. code_exec는 이번 범위 밖 */
|
|
36
36
|
graderTypes: string[];
|
|
37
37
|
/** 학습 참고 내용(commentary) 파일의 기본 이름 (zip 최상위, 일반 텍스트). metadata.json `commentary`가 가리킨다 */
|
|
38
38
|
commentaryFile: string;
|
|
@@ -62,6 +62,13 @@ export interface RulesSpec {
|
|
|
62
62
|
}[];
|
|
63
63
|
secretPatterns: SecretPattern[];
|
|
64
64
|
rules: RuleDef[];
|
|
65
|
+
/**
|
|
66
|
+
* LXP 프로토콜과 맞는 최소 버전 (metadata.json build.sdk와 비교). 낮으면 sdk.outdated 오류.
|
|
67
|
+
* 프로토콜이 바뀔 때(예: 완료 정책 저장) 올린다 (ADR 0010)
|
|
68
|
+
*/
|
|
69
|
+
minVersions: {
|
|
70
|
+
sdk: string;
|
|
71
|
+
};
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
67
74
|
* 비밀 값 탐지 (`sec.secret`). 사내 SAST(semgrep p/secrets + security/semgrep custom)를 옮긴 것.
|
|
@@ -101,12 +108,15 @@ export interface CheckOptions {
|
|
|
101
108
|
/** ecdk build가 모듈 스크립트를 HTML 안에 묶어 넣는다 (build · doctor · dev가 원본을 볼 때). 그러면 sandbox.module-src를 보지 않는다 */
|
|
102
109
|
bundlesModules?: boolean | undefined;
|
|
103
110
|
/**
|
|
104
|
-
* 프로젝트 검사(build · doctor · dev)일 때
|
|
105
|
-
*
|
|
111
|
+
* 프로젝트 검사(build · check · doctor · dev)일 때 프로젝트에 남은 옛 파일 (content.json · grading.json, ADR 0011).
|
|
112
|
+
* 있으면 project.legacy-file로 옮기는 법을 알린다. undefined면 zip만 본 것이라 보지 않는다
|
|
113
|
+
*/
|
|
114
|
+
legacyFiles?: string[] | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* 프로젝트 검사일 때: package.json에 @eliceio/cdk가 없고 원본에 lib/cdk.js 복사본이 있는 옛 프로젝트면 그 경로.
|
|
117
|
+
* 있으면 sdk.lib-copy로 옮기는 법을 알리고, 복사본 버전은 sdk.outdated 대신 그 경고에 적는다
|
|
106
118
|
*/
|
|
107
|
-
|
|
108
|
-
type: string;
|
|
109
|
-
} | null | undefined;
|
|
119
|
+
legacySdkCopy?: string | undefined;
|
|
110
120
|
/**
|
|
111
121
|
* 이 CLI가 아는 템플릿과 버전 ({ quiz: '1.0.0' }). 있으면 metadata.json build.template을 맞춰 본다
|
|
112
122
|
* (build.template-unknown). 없으면(서버 · 라이브러리 사용) 보지 않는다
|
|
@@ -119,9 +129,9 @@ export interface BuildInfo {
|
|
|
119
129
|
rules: string;
|
|
120
130
|
protocol: number;
|
|
121
131
|
engine: string;
|
|
122
|
-
/** 만든 템플릿과 그 템플릿의 버전 (예: "quiz@1.0.0", 템플릿마다 template.json version). ecdk create가
|
|
132
|
+
/** 만든 템플릿과 그 템플릿의 버전 (예: "quiz@1.0.0", 템플릿마다 template.json version). ecdk create가 package.json "ecdk"에 적어 둔 값 */
|
|
123
133
|
template?: string | undefined;
|
|
124
|
-
/**
|
|
134
|
+
/** zip lib/cdk.js의 @eliceio/cdk 버전 (build가 설치된 SDK를 넣으며 붙인 머리말, 옛 프로젝트는 복사본 머리말) */
|
|
125
135
|
sdk?: string | undefined;
|
|
126
136
|
/** minify로 줄였는지 */
|
|
127
137
|
minify?: boolean | undefined;
|
package/es/rules.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const version="0.5.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 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:"grading.missing",level:"warn",scope:"client",title:"채점(on_graded)으로 완료하는데 프로젝트에 grading.json이 없음 (ecdk dev가 채점을 흉내 내지 못함, 프로젝트 검사만)"},{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 대상 *"}];var rulesJson = {version:version,manifest:manifest,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
|
|
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};
|
|
2
2
|
|
|
3
|
-
export { allowedExtensions, rulesJson as default, excluded, forbiddenApis, imageExtensions, limits, manifest, rules, secretPatterns, version };
|
|
3
|
+
export { allowedExtensions, rulesJson as default, excluded, forbiddenApis, imageExtensions, limits, manifest, minVersions, rules, secretPatterns, version };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CreateOptions, type CreateResult } from './commands/create/scaffold.js';
|
|
2
|
+
export declare const SDK_STUB: string;
|
|
3
|
+
/** 워크스페이스 SDK 버전 (packages/eliceio-cdk/package.json) */
|
|
4
|
+
export declare function workspaceSdkVersion(): Promise<string>;
|
|
5
|
+
export declare function installWorkspaceSdk(dir: string, version?: string): Promise<void>;
|
|
6
|
+
/** ecdk create(--no-install)와 같이 만들고 SDK 대역을 넣는다 */
|
|
7
|
+
export declare function createTestProject(options: CreateOptions): Promise<CreateResult>;
|
|
@@ -54,16 +54,16 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
54
54
|
| Writing or assignments graded against a rubric (AI grading) | `on_graded` | `rubric` (the criteria) | `useSubmit`, the score comes back at once |
|
|
55
55
|
|
|
56
56
|
- **The grader and the answers are set on the edit screen** and saved to `settings.grading` with the edit token (`useSave` with `getGrading`): `{ "type": "pattern", "answer_key": "^…$" }` or `{ "type": "rubric", "rubric": "…" }`. The kit's default block `app.useGradingBlock()` uses LXP's wording (기준 답안 (정규표현식), 작성 예시 보기, 평가 기준). When the answers depend on the content's structure (questions, choices, steps), set them where the content is edited, for example in each question card. The answer to `pattern` is **one regular expression** that must match the whole submitted answer string (trimmed), so submit one string and build the regex from the instructor's choices.
|
|
57
|
-
- **`completionPolicies` is required** in
|
|
57
|
+
- **`completionPolicies` is required** in the project's `metadata.json` (a material without it, or with an empty list, fails `manifest.completion-policies-missing`): for example `"completionPolicies": ["on_submit"]`. The server sets the **first** value as the material's policy on upload. Put `on_graded` in it only when the edit screen saves the grading. The grader is not listed here: it is `settings.grading.type` (`pattern` · `rubric`), set on the edit screen.
|
|
58
58
|
- **One policy fixes it** (`["on_graded"]` in the quiz template; no completion policy screen). **More than one** lets the instructor pick among them on the **completion policy screen** (`screens.completionPolicy`, `app.useCompletion()`, which shows only the listed policies). That screen saves through `app.completion.set()` → SDK `saveCompletionPolicy` (`PATCH` `completion_policy`); it never touches `settings`, and the edit screen never sends a policy. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). More than one policy without the screen warns `completion.no-screen`; one policy with the screen warns `completion.screen-unused`. The blank template lists `["on_submit", "on_access"]` with the screen.
|
|
59
59
|
- Custom HTML does not use manual grading (`manual`) or no grading (`none`). There is no per-question grading: every question must be right for 100. Changing the answers does not regrade past submissions.
|
|
60
|
-
- Answers never go in the zip (`metadata.json` ·
|
|
60
|
+
- Answers never go in the zip (`metadata.json` · data JSON · code), and there is no answer file in the project: answers exist only in `settings.grading`, saved on the edit screen. The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `metadata.json` or an old `elice.config.json`. A grading with the 11-10 policy and grader fields is rejected with how to rewrite it.
|
|
61
61
|
|
|
62
62
|
**②-1 Learning notes**: write the key concepts, the activity, and the intent of the questions in `commentary.txt` (plain text) at the top of the project. `build` puts it in the zip and writes `"commentary": "commentary.txt"` in `metadata.json`; LXP's AI Helpy and AI quiz generation read it. It is inside the zip, so students can read it: **never put answers in it.** A material needs it: LXP rejects an upload without learning notes, and `ecdk check` reports `manifest.commentary-missing` (a problem description, `kind: description`, does not need it). Once it is filled in, AI Helpy answers only questions about this material.
|
|
63
63
|
|
|
64
64
|
**③ Does it need an instructor screen?** Make one when there are explanations, a summary of the answer conditions, or teaching tips. Turn it off when it would equal the student screen.
|
|
65
65
|
|
|
66
|
-
**④ Does it need a content edit screen?** When instructors may want to rewrite text, numbers or lists (for example a simulation's initial values, a card list, step descriptions),
|
|
66
|
+
**④ Does it need a content edit screen?** When instructors may want to rewrite text, numbers or lists (for example a simulation's initial values, a card list, step descriptions), keep them in the content the edit screen saves (`app.content`, the material's `settings`) and let the edit screen change them. There is no default content file: until the edit screen saves, `app.content` is `{}`, `app.hasContent` is false, and the student and instructor screens show `app.emptyState()` ("아직 내용이 없습니다 …"). Turn the edit screen off only when the material needs no content at all (everything is in the code).
|
|
67
67
|
|
|
68
68
|
**⑤ Purpose**: the material itself (`kind: material`, the default), or the **problem description** of another material such as a practice (`kind: description`: student screen only, no grading).
|
|
69
69
|
|
|
@@ -76,29 +76,31 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
76
76
|
|
|
77
77
|
## 3. Create the project
|
|
78
78
|
|
|
79
|
-
Run `ecdk create --list` first: it prints each template with its own version (`quiz@1.
|
|
79
|
+
Run `ecdk create --list` first: it prints each template with its own version (`quiz@1.1.0`), what it is for, its screens and its completion policy. Pick the template from that list. `ecdk create` records the template and version in `package.json` `"ecdk"` (`template`), `ecdk build` copies it to `metadata.json` `build.template`, and `ecdk doctor` says when the installed ecdk ships a newer version of that template (nothing changes on its own).
|
|
80
80
|
|
|
81
|
-
| Case
|
|
82
|
-
|
|
|
83
|
-
| A
|
|
84
|
-
| Any other material
|
|
85
|
-
| A dark screen
|
|
86
|
-
| A problem description
|
|
87
|
-
| An existing HTML page
|
|
81
|
+
| Case | Start with |
|
|
82
|
+
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| A quiz (one question per quiz material; several questions mean several quiz materials) | `ecdk create <folder>` (quiz template: starts with no question; the edit screen adds one question of any of the five types with "문항 추가"; answers set on the edit screen; `"completionPolicies": ["on_graded"]` + `pattern`) |
|
|
84
|
+
| Any other material | `ecdk create <folder> --template blank` (skeleton of the three screens) |
|
|
85
|
+
| A dark screen | Add `--theme dark` to the above |
|
|
86
|
+
| A problem description | Create with blank, set `metadata.json` to `{ "kind": "description", "screens": { "learn": { "enabled": true, "entry": "index.html" } }, "commentary": "commentary.txt" }`, delete the other screen files |
|
|
87
|
+
| An existing HTML page | [7. Move existing HTML](#7-move-existing-html) |
|
|
88
88
|
|
|
89
|
-
`create` refuses a folder that is not empty. Use a new subfolder.
|
|
89
|
+
`create` refuses a folder that is not empty. Use a new subfolder. It then runs `npm install` in the project (the SDK `@eliceio/cdk` comes from npm through `package.json`; `--no-install` skips it). When the install fails, the project stays: run `npm install` in it (network or proxy problem; tell the user).
|
|
90
|
+
|
|
91
|
+
The project files: screens, `lib/` (the screen kit, copied as is), `metadata.json` (screens · `completionPolicies` · `commentary`; `ecdk build` copies it and fills only `build`), `package.json` (the SDK version in `dependencies`, build options `minify` · `sourcemap` · `root` · `outDir` · `exclude` · `template` under `"ecdk"`). There is no `lib/cdk.js` in the project: `ecdk build` and `ecdk dev` take it from `node_modules/@eliceio/cdk`. To update the SDK run `npm update @eliceio/cdk`.
|
|
90
92
|
|
|
91
93
|
Then:
|
|
92
94
|
|
|
93
|
-
1. Set `screens` in `
|
|
94
|
-
2.
|
|
95
|
+
1. Set `screens` in `metadata.json` to the design (`{ "enabled": true, "entry": "edit.html" }` for a screen you keep, `{ "enabled": false }` for one you drop). Set `completionPolicies` too. In `ecdk dev`, saving in the content edit view writes the whole settings (content and answers) to `.ecdk/settings.json`, and the completion policy view writes `.ecdk/completion.json`; both stay out of the zip and out of `ecdk build` · `check`.
|
|
96
|
+
2. Make the edit screen save the data in ④. **Local work builds only the template (screens and code)**; the real content and answers are entered in the LXP edit screen after upload (2026-11-11). In `ecdk dev`, try the edit and learn screens with a little sample input; it is saved only in `.ecdk/settings.json` and never uploaded, so do not author the full content locally. When the person describes the content, give it as draft text for them to enter in LXP.
|
|
95
97
|
3. Write the screen code ([5](#5-screen-code)). Delete the HTML and JS of screens you do not use.
|
|
96
98
|
4. Check ([9](#9-check)) → build ([10](#10-build)).
|
|
97
99
|
|
|
98
100
|
## 4. Rules
|
|
99
101
|
|
|
100
|
-
1. **Never put correct answers in the content**: not in
|
|
101
|
-
2. **Screen code calls only `lib/elice-content.js` (the kit).** Do not edit `lib/`. Do not call the SDK (`lib/cdk.js`) directly.
|
|
102
|
+
1. **Never put correct answers in the content**: not in a data JSON file, the screen code, or comments. They reach the student's browser. Answers go only in `settings.grading` through the edit screen (the server never sends it to students; `ecdk dev` keeps it in `.ecdk/settings.json`, left out of the zip).
|
|
103
|
+
2. **Screen code calls only `lib/elice-content.js` (the kit).** Do not edit `lib/`. Do not call the SDK (`lib/cdk.js`, added by `ecdk build` from `node_modules`) directly.
|
|
102
104
|
3. **Do not use blocked features**: `localStorage` · `sessionStorage` · `indexedDB` · `document.cookie` · `alert`/`confirm`/`prompt` · `window.open` · `<form>` submission · access to `window.parent`/`top` · `fetch`/`WebSocket` to external addresses · external `<script src>`. To keep progress, submit it (`useSubmit`); to keep content, save it from the edit screen.
|
|
103
105
|
4. **Libraries and media go inside the zip.** Download libraries for charts, visualization or physics (for example Chart.js, D3, p5.js) into `vendor/` and load them by relative path instead of a CDN. Fonts, images and sounds also go in the zip. Limits: zip 20 MB, 300 files. Upload long videos separately as Elice video materials.
|
|
104
106
|
5. **Use relative paths** (`img/a.png`). Paths starting with `/` break. Match file name case. Prefer letters, digits, `-` and `_`.
|
|
@@ -115,7 +117,9 @@ import { start } from '../lib/elice-content.js';
|
|
|
115
117
|
|
|
116
118
|
// Student screen
|
|
117
119
|
const app = await start({ screen: 'learn' });
|
|
118
|
-
|
|
120
|
+
// Content is only what the edit screen saved (no default content file). Before that, show the kit's notice
|
|
121
|
+
if (app.hasContent) render(app.content);
|
|
122
|
+
else root.replaceChildren(app.emptyState());
|
|
119
123
|
|
|
120
124
|
// Only for materials with a submission: say how to collect and restore the answer (result).
|
|
121
125
|
// Locking, restoring and result messages are handled by the kit.
|
|
@@ -172,10 +176,10 @@ app.useCompletion();
|
|
|
172
176
|
|
|
173
177
|
## 6. Using the quiz template
|
|
174
178
|
|
|
175
|
-
- The template starts with **
|
|
179
|
+
- The template starts with **no questions**: the student and instructor screens show "아직 내용이 없습니다" until the edit screen saves. The person adds the question and answer on the LXP edit screen after upload ("문항 추가", any of the five types, the answer in the same card). **One quiz material holds one question**, like the legacy LXP quiz: once there is a question the edit screen shows a hint instead of "문항 추가", and several questions mean several quiz materials (pages). A quiz already saved with more questions still shows and saves. Locally, add a sample question in `ecdk dev` to check the screens; give the requested question set as draft text, one question per quiz material.
|
|
176
180
|
- Question types: `select_one` · `select_multiple` · `order` · `text` · `group`. Question, choice and group ids (`q1`, `a`, `g1`) are lower-case letters and digits; once set, do not change them.
|
|
177
181
|
- Student answer: **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and `encodeURIComponent`-encoded.
|
|
178
|
-
- Answers: the instructor picks the answer in each question card of the edit screen (text questions take one allowed answer per line
|
|
182
|
+
- Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz lists only `on_graded` (`"completionPolicies": ["on_graded"]`) and grades with `pattern`, so it has no completion policy screen and no hand-written regex. `pattern` compares the whole answer at once, so **everything must match for 100** (no partial score per question).
|
|
179
183
|
|
|
180
184
|
```json
|
|
181
185
|
{
|
|
@@ -200,32 +204,35 @@ To mix a visualization or simulation into a quiz, edit the quiz template, or wri
|
|
|
200
204
|
3. Download external CDN scripts and fonts into the zip.
|
|
201
205
|
4. Replace blocked code (storage, `alert`, external sends) as in [4](#4-rules).
|
|
202
206
|
5. Merge multiple HTML pages into one HTML that switches views.
|
|
203
|
-
6. Decide completion and grading as in [2 ②](#2-design-the-material). Without grading, pick `on_access` or `on_submit` and write it in `
|
|
204
|
-
7.
|
|
207
|
+
6. Decide completion and grading as in [2 ②](#2-design-the-material). Without grading, pick `on_access` or `on_submit` and write it in `metadata.json` (`"completionPolicies": ["on_access"]` when there is no submission).
|
|
208
|
+
7. Turn off the instructor, edit and completion policy screens in `metadata.json` `screens` (`{ "enabled": false }`) and delete their files when they are not needed.
|
|
209
|
+
8. An old ecdk project with `elice.config.json` or `lib/cdk.js` and no `@eliceio/cdk` in `package.json`: run `ecdk doctor --fix` (moves the settings to `metadata.json` and `package.json` `"ecdk"`, adds the SDK dependency), then `npm install`.
|
|
205
210
|
|
|
206
211
|
## 8. Fix check errors
|
|
207
212
|
|
|
208
213
|
Read `check.issues[]` (`id` · `level` · `path` · `line` · `message`) from `ecdk build --json`. With an `error` no zip is made. Each `message` says how to fix it.
|
|
209
214
|
|
|
210
|
-
| id | Fix
|
|
211
|
-
| ---------------------------------------------- |
|
|
212
|
-
| `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file
|
|
213
|
-
| `ref.root-absolute` | Change `/…` to a relative path
|
|
214
|
-
| `ref.external-script` · `ref.external-request` | Put the library or font in the zip and use a relative path
|
|
215
|
-
| `api.storage` · `api.cookie` | Do not use storage. Submit results; save content from the edit screen
|
|
216
|
-
| `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit`
|
|
217
|
-
| `api.external-send` | Remove the external send
|
|
218
|
-
| `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason
|
|
219
|
-
| `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**)
|
|
220
|
-
| `manifest.completion-policies-missing` (error) | Add `"completionPolicies": ["on_submit"]` (or the policies you chose, default first) to `
|
|
221
|
-
| `completion.no-screen` (warn) | Turn on the completion policy screen (`screens.completionPolicy`), or keep only one policy
|
|
222
|
-
| `completion.screen-unused` (warn) | One policy is fixed: remove the completion policy screen, or list more policies
|
|
223
|
-
| `completion.no-edit` (error) | `on_graded` needs an edit screen to set the answers: turn on `screens.edit`, or pick `on_submit` · `on_access`
|
|
224
|
-
| `completion.no-grading` (warn) | Add `app.useGradingBlock()` to the edit screen and pass `getGrading` to `useSave`
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
215
|
+
| id | Fix |
|
|
216
|
+
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
217
|
+
| `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file |
|
|
218
|
+
| `ref.root-absolute` | Change `/…` to a relative path |
|
|
219
|
+
| `ref.external-script` · `ref.external-request` | Put the library or font in the zip and use a relative path |
|
|
220
|
+
| `api.storage` · `api.cookie` | Do not use storage. Submit results; save content from the edit screen |
|
|
221
|
+
| `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit` |
|
|
222
|
+
| `api.external-send` | Remove the external send |
|
|
223
|
+
| `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason |
|
|
224
|
+
| `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**) |
|
|
225
|
+
| `manifest.completion-policies-missing` (error) | Add `"completionPolicies": ["on_submit"]` (or the policies you chose, default first) to `metadata.json` |
|
|
226
|
+
| `completion.no-screen` (warn) | Turn on the completion policy screen (`screens.completionPolicy`), or keep only one policy |
|
|
227
|
+
| `completion.screen-unused` (warn) | One policy is fixed: remove the completion policy screen, or list more policies |
|
|
228
|
+
| `completion.no-edit` (error) | `on_graded` needs an edit screen to set the answers: turn on `screens.edit`, or pick `on_submit` · `on_access` |
|
|
229
|
+
| `completion.no-grading` (warn) | Add `app.useGradingBlock()` to the edit screen and pass `getGrading` to `useSave` |
|
|
230
|
+
| `project.legacy-file` (warn, project only) | An old `elice.config.json` · `content.json` · `grading.json` is left: `ecdk doctor --fix` moves `elice.config.json`; re-enter the content and answers in the edit screen, then delete the other files |
|
|
231
|
+
| `sdk.outdated` (error) | The SDK in the zip is older than the minimum: `npm update @eliceio/cdk` (an old `lib/cdk.js` copy: `ecdk doctor --fix && npm install`), then build again |
|
|
232
|
+
| `sdk.lib-copy` (warn, project only) | An old `lib/cdk.js` copy and no `@eliceio/cdk` in `package.json`: `ecdk doctor --fix`, then `npm install` |
|
|
233
|
+
| `build.template-unknown` (warn) | The material was made with a template or template version this ecdk does not know. Update ecdk (`npm i -g @eliceio/cdk-cli`) or check `template` in `package.json` `"ecdk"` |
|
|
234
|
+
| `manifest.*` · `entry.*` | Check `screens` and `kind` in `metadata.json` |
|
|
235
|
+
| `limit.*` · `file.large-image` | Shrink images and video, drop unused files (build output: "files not referenced anywhere") |
|
|
229
236
|
|
|
230
237
|
Use `ecdk-ignore`, which turns a rule off, only for legitimate code a regular expression cannot tell apart, and **always with the reason**. Do not scatter it to silence errors.
|
|
231
238
|
|
|
@@ -246,7 +253,7 @@ ecdk dev # http://localhost:4170: student, tutoring, instructor, conten
|
|
|
246
253
|
ecdk build --json
|
|
247
254
|
```
|
|
248
255
|
|
|
249
|
-
- With `ok: true` the zip is `dist/content.zip`. To make it smaller, set `"minify": true` in `
|
|
256
|
+
- With `ok: true` the zip is `dist/content.zip`. To make it smaller, set `"minify": true` in `package.json` `"ecdk"` (quiz template about 122 KB → 87 KB).
|
|
250
257
|
- Report to the user: what the material is (what the student does, which screens are on, how it completes), the zip path and size, **how it completes and what to pick in the settings tab** (the completion policy and the grading type, and where the answers are set), the upload steps (Custom HTML material in LXP → upload the zip → settings tab → save → check the student and instructor screens), and anything left to check. Saving makes the new version visible to learners at once, so the person approves it first (see [0. What the person decides](#0-what-the-person-decides)).
|
|
251
258
|
|
|
252
259
|
## 11. More
|
|
@@ -260,18 +267,18 @@ The `elice-material` MCP server (elice-material backend) uploads a built zip to
|
|
|
260
267
|
|
|
261
268
|
**Order**
|
|
262
269
|
|
|
263
|
-
| Step | Tool or command
|
|
264
|
-
| ------------------- |
|
|
265
|
-
| Build | `ecdk build --json`
|
|
266
|
-
| Find the page | `list_my_organizations` → `list_courses` → `list_lectures` → `list_custom_pages`
|
|
267
|
-
| New page (optional) | `create_custom_page` (`org`, `lecture_id`)
|
|
268
|
-
| Current version | `get_material`
|
|
269
|
-
| Upload URL | `create_package_upload` (`size_bytes`)
|
|
270
|
-
| Upload | the `curl_command`, `package.zip` replaced by the zip path
|
|
271
|
-
| Draft | `submit_package` (`key`) → `get_draft` every 2–3 s
|
|
272
|
-
| Approve | —
|
|
273
|
-
| Save | `save_draft` (`material_draft_id`, `expected_current_version_id`, `completion_policy
|
|
274
|
-
| Title, icon | `update_material` (`expected_current_version_id`, `payload`)
|
|
270
|
+
| Step | Tool or command | Notes |
|
|
271
|
+
| ------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
272
|
+
| Build | `ecdk build --json` | `ok: true` required. Use `zip` and `zipBytes` |
|
|
273
|
+
| Find the page | `list_my_organizations` → `list_courses` → `list_lectures` → `list_custom_pages` | Or read `.ecdk/link.json` (written after a save, see below), or parse the LXP edit URL `https://{org}.…/courses/{c}/lectures/{l}/lecturepages/{id}/edit`. Only lectures with `can_hold_pages: true` hold pages |
|
|
274
|
+
| New page (optional) | `create_custom_page` (`org`, `lecture_id`) | Ask first. The page is closed to learners and has no title until its first save. Fails where the elice-api change is not deployed: then use an existing Custom page |
|
|
275
|
+
| Current version | `get_material` | Keep `current_version.id` (null for a page never saved) |
|
|
276
|
+
| Upload URL | `create_package_upload` (`size_bytes`) | At most 20 MB. Returns `key` and `curl_command` |
|
|
277
|
+
| Upload | the `curl_command`, `package.zip` replaced by the zip path | From a desktop app, run it through a login shell (see Always) |
|
|
278
|
+
| Draft | `submit_package` (`key`) → `get_draft` every 2–3 s | `ready`: shows `preview_urls`, `warnings`, the package metadata. `failed`: report `failure` with `ecdk check dist/content.zip` and stop |
|
|
279
|
+
| Approve | — | Show page, title, completion policy, answers saved or not, `preview_urls`. Saving is visible to learners at once when the page is open |
|
|
280
|
+
| Save | `save_draft` (`material_draft_id`, `expected_current_version_id`, `completion_policy`) | See below (no content or `grading` from the project). `MATERIAL_CHANGED`: someone saved after your `get_material`; do not retry blindly, tell the person |
|
|
281
|
+
| Title, icon | `update_material` (`expected_current_version_id`, `payload`) | Only keys to change, e.g. `{ "title": "…", "icon": "quiz" }`. Read the new version id with `get_material` first |
|
|
275
282
|
|
|
276
283
|
After a successful save, write `.ecdk/link.json` in the project (it is not put in the zip; add `.ecdk/` to `.gitignore`):
|
|
277
284
|
|
|
@@ -283,8 +290,9 @@ Next time, read it, confirm the page with the person, and compare `version_id` w
|
|
|
283
290
|
|
|
284
291
|
**Completion policy and answers**
|
|
285
292
|
|
|
286
|
-
- `completion_policy`: `on_access` (complete on open), `on_submit` (complete on any submission) or `on_graded` (complete when the grading passes). Pass the first value of `completionPolicies` on the first `save_draft` (the server will also read it from `metadata.json`, G132; until then a first version without it gets `on_access`), and later versions keep the current policy unless you pass one. Pass it on `save_draft`, not afterwards, so learners never complete the page under the wrong policy.
|
|
287
|
-
-
|
|
293
|
+
- `completion_policy`: `on_access` (complete on open), `on_submit` (complete on any submission) or `on_graded` (complete when the grading passes). Pass the first value of `completionPolicies` on the first `save_draft` (the server will also read it from `metadata.json`, G132; until then a first version without it gets `on_access`), and later versions keep the current policy unless you pass one. Pass it on `save_draft`, not afterwards, so learners never complete the page under the wrong policy.
|
|
294
|
+
- Content and answers are not uploaded from the project (2026-11-11): local `ecdk dev` builds only the template (screens and code), and `.ecdk/settings.json` is sample input for local checks that is never uploaded. Do not pass content or `grading` to `save_draft`. After saving, tell the person to open the LXP edit screen and enter the content and answers (`settings`, with `settings.grading` for `on_graded`). Answers never go into the zip.
|
|
295
|
+
- A quiz (`on_graded`) has no answers at its first upload. Whether the server accepts `on_graded` without grading is undecided (G132): if `save_draft` returns `MATERIAL_GRADING_REQUIRED`, stop and tell the person. Either way, the person sets the answers on the edit screen right after the upload.
|
|
288
296
|
- The quiz template is `on_graded` with a pattern; other materials follow the design (②).
|
|
289
297
|
|
|
290
298
|
**Icon**: one of `note`, `video`, `pdf`, `exercise`, `quiz`, `notebook`, `live`, `assignment`, `external`, `survey`, or `null` (free-form, the default). Use `quiz` for the quiz template, otherwise `null` unless the person picks one. Title and icon also update the lecture page list.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliceio/cdk-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"description": "교육자용 Custom HTML 콘텐츠 CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@eliceio/cdk": "^1.0.0-alpha.3"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
|
-
"prebuild": "del-cli \"buildcache/*\" \"es/*\"
|
|
47
|
+
"prebuild": "del-cli \"buildcache/*\" \"es/*\"",
|
|
48
48
|
"build": "cross-env NODE_ENV=production rollup -c ./rollup.config.ts --configPlugin typescript -f es",
|
|
49
49
|
"lint": "eslint src --max-warnings=0",
|
|
50
50
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|