Skip to content

feat: --json and --host for generate, inspect command (1.2.0) - #1

Merged
jack1590 merged 10 commits into
mainfrom
feat/json-mode
Oct 12, 2026
Merged

jack1590 merged 10 commits into
mainfrom
feat/json-mode

Conversation

@jack1590

@jack1590 jack1590 commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Adds a machine-readable mode so other tools can drive roku-pkg without its interactive prompts. Roku Dev Studio's new Packager panel is the first user. Releases as 1.2.0.

What changes

  • generate --json
    • Prints one JSON event per line: step, log, and exactly one result, which is always last.
    • Never prompts. Every place that would prompt fails with an error code instead, such as NEEDS_BUILD_CHOICE or PROJECT_NOT_FOUND.
    • Exit codes: 0 ok, 1 failed, 130 cancelled. SIGTERM or SIGINT cleans up .roku-deploy-temp and reports CANCELLED.
    • Deploy and sign are separate steps, so a UI can show signing on its own.
    • With no build flag, it uses the project's new defaultBuildTask.
  • generate --host <ip>: uses a specific device without changing the saved one. It can't be combined with --discover. It also works in text mode.
  • inspect <dir> [--json]: shows the manifest title and version, the build folder and where it was found, and the VSCode tasks.
  • Config: ~/.roku-pkg/config.json is now written readable by its owner only (0600), since it holds sign keys and the device password.
  • Text mode: unchanged apart from --host.
{"type":"step","step":"rekey","status":"done","ms":7120}
{"type":"result","ok":true,"packagePath":"/Users/me/builds/CNBC.pkg","sizeBytes":19293184,"version":"4.12.0"}

Things a reviewer should know

  • Separate pipeline. --json runs a new non-interactive pipeline (src/lib/generate-json.ts) instead of branching inside the existing generate action. This keeps the interactive flow untouched. The cost is that the two flows now repeat some steps.
  • Password check. The device password is checked up front with roku-deploy's digest-auth request helper (doGetRequest on plugin_inspect). That helper is private in roku-deploy's typings, so it is cast. getDevId can't be used because it reads ECP without auth, so it can't detect a wrong password.
  • No overwrite on failure. The signed package is downloaded to a temp folder, then copied to the output. When a download fails, roku-deploy writes the error body to the target file, which would otherwise replace the last good package.
  • Build tasks get their own process group when run with an abort signal. This is so cancel stops npm run build and its children, not just the wrapper shell.
  • The password still travels in argv (--password), visible in ps during a run. This was an accepted trade-off.

Testing

  • npm test: 29/29 pass. New suites:
    • events,
    • inspect,
    • generate-json: every step, every error code, cancel, and checks that no secret is printed. It uses fake device and disk dependencies.
    • generate-cli: runs the built CLI and checks it prints only JSON lines and never prompts.
  • Not yet run end-to-end against a real Roku, because that rekeys the device. Smoke test before publishing:
npm run build && node dist/index.js generate <project> --json --host <ip> --password '<pwd>' --use-existing-build

Dependency and CI changes

  • npm audit fix removes the fixable advisories in tmp, postman-request, uuid and qs.
  • jest-util is now a dev dependency. It is a peer dependency of ts-jest. npm 9, which ships with Node 18, didn't install it, so npm ci + jest failed on Node 18.
  • The security job uses audit-ci (audit-ci.jsonc), failing on moderate and above.
    • Two advisories are allowlisted because no fixed release exists yet:
    • braces only expands our own glob patterns, never user input.
    • Any new advisory still fails the build.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8cb8d9b-08ae-4875-9cb8-75d5cd39474f

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jack1590
jack1590 merged commit e9f9f54 into main Oct 12, 2026
5 checks passed
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.

1 participant