@specforge/mcp 1.5.3 → 2.0.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/dist/lib/format.d.ts +145 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +227 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/response.d.ts +119 -0
- package/dist/lib/response.d.ts.map +1 -0
- package/dist/lib/response.js +123 -0
- package/dist/lib/response.js.map +1 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +15 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/inheritance.d.ts +193 -0
- package/dist/patterns/inheritance.d.ts.map +1 -0
- package/dist/patterns/inheritance.js +265 -0
- package/dist/patterns/inheritance.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +21 -4
- package/dist/server.js.map +1 -1
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1384 -695
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +567 -19
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +244 -1
- package/dist/types/index.js.map +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +163 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/validation/ticket-validation.d.ts +162 -0
- package/dist/validation/ticket-validation.d.ts.map +1 -0
- package/dist/validation/ticket-validation.js +311 -0
- package/dist/validation/ticket-validation.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Inheritance Module
|
|
3
|
+
*
|
|
4
|
+
* Exports pattern resolution functions for the SpecForge MCP.
|
|
5
|
+
*
|
|
6
|
+
* @see MCI-030-05-pattern-inheritance-resolver
|
|
7
|
+
*/
|
|
8
|
+
export {
|
|
9
|
+
// Main functions
|
|
10
|
+
resolvePatterns, resolvePatternsWithCache, getPatternOverrides,
|
|
11
|
+
// Helper functions
|
|
12
|
+
flattenCodeStandards, flattenSharedPatterns,
|
|
13
|
+
// Cache management
|
|
14
|
+
invalidatePatternCache, invalidateAllPatternCaches, getPatternCacheSize, } from './inheritance.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/patterns/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO;AAML,iBAAiB;AACjB,eAAe,EACf,wBAAwB,EACxB,mBAAmB;AACnB,mBAAmB;AACnB,oBAAoB,EACpB,qBAAqB;AACrB,mBAAmB;AACnB,sBAAsB,EACtB,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Inheritance Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves the complete pattern inheritance chain for tickets:
|
|
5
|
+
* Specification → Epic → Ticket
|
|
6
|
+
*
|
|
7
|
+
* Later values override earlier ones. Arrays are concatenated.
|
|
8
|
+
*
|
|
9
|
+
* @see MCI-030-05-pattern-inheritance-resolver
|
|
10
|
+
*/
|
|
11
|
+
import type { SpecificationCodeStandards, ReturnTypes, NamingConventions, EpicSharedPatterns, EpicCommonFiles } from '../types/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Fully resolved patterns for a ticket
|
|
14
|
+
*
|
|
15
|
+
* Combines patterns from specification, epic, and ticket levels
|
|
16
|
+
* with proper override semantics.
|
|
17
|
+
*/
|
|
18
|
+
export interface ResolvedPatterns {
|
|
19
|
+
/** All imports (spec.commonImports + epic.additionalImports) */
|
|
20
|
+
imports: string[];
|
|
21
|
+
/** Merged patterns (spec → epic → ticket, later wins) */
|
|
22
|
+
patterns: Record<string, string>;
|
|
23
|
+
/** Return types from specification */
|
|
24
|
+
returnTypes: ReturnTypes;
|
|
25
|
+
/** Common files from epic */
|
|
26
|
+
commonFiles: EpicCommonFiles;
|
|
27
|
+
/** Naming conventions from specification */
|
|
28
|
+
naming: NamingConventions;
|
|
29
|
+
/** Source information for debugging */
|
|
30
|
+
sources: {
|
|
31
|
+
specificationId: string;
|
|
32
|
+
epicId: string;
|
|
33
|
+
ticketId: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Override information for a single pattern key
|
|
38
|
+
*/
|
|
39
|
+
export interface PatternOverride {
|
|
40
|
+
/** Pattern key */
|
|
41
|
+
key: string;
|
|
42
|
+
/** Value from specification (if defined) */
|
|
43
|
+
specValue?: string;
|
|
44
|
+
/** Value from epic (if defined) */
|
|
45
|
+
epicValue?: string;
|
|
46
|
+
/** Value from ticket (if defined) */
|
|
47
|
+
ticketValue?: string;
|
|
48
|
+
/** Which level the final value came from */
|
|
49
|
+
resolvedFrom: 'specification' | 'epic' | 'ticket';
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Detailed override report for debugging
|
|
53
|
+
*/
|
|
54
|
+
export interface PatternOverrideReport {
|
|
55
|
+
/** Final merged patterns */
|
|
56
|
+
final: Record<string, string>;
|
|
57
|
+
/** Details about each override */
|
|
58
|
+
overrides: PatternOverride[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Input data for pattern resolution
|
|
62
|
+
*/
|
|
63
|
+
export interface PatternResolutionInput {
|
|
64
|
+
/** Ticket ID */
|
|
65
|
+
ticketId: string;
|
|
66
|
+
/** Specification data */
|
|
67
|
+
specification: {
|
|
68
|
+
id: string;
|
|
69
|
+
codeStandards?: SpecificationCodeStandards | null;
|
|
70
|
+
commonImports?: string[] | null;
|
|
71
|
+
returnTypes?: ReturnTypes | null;
|
|
72
|
+
};
|
|
73
|
+
/** Epic data */
|
|
74
|
+
epic: {
|
|
75
|
+
id: string;
|
|
76
|
+
sharedPatterns?: EpicSharedPatterns | null;
|
|
77
|
+
additionalImports?: string[] | null;
|
|
78
|
+
commonFiles?: EpicCommonFiles | null;
|
|
79
|
+
};
|
|
80
|
+
/** Ticket data (optional, for override information) */
|
|
81
|
+
ticket?: {
|
|
82
|
+
id: string;
|
|
83
|
+
technicalDetails?: {
|
|
84
|
+
patterns?: Record<string, string>;
|
|
85
|
+
} | null;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Flatten SpecificationCodeStandards to a flat Record
|
|
90
|
+
*
|
|
91
|
+
* Extracts all pattern-related fields from code standards into a
|
|
92
|
+
* flat key-value structure for easy merging.
|
|
93
|
+
*
|
|
94
|
+
* @param standards - Specification code standards object
|
|
95
|
+
* @returns Flat record of pattern key-value pairs
|
|
96
|
+
*/
|
|
97
|
+
export declare function flattenCodeStandards(standards: SpecificationCodeStandards | null | undefined): Record<string, string>;
|
|
98
|
+
/**
|
|
99
|
+
* Flatten EpicSharedPatterns to a flat Record
|
|
100
|
+
*
|
|
101
|
+
* Extracts all pattern fields from epic shared patterns into a
|
|
102
|
+
* flat key-value structure for merging.
|
|
103
|
+
*
|
|
104
|
+
* @param patterns - Epic shared patterns object
|
|
105
|
+
* @returns Flat record of pattern key-value pairs
|
|
106
|
+
*/
|
|
107
|
+
export declare function flattenSharedPatterns(patterns: EpicSharedPatterns | null | undefined): Record<string, string>;
|
|
108
|
+
/**
|
|
109
|
+
* Resolve inherited patterns for a ticket
|
|
110
|
+
*
|
|
111
|
+
* Merges patterns from the specification → epic → ticket chain.
|
|
112
|
+
* Later values override earlier ones. Arrays are concatenated.
|
|
113
|
+
*
|
|
114
|
+
* @param input - Pattern resolution input with spec, epic, and ticket data
|
|
115
|
+
* @returns Fully resolved patterns
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const resolved = resolvePatterns({
|
|
120
|
+
* ticketId: 'ticket-123',
|
|
121
|
+
* specification: {
|
|
122
|
+
* id: 'spec-1',
|
|
123
|
+
* codeStandards: { errorHandling: 'Result<T>' },
|
|
124
|
+
* commonImports: ['import { z } from "zod"']
|
|
125
|
+
* },
|
|
126
|
+
* epic: {
|
|
127
|
+
* id: 'epic-1',
|
|
128
|
+
* sharedPatterns: { errorHandling: 'AppError' },
|
|
129
|
+
* additionalImports: ['import { api } from "@/lib/api"']
|
|
130
|
+
* }
|
|
131
|
+
* });
|
|
132
|
+
*
|
|
133
|
+
* // resolved.patterns.errorHandling === 'AppError' (epic overrides spec)
|
|
134
|
+
* // resolved.imports contains both spec and epic imports
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function resolvePatterns(input: PatternResolutionInput): ResolvedPatterns;
|
|
138
|
+
/**
|
|
139
|
+
* Get detailed override information for debugging
|
|
140
|
+
*
|
|
141
|
+
* Shows where each pattern value came from in the inheritance chain.
|
|
142
|
+
* Useful for debugging and understanding pattern resolution.
|
|
143
|
+
*
|
|
144
|
+
* @param input - Pattern resolution input
|
|
145
|
+
* @returns Override report with final values and source information
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const report = getPatternOverrides(input);
|
|
150
|
+
*
|
|
151
|
+
* for (const override of report.overrides) {
|
|
152
|
+
* if (override.resolvedFrom === 'epic') {
|
|
153
|
+
* console.log(`${override.key}: Epic overrides spec`);
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare function getPatternOverrides(input: PatternResolutionInput): PatternOverrideReport;
|
|
159
|
+
/**
|
|
160
|
+
* Resolve patterns with caching for performance
|
|
161
|
+
*
|
|
162
|
+
* Uses an in-memory cache to avoid repeated resolution for the same ticket.
|
|
163
|
+
* Cache entries expire after TTL (default 1 minute).
|
|
164
|
+
*
|
|
165
|
+
* @param input - Pattern resolution input
|
|
166
|
+
* @param ttl - Cache TTL in milliseconds (default: 60000)
|
|
167
|
+
* @returns Resolved patterns (may be cached)
|
|
168
|
+
*/
|
|
169
|
+
export declare function resolvePatternsWithCache(input: PatternResolutionInput, ttl?: number): ResolvedPatterns;
|
|
170
|
+
/**
|
|
171
|
+
* Clear cache for a specific ticket
|
|
172
|
+
*
|
|
173
|
+
* Call this after updating a ticket's patterns.
|
|
174
|
+
*
|
|
175
|
+
* @param ticketId - Ticket ID to invalidate
|
|
176
|
+
*/
|
|
177
|
+
export declare function invalidatePatternCache(ticketId: string): void;
|
|
178
|
+
/**
|
|
179
|
+
* Clear all pattern caches
|
|
180
|
+
*
|
|
181
|
+
* Call this after updating specification or epic patterns,
|
|
182
|
+
* as these changes affect multiple tickets.
|
|
183
|
+
*/
|
|
184
|
+
export declare function invalidateAllPatternCaches(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Get current cache size
|
|
187
|
+
*
|
|
188
|
+
* Useful for monitoring and debugging.
|
|
189
|
+
*
|
|
190
|
+
* @returns Number of cached entries
|
|
191
|
+
*/
|
|
192
|
+
export declare function getPatternCacheSize(): number;
|
|
193
|
+
//# sourceMappingURL=inheritance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.d.ts","sourceRoot":"","sources":["../../src/patterns/inheritance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,0BAA0B,EAC1B,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAM3B;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC,sCAAsC;IACtC,WAAW,EAAE,WAAW,CAAC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IAAI,CAAC;KACtC,CAAC;IACF,uDAAuD;IACvD,MAAM,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,gBAAgB,CAAC,EAAE;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACnC,GAAG,IAAI,CAAC;KACV,CAAC;CACH;AAMD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,0BAA0B,GAAG,IAAI,GAAG,SAAS,GACvD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAsBxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,GAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,GAAG,gBAAgB,CAgC/E;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,GAAG,qBAAqB,CA4CxF;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,sBAAsB,EAC7B,GAAG,GAAE,MAA0B,GAC9B,gBAAgB,CAgBlB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern Inheritance Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves the complete pattern inheritance chain for tickets:
|
|
5
|
+
* Specification → Epic → Ticket
|
|
6
|
+
*
|
|
7
|
+
* Later values override earlier ones. Arrays are concatenated.
|
|
8
|
+
*
|
|
9
|
+
* @see MCI-030-05-pattern-inheritance-resolver
|
|
10
|
+
*/
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Pattern Flattening Helpers
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Flatten SpecificationCodeStandards to a flat Record
|
|
16
|
+
*
|
|
17
|
+
* Extracts all pattern-related fields from code standards into a
|
|
18
|
+
* flat key-value structure for easy merging.
|
|
19
|
+
*
|
|
20
|
+
* @param standards - Specification code standards object
|
|
21
|
+
* @returns Flat record of pattern key-value pairs
|
|
22
|
+
*/
|
|
23
|
+
export function flattenCodeStandards(standards) {
|
|
24
|
+
if (!standards)
|
|
25
|
+
return {};
|
|
26
|
+
const result = {};
|
|
27
|
+
// Extract all standard fields
|
|
28
|
+
if (standards.language)
|
|
29
|
+
result.language = standards.language;
|
|
30
|
+
if (standards.asyncPattern)
|
|
31
|
+
result.asyncPattern = standards.asyncPattern;
|
|
32
|
+
if (standards.errorHandling)
|
|
33
|
+
result.errorHandling = standards.errorHandling;
|
|
34
|
+
if (standards.documentation)
|
|
35
|
+
result.documentation = standards.documentation;
|
|
36
|
+
if (standards.testing)
|
|
37
|
+
result.testing = standards.testing;
|
|
38
|
+
if (standards.stateManagement)
|
|
39
|
+
result.stateManagement = standards.stateManagement;
|
|
40
|
+
if (standards.apiPattern)
|
|
41
|
+
result.apiPattern = standards.apiPattern;
|
|
42
|
+
if (standards.logging)
|
|
43
|
+
result.logging = standards.logging;
|
|
44
|
+
if (standards.validation)
|
|
45
|
+
result.validation = standards.validation;
|
|
46
|
+
// Include custom standards
|
|
47
|
+
if (standards.custom) {
|
|
48
|
+
Object.assign(result, standards.custom);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Flatten EpicSharedPatterns to a flat Record
|
|
54
|
+
*
|
|
55
|
+
* Extracts all pattern fields from epic shared patterns into a
|
|
56
|
+
* flat key-value structure for merging.
|
|
57
|
+
*
|
|
58
|
+
* @param patterns - Epic shared patterns object
|
|
59
|
+
* @returns Flat record of pattern key-value pairs
|
|
60
|
+
*/
|
|
61
|
+
export function flattenSharedPatterns(patterns) {
|
|
62
|
+
if (!patterns)
|
|
63
|
+
return {};
|
|
64
|
+
const result = {};
|
|
65
|
+
// Extract all standard fields
|
|
66
|
+
if (patterns.errorHandling)
|
|
67
|
+
result.errorHandling = patterns.errorHandling;
|
|
68
|
+
if (patterns.returnType)
|
|
69
|
+
result.returnType = patterns.returnType;
|
|
70
|
+
if (patterns.actionPrefix)
|
|
71
|
+
result.actionPrefix = patterns.actionPrefix;
|
|
72
|
+
if (patterns.stateSlice)
|
|
73
|
+
result.stateSlice = patterns.stateSlice;
|
|
74
|
+
if (patterns.apiBasePath)
|
|
75
|
+
result.apiBasePath = patterns.apiBasePath;
|
|
76
|
+
if (patterns.componentFolder)
|
|
77
|
+
result.componentFolder = patterns.componentFolder;
|
|
78
|
+
if (patterns.hookPattern)
|
|
79
|
+
result.hookPattern = patterns.hookPattern;
|
|
80
|
+
// Include custom patterns
|
|
81
|
+
if (patterns.custom) {
|
|
82
|
+
Object.assign(result, patterns.custom);
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// Main Resolution Function
|
|
88
|
+
// =============================================================================
|
|
89
|
+
/**
|
|
90
|
+
* Resolve inherited patterns for a ticket
|
|
91
|
+
*
|
|
92
|
+
* Merges patterns from the specification → epic → ticket chain.
|
|
93
|
+
* Later values override earlier ones. Arrays are concatenated.
|
|
94
|
+
*
|
|
95
|
+
* @param input - Pattern resolution input with spec, epic, and ticket data
|
|
96
|
+
* @returns Fully resolved patterns
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const resolved = resolvePatterns({
|
|
101
|
+
* ticketId: 'ticket-123',
|
|
102
|
+
* specification: {
|
|
103
|
+
* id: 'spec-1',
|
|
104
|
+
* codeStandards: { errorHandling: 'Result<T>' },
|
|
105
|
+
* commonImports: ['import { z } from "zod"']
|
|
106
|
+
* },
|
|
107
|
+
* epic: {
|
|
108
|
+
* id: 'epic-1',
|
|
109
|
+
* sharedPatterns: { errorHandling: 'AppError' },
|
|
110
|
+
* additionalImports: ['import { api } from "@/lib/api"']
|
|
111
|
+
* }
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* // resolved.patterns.errorHandling === 'AppError' (epic overrides spec)
|
|
115
|
+
* // resolved.imports contains both spec and epic imports
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export function resolvePatterns(input) {
|
|
119
|
+
const { ticketId, specification, epic, ticket } = input;
|
|
120
|
+
// Concatenate imports (spec + epic, deduplicated)
|
|
121
|
+
const specImports = specification.commonImports ?? [];
|
|
122
|
+
const epicImports = epic.additionalImports ?? [];
|
|
123
|
+
const imports = [...new Set([...specImports, ...epicImports])];
|
|
124
|
+
// Flatten patterns from each level
|
|
125
|
+
const specPatterns = flattenCodeStandards(specification.codeStandards);
|
|
126
|
+
const epicPatterns = flattenSharedPatterns(epic.sharedPatterns);
|
|
127
|
+
const ticketPatterns = ticket?.technicalDetails?.patterns ?? {};
|
|
128
|
+
// Merge patterns (later overrides earlier)
|
|
129
|
+
const patterns = {
|
|
130
|
+
...specPatterns,
|
|
131
|
+
...epicPatterns,
|
|
132
|
+
...ticketPatterns,
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
imports,
|
|
136
|
+
patterns,
|
|
137
|
+
returnTypes: specification.returnTypes ?? {},
|
|
138
|
+
commonFiles: epic.commonFiles ?? {},
|
|
139
|
+
naming: specification.codeStandards?.naming ?? {},
|
|
140
|
+
sources: {
|
|
141
|
+
specificationId: specification.id,
|
|
142
|
+
epicId: epic.id,
|
|
143
|
+
ticketId: ticket?.id ?? ticketId,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// Override Tracking
|
|
149
|
+
// =============================================================================
|
|
150
|
+
/**
|
|
151
|
+
* Get detailed override information for debugging
|
|
152
|
+
*
|
|
153
|
+
* Shows where each pattern value came from in the inheritance chain.
|
|
154
|
+
* Useful for debugging and understanding pattern resolution.
|
|
155
|
+
*
|
|
156
|
+
* @param input - Pattern resolution input
|
|
157
|
+
* @returns Override report with final values and source information
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const report = getPatternOverrides(input);
|
|
162
|
+
*
|
|
163
|
+
* for (const override of report.overrides) {
|
|
164
|
+
* if (override.resolvedFrom === 'epic') {
|
|
165
|
+
* console.log(`${override.key}: Epic overrides spec`);
|
|
166
|
+
* }
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export function getPatternOverrides(input) {
|
|
171
|
+
const { specification, epic, ticket } = input;
|
|
172
|
+
const specPatterns = flattenCodeStandards(specification.codeStandards);
|
|
173
|
+
const epicPatterns = flattenSharedPatterns(epic.sharedPatterns);
|
|
174
|
+
const ticketPatterns = ticket?.technicalDetails?.patterns ?? {};
|
|
175
|
+
// Get all unique keys
|
|
176
|
+
const allKeys = new Set([
|
|
177
|
+
...Object.keys(specPatterns),
|
|
178
|
+
...Object.keys(epicPatterns),
|
|
179
|
+
...Object.keys(ticketPatterns),
|
|
180
|
+
]);
|
|
181
|
+
// Build override information for each key
|
|
182
|
+
const overrides = Array.from(allKeys).map((key) => {
|
|
183
|
+
const specValue = specPatterns[key];
|
|
184
|
+
const epicValue = epicPatterns[key];
|
|
185
|
+
const ticketValue = ticketPatterns[key];
|
|
186
|
+
// Determine which level the value came from
|
|
187
|
+
let resolvedFrom;
|
|
188
|
+
if (ticketValue !== undefined) {
|
|
189
|
+
resolvedFrom = 'ticket';
|
|
190
|
+
}
|
|
191
|
+
else if (epicValue !== undefined) {
|
|
192
|
+
resolvedFrom = 'epic';
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
resolvedFrom = 'specification';
|
|
196
|
+
}
|
|
197
|
+
return { key, specValue, epicValue, ticketValue, resolvedFrom };
|
|
198
|
+
});
|
|
199
|
+
// Sort by key for consistent output
|
|
200
|
+
overrides.sort((a, b) => a.key.localeCompare(b.key));
|
|
201
|
+
// Build final merged patterns
|
|
202
|
+
const final = {
|
|
203
|
+
...specPatterns,
|
|
204
|
+
...epicPatterns,
|
|
205
|
+
...ticketPatterns,
|
|
206
|
+
};
|
|
207
|
+
return { final, overrides };
|
|
208
|
+
}
|
|
209
|
+
/** Pattern resolution cache */
|
|
210
|
+
const patternCache = new Map();
|
|
211
|
+
/** Default cache TTL (1 minute) */
|
|
212
|
+
const DEFAULT_CACHE_TTL = 60000;
|
|
213
|
+
/**
|
|
214
|
+
* Resolve patterns with caching for performance
|
|
215
|
+
*
|
|
216
|
+
* Uses an in-memory cache to avoid repeated resolution for the same ticket.
|
|
217
|
+
* Cache entries expire after TTL (default 1 minute).
|
|
218
|
+
*
|
|
219
|
+
* @param input - Pattern resolution input
|
|
220
|
+
* @param ttl - Cache TTL in milliseconds (default: 60000)
|
|
221
|
+
* @returns Resolved patterns (may be cached)
|
|
222
|
+
*/
|
|
223
|
+
export function resolvePatternsWithCache(input, ttl = DEFAULT_CACHE_TTL) {
|
|
224
|
+
const cacheKey = input.ticketId;
|
|
225
|
+
const cached = patternCache.get(cacheKey);
|
|
226
|
+
if (cached && cached.expiry > Date.now()) {
|
|
227
|
+
return cached.patterns;
|
|
228
|
+
}
|
|
229
|
+
const patterns = resolvePatterns(input);
|
|
230
|
+
patternCache.set(cacheKey, {
|
|
231
|
+
patterns,
|
|
232
|
+
expiry: Date.now() + ttl,
|
|
233
|
+
});
|
|
234
|
+
return patterns;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Clear cache for a specific ticket
|
|
238
|
+
*
|
|
239
|
+
* Call this after updating a ticket's patterns.
|
|
240
|
+
*
|
|
241
|
+
* @param ticketId - Ticket ID to invalidate
|
|
242
|
+
*/
|
|
243
|
+
export function invalidatePatternCache(ticketId) {
|
|
244
|
+
patternCache.delete(ticketId);
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Clear all pattern caches
|
|
248
|
+
*
|
|
249
|
+
* Call this after updating specification or epic patterns,
|
|
250
|
+
* as these changes affect multiple tickets.
|
|
251
|
+
*/
|
|
252
|
+
export function invalidateAllPatternCaches() {
|
|
253
|
+
patternCache.clear();
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Get current cache size
|
|
257
|
+
*
|
|
258
|
+
* Useful for monitoring and debugging.
|
|
259
|
+
*
|
|
260
|
+
* @returns Number of cached entries
|
|
261
|
+
*/
|
|
262
|
+
export function getPatternCacheSize() {
|
|
263
|
+
return patternCache.size;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=inheritance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inheritance.js","sourceRoot":"","sources":["../../src/patterns/inheritance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmGH,gFAAgF;AAChF,6BAA6B;AAC7B,gFAAgF;AAEhF;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,SAAwD;IAExD,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAE1B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,8BAA8B;IAC9B,IAAI,SAAS,CAAC,QAAQ;QAAE,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;IAC7D,IAAI,SAAS,CAAC,YAAY;QAAE,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC;IACzE,IAAI,SAAS,CAAC,aAAa;QAAE,MAAM,CAAC,aAAa,GAAG,SAAS,CAAC,aAAa,CAAC;IAC5E,IAAI,SAAS,CAAC,aAAa;QAAE,MAAM,CAAC,aAAa,GAAG,SAAS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AC,GAAG,EAAE,GAAG,GAAG;KACzB,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B;IACxC,YAAY,CAAC,KAAK,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,YAAY,CAAC,IAAI,CAAC;AAC3B,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAOnE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAOnE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAS9C;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAoFrE;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B/D"}
|
package/dist/server.js
CHANGED
|
@@ -9,6 +9,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
9
9
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
10
10
|
import { ApiClient } from './client/api-client.js';
|
|
11
11
|
import { getTools, handleToolCall } from './tools/index.js';
|
|
12
|
+
import { formatResponse, getFormatFromArgs } from './lib/format.js';
|
|
12
13
|
/**
|
|
13
14
|
* Package version - should match package.json
|
|
14
15
|
*/
|
|
@@ -43,16 +44,31 @@ export async function createServer(config) {
|
|
|
43
44
|
// Handle CallTool requests - execute the requested tool
|
|
44
45
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
45
46
|
const { name, arguments: args } = request.params;
|
|
47
|
+
const argsRecord = (args || {});
|
|
48
|
+
// Extract format from args before processing
|
|
49
|
+
const format = getFormatFromArgs(argsRecord);
|
|
46
50
|
if (config.debug) {
|
|
47
51
|
console.error('[DEBUG] CallTool request:', {
|
|
48
52
|
name,
|
|
49
53
|
args: JSON.stringify(args),
|
|
54
|
+
format,
|
|
50
55
|
});
|
|
51
56
|
}
|
|
52
57
|
try {
|
|
53
|
-
const result = await handleToolCall(apiClient, name,
|
|
54
|
-
// Format
|
|
55
|
-
|
|
58
|
+
const result = await handleToolCall(apiClient, name, argsRecord, config.debug);
|
|
59
|
+
// Format response based on requested format
|
|
60
|
+
// Fast path: JSON format (most common) - avoid transformation
|
|
61
|
+
if (format === 'json') {
|
|
62
|
+
const text = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
|
|
63
|
+
return {
|
|
64
|
+
content: [{ type: 'text', text }],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// Slow path: TOON format (opt-in) - apply transformation
|
|
68
|
+
const formatted = formatResponse(result, format);
|
|
69
|
+
const text = typeof formatted === 'string'
|
|
70
|
+
? formatted
|
|
71
|
+
: JSON.stringify(formatted, null, 2);
|
|
56
72
|
return {
|
|
57
73
|
content: [{ type: 'text', text }],
|
|
58
74
|
};
|
|
@@ -62,8 +78,9 @@ export async function createServer(config) {
|
|
|
62
78
|
if (config.debug) {
|
|
63
79
|
console.error(`[DEBUG] Tool ${name} failed:`, message);
|
|
64
80
|
}
|
|
81
|
+
// Error responses always in JSON for consistency
|
|
65
82
|
return {
|
|
66
|
-
content: [{ type: 'text', text:
|
|
83
|
+
content: [{ type: 'text', text: JSON.stringify({ error: message }) }],
|
|
67
84
|
isError: true,
|
|
68
85
|
};
|
|
69
86
|
}
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;GAEG;AACH,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAiB;IAClD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;QACE,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,OAAO;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oBAAoB,EAAE,CAAC;IAE7C,2BAA2B;IAC3B,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,OAAO,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACpD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEhC,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;QACxC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAM,EAAE,EAAE;QAC1C,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,uBAAuB;IACvB,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -28,14 +28,6 @@ export interface Tool {
|
|
|
28
28
|
required?: string[];
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Get list of all available tools
|
|
33
|
-
*
|
|
34
|
-
* This returns the tool definitions that will be sent to the AI client
|
|
35
|
-
* in response to ListTools requests.
|
|
36
|
-
*
|
|
37
|
-
* @returns Array of tool definitions
|
|
38
|
-
*/
|
|
39
31
|
export declare function getTools(): Tool[];
|
|
40
32
|
/**
|
|
41
33
|
* Tool handler type - processes arguments and returns a result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAML,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAML,gBAAgB,EAKjB,MAAM,wBAAwB,CAAC;AAmBhC;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AA6ED,wBAAgB,QAAQ,IAAI,IAAI,EAAE,CAwrEjC;AAED;;GAEG;AACH,KAAK,WAAW,GAAG,CACjB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;AA6EtB;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,GACnB,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAu+B7B;AAqCD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,GAAE,OAAe,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