@co0ontty/wand 4.37.0 → 4.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
3
|
-
"builtAt": "2026-08-
|
|
4
|
-
"version": "4.
|
|
2
|
+
"commit": "c2cb25ff02d2e249d43d4559cf48390275040221",
|
|
3
|
+
"builtAt": "2026-08-08T01:49:50.381Z",
|
|
4
|
+
"version": "4.38.0",
|
|
5
5
|
"channel": "stable"
|
|
6
6
|
}
|
package/dist/pty-shell-launch.js
CHANGED
|
@@ -10,6 +10,36 @@ function quotePosixShell(value) {
|
|
|
10
10
|
function isKnownPosixShell(shell) {
|
|
11
11
|
return POSIX_SHELLS.has(path.basename(shell).toLowerCase());
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Commands passed through `shell -c` bypass the interactive line editor, so
|
|
15
|
+
* zsh/bash do not add them to history automatically. Register only the actual
|
|
16
|
+
* provider command (never Wand's marker wrapper) before launching the CLI.
|
|
17
|
+
*
|
|
18
|
+
* Both implementations append instead of rewriting the history file. zsh's
|
|
19
|
+
* incremental append is skipped when the user's history-sharing option already
|
|
20
|
+
* persisted `print -s`, avoiding duplicate entries.
|
|
21
|
+
*/
|
|
22
|
+
function buildShellHistoryRegistration(command, shell) {
|
|
23
|
+
const quotedCommand = quotePosixShell(command);
|
|
24
|
+
switch (path.basename(shell).toLowerCase()) {
|
|
25
|
+
case "zsh":
|
|
26
|
+
return [
|
|
27
|
+
`print -s -- ${quotedCommand} 2>/dev/null || :`,
|
|
28
|
+
"if [[ -n ${HISTFILE-} && ${SAVEHIST:-0} -gt 0 ]] "
|
|
29
|
+
+ "&& [[ ! -o SHARE_HISTORY && ! -o INC_APPEND_HISTORY && ! -o INC_APPEND_HISTORY_TIME ]]; "
|
|
30
|
+
+ "then fc -AI \"$HISTFILE\" 2>/dev/null || :; fi",
|
|
31
|
+
];
|
|
32
|
+
case "bash":
|
|
33
|
+
return [
|
|
34
|
+
`history -s ${quotedCommand} 2>/dev/null || :`,
|
|
35
|
+
"history -a 2>/dev/null || :",
|
|
36
|
+
];
|
|
37
|
+
default:
|
|
38
|
+
// Other POSIX shells do not share a portable, non-destructive API for
|
|
39
|
+
// inserting and incrementally persisting a history entry.
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
13
43
|
function longestMarkerPrefixSuffix(value, markerPrefix) {
|
|
14
44
|
const maxLength = Math.min(value.length, markerPrefix.length - 1);
|
|
15
45
|
for (let length = maxLength; length > 0; length -= 1) {
|
|
@@ -68,6 +98,7 @@ function buildPosixProviderShellCommand(command, shell, marker) {
|
|
|
68
98
|
// Running the CLI as an `if` condition also prevents a user-set `errexit`
|
|
69
99
|
// option from skipping the marker and fallback shell after a non-zero exit.
|
|
70
100
|
return [
|
|
101
|
+
...buildShellHistoryRegistration(command, shell),
|
|
71
102
|
"trap ':' INT",
|
|
72
103
|
`if ${command}; then __wand_cli_status=0; else __wand_cli_status=$?; fi`,
|
|
73
104
|
`printf '\\036WAND_CLI_EXIT:${marker.token}:%s\\037' "$__wand_cli_status"`,
|