centient 2.20.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/CHANGELOG.md +362 -0
- package/README.md +433 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +478 -0
- package/dist/server.js.map +1 -0
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +3 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/instrumentation.d.ts +10 -0
- package/dist/telemetry/instrumentation.d.ts.map +1 -0
- package/dist/telemetry/instrumentation.js +86 -0
- package/dist/telemetry/instrumentation.js.map +1 -0
- package/dist/telemetry/tracer.d.ts +6 -0
- package/dist/telemetry/tracer.d.ts.map +1 -0
- package/dist/telemetry/tracer.js +27 -0
- package/dist/telemetry/tracer.js.map +1 -0
- package/dist/tools/artifacts/diffSessions.d.ts +9 -0
- package/dist/tools/artifacts/diffSessions.d.ts.map +1 -0
- package/dist/tools/artifacts/diffSessions.js +320 -0
- package/dist/tools/artifacts/diffSessions.js.map +1 -0
- package/dist/tools/artifacts/extractSessionContext.d.ts +9 -0
- package/dist/tools/artifacts/extractSessionContext.d.ts.map +1 -0
- package/dist/tools/artifacts/extractSessionContext.js +291 -0
- package/dist/tools/artifacts/extractSessionContext.js.map +1 -0
- package/dist/tools/artifacts/getSessionCode.d.ts +9 -0
- package/dist/tools/artifacts/getSessionCode.d.ts.map +1 -0
- package/dist/tools/artifacts/getSessionCode.js +104 -0
- package/dist/tools/artifacts/getSessionCode.js.map +1 -0
- package/dist/tools/artifacts/loadSession.d.ts +9 -0
- package/dist/tools/artifacts/loadSession.d.ts.map +1 -0
- package/dist/tools/artifacts/loadSession.js +163 -0
- package/dist/tools/artifacts/loadSession.js.map +1 -0
- package/dist/tools/artifacts/searchArtifacts.d.ts +9 -0
- package/dist/tools/artifacts/searchArtifacts.d.ts.map +1 -0
- package/dist/tools/artifacts/searchArtifacts.js +98 -0
- package/dist/tools/artifacts/searchArtifacts.js.map +1 -0
- package/dist/tools/branching/closeBranch.d.ts +10 -0
- package/dist/tools/branching/closeBranch.d.ts.map +1 -0
- package/dist/tools/branching/closeBranch.js +193 -0
- package/dist/tools/branching/closeBranch.js.map +1 -0
- package/dist/tools/branching/createBranch.d.ts +10 -0
- package/dist/tools/branching/createBranch.d.ts.map +1 -0
- package/dist/tools/branching/createBranch.js +136 -0
- package/dist/tools/branching/createBranch.js.map +1 -0
- package/dist/tools/branching/listBranches.d.ts +9 -0
- package/dist/tools/branching/listBranches.d.ts.map +1 -0
- package/dist/tools/branching/listBranches.js +212 -0
- package/dist/tools/branching/listBranches.js.map +1 -0
- package/dist/tools/branching/listDecisionPoints.d.ts +9 -0
- package/dist/tools/branching/listDecisionPoints.d.ts.map +1 -0
- package/dist/tools/branching/listDecisionPoints.js +156 -0
- package/dist/tools/branching/listDecisionPoints.js.map +1 -0
- package/dist/tools/branching/markDecisionPoint.d.ts +10 -0
- package/dist/tools/branching/markDecisionPoint.d.ts.map +1 -0
- package/dist/tools/branching/markDecisionPoint.js +149 -0
- package/dist/tools/branching/markDecisionPoint.js.map +1 -0
- package/dist/tools/branching/switchBranch.d.ts +9 -0
- package/dist/tools/branching/switchBranch.d.ts.map +1 -0
- package/dist/tools/branching/switchBranch.js +153 -0
- package/dist/tools/branching/switchBranch.js.map +1 -0
- package/dist/tools/consultation/aggregateConsensus.d.ts +9 -0
- package/dist/tools/consultation/aggregateConsensus.d.ts.map +1 -0
- package/dist/tools/consultation/aggregateConsensus.js +259 -0
- package/dist/tools/consultation/aggregateConsensus.js.map +1 -0
- package/dist/tools/consultation/captureConsultationResponse.d.ts +11 -0
- package/dist/tools/consultation/captureConsultationResponse.d.ts.map +1 -0
- package/dist/tools/consultation/captureConsultationResponse.js +244 -0
- package/dist/tools/consultation/captureConsultationResponse.js.map +1 -0
- package/dist/tools/consultation/consultLlmStream.d.ts +9 -0
- package/dist/tools/consultation/consultLlmStream.d.ts.map +1 -0
- package/dist/tools/consultation/consultLlmStream.js +201 -0
- package/dist/tools/consultation/consultLlmStream.js.map +1 -0
- package/dist/tools/consultation/index.d.ts +8 -0
- package/dist/tools/consultation/index.d.ts.map +1 -0
- package/dist/tools/consultation/index.js +8 -0
- package/dist/tools/consultation/index.js.map +1 -0
- package/dist/tools/consultation/peerReviewContract.d.ts +146 -0
- package/dist/tools/consultation/peerReviewContract.d.ts.map +1 -0
- package/dist/tools/consultation/peerReviewContract.js +731 -0
- package/dist/tools/consultation/peerReviewContract.js.map +1 -0
- package/dist/tools/consultation/peerReviewSession.d.ts +9 -0
- package/dist/tools/consultation/peerReviewSession.d.ts.map +1 -0
- package/dist/tools/consultation/peerReviewSession.js +433 -0
- package/dist/tools/consultation/peerReviewSession.js.map +1 -0
- package/dist/tools/consultation/prepareConsultationContext.d.ts +9 -0
- package/dist/tools/consultation/prepareConsultationContext.d.ts.map +1 -0
- package/dist/tools/consultation/prepareConsultationContext.js +263 -0
- package/dist/tools/consultation/prepareConsultationContext.js.map +1 -0
- package/dist/tools/consultation/seekConsensus.d.ts +9 -0
- package/dist/tools/consultation/seekConsensus.d.ts.map +1 -0
- package/dist/tools/consultation/seekConsensus.js +358 -0
- package/dist/tools/consultation/seekConsensus.js.map +1 -0
- package/dist/tools/consultation/validateDecision.d.ts +9 -0
- package/dist/tools/consultation/validateDecision.d.ts.map +1 -0
- package/dist/tools/consultation/validateDecision.js +253 -0
- package/dist/tools/consultation/validateDecision.js.map +1 -0
- package/dist/tools/consultation/validateReviewResponse.d.ts +9 -0
- package/dist/tools/consultation/validateReviewResponse.d.ts.map +1 -0
- package/dist/tools/consultation/validateReviewResponse.js +105 -0
- package/dist/tools/consultation/validateReviewResponse.js.map +1 -0
- package/dist/tools/graph/addNoteRelationship.d.ts +9 -0
- package/dist/tools/graph/addNoteRelationship.d.ts.map +1 -0
- package/dist/tools/graph/addNoteRelationship.js +120 -0
- package/dist/tools/graph/addNoteRelationship.js.map +1 -0
- package/dist/tools/graph/linkSessions.d.ts +9 -0
- package/dist/tools/graph/linkSessions.d.ts.map +1 -0
- package/dist/tools/graph/linkSessions.js +126 -0
- package/dist/tools/graph/linkSessions.js.map +1 -0
- package/dist/tools/graph/queryTemporalGraph.d.ts +9 -0
- package/dist/tools/graph/queryTemporalGraph.d.ts.map +1 -0
- package/dist/tools/graph/queryTemporalGraph.js +339 -0
- package/dist/tools/graph/queryTemporalGraph.js.map +1 -0
- package/dist/tools/health/getCircuitBreakerStats.d.ts +9 -0
- package/dist/tools/health/getCircuitBreakerStats.d.ts.map +1 -0
- package/dist/tools/health/getCircuitBreakerStats.js +195 -0
- package/dist/tools/health/getCircuitBreakerStats.js.map +1 -0
- package/dist/tools/health/getContextHealth.d.ts +9 -0
- package/dist/tools/health/getContextHealth.d.ts.map +1 -0
- package/dist/tools/health/getContextHealth.js +331 -0
- package/dist/tools/health/getContextHealth.js.map +1 -0
- package/dist/tools/health/getQdrantHealth.d.ts +9 -0
- package/dist/tools/health/getQdrantHealth.d.ts.map +1 -0
- package/dist/tools/health/getQdrantHealth.js +144 -0
- package/dist/tools/health/getQdrantHealth.js.map +1 -0
- package/dist/tools/health/getRateLimitStats.d.ts +9 -0
- package/dist/tools/health/getRateLimitStats.d.ts.map +1 -0
- package/dist/tools/health/getRateLimitStats.js +191 -0
- package/dist/tools/health/getRateLimitStats.js.map +1 -0
- package/dist/tools/knowledge/index.d.ts +4 -0
- package/dist/tools/knowledge/index.d.ts.map +1 -0
- package/dist/tools/knowledge/index.js +4 -0
- package/dist/tools/knowledge/index.js.map +1 -0
- package/dist/tools/knowledge/promoteDecision.d.ts +9 -0
- package/dist/tools/knowledge/promoteDecision.d.ts.map +1 -0
- package/dist/tools/knowledge/promoteDecision.js +139 -0
- package/dist/tools/knowledge/promoteDecision.js.map +1 -0
- package/dist/tools/knowledge/promoteLearning.d.ts +9 -0
- package/dist/tools/knowledge/promoteLearning.d.ts.map +1 -0
- package/dist/tools/knowledge/promoteLearning.js +132 -0
- package/dist/tools/knowledge/promoteLearning.js.map +1 -0
- package/dist/tools/knowledge/searchMetaKnowledge.d.ts +9 -0
- package/dist/tools/knowledge/searchMetaKnowledge.d.ts.map +1 -0
- package/dist/tools/knowledge/searchMetaKnowledge.js +120 -0
- package/dist/tools/knowledge/searchMetaKnowledge.js.map +1 -0
- package/dist/tools/memory/addNote.d.ts +9 -0
- package/dist/tools/memory/addNote.d.ts.map +1 -0
- package/dist/tools/memory/addNote.js +105 -0
- package/dist/tools/memory/addNote.js.map +1 -0
- package/dist/tools/memory/getDecisions.d.ts +9 -0
- package/dist/tools/memory/getDecisions.d.ts.map +1 -0
- package/dist/tools/memory/getDecisions.js +93 -0
- package/dist/tools/memory/getDecisions.js.map +1 -0
- package/dist/tools/memory/getHypotheses.d.ts +9 -0
- package/dist/tools/memory/getHypotheses.d.ts.map +1 -0
- package/dist/tools/memory/getHypotheses.js +93 -0
- package/dist/tools/memory/getHypotheses.js.map +1 -0
- package/dist/tools/memory-bank/memoryBankList.d.ts +9 -0
- package/dist/tools/memory-bank/memoryBankList.d.ts.map +1 -0
- package/dist/tools/memory-bank/memoryBankList.js +108 -0
- package/dist/tools/memory-bank/memoryBankList.js.map +1 -0
- package/dist/tools/memory-bank/memoryBankSearch.d.ts +9 -0
- package/dist/tools/memory-bank/memoryBankSearch.d.ts.map +1 -0
- package/dist/tools/memory-bank/memoryBankSearch.js +128 -0
- package/dist/tools/memory-bank/memoryBankSearch.js.map +1 -0
- package/dist/tools/metrics/getAuditLog.d.ts +9 -0
- package/dist/tools/metrics/getAuditLog.d.ts.map +1 -0
- package/dist/tools/metrics/getAuditLog.js +172 -0
- package/dist/tools/metrics/getAuditLog.js.map +1 -0
- package/dist/tools/metrics/getCompressionRatio.d.ts +9 -0
- package/dist/tools/metrics/getCompressionRatio.d.ts.map +1 -0
- package/dist/tools/metrics/getCompressionRatio.js +112 -0
- package/dist/tools/metrics/getCompressionRatio.js.map +1 -0
- package/dist/tools/metrics/getCostDashboard.d.ts +9 -0
- package/dist/tools/metrics/getCostDashboard.d.ts.map +1 -0
- package/dist/tools/metrics/getCostDashboard.js +126 -0
- package/dist/tools/metrics/getCostDashboard.js.map +1 -0
- package/dist/tools/metrics/getPatternAnalytics.d.ts +9 -0
- package/dist/tools/metrics/getPatternAnalytics.d.ts.map +1 -0
- package/dist/tools/metrics/getPatternAnalytics.js +192 -0
- package/dist/tools/metrics/getPatternAnalytics.js.map +1 -0
- package/dist/tools/metrics/getPatternReuse.d.ts +9 -0
- package/dist/tools/metrics/getPatternReuse.d.ts.map +1 -0
- package/dist/tools/metrics/getPatternReuse.js +130 -0
- package/dist/tools/metrics/getPatternReuse.js.map +1 -0
- package/dist/tools/patterns/createPatternVersion.d.ts +9 -0
- package/dist/tools/patterns/createPatternVersion.d.ts.map +1 -0
- package/dist/tools/patterns/createPatternVersion.js +137 -0
- package/dist/tools/patterns/createPatternVersion.js.map +1 -0
- package/dist/tools/patterns/deprecatePatternVersion.d.ts +9 -0
- package/dist/tools/patterns/deprecatePatternVersion.d.ts.map +1 -0
- package/dist/tools/patterns/deprecatePatternVersion.js +131 -0
- package/dist/tools/patterns/deprecatePatternVersion.js.map +1 -0
- package/dist/tools/patterns/diffPatterns.d.ts +9 -0
- package/dist/tools/patterns/diffPatterns.d.ts.map +1 -0
- package/dist/tools/patterns/diffPatterns.js +402 -0
- package/dist/tools/patterns/diffPatterns.js.map +1 -0
- package/dist/tools/patterns/executeSkill.d.ts +9 -0
- package/dist/tools/patterns/executeSkill.d.ts.map +1 -0
- package/dist/tools/patterns/executeSkill.js +230 -0
- package/dist/tools/patterns/executeSkill.js.map +1 -0
- package/dist/tools/patterns/findPatterns.d.ts +9 -0
- package/dist/tools/patterns/findPatterns.d.ts.map +1 -0
- package/dist/tools/patterns/findPatterns.js +164 -0
- package/dist/tools/patterns/findPatterns.js.map +1 -0
- package/dist/tools/patterns/getPatternVersions.d.ts +9 -0
- package/dist/tools/patterns/getPatternVersions.d.ts.map +1 -0
- package/dist/tools/patterns/getPatternVersions.js +114 -0
- package/dist/tools/patterns/getPatternVersions.js.map +1 -0
- package/dist/tools/patterns/indexPatternLibrary.d.ts +9 -0
- package/dist/tools/patterns/indexPatternLibrary.d.ts.map +1 -0
- package/dist/tools/patterns/indexPatternLibrary.js +228 -0
- package/dist/tools/patterns/indexPatternLibrary.js.map +1 -0
- package/dist/tools/patterns/loadSkill.d.ts +9 -0
- package/dist/tools/patterns/loadSkill.d.ts.map +1 -0
- package/dist/tools/patterns/loadSkill.js +229 -0
- package/dist/tools/patterns/loadSkill.js.map +1 -0
- package/dist/tools/patterns/predictOutcome.d.ts +9 -0
- package/dist/tools/patterns/predictOutcome.d.ts.map +1 -0
- package/dist/tools/patterns/predictOutcome.js +256 -0
- package/dist/tools/patterns/predictOutcome.js.map +1 -0
- package/dist/tools/patterns/recommendPatterns.d.ts +9 -0
- package/dist/tools/patterns/recommendPatterns.d.ts.map +1 -0
- package/dist/tools/patterns/recommendPatterns.js +278 -0
- package/dist/tools/patterns/recommendPatterns.js.map +1 -0
- package/dist/tools/patterns/searchPatterns.d.ts +9 -0
- package/dist/tools/patterns/searchPatterns.d.ts.map +1 -0
- package/dist/tools/patterns/searchPatterns.js +144 -0
- package/dist/tools/patterns/searchPatterns.js.map +1 -0
- package/dist/tools/patterns/signPattern.d.ts +9 -0
- package/dist/tools/patterns/signPattern.d.ts.map +1 -0
- package/dist/tools/patterns/signPattern.js +147 -0
- package/dist/tools/patterns/signPattern.js.map +1 -0
- package/dist/tools/patterns/trackPatternUsage.d.ts +9 -0
- package/dist/tools/patterns/trackPatternUsage.d.ts.map +1 -0
- package/dist/tools/patterns/trackPatternUsage.js +126 -0
- package/dist/tools/patterns/trackPatternUsage.js.map +1 -0
- package/dist/tools/research/approveResearchPlan.d.ts +9 -0
- package/dist/tools/research/approveResearchPlan.d.ts.map +1 -0
- package/dist/tools/research/approveResearchPlan.js +204 -0
- package/dist/tools/research/approveResearchPlan.js.map +1 -0
- package/dist/tools/research/generateResearchPlan.d.ts +9 -0
- package/dist/tools/research/generateResearchPlan.d.ts.map +1 -0
- package/dist/tools/research/generateResearchPlan.js +347 -0
- package/dist/tools/research/generateResearchPlan.js.map +1 -0
- package/dist/tools/research/listResearchSessions.d.ts +9 -0
- package/dist/tools/research/listResearchSessions.d.ts.map +1 -0
- package/dist/tools/research/listResearchSessions.js +108 -0
- package/dist/tools/research/listResearchSessions.js.map +1 -0
- package/dist/tools/research/suggestModelForResearch.d.ts +9 -0
- package/dist/tools/research/suggestModelForResearch.d.ts.map +1 -0
- package/dist/tools/research/suggestModelForResearch.js +416 -0
- package/dist/tools/research/suggestModelForResearch.js.map +1 -0
- package/dist/tools/research/trackResearchProgress.d.ts +9 -0
- package/dist/tools/research/trackResearchProgress.d.ts.map +1 -0
- package/dist/tools/research/trackResearchProgress.js +177 -0
- package/dist/tools/research/trackResearchProgress.js.map +1 -0
- package/dist/tools/rlvr/rlvrExecute.d.ts +9 -0
- package/dist/tools/rlvr/rlvrExecute.d.ts.map +1 -0
- package/dist/tools/rlvr/rlvrExecute.js +296 -0
- package/dist/tools/rlvr/rlvrExecute.js.map +1 -0
- package/dist/tools/search/getSearchStats.d.ts +9 -0
- package/dist/tools/search/getSearchStats.d.ts.map +1 -0
- package/dist/tools/search/getSearchStats.js +107 -0
- package/dist/tools/search/getSearchStats.js.map +1 -0
- package/dist/tools/search/index.d.ts +4 -0
- package/dist/tools/search/index.d.ts.map +1 -0
- package/dist/tools/search/index.js +4 -0
- package/dist/tools/search/index.js.map +1 -0
- package/dist/tools/search/indexSession.d.ts +9 -0
- package/dist/tools/search/indexSession.d.ts.map +1 -0
- package/dist/tools/search/indexSession.js +254 -0
- package/dist/tools/search/indexSession.js.map +1 -0
- package/dist/tools/search/semanticSearch.d.ts +9 -0
- package/dist/tools/search/semanticSearch.d.ts.map +1 -0
- package/dist/tools/search/semanticSearch.js +171 -0
- package/dist/tools/search/semanticSearch.js.map +1 -0
- package/dist/tools/session/askSession.d.ts +9 -0
- package/dist/tools/session/askSession.d.ts.map +1 -0
- package/dist/tools/session/askSession.js +311 -0
- package/dist/tools/session/askSession.js.map +1 -0
- package/dist/tools/session/checkClaimConsistency.d.ts +9 -0
- package/dist/tools/session/checkClaimConsistency.d.ts.map +1 -0
- package/dist/tools/session/checkClaimConsistency.js +343 -0
- package/dist/tools/session/checkClaimConsistency.js.map +1 -0
- package/dist/tools/session/checkCodeFeasibility.d.ts +19 -0
- package/dist/tools/session/checkCodeFeasibility.d.ts.map +1 -0
- package/dist/tools/session/checkCodeFeasibility.js +766 -0
- package/dist/tools/session/checkCodeFeasibility.js.map +1 -0
- package/dist/tools/session/checkConstraintViolation.d.ts +9 -0
- package/dist/tools/session/checkConstraintViolation.d.ts.map +1 -0
- package/dist/tools/session/checkConstraintViolation.js +98 -0
- package/dist/tools/session/checkConstraintViolation.js.map +1 -0
- package/dist/tools/session/checkDuplicateWork.d.ts +9 -0
- package/dist/tools/session/checkDuplicateWork.d.ts.map +1 -0
- package/dist/tools/session/checkDuplicateWork.js +105 -0
- package/dist/tools/session/checkDuplicateWork.js.map +1 -0
- package/dist/tools/session/extractSessionMemories.d.ts +9 -0
- package/dist/tools/session/extractSessionMemories.d.ts.map +1 -0
- package/dist/tools/session/extractSessionMemories.js +203 -0
- package/dist/tools/session/extractSessionMemories.js.map +1 -0
- package/dist/tools/session/finalizeSessionCoordination.d.ts +9 -0
- package/dist/tools/session/finalizeSessionCoordination.d.ts.map +1 -0
- package/dist/tools/session/finalizeSessionCoordination.js +85 -0
- package/dist/tools/session/finalizeSessionCoordination.js.map +1 -0
- package/dist/tools/session/flagForVerification.d.ts +17 -0
- package/dist/tools/session/flagForVerification.d.ts.map +1 -0
- package/dist/tools/session/flagForVerification.js +232 -0
- package/dist/tools/session/flagForVerification.js.map +1 -0
- package/dist/tools/session/getConstraints.d.ts +9 -0
- package/dist/tools/session/getConstraints.d.ts.map +1 -0
- package/dist/tools/session/getConstraints.js +84 -0
- package/dist/tools/session/getConstraints.js.map +1 -0
- package/dist/tools/session/getSessionStats.d.ts +9 -0
- package/dist/tools/session/getSessionStats.d.ts.map +1 -0
- package/dist/tools/session/getSessionStats.js +86 -0
- package/dist/tools/session/getSessionStats.js.map +1 -0
- package/dist/tools/session/getSessionSummary.d.ts +9 -0
- package/dist/tools/session/getSessionSummary.d.ts.map +1 -0
- package/dist/tools/session/getSessionSummary.js +360 -0
- package/dist/tools/session/getSessionSummary.js.map +1 -0
- package/dist/tools/session/getVerificationPrompt.d.ts +9 -0
- package/dist/tools/session/getVerificationPrompt.d.ts.map +1 -0
- package/dist/tools/session/getVerificationPrompt.js +210 -0
- package/dist/tools/session/getVerificationPrompt.js.map +1 -0
- package/dist/tools/session/liftConstraint.d.ts +9 -0
- package/dist/tools/session/liftConstraint.d.ts.map +1 -0
- package/dist/tools/session/liftConstraint.js +94 -0
- package/dist/tools/session/liftConstraint.js.map +1 -0
- package/dist/tools/session/recordVerificationOutcome.d.ts +24 -0
- package/dist/tools/session/recordVerificationOutcome.d.ts.map +1 -0
- package/dist/tools/session/recordVerificationOutcome.js +237 -0
- package/dist/tools/session/recordVerificationOutcome.js.map +1 -0
- package/dist/tools/session/saveSessionNote.d.ts +9 -0
- package/dist/tools/session/saveSessionNote.d.ts.map +1 -0
- package/dist/tools/session/saveSessionNote.js +213 -0
- package/dist/tools/session/saveSessionNote.js.map +1 -0
- package/dist/tools/session/sessionSearch.d.ts +9 -0
- package/dist/tools/session/sessionSearch.d.ts.map +1 -0
- package/dist/tools/session/sessionSearch.js +116 -0
- package/dist/tools/session/sessionSearch.js.map +1 -0
- package/dist/tools/session/startSessionCoordination.d.ts +13 -0
- package/dist/tools/session/startSessionCoordination.d.ts.map +1 -0
- package/dist/tools/session/startSessionCoordination.js +126 -0
- package/dist/tools/session/startSessionCoordination.js.map +1 -0
- package/dist/tools/session/trackApprovalFingerprint.d.ts +19 -0
- package/dist/tools/session/trackApprovalFingerprint.d.ts.map +1 -0
- package/dist/tools/session/trackApprovalFingerprint.js +172 -0
- package/dist/tools/session/trackApprovalFingerprint.js.map +1 -0
- package/dist/tools/session/trackConstraint.d.ts +9 -0
- package/dist/tools/session/trackConstraint.d.ts.map +1 -0
- package/dist/tools/session/trackConstraint.js +101 -0
- package/dist/tools/session/trackConstraint.js.map +1 -0
- package/dist/tools/session/validateCitation.d.ts +9 -0
- package/dist/tools/session/validateCitation.d.ts.map +1 -0
- package/dist/tools/session/validateCitation.js +450 -0
- package/dist/tools/session/validateCitation.js.map +1 -0
- package/dist/tools/stuck/checkStuckPattern.d.ts +9 -0
- package/dist/tools/stuck/checkStuckPattern.d.ts.map +1 -0
- package/dist/tools/stuck/checkStuckPattern.js +93 -0
- package/dist/tools/stuck/checkStuckPattern.js.map +1 -0
- package/dist/tools/stuck/getRecoverySuggestions.d.ts +9 -0
- package/dist/tools/stuck/getRecoverySuggestions.d.ts.map +1 -0
- package/dist/tools/stuck/getRecoverySuggestions.js +132 -0
- package/dist/tools/stuck/getRecoverySuggestions.js.map +1 -0
- package/dist/types/research.d.ts +76 -0
- package/dist/types/research.d.ts.map +1 -0
- package/dist/types/research.js +2 -0
- package/dist/types/research.js.map +1 -0
- package/dist/types/temporal-graph.d.ts +97 -0
- package/dist/types/temporal-graph.d.ts.map +1 -0
- package/dist/types/temporal-graph.js +2 -0
- package/dist/types/temporal-graph.js.map +1 -0
- package/dist/utils/AuditLogger.d.ts +99 -0
- package/dist/utils/AuditLogger.d.ts.map +1 -0
- package/dist/utils/AuditLogger.js +303 -0
- package/dist/utils/AuditLogger.js.map +1 -0
- package/dist/utils/CacheManager.d.ts +56 -0
- package/dist/utils/CacheManager.d.ts.map +1 -0
- package/dist/utils/CacheManager.js +184 -0
- package/dist/utils/CacheManager.js.map +1 -0
- package/dist/utils/CircuitBreaker.d.ts +76 -0
- package/dist/utils/CircuitBreaker.d.ts.map +1 -0
- package/dist/utils/CircuitBreaker.js +236 -0
- package/dist/utils/CircuitBreaker.js.map +1 -0
- package/dist/utils/CostTracker.d.ts +83 -0
- package/dist/utils/CostTracker.d.ts.map +1 -0
- package/dist/utils/CostTracker.js +228 -0
- package/dist/utils/CostTracker.js.map +1 -0
- package/dist/utils/DockerSandbox.d.ts +39 -0
- package/dist/utils/DockerSandbox.d.ts.map +1 -0
- package/dist/utils/DockerSandbox.js +277 -0
- package/dist/utils/DockerSandbox.js.map +1 -0
- package/dist/utils/FinalizationCompressor.d.ts +70 -0
- package/dist/utils/FinalizationCompressor.d.ts.map +1 -0
- package/dist/utils/FinalizationCompressor.js +295 -0
- package/dist/utils/FinalizationCompressor.js.map +1 -0
- package/dist/utils/MetaKnowledgeManager.d.ts +63 -0
- package/dist/utils/MetaKnowledgeManager.d.ts.map +1 -0
- package/dist/utils/MetaKnowledgeManager.js +152 -0
- package/dist/utils/MetaKnowledgeManager.js.map +1 -0
- package/dist/utils/PatternIndexer.d.ts +83 -0
- package/dist/utils/PatternIndexer.d.ts.map +1 -0
- package/dist/utils/PatternIndexer.js +730 -0
- package/dist/utils/PatternIndexer.js.map +1 -0
- package/dist/utils/PatternUsageTracker.d.ts +97 -0
- package/dist/utils/PatternUsageTracker.d.ts.map +1 -0
- package/dist/utils/PatternUsageTracker.js +352 -0
- package/dist/utils/PatternUsageTracker.js.map +1 -0
- package/dist/utils/PatternVerifier.d.ts +71 -0
- package/dist/utils/PatternVerifier.d.ts.map +1 -0
- package/dist/utils/PatternVerifier.js +328 -0
- package/dist/utils/PatternVerifier.js.map +1 -0
- package/dist/utils/PatternVersionManager.d.ts +47 -0
- package/dist/utils/PatternVersionManager.d.ts.map +1 -0
- package/dist/utils/PatternVersionManager.js +308 -0
- package/dist/utils/PatternVersionManager.js.map +1 -0
- package/dist/utils/QdrantConnectionManager.d.ts +47 -0
- package/dist/utils/QdrantConnectionManager.d.ts.map +1 -0
- package/dist/utils/QdrantConnectionManager.js +228 -0
- package/dist/utils/QdrantConnectionManager.js.map +1 -0
- package/dist/utils/RateLimiter.d.ts +85 -0
- package/dist/utils/RateLimiter.d.ts.map +1 -0
- package/dist/utils/RateLimiter.js +300 -0
- package/dist/utils/RateLimiter.js.map +1 -0
- package/dist/utils/RecoveryEngine.d.ts +45 -0
- package/dist/utils/RecoveryEngine.d.ts.map +1 -0
- package/dist/utils/RecoveryEngine.js +268 -0
- package/dist/utils/RecoveryEngine.js.map +1 -0
- package/dist/utils/ResearchCoordinator.d.ts +30 -0
- package/dist/utils/ResearchCoordinator.d.ts.map +1 -0
- package/dist/utils/ResearchCoordinator.js +197 -0
- package/dist/utils/ResearchCoordinator.js.map +1 -0
- package/dist/utils/SessionCoordinator.d.ts +111 -0
- package/dist/utils/SessionCoordinator.d.ts.map +1 -0
- package/dist/utils/SessionCoordinator.js +1062 -0
- package/dist/utils/SessionCoordinator.js.map +1 -0
- package/dist/utils/SkillExecutor.d.ts +50 -0
- package/dist/utils/SkillExecutor.d.ts.map +1 -0
- package/dist/utils/SkillExecutor.js +396 -0
- package/dist/utils/SkillExecutor.js.map +1 -0
- package/dist/utils/StuckDetector.d.ts +43 -0
- package/dist/utils/StuckDetector.d.ts.map +1 -0
- package/dist/utils/StuckDetector.js +336 -0
- package/dist/utils/StuckDetector.js.map +1 -0
- package/dist/utils/TemporalGraphIndex.d.ts +33 -0
- package/dist/utils/TemporalGraphIndex.d.ts.map +1 -0
- package/dist/utils/TemporalGraphIndex.js +218 -0
- package/dist/utils/TemporalGraphIndex.js.map +1 -0
- package/dist/utils/artifacts.d.ts +35 -0
- package/dist/utils/artifacts.d.ts.map +1 -0
- package/dist/utils/artifacts.js +294 -0
- package/dist/utils/artifacts.js.map +1 -0
- package/dist/utils/consensusAggregator.d.ts +50 -0
- package/dist/utils/consensusAggregator.d.ts.map +1 -0
- package/dist/utils/consensusAggregator.js +195 -0
- package/dist/utils/consensusAggregator.js.map +1 -0
- package/dist/utils/contextBuilder.d.ts +58 -0
- package/dist/utils/contextBuilder.d.ts.map +1 -0
- package/dist/utils/contextBuilder.js +221 -0
- package/dist/utils/contextBuilder.js.map +1 -0
- package/dist/utils/costPricing.d.ts +11 -0
- package/dist/utils/costPricing.d.ts.map +1 -0
- package/dist/utils/costPricing.js +86 -0
- package/dist/utils/costPricing.js.map +1 -0
- package/dist/utils/filesystem.d.ts +16 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +184 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/llmStreamClient.d.ts +41 -0
- package/dist/utils/llmStreamClient.d.ts.map +1 -0
- package/dist/utils/llmStreamClient.js +257 -0
- package/dist/utils/llmStreamClient.js.map +1 -0
- package/dist/utils/memory.d.ts +22 -0
- package/dist/utils/memory.d.ts.map +1 -0
- package/dist/utils/memory.js +67 -0
- package/dist/utils/memory.js.map +1 -0
- package/dist/utils/memoryBank.d.ts +18 -0
- package/dist/utils/memoryBank.d.ts.map +1 -0
- package/dist/utils/memoryBank.js +128 -0
- package/dist/utils/memoryBank.js.map +1 -0
- package/dist/utils/metrics.d.ts +30 -0
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/metrics.js +208 -0
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/pythonRunner.d.ts +7 -0
- package/dist/utils/pythonRunner.d.ts.map +1 -0
- package/dist/utils/pythonRunner.js +72 -0
- package/dist/utils/pythonRunner.js.map +1 -0
- package/dist/utils/responseParser.d.ts +15 -0
- package/dist/utils/responseParser.d.ts.map +1 -0
- package/dist/utils/responseParser.js +306 -0
- package/dist/utils/responseParser.js.map +1 -0
- package/dist/utils/rlvr/PythonSandbox.d.ts +16 -0
- package/dist/utils/rlvr/PythonSandbox.d.ts.map +1 -0
- package/dist/utils/rlvr/PythonSandbox.js +203 -0
- package/dist/utils/rlvr/PythonSandbox.js.map +1 -0
- package/dist/utils/rlvr/RewardComputer.d.ts +28 -0
- package/dist/utils/rlvr/RewardComputer.d.ts.map +1 -0
- package/dist/utils/rlvr/RewardComputer.js +227 -0
- package/dist/utils/rlvr/RewardComputer.js.map +1 -0
- package/dist/utils/rlvr/RewardHistoryStore.d.ts +48 -0
- package/dist/utils/rlvr/RewardHistoryStore.d.ts.map +1 -0
- package/dist/utils/rlvr/RewardHistoryStore.js +428 -0
- package/dist/utils/rlvr/RewardHistoryStore.js.map +1 -0
- package/dist/utils/rlvr/SQLSandbox.d.ts +21 -0
- package/dist/utils/rlvr/SQLSandbox.d.ts.map +1 -0
- package/dist/utils/rlvr/SQLSandbox.js +199 -0
- package/dist/utils/rlvr/SQLSandbox.js.map +1 -0
- package/dist/utils/rlvr/TestGenerator.d.ts +8 -0
- package/dist/utils/rlvr/TestGenerator.d.ts.map +1 -0
- package/dist/utils/rlvr/TestGenerator.js +216 -0
- package/dist/utils/rlvr/TestGenerator.js.map +1 -0
- package/dist/utils/rlvr/TestOrchestrator.d.ts +45 -0
- package/dist/utils/rlvr/TestOrchestrator.d.ts.map +1 -0
- package/dist/utils/rlvr/TestOrchestrator.js +331 -0
- package/dist/utils/rlvr/TestOrchestrator.js.map +1 -0
- package/dist/utils/rlvr/TypeScriptSandbox.d.ts +16 -0
- package/dist/utils/rlvr/TypeScriptSandbox.d.ts.map +1 -0
- package/dist/utils/rlvr/TypeScriptSandbox.js +244 -0
- package/dist/utils/rlvr/TypeScriptSandbox.js.map +1 -0
- package/dist/utils/rlvr/index.d.ts +9 -0
- package/dist/utils/rlvr/index.d.ts.map +1 -0
- package/dist/utils/rlvr/index.js +9 -0
- package/dist/utils/rlvr/index.js.map +1 -0
- package/dist/utils/rlvr/python_executor.py +309 -0
- package/dist/utils/rlvr/sql_executor.py +233 -0
- package/dist/utils/rlvr/test-orchestrator.d.ts +2 -0
- package/dist/utils/rlvr/test-orchestrator.d.ts.map +1 -0
- package/dist/utils/rlvr/test-orchestrator.js +200 -0
- package/dist/utils/rlvr/test-orchestrator.js.map +1 -0
- package/dist/utils/rlvr/test-persistence.d.ts +2 -0
- package/dist/utils/rlvr/test-persistence.d.ts.map +1 -0
- package/dist/utils/rlvr/test-persistence.js +175 -0
- package/dist/utils/rlvr/test-persistence.js.map +1 -0
- package/dist/utils/rlvr/test-rlvr.d.ts +2 -0
- package/dist/utils/rlvr/test-rlvr.d.ts.map +1 -0
- package/dist/utils/rlvr/test-rlvr.js +286 -0
- package/dist/utils/rlvr/test-rlvr.js.map +1 -0
- package/dist/utils/rlvr/test-sql.d.ts +2 -0
- package/dist/utils/rlvr/test-sql.d.ts.map +1 -0
- package/dist/utils/rlvr/test-sql.js +63 -0
- package/dist/utils/rlvr/test-sql.js.map +1 -0
- package/dist/utils/rlvr/types.d.ts +133 -0
- package/dist/utils/rlvr/types.d.ts.map +1 -0
- package/dist/utils/rlvr/types.js +8 -0
- package/dist/utils/rlvr/types.js.map +1 -0
- package/dist/utils/tokenEstimator.d.ts +4 -0
- package/dist/utils/tokenEstimator.d.ts.map +1 -0
- package/dist/utils/tokenEstimator.js +14 -0
- package/dist/utils/tokenEstimator.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
import { estimateTokensFromJSON } from "../../utils/tokenEstimator.js";
|
|
2
|
+
export const checkCodeFeasibilityTool = {
|
|
3
|
+
name: "check_code_feasibility",
|
|
4
|
+
description: "Check code for feasibility issues: syntax errors, non-existent imports, invalid API calls, deprecated patterns, and security concerns. Part of hallucination detection for code suggestions.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
code: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "The code to check for feasibility",
|
|
11
|
+
},
|
|
12
|
+
language: {
|
|
13
|
+
type: "string",
|
|
14
|
+
enum: [
|
|
15
|
+
"typescript",
|
|
16
|
+
"javascript",
|
|
17
|
+
"python",
|
|
18
|
+
"go",
|
|
19
|
+
"rust",
|
|
20
|
+
"sql",
|
|
21
|
+
"bash",
|
|
22
|
+
],
|
|
23
|
+
description: "Programming language of the code",
|
|
24
|
+
},
|
|
25
|
+
context: {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Optional context about what the code is supposed to do",
|
|
28
|
+
},
|
|
29
|
+
strictMode: {
|
|
30
|
+
type: "boolean",
|
|
31
|
+
description: "Enable strict checking (more warnings, lower confidence threshold)",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
required: ["code", "language"],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export async function checkCodeFeasibilityHandler(args) {
|
|
38
|
+
const startTime = Date.now();
|
|
39
|
+
try {
|
|
40
|
+
const input = args;
|
|
41
|
+
if (!input.code) {
|
|
42
|
+
throw new Error("code is required");
|
|
43
|
+
}
|
|
44
|
+
if (!input.language) {
|
|
45
|
+
throw new Error("language is required");
|
|
46
|
+
}
|
|
47
|
+
const result = await checkFeasibility(input);
|
|
48
|
+
const duration = Date.now() - startTime;
|
|
49
|
+
const tokensUsed = estimateTokensFromJSON({ input, result });
|
|
50
|
+
const output = {
|
|
51
|
+
success: true,
|
|
52
|
+
data: result,
|
|
53
|
+
metadata: {
|
|
54
|
+
tokensUsed,
|
|
55
|
+
duration,
|
|
56
|
+
language: input.language,
|
|
57
|
+
linesOfCode: input.code.split("\n").length,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: JSON.stringify(output, null, 2),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const duration = Date.now() - startTime;
|
|
71
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
72
|
+
const input = args;
|
|
73
|
+
const errorResult = {
|
|
74
|
+
success: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: "CODE_FEASIBILITY_ERROR",
|
|
77
|
+
message: errorMessage,
|
|
78
|
+
},
|
|
79
|
+
metadata: {
|
|
80
|
+
tokensUsed: 0,
|
|
81
|
+
duration,
|
|
82
|
+
language: input?.language || "unknown",
|
|
83
|
+
linesOfCode: input?.code?.split("\n").length || 0,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: JSON.stringify(errorResult, null, 2),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async function checkFeasibility(input) {
|
|
97
|
+
const { code, language, strictMode = false } = input;
|
|
98
|
+
const issues = [];
|
|
99
|
+
const checksPerformed = [];
|
|
100
|
+
const syntaxResult = checkSyntax(code, language);
|
|
101
|
+
issues.push(...syntaxResult.issues);
|
|
102
|
+
checksPerformed.push("syntax");
|
|
103
|
+
const importResult = checkImports(code, language);
|
|
104
|
+
issues.push(...importResult.issues);
|
|
105
|
+
checksPerformed.push("imports");
|
|
106
|
+
const apiResult = checkApiPatterns(code, language);
|
|
107
|
+
issues.push(...apiResult.issues);
|
|
108
|
+
checksPerformed.push("api_patterns");
|
|
109
|
+
const logicResult = checkLogicPatterns(code, language);
|
|
110
|
+
issues.push(...logicResult.issues);
|
|
111
|
+
checksPerformed.push("logic_patterns");
|
|
112
|
+
const securityResult = checkSecurityPatterns(code, language);
|
|
113
|
+
issues.push(...securityResult.issues);
|
|
114
|
+
checksPerformed.push("security_patterns");
|
|
115
|
+
const errorCount = issues.filter((i) => i.severity === "error").length;
|
|
116
|
+
const warningCount = issues.filter((i) => i.severity === "warning").length;
|
|
117
|
+
const syntaxValid = syntaxResult.issues.filter((i) => i.severity === "error").length === 0;
|
|
118
|
+
const importsValid = importResult.issues.filter((i) => i.severity === "error").length === 0;
|
|
119
|
+
const apisValid = apiResult.issues.filter((i) => i.severity === "error").length === 0;
|
|
120
|
+
let confidence = 1.0;
|
|
121
|
+
confidence -= errorCount * 0.2;
|
|
122
|
+
confidence -= warningCount * 0.05;
|
|
123
|
+
if (strictMode) {
|
|
124
|
+
confidence -= warningCount * 0.05;
|
|
125
|
+
}
|
|
126
|
+
confidence = Math.max(0, Math.min(1, confidence));
|
|
127
|
+
const feasible = errorCount === 0 && (strictMode ? warningCount < 3 : true);
|
|
128
|
+
const badge = determineBadge(confidence, errorCount, warningCount);
|
|
129
|
+
return {
|
|
130
|
+
feasible,
|
|
131
|
+
syntaxValid,
|
|
132
|
+
importsValid,
|
|
133
|
+
apisValid,
|
|
134
|
+
issues,
|
|
135
|
+
confidence,
|
|
136
|
+
checksPerformed,
|
|
137
|
+
badge,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function determineBadge(confidence, errors, warnings) {
|
|
141
|
+
if (errors > 0) {
|
|
142
|
+
return "🚫 ERRORS FOUND";
|
|
143
|
+
}
|
|
144
|
+
if (confidence >= 0.9) {
|
|
145
|
+
return "✅ FEASIBLE";
|
|
146
|
+
}
|
|
147
|
+
if (confidence >= 0.7) {
|
|
148
|
+
return "✓ LIKELY FEASIBLE";
|
|
149
|
+
}
|
|
150
|
+
if (warnings > 0) {
|
|
151
|
+
return "⚠️ WARNINGS";
|
|
152
|
+
}
|
|
153
|
+
return "🔍 NEEDS REVIEW";
|
|
154
|
+
}
|
|
155
|
+
function checkSyntax(code, language) {
|
|
156
|
+
const issues = [];
|
|
157
|
+
const lines = code.split("\n");
|
|
158
|
+
switch (language) {
|
|
159
|
+
case "typescript":
|
|
160
|
+
case "javascript":
|
|
161
|
+
issues.push(...checkJsSyntax(code, lines));
|
|
162
|
+
break;
|
|
163
|
+
case "python":
|
|
164
|
+
issues.push(...checkPythonSyntax(code, lines));
|
|
165
|
+
break;
|
|
166
|
+
case "go":
|
|
167
|
+
issues.push(...checkGoSyntax(code, lines));
|
|
168
|
+
break;
|
|
169
|
+
case "rust":
|
|
170
|
+
issues.push(...checkRustSyntax(code, lines));
|
|
171
|
+
break;
|
|
172
|
+
case "sql":
|
|
173
|
+
issues.push(...checkSqlSyntax(code, lines));
|
|
174
|
+
break;
|
|
175
|
+
case "bash":
|
|
176
|
+
issues.push(...checkBashSyntax(code, lines));
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
return { issues };
|
|
180
|
+
}
|
|
181
|
+
function checkJsSyntax(code, lines) {
|
|
182
|
+
const issues = [];
|
|
183
|
+
const openBraces = (code.match(/\{/g) || []).length;
|
|
184
|
+
const closeBraces = (code.match(/\}/g) || []).length;
|
|
185
|
+
if (openBraces !== closeBraces) {
|
|
186
|
+
issues.push({
|
|
187
|
+
type: "syntax",
|
|
188
|
+
description: `Unbalanced braces: ${openBraces} opening, ${closeBraces} closing`,
|
|
189
|
+
severity: "error",
|
|
190
|
+
suggestion: "Check for missing or extra braces",
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const openParens = (code.match(/\(/g) || []).length;
|
|
194
|
+
const closeParens = (code.match(/\)/g) || []).length;
|
|
195
|
+
if (openParens !== closeParens) {
|
|
196
|
+
issues.push({
|
|
197
|
+
type: "syntax",
|
|
198
|
+
description: `Unbalanced parentheses: ${openParens} opening, ${closeParens} closing`,
|
|
199
|
+
severity: "error",
|
|
200
|
+
suggestion: "Check for missing or extra parentheses",
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
lines.forEach((line, idx) => {
|
|
204
|
+
if (/\bfunciton\b/i.test(line)) {
|
|
205
|
+
issues.push({
|
|
206
|
+
type: "syntax",
|
|
207
|
+
description: 'Typo: "funciton" should be "function"',
|
|
208
|
+
severity: "error",
|
|
209
|
+
line: idx + 1,
|
|
210
|
+
suggestion: 'Replace with "function"',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (/^\s*(const|let)\s+\w+\s*;/.test(line) && /const/.test(line)) {
|
|
214
|
+
issues.push({
|
|
215
|
+
type: "syntax",
|
|
216
|
+
description: "const declaration without initialization",
|
|
217
|
+
severity: "error",
|
|
218
|
+
line: idx + 1,
|
|
219
|
+
suggestion: "const requires an initial value",
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (/=>\s*\{[^}]*$/.test(line) &&
|
|
223
|
+
!lines.slice(idx + 1).some((l) => /\}/.test(l))) {
|
|
224
|
+
issues.push({
|
|
225
|
+
type: "syntax",
|
|
226
|
+
description: "Arrow function body may not be closed",
|
|
227
|
+
severity: "warning",
|
|
228
|
+
line: idx + 1,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
return issues;
|
|
233
|
+
}
|
|
234
|
+
function checkPythonSyntax(_code, lines) {
|
|
235
|
+
const issues = [];
|
|
236
|
+
lines.forEach((line, idx) => {
|
|
237
|
+
const leadingSpaces = line.match(/^(\s*)/)?.[1] || "";
|
|
238
|
+
if (leadingSpaces.includes("\t") && leadingSpaces.includes(" ")) {
|
|
239
|
+
issues.push({
|
|
240
|
+
type: "syntax",
|
|
241
|
+
description: "Mixed tabs and spaces in indentation",
|
|
242
|
+
severity: "error",
|
|
243
|
+
line: idx + 1,
|
|
244
|
+
suggestion: "Use consistent indentation (spaces recommended)",
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (/\bpritn\b/.test(line)) {
|
|
248
|
+
issues.push({
|
|
249
|
+
type: "syntax",
|
|
250
|
+
description: 'Typo: "pritn" should be "print"',
|
|
251
|
+
severity: "error",
|
|
252
|
+
line: idx + 1,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (/^\s*(def|if|elif|else|for|while|class|try|except|finally|with)\s+[^:]+$/.test(line) &&
|
|
256
|
+
!/:\s*$/.test(line) &&
|
|
257
|
+
!/^\s*(else|try|finally)\s*$/.test(line)) {
|
|
258
|
+
issues.push({
|
|
259
|
+
type: "syntax",
|
|
260
|
+
description: "Missing colon after statement",
|
|
261
|
+
severity: "error",
|
|
262
|
+
line: idx + 1,
|
|
263
|
+
suggestion: "Add colon at end of line",
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
return issues;
|
|
268
|
+
}
|
|
269
|
+
function checkGoSyntax(code, lines) {
|
|
270
|
+
const issues = [];
|
|
271
|
+
const openBraces = (code.match(/\{/g) || []).length;
|
|
272
|
+
const closeBraces = (code.match(/\}/g) || []).length;
|
|
273
|
+
if (openBraces !== closeBraces) {
|
|
274
|
+
issues.push({
|
|
275
|
+
type: "syntax",
|
|
276
|
+
description: `Unbalanced braces: ${openBraces} opening, ${closeBraces} closing`,
|
|
277
|
+
severity: "error",
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
lines.forEach((line, idx) => {
|
|
281
|
+
if (/^\s*(func|if|for|switch|select)\s+[^{]*$/.test(line) &&
|
|
282
|
+
lines[idx + 1]?.trim().startsWith("{")) {
|
|
283
|
+
issues.push({
|
|
284
|
+
type: "syntax",
|
|
285
|
+
description: "Go requires opening brace on same line as statement",
|
|
286
|
+
severity: "error",
|
|
287
|
+
line: idx + 1,
|
|
288
|
+
suggestion: "Move opening brace to end of this line",
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
return issues;
|
|
293
|
+
}
|
|
294
|
+
function checkRustSyntax(code, lines) {
|
|
295
|
+
const issues = [];
|
|
296
|
+
const openBraces = (code.match(/\{/g) || []).length;
|
|
297
|
+
const closeBraces = (code.match(/\}/g) || []).length;
|
|
298
|
+
if (openBraces !== closeBraces) {
|
|
299
|
+
issues.push({
|
|
300
|
+
type: "syntax",
|
|
301
|
+
description: `Unbalanced braces: ${openBraces} opening, ${closeBraces} closing`,
|
|
302
|
+
severity: "error",
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
lines.forEach((line, idx) => {
|
|
306
|
+
if (/^\s*(let|const|return|println!|print!|eprintln!)\s+[^;{]+[^;{}\s]$/.test(line)) {
|
|
307
|
+
issues.push({
|
|
308
|
+
type: "syntax",
|
|
309
|
+
description: "Possible missing semicolon",
|
|
310
|
+
severity: "warning",
|
|
311
|
+
line: idx + 1,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
return issues;
|
|
316
|
+
}
|
|
317
|
+
function checkSqlSyntax(code, _lines) {
|
|
318
|
+
void _lines;
|
|
319
|
+
const issues = [];
|
|
320
|
+
const upperCode = code.toUpperCase();
|
|
321
|
+
if (/\bSELECT\b/.test(upperCode) &&
|
|
322
|
+
!/\bFROM\b/.test(upperCode) &&
|
|
323
|
+
!/\bSELECT\s+\d+/.test(upperCode)) {
|
|
324
|
+
issues.push({
|
|
325
|
+
type: "syntax",
|
|
326
|
+
description: "SELECT statement without FROM clause",
|
|
327
|
+
severity: "warning",
|
|
328
|
+
suggestion: "Add FROM clause or use SELECT literal",
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
if (/\bUPDATE\b/.test(upperCode) && !/\bWHERE\b/.test(upperCode)) {
|
|
332
|
+
issues.push({
|
|
333
|
+
type: "security",
|
|
334
|
+
description: "UPDATE statement without WHERE clause - will affect all rows",
|
|
335
|
+
severity: "error",
|
|
336
|
+
suggestion: "Add WHERE clause to limit affected rows",
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
if (/\bDELETE\b/.test(upperCode) && !/\bWHERE\b/.test(upperCode)) {
|
|
340
|
+
issues.push({
|
|
341
|
+
type: "security",
|
|
342
|
+
description: "DELETE statement without WHERE clause - will delete all rows",
|
|
343
|
+
severity: "error",
|
|
344
|
+
suggestion: "Add WHERE clause to limit affected rows",
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
return issues;
|
|
348
|
+
}
|
|
349
|
+
function checkBashSyntax(code, lines) {
|
|
350
|
+
const issues = [];
|
|
351
|
+
lines.forEach((line, idx) => {
|
|
352
|
+
if (/\brm\s+-rf?\s+\$\w+[^"]/.test(line) ||
|
|
353
|
+
/\brm\s+-rf?\s+\$\{[^}]+\}[^"]/.test(line)) {
|
|
354
|
+
issues.push({
|
|
355
|
+
type: "security",
|
|
356
|
+
description: "Unquoted variable in rm command - dangerous if empty or contains spaces",
|
|
357
|
+
severity: "error",
|
|
358
|
+
line: idx + 1,
|
|
359
|
+
suggestion: 'Quote the variable: rm -rf "$variable"',
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
if (/\[\s+[^]]*\s+\]/.test(line) && !/\[\[/.test(line)) {
|
|
363
|
+
issues.push({
|
|
364
|
+
type: "logic",
|
|
365
|
+
description: "Using [ ] instead of [[ ]] - consider using [[ ]] for better string handling",
|
|
366
|
+
severity: "info",
|
|
367
|
+
line: idx + 1,
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
const ifCount = (code.match(/\bif\b/g) || []).length;
|
|
372
|
+
const fiCount = (code.match(/\bfi\b/g) || []).length;
|
|
373
|
+
if (ifCount !== fiCount) {
|
|
374
|
+
issues.push({
|
|
375
|
+
type: "syntax",
|
|
376
|
+
description: `Unbalanced if/fi: ${ifCount} if statements, ${fiCount} fi`,
|
|
377
|
+
severity: "error",
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
return issues;
|
|
381
|
+
}
|
|
382
|
+
const KNOWN_PACKAGES = {
|
|
383
|
+
npm: new Set([
|
|
384
|
+
"react",
|
|
385
|
+
"vue",
|
|
386
|
+
"angular",
|
|
387
|
+
"express",
|
|
388
|
+
"next",
|
|
389
|
+
"axios",
|
|
390
|
+
"lodash",
|
|
391
|
+
"moment",
|
|
392
|
+
"dayjs",
|
|
393
|
+
"date-fns",
|
|
394
|
+
"uuid",
|
|
395
|
+
"zod",
|
|
396
|
+
"joi",
|
|
397
|
+
"yup",
|
|
398
|
+
"typescript",
|
|
399
|
+
"webpack",
|
|
400
|
+
"vite",
|
|
401
|
+
"esbuild",
|
|
402
|
+
"rollup",
|
|
403
|
+
"jest",
|
|
404
|
+
"vitest",
|
|
405
|
+
"mocha",
|
|
406
|
+
"chai",
|
|
407
|
+
"prisma",
|
|
408
|
+
"drizzle-orm",
|
|
409
|
+
"typeorm",
|
|
410
|
+
"sequelize",
|
|
411
|
+
"mongoose",
|
|
412
|
+
"graphql",
|
|
413
|
+
"apollo",
|
|
414
|
+
"@tanstack/react-query",
|
|
415
|
+
"swr",
|
|
416
|
+
"redux",
|
|
417
|
+
"zustand",
|
|
418
|
+
"jotai",
|
|
419
|
+
"recoil",
|
|
420
|
+
"@modelcontextprotocol/sdk",
|
|
421
|
+
"@qdrant/js-client-rest",
|
|
422
|
+
"openai",
|
|
423
|
+
"@google/genai",
|
|
424
|
+
]),
|
|
425
|
+
python: new Set([
|
|
426
|
+
"numpy",
|
|
427
|
+
"pandas",
|
|
428
|
+
"scipy",
|
|
429
|
+
"matplotlib",
|
|
430
|
+
"seaborn",
|
|
431
|
+
"sklearn",
|
|
432
|
+
"tensorflow",
|
|
433
|
+
"torch",
|
|
434
|
+
"keras",
|
|
435
|
+
"flask",
|
|
436
|
+
"django",
|
|
437
|
+
"fastapi",
|
|
438
|
+
"requests",
|
|
439
|
+
"httpx",
|
|
440
|
+
"aiohttp",
|
|
441
|
+
"sqlalchemy",
|
|
442
|
+
"alembic",
|
|
443
|
+
"pydantic",
|
|
444
|
+
"pytest",
|
|
445
|
+
"unittest",
|
|
446
|
+
"asyncio",
|
|
447
|
+
"typing",
|
|
448
|
+
"json",
|
|
449
|
+
"os",
|
|
450
|
+
"sys",
|
|
451
|
+
"pathlib",
|
|
452
|
+
"re",
|
|
453
|
+
"datetime",
|
|
454
|
+
"collections",
|
|
455
|
+
"itertools",
|
|
456
|
+
]),
|
|
457
|
+
go: new Set([
|
|
458
|
+
"fmt",
|
|
459
|
+
"os",
|
|
460
|
+
"io",
|
|
461
|
+
"net",
|
|
462
|
+
"http",
|
|
463
|
+
"encoding/json",
|
|
464
|
+
"encoding/xml",
|
|
465
|
+
"database/sql",
|
|
466
|
+
"context",
|
|
467
|
+
"sync",
|
|
468
|
+
"time",
|
|
469
|
+
"strings",
|
|
470
|
+
"strconv",
|
|
471
|
+
"regexp",
|
|
472
|
+
"errors",
|
|
473
|
+
"log",
|
|
474
|
+
]),
|
|
475
|
+
};
|
|
476
|
+
function checkImports(code, language) {
|
|
477
|
+
const issues = [];
|
|
478
|
+
switch (language) {
|
|
479
|
+
case "typescript":
|
|
480
|
+
case "javascript": {
|
|
481
|
+
const importMatches = code.matchAll(/import\s+(?:(?:\{[^}]+\}|\*\s+as\s+\w+|\w+)\s+from\s+)?['"]([^'"]+)['"]/g);
|
|
482
|
+
for (const match of importMatches) {
|
|
483
|
+
const pkg = match[1];
|
|
484
|
+
if (!pkg)
|
|
485
|
+
continue;
|
|
486
|
+
if (pkg.startsWith(".") || pkg.startsWith("/"))
|
|
487
|
+
continue;
|
|
488
|
+
const basePkg = pkg.split("/")[0];
|
|
489
|
+
if (!KNOWN_PACKAGES.npm.has(basePkg) &&
|
|
490
|
+
!basePkg.startsWith("@types/")) {
|
|
491
|
+
issues.push({
|
|
492
|
+
type: "import",
|
|
493
|
+
description: `Unknown package: "${basePkg}" - verify it exists in npm`,
|
|
494
|
+
severity: "warning",
|
|
495
|
+
suggestion: `Check npm for package existence: npm view ${basePkg}`,
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (/from\s+['"]raect['"]/.test(code)) {
|
|
500
|
+
issues.push({
|
|
501
|
+
type: "import",
|
|
502
|
+
description: 'Typo: "raect" should be "react"',
|
|
503
|
+
severity: "error",
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
case "python": {
|
|
509
|
+
const importMatches = code.matchAll(/(?:from\s+(\S+)\s+import|import\s+(\S+))/g);
|
|
510
|
+
for (const match of importMatches) {
|
|
511
|
+
const pkg = (match[1] || match[2])?.split(".")[0];
|
|
512
|
+
if (!pkg)
|
|
513
|
+
continue;
|
|
514
|
+
if (!KNOWN_PACKAGES.python.has(pkg) && !pkg.startsWith("_")) {
|
|
515
|
+
issues.push({
|
|
516
|
+
type: "import",
|
|
517
|
+
description: `Unknown package: "${pkg}" - verify it exists in PyPI`,
|
|
518
|
+
severity: "warning",
|
|
519
|
+
suggestion: `Check PyPI for package existence: pip show ${pkg}`,
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
case "go": {
|
|
526
|
+
const importMatches = code.matchAll(/import\s+(?:\(\s*([\s\S]*?)\s*\)|"([^"]+)")/g);
|
|
527
|
+
for (const match of importMatches) {
|
|
528
|
+
const imports = match[1] || match[2];
|
|
529
|
+
if (!imports)
|
|
530
|
+
continue;
|
|
531
|
+
const pkgs = imports
|
|
532
|
+
.split("\n")
|
|
533
|
+
.map((l) => l.trim().replace(/"/g, ""))
|
|
534
|
+
.filter(Boolean);
|
|
535
|
+
for (const pkg of pkgs) {
|
|
536
|
+
if (!pkg || pkg.startsWith("//"))
|
|
537
|
+
continue;
|
|
538
|
+
const basePkg = pkg.split("/")[0];
|
|
539
|
+
if (!KNOWN_PACKAGES.go.has(basePkg) && !pkg.includes(".")) {
|
|
540
|
+
issues.push({
|
|
541
|
+
type: "import",
|
|
542
|
+
description: `Unknown standard library package: "${basePkg}"`,
|
|
543
|
+
severity: "warning",
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return { issues };
|
|
552
|
+
}
|
|
553
|
+
const API_PATTERNS = {
|
|
554
|
+
typescript: [
|
|
555
|
+
{
|
|
556
|
+
pattern: /fetch\([^)]+\)\s*(?!\.then|await)/,
|
|
557
|
+
issue: "fetch() returns a Promise - should be awaited or .then() chained",
|
|
558
|
+
severity: "warning",
|
|
559
|
+
suggestion: "Add await or .then() to handle the Promise",
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
pattern: /JSON\.parse\([^)]*\)\s*(?!\.catch|try)/,
|
|
563
|
+
issue: "JSON.parse() can throw - consider wrapping in try/catch",
|
|
564
|
+
severity: "info",
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
pattern: /\.(map|filter|reduce)\([^)]*\)\s*\.length/,
|
|
568
|
+
issue: "Using .length after map/filter - consider using appropriate method",
|
|
569
|
+
severity: "info",
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
pattern: /new\s+Promise\([^)]*resolve[^)]*reject[^)]*\)\s*{\s*return/,
|
|
573
|
+
issue: "Returning inside Promise executor - use resolve() instead",
|
|
574
|
+
severity: "warning",
|
|
575
|
+
},
|
|
576
|
+
],
|
|
577
|
+
javascript: [],
|
|
578
|
+
python: [
|
|
579
|
+
{
|
|
580
|
+
pattern: /open\([^)]+\)(?!\s*as\s)/,
|
|
581
|
+
issue: 'File open without context manager - use "with open() as f:"',
|
|
582
|
+
severity: "warning",
|
|
583
|
+
suggestion: "Use context manager for automatic file closing",
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
pattern: /except:\s*$/m,
|
|
587
|
+
issue: "Bare except clause - catches all exceptions including KeyboardInterrupt",
|
|
588
|
+
severity: "warning",
|
|
589
|
+
suggestion: 'Use "except Exception:" or specific exception types',
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
pattern: /==\s*None/,
|
|
593
|
+
issue: 'Use "is None" instead of "== None"',
|
|
594
|
+
severity: "info",
|
|
595
|
+
},
|
|
596
|
+
],
|
|
597
|
+
sql: [
|
|
598
|
+
{
|
|
599
|
+
pattern: /SELECT\s+\*/i,
|
|
600
|
+
issue: "SELECT * is inefficient - specify needed columns",
|
|
601
|
+
severity: "info",
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
pattern: /'\s*\+\s*\w+\s*\+\s*'/,
|
|
605
|
+
issue: "String concatenation in SQL - possible SQL injection",
|
|
606
|
+
severity: "error",
|
|
607
|
+
suggestion: "Use parameterized queries instead",
|
|
608
|
+
},
|
|
609
|
+
],
|
|
610
|
+
};
|
|
611
|
+
function checkApiPatterns(code, language) {
|
|
612
|
+
const issues = [];
|
|
613
|
+
let patterns = API_PATTERNS[language] || [];
|
|
614
|
+
if (language === "javascript") {
|
|
615
|
+
patterns = [...(API_PATTERNS.typescript || []), ...patterns];
|
|
616
|
+
}
|
|
617
|
+
for (const { pattern, issue, severity, suggestion } of patterns) {
|
|
618
|
+
if (pattern.test(code)) {
|
|
619
|
+
issues.push({
|
|
620
|
+
type: "api",
|
|
621
|
+
description: issue,
|
|
622
|
+
severity,
|
|
623
|
+
suggestion,
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return { issues };
|
|
628
|
+
}
|
|
629
|
+
function checkLogicPatterns(code, language) {
|
|
630
|
+
const issues = [];
|
|
631
|
+
const lines = code.split("\n");
|
|
632
|
+
lines.forEach((line, idx) => {
|
|
633
|
+
if (/catch\s*\([^)]*\)\s*\{\s*\}/.test(line)) {
|
|
634
|
+
issues.push({
|
|
635
|
+
type: "logic",
|
|
636
|
+
description: "Empty catch block - exceptions are silently ignored",
|
|
637
|
+
severity: "warning",
|
|
638
|
+
line: idx + 1,
|
|
639
|
+
suggestion: "Log the error or handle it appropriately",
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
if (/console\.(log|debug|info)\(/.test(line) &&
|
|
643
|
+
!line.includes("// debug")) {
|
|
644
|
+
issues.push({
|
|
645
|
+
type: "logic",
|
|
646
|
+
description: "console.log statement - remove before production",
|
|
647
|
+
severity: "info",
|
|
648
|
+
line: idx + 1,
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
if (/\/\/\s*(TODO|FIXME|XXX|HACK)/i.test(line)) {
|
|
652
|
+
issues.push({
|
|
653
|
+
type: "logic",
|
|
654
|
+
description: "TODO/FIXME comment found - incomplete implementation",
|
|
655
|
+
severity: "info",
|
|
656
|
+
line: idx + 1,
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
switch (language) {
|
|
661
|
+
case "typescript":
|
|
662
|
+
case "javascript":
|
|
663
|
+
if (/[^!=]==[^=]/.test(code) && !/===/.test(code.replace(/==/g, ""))) {
|
|
664
|
+
issues.push({
|
|
665
|
+
type: "logic",
|
|
666
|
+
description: "Using == instead of === - may cause type coercion issues",
|
|
667
|
+
severity: "warning",
|
|
668
|
+
suggestion: "Use === for strict equality comparison",
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
if (/async\s+(?:function|\([^)]*\)\s*=>)/.test(code) &&
|
|
672
|
+
!/await\s/.test(code)) {
|
|
673
|
+
issues.push({
|
|
674
|
+
type: "logic",
|
|
675
|
+
description: "async function without await - may be unnecessary",
|
|
676
|
+
severity: "info",
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
break;
|
|
680
|
+
case "python":
|
|
681
|
+
if (/def\s+\w+\([^)]*(?:\[\]|\{\}|set\(\))[^)]*\):/.test(code)) {
|
|
682
|
+
issues.push({
|
|
683
|
+
type: "logic",
|
|
684
|
+
description: "Mutable default argument - shared between calls",
|
|
685
|
+
severity: "error",
|
|
686
|
+
suggestion: "Use None as default and create inside function",
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
break;
|
|
690
|
+
}
|
|
691
|
+
return { issues };
|
|
692
|
+
}
|
|
693
|
+
function checkSecurityPatterns(code, language) {
|
|
694
|
+
const issues = [];
|
|
695
|
+
const lines = code.split("\n");
|
|
696
|
+
lines.forEach((line, idx) => {
|
|
697
|
+
if (/(?:password|secret|api_key|apikey|token|auth)\s*[:=]\s*['"][^'"]{8,}['"]/i.test(line)) {
|
|
698
|
+
issues.push({
|
|
699
|
+
type: "security",
|
|
700
|
+
description: "Possible hardcoded secret detected",
|
|
701
|
+
severity: "error",
|
|
702
|
+
line: idx + 1,
|
|
703
|
+
suggestion: "Use environment variables for secrets",
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
if (/\beval\s*\(/.test(line)) {
|
|
707
|
+
issues.push({
|
|
708
|
+
type: "security",
|
|
709
|
+
description: "eval() usage - potential code injection vulnerability",
|
|
710
|
+
severity: "error",
|
|
711
|
+
line: idx + 1,
|
|
712
|
+
suggestion: "Avoid eval() - use safer alternatives",
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
switch (language) {
|
|
717
|
+
case "typescript":
|
|
718
|
+
case "javascript":
|
|
719
|
+
if (/\.innerHTML\s*=/.test(code)) {
|
|
720
|
+
issues.push({
|
|
721
|
+
type: "security",
|
|
722
|
+
description: "innerHTML assignment - potential XSS vulnerability",
|
|
723
|
+
severity: "warning",
|
|
724
|
+
suggestion: "Use textContent or sanitize input",
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
if (/document\.write\s*\(/.test(code)) {
|
|
728
|
+
issues.push({
|
|
729
|
+
type: "security",
|
|
730
|
+
description: "document.write() usage - potential XSS and performance issues",
|
|
731
|
+
severity: "warning",
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
break;
|
|
735
|
+
case "python":
|
|
736
|
+
if (/pickle\.loads?\s*\(/.test(code)) {
|
|
737
|
+
issues.push({
|
|
738
|
+
type: "security",
|
|
739
|
+
description: "pickle usage - can execute arbitrary code with untrusted data",
|
|
740
|
+
severity: "warning",
|
|
741
|
+
suggestion: "Use JSON for untrusted data serialization",
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
if (/os\.system\s*\(/.test(code) ||
|
|
745
|
+
/subprocess\.(?:call|run)\s*\([^)]*shell\s*=\s*True/.test(code)) {
|
|
746
|
+
issues.push({
|
|
747
|
+
type: "security",
|
|
748
|
+
description: "Shell command execution - potential command injection",
|
|
749
|
+
severity: "warning",
|
|
750
|
+
suggestion: "Use subprocess with shell=False and pass args as list",
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
break;
|
|
754
|
+
case "bash":
|
|
755
|
+
if (/\$\([^)]*\$[A-Za-z_]/.test(code)) {
|
|
756
|
+
issues.push({
|
|
757
|
+
type: "security",
|
|
758
|
+
description: "Variable in command substitution - potential injection",
|
|
759
|
+
severity: "warning",
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
return { issues };
|
|
765
|
+
}
|
|
766
|
+
//# sourceMappingURL=checkCodeFeasibility.js.map
|