@eliceio/cdk-cli 0.1.0-alpha.4 → 0.1.0-alpha.6
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 +215 -152
- package/es/cli.js +65 -66
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +20 -7
- package/es/commands/create/index.d.ts +1 -1
- package/es/commands/create/index.js +5 -9
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +5 -5
- package/es/commands/doctor/index.d.ts +18 -1
- package/es/commands/doctor/index.js +137 -27
- package/es/commands/mcp/index.d.ts +0 -12
- package/es/commands/mcp/index.js +6 -57
- package/es/commands/setup/index.d.ts +11 -3
- package/es/commands/setup/index.js +112 -37
- package/es/commands/skill/index.d.ts +46 -8
- package/es/commands/skill/index.js +151 -35
- package/es/commands/uninstall/index.d.ts +54 -0
- package/es/commands/uninstall/index.js +304 -0
- package/es/commands/update/index.d.ts +59 -0
- package/es/commands/update/index.js +251 -0
- package/es/commands/{check → validate}/index.d.ts +1 -1
- package/es/commands/{check → validate}/index.js +1 -1
- package/es/core/collect.js +1 -1
- package/es/core/config.d.ts +20 -37
- package/es/core/config.js +36 -89
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/prepare.js +4 -3
- package/es/core/project-check.d.ts +2 -2
- package/es/core/project-check.js +2 -2
- package/es/core/sandbox.js +6 -3
- package/es/core/templates.d.ts +1 -3
- package/es/core/templates.js +1 -4
- package/es/dev/grading.d.ts +7 -8
- package/es/dev/grading.js +6 -16
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +29 -12
- package/es/dev/inject.d.ts +6 -0
- package/es/dev/inject.js +16 -1
- package/es/dev/mock-api.d.ts +8 -12
- package/es/dev/mock-api.js +50 -81
- package/es/dev/server.d.ts +4 -2
- package/es/dev/server.js +18 -29
- package/es/rules/check.js +80 -41
- package/es/rules/csp.d.ts +26 -0
- package/es/rules/csp.js +42 -0
- package/es/rules/index.d.ts +2 -1
- package/es/rules/index.js +2 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/refs.d.ts +12 -2
- package/es/rules/refs.js +50 -18
- package/es/rules/types.d.ts +6 -13
- package/es/rules.json.js +2 -2
- package/package.json +2 -3
- package/rules.json +48 -57
- package/skills/_shared/always.md +5 -4
- package/skills/elice-content-check/SKILL.md +10 -9
- package/skills/elice-content-create/SKILL.md +7 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +14 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +27 -0
- package/skills/elice-content-guide/topics/09-check.md +11 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +10 -8
- package/skills/elice-content-publish/SKILL.md +8 -8
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +41 -136
- package/templates/_shared/lib/elice-content.css +81 -1
- package/templates/_shared/lib/elice-content.d.ts +6 -37
- package/templates/_shared/lib/elice-content.js +23 -236
- package/templates/blank/README.md +5 -6
- package/templates/blank/metadata.json +1 -3
- package/templates/blank/package.json +2 -2
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +4 -4
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +11 -9
- package/templates/quiz/core/editor.js +32 -32
- package/templates/quiz/core/model.js +3 -3
- package/templates/quiz/metadata.json +1 -3
- package/templates/quiz/package.json +2 -2
- package/templates/quiz/screens/edit.js +121 -29
- package/templates/quiz/screens/learn.js +5 -2
- package/templates/quiz/styles.css +96 -37
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +4 -0
- package/templates/quiz/ui/templates/edit.js +69 -19
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/templates/page.js +1 -2
- package/templates/quiz/ui/templates/text.js +10 -7
- package/templates/quiz/ui/texts.js +14 -12
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -302
- package/templates/blank/completion.html +0 -15
- package/templates/blank/screens/completion.js +0 -7
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
# Developing Elice Custom HTML learning materials
|
|
2
|
-
|
|
3
|
-
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.
|
|
4
|
-
|
|
5
|
-
Build it with the `ecdk` CLI (`@eliceio/cdk-cli`). Read one topic of this guide with `ecdk guide <topic>` (`ecdk guide` lists the topics). For a command's options, run `ecdk <command> --help`.
|
|
6
|
-
|
|
7
|
-
One zip has up to four screens.
|
|
8
|
-
|
|
9
|
-
| Screen | Files | What it does |
|
|
10
|
-
| ---------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
-
| Student (required) | `index.html` + `screens/learn.js` | The learning activity (read, interact, solve, make). Submits a result when needed |
|
|
12
|
-
| Instructor (optional) | `instructor.html` + `screens/instructor.js` | What only instructors see: activity summary, explanations, teaching tips |
|
|
13
|
-
| 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) |
|
|
14
|
-
| Completion policy (optional) | `completion.html` + `screens/completion.js` | The instructor picks when the material counts as done, among `completionPolicies` (`screens.completionPolicy`). Off when the material lists one policy |
|
|
15
|
-
|
|
16
|
-
Elice opens the content in a **sandboxed (`allow-scripts`) iframe on another origin**. There is no server: everything runs as browser JS, and only submission, saving and grading go to the Elice server.
|
|
17
|
-
|
|
18
|
-
## 0. What the person decides
|
|
19
|
-
|
|
20
|
-
The person (the instructor or author) is responsible for the content and its answers. Do not settle the following on your own; ask, or get a confirmation.
|
|
21
|
-
|
|
22
|
-
1. **The learning goal, when it is unclear.** Decide the rest of the design to fit the goal and tell the person briefly what you decided.
|
|
23
|
-
2. **Correct answers.** You may draft answers and rubrics, but the person confirms that they are right.
|
|
24
|
-
3. **How it completes and how it is graded**: which completion policies the material supports (`completionPolicies`, the first one is the default) and the grader. One policy fixes it; more than one lets the instructor pick on a completion policy screen. Propose what fits the material and get a confirmation.
|
|
25
|
-
4. **What the learning notes say** (`commentary.txt`). A material needs them (LXP rejects the upload without them); once they are filled in, AI Helpy answers only questions about this material, so let the person check the wording.
|
|
26
|
-
5. **Checking the screens.** The person looks at the student, tutoring, instructor, edit and mobile views in the preview. When they cannot, tell them what to check and in which order.
|
|
27
|
-
6. **Uploading to LXP.** A saved version is **visible to learners at once** (when the page is open). Before uploading, show what changes and get approval. The same goes for changing a material that is already open, changing answers, and restoring an older version.
|
|
28
|
-
7. **Global installs, accounts and permissions.** Leave them to the person.
|
|
29
|
-
|
|
30
|
-
## 1. Check the environment
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
ecdk --version && ecdk doctor --json
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
- Without `ecdk`: it needs Node.js 20.19 or later (22 LTS recommended) and `@eliceio/cdk-cli`. Tell the user how to install it, and run **a global install (`npm install -g @eliceio/cdk-cli`) only after the user agrees**. Without agreement, run `npx @eliceio/cdk-cli <command>`.
|
|
37
|
-
- `doctor` item `mcp.material` warns when the Elice material server MCP is not registered. It is used later to upload to LXP (the publish skill is not available yet), so it is not needed to make a material. To register it, ask the user first, then run `ecdk setup` (installs the skills and registers the MCP in one go; production by default, `--env qa5` for the QA server; `ecdk mcp setup` registers the MCP only) and tell the user the login step it prints.
|
|
38
|
-
- Fix each `fail` item in `doctor` as its `fix.description` says. `--fix` fixes only the items that can be fixed automatically.
|
|
39
|
-
|
|
40
|
-
## 2. Design the material
|
|
41
|
-
|
|
42
|
-
Decide the following before writing code. Decide what the request leaves out to fit the material's purpose, and tell the user briefly what you decided. Ask only when the learning goal is unclear.
|
|
43
|
-
|
|
44
|
-
**① What the student does**
|
|
45
|
-
Read or watch / change values and observe (simulation, visualization) / follow steps / solve problems / make something. Tie the activity directly to the learning goal.
|
|
46
|
-
|
|
47
|
-
**② Completion policy and grading** (2026-11-11: the material lists the completion policies it supports in `completionPolicies` and the server sets the first one; the grading settings `settings.grading` hold the grader `type` and its answers)
|
|
48
|
-
|
|
49
|
-
| Material | Completion policy | Grading (`type`) | Student screen |
|
|
50
|
-
| ----------------------------------------------------------- | --------------------------------- | ----------------------- | ----------------------------------------- |
|
|
51
|
-
| Something to read or watch, such as a simulation | `on_access` (done on open) | - | No submission |
|
|
52
|
-
| Done when the activity ends (results, self-check, survey) | `on_submit` (100 on submit) | - | Submit the result with `useSubmit` |
|
|
53
|
-
| One correct answer or one set of answers | `on_graded` (done when it passes) | `pattern` (one regex) | `useSubmit` |
|
|
54
|
-
| Writing or assignments graded against a rubric (AI grading) | `on_graded` | `rubric` (the criteria) | `useSubmit`, the score comes back at once |
|
|
55
|
-
|
|
56
|
-
- **The grader and the answers are set on the edit screen** and saved to `settings.grading` with the edit token (`useSave` with `getGrading`): `{ "type": "pattern", "answer_key": "^…$" }` or `{ "type": "rubric", "rubric": "…" }`. The kit's default block `app.useGradingBlock()` uses LXP's wording (기준 답안 (정규표현식), 작성 예시 보기, 평가 기준). When the answers depend on the content's structure (questions, choices, steps), set them where the content is edited, for example in each question card. The answer to `pattern` is **one regular expression** that must match the whole submitted answer string (trimmed), so submit one string and build the regex from the instructor's choices.
|
|
57
|
-
- **`completionPolicies` is required** in the project's `metadata.json` (a material without it, or with an empty list, fails `manifest.completion-policies-missing`): for example `"completionPolicies": ["on_submit"]`. The server sets the **first** value as the material's policy on upload. Put `on_graded` in it only when the edit screen saves the grading. The grader is not listed here: it is `settings.grading.type` (`pattern` · `rubric`), set on the edit screen.
|
|
58
|
-
- **One policy fixes it** (`["on_graded"]` in the quiz template; no completion policy screen). **More than one** lets the instructor pick among them on the **completion policy screen** (`screens.completionPolicy`, `app.useCompletion()`, which shows only the listed policies). That screen saves through `app.completion.set()` → SDK `saveCompletionPolicy` (`PATCH` `completion_policy`); it never touches `settings`, and the edit screen never sends a policy. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). More than one policy without the screen warns `completion.no-screen`; one policy with the screen warns `completion.screen-unused`. The blank template lists `["on_submit", "on_access"]` with the screen.
|
|
59
|
-
- Custom HTML does not use manual grading (`manual`) or no grading (`none`). There is no per-question grading: every question must be right for 100. Changing the answers does not regrade past submissions.
|
|
60
|
-
- Answers never go in the zip (`metadata.json` · data JSON · code), and there is no answer file in the project: answers exist only in `settings.grading`, saved on the edit screen. The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `metadata.json` or an old `elice.config.json`. A grading with the 11-10 policy and grader fields is rejected with how to rewrite it.
|
|
61
|
-
|
|
62
|
-
**②-1 Learning notes**: write the key concepts, the activity, and the intent of the questions in `commentary.txt` (plain text) at the top of the project. `build` puts it in the zip and writes `"commentary": "commentary.txt"` in `metadata.json`; LXP's AI Helpy and AI quiz generation read it. It is inside the zip, so students can read it: **never put answers in it.** A material needs it: LXP rejects an upload without learning notes, and `ecdk check` reports `manifest.commentary-missing` (a problem description, `kind: description`, does not need it). Once it is filled in, AI Helpy answers only questions about this material.
|
|
63
|
-
|
|
64
|
-
**③ Does it need an instructor screen?** Make one when there are explanations, a summary of the answer conditions, or teaching tips. Turn it off when it would equal the student screen.
|
|
65
|
-
|
|
66
|
-
**④ Does it need a content edit screen?** When instructors may want to rewrite text, numbers or lists (for example a simulation's initial values, a card list, step descriptions), keep them in the content the edit screen saves (`app.content`, the material's `settings`) and let the edit screen change them. There is no default content file: until the edit screen saves, `app.content` is `{}`, `app.hasContent` is false, and the student and instructor screens show `app.emptyState()` ("아직 내용이 없습니다 …"). Turn the edit screen off only when the material needs no content at all (everything is in the code).
|
|
67
|
-
|
|
68
|
-
**⑤ Purpose**: the material itself (`kind: material`, the default), or the **problem description** of another material such as a practice (`kind: description`: student screen only, no grading).
|
|
69
|
-
|
|
70
|
-
**Steps inside one material (paging)**: LXP already draws a bar **under every material** with `< 이전 · 3/6 · 다음 >` that moves between **lecture pages** of the course. Inside the material, never draw a bottom bar with 이전 · 다음 (or "◀ 이전 · 2 / 6 · 다음 ▶") that looks like it: the student cannot tell which one moves the step and which one leaves the material. For a material with several steps (slides, STEP 1~5), use the kit's `app.usePaging` (see 5):
|
|
71
|
-
|
|
72
|
-
- Between steps: **round chevron buttons on the left and right edges** of the content, vertically centered, and a small **`n / N` indicator inside the content**.
|
|
73
|
-
- On the **first step the left button, on the last step the right button go to the previous / next lecture page** in LXP (SDK `app.navigation.previous()` · `next()`). They look different on purpose (a labeled pill "‹ 이전 자료" · "다음 자료 ›" instead of a bare chevron), so the student knows they are leaving this material. When there is no lecture page on that side, or the material is not in LXP (editor preview, local), they are hidden.
|
|
74
|
-
- If the last step has its own action (submit, "결과 보기"), keep it in the content; the right pill still leads on to the next material.
|
|
75
|
-
- On a phone (narrower than 512px) the kit puts the buttons under the content instead of over its edges.
|
|
76
|
-
|
|
77
|
-
## 3. Create the project
|
|
78
|
-
|
|
79
|
-
Run `ecdk create --list` first: it prints each template with its own version (`quiz@1.1.0`), what it is for, its screens and its completion policy. Pick the template from that list. `ecdk create` records the template and version in `package.json` `"ecdk"` (`template`), `ecdk build` copies it to `metadata.json` `build.template`, and `ecdk doctor` says when the installed ecdk ships a newer version of that template (nothing changes on its own).
|
|
80
|
-
|
|
81
|
-
| Case | Start with |
|
|
82
|
-
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
-
| A quiz (one question per quiz material; several questions mean several quiz materials) | `ecdk create <folder>` (quiz template: starts with no question; the edit screen adds one question of any of the five types with "문항 추가"; answers set on the edit screen; `"completionPolicies": ["on_graded"]` + `pattern`) |
|
|
84
|
-
| Any other material | `ecdk create <folder> --template blank` (skeleton of the three screens) |
|
|
85
|
-
| A dark screen | Add `--theme dark` to the above |
|
|
86
|
-
| A problem description | Create with blank, set `metadata.json` to `{ "kind": "description", "screens": { "learn": { "enabled": true, "entry": "index.html" } }, "commentary": "commentary.txt" }`, delete the other screen files |
|
|
87
|
-
| An existing HTML page | [7. Move existing HTML](#7-move-existing-html) |
|
|
88
|
-
|
|
89
|
-
`create` refuses a folder that is not empty. Use a new subfolder. It then runs `npm install` in the project (the SDK `@eliceio/cdk` comes from npm through `package.json`; `--no-install` skips it). When the install fails, the project stays: run `npm install` in it (network or proxy problem; tell the user).
|
|
90
|
-
|
|
91
|
-
The project files: screens, `lib/` (the screen kit, copied as is), `metadata.json` (screens · `completionPolicies` · `commentary`; `ecdk build` copies it and fills only `build`), `package.json` (the SDK version in `dependencies`, build options `minify` · `sourcemap` · `root` · `outDir` · `exclude` · `template` under `"ecdk"`). There is no `lib/cdk.js` in the project: `ecdk build` and `ecdk dev` take it from `node_modules/@eliceio/cdk`. To update the SDK run `npm update @eliceio/cdk`.
|
|
92
|
-
|
|
93
|
-
Then:
|
|
94
|
-
|
|
95
|
-
1. Set `screens` in `metadata.json` to the design (`{ "enabled": true, "entry": "edit.html" }` for a screen you keep, `{ "enabled": false }` for one you drop). Set `completionPolicies` too. In `ecdk dev`, saving in the content edit view writes the whole settings (content and answers) to `.ecdk/settings.json`, and the completion policy view writes `.ecdk/completion.json`; both stay out of the zip and out of `ecdk build` · `check`.
|
|
96
|
-
2. Make the edit screen save the data in ④. **Local work builds only the template (screens and code)**; the real content and answers are entered in the LXP edit screen after upload (2026-11-11). In `ecdk dev`, try the edit and learn screens with a little sample input; it is saved only in `.ecdk/settings.json` and never uploaded, so do not author the full content locally. When the person describes the content, give it as draft text for them to enter in LXP.
|
|
97
|
-
3. Write the screen code ([5](#5-screen-code)). Delete the HTML and JS of screens you do not use.
|
|
98
|
-
4. Check ([9](#9-check)) → build ([10](#10-build)).
|
|
99
|
-
|
|
100
|
-
## 4. Rules
|
|
101
|
-
|
|
102
|
-
1. **Never put correct answers in the content**: not in a data JSON file, the screen code, or comments. They reach the student's browser. Answers go only in `settings.grading` through the edit screen (the server never sends it to students; `ecdk dev` keeps it in `.ecdk/settings.json`, left out of the zip).
|
|
103
|
-
2. **Screen code calls only `lib/elice-content.js` (the kit).** Do not edit `lib/`. Do not call the SDK (`lib/cdk.js`, added by `ecdk build` from `node_modules`) directly.
|
|
104
|
-
3. **Do not use blocked features**: `localStorage` · `sessionStorage` · `indexedDB` · `document.cookie` · `alert`/`confirm`/`prompt` · `window.open` · `<form>` submission · access to `window.parent`/`top` · `fetch`/`WebSocket` to external addresses · external `<script src>`. To keep progress, submit it (`useSubmit`); to keep content, save it from the edit screen.
|
|
105
|
-
4. **Libraries and media go inside the zip.** Download libraries for charts, visualization or physics (for example Chart.js, D3, p5.js) into `vendor/` and load them by relative path instead of a CDN. Fonts, images and sounds also go in the zip. Limits: zip 20 MB, 300 files. Upload long videos separately as Elice video materials.
|
|
106
|
-
5. **Use relative paths** (`img/a.png`). Paths starting with `/` break. Match file name case. Prefer letters, digits, `-` and `_`.
|
|
107
|
-
6. **Switch views inside one HTML.** Show and hide steps or pages within the same HTML. Moving to another HTML or reloading loses the access token and shows "please reopen the material".
|
|
108
|
-
7. **Never insert user input as HTML**: use `textContent`. When `innerHTML` is really needed, escape it and leave `// ecdk-ignore-next-line sec.html-injection` with the reason.
|
|
109
|
-
8. **Colors and fonts use EDS tokens** (`var(--eds-primary-main)`, `var(--eds-text-primary)`, `var(--eds-background-paper)` …). When drawing on canvas or SVG, read them with `getComputedStyle(document.documentElement).getPropertyValue('--eds-primary-main')`. Do not write colors directly (the dark theme will not match).
|
|
110
|
-
9. **Mobile and accessibility**: touch targets 44 px or more, input text 16 px, no breakage at 360 px width. Work with touch (Pointer Events) and keyboard, not only a mouse. Give images `alt`.
|
|
111
|
-
10. Never include keys, tokens or passwords (comments are checked too).
|
|
112
|
-
|
|
113
|
-
## 5. Screen code
|
|
114
|
-
|
|
115
|
-
```js
|
|
116
|
-
import { start } from '../lib/elice-content.js';
|
|
117
|
-
|
|
118
|
-
// Student screen
|
|
119
|
-
const app = await start({ screen: 'learn' });
|
|
120
|
-
// Content is only what the edit screen saved (no default content file). Before that, show the kit's notice
|
|
121
|
-
if (app.hasContent) render(app.content);
|
|
122
|
-
else root.replaceChildren(app.emptyState());
|
|
123
|
-
|
|
124
|
-
// Only for materials with a submission: say how to collect and restore the answer (result).
|
|
125
|
-
// Locking, restoring and result messages are handled by the kit.
|
|
126
|
-
app.useSubmit({
|
|
127
|
-
getAnswer: () => ({ result: currentResult() }), // small JSON (a few KB at most)
|
|
128
|
-
setAnswer: a => restore(a?.result), // filled on reopen and in tutoring
|
|
129
|
-
validate: a => a.result != null || 'Finish the activity before submitting.',
|
|
130
|
-
onResult: res => showFeedback(res), // grading result (score · isCorrect)
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
// Content edit screen: render the fields and say what to save
|
|
136
|
-
const app = await start({ screen: 'edit' });
|
|
137
|
-
renderForm(app.content);
|
|
138
|
-
app.useSave({
|
|
139
|
-
getContent: () => ({ ...app.content, title: titleInput.value, steps: readSteps() }),
|
|
140
|
-
validate: c => c.title.trim() !== '' || 'Enter a title.',
|
|
141
|
-
});
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
```js
|
|
145
|
-
// Edit screen with the grader block: the kit draws LXP's grader radios, the "기준 답안 (정규표현식)" field
|
|
146
|
-
// with "작성 예시 보기", and the "평가 기준" field. useSave saves the content and the grader in one save.
|
|
147
|
-
const grading = app.useGradingBlock();
|
|
148
|
-
app.useSave({ getContent: () => app.content, getGrading: () => grading.getGrading() });
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
```js
|
|
152
|
-
// Completion policy screen (screens.completionPolicy): radios for the policies in completionPolicies and the save button.
|
|
153
|
-
// It saves through app.completion.set() → SDK saveCompletionPolicy (PATCH completion_policy), not settings.
|
|
154
|
-
const app = await start({ screen: 'completionPolicy' });
|
|
155
|
-
app.useCompletion();
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
- `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 and completion policy screens). `app.completion.get()` · `set(policy)` read and change the completion policy (`set` only on the completion policy screen and only within `completionPolicies`).
|
|
159
|
-
- With `on_graded` in `completionPolicies`, the edit screen must save the grading (`completion.no-grading` warns when its code never uses `useGradingBlock` · `getGrading` · `grading:`).
|
|
160
|
-
- Saving on the edit screen (`useSave`) **saves to the material at once** (SDK `saveSettings`, with the edit token LXP opens the edit screen with): a new version, shown on the student and instructor screens right away. The kit shows the result and the failure messages (the upload is not saved yet, someone saved in between, session expired), so the screen code does not announce "saved" itself.
|
|
161
|
-
- Materials without a submission (`on_access`) do not call `useSubmit`.
|
|
162
|
-
- 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.
|
|
163
|
-
- 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.
|
|
164
|
-
|
|
165
|
-
```js
|
|
166
|
-
app.usePaging({
|
|
167
|
-
count: steps.length,
|
|
168
|
-
// also called once at start. Draw only into `content` (#app by default); the kit keeps its buttons outside it
|
|
169
|
-
onChange: (i, { content }) => content.replaceChildren(renderStep(steps[i])),
|
|
170
|
-
});
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
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.
|
|
174
|
-
|
|
175
|
-
- Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
|
|
176
|
-
|
|
177
|
-
## 6. Using the quiz template
|
|
178
|
-
|
|
179
|
-
- The template starts with **no questions**: the student and instructor screens show "아직 내용이 없습니다" until the edit screen saves. The person adds the question and answer on the LXP edit screen after upload ("문항 추가", any of the five types, the answer in the same card). **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. Locally, add a sample question in `ecdk dev` to check the screens; give the requested question set as draft text, one question per quiz material.
|
|
180
|
-
- 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.
|
|
181
|
-
- 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.
|
|
182
|
-
- 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 lists only `on_graded` (`"completionPolicies": ["on_graded"]`) and grades with `pattern`, so it has no completion policy screen and no hand-written regex. `pattern` compares the whole answer at once, so **everything must match for 100** (no partial score per question).
|
|
183
|
-
|
|
184
|
-
```json
|
|
185
|
-
{
|
|
186
|
-
"type": "pattern",
|
|
187
|
-
"answer_key": "^q1=b;q2=a,d;q3=c,a,b;q4=(?:weight|%EA%B0%80%EC%A4%91%EC%B9%98);q5=g1:a\\|g2:b,c$"
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
- 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).
|
|
192
|
-
- Colors, spacing, corners, choice cards: the `--qz-*` variables in `ui/theme.css` (they point at EDS tokens, so `--theme dark` also fits)
|
|
193
|
-
- Text: `ui/texts.js` (tab title, loading, student, instructor, edit, and validation messages)
|
|
194
|
-
- 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.
|
|
195
|
-
- Behavior adds state as attributes: `data-result="correct|wrong"` · `data-dragging` · `data-ghost`. Style them in CSS.
|
|
196
|
-
- 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.
|
|
197
|
-
|
|
198
|
-
To mix a visualization or simulation into a quiz, edit the quiz template, or write the question data in the same shape on top of blank.
|
|
199
|
-
|
|
200
|
-
## 7. Move existing HTML
|
|
201
|
-
|
|
202
|
-
1. Create a skeleton with `ecdk create <new folder> --template blank`.
|
|
203
|
-
2. Move the original body, styles and scripts to the student screen (`index.html` · `screens/learn.js` · `styles.css`). Copy image, font and library folders as they are and use relative paths.
|
|
204
|
-
3. Download external CDN scripts and fonts into the zip.
|
|
205
|
-
4. Replace blocked code (storage, `alert`, external sends) as in [4](#4-rules).
|
|
206
|
-
5. Merge multiple HTML pages into one HTML that switches views.
|
|
207
|
-
6. Decide completion and grading as in [2 ②](#2-design-the-material). Without grading, pick `on_access` or `on_submit` and write it in `metadata.json` (`"completionPolicies": ["on_access"]` when there is no submission).
|
|
208
|
-
7. Turn off the instructor, edit and completion policy screens in `metadata.json` `screens` (`{ "enabled": false }`) and delete their files when they are not needed.
|
|
209
|
-
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`.
|
|
210
|
-
|
|
211
|
-
## 8. Fix check errors
|
|
212
|
-
|
|
213
|
-
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.
|
|
214
|
-
|
|
215
|
-
| id | Fix |
|
|
216
|
-
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
217
|
-
| `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file |
|
|
218
|
-
| `ref.root-absolute` | Change `/…` to a relative path |
|
|
219
|
-
| `ref.external-script` · `ref.external-request` | Put the library or font in the zip and use a relative path |
|
|
220
|
-
| `api.storage` · `api.cookie` | Do not use storage. Submit results; save content from the edit screen |
|
|
221
|
-
| `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit` |
|
|
222
|
-
| `api.external-send` | Remove the external send |
|
|
223
|
-
| `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason |
|
|
224
|
-
| `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**) |
|
|
225
|
-
| `manifest.completion-policies-missing` (error) | Add `"completionPolicies": ["on_submit"]` (or the policies you chose, default first) to `metadata.json` |
|
|
226
|
-
| `completion.no-screen` (warn) | Turn on the completion policy screen (`screens.completionPolicy`), or keep only one policy |
|
|
227
|
-
| `completion.screen-unused` (warn) | One policy is fixed: remove the completion policy screen, or list more policies |
|
|
228
|
-
| `completion.no-edit` (error) | `on_graded` needs an edit screen to set the answers: turn on `screens.edit`, or pick `on_submit` · `on_access` |
|
|
229
|
-
| `completion.no-grading` (warn) | Add `app.useGradingBlock()` to the edit screen and pass `getGrading` to `useSave` |
|
|
230
|
-
| `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 |
|
|
231
|
-
| `sdk.outdated` (error) | The SDK in the zip is older than the minimum: `npm update @eliceio/cdk` (an old `lib/cdk.js` copy: `ecdk doctor --fix && npm install`), then build again |
|
|
232
|
-
| `sdk.lib-copy` (warn, project only) | An old `lib/cdk.js` copy and no `@eliceio/cdk` in `package.json`: `ecdk doctor --fix`, then `npm install` |
|
|
233
|
-
| `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"` |
|
|
234
|
-
| `manifest.*` · `entry.*` | Check `screens` and `kind` in `metadata.json` |
|
|
235
|
-
| `limit.*` · `file.large-image` | Shrink images and video, drop unused files (build output: "files not referenced anywhere") |
|
|
236
|
-
|
|
237
|
-
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.
|
|
238
|
-
|
|
239
|
-
## 9. Check
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
ecdk dev # http://localhost:4170: student, tutoring, instructor, content edit, completion policy (when on); desktop and mobile widths
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
- 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, changing the policy in the completion policy view (when on), the mobile width, and the dark theme. Without one, ask the user to check in this order.
|
|
246
|
-
- Even after your own check, the person looks at the screens before uploading (see [0. What the person decides](#0-what-the-person-decides)).
|
|
247
|
-
- Fix the content console errors and 404s printed in the terminal.
|
|
248
|
-
- Opening files directly with `file://` is not a check.
|
|
249
|
-
|
|
250
|
-
## 10. Build
|
|
251
|
-
|
|
252
|
-
```bash
|
|
253
|
-
ecdk build --json
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
- With `ok: true` the zip is `dist/content.zip`. To make it smaller, set `"minify": true` in `package.json` `"ecdk"` (quiz template about 122 KB → 87 KB).
|
|
257
|
-
- Report to the user: what the material is (what the student does, which screens are on, how it completes), the zip path and size, **how it completes and what to pick in the settings tab** (the completion policy and 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](#0-what-the-person-decides)).
|
|
258
|
-
|
|
259
|
-
## 11. More
|
|
260
|
-
|
|
261
|
-
- CLI usage: the `@eliceio/cdk-cli` README
|
|
262
|
-
- Command help: `ecdk <command> --help`
|
|
263
|
-
|
|
264
|
-
## 12. Upload with the material MCP
|
|
265
|
-
|
|
266
|
-
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` (QA: `ecdk mcp setup --env qa5`) 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`.
|
|
267
|
-
|
|
268
|
-
**Order**
|
|
269
|
-
|
|
270
|
-
| Step | Tool or command | Notes |
|
|
271
|
-
| ------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
272
|
-
| Build | `ecdk build --json` | `ok: true` required. Use `zip` and `zipBytes` |
|
|
273
|
-
| 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 |
|
|
274
|
-
| New page (optional) | `create_custom_page` (`org`, `lecture_id`) | Ask first. 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 |
|
|
275
|
-
| Current version | `get_material` | Keep `current_version.id` (null for a page never saved) |
|
|
276
|
-
| Upload URL | `create_package_upload` (`size_bytes`) | At most 20 MB. Returns `key` and `curl_command` |
|
|
277
|
-
| Upload | the `curl_command`, `package.zip` replaced by the zip path | From a desktop app, run it through a login shell (see Always) |
|
|
278
|
-
| Draft | `submit_package` (`key`) → `get_draft` every 2–3 s | `ready`: shows `preview_urls`, `warnings`, the package metadata. `failed`: report `failure` with `ecdk check dist/content.zip` and stop |
|
|
279
|
-
| Approve | — | Show page, title, completion policy, answers saved or not, `preview_urls`. Saving is visible to learners at once when the page is open |
|
|
280
|
-
| Save | `save_draft` (`material_draft_id`, `expected_current_version_id`, `completion_policy`) | See below (no content or `grading` from the project). `MATERIAL_CHANGED`: someone saved after your `get_material`; do not retry blindly, tell the person |
|
|
281
|
-
| 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 |
|
|
282
|
-
|
|
283
|
-
After a successful save, write `.ecdk/link.json` in the project (it is not put in the zip; add `.ecdk/` to `.gitignore`):
|
|
284
|
-
|
|
285
|
-
```json
|
|
286
|
-
{ "org": "trial-cdk-qa5", "lecture_page_id": 129, "version_id": "…" }
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Next time, read it, confirm the page with the person, and compare `version_id` with `get_material`'s `current_version.id`: if they differ, someone saved in LXP since — tell the person before uploading.
|
|
290
|
-
|
|
291
|
-
**Completion policy and answers**
|
|
292
|
-
|
|
293
|
-
- `completion_policy`: `on_access` (complete on open), `on_submit` (complete on any submission) or `on_graded` (complete when the grading passes). Pass the first value of `completionPolicies` on the first `save_draft` (the server will also read it from `metadata.json`, G132; until then a first version without it gets `on_access`), and later versions keep the current policy unless you pass one. Pass it on `save_draft`, not afterwards, so learners never complete the page under the wrong policy.
|
|
294
|
-
- 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 and enter the content and answers (`settings`, with `settings.grading` for `on_graded`). Answers never go into the zip.
|
|
295
|
-
- A quiz (`on_graded`) has no answers at its first upload. Whether the server accepts `on_graded` without grading is undecided (G132): if `save_draft` returns `MATERIAL_GRADING_REQUIRED`, stop and tell the person. Either way, the person sets the answers on the edit screen right after the upload.
|
|
296
|
-
- The quiz template is `on_graded` with a pattern; other materials follow the design (②).
|
|
297
|
-
|
|
298
|
-
**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.
|
|
299
|
-
|
|
300
|
-
**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.
|
|
301
|
-
|
|
302
|
-
**After saving**: report the LXP URL of the page and that 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,15 +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
|
-
<title>완료 정책</title>
|
|
7
|
-
<link rel="stylesheet" href="lib/elice-tokens.css" />
|
|
8
|
-
<link rel="stylesheet" href="lib/elice-content.css" />
|
|
9
|
-
<link rel="stylesheet" href="styles.css" />
|
|
10
|
-
<script type="module" src="screens/completion.js"></script>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<main id="app"><p class="ec-muted">불러오는 중…</p></main>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// 완료 정책 화면 (LXP 편집 페이지 설정 탭, screens.completionPolicy). 라디오 · 저장 · 변경 표시는 키트(useCompletion)가 합니다.
|
|
2
|
-
// metadata.json completionPolicies에 적은 정책만 보이고, 저장하면 SDK saveCompletionPolicy로 자료의 완료 정책이 바뀝니다.
|
|
3
|
-
// 정책을 하나만 두면(고정) 이 화면은 지우고 metadata.json screens.completionPolicy를 { "enabled": false }로 바꿉니다.
|
|
4
|
-
import { start } from '../lib/elice-content.js';
|
|
5
|
-
|
|
6
|
-
const app = await start({ screen: 'completionPolicy' });
|
|
7
|
-
app.useCompletion();
|