-
Notifications
You must be signed in to change notification settings - Fork 1
feat(config): add Jean worktree setup script #764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
064b0f4
33365cc
8ae7c7d
0102947
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "scripts": { | ||
| "setup": "bash \"$JEAN_ROOT_PATH/scripts/jean-setup.sh\"" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Setting up Jean worktree..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # JEAN_ROOT_PATH is set by Jean to the main repo checkout. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # We copy local config files from there into this worktree so each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # worktree can be modified independently. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -z "${JEAN_ROOT_PATH:-}" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " JEAN_ROOT_PATH is not set β skipping config file copy." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local src="$JEAN_ROOT_PATH/$1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "$src" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p "$(dirname "$1")" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cp "$src" "$1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " copied $1" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " skipped $1 (not found in root)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Copying local config files..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "server/application-server/src/main/resources/application-local.yml" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "server/application-server/src/test/resources/application-live-local.yml" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "server/application-server/.env" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "server/intelligence-service/.env" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "server/webhook-ingest/.env" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists "docker/.env" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_if_exists ".claude/settings.local.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+30
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo " JEAN_ROOT_PATH is not set β skipping config file copy." | |
| else | |
| copy_if_exists() { | |
| local src="$JEAN_ROOT_PATH/$1" | |
| if [ -f "$src" ]; then | |
| mkdir -p "$(dirname "$1")" | |
| cp "$src" "$1" | |
| echo " copied $1" | |
| else | |
| echo " skipped $1 (not found in root)" | |
| fi | |
| } | |
| echo "Copying local config files..." | |
| copy_if_exists "server/application-server/src/main/resources/application-local.yml" | |
| copy_if_exists "server/application-server/src/test/resources/application-live-local.yml" | |
| copy_if_exists "server/application-server/.env" | |
| copy_if_exists "server/intelligence-service/.env" | |
| copy_if_exists "server/webhook-ingest/.env" | |
| copy_if_exists "docker/.env" | |
| copy_if_exists ".claude/settings.local.json" | |
| echo " JEAN_ROOT_PATH is not set β skipping config file copy." | |
| else | |
| copy_if_exists() { | |
| local src="$JEAN_ROOT_PATH/$1" | |
| if [ -f "$src" ]; then | |
| mkdir -p "$(dirname "$1")" | |
| cp "$src" "$1" | |
| echo " copied $1" | |
| else | |
| echo " skipped $1 (not found in root)" | |
| fi | |
| } | |
| echo "Copying local config files..." | |
| copy_if_exists "server/application-server/src/main/resources/application-local.yml" | |
| copy_if_exists "server/application-server/src/test/resources/application-live-local.yml" | |
| copy_if_exists "server/application-server/.env" | |
| copy_if_exists "server/intelligence-service/.env" | |
| copy_if_exists "server/webhook-ingest/.env" | |
| copy_if_exists "docker/.env" | |
| copy_if_exists ".claude/settings.local.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π§© Analysis chain
π Script executed:
#!/bin/bash
# Check whether .claude/settings.local.json is covered by any .gitignore in the repo
rg -n "settings\.local\.json" --glob ".gitignore" --glob "**/.gitignore"Repository: ls1intum/Hephaestus
Length of output: 45
π Script executed:
#!/bin/bash
# Also check for broader .claude directory patterns in .gitignore
rg -n "\.claude" --glob ".gitignore" --glob "**/.gitignore"Repository: ls1intum/Hephaestus
Length of output: 45
π Script executed:
#!/bin/bash
# Examine the context around line 30 in scripts/jean-setup.sh
cat -n scripts/jean-setup.sh | sed -n '20,40p'Repository: ls1intum/Hephaestus
Length of output: 729
π Script executed:
#!/bin/bash
# Check if there's a .claude directory and settings.local.json file in the repo
find . -type d -name ".claude" 2>/dev/null
find . -type f -name "settings.local.json" 2>/dev/nullRepository: ls1intum/Hephaestus
Length of output: 72
Add documentation and ensure .claude/settings.local.json is in .gitignore.
This file is being copied to every new worktree without explanation or protection. .claude/settings.local.json is not currently covered by any .gitignore rule, creating a risk that developers could accidentally commit credentials if the file is staged in a worktree commit. Add a comment above line 30 explaining the intent, and add .claude/settings.local.json (or .claude/) to the project's .gitignore.
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/jean-setup.sh` at line 30, Add a short comment above the
copy_if_exists ".claude/settings.local.json" call explaining that this copies a
developer-local Claude settings file (non-committed, may contain credentials)
for convenience; then update the repository .gitignore to include either
".claude/settings.local.json" or the entire ".claude/" directory to prevent
accidental commits of credentials. Ensure the comment references copy_if_exists
and the filename ".claude/settings.local.json" so future readers understand
intent, and commit the .gitignore change alongside the script update.
π§© Analysis chain
π Script executed:
# Check if .claude/settings.local.json is covered by any .gitignore
rg -n "settings\.local\.json" --glob "*.gitignore" --glob ".gitignore"Repository: ls1intum/Hephaestus
Length of output: 45
π Script executed:
# Check for .gitignore files in the repo
fd -H ".gitignore" -x cat -n {}Repository: ls1intum/Hephaestus
Length of output: 9525
π Script executed:
# Examine the jean-setup.sh script around line 30
cat -n scripts/jean-setup.sh | head -50Repository: ls1intum/Hephaestus
Length of output: 1431
Add an inline comment explaining the security implications of copying .claude/settings.local.json.
The file .claude/settings.local.json is not explicitly covered by any .gitignore pattern in the repository (the *.local pattern does not match filenames ending in .json). Since this file can contain sensitive credentials, it should have an inline comment explaining why it's safe to copy silently into worktrees, and the assumption that .gitignore coverage is in place elsewhere should be documented.
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/jean-setup.sh` at line 30, Add an inline comment immediately above
the call to copy_if_exists for ".claude/settings.local.json" that explains this
file may contain sensitive credentials, notes that the repoβs existing "*.local"
.gitignore pattern does not match ".json" filenames (so this specific filename
must be ignored elsewhere or handled securely), states the assumption under
which it's safe to copy silently (e.g., that developers have configured a
repo-level or global ignore or secrets manager), and instructs maintainers to
ensure .gitignore or other controls explicitly exclude this file if that
assumption is not met; reference the copy_if_exists call and the literal
".claude/settings.local.json" when adding the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard npm install against a missing package.json.
With set -e, a failed npm install (e.g., no package.json at the worktree root, or npm not on PATH) aborts the entire setup ungracefully. The rest of the script β file copying, config propagation β will have succeeded, so a hard failure here discards useful partial work. At minimum, skip gracefully when there's no manifest; alternatively mirror the same pattern used for config files.
π‘οΈ Proposed fix
-echo "Installing npm dependencies..."
-npm install
+if [ -f "package.json" ]; then
+ echo "Installing npm dependencies..."
+ npm install
+else
+ echo " skipped npm install (no package.json found)"
+fiπ Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| echo "Installing npm dependencies..." | |
| npm install | |
| if [ -f "package.json" ]; then | |
| echo "Installing npm dependencies..." | |
| npm install | |
| else | |
| echo " skipped npm install (no package.json found)" | |
| fi |
π€ Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/jean-setup.sh` around lines 33 - 34, Guard the npm install step so
the script doesn't abort under set -e when npm or package.json is missing:
before the existing "npm install" invocation check for the presence of
package.json and that npm is on PATH (same pattern used for config propagation),
and only run the "npm install" command when both checks pass; otherwise log a
clear skip/warning and continue. Ensure you update the block that currently
contains the echo "Installing npm dependencies..." / npm install to use these
checks and a non-failing fallback so partial setup isn't discarded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script uses single brackets
[ ]for test conditions (line 9, 14), but all other bash scripts in the repository consistently use double brackets[[ ]]which is the bash-specific, more feature-rich test operator. Update to use[[ ]]for consistency with scripts/codex-setup.sh, scripts/codex-maintenance.sh, and scripts/local-postgres.sh.