Skip to content

detect_framework reports ox_lib users as ox_core and breaks ties by dict order #33

Closed

Description

@TMHSDigital

Summary

detect_framework_tool scores ox_lib as ox_core, so standalone, ESX and QBCore resources that use ox_lib are reported as ox_core with high confidence. Ties are broken by dict order, so multi-framework bridge resources are always reported as esx.

Where

  • mcp-server/tools/detect_framework.py:14-24 (MANIFEST_SIGNALS, "ox_lib": "oxcore", "qb-", "esx_")
  • mcp-server/tools/detect_framework.py:36-38 (CODE_SIGNALS, @ox_lib and exports['ox_lib'] as oxcore)
  • mcp-server/tools/detect_framework.py:74 (best = max(scores, ...))
  • mcp-server/tools/detect_framework.py:131-134 (raw substring match over the whole manifest)

Details

  • ox_lib is a framework-agnostic utility library used by ESX, QBCore, Qbox and plain standalone resources, yet it adds +3 to oxcore per manifest and more per code match.
  • Manifest signals are raw substring checks over the whole file, comments included. "qb-" matches any qb-* dependency (such as qb-target, common in ESX and standalone resources), and "qb-core" also matches "qb-", so one dependency scores twice. "esx_" matches any text containing it.
  • max() returns the first key on a tie, and esx is first. Running the tool on this repo's bridge examples (for example examples/secure-shop) reports Detected framework: esx, Confidence: medium (4 signals, 50% of total) with qbcore at the same score.

Impact

The framework-detection skill then generates code for the wrong framework, for example ox_core calls (Ox.GetPlayer) on a server that has no ox_core, or ESX-only code for a resource that supports both ESX and QBCore.

Steps to reproduce

  1. Create a directory with an fxmanifest.lua containing shared_script '@ox_lib/init.lua' and no framework dependency.
  2. cd mcp-server && python -c "from tools.detect_framework import detect_framework as d; print(d('<dir>'))" reports oxcore, confidence high.
  3. python -c "from tools.detect_framework import detect_framework as d; print(d('../examples/secure-shop'))" reports esx with qbcore tied.

Suggested fix

  • Treat ox_lib as a library signal (score 0, report it as "library: ox_lib"); count only ox_core / @ox_core for oxcore.
  • Match manifest signals as quoted dependency or script tokens (for example ['"]@?ox_core[/'"]) instead of bare substrings; restrict qb- matching to qb-core; ignore comments.
  • When the top two scores tie, report "multiple frameworks / bridge" with both names instead of picking one.

Acceptance criteria

  • A manifest with only @ox_lib/init.lua detects as standalone (with ox_lib noted as a library).
  • Each of templates/{esx,qbcore,qbox,oxcore,vorp,rsg,standalone} detects its own framework with confidence high.
  • Equal esx and qbcore scores produce an explicit multi-framework / bridge result.
  • A manifest with @qbx_core and @ox_lib detects qbox, not a tie with oxcore.
  • Tests also cover: empty dir gives standalone with "No framework signals detected"; nonexistent path gives Error: directory not found; files under node_modules/ and .git/ are ignored; files over 256 KB are read only up to MAX_FILE_SIZE.

Getting started

  • Relevant files: mcp-server/tools/detect_framework.py
  • How to run checks: there is no test suite yet; run the MCP server with cd mcp-server && pip install -r requirements.txt && python server.py, and CI checks live in .github/workflows/validate.yml
  • Related docs: skills/framework-detection/SKILL.md

Filed by repo-audit/full-audit at 701824d. Severity: medium. Effort: S. audit-key: bug|mcp-server/tools/detect_framework.py|detect_framework

Activity

  1. added
    bug
    good first issue
    on Nov 21, 2026
  2. TMHSDigital commented on Nov 21, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in a43be53.

    Manifest signals now match quoted dependency/script tokens (comments ignored), ox_lib and oxmysql are reported as libraries without scoring, and equal top scores report "multiple frameworks / bridge".

    Verified: Every framework template detects its own framework with high confidence; an ox_lib-only manifest is standalone with ox_lib listed; @qbx_core + @ox_lib is qbox; es_extended + qb-core and examples/secure-shop report a bridge; qb-target and commented names are ignored. Covered by mcp-server/tests/test_detect_framework.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issueseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions