Skip to content

Adds roku (Brightscript/BrighterScript and SceneGraph) support#37

Merged
Houseofmvps merged 3 commits intoHouseofmvps:mainfrom
Fyb3roptik:main
Apr 21, 2026
Merged

Adds roku (Brightscript/BrighterScript and SceneGraph) support#37
Houseofmvps merged 3 commits intoHouseofmvps:mainfrom
Fyb3roptik:main

Conversation

@Fyb3roptik
Copy link
Copy Markdown
Contributor

Summary

Adds full codesight support for Roku apps. Anchors project detection on the plain-text manifest file (the same file Roku itself uses), adds three new regex-based extractors (BrightScript, BrighterScript, SceneGraph XML), and wires all 8 detectors to map Roku idioms onto codesight's existing data model.

Closes #.

Layouts supported:

  • Standard single-channel (~90% of Roku repos, the getting-started template + kernel-roku-style): manifest + source/ + components/ at the repo root.
  • BrighterScript template (rokucommunity/brighterscript-template): bsconfig.json at root, channel rooted under src/. Detected as a single channel, not promoted to a monorepo.
  • Multi-channel monorepo (explicit exception — large codebases that ship several branded channels via roku-deploy + gulp merging a shared common/ layer): each channel registered as its own workspace. Strict structural signal (no root manifest + roku-deploy in deps + common/ + ≥2 sibling-channel dirs with manifests) so an ordinary single-channel repo that happens to have roku-deploy is never mis-labeled.

Mapping:

  • Routes — every child with an id in a Scene XML's <children> becomes a route. method = VIEW by default, upgraded to MODAL when a configurable navigation helper (default set covers ShowScreen, pushScreen, NavigateTo, showView, plus camelCase variants) is called with a literal true second arg. Works on projects with no helper at all.
  • Schemaorm: "scenegraph" models from every component XML with a non-empty <interface>. Field types normalized (Stringstring, assocarrayobject, nodenode-ref, etc.).
  • Components — one per SceneGraph XML; props = interface field ids.
  • Libraries.brs functions/subs; .bs adds classes, namespaces, enums, interfaces on top. Files under components/ are skipped (handler code, not libs).
  • MiddlewareobserveField subscriptions, m.global.AddField registrations. BugsnagTask / RudderstackTask recognized when present.
  • Graph — edges from <script uri="pkg:/..."> in XML + import "pkg:/..." in .bs, with a suffix-match resolver for nested channel layouts.
  • Events — observed fields (system: scenegraph-observer) + Rudderstack event names (system: rudderstack).
  • Config — Roku manifest keys surfaced as manifest.<name> pseudo env-vars.

Changes

  • types.ts — adds Framework: "roku-scenegraph", ComponentFramework: "scenegraph", ORM: "scenegraph", language: "brightscript", EventInfo.system: "scenegraph-observer" | "rudderstack", and a CodesightConfig.rokuScreenHelpers?: string[] option.
  • scanner.ts — adds .brs, .bs, .xml to CODE_EXTENSIONS; bare manifest added as a non-extension exception; roku_modules + .roku-deploy-staging added to IGNORE_DIRS; new hasRokuManifest(), detectBrighterScriptTemplateRoot(), and detectRokuMonorepo() helpers (structural common/ + ≥2 channels + roku-deploy signal); Roku language/framework/ORM + component framework branches; workspace discovery wires the monorepo detector in front of the generic depth-2 fallback.
  • ast/extract-scenegraph.ts — new file. Parses <component>, <interface> fields + functions, <script uri> includes, <children>. Exposes extractSceneGraphComponent, extractMainSceneScreens, isSceneGraphXml.
  • ast/extract-brightscript.ts — new file. extractBrightScriptFunctions, extractBrightScriptObservers, extractBrightScriptNavigationCalls (configurable helper names), extractBrightScriptShowScreenCalls (back-compat wrapper), extractBrightScriptGraphqlCalls, extractBrightScriptGlobalFields, extractBrightScriptRudderstackEvents, extractFindNodeBindings.
  • ast/extract-brighterscript.ts — new file. extractBrighterScriptImports + extractBrighterScriptExports (classes, namespaces, enums, interfaces; composes with BrightScript extractor for functions/subs).
  • detectors/routes.ts — new case "roku-scenegraph" branch + detectRokuScreens() helper. Children-first: <children> slots are the primary route surface; helper-call sites are optional enrichment that can flip VIEW→MODAL.
  • detectors/schema.ts — new case "scenegraph" branch + detectSceneGraphSchemas() helper.
  • detectors/components.ts — new case "scenegraph" branch + detectSceneGraphComponents() helper.
  • detectors/libs.ts.brs/.bs added to lib filter; dispatches to the new extractors. Filter now compares against the project-relative path, fixing a latent bug where any project hosted under a parent tests/ directory had all its lib files silently dropped.
  • detectors/middleware.ts — emits observeField + m.global.AddField as custom middleware, BugsnagTask as error-handler, RudderstackTask as logging.
  • detectors/graph.ts — extended to .brs/.bs/.xml; new extractSceneGraphImportsInline + extractBrighterScriptImportsInline with a suffix-match resolver for pkg:/... URIs.
  • detectors/events.ts — extended to .brs/.bs; emits scenegraph-observer + rudderstack events.
  • detectors/config.ts — surfaces manifest in configFiles and manifest keys as manifest.<name> env vars.
  • README.md — adds BrightScript/BrighterScript to the Works-with line, updates the Supported Stacks table, adds a ## Roku / BrightScript / SceneGraph section that leads with the standard single-channel layout, documents the BrighterScript template variant, and calls out the multi-channel monorepo as an explicit exception with the structural signal described. Documents the rokuScreenHelpers config option.

Tests

New Roku SceneGraph Detection suite in tests/detectors.test.ts with four fixtures and assertions:

  1. Kernel-roku-style single channel with no navigation helper at all — asserts two VIEW routes are derived from MainScene's <children> alone, repo is not flagged as a monorepo.
  2. BrighterScript template (bsconfig.json + src/manifest) — asserts root is identified as the Roku channel, schemas + components include src/-rooted paths, not promoted to monorepo.
  3. roku-deploy in deps but only one channel — asserts the structural signal does not fire, repo is single-channel.
  4. Full multi-channel feature coverage — asserts VIEW/MODAL routes, scenegraph schemas with normalized field types, components + props, .brs + .bs lib exports, script-include + import dependency edges, manifest config surfacing, and observeField/m.global middleware.

Full suite: 58/58 pass (54 pre-existing + 4 new).

Real-world smoke tests:

  • Synthetic kernel-roku-style channel (5 files, no navigation helper): detected as roku-scenegraph | scenegraph | brightscript, not a monorepo, 2 VIEW routes pulled from <children> alone.
  • Multi-channel monorepo with 5 workspaces (common + 4 channels): still correctly detected as monorepo, 253 files scanned, 132K tokens saved per conversation.

@Fyb3roptik
Copy link
Copy Markdown
Contributor Author

Fixes #36

@Houseofmvps Houseofmvps merged commit e717f1e into Houseofmvps:main Apr 21, 2026
1 check failed
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.

2 participants