Skip to content

feat: AI Property-Based Testing, Feedback System, Code Search, and Best Practice Recommendations - #637

Merged
Nanle-code merged 1 commit into
Nanle-code:masterfrom
KidDev88:feat/ai-features-batch
Jul 27, 2026
Merged

feat: AI Property-Based Testing, Feedback System, Code Search, and Best Practice Recommendations#637
Nanle-code merged 1 commit into
Nanle-code:masterfrom
KidDev88:feat/ai-features-batch

Conversation

@KidDev88

Copy link
Copy Markdown
Contributor

Closes #569, Closes #523, Closes #518, Closes #516

Type of Change

  • New feature (non-breaking change that adds functionality)

Summary

This PR implements four AI-powered features for the StarForge CLI:

  1. 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.

  2. 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.

  3. 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.

  4. 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:

  • Property-based testing catches edge cases that unit tests miss
  • Feedback system enables continuous improvement of AI responses
  • Code search helps developers discover patterns and reuse code
  • Best practice recommendations guide developers toward secure, optimized contracts

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 strategies
  • src/utils/ai_feedback.rs: Feedback storage, preference learning, quality metrics, feature statistics
  • src/utils/ai_search.rs: Code indexing, relevance scoring, pattern discovery, usage example generation
  • src/utils/ai_recommendations.rs: Security, gas, testing, deployment, and access control analysis

Modified Files

  • src/main.rs: Added command variants and handlers for all 4 features
  • src/commands/mod.rs: Registered new command modules
  • src/utils/mod.rs: Registered new utility modules
  • src/commands/optimize.rs: Fixed unclosed delimiter bug

Testing

All new modules include unit tests:

  • ai_property_testing: Property discovery, invariant extraction, strategy generation, test pipeline
  • ai_feedback: Feedback recording, quality metrics, preference learning, prompt building
  • ai_search: Code relevance scoring, function name extraction, search configuration
  • ai_recommendations: Security checks, score calculation, prompt generation

Tradeoffs

  • Local heuristic analysis provides fast results without Ollama, with optional AI enhancement
  • Each feature follows existing CLI patterns (clap subcommands, structured output)
  • No new dependencies required (uses existing proptest, serde, anyhow, colored)

Out of scope

  • Real-time file watching for code search updates
  • Cloud-based pattern sharing across projects
  • Advanced ML models for pattern recognition (uses heuristic + optional Ollama)

… 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.
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Nanle-code
Nanle-code merged commit 28a3214 into Nanle-code:master Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI Property-Based Testing AI Feedback and Learning System AI Code Search and Discovery AI Best Practice Recommendations

2 participants