@eliceio/cdk-cli 1.1.0 → 1.2.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.
Files changed (75) hide show
  1. package/README.md +65 -38
  2. package/es/cli.js +35 -2
  3. package/es/commands/create/index.js +2 -2
  4. package/es/commands/dev/index.d.ts +8 -3
  5. package/es/commands/dev/index.js +72 -3
  6. package/es/commands/doctor/index.d.ts +1 -1
  7. package/es/commands/doctor/index.js +10 -13
  8. package/es/commands/setup/index.d.ts +1 -1
  9. package/es/commands/setup/index.js +4 -3
  10. package/es/commands/uninstall/index.d.ts +1 -1
  11. package/es/commands/uninstall/index.js +7 -30
  12. package/es/core/config.d.ts +2 -2
  13. package/es/core/config.js +2 -2
  14. package/es/core/skills.d.ts +22 -4
  15. package/es/core/skills.js +89 -17
  16. package/es/dev/browser.d.ts +22 -0
  17. package/es/dev/browser.js +105 -0
  18. package/es/dev/check.d.ts +84 -0
  19. package/es/dev/check.js +326 -0
  20. package/es/dev/host-page.js +10 -0
  21. package/es/dev/mock-api.js +1 -1
  22. package/es/dev/server.d.ts +2 -0
  23. package/es/dev/server.js +1 -0
  24. package/es/rules/check.js +1 -1
  25. package/es/rules/manifest.d.ts +1 -1
  26. package/es/rules/manifest.js +2 -2
  27. package/es/test-old-skill.d.ts +5 -0
  28. package/package.json +3 -2
  29. package/skills/_shared/always.md +13 -5
  30. package/skills/{elice-content-guide/topics → _shared/references}/00-what-the-person-decides.md +2 -2
  31. package/skills/{elice-content-guide/topics → _shared/references}/02-design-the-material.md +13 -4
  32. package/skills/{elice-content-guide/topics → _shared/references}/03-create-the-project.md +2 -2
  33. package/skills/_shared/references/05-screen-code.md +169 -0
  34. package/skills/{elice-content-guide/topics → _shared/references}/06-using-the-quiz-template.md +4 -3
  35. package/skills/{elice-content-guide/topics → _shared/references}/07-move-existing-html.md +1 -1
  36. package/skills/_shared/references/08-fix-check-errors.md +28 -0
  37. package/skills/_shared/references/09-check.md +29 -0
  38. package/skills/_shared/references/10-build.md +8 -0
  39. package/skills/_shared/references/12-upload-with-the-material-mcp.md +83 -0
  40. package/skills/elice-content-check/SKILL.md +7 -9
  41. package/skills/elice-content-create/SKILL.md +12 -10
  42. package/skills/elice-content-migrate/SKILL.md +10 -8
  43. package/skills/elice-content-publish/SKILL.md +10 -8
  44. package/templates/_shared/lib/cdk-mock.d.ts +1 -1
  45. package/templates/_shared/lib/cdk-mock.js +2 -2
  46. package/templates/_shared/lib/elice-content.css +1 -1
  47. package/templates/_shared/lib/elice-content.d.ts +1 -1
  48. package/templates/_shared/lib/elice-content.js +35 -18
  49. package/templates/blank/README.md +24 -21
  50. package/templates/blank/screens/edit.js +1 -1
  51. package/templates/blank/template.json +1 -1
  52. package/templates/quiz/README.md +8 -7
  53. package/templates/quiz/core/editor.js +141 -4
  54. package/templates/quiz/core/model.js +4 -3
  55. package/templates/quiz/metadata.json +1 -1
  56. package/templates/quiz/screens/edit.js +673 -162
  57. package/templates/quiz/screens/learn.js +1 -1
  58. package/templates/quiz/styles.css +557 -73
  59. package/templates/quiz/template.json +2 -2
  60. package/templates/quiz/ui/templates/edit.d.ts +1 -1
  61. package/templates/quiz/ui/templates/edit.js +417 -76
  62. package/templates/quiz/ui/templates/page.js +2 -17
  63. package/templates/quiz/ui/templates/question.js +1 -1
  64. package/templates/quiz/ui/texts.js +40 -27
  65. package/skills/elice-content-guide/SKILL.md +0 -42
  66. package/skills/elice-content-guide/topics/05-screen-code.md +0 -132
  67. package/skills/elice-content-guide/topics/08-fix-check-errors.md +0 -27
  68. package/skills/elice-content-guide/topics/09-check.md +0 -11
  69. package/skills/elice-content-guide/topics/10-build.md +0 -8
  70. package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +0 -41
  71. package/templates/quiz/instructor.html +0 -17
  72. package/templates/quiz/screens/instructor.js +0 -33
  73. /package/skills/{elice-content-guide/topics → _shared/references}/01-check-the-environment.md +0 -0
  74. /package/skills/{elice-content-guide/topics → _shared/references}/04-rules.md +0 -0
  75. /package/skills/{elice-content-guide/topics → _shared/references}/11-more.md +0 -0
@@ -1,9 +1,9 @@
1
- // 화면 머리 (학생 · 교육자)와 불러오는 동안 보이는 자리. 문항 위에 무엇을 보일지 여기서 고칩니다.
1
+ // 학생 화면 머리와 불러오는 동안 보이는 자리. 문항 위에 무엇을 보일지 여기서 고칩니다.
2
2
  import { html } from '../../core/dom.js';
3
3
  import { markdown } from '../../core/markdown.js';
4
4
  import { texts } from '../texts.js';
5
5
 
6
- /** 내용을 받기 전까지 보이는 문구 (학생 · 교육자 · 편집 공통) */
6
+ /** 내용을 받기 전까지 보이는 문구 (학생 · 편집 공통) */
7
7
  export const loading = () => html`<p class="ec-muted">${texts.page.loading}</p>`;
8
8
 
9
9
  /** 학생 화면 머리: 제목 · 안내 */
@@ -11,18 +11,3 @@ export const learnHeader = ({ title, description }) => html`
11
11
  <h1 class="qz-title">${title}</h1>
12
12
  ${description ? markdown(description, 'qz-markdown qz-lead') : null}
13
13
  `;
14
-
15
- /** 교육자 화면 머리: 제목 · 요약. byType: [[유형 이름, 문항 수], …] */
16
- export const instructorHeader = ({ title, count, byType }) => html`
17
- <h1 class="qz-title">${title}</h1>
18
- <section class="qz-summary">
19
- <span class="qz-badge dark">${texts.instructor.badge}</span>
20
- <p>
21
- ${texts.instructor.summary(
22
- count,
23
- byType.map(([type, n]) => texts.instructor.summaryType(type, n)),
24
- )}
25
- </p>
26
- <p class="qz-muted">${texts.instructor.note}</p>
27
- </section>
28
- `;
@@ -1,4 +1,4 @@
1
- // 문항 겉모양 (학생 · 교육자 공통): 제목 · 유형 표시(교육자 화면만) · 지문 · 본문 · 결과 · 해설
1
+ // 문항 겉모양: 제목 · 유형 표시(labels.types를 넘길 때만) · 지문 · 본문 · 결과 · 해설
2
2
  // 꼭 남길 것: data-role="result" (정답 · 오답 문구 자리), data-role="explanation" (해설, 처음엔 hidden)
3
3
  // 동작이 문항 요소에 data-role="question" · data-id · data-result="correct|wrong"를 붙입니다.
4
4
  import { html } from '../../core/dom.js';
@@ -1,4 +1,4 @@
1
- // 퀴즈 화면에 보이는 문구 모음 (학생 · 교육자 · 편집). 문구를 바꾸려면 여기만 고치면 됩니다.
1
+ // 퀴즈 화면에 보이는 문구 모음 (학생 · 편집). 문구를 바꾸려면 여기만 고치면 됩니다.
2
2
  // 숫자 · 이름이 들어가는 문구는 함수입니다: 모양(인자)은 그대로 두고 돌려주는 글만 바꾸세요.
3
3
 
4
4
  export const texts = {
@@ -14,25 +14,22 @@ export const texts = {
14
14
  /** 브라우저 탭 제목 · 불러오는 동안 보이는 문구 (화면이 넣음. HTML의 같은 글은 스크립트가 돌기 전 대비용) */
15
15
  page: {
16
16
  learn: '학생 화면',
17
- instructor: '교육자 화면',
18
17
  edit: '내용 편집',
19
18
  loading: '불러오는 중…',
20
19
  },
21
20
 
22
21
  /** 편집 화면의 정답 (ADR 0009: 퀴즈는 채점해 통과하면 완료 · 기준 답안 고정, 정답은 문항마다 여기서 고름) */
23
22
  answers: {
24
- intro:
25
- '정답은 보기 줄에서 고릅니다(순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 채점하며, 정답은 학생에게 보이지 않습니다.',
26
23
  label: '정답',
27
24
  hint: {
28
- select_one: "정답인 보기를 '정답' 열에서 고르세요.",
29
- select_multiple: "정답인 보기를 '정답' 열에서 모두 고르세요.",
30
- order: '정답 순서대로 칸에 놓으세요.',
31
- group: "보기마다 들어갈 그룹을 '정답' 열에서 고르세요. \"오답 (그룹 없음)\"인 보기는 어느 그룹에도 넣지 않는 오답 보기입니다.",
32
- text: '정답으로 인정할 답을 한 줄에 하나씩 적으세요. 여러 줄이면 그중 하나만 맞아도 정답입니다. 앞뒤 공백은 무시합니다.',
25
+ order: '정답 순서대로 보기를 적으세요. 학생에게는 섞여서 보입니다',
26
+ group: '보기를 알맞은 그룹 상자 안에 적으세요',
27
+ text: '유사 정답 중 하나만 맞아도 정답입니다.',
33
28
  },
34
- textPlaceholder: '예: 가중치\nweight',
35
- typeChanged: '유형을 바꾸면 고른 정답이 초기화됩니다. 정답을 다시 고른 뒤 저장하세요.',
29
+ addText: '+ 유사 정답 추가',
30
+ textInput: i => (i === 0 ? '정답 입력' : `유사 정답 ${i} 입력`),
31
+ textDelete: i => (i === 0 ? '정답 지우기' : `유사 정답 ${i} 지우기`),
32
+ textMin: '정답은 하나 이상 있어야 합니다.',
36
33
  unreadable:
37
34
  '저장된 정답(기준 답안)을 이 화면이 읽지 못했어요. 문항마다 정답을 다시 골라 저장해 주세요.',
38
35
  validation: {
@@ -42,6 +39,9 @@ export const texts = {
42
39
  badRegex: '정답으로 기준 답안을 만들지 못했어요. 정답을 다시 골라 주세요.',
43
40
  roundTrip: '정답으로 낸 답이 기준 답안과 맞지 않습니다. 정답을 다시 골라 주세요.',
44
41
  tooWide: '다른 답도 정답으로 인정됩니다. 정답을 다시 확인해 주세요.',
42
+ // 퀴즈 전체 정답 길이가 한도를 넘음 (가장 긴 문항에 붙여 보인다)
43
+ tooLong: (length, max) =>
44
+ `정답이 너무 깁니다 (퀴즈 전체 ${length}자, 최대 ${max}자). 이 문항의 정답 · 유사 정답을 줄이거나 퀴즈를 나눠 주세요.`,
45
45
  },
46
46
  },
47
47
 
@@ -50,15 +50,7 @@ export const texts = {
50
50
  unanswered: no => `${no}번 문항에 답해 주세요.`,
51
51
  },
52
52
 
53
- /** 교육자 화면 */
54
- instructor: {
55
- badge: '교육자 화면',
56
- summary: (count, byType) => `문항 ${count}개 · ${byType.join(' · ')}`,
57
- summaryType: (type, n) => `${type} ${n}`,
58
- note: '정답은 내용 편집 화면에서 문항마다 정합니다. 모든 문항을 맞혀야 100점입니다.',
59
- },
60
-
61
- /** 문항 (학생 · 교육자 공통) */
53
+ /** 문항 */
62
54
  question: {
63
55
  title: (no, title) => `${no}. ${title}`,
64
56
  correct: '정답',
@@ -81,9 +73,16 @@ export const texts = {
81
73
 
82
74
  /** 내용 편집 화면 */
83
75
  edit: {
84
- done: '편집 완료',
76
+ done: '초안에 반영',
77
+ // 라벨은 화면에 보이지 않고 화면 낭독기가 읽는다. 무슨 칸인지는 placeholder가 알린다
85
78
  quizTitle: '퀴즈 제목',
86
- quizDescription: '안내',
79
+ quizTitlePlaceholder: '퀴즈 제목',
80
+ quizDescription: '퀴즈 안내',
81
+ quizDescriptionPlaceholder: '퀴즈 안내',
82
+ addDescription: '설명 추가',
83
+ revealClose: label => `${label.replace(/^\+\s*/, '')} 지우기`,
84
+ titlePlaceholder: '질문을 입력하세요',
85
+ descriptionPlaceholder: '설명',
87
86
  optional: ' 선택',
88
87
  required: ' *',
89
88
  count: (length, max) => `${length} / ${max}`,
@@ -94,8 +93,9 @@ export const texts = {
94
93
  questionDelete: no => `문항 ${no} 삭제`,
95
94
  questionDeleted: no => `문항 ${no}을 삭제했습니다.`,
96
95
  undo: '되돌리기',
96
+ typeChanged: '유형을 바꿔 질문만 남기고 모두 초기화했습니다.',
97
97
  addQuestion: '+ 문항 추가',
98
- singleQuestion: '퀴즈 하나에 문항은 하나입니다. 여러 문항은 퀴즈 페이지를 여러 개 만들어 주세요.',
98
+ questionLimit: '문항은 20개까지 넣을 수 있습니다.',
99
99
  title: '질문',
100
100
  description: '설명',
101
101
  options: '보기',
@@ -111,18 +111,31 @@ export const texts = {
111
111
  groupsMin: min => `그룹은 ${min}개 이상이어야 합니다.`,
112
112
  groupsMax: max => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
113
113
  addGroup: '+ 그룹 추가',
114
+ groupBoard: '그룹과 보기',
115
+ noneTitle: '오답 보기',
116
+ noneHint: '어느 그룹에도 속하지 않는 보기',
117
+ addNone: '오답 보기 추가',
118
+ orderTitle: '정답 순서',
119
+ noneHintOrder: '정답 순서에 들어가지 않는 보기',
120
+ noneClose: '오답 보기 삭제',
121
+ noneDeleted: n => `오답 보기 ${n}개를 삭제했습니다.`,
114
122
  answer: '정답',
123
+ answerTitle: '정답으로 지정',
115
124
  answerLabel: no => `보기 ${no} 정답`,
116
125
  answerGroup: no => `보기 ${no} 정답 그룹`,
117
126
  answerNoGroup: '오답 (그룹 없음)',
118
127
  slots: '답안 칸 수',
119
128
  slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
120
129
  placeholder: '입력란 힌트',
121
- placeholderHint: '비우면 "답안을 작성해 주세요."',
122
- display: '표시 옵션',
123
- shuffle: '답안 순서 섞기 (학생마다 보기 순서가 달라집니다)',
124
- explanationOn: '해설 사용 (학생이 한 번 제출하면 보입니다)',
130
+ addPlaceholder: '입력란 힌트 추가',
131
+ placeholderInput: '예: 정답을 한 단어로 입력해 주세요',
132
+ placeholderHint: '학생 답안 칸에 흐리게 미리 보이는 안내 글입니다. 비우면 "답안을 작성해 주세요."가 보입니다.',
133
+ shuffle: '보기 순서 섞기',
134
+ shuffleHint: '학생마다 보기 순서가 달라집니다',
135
+ addExplanation: '해설 추가',
125
136
  explanation: '해설',
137
+ explanationHint: '학생이 한 번 제출하면 보입니다',
138
+ explanationPlaceholder: '해설을 입력하세요',
126
139
  sortLabel: label => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
127
140
  sortTitle: '끌어서 순서 바꾸기',
128
141
  up: '↑',
@@ -1,42 +0,0 @@
1
- ---
2
- name: elice-content-guide
3
- description: The Elice Custom HTML learning material development guide (LXP material type 17, ecdk CLI) - design, the LXP sandbox rules, screen code and SDK, templates, fixing ecdk validate or build errors, checking, building and uploading. The other elice-content skills (create, migrate, check, publish) read its topic files; read it when you work on an Elice or LXP learning material.
4
- ---
5
-
6
- # Developing Elice Custom HTML learning materials
7
-
8
- A Custom HTML learning material is **a small web app in one zip**. Anything that runs in a browser can be a learning material: an explanation, an interactive simulation or visualization, a guided exercise, a game-like activity, flashcards, a self-check or survey, a quiz, or the description of a practice problem.
9
-
10
- Build it with the `ecdk` CLI (`@eliceio/cdk-cli`). This guide is split into topic files in `topics/` next to this file: read only the topics you need, with the Read tool (table below). For a command's options, run `ecdk <command> --help`.
11
-
12
- One zip has up to three screens. The completion policy is not part of the zip: the instructor picks it in the LXP settings tab after the upload (ADR 0012).
13
-
14
- | Screen | Files | What it does |
15
- | ----------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
- | Student (required) | `index.html` + `screens/learn.js` | The learning activity (read, interact, solve, make). Submits a result when needed |
17
- | Instructor (optional) | `instructor.html` + `screens/instructor.js` | What only instructors see: activity summary, explanations, teaching tips |
18
- | Content edit (optional) | `edit.html` + `screens/edit.js` | Instructors edit text and data without code and save it → `app.content` of the other screens. Also sets the grader and the answers or rubric, saved to `settings.grading` (never sent to students) |
19
-
20
- Elice opens the content in a **sandboxed (`allow-scripts allow-same-origin`) iframe on its own origin**, separate from Elice and from other contents. There is no server: everything runs as browser JS, and only submission, saving and grading go to the Elice server.
21
-
22
- ## Topics
23
-
24
- The other elice-content skills point to these files as `../elice-content-guide/topics/<file>` (this skill is installed next to them by `ecdk setup --only skills`). Cross references inside a topic ("see 2 ②") use the topic number.
25
-
26
- | Topic file | Read when |
27
- | ------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
28
- | `topics/00-what-the-person-decides.md` | Before you design or upload: what the person decides (goal, answers, grading, learning notes, upload) |
29
- | `topics/01-check-the-environment.md` | At the start: `ecdk doctor`, installing or updating ecdk, registering the material MCP |
30
- | `topics/02-design-the-material.md` | Designing: screens, submission and grading, learning notes, which completion policy fits |
31
- | `topics/03-create-the-project.md` | Picking a template and running `ecdk create` |
32
- | `topics/04-rules.md` | Before writing code: what the LXP sandbox blocks and what never goes in the zip |
33
- | `topics/05-screen-code.md` | Writing screens: the SDK, the screen kit and its UI patterns |
34
- | `topics/06-using-the-quiz-template.md` | Working on the quiz template |
35
- | `topics/07-move-existing-html.md` | Moving existing HTML or a web demo into a project |
36
- | `topics/08-fix-check-errors.md` | `ecdk validate` or `ecdk build` reports an error or warning (look the id up) |
37
- | `topics/09-check.md` | Checking the screens in `ecdk dev` before you report |
38
- | `topics/10-build.md` | Building the zip and reporting to the person |
39
- | `topics/11-more.md` | Where to find more (SDK docs, `--help`) |
40
- | `topics/12-upload-with-the-material-mcp.md` | Uploading to LXP with the `elice-material` MCP |
41
-
42
- {{version}}
@@ -1,132 +0,0 @@
1
- # 5. Screen code
2
-
3
- ```js
4
- import { start } from '../lib/elice-content.js';
5
-
6
- // Student screen
7
- const app = await start({ screen: 'learn' });
8
- // Content is only what the edit screen saved (no default content file). Before that, show the kit's notice
9
- if (app.hasContent) render(app.content);
10
- else root.replaceChildren(app.emptyState());
11
-
12
- // Only for materials with a submission: say how to collect and restore the answer (result).
13
- // Locking, restoring and result messages are handled by the kit.
14
- app.useSubmit({
15
- getAnswer: () => ({ result: currentResult() }), // small JSON (a few KB at most)
16
- setAnswer: a => restore(a?.result), // filled on reopen and in tutoring
17
- validate: a => a.result != null || 'Finish the activity before submitting.',
18
- onResult: res => showFeedback(res), // grading result (score · isCorrect)
19
- });
20
- ```
21
-
22
- ```js
23
- // Content edit screen: render the fields and say what to save
24
- const app = await start({ screen: 'edit' });
25
- renderForm(app.content);
26
- app.useSave({
27
- getContent: () => ({ ...app.content, title: titleInput.value, steps: readSteps() }),
28
- validate: c => c.title.trim() !== '' || 'Enter a title.',
29
- });
30
- ```
31
-
32
- ```js
33
- // Edit screen with the grader block: the kit draws LXP's grader radios, the "기준 답안 (정규표현식)" field
34
- // with "작성 예시 보기", and the "평가 기준" field. useSave saves the content and the grader in one save.
35
- const grading = app.useGradingBlock();
36
- app.useSave({ getContent: () => app.content, getGrading: () => grading.getGrading() });
37
- ```
38
-
39
- - `getGrading` returns the grading settings (`{ type: 'pattern', answer_key }` or `{ type: 'rubric', rubric }`) or an error message that blocks saving. `app.grading` is the saved grading (only on the edit screen).
40
- - When the edit screen saves the grading, the student screen must submit (`grading.no-submit` warns when the edit screen uses `useGradingBlock` · `getGrading` · `grading:` but no code calls `useSubmit` · `submit(`).
41
- - Saving on the edit screen (`useSave`) **saves to the material's draft** (SDK `saveSettings`, with the edit token LXP opens the edit screen with). LXP's previews show the draft right away; learners see it only after the person presses 저장 at the bottom of the LXP edit page, which publishes the draft as a new version. In `ecdk dev` there is no publish step, so the student view changes at once. The kit shows the result and the failure messages (the upload is not saved yet, the upload is still processing, session expired), so the screen code does not announce "saved" itself.
42
- - Materials without a submission do not call `useSubmit` (only `on_access` fits them in LXP).
43
- - Use `app.mode` (`learn` · `preview` · `tutor` · `instructor` · `edit`), `app.readOnly` (tutoring) and `app.account.anonymousId` (for example a per-person fixed random seed) only when needed. The kit handles per-mode behavior such as the tutoring lock, so the screen code does not branch on the mode.
44
- - Steps inside one material (see "Steps inside one material" in 2): let the kit draw the side buttons and the `n / N` indicator. Never draw an LXP-like bottom 이전 · 다음 bar.
45
-
46
- ```js
47
- app.usePaging({
48
- count: steps.length,
49
- // also called once at start. Draw only into `content` (#app by default); the kit keeps its buttons outside it
50
- onChange: (i, { content }) => content.replaceChildren(renderStep(steps[i])),
51
- });
52
- ```
53
-
54
- The kit wraps the content area (`root`, default `#app`) in its own frame and puts the side buttons and `n / N` in the frame, so redrawing `#app` (`replaceChildren`, `innerHTML`) does not remove them. Toggling `hidden` on prepared step elements works too. `usePaging({ count, onChange, start, root })` returns `{ element, content, go(i), step, ready }`. Use `go(i)` to jump (for example "다시 배분하기" back to step 3). Gating a step (for example "submit before moving on") is the screen's job: show a message in the step, the kit does not lock the arrows.
55
-
56
- - Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
57
-
58
- ### Content editor (JSON)
59
-
60
- 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.
61
-
62
- ```js
63
- import { start } from '../lib/elice-content.js';
64
- import { useContentEditor } from '../lib/elice-content-editor.js';
65
-
66
- const app = await start({ screen: 'edit' });
67
- const schema = {
68
- title: { label: '제목', required: true },
69
- items: {
70
- label: '항목',
71
- min: 2,
72
- max: 12,
73
- item: {
74
- name: { label: '이름', required: true },
75
- value: { label: '값', type: 'number', required: true },
76
- },
77
- },
78
- };
79
- // initial: the sample the editor starts from while nothing is saved (there is still no default content file)
80
- const editor = useContentEditor(app, { initial: sample, schema });
81
- app.useSave({ getContent: editor.getContent, validate: editor.validate });
82
- ```
83
-
84
- - Two tabs. **폼 보기** (default) builds fields from the value: text → input (long text or `multiline` → textarea), number → number input, boolean → switch, `enum` → select, object → a group, list of text or numbers → rows, list of objects → cards. Lists add (a new item has the item shape with empty values), remove (a red ✕ on rows, trash on cards) with an undo notice (`.ec-notice` "항목을 삭제했습니다. 되돌리기", 6 s), reorder by dragging the `⠿` handle, the handle's ↑ · ↓ keys or the card's ↑ · ↓ buttons, and show "N개 이상이어야 합니다" at the minimum. **코드 보기** is the JSON text with colors, "정렬" (pretty print) and pasting; a syntax error shows line and column (`4줄 16칸: 쉼표(,)가 겹쳤습니다`), a schema error shows the path (`items[2].value: 숫자여야 합니다`). Going back to 폼 보기 applies the JSON only when it parses and has the right shape.
85
- - Schema (optional, a plain object, name → field): `label` · `type` (`string` · `number` · `boolean` · `object` · `array`) · `required` · `min` · `max` (number range, or item count for a list) · `multiline` · `enum` · `hint` · `placeholder` · `item` (list item: one field, or name → field for objects) · `fields` (fields of a group). Without a schema the labels are the key names and the types come from `initial`, so a number in `initial` must stay a number.
86
- - `validate` blocks the save: in 폼 보기 it shows the message under the field and focuses it (the save bar says `항목 3 › 값: 입력해 주세요`). Pass your own check as `useContentEditor(app, { validate: c => … || '…' })`. With the grader block add `getGrading` to `useSave` as above.
87
- - Only the edit screen imports `lib/elice-content-editor.js`; `ecdk build` bundles code per screen, so the student screen does not carry it.
88
- - Use the editor when the content is data (lists, numbers, short texts). Write a custom edit screen when editing needs its own UI (placing points on an image, a per-question answer UI like the quiz template). The content is visible to students: values the student screen reveals (like "정답 보기" of a self-check) may be in it, answers that are graded never are (`settings.grading`).
89
-
90
- ### UI patterns
91
-
92
- Build screens from the kit's classes in `lib/elice-content.css` (EDS values, both themes) so every material looks and behaves the same. The quiz template follows these patterns; copy its markup from `ui/templates/`.
93
-
94
- | Where | Pattern |
95
- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
- | Edit screen, a card for one item (question, step) | Title on the left, then a type `<select>` in regular weight. On the right, borderless icon buttons `button.ec-icon-button`: ↑ · ↓ · delete with a **trash** icon. Hide ↑ · ↓ when there is only one card. |
97
- | Edit screen, one row in a list (choice, group) | `⠿` drag handle → the answer control (radio or checkbox) → number → text input → remove with `button.ec-icon-button.ec-danger` (a red **✕**, no border). A wide answer control (a `<select>`) goes after the input instead. Disable remove at the minimum count. |
98
- | Student screen, an empty drop target | `.ec-dropzone`: a dashed box with an icon, a bold line `.ec-dropzone-title` (for example "보기를 여기로 끌어 놓으세요") and a hint `<p>` ("또는 보기를 누른 뒤 이곳을 눌러 주세요."). It also takes clicks, not only drops. |
99
- | Student screen, undo actions ("답안 초기화") | Show only when there is something to undo (for example at least one item placed), hide on read-only screens, and keep the row height fixed so nothing below jumps. Keep it away from the submit button. |
100
- | Any Korean text in a narrow box | `word-break: keep-all` so lines do not break inside a word. |
101
-
102
- Icon buttons always need `aria-label`. Icons are inline SVG with `stroke="currentColor"`, so color follows the button:
103
-
104
- ```html
105
- <!-- trash (delete a card) -->
106
- <svg
107
- viewBox="0 0 24 24"
108
- width="18"
109
- height="18"
110
- fill="none"
111
- stroke="currentColor"
112
- stroke-width="2"
113
- stroke-linecap="round"
114
- stroke-linejoin="round"
115
- aria-hidden="true"
116
- >
117
- <path d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />
118
- </svg>
119
- <!-- ✕ (remove one row) -->
120
- <svg
121
- viewBox="0 0 24 24"
122
- width="18"
123
- height="18"
124
- fill="none"
125
- stroke="currentColor"
126
- stroke-width="2"
127
- stroke-linecap="round"
128
- aria-hidden="true"
129
- >
130
- <path d="M6 6l12 12M18 6L6 18" />
131
- </svg>
132
- ```
@@ -1,27 +0,0 @@
1
- # 8. Fix check errors
2
-
3
- Read `check.issues[]` (`id` · `level` · `path` · `line` · `message`) from `ecdk build --json`. With an `error` no zip is made. Each `message` says how to fix it.
4
-
5
- | id | Fix |
6
- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7
- | `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file |
8
- | `ref.root-absolute` | Change `/…` to a relative path |
9
- | `ref.external-script` · `ref.external-request` · `ref.insecure` | Put the library, image, font or video in the zip and use a relative path (fonts: files or data URIs) |
10
- | `html.iframe` | Remove the `<iframe src>`/`<object>`/`<embed>` (an `<iframe>` with `srcdoc` for a code preview passes): upload video as an Elice video material, put other content in this HTML |
11
- | `ref.external-font` (warn) | A font from a host in `rules.json` `externalAllow` (empty for now): closed-network schools cannot reach it, so put a font that matters in the zip |
12
- | `ref.vendor-external-url` (warn) | A library file holds outside addresses: run `ecdk dev`, look for "막힌 외부 요청", put what it loads in the zip and set the library to a relative path |
13
- | `api.storage` · `api.cookie` (warn) | Browser storage and cookies stay only in that browser and device and are not the learner's record. Submit results; save content from the edit screen |
14
- | `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit` |
15
- | `api.external-send` | Remove the external send |
16
- | `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason |
17
- | `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**) |
18
- | `manifest.completion-policies-ignored` (warn) | Remove the old `completionPolicies` and `screens.completionPolicy` from `metadata.json` (and the completion policy screen files). The instructor picks the policy in the LXP settings tab |
19
- | `grading.no-submit` (warn) | The edit screen saves the grading but nothing submits: add `useSubmit` to the student screen, or drop the grading block when the material is not graded |
20
- | `project.legacy-file` (warn, project only) | An old `elice.config.json` · `content.json` · `grading.json` is left: `ecdk doctor --fix` moves `elice.config.json`; re-enter the content and answers in the edit screen, then delete the other files |
21
- | `sdk.outdated` (error) | The installed SDK bundled into the zip is older than the minimum (1.0.0-alpha.3 or older cannot save in the LXP edit screen - draft save fails): `npm update @eliceio/cdk`, then build again |
22
- | `sdk.lib-copy` (error, project only) | An SDK copy `lib/cdk.js` in the project (never put in the zip): `ecdk doctor --fix`, `npm install`, replace the kit `lib/elice-content.js` with a new `ecdk create` one, delete `lib/cdk.js` |
23
- | `build.template-unknown` (warn) | The material was made with a template or template version this ecdk does not know. Update ecdk (`npm i -g @eliceio/cdk-cli`) or check `template` in `package.json` `"ecdk"` |
24
- | `manifest.*` · `entry.*` | Check `screens` and `kind` in `metadata.json` |
25
- | `limit.*` · `file.large-image` | Shrink images and video, drop unused files (build output: "files not referenced anywhere") |
26
-
27
- Use `ecdk-ignore`, which turns a rule off, only for legitimate code a regular expression cannot tell apart, and **always with the reason**. Do not scatter it to silence errors.
@@ -1,11 +0,0 @@
1
- # 9. Check
2
-
3
- ```bash
4
- ecdk dev # http://localhost:4170: student, tutoring, instructor, content edit; desktop and mobile widths
5
- ```
6
-
7
- - With a browser tool, open it and finish the student activity (with the score and result when it submits), then check the tutoring lock, saving on the edit screen → the change on the student screen, saving answers on the edit view → grading of the student view (without saved grading a submission is only accepted, with no score), the mobile width, and the dark theme. Without one, ask the user to check in this order.
8
- - Even after your own check, the person looks at the screens before uploading (see [0. What the person decides](00-what-the-person-decides.md)).
9
- - Fix the content console errors and 404s printed in the terminal.
10
- - `ecdk dev` serves the content with the LXP content CSP. "막힌 외부 요청: <address> (<directive>)" in the log above the content and in the terminal is a request LXP blocks too (an external image, font or `fetch`, or a library calling outside while it runs): put the file in the zip.
11
- - Opening files directly with `file://` is not a check.
@@ -1,8 +0,0 @@
1
- # 10. Build
2
-
3
- ```bash
4
- ecdk build --json
5
- ```
6
-
7
- - With `ok: true` the zip is `dist/content.zip`. The build minifies by default (comments do not reach learners' browsers, quiz template about 149 KB → 107 KB). Screen code, the kit and the SDK go into the HTML as one bundle, not as separate files. Besides the bundle the zip holds only `metadata.json`, the files it names (`commentary`) and the files in `public/` (as they are, at the zip root); a source file nothing bundles is left out, so put files loaded by a string path at run time in `public/`. Turn minifying off only to debug, with `"minify": false` in `package.json` `"ecdk"`.
8
- - Report to the user: what the material is (what the student does, which screens are on, how it completes), the zip path and size, **what to pick in the LXP settings tab** (the completion policy that fits, which the instructor picks there, the grading type, and where the answers are set), the upload steps (Custom HTML material in LXP → upload the zip → settings tab → save → check the student and instructor screens), and anything left to check. Saving makes the new version visible to learners at once, so the person approves it first (see [0. What the person decides](00-what-the-person-decides.md)).
@@ -1,41 +0,0 @@
1
- # 12. Upload with the material MCP
2
-
3
- The `elice-material` MCP server (elice-material backend) uploads a built zip to a LXP Custom page and saves it as a new version. Register it with `ecdk setup` (MCP only: `ecdk setup --only mcp`) and log in once per tool (Claude Code `/mcp` → elice-material → Authenticate, Helpy Code `⌘ ;`). Every page tool takes `org` (the organization's `name_short`, the subdomain of `https://{org}.elice.io`) and `lecture_page_id`.
4
-
5
- **Confirm the target page.** Never upload to a page the person has not explicitly confirmed. Before any upload call (`create_package_upload`, `submit_package`), show the full target, 기관 · 과목 · 수업 · 페이지 (names and ids), and its LXP edit URL, then wait for an explicit yes. This holds every time: also when `.ecdk/link.json` exists and when the person gave a URL (confirm the names it resolves to). `.ecdk/link.json` and an edit URL give only the org's `name_short`: get the 기관 name from `list_my_organizations` and the 과목 · 수업 · 페이지 names from `get_material`. Never pick a page yourself (not the first in a list, not a guess by title, not a page from another project); if the answer is ambiguous, ask again. Creating a page (`create_custom_page`) needs its own yes that names the 수업 it goes into.
6
-
7
- **Order**
8
-
9
- | Step | Tool or command | Notes |
10
- | ------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
- | Build | `ecdk build --json` | `ok: true` required. Use `zip` and `zipBytes` |
12
- | Find the page | `list_my_organizations` → `list_courses` → `list_lectures` → `list_custom_pages` | Or read `.ecdk/link.json` (written after a save, see below), or parse the LXP edit URL `https://{org}.…/courses/{c}/lectures/{l}/lecturepages/{id}/edit`. Only lectures with `can_hold_pages: true` hold pages. The person picks; then confirm the full target (above) |
13
- | New page (optional) | `create_custom_page` (`org`, `lecture_id`) | Its own yes, naming the 수업. The page is closed to learners and has no title until its first save. Fails where the elice-api change is not deployed: then use an existing Custom page |
14
- | Current version | `get_material` | Keep `current_version.id` (null for a page never saved) |
15
- | Upload URL | `create_package_upload` (`size_bytes`) | At most 20 MB. Returns `key` and `curl_command` |
16
- | Upload | the `curl_command`, `package.zip` replaced by the zip path | From a desktop app, run it through a login shell (see Always) |
17
- | Draft | `submit_package` (`key`) → `get_draft` every 2–3 s | `ready`: shows `preview_urls`, `warnings`, the package metadata. `failed`: report `failure` with `ecdk validate dist/content.zip` and stop |
18
- | Approve | — | Show page, title, answers saved or not, `preview_urls`. Saving is visible to learners at once when the page is open |
19
- | Save | `save_draft` (`material_draft_id`, `expected_current_version_id`) | See below (no content or `grading` from the project). `MATERIAL_CHANGED`: someone saved after your `get_material`; do not retry blindly, tell the person |
20
- | Title, icon | `update_material` (`expected_current_version_id`, `payload`) | Only keys to change, e.g. `{ "title": "…", "icon": "quiz" }`. Read the new version id with `get_material` first |
21
-
22
- After a successful save, write `.ecdk/link.json` in the project (it is not put in the zip; add `.ecdk/` to `.gitignore`):
23
-
24
- ```json
25
- { "org": "my-school", "lecture_page_id": 129, "version_id": "…" }
26
- ```
27
-
28
- Next time, read it, confirm the page with the person as above (기관 · 과목 · 수업 · 페이지 and the URL), and compare `version_id` with `get_material`'s `current_version.id`: if they differ, someone saved in LXP since — tell the person before uploading.
29
-
30
- **Completion policy and answers**
31
-
32
- - Do not pass `completion_policy` to `save_draft` (2026-11-12, ADR 0012): the completion policy is an LXP setting. After saving, tell the person to pick it in the LXP settings tab (`on_access` complete on open, `on_submit` complete on any submission, `on_graded` complete when the grading passes) and say which one fits the material.
33
- - Content and answers are not uploaded from the project (2026-11-11): local `ecdk dev` builds only the template (screens and code), and `.ecdk/settings.json` is sample input for local checks that is never uploaded. Do not pass content or `grading` to `save_draft`. After saving, tell the person to open the LXP edit screen, enter the content and answers (`settings`, with `settings.grading` for `on_graded`), save with the edit screen's own button (the quiz template: "편집 완료"), then press 저장 at the bottom of the LXP edit page: the edit screen saves to the draft, and learners see it only after that 저장 makes a new version. Answers never go into the zip.
34
- - A quiz has no answers at its first upload: the person sets the answers on the edit screen, then picks `on_graded` in the settings tab. If `save_draft` returns `MATERIAL_GRADING_REQUIRED` (the page already uses `on_graded`), stop and tell the person.
35
- - The quiz template grades with a pattern; other materials follow the design (②).
36
-
37
- **Icon**: one of `note`, `video`, `pdf`, `exercise`, `quiz`, `notebook`, `live`, `assignment`, `external`, `survey`, or `null` (free-form, the default). Use `quiz` for the quiz template, otherwise `null` unless the person picks one. Title and icon also update the lecture page list.
38
-
39
- **Errors**: a login prompt → ask the person to log in again (`/mcp`). A permission error → the account needs HeadTA or higher in that course. `MATERIAL_GRADING_REQUIRED` → `on_graded` without `grading`. `PACKAGE_TOO_LARGE` → over 20 MB.
40
-
41
- **After saving**: report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version, and whether the page is closed to learners (a new page stays closed until the person opens it in LXP). If the LXP edit tab of the page is open, it must be refreshed before editing there, or it overwrites this save.
@@ -1,17 +0,0 @@
1
- <!doctype html>
2
- <html lang="ko">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1" />
6
- <!-- 제목 · "불러오는 중" 문구는 ui/texts.js(page)에서 고칩니다. 여기 글은 스크립트가 돌기 전에만 보입니다 -->
7
- <title>교육자 화면</title>
8
- <link rel="stylesheet" href="lib/elice-tokens.css" />
9
- <link rel="stylesheet" href="lib/elice-content.css" />
10
- <link rel="stylesheet" href="ui/theme.css" />
11
- <link rel="stylesheet" href="styles.css" />
12
- <script type="module" src="screens/instructor.js"></script>
13
- </head>
14
- <body>
15
- <main id="app"><p class="ec-muted">불러오는 중…</p></main>
16
- </body>
17
- </html>
@@ -1,33 +0,0 @@
1
- // 교육자 화면. 문항 구성과 해설을 한눈에 봅니다.
2
- // 정답과 반 전체 결과는 서버가 교육자 모드에 내려주면 표시합니다 (서버 요청 중).
3
- // 모양은 ui/(templates · texts · theme.css), 동작은 core/에 있습니다.
4
- import { start } from '../lib/elice-content.js';
5
- import { renderQuestion } from '../core/behaviors.js';
6
- import { labels, templates } from '../ui/templates/index.js';
7
- import { instructorHeader, loading } from '../ui/templates/page.js';
8
- import { texts } from '../ui/texts.js';
9
-
10
- const root = document.getElementById('app');
11
- document.title = texts.page.instructor;
12
- root.replaceChildren(loading());
13
- const app = await start({ screen: 'instructor' });
14
- // 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다
15
- if (app.hasContent) show();
16
- else root.replaceChildren(app.emptyState());
17
-
18
- function show() {
19
- const { title, questions = [] } = app.content;
20
- const counts = questions.reduce((m, q) => ({ ...m, [q.type]: (m[q.type] ?? 0) + 1 }), {});
21
-
22
- const views = questions.map((q, i) => renderQuestion(q, i, { templates, labels, disabled: true }));
23
- views.forEach((v) => v.showExplanation());
24
-
25
- root.replaceChildren(
26
- instructorHeader({
27
- title: title ?? '',
28
- count: questions.length,
29
- byType: Object.entries(counts).map(([t, n]) => [texts.types[t] ?? t, n]),
30
- }),
31
- ...views.map((v) => v.el),
32
- );
33
- }