@weavetab/skills 2.5.0 → 2.5.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 +108 -108
- package/ROUTER.md +43 -43
- package/bin/cli.js +232 -232
- package/browser/dom-strategy.md +121 -119
- package/browser/form-automation.md +84 -87
- package/browser/interaction-pipeline.md +242 -216
- package/browser/tab-and-window.md +136 -136
- package/desktop/desktop-targeting.md +85 -85
- package/desktop/electron-discovery.md +115 -115
- package/developer/github-forensics.md +89 -74
- package/dist/bundled/weavetab-all.md +1885 -1709
- package/dist/bundled/weavetab-browser.md +526 -501
- package/dist/bundled/weavetab-desktop.md +176 -176
- package/dist/bundled/weavetab-developer.md +84 -67
- package/dist/bundled/weavetab-documents.md +184 -142
- package/dist/bundled/weavetab-memory.md +259 -233
- package/dist/bundled/weavetab-network-and-perf.md +250 -223
- package/dist/bundled/weavetab-plugins.md +88 -83
- package/dist/bundled/weavetab-resilience.md +244 -216
- package/dist/bundled/weavetab-security.md +93 -87
- package/dist/granular/browser_dom-strategy.md +121 -119
- package/dist/granular/browser_form-automation.md +84 -87
- package/dist/granular/browser_interaction-pipeline.md +242 -216
- package/dist/granular/browser_tab-and-window.md +136 -136
- package/dist/granular/desktop_desktop-targeting.md +85 -85
- package/dist/granular/desktop_electron-discovery.md +115 -115
- package/dist/granular/developer_github-forensics.md +89 -74
- package/dist/granular/documents_canvas-and-visual-capture.md +117 -103
- package/dist/granular/documents_office-document-ingestion.md +91 -63
- package/dist/granular/memory_selector-memory-system.md +127 -127
- package/dist/granular/memory_session-trail.md +111 -95
- package/dist/granular/memory_site-learning.md +62 -53
- package/dist/granular/network-and-perf_device-and-environment.md +100 -87
- package/dist/granular/network-and-perf_network-intercept-and-mock.md +97 -84
- package/dist/granular/network-and-perf_performance-and-vitals.md +86 -84
- package/dist/granular/plugins_hooks-and-overrides.md +40 -35
- package/dist/granular/plugins_plugin-runtime.md +63 -63
- package/dist/granular/resilience_loop-breaker.md +72 -67
- package/dist/granular/resilience_session-time-travel.md +146 -131
- package/dist/granular/resilience_stale-ref-recovery.md +61 -53
- package/dist/granular/security_rbac-and-policies.md +50 -47
- package/dist/granular/security_secret-containment-protocol.md +62 -59
- package/documents/canvas-and-visual-capture.md +117 -103
- package/documents/office-document-ingestion.md +91 -63
- package/evals/evaluator.js +146 -146
- package/evals/scenarios.json +239 -239
- package/memory/selector-memory-system.md +127 -127
- package/memory/session-trail.md +111 -95
- package/memory/site-learning.md +61 -52
- package/network-and-perf/device-and-environment.md +100 -87
- package/network-and-perf/network-intercept-and-mock.md +97 -84
- package/network-and-perf/performance-and-vitals.md +86 -84
- package/package.json +74 -73
- package/plugins/hooks-and-overrides.md +40 -35
- package/plugins/plugin-runtime.md +63 -63
- package/resilience/loop-breaker.md +72 -67
- package/resilience/session-time-travel.md +146 -131
- package/resilience/stale-ref-recovery.md +61 -53
- package/security/rbac-and-policies.md +50 -47
- package/security/secret-containment-protocol.md +62 -59
- package/skills.json +425 -426
- package/src/api.js +239 -239
package/src/api.js
CHANGED
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const packageRoot = path.join(__dirname, '..');
|
|
5
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
6
|
-
const WEAVETAB_VERSION = pkg.version;
|
|
7
|
-
const skillsJsonPath = path.join(packageRoot, 'skills.json');
|
|
8
|
-
const routerPath = path.join(packageRoot, 'ROUTER.md');
|
|
9
|
-
const distBundledDir = path.join(packageRoot, 'dist', 'bundled');
|
|
10
|
-
|
|
11
|
-
const ALL_DOMAINS = [
|
|
12
|
-
'browser',
|
|
13
|
-
'desktop',
|
|
14
|
-
'memory',
|
|
15
|
-
'resilience',
|
|
16
|
-
'security',
|
|
17
|
-
'plugins',
|
|
18
|
-
'network-and-perf',
|
|
19
|
-
'documents',
|
|
20
|
-
'developer'
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Read the pre-compiled skills catalog.
|
|
25
|
-
*/
|
|
26
|
-
function getSkills() {
|
|
27
|
-
if (!fs.existsSync(skillsJsonPath)) {
|
|
28
|
-
throw new Error("skills.json not found. Run 'npm run build' first.");
|
|
29
|
-
}
|
|
30
|
-
return JSON.parse(fs.readFileSync(skillsJsonPath, 'utf8'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Retrieve a specific skill by its ID.
|
|
35
|
-
*/
|
|
36
|
-
function getSkill(id) {
|
|
37
|
-
const data = getSkills();
|
|
38
|
-
return data.skills.find(s => s.id === id) || null;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Retrieve all skills belonging to a domain.
|
|
43
|
-
*/
|
|
44
|
-
function getSkillsByDomain(domain) {
|
|
45
|
-
const data = getSkills();
|
|
46
|
-
return data.skills.filter(s => s.domain === domain);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Read the universal intent decision matrix (ROUTER.md).
|
|
51
|
-
*/
|
|
52
|
-
function getRouterMatrix() {
|
|
53
|
-
if (!fs.existsSync(routerPath)) return "";
|
|
54
|
-
return fs.readFileSync(routerPath, 'utf8');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Programmatically install Weavetab MCP skills into a target project.
|
|
59
|
-
*
|
|
60
|
-
* @param {Object} options
|
|
61
|
-
* @param {string} options.targetFramework - '.agents', '.cursor', '.clinerules', '.windsurf', '.openclaw', '.roocode', '.aider', or 'generic'
|
|
62
|
-
* @param {string[]} [options.domains] - Domains to install (e.g. ['browser', 'security']). Defaults to all domains.
|
|
63
|
-
* @param {string} [options.projectRoot] - Root directory to install into (defaults to process.cwd())
|
|
64
|
-
* @param {boolean} [options.includeRouter=true] - Whether to include the Step-0 ROUTER.md matrix.
|
|
65
|
-
* @returns {Promise<string>} - Confirmation message and target path.
|
|
66
|
-
*/
|
|
67
|
-
async function installSkills({
|
|
68
|
-
targetFramework,
|
|
69
|
-
domains = ALL_DOMAINS,
|
|
70
|
-
projectRoot = process.cwd(),
|
|
71
|
-
includeRouter = true
|
|
72
|
-
}) {
|
|
73
|
-
if (!targetFramework) {
|
|
74
|
-
throw new Error("targetFramework is required (e.g. '.agents', '.cursor', '.clinerules').");
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (!domains || domains.length === 0) {
|
|
78
|
-
domains = ALL_DOMAINS;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const routerContent = getRouterMatrix();
|
|
82
|
-
|
|
83
|
-
// Load domain bundled content
|
|
84
|
-
const domainBundles = {};
|
|
85
|
-
for (const domain of domains) {
|
|
86
|
-
const bundleFile = path.join(distBundledDir, `weavetab-${domain}.md`);
|
|
87
|
-
if (fs.existsSync(bundleFile)) {
|
|
88
|
-
domainBundles[domain] = fs.readFileSync(bundleFile, 'utf8');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// 1. Antigravity & Standard Agent Tree (.agent/skills/<skill-name>/SKILL.md)
|
|
93
|
-
if (targetFramework === '.agents' || targetFramework === '.agent') {
|
|
94
|
-
const baseSkillsDir = path.join(projectRoot, '.agent', 'skills');
|
|
95
|
-
fs.mkdirSync(baseSkillsDir, { recursive: true });
|
|
96
|
-
|
|
97
|
-
if (includeRouter) {
|
|
98
|
-
const routerDir = path.join(baseSkillsDir, 'weavetab-router');
|
|
99
|
-
fs.mkdirSync(routerDir, { recursive: true });
|
|
100
|
-
const routerFrontmatter = [
|
|
101
|
-
"---",
|
|
102
|
-
"name: weavetab-router",
|
|
103
|
-
"description: Step-0 Universal Intent Decision Matrix for Weavetab MCP automation",
|
|
104
|
-
"---",
|
|
105
|
-
"",
|
|
106
|
-
routerContent
|
|
107
|
-
].join('\n');
|
|
108
|
-
fs.writeFileSync(path.join(routerDir, 'SKILL.md'), routerFrontmatter);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
112
|
-
const skillDir = path.join(baseSkillsDir, `weavetab-${domain}`);
|
|
113
|
-
fs.mkdirSync(skillDir, { recursive: true });
|
|
114
|
-
const frontmatter = [
|
|
115
|
-
"---",
|
|
116
|
-
`name: weavetab-${domain}`,
|
|
117
|
-
`description: Operational guidance for Weavetab MCP ${domain} domain automation and tool protocols.`,
|
|
118
|
-
"---",
|
|
119
|
-
"",
|
|
120
|
-
content
|
|
121
|
-
].join('\n');
|
|
122
|
-
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), frontmatter);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return `Successfully installed ${domains.length} domain skills to ${baseSkillsDir}`;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// 2. Cursor IDE (.cursor/rules/weavetab-<domain>.mdc)
|
|
129
|
-
else if (targetFramework === '.cursor') {
|
|
130
|
-
const cursorRulesDir = path.join(projectRoot, '.cursor', 'rules');
|
|
131
|
-
fs.mkdirSync(cursorRulesDir, { recursive: true });
|
|
132
|
-
|
|
133
|
-
if (includeRouter) {
|
|
134
|
-
const routerMdc = [
|
|
135
|
-
"---",
|
|
136
|
-
"description: Universal Agent Intent Decision Matrix for Weavetab MCP",
|
|
137
|
-
"globs: *",
|
|
138
|
-
"alwaysApply: false",
|
|
139
|
-
"---",
|
|
140
|
-
"",
|
|
141
|
-
routerContent
|
|
142
|
-
].join('\n');
|
|
143
|
-
fs.writeFileSync(path.join(cursorRulesDir, 'weavetab-router.mdc'), routerMdc);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
147
|
-
const mdcContent = [
|
|
148
|
-
"---",
|
|
149
|
-
`description: Weavetab MCP operational rules for ${domain}`,
|
|
150
|
-
"globs: *",
|
|
151
|
-
"alwaysApply: false",
|
|
152
|
-
"---",
|
|
153
|
-
"",
|
|
154
|
-
content
|
|
155
|
-
].join('\n');
|
|
156
|
-
fs.writeFileSync(path.join(cursorRulesDir, `weavetab-${domain}.mdc`), mdcContent);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return `Successfully installed ${domains.length} Cursor rules to ${cursorRulesDir}`;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 3. Cline (.clinerules single file)
|
|
163
|
-
else if (targetFramework === '.clinerules') {
|
|
164
|
-
const clineFile = path.join(projectRoot, '.clinerules');
|
|
165
|
-
let combined = `\n\n# ====================================================\n# Weavetab MCP Skills (v${WEAVETAB_VERSION})\n# ====================================================\n\n`;
|
|
166
|
-
if (includeRouter) {
|
|
167
|
-
combined += routerContent + "\n\n";
|
|
168
|
-
}
|
|
169
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
170
|
-
combined += `\n\n# --- DOMAIN: ${domain.toUpperCase()} ---\n\n${content}\n`;
|
|
171
|
-
}
|
|
172
|
-
fs.appendFileSync(clineFile, combined);
|
|
173
|
-
return `Successfully appended ${domains.length} domains to ${clineFile}`;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// 4. Windsurf IDE (.windsurf/rules/weavetab-<domain>.md)
|
|
177
|
-
else if (targetFramework === '.windsurf') {
|
|
178
|
-
const windsurfDir = path.join(projectRoot, '.windsurf', 'rules');
|
|
179
|
-
fs.mkdirSync(windsurfDir, { recursive: true });
|
|
180
|
-
|
|
181
|
-
if (includeRouter) {
|
|
182
|
-
fs.writeFileSync(path.join(windsurfDir, 'weavetab-router.md'), routerContent);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
186
|
-
fs.writeFileSync(path.join(windsurfDir, `weavetab-${domain}.md`), content);
|
|
187
|
-
}
|
|
188
|
-
return `Successfully installed ${domains.length} rules to ${windsurfDir}`;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// 5. OpenClaw (.openclaw/skills/weavetab-<domain>/SKILL.md)
|
|
192
|
-
else if (targetFramework === '.openclaw') {
|
|
193
|
-
const openClawDir = path.join(projectRoot, '.openclaw', 'skills');
|
|
194
|
-
fs.mkdirSync(openClawDir, { recursive: true });
|
|
195
|
-
|
|
196
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
197
|
-
const dir = path.join(openClawDir, `weavetab-${domain}`);
|
|
198
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
199
|
-
fs.writeFileSync(path.join(dir, 'SKILL.md'), content);
|
|
200
|
-
}
|
|
201
|
-
return `Successfully installed ${domains.length} skills to ${openClawDir}`;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 6. RooCode (.roocode/rules/weavetab-<domain>.md)
|
|
205
|
-
else if (targetFramework === '.roocode') {
|
|
206
|
-
const rooDir = path.join(projectRoot, '.roocode', 'rules');
|
|
207
|
-
fs.mkdirSync(rooDir, { recursive: true });
|
|
208
|
-
|
|
209
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
210
|
-
fs.writeFileSync(path.join(rooDir, `weavetab-${domain}.md`), content);
|
|
211
|
-
}
|
|
212
|
-
return `Successfully installed ${domains.length} rules to ${rooDir}`;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// 7. Generic / Raw Markdown
|
|
216
|
-
else {
|
|
217
|
-
const genericDir = path.join(projectRoot, 'weavetab-skills');
|
|
218
|
-
fs.mkdirSync(genericDir, { recursive: true });
|
|
219
|
-
|
|
220
|
-
if (includeRouter) {
|
|
221
|
-
fs.writeFileSync(path.join(genericDir, 'ROUTER.md'), routerContent);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
225
|
-
fs.writeFileSync(path.join(genericDir, `weavetab-${domain}.md`), content);
|
|
226
|
-
}
|
|
227
|
-
return `Successfully installed ${domains.length} domain bundles to ${genericDir}`;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
module.exports = {
|
|
232
|
-
WEAVETAB_VERSION,
|
|
233
|
-
installSkills,
|
|
234
|
-
getSkills,
|
|
235
|
-
getSkill,
|
|
236
|
-
getSkillsByDomain,
|
|
237
|
-
getRouterMatrix,
|
|
238
|
-
ALL_DOMAINS
|
|
239
|
-
};
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const packageRoot = path.join(__dirname, '..');
|
|
5
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
6
|
+
const WEAVETAB_VERSION = pkg.version;
|
|
7
|
+
const skillsJsonPath = path.join(packageRoot, 'skills.json');
|
|
8
|
+
const routerPath = path.join(packageRoot, 'ROUTER.md');
|
|
9
|
+
const distBundledDir = path.join(packageRoot, 'dist', 'bundled');
|
|
10
|
+
|
|
11
|
+
const ALL_DOMAINS = [
|
|
12
|
+
'browser',
|
|
13
|
+
'desktop',
|
|
14
|
+
'memory',
|
|
15
|
+
'resilience',
|
|
16
|
+
'security',
|
|
17
|
+
'plugins',
|
|
18
|
+
'network-and-perf',
|
|
19
|
+
'documents',
|
|
20
|
+
'developer'
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Read the pre-compiled skills catalog.
|
|
25
|
+
*/
|
|
26
|
+
function getSkills() {
|
|
27
|
+
if (!fs.existsSync(skillsJsonPath)) {
|
|
28
|
+
throw new Error("skills.json not found. Run 'npm run build' first.");
|
|
29
|
+
}
|
|
30
|
+
return JSON.parse(fs.readFileSync(skillsJsonPath, 'utf8'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve a specific skill by its ID.
|
|
35
|
+
*/
|
|
36
|
+
function getSkill(id) {
|
|
37
|
+
const data = getSkills();
|
|
38
|
+
return data.skills.find(s => s.id === id) || null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve all skills belonging to a domain.
|
|
43
|
+
*/
|
|
44
|
+
function getSkillsByDomain(domain) {
|
|
45
|
+
const data = getSkills();
|
|
46
|
+
return data.skills.filter(s => s.domain === domain);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Read the universal intent decision matrix (ROUTER.md).
|
|
51
|
+
*/
|
|
52
|
+
function getRouterMatrix() {
|
|
53
|
+
if (!fs.existsSync(routerPath)) return "";
|
|
54
|
+
return fs.readFileSync(routerPath, 'utf8');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Programmatically install Weavetab MCP skills into a target project.
|
|
59
|
+
*
|
|
60
|
+
* @param {Object} options
|
|
61
|
+
* @param {string} options.targetFramework - '.agents', '.cursor', '.clinerules', '.windsurf', '.openclaw', '.roocode', '.aider', or 'generic'
|
|
62
|
+
* @param {string[]} [options.domains] - Domains to install (e.g. ['browser', 'security']). Defaults to all domains.
|
|
63
|
+
* @param {string} [options.projectRoot] - Root directory to install into (defaults to process.cwd())
|
|
64
|
+
* @param {boolean} [options.includeRouter=true] - Whether to include the Step-0 ROUTER.md matrix.
|
|
65
|
+
* @returns {Promise<string>} - Confirmation message and target path.
|
|
66
|
+
*/
|
|
67
|
+
async function installSkills({
|
|
68
|
+
targetFramework,
|
|
69
|
+
domains = ALL_DOMAINS,
|
|
70
|
+
projectRoot = process.cwd(),
|
|
71
|
+
includeRouter = true
|
|
72
|
+
}) {
|
|
73
|
+
if (!targetFramework) {
|
|
74
|
+
throw new Error("targetFramework is required (e.g. '.agents', '.cursor', '.clinerules').");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!domains || domains.length === 0) {
|
|
78
|
+
domains = ALL_DOMAINS;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const routerContent = getRouterMatrix();
|
|
82
|
+
|
|
83
|
+
// Load domain bundled content
|
|
84
|
+
const domainBundles = {};
|
|
85
|
+
for (const domain of domains) {
|
|
86
|
+
const bundleFile = path.join(distBundledDir, `weavetab-${domain}.md`);
|
|
87
|
+
if (fs.existsSync(bundleFile)) {
|
|
88
|
+
domainBundles[domain] = fs.readFileSync(bundleFile, 'utf8');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 1. Antigravity & Standard Agent Tree (.agent/skills/<skill-name>/SKILL.md)
|
|
93
|
+
if (targetFramework === '.agents' || targetFramework === '.agent') {
|
|
94
|
+
const baseSkillsDir = path.join(projectRoot, '.agent', 'skills');
|
|
95
|
+
fs.mkdirSync(baseSkillsDir, { recursive: true });
|
|
96
|
+
|
|
97
|
+
if (includeRouter) {
|
|
98
|
+
const routerDir = path.join(baseSkillsDir, 'weavetab-router');
|
|
99
|
+
fs.mkdirSync(routerDir, { recursive: true });
|
|
100
|
+
const routerFrontmatter = [
|
|
101
|
+
"---",
|
|
102
|
+
"name: weavetab-router",
|
|
103
|
+
"description: Step-0 Universal Intent Decision Matrix for Weavetab MCP automation",
|
|
104
|
+
"---",
|
|
105
|
+
"",
|
|
106
|
+
routerContent
|
|
107
|
+
].join('\n');
|
|
108
|
+
fs.writeFileSync(path.join(routerDir, 'SKILL.md'), routerFrontmatter);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
112
|
+
const skillDir = path.join(baseSkillsDir, `weavetab-${domain}`);
|
|
113
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
114
|
+
const frontmatter = [
|
|
115
|
+
"---",
|
|
116
|
+
`name: weavetab-${domain}`,
|
|
117
|
+
`description: Operational guidance for Weavetab MCP ${domain} domain automation and tool protocols.`,
|
|
118
|
+
"---",
|
|
119
|
+
"",
|
|
120
|
+
content
|
|
121
|
+
].join('\n');
|
|
122
|
+
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), frontmatter);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return `Successfully installed ${domains.length} domain skills to ${baseSkillsDir}`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 2. Cursor IDE (.cursor/rules/weavetab-<domain>.mdc)
|
|
129
|
+
else if (targetFramework === '.cursor') {
|
|
130
|
+
const cursorRulesDir = path.join(projectRoot, '.cursor', 'rules');
|
|
131
|
+
fs.mkdirSync(cursorRulesDir, { recursive: true });
|
|
132
|
+
|
|
133
|
+
if (includeRouter) {
|
|
134
|
+
const routerMdc = [
|
|
135
|
+
"---",
|
|
136
|
+
"description: Universal Agent Intent Decision Matrix for Weavetab MCP",
|
|
137
|
+
"globs: *",
|
|
138
|
+
"alwaysApply: false",
|
|
139
|
+
"---",
|
|
140
|
+
"",
|
|
141
|
+
routerContent
|
|
142
|
+
].join('\n');
|
|
143
|
+
fs.writeFileSync(path.join(cursorRulesDir, 'weavetab-router.mdc'), routerMdc);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
147
|
+
const mdcContent = [
|
|
148
|
+
"---",
|
|
149
|
+
`description: Weavetab MCP operational rules for ${domain}`,
|
|
150
|
+
"globs: *",
|
|
151
|
+
"alwaysApply: false",
|
|
152
|
+
"---",
|
|
153
|
+
"",
|
|
154
|
+
content
|
|
155
|
+
].join('\n');
|
|
156
|
+
fs.writeFileSync(path.join(cursorRulesDir, `weavetab-${domain}.mdc`), mdcContent);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return `Successfully installed ${domains.length} Cursor rules to ${cursorRulesDir}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 3. Cline (.clinerules single file)
|
|
163
|
+
else if (targetFramework === '.clinerules') {
|
|
164
|
+
const clineFile = path.join(projectRoot, '.clinerules');
|
|
165
|
+
let combined = `\n\n# ====================================================\n# Weavetab MCP Skills (v${WEAVETAB_VERSION})\n# ====================================================\n\n`;
|
|
166
|
+
if (includeRouter) {
|
|
167
|
+
combined += routerContent + "\n\n";
|
|
168
|
+
}
|
|
169
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
170
|
+
combined += `\n\n# --- DOMAIN: ${domain.toUpperCase()} ---\n\n${content}\n`;
|
|
171
|
+
}
|
|
172
|
+
fs.appendFileSync(clineFile, combined);
|
|
173
|
+
return `Successfully appended ${domains.length} domains to ${clineFile}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// 4. Windsurf IDE (.windsurf/rules/weavetab-<domain>.md)
|
|
177
|
+
else if (targetFramework === '.windsurf') {
|
|
178
|
+
const windsurfDir = path.join(projectRoot, '.windsurf', 'rules');
|
|
179
|
+
fs.mkdirSync(windsurfDir, { recursive: true });
|
|
180
|
+
|
|
181
|
+
if (includeRouter) {
|
|
182
|
+
fs.writeFileSync(path.join(windsurfDir, 'weavetab-router.md'), routerContent);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
186
|
+
fs.writeFileSync(path.join(windsurfDir, `weavetab-${domain}.md`), content);
|
|
187
|
+
}
|
|
188
|
+
return `Successfully installed ${domains.length} rules to ${windsurfDir}`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 5. OpenClaw (.openclaw/skills/weavetab-<domain>/SKILL.md)
|
|
192
|
+
else if (targetFramework === '.openclaw') {
|
|
193
|
+
const openClawDir = path.join(projectRoot, '.openclaw', 'skills');
|
|
194
|
+
fs.mkdirSync(openClawDir, { recursive: true });
|
|
195
|
+
|
|
196
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
197
|
+
const dir = path.join(openClawDir, `weavetab-${domain}`);
|
|
198
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
199
|
+
fs.writeFileSync(path.join(dir, 'SKILL.md'), content);
|
|
200
|
+
}
|
|
201
|
+
return `Successfully installed ${domains.length} skills to ${openClawDir}`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// 6. RooCode (.roocode/rules/weavetab-<domain>.md)
|
|
205
|
+
else if (targetFramework === '.roocode') {
|
|
206
|
+
const rooDir = path.join(projectRoot, '.roocode', 'rules');
|
|
207
|
+
fs.mkdirSync(rooDir, { recursive: true });
|
|
208
|
+
|
|
209
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
210
|
+
fs.writeFileSync(path.join(rooDir, `weavetab-${domain}.md`), content);
|
|
211
|
+
}
|
|
212
|
+
return `Successfully installed ${domains.length} rules to ${rooDir}`;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 7. Generic / Raw Markdown
|
|
216
|
+
else {
|
|
217
|
+
const genericDir = path.join(projectRoot, 'weavetab-skills');
|
|
218
|
+
fs.mkdirSync(genericDir, { recursive: true });
|
|
219
|
+
|
|
220
|
+
if (includeRouter) {
|
|
221
|
+
fs.writeFileSync(path.join(genericDir, 'ROUTER.md'), routerContent);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
for (const [domain, content] of Object.entries(domainBundles)) {
|
|
225
|
+
fs.writeFileSync(path.join(genericDir, `weavetab-${domain}.md`), content);
|
|
226
|
+
}
|
|
227
|
+
return `Successfully installed ${domains.length} domain bundles to ${genericDir}`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
module.exports = {
|
|
232
|
+
WEAVETAB_VERSION,
|
|
233
|
+
installSkills,
|
|
234
|
+
getSkills,
|
|
235
|
+
getSkill,
|
|
236
|
+
getSkillsByDomain,
|
|
237
|
+
getRouterMatrix,
|
|
238
|
+
ALL_DOMAINS
|
|
239
|
+
};
|