Files
anomalyco_opencode/packages/opencode
Aiden Cline cc437b9e9a fix(opencode): make Rune tolerate idiomatic defensive JavaScript
Bring the Rune interpreter closer to JS semantics so ordinary defensive code
stops crashing where real JS would quietly yield undefined or succeed:

- Unknown property reads on strings, numbers, and arrays now yield undefined
  instead of throwing (including under optional chaining, which only guards
  null/undefined receivers). MCP results are frequently JSON strings, so
  `result?.field ?? result` reads the field when present and falls back to the
  raw string otherwise. The method allowlist still errors (e.g. arr.splice keeps
  its rewrite hint).
- `typeof undeclaredIdentifier` is now "undefined" rather than a reference
  error, so `typeof x !== "undefined"` feature-detection guards are safe.
- Object spread of null/undefined is a no-op, so `{ ...maybeOpts, override }`
  merges work when the operand is absent.
- Builtin coercions (Boolean/String/Number) are accepted as array callbacks, so
  filter(Boolean) / map(String) / map(Number) work.

Adds rune-parity.test.ts covering each fix plus its guardrails, and documents
the parity behavior in rune.md.
2026-07-01 12:20:54 -05:00
..
2026-03-27 15:00:26 +01:00

js

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.2.12. Bun is a fast all-in-one JavaScript runtime.