From 5148511d3bdeb289027eca9271d4503d81135c38 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 24 Nov 2025 21:02:27 -0800 Subject: [PATCH 1/2] add an "add" button when there are no secrets, also add `wsh secret ui` cli command --- cmd/wsh/cmd/wshcmd-secret.go | 32 +++++++++++++++++++ docs/docs/wsh-reference.mdx | 17 ++++++++++ frontend/app/view/secretstore/secretstore.tsx | 13 ++++++-- 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/cmd/wsh/cmd/wshcmd-secret.go b/cmd/wsh/cmd/wshcmd-secret.go index bce1d0beb9..71f56885f0 100644 --- a/cmd/wsh/cmd/wshcmd-secret.go +++ b/cmd/wsh/cmd/wshcmd-secret.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/spf13/cobra" + "github.com/wavetermdev/waveterm/pkg/waveobj" "github.com/wavetermdev/waveterm/pkg/wshrpc" "github.com/wavetermdev/waveterm/pkg/wshrpc/wshclient" ) @@ -54,12 +55,21 @@ var secretDeleteCmd = &cobra.Command{ PreRunE: preRunSetupRpcClient, } +var secretUiCmd = &cobra.Command{ + Use: "ui", + Short: "open secrets UI", + Args: cobra.NoArgs, + RunE: secretUiRun, + PreRunE: preRunSetupRpcClient, +} + func init() { rootCmd.AddCommand(secretCmd) secretCmd.AddCommand(secretGetCmd) secretCmd.AddCommand(secretSetCmd) secretCmd.AddCommand(secretListCmd) secretCmd.AddCommand(secretDeleteCmd) + secretCmd.AddCommand(secretUiCmd) } func secretGetRun(cmd *cobra.Command, args []string) (rtnErr error) { @@ -156,4 +166,26 @@ func secretDeleteRun(cmd *cobra.Command, args []string) (rtnErr error) { WriteStdout("secret deleted: %s\n", name) return nil +} + +func secretUiRun(cmd *cobra.Command, args []string) (rtnErr error) { + defer func() { + sendActivity("secret", rtnErr == nil) + }() + + wshCmd := &wshrpc.CommandCreateBlockData{ + BlockDef: &waveobj.BlockDef{ + Meta: map[string]interface{}{ + waveobj.MetaKey_View: "secretstore", + }, + }, + Magnified: false, + Focused: true, + } + + _, err := RpcClient.SendRpcRequest(wshrpc.Command_CreateBlock, wshCmd, &wshrpc.RpcOpts{Timeout: 2000}) + if err != nil { + return fmt.Errorf("opening secrets UI: %w", err) + } + return nil } \ No newline at end of file diff --git a/docs/docs/wsh-reference.mdx b/docs/docs/wsh-reference.mdx index a6006010d0..7a10f70d01 100644 --- a/docs/docs/wsh-reference.mdx +++ b/docs/docs/wsh-reference.mdx @@ -978,6 +978,23 @@ wsh secret delete old_api_key wsh secret delete temp_token ``` +### ui + +```sh +wsh secret ui +``` + +Open the secrets management interface in a new block. This provides a graphical interface for viewing and managing all your secrets. + +Example: + +```sh +# Open the secrets UI +wsh secret ui +``` + +The secrets UI provides a convenient visual way to browse, add, edit, and delete secrets without needing to use the command-line interface. + :::tip Use secrets in your scripts to avoid hardcoding sensitive values. Secrets work across remote machines - store an API key locally with `wsh secret set`, then access it from any SSH or WSL connection with `wsh secret get`. The secret is securely retrieved from your local machine without needing to duplicate it on remote systems. ::: diff --git a/frontend/app/view/secretstore/secretstore.tsx b/frontend/app/view/secretstore/secretstore.tsx index d695522ea3..83e32a14fe 100644 --- a/frontend/app/view/secretstore/secretstore.tsx +++ b/frontend/app/view/secretstore/secretstore.tsx @@ -38,12 +38,19 @@ const LoadingSpinner = memo(({ message }: { message: string }) => { }); LoadingSpinner.displayName = "LoadingSpinner"; -const EmptyState = memo(() => { +const EmptyState = memo(({ onAddSecret }: { onAddSecret: () => void }) => { return ( -
+

No Secrets

Add a secret to get started

+
); }); @@ -352,7 +359,7 @@ export const SecretStoreView = memo(({ model }: { blockId: string; model: Secret } if (secretNames.length === 0) { - return ; + return model.startAddingSecret()} />; } return ( From 48338f3530c5bc273750c84cdcf33dc148101058 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 24 Nov 2025 21:08:39 -0800 Subject: [PATCH 2/2] add -m flag for `wsh secret ui` and document -m and -r flags for wsh web open --- cmd/wsh/cmd/wshcmd-secret.go | 5 ++++- docs/docs/wsh-reference.mdx | 38 +++++++++++++++++++++++++++++------- package-lock.json | 4 ++-- 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/cmd/wsh/cmd/wshcmd-secret.go b/cmd/wsh/cmd/wshcmd-secret.go index 71f56885f0..cfd8daf407 100644 --- a/cmd/wsh/cmd/wshcmd-secret.go +++ b/cmd/wsh/cmd/wshcmd-secret.go @@ -17,6 +17,8 @@ import ( // secretNameRegex must match the validation in pkg/wconfig/secretstore.go var secretNameRegex = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9_]*$`) +var secretUiMagnified bool + var secretCmd = &cobra.Command{ Use: "secret", Short: "manage secrets", @@ -64,6 +66,7 @@ var secretUiCmd = &cobra.Command{ } func init() { + secretUiCmd.Flags().BoolVarP(&secretUiMagnified, "magnified", "m", false, "open secrets UI in magnified mode") rootCmd.AddCommand(secretCmd) secretCmd.AddCommand(secretGetCmd) secretCmd.AddCommand(secretSetCmd) @@ -179,7 +182,7 @@ func secretUiRun(cmd *cobra.Command, args []string) (rtnErr error) { waveobj.MetaKey_View: "secretstore", }, }, - Magnified: false, + Magnified: secretUiMagnified, Focused: true, } diff --git a/docs/docs/wsh-reference.mdx b/docs/docs/wsh-reference.mdx index 7a10f70d01..b9df30f31d 100644 --- a/docs/docs/wsh-reference.mdx +++ b/docs/docs/wsh-reference.mdx @@ -342,19 +342,36 @@ This will connect to a WSL distribution on the local machine. It will use the de ## web -You can search for a given url using: +The `web` command opens URLs in a web block within Wave Terminal. ```sh -wsh web open [url] +wsh web open [url] [-m] [-r blockid] ``` -Alternatively, you can search with the configured search engine using: +You can open a specific URL or perform a search using the configured search engine. + +Flags: + +- `-m, --magnified` - open the web block in magnified mode +- `-r, --replace ` - replace an existing block instead of creating a new one + +Examples: ```sh -wsh web open [search-query] +# Open a URL +wsh web open https://waveterm.dev + +# Search with the configured search engine +wsh web open "wave terminal documentation" + +# Open in magnified mode +wsh web open -m https://github.com + +# Replace an existing block +wsh web open -r 2 https://example.com ``` -Both of these commands will open a new web block with the desired page. +The command will open a new web block with the desired page, or replace an existing block if the `-r` flag is used. Note that `--replace` and `--magnified` cannot be used together. --- @@ -981,16 +998,23 @@ wsh secret delete temp_token ### ui ```sh -wsh secret ui +wsh secret ui [-m] ``` Open the secrets management interface in a new block. This provides a graphical interface for viewing and managing all your secrets. -Example: +Flags: + +- `-m, --magnified` - open the secrets UI in magnified mode + +Examples: ```sh # Open the secrets UI wsh secret ui + +# Open the secrets UI in magnified mode +wsh secret ui -m ``` The secrets UI provides a convenient visual way to browse, add, edit, and delete secrets without needing to use the command-line interface. diff --git a/package-lock.json b/package-lock.json index b770d276d0..30e4dcf00a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "waveterm", - "version": "0.12.4", + "version": "0.12.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "waveterm", - "version": "0.12.4", + "version": "0.12.5", "hasInstallScript": true, "license": "Apache-2.0", "workspaces": [