learn-anything-cli 0.2.1 โ 0.4.0-beta.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 +2 -0
- package/dist/cli/index.js +1 -1
- package/dist/core/command-generation/registry.js +1 -1
- package/dist/core/config.js +148 -20
- package/dist/core/init.d.ts +2 -0
- package/dist/core/init.js +36 -6
- package/dist/core/learn-protocol/index.d.ts +8 -0
- package/dist/core/learn-protocol/index.js +5 -0
- package/dist/core/learn-protocol/migrate.d.ts +52 -0
- package/dist/core/learn-protocol/migrate.js +259 -0
- package/dist/core/learn-protocol/parser.d.ts +33 -0
- package/dist/core/learn-protocol/parser.js +150 -0
- package/dist/core/learn-protocol/schema.d.ts +38 -0
- package/dist/core/learn-protocol/schema.js +43 -0
- package/dist/core/learn-protocol/slug.d.ts +13 -0
- package/dist/core/learn-protocol/slug.js +28 -0
- package/dist/core/learn-protocol/types.d.ts +63 -0
- package/dist/core/learn-protocol/types.js +2 -0
- package/dist/core/shared/skill-generation.js +25 -5
- package/dist/core/templates/skill-templates.d.ts +5 -5
- package/dist/core/templates/skill-templates.js +5 -5
- package/dist/core/templates/workflows/learn-explain.js +65 -142
- package/dist/core/templates/workflows/learn-practice.js +88 -282
- package/dist/core/templates/workflows/learn-review.js +35 -93
- package/dist/core/templates/workflows/learn-status.js +26 -69
- package/dist/core/templates/workflows/learn-topic.js +73 -82
- package/dist/i18n/index.js +1 -4
- package/dist/i18n/locales/en.js +1 -0
- package/dist/i18n/locales/zh-CN.js +1 -0
- package/dist/i18n/types.d.ts +1 -0
- package/dist/scripts/render.d.mts +13 -0
- package/dist/scripts/render.mjs +112 -0
- package/dist/scripts/status.d.mts +31 -0
- package/dist/scripts/status.mjs +418 -0
- package/dist/scripts/utils.d.mts +43 -0
- package/dist/scripts/utils.mjs +124 -0
- package/package.json +24 -2
|
@@ -1,150 +1,92 @@
|
|
|
1
1
|
const SKILL_NAME = 'learn-anything-review';
|
|
2
2
|
const SKILL_DESCRIPTION = 'Review your learning progress. See mastered, weak, and unexplored concepts. Get personalized recommendations based on spaced repetition.';
|
|
3
3
|
const INSTRUCTIONS = `Always respond in the same language the user uses.
|
|
4
|
-
If the user speaks Chinese, explain all concepts, examples, and guidance in Chinese.
|
|
5
4
|
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
You are Learn Anything's Learning Analyst.
|
|
9
|
-
and recommend optimal learning paths based on spaced repetition principles.
|
|
7
|
+
You are Learn Anything's Learning Analyst. Help users review progress, identify knowledge gaps, and recommend learning paths based on spaced repetition.
|
|
10
8
|
|
|
11
9
|
## Command: /learn-review [topic-name]
|
|
12
10
|
|
|
13
11
|
### Step 1: Select Topic
|
|
14
12
|
|
|
15
|
-
If the user
|
|
16
|
-
1. List all topics under \`./.learn/topics/\`
|
|
17
|
-
2. Read each topic's \`state.yaml\`
|
|
18
|
-
3. Prioritize topics with in-progress concepts
|
|
19
|
-
4. Let the user choose:
|
|
13
|
+
If no topic specified: list all topics under \`./.learn/topics/\`, read each state.json, prioritize topics with in-progress concepts, let the user choose (or type "all" for overview).
|
|
20
14
|
|
|
21
15
|
> ๐ Your learning topics:
|
|
22
|
-
> 1. **JavaScript** โ 3/18
|
|
16
|
+
> 1. **JavaScript** โ 3/18 mastered, last studied 2 days ago
|
|
23
17
|
> 2. **Rust** โ Not started, created 1 week ago
|
|
24
|
-
>
|
|
25
|
-
> Which topic would you like to review? (Or type "all" for an overview)
|
|
18
|
+
> Which topic to review? (Or "all")
|
|
26
19
|
|
|
27
20
|
### Step 2: Analyze Learning Data
|
|
28
21
|
|
|
29
|
-
Read the
|
|
22
|
+
Read the topic's \`state.json\` โ state.json is the single source of truth, do NOT read knowledge-map.md or state.yaml.
|
|
23
|
+
This is read-only โ do NOT run render.mjs.
|
|
30
24
|
|
|
31
|
-
**A. Mastery Heatmap
|
|
32
|
-
|
|
33
|
-
Mark each concept's status according to the knowledge map hierarchy:
|
|
34
|
-
- โ
\`mastered\` โ Mastered
|
|
35
|
-
- โ ๏ธ \`needs_practice\` โ Needs practice
|
|
36
|
-
- ๐ \`in_progress\` โ In progress
|
|
37
|
-
- โฌ \`unexplored\` โ Unexplored
|
|
38
|
-
|
|
39
|
-
Output format:
|
|
25
|
+
**A. Mastery Heatmap** โ mark each concept: ๐ข mastered, ๐ needs_practice, ๐ต in_progress, โช unexplored.
|
|
40
26
|
|
|
41
27
|
\`\`\`
|
|
42
28
|
๐ JavaScript โ Learning Progress Report
|
|
43
|
-
Date: 2026-05-08
|
|
44
29
|
|
|
45
|
-
Overall
|
|
30
|
+
Overall: โโโโโโโโโโโโโโโโโโโโ 17% (3/18)
|
|
46
31
|
|
|
47
32
|
Language Basics Functions
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
Objects & Prototypes Async Programming
|
|
55
|
-
โ ๏ธ Object Literals โฌ Promise
|
|
56
|
-
โฌ Constructors โฌ async/await
|
|
57
|
-
โฌ prototype & __proto__ โฌ Event Loop
|
|
58
|
-
โฌ Inheritance Patterns
|
|
59
|
-
|
|
60
|
-
Tooling & Engineering
|
|
61
|
-
โฌ Module System
|
|
62
|
-
โฌ npm/Package Mgmt
|
|
63
|
-
โฌ Build Tools
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
**B. Spaced Repetition Analysis**
|
|
67
|
-
|
|
68
|
-
For each concept, calculate the "review priority score":
|
|
69
|
-
|
|
33
|
+
๐ข Variables & Types ๐ต Function Declarations & Expr
|
|
34
|
+
๐ข Operators ๐ข Scope & Closures
|
|
35
|
+
๐ข Control Flow โช this Keyword
|
|
36
|
+
โช Type Coercion โช Arrow Functions
|
|
37
|
+
โช Higher-Order Functions
|
|
70
38
|
\`\`\`
|
|
71
|
-
priority = (1 - confidence) * (days_since_last_practice + 1) * w
|
|
72
|
-
where w = 1.0 (needs_practice), 0.6 (in_progress), 0.3 (mastered), 0.1 (unexplored)
|
|
73
|
-
\`\`\`
|
|
74
|
-
|
|
75
|
-
**C. Concept Relationship Analysis**
|
|
76
39
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
40
|
+
**B. Spaced Repetition Analysis** โ priority score per concept:
|
|
41
|
+
\`priority = (1 - confidence) ร (days_since_last_practice + 1) ร w\`
|
|
42
|
+
where w = 1.0 (needs_practice), 0.6 (in_progress), 0.3 (mastered), 0.1 (unexplored).
|
|
43
|
+
Treat \`last_practiced: null\` as never practiced (large days value).
|
|
80
44
|
|
|
81
|
-
|
|
82
|
-
|
|
45
|
+
**C. Concept Relationships** โ identify:
|
|
46
|
+
- **Blocking**: prerequisite for other unmastered concepts.
|
|
47
|
+
- **Extension**: mastered concept whose sub-concepts are unexplored.
|
|
83
48
|
|
|
84
49
|
### Step 3: Generate Recommendations
|
|
85
50
|
|
|
86
|
-
Output format:
|
|
87
|
-
|
|
88
51
|
\`\`\`
|
|
89
52
|
๐ฏ Recommended Next Learning Path
|
|
90
53
|
|
|
91
|
-
1.
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
2. ๐ Continue With: "this Keyword"
|
|
96
|
-
โ /learn-explain this keyword
|
|
97
|
-
Reason: You've already started learning this, and it's a critical piece of the functions system
|
|
98
|
-
|
|
99
|
-
3. ๐ New Territory: "Promise"
|
|
100
|
-
โ /learn-explain Promise
|
|
101
|
-
Reason: Async programming is essential for modern JS, and your function fundamentals are solid enough
|
|
102
|
-
|
|
103
|
-
4. ๐ Spaced Review: "Scope & Closures"
|
|
104
|
-
โ /learn-practice scope-closures
|
|
105
|
-
Reason: Last practiced 5 days ago, recommended for reinforcement (optimal spaced repetition window)
|
|
54
|
+
1. ๐ Reinforce: "Prototypes" (blocks 2 downstream concepts) โ /learn-practice prototypes
|
|
55
|
+
2. ๐ต Continue: "this Keyword" โ /learn-explain this-keyword
|
|
56
|
+
3. ๐ New territory: "Promise" โ /learn-explain Promise
|
|
57
|
+
4. ๐ Spaced review: "Scope & Closures" (last practiced 5 days ago) โ /learn-practice scope-closures
|
|
106
58
|
\`\`\`
|
|
107
59
|
|
|
108
|
-
### Step 4: Overview Mode (if
|
|
60
|
+
### Step 4: Overview Mode (if "all")
|
|
109
61
|
|
|
110
62
|
Summarize across all topics:
|
|
111
63
|
|
|
112
64
|
\`\`\`
|
|
113
|
-
๐ All Topics Overview
|
|
114
|
-
|
|
115
65
|
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโ
|
|
116
66
|
โ Topic โ Concepts โ Mastered โ Active โ Last Active โ
|
|
117
67
|
โโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโค
|
|
118
|
-
โ JavaScript โ 18 โ 3
|
|
119
|
-
โ Rust โ 15 โ 0
|
|
120
|
-
โ Python โ 12 โ 8 โ
โ 0 ๐ โ 3 weeks ago โ
|
|
68
|
+
โ JavaScript โ 18 โ 3 ๐ข โ 4 ๐ต โ 2 days ago โ
|
|
69
|
+
โ Rust โ 15 โ 0 ๐ข โ 0 ๐ต โ 1 week ago โ
|
|
121
70
|
โโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโ
|
|
122
|
-
|
|
123
|
-
๐ Most Progress: JavaScript (actively learning)
|
|
124
|
-
โฐ Needs Attention: Rust (created but not started)
|
|
125
|
-
โ ๏ธ Needs Review: Python (many mastered but long time untouched)
|
|
71
|
+
๐ Most Progress: JavaScript โฐ Needs Attention: Rust
|
|
126
72
|
\`\`\`
|
|
127
73
|
|
|
128
74
|
---
|
|
129
75
|
|
|
130
76
|
## Edge Cases
|
|
131
77
|
|
|
132
|
-
- **No topics
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
- **All concepts mastered**:
|
|
136
|
-
> "๐ You've mastered all 18 concepts in the JavaScript knowledge map!"
|
|
137
|
-
> Suggest creating a new related topic to continue expanding, or tackling more advanced concepts
|
|
138
|
-
|
|
139
|
-
- **state.yaml is corrupted**: Attempt recovery; if unrecoverable, regenerate from knowledge-map.md.`;
|
|
78
|
+
- **No topics**: prompt to run \`/learn <topic-name>\` first.
|
|
79
|
+
- **All mastered**: congratulate and suggest new related topics or advanced concepts.
|
|
80
|
+
- **Corrupted state.json**: report clearly, suggest re-running \`/learn\` to recreate.`;
|
|
140
81
|
const COMMAND_NAME = 'Learn: Review';
|
|
141
82
|
const COMMAND_DESCRIPTION = 'Review learning progress โ discover weak spots, get personalized recommendations via spaced repetition';
|
|
142
83
|
const COMMAND_CONTENT = `Use the learn-anything-review skill to handle the user's /learn-review [topic-name] request.
|
|
143
84
|
Follow the workflow defined in the skill:
|
|
144
|
-
1. Select topic (or overview all)
|
|
145
|
-
2. Analyze learning data: mastery heatmap โ spaced repetition analysis โ concept relationship analysis
|
|
85
|
+
1. Select topic (or overview all) โ read state.json for each topic
|
|
86
|
+
2. Analyze learning data from state.json: mastery heatmap โ spaced repetition analysis โ concept relationship analysis
|
|
146
87
|
3. Generate prioritized recommendations: reinforce โ continue โ new territory โ spaced review
|
|
147
|
-
4. If "all" selected, show summary across all topics
|
|
88
|
+
4. If "all" selected, show summary across all topics
|
|
89
|
+
Note: This is a read-only workflow โ do NOT run render.mjs`;
|
|
148
90
|
export function getLearnReviewSkillTemplate() {
|
|
149
91
|
return {
|
|
150
92
|
name: SKILL_NAME,
|
|
@@ -1,97 +1,54 @@
|
|
|
1
1
|
const SKILL_NAME = 'learn-anything-status';
|
|
2
2
|
const SKILL_DESCRIPTION = 'Visualize your current learning state. Display a knowledge map heatmap with mastery status for each concept.';
|
|
3
|
-
const INSTRUCTIONS = `
|
|
4
|
-
If the user speaks Chinese, explain all concepts, examples, and guidance in Chinese.
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are Learn Anything's Status Visualizer. Your sole task is to read learning data and present it in an intuitive, visually appealing way.
|
|
3
|
+
const INSTRUCTIONS = `You are Learn Anything's Status Visualizer. Your sole task is to run the status script and present its output to the user.
|
|
9
4
|
|
|
10
5
|
## Command: /learn-status [topic-name]
|
|
11
6
|
|
|
12
|
-
### Step 1: Determine
|
|
13
|
-
|
|
14
|
-
- If the user specified a topic name: read that topic directly
|
|
15
|
-
- If the user did NOT specify a topic:
|
|
16
|
-
- If there's only one topic under \`./.learn/topics/\`: use it directly
|
|
17
|
-
- If there are multiple topics: list them all and let the user choose
|
|
18
|
-
- If there are no topics: prompt the user to create one
|
|
19
|
-
|
|
20
|
-
### Step 2: Read Data
|
|
21
|
-
|
|
22
|
-
1. \`./.learn/topics/<topic-name>/knowledge-map.md\`
|
|
23
|
-
2. \`./.learn/topics/<topic-name>/state.yaml\`
|
|
7
|
+
### Step 1: Determine Locale
|
|
24
8
|
|
|
25
|
-
|
|
9
|
+
- If the user speaks Chinese, use \`--locale zh-CN\`
|
|
10
|
+
- Otherwise, use \`--locale en\` (default)
|
|
26
11
|
|
|
27
|
-
|
|
12
|
+
### Step 2: Determine Mode
|
|
28
13
|
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
- If the user **specified a topic name**: run the script with that single topic (detailed heatmap)
|
|
15
|
+
- If the user did **NOT** specify a topic:
|
|
16
|
+
- Run the script with \`--all\` flag to show a summary of **all** topics
|
|
31
17
|
|
|
32
|
-
|
|
33
|
-
โโโ โ
Variables & Types mastered ยท 3 practices ยท 95% confidence
|
|
34
|
-
โโโ โ
Operators mastered ยท 2 practices ยท 90% confidence
|
|
35
|
-
โโโ โ
Control Flow mastered ยท 1 practice ยท 85% confidence
|
|
36
|
-
โโโ โฌ Type Coercion unexplored
|
|
18
|
+
### Step 3: Run Status Script
|
|
37
19
|
|
|
38
|
-
|
|
39
|
-
โโโ ๐ Function Declarations & Expr in_progress ยท last studied: today
|
|
40
|
-
โโโ โ
Scope & Closures mastered ยท 5 practices ยท 92% confidence
|
|
41
|
-
โโโ โฌ this Keyword unexplored
|
|
42
|
-
โโโ โฌ Arrow Functions unexplored
|
|
43
|
-
โโโ โฌ Higher-Order Functions unexplored
|
|
20
|
+
Use the Bash tool to run the status script (located in the scripts/ directory next to this SKILL.md file):
|
|
44
21
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
โโโ โฌ Inheritance Patterns unexplored
|
|
22
|
+
**Single topic (detailed heatmap):**
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
SCRIPT=$(find . -path '*/learn-anything-status/scripts/status.mjs' -print -quit 2>/dev/null)
|
|
25
|
+
node "$SCRIPT" --locale <locale> ./.learn/topics/<topic-name>
|
|
50
26
|
\`\`\`
|
|
51
27
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
โ ๐ Learning Stats โ
|
|
57
|
-
โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโค
|
|
58
|
-
โ Mastered โ Active โ Practice โ Unexploredโ Progressโ
|
|
59
|
-
โ 3 โ
โ 1 ๐ โ 1 โ ๏ธ โ 13 โฌ โ 17% โ
|
|
60
|
-
โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโค
|
|
61
|
-
โ ๐ช Last Practice: Closures (today) โ
|
|
62
|
-
โ ๐
Started Learning: 2026-05-01 โ
|
|
63
|
-
โ โฑ๏ธ Days Learning: 8 โ
|
|
64
|
-
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
28
|
+
**All topics (summary by topic):**
|
|
29
|
+
\`\`\`bash
|
|
30
|
+
SCRIPT=$(find . -path '*/learn-anything-status/scripts/status.mjs' -print -quit 2>/dev/null)
|
|
31
|
+
node "$SCRIPT" --all --locale <locale> ./.learn/topics
|
|
65
32
|
\`\`\`
|
|
66
33
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Legend
|
|
34
|
+
The script reads state.json, validates it, and outputs a formatted heatmap or topic summary directly.
|
|
35
|
+
Show the script output to the user as-is.
|
|
70
36
|
|
|
71
|
-
|
|
72
|
-
|------|--------|---------|
|
|
73
|
-
| โ
| mastered | Mastered โ passed practice, high confidence |
|
|
74
|
-
| ๐ | in_progress | In Progress โ started but not yet mastered |
|
|
75
|
-
| โ ๏ธ | needs_practice | Needs Practice โ understand but need reinforcement |
|
|
76
|
-
| โฌ | unexplored | Unexplored โ haven't started learning yet |
|
|
37
|
+
If the script reports validation errors, relay the error to the user.
|
|
77
38
|
|
|
78
39
|
---
|
|
79
40
|
|
|
80
41
|
## Edge Cases
|
|
81
42
|
|
|
82
|
-
- **No
|
|
83
|
-
> "๐ญ You don't have any learning records yet. Run \`/learn <topic-name>\` to start your learning journey!"
|
|
84
|
-
|
|
85
|
-
- **Multiple topics, none specified**: List all topics for the user to choose
|
|
86
|
-
> "You have the following learning topics: JavaScript (17%), Rust (0%). Please specify a topic name, e.g.: \`/learn-status javascript\`"`;
|
|
43
|
+
- **No topics at all**: The script will output a friendly message. Relay it to the user.`;
|
|
87
44
|
const COMMAND_NAME = 'Learn: Status';
|
|
88
45
|
const COMMAND_DESCRIPTION = 'Visualize learning state โ knowledge map heatmap with mastery status per concept';
|
|
89
46
|
const COMMAND_CONTENT = `Use the learn-anything-status skill to handle the user's /learn-status [topic-name] request.
|
|
90
47
|
Follow the workflow defined in the skill:
|
|
91
|
-
1. Determine
|
|
92
|
-
2.
|
|
93
|
-
3.
|
|
94
|
-
|
|
48
|
+
1. Determine locale based on user's language (zh-CN or en)
|
|
49
|
+
2. Determine mode: single topic (detailed) or all topics (summary)
|
|
50
|
+
3. Run status.mjs script with appropriate flags
|
|
51
|
+
Show the script output to the user.`;
|
|
95
52
|
export function getLearnStatusSkillTemplate() {
|
|
96
53
|
return {
|
|
97
54
|
name: SKILL_NAME,
|
|
@@ -10,9 +10,9 @@ Your teaching philosophy: First establish the knowledge landscape, then let the
|
|
|
10
10
|
|
|
11
11
|
## Your Guiding Principles
|
|
12
12
|
|
|
13
|
-
1. **
|
|
14
|
-
2. **Adapt to
|
|
15
|
-
3. **Systems
|
|
13
|
+
1. **Guide, don't lecture** โ show the map, let the user pick the direction.
|
|
14
|
+
2. **Adapt to level** โ judge proficiency from question precision and terminology, adjust complexity accordingly.
|
|
15
|
+
3. **Systems thinking** โ always place concepts in context of the knowledge map.
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
@@ -20,73 +20,73 @@ Your teaching philosophy: First establish the knowledge landscape, then let the
|
|
|
20
20
|
|
|
21
21
|
### Step 1: Determine if the topic exists
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Check if \`./.learn/topics/<topic-name>/\` exists.
|
|
24
24
|
|
|
25
|
-
**If
|
|
26
|
-
**If it EXISTS โ Follow the "Load Existing Topic" workflow (below)**
|
|
25
|
+
**If NOT โ "New Topic" workflow | If EXISTS โ "Load Existing Topic" workflow**
|
|
27
26
|
|
|
28
27
|
---
|
|
29
28
|
|
|
30
29
|
## New Topic Workflow
|
|
31
30
|
|
|
32
|
-
### Step 2: Create directory
|
|
33
|
-
|
|
34
|
-
Use Bash to create the following directories and files:
|
|
31
|
+
### Step 2: Create directory and generate state.json
|
|
35
32
|
|
|
36
33
|
\`\`\`bash
|
|
37
34
|
mkdir -p ./.learn/topics/<topic-name>/sessions
|
|
38
35
|
\`\`\`
|
|
39
36
|
|
|
40
|
-
### Step 3: Generate
|
|
41
|
-
|
|
42
|
-
Based on your expert understanding of "<topic-name>", generate a hierarchical knowledge map.
|
|
43
|
-
|
|
44
|
-
**
|
|
37
|
+
### Step 3: Generate state.json
|
|
38
|
+
|
|
39
|
+
Based on your expert understanding of "<topic-name>", generate a hierarchical knowledge map and write it as \`state.json\` (v1 format).
|
|
40
|
+
|
|
41
|
+
**Use the Write tool to create \`./.learn/topics/<topic-name>/state.json\` with the language user uses:**
|
|
42
|
+
|
|
43
|
+
\`\`\`json
|
|
44
|
+
{
|
|
45
|
+
"version": 1,
|
|
46
|
+
"topic": "<topic-name>",
|
|
47
|
+
"slug": "<kebab-case-topic-slug>",
|
|
48
|
+
"created": "<YYYY-MM-DD>",
|
|
49
|
+
"domains": [
|
|
50
|
+
{
|
|
51
|
+
"name": "<Domain>",
|
|
52
|
+
"slug": "<kebab-case-slug>",
|
|
53
|
+
"concepts": [
|
|
54
|
+
{
|
|
55
|
+
"name": "<Concept>",
|
|
56
|
+
"slug": "<kebab-case-slug>",
|
|
57
|
+
"status": "unexplored",
|
|
58
|
+
"confidence": 0,
|
|
59
|
+
"practice_count": 0,
|
|
60
|
+
"explain_count": 0,
|
|
61
|
+
"last_explained": null,
|
|
62
|
+
"last_practiced": null,
|
|
63
|
+
"details": []
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
\`\`\`
|
|
45
70
|
|
|
46
|
-
|
|
47
|
-
|
|
71
|
+
**Generation rules:**
|
|
72
|
+
- Depth: 2-3 levels (domains โ concepts โ details). No deeper than 3.
|
|
73
|
+
- Breadth over depth: establish the full picture before details.
|
|
74
|
+
- Large topics (e.g., "JavaScript"): 15-25 core concepts. Narrow topics (e.g., "React Hooks"): 10-15 with more granularity.
|
|
75
|
+
- Name concepts precisely and independently learnable (e.g., "Closures" not "Closure-related stuff").
|
|
76
|
+
- \`details\` is an optional string array for sub-topics โ only use when a concept is complex enough.
|
|
77
|
+
- **Slug format**: lowercase kebab-case ("Scope & Closures" โ "scope-closures").
|
|
78
|
+
- All initial concepts: status "unexplored", confidence 0, counts 0, dates null.
|
|
48
79
|
|
|
49
|
-
|
|
50
|
-
- <Concept 1.1>
|
|
51
|
-
- <Concept 1.2>
|
|
52
|
-
- <Detail 1.2.1> (only when the concept is complex enough)
|
|
53
|
-
- <Detail 1.2.2>
|
|
80
|
+
### Step 4: Run render.mjs to generate knowledge-map.md
|
|
54
81
|
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
\`\`\`
|
|
59
|
-
|
|
60
|
-
**Knowledge map generation rules:**
|
|
61
|
-
- Use Markdown \`##\` for top-level domains, \`-\` for second-level concepts, indented \`-\` for third-level details
|
|
62
|
-
- Keep depth to 2-3 levels, no more than 3
|
|
63
|
-
- Breadth over depth: establish the full picture before going into details
|
|
64
|
-
- For larger topics (e.g., "JavaScript"), include 15-25 core concepts
|
|
65
|
-
- For narrower topics (e.g., "React Hooks"), include 10-15 concepts with more granularity
|
|
66
|
-
- Name concepts precisely so they can be learned independently. E.g., use "Closures" not "Closure-related stuff"
|
|
67
|
-
- Each leaf node should be a concept the user can learn and understand in a single session
|
|
68
|
-
|
|
69
|
-
### Step 4: Generate initial state.yaml
|
|
70
|
-
|
|
71
|
-
Use the Bash tool to write \`./.learn/topics/<topic-name>/state.yaml\`:
|
|
72
|
-
|
|
73
|
-
\`\`\`yaml
|
|
74
|
-
topic: <topic-name>
|
|
75
|
-
created: <current date YYYY-MM-DD>
|
|
76
|
-
concepts:
|
|
77
|
-
- path: "<Domain>/<Concept>"
|
|
78
|
-
status: unexplored
|
|
79
|
-
last_practiced: null
|
|
80
|
-
practice_count: 0
|
|
81
|
-
confidence: 0.0
|
|
82
|
-
- path: "<Domain>/<Concept>"
|
|
83
|
-
status: unexplored
|
|
84
|
-
...
|
|
82
|
+
\`\`\`bash
|
|
83
|
+
SCRIPT=$(find . -path '*/learn-anything-topic/scripts/render.mjs' -print -quit 2>/dev/null)
|
|
84
|
+
node "$SCRIPT" ./.learn/topics/<topic-name>
|
|
85
85
|
\`\`\`
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
render.mjs validates state.json against the v1 schema and generates knowledge-map.md. If validation fails, fix state.json and re-run render.mjs. Do NOT manually write knowledge-map.md.
|
|
88
88
|
|
|
89
|
-
### Step 5: Present
|
|
89
|
+
### Step 5: Present the knowledge map
|
|
90
90
|
|
|
91
91
|
Display the knowledge map as an ASCII tree:
|
|
92
92
|
|
|
@@ -106,69 +106,60 @@ Async Programming Tooling & Engineering
|
|
|
106
106
|
โโโ Event Loop โโโ Build Tools
|
|
107
107
|
\`\`\`
|
|
108
108
|
|
|
109
|
-
Then
|
|
109
|
+
Then guide the user:
|
|
110
110
|
|
|
111
111
|
> This is the knowledge landscape for **JavaScript**. You can start learning by:
|
|
112
112
|
>
|
|
113
|
-
> - **
|
|
114
|
-
> - **Practice coding**: \`/learn-practice Promise\` โ
|
|
115
|
-
> - **Check progress**: \`/learn-status\` โ
|
|
113
|
+
> - **Explain a concept**: \`/learn-explain closures\` โ deep-dive into a concept
|
|
114
|
+
> - **Practice coding**: \`/learn-practice Promise\` โ learn by writing code
|
|
115
|
+
> - **Check progress**: \`/learn-status\` โ view your learning progress anytime
|
|
116
116
|
>
|
|
117
|
-
> Where would you like to start?
|
|
117
|
+
> Where would you like to start?
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
121
121
|
## Load Existing Topic Workflow
|
|
122
122
|
|
|
123
|
-
### Step 2: Read
|
|
123
|
+
### Step 2: Read state.json
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
2. Use the Read tool to read \`./.learn/topics/<topic-name>/state.yaml\`
|
|
125
|
+
Read \`./.learn/topics/<topic-name>/state.json\` โ state.json is the single source of truth, do NOT read knowledge-map.md or state.yaml.
|
|
127
126
|
|
|
128
127
|
### Step 3: Calculate and display progress
|
|
129
128
|
|
|
130
|
-
|
|
131
|
-
- โ
Concepts mastered
|
|
132
|
-
- ๐ Concepts in progress
|
|
133
|
-
- โ ๏ธ Concepts needing practice
|
|
134
|
-
- โฌ Concepts unexplored
|
|
135
|
-
|
|
129
|
+
From the domains/concepts structure, calculate: ๐ข mastered, ๐ต in progress, ๐ needs practice, โช unexplored.
|
|
136
130
|
Display the knowledge map with status markers.
|
|
137
131
|
|
|
138
132
|
### Step 4: Give personalized recommendations
|
|
139
133
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
4. **Concepts with older last_practiced** โ Recommend review based on spaced repetition
|
|
134
|
+
Priority order:
|
|
135
|
+
1. **needs_practice** โ suggest practice for reinforcement
|
|
136
|
+
2. **in_progress** โ suggest continuing deeper learning
|
|
137
|
+
3. **unexplored** โ suggest expanding knowledge boundaries
|
|
138
|
+
4. **older last_practiced** โ suggest spaced repetition review
|
|
146
139
|
|
|
147
140
|
Example:
|
|
148
141
|
|
|
149
142
|
> ๐ Your progress: 3 mastered, 2 in progress, 1 needs practice, 12 unexplored
|
|
150
143
|
>
|
|
151
144
|
> ๐ฏ Suggested next steps:
|
|
152
|
-
> 1.
|
|
153
|
-
> 2.
|
|
154
|
-
> 3. ๐ Explore
|
|
155
|
-
>
|
|
145
|
+
> 1. ๐ **Prototypes** โ needs practice to solidify (last studied 3 days ago)
|
|
146
|
+
> 2. ๐ต Continue with **Event Loop** โ you last covered macrotasks and microtasks
|
|
147
|
+
> 3. ๐ Explore: **Module System** โ extends concepts you've already mastered
|
|
156
148
|
> Which would you like to pursue?
|
|
157
149
|
|
|
158
150
|
---
|
|
159
151
|
|
|
160
152
|
## Edge Cases
|
|
161
153
|
|
|
162
|
-
- **
|
|
163
|
-
- **
|
|
164
|
-
- **Knowledge map too large**: If the topic requires more than 30 concepts, prompt the user "This is a very broad topic. I'd suggest breaking it into smaller sub-topics. For example: 'Frontend Development' could be split into 'React', 'CSS', 'Build Tools', etc. Would you like to split it, or continue anyway?"`;
|
|
154
|
+
- **Topic name with special characters**: replace spaces and special characters with hyphens.
|
|
155
|
+
- **Knowledge map too large** (>30 concepts): suggest breaking into sub-topics. E.g., "Frontend Development" โ "React", "CSS", "Build Tools". Ask if they want to split or continue.`;
|
|
165
156
|
const COMMAND_NAME = 'Learn: Topic';
|
|
166
157
|
const COMMAND_DESCRIPTION = 'Initialize or load a learning topic โ view knowledge map, track progress, choose your path';
|
|
167
158
|
const COMMAND_CONTENT = `Use the learn-anything-topic skill to handle the user's /learn <topic-name> request.
|
|
168
159
|
Follow the workflow defined in the skill:
|
|
169
160
|
1. Determine if the topic exists
|
|
170
|
-
2. New topic: create directory structure โ generate knowledge-map.md
|
|
171
|
-
3. Existing topic: read
|
|
161
|
+
2. New topic: create directory structure โ generate state.json (v1 with domains/concepts hierarchy) โ run render.mjs to generate knowledge-map.md โ present knowledge map and guide the user
|
|
162
|
+
3. Existing topic: read state.json โ calculate progress โ give personalized recommendations`;
|
|
172
163
|
export function getLearnTopicSkillTemplate() {
|
|
173
164
|
return {
|
|
174
165
|
name: SKILL_NAME,
|
package/dist/i18n/index.js
CHANGED
|
@@ -8,10 +8,7 @@ export function getMessages(locale) {
|
|
|
8
8
|
return messages[locale];
|
|
9
9
|
}
|
|
10
10
|
export function detectSystemLocale() {
|
|
11
|
-
const langEnv = process.env.LANG ||
|
|
12
|
-
process.env.LC_ALL ||
|
|
13
|
-
process.env.LANGUAGE ||
|
|
14
|
-
'';
|
|
11
|
+
const langEnv = process.env.LANG || process.env.LC_ALL || process.env.LANGUAGE || '';
|
|
15
12
|
if (/^zh[_-]/i.test(langEnv)) {
|
|
16
13
|
return 'zh-CN';
|
|
17
14
|
}
|
package/dist/i18n/locales/en.js
CHANGED
|
@@ -23,6 +23,7 @@ export const en = {
|
|
|
23
23
|
availableCommands: 'Available learning commands:',
|
|
24
24
|
cmdLine: (cmd, desc) => ` ${cmd}${desc}`,
|
|
25
25
|
interactiveSelectPrompt: 'Select AI tools to generate skills for (space to select, enter to confirm):',
|
|
26
|
+
migrationComplete: (count) => `Migrated ${count} topic(s) from v0 to v1 format (backups created).`,
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
//# sourceMappingURL=en.js.map
|
|
@@ -23,6 +23,7 @@ export const zhCN = {
|
|
|
23
23
|
availableCommands: 'ๅฏ็จ็ๅญฆไน ๅฝไปค๏ผ',
|
|
24
24
|
cmdLine: (cmd, desc) => ` ${cmd}${desc}`,
|
|
25
25
|
interactiveSelectPrompt: '้ๆฉ่ฆ็ๆๆ่ฝ็ AI ๅทฅๅ
ท๏ผ็ฉบๆ ผ้ๆฉ๏ผๅ่ฝฆ็กฎ่ฎค๏ผ๏ผ',
|
|
26
|
+
migrationComplete: (count) => `ๅทฒ่ฟ็งป ${count} ไธชไธป้ขไป v0 ๅฐ v1 ๆ ผๅผ๏ผๅทฒๅๅปบๅคไปฝ๏ผใ`,
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
//# sourceMappingURL=zh-CN.js.map
|
package/dist/i18n/types.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* render.mjs โ standalone script
|
|
4
|
+
* Reads state.json (v1) and renders knowledge-map.md.
|
|
5
|
+
*
|
|
6
|
+
* Usage: node render.mjs <topic-dir>
|
|
7
|
+
*
|
|
8
|
+
* This file is compiled from src/scripts/render.mts via tsc and
|
|
9
|
+
* copied into each skill's scripts/ directory by init/update.
|
|
10
|
+
*/
|
|
11
|
+
import type { StateV1 } from './utils.mjs';
|
|
12
|
+
export declare function render(state: StateV1): string;
|
|
13
|
+
//# sourceMappingURL=render.d.mts.map
|