mcp-adr-analysis-server 2.0.21 → 2.1.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 +94 -839
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/config/ai-config.d.ts.map +1 -1
- package/dist/src/config/ai-config.js +9 -9
- package/dist/src/config/ai-config.js.map +1 -1
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1594 -837
- package/dist/src/index.js.map +1 -1
- package/dist/src/prompts/analysis-prompts.d.ts +4 -1
- package/dist/src/prompts/analysis-prompts.d.ts.map +1 -1
- package/dist/src/prompts/analysis-prompts.js +61 -30
- package/dist/src/prompts/analysis-prompts.js.map +1 -1
- package/dist/src/prompts/index.d.ts +17 -1
- package/dist/src/prompts/index.d.ts.map +1 -1
- package/dist/src/prompts/index.js +325 -1
- package/dist/src/prompts/index.js.map +1 -1
- package/dist/src/prompts/rule-generation-prompts.d.ts +5 -1
- package/dist/src/prompts/rule-generation-prompts.d.ts.map +1 -1
- package/dist/src/prompts/rule-generation-prompts.js +5 -1
- package/dist/src/prompts/rule-generation-prompts.js.map +1 -1
- package/dist/src/prompts/security-prompts.d.ts +6 -1
- package/dist/src/prompts/security-prompts.d.ts.map +1 -1
- package/dist/src/prompts/security-prompts.js +6 -1
- package/dist/src/prompts/security-prompts.js.map +1 -1
- package/dist/src/prompts/todo-prompts.d.ts +49 -0
- package/dist/src/prompts/todo-prompts.d.ts.map +1 -0
- package/dist/src/prompts/todo-prompts.js +824 -0
- package/dist/src/prompts/todo-prompts.js.map +1 -0
- package/dist/src/resources/index.d.ts.map +1 -1
- package/dist/src/resources/index.js +9 -7
- package/dist/src/resources/index.js.map +1 -1
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts +47 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.d.ts.map +1 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.js +979 -0
- package/dist/src/tools/adr-bootstrap-validation-tool.js.map +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts +1 -0
- package/dist/src/tools/adr-suggestion-tool.d.ts.map +1 -1
- package/dist/src/tools/adr-suggestion-tool.js +330 -32
- package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
- package/dist/src/tools/content-masking-tool.d.ts +5 -0
- package/dist/src/tools/content-masking-tool.d.ts.map +1 -1
- package/dist/src/tools/content-masking-tool.js +631 -28
- package/dist/src/tools/content-masking-tool.js.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.d.ts +8 -5
- package/dist/src/tools/deployment-readiness-tool.d.ts.map +1 -1
- package/dist/src/tools/deployment-readiness-tool.js +1017 -93
- package/dist/src/tools/deployment-readiness-tool.js.map +1 -1
- package/dist/src/tools/environment-analysis-tool.d.ts +4 -0
- package/dist/src/tools/environment-analysis-tool.d.ts.map +1 -1
- package/dist/src/tools/environment-analysis-tool.js +568 -24
- package/dist/src/tools/environment-analysis-tool.js.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/interactive-adr-planning-tool.js +270 -108
- package/dist/src/tools/interactive-adr-planning-tool.js.map +1 -1
- package/dist/src/tools/mcp-planning-tool.d.ts.map +1 -1
- package/dist/src/tools/mcp-planning-tool.js +316 -183
- package/dist/src/tools/mcp-planning-tool.js.map +1 -1
- package/dist/src/tools/memory-loading-tool.d.ts +60 -0
- package/dist/src/tools/memory-loading-tool.d.ts.map +1 -0
- package/dist/src/tools/memory-loading-tool.js +457 -0
- package/dist/src/tools/memory-loading-tool.js.map +1 -0
- package/dist/src/tools/research-integration-tool.d.ts +4 -1
- package/dist/src/tools/research-integration-tool.d.ts.map +1 -1
- package/dist/src/tools/research-integration-tool.js +5 -1
- package/dist/src/tools/research-integration-tool.js.map +1 -1
- package/dist/src/tools/review-existing-adrs-tool.d.ts +19 -0
- package/dist/src/tools/review-existing-adrs-tool.d.ts.map +1 -0
- package/dist/src/tools/review-existing-adrs-tool.js +1204 -0
- package/dist/src/tools/review-existing-adrs-tool.js.map +1 -0
- package/dist/src/tools/rule-generation-tool.d.ts +2 -0
- package/dist/src/tools/rule-generation-tool.d.ts.map +1 -1
- package/dist/src/tools/rule-generation-tool.js +274 -33
- package/dist/src/tools/rule-generation-tool.js.map +1 -1
- package/dist/src/tools/smart-git-push-tool-v2.d.ts +4 -0
- package/dist/src/tools/smart-git-push-tool-v2.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool-v2.js +423 -229
- package/dist/src/tools/smart-git-push-tool-v2.js.map +1 -1
- package/dist/src/tools/smart-git-push-tool.d.ts +3 -0
- package/dist/src/tools/smart-git-push-tool.d.ts.map +1 -1
- package/dist/src/tools/smart-git-push-tool.js +241 -235
- package/dist/src/tools/smart-git-push-tool.js.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.d.ts +2 -2
- package/dist/src/tools/tool-chain-orchestrator.d.ts.map +1 -1
- package/dist/src/tools/tool-chain-orchestrator.js +152 -93
- package/dist/src/tools/tool-chain-orchestrator.js.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts +22 -13
- package/dist/src/tools/troubleshoot-guided-workflow-tool.d.ts.map +1 -1
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js +660 -28
- package/dist/src/tools/troubleshoot-guided-workflow-tool.js.map +1 -1
- package/dist/src/types/ape-framework.d.ts +93 -0
- package/dist/src/types/ape-framework.d.ts.map +1 -1
- package/dist/src/types/ape-framework.js +10 -10
- package/dist/src/types/ape-framework.js.map +1 -1
- package/dist/src/types/enhanced-errors.d.ts +173 -0
- package/dist/src/types/enhanced-errors.d.ts.map +1 -0
- package/dist/src/types/enhanced-errors.js +668 -0
- package/dist/src/types/enhanced-errors.js.map +1 -0
- package/dist/src/types/index.d.ts +129 -3
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +15 -0
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/knowledge-generation.d.ts +78 -0
- package/dist/src/types/knowledge-generation.d.ts.map +1 -1
- package/dist/src/types/knowledge-generation.js +10 -6
- package/dist/src/types/knowledge-generation.js.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.d.ts +92 -0
- package/dist/src/types/knowledge-graph-schemas.d.ts.map +1 -1
- package/dist/src/types/knowledge-graph-schemas.js +45 -17
- package/dist/src/types/knowledge-graph-schemas.js.map +1 -1
- package/dist/src/types/memory-entities.d.ts +7209 -0
- package/dist/src/types/memory-entities.d.ts.map +1 -0
- package/dist/src/types/memory-entities.js +395 -0
- package/dist/src/types/memory-entities.js.map +1 -0
- package/dist/src/types/reflexion-framework.d.ts +44 -0
- package/dist/src/types/reflexion-framework.d.ts.map +1 -1
- package/dist/src/types/reflexion-framework.js +7 -7
- package/dist/src/types/reflexion-framework.js.map +1 -1
- package/dist/src/types/todo-json-schemas.d.ts +7 -653
- package/dist/src/types/todo-json-schemas.d.ts.map +1 -1
- package/dist/src/types/todo-json-schemas.js +6 -110
- package/dist/src/types/todo-json-schemas.js.map +1 -1
- package/dist/src/types/tool-arguments.d.ts +224 -0
- package/dist/src/types/tool-arguments.d.ts.map +1 -0
- package/dist/src/types/tool-arguments.js +6 -0
- package/dist/src/types/tool-arguments.js.map +1 -0
- package/dist/src/utils/actual-file-operations.d.ts.map +1 -1
- package/dist/src/utils/actual-file-operations.js +25 -9
- package/dist/src/utils/actual-file-operations.js.map +1 -1
- package/dist/src/utils/adr-discovery.d.ts +33 -1
- package/dist/src/utils/adr-discovery.d.ts.map +1 -1
- package/dist/src/utils/adr-discovery.js +14 -9
- package/dist/src/utils/adr-discovery.js.map +1 -1
- package/dist/src/utils/adr-suggestions.d.ts +72 -0
- package/dist/src/utils/adr-suggestions.d.ts.map +1 -1
- package/dist/src/utils/adr-suggestions.js +6 -0
- package/dist/src/utils/adr-suggestions.js.map +1 -1
- package/dist/src/utils/cache.d.ts.map +1 -1
- package/dist/src/utils/cache.js +22 -19
- package/dist/src/utils/cache.js.map +1 -1
- package/dist/src/utils/chain-of-thought-template.d.ts +13 -1
- package/dist/src/utils/chain-of-thought-template.d.ts.map +1 -1
- package/dist/src/utils/chain-of-thought-template.js +31 -22
- package/dist/src/utils/chain-of-thought-template.js.map +1 -1
- package/dist/src/utils/config.d.ts.map +1 -1
- package/dist/src/utils/config.js +1 -0
- package/dist/src/utils/config.js.map +1 -1
- package/dist/src/utils/directory-compat.js +1 -1
- package/dist/src/utils/directory-compat.js.map +1 -1
- package/dist/src/utils/enhanced-logging.d.ts +195 -0
- package/dist/src/utils/enhanced-logging.d.ts.map +1 -0
- package/dist/src/utils/enhanced-logging.js +449 -0
- package/dist/src/utils/enhanced-logging.js.map +1 -0
- package/dist/src/utils/file-system.d.ts +182 -34
- package/dist/src/utils/file-system.d.ts.map +1 -1
- package/dist/src/utils/file-system.js +648 -774
- package/dist/src/utils/file-system.js.map +1 -1
- package/dist/src/utils/gitleaks-detector.d.ts +50 -0
- package/dist/src/utils/gitleaks-detector.d.ts.map +1 -0
- package/dist/src/utils/gitleaks-detector.js +334 -0
- package/dist/src/utils/gitleaks-detector.js.map +1 -0
- package/dist/src/utils/interactive-approval.d.ts +1 -1
- package/dist/src/utils/interactive-approval.d.ts.map +1 -1
- package/dist/src/utils/interactive-approval.js +22 -17
- package/dist/src/utils/interactive-approval.js.map +1 -1
- package/dist/src/utils/json-safe.d.ts.map +1 -1
- package/dist/src/utils/json-safe.js +9 -6
- package/dist/src/utils/json-safe.js.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts +37 -1
- package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
- package/dist/src/utils/knowledge-graph-manager.js +315 -70
- package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
- package/dist/src/utils/location-filter.d.ts +35 -10
- package/dist/src/utils/location-filter.d.ts.map +1 -1
- package/dist/src/utils/location-filter.js +360 -94
- package/dist/src/utils/location-filter.js.map +1 -1
- package/dist/src/utils/mcp-response-validator.d.ts.map +1 -1
- package/dist/src/utils/mcp-response-validator.js +34 -19
- package/dist/src/utils/mcp-response-validator.js.map +1 -1
- package/dist/src/utils/memory-entity-manager.d.ts +134 -0
- package/dist/src/utils/memory-entity-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-entity-manager.js +851 -0
- package/dist/src/utils/memory-entity-manager.js.map +1 -0
- package/dist/src/utils/memory-health-scoring.d.ts +125 -0
- package/dist/src/utils/memory-health-scoring.d.ts.map +1 -0
- package/dist/src/utils/memory-health-scoring.js +277 -0
- package/dist/src/utils/memory-health-scoring.js.map +1 -0
- package/dist/src/utils/memory-migration-manager.d.ts +93 -0
- package/dist/src/utils/memory-migration-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-migration-manager.js +842 -0
- package/dist/src/utils/memory-migration-manager.js.map +1 -0
- package/dist/src/utils/memory-relationship-mapper.d.ts +87 -0
- package/dist/src/utils/memory-relationship-mapper.d.ts.map +1 -0
- package/dist/src/utils/memory-relationship-mapper.js +482 -0
- package/dist/src/utils/memory-relationship-mapper.js.map +1 -0
- package/dist/src/utils/memory-rollback-manager.d.ts +105 -0
- package/dist/src/utils/memory-rollback-manager.d.ts.map +1 -0
- package/dist/src/utils/memory-rollback-manager.js +575 -0
- package/dist/src/utils/memory-rollback-manager.js.map +1 -0
- package/dist/src/utils/memory-transformation.d.ts +59 -0
- package/dist/src/utils/memory-transformation.d.ts.map +1 -0
- package/dist/src/utils/memory-transformation.js +742 -0
- package/dist/src/utils/memory-transformation.js.map +1 -0
- package/dist/src/utils/output-masking.d.ts +12 -0
- package/dist/src/utils/output-masking.d.ts.map +1 -1
- package/dist/src/utils/output-masking.js +5 -0
- package/dist/src/utils/output-masking.js.map +1 -1
- package/dist/src/utils/prompt-execution.d.ts.map +1 -1
- package/dist/src/utils/prompt-execution.js +72 -51
- package/dist/src/utils/prompt-execution.js.map +1 -1
- package/dist/src/utils/release-readiness-detector.d.ts.map +1 -1
- package/dist/src/utils/release-readiness-detector.js +43 -42
- package/dist/src/utils/release-readiness-detector.js.map +1 -1
- package/dist/src/utils/research-integration.d.ts.map +1 -1
- package/dist/src/utils/research-integration.js +73 -44
- package/dist/src/utils/research-integration.js.map +1 -1
- package/dist/src/utils/research-questions.d.ts.map +1 -1
- package/dist/src/utils/research-questions.js +40 -14
- package/dist/src/utils/research-questions.js.map +1 -1
- package/dist/src/utils/ripgrep-wrapper.d.ts +84 -0
- package/dist/src/utils/ripgrep-wrapper.d.ts.map +1 -0
- package/dist/src/utils/ripgrep-wrapper.js +255 -0
- package/dist/src/utils/ripgrep-wrapper.js.map +1 -0
- package/dist/src/utils/rule-generation.d.ts.map +1 -1
- package/dist/src/utils/rule-generation.js +26 -15
- package/dist/src/utils/rule-generation.js.map +1 -1
- package/dist/src/utils/todo-file-watcher.d.ts +11 -23
- package/dist/src/utils/todo-file-watcher.d.ts.map +1 -1
- package/dist/src/utils/todo-file-watcher.js +18 -156
- package/dist/src/utils/todo-file-watcher.js.map +1 -1
- package/dist/src/utils/tree-sitter-analyzer.d.ts +185 -0
- package/dist/src/utils/tree-sitter-analyzer.d.ts.map +1 -0
- package/dist/src/utils/tree-sitter-analyzer.js +885 -0
- package/dist/src/utils/tree-sitter-analyzer.js.map +1 -0
- package/package.json +51 -10
- package/dist/src/tools/smart-score-tool.d.ts +0 -173
- package/dist/src/tools/smart-score-tool.d.ts.map +0 -1
- package/dist/src/tools/smart-score-tool.js +0 -681
- package/dist/src/tools/smart-score-tool.js.map +0 -1
- package/dist/src/tools/todo-management-tool-v2.d.ts +0 -368
- package/dist/src/tools/todo-management-tool-v2.d.ts.map +0 -1
- package/dist/src/tools/todo-management-tool-v2.js +0 -922
- package/dist/src/tools/todo-management-tool-v2.js.map +0 -1
- package/dist/src/utils/enhanced-sensitive-detector.d.ts +0 -61
- package/dist/src/utils/enhanced-sensitive-detector.d.ts.map +0 -1
- package/dist/src/utils/enhanced-sensitive-detector.js +0 -437
- package/dist/src/utils/enhanced-sensitive-detector.js.map +0 -1
- package/dist/src/utils/project-health-scoring.d.ts +0 -177
- package/dist/src/utils/project-health-scoring.d.ts.map +0 -1
- package/dist/src/utils/project-health-scoring.js +0 -370
- package/dist/src/utils/project-health-scoring.js.map +0 -1
- package/dist/src/utils/todo-json-manager.d.ts +0 -71
- package/dist/src/utils/todo-json-manager.d.ts.map +0 -1
- package/dist/src/utils/todo-json-manager.js +0 -396
- package/dist/src/utils/todo-json-manager.js.map +0 -1
- package/dist/src/utils/todo-markdown-converter.d.ts +0 -16
- package/dist/src/utils/todo-markdown-converter.d.ts.map +0 -1
- package/dist/src/utils/todo-markdown-converter.js +0 -362
- package/dist/src/utils/todo-markdown-converter.js.map +0 -1
- package/dist/src/utils/todo-migration.d.ts +0 -47
- package/dist/src/utils/todo-migration.d.ts.map +0 -1
- package/dist/src/utils/todo-migration.js +0 -261
- package/dist/src/utils/todo-migration.js.map +0 -1
|
@@ -31,14 +31,14 @@ import { McpAdrError } from '../types/index.js';
|
|
|
31
31
|
import { execSync } from 'child_process';
|
|
32
32
|
import { readFileSync, existsSync, statSync } from 'fs';
|
|
33
33
|
import { join, basename } from 'path';
|
|
34
|
-
import { jsonSafeFilePath, jsonSafeMarkdownList, jsonSafeError, jsonSafeUserInput } from '../utils/json-safe.js';
|
|
34
|
+
import { jsonSafeFilePath, jsonSafeMarkdownList, jsonSafeError, jsonSafeUserInput, } from '../utils/json-safe.js';
|
|
35
35
|
import { validateMcpResponse } from '../utils/mcp-response-validator.js';
|
|
36
36
|
import { KnowledgeGraphManager } from '../utils/knowledge-graph-manager.js';
|
|
37
37
|
/**
|
|
38
38
|
* Main smart git push function - Knowledge Graph Enhanced Version
|
|
39
39
|
*/
|
|
40
40
|
async function _smartGitPushInternal(args) {
|
|
41
|
-
const { branch, message, skipValidation = false, allowedArtifacts = [], sensitivityLevel = 'moderate', dryRun = false, projectPath = process.cwd(), checkReleaseReadiness = false, releaseType = 'minor', skipKnowledgeGraphAnalysis = false } = args;
|
|
41
|
+
const { branch, message, skipValidation = false, allowedArtifacts = [], sensitivityLevel = 'moderate', dryRun = false, projectPath = process.cwd(), checkReleaseReadiness = false, releaseType = 'minor', skipKnowledgeGraphAnalysis = false, } = args;
|
|
42
42
|
try {
|
|
43
43
|
// Step 1: Get staged files using git CLI
|
|
44
44
|
const stagedFiles = await getStagedFiles(projectPath);
|
|
@@ -61,26 +61,19 @@ async function _smartGitPushInternal(args) {
|
|
|
61
61
|
releaseReadinessResult = await analyzeReleaseReadiness({
|
|
62
62
|
projectPath,
|
|
63
63
|
releaseType,
|
|
64
|
-
includeAnalysis: true
|
|
64
|
+
includeAnalysis: true,
|
|
65
65
|
});
|
|
66
66
|
// Update deployment readiness score in health scoring system
|
|
67
67
|
try {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
releaseScore: releaseReadinessResult.score,
|
|
72
|
-
milestoneCompletion: releaseReadinessResult.milestones.length > 0 ?
|
|
73
|
-
releaseReadinessResult.milestones.reduce((sum, m) => sum + m.completionRate, 0) / releaseReadinessResult.milestones.length : 0.5,
|
|
74
|
-
criticalBlockers: releaseReadinessResult.blockers.filter((b) => b.severity === 'error').length,
|
|
75
|
-
warningBlockers: releaseReadinessResult.blockers.filter((b) => b.severity === 'warning').length,
|
|
76
|
-
gitHealthScore: releaseReadinessResult.blockers.some((b) => b.type === 'unstable-code') ? 30 : 80
|
|
77
|
-
});
|
|
68
|
+
// ProjectHealthScoring removed - skip health scoring
|
|
69
|
+
console.warn('⚠️ ProjectHealthScoring is deprecated and was removed in memory-centric transformation');
|
|
70
|
+
// Skip health scoring update - ProjectHealthScoring removed
|
|
78
71
|
}
|
|
79
|
-
catch
|
|
72
|
+
catch {
|
|
80
73
|
// Silently handle health scoring errors
|
|
81
74
|
}
|
|
82
75
|
}
|
|
83
|
-
catch
|
|
76
|
+
catch {
|
|
84
77
|
// Silently handle release readiness analysis errors
|
|
85
78
|
}
|
|
86
79
|
}
|
|
@@ -105,16 +98,23 @@ No staged files found. Use \`git add\` to stage files before pushing.
|
|
|
105
98
|
- **Goal Progress**: ${kgAnalysis.projectGoalProgress.overallProgress}%
|
|
106
99
|
- **Task Dependencies**: ${kgAnalysis.taskDependencies.completed.length} completed, ${kgAnalysis.taskDependencies.pending.length} pending
|
|
107
100
|
|
|
108
|
-
${kgAnalysis.activeIntents.length > 0
|
|
101
|
+
${kgAnalysis.activeIntents.length > 0
|
|
102
|
+
? `
|
|
109
103
|
### Active Intents
|
|
110
104
|
${kgAnalysis.activeIntents.map(intent => `- **${intent.currentStatus}**: ${jsonSafeUserInput(intent.humanRequest.substring(0, 80))}...`).join('\n')}
|
|
111
|
-
`
|
|
105
|
+
`
|
|
106
|
+
: ''}
|
|
112
107
|
|
|
113
|
-
${kgAnalysis.taskDependencies.pending.length > 0
|
|
108
|
+
${kgAnalysis.taskDependencies.pending.length > 0
|
|
109
|
+
? `
|
|
114
110
|
### Pending Tasks
|
|
115
111
|
Consider working on these tasks before your next push:
|
|
116
|
-
${kgAnalysis.taskDependencies.pending
|
|
117
|
-
|
|
112
|
+
${kgAnalysis.taskDependencies.pending
|
|
113
|
+
.slice(0, 5)
|
|
114
|
+
.map(task => `- ${jsonSafeUserInput(task)}`)
|
|
115
|
+
.join('\n')}
|
|
116
|
+
`
|
|
117
|
+
: ''}
|
|
118
118
|
`;
|
|
119
119
|
}
|
|
120
120
|
// Add release readiness info if checked
|
|
@@ -127,16 +127,18 @@ ${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
|
127
127
|
### Recommendations
|
|
128
128
|
${jsonSafeMarkdownList(releaseReadinessResult.recommendations)}
|
|
129
129
|
|
|
130
|
-
${releaseReadinessResult.isReady
|
|
131
|
-
'✅ **Project is ready for release!** Consider creating a release after staging files.'
|
|
132
|
-
'❌ **Project is not ready for release.** Address blockers before proceeding.'}
|
|
130
|
+
${releaseReadinessResult.isReady
|
|
131
|
+
? '✅ **Project is ready for release!** Consider creating a release after staging files.'
|
|
132
|
+
: '❌ **Project is not ready for release.** Address blockers before proceeding.'}
|
|
133
133
|
`;
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
136
|
-
content: [
|
|
136
|
+
content: [
|
|
137
|
+
{
|
|
137
138
|
type: 'text',
|
|
138
|
-
text: responseText
|
|
139
|
-
}
|
|
139
|
+
text: responseText,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
140
142
|
};
|
|
141
143
|
}
|
|
142
144
|
// Step 3: Analyze staged files if validation is enabled
|
|
@@ -145,7 +147,7 @@ ${releaseReadinessResult.isReady ?
|
|
|
145
147
|
validationResults = await validateStagedFiles(stagedFiles, {
|
|
146
148
|
sensitivityLevel,
|
|
147
149
|
allowedArtifacts,
|
|
148
|
-
projectPath
|
|
150
|
+
projectPath,
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
153
|
// Step 4: Check for blocking conditions (Enhanced with Knowledge Graph)
|
|
@@ -174,14 +176,16 @@ ${releaseReadinessResult.isReady ?
|
|
|
174
176
|
Push blocked due to critical issues that must be resolved.
|
|
175
177
|
|
|
176
178
|
## Issues Found
|
|
177
|
-
${issues
|
|
179
|
+
${issues
|
|
180
|
+
.map(issue => `
|
|
178
181
|
|
|
179
182
|
### ${jsonSafeFilePath(issue.file)}
|
|
180
183
|
${issue.issues.map(i => `- **${i.severity.toUpperCase()}**: ${jsonSafeUserInput(i.message)}`).join('\n')}
|
|
181
184
|
|
|
182
185
|
**Suggestions:**
|
|
183
186
|
${jsonSafeMarkdownList(issue.suggestions)}
|
|
184
|
-
`)
|
|
187
|
+
`)
|
|
188
|
+
.join('\n')}
|
|
185
189
|
`;
|
|
186
190
|
// Add release readiness info if checked and blocked
|
|
187
191
|
if (releaseReadinessResult && releaseReadinessBlocked) {
|
|
@@ -191,7 +195,10 @@ ${jsonSafeMarkdownList(issue.suggestions)}
|
|
|
191
195
|
${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
192
196
|
|
|
193
197
|
### Critical Blockers
|
|
194
|
-
${releaseReadinessResult.blockers
|
|
198
|
+
${releaseReadinessResult.blockers
|
|
199
|
+
.filter(b => b.severity === 'error')
|
|
200
|
+
.map(b => `- **${b.type}**: ${jsonSafeUserInput(b.message)}`)
|
|
201
|
+
.join('\n')}
|
|
195
202
|
|
|
196
203
|
### Recommendations
|
|
197
204
|
${jsonSafeMarkdownList(releaseReadinessResult.recommendations)}
|
|
@@ -228,14 +235,19 @@ ${kgBlockingConditions.map(bc => `- ${jsonSafeUserInput(bc.recommendation)}`).jo
|
|
|
228
235
|
- **Goal Progress**: ${kgAnalysis.projectGoalProgress.overallProgress}%
|
|
229
236
|
|
|
230
237
|
### Warnings
|
|
231
|
-
${kgAnalysis.blockingConditions
|
|
238
|
+
${kgAnalysis.blockingConditions
|
|
239
|
+
.filter(bc => bc.severity === 'warning')
|
|
240
|
+
.map(bc => `- **${bc.type}**: ${jsonSafeUserInput(bc.message)}`)
|
|
241
|
+
.join('\n')}
|
|
232
242
|
`;
|
|
233
243
|
}
|
|
234
244
|
return {
|
|
235
|
-
content: [
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
236
247
|
type: 'text',
|
|
237
|
-
text: cancelText
|
|
238
|
-
}
|
|
248
|
+
text: cancelText,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
239
251
|
};
|
|
240
252
|
}
|
|
241
253
|
// Step 5: Execute git push if not dry run
|
|
@@ -244,15 +256,15 @@ ${kgAnalysis.blockingConditions.filter(bc => bc.severity === 'warning').map(bc =
|
|
|
244
256
|
// Update TODO tasks with KG integration
|
|
245
257
|
if (kgAnalysis) {
|
|
246
258
|
try {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
259
|
+
// TodoJsonManager removed - skipping todo validation
|
|
260
|
+
console.warn('⚠️ TodoJsonManager is deprecated and was removed in memory-centric transformation');
|
|
261
|
+
// Skip todo task update - TodoJsonManager removed
|
|
250
262
|
}
|
|
251
263
|
catch (todoError) {
|
|
252
264
|
console.error('Error updating TODO tasks with KG:', todoError);
|
|
253
265
|
}
|
|
254
266
|
}
|
|
255
|
-
|
|
267
|
+
const successText = `# Smart Git Push - Success ✅
|
|
256
268
|
|
|
257
269
|
## Push Details
|
|
258
270
|
- **Branch**: ${branch || 'current'}
|
|
@@ -266,7 +278,8 @@ ${kgAnalysis ? `- **Knowledge Graph Analysis**: ✅ Completed` : ''}
|
|
|
266
278
|
## Files Pushed
|
|
267
279
|
${stagedFiles.map(f => `- ${jsonSafeFilePath(f.path)} (${f.status})`).join('\n')}
|
|
268
280
|
|
|
269
|
-
${kgAnalysis
|
|
281
|
+
${kgAnalysis
|
|
282
|
+
? `
|
|
270
283
|
## Knowledge Graph Analysis
|
|
271
284
|
### Project Context
|
|
272
285
|
- **Active Intents**: ${kgAnalysis.activeIntents.length}
|
|
@@ -277,28 +290,41 @@ ${kgAnalysis ? `
|
|
|
277
290
|
### Architectural Insights
|
|
278
291
|
${kgAnalysis.architecturalAlignment.details.map(detail => `- ${jsonSafeUserInput(detail)}`).join('\n')}
|
|
279
292
|
|
|
280
|
-
${kgAnalysis.blockingConditions.length > 0
|
|
293
|
+
${kgAnalysis.blockingConditions.length > 0
|
|
294
|
+
? `
|
|
281
295
|
### Warnings & Recommendations
|
|
282
|
-
${kgAnalysis.blockingConditions
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
296
|
+
${kgAnalysis.blockingConditions
|
|
297
|
+
.filter(bc => bc.severity === 'warning')
|
|
298
|
+
.map(bc => `- **${bc.type}**: ${jsonSafeUserInput(bc.message)}`)
|
|
299
|
+
.join('\n')}
|
|
300
|
+
`
|
|
301
|
+
: ''}
|
|
302
|
+
|
|
303
|
+
${kgAnalysis.projectGoalProgress.intentProgress.length > 0
|
|
304
|
+
? `
|
|
286
305
|
### Intent Progress
|
|
287
306
|
${kgAnalysis.projectGoalProgress.intentProgress.map(intent => `- **${intent.status}**: ${jsonSafeUserInput(intent.humanRequest.substring(0, 60))}... (${intent.progress}%)`).join('\n')}
|
|
288
|
-
`
|
|
289
|
-
|
|
307
|
+
`
|
|
308
|
+
: ''}
|
|
309
|
+
`
|
|
310
|
+
: ''}
|
|
290
311
|
|
|
291
|
-
${issues.length > 0
|
|
312
|
+
${issues.length > 0
|
|
313
|
+
? `
|
|
292
314
|
|
|
293
315
|
## Validation Issues (Auto-Approved)
|
|
294
|
-
${issues
|
|
316
|
+
${issues
|
|
317
|
+
.map(issue => `
|
|
295
318
|
|
|
296
319
|
### ${jsonSafeFilePath(issue.file)}
|
|
297
320
|
${issue.issues.map(i => `- **${i.severity.toUpperCase()}**: ${jsonSafeUserInput(i.message)}`).join('\n')}
|
|
298
|
-
`)
|
|
299
|
-
|
|
321
|
+
`)
|
|
322
|
+
.join('\n')}
|
|
323
|
+
`
|
|
324
|
+
: ''}
|
|
300
325
|
|
|
301
|
-
${releaseReadinessResult
|
|
326
|
+
${releaseReadinessResult
|
|
327
|
+
? `
|
|
302
328
|
|
|
303
329
|
## Release Readiness Analysis
|
|
304
330
|
${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
@@ -306,10 +332,11 @@ ${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
|
306
332
|
### Post-Push Recommendations
|
|
307
333
|
${jsonSafeMarkdownList(releaseReadinessResult.recommendations)}
|
|
308
334
|
|
|
309
|
-
${releaseReadinessResult.isReady
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
`
|
|
335
|
+
${releaseReadinessResult.isReady
|
|
336
|
+
? '🎉 **Congratulations!** This push completed a release-ready state. Consider creating a release tag.'
|
|
337
|
+
: '📋 **Next Steps**: Address remaining blockers to achieve release readiness.'}
|
|
338
|
+
`
|
|
339
|
+
: ''}
|
|
313
340
|
|
|
314
341
|
## Git Output
|
|
315
342
|
\`\`\`
|
|
@@ -324,15 +351,17 @@ ${releaseReadinessResult?.isReady ? '- Consider creating a release tag or publis
|
|
|
324
351
|
${kgAnalysis ? '- Review knowledge graph insights for follow-up tasks' : ''}
|
|
325
352
|
`;
|
|
326
353
|
return {
|
|
327
|
-
content: [
|
|
354
|
+
content: [
|
|
355
|
+
{
|
|
328
356
|
type: 'text',
|
|
329
|
-
text: successText
|
|
330
|
-
}
|
|
357
|
+
text: successText,
|
|
358
|
+
},
|
|
359
|
+
],
|
|
331
360
|
};
|
|
332
361
|
}
|
|
333
362
|
else {
|
|
334
363
|
// Dry run - show what would happen
|
|
335
|
-
|
|
364
|
+
const dryRunText = `# Smart Git Push - Dry Run 🔍
|
|
336
365
|
|
|
337
366
|
## Analysis Complete
|
|
338
367
|
- **Files to Push**: ${stagedFiles.length}
|
|
@@ -345,7 +374,8 @@ ${kgAnalysis ? `- **Knowledge Graph Analysis**: ✅ Completed` : ''}
|
|
|
345
374
|
## Staged Files
|
|
346
375
|
${stagedFiles.map(f => `- ${jsonSafeFilePath(f.path)} (${f.status}) - ${f.size} bytes`).join('\n')}
|
|
347
376
|
|
|
348
|
-
${kgAnalysis
|
|
377
|
+
${kgAnalysis
|
|
378
|
+
? `
|
|
349
379
|
## Knowledge Graph Analysis Preview
|
|
350
380
|
### Project Context
|
|
351
381
|
- **Active Intents**: ${kgAnalysis.activeIntents.length}
|
|
@@ -356,31 +386,41 @@ ${kgAnalysis ? `
|
|
|
356
386
|
### Architectural Assessment
|
|
357
387
|
${kgAnalysis.architecturalAlignment.details.map(detail => `- ${jsonSafeUserInput(detail)}`).join('\n')}
|
|
358
388
|
|
|
359
|
-
${kgAnalysis.blockingConditions.length > 0
|
|
389
|
+
${kgAnalysis.blockingConditions.length > 0
|
|
390
|
+
? `
|
|
360
391
|
### Potential Issues
|
|
361
392
|
${kgAnalysis.blockingConditions.map(bc => `- **${bc.type}** (${bc.severity}): ${jsonSafeUserInput(bc.message)}`).join('\n')}
|
|
362
|
-
`
|
|
393
|
+
`
|
|
394
|
+
: ''}
|
|
363
395
|
|
|
364
|
-
${kgAnalysis.projectGoalProgress.intentProgress.length > 0
|
|
396
|
+
${kgAnalysis.projectGoalProgress.intentProgress.length > 0
|
|
397
|
+
? `
|
|
365
398
|
### Intent Progress Impact
|
|
366
399
|
${kgAnalysis.projectGoalProgress.intentProgress.map(intent => `- **${intent.status}**: ${jsonSafeUserInput(intent.humanRequest.substring(0, 60))}... (${intent.progress}%)`).join('\n')}
|
|
367
|
-
`
|
|
368
|
-
|
|
400
|
+
`
|
|
401
|
+
: ''}
|
|
402
|
+
`
|
|
403
|
+
: ''}
|
|
369
404
|
|
|
370
|
-
${issues.length > 0
|
|
405
|
+
${issues.length > 0
|
|
406
|
+
? `
|
|
371
407
|
|
|
372
408
|
## Validation Issues Found
|
|
373
|
-
${issues
|
|
409
|
+
${issues
|
|
410
|
+
.map(issue => `
|
|
374
411
|
|
|
375
412
|
### ${jsonSafeFilePath(issue.file)}
|
|
376
413
|
${issue.issues.map(i => `- **${i.severity.toUpperCase()}**: ${jsonSafeUserInput(i.message)}`).join('\n')}
|
|
377
414
|
|
|
378
415
|
**Suggestions:**
|
|
379
416
|
${jsonSafeMarkdownList(issue.suggestions)}
|
|
380
|
-
`)
|
|
381
|
-
|
|
417
|
+
`)
|
|
418
|
+
.join('\n')}
|
|
419
|
+
`
|
|
420
|
+
: '## ✅ No Validation Issues Found'}
|
|
382
421
|
|
|
383
|
-
${releaseReadinessResult
|
|
422
|
+
${releaseReadinessResult
|
|
423
|
+
? `
|
|
384
424
|
|
|
385
425
|
## Release Readiness Analysis
|
|
386
426
|
${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
@@ -388,10 +428,11 @@ ${jsonSafeUserInput(releaseReadinessResult.summary)}
|
|
|
388
428
|
### Pre-Push Recommendations
|
|
389
429
|
${jsonSafeMarkdownList(releaseReadinessResult.recommendations)}
|
|
390
430
|
|
|
391
|
-
${releaseReadinessResult.isReady
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
`
|
|
431
|
+
${releaseReadinessResult.isReady
|
|
432
|
+
? '🎉 **Ready for Release!** This push would complete all release requirements.'
|
|
433
|
+
: '📋 **Release Blockers**: Address these issues before considering this a release.'}
|
|
434
|
+
`
|
|
435
|
+
: ''}
|
|
395
436
|
|
|
396
437
|
## Command to Execute
|
|
397
438
|
\`\`\`bash
|
|
@@ -402,10 +443,12 @@ git push${branch ? ` origin ${branch}` : ''}
|
|
|
402
443
|
**Note:** This was a dry run. No files were actually pushed.
|
|
403
444
|
`;
|
|
404
445
|
return {
|
|
405
|
-
content: [
|
|
446
|
+
content: [
|
|
447
|
+
{
|
|
406
448
|
type: 'text',
|
|
407
|
-
text: dryRunText
|
|
408
|
-
}
|
|
449
|
+
text: dryRunText,
|
|
450
|
+
},
|
|
451
|
+
],
|
|
409
452
|
};
|
|
410
453
|
}
|
|
411
454
|
}
|
|
@@ -421,7 +464,7 @@ async function getStagedFiles(projectPath) {
|
|
|
421
464
|
// Get staged files with status
|
|
422
465
|
const gitOutput = execSync('git diff --cached --name-status', {
|
|
423
466
|
cwd: projectPath,
|
|
424
|
-
encoding: 'utf8'
|
|
467
|
+
encoding: 'utf8',
|
|
425
468
|
});
|
|
426
469
|
if (!gitOutput.trim()) {
|
|
427
470
|
return [];
|
|
@@ -444,7 +487,7 @@ async function getStagedFiles(projectPath) {
|
|
|
444
487
|
content = readFileSync(fullPath, 'utf8');
|
|
445
488
|
}
|
|
446
489
|
}
|
|
447
|
-
catch
|
|
490
|
+
catch {
|
|
448
491
|
// Silently handle file read errors
|
|
449
492
|
}
|
|
450
493
|
}
|
|
@@ -452,7 +495,7 @@ async function getStagedFiles(projectPath) {
|
|
|
452
495
|
path,
|
|
453
496
|
status: mapGitStatus(status || 'M'),
|
|
454
497
|
content: content || '',
|
|
455
|
-
size
|
|
498
|
+
size,
|
|
456
499
|
});
|
|
457
500
|
}
|
|
458
501
|
return files;
|
|
@@ -466,11 +509,16 @@ async function getStagedFiles(projectPath) {
|
|
|
466
509
|
*/
|
|
467
510
|
function mapGitStatus(status) {
|
|
468
511
|
switch (status) {
|
|
469
|
-
case 'A':
|
|
470
|
-
|
|
471
|
-
case '
|
|
472
|
-
|
|
473
|
-
|
|
512
|
+
case 'A':
|
|
513
|
+
return 'added';
|
|
514
|
+
case 'M':
|
|
515
|
+
return 'modified';
|
|
516
|
+
case 'D':
|
|
517
|
+
return 'deleted';
|
|
518
|
+
case 'R':
|
|
519
|
+
return 'renamed';
|
|
520
|
+
default:
|
|
521
|
+
return 'modified';
|
|
474
522
|
}
|
|
475
523
|
}
|
|
476
524
|
/**
|
|
@@ -504,7 +552,7 @@ async function validateStagedFiles(files, options) {
|
|
|
504
552
|
file: file.path,
|
|
505
553
|
issues,
|
|
506
554
|
suggestions,
|
|
507
|
-
approved: issues.length === 0 || issues.every(i => i.severity === 'info')
|
|
555
|
+
approved: issues.length === 0 || issues.every(i => i.severity === 'info'),
|
|
508
556
|
});
|
|
509
557
|
}
|
|
510
558
|
return results;
|
|
@@ -514,25 +562,29 @@ async function validateStagedFiles(files, options) {
|
|
|
514
562
|
*/
|
|
515
563
|
async function checkSensitiveContent(content, filePath) {
|
|
516
564
|
try {
|
|
517
|
-
// Use
|
|
518
|
-
const { analyzeSensitiveContent } = await import('../utils/
|
|
565
|
+
// Use gitleaks for industry-standard secret detection
|
|
566
|
+
const { analyzeSensitiveContent } = await import('../utils/gitleaks-detector.js');
|
|
519
567
|
const result = await analyzeSensitiveContent(filePath, content);
|
|
520
568
|
// Convert to ValidationIssue format
|
|
521
569
|
const issues = [];
|
|
522
570
|
for (const match of result.matches) {
|
|
523
571
|
issues.push({
|
|
524
572
|
type: 'sensitive-content',
|
|
525
|
-
severity: match.pattern.severity === 'critical'
|
|
526
|
-
|
|
527
|
-
|
|
573
|
+
severity: match.pattern.severity === 'critical'
|
|
574
|
+
? 'error'
|
|
575
|
+
: match.pattern.severity === 'high'
|
|
576
|
+
? 'error'
|
|
577
|
+
: match.pattern.severity === 'medium'
|
|
578
|
+
? 'warning'
|
|
579
|
+
: 'info',
|
|
528
580
|
message: `${match.pattern.description}: ${match.match}`,
|
|
529
581
|
pattern: match.pattern.name,
|
|
530
|
-
line: match.line
|
|
582
|
+
line: match.line,
|
|
531
583
|
});
|
|
532
584
|
}
|
|
533
585
|
return issues;
|
|
534
586
|
}
|
|
535
|
-
catch
|
|
587
|
+
catch {
|
|
536
588
|
// Silently handle sensitive content check errors
|
|
537
589
|
return [];
|
|
538
590
|
}
|
|
@@ -550,10 +602,13 @@ async function checkLLMArtifacts(filePath, content) {
|
|
|
550
602
|
for (const match of result.matches) {
|
|
551
603
|
const issue = {
|
|
552
604
|
type: 'llm-artifact',
|
|
553
|
-
severity: match.pattern.severity === 'error'
|
|
554
|
-
|
|
605
|
+
severity: match.pattern.severity === 'error'
|
|
606
|
+
? 'error'
|
|
607
|
+
: match.pattern.severity === 'warning'
|
|
608
|
+
? 'warning'
|
|
609
|
+
: 'info',
|
|
555
610
|
message: `${match.pattern.description}: ${match.match}`,
|
|
556
|
-
pattern: match.pattern.name
|
|
611
|
+
pattern: match.pattern.name,
|
|
557
612
|
};
|
|
558
613
|
if (match.line !== undefined) {
|
|
559
614
|
issue.line = match.line;
|
|
@@ -562,7 +617,7 @@ async function checkLLMArtifacts(filePath, content) {
|
|
|
562
617
|
}
|
|
563
618
|
return issues;
|
|
564
619
|
}
|
|
565
|
-
catch
|
|
620
|
+
catch {
|
|
566
621
|
// Silently handle LLM artifact check errors
|
|
567
622
|
return [];
|
|
568
623
|
}
|
|
@@ -573,24 +628,81 @@ async function checkLLMArtifacts(filePath, content) {
|
|
|
573
628
|
async function checkLocationRules(filePath, allowedArtifacts) {
|
|
574
629
|
try {
|
|
575
630
|
// Use enhanced location filter
|
|
576
|
-
const {
|
|
631
|
+
const { validateFileLocationIntelligent } = await import('../utils/location-filter.js');
|
|
577
632
|
// Skip if explicitly allowed
|
|
578
633
|
if (allowedArtifacts.includes(basename(filePath)) || allowedArtifacts.includes(filePath)) {
|
|
579
634
|
return [];
|
|
580
635
|
}
|
|
581
|
-
|
|
636
|
+
// Read file content for intelligent analysis
|
|
637
|
+
let fileContent;
|
|
638
|
+
try {
|
|
639
|
+
fileContent = readFileSync(filePath, 'utf-8');
|
|
640
|
+
}
|
|
641
|
+
catch {
|
|
642
|
+
console.warn(`Could not read file for analysis: ${filePath}`);
|
|
643
|
+
}
|
|
644
|
+
const result = await validateFileLocationIntelligent(filePath, fileContent);
|
|
582
645
|
if (!result.isValid) {
|
|
583
|
-
|
|
646
|
+
const issues = [
|
|
647
|
+
{
|
|
584
648
|
type: 'wrong-location',
|
|
585
|
-
severity: result.severity === 'error'
|
|
586
|
-
|
|
649
|
+
severity: result.severity === 'error'
|
|
650
|
+
? 'error'
|
|
651
|
+
: result.severity === 'warning'
|
|
652
|
+
? 'warning'
|
|
653
|
+
: 'info',
|
|
587
654
|
message: result.message,
|
|
588
|
-
pattern: result.rule?.name || 'location-rule'
|
|
589
|
-
}
|
|
655
|
+
pattern: result.rule?.name || 'location-rule',
|
|
656
|
+
},
|
|
657
|
+
];
|
|
658
|
+
// Add tree-sitter security insights
|
|
659
|
+
if (result.treeSitterAnalysis) {
|
|
660
|
+
const analysis = result.treeSitterAnalysis;
|
|
661
|
+
// Critical security issues
|
|
662
|
+
if (analysis.hasSecrets) {
|
|
663
|
+
issues.push({
|
|
664
|
+
type: 'security-risk',
|
|
665
|
+
severity: 'error',
|
|
666
|
+
message: `🔐 Security Risk: File contains ${analysis.secrets.length} potential secret(s). Secrets should be in secure locations or environment variables.`,
|
|
667
|
+
pattern: 'tree-sitter-secrets',
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
// Dangerous imports
|
|
671
|
+
const dangerousImports = analysis.imports.filter(i => i.isDangerous);
|
|
672
|
+
if (dangerousImports.length > 0) {
|
|
673
|
+
issues.push({
|
|
674
|
+
type: 'security-risk',
|
|
675
|
+
severity: 'warning',
|
|
676
|
+
message: `⚠️ Dangerous imports detected: ${dangerousImports.map(i => i.module).join(', ')}. Consider safer alternatives.`,
|
|
677
|
+
pattern: 'tree-sitter-dangerous-imports',
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
// Infrastructure security risks
|
|
681
|
+
const riskyInfra = analysis.infraStructure.filter(i => i.securityRisks.length > 0);
|
|
682
|
+
if (riskyInfra.length > 0) {
|
|
683
|
+
const risks = riskyInfra.flatMap(i => i.securityRisks);
|
|
684
|
+
issues.push({
|
|
685
|
+
type: 'security-risk',
|
|
686
|
+
severity: 'error',
|
|
687
|
+
message: `🏗️ Infrastructure security risks: ${risks.join(', ')}. Review before deployment.`,
|
|
688
|
+
pattern: 'tree-sitter-infra-security',
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
// Architectural violations
|
|
692
|
+
if (result.intelligentReasons?.some(r => r.includes('violates'))) {
|
|
693
|
+
issues.push({
|
|
694
|
+
type: 'architecture-violation',
|
|
695
|
+
severity: 'error',
|
|
696
|
+
message: `🏗️ Architectural violation detected. This may affect system maintainability and scalability.`,
|
|
697
|
+
pattern: 'tree-sitter-architecture',
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return issues;
|
|
590
702
|
}
|
|
591
703
|
return [];
|
|
592
704
|
}
|
|
593
|
-
catch
|
|
705
|
+
catch {
|
|
594
706
|
// Silently handle location rule check errors
|
|
595
707
|
return [];
|
|
596
708
|
}
|
|
@@ -633,7 +745,7 @@ async function executePush(projectPath, branch, message) {
|
|
|
633
745
|
if (message) {
|
|
634
746
|
const commitOutput = execSync(`git commit -m "${message}"`, {
|
|
635
747
|
cwd: projectPath,
|
|
636
|
-
encoding: 'utf8'
|
|
748
|
+
encoding: 'utf8',
|
|
637
749
|
});
|
|
638
750
|
output += `Commit:\n${commitOutput}\n\n`;
|
|
639
751
|
}
|
|
@@ -641,7 +753,7 @@ async function executePush(projectPath, branch, message) {
|
|
|
641
753
|
const pushCommand = branch ? `git push origin ${branch}` : 'git push';
|
|
642
754
|
const pushOutput = execSync(pushCommand, {
|
|
643
755
|
cwd: projectPath,
|
|
644
|
-
encoding: 'utf8'
|
|
756
|
+
encoding: 'utf8',
|
|
645
757
|
});
|
|
646
758
|
output += `Push:\n${pushOutput}`;
|
|
647
759
|
return { output, success: true };
|
|
@@ -668,11 +780,13 @@ export async function smartGitPushMcpSafe(args) {
|
|
|
668
780
|
catch (error) {
|
|
669
781
|
// Always return a safe MCP response, never throw
|
|
670
782
|
const errorResponse = {
|
|
671
|
-
content: [
|
|
783
|
+
content: [
|
|
784
|
+
{
|
|
672
785
|
type: 'text',
|
|
673
|
-
text: `# Smart Git Push - Error\n\n**Error**: ${jsonSafeError(error)}\n\nPlease check your git configuration and try again
|
|
674
|
-
}
|
|
675
|
-
|
|
786
|
+
text: `# Smart Git Push - Error\n\n**Error**: ${jsonSafeError(error)}\n\nPlease check your git configuration and try again.`,
|
|
787
|
+
},
|
|
788
|
+
],
|
|
789
|
+
isError: true,
|
|
676
790
|
};
|
|
677
791
|
return validateMcpResponse(errorResponse);
|
|
678
792
|
}
|
|
@@ -683,11 +797,12 @@ export async function smartGitPushMcpSafe(args) {
|
|
|
683
797
|
*/
|
|
684
798
|
async function analyzeKnowledgeGraphContext(projectPath, stagedFiles) {
|
|
685
799
|
const kgManager = new KnowledgeGraphManager();
|
|
686
|
-
|
|
687
|
-
|
|
800
|
+
// TodoJsonManager removed - use mcp-shrimp-task-manager for task management
|
|
801
|
+
console.warn('⚠️ TodoJsonManager is deprecated and was removed in memory-centric transformation');
|
|
688
802
|
// Load knowledge graph and TODO data
|
|
689
803
|
const kg = await kgManager.loadKnowledgeGraph();
|
|
690
|
-
|
|
804
|
+
// Skip todo data loading - TodoJsonManager removed
|
|
805
|
+
const todoData = { tasks: {}, metadata: { totalTasks: 0, completedTasks: 0 } };
|
|
691
806
|
// Get active intents
|
|
692
807
|
const activeIntents = kg.intents.filter(i => i.currentStatus === 'executing' || i.currentStatus === 'planning');
|
|
693
808
|
// Analyze file changes against project context
|
|
@@ -708,7 +823,7 @@ async function analyzeKnowledgeGraphContext(projectPath, stagedFiles) {
|
|
|
708
823
|
blockingConditions,
|
|
709
824
|
architecturalAlignment,
|
|
710
825
|
taskDependencies,
|
|
711
|
-
projectGoalProgress
|
|
826
|
+
projectGoalProgress,
|
|
712
827
|
};
|
|
713
828
|
}
|
|
714
829
|
/**
|
|
@@ -717,7 +832,7 @@ async function analyzeKnowledgeGraphContext(projectPath, stagedFiles) {
|
|
|
717
832
|
async function analyzeFileChangesContext(stagedFiles, activeIntents, todoData) {
|
|
718
833
|
const fileAnalysis = {
|
|
719
834
|
intentAlignment: [],
|
|
720
|
-
todoTaskProgress: []
|
|
835
|
+
todoTaskProgress: [],
|
|
721
836
|
};
|
|
722
837
|
// Check how files relate to active intents
|
|
723
838
|
for (const intent of activeIntents) {
|
|
@@ -735,7 +850,7 @@ async function analyzeFileChangesContext(stagedFiles, activeIntents, todoData) {
|
|
|
735
850
|
fileAnalysis.intentAlignment.push({
|
|
736
851
|
intentId: intent.intentId,
|
|
737
852
|
alignedFiles,
|
|
738
|
-
conflictingFiles
|
|
853
|
+
conflictingFiles,
|
|
739
854
|
});
|
|
740
855
|
}
|
|
741
856
|
// Check how files relate to TODO tasks
|
|
@@ -743,15 +858,15 @@ async function analyzeFileChangesContext(stagedFiles, activeIntents, todoData) {
|
|
|
743
858
|
for (const task of tasks) {
|
|
744
859
|
const relatedFiles = stagedFiles.filter(file => {
|
|
745
860
|
const fileName = basename(file.path);
|
|
746
|
-
return task.title.toLowerCase().includes(fileName.toLowerCase()) ||
|
|
861
|
+
return (task.title.toLowerCase().includes(fileName.toLowerCase()) ||
|
|
747
862
|
task.description?.toLowerCase().includes(fileName.toLowerCase()) ||
|
|
748
|
-
task.title.toLowerCase().includes(file.path.toLowerCase());
|
|
863
|
+
task.title.toLowerCase().includes(file.path.toLowerCase()));
|
|
749
864
|
});
|
|
750
865
|
if (relatedFiles.length > 0) {
|
|
751
866
|
fileAnalysis.todoTaskProgress.push({
|
|
752
867
|
taskId: task.id,
|
|
753
868
|
relatedFiles: relatedFiles.map(f => f.path),
|
|
754
|
-
progressImpact: 'positive' // Assume file changes indicate progress
|
|
869
|
+
progressImpact: 'positive', // Assume file changes indicate progress
|
|
755
870
|
});
|
|
756
871
|
}
|
|
757
872
|
}
|
|
@@ -800,7 +915,7 @@ async function analyzeArchitecturalAlignment(stagedFiles, activeIntents, _projec
|
|
|
800
915
|
return {
|
|
801
916
|
score: Math.max(0, Math.min(100, alignmentScore)),
|
|
802
917
|
details,
|
|
803
|
-
recommendations
|
|
918
|
+
recommendations,
|
|
804
919
|
};
|
|
805
920
|
}
|
|
806
921
|
/**
|
|
@@ -834,7 +949,7 @@ async function analyzeProjectGoalProgress(_kg, _todoData, activeIntents) {
|
|
|
834
949
|
intentId: intent.intentId,
|
|
835
950
|
humanRequest: intent.humanRequest,
|
|
836
951
|
progress,
|
|
837
|
-
status: intent.currentStatus
|
|
952
|
+
status: intent.currentStatus,
|
|
838
953
|
};
|
|
839
954
|
});
|
|
840
955
|
const overallProgress = intentProgress.length > 0
|
|
@@ -842,7 +957,7 @@ async function analyzeProjectGoalProgress(_kg, _todoData, activeIntents) {
|
|
|
842
957
|
: 0;
|
|
843
958
|
return {
|
|
844
959
|
overallProgress,
|
|
845
|
-
intentProgress
|
|
960
|
+
intentProgress,
|
|
846
961
|
};
|
|
847
962
|
}
|
|
848
963
|
/**
|
|
@@ -857,7 +972,7 @@ async function determineBlockingConditions(_fileAnalysis, architecturalAlignment
|
|
|
857
972
|
severity: 'error',
|
|
858
973
|
message: `${taskDependencies.blocking.length} critical tasks are blocking this push`,
|
|
859
974
|
recommendation: 'Complete or unblock critical tasks before pushing',
|
|
860
|
-
affectedFiles: stagedFiles.map(f => f.path)
|
|
975
|
+
affectedFiles: stagedFiles.map(f => f.path),
|
|
861
976
|
});
|
|
862
977
|
}
|
|
863
978
|
// Check architectural alignment
|
|
@@ -867,7 +982,7 @@ async function determineBlockingConditions(_fileAnalysis, architecturalAlignment
|
|
|
867
982
|
severity: 'warning',
|
|
868
983
|
message: `Low architectural alignment score: ${architecturalAlignment.score}%`,
|
|
869
984
|
recommendation: 'Review architectural compliance of changes',
|
|
870
|
-
affectedFiles: stagedFiles.map(f => f.path)
|
|
985
|
+
affectedFiles: stagedFiles.map(f => f.path),
|
|
871
986
|
});
|
|
872
987
|
}
|
|
873
988
|
// Check goal regression
|
|
@@ -877,7 +992,7 @@ async function determineBlockingConditions(_fileAnalysis, architecturalAlignment
|
|
|
877
992
|
severity: 'warning',
|
|
878
993
|
message: `Low project goal progress: ${projectGoalProgress.overallProgress}%`,
|
|
879
994
|
recommendation: 'Focus on completing active project goals',
|
|
880
|
-
affectedFiles: stagedFiles.map(f => f.path)
|
|
995
|
+
affectedFiles: stagedFiles.map(f => f.path),
|
|
881
996
|
});
|
|
882
997
|
}
|
|
883
998
|
return blockingConditions;
|
|
@@ -893,113 +1008,4 @@ async function findRelevantAdrs(_stagedFiles, _projectPath) {
|
|
|
893
1008
|
/**
|
|
894
1009
|
* Update TODO tasks based on successful git push with Knowledge Graph integration
|
|
895
1010
|
*/
|
|
896
|
-
async function updateTodoTasksFromGitPushWithKG(todoManager, stagedFiles, kgAnalysis, releaseReadinessResult) {
|
|
897
|
-
try {
|
|
898
|
-
// Create intent for this git push
|
|
899
|
-
const kgManager = new KnowledgeGraphManager();
|
|
900
|
-
const intentId = await kgManager.createIntent(`Git push: ${stagedFiles.length} files`, [`Push ${stagedFiles.map(f => f.path).join(', ')}`], 'medium');
|
|
901
|
-
// Record tool execution
|
|
902
|
-
await kgManager.addToolExecution(intentId, 'smart_git_push', {
|
|
903
|
-
files: stagedFiles.map(f => f.path),
|
|
904
|
-
branch: 'current',
|
|
905
|
-
knowledgeGraphAnalysis: true
|
|
906
|
-
}, {
|
|
907
|
-
success: true,
|
|
908
|
-
filesProcessed: stagedFiles.length,
|
|
909
|
-
architecturalAlignment: kgAnalysis.architecturalAlignment.score
|
|
910
|
-
}, true, [], // todoTasksCreated
|
|
911
|
-
kgAnalysis.taskDependencies.completed // todoTasksModified
|
|
912
|
-
);
|
|
913
|
-
// Update intent status
|
|
914
|
-
await kgManager.updateIntentStatus(intentId, 'completed');
|
|
915
|
-
// Update TODO tasks
|
|
916
|
-
await updateTodoTasksFromGitPush(todoManager, stagedFiles, releaseReadinessResult);
|
|
917
|
-
}
|
|
918
|
-
catch (error) {
|
|
919
|
-
console.error('Error updating TODO tasks with KG:', error);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
/**
|
|
923
|
-
* Update TODO tasks based on successful git push
|
|
924
|
-
*/
|
|
925
|
-
async function updateTodoTasksFromGitPush(todoManager, stagedFiles, releaseReadinessResult) {
|
|
926
|
-
try {
|
|
927
|
-
const data = await todoManager.loadTodoData();
|
|
928
|
-
const tasks = Object.values(data.tasks);
|
|
929
|
-
// 1. Auto-update tasks based on file changes
|
|
930
|
-
for (const file of stagedFiles) {
|
|
931
|
-
// Look for tasks that mention this file in their title or description
|
|
932
|
-
const relatedTasks = tasks.filter(task => task.title.toLowerCase().includes(basename(file.path).toLowerCase()) ||
|
|
933
|
-
task.description?.toLowerCase().includes(basename(file.path).toLowerCase()) ||
|
|
934
|
-
task.title.toLowerCase().includes(file.path.toLowerCase()));
|
|
935
|
-
for (const task of relatedTasks) {
|
|
936
|
-
if (task.status === 'pending' || task.status === 'in_progress') {
|
|
937
|
-
// Update to in_progress if pending, or completed if already in_progress
|
|
938
|
-
const newStatus = task.status === 'pending' ? 'in_progress' : 'completed';
|
|
939
|
-
await todoManager.updateTask({
|
|
940
|
-
taskId: task.id,
|
|
941
|
-
updates: {
|
|
942
|
-
status: newStatus,
|
|
943
|
-
notes: `Auto-updated: ${file.path} was ${file.status} in git push`
|
|
944
|
-
},
|
|
945
|
-
reason: `Git push: ${file.path} ${file.status}`,
|
|
946
|
-
triggeredBy: 'tool'
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
// 2. Create follow-up tasks based on what was pushed
|
|
952
|
-
const followUpTasks = [];
|
|
953
|
-
// If documentation files were changed, create review tasks
|
|
954
|
-
const docFiles = stagedFiles.filter(f => f.path.match(/\.(md|txt|rst)$/i) &&
|
|
955
|
-
!f.path.includes('TODO.md'));
|
|
956
|
-
if (docFiles.length > 0) {
|
|
957
|
-
followUpTasks.push({
|
|
958
|
-
title: `Review updated documentation`,
|
|
959
|
-
description: `Review changes to: ${docFiles.map(f => f.path).join(', ')}`,
|
|
960
|
-
priority: 'medium',
|
|
961
|
-
category: 'documentation',
|
|
962
|
-
tags: ['review', 'documentation']
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
// If source code was changed, create testing tasks
|
|
966
|
-
const codeFiles = stagedFiles.filter(f => f.path.match(/\.(ts|js|py|java|cs|go|rb|php|swift|kt|rs|cpp|c|h)$/i));
|
|
967
|
-
if (codeFiles.length > 0) {
|
|
968
|
-
followUpTasks.push({
|
|
969
|
-
title: `Test changes in ${codeFiles.length} code files`,
|
|
970
|
-
description: `Verify functionality of: ${codeFiles.map(f => f.path).join(', ')}`,
|
|
971
|
-
priority: 'high',
|
|
972
|
-
category: 'testing',
|
|
973
|
-
tags: ['testing', 'verification']
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
// If release readiness improved, create release tasks
|
|
977
|
-
if (releaseReadinessResult?.isReady) {
|
|
978
|
-
const existingReleaseTasks = tasks.filter(task => task.title.toLowerCase().includes('release') ||
|
|
979
|
-
task.tags?.includes('release'));
|
|
980
|
-
if (existingReleaseTasks.length === 0) {
|
|
981
|
-
followUpTasks.push({
|
|
982
|
-
title: `Prepare release - all requirements met`,
|
|
983
|
-
description: `Project is now release-ready. Create release tag and publish.`,
|
|
984
|
-
priority: 'critical',
|
|
985
|
-
category: 'release',
|
|
986
|
-
tags: ['release', 'deployment']
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
// Create follow-up tasks
|
|
991
|
-
for (const taskData of followUpTasks) {
|
|
992
|
-
await todoManager.createTask(taskData);
|
|
993
|
-
}
|
|
994
|
-
// 3. Update task metadata with git information
|
|
995
|
-
const now = new Date().toISOString();
|
|
996
|
-
data.metadata.lastGitPush = now;
|
|
997
|
-
data.metadata.lastPushFiles = stagedFiles.map(f => f.path);
|
|
998
|
-
await todoManager.saveTodoData(data);
|
|
999
|
-
}
|
|
1000
|
-
catch (error) {
|
|
1001
|
-
// Silently handle errors to avoid breaking git push
|
|
1002
|
-
console.error('Error updating TODO tasks from git push:', error);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
1011
|
//# sourceMappingURL=smart-git-push-tool.js.map
|