Skip to content

Commit deb36c1

Browse files
committed
feat: make container mode default (auto-detect Docker like herm)
1 parent f1da4bd commit deb36c1

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎cmd/container_boot.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ type containerStatusMsg struct {
1818
sandbox *sandbox.ContainerSandbox
1919
}
2020

21+
// shouldUseContainer determines if hawk should run in container mode.
22+
// Default: YES if Docker is available (like herm). User can override with --no-container.
23+
func shouldUseContainer() bool {
24+
if noContainer {
25+
return false
26+
}
27+
if containerMode {
28+
return true
29+
}
30+
// Default: auto-detect. If Docker is running, use container mode.
31+
return sandbox.DockerAvailable()
32+
}
33+
2134
// bootContainerCmd starts the container in the background and sends status
2235
// updates to the TUI (herm-style async boot with progress feedback).
2336
func bootContainerCmd(projectDir string) tea.Cmd {

‎cmd/root.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var (
5353
teachDepth int
5454
autoSkillFlag bool
5555
containerMode bool
56+
noContainer bool
5657
)
5758

5859
// SetVersion sets the version string from main.
@@ -163,7 +164,8 @@ func init() {
163164
rootCmd.Flags().BoolVar(&teachMode, "teach", false, "explain reasoning as the agent works")
164165
rootCmd.Flags().IntVar(&teachDepth, "teach-depth", 2, "explanation depth: 1=what, 2=why, 3=how")
165166
rootCmd.Flags().BoolVar(&autoSkillFlag, "auto-skill", false, "auto-detect project and install matching skills")
166-
rootCmd.Flags().BoolVar(&containerMode, "container", false, "run all commands inside a Docker container (hermetic mode — no permission prompts)")
167+
rootCmd.Flags().BoolVar(&noContainer, "no-container", false, "disable container mode (run on host with permission prompts)")
168+
rootCmd.Flags().BoolVar(&containerMode, "container", false, "force container mode even if auto-detection would skip it")
167169
rootCmd.Flags().BoolVarP(&versionFlag, "version", "v", false, "output the version number")
168170
rootCmd.AddCommand(versionCmd)
169171
rootCmd.AddCommand(setupCmd)

0 commit comments

Comments
 (0)