@eliceio/cdk-cli 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/es/commands/create/index.js +1 -0
- package/es/commands/create/scaffold.d.ts +1 -1
- package/es/commands/create/scaffold.js +1 -1
- package/es/commands/doctor/index.js +19 -2
- package/es/core/sandbox.js +1 -1
- package/es/rules/check.js +19 -2
- package/es/rules/grading.d.ts +25 -0
- package/es/rules/grading.js +131 -0
- package/es/rules/privacy.d.ts +2 -0
- package/es/rules/privacy.js +1 -1
- package/es/rules.json.js +1 -1
- package/package.json +2 -2
- package/rules.json +13 -1
- package/skills/_shared/references/02-design-the-material.md +1 -0
- package/skills/_shared/references/05-screen-code.md +26 -0
- package/skills/_shared/references/08-fix-check-errors.md +3 -1
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +1 -0
- package/skills/_shared/references/13-edit-screen-design.md +1 -1
- package/skills/elice-content-create/SKILL.md +1 -1
- package/skills/elice-content-publish/SKILL.md +1 -1
- package/templates/_shared/lib/elice-content.d.ts +45 -0
- package/templates/_shared/lib/elice-content.js +133 -5
- package/templates/video/README.md +68 -0
- package/templates/video/commentary.txt +2 -0
- package/templates/video/core/dom.d.ts +13 -0
- package/templates/video/core/dom.js +83 -0
- package/templates/video/core/settings.d.ts +19 -0
- package/templates/video/core/settings.js +52 -0
- package/templates/video/edit.html +17 -0
- package/templates/video/gitignore +4 -0
- package/templates/video/index.html +17 -0
- package/templates/video/metadata.json +9 -0
- package/templates/video/package.json +13 -0
- package/templates/video/screens/edit.js +69 -0
- package/templates/video/screens/learn.js +46 -0
- package/templates/video/styles.css +112 -0
- package/templates/video/template.json +13 -0
- package/templates/video/ui/templates/edit.js +26 -0
- package/templates/video/ui/templates/player.js +51 -0
- package/templates/video/ui/texts.d.ts +3 -0
- package/templates/video/ui/texts.js +50 -0
- package/templates/video/ui/theme.css +14 -0
package/README.md
CHANGED
|
@@ -215,7 +215,7 @@ frame-ancestors {LXP_ORIGINS}
|
|
|
215
215
|
``` 파일을 브라우저로 직접 열면(`file://`) 운영과 조건이 달라 확인이 되지 않습니다.
|
|
216
216
|
|
|
217
217
|
```bash
|
|
218
|
-
ecdk build # [ok] dist/content.zip · 파일 6개 · 149.4KB (엔진 vite, 규칙 0.
|
|
218
|
+
ecdk build # [ok] dist/content.zip · 파일 6개 · 149.4KB (엔진 vite, 규칙 0.20.0)
|
|
219
219
|
````
|
|
220
220
|
|
|
221
221
|
`[ok]`면 서버와 같은 규칙을 통과한 것입니다. 오류는 규칙 id로 [검사 규칙](#검사-규칙)을 찾습니다.
|
|
@@ -549,7 +549,7 @@ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
|
|
|
549
549
|
|
|
550
550
|
## 검사 규칙
|
|
551
551
|
|
|
552
|
-
`ecdk validate` · `ecdk build`와 서버 업로드 검사가 같은 규칙 파일(`rules.json`, 지금 0.
|
|
552
|
+
`ecdk validate` · `ecdk build`와 서버 업로드 검사가 같은 규칙 파일(`rules.json`, 지금 0.20.0)을 씁니다. **오류**는 zip을 만들지 않고 업로드도 거절됩니다. **경고**는 통과하지만 확인이 필요합니다.
|
|
553
553
|
|
|
554
554
|
<!-- 검사 규칙 표: rules.json의 모든 id가 있어야 한다 (src/readme.test.ts가 확인) -->
|
|
555
555
|
|
|
@@ -581,6 +581,8 @@ q1=b;q2=a,d;q3=c,a,b;q4=가중치;q5=g1:a|g2:b,c
|
|
|
581
581
|
| `file.bom` | 경고 | `commentary.txt` 맨 앞의 BOM → "UTF-8(BOM 없음)"으로 저장 |
|
|
582
582
|
| `content.answer-key` | 경고 | zip 안 JSON에 `answer` · `correct` · `answer_key` · `isCorrect` · `정답` 같은 키 → 정답은 편집 화면이 `settings.grading`에 저장 |
|
|
583
583
|
| `grading.no-submit` | 경고 | 편집 화면이 채점 설정(`useGradingBlock` · `getGrading`, 주석 제외)을 저장하는데 화면 코드에 `useSubmit` · `submit(`이 없음 → 학생 화면에 제출을 넣거나, 채점하지 않는 자료면 채점 설정을 빼기 (ecdk build가 묶은 zip은 원본으로 이미 검사해 건너뜀) |
|
|
584
|
+
| `grading.client-score` | 경고 | 제출하는 답(`submit(` 인자, `useSubmit`의 `getAnswer`)의 객체에 `score` · `scores` · `points` key → 서버는 답 안 점수를 쓰지 않으므로 학습자 답만 제출하고 `settings.grading`(`rubric` · `pattern`)으로 채점. 보여 주기만 하는 코드면 `ecdk-ignore-next-line grading.client-score`와 이유 |
|
|
585
|
+
| `grading.ai-without-grading` | 경고 | 화면 코드가 `mlapi.fetch`를 부르고 제출(`useSubmit` · `submit(`)하는데 채점 설정(`getGrading` · `useGradingBlock` · `grading:`)을 저장하지 않음 → LXP `on_graded`면 0점 · 미완료, `on_submit`이면 AI 결과와 상관없이 100점. 편집 화면 `useSave`에 `getGrading: () => ({ type: 'rubric', rubric })`. AI 피드백을 보여 주기만 하면 그 `mlapi.fetch` 줄에 `ecdk-ignore-next-line grading.ai-without-grading`와 이유 |
|
|
584
586
|
| `project.legacy-file` | 경고 | (프로젝트 검사만: build · check · doctor · dev) 옛 `elice.config.json` · `content.json` · `grading.json`이 남아 있음 → `elice.config.json`은 `ecdk doctor --fix`가 옮김, 내용 · 답은 편집 화면에서 다시 넣고 파일 지우기 (ADR 0011) |
|
|
585
587
|
| `sdk.outdated` | 오류 | `metadata.json` `build.sdk`(번들로 묶은 설치 SDK 버전)가 `rules.json` `minVersions.sdk`(1.0.0-alpha.4)보다 낮음. alpha.3 이하는 LXP 편집 화면 저장(초안 저장)이 실패 → `npm update @eliceio/cdk` 후 다시 build |
|
|
586
588
|
| `sdk.lib-copy` | 오류 | (프로젝트 검사만) 원본에 SDK 복사본 `lib/cdk.js`가 있음 (zip에 넣지 않음, SDK는 `package.json` 의존성을 번들로 묶음) → `ecdk doctor --fix` · `npm install` · 키트 바꾸고 `lib/cdk.js` 지우기 ([옛 프로젝트 옮기기](#옛-프로젝트-옮기기)) |
|
|
@@ -667,7 +669,7 @@ npm uninstall -g @eliceio/cdk-cli # CLI 자체 (npx로만 썼다면 지
|
|
|
667
669
|
| `cli.latest` | npm `latest`에 새 ecdk가 있음 → `ecdk update`. 오프라인 · 3초 안에 응답이 없으면 skip (`ECDK_NO_UPDATE_CHECK=1`이면 묻지 않음) |
|
|
668
670
|
| `project.config` | `package.json` `"ecdk"` 문법 · 필드 확인. 옛 `elice.config.json`은 `--fix`가 옮김 |
|
|
669
671
|
| `project.deps` | SDK(`@eliceio/cdk`) 설치(`npm install`) · 최소 버전 이상(`npm update @eliceio/cdk`). SDK 복사본 `lib/cdk.js`만 있으면 실패, `--fix`가 `package.json`에 넣음 |
|
|
670
|
-
| `project.grading` | `.ecdk/settings.json`의 `grading`이 서버 저장 규칙에 맞지 않거나 공개 값 `gradingType`과 어긋남 → `ecdk dev` 내용 편집에서 표시되는 칸을 고쳐 다시 저장 (파일을 지우면 내용도 사라짐)
|
|
672
|
+
| `project.grading` | `.ecdk/settings.json`의 `grading`이 서버 저장 규칙에 맞지 않거나 공개 값 `gradingType`과 어긋남 → `ecdk dev` 내용 편집에서 표시되는 칸을 고쳐 다시 저장 (파일을 지우면 내용도 사라짐). AI 평가 설정(`criteria` · `apiId`)만 있고 `grading`이 없으면 경고 → 편집 화면 `getGrading`으로 `rubric` 저장 |
|
|
671
673
|
| `project.quiz` | 퀴즈 템플릿만: 저장한 문항 · 정답 · 배점이 편집 화면 규칙과 다름 (프로젝트 `core/model.js`로 검증 · 정답 정규식 왕복 · `answer_key` · `scores` 자리 · `points`와 `scores` · `gradingType` · `pointsMode`). settings를 손으로 고쳤을 때 → `ecdk dev` 내용 편집에서 '초안으로 저장', 직접 고치는 법은 스킬 참고 문서 15 |
|
|
672
674
|
| `project.root` | `root` · `outDir` 확인 |
|
|
673
675
|
| `project.answer-import` | 콘텐츠가 정답 · 설정 파일을 불러옴 → 정답은 채점 설정으로 |
|
|
@@ -12,6 +12,7 @@ const usage = `사용법: ecdk create <폴더> [--template ${TEMPLATES.join('|')
|
|
|
12
12
|
blank: 퀴즈가 아닌 모든 자료(시뮬레이션 · 시각화 · 활동 · 설명 · 플래시카드 · 설문)를 직접 만들 때. 화면 3개 골격
|
|
13
13
|
steps: 여러 단계로 나눈 자료(도입 → 실험 → 정리). 키트 스테퍼(app.useStepper) + 단계마다 콘텐츠 레이아웃
|
|
14
14
|
document: 문서(PDF · PPTX) 한 편 보기. 편집 화면에서 문서를 올리고 PPTX 글자를 바로 고침 (.ppt · .pps · .ppsx는 .pptx · .pdf로 바꿔 올림)
|
|
15
|
+
video: 영상 한 편 보기. Elice 비디오 플레이어로 편집 화면에서 올리고, 끝까지 보면 자동 제출
|
|
15
16
|
--list: 템플릿 목록과 버전 · 설명 (템플릿마다 버전이 따로 있음)
|
|
16
17
|
--theme dark: Elice Design System 어두운 화면 (기본 light)
|
|
17
18
|
--no-install: npm install을 하지 않는다 (나중에 프로젝트 폴더에서 npm install)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const TEMPLATES: readonly ["quiz", "blank", "steps", "document"];
|
|
1
|
+
export declare const TEMPLATES: readonly ["quiz", "blank", "steps", "document", "video"];
|
|
2
2
|
export type TemplateName = (typeof TEMPLATES)[number];
|
|
3
3
|
/** 화면 테마. dark는 화면 HTML에 data-eds-theme="dark"를 붙여 EDS 어두운 팔레트를 쓴다 */
|
|
4
4
|
export declare const THEMES: readonly ["light", "dark"];
|
|
@@ -5,7 +5,7 @@ import { SDK_PACKAGE } from '../../core/sdk.js';
|
|
|
5
5
|
import { listTemplates } from '../../core/templates.js';
|
|
6
6
|
import { localSdkSpec } from './install.js';
|
|
7
7
|
|
|
8
|
-
const TEMPLATES = ['quiz', 'blank', 'steps', 'document'];
|
|
8
|
+
const TEMPLATES = ['quiz', 'blank', 'steps', 'document', 'video'];
|
|
9
9
|
/** 화면 테마. dark는 화면 HTML에 data-eds-theme="dark"를 붙여 EDS 어두운 팔레트를 쓴다 */
|
|
10
10
|
const THEMES = ['light', 'dark'];
|
|
11
11
|
/** 패키지 루트의 templates/ (es/commands/create/와 src/commands/create/ 모두 세 단계 위) */
|
|
@@ -2,7 +2,7 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { readFile, writeFile, access, appendFile } from 'node:fs/promises';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { resolve, join, dirname } from 'node:path';
|
|
5
|
-
import { loadConfig, CONFIG_FILE, planLegacyMigration, applyLegacyMigration, PACKAGE_FILE, PACKAGE_CONFIG_KEY, legacyGradingTypesWarning, legacyCompletionWarning,
|
|
5
|
+
import { loadConfig, CONFIG_FILE, planLegacyMigration, applyLegacyMigration, PACKAGE_FILE, PACKAGE_CONFIG_KEY, legacyGradingTypesWarning, legacyCompletionWarning, loadSavedSettings, savedGradingProblem, loadGrading, SETTINGS_DATA_FILE } from '../../core/config.js';
|
|
6
6
|
import { NO_UPDATE_CHECK_ENV, npmLatest, isNewer, LATEST_DOCTOR_TIMEOUT_MS } from '../../core/latest.js';
|
|
7
7
|
import { defaultMcpEnv, detectTargets, claudeRegistration, helpyRegisteredUrl, MCP_NAME, envOfUrl } from '../../core/mcp.js';
|
|
8
8
|
import { prepareContent } from '../../core/prepare.js';
|
|
@@ -281,6 +281,12 @@ function projectSkillDirs(dir, home = homedir()) {
|
|
|
281
281
|
* 옛 elice.config.json gradingTypes · 완료 정책은 경고, .ecdk/settings.json 형식이 틀리거나 서버 저장 규칙(partial_pattern 합 100 이상 ·
|
|
282
282
|
* 0~100 정수 · 개수 일치 · 1~50개 · 정규식, rubric 1만 자)에 맞지 않거나 공개 값 gradingType과 어긋나면 실패. publish 스킬은 실패면 settings를 올리지 않는다
|
|
283
283
|
*/
|
|
284
|
+
/** 저장한 settings가 AI 평가 자료처럼 보이는가: 평가 기준 목록(criteria: [{ name · points · description }])이나 mlapi apiId */
|
|
285
|
+
function looksAiGraded(settings) {
|
|
286
|
+
const criteria = settings.criteria;
|
|
287
|
+
const hasCriteria = Array.isArray(criteria) && criteria.some(c => typeof c === 'object' && c !== null && ('points' in c || 'description' in c));
|
|
288
|
+
return hasCriteria || typeof settings.apiId === 'string';
|
|
289
|
+
}
|
|
284
290
|
async function checkGrading(dir, config) {
|
|
285
291
|
const id = 'project.grading';
|
|
286
292
|
if (config.kind === 'description') return {
|
|
@@ -292,7 +298,8 @@ async function checkGrading(dir, config) {
|
|
|
292
298
|
const legacyCompletion = legacyCompletionWarning(config);
|
|
293
299
|
try {
|
|
294
300
|
// 서버 저장 규칙 · 공개 값 gradingType (publish 스킬이 settings를 올리기 전에 이 검사를 본다)
|
|
295
|
-
const
|
|
301
|
+
const saved = await loadSavedSettings(dir);
|
|
302
|
+
const problem = savedGradingProblem(saved);
|
|
296
303
|
if (problem) throw new Error(problem);
|
|
297
304
|
const grading = await loadGrading(dir, config);
|
|
298
305
|
if (legacy || legacyCompletion) return {
|
|
@@ -304,6 +311,16 @@ async function checkGrading(dir, config) {
|
|
|
304
311
|
auto: false
|
|
305
312
|
}
|
|
306
313
|
};
|
|
314
|
+
// AI 평가 설정(평가 기준 criteria · mlapi apiId)만 있고 채점 설정이 없음: on_graded면 0점, on_submit이면 늘 100점
|
|
315
|
+
if (!grading?.grading && looksAiGraded(saved)) return {
|
|
316
|
+
id,
|
|
317
|
+
level: 'warn',
|
|
318
|
+
message: `${SETTINGS_DATA_FILE}에 AI 평가 설정(criteria · apiId)이 있는데 채점 설정(grading)이 없습니다. 서버는 화면에서 계산한 점수를 쓰지 않아 '답안 확인 후 완료'(on_graded)면 0점 · 미완료, '제출하면 완료'(on_submit)면 늘 100점입니다.`,
|
|
319
|
+
fix: {
|
|
320
|
+
description: `편집 화면 useSave에 getGrading: () => ({ type: 'rubric', rubric: 평가 기준 글 })을 넘기고 ecdk dev의 '내용 편집'에서 다시 저장 (AI 피드백을 보여 주기만 하면 on_submit으로 올리고 점수가 AI 결과가 아님을 알리기)`,
|
|
321
|
+
auto: false
|
|
322
|
+
}
|
|
323
|
+
};
|
|
307
324
|
const message = grading?.grading ? `로컬 채점 ${grading.grading.type} (${SETTINGS_DATA_FILE})` : "로컬 채점 설정 없음: 제출만 받음 (ecdk dev의 '내용 편집'에서 답을 저장하면 학생 보기가 채점)";
|
|
308
325
|
return {
|
|
309
326
|
id,
|
package/es/core/sandbox.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { build } from 'esbuild';
|
|
2
2
|
import 'fflate';
|
|
3
3
|
import { rules } from '../rules/spec.js';
|
|
4
|
-
import { resolveRef } from '../rules/path.js';
|
|
5
4
|
import { classifyRef } from '../rules/refs.js';
|
|
5
|
+
import { resolveRef } from '../rules/path.js';
|
|
6
6
|
import { screenSizes, LAZY_FILE_MARK } from '../rules/size.js';
|
|
7
7
|
|
|
8
8
|
/**
|
package/es/rules/check.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { zipSync } from 'fflate';
|
|
2
2
|
import { isAllowedExternal, allowedOrigins } from './csp.js';
|
|
3
|
+
import { clientScoreFindings, CLIENT_SCORE_RULE, mlapiFetchLines, AI_WITHOUT_GRADING_RULE, AI_WITHOUT_GRADING_MESSAGE } from './grading.js';
|
|
3
4
|
import { parseManifest } from './manifest.js';
|
|
4
5
|
import { isUnsafePath, extname, resolveRef, globToRegExp } from './path.js';
|
|
5
6
|
import { privacyFindings, PRIVACY_RULE } from './privacy.js';
|
|
@@ -61,7 +62,11 @@ function answerKeyPath(value, path = []) {
|
|
|
61
62
|
*/
|
|
62
63
|
function checkScreenCode(files, manifest, add) {
|
|
63
64
|
const decoder = new TextDecoder();
|
|
64
|
-
const
|
|
65
|
+
const screenFiles = files.filter(f => /\.(?:m?js|html?)$/i.test(f.path) && !f.path.startsWith('lib/')).map(f => ({
|
|
66
|
+
path: f.path,
|
|
67
|
+
text: decoder.decode(f.data)
|
|
68
|
+
}));
|
|
69
|
+
const texts = screenFiles.map(f => f.text);
|
|
65
70
|
// ecdk build가 묶은 HTML에는 키트(useSubmit · useSave 정의)가 화면 코드와 함께 들어가 나눌 수 없다.
|
|
66
71
|
// 이런 zip은 판단하지 않는다: build가 묶기 전 원본으로 이미 검사했다
|
|
67
72
|
if (texts.some(t => /<script\b[^>]*\sdata-ecdk-bundle\b/i.test(t))) return;
|
|
@@ -70,6 +75,15 @@ function checkScreenCode(files, manifest, add) {
|
|
|
70
75
|
const uncommented = code.replace(/\/\*[\s\S]*?\*\/|(^|[^:])\/\/.*$/gm, '$1');
|
|
71
76
|
const savesGrading = /\buseGradingBlock\b|\bgetGrading\b|\bgrading\s*:/.test(uncommented);
|
|
72
77
|
if (manifest.entries.edit && savesGrading && !/\buseSubmit\b|\.submit\s*\(/.test(uncommented)) add('grading.no-submit', `편집 화면(${manifest.entries.edit})이 채점 설정(settings.grading)을 저장하는데 화면 코드에 제출(app.useSubmit · sdk.submit)이 없습니다. 학생이 제출할 수 없어 채점 설정을 쓸 곳이 없고, LXP에서 '제출하면 완료' · '채점해 완료'를 골라도 학생이 완료할 수 없습니다. 학생 화면에 제출을 넣거나, 채점하지 않는 자료면 편집 화면에서 채점 설정(useGradingBlock · getGrading)을 빼 주세요.`);
|
|
78
|
+
// AI(mlapi)로 답을 평가하고 제출하는데 채점 설정을 저장하지 않음: 서버는 화면 점수를 쓰지 않아 on_graded면 0점, on_submit이면 100점.
|
|
79
|
+
// 라이브러리 파일은 빼고, 첫 mlapi.fetch 줄을 가리킨다 (그 줄의 ecdk-ignore로 끔)
|
|
80
|
+
if (!savesGrading && /\buseSubmit\b|\.submit\s*\(/.test(uncommented)) {
|
|
81
|
+
const first = screenFiles.filter(f => !isVendorFile(f.path)).map(f => ({
|
|
82
|
+
path: f.path,
|
|
83
|
+
line: mlapiFetchLines(f.text)[0]
|
|
84
|
+
})).find(f => f.line !== undefined);
|
|
85
|
+
if (first) add(AI_WITHOUT_GRADING_RULE, AI_WITHOUT_GRADING_MESSAGE, first.path, first.line);
|
|
86
|
+
}
|
|
73
87
|
if (manifest.entries.edit && !/\buseSave\b|\bsaveSettings\s*\(|\bsaveContent\s*\(/.test(code)) add('edit.no-save', `편집 화면(${manifest.entries.edit})을 켰는데 저장(app.useSave · sdk.saveSettings)이 없습니다. 편집한 내용이 LXP로 넘어가지 않습니다.`);
|
|
74
88
|
}
|
|
75
89
|
/** 레이아웃 값을 적는 곳: HTML 속성 · JS 문자열 속 속성, dataset.ecLayout, setAttribute('data-ec-layout', …) */
|
|
@@ -307,7 +321,7 @@ function checkFiles(input, opts = {}) {
|
|
|
307
321
|
if (startsWithBom(commentaryFile.data)) add('file.bom', `학습 참고 내용 파일 맨 앞에 BOM(보이지 않는 글자)이 있습니다: ${commentaryFile.path}. "UTF-8(BOM 없음)"으로 다시 저장해 주세요.`, commentaryFile.path);
|
|
308
322
|
}
|
|
309
323
|
checkTemplate(manifest, opts, message => add('build.template-unknown', message, spec.manifest.file));
|
|
310
|
-
checkScreenCode(files, manifest, (id, message) => add(id, message, spec.manifest.file));
|
|
324
|
+
checkScreenCode(files, manifest, (id, message, path, line) => add(id, message, path ?? spec.manifest.file, line));
|
|
311
325
|
}
|
|
312
326
|
checkLayouts(files, spec, add);
|
|
313
327
|
checkAnswerLeak(files, opts.answerNeedles ?? [], add);
|
|
@@ -461,6 +475,9 @@ function checkFiles(input, opts = {}) {
|
|
|
461
475
|
if (!vendor && !f.path.startsWith('lib/')) {
|
|
462
476
|
const [first] = privacyFindings(scanned);
|
|
463
477
|
if (first) add(PRIVACY_RULE, first.message, f.path, first.line);
|
|
478
|
+
// 화면에서 계산한 점수를 제출 (서버 채점에 쓰이지 않음, 같은 파일은 처음 한 곳)
|
|
479
|
+
const [score] = clientScoreFindings(scanned);
|
|
480
|
+
if (score) add(CLIENT_SCORE_RULE, score.message, f.path, score.line);
|
|
464
481
|
}
|
|
465
482
|
}
|
|
466
483
|
return {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI로 평가하는 자료가 서버 채점을 잃지 않게 하는 경고 (client · warn, 정규식이라 흐름은 따라가지 않음).
|
|
3
|
+
*
|
|
4
|
+
* 서버(elice-material app/core/grading.py)는 답 안의 점수를 쓰지 않는다: `on_graded`인데 settings.grading이 없으면 0점 · 미완료,
|
|
5
|
+
* `on_submit`이면 AI 결과와 상관없이 100점. AI 평가는 편집 화면이 settings.grading을 `rubric`으로 저장해 서버가 하게 한다.
|
|
6
|
+
* (2026-11-20 운영 사고: 화면에서 mlapi로 점수를 계산해 submit({ text, score, scores })로 보내고 grading은 저장하지 않음)
|
|
7
|
+
*
|
|
8
|
+
* - grading.client-score: 제출(`submit(` 인자, `useSubmit(`의 getAnswer)에 넣는 객체에 score · scores · points key
|
|
9
|
+
* - grading.ai-without-grading: 화면 코드가 mlapi.fetch와 제출을 쓰는데 편집 화면이 저장하면서 채점 설정(getGrading · grading:)이 없음 (check.ts)
|
|
10
|
+
*/
|
|
11
|
+
export declare const CLIENT_SCORE_RULE = "grading.client-score";
|
|
12
|
+
export declare const AI_WITHOUT_GRADING_RULE = "grading.ai-without-grading";
|
|
13
|
+
export declare const CLIENT_SCORE_MESSAGE: (key: string) => string;
|
|
14
|
+
export declare const AI_WITHOUT_GRADING_MESSAGE = "\uD654\uBA74 \uCF54\uB4DC\uAC00 AI(mlapi.fetch)\uB97C \uBD80\uB974\uACE0 \uB2F5\uC744 \uC81C\uCD9C\uD558\uB294\uB370, \uD3B8\uC9D1 \uD654\uBA74\uC774 \uCC44\uC810 \uC124\uC815(settings.grading)\uC744 \uC800\uC7A5\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC11C\uBC84\uB294 \uD654\uBA74\uC5D0\uC11C \uACC4\uC0B0\uD55C \uC810\uC218\uB97C \uC4F0\uC9C0 \uC54A\uC544 LXP '\uB2F5\uC548 \uD655\uC778 \uD6C4 \uC644\uB8CC'(on_graded)\uBA74 0\uC810 \u00B7 \uBBF8\uC644\uB8CC, '\uC81C\uCD9C\uD558\uBA74 \uC644\uB8CC'(on_submit)\uBA74 AI \uACB0\uACFC\uC640 \uC0C1\uAD00\uC5C6\uC774 100\uC810\uC785\uB2C8\uB2E4. AI\uAC00 \uB2F5\uC744 \uD3C9\uAC00\uD558\uB294 \uC790\uB8CC\uB294 \uD3B8\uC9D1 \uD654\uBA74 useSave\uC5D0 getGrading: () => ({ type: 'rubric', rubric: \uD3C9\uAC00 \uAE30\uC900 \uAE00 })\uC744 \uB118\uACA8 \uC11C\uBC84\uAC00 AI\uB85C \uCC44\uC810\uD558\uAC8C \uD558\uACE0, \uD559\uC2B5 \uD654\uBA74\uC740 \uD559\uC2B5\uC790 \uB2F5\uB9CC \uC81C\uCD9C\uD558\uC138\uC694. AI \uD53C\uB4DC\uBC31\uC744 \uBCF4\uC5EC \uC8FC\uAE30\uB9CC \uD558\uACE0 \uCC44\uC810\uD558\uC9C0 \uC54A\uB294 \uC790\uB8CC\uBA74 \uADF8 mlapi.fetch \uC904 \uC704\uC5D0 // ecdk-ignore-next-line grading.ai-without-grading\uC640 \uC774\uC720\uB97C \uB0A8\uACA8 \uC8FC\uC138\uC694. \uCC38\uACE0: \uC2A4\uD0AC \uCC38\uACE0 \uBB38\uC11C 05-screen-code.md \"AI grading\"";
|
|
15
|
+
export interface GradingFinding {
|
|
16
|
+
line: number;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 화면 HTML · JS 하나에서 grading.client-score (주석뿐인 줄 · ecdk-ignore로 끈 줄 제외, 같은 줄은 하나만).
|
|
21
|
+
* `submit(…)`은 인자 전체, `useSubmit({…})`은 getAnswer 값만 본다 (onResult 등 점수를 보여 주는 코드는 제출이 아니다)
|
|
22
|
+
*/
|
|
23
|
+
export declare function clientScoreFindings(text: string): GradingFinding[];
|
|
24
|
+
/** 화면 코드 하나에서 grading.ai-without-grading으로 셀 mlapi.fetch 줄 (주석 · ecdk-ignore로 끈 줄 제외) */
|
|
25
|
+
export declare function mlapiFetchLines(text: string): number[];
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { callArgs } from './privacy.js';
|
|
2
|
+
import { lineAt } from './refs.js';
|
|
3
|
+
import { lineSkipper } from './skip.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* AI로 평가하는 자료가 서버 채점을 잃지 않게 하는 경고 (client · warn, 정규식이라 흐름은 따라가지 않음).
|
|
7
|
+
*
|
|
8
|
+
* 서버(elice-material app/core/grading.py)는 답 안의 점수를 쓰지 않는다: `on_graded`인데 settings.grading이 없으면 0점 · 미완료,
|
|
9
|
+
* `on_submit`이면 AI 결과와 상관없이 100점. AI 평가는 편집 화면이 settings.grading을 `rubric`으로 저장해 서버가 하게 한다.
|
|
10
|
+
* (2026-11-20 운영 사고: 화면에서 mlapi로 점수를 계산해 submit({ text, score, scores })로 보내고 grading은 저장하지 않음)
|
|
11
|
+
*
|
|
12
|
+
* - grading.client-score: 제출(`submit(` 인자, `useSubmit(`의 getAnswer)에 넣는 객체에 score · scores · points key
|
|
13
|
+
* - grading.ai-without-grading: 화면 코드가 mlapi.fetch와 제출을 쓰는데 편집 화면이 저장하면서 채점 설정(getGrading · grading:)이 없음 (check.ts)
|
|
14
|
+
*/
|
|
15
|
+
const CLIENT_SCORE_RULE = 'grading.client-score';
|
|
16
|
+
const AI_WITHOUT_GRADING_RULE = 'grading.ai-without-grading';
|
|
17
|
+
const DOC = '참고: 스킬 참고 문서 05-screen-code.md "AI grading"';
|
|
18
|
+
const CLIENT_SCORE_MESSAGE = key => `제출하는 답에 점수 key(${key})가 있습니다. 화면에서 계산한 점수는 서버 채점에 쓰이지 않습니다. settings.grading(rubric/pattern)으로 채점하세요: 서버는 답 전체를 채점 글로 보므로 학습자 답(글이나 채점에 필요한 최소 JSON)만 제출하고, AI가 평가하는 자료는 편집 화면 useSave에 getGrading: () => ({ type: 'rubric', rubric: 평가 기준 글 })을 넘기세요. 점수를 보여 주기만 하는 코드면 그 줄 위에 // ecdk-ignore-next-line ${CLIENT_SCORE_RULE}와 이유를 남겨 주세요. ${DOC}`;
|
|
19
|
+
const AI_WITHOUT_GRADING_MESSAGE = `화면 코드가 AI(mlapi.fetch)를 부르고 답을 제출하는데, 편집 화면이 채점 설정(settings.grading)을 저장하지 않습니다. 서버는 화면에서 계산한 점수를 쓰지 않아 LXP '답안 확인 후 완료'(on_graded)면 0점 · 미완료, '제출하면 완료'(on_submit)면 AI 결과와 상관없이 100점입니다. AI가 답을 평가하는 자료는 편집 화면 useSave에 getGrading: () => ({ type: 'rubric', rubric: 평가 기준 글 })을 넘겨 서버가 AI로 채점하게 하고, 학습 화면은 학습자 답만 제출하세요. AI 피드백을 보여 주기만 하고 채점하지 않는 자료면 그 mlapi.fetch 줄 위에 // ecdk-ignore-next-line ${AI_WITHOUT_GRADING_RULE}와 이유를 남겨 주세요. ${DOC}`;
|
|
20
|
+
const SCORE_KEYS = new Set(['score', 'scores', 'points']);
|
|
21
|
+
const SUBMIT_CALL = /\b(submit|useSubmit)\s*\(/g;
|
|
22
|
+
const GET_ANSWER = /\bgetAnswer\b/g;
|
|
23
|
+
/**
|
|
24
|
+
* 객체 리터럴(가장 안쪽 괄호가 `{`)의 key 중 점수 이름. `{ score }` · `{ score: s }` · `{ 'score': s }`.
|
|
25
|
+
* 한 줄 문자열과 템플릿 문자열 안은 보지 않는다
|
|
26
|
+
*/
|
|
27
|
+
function scoreKeys(text) {
|
|
28
|
+
const out = [];
|
|
29
|
+
const stack = [];
|
|
30
|
+
let prev = '';
|
|
31
|
+
for (let i = 0; i < text.length; i++) {
|
|
32
|
+
const c = text[i] ?? '';
|
|
33
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
34
|
+
const start = i;
|
|
35
|
+
for (i++; i < text.length && text[i] !== c; i++) {
|
|
36
|
+
if (text[i] === '\\') i++;else if (c !== '`' && text[i] === '\n') break;
|
|
37
|
+
}
|
|
38
|
+
// 따옴표 key: { 'score': x }
|
|
39
|
+
const inner = text.slice(start + 1, i);
|
|
40
|
+
const after = text.slice(i + 1).match(/^\s*:(?!:)/);
|
|
41
|
+
if (c !== '`' && after && stack.at(-1) === '{' && (prev === '{' || prev === ',') && SCORE_KEYS.has(inner)) out.push({
|
|
42
|
+
key: inner,
|
|
43
|
+
index: start
|
|
44
|
+
});
|
|
45
|
+
prev = c;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (/\s/.test(c)) continue;
|
|
49
|
+
if ('({['.includes(c)) stack.push(c);else if (')}]'.includes(c)) stack.pop();else if (/[A-Za-z_$]/.test(c)) {
|
|
50
|
+
const word = text.slice(i).match(/^[A-Za-z_$][\w$]*/)?.[0] ?? c;
|
|
51
|
+
const after = text.slice(i + word.length).match(/^\s*(::|[:,}])/)?.[1];
|
|
52
|
+
if (SCORE_KEYS.has(word) && stack.at(-1) === '{' && (prev === '{' || prev === ',') && (after === ':' || after === ',' || after === '}')) out.push({
|
|
53
|
+
key: word,
|
|
54
|
+
index: i
|
|
55
|
+
});
|
|
56
|
+
i += word.length - 1;
|
|
57
|
+
prev = 'w';
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
prev = c;
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
/** `getAnswer: …` · `getAnswer() {…}`의 값 (같은 객체의 다음 `,` · `}`까지) */
|
|
65
|
+
function propertyValue(text, at) {
|
|
66
|
+
let depth = 0;
|
|
67
|
+
let i = at;
|
|
68
|
+
for (; i < text.length; i++) {
|
|
69
|
+
const c = text[i];
|
|
70
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
71
|
+
for (i++; i < text.length && text[i] !== c; i++) if (text[i] === '\\') i++;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (c === '(' || c === '{' || c === '[') depth++;else if (c === ')' || c === '}' || c === ']') {
|
|
75
|
+
if (depth === 0) break;
|
|
76
|
+
depth--;
|
|
77
|
+
} else if (c === ',' && depth === 0) break;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
text: text.slice(at, i),
|
|
81
|
+
index: at
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 화면 HTML · JS 하나에서 grading.client-score (주석뿐인 줄 · ecdk-ignore로 끈 줄 제외, 같은 줄은 하나만).
|
|
86
|
+
* `submit(…)`은 인자 전체, `useSubmit({…})`은 getAnswer 값만 본다 (onResult 등 점수를 보여 주는 코드는 제출이 아니다)
|
|
87
|
+
*/
|
|
88
|
+
function clientScoreFindings(text) {
|
|
89
|
+
const skip = lineSkipper(text);
|
|
90
|
+
const seen = new Set();
|
|
91
|
+
const out = [];
|
|
92
|
+
for (const m of text.matchAll(SUBMIT_CALL)) {
|
|
93
|
+
const open = m.index + m[0].length - 1;
|
|
94
|
+
const args = callArgs(text, open);
|
|
95
|
+
const argsAt = open + 1;
|
|
96
|
+
const parts = [];
|
|
97
|
+
if (m[1] === 'submit') parts.push({
|
|
98
|
+
text: args,
|
|
99
|
+
index: argsAt
|
|
100
|
+
});else for (const g of args.matchAll(GET_ANSWER)) {
|
|
101
|
+
const v = propertyValue(args, g.index + g[0].length);
|
|
102
|
+
parts.push({
|
|
103
|
+
text: v.text,
|
|
104
|
+
index: argsAt + v.index
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
for (const part of parts) for (const k of scoreKeys(part.text)) {
|
|
108
|
+
const line = lineAt(text, part.index + k.index);
|
|
109
|
+
if (seen.has(line) || skip.isSkipped(line, CLIENT_SCORE_RULE)) continue;
|
|
110
|
+
seen.add(line);
|
|
111
|
+
out.push({
|
|
112
|
+
line,
|
|
113
|
+
message: CLIENT_SCORE_MESSAGE(k.key)
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out.sort((a, b) => a.line - b.line);
|
|
118
|
+
}
|
|
119
|
+
const MLAPI_FETCH = /\bmlapi\??\.fetch\s*\(/g;
|
|
120
|
+
/** 화면 코드 하나에서 grading.ai-without-grading으로 셀 mlapi.fetch 줄 (주석 · ecdk-ignore로 끈 줄 제외) */
|
|
121
|
+
function mlapiFetchLines(text) {
|
|
122
|
+
const skip = lineSkipper(text);
|
|
123
|
+
const lines = [];
|
|
124
|
+
for (const m of text.matchAll(MLAPI_FETCH)) {
|
|
125
|
+
const line = lineAt(text, m.index);
|
|
126
|
+
if (!skip.isSkipped(line, AI_WITHOUT_GRADING_RULE)) lines.push(line);
|
|
127
|
+
}
|
|
128
|
+
return lines;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { AI_WITHOUT_GRADING_MESSAGE, AI_WITHOUT_GRADING_RULE, CLIENT_SCORE_MESSAGE, CLIENT_SCORE_RULE, clientScoreFindings, mlapiFetchLines };
|
package/es/rules/privacy.d.ts
CHANGED
|
@@ -16,5 +16,7 @@ export interface PrivacyFinding {
|
|
|
16
16
|
line: number;
|
|
17
17
|
message: string;
|
|
18
18
|
}
|
|
19
|
+
/** `(` 다음부터 짝이 맞는 `)`까지 (한 줄 문자열 '…' · "…" 안 괄호는 셈하지 않음, 너무 길면 자름) */
|
|
20
|
+
export declare function callArgs(text: string, open: number, max?: number): string;
|
|
19
21
|
/** 화면 HTML · JS 하나에서 찾은 곳 (주석뿐인 줄 · ecdk-ignore로 끈 줄 제외, 같은 줄은 하나만) */
|
|
20
22
|
export declare function privacyFindings(text: string): PrivacyFinding[];
|
package/es/rules/privacy.js
CHANGED
package/es/rules.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const version="0.19.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","partial_pattern","rubric"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[]};const minVersions={sdk:"1.0.0-alpha.4"};const layouts={content:["single","split","stage","media"],regions:["main","aside","stage","controls","readout","actions"]};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576,maxScreenBytes:1572864};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"새 창 열기 (sandbox에서 막힘)"},{id:"api.external-send",pattern:"(?<!\\bmlapi\\??\\.)\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"(?<!\\bmlapi\\??\\.)\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"limit.screen-size",level:"warn",scope:"client",title:"화면 하나를 열 때 받는 JS · CSS가 큼 (기준 limits.maxScreenBytes, 큰 라이브러리는 import()로)"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"layout.unknown",level:"warn",scope:"client",title:"data-ec-layout · data-ec-region에 키트가 모르는 값 (single · split · stage · media, main · aside · stage · controls · readout · actions)"},{id:"layout.own-step-nav",level:"warn",scope:"client",title:"화면 코드가 이전 · 다음 버튼을 직접 그림 (LXP 이전 · 다음 막대와 헷갈림, 키트 app.useStepper)"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기는 통과)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"새 창 열기"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.answer-in-bundle",level:"warn",scope:"client",title:"편집 화면에 저장한 정답(.ecdk/settings.json 채점 설정)과 같은 글이 zip에 들어갈 파일에 있음 (프로젝트 검사만)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"privacy.personal-field",level:"warn",scope:"client",title:"학습자 개인정보를 받는 입력 칸(전화 · 이메일 · 이름 autocomplete 등)이나 개인정보 · 학습자 이름(account.fullname)을 제출 · 저장 · AI 호출로 보냄 (익명 id account.anonymousId, 이름은 보여 주기만)"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,layouts:layouts,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
|
|
1
|
+
const version="0.20.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},graderTypes:["pattern","partial_pattern","rubric"],commentaryFile:"commentary.txt",defaultEntry:"index.html"};const externalAllow={"style-src":[],"font-src":[]};const minVersions={sdk:"1.0.0-alpha.4"};const layouts={content:["single","split","stage","media"],regions:["main","aside","stage","controls","readout","actions"]};const limits={maxZipBytes:20971520,maxUnpackedBytes:209715200,maxFiles:300,maxEntries:3000,warnRatio:0.8,maxImageBytes:1048576,maxScreenBytes:1572864};const allowedExtensions=["html","htm","css","js","mjs","json","map","txt","md","csv","xml","vtt","svg","png","jpg","jpeg","gif","webp","avif","ico","bmp","mp3","wav","ogg","m4a","mp4","webm","woff","woff2","ttf","otf","glb","gltf","bin","wasm","pdf"];const imageExtensions=["png","jpg","jpeg","gif","webp","avif","bmp","svg"];const excluded={secret:{level:"error",files:[".env",".env.*","elice.config.*","grading.json","answers.*","*.pem","*.key"],dirs:[]},dev:{level:"error",files:[],dirs:[".git","node_modules",".ecdk"]},junk:{level:"warn",files:[".DS_Store","Thumbs.db","desktop.ini"],dirs:["__MACOSX"]}};const forbiddenApis=[{id:"api.parent-access",pattern:"\\bwindow\\.(?:top|parent)\\b|\\b(?:top|parent)\\.(?:document|location)\\b",title:"부모 창 직접 접근 (다른 출처라 막힘, SDK 사용)"},{id:"api.cookie",pattern:"\\bdocument\\.cookie\\b",title:"쿠키 사용 (이 브라우저에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.storage",pattern:"\\b(?:localStorage|sessionStorage|indexedDB)\\b",title:"브라우저 저장소 사용 (이 브라우저 · 기기에만 남고 학습 기록이 아님, 남길 입력값은 SDK로 저장)"},{id:"api.eval",pattern:"\\beval\\s*\\(|\\bnew\\s+Function\\s*\\(|\\bset(?:Timeout|Interval)\\s*\\(\\s*[\"'`]",title:"eval · new Function · 문자열 setTimeout 사용"},{id:"api.dialog",pattern:"\\b(?:alert|confirm|prompt)\\s*\\(",title:"alert · confirm · prompt 사용 (sandbox에서 막힘, 화면 안 메시지로)"},{id:"api.window-open",pattern:"\\bwindow\\.open\\s*\\(",title:"새 창 열기 (sandbox에서 막힘)"},{id:"api.external-send",pattern:"(?<!\\bmlapi\\??\\.)\\b(?:fetch|sendBeacon|EventSource|WebSocket)\\s*\\(\\s*['\"`](?:https?|wss?):\\/\\/|\\.open\\(\\s*['\"`][A-Za-z]+['\"`]\\s*,\\s*['\"`]https?:\\/\\/",title:"외부 주소로 요청을 보냄 (학생 정보 유출 위험)"},{id:"sec.html-injection",pattern:"\\.(?:inner|outer)HTML\\s*\\+?=(?!=)(?!\\s*(?:'[^'\\n]*'|\"[^\"\\n]*\"|`[^`$\\n]*`)\\s*(?:[;,)}\\n]|$))|\\.insertAdjacentHTML\\s*\\(|\\bdocument\\.write(?:ln)?\\s*\\(|\\bdangerouslySetInnerHTML\\b",title:"HTML 문자열을 그대로 넣음 (XSS 위험, textContent나 이스케이프 사용)"},{id:"sec.redirect",pattern:"\\blocation(?:\\.href)?\\s*=(?!=)(?!\\s*[\"'`][^\"'`$]*[\"'`])|\\blocation\\.(?:replace|assign)\\s*\\((?!\\s*[\"'`][^\"'`$]*[\"'`]\\s*\\))",title:"주소를 값으로 바꿈 (열린 리디렉션 · javascript: XSS 위험)"},{id:"sec.postmessage-wildcard",pattern:"\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",title:"postMessage 대상이 * (아무 창이나 받을 수 있음)"},{id:"sandbox.fetch-local",pattern:"(?<!\\bmlapi\\??\\.)\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없으면 CORS로 막힘)"}];const secretPatterns=[{source:"elice-hardcoded-private-key · detected-private-key · detected-pgp-private-key-block",title:"개인키",pattern:"-----BEGIN[ A-Z0-9_-]*PRIVATE KEY(?: BLOCK)?-----"},{source:"elice-hardcoded-secret",title:"하드코딩된 비밀 값",pattern:"(?:secret|token|api[_-]?key|access[_-]?key|password|passwd)\\s*[:=]\\s*[\"'][A-Za-z0-9_\\-/+]{16,}[\"']",flags:"i",not:"os\\.environ|getenv|process\\.env|dotenv|\\$\\{|<[a-z_]+>|example|dummy|placeholder|changeme|xxxx|your[_-]"},{source:"detected-aws-access-key-id-value",title:"AWS 액세스 키",pattern:"\\b(?:A3T[A-Z0-9]|AKIA|AGPA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\\b",not:"example|sample|test|fake"},{source:"detected-aws-secret-access-key",title:"AWS 비밀 키",pattern:"[\"'`]?aws_?\\w*secret_?\\w*[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?[A-Za-z0-9/+=]{40}",flags:"i",not:"example|sample|test|fake|xxxxxx"},{source:"detected-aws-session-token",title:"AWS 세션 토큰",pattern:"AWS_SESSION_TOKEN\\s*(?::|=>|=)\\s*[A-Za-z0-9/+=]{16,}",flags:"i",not:"example|sample|test|fake"},{source:"detected-aws-appsync-graphql-key",title:"AWS AppSync 키",pattern:"da2-[a-z0-9]{26}"},{source:"detected-amazon-mws-auth-token",title:"Amazon MWS 토큰",pattern:"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},{source:"detected-artifactory-token",title:"Artifactory 토큰",pattern:"\\bAKC[a-zA-Z0-9]{10,}\\n",not:"sha(?:128|256|512)"},{source:"detected-artifactory-password",title:"Artifactory 비밀번호",pattern:"[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy].*\\bAP[\\dA-F][a-zA-Z0-9]{8,}|\\bAP[\\dA-F][a-zA-Z0-9]{8,}.*[Aa][Rr][Tt][Ii][-_]?[Ff][Aa][Cc][Tt][Oo][Rr][Yy]",not:"sha(?:1|2|3|118|256|512)"},{source:"detected-bcrypt-hash",title:"bcrypt 해시",pattern:"\\$2[aby]?\\$\\d+\\$[./A-Za-z0-9]{53}"},{source:"detected-codeclimate",title:"Code Climate 토큰",pattern:"codeclima.{0,50}[\"'`]?[0-9a-f]{64}",flags:"i"},{source:"detected-etc-shadow",title:"/etc/shadow 내용",pattern:"^\\s*root:[x!*]*:\\d*:\\d*",flags:"m"},{source:"detected-facebook-access-token",title:"Facebook 액세스 토큰",pattern:"EAACEdEose0cBA[0-9A-Za-z]+|EAAAACZAVC6ygB[0-9A-Za-z]+|EAAAAZAw4[0-9A-Za-z]+"},{source:"detected-facebook-oauth",title:"Facebook OAuth 비밀",pattern:"[fF][aA][cC][eE][bB][oO][oO][kK].*[tT][oO][kK][eE][nN].*[\"'`]?[0-9a-f]{32}"},{source:"detected-google-gcm-service-account",title:"Google 서비스 계정 키",pattern:"[\"'`]?type[\"'`]?\\s{0,50}(?::|=>|=)\\s{0,50}[\"'`]?service_account"},{source:"detected-google-oauth-access-token",title:"Google OAuth 토큰",pattern:"ya29\\.[0-9A-Za-z_-]+"},{source:"detected-heroku-api-key",title:"Heroku API 키",pattern:"[hH][eE][rR][oO][kK][uU].*[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"},{source:"detected-hockeyapp",title:"HockeyApp 토큰",pattern:"hockey.{0,50}[\"'`]?[0-9a-f]{32}",flags:"i"},{source:"detected-mailchimp-api-key",title:"Mailchimp API 키",pattern:"[0-9a-f]{32}-us\\d{1,2}"},{source:"detected-mailgun-api-key",title:"Mailgun API 키",pattern:"key-[0-9a-zA-Z]{32}"},{source:"detected-onfido-live-api-token",title:"Onfido API 토큰",pattern:"api_live(?:_[a-zA-Z]{2})?\\.[a-zA-Z0-9_-]{11}\\.[a-zA-Z0-9_-]{32}"},{source:"detected-outlook-team",title:"Outlook 웹훅",pattern:"https://outlook\\.office\\.com/webhook/[0-9a-f-]{36}"},{source:"detected-paypal-braintree-access-token",title:"PayPal Braintree 토큰",pattern:"access_token\\$production\\$[0-9a-z]{16}\\$[0-9a-z]{32}"},{source:"detected-picatic-api-key",title:"Picatic API 키",pattern:"sk_live_[0-9a-z]{32}"},{source:"detected-sauce-token",title:"Sauce Labs 토큰",pattern:"sauce.{0,50}[\"'`]?[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}",flags:"i"},{source:"detected-slack-token",title:"Slack 토큰",pattern:"xox[pboa]-\\d{12}-\\d{12}-\\d{12}-[a-z0-9]{32}|xox.-\\d{12}-\\d{12}-[0-9a-zA-Z]{24}"},{source:"detected-slack-webhook",title:"Slack 웹훅",pattern:"https://hooks\\.slack\\.com/services/T[a-zA-Z0-9_]{8,10}/B[a-zA-Z0-9_]{8,10}/[a-zA-Z0-9_]{24}",not:"T00000000/B00000000/X{24}"},{source:"detected-sonarqube-docs-api-key",title:"SonarQube 토큰",pattern:"sonar[a-z0-9_.-]{0,30}(?:token|key|login|password|pass|secret|auth)?\\s*[:=]\\s*\\\\?[\"'`]?[0-9a-f]{40}\\b",flags:"i"},{source:"detected-square-access-token",title:"Square 액세스 토큰",pattern:"sq0atp-[0-9A-Za-z_-]{22}"},{source:"detected-square-oauth-secret",title:"Square OAuth 비밀",pattern:"sq0csp-[0-9A-Za-z\\\\_-]{43}"},{source:"detected-ssh-password",title:"sshpass 비밀번호",pattern:"sshpass[ ]-p\\s*['\"]"},{source:"detected-stripe-api-key",title:"Stripe API 키",pattern:"sk_live_[0-9a-zA-Z]{24}"},{source:"detected-stripe-restricted-api-key",title:"Stripe 제한 키",pattern:"rk_live_[0-9a-zA-Z]{24}"},{source:"detected-telegram-bot-api-key",title:"Telegram 봇 토큰",pattern:"\\d+:AA[0-9A-Za-z_-]{33}",not:"go\\.mod|v\\d+\\.\\d+\\.\\d+"},{source:"detected-twilio-api-key",title:"Twilio API 키",pattern:"SK[0-9a-fA-F]{32}"},{source:"detected-username-and-password-in-uri",title:"주소에 들어 있는 아이디 · 비밀번호",pattern:"[A-Za-z0-9+.-]*(?:http|sql|ftp|smtp)[A-Za-z0-9+.-]*://\\{?[A-Za-z][A-Za-z0-9_-]{5,31}\\}?:(?=[^\\s@/]*\\d)(?=[^\\s@/]*[a-z])(?=[^\\s@/]*[A-Z])(?=[^\\s@/]*[!-.:-?\\[-`{-~])[^\\s@/]{6,32}@"}];const rules=[{id:"manifest.missing",level:"error",scope:"server",title:"metadata.json 없음"},{id:"manifest.invalid",level:"error",scope:"server",title:"metadata.json 형식 오류"},{id:"manifest.entry-missing",level:"error",scope:"server",title:"metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"},{id:"manifest.commentary-missing",level:"error",scope:"server",title:"학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"},{id:"manifest.grading-types",level:"warn",scope:"server",title:"쓰지 않는 gradingTypes (완료 정책은 LXP 설정, 채점 방식은 편집 화면)"},{id:"manifest.completion-policies-ignored",level:"warn",scope:"client",title:"쓰지 않는 completionPolicies · 완료 정책 화면(screens.completionPolicy) (완료 정책은 LXP 설정, build가 zip에서 뺌)"},{id:"entry.missing",level:"error",scope:"server",title:"학생 화면 진입 파일 없음"},{id:"entry.nested",level:"error",scope:"server",title:"폴더째 묶은 zip (metadata.json이 최상위에 없음)"},{id:"input.not-zip",level:"error",scope:"server",title:"zip이 아닌 업로드 (HTML 파일 하나 등)"},{id:"limit.zip-size",level:"error",scope:"server",title:"zip 크기 한도 초과"},{id:"limit.file-count",level:"error",scope:"server",title:"파일 개수 한도 초과"},{id:"limit.unpacked-size",level:"error",scope:"server",title:"풀면 너무 큰 zip (압축 폭탄 의심)"},{id:"limit.near",level:"warn",scope:"client",title:"한도에 가까움"},{id:"limit.screen-size",level:"warn",scope:"client",title:"화면 하나를 열 때 받는 JS · CSS가 큼 (기준 limits.maxScreenBytes, 큰 라이브러리는 import()로)"},{id:"path.unsafe",level:"error",scope:"server",title:"안전하지 않은 경로 (절대경로, .., 역슬래시, 정규화 안 됨)"},{id:"path.case-collision",level:"error",scope:"server",title:"대소문자만 다른 경로"},{id:"path.non-ascii",level:"warn",scope:"client",title:"공백·한글 등 ASCII 밖 문자가 든 경로"},{id:"file.extension",level:"error",scope:"server",title:"허용하지 않는 확장자"},{id:"file.secret",level:"error",scope:"server",title:"정답·비밀 파일 포함"},{id:"file.dev",level:"error",scope:"server",title:"개발용 폴더 포함"},{id:"file.junk",level:"warn",scope:"server",title:"운영체제가 만든 불필요한 파일"},{id:"file.large-image",level:"warn",scope:"client",title:"1MB 넘는 이미지"},{id:"file.encoding",level:"error",scope:"client",title:"UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"},{id:"file.bom",level:"warn",scope:"client",title:"학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"},{id:"content.answer-key",level:"warn",scope:"client",title:"학생에게 내려가는 JSON에 정답처럼 보이는 키"},{id:"grading.no-submit",level:"warn",scope:"client",title:"편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"},{id:"grading.client-score",level:"warn",scope:"client",title:"제출하는 답에 화면에서 계산한 점수(score · scores · points key)를 넣음 (서버는 답 안 점수를 쓰지 않음, settings.grading rubric · pattern으로 채점)"},{id:"grading.ai-without-grading",level:"warn",scope:"client",title:"화면이 AI(mlapi.fetch)를 부르고 제출하는데 편집 화면이 채점 설정(settings.grading)을 저장하지 않음 (on_graded면 0점 · 미완료, on_submit이면 늘 100점. AI 평가는 rubric으로)"},{id:"edit.no-save",level:"warn",scope:"client",title:"편집 화면인데 저장이 없음"},{id:"project.legacy-file",level:"warn",scope:"client",title:"더 쓰지 않는 프로젝트 파일(elice.config.json · content.json · grading.json)이 남아 있음 (프로젝트 검사만, ADR 0011)"},{id:"build.template-unknown",level:"warn",scope:"client",title:"metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"},{id:"layout.unknown",level:"warn",scope:"client",title:"data-ec-layout · data-ec-region에 키트가 모르는 값 (single · split · stage · media, main · aside · stage · controls · readout · actions)"},{id:"layout.own-step-nav",level:"warn",scope:"client",title:"화면 코드가 이전 · 다음 버튼을 직접 그림 (LXP 이전 · 다음 막대와 헷갈림, 키트 app.useStepper)"},{id:"ref.missing",level:"error",scope:"client",title:"참조한 파일이 없음"},{id:"ref.case-mismatch",level:"error",scope:"client",title:"참조 경로의 대소문자가 실제 파일과 다름"},{id:"ref.root-absolute",level:"error",scope:"client",title:"/로 시작하는 경로 · 자기 폴더가 아닌 <base href> (배포 주소 /s/{서명}/ 아래에서 깨짐)"},{id:"ref.external-script",level:"error",scope:"client",title:"외부 스크립트 (zip 안에 넣고 상대경로로)"},{id:"ref.external-request",level:"error",scope:"client",title:"외부 리소스 요청 (이미지 · 글꼴 · 영상 · CSS, 콘텐츠 CSP가 막음: zip 안에 넣기)"},{id:"ref.external-font",level:"warn",scope:"client",title:"허용 목록(externalAllow)의 외부 글꼴 (망분리 기관에서는 받지 못해 기본 글꼴로 보일 수 있음)"},{id:"ref.insecure",level:"error",scope:"client",title:"http:// 외부 리소스 (https 페이지 · 콘텐츠 CSP가 막음)"},{id:"ref.vendor-external-url",level:"warn",scope:"client",title:"라이브러리 파일 안의 외부 주소 (실행 중 외부를 부르면 콘텐츠 CSP가 막음, ecdk dev 로그 확인)"},{id:"ref.script-not-public",level:"error",scope:"client",title:"type=\"module\" 없는 <script src>가 public/ 밖 파일 (프로젝트 검사만. build가 묶지 않고 zip에도 넣지 않음, type=\"module\"을 붙이거나 public/으로)"},{id:"sandbox.module-src",level:"warn",scope:"client",title:"모듈 스크립트 파일(<script type=\"module\" src>): 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"},{id:"sandbox.fetch-local",level:"warn",scope:"client",title:"zip 안 파일을 fetch · 변수 import() · Worker로 읽음: 콘텐츠 서버의 sandbox 헤더에 allow-same-origin이 없는 LXP에서는 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"},{id:"html.img-alt",level:"warn",scope:"client",title:"대체 텍스트 없는 이미지"},{id:"html.iframe",level:"error",scope:"client",title:"src로 띄우는 iframe · frame, object · embed (콘텐츠 CSP가 막음, 영상은 Elice 비디오 자료로, srcdoc 미리보기는 통과)"},{id:"html.form",level:"warn",scope:"client",title:"form 제출 (sandbox · CSP form-action이 막음, 버튼 click으로 처리)"},{id:"api.external-send",level:"error",scope:"client",title:"외부 주소로 요청 보냄"},{id:"api.parent-access",level:"warn",scope:"client",title:"부모 창 직접 접근"},{id:"api.cookie",level:"warn",scope:"client",title:"쿠키 사용 (학습 기록이 아님)"},{id:"api.storage",level:"warn",scope:"client",title:"브라우저 저장소 사용 (학습 기록이 아님)"},{id:"api.eval",level:"warn",scope:"client",title:"eval · new Function 사용"},{id:"api.dialog",level:"error",scope:"client",title:"alert · confirm · prompt 사용"},{id:"api.window-open",level:"error",scope:"client",title:"새 창 열기"},{id:"sec.secret",level:"error",scope:"server",title:"비밀 값 (키 · 토큰 · 비밀번호)"},{id:"sec.answer-in-bundle",level:"warn",scope:"client",title:"편집 화면에 저장한 정답(.ecdk/settings.json 채점 설정)과 같은 글이 zip에 들어갈 파일에 있음 (프로젝트 검사만)"},{id:"sec.html-injection",level:"warn",scope:"client",title:"HTML 문자열 삽입"},{id:"sec.redirect",level:"warn",scope:"client",title:"주소를 값으로 바꿈"},{id:"sec.postmessage-wildcard",level:"warn",scope:"client",title:"postMessage 대상 *"},{id:"privacy.personal-field",level:"warn",scope:"client",title:"학습자 개인정보를 받는 입력 칸(전화 · 이메일 · 이름 autocomplete 등)이나 개인정보 · 학습자 이름(account.fullname)을 제출 · 저장 · AI 호출로 보냄 (익명 id account.anonymousId, 이름은 보여 주기만)"},{id:"sdk.outdated",level:"error",scope:"client",title:"SDK가 최소 버전보다 낮음 (metadata.json build.sdk < rules.json minVersions.sdk. alpha.3 이하는 LXP 편집 화면 저장(초안) 실패, npm update @eliceio/cdk)"},{id:"sdk.lib-copy",level:"error",scope:"client",title:"SDK 복사본 lib/cdk.js (zip에 넣지 않음, 프로젝트 검사만. SDK는 package.json 의존성 @eliceio/cdk를 build가 번들로 묶음)"}];var rulesJson = {version:version,manifest:manifest,externalAllow:externalAllow,minVersions:minVersions,layouts:layouts,limits:limits,allowedExtensions:allowedExtensions,imageExtensions:imageExtensions,excluded:excluded,forbiddenApis:forbiddenApis,secretPatterns:secretPatterns,rules:rules};
|
|
2
2
|
|
|
3
3
|
export { allowedExtensions, rulesJson as default, excluded, externalAllow, forbiddenApis, imageExtensions, layouts, limits, manifest, minVersions, rules, secretPatterns, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliceio/cdk-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "교육자용 Custom HTML 콘텐츠 CLI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"rollup": "^4.0.0",
|
|
47
47
|
"tslib": "^2.6.1",
|
|
48
48
|
"typescript": "~5.9.3",
|
|
49
|
-
"@eliceio/cdk": "^1.
|
|
49
|
+
"@eliceio/cdk": "^1.4.1"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"prebuild": "del-cli \"buildcache/*\" \"es/*\"",
|
package/rules.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.20.0",
|
|
3
3
|
"manifest": {
|
|
4
4
|
"file": "metadata.json",
|
|
5
5
|
"kinds": ["material", "description"],
|
|
@@ -502,6 +502,18 @@
|
|
|
502
502
|
"scope": "client",
|
|
503
503
|
"title": "편집 화면이 채점 설정을 저장하는데 화면 코드에 제출이 없음"
|
|
504
504
|
},
|
|
505
|
+
{
|
|
506
|
+
"id": "grading.client-score",
|
|
507
|
+
"level": "warn",
|
|
508
|
+
"scope": "client",
|
|
509
|
+
"title": "제출하는 답에 화면에서 계산한 점수(score · scores · points key)를 넣음 (서버는 답 안 점수를 쓰지 않음, settings.grading rubric · pattern으로 채점)"
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"id": "grading.ai-without-grading",
|
|
513
|
+
"level": "warn",
|
|
514
|
+
"scope": "client",
|
|
515
|
+
"title": "화면이 AI(mlapi.fetch)를 부르고 제출하는데 편집 화면이 채점 설정(settings.grading)을 저장하지 않음 (on_graded면 0점 · 미완료, on_submit이면 늘 100점. AI 평가는 rubric으로)"
|
|
516
|
+
},
|
|
505
517
|
{
|
|
506
518
|
"id": "edit.no-save",
|
|
507
519
|
"level": "warn",
|
|
@@ -30,6 +30,7 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
30
30
|
> - **When the request asks for it** (a survey with name and phone number, a self-introduction with contact details, a sign-up form, a photo of the learner), do not build that part. Tell the person why and offer the alternative before you build, for example: "이름 · 연락처 같은 학습자 개인정보는 자료에서 받거나 저장할 수 없어요. 제출한 답은 서버에 남아 교육자 · 운영자가 볼 수 있기 때문이에요. 대신 관심 분야 · 경험 수준 · 기대하는 점을 묻는 익명 설문으로 만들까요? 연락처가 꼭 필요하면 자료 밖의 기관 절차(수집 동의를 받는 곳)로 받아 주세요."
|
|
31
31
|
|
|
32
32
|
- **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.
|
|
33
|
+
- **AI grading is `rubric`, saved on the edit screen.** AI가 답을 평가해 점수를 매기는 학습자료는 `settings.grading`을 `rubric`으로 저장한다 (편집 화면 `useSave`의 `getGrading`으로 평가 기준을 rubric 글로 만들어 저장), 학습 화면은 학습자 답만 제출한다, 화면에서 계산한 점수는 서버 채점에 쓰이지 않는다. Without `settings.grading`, `on_graded` scores 0 and never completes and `on_submit` gives 100 whatever the AI said. With `on_graded` + `rubric` the server grades 0–100 and completes at 1 point or more. Never compute the score with `mlapi` in the browser and submit it. Sketch and details: [5](05-screen-code.md) "AI grading".
|
|
33
34
|
- **`partial_pattern` (partial score per question)**: `{ "type": "partial_pattern", "answer_key": ["^…$", "^…$"], "scores": [50, 50] }`. The student submits a **string array** in question order and `answer[i]` is matched against `answer_key[i]` the same way as `pattern` (trimmed, full match). The score is the sum of `scores[i]` of the matched questions, capped at 100. Rules the server enforces on save (422 otherwise): both arrays 1–50 long and the same length, each score an integer 0–100, the sum at least 100 (a lower sum could never complete). Only 100 is `is_correct: true` and completes `on_graded`; a missing item scores 0, extra items are ignored, and an answer that is not an array of strings is rejected (422). The response also carries `answer_correctness` (per question, `answer_key` order; `[]` for `pattern` · `rubric`), in the submit response and the submission lists, so a screen can mark each question right or wrong (SDK `answerCorrectness`). Kit helpers: `validatePartialGrading` (the same rules, for `getGrading`) and `splitScores(n)` (equal integer split summing to 100, e.g. 3 → [33, 33, 34]). The quiz template supports both (6).
|
|
34
35
|
- **Choosing between `pattern` and `partial_pattern` is the person's call.** For a material with several questions, ask: "모두 맞혀야 100점" (`pattern`) or "문항별 부분 점수" (`partial_pattern`). For partial scores, take the per-question scores from the person or from the planning material; if neither gives them, use an equal score and say so in the summary (the quiz template's automatic score is `ceil(100 / questions)` each, 3 → 34 · 34 · 34; the kit's `splitScores` sums to exactly 100, 3 → 33 · 33 · 34). In the quiz template the author can also change the grader and the scores on the edit screen. Scores are integers 0–100 summing to at least 100 (usually exactly 100). Students must answer every question before they submit (the quiz blocks an unanswered question), so a skipped question cannot score 0 by design.
|
|
35
36
|
- **Regexes run on the server in Python `re`**, not JavaScript: for a case-insensitive match put `(?i)` at the very start (`(?i)^(paris|파리)$`); the kit, `ecdk dev` and the local mock turn a leading `(?i)` · `(?s)` · `(?m)` into the JS flag. Avoid what the two engines read differently: `\w` · `\d` · `\b` match Unicode (Korean letters, full-width digits) in Python but only ASCII in JS, so write the characters out (`[0-9]`, `[가-힣A-Za-z]`); named groups are `(?P<name>…)` in Python and `(?<name>…)` in JS (do not use them); lookbehind must be fixed-width in Python; inline flags anywhere but the start fail in both. The generated keys (escaped literals, `(?:…|…)`, `^…$`) mean the same in both.
|
|
@@ -112,6 +112,32 @@ app.useSave({ getContent: () => app.content, getGrading: () => grading.getGradin
|
|
|
112
112
|
|
|
113
113
|
- Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
|
|
114
114
|
|
|
115
|
+
### AI grading
|
|
116
|
+
|
|
117
|
+
**AI가 답을 평가해 점수를 매기는 학습자료는 `settings.grading`을 `rubric`으로 저장한다 (편집 화면 `useSave`의 `getGrading`으로 평가 기준을 rubric 글로 만들어 저장), 학습 화면은 학습자 답만 제출한다, 화면에서 계산한 점수는 서버 채점에 쓰이지 않는다.**
|
|
118
|
+
|
|
119
|
+
- The server grades a submission only from `settings.grading`, never from a score inside the answer. With the LXP policy `on_graded` and no `settings.grading` every submission scores 0 and never completes; with `on_submit` every submission scores 100 whatever the AI said (2026-11-20, an essay material that scored with `sdk.mlapi.fetch` in the browser and submitted `{ text, score, scores }`: "채점이 안 됨").
|
|
120
|
+
- `rubric` grading: the server asks AI to grade the submitted answer against the rubric text (up to 10,000 characters), 0–100; `on_graded` completes at 1 point or more, and 100 is `is_correct: true`. Keep the evaluation criteria (names, points, descriptions) in the content if the edit screen edits them, and build the rubric text from them on save. The rubric is never sent to students.
|
|
121
|
+
- The learn screen submits only the learner's answer: plain text, or the smallest JSON the grading needs. The server puts the whole answer JSON into the grading prompt, so never add a client score, per-criterion scores or other numbers to it.
|
|
122
|
+
- Per-criterion feedback from your own `mlapi.fetch` call is optional and display-only: it costs AI credits a second time and its numbers never become the grade. Mixing AI grading for some questions with regex grading for others is not available yet.
|
|
123
|
+
|
|
124
|
+
```js
|
|
125
|
+
// screens/edit.js: criteria = [{ name, points, description }] edited in the content
|
|
126
|
+
const criteriaToRubric = c =>
|
|
127
|
+
c.criteria.map((x, i) => `${i + 1}. ${x.name} (${x.points}점): ${x.description}`).join('\n') +
|
|
128
|
+
'\n\n항목 점수를 더해 0~100점으로 채점한다.';
|
|
129
|
+
app.useSave({
|
|
130
|
+
getContent: () => content,
|
|
131
|
+
getGrading: () => ({ type: 'rubric', rubric: criteriaToRubric(content) }),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// screens/learn.js: the answer only, no score
|
|
135
|
+
app.useSubmit({ getAnswer: () => textarea.value, setAnswer: v => (textarea.value = v ?? '') });
|
|
136
|
+
// or: await app.submit({ text });
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The check warns about both mistakes: `grading.client-score` (a `score` · `scores` · `points` key in a submitted object) and `grading.ai-without-grading` (`mlapi.fetch` and a submission, but no `getGrading` · `useGradingBlock` · `grading:`). Propose `on_graded` (2 ②); `on_submit` only for AI feedback that is shown and not graded, and then tell the person the score will not reflect the AI result.
|
|
140
|
+
|
|
115
141
|
### Content editor (JSON)
|
|
116
142
|
|
|
117
143
|
Design the **content JSON shape first** (for example `{ title, intro, unit, items: [{ name, value, note }] }`); the student and instructor screens only read that shape from `app.content`. Then the edit screen does not need hand-written fields: the kit's content editor draws them from the shape.
|