moodle-cli 0.8.0 → 0.9.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/README.md CHANGED
@@ -67,6 +67,14 @@ moodle
67
67
 
68
68
  On first use, enter your Moodle site origin, such as `https://moodle.example.edu`. `moodle-cli` validates it and saves it to `~/.config/moodle-cli/config.yaml`. If the CLI cannot find an active session, it opens your university's sign-in page and waits for you to finish.
69
69
 
70
+ On macOS the cookie store sits behind Full Disk Access, which is granted to your terminal application rather than to the CLI. If `moodle doctor` reports that the store cannot be opened, either grant that access and restart the terminal, or hand the cookie over once:
71
+
72
+ ```bash
73
+ moodle auth login --paste
74
+ ```
75
+
76
+ The prompt does not echo, and the value is kept in the encrypted session cache, so this is a one-time step. Paste whatever the browser gives you: in the developer tools' Network tab, `Copy as cURL` on any request to the site carries the cookie, as does the `MoodleSession` value from the cookie panel.
77
+
70
78
  Keep the session active on macOS with `moodle auth keepalive install`. On Linux, schedule `moodle auth keepalive --json` every 30 minutes with cron.
71
79
 
72
80
  GitHub Releases also provide standalone binaries for macOS arm64 and Linux x64.
@@ -96,7 +104,7 @@ moodle news UNIT
96
104
  ```
97
105
 
98
106
  Ambiguous references list candidates. JSON callers receive `error.code: "ambiguous"`;
99
- TTY users can select a numbered match. A bare number in a section reference matches
107
+ At a terminal you pick the match from a list (arrow keys, or type to filter a long one). A bare number in a section reference matches
100
108
  that number in the site's section name, so 7 never matches 17.
101
109
 
102
110
  #### Paste Moodle links directly
@@ -115,6 +123,24 @@ You can paste the same links into your agent and ask it to inspect the page, fin
115
123
 
116
124
  `moodle download` accepts an activity ID or an authenticated Moodle URL. `--dest` sets the exact local path, and `--force` replaces an existing file after the download completes. Folder activities expose `files` so you can choose which files to save.
117
125
 
126
+ #### Submit assignment files
127
+
128
+ `moodle submit` uploads local files into an assignment through the same pages a browser
129
+ uses, then prints the receipt Moodle shows afterwards: status, files, due date and the
130
+ time it was checked. It is the only command that writes to Moodle.
131
+
132
+ ```bash
133
+ moodle submit "UNIT TASK" essay.pdf --dry-run # plan only: limits, statement, existing files
134
+ moodle submit "UNIT TASK" essay.pdf # upload; Moodle keeps a draft where drafts are allowed
135
+ moodle submit "UNIT TASK" --final --accept-statement # submit the draft for grading (cannot be undone)
136
+ ```
137
+
138
+ Every run plans first and asks for confirmation; `--yes` skips the prompt for scripts.
139
+ `--replace` removes the files already in the submission, `--accept-statement` agrees to
140
+ the site's submission statement when one is required, and a file that is too large or of
141
+ the wrong type is refused before anything is uploaded. Assignments without drafts submit
142
+ on save; the receipt reports what the site did.
143
+
118
144
  ### Remote MCP for web AI
119
145
 
120
146
  A private remote MCP server lets a supported web AI client use Moodle when it cannot run the local CLI. You need a Cloudflare account.
@@ -128,6 +154,8 @@ moodle mcp status
128
154
 
129
155
  The MCP `get_file` tool accepts a resource activity ID, resource URL, or `pluginfile.php` URL and returns files up to 16 MiB directly as an embedded MCP resource. The Moodle session stays inside the local server or private Worker; clients do not need to fetch an authenticated Moodle URL themselves.
130
156
 
157
+ The remote server is read-only. The local server (`moodle mcp serve`) also offers `submit`, which needs the files on the same machine. It defaults to `dry_run: true`, so an agent has to show the plan and run it again with `dry_run: false` to upload; `final: true` submits for grading.
158
+
131
159
  ### Update
132
160
 
133
161
  ```bash
@@ -154,7 +182,7 @@ Commands support:
154
182
  - `--fields units,total` to select envelope fields
155
183
  - `-o, --output FILE` to write command output or a download receipt
156
184
 
157
- The CLI prints tables in an interactive terminal and JSON when stdout goes to a pipe or file. Structured errors use one JSON object on stderr:
185
+ The CLI prints tables in an interactive terminal and JSON when stdout goes to a pipe or file. In a terminal, a command missing its unit asks for it with a picker (`moodle activities` lists your units); pipes, `--json` and agent shells get the usage error with the usage line instead. Structured errors use one JSON object on stderr:
158
186
 
159
187
  ```json
160
188
  {"ok":false,"error":{"code":"auth","message":"...","hint":"..."},"exit_code":3}
@@ -298,7 +326,8 @@ and `name`. Dates include ISO offsets and epoch seconds. Unit detail defaults to
298
326
  section index; pass a section for activities. `--fields` selects envelope keys.
299
327
 
300
328
  The 11 default MCP tools are home, due, units, unit, find, item, grades, news, thread,
301
- search_forums and file. Old names remain callable through 0.8 with the new envelopes;
329
+ search_forums and file; a local server adds submit, whose `submission` envelope is the
330
+ upload receipt. Old names remain callable through 0.8 with the new envelopes;
302
331
  they are deprecated and omitted from default discovery to avoid duplicate catalog cost.
303
332
  The local command tree remains available, including courses as an alias for units.
304
333
  The unused projects/quiet aliases were removed. `--verbose` (`-v`) prints sanitized
package/SKILL.md CHANGED
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: moodle-cli
3
- description: Read Moodle units, deadlines, grades, announcements and files; diagnose sign-in and manage a private MCP server.
3
+ description: Read Moodle units, deadlines, grades, announcements and files; submit assignment files; diagnose sign-in and manage a private MCP server.
4
4
  ---
5
5
 
6
6
  # Moodle CLI
7
7
 
8
- Read-only Moodle data. UNIT is a site code/name, id or URL; SECTION is a number or name.
8
+ Reads Moodle; only `submit` writes. UNIT is a site code/name, id or URL; SECTION is a number or name.
9
9
  Never assume code patterns or ask for ids. `moodle units` shows the site's vocabulary.
10
10
 
11
11
  | Intent | Run |
@@ -19,12 +19,13 @@ Never assume code patterns or ask for ids. `moodle units` shows the site's vocab
19
19
  | my grades | moodle grades [UNIT] |
20
20
  | announcements | moodle news [UNIT] |
21
21
  | forum post text | moodle forums search "QUERY" --unit UNIT |
22
+ | upload assignment files | moodle submit "UNIT TASK" FILE... [--final] |
22
23
  | download a file | moodle get "UNIT TASK" --to DIR |
23
24
 
24
25
  Pipes emit compact JSON; `--json` forces it, `--pretty` indents it.
25
26
  Ambiguity returns `candidates`: pick or refine, never guess.
26
27
  Lists report `total`; narrow or page when more exist. Quote ISO dates with offsets.
27
- Never expose cookies or tokens. Only download when requested.
28
+ Never expose cookies or tokens. Download or submit only when asked; dry-run submit first. `--final` cannot be undone.
28
29
  Sign-in trouble: `moodle doctor`; remote expiry: `moodle mcp login`.
29
30
  Exact syntax: `moodle commands --json` or [reference](references/command-reference.md).
30
31
  Setup, MCP and removal: [guide](references/setup-and-auth.md).
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Moodle CLI"
3
- short_description: "Inspect Moodle and retrieve authenticated course files"
3
+ short_description: "Inspect Moodle, retrieve authenticated course files and submit assignment files"
4
4
  default_prompt: "Use $moodle-cli to inspect my Moodle data, retrieve a file through MCP, or download selected files locally with the narrowest relevant operation."