command-stream 0.0.1 β 0.0.2
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/README.md +43 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
# command-$tream
|
|
1
|
+
# [command-$tream](https://github.com/link-foundation/command-stream)
|
|
2
2
|
|
|
3
3
|
$treamable commands executor
|
|
4
4
|
|
|
5
5
|
A modern $ shell utility library with streaming, async iteration, and EventEmitter support, optimized for Bun runtime.
|
|
6
6
|
|
|
7
|
+
<img width="2624" height="1320" alt="carbon" src="https://github.com/user-attachments/assets/41cccd6a-f029-4206-b3bc-a85c5dbcf2cf" />
|
|
8
|
+
|
|
7
9
|
## Features
|
|
8
10
|
|
|
9
11
|
- π **Shell-like by Default**: Commands behave exactly like running in terminal (stdoutβstdout, stderrβstderr, stdinβstdin)
|
|
@@ -16,6 +18,46 @@ A modern $ shell utility library with streaming, async iteration, and EventEmitt
|
|
|
16
18
|
- π‘οΈ **Type Safe**: Full TypeScript support (coming soon)
|
|
17
19
|
- π§ **Built-in Commands**: 18 essential commands work identically across platforms
|
|
18
20
|
|
|
21
|
+
## Comparison with Other Libraries
|
|
22
|
+
|
|
23
|
+
| Feature | [command-stream](https://github.com/link-foundation/command-stream) | [Bun.$](https://bun.sh/docs/runtime/shell) | [execa](https://github.com/sindresorhus/execa) | [zx](https://github.com/google/zx) |
|
|
24
|
+
|---------|----------------|-------|-------|-----|
|
|
25
|
+
| **Runtime Support** | β
Bun + Node.js | π‘ Bun only | β
Node.js | β
Node.js |
|
|
26
|
+
| **Template Literals** | β
`` $`cmd` `` | β
`` $`cmd` `` | β
`` $`cmd` `` | β
`` $`cmd` `` |
|
|
27
|
+
| **Real-time Streaming** | β
Live output | β Buffer only | π‘ Limited | β Buffer only |
|
|
28
|
+
| **Synchronous Execution** | β
`.sync()` with events | β No | β
`execaSync` | β No |
|
|
29
|
+
| **Async Iteration** | β
`for await (chunk of $.stream())` | β No | β No | β No |
|
|
30
|
+
| **EventEmitter Pattern** | β
`.on('data', ...)` | β No | π‘ Limited events | β No |
|
|
31
|
+
| **Mixed Patterns** | β
Events + await/sync | β No | β No | β No |
|
|
32
|
+
| **Shell Injection Protection** | β
Auto-quoting | β
Built-in | β
Safe by default | β
Safe by default |
|
|
33
|
+
| **Cross-platform** | β
macOS/Linux/Windows | β
Yes | β
Yes | β
Yes |
|
|
34
|
+
| **Performance** | β‘ Fast (Bun optimized) | β‘ Very fast | π Moderate | π Slow |
|
|
35
|
+
| **Memory Efficiency** | β
Streaming prevents buildup | π‘ Buffers in memory | π‘ Buffers in memory | π‘ Buffers in memory |
|
|
36
|
+
| **Error Handling** | β
Configurable (`set -e`/`set +e`, non-zero OK by default) | β
Throws on error | β
Throws on error | β
Throws on error |
|
|
37
|
+
| **Shell Settings** | β
`set -e`/`set +e` equivalent | β No | β No | β No |
|
|
38
|
+
| **Stdout Support** | β
Real-time streaming + events | β
Shell redirection + buffered | β
Node.js streams + interleaved | β
Readable streams + `.pipe.stdout` |
|
|
39
|
+
| **Stderr Support** | β
Real-time streaming + events | β
Redirection + `.quiet()` access | β
Streams + interleaved output | β
Readable streams + `.pipe.stderr` |
|
|
40
|
+
| **Stdin Support** | β
string/Buffer/inherit/ignore | β
Pipe operations | β
Input/output streams | β
Basic stdin |
|
|
41
|
+
| **Built-in Commands** | β
**18 commands**: cat, ls, mkdir, rm, mv, cp, touch, basename, dirname, seq, yes + all Bun.$ commands | β
echo, cd, etc. | β Uses system | β Uses system |
|
|
42
|
+
| **Virtual Commands Engine** | β
**Revolutionary**: Register JavaScript functions as shell commands with full pipeline support | β No extensibility | β No custom commands | β No custom commands |
|
|
43
|
+
| **Pipeline/Piping Support** | β
**Advanced**: System + Built-ins + Virtual + Mixed + `.pipe()` method | β
Standard shell piping | β
Programmatic `.pipe()` + multi-destination | β
Shell piping + `.pipe()` method |
|
|
44
|
+
| **Bundle Size** | π¦ ~15KB | π― 0KB (built-in) | π¦ ~25KB | π¦ ~50KB |
|
|
45
|
+
| **TypeScript** | π Coming soon | β
Built-in | β
Full support | β
Full support |
|
|
46
|
+
| **License** | β
**Unlicense (Public Domain)** | π‘ MIT (+ LGPL dependencies) | π‘ MIT | π‘ Apache 2.0 |
|
|
47
|
+
|
|
48
|
+
### Why Choose command-stream?
|
|
49
|
+
|
|
50
|
+
- **π Truly Free**: **Unlicense (Public Domain)** - No restrictions, no attribution required, use however you want
|
|
51
|
+
- **π Revolutionary Virtual Commands**: **World's first** fully customizable virtual commands engine - register JavaScript functions as shell commands!
|
|
52
|
+
- **π Advanced Pipeline System**: **Only library** where virtual commands work seamlessly in pipelines with built-ins and system commands
|
|
53
|
+
- **π§ Built-in Commands**: **18 essential commands** work identically across all platforms - no system dependencies!
|
|
54
|
+
- **π‘ Real-time Processing**: Only library with true streaming and async iteration
|
|
55
|
+
- **π Flexible Patterns**: Multiple usage patterns (await, events, iteration, mixed)
|
|
56
|
+
- **π Shell Replacement**: Dynamic error handling with `set -e`/`set +e` equivalents for .sh file replacement
|
|
57
|
+
- **β‘ Bun Optimized**: Designed for Bun with Node.js fallback compatibility
|
|
58
|
+
- **πΎ Memory Efficient**: Streaming prevents large buffer accumulation
|
|
59
|
+
- **π‘οΈ Production Ready**: 266+ tests with comprehensive coverage
|
|
60
|
+
|
|
19
61
|
## Built-in Commands (π NEW!)
|
|
20
62
|
|
|
21
63
|
command-stream now includes **18 built-in commands** that work identically to their bash/sh counterparts, providing true cross-platform shell scripting without system dependencies:
|
|
@@ -72,46 +114,6 @@ await $`seq 1 5 | cat > numbers.txt`;
|
|
|
72
114
|
await $`basename /path/to/file.txt .txt`; // β "file"
|
|
73
115
|
```
|
|
74
116
|
|
|
75
|
-
## Comparison with Other Libraries
|
|
76
|
-
|
|
77
|
-
| Feature | [command-stream](https://github.com/link-foundation/command-stream) | [Bun.$](https://bun.sh/docs/runtime/shell) | [execa](https://github.com/sindresorhus/execa) | [zx](https://github.com/google/zx) |
|
|
78
|
-
|---------|----------------|-------|-------|-----|
|
|
79
|
-
| **Runtime Support** | β
Bun + Node.js | π‘ Bun only | β
Node.js | β
Node.js |
|
|
80
|
-
| **Template Literals** | β
`` $`cmd` `` | β
`` $`cmd` `` | β
`` $`cmd` `` | β
`` $`cmd` `` |
|
|
81
|
-
| **Real-time Streaming** | β
Live output | β Buffer only | π‘ Limited | β Buffer only |
|
|
82
|
-
| **Synchronous Execution** | β
`.sync()` with events | β No | β
`execaSync` | β No |
|
|
83
|
-
| **Async Iteration** | β
`for await (chunk of $.stream())` | β No | β No | β No |
|
|
84
|
-
| **EventEmitter Pattern** | β
`.on('data', ...)` | β No | π‘ Limited events | β No |
|
|
85
|
-
| **Mixed Patterns** | β
Events + await/sync | β No | β No | β No |
|
|
86
|
-
| **Shell Injection Protection** | β
Auto-quoting | β
Built-in | β
Safe by default | β
Safe by default |
|
|
87
|
-
| **Cross-platform** | β
macOS/Linux/Windows | β
Yes | β
Yes | β
Yes |
|
|
88
|
-
| **Performance** | β‘ Fast (Bun optimized) | β‘ Very fast | π Moderate | π Slow |
|
|
89
|
-
| **Memory Efficiency** | β
Streaming prevents buildup | π‘ Buffers in memory | π‘ Buffers in memory | π‘ Buffers in memory |
|
|
90
|
-
| **Error Handling** | β
Configurable (`set -e`/`set +e`, non-zero OK by default) | β
Throws on error | β
Throws on error | β
Throws on error |
|
|
91
|
-
| **Shell Settings** | β
`set -e`/`set +e` equivalent | β No | β No | β No |
|
|
92
|
-
| **Stdout Support** | β
Real-time streaming + events | β
Shell redirection + buffered | β
Node.js streams + interleaved | β
Readable streams + `.pipe.stdout` |
|
|
93
|
-
| **Stderr Support** | β
Real-time streaming + events | β
Redirection + `.quiet()` access | β
Streams + interleaved output | β
Readable streams + `.pipe.stderr` |
|
|
94
|
-
| **Stdin Support** | β
string/Buffer/inherit/ignore | β
Pipe operations | β
Input/output streams | β
Basic stdin |
|
|
95
|
-
| **Built-in Commands** | β
**18 commands**: cat, ls, mkdir, rm, mv, cp, touch, basename, dirname, seq, yes + all Bun.$ commands | β
echo, cd, etc. | β Uses system | β Uses system |
|
|
96
|
-
| **Virtual Commands Engine** | β
**Revolutionary**: Register JavaScript functions as shell commands with full pipeline support | β No extensibility | β No custom commands | β No custom commands |
|
|
97
|
-
| **Pipeline/Piping Support** | β
**Advanced**: System + Built-ins + Virtual + Mixed + `.pipe()` method | β
Standard shell piping | β
Programmatic `.pipe()` + multi-destination | β
Shell piping + `.pipe()` method |
|
|
98
|
-
| **Bundle Size** | π¦ ~15KB | π― 0KB (built-in) | π¦ ~25KB | π¦ ~50KB |
|
|
99
|
-
| **TypeScript** | π Coming soon | β
Built-in | β
Full support | β
Full support |
|
|
100
|
-
| **License** | β
**Unlicense (Public Domain)** | π‘ MIT (+ LGPL dependencies) | π‘ MIT | π‘ Apache 2.0 |
|
|
101
|
-
|
|
102
|
-
### Why Choose command-stream?
|
|
103
|
-
|
|
104
|
-
- **π Truly Free**: **Unlicense (Public Domain)** - No restrictions, no attribution required, use however you want
|
|
105
|
-
- **π Revolutionary Virtual Commands**: **World's first** fully customizable virtual commands engine - register JavaScript functions as shell commands!
|
|
106
|
-
- **π Advanced Pipeline System**: **Only library** where virtual commands work seamlessly in pipelines with built-ins and system commands
|
|
107
|
-
- **π§ Built-in Commands**: **18 essential commands** work identically across all platforms - no system dependencies!
|
|
108
|
-
- **π‘ Real-time Processing**: Only library with true streaming and async iteration
|
|
109
|
-
- **π Flexible Patterns**: Multiple usage patterns (await, events, iteration, mixed)
|
|
110
|
-
- **π Shell Replacement**: Dynamic error handling with `set -e`/`set +e` equivalents for .sh file replacement
|
|
111
|
-
- **β‘ Bun Optimized**: Designed for Bun with Node.js fallback compatibility
|
|
112
|
-
- **πΎ Memory Efficient**: Streaming prevents large buffer accumulation
|
|
113
|
-
- **π‘οΈ Production Ready**: 266+ tests with comprehensive coverage
|
|
114
|
-
|
|
115
117
|
## Installation
|
|
116
118
|
|
|
117
119
|
```bash
|
package/package.json
CHANGED