Skip to content

Codex-generated pull request#1

Open
manova wants to merge 1 commit intomasterfrom
codex/add-setup-script-for-environment
Open

Codex-generated pull request#1
manova wants to merge 1 commit intomasterfrom
codex/add-setup-script-for-environment

Conversation

@manova
Copy link
Owner

@manova manova commented Feb 19, 2026

Codex generated this pull request, but encountered an unexpected error after generation. This is a placeholder PR message.


Codex Task


Note

Low Risk
Adds a standalone developer convenience script and does not modify application/runtime code; main risk is accidental env overwrite or unexpected installs/builds when run without --dry-run/--force-env awareness.

Overview
Adds setup-worktree.sh, a Linux/WSL-oriented bootstrap script for new git worktrees.

The script auto-detects the primary worktree, copies common .env* files (optionally --force-env), and installs/builds detected backend/frontend projects (Node via pnpm/yarn/npm, backend optionally via uv), with --skip-install, --skip-build, and --dry-run support.

Written by Cursor Bugbot for commit 279b78b. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

auto_detect_main_dir() {
local current="$1"
local first
first="$(git worktree list --porcelain | awk '/^worktree / {print $2; exit}')"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awk truncates worktree paths containing spaces

Medium Severity

auto_detect_main_dir parses git worktree list --porcelain output using awk '{print $2}', which splits on whitespace. If the primary worktree path contains spaces (e.g., /mnt/c/Users/John Smith/project on WSL), only the portion before the first space is returned. This causes MAIN_DIR to be set to an incorrect, truncated path, breaking env file copying and potentially causing early script exit. Using sub(/^worktree /, ""); print instead of print $2 would preserve the full path.

Fix in Cursor Fix in Web


if [[ "$copied" -eq 0 ]]; then
warn "No env files copied. Ensure env files exist in: $source_root"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading warning when env files already exist

Low Severity

The copied counter in copy_env_files only tracks files that were actually copied, not files that were intentionally skipped because they already exist. When the script is run a second time without --force-env, every env file hits the "Keeping existing" branch, copied stays at 0, and the warning "No env files copied. Ensure env files exist in: $source_root" fires — incorrectly implying the source files are missing when they're present and the target files were deliberately preserved.

Fix in Cursor Fix in Web


if [[ "$SKIP_BUILD" != "true" ]]; then
run_cmd "cd '$dir' && $pm run build"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node build crashes when no build script exists

Medium Severity

install_and_build_node_project unconditionally runs $pm run build without checking whether a build script is defined in package.json. If the project lacks a build script, the package manager exits non-zero and set -e terminates the entire setup script. This is inconsistent with the uv/Python backend path, which inspects Makefile and pyproject.toml before attempting a build and gracefully warns when no build configuration is found.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant