tmux-team 1.1.0 → 2.0.0-alpha.1
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 +195 -22
- package/bin/tmux-team +31 -430
- package/package.json +25 -5
- package/src/cli.ts +212 -0
- package/src/commands/add.ts +38 -0
- package/src/commands/check.ts +34 -0
- package/src/commands/completion.ts +118 -0
- package/src/commands/help.ts +51 -0
- package/src/commands/init.ts +24 -0
- package/src/commands/list.ts +27 -0
- package/src/commands/remove.ts +25 -0
- package/src/commands/talk.test.ts +652 -0
- package/src/commands/talk.ts +261 -0
- package/src/commands/update.ts +47 -0
- package/src/config.test.ts +246 -0
- package/src/config.ts +159 -0
- package/src/context.ts +38 -0
- package/src/exits.ts +14 -0
- package/src/pm/commands.test.ts +158 -0
- package/src/pm/commands.ts +654 -0
- package/src/pm/manager.test.ts +377 -0
- package/src/pm/manager.ts +140 -0
- package/src/pm/storage/adapter.ts +55 -0
- package/src/pm/storage/fs.test.ts +384 -0
- package/src/pm/storage/fs.ts +255 -0
- package/src/pm/storage/github.ts +751 -0
- package/src/pm/types.ts +79 -0
- package/src/state.test.ts +311 -0
- package/src/state.ts +83 -0
- package/src/tmux.test.ts +205 -0
- package/src/tmux.ts +27 -0
- package/src/types.ts +86 -0
- package/src/ui.ts +67 -0
- package/src/version.ts +21 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────
|
|
2
|
+
// Shared TypeScript interfaces for tmux-team
|
|
3
|
+
// ─────────────────────────────────────────────────────────────
|
|
4
|
+
|
|
5
|
+
export interface AgentConfig {
|
|
6
|
+
preamble?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface PaneEntry {
|
|
10
|
+
pane: string;
|
|
11
|
+
remark?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ConfigDefaults {
|
|
15
|
+
timeout: number; // seconds
|
|
16
|
+
pollInterval: number; // seconds
|
|
17
|
+
captureLines: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface GlobalConfig {
|
|
21
|
+
mode: 'polling' | 'wait';
|
|
22
|
+
preambleMode: 'always' | 'disabled';
|
|
23
|
+
defaults: ConfigDefaults;
|
|
24
|
+
agents: Record<string, AgentConfig>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface LocalConfig {
|
|
28
|
+
[agentName: string]: PaneEntry;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ResolvedConfig {
|
|
32
|
+
mode: 'polling' | 'wait';
|
|
33
|
+
preambleMode: 'always' | 'disabled';
|
|
34
|
+
defaults: ConfigDefaults;
|
|
35
|
+
agents: Record<string, AgentConfig>;
|
|
36
|
+
paneRegistry: Record<string, PaneEntry>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Flags {
|
|
40
|
+
json: boolean;
|
|
41
|
+
verbose: boolean;
|
|
42
|
+
config?: string;
|
|
43
|
+
force?: boolean;
|
|
44
|
+
delay?: number; // seconds
|
|
45
|
+
wait?: boolean;
|
|
46
|
+
timeout?: number; // seconds
|
|
47
|
+
noPreamble?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Paths {
|
|
51
|
+
globalDir: string;
|
|
52
|
+
globalConfig: string;
|
|
53
|
+
localConfig: string;
|
|
54
|
+
stateFile: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface UI {
|
|
58
|
+
info: (msg: string) => void;
|
|
59
|
+
success: (msg: string) => void;
|
|
60
|
+
warn: (msg: string) => void;
|
|
61
|
+
error: (msg: string) => void;
|
|
62
|
+
table: (headers: string[], rows: string[][]) => void;
|
|
63
|
+
json: (data: unknown) => void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface Tmux {
|
|
67
|
+
send: (paneId: string, message: string) => void;
|
|
68
|
+
capture: (paneId: string, lines: number) => string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface WaitResult {
|
|
72
|
+
requestId: string;
|
|
73
|
+
nonce: string;
|
|
74
|
+
marker: string;
|
|
75
|
+
response: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface Context {
|
|
79
|
+
argv: string[];
|
|
80
|
+
flags: Flags;
|
|
81
|
+
ui: UI;
|
|
82
|
+
config: ResolvedConfig;
|
|
83
|
+
tmux: Tmux;
|
|
84
|
+
paths: Paths;
|
|
85
|
+
exit: (code: number) => never;
|
|
86
|
+
}
|
package/src/ui.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────
|
|
2
|
+
// UI utilities - colors, logging, output formatting
|
|
3
|
+
// ─────────────────────────────────────────────────────────────
|
|
4
|
+
|
|
5
|
+
import type { UI } from './types.js';
|
|
6
|
+
|
|
7
|
+
const isTTY = process.stdout.isTTY;
|
|
8
|
+
|
|
9
|
+
export const colors = {
|
|
10
|
+
red: (s: string) => (isTTY ? `\x1b[31m${s}\x1b[0m` : s),
|
|
11
|
+
green: (s: string) => (isTTY ? `\x1b[32m${s}\x1b[0m` : s),
|
|
12
|
+
yellow: (s: string) => (isTTY ? `\x1b[33m${s}\x1b[0m` : s),
|
|
13
|
+
blue: (s: string) => (isTTY ? `\x1b[34m${s}\x1b[0m` : s),
|
|
14
|
+
cyan: (s: string) => (isTTY ? `\x1b[36m${s}\x1b[0m` : s),
|
|
15
|
+
dim: (s: string) => (isTTY ? `\x1b[2m${s}\x1b[0m` : s),
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function createUI(jsonMode: boolean): UI {
|
|
19
|
+
if (jsonMode) {
|
|
20
|
+
// In JSON mode, suppress all human-friendly output
|
|
21
|
+
return {
|
|
22
|
+
info: () => {},
|
|
23
|
+
success: () => {},
|
|
24
|
+
warn: () => {},
|
|
25
|
+
error: (msg: string) => {
|
|
26
|
+
console.error(JSON.stringify({ error: msg }));
|
|
27
|
+
},
|
|
28
|
+
table: () => {},
|
|
29
|
+
json: (data: unknown) => {
|
|
30
|
+
console.log(JSON.stringify(data, null, 2));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
info: (msg: string) => {
|
|
37
|
+
console.log(`${colors.blue('ℹ')} ${msg}`);
|
|
38
|
+
},
|
|
39
|
+
success: (msg: string) => {
|
|
40
|
+
console.log(`${colors.green('✓')} ${msg}`);
|
|
41
|
+
},
|
|
42
|
+
warn: (msg: string) => {
|
|
43
|
+
console.log(`${colors.yellow('⚠')} ${msg}`);
|
|
44
|
+
},
|
|
45
|
+
error: (msg: string) => {
|
|
46
|
+
console.error(`${colors.red('✗')} ${msg}`);
|
|
47
|
+
},
|
|
48
|
+
table: (headers: string[], rows: string[][]) => {
|
|
49
|
+
// Calculate column widths
|
|
50
|
+
const widths = headers.map((h, i) =>
|
|
51
|
+
Math.max(h.length, ...rows.map((r) => (r[i] || '').length))
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Print header
|
|
55
|
+
console.log(' ' + headers.map((h, i) => colors.yellow(h.padEnd(widths[i]))).join(' '));
|
|
56
|
+
console.log(' ' + widths.map((w) => '─'.repeat(w)).join(' '));
|
|
57
|
+
|
|
58
|
+
// Print rows
|
|
59
|
+
for (const row of rows) {
|
|
60
|
+
console.log(' ' + row.map((c, i) => (c || '-').padEnd(widths[i])).join(' '));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
json: (data: unknown) => {
|
|
64
|
+
console.log(JSON.stringify(data, null, 2));
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────
|
|
2
|
+
// Version - read from package.json
|
|
3
|
+
// ─────────────────────────────────────────────────────────────
|
|
4
|
+
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
function getVersion(): string {
|
|
12
|
+
try {
|
|
13
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
14
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
15
|
+
return pkg.version;
|
|
16
|
+
} catch {
|
|
17
|
+
return '2.0.0';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const VERSION = getVersion();
|