Skip to content

Publish a library surface + real-server testing helpers - #124

Merged
cuibonobo merged 2 commits into
mainfrom
claude/npm-library-exports
Sep 13, 2026
Merged

cuibonobo merged 2 commits into
mainfrom
claude/npm-library-exports

Conversation

@cuibonobo

Copy link
Copy Markdown
Member

Summary

  • @haverstack/server has been Docker-image-only (no npm exports/main) — nothing could depend on it. Splits the process entrypoint into src/main.ts (dev/start scripts + Dockerfile CMD updated) and makes src/index.ts a pure library barrel (createApp, initStack/StackContext, loadConfig/Config, createShutdownHandler).
  • Adds @haverstack/server/testing (mirrors @haverstack/core/testing): promotes tests/setup.ts's fixtures to a public surface and adds startTestServer(), which spins up a real, listening instance on an ephemeral port — for a consumer's HTTP client (e.g. @haverstack/adapter-api, from @haverstack/cli's upcoming server-path integration tests) to exercise against the actual wire protocol instead of a mocked fetch. tests/setup.ts now imports the shared pieces instead of duplicating them.
  • package.json gains exports/main/types/files/publishConfig.access: "public".
  • release.yml gains an npm publish step (OIDC Trusted Publishing, id-token: write, alongside the existing Docker push) — this repo will need npm Trusted Publishing configured for haverstack/server on npmjs.com before this step succeeds; it isn't something I can set up.
  • ci.yml gains a build job, since a broken build now breaks downstream consumers, not just the Docker image.

Test plan

  • pnpm run format:check / lint / typecheck / test / build all green (526 tests).
  • New tests/testing.test.ts proves startTestServer() actually listens: real fetch() against /.well-known/stack and an authenticated /types round trip over a real socket, plus a close() teardown check.
  • Docker image still builds/runs correctly with the renamed dist/main.js entrypoint (not verified in this environment — no Docker available; please confirm before merging).

🤖 Generated with Claude Code

https://claude.ai/code/session_017sUHNZvaGXZVgA4w93Waco

@haverstack/server has been an app only (Docker image, no npm exports) --
nothing could depend on it. Splits the executable entrypoint out to
src/main.ts (dev/start/Dockerfile CMD updated accordingly) and makes
src/index.ts a pure library barrel: createApp, initStack/StackContext,
loadConfig/Config, createShutdownHandler.

Adds @haverstack/server/testing (mirrors @haverstack/core/testing),
promoting tests/setup.ts's fixtures to a public surface and adding
startTestServer(): spins up a real, listening instance on an ephemeral
port so a consumer's HTTP client (e.g. @haverstack/adapter-api) can be
exercised against the actual wire protocol instead of a mocked fetch.
tests/setup.ts now imports the shared pieces instead of duplicating them.

package.json gains exports/main/types/files/publishConfig; release.yml
gains an npm publish step (OIDC Trusted Publishing, alongside the
existing Docker push); ci.yml gains a build job now that a broken build
would break downstream consumers, not just the Docker image.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sUHNZvaGXZVgA4w93Waco
Comment thread .github/workflows/ci.yml Fixed
CodeQL flagged all five jobs (format/lint/typecheck/test/build) for not
limiting GITHUB_TOKEN permissions. None of them push, comment, or need
anything beyond checking out the code, so a single workflow-level
contents: read covers all of them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sUHNZvaGXZVgA4w93Waco
@cuibonobo
cuibonobo merged commit 0fc327d into main Sep 13, 2026
8 checks passed
@cuibonobo
cuibonobo deleted the claude/npm-library-exports branch September 13, 2026 14:44
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.

2 participants