upb-moodle-mcp 0.2.4 → 0.2.5
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 +46 -1
- package/bin/upb-moodle-doctor.js +5 -0
- package/bin/upb-moodle-install.js +6 -0
- package/bin/upb-moodle-mcp.js +3 -1
- package/bin/upb-moodle-uninstall.js +5 -0
- package/bin/upb-moodle-update.js +5 -0
- package/lib/run.js +26 -5
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -31,12 +31,57 @@ Dacă pachetul Python nu s-a instalat, după ce rezolvi cauza rulează `npm rebu
|
|
|
31
31
|
|---|---|
|
|
32
32
|
| `upb-moodle login` | te loghezi în Moodle în browser, cu UPB Login (o singură dată) |
|
|
33
33
|
| `upb-moodle auth-status` | verifică dacă ești logat |
|
|
34
|
-
| `upb-moodle install` | adaugă pluginul
|
|
34
|
+
| `upb-moodle install` | adaugă pluginul sau serverul MCP în toate CLI-urile |
|
|
35
|
+
| `upb-moodle uninstall` | scoate pluginul și/sau serverul MCP |
|
|
35
36
|
| `upb-moodle doctor` | verifică instalarea și arată ce lipsește |
|
|
36
37
|
| `upb-moodle courses --faculty ETTI --year 1 --sem 1` | cursurile unei facultăți, într-un semestru |
|
|
37
38
|
| `upb-moodle deadlines --days 14` | termenele din următoarele 14 zile |
|
|
38
39
|
| `upb-moodle download --year 1 --sem 1 --out <folder>` | materialele unui an și semestru |
|
|
39
40
|
|
|
41
|
+
### Binare pentru configurare
|
|
42
|
+
|
|
43
|
+
Pachetul adaugă patru binare scurte, ca să nu scrii comanda completă:
|
|
44
|
+
|
|
45
|
+
| Binar | Echivalent |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `upb-moodle-install <target> ...` | `upb-moodle install <target> ...` |
|
|
48
|
+
| `upb-moodle-uninstall <target> ...` | `upb-moodle uninstall <target> ...` |
|
|
49
|
+
| `upb-moodle-update <target> ...` | `upb-moodle update <target> ...` |
|
|
50
|
+
| `upb-moodle-doctor` | `upb-moodle doctor` |
|
|
51
|
+
|
|
52
|
+
Targete: `claude`, `codex`, `opencode`, `opencode2`, `antigravity`, `all`.
|
|
53
|
+
|
|
54
|
+
### Instalare directă prin npx (fără `npm install -g`)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Claude Code: plugin în folderul proiectului
|
|
58
|
+
npx -y upb-moodle-mcp install claude --scope project
|
|
59
|
+
|
|
60
|
+
# Claude Code: doar serverul MCP, global
|
|
61
|
+
npx -y upb-moodle-mcp install claude --mode mcp --scope global
|
|
62
|
+
|
|
63
|
+
# Codex: server MCP în .codex/config.toml din folder
|
|
64
|
+
npx -y upb-moodle-mcp install codex --scope project
|
|
65
|
+
|
|
66
|
+
# opencode 1 și opencode 2 (același fișier opencode.json, chei diferite)
|
|
67
|
+
npx -y upb-moodle-mcp install opencode --scope project
|
|
68
|
+
npx -y upb-moodle-mcp install opencode2 --scope global
|
|
69
|
+
|
|
70
|
+
# Antigravity (doar global)
|
|
71
|
+
npx -y upb-moodle-mcp install antigravity --mode mcp
|
|
72
|
+
|
|
73
|
+
# Toate, verificare, înlăturare
|
|
74
|
+
npx -y upb-moodle-mcp install all --scope project
|
|
75
|
+
npx -y upb-moodle-mcp doctor
|
|
76
|
+
npx -y upb-moodle-mcp uninstall all --scope all
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Scope:** `global` (implicit) sau `project` (cu `--project-dir DIR`). **Mod:** `auto` (implicit: plugin acolo unde există, MCP pe opencode/opencode2), `plugin` sau `mcp` (doar serverul). `uninstall` curăță ambele mecanisme, indiferent cum ai instalat. `opencode2` scrie `mcp.servers.upb-moodle`; `opencode` scrie `mcp.upb-moodle`, deci nu se suprascriu.
|
|
80
|
+
|
|
81
|
+
Detalii complete per platformă: [PLATFORMS.md](https://github.com/FiredMosquito831/upb-moodle-mcp/blob/main/docs/PLATFORMS.md).
|
|
82
|
+
|
|
83
|
+
Dacă pachetul Python lipsește, launcherul îl instalează automat (prin pipx sau `pip --user`). Setează `UPB_MOODLE_NO_AUTO_INSTALL=1` ca să primești eroare în schimb.
|
|
84
|
+
|
|
40
85
|
Lista completă, cu toate opțiunile: [USAGE.md](https://github.com/FiredMosquito831/upb-moodle-mcp/blob/main/docs/USAGE.md).
|
|
41
86
|
|
|
42
87
|
Pachetul are două binare:
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// npx -y upb-moodle-mcp install <target> [--scope global|project] [--mode auto|plugin|mcp]
|
|
5
|
+
// Numele binarului scurteaza comanda; argumentele ajung identice in CLI-ul Python.
|
|
6
|
+
require('../lib/run').launch('cli', ['install', ...process.argv.slice(2)]);
|
package/bin/upb-moodle-mcp.js
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
// Fara argumente: server MCP. Cu argumente: CLI-ul (ca upb-moodle), vezi mcp_server.main.
|
|
5
|
-
|
|
5
|
+
// Comenzile de configurare isi instaleaza singure pachetul Python daca lipseste (npx direct).
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
require('../lib/run').launch('mcp', args, args.length > 0);
|
package/lib/run.js
CHANGED
|
@@ -42,13 +42,34 @@ function findPython() {
|
|
|
42
42
|
return fallback;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// Instaleaza pachetul Python o singura data, doar pentru comenzile de configurare.
|
|
46
|
+
// npx ruleaza deja postinstall, dar o instalare veche/cached poate ramane fara modul.
|
|
47
|
+
function ensurePackage(py) {
|
|
48
|
+
if (process.env.UPB_MOODLE_NO_AUTO_INSTALL === '1') {
|
|
49
|
+
fail(`Pachetul upb-moodle nu e instalat pentru ${py.cmd}.\nRuleaza:\n ${INSTALL}`);
|
|
50
|
+
}
|
|
51
|
+
process.stderr.write(`[upb-moodle-mcp] instalez pachetul Python (${py.cmd})...\n`);
|
|
52
|
+
const pipx = spawnSync('pipx', ['install', '--force', SPEC], { stdio: 'inherit', windowsHide: true });
|
|
53
|
+
if (!pipx.error && pipx.status === 0) return;
|
|
54
|
+
const pip = spawnSync(py.cmd, [...py.pre, '-m', 'pip', 'install', '--user', '--quiet', SPEC], {
|
|
55
|
+
stdio: 'inherit', windowsHide: true,
|
|
56
|
+
});
|
|
57
|
+
if (pip.error || pip.status !== 0) {
|
|
58
|
+
fail(`Nu am putut instala pachetul Python. Ruleaza manual:\n ${INSTALL}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function launch(kind, args, ensure = true) {
|
|
63
|
+
let py = findPython();
|
|
47
64
|
if (!py) {
|
|
48
65
|
fail('Nu gasesc Python 3.10 sau mai nou in PATH. Instaleaza-l de pe python.org.');
|
|
49
66
|
}
|
|
50
|
-
if (!py.hasModule) {
|
|
51
|
-
|
|
67
|
+
if (!py.hasModule && ensure) {
|
|
68
|
+
ensurePackage(py);
|
|
69
|
+
py = findPython();
|
|
70
|
+
}
|
|
71
|
+
if (!py || !py.hasModule) {
|
|
72
|
+
fail(`Pachetul upb-moodle nu e instalat pentru ${py ? py.cmd : 'Python'}.\nRuleaza:\n ${INSTALL}`);
|
|
52
73
|
}
|
|
53
74
|
const child = spawn(py.cmd, [...py.pre, '-c', SCRIPTS[kind], ...args], {
|
|
54
75
|
stdio: 'inherit',
|
|
@@ -61,4 +82,4 @@ function launch(kind, args) {
|
|
|
61
82
|
child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)));
|
|
62
83
|
}
|
|
63
84
|
|
|
64
|
-
module.exports = { launch, findPython, INSTALL, SPEC };
|
|
85
|
+
module.exports = { launch, findPython, ensurePackage, INSTALL, SPEC };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upb-moodle-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "MCP server and CLI for Moodle POLITEHNICA București (curs.upb.ro/2026): courses, materials, assignments, forums, grades, quizzes, notifications and deadlines for Claude Code, Codex, opencode and Antigravity.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"moodle",
|
|
@@ -34,11 +34,19 @@
|
|
|
34
34
|
"type": "commonjs",
|
|
35
35
|
"bin": {
|
|
36
36
|
"upb-moodle": "bin/upb-moodle.js",
|
|
37
|
-
"upb-moodle-mcp": "bin/upb-moodle-mcp.js"
|
|
37
|
+
"upb-moodle-mcp": "bin/upb-moodle-mcp.js",
|
|
38
|
+
"upb-moodle-install": "bin/upb-moodle-install.js",
|
|
39
|
+
"upb-moodle-uninstall": "bin/upb-moodle-uninstall.js",
|
|
40
|
+
"upb-moodle-update": "bin/upb-moodle-update.js",
|
|
41
|
+
"upb-moodle-doctor": "bin/upb-moodle-doctor.js"
|
|
38
42
|
},
|
|
39
43
|
"scripts": {
|
|
40
44
|
"postinstall": "node scripts/postinstall.js",
|
|
41
|
-
"check": "node --check bin/upb-moodle.js && node --check bin/upb-moodle-mcp.js && node --check lib/run.js && node --check scripts/postinstall.js",
|
|
45
|
+
"check": "node --check bin/upb-moodle.js && node --check bin/upb-moodle-mcp.js && node --check bin/upb-moodle-install.js && node --check bin/upb-moodle-uninstall.js && node --check bin/upb-moodle-update.js && node --check bin/upb-moodle-doctor.js && node --check lib/run.js && node --check scripts/postinstall.js",
|
|
46
|
+
"add": "node bin/upb-moodle-install.js",
|
|
47
|
+
"remove": "node bin/upb-moodle-uninstall.js",
|
|
48
|
+
"update:mcp": "node bin/upb-moodle-update.js",
|
|
49
|
+
"doctor": "node bin/upb-moodle-doctor.js",
|
|
42
50
|
"pack:dry": "npm pack --dry-run"
|
|
43
51
|
},
|
|
44
52
|
"files": [
|