specweave 1.0.71 → 1.0.73
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/CLAUDE.md +38 -31
- package/dist/src/cli/commands/save.d.ts.map +1 -1
- package/dist/src/cli/commands/save.js +29 -6
- package/dist/src/cli/commands/save.js.map +1 -1
- package/dist/src/core/auto/e2e-coverage.d.ts +413 -0
- package/dist/src/core/auto/e2e-coverage.d.ts.map +1 -0
- package/dist/src/core/auto/e2e-coverage.js +1378 -0
- package/dist/src/core/auto/e2e-coverage.js.map +1 -0
- package/dist/src/core/auto/increment-planner.js +7 -1
- package/dist/src/core/auto/increment-planner.js.map +1 -1
- package/dist/src/core/auto/index.d.ts +2 -0
- package/dist/src/core/auto/index.d.ts.map +1 -1
- package/dist/src/core/auto/index.js +10 -0
- package/dist/src/core/auto/index.js.map +1 -1
- package/dist/src/core/auto/plan-approval.d.ts +104 -0
- package/dist/src/core/auto/plan-approval.d.ts.map +1 -0
- package/dist/src/core/auto/plan-approval.js +361 -0
- package/dist/src/core/auto/plan-approval.js.map +1 -0
- package/dist/src/core/plugins/skill-trigger-extractor.d.ts +147 -0
- package/dist/src/core/plugins/skill-trigger-extractor.d.ts.map +1 -0
- package/dist/src/core/plugins/skill-trigger-extractor.js +352 -0
- package/dist/src/core/plugins/skill-trigger-extractor.js.map +1 -0
- package/dist/src/core/plugins/skill-trigger-index.d.ts +91 -0
- package/dist/src/core/plugins/skill-trigger-index.d.ts.map +1 -0
- package/dist/src/core/plugins/skill-trigger-index.js +196 -0
- package/dist/src/core/plugins/skill-trigger-index.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/commands/auto.md +197 -0
- package/plugins/specweave/commands/save.md +24 -1
- package/plugins/specweave/commands/skip-increment.md +93 -0
- package/plugins/specweave/hooks/lib/resolve-package.sh +126 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +47 -3
- package/plugins/specweave/hooks/stop-auto.sh +230 -11
- package/plugins/specweave/hooks/user-prompt-submit.sh +4 -2
- package/plugins/specweave/hooks/v2/handlers/github-sync-handler.sh +8 -0
- package/plugins/specweave/hooks/v2/handlers/living-docs-handler.sh +10 -3
- package/plugins/specweave/hooks/v2/handlers/living-specs-handler.sh +18 -7
- package/plugins/specweave/hooks/v2/handlers/project-bridge-handler.sh +10 -3
- package/plugins/specweave/hooks/v2/session-end.sh +50 -2
- package/plugins/specweave/hooks/v2/session-start.sh +68 -4
- package/plugins/specweave/scripts/chunk-prompt.js +204 -0
- package/plugins/specweave/scripts/setup-auto.sh +66 -0
- package/src/templates/CLAUDE.md.template +37 -30
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Approval for Auto Mode
|
|
3
|
+
*
|
|
4
|
+
* Displays increment plan and handles user approval/modification before execution.
|
|
5
|
+
*
|
|
6
|
+
* @module plan-approval
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Format increment plan for display
|
|
12
|
+
*
|
|
13
|
+
* @param plan - Planning result to display
|
|
14
|
+
* @param options - Display options
|
|
15
|
+
* @returns Formatted string
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const output = formatPlanDisplay(plan, { showDetails: true });
|
|
20
|
+
* console.log(output);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function formatPlanDisplay(plan, options = {}) {
|
|
24
|
+
const { showDetails = true, showDependencies = true, format = 'text' } = options;
|
|
25
|
+
if (format === 'json') {
|
|
26
|
+
return JSON.stringify(plan, null, 2);
|
|
27
|
+
}
|
|
28
|
+
const lines = [];
|
|
29
|
+
const isMarkdown = format === 'markdown';
|
|
30
|
+
// Header
|
|
31
|
+
if (isMarkdown) {
|
|
32
|
+
lines.push('## 📋 Increment Plan');
|
|
33
|
+
lines.push('');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
lines.push('📋 Increment Plan');
|
|
37
|
+
lines.push('═'.repeat(50));
|
|
38
|
+
}
|
|
39
|
+
// Summary
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push(`Total Features: ${plan.totalFeatures}`);
|
|
42
|
+
lines.push(`Total Tasks: ~${plan.totalTasks}`);
|
|
43
|
+
lines.push(`Estimated Duration: ${plan.estimatedDuration}`);
|
|
44
|
+
lines.push(`Increments: ${plan.increments.length}`);
|
|
45
|
+
lines.push('');
|
|
46
|
+
// Increments table/list
|
|
47
|
+
if (isMarkdown) {
|
|
48
|
+
lines.push('### Increments');
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push('| # | Name | Tasks | Features | Dependencies |');
|
|
51
|
+
lines.push('|---|------|-------|----------|--------------|');
|
|
52
|
+
for (let i = 0; i < plan.increments.length; i++) {
|
|
53
|
+
const inc = plan.increments[i];
|
|
54
|
+
const deps = inc.dependencies.length > 0 ? inc.dependencies.map((d) => `#${d.split('-')[0]}`).join(', ') : '-';
|
|
55
|
+
lines.push(`| ${i + 1} | ${inc.name} | ~${inc.estimatedTasks} | ${inc.features.length} | ${deps} |`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
lines.push('Increments:');
|
|
60
|
+
lines.push('-'.repeat(50));
|
|
61
|
+
for (let i = 0; i < plan.increments.length; i++) {
|
|
62
|
+
const inc = plan.increments[i];
|
|
63
|
+
lines.push(` ${i + 1}. ${inc.name}`);
|
|
64
|
+
lines.push(` ID: ${inc.id}`);
|
|
65
|
+
lines.push(` Tasks: ~${inc.estimatedTasks}`);
|
|
66
|
+
lines.push(` Features: ${inc.features.map((f) => f.name).join(', ')}`);
|
|
67
|
+
if (showDependencies && inc.dependencies.length > 0) {
|
|
68
|
+
lines.push(` Depends on: ${inc.dependencies.join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
lines.push('');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Detailed feature breakdown
|
|
74
|
+
if (showDetails) {
|
|
75
|
+
lines.push('');
|
|
76
|
+
if (isMarkdown) {
|
|
77
|
+
lines.push('### Feature Breakdown');
|
|
78
|
+
lines.push('');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
lines.push('Feature Breakdown:');
|
|
82
|
+
lines.push('-'.repeat(50));
|
|
83
|
+
}
|
|
84
|
+
for (const inc of plan.increments) {
|
|
85
|
+
lines.push(`${inc.name}:`);
|
|
86
|
+
for (const feature of inc.features) {
|
|
87
|
+
const complexityIcon = feature.complexity === 'complex' ? '🔴' : feature.complexity === 'medium' ? '🟡' : '🟢';
|
|
88
|
+
lines.push(` ${complexityIcon} ${feature.name} (~${feature.estimatedTasks} tasks)`);
|
|
89
|
+
if (feature.description !== feature.name) {
|
|
90
|
+
lines.push(` "${feature.description}"`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
lines.push('');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Dependency graph visualization
|
|
97
|
+
if (showDependencies && plan.increments.some((inc) => inc.dependencies.length > 0)) {
|
|
98
|
+
lines.push('');
|
|
99
|
+
if (isMarkdown) {
|
|
100
|
+
lines.push('### Execution Order');
|
|
101
|
+
lines.push('```');
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
lines.push('Execution Order:');
|
|
105
|
+
lines.push('-'.repeat(50));
|
|
106
|
+
}
|
|
107
|
+
// Simple ASCII dependency graph
|
|
108
|
+
for (let i = 0; i < plan.increments.length; i++) {
|
|
109
|
+
const inc = plan.increments[i];
|
|
110
|
+
const prefix = i === 0 ? '┌' : i === plan.increments.length - 1 ? '└' : '├';
|
|
111
|
+
const deps = inc.dependencies.length > 0 ? ` ← depends on: ${inc.dependencies.join(', ')}` : '';
|
|
112
|
+
lines.push(`${prefix}─ ${inc.id}${deps}`);
|
|
113
|
+
}
|
|
114
|
+
if (isMarkdown) {
|
|
115
|
+
lines.push('```');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return lines.join('\n');
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Log approved plan to file
|
|
122
|
+
*
|
|
123
|
+
* @param plan - Approved plan
|
|
124
|
+
* @param projectPath - Project root path
|
|
125
|
+
*/
|
|
126
|
+
export function logApprovedPlan(plan, projectPath) {
|
|
127
|
+
const logsDir = path.join(projectPath, '.specweave/logs');
|
|
128
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
129
|
+
const logFile = path.join(logsDir, `plan-approved-${timestamp}.json`);
|
|
130
|
+
// Ensure logs directory exists
|
|
131
|
+
if (!fs.existsSync(logsDir)) {
|
|
132
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
133
|
+
}
|
|
134
|
+
const logEntry = {
|
|
135
|
+
timestamp: new Date().toISOString(),
|
|
136
|
+
event: 'plan_approved',
|
|
137
|
+
plan: {
|
|
138
|
+
totalFeatures: plan.totalFeatures,
|
|
139
|
+
totalTasks: plan.totalTasks,
|
|
140
|
+
estimatedDuration: plan.estimatedDuration,
|
|
141
|
+
increments: plan.increments.map((inc) => ({
|
|
142
|
+
id: inc.id,
|
|
143
|
+
name: inc.name,
|
|
144
|
+
estimatedTasks: inc.estimatedTasks,
|
|
145
|
+
featureCount: inc.features.length,
|
|
146
|
+
dependencies: inc.dependencies,
|
|
147
|
+
})),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
fs.writeFileSync(logFile, JSON.stringify(logEntry, null, 2));
|
|
151
|
+
// Also append to auto-sessions.log
|
|
152
|
+
const sessionsLog = path.join(logsDir, 'auto-sessions.log');
|
|
153
|
+
const logLine = JSON.stringify({
|
|
154
|
+
timestamp: new Date().toISOString(),
|
|
155
|
+
event: 'plan_approved',
|
|
156
|
+
increments: plan.increments.length,
|
|
157
|
+
totalTasks: plan.totalTasks,
|
|
158
|
+
});
|
|
159
|
+
fs.appendFileSync(sessionsLog, logLine + '\n');
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Generate approval prompt text
|
|
163
|
+
*
|
|
164
|
+
* @param plan - Planning result
|
|
165
|
+
* @returns Prompt text for user approval
|
|
166
|
+
*/
|
|
167
|
+
export function generateApprovalPrompt(plan) {
|
|
168
|
+
const lines = [];
|
|
169
|
+
lines.push('');
|
|
170
|
+
lines.push('💡 Review the plan above.');
|
|
171
|
+
lines.push('');
|
|
172
|
+
lines.push('Options:');
|
|
173
|
+
lines.push(' 1. Approve - Start execution with this plan');
|
|
174
|
+
lines.push(' 2. Modify - Adjust increment structure');
|
|
175
|
+
lines.push(' 3. Cancel - Abort and return to prompt');
|
|
176
|
+
lines.push('');
|
|
177
|
+
lines.push('To skip this prompt in future: use --yes flag');
|
|
178
|
+
lines.push('');
|
|
179
|
+
return lines.join('\n');
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Validate plan is executable
|
|
183
|
+
*
|
|
184
|
+
* @param plan - Planning result to validate
|
|
185
|
+
* @returns Validation result with any issues
|
|
186
|
+
*/
|
|
187
|
+
export function validatePlan(plan) {
|
|
188
|
+
const issues = [];
|
|
189
|
+
// Check for empty plan
|
|
190
|
+
if (plan.increments.length === 0) {
|
|
191
|
+
issues.push('Plan has no increments');
|
|
192
|
+
}
|
|
193
|
+
// Check for increments with no features
|
|
194
|
+
for (const inc of plan.increments) {
|
|
195
|
+
if (inc.features.length === 0) {
|
|
196
|
+
issues.push(`Increment ${inc.id} has no features`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// Check for circular dependencies
|
|
200
|
+
const visited = new Set();
|
|
201
|
+
const visiting = new Set();
|
|
202
|
+
function detectCycle(incId) {
|
|
203
|
+
if (visiting.has(incId))
|
|
204
|
+
return true;
|
|
205
|
+
if (visited.has(incId))
|
|
206
|
+
return false;
|
|
207
|
+
visiting.add(incId);
|
|
208
|
+
const inc = plan.increments.find((i) => i.id === incId);
|
|
209
|
+
if (inc) {
|
|
210
|
+
for (const depId of inc.dependencies) {
|
|
211
|
+
if (detectCycle(depId)) {
|
|
212
|
+
issues.push(`Circular dependency detected involving ${incId}`);
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
visiting.delete(incId);
|
|
218
|
+
visited.add(incId);
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
for (const inc of plan.increments) {
|
|
222
|
+
detectCycle(inc.id);
|
|
223
|
+
}
|
|
224
|
+
// Check for missing dependencies
|
|
225
|
+
const allIds = new Set(plan.increments.map((i) => i.id));
|
|
226
|
+
for (const inc of plan.increments) {
|
|
227
|
+
for (const depId of inc.dependencies) {
|
|
228
|
+
if (!allIds.has(depId)) {
|
|
229
|
+
issues.push(`Increment ${inc.id} depends on non-existent increment ${depId}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Warn about very large increments
|
|
234
|
+
for (const inc of plan.increments) {
|
|
235
|
+
if (inc.estimatedTasks > 20) {
|
|
236
|
+
issues.push(`Warning: Increment ${inc.id} has ~${inc.estimatedTasks} tasks (consider splitting)`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
valid: issues.filter((i) => !i.startsWith('Warning:')).length === 0,
|
|
241
|
+
issues,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Save plan to state for later execution
|
|
246
|
+
*
|
|
247
|
+
* @param plan - Planning result to save
|
|
248
|
+
* @param projectPath - Project root path
|
|
249
|
+
*/
|
|
250
|
+
export function savePlanToState(plan, projectPath) {
|
|
251
|
+
const stateDir = path.join(projectPath, '.specweave/state');
|
|
252
|
+
const planFile = path.join(stateDir, 'pending-plan.json');
|
|
253
|
+
// Ensure state directory exists
|
|
254
|
+
if (!fs.existsSync(stateDir)) {
|
|
255
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
256
|
+
}
|
|
257
|
+
const planState = {
|
|
258
|
+
savedAt: new Date().toISOString(),
|
|
259
|
+
plan,
|
|
260
|
+
status: 'pending_approval',
|
|
261
|
+
};
|
|
262
|
+
fs.writeFileSync(planFile, JSON.stringify(planState, null, 2));
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Load saved plan from state
|
|
266
|
+
*
|
|
267
|
+
* @param projectPath - Project root path
|
|
268
|
+
* @returns Saved plan or null if none exists
|
|
269
|
+
*/
|
|
270
|
+
export function loadPlanFromState(projectPath) {
|
|
271
|
+
const planFile = path.join(projectPath, '.specweave/state/pending-plan.json');
|
|
272
|
+
if (!fs.existsSync(planFile)) {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
const content = fs.readFileSync(planFile, 'utf-8');
|
|
277
|
+
const state = JSON.parse(content);
|
|
278
|
+
return {
|
|
279
|
+
plan: state.plan,
|
|
280
|
+
savedAt: state.savedAt,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Clear saved plan from state
|
|
289
|
+
*
|
|
290
|
+
* @param projectPath - Project root path
|
|
291
|
+
*/
|
|
292
|
+
export function clearPlanFromState(projectPath) {
|
|
293
|
+
const planFile = path.join(projectPath, '.specweave/state/pending-plan.json');
|
|
294
|
+
if (fs.existsSync(planFile)) {
|
|
295
|
+
fs.unlinkSync(planFile);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Process user's plan modification request
|
|
300
|
+
*
|
|
301
|
+
* @param plan - Original plan
|
|
302
|
+
* @param modification - User's modification description
|
|
303
|
+
* @returns Modified plan
|
|
304
|
+
*/
|
|
305
|
+
export function applyPlanModification(plan, modification) {
|
|
306
|
+
const increments = [...plan.increments];
|
|
307
|
+
switch (modification.type) {
|
|
308
|
+
case 'merge': {
|
|
309
|
+
// Merge multiple increments into one
|
|
310
|
+
const toMerge = increments.filter((inc) => modification.incrementIds.includes(inc.id));
|
|
311
|
+
if (toMerge.length < 2)
|
|
312
|
+
break;
|
|
313
|
+
const merged = {
|
|
314
|
+
id: toMerge[0].id,
|
|
315
|
+
name: modification.newName || toMerge.map((i) => i.name).join(' & '),
|
|
316
|
+
description: toMerge.map((i) => i.description).join('; '),
|
|
317
|
+
features: toMerge.flatMap((i) => i.features),
|
|
318
|
+
estimatedTasks: toMerge.reduce((sum, i) => sum + i.estimatedTasks, 0),
|
|
319
|
+
dependencies: [...new Set(toMerge.flatMap((i) => i.dependencies))].filter((d) => !modification.incrementIds.includes(d)),
|
|
320
|
+
priority: Math.min(...toMerge.map((i) => i.priority)),
|
|
321
|
+
};
|
|
322
|
+
// Remove merged increments and add new one
|
|
323
|
+
const filtered = increments.filter((inc) => !modification.incrementIds.includes(inc.id));
|
|
324
|
+
filtered.splice(merged.priority - 1, 0, merged);
|
|
325
|
+
return {
|
|
326
|
+
...plan,
|
|
327
|
+
increments: filtered,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
case 'remove': {
|
|
331
|
+
// Remove increments from plan
|
|
332
|
+
const filtered = increments.filter((inc) => !modification.incrementIds.includes(inc.id));
|
|
333
|
+
const totalTasks = filtered.reduce((sum, i) => sum + i.estimatedTasks, 0);
|
|
334
|
+
return {
|
|
335
|
+
...plan,
|
|
336
|
+
increments: filtered,
|
|
337
|
+
totalTasks,
|
|
338
|
+
totalFeatures: filtered.reduce((sum, i) => sum + i.features.length, 0),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
case 'reorder': {
|
|
342
|
+
// Reorder increments (incrementIds is the new order)
|
|
343
|
+
const reordered = modification.incrementIds
|
|
344
|
+
.map((id) => increments.find((inc) => inc.id === id))
|
|
345
|
+
.filter((inc) => inc !== undefined);
|
|
346
|
+
// Add any increments not in the reorder list at the end
|
|
347
|
+
const remaining = increments.filter((inc) => !modification.incrementIds.includes(inc.id));
|
|
348
|
+
return {
|
|
349
|
+
...plan,
|
|
350
|
+
increments: [...reordered, ...remaining].map((inc, idx) => ({
|
|
351
|
+
...inc,
|
|
352
|
+
priority: idx + 1,
|
|
353
|
+
})),
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
default:
|
|
357
|
+
return plan;
|
|
358
|
+
}
|
|
359
|
+
return plan;
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=plan-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-approval.js","sourceRoot":"","sources":["../../../../src/core/auto/plan-approval.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AA4B7B;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAoB,EAAE,UAA8B,EAAE;IACtF,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,gBAAgB,GAAG,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;IAEjF,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;IAEzC,SAAS;IACT,IAAI,UAAU,EAAE,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED,UAAU;IACV,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,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DAAwD;YACxD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAE1F,OAAO;gBACL,GAAG,IAAI;gBACP,UAAU,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC1D,GAAG,GAAG;oBACN,QAAQ,EAAE,GAAG,GAAG,CAAC;iBAClB,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC;QAED;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Trigger Extractor
|
|
3
|
+
*
|
|
4
|
+
* Extracts activation trigger keywords from SKILL.md and AGENT.md files.
|
|
5
|
+
* These triggers enable automatic skill activation based on user prompts.
|
|
6
|
+
*
|
|
7
|
+
* @module core/plugins/skill-trigger-extractor
|
|
8
|
+
* @version 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Extracted trigger data from a skill or agent
|
|
12
|
+
*/
|
|
13
|
+
export interface ExtractedTriggers {
|
|
14
|
+
/** Skill or agent name */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Parent plugin name */
|
|
17
|
+
plugin: string;
|
|
18
|
+
/** Type: skill or agent */
|
|
19
|
+
type: 'skill' | 'agent';
|
|
20
|
+
/** Description from frontmatter */
|
|
21
|
+
description: string;
|
|
22
|
+
/** Extracted trigger keywords (normalized) */
|
|
23
|
+
triggers: string[];
|
|
24
|
+
/** Path to the source file */
|
|
25
|
+
path: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Skill triggers index structure
|
|
29
|
+
*/
|
|
30
|
+
export interface SkillTriggersIndex {
|
|
31
|
+
/** Inverted index: keyword → skill/agent names */
|
|
32
|
+
keywords: Record<string, string[]>;
|
|
33
|
+
/** Skills/agents metadata */
|
|
34
|
+
skills: Record<string, SkillMetadata>;
|
|
35
|
+
/** Generation timestamp */
|
|
36
|
+
generatedAt: string;
|
|
37
|
+
/** Total skill count */
|
|
38
|
+
skillCount: number;
|
|
39
|
+
/** Total keyword count */
|
|
40
|
+
keywordCount: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Metadata for a skill in the index
|
|
44
|
+
*/
|
|
45
|
+
export interface SkillMetadata {
|
|
46
|
+
/** Parent plugin name */
|
|
47
|
+
plugin: string;
|
|
48
|
+
/** Type: skill or agent */
|
|
49
|
+
type: 'skill' | 'agent';
|
|
50
|
+
/** Trigger keywords */
|
|
51
|
+
triggers: string[];
|
|
52
|
+
/** Short description (first 150 chars) */
|
|
53
|
+
description: string;
|
|
54
|
+
/** Full qualified name for invocation */
|
|
55
|
+
fqn: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* SkillTriggerExtractor - Extract activation triggers from plugin skills
|
|
59
|
+
*/
|
|
60
|
+
export declare class SkillTriggerExtractor {
|
|
61
|
+
/**
|
|
62
|
+
* Extract triggers from a single SKILL.md or AGENT.md content
|
|
63
|
+
*
|
|
64
|
+
* @param content - File content
|
|
65
|
+
* @param name - Skill/agent name
|
|
66
|
+
* @param plugin - Parent plugin name
|
|
67
|
+
* @param type - 'skill' or 'agent'
|
|
68
|
+
* @param filePath - Path to the file
|
|
69
|
+
* @returns Extracted triggers
|
|
70
|
+
*/
|
|
71
|
+
extractFromContent(content: string, name: string, plugin: string, type: 'skill' | 'agent', filePath: string): ExtractedTriggers;
|
|
72
|
+
/**
|
|
73
|
+
* Extract description from YAML frontmatter
|
|
74
|
+
*
|
|
75
|
+
* @param content - File content
|
|
76
|
+
* @returns Description string
|
|
77
|
+
*/
|
|
78
|
+
private extractDescription;
|
|
79
|
+
/**
|
|
80
|
+
* Extract trigger keywords from content and description
|
|
81
|
+
*
|
|
82
|
+
* Looks for:
|
|
83
|
+
* 1. "Activates for:" sections in description
|
|
84
|
+
* 2. Keywords in YAML frontmatter
|
|
85
|
+
* 3. Technology names and patterns in the description
|
|
86
|
+
*
|
|
87
|
+
* @param content - Full file content
|
|
88
|
+
* @param description - Extracted description
|
|
89
|
+
* @returns Array of normalized trigger keywords
|
|
90
|
+
*/
|
|
91
|
+
extractTriggerKeywords(content: string, description: string): string[];
|
|
92
|
+
/**
|
|
93
|
+
* Parse a keyword list from comma/or separated string
|
|
94
|
+
*
|
|
95
|
+
* @param text - Keyword list text
|
|
96
|
+
* @returns Array of normalized keywords
|
|
97
|
+
*/
|
|
98
|
+
private parseKeywordList;
|
|
99
|
+
/**
|
|
100
|
+
* Extract technology terms from text
|
|
101
|
+
*
|
|
102
|
+
* @param text - Text to extract from
|
|
103
|
+
* @returns Array of technology terms
|
|
104
|
+
*/
|
|
105
|
+
private extractTechnologyTerms;
|
|
106
|
+
/**
|
|
107
|
+
* Check if a term is a strong technology term (not generic)
|
|
108
|
+
*
|
|
109
|
+
* @param term - Term to check
|
|
110
|
+
* @returns True if strong technology term
|
|
111
|
+
*/
|
|
112
|
+
private isStrongTechnologyTerm;
|
|
113
|
+
/**
|
|
114
|
+
* Check if word is a stop word (common words to ignore)
|
|
115
|
+
*
|
|
116
|
+
* @param word - Word to check
|
|
117
|
+
* @returns True if stop word
|
|
118
|
+
*/
|
|
119
|
+
private isStopWord;
|
|
120
|
+
/**
|
|
121
|
+
* Scan all plugins and extract triggers
|
|
122
|
+
*
|
|
123
|
+
* @param pluginsDir - Path to plugins directory
|
|
124
|
+
* @returns Array of extracted triggers
|
|
125
|
+
*/
|
|
126
|
+
scanAllPlugins(pluginsDir: string): Promise<ExtractedTriggers[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Build the skill triggers index from extracted triggers
|
|
129
|
+
*
|
|
130
|
+
* @param triggers - Array of extracted triggers
|
|
131
|
+
* @returns Skill triggers index
|
|
132
|
+
*/
|
|
133
|
+
buildIndex(triggers: ExtractedTriggers[]): SkillTriggersIndex;
|
|
134
|
+
/**
|
|
135
|
+
* Match a user prompt against the trigger index
|
|
136
|
+
*
|
|
137
|
+
* @param prompt - User prompt
|
|
138
|
+
* @param index - Skill triggers index
|
|
139
|
+
* @returns Array of matched skill FQNs sorted by relevance
|
|
140
|
+
*/
|
|
141
|
+
matchPrompt(prompt: string, index: SkillTriggersIndex): Array<{
|
|
142
|
+
fqn: string;
|
|
143
|
+
score: number;
|
|
144
|
+
matchedKeywords: string[];
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=skill-trigger-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-trigger-extractor.d.ts","sourceRoot":"","sources":["../../../../src/core/plugins/skill-trigger-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,2BAA2B;IAC3B,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IACxB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACtC,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IA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