@breadstone/archipel-mcp 0.0.20 → 0.0.22
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/data/guides/ai-text-generation.md +10 -0
- package/data/guides/analytics-and-error-tracking.md +6 -0
- package/data/guides/cryptography-and-otp.md +20 -2
- package/data/guides/database-setup.md +4 -3
- package/data/guides/document-generation.md +26 -0
- package/data/guides/email-delivery.md +23 -0
- package/data/guides/email-templates.md +298 -0
- package/data/guides/esigning-integration.md +1 -1
- package/data/guides/getting-started.md +6 -6
- package/data/guides/index.md +1 -0
- package/data/guides/mcp-server.md +9 -0
- package/data/guides/payments-and-feature-gating.md +18 -0
- package/data/guides/resource-management.md +9 -9
- package/data/guides/telemetry-and-observability.md +7 -1
- package/data/packages/platform-analytics/api/Class.AppInsightsAnalyticsClient.md +55 -6
- package/data/packages/platform-analytics/api/Class.DatadogAnalyticsClient.md +32 -6
- package/data/packages/platform-analytics/api/Class.SentryAnalyticsClient.md +55 -6
- package/data/packages/platform-analytics/index.md +13 -0
- package/data/packages/platform-blob-storage/api/Variable.AWS_S3_PROVIDER_OPTIONS.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.AZURE_BLOB_PROVIDER_OPTIONS.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.BLOB_PROVIDER.md +1 -1
- package/data/packages/platform-blob-storage/api/Variable.VERCEL_BLOB_PROVIDER_OPTIONS.md +1 -1
- package/data/packages/platform-core/api/Class.ErrorTemplateService.md +1 -1
- package/data/packages/platform-core/api/Class.EventHub.md +7 -7
- package/data/packages/platform-core/api/Class.HostService.md +1 -1
- package/data/packages/platform-core/api/Class.SseHub.md +29 -6
- package/data/packages/platform-core/api/Variable.ID_GENERATOR_TOKEN.md +1 -1
- package/data/packages/platform-core/api/index.md +0 -27
- package/data/packages/platform-core/index.md +8 -4
- package/data/packages/platform-cryptography/api/Class.BcryptService.md +4 -4
- package/data/packages/platform-cryptography/api/Class.CryptoService.md +3 -3
- package/data/packages/platform-cryptography/api/Class.OtpService.md +6 -6
- package/data/packages/platform-cryptography/api/Variable.BCRYPT_OPTIONS.md +2 -2
- package/data/packages/platform-cryptography/api/Variable.MAX_BCRYPT_PASSWORD_BYTES.md +1 -1
- package/data/packages/platform-cryptography/api/Variable.MIN_BCRYPT_ROUNDS.md +1 -1
- package/data/packages/platform-cryptography/api/Variable.OTP_OPTIONS.md +2 -2
- package/data/packages/platform-cryptography/api/Variable.OTP_SERVICE_TOKEN.md +2 -2
- package/data/packages/platform-cryptography/api/Variable.TOTP_EPOCH_TOLERANCE.md +1 -1
- package/data/packages/platform-cryptography/api/index.md +3 -3
- package/data/packages/platform-cryptography/index.md +10 -0
- package/data/packages/platform-documents/api/Class.BaseDocumentRenderer.md +32 -1
- package/data/packages/platform-documents/api/Class.DocumentEngine.md +4 -4
- package/data/packages/platform-documents/api/Class.DocumentError.md +61 -0
- package/data/packages/platform-documents/api/Class.DocumentModule.md +2 -2
- package/data/packages/platform-documents/api/Class.DocumentRenderError.md +53 -0
- package/data/packages/platform-documents/api/Class.DocumentValidationError.md +52 -0
- package/data/packages/platform-documents/api/Class.DocxDocumentRenderer2.md +333 -0
- package/data/packages/platform-documents/api/Class.ImageProcessingError.md +53 -0
- package/data/packages/platform-documents/api/Class.PdfDocumentRenderer.md +355 -0
- package/data/packages/platform-documents/api/Class.SharpImageProcessor.md +5 -5
- package/data/packages/platform-documents/api/Interface.IDocumentModuleOptions.md +31 -5
- package/data/packages/platform-documents/api/Variable.DOCUMENT_MODULE_OPTIONS.md +1 -1
- package/data/packages/platform-documents/api/Variable.DOCUMENT_PARSER_TOKEN.md +1 -1
- package/data/packages/platform-documents/api/Variable.DOCUMENT_RENDERER_TOKEN.md +1 -1
- package/data/packages/platform-documents/api/Variable.IMAGE_PROCESSOR_TOKEN.md +1 -1
- package/data/packages/platform-documents/api/index.md +6 -0
- package/data/packages/platform-documents/index.md +27 -0
- package/data/packages/platform-esigning/api/Class.EsigningClientPort.md +2 -2
- package/data/packages/platform-esigning/api/Class.InternalEsigningProvider.md +8 -8
- package/data/packages/platform-esigning/index.md +2 -0
- package/data/packages/platform-health/index.md +128 -0
- package/data/packages/platform-intelligence/api/Class.IntelligenceCapabilityRegistry.md +3 -3
- package/data/packages/platform-intelligence/api/Class.IntelligenceConfigurationError.md +50 -0
- package/data/packages/platform-intelligence/api/Class.IntelligenceTextGenerator.md +27 -4
- package/data/packages/platform-intelligence/api/Class.IntelligenceValidationError.md +50 -0
- package/data/packages/platform-intelligence/api/Function.loadProviderFactory.md +1 -1
- package/data/packages/platform-intelligence/api/index.md +2 -0
- package/data/packages/platform-intelligence/index.md +32 -0
- package/data/packages/platform-logging/api/Class.LoggerModule.md +1 -1
- package/data/packages/platform-logging/index.md +2 -0
- package/data/packages/platform-mailing/api/Class.DeliveryStrategyBase.md +0 -1
- package/data/packages/platform-mailing/api/Class.MailDeliveryError.md +65 -0
- package/data/packages/platform-mailing/api/Class.MailModule.md +1 -1
- package/data/packages/platform-mailing/api/Class.MailgunDeliveryStrategy.md +3 -3
- package/data/packages/platform-mailing/api/Class.PostmarkDeliveryStrategy.md +3 -3
- package/data/packages/platform-mailing/api/Class.ResendDeliveryStrategy.md +3 -3
- package/data/packages/platform-mailing/api/Class.SendGridDeliveryStrategy.md +3 -3
- package/data/packages/platform-mailing/api/Class.SmtpDeliveryStrategy.md +3 -3
- package/data/packages/platform-mailing/api/Class.TemplateFetchStrategyBase.md +0 -5
- package/data/packages/platform-mailing/api/Variable.SMTP_CONFIG_ENTRIES.md +14 -0
- package/data/packages/platform-mailing/api/Variable.SMTP_HOST.md +14 -0
- package/data/packages/platform-mailing/api/Variable.SMTP_PASSWORD.md +14 -0
- package/data/packages/platform-mailing/api/Variable.SMTP_PORT.md +14 -0
- package/data/packages/platform-mailing/api/Variable.SMTP_SECURE.md +14 -0
- package/data/packages/platform-mailing/api/Variable.SMTP_USER.md +14 -0
- package/data/packages/platform-mailing/api/index.md +7 -3
- package/data/packages/platform-mailing/index.md +29 -0
- package/data/packages/platform-mapping/index.md +121 -0
- package/data/packages/platform-mcp/api/Class.McpServerService.md +8 -8
- package/data/packages/platform-mcp/api/Variable.MCP_MODULE_OPTIONS.md +1 -1
- package/data/packages/platform-mcp/index.md +11 -0
- package/data/packages/platform-openapi/api/Class.SwaggerMultiDocumentService.md +4 -4
- package/data/packages/platform-openapi/api/Class.SwaggerTheme.md +2 -2
- package/data/packages/platform-openapi/index.md +1 -1
- package/data/packages/platform-payments/api/Class.LemonSqueezyClient.md +6 -6
- package/data/packages/platform-payments/api/Class.MollieClient.md +6 -6
- package/data/packages/platform-payments/api/Class.PaddleClient.md +6 -6
- package/data/packages/platform-payments/api/Class.PaymentError.md +65 -0
- package/data/packages/platform-payments/api/Class.StripeClient.md +6 -6
- package/data/packages/platform-payments/api/index.md +1 -0
- package/data/packages/platform-payments/index.md +29 -0
- package/data/packages/platform-reporting/api/Class.ReportingContributorRegistry.md +1 -1
- package/data/packages/platform-reporting/index.md +3 -1
- package/data/packages/platform-resources/index.md +135 -0
- package/data/packages/platform-telemetry/api/Class.MetricsService.md +29 -3
- package/data/packages/platform-telemetry/api/Class.OtelSdkHolder.md +3 -2
- package/data/packages/platform-telemetry/api/Class.TelemetryLoggerService.md +6 -6
- package/data/packages/platform-telemetry/api/Class.TelemetryRuleEngine.md +3 -3
- package/data/packages/platform-telemetry/api/Variable.TELEMETRY_ENABLED.md +1 -1
- package/data/packages/platform-telemetry/api/Variable.TELEMETRY_FACADE.md +1 -1
- package/data/packages/platform-telemetry/api/Variable.TELEMETRY_OPTIONS.md +1 -1
- package/data/packages/platform-telemetry/api/index.md +1 -1
- package/data/packages/platform-telemetry/index.md +3 -1
- package/{src/knowledge/configPattern.js → data/patterns/config-pattern.md} +44 -47
- package/{src/knowledge/dtoPattern.js → data/patterns/dto-pattern.md} +58 -61
- package/{src/knowledge/errorHandlingPattern.js → data/patterns/error-handling-pattern.md} +35 -38
- package/{src/knowledge/guardPattern.js → data/patterns/guard-pattern.md} +35 -38
- package/{src/knowledge/mappingPattern.js → data/patterns/mapping-pattern.md} +43 -144
- package/data/patterns/module-pattern.md +182 -0
- package/data/patterns/query-pattern.md +137 -0
- package/data/patterns/repository-pattern.md +208 -0
- package/{src/knowledge/testingPattern.js → data/patterns/testing-pattern.md} +37 -40
- package/package.json +1 -1
- package/src/PatternsLoader.d.ts +12 -0
- package/src/PatternsLoader.js +65 -0
- package/src/generators/mappingPatternGenerator.d.ts +5 -0
- package/src/generators/mappingPatternGenerator.js +107 -0
- package/src/generators/modulePatternGenerator.d.ts +5 -0
- package/src/generators/modulePatternGenerator.js +107 -0
- package/src/generators/queryPatternGenerator.d.ts +4 -0
- package/src/generators/queryPatternGenerator.js +83 -0
- package/src/generators/repositoryPatternGenerator.d.ts +5 -0
- package/src/generators/repositoryPatternGenerator.js +165 -0
- package/src/main.js +15 -9
- package/src/models/IPatternDoc.d.ts +15 -0
- package/src/models/IPatternDoc.js +3 -0
- package/src/tools/registerGetConfigPatternTool.d.ts +2 -1
- package/src/tools/registerGetConfigPatternTool.js +4 -3
- package/src/tools/registerGetDtoPatternTool.d.ts +2 -1
- package/src/tools/registerGetDtoPatternTool.js +4 -3
- package/src/tools/registerGetErrorHandlingPatternTool.d.ts +2 -1
- package/src/tools/registerGetErrorHandlingPatternTool.js +4 -3
- package/src/tools/registerGetGuardPatternTool.d.ts +2 -1
- package/src/tools/registerGetGuardPatternTool.js +4 -3
- package/src/tools/registerGetMappingPatternTool.d.ts +2 -1
- package/src/tools/registerGetMappingPatternTool.js +5 -4
- package/src/tools/registerGetModulePatternTool.d.ts +2 -1
- package/src/tools/registerGetModulePatternTool.js +5 -4
- package/src/tools/registerGetQueryPatternTool.d.ts +2 -1
- package/src/tools/registerGetQueryPatternTool.js +5 -4
- package/src/tools/registerGetRepositoryPatternTool.d.ts +2 -1
- package/src/tools/registerGetRepositoryPatternTool.js +5 -4
- package/src/tools/registerGetTestingPatternTool.d.ts +2 -1
- package/src/tools/registerGetTestingPatternTool.js +4 -3
- package/data/packages/platform-core/api/Class.BlobResourceStrategy.md +0 -195
- package/data/packages/platform-core/api/Class.EmbeddedResourceStrategy.md +0 -215
- package/data/packages/platform-core/api/Class.FileResourceStrategy.md +0 -192
- package/data/packages/platform-core/api/Class.HealthModule.md +0 -42
- package/data/packages/platform-core/api/Class.HealthOrchestrator.md +0 -64
- package/data/packages/platform-core/api/Class.MappingBuilder.md +0 -110
- package/data/packages/platform-core/api/Class.MappingModule.md +0 -46
- package/data/packages/platform-core/api/Class.MappingNotRegisteredError.md +0 -56
- package/data/packages/platform-core/api/Class.MappingProfileBase.md +0 -52
- package/data/packages/platform-core/api/Class.MappingService.md +0 -284
- package/data/packages/platform-core/api/Class.ResourceManager.md +0 -565
- package/data/packages/platform-core/api/Class.ResourceModule.md +0 -46
- package/data/packages/platform-core/api/Class.TypeMappingNotRegisteredError.md +0 -57
- package/data/packages/platform-core/api/Function.createMappingKey.md +0 -39
- package/data/packages/platform-core/api/Interface.IBlobResourceStrategyConfig.md +0 -28
- package/data/packages/platform-core/api/Interface.IBlobServiceAdapter.md +0 -40
- package/data/packages/platform-core/api/Interface.IFileResourceStrategyConfig.md +0 -72
- package/data/packages/platform-core/api/Interface.IHealthCheckResult.md +0 -46
- package/data/packages/platform-core/api/Interface.IHealthIndicator.md +0 -41
- package/data/packages/platform-core/api/Interface.IMappingBuilder.md +0 -76
- package/data/packages/platform-core/api/Interface.IMappingKey.md +0 -58
- package/data/packages/platform-core/api/Interface.IMappingProfile.md +0 -32
- package/data/packages/platform-core/api/Interface.IResourceManagerConfig.md +0 -89
- package/data/packages/platform-core/api/Interface.IResourceMetadata.md +0 -94
- package/data/packages/platform-core/api/Interface.IResourceResult.md +0 -34
- package/data/packages/platform-core/api/Interface.IResourceStrategy.md +0 -134
- package/data/packages/platform-core/api/Variable.HEALTH_INDICATORS_TOKEN.md +0 -14
- package/data/packages/platform-mailing/api/Class.BlobTemplateFetchStrategy.md +0 -60
- package/data/packages/platform-mailing/api/Class.FileTemplateFetchStrategy.md +0 -58
- package/data/packages/platform-mailing/api/Class.LogDeliveryStrategy.md +0 -71
- package/src/knowledge/configPattern.d.ts +0 -5
- package/src/knowledge/dtoPattern.d.ts +0 -5
- package/src/knowledge/errorHandlingPattern.d.ts +0 -5
- package/src/knowledge/guardPattern.d.ts +0 -5
- package/src/knowledge/mappingPattern.d.ts +0 -6
- package/src/knowledge/modulePattern.d.ts +0 -6
- package/src/knowledge/modulePattern.js +0 -283
- package/src/knowledge/queryPattern.d.ts +0 -6
- package/src/knowledge/queryPattern.js +0 -215
- package/src/knowledge/repositoryPattern.d.ts +0 -6
- package/src/knowledge/repositoryPattern.js +0 -367
- package/src/knowledge/testingPattern.d.ts +0 -5
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAPPING_PATTERN_WITH_CONTEXT = MAPPING_PATTERN_WITH_CONTEXT;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a full mapping example (input interface, key, profile, module registration,
|
|
6
|
+
* controller usage) for a given entity and its target response class.
|
|
7
|
+
*/
|
|
8
|
+
function MAPPING_PATTERN_WITH_CONTEXT(entityName, fields, responseName) {
|
|
9
|
+
return `
|
|
10
|
+
## Example: Mapping for "${entityName}" → "${responseName}"
|
|
11
|
+
|
|
12
|
+
Given an entity \`${entityName}\` with fields: ${fields.map((f) => `\`${f}\``).join(', ')}
|
|
13
|
+
|
|
14
|
+
### 1. Input Interface
|
|
15
|
+
|
|
16
|
+
\`\`\`typescript
|
|
17
|
+
// models/mapping-inputs/I${entityName}MappingInput.ts
|
|
18
|
+
|
|
19
|
+
export interface I${entityName}MappingInput {
|
|
20
|
+
${fields.map((f) => ` readonly ${f}: ${inferMappingFieldType(f)};`).join('\n')}
|
|
21
|
+
}
|
|
22
|
+
\`\`\`
|
|
23
|
+
|
|
24
|
+
### 2. Mapping Key
|
|
25
|
+
|
|
26
|
+
\`\`\`typescript
|
|
27
|
+
// constants/MappingKeys.ts
|
|
28
|
+
import { createMappingKey } from '@breadstone/archipel-platform-mapping';
|
|
29
|
+
import { I${entityName}MappingInput } from '../models/mapping-inputs/I${entityName}MappingInput';
|
|
30
|
+
import { ${responseName} } from '../dtos/${responseName}';
|
|
31
|
+
|
|
32
|
+
export const ${toConstantCase(entityName)}_MAPPING_KEY = createMappingKey<I${entityName}MappingInput, ${responseName}>('${toDotNotation(entityName)}');
|
|
33
|
+
\`\`\`
|
|
34
|
+
|
|
35
|
+
### 3. Mapping Profile
|
|
36
|
+
|
|
37
|
+
\`\`\`typescript
|
|
38
|
+
// mappers/${entityName}MappingProfile.ts
|
|
39
|
+
import { MappingProfileBase, IMappingBuilder } from '@breadstone/archipel-platform-mapping';
|
|
40
|
+
import { ${toConstantCase(entityName)}_MAPPING_KEY } from '../constants/MappingKeys';
|
|
41
|
+
import { I${entityName}MappingInput } from '../models/mapping-inputs/I${entityName}MappingInput';
|
|
42
|
+
import { ${responseName} } from '../dtos/${responseName}';
|
|
43
|
+
|
|
44
|
+
export class ${entityName}MappingProfile extends MappingProfileBase {
|
|
45
|
+
|
|
46
|
+
// #region Methods
|
|
47
|
+
|
|
48
|
+
public configure(builder: IMappingBuilder): void {
|
|
49
|
+
builder.createKeyedMap(${toConstantCase(entityName)}_MAPPING_KEY, (input: I${entityName}MappingInput) => {
|
|
50
|
+
const response = new ${responseName}();
|
|
51
|
+
${fields.map((f) => ` response.${f} = input.${f};`).join('\n')}
|
|
52
|
+
|
|
53
|
+
return response;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// #endregion
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
\`\`\`
|
|
61
|
+
|
|
62
|
+
### 4. Module Registration
|
|
63
|
+
|
|
64
|
+
\`\`\`typescript
|
|
65
|
+
import { MappingModule } from '@breadstone/archipel-platform-mapping';
|
|
66
|
+
import { ${entityName}MappingProfile } from './mappers/${entityName}MappingProfile';
|
|
67
|
+
|
|
68
|
+
@Module({
|
|
69
|
+
imports: [
|
|
70
|
+
MappingModule.withProfiles([${entityName}MappingProfile]),
|
|
71
|
+
],
|
|
72
|
+
})
|
|
73
|
+
export class ${entityName}Module {}
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
### 5. Controller Usage
|
|
77
|
+
|
|
78
|
+
\`\`\`typescript
|
|
79
|
+
// In a controller method:
|
|
80
|
+
const entity = await this._${lowerFirst(entityName)}Service.findById(id);
|
|
81
|
+
const response = this._mappingService.map(${toConstantCase(entityName)}_MAPPING_KEY, entity);
|
|
82
|
+
\`\`\`
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
function inferMappingFieldType(fieldName) {
|
|
86
|
+
if (fieldName === 'id')
|
|
87
|
+
return 'string';
|
|
88
|
+
if (fieldName.endsWith('Id'))
|
|
89
|
+
return 'string';
|
|
90
|
+
if (fieldName.endsWith('At') || fieldName === 'createdAt' || fieldName === 'updatedAt')
|
|
91
|
+
return 'Date';
|
|
92
|
+
if (fieldName.startsWith('is') || fieldName.startsWith('has'))
|
|
93
|
+
return 'boolean';
|
|
94
|
+
if (fieldName === 'count' || fieldName === 'quantity' || fieldName === 'amount' || fieldName === 'price')
|
|
95
|
+
return 'number';
|
|
96
|
+
return 'string';
|
|
97
|
+
}
|
|
98
|
+
function toConstantCase(name) {
|
|
99
|
+
return name.replace(/([a-z])([A-Z])/g, '$1_$2').toUpperCase();
|
|
100
|
+
}
|
|
101
|
+
function toDotNotation(name) {
|
|
102
|
+
return name.replace(/([a-z])([A-Z])/g, '$1.$2').toLowerCase();
|
|
103
|
+
}
|
|
104
|
+
function lowerFirst(str) {
|
|
105
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=mappingPatternGenerator.js.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODULE_PATTERN_WITH_CONTEXT = MODULE_PATTERN_WITH_CONTEXT;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a dynamic NestJS module example with ports, options interface,
|
|
6
|
+
* module class, and consumer registration for the given module and port names.
|
|
7
|
+
*/
|
|
8
|
+
function MODULE_PATTERN_WITH_CONTEXT(moduleName, ports) {
|
|
9
|
+
return `
|
|
10
|
+
## Example: Dynamic Module "${moduleName}"
|
|
11
|
+
|
|
12
|
+
With ports: ${ports.map((p) => `\`${p}\``).join(', ')}
|
|
13
|
+
|
|
14
|
+
### Port Definitions
|
|
15
|
+
|
|
16
|
+
${ports
|
|
17
|
+
.map((port) => `\`\`\`typescript
|
|
18
|
+
// contracts/${port}.ts
|
|
19
|
+
|
|
20
|
+
export abstract class ${port} {
|
|
21
|
+
|
|
22
|
+
// Define abstract methods for the port contract
|
|
23
|
+
public abstract execute(/* args */): Promise<void>;
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
\`\`\``)
|
|
27
|
+
.join('\n\n')}
|
|
28
|
+
|
|
29
|
+
### Options Interface
|
|
30
|
+
|
|
31
|
+
\`\`\`typescript
|
|
32
|
+
// interfaces/I${moduleName}Options.ts
|
|
33
|
+
import { Type } from '@nestjs/common';
|
|
34
|
+
${ports.map((port) => `import { ${port} } from '../contracts/${port}';`).join('\n')}
|
|
35
|
+
|
|
36
|
+
export interface I${moduleName}Options {
|
|
37
|
+
${ports.map((port) => ` ${lowerFirstChar(port)}: Type<${port}>;`).join('\n')}
|
|
38
|
+
isGlobal?: boolean;
|
|
39
|
+
}
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
### Module Class
|
|
43
|
+
|
|
44
|
+
\`\`\`typescript
|
|
45
|
+
// ${moduleName}.ts
|
|
46
|
+
import { ConfigModule } from '@breadstone/archipel-platform-core';
|
|
47
|
+
import { type DynamicModule, Module, type Type } from '@nestjs/common';
|
|
48
|
+
import { I${moduleName}Options } from './interfaces/I${moduleName}Options';
|
|
49
|
+
${ports.map((port) => `import { ${port} } from './contracts/${port}';`).join('\n')}
|
|
50
|
+
|
|
51
|
+
@Module({})
|
|
52
|
+
export class ${moduleName} {
|
|
53
|
+
|
|
54
|
+
public static register(options: I${moduleName}Options): DynamicModule {
|
|
55
|
+
const portProviders = [
|
|
56
|
+
${ports.map((port) => ` { provide: ${port}, useClass: options.${lowerFirstChar(port)} },`).join('\n')}
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
global: options.isGlobal ?? false,
|
|
61
|
+
module: ${moduleName},
|
|
62
|
+
imports: [
|
|
63
|
+
ConfigModule.register('${toKebabCase(moduleName)}', PLATFORM_${toUpperSnakeCase(moduleName)}_CONFIG_ENTRIES),
|
|
64
|
+
],
|
|
65
|
+
providers: [
|
|
66
|
+
...portProviders,
|
|
67
|
+
// Add services, guards, interceptors here
|
|
68
|
+
],
|
|
69
|
+
exports: [
|
|
70
|
+
// Export public services, guards, interceptors
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
\`\`\`
|
|
77
|
+
|
|
78
|
+
### Consumer Usage
|
|
79
|
+
|
|
80
|
+
\`\`\`typescript
|
|
81
|
+
@Module({
|
|
82
|
+
imports: [
|
|
83
|
+
${moduleName}.register({
|
|
84
|
+
${ports.map((port) => ` ${lowerFirstChar(port)}: My${port}Adapter,`).join('\n')}
|
|
85
|
+
}),
|
|
86
|
+
],
|
|
87
|
+
})
|
|
88
|
+
export class AppModule {}
|
|
89
|
+
\`\`\`
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
function lowerFirstChar(str) {
|
|
93
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
94
|
+
}
|
|
95
|
+
function toKebabCase(name) {
|
|
96
|
+
return name
|
|
97
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
98
|
+
.toLowerCase()
|
|
99
|
+
.replace(/module$/, '');
|
|
100
|
+
}
|
|
101
|
+
function toUpperSnakeCase(name) {
|
|
102
|
+
return name
|
|
103
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2')
|
|
104
|
+
.toUpperCase()
|
|
105
|
+
.replace(/MODULE$/, '');
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=modulePatternGenerator.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QUERY_PATTERN_WITH_MODEL = QUERY_PATTERN_WITH_MODEL;
|
|
4
|
+
/**
|
|
5
|
+
* Generates model-specific query factory examples based on a Prisma model name and its fields.
|
|
6
|
+
*/
|
|
7
|
+
function QUERY_PATTERN_WITH_MODEL(modelName, fields) {
|
|
8
|
+
return `
|
|
9
|
+
## Example: Queries for "${modelName}"
|
|
10
|
+
|
|
11
|
+
Given a Prisma model \`${modelName}\` with fields: ${fields.map((f) => `\`${f}\``).join(', ')}
|
|
12
|
+
|
|
13
|
+
### findFirst query
|
|
14
|
+
\`\`\`typescript
|
|
15
|
+
import { Prisma } from '@prisma/client';
|
|
16
|
+
import { query } from '@breadstone/archipel-platform-database';
|
|
17
|
+
|
|
18
|
+
export function find${modelName}ByIdQuery(id: string) {
|
|
19
|
+
return query<Prisma.${modelName}Delegate, { ${fields.map((f) => `${f}: ${inferFieldType(f)}`).join('; ')} } | null>(
|
|
20
|
+
'find${modelName}ById',
|
|
21
|
+
(model) =>
|
|
22
|
+
model.findFirst({
|
|
23
|
+
where: { id },
|
|
24
|
+
select: { ${fields.map((f) => `${f}: true`).join(', ')} },
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
### findMany query
|
|
31
|
+
\`\`\`typescript
|
|
32
|
+
export function findAll${modelName}sQuery(skip = 0, take = 20) {
|
|
33
|
+
return query<Prisma.${modelName}Delegate, Array<{ ${fields.map((f) => `${f}: ${inferFieldType(f)}`).join('; ')} }>>(
|
|
34
|
+
'findAll${modelName}s',
|
|
35
|
+
(model) =>
|
|
36
|
+
model.findMany({
|
|
37
|
+
skip,
|
|
38
|
+
take,
|
|
39
|
+
select: { ${fields.map((f) => `${f}: true`).join(', ')} },
|
|
40
|
+
orderBy: { ${fields.includes('createdAt') ? 'createdAt' : fields[0]}: 'desc' },
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
### count query
|
|
47
|
+
\`\`\`typescript
|
|
48
|
+
export function count${modelName}sQuery() {
|
|
49
|
+
return query<Prisma.${modelName}Delegate, number>(
|
|
50
|
+
'count${modelName}s',
|
|
51
|
+
(model) => model.count(),
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### Service usage
|
|
57
|
+
\`\`\`typescript
|
|
58
|
+
// In a service method:
|
|
59
|
+
const item = await this._${lowerFirst(modelName)}Repository.execute(find${modelName}ByIdQuery(id));
|
|
60
|
+
const items = await this._${lowerFirst(modelName)}Repository.execute(findAll${modelName}sQuery(0, 50));
|
|
61
|
+
const total = await this._${lowerFirst(modelName)}Repository.execute(count${modelName}sQuery());
|
|
62
|
+
\`\`\`
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
function inferFieldType(fieldName) {
|
|
66
|
+
if (fieldName === 'id')
|
|
67
|
+
return 'string';
|
|
68
|
+
if (fieldName.endsWith('Id'))
|
|
69
|
+
return 'string';
|
|
70
|
+
if (fieldName.endsWith('At') || fieldName === 'createdAt' || fieldName === 'updatedAt')
|
|
71
|
+
return 'Date';
|
|
72
|
+
if (fieldName.startsWith('is') || fieldName.startsWith('has'))
|
|
73
|
+
return 'boolean';
|
|
74
|
+
if (fieldName === 'count' || fieldName === 'quantity' || fieldName === 'amount' || fieldName === 'order')
|
|
75
|
+
return 'number';
|
|
76
|
+
if (fieldName === 'email' || fieldName === 'name' || fieldName === 'title' || fieldName === 'description')
|
|
77
|
+
return 'string';
|
|
78
|
+
return 'unknown';
|
|
79
|
+
}
|
|
80
|
+
function lowerFirst(str) {
|
|
81
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=queryPatternGenerator.js.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REPOSITORY_PATTERN_WITH_MODEL = REPOSITORY_PATTERN_WITH_MODEL;
|
|
4
|
+
/**
|
|
5
|
+
* Generates a full repository class, entity interface, query factories, module
|
|
6
|
+
* registration, and service usage example for a given Prisma model.
|
|
7
|
+
*/
|
|
8
|
+
function REPOSITORY_PATTERN_WITH_MODEL(modelName, fields) {
|
|
9
|
+
return `
|
|
10
|
+
## Example: Repository for "${modelName}"
|
|
11
|
+
|
|
12
|
+
Given a Prisma model \`${modelName}\` with fields: ${fields.map((f) => `\`${f}\``).join(', ')}
|
|
13
|
+
|
|
14
|
+
### Repository Class
|
|
15
|
+
|
|
16
|
+
\`\`\`typescript
|
|
17
|
+
// repositories/${modelName}Repository.ts
|
|
18
|
+
import { Injectable } from '@nestjs/common';
|
|
19
|
+
import { Prisma } from '@prisma/client';
|
|
20
|
+
import {
|
|
21
|
+
DatabaseService,
|
|
22
|
+
DelegateArgs,
|
|
23
|
+
DelegateReturnTypes,
|
|
24
|
+
RepositoryBase,
|
|
25
|
+
} from '@breadstone/archipel-platform-database';
|
|
26
|
+
import { I${modelName}Entity } from '../models/entities/I${modelName}Entity';
|
|
27
|
+
|
|
28
|
+
@Injectable()
|
|
29
|
+
export class ${modelName}Repository extends RepositoryBase<
|
|
30
|
+
Prisma.${modelName}Delegate,
|
|
31
|
+
DelegateArgs<Prisma.${modelName}Delegate>,
|
|
32
|
+
DelegateReturnTypes<Prisma.${modelName}Delegate>,
|
|
33
|
+
I${modelName}Entity
|
|
34
|
+
> {
|
|
35
|
+
|
|
36
|
+
// #region Ctor
|
|
37
|
+
|
|
38
|
+
public constructor(db: DatabaseService) {
|
|
39
|
+
super(db, db.client.${lowerFirst(modelName)});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// #endregion
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
### Entity Interface
|
|
48
|
+
|
|
49
|
+
\`\`\`typescript
|
|
50
|
+
// models/entities/I${modelName}Entity.ts
|
|
51
|
+
export interface I${modelName}Entity {
|
|
52
|
+
${fields.map((f) => ` readonly ${f}: ${inferFieldType(f)};`).join('\n')}
|
|
53
|
+
}
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### Query Factories
|
|
57
|
+
|
|
58
|
+
\`\`\`typescript
|
|
59
|
+
// queries/find${modelName}ByIdQuery.ts
|
|
60
|
+
import { Prisma } from '@prisma/client';
|
|
61
|
+
import { query } from '@breadstone/archipel-platform-database';
|
|
62
|
+
import { I${modelName}Entity } from '../models/entities/I${modelName}Entity';
|
|
63
|
+
|
|
64
|
+
export function find${modelName}ByIdQuery(id: string) {
|
|
65
|
+
return query<Prisma.${modelName}Delegate, I${modelName}Entity | null>(
|
|
66
|
+
'find${modelName}ById',
|
|
67
|
+
(model) => model.findFirst({
|
|
68
|
+
where: { id },
|
|
69
|
+
select: { ${fields.map((f) => `${f}: true`).join(', ')} },
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function findAll${modelName}sQuery(skip = 0, take = 20) {
|
|
75
|
+
return query<Prisma.${modelName}Delegate, I${modelName}Entity[]>(
|
|
76
|
+
'findAll${modelName}s',
|
|
77
|
+
(model) => model.findMany({
|
|
78
|
+
skip,
|
|
79
|
+
take,
|
|
80
|
+
select: { ${fields.map((f) => `${f}: true`).join(', ')} },
|
|
81
|
+
orderBy: { ${fields.includes('createdAt') ? 'createdAt' : fields[0]}: 'desc' },
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function count${modelName}sQuery() {
|
|
87
|
+
return query<Prisma.${modelName}Delegate, number>(
|
|
88
|
+
'count${modelName}s',
|
|
89
|
+
(model) => model.count(),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
### Module Registration
|
|
95
|
+
|
|
96
|
+
\`\`\`typescript
|
|
97
|
+
import { DatabaseModule } from '@breadstone/archipel-platform-database';
|
|
98
|
+
import { ${modelName}Repository } from './repositories/${modelName}Repository';
|
|
99
|
+
import { ${modelName}Service } from './services/${modelName}Service';
|
|
100
|
+
|
|
101
|
+
@Module({
|
|
102
|
+
imports: [DatabaseModule.register()],
|
|
103
|
+
providers: [${modelName}Repository, ${modelName}Service],
|
|
104
|
+
exports: [${modelName}Service],
|
|
105
|
+
})
|
|
106
|
+
export class ${modelName}Module {}
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
### Service Usage
|
|
110
|
+
|
|
111
|
+
\`\`\`typescript
|
|
112
|
+
@Injectable()
|
|
113
|
+
export class ${modelName}Service {
|
|
114
|
+
|
|
115
|
+
// #region Fields
|
|
116
|
+
|
|
117
|
+
private readonly _${lowerFirst(modelName)}Repository: ${modelName}Repository;
|
|
118
|
+
|
|
119
|
+
// #endregion
|
|
120
|
+
|
|
121
|
+
// #region Ctor
|
|
122
|
+
|
|
123
|
+
public constructor(${lowerFirst(modelName)}Repository: ${modelName}Repository) {
|
|
124
|
+
this._${lowerFirst(modelName)}Repository = ${lowerFirst(modelName)}Repository;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// #endregion
|
|
128
|
+
|
|
129
|
+
// #region Methods
|
|
130
|
+
|
|
131
|
+
public async findById(id: string): Promise<I${modelName}Entity | null> {
|
|
132
|
+
return this._${lowerFirst(modelName)}Repository.execute(find${modelName}ByIdQuery(id));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public async findAll(skip = 0, take = 20): Promise<I${modelName}Entity[]> {
|
|
136
|
+
return this._${lowerFirst(modelName)}Repository.execute(findAll${modelName}sQuery(skip, take));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public async count(): Promise<number> {
|
|
140
|
+
return this._${lowerFirst(modelName)}Repository.execute(count${modelName}sQuery());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// #endregion
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
\`\`\`
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
function inferFieldType(fieldName) {
|
|
150
|
+
if (fieldName === 'id')
|
|
151
|
+
return 'string';
|
|
152
|
+
if (fieldName.endsWith('Id'))
|
|
153
|
+
return 'string';
|
|
154
|
+
if (fieldName.endsWith('At') || fieldName === 'createdAt' || fieldName === 'updatedAt')
|
|
155
|
+
return 'Date';
|
|
156
|
+
if (fieldName.startsWith('is') || fieldName.startsWith('has'))
|
|
157
|
+
return 'boolean';
|
|
158
|
+
if (fieldName === 'count' || fieldName === 'quantity' || fieldName === 'amount' || fieldName === 'price')
|
|
159
|
+
return 'number';
|
|
160
|
+
return 'string';
|
|
161
|
+
}
|
|
162
|
+
function lowerFirst(str) {
|
|
163
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=repositoryPatternGenerator.js.map
|
package/src/main.js
CHANGED
|
@@ -5,6 +5,7 @@ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
5
5
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
6
6
|
const DocsLoader_1 = require("./DocsLoader");
|
|
7
7
|
const GuidesLoader_1 = require("./GuidesLoader");
|
|
8
|
+
const PatternsLoader_1 = require("./PatternsLoader");
|
|
8
9
|
const registerGetConfigPatternTool_1 = require("./tools/registerGetConfigPatternTool");
|
|
9
10
|
const registerGetDtoPatternTool_1 = require("./tools/registerGetDtoPatternTool");
|
|
10
11
|
const registerGetErrorHandlingPatternTool_1 = require("./tools/registerGetErrorHandlingPatternTool");
|
|
@@ -30,6 +31,8 @@ async function main() {
|
|
|
30
31
|
docsLoader.load();
|
|
31
32
|
const guidesLoader = new GuidesLoader_1.GuidesLoader();
|
|
32
33
|
guidesLoader.load();
|
|
34
|
+
const patternsLoader = new PatternsLoader_1.PatternsLoader();
|
|
35
|
+
patternsLoader.load();
|
|
33
36
|
const server = new mcp_js_1.McpServer({
|
|
34
37
|
name: SERVER_NAME,
|
|
35
38
|
description: 'MCP server for Archipel platform documentation, guides, and knowledge base.',
|
|
@@ -37,21 +40,24 @@ async function main() {
|
|
|
37
40
|
websiteUrl: 'https://archipel.breadstone.de/',
|
|
38
41
|
version: SERVER_VERSION,
|
|
39
42
|
});
|
|
43
|
+
// docs tools
|
|
40
44
|
(0, registerListPackagesTool_1.registerListPackagesTool)(server, docsLoader);
|
|
41
45
|
(0, registerGetPackageDocTool_1.registerGetPackageDocTool)(server, docsLoader);
|
|
42
46
|
(0, registerSearchDocsTool_1.registerSearchDocsTool)(server, docsLoader);
|
|
47
|
+
// guides tools
|
|
43
48
|
(0, registerListGuidesTool_1.registerListGuidesTool)(server, guidesLoader);
|
|
44
49
|
(0, registerGetGuideTool_1.registerGetGuideTool)(server, guidesLoader);
|
|
45
50
|
(0, registerSearchGuidesTool_1.registerSearchGuidesTool)(server, guidesLoader);
|
|
46
|
-
|
|
47
|
-
(0,
|
|
48
|
-
(0,
|
|
49
|
-
(0,
|
|
50
|
-
(0,
|
|
51
|
-
(0,
|
|
52
|
-
(0,
|
|
53
|
-
(0,
|
|
54
|
-
(0,
|
|
51
|
+
// pattern tools
|
|
52
|
+
(0, registerGetQueryPatternTool_1.registerGetQueryPatternTool)(server, patternsLoader);
|
|
53
|
+
(0, registerGetRepositoryPatternTool_1.registerGetRepositoryPatternTool)(server, patternsLoader);
|
|
54
|
+
(0, registerGetMappingPatternTool_1.registerGetMappingPatternTool)(server, patternsLoader);
|
|
55
|
+
(0, registerGetModulePatternTool_1.registerGetModulePatternTool)(server, patternsLoader);
|
|
56
|
+
(0, registerGetErrorHandlingPatternTool_1.registerGetErrorHandlingPatternTool)(server, patternsLoader);
|
|
57
|
+
(0, registerGetConfigPatternTool_1.registerGetConfigPatternTool)(server, patternsLoader);
|
|
58
|
+
(0, registerGetGuardPatternTool_1.registerGetGuardPatternTool)(server, patternsLoader);
|
|
59
|
+
(0, registerGetDtoPatternTool_1.registerGetDtoPatternTool)(server, patternsLoader);
|
|
60
|
+
(0, registerGetTestingPatternTool_1.registerGetTestingPatternTool)(server, patternsLoader);
|
|
55
61
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
56
62
|
await server.connect(transport);
|
|
57
63
|
process.stderr.write(`[${SERVER_NAME}] Server running on stdio\n`);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Describes a loaded pattern documentation entry.
|
|
3
|
+
*/
|
|
4
|
+
export interface IPatternDoc {
|
|
5
|
+
/** File name without extension (e.g. "config-pattern"). */
|
|
6
|
+
readonly name: string;
|
|
7
|
+
/** Human-readable title from frontmatter. */
|
|
8
|
+
readonly title: string;
|
|
9
|
+
/** Short description from frontmatter. */
|
|
10
|
+
readonly description: string;
|
|
11
|
+
/** Sort order from frontmatter. */
|
|
12
|
+
readonly order: number;
|
|
13
|
+
/** Markdown body (without frontmatter). */
|
|
14
|
+
readonly content: string;
|
|
15
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { PatternsLoader } from '../PatternsLoader';
|
|
2
3
|
/**
|
|
3
4
|
* Registers the get-config-pattern tool on the MCP server.
|
|
4
5
|
*/
|
|
5
|
-
export declare function registerGetConfigPatternTool(server: McpServer): void;
|
|
6
|
+
export declare function registerGetConfigPatternTool(server: McpServer, patternsLoader: PatternsLoader): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerGetConfigPatternTool = registerGetConfigPatternTool;
|
|
4
|
-
const configPattern_1 = require("../knowledge/configPattern");
|
|
5
4
|
/**
|
|
6
5
|
* Registers the get-config-pattern tool on the MCP server.
|
|
7
6
|
*/
|
|
8
|
-
function registerGetConfigPatternTool(server) {
|
|
7
|
+
function registerGetConfigPatternTool(server, patternsLoader) {
|
|
9
8
|
server.tool('get-config-pattern', 'Returns the Archipel configuration pattern — typed config keys (createConfigKey), ConfigRegistry, ConfigService, env.ts conventions, and ConfigModule integration.', {}, async () => {
|
|
9
|
+
const pattern = patternsLoader.patterns.get('config-pattern');
|
|
10
|
+
const text = pattern?.content ?? 'Config pattern documentation not available.';
|
|
10
11
|
return {
|
|
11
|
-
content: [{ type: 'text', text
|
|
12
|
+
content: [{ type: 'text', text }],
|
|
12
13
|
};
|
|
13
14
|
});
|
|
14
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { PatternsLoader } from '../PatternsLoader';
|
|
2
3
|
/**
|
|
3
4
|
* Registers the get-dto-pattern tool on the MCP server.
|
|
4
5
|
*/
|
|
5
|
-
export declare function registerGetDtoPatternTool(server: McpServer): void;
|
|
6
|
+
export declare function registerGetDtoPatternTool(server: McpServer, patternsLoader: PatternsLoader): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerGetDtoPatternTool = registerGetDtoPatternTool;
|
|
4
|
-
const dtoPattern_1 = require("../knowledge/dtoPattern");
|
|
5
4
|
/**
|
|
6
5
|
* Registers the get-dto-pattern tool on the MCP server.
|
|
7
6
|
*/
|
|
8
|
-
function registerGetDtoPatternTool(server) {
|
|
7
|
+
function registerGetDtoPatternTool(server, patternsLoader) {
|
|
9
8
|
server.tool('get-dto-pattern', 'Returns the Archipel DTO & validation pattern — Request/Response DTOs, class-validator decorators, cross-field validation, query parameter DTOs, OpenAPI integration, and naming conventions.', {}, async () => {
|
|
9
|
+
const pattern = patternsLoader.patterns.get('dto-pattern');
|
|
10
|
+
const text = pattern?.content ?? 'DTO pattern documentation not available.';
|
|
10
11
|
return {
|
|
11
|
-
content: [{ type: 'text', text
|
|
12
|
+
content: [{ type: 'text', text }],
|
|
12
13
|
};
|
|
13
14
|
});
|
|
14
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { PatternsLoader } from '../PatternsLoader';
|
|
2
3
|
/**
|
|
3
4
|
* Registers the get-error-handling-pattern tool on the MCP server.
|
|
4
5
|
*/
|
|
5
|
-
export declare function registerGetErrorHandlingPatternTool(server: McpServer): void;
|
|
6
|
+
export declare function registerGetErrorHandlingPatternTool(server: McpServer, patternsLoader: PatternsLoader): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerGetErrorHandlingPatternTool = registerGetErrorHandlingPatternTool;
|
|
4
|
-
const errorHandlingPattern_1 = require("../knowledge/errorHandlingPattern");
|
|
5
4
|
/**
|
|
6
5
|
* Registers the get-error-handling-pattern tool on the MCP server.
|
|
7
6
|
*/
|
|
8
|
-
function registerGetErrorHandlingPatternTool(server) {
|
|
7
|
+
function registerGetErrorHandlingPatternTool(server, patternsLoader) {
|
|
9
8
|
server.tool('get-error-handling-pattern', 'Returns the Archipel error handling pattern — domain errors, RepositoryError, exception filters, and structured error response envelopes.', {}, async () => {
|
|
9
|
+
const pattern = patternsLoader.patterns.get('error-handling-pattern');
|
|
10
|
+
const text = pattern?.content ?? 'Error handling pattern documentation not available.';
|
|
10
11
|
return {
|
|
11
|
-
content: [{ type: 'text', text
|
|
12
|
+
content: [{ type: 'text', text }],
|
|
12
13
|
};
|
|
13
14
|
});
|
|
14
15
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { PatternsLoader } from '../PatternsLoader';
|
|
2
3
|
/**
|
|
3
4
|
* Registers the get-guard-pattern tool on the MCP server.
|
|
4
5
|
*/
|
|
5
|
-
export declare function registerGetGuardPatternTool(server: McpServer): void;
|
|
6
|
+
export declare function registerGetGuardPatternTool(server: McpServer, patternsLoader: PatternsLoader): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerGetGuardPatternTool = registerGetGuardPatternTool;
|
|
4
|
-
const guardPattern_1 = require("../knowledge/guardPattern");
|
|
5
4
|
/**
|
|
6
5
|
* Registers the get-guard-pattern tool on the MCP server.
|
|
7
6
|
*/
|
|
8
|
-
function registerGetGuardPatternTool(server) {
|
|
7
|
+
function registerGetGuardPatternTool(server, patternsLoader) {
|
|
9
8
|
server.tool('get-guard-pattern', 'Returns the Archipel guard & interceptor pattern — metadata decorators, FeatureGuard, RolesGuard, FeatureUsageInterceptor, and the full decorator-guard-interceptor trio.', {}, async () => {
|
|
9
|
+
const pattern = patternsLoader.patterns.get('guard-pattern');
|
|
10
|
+
const text = pattern?.content ?? 'Guard pattern documentation not available.';
|
|
10
11
|
return {
|
|
11
|
-
content: [{ type: 'text', text
|
|
12
|
+
content: [{ type: 'text', text }],
|
|
12
13
|
};
|
|
13
14
|
});
|
|
14
15
|
}
|