mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-02-12 15:05:10 -05:00
### CHANGES * Extract chat processing logic into separate function * Create modular command handlers for setup, configuration, listing, management, and extensions * Improve patterns loader with migration support and better error handling * Simplify main CLI logic by delegating to specialized handlers * Enhance code organization and maintainability * Add tool processing for YouTube and web scraping functionality
29 lines
598 B
Go
29 lines
598 B
Go
package cli
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/danielmiessler/fabric/internal/core"
|
|
"github.com/danielmiessler/fabric/internal/plugins/db/fsdb"
|
|
)
|
|
|
|
// initializeFabric initializes the fabric database and plugin registry
|
|
func initializeFabric() (registry *core.PluginRegistry, err error) {
|
|
var homedir string
|
|
if homedir, err = os.UserHomeDir(); err != nil {
|
|
return
|
|
}
|
|
|
|
fabricDb := fsdb.NewDb(filepath.Join(homedir, ".config/fabric"))
|
|
if err = fabricDb.Configure(); err != nil {
|
|
return
|
|
}
|
|
|
|
if registry, err = core.NewPluginRegistry(fabricDb); err != nil {
|
|
return
|
|
}
|
|
|
|
return
|
|
}
|