framework-mcp 1.5.2 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.claude/commands/speckit.analyze.md +184 -0
  2. package/.claude/commands/speckit.checklist.md +294 -0
  3. package/.claude/commands/speckit.clarify.md +181 -0
  4. package/.claude/commands/speckit.constitution.md +82 -0
  5. package/.claude/commands/speckit.implement.md +135 -0
  6. package/.claude/commands/speckit.plan.md +89 -0
  7. package/.claude/commands/speckit.specify.md +258 -0
  8. package/.claude/commands/speckit.tasks.md +137 -0
  9. package/.claude/commands/speckit.taskstoissues.md +30 -0
  10. package/.do/app.yaml +1 -1
  11. package/.github/dependabot.yml +15 -0
  12. package/.github/workflows/ci.yml +19 -1
  13. package/.specify/memory/constitution.md +50 -0
  14. package/.specify/scripts/bash/check-prerequisites.sh +166 -0
  15. package/.specify/scripts/bash/common.sh +156 -0
  16. package/.specify/scripts/bash/create-new-feature.sh +297 -0
  17. package/.specify/scripts/bash/setup-plan.sh +61 -0
  18. package/.specify/scripts/bash/update-agent-context.sh +799 -0
  19. package/.specify/templates/agent-file-template.md +28 -0
  20. package/.specify/templates/checklist-template.md +40 -0
  21. package/.specify/templates/plan-template.md +104 -0
  22. package/.specify/templates/spec-template.md +115 -0
  23. package/.specify/templates/tasks-template.md +251 -0
  24. package/README.md +84 -435
  25. package/dist/core/safeguard-manager.d.ts.map +1 -1
  26. package/dist/core/safeguard-manager.js +7295 -2700
  27. package/dist/core/safeguard-manager.js.map +1 -1
  28. package/dist/interfaces/http/http-server.d.ts +2 -0
  29. package/dist/interfaces/http/http-server.d.ts.map +1 -1
  30. package/dist/interfaces/http/http-server.js +95 -3
  31. package/dist/interfaces/http/http-server.js.map +1 -1
  32. package/dist/interfaces/mcp/mcp-server.js +3 -3
  33. package/dist/shared/types.d.ts +85 -2
  34. package/dist/shared/types.d.ts.map +1 -1
  35. package/dist/shared/types.js +132 -1
  36. package/dist/shared/types.js.map +1 -1
  37. package/package.json +7 -4
  38. package/scripts/standardize-prompts.js +325 -0
  39. package/scripts/validate-capability-prompts.js +110 -0
  40. package/src/core/safeguard-manager.ts +12376 -2586
  41. package/src/interfaces/http/http-server.ts +109 -4
  42. package/src/interfaces/mcp/mcp-server.ts +3 -3
  43. package/src/shared/types.ts +268 -2
  44. package/swagger.json +58 -38
  45. package/CAPABILITY_TRANSFORMATION_SUMMARY.md +0 -158
  46. package/CIS_CONTROLS_IMPLEMENTATION_PLAN.md +0 -220
  47. package/COPILOT_INTEGRATION.md +0 -322
  48. package/DAYS_5_6_COMPLETION_SUMMARY.md +0 -178
  49. package/DEPLOYMENT_GUIDE.md +0 -334
  50. package/DEPLOYMENT_SUMMARY_v1.1.3.md +0 -211
  51. package/MCP_INTEGRATION_GUIDE.md +0 -285
  52. package/MIGRATION_GUIDE_v1.4.0.md +0 -190
  53. package/RELEASE_NOTES_v1.1.3.md +0 -321
  54. package/RELEASE_NOTES_v1.2.0.md +0 -396
  55. package/RELEASE_NOTES_v1.3.7.md +0 -275
  56. package/RELEASE_NOTES_v1.4.0.md +0 -178
  57. package/SAFEGUARDS_VERIFICATION_LOG.md +0 -157
  58. package/coordinator-bot-compact.txt +0 -33
  59. package/coordinator-bot-system-prompt.md +0 -192
  60. package/docs/installation.md +0 -71
  61. package/scripts/analyze-data-structure.cjs +0 -74
  62. package/scripts/clean-safeguards-data.cjs +0 -60
  63. package/scripts/comprehensive-validation.cjs +0 -176
  64. package/scripts/count-safeguards.cjs +0 -89
  65. package/scripts/format-safeguards-proper.cjs +0 -44
  66. package/scripts/validate-formatted-data.cjs +0 -88
  67. package/test_capability_integration.js +0 -73
  68. package/test_comprehensive_scenarios.js +0 -192
  69. package/test_enhanced_detection.js +0 -74
  70. package/test_integrated_validation.js +0 -112
  71. package/test_language_update.js +0 -101
  72. package/test_live_validation.json +0 -12
  73. package/test_performance_monitoring.js +0 -124
  74. package/test_runner_automated.js +0 -156
  75. package/test_suite_comprehensive.js +0 -218
@@ -0,0 +1,325 @@
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
+ }
@@ -0,0 +1,110 @@
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
+ }