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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.25.12
toolchain go1.26.4

require (
github.com/codefly-dev/core v0.2.78
github.com/codefly-dev/core v0.2.80
gopkg.in/yaml.v3 v3.0.1
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJ
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
github.com/codefly-dev/core v0.2.78 h1:v6fW62ZoS/umsjrz4oEEnSJ50nzXeeORMegB7nlXbXQ=
github.com/codefly-dev/core v0.2.78/go.mod h1:hNxTk7ZnR5AU8imfvNJcGpoULQ1uzML5M3E4/RffWU4=
github.com/codefly-dev/core v0.2.80 h1:RwBAWd+7J2ZHHY5RSllfPNlr1wP9CNTmVFQz9UM3rog=
github.com/codefly-dev/core v0.2.80/go.mod h1:hNxTk7ZnR5AU8imfvNJcGpoULQ1uzML5M3E4/RffWU4=
github.com/codefly-dev/gortk v0.2.0 h1:7bOlS5valYz2zil+fZctQNcPCYBcPj86abcw9N8h1hQ=
github.com/codefly-dev/gortk v0.2.0/go.mod h1:dDWUMFgAP063OCGhTEpV7FFUj9+zTcxxO/nV80VKEwg=
github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE=
Expand Down
9 changes: 8 additions & 1 deletion pkg/tooling/tooling.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"context"
"fmt"

corecode "github.com/codefly-dev/core/code"
"github.com/codefly-dev/core/failures"
basev0 "github.com/codefly-dev/core/generated/go/codefly/base/v0"
codev0 "github.com/codefly-dev/core/generated/go/codefly/services/code/v0"
Expand All @@ -22,7 +23,7 @@ import (
//
// ARCHITECTURE: Tooling is the primary interface Mind calls for
// language-specific commands. It unifies Code and Runtime:
// - Analysis: GetProjectInfo (via Code)
// - Analysis: GetProjectInfo + body-free semantic projection (via Code)
// - Modification: Fix (ruff), ApplyEdit (via Code)
// - Dev: Build, Test (pytest), Lint (ruff) (delegates to Runtime)
type Tooling struct {
Expand All @@ -36,6 +37,12 @@ func New(code *pythoncode.Code, rt *pythonruntime.Runtime) *Tooling {
return &Tooling{Code: code, Runtime: rt}
}

// GetSemanticIndex delegates project parsing to the Core Code server embedded
// by the Python agent; no project bytes cross the Tooling boundary.
func (t *Tooling) GetSemanticIndex(ctx context.Context, req *toolingv0.GetSemanticIndexRequest) (*toolingv0.GetSemanticIndexResponse, error) {
return corecode.NewSourceTooling(t.Code).GetSemanticIndex(ctx, req)
}

// ── Code Modification ──────────────────────────────────

func (t *Tooling) Fix(ctx context.Context, req *toolingv0.FixRequest) (*toolingv0.FixResponse, error) {
Expand Down
8 changes: 8 additions & 0 deletions pkg/tooling/tooling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"
"testing"

basev0 "github.com/codefly-dev/core/generated/go/codefly/base/v0"
codev0 "github.com/codefly-dev/core/generated/go/codefly/services/code/v0"
toolingv0 "github.com/codefly-dev/core/generated/go/codefly/services/tooling/v0"
"github.com/codefly-dev/core/resources"
Expand Down Expand Up @@ -69,4 +70,11 @@ func TestProjectInfoCarriesRequirementsAndImportsAcrossCodeAndTooling(t *testing
len(toolingResponse.GetSourceFiles()[0].GetImports()) != 1 || toolingResponse.GetSourceFiles()[0].GetImports()[0] != "flask" {
t.Fatalf("tooling project info = %+v", toolingResponse)
}
semantic, err := pythontooling.New(server, nil).GetSemanticIndex(context.Background(), &toolingv0.GetSemanticIndexRequest{})
if err != nil {
t.Fatal(err)
}
if semantic.GetFailure() != nil || semantic.GetIndex().GetState() != basev0.SemanticIndexState_SEMANTIC_INDEX_STATE_COMPLETE || len(semantic.GetIndex().GetFiles()) != 1 {
t.Fatalf("semantic index = %+v", semantic)
}
}
Loading