command-stream 0.8.2 → 0.8.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "command-stream",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
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
@@ -12,14 +12,30 @@ import { parseShellCommand, needsRealShell } from './shell-parser.mjs';
12
12
 
13
13
  const isBun = typeof globalThis.Bun !== 'undefined';
14
14
 
15
- const VERBOSE =
16
- process.env.COMMAND_STREAM_VERBOSE === 'true' || process.env.CI === 'true';
17
-
18
15
  // Trace function for verbose logging
19
- function trace(category, messageOrFunc) {
16
+ // Can be controlled via COMMAND_STREAM_VERBOSE or COMMAND_STREAM_TRACE env vars
17
+ // Can be disabled per-command via trace: false option
18
+ // CI environment no longer auto-enables tracing
19
+ function trace(category, messageOrFunc, runner = null) {
20
+ // Check if runner explicitly disabled tracing
21
+ if (runner && runner.options && runner.options.trace === false) {
22
+ return;
23
+ }
24
+
25
+ // Check global trace setting (evaluated dynamically for runtime changes)
26
+ const TRACE_ENV = process.env.COMMAND_STREAM_TRACE;
27
+ const VERBOSE_ENV = process.env.COMMAND_STREAM_VERBOSE === 'true';
28
+
29
+ // COMMAND_STREAM_TRACE=false explicitly disables tracing even if COMMAND_STREAM_VERBOSE=true
30
+ // COMMAND_STREAM_TRACE=true explicitly enables tracing
31
+ // Otherwise, use COMMAND_STREAM_VERBOSE
32
+ const VERBOSE =
33
+ TRACE_ENV === 'false' ? false : TRACE_ENV === 'true' ? true : VERBOSE_ENV;
34
+
20
35
  if (!VERBOSE) {
21
36
  return;
22
37
  }
38
+
23
39
  const message =
24
40
  typeof messageOrFunc === 'function' ? messageOrFunc() : messageOrFunc;
25
41
  const timestamp = new Date().toISOString();
package/src/$.utils.mjs CHANGED
@@ -1,11 +1,23 @@
1
1
  import path from 'path';
2
2
 
3
- const VERBOSE = process.env.COMMAND_STREAM_VERBOSE === 'true';
4
-
3
+ // Trace function for verbose logging - consistent with src/$.mjs
4
+ // Can be controlled via COMMAND_STREAM_VERBOSE or COMMAND_STREAM_TRACE env vars
5
+ // CI environment no longer auto-enables tracing
5
6
  export function trace(category, messageOrFunc) {
7
+ // Check global trace setting (evaluated dynamically for runtime changes)
8
+ const TRACE_ENV = process.env.COMMAND_STREAM_TRACE;
9
+ const VERBOSE_ENV = process.env.COMMAND_STREAM_VERBOSE === 'true';
10
+
11
+ // COMMAND_STREAM_TRACE=false explicitly disables tracing even if COMMAND_STREAM_VERBOSE=true
12
+ // COMMAND_STREAM_TRACE=true explicitly enables tracing
13
+ // Otherwise, use COMMAND_STREAM_VERBOSE
14
+ const VERBOSE =
15
+ TRACE_ENV === 'false' ? false : TRACE_ENV === 'true' ? true : VERBOSE_ENV;
16
+
6
17
  if (!VERBOSE) {
7
18
  return;
8
19
  }
20
+
9
21
  const message =
10
22
  typeof messageOrFunc === 'function' ? messageOrFunc() : messageOrFunc;
11
23
  const timestamp = new Date().toISOString();