Skip to content

Docker: every dist/cli/agentdb-cli.js reference is wrong (tsconfig emits dist/src/cli/) — breaks the production image CMD and 3 build stages #25

Open

Description

@vidaunited

Summary

Every Docker reference to the CLI uses dist/cli/agentdb-cli.js, but the build never emits that path. tsconfig.json sets rootDir: ".", so everything under src/ lands in dist/src/. The package's own manifest already agrees:

"main": "dist/src/index.js",
"bin": { "agentdb": "dist/src/cli/agentdb-cli.js" }

So package.json says dist/src/cli/… and the Docker assets say dist/cli/…. The Docker side is the one that's wrong.

The production image is affected, not just CI. Dockerfile.root:177:

CMD ["node", "dist/cli/agentdb-cli.js", "--help"]

The production stage copies --from=builder /app/dist ./dist, which contains dist/src/cli/, so the image's default command fails immediately:

Error: Cannot find module '/app/dist/cli/agentdb-cli.js'

This is masked by the healthcheck, which is node -e "process.exit(0)" — it passes regardless of whether the CLI resolves, so the container reports healthy while its CMD is broken.

Reproduction

At a478ab3 (3.0.0-alpha.14):

$ npx tsc            # emits
$ ls dist/cli/agentdb-cli.js
ls: cannot access 'dist/cli/agentdb-cli.js': No such file or directory
$ ls dist/src/cli/agentdb-cli.js
dist/src/cli/agentdb-cli.js

Verified against both the committed tsconfig.json and a narrowed variant (include: ["src/**/*", "simulation/**/*"]) — dist/cli/ is absent either way, so it isn't a side effect of which files are included. rootDir: "." is what decides it.

In Docker, --target cli-test fails at:

#16 Error: Cannot find module '/app/dist/cli/agentdb-cli.js'
#16 ERROR: process "/bin/sh -c node dist/cli/agentdb-cli.js --version && ..." did not complete successfully

All affected references (11)

file lines
docker/Dockerfile.root 99, 100 (cli-test), 104, 117 (mcp-test), 140, 144 (migration-test), 177 (production CMD)
docker/docker-compose.yml 51
docker/validation/02-test-cli-commands.sh 14, 23, 38

docker/validation/02-test-cli-commands.sh:14 guards on if [ -f "./dist/cli/agentdb-cli.js" ], so it takes the "CLI binary not found" branch rather than surfacing the path mismatch.

Suggested fix

Either point the Docker assets at what the build produces:

CMD ["node", "dist/src/cli/agentdb-cli.js", "--help"]

or, if dist/cli/… is the intended layout, set rootDir: "./src" in tsconfig.json and update main/bin accordingly. The first is the smaller change and matches the existing bin field.

Context

Found downstream in vidaunited/agentic-flow, which vendors this repo as a submodule. Our CI had never reached these stages before — an earlier stage ran the full vitest suite and exhausted the job timeout, so the build never got far enough to execute the CLI checks. Once that stage was removed the build completed in ~3 minutes and surfaced this immediately.

Happy to send a PR if the preferred direction is confirmed.

Activity

  1. added a commit that references this issue on Sep 8, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions