@dpeluche/trs 0.5.1 → 0.5.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 CHANGED
@@ -68,11 +68,14 @@ trs git status --raw # passthrough (tracked)
68
68
 
69
69
  ## Supported platforms
70
70
 
71
- | Platform | Architecture |
72
- |----------|-------------|
73
- | macOS | x64, arm64 |
74
- | Linux | x64, arm64 |
75
- | Windows | x64 |
71
+ | Platform | Architecture | Notes |
72
+ |----------|-------------|-------|
73
+ | macOS | x64, arm64 | shell launcher (~12ms overhead) |
74
+ | Linux | x64, arm64 | shell launcher (~12ms overhead) |
75
+ | Windows | x64 | `.cmd` launcher (requires Windows x64) |
76
+
77
+ > The launcher `exec`s the native binary directly — no Node.js at runtime,
78
+ > which is why startup is on par with a Homebrew install.
76
79
 
77
80
  ## Links
78
81
 
package/bin/trs CHANGED
@@ -1,65 +1,54 @@
1
- #!/usr/bin/env node
1
+ #!/bin/sh
2
+ # trs — shell wrapper that execs the native binary directly.
3
+ # Saves ~25ms vs the previous Node wrapper by skipping the node runtime.
4
+ #
5
+ # The platform-specific binary is installed by npm as an optionalDependency
6
+ # into node_modules/@dpeluche/trs-cli-<os>-<arch>/trs.
2
7
 
3
- const { platform, arch, env } = process;
4
- const { execSync } = require("child_process");
8
+ set -e
5
9
 
6
- function isMusl() {
7
- try {
8
- const out = execSync("ldd --version 2>&1", { stdio: ["pipe", "pipe", "pipe"] });
9
- return out.toString().indexOf("musl") > -1;
10
- } catch (err) {
11
- // ldd --version exits non-zero on musl systems
12
- return err.stderr && err.stderr.toString().indexOf("musl") > -1;
13
- }
14
- }
10
+ # Resolve real location of this script (npm installs it as a symlink).
11
+ SCRIPT="$0"
12
+ while [ -L "$SCRIPT" ]; do
13
+ LINK=$(readlink "$SCRIPT")
14
+ case "$LINK" in
15
+ /*) SCRIPT="$LINK" ;;
16
+ *) SCRIPT="$(dirname "$SCRIPT")/$LINK" ;;
17
+ esac
18
+ done
19
+ DIR="$(cd "$(dirname "$SCRIPT")" && pwd)"
20
+ # DIR is .../node_modules/@dpeluche/trs/bin
15
21
 
16
- const PLATFORMS = {
17
- win32: {
18
- x64: "@dpeluche/trs-cli-win32-x64/trs.exe",
19
- },
20
- darwin: {
21
- x64: "@dpeluche/trs-cli-darwin-x64/trs",
22
- arm64: "@dpeluche/trs-cli-darwin-arm64/trs",
23
- },
24
- linux: {
25
- x64: "@dpeluche/trs-cli-linux-x64/trs",
26
- arm64: "@dpeluche/trs-cli-linux-arm64/trs",
27
- },
28
- };
22
+ OS=$(uname -s)
23
+ ARCH=$(uname -m)
24
+ case "$OS" in
25
+ Darwin) OS=darwin ;;
26
+ Linux) OS=linux ;;
27
+ *) echo "trs: unsupported OS: $OS" >&2; exit 1 ;;
28
+ esac
29
+ case "$ARCH" in
30
+ x86_64|amd64) ARCH=x64 ;;
31
+ arm64|aarch64) ARCH=arm64 ;;
32
+ *) echo "trs: unsupported arch: $ARCH" >&2; exit 1 ;;
33
+ esac
29
34
 
30
- let binPath = env.TRS_BINARY;
35
+ # Default path: sibling package in node_modules/@dpeluche/
36
+ BIN="$DIR/../../trs-cli-$OS-$ARCH/trs"
31
37
 
32
- if (!binPath) {
33
- const platformBins = PLATFORMS[platform];
34
- if (platformBins) {
35
- binPath = platformBins[arch];
36
- }
37
- }
38
+ # Env override for custom builds / debugging
39
+ if [ -n "${TRS_BINARY:-}" ]; then
40
+ BIN="$TRS_BINARY"
41
+ fi
38
42
 
39
- if (binPath && !env.TRS_BINARY) {
40
- try {
41
- binPath = require.resolve(binPath);
42
- } catch {
43
- binPath = null;
44
- }
45
- }
43
+ if [ ! -x "$BIN" ]; then
44
+ echo "trs: binary not found at $BIN" >&2
45
+ echo "" >&2
46
+ echo "Expected platform package: @dpeluche/trs-cli-$OS-$ARCH" >&2
47
+ echo "" >&2
48
+ echo "Alternatives:" >&2
49
+ echo " cargo install tars-cli # build from source" >&2
50
+ echo " brew install trs # macOS (when available)" >&2
51
+ exit 1
52
+ fi
46
53
 
47
- if (binPath) {
48
- const result = require("child_process").spawnSync(binPath, process.argv.slice(2), {
49
- shell: false,
50
- stdio: "inherit",
51
- });
52
- if (result.error) {
53
- throw result.error;
54
- }
55
- process.exitCode = result.status;
56
- } else {
57
- console.error(
58
- `trs: no prebuilt binary for ${platform}-${arch}.\n\n` +
59
- `Supported: darwin-x64, darwin-arm64, linux-x64, linux-arm64, win32-x64\n\n` +
60
- `Alternatives:\n` +
61
- ` cargo install tars-cli # build from source\n` +
62
- ` brew install trs # macOS (when available)\n`
63
- );
64
- process.exitCode = 1;
65
- }
54
+ exec "$BIN" "$@"
package/bin/trs.cmd ADDED
@@ -0,0 +1,22 @@
1
+ @echo off
2
+ rem trs launcher for Windows — execs the native binary directly.
3
+ rem See bin/trs for the Unix equivalent.
4
+ setlocal
5
+
6
+ set "DIR=%~dp0"
7
+ set "BIN=%DIR%..\..\trs-cli-win32-x64\trs.exe"
8
+
9
+ if defined TRS_BINARY set "BIN=%TRS_BINARY%"
10
+
11
+ if not exist "%BIN%" (
12
+ echo trs: binary not found at %BIN% 1>&2
13
+ echo. 1>&2
14
+ echo Expected platform package: @dpeluche/trs-cli-win32-x64 1>&2
15
+ echo. 1>&2
16
+ echo Alternatives: 1>&2
17
+ echo cargo install tars-cli ^(build from source^) 1>&2
18
+ exit /b 1
19
+ )
20
+
21
+ "%BIN%" %*
22
+ exit /b %ERRORLEVEL%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dpeluche/trs",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Transform noisy terminal output into compact, structured signal. CLI toolkit for developers, automation pipelines, and AI agents. 68-90% token savings.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "files": [
16
16
  "bin/trs",
17
+ "bin/trs.cmd",
17
18
  "README.md"
18
19
  ],
19
20
  "engines": {
@@ -36,10 +37,10 @@
36
37
  "compact"
37
38
  ],
38
39
  "optionalDependencies": {
39
- "@dpeluche/trs-cli-darwin-x64": "0.5.1",
40
- "@dpeluche/trs-cli-darwin-arm64": "0.5.1",
41
- "@dpeluche/trs-cli-linux-x64": "0.5.1",
42
- "@dpeluche/trs-cli-linux-arm64": "0.5.1",
43
- "@dpeluche/trs-cli-win32-x64": "0.5.1"
40
+ "@dpeluche/trs-cli-darwin-x64": "0.5.2",
41
+ "@dpeluche/trs-cli-darwin-arm64": "0.5.2",
42
+ "@dpeluche/trs-cli-linux-x64": "0.5.2",
43
+ "@dpeluche/trs-cli-linux-arm64": "0.5.2",
44
+ "@dpeluche/trs-cli-win32-x64": "0.5.2"
44
45
  }
45
46
  }