@lukeguo12210/canvas-cli 0.0.2 → 0.0.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lukeguo12210/canvas-cli",
3
- "version": "0.0.2",
4
- "description": "Canvas LMS CLI and AI agent skills bundle for technical students.",
3
+ "version": "0.0.4",
4
+ "description": "Connect Canvas courses to AI agents: pull modules, files, assignments, pages, folders, and review packs without manual downloads.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "canvas": "dist/bin/canvas.js"
@@ -28,9 +28,12 @@
28
28
  "canvas-lms",
29
29
  "cli",
30
30
  "agents",
31
+ "ai-agents",
31
32
  "skills",
32
33
  "students",
33
- "education"
34
+ "education",
35
+ "study",
36
+ "coursework"
34
37
  ],
35
38
  "repository": {
36
39
  "type": "git",
@@ -48,6 +48,7 @@ Implemented now:
48
48
 
49
49
  - `canvas auth login`
50
50
  - `canvas auth status`
51
+ - `canvas auth schools search <query>`
51
52
  - `canvas auth logout`
52
53
  - `canvas config show`
53
54
  - `canvas me`
@@ -72,8 +73,8 @@ Planned but not implemented yet:
72
73
  ## Core Rules
73
74
 
74
75
  - Use `canvas auth status` first if auth state is uncertain.
75
- - If no auth config exists, ask the user to run `canvas auth login`.
76
- - Never print, paste, summarize, or expose a Canvas personal access token.
76
+ - If no auth config exists, use `canvas auth schools search <query>` and then `canvas auth login --school <query> --token-env <env>` or `canvas auth login --school <query> --token <token>` when the user explicitly provides a PAT.
77
+ - Never print, paste, summarize, or expose a Canvas personal access token after receiving it.
77
78
  - Default output is JSON and should be preferred for agents.
78
79
  - Use `--format pretty` only when presenting a compact human-facing result.
79
80
  - Use `--page-all` when completeness matters.
@@ -112,6 +113,7 @@ Do not include those in review packs unless the user explicitly asks.
112
113
 
113
114
  ```bash
114
115
  canvas auth status --format json
116
+ canvas auth schools search "Columbia" --format json
115
117
  canvas courses list --active --page-all --format json
116
118
  canvas courses search "course name" --format json
117
119
  canvas courses overview <course-id> --format json
@@ -4,6 +4,9 @@ Implemented auth commands:
4
4
 
5
5
  ```bash
6
6
  canvas auth login
7
+ canvas auth login --school "Columbia" --token-env CANVAS_TOKEN
8
+ canvas auth login --school-url https://courseworks2.columbia.edu --school-name "Columbia University (CourseWorks)" --token "paste-token-here"
9
+ canvas auth schools search "Columbia" --format json
7
10
  canvas auth status --format json
8
11
  canvas auth logout
9
12
  canvas config show --format json
@@ -15,11 +18,49 @@ If `canvas` is not on `PATH`, use the npm exec fallback:
15
18
  ```bash
16
19
  npm exec --yes --package @lukeguo12210/canvas-cli -- canvas auth status --format json
17
20
  npm exec --yes --package @lukeguo12210/canvas-cli -- canvas auth login
21
+ npm exec --yes --package @lukeguo12210/canvas-cli -- canvas auth login --school "Columbia" --token-env CANVAS_TOKEN
18
22
  ```
19
23
 
20
24
  Do not attempt `sudo npm install -g` from inside an agent session. Prefer the fallback above or ask the user to fix their npm global prefix.
21
25
 
22
- ## Login Flow
26
+ ## Agent Login Flow
27
+
28
+ Agents can complete login non-interactively when the user explicitly provides a Canvas PAT.
29
+
30
+ 1. Search schools:
31
+
32
+ ```bash
33
+ canvas auth schools search "Columbia" --format json
34
+ ```
35
+
36
+ 2. Login with a known school match:
37
+
38
+ ```bash
39
+ canvas auth login --school "Columbia" --token-env CANVAS_TOKEN
40
+ ```
41
+
42
+ or, if the user provides the token directly in chat:
43
+
44
+ ```bash
45
+ canvas auth login --school "Columbia" --token "paste-token-here"
46
+ ```
47
+
48
+ 3. For a custom Canvas URL:
49
+
50
+ ```bash
51
+ canvas auth login --school-url https://courseworks2.columbia.edu --school-name "Columbia University (CourseWorks)" --token-env CANVAS_TOKEN
52
+ ```
53
+
54
+ 4. Verify:
55
+
56
+ ```bash
57
+ canvas auth status --format json
58
+ canvas courses list --active --page-all --format json
59
+ ```
60
+
61
+ If `--school` matches multiple schools, run `canvas auth schools search <query>` and retry with a more specific value or use `--school-url`.
62
+
63
+ ## Interactive Login Flow
23
64
 
24
65
  `canvas auth login` is interactive.
25
66
 
@@ -40,9 +81,15 @@ Is this your school: Columbia University (CourseWorks) (https://courseworks2.col
40
81
  8. Validate token.
41
82
  9. Store local config.
42
83
 
43
- ## Token Safety
84
+ ## Token Handling
85
+
86
+ The CLI supports agent-provided PATs for initial setup:
87
+
88
+ - `--token <PAT>`: direct token argument.
89
+ - `--token-env <ENV_NAME>`: read token from an environment variable.
90
+ - `--token-stdin`: read token from stdin.
44
91
 
45
- Never ask the user to paste a token into chat. The token should be pasted into the local terminal prompt from `canvas auth login`.
92
+ Prefer `--token-env` or `--token-stdin` when possible. If the user pastes a PAT into chat, use it only for `canvas auth login`, then do not repeat, print, summarize, or store it anywhere except the Canvas config written by the CLI.
46
93
 
47
94
  Never print:
48
95