@eliceio/cdk-cli 0.1.0-alpha.4 → 0.1.0-alpha.5
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 +182 -146
- package/es/cli.js +65 -66
- package/es/commands/build/index.js +17 -4
- package/es/commands/create/index.d.ts +1 -1
- package/es/commands/create/index.js +5 -9
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +4 -4
- package/es/commands/doctor/index.d.ts +18 -1
- package/es/commands/doctor/index.js +136 -26
- package/es/commands/mcp/index.d.ts +0 -12
- package/es/commands/mcp/index.js +6 -57
- package/es/commands/setup/index.d.ts +11 -3
- package/es/commands/setup/index.js +112 -37
- package/es/commands/skill/index.d.ts +46 -8
- package/es/commands/skill/index.js +151 -35
- package/es/commands/uninstall/index.d.ts +54 -0
- package/es/commands/uninstall/index.js +304 -0
- package/es/commands/update/index.d.ts +59 -0
- package/es/commands/update/index.js +251 -0
- package/es/commands/{check → validate}/index.d.ts +1 -1
- package/es/commands/{check → validate}/index.js +1 -1
- package/es/core/config.d.ts +20 -37
- package/es/core/config.js +36 -89
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/prepare.js +3 -2
- package/es/core/project-check.d.ts +2 -2
- package/es/core/project-check.js +2 -2
- package/es/core/templates.d.ts +1 -3
- package/es/core/templates.js +1 -4
- package/es/dev/grading.d.ts +7 -8
- package/es/dev/grading.js +6 -16
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +11 -9
- package/es/dev/mock-api.d.ts +8 -12
- package/es/dev/mock-api.js +50 -65
- package/es/dev/server.js +7 -26
- package/es/rules/check.js +11 -35
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/types.d.ts +1 -13
- package/es/rules.json.js +1 -1
- package/package.json +2 -3
- package/rules.json +12 -43
- package/skills/_shared/always.md +3 -3
- package/skills/elice-content-check/SKILL.md +10 -9
- package/skills/elice-content-create/SKILL.md +7 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +12 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
- package/skills/elice-content-guide/topics/09-check.md +10 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +8 -7
- package/skills/elice-content-publish/SKILL.md +8 -8
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +40 -135
- package/templates/_shared/lib/elice-content.css +60 -1
- package/templates/_shared/lib/elice-content.d.ts +6 -37
- package/templates/_shared/lib/elice-content.js +23 -236
- package/templates/blank/README.md +5 -6
- package/templates/blank/metadata.json +1 -3
- package/templates/blank/package.json +2 -2
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +3 -3
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +9 -9
- package/templates/quiz/core/editor.js +16 -26
- package/templates/quiz/core/model.js +3 -3
- package/templates/quiz/metadata.json +1 -3
- package/templates/quiz/package.json +2 -2
- package/templates/quiz/screens/edit.js +17 -6
- package/templates/quiz/screens/learn.js +5 -2
- package/templates/quiz/styles.css +23 -27
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.js +29 -15
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/texts.js +4 -6
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -302
- package/templates/blank/completion.html +0 -15
- package/templates/blank/screens/completion.js +0 -7
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// 퀴즈 데이터 모델. 학생 · 교육자 · 편집 화면이 같이 씁니다. (기존 퀴즈 material 명세: docs/quiz-spec.md)
|
|
2
2
|
//
|
|
3
3
|
// 편집 화면이 저장하는 settings (학생에게 공개, 정답 없음)
|
|
4
|
-
// { title, description, questions: [{ id, type, title, description
|
|
4
|
+
// { title, description, questions: [{ id, type, title, description?, options?, groups?, slots?,
|
|
5
5
|
// shuffle?, placeholder?, explanation: { enabled, text } }] }
|
|
6
|
+
// 문항 description은 편집 화면에서 적을 때만 생긴다 (새 문항에는 키가 없음)
|
|
6
7
|
// 제출하는 답: 문자열 하나 (ADR 0008). 문항 순서대로 `문항id=답`을 `;`로 잇고, 주관식 답은 encodeURIComponent
|
|
7
8
|
// "q1=b;q2=a,d;q3=c,a,b;q4=%EA%B0%80%EC%A4%91%EC%B9%98;q5=g1:a|g2:b,c"
|
|
8
|
-
// 퀴즈는
|
|
9
|
+
// 퀴즈는 채점 방식 pattern 고정 (ADR 0009, 완료 정책은 LXP 설정, ADR 0012). 정답(settings.grading)은 편집 화면이 문항마다 고른 답으로
|
|
9
10
|
// 만든 정규식 하나: { type: 'pattern', answer_key: '^q1=b;…$' }
|
|
10
11
|
|
|
11
12
|
// 화면에 보이는 문구는 여기 두지 않습니다 (ui/texts.js). 문구가 필요한 함수는 화면(screens/)이 문구를 넘겨 줍니다.
|
|
@@ -45,7 +46,6 @@ export function newQuestion(type, usedIds, names) {
|
|
|
45
46
|
id: nextId(usedIds, 'q'),
|
|
46
47
|
type,
|
|
47
48
|
title: '',
|
|
48
|
-
description: '',
|
|
49
49
|
explanation: { enabled: false, text: '' },
|
|
50
50
|
};
|
|
51
51
|
return convertType(q, type, names);
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
"screens": {
|
|
4
4
|
"learn": { "enabled": true, "entry": "index.html" },
|
|
5
5
|
"instructor": { "enabled": true, "entry": "instructor.html" },
|
|
6
|
-
"edit": { "enabled": true, "entry": "edit.html" }
|
|
7
|
-
"completionPolicy": { "enabled": false }
|
|
6
|
+
"edit": { "enabled": true, "entry": "edit.html" }
|
|
8
7
|
},
|
|
9
|
-
"completionPolicies": ["on_graded"],
|
|
10
8
|
"commentary": "commentary.txt"
|
|
11
9
|
}
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "ecdk dev",
|
|
6
6
|
"build": "ecdk build",
|
|
7
|
-
"
|
|
7
|
+
"validate": "ecdk validate"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@eliceio/cdk": "workspace:^1.0.0-alpha.
|
|
10
|
+
"@eliceio/cdk": "workspace:^1.0.0-alpha.4"
|
|
11
11
|
},
|
|
12
12
|
"ecdk": {}
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// 내용 편집 화면(CMS). 기존 퀴즈 편집 폼을 옮김 (docs/quiz-spec.md §3). 저장 버튼 · 변경 표시는 키트(useSave)가 합니다.
|
|
2
|
-
// 퀴즈는
|
|
2
|
+
// 퀴즈는 채점 방식 pattern 고정 (ADR 0009, 완료 정책은 LXP 설정 탭에서 교육자가 고름, ADR 0012): 문항 카드마다 정답을
|
|
3
3
|
// 고르고 (단일 · 복수 · 그룹은 보기 줄에서 바로, 순서 · 주관식은 아래 "정답"에서), 저장할 때 고른 답으로 정답 정규식 하나를 만들어 검증한 뒤 settings.grading에 함께 저장합니다.
|
|
4
4
|
// 문제 내용(content)은 학생에게도 내려가므로 정답을 넣지 않습니다 (정답은 grading에만, 서버가 학생에게 내려주지 않음).
|
|
5
5
|
// 여기서는 어떤 칸을 어떤 순서로 놓을지만 정합니다. 모양은 ui/(templates/edit.js · texts · theme.css), 동작은 core/.
|
|
@@ -48,8 +48,6 @@ const form = createEditor({
|
|
|
48
48
|
root,
|
|
49
49
|
templates,
|
|
50
50
|
labels: {
|
|
51
|
-
preview: t.preview,
|
|
52
|
-
previewClose: t.previewClose,
|
|
53
51
|
count: t.count,
|
|
54
52
|
group: texts.defaults.group,
|
|
55
53
|
},
|
|
@@ -118,7 +116,11 @@ function optionsOpts(q) {
|
|
|
118
116
|
function questionFields(q, i) {
|
|
119
117
|
const body = [
|
|
120
118
|
form.field(t.title, q.title, v => (q.title = v), { required: true, max: LIMITS.titleMax }),
|
|
121
|
-
|
|
119
|
+
// 문항 설명: 미리보기 없는 여러 줄 칸. 새 문항에는 키가 없고, 적으면 생긴다
|
|
120
|
+
form.field(t.description, q.description ?? '', v => (q.description = v), {
|
|
121
|
+
multiline: true,
|
|
122
|
+
showOptional: false,
|
|
123
|
+
}),
|
|
122
124
|
];
|
|
123
125
|
if (q.type === 'select_one' || q.type === 'select_multiple' || q.type === 'order') {
|
|
124
126
|
const options = form.itemList('option', q.options, `${i}o`, optionsOpts(q));
|
|
@@ -179,7 +181,12 @@ function questionFields(q, i) {
|
|
|
179
181
|
})
|
|
180
182
|
);
|
|
181
183
|
if (q.explanation?.enabled)
|
|
182
|
-
body.push(
|
|
184
|
+
body.push(
|
|
185
|
+
form.field(t.explanation, q.explanation.text, v => (q.explanation.text = v), {
|
|
186
|
+
multiline: true,
|
|
187
|
+
showOptional: false,
|
|
188
|
+
})
|
|
189
|
+
);
|
|
183
190
|
return body;
|
|
184
191
|
}
|
|
185
192
|
|
|
@@ -214,7 +221,11 @@ function render() {
|
|
|
214
221
|
root.replaceChildren(
|
|
215
222
|
templates.answersIntro({ text: unreadable ? `${a.unreadable} ${a.intro}` : a.intro }),
|
|
216
223
|
form.field(t.quizTitle, draft.title, v => (draft.title = v), { required: true }),
|
|
217
|
-
|
|
224
|
+
// 퀴즈 안내: 라벨 옆 "선택" 표시 없이
|
|
225
|
+
form.field(t.quizDescription, draft.description, v => (draft.description = v), {
|
|
226
|
+
multiline: true,
|
|
227
|
+
showOptional: false,
|
|
228
|
+
}),
|
|
218
229
|
...draft.questions.map(questionCard),
|
|
219
230
|
// 퀴즈 하나에 문항 하나: 문항이 있으면 "문항 추가" 대신 안내 (이미 여러 문항으로 저장된 퀴즈도 편집 · 저장은 됨)
|
|
220
231
|
canAddQuestion(draft.questions)
|
|
@@ -40,10 +40,13 @@ function show() {
|
|
|
40
40
|
const left = questions.findIndex((q, i) => !isAnswered(q, views[i].getValue()));
|
|
41
41
|
return left < 0 || texts.learn.unanswered(left + 1);
|
|
42
42
|
},
|
|
43
|
-
// 서버 채점 결과는 전체 { isCorrect, score }
|
|
43
|
+
// 서버 채점 결과는 전체 { isCorrect, score }뿐이다. 문항이 하나면 그 결과가 곧 문항의 정답 · 오답이고,
|
|
44
|
+
// 여러 문항이면 어느 문항이 틀렸는지 모르므로 모두 맞았을 때만 정답 표시. 해설은 한 번이라도 제출하면
|
|
44
45
|
onResult: (res) => {
|
|
46
|
+
const single = views.length === 1;
|
|
45
47
|
views.forEach((v) => {
|
|
46
|
-
|
|
48
|
+
const correct = typeof res.isCorrect === 'boolean' ? res.isCorrect : null;
|
|
49
|
+
v.setResult(single ? correct : correct === true ? true : null);
|
|
47
50
|
v.showExplanation();
|
|
48
51
|
});
|
|
49
52
|
},
|
|
@@ -398,7 +398,12 @@
|
|
|
398
398
|
gap: var(--qz-list-gap);
|
|
399
399
|
min-height: 44px;
|
|
400
400
|
}
|
|
401
|
+
.qz-group:hover .ec-dropzone {
|
|
402
|
+
border-color: var(--qz-accent);
|
|
403
|
+
}
|
|
401
404
|
.qz-pool-head {
|
|
405
|
+
/* 답안 초기화가 숨었다 나타나도 높이가 그대로 (버튼 높이 30px) */
|
|
406
|
+
min-height: 30px;
|
|
402
407
|
display: flex;
|
|
403
408
|
justify-content: space-between;
|
|
404
409
|
align-items: center;
|
|
@@ -408,6 +413,13 @@
|
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
@media (max-width: 767.98px) {
|
|
416
|
+
/* 좁은 화면: 문항 머리의 아이콘 버튼을 좁혀 유형 이름이 덜 잘리게 */
|
|
417
|
+
.qe-card-head {
|
|
418
|
+
gap: 4px;
|
|
419
|
+
}
|
|
420
|
+
.qe-card-head .ec-icon-button {
|
|
421
|
+
width: 32px;
|
|
422
|
+
}
|
|
411
423
|
.qz-order {
|
|
412
424
|
grid-template-columns: 1fr;
|
|
413
425
|
}
|
|
@@ -448,16 +460,26 @@
|
|
|
448
460
|
}
|
|
449
461
|
.qe-card-head {
|
|
450
462
|
display: flex;
|
|
451
|
-
|
|
463
|
+
/* 좁은 화면에서도 ↑ · ↓ · 삭제가 다음 줄로 넘어가지 않게, 대신 유형 선택이 줄어듦 */
|
|
464
|
+
flex-wrap: nowrap;
|
|
452
465
|
align-items: center;
|
|
453
466
|
gap: 8px;
|
|
454
467
|
font-size: var(--eds-fs-subtitle2);
|
|
455
468
|
font-weight: var(--eds-fw-extrabold);
|
|
456
469
|
}
|
|
470
|
+
.qe-card-head > strong {
|
|
471
|
+
flex: none;
|
|
472
|
+
white-space: nowrap;
|
|
473
|
+
}
|
|
457
474
|
.qe-type {
|
|
458
475
|
width: auto;
|
|
476
|
+
min-width: 0;
|
|
477
|
+
flex: 0 1 auto;
|
|
478
|
+
text-overflow: ellipsis;
|
|
459
479
|
margin-right: auto;
|
|
460
480
|
font-size: var(--eds-fs-body2);
|
|
481
|
+
/* 문항 머리(굵은 글씨)를 물려받지 않게 */
|
|
482
|
+
font-weight: 400;
|
|
461
483
|
}
|
|
462
484
|
.qe-field {
|
|
463
485
|
display: flex;
|
|
@@ -572,18 +594,6 @@
|
|
|
572
594
|
width: auto;
|
|
573
595
|
min-width: 0;
|
|
574
596
|
}
|
|
575
|
-
/* IconButton outlined */
|
|
576
|
-
.qe-icon {
|
|
577
|
-
flex: none;
|
|
578
|
-
width: 40px;
|
|
579
|
-
min-height: 40px;
|
|
580
|
-
padding: 0;
|
|
581
|
-
border-color: var(--qz-border);
|
|
582
|
-
color: var(--eds-text-secondary);
|
|
583
|
-
}
|
|
584
|
-
.qe-icon:hover {
|
|
585
|
-
background: var(--qz-hover);
|
|
586
|
-
}
|
|
587
597
|
.qe-add {
|
|
588
598
|
align-self: flex-start;
|
|
589
599
|
border-style: dashed;
|
|
@@ -601,17 +611,3 @@
|
|
|
601
611
|
height: 18px;
|
|
602
612
|
accent-color: var(--qz-accent);
|
|
603
613
|
}
|
|
604
|
-
.qe-link {
|
|
605
|
-
min-height: 0;
|
|
606
|
-
padding: 0 4px;
|
|
607
|
-
border: 0;
|
|
608
|
-
background: none;
|
|
609
|
-
color: var(--qz-accent);
|
|
610
|
-
font-size: var(--eds-fs-caption);
|
|
611
|
-
font-weight: var(--eds-fw-medium);
|
|
612
|
-
}
|
|
613
|
-
.qe-preview {
|
|
614
|
-
padding: 12px 16px;
|
|
615
|
-
border: 1px dashed var(--qz-border);
|
|
616
|
-
border-radius: var(--eds-radius);
|
|
617
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiz",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"title": "퀴즈",
|
|
5
|
-
"description": "한 문항 퀴즈 (여러 문항은 페이지를 여러 개로). 문항 없이 시작해 편집 화면 \"문항 추가\"로 선택 · 순서 · 주관식 · 그룹 분류 문항 하나를 만듦. 정답은 편집 화면에서 정하고
|
|
5
|
+
"description": "한 문항 퀴즈 (여러 문항은 페이지를 여러 개로). 문항 없이 시작해 편집 화면 \"문항 추가\"로 선택 · 순서 · 주관식 · 그룹 분류 문항 하나를 만듦. 정답은 편집 화면에서 정하고 기준 답안(pattern)으로 채점 (완료 정책은 LXP 설정 탭에서 교육자가 고름)"
|
|
6
6
|
}
|
|
@@ -5,6 +5,20 @@ import { html } from '../../core/dom.js';
|
|
|
5
5
|
import { texts } from '../texts.js';
|
|
6
6
|
|
|
7
7
|
const t = texts.edit;
|
|
8
|
+
/** 삭제 아이콘. 요소는 한 자리에만 들어가므로 쓸 때마다 새로 만든다 (색은 버튼 글자색을 따름) */
|
|
9
|
+
const icons = {
|
|
10
|
+
trash: () => html`
|
|
11
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
12
|
+
<path d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />
|
|
13
|
+
</svg>
|
|
14
|
+
`,
|
|
15
|
+
minusCircle: () => html`
|
|
16
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true">
|
|
17
|
+
<circle cx="12" cy="12" r="9" />
|
|
18
|
+
<path d="M8 12h8" />
|
|
19
|
+
</svg>
|
|
20
|
+
`,
|
|
21
|
+
};
|
|
8
22
|
/** 보기 · 그룹 목록에서 종류마다 다른 문구와 번호 표시 */
|
|
9
23
|
const KIND = {
|
|
10
24
|
option: {
|
|
@@ -29,31 +43,27 @@ const KIND = {
|
|
|
29
43
|
|
|
30
44
|
/**
|
|
31
45
|
* 글 입력 칸. data-role="input" (input · textarea), 있으면 data-role="count" (글자 수)
|
|
32
|
-
*
|
|
46
|
+
* 필수면 "*", 아니면 "선택" (showOptional: false면 표시 없음)
|
|
33
47
|
*/
|
|
34
48
|
export const field = ({
|
|
35
49
|
label,
|
|
36
50
|
required = false,
|
|
51
|
+
showOptional = true,
|
|
37
52
|
hint,
|
|
38
53
|
max,
|
|
39
54
|
multiline = false,
|
|
40
|
-
markdown = false,
|
|
41
55
|
}) => {
|
|
42
56
|
const mark = required
|
|
43
57
|
? html`<b class="qe-required">${t.required}</b>`
|
|
44
|
-
: html`<span class="qe-optional">${t.optional}</span>`;
|
|
45
|
-
const preview =
|
|
46
|
-
markdown &&
|
|
47
|
-
html`<button type="button" class="qe-link" data-role="preview-toggle">${t.preview}</button>`;
|
|
58
|
+
: showOptional && html`<span class="qe-optional">${t.optional}</span>`;
|
|
48
59
|
return html`
|
|
49
60
|
<label class="qe-field">
|
|
50
|
-
<span class="qe-label">${label}${mark}
|
|
61
|
+
<span class="qe-label">${label}${mark}</span>
|
|
51
62
|
${hint && html`<span class="qe-hint">${hint}</span>`}
|
|
52
63
|
${multiline
|
|
53
64
|
? html`<textarea class="qe-input" data-role="input"></textarea>`
|
|
54
65
|
: html`<input class="qe-input" data-role="input" />`}
|
|
55
66
|
${max && html`<span class="qe-count" data-role="count"></span>`}
|
|
56
|
-
${markdown && html`<div class="qe-preview" data-role="preview" hidden></div>`}
|
|
57
67
|
</label>
|
|
58
68
|
`;
|
|
59
69
|
};
|
|
@@ -133,18 +143,19 @@ export const row = ({ kind, index, canDelete, min, answer }) => {
|
|
|
133
143
|
>
|
|
134
144
|
${t.handle}
|
|
135
145
|
</button>
|
|
146
|
+
${answer && answer.type !== 'select' && answerControl(answer, index)}
|
|
136
147
|
<span class="qe-option-no">${k.marker(index)}</span>
|
|
137
148
|
<input class="qe-input qe-option-text" data-role="input" aria-label="${k.input(index)}" />
|
|
138
|
-
${answer && answerControl(answer, index)}
|
|
149
|
+
${answer && answer.type === 'select' && answerControl(answer, index)}
|
|
139
150
|
<button
|
|
140
151
|
type="button"
|
|
141
|
-
class="
|
|
152
|
+
class="ec-icon-button ec-danger"
|
|
142
153
|
data-role="delete"
|
|
143
154
|
aria-label="${k.remove(index)}"
|
|
144
155
|
title="${canDelete ? '' : k.min(min)}"
|
|
145
156
|
${!canDelete && 'disabled'}
|
|
146
157
|
>
|
|
147
|
-
${
|
|
158
|
+
${icons.minusCircle()}
|
|
148
159
|
</button>
|
|
149
160
|
</div>
|
|
150
161
|
`;
|
|
@@ -165,6 +176,7 @@ export const addButton = ({ kind, full, max }) => html`
|
|
|
165
176
|
/**
|
|
166
177
|
* 문항 카드. body: 문항 칸들 · types: [[값, 이름], …]
|
|
167
178
|
* data-role="type" (유형 select) · data-role="up" · data-role="down" · data-role="delete"
|
|
179
|
+
* 문항이 하나뿐이면 ↑ · ↓는 숨긴다 (옮길 곳이 없음)
|
|
168
180
|
*/
|
|
169
181
|
export const card = ({ q, index, count, types, body }) => html`
|
|
170
182
|
<section class="qe-card">
|
|
@@ -178,29 +190,31 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
178
190
|
</select>
|
|
179
191
|
<button
|
|
180
192
|
type="button"
|
|
181
|
-
class="
|
|
193
|
+
class="ec-icon-button"
|
|
182
194
|
data-role="up"
|
|
183
195
|
aria-label="${t.questionUp(index + 1)}"
|
|
184
196
|
${index === 0 && 'disabled'}
|
|
197
|
+
${count === 1 && 'hidden'}
|
|
185
198
|
>
|
|
186
199
|
${t.up}
|
|
187
200
|
</button>
|
|
188
201
|
<button
|
|
189
202
|
type="button"
|
|
190
|
-
class="
|
|
203
|
+
class="ec-icon-button"
|
|
191
204
|
data-role="down"
|
|
192
205
|
aria-label="${t.questionDown(index + 1)}"
|
|
193
206
|
${index === count - 1 && 'disabled'}
|
|
207
|
+
${count === 1 && 'hidden'}
|
|
194
208
|
>
|
|
195
209
|
${t.down}
|
|
196
210
|
</button>
|
|
197
211
|
<button
|
|
198
212
|
type="button"
|
|
199
|
-
class="
|
|
213
|
+
class="ec-icon-button"
|
|
200
214
|
data-role="delete"
|
|
201
215
|
aria-label="${t.questionDelete(index + 1)}"
|
|
202
216
|
>
|
|
203
|
-
${
|
|
217
|
+
${icons.trash()}
|
|
204
218
|
</button>
|
|
205
219
|
</header>
|
|
206
220
|
${body}
|
|
@@ -63,6 +63,14 @@ export const group = {
|
|
|
63
63
|
`,
|
|
64
64
|
/** 보기를 모두 그룹에 놓았을 때 풀에 보이는 안내 */
|
|
65
65
|
poolEmpty: () => html`<p class="qz-empty">${t.groupPoolEmpty}</p>`,
|
|
66
|
-
/** 빈
|
|
67
|
-
boxEmpty: () => html
|
|
66
|
+
/** 빈 그룹: 파일 올리기 칸처럼 점선 상자 + 아이콘 + 안내 */
|
|
67
|
+
boxEmpty: () => html`
|
|
68
|
+
<div class="ec-dropzone">
|
|
69
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
70
|
+
<path d="M12 4v10M8 10l4 4 4-4M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2" />
|
|
71
|
+
</svg>
|
|
72
|
+
<p class="ec-dropzone-title">${t.groupEmptyTitle}</p>
|
|
73
|
+
<p>${t.groupEmpty}</p>
|
|
74
|
+
</div>
|
|
75
|
+
`,
|
|
68
76
|
};
|
|
@@ -25,8 +25,8 @@ export const texts = {
|
|
|
25
25
|
'정답은 문항마다 고릅니다 (객관식 · 그룹 분류는 보기 줄에서, 순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 기준 답안(정규표현식)을 만들어 채점에 씁니다. 학생은 모든 문항을 맞혀야 완료(100점)됩니다. 정답은 학생에게 보이지 않습니다.',
|
|
26
26
|
label: '정답',
|
|
27
27
|
hint: {
|
|
28
|
-
select_one: '정답 보기
|
|
29
|
-
select_multiple: '정답 보기
|
|
28
|
+
select_one: '정답 보기 앞의 "정답"을 고르세요.',
|
|
29
|
+
select_multiple: '정답 보기 앞의 "정답"을 모두 고르세요.',
|
|
30
30
|
order: '정답 순서대로 칸에 놓으세요.',
|
|
31
31
|
group: '보기마다 정답 그룹을 고르세요. "그룹 없음"인 보기는 오답 보기입니다.',
|
|
32
32
|
text: '정답으로 인정할 답을 줄마다 하나씩 적으세요. 앞뒤 공백은 무시합니다.',
|
|
@@ -74,7 +74,8 @@ export const texts = {
|
|
|
74
74
|
groupRemove: '빼기',
|
|
75
75
|
groupRemoveLabel: option => `${option} 빼기`,
|
|
76
76
|
groupPoolEmpty: '모든 보기를 그룹에 배치하였습니다.',
|
|
77
|
-
|
|
77
|
+
groupEmptyTitle: '보기를 여기로 끌어 놓으세요',
|
|
78
|
+
groupEmpty: '또는 보기를 누른 뒤 이곳을 눌러 주세요.',
|
|
78
79
|
},
|
|
79
80
|
|
|
80
81
|
/** 내용 편집 화면 */
|
|
@@ -85,8 +86,6 @@ export const texts = {
|
|
|
85
86
|
optional: ' 선택',
|
|
86
87
|
required: ' *',
|
|
87
88
|
count: (length, max) => `${length} / ${max}`,
|
|
88
|
-
preview: '미리보기',
|
|
89
|
-
previewClose: '미리보기 닫기',
|
|
90
89
|
question: no => `문항 ${no}`,
|
|
91
90
|
questionType: no => `문항 ${no} 유형`,
|
|
92
91
|
questionUp: no => `문항 ${no} 위로`,
|
|
@@ -122,7 +121,6 @@ export const texts = {
|
|
|
122
121
|
explanation: '해설',
|
|
123
122
|
sortLabel: label => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
|
|
124
123
|
sortTitle: '끌어서 순서 바꾸기',
|
|
125
|
-
delete: '×',
|
|
126
124
|
up: '↑',
|
|
127
125
|
down: '↓',
|
|
128
126
|
handle: '⠿',
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CommandResult } from '../../types.js';
|
|
2
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk guide [\uC8FC\uC81C] [--json]\n\n \uC5D0\uC774\uC804\uD2B8(Claude \uB4F1)\uAC00 \uD559\uC2B5\uC790\uB8CC\uB97C \uB9CC\uB4E4 \uB54C \uC77D\uB294 \uAC1C\uBC1C \uAC00\uC774\uB4DC(\uC601\uC5B4)\uB97C \uCD9C\uB825\uD55C\uB2E4.\n \uC8FC\uC81C \uC5C6\uC774: \uC8FC\uC81C \uBAA9\uB85D \u00B7 \uC8FC\uC81C: \uADF8 \uC808\uB9CC (\uBC88\uD638\uB098 \uC55E\uBD80\uBD84\uB9CC \uC801\uC5B4\uB3C4 \uB428, \uC608: build \u00B7 10) \u00B7 all: \uC804\uCCB4\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uC131\uACF5 \u00B7 2 \uC5C6\uB294 \uC8FC\uC81C";
|
|
3
|
-
/** CLI 패키지에 들어 있는 가이드: CLI와 같은 버전이라 명령 · 규칙과 어긋나지 않는다 */
|
|
4
|
-
export declare const GUIDE_FILE: string;
|
|
5
|
-
export interface GuideTopic {
|
|
6
|
-
/** 제목을 소문자 · 하이픈으로 (예: "10. Build" → "10-build") */
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
/** 제목 줄을 포함한 절 본문 */
|
|
10
|
-
body: string;
|
|
11
|
-
}
|
|
12
|
-
export interface Guide {
|
|
13
|
-
title: string;
|
|
14
|
-
/** 첫 `##` 앞 (무엇을 만드는지 · 화면 표) */
|
|
15
|
-
intro: string;
|
|
16
|
-
topics: GuideTopic[];
|
|
17
|
-
}
|
|
18
|
-
/** 제목 → 주제 id: 소문자, 글자 · 숫자가 아닌 것이 이어지면 하이픈 하나 */
|
|
19
|
-
export declare function toTopicId(title: string): string;
|
|
20
|
-
/** `##` 절로 나눈다. 코드 블록 안의 `##`는 제목이 아니다 */
|
|
21
|
-
export declare function parseGuide(markdown: string): Guide;
|
|
22
|
-
export declare function loadGuide(file?: string): Guide;
|
|
23
|
-
/** 주제 찾기: id 그대로 → 번호(10) → id 안의 낱말(build) 순. 여럿이면 찾지 못한 것으로 */
|
|
24
|
-
export declare function findTopic(guide: Guide, query: string): GuideTopic | undefined;
|
|
25
|
-
export declare function run(args: {
|
|
26
|
-
topic?: string | undefined;
|
|
27
|
-
json: boolean;
|
|
28
|
-
file?: string;
|
|
29
|
-
}): CommandResult;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { VERSION } from '../../version.js';
|
|
4
|
-
|
|
5
|
-
const usage = `사용법: ecdk guide [주제] [--json]
|
|
6
|
-
|
|
7
|
-
에이전트(Claude 등)가 학습자료를 만들 때 읽는 개발 가이드(영어)를 출력한다.
|
|
8
|
-
주제 없이: 주제 목록 · 주제: 그 절만 (번호나 앞부분만 적어도 됨, 예: build · 10) · all: 전체
|
|
9
|
-
|
|
10
|
-
종료 코드: 0 성공 · 2 없는 주제`;
|
|
11
|
-
/** CLI 패키지에 들어 있는 가이드: CLI와 같은 버전이라 명령 · 규칙과 어긋나지 않는다 */
|
|
12
|
-
const GUIDE_FILE = fileURLToPath(new URL('../../../guides/content-development.md', import.meta.url));
|
|
13
|
-
/** 제목 → 주제 id: 소문자, 글자 · 숫자가 아닌 것이 이어지면 하이픈 하나 */
|
|
14
|
-
function toTopicId(title) {
|
|
15
|
-
return title.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, '-').replace(/^-+|-+$/g, '');
|
|
16
|
-
}
|
|
17
|
-
/** `##` 절로 나눈다. 코드 블록 안의 `##`는 제목이 아니다 */
|
|
18
|
-
function parseGuide(markdown) {
|
|
19
|
-
const title = /^#\s+(.+?)\s*$/m.exec(markdown)?.[1] ?? '';
|
|
20
|
-
const intro = [];
|
|
21
|
-
const topics = [];
|
|
22
|
-
let current = null;
|
|
23
|
-
let fence = null;
|
|
24
|
-
const flush = () => {
|
|
25
|
-
if (current) topics.push({
|
|
26
|
-
id: toTopicId(current.title),
|
|
27
|
-
title: current.title,
|
|
28
|
-
body: current.lines.join('\n').trimEnd()
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
for (const line of markdown.split('\n')) {
|
|
32
|
-
const marker = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];
|
|
33
|
-
if (marker) {
|
|
34
|
-
if (fence === null) fence = marker;else if (marker.startsWith(fence[0] ?? '') && marker.length >= fence.length) fence = null;
|
|
35
|
-
}
|
|
36
|
-
const heading = fence === null ? /^##\s+(.+?)\s*#*\s*$/.exec(line)?.[1] : undefined;
|
|
37
|
-
if (heading) {
|
|
38
|
-
flush();
|
|
39
|
-
current = {
|
|
40
|
-
title: heading,
|
|
41
|
-
lines: [line]
|
|
42
|
-
};
|
|
43
|
-
} else if (current) current.lines.push(line);else if (!/^#\s/.test(line)) intro.push(line);
|
|
44
|
-
}
|
|
45
|
-
flush();
|
|
46
|
-
return {
|
|
47
|
-
title,
|
|
48
|
-
intro: intro.join('\n').trim(),
|
|
49
|
-
topics
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function loadGuide(file = GUIDE_FILE) {
|
|
53
|
-
return parseGuide(readFileSync(file, 'utf8'));
|
|
54
|
-
}
|
|
55
|
-
/** 주제 찾기: id 그대로 → 번호(10) → id 안의 낱말(build) 순. 여럿이면 찾지 못한 것으로 */
|
|
56
|
-
function findTopic(guide, query) {
|
|
57
|
-
const q = toTopicId(query);
|
|
58
|
-
if (!q) return undefined;
|
|
59
|
-
const exact = guide.topics.find(t => t.id === q);
|
|
60
|
-
if (exact) return exact;
|
|
61
|
-
const byNumber = guide.topics.find(t => t.id.startsWith(`${q}-`) && /^\d+$/.test(q));
|
|
62
|
-
if (byNumber) return byNumber;
|
|
63
|
-
// 번호 없이 적은 id (예: what-the-person-decides → 0-what-the-person-decides)
|
|
64
|
-
const byName = guide.topics.find(t => t.id.replace(/^\d+-/, '') === q);
|
|
65
|
-
if (byName) return byName;
|
|
66
|
-
const partial = guide.topics.filter(t => t.id.split('-').some(word => word === q) || t.id.startsWith(q));
|
|
67
|
-
return partial.length === 1 ? partial[0] : undefined;
|
|
68
|
-
}
|
|
69
|
-
function list(guide) {
|
|
70
|
-
return [`# ${guide.title} (ecdk ${VERSION})`, '', guide.intro, '', 'Topics (read one with `ecdk guide <topic>`, everything with `ecdk guide all`):', ...guide.topics.map(t => `- ${t.id}: ${t.title}`)].join('\n');
|
|
71
|
-
}
|
|
72
|
-
function run(args) {
|
|
73
|
-
const guide = loadGuide(args.file);
|
|
74
|
-
const topics = guide.topics.map(({
|
|
75
|
-
id,
|
|
76
|
-
title
|
|
77
|
-
}) => ({
|
|
78
|
-
id,
|
|
79
|
-
title
|
|
80
|
-
}));
|
|
81
|
-
if (args.topic === undefined) {
|
|
82
|
-
return {
|
|
83
|
-
exitCode: 0,
|
|
84
|
-
output: args.json ? JSON.stringify({
|
|
85
|
-
title: guide.title,
|
|
86
|
-
version: VERSION,
|
|
87
|
-
intro: guide.intro,
|
|
88
|
-
topics
|
|
89
|
-
}, null, 2) : list(guide)
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (args.topic === 'all') {
|
|
93
|
-
const text = readFileSync(args.file ?? GUIDE_FILE, 'utf8');
|
|
94
|
-
return {
|
|
95
|
-
exitCode: 0,
|
|
96
|
-
output: args.json ? JSON.stringify({
|
|
97
|
-
title: guide.title,
|
|
98
|
-
version: VERSION,
|
|
99
|
-
markdown: text
|
|
100
|
-
}, null, 2) : text
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const topic = findTopic(guide, args.topic);
|
|
104
|
-
if (!topic) {
|
|
105
|
-
const message = `없는 주제입니다: ${args.topic}`;
|
|
106
|
-
return {
|
|
107
|
-
exitCode: 2,
|
|
108
|
-
output: args.json ? JSON.stringify({
|
|
109
|
-
error: message,
|
|
110
|
-
topics
|
|
111
|
-
}, null, 2) : `${message}\n\n${topics.map(t => `- ${t.id}: ${t.title}`).join('\n')}`
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
exitCode: 0,
|
|
116
|
-
output: args.json ? JSON.stringify(topic, null, 2) : topic.body
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export { GUIDE_FILE, findTopic, loadGuide, parseGuide, run, toTopicId, usage };
|