Skip to content

Discovery Engine — Phase 4: JS-bundle route + API-call extraction (framework fingerprint) #129

Description

@badchars

Part of the Discovery Engine epic #125.

Scope — routes/endpoints from loaded JS bundles (most advanced)

SPA route tables and API URLs are often statically defined in the app's JS. Extract them from the already-loaded bundles (in the browser) — this surfaces routes/endpoints without any clicking.

  • Framework fingerprint: window.ng/__NG*, __REACT*, window.__VUE*, __NEXT_DATA__, script-src patterns → run only relevant extractors.
  • js-route detectors (per framework):
    • Angular: RouterModule.forRoot([...]) / loadChildren / route metadata.
    • React Router: createBrowserRouter([...]), <Route path>, route manifest.
    • Vue Router: routes: [{ path }].
    • Next.js: __NEXT_DATA__, build/route manifest.
  • api-call detector: mine fetch("/api/..."), axios.<m>("/..."), template-literal URLs, baseURL/API_BASE constants → endpoints.

Honest fragility

Minified/obfuscated bundles make regex/AST extraction brittle. Mitigations: prefer source-maps when present; emit with a confidence score; treat as best-effort seeds (the crawl/LLM still validate). This is why it's the last phase and modular per framework.

Commits (granular)

Fingerprint → bundle collection (loaded scripts) → source-map detection → Angular route extractor → React extractor → Vue extractor → Next.js extractor → api-call URL miner → base-url resolution → confidence scoring → emit → per-extractor tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions