@mo7yw4ng/openape 1.0.5 → 2.0.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 (152) hide show
  1. package/bin/openape +29 -0
  2. package/bin/openape.js +29 -0
  3. package/package.json +22 -28
  4. package/LICENSE +0 -21
  5. package/README.md +0 -135
  6. package/esm/_dnt.polyfills.d.ts +0 -101
  7. package/esm/_dnt.polyfills.d.ts.map +0 -1
  8. package/esm/_dnt.polyfills.js +0 -127
  9. package/esm/_dnt.shims.d.ts +0 -6
  10. package/esm/_dnt.shims.d.ts.map +0 -1
  11. package/esm/_dnt.shims.js +0 -61
  12. package/esm/deno.d.ts +0 -25
  13. package/esm/deno.d.ts.map +0 -1
  14. package/esm/deno.js +0 -23
  15. package/esm/package.json +0 -3
  16. package/esm/src/commands/announcements.d.ts +0 -3
  17. package/esm/src/commands/announcements.d.ts.map +0 -1
  18. package/esm/src/commands/announcements.js +0 -134
  19. package/esm/src/commands/assignments.d.ts +0 -3
  20. package/esm/src/commands/assignments.d.ts.map +0 -1
  21. package/esm/src/commands/assignments.js +0 -230
  22. package/esm/src/commands/auth.d.ts +0 -3
  23. package/esm/src/commands/auth.d.ts.map +0 -1
  24. package/esm/src/commands/auth.js +0 -290
  25. package/esm/src/commands/calendar.d.ts +0 -3
  26. package/esm/src/commands/calendar.d.ts.map +0 -1
  27. package/esm/src/commands/calendar.js +0 -179
  28. package/esm/src/commands/courses.d.ts +0 -3
  29. package/esm/src/commands/courses.d.ts.map +0 -1
  30. package/esm/src/commands/courses.js +0 -348
  31. package/esm/src/commands/forums.d.ts +0 -3
  32. package/esm/src/commands/forums.d.ts.map +0 -1
  33. package/esm/src/commands/forums.js +0 -318
  34. package/esm/src/commands/grades.d.ts +0 -3
  35. package/esm/src/commands/grades.d.ts.map +0 -1
  36. package/esm/src/commands/grades.js +0 -121
  37. package/esm/src/commands/materials.d.ts +0 -3
  38. package/esm/src/commands/materials.d.ts.map +0 -1
  39. package/esm/src/commands/materials.js +0 -413
  40. package/esm/src/commands/quizzes.d.ts +0 -3
  41. package/esm/src/commands/quizzes.d.ts.map +0 -1
  42. package/esm/src/commands/quizzes.js +0 -271
  43. package/esm/src/commands/skills.d.ts +0 -3
  44. package/esm/src/commands/skills.d.ts.map +0 -1
  45. package/esm/src/commands/skills.js +0 -106
  46. package/esm/src/commands/upload.d.ts +0 -3
  47. package/esm/src/commands/upload.d.ts.map +0 -1
  48. package/esm/src/commands/upload.js +0 -58
  49. package/esm/src/commands/videos.d.ts +0 -3
  50. package/esm/src/commands/videos.d.ts.map +0 -1
  51. package/esm/src/commands/videos.js +0 -336
  52. package/esm/src/index.d.ts +0 -27
  53. package/esm/src/index.d.ts.map +0 -1
  54. package/esm/src/index.js +0 -160
  55. package/esm/src/lib/auth.d.ts +0 -47
  56. package/esm/src/lib/auth.d.ts.map +0 -1
  57. package/esm/src/lib/auth.js +0 -227
  58. package/esm/src/lib/config.d.ts +0 -6
  59. package/esm/src/lib/config.d.ts.map +0 -1
  60. package/esm/src/lib/config.js +0 -36
  61. package/esm/src/lib/logger.d.ts +0 -3
  62. package/esm/src/lib/logger.d.ts.map +0 -1
  63. package/esm/src/lib/logger.js +0 -27
  64. package/esm/src/lib/moodle.d.ts +0 -433
  65. package/esm/src/lib/moodle.d.ts.map +0 -1
  66. package/esm/src/lib/moodle.js +0 -1318
  67. package/esm/src/lib/session.d.ts +0 -8
  68. package/esm/src/lib/session.d.ts.map +0 -1
  69. package/esm/src/lib/session.js +0 -42
  70. package/esm/src/lib/token.d.ts +0 -38
  71. package/esm/src/lib/token.d.ts.map +0 -1
  72. package/esm/src/lib/token.js +0 -178
  73. package/esm/src/lib/types.d.ts +0 -189
  74. package/esm/src/lib/types.d.ts.map +0 -1
  75. package/esm/src/lib/types.js +0 -2
  76. package/esm/src/lib/utils.d.ts +0 -57
  77. package/esm/src/lib/utils.d.ts.map +0 -1
  78. package/esm/src/lib/utils.js +0 -129
  79. package/script/_dnt.polyfills.d.ts +0 -101
  80. package/script/_dnt.polyfills.d.ts.map +0 -1
  81. package/script/_dnt.polyfills.js +0 -130
  82. package/script/_dnt.shims.d.ts +0 -6
  83. package/script/_dnt.shims.d.ts.map +0 -1
  84. package/script/_dnt.shims.js +0 -65
  85. package/script/deno.d.ts +0 -25
  86. package/script/deno.d.ts.map +0 -1
  87. package/script/deno.js +0 -25
  88. package/script/package.json +0 -3
  89. package/script/src/commands/announcements.d.ts +0 -3
  90. package/script/src/commands/announcements.d.ts.map +0 -1
  91. package/script/src/commands/announcements.js +0 -140
  92. package/script/src/commands/assignments.d.ts +0 -3
  93. package/script/src/commands/assignments.d.ts.map +0 -1
  94. package/script/src/commands/assignments.js +0 -269
  95. package/script/src/commands/auth.d.ts +0 -3
  96. package/script/src/commands/auth.d.ts.map +0 -1
  97. package/script/src/commands/auth.js +0 -296
  98. package/script/src/commands/calendar.d.ts +0 -3
  99. package/script/src/commands/calendar.d.ts.map +0 -1
  100. package/script/src/commands/calendar.js +0 -185
  101. package/script/src/commands/courses.d.ts +0 -3
  102. package/script/src/commands/courses.d.ts.map +0 -1
  103. package/script/src/commands/courses.js +0 -354
  104. package/script/src/commands/forums.d.ts +0 -3
  105. package/script/src/commands/forums.d.ts.map +0 -1
  106. package/script/src/commands/forums.js +0 -324
  107. package/script/src/commands/grades.d.ts +0 -3
  108. package/script/src/commands/grades.d.ts.map +0 -1
  109. package/script/src/commands/grades.js +0 -127
  110. package/script/src/commands/materials.d.ts +0 -3
  111. package/script/src/commands/materials.d.ts.map +0 -1
  112. package/script/src/commands/materials.js +0 -419
  113. package/script/src/commands/quizzes.d.ts +0 -3
  114. package/script/src/commands/quizzes.d.ts.map +0 -1
  115. package/script/src/commands/quizzes.js +0 -277
  116. package/script/src/commands/skills.d.ts +0 -3
  117. package/script/src/commands/skills.d.ts.map +0 -1
  118. package/script/src/commands/skills.js +0 -112
  119. package/script/src/commands/upload.d.ts +0 -3
  120. package/script/src/commands/upload.d.ts.map +0 -1
  121. package/script/src/commands/upload.js +0 -64
  122. package/script/src/commands/videos.d.ts +0 -3
  123. package/script/src/commands/videos.d.ts.map +0 -1
  124. package/script/src/commands/videos.js +0 -342
  125. package/script/src/index.d.ts +0 -27
  126. package/script/src/index.d.ts.map +0 -1
  127. package/script/src/index.js +0 -167
  128. package/script/src/lib/auth.d.ts +0 -47
  129. package/script/src/lib/auth.d.ts.map +0 -1
  130. package/script/src/lib/auth.js +0 -269
  131. package/script/src/lib/config.d.ts +0 -6
  132. package/script/src/lib/config.d.ts.map +0 -1
  133. package/script/src/lib/config.js +0 -42
  134. package/script/src/lib/logger.d.ts +0 -3
  135. package/script/src/lib/logger.d.ts.map +0 -1
  136. package/script/src/lib/logger.js +0 -30
  137. package/script/src/lib/moodle.d.ts +0 -433
  138. package/script/src/lib/moodle.d.ts.map +0 -1
  139. package/script/src/lib/moodle.js +0 -1389
  140. package/script/src/lib/session.d.ts +0 -8
  141. package/script/src/lib/session.d.ts.map +0 -1
  142. package/script/src/lib/session.js +0 -45
  143. package/script/src/lib/token.d.ts +0 -38
  144. package/script/src/lib/token.d.ts.map +0 -1
  145. package/script/src/lib/token.js +0 -189
  146. package/script/src/lib/types.d.ts +0 -189
  147. package/script/src/lib/types.d.ts.map +0 -1
  148. package/script/src/lib/types.js +0 -3
  149. package/script/src/lib/utils.d.ts +0 -57
  150. package/script/src/lib/utils.d.ts.map +0 -1
  151. package/script/src/lib/utils.js +0 -175
  152. package/skills/openape/SKILL.md +0 -115
@@ -1,413 +0,0 @@
1
- import { getOutputFormat, sanitizeFilename, formatFileSize } from "../lib/utils.js";
2
- import { getEnrolledCoursesApi, getResourcesByCoursesApi, updateActivityCompletionStatusManually, getSiteInfoApi, moodleApiCall } from "../lib/moodle.js";
3
- import { createApiContext } from "../lib/auth.js";
4
- import { formatAndOutput } from "../index.js";
5
- import path from "node:path";
6
- import fs from "node:fs";
7
- export function registerMaterialsCommand(program) {
8
- const materialsCmd = program.command("materials");
9
- materialsCmd.description("Material/resource operations");
10
- // Helper to download a single resource via HTTP (no browser needed)
11
- async function downloadResourceHttp(resource, outputDir, log, token) {
12
- try {
13
- // Only download resource type (skip url)
14
- if (resource.modType !== "resource") {
15
- log.debug(` Skipping ${resource.modType}: ${resource.name}`);
16
- return null;
17
- }
18
- const courseDir = path.join(outputDir, sanitizeFilename(resource.course_name));
19
- await fs.promises.mkdir(courseDir, { recursive: true });
20
- // Build filename
21
- let filename = sanitizeFilename(resource.name);
22
- if (resource.mimetype && !path.extname(filename)) {
23
- const extMap = {
24
- "application/pdf": ".pdf",
25
- "application/vnd.ms-powerpoint": ".ppt",
26
- "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx",
27
- "application/msword": ".doc",
28
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
29
- "application/vnd.ms-excel": ".xls",
30
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
31
- "application/zip": ".zip",
32
- "image/jpeg": ".jpg",
33
- "image/png": ".png",
34
- };
35
- if (extMap[resource.mimetype]) {
36
- filename += extMap[resource.mimetype];
37
- }
38
- }
39
- const outputPath = path.join(courseDir, filename);
40
- // Skip if already exists
41
- if (fs.existsSync(outputPath)) {
42
- log.debug(` Skipping (exists): ${filename}`);
43
- const stats = await fs.promises.stat(outputPath);
44
- return { filename, path: outputPath, size: stats.size, course_id: resource.course_id, course_name: resource.course_name };
45
- }
46
- // Download via HTTP with WS token
47
- const separator = resource.url.includes("?") ? "&" : "?";
48
- const downloadUrl = `${resource.url}${separator}token=${token}`;
49
- log.debug(` Downloading: ${resource.name}`);
50
- const response = await fetch(downloadUrl);
51
- if (!response.ok) {
52
- log.warn(` Failed to download ${resource.name}: HTTP ${response.status}`);
53
- return null;
54
- }
55
- const arrayBuffer = await response.arrayBuffer();
56
- const data = new Uint8Array(arrayBuffer);
57
- await fs.promises.writeFile(outputPath, data);
58
- log.success(` Downloaded: ${filename} (${formatFileSize(data.byteLength, 1)} KB)`);
59
- return { filename, path: outputPath, size: data.byteLength, course_id: resource.course_id, course_name: resource.course_name };
60
- }
61
- catch (err) {
62
- log.warn(` Failed to download ${resource.name}: ${err instanceof Error ? err.message : String(err)}`);
63
- return null;
64
- }
65
- }
66
- // Helper to build material list from API resources
67
- function buildMaterialsList(courses, apiResources) {
68
- const courseMap = new Map(courses.map(c => [c.id, c]));
69
- const materials = [];
70
- for (const resource of apiResources) {
71
- const course = courseMap.get(resource.courseId);
72
- if (course) {
73
- materials.push({
74
- course_id: resource.courseId,
75
- course_name: course.fullname,
76
- cmid: resource.cmid,
77
- name: resource.name,
78
- url: resource.url,
79
- modType: resource.modType,
80
- mimetype: resource.mimetype,
81
- filesize: resource.filesize,
82
- modified: resource.modified,
83
- });
84
- }
85
- }
86
- return materials;
87
- }
88
- materialsCmd
89
- .command("list-all")
90
- .description("List all materials/resources across all courses")
91
- .option("--level <type>", "Course level: in_progress (default) | all", "in_progress")
92
- .option("--output <format>", "Output format: json|csv|table|silent")
93
- .action(async (options, command) => {
94
- const apiContext = await createApiContext(options, command);
95
- if (!apiContext) {
96
- process.exitCode = 1;
97
- return;
98
- }
99
- const classification = options.level === "all" ? undefined : "inprogress";
100
- const courses = await getEnrolledCoursesApi(apiContext.session, {
101
- classification,
102
- });
103
- // Get materials via WS API (no browser needed!)
104
- const courseIds = courses.map(c => c.id);
105
- const apiResources = await getResourcesByCoursesApi(apiContext.session, courseIds);
106
- // Build a map of courseId -> course for quick lookup
107
- const courseMap = new Map(courses.map(c => [c.id, c]));
108
- const allMaterials = [];
109
- for (const resource of apiResources) {
110
- const course = courseMap.get(resource.courseId);
111
- if (course) {
112
- allMaterials.push({
113
- course_id: resource.courseId,
114
- course_name: course.fullname,
115
- cmid: resource.cmid,
116
- name: resource.name,
117
- url: resource.url,
118
- modType: resource.modType,
119
- mimetype: resource.mimetype,
120
- filesize: resource.filesize,
121
- modified: resource.modified,
122
- });
123
- }
124
- }
125
- const output = {
126
- status: "success",
127
- timestamp: new Date().toISOString(),
128
- level: options.level,
129
- materials: allMaterials.map(m => ({
130
- course_id: m.course_id,
131
- course_name: m.course_name,
132
- id: m.cmid,
133
- name: m.name,
134
- type: m.modType,
135
- mimetype: m.mimetype,
136
- filesize: m.filesize,
137
- modified: m.modified ? new Date(m.modified * 1000).toISOString() : null,
138
- url: m.url,
139
- })),
140
- summary: {
141
- total_courses: courses.length,
142
- total_materials: allMaterials.length,
143
- by_type: allMaterials.reduce((acc, m) => {
144
- acc[m.modType] = (acc[m.modType] || 0) + 1;
145
- return acc;
146
- }, {}),
147
- },
148
- };
149
- console.log(JSON.stringify(output));
150
- });
151
- materialsCmd
152
- .command("download")
153
- .description("Download all materials from a specific course")
154
- .argument("<course-id>", "Course ID")
155
- .option("--output-dir <path>", "Output directory", "./downloads")
156
- .action(async (courseId, options, command) => {
157
- const apiContext = await createApiContext(options, command);
158
- if (!apiContext) {
159
- process.exitCode = 1;
160
- return;
161
- }
162
- const { log, session } = apiContext;
163
- const courses = await getEnrolledCoursesApi(session);
164
- const course = courses.find((c) => c.id === parseInt(courseId, 10));
165
- if (!course) {
166
- log.error(`Course not found: ${courseId}`);
167
- process.exitCode = 1;
168
- return;
169
- }
170
- const apiResources = await getResourcesByCoursesApi(session, [course.id]);
171
- const materials = buildMaterialsList(courses, apiResources);
172
- log.info(`Found ${materials.length} materials in course: ${course.fullname}`);
173
- const downloadedFiles = [];
174
- for (const material of materials) {
175
- const result = await downloadResourceHttp(material, options.outputDir, log, session.wsToken);
176
- if (result) {
177
- downloadedFiles.push(result);
178
- }
179
- }
180
- const output = {
181
- status: "success",
182
- timestamp: new Date().toISOString(),
183
- downloaded_files: downloadedFiles.map(f => ({
184
- filename: f.filename,
185
- path: f.path,
186
- size: f.size,
187
- course_id: f.course_id,
188
- course_name: f.course_name,
189
- })),
190
- summary: {
191
- total_materials: materials.length,
192
- downloaded: downloadedFiles.length,
193
- skipped: materials.length - downloadedFiles.length,
194
- total_size: downloadedFiles.reduce((sum, f) => sum + f.size, 0),
195
- },
196
- };
197
- console.log(JSON.stringify(output));
198
- });
199
- materialsCmd
200
- .command("download-all")
201
- .description("Download all materials from all courses")
202
- .option("--output-dir <path>", "Output directory", "./downloads")
203
- .option("--level <type>", "Course level: in_progress (default) | all", "in_progress")
204
- .action(async (options, command) => {
205
- const apiContext = await createApiContext(options, command);
206
- if (!apiContext) {
207
- process.exitCode = 1;
208
- return;
209
- }
210
- const { log, session } = apiContext;
211
- const classification = options.level === "all" ? undefined : "inprogress";
212
- const courses = await getEnrolledCoursesApi(session, { classification });
213
- log.info(`Scanning ${courses.length} courses for materials...`);
214
- const courseIds = courses.map((c) => c.id);
215
- const apiResources = await getResourcesByCoursesApi(session, courseIds);
216
- const allMaterials = buildMaterialsList(courses, apiResources);
217
- log.info(`Found ${allMaterials.length} materials across ${courses.length} courses`);
218
- const downloadedFiles = [];
219
- for (const material of allMaterials) {
220
- const result = await downloadResourceHttp(material, options.outputDir, log, session.wsToken);
221
- if (result) {
222
- downloadedFiles.push(result);
223
- }
224
- }
225
- const output = {
226
- status: "success",
227
- timestamp: new Date().toISOString(),
228
- downloaded_files: downloadedFiles.map(f => ({
229
- filename: f.filename,
230
- path: f.path,
231
- size: f.size,
232
- course_id: f.course_id,
233
- course_name: f.course_name,
234
- })),
235
- summary: {
236
- total_courses: courses.length,
237
- total_materials: allMaterials.length,
238
- downloaded: downloadedFiles.length,
239
- skipped: allMaterials.length - downloadedFiles.length,
240
- total_size: downloadedFiles.reduce((sum, f) => sum + f.size, 0),
241
- },
242
- };
243
- console.log(JSON.stringify(output));
244
- });
245
- materialsCmd
246
- .command("complete")
247
- .description("Mark all incomplete resources (non-video) as complete in a course")
248
- .argument("<course-id>", "Course ID")
249
- .option("--dry-run", "Show what would be marked complete without doing it")
250
- .option("--output <format>", "Output format: json|csv|table|silent")
251
- .action(async (courseId, options, command) => {
252
- const output = getOutputFormat(command);
253
- const apiContext = await createApiContext(options, command);
254
- if (!apiContext) {
255
- process.exitCode = 1;
256
- return;
257
- }
258
- try {
259
- const { log, session } = apiContext;
260
- // Get user ID
261
- const siteInfo = await getSiteInfoApi(session);
262
- // Get completion status for all activities in the course
263
- const completionData = await moodleApiCall(session, "core_completion_get_activities_completion_status", { courseid: parseInt(courseId, 10), userid: siteInfo.userid });
264
- if (!completionData?.statuses) {
265
- log.info("No activities found in this course.");
266
- return;
267
- }
268
- // Filter for resources (non-video) that have completion enabled but are not complete
269
- const incompleteResources = completionData.statuses.filter((status) => {
270
- // Only resources, not supervideo
271
- if (status.modname === "supervideo")
272
- return false;
273
- // Must have completion enabled
274
- if (!status.hascompletion)
275
- return false;
276
- // Must be incomplete
277
- if (status.isoverallcomplete)
278
- return false;
279
- return true;
280
- });
281
- if (incompleteResources.length === 0) {
282
- log.info("All resources are already complete (or no resources with completion tracking).");
283
- return;
284
- }
285
- log.info(`Found ${incompleteResources.length} incomplete resources to complete:`);
286
- for (const resource of incompleteResources) {
287
- log.info(` - ${resource.name} (cmid: ${resource.cmid})`);
288
- }
289
- if (options.dryRun) {
290
- log.info("\n[Dry run] No changes made.");
291
- return;
292
- }
293
- // Mark each resource as complete
294
- const results = [];
295
- for (const resource of incompleteResources) {
296
- const success = await updateActivityCompletionStatusManually(session, resource.cmid, true);
297
- results.push({
298
- cmid: resource.cmid,
299
- name: resource.name,
300
- success,
301
- });
302
- if (success) {
303
- log.success(` ✓ Completed: ${resource.name}`);
304
- }
305
- else {
306
- log.error(` ✗ Failed: ${resource.name}`);
307
- }
308
- }
309
- const completed = results.filter(r => r.success).length;
310
- const failed = results.filter(r => !r.success).length;
311
- log.info(`\n執行結果: ${completed} 成功, ${failed} 失敗`);
312
- if (output !== "silent") {
313
- formatAndOutput(results, output, log);
314
- }
315
- }
316
- catch (e) {
317
- apiContext.log.error(`Error: ${e instanceof Error ? e.message : String(e)}`);
318
- process.exitCode = 1;
319
- }
320
- });
321
- materialsCmd
322
- .command("complete-all")
323
- .description("Mark all incomplete resources (non-video) as complete across all in-progress courses")
324
- .option("--dry-run", "Show what would be marked complete without doing it")
325
- .option("--level <type>", "Course level: in_progress (default) | all", "in_progress")
326
- .option("--output <format>", "Output format: json|csv|table|silent")
327
- .action(async (options, command) => {
328
- const output = getOutputFormat(command);
329
- const apiContext = await createApiContext(options, command);
330
- if (!apiContext) {
331
- process.exitCode = 1;
332
- return;
333
- }
334
- try {
335
- const { log, session } = apiContext;
336
- // Get user ID
337
- const siteInfo = await getSiteInfoApi(session);
338
- // Get all courses
339
- const classification = options.level === "all" ? undefined : "inprogress";
340
- const courses = await getEnrolledCoursesApi(session, { classification });
341
- log.info(`Scanning ${courses.length} courses for incomplete resources...`);
342
- const allResults = [];
343
- let totalIncomplete = 0;
344
- for (const course of courses) {
345
- try {
346
- // Get completion status for all activities in the course
347
- const completionData = await moodleApiCall(session, "core_completion_get_activities_completion_status", { courseid: course.id, userid: siteInfo.userid });
348
- if (!completionData?.statuses)
349
- continue;
350
- // Filter for resources (non-video) that have completion enabled but are not complete
351
- const incompleteResources = completionData.statuses.filter((status) => {
352
- if (status.modname === "supervideo")
353
- return false;
354
- if (!status.hascompletion)
355
- return false;
356
- if (status.isoverallcomplete)
357
- return false;
358
- return true;
359
- });
360
- if (incompleteResources.length > 0) {
361
- log.info(`\n${course.fullname}: ${incompleteResources.length} incomplete resources`);
362
- totalIncomplete += incompleteResources.length;
363
- if (options.dryRun) {
364
- for (const resource of incompleteResources) {
365
- log.info(` - ${resource.name} (cmid: ${resource.cmid})`);
366
- }
367
- }
368
- else {
369
- for (const resource of incompleteResources) {
370
- const success = await updateActivityCompletionStatusManually(session, resource.cmid, true);
371
- allResults.push({
372
- courseId: course.id,
373
- courseName: course.fullname,
374
- cmid: resource.cmid,
375
- name: resource.name,
376
- success,
377
- });
378
- if (success) {
379
- log.success(` ✓ Completed: ${resource.name}`);
380
- }
381
- else {
382
- log.error(` ✗ Failed: ${resource.name}`);
383
- }
384
- }
385
- }
386
- }
387
- }
388
- catch (e) {
389
- log.warn(`Failed to process course ${course.fullname}: ${e}`);
390
- }
391
- }
392
- if (totalIncomplete === 0) {
393
- log.info("\nAll resources are already complete (or no resources with completion tracking).");
394
- return;
395
- }
396
- if (options.dryRun) {
397
- log.info(`\n[Dry run] Found ${totalIncomplete} incomplete resources across ${courses.length} courses.`);
398
- log.info("Run without --dry-run to mark them as complete.");
399
- return;
400
- }
401
- const completed = allResults.filter(r => r.success).length;
402
- const failed = allResults.filter(r => !r.success).length;
403
- log.info(`\n執行結果: ${completed} 成功, ${failed} 失敗`);
404
- if (output !== "silent") {
405
- formatAndOutput(allResults, output, log);
406
- }
407
- }
408
- catch (e) {
409
- apiContext.log.error(`Error: ${e instanceof Error ? e.message : String(e)}`);
410
- process.exitCode = 1;
411
- }
412
- });
413
- }
@@ -1,3 +0,0 @@
1
- import { Command } from "commander";
2
- export declare function registerQuizzesCommand(program: Command): void;
3
- //# sourceMappingURL=quizzes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quizzes.d.ts","sourceRoot":"","sources":["../../../src/src/commands/quizzes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyEpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoQ7D"}