Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 9 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ main, develop ]

env:
GO_VERSION: '1.21'
GO_VERSION: '1.23'

jobs:
test:
Expand All @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -37,11 +37,12 @@ jobs:
run: go test -race -covermode=atomic -coverprofile=coverage.out -v ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}

build:
name: Build
Expand All @@ -52,7 +53,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -70,7 +71,7 @@ jobs:
run: ./bin/lil-rag --help

- name: Upload build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: binaries
path: bin/
Expand All @@ -84,13 +85,13 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=5m
Expand All @@ -104,7 +105,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand All @@ -118,26 +119,3 @@ jobs:
- name: Validate profile example
run: cd examples/profile && go build -v .

security:
name: Security Scan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: true

- name: Run Gosec Security Scanner
uses: securecodewarrior/github-action-gosec@master
with:
args: '-no-fail -fmt sarif -out results.sarif ./...'

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*'

env:
GO_VERSION: '1.21'
GO_VERSION: '1.23'

jobs:
build-and-release:
Expand All @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt

- name: Create release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
# Build output
/bin/
/dist/
lil-rag
lil-rag-server

# Example binaries
examples/library/library
examples/profile/profile

# Test binary, built with `go test -c`
*.test
Expand Down
40 changes: 28 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ linters-settings:
goimports:
local-prefixes: lil-rag

golint:
min-confidence: 0.8

goconst:
min-len: 3
min-occurrences: 3
Expand All @@ -61,17 +58,15 @@ linters:
disable-all: true
enable:
- bodyclose
- deadcode
- depguard
- copyloopvar # replaces exportloopvar
- dogsled
- errcheck
- exportloopref
- exhaustive
- goconst
- gocritic
- gofmt
- goimports
- golint
- revive # replaces golint
- gosec
- gosimple
- govet
Expand All @@ -81,22 +76,42 @@ linters:
- nakedret
- rowserrcheck
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

issues:
exclude-rules:
# Disable all lint checks for test files
- path: _test\.go
linters:
- bodyclose
- copyloopvar
- dogsled
- errcheck
- exhaustive
- goconst
- gocritic
- gofmt
- goimports
- revive
- gosec
- gosimple
- govet
- ineffassign
- lll
- goconst
- misspell
- nakedret
- rowserrcheck
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- whitespace

- linters:
- lll
Expand All @@ -111,6 +126,7 @@ issues:
new: false

output:
format: colored-line-number
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
60 changes: 33 additions & 27 deletions cmd/lil-rag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,40 +163,38 @@ func handleIndex(ctx context.Context, rag *minirag.MiniRag, args []string) error
}
fmt.Printf("Successfully indexed PDF file '%s' with ID '%s'\n", input, id)
return nil
} else {
// Regular text file
text, err := readFromFile(input)
if err != nil {
return fmt.Errorf("failed to read from file: %w", err)
}

if strings.TrimSpace(text) == "" {
return fmt.Errorf("no text to index")
}

fmt.Printf("Indexing text file '%s' with ID '%s'...\n", input, id)
if err := rag.Index(ctx, text, id); err != nil {
return fmt.Errorf("failed to index: %w", err)
}

fmt.Printf("Successfully indexed %d characters with ID '%s'\n", len(text), id)
return nil
}
} else {
// Treat as direct text input
text := input
// Regular text file
text, err := readFromFile(input)
if err != nil {
return fmt.Errorf("failed to read from file: %w", err)
}

if strings.TrimSpace(text) == "" {
return fmt.Errorf("no text to index")
}

fmt.Printf("Indexing text with ID '%s'...\n", id)
fmt.Printf("Indexing text file '%s' with ID '%s'...\n", input, id)
if err := rag.Index(ctx, text, id); err != nil {
return fmt.Errorf("failed to index: %w", err)
}

fmt.Printf("Successfully indexed %d characters with ID '%s'\n", len(text), id)
return nil
}
// Treat as direct text input
text := input
if strings.TrimSpace(text) == "" {
return fmt.Errorf("no text to index")
}

fmt.Printf("Indexing text with ID '%s'...\n", id)
if err := rag.Index(ctx, text, id); err != nil {
return fmt.Errorf("failed to index: %w", err)
}

fmt.Printf("Successfully indexed %d characters with ID '%s'\n", len(text), id)
return nil
}

func handleSearch(ctx context.Context, rag *minirag.MiniRag, args []string) error {
Expand Down Expand Up @@ -263,13 +261,21 @@ func handleConfig(profileConfig *config.ProfileConfig, args []string) error {
if err := defaultConfig.Save(); err != nil {
return fmt.Errorf("failed to save config: %w", err)
}
configPath, _ := config.GetProfileConfigPath()
fmt.Printf("Profile config initialized at: %s\n", configPath)
configPath, err := config.GetProfileConfigPath()
if err != nil {
fmt.Println("Profile config initialized successfully")
} else {
fmt.Printf("Profile config initialized at: %s\n", configPath)
}
return nil

case "show":
configPath, _ := config.GetProfileConfigPath()
fmt.Printf("Config file: %s\n", configPath)
configPath, err := config.GetProfileConfigPath()
if err != nil {
fmt.Printf("Config file: <error getting path: %v>\n", err)
} else {
fmt.Printf("Config file: %s\n", configPath)
}
fmt.Printf("Storage Path: %s\n", profileConfig.StoragePath)
fmt.Printf("Data Directory: %s\n", profileConfig.DataDir)
fmt.Printf("Ollama Endpoint: %s\n", profileConfig.Ollama.Endpoint)
Expand Down Expand Up @@ -398,7 +404,7 @@ func handleReset(profileConfig *config.ProfileConfig, args []string) error {

response := strings.ToLower(strings.TrimSpace(scanner.Text()))
if response != "y" && response != "yes" {
fmt.Println("Operation cancelled.")
fmt.Println("Operation canceled.")
return nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module lil-rag

go 1.24.6
go 1.23

require (
github.com/asg017/sqlite-vec-go-bindings v0.1.6
Expand Down
Loading