@lukeguo12210/canvas-cli 0.0.1
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/LICENSE +99 -0
- package/README.md +216 -0
- package/dist/bin/canvas.d.ts +2 -0
- package/dist/bin/canvas.js +1160 -0
- package/dist/bin/canvas.js.map +1 -0
- package/package.json +49 -0
- package/skills/canvas-assignments/SKILL.md +30 -0
- package/skills/canvas-courses/SKILL.md +121 -0
- package/skills/canvas-files/SKILL.md +32 -0
- package/skills/canvas-modules/SKILL.md +42 -0
- package/skills/canvas-review/SKILL.md +40 -0
- package/skills/canvas-shared/SKILL.md +82 -0
- package/skills/canvas-shared/references/auth.md +67 -0
- package/skills/canvas-shared/references/output.md +46 -0
- package/skills/canvas-shared/references/pagination.md +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
License text copyright © 2024 MariaDB plc, All Rights Reserved.
|
|
4
|
+
"Business Source License" is a trademark of MariaDB plc.
|
|
5
|
+
|
|
6
|
+
Licensor: Luke Guo
|
|
7
|
+
|
|
8
|
+
Licensed Work: canvas-cli
|
|
9
|
+
|
|
10
|
+
Additional Use Grant:
|
|
11
|
+
|
|
12
|
+
You may make production use of the Licensed Work for personal, educational,
|
|
13
|
+
research, academic, non-commercial, and internal evaluation purposes, provided
|
|
14
|
+
your use does not include offering the Licensed Work to third parties as a
|
|
15
|
+
commercial hosted service, managed service, paid integration, or competing
|
|
16
|
+
product offering that exposes Canvas LMS automation, Canvas LMS agent access,
|
|
17
|
+
Canvas LMS data export, or Canvas LMS workflow capabilities.
|
|
18
|
+
|
|
19
|
+
For uses outside this Additional Use Grant, contact the Licensor for a separate
|
|
20
|
+
commercial license.
|
|
21
|
+
|
|
22
|
+
Change Date: 2030-05-29
|
|
23
|
+
|
|
24
|
+
Change License: GNU Affero General Public License v3.0 or later
|
|
25
|
+
|
|
26
|
+
Terms
|
|
27
|
+
|
|
28
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
29
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
30
|
+
Licensor may make an Additional Use Grant, above, permitting limited production
|
|
31
|
+
use.
|
|
32
|
+
|
|
33
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
34
|
+
available distribution of a specific version of the Licensed Work under this
|
|
35
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
36
|
+
the terms of the Change License, and the rights granted in the paragraph above
|
|
37
|
+
terminate.
|
|
38
|
+
|
|
39
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
40
|
+
currently in effect as described in this License, you must purchase a
|
|
41
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
42
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
43
|
+
|
|
44
|
+
All copies of the original and modified Licensed Work, and derivative works of
|
|
45
|
+
the Licensed Work, are subject to this License. This License applies separately
|
|
46
|
+
for each version of the Licensed Work and the Change Date may vary for each
|
|
47
|
+
version of the Licensed Work released by Licensor.
|
|
48
|
+
|
|
49
|
+
You must conspicuously display this License on each original or modified copy
|
|
50
|
+
of the Licensed Work. If you receive the Licensed Work in original or modified
|
|
51
|
+
form from a third party, the terms and conditions set forth in this License
|
|
52
|
+
apply to your use of that work.
|
|
53
|
+
|
|
54
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
55
|
+
terminate your rights under this License for the current and all other versions
|
|
56
|
+
of the Licensed Work.
|
|
57
|
+
|
|
58
|
+
This License does not grant you any right in any trademark or logo of Licensor
|
|
59
|
+
or its affiliates (provided that you may use a trademark or logo of Licensor as
|
|
60
|
+
expressly required by this License).
|
|
61
|
+
|
|
62
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
|
|
63
|
+
"AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
|
|
64
|
+
OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
|
|
66
|
+
|
|
67
|
+
MariaDB hereby grants you permission to use this License's text to license your
|
|
68
|
+
works, and to refer to it using the trademark "Business Source License", as
|
|
69
|
+
long as you comply with the Covenants of Licensor below.
|
|
70
|
+
|
|
71
|
+
Covenants of Licensor
|
|
72
|
+
|
|
73
|
+
In consideration of the right to use this License's text and the "Business
|
|
74
|
+
Source License" name and trademark, Licensor covenants to MariaDB, and to all
|
|
75
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
76
|
+
|
|
77
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
78
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
79
|
+
where "compatible" means that software provided under the Change License can
|
|
80
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
81
|
+
later version. Licensor may specify additional Change Licenses without
|
|
82
|
+
limitation.
|
|
83
|
+
|
|
84
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
85
|
+
impose any additional restriction on the right granted in this License, as
|
|
86
|
+
the Additional Use Grant; or (b) insert the text "None".
|
|
87
|
+
|
|
88
|
+
3. To specify a Change Date.
|
|
89
|
+
|
|
90
|
+
4. Not to modify this License in any other way.
|
|
91
|
+
|
|
92
|
+
Notice
|
|
93
|
+
|
|
94
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
95
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
96
|
+
under an Open Source License, as stated in this License.
|
|
97
|
+
|
|
98
|
+
For more information on the use of the Business Source License generally,
|
|
99
|
+
please visit https://mariadb.com/bsl11/.
|
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# @lukeguo12210/canvas-cli
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
|
|
5
|
+
Canvas CLI for technical students and AI agents.
|
|
6
|
+
|
|
7
|
+
`@lukeguo12210/canvas-cli` turns Canvas LMS into a local, scriptable, agent-readable workspace. It is built for students who already live in terminals, editors, notebooks, and AI coding tools. Use the `canvas` command directly, or install the bundled skills so Codex, Claude Code, and other local agents can authenticate, understand your courses, pull materials, inspect upcoming work, and build review packs.
|
|
8
|
+
|
|
9
|
+
[Install](#installation--quick-start) · [Agent Skills](#agent-skills) · [Auth](#authentication) · [Commands](#command-system) · [Security](#security--privacy) · [License](#license) · [Roadmap](#roadmap)
|
|
10
|
+
|
|
11
|
+
## Why @lukeguo12210/canvas-cli?
|
|
12
|
+
|
|
13
|
+
- **Built for technical students** — bring Canvas into your terminal, scripts, and local AI workflow.
|
|
14
|
+
- **Agent-native design** — structured skills teach agents Canvas auth, pagination, course structure, and study workflows.
|
|
15
|
+
- **Course context in minutes** — after login, the CLI gathers who you are, what courses you are taking, and where you are in the semester.
|
|
16
|
+
- **Review-pack first** — export modules, pages, assignments, files, discussions, announcements, and calendar context into a structured local course folder.
|
|
17
|
+
- **Canvas-native commands** — simple commands such as `canvas courses list`, `canvas modules list`, and `canvas review pack`.
|
|
18
|
+
- **Local-first control** — personal access tokens stay local, and course exports are written to directories you choose.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
| Category | Capabilities |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| Auth | Interactive `canvas auth login`, school picker, Canvas settings walkthrough, local PAT config |
|
|
25
|
+
| Context | Post-login context bootstrap: user profile, active courses, planner, calendar, upcoming assignments, modules |
|
|
26
|
+
| Courses | List, search, inspect, and summarize active courses |
|
|
27
|
+
| Modules | Traverse modules and module items in Canvas order |
|
|
28
|
+
| Pages | Fetch pages and export Canvas HTML to Markdown |
|
|
29
|
+
| Files | List files/folders and download accessible course files safely |
|
|
30
|
+
| Assignments | List assignments, due dates, descriptions, visible attachments, and assignment groups |
|
|
31
|
+
| Calendar | Pull calendar, planner, and todo context for the semester |
|
|
32
|
+
| Discussions | Inspect discussion prompts and announcements where visible |
|
|
33
|
+
| Review Packs | Preserve Canvas course structure in an agent-readable local export |
|
|
34
|
+
| Agent Skills | Lark-style skills for Codex, Claude Code, and other local agents |
|
|
35
|
+
|
|
36
|
+
## Status
|
|
37
|
+
|
|
38
|
+
Early scaffold.
|
|
39
|
+
|
|
40
|
+
Implemented:
|
|
41
|
+
|
|
42
|
+
- TypeScript/Node package scaffold.
|
|
43
|
+
- `canvas --help` and `canvas version`.
|
|
44
|
+
- Core runtime utilities for output envelopes, redaction, config paths, pagination, and Canvas GET requests.
|
|
45
|
+
- Initial unit tests for the safety-critical runtime.
|
|
46
|
+
- Engineering PRD and executable build plan.
|
|
47
|
+
- Initial Lark-style skill bundle skeleton.
|
|
48
|
+
|
|
49
|
+
Planned next:
|
|
50
|
+
|
|
51
|
+
- `canvas auth login`.
|
|
52
|
+
- Canvas school picker and PAT setup flow.
|
|
53
|
+
- Post-login context bootstrap.
|
|
54
|
+
- Course/resource commands.
|
|
55
|
+
- Review packs.
|
|
56
|
+
|
|
57
|
+
## Installation & Quick Start
|
|
58
|
+
|
|
59
|
+
### Requirements
|
|
60
|
+
|
|
61
|
+
- Node.js 20+
|
|
62
|
+
- npm
|
|
63
|
+
- A Canvas personal access token generated from your own Canvas account
|
|
64
|
+
|
|
65
|
+
### Install
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install -g @lukeguo12210/canvas-cli
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Use
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# 1. Authenticate with your Canvas school
|
|
75
|
+
canvas auth login
|
|
76
|
+
|
|
77
|
+
# 2. Inspect the automatically gathered student context
|
|
78
|
+
canvas context show
|
|
79
|
+
|
|
80
|
+
# 3. List courses
|
|
81
|
+
canvas courses list
|
|
82
|
+
|
|
83
|
+
# 4. Build a local review pack
|
|
84
|
+
canvas review pack --course-id <course-id> --out ./review/<course>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Install Agent Skills
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx skills add @lukeguo12210/canvas-cli -g -y
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Agent Skills
|
|
94
|
+
|
|
95
|
+
| Skill | Description |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `canvas-shared` | Auth, token safety, output formats, pagination, raw API usage, common Canvas errors |
|
|
98
|
+
| `canvas-courses` | Course discovery, course name disambiguation, tabs, and overview |
|
|
99
|
+
| `canvas-modules` | Module traversal, module item resolution, Canvas course order |
|
|
100
|
+
| `canvas-files` | File metadata, folders, linked files, safe downloads |
|
|
101
|
+
| `canvas-assignments` | Assignments, due dates, descriptions, visible attachments |
|
|
102
|
+
| `canvas-review` | Review-pack workflow that preserves Canvas course structure |
|
|
103
|
+
|
|
104
|
+
Skills live in [`skills/`](skills/). Each domain skill points agents back to `canvas-shared` first, then gives quick decisions, command examples, Canvas concepts, common errors, and output expectations.
|
|
105
|
+
|
|
106
|
+
## Authentication
|
|
107
|
+
|
|
108
|
+
The MVP uses personal access tokens only.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
canvas auth login
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The login flow will:
|
|
115
|
+
|
|
116
|
+
1. Ask for your school.
|
|
117
|
+
2. Open your Canvas settings page.
|
|
118
|
+
3. Guide you through creating a personal access token.
|
|
119
|
+
4. Store the token locally.
|
|
120
|
+
5. Run a lightweight context bootstrap.
|
|
121
|
+
|
|
122
|
+
Personal access tokens are for local/self use. Do not paste tokens into hosted apps or share them with other users.
|
|
123
|
+
|
|
124
|
+
## Command System
|
|
125
|
+
|
|
126
|
+
`@lukeguo12210/canvas-cli` uses a simple Canvas-native command system.
|
|
127
|
+
|
|
128
|
+
### Student Workflows
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
canvas context show
|
|
132
|
+
canvas review pack --course-id <course-id> --out ./review/<course>
|
|
133
|
+
canvas review search --path ./review/<course> --query "dynamic programming"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Domain Commands
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
canvas courses list
|
|
140
|
+
canvas courses search "algorithms"
|
|
141
|
+
canvas modules list --course-id <course-id>
|
|
142
|
+
canvas assignments list --course-id <course-id>
|
|
143
|
+
canvas pages show --course-id <course-id> --page <url-or-id>
|
|
144
|
+
canvas files download <file-id> --out ./files
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Raw Read-Only API
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
canvas api get /api/v1/courses
|
|
151
|
+
canvas api get /api/v1/courses/<course-id>/modules --params '{"include":["items"]}'
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
MVP raw API access is GET-only.
|
|
155
|
+
|
|
156
|
+
## Output Formats
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
--format json # default, agent-friendly
|
|
160
|
+
--format pretty # human-readable
|
|
161
|
+
--format table # simple list output
|
|
162
|
+
--format ndjson # streaming/batch-friendly
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Security & Privacy
|
|
166
|
+
|
|
167
|
+
- Tokens are local and must never be printed.
|
|
168
|
+
- Logs and errors redact `Authorization`, `access_token`, `token`, and bearer values.
|
|
169
|
+
- The MVP refuses Canvas write methods.
|
|
170
|
+
- Review packs exclude grades, submissions, conversations, and group member lists by default.
|
|
171
|
+
- Downloads are constrained to the requested output directory.
|
|
172
|
+
- Pagination follows Canvas `Link` headers instead of guessing URLs.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
`@lukeguo12210/canvas-cli` is source-available under the Business Source License 1.1.
|
|
177
|
+
|
|
178
|
+
Personal, educational, research, academic, non-commercial, and internal evaluation use is permitted. Commercial hosted services, managed services, paid integrations, or competing product offerings require a separate commercial license until the Change Date.
|
|
179
|
+
|
|
180
|
+
Change Date: May 29, 2030.
|
|
181
|
+
|
|
182
|
+
Change License: GNU Affero General Public License v3.0 or later.
|
|
183
|
+
|
|
184
|
+
See [LICENSE](LICENSE).
|
|
185
|
+
|
|
186
|
+
## Roadmap
|
|
187
|
+
|
|
188
|
+
Near term:
|
|
189
|
+
|
|
190
|
+
- Implement `canvas auth login`.
|
|
191
|
+
- Add school registry and custom Canvas URL setup.
|
|
192
|
+
- Add post-login context bootstrap.
|
|
193
|
+
- Implement courses, tabs, modules, assignments, pages, and files.
|
|
194
|
+
- Build `canvas review pack`.
|
|
195
|
+
- Package skills for `npx skills add @lukeguo12210/canvas-cli -g -y`.
|
|
196
|
+
|
|
197
|
+
Later:
|
|
198
|
+
|
|
199
|
+
- Full student read surface: grades, submissions, quizzes, discussions, announcements, planner, groups, conversations.
|
|
200
|
+
- Optional write-capable student workflows with explicit commands and dedicated skills.
|
|
201
|
+
- Public npm release.
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
npm install
|
|
207
|
+
npm run typecheck
|
|
208
|
+
npm run test
|
|
209
|
+
npm run build
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Docs
|
|
213
|
+
|
|
214
|
+
- [Engineering PRD](docs/engineering-prd.md)
|
|
215
|
+
- [Executable Build Steps](docs/build-steps.md)
|
|
216
|
+
- [Read-Only-First Plan](docs/read-only-first.md)
|