Skip to content

Support for Roku projects (BrightScript, BrighterScript, SceneGraph) #36

@Fyb3roptik

Description

@Fyb3roptik

Feature Request: Roku / BrightScript / BrighterScript / SceneGraph support

Problem

codesight currently supports 13 languages but none of them cover Roku channel development. Roku apps use BrightScript (.brs), BrighterScript (.bs, a superset), and SceneGraph XML components (.xml), with a plain-text manifest file as the channel root — a stack that no existing detector matches.

Running codesight on a real Roku repo today produces an almost-empty result because:

  • .brs, .bs, and .xml are not in CODE_EXTENSIONS, so no source is even scanned
  • Project detection has no anchor for Roku, so language falls back to javascript and the framework is raw-http
  • None of the 8 detectors know how to map Roku idioms (screens in <children>, <interface> contracts, <script uri> includes, m.top.observeField) to codesight's data model

Example output on a standard Roku channel before the change:

Detecting project... raw-http | no ORM | javascript
Collecting files... 0 files
Analyzing... done
Results:
  Routes: 0  Models: 0  Components: 0  Libraries: 0

Proposed Solution

Add Roku as a first-class target, anchored on the plain-text manifest file (with title= and major_version= keys) that Roku itself uses to identify a channel. Cover the two layouts that effectively all Roku repos fall into:

Standard single-channel layout (~90% of Roku repos — matches the Roku docs' getting-started template, projects like kernel-roku, and the rokucommunity/brighterscript-template):

/
  manifest
  source/         # Main.brs + shared .brs libraries
  components/     # *.xml + paired *.brs component handlers
  images/

The rokucommunity/brighterscript-template variant, where the channel lives under src/ and the root has a bsconfig.json, should be recognized as the same case (single channel, rooted at src/) — not promoted to a monorepo.

Multi-channel monorepo layout (less common — used by larger codebases that ship several branded channels from one repo with roku-deploy + gulp to merge a shared common/ layer with per-channel assets at build time):

/
  package.json      # depends on roku-deploy, gulp
  gulpfile.js
  src/apps/
    common/         # shared layer, merged into every channel at build
    creatorA/
      manifest
    creatorB/
      manifest

This should be detected via a strict structural signal (no manifest at root + roku-deploy in deps + a common/ directory with at least 2 sibling directories that each have their own manifest) so that an ordinary single-channel repo that happens to include roku-deploy is never mis-labeled as a monorepo.

Mapping to codesight's data model:

codesight concept Roku equivalent
Routes Screens — every child element with an id in the Scene XML's <children>. method = VIEW by default, upgraded to MODAL when a configurable navigation helper (ShowScreen, pushScreen, NavigateTo, etc.) is called with a literal true second argument. Works on projects with no navigation helper at all.
Schema Every SceneGraph component XML whose <interface> has at least one <field> — the typed contract is the model. orm = scenegraph.
Components Every <component name="..." extends="..."> XML. Props = interface field ids.
Libraries .brs / .bs files outside components/ — top-level function/sub plus BrighterScript class / namespace / enum / interface.
Middleware m.top.observeField, m.global.AddField, plus any BugsnagTask / RudderstackTask wiring.
Dependencies <script uri="pkg:/..." /> in component XML + import "pkg:/..." in .bs.
Events Observed fields (system: scenegraph-observer) and Rudderstack event names (system: rudderstack).
Config The Roku manifest key/value lines surfaced as manifest.<name> pseudo env-vars.

New types: Framework: "roku-scenegraph", ComponentFramework: "scenegraph", ORM: "scenegraph", language: "brightscript". New config option rokuScreenHelpers?: string[] for projects that use custom navigation helper names.

Expected Output

Standard single-channel Roku app (kernel-roku-style, no custom navigation helper):

Detecting project... roku-scenegraph | scenegraph | brightscript
Collecting files... 5 files
Analyzing... done
Results:
  Routes: 2  Models: 2  Components: 3  Libraries: 1
- `VIEW` `/homeView` — components/views/HomeView.xml
- `VIEW` `/detailView` — components/views/DetailView.xml

### HomeView
- items: array

### DetailView
- itemId: string

Multi-channel monorepo (the documented exception):

Detecting project... roku-scenegraph | scenegraph | mixed
Monorepo: common, creatorA, creatorB, creatorC, creatorD
Collecting files... 253 files
Analyzing... done
Results:
  Routes: 12  Models: 71  Components: 81  Libraries: 57
  Saved: ~132,535 tokens per conversation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions