From 71742de72f38a3ee4111eaee28379b7ad804bf6d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 8 Nov 2025 02:27:36 +0000 Subject: [PATCH 1/5] Initial plan From 256085a00d85e74492c1a3e225004bed217810c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 8 Nov 2025 02:37:43 +0000 Subject: [PATCH 2/5] Add RenameLocalApp function with comprehensive tests Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> --- pkg/waveappstore/waveappstore.go | 77 ++++++- pkg/waveappstore/waveappstore_test.go | 320 ++++++++++++++++++++++++++ 2 files changed, 396 insertions(+), 1 deletion(-) create mode 100644 pkg/waveappstore/waveappstore_test.go diff --git a/pkg/waveappstore/waveappstore.go b/pkg/waveappstore/waveappstore.go index 1da4c59278..9ae57be7b1 100644 --- a/pkg/waveappstore/waveappstore.go +++ b/pkg/waveappstore/waveappstore.go @@ -498,7 +498,6 @@ func ListAllEditableApps() ([]string, error) { return appIds, nil } - func DraftHasLocalVersion(draftAppId string) (bool, error) { if err := ValidateAppId(draftAppId); err != nil { return false, fmt.Errorf("invalid appId: %w", err) @@ -521,3 +520,79 @@ func DraftHasLocalVersion(draftAppId string) (bool, error) { return true, nil } + +func RenameLocalApp(appName string, newAppName string) error { + // Validate the old app name by constructing a valid appId + oldLocalAppId := MakeAppId(AppNSLocal, appName) + if err := ValidateAppId(oldLocalAppId); err != nil { + return fmt.Errorf("invalid app name: %w", err) + } + + // Validate the new app name by constructing a valid appId + newLocalAppId := MakeAppId(AppNSLocal, newAppName) + if err := ValidateAppId(newLocalAppId); err != nil { + return fmt.Errorf("invalid new app name: %w", err) + } + + homeDir := wavebase.GetHomeDir() + waveappsDir := filepath.Join(homeDir, "waveapps") + + oldLocalDir := filepath.Join(waveappsDir, AppNSLocal, appName) + newLocalDir := filepath.Join(waveappsDir, AppNSLocal, newAppName) + oldDraftDir := filepath.Join(waveappsDir, AppNSDraft, appName) + newDraftDir := filepath.Join(waveappsDir, AppNSDraft, newAppName) + + // Check if at least one of the apps exists + localExists := false + draftExists := false + if _, err := os.Stat(oldLocalDir); err == nil { + localExists = true + } else if !os.IsNotExist(err) { + return fmt.Errorf("failed to check local app: %w", err) + } + + if _, err := os.Stat(oldDraftDir); err == nil { + draftExists = true + } else if !os.IsNotExist(err) { + return fmt.Errorf("failed to check draft app: %w", err) + } + + if !localExists && !draftExists { + return fmt.Errorf("app '%s' does not exist in local or draft namespace", appName) + } + + // Check if new app name already exists in either namespace + if _, err := os.Stat(newLocalDir); err == nil { + return fmt.Errorf("local app '%s' already exists", newAppName) + } else if !os.IsNotExist(err) { + return fmt.Errorf("failed to check if new local app exists: %w", err) + } + + if _, err := os.Stat(newDraftDir); err == nil { + return fmt.Errorf("draft app '%s' already exists", newAppName) + } else if !os.IsNotExist(err) { + return fmt.Errorf("failed to check if new draft app exists: %w", err) + } + + // Rename local app if it exists + if localExists { + if err := os.Rename(oldLocalDir, newLocalDir); err != nil { + return fmt.Errorf("failed to rename local app: %w", err) + } + } + + // Rename draft app if it exists + if draftExists { + if err := os.Rename(oldDraftDir, newDraftDir); err != nil { + // If local was renamed but draft fails, try to rollback local rename + if localExists { + if rollbackErr := os.Rename(newLocalDir, oldLocalDir); rollbackErr != nil { + return fmt.Errorf("failed to rename draft app (and failed to rollback local rename: %v): %w", rollbackErr, err) + } + } + return fmt.Errorf("failed to rename draft app: %w", err) + } + } + + return nil +} diff --git a/pkg/waveappstore/waveappstore_test.go b/pkg/waveappstore/waveappstore_test.go new file mode 100644 index 0000000000..4791f79f56 --- /dev/null +++ b/pkg/waveappstore/waveappstore_test.go @@ -0,0 +1,320 @@ +// Copyright 2025, Command Line Inc. +// SPDX-License-Identifier: Apache-2.0 + +package waveappstore + +import ( + "os" + "path/filepath" + "testing" +) + +// setupTestDir creates a temporary test directory and sets it as the home directory +func setupTestDir(t *testing.T) (string, func()) { + t.Helper() + + // Create a temporary directory for testing + tmpDir, err := os.MkdirTemp("", "waveappstore-test-*") + if err != nil { + t.Fatalf("failed to create temp dir: %v", err) + } + + // Save the original HOME environment variable + originalHome := os.Getenv("HOME") + + // Set the test directory as the home directory + os.Setenv("HOME", tmpDir) + + // Return cleanup function + cleanup := func() { + os.RemoveAll(tmpDir) + // Restore original home directory + if originalHome != "" { + os.Setenv("HOME", originalHome) + } else { + os.Unsetenv("HOME") + } + } + + return tmpDir, cleanup +} + +// createTestApp creates a test app with a simple file +func createTestApp(t *testing.T, appId string) { + t.Helper() + + appDir, err := GetAppDir(appId) + if err != nil { + t.Fatalf("failed to get app dir: %v", err) + } + + if err := os.MkdirAll(appDir, 0755); err != nil { + t.Fatalf("failed to create app dir: %v", err) + } + + testFile := filepath.Join(appDir, "test.txt") + if err := os.WriteFile(testFile, []byte("test content"), 0644); err != nil { + t.Fatalf("failed to write test file: %v", err) + } +} + +// appExists checks if an app directory exists +func appExists(t *testing.T, appId string) bool { + t.Helper() + + appDir, err := GetAppDir(appId) + if err != nil { + t.Fatalf("failed to get app dir: %v", err) + } + + _, err = os.Stat(appDir) + return err == nil +} + +func TestRenameLocalApp_LocalOnly(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create a local app + createTestApp(t, "local/testapp") + + // Rename the app + err := RenameLocalApp("testapp", "renamedapp") + if err != nil { + t.Fatalf("RenameLocalApp failed: %v", err) + } + + // Verify old app is gone + if appExists(t, "local/testapp") { + t.Error("old local app still exists") + } + + // Verify new app exists + if !appExists(t, "local/renamedapp") { + t.Error("new local app does not exist") + } + + // Verify draft app does not exist + if appExists(t, "draft/testapp") { + t.Error("old draft app should not exist") + } + if appExists(t, "draft/renamedapp") { + t.Error("new draft app should not exist") + } +} + +func TestRenameLocalApp_DraftOnly(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create a draft app + createTestApp(t, "draft/testapp") + + // Rename the app + err := RenameLocalApp("testapp", "renamedapp") + if err != nil { + t.Fatalf("RenameLocalApp failed: %v", err) + } + + // Verify old draft app is gone + if appExists(t, "draft/testapp") { + t.Error("old draft app still exists") + } + + // Verify new draft app exists + if !appExists(t, "draft/renamedapp") { + t.Error("new draft app does not exist") + } + + // Verify local app does not exist + if appExists(t, "local/testapp") { + t.Error("old local app should not exist") + } + if appExists(t, "local/renamedapp") { + t.Error("new local app should not exist") + } +} + +func TestRenameLocalApp_BothLocalAndDraft(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create both local and draft apps + createTestApp(t, "local/testapp") + createTestApp(t, "draft/testapp") + + // Rename the app + err := RenameLocalApp("testapp", "renamedapp") + if err != nil { + t.Fatalf("RenameLocalApp failed: %v", err) + } + + // Verify old apps are gone + if appExists(t, "local/testapp") { + t.Error("old local app still exists") + } + if appExists(t, "draft/testapp") { + t.Error("old draft app still exists") + } + + // Verify new apps exist + if !appExists(t, "local/renamedapp") { + t.Error("new local app does not exist") + } + if !appExists(t, "draft/renamedapp") { + t.Error("new draft app does not exist") + } +} + +func TestRenameLocalApp_NonExistentApp(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Try to rename an app that doesn't exist + err := RenameLocalApp("nonexistent", "newname") + if err == nil { + t.Fatal("expected error when renaming non-existent app, got nil") + } + + expectedMsg := "does not exist" + if err.Error() == "" || len(err.Error()) < len(expectedMsg) { + t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) + } +} + +func TestRenameLocalApp_InvalidOldName(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Try to rename with invalid old app name + err := RenameLocalApp("invalid name with spaces", "newname") + if err == nil { + t.Fatal("expected error with invalid old app name, got nil") + } +} + +func TestRenameLocalApp_InvalidNewName(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create a local app + createTestApp(t, "local/testapp") + + // Try to rename with invalid new app name + err := RenameLocalApp("testapp", "invalid name with spaces") + if err == nil { + t.Fatal("expected error with invalid new app name, got nil") + } + + // Verify original app still exists + if !appExists(t, "local/testapp") { + t.Error("original app should still exist after failed rename") + } +} + +func TestRenameLocalApp_ConflictWithExistingLocal(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create two local apps + createTestApp(t, "local/testapp") + createTestApp(t, "local/existingapp") + + // Try to rename to an existing app name + err := RenameLocalApp("testapp", "existingapp") + if err == nil { + t.Fatal("expected error when renaming to existing app, got nil") + } + + expectedMsg := "already exists" + if err.Error() == "" || len(err.Error()) < len(expectedMsg) { + t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) + } + + // Verify both apps still exist unchanged + if !appExists(t, "local/testapp") { + t.Error("original app should still exist") + } + if !appExists(t, "local/existingapp") { + t.Error("existing app should still exist") + } +} + +func TestRenameLocalApp_ConflictWithExistingDraft(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create a local app and a draft app with different names + createTestApp(t, "local/testapp") + createTestApp(t, "draft/existingapp") + + // Try to rename to an existing draft app name + err := RenameLocalApp("testapp", "existingapp") + if err == nil { + t.Fatal("expected error when renaming to existing draft app, got nil") + } + + expectedMsg := "already exists" + if err.Error() == "" || len(err.Error()) < len(expectedMsg) { + t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) + } + + // Verify both apps still exist unchanged + if !appExists(t, "local/testapp") { + t.Error("original app should still exist") + } + if !appExists(t, "draft/existingapp") { + t.Error("existing draft app should still exist") + } +} + +func TestRenameLocalApp_PreserveFileContents(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Create a local app with specific content + appId := "local/testapp" + createTestApp(t, appId) + + // Write additional content + err := WriteAppFile(appId, "config.json", []byte(`{"key": "value"}`)) + if err != nil { + t.Fatalf("failed to write config file: %v", err) + } + + // Rename the app + err = RenameLocalApp("testapp", "renamedapp") + if err != nil { + t.Fatalf("RenameLocalApp failed: %v", err) + } + + // Verify the file contents are preserved + newAppId := "local/renamedapp" + fileData, err := ReadAppFile(newAppId, "config.json") + if err != nil { + t.Fatalf("failed to read config file from renamed app: %v", err) + } + + expectedContent := `{"key": "value"}` + if string(fileData.Contents) != expectedContent { + t.Errorf("file contents not preserved, expected %q, got %q", expectedContent, string(fileData.Contents)) + } +} + +func TestRenameLocalApp_EmptyAppName(t *testing.T) { + _, cleanup := setupTestDir(t) + defer cleanup() + + // Try to rename with empty old app name + err := RenameLocalApp("", "newname") + if err == nil { + t.Fatal("expected error with empty old app name, got nil") + } + + // Try to rename with empty new app name + createTestApp(t, "local/testapp") + err = RenameLocalApp("testapp", "") + if err == nil { + t.Fatal("expected error with empty new app name, got nil") + } +} From f753330e56c29fabace20388368ff03973bbb4a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 8 Nov 2025 02:43:42 +0000 Subject: [PATCH 3/5] Add documentation comment for RenameLocalApp function Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> --- go.mod | 1 - go.sum | 2 -- pkg/waveappstore/waveappstore.go | 5 +++++ tsunami/demo/cpuchart/go.mod | 7 +------ tsunami/demo/cpuchart/go.sum | 12 ------------ tsunami/demo/githubaction/go.mod | 7 ------- tsunami/demo/githubaction/go.sum | 4 ---- tsunami/demo/modaltest/go.mod | 7 ------- tsunami/demo/modaltest/go.sum | 4 ---- tsunami/demo/pomodoro/go.mod | 7 ------- tsunami/demo/pomodoro/go.sum | 4 ---- tsunami/demo/recharts/go.mod | 7 ------- tsunami/demo/recharts/go.sum | 4 ---- tsunami/demo/tabletest/go.mod | 7 ------- tsunami/demo/tabletest/go.sum | 4 ---- tsunami/demo/todo/go.mod | 7 ------- tsunami/demo/todo/go.sum | 4 ---- tsunami/demo/tsunamiconfig/go.mod | 7 ------- tsunami/demo/tsunamiconfig/go.sum | 4 ---- 19 files changed, 6 insertions(+), 98 deletions(-) diff --git a/go.mod b/go.mod index fcdf425d16..4397f4ec73 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,6 @@ require ( github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/outrigdev/goid v0.3.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sirupsen/logrus v1.9.3 // indirect diff --git a/go.sum b/go.sum index c86bf5c664..8698d75056 100644 --- a/go.sum +++ b/go.sum @@ -144,8 +144,6 @@ github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuE github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= github.com/photostorm/pty v1.1.19-0.20230903182454-31354506054b h1:cLGKfKb1uk0hxI0Q8L83UAJPpeJ+gSpn3cCU/tjd3eg= github.com/photostorm/pty v1.1.19-0.20230903182454-31354506054b/go.mod h1:KO+FcPtyLAiRC0hJwreJVvfwc7vnNz77UxBTIGHdPVk= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= diff --git a/pkg/waveappstore/waveappstore.go b/pkg/waveappstore/waveappstore.go index 9ae57be7b1..a4ab7f1176 100644 --- a/pkg/waveappstore/waveappstore.go +++ b/pkg/waveappstore/waveappstore.go @@ -521,6 +521,11 @@ func DraftHasLocalVersion(draftAppId string) (bool, error) { return true, nil } +// RenameLocalApp renames a local app by renaming its directories in both the local and draft namespaces. +// It takes the current app name and the new app name (without namespace prefixes). +// Both local/[appName] and draft/[appName] will be renamed if they exist. +// Returns an error if the app doesn't exist in either namespace, if the new name is invalid, +// or if the new name conflicts with an existing app. func RenameLocalApp(appName string, newAppName string) error { // Validate the old app name by constructing a valid appId oldLocalAppId := MakeAppId(AppNSLocal, appName) diff --git a/tsunami/demo/cpuchart/go.mod b/tsunami/demo/cpuchart/go.mod index 0140d12180..864522e4e6 100644 --- a/tsunami/demo/cpuchart/go.mod +++ b/tsunami/demo/cpuchart/go.mod @@ -2,17 +2,12 @@ module tsunami/app/cpuchart go 1.24.6 -require ( - github.com/shirou/gopsutil/v4 v4.25.8 - github.com/wavetermdev/waveterm/tsunami v0.0.0 -) +require github.com/shirou/gopsutil/v4 v4.25.8 require ( github.com/ebitengine/purego v0.8.4 // indirect github.com/go-ole/go-ole v1.2.6 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect diff --git a/tsunami/demo/cpuchart/go.sum b/tsunami/demo/cpuchart/go.sum index 4d3c872cfc..965d0ed1e9 100644 --- a/tsunami/demo/cpuchart/go.sum +++ b/tsunami/demo/cpuchart/go.sum @@ -1,26 +1,16 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970= github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= -github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= @@ -32,5 +22,3 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tsunami/demo/githubaction/go.mod b/tsunami/demo/githubaction/go.mod index cf51505f61..7ba875a5ab 100644 --- a/tsunami/demo/githubaction/go.mod +++ b/tsunami/demo/githubaction/go.mod @@ -2,11 +2,4 @@ module tsunami/app/githubaction go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/githubaction/go.sum b/tsunami/demo/githubaction/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/githubaction/go.sum +++ b/tsunami/demo/githubaction/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/modaltest/go.mod b/tsunami/demo/modaltest/go.mod index a2c875ebf0..cf35e88303 100644 --- a/tsunami/demo/modaltest/go.mod +++ b/tsunami/demo/modaltest/go.mod @@ -2,11 +2,4 @@ module github.com/wavetermdev/waveterm/tsunami/demo/modaltest go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0-00010101000000-000000000000 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/modaltest/go.sum b/tsunami/demo/modaltest/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/modaltest/go.sum +++ b/tsunami/demo/modaltest/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/pomodoro/go.mod b/tsunami/demo/pomodoro/go.mod index 9e5e8362d4..bf8b7c0096 100644 --- a/tsunami/demo/pomodoro/go.mod +++ b/tsunami/demo/pomodoro/go.mod @@ -2,11 +2,4 @@ module tsunami/app/pomodoro go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/pomodoro/go.sum b/tsunami/demo/pomodoro/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/pomodoro/go.sum +++ b/tsunami/demo/pomodoro/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/recharts/go.mod b/tsunami/demo/recharts/go.mod index dfe7fef813..9d2536376d 100644 --- a/tsunami/demo/recharts/go.mod +++ b/tsunami/demo/recharts/go.mod @@ -2,11 +2,4 @@ module tsunami/app/recharts go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/recharts/go.sum b/tsunami/demo/recharts/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/recharts/go.sum +++ b/tsunami/demo/recharts/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/tabletest/go.mod b/tsunami/demo/tabletest/go.mod index 86b7209a5a..6f2d6aad21 100644 --- a/tsunami/demo/tabletest/go.mod +++ b/tsunami/demo/tabletest/go.mod @@ -2,11 +2,4 @@ module tsunami/app/tabletest go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/tabletest/go.sum b/tsunami/demo/tabletest/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/tabletest/go.sum +++ b/tsunami/demo/tabletest/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/todo/go.mod b/tsunami/demo/todo/go.mod index f82b52b1cc..f5b6f93578 100644 --- a/tsunami/demo/todo/go.mod +++ b/tsunami/demo/todo/go.mod @@ -2,11 +2,4 @@ module tsunami/app/todo go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/todo/go.sum b/tsunami/demo/todo/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/todo/go.sum +++ b/tsunami/demo/todo/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/tsunamiconfig/go.mod b/tsunami/demo/tsunamiconfig/go.mod index 165622f27a..6c3f08b497 100644 --- a/tsunami/demo/tsunamiconfig/go.mod +++ b/tsunami/demo/tsunamiconfig/go.mod @@ -2,11 +2,4 @@ module tsunami/app/tsunamiconfig go 1.24.6 -require github.com/wavetermdev/waveterm/tsunami v0.0.0 - -require ( - github.com/google/uuid v1.6.0 // indirect - github.com/outrigdev/goid v0.3.0 // indirect -) - replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/tsunamiconfig/go.sum b/tsunami/demo/tsunamiconfig/go.sum index 4c44991dfc..e69de29bb2 100644 --- a/tsunami/demo/tsunamiconfig/go.sum +++ b/tsunami/demo/tsunamiconfig/go.sum @@ -1,4 +0,0 @@ -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= -github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= From 3dc2b48e4f91662657b337c0878f5dbea19ce4b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 10 Nov 2025 21:16:09 +0000 Subject: [PATCH 4/5] Revert go.mod and go.sum changes for tsunami demos Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> --- go.mod | 1 + go.sum | 2 ++ tsunami/demo/cpuchart/go.mod | 7 ++++++- tsunami/demo/cpuchart/go.sum | 12 ++++++++++++ tsunami/demo/githubaction/go.mod | 7 +++++++ tsunami/demo/githubaction/go.sum | 4 ++++ tsunami/demo/modaltest/go.mod | 7 +++++++ tsunami/demo/modaltest/go.sum | 4 ++++ tsunami/demo/pomodoro/go.mod | 7 +++++++ tsunami/demo/pomodoro/go.sum | 4 ++++ tsunami/demo/recharts/go.mod | 7 +++++++ tsunami/demo/recharts/go.sum | 4 ++++ tsunami/demo/tabletest/go.mod | 7 +++++++ tsunami/demo/tabletest/go.sum | 4 ++++ tsunami/demo/todo/go.mod | 7 +++++++ tsunami/demo/todo/go.sum | 4 ++++ tsunami/demo/tsunamiconfig/go.mod | 7 +++++++ tsunami/demo/tsunamiconfig/go.sum | 4 ++++ 18 files changed, 98 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 4397f4ec73..fcdf425d16 100644 --- a/go.mod +++ b/go.mod @@ -80,6 +80,7 @@ require ( github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/outrigdev/goid v0.3.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sirupsen/logrus v1.9.3 // indirect diff --git a/go.sum b/go.sum index 8698d75056..c86bf5c664 100644 --- a/go.sum +++ b/go.sum @@ -144,6 +144,8 @@ github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuE github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= github.com/photostorm/pty v1.1.19-0.20230903182454-31354506054b h1:cLGKfKb1uk0hxI0Q8L83UAJPpeJ+gSpn3cCU/tjd3eg= github.com/photostorm/pty v1.1.19-0.20230903182454-31354506054b/go.mod h1:KO+FcPtyLAiRC0hJwreJVvfwc7vnNz77UxBTIGHdPVk= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= diff --git a/tsunami/demo/cpuchart/go.mod b/tsunami/demo/cpuchart/go.mod index 864522e4e6..0140d12180 100644 --- a/tsunami/demo/cpuchart/go.mod +++ b/tsunami/demo/cpuchart/go.mod @@ -2,12 +2,17 @@ module tsunami/app/cpuchart go 1.24.6 -require github.com/shirou/gopsutil/v4 v4.25.8 +require ( + github.com/shirou/gopsutil/v4 v4.25.8 + github.com/wavetermdev/waveterm/tsunami v0.0.0 +) require ( github.com/ebitengine/purego v0.8.4 // indirect github.com/go-ole/go-ole v1.2.6 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect diff --git a/tsunami/demo/cpuchart/go.sum b/tsunami/demo/cpuchart/go.sum index 965d0ed1e9..4d3c872cfc 100644 --- a/tsunami/demo/cpuchart/go.sum +++ b/tsunami/demo/cpuchart/go.sum @@ -1,16 +1,26 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970= github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= @@ -22,3 +32,5 @@ golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tsunami/demo/githubaction/go.mod b/tsunami/demo/githubaction/go.mod index 7ba875a5ab..cf51505f61 100644 --- a/tsunami/demo/githubaction/go.mod +++ b/tsunami/demo/githubaction/go.mod @@ -2,4 +2,11 @@ module tsunami/app/githubaction go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/githubaction/go.sum b/tsunami/demo/githubaction/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/githubaction/go.sum +++ b/tsunami/demo/githubaction/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/modaltest/go.mod b/tsunami/demo/modaltest/go.mod index cf35e88303..a2c875ebf0 100644 --- a/tsunami/demo/modaltest/go.mod +++ b/tsunami/demo/modaltest/go.mod @@ -2,4 +2,11 @@ module github.com/wavetermdev/waveterm/tsunami/demo/modaltest go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0-00010101000000-000000000000 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/modaltest/go.sum b/tsunami/demo/modaltest/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/modaltest/go.sum +++ b/tsunami/demo/modaltest/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/pomodoro/go.mod b/tsunami/demo/pomodoro/go.mod index bf8b7c0096..9e5e8362d4 100644 --- a/tsunami/demo/pomodoro/go.mod +++ b/tsunami/demo/pomodoro/go.mod @@ -2,4 +2,11 @@ module tsunami/app/pomodoro go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/pomodoro/go.sum b/tsunami/demo/pomodoro/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/pomodoro/go.sum +++ b/tsunami/demo/pomodoro/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/recharts/go.mod b/tsunami/demo/recharts/go.mod index 9d2536376d..dfe7fef813 100644 --- a/tsunami/demo/recharts/go.mod +++ b/tsunami/demo/recharts/go.mod @@ -2,4 +2,11 @@ module tsunami/app/recharts go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/recharts/go.sum b/tsunami/demo/recharts/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/recharts/go.sum +++ b/tsunami/demo/recharts/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/tabletest/go.mod b/tsunami/demo/tabletest/go.mod index 6f2d6aad21..86b7209a5a 100644 --- a/tsunami/demo/tabletest/go.mod +++ b/tsunami/demo/tabletest/go.mod @@ -2,4 +2,11 @@ module tsunami/app/tabletest go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/tabletest/go.sum b/tsunami/demo/tabletest/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/tabletest/go.sum +++ b/tsunami/demo/tabletest/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/todo/go.mod b/tsunami/demo/todo/go.mod index f5b6f93578..f82b52b1cc 100644 --- a/tsunami/demo/todo/go.mod +++ b/tsunami/demo/todo/go.mod @@ -2,4 +2,11 @@ module tsunami/app/todo go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/todo/go.sum b/tsunami/demo/todo/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/todo/go.sum +++ b/tsunami/demo/todo/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= diff --git a/tsunami/demo/tsunamiconfig/go.mod b/tsunami/demo/tsunamiconfig/go.mod index 6c3f08b497..165622f27a 100644 --- a/tsunami/demo/tsunamiconfig/go.mod +++ b/tsunami/demo/tsunamiconfig/go.mod @@ -2,4 +2,11 @@ module tsunami/app/tsunamiconfig go 1.24.6 +require github.com/wavetermdev/waveterm/tsunami v0.0.0 + +require ( + github.com/google/uuid v1.6.0 // indirect + github.com/outrigdev/goid v0.3.0 // indirect +) + replace github.com/wavetermdev/waveterm/tsunami => /Users/mike/work/waveterm/tsunami diff --git a/tsunami/demo/tsunamiconfig/go.sum b/tsunami/demo/tsunamiconfig/go.sum index e69de29bb2..4c44991dfc 100644 --- a/tsunami/demo/tsunamiconfig/go.sum +++ b/tsunami/demo/tsunamiconfig/go.sum @@ -0,0 +1,4 @@ +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/outrigdev/goid v0.3.0 h1:t/otQD3EXc45cLtQVPUnNgEyRaTQA4cPeu3qVcrsIws= +github.com/outrigdev/goid v0.3.0/go.mod h1:hEH7f27ypN/GHWt/7gvkRoFYR0LZizfUBIAbak4neVE= From 814d0fc46c61d35029023312bbc15be9c0585671 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 00:39:49 +0000 Subject: [PATCH 5/5] Remove test file for RenameLocalApp function Co-authored-by: sawka <2722291+sawka@users.noreply.github.com> --- pkg/waveappstore/waveappstore_test.go | 320 -------------------------- 1 file changed, 320 deletions(-) delete mode 100644 pkg/waveappstore/waveappstore_test.go diff --git a/pkg/waveappstore/waveappstore_test.go b/pkg/waveappstore/waveappstore_test.go deleted file mode 100644 index 4791f79f56..0000000000 --- a/pkg/waveappstore/waveappstore_test.go +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2025, Command Line Inc. -// SPDX-License-Identifier: Apache-2.0 - -package waveappstore - -import ( - "os" - "path/filepath" - "testing" -) - -// setupTestDir creates a temporary test directory and sets it as the home directory -func setupTestDir(t *testing.T) (string, func()) { - t.Helper() - - // Create a temporary directory for testing - tmpDir, err := os.MkdirTemp("", "waveappstore-test-*") - if err != nil { - t.Fatalf("failed to create temp dir: %v", err) - } - - // Save the original HOME environment variable - originalHome := os.Getenv("HOME") - - // Set the test directory as the home directory - os.Setenv("HOME", tmpDir) - - // Return cleanup function - cleanup := func() { - os.RemoveAll(tmpDir) - // Restore original home directory - if originalHome != "" { - os.Setenv("HOME", originalHome) - } else { - os.Unsetenv("HOME") - } - } - - return tmpDir, cleanup -} - -// createTestApp creates a test app with a simple file -func createTestApp(t *testing.T, appId string) { - t.Helper() - - appDir, err := GetAppDir(appId) - if err != nil { - t.Fatalf("failed to get app dir: %v", err) - } - - if err := os.MkdirAll(appDir, 0755); err != nil { - t.Fatalf("failed to create app dir: %v", err) - } - - testFile := filepath.Join(appDir, "test.txt") - if err := os.WriteFile(testFile, []byte("test content"), 0644); err != nil { - t.Fatalf("failed to write test file: %v", err) - } -} - -// appExists checks if an app directory exists -func appExists(t *testing.T, appId string) bool { - t.Helper() - - appDir, err := GetAppDir(appId) - if err != nil { - t.Fatalf("failed to get app dir: %v", err) - } - - _, err = os.Stat(appDir) - return err == nil -} - -func TestRenameLocalApp_LocalOnly(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create a local app - createTestApp(t, "local/testapp") - - // Rename the app - err := RenameLocalApp("testapp", "renamedapp") - if err != nil { - t.Fatalf("RenameLocalApp failed: %v", err) - } - - // Verify old app is gone - if appExists(t, "local/testapp") { - t.Error("old local app still exists") - } - - // Verify new app exists - if !appExists(t, "local/renamedapp") { - t.Error("new local app does not exist") - } - - // Verify draft app does not exist - if appExists(t, "draft/testapp") { - t.Error("old draft app should not exist") - } - if appExists(t, "draft/renamedapp") { - t.Error("new draft app should not exist") - } -} - -func TestRenameLocalApp_DraftOnly(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create a draft app - createTestApp(t, "draft/testapp") - - // Rename the app - err := RenameLocalApp("testapp", "renamedapp") - if err != nil { - t.Fatalf("RenameLocalApp failed: %v", err) - } - - // Verify old draft app is gone - if appExists(t, "draft/testapp") { - t.Error("old draft app still exists") - } - - // Verify new draft app exists - if !appExists(t, "draft/renamedapp") { - t.Error("new draft app does not exist") - } - - // Verify local app does not exist - if appExists(t, "local/testapp") { - t.Error("old local app should not exist") - } - if appExists(t, "local/renamedapp") { - t.Error("new local app should not exist") - } -} - -func TestRenameLocalApp_BothLocalAndDraft(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create both local and draft apps - createTestApp(t, "local/testapp") - createTestApp(t, "draft/testapp") - - // Rename the app - err := RenameLocalApp("testapp", "renamedapp") - if err != nil { - t.Fatalf("RenameLocalApp failed: %v", err) - } - - // Verify old apps are gone - if appExists(t, "local/testapp") { - t.Error("old local app still exists") - } - if appExists(t, "draft/testapp") { - t.Error("old draft app still exists") - } - - // Verify new apps exist - if !appExists(t, "local/renamedapp") { - t.Error("new local app does not exist") - } - if !appExists(t, "draft/renamedapp") { - t.Error("new draft app does not exist") - } -} - -func TestRenameLocalApp_NonExistentApp(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Try to rename an app that doesn't exist - err := RenameLocalApp("nonexistent", "newname") - if err == nil { - t.Fatal("expected error when renaming non-existent app, got nil") - } - - expectedMsg := "does not exist" - if err.Error() == "" || len(err.Error()) < len(expectedMsg) { - t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) - } -} - -func TestRenameLocalApp_InvalidOldName(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Try to rename with invalid old app name - err := RenameLocalApp("invalid name with spaces", "newname") - if err == nil { - t.Fatal("expected error with invalid old app name, got nil") - } -} - -func TestRenameLocalApp_InvalidNewName(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create a local app - createTestApp(t, "local/testapp") - - // Try to rename with invalid new app name - err := RenameLocalApp("testapp", "invalid name with spaces") - if err == nil { - t.Fatal("expected error with invalid new app name, got nil") - } - - // Verify original app still exists - if !appExists(t, "local/testapp") { - t.Error("original app should still exist after failed rename") - } -} - -func TestRenameLocalApp_ConflictWithExistingLocal(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create two local apps - createTestApp(t, "local/testapp") - createTestApp(t, "local/existingapp") - - // Try to rename to an existing app name - err := RenameLocalApp("testapp", "existingapp") - if err == nil { - t.Fatal("expected error when renaming to existing app, got nil") - } - - expectedMsg := "already exists" - if err.Error() == "" || len(err.Error()) < len(expectedMsg) { - t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) - } - - // Verify both apps still exist unchanged - if !appExists(t, "local/testapp") { - t.Error("original app should still exist") - } - if !appExists(t, "local/existingapp") { - t.Error("existing app should still exist") - } -} - -func TestRenameLocalApp_ConflictWithExistingDraft(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create a local app and a draft app with different names - createTestApp(t, "local/testapp") - createTestApp(t, "draft/existingapp") - - // Try to rename to an existing draft app name - err := RenameLocalApp("testapp", "existingapp") - if err == nil { - t.Fatal("expected error when renaming to existing draft app, got nil") - } - - expectedMsg := "already exists" - if err.Error() == "" || len(err.Error()) < len(expectedMsg) { - t.Errorf("expected error message containing '%s', got: %v", expectedMsg, err) - } - - // Verify both apps still exist unchanged - if !appExists(t, "local/testapp") { - t.Error("original app should still exist") - } - if !appExists(t, "draft/existingapp") { - t.Error("existing draft app should still exist") - } -} - -func TestRenameLocalApp_PreserveFileContents(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Create a local app with specific content - appId := "local/testapp" - createTestApp(t, appId) - - // Write additional content - err := WriteAppFile(appId, "config.json", []byte(`{"key": "value"}`)) - if err != nil { - t.Fatalf("failed to write config file: %v", err) - } - - // Rename the app - err = RenameLocalApp("testapp", "renamedapp") - if err != nil { - t.Fatalf("RenameLocalApp failed: %v", err) - } - - // Verify the file contents are preserved - newAppId := "local/renamedapp" - fileData, err := ReadAppFile(newAppId, "config.json") - if err != nil { - t.Fatalf("failed to read config file from renamed app: %v", err) - } - - expectedContent := `{"key": "value"}` - if string(fileData.Contents) != expectedContent { - t.Errorf("file contents not preserved, expected %q, got %q", expectedContent, string(fileData.Contents)) - } -} - -func TestRenameLocalApp_EmptyAppName(t *testing.T) { - _, cleanup := setupTestDir(t) - defer cleanup() - - // Try to rename with empty old app name - err := RenameLocalApp("", "newname") - if err == nil { - t.Fatal("expected error with empty old app name, got nil") - } - - // Try to rename with empty new app name - createTestApp(t, "local/testapp") - err = RenameLocalApp("testapp", "") - if err == nil { - t.Fatal("expected error with empty new app name, got nil") - } -}