Skip to content

Commit 9e65693

Browse files
sgx-labsclaude
andcommitted
Add Ollama double-confirm, auto-install hooks, pass --yes in piped installs
Ollama skip now requires two explicit "yes" answers (both default NO) with a comparison table showing semantic vs keyword search. Hooks install automatically without prompting — they're core to the product. Installers pass --yes to same init so piped installs auto-accept defaults cleanly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8868670 commit 9e65693

4 files changed

Lines changed: 37 additions & 19 deletions

File tree

install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ if (-not $MissingOllama -and -not $MissingNode) {
333333
Write-Host ""
334334
Write-Host " ${Bold}Starting setup wizard...${Reset}"
335335
Write-Host ""
336-
& same init
336+
& same init --yes
337337
} else {
338338
Write-Host "-----------------------------------------------------------"
339339
Write-Host ""

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ if [ "$MISSING_OLLAMA" = false ] && [ "$MISSING_NODE" = false ]; then
498498
echo ""
499499
echo -e " ${BOLD}Starting setup wizard...${RESET}"
500500
echo ""
501-
same init
501+
same init --yes
502502
else
503503
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
504504
echo ""

internal/setup/hooks.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,11 @@ func quotePath(p string) string {
280280
return p
281281
}
282282

283-
// setupHooksInteractive prompts and sets up hooks.
283+
// setupHooksInteractive installs hooks automatically — they're core to SAME working.
284284
func setupHooksInteractive(vaultPath string, autoAccept bool) {
285-
// Use friendlier prompt text for non-developers
286-
if autoAccept || confirm(" Connect to Claude Code? (recommended)", true) {
287-
if err := SetupHooks(vaultPath); err != nil {
288-
fmt.Printf(" %s!%s Could not set up connection: %v\n",
289-
cli.Yellow, cli.Reset, err)
290-
}
291-
} else {
292-
fmt.Println(" Skipped. Run 'same setup hooks' later if needed.")
285+
if err := SetupHooks(vaultPath); err != nil {
286+
fmt.Printf(" %s!%s Could not set up hooks: %v\n",
287+
cli.Yellow, cli.Reset, err)
288+
fmt.Printf(" Run %ssame setup hooks%s to try again.\n", cli.Bold, cli.Reset)
293289
}
294290
}

internal/setup/init.go

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,37 @@ func RunInit(opts InitOptions) error {
205205
cli.Section("Ollama")
206206
ollamaOK := true
207207
if err := checkOllama(); err != nil {
208-
// Offer lite mode instead of failing
209-
fmt.Println()
210-
fmt.Printf(" %s→%s You can still use SAME without Ollama (keyword search mode).\n", cli.Cyan, cli.Reset)
211-
fmt.Printf(" %sSearch will use keywords instead of AI-powered semantic matching.%s\n", cli.Dim, cli.Reset)
212-
fmt.Printf(" %sInstall Ollama later and run 'same reindex' to upgrade.%s\n\n", cli.Dim, cli.Reset)
213-
if !opts.Yes && !confirm(" Continue without Ollama?", true) {
214-
return fmt.Errorf("setup cancelled — install Ollama from https://ollama.com and try again")
208+
if opts.Yes {
209+
// Non-interactive (piped install) — silently fall back to lite mode
210+
ollamaOK = false
211+
} else {
212+
// Interactive — make them really want to skip this
213+
fmt.Println()
214+
fmt.Printf(" %sOllama is what makes SAME powerful.%s Without it:\n\n", cli.Bold, cli.Reset)
215+
fmt.Printf(" %sWith Ollama%s %sWithout%s\n", cli.Green, cli.Reset, cli.Dim, cli.Reset)
216+
fmt.Printf(" Semantic search Keyword matching only\n")
217+
fmt.Printf(" \"auth flow\" finds \"auth flow\" misses\n")
218+
fmt.Printf(" \"login system\" \"login system\"\n")
219+
fmt.Printf(" Understands %smeaning%s Exact words only\n\n", cli.Bold, cli.Reset)
220+
fmt.Printf(" %sStart Ollama and run 'same init' again for the full experience.%s\n\n", cli.Dim, cli.Reset)
221+
222+
if !confirm(" Skip Ollama and use keyword-only mode?", false) {
223+
return fmt.Errorf("setup cancelled — start Ollama and run 'same init' again")
224+
}
225+
226+
// They said yes — push back one more time
227+
fmt.Println()
228+
fmt.Printf(" %sSemantic search is SAME's core feature — it's the difference\n", cli.Dim)
229+
fmt.Printf(" between your AI finding the right context and missing it entirely.%s\n\n", cli.Reset)
230+
fmt.Printf(" Install Ollama anytime: %shttps://ollama.com%s\n", cli.Bold, cli.Reset)
231+
fmt.Printf(" Then run %ssame reindex%s to upgrade.\n\n", cli.Bold, cli.Reset)
232+
233+
if !confirm(" Are you sure you want keyword-only mode?", false) {
234+
return fmt.Errorf("setup cancelled — start Ollama and run 'same init' again")
235+
}
236+
237+
ollamaOK = false
215238
}
216-
ollamaOK = false
217239
}
218240

219241
// Finding notes

0 commit comments

Comments
 (0)