@eliceio/cdk-cli 0.1.0-alpha.1 → 0.1.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +171 -136
  2. package/es/cli.js +119 -26
  3. package/es/commands/build/index.d.ts +4 -1
  4. package/es/commands/build/index.js +28 -9
  5. package/es/commands/check/index.d.ts +8 -2
  6. package/es/commands/check/index.js +45 -5
  7. package/es/commands/create/index.d.ts +2 -0
  8. package/es/commands/create/index.js +28 -3
  9. package/es/commands/create/scaffold.d.ts +2 -0
  10. package/es/commands/create/scaffold.js +10 -6
  11. package/es/commands/dev/index.d.ts +1 -1
  12. package/es/commands/dev/index.js +6 -2
  13. package/es/commands/doctor/index.d.ts +12 -0
  14. package/es/commands/doctor/index.js +217 -7
  15. package/es/commands/guide/index.d.ts +29 -0
  16. package/es/commands/guide/index.js +120 -0
  17. package/es/commands/mcp/index.d.ts +134 -0
  18. package/es/commands/mcp/index.js +399 -0
  19. package/es/commands/setup/index.d.ts +40 -0
  20. package/es/commands/setup/index.js +157 -0
  21. package/es/commands/skill/index.d.ts +45 -0
  22. package/es/commands/skill/index.js +145 -0
  23. package/es/core/config.d.ts +63 -19
  24. package/es/core/config.js +108 -32
  25. package/es/core/prepare.js +3 -5
  26. package/es/core/project-check.d.ts +15 -0
  27. package/es/core/project-check.js +26 -0
  28. package/es/core/sandbox.d.ts +17 -0
  29. package/es/core/sandbox.js +182 -0
  30. package/es/core/templates.d.ts +25 -0
  31. package/es/core/templates.js +41 -0
  32. package/es/dev/grading.d.ts +14 -7
  33. package/es/dev/grading.js +27 -13
  34. package/es/dev/host-page.d.ts +1 -1
  35. package/es/dev/host-page.js +33 -33
  36. package/es/dev/mock-api.d.ts +20 -4
  37. package/es/dev/mock-api.js +70 -9
  38. package/es/dev/server.d.ts +9 -1
  39. package/es/dev/server.js +101 -25
  40. package/es/rules/check.js +126 -4
  41. package/es/rules/index.d.ts +1 -1
  42. package/es/rules/index.js +1 -1
  43. package/es/rules/manifest.d.ts +23 -9
  44. package/es/rules/manifest.js +60 -35
  45. package/es/rules/node.js +3 -1
  46. package/es/rules/semver.d.ts +5 -0
  47. package/es/rules/semver.js +32 -0
  48. package/es/rules/types.d.ts +29 -6
  49. package/es/rules.json.js +1 -1
  50. package/es/version.d.ts +2 -1
  51. package/es/version.js +5 -1
  52. package/guides/content-development.md +294 -0
  53. package/package.json +4 -2
  54. package/rules.json +113 -5
  55. package/skills/_shared/always.md +9 -0
  56. package/skills/elice-content-check/SKILL.md +22 -0
  57. package/skills/elice-content-create/SKILL.md +21 -0
  58. package/skills/elice-content-migrate/SKILL.md +21 -0
  59. package/skills/elice-content-publish/SKILL.md +22 -0
  60. package/templates/_shared/lib/cdk-mock.d.ts +21 -3
  61. package/templates/_shared/lib/cdk-mock.js +239 -80
  62. package/templates/_shared/lib/cdk.js +2 -2
  63. package/templates/_shared/lib/elice-content.css +206 -0
  64. package/templates/_shared/lib/elice-content.d.ts +112 -5
  65. package/templates/_shared/lib/elice-content.js +660 -62
  66. package/templates/blank/README.md +14 -5
  67. package/templates/blank/commentary.txt +2 -0
  68. package/templates/blank/completion.html +15 -0
  69. package/templates/blank/elice.config.json +3 -5
  70. package/templates/blank/gitignore +1 -0
  71. package/templates/blank/screens/completion.js +7 -0
  72. package/templates/blank/screens/edit.js +3 -0
  73. package/templates/blank/template.json +6 -0
  74. package/templates/quiz/README.md +37 -30
  75. package/templates/quiz/commentary.txt +2 -0
  76. package/templates/quiz/content.json +17 -63
  77. package/templates/quiz/core/behaviors.d.ts +8 -3
  78. package/templates/quiz/core/behaviors.js +15 -2
  79. package/templates/quiz/core/model.d.ts +27 -1
  80. package/templates/quiz/core/model.js +199 -4
  81. package/templates/quiz/elice.config.json +1 -6
  82. package/templates/quiz/gitignore +1 -0
  83. package/templates/quiz/grading.json +1 -10
  84. package/templates/quiz/screens/edit.js +106 -32
  85. package/templates/quiz/screens/learn.js +13 -9
  86. package/templates/quiz/styles.css +84 -24
  87. package/templates/quiz/template.json +6 -0
  88. package/templates/quiz/ui/templates/edit.d.ts +2 -1
  89. package/templates/quiz/ui/templates/edit.js +16 -13
  90. package/templates/quiz/ui/templates/group.js +29 -8
  91. package/templates/quiz/ui/templates/question.js +3 -3
  92. package/templates/quiz/ui/texts.js +53 -29
@@ -0,0 +1,294 @@
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 `elice.config.json` (copied into `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` · `content.json` · code). The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `elice.config.json`. A `grading.json` 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), collect them in `content.json` and let the edit screen change them. Turn it off when there is nothing to edit.
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.0.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 `elice.config.json` (`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 multi-question quiz | `ecdk create <folder>` (quiz template: starts with one single-choice question; the edit screen adds any of the five question types; 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 `elice.config.json` to `{ "kind": "description", "screens": { "learn": "index.html" } }`, delete the instructor and edit 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.
90
+
91
+ Then:
92
+
93
+ 1. Set `screens` in `elice.config.json` to the design (only the screens you keep: `{ "learn": "index.html", "edit": "edit.html", "completionPolicy": "completion.html" }`). Set `completionPolicies` too. Local grading reads `grading.json` (`{ "type": "pattern", "answer_key": "^…$" }`) and the local completion policy `.ecdk/completion.json`; saving in the content edit and completion policy views of `ecdk dev` writes them for you.
94
+ 2. Shape `content.json` as the data in ④.
95
+ 3. Write the screen code ([5](#5-screen-code)). Delete the HTML and JS of screens you do not use.
96
+ 4. Check ([9](#9-check)) → build ([10](#10-build)).
97
+
98
+ ## 4. Rules
99
+
100
+ 1. **Never put correct answers in the content**: not in `content.json`, the screen code, or comments. They reach the student's browser. Answers go in `settings.grading` through the edit screen (the server never sends it to students), and in `grading.json` only for local checks (it is left out of the zip).
101
+ 2. **Screen code calls only `lib/elice-content.js` (the kit).** Do not edit `lib/`. Do not call the SDK (`lib/cdk.js`) directly.
102
+ 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.
103
+ 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.
104
+ 5. **Use relative paths** (`img/a.png`). Paths starting with `/` break. Match file name case. Prefer letters, digits, `-` and `_`.
105
+ 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".
106
+ 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.
107
+ 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).
108
+ 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`.
109
+ 10. Never include keys, tokens or passwords (comments are checked too).
110
+
111
+ ## 5. Screen code
112
+
113
+ ```js
114
+ import { start } from '../lib/elice-content.js';
115
+
116
+ // Student screen
117
+ const app = await start({ screen: 'learn' });
118
+ render(app.content); // what the edit screen saved, or content.json
119
+
120
+ // Only for materials with a submission: say how to collect and restore the answer (result).
121
+ // Locking, restoring and result messages are handled by the kit.
122
+ app.useSubmit({
123
+ getAnswer: () => ({ result: currentResult() }), // small JSON (a few KB at most)
124
+ setAnswer: a => restore(a?.result), // filled on reopen and in tutoring
125
+ validate: a => a.result != null || 'Finish the activity before submitting.',
126
+ onResult: res => showFeedback(res), // grading result (score · isCorrect)
127
+ });
128
+ ```
129
+
130
+ ```js
131
+ // Content edit screen: render the fields and say what to save
132
+ const app = await start({ screen: 'edit' });
133
+ renderForm(app.content);
134
+ app.useSave({
135
+ getContent: () => ({ ...app.content, title: titleInput.value, steps: readSteps() }),
136
+ validate: c => c.title.trim() !== '' || 'Enter a title.',
137
+ });
138
+ ```
139
+
140
+ ```js
141
+ // Edit screen with the grader block: the kit draws LXP's grader radios, the "기준 답안 (정규표현식)" field
142
+ // with "작성 예시 보기", and the "평가 기준" field. useSave saves the content and the grader in one save.
143
+ const grading = app.useGradingBlock();
144
+ app.useSave({ getContent: () => app.content, getGrading: () => grading.getGrading() });
145
+ ```
146
+
147
+ ```js
148
+ // Completion policy screen (screens.completionPolicy): radios for the policies in completionPolicies and the save button.
149
+ // It saves through app.completion.set() → SDK saveCompletionPolicy (PATCH completion_policy), not settings.
150
+ const app = await start({ screen: 'completionPolicy' });
151
+ app.useCompletion();
152
+ ```
153
+
154
+ - `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`).
155
+ - With `on_graded` in `completionPolicies`, the edit screen must save the grading (`completion.no-grading` warns when its code never uses `useGradingBlock` · `getGrading` · `grading:`).
156
+ - 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.
157
+ - Materials without a submission (`on_access`) do not call `useSubmit`.
158
+ - 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.
159
+ - 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.
160
+
161
+ ```js
162
+ app.usePaging({
163
+ count: steps.length,
164
+ // also called once at start. Draw only into `content` (#app by default); the kit keeps its buttons outside it
165
+ onChange: (i, { content }) => content.replaceChildren(renderStep(steps[i])),
166
+ });
167
+ ```
168
+
169
+ 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.
170
+
171
+ - Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
172
+
173
+ ## 6. Using the quiz template
174
+
175
+ - The template starts with **one single-choice question** (`content.json`) and its answer in `grading.json` (`^q1=b$`). Replace it with the requested questions; any of the five types can be added from the edit screen ("문항 추가"). Write the questions into `content.json` and set the answers on the edit screen or in `grading.json` with the same regex rules.
176
+ - 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.
177
+ - 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.
178
+ - Answers: the instructor picks the answer in each question card of the edit screen (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 (`grading.json` holds the same for local checks). 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).
179
+
180
+ ```json
181
+ {
182
+ "type": "pattern",
183
+ "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$"
184
+ }
185
+ ```
186
+
187
+ - 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).
188
+ - Colors, spacing, corners, choice cards: the `--qz-*` variables in `ui/theme.css` (they point at EDS tokens, so `--theme dark` also fits)
189
+ - Text: `ui/texts.js` (tab title, loading, student, instructor, edit, and validation messages)
190
+ - 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.
191
+ - Behavior adds state as attributes: `data-result="correct|wrong"` · `data-dragging` · `data-ghost`. Style them in CSS.
192
+ - 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.
193
+
194
+ 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.
195
+
196
+ ## 7. Move existing HTML
197
+
198
+ 1. Create a skeleton with `ecdk create <new folder> --template blank`.
199
+ 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.
200
+ 3. Download external CDN scripts and fonts into the zip.
201
+ 4. Replace blocked code (storage, `alert`, external sends) as in [4](#4-rules).
202
+ 5. Merge multiple HTML pages into one HTML that switches views.
203
+ 6. Decide completion and grading as in [2 ②](#2-design-the-material). Without grading, pick `on_access` or `on_submit` and write it in `elice.config.json` (`"completionPolicies": ["on_access"]` when there is no submission).
204
+ 7. Remove the instructor, edit and completion policy screens from `screens` and delete their files when they are not needed.
205
+
206
+ ## 8. Fix check errors
207
+
208
+ 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.
209
+
210
+ | id | Fix |
211
+ | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
212
+ | `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file |
213
+ | `ref.root-absolute` | Change `/…` to a relative path |
214
+ | `ref.external-script` · `ref.external-request` | Put the library or font in the zip and use a relative path |
215
+ | `api.storage` · `api.cookie` | Do not use storage. Submit results; save content from the edit screen |
216
+ | `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit` |
217
+ | `api.external-send` | Remove the external send |
218
+ | `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason |
219
+ | `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**) |
220
+ | `manifest.completion-policies-missing` (error) | Add `"completionPolicies": ["on_submit"]` (or the policies you chose, default first) to `elice.config.json` |
221
+ | `completion.no-screen` (warn) | Turn on the completion policy screen (`screens.completionPolicy`), or keep only one policy |
222
+ | `completion.screen-unused` (warn) | One policy is fixed: remove the completion policy screen, or list more policies |
223
+ | `completion.no-edit` (error) | `on_graded` needs an edit screen to set the answers: turn on `screens.edit`, or pick `on_submit` · `on_access` |
224
+ | `completion.no-grading` (warn) | Add `app.useGradingBlock()` to the edit screen and pass `getGrading` to `useSave` |
225
+ | `grading.missing` (warn, project only) | Save the answers in the `ecdk dev` content edit view (writes `grading.json`) |
226
+ | `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 `elice.config.json` |
227
+ | `manifest.*` · `entry.*` | Check `screens` and `kind` in `elice.config.json` |
228
+ | `limit.*` · `file.large-image` | Shrink images and video, drop unused files (build output: "files not referenced anywhere") |
229
+
230
+ 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.
231
+
232
+ ## 9. Check
233
+
234
+ ```bash
235
+ ecdk dev # http://localhost:4170: student, tutoring, instructor, content edit, completion policy (when on); desktop and mobile widths
236
+ ```
237
+
238
+ - 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.
239
+ - Even after your own check, the person looks at the screens before uploading (see [0. What the person decides](#0-what-the-person-decides)).
240
+ - Fix the content console errors and 404s printed in the terminal.
241
+ - Opening files directly with `file://` is not a check.
242
+
243
+ ## 10. Build
244
+
245
+ ```bash
246
+ ecdk build --json
247
+ ```
248
+
249
+ - With `ok: true` the zip is `dist/content.zip`. To make it smaller, set `"minify": true` in `elice.config.json` (quiz template about 122 KB → 87 KB).
250
+ - 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)).
251
+
252
+ ## 11. More
253
+
254
+ - CLI usage: the `@eliceio/cdk-cli` README
255
+ - Command help: `ecdk <command> --help`
256
+
257
+ ## 12. Upload with the material MCP
258
+
259
+ 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`.
260
+
261
+ **Order**
262
+
263
+ | Step | Tool or command | Notes |
264
+ | ------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
265
+ | Build | `ecdk build --json` | `ok: true` required. Use `zip` and `zipBytes` |
266
+ | 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 |
267
+ | 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 |
268
+ | Current version | `get_material` | Keep `current_version.id` (null for a page never saved) |
269
+ | Upload URL | `create_package_upload` (`size_bytes`) | At most 20 MB. Returns `key` and `curl_command` |
270
+ | Upload | the `curl_command`, `package.zip` replaced by the zip path | From a desktop app, run it through a login shell (see Always) |
271
+ | 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 |
272
+ | Approve | — | Show page, title, completion policy, answers saved or not, `preview_urls`. Saving is visible to learners at once when the page is open |
273
+ | Save | `save_draft` (`material_draft_id`, `expected_current_version_id`, `completion_policy`, `grading`) | See below. `MATERIAL_CHANGED`: someone saved after your `get_material`; do not retry blindly, tell the person |
274
+ | 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 |
275
+
276
+ After a successful save, write `.ecdk/link.json` in the project (it is not put in the zip; add `.ecdk/` to `.gitignore`):
277
+
278
+ ```json
279
+ { "org": "trial-cdk-qa5", "lecture_page_id": 129, "version_id": "…" }
280
+ ```
281
+
282
+ 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.
283
+
284
+ **Completion policy and answers**
285
+
286
+ - `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. `on_graded` needs `grading`.
287
+ - `on_graded` needs `grading`: `{ "type": "pattern", "answer_key": "^…$" }` or `{ "type": "rubric", "rubric": "…" }`. Take it from `grading.json` only after the person confirms the answers. The server merges it into `settings.grading` and does not send it to learners. Answers never go into the zip.
288
+ - The quiz template is `on_graded` with a pattern; other materials follow the design (②).
289
+
290
+ **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.
291
+
292
+ **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.
293
+
294
+ **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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliceio/cdk-cli",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "교육자용 Custom HTML 콘텐츠 CLI",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -15,7 +15,9 @@
15
15
  },
16
16
  "files": [
17
17
  "es",
18
+ "guides",
18
19
  "rules.json",
20
+ "skills",
19
21
  "templates"
20
22
  ],
21
23
  "engines": {
@@ -39,7 +41,7 @@
39
41
  "rollup": "^4.0.0",
40
42
  "tslib": "^2.6.1",
41
43
  "typescript": "~5.9.3",
42
- "@eliceio/cdk": "^1.0.0-alpha.1"
44
+ "@eliceio/cdk": "^1.0.0-alpha.3"
43
45
  },
44
46
  "scripts": {
45
47
  "prebuild": "del-cli \"buildcache/*\" \"es/*\" && node ../../scripts/copy-cdk.mjs",
package/rules.json CHANGED
@@ -1,16 +1,17 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.5.0",
3
3
  "manifest": {
4
4
  "file": "metadata.json",
5
5
  "kinds": ["material", "description"],
6
6
  "defaultKind": "material",
7
- "modes": ["learn", "instructor", "edit"],
7
+ "modes": ["learn", "instructor", "edit", "completionPolicy"],
8
8
  "required": ["learn"],
9
9
  "kindModes": {
10
- "material": ["learn", "instructor", "edit"],
10
+ "material": ["learn", "instructor", "edit", "completionPolicy"],
11
11
  "description": ["learn"]
12
12
  },
13
- "gradingTypes": ["on_access", "on_submit", "pattern", "rubric"],
13
+ "completionPolicies": ["on_access", "on_submit", "on_graded"],
14
+ "graderTypes": ["pattern", "rubric"],
14
15
  "commentaryFile": "commentary.txt",
15
16
  "defaultEntry": "index.html"
16
17
  },
@@ -70,7 +71,7 @@
70
71
  "dev": {
71
72
  "level": "error",
72
73
  "files": [],
73
- "dirs": [".git", "node_modules"]
74
+ "dirs": [".git", "node_modules", ".ecdk"]
74
75
  },
75
76
  "junk": {
76
77
  "level": "warn",
@@ -128,6 +129,11 @@
128
129
  "id": "sec.postmessage-wildcard",
129
130
  "pattern": "\\.postMessage\\s*\\([^;]*?,\\s*[\"'`]\\*[\"'`]",
130
131
  "title": "postMessage 대상이 * (아무 창이나 받을 수 있음)"
132
+ },
133
+ {
134
+ "id": "sandbox.fetch-local",
135
+ "pattern": "\\bfetch\\(\\s*(['\"`])(?![a-z][a-z0-9+.-]*:|//)[^'\"`]*(?<!\\.json)\\1|\\bimport\\(\\s*(?!['\"`])[A-Za-z_$]|\\bnew\\s+(?:Shared)?Worker\\(\\s*['\"`](?![a-z][a-z0-9+.-]*:|//)",
136
+ "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음 (LXP sandbox에서 CORS로 막힘)"
131
137
  }
132
138
  ],
133
139
  "secretPatterns": [
@@ -347,6 +353,24 @@
347
353
  "scope": "server",
348
354
  "title": "metadata.json에 적은 파일(진입 파일 · 학습 참고 내용)이 없음"
349
355
  },
356
+ {
357
+ "id": "manifest.commentary-missing",
358
+ "level": "error",
359
+ "scope": "server",
360
+ "title": "학습 참고 내용 파일(commentary.txt) 없음 (LXP 업로드가 거절함)"
361
+ },
362
+ {
363
+ "id": "manifest.grading-types",
364
+ "level": "warn",
365
+ "scope": "server",
366
+ "title": "쓰지 않는 gradingTypes (완료 정책은 completionPolicies · 완료 정책 화면, 채점 방식은 편집 화면)"
367
+ },
368
+ {
369
+ "id": "manifest.completion-policies-missing",
370
+ "level": "error",
371
+ "scope": "server",
372
+ "title": "자료 본문인데 completionPolicies(지원하는 완료 정책)가 없거나 비어 있음"
373
+ },
350
374
  {
351
375
  "id": "entry.missing",
352
376
  "level": "error",
@@ -437,6 +461,78 @@
437
461
  "scope": "client",
438
462
  "title": "1MB 넘는 이미지"
439
463
  },
464
+ {
465
+ "id": "file.encoding",
466
+ "level": "error",
467
+ "scope": "client",
468
+ "title": "UTF-8이 아닌 텍스트 파일 (한글이 깨짐)"
469
+ },
470
+ {
471
+ "id": "file.bom",
472
+ "level": "warn",
473
+ "scope": "client",
474
+ "title": "학습 참고 내용 맨 앞의 BOM (보이지 않는 글자)"
475
+ },
476
+ {
477
+ "id": "content.answer-key",
478
+ "level": "warn",
479
+ "scope": "client",
480
+ "title": "학생에게 내려가는 JSON에 정답처럼 보이는 키"
481
+ },
482
+ {
483
+ "id": "completion.no-submit",
484
+ "level": "warn",
485
+ "scope": "client",
486
+ "title": "제출 · 채점으로 완료하는데 화면 코드에 제출이 없음"
487
+ },
488
+ {
489
+ "id": "edit.no-save",
490
+ "level": "warn",
491
+ "scope": "client",
492
+ "title": "편집 화면인데 저장이 없음"
493
+ },
494
+ {
495
+ "id": "completion.no-save",
496
+ "level": "warn",
497
+ "scope": "client",
498
+ "title": "완료 정책 화면인데 저장(useCompletion · saveCompletionPolicy)이 없음"
499
+ },
500
+ {
501
+ "id": "completion.no-screen",
502
+ "level": "warn",
503
+ "scope": "client",
504
+ "title": "완료 정책이 여럿인데 완료 정책 화면(completionPolicy)이 없어 첫 값만 쓰임"
505
+ },
506
+ {
507
+ "id": "completion.screen-unused",
508
+ "level": "warn",
509
+ "scope": "client",
510
+ "title": "완료 정책이 하나(고정)인데 완료 정책 화면(completionPolicy)이 켜져 있음"
511
+ },
512
+ {
513
+ "id": "completion.no-edit",
514
+ "level": "error",
515
+ "scope": "server",
516
+ "title": "채점(on_graded)으로 완료하는데 채점 방식 · 답을 정할 편집 화면이 없음"
517
+ },
518
+ {
519
+ "id": "completion.no-grading",
520
+ "level": "warn",
521
+ "scope": "client",
522
+ "title": "채점(on_graded)으로 완료하는데 편집 화면 코드가 채점 설정(getGrading · useGradingBlock)을 저장하지 않음"
523
+ },
524
+ {
525
+ "id": "grading.missing",
526
+ "level": "warn",
527
+ "scope": "client",
528
+ "title": "채점(on_graded)으로 완료하는데 프로젝트에 grading.json이 없음 (ecdk dev가 채점을 흉내 내지 못함, 프로젝트 검사만)"
529
+ },
530
+ {
531
+ "id": "build.template-unknown",
532
+ "level": "warn",
533
+ "scope": "client",
534
+ "title": "metadata.json build.template이 이 ecdk가 모르는 템플릿이거나 더 새 템플릿 버전"
535
+ },
440
536
  {
441
537
  "id": "ref.missing",
442
538
  "level": "error",
@@ -473,6 +569,18 @@
473
569
  "scope": "client",
474
570
  "title": "http:// 외부 리소스 (https 페이지에서 막힘)"
475
571
  },
572
+ {
573
+ "id": "sandbox.module-src",
574
+ "level": "error",
575
+ "scope": "client",
576
+ "title": "모듈 스크립트 파일(<script type=\"module\" src>): LXP sandbox에서 CORS로 막혀 화면이 뜨지 않음 (ecdk build가 HTML 안에 묶음)"
577
+ },
578
+ {
579
+ "id": "sandbox.fetch-local",
580
+ "level": "error",
581
+ "scope": "client",
582
+ "title": "zip 안 파일을 fetch · 변수 import() · Worker로 읽음: LXP sandbox에서 CORS로 막힘 (JSON fetch · 문자열 import()는 ecdk build가 처리)"
583
+ },
476
584
  {
477
585
  "id": "html.img-alt",
478
586
  "level": "warn",
@@ -0,0 +1,9 @@
1
+ ## Always
2
+
3
+ - Never put correct answers in the content zip. The edit screen saves them to `settings.grading` (locally `grading.json`).
4
+ - The content runs in a sandboxed iframe on another origin: use the SDK (`app.useSubmit`, `app.useSave`) instead of storage, cookies, `alert`/`confirm`, new windows, the parent window or external requests.
5
+ - If `ecdk`, `node` or `npm` is "command not found", the app started without the person's shell PATH (macOS desktop apps such as Helpy Code Desktop). Run each command through their login shell instead: `"$SHELL" -ilc 'ecdk build --json'` (use `zsh -ilc` when `$SHELL` is empty). With `--json`, read only the last JSON block of the output (a login shell may print other text first). If that also fails, ask the person how Node was installed.
6
+ - Fix every `ecdk check` / `ecdk build` error before you report. Do not edit `lib/` (the SDK kit).
7
+ - Ask the person before you settle correct answers, install anything globally, or upload or save to LXP (a saved version is visible to learners at once).
8
+ - LXP draws its own 이전 · 다음 bar under the material to move between lecture pages. For steps inside a material use the kit's `app.usePaging` (side chevrons, `n / N`; on the first and last step they become "이전 자료" · "다음 자료" to the previous / next lecture page, `ecdk guide 2`), never a look-alike bottom 이전 · 다음 bar.
9
+ - Answer the person in their language. The guide is in English.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: elice-content-check
3
+ description: Find and fix problems in an Elice Custom HTML learning material - ecdk check or ecdk build errors, blocked browser APIs, missing or wrongly cased files, a zip that LXP rejects, or a material that stays on "Loading" or shows nothing in LXP. Use when the person reports an error with an Elice or LXP material or with ecdk.
4
+ ---
5
+
6
+ # Fix an Elice learning material
7
+
8
+ The full guide ships with the CLI: `ecdk guide 8` (fix check errors), `ecdk guide 4` (rules), `ecdk guide 9` (check).
9
+
10
+ {{always}}
11
+
12
+ ## Steps
13
+
14
+ 1. **Reproduce with the CLI.** In the project, `ecdk doctor --json` and `ecdk check --json`. For a zip someone made, `ecdk check <file>.zip --json`. Each issue has an id, a file and a line.
15
+ 2. **Fix by the guide.** Look the id up in `ecdk guide 8`. Fix the cause in the source, not in `dist/`. Do not silence a rule with an `ecdk-ignore` comment unless the guide says so.
16
+ 3. **Problems that show only in LXP.**
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 check dist/content.zip`. Ask the person for the browser console error.
18
+ - Upload rejected: check `ecdk check dist/content.zip`; a material needs `commentary.txt` and every file named in `metadata.json`.
19
+ - Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `grading.json`) and `completionPolicies` (its first value is the default; the completion policy view writes `.ecdk/completion.json`) and that the submitted answer string matches the regex (`ecdk guide 2`, `ecdk guide 6`).
20
+ 4. **Confirm.** `ecdk check` has no errors, `ecdk dev` works, and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
21
+
22
+ {{version}}
@@ -0,0 +1,21 @@
1
+ ---
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, or an ecdk project from scratch.
4
+ ---
5
+
6
+ # Create an Elice learning material
7
+
8
+ The full guide ships with the CLI. Read only the topics you need: `ecdk guide` lists them, `ecdk guide <topic>` prints one (a number such as `ecdk guide 10` works), `ecdk guide all` prints everything.
9
+
10
+ {{always}}
11
+
12
+ ## Steps
13
+
14
+ 1. **Design before code.** Read `ecdk guide 0` (what the person decides) and `ecdk guide 2`. Decide ① what the student does, ② the completion policies and the grading (`on_access` · `on_submit` · `on_graded` with grading `type` `pattern` or `rubric`), written as the required `completionPolicies` in `elice.config.json` with the default first; one policy fixes it, more than one needs a completion policy screen where the instructor picks; the quiz template fixes `["on_graded"]`, so do not ask for a quiz, ③ 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.
15
+ 2. **Environment and project.** `ecdk --version && ecdk doctor --json` (`ecdk guide 1`), then `ecdk create --list` to pick a template and `ecdk create <folder> --template <name>` (`ecdk guide 3`).
16
+ 3. **Write.** Screens and content (`ecdk guide 5`; the quiz template: `ecdk guide 6`). Write `commentary.txt` (key concepts and intent, no answers). Draft correct answers on the edit screen (the quiz: in each question card; saving in the content edit view of `ecdk dev` writes `grading.json`) and let the person confirm them.
17
+ 4. **Check.** `ecdk check`, fix errors (`ecdk guide 8`), then `ecdk dev` and go through the screens (`ecdk guide 9`). The person looks at the screens too.
18
+ 5. **Build and report.** `ecdk build --json` must return `ok: true`. Report as `ecdk guide 10` says.
19
+ 6. **Upload** only after the person approves: the elice-content-publish skill (`ecdk guide 12`), or the person uploads `dist/content.zip` in LXP.
20
+
21
+ {{version}}
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: elice-content-migrate
3
+ description: Move existing HTML, JavaScript or a web demo into an Elice Custom HTML learning material with the ecdk CLI - wrap it in an ecdk project, replace browser features the LXP sandbox blocks, add completion or grading, and build the upload zip. Use when the person has an HTML file, folder or zip they want to run as Elice or LXP learning content.
4
+ ---
5
+
6
+ # Move existing HTML into an Elice learning material
7
+
8
+ The full guide ships with the CLI: `ecdk guide` lists the topics, `ecdk guide <topic>` prints one.
9
+
10
+ {{always}}
11
+
12
+ ## Steps
13
+
14
+ 1. **Read** `ecdk guide 7` (move existing HTML) and `ecdk guide 4` (rules).
15
+ 2. **Look at the original first.** List its entry HTML, the files it loads, and anything the sandbox blocks (storage, cookies, dialogs, `window.open`, the parent window, external requests, absolute `/` paths). Tell the person what will change.
16
+ 3. **Wrap it.** Make or reuse an ecdk project as `ecdk guide 7` says, keep the original files as they are where possible, and write `commentary.txt`.
17
+ 4. **Completion and grading.** Decide how it completes (`ecdk guide 2`) and write the required `completionPolicies` in `elice.config.json`, default first (`["on_access"]` without a submission). When it grades, set the grader and the answers on the edit screen (`app.useGradingBlock()`); list more than one policy and add a completion policy screen only when the instructor should pick the policy. Ask the person for correct answers when it is graded.
18
+ 5. **Check.** `ecdk check`, fix errors (`ecdk guide 8`), `ecdk dev`, compare with the original.
19
+ 6. **Build and report.** `ecdk build --json` returns `ok: true`; report what changed from the original (`ecdk guide 10`).
20
+
21
+ {{version}}
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: elice-content-publish
3
+ description: Upload an Elice Custom HTML learning material to LXP with the elice-material MCP - build the zip with ecdk, pick or create the lecture page, upload, check the draft and save it as a new version after the person approves. Use when the person asks to upload, publish, deploy or update an Elice or LXP material made with ecdk.
4
+ ---
5
+
6
+ # Upload an Elice learning material
7
+
8
+ Read `ecdk guide 12` (upload with the material MCP) first. It has the tool order, arguments and error handling.
9
+
10
+ {{always}}
11
+
12
+ ## Steps
13
+
14
+ 1. **MCP ready?** The `elice-material` tools must be available. If not, ask the person to run `ecdk setup` (QA: `ecdk mcp setup --env qa5`) and log in (Claude Code `/mcp` → elice-material → Authenticate, Helpy Code `⌘ ;`), then stop.
15
+ 2. **Build.** `ecdk build --json` must return `ok: true`. Keep `zip` and `zipBytes`.
16
+ 3. **Pick the page.** Use `.ecdk/link.json` if it exists, or the LXP edit URL the person gives (`https://{org}.…/lecturepages/{id}/edit`). Otherwise list with `list_my_organizations` → `list_courses` → `list_lectures` → `list_custom_pages` and let the person choose. Make a new page with `create_custom_page` only after the person approves.
17
+ 4. **Upload.** `get_material` (keep `current_version.id`) → `create_package_upload` with `size_bytes = zipBytes` → run its `curl_command` with `package.zip` replaced by the zip path → `submit_package` → poll `get_draft` until ready or failed. On failure, report the server's reason with `ecdk check dist/content.zip` and stop.
18
+ 5. **Approve.** Show what changes (page, title, completion policy, whether answers are saved) and the draft `preview_urls`. Saving is visible to learners at once if the page is open. Wait for an explicit yes.
19
+ 6. **Save.** `save_draft` with `expected_current_version_id`, `completion_policy` and, for `on_graded`, the `grading` the person confirmed. On `MATERIAL_CHANGED`, stop: someone saved in between.
20
+ 7. **Finish.** Set the title and icon with `update_material` if the page has none (`ecdk guide 12`). Write `.ecdk/link.json` as `{ "org": …, "lecture_page_id": …, "version_id": … }` so the next upload goes to the same page. Report the LXP URL. New pages stay closed until the person opens them in LXP.
21
+
22
+ {{version}}