cmd/sketch: remove -initial-commit flag configuration option
Remove the -initial-commit command-line flag to simplify the CLI interface
while preserving all internal agent functionality for tracking the initial
commit baseline through the existing SketchGitBase system.
Problem Analysis:
The -initial-commit flag allowed users to specify a different git commit
reference as the starting point for Sketch operations. This added complexity
to the command-line interface and created an incompatibility with the -unsafe
flag. Analysis showed that most users would use the default HEAD value, making
the flag unnecessary complexity.
Implementation Changes:
1. Command Line Interface:
- Removed -initial-commit flag definition from main.go
- Removed CLI flag struct field and validation logic
- Eliminated incompatibility check with -unsafe flag
- Cleaned up flag parsing to remove unused initialCommit field
2. Container Configuration:
- Removed InitialCommit field from dockerimg.ContainerConfig struct
- Updated git commit resolution to use "HEAD" directly instead of flag value
- Simplified container launch process by removing flag passthrough
3. Preserved Agent Functionality:
- Maintained all SketchGitBase and SketchGitBaseRef methods unchanged
- Preserved initial_commit field in server state and web UI for agent tracking
- Kept all git diff, log, and baseline functionality intact
- Agent continues to establish and track its own initial commit baseline
Technical Details:
- The agent's internal initial commit tracking remains fully functional
- Git operations continue to work with the sketch-base tag system
- Agent initialization still establishes proper git baseline using HEAD
- All existing git diff and log functionality preserved
- Container and unsafe modes both default to current HEAD commit
- Web UI continues to display the agent's tracked initial commit
Testing:
- All Go package tests pass (loop/server, dockerimg)
- Command-line flag parsing works correctly without -initial-commit
- Basic sketch startup functionality verified in both safe and unsafe modes
- Agent git operations and baseline tracking remain intact
Benefits:
- Simplified command-line interface with fewer flags to understand
- Removed artificial incompatibility between -initial-commit and -unsafe
- Reduced cognitive load for new users learning sketch CLI options
- Cleaner container configuration with less conditional logic
- Maintained all essential agent functionality while removing user complexity
This change removes only the user-facing configurability while preserving
all internal git tracking and baseline functionality that the agent relies on.
Co-Authored-By: sketch <hello@sketch.dev>
Change-ID: s962b916b2d3b6582k
diff --git a/dockerimg/dockerimg.go b/dockerimg/dockerimg.go
index ad18246..79d4b28 100644
--- a/dockerimg/dockerimg.go
+++ b/dockerimg/dockerimg.go
@@ -90,9 +90,6 @@
// Initial prompt
Prompt string
- // Initial commit to use as starting point. Resolved into Commit on the host.
- InitialCommit string
-
// Verbose enables verbose output
Verbose bool
@@ -198,8 +195,8 @@
// Get the current host git commit
var commit string
- if out, err := combinedOutput(ctx, "git", "rev-parse", config.InitialCommit); err != nil {
- return fmt.Errorf("git rev-parse %s: %w", config.InitialCommit, err)
+ if out, err := combinedOutput(ctx, "git", "rev-parse", "HEAD"); err != nil {
+ return fmt.Errorf("git rev-parse HEAD: %w", err)
} else {
commit = strings.TrimSpace(string(out))
}