mirror of
https://github.com/lukaszraczylo/claude-mnemonic.git
synced 2026-10-17 05:59:36 +00:00
feat(chunking): add AST-aware code chunking for Go, Python, TypeScript
- [x] Add language-specific chunkers with AST parsing (Go, Python, TypeScript) - [x] Implement chunking manager to dispatch files to appropriate chunkers - [x] Integrate code chunks into vector sync for semantic search - [x] Add tree-sitter dependency for Python/TypeScript parsing - [x] Reorder struct fields for consistency across codebase - [x] Rename error variables to follow Go conventions (err → unmarshalErr, etc.) - [x] Add code chunk metadata to vector documents (language, symbol name, line ranges) - [x] Update worker service to initialize chunking pipeline with all three languages
This commit is contained in:
@@ -62,11 +62,11 @@ type BaseInput struct {
|
||||
// HookContext provides common context for hook handlers.
|
||||
type HookContext struct {
|
||||
HookName string
|
||||
Port int
|
||||
Project string
|
||||
SessionID string
|
||||
CWD string
|
||||
RawInput []byte
|
||||
Port int
|
||||
}
|
||||
|
||||
// HookHandler is a function that handles hook-specific logic.
|
||||
@@ -92,8 +92,8 @@ func RunHook[T any](hookName string, handler HookHandler[T]) {
|
||||
|
||||
// Parse input
|
||||
var input T
|
||||
if err := json.Unmarshal(inputData, &input); err != nil {
|
||||
WriteError(hookName, err)
|
||||
if unmarshalErr := json.Unmarshal(inputData, &input); unmarshalErr != nil {
|
||||
WriteError(hookName, unmarshalErr)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
@@ -320,11 +320,11 @@ func TestExtractBaseVersion(t *testing.T) {
|
||||
// TestPOST tests the POST function with a mock server.
|
||||
func TestPOST(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serverHandler func(w http.ResponseWriter, r *http.Request)
|
||||
body interface{}
|
||||
expectError bool
|
||||
serverHandler func(w http.ResponseWriter, r *http.Request)
|
||||
expectedResult map[string]interface{}
|
||||
name string
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
name: "successful POST with JSON response",
|
||||
@@ -393,10 +393,10 @@ func TestPOST(t *testing.T) {
|
||||
// TestGET tests the GET function with a mock server.
|
||||
func TestGET(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serverHandler func(w http.ResponseWriter, r *http.Request)
|
||||
expectError bool
|
||||
expectedResult map[string]interface{}
|
||||
name string
|
||||
expectError bool
|
||||
}{
|
||||
{
|
||||
name: "successful GET with JSON response",
|
||||
@@ -532,8 +532,8 @@ func TestExitCodes(t *testing.T) {
|
||||
func TestHookResponse(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
response HookResponse
|
||||
expected string
|
||||
response HookResponse
|
||||
}{
|
||||
{
|
||||
name: "continue true",
|
||||
@@ -597,8 +597,8 @@ func TestHookContext(t *testing.T) {
|
||||
// TestIsWorkerRunning_WithServer tests IsWorkerRunning with actual server.
|
||||
func TestIsWorkerRunning_WithServer(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
serverHandler func(w http.ResponseWriter, r *http.Request)
|
||||
name string
|
||||
expectedResult bool
|
||||
}{
|
||||
{
|
||||
@@ -828,8 +828,8 @@ func TestBaseInput_PartialFields(t *testing.T) {
|
||||
func TestHookResponse_Marshal(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
response HookResponse
|
||||
contains []string
|
||||
response HookResponse
|
||||
}{
|
||||
{
|
||||
name: "continue true",
|
||||
@@ -1177,7 +1177,7 @@ func TestHookContext_RawInput(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
ctx := HookContext{
|
||||
HookName: "test",
|
||||
HookName: "test", //nolint:govet
|
||||
RawInput: tt.rawInput,
|
||||
}
|
||||
assert.Equal(t, tt.rawInput, ctx.RawInput)
|
||||
|
||||
Reference in New Issue
Block a user