@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +288 -200
- package/es/cli.js +70 -66
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +27 -15
- package/es/commands/create/index.d.ts +5 -1
- package/es/commands/create/index.js +34 -15
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +4 -1
- package/es/commands/create/scaffold.js +19 -13
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +5 -5
- package/es/commands/doctor/index.d.ts +29 -2
- package/es/commands/doctor/index.js +253 -55
- 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/validate/index.d.ts +18 -0
- package/es/commands/{check → validate}/index.js +16 -10
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +99 -50
- package/es/core/config.js +244 -91
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +48 -16
- package/es/core/project-check.d.ts +19 -8
- package/es/core/project-check.js +36 -9
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +2 -4
- package/es/core/templates.js +2 -5
- 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 +12 -10
- package/es/dev/mock-api.d.ts +13 -18
- package/es/dev/mock-api.js +56 -66
- package/es/dev/server.js +52 -52
- package/es/rules/check.js +43 -31
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/types.d.ts +18 -20
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/package.json +3 -4
- package/rules.json +27 -43
- package/skills/_shared/always.md +4 -4
- package/skills/elice-content-check/SKILL.md +11 -8
- package/skills/elice-content-create/SKILL.md +8 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +12 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
- package/skills/elice-content-guide/topics/09-check.md +10 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +8 -7
- package/skills/elice-content-publish/SKILL.md +8 -7
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +49 -144
- package/templates/_shared/lib/elice-content.css +68 -1
- package/templates/_shared/lib/elice-content.d.ts +11 -38
- package/templates/_shared/lib/elice-content.js +43 -248
- package/templates/blank/README.md +12 -10
- package/templates/blank/metadata.json +9 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +15 -12
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +21 -10
- package/templates/quiz/core/editor.js +44 -31
- package/templates/quiz/core/model.d.ts +14 -0
- package/templates/quiz/core/model.js +76 -4
- package/templates/quiz/metadata.json +9 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +101 -34
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +45 -36
- package/templates/quiz/styles.css +65 -22
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +65 -19
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/texts.js +11 -11
- package/es/commands/check/index.d.ts +0 -15
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -294
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/completion.html +0 -15
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -10
- package/templates/blank/screens/completion.js +0 -7
- package/templates/quiz/content.json +0 -35
- package/templates/quiz/elice.config.json +0 -9
- package/templates/quiz/grading.json +0 -4
|
@@ -5,6 +5,20 @@ import { html } from '../../core/dom.js';
|
|
|
5
5
|
import { texts } from '../texts.js';
|
|
6
6
|
|
|
7
7
|
const t = texts.edit;
|
|
8
|
+
/** 삭제 아이콘. 요소는 한 자리에만 들어가므로 쓸 때마다 새로 만든다 (색은 버튼 글자색을 따름) */
|
|
9
|
+
const icons = {
|
|
10
|
+
trash: () => html`
|
|
11
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
12
|
+
<path d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />
|
|
13
|
+
</svg>
|
|
14
|
+
`,
|
|
15
|
+
minusCircle: () => html`
|
|
16
|
+
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true">
|
|
17
|
+
<circle cx="12" cy="12" r="9" />
|
|
18
|
+
<path d="M8 12h8" />
|
|
19
|
+
</svg>
|
|
20
|
+
`,
|
|
21
|
+
};
|
|
8
22
|
/** 보기 · 그룹 목록에서 종류마다 다른 문구와 번호 표시 */
|
|
9
23
|
const KIND = {
|
|
10
24
|
option: {
|
|
@@ -29,31 +43,27 @@ const KIND = {
|
|
|
29
43
|
|
|
30
44
|
/**
|
|
31
45
|
* 글 입력 칸. data-role="input" (input · textarea), 있으면 data-role="count" (글자 수)
|
|
32
|
-
*
|
|
46
|
+
* 필수면 "*", 아니면 "선택" (showOptional: false면 표시 없음)
|
|
33
47
|
*/
|
|
34
48
|
export const field = ({
|
|
35
49
|
label,
|
|
36
50
|
required = false,
|
|
51
|
+
showOptional = true,
|
|
37
52
|
hint,
|
|
38
53
|
max,
|
|
39
54
|
multiline = false,
|
|
40
|
-
markdown = false,
|
|
41
55
|
}) => {
|
|
42
56
|
const mark = required
|
|
43
57
|
? html`<b class="qe-required">${t.required}</b>`
|
|
44
|
-
: html`<span class="qe-optional">${t.optional}</span>`;
|
|
45
|
-
const preview =
|
|
46
|
-
markdown &&
|
|
47
|
-
html`<button type="button" class="qe-link" data-role="preview-toggle">${t.preview}</button>`;
|
|
58
|
+
: showOptional && html`<span class="qe-optional">${t.optional}</span>`;
|
|
48
59
|
return html`
|
|
49
60
|
<label class="qe-field">
|
|
50
|
-
<span class="qe-label">${label}${mark}
|
|
61
|
+
<span class="qe-label">${label}${mark}</span>
|
|
51
62
|
${hint && html`<span class="qe-hint">${hint}</span>`}
|
|
52
63
|
${multiline
|
|
53
64
|
? html`<textarea class="qe-input" data-role="input"></textarea>`
|
|
54
65
|
: html`<input class="qe-input" data-role="input" />`}
|
|
55
66
|
${max && html`<span class="qe-count" data-role="count"></span>`}
|
|
56
|
-
${markdown && html`<div class="qe-preview" data-role="preview" hidden></div>`}
|
|
57
67
|
</label>
|
|
58
68
|
`;
|
|
59
69
|
};
|
|
@@ -86,11 +96,41 @@ export const section = ({ label, hint, body }) => html`
|
|
|
86
96
|
/** 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨) */
|
|
87
97
|
export const list = ({ rows, add }) => html`<div class="qe-options">${rows}${add}</div>`;
|
|
88
98
|
|
|
99
|
+
/**
|
|
100
|
+
* 보기 줄의 정답 칸. type: 'radio'(단일) · 'checkbox'(복수) · 'select'(그룹 고르기, choices: [그룹 id, 이름]).
|
|
101
|
+
* name: 문항마다 다른 이름 (같은 문항의 radio끼리 묶임). data-role="answer" (input · select, 값은 동작이 넣음)
|
|
102
|
+
*/
|
|
103
|
+
const answerControl = ({ type, name, choices = [] }, index) =>
|
|
104
|
+
type === 'select'
|
|
105
|
+
? html`
|
|
106
|
+
<select
|
|
107
|
+
class="qe-input qe-answer-group"
|
|
108
|
+
data-role="answer"
|
|
109
|
+
name="${name}"
|
|
110
|
+
aria-label="${t.answerGroup(index + 1)}"
|
|
111
|
+
>
|
|
112
|
+
<option value="">${t.answerNoGroup}</option>
|
|
113
|
+
${choices.map(([value, label]) => html`<option value="${value}">${label}</option>`)}
|
|
114
|
+
</select>
|
|
115
|
+
`
|
|
116
|
+
: html`
|
|
117
|
+
<label class="qe-answer">
|
|
118
|
+
<input
|
|
119
|
+
type="${type}"
|
|
120
|
+
data-role="answer"
|
|
121
|
+
name="${name}"
|
|
122
|
+
aria-label="${t.answerLabel(index + 1)}"
|
|
123
|
+
/>
|
|
124
|
+
<span aria-hidden="true">${t.answer}</span>
|
|
125
|
+
</label>
|
|
126
|
+
`;
|
|
127
|
+
|
|
89
128
|
/**
|
|
90
129
|
* 보기 · 그룹 한 줄. kind: 'option' | 'group' · index: 0부터 · canDelete: 최소 개수보다 많음
|
|
91
|
-
*
|
|
130
|
+
* answer: 있으면 정답 칸 (answerControl, 단일 · 복수 · 그룹 문항의 보기)
|
|
131
|
+
* data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete" · 있으면 data-role="answer"
|
|
92
132
|
*/
|
|
93
|
-
export const row = ({ kind, index, canDelete, min }) => {
|
|
133
|
+
export const row = ({ kind, index, canDelete, min, answer }) => {
|
|
94
134
|
const k = KIND[kind];
|
|
95
135
|
return html`
|
|
96
136
|
<div class="qe-option">
|
|
@@ -103,17 +143,19 @@ export const row = ({ kind, index, canDelete, min }) => {
|
|
|
103
143
|
>
|
|
104
144
|
${t.handle}
|
|
105
145
|
</button>
|
|
146
|
+
${answer && answer.type !== 'select' && answerControl(answer, index)}
|
|
106
147
|
<span class="qe-option-no">${k.marker(index)}</span>
|
|
107
|
-
<input class="qe-input" data-role="input" aria-label="${k.input(index)}" />
|
|
148
|
+
<input class="qe-input qe-option-text" data-role="input" aria-label="${k.input(index)}" />
|
|
149
|
+
${answer && answer.type === 'select' && answerControl(answer, index)}
|
|
108
150
|
<button
|
|
109
151
|
type="button"
|
|
110
|
-
class="
|
|
152
|
+
class="ec-icon-button ec-danger"
|
|
111
153
|
data-role="delete"
|
|
112
154
|
aria-label="${k.remove(index)}"
|
|
113
155
|
title="${canDelete ? '' : k.min(min)}"
|
|
114
156
|
${!canDelete && 'disabled'}
|
|
115
157
|
>
|
|
116
|
-
${
|
|
158
|
+
${icons.minusCircle()}
|
|
117
159
|
</button>
|
|
118
160
|
</div>
|
|
119
161
|
`;
|
|
@@ -134,6 +176,7 @@ export const addButton = ({ kind, full, max }) => html`
|
|
|
134
176
|
/**
|
|
135
177
|
* 문항 카드. body: 문항 칸들 · types: [[값, 이름], …]
|
|
136
178
|
* data-role="type" (유형 select) · data-role="up" · data-role="down" · data-role="delete"
|
|
179
|
+
* 문항이 하나뿐이면 ↑ · ↓는 숨긴다 (옮길 곳이 없음)
|
|
137
180
|
*/
|
|
138
181
|
export const card = ({ q, index, count, types, body }) => html`
|
|
139
182
|
<section class="qe-card">
|
|
@@ -147,31 +190,31 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
147
190
|
</select>
|
|
148
191
|
<button
|
|
149
192
|
type="button"
|
|
150
|
-
class="
|
|
193
|
+
class="ec-icon-button"
|
|
151
194
|
data-role="up"
|
|
152
195
|
aria-label="${t.questionUp(index + 1)}"
|
|
153
196
|
${index === 0 && 'disabled'}
|
|
197
|
+
${count === 1 && 'hidden'}
|
|
154
198
|
>
|
|
155
199
|
${t.up}
|
|
156
200
|
</button>
|
|
157
201
|
<button
|
|
158
202
|
type="button"
|
|
159
|
-
class="
|
|
203
|
+
class="ec-icon-button"
|
|
160
204
|
data-role="down"
|
|
161
205
|
aria-label="${t.questionDown(index + 1)}"
|
|
162
206
|
${index === count - 1 && 'disabled'}
|
|
207
|
+
${count === 1 && 'hidden'}
|
|
163
208
|
>
|
|
164
209
|
${t.down}
|
|
165
210
|
</button>
|
|
166
211
|
<button
|
|
167
212
|
type="button"
|
|
168
|
-
class="
|
|
213
|
+
class="ec-icon-button"
|
|
169
214
|
data-role="delete"
|
|
170
215
|
aria-label="${t.questionDelete(index + 1)}"
|
|
171
|
-
title="${count <= 1 ? t.questionMin : ''}"
|
|
172
|
-
${count <= 1 && 'disabled'}
|
|
173
216
|
>
|
|
174
|
-
${
|
|
217
|
+
${icons.trash()}
|
|
175
218
|
</button>
|
|
176
219
|
</header>
|
|
177
220
|
${body}
|
|
@@ -188,3 +231,6 @@ export const textAnswers = ({ placeholder }) =>
|
|
|
188
231
|
/** 문항 추가 버튼 */
|
|
189
232
|
export const addQuestion = () =>
|
|
190
233
|
html`<button type="button" class="qe-add qe-add-question">${t.addQuestion}</button>`;
|
|
234
|
+
|
|
235
|
+
/** 문항이 이미 있어 "문항 추가" 대신 보이는 안내 (퀴즈 하나에 문항 하나) */
|
|
236
|
+
export const singleQuestion = ({ text }) => html`<p class="qe-hint qe-single-question">${text}</p>`;
|
|
@@ -63,6 +63,14 @@ export const group = {
|
|
|
63
63
|
`,
|
|
64
64
|
/** 보기를 모두 그룹에 놓았을 때 풀에 보이는 안내 */
|
|
65
65
|
poolEmpty: () => html`<p class="qz-empty">${t.groupPoolEmpty}</p>`,
|
|
66
|
-
/** 빈
|
|
67
|
-
boxEmpty: () => html
|
|
66
|
+
/** 빈 그룹: 파일 올리기 칸처럼 점선 상자 + 아이콘 + 안내 */
|
|
67
|
+
boxEmpty: () => html`
|
|
68
|
+
<div class="ec-dropzone">
|
|
69
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
|
|
70
|
+
<path d="M12 4v10M8 10l4 4 4-4M4 16v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2" />
|
|
71
|
+
</svg>
|
|
72
|
+
<p class="ec-dropzone-title">${t.groupEmptyTitle}</p>
|
|
73
|
+
<p>${t.groupEmpty}</p>
|
|
74
|
+
</div>
|
|
75
|
+
`,
|
|
68
76
|
};
|
|
@@ -22,13 +22,13 @@ export const texts = {
|
|
|
22
22
|
/** 편집 화면의 정답 (ADR 0009: 퀴즈는 채점해 통과하면 완료 · 기준 답안 고정, 정답은 문항마다 여기서 고름) */
|
|
23
23
|
answers: {
|
|
24
24
|
intro:
|
|
25
|
-
'정답은 문항마다
|
|
25
|
+
'정답은 문항마다 고릅니다 (객관식 · 그룹 분류는 보기 줄에서, 순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 기준 답안(정규표현식)을 만들어 채점에 씁니다. 학생은 모든 문항을 맞혀야 완료(100점)됩니다. 정답은 학생에게 보이지 않습니다.',
|
|
26
26
|
label: '정답',
|
|
27
27
|
hint: {
|
|
28
|
-
select_one: '정답
|
|
29
|
-
select_multiple: '정답
|
|
28
|
+
select_one: '정답 보기 앞의 "정답"을 고르세요.',
|
|
29
|
+
select_multiple: '정답 보기 앞의 "정답"을 모두 고르세요.',
|
|
30
30
|
order: '정답 순서대로 칸에 놓으세요.',
|
|
31
|
-
group: '
|
|
31
|
+
group: '보기마다 정답 그룹을 고르세요. "그룹 없음"인 보기는 오답 보기입니다.',
|
|
32
32
|
text: '정답으로 인정할 답을 줄마다 하나씩 적으세요. 앞뒤 공백은 무시합니다.',
|
|
33
33
|
},
|
|
34
34
|
textPlaceholder: '예: 가중치\nweight',
|
|
@@ -74,7 +74,8 @@ export const texts = {
|
|
|
74
74
|
groupRemove: '빼기',
|
|
75
75
|
groupRemoveLabel: option => `${option} 빼기`,
|
|
76
76
|
groupPoolEmpty: '모든 보기를 그룹에 배치하였습니다.',
|
|
77
|
-
|
|
77
|
+
groupEmptyTitle: '보기를 여기로 끌어 놓으세요',
|
|
78
|
+
groupEmpty: '또는 보기를 누른 뒤 이곳을 눌러 주세요.',
|
|
78
79
|
},
|
|
79
80
|
|
|
80
81
|
/** 내용 편집 화면 */
|
|
@@ -85,15 +86,13 @@ export const texts = {
|
|
|
85
86
|
optional: ' 선택',
|
|
86
87
|
required: ' *',
|
|
87
88
|
count: (length, max) => `${length} / ${max}`,
|
|
88
|
-
preview: '미리보기',
|
|
89
|
-
previewClose: '미리보기 닫기',
|
|
90
89
|
question: no => `문항 ${no}`,
|
|
91
90
|
questionType: no => `문항 ${no} 유형`,
|
|
92
91
|
questionUp: no => `문항 ${no} 위로`,
|
|
93
92
|
questionDown: no => `문항 ${no} 아래로`,
|
|
94
93
|
questionDelete: no => `문항 ${no} 삭제`,
|
|
95
|
-
questionMin: '문항은 하나 이상이어야 합니다.',
|
|
96
94
|
addQuestion: '+ 문항 추가',
|
|
95
|
+
singleQuestion: '퀴즈 하나에 문항은 하나입니다. 여러 문항은 퀴즈 페이지를 여러 개 만들어 주세요.',
|
|
97
96
|
title: '질문',
|
|
98
97
|
description: '설명',
|
|
99
98
|
options: '보기',
|
|
@@ -109,8 +108,10 @@ export const texts = {
|
|
|
109
108
|
groupsMin: min => `그룹은 ${min}개 이상이어야 합니다.`,
|
|
110
109
|
groupsMax: max => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
|
|
111
110
|
addGroup: '+ 그룹 추가',
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
answer: '정답',
|
|
112
|
+
answerLabel: no => `보기 ${no} 정답`,
|
|
113
|
+
answerGroup: no => `보기 ${no} 정답 그룹`,
|
|
114
|
+
answerNoGroup: '그룹 없음 (오답)',
|
|
114
115
|
slots: '답안 칸 수',
|
|
115
116
|
slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
|
|
116
117
|
placeholder: '입력란 힌트',
|
|
@@ -120,7 +121,6 @@ export const texts = {
|
|
|
120
121
|
explanation: '해설',
|
|
121
122
|
sortLabel: label => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
|
|
122
123
|
sortTitle: '끌어서 순서 바꾸기',
|
|
123
|
-
delete: '×',
|
|
124
124
|
up: '↑',
|
|
125
125
|
down: '↓',
|
|
126
126
|
handle: '⠿',
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CheckResult } from '../../rules/index.js';
|
|
2
|
-
import type { CommandResult } from '../../types.js';
|
|
3
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk check [\uACBD\uB85C] [--json]\n\n \uACBD\uB85C \uD3F4\uB354, .zip, .html (\uAE30\uBCF8\uAC12: \uD604\uC7AC \uD3F4\uB354)\n ecdk \uD504\uB85C\uC81D\uD2B8 \uD3F4\uB354(elice.config.json\uC774 \uC788\uC74C)\uB294 ecdk build\uAC00 \uB9CC\uB4E4 zip \uAE30\uC900\uC73C\uB85C \uAC80\uC0AC\uD55C\uB2E4\n (\uC815\uB2F5 \u00B7 \uC124\uC815 \u00B7 \uAC1C\uBC1C\uC6A9 \uD30C\uC77C\uC744 \uBE7C\uACE0 metadata.json\uC744 \uB9CC\uB4E0 \uB4A4). \uADF8 \uBC16\uC758 \uD3F4\uB354\uB294 \uADF8\uB300\uB85C \uC62C\uB9B4 zip\uC73C\uB85C \uBCF8\uB2E4\n --json \uAE30\uACC4\uC6A9 \uCD9C\uB825 (Claude \uC2A4\uD0AC\u00B7CI)\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uD1B5\uACFC \u00B7 1 \uC624\uB958 \uC788\uC74C \u00B7 2 \uC798\uBABB\uB41C \uC0AC\uC6A9";
|
|
4
|
-
/** 검사 방식: project = build가 만들 zip 기준, path = 주어진 폴더 · zip · html을 그대로 */
|
|
5
|
-
export type CheckMode = 'project' | 'path';
|
|
6
|
-
/** ecdk 프로젝트 폴더인지: elice.config.json이 있거나 package.json이 @eliceio/cdk-cli를 쓴다 */
|
|
7
|
-
export declare function isProjectDir(dir: string): Promise<boolean>;
|
|
8
|
-
/** build와 같은 준비(제외 · metadata.json)를 거친 파일로 검사한다. 모듈 묶기는 build가 하므로 module-src는 보지 않는다 */
|
|
9
|
-
export declare function checkProject(dir: string): Promise<CheckResult>;
|
|
10
|
-
export declare function formatIssues(r: CheckResult): string[];
|
|
11
|
-
export declare function formatText(target: string, r: CheckResult, mode?: CheckMode): string;
|
|
12
|
-
export declare function run(args: {
|
|
13
|
-
target: string;
|
|
14
|
-
json: boolean;
|
|
15
|
-
}): Promise<CommandResult>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CommandResult } from '../../types.js';
|
|
2
|
-
export declare const usage = "\uC0AC\uC6A9\uBC95: ecdk guide [\uC8FC\uC81C] [--json]\n\n \uC5D0\uC774\uC804\uD2B8(Claude \uB4F1)\uAC00 \uD559\uC2B5\uC790\uB8CC\uB97C \uB9CC\uB4E4 \uB54C \uC77D\uB294 \uAC1C\uBC1C \uAC00\uC774\uB4DC(\uC601\uC5B4)\uB97C \uCD9C\uB825\uD55C\uB2E4.\n \uC8FC\uC81C \uC5C6\uC774: \uC8FC\uC81C \uBAA9\uB85D \u00B7 \uC8FC\uC81C: \uADF8 \uC808\uB9CC (\uBC88\uD638\uB098 \uC55E\uBD80\uBD84\uB9CC \uC801\uC5B4\uB3C4 \uB428, \uC608: build \u00B7 10) \u00B7 all: \uC804\uCCB4\n\n\uC885\uB8CC \uCF54\uB4DC: 0 \uC131\uACF5 \u00B7 2 \uC5C6\uB294 \uC8FC\uC81C";
|
|
3
|
-
/** CLI 패키지에 들어 있는 가이드: CLI와 같은 버전이라 명령 · 규칙과 어긋나지 않는다 */
|
|
4
|
-
export declare const GUIDE_FILE: string;
|
|
5
|
-
export interface GuideTopic {
|
|
6
|
-
/** 제목을 소문자 · 하이픈으로 (예: "10. Build" → "10-build") */
|
|
7
|
-
id: string;
|
|
8
|
-
title: string;
|
|
9
|
-
/** 제목 줄을 포함한 절 본문 */
|
|
10
|
-
body: string;
|
|
11
|
-
}
|
|
12
|
-
export interface Guide {
|
|
13
|
-
title: string;
|
|
14
|
-
/** 첫 `##` 앞 (무엇을 만드는지 · 화면 표) */
|
|
15
|
-
intro: string;
|
|
16
|
-
topics: GuideTopic[];
|
|
17
|
-
}
|
|
18
|
-
/** 제목 → 주제 id: 소문자, 글자 · 숫자가 아닌 것이 이어지면 하이픈 하나 */
|
|
19
|
-
export declare function toTopicId(title: string): string;
|
|
20
|
-
/** `##` 절로 나눈다. 코드 블록 안의 `##`는 제목이 아니다 */
|
|
21
|
-
export declare function parseGuide(markdown: string): Guide;
|
|
22
|
-
export declare function loadGuide(file?: string): Guide;
|
|
23
|
-
/** 주제 찾기: id 그대로 → 번호(10) → id 안의 낱말(build) 순. 여럿이면 찾지 못한 것으로 */
|
|
24
|
-
export declare function findTopic(guide: Guide, query: string): GuideTopic | undefined;
|
|
25
|
-
export declare function run(args: {
|
|
26
|
-
topic?: string | undefined;
|
|
27
|
-
json: boolean;
|
|
28
|
-
file?: string;
|
|
29
|
-
}): CommandResult;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { VERSION } from '../../version.js';
|
|
4
|
-
|
|
5
|
-
const usage = `사용법: ecdk guide [주제] [--json]
|
|
6
|
-
|
|
7
|
-
에이전트(Claude 등)가 학습자료를 만들 때 읽는 개발 가이드(영어)를 출력한다.
|
|
8
|
-
주제 없이: 주제 목록 · 주제: 그 절만 (번호나 앞부분만 적어도 됨, 예: build · 10) · all: 전체
|
|
9
|
-
|
|
10
|
-
종료 코드: 0 성공 · 2 없는 주제`;
|
|
11
|
-
/** CLI 패키지에 들어 있는 가이드: CLI와 같은 버전이라 명령 · 규칙과 어긋나지 않는다 */
|
|
12
|
-
const GUIDE_FILE = fileURLToPath(new URL('../../../guides/content-development.md', import.meta.url));
|
|
13
|
-
/** 제목 → 주제 id: 소문자, 글자 · 숫자가 아닌 것이 이어지면 하이픈 하나 */
|
|
14
|
-
function toTopicId(title) {
|
|
15
|
-
return title.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, '-').replace(/^-+|-+$/g, '');
|
|
16
|
-
}
|
|
17
|
-
/** `##` 절로 나눈다. 코드 블록 안의 `##`는 제목이 아니다 */
|
|
18
|
-
function parseGuide(markdown) {
|
|
19
|
-
const title = /^#\s+(.+?)\s*$/m.exec(markdown)?.[1] ?? '';
|
|
20
|
-
const intro = [];
|
|
21
|
-
const topics = [];
|
|
22
|
-
let current = null;
|
|
23
|
-
let fence = null;
|
|
24
|
-
const flush = () => {
|
|
25
|
-
if (current) topics.push({
|
|
26
|
-
id: toTopicId(current.title),
|
|
27
|
-
title: current.title,
|
|
28
|
-
body: current.lines.join('\n').trimEnd()
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
for (const line of markdown.split('\n')) {
|
|
32
|
-
const marker = /^\s*(`{3,}|~{3,})/.exec(line)?.[1];
|
|
33
|
-
if (marker) {
|
|
34
|
-
if (fence === null) fence = marker;else if (marker.startsWith(fence[0] ?? '') && marker.length >= fence.length) fence = null;
|
|
35
|
-
}
|
|
36
|
-
const heading = fence === null ? /^##\s+(.+?)\s*#*\s*$/.exec(line)?.[1] : undefined;
|
|
37
|
-
if (heading) {
|
|
38
|
-
flush();
|
|
39
|
-
current = {
|
|
40
|
-
title: heading,
|
|
41
|
-
lines: [line]
|
|
42
|
-
};
|
|
43
|
-
} else if (current) current.lines.push(line);else if (!/^#\s/.test(line)) intro.push(line);
|
|
44
|
-
}
|
|
45
|
-
flush();
|
|
46
|
-
return {
|
|
47
|
-
title,
|
|
48
|
-
intro: intro.join('\n').trim(),
|
|
49
|
-
topics
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function loadGuide(file = GUIDE_FILE) {
|
|
53
|
-
return parseGuide(readFileSync(file, 'utf8'));
|
|
54
|
-
}
|
|
55
|
-
/** 주제 찾기: id 그대로 → 번호(10) → id 안의 낱말(build) 순. 여럿이면 찾지 못한 것으로 */
|
|
56
|
-
function findTopic(guide, query) {
|
|
57
|
-
const q = toTopicId(query);
|
|
58
|
-
if (!q) return undefined;
|
|
59
|
-
const exact = guide.topics.find(t => t.id === q);
|
|
60
|
-
if (exact) return exact;
|
|
61
|
-
const byNumber = guide.topics.find(t => t.id.startsWith(`${q}-`) && /^\d+$/.test(q));
|
|
62
|
-
if (byNumber) return byNumber;
|
|
63
|
-
// 번호 없이 적은 id (예: what-the-person-decides → 0-what-the-person-decides)
|
|
64
|
-
const byName = guide.topics.find(t => t.id.replace(/^\d+-/, '') === q);
|
|
65
|
-
if (byName) return byName;
|
|
66
|
-
const partial = guide.topics.filter(t => t.id.split('-').some(word => word === q) || t.id.startsWith(q));
|
|
67
|
-
return partial.length === 1 ? partial[0] : undefined;
|
|
68
|
-
}
|
|
69
|
-
function list(guide) {
|
|
70
|
-
return [`# ${guide.title} (ecdk ${VERSION})`, '', guide.intro, '', 'Topics (read one with `ecdk guide <topic>`, everything with `ecdk guide all`):', ...guide.topics.map(t => `- ${t.id}: ${t.title}`)].join('\n');
|
|
71
|
-
}
|
|
72
|
-
function run(args) {
|
|
73
|
-
const guide = loadGuide(args.file);
|
|
74
|
-
const topics = guide.topics.map(({
|
|
75
|
-
id,
|
|
76
|
-
title
|
|
77
|
-
}) => ({
|
|
78
|
-
id,
|
|
79
|
-
title
|
|
80
|
-
}));
|
|
81
|
-
if (args.topic === undefined) {
|
|
82
|
-
return {
|
|
83
|
-
exitCode: 0,
|
|
84
|
-
output: args.json ? JSON.stringify({
|
|
85
|
-
title: guide.title,
|
|
86
|
-
version: VERSION,
|
|
87
|
-
intro: guide.intro,
|
|
88
|
-
topics
|
|
89
|
-
}, null, 2) : list(guide)
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (args.topic === 'all') {
|
|
93
|
-
const text = readFileSync(args.file ?? GUIDE_FILE, 'utf8');
|
|
94
|
-
return {
|
|
95
|
-
exitCode: 0,
|
|
96
|
-
output: args.json ? JSON.stringify({
|
|
97
|
-
title: guide.title,
|
|
98
|
-
version: VERSION,
|
|
99
|
-
markdown: text
|
|
100
|
-
}, null, 2) : text
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const topic = findTopic(guide, args.topic);
|
|
104
|
-
if (!topic) {
|
|
105
|
-
const message = `없는 주제입니다: ${args.topic}`;
|
|
106
|
-
return {
|
|
107
|
-
exitCode: 2,
|
|
108
|
-
output: args.json ? JSON.stringify({
|
|
109
|
-
error: message,
|
|
110
|
-
topics
|
|
111
|
-
}, null, 2) : `${message}\n\n${topics.map(t => `- ${t.id}: ${t.title}`).join('\n')}`
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
exitCode: 0,
|
|
116
|
-
output: args.json ? JSON.stringify(topic, null, 2) : topic.body
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export { GUIDE_FILE, findTopic, loadGuide, parseGuide, run, toTopicId, usage };
|