@sofianedjerbi/knowledge-tree-mcp
Version:
MCP server for hierarchical project knowledge management
87 lines • 2.07 kB
JavaScript
/**
* Priority-related constants for the Knowledge Tree system
*/
/**
* Priority levels in order of importance
*/
export const PRIORITY_LEVELS = [
'CRITICAL',
'REQUIRED',
'COMMON',
'EDGE-CASE'
];
/**
* Priority weights for scoring and sorting
* Higher values indicate higher priority
*/
export const PRIORITY_WEIGHTS = {
'CRITICAL': 4,
'REQUIRED': 3,
'COMMON': 2,
'EDGE-CASE': 1
};
/**
* Priority sort order (ascending)
* Lower values appear first when sorting
*/
export const PRIORITY_ORDER = {
'CRITICAL': 0,
'REQUIRED': 1,
'COMMON': 2,
'EDGE-CASE': 3
};
/**
* Priority display names for UI/documentation
*/
export const PRIORITY_DISPLAY_NAMES = {
'CRITICAL': 'Critical',
'REQUIRED': 'Required',
'COMMON': 'Common',
'EDGE-CASE': 'Edge Case'
};
/**
* Priority descriptions for help text
*/
export const PRIORITY_DESCRIPTIONS = {
'CRITICAL': 'Architecture violations, security issues, breaking changes',
'REQUIRED': 'Must-follow patterns, best practices, team standards',
'COMMON': 'Frequent issues and their solutions',
'EDGE-CASE': 'Rare but documented scenarios'
};
/**
* Priority colors for UI/visualization (CSS color values)
*/
export const PRIORITY_COLORS = {
'CRITICAL': '#ff4444',
'REQUIRED': '#ff9944',
'COMMON': '#44ff44',
'EDGE-CASE': '#4444ff'
};
/**
* Priority border colors for UI elements
*/
export const PRIORITY_BORDER_COLORS = {
'CRITICAL': '#cc0000',
'REQUIRED': '#ff6600',
'COMMON': '#00cc00',
'EDGE-CASE': '#0000cc'
};
/**
* Check if a value is a valid priority
*/
export function isValidPriority(value) {
return typeof value === 'string' && PRIORITY_LEVELS.includes(value);
}
/**
* Get priority weight for sorting
*/
export function getPriorityWeight(priority) {
return PRIORITY_WEIGHTS[priority] ?? 0;
}
/**
* Compare two priorities for sorting (returns -1, 0, or 1)
*/
export function comparePriorities(a, b) {
return PRIORITY_ORDER[a] - PRIORITY_ORDER[b];
}
//# sourceMappingURL=priorities.js.map