general improvements (#17)

* refactor(hooks): simplify hook execution with shared context

- [x] Extract BaseInput struct to eliminate duplicate fields across hooks
- [x] Create RunHook handler pattern for session-start and user-prompt
- [x] Create RunStatuslineHook for fast statusline rendering without worker startup
- [x] Add HookContext struct to pass port, project, CWD, SessionID to handlers
- [x] Add db/interface.go with ObservationReader/Writer interfaces
- [x] Add comprehensive conflict management tests in sqlite/conflict_test.go
- [x] Add vector client tests for Count, ModelVersion, NeedsRebuild, GetStaleVectors
- [x] Add FilterByThreshold helper tests for query result filtering
- [x] Make handlers_test more robust for network-dependent update checks
- [x] Update package versions in UI

* Move to GORM + general cleanup

* feat(mcp): add observation relations discovery and scoring integration

- [x] Add find_related_observations MCP tool for discovering related observations by confidence
- [x] Integrate scoring calculator and recalculator into MCP server initialization
- [x] Add pattern, relation, and session stores to MCP server dependencies
- [x] Register MCP server in Claude Code settings during plugin installation
- [x] Update install scripts (bash, PowerShell) to configure MCP server settings
- [x] Switch plugin manifest files to template-based versioning (plugin.json.tpl, marketplace.json.tpl)
- [x] Update all MCP server tests to pass new dependency parameters
This commit is contained in:
2026-01-07 00:26:20 +00:00
committed by GitHub
parent 92a99c7615
commit 7a061c85eb
85 changed files with 8445 additions and 8202 deletions
+12 -13
View File
@@ -7,7 +7,7 @@ import (
"os"
"testing"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/sqlite"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/gorm"
"github.com/lukaszraczylo/claude-mnemonic/pkg/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -45,8 +45,8 @@ func hasFTS5(t *testing.T) bool {
return true
}
// testStore creates a sqlite.Store with a temporary database for testing.
func testStore(t *testing.T) (*sqlite.Store, func()) {
// testStore creates a gorm.Store with a temporary database for testing.
func testStore(t *testing.T) (*gorm.Store, func()) {
t.Helper()
if !hasFTS5(t) {
@@ -58,10 +58,9 @@ func testStore(t *testing.T) (*sqlite.Store, func()) {
dbPath := tmpDir + "/test.db"
store, err := sqlite.NewStore(sqlite.StoreConfig{
store, err := gorm.NewStore(gorm.Config{
Path: dbPath,
MaxConns: 1,
WALMode: true,
})
require.NoError(t, err)
@@ -76,12 +75,12 @@ func testStore(t *testing.T) (*sqlite.Store, func()) {
// SearchIntegrationSuite tests search with real SQLite stores.
type SearchIntegrationSuite struct {
suite.Suite
store *sqlite.Store
store *gorm.Store
cleanup func()
manager *Manager
obsStore *sqlite.ObservationStore
sumStore *sqlite.SummaryStore
prmStore *sqlite.PromptStore
obsStore *gorm.ObservationStore
sumStore *gorm.SummaryStore
prmStore *gorm.PromptStore
}
func (s *SearchIntegrationSuite) SetupTest() {
@@ -92,9 +91,9 @@ func (s *SearchIntegrationSuite) SetupTest() {
s.store, s.cleanup = testStore(s.T())
// Create real stores backed by SQLite
s.obsStore = sqlite.NewObservationStore(s.store)
s.sumStore = sqlite.NewSummaryStore(s.store)
s.prmStore = sqlite.NewPromptStore(s.store)
s.obsStore = gorm.NewObservationStore(s.store, nil, nil, nil)
s.sumStore = gorm.NewSummaryStore(s.store)
s.prmStore = gorm.NewPromptStore(s.store, nil)
// Create search manager with real stores (no vector client for now)
s.manager = NewManager(s.obsStore, s.sumStore, s.prmStore, nil)
@@ -491,7 +490,7 @@ func (s *SearchIntegrationSuite) TestSummaryToResult_FullFormat() {
func (s *SearchIntegrationSuite) TestPromptToResult_FullFormat() {
// First create a session
ctx := context.Background()
sessionStore := sqlite.NewSessionStore(s.store)
sessionStore := gorm.NewSessionStore(s.store)
_, err := sessionStore.CreateSDKSession(ctx, "sdk-prompt-test", "test-project", "initial prompt")
s.Require().NoError(err)