@dpeluche/trs 0.5.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.
Files changed (3) hide show
  1. package/README.md +84 -0
  2. package/bin/trs +65 -0
  3. package/package.json +45 -0
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # trs — Token-Reducing Shell
2
+
3
+ Transform noisy terminal output into compact, structured signal.
4
+ A CLI toolkit for developers, automation pipelines, and AI agents.
5
+
6
+ **68-90% token savings** on common dev operations.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install -g @dpeluche/trs
12
+ ```
13
+
14
+ Or with other package managers:
15
+
16
+ ```bash
17
+ cargo install tars-cli # from source (Rust required)
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```bash
23
+ # Git (compressed output)
24
+ trs git status
25
+ trs git diff
26
+ trs git log --oneline -20
27
+
28
+ # Test runners
29
+ trs cargo test / go test / pytest / jest / vitest / npm test
30
+
31
+ # Linters
32
+ trs cargo clippy / eslint / ruff / biome / golangci-lint
33
+
34
+ # Files & search
35
+ trs ls -la / find / grep / tree
36
+
37
+ # Project digest (LLM-ready codebase index)
38
+ trs ingest # digest current project
39
+ trs ingest --budget 128k # fit to token budget
40
+ trs ingest --deps # dependency graph only
41
+
42
+ # AI tool hooks (auto-rewrite commands through trs)
43
+ trs init claude # Claude Code
44
+ trs init gemini # Gemini CLI
45
+ trs init cursor # Cursor
46
+ trs init codex # Codex (AGENTS.md)
47
+ ```
48
+
49
+ ## How it works
50
+
51
+ trs wraps your existing commands, parses their output, and returns a compact structured version. No changes to your workflow — just prefix with `trs`.
52
+
53
+ ```
54
+ $ git status # 2.1 KB raw output
55
+ $ trs git status # 58 bytes (97% reduction)
56
+ main | clean | 0 staged
57
+ ```
58
+
59
+ ## Output formats
60
+
61
+ ```bash
62
+ trs git status --json # structured JSON
63
+ trs git status --compact # human-readable (default)
64
+ trs git status --agent # AI-optimized markdown
65
+ trs git status --csv # tabular
66
+ trs git status --raw # passthrough (tracked)
67
+ ```
68
+
69
+ ## Supported platforms
70
+
71
+ | Platform | Architecture |
72
+ |----------|-------------|
73
+ | macOS | x64, arm64 |
74
+ | Linux | x64, arm64 |
75
+ | Windows | x64 |
76
+
77
+ ## Links
78
+
79
+ - [GitHub](https://github.com/dPeluChe/trs)
80
+ - [Documentation](https://github.com/dPeluChe/trs#readme)
81
+
82
+ Built by [Iteris](https://dpeluche.dev)
83
+
84
+ MIT License
package/bin/trs ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { platform, arch, env } = process;
4
+ const { execSync } = require("child_process");
5
+
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
+ }
15
+
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
+ };
29
+
30
+ let binPath = env.TRS_BINARY;
31
+
32
+ if (!binPath) {
33
+ const platformBins = PLATFORMS[platform];
34
+ if (platformBins) {
35
+ binPath = platformBins[arch];
36
+ }
37
+ }
38
+
39
+ if (binPath && !env.TRS_BINARY) {
40
+ try {
41
+ binPath = require.resolve(binPath);
42
+ } catch {
43
+ binPath = null;
44
+ }
45
+ }
46
+
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
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@dpeluche/trs",
3
+ "version": "0.5.0",
4
+ "description": "Transform noisy terminal output into compact, structured signal. CLI toolkit for developers, automation pipelines, and AI agents. 68-90% token savings.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/dPeluChe/trs"
9
+ },
10
+ "homepage": "https://github.com/dPeluChe/trs",
11
+ "author": "Iteris <antonio@dpeluche.dev>",
12
+ "bin": {
13
+ "trs": "bin/trs"
14
+ },
15
+ "files": [
16
+ "bin/trs",
17
+ "README.md"
18
+ ],
19
+ "engines": {
20
+ "node": ">=14"
21
+ },
22
+ "keywords": [
23
+ "cli",
24
+ "terminal",
25
+ "output",
26
+ "parser",
27
+ "git",
28
+ "ai",
29
+ "agent",
30
+ "token",
31
+ "reduction",
32
+ "structured",
33
+ "json",
34
+ "llm",
35
+ "claude",
36
+ "compact"
37
+ ],
38
+ "optionalDependencies": {
39
+ "@dpeluche/trs-cli-darwin-x64": "0.5.0",
40
+ "@dpeluche/trs-cli-darwin-arm64": "0.5.0",
41
+ "@dpeluche/trs-cli-linux-x64": "0.5.0",
42
+ "@dpeluche/trs-cli-linux-arm64": "0.5.0",
43
+ "@dpeluche/trs-cli-win32-x64": "0.5.0"
44
+ }
45
+ }