Skip to content

packages/client has no consumable form: dist is gitignored, and the built dist carries bare dependency imports #39

Description

@iceteaSA

@cortexkit/claustrum-client is declared as a library — main: ./dist/index.js, an exports map pointing only at dist, a files: ["dist", "README.md"] allowlist — but there is no form a consumer outside this repo can actually import. dist/ is gitignored (.gitignore:7, packages/*/dist), nothing is published, and the built dist is not self-contained.

This is not hypothetical. A consumer on this box (the tok tooling) adopted the client this week and hit it at import.

What a consumer finds

Measured on a clean git archive of origin/master, three arms:

tsc dist, absolute-path import, unrelated cwd, node_modules present   OK, 9 exports
raw src/index.ts, absolute-path import, node_modules present          OK, 9 exports
the same tsc dist copied away from its node_modules                   ENOENT resolving
                                                                      '@cortexkit/subc-client'
                                                                      from dist/detect.js

The discriminator is not source-versus-built. bun run build runs tsc -p tsconfig.build.json, which emits per-file output: a 340-byte re-export barrel plus wire.js and detect.js carrying bare @cortexkit/subc-client imports. The artifact only works while it sits beside a populated node_modules, so it is not relocatable and not vendorable.

How the consumer worked around it, and why that is worse than it looks

Not knowing bun install alone was sufficient, they built the sibling subc client from source, symlinked it into packages/client/node_modules, and ran bun build src/index.ts --outdir dist --target bun — producing a 99KB bundle with the dependency inlined. That is what their tool imports today.

So the artifact in use is not the artifact bun run build produces. The first time anyone runs the repo's own documented build command in that checkout, the bundle is replaced by the tsc emit and the consumer breaks — not from a git clean, from the ordinary command. A consumer pinned to a procedure the repo does not perform is a break waiting on an unrelated action.

Worth noting the supported path does exist and is unremarkable — bun install --frozen-lockfile && bun run build, no symlink, no sibling source build, @types/bun arriving from the install. @cortexkit/subc-client is public on npm. The workaround was avoidable; it was reached because nothing states this.

Ask

Either would close it:

  1. Publish @cortexkit/claustrum-client — even 0.x. @cortexkit/subc-client already publishes to npm from this org, so the path exists. files/exports/prepack are already correct for it.
  2. Document the supported build in packages/client/README.md and state whether the dist is intended to be self-contained. If it is, the build wants a bundling step; if it is not, say so, because files: ["dist"] implies a package whose consumer resolves the dependency through npm — which no path-importing consumer does.

I lean (1): (2) still leaves consumers importing a gitignored artifact out of a working tree, and the failure mode is silent degradation at import rather than a version error.

Happy to do the work on either. Publishing is the org's call, not mine — flagging rather than assuming.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions