snow-flow 8.4.42 → 8.4.44
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/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +56 -60
- package/dist/cli/auth.js.map +1 -1
- package/dist/utils/snow-oauth.d.ts +10 -5
- package/dist/utils/snow-oauth.d.ts.map +1 -1
- package/dist/utils/snow-oauth.js +223 -86
- package/dist/utils/snow-oauth.js.map +1 -1
- package/package.json +1 -1
- package/THEMES.md +0 -223
- package/dist/mcp/servicenow-mcp-unified/config/tool-definitions.json +0 -3935
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_automation_discover.js +0 -164
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_artifact_transfer.js +0 -282
- package/dist/mcp/servicenow-mcp-unified/tools/filters/snow_build_filter.js +0 -171
- package/dist/mcp/servicenow-mcp-unified/tools/formatters/snow_format_value.js +0 -164
- package/dist/mcp/servicenow-mcp-unified/tools/knowledge/index.js.bak +0 -45
- package/dist/mcp/servicenow-mcp-unified/tools/local-sync/snow_artifact_sync.js +0 -172
- package/dist/mcp/servicenow-mcp-unified/tools/system-properties/index.js +0 -36
- package/dist/mcp/servicenow-mcp-unified/tools/ui-builder/snow_discover_uib.js +0 -296
- package/dist/mcp/servicenow-mcp-unified/tools/workspace/snow_create_ux_component.js +0 -292
- package/dist/memory/session-memory.d.ts +0 -80
- package/dist/memory/session-memory.d.ts.map +0 -1
- package/dist/memory/session-memory.js +0 -468
- package/dist/memory/session-memory.js.map +0 -1
- package/dist/templates/opencode-agents-template.d.ts +0 -2
- package/dist/templates/opencode-agents-template.d.ts.map +0 -1
- package/dist/templates/opencode-agents-template.js +0 -469
- package/dist/templates/opencode-agents-template.js.map +0 -1
- package/dist/utils/opencode-output-interceptor.d.ts +0 -40
- package/dist/utils/opencode-output-interceptor.d.ts.map +0 -1
- package/dist/utils/opencode-output-interceptor.js +0 -258
- package/dist/utils/opencode-output-interceptor.js.map +0 -1
- package/scripts/bulk-optimize-tools.js +0 -486
- package/scripts/optimize-mcp-tools.ts +0 -410
- package/themes/README.md +0 -83
- package/themes/servicenow.json +0 -117
|
@@ -1,410 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
/**
|
|
3
|
-
* MCP Tool Optimization Script
|
|
4
|
-
*
|
|
5
|
-
* Systematically optimizes all MCP tool definitions:
|
|
6
|
-
* 1. Compress verbose descriptions
|
|
7
|
-
* 2. Add categorization metadata
|
|
8
|
-
* 3. Calculate token savings
|
|
9
|
-
* 4. Validate all changes
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import * as fs from 'fs';
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
|
|
15
|
-
// ============================================================================
|
|
16
|
-
// CONFIGURATION
|
|
17
|
-
// ============================================================================
|
|
18
|
-
|
|
19
|
-
const TOOL_DIRS = [
|
|
20
|
-
'dist/mcp/servicenow-mcp-unified/tools',
|
|
21
|
-
'dist/mcp/snow-flow/tools'
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
const OPTIMIZATION_RULES = {
|
|
25
|
-
maxDescriptionWords: 8,
|
|
26
|
-
maxPropertyDescWords: 5,
|
|
27
|
-
removePatterns: [
|
|
28
|
-
/Executes all \d+ steps automatically:/,
|
|
29
|
-
/with automatic/,
|
|
30
|
-
/comprehensive/,
|
|
31
|
-
/advanced/,
|
|
32
|
-
/flexible/,
|
|
33
|
-
/powerful/,
|
|
34
|
-
/complete/,
|
|
35
|
-
/full support for/,
|
|
36
|
-
/provides capability to/,
|
|
37
|
-
/allows you to/,
|
|
38
|
-
/enables/
|
|
39
|
-
],
|
|
40
|
-
replacements: {
|
|
41
|
-
'Create a new': 'Create',
|
|
42
|
-
'Update an existing': 'Update',
|
|
43
|
-
'Delete an existing': 'Delete',
|
|
44
|
-
'Query for': 'Query',
|
|
45
|
-
'Search for': 'Search',
|
|
46
|
-
'Retrieve information about': 'Get',
|
|
47
|
-
'with filtering and pagination': ': filter, paginate',
|
|
48
|
-
'with role-based access control': 'with RBAC',
|
|
49
|
-
'Now Experience Framework': 'UX',
|
|
50
|
-
'UI Builder': 'UIB',
|
|
51
|
-
'Service Portal': 'SP',
|
|
52
|
-
'Configuration Management Database': 'CMDB'
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
// ============================================================================
|
|
57
|
-
// METADATA TAXONOMY
|
|
58
|
-
// ============================================================================
|
|
59
|
-
|
|
60
|
-
interface ToolMetadata {
|
|
61
|
-
category: string;
|
|
62
|
-
subcategory: string;
|
|
63
|
-
use_cases: string[];
|
|
64
|
-
complexity: 'beginner' | 'intermediate' | 'advanced' | 'expert';
|
|
65
|
-
frequency: 'very-high' | 'high' | 'medium' | 'low';
|
|
66
|
-
related_tools?: string[];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const CATEGORY_MAPPING: Record<string, ToolMetadata> = {
|
|
70
|
-
// Core Operations
|
|
71
|
-
'operations/snow_query_table': {
|
|
72
|
-
category: 'core-operations',
|
|
73
|
-
subcategory: 'query',
|
|
74
|
-
use_cases: ['data-retrieval', 'reporting', 'analysis'],
|
|
75
|
-
complexity: 'beginner',
|
|
76
|
-
frequency: 'very-high'
|
|
77
|
-
},
|
|
78
|
-
'operations/snow_create_record': {
|
|
79
|
-
category: 'core-operations',
|
|
80
|
-
subcategory: 'crud',
|
|
81
|
-
use_cases: ['data-creation', 'automation'],
|
|
82
|
-
complexity: 'beginner',
|
|
83
|
-
frequency: 'very-high'
|
|
84
|
-
},
|
|
85
|
-
'operations/snow_update_record': {
|
|
86
|
-
category: 'core-operations',
|
|
87
|
-
subcategory: 'crud',
|
|
88
|
-
use_cases: ['data-modification', 'automation'],
|
|
89
|
-
complexity: 'beginner',
|
|
90
|
-
frequency: 'very-high'
|
|
91
|
-
},
|
|
92
|
-
'operations/snow_delete_record': {
|
|
93
|
-
category: 'core-operations',
|
|
94
|
-
subcategory: 'crud',
|
|
95
|
-
use_cases: ['data-cleanup', 'maintenance'],
|
|
96
|
-
complexity: 'intermediate',
|
|
97
|
-
frequency: 'high'
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
// UI Builder
|
|
101
|
-
'ui-builder/snow_create_uib_page': {
|
|
102
|
-
category: 'ui-frameworks',
|
|
103
|
-
subcategory: 'ui-builder-pages',
|
|
104
|
-
use_cases: ['workspace', 'portal', 'app-development'],
|
|
105
|
-
complexity: 'intermediate',
|
|
106
|
-
frequency: 'high',
|
|
107
|
-
related_tools: ['snow_add_uib_page_element', 'snow_create_uib_data_broker']
|
|
108
|
-
},
|
|
109
|
-
'ui-builder/snow_add_uib_page_element': {
|
|
110
|
-
category: 'ui-frameworks',
|
|
111
|
-
subcategory: 'ui-builder-components',
|
|
112
|
-
use_cases: ['ui-composition', 'layout'],
|
|
113
|
-
complexity: 'intermediate',
|
|
114
|
-
frequency: 'high'
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// Workspace
|
|
118
|
-
'workspace/snow_create_complete_workspace': {
|
|
119
|
-
category: 'ui-frameworks',
|
|
120
|
-
subcategory: 'workspace',
|
|
121
|
-
use_cases: ['agent-workspace', 'ux-framework'],
|
|
122
|
-
complexity: 'intermediate',
|
|
123
|
-
frequency: 'high',
|
|
124
|
-
related_tools: ['snow_create_uib_page', 'snow_create_ux_app_route']
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
// Update Sets
|
|
128
|
-
'update-sets/snow_update_set_create': {
|
|
129
|
-
category: 'development',
|
|
130
|
-
subcategory: 'update-sets',
|
|
131
|
-
use_cases: ['change-tracking', 'deployment'],
|
|
132
|
-
complexity: 'beginner',
|
|
133
|
-
frequency: 'very-high'
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
// Automation
|
|
137
|
-
'automation/snow_execute_script_with_output': {
|
|
138
|
-
category: 'automation',
|
|
139
|
-
subcategory: 'script-execution',
|
|
140
|
-
use_cases: ['testing', 'debugging', 'automation'],
|
|
141
|
-
complexity: 'intermediate',
|
|
142
|
-
frequency: 'very-high'
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
// Auto-infer metadata from directory structure
|
|
147
|
-
function inferMetadata(toolPath: string): ToolMetadata {
|
|
148
|
-
const dirName = path.dirname(toolPath).split('/').pop() || '';
|
|
149
|
-
const fileName = path.basename(toolPath, '.js');
|
|
150
|
-
|
|
151
|
-
// Try exact match first
|
|
152
|
-
const key = `${dirName}/${fileName}`;
|
|
153
|
-
if (CATEGORY_MAPPING[key]) {
|
|
154
|
-
return CATEGORY_MAPPING[key];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Infer from directory name
|
|
158
|
-
const categoryMap: Record<string, { category: string, subcategory: string, complexity: ToolMetadata['complexity'], frequency: ToolMetadata['frequency'] }> = {
|
|
159
|
-
'operations': { category: 'core-operations', subcategory: 'general', complexity: 'beginner', frequency: 'very-high' },
|
|
160
|
-
'ui-builder': { category: 'ui-frameworks', subcategory: 'ui-builder', complexity: 'intermediate', frequency: 'high' },
|
|
161
|
-
'workspace': { category: 'ui-frameworks', subcategory: 'workspace', complexity: 'intermediate', frequency: 'high' },
|
|
162
|
-
'service-portal': { category: 'ui-frameworks', subcategory: 'service-portal', complexity: 'intermediate', frequency: 'medium' },
|
|
163
|
-
'update-sets': { category: 'development', subcategory: 'update-sets', complexity: 'beginner', frequency: 'very-high' },
|
|
164
|
-
'deployment': { category: 'development', subcategory: 'deployment', complexity: 'intermediate', frequency: 'high' },
|
|
165
|
-
'automation': { category: 'automation', subcategory: 'script-execution', complexity: 'intermediate', frequency: 'high' },
|
|
166
|
-
'integration': { category: 'integration', subcategory: 'rest-soap', complexity: 'advanced', frequency: 'medium' },
|
|
167
|
-
'cmdb': { category: 'cmdb', subcategory: 'ci-management', complexity: 'intermediate', frequency: 'medium' },
|
|
168
|
-
'knowledge': { category: 'itsm', subcategory: 'knowledge', complexity: 'beginner', frequency: 'medium' },
|
|
169
|
-
'change': { category: 'itsm', subcategory: 'change', complexity: 'intermediate', frequency: 'high' },
|
|
170
|
-
'predictive-intelligence': { category: 'ml-analytics', subcategory: 'predictive-intelligence', complexity: 'advanced', frequency: 'medium' },
|
|
171
|
-
'performance-analytics': { category: 'ml-analytics', subcategory: 'performance-analytics', complexity: 'intermediate', frequency: 'medium' },
|
|
172
|
-
'flow-designer': { category: 'automation', subcategory: 'flow-designer', complexity: 'intermediate', frequency: 'medium' },
|
|
173
|
-
'local-sync': { category: 'development', subcategory: 'local-sync', complexity: 'intermediate', frequency: 'high' },
|
|
174
|
-
'system-properties': { category: 'core-operations', subcategory: 'properties', complexity: 'beginner', frequency: 'high' }
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const inferred = categoryMap[dirName] || {
|
|
178
|
-
category: 'advanced',
|
|
179
|
-
subcategory: 'specialized',
|
|
180
|
-
complexity: 'intermediate',
|
|
181
|
-
frequency: 'low'
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
...inferred,
|
|
186
|
-
use_cases: [dirName.replace(/-/g, '_')]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// ============================================================================
|
|
191
|
-
// DESCRIPTION OPTIMIZATION
|
|
192
|
-
// ============================================================================
|
|
193
|
-
|
|
194
|
-
function optimizeDescription(description: string): string {
|
|
195
|
-
let optimized = description;
|
|
196
|
-
|
|
197
|
-
// Apply removal patterns
|
|
198
|
-
OPTIMIZATION_RULES.removePatterns.forEach(pattern => {
|
|
199
|
-
optimized = optimized.replace(pattern, '');
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// Apply replacements
|
|
203
|
-
Object.entries(OPTIMIZATION_RULES.replacements).forEach(([from, to]) => {
|
|
204
|
-
optimized = optimized.replace(new RegExp(from, 'g'), to);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// Remove redundant whitespace
|
|
208
|
-
optimized = optimized.replace(/\s+/g, ' ').trim();
|
|
209
|
-
|
|
210
|
-
// Truncate to max words if needed
|
|
211
|
-
const words = optimized.split(' ');
|
|
212
|
-
if (words.length > OPTIMIZATION_RULES.maxDescriptionWords) {
|
|
213
|
-
optimized = words.slice(0, OPTIMIZATION_RULES.maxDescriptionWords).join(' ');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return optimized;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function optimizePropertyDescription(description: string): string {
|
|
220
|
-
let optimized = description;
|
|
221
|
-
|
|
222
|
-
// Remove common redundant phrases
|
|
223
|
-
optimized = optimized
|
|
224
|
-
.replace(/^The /, '')
|
|
225
|
-
.replace(/ \(optional\)$/, '')
|
|
226
|
-
.replace(/ to use$/, '')
|
|
227
|
-
.replace(/ for the /, ' for ')
|
|
228
|
-
.replace(/ of the /, ' of ');
|
|
229
|
-
|
|
230
|
-
// Truncate to max words
|
|
231
|
-
const words = optimized.split(' ');
|
|
232
|
-
if (words.length > OPTIMIZATION_RULES.maxPropertyDescWords) {
|
|
233
|
-
optimized = words.slice(0, OPTIMIZATION_RULES.maxPropertyDescWords).join(' ');
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return optimized;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// ============================================================================
|
|
240
|
-
// TOKEN ESTIMATION
|
|
241
|
-
// ============================================================================
|
|
242
|
-
|
|
243
|
-
function estimateTokens(text: string): number {
|
|
244
|
-
// Rough estimation: 1 token ≈ 4 characters for English
|
|
245
|
-
return Math.ceil(text.length / 4);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function estimateToolTokens(toolDef: any): number {
|
|
249
|
-
let total = 0;
|
|
250
|
-
|
|
251
|
-
// Name
|
|
252
|
-
total += estimateTokens(toolDef.name);
|
|
253
|
-
|
|
254
|
-
// Description
|
|
255
|
-
total += estimateTokens(toolDef.description);
|
|
256
|
-
|
|
257
|
-
// Input schema
|
|
258
|
-
if (toolDef.inputSchema) {
|
|
259
|
-
total += estimateTokens(JSON.stringify(toolDef.inputSchema));
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return total;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// ============================================================================
|
|
266
|
-
// FILE PROCESSING
|
|
267
|
-
// ============================================================================
|
|
268
|
-
|
|
269
|
-
interface OptimizationResult {
|
|
270
|
-
file: string;
|
|
271
|
-
originalTokens: number;
|
|
272
|
-
optimizedTokens: number;
|
|
273
|
-
savings: number;
|
|
274
|
-
metadata: ToolMetadata;
|
|
275
|
-
changes: string[];
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async function processToolFile(filePath: string): Promise<OptimizationResult | null> {
|
|
279
|
-
try {
|
|
280
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
281
|
-
|
|
282
|
-
// Skip if not a tool file
|
|
283
|
-
if (!content.includes('toolDefinition') || content.includes('index.js')) {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Extract current tool definition (regex-based parsing)
|
|
288
|
-
const toolDefMatch = content.match(/exports\.toolDefinition\s*=\s*({[\s\S]*?});/);
|
|
289
|
-
if (!toolDefMatch) {
|
|
290
|
-
console.warn(`⚠️ Could not parse toolDefinition in ${filePath}`);
|
|
291
|
-
return null;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// This is a simplified approach - in real implementation we'd use proper AST parsing
|
|
295
|
-
// For now, we'll return a placeholder result
|
|
296
|
-
const relativePath = path.relative(process.cwd(), filePath);
|
|
297
|
-
const metadata = inferMetadata(relativePath);
|
|
298
|
-
|
|
299
|
-
const result: OptimizationResult = {
|
|
300
|
-
file: relativePath,
|
|
301
|
-
originalTokens: 60, // Will calculate properly
|
|
302
|
-
optimizedTokens: 35, // Will calculate properly
|
|
303
|
-
savings: 25,
|
|
304
|
-
metadata,
|
|
305
|
-
changes: [
|
|
306
|
-
'Description optimized',
|
|
307
|
-
'Metadata added',
|
|
308
|
-
'Property descriptions compressed'
|
|
309
|
-
]
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
return result;
|
|
313
|
-
|
|
314
|
-
} catch (error) {
|
|
315
|
-
console.error(`❌ Error processing ${filePath}:`, error);
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// ============================================================================
|
|
321
|
-
// MAIN EXECUTION
|
|
322
|
-
// ============================================================================
|
|
323
|
-
|
|
324
|
-
async function main() {
|
|
325
|
-
console.log('🚀 Starting MCP Tool Optimization...\n');
|
|
326
|
-
|
|
327
|
-
const allResults: OptimizationResult[] = [];
|
|
328
|
-
let totalOriginalTokens = 0;
|
|
329
|
-
let totalOptimizedTokens = 0;
|
|
330
|
-
|
|
331
|
-
for (const toolDir of TOOL_DIRS) {
|
|
332
|
-
const fullPath = path.join(process.cwd(), toolDir);
|
|
333
|
-
|
|
334
|
-
if (!fs.existsSync(fullPath)) {
|
|
335
|
-
console.warn(`⚠️ Directory not found: ${toolDir}`);
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
console.log(`📁 Processing: ${toolDir}`);
|
|
340
|
-
|
|
341
|
-
// Recursively find all .js files
|
|
342
|
-
const files = findJsFiles(fullPath);
|
|
343
|
-
console.log(` Found ${files.length} tool files\n`);
|
|
344
|
-
|
|
345
|
-
for (const file of files) {
|
|
346
|
-
const result = await processToolFile(file);
|
|
347
|
-
if (result) {
|
|
348
|
-
allResults.push(result);
|
|
349
|
-
totalOriginalTokens += result.originalTokens;
|
|
350
|
-
totalOptimizedTokens += result.optimizedTokens;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
// Print summary
|
|
356
|
-
console.log('\n' + '='.repeat(80));
|
|
357
|
-
console.log('📊 OPTIMIZATION SUMMARY');
|
|
358
|
-
console.log('='.repeat(80));
|
|
359
|
-
console.log(`Total tools processed: ${allResults.length}`);
|
|
360
|
-
console.log(`Original tokens: ${totalOriginalTokens.toLocaleString()}`);
|
|
361
|
-
console.log(`Optimized tokens: ${totalOptimizedTokens.toLocaleString()}`);
|
|
362
|
-
console.log(`Total savings: ${(totalOriginalTokens - totalOptimizedTokens).toLocaleString()} tokens`);
|
|
363
|
-
console.log(`Reduction: ${((1 - totalOptimizedTokens / totalOriginalTokens) * 100).toFixed(1)}%`);
|
|
364
|
-
console.log('='.repeat(80));
|
|
365
|
-
|
|
366
|
-
// Save detailed report
|
|
367
|
-
const report = {
|
|
368
|
-
timestamp: new Date().toISOString(),
|
|
369
|
-
summary: {
|
|
370
|
-
totalTools: allResults.length,
|
|
371
|
-
originalTokens: totalOriginalTokens,
|
|
372
|
-
optimizedTokens: totalOptimizedTokens,
|
|
373
|
-
savings: totalOriginalTokens - totalOptimizedTokens,
|
|
374
|
-
reductionPercent: ((1 - totalOptimizedTokens / totalOriginalTokens) * 100).toFixed(1)
|
|
375
|
-
},
|
|
376
|
-
results: allResults
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
const reportPath = path.join(process.cwd(), 'docs/optimization-report.json');
|
|
380
|
-
fs.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
381
|
-
console.log(`\n✅ Detailed report saved to: ${reportPath}`);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function findJsFiles(dir: string): string[] {
|
|
385
|
-
const files: string[] = [];
|
|
386
|
-
|
|
387
|
-
function traverse(currentDir: string) {
|
|
388
|
-
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
389
|
-
|
|
390
|
-
for (const entry of entries) {
|
|
391
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
392
|
-
|
|
393
|
-
if (entry.isDirectory()) {
|
|
394
|
-
traverse(fullPath);
|
|
395
|
-
} else if (entry.isFile() && entry.name.endsWith('.js') && !entry.name.endsWith('.map')) {
|
|
396
|
-
files.push(fullPath);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
traverse(dir);
|
|
402
|
-
return files;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// Run if executed directly
|
|
406
|
-
if (require.main === module) {
|
|
407
|
-
main().catch(console.error);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export { optimizeDescription, optimizePropertyDescription, estimateTokens, inferMetadata };
|
package/themes/README.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# OpenCode Themes for Snow-Flow
|
|
2
|
-
|
|
3
|
-
## 🎨 ServiceNow Theme
|
|
4
|
-
|
|
5
|
-
The **servicenow.json** theme provides an authentic ServiceNow Now Platform experience with official color schemes.
|
|
6
|
-
|
|
7
|
-
### Features
|
|
8
|
-
|
|
9
|
-
- **Official ServiceNow Colors**: Uses the authentic ServiceNow blue (#0073CF) as primary color
|
|
10
|
-
- **Dark & Light Mode Support**: Automatically adapts to your system preferences
|
|
11
|
-
- **Optimized Syntax Highlighting**: ServiceNow-inspired colors for JavaScript, JSON, and other languages
|
|
12
|
-
- **Professional UI**: Clean, modern interface matching ServiceNow's design language
|
|
13
|
-
|
|
14
|
-
### Color Palette
|
|
15
|
-
|
|
16
|
-
| Color | Hex | Usage |
|
|
17
|
-
|-------|-----|-------|
|
|
18
|
-
| ServiceNow Blue | `#0073CF` | Primary actions, links, focus states |
|
|
19
|
-
| Teal | `#00B0B9` | Secondary actions, info states |
|
|
20
|
-
| Green | `#5BB85C` | Success states, added lines |
|
|
21
|
-
| Orange | `#FF8C2B` | Warnings, modified lines |
|
|
22
|
-
| Red | `#E53935` | Errors, removed lines |
|
|
23
|
-
| Purple | `#7E57C2` | Keywords, operators |
|
|
24
|
-
|
|
25
|
-
### Activation
|
|
26
|
-
|
|
27
|
-
The theme is automatically activated when you run OpenCode in the snow-flow-test-run directory.
|
|
28
|
-
|
|
29
|
-
To manually switch themes:
|
|
30
|
-
```bash
|
|
31
|
-
# Via OpenCode CLI
|
|
32
|
-
opencode --theme servicenow
|
|
33
|
-
|
|
34
|
-
# Or via config.json
|
|
35
|
-
{
|
|
36
|
-
"theme": "servicenow"
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Customization
|
|
41
|
-
|
|
42
|
-
To customize the theme, edit `servicenow.json`:
|
|
43
|
-
|
|
44
|
-
```json
|
|
45
|
-
{
|
|
46
|
-
"defs": {
|
|
47
|
-
"my_custom_color": "#FF6B6B"
|
|
48
|
-
},
|
|
49
|
-
"theme": {
|
|
50
|
-
"primary": "my_custom_color"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Creating Your Own Theme
|
|
56
|
-
|
|
57
|
-
1. Create a new JSON file in `.opencode/themes/`
|
|
58
|
-
2. Copy the structure from `servicenow.json`
|
|
59
|
-
3. Customize colors in the `defs` and `theme` sections
|
|
60
|
-
4. Set `"theme": "your-theme-name"` in `.opencode/config.json`
|
|
61
|
-
|
|
62
|
-
## Available Themes
|
|
63
|
-
|
|
64
|
-
- **servicenow** - Official ServiceNow Now Platform theme (default)
|
|
65
|
-
|
|
66
|
-
## Theme Schema
|
|
67
|
-
|
|
68
|
-
For full theme documentation, see:
|
|
69
|
-
- [OpenCode Theme Documentation](https://opencode.ai/docs/themes/)
|
|
70
|
-
- [Theme JSON Schema](https://opencode.ai/theme.json)
|
|
71
|
-
|
|
72
|
-
## Contributing
|
|
73
|
-
|
|
74
|
-
Want to create more themes for Snow-Flow? Submit a PR with:
|
|
75
|
-
- Theme JSON file in this directory
|
|
76
|
-
- Update this README with theme description
|
|
77
|
-
- Screenshot of the theme in action
|
|
78
|
-
|
|
79
|
-
Suggested themes:
|
|
80
|
-
- **servicenow-dark** - Pure dark mode variant
|
|
81
|
-
- **servicenow-light** - Pure light mode variant
|
|
82
|
-
- **servicenow-high-contrast** - Accessibility-focused theme
|
|
83
|
-
- **servicenow-retro** - Classic ServiceNow colors from early versions
|
package/themes/servicenow.json
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://opencode.ai/theme.json",
|
|
3
|
-
"name": "ServiceNow",
|
|
4
|
-
"description": "Official ServiceNow color scheme - inspired by the Now Platform",
|
|
5
|
-
"author": "Snow-Flow Team",
|
|
6
|
-
"version": "1.0.0",
|
|
7
|
-
"defs": {
|
|
8
|
-
"snow_blue": "#0073CF",
|
|
9
|
-
"snow_blue_light": "#1E90FF",
|
|
10
|
-
"snow_blue_dark": "#005BA1",
|
|
11
|
-
"snow_teal": "#00B0B9",
|
|
12
|
-
"snow_green": "#5BB85C",
|
|
13
|
-
"snow_orange": "#FF8C2B",
|
|
14
|
-
"snow_red": "#E53935",
|
|
15
|
-
"snow_purple": "#7E57C2",
|
|
16
|
-
"snow_gray_darker": "#1A1A1A",
|
|
17
|
-
"snow_gray_dark": "#2B2F33",
|
|
18
|
-
"snow_gray_medium": "#3E4345",
|
|
19
|
-
"snow_gray": "#5F6D7E",
|
|
20
|
-
"snow_gray_light": "#8B95A5",
|
|
21
|
-
"snow_gray_lighter": "#D1D8DD",
|
|
22
|
-
"snow_white": "#FFFFFF",
|
|
23
|
-
"snow_off_white": "#F4F6F8",
|
|
24
|
-
"snow_code_bg": "#282C34",
|
|
25
|
-
"snow_selection": "#264F78"
|
|
26
|
-
},
|
|
27
|
-
"theme": {
|
|
28
|
-
"primary": "snow_blue",
|
|
29
|
-
"secondary": "snow_teal",
|
|
30
|
-
"accent": "snow_blue_light",
|
|
31
|
-
"error": "snow_red",
|
|
32
|
-
"warning": "snow_orange",
|
|
33
|
-
"success": "snow_green",
|
|
34
|
-
"info": "snow_teal",
|
|
35
|
-
"text": {
|
|
36
|
-
"dark": "snow_white",
|
|
37
|
-
"light": "snow_gray_darker"
|
|
38
|
-
},
|
|
39
|
-
"textMuted": {
|
|
40
|
-
"dark": "snow_gray_light",
|
|
41
|
-
"light": "snow_gray"
|
|
42
|
-
},
|
|
43
|
-
"background": {
|
|
44
|
-
"dark": "snow_gray_dark",
|
|
45
|
-
"light": "snow_white"
|
|
46
|
-
},
|
|
47
|
-
"backgroundAlt": {
|
|
48
|
-
"dark": "snow_gray_medium",
|
|
49
|
-
"light": "snow_off_white"
|
|
50
|
-
},
|
|
51
|
-
"border": {
|
|
52
|
-
"dark": "snow_gray_medium",
|
|
53
|
-
"light": "snow_gray_lighter"
|
|
54
|
-
},
|
|
55
|
-
"borderActive": "snow_blue",
|
|
56
|
-
"selection": "snow_selection",
|
|
57
|
-
"cursor": "snow_blue_light",
|
|
58
|
-
"diffAdded": "snow_green",
|
|
59
|
-
"diffRemoved": "snow_red",
|
|
60
|
-
"diffModified": "snow_orange",
|
|
61
|
-
"syntaxComment": {
|
|
62
|
-
"dark": "snow_gray_light",
|
|
63
|
-
"light": "snow_gray"
|
|
64
|
-
},
|
|
65
|
-
"syntaxKeyword": "snow_purple",
|
|
66
|
-
"syntaxString": "snow_green",
|
|
67
|
-
"syntaxNumber": "snow_orange",
|
|
68
|
-
"syntaxFunction": "snow_blue_light",
|
|
69
|
-
"syntaxVariable": {
|
|
70
|
-
"dark": "snow_white",
|
|
71
|
-
"light": "snow_gray_darker"
|
|
72
|
-
},
|
|
73
|
-
"syntaxType": "snow_teal",
|
|
74
|
-
"syntaxConstant": "snow_orange",
|
|
75
|
-
"syntaxOperator": "snow_purple",
|
|
76
|
-
"syntaxPunctuation": {
|
|
77
|
-
"dark": "snow_gray_light",
|
|
78
|
-
"light": "snow_gray"
|
|
79
|
-
},
|
|
80
|
-
"syntaxAttribute": "snow_teal",
|
|
81
|
-
"syntaxTag": "snow_red",
|
|
82
|
-
"syntaxError": "snow_red",
|
|
83
|
-
"linkText": "snow_blue",
|
|
84
|
-
"linkUnderline": "snow_blue",
|
|
85
|
-
"codeBackground": {
|
|
86
|
-
"dark": "snow_code_bg",
|
|
87
|
-
"light": "snow_off_white"
|
|
88
|
-
},
|
|
89
|
-
"codeBlockBackground": {
|
|
90
|
-
"dark": "snow_gray_darker",
|
|
91
|
-
"light": "snow_off_white"
|
|
92
|
-
},
|
|
93
|
-
"promptBackground": {
|
|
94
|
-
"dark": "snow_gray_medium",
|
|
95
|
-
"light": "snow_off_white"
|
|
96
|
-
},
|
|
97
|
-
"toolCallBackground": {
|
|
98
|
-
"dark": "snow_gray_medium",
|
|
99
|
-
"light": "snow_off_white"
|
|
100
|
-
},
|
|
101
|
-
"headerBackground": {
|
|
102
|
-
"dark": "snow_gray_darker",
|
|
103
|
-
"light": "snow_blue"
|
|
104
|
-
},
|
|
105
|
-
"headerText": "snow_white",
|
|
106
|
-
"spinnerPrimary": "snow_blue",
|
|
107
|
-
"spinnerSecondary": "snow_teal",
|
|
108
|
-
"scrollbarThumb": {
|
|
109
|
-
"dark": "snow_gray",
|
|
110
|
-
"light": "snow_gray_light"
|
|
111
|
-
},
|
|
112
|
-
"scrollbarTrack": {
|
|
113
|
-
"dark": "snow_gray_dark",
|
|
114
|
-
"light": "snow_gray_lighter"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|