Skip to content

Commit bf18bb0

Browse files
committed
fix: resolve build errors after rebase onto v0.8.0
- cmd.go: rename cmd.Flags() to c.Flags() (upstream variable rename) - sessionevent/cmd.go: update import core -> core/state (package split) - copilot.go: prefix Session/Message/ToolUse with entity. (types moved) DCO-1.1-Signed-off-by: ersan bilik <ersanbilik@gmail.com> Signed-off-by: ersan bilik <ersanbilik@gmail.com>
1 parent e4601ca commit bf18bb0

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

internal/cli/initialize/cmd/root/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func Cmd() *cobra.Command {
7777
&noPluginEnable, cFlag.NoPluginEnable, false,
7878
desc.Flag(flag.DescKeyInitializeNoPluginEnable),
7979
)
80-
cmd.Flags().StringVar(
80+
c.Flags().StringVar(
8181
&caller, "caller", "",
8282
"Identify the calling tool (e.g. vscode) to tailor output",
8383
)

internal/cli/system/cmd/sessionevent/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/spf13/cobra"
1313

14-
"github.com/ActiveMemory/ctx/internal/cli/system/core"
14+
coreState "github.com/ActiveMemory/ctx/internal/cli/system/core/state"
1515
"github.com/ActiveMemory/ctx/internal/log"
1616
"github.com/ActiveMemory/ctx/internal/notify"
1717
)
@@ -48,7 +48,7 @@ Examples:
4848
}
4949

5050
func runSessionEvent(cmd *cobra.Command, eventType, caller string) error {
51-
if !core.Initialized() {
51+
if !coreState.Initialized() {
5252
return nil
5353
}
5454

internal/recall/parser/copilot.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/ActiveMemory/ctx/internal/config/file"
2323
"github.com/ActiveMemory/ctx/internal/config/session"
2424
"github.com/ActiveMemory/ctx/internal/config/token"
25+
"github.com/ActiveMemory/ctx/internal/entity"
2526
)
2627

2728
// copilotKeyRequests is the key path segment for request arrays.
@@ -94,7 +95,7 @@ func (p *CopilotParser) Matches(path string) bool {
9495
//
9596
// Reconstructs the session by reading the initial snapshot (kind=0) and
9697
// applying incremental patches (kind=1 for scalar, kind=2 for array/object).
97-
func (p *CopilotParser) ParseFile(path string) ([]*Session, error) {
98+
func (p *CopilotParser) ParseFile(path string) ([]*entity.Session, error) {
9899
file, openErr := os.Open(filepath.Clean(path))
99100
if openErr != nil {
100101
return nil, fmt.Errorf("open file: %w", openErr)
@@ -157,12 +158,12 @@ func (p *CopilotParser) ParseFile(path string) ([]*Session, error) {
157158
return nil, nil
158159
}
159160

160-
return []*Session{result}, nil
161+
return []*entity.Session{result}, nil
161162
}
162163

163164
// ParseLine is not meaningful for Copilot sessions since they use patches.
164165
// Returns nil for all lines.
165-
func (p *CopilotParser) ParseLine(_ []byte) (*Message, string, error) {
166+
func (p *CopilotParser) ParseLine(_ []byte) (*entity.Message, string, error) {
166167
return nil, "", nil
167168
}
168169

@@ -240,12 +241,12 @@ func (p *CopilotParser) parseKeyPath(keys []json.RawMessage) []string {
240241
// buildSession converts a reconstructed copilotRawSession into a Session.
241242
func (p *CopilotParser) buildSession(
242243
raw *copilotRawSession, sourcePath string, cwd string,
243-
) *Session {
244+
) *entity.Session {
244245
if len(raw.Requests) == 0 {
245246
return nil
246247
}
247248

248-
session := &Session{
249+
session := &entity.Session{
249250
ID: raw.SessionID,
250251
Tool: session.ToolCopilot,
251252
SourceFile: sourcePath,
@@ -260,7 +261,7 @@ func (p *CopilotParser) buildSession(
260261

261262
for _, req := range raw.Requests {
262263
// User message
263-
userMsg := Message{
264+
userMsg := entity.Message{
264265
ID: req.RequestID,
265266
Timestamp: time.UnixMilli(req.Timestamp),
266267
Role: claude.RoleUser,
@@ -319,12 +320,12 @@ func (p *CopilotParser) buildSession(
319320
// buildAssistantMessage extracts the assistant response from a request.
320321
func (p *CopilotParser) buildAssistantMessage(
321322
req copilotRawRequest,
322-
) *Message {
323+
) *entity.Message {
323324
if len(req.Response) == 0 {
324325
return nil
325326
}
326327

327-
msg := &Message{
328+
msg := &entity.Message{
328329
ID: req.RequestID + "-response",
329330
Timestamp: time.UnixMilli(req.Timestamp),
330331
Role: claude.RoleAssistant,
@@ -380,7 +381,7 @@ func (p *CopilotParser) buildAssistantMessage(
380381
}
381382

382383
// parseToolInvocation extracts a ToolUse from a toolInvocationSerialized item.
383-
func (p *CopilotParser) parseToolInvocation(item copilotRawRespItem) *ToolUse {
384+
func (p *CopilotParser) parseToolInvocation(item copilotRawRespItem) *entity.ToolUse {
384385
toolID := item.ToolID
385386
if toolID == "" {
386387
return nil
@@ -409,7 +410,7 @@ func (p *CopilotParser) parseToolInvocation(item copilotRawRespItem) *ToolUse {
409410
}
410411
}
411412

412-
return &ToolUse{
413+
return &entity.ToolUse{
413414
ID: item.ToolCallID,
414415
Name: name,
415416
Input: inputStr,

0 commit comments

Comments
 (0)