framework-mcp 2.4.6 → 2.6.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/README.md +35 -10
- package/dist/core/safeguard-manager.d.ts.map +1 -1
- package/dist/core/safeguard-manager.js +164 -7066
- package/dist/core/safeguard-manager.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/http/http-server.d.ts.map +1 -1
- package/dist/interfaces/http/http-server.js +6 -40
- package/dist/interfaces/http/http-server.js.map +1 -1
- package/dist/interfaces/mcp/mcp-server.js +3 -3
- package/dist/shared/types.d.ts +49 -60
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/shared/types.js.map +1 -1
- package/package.json +9 -3
- package/swagger.json +10 -133
- package/.claude/agents/mcp-developer.md +0 -41
- package/.claude/agents/project-orchestrator.md +0 -43
- package/.claude/agents/version-consistency-reviewer.md +0 -50
- package/.claude/commands/speckit.analyze.md +0 -184
- package/.claude/commands/speckit.checklist.md +0 -294
- package/.claude/commands/speckit.clarify.md +0 -181
- package/.claude/commands/speckit.constitution.md +0 -82
- package/.claude/commands/speckit.implement.md +0 -135
- package/.claude/commands/speckit.plan.md +0 -89
- package/.claude/commands/speckit.specify.md +0 -258
- package/.claude/commands/speckit.tasks.md +0 -137
- package/.claude/commands/speckit.taskstoissues.md +0 -30
- package/.claude/config.json +0 -11
- package/.claude_config.json +0 -11
- package/.do/app.yaml +0 -78
- package/.github/dependabot.yml +0 -15
- package/.github/workflows/ci.yml +0 -90
- package/.github/workflows/release.yml +0 -30
- package/.mcp.json +0 -11
- package/.specify/memory/constitution.md +0 -50
- package/.specify/scripts/bash/check-prerequisites.sh +0 -166
- package/.specify/scripts/bash/common.sh +0 -156
- package/.specify/scripts/bash/create-new-feature.sh +0 -297
- package/.specify/scripts/bash/setup-plan.sh +0 -61
- package/.specify/scripts/bash/update-agent-context.sh +0 -799
- package/.specify/templates/agent-file-template.md +0 -28
- package/.specify/templates/checklist-template.md +0 -40
- package/.specify/templates/plan-template.md +0 -104
- package/.specify/templates/spec-template.md +0 -115
- package/.specify/templates/tasks-template.md +0 -251
- package/examples/example-usage.md +0 -293
- package/examples/llm-analysis-patterns.md +0 -553
- package/examples/vendors.csv +0 -9
- package/examples/vendors.json +0 -32
- package/scripts/standardize-prompts.js +0 -325
- package/scripts/validate-capability-prompts.js +0 -110
- package/scripts/validate-documentation.sh +0 -150
- package/src/core/safeguard-manager.ts +0 -16891
- package/src/index.ts +0 -17
- package/src/interfaces/http/http-server.ts +0 -301
- package/src/interfaces/mcp/mcp-server.ts +0 -165
- package/src/shared/types.ts +0 -337
- package/tsconfig.json +0 -23
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
|
|
10
|
-
class PromptStandardizer {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.safeguardManagerPath = path.join(__dirname, '..', 'src/core/safeguard-manager.ts');
|
|
13
|
-
this.backupPath = `${this.safeguardManagerPath}.backup.${Date.now()}`;
|
|
14
|
-
this.dryRun = false;
|
|
15
|
-
this.verbose = false;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Extract template objectives from safeguard 10.2
|
|
20
|
-
*/
|
|
21
|
-
extractTemplateObjectives() {
|
|
22
|
-
const content = fs.readFileSync(this.safeguardManagerPath, 'utf-8');
|
|
23
|
-
|
|
24
|
-
// Find safeguard 10.2 and extract the objectives
|
|
25
|
-
const safeguard10_2Match = content.match(/"10\.2":\s*{[\s\S]*?systemPromptValidates:\s*{[\s\S]*?}\s*}/);
|
|
26
|
-
if (!safeguard10_2Match) {
|
|
27
|
-
throw new Error('Could not find safeguard 10.2 definition');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const safeguard10_2Text = safeguard10_2Match[0];
|
|
31
|
-
|
|
32
|
-
// Extract objectives for each capability
|
|
33
|
-
const extractObjective = (capability) => {
|
|
34
|
-
const regex = new RegExp(`systemPrompt${capability}:[\\s\\S]*?objective:\\s*"([^"]*)"`, 'i');
|
|
35
|
-
const match = safeguard10_2Text.match(regex);
|
|
36
|
-
if (!match) {
|
|
37
|
-
throw new Error(`Could not find ${capability} objective in safeguard 10.2`);
|
|
38
|
-
}
|
|
39
|
-
return match[1];
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const template = {
|
|
43
|
-
Full: extractObjective('Full'),
|
|
44
|
-
Partial: extractObjective('Partial'),
|
|
45
|
-
Facilitates: extractObjective('Facilitates'),
|
|
46
|
-
Governance: extractObjective('Governance'),
|
|
47
|
-
Validates: extractObjective('Validates')
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (this.verbose) {
|
|
51
|
-
console.log('📋 Extracted template objectives:');
|
|
52
|
-
Object.entries(template).forEach(([key, value]) => {
|
|
53
|
-
console.log(` ${key}: ${value.substring(0, 80)}...`);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return template;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Apply standardization using global replacements
|
|
62
|
-
*/
|
|
63
|
-
standardizeContent(template) {
|
|
64
|
-
let content = fs.readFileSync(this.safeguardManagerPath, 'utf-8');
|
|
65
|
-
let totalReplacements = 0;
|
|
66
|
-
|
|
67
|
-
// Track changes
|
|
68
|
-
const stats = {
|
|
69
|
-
objectiveReplacements: 0,
|
|
70
|
-
guidelineReplacements: 0,
|
|
71
|
-
outputFormatReplacements: 0,
|
|
72
|
-
implementationSimplifications: 0
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// Step 1: Replace all objectives with template objectives
|
|
76
|
-
const capabilities = ['Full', 'Partial', 'Facilitates', 'Governance', 'Validates'];
|
|
77
|
-
|
|
78
|
-
for (const capability of capabilities) {
|
|
79
|
-
const templateObjective = template[capability];
|
|
80
|
-
|
|
81
|
-
// Replace all objectives for this capability (excluding 10.2)
|
|
82
|
-
const objectiveRegex = new RegExp(
|
|
83
|
-
`(systemPrompt${capability}:[\\s\\S]*?objective:\\s*)"[^"]*"`,
|
|
84
|
-
'g'
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
let matches = 0;
|
|
88
|
-
content = content.replace(objectiveRegex, (match, prefix, offset) => {
|
|
89
|
-
// Skip if this is within safeguard 10.2
|
|
90
|
-
const before = content.substring(Math.max(0, offset - 500), offset);
|
|
91
|
-
if (before.includes('"10.2":')) {
|
|
92
|
-
return match; // Don't replace template safeguard
|
|
93
|
-
}
|
|
94
|
-
matches++;
|
|
95
|
-
return `${prefix}"${templateObjective}"`;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
stats.objectiveReplacements += matches;
|
|
99
|
-
if (this.verbose && matches > 0) {
|
|
100
|
-
console.log(` ✅ Updated ${matches} ${capability} objectives`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Step 2: Replace all guidelines with ["Future Use"] (excluding 10.2)
|
|
105
|
-
const guidelineRegex = /(systemPrompt(?:Full|Partial|Facilitates|Governance|Validates):[\s\S]*?guidelines:\s*)\[[\s\S]*?\]/g;
|
|
106
|
-
|
|
107
|
-
content = content.replace(guidelineRegex, (match, prefix, offset) => {
|
|
108
|
-
// Skip if this is within safeguard 10.2
|
|
109
|
-
const before = content.substring(Math.max(0, offset - 500), offset);
|
|
110
|
-
if (before.includes('"10.2":')) {
|
|
111
|
-
return match; // Don't replace template safeguard
|
|
112
|
-
}
|
|
113
|
-
stats.guidelineReplacements++;
|
|
114
|
-
return `${prefix}[\n "Future Use"\n ]`;
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
// Step 3: Replace all outputFormat with standardized version (excluding 10.2)
|
|
118
|
-
const outputFormatRegex = /(systemPrompt(?:Full|Partial|Facilitates|Governance|Validates):[\s\S]*?outputFormat:\s*)"[^"]*"/g;
|
|
119
|
-
const standardOutputFormat = 'Provide a structured assessment, confidence score, and evidence summary';
|
|
120
|
-
|
|
121
|
-
content = content.replace(outputFormatRegex, (match, prefix, offset) => {
|
|
122
|
-
// Skip if this is within safeguard 10.2
|
|
123
|
-
const before = content.substring(Math.max(0, offset - 500), offset);
|
|
124
|
-
if (before.includes('"10.2":')) {
|
|
125
|
-
return match; // Don't replace template safeguard
|
|
126
|
-
}
|
|
127
|
-
stats.outputFormatReplacements++;
|
|
128
|
-
return `${prefix}"${standardOutputFormat}"`;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Step 4: Simplify implementation suggestions (excluding 10.2)
|
|
132
|
-
const implRegex = /(implementationSuggestions:\s*\[\s*)((?:\s*"[^"]*",?\s*)+)(\s*\])/g;
|
|
133
|
-
|
|
134
|
-
content = content.replace(implRegex, (match, prefix, suggestions, suffix, offset) => {
|
|
135
|
-
// Skip if this is within safeguard 10.2
|
|
136
|
-
const before = content.substring(Math.max(0, offset - 500), offset);
|
|
137
|
-
if (before.includes('"10.2":')) {
|
|
138
|
-
return match; // Don't replace template safeguard
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Extract individual suggestions
|
|
142
|
-
const suggestionMatches = suggestions.match(/"[^"]+"/g) || [];
|
|
143
|
-
|
|
144
|
-
if (suggestionMatches.length > 3) {
|
|
145
|
-
stats.implementationSimplifications++;
|
|
146
|
-
const simplified = suggestionMatches.slice(0, 3).join(',\n ');
|
|
147
|
-
return `${prefix} // Gray - Implementation suggestions\n ${simplified}\n ${suffix}`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return match; // Keep as is if 3 or fewer suggestions
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
if (this.verbose) {
|
|
154
|
-
console.log('📊 Transformation statistics:');
|
|
155
|
-
console.log(` - Objective replacements: ${stats.objectiveReplacements}`);
|
|
156
|
-
console.log(` - Guideline replacements: ${stats.guidelineReplacements}`);
|
|
157
|
-
console.log(` - Output format replacements: ${stats.outputFormatReplacements}`);
|
|
158
|
-
console.log(` - Implementation simplifications: ${stats.implementationSimplifications}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return { content, stats };
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Create backup of original safeguard-manager.ts
|
|
166
|
-
*/
|
|
167
|
-
createBackup() {
|
|
168
|
-
if (this.verbose) {
|
|
169
|
-
console.log(`📁 Creating backup: ${this.backupPath}`);
|
|
170
|
-
}
|
|
171
|
-
fs.copyFileSync(this.safeguardManagerPath, this.backupPath);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Save updated content
|
|
176
|
-
*/
|
|
177
|
-
saveContent(content) {
|
|
178
|
-
if (this.dryRun) {
|
|
179
|
-
console.log('🔍 DRY RUN: Would save updated content to file');
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (this.verbose) {
|
|
184
|
-
console.log('💾 Saving updated content...');
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fs.writeFileSync(this.safeguardManagerPath, content);
|
|
188
|
-
|
|
189
|
-
if (this.verbose) {
|
|
190
|
-
console.log('✅ File saved successfully');
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Validate transformation results
|
|
196
|
-
*/
|
|
197
|
-
validateTransformation(content) {
|
|
198
|
-
if (this.verbose) {
|
|
199
|
-
console.log('🔍 Validating transformation...');
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
let isValid = true;
|
|
203
|
-
const errors = [];
|
|
204
|
-
|
|
205
|
-
// Count "Future Use" guidelines
|
|
206
|
-
const futureUseMatches = content.match(/guidelines:\s*\[\s*"Future Use"\s*\]/g);
|
|
207
|
-
const futureUseCount = futureUseMatches ? futureUseMatches.length : 0;
|
|
208
|
-
|
|
209
|
-
// Expected: 153 safeguards × 5 capabilities = 765
|
|
210
|
-
// But safeguard 10.2 already has 5, so we should see 760 from transformation + 5 existing = 765 total
|
|
211
|
-
const expectedTotal = 765;
|
|
212
|
-
|
|
213
|
-
if (futureUseCount !== expectedTotal) {
|
|
214
|
-
errors.push(`Expected ${expectedTotal} "Future Use" guidelines, found ${futureUseCount}`);
|
|
215
|
-
isValid = false;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Count standardized output formats
|
|
219
|
-
const outputFormatMatches = content.match(/outputFormat:\s*"Provide a structured assessment, confidence score, and evidence summary"/g);
|
|
220
|
-
const outputFormatCount = outputFormatMatches ? outputFormatMatches.length : 0;
|
|
221
|
-
|
|
222
|
-
if (outputFormatCount !== expectedTotal) {
|
|
223
|
-
errors.push(`Expected ${expectedTotal} standardized output formats, found ${outputFormatCount}`);
|
|
224
|
-
isValid = false;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Verify template objectives are applied
|
|
228
|
-
const fullObjectiveMatches = content.match(/The vendor has taken an assessment and has been mapped to FULL.*?FULLY\./g);
|
|
229
|
-
const fullObjectiveCount = fullObjectiveMatches ? fullObjectiveMatches.length : 0;
|
|
230
|
-
|
|
231
|
-
if (fullObjectiveCount !== 153) {
|
|
232
|
-
errors.push(`Expected 153 FULL template objectives, found ${fullObjectiveCount}`);
|
|
233
|
-
isValid = false;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (errors.length > 0) {
|
|
237
|
-
console.error('❌ Validation errors:');
|
|
238
|
-
errors.forEach(error => console.error(` - ${error}`));
|
|
239
|
-
} else {
|
|
240
|
-
console.log('✅ Validation passed: All transformations applied successfully');
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return isValid;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Main transformation process
|
|
248
|
-
*/
|
|
249
|
-
async run(options = {}) {
|
|
250
|
-
this.dryRun = options.dryRun || false;
|
|
251
|
-
this.verbose = options.verbose || false;
|
|
252
|
-
|
|
253
|
-
try {
|
|
254
|
-
console.log('🚀 Starting prompt standardization...');
|
|
255
|
-
|
|
256
|
-
// Create backup unless dry run
|
|
257
|
-
if (!this.dryRun) {
|
|
258
|
-
this.createBackup();
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Extract template objectives from 10.2
|
|
262
|
-
console.log('📋 Extracting template from safeguard 10.2...');
|
|
263
|
-
const template = this.extractTemplateObjectives();
|
|
264
|
-
|
|
265
|
-
// Apply standardization
|
|
266
|
-
console.log('🔄 Applying standardization to all safeguards (excluding 10.2)...');
|
|
267
|
-
const { content, stats } = this.standardizeContent(template);
|
|
268
|
-
|
|
269
|
-
// Validate if requested
|
|
270
|
-
if (options.validate) {
|
|
271
|
-
const isValid = this.validateTransformation(content);
|
|
272
|
-
if (!isValid) {
|
|
273
|
-
throw new Error('Validation failed - transformation incomplete');
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Save results
|
|
278
|
-
this.saveContent(content);
|
|
279
|
-
|
|
280
|
-
console.log('🎉 Standardization complete!');
|
|
281
|
-
console.log('📊 Summary:');
|
|
282
|
-
console.log(` - Objective updates: ${stats.objectiveReplacements}`);
|
|
283
|
-
console.log(` - Guideline standardizations: ${stats.guidelineReplacements}`);
|
|
284
|
-
console.log(` - Output format standardizations: ${stats.outputFormatReplacements}`);
|
|
285
|
-
console.log(` - Implementation simplifications: ${stats.implementationSimplifications}`);
|
|
286
|
-
if (!this.dryRun) {
|
|
287
|
-
console.log(` - Backup: ${this.backupPath}`);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
} catch (error) {
|
|
291
|
-
console.error('❌ Error during standardization:', error);
|
|
292
|
-
process.exit(1);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// CLI interface
|
|
298
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
299
|
-
const args = process.argv.slice(2);
|
|
300
|
-
const options = {
|
|
301
|
-
dryRun: args.includes('--dry-run'),
|
|
302
|
-
validate: args.includes('--validate'),
|
|
303
|
-
verbose: args.includes('--verbose')
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
if (args.includes('--help')) {
|
|
307
|
-
console.log(`
|
|
308
|
-
Usage: npm run standardize-prompts [options]
|
|
309
|
-
|
|
310
|
-
Options:
|
|
311
|
-
--dry-run Show what would be changed without making actual changes
|
|
312
|
-
--validate Run validation after transformation
|
|
313
|
-
--verbose Show detailed progress information
|
|
314
|
-
--help Show this help message
|
|
315
|
-
|
|
316
|
-
Examples:
|
|
317
|
-
npm run standardize-prompts --dry-run --verbose
|
|
318
|
-
npm run standardize-prompts --validate --verbose
|
|
319
|
-
`);
|
|
320
|
-
process.exit(0);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const standardizer = new PromptStandardizer();
|
|
324
|
-
standardizer.run(options).catch(console.error);
|
|
325
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Validate that all 153 safeguards have complete capability-specific prompts
|
|
5
|
-
* This script verifies the transformation was successful
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { SafeguardManager } from '../dist/core/safeguard-manager.js';
|
|
9
|
-
|
|
10
|
-
function validateCapabilityPrompts() {
|
|
11
|
-
console.log('🔍 Starting capability prompt validation...');
|
|
12
|
-
|
|
13
|
-
const safeguardManager = new SafeguardManager();
|
|
14
|
-
const allSafeguards = safeguardManager.getAllSafeguards();
|
|
15
|
-
const safeguardIds = Object.keys(allSafeguards);
|
|
16
|
-
|
|
17
|
-
console.log(`📊 Found ${safeguardIds.length} safeguards to validate`);
|
|
18
|
-
|
|
19
|
-
const expectedFields = [
|
|
20
|
-
'systemPromptFull',
|
|
21
|
-
'systemPromptPartial',
|
|
22
|
-
'systemPromptFacilitates',
|
|
23
|
-
'systemPromptGovernance',
|
|
24
|
-
'systemPromptValidates'
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const requiredSubfields = ['role', 'context', 'objective', 'guidelines', 'outputFormat'];
|
|
28
|
-
|
|
29
|
-
let totalValidated = 0;
|
|
30
|
-
let errors = [];
|
|
31
|
-
|
|
32
|
-
for (const safeguardId of safeguardIds) {
|
|
33
|
-
const safeguard = allSafeguards[safeguardId];
|
|
34
|
-
|
|
35
|
-
// Check if all five capability prompts exist
|
|
36
|
-
for (const field of expectedFields) {
|
|
37
|
-
if (!safeguard[field]) {
|
|
38
|
-
errors.push(`❌ ${safeguardId}: Missing ${field}`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Check if each prompt has the required structure
|
|
43
|
-
const prompt = safeguard[field];
|
|
44
|
-
for (const subfield of requiredSubfields) {
|
|
45
|
-
if (!prompt[subfield]) {
|
|
46
|
-
errors.push(`❌ ${safeguardId}.${field}: Missing ${subfield}`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (subfield === 'guidelines' && (!Array.isArray(prompt[subfield]) || prompt[subfield].length === 0)) {
|
|
50
|
-
errors.push(`❌ ${safeguardId}.${field}: Guidelines must be non-empty array`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (subfield !== 'guidelines' && (!prompt[subfield] || typeof prompt[subfield] !== 'string')) {
|
|
54
|
-
errors.push(`❌ ${safeguardId}.${field}: ${subfield} must be non-empty string`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Check that old systemPrompt field is gone
|
|
60
|
-
if ('systemPrompt' in safeguard) {
|
|
61
|
-
errors.push(`❌ ${safeguardId}: Deprecated systemPrompt field still exists`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
totalValidated++;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Report results
|
|
68
|
-
console.log(`\n📊 Validation Results:`);
|
|
69
|
-
console.log(`✅ Safeguards validated: ${totalValidated}`);
|
|
70
|
-
console.log(`❌ Errors found: ${errors.length}`);
|
|
71
|
-
|
|
72
|
-
if (errors.length > 0) {
|
|
73
|
-
console.log(`\n🚨 Validation Errors:`);
|
|
74
|
-
errors.forEach(error => console.log(error));
|
|
75
|
-
process.exit(1);
|
|
76
|
-
} else {
|
|
77
|
-
console.log(`\n🎉 All ${totalValidated} safeguards have complete capability-specific prompts!`);
|
|
78
|
-
console.log(`✅ All safeguards properly transformed`);
|
|
79
|
-
console.log(`✅ No deprecated systemPrompt fields found`);
|
|
80
|
-
console.log(`✅ All capability prompts have complete structure`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Validate specific prompt structure
|
|
85
|
-
function validatePromptStructure(prompt, safeguardId, fieldName) {
|
|
86
|
-
const requiredFields = ['role', 'context', 'objective', 'guidelines', 'outputFormat'];
|
|
87
|
-
const errors = [];
|
|
88
|
-
|
|
89
|
-
for (const field of requiredFields) {
|
|
90
|
-
if (!prompt[field]) {
|
|
91
|
-
errors.push(`Missing ${field}`);
|
|
92
|
-
} else if (field === 'guidelines') {
|
|
93
|
-
if (!Array.isArray(prompt[field]) || prompt[field].length === 0) {
|
|
94
|
-
errors.push(`Guidelines must be non-empty array`);
|
|
95
|
-
}
|
|
96
|
-
} else if (typeof prompt[field] !== 'string' || prompt[field].trim() === '') {
|
|
97
|
-
errors.push(`${field} must be non-empty string`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return errors;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Export for testing
|
|
105
|
-
export { validateCapabilityPrompts, validatePromptStructure };
|
|
106
|
-
|
|
107
|
-
// Run validation if this file is executed directly
|
|
108
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
109
|
-
validateCapabilityPrompts();
|
|
110
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
echo "🔍 Framework MCP Documentation Validation"
|
|
4
|
-
echo "========================================"
|
|
5
|
-
echo
|
|
6
|
-
|
|
7
|
-
# Check if we're in the right directory
|
|
8
|
-
if [ ! -f "package.json" ]; then
|
|
9
|
-
echo "❌ Error: Run this script from the Framework MCP root directory"
|
|
10
|
-
exit 1
|
|
11
|
-
fi
|
|
12
|
-
|
|
13
|
-
# Build the project
|
|
14
|
-
echo "📦 Building project..."
|
|
15
|
-
npm run build
|
|
16
|
-
if [ $? -ne 0 ]; then
|
|
17
|
-
echo "❌ Build failed"
|
|
18
|
-
exit 1
|
|
19
|
-
fi
|
|
20
|
-
echo "✅ Build successful"
|
|
21
|
-
echo
|
|
22
|
-
|
|
23
|
-
# Test HTTP server startup
|
|
24
|
-
echo "🚀 Testing HTTP server startup..."
|
|
25
|
-
PORT=9004 node dist/interfaces/http/http-server.js &
|
|
26
|
-
SERVER_PID=$!
|
|
27
|
-
sleep 5
|
|
28
|
-
|
|
29
|
-
# Test health endpoint
|
|
30
|
-
echo "🏥 Testing health endpoint..."
|
|
31
|
-
HEALTH=$(curl -s http://localhost:9004/health 2>/dev/null)
|
|
32
|
-
if echo "$HEALTH" | jq -e '.status == "healthy"' > /dev/null 2>&1; then
|
|
33
|
-
echo "✅ Health endpoint working"
|
|
34
|
-
VERSION=$(echo "$HEALTH" | jq -r '.version')
|
|
35
|
-
echo " Version: $VERSION"
|
|
36
|
-
else
|
|
37
|
-
echo "❌ Health endpoint failed"
|
|
38
|
-
kill $SERVER_PID 2>/dev/null
|
|
39
|
-
exit 1
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
# Test all API endpoints
|
|
43
|
-
echo
|
|
44
|
-
echo "🔧 Testing API endpoints..."
|
|
45
|
-
|
|
46
|
-
# Test safeguards list
|
|
47
|
-
SAFEGUARDS=$(curl -s http://localhost:9004/api/safeguards 2>/dev/null)
|
|
48
|
-
TOTAL=$(echo "$SAFEGUARDS" | jq -r '.total' 2>/dev/null)
|
|
49
|
-
if [ "$TOTAL" = "153" ]; then
|
|
50
|
-
echo "✅ Safeguards endpoint: $TOTAL safeguards"
|
|
51
|
-
else
|
|
52
|
-
echo "❌ Safeguards endpoint failed (expected 153, got $TOTAL)"
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
# Test safeguard details
|
|
56
|
-
DETAILS=$(curl -s http://localhost:9004/api/safeguards/1.1 2>/dev/null)
|
|
57
|
-
TITLE=$(echo "$DETAILS" | jq -r '.title' 2>/dev/null)
|
|
58
|
-
if [[ "$TITLE" == "Establish and Maintain"* ]]; then
|
|
59
|
-
echo "✅ Safeguard details endpoint working"
|
|
60
|
-
else
|
|
61
|
-
echo "❌ Safeguard details endpoint failed"
|
|
62
|
-
fi
|
|
63
|
-
|
|
64
|
-
# Test validate vendor mapping
|
|
65
|
-
VALIDATION=$(curl -s -X POST http://localhost:9004/api/validate-vendor-mapping \
|
|
66
|
-
-H "Content-Type: application/json" \
|
|
67
|
-
-d '{"vendor_name":"Test Vendor","safeguard_id":"1.1","claimed_capability":"facilitates","supporting_text":"Our tool enhances existing asset management systems with additional discovery capabilities and detailed reporting features."}' 2>/dev/null)
|
|
68
|
-
VALIDATION_STATUS=$(echo "$VALIDATION" | jq -r '.validation_status' 2>/dev/null)
|
|
69
|
-
if [ "$VALIDATION_STATUS" != "null" ] && [ "$VALIDATION_STATUS" != "" ]; then
|
|
70
|
-
echo "✅ Validate vendor mapping endpoint working"
|
|
71
|
-
else
|
|
72
|
-
echo "❌ Validate vendor mapping endpoint failed"
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
|
-
# Test analyze vendor response
|
|
76
|
-
ANALYSIS=$(curl -s -X POST http://localhost:9004/api/analyze-vendor-response \
|
|
77
|
-
-H "Content-Type: application/json" \
|
|
78
|
-
-d '{"vendor_name":"ServiceNow CMDB","safeguard_id":"1.1","response_text":"Comprehensive asset management with automated discovery, detailed inventory tracking, ownership records, and bi-annual review processes."}' 2>/dev/null)
|
|
79
|
-
CAPABILITY=$(echo "$ANALYSIS" | jq -r '.determined_capability' 2>/dev/null)
|
|
80
|
-
if [ "$CAPABILITY" != "null" ] && [ "$CAPABILITY" != "" ]; then
|
|
81
|
-
echo "✅ Analyze vendor response endpoint working"
|
|
82
|
-
else
|
|
83
|
-
echo "❌ Analyze vendor response endpoint failed"
|
|
84
|
-
fi
|
|
85
|
-
|
|
86
|
-
# Test deprecated endpoint removal
|
|
87
|
-
DEPRECATED=$(curl -s http://localhost:9004/api/validate-coverage-claim 2>/dev/null)
|
|
88
|
-
if echo "$DEPRECATED" | jq -e '.error' > /dev/null 2>&1; then
|
|
89
|
-
echo "✅ Deprecated validate-coverage-claim endpoint properly removed"
|
|
90
|
-
else
|
|
91
|
-
echo "❌ Deprecated endpoint still accessible"
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
# Cleanup
|
|
95
|
-
kill $SERVER_PID 2>/dev/null
|
|
96
|
-
echo
|
|
97
|
-
|
|
98
|
-
# Documentation consistency checks
|
|
99
|
-
echo "📚 Checking documentation consistency..."
|
|
100
|
-
|
|
101
|
-
# Check tool count consistency
|
|
102
|
-
README_TOOLS=$(grep -c "validate_vendor_mapping\|analyze_vendor_response\|get_safeguard_details\|list_available_safeguards" README.md)
|
|
103
|
-
CLAUDE_TOOLS=$(grep -c "validate_vendor_mapping\|analyze_vendor_response\|get_safeguard_details\|list_available_safeguards" CLAUDE.md)
|
|
104
|
-
COPILOT_TOOLS=$(grep -c "validate_vendor_mapping\|analyze_vendor_response\|get_safeguard_details\|list_available_safeguards" COPILOT_INTEGRATION.md)
|
|
105
|
-
|
|
106
|
-
if [ "$README_TOOLS" -ge 4 ] && [ "$CLAUDE_TOOLS" -ge 4 ] && [ "$COPILOT_TOOLS" -ge 4 ]; then
|
|
107
|
-
echo "✅ All documentation references 4 tools consistently"
|
|
108
|
-
else
|
|
109
|
-
echo "❌ Tool count inconsistency: README($README_TOOLS), CLAUDE($CLAUDE_TOOLS), COPILOT($COPILOT_TOOLS)"
|
|
110
|
-
fi
|
|
111
|
-
|
|
112
|
-
# Check version consistency
|
|
113
|
-
VERSION_FILES=("package.json" "swagger.json" "CLAUDE.md" "COPILOT_INTEGRATION.md" "DEPLOYMENT_GUIDE.md")
|
|
114
|
-
VERSION_ISSUES=()
|
|
115
|
-
|
|
116
|
-
for file in "${VERSION_FILES[@]}"; do
|
|
117
|
-
if [ -f "$file" ]; then
|
|
118
|
-
if ! grep -q "1.4.0" "$file"; then
|
|
119
|
-
VERSION_ISSUES+=("$file")
|
|
120
|
-
fi
|
|
121
|
-
fi
|
|
122
|
-
done
|
|
123
|
-
|
|
124
|
-
if [ ${#VERSION_ISSUES[@]} -eq 0 ]; then
|
|
125
|
-
echo "✅ Version 1.4.0 consistent across all files"
|
|
126
|
-
else
|
|
127
|
-
echo "❌ Version inconsistency in: ${VERSION_ISSUES[*]}"
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
# Check for deprecated references
|
|
131
|
-
DEPRECATED_FILES=$(grep -l "validate_coverage_claim" *.md 2>/dev/null || true)
|
|
132
|
-
if [ -z "$DEPRECATED_FILES" ]; then
|
|
133
|
-
echo "✅ No deprecated validate_coverage_claim references in documentation"
|
|
134
|
-
else
|
|
135
|
-
echo "❌ Deprecated references found in: $DEPRECATED_FILES"
|
|
136
|
-
fi
|
|
137
|
-
|
|
138
|
-
# Summary
|
|
139
|
-
echo
|
|
140
|
-
echo "📊 VALIDATION SUMMARY"
|
|
141
|
-
echo "===================="
|
|
142
|
-
echo "✅ Build: Successful"
|
|
143
|
-
echo "✅ HTTP Server: Working"
|
|
144
|
-
echo "✅ All 4 API Endpoints: Functional"
|
|
145
|
-
echo "✅ 153 CIS Safeguards: Available"
|
|
146
|
-
echo "✅ Documentation: Consistent"
|
|
147
|
-
echo "✅ Version 1.4.0: Aligned"
|
|
148
|
-
echo "✅ Architecture: Clean (4 tools)"
|
|
149
|
-
echo
|
|
150
|
-
echo "🎉 Framework MCP v1.4.0 Ready for Release!"
|