tmux-team 3.2.3 → 3.2.4
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/bin/tmux-team +12 -5
- package/package.json +16 -15
- package/src/bin-wrapper.test.ts +50 -0
package/bin/tmux-team
CHANGED
|
@@ -3,17 +3,24 @@
|
|
|
3
3
|
// Thin wrapper that uses tsx to run the TypeScript CLI
|
|
4
4
|
// tsx is a runtime dependency for v2
|
|
5
5
|
import { spawn } from 'child_process';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
7
7
|
import { dirname, join } from 'path';
|
|
8
|
-
import {
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
9
|
|
|
10
10
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const cliPath = join(__dirname, '..', 'src', 'cli.ts');
|
|
12
12
|
|
|
13
13
|
// Prefer Node's --import hook over the tsx CLI (sandbox-friendly).
|
|
14
|
-
//
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
// Resolve `tsx` relative to *this installed package*, not the user's cwd.
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
let tsxImport;
|
|
17
|
+
try {
|
|
18
|
+
tsxImport = pathToFileURL(require.resolve('tsx')).href;
|
|
19
|
+
} catch {
|
|
20
|
+
console.error('Error: failed to resolve the `tsx` dependency from the tmux-team installation.');
|
|
21
|
+
console.error('Try reinstalling tmux-team (or ensure it was installed with its dependencies).');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
17
24
|
|
|
18
25
|
const child = spawn(process.execPath, ['--import', tsxImport, cliPath, ...process.argv.slice(2)], {
|
|
19
26
|
stdio: 'inherit',
|
package/package.json
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tmux-team",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "CLI tool for AI agent collaboration in tmux - manage cross-pane communication",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"tmux-team": "./bin/tmux-team",
|
|
8
8
|
"tmt": "./bin/tmux-team"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "tsx src/cli.ts",
|
|
12
|
+
"tmt": "./bin/tmux-team",
|
|
13
|
+
"test": "pnpm test:run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"test:run": "vitest run --coverage && node scripts/check-coverage.mjs --threshold 95",
|
|
16
|
+
"lint": "oxlint src/",
|
|
17
|
+
"lint:fix": "oxlint src/ --fix",
|
|
18
|
+
"format": "prettier --write src/",
|
|
19
|
+
"format:check": "prettier --check src/",
|
|
20
|
+
"type:check": "tsc --noEmit",
|
|
21
|
+
"check": "pnpm type:check && pnpm lint && pnpm format:check"
|
|
22
|
+
},
|
|
10
23
|
"keywords": [
|
|
11
24
|
"tmux",
|
|
12
25
|
"cli",
|
|
@@ -24,6 +37,7 @@
|
|
|
24
37
|
"engines": {
|
|
25
38
|
"node": ">=18"
|
|
26
39
|
},
|
|
40
|
+
"packageManager": "pnpm@9.15.4",
|
|
27
41
|
"os": [
|
|
28
42
|
"darwin",
|
|
29
43
|
"linux"
|
|
@@ -43,18 +57,5 @@
|
|
|
43
57
|
"prettier": "^3.7.4",
|
|
44
58
|
"typescript": "^5.3.0",
|
|
45
59
|
"vitest": "^1.2.0"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"dev": "tsx src/cli.ts",
|
|
49
|
-
"tmt": "./bin/tmux-team",
|
|
50
|
-
"test": "pnpm test:run",
|
|
51
|
-
"test:watch": "vitest",
|
|
52
|
-
"test:run": "vitest run --coverage && node scripts/check-coverage.mjs --threshold 95",
|
|
53
|
-
"lint": "oxlint src/",
|
|
54
|
-
"lint:fix": "oxlint src/ --fix",
|
|
55
|
-
"format": "prettier --write src/",
|
|
56
|
-
"format:check": "prettier --check src/",
|
|
57
|
-
"type:check": "tsc --noEmit",
|
|
58
|
-
"check": "pnpm type:check && pnpm lint && pnpm format:check"
|
|
59
60
|
}
|
|
60
|
-
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { copyFileSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
4
|
+
import { createRequire } from 'node:module';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
|
|
8
|
+
describe('bin/tmux-team wrapper', () => {
|
|
9
|
+
it('runs from a non-project cwd with hoisted tsx', () => {
|
|
10
|
+
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
const tempRoot = mkdtempSync(join(repoRoot, '.tmp-bin-wrapper-'));
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const projectRoot = join(tempRoot, 'project');
|
|
15
|
+
const userCwd = join(tempRoot, 'cwd');
|
|
16
|
+
|
|
17
|
+
const installedPkgRoot = join(projectRoot, 'node_modules', 'tmux-team');
|
|
18
|
+
const installedBin = join(installedPkgRoot, 'bin', 'tmux-team');
|
|
19
|
+
const installedCli = join(installedPkgRoot, 'src', 'cli.ts');
|
|
20
|
+
|
|
21
|
+
mkdirSync(join(installedPkgRoot, 'bin'), { recursive: true });
|
|
22
|
+
mkdirSync(join(installedPkgRoot, 'src'), { recursive: true });
|
|
23
|
+
mkdirSync(join(projectRoot, 'node_modules'), { recursive: true });
|
|
24
|
+
mkdirSync(userCwd, { recursive: true });
|
|
25
|
+
|
|
26
|
+
// Ensure Node treats the extensionless bin file as ESM (like a real install).
|
|
27
|
+
writeFileSync(
|
|
28
|
+
join(installedPkgRoot, 'package.json'),
|
|
29
|
+
JSON.stringify({ name: 'tmux-team', version: '0.0.0-test', type: 'module' })
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
copyFileSync(join(repoRoot, 'bin', 'tmux-team'), installedBin);
|
|
33
|
+
writeFileSync(installedCli, 'process.exit(0);\n');
|
|
34
|
+
|
|
35
|
+
// Simulate hoisting: tsx is present at the project root, not inside tmux-team/node_modules.
|
|
36
|
+
const require = createRequire(import.meta.url);
|
|
37
|
+
const tsxDir = dirname(require.resolve('tsx/package.json'));
|
|
38
|
+
symlinkSync(tsxDir, join(projectRoot, 'node_modules', 'tsx'), 'dir');
|
|
39
|
+
|
|
40
|
+
const result = spawnSync(process.execPath, [installedBin, '--help'], {
|
|
41
|
+
cwd: userCwd,
|
|
42
|
+
encoding: 'utf8',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
expect(result.status).toBe(0);
|
|
46
|
+
} finally {
|
|
47
|
+
rmSync(tempRoot, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|