Skip to content

v0.1.2

Choose a tag to compare

@hyein-cbio hyein-cbio released this 07 Oct 09:44
· 5 commits to main since this release
e9c9e9f

Word-level diff highlighting

  • Highlight changed words in single-line codemode edit/write replacements using red/green inverse video, matching Pi's native edit rendering.
  • Apply highlighting in collapsed previews and expanded views, including persisted PiG entries.
  • Use the renderer-provided theme rather than Pi's global theme; retain colors after theme changes, session resume, and reload.
  • Preserve terminal-control sanitization and keep ANSI styling out of stored diffs and model-facing results.
  • Preserve each original line's whitespace. If word diffing cannot reconstruct both inputs exactly, display the original lines without word highlighting.
  • Bound large or complex word comparisons and fall back to ordinary line colors.

Scope and dependencies

Like Pi's native edit diff, word highlighting applies only to a consecutive block containing exactly one removed line and one added line. Multi-line replacements and standalone additions/deletions retain line colors.

The package now declares diff as a runtime dependency. Pi installs it for npm/git sources. For local checkouts, install dependencies before loading:

npm install --omit=dev --omit=peer --ignore-scripts
# Or npm ci for development.

PiG still uses the existing Node compatibility path and separate completion-time entries; this release does not include a native Go port.

Validation

  • npm run typecheck passed.
  • 73 tests passed; 1 optional actual-PiG-runtime loader test was skipped because PIG_NODE_RUNTIME_DIR was not provided.
  • Tests cover parity with Pi's native word highlighting in dark/light themes, previews, Unicode/wrapping, control-character sanitization, whitespace preservation, model-context isolation, real Pi tool-component rendering, theme changes, session resume, and npm artifact loading.
  • PiG entry rendering is covered by unit tests; this release's new highlighting was not revalidated in the actual PiG executable.
  • git diff --check and npm publish --dry-run --ignore-scripts passed.

Install

pi install git:github.com/hyein-cbio/pi-codemode-diff@v0.1.2
pig install git:github.com/hyein-cbio/pi-codemode-diff@v0.1.2

Run /reload in an existing session after upgrading.

The attached npm tarball contains source, README, license, and the manifest; dependencies are declared rather than bundled. npm registry publication is a separate manual step and has not been performed as part of this GitHub release.