canvaslms-cli 1.6.2 → 1.6.4-fix

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 (80) hide show
  1. package/CHANGELOG.md +64 -31
  2. package/README.md +131 -129
  3. package/dist/commands/announcements.d.ts +2 -2
  4. package/dist/commands/announcements.d.ts.map +1 -1
  5. package/dist/commands/announcements.js +29 -20
  6. package/dist/commands/announcements.js.map +1 -1
  7. package/dist/commands/api.d.ts +1 -1
  8. package/dist/commands/api.d.ts.map +1 -1
  9. package/dist/commands/api.js +1 -1
  10. package/dist/commands/api.js.map +1 -1
  11. package/dist/commands/assignments.d.ts +2 -2
  12. package/dist/commands/assignments.d.ts.map +1 -1
  13. package/dist/commands/assignments.js +24 -19
  14. package/dist/commands/assignments.js.map +1 -1
  15. package/dist/commands/calendar.d.ts +7 -0
  16. package/dist/commands/calendar.d.ts.map +1 -0
  17. package/dist/commands/calendar.js +150 -0
  18. package/dist/commands/calendar.js.map +1 -0
  19. package/dist/commands/config.d.ts.map +1 -1
  20. package/dist/commands/config.js +102 -85
  21. package/dist/commands/config.js.map +1 -1
  22. package/dist/commands/grades.d.ts +2 -2
  23. package/dist/commands/grades.d.ts.map +1 -1
  24. package/dist/commands/grades.js +296 -176
  25. package/dist/commands/grades.js.map +1 -1
  26. package/dist/commands/list.d.ts +1 -1
  27. package/dist/commands/list.d.ts.map +1 -1
  28. package/dist/commands/list.js +21 -19
  29. package/dist/commands/list.js.map +1 -1
  30. package/dist/commands/modules.d.ts +5 -0
  31. package/dist/commands/modules.d.ts.map +1 -0
  32. package/dist/commands/modules.js +263 -0
  33. package/dist/commands/modules.js.map +1 -0
  34. package/dist/commands/profile.d.ts.map +1 -1
  35. package/dist/commands/profile.js +57 -32
  36. package/dist/commands/profile.js.map +1 -1
  37. package/dist/commands/submit.d.ts +1 -2
  38. package/dist/commands/submit.d.ts.map +1 -1
  39. package/dist/commands/submit.js +88 -79
  40. package/dist/commands/submit.js.map +1 -1
  41. package/dist/index.d.ts +16 -14
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +16 -14
  44. package/dist/index.js.map +1 -1
  45. package/dist/lib/api-client.d.ts +3 -0
  46. package/dist/lib/api-client.d.ts.map +1 -1
  47. package/dist/lib/api-client.js +31 -16
  48. package/dist/lib/api-client.js.map +1 -1
  49. package/dist/lib/config-validator.d.ts.map +1 -1
  50. package/dist/lib/config-validator.js +12 -12
  51. package/dist/lib/config-validator.js.map +1 -1
  52. package/dist/lib/config.d.ts +1 -1
  53. package/dist/lib/config.d.ts.map +1 -1
  54. package/dist/lib/config.js +16 -14
  55. package/dist/lib/config.js.map +1 -1
  56. package/dist/lib/display.d.ts +10 -4
  57. package/dist/lib/display.d.ts.map +1 -1
  58. package/dist/lib/display.js +263 -167
  59. package/dist/lib/display.js.map +1 -1
  60. package/dist/lib/file-upload.d.ts.map +1 -1
  61. package/dist/lib/file-upload.js +17 -17
  62. package/dist/lib/file-upload.js.map +1 -1
  63. package/dist/lib/interactive.d.ts +1 -1
  64. package/dist/lib/interactive.d.ts.map +1 -1
  65. package/dist/lib/interactive.js +196 -144
  66. package/dist/lib/interactive.js.map +1 -1
  67. package/dist/src/index.d.ts +0 -1
  68. package/dist/src/index.js +83 -63
  69. package/dist/src/index.js.map +1 -1
  70. package/dist/types/index.d.ts +34 -1
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/package.json +10 -3
  73. package/dist/commands/coursenames.d.ts +0 -15
  74. package/dist/commands/coursenames.d.ts.map +0 -1
  75. package/dist/commands/coursenames.js +0 -150
  76. package/dist/commands/coursenames.js.map +0 -1
  77. package/dist/lib/course-utils.d.ts +0 -6
  78. package/dist/lib/course-utils.d.ts.map +0 -1
  79. package/dist/lib/course-utils.js +0 -17
  80. package/dist/lib/course-utils.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,10 +5,45 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.6.4-fix] - 2025-12-15
9
+
10
+ ### Fix (1.6.4)
11
+
12
+ - **Remove Postinstall Command**: Change to prepare husky
13
+
14
+ ## [1.6.4] - 2025-12-15
15
+
16
+ ### Added (1.6.4)
17
+
18
+ - **Modules Command**: New `modules` command to view course modules and their items with progress tracking
19
+ - **Calendar Command**: New `calendar` command to view upcoming assignments and events with due dates
20
+
21
+ ### Changed (1.6.4)
22
+
23
+ - **Course Arguments**: Replaced course ID arguments with course name arguments across all commands (assignments, grades, announcements) for easier usage
24
+ - **Workflow Name**: Changed CI workflow name from "CI" to "Test & Build" for better clarity
25
+
26
+ ## [1.6.3] - 2025-12-14
27
+
28
+ ### Added (1.6.3)
29
+
30
+ - **Live table resize**: Tables re-render automatically when terminal is resized
31
+ - **Adaptive truncation**: Text truncation updates dynamically based on terminal width
32
+
33
+ ### Fixed (1.6.3)
34
+
35
+ - **Submit table truncation**: Reduced excessive truncation in the submit table by compacting columns and shortening date format
36
+ - **Table overflow**: Fixed tables overflowing terminal width on small screens
37
+ - **Column width calculation**: Corrected border overhead calculation for accurate fitting
38
+
39
+ ### Changed (1.6.3)
40
+
41
+ - **Submit table columns**: Optimized and tightened column widths for compact display (Assignment Name max width set to 35, Type fixed at 8, Due fixed at 16 with MM/DD/YYYY formatting, Status fixed at 12)
42
+
8
43
  ## [1.6.2] - 2025-12-14
9
44
 
10
45
  - **Table display**: All table now have the same rounded corner format, text size adaptive to the terminal size
11
-
46
+
12
47
  ## [1.6.1] - 2025-12-13
13
48
 
14
49
  - **Dry Run Mode**: Submit command now supports `--dry-run` flag to test submission flow without actually uploading files or submitting assignments
@@ -16,7 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
16
51
 
17
52
  ## [1.6.0] - 2025-12-06
18
53
 
19
- ### Added
54
+ ### Added (1.6.0)
20
55
 
21
56
  - **Boxed Table Displays**: All commands now display data in modern boxed tables with rounded corners (╭╮╰╯)
22
57
  - **Adaptive Column Widths**: Tables dynamically adjust column widths based on terminal size for optimal display
@@ -24,7 +59,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
24
59
  - **Announcements Table**: Course selection and announcements list now displayed in formatted tables
25
60
  - **Profile Table**: User profile information displayed in clean field/value table format
26
61
 
27
- ### Changed
62
+ ### Changed (1.6.0)
28
63
 
29
64
  - **Grades Display**: Merged official grades and calculated statistics into a unified table
30
65
  - **CLI Descriptions**: Shortened command descriptions for cleaner help output
@@ -41,31 +76,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
41
76
 
42
77
  ## [1.4.7] - 2025-11-05
43
78
 
44
- ### Added
79
+ ### Added (1.4.7)
45
80
 
46
- - Show allowed file extensions hint in the interactive file browser when an assignment restricts uploads (e.g. "Allowed: .pdf, .docx").
81
+ - Show allowed file extensions hint in the interactive file browser when an assignment restricts uploads (e.g. `*.pdf`, `*.docx`).
47
82
  - Add `r` keybinding to the file browser to reload the current directory listing without exiting the browser.
48
83
 
49
- ### Fixed
50
-
51
- - Prevent the interactive file browser from permanently removing other stdin listeners: save and restore `process.stdin` 'data' listeners so `readline` and SIGINT (Ctrl+C) continue to work after browser exit.
52
- - Filter file browser listings by `allowed_extensions` when provided by the assignment so disallowed file types cannot be selected (prevents HTTP 400 "filetype not allowed").
53
- - Allow pressing Enter at the final "Proceed with submission? (Y/n)" prompt to accept the default (Yes) to match the shown prompt.
54
-
55
- ### Notes
56
-
57
- - Bumped package version to 1.4.7.
58
-
59
-
60
- ### Added
61
-
62
84
  - **Enhanced File Selection UX**: Implemented continuous file selection until empty input
63
85
  - Browse current directory with file size display
64
86
  - Add multiple files one by one
65
87
  - Remove files from selection
66
88
  - Show currently selected files
67
89
  - Smart file filtering (excludes hidden files, package files)
68
- - **Wildcard support**: Use patterns like *.html, *.js, *.pdf to select multiple files
90
+ - **Wildcard support**: Use patterns like `*.html`, `*.js`, `*.pdf` to select multiple files
69
91
  - File type icons for better visual identification
70
92
 
71
93
  - **Improved Grade Viewing**:
@@ -75,6 +97,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
75
97
  - Better grade formatting and status indicators
76
98
  - Support for letter grades, excused, and missing assignments
77
99
 
100
+ ### Notes (1.4.7)
101
+
102
+ - Bumped package version to 1.4.7.
103
+ - Assignment-level grade details with color coding
104
+ - Overall course grade summary
105
+ - Better grade formatting and status indicators
106
+ - Support for letter grades, excused, and missing assignments
107
+
78
108
  - **Enhanced Display Names**:
79
109
  - Show course names instead of IDs in all commands
80
110
  - Display assignment names prominently
@@ -85,7 +115,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
85
115
  - Confirmation helpers with default values
86
116
  - List selection utilities with cancel option
87
117
 
88
- ### Improved
118
+ ### Improved (1.4.7)
89
119
 
90
120
  - **Submit Command**: Complete redesign with better file selection workflow
91
121
  - **Grades Command**: Interactive course selection and detailed assignment grades
@@ -93,13 +123,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
93
123
  - **Announcements Command**: Show course names instead of IDs
94
124
  - **User Experience**: More consistent and intuitive interfaces across all commands
95
125
 
96
- ### Fixed
126
+ ### Fixed (1.4.7)
97
127
 
128
+ - Prevent the interactive file browser from permanently removing other stdin listeners: save and restore `process.stdin` 'data' listeners so `readline` and SIGINT (Ctrl+C) continue to work after browser exit.
129
+ - Filter file browser listings by `allowed_extensions` when provided by the assignment so disallowed file types cannot be selected (prevents HTTP 400 "filetype not allowed").
130
+ - Allow pressing Enter at the final "Proceed with submission? (Y/n)" prompt to accept the default (Yes) to match the shown prompt.
98
131
  - **Assignment Name Display**: Fixed "Unknown Assignment" issue in submission summary
99
132
  - **File Selection Flow**: Better error handling and user guidance during file selection
100
133
  - **Variable Scope**: Proper assignment variable handling throughout submission process
101
134
 
102
- ### Technical
135
+ ### Technical (1.4.7)
103
136
 
104
137
  - Enhanced interactive utilities in `lib/interactive.js`
105
138
  - Better error handling and user guidance
@@ -107,19 +140,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
107
140
 
108
141
  ## [1.1.1] - 2025-07-03
109
142
 
110
- ### Fixed
143
+ ### Fixed (1.1.1)
111
144
 
112
145
  - Removed dotenv dependency that was causing module not found errors
113
146
  - Fixed configuration file path to use `.canvaslms-cli-config.json`
114
147
  - Resolved package publishing and global installation issues
115
148
 
116
- ### Added
149
+ ### Added (1.1.1)
117
150
 
118
151
  - Dual binary support: both `canvaslms-cli` and `canvas` commands work
119
152
 
120
153
  ## [1.1.0] - 2025-07-03
121
154
 
122
- ### Major Changes
155
+ ### Major Changes (1.1.0)
123
156
 
124
157
  - Home directory configuration system (~/.canvaslms-cli-config.json)
125
158
  - Interactive configuration setup wizard (`canvas config setup`)
@@ -131,21 +164,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
131
164
  - Automatic configuration validation for all commands
132
165
  - Improved error handling and user guidance
133
166
 
134
- ### Changed
167
+ ### Changed (1.1.0)
135
168
 
136
169
  - **BREAKING**: Removed environment variable support (.env files)
137
170
  - Configuration now stored in user's home directory instead of project directory
138
171
  - Enhanced configuration validation with better error messages
139
172
  - Improved user onboarding with guided setup process
140
173
 
141
- ### Removed
174
+ ### Removed (1.1.0)
142
175
 
143
176
  - dotenv dependency (no longer needed)
144
177
  - Environment variable fallback support
145
178
 
146
179
  ## [1.0.0] - 2025-07-03
147
180
 
148
- ### Added
181
+ ### Added (1.0.0)
149
182
 
150
183
  - Initial release of Canvas CLI Tool
151
184
  - Modular architecture with separate command handlers
@@ -162,7 +195,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
162
195
  - File selection from current directory
163
196
  - Detailed verbose modes for all commands
164
197
 
165
- ### Features
198
+ ### Features (1.0.0)
166
199
 
167
200
  - 📚 Course listing with favorites support
168
201
  - 📝 Assignment management with status indicators
@@ -174,7 +207,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
174
207
  - 🎨 Color-coded grade display
175
208
  - 📁 Smart file selection interface
176
209
 
177
- ### Technical
210
+ ### Technical (1.0.0)
178
211
 
179
212
  - Modular command structure in separate files
180
213
  - Reusable API client library
@@ -185,7 +218,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
185
218
 
186
219
  ## [Unreleased]
187
220
 
188
- ### Planned Features
221
+ ### Planned Features (Unreleased)
189
222
 
190
223
  - Assignment creation and editing
191
224
  - Bulk operations
package/README.md CHANGED
@@ -1,129 +1,131 @@
1
- # Canvas CLI Tool
2
-
3
- A modern, user-friendly command-line interface for Canvas LMS. Manage courses, assignments, submissions, grades, and more directly from your terminal.
4
-
5
- ## Features
6
-
7
- - List and filter enrolled/starred courses
8
- - View assignments, grades, and submission status
9
- - Interactive file upload for assignments
10
- - View course announcements
11
- - Display user profile information
12
- - Direct access to Canvas API endpoints
13
-
14
- ## Installation
15
-
16
- ### Global (Recommended)
17
-
18
- ```bash
19
- npm install -g canvaslms-cli
20
- ```
21
-
22
- ## Setup
23
-
24
- 1. **Get your Canvas API Token**
25
- - Log in to Canvas
26
- - Go to Account → Settings
27
- - Under Approved Integrations, click + New Access Token
28
- - Copy the generated token
29
-
30
- 2. **Configure the CLI**
31
-
32
- ```bash
33
- canvas config
34
- ```
35
-
36
- 3. **Environment Variables**
37
-
38
- Create a `.env` file in your project root:
39
-
40
- ```env
41
- CANVAS_DOMAIN=your-canvas-domain.instructure.com
42
- CANVAS_API_TOKEN=your-api-token
43
- ```
44
-
45
- ## Usage
46
-
47
- ### Common Commands
48
-
49
- ```bash
50
- canvas config # Configure domain and API token
51
- canvas list # List starred courses
52
- canvas list -a # List all enrolled courses
53
- canvas assignments <course> # List assignments for a course
54
- canvas grades # Interactive course selection + detailed grades
55
- canvas grades <course-id> # Show detailed grades for specific course
56
- canvas announcements # Show recent announcements
57
- canvas profile # Show user profile
58
- canvas submit # Interactive assignment submission
59
- ```
60
-
61
- ### Assignment Submission
62
-
63
- ```bash
64
- canvas submit # Interactive mode
65
- canvas submit -c <courseId> # Specify course
66
- canvas submit -a <assignmentId> # Specify assignment
67
- canvas submit -f <file> # Submit specific file
68
- ```
69
-
70
- ### Viewing Grades
71
-
72
- The grades command provides an enhanced, interactive experience:
73
-
74
- ```bash
75
- canvas grades # Interactive course selection (active courses)
76
- canvas grades --all # Include inactive/completed courses
77
- canvas grades <course-id> # Direct course grade view
78
- canvas grades --verbose # Include enrollment details
79
- canvas grades -a -v # All courses with verbose details
80
- ```
81
-
82
- **Features:**
83
- - 📊 Interactive course selection with grade summary table
84
- - 📝 Detailed assignment breakdown with scores
85
- - Color-coded status indicators (graded, pending, not done)
86
- - 📈 Calculated totals based on graded assignments
87
- - 📋 Table-formatted overall grades
88
- - 🔍 Option to view all courses including inactive ones
89
- - 🎯 Visual progress tracking with emojis
90
-
91
- **What you'll see:**
92
- 1. List of all courses with current/final scores
93
- 2. Select a course to view detailed breakdown
94
- 3. Overall grades (Canvas official + calculated average)
95
- 4. Complete assignment list with individual scores
96
- 5. Points earned vs points possible
97
- 6. Assignment submission status
98
-
99
- ## Command Reference
100
-
101
- | Command | Alias | Description |
102
- |-----------------|-----------|-----------------------------------|
103
- | `list` | `l` | List courses |
104
- | `assignments` | `assign` | List assignments |
105
- | `submit` | `sub` | Submit assignment files |
106
- | `grades` | `grade` | Show grades |
107
- | `announcements` | `announce`| Show announcements |
108
- | `profile` | `me` | Show user profile |
109
- | `config` | - | Show configuration |
110
-
111
- ## Requirements
112
-
113
- - Node.js >= 14.x
114
- - npm >= 6.x
115
- - Valid Canvas LMS API token
116
-
117
- ## Contributing
118
-
119
- 1. Fork the repository
120
- 2. Create a feature branch: `git checkout -b feature-name`
121
- 3. Make your changes
122
- 4. Run tests: `npm test`
123
- 5. Commit: `git commit -am 'Add feature'`
124
- 6. Push: `git push origin feature-name`
125
- 7. Submit a pull request
126
-
127
- ## License
128
-
129
- MIT License - see [LICENSE](LICENSE) for details.
1
+ # Canvas CLI Tool
2
+
3
+ A modern, user-friendly command-line interface for Canvas LMS. Manage courses, assignments, submissions, grades, and more directly from your terminal.
4
+
5
+ ## Features
6
+
7
+ - List and filter enrolled/starred courses
8
+ - View assignments, grades, and submission status
9
+ - Interactive file upload for assignments
10
+ - View course announcements
11
+ - Display user profile information
12
+ - Direct access to Canvas API endpoints
13
+
14
+ ## Installation
15
+
16
+ ### Global (Recommended)
17
+
18
+ ```bash
19
+ npm install -g canvaslms-cli
20
+ ```
21
+
22
+ ## Setup
23
+
24
+ 1. **Get your Canvas API Token**
25
+ - Log in to Canvas
26
+ - Go to Account → Settings
27
+ - Under Approved Integrations, click + New Access Token
28
+ - Copy the generated token
29
+
30
+ 2. **Configure the CLI**
31
+
32
+ ```bash
33
+ canvas config
34
+ ```
35
+
36
+ 3. **Environment Variables**
37
+
38
+ Create a `.env` file in your project root:
39
+
40
+ ```env
41
+ CANVAS_DOMAIN=your-canvas-domain.instructure.com
42
+ CANVAS_API_TOKEN=your-api-token
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### Common Commands
48
+
49
+ ```bash
50
+ canvas config # Configure domain and API token
51
+ canvas list # List starred courses
52
+ canvas list -a # List all enrolled courses
53
+ canvas assignments <course> # List assignments for a course
54
+ canvas grades # Interactive course selection + detailed grades
55
+ canvas grades <course-id> # Show detailed grades for specific course
56
+ canvas announcements # Show recent announcements
57
+ canvas profile # Show user profile
58
+ canvas submit # Interactive assignment submission
59
+ ```
60
+
61
+ ### Assignment Submission
62
+
63
+ ```bash
64
+ canvas submit # Interactive mode
65
+ canvas submit -c <courseId> # Specify course
66
+ canvas submit -a <assignmentId> # Specify assignment
67
+ canvas submit -f <file> # Submit specific file
68
+ ```
69
+
70
+ ### Viewing Grades
71
+
72
+ The grades command provides an enhanced, interactive experience:
73
+
74
+ ```bash
75
+ canvas grades # Interactive course selection (active courses)
76
+ canvas grades --all # Include inactive/completed courses
77
+ canvas grades <course-id> # Direct course grade view
78
+ canvas grades --verbose # Include enrollment details
79
+ canvas grades -a -v # All courses with verbose details
80
+ ```
81
+
82
+ **Features:**
83
+
84
+ - 📊 Interactive course selection with grade summary table
85
+ - 📝 Detailed assignment breakdown with scores
86
+ - Color-coded status indicators (graded, pending, not done)
87
+ - 📈 Calculated totals based on graded assignments
88
+ - 📋 Table-formatted overall grades
89
+ - 🔍 Option to view all courses including inactive ones
90
+ - 🎯 Visual progress tracking with emojis
91
+
92
+ **What you'll see:**
93
+
94
+ 1. List of all courses with current/final scores
95
+ 2. Select a course to view detailed breakdown
96
+ 3. Overall grades (Canvas official + calculated average)
97
+ 4. Complete assignment list with individual scores
98
+ 5. Points earned vs points possible
99
+ 6. Assignment submission status
100
+
101
+ ## Command Reference
102
+
103
+ | Command | Alias | Description |
104
+ | --------------- | ---------- | ----------------------- |
105
+ | `list` | `l` | List courses |
106
+ | `assignments` | `assign` | List assignments |
107
+ | `submit` | `sub` | Submit assignment files |
108
+ | `grades` | `grade` | Show grades |
109
+ | `announcements` | `announce` | Show announcements |
110
+ | `profile` | `me` | Show user profile |
111
+ | `config` | - | Show configuration |
112
+
113
+ ## Requirements
114
+
115
+ - Node.js >= 14.x
116
+ - npm >= 6.x
117
+ - Valid Canvas LMS API token
118
+
119
+ ## Contributing
120
+
121
+ 1. Fork the repository
122
+ 2. Create a feature branch: `git checkout -b feature-name`
123
+ 3. Make your changes
124
+ 4. Run tests: `npm test`
125
+ 5. Commit: `git commit -am 'Add feature'`
126
+ 6. Push: `git push origin feature-name`
127
+ 7. Submit a pull request
128
+
129
+ ## License
130
+
131
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -1,3 +1,3 @@
1
- import type { ShowAnnouncementsOptions } from '../types/index.js';
2
- export declare function showAnnouncements(courseId?: string, options?: ShowAnnouncementsOptions): Promise<void>;
1
+ import type { ShowAnnouncementsOptions } from "../types/index.js";
2
+ export declare function showAnnouncements(courseName?: string, options?: ShowAnnouncementsOptions): Promise<void>;
3
3
  //# sourceMappingURL=announcements.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"announcements.d.ts","sourceRoot":"","sources":["../../commands/announcements.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAsB,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,wBAAsB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEhH"}
1
+ {"version":3,"file":"announcements.d.ts","sourceRoot":"","sources":["../../commands/announcements.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,wBAAsB,iBAAiB,CACrC,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAiFf"}
@@ -1,55 +1,64 @@
1
- import { makeCanvasRequest } from '../lib/api-client.js';
2
- import { createReadlineInterface, askQuestion } from '../lib/interactive.js';
3
- import { pickCourse, displayAnnouncements, displayAnnouncementDetail, printInfo, printError, printSuccess, printWarning } from '../lib/display.js';
4
- import chalk from 'chalk';
5
- export async function showAnnouncements(courseId, options = {}) {
1
+ import { makeCanvasRequest, getCanvasCourse } from "../lib/api-client.js";
2
+ import { createReadlineInterface, askQuestion } from "../lib/interactive.js";
3
+ import { pickCourse, displayAnnouncements, displayAnnouncementDetail, printInfo, printError, printSuccess, printWarning, } from "../lib/display.js";
4
+ import chalk from "chalk";
5
+ export async function showAnnouncements(courseName, options = {}) {
6
6
  let rl = null;
7
7
  try {
8
- let selectedCourseId = courseId;
9
- if (!selectedCourseId) {
10
- const result = await pickCourse({ title: '\nLoading your courses, please wait...' });
8
+ let selectedCourseId;
9
+ if (!courseName) {
10
+ const result = await pickCourse({
11
+ title: "\nLoading your courses, please wait...",
12
+ });
11
13
  if (!result)
12
14
  return;
13
15
  selectedCourseId = result.course.id.toString();
14
16
  rl = result.rl;
15
17
  }
16
18
  else {
19
+ const course = await getCanvasCourse(courseName);
20
+ if (!course) {
21
+ printError(`Course "${courseName}" not found.`);
22
+ return;
23
+ }
24
+ selectedCourseId = course.id.toString();
25
+ printSuccess(`✓ Using course: ${course.name}`);
17
26
  rl = createReadlineInterface();
18
27
  }
19
- const limit = parseInt(options.limit || '5') || 5;
20
- printInfo('Loading announcements...');
21
- const announcements = await makeCanvasRequest('get', `courses/${selectedCourseId}/discussion_topics`, [`only_announcements=true`, `per_page=${limit}`]);
28
+ const limit = parseInt(options.limit || "5") || 5;
29
+ printInfo("Loading announcements...");
30
+ const announcements = await makeCanvasRequest("get", `courses/${selectedCourseId}/discussion_topics`, [`only_announcements=true`, `per_page=${limit}`]);
22
31
  if (!announcements || announcements.length === 0) {
23
- printWarning('No announcements found for this course.');
32
+ printWarning("No announcements found for this course.");
24
33
  rl?.close();
25
34
  return;
26
35
  }
27
36
  printSuccess(`Found ${announcements.length} announcement(s).`);
28
37
  const announcementTable = displayAnnouncements(announcements);
29
- const annChoice = await askQuestion(rl, chalk.bold.cyan('\nEnter announcement number to view details (0 to exit): '));
38
+ const annChoice = await askQuestion(rl, chalk.bold.cyan("\nEnter announcement number to view details (0 to exit): "));
30
39
  announcementTable.stopWatching();
31
- if (!annChoice.trim() || annChoice === '0') {
32
- printWarning('Exiting announcements viewer.');
40
+ if (!annChoice.trim() || annChoice === "0") {
41
+ printWarning("Exiting announcements viewer.");
33
42
  rl?.close();
34
43
  return;
35
44
  }
36
45
  const annIndex = parseInt(annChoice) - 1;
37
46
  if (annIndex < 0 || annIndex >= announcements.length) {
38
- printError('Invalid announcement selection.');
47
+ printError("Invalid announcement selection.");
39
48
  rl?.close();
40
49
  return;
41
50
  }
42
51
  const ann = announcements[annIndex];
43
52
  displayAnnouncementDetail({
44
- title: ann?.title || 'Untitled',
53
+ title: ann?.title || "Untitled",
45
54
  postedAt: ann?.posted_at || null,
46
- author: ann?.author?.display_name || 'Unknown',
47
- message: ann?.message || 'No content'
55
+ author: ann?.author?.display_name || "Unknown",
56
+ message: ann?.message || "No content",
48
57
  });
49
58
  }
50
59
  catch (error) {
51
60
  const errorMessage = error instanceof Error ? error.message : String(error);
52
- console.error(chalk.red('Error: Failed to fetch announcements: ') + errorMessage);
61
+ console.error(chalk.red("Error: Failed to fetch announcements: ") + errorMessage);
53
62
  }
54
63
  finally {
55
64
  rl?.close();
@@ -1 +1 @@
1
- {"version":3,"file":"announcements.js","sourceRoot":"","sources":["../../commands/announcements.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,yBAAyB,EACzB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,YAAY,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,QAAiB,EAAE,UAAoC,EAAE;IAC/F,IAAI,EAAE,GAAsD,IAAI,CAAC;IAEjE,IAAI,CAAC;QACH,IAAI,gBAAgB,GAAG,QAAQ,CAAC;QAEhC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,EAAE,KAAK,EAAE,wCAAwC,EAAE,CAAC,CAAC;YACrF,IAAI,CAAC,MAAM;gBAAE,OAAO;YAEpB,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC/C,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,EAAE,GAAG,uBAAuB,EAAE,CAAC;QACjC,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QAClD,SAAS,CAAC,0BAA0B,CAAC,CAAC;Q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E,CAAC;YACZ,OAAO;QACT,CAAC;QAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,QAAQ,GAAG,CAAC,IAAI,QAAQ,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;YACrD,UAAU,CAAC,iCAAiC,CAAC,CAAC;YAC9C,EAAE,EAAE,KAAK,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QACpC,yBAAyB,CAAC;YACxB,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,UAAU;YAC/B,QAAQ,EAAE,GAAG,EAAE,SAAS,IAAI,IAAI;YAChC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,IAAI,SAAS;YAC9C,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,YAAY;SACtC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CAAC,wCAAwC,CAAC,GAAG,YAAY,CACnE,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,EAAE,EAAE,KAAK,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { ApiQueryOptions } from '../types/index.js';
1
+ import type { ApiQueryOptions } from "../types/index.js";
2
2
  export declare function createQueryHandler(method: string): (endpoint: string, options: ApiQueryOptions) => Promise<void>;
3
3
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../commands/api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,IACzB,UAAU,MAAM,EAAE,SAAS,eAAe,KAAG,OAAO,CAAC,IAAI,CAAC,CAIjF"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../commands/api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKzD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,IAE7C,UAAU,MAAM,EAChB,SAAS,eAAe,KACvB,OAAO,CAAC,IAAI,CAAC,CASjB"}
@@ -1,4 +1,4 @@
1
- import { makeCanvasRequest } from '../lib/api-client.js';
1
+ import { makeCanvasRequest } from "../lib/api-client.js";
2
2
  export function createQueryHandler(method) {
3
3
  return async function (endpoint, options) {
4
4
  const data = await makeCanvasRequest(method, endpoint, options.query || [], options.body || null);
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../commands/api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAMzD,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,KAAK,WAAU,QAAgB,EAAE,OAAwB;QAC9D,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;QAClG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../commands/api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAMzD,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,KAAK,WACV,QAAgB,EAChB,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAClC,MAAM,EACN,QAAQ,EACR,OAAO,CAAC,KAAK,IAAI,EAAE,EACnB,OAAO,CAAC,IAAI,IAAI,IAAI,CACrB,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { ListAssignmentsOptions } from '../types/index.js';
2
- export declare function listAssignments(courseId?: string, options?: ListAssignmentsOptions): Promise<void>;
1
+ import type { ListAssignmentsOptions } from "../types/index.js";
2
+ export declare function listAssignments(courseName?: string, options?: ListAssignmentsOptions): Promise<void>;
3
3
  //# sourceMappingURL=assignments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../commands/assignments.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkC,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEhG,wBAAsB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAyD5G"}
1
+ {"version":3,"file":"assignments.d.ts","sourceRoot":"","sources":["../../commands/assignments.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAGV,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,wBAAsB,eAAe,CACnC,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAmEf"}