Skip to content

Commit b7a752d

Browse files
Copilotlpcox
andcommitted
Improve language detection in serena-init.sh script
- Check for all three languages individually with anchored grep patterns - Only recreate config if any of go, typescript, or python is missing - Makes the script more precise and truly idempotent - Addresses code review feedback about insufficient condition Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
1 parent 9b5a1b5 commit b7a752d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

containers/serena-mcp-server/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ set -e\n\
6161
# Ensure .serena directory exists in workspace\n\
6262
mkdir -p /workspace/.serena\n\
6363
\n\
64-
# If project.yml does not exist or only has go, create/update it with all languages\n\
65-
if [ ! -f /workspace/.serena/project.yml ] || ! grep -q "typescript" /workspace/.serena/project.yml; then\n\
64+
# Check if project.yml needs to be created or updated\n\
65+
# Create/update if: file does not exist, OR it is missing any of the three required languages\n\
66+
if [ ! -f /workspace/.serena/project.yml ] || \\\n\
67+
! grep -q "^- go$" /workspace/.serena/project.yml || \\\n\
68+
! grep -q "^- typescript$" /workspace/.serena/project.yml || \\\n\
69+
! grep -q "^- python$" /workspace/.serena/project.yml; then\n\
6670
echo "Initializing Serena project with Go, TypeScript, and Python support..."\n\
6771
printf "languages:\\n- go\\n- typescript\\n- python\\n" > /workspace/.serena/project.yml\n\
6872
fi\n\

0 commit comments

Comments
 (0)