Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 2.45 KB

development.md

File metadata and controls

67 lines (46 loc) · 2.45 KB

Development

Workspace layout

packages/core      Shared, host-independent code (@cortexkit/openai-auth-core, not published)
packages/opencode  OpenCode plugin (@cortexkit/opencode-openai-auth)
packages/pi        Pi extension (@cortexkit/pi-openai-auth)
scripts            Release and development tooling

STRUCTURE.md maps the files in more detail, and ARCHITECTURE.md describes how the pieces fit together.

Checks

Install dependencies:

bun install

Run the checks (the build refuses dependencies that resolve outside the repository):

bun run typecheck
bun run test
bun run build
bun run lint
bun run format:check

Inspect package contents before publishing:

The Node bundles keep jsonc-parser as a declared runtime dependency: its UMD entry uses relative require calls that Bun's bundler leaves unresolved when inlined. The packed-package tests check the external dependency allowlist and load the installed package with plain Node.

bun run pack:opencode:dry
bun run pack:pi:dry

Testing a local build with OpenCode

bun run dev

This builds the OpenCode plugin, symlinks the output into .opencode/plugins/, and starts tsc --watch. Restart OpenCode after starting the dev script and after rebuilds. Remove the local dev symlink with:

bun run dev:clean

Analyzing cache cliffs

To inspect a cache cliff, a sudden drop in prompt-cache reuse between turns, enable request dumps. The analyzer matches usage records only to main dumps: OpenCode 1 WebSocket requests, not WebSocket prewarm or HTTP requests. OpenCode 2 marks HTTP dumps http and WebSocket dumps observed, so the analyzer does not detect cliffs from either, even when those dumps are present.

Pass the SQLite database for the OpenCode instance that made the dumps. The analyzer looks in opencode-openai-auth-dumps in the OS temporary directory on Linux, macOS and Windows. If the instance uses a different directory, pass --dump-dir <path>.

bun run analyze:cache -- --session ses_... --db /path/to/opencode.db --no-timeline

To print previous and current request-body text around the first differing byte, add --wire-context with the number of surrounding bytes:

bun run analyze:cache -- --session ses_... --db /path/to/opencode.db --no-timeline --wire-context 180