Add handling for Vercel apps to exclude entire branches #904
Add handling for Vercel apps to exclude entire branches #904
Conversation
…nt. Ref #239. Entire-Checkpoint: 07ed1bd20d95
There was a problem hiding this comment.
Pull request overview
Adds Vercel-aware behavior to the setup/configure flows so Entire can optionally disable Vercel preview deployments for entire/* branches by updating vercel.json, with accompanying unit tests.
Changes:
- Introduces
maybePromptVercelDeploymentDisableto detect Vercel projects and optionally writegit.deploymentEnabled["entire/*"]=falseintovercel.json. - Wires the Vercel prompt into interactive enable, non-interactive setup, and agent-management change flows after hooks are installed.
- Adds tests covering merge-with-existing-config, create-new-config, and “already disabled” no-op behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cmd/entire/cli/setup.go | Adds Vercel detection + prompt logic and integrates it into setup/configure flows. |
| cmd/entire/cli/setup_test.go | Adds unit tests for the new Vercel prompt/config-merge behavior. |
| vercelJSONPath := filepath.Join(repoRoot, "vercel.json") | ||
| hasVercelJSON := false | ||
| if _, err := os.Stat(vercelJSONPath); err == nil { | ||
| hasVercelJSON = true | ||
| } |
There was a problem hiding this comment.
os.Stat errors other than "not exists" (e.g., permission errors, broken symlinks) are currently treated as if vercel.json is absent. This can lead to prompting/writing a new config when an existing file can't be read. Consider handling non-NotExist errors explicitly (returning the error or printing a skip note) instead of silently treating them as false.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Fixed in fcf3459. os.Stat errors other than os.IsNotExist now print a skip note and return nil for both the vercel.json check and the .vercel/vercel.ts checks. Also fixed the ignored error return from mergeVercelDeploymentDisabled at the call site.
| for _, path := range []string{ | ||
| filepath.Join(repoRoot, ".vercel"), | ||
| filepath.Join(repoRoot, "vercel.ts"), | ||
| } { | ||
| if _, err := os.Stat(path); err == nil { | ||
| hasVercelProject = true | ||
| break |
There was a problem hiding this comment.
Similar to the vercel.json check: os.Stat errors for .vercel / vercel.ts other than "not exists" are currently ignored. It would be safer to treat unexpected stat failures as an error/skip note rather than assuming the file isn't there.
There was a problem hiding this comment.
@copilot apply changes based on this feedback
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d mergeVercelDeploymentDisabled error Agent-Logs-Url: https://github.com/entireio/cli/sessions/59ca634c-4da4-40b7-b97b-2310258df3de Co-authored-by: ashtom <70720+ashtom@users.noreply.github.com>
This pull request enhances the CLI setup process for projects using Vercel by adding logic to detect Vercel configuration and prompt users to disable deployments for
entire/*branches as reported in #239. It also introduces comprehensive tests to ensure this behavior works as intended. The changes are primarily focused on improving integration with Vercel and maintaining user control over deployment settings.Vercel integration and deployment control:
maybePromptVercelDeploymentDisable, which detects Vercel configuration files and prompts the user to optionally disable deployments forentire/*branches by updatingvercel.json. This function ensures that existing configuration is preserved and only the relevant deployment setting is changed.runEnableInteractive,applyAgentChanges,setupAgentHooksNonInteractive) to callmaybePromptVercelDeploymentDisableafter agent hooks are installed, ensuring users are prompted at the correct time. [1] [2] [3] [4]entire/*as a constant for consistent use across the codebase.Testing improvements:
setup_test.goto verify that the Vercel deployment disable prompt merges with existing config, creates config when needed, and skips prompting if already disabled. These tests ensure reliability and correct behavior of the new logic.Dependency and import updates:
"encoding/json"import to support reading and writingvercel.jsonfiles.Entire
Note
Medium Risk
Modifies CLI setup flows to write/merge
vercel.jsonsettings, which could affect a project's Vercel deployment behavior if users accept the prompt; logic is guarded by detection and explicit confirmation.Overview
Adds Vercel-aware behavior to
entire configure/enable: when hooks are newly installed and a Vercel project is detected, the CLI can prompt to disable preview deployments forentire/*branches by merginggit.deploymentEnabled["entire/*"]=falseintovercel.json(creating the file if needed and preserving existing config).Includes new unit tests covering merge behavior, file creation when Vercel is detected without
vercel.json, and skipping when the setting is already disabled, plus updates call sites to only run this step when hooks were actually installed.Reviewed by Cursor Bugbot for commit 41c48af. Configure here.