Phase 2 of v2.0. BooCoder is now a functional write-capable chatbot.
Write-path guard: resolveWritePath() uses resolve() (no realpath — files may
not exist for creates) + prefix-check + secret-file deny list (.env, *.pem,
id_rsa*, etc.). 23 unit tests cover traversal attacks.
Pending-changes service: queueEdit/Create/Delete → applyOne/All →
rejectOne/All → rewindOne. Edit diffs stored as JSON {old, new}. All writes
queue before touching disk; apply re-validates the path guard.
5 write tools: edit_file, create_file, delete_file, apply_pending, rewind.
Registered alongside 25 read-only tools from BooChat (30 total, alpha-sorted).
Write tools use a module-level inference context for sql+sessionId injection.
Inference loop via workspace dependency: apps/coder imports
createInferenceRunner, createBroker, ALL_TOOLS from @boocode/server (dist/).
apps/server gains declaration: true + exports map with typed subpath entries.
No code duplication — one inference engine shared by both apps.
API routes: POST /api/sessions/:id/messages (user msg → inference), POST stop,
GET/POST pending-changes CRUD (5 endpoints), WebSocket session streaming.
Dockerfile updated to build apps/server first (coder depends on its .d.ts).
Health endpoint reports tool count: {"ok":true,"db":true,"tools":30}.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
834 B
Docker
33 lines
834 B
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM node:20-alpine AS builder
|
|
RUN corepack enable
|
|
WORKDIR /build
|
|
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml tsconfig.base.json ./
|
|
COPY apps/server/package.json ./apps/server/
|
|
COPY apps/coder/package.json ./apps/coder/
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Build server first (coder depends on it via workspace dep for types + inference)
|
|
COPY apps/server ./apps/server
|
|
RUN pnpm -C apps/server build
|
|
|
|
COPY apps/coder ./apps/coder
|
|
RUN pnpm -C apps/coder build
|
|
|
|
RUN pnpm deploy --filter=@boocode/coder --prod --legacy /out/coder
|
|
|
|
|
|
FROM node:20-bookworm-slim AS runtime
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ripgrep git && rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /out/coder ./
|
|
|
|
ENV NODE_ENV=production
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "dist/index.js"]
|