Compare commits

..

2 Commits

Author SHA1 Message Date
celestial-vault b36fe247fd add dev command for cline-core changes for cli 2025-10-04 10:16:12 -07:00
pashpashpash 097f8e6239 cline cli super alpha (#6644)
* super sketchy big merge with main

* gitignore

* gitignore

* Delete cli/bin/air

* Delete cli/bin directory

* Delete cli/cline-host

* Fix missing package.json in cli

Copy the package JSON into the dist-standalone dir during compilation.
Remove workaround for missing package.json

* Update scripts/build-cli.sh

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Remove reference to watchservice, it has been removed

* Update scripts/build-go-proto.mjs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix timestamp to string conversion

* diff.go ellipsis fix

* COMMON_TYPES

---------

Co-authored-by: Sarah Fortune <sarah.fortune@gmail.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-03 15:04:00 -07:00
5 changed files with 15 additions and 128 deletions
-2
View File
@@ -12,8 +12,6 @@ require (
replace github.com/cline/grpc-go => ../src/generated/grpc-go
require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.41.0 // indirect
-2
View File
@@ -1,5 +1,3 @@
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
+14 -118
View File
@@ -3,16 +3,9 @@ package hostbridge
import (
"context"
"log"
"os"
"path/filepath"
"strings"
"github.com/atotto/clipboard"
"github.com/cline/cli/pkg/cli"
"github.com/cline/grpc-go/cline"
"github.com/cline/grpc-go/host"
"github.com/google/uuid"
"google.golang.org/protobuf/proto"
)
// Global shutdown channel - simple approach
@@ -38,18 +31,11 @@ func NewEnvService(verbose bool) *EnvService {
// ClipboardWriteText writes text to the system clipboard
func (s *EnvService) ClipboardWriteText(ctx context.Context, req *cline.StringRequest) (*cline.Empty, error) {
if s.verbose {
log.Printf("ClipboardWriteText called with text length: %d", len(req.GetValue()))
}
err := clipboard.WriteAll(req.GetValue())
if err != nil {
if s.verbose {
log.Printf("Failed to write to clipboard: %v", err)
}
// Don't fail if clipboard is not available (e.g., headless environment)
// Just log and return success
log.Printf("ClipboardWriteText called with: %s", req.GetValue())
}
// TODO: Implement actual clipboard functionality
// For now, just return success
return &cline.Empty{}, nil
}
@@ -59,78 +45,24 @@ func (s *EnvService) ClipboardReadText(ctx context.Context, req *cline.EmptyRequ
log.Printf("ClipboardReadText called")
}
text, err := clipboard.ReadAll()
if err != nil {
if s.verbose {
log.Printf("Failed to read from clipboard: %v", err)
}
// Return empty string if clipboard is not available
text = ""
}
// TODO: Implement actual clipboard functionality
// For now, return empty string
return &cline.String{
Value: text,
Value: "",
}, nil
}
// getMachineIdPath returns the path to the machine ID file
func getMachineIdPath() (string, error) {
homeDir, err := os.UserHomeDir()
if err != nil {
return "", err
}
return filepath.Join(homeDir, ".cline", "machine-id"), nil
}
// GetMachineId returns a stable machine identifier for telemetry distinctId purposes
func (s *EnvService) GetMachineId(ctx context.Context, req *cline.EmptyRequest) (*cline.String, error) {
if s.verbose {
log.Printf("GetMachineId called")
}
idPath, err := getMachineIdPath()
if err != nil {
if s.verbose {
log.Printf("Failed to get machine ID path: %v", err)
}
return &cline.String{Value: ""}, nil
}
// Try to read existing machine ID
if data, err := os.ReadFile(idPath); err == nil {
id := strings.TrimSpace(string(data))
if id != "" {
if s.verbose {
log.Printf("Using existing machine ID: %s", id)
}
return &cline.String{Value: id}, nil
}
}
// Generate new machine ID
id := uuid.New().String()
if s.verbose {
log.Printf("Generated new machine ID: %s", id)
}
// Ensure directory exists
if err := os.MkdirAll(filepath.Dir(idPath), 0755); err != nil {
if s.verbose {
log.Printf("Failed to create .cline directory: %v", err)
}
// Still return the ID even if we can't save it
return &cline.String{Value: id}, nil
}
// Try to save the machine ID for future use
if err := os.WriteFile(idPath, []byte(id), 0644); err != nil {
if s.verbose {
log.Printf("Failed to save machine ID: %v", err)
}
// Still return the ID even if we can't save it
}
return &cline.String{Value: id}, nil
// TODO: Implement actual machine ID functionality
// For now, return empty string
return &cline.String{
Value: "",
}, nil
}
// GetHostVersion returns the host platform name and version
@@ -139,45 +71,9 @@ func (s *EnvService) GetHostVersion(ctx context.Context, req *cline.EmptyRequest
log.Printf("GetHostVersion called")
}
return &host.GetHostVersionResponse{
Platform: proto.String("Cline CLI"),
Version: proto.String(""),
ClineType: proto.String("CLI"),
ClineVersion: proto.String(cli.Version),
}, nil
}
// GetIdeRedirectUri returns a URI that will redirect to the host environment
func (s *EnvService) GetIdeRedirectUri(ctx context.Context, req *cline.EmptyRequest) (*cline.String, error) {
if s.verbose {
log.Printf("GetIdeRedirectUri called")
}
// CLI does not have a URI scheme
return &cline.String{Value: ""}, nil
}
// GetTelemetrySettings returns the telemetry settings of the host environment
func (s *EnvService) GetTelemetrySettings(ctx context.Context, req *cline.EmptyRequest) (*host.GetTelemetrySettingsResponse, error) {
if s.verbose {
log.Printf("GetTelemetrySettings called")
}
// CLI does not have its own telemetry settings
return &host.GetTelemetrySettingsResponse{
IsEnabled: host.Setting_UNSUPPORTED,
}, nil
}
// SubscribeToTelemetrySettings returns events when the telemetry settings change
func (s *EnvService) SubscribeToTelemetrySettings(req *cline.EmptyRequest, stream host.EnvService_SubscribeToTelemetrySettingsServer) error {
if s.verbose {
log.Printf("SubscribeToTelemetrySettings called")
}
// CLI does not have telemetry settings changes to stream
// Just return without sending any events (empty stream)
return nil
// TODO: Implement actual host version functionality
// For now, return empty response
return &host.GetHostVersionResponse{}, nil
}
// Shutdown initiates a graceful shutdown of the host bridge service
+1
View File
@@ -296,6 +296,7 @@
"compile": "npm run check-types && npm run lint && node esbuild.mjs",
"compile-standalone": "npm run check-types && npm run lint && node esbuild.mjs --standalone",
"compile-cli": "scripts/build-cli.sh",
"dev:cli": "npm run compile-standalone && npm run compile-cli && ./cli/bin/cline instance kill --all && ./cli/bin/cline instance new",
"postcompile-standalone": "node scripts/package-standalone.mjs",
"watch": "npm-run-all -p watch:*",
"watch:esbuild": "node esbuild.mjs --watch",
-6
View File
@@ -5,17 +5,11 @@ import { EmptyRequest } from "@/shared/proto/cline/common"
// Canonical header names for extra client/host context
export const ClineHeaders = {
// Platform name, e.g. "Jetbrains IDEA ULtimate"
PLATFORM: "X-PLATFORM",
// Version of IDE
PLATFORM_VERSION: "X-PLATFORM-VERSION",
// E.G. Version of Extension, Plugin, or CLI
CLIENT_VERSION: "X-CLIENT-VERSION",
// Type of client, e.g. "CLI", "Jetbrains", "VS Code"
CLIENT_TYPE: "X-CLIENT-TYPE",
// Version of Cline Core
CORE_VERSION: "X-CORE-VERSION",
// Whether this is a multiroot workspace
IS_MULTIROOT: "X-IS-MULTIROOT",
} as const
export type ClineHeaderName = (typeof ClineHeaders)[keyof typeof ClineHeaders]