@ngxtm/devkit 3.8.0 → 3.10.0
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/cli/init.js +22 -10
- package/cli/update.js +18 -9
- package/package.json +1 -1
- package/templates/base/rules/auto-skill.md +139 -0
package/cli/init.js
CHANGED
|
@@ -85,18 +85,22 @@ function installForTool(toolId, tool, projectDir, options = {}) {
|
|
|
85
85
|
let totalFiles = 0;
|
|
86
86
|
const stats = {};
|
|
87
87
|
|
|
88
|
-
// 1. Install commands (if tool supports it)
|
|
88
|
+
// 1. Install core commands (if tool supports it) - optimized size ~400KB
|
|
89
89
|
if (tool.commandsPath) {
|
|
90
|
-
const
|
|
90
|
+
const coreCommandsDir = path.join(PACKAGE_ROOT, 'core-commands');
|
|
91
91
|
const commandsDir = path.join(targetDir, tool.commandsPath);
|
|
92
92
|
|
|
93
|
-
if (fs.existsSync(
|
|
94
|
-
const count = copyDir(
|
|
93
|
+
if (fs.existsSync(coreCommandsDir)) {
|
|
94
|
+
const count = copyDir(coreCommandsDir, commandsDir);
|
|
95
95
|
stats.commands = count;
|
|
96
96
|
totalFiles += count;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
// Note: Skills are loaded on-demand from skills-compact.json
|
|
101
|
+
// Full skills are NOT copied to reduce installation size
|
|
102
|
+
// User can run "devkit add-skills" to install specific skill packs
|
|
103
|
+
|
|
100
104
|
// 2. Install rules
|
|
101
105
|
if (tool.rulesPath && options.rules && options.rules.length > 0) {
|
|
102
106
|
const rulesDir = path.join(targetDir, tool.rulesPath);
|
|
@@ -136,14 +140,22 @@ function installForTool(toolId, tool, projectDir, options = {}) {
|
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
// 4. Install
|
|
140
|
-
const
|
|
141
|
-
if (fs.existsSync(
|
|
142
|
-
fs.copyFileSync(
|
|
143
|
+
// 4. Install compact skill index (for auto-detection, ~20KB only)
|
|
144
|
+
const compactIndex = path.join(PACKAGE_ROOT, 'skills-compact.json');
|
|
145
|
+
if (fs.existsSync(compactIndex)) {
|
|
146
|
+
fs.copyFileSync(compactIndex, path.join(targetDir, 'skills-compact.json'));
|
|
143
147
|
totalFiles++;
|
|
144
148
|
}
|
|
145
149
|
|
|
146
|
-
// 5.
|
|
150
|
+
// 5. Install base rules (including auto-skill detection)
|
|
151
|
+
const baseRulesDir = path.join(PACKAGE_ROOT, 'templates', 'base', 'rules');
|
|
152
|
+
if (tool.rulesPath && fs.existsSync(baseRulesDir)) {
|
|
153
|
+
const destRulesDir = path.join(targetDir, tool.rulesPath, 'base');
|
|
154
|
+
const count = copyDir(baseRulesDir, destRulesDir);
|
|
155
|
+
totalFiles += count;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 6. Create devkit.json tracking file
|
|
147
159
|
const devkitConfig = {
|
|
148
160
|
version: VERSION,
|
|
149
161
|
tool: toolId,
|
|
@@ -164,7 +176,7 @@ function installForTool(toolId, tool, projectDir, options = {}) {
|
|
|
164
176
|
);
|
|
165
177
|
totalFiles++;
|
|
166
178
|
|
|
167
|
-
//
|
|
179
|
+
// 7. Create settings.json if not exists (for tools that use it)
|
|
168
180
|
if (toolId === 'claude') {
|
|
169
181
|
const settingsPath = path.join(targetDir, 'settings.json');
|
|
170
182
|
if (!fs.existsSync(settingsPath)) {
|
package/cli/update.js
CHANGED
|
@@ -56,15 +56,17 @@ function updateToolInstallation(toolId, tool, projectDir, options = {}) {
|
|
|
56
56
|
|
|
57
57
|
let updatedCount = 0;
|
|
58
58
|
|
|
59
|
-
// 1. Update commands (if tool supports it)
|
|
59
|
+
// 1. Update core commands (if tool supports it) - optimized size ~400KB
|
|
60
60
|
if (tool.commandsPath) {
|
|
61
|
-
const
|
|
61
|
+
const coreCommandsDir = path.join(PACKAGE_ROOT, 'core-commands');
|
|
62
62
|
const commandsDir = path.join(targetDir, tool.commandsPath);
|
|
63
|
-
if (fs.existsSync(
|
|
64
|
-
updatedCount += copyDir(
|
|
63
|
+
if (fs.existsSync(coreCommandsDir)) {
|
|
64
|
+
updatedCount += copyDir(coreCommandsDir, commandsDir);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// Note: Skills are loaded on-demand, not copied to project
|
|
69
|
+
|
|
68
70
|
// 2. Update rules
|
|
69
71
|
if (tool.rulesPath && options.rules && options.rules.length > 0) {
|
|
70
72
|
const rulesDir = path.join(targetDir, tool.rulesPath);
|
|
@@ -97,14 +99,21 @@ function updateToolInstallation(toolId, tool, projectDir, options = {}) {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
// 5. Update
|
|
101
|
-
const
|
|
102
|
-
if (fs.existsSync(
|
|
103
|
-
fs.copyFileSync(
|
|
102
|
+
// 5. Update compact skill index (for auto-detection, ~20KB only)
|
|
103
|
+
const compactIndex = path.join(PACKAGE_ROOT, 'skills-compact.json');
|
|
104
|
+
if (fs.existsSync(compactIndex)) {
|
|
105
|
+
fs.copyFileSync(compactIndex, path.join(targetDir, 'skills-compact.json'));
|
|
104
106
|
updatedCount++;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
// 6. Update
|
|
109
|
+
// 6. Update base rules (including auto-skill detection)
|
|
110
|
+
const baseRulesDir = path.join(PACKAGE_ROOT, 'templates', 'base', 'rules');
|
|
111
|
+
if (tool.rulesPath && fs.existsSync(baseRulesDir)) {
|
|
112
|
+
const destRulesDir = path.join(targetDir, tool.rulesPath, 'base');
|
|
113
|
+
updatedCount += copyDir(baseRulesDir, destRulesDir);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 7. Update devkit.json
|
|
108
117
|
const newConfig = {
|
|
109
118
|
...config,
|
|
110
119
|
version: VERSION,
|
package/package.json
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Auto-Skill Detection
|
|
2
|
+
|
|
3
|
+
> Automatically detect and suggest relevant skills based on user's task
|
|
4
|
+
|
|
5
|
+
## When to Activate
|
|
6
|
+
|
|
7
|
+
Before starting ANY coding task, you SHOULD check if a relevant skill exists:
|
|
8
|
+
|
|
9
|
+
1. **Analyze the user's request** - Extract key technologies, patterns, or domains
|
|
10
|
+
2. **Check compact index** - Read `skills-compact.json` (~20KB) for skill names and categories
|
|
11
|
+
3. **Suggest to user** - Present top 1-3 matching skills
|
|
12
|
+
4. **Load on-demand** - When user confirms, read full skill from `skills/{name}/SKILL.md`
|
|
13
|
+
|
|
14
|
+
## Quick Reference: Skill Categories
|
|
15
|
+
|
|
16
|
+
| Code | Category | Examples |
|
|
17
|
+
|------|----------|----------|
|
|
18
|
+
| `fe` | Frontend | react, vue, nextjs, tailwind, ui/ux |
|
|
19
|
+
| `be` | Backend | node, express, nestjs, fastapi, api |
|
|
20
|
+
| `db` | Database | postgres, mysql, mongodb, redis, prisma |
|
|
21
|
+
| `ai` | AI/ML | llm, agents, rag, mcp, embeddings |
|
|
22
|
+
| `ops` | DevOps | docker, k8s, ci/cd, aws, terraform |
|
|
23
|
+
| `test` | Testing | jest, playwright, tdd, e2e |
|
|
24
|
+
| `sec` | Security | auth, oauth, jwt, owasp, pentest |
|
|
25
|
+
| `git` | Git/Workflow | pr, review, commit, branching |
|
|
26
|
+
| `mob` | Mobile | react-native, flutter, ios, android |
|
|
27
|
+
| `py` | Python | django, flask, fastapi, pandas |
|
|
28
|
+
| `go` | Golang | gin, echo, fiber, concurrency |
|
|
29
|
+
|
|
30
|
+
## Detection Flow
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
User Request → Extract keywords (react, auth, test, etc.)
|
|
34
|
+
↓
|
|
35
|
+
Read skills-compact.json
|
|
36
|
+
↓
|
|
37
|
+
Match skill names containing keywords
|
|
38
|
+
↓
|
|
39
|
+
Found? → Suggest: "I found /skill-name. Use it?"
|
|
40
|
+
↓ No
|
|
41
|
+
Check category (fe, be, ai, etc.)
|
|
42
|
+
↓
|
|
43
|
+
Suggest skills in that category
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## How to Search
|
|
47
|
+
|
|
48
|
+
### Step 1: Read Compact Index
|
|
49
|
+
```
|
|
50
|
+
Read: .claude/skills-compact.json
|
|
51
|
+
Format: { "_categories": {...}, "skills": { "skill-name": "category-code" } }
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 2: Match by Name/Keyword
|
|
55
|
+
Look for skills whose name contains user's keywords:
|
|
56
|
+
- User says "react" → find skills with "react" in name
|
|
57
|
+
- User says "authentication" → find "auth" skills
|
|
58
|
+
- User says "docker" → find "docker" skills
|
|
59
|
+
|
|
60
|
+
### Step 3: Load Full Skill
|
|
61
|
+
When user confirms, read the full skill:
|
|
62
|
+
```
|
|
63
|
+
Read: .claude/skills/{skill-name}/SKILL.md
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Suggestion Format
|
|
67
|
+
|
|
68
|
+
**Single match:**
|
|
69
|
+
```
|
|
70
|
+
I found a skill that might help:
|
|
71
|
+
|
|
72
|
+
📌 /skill-name - [category]
|
|
73
|
+
|
|
74
|
+
Load this skill? It has specialized patterns for your task.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Multiple matches (max 3):**
|
|
78
|
+
```
|
|
79
|
+
I found skills that might help:
|
|
80
|
+
|
|
81
|
+
1. /skill-1 - [category]
|
|
82
|
+
2. /skill-2 - [category]
|
|
83
|
+
3. /skill-3 - [category]
|
|
84
|
+
|
|
85
|
+
Which one should I use? (or "none" to proceed without)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Auto-Activate Triggers
|
|
89
|
+
|
|
90
|
+
Some patterns should auto-suggest specific skills:
|
|
91
|
+
|
|
92
|
+
| User says... | Suggest skill |
|
|
93
|
+
|--------------|---------------|
|
|
94
|
+
| "create PR", "pull request" | /git-advanced-workflows |
|
|
95
|
+
| "code review" | /code-review |
|
|
96
|
+
| "write tests", "add tests" | /test-master |
|
|
97
|
+
| "fix bug", "debug" | /systematic-debugging |
|
|
98
|
+
| "learn", "teach me" | /learn |
|
|
99
|
+
| "react component" | /react-expert |
|
|
100
|
+
| "nextjs", "next.js" | /nextjs-best-practices |
|
|
101
|
+
| "docker", "container" | /docker-expert |
|
|
102
|
+
| "api design" | /api-design-principles |
|
|
103
|
+
| "database schema" | /database-design |
|
|
104
|
+
| "authentication", "auth" | /auth-implementation-patterns |
|
|
105
|
+
| "mcp server" | /mcp-developer |
|
|
106
|
+
|
|
107
|
+
## Important Rules
|
|
108
|
+
|
|
109
|
+
1. **Don't auto-load** - Always ask before loading a skill
|
|
110
|
+
2. **Max 3 suggestions** - Don't overwhelm user
|
|
111
|
+
3. **Be concise** - One-line per skill
|
|
112
|
+
4. **Remember context** - If user said "none", don't suggest again for same task
|
|
113
|
+
5. **On-demand loading** - Only read full SKILL.md when user confirms
|
|
114
|
+
6. **Core commands available** - /learn, /react-expert, /docker-expert, etc. are pre-loaded
|
|
115
|
+
|
|
116
|
+
## File Locations
|
|
117
|
+
|
|
118
|
+
| File | Purpose | Size |
|
|
119
|
+
|------|---------|------|
|
|
120
|
+
| `skills-compact.json` | Quick lookup index | ~20KB |
|
|
121
|
+
| `skills/{name}/SKILL.md` | Full skill content | varies |
|
|
122
|
+
| `commands/*.md` | Core commands (pre-loaded) | ~400KB |
|
|
123
|
+
|
|
124
|
+
## Example Interaction
|
|
125
|
+
|
|
126
|
+
**User:** "Help me add JWT authentication to my Express API"
|
|
127
|
+
|
|
128
|
+
**Claude:** (reads skills-compact.json, finds "auth-implementation-patterns")
|
|
129
|
+
```
|
|
130
|
+
I found a skill that matches your task:
|
|
131
|
+
|
|
132
|
+
📌 /auth-implementation-patterns - security
|
|
133
|
+
|
|
134
|
+
This skill has JWT, OAuth2, and session patterns. Load it?
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**User:** "yes"
|
|
138
|
+
|
|
139
|
+
**Claude:** (reads skills/auth-implementation-patterns/SKILL.md and applies it)
|