Scoped package: @carllee1983/dbcli. All npm / npx examples below use this name.
Before running npm publish:
-
Verify build is clean:
bun run build ls -lh dist/cli.mjs # expect a few MB (bundled CLI + dependencies) -
Verify tests pass (pick one):
# Fast path: unit + core only (matches CI-style smoke) bun run test:unit # Full suite (Bun test runner) bun test
For live database integration tests, set an explicit config if needed:
LIVE_DB_CONFIG_PATH=/path/to/.dbcli bun test tests/integration/live-db.test.tsIf no live config is available,
tests/integration/live-db.test.tsskips instead of falling back to the default PostgreSQL configuration. UseSKIP_INTEGRATION_TESTS=trueto skip integration tests when running a broadbun test. -
Update version in package.json:
npm version minor # bumps version + creates git tag (in this repo) # OR edit the "version" field in package.json by hand
-
Verify package contents (dry run):
npm pack --dry-run
Expect
dist/(includingcli.mjs,core.mjs/core.d.ts, andagent-core.mjs/agent-core.d.ts),assets/(e.g.SKILL.md,reference.mdfordbcli skill),README.md,CHANGELOG.md,LICENSE, andpackage.json. There must be nosrc/,tests/, ornode_modules/. The listing may also include other rootREADME*.mdfiles (npm can still pack them even whenfilesis set); dev-only readmes are listed in.npmignore— re-check with dry-run if you add or remove docs. -
Check package size:
npm pack ls -lh carllee1983-dbcli-*.tgz # compressed tarball (typically well under 5MB) rm carllee1983-dbcli-*.tgz # cleanup
Publication uses the prepublishOnly script in package.json:
npm publishWhat runs (conceptually):
prepublishOnly:bun run build— rebuildsdist/cli.mjsfromsrc/cli.tsviascripts/build.ts.- Tarball — paths from the
filesfield inpackage.json, further filtered by.npmignore. (Some npm versions also merge in extra rootREADME*files; use dry-run to see exactly what will ship.) - Registry — with
"publishConfig": { "access": "public" }, the scoped package is published as public.
A failed bun run build will fail the publish, so you should not ship a stale dist/ from a previous local build.
After publishing:
-
Global install:
bun install -g @carllee1983/dbcli which dbcli dbcli --version
npm install -galso works, but the installed executable still runs under Bun via its#!/usr/bin/env bunshebang — verify on a machine that has Bun onPATH. -
Zero-install (bunx / npx):
cd /tmp && mkdir -p test-dbcli && cd test-dbcli bunx @carllee1983/dbcli --help bunx @carllee1983/dbcli --version # or: npx @carllee1983/dbcli --help
-
Windows (if available):
npm install -g @carllee1983/dbcli, thendbcli --help. npm creates the.cmdstub for thebinentry; no hand-written.cmdin the repo. Bun must be onPATHthere too.
If a bad release must be mitigated:
npm unpublish @carllee1983/dbcli@<VERSION>
# and/or
npm deprecate @carllee1983/dbcli@<VERSION> "Reason; use <SAFE_VERSION> instead"Then ship a patch version with the fix. Prefer deprecate over unpublish when consumers may already depend on the version.
files(inpackage.json): Publishesdist/,assets/,README.md,CHANGELOG.md,LICENSE. Theassets/tree is required fordbcli skillto copy bundledSKILL.md/reference.mdfrom the installed package.prepublishOnly:bun run buildsodist/cli.mjsmatches current source.engines: Declaresbun >= 1.3.3only.nodewas removed because the published bundles cannot run on Node:dist/cli.mjsdynamic-imports the extensionless./cli-runtime(Bun's resolver appends.mjs, Node's does not) anddist/core.mjscalls Bun globals.tests/integration/runtime-contract.test.tsfails ifengines.nodecomes back without the bundles being fixed to match, and ifdist/agent-core.mjs— the one entry point that is Node-importable — regresses. Seedocs/adr/0008-dbcli-is-a-bun-program-and-engines-says-so.md.- Shebang:
scripts/build.tsprepends#!/usr/bin/env buntodist/cli.mjs; thebinfield inpackage.jsonpoints at that file. exports:./coreand./agent-coreonly — there is deliberately no.entry. It used to point atdist/cli.mjs, andsrc/cli-runtime.tscallsoutputHelp()andparseAsync(process.argv)at module top level, so importing the package ran the CLI against the host's argv and never returned.bindoes not resolve throughexports, so the executable is unaffected.tests/integration/runtime-contract.test.tspins both the absence of.and the side effect that justifies it.postinstall:scripts/postinstall-check-bun.mjsreports a missing Bun — npm ignoresengines.bun, so this is the only signal an npm-only machine gets beforedbclirefuses to start. The command isbun … || node …so it runs under whichever runtime is present: Bun-only machines have nonodeto invoke it with, and a hardnodedependency there would break the primary install path. It must not end in|| exit 0; v1.55.0 shipped with that mask and npm, which hides lifecycle output unless a script fails, therefore showed nothing at all. On a global install (npm_config_global === 'true') a missing Bun exits 1, so the reason is printed and npm rolls thebinback; a dependency install only warns, because that is the./agent-coreconsumer. Both outcomes are pinned intests/integration/runtime-contract.test.ts.- Live DB tests:
tests/integration/live-db.test.tsuses project.dbcliby default orLIVE_DB_CONFIG_PATHwhen you point at another config directory. SetSKIP_INTEGRATION_TESTS=trueto skip all integration tests.
For contributor workflow and release process, see CONTRIBUTING.md and the main README.md Development section.
| Issue | What to do |
|---|---|
prepublishOnly / build fails |
Fix TypeScript or build errors, run bun run test:unit, then bun run build again. |
| Tarball unexpectedly large or bloated | Inspect the bundle: e.g. bun build ./src/cli.ts --outfile=dist/cli.mjs --target=bun --metafile=meta.json and review the metafile; trim dependencies or dev-only code paths. |
Windows: dbcli not found after global install |
Confirm PATH includes npm’s global bin; reinstall npm i -g @carllee1983/dbcli. |
npx download slow or cache weird |
npm cache clean --force and retry npx @carllee1983/dbcli --version. |