@eliceio/cdk-cli 0.1.0-alpha.1 → 0.1.0-alpha.3
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 +171 -136
- package/es/cli.js +119 -26
- package/es/commands/build/index.d.ts +4 -1
- package/es/commands/build/index.js +28 -9
- package/es/commands/check/index.d.ts +8 -2
- package/es/commands/check/index.js +45 -5
- package/es/commands/create/index.d.ts +2 -0
- package/es/commands/create/index.js +28 -3
- package/es/commands/create/scaffold.d.ts +2 -0
- package/es/commands/create/scaffold.js +10 -6
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +6 -2
- package/es/commands/doctor/index.d.ts +12 -0
- package/es/commands/doctor/index.js +217 -7
- package/es/commands/guide/index.d.ts +29 -0
- package/es/commands/guide/index.js +120 -0
- package/es/commands/mcp/index.d.ts +134 -0
- package/es/commands/mcp/index.js +399 -0
- package/es/commands/setup/index.d.ts +40 -0
- package/es/commands/setup/index.js +157 -0
- package/es/commands/skill/index.d.ts +45 -0
- package/es/commands/skill/index.js +145 -0
- package/es/core/config.d.ts +63 -19
- package/es/core/config.js +108 -32
- package/es/core/prepare.js +3 -5
- package/es/core/project-check.d.ts +15 -0
- package/es/core/project-check.js +26 -0
- package/es/core/sandbox.d.ts +17 -0
- package/es/core/sandbox.js +182 -0
- package/es/core/templates.d.ts +25 -0
- package/es/core/templates.js +41 -0
- package/es/dev/grading.d.ts +14 -7
- package/es/dev/grading.js +27 -13
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +33 -33
- package/es/dev/mock-api.d.ts +20 -4
- package/es/dev/mock-api.js +70 -9
- package/es/dev/server.d.ts +9 -1
- package/es/dev/server.js +101 -25
- package/es/rules/check.js +126 -4
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +23 -9
- package/es/rules/manifest.js +60 -35
- package/es/rules/node.js +3 -1
- package/es/rules/semver.d.ts +5 -0
- package/es/rules/semver.js +32 -0
- package/es/rules/types.d.ts +29 -6
- package/es/rules.json.js +1 -1
- package/es/version.d.ts +2 -1
- package/es/version.js +5 -1
- package/guides/content-development.md +294 -0
- package/package.json +4 -2
- package/rules.json +113 -5
- package/skills/_shared/always.md +9 -0
- package/skills/elice-content-check/SKILL.md +22 -0
- package/skills/elice-content-create/SKILL.md +21 -0
- package/skills/elice-content-migrate/SKILL.md +21 -0
- package/skills/elice-content-publish/SKILL.md +22 -0
- package/templates/_shared/lib/cdk-mock.d.ts +21 -3
- package/templates/_shared/lib/cdk-mock.js +239 -80
- package/templates/_shared/lib/cdk.js +2 -2
- package/templates/_shared/lib/elice-content.css +206 -0
- package/templates/_shared/lib/elice-content.d.ts +112 -5
- package/templates/_shared/lib/elice-content.js +660 -62
- package/templates/blank/README.md +14 -5
- package/templates/blank/commentary.txt +2 -0
- package/templates/blank/completion.html +15 -0
- package/templates/blank/elice.config.json +3 -5
- package/templates/blank/gitignore +1 -0
- package/templates/blank/screens/completion.js +7 -0
- package/templates/blank/screens/edit.js +3 -0
- package/templates/blank/template.json +6 -0
- package/templates/quiz/README.md +37 -30
- package/templates/quiz/commentary.txt +2 -0
- package/templates/quiz/content.json +17 -63
- package/templates/quiz/core/behaviors.d.ts +8 -3
- package/templates/quiz/core/behaviors.js +15 -2
- package/templates/quiz/core/model.d.ts +27 -1
- package/templates/quiz/core/model.js +199 -4
- package/templates/quiz/elice.config.json +1 -6
- package/templates/quiz/gitignore +1 -0
- package/templates/quiz/grading.json +1 -10
- package/templates/quiz/screens/edit.js +106 -32
- package/templates/quiz/screens/learn.js +13 -9
- package/templates/quiz/styles.css +84 -24
- package/templates/quiz/template.json +6 -0
- package/templates/quiz/ui/templates/edit.d.ts +2 -1
- package/templates/quiz/ui/templates/edit.js +16 -13
- package/templates/quiz/ui/templates/group.js +29 -8
- package/templates/quiz/ui/templates/question.js +3 -3
- package/templates/quiz/ui/texts.js +53 -29
package/es/rules/manifest.js
CHANGED
|
@@ -11,39 +11,59 @@ function fileNameError(name, label) {
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* 수동 채점(manual) · 채점 없음(none)은 Custom HTML에서 쓰지 않는다.
|
|
14
|
+
* 완료 정책 하나 검사 (metadata `completionPolicies`의 값 · 로컬 `.ecdk/completion.json`, ADR 0009).
|
|
15
|
+
* 문제가 없으면 null. 수동 채점(manual) · 채점 없음(none)은 Custom HTML에서 쓰지 않는다.
|
|
16
16
|
*/
|
|
17
|
-
function
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
if (types.includes('none')) return '채점 없음(none)은 Custom HTML 자료에서 쓰지 않습니다. 보기만 하는 자료는 on_access, 제출만 받는 자료는 on_submit.';
|
|
22
|
-
const unknown = types.find(t => !allowed.includes(t));
|
|
23
|
-
if (unknown) return `알 수 없는 채점 유형입니다: ${unknown} (가능: ${allowed.join(', ')})`;
|
|
24
|
-
const dup = types.find((t, i) => types.indexOf(t) !== i);
|
|
25
|
-
if (dup) return `gradingTypes에 같은 유형이 두 번 있습니다: ${dup}`;
|
|
17
|
+
function completionPolicyError(value, allowed) {
|
|
18
|
+
if (value === 'manual') return `수동 채점(manual)은 Custom HTML 자료에서 쓰지 않습니다. 완료 정책은 ${allowed.join(' · ')} 중에서 고르세요.`;
|
|
19
|
+
if (value === 'none') return '채점 없음(none)은 Custom HTML 자료에서 쓰지 않습니다. 보기만 하는 자료는 on_access, 제출만 받는 자료는 on_submit.';
|
|
20
|
+
if (typeof value !== 'string' || !allowed.includes(value)) return `알 수 없는 완료 정책입니다: ${String(value)} (가능: ${allowed.join(', ')})`;
|
|
26
21
|
return null;
|
|
27
22
|
}
|
|
23
|
+
/** 채점 방식 하나 검사 (on_graded일 때 `settings.grading.type`: pattern · rubric). 문제가 없으면 null */
|
|
24
|
+
function graderTypeError(value, allowed) {
|
|
25
|
+
if (value === 'code_exec') return `코드 실행 채점(code_exec)은 아직 지원하지 않습니다 (Custom HTML은 브라우저에서 돌고 서버 실행 환경이 정해지지 않음). ${allowed.join(' · ')} 중에서 고르세요.`;
|
|
26
|
+
if (typeof value !== 'string' || !allowed.includes(value)) return value === 'regex' || value === 'ai_rubric' ? `채점 방식 이름은 grading.type과 같은 ${allowed.join(' · ')}입니다 (${value} → ${value === 'regex' ? 'pattern' : 'rubric'}, 2026-11-11).` : `알 수 없는 채점 방식입니다: ${String(value)} (가능: ${allowed.join(', ')})`;
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
/** completionPolicies 예시 (오류 문구에 같이 보인다) */
|
|
30
|
+
const COMPLETION_POLICIES_EXAMPLE = '예: "completionPolicies": ["on_submit"] · 고를 수 있게 ["on_submit", "on_access"] · 채점하는 퀴즈 ["on_graded"]';
|
|
31
|
+
/**
|
|
32
|
+
* `completionPolicies` 검사 (metadata.json · elice.config.json, ADR 0009 2026-11-11 결정 2): 알려진 완료 정책의 배열,
|
|
33
|
+
* 같은 값 두 번 없음. 문제가 있으면 문장, 없으면 배열. 빈 배열은 여기서 통과시키고 검사 규칙
|
|
34
|
+
* manifest.completion-policies-missing이 알린다 (없는 것과 같은 문제)
|
|
35
|
+
*/
|
|
36
|
+
function parseCompletionPolicies(value, spec) {
|
|
37
|
+
if (!Array.isArray(value)) return `completionPolicies는 완료 정책 배열입니다. ${COMPLETION_POLICIES_EXAMPLE}`;
|
|
38
|
+
for (const policy of value) {
|
|
39
|
+
const error = completionPolicyError(policy, spec.manifest.completionPolicies);
|
|
40
|
+
if (error) return `completionPolicies: ${error}`;
|
|
41
|
+
}
|
|
42
|
+
const twice = value.find((p, i) => value.indexOf(p) !== i);
|
|
43
|
+
if (twice !== undefined) return `completionPolicies에 ${String(twice)}가 두 번 있습니다.`;
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
28
46
|
/**
|
|
29
47
|
* metadata.json (zip 최상위): 용도, 화면(모드)별 사용 여부와 진입 파일, 빌드 정보. 정답은 넣지 않는다.
|
|
30
48
|
*
|
|
31
49
|
* {
|
|
32
50
|
* "kind": "material", // 선택. material: 자료 본문(기본) · description: 문제 설명
|
|
33
|
-
* "screens": { //
|
|
51
|
+
* "screens": { // 알려진 화면을 적는다. 적지 않은 화면은 꺼짐
|
|
34
52
|
* "learn": { "enabled": true, "entry": "index.html" },
|
|
35
53
|
* "instructor": { "enabled": true, "entry": "instructor.html" },
|
|
36
|
-
* "edit": { "enabled":
|
|
54
|
+
* "edit": { "enabled": true, "entry": "edit.html" }, // 내용 편집 + 채점 방식 · 답 (ADR 0009)
|
|
55
|
+
* "completionPolicy": { "enabled": false } // 완료 정책 화면 (ADR 0009)
|
|
37
56
|
* },
|
|
38
|
-
* //
|
|
39
|
-
* //
|
|
40
|
-
* "
|
|
57
|
+
* // 자료 본문은 필수: 지원하는 완료 정책, 서버는 첫 값으로 정한다. 하나면 고정(퀴즈 ["on_graded"]),
|
|
58
|
+
* // 여럿이면 완료 정책 화면이 그 안에서 바꾼다
|
|
59
|
+
* "completionPolicies": ["on_submit", "on_access"],
|
|
41
60
|
* "commentary": "commentary.txt", // 선택. 학습 참고 내용 파일 (zip 최상위, 일반 텍스트)
|
|
42
61
|
* "build": { "cli": "0.1.0", "rules": "0.2.0", "protocol": 1, "engine": "static" } // 선택
|
|
43
62
|
* }
|
|
44
63
|
*
|
|
45
64
|
* 파싱 결과의 `entries`는 켠 화면만 담는다. 서버 `material_draft.manifest`(JSONB) · SDK `MaterialManifest`의
|
|
46
65
|
* `{ entries }`가 이 모양이라 서버는 그대로 저장할 수 있다. 형식은 서버·디자인과 확정 전 제안안 (ADR 0004).
|
|
66
|
+
* `gradingTypes`(2026-11-10 삭제, ADR 0008)가 있으면 받아 주고 경고만 낸다: 완료 정책은 completionPolicies · 완료 정책 화면, 채점 방식은 편집 화면이 정한다.
|
|
47
67
|
*/
|
|
48
68
|
function parseManifest(text, spec) {
|
|
49
69
|
const fail = error => ({
|
|
@@ -61,11 +81,13 @@ function parseManifest(text, spec) {
|
|
|
61
81
|
if (json.kind !== undefined && !spec.manifest.kinds.includes(json.kind)) return fail(`"kind"는 ${spec.manifest.kinds.join(' · ')} 중 하나여야 합니다 (material: 자료 본문, description: 문제 설명). 없으면 ${spec.manifest.defaultKind}.`);
|
|
62
82
|
const kind = json.kind;
|
|
63
83
|
const unknown = Object.keys(json.screens).find(m => !spec.manifest.modes.includes(m));
|
|
84
|
+
if (unknown === 'completion' || unknown === 'grading') return fail(`완료 정책 화면의 이름은 "completionPolicy"입니다 (2026-11-11): screens.${unknown} → screens.completionPolicy`);
|
|
64
85
|
if (unknown) return fail(`알 수 없는 화면입니다: ${unknown} (가능: ${spec.manifest.modes.join(', ')})`);
|
|
65
86
|
const entries = {};
|
|
66
87
|
for (const mode of spec.manifest.modes) {
|
|
67
88
|
const s = json.screens[mode];
|
|
68
|
-
|
|
89
|
+
// 적지 않은 화면은 꺼짐 (옛 metadata에는 completionPolicy가 없다)
|
|
90
|
+
if (s === undefined) continue;
|
|
69
91
|
if (!isRecord(s) || typeof s.enabled !== 'boolean') return fail(`${mode} 화면은 { "enabled": true|false, "entry": "파일" } 모양이어야 합니다.`);
|
|
70
92
|
if (!s.enabled) {
|
|
71
93
|
if (s.entry !== undefined) return fail(`${mode} 화면은 꺼져 있는데(enabled: false) entry가 있습니다. 둘 중 하나를 고쳐 주세요.`);
|
|
@@ -83,18 +105,18 @@ function parseManifest(text, spec) {
|
|
|
83
105
|
const allowed = spec.manifest.kindModes[kind ?? spec.manifest.defaultKind] ?? spec.manifest.modes;
|
|
84
106
|
const extra = Object.keys(entries).filter(m => !allowed.includes(m));
|
|
85
107
|
if (extra.length > 0) return fail(`${kind === 'description' ? '문제 설명' : kind} 용도는 ${allowed.join(' · ')} 화면만 지원합니다: ${extra.join(', ')}를 { "enabled": false }로 바꿔 주세요.`);
|
|
86
|
-
// 채점
|
|
87
|
-
if (json.grading !== undefined) return fail('"grading"
|
|
88
|
-
|
|
89
|
-
let
|
|
90
|
-
if (json.
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
} else if (!isDescription) {
|
|
96
|
-
return fail(`자료 본문에는 지원하는 채점 유형이 있어야 합니다: "gradingTypes": [${spec.manifest.gradingTypes.map(t => `"${t}"`).join(', ')}] 중 하나 이상. 보기만 하는 자료는 ["on_access"].`);
|
|
108
|
+
// 채점 설정(정답 · 기준)은 metadata에 넣지 않는다: zip은 학생에게도 내려간다. 편집 화면이 settings.grading에 저장
|
|
109
|
+
if (json.grading !== undefined) return fail('"grading"(채점 설정)은 metadata.json에 넣지 않습니다. 정답이 학생에게 보입니다. 채점 방식 · 답은 편집 화면에서 정합니다 (ADR 0009).');
|
|
110
|
+
if (json.completion !== undefined) return fail(`"completion" 대신 "completionPolicies"(지원하는 완료 정책 배열, 첫 값이 기본)를 적습니다 (2026-11-11). ${COMPLETION_POLICIES_EXAMPLE}`);
|
|
111
|
+
let completionPolicies;
|
|
112
|
+
if (json.completionPolicies !== undefined) {
|
|
113
|
+
if (kind === 'description') return fail('문제 설명(kind: description)은 완료 · 채점하지 않으므로 "completionPolicies"를 넣지 않습니다.');
|
|
114
|
+
const parsed = parseCompletionPolicies(json.completionPolicies, spec);
|
|
115
|
+
if (typeof parsed === 'string') return fail(parsed);
|
|
116
|
+
completionPolicies = parsed;
|
|
97
117
|
}
|
|
118
|
+
const warnings = [];
|
|
119
|
+
if (json.gradingTypes !== undefined) warnings.push('"gradingTypes"는 더 쓰지 않습니다 (2026-11-10). 완료 정책은 "completionPolicies"와 완료 정책 화면(screens.completionPolicy)이, 채점 방식 · 답은 편집 화면이 정합니다 (ADR 0009). ecdk build로 다시 만들면 빠집니다.');
|
|
98
120
|
const commentary = json.commentary;
|
|
99
121
|
if (commentary !== undefined) {
|
|
100
122
|
if (typeof commentary !== 'string' || commentary.trim() === '') return fail('"commentary"(학습 참고 내용)는 파일 이름이어야 합니다. 예: "commentary.txt"');
|
|
@@ -123,8 +145,8 @@ function parseManifest(text, spec) {
|
|
|
123
145
|
kind
|
|
124
146
|
} : {}),
|
|
125
147
|
entries,
|
|
126
|
-
...(
|
|
127
|
-
|
|
148
|
+
...(completionPolicies ? {
|
|
149
|
+
completionPolicies
|
|
128
150
|
} : {}),
|
|
129
151
|
...(typeof commentary === 'string' ? {
|
|
130
152
|
commentary: commentary.trim()
|
|
@@ -132,11 +154,14 @@ function parseManifest(text, spec) {
|
|
|
132
154
|
...(build ? {
|
|
133
155
|
build
|
|
134
156
|
} : {})
|
|
135
|
-
}
|
|
157
|
+
},
|
|
158
|
+
...(warnings.length > 0 ? {
|
|
159
|
+
warnings
|
|
160
|
+
} : {})
|
|
136
161
|
};
|
|
137
162
|
}
|
|
138
163
|
/**
|
|
139
|
-
*
|
|
164
|
+
* 알려진 화면의 사용 여부(enabled)를 모두 적는다. 필드 순서(kind · screens · completionPolicies · commentary · build)와 화면 순서(learn · instructor · edit · completionPolicy)를
|
|
140
165
|
* 고정해 같은 입력이면 같은 파일이 나오게 한다. kind가 없으면 기본값을 적는다.
|
|
141
166
|
*/
|
|
142
167
|
function serializeManifest(manifest, spec) {
|
|
@@ -152,8 +177,8 @@ function serializeManifest(manifest, spec) {
|
|
|
152
177
|
const out = {
|
|
153
178
|
kind: manifest.kind ?? spec.manifest.defaultKind,
|
|
154
179
|
screens,
|
|
155
|
-
...(manifest.
|
|
156
|
-
|
|
180
|
+
...(manifest.completionPolicies ? {
|
|
181
|
+
completionPolicies: manifest.completionPolicies
|
|
157
182
|
} : {}),
|
|
158
183
|
...(manifest.commentary !== undefined ? {
|
|
159
184
|
commentary: manifest.commentary
|
|
@@ -165,4 +190,4 @@ function serializeManifest(manifest, spec) {
|
|
|
165
190
|
return `${JSON.stringify(out, null, 2)}\n`;
|
|
166
191
|
}
|
|
167
192
|
|
|
168
|
-
export {
|
|
193
|
+
export { COMPLETION_POLICIES_EXAMPLE, completionPolicyError, graderTypeError, parseCompletionPolicies, parseManifest, serializeManifest };
|
package/es/rules/node.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { stat, readFile, readdir } from 'node:fs/promises';
|
|
2
2
|
import { extname, join, relative, sep } from 'node:path';
|
|
3
|
+
import { knownTemplates } from '../core/templates.js';
|
|
3
4
|
import { checkFiles } from './check.js';
|
|
4
5
|
import { rules } from './spec.js';
|
|
5
6
|
export { RULES_VERSION } from './spec.js';
|
|
@@ -61,7 +62,8 @@ async function checkPath(p) {
|
|
|
61
62
|
} = await filesFromPath(p);
|
|
62
63
|
return checkFiles(files, {
|
|
63
64
|
input,
|
|
64
|
-
zipBytes
|
|
65
|
+
zipBytes,
|
|
66
|
+
templates: knownTemplates()
|
|
65
67
|
});
|
|
66
68
|
} catch (e) {
|
|
67
69
|
if (!(e instanceof ZipLimitError)) throw e;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// semver 비교 (스킬 · 템플릿 버전 공통). 노드 API 없이 규칙 검사에서도 쓴다
|
|
2
|
+
const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
|
|
3
|
+
/**
|
|
4
|
+
* semver 순서로 a가 b보다 앞이면 음수, 뒤면 양수, 같으면 0. 읽을 수 없는 버전은 undefined.
|
|
5
|
+
* 정식 버전은 같은 숫자의 pre-release보다 뒤 (1.0.0-alpha.1 < 1.0.0)
|
|
6
|
+
*/
|
|
7
|
+
function compareVersions(a, b) {
|
|
8
|
+
const pa = SEMVER.exec(a);
|
|
9
|
+
const pb = SEMVER.exec(b);
|
|
10
|
+
if (!pa || !pb) return undefined;
|
|
11
|
+
for (let i = 1; i <= 3; i++) {
|
|
12
|
+
const d = Number(pa[i]) - Number(pb[i]);
|
|
13
|
+
if (d !== 0) return d;
|
|
14
|
+
}
|
|
15
|
+
if (pa[4] === pb[4]) return 0;
|
|
16
|
+
if (pa[4] === undefined) return 1;
|
|
17
|
+
if (pb[4] === undefined) return -1;
|
|
18
|
+
const xa = pa[4].split('.');
|
|
19
|
+
const xb = pb[4].split('.');
|
|
20
|
+
for (let i = 0; i < Math.min(xa.length, xb.length); i++) {
|
|
21
|
+
const [x = '', y = ''] = [xa[i], xb[i]];
|
|
22
|
+
if (x === y) continue;
|
|
23
|
+
const nx = /^\d+$/.test(x);
|
|
24
|
+
const ny = /^\d+$/.test(y);
|
|
25
|
+
if (nx && ny) return Number(x) - Number(y);
|
|
26
|
+
if (nx !== ny) return nx ? -1 : 1;
|
|
27
|
+
return x < y ? -1 : 1;
|
|
28
|
+
}
|
|
29
|
+
return xa.length - xb.length;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { compareVersions };
|
package/es/rules/types.d.ts
CHANGED
|
@@ -26,8 +26,14 @@ export interface RulesSpec {
|
|
|
26
26
|
required: string[];
|
|
27
27
|
/** 용도별로 지원할 수 있는 화면. 문제 설명은 학생 화면만 */
|
|
28
28
|
kindModes: Record<string, string[]>;
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* metadata `completionPolicies`에 쓸 수 있는 완료 정책 (2026-11-11 결정 2). 서버는 그 첫 값으로 완료 정책을 정하고,
|
|
31
|
+
* 완료 정책 화면 · SDK `saveCompletionPolicy`가 그 안에서 바꾼다.
|
|
32
|
+
* on_access(열면 완료) · on_submit(제출하면 완료) · on_graded(채점해 통과하면 완료)
|
|
33
|
+
*/
|
|
34
|
+
completionPolicies: string[];
|
|
35
|
+
/** 채점 방식 (on_graded일 때만): `settings.grading.type` · 로컬 `grading.json` `type`. code_exec는 이번 범위 밖 */
|
|
36
|
+
graderTypes: string[];
|
|
31
37
|
/** 학습 참고 내용(commentary) 파일의 기본 이름 (zip 최상위, 일반 텍스트). metadata.json `commentary`가 가리킨다 */
|
|
32
38
|
commentaryFile: string;
|
|
33
39
|
defaultEntry: string;
|
|
@@ -92,6 +98,20 @@ export interface CheckOptions {
|
|
|
92
98
|
/** 이미 만든 zip의 크기. 없으면 검사기가 압축해 본 크기 */
|
|
93
99
|
zipBytes?: number | undefined;
|
|
94
100
|
spec?: RulesSpec | undefined;
|
|
101
|
+
/** ecdk build가 모듈 스크립트를 HTML 안에 묶어 넣는다 (build · doctor · dev가 원본을 볼 때). 그러면 sandbox.module-src를 보지 않는다 */
|
|
102
|
+
bundlesModules?: boolean | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* 프로젝트 검사(build · doctor · dev)일 때 로컬 grading.json (없으면 null). undefined면 zip만 본 것이라
|
|
105
|
+
* grading.missing을 보지 않는다 (grading.json은 zip에 들어가지 않음)
|
|
106
|
+
*/
|
|
107
|
+
grading?: {
|
|
108
|
+
type: string;
|
|
109
|
+
} | null | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* 이 CLI가 아는 템플릿과 버전 ({ quiz: '1.0.0' }). 있으면 metadata.json build.template을 맞춰 본다
|
|
112
|
+
* (build.template-unknown). 없으면(서버 · 라이브러리 사용) 보지 않는다
|
|
113
|
+
*/
|
|
114
|
+
templates?: Record<string, string> | undefined;
|
|
95
115
|
}
|
|
96
116
|
/** metadata.json의 build: 어떤 도구·규칙으로 만들었는지. 서버가 "오래된 규칙" 같은 안내에 쓴다 */
|
|
97
117
|
export interface BuildInfo {
|
|
@@ -99,7 +119,7 @@ export interface BuildInfo {
|
|
|
99
119
|
rules: string;
|
|
100
120
|
protocol: number;
|
|
101
121
|
engine: string;
|
|
102
|
-
/** 만든 템플릿과 버전 (예: "quiz@
|
|
122
|
+
/** 만든 템플릿과 그 템플릿의 버전 (예: "quiz@1.0.0", 템플릿마다 template.json version). ecdk create가 elice.config.json에 적어 둔 값 */
|
|
103
123
|
template?: string | undefined;
|
|
104
124
|
/** 묶어 넣은 @eliceio/cdk 버전 (lib/cdk.js 머리말) */
|
|
105
125
|
sdk?: string | undefined;
|
|
@@ -116,9 +136,12 @@ export interface Manifest {
|
|
|
116
136
|
kind?: string | undefined;
|
|
117
137
|
/** 켠 화면 → 진입 파일 (metadata.json `screens`에서 enabled: true인 것만) */
|
|
118
138
|
entries: Record<string, string>;
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
/**
|
|
140
|
+
* 이 자료가 지원하는 완료 정책 (ADR 0009 2026-11-11 결정 2). 서버는 첫 값으로 완료 정책을 정한다.
|
|
141
|
+
* 하나면 고정(퀴즈: ["on_graded"]), 여럿이면 완료 정책 화면(`screens.completionPolicy`)이 그 안에서 바꾼다.
|
|
142
|
+
* 자료 본문은 필수(검사 규칙 manifest.completion-policies-missing), 문제 설명에는 넣지 않는다
|
|
143
|
+
*/
|
|
144
|
+
completionPolicies?: string[] | undefined;
|
|
122
145
|
/** 학습 참고 내용 파일 (zip 최상위 .txt). LXP "AI헬피 설정 → 학습 참고 내용"(lecture page `commentary`)으로 들어간다 */
|
|
123
146
|
commentary?: string | undefined;
|
|
124
147
|
/** ecdk build가 채움. 직접 만든 zip에는 없어도 됨 */
|
package/es/rules.json.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const version="0.2.0";const manifest={file:"metadata.json",kinds:["material","description"],defaultKind:"material",modes:["learn","instructor","edit"],required:["learn"],kindModes:{material:["learn","instructor","edit"],description:["learn"]},gradingTypes:["on_access","on_submit","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"]},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 대상이 * (아무 창이나 받을 수 있음)"}];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:"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:"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:"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.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};
|
|
2
2
|
|
|
3
3
|
export { allowedExtensions, rulesJson as default, excluded, forbiddenApis, imageExtensions, limits, manifest, rules, secretPatterns, version };
|
package/es/version.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** @eliceio/cdk-cli 버전 (패키지 루트의 package.json, es/와 src/ 모두 한 단계 위) */
|
|
2
|
+
export declare const VERSION: string;
|
package/es/version.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
|
|
4
|
+
/** @eliceio/cdk-cli 버전 (패키지 루트의 package.json, es/와 src/ 모두 한 단계 위) */
|
|
5
|
+
const VERSION = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8')).version;
|
|
2
6
|
|
|
3
7
|
export { VERSION };
|