feat: typescript migration (#40)
* chore: initialize TypeScript configuration and build setup - Add tsconfig.json for root and mcp-server with strict type checking - Install typescript and @types/node as devDependencies - Add npm build script for TypeScript compilation - Update main entrypoint to compiled dist/shannon.js - Update Dockerfile to build TypeScript before running - Configure output directory and module resolution for Node.js * refactor: migrate codebase from JavaScript to TypeScript - Convert all 37 JavaScript files to TypeScript (.js -> .ts) - Add type definitions in src/types/ for agents, config, errors, session - Update mcp-server with proper TypeScript types - Move entry point from shannon.mjs to src/shannon.ts - Update tsconfig.json with rootDir: "./src" for cleaner dist output - Update Dockerfile to build TypeScript before runtime - Update package.json paths to use compiled dist/shannon.js No runtime behavior changes - pure type safety migration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update CLI references from ./shannon.mjs to shannon - Update help text in src/cli/ui.ts - Update usage examples in src/cli/command-handler.ts - Update setup message in src/shannon.ts - Update CLAUDE.md documentation with TypeScript file structure - Replace all ./shannon.mjs references with shannon command 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * chore: remove unnecessary eslint-disable comments ESLint is not configured in this project, making these comments redundant. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+15
-9
@@ -108,18 +108,25 @@ RUN addgroup -g 1001 pentest && \
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json first for better caching
|
||||
# Copy package files first for better caching
|
||||
COPY package*.json ./
|
||||
COPY mcp-server/package*.json ./mcp-server/
|
||||
|
||||
# Install Node.js dependencies as root
|
||||
RUN npm ci --only=production && \
|
||||
npm install -g zx && \
|
||||
npm install -g @anthropic-ai/claude-agent-sdk && \
|
||||
# Install Node.js dependencies (including devDependencies for TypeScript build)
|
||||
RUN npm ci && \
|
||||
cd mcp-server && npm ci && cd .. && \
|
||||
npm cache clean --force
|
||||
|
||||
# Copy application code
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
|
||||
# Build TypeScript (mcp-server first, then main project)
|
||||
RUN cd mcp-server && npm run build && cd .. && npm run build
|
||||
|
||||
# Remove devDependencies after build to reduce image size
|
||||
RUN npm prune --production && \
|
||||
cd mcp-server && npm prune --production
|
||||
|
||||
# Create directories for session data and ensure proper permissions
|
||||
RUN mkdir -p /app/sessions /app/deliverables /app/repos /app/configs && \
|
||||
mkdir -p /tmp/.cache /tmp/.config /tmp/.npm && \
|
||||
@@ -127,8 +134,7 @@ RUN mkdir -p /app/sessions /app/deliverables /app/repos /app/configs && \
|
||||
chmod 777 /tmp/.cache && \
|
||||
chmod 777 /tmp/.config && \
|
||||
chmod 777 /tmp/.npm && \
|
||||
chown -R pentest:pentest /app && \
|
||||
chmod +x /app/shannon.mjs
|
||||
chown -R pentest:pentest /app
|
||||
|
||||
# Switch to non-root user
|
||||
USER pentest
|
||||
@@ -148,4 +154,4 @@ ENV XDG_CACHE_HOME=/tmp/.cache
|
||||
ENV XDG_CONFIG_HOME=/tmp/.config
|
||||
|
||||
# Set entrypoint
|
||||
ENTRYPOINT ["./shannon.mjs"]
|
||||
ENTRYPOINT ["node", "dist/shannon.js"]
|
||||
|
||||
Reference in New Issue
Block a user