Docker: every dist/cli/agentdb-cli.js reference is wrong (tsconfig emits dist/src/cli/) — breaks the production image CMD and 3 build stages
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 89
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tsconfig.json and package.json to confirm the emitted and declared CLI paths, then inspect the references listed in docker/Dockerfile.root, docker/docker-compose.yml, and docker/validation/02-test-cli-commands.sh. Run npx tsc and the Docker cli-test or validation script; done means every Docker CLI reference resolves and the production image CMD starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- build-system, cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100