command-stream 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/$.mjs +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "command-stream",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Modern $ shell utility library with streaming, async iteration, and EventEmitter support, optimized for Bun runtime",
5
5
  "type": "module",
6
6
  "main": "src/$.mjs",
package/src/$.mjs CHANGED
@@ -766,6 +766,20 @@ function buildShellCommand(strings, values) {
766
766
  valuesLength: values.length
767
767
  }, null, 2)}`);
768
768
 
769
+ // Special case: if we have a single value with empty surrounding strings,
770
+ // and the value looks like a complete shell command, treat it as raw
771
+ if (values.length === 1 && strings.length === 2 &&
772
+ strings[0] === '' && strings[1] === '' &&
773
+ typeof values[0] === 'string') {
774
+ const commandStr = values[0];
775
+ // Check if this looks like a complete shell command (contains spaces and shell-safe characters)
776
+ const commandPattern = /^[a-zA-Z0-9_\-./=,+@:\s"'`$(){}<>|&;*?[\]~\\]+$/;
777
+ if (commandPattern.test(commandStr) && commandStr.trim().length > 0) {
778
+ trace('Utils', () => `BRANCH: buildShellCommand => COMPLETE_COMMAND | ${JSON.stringify({ command: commandStr }, null, 2)}`);
779
+ return commandStr;
780
+ }
781
+ }
782
+
769
783
  let out = '';
770
784
  for (let i = 0; i < strings.length; i++) {
771
785
  out += strings[i];