@mo7yw4ng/openape 1.0.0

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/esm/_dnt.polyfills.d.ts +24 -0
  4. package/esm/_dnt.polyfills.js +1 -0
  5. package/esm/_dnt.shims.d.ts +5 -0
  6. package/esm/_dnt.shims.js +61 -0
  7. package/esm/deno.d.ts +23 -0
  8. package/esm/deno.js +22 -0
  9. package/esm/package.json +3 -0
  10. package/package.json +34 -0
  11. package/script/_dnt.polyfills.d.ts +24 -0
  12. package/script/_dnt.polyfills.js +2 -0
  13. package/script/_dnt.shims.d.ts +5 -0
  14. package/script/_dnt.shims.js +65 -0
  15. package/script/deno.d.ts +23 -0
  16. package/script/deno.js +24 -0
  17. package/script/package.json +3 -0
  18. package/script/src/commands/announcements.d.ts +2 -0
  19. package/script/src/commands/announcements.js +288 -0
  20. package/script/src/commands/auth.d.ts +2 -0
  21. package/script/src/commands/auth.js +238 -0
  22. package/script/src/commands/calendar.d.ts +2 -0
  23. package/script/src/commands/calendar.js +375 -0
  24. package/script/src/commands/courses.d.ts +2 -0
  25. package/script/src/commands/courses.js +484 -0
  26. package/script/src/commands/forums.d.ts +2 -0
  27. package/script/src/commands/forums.js +403 -0
  28. package/script/src/commands/grades.d.ts +2 -0
  29. package/script/src/commands/grades.js +259 -0
  30. package/script/src/commands/materials.d.ts +2 -0
  31. package/script/src/commands/materials.js +423 -0
  32. package/script/src/commands/quizzes.d.ts +2 -0
  33. package/script/src/commands/quizzes.js +228 -0
  34. package/script/src/commands/skills.d.ts +2 -0
  35. package/script/src/commands/skills.js +117 -0
  36. package/script/src/commands/videos.d.ts +2 -0
  37. package/script/src/commands/videos.js +334 -0
  38. package/script/src/index.d.ts +26 -0
  39. package/script/src/index.js +156 -0
  40. package/script/src/lib/auth.d.ts +24 -0
  41. package/script/src/lib/auth.js +203 -0
  42. package/script/src/lib/config.d.ts +5 -0
  43. package/script/src/lib/config.js +43 -0
  44. package/script/src/lib/logger.d.ts +2 -0
  45. package/script/src/lib/logger.js +28 -0
  46. package/script/src/lib/moodle.d.ts +234 -0
  47. package/script/src/lib/moodle.js +966 -0
  48. package/script/src/lib/session.d.ts +7 -0
  49. package/script/src/lib/session.js +71 -0
  50. package/script/src/lib/token.d.ts +27 -0
  51. package/script/src/lib/token.js +154 -0
  52. package/script/src/lib/types.d.ts +261 -0
  53. package/script/src/lib/types.js +2 -0
  54. package/script/src/lib/utils.d.ts +5 -0
  55. package/script/src/lib/utils.js +43 -0
  56. package/skills/openape/SKILL.md +328 -0
@@ -0,0 +1,328 @@
1
+ ---
2
+ name: openape
3
+ description: How to use OpenApe CLI — automate CYCU iLearning (Moodle) tasks including course management, video progress tracking, quizzes, materials, grades, forums, announcements, and calendar
4
+ ---
5
+
6
+ # OpenApe CLI
7
+
8
+ Use the `openape` command to access CYCU iLearning (Moodle) platform. OpenApe provides automation for course management, video progress completion, quiz tracking, material downloads, grade viewing, forum discussions, announcements, and calendar events.
9
+
10
+ ## Setup
11
+
12
+ Install via npm:
13
+ ```bash
14
+ npm install -g openape
15
+ ```
16
+
17
+ Or clone and compile:
18
+ ```bash
19
+ git clone https://github.com/mo7yw4ng/openape && cd openape
20
+ deno task compile
21
+ # Add dist/OpenApe.exe to your PATH
22
+ ```
23
+
24
+ If not authenticated, run:
25
+ ```bash
26
+ openape login
27
+ ```
28
+ A browser will open for Microsoft OAuth SSO. Complete MFA login manually — no username/password input needed in the terminal.
29
+
30
+ Session is saved to `.auth/storage-state.json` and persists between runs. If session expires, run `openape login` again.
31
+
32
+ ## Discovering Commands
33
+
34
+ Every command supports `--help` for full option details:
35
+ ```bash
36
+ openape --help
37
+ openape courses --help
38
+ openape videos complete --help
39
+ ```
40
+
41
+ Add `--output json` to any command for machine-readable output. Use `--output csv` for spreadsheet format, `--output table` for human-readable tables, or `--output silent` to suppress output.
42
+
43
+ ## Course Commands
44
+
45
+ ### Listing courses
46
+
47
+ ```bash
48
+ # List in-progress courses (default)
49
+ openape courses list
50
+
51
+ # List all courses including past and future
52
+ openape courses list --level all
53
+
54
+ # List only past courses
55
+ openape courses list --level past
56
+
57
+ # List only future courses
58
+ openape courses list --level future
59
+ ```
60
+
61
+ Course levels: `in_progress` (default), `past`, `future`, `all`.
62
+
63
+ ### Course information
64
+
65
+ ```bash
66
+ # Get detailed course information
67
+ openape courses info <course-id>
68
+
69
+ # Get course progress percentage
70
+ openape courses progress <course-id>
71
+
72
+ # Get course syllabus from CMAP (18-week schedule)
73
+ openape courses syllabus <course-id>
74
+ ```
75
+
76
+ ## Video Commands
77
+
78
+ ### Listing videos
79
+
80
+ ```bash
81
+ # List all videos in a course
82
+ openape videos list <course-id>
83
+
84
+ # List only incomplete videos (browser mode only)
85
+ openape videos list <course-id> --incomplete-only
86
+ ```
87
+
88
+ ### Completing videos
89
+
90
+ ```bash
91
+ # Complete all incomplete videos in a course
92
+ openape videos complete <course-id>
93
+
94
+ # Dry-run: discover videos without completing
95
+ openape videos complete <course-id> --dry-run
96
+
97
+ # Complete all incomplete videos across all courses
98
+ openape videos complete-all
99
+
100
+ # Dry-run all courses
101
+ openape videos complete-all --dry-run
102
+ ```
103
+
104
+ **Note:** Video completion forges SuperVideo progress AJAX calls to simulate watching the entire video. The server accepts the progress but completion status may take time to update in the course state.
105
+
106
+ ### Downloading videos
107
+
108
+ ```bash
109
+ # Download all videos from a course
110
+ openape videos download <course-id>
111
+
112
+ # Download only incomplete videos
113
+ openape videos download <course-id> --incomplete-only
114
+
115
+ # Specify output directory (default: ./downloads/videos)
116
+ openape videos download <course-id> --output-dir ./my-videos
117
+ ```
118
+
119
+ ## Quiz Commands
120
+
121
+ ### Listing quizzes
122
+
123
+ ```bash
124
+ # List quizzes in a specific course
125
+ openape quizzes list <course-id>
126
+
127
+ # List all quizzes across all courses
128
+ openape quizzes list-all
129
+
130
+ # List only in-progress course quizzes
131
+ openape quizzes list-all --level in_progress
132
+ ```
133
+
134
+ ### Opening quizzes
135
+
136
+ ```bash
137
+ # Open a quiz URL in browser (manual mode)
138
+ openape quizzes open <quiz-url>
139
+ ```
140
+
141
+ ## Material Commands
142
+
143
+ ### Listing materials
144
+
145
+ ```bash
146
+ # List all materials/resources across all courses
147
+ openape materials list-all
148
+
149
+ # List materials from in-progress courses only
150
+ openape materials list-all --level in_progress
151
+ ```
152
+
153
+ Materials include resources (PDFs, documents) and URLs (external links).
154
+
155
+ ### Downloading materials
156
+
157
+ ```bash
158
+ # Download all materials from a specific course
159
+ openape materials download <course-id>
160
+
161
+ # Download all materials from all in-progress courses
162
+ openape materials download-all
163
+
164
+ # Download from all courses (including past)
165
+ openape materials download-all --level all
166
+
167
+ # Specify output directory (default: ./downloads)
168
+ openape materials download-all --output-dir ./my-materials
169
+ ```
170
+
171
+ ## Grade Commands
172
+
173
+ ### Viewing grades
174
+
175
+ ```bash
176
+ # Show grade summary across all courses
177
+ openape grades summary
178
+
179
+ # Show detailed grades for a specific course
180
+ openape grades course <course-id>
181
+ ```
182
+
183
+ ## Forum Commands
184
+
185
+ ### Listing forums
186
+
187
+ ```bash
188
+ # List forums from in-progress courses
189
+ openape forums list
190
+
191
+ # List all forums across all courses
192
+ openape forums list-all
193
+
194
+ # List forums from a specific course level
195
+ openape forums list-all --level past
196
+ ```
197
+
198
+ ### Reading discussions
199
+
200
+ ```bash
201
+ # List discussions in a forum (use cmid or instance ID)
202
+ openape forums discussions <forum-id>
203
+
204
+ # Show posts in a discussion
205
+ openape forums posts <discussion-id>
206
+ ```
207
+
208
+ ## Announcement Commands
209
+
210
+ ### Listing announcements
211
+
212
+ ```bash
213
+ # List all announcements across all courses
214
+ openape announcements list-all
215
+
216
+ # List only unread announcements
217
+ openape announcements list-all --unread-only
218
+ ```
219
+
220
+ ### Reading announcements
221
+
222
+ ```bash
223
+ # Read a specific announcement (shows full content)
224
+ openape announcements read <announcement-id>
225
+ ```
226
+
227
+ ## Calendar Commands
228
+
229
+ ### Listing events
230
+
231
+ ```bash
232
+ # List all calendar events
233
+ openape calendar events
234
+
235
+ # List events after a specific date
236
+ openape calendar events --events-after 2026-03-01
237
+
238
+ # List events before a specific date
239
+ openape calendar events --events-before 2026-06-30
240
+
241
+ # List events in a specific course
242
+ openape calendar events --course-id <course-id>
243
+ ```
244
+
245
+ ### Exporting calendar
246
+
247
+ ```bash
248
+ # Export calendar events to file
249
+ openape calendar export
250
+
251
+ # Specify output file (default: calendar_events.json)
252
+ openape calendar export --output my-calendar.json
253
+
254
+ # Export as ICS format for calendar apps
255
+ openape calendar export --format ics --output my-calendar.ics
256
+ ```
257
+
258
+ ## Output Formats
259
+
260
+ All commands support `--output` option:
261
+ - `json` (default) - Machine-readable JSON
262
+ - `csv` - Comma-separated values for spreadsheets
263
+ - `table` - Human-readable table format
264
+ - `silent` - Suppress output (useful for automation)
265
+
266
+ Global options:
267
+ - `--verbose` - Enable debug logging
268
+ - `--silent` - Suppress all log output (JSON only)
269
+ - `--headed` - Run browser in visible mode (for debugging)
270
+
271
+ ## Example Workflows
272
+
273
+ **Check daily progress:** See what's due and what's incomplete.
274
+ ```bash
275
+ openape courses list --level in_progress
276
+ openape videos list <course-id>
277
+ openape quizzes list-all
278
+ openape announcements list-all --unread-only
279
+ ```
280
+
281
+ **Auto-complete videos:** Complete all incomplete videos across courses.
282
+ ```bash
283
+ # First, dry-run to see what will be completed
284
+ openape videos complete-all --dry-run
285
+
286
+ # Then actually complete them
287
+ openape videos complete-all
288
+ ```
289
+
290
+ **Download all materials:** Get all course materials for offline study.
291
+ ```bash
292
+ openape materials download-all --output-dir ./semester-materials
293
+ ```
294
+
295
+ **Check grades and progress:** See how you're doing in all courses.
296
+ ```bash
297
+ openape grades summary
298
+ openape courses progress <course-id>
299
+ openape courses syllabus <course-id>
300
+ ```
301
+
302
+ **Review discussions:** Catch up on forum activity.
303
+ ```bash
304
+ openape forums list --level in_progress
305
+ openape forums discussions <forum-id>
306
+ openape forums posts <discussion-id>
307
+ ```
308
+
309
+ **Plan your week:** Check upcoming events and deadlines.
310
+ ```bash
311
+ openape calendar events --events-after 2026-03-21 --events-before 2026-03-28
312
+ openape calendar export --format ics --output week.ics
313
+ ```
314
+
315
+ **Bulk operations:** Complete videos and download materials across all courses.
316
+ ```bash
317
+ openape videos complete-all
318
+ openape materials download-all --level in_progress
319
+ ```
320
+
321
+ ## Tips
322
+
323
+ - Use `--dry-run` with `videos complete` to preview what will be completed
324
+ - Use `--level in_progress` (default) to focus on active courses
325
+ - Use `--output json` for scripting and automation
326
+ - Use `--output table` for human-readable output
327
+ - Session persists after login, no need to re-authenticate
328
+ - WS API mode is used by default for faster performance; browser mode is fallback