-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add swap token exchange for Wave Terminal v0.14.0+ #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
94c016f
604620a
a5a57fb
bb9279f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 1.0.0 | ||
| 2.0.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| #!/bin/bash | ||
| # wave-notes-setup v1.0.0 | ||
| # wave-notes-setup v2.0.1 | ||
| # Configure Wave Terminal with a Warp-like notes system | ||
| # https://github.com/qbandev/wave-notes-setup | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| VERSION="1.0.0" | ||
| VERSION="2.0.1" # x-release-please-version | ||
| SCRIPT_NAME="wave-notes-setup" | ||
|
|
||
| # Colors | ||
|
|
@@ -316,7 +316,7 @@ install_scratchpad_script() { | |
| # Generate the script with injected paths | ||
| cat > "$script_path" << 'SCRIPT_EOF' | ||
| #!/bin/bash | ||
| # Generated by wave-notes-setup v1.0.0 | ||
| # Generated by wave-notes-setup v2.0.1 | ||
| # Re-run wave-notes-setup to update paths | ||
|
|
||
| set -euo pipefail | ||
|
|
@@ -338,6 +338,8 @@ find_wsh() { | |
| return | ||
| fi | ||
| local paths=( | ||
| "$HOME/.config/waveterm/bin/wsh" | ||
| "$HOME/.waveterm/bin/wsh" | ||
| "$HOME/Library/Application Support/waveterm/bin/wsh" | ||
| "/usr/local/bin/wsh" | ||
| "/opt/homebrew/bin/wsh" | ||
|
|
@@ -353,13 +355,34 @@ find_wsh() { | |
|
|
||
| WSH_CMD=$(find_wsh) | ||
|
|
||
| if [[ -n "$WSH_CMD" ]]; then | ||
| "$WSH_CMD" edit "$FILEPATH" | ||
| else | ||
| if [[ -z "$WSH_CMD" ]]; then | ||
| echo "Error: 'wsh' command not found. Is Wave Terminal installed and running?" >&2 | ||
| echo "File created at: $FILEPATH" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Wave Terminal v0.14.0+ token exchange for cmd controller blocks. | ||
| # wsh token outputs shell code setting multiple env vars needed by wsh | ||
| # commands (not just WAVETERM_JWT), so eval is required here — matching | ||
| # Wave's own integration at ~/Library/Application Support/waveterm/shell/bash/.bashrc | ||
| if [[ -z "${WAVETERM_JWT:-}" && -n "${WAVETERM_SWAPTOKEN:-}" ]]; then | ||
| eval "$("$WSH_CMD" token "$WAVETERM_SWAPTOKEN" bash 2>/dev/null)" || true | ||
| fi | ||
|
|
||
| ERR_FILE=$(mktemp) | ||
| if ! "$WSH_CMD" edit "$FILEPATH" 2>"$ERR_FILE"; then | ||
| wsh_err=$(cat "$ERR_FILE" 2>/dev/null) | ||
| rm -f "$ERR_FILE" | ||
| if printf '%s\n' "$wsh_err" | grep -q "WAVETERM"; then | ||
| echo "Error: Wave Terminal authentication failed." >&2 | ||
| echo "Try: Re-run 'wave-notes-setup' to update configuration." >&2 | ||
| else | ||
| echo "Error: Failed to open editor: $wsh_err" >&2 | ||
| fi | ||
| echo "Note created at: $FILEPATH" >&2 | ||
| exit 1 | ||
| fi | ||
| rm -f "$ERR_FILE" | ||
|
Comment on lines
+372
to
+385
|
||
| SCRIPT_EOF | ||
|
|
||
| # Replace placeholder with actual path | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,16 @@ | |
| "package-name": "wave-notes-setup", | ||
| "changelog-path": "CHANGELOG.md", | ||
| "extra-files": [ | ||
| "VERSION", | ||
| { | ||
| "type": "generic", | ||
| "path": "install.sh", | ||
| "glob": false | ||
| }, | ||
| { | ||
| "type": "generic", | ||
| "path": "uninstall.sh", | ||
| "glob": false | ||
|
Qbandev marked this conversation as resolved.
|
||
| } | ||
|
Comment on lines
8
to
19
|
||
| ] | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.