@creativeintelligence/abbie 0.1.6 → 0.1.7
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/dev.js +1 -49
- package/bin/run.js +42 -49
- package/dist/cli/commands/project/add.d.ts +0 -1
- package/dist/cli/commands/project/add.js +16 -52
- package/dist/cli/commands/project/list.js +13 -93
- package/dist/cli/commands/project/remove.d.ts +0 -2
- package/dist/cli/commands/project/remove.js +11 -28
- package/dist/cli/commands/session/list.js +3 -12
- package/dist/cli/commands/session/mark-done.js +1 -7
- package/dist/cli/commands/session/start.d.ts +0 -1
- package/dist/cli/commands/session/start.js +5 -7
- package/dist/lib/active-sessions.d.ts +0 -12
- package/dist/lib/active-sessions.js +6 -175
- package/dist/lib/project-path.d.ts +6 -0
- package/dist/lib/project-path.js +21 -0
- package/dist/lib.d.ts +1 -2
- package/dist/lib.js +2 -4
- package/oclif.manifest.json +2569 -6368
- package/package.json +1 -1
- package/dist/cli/commands/backlog/add.d.ts +0 -22
- package/dist/cli/commands/backlog/add.js +0 -65
- package/dist/cli/commands/backlog/claim.d.ts +0 -19
- package/dist/cli/commands/backlog/claim.js +0 -45
- package/dist/cli/commands/backlog/complete.d.ts +0 -18
- package/dist/cli/commands/backlog/complete.js +0 -42
- package/dist/cli/commands/backlog/list.d.ts +0 -20
- package/dist/cli/commands/backlog/list.js +0 -91
- package/dist/cli/commands/backlog/pick.d.ts +0 -18
- package/dist/cli/commands/backlog/pick.js +0 -42
- package/dist/cli/commands/backlog/sync.d.ts +0 -24
- package/dist/cli/commands/backlog/sync.js +0 -109
- package/dist/cli/commands/daemon.d.ts +0 -56
- package/dist/cli/commands/daemon.js +0 -1465
- package/dist/cli/commands/docs/lint.d.ts +0 -18
- package/dist/cli/commands/docs/lint.js +0 -82
- package/dist/cli/commands/docs/sync.d.ts +0 -19
- package/dist/cli/commands/docs/sync.js +0 -76
- package/dist/cli/commands/gc.d.ts +0 -29
- package/dist/cli/commands/gc.js +0 -211
- package/dist/cli/commands/index.d.ts +0 -36
- package/dist/cli/commands/index.js +0 -228
- package/dist/cli/commands/panes/broker.d.ts +0 -17
- package/dist/cli/commands/panes/broker.js +0 -57
- package/dist/cli/commands/panes/pipe-sink.d.ts +0 -17
- package/dist/cli/commands/panes/pipe-sink.js +0 -90
- package/dist/cli/commands/panes/snapshot.d.ts +0 -20
- package/dist/cli/commands/panes/snapshot.js +0 -125
- package/dist/cli/commands/preview/init.d.ts +0 -25
- package/dist/cli/commands/preview/init.js +0 -159
- package/dist/cli/commands/preview/sync.d.ts +0 -23
- package/dist/cli/commands/preview/sync.js +0 -144
- package/dist/cli/commands/preview/watch.d.ts +0 -24
- package/dist/cli/commands/preview/watch.js +0 -153
- package/dist/cli/commands/resource/acquire.d.ts +0 -21
- package/dist/cli/commands/resource/acquire.js +0 -90
- package/dist/cli/commands/resource/list.d.ts +0 -15
- package/dist/cli/commands/resource/list.js +0 -61
- package/dist/cli/commands/resource/release.d.ts +0 -18
- package/dist/cli/commands/resource/release.js +0 -50
- package/dist/cli/commands/resource/wait.d.ts +0 -21
- package/dist/cli/commands/resource/wait.js +0 -73
- package/dist/cli/commands/session/view.d.ts +0 -24
- package/dist/cli/commands/session/view.js +0 -145
- package/dist/cli/commands/start.d.ts +0 -37
- package/dist/cli/commands/start.js +0 -234
- package/dist/cli/commands/triage/claim.d.ts +0 -23
- package/dist/cli/commands/triage/claim.js +0 -186
- package/dist/cli/commands/triage/list.d.ts +0 -22
- package/dist/cli/commands/triage/list.js +0 -112
- package/dist/cli/commands/triage/next.d.ts +0 -18
- package/dist/cli/commands/triage/next.js +0 -63
- package/dist/cli/commands/triage/pull.d.ts +0 -19
- package/dist/cli/commands/triage/pull.js +0 -82
- package/dist/cli/commands/triage/stats.d.ts +0 -16
- package/dist/cli/commands/triage/stats.js +0 -69
- package/dist/cli/commands/tunnel/list.d.ts +0 -16
- package/dist/cli/commands/tunnel/list.js +0 -98
- package/dist/cli/commands/tunnel/start.d.ts +0 -24
- package/dist/cli/commands/tunnel/start.js +0 -107
- package/dist/cli/commands/tunnel/stop.d.ts +0 -20
- package/dist/cli/commands/tunnel/stop.js +0 -90
- package/dist/cli/commands/tunnel/url.d.ts +0 -21
- package/dist/cli/commands/tunnel/url.js +0 -70
- package/dist/cli/commands/windows/context.d.ts +0 -18
- package/dist/cli/commands/windows/context.js +0 -326
- package/dist/cli/commands/windows/focus.d.ts +0 -17
- package/dist/cli/commands/windows/focus.js +0 -103
- package/dist/cli/commands/windows/list.d.ts +0 -21
- package/dist/cli/commands/windows/list.js +0 -172
- package/dist/cli/commands/windows/map.d.ts +0 -17
- package/dist/cli/commands/windows/map.js +0 -168
- package/dist/cli/commands/windows/read.d.ts +0 -21
- package/dist/cli/commands/windows/read.js +0 -241
- package/dist/cli/commands/windows/search.d.ts +0 -24
- package/dist/cli/commands/windows/search.js +0 -171
- package/dist/cli/commands/windows/show.d.ts +0 -19
- package/dist/cli/commands/windows/show.js +0 -165
- package/dist/cli/commands/windows/watch.d.ts +0 -19
- package/dist/cli/commands/windows/watch.js +0 -241
- package/dist/lib/managed-session.d.ts +0 -27
- package/dist/lib/managed-session.js +0 -105
- package/dist/lib/panes/broker.d.ts +0 -130
- package/dist/lib/panes/broker.js +0 -97
- package/dist/lib/panes/index.d.ts +0 -2
- package/dist/lib/panes/index.js +0 -1
- package/dist/lib/panes/server.d.ts +0 -17
- package/dist/lib/panes/server.js +0 -308
- package/dist/lib/preview/manager.d.ts +0 -77
- package/dist/lib/preview/manager.js +0 -369
- package/dist/lib/preview/schema.d.ts +0 -2
- package/dist/lib/preview/schema.js +0 -32
- package/dist/lib/preview/sprite.d.ts +0 -85
- package/dist/lib/preview/sprite.js +0 -321
- package/dist/lib/preview/watcher.d.ts +0 -63
- package/dist/lib/preview/watcher.js +0 -185
- package/dist/lib/project-identity.d.ts +0 -16
- package/dist/lib/project-identity.js +0 -75
- package/dist/lib/tmux/bridge.d.ts +0 -133
- package/dist/lib/tmux/bridge.js +0 -315
- package/dist/lib/tmux/context.d.ts +0 -82
- package/dist/lib/tmux/context.js +0 -239
- package/dist/lib/tmux/index.d.ts +0 -8
- package/dist/lib/tmux/index.js +0 -11
- package/dist/lib/tmux/map.d.ts +0 -57
- package/dist/lib/tmux/map.js +0 -198
- package/dist/lib/tmux/panes.d.ts +0 -27
- package/dist/lib/tmux/panes.js +0 -151
- package/dist/lib/tmux/redaction.d.ts +0 -57
- package/dist/lib/tmux/redaction.js +0 -152
- package/dist/lib/web/analytics.d.ts +0 -63
- package/dist/lib/web/analytics.js +0 -168
- package/dist/lib/web/server.d.ts +0 -26
- package/dist/lib/web/server.js +0 -697
- package/dist/lib/web/tmux-bridge.d.ts +0 -7
- package/dist/lib/web/tmux-bridge.js +0 -7
- package/dist/lib/windows/index.d.ts +0 -3
- package/dist/lib/windows/index.js +0 -2
- package/dist/lib/windows/inventory.d.ts +0 -21
- package/dist/lib/windows/inventory.js +0 -263
- package/dist/lib/windows/types.d.ts +0 -46
- package/dist/lib/windows/types.js +0 -1
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tmux bridge - core primitives for interacting with tmux.
|
|
3
|
-
* Provides programmatic access to tmux sessions, windows, and panes.
|
|
4
|
-
*/
|
|
5
|
-
export interface TmuxWindow {
|
|
6
|
-
id: string;
|
|
7
|
-
index: number;
|
|
8
|
-
name: string;
|
|
9
|
-
active: boolean;
|
|
10
|
-
panes: number;
|
|
11
|
-
layout: string;
|
|
12
|
-
}
|
|
13
|
-
export interface TmuxPane {
|
|
14
|
-
index: number;
|
|
15
|
-
active: boolean;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
currentCommand: string;
|
|
19
|
-
currentPath: string;
|
|
20
|
-
}
|
|
21
|
-
export interface TmuxSession {
|
|
22
|
-
name: string;
|
|
23
|
-
windows: number;
|
|
24
|
-
attached: boolean;
|
|
25
|
-
created: Date;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Check if tmux server is running.
|
|
29
|
-
*/
|
|
30
|
-
export declare function isRunning(): Promise<boolean>;
|
|
31
|
-
/**
|
|
32
|
-
* List all tmux sessions.
|
|
33
|
-
*/
|
|
34
|
-
export declare function listSessions(): Promise<TmuxSession[]>;
|
|
35
|
-
/**
|
|
36
|
-
* List all windows in a session (defaults to current).
|
|
37
|
-
*/
|
|
38
|
-
export declare function listWindows(session?: string): Promise<TmuxWindow[]>;
|
|
39
|
-
/**
|
|
40
|
-
* List all panes in a window.
|
|
41
|
-
*/
|
|
42
|
-
export declare function listPanes(window: string | number, session?: string): Promise<TmuxPane[]>;
|
|
43
|
-
/**
|
|
44
|
-
* Capture pane content (plain text, no ANSI).
|
|
45
|
-
*/
|
|
46
|
-
export declare function capturePane(window: string | number, pane?: number, options?: {
|
|
47
|
-
lines?: number;
|
|
48
|
-
session?: string;
|
|
49
|
-
startLine?: number;
|
|
50
|
-
}): Promise<string>;
|
|
51
|
-
/**
|
|
52
|
-
* Capture pane content with ANSI escape codes preserved.
|
|
53
|
-
*/
|
|
54
|
-
export declare function capturePaneWithAnsi(window: string | number, pane?: number, options?: {
|
|
55
|
-
lines?: number;
|
|
56
|
-
session?: string;
|
|
57
|
-
startLine?: number;
|
|
58
|
-
}): Promise<string>;
|
|
59
|
-
/**
|
|
60
|
-
* Send keys to a pane.
|
|
61
|
-
*/
|
|
62
|
-
export declare function sendKeys(window: string | number, pane: number, keys: string, options?: {
|
|
63
|
-
session?: string;
|
|
64
|
-
literal?: boolean;
|
|
65
|
-
}): Promise<void>;
|
|
66
|
-
/**
|
|
67
|
-
* Select a window.
|
|
68
|
-
*/
|
|
69
|
-
export declare function selectWindow(window: string | number, session?: string): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Select a pane.
|
|
72
|
-
*/
|
|
73
|
-
export declare function selectPane(window: string | number, pane: number, session?: string): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Create a new window.
|
|
76
|
-
*/
|
|
77
|
-
export declare function newWindow(options: {
|
|
78
|
-
name?: string;
|
|
79
|
-
cwd?: string;
|
|
80
|
-
session?: string;
|
|
81
|
-
command?: string;
|
|
82
|
-
}): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* Kill a window.
|
|
85
|
-
*/
|
|
86
|
-
export declare function killWindow(window: string | number, session?: string): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Reorder a window by moving it to a target index.
|
|
89
|
-
* Uses -r to renumber windows to avoid index collisions.
|
|
90
|
-
*/
|
|
91
|
-
export declare function moveWindow(sourceIndex: number, targetIndex: number, session?: string): Promise<void>;
|
|
92
|
-
/**
|
|
93
|
-
* Move a window (by id or index string) to a target index.
|
|
94
|
-
* Prefer window ids (e.g. "@47") because indices change as we reorder.
|
|
95
|
-
*/
|
|
96
|
-
export declare function moveWindowToIndex(source: string, targetIndex: number, session?: string): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* Swap two windows by index.
|
|
99
|
-
* This is the safest way to reorder within a session because `move-window` cannot
|
|
100
|
-
* move into an index that's already in use.
|
|
101
|
-
*/
|
|
102
|
-
export declare function swapWindows(sourceIndex: number, targetIndex: number, session?: string): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Get the current window name.
|
|
105
|
-
*/
|
|
106
|
-
export declare function getCurrentWindow(session?: string): Promise<string | null>;
|
|
107
|
-
/**
|
|
108
|
-
* Get the current pane's working directory.
|
|
109
|
-
*/
|
|
110
|
-
export declare function getPaneCwd(window: string | number, pane?: number, session?: string): Promise<string | null>;
|
|
111
|
-
/**
|
|
112
|
-
* Resize a pane to specific dimensions.
|
|
113
|
-
* Note: This resizes the pane within the window layout.
|
|
114
|
-
*/
|
|
115
|
-
export declare function resizePane(window: string | number, pane: number, cols: number, rows: number, session?: string): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Get the pane ID (unique identifier like %0, %1, etc).
|
|
118
|
-
* Useful for nvim socket naming: /tmp/nvim-${paneId}.sock
|
|
119
|
-
*/
|
|
120
|
-
export declare function getPaneId(window: string | number, pane?: number, session?: string): Promise<string | null>;
|
|
121
|
-
/**
|
|
122
|
-
* Get the pane's TTY path.
|
|
123
|
-
* Useful for correlating nvim instances to panes.
|
|
124
|
-
*/
|
|
125
|
-
export declare function getPaneTty(window: string | number, pane?: number, session?: string): Promise<string | null>;
|
|
126
|
-
/**
|
|
127
|
-
* Get pane dimensions (width and height in columns/rows).
|
|
128
|
-
*/
|
|
129
|
-
export declare function getPaneDimensions(window: string | number, pane?: number, session?: string): Promise<{
|
|
130
|
-
cols: number;
|
|
131
|
-
rows: number;
|
|
132
|
-
} | null>;
|
|
133
|
-
//# sourceMappingURL=bridge.d.ts.map
|
package/dist/lib/tmux/bridge.js
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tmux bridge - core primitives for interacting with tmux.
|
|
3
|
-
* Provides programmatic access to tmux sessions, windows, and panes.
|
|
4
|
-
*/
|
|
5
|
-
import { spawn } from "node:child_process";
|
|
6
|
-
/**
|
|
7
|
-
* Execute a tmux command and return stdout.
|
|
8
|
-
*/
|
|
9
|
-
async function tmux(...args) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
const proc = spawn("tmux", args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
12
|
-
let stdout = "";
|
|
13
|
-
let stderr = "";
|
|
14
|
-
proc.stdout.on("data", (data) => {
|
|
15
|
-
stdout += data.toString();
|
|
16
|
-
});
|
|
17
|
-
proc.stderr.on("data", (data) => {
|
|
18
|
-
stderr += data.toString();
|
|
19
|
-
});
|
|
20
|
-
proc.on("close", (code) => {
|
|
21
|
-
if (code === 0) {
|
|
22
|
-
resolve(stdout.trim());
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
reject(new Error(`tmux ${args.join(" ")} failed: ${stderr || `exit code ${code}`}`));
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
proc.on("error", reject);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Check if tmux server is running.
|
|
33
|
-
*/
|
|
34
|
-
export async function isRunning() {
|
|
35
|
-
try {
|
|
36
|
-
await tmux("list-sessions");
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* List all tmux sessions.
|
|
45
|
-
*/
|
|
46
|
-
export async function listSessions() {
|
|
47
|
-
try {
|
|
48
|
-
const output = await tmux("list-sessions", "-F", "#{session_name}\t#{session_windows}\t#{session_attached}\t#{session_created}");
|
|
49
|
-
if (!output)
|
|
50
|
-
return [];
|
|
51
|
-
return output.split("\n").map((line) => {
|
|
52
|
-
const [name, windows, attached, created] = line.split("\t");
|
|
53
|
-
return {
|
|
54
|
-
name,
|
|
55
|
-
windows: parseInt(windows, 10),
|
|
56
|
-
attached: attached === "1",
|
|
57
|
-
created: new Date(parseInt(created, 10) * 1000),
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
catch {
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* List all windows in a session (defaults to current).
|
|
67
|
-
*/
|
|
68
|
-
export async function listWindows(session) {
|
|
69
|
-
try {
|
|
70
|
-
const target = session ? ["-t", session] : [];
|
|
71
|
-
const output = await tmux("list-windows", ...target, "-F", "#{window_id}\t#{window_index}\t#{window_name}\t#{window_active}\t#{window_panes}\t#{window_layout}");
|
|
72
|
-
if (!output)
|
|
73
|
-
return [];
|
|
74
|
-
return output.split("\n").map((line) => {
|
|
75
|
-
const [id, index, name, active, panes, layout] = line.split("\t");
|
|
76
|
-
return {
|
|
77
|
-
id,
|
|
78
|
-
index: parseInt(index, 10),
|
|
79
|
-
name,
|
|
80
|
-
active: active === "1",
|
|
81
|
-
panes: parseInt(panes, 10),
|
|
82
|
-
layout,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* List all panes in a window.
|
|
92
|
-
*/
|
|
93
|
-
export async function listPanes(window, session) {
|
|
94
|
-
try {
|
|
95
|
-
const target = session ? `${session}:${window}` : `${window}`;
|
|
96
|
-
const output = await tmux("list-panes", "-t", target, "-F", "#{pane_index}\t#{pane_active}\t#{pane_width}\t#{pane_height}\t#{pane_current_command}\t#{pane_current_path}");
|
|
97
|
-
if (!output)
|
|
98
|
-
return [];
|
|
99
|
-
return output.split("\n").map((line) => {
|
|
100
|
-
const [index, active, width, height, currentCommand = "", currentPath = ""] = line.split("\t");
|
|
101
|
-
return {
|
|
102
|
-
index: parseInt(index, 10),
|
|
103
|
-
active: active === "1",
|
|
104
|
-
width: parseInt(width, 10),
|
|
105
|
-
height: parseInt(height, 10),
|
|
106
|
-
currentCommand,
|
|
107
|
-
currentPath,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Capture pane content (plain text, no ANSI).
|
|
117
|
-
*/
|
|
118
|
-
export async function capturePane(window, pane = 0, options = {}) {
|
|
119
|
-
const { lines = 100, session, startLine } = options;
|
|
120
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
121
|
-
// -p prints to stdout (no -e for plain text without ANSI)
|
|
122
|
-
const args = ["capture-pane", "-t", target, "-p"];
|
|
123
|
-
if (startLine !== undefined) {
|
|
124
|
-
args.push("-S", String(startLine));
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
args.push("-S", `-${lines}`);
|
|
128
|
-
}
|
|
129
|
-
try {
|
|
130
|
-
return await tmux(...args);
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
return "";
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Capture pane content with ANSI escape codes preserved.
|
|
138
|
-
*/
|
|
139
|
-
export async function capturePaneWithAnsi(window, pane = 0, options = {}) {
|
|
140
|
-
const { lines = 100, session, startLine } = options;
|
|
141
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
142
|
-
// -e preserves escape sequences (ANSI colors), -p prints to stdout
|
|
143
|
-
const args = ["capture-pane", "-t", target, "-p", "-e"];
|
|
144
|
-
if (startLine !== undefined) {
|
|
145
|
-
args.push("-S", String(startLine));
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
args.push("-S", `-${lines}`);
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
return await tmux(...args);
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
return "";
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Send keys to a pane.
|
|
159
|
-
*/
|
|
160
|
-
export async function sendKeys(window, pane, keys, options = {}) {
|
|
161
|
-
const { session, literal = false } = options;
|
|
162
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
163
|
-
const args = ["send-keys", "-t", target];
|
|
164
|
-
if (literal) {
|
|
165
|
-
args.push("-l");
|
|
166
|
-
}
|
|
167
|
-
args.push(keys);
|
|
168
|
-
await tmux(...args);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Select a window.
|
|
172
|
-
*/
|
|
173
|
-
export async function selectWindow(window, session) {
|
|
174
|
-
const target = session ? `${session}:${window}` : `${window}`;
|
|
175
|
-
await tmux("select-window", "-t", target);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Select a pane.
|
|
179
|
-
*/
|
|
180
|
-
export async function selectPane(window, pane, session) {
|
|
181
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
182
|
-
await tmux("select-pane", "-t", target);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Create a new window.
|
|
186
|
-
*/
|
|
187
|
-
export async function newWindow(options) {
|
|
188
|
-
const { name, cwd, session, command } = options;
|
|
189
|
-
const args = ["new-window"];
|
|
190
|
-
// Trailing colon ensures tmux interprets as session (not window/pane match)
|
|
191
|
-
if (session)
|
|
192
|
-
args.push("-t", `${session}:`);
|
|
193
|
-
if (name)
|
|
194
|
-
args.push("-n", name);
|
|
195
|
-
if (cwd)
|
|
196
|
-
args.push("-c", cwd);
|
|
197
|
-
if (command)
|
|
198
|
-
args.push(command);
|
|
199
|
-
await tmux(...args);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Kill a window.
|
|
203
|
-
*/
|
|
204
|
-
export async function killWindow(window, session) {
|
|
205
|
-
const target = session ? `${session}:${window}` : `${window}`;
|
|
206
|
-
await tmux("kill-window", "-t", target);
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Reorder a window by moving it to a target index.
|
|
210
|
-
* Uses -r to renumber windows to avoid index collisions.
|
|
211
|
-
*/
|
|
212
|
-
export async function moveWindow(sourceIndex, targetIndex, session) {
|
|
213
|
-
const source = session ? `${session}:${sourceIndex}` : String(sourceIndex);
|
|
214
|
-
const target = session ? `${session}:${targetIndex}` : String(targetIndex);
|
|
215
|
-
await tmux("move-window", "-r", "-s", source, "-t", target);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Move a window (by id or index string) to a target index.
|
|
219
|
-
* Prefer window ids (e.g. "@47") because indices change as we reorder.
|
|
220
|
-
*/
|
|
221
|
-
export async function moveWindowToIndex(source, targetIndex, session) {
|
|
222
|
-
const sourceTarget = source.startsWith("@") ? source : session ? `${session}:${source}` : source;
|
|
223
|
-
const target = session ? `${session}:${targetIndex}` : String(targetIndex);
|
|
224
|
-
await tmux("move-window", "-r", "-s", sourceTarget, "-t", target);
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Swap two windows by index.
|
|
228
|
-
* This is the safest way to reorder within a session because `move-window` cannot
|
|
229
|
-
* move into an index that's already in use.
|
|
230
|
-
*/
|
|
231
|
-
export async function swapWindows(sourceIndex, targetIndex, session) {
|
|
232
|
-
const source = session ? `${session}:${sourceIndex}` : String(sourceIndex);
|
|
233
|
-
const target = session ? `${session}:${targetIndex}` : String(targetIndex);
|
|
234
|
-
await tmux("swap-window", "-s", source, "-t", target);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Get the current window name.
|
|
238
|
-
*/
|
|
239
|
-
export async function getCurrentWindow(session) {
|
|
240
|
-
try {
|
|
241
|
-
const target = session ? ["-t", session] : [];
|
|
242
|
-
const output = await tmux("display-message", ...target, "-p", "#{window_name}");
|
|
243
|
-
return output || null;
|
|
244
|
-
}
|
|
245
|
-
catch {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Get the current pane's working directory.
|
|
251
|
-
*/
|
|
252
|
-
export async function getPaneCwd(window, pane = 0, session) {
|
|
253
|
-
try {
|
|
254
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
255
|
-
const output = await tmux("display-message", "-t", target, "-p", "#{pane_current_path}");
|
|
256
|
-
return output || null;
|
|
257
|
-
}
|
|
258
|
-
catch {
|
|
259
|
-
return null;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Resize a pane to specific dimensions.
|
|
264
|
-
* Note: This resizes the pane within the window layout.
|
|
265
|
-
*/
|
|
266
|
-
export async function resizePane(window, pane, cols, rows, session) {
|
|
267
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
268
|
-
// resize-pane -x sets width, -y sets height
|
|
269
|
-
await tmux("resize-pane", "-t", target, "-x", String(cols), "-y", String(rows));
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Get the pane ID (unique identifier like %0, %1, etc).
|
|
273
|
-
* Useful for nvim socket naming: /tmp/nvim-${paneId}.sock
|
|
274
|
-
*/
|
|
275
|
-
export async function getPaneId(window, pane = 0, session) {
|
|
276
|
-
try {
|
|
277
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
278
|
-
const output = await tmux("display-message", "-t", target, "-p", "#{pane_id}");
|
|
279
|
-
return output || null;
|
|
280
|
-
}
|
|
281
|
-
catch {
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Get the pane's TTY path.
|
|
287
|
-
* Useful for correlating nvim instances to panes.
|
|
288
|
-
*/
|
|
289
|
-
export async function getPaneTty(window, pane = 0, session) {
|
|
290
|
-
try {
|
|
291
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
292
|
-
const output = await tmux("display-message", "-t", target, "-p", "#{pane_tty}");
|
|
293
|
-
return output || null;
|
|
294
|
-
}
|
|
295
|
-
catch {
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Get pane dimensions (width and height in columns/rows).
|
|
301
|
-
*/
|
|
302
|
-
export async function getPaneDimensions(window, pane = 0, session) {
|
|
303
|
-
try {
|
|
304
|
-
const target = session ? `${session}:${window}.${pane}` : `${window}.${pane}`;
|
|
305
|
-
const output = await tmux("display-message", "-t", target, "-p", "#{pane_width}x#{pane_height}");
|
|
306
|
-
const match = output?.match(/^(\d+)x(\d+)$/);
|
|
307
|
-
if (match) {
|
|
308
|
-
return { cols: parseInt(match[1], 10), rows: parseInt(match[2], 10) };
|
|
309
|
-
}
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
catch {
|
|
313
|
-
return null;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tmux context builder.
|
|
3
|
-
* Builds a structured snapshot of the tmux workspace for agent injection.
|
|
4
|
-
*/
|
|
5
|
-
import { type FilterConfig, type RedactMode } from "./redaction.js";
|
|
6
|
-
/**
|
|
7
|
-
* Context options.
|
|
8
|
-
*/
|
|
9
|
-
export interface ContextOptions {
|
|
10
|
-
/** Maximum bytes in output (default: 200000) */
|
|
11
|
-
maxBytes?: number;
|
|
12
|
-
/** Maximum total lines across all panes (default: 4000) */
|
|
13
|
-
maxTotalLines?: number;
|
|
14
|
-
/** Maximum sessions to include (default: unlimited) */
|
|
15
|
-
maxSessions?: number;
|
|
16
|
-
/** Maximum windows per session (default: unlimited) */
|
|
17
|
-
maxWindowsPerSession?: number;
|
|
18
|
-
/** Maximum panes per window (default: unlimited) */
|
|
19
|
-
maxPanesPerWindow?: number;
|
|
20
|
-
/** Enable redaction (default: true) */
|
|
21
|
-
redact?: boolean;
|
|
22
|
-
/** Redaction mode (default: balanced) */
|
|
23
|
-
redactMode?: RedactMode;
|
|
24
|
-
/** Filter configuration */
|
|
25
|
-
filter?: FilterConfig;
|
|
26
|
-
/** Include all commands, not just shell+editor (default: false) */
|
|
27
|
-
includeAllCommands?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Pane context.
|
|
31
|
-
*/
|
|
32
|
-
export interface PaneContext {
|
|
33
|
-
index: number;
|
|
34
|
-
active: boolean;
|
|
35
|
-
cwd: string;
|
|
36
|
-
cmd: string;
|
|
37
|
-
size: string;
|
|
38
|
-
screen: string;
|
|
39
|
-
redacted: boolean;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Window context.
|
|
43
|
-
*/
|
|
44
|
-
export interface WindowContext {
|
|
45
|
-
id: string;
|
|
46
|
-
index: number;
|
|
47
|
-
name: string;
|
|
48
|
-
active: boolean;
|
|
49
|
-
paneCount: number;
|
|
50
|
-
panes: PaneContext[];
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Session context.
|
|
54
|
-
*/
|
|
55
|
-
export interface SessionContext {
|
|
56
|
-
name: string;
|
|
57
|
-
attached: boolean;
|
|
58
|
-
windows: WindowContext[];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Full tmux context.
|
|
62
|
-
*/
|
|
63
|
-
export interface TmuxContext {
|
|
64
|
-
generatedAt: string;
|
|
65
|
-
tmuxRunning: boolean;
|
|
66
|
-
truncated: boolean;
|
|
67
|
-
truncationReason?: string;
|
|
68
|
-
sessions: SessionContext[];
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Build a structured tmux context.
|
|
72
|
-
*/
|
|
73
|
-
export declare function buildContext(options?: ContextOptions): Promise<TmuxContext>;
|
|
74
|
-
/**
|
|
75
|
-
* Serialize context to XML.
|
|
76
|
-
*/
|
|
77
|
-
export declare function toXml(context: TmuxContext): string;
|
|
78
|
-
/**
|
|
79
|
-
* Serialize context to JSON.
|
|
80
|
-
*/
|
|
81
|
-
export declare function toJson(context: TmuxContext): string;
|
|
82
|
-
//# sourceMappingURL=context.d.ts.map
|