Skip to content

Commit c6bac3b

Browse files
Claudeclaude
authored andcommitted
refactor: clean room 2x2 matrix — claude/cursor x npm/local
Replaced 3 inconsistently named Dockerfiles with 4 standardized ones: - Dockerfile.claude-npm, Dockerfile.claude-local - Dockerfile.cursor-npm, Dockerfile.cursor-local Unified build-and-run.sh: `./build-and-run.sh <claude|cursor> [local]` Local mode auto-handles npm pack + tarball copy + cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 703a618 commit c6bac3b

File tree

5 files changed

+140
-29
lines changed

5 files changed

+140
-29
lines changed

testing/clean-room/Dockerfile.local renamed to testing/clean-room/Dockerfile.claude-local

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# GitMem Clean Room — Local Build Test
1+
# GitMem Clean Room — Claude Code + local tarball (dev testing)
22
#
3-
# Same as Dockerfile.npm but installs from local tarball instead of npm.
3+
# Same as claude-npm but installs from local tarball instead of npm.
4+
# Use this to test changes before publishing.
45
#
56
# Build & run:
6-
# cd /workspace/gitmem && npm pack && cp gitmem-mcp-*.tgz testing/clean-room/gitmem-mcp-local.tgz
7-
# docker build -t gitmem-local -f testing/clean-room/Dockerfile.local testing/clean-room/
8-
# docker run -it --rm gitmem-local
7+
# ./testing/clean-room/build-and-run.sh claude local
8+
#
9+
# Then test:
10+
# gitmem-mcp init
911

1012
FROM node:20-slim
1113

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# GitMem Clean Room — New User Experience
1+
# GitMem Clean Room — Claude Code + npm (published release)
22
#
3-
# Simulates a brand new user with nothing installed.
4-
# No gitmem, no pre-config — just node + git + claude.
3+
# Simulates a brand new Claude Code user installing gitmem from npm.
4+
# Tests the exact experience a real user gets.
55
#
66
# Build & run:
7-
# docker build -t gitmem-npm -f testing/clean-room/Dockerfile.npm testing/clean-room/
8-
# docker run -it --rm -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY gitmem-npm
7+
# ./testing/clean-room/build-and-run.sh claude
98
#
10-
# Then test exactly what the website says:
9+
# Then test:
1110
# npx gitmem-mcp init
1211

1312
FROM node:20-slim
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# GitMem Clean Room — Cursor + local tarball (dev testing)
2+
#
3+
# Same as cursor-npm but installs from local tarball instead of npm.
4+
# Use this to test changes before publishing.
5+
#
6+
# Build & run:
7+
# ./testing/clean-room/build-and-run.sh cursor local
8+
#
9+
# Then test:
10+
# gitmem-mcp init
11+
# cursor
12+
#
13+
# Expected: auto-detects Cursor, creates .cursor/mcp.json, .cursorrules, .cursor/hooks.json
14+
15+
FROM node:20-slim
16+
17+
# System dependencies
18+
RUN apt-get update && apt-get install -y --no-install-recommends \
19+
git \
20+
curl \
21+
jq \
22+
ca-certificates \
23+
&& rm -rf /var/lib/apt/lists/*
24+
25+
# Keep npm current (suppresses upgrade nag for users)
26+
RUN npm install -g npm@latest
27+
28+
# Install Cursor CLI (as root, before user switch)
29+
RUN curl https://cursor.com/install -fsS | bash
30+
31+
# Make Cursor CLI available to developer user.
32+
RUN CURSOR_DIR=$(readlink -f /root/.local/bin/agent | xargs dirname) \
33+
&& cp -r "$CURSOR_DIR" /opt/cursor-agent \
34+
&& chmod -R a+rX /opt/cursor-agent \
35+
&& ln -s /opt/cursor-agent/cursor-agent /usr/local/bin/cursor
36+
37+
# Copy and install local tarball globally so npx resolves it
38+
COPY gitmem-mcp-local.tgz /tmp/gitmem-mcp-local.tgz
39+
RUN npm install -g /tmp/gitmem-mcp-local.tgz && rm /tmp/gitmem-mcp-local.tgz
40+
41+
# Create non-root developer user with project dir
42+
RUN useradd -m -s /bin/bash developer \
43+
&& mkdir -p /home/developer/my-project \
44+
&& chown developer:developer /home/developer/my-project
45+
USER developer
46+
WORKDIR /home/developer/my-project
47+
48+
# Init a git repo (gitmem expects one)
49+
RUN git init && git config user.email "dev@test.local" && git config user.name "Test Dev"
50+
51+
# Create .cursor/ directory — this is what Cursor IDE creates on first open.
52+
RUN mkdir -p .cursor
53+
54+
# Nothing else. Bare Cursor project. Just like a real new user.
55+
CMD ["bash"]
Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
# GitMem Clean Room — Cursor IDE New User Experience
1+
# GitMem Clean Room — Cursor + npm (published release)
22
#
3-
# Simulates a brand new Cursor user with nothing installed.
4-
# No gitmem, no pre-config — just node + git + cursor CLI.
5-
# Mirrors Dockerfile.npm but with Cursor instead of Claude Code.
3+
# Simulates a brand new Cursor user installing gitmem from npm.
4+
# Tests the exact experience a real user gets.
65
#
7-
# Build (from gitmem/ root — needs the tarball):
8-
# npm pack # creates gitmem-mcp-*.tgz
9-
# docker build -t gitmem-cursor -f testing/clean-room/Dockerfile.cursor .
10-
# docker run -it --rm -e CURSOR_API_KEY=$CURSOR_API_KEY gitmem-cursor
6+
# Build & run:
7+
# ./testing/clean-room/build-and-run.sh cursor
118
#
12-
# Then test exactly what the website says:
9+
# Then test:
1310
# npx gitmem-mcp init
1411
# cursor
1512
#
@@ -25,18 +22,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2522
ca-certificates \
2623
&& rm -rf /var/lib/apt/lists/*
2724

25+
# Keep npm current (suppresses upgrade nag for users)
26+
RUN npm install -g npm@latest
27+
2828
# Install Cursor CLI (as root, before user switch)
2929
RUN curl https://cursor.com/install -fsS | bash
3030

31-
# Install gitmem from local tarball (not published npm — contains Cursor changes)
32-
COPY gitmem-mcp-*.tgz /tmp/gitmem-mcp.tgz
33-
RUN npm install -g --loglevel=error /tmp/gitmem-mcp.tgz && rm /tmp/gitmem-mcp.tgz
34-
35-
# Create non-root developer user with project dir
36-
RUN useradd -m -s /bin/bash developer \
37-
&& mkdir -p /home/developer/my-project \
38-
&& chown developer:developer /home/developer/my-project
39-
4031
# Make Cursor CLI available to developer user.
4132
# The installer puts a full package (bundled Node 24, index.js, chunks) under
4233
# /root/.local/share/cursor-agent/versions/<ver>/. Copy the whole thing to a
@@ -46,6 +37,10 @@ RUN CURSOR_DIR=$(readlink -f /root/.local/bin/agent | xargs dirname) \
4637
&& chmod -R a+rX /opt/cursor-agent \
4738
&& ln -s /opt/cursor-agent/cursor-agent /usr/local/bin/cursor
4839

40+
# Create non-root developer user with project dir
41+
RUN useradd -m -s /bin/bash developer \
42+
&& mkdir -p /home/developer/my-project \
43+
&& chown developer:developer /home/developer/my-project
4944
USER developer
5045
WORKDIR /home/developer/my-project
5146

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
#
3+
# Unified clean room build & run
4+
#
5+
# Usage:
6+
# ./testing/clean-room/build-and-run.sh claude # Claude + npm (published)
7+
# ./testing/clean-room/build-and-run.sh claude local # Claude + local tarball
8+
# ./testing/clean-room/build-and-run.sh cursor # Cursor + npm (published)
9+
# ./testing/clean-room/build-and-run.sh cursor local # Cursor + local tarball
10+
11+
set -e
12+
13+
CLIENT="${1:-claude}"
14+
MODE="${2:-npm}"
15+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16+
REPO_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
17+
18+
if [[ "$CLIENT" != "claude" && "$CLIENT" != "cursor" ]]; then
19+
echo "Usage: $0 <claude|cursor> [local]"
20+
exit 1
21+
fi
22+
23+
if [[ "$MODE" != "npm" && "$MODE" != "local" ]]; then
24+
echo "Usage: $0 <claude|cursor> [local]"
25+
exit 1
26+
fi
27+
28+
DOCKERFILE="$SCRIPT_DIR/Dockerfile.${CLIENT}-${MODE}"
29+
IMAGE="gitmem-${CLIENT}-${MODE}"
30+
31+
if [[ ! -f "$DOCKERFILE" ]]; then
32+
echo "Error: $DOCKERFILE not found"
33+
exit 1
34+
fi
35+
36+
echo "=== Clean Room: $CLIENT + $MODE ==="
37+
38+
# For local mode, build tarball first
39+
if [[ "$MODE" == "local" ]]; then
40+
echo "--- Building local tarball ---"
41+
cd "$REPO_DIR"
42+
npm run build
43+
npm pack
44+
mv gitmem-mcp-*.tgz "$SCRIPT_DIR/gitmem-mcp-local.tgz"
45+
echo "--- Tarball ready ---"
46+
fi
47+
48+
echo "--- Building Docker image: $IMAGE ---"
49+
docker build --no-cache -t "$IMAGE" -f "$DOCKERFILE" "$SCRIPT_DIR"
50+
51+
# Clean up tarball after build
52+
if [[ "$MODE" == "local" && -f "$SCRIPT_DIR/gitmem-mcp-local.tgz" ]]; then
53+
rm "$SCRIPT_DIR/gitmem-mcp-local.tgz"
54+
fi
55+
56+
echo "--- Running container ---"
57+
docker run -it --rm \
58+
-e ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY:-}" \
59+
-e CURSOR_API_KEY="${CURSOR_API_KEY:-}" \
60+
"$IMAGE"

0 commit comments

Comments
 (0)