export field configured by exposing a stable public API surface for mex-agent - #44
Conversation
|
Quick review — three small cleanups before merge:
Small nits (non-blocking):
What's good: minimal public surface, CI note: |
theDakshJaitly
left a comment
There was a problem hiding this comment.
LGTM — all three cleanup asks addressed and the pointless rename nit fixed. Public surface stays minimal and well-curated; CI green on Node 20 and 22; 153/153 tests pass locally. Approving and merging.
What
Expose a stable public API surface for mex-agent so embedders can consume it in-process as an npm
dependency, instead of shelling out to the mex CLI.
The change is purely additive:
helpers, and shared types.
(dist/index.js + dist/index.d.ts).
the project + scaffold live (bypasses findConfig's .mex/ discovery).
DEFAULT_SCAFFOLD_PATTERNS and DEFAULT_HEARTBEAT_PATTERNS exported so callers can extend rather than
replace.
from it).
asserts the contract (function shapes, runtime constants, round-trip behaviour). CI-enforced so the
contract can't rot silently.
Why
mex-agent currently ships only a CLI binary. External tools that want to reuse its drift detector,
event log, heartbeat checker, or frontmatter parser have two bad options: shell out to mex (slow, no
types, fragile across versions) or vendor the source (creates a maintenance fork). Adding a typed
public entry lets them depend on mex-agent directly via npm install and import functions in-process.
T-Rex (a team-mode layer being built on top of mex) is the first such consumer and motivated the
specific export list, but nothing here is T-Rex-specific.
Type of change
How to test
path-separator failures in test/heartbeat.test.ts:38 and test/scanner.test.ts:56 are unrelated to
this PR and exist on main.
createConfig, EVENT_KINDS, type MexConfig } from "mex-agent" — should resolve with full types.
Checklist
defaulting to current behaviour. Internal callers (cli.ts, doctor.ts, tui.ts, watch.ts,
sync/index.ts) are untouched and continue to compile.