Skip to the content.

How It Works – Discovery, Scoring, and “Why”

Table of Contents

This guide explains exactly how the discovery engine ranks candidates and how to use the Discovery Lens CLI to verify the reasoning in your own repo.

Language Integrations At A Glance

Language Discovery Strategy CLI Hooks Scaffold Output Notes
JavaScript In-process heuristics over Babel AST (src/adaptive/discovery-engine.js) discover, why, scaffold, enable-invisible Jest suites (JavaScript) Baseline experience with telemetry + invisible mode
TypeScript DiscoveryEngine with TS extensions (src/adaptive/typescript/discovery.js) discover, why, scaffold Jest suites (ts-jest) Resolves path aliases through tsconfig-resolver.js
Python spawnSync bridge running ast.parse (src/adaptive/python/python-discovery-integration.js) discover, scaffold, why (signature hints) Pytest skeletons Requires local python3; 5 s timeout + 1 MB buffer
Java java-parser AST collector (src/adaptive/java/java-discovery-collector.js) discover, scaffold JUnit tests Auto-detects Maven/Gradle layouts
Go Tree-sitter (tree-sitter-go) collector (src/adaptive/go/go-discovery-collector.js) discover, scaffold Go test skeletons Optional dependency; graceful fallback when parser missing
PHP Native PHP bridge with php-parser fallback (src/adaptive/php/php-discovery-collector.js) discover, scaffold PHPUnit cases Captures namespaces, traits, and functions
Ruby Ripper AST fallbacks with caching (src/adaptive/ruby/ruby-discovery-integration.js) discover, scaffold RSpec skeletons 2 s interpreter checks + bounded cache
Rust Lezer-based parser (src/adaptive/rust/rust-discovery-collector.js) discover, scaffold Rust test modules (#[cfg(test)]) Infers crate/module names for output paths
Wolfram Wolfram CLI bridge (src/adaptive/wolfram/wolfram-discovery-collector.js) discover Not yet available Scaffolding tracked on roadmap

Run Discovery Lens:

npx adaptive-tests why '{"name":"UserService"}'
# Or machine‑readable output
npx adaptive-tests why '{"name":"UserService"}' --json

Each candidate receives points from distinct categories. The CLI shows a ranked list plus a per‑factor breakdown so you can see where points came from.

Scoring Categories

Notes:

Lifecycle

  1. Candidate Collection
  1. Scoring (static)
  1. Recency Bonus (optional)
  1. Structural Validation (dynamic)

Using Discovery Lens to Debug

Configuration Pointers