dsh-deeptutor 0.1.7 → 0.1.9
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 +226 -181
- package/README.zh.md +166 -133
- package/cordis.patch.yml +17 -17
- package/docs/demo/en-final-answer.png +0 -0
- package/docs/demo/en-study-page.png +0 -0
- package/docs/demo/final-answer.png +0 -0
- package/docs/demo/study-page.png +0 -0
- package/package.json +75 -66
- package/scripts/install-profile.mjs +233 -233
- package/scripts/md-to-html.js +381 -381
- package/scripts/sync-skills.mjs +46 -46
- package/skills/deeptutor/README.md +129 -129
- package/skills/deeptutor/SKILL.md +183 -183
- package/skills/html-doc/SKILL.md +91 -91
- package/skills/html-doc/scripts/md-to-html.js +381 -381
- package/src/cli-exec.ts +251 -251
- package/src/config.ts +71 -71
- package/src/html-render.ts +53 -53
- package/src/http-api.ts +98 -98
- package/src/index.ts +468 -468
- package/src/turn.ts +197 -197
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: deeptutor
|
|
3
|
-
description: Combine DeepTutor personal knowledge bases (RAG) with authoritative web sources to generate learning content, self-test questions, and study plans, and archive notes to a notebook. Works with both local and remote DeepTutor deployments. Use when the user wants to learn/review a technical topic (e.g. .NET, C#, SQL Server, React), get a deep explanation grounded in their own knowledge bases, generate exercises, or plan their learning.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# DeepTutor Learning Assistant (Personal Knowledge Base)
|
|
7
|
-
|
|
8
|
-
Combines the user's **personal knowledge bases** (RAG retrieval) with
|
|
9
|
-
**authoritative web sources** to produce learning content, self-test
|
|
10
|
-
questions, and study plans, then archives notes to a DeepTutor notebook.
|
|
11
|
-
|
|
12
|
-
This skill is **agent-agnostic**: every action below has two equivalent
|
|
13
|
-
drivers —
|
|
14
|
-
|
|
15
|
-
- **pi / dsh (with the pi deeptutor extension or the `dsh-deeptutor` bundle installed):** the `deeptutor_*` tools.
|
|
16
|
-
They auto-adapt local/remote deployment (HTTP/WS first with an automatic
|
|
17
|
-
SSH tunnel, CLI fallback) and stream progress.
|
|
18
|
-
- **Any agent / plain CLI:** the `deeptutor` executable directly (local
|
|
19
|
-
binary on PATH, or over SSH for remote deployments). No extension needed.
|
|
20
|
-
|
|
21
|
-
Pick whichever path exists in your environment; the action, not the tool, is
|
|
22
|
-
what matters.
|
|
23
|
-
|
|
24
|
-
## When to Use
|
|
25
|
-
|
|
26
|
-
- The user wants to learn or review a technical topic (.NET, C#, SQL Server, React, …)
|
|
27
|
-
- The user wants content grounded in their own notes/knowledge bases
|
|
28
|
-
- The user wants generated exercises, quizzes, or a learning plan
|
|
29
|
-
- The user wants to archive study notes for later review
|
|
30
|
-
|
|
31
|
-
## Configuration (env vars, agent-agnostic)
|
|
32
|
-
|
|
33
|
-
Nothing is hardcoded in this skill; all server parameters come from environment variables (put them in `~/.bashrc` or `~/.zshrc`; any agent — pi / dsh / Claude Code / Codex / opencode — inherits them at startup). **Deployment mode adapts automatically**:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# Remote deployment (DeepTutor on a server, reached through an SSH tunnel)
|
|
37
|
-
export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH host alias (set = remote mode)
|
|
38
|
-
export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local tunnel address (change port/server here)
|
|
39
|
-
export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
|
|
40
|
-
export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
|
|
41
|
-
|
|
42
|
-
# Local deployment (DeepTutor on this machine) — leave DEEPTUTOR_SSH_HOST unset for local mode
|
|
43
|
-
# export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local serve port
|
|
44
|
-
# export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
- **Tools path:** API reachable (local serve or tunnel) → HTTP/WS; unreachable →
|
|
48
|
-
local CLI or SSH CLI fallback automatically. The extension/bundle starts/recycles
|
|
49
|
-
the SSH tunnel; local mode needs no tunnel.
|
|
50
|
-
- **Plain CLI path:** run `deeptutor <subcommand>` locally, or
|
|
51
|
-
`ssh <DEEPTUTOR_SSH_HOST> <DEEPTUTOR_REMOTE_BIN> <subcommand>` for remote
|
|
52
|
-
deployments (the tunnel is the extension's job — CLI users don't need it).
|
|
53
|
-
- Migrating to another server or port only requires changing env vars — never this skill.
|
|
54
|
-
|
|
55
|
-
## Actions Cheat Sheet
|
|
56
|
-
|
|
57
|
-
| Action | Tools (`deeptutor_*`) | CLI equivalent (`deeptutor …`) |
|
|
58
|
-
| ---------------------------- | -------------------------------- | ------------------------------------------------------------ |
|
|
59
|
-
| List knowledge bases | `deeptutor_kb action=list` | `kb list --format json` |
|
|
60
|
-
| Search a knowledge base | `deeptutor_kb action=search` | `kb search <kb> "<query>" --format json --mode hybrid` |
|
|
61
|
-
| Show a knowledge base's info | `deeptutor_kb action=info` | `kb info <kb>` |
|
|
62
|
-
| Run a learning capability | `deeptutor_run capability=<cap>` | `run <cap> "<prompt>" --format json` |
|
|
63
|
-
| Archive a note to a notebook | `deeptutor_note` | `notebook add-md <nb-id> <file> --title "<t>" --type <type>` |
|
|
64
|
-
| View lightweight memory | — (CLI only) | `memory show` |
|
|
65
|
-
| List / inspect sessions | — (CLI only) | `session list` · `session show <id>` |
|
|
66
|
-
| Show a notebook's records | — (CLI only) | `notebook show <name>` |
|
|
67
|
-
| Inspect configuration | — (CLI only) | `config show` (troubleshooting) |
|
|
68
|
-
|
|
69
|
-
Capabilities: `deep_solve` / `deep_question` / `deep_research` / `chat` /
|
|
70
|
-
`mastery_path` / `visualize` / `math_animator`.
|
|
71
|
-
|
|
72
|
-
Useful `run` flags: `--kb <name>` (mount a knowledge base, repeatable),
|
|
73
|
-
`--tool <name>` (`rag`, `web_search`, `reason`, …, repeatable),
|
|
74
|
-
`--session <id>` (continue context), `--language zh`, `--config k=v`
|
|
75
|
-
(repeatable; e.g. `--config num_questions=5`), `--config-json '{"..."}'`
|
|
76
|
-
(complex config), `--notebook-ref <name>` / `--history-ref <id>` (reference
|
|
77
|
-
notebooks or past sessions from the prompt).
|
|
78
|
-
|
|
79
|
-
## Discovering Commands
|
|
80
|
-
|
|
81
|
-
The command set evolves — this cheat sheet is a curated subset, not the full
|
|
82
|
-
surface. Before using a command not listed here, **discover it from the CLI
|
|
83
|
-
itself** and never invent flags:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
deeptutor --help # top-level commands
|
|
87
|
-
deeptutor <cmd> --help # one subcommand's options
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Read the output, then use only what it shows. If a needed capability is not
|
|
91
|
-
in `--help`, report that to the user instead of guessing.
|
|
92
|
-
|
|
93
|
-
## Recommended Learning Workflow
|
|
94
|
-
|
|
95
|
-
### 1. Gather material from both channels
|
|
96
|
-
|
|
97
|
-
- `web_search` for **authoritative sources**: official docs (Microsoft Learn / learn.microsoft.com), official blogs, trusted tutorials. Keep the source links.
|
|
98
|
-
- Search the user's personal knowledge base (pick the right one: dotnet-related → their dotnet base, database → sqlserver) to get their own curated notes:
|
|
99
|
-
- Tools: `deeptutor_kb action=search kb=<kb> query="<topic>"`
|
|
100
|
-
- CLI: `deeptutor kb search <kb> "<topic>" --format json`
|
|
101
|
-
- Always list bases first (`deeptutor_kb action=list` / `deeptutor kb list --format json`) — never assume names.
|
|
102
|
-
|
|
103
|
-
### 2. Deep Solve
|
|
104
|
-
|
|
105
|
-
- Tools: `deeptutor_run capability=deep_solve prompt="<topic>" kbs=[<kb>] tools=[rag, web_search] language=zh`
|
|
106
|
-
- CLI: `deeptutor run deep_solve "<topic>" --kb <kb> --tool rag --tool web_search --language zh --format json`
|
|
107
|
-
|
|
108
|
-
**Always record the returned `session_id`** — reuse it for every follow-up turn so DeepTutor keeps the context (chat history, knowledge bases, tools).
|
|
109
|
-
|
|
110
|
-
### 3. Follow-up questions / targeted reinforcement
|
|
111
|
-
|
|
112
|
-
Continue with the same `session_id`: details, code examples, common pitfalls, differences vs. authoritative sources.
|
|
113
|
-
|
|
114
|
-
### 4. Self-test
|
|
115
|
-
|
|
116
|
-
- Tools: `deeptutor_run capability=deep_question prompt="<topic essentials>" session_id=<same> config={num_questions: 5} kbs=[<kb>] language=zh`
|
|
117
|
-
- CLI: `deeptutor run deep_question "<topic essentials>" --session <same> --config num_questions=5 --kb <kb> --language zh --format json`
|
|
118
|
-
|
|
119
|
-
### 5. Output a study plan
|
|
120
|
-
|
|
121
|
-
Combine all three material sources into a structured plan (Markdown):
|
|
122
|
-
|
|
123
|
-
- Learning goals and prerequisites
|
|
124
|
-
- Core concept list (marked: from personal KB / authoritative link)
|
|
125
|
-
- Phased schedule (each phase: concept → authoritative reading → KB review → exercises)
|
|
126
|
-
- Quiz questions and acceptance criteria
|
|
127
|
-
- Reference list (authoritative links + KB hit sources)
|
|
128
|
-
|
|
129
|
-
### 5b. Render study material to local HTML (recommended)
|
|
130
|
-
|
|
131
|
-
When the user wants readable/browsable/printable study material, render the
|
|
132
|
-
answers to a self-contained HTML page (dark/light toggle, TOC, collapsible
|
|
133
|
-
quiz answers, print-friendly) with the **html-doc skill** (zero-dependency
|
|
134
|
-
Node converter):
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
node skills/html-doc/scripts/md-to-html.js <answer.md> --out <page.html> --title "<主题>" --toc
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
When given the `html` param, `deeptutor_run` does this automatically:
|
|
141
|
-
|
|
142
|
-
```
|
|
143
|
-
deeptutor_run capability=deep_solve prompt=<topic> kbs=[...] tools=[rag, web_search]
|
|
144
|
-
html="data/study/<topic>/knowledge.html" html_title="<主题> · 知识点" language=zh
|
|
145
|
-
deeptutor_run capability=deep_question prompt=<topic essentials> config={num_questions: 5}
|
|
146
|
-
html="data/study/<topic>/quiz.html" html_title="<主题> · 自测题" language=zh
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Then tell the user the HTML file paths so they can open them in a browser.
|
|
150
|
-
|
|
151
|
-
### 6. Archive
|
|
152
|
-
|
|
153
|
-
Store the final notes/plan in a server notebook (e.g. `dotnet-learning`) so they can be retrieved for review later:
|
|
154
|
-
|
|
155
|
-
- Tools: `deeptutor_note notebook=<name> title="<t>" type=solve content=<markdown>`
|
|
156
|
-
- CLI:
|
|
157
|
-
```bash
|
|
158
|
-
deeptutor notebook list # find the notebook id
|
|
159
|
-
deeptutor notebook create <name> --description "archived" # only if missing
|
|
160
|
-
deeptutor notebook add-md <nb-id> <notes.md> --title "<t>" --type solve
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Safety Boundaries
|
|
164
|
-
|
|
165
|
-
Read-only exploration is always fine: `kb list/info/search`, `memory show`,
|
|
166
|
-
`session list/show`, `config show`, `notebook list/show`.
|
|
167
|
-
|
|
168
|
-
Never run destructive commands: `kb delete`, `memory clear`, `session delete`,
|
|
169
|
-
`notebook remove-record`. Creation/update commands (`kb create/add`,
|
|
170
|
-
`notebook create/add-md/replace-md`, `session rename`) only on the user's
|
|
171
|
-
explicit request — never proactively.
|
|
172
|
-
|
|
173
|
-
## Notes
|
|
174
|
-
|
|
175
|
-
- Tool calls go through HTTP/WS first (tunnel), falling back to SSH CLI automatically when the tunnel is down; `deeptutor_run` streams over WebSocket so progress is visible.
|
|
176
|
-
- CLI-only flags (not exposed as `deeptutor_run` tool parameters): `--config-json` (complex config; the tools pass config through the API's `config` parameter instead), `--notebook-ref`, `--history-ref`.
|
|
177
|
-
- `deep_research` can take minutes: give a generous timeout (900+) or split long tasks.
|
|
178
|
-
- Results may be truncated (default 30000 chars) — ask to continue for the full content.
|
|
179
|
-
- RAG hits can be noisy; treat official sources as authoritative and point out conflicts to the user.
|
|
180
|
-
- Do not delete knowledge bases or run destructive operations (see Safety
|
|
181
|
-
Boundaries above); `kb create/add` is fine, but only on the user's explicit
|
|
182
|
-
request, never proactively.
|
|
183
|
-
- CLI output: add `--format json` for machine-readable events; without it you get human-readable text.
|
|
1
|
+
---
|
|
2
|
+
name: deeptutor
|
|
3
|
+
description: Combine DeepTutor personal knowledge bases (RAG) with authoritative web sources to generate learning content, self-test questions, and study plans, and archive notes to a notebook. Works with both local and remote DeepTutor deployments. Use when the user wants to learn/review a technical topic (e.g. .NET, C#, SQL Server, React), get a deep explanation grounded in their own knowledge bases, generate exercises, or plan their learning.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DeepTutor Learning Assistant (Personal Knowledge Base)
|
|
7
|
+
|
|
8
|
+
Combines the user's **personal knowledge bases** (RAG retrieval) with
|
|
9
|
+
**authoritative web sources** to produce learning content, self-test
|
|
10
|
+
questions, and study plans, then archives notes to a DeepTutor notebook.
|
|
11
|
+
|
|
12
|
+
This skill is **agent-agnostic**: every action below has two equivalent
|
|
13
|
+
drivers —
|
|
14
|
+
|
|
15
|
+
- **pi / dsh (with the pi deeptutor extension or the `dsh-deeptutor` bundle installed):** the `deeptutor_*` tools.
|
|
16
|
+
They auto-adapt local/remote deployment (HTTP/WS first with an automatic
|
|
17
|
+
SSH tunnel, CLI fallback) and stream progress.
|
|
18
|
+
- **Any agent / plain CLI:** the `deeptutor` executable directly (local
|
|
19
|
+
binary on PATH, or over SSH for remote deployments). No extension needed.
|
|
20
|
+
|
|
21
|
+
Pick whichever path exists in your environment; the action, not the tool, is
|
|
22
|
+
what matters.
|
|
23
|
+
|
|
24
|
+
## When to Use
|
|
25
|
+
|
|
26
|
+
- The user wants to learn or review a technical topic (.NET, C#, SQL Server, React, …)
|
|
27
|
+
- The user wants content grounded in their own notes/knowledge bases
|
|
28
|
+
- The user wants generated exercises, quizzes, or a learning plan
|
|
29
|
+
- The user wants to archive study notes for later review
|
|
30
|
+
|
|
31
|
+
## Configuration (env vars, agent-agnostic)
|
|
32
|
+
|
|
33
|
+
Nothing is hardcoded in this skill; all server parameters come from environment variables (put them in `~/.bashrc` or `~/.zshrc`; any agent — pi / dsh / Claude Code / Codex / opencode — inherits them at startup). **Deployment mode adapts automatically**:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Remote deployment (DeepTutor on a server, reached through an SSH tunnel)
|
|
37
|
+
export DEEPTUTOR_SSH_HOST="tencent-cloud" # SSH host alias (set = remote mode)
|
|
38
|
+
export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local tunnel address (change port/server here)
|
|
39
|
+
export DEEPTUTOR_REMOTE_BIN="/home/ubuntu/my-deeptutor/.venv/bin/deeptutor"
|
|
40
|
+
export DEEPTUTOR_REMOTE_HOME="/home/ubuntu/my-deeptutor"
|
|
41
|
+
|
|
42
|
+
# Local deployment (DeepTutor on this machine) — leave DEEPTUTOR_SSH_HOST unset for local mode
|
|
43
|
+
# export DEEPTUTOR_API_BASE="http://127.0.0.1:8001" # local serve port
|
|
44
|
+
# export DEEPTUTOR_LOCAL_BIN="deeptutor" # local CLI path (default: deeptutor on PATH)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- **Tools path:** API reachable (local serve or tunnel) → HTTP/WS; unreachable →
|
|
48
|
+
local CLI or SSH CLI fallback automatically. The extension/bundle starts/recycles
|
|
49
|
+
the SSH tunnel; local mode needs no tunnel.
|
|
50
|
+
- **Plain CLI path:** run `deeptutor <subcommand>` locally, or
|
|
51
|
+
`ssh <DEEPTUTOR_SSH_HOST> <DEEPTUTOR_REMOTE_BIN> <subcommand>` for remote
|
|
52
|
+
deployments (the tunnel is the extension's job — CLI users don't need it).
|
|
53
|
+
- Migrating to another server or port only requires changing env vars — never this skill.
|
|
54
|
+
|
|
55
|
+
## Actions Cheat Sheet
|
|
56
|
+
|
|
57
|
+
| Action | Tools (`deeptutor_*`) | CLI equivalent (`deeptutor …`) |
|
|
58
|
+
| ---------------------------- | -------------------------------- | ------------------------------------------------------------ |
|
|
59
|
+
| List knowledge bases | `deeptutor_kb action=list` | `kb list --format json` |
|
|
60
|
+
| Search a knowledge base | `deeptutor_kb action=search` | `kb search <kb> "<query>" --format json --mode hybrid` |
|
|
61
|
+
| Show a knowledge base's info | `deeptutor_kb action=info` | `kb info <kb>` |
|
|
62
|
+
| Run a learning capability | `deeptutor_run capability=<cap>` | `run <cap> "<prompt>" --format json` |
|
|
63
|
+
| Archive a note to a notebook | `deeptutor_note` | `notebook add-md <nb-id> <file> --title "<t>" --type <type>` |
|
|
64
|
+
| View lightweight memory | — (CLI only) | `memory show` |
|
|
65
|
+
| List / inspect sessions | — (CLI only) | `session list` · `session show <id>` |
|
|
66
|
+
| Show a notebook's records | — (CLI only) | `notebook show <name>` |
|
|
67
|
+
| Inspect configuration | — (CLI only) | `config show` (troubleshooting) |
|
|
68
|
+
|
|
69
|
+
Capabilities: `deep_solve` / `deep_question` / `deep_research` / `chat` /
|
|
70
|
+
`mastery_path` / `visualize` / `math_animator`.
|
|
71
|
+
|
|
72
|
+
Useful `run` flags: `--kb <name>` (mount a knowledge base, repeatable),
|
|
73
|
+
`--tool <name>` (`rag`, `web_search`, `reason`, …, repeatable),
|
|
74
|
+
`--session <id>` (continue context), `--language zh`, `--config k=v`
|
|
75
|
+
(repeatable; e.g. `--config num_questions=5`), `--config-json '{"..."}'`
|
|
76
|
+
(complex config), `--notebook-ref <name>` / `--history-ref <id>` (reference
|
|
77
|
+
notebooks or past sessions from the prompt).
|
|
78
|
+
|
|
79
|
+
## Discovering Commands
|
|
80
|
+
|
|
81
|
+
The command set evolves — this cheat sheet is a curated subset, not the full
|
|
82
|
+
surface. Before using a command not listed here, **discover it from the CLI
|
|
83
|
+
itself** and never invent flags:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
deeptutor --help # top-level commands
|
|
87
|
+
deeptutor <cmd> --help # one subcommand's options
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Read the output, then use only what it shows. If a needed capability is not
|
|
91
|
+
in `--help`, report that to the user instead of guessing.
|
|
92
|
+
|
|
93
|
+
## Recommended Learning Workflow
|
|
94
|
+
|
|
95
|
+
### 1. Gather material from both channels
|
|
96
|
+
|
|
97
|
+
- `web_search` for **authoritative sources**: official docs (Microsoft Learn / learn.microsoft.com), official blogs, trusted tutorials. Keep the source links.
|
|
98
|
+
- Search the user's personal knowledge base (pick the right one: dotnet-related → their dotnet base, database → sqlserver) to get their own curated notes:
|
|
99
|
+
- Tools: `deeptutor_kb action=search kb=<kb> query="<topic>"`
|
|
100
|
+
- CLI: `deeptutor kb search <kb> "<topic>" --format json`
|
|
101
|
+
- Always list bases first (`deeptutor_kb action=list` / `deeptutor kb list --format json`) — never assume names.
|
|
102
|
+
|
|
103
|
+
### 2. Deep Solve
|
|
104
|
+
|
|
105
|
+
- Tools: `deeptutor_run capability=deep_solve prompt="<topic>" kbs=[<kb>] tools=[rag, web_search] language=zh`
|
|
106
|
+
- CLI: `deeptutor run deep_solve "<topic>" --kb <kb> --tool rag --tool web_search --language zh --format json`
|
|
107
|
+
|
|
108
|
+
**Always record the returned `session_id`** — reuse it for every follow-up turn so DeepTutor keeps the context (chat history, knowledge bases, tools).
|
|
109
|
+
|
|
110
|
+
### 3. Follow-up questions / targeted reinforcement
|
|
111
|
+
|
|
112
|
+
Continue with the same `session_id`: details, code examples, common pitfalls, differences vs. authoritative sources.
|
|
113
|
+
|
|
114
|
+
### 4. Self-test
|
|
115
|
+
|
|
116
|
+
- Tools: `deeptutor_run capability=deep_question prompt="<topic essentials>" session_id=<same> config={num_questions: 5} kbs=[<kb>] language=zh`
|
|
117
|
+
- CLI: `deeptutor run deep_question "<topic essentials>" --session <same> --config num_questions=5 --kb <kb> --language zh --format json`
|
|
118
|
+
|
|
119
|
+
### 5. Output a study plan
|
|
120
|
+
|
|
121
|
+
Combine all three material sources into a structured plan (Markdown):
|
|
122
|
+
|
|
123
|
+
- Learning goals and prerequisites
|
|
124
|
+
- Core concept list (marked: from personal KB / authoritative link)
|
|
125
|
+
- Phased schedule (each phase: concept → authoritative reading → KB review → exercises)
|
|
126
|
+
- Quiz questions and acceptance criteria
|
|
127
|
+
- Reference list (authoritative links + KB hit sources)
|
|
128
|
+
|
|
129
|
+
### 5b. Render study material to local HTML (recommended)
|
|
130
|
+
|
|
131
|
+
When the user wants readable/browsable/printable study material, render the
|
|
132
|
+
answers to a self-contained HTML page (dark/light toggle, TOC, collapsible
|
|
133
|
+
quiz answers, print-friendly) with the **html-doc skill** (zero-dependency
|
|
134
|
+
Node converter):
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
node skills/html-doc/scripts/md-to-html.js <answer.md> --out <page.html> --title "<主题>" --toc
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
When given the `html` param, `deeptutor_run` does this automatically:
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
deeptutor_run capability=deep_solve prompt=<topic> kbs=[...] tools=[rag, web_search]
|
|
144
|
+
html="data/study/<topic>/knowledge.html" html_title="<主题> · 知识点" language=zh
|
|
145
|
+
deeptutor_run capability=deep_question prompt=<topic essentials> config={num_questions: 5}
|
|
146
|
+
html="data/study/<topic>/quiz.html" html_title="<主题> · 自测题" language=zh
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Then tell the user the HTML file paths so they can open them in a browser.
|
|
150
|
+
|
|
151
|
+
### 6. Archive
|
|
152
|
+
|
|
153
|
+
Store the final notes/plan in a server notebook (e.g. `dotnet-learning`) so they can be retrieved for review later:
|
|
154
|
+
|
|
155
|
+
- Tools: `deeptutor_note notebook=<name> title="<t>" type=solve content=<markdown>`
|
|
156
|
+
- CLI:
|
|
157
|
+
```bash
|
|
158
|
+
deeptutor notebook list # find the notebook id
|
|
159
|
+
deeptutor notebook create <name> --description "archived" # only if missing
|
|
160
|
+
deeptutor notebook add-md <nb-id> <notes.md> --title "<t>" --type solve
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Safety Boundaries
|
|
164
|
+
|
|
165
|
+
Read-only exploration is always fine: `kb list/info/search`, `memory show`,
|
|
166
|
+
`session list/show`, `config show`, `notebook list/show`.
|
|
167
|
+
|
|
168
|
+
Never run destructive commands: `kb delete`, `memory clear`, `session delete`,
|
|
169
|
+
`notebook remove-record`. Creation/update commands (`kb create/add`,
|
|
170
|
+
`notebook create/add-md/replace-md`, `session rename`) only on the user's
|
|
171
|
+
explicit request — never proactively.
|
|
172
|
+
|
|
173
|
+
## Notes
|
|
174
|
+
|
|
175
|
+
- Tool calls go through HTTP/WS first (tunnel), falling back to SSH CLI automatically when the tunnel is down; `deeptutor_run` streams over WebSocket so progress is visible.
|
|
176
|
+
- CLI-only flags (not exposed as `deeptutor_run` tool parameters): `--config-json` (complex config; the tools pass config through the API's `config` parameter instead), `--notebook-ref`, `--history-ref`.
|
|
177
|
+
- `deep_research` can take minutes: give a generous timeout (900+) or split long tasks.
|
|
178
|
+
- Results may be truncated (default 30000 chars) — ask to continue for the full content.
|
|
179
|
+
- RAG hits can be noisy; treat official sources as authoritative and point out conflicts to the user.
|
|
180
|
+
- Do not delete knowledge bases or run destructive operations (see Safety
|
|
181
|
+
Boundaries above); `kb create/add` is fine, but only on the user's explicit
|
|
182
|
+
request, never proactively.
|
|
183
|
+
- CLI output: add `--format json` for machine-readable events; without it you get human-readable text.
|
package/skills/html-doc/SKILL.md
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: html-doc
|
|
3
|
-
description: Generates self-contained, browser-ready HTML files from Markdown content (study notes, documentation, quiz/exercise sheets) using a zero-dependency Node converter and a polished built-in template with dark/light theme toggle, collapsible answers, and print-friendly layout. Use when the user wants local HTML output for reading, reviewing, or sharing learning material and docs.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# HTML Doc Generator
|
|
7
|
-
|
|
8
|
-
Convert Markdown into a beautiful, self-contained local HTML file (single file, inline CSS/JS, no network needed to open). Ideal for study notes, knowledge summaries, and self-test question sheets.
|
|
9
|
-
|
|
10
|
-
## When to Use
|
|
11
|
-
|
|
12
|
-
- After a learning session (e.g. deeptutor deep_solve / deep_question), the user wants readable local HTML of the knowledge points and quiz questions
|
|
13
|
-
- Converting any Markdown notes/docs into a polished local HTML page
|
|
14
|
-
|
|
15
|
-
## Files
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
html-doc/
|
|
19
|
-
├── SKILL.md # this file
|
|
20
|
-
├── scripts/
|
|
21
|
-
│ └── md-to-html.js # zero-dependency Markdown → HTML converter (Node ≥ 20.11)
|
|
22
|
-
└── assets/
|
|
23
|
-
└── template.html # default HTML template (CSS + JS, customizable)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
# Basic: write Markdown to a file, then convert
|
|
30
|
-
node scripts/md-to-html.js notes.md --out notes.html --title "C# 抽象类学习笔记"
|
|
31
|
-
|
|
32
|
-
# From stdin (any tool output piped in)
|
|
33
|
-
cat notes.md | node scripts/md-to-html.js --title "Quiz" --theme dark --out quiz.html
|
|
34
|
-
|
|
35
|
-
# Options
|
|
36
|
-
# --out <file> output path (default: <input>.html)
|
|
37
|
-
# --title <text> page title (default: input filename or "Document")
|
|
38
|
-
# --theme <mode> dark | light (default: light; user can toggle in-page anyway)
|
|
39
|
-
# --toc generate a table of contents from headings (h2/h3)
|
|
40
|
-
# --lang <code> html lang attribute (default: zh-CN)
|
|
41
|
-
# --no-collapse disable <details> wrapping for quiz answers (default: collapse enabled)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Supported Markdown
|
|
45
|
-
|
|
46
|
-
ATX headings (`#`–`######`), fenced code blocks (``` with optional language), inline code, bold, italic, links, unordered/ordered lists, task lists (`- [ ]` / `- [x]`), blockquotes, tables (pipe syntax), horizontal rules, paragraphs.
|
|
47
|
-
|
|
48
|
-
Anything unsupported falls back to a plain `<p>` — output always stays valid.
|
|
49
|
-
|
|
50
|
-
## Recommended Workflow for Study Material
|
|
51
|
-
|
|
52
|
-
1. Collect the learning content (e.g. from deeptutor_run answer) as Markdown files under a docs folder, e.g. `~/study/abstract-class/`:
|
|
53
|
-
- `knowledge.md` — the deep-solve explanation
|
|
54
|
-
- `quiz.md` — the self-test questions (mark answers inside `<details>` blocks so they collapse)
|
|
55
|
-
2. Convert each file:
|
|
56
|
-
```bash
|
|
57
|
-
node scripts/md-to-html.js knowledge.md --out knowledge.html --title "C# 抽象类 · 知识点" --toc
|
|
58
|
-
node scripts/md-to-html.js quiz.md --out quiz.html --title "C# 抽象类 · 自测题" --toc
|
|
59
|
-
```
|
|
60
|
-
3. Open the HTML files in the browser (or tell the user the file paths).
|
|
61
|
-
|
|
62
|
-
## Quiz Answer Collapsing
|
|
63
|
-
|
|
64
|
-
The converter auto-detects quiz structure: any heading containing "答案" / "Answer" / "解析" / "Explanation" starts a `<details>` block whose following content (until the next heading) is collapsed. Also, a heading line that is immediately followed by content gets wrapped when the heading matches. This keeps the quiz readable while hiding answers until clicked.
|
|
65
|
-
|
|
66
|
-
To be explicit, authors can also wrap answers manually:
|
|
67
|
-
|
|
68
|
-
```markdown
|
|
69
|
-
<details><summary>答案:C</summary>
|
|
70
|
-
|
|
71
|
-
解析:...
|
|
72
|
-
</details>
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Raw `<details>`/`<summary>` blocks are preserved as-is (the only raw-HTML passthrough); everything else is treated as Markdown/text and HTML-escaped.
|
|
76
|
-
|
|
77
|
-
## Customizing the Template
|
|
78
|
-
|
|
79
|
-
Edit `assets/template.html` — it uses `{{TITLE}}`, `{{BODY}}`, `{{THEME}}`, `{{LANG}}`, `{{TOC}}`, `{{GENERATED}}` placeholders. Keep placeholders intact; the converter does simple string replacement. The built-in template includes:
|
|
80
|
-
|
|
81
|
-
- CSS variables for light/dark theming with an in-page toggle button (remembers choice in localStorage)
|
|
82
|
-
- Print stylesheet (answers stay collapsed on paper)
|
|
83
|
-
- Code block styling with optional language badge
|
|
84
|
-
- Table styling, blockquote styling, task-list checkboxes
|
|
85
|
-
- Responsive layout (comfortable reading column)
|
|
86
|
-
|
|
87
|
-
## Notes
|
|
88
|
-
|
|
89
|
-
- Zero dependencies — only `node` (≥ 20.11, uses `import.meta.dirname`) is required; no npm install needed
|
|
90
|
-
- Output is fully self-contained: inline CSS + JS, no external fonts/CDN (offline-friendly)
|
|
91
|
-
- Escaping is handled: content is HTML-escaped before insertion. Raw-HTML passthrough is intentionally narrow (`<details>`/`<summary>` only) since `deeptutor_run` feeds model/web_search-sourced answers into this converter automatically — a wider tag whitelist would let untrusted `<script>`/`on*=` content ride along into the generated local HTML.
|
|
1
|
+
---
|
|
2
|
+
name: html-doc
|
|
3
|
+
description: Generates self-contained, browser-ready HTML files from Markdown content (study notes, documentation, quiz/exercise sheets) using a zero-dependency Node converter and a polished built-in template with dark/light theme toggle, collapsible answers, and print-friendly layout. Use when the user wants local HTML output for reading, reviewing, or sharing learning material and docs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# HTML Doc Generator
|
|
7
|
+
|
|
8
|
+
Convert Markdown into a beautiful, self-contained local HTML file (single file, inline CSS/JS, no network needed to open). Ideal for study notes, knowledge summaries, and self-test question sheets.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
- After a learning session (e.g. deeptutor deep_solve / deep_question), the user wants readable local HTML of the knowledge points and quiz questions
|
|
13
|
+
- Converting any Markdown notes/docs into a polished local HTML page
|
|
14
|
+
|
|
15
|
+
## Files
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
html-doc/
|
|
19
|
+
├── SKILL.md # this file
|
|
20
|
+
├── scripts/
|
|
21
|
+
│ └── md-to-html.js # zero-dependency Markdown → HTML converter (Node ≥ 20.11)
|
|
22
|
+
└── assets/
|
|
23
|
+
└── template.html # default HTML template (CSS + JS, customizable)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Basic: write Markdown to a file, then convert
|
|
30
|
+
node scripts/md-to-html.js notes.md --out notes.html --title "C# 抽象类学习笔记"
|
|
31
|
+
|
|
32
|
+
# From stdin (any tool output piped in)
|
|
33
|
+
cat notes.md | node scripts/md-to-html.js --title "Quiz" --theme dark --out quiz.html
|
|
34
|
+
|
|
35
|
+
# Options
|
|
36
|
+
# --out <file> output path (default: <input>.html)
|
|
37
|
+
# --title <text> page title (default: input filename or "Document")
|
|
38
|
+
# --theme <mode> dark | light (default: light; user can toggle in-page anyway)
|
|
39
|
+
# --toc generate a table of contents from headings (h2/h3)
|
|
40
|
+
# --lang <code> html lang attribute (default: zh-CN)
|
|
41
|
+
# --no-collapse disable <details> wrapping for quiz answers (default: collapse enabled)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Supported Markdown
|
|
45
|
+
|
|
46
|
+
ATX headings (`#`–`######`), fenced code blocks (``` with optional language), inline code, bold, italic, links, unordered/ordered lists, task lists (`- [ ]` / `- [x]`), blockquotes, tables (pipe syntax), horizontal rules, paragraphs.
|
|
47
|
+
|
|
48
|
+
Anything unsupported falls back to a plain `<p>` — output always stays valid.
|
|
49
|
+
|
|
50
|
+
## Recommended Workflow for Study Material
|
|
51
|
+
|
|
52
|
+
1. Collect the learning content (e.g. from deeptutor_run answer) as Markdown files under a docs folder, e.g. `~/study/abstract-class/`:
|
|
53
|
+
- `knowledge.md` — the deep-solve explanation
|
|
54
|
+
- `quiz.md` — the self-test questions (mark answers inside `<details>` blocks so they collapse)
|
|
55
|
+
2. Convert each file:
|
|
56
|
+
```bash
|
|
57
|
+
node scripts/md-to-html.js knowledge.md --out knowledge.html --title "C# 抽象类 · 知识点" --toc
|
|
58
|
+
node scripts/md-to-html.js quiz.md --out quiz.html --title "C# 抽象类 · 自测题" --toc
|
|
59
|
+
```
|
|
60
|
+
3. Open the HTML files in the browser (or tell the user the file paths).
|
|
61
|
+
|
|
62
|
+
## Quiz Answer Collapsing
|
|
63
|
+
|
|
64
|
+
The converter auto-detects quiz structure: any heading containing "答案" / "Answer" / "解析" / "Explanation" starts a `<details>` block whose following content (until the next heading) is collapsed. Also, a heading line that is immediately followed by content gets wrapped when the heading matches. This keeps the quiz readable while hiding answers until clicked.
|
|
65
|
+
|
|
66
|
+
To be explicit, authors can also wrap answers manually:
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
<details><summary>答案:C</summary>
|
|
70
|
+
|
|
71
|
+
解析:...
|
|
72
|
+
</details>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Raw `<details>`/`<summary>` blocks are preserved as-is (the only raw-HTML passthrough); everything else is treated as Markdown/text and HTML-escaped.
|
|
76
|
+
|
|
77
|
+
## Customizing the Template
|
|
78
|
+
|
|
79
|
+
Edit `assets/template.html` — it uses `{{TITLE}}`, `{{BODY}}`, `{{THEME}}`, `{{LANG}}`, `{{TOC}}`, `{{GENERATED}}` placeholders. Keep placeholders intact; the converter does simple string replacement. The built-in template includes:
|
|
80
|
+
|
|
81
|
+
- CSS variables for light/dark theming with an in-page toggle button (remembers choice in localStorage)
|
|
82
|
+
- Print stylesheet (answers stay collapsed on paper)
|
|
83
|
+
- Code block styling with optional language badge
|
|
84
|
+
- Table styling, blockquote styling, task-list checkboxes
|
|
85
|
+
- Responsive layout (comfortable reading column)
|
|
86
|
+
|
|
87
|
+
## Notes
|
|
88
|
+
|
|
89
|
+
- Zero dependencies — only `node` (≥ 20.11, uses `import.meta.dirname`) is required; no npm install needed
|
|
90
|
+
- Output is fully self-contained: inline CSS + JS, no external fonts/CDN (offline-friendly)
|
|
91
|
+
- Escaping is handled: content is HTML-escaped before insertion. Raw-HTML passthrough is intentionally narrow (`<details>`/`<summary>` only) since `deeptutor_run` feeds model/web_search-sourced answers into this converter automatically — a wider tag whitelist would let untrusted `<script>`/`on*=` content ride along into the generated local HTML.
|