Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .claude/scripts/remote-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
# Remote environment setup for Claude Code web sessions
# This script configures DNS and installs mise in cloud containers

set -e

# Only run in remote (web/cloud) environments
if [ "$CLAUDE_CODE_REMOTE" != "true" ]; then
exit 0
fi

echo "Setting up remote environment..."

# 1. Configure DNS (required in web containers)
echo "Configuring DNS..."
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

# 2. Install mise if not already installed
if ! command -v mise &> /dev/null; then
echo "Installing mise..."
curl -fsSL https://mise.run | sh

# Add mise to PATH for this script
export PATH="$HOME/.local/bin:$PATH"
fi

# 3. Trust mise config and install tools
echo "Installing project tools..."
cd "$CLAUDE_PROJECT_DIR"
mise trust
mise install

# 4. Persist mise activation for subsequent commands
# Capture environment changes from mise activation and write exports to CLAUDE_ENV_FILE
if [ -n "$CLAUDE_ENV_FILE" ]; then
echo "Persisting mise environment..."
# Capture exports before and after mise activation, then write only the diff
ENV_BEFORE=$(export -p | sort)
eval "$(mise activate bash)"
ENV_AFTER=$(export -p | sort)
comm -13 <(echo "$ENV_BEFORE") <(echo "$ENV_AFTER") >> "$CLAUDE_ENV_FILE"
fi

echo "Remote environment setup complete!"
4 changes: 4 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash ${CLAUDE_PROJECT_DIR}/.claude/scripts/remote-setup.sh"
},
{
"type": "command",
"command": "go run ${CLAUDE_PROJECT_DIR}/cmd/entire/main.go hooks claude-code session-start"
Expand Down
19 changes: 19 additions & 0 deletions cmd/entire/cli/integration_test/git_author_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ func TestGetGitAuthorFallbackToGitCommand(t *testing.T) {
t.Fatalf("git init failed: %v", err)
}

// Disable GPG signing for test commits
configCmd := exec.Command("git", "config", "commit.gpgsign", "false")
configCmd.Dir = env.RepoDir
if err := configCmd.Run(); err != nil {
t.Fatalf("git config commit.gpgsign failed: %v", err)
}

// The repo now has no local user config. We'll use GIT_AUTHOR_* and GIT_COMMITTER_*
// env vars for commits, simulating global config that go-git can't see but git command can.

Expand Down Expand Up @@ -131,6 +138,18 @@ func TestGetGitAuthorNoConfigReturnsDefaults(t *testing.T) {
t.Fatalf("git init failed: %v", err)
}

// Disable GPG signing for test commits
configCmd := exec.Command("git", "config", "commit.gpgsign", "false")
configCmd.Dir = env.RepoDir
configCmd.Env = []string{
"HOME=" + fakeHome,
"PATH=" + os.Getenv("PATH"),
"GIT_CONFIG_NOSYSTEM=1",
}
if err := configCmd.Run(); err != nil {
t.Fatalf("git config commit.gpgsign failed: %v", err)
}

env.InitEntire("manual-commit")

// Create initial commit using environment variables (required for CI without global config)
Expand Down
8 changes: 8 additions & 0 deletions cmd/entire/cli/integration_test/testenv.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/config"
"github.com/go-git/go-git/v5/plumbing/object"
)

Expand Down Expand Up @@ -261,6 +262,13 @@ func (env *TestEnv) InitRepo() {
}
cfg.User.Name = "Test User"
cfg.User.Email = "test@example.com"

// Disable GPG signing for test commits (prevents failures if user has commit.gpgsign=true globally)
if cfg.Raw == nil {
cfg.Raw = config.New()
}
cfg.Raw.Section("commit").SetOption("gpgsign", "false")

if err := repo.SetConfig(cfg); err != nil {
env.T.Fatalf("failed to set repo config: %v", err)
}
Expand Down
14 changes: 14 additions & 0 deletions cmd/entire/cli/strategy/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ func TestGetGitDirInPath_Worktree(t *testing.T) {
t.Fatalf("failed to configure git name: %v", err)
}

// Disable GPG signing for test commits
cmd = exec.CommandContext(ctx, "git", "config", "commit.gpgsign", "false")
cmd.Dir = mainRepo
if err := cmd.Run(); err != nil {
t.Fatalf("failed to configure commit.gpgsign: %v", err)
}

// Create an initial commit (required for worktree)
testFile := filepath.Join(mainRepo, "test.txt")
if err := os.WriteFile(testFile, []byte("test"), 0o644); err != nil {
Expand Down Expand Up @@ -274,6 +281,13 @@ func TestIsGitSequenceOperation_Worktree(t *testing.T) {
t.Fatalf("failed to configure git name: %v", err)
}

// Disable GPG signing for test commits
cmd = exec.CommandContext(ctx, "git", "config", "commit.gpgsign", "false")
cmd.Dir = mainRepo
if err := cmd.Run(); err != nil {
t.Fatalf("failed to configure commit.gpgsign: %v", err)
}

testFile := filepath.Join(mainRepo, "test.txt")
if err := os.WriteFile(testFile, []byte("test"), 0o644); err != nil {
t.Fatalf("failed to create test file: %v", err)
Expand Down