@imstudium/cli 0.1.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/mcp.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "imstudium": {
4
+ "command": "npx",
5
+ "args": ["-y", "@imstudium/mcp"],
6
+ "env": {
7
+ "IMSTUDIUM_WORKSPACE": "~/Studium"
8
+ }
9
+ }
10
+ }
11
+ }
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@imstudium/cli",
3
+ "version": "0.1.1",
4
+ "description": "ImStudium CLI — study workspace from Stud.IP",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "author": "Patrick Schröppel",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/paddy-shrp/imstudium.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "homepage": "https://github.com/paddy-shrp/imstudium#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/paddy-shrp/imstudium/issues"
16
+ },
17
+ "keywords": [
18
+ "imstudium",
19
+ "studip",
20
+ "studium",
21
+ "mcp",
22
+ "cursor",
23
+ "claude",
24
+ "codex",
25
+ "windsurf",
26
+ "opencode"
27
+ ],
28
+ "bin": {
29
+ "imstudium": "./dist/cli.js"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "skills",
34
+ "mcp.json"
35
+ ],
36
+ "scripts": {
37
+ "build": "tsup",
38
+ "typecheck": "tsc --noEmit",
39
+ "clean": "rm -rf dist",
40
+ "prepublishOnly": "bun run build && bun run typecheck"
41
+ },
42
+ "dependencies": {
43
+ "@imstudium/sdk": "workspace:*",
44
+ "commander": "^13.1.0",
45
+ "playwright": "^1.52.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.15.21",
49
+ "tsup": "^8.5.0",
50
+ "tsx": "^4.19.4",
51
+ "typescript": "^5.8.3"
52
+ },
53
+ "engines": {
54
+ "node": ">=20"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ }
60
+ }
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: imstudium-cli
3
+ description: |
4
+ ImStudium CLI — sync Stud.IP course files, build ~/Studium workspace, plan Klausuren.
5
+ Use when the user mentions ImStudium, Studium, Stud.IP, course materials, Klausur dates, or exam prep from university LMS.
6
+ allowed-tools:
7
+ - Bash(imstudium *)
8
+ - Bash(npx @imstudium/cli *)
9
+ - Bash(npx -y @imstudium/cli@latest *)
10
+ ---
11
+
12
+ # imstudium cli
13
+
14
+ Command-line interface for ImStudium / Stud.IP. Sync materials, build agent workspace, plan exams.
15
+
16
+ ## When to use
17
+
18
+ - User wants course files offline from ImStudium
19
+ - User asks about Klausuren / exam timeline
20
+ - User needs `studium.json` for study planning
21
+ - Prefer **local workspace** after sync — no API calls until refresh
22
+
23
+ ## One-shot setup
24
+
25
+ ```bash
26
+ npx -y @imstudium/cli onboard --agents-only -y -o ~/Studium
27
+ imstudium login
28
+ imstudium init -o ~/Studium
29
+ ```
30
+
31
+ ## Updates
32
+
33
+ ```bash
34
+ imstudium update --json # upgrade + refresh harness; use --json for agents
35
+ ```
36
+
37
+ ## Quick commands
38
+
39
+ ```bash
40
+ imstudium status --json
41
+ imstudium --json studium
42
+ imstudium --json klausuren
43
+ imstudium sync --quiet --extract
44
+ imstudium extract --course "Analysis"
45
+ imstudium doctor --json
46
+ imstudium files tree --course "Analysis"
47
+ ```
48
+
49
+ ## Reading slides
50
+
51
+ After `extract`, each file has `extracted/<file>/content.md` and `pages/*.png`. Read the PNGs for diagrams and formulas (see `imstudium-visual` skill).
52
+
53
+ ## Auth
54
+
55
+ ```bash
56
+ imstudium login # local helper fallback until OAuth is registered
57
+ ```
58
+
59
+ ## Escalation
60
+
61
+ 1. `imstudium status --json` — auth + cliVersion
62
+ 2. `imstudium update --json` — upgrade + refresh harness
63
+ 3. `imstudium --json studium` — local overview
64
+ 4. `imstudium sync` — refresh from API
65
+ 5. MCP tools — see `@imstudium/mcp` skill
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: imstudium-klausuren
3
+ description: |
4
+ Klausur and exam timeline with days-remaining. Use when user asks about exams, Prüfungen, deadlines, "when is my Klausur".
5
+ ---
6
+
7
+ # imstudium klausuren
8
+
9
+ Exam planning from `klausuren.md` / `studium.json`.
10
+
11
+ ## Read timeline
12
+
13
+ ```bash
14
+ imstudium --json klausuren
15
+ ```
16
+
17
+ Or MCP: `studium_klausuren`
18
+
19
+ ## Confirmed vs unconfirmed
20
+
21
+ | Source | Trust |
22
+ |--------|-------|
23
+ | `event` (course calendar) | **Confirmed** — schedule around these |
24
+ | `achievement`, `miscellaneous` | **Unconfirmed** — ask student to verify |
25
+
26
+ ## Planning output
27
+
28
+ For each exam in the next 14 days:
29
+
30
+ 1. Date + `daysRemaining`
31
+ 2. Course title
32
+ 3. Location if known
33
+ 4. Top materials via `studium_find_materials`
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: imstudium-mcp
3
+ description: |
4
+ ImStudium MCP tools for all agent harnesses — studium overview, klausuren, course brief, find materials, sync.
5
+ Use when working inside an MCP-enabled agent instead of terminal.
6
+ ---
7
+
8
+ # imstudium mcp
9
+
10
+ MCP server: `@imstudium/mcp`
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ imstudium setup mcp
16
+ ```
17
+
18
+ ## Tool selection
19
+
20
+ | Intent | Tool |
21
+ |--------|------|
22
+ | Course map + search guidance | `studium_overview` (read `searchGuidance`) |
23
+ | Exams | `studium_klausuren` |
24
+ | One course | `studium_course_brief` |
25
+ | Find PDFs by filename | `studium_find_materials` |
26
+ | **Read/see slide content** | `studium_read_material` |
27
+ | Refresh | `imstudium_sync` |
28
+ | Auth check | `imstudium_whoami` |
29
+
30
+ ## Finding content (use YOUR search tools)
31
+
32
+ **No custom search MCP tool.** Cursor/Codex/Claude already grep and semantic-search — the harness only prepares the index.
33
+
34
+ After `studium_overview`, use `searchGuidance`:
35
+
36
+ ```
37
+ rg -i "backprop" ~/Studium/SS2026/*/search/corpus.jsonl
38
+ ```
39
+
40
+ Each JSONL line has `ref`, `text`, `pageImage`, `extractSlug`. Cite with `ref`, then read:
41
+
42
+ - `extracted/<extractSlug>/content.md` (## Page N)
43
+ - `extracted/<extractSlug>/pages/page-NNN.png` for slides
44
+
45
+ Or semantic-search `corpus.jsonl` / `content.md` with your harness indexer.
46
+
47
+ ## Workflow
48
+
49
+ ```
50
+ imstudium_whoami → studium_overview → studium_klausuren
51
+ → grep corpus.jsonl OR studium_find_materials
52
+ → studium_read_material → read pageImages
53
+ ```
54
+
55
+ Prefer local tools before `imstudium_sync` (network + auth).
56
+
57
+ ## Visual comprehension (important)
58
+
59
+ `studium_read_material` returns `content` (text) and `pageImages` (PNG paths). Slides carry diagrams, plots, and formulas that text misses — **read the `pageImages` files** with your image-reading tool before explaining slide content. Use the `page` argument to target one slide.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: imstudium-studium
3
+ description: |
4
+ Read the Studium workspace — courses, file counts, schedule context from studium.json.
5
+ Use after sync or when user asks "what courses am I in", "semester overview", "my Studium".
6
+ ---
7
+
8
+ # imstudium studium
9
+
10
+ Local semester map at `~/Studium/studium.json` (or `IMSTUDIUM_WORKSPACE`).
11
+
12
+ **Default:** current calendar semester only (e.g. `SS2026/`), not all past enrollments.
13
+
14
+ ## Read first (no network)
15
+
16
+ ```bash
17
+ imstudium --json studium
18
+ ```
19
+
20
+ Or MCP: `studium_overview`
21
+
22
+ ## Output includes
23
+
24
+ - Course list with slugs and file counts (current semester by default)
25
+ - `semesters`, `semesterSlug` — active Stud.IP semester
26
+ - `nextDeadlines` — upcoming exams
27
+ - Schedule entries per course
28
+
29
+ ## Refresh only when stale
30
+
31
+ ```bash
32
+ imstudium sync --quiet
33
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: imstudium-sync
3
+ description: |
4
+ Sync course files, wiki, news, and calendar from Stud.IP via ImStudium. Use when materials are missing, stale, or user says "refresh Studium", "download course files".
5
+ ---
6
+
7
+ # imstudium sync
8
+
9
+ Incremental sync from Stud.IP JSON:API to local workspace.
10
+
11
+ **Default:** syncs courses active in the **current calendar semester** into `~/Studium/SS2026/` (not all 50+ past enrollments).
12
+
13
+ ```bash
14
+ imstudium semesters # show current + recent semesters
15
+ imstudium courses list # current semester courses only
16
+ imstudium sync --semester WS2025-26 # pick a specific semester
17
+ imstudium sync --all-semesters # legacy: every enrollment
18
+ ```
19
+
20
+ ## Full refresh
21
+
22
+ ```bash
23
+ imstudium sync -o ~/Studium
24
+ imstudium sync --extract # also extract text + slide images
25
+ ```
26
+
27
+ Includes wiki, news, `calendar.ics`, rebuilds `studium.json`. With `--extract`, new/changed files get `extracted/<file>/content.md` + `pages/*.png`.
28
+
29
+ ## Preview (dry run)
30
+
31
+ ```bash
32
+ imstudium sync --dry-run --json
33
+ ```
34
+
35
+ Or MCP: `imstudium_sync_dry_run`
36
+
37
+ ## Cron
38
+
39
+ ```cron
40
+ 0 8 * * * imstudium sync --quiet --extract -o ~/Studium
41
+ ```
42
+
43
+ ## After sync
44
+
45
+ Always re-read: `imstudium --json studium`
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: imstudium-visual
3
+ description: |
4
+ MANDATORY when explaining slides, PDFs, diagrams, or formulas from ImStudium materials.
5
+ Text extraction is incomplete — you MUST read page PNGs or open viewer.html in Playwright/browser before answering.
6
+ Use after studium_read_material, imstudium view, or when user asks about slide content.
7
+ allowed-tools:
8
+ - Bash(imstudium view *)
9
+ - Bash(imstudium extract *)
10
+ - Bash(npx playwright *)
11
+ ---
12
+
13
+ # imstudium visual comprehension
14
+
15
+ Slides are **visual**. `content.md` text misses diagrams, plots, formulas, tables, and layout.
16
+
17
+ ## Rule (all agents)
18
+
19
+ **Never summarize slide content from text alone.** Before answering:
20
+
21
+ 1. Read **every** path in `pageImages`, OR
22
+ 2. Open `viewerFileUrl` (`file://.../viewer.html`) in Playwright / browser MCP and inspect each slide
23
+
24
+ ## Fast paths by harness
25
+
26
+ | Harness | What to do |
27
+ |---------|------------|
28
+ | **Cursor / Claude / Codex / Windsurf / OpenCode with Read/vision** | `Read` each `pageImages` file |
29
+ | **Playwright CLI** | `imstudium view --course "Analysis" --file "vorlesung 3"` → open printed `viewerFileUrl` |
30
+ | **Browser MCP** (cursor-ide-browser) | `browser_navigate` to `viewerFileUrl`, `browser_take_screenshot` per slide |
31
+ | **MCP only** | `studium_read_material` → follow `requiredAction` + `methods` in JSON response |
32
+ | **Terminal** | `imstudium view --dir ~/Studium/.../extracted/foo-pdf` |
33
+
34
+ ## MCP response fields
35
+
36
+ ```json
37
+ {
38
+ "requiredAction": "MANDATORY: Visually inspect all pageImages...",
39
+ "pageImages": ["/abs/path/pages/page-1.png", "..."],
40
+ "viewerHtml": "/abs/path/viewer.html",
41
+ "viewerFileUrl": "file:///abs/path/viewer.html",
42
+ "methods": [{ "id": "read_image", "action": "..." }, { "id": "playwright", "action": "..." }]
43
+ }
44
+ ```
45
+
46
+ Follow `requiredAction` literally.
47
+
48
+ ## Speed
49
+
50
+ - `studium_read_material` reuses cached extraction (manifest mtime) — fast on repeat
51
+ - `imstudium view` only writes `viewer.html` (~instant) — no re-render unless file changed
52
+ - Bulk `imstudium extract` does NOT auto-open browser — agents opt in per file
53
+
54
+ ## Playwright one-liner
55
+
56
+ ```bash
57
+ imstudium view --course "Analysis" --file "folien" --json
58
+ # → open viewerFileUrl in Playwright, screenshot each .slide img
59
+ ```
60
+
61
+ ## When pageImages is empty
62
+
63
+ Tell user: `imstudium doctor` then `imstudium extract --course "..."`. Poppler renders PDF slides; LibreOffice renders PPTX.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: imstudium-klausur-prep
3
+ description: |
4
+ Workflow — produce a Klausur prep brief for one course: exam date, days remaining, priority files, 60-min study block.
5
+ Use when user says "help me study for", "Klausur prep", "exam plan for [course]".
6
+ ---
7
+
8
+ # Workflow: Klausur prep
9
+
10
+ ## Inputs
11
+
12
+ - Course name (substring match)
13
+ - Optional: days until exam
14
+
15
+ ## Steps
16
+
17
+ 1. `studium_klausuren` — confirm exam date (confirmed vs unconfirmed)
18
+ 2. `studium_course_brief` — course context + `COURSE.md`
19
+ 3. `studium_find_materials` with queries: `klausur`, `übung`, `script`, `folien`
20
+ 4. `studium_read_material` on the top files — read the `pageImages` PNGs to actually see diagrams and formulas, then summarize key concepts per slide
21
+ 5. If no files: `imstudium_sync_dry_run` then `imstudium_sync`
22
+
23
+ ## Deliverable
24
+
25
+ ```markdown
26
+ ## [Course] — Klausur prep
27
+ - **Exam:** [date] ([N] days)
28
+ - **Status:** confirmed / verify manually
29
+ - **Priority files:** (top 3 paths)
30
+ - **60-min block:** [single focused task with done state]
31
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: imstudium-semester-refresh
3
+ description: |
4
+ Workflow — morning semester refresh: sync, overview, next 3 exams, flag stale courses.
5
+ Use for daily briefing, "what's due", "update my Studium".
6
+ ---
7
+
8
+ # Workflow: Semester refresh
9
+
10
+ ## Steps
11
+
12
+ 0. `imstudium update` — upgrade CLI + refresh harness
13
+ 1. `imstudium_whoami` — auth OK?
14
+ 2. `imstudium_sync` or CLI `imstudium sync --quiet`
15
+ 3. `studium_overview` — course list
16
+ 4. `studium_klausuren` — `nextDeadlines` top 3
17
+
18
+ ## Deliverable
19
+
20
+ ```markdown
21
+ ## Studium refresh — [date]
22
+ - **Courses:** N active
23
+ - **Next exams:** (top 3 with days remaining)
24
+ - **Action:** [one course needing attention — fewest files or nearest exam]
25
+ ```
26
+
27
+ ## Cron alignment
28
+
29
+ Matches `0 8 * * * imstudium sync --quiet` — run this workflow after sync in daily briefing.