feat: AI Property-Based Testing, Feedback System, Code Search, and Best Practice Recommendations - #637
Merged
Conversation
… Practice Recommendations Implement four AI-powered features for StarForge CLI: 1. AI Property-Based Testing (Nanle-code#569): Property discovery, invariant extraction, test generation with proptest strategies, and shrinkage support 2. AI Feedback and Learning System (Nanle-code#523): User feedback collection, quality tracking, preference learning, and continuous improvement 3. AI Code Search and Discovery (Nanle-code#518): Natural language code search, pattern discovery, similar code finding, and usage example generation 4. AI Best Practice Recommendations (Nanle-code#516): Code analysis for security, gas optimization, testing, deployment, and access control All features include local heuristic analysis with optional Ollama AI enhancement, structured JSON/text output, and comprehensive tests.
|
@KidDev88 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #569, Closes #523, Closes #518, Closes #516
Type of Change
Summary
This PR implements four AI-powered features for the StarForge CLI:
AI Property-Based Testing (AI Property-Based Testing #569): Automatically discovers contract properties and invariants, generates proptest-compatible test strategies, validates invariants across state transitions, discovers edge cases via boundary analysis, and provides shrinkage strategies for counterexample minimization.
AI Feedback and Learning System (AI Feedback and Learning System #523): Collects user feedback on AI-generated responses, tracks response quality metrics, learns user preferences from corrections, and generates improvement plans based on feedback trends.
AI Code Search and Discovery (AI Code Search and Discovery #518): Provides natural language code search, discovers patterns in the codebase, finds similar code blocks, and generates usage examples for contract functions.
AI Best Practice Recommendations (AI Best Practice Recommendations #516): Analyzes Soroban contracts against security, gas optimization, code organization, testing, deployment, error handling, storage, and access control best practices, with priority-ranked recommendations.
Motivation / Context
Closes #569, Closes #523, Closes #518, Closes #516
These features enhance the StarForge CLI with intelligent analysis capabilities:
Changes
New Command Modules
src/commands/ai_property_test.rs: CLI for property testing (discover, generate, validate, edge-cases, shrink)src/commands/ai_feedback.rs: CLI for feedback (record, stats, preferences, quality, improve, prompt)src/commands/ai_search.rs: CLI for code search (search, similar, patterns, usage, discover)src/commands/ai_recommend.rs: CLI for recommendations (analyze, scan, category, plan)New Utility Modules
src/utils/ai_property_testing.rs: Property discovery, invariant extraction, strategy generation, test case generation, shrinkage strategiessrc/utils/ai_feedback.rs: Feedback storage, preference learning, quality metrics, feature statisticssrc/utils/ai_search.rs: Code indexing, relevance scoring, pattern discovery, usage example generationsrc/utils/ai_recommendations.rs: Security, gas, testing, deployment, and access control analysisModified Files
src/main.rs: Added command variants and handlers for all 4 featuressrc/commands/mod.rs: Registered new command modulessrc/utils/mod.rs: Registered new utility modulessrc/commands/optimize.rs: Fixed unclosed delimiter bugTesting
All new modules include unit tests:
ai_property_testing: Property discovery, invariant extraction, strategy generation, test pipelineai_feedback: Feedback recording, quality metrics, preference learning, prompt buildingai_search: Code relevance scoring, function name extraction, search configurationai_recommendations: Security checks, score calculation, prompt generationTradeoffs
Out of scope