@eliceio/cdk-cli 1.1.0-versionpreview.0 → 1.2.0
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 +54 -27
- package/es/cli.js +35 -2
- package/es/commands/create/index.js +1 -1
- package/es/commands/dev/index.d.ts +8 -3
- package/es/commands/dev/index.js +72 -3
- package/es/commands/doctor/index.d.ts +1 -1
- package/es/commands/doctor/index.js +10 -13
- package/es/commands/setup/index.d.ts +1 -1
- package/es/commands/setup/index.js +4 -3
- package/es/commands/uninstall/index.d.ts +1 -1
- package/es/commands/uninstall/index.js +7 -30
- package/es/core/config.d.ts +2 -2
- package/es/core/config.js +2 -2
- package/es/core/skills.d.ts +22 -4
- package/es/core/skills.js +89 -17
- package/es/dev/browser.d.ts +22 -0
- package/es/dev/browser.js +105 -0
- package/es/dev/check.d.ts +84 -0
- package/es/dev/check.js +326 -0
- package/es/dev/host-page.js +10 -0
- package/es/dev/mock-api.js +1 -1
- package/es/dev/server.d.ts +2 -0
- package/es/dev/server.js +1 -0
- package/es/rules/check.js +1 -1
- package/es/rules/manifest.d.ts +1 -1
- package/es/rules/manifest.js +2 -2
- package/es/test-old-skill.d.ts +5 -0
- package/package.json +3 -2
- package/skills/_shared/always.md +13 -5
- package/skills/{elice-content-guide/topics → _shared/references}/00-what-the-person-decides.md +2 -2
- package/skills/{elice-content-guide/topics → _shared/references}/02-design-the-material.md +13 -4
- package/skills/{elice-content-guide/topics → _shared/references}/03-create-the-project.md +2 -2
- package/skills/_shared/references/05-screen-code.md +169 -0
- package/skills/{elice-content-guide/topics → _shared/references}/06-using-the-quiz-template.md +4 -3
- package/skills/{elice-content-guide/topics → _shared/references}/07-move-existing-html.md +1 -1
- package/skills/_shared/references/08-fix-check-errors.md +28 -0
- package/skills/_shared/references/09-check.md +29 -0
- package/skills/_shared/references/10-build.md +8 -0
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +83 -0
- package/skills/elice-content-check/SKILL.md +7 -9
- package/skills/elice-content-create/SKILL.md +12 -10
- package/skills/elice-content-migrate/SKILL.md +10 -8
- package/skills/elice-content-publish/SKILL.md +10 -8
- package/templates/_shared/lib/cdk-mock.d.ts +1 -1
- package/templates/_shared/lib/cdk-mock.js +2 -2
- package/templates/_shared/lib/elice-content.css +1 -1
- package/templates/_shared/lib/elice-content.d.ts +1 -1
- package/templates/_shared/lib/elice-content.js +33 -16
- package/templates/blank/README.md +24 -21
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/template.json +1 -1
- package/templates/quiz/README.md +6 -5
- package/templates/quiz/metadata.json +1 -1
- package/templates/quiz/screens/edit.js +1 -1
- package/templates/quiz/screens/learn.js +1 -1
- package/templates/quiz/styles.css +3 -33
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/page.js +2 -17
- package/templates/quiz/ui/templates/question.js +1 -1
- package/templates/quiz/ui/texts.js +2 -11
- package/skills/elice-content-guide/SKILL.md +0 -42
- package/skills/elice-content-guide/topics/05-screen-code.md +0 -132
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +0 -27
- package/skills/elice-content-guide/topics/09-check.md +0 -11
- package/skills/elice-content-guide/topics/10-build.md +0 -8
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +0 -41
- package/templates/quiz/instructor.html +0 -17
- package/templates/quiz/screens/instructor.js +0 -33
- /package/skills/{elice-content-guide/topics → _shared/references}/01-check-the-environment.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/04-rules.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/11-more.md +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# 5. Screen code
|
|
2
|
+
|
|
3
|
+
## Kit API (this table is the API)
|
|
4
|
+
|
|
5
|
+
Do not open `lib/` to learn the API: this table is the API (from `lib/elice-content.d.ts`, `lib/elice-content-editor.d.ts`, `lib/elice-content.css`). Start from the template's example screens (`screens/*.js`) and change them. Never edit `lib/`.
|
|
6
|
+
|
|
7
|
+
| `lib/elice-content.js` | What it is |
|
|
8
|
+
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `await start({ screen })` → `app` | `screen`: `'learn'` · `'instructor'` · `'edit'`. Optional `onError(err)` (`ContentError` with `code`) |
|
|
10
|
+
| `app.content` · `app.hasContent` · `app.emptyState()` | What the edit screen saved (`{}` until saved) · whether it saved · the "아직 내용이 없습니다" element to show when `hasContent` is false (student and instructor screens) |
|
|
11
|
+
| `app.screen` · `app.viewer` · `app.readOnly` · `app.isDraft` | `'learn'`… · `'student'` · `'instructor'` · `'tutor'` · tutoring (read-only, the kit locks the screen) · draft preview (submissions not recorded) |
|
|
12
|
+
| `app.account` · `app.result` | `{ anonymousId, fullname }` or null (e.g. `anonymousId` as a per-person random seed) · `{ score, submitCount, completedAt }` or null |
|
|
13
|
+
| `app.useSubmit({ getAnswer, setAnswer?, validate?, onResult?, root?, label? })` | Student screen submit bar → `{ element, result, restored }`. `getAnswer()` small JSON · `setAnswer(a)` on reopen and in tutoring · `validate(a)` → `true` or a message · `onResult({ isCorrect, score, answer? }, { restored })`. Locking, restoring and messages are the kit's |
|
|
14
|
+
| `app.useSave({ getContent, validate?, getGrading?, root?, label? })` | Edit screen save bar → `{ element, markDirty(), dirty }`. Watches `root` (default `#app`) for changes, except inside `[data-ec-quiet]`. `getGrading()` → `Grading`, a message (blocks saving) or `undefined` (keep) |
|
|
15
|
+
| `app.useGradingBlock({ graders?, examples?, root? })` | Edit screen grader block (LXP's "기준 답안 (정규표현식)" · "평가 기준") → `{ element, grader, getGrading() }`; pass `getGrading` to `useSave` |
|
|
16
|
+
| `app.usePaging({ count, onChange(step, { content }), start?, root? })` | Steps inside one material: side chevrons and `n / N` → `{ element, content, go(i), step, ready }`. Draw only into `content` |
|
|
17
|
+
| `app.grading` | Saved grading on the edit screen only: `{ type: 'pattern', answer_key }` · `{ type: 'rubric', rubric }` or null |
|
|
18
|
+
| `app.submit(answer)` · `app.lastAnswer()` · `app.lastSubmission()` · `app.saveContent(content, grading?)` | Low-level calls under `useSubmit` · `useSave` (rarely needed) |
|
|
19
|
+
| `validateAnswerRegex(regex, samples?)` | Exported: checks an answer regex (non-empty, length ≤ `ANSWER_KEY_MAX`, compiles, `^…$`, run time) → `null` or a message. Also `GRADER_TYPES`, `GRADING_EXAMPLES`, `normalizeGrading` |
|
|
20
|
+
|
|
21
|
+
| `lib/elice-content-editor.js` (edit screen only) | What it is |
|
|
22
|
+
| ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `useContentEditor(app, { initial?, schema?, validate?, root? })` | JSON content editor (폼 보기 · 코드 보기) in `root` (default `#app`) → `{ element, view, showView(v), getContent(), setContent(c), validate(c?) }`. Pass `getContent` · `validate` to `useSave` |
|
|
24
|
+
| schema field | `label` · `type` (`string` · `number` · `boolean` · `object` · `array`) · `required` · `min` · `max` · `multiline` · `enum` · `hint` · `placeholder` · `item` · `fields` (below) |
|
|
25
|
+
|
|
26
|
+
| `lib/elice-content.css` (EDS, light and dark) | Use |
|
|
27
|
+
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| Elements | `main` (720px column, 20px gap), `h1`, `p`, `button`, `input` · `textarea` · `select` (full width, 16px text) are styled already |
|
|
29
|
+
| Layout · boxes | `.ec-card` (bordered box, column) · `.ec-row` (wrapping row, 8px gap) · `.ec-col` (column, 12px gap) · `.ec-option` (one choice row with its input) · `.ec-badge` (small tag) |
|
|
30
|
+
| Buttons | `button.ec-primary` (main action) · `button.ec-text-button` · `button.ec-icon-button` (borderless icon, needs `aria-label`) · `button.ec-icon-button.ec-danger` (red ✕) |
|
|
31
|
+
| Messages | `.ec-result` (info) · `.ec-result.ok` · `.ec-result.no` · `.ec-error` · `.ec-notice` (message + one action) · `.ec-muted` · `.ec-empty` (from `emptyState()`) · `.ec-visually-hidden` |
|
|
32
|
+
| Student targets | `.ec-dropzone` + `.ec-dropzone-title` (empty drop target) |
|
|
33
|
+
| Drawn by the kit | `.ec-submitbar` · `.ec-paging` · `.ec-step-nav` · `.ec-step-count` · `.ec-grading*` · `.ec-json*` (do not build these yourself) |
|
|
34
|
+
| Tokens | `--ec-bg` `--ec-surface` `--ec-fg` `--ec-muted` `--ec-line` `--ec-border` `--ec-accent` `--ec-accent-dark` `--ec-accent-bg` `--ec-ok` `--ec-ok-bg` `--ec-no` `--ec-no-bg` `--ec-warn-bg` `--ec-info` `--ec-info-bg` `--ec-radius` `--ec-shadow`; type: `--eds-font-family` `--eds-fs-h1`…`--eds-fs-h6` `--eds-fs-body1` `--eds-fs-body2` `--eds-fs-caption` `--eds-fw-medium` `--eds-fw-semibold` `--eds-fw-bold` `--eds-fw-extrabold`. Dark theme: `<html data-eds-theme="dark">` |
|
|
35
|
+
|
|
36
|
+
Your own styles go in `styles.css` with these tokens, so both themes work.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { start } from '../lib/elice-content.js';
|
|
42
|
+
|
|
43
|
+
// Student screen
|
|
44
|
+
const app = await start({ screen: 'learn' });
|
|
45
|
+
// Content is only what the edit screen saved (no default content file). Before that, show the kit's notice
|
|
46
|
+
if (app.hasContent) render(app.content);
|
|
47
|
+
else root.replaceChildren(app.emptyState());
|
|
48
|
+
|
|
49
|
+
// Only for materials with a submission: say how to collect and restore the answer (result).
|
|
50
|
+
// Locking, restoring and result messages are handled by the kit.
|
|
51
|
+
app.useSubmit({
|
|
52
|
+
getAnswer: () => ({ result: currentResult() }), // small JSON (a few KB at most)
|
|
53
|
+
setAnswer: a => restore(a?.result), // filled on reopen and in tutoring
|
|
54
|
+
validate: a => a.result != null || 'Finish the activity before submitting.',
|
|
55
|
+
onResult: res => showFeedback(res), // grading result (score · isCorrect)
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
// Content edit screen: render the fields and say what to save
|
|
61
|
+
const app = await start({ screen: 'edit' });
|
|
62
|
+
renderForm(app.content);
|
|
63
|
+
app.useSave({
|
|
64
|
+
getContent: () => ({ ...app.content, title: titleInput.value, steps: readSteps() }),
|
|
65
|
+
validate: c => c.title.trim() !== '' || 'Enter a title.',
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
// Edit screen with the grader block: the kit draws LXP's grader radios, the "기준 답안 (정규표현식)" field
|
|
71
|
+
// with "작성 예시 보기", and the "평가 기준" field. useSave saves the content and the grader in one save.
|
|
72
|
+
const grading = app.useGradingBlock();
|
|
73
|
+
app.useSave({ getContent: () => app.content, getGrading: () => grading.getGrading() });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- `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).
|
|
77
|
+
- 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(`).
|
|
78
|
+
- 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 top 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.
|
|
79
|
+
- Materials without a submission do not call `useSubmit` (only `on_access` fits them in LXP).
|
|
80
|
+
- Use `app.viewer` (`student` · `instructor` · `tutor`), `app.readOnly` (tutoring) and `app.account.anonymousId` (for example a per-person fixed random seed) only when needed. The kit handles per-viewer behavior such as the tutoring lock, so the screen code does not branch on the viewer.
|
|
81
|
+
- 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.
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
app.usePaging({
|
|
85
|
+
count: steps.length,
|
|
86
|
+
// also called once at start. Draw only into `content` (#app by default); the kit keeps its buttons outside it
|
|
87
|
+
onChange: (i, { content }) => content.replaceChildren(renderStep(steps[i])),
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
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.
|
|
92
|
+
|
|
93
|
+
- Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
|
|
94
|
+
|
|
95
|
+
### Content editor (JSON)
|
|
96
|
+
|
|
97
|
+
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.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import { start } from '../lib/elice-content.js';
|
|
101
|
+
import { useContentEditor } from '../lib/elice-content-editor.js';
|
|
102
|
+
|
|
103
|
+
const app = await start({ screen: 'edit' });
|
|
104
|
+
const schema = {
|
|
105
|
+
title: { label: '제목', required: true },
|
|
106
|
+
items: {
|
|
107
|
+
label: '항목',
|
|
108
|
+
min: 2,
|
|
109
|
+
max: 12,
|
|
110
|
+
item: {
|
|
111
|
+
name: { label: '이름', required: true },
|
|
112
|
+
value: { label: '값', type: 'number', required: true },
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
// initial: the sample the editor starts from while nothing is saved (there is still no default content file)
|
|
117
|
+
const editor = useContentEditor(app, { initial: sample, schema });
|
|
118
|
+
app.useSave({ getContent: editor.getContent, validate: editor.validate });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- 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.
|
|
122
|
+
- 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.
|
|
123
|
+
- `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.
|
|
124
|
+
- Only the edit screen imports `lib/elice-content-editor.js`; `ecdk build` bundles code per screen, so the student screen does not carry it.
|
|
125
|
+
- 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`).
|
|
126
|
+
|
|
127
|
+
### UI patterns
|
|
128
|
+
|
|
129
|
+
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/`.
|
|
130
|
+
|
|
131
|
+
| Where | Pattern |
|
|
132
|
+
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| 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. |
|
|
134
|
+
| 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. |
|
|
135
|
+
| 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. |
|
|
136
|
+
| 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. |
|
|
137
|
+
| Any Korean text in a narrow box | `word-break: keep-all` so lines do not break inside a word. |
|
|
138
|
+
|
|
139
|
+
Icon buttons always need `aria-label`. Icons are inline SVG with `stroke="currentColor"`, so color follows the button:
|
|
140
|
+
|
|
141
|
+
```html
|
|
142
|
+
<!-- trash (delete a card) -->
|
|
143
|
+
<svg
|
|
144
|
+
viewBox="0 0 24 24"
|
|
145
|
+
width="18"
|
|
146
|
+
height="18"
|
|
147
|
+
fill="none"
|
|
148
|
+
stroke="currentColor"
|
|
149
|
+
stroke-width="2"
|
|
150
|
+
stroke-linecap="round"
|
|
151
|
+
stroke-linejoin="round"
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
>
|
|
154
|
+
<path d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />
|
|
155
|
+
</svg>
|
|
156
|
+
<!-- ✕ (remove one row) -->
|
|
157
|
+
<svg
|
|
158
|
+
viewBox="0 0 24 24"
|
|
159
|
+
width="18"
|
|
160
|
+
height="18"
|
|
161
|
+
fill="none"
|
|
162
|
+
stroke="currentColor"
|
|
163
|
+
stroke-width="2"
|
|
164
|
+
stroke-linecap="round"
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
>
|
|
167
|
+
<path d="M6 6l12 12M18 6L6 18" />
|
|
168
|
+
</svg>
|
|
169
|
+
```
|
package/skills/{elice-content-guide/topics → _shared/references}/06-using-the-quiz-template.md
RENAMED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# 6. Using the quiz template
|
|
2
2
|
|
|
3
|
-
- The
|
|
3
|
+
- The quiz has **no instructor screen** (`metadata.json` `screens.instructor.enabled: false`): an instructor who opens it in LXP gets the student screen and can solve and submit it (graded, not recorded). Add `instructor.html` and turn it on only when the person asks for one.
|
|
4
|
+
- The template starts with **no questions**: the student screen shows "아직 내용이 없습니다" until the edit screen saves. The question and answer are added on the edit screen ("문항 추가", any of the five types, the answer in the same card): in `ecdk dev`, so the upload can carry them (`.ecdk/settings.json`, sent after the person agrees), or on the LXP edit screen after upload. **One quiz material holds one question**, like the legacy LXP quiz: once there is a question the edit screen shows a hint instead of "문항 추가", and several questions mean several quiz materials (pages). A quiz already saved with more questions still shows and saves. For a requested question set, put the first question in the edit view in `ecdk dev` (answers confirmed by the person) and give the others as draft text, one question per quiz material.
|
|
4
5
|
- Question types: `select_one` · `select_multiple` · `order` · `text` · `group`. Question, choice and group ids (`q1`, `a`, `g1`) are lower-case letters and digits; once set, do not change them.
|
|
5
6
|
- Student answer: **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and `encodeURIComponent`-encoded.
|
|
6
|
-
- Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` (no hand-written regex); in
|
|
7
|
+
- Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` (no hand-written regex); its completion policy is `on_graded` (set by the publish skill with the answers, or picked in the '설정' panel at the top of the LXP edit page); with `on_submit` the server does not grade (`is_correct: null`, the kit shows "제출했어요."). `pattern` compares the whole answer at once, so **everything must match for 100** (no partial score per question).
|
|
7
8
|
|
|
8
9
|
```json
|
|
9
10
|
{
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
|
|
15
16
|
- File split: **`ui/` is the look** (edit freely), **`screens/` is the layout** (which blocks in which order), **`core/` is behavior and the grading contract** (do not edit).
|
|
16
17
|
- Colors, spacing, corners, choice cards: the `--qz-*` variables in `ui/theme.css` (they point at EDS tokens, so `--theme dark` also fits)
|
|
17
|
-
- Text: `ui/texts.js` (tab title, loading, student,
|
|
18
|
+
- Text: `ui/texts.js` (tab title, loading, student, edit, and validation messages)
|
|
18
19
|
- Markup: the `` html`…` `` snippets in `ui/templates/*.js` (`choice` card, `question` frame, `order`, `group`, `text`, `page` header, `edit` fields). Inserted values are escaped. Classes and tags are free; **keep the `data-role` attributes** (`result` · `explanation` · `choice` · `input` · `pool` · `slots` · `items` and so on, listed at the top of each file) and selecting, dragging and the answer strings keep working.
|
|
19
20
|
- Behavior adds state as attributes: `data-result="correct|wrong"` · `data-dragging` · `data-ghost`. Style them in CSS.
|
|
20
21
|
- After a change, solve all five types in `ecdk dev` by clicking and dragging, submit, and check that the answer string (local grading) is unchanged.
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
3. Download external CDN scripts, fonts, images, CSS and videos into the zip (fonts as files or data URIs, long videos as Elice video materials, no `<iframe>`). After `ecdk dev`, check the log for "막힌 외部 요청".
|
|
6
6
|
4. Replace blocked code (storage, `alert`, external sends) as in [4](04-rules.md).
|
|
7
7
|
5. Merge multiple HTML pages into one HTML that switches views.
|
|
8
|
-
6. Decide submission and grading as in [2 ②](02-design-the-material.md). The completion policy is not written in the project: the instructor picks it in the
|
|
8
|
+
6. Decide submission and grading as in [2 ②](02-design-the-material.md). The completion policy is not written in the project: the publish skill sets it with the upload after the person agrees, or the instructor picks it in the '설정' panel at the top of the LXP edit page (suggest `on_access` when there is no submission).
|
|
9
9
|
7. Turn off the instructor and edit screens in `metadata.json` `screens` (`{ "enabled": false }`) and delete their files when they are not needed.
|
|
10
10
|
8. An old ecdk project with `elice.config.json` or `lib/cdk.js` and no `@eliceio/cdk` in `package.json`: run `ecdk doctor --fix` (moves the settings to `metadata.json` and `package.json` `"ecdk"`, adds the SDK dependency), then `npm install`, replace `lib/elice-content.js` with the one from a new `ecdk create` project (it imports `@eliceio/cdk`) and delete `lib/cdk.js` (the zip never takes an SDK copy: `sdk.lib-copy` error).
|
|
@@ -0,0 +1,28 @@
|
|
|
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 '설정' panel at the top of the LXP edit page |
|
|
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
|
+
| `project.deps` (doctor) · "@eliceio/cdk 패키지를 찾지 못했습니다" | The SDK package is not installed in the project: run `npm install` in the project, then build again |
|
|
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
|
+
| `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` |
|
|
27
|
+
|
|
28
|
+
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.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# 9. Check
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
ecdk dev <folder> # in the background: http://localhost:4170 (student, tutoring, instructor, content edit; desktop and mobile widths)
|
|
5
|
+
ecdk dev <folder> --check # one-shot check of every enabled screen, headless
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
- Start `ecdk dev` in the background right after `ecdk create` and give the person the URL it prints (the next free port pair when 4170 is taken), so they watch the screens change while you write code. It checks the project again and reloads the view on every change, so do not run `ecdk validate` in a loop; run it once before building.
|
|
9
|
+
- **`ecdk dev [folder] --check [--screens learn,tutoring,instructor,edit] [--viewport desktop,mobile] [--json]`** is the only way you check screens yourself. Never write your own browser-automation script (Playwright, Puppeteer, a headless Chrome command). It starts dev, opens each enabled screen headless at desktop and mobile width (mobile is the dev host's 360px mode) and prints one line per screen and width, then a summary and the validation result, in about 5–15 s:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
[ok] learn · desktop 1254px 화면 그림 .ecdk/screens/learn-desktop.png
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `[fail]`: console or page errors, "막힌 외부 요청" (requests the content CSP blocks; LXP blocks them too: put the file in the zip), failed requests (4xx · 5xx), a blank screen, or `ecdk validate` errors.
|
|
16
|
+
- `[warn]`: a leftover "불러오는 중…" or horizontal overflow (usually the mobile width).
|
|
17
|
+
- Screenshots of the content only: `.ecdk/screens/<screen>-<viewport>.png` (for example `.ecdk/screens/learn-mobile.png`; never in the zip).
|
|
18
|
+
- `--json`: `ok`, `validate` (`errors`, `warnings`, `issues`), `browser`, `screenshotsDir`, and per screen `screen`, `viewport`, `width`, `rendered`, `loading`, `consoleErrors`, `pageErrors`, `blocked`, `failedRequests`, `overflowX`, `screenshot`, `ms`.
|
|
19
|
+
|
|
20
|
+
Exit codes: 0 no problems · 1 problems · 2 wrong usage · 3 no browser found (it needs Chrome, Edge or Chromium, or `ECDK_BROWSER`). It checks only the first state of each screen (no clicks, no submits): the activity itself is for the person to try in the browser.
|
|
21
|
+
|
|
22
|
+
- After each screen you write, run it for that screen (`--screens learn`); on exit 1 fix what it reports and run again (at most twice). Tell the person the result lines, the screenshot paths (Claude Code: Read the PNG to look at it) and what to try in the browser. A direct link to one view: the dev URL with `?view=student|tutor|instructor|edit` and `?width=360px` (mobile).
|
|
23
|
+
- Screens show their empty state ("아직 내용이 없습니다") until content is saved. To check them with sample content, write `<folder>/.ecdk/settings.json` yourself before `--check`: **the same object the edit screen's `getContent()` returns, at the top level** (not wrapped in a `content` key), plus `grading` only when the material is graded (`{ "type": "pattern", "answer_key": "…" }`). For the blank template with the content editor that is the `initial` sample in `screens/edit.js`; for the quiz template `{ "title": …, "questions": [ … ] }` as in `references/06-using-the-quiz-template.md`. The file is never in the zip. It stays local unless the person agrees to send it with the upload ([12](12-upload-with-the-material-mcp.md)), and a file you wrote by hand must first be saved once through the edit view in `ecdk dev` so the edit screen's validation runs.
|
|
24
|
+
- Before the first run, make sure `ecdk dev --help` lists `--check`: an older ecdk does not have it (an ecdk that has it also stops with a usage error, exit 2, on an option the command does not take).
|
|
25
|
+
- On exit 3 (no browser), no `--check` in `--help` (an older ecdk: suggest `ecdk update`), or a problem you cannot fix after two tries, stop checking yourself: ask the person to open the dev URL and go through the list below.
|
|
26
|
+
- What the person (or you, from the screenshots) goes through: finish the student activity (with the score and result when it submits), 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.
|
|
27
|
+
- 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)).
|
|
28
|
+
- `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.
|
|
29
|
+
- Opening files directly with `file://` is not a check.
|
|
@@ -0,0 +1,8 @@
|
|
|
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, **the completion policy** (the one that fits; the publish skill sets it after the person agrees, or the instructor picks it in the '설정' panel at the top of the LXP edit page; only `on_graded` grades, `on_submit` completes on any submission without grading, the grading type, and where the answers are set: saved in the `ecdk dev` edit view so the upload can carry them after the person agrees, or on the LXP edit screen), the upload steps (Custom HTML material in LXP → upload the zip (on an existing page: ⋮ › '다른 파일로 변경') → enter the content and answers on the edit screen and save there → '수업 자료에 반영' at the top of the LXP edit page → pick the completion policy in the '설정' panel there → 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)).
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
**What learners see at once.** `save_draft`, `update_material` and `restore_version` change what learners see immediately when the page is open. The completion policy is a setting of the page, not of a version: sending it applies right away.
|
|
8
|
+
|
|
9
|
+
**Order**
|
|
10
|
+
|
|
11
|
+
| Step | Tool or command | Notes |
|
|
12
|
+
| ------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| Build | `ecdk build --json` | `ok: true` required. Use `zip` and `zipBytes` |
|
|
14
|
+
| Content and answers | `.ecdk/settings.json` of this project | Optional. See "Content and answers (settings)" below: summary, an explicit yes, checks. No file: suggest filling the edit view in `ecdk dev` first, or skip (the person enters it in the LXP edit screen later) |
|
|
15
|
+
| 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) |
|
|
16
|
+
| 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 |
|
|
17
|
+
| Current version | `get_material` | Keep `current_version.id` (null for a page never saved), the title, the current completion policy and the saved settings. Sending settings replaces the saved ones as a whole: compare first ("Whole replace" below) |
|
|
18
|
+
| Upload URL | `create_package_upload` (`size_bytes`) | At most 20 MB. Returns `key` and `curl_command` |
|
|
19
|
+
| Upload | the `curl_command`, `package.zip` replaced by the zip path | From a desktop app, run it through a login shell (see Always) |
|
|
20
|
+
| 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 |
|
|
21
|
+
| Approve | — | Show page, title, whether content and answers go with it (the summary, no answer values), the completion policy to set (below), `preview_urls`. Saving is visible to learners at once when the page is open |
|
|
22
|
+
| Save | `save_draft` (`material_draft_id`, `expected_current_version_id`, `payload`) | One save carries everything, so no extra version is made. `payload` holds only the keys to set, each only when the tool's schema lists it: `settings` and `completion_policy` when the person said yes (below; `on_graded` only together with `settings` that include `grading`), and `title` · `icon` when the page has none (a new page). `MATERIAL_CHANGED`: someone saved after your `get_material`; do not retry blindly, tell the person |
|
|
23
|
+
| Check | `get_material` (or `get_draft` before saving) | When settings were sent: the saved settings have the same top-level keys and item count and `grading.type` as the summary. When a policy was sent: it shows that policy. Show any `warnings` in the result to the person. If not as sent, tell the person and use the fallback |
|
|
24
|
+
| Later edits | `update_material` (`expected_current_version_id`, `payload`) | Only for a page that already has a version, when the person wants to change the title, icon, description, settings or completion policy without a new zip. Only the keys to change (`icon: null` clears the icon). Read the current version id with `get_material` first. Not right after an upload: the upload's `save_draft` carries all of it |
|
|
25
|
+
|
|
26
|
+
After a successful save, write `.ecdk/link.json` in the project (it is not put in the zip; add `.ecdk/` to `.gitignore`):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{ "org": "my-school", "lecture_page_id": 129, "version_id": "…" }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
**Content and answers (settings)**
|
|
35
|
+
|
|
36
|
+
`.ecdk/settings.json` is what the `ecdk dev` edit view saves: the edit screen's content object at the top level plus `grading` when the material is graded (the same `settings` object the SDK's `saveSettings` sends to the draft). It stays local by default and never goes into the zip. When the MCP server takes `settings`, the upload can carry it, so the person does not have to type the content and answers again in LXP.
|
|
37
|
+
|
|
38
|
+
1. **Does the server take it?** Look at the input schema of `save_draft` (and `update_material`): use `settings` only when the schema lists it as a key of `payload` (or, on an older server, as a top-level parameter). The same holds for `completion_policy`, `title` and `icon`. If no tool has it, use the fallback below. Never guess another argument or tool name.
|
|
39
|
+
2. **Only this project's file.** Use `<project>/.ecdk/settings.json` of the project you just built, never a file from another project or copied for another material. If the person changed the target page or project since, ask again.
|
|
40
|
+
3. **Checked by the edit screen.** It must be what the edit screen saved, so its own validation ran (the quiz edit screen checks every answer and builds the regex): the person opens the edit view in `ecdk dev`, checks the content and saves with the edit screen's button (the quiz template: "편집 완료"); the dev log prints "내용을 .ecdk/settings.json에 저장했습니다". If you wrote or changed the file by hand (`references/09-check.md`), that save must happen before the upload. Then check the shape: a JSON object, content keys at the top level (not wrapped in `content`), `grading` only when graded. The quiz: `{ "title": …, "questions": [ … ] }` with `grading` `{ "type": "pattern", "answer_key": "^…$" }`.
|
|
41
|
+
4. **Whole replace: compare first.** `settings` replaces the page's settings as a whole (the content keys and `grading`); nothing is merged. On a page that already has a version, read its settings with `get_material` and compare them with the local file. If keys would disappear, or the content saved in LXP differs from the file (an instructor edited it in LXP after the last upload), show a short summary of the difference (which keys or items, the title, the number of questions; never answer values) and ask before overwriting. The person may prefer to keep LXP's content: then send no `settings`. A first upload to a new page needs no comparison.
|
|
42
|
+
5. **Summary and an explicit yes.** Before the upload, show what goes with it: the title, the number of questions or items, and whether answers are included (`grading.type`, `pattern` or `rubric`), but never the answer values (`answer_key`, `rubric`). The answers must be ones the person confirmed (Always: ask before you settle correct answers). Send it only after an explicit yes; a no means the fallback.
|
|
43
|
+
6. **Send** it as `payload.settings` with the save (`save_draft` above), with the completion policy the person agreed to (below). Then check it with `get_material` (or `get_draft` when the draft shows it before saving) as in the table.
|
|
44
|
+
7. **No settings file?** Suggest filling the edit view in `ecdk dev` first and saving, so the upload carries it, or skip it (the person enters the content in the LXP edit screen later).
|
|
45
|
+
|
|
46
|
+
**Fallback (the server has no `settings`, the person said no, or there is no file)**: upload the zip only, without content or `grading`, and without `on_graded` (see "Completion policy"). After saving, tell the person to open the LXP edit page, enter the content and answers on the edit screen (`settings`, with `settings.grading` for `on_graded`) and save with the edit screen's own button (the quiz template: "편집 완료"). That saves to the draft; learners see it only after '수업 자료에 반영' at the top of the LXP edit page.
|
|
47
|
+
|
|
48
|
+
**Uploading a zip by hand in LXP**: on the LXP edit page, ⋮ › '다른 파일로 변경', pick the zip, then '수업 자료에 반영'.
|
|
49
|
+
|
|
50
|
+
**Completion policy** (2026-11-12: the upload can set it)
|
|
51
|
+
|
|
52
|
+
The completion policy is not in the project or the zip (ADR 0012): it is a setting of the LXP page, independent of versions, and it applies as soon as it is set. The publish skill proposes one and sets it with the save after the person agrees, when the save tool takes it. Detect support like `settings`: use `completion_policy` only when the input schema of `save_draft` (or `update_material`) lists it in `payload`. If no tool has it, tell the person after saving which one to pick in the '설정' panel opened from the top of the LXP edit page (choosing applies at once).
|
|
53
|
+
|
|
54
|
+
| The material | Propose |
|
|
55
|
+
| ------------------------------------------------------------------------ | ---------------------------------------- |
|
|
56
|
+
| Graded: the quiz template, or any material whose settings have `grading` | `on_graded` ("답안 확인 후 완료") |
|
|
57
|
+
| Submits (`useSubmit`) without grading | `on_submit` (complete on any submission) |
|
|
58
|
+
| No submission | `on_access` (complete on open) |
|
|
59
|
+
|
|
60
|
+
- Show the proposal in the target summary and the approval (on a page that already has a policy, show the current one too; changing it needs the yes). Send it only after an explicit yes.
|
|
61
|
+
- **`on_graded` needs grading saved first** (the server answers `MATERIAL_GRADING_REQUIRED` otherwise). Send `on_graded` in the same save only together with `settings` that include `grading` (the server takes `settings` and the person agreed), or when the page already has grading (`get_material` shows it).
|
|
62
|
+
- **Without settings** (the server has no `settings`, no file, or the person said no): do not send `on_graded` at the first save. Send no policy, or `on_submit` only if the person wants learners to complete by submitting until the answers exist (ask). Then the person enters the answers on the LXP edit screen and applies them with '수업 자료에 반영'; afterwards either the person picks 답안 확인 후 완료 in the '설정' panel, or, if `update_material` takes `completion_policy`, offer to set `on_graded` through the MCP once `get_material` shows the grading.
|
|
63
|
+
- **Only `on_graded` grades.** `on_submit` completes on any submission and does not grade: the submission comes back `is_correct: null`, `score: 100`, and the kit shows "제출했어요.". `on_access` completes on open. Saved answers are used only with `on_graded`; say so in the report so the person does not think grading is broken.
|
|
64
|
+
- Answers never go into the zip: only in `settings.grading`, sent with the save above or entered on the edit screen.
|
|
65
|
+
- If `save_draft` returns `MATERIAL_GRADING_REQUIRED` (the page already uses `on_graded`, or `on_graded` was sent, and no grading came with it), stop and tell the person.
|
|
66
|
+
- The quiz template grades with a pattern; other materials follow the design (②).
|
|
67
|
+
|
|
68
|
+
**Icon**: one of `note`, `video`, `pdf`, `exercise`, `quiz`, `notebook`, `live`, `assignment`, `external`, `survey`, or `null` (free-form, the default; `icon: null` clears one). Use `quiz` for the quiz template, otherwise `null` unless the person picks one. Title and icon also update the lecture page list.
|
|
69
|
+
|
|
70
|
+
**Errors and warnings**
|
|
71
|
+
|
|
72
|
+
| Result | What to do |
|
|
73
|
+
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
74
|
+
| A login prompt | Ask the person to log in again (`/mcp`) |
|
|
75
|
+
| A permission error | The account needs HeadTA or higher in that course |
|
|
76
|
+
| `MATERIAL_CHANGED` | Someone saved after your `get_material`. Do not retry blindly; tell the person |
|
|
77
|
+
| `MATERIAL_GRADING_REQUIRED` | `on_graded` without `grading`. Stop and tell the person |
|
|
78
|
+
| `MATERIAL_DRAFT_PENDING` (`update_material`) | Someone uploaded a package to this page and did not save it: a ready draft holds a package different from the current version. Nothing changed. Stop, explain it, and ask whether to save that draft (`save_draft`, which publishes their upload) or discard it (`discard_draft`). Never pick for the person |
|
|
79
|
+
| `PACKAGE_TOO_LARGE` | Over 20 MB |
|
|
80
|
+
| An error about `settings` (for example `INVALID_INPUT`, a bad `settings.grading` pattern or rubric) | Nothing was saved: report it, and save without settings (the fallback) only after the person agrees |
|
|
81
|
+
| `warnings` in a tool result | Show them to the person close to word for word (for example `settings.grading` sent while the policy is not `on_graded`). No `warnings` key means none |
|
|
82
|
+
|
|
83
|
+
**After saving**: report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version, the completion policy (set, or what to pick in the '설정' panel and why: only `on_graded` grades; `on_submit` completes on any submission without grading), any `warnings`, 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,25 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: elice-content-check
|
|
3
|
-
description: Find and fix problems in an Elice Custom HTML learning material - ecdk validate or ecdk build errors, blocked browser APIs, missing or wrongly cased files, a zip that LXP rejects,
|
|
3
|
+
description: Find and fix problems in an Elice Custom HTML learning material and answer questions about its rules and SDK - ecdk validate or ecdk build errors, blocked browser APIs and the LXP sandbox and CSP rules, missing or wrongly cased files, a zip that LXP rejects, a material that stays on "Loading" or shows nothing in LXP, and how the @eliceio/cdk SDK or the screen kit works (submit, save, grading, paging). Use when the person reports an error with an Elice or LXP material or with ecdk, or asks what is allowed or how an SDK or kit call works.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Fix an Elice learning material
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reference files are in `references/` in this skill's folder (see Always). For this skill: `references/08-fix-check-errors.md`, `references/04-rules.md`, `references/09-check.md`; SDK and kit questions: the kit API table in `references/05-screen-code.md`.
|
|
9
9
|
|
|
10
10
|
{{always}}
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
13
|
|
|
14
|
-
1. **Reproduce with the CLI.** In the project, `ecdk doctor --json` and `ecdk validate --json`. For a zip someone made, `ecdk validate <file>.zip --json`. Each issue has an id, a file and a line.
|
|
15
|
-
2. **Fix by the
|
|
14
|
+
1. **Reproduce with the CLI.** In the project, `ecdk doctor --json` and `ecdk validate --json`. For a zip someone made, `ecdk validate <file>.zip --json`. Each issue has an id, a file and a line. A screen problem: `ecdk dev --check` (screenshots, console errors, blocked requests).
|
|
15
|
+
2. **Fix by the reference.** Look the id up in `references/08-fix-check-errors.md` (it also covers old projects: `project.legacy-file`, `sdk.lib-copy`, `sdk.outdated`, a missing `@eliceio/cdk`). Fix the cause in the source, not in `dist/`. Do not silence a rule with an `ecdk-ignore` comment unless the reference says so. doctor `cli.latest`: `references/01-check-the-environment.md`.
|
|
16
16
|
3. **Problems that show only in LXP.**
|
|
17
17
|
- Stays on "Loading" or shows nothing: rebuild with the current `ecdk build` (it adapts the pages to the LXP sandbox) and check the built zip with `ecdk validate dist/content.zip`. Ask the person for the browser console error.
|
|
18
18
|
- Upload rejected: check `ecdk validate dist/content.zip`; a material needs `commentary.txt` and every file named in `metadata.json`.
|
|
19
|
-
- Screens show "아직 내용이 없습니다": nothing is saved yet; create the content in the edit screen (there is no default content file)
|
|
20
|
-
- Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `.ecdk/settings.json`) and that the submitted answer string matches the regex (
|
|
21
|
-
|
|
22
|
-
- `@eliceio/cdk 패키지를 찾지 못했습니다` or doctor `project.deps` fails: run `npm install` in the project. `sdk.outdated` (SDK 1.0.0-alpha.3 or older: saving in the LXP edit screen - draft save - fails): `npm update @eliceio/cdk` (on an old `lib/cdk.js` copy: `ecdk doctor --fix && npm install`), then build again.
|
|
23
|
-
4. **Confirm.** `ecdk validate` has no errors, `ecdk dev` works, and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
|
|
19
|
+
- Screens show "아직 내용이 없습니다": nothing is saved yet; create the content in the edit screen (there is no default content file), and in LXP press '수업 자료에 반영' at the top of the edit page after saving the edit screen (`references/12-upload-with-the-material-mcp.md`, "Fallback").
|
|
20
|
+
- Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `.ecdk/settings.json`) and that the submitted answer string matches the regex (`references/02-design-the-material.md`, `references/06-using-the-quiz-template.md`). In `ecdk dev` a submission is graded only when grading is saved; otherwise it is only accepted. Completing at the wrong time is the completion policy, an LXP setting (Always).
|
|
21
|
+
4. **Confirm.** `ecdk validate` has no errors, `ecdk dev --check` passes (or the person checked the dev URL), and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
|
|
24
22
|
|
|
25
23
|
{{version}}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: elice-content-create
|
|
3
|
-
description: Create a new Elice Custom HTML learning material (LXP material type 17) with the ecdk CLI - a quiz, simulation, interactive explanation, guided exercise, flashcards or survey. Use when the person asks to make Elice or LXP learning content, a Custom HTML material
|
|
3
|
+
description: Create a new Elice Custom HTML learning material (LXP material type 17) with the ecdk CLI - a quiz, simulation, interactive explanation, guided exercise, flashcards or survey - and answer how-to questions about making one (design, screens, the screen kit and SDK, templates, the content editor, checking in ecdk dev, building the zip). Use when the person asks to make Elice or LXP learning content, a Custom HTML material or an ecdk project, or asks how to build something in one.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create an Elice learning material
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reference files are in `references/` in this skill's folder (see Always). For a how-to question, answer from the matching reference without creating a project.
|
|
9
9
|
|
|
10
10
|
{{always}}
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
5
|
|
21
|
-
|
|
14
|
+
Write the progress line `[n/N] …` before and after every step below (Always › Progress); the person sees nothing else while you work.
|
|
15
|
+
|
|
16
|
+
1. **Design before code.** Read `references/00-what-the-person-decides.md` and `references/02-design-the-material.md`. Decide ① what the student does, ② whether the student submits and the grading (`type` `pattern` or `rubric`, set on the edit screen; the quiz template uses `pattern`, so do not ask for a quiz) and which completion policy fits (the publish skill sets it after the person agrees; only `on_graded` grades, `on_submit` completes on any submission without grading), ③ the instructor screen, ④ the content edit screen, ⑤ the purpose. Decide what the request leaves out and tell the person briefly; ask only when the learning goal is unclear. Then show the numbered plan.
|
|
17
|
+
2. **Environment and project.** `ecdk --version && ecdk doctor --json` (`references/01-check-the-environment.md`, also for `cli.latest`), then `ecdk create --list` to pick a template and `ecdk create <folder> --template <name>` (`references/03-create-the-project.md`; it runs `npm install` for the SDK, so when that fails run `npm install` in the project). Start `ecdk dev <folder>` in the background now and give the person the URL.
|
|
18
|
+
3. **Write the screens.** Start from the template's example code and the kit API table at the top of `references/05-screen-code.md`; do not open `lib/` to learn the API (the table is the API). Follow its UI patterns (kit icon buttons, list rows, drop zones; the quiz template: `references/06-using-the-quiz-template.md`), and write `commentary.txt` (key concepts and intent, no answers). There is no default content file: the content and answers are what the edit screen saves (`ecdk dev` writes `.ecdk/settings.json`, local by default; the elice-content-publish skill can send it with the upload after the person agrees, otherwise the person enters it in the LXP edit screen).
|
|
19
|
+
- For a material that is not a quiz, start from the blank template and its content editor: design the content JSON shape and its schema first (`references/02-design-the-material.md` ④-1), put them in `screens/edit.js` (`useContentEditor(app, { initial, schema })`), then write the student screen against that shape. Replace the template's example everywhere it says `이 자료에 맞게 바꿀 곳`.
|
|
20
|
+
- If the person describes the content (for example "5 questions about perceptrons"), fill it in so the upload can carry it: write `.ecdk/settings.json` in the shape `references/09-check.md` describes (the edit screen's content object at the top level, `grading` when graded), then have the person open the edit view in `ecdk dev`, check it and save with the edit screen's button, so the edit screen's own validation runs. Draft the answers, but the person confirms them before any upload (Always). A quiz material holds one question, so several questions mean several quiz materials (pages): fill in the first and give the rest as draft text, one per page (each can be put in the edit view and uploaded in turn). If the person prefers, give the content as draft text (the content editor: one JSON block for 코드 보기) to enter in the LXP edit screen instead.
|
|
21
|
+
4. **Check each screen** with `ecdk dev <folder> --check --screens <screen>` after you write it (`references/09-check.md`), fix what it reports (error ids: `references/08-fix-check-errors.md`). The person looks at the screens too.
|
|
22
|
+
5. **Build and report.** `ecdk validate` once, then `ecdk build --json` must return `ok: true`. Report as `references/10-build.md` says.
|
|
23
|
+
6. **Upload** only after the person approves: the elice-content-publish skill (it can send `.ecdk/settings.json` with the upload after the person agrees to the summary), or the person uploads `dist/content.zip` in LXP. Content not sent with the upload is entered in the LXP edit screen, then '수업 자료에 반영' at the top of the LXP edit page (`references/12-upload-with-the-material-mcp.md`, "Content and answers (settings)" and "Fallback").
|
|
22
24
|
|
|
23
25
|
{{version}}
|
|
@@ -5,19 +5,21 @@ description: Move existing HTML, JavaScript or a web demo into an Elice Custom H
|
|
|
5
5
|
|
|
6
6
|
# Move existing HTML into an Elice learning material
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reference files are in `references/` in this skill's folder (see Always).
|
|
9
9
|
|
|
10
10
|
{{always}}
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
Write the progress line `[n/N] …` before and after every step below (Always › Progress); the person sees nothing else while you work.
|
|
15
|
+
|
|
16
|
+
1. **Read** `references/07-move-existing-html.md` (move existing HTML) and `references/04-rules.md` (rules).
|
|
17
|
+
2. **Look at the original first.** List its entry HTML, the files it loads, and storage or cookies used to keep learner data, anything the sandbox blocks (dialogs, `window.open`, the parent window, external requests, absolute `/` paths). Tell the person what will change, then show the numbered plan.
|
|
18
|
+
3. **Wrap it.** Make or reuse an ecdk project as `references/07-move-existing-html.md` says, keep the original files as they are where possible, and write `commentary.txt`. An old ecdk project: `references/08-fix-check-errors.md` (`project.legacy-file`, `sdk.lib-copy`). Start `ecdk dev <folder>` in the background and give the person the URL.
|
|
19
|
+
4. **Submission and grading.** Decide whether it submits and how it grades (`references/02-design-the-material.md`); say which completion policy fits (e.g. `on_access` without a submission); the elice-content-publish skill sets it with the upload after the person agrees. When it grades, set the grader and the answers on the edit screen (`app.useGradingBlock()`). Ask the person for correct answers when it is graded. Data the instructor should edit goes in the content the edit screen saves, not in a default JSON file; until it is saved the screens show `app.emptyState()`. To carry the original's data with the upload, save it through the edit view in `ecdk dev` (`.ecdk/settings.json`, shape in `references/09-check.md`); the elice-content-publish skill sends it after the person agrees, with answers the person confirmed.
|
|
20
|
+
Keep the original design on the student screen. Screens you add (an edit screen, an empty state) follow the kit API table and UI patterns in `references/05-screen-code.md`.
|
|
19
21
|
5. **Bring external assets in.** Download every external image, font, CSS file, video and library into the zip and use relative paths (fonts as files or data URIs; replace `<iframe>` embeds, video goes to an Elice video material). The content CSP blocks anything outside the zip.
|
|
20
|
-
6. **Check.** `ecdk
|
|
21
|
-
7. **Build and report.** `ecdk build --json` returns `ok: true`; report what changed from the original (
|
|
22
|
+
6. **Check.** `ecdk dev <folder> --check` (`references/09-check.md`), fix what it reports (`references/08-fix-check-errors.md`), compare with the original. "막힌 외부 요청" is a library calling outside at runtime; bring that file into the zip too.
|
|
23
|
+
7. **Build and report.** `ecdk validate` once, then `ecdk build --json` returns `ok: true`; report what changed from the original (`references/10-build.md`).
|
|
22
24
|
|
|
23
25
|
{{version}}
|