feat: add .architect/ project mapping system with architect-indexer agent and Docker containerization
- Add .architect/ directory structure (10 template files) as project brain for agent orientation - Add architect-indexer agent that scans codebase and generates structured architecture docs - Add Docker containerization: Dockerfile.architect-indexer, docker-compose.architect.yml - Add TypeScript project-mapper module with staleness detection and context injection - Add /index-project command, architect-first-contact rule, project-mapping skill - Integrate orchestrator first-contact check: triggers indexing before any task delegation - Add npm arch:* scripts for Docker-based indexing workflow - Register agent in capability-index.yaml and AGENTS.md
This commit is contained in:
63
docker/Dockerfile.architect-indexer
Normal file
63
docker/Dockerfile.architect-indexer
Normal file
@@ -0,0 +1,63 @@
|
||||
# Architect Indexer Dockerfile
|
||||
# Scans target project codebase and generates .architect/ directory
|
||||
#
|
||||
# Usage:
|
||||
# docker compose -f docker/docker-compose.architect.yml build
|
||||
# docker compose -f docker/docker-compose.architect.yml run --rm architect-indexer
|
||||
# docker compose -f docker/docker-compose.architect.yml run --rm architect-indexer --mode incremental
|
||||
|
||||
# ── Build stage ────────────────────────────────────────────────────
|
||||
FROM oven/bun:1-alpine AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Copy dependency files first (cache layer)
|
||||
COPY package.json ./
|
||||
# bun.lock might not exist; handle gracefully
|
||||
COPY bun.lock* ./
|
||||
|
||||
# Install dependencies
|
||||
RUN bun install 2>/dev/null || npm install 2>/dev/null || true
|
||||
|
||||
# Copy source for build
|
||||
COPY tsconfig.json ./
|
||||
COPY src/ ./src/
|
||||
|
||||
# Build TypeScript
|
||||
RUN bun run build 2>/dev/null || npx tsc 2>/dev/null || true
|
||||
|
||||
# ── Production stage ────────────────────────────────────────────────
|
||||
FROM node:20-alpine AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Security: non-root user
|
||||
RUN addgroup -S apaw && adduser -S apaw -G apaw
|
||||
|
||||
# Copy built artifacts
|
||||
COPY --from=builder /build/dist/ ./dist/
|
||||
COPY --from=builder /build/node_modules/ ./node_modules/
|
||||
COPY --from=builder /build/package.json ./
|
||||
|
||||
# Copy .kilo configs for agent context
|
||||
COPY .kilo/agents/architect-indexer.md ./agents/architect-indexer.md
|
||||
COPY .kilo/skills/project-mapping/ ./skills/project-mapping/
|
||||
COPY .kilo/rules/ ./rules/
|
||||
|
||||
# Ensure .architect template directory exists
|
||||
COPY .architect/ /template/.architect/
|
||||
|
||||
# Default project mount point
|
||||
ENV PROJECT_ROOT=/project
|
||||
ENV NODE_ENV=production
|
||||
ENV TZ=UTC
|
||||
|
||||
# Healthcheck: verify .architect/ was generated
|
||||
HEALTHCHECK --interval=60s --timeout=15s --start-period=10s --retries=2 \
|
||||
CMD test -d /project/.architect || exit 1
|
||||
|
||||
USER apaw
|
||||
|
||||
# Run the indexer script (compiled from TypeScript)
|
||||
ENTRYPOINT ["node", "dist/kilocode/scripts/run-architect-indexer.js"]
|
||||
CMD ["--target", "/project"]
|
||||
48
docker/docker-compose.architect.yml
Normal file
48
docker/docker-compose.architect.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
# Architect Indexer Service
|
||||
# Scans project codebase and generates/updates .architect/ directory
|
||||
#
|
||||
# Usage:
|
||||
# Full index (first run):
|
||||
# docker compose -f docker/docker-compose.architect.yml run architect-indexer
|
||||
#
|
||||
# Incremental update:
|
||||
# docker compose -f docker/docker-compose.architect.yml run architect-indexer --mode incremental
|
||||
#
|
||||
# Index a specific project path:
|
||||
# docker compose -f docker/docker-compose.architect.yml run architect-indexer --target /project
|
||||
#
|
||||
# Re-build image:
|
||||
# docker compose -f docker/docker-compose.architect.yml build
|
||||
|
||||
services:
|
||||
architect-indexer:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.architect-indexer
|
||||
container_name: apaw-architect-indexer
|
||||
volumes:
|
||||
# Mount target project for scanning and .architect/ output
|
||||
- ..:/project:rw
|
||||
# Exclude node_modules from mount (use container's own)
|
||||
- /project/node_modules
|
||||
# Exclude .kilo internal deps from scan
|
||||
- /project/.kilo/node_modules
|
||||
environment:
|
||||
- PROJECT_ROOT=/project
|
||||
- NODE_ENV=production
|
||||
- TZ=UTC
|
||||
# Gitea integration (optional, for posting indexing comments)
|
||||
- GITEA_API_URL=${GITEA_API_URL:-https://git.softuniq.eu/api/v1}
|
||||
- GITEA_TOKEN=${GITEA_TOKEN:-}
|
||||
- GITEA_ISSUE=${GITEA_ISSUE:-}
|
||||
working_dir: /project
|
||||
networks:
|
||||
- architect-network
|
||||
restart: "no"
|
||||
labels:
|
||||
- "com.apaw.service=architect-indexer"
|
||||
- "com.apaw.description=Project codebase indexer - generates .architect/ directory"
|
||||
|
||||
networks:
|
||||
architect-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user