A comprehensive command-line tool for managing multiple Roku projects and automating package (.pkg) generation with advanced device discovery and automation features.
- 🔍 Device Discovery: Automatically discover Roku devices on your network using SSDP
- 📺 Multi-Project Management: Manage multiple Roku projects in one place
- 🤖 Full Automation: Complete CI/CD support with non-interactive flags
- 🔐 Secure Configuration: Store signing credentials and device configurations securely
- 🏗️ Build Integration: Seamless integration with VSCode tasks and custom build commands
- 🚀 Smart Deployment: Automated device rekeying and package generation
- 🏠 Device Management: Automatic home screen navigation for clean workflow
- 💾 Configuration Persistence: JSON-based configuration with easy migration
- 🎯 Interactive & Automated: Support both interactive prompts and full automation
- ✅ Validation & Error Handling: Comprehensive project structure validation
- 🔧 VSCode Integration: Built-in support for VSCode launch.json and tasks.json
- Node.js v18 or higher
- npm, yarn, or pnpm
- A Roku device in developer mode
- Roku app source code with proper structure
npm install -g @jcjoyac/roku-pkg-cli# Clone the repository
git clone https://github.com/jack1590/roku-pkg-cli.git
cd roku-pkg-cli
# Install dependencies
npm install
# Build the project
npm run build
# Link globally
npm link-
Discover and configure your Roku device
roku-pkg discover --configure
-
Add your first project
roku-pkg add
-
Generate a package with full automation
roku-pkg generate myproject --discover --first-device --password mypass
-
Configure your Roku device manually
roku-pkg device
-
Add your first project
roku-pkg add
-
Build and generate a package
roku-pkg generate
The tool stores all configuration in a roku-pkg-config.json file in your current directory:
{
"rokuDevice": {
"ip": "192.168.2.35",
"password": "your-dev-password"
},
"projects": [
{
"name": "MyApp",
"rootDir": "/path/to/roku/app/source",
"signKey": "your-signing-key",
"signPackageLocation": "/path/to/signed.pkg",
"outputLocation": "./output/MyApp.pkg"
}
]
}Discover Roku devices on your network using SSDP protocol.
# Basic discovery
roku-pkg discover
# Discover and configure immediately
roku-pkg discover --configure
# Automation: auto-select first device and provide password
roku-pkg discover --configure --first-device --password mypassConfigure Roku device settings.
roku-pkg deviceBuild, deploy, and generate a package for a project. This will:
- Validate the project structure
- Read VSCode launch.json configuration (if available)
- Use the configured build directory or detect it automatically
- Rekey the Roku device with the project's signing key and package
- Deploy the build to your Roku device
- Create a new signed package
- Save it to the specified output location
roku-pkg generate MyApp
# or
roku-pkg generate # Select from listgenerate --json prints one JSON object per line and never prompts, so other tools (and Roku Dev Studio's Packager) can drive it:
roku-pkg generate CNBC --json --host 192.168.0.13 --password "$ROKU_DEV_PASSWORD" --use-existing-build{"type":"step","step":"home","status":"start"}
{"type":"step","step":"home","status":"done","ms":2010}
{"type":"step","step":"build","status":"skip","detail":"used existing build"}
...
{"type":"result","ok":true,"packagePath":"/Users/me/builds/CNBC.pkg","sizeBytes":19293184,"version":"4.12.0"}
Steps are home, build, validate, rekey, deploy, sign and save. A failed run ends with
{"type":"result","ok":false,"step":"rekey","code":"REKEY_FAILED","message":"...","hint":"..."}.
Error codes: PROJECT_NOT_FOUND, DEVICE_UNREACHABLE, AUTH_FAILED, NEEDS_BUILD_CHOICE, TASK_NOT_FOUND,
BUILD_FAILED, BUILD_TIMEOUT, INVALID_BUILD, SIGNED_PKG_MISSING, REKEY_FAILED, DEPLOY_FAILED,
DEPLOY_TIMEOUT, SIGN_FAILED, KEY_MISMATCH, CANCELLED, UNKNOWN. Exit code is 0 on success, 1 on failure, 130 when cancelled.
With no build flag, --json uses the project's defaultBuildTask; if it has none and VSCode tasks exist, it fails with NEEDS_BUILD_CHOICE.
Shows what roku-pkg detects in an app folder: manifest title and version, the build folder (and where it came from), and the VSCode tasks.
Your Roku app must follow the standard structure:
your-roku-app/
├── manifest # Required: App configuration
├── source/ # Required: BrightScript source files
│ └── main.brs # Required: Entry point
├── components/ # Optional: SceneGraph components
├── images/ # Optional: Image assets
└── fonts/ # Optional: Font files
The tool automatically detects and uses VSCode launch.json configuration if present in your project. This allows seamless integration with your existing development workflow.
{
"version": "0.2.0",
"configurations": [
{
"type": "brightscript",
"request": "launch",
"name": "BrightScript Debug: Launch",
"rootDir": "${workspaceFolder}",
"outDir": "${workspaceFolder}/dist",
"stagingFolderPath": "${workspaceFolder}/.out"
}
]
}The tool will automatically:
- Read the build output directory from
stagingFolderPath,outDir, or common build directories (dist,build,out,.out) - Use the configured build directory for deployment
- Fall back to the project root if no build directory is found
- Prepare your Roku app: Ensure your app follows the standard Roku structure
- Get your signing credentials: You need an existing signed .pkg file and its signing key
- Add the project: Run
roku-pkg addand provide all required information - Generate packages: Run
roku-pkg generate <project-name>to build and package
The CLI is designed for seamless CI/CD integration with complete automation support:
# GitHub Actions, Jenkins, etc.
roku-pkg generate myproject \
--discover \
--first-device \
--password "$ROKU_DEV_PASSWORD" \
--build-task "build:production" \
--skip-build # if build happens in previous CI stepEnvironment Variables:
- Set
ROKU_DEV_PASSWORDin your CI environment - Use
--first-deviceto automatically select the first discovered device - Combine with
--build-taskto specify exact build commands
When you run roku-pkg generate, the tool will:
- Validate your project structure
- Read VSCode launch.json configuration (if available)
- Detect the build directory automatically
- Deploy the build to your Roku device using roku-deploy
- Rekey your device with the project's signing key
- Generate a signed .pkg file
- Save the package to your specified output location
- The tool supports
~in paths (expands to home directory) - Relative paths are converted to absolute paths for rootDir
- The tool validates that your project has the required structure
- Missing files or directories will be reported before build
- The tool automatically detects build directories from VSCode configuration
- Common build directories are checked:
dist,build,out,.out - Final packages are saved to your configured output location
- Connection errors include helpful tips about network and device setup
- Build errors show what's missing in your project structure
- Authentication errors suggest checking passwords
- Your project needs to be updated with the root directory
- Run
roku-pkg edit <project>to add the rootDir
- Your Roku app is missing the manifest file
- Create a manifest file in your app's root directory
- Your Roku app needs a source directory
- Create a
sourcefolder with at least amain.brsfile
- Ensure your Roku is on the same network as your computer
- Verify developer mode is enabled on your Roku
- Check the IP address is correct
- Try pinging the device:
ping <roku-ip>
- Verify your Roku developer password
- Re-run
roku-pkg deviceto update credentials
- Check that the signing key matches the signed package
- Ensure the signed package file exists and is valid
- Verify the package was signed with the provided key
roku-pkg-cli/
├── src/
│ ├── index.ts # CLI entry point
│ ├── commands/ # Command implementations
│ ├── lib/ # Core libraries
│ │ ├── config-manager.ts # Configuration management
│ │ ├── roku-api.ts # Roku device API
│ │ └── roku-deploy.ts # roku-deploy integration
│ ├── types/ # TypeScript types
│ └── utils/ # Utility functions
│ └── vscode-config.ts # VSCode configuration reader
├── dist/ # Compiled JavaScript
├── package.json
└── tsconfig.json
npm run buildnpm run devThis project is configured to automatically publish to npm when a GitHub release is created. To set this up:
- NPM Account: You need an npm account with publishing permissions
- NPM Token: Generate an automation token from npmjs.com
-
Generate NPM Token:
- Go to npmjs.com and log in
- Navigate to Access Tokens in your account settings
- Generate a new "Automation" token
- Copy the token (it starts with
npm_)
-
Add GitHub Secret:
- Go to your GitHub repository settings
- Navigate to "Secrets and variables" → "Actions"
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste your npm token
-
Create a Release:
- Go to GitHub releases and click "Create a new release"
- Create a tag with version format
v1.2.3(following semver) - Write release notes
- Click "Publish release"
-
Automatic Publishing:
- The GitHub Action will automatically:
- Run all tests
- Update package.json version to match the release tag
- Build the project
- Publish to npm registry
- Report success/failure
- The GitHub Action will automatically:
- Release tags should follow semantic versioning:
v1.0.0,v1.1.0,v2.0.0 - The GitHub Action automatically syncs the package.json version with the release tag
- Only non-prerelease releases trigger automatic publishing
This tool uses the official roku-deploy package from the Roku Community for building, deploying, and packaging Roku applications.
MIT
Contributions are welcome! Please feel free to submit a Pull Request.