repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/cmd/to_pdf/main.go
cmd/to_pdf/main.go
// to_pdf // // Usage: // [no args] Read from stdin, write to output.pdf // <file.tex> Read from .tex file, write to <file>.pdf // <output.pdf> Read stdin, write to specified PDF // <output> Read stdin, write to <output>.pdf // <input> <output> Read input (.te...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/docs/docs.go
docs/docs.go
// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": { "n...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/chat/chat.go
internal/chat/chat.go
package chat import ( "encoding/json" "errors" ) const ( ChatMessageRoleSystem = "system" ChatMessageRoleUser = "user" ChatMessageRoleAssistant = "assistant" ChatMessageRoleFunction = "function" ChatMessageRoleTool = "tool" ChatMessageRoleDeveloper = "developer" ) var ErrContentFieldsMisused = ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/util/groups_items.go
internal/util/groups_items.go
package util import ( "fmt" "sort" "strings" "github.com/samber/lo" ) func NewGroupsItemsSelector[I any](selectionLabel string, getItemLabel func(I) string) *GroupsItemsSelector[I] { return &GroupsItemsSelector[I]{SelectionLabel: selectionLabel, GetItemKey: getItemLabel, GroupsItems: make([]*GroupItems[I...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/util/utils.go
internal/util/utils.go
package util import ( "errors" "fmt" "os" "path/filepath" "runtime" "strings" ) // GetAbsolutePath resolves a given path to its absolute form, handling ~, ./, ../, UNC paths, and symlinks. func GetAbsolutePath(path string) (string, error) { if path == "" { return "", errors.New("path is empty") } // Handl...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/util/oauth_storage_test.go
internal/util/oauth_storage_test.go
package util import ( "os" "path/filepath" "testing" "time" ) func TestOAuthToken_IsExpired(t *testing.T) { tests := []struct { name string expiresAt int64 bufferMinutes int expected bool }{ { name: "token not expired", expiresAt: time.Now().Unix() + 3600, // 1 hou...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/util/oauth_storage.go
internal/util/oauth_storage.go
package util import ( "encoding/json" "fmt" "os" "path/filepath" "time" ) // OAuthToken represents stored OAuth token information type OAuthToken struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresAt int64 `json:"expires_at"` TokenType string `json:"to...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/defaults.go
internal/tools/defaults.go
package tools import ( "fmt" "strconv" "github.com/pkg/errors" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/plugins/ai" ) func NeeDefaults(getVendorsModels func() (*ai.VendorsModels, error)) (ret *Defaults) { v...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/patterns_loader.go
internal/tools/patterns_loader.go
package tools import ( "fmt" "os" "path/filepath" "sort" "strings" "github.com/danielmiessler/fabric/internal/i18n" debuglog "github.com/danielmiessler/fabric/internal/log" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/plugins/db/fsdb" "github.com/danielmiess...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/lang/language.go
internal/tools/lang/language.go
package lang import ( "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/plugins" "golang.org/x/text/language" ) func NewLanguage() (ret *Language) { label := "Language" ret = &Language{} ret.PluginBase = &plugins.PluginBase{ Name: i18n.T("language_label"...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/youtube/youtube.go
internal/tools/youtube/youtube.go
// Package youtube provides YouTube video transcript and comment extraction functionality. // // Requirements: // - yt-dlp: Required for transcript extraction (must be installed separately) // - YouTube API key: Optional, only needed for comments and metadata extraction // // The implementation uses yt-dlp for reliable...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/youtube/timestamp_test.go
internal/tools/youtube/timestamp_test.go
package youtube import ( "testing" ) func TestParseTimestampToSeconds(t *testing.T) { tests := []struct { timestamp string expected int shouldErr bool }{ {"00:30", 30, false}, {"01:30", 90, false}, {"01:05:30", 3930, false}, // 1 hour 5 minutes 30 seconds {"10:00", 600, false}, {"invalid", 0, true...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/youtube/youtube_test.go
internal/tools/youtube/youtube_test.go
package youtube import ( "strings" "testing" ) func TestParseSeconds(t *testing.T) { tests := []struct { name string input string want int wantErr bool }{ { name: "integer seconds", input: "42", want: 42, wantErr: false, }, { name: "fractional seconds", input: ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/youtube/youtube_optional_test.go
internal/tools/youtube/youtube_optional_test.go
package youtube import "testing" func TestNewYouTubeApiKeyOptional(t *testing.T) { yt := NewYouTube() if yt.ApiKey == nil { t.Fatal("expected API key setup question to be initialized") } if yt.ApiKey.Required { t.Fatalf("expected YouTube API key to be optional, but it is marked as required") } if !yt.IsC...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/custom_patterns/custom_patterns.go
internal/tools/custom_patterns/custom_patterns.go
package custom_patterns import ( "fmt" "os" "path/filepath" "strings" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/plugins" ) func NewCustomPatterns() (ret *CustomPatterns) { label := "Custom Patterns" ret = &CustomPatterns{} ret.PluginBase = &plugins.PluginBa...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/custom_patterns/custom_patterns_test.go
internal/tools/custom_patterns/custom_patterns_test.go
package custom_patterns import ( "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestNewCustomPatterns(t *testing.T) { plugin := NewCustomPatterns() assert.NotNil(t, plugin) assert.Equal(t, "Custom Patterns", plugin.GetName()) assert.Equal(t,...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/converter/html_readability.go
internal/tools/converter/html_readability.go
package converter import ( "bytes" "github.com/go-shiori/go-readability" ) // HtmlReadability Convert HTML input into a clean, readable view // args: // // html (string): full data of web page // // return: // // viewContent (string): html main content // err (error): parser error func HtmlReadability(html string)...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/converter/html_readability_test.go
internal/tools/converter/html_readability_test.go
package converter import ( "testing" "github.com/stretchr/testify/assert" ) func TestHtmlReadability(t *testing.T) { tests := []struct { name string html string expected string }{ { name: "Empty HTML", html: "", expected: "", }, { name: "HTML with text", html: "...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/jina/jina.go
internal/tools/jina/jina.go
package jina // see https://jina.ai for more information import ( "fmt" "io" "net/http" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/plugins" ) type Client struct { *plugins.PluginBase ApiKey *plugins.SetupQuestion } func NewClient() (ret *Client) { label := ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/notifications/notifications.go
internal/tools/notifications/notifications.go
package notifications import ( "fmt" "os" "os/exec" "runtime" ) // NotificationProvider interface for different notification backends type NotificationProvider interface { Send(title, message string) error IsAvailable() bool } // NotificationManager handles cross-platform notifications type NotificationManager...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/notifications/notifications_test.go
internal/tools/notifications/notifications_test.go
package notifications import ( "os/exec" "runtime" "testing" ) func TestNewNotificationManager(t *testing.T) { manager := NewNotificationManager() if manager == nil { t.Fatal("NewNotificationManager() returned nil") } if manager.provider == nil { t.Fatal("NotificationManager provider is nil") } } func Te...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/tools/githelper/githelper.go
internal/tools/githelper/githelper.go
package githelper import ( "fmt" "io" "os" "path/filepath" "strings" "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/storage/memory" ) // FetchOptions defines options for fetching files from a git repo type FetchOptions struct { // RepoURL is the URL ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/i18n/i18n_variants_test.go
internal/i18n/i18n_variants_test.go
package i18n import ( "testing" goi18n "github.com/nicksnyder/go-i18n/v2/i18n" ) func TestNormalizeToBCP47(t *testing.T) { tests := []struct { input string expected string }{ // Basic cases {"pt", "pt"}, {"pt-BR", "pt-BR"}, {"pt-PT", "pt-PT"}, // Underscore normalization {"pt_BR", "pt-BR"}, ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/i18n/locale_test.go
internal/i18n/locale_test.go
package i18n import ( "os" "testing" ) func TestDetectSystemLocale(t *testing.T) { // Save original environment originalLC_ALL := os.Getenv("LC_ALL") originalLC_MESSAGES := os.Getenv("LC_MESSAGES") originalLANG := os.Getenv("LANG") // Clean up after test defer func() { os.Setenv("LC_ALL", originalLC_ALL) ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/i18n/locale.go
internal/i18n/locale.go
package i18n import ( "os" "strings" "golang.org/x/text/language" ) // detectSystemLocale detects the system locale using standard Unix environment variables. // Follows the POSIX priority order for locale environment variables: // 1. LC_ALL (highest priority - overrides all others) // 2. LC_MESSAGES (for message...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/i18n/i18n.go
internal/i18n/i18n.go
package i18n import ( "embed" "encoding/json" "fmt" "io" "net/http" "os" "path/filepath" "strings" "sync" "github.com/nicksnyder/go-i18n/v2/i18n" "golang.org/x/text/language" ) // embedded default locales // //go:embed locales/*.json var localeFS embed.FS var ( translator *i18n.Localizer initOnce syn...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/i18n/i18n_test.go
internal/i18n/i18n_test.go
package i18n import ( "testing" gi18n "github.com/nicksnyder/go-i18n/v2/i18n" ) func TestTranslation(t *testing.T) { testCases := []struct { lang string expected string }{ {"es", "usa la entrada original, porque no se puede aplicar la legibilidad de html"}, {"en", "use original input, because can't a...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/thinking.go
internal/domain/thinking.go
package domain // ThinkingLevel represents reasoning/thinking levels supported across providers. type ThinkingLevel string const ( ThinkingOff ThinkingLevel = "off" ThinkingLow ThinkingLevel = "low" ThinkingMedium ThinkingLevel = "medium" ThinkingHigh ThinkingLevel = "high" ) // ThinkingBudgets defines s...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/domain.go
internal/domain/domain.go
package domain import "github.com/danielmiessler/fabric/internal/chat" const ChatMessageRoleMeta = "meta" // Default values for chat options (must match cli/flags.go defaults) const ( DefaultTemperature = 0.7 DefaultTopP = 0.9 DefaultPresencePenalty = 0.0 DefaultFrequencyPenalty = 0.0 ) type C...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/file_manager_test.go
internal/domain/file_manager_test.go
package domain import ( "os" "path/filepath" "testing" ) func TestParseFileChanges(t *testing.T) { tests := []struct { name string input string want int // number of expected file changes wantErr bool }{ { name: "No " + FileChangesMarker + " section", input: "This is a normal respons...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/stream.go
internal/domain/stream.go
package domain // StreamType distinguishes between partial text content and metadata events. type StreamType string const ( StreamTypeContent StreamType = "content" StreamTypeUsage StreamType = "usage" StreamTypeError StreamType = "error" ) // StreamUpdate is the unified payload sent through the internal chan...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/think_test.go
internal/domain/think_test.go
package domain import "testing" func TestStripThinkBlocks(t *testing.T) { input := "<think>internal</think>\n\nresult" got := StripThinkBlocks(input, "<think>", "</think>") if got != "result" { t.Errorf("expected %q, got %q", "result", got) } } func TestStripThinkBlocksCustomTags(t *testing.T) { input := "[[t...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/attachment.go
internal/domain/attachment.go
package domain import ( "bytes" "crypto/sha256" "encoding/base64" "encoding/json" "fmt" "io" "net/http" "os" "path/filepath" "github.com/gabriel-vasile/mimetype" ) type Attachment struct { Type *string `json:"type,omitempty"` Path *string `json:"path,omitempty"` URL *string `json:"url,omitempt...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/domain_test.go
internal/domain/domain_test.go
package domain import ( "testing" "github.com/danielmiessler/fabric/internal/chat" "github.com/stretchr/testify/assert" ) func TestNormalizeMessages(t *testing.T) { msgs := []*chat.ChatCompletionMessage{ {Role: chat.ChatMessageRoleUser, Content: "Hello"}, {Role: chat.ChatMessageRoleAssistant, Content: "Hi th...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/file_manager.go
internal/domain/file_manager.go
package domain import ( "encoding/json" "fmt" "os" "path/filepath" "slices" "strings" ) // FileChangesMarker identifies the start of a file changes section in output const FileChangesMarker = "__CREATE_CODING_FEATURE_FILE_CHANGES__" const ( // MaxFileSize is the maximum size of a file that can be created (10M...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/domain/think.go
internal/domain/think.go
package domain import ( "regexp" "sync" ) // StripThinkBlocks removes any content between the provided start and end tags // from the input string. Whitespace following the end tag is also removed so // output resumes at the next non-empty line. var ( regexCache = make(map[string]*regexp.Regexp) cacheMutex sync.M...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/plugin_test.go
internal/plugins/plugin_test.go
package plugins import ( "bytes" "os" "testing" "github.com/stretchr/testify/assert" ) func TestConfigurable_AddSetting(t *testing.T) { conf := &PluginBase{ Settings: Settings{}, Name: "TestConfigurable", EnvNamePrefix: "TEST_", } setting := conf.AddSetting("test_setting", true) assert.E...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/plugin.go
internal/plugins/plugin.go
package plugins import ( "bytes" "fmt" "os" "strings" "github.com/danielmiessler/fabric/internal/i18n" ) const AnswerReset = "reset" const SettingTypeBool = "bool" type Plugin interface { GetName() string GetSetupDescription() string IsConfigured() bool Configure() error Setup() error SetupFillEnvFileCon...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/models.go
internal/plugins/ai/models.go
package ai import ( "fmt" "sort" "strings" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/util" ) func NewVendorsModels() *VendorsModels { return &VendorsModels{GroupsItemsSelectorString: util.NewGroupsItemsSelectorString(i18n.T("available_models_header"))} } type ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/vendors.go
internal/plugins/ai/vendors.go
package ai import ( "bytes" "context" "fmt" "sort" "strings" "sync" "github.com/danielmiessler/fabric/internal/plugins" ) func NewVendorsManager() *VendorsManager { return &VendorsManager{ Vendors: []Vendor{}, VendorsByName: map[string]Vendor{}, } } type VendorsManager struct { *plugins.PluginBa...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/vendor.go
internal/plugins/ai/vendor.go
package ai import ( "context" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/domain" ) type Vendor interface { plugins.Plugin ListModels() ([]string, error) SendStream([]*chat.ChatCompletionMessage, *domain.ChatO...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/vendors_test.go
internal/plugins/ai/vendors_test.go
package ai import ( "bytes" "context" "testing" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" ) type stubVendor struct { name string } func (v *stubVendor) GetName() string { return v.name } func (v *stubVendor) GetSetupDescription() ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/models_test.go
internal/plugins/ai/models_test.go
package ai import ( "io" "os" "strings" "testing" ) func TestNewVendorsModels(t *testing.T) { vendors := NewVendorsModels() if vendors == nil { t.Fatalf("NewVendorsModels() returned nil") } if len(vendors.GroupsItems) != 0 { t.Fatalf("NewVendorsModels() returned non-empty VendorsModels map") } } func Te...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai_image.go
internal/plugins/ai/openai/openai_image.go
package openai // This file contains helper methods for image generation and processing // using OpenAI's Responses API and Image API. import ( "encoding/base64" "fmt" "os" "path/filepath" "slices" "strings" "github.com/danielmiessler/fabric/internal/domain" "github.com/openai/openai-go/packages/param" "git...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/message_conversion.go
internal/plugins/ai/openai/message_conversion.go
package openai import "github.com/danielmiessler/fabric/internal/chat" // MessageConversionResult holds the common conversion result type MessageConversionResult struct { Role string Content string MultiContent []chat.ChatMessagePart HasMultiContent bool } // convertMessageCommon extracts c...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai_test.go
internal/plugins/ai/openai/openai_test.go
package openai import ( "strings" "testing" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" openai "github.com/openai/openai-go" "github.com/openai/openai-go/responses" "github.com/openai/openai-go/shared" "github.com/stretchr/testify/assert" ) func TestBui...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai_models_test.go
internal/plugins/ai/openai/openai_models_test.go
package openai import ( "context" "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" ) // Ensures we can fetch models directly when a provider returns a direct array of models // instead of the standard OpenAI list response structure. func TestFetchModelsDirectly_DirectArray(t *testin...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai_audio.go
internal/plugins/ai/openai/openai_audio.go
package openai import ( "bytes" "context" "fmt" "os" "os/exec" "path/filepath" "slices" "sort" "strings" "sync" debuglog "github.com/danielmiessler/fabric/internal/log" openai "github.com/openai/openai-go" ) // transcriptionResult holds the result of a single chunk transcription. type transcriptionResul...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai_image_test.go
internal/plugins/ai/openai/openai_image_test.go
package openai import ( "fmt" "strings" "testing" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" "github.com/openai/openai-go/responses" "github.com/stretchr/testify/assert" ) func TestShouldUseImageGeneration(t *testing.T) { client := NewClient() // Tes...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/chat_completions.go
internal/plugins/ai/openai/chat_completions.go
package openai // This file contains helper methods for the Chat Completions API. // These methods are used as fallbacks for OpenAI-compatible providers // that don't support the newer Responses API (e.g., Groq, Mistral, etc.). import ( "context" "strings" "github.com/danielmiessler/fabric/internal/chat" "github...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/direct_models.go
internal/plugins/ai/openai/direct_models.go
package openai import ( "context" "encoding/json" "fmt" "io" "net/http" "net/url" "time" "github.com/danielmiessler/fabric/internal/i18n" debuglog "github.com/danielmiessler/fabric/internal/log" ) // modelResponse represents a minimal model returned by the API. // This mirrors the shape used by OpenAI-compa...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai/openai.go
internal/plugins/ai/openai/openai.go
package openai import ( "context" "fmt" "net/http" "slices" "strings" "time" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" debuglog "github.com/danielmiessler/fabric/internal/log" "github.com/danielmiessler/fabric/internal/plugins" openai "github.com/op...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/lmstudio/lmstudio.go
internal/plugins/ai/lmstudio/lmstudio.go
package lmstudio import ( "bufio" "bytes" "context" "encoding/json" "fmt" "io" "net/http" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" "github.com/danielmiessler/fabric/internal/plugins" ) // NewClient creates a new LM Studio client with default confi...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/azure/azure_test.go
internal/plugins/ai/azure/azure_test.go
package azure import ( "testing" ) // Test generated using Keploy func TestNewClientInitialization(t *testing.T) { client := NewClient() if client == nil { t.Fatalf("Expected non-nil client, got nil") } if client.ApiDeployments == nil { t.Errorf("Expected ApiDeployments to be initialized, got nil") } if cl...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/azure/azure.go
internal/plugins/ai/azure/azure.go
package azure import ( "fmt" "strings" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/plugins/ai/openai" openaiapi "github.com/openai/openai-go" "github.com/openai/openai-go/azure" ) func NewClient() (ret *Client) { ret = &Client{} ret.Client = openai.NewClient...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/exolab/exolab.go
internal/plugins/ai/exolab/exolab.go
package exolab import ( "strings" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/plugins/ai/openai" openaiapi "github.com/openai/openai-go" "github.com/openai/openai-go/option" ) func NewClient() (ret *Client) { ret = &Client{} ret.Client = openai.NewClientCompa...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/dryrun/dryrun_test.go
internal/plugins/ai/dryrun/dryrun_test.go
package dryrun import ( "reflect" "testing" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" ) // Test generated using Keploy func TestListModels_ReturnsExpectedModel(t *testing.T) { client := NewClient() models, err := client.ListModels() if err != nil { t...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/dryrun/dryrun.go
internal/plugins/ai/dryrun/dryrun.go
package dryrun import ( "bytes" "context" "fmt" "strings" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" "github.com/danielmiessler/fabric/internal/plugins" ) const DryRunResponse = "Dry run: Fake response sent by DryRun plugin\n" type Client struct { *p...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai_compatible/direct_models_call.go
internal/plugins/ai/openai_compatible/direct_models_call.go
package openai_compatible import ( "context" "github.com/danielmiessler/fabric/internal/plugins/ai/openai" ) // DirectlyGetModels is used to fetch models directly from the API when the // standard OpenAI SDK method fails due to a nonstandard format. func (c *Client) DirectlyGetModels(ctx context.Context) ([]string...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai_compatible/providers_config_test.go
internal/plugins/ai/openai_compatible/providers_config_test.go
package openai_compatible import ( "testing" ) func TestCreateClient(t *testing.T) { testCases := []struct { name string provider string exists bool }{ { name: "Existing provider - Mistral", provider: "Mistral", exists: true, }, { name: "Existing provider - Groq", provide...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/openai_compatible/providers_config.go
internal/plugins/ai/openai_compatible/providers_config.go
package openai_compatible import ( "context" "fmt" "os" "strings" "github.com/danielmiessler/fabric/internal/plugins/ai/openai" ) // ProviderConfig defines the configuration for an OpenAI-compatible API provider type ProviderConfig struct { Name string BaseURL string ModelsURL ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/ollama/ollama.go
internal/plugins/ai/ollama/ollama.go
package ollama import ( "context" "encoding/base64" "fmt" "io" "net/http" "net/url" "os" "strings" "time" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" debuglog "github.com/danielmiessler/fabric/internal/log" "github.com/danielmiessler/fabric/internal...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/bedrock/bedrock.go
internal/plugins/ai/bedrock/bedrock.go
// Package bedrock provides a plugin to use Amazon Bedrock models. // Supported models are defined in the MODELS variable. // To add additional models, append them to the MODELS array. Models must support the Converse and ConverseStream operations // Authentication uses the AWS credential provider chain, similar.to th...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/anthropic/anthropic.go
internal/plugins/ai/anthropic/anthropic.go
package anthropic import ( "context" "fmt" "net/http" "os" "strconv" "strings" "github.com/anthropics/anthropic-sdk-go" "github.com/anthropics/anthropic-sdk-go/option" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" debuglog "github.com/danielmiessler/fab...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/anthropic/oauth.go
internal/plugins/ai/anthropic/oauth.go
package anthropic import ( "bytes" "crypto/rand" "crypto/sha256" "encoding/base64" "encoding/json" "fmt" "io" "net/http" "os/exec" "strings" "time" debuglog "github.com/danielmiessler/fabric/internal/log" "github.com/danielmiessler/fabric/internal/util" "golang.org/x/oauth2" ) // OAuth configuration co...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/anthropic/anthropic_test.go
internal/plugins/ai/anthropic/anthropic_test.go
package anthropic import ( "strings" "testing" "github.com/anthropics/anthropic-sdk-go" "github.com/danielmiessler/fabric/internal/domain" ) // Test generated using Keploy func TestNewClient_DefaultInitialization(t *testing.T) { client := NewClient() if client == nil { t.Fatal("Expected client to be initial...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/anthropic/oauth_test.go
internal/plugins/ai/anthropic/oauth_test.go
package anthropic // OAuth Testing Strategy: // // This test suite covers OAuth functionality while avoiding real external calls. // Key principles: // 1. Never trigger real OAuth flows that would open browsers or call external APIs // 2. Use temporary directories and mock tokens for isolated testing // 3. Skip integr...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/gemini_openai/gemini.go
internal/plugins/ai/gemini_openai/gemini.go
package gemini_openai import ( "github.com/danielmiessler/fabric/internal/plugins/ai/openai" ) func NewClient() (ret *Client) { ret = &Client{} ret.Client = openai.NewClientCompatible("GeminiOpenAI", "https://generativelanguage.googleapis.com/v1beta", nil) return } type Client struct { *openai.Client }
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/vertexai/vertexai.go
internal/plugins/ai/vertexai/vertexai.go
package vertexai import ( "context" "fmt" "strings" "github.com/anthropics/anthropic-sdk-go" "github.com/anthropics/anthropic-sdk-go/vertex" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" "github.com/danielmiessler/fabric/internal/plugins" ) const ( cloud...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/perplexity/perplexity.go
internal/plugins/ai/perplexity/perplexity.go
package perplexity import ( "context" "fmt" "os" "strings" "sync" "github.com/danielmiessler/fabric/internal/domain" debuglog "github.com/danielmiessler/fabric/internal/log" "github.com/danielmiessler/fabric/internal/plugins" perplexity "github.com/sgaunet/perplexity-go/v2" "github.com/danielmiessler/fabri...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/gemini/gemini.go
internal/plugins/ai/gemini/gemini.go
package gemini import ( "bytes" "context" "encoding/binary" "fmt" "regexp" "strconv" "strings" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/plugins" "github.com/danielmiessler/fabric/internal/domain" "google.golang.org/genai" ) // WAV audio constants const (...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/gemini/gemini_test.go
internal/plugins/ai/gemini/gemini_test.go
package gemini import ( "strings" "testing" "google.golang.org/genai" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" ) // Test buildModelNameFull method func TestBuildModelNameFull(t *testing.T) { client := &Client{} tests := []struct { input string ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/ai/gemini/voices.go
internal/plugins/ai/gemini/voices.go
package gemini import ( "fmt" "sort" "strings" ) // GeminiVoice represents a Gemini TTS voice with its characteristics type GeminiVoice struct { Name string Description string Characteristics []string } // GetGeminiVoices returns the current list of supported Gemini TTS voices // This list is ma...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/api.go
internal/plugins/db/api.go
package db type Storage[T any] interface { Configure() (err error) Get(name string) (ret *T, err error) GetNames() (ret []string, err error) Delete(name string) (err error) Exists(name string) (ret bool) Rename(oldName, newName string) (err error) Save(name string, content []byte) (err error) Load(name string)...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/storage.go
internal/plugins/db/fsdb/storage.go
package fsdb import ( "encoding/json" "fmt" "os" "path/filepath" "strings" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/util" ) type StorageEntity struct { Label string Dir string ItemIsDir bool FileExtension string } func (o *StorageEn...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/patterns_test.go
internal/plugins/db/fsdb/patterns_test.go
package fsdb import ( "os" "path/filepath" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func setupTestPatternsEntity(t *testing.T) (*PatternsEntity, func()) { // Create a temporary directory for test patterns tmpDir, err := os.MkdirTemp("", "test-patterns-*") require...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/patterns.go
internal/plugins/db/fsdb/patterns.go
package fsdb import ( "fmt" "os" "path/filepath" "sort" "strings" "github.com/danielmiessler/fabric/internal/i18n" "github.com/danielmiessler/fabric/internal/plugins/template" "github.com/danielmiessler/fabric/internal/util" ) type PatternsEntity struct { *StorageEntity SystemPatternFile string Uniqu...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/contexts.go
internal/plugins/db/fsdb/contexts.go
package fsdb import "fmt" type ContextsEntity struct { *StorageEntity } // Get Load a context from file func (o *ContextsEntity) Get(name string) (ret *Context, err error) { var content []byte if content, err = o.Load(name); err != nil { return } ret = &Context{Name: name, Content: string(content)} return }...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/sessions_test.go
internal/plugins/db/fsdb/sessions_test.go
package fsdb import ( "testing" "github.com/danielmiessler/fabric/internal/chat" ) func TestSessions_GetOrCreateSession(t *testing.T) { dir := t.TempDir() sessions := &SessionsEntity{ StorageEntity: &StorageEntity{Dir: dir, FileExtension: ".json"}, } sessionName := "testSession" session, err := sessions.Get...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/sessions.go
internal/plugins/db/fsdb/sessions.go
package fsdb import ( "fmt" "github.com/danielmiessler/fabric/internal/chat" "github.com/danielmiessler/fabric/internal/domain" ) type SessionsEntity struct { *StorageEntity } func (o *SessionsEntity) Get(name string) (session *Session, err error) { session = &Session{Name: name} if o.Exists(name) { err = ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/db_test.go
internal/plugins/db/fsdb/db_test.go
package fsdb import ( "os" "testing" ) func TestDb_Configure(t *testing.T) { dir := t.TempDir() db := NewDb(dir) err := db.Configure() if err == nil { t.Fatalf("db is configured, but must not be at empty dir: %v", dir) } if db.IsEnvFileExists() { t.Fatalf("db file exists, but must not be at empty dir: %v"...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/storage_test.go
internal/plugins/db/fsdb/storage_test.go
package fsdb import ( "testing" ) func TestStorage_SaveAndLoad(t *testing.T) { dir := t.TempDir() storage := &StorageEntity{Dir: dir} name := "test" content := []byte("test content") if err := storage.Save(name, content); err != nil { t.Fatalf("failed to save content: %v", err) } loadedContent, err := stora...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/db.go
internal/plugins/db/fsdb/db.go
package fsdb import ( "fmt" "os" "path/filepath" "strings" "time" "github.com/joho/godotenv" ) func NewDb(dir string) (db *Db) { db = &Db{Dir: dir} db.EnvFilePath = db.FilePath(".env") db.Patterns = &PatternsEntity{ StorageEntity: &StorageEntity{Label: "Patterns", Dir: db.FilePath("patterns"),...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/db/fsdb/contexts_test.go
internal/plugins/db/fsdb/contexts_test.go
package fsdb import ( "os" "path/filepath" "testing" ) func TestContexts_GetContext(t *testing.T) { dir := t.TempDir() contexts := &ContextsEntity{ StorageEntity: &StorageEntity{Dir: dir}, } contextName := "testContext" contextPath := filepath.Join(dir, contextName) contextContent := "test content" err :=...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/extension_executor_test.go
internal/plugins/template/extension_executor_test.go
package template import ( "os" "path/filepath" "strings" "testing" ) func TestExtensionExecutor(t *testing.T) { tmpDir, err := os.MkdirTemp("", "fabric-ext-executor-*") if err != nil { t.Fatalf("Failed to create temp directory: %v", err) } defer os.RemoveAll(tmpDir) // Create test script that has both std...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/text.go
internal/plugins/template/text.go
// Package template provides text transformation operations for the template system. package template import ( "fmt" "strings" "unicode" ) // TextPlugin provides string manipulation operations type TextPlugin struct{} // toTitle capitalizes a letter if it follows a non-letter, unless next char is space func toTit...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/extension_manager.go
internal/plugins/template/extension_manager.go
package template import ( "fmt" "os" "path/filepath" "time" "gopkg.in/yaml.v3" ) // ExtensionManager handles the high-level operations of the extension system type ExtensionManager struct { registry *ExtensionRegistry executor *ExtensionExecutor configDir string } // NewExtensionManager creates a new exte...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/file.go
internal/plugins/template/file.go
// Package template provides file system operations for the template system. // Security Note: This plugin provides access to the local filesystem. // Consider carefully which paths to allow access to in production. package template import ( "bufio" "fmt" "os" "path/filepath" "strconv" "strings" "time" ) // Ma...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/fetch_test.go
internal/plugins/template/fetch_test.go
package template import ( "net/http/httptest" "strings" "testing" ) func TestFetchPlugin(t *testing.T) { plugin := &FetchPlugin{} tests := []struct { name string operation string value string server func() *httptest.Server wantErr bool errContains string }{ // ... keep exi...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/constants.go
internal/plugins/template/constants.go
package template // InputSentinel is used to temporarily replace {{input}} during template processing // to prevent recursive variable resolution const InputSentinel = "__FABRIC_INPUT_SENTINEL_TOKEN__"
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/hash.go
internal/plugins/template/hash.go
package template import ( "crypto/sha256" "encoding/hex" "fmt" "io" "os" ) // ComputeHash computes SHA-256 hash of a file at given path. // Returns the hex-encoded hash string or an error if the operation fails. func ComputeHash(path string) (string, error) { f, err := os.Open(path) if err != nil { return ""...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/utils.go
internal/plugins/template/utils.go
// utils.go in template package for now package template import ( "fmt" "os" "os/user" "path/filepath" "strings" ) // ExpandPath expands the ~ to user's home directory and returns absolute path // It also checks if the path exists // Returns expanded absolute path or error if: // - cannot determine user home dir...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/template_extension_multiple_test.go
internal/plugins/template/template_extension_multiple_test.go
package template import ( "os" "path/filepath" "strings" "testing" ) // TestMultipleExtensionsWithInput ensures multiple extension calls each using {{input}} get proper substitution. func TestMultipleExtensionsWithInput(t *testing.T) { input := "DATA" variables := map[string]string{} tmp := t.TempDir() confi...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/datetime.go
internal/plugins/template/datetime.go
// Package template provides datetime operations for the template system package template import ( "fmt" "strconv" "time" ) // DateTimePlugin handles time and date operations type DateTimePlugin struct{} // Apply executes datetime operations with the following formats: // Time: now (RFC3339), time (HH:MM:SS), uni...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/file_test.go
internal/plugins/template/file_test.go
package template import ( "os" "path/filepath" "strings" "testing" "time" ) func TestFilePlugin(t *testing.T) { plugin := &FilePlugin{} // Create temp test files tmpDir := t.TempDir() testFile := filepath.Join(tmpDir, "test.txt") content := "line1\nline2\nline3\nline4\nline5\n" err := os.WriteFile(testFi...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/hash_test.go
internal/plugins/template/hash_test.go
// template/hash_test.go package template import ( "os" "path/filepath" "testing" ) func TestComputeHash(t *testing.T) { // Create a temporary test file content := []byte("test content for hashing") tmpfile, err := os.CreateTemp("", "hashtest") if err != nil { t.Fatalf("failed to create temp file: %v", err) ...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/sys_test.go
internal/plugins/template/sys_test.go
package template import ( "fmt" "os" "path/filepath" "runtime" "strings" "testing" ) func TestSysPlugin(t *testing.T) { plugin := &SysPlugin{} // Set up test environment variable const testEnvVar = "FABRIC_TEST_VAR" const testEnvValue = "test_value" os.Setenv(testEnvVar, testEnvValue) defer os.Unsetenv(t...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/fetch.go
internal/plugins/template/fetch.go
// Package template provides URL fetching operations for the template system. // Security Note: This plugin makes outbound HTTP requests. Use with caution // and consider implementing URL allowlists in production. package template import ( "bytes" "fmt" "io" "mime" "net/http" "strings" "unicode/utf8" ) const (...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/template_sentinel_test.go
internal/plugins/template/template_sentinel_test.go
package template import ( "fmt" "os" "path/filepath" "strings" "testing" ) // withTestExtension creates a temporary test extension and runs the test function func withTestExtension(t *testing.T, name string, scriptContent string, testFunc func(*ExtensionManager, string)) { t.Helper() // Create a temporary dir...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false
danielmiessler/Fabric
https://github.com/danielmiessler/Fabric/blob/d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725/internal/plugins/template/extension_executor.go
internal/plugins/template/extension_executor.go
package template import ( "bytes" "context" "fmt" "os" "os/exec" "path/filepath" "strings" "time" ) // ExtensionExecutor handles the secure execution of extensions // It uses the registry to verify extensions before running them type ExtensionExecutor struct { registry *ExtensionRegistry } // NewExtensionEx...
go
MIT
d96a1721bbd5cc675b81cf37dac8a8a3a6bb5725
2026-01-07T08:35:59.866090Z
false