@eliceio/cdk-cli 0.0.0-stage → 0.1.0-alpha.2

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 (141) hide show
  1. package/README.md +526 -2
  2. package/es/bin/index.d.ts +2 -0
  3. package/es/bin/index.js +10 -0
  4. package/es/cli.d.ts +5 -0
  5. package/es/cli.js +209 -0
  6. package/es/commands/build/index.d.ts +30 -0
  7. package/es/commands/build/index.js +163 -0
  8. package/es/commands/check/index.d.ts +9 -0
  9. package/es/commands/check/index.js +31 -0
  10. package/es/commands/create/index.d.ts +8 -0
  11. package/es/commands/create/index.js +22 -0
  12. package/es/commands/create/scaffold.d.ts +24 -0
  13. package/es/commands/create/scaffold.js +82 -0
  14. package/es/commands/dev/index.d.ts +6 -0
  15. package/es/commands/dev/index.js +40 -0
  16. package/es/commands/doctor/index.d.ts +34 -0
  17. package/es/commands/doctor/index.js +311 -0
  18. package/es/commands/guide/index.d.ts +29 -0
  19. package/es/commands/guide/index.js +120 -0
  20. package/es/commands/skill/index.d.ts +48 -0
  21. package/es/commands/skill/index.js +173 -0
  22. package/es/core/collect.d.ts +21 -0
  23. package/es/core/collect.js +89 -0
  24. package/es/core/config.d.ts +55 -0
  25. package/es/core/config.js +109 -0
  26. package/es/core/manifest.d.ts +15 -0
  27. package/es/core/manifest.js +43 -0
  28. package/es/core/minify.d.ts +18 -0
  29. package/es/core/minify.js +93 -0
  30. package/es/core/prepare.d.ts +12 -0
  31. package/es/core/prepare.js +86 -0
  32. package/es/core/protocol.d.ts +2 -0
  33. package/es/core/protocol.js +4 -0
  34. package/es/core/sandbox.d.ts +17 -0
  35. package/es/core/sandbox.js +182 -0
  36. package/es/core/zip.d.ts +4 -0
  37. package/es/core/zip.js +17 -0
  38. package/es/dev/grading.d.ts +15 -0
  39. package/es/dev/grading.js +37 -0
  40. package/es/dev/host-page.d.ts +7 -0
  41. package/es/dev/host-page.js +240 -0
  42. package/es/dev/inject.d.ts +8 -0
  43. package/es/dev/inject.js +38 -0
  44. package/es/dev/mock-api.d.ts +65 -0
  45. package/es/dev/mock-api.js +269 -0
  46. package/es/dev/server.d.ts +25 -0
  47. package/es/dev/server.js +309 -0
  48. package/es/engines/static/index.d.ts +3 -0
  49. package/es/engines/static/index.js +11 -0
  50. package/es/engines/types.d.ts +12 -0
  51. package/es/engines/vite/index.d.ts +2 -0
  52. package/es/engines/vite/index.js +4 -0
  53. package/es/index.d.ts +2 -0
  54. package/es/index.js +2 -0
  55. package/es/rules/check.d.ts +2 -0
  56. package/es/rules/check.js +282 -0
  57. package/es/rules/index.d.ts +8 -0
  58. package/es/rules/index.js +7 -0
  59. package/es/rules/manifest.d.ts +39 -0
  60. package/es/rules/manifest.js +168 -0
  61. package/es/rules/node.d.ts +11 -0
  62. package/es/rules/node.js +87 -0
  63. package/es/rules/path.d.ts +7 -0
  64. package/es/rules/path.js +35 -0
  65. package/es/rules/refs.d.ts +19 -0
  66. package/es/rules/refs.js +111 -0
  67. package/es/rules/skip.d.ts +12 -0
  68. package/es/rules/skip.js +55 -0
  69. package/es/rules/spec.d.ts +3 -0
  70. package/es/rules/spec.js +6 -0
  71. package/es/rules/types.d.ts +140 -0
  72. package/es/rules/unused.d.ts +7 -0
  73. package/es/rules/unused.js +21 -0
  74. package/es/rules/zip.d.ts +13 -0
  75. package/es/rules/zip.js +45 -0
  76. package/es/rules.json.js +3 -0
  77. package/es/types.d.ts +4 -0
  78. package/es/version.d.ts +2 -0
  79. package/es/version.js +7 -0
  80. package/guides/content-development.md +207 -0
  81. package/package.json +50 -3
  82. package/rules.json +608 -0
  83. package/skills/_shared/always.md +7 -0
  84. package/skills/elice-content-check/SKILL.md +22 -0
  85. package/skills/elice-content-create/SKILL.md +21 -0
  86. package/skills/elice-content-migrate/SKILL.md +21 -0
  87. package/templates/_shared/lib/cdk-mock.d.ts +94 -0
  88. package/templates/_shared/lib/cdk-mock.js +429 -0
  89. package/templates/_shared/lib/cdk.js +3 -0
  90. package/templates/_shared/lib/elice-content.css +262 -0
  91. package/templates/_shared/lib/elice-content.d.ts +123 -0
  92. package/templates/_shared/lib/elice-content.js +534 -0
  93. package/templates/_shared/lib/elice-tokens.css +446 -0
  94. package/templates/blank/README.md +64 -0
  95. package/templates/blank/commentary.txt +2 -0
  96. package/templates/blank/content.json +4 -0
  97. package/templates/blank/edit.html +15 -0
  98. package/templates/blank/elice.config.json +12 -0
  99. package/templates/blank/gitignore +3 -0
  100. package/templates/blank/index.html +15 -0
  101. package/templates/blank/instructor.html +15 -0
  102. package/templates/blank/screens/edit.js +21 -0
  103. package/templates/blank/screens/instructor.js +9 -0
  104. package/templates/blank/screens/learn.js +19 -0
  105. package/templates/blank/styles.css +1 -0
  106. package/templates/quiz/README.md +108 -0
  107. package/templates/quiz/commentary.txt +2 -0
  108. package/templates/quiz/content.json +81 -0
  109. package/templates/quiz/core/behaviors.d.ts +59 -0
  110. package/templates/quiz/core/behaviors.js +310 -0
  111. package/templates/quiz/core/dom.d.ts +13 -0
  112. package/templates/quiz/core/dom.js +83 -0
  113. package/templates/quiz/core/editor.d.ts +48 -0
  114. package/templates/quiz/core/editor.js +206 -0
  115. package/templates/quiz/core/markdown.d.ts +2 -0
  116. package/templates/quiz/core/markdown.js +84 -0
  117. package/templates/quiz/core/model.d.ts +20 -0
  118. package/templates/quiz/core/model.js +203 -0
  119. package/templates/quiz/edit.html +17 -0
  120. package/templates/quiz/elice.config.json +14 -0
  121. package/templates/quiz/gitignore +3 -0
  122. package/templates/quiz/grading.json +13 -0
  123. package/templates/quiz/index.html +17 -0
  124. package/templates/quiz/instructor.html +17 -0
  125. package/templates/quiz/screens/edit.js +139 -0
  126. package/templates/quiz/screens/instructor.js +27 -0
  127. package/templates/quiz/screens/learn.js +55 -0
  128. package/templates/quiz/styles.css +570 -0
  129. package/templates/quiz/ui/templates/choice.js +22 -0
  130. package/templates/quiz/ui/templates/edit.d.ts +13 -0
  131. package/templates/quiz/ui/templates/edit.js +183 -0
  132. package/templates/quiz/ui/templates/group.js +68 -0
  133. package/templates/quiz/ui/templates/index.d.ts +5 -0
  134. package/templates/quiz/ui/templates/index.js +17 -0
  135. package/templates/quiz/ui/templates/order.js +35 -0
  136. package/templates/quiz/ui/templates/page.js +29 -0
  137. package/templates/quiz/ui/templates/question.js +28 -0
  138. package/templates/quiz/ui/templates/text.js +16 -0
  139. package/templates/quiz/ui/texts.d.ts +3 -0
  140. package/templates/quiz/ui/texts.js +127 -0
  141. package/templates/quiz/ui/theme.css +50 -0
@@ -0,0 +1,262 @@
1
+ /* Elice Content 기본 스타일 · 템플릿이 제공 (고치지 말고 styles.css에서 덮어쓰세요)
2
+ 색 · 글꼴 · 크기는 Elice Design System 토큰(lib/elice-tokens.css)을 씁니다.
3
+ 컴포넌트 값은 EDS 명세(specs/components)를 따릅니다: Button · OutlinedInput · Tag · Alert */
4
+ :root {
5
+ --ec-bg: var(--eds-background-default);
6
+ --ec-surface: var(--eds-background-neutral);
7
+ --ec-fg: var(--eds-text-primary);
8
+ --ec-muted: var(--eds-text-secondary);
9
+ --ec-line: var(--eds-divider);
10
+ --ec-border: var(--eds-surface-border);
11
+ --ec-accent: var(--eds-primary-main);
12
+ --ec-accent-dark: var(--eds-primary-dark);
13
+ --ec-accent-bg: var(--eds-primary-opacity02);
14
+ --ec-ok: var(--eds-success-main);
15
+ --ec-ok-bg: var(--eds-success-background);
16
+ --ec-no: var(--eds-error-main);
17
+ --ec-no-bg: var(--eds-error-background);
18
+ --ec-warn-bg: var(--eds-warning-background);
19
+ --ec-info: var(--eds-info-dark);
20
+ --ec-info-bg: var(--eds-info-background);
21
+ --ec-radius: var(--eds-radius);
22
+ /* 떠 있는 요소(끄는 보기 등). 그림자는 두 테마 모두 검정 */
23
+ --ec-shadow: 0 8px 24px rgb(0 0 0 / 0.16);
24
+ font-family: var(--eds-font-family);
25
+ font-size: var(--eds-fs-body2);
26
+ font-weight: var(--eds-fw-medium);
27
+ color: var(--ec-fg);
28
+ background: var(--ec-bg);
29
+ }
30
+ /* 어두운 테마(<html data-eds-theme="dark">, ecdk create --theme dark): 색은 elice-tokens.css가 바꾸고,
31
+ 여기서는 체크박스 · 선택 상자 · 스크롤바 같은 브라우저 기본 요소도 어둡게 */
32
+ :root[data-eds-theme='dark'] {
33
+ color-scheme: dark;
34
+ --ec-shadow: 0 8px 24px rgb(0 0 0 / 0.48);
35
+ }
36
+ * {
37
+ box-sizing: border-box;
38
+ }
39
+ body {
40
+ margin: 0;
41
+ padding: 24px 16px 96px;
42
+ line-height: var(--eds-lh-body2);
43
+ }
44
+ main {
45
+ max-width: 720px;
46
+ margin: 0 auto;
47
+ display: flex;
48
+ flex-direction: column;
49
+ gap: 20px;
50
+ }
51
+ /* EDS h6: 24px / 800 / 1.3 / -1% */
52
+ h1 {
53
+ font-size: var(--eds-fs-h6);
54
+ line-height: var(--eds-lh-h6);
55
+ font-weight: var(--eds-fw-extrabold);
56
+ letter-spacing: -0.01em;
57
+ margin: 0;
58
+ }
59
+ p {
60
+ margin: 0;
61
+ }
62
+ .ec-muted {
63
+ color: var(--ec-muted);
64
+ font-size: var(--eds-fs-body2);
65
+ }
66
+ .ec-card {
67
+ border: 1px solid var(--ec-border);
68
+ border-radius: var(--ec-radius);
69
+ padding: 16px;
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 10px;
73
+ }
74
+ /* EDS Tag (muted · primary · medium): 높이 24px, 모서리 6px, 11px / 700 */
75
+ .ec-badge {
76
+ align-self: flex-start;
77
+ display: inline-flex;
78
+ align-items: center;
79
+ height: 24px;
80
+ padding: 0 6px;
81
+ border-radius: 6px;
82
+ font-size: 11px;
83
+ font-weight: var(--eds-fw-bold);
84
+ background: var(--ec-accent-bg);
85
+ color: var(--ec-accent);
86
+ }
87
+ /* EDS OutlinedInput: 배경 background.input, 테두리 surface.border, small 여백 8px 12px.
88
+ 모바일 규칙(디자인 제작 가이드 "4. 모바일"): 입력 글자 16px */
89
+ input,
90
+ textarea,
91
+ select {
92
+ font: inherit;
93
+ font-size: 16px;
94
+ padding: 8px 12px;
95
+ border: 1px solid var(--ec-border);
96
+ border-radius: var(--ec-radius);
97
+ background: var(--eds-background-input);
98
+ color: var(--ec-fg);
99
+ width: 100%;
100
+ }
101
+ /* 선택 상자: 브라우저 기본 화살표는 테두리에 붙어 보여서, 오른쪽에서 12px 띄운 화살표를 직접 그린다 (EDS Select).
102
+ 두 삼각형 그라데이션으로 그려 글자색 토큰을 따르므로 어두운 테마에서도 보인다 */
103
+ select {
104
+ appearance: none;
105
+ padding-right: 36px;
106
+ background-image:
107
+ linear-gradient(45deg, transparent 50%, var(--eds-text-secondary) 50%),
108
+ linear-gradient(135deg, var(--eds-text-secondary) 50%, transparent 50%);
109
+ background-position:
110
+ right 17px center,
111
+ right 12px center;
112
+ background-size: 5px 5px;
113
+ background-repeat: no-repeat;
114
+ cursor: pointer;
115
+ }
116
+ input:focus,
117
+ textarea:focus,
118
+ select:focus {
119
+ outline: 2px solid var(--ec-accent);
120
+ outline-offset: -1px;
121
+ }
122
+ /* EDS Button medium: 14px / 600, 여백 8px 16px, 줄높이 24px, 모서리 8px, 대문자 변환 없음.
123
+ 기본은 outlined(primary), .ec-primary는 contained. 누르는 영역 44px 이상(모바일 규칙) */
124
+ button {
125
+ font: inherit;
126
+ font-size: 14px;
127
+ font-weight: var(--eds-fw-semibold);
128
+ line-height: 24px;
129
+ min-height: 44px;
130
+ padding: 7px 15px;
131
+ border-radius: var(--ec-radius);
132
+ border: 1px solid var(--ec-accent);
133
+ background: transparent;
134
+ color: var(--ec-accent);
135
+ white-space: nowrap;
136
+ cursor: pointer;
137
+ transition: background-color 150ms ease-in-out;
138
+ }
139
+ button:hover {
140
+ background: var(--eds-primary-opacity01);
141
+ }
142
+ button.ec-primary {
143
+ padding: 8px 16px;
144
+ border: 0;
145
+ background: var(--ec-accent);
146
+ color: var(--eds-primary-contrast-text);
147
+ }
148
+ button.ec-primary:hover {
149
+ background: var(--ec-accent-dark);
150
+ }
151
+ button:disabled {
152
+ border-color: var(--eds-action-disabled-background);
153
+ background: var(--eds-action-disabled-background);
154
+ color: var(--eds-action-disabled);
155
+ cursor: not-allowed;
156
+ }
157
+ .ec-option {
158
+ display: flex;
159
+ align-items: center;
160
+ gap: 10px;
161
+ min-height: 44px;
162
+ padding: 8px 12px;
163
+ border: 1px solid var(--ec-border);
164
+ border-radius: var(--ec-radius);
165
+ }
166
+ .ec-option input {
167
+ width: auto;
168
+ }
169
+ .ec-row {
170
+ display: flex;
171
+ gap: 8px;
172
+ align-items: center;
173
+ flex-wrap: wrap;
174
+ }
175
+ .ec-col {
176
+ display: flex;
177
+ flex-direction: column;
178
+ gap: 12px;
179
+ }
180
+ /* EDS Alert(standard) 색: success · error · info background */
181
+ .ec-result {
182
+ padding: 12px 16px;
183
+ border-radius: var(--ec-radius);
184
+ background: var(--ec-info-bg);
185
+ color: var(--ec-info);
186
+ font-weight: var(--eds-fw-semibold);
187
+ }
188
+ .ec-result.ok {
189
+ background: var(--ec-ok-bg);
190
+ color: var(--ec-ok);
191
+ }
192
+ .ec-result.no {
193
+ background: var(--ec-no-bg);
194
+ color: var(--ec-no);
195
+ }
196
+ .ec-error {
197
+ color: var(--ec-no);
198
+ font-size: var(--eds-fs-body2);
199
+ }
200
+ /* 제출 바: 모바일에서 화면 아래 고정, EDS Button large(48px, 모서리 10px) */
201
+ .ec-submitbar {
202
+ position: sticky;
203
+ bottom: 0;
204
+ background: var(--ec-bg);
205
+ padding: 12px 0;
206
+ border-top: 1px solid var(--ec-line);
207
+ display: flex;
208
+ gap: 12px;
209
+ align-items: center;
210
+ justify-content: flex-end;
211
+ }
212
+ @media (max-width: 511.98px) {
213
+ .ec-submitbar button {
214
+ flex: 1;
215
+ height: 48px;
216
+ font-size: 15px;
217
+ font-weight: var(--eds-fw-bold);
218
+ border-radius: 10px;
219
+ }
220
+ }
221
+ #elice-banner {
222
+ position: sticky;
223
+ top: 0;
224
+ z-index: 10;
225
+ background: var(--ec-warn-bg);
226
+ color: var(--eds-warning-dark);
227
+ padding: 10px 16px;
228
+ margin: -24px -16px 16px;
229
+ font-size: var(--eds-fs-body2);
230
+ }
231
+ #elice-status {
232
+ position: sticky;
233
+ top: 0;
234
+ z-index: 9;
235
+ background: var(--ec-accent-bg);
236
+ color: var(--ec-accent);
237
+ padding: 8px 16px;
238
+ margin: -24px -16px 16px;
239
+ font-size: var(--eds-fs-caption);
240
+ font-weight: var(--eds-fw-semibold);
241
+ }
242
+ /* 데스크톱(512px 이상): 제출 바가 아래에 붙지 않으니 아래 여백을 줄이고, 마지막 카드와 제출 바를 띄운다.
243
+ 모바일은 제출 바가 화면 아래 고정이라 아래 여백 96px 그대로 */
244
+ @media (min-width: 512px) {
245
+ body {
246
+ padding-bottom: 24px;
247
+ }
248
+ .ec-submitbar {
249
+ margin-top: 16px;
250
+ }
251
+ }
252
+ [aria-readonly='true'] {
253
+ opacity: 0.85;
254
+ }
255
+ .ec-submitbar,
256
+ .ec-result {
257
+ max-width: 720px;
258
+ margin-inline: auto;
259
+ }
260
+ [hidden] {
261
+ display: none !important;
262
+ }
@@ -0,0 +1,123 @@
1
+ // 편집기 자동완성용 타입. lib/elice-content.js와 같이 고치지 않습니다.
2
+
3
+ export type Screen = 'learn' | 'instructor' | 'edit';
4
+ export type Scope = 'learn' | 'edit';
5
+ export type Viewer = 'student' | 'instructor' | 'tutor';
6
+
7
+ export declare class ContentError extends Error {
8
+ code: string;
9
+ constructor(code: string, message: string, cause?: unknown);
10
+ }
11
+
12
+ export declare const LOCAL_MATERIAL_PATH: string;
13
+
14
+ export declare function pickSdk(where: {
15
+ hash: string;
16
+ pathname: string;
17
+ search: string;
18
+ /** 로컬(localhost · 127.0.0.1)이면 자료 주소라도 토큰 없이 mock */
19
+ hostname?: string;
20
+ }): 'real' | 'mock';
21
+
22
+ export declare function resolveLaunch(
23
+ hash: string,
24
+ pathname: string,
25
+ screen: Screen,
26
+ ): { hash: string; pathname: string; local: boolean };
27
+
28
+ /** 서버 채점 결과. 점수 없는 채점(manual · none)이면 둘 다 null */
29
+ export interface SubmitResult {
30
+ isCorrect: boolean | null;
31
+ score: number | null;
32
+ }
33
+
34
+ export interface Navigation {
35
+ previous(): void;
36
+ next(): void;
37
+ navigate(lecturePageId: number): void;
38
+ getHasPrevious(): Promise<boolean>;
39
+ getHasNext(): Promise<boolean>;
40
+ }
41
+
42
+ export interface SubmitOptions<A = unknown> {
43
+ getAnswer: () => A;
44
+ setAnswer?: (answer: A) => void;
45
+ validate?: (answer: A) => true | string | false;
46
+ /** 채점 결과 (제출 직후 · 다시 열었을 때) */
47
+ onResult?: (result: SubmitResult & { answer?: A }, info: { restored: boolean }) => void;
48
+ root?: Element;
49
+ label?: string;
50
+ }
51
+
52
+ export interface SaveOptions<C> {
53
+ getContent: () => C;
54
+ validate?: (content: C) => true | string | false;
55
+ root?: Element;
56
+ label?: string;
57
+ }
58
+
59
+ /** 화면 맨 위 안내 한 줄. mock SDK일 때만 글자가 있고, 플랫폼(real)에서는 늘 '' */
60
+ export declare function statusText(app: ContentApp): string;
61
+
62
+ export interface ContentApp<C = Record<string, unknown>> {
63
+ screen: Screen;
64
+ scope: Scope;
65
+ viewer: Viewer;
66
+ readOnly: boolean;
67
+ isDraft: boolean;
68
+ navigation: Navigation | null;
69
+ isLocal: boolean;
70
+ sdkKind: 'real' | 'mock' | 'custom';
71
+ account: { anonymousId: string; fullname: string | null } | null;
72
+ result: { score: number | null; submitCount: number; completedAt: string | null } | null;
73
+ readonly records: boolean;
74
+ readonly content: C;
75
+ submit(answer: unknown): Promise<SubmitResult>;
76
+ lastAnswer(): Promise<unknown>;
77
+ lastSubmission(): Promise<
78
+ (SubmitResult & { id: string; answer: unknown; createdAt: string }) | null
79
+ >;
80
+ saveContent(content: C): Promise<void>;
81
+ /** 학생 화면 제출 영역 (보는 사람별 처리는 키트가) */
82
+ useSubmit<A = unknown>(
83
+ options: SubmitOptions<A>,
84
+ ): { element: Element; result: Element; restored: Promise<void> };
85
+ /** 편집 화면 저장 영역 */
86
+ useSave(options: SaveOptions<C>): {
87
+ element: Element;
88
+ markDirty(): void;
89
+ readonly dirty: boolean;
90
+ };
91
+ }
92
+
93
+ export interface StartOptions {
94
+ screen: Screen;
95
+ defaults?: string;
96
+ onError?: (error: ContentError) => void;
97
+ sdk?: 'real' | 'mock' | object;
98
+ mock?: {
99
+ scenario?:
100
+ | 'session_expired'
101
+ | 'rate_limited'
102
+ | 'request_failed'
103
+ | 'external_service_error'
104
+ | 'slow'
105
+ | 'content_not_ready'
106
+ | 'unauthorized';
107
+ grading?: unknown;
108
+ settings?: Record<string, unknown>;
109
+ delayMs?: number;
110
+ };
111
+ loadJson?: (url: string) => Promise<unknown>;
112
+ hash?: string;
113
+ pathname?: string;
114
+ search?: string;
115
+ /** 테스트용: location.hostname 대신 */
116
+ hostname?: string;
117
+ /** mock SDK일 때 화면 맨 위 안내 줄 (기본 true). 플랫폼에서는 늘 없음 */
118
+ status?: boolean;
119
+ }
120
+
121
+ export declare function start<C = Record<string, unknown>>(
122
+ options: StartOptions,
123
+ ): Promise<ContentApp<C>>;