MCPcopy Create free account
hub / github.com/diillson/chatcli / ForkCurrentToNew

Method ForkCurrentToNew

cli/session_manager.go:345–356  ·  view source on GitHub ↗

ForkCurrentToNew creates a fork from in-memory session data (for forking unsaved sessions).

(newName string, sd *SessionData)

Source from the content-addressed store, hash-verified

343
344// ForkCurrentToNew creates a fork from in-memory session data (for forking unsaved sessions).
345func (sm *SessionManager) ForkCurrentToNew(newName string, sd *SessionData) error {
346 if newName == "" {
347 return fmt.Errorf("target session name required")
348 }
349
350 targetPath := sm.getSessionPath(newName)
351 if _, err := os.Stat(targetPath); err == nil {
352 return fmt.Errorf("sessão '%s' já existe", newName)
353 }
354
355 return sm.SaveSessionV2(newName, sd)
356}
357
358// DeleteSession apaga um arquivo de sessão.
359func (sm *SessionManager) DeleteSession(name string) error {

Callers 1

handleForkSessionMethod · 0.80

Calls 3

getSessionPathMethod · 0.95
SaveSessionV2Method · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected