driftdetect-mcp 0.3.0 → 0.4.2
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/dist/bin/server.d.ts +12 -2
- package/dist/bin/server.d.ts.map +1 -1
- package/dist/bin/server.js +25 -5
- package/dist/bin/server.js.map +1 -1
- package/dist/enterprise-server.d.ts +78 -0
- package/dist/enterprise-server.d.ts.map +1 -0
- package/dist/enterprise-server.js +201 -0
- package/dist/enterprise-server.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/cache.d.ts +86 -0
- package/dist/infrastructure/cache.d.ts.map +1 -0
- package/dist/infrastructure/cache.js +271 -0
- package/dist/infrastructure/cache.js.map +1 -0
- package/dist/infrastructure/cursor-manager.d.ts +86 -0
- package/dist/infrastructure/cursor-manager.d.ts.map +1 -0
- package/dist/infrastructure/cursor-manager.js +175 -0
- package/dist/infrastructure/cursor-manager.js.map +1 -0
- package/dist/infrastructure/error-handler.d.ts +82 -0
- package/dist/infrastructure/error-handler.d.ts.map +1 -0
- package/dist/infrastructure/error-handler.js +226 -0
- package/dist/infrastructure/error-handler.js.map +1 -0
- package/dist/infrastructure/index.d.ts +19 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +26 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/metrics.d.ts +104 -0
- package/dist/infrastructure/metrics.d.ts.map +1 -0
- package/dist/infrastructure/metrics.js +291 -0
- package/dist/infrastructure/metrics.js.map +1 -0
- package/dist/infrastructure/rate-limiter.d.ts +59 -0
- package/dist/infrastructure/rate-limiter.d.ts.map +1 -0
- package/dist/infrastructure/rate-limiter.js +132 -0
- package/dist/infrastructure/rate-limiter.js.map +1 -0
- package/dist/infrastructure/response-builder.d.ts +104 -0
- package/dist/infrastructure/response-builder.d.ts.map +1 -0
- package/dist/infrastructure/response-builder.js +207 -0
- package/dist/infrastructure/response-builder.js.map +1 -0
- package/dist/infrastructure/token-estimator.d.ts +48 -0
- package/dist/infrastructure/token-estimator.d.ts.map +1 -0
- package/dist/infrastructure/token-estimator.js +131 -0
- package/dist/infrastructure/token-estimator.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1136 -18
- package/dist/server.js.map +1 -1
- package/dist/tools/detail/code-examples.d.ts +33 -0
- package/dist/tools/detail/code-examples.d.ts.map +1 -0
- package/dist/tools/detail/code-examples.js +126 -0
- package/dist/tools/detail/code-examples.js.map +1 -0
- package/dist/tools/detail/dna-check.d.ts +32 -0
- package/dist/tools/detail/dna-check.d.ts.map +1 -0
- package/dist/tools/detail/dna-check.js +231 -0
- package/dist/tools/detail/dna-check.js.map +1 -0
- package/dist/tools/detail/dna-profile.d.ts +37 -0
- package/dist/tools/detail/dna-profile.d.ts.map +1 -0
- package/dist/tools/detail/dna-profile.js +101 -0
- package/dist/tools/detail/dna-profile.js.map +1 -0
- package/dist/tools/detail/file-patterns.d.ts +39 -0
- package/dist/tools/detail/file-patterns.d.ts.map +1 -0
- package/dist/tools/detail/file-patterns.js +103 -0
- package/dist/tools/detail/file-patterns.js.map +1 -0
- package/dist/tools/detail/files-list.d.ts +30 -0
- package/dist/tools/detail/files-list.d.ts.map +1 -0
- package/dist/tools/detail/files-list.js +99 -0
- package/dist/tools/detail/files-list.js.map +1 -0
- package/dist/tools/detail/impact-analysis.d.ts +53 -0
- package/dist/tools/detail/impact-analysis.d.ts.map +1 -0
- package/dist/tools/detail/impact-analysis.js +130 -0
- package/dist/tools/detail/impact-analysis.js.map +1 -0
- package/dist/tools/detail/index.d.ts +23 -0
- package/dist/tools/detail/index.d.ts.map +1 -0
- package/dist/tools/detail/index.js +200 -0
- package/dist/tools/detail/index.js.map +1 -0
- package/dist/tools/detail/pattern-get.d.ts +45 -0
- package/dist/tools/detail/pattern-get.d.ts.map +1 -0
- package/dist/tools/detail/pattern-get.js +87 -0
- package/dist/tools/detail/pattern-get.js.map +1 -0
- package/dist/tools/detail/reachability.d.ts +60 -0
- package/dist/tools/detail/reachability.d.ts.map +1 -0
- package/dist/tools/detail/reachability.js +168 -0
- package/dist/tools/detail/reachability.js.map +1 -0
- package/dist/tools/discovery/capabilities.d.ts +28 -0
- package/dist/tools/discovery/capabilities.d.ts.map +1 -0
- package/dist/tools/discovery/capabilities.js +112 -0
- package/dist/tools/discovery/capabilities.js.map +1 -0
- package/dist/tools/discovery/index.d.ts +13 -0
- package/dist/tools/discovery/index.d.ts.map +1 -0
- package/dist/tools/discovery/index.js +30 -0
- package/dist/tools/discovery/index.js.map +1 -0
- package/dist/tools/discovery/projects.d.ts +26 -0
- package/dist/tools/discovery/projects.d.ts.map +1 -0
- package/dist/tools/discovery/projects.js +210 -0
- package/dist/tools/discovery/projects.js.map +1 -0
- package/dist/tools/discovery/status.d.ts +42 -0
- package/dist/tools/discovery/status.d.ts.map +1 -0
- package/dist/tools/discovery/status.js +157 -0
- package/dist/tools/discovery/status.js.map +1 -0
- package/dist/tools/exploration/contracts-list.d.ts +35 -0
- package/dist/tools/exploration/contracts-list.d.ts.map +1 -0
- package/dist/tools/exploration/contracts-list.js +106 -0
- package/dist/tools/exploration/contracts-list.js.map +1 -0
- package/dist/tools/exploration/files-list.d.ts +29 -0
- package/dist/tools/exploration/files-list.d.ts.map +1 -0
- package/dist/tools/exploration/files-list.js +94 -0
- package/dist/tools/exploration/files-list.js.map +1 -0
- package/dist/tools/exploration/index.d.ts +17 -0
- package/dist/tools/exploration/index.d.ts.map +1 -0
- package/dist/tools/exploration/index.js +126 -0
- package/dist/tools/exploration/index.js.map +1 -0
- package/dist/tools/exploration/patterns-list.d.ts +40 -0
- package/dist/tools/exploration/patterns-list.d.ts.map +1 -0
- package/dist/tools/exploration/patterns-list.js +172 -0
- package/dist/tools/exploration/patterns-list.js.map +1 -0
- package/dist/tools/exploration/security-summary.d.ts +49 -0
- package/dist/tools/exploration/security-summary.d.ts.map +1 -0
- package/dist/tools/exploration/security-summary.js +111 -0
- package/dist/tools/exploration/security-summary.js.map +1 -0
- package/dist/tools/exploration/trends.d.ts +49 -0
- package/dist/tools/exploration/trends.d.ts.map +1 -0
- package/dist/tools/exploration/trends.js +147 -0
- package/dist/tools/exploration/trends.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/orchestration/context.d.ts +72 -0
- package/dist/tools/orchestration/context.d.ts.map +1 -0
- package/dist/tools/orchestration/context.js +499 -0
- package/dist/tools/orchestration/context.js.map +1 -0
- package/dist/tools/orchestration/index.d.ts +11 -0
- package/dist/tools/orchestration/index.d.ts.map +1 -0
- package/dist/tools/orchestration/index.js +56 -0
- package/dist/tools/orchestration/index.js.map +1 -0
- package/dist/tools/registry.d.ts +41 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +64 -0
- package/dist/tools/registry.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_trends - Pattern Trend Analysis
|
|
3
|
+
*
|
|
4
|
+
* Exploration tool that shows how patterns have changed over time.
|
|
5
|
+
* Identifies regressions, improvements, and stability.
|
|
6
|
+
*/
|
|
7
|
+
import type { HistoryStore } from 'driftdetect-core';
|
|
8
|
+
export interface TrendItem {
|
|
9
|
+
patternId: string;
|
|
10
|
+
patternName: string;
|
|
11
|
+
category: string;
|
|
12
|
+
type: 'regression' | 'improvement' | 'stable';
|
|
13
|
+
severity?: 'critical' | 'warning';
|
|
14
|
+
metric: string;
|
|
15
|
+
change: {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
delta: number;
|
|
19
|
+
deltaPercent: number;
|
|
20
|
+
};
|
|
21
|
+
details?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TrendsData {
|
|
24
|
+
period: string;
|
|
25
|
+
summary: {
|
|
26
|
+
regressions: number;
|
|
27
|
+
improvements: number;
|
|
28
|
+
stable: number;
|
|
29
|
+
criticalRegressions: number;
|
|
30
|
+
};
|
|
31
|
+
trends: TrendItem[];
|
|
32
|
+
healthTrend: {
|
|
33
|
+
current: number;
|
|
34
|
+
previous: number;
|
|
35
|
+
direction: 'up' | 'down' | 'stable';
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare function handleTrends(store: HistoryStore, args: {
|
|
39
|
+
period?: string;
|
|
40
|
+
category?: string;
|
|
41
|
+
severity?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
content: Array<{
|
|
45
|
+
type: string;
|
|
46
|
+
text: string;
|
|
47
|
+
}>;
|
|
48
|
+
}>;
|
|
49
|
+
//# sourceMappingURL=trends.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trends.d.ts","sourceRoot":"","sources":["../../../src/tools/exploration/trends.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAGnE,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,YAAY,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC9C,QAAQ,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;KACrC,CAAC;CACH;AAgBD,wBAAsB,YAAY,CAChC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA4I7D"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_trends - Pattern Trend Analysis
|
|
3
|
+
*
|
|
4
|
+
* Exploration tool that shows how patterns have changed over time.
|
|
5
|
+
* Identifies regressions, improvements, and stability.
|
|
6
|
+
*/
|
|
7
|
+
import { createResponseBuilder } from '../../infrastructure/index.js';
|
|
8
|
+
const DEFAULT_LIMIT = 20;
|
|
9
|
+
function getPeriodStartDate(period) {
|
|
10
|
+
const now = new Date();
|
|
11
|
+
let daysAgo = 7;
|
|
12
|
+
if (period === '30d')
|
|
13
|
+
daysAgo = 30;
|
|
14
|
+
else if (period === '90d')
|
|
15
|
+
daysAgo = 90;
|
|
16
|
+
const startDate = new Date(now);
|
|
17
|
+
startDate.setDate(startDate.getDate() - daysAgo);
|
|
18
|
+
return startDate.toISOString().split('T')[0];
|
|
19
|
+
}
|
|
20
|
+
export async function handleTrends(store, args) {
|
|
21
|
+
const builder = createResponseBuilder();
|
|
22
|
+
const period = args.period ?? '7d';
|
|
23
|
+
const limit = args.limit ?? DEFAULT_LIMIT;
|
|
24
|
+
await store.initialize();
|
|
25
|
+
// Get snapshots for the period
|
|
26
|
+
const startDate = getPeriodStartDate(period);
|
|
27
|
+
const snapshots = await store.getSnapshots(startDate);
|
|
28
|
+
if (snapshots.length < 2) {
|
|
29
|
+
return builder
|
|
30
|
+
.withSummary(`Not enough history for ${period} trend analysis. Need at least 2 snapshots.`)
|
|
31
|
+
.withData({
|
|
32
|
+
period,
|
|
33
|
+
summary: { regressions: 0, improvements: 0, stable: 0, criticalRegressions: 0 },
|
|
34
|
+
trends: [],
|
|
35
|
+
healthTrend: { current: 0, previous: 0, direction: 'stable' },
|
|
36
|
+
})
|
|
37
|
+
.withHints({
|
|
38
|
+
nextActions: [
|
|
39
|
+
"Run 'drift scan' periodically to build history",
|
|
40
|
+
'Try a longer period like 30d or 90d',
|
|
41
|
+
],
|
|
42
|
+
})
|
|
43
|
+
.buildContent();
|
|
44
|
+
}
|
|
45
|
+
const oldSnapshot = snapshots[0];
|
|
46
|
+
const newSnapshot = snapshots[snapshots.length - 1];
|
|
47
|
+
// Calculate trends using the store's method
|
|
48
|
+
const calculatedTrends = store.calculateTrends(newSnapshot, oldSnapshot);
|
|
49
|
+
// Map to our TrendItem format
|
|
50
|
+
let trends = calculatedTrends.map((t) => {
|
|
51
|
+
const item = {
|
|
52
|
+
patternId: t.patternId,
|
|
53
|
+
patternName: t.patternName,
|
|
54
|
+
category: t.category,
|
|
55
|
+
type: t.type,
|
|
56
|
+
metric: t.metric,
|
|
57
|
+
change: {
|
|
58
|
+
from: t.previousValue,
|
|
59
|
+
to: t.currentValue,
|
|
60
|
+
delta: t.change,
|
|
61
|
+
deltaPercent: Math.round(t.changePercent),
|
|
62
|
+
},
|
|
63
|
+
details: t.details,
|
|
64
|
+
};
|
|
65
|
+
if (t.severity === 'critical') {
|
|
66
|
+
item.severity = 'critical';
|
|
67
|
+
}
|
|
68
|
+
else if (t.severity === 'warning') {
|
|
69
|
+
item.severity = 'warning';
|
|
70
|
+
}
|
|
71
|
+
return item;
|
|
72
|
+
});
|
|
73
|
+
// Filter by category
|
|
74
|
+
if (args.category) {
|
|
75
|
+
trends = trends.filter(t => t.category === args.category);
|
|
76
|
+
}
|
|
77
|
+
// Filter by severity
|
|
78
|
+
if (args.severity && args.severity !== 'all') {
|
|
79
|
+
if (args.severity === 'critical') {
|
|
80
|
+
trends = trends.filter(t => t.severity === 'critical');
|
|
81
|
+
}
|
|
82
|
+
else if (args.severity === 'warning') {
|
|
83
|
+
trends = trends.filter(t => t.severity === 'critical' || t.severity === 'warning');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Sort: regressions first, then by severity
|
|
87
|
+
trends.sort((a, b) => {
|
|
88
|
+
if (a.type === 'regression' && b.type !== 'regression')
|
|
89
|
+
return -1;
|
|
90
|
+
if (b.type === 'regression' && a.type !== 'regression')
|
|
91
|
+
return 1;
|
|
92
|
+
if (a.severity === 'critical' && b.severity !== 'critical')
|
|
93
|
+
return -1;
|
|
94
|
+
if (b.severity === 'critical' && a.severity !== 'critical')
|
|
95
|
+
return 1;
|
|
96
|
+
return Math.abs(b.change.deltaPercent) - Math.abs(a.change.deltaPercent);
|
|
97
|
+
});
|
|
98
|
+
// Calculate summary before limiting
|
|
99
|
+
const summary = {
|
|
100
|
+
regressions: trends.filter(t => t.type === 'regression').length,
|
|
101
|
+
improvements: trends.filter(t => t.type === 'improvement').length,
|
|
102
|
+
stable: newSnapshot.patterns.length - trends.length,
|
|
103
|
+
criticalRegressions: trends.filter(t => t.severity === 'critical').length,
|
|
104
|
+
};
|
|
105
|
+
// Apply limit
|
|
106
|
+
trends = trends.slice(0, limit);
|
|
107
|
+
// Calculate health trend from summaries
|
|
108
|
+
const currentHealth = Math.round((newSnapshot.summary?.avgConfidence ?? 0) * 100);
|
|
109
|
+
const previousHealth = Math.round((oldSnapshot.summary?.avgConfidence ?? 0) * 100);
|
|
110
|
+
const healthTrend = {
|
|
111
|
+
current: currentHealth,
|
|
112
|
+
previous: previousHealth,
|
|
113
|
+
direction: currentHealth > previousHealth + 5
|
|
114
|
+
? 'up'
|
|
115
|
+
: currentHealth < previousHealth - 5
|
|
116
|
+
? 'down'
|
|
117
|
+
: 'stable',
|
|
118
|
+
};
|
|
119
|
+
// Build summary text
|
|
120
|
+
let summaryText = `${period} trends: `;
|
|
121
|
+
if (summary.criticalRegressions > 0) {
|
|
122
|
+
summaryText += `⚠️ ${summary.criticalRegressions} critical regressions. `;
|
|
123
|
+
}
|
|
124
|
+
summaryText += `${summary.regressions} regressions, ${summary.improvements} improvements. `;
|
|
125
|
+
summaryText += `Health: ${currentHealth}/100 (${healthTrend.direction}).`;
|
|
126
|
+
const hints = {
|
|
127
|
+
nextActions: summary.regressions > 0
|
|
128
|
+
? [
|
|
129
|
+
'Use drift_pattern_get to investigate regression details',
|
|
130
|
+
'Use drift_code_examples to see correct implementations',
|
|
131
|
+
]
|
|
132
|
+
: [
|
|
133
|
+
'Continue monitoring with periodic scans',
|
|
134
|
+
'Use drift_patterns_list to explore stable patterns',
|
|
135
|
+
],
|
|
136
|
+
relatedTools: ['drift_pattern_get', 'drift_code_examples', 'drift_patterns_list'],
|
|
137
|
+
};
|
|
138
|
+
if (summary.criticalRegressions > 0) {
|
|
139
|
+
hints.warnings = [`${summary.criticalRegressions} patterns have critical regressions`];
|
|
140
|
+
}
|
|
141
|
+
return builder
|
|
142
|
+
.withSummary(summaryText)
|
|
143
|
+
.withData({ period, summary, trends, healthTrend })
|
|
144
|
+
.withHints(hints)
|
|
145
|
+
.buildContent();
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=trends.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trends.js","sourceRoot":"","sources":["../../../src/tools/exploration/trends.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OA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G,CAAC;gBAClC,CAAC,CAAC,MAAe;gBACjB,CAAC,CAAC,QAAiB;KACxB,CAAC;IAEF,qBAAqB;IACrB,IAAI,WAAW,GAAG,GAAG,MAAM,WAAW,CAAC;IACvC,IAAI,OAAO,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QACpC,WAAW,IAAI,MAAM,OAAO,CAAC,mBAAmB,yBAAyB,CAAC;IAC5E,CAAC;IACD,WAAW,IAAI,GAAG,OAAO,CAAC,WAAW,iBAAiB,OAAO,CAAC,YAAY,iBAAiB,CAAC;IAC5F,WAAW,IAAI,WAAW,aAAa,SAAS,WAAW,CAAC,SAAS,IAAI,CAAC;IAE1E,MAAM,KAAK,GAA2E;QACpF,WAAW,EAAE,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,CAAC,CAAC;gBACE,yDAAyD;gBACzD,wDAAwD;aACzD;YACH,CAAC,CAAC;gBACE,yCAAyC;gBACzC,oDAAoD;aACrD;QACL,YAAY,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,qBAAqB,CAAC;KAClF,CAAC;IAEF,IAAI,OAAO,CAAC,mBAAmB,GAAG,CAAC,EAAE,CAAC;QACpC,KAAK,CAAC,QAAQ,GAAG,CAAC,GAAG,OAAO,CAAC,mBAAmB,qCAAqC,CAAC,CAAC;IACzF,CAAC;IAED,OAAO,OAAO;SACX,WAAW,CAAC,WAAW,CAAC;SACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;SAClD,SAAS,CAAC,KAAK,CAAC;SAChB,YAAY,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enterprise MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools organized into three layers:
|
|
5
|
+
* - Discovery: Lightweight status and capability tools
|
|
6
|
+
* - Exploration: Paginated listing tools
|
|
7
|
+
* - Detail: Focused single-item tools
|
|
8
|
+
*/
|
|
9
|
+
export * from './discovery/index.js';
|
|
10
|
+
export * from './exploration/index.js';
|
|
11
|
+
export * from './detail/index.js';
|
|
12
|
+
export * from './registry.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enterprise MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools organized into three layers:
|
|
5
|
+
* - Discovery: Lightweight status and capability tools
|
|
6
|
+
* - Exploration: Paginated listing tools
|
|
7
|
+
* - Detail: Focused single-item tools
|
|
8
|
+
*/
|
|
9
|
+
export * from './discovery/index.js';
|
|
10
|
+
export * from './exploration/index.js';
|
|
11
|
+
export * from './detail/index.js';
|
|
12
|
+
export * from './registry.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_context - Intent-Aware Context Orchestration
|
|
3
|
+
*
|
|
4
|
+
* The "final boss" tool. Instead of making the AI figure out which tools to call
|
|
5
|
+
* and how to synthesize the results, this tool understands the AI's intent and
|
|
6
|
+
* returns a curated context package with everything needed for the task.
|
|
7
|
+
*
|
|
8
|
+
* This is the recommended starting point for any code generation task.
|
|
9
|
+
*/
|
|
10
|
+
import { PatternStore, ManifestStore, BoundaryStore, CallGraphStore, DNAStore } from 'driftdetect-core';
|
|
11
|
+
export type TaskIntent = 'add_feature' | 'fix_bug' | 'refactor' | 'security_audit' | 'understand_code' | 'add_test';
|
|
12
|
+
export interface RelevantPattern {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
category: string;
|
|
16
|
+
why: string;
|
|
17
|
+
example: string;
|
|
18
|
+
confidence: number;
|
|
19
|
+
locationCount: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SuggestedFile {
|
|
22
|
+
file: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
patterns: string[];
|
|
25
|
+
risk: 'low' | 'medium' | 'high';
|
|
26
|
+
}
|
|
27
|
+
export interface Guidance {
|
|
28
|
+
keyInsights: string[];
|
|
29
|
+
commonMistakes: string[];
|
|
30
|
+
decisionPoints: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface Warning {
|
|
33
|
+
type: 'security' | 'breaking_change' | 'deprecated' | 'complexity' | 'data_access';
|
|
34
|
+
message: string;
|
|
35
|
+
severity: 'info' | 'warning' | 'critical';
|
|
36
|
+
}
|
|
37
|
+
export interface Confidence {
|
|
38
|
+
patternCoverage: number;
|
|
39
|
+
dataFreshness: string;
|
|
40
|
+
limitations: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface DeeperDive {
|
|
43
|
+
tool: string;
|
|
44
|
+
args: Record<string, unknown>;
|
|
45
|
+
reason: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ContextPackage {
|
|
48
|
+
summary: string;
|
|
49
|
+
relevantPatterns: RelevantPattern[];
|
|
50
|
+
suggestedFiles: SuggestedFile[];
|
|
51
|
+
guidance: Guidance;
|
|
52
|
+
warnings: Warning[];
|
|
53
|
+
confidence: Confidence;
|
|
54
|
+
deeperDive: DeeperDive[];
|
|
55
|
+
}
|
|
56
|
+
export declare function handleContext(stores: {
|
|
57
|
+
pattern: PatternStore;
|
|
58
|
+
manifest: ManifestStore;
|
|
59
|
+
boundary: BoundaryStore;
|
|
60
|
+
callGraph: CallGraphStore;
|
|
61
|
+
dna: DNAStore;
|
|
62
|
+
}, projectRoot: string, args: {
|
|
63
|
+
intent: TaskIntent;
|
|
64
|
+
focus: string;
|
|
65
|
+
question?: string;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
content: Array<{
|
|
68
|
+
type: string;
|
|
69
|
+
text: string;
|
|
70
|
+
}>;
|
|
71
|
+
}>;
|
|
72
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/tools/orchestration/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,QAAQ,EAGT,MAAM,kBAAkB,CAAC;AAS1B,MAAM,MAAM,UAAU,GAClB,aAAa,GACb,SAAS,GACT,UAAU,GACV,gBAAgB,GAChB,iBAAiB,GACjB,UAAU,CAAC;AAEf,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MA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