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
+8 -10
View File
@@ -7,7 +7,7 @@ import (
"testing"
"time"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/sqlite"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/gorm"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
@@ -25,10 +25,9 @@ func hasFTS5(t *testing.T) bool {
}
defer func() { _ = os.RemoveAll(tmpDir) }()
store, err := sqlite.NewStore(sqlite.StoreConfig{
store, err := gorm.NewStore(gorm.Config{
Path: tmpDir + "/check.db",
MaxConns: 1,
WALMode: true,
})
if err != nil {
return false
@@ -37,8 +36,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) {
@@ -50,10 +49,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)
@@ -68,8 +66,8 @@ func testStore(t *testing.T) (*sqlite.Store, func()) {
// SessionIntegrationSuite tests session manager with real SQLite stores.
type SessionIntegrationSuite struct {
suite.Suite
store *sqlite.Store
sessionStore *sqlite.SessionStore
store *gorm.Store
sessionStore *gorm.SessionStore
cleanup func()
manager *Manager
}
@@ -80,7 +78,7 @@ func (s *SessionIntegrationSuite) SetupTest() {
}
s.store, s.cleanup = testStore(s.T())
s.sessionStore = sqlite.NewSessionStore(s.store)
s.sessionStore = gorm.NewSessionStore(s.store)
s.manager = NewManager(s.sessionStore)
}
+3 -3
View File
@@ -7,7 +7,7 @@ import (
"sync/atomic"
"time"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/sqlite"
"github.com/lukaszraczylo/claude-mnemonic/internal/db/gorm"
"github.com/rs/zerolog/log"
)
@@ -70,7 +70,7 @@ const CleanupInterval = 5 * time.Minute
// Manager manages active session lifecycles.
type Manager struct {
sessionStore *sqlite.SessionStore
sessionStore *gorm.SessionStore
sessions map[int64]*ActiveSession
mu sync.RWMutex
onCreated func(int64)
@@ -82,7 +82,7 @@ type Manager struct {
}
// NewManager creates a new session manager.
func NewManager(sessionStore *sqlite.SessionStore) *Manager {
func NewManager(sessionStore *gorm.SessionStore) *Manager {
ctx, cancel := context.WithCancel(context.Background())
m := &Manager{
sessionStore: sessionStore,