Skip to content

Commit f33f9fd

Browse files
committed
feat: remove telemetry
1 parent 992d0a1 commit f33f9fd

9 files changed

Lines changed: 20 additions & 324 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ jobs:
4747
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
4848
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
4949
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
50-
# Telemetry configuration (injected at build time)
51-
TELEMETRY_ENDPOINT: ${{ secrets.TELEMETRY_ENDPOINT }}
52-
TELEMETRY_HEADERS: ${{ secrets.TELEMETRY_HEADERS }}
5350

5451
container-images:
5552
name: Build and Push Container Images

.goreleaser.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ builds:
3535
ldflags:
3636
- -s -w
3737
- -X github.com/xinnjie/onekeymap-cli/internal/cmd.version={{.Version}}
38-
- -X github.com/xinnjie/onekeymap-cli/internal/cliconfig.telemetryEndpoint={{.Env.TELEMETRY_ENDPOINT}}
39-
- -X github.com/xinnjie/onekeymap-cli/internal/cliconfig.telemetryHeaders={{.Env.TELEMETRY_HEADERS}}
4038

4139
archives:
4240
- id: onekeymap-cli

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ OneKeymap CLI is a powerful command-line tool that lets you import, export, and
3838

3939
- **Debian/Ubuntu (.deb)**
4040
```bash
41-
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.5.1/onekeymap-cli_0.5.1_x86_64.deb
42-
sudo dpkg -i onekeymap-cli_0.5.1_x86_64.deb
41+
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.7.1/onekeymap-cli_0.7.1_x86_64.deb
42+
sudo dpkg -i onekeymap-cli_0.7.1_x86_64.deb
4343
```
4444
- **Fedora/RHEL/CentOS (.rpm)**
4545
```bash
46-
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.5.1/onekeymap-cli_0.5.1_x86_64.rpm
47-
sudo rpm -i onekeymap-cli_0.5.1_x86_64.rpm
46+
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.7.1/onekeymap-cli_0.7.1_x86_64.rpm
47+
sudo rpm -i onekeymap-cli_0.7.1_x86_64.rpm
4848
```
4949
- **Alpine (.apk)**
5050
```bash
51-
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.5.1/onekeymap-cli_0.5.1_x86_64.apk
52-
sudo apk add --allow-untrusted onekeymap-cli_0.5.1_x86_64.apk
51+
wget https://github.com/xinnjie/onekeymap-cli/releases/download/v0.7.1/onekeymap-cli_0.7.1_x86_64.apk
52+
sudo apk add --allow-untrusted onekeymap-cli_0.7.1_x86_64.apk
5353
```
5454

5555
#### Windows
@@ -142,8 +142,8 @@ editors:
142142
| **VSCode** | ✅ | ✅ | |
143143
| **Zed** | ✅ | ✅ | |
144144
| **IntelliJ IDEA** | ✅ | ✅ | |
145-
| **Xcode** | ✅ | ✅ | shortcut coverage is still limited (see [Action Support Matrix](action-support-matrix.md)) |
146-
| **Helix** | ❌ | ✅ | TOML configuration support; shortcut coverage is still limited (see [Action Support Matrix](action-support-matrix.md)) |
145+
| **Xcode(experimental)** | ✅ | ✅ | shortcut coverage is still limited (see [Action Support Matrix](action-support-matrix.md)) |
146+
| **Helix(experimental)** | ❌ | ✅ | TOML configuration support; shortcut coverage is still limited (see [Action Support Matrix](action-support-matrix.md)) |
147147
| **Vim/Neovim** | 🚧 | 🚧 | Planned |
148148
149149
> See all supported actions: [action-support-matrix.md](action-support-matrix.md)

docs/telemetry.md

Lines changed: 0 additions & 78 deletions
This file was deleted.

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/charmbracelet/lipgloss v1.1.0
1010
github.com/fsnotify/fsnotify v1.9.0
1111
github.com/google/go-cmp v0.7.0
12-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2
1312
github.com/hashicorp/go-version v1.7.0
1413
github.com/microsoft/go-deviceid v1.0.0
1514
github.com/mrk21/go-diff-fmt v0.2.0
@@ -27,9 +26,6 @@ require (
2726
go.opentelemetry.io/otel/sdk/metric v1.38.0
2827
go.yaml.in/yaml/v3 v3.0.4
2928
golang.org/x/term v0.37.0
30-
google.golang.org/genproto/googleapis/api v0.0.0-20251002232023-7c0ddcbb5797
31-
google.golang.org/grpc v1.76.0
32-
google.golang.org/protobuf v1.36.10
3329
gopkg.in/yaml.v3 v3.0.1
3430
howett.net/plist v1.0.1
3531
)
@@ -79,8 +75,12 @@ require (
7975
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
8076
go.opentelemetry.io/otel/trace v1.38.0 // indirect
8177
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
78+
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
8279
golang.org/x/net v0.43.0 // indirect
8380
golang.org/x/sys v0.38.0 // indirect
8481
golang.org/x/text v0.28.0 // indirect
82+
google.golang.org/genproto/googleapis/api v0.0.0-20251002232023-7c0ddcbb5797 // indirect
8583
google.golang.org/genproto/googleapis/rpc v0.0.0-20250922171735-9219d122eba9 // indirect
84+
google.golang.org/grpc v1.76.0 // indirect
85+
google.golang.org/protobuf v1.36.10 // indirect
8686
)

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
8080
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
8181
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
8282
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
83-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0=
84-
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc=
8583
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
8684
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
8785
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=

internal/cmd/root.go

Lines changed: 1 addition & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
package cmd
22

33
import (
4-
"errors"
54
"fmt"
65
"log/slog"
76
"os"
8-
"strings"
97

10-
tea "github.com/charmbracelet/bubbletea"
118
"github.com/spf13/cobra"
129
"github.com/spf13/viper"
1310
"github.com/xinnjie/onekeymap-cli/internal/cliconfig"
1411
"github.com/xinnjie/onekeymap-cli/internal/updatecheck"
15-
"github.com/xinnjie/onekeymap-cli/internal/views"
1612
"github.com/xinnjie/onekeymap-cli/pkg/api/exporterapi"
1713
"github.com/xinnjie/onekeymap-cli/pkg/api/importerapi"
1814
"github.com/xinnjie/onekeymap-cli/pkg/exporter"
@@ -50,7 +46,6 @@ type rootFlags struct {
5046
logJSON bool
5147
backup bool
5248
interactive bool
53-
enableTelemetry bool
5449
sandbox bool
5550
skipUpdateCheck bool
5651
onekeymap string
@@ -77,8 +72,6 @@ func newCmdRoot() (*cobra.Command, *rootFlags) {
7772
cmd.PersistentFlags().BoolVar(&f.logJSON, "log-json", false, "Output logs in JSON format")
7873
cmd.PersistentFlags().BoolVarP(&f.backup, "backup", "b", true, "Create a backup of the target editor's keymap")
7974
cmd.PersistentFlags().BoolVarP(&f.interactive, "interactive", "i", true, "Run in interactive mode")
80-
cmd.PersistentFlags().
81-
BoolVar(&f.enableTelemetry, "telemetry", false, "Enable telemetry to help improve onekeymap-cli")
8275
cmd.PersistentFlags().
8376
BoolVar(&f.sandbox, "sandbox", false, "Enable sandbox mode for macOS, restricting file access")
8477
cmd.PersistentFlags().
@@ -90,10 +83,6 @@ func newCmdRoot() (*cobra.Command, *rootFlags) {
9083
cmd.PrintErrf("Error binding onekeymap flag: %v\n", err)
9184
os.Exit(1)
9285
}
93-
if err := viper.BindPFlag("telemetry.enabled", cmd.PersistentFlags().Lookup("telemetry")); err != nil {
94-
cmd.PrintErrf("Error binding telemetry flag: %v\n", err)
95-
os.Exit(1)
96-
}
9786

9887
return cmd, &f
9988
}
@@ -106,26 +95,15 @@ func rootPersistentPreRun(f *rootFlags) func(cmd *cobra.Command, _ []string) {
10695
os.Exit(1)
10796
}
10897

109-
// Show telemetry prompt in interactive mode if telemetry is not explicitly configured
110-
// and not explicitly enabled via flag, and running in a TTY environment
11198
isTTY := term.IsTerminal(int(os.Stdin.Fd()))
11299
if !isTTY {
113100
f.interactive = false
114101
}
115-
if f.interactive && isTTY && !cliconfig.IsTelemetryExplicitlySet() && !f.enableTelemetry {
116-
if err := showTelemetryPrompt(); err != nil {
117-
cmd.PrintErrf("Error showing telemetry prompt: %v\n", err)
118-
// Continue execution even if prompt fails
119-
}
120-
}
121102

122103
verbose := f.verbose
123104
quiet := f.quiet
124105
logJSON := f.logJSON
125-
telemetryEnabled := viper.GetBool("telemetry.enabled")
126-
telemetryEndpoint := viper.GetString("telemetry.endpoint")
127-
telemetryHeaders := viper.GetString("telemetry.headers")
128-
ctx := cmd.Context()
106+
cmdRecorder = metrics.NewNoop()
129107

130108
cmdMappingConfig, err = mappings.NewMappingConfig()
131109
if err != nil {
@@ -165,30 +143,6 @@ func rootPersistentPreRun(f *rootFlags) func(cmd *cobra.Command, _ []string) {
165143
}
166144

167145
cmdLogger = slog.New(handler)
168-
logger := cmdLogger
169-
170-
cmdRecorder = metrics.NewNoop()
171-
if telemetryEnabled {
172-
logger.DebugContext(ctx, "Telemetry enabled")
173-
if telemetryEndpoint == "" {
174-
logger.DebugContext(
175-
ctx,
176-
"telemetry is enabled, but telemetry.endpoint is not set. Telemetry data will not be sent.",
177-
)
178-
}
179-
180-
headers := parseHeaders(telemetryHeaders)
181-
182-
cmdRecorder, err = metrics.New(ctx, version, logger, metrics.RecorderOption{
183-
Endpoint: telemetryEndpoint,
184-
Headers: headers,
185-
UseDelta: true, // Use delta temporality for short-lived CLI application
186-
})
187-
if err != nil {
188-
logger.WarnContext(ctx, "failed to initialize telemetry", "error", err)
189-
os.Exit(1)
190-
}
191-
}
192146

193147
cmdPluginRegistry = registry.NewRegistryWithPlugins(cmdMappingConfig, cmdLogger, cmdRecorder)
194148

@@ -266,56 +220,3 @@ func buildVersionString() string {
266220

267221
return version
268222
}
269-
270-
const (
271-
headerKeyValueParts = 2
272-
)
273-
274-
// parseHeaders parses a comma-separated string of key=value pairs into a map.
275-
// Format: "key1=value1,key2=value2"
276-
func parseHeaders(headersStr string) map[string]string {
277-
if headersStr == "" {
278-
return nil
279-
}
280-
281-
headers := make(map[string]string)
282-
pairs := strings.Split(headersStr, ",")
283-
for _, pair := range pairs {
284-
pair = strings.TrimSpace(pair)
285-
if pair == "" {
286-
continue
287-
}
288-
parts := strings.SplitN(pair, "=", headerKeyValueParts)
289-
if len(parts) == headerKeyValueParts {
290-
headers[strings.TrimSpace(parts[0])] = strings.TrimSpace(parts[1])
291-
}
292-
}
293-
return headers
294-
}
295-
296-
// showTelemetryPrompt displays the telemetry consent prompt and updates config based on user choice
297-
func showTelemetryPrompt() error {
298-
model := views.NewTelemetryPrompt()
299-
program := tea.NewProgram(model)
300-
301-
finalModel, err := program.Run()
302-
if err != nil {
303-
return fmt.Errorf("failed to run telemetry prompt: %w", err)
304-
}
305-
306-
// Cast back to our model type
307-
m, ok := finalModel.(views.TelemetryPromptModel)
308-
if !ok {
309-
return errors.New("unexpected model type")
310-
}
311-
312-
// Only update config if user made a selection (didn't quit)
313-
if m.WasSelected() {
314-
enabled := m.GetChoice()
315-
if err := cliconfig.UpdateTelemetrySettings(enabled); err != nil {
316-
return fmt.Errorf("failed to update telemetry settings: %w", err)
317-
}
318-
}
319-
320-
return nil
321-
}

internal/views/style.go

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ import "github.com/charmbracelet/lipgloss"
44

55
// Color constants used across TUI components
66
const (
7-
blue = lipgloss.Color("12")
8-
white = lipgloss.Color("7")
9-
red = lipgloss.Color("9")
10-
yellow = lipgloss.Color("11")
11-
cyan = lipgloss.Color("14")
12-
green = lipgloss.Color("10")
13-
gray = lipgloss.Color("8")
14-
purple = lipgloss.Color("#7C3AED")
15-
lightGray = lipgloss.Color("#666666")
7+
blue = lipgloss.Color("12")
8+
white = lipgloss.Color("7")
9+
red = lipgloss.Color("9")
10+
yellow = lipgloss.Color("11")
11+
cyan = lipgloss.Color("14")
12+
green = lipgloss.Color("10")
13+
gray = lipgloss.Color("8")
1614

1715
IssuePaddingLeft = 2
1816
OptionPadding = 2
@@ -62,32 +60,6 @@ var (
6260
actionStyle = lipgloss.NewStyle().
6361
Foreground(green)
6462

65-
// Telemetry prompt styles
66-
//nolint:gochecknoglobals // style reused across TUI
67-
telemetryTitleStyle = lipgloss.NewStyle().
68-
Bold(true).
69-
Foreground(purple).
70-
Padding(1, 0)
71-
72-
//nolint:gochecknoglobals // style reused across TUI
73-
questionStyle = lipgloss.NewStyle().
74-
Padding(1, 0)
75-
76-
//nolint:gochecknoglobals // style reused across TUI
77-
optionStyle = lipgloss.NewStyle().
78-
Padding(0, OptionPadding)
79-
80-
//nolint:gochecknoglobals // style reused across TUI
81-
selectedOptionStyle = lipgloss.NewStyle().
82-
Padding(0, OptionPadding).
83-
Background(purple).
84-
Foreground(lipgloss.Color("#FFFFFF"))
85-
86-
//nolint:gochecknoglobals // style reused across TUI
87-
telemetryHelpStyle = lipgloss.NewStyle().
88-
Foreground(lightGray).
89-
Padding(1, 0)
90-
9163
// Action detail styles
9264
//nolint:gochecknoglobals // style reused across TUI
9365
labelStyle = lipgloss.NewStyle().Bold(true)

0 commit comments

Comments
 (0)