Skip to content

Add handling for Vercel apps to exclude entire branches #904

Draft
ashtom wants to merge 4 commits intomainfrom
ashtom/vercel-config
Draft

Add handling for Vercel apps to exclude entire branches #904
ashtom wants to merge 4 commits intomainfrom
ashtom/vercel-config

Conversation

@ashtom
Copy link
Copy Markdown
Member

@ashtom ashtom commented Apr 9, 2026

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:

  • Added a new function, maybePromptVercelDeploymentDisable, which detects Vercel configuration files and prompts the user to optionally disable deployments for entire/* branches by updating vercel.json. This function ensures that existing configuration is preserved and only the relevant deployment setting is changed.
  • Updated interactive and non-interactive agent setup flows (runEnableInteractive, applyAgentChanges, setupAgentHooksNonInteractive) to call maybePromptVercelDeploymentDisable after agent hooks are installed, ensuring users are prompted at the correct time. [1] [2] [3] [4]
  • Defined the branch pattern entire/* as a constant for consistent use across the codebase.

Testing improvements:

  • Added new tests in setup_test.go to 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:

  • Added the "encoding/json" import to support reading and writing vercel.json files.

Entire


Note

Medium Risk
Modifies CLI setup flows to write/merge vercel.json settings, 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 for entire/* branches by merging git.deploymentEnabled["entire/*"]=false into vercel.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.

Copilot AI review requested due to automatic review settings April 9, 2026 17:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 maybePromptVercelDeploymentDisable to detect Vercel projects and optionally write git.deploymentEnabled["entire/*"]=false into vercel.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.

Comment on lines +1513 to +1517
vercelJSONPath := filepath.Join(repoRoot, "vercel.json")
hasVercelJSON := false
if _, err := os.Stat(vercelJSONPath); err == nil {
hasVercelJSON = true
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment on lines +1521 to +1527
for _, path := range []string{
filepath.Join(repoRoot, ".vercel"),
filepath.Join(repoRoot, "vercel.ts"),
} {
if _, err := os.Stat(path); err == nil {
hasVercelProject = true
break
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
ashtom and others added 2 commits April 9, 2026 20:04
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants