tmux-agent 0.1.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.
- package/.codex/skills/speckit/SKILL.md +173 -0
- package/.codex/skills/speckit/assets/templates/checklist-template.md +49 -0
- package/.codex/skills/speckit/assets/templates/notes-entrypoints-template.md +11 -0
- package/.codex/skills/speckit/assets/templates/notes-questions-template.md +7 -0
- package/.codex/skills/speckit/assets/templates/notes-readme-template.md +36 -0
- package/.codex/skills/speckit/assets/templates/notes-session-template.md +21 -0
- package/.codex/skills/speckit/assets/templates/plan-template.md +126 -0
- package/.codex/skills/speckit/assets/templates/spec-template.md +135 -0
- package/.codex/skills/speckit/assets/templates/tasks-template.md +269 -0
- package/.codex/skills/speckit/references/acceptance.md +183 -0
- package/.codex/skills/speckit/references/analyze.md +186 -0
- package/.codex/skills/speckit/references/checklist.md +302 -0
- package/.codex/skills/speckit/references/clarify-auto.md +69 -0
- package/.codex/skills/speckit/references/clarify-detailed.md +78 -0
- package/.codex/skills/speckit/references/clarify.md +189 -0
- package/.codex/skills/speckit/references/constitution.md +90 -0
- package/.codex/skills/speckit/references/group.md +89 -0
- package/.codex/skills/speckit/references/implement-task.md +115 -0
- package/.codex/skills/speckit/references/implement.md +129 -0
- package/.codex/skills/speckit/references/notes.md +82 -0
- package/.codex/skills/speckit/references/plan-deep.md +87 -0
- package/.codex/skills/speckit/references/plan-from-questions.md +115 -0
- package/.codex/skills/speckit/references/plan-from-review.md +89 -0
- package/.codex/skills/speckit/references/plan.md +97 -0
- package/.codex/skills/speckit/references/review-plan.md +156 -0
- package/.codex/skills/speckit/references/specify.md +246 -0
- package/.codex/skills/speckit/references/tasks.md +155 -0
- package/.codex/skills/speckit/references/taskstoissues.md +33 -0
- package/.codex/skills/speckit/scripts/bash/check-prerequisites.sh +206 -0
- package/.codex/skills/speckit/scripts/bash/common.sh +191 -0
- package/.codex/skills/speckit/scripts/bash/create-new-feature.sh +259 -0
- package/.codex/skills/speckit/scripts/bash/extract-coded-points.sh +322 -0
- package/.codex/skills/speckit/scripts/bash/extract-spec-ids.sh +238 -0
- package/.codex/skills/speckit/scripts/bash/extract-tasks.sh +295 -0
- package/.codex/skills/speckit/scripts/bash/extract-user-stories.sh +312 -0
- package/.codex/skills/speckit/scripts/bash/setup-notes.sh +182 -0
- package/.codex/skills/speckit/scripts/bash/setup-plan.sh +110 -0
- package/.codex/skills/speckit/scripts/bash/show-todo-tasks.sh +257 -0
- package/.codex/skills/speckit/scripts/bash/spec-group-checklist.sh +402 -0
- package/.codex/skills/speckit/scripts/bash/spec-group-members.sh +215 -0
- package/.codex/skills/speckit/scripts/bash/spec-registry-graph.sh +399 -0
- package/.specify/memory/constitution.md +67 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +49 -0
- package/.specify/templates/plan-template.md +126 -0
- package/.specify/templates/spec-template.md +135 -0
- package/.specify/templates/tasks-template.md +269 -0
- package/README.md +128 -0
- package/README.zh-CN.md +127 -0
- package/bun.lock +269 -0
- package/dist/cli/commands/codex/forkHome.js +88 -0
- package/dist/cli/commands/codex/send.js +55 -0
- package/dist/cli/commands/codex/sessionInfo.js +42 -0
- package/dist/cli/commands/codex/spawn.js +68 -0
- package/dist/cli/commands/find.js +26 -0
- package/dist/cli/commands/paneKill.js +33 -0
- package/dist/cli/commands/paneSpawn.js +40 -0
- package/dist/cli/commands/paneTitle.js +33 -0
- package/dist/cli/commands/read.js +34 -0
- package/dist/cli/commands/send.js +51 -0
- package/dist/cli/commands/snapshot.js +19 -0
- package/dist/cli/commands/ui/select.js +41 -0
- package/dist/cli/commands/windowKill.js +25 -0
- package/dist/cli/commands/windowLs.js +15 -0
- package/dist/cli/commands/windowNew.js +28 -0
- package/dist/cli/commands/windowRename.js +25 -0
- package/dist/cli/index.js +365 -0
- package/dist/cli/parse.js +39 -0
- package/dist/lib/codex/forkHome.js +101 -0
- package/dist/lib/codex/isCodexPane.js +55 -0
- package/dist/lib/codex/send.js +58 -0
- package/dist/lib/codex/sessionInfo.js +449 -0
- package/dist/lib/codex/spawn.js +246 -0
- package/dist/lib/contracts/types.js +2 -0
- package/dist/lib/fs/safeRm.js +32 -0
- package/dist/lib/io/readStdin.js +14 -0
- package/dist/lib/os/process.js +55 -0
- package/dist/lib/output/format.js +95 -0
- package/dist/lib/proc/lsof.js +42 -0
- package/dist/lib/proc/ps.js +60 -0
- package/dist/lib/targeting/errors.js +13 -0
- package/dist/lib/targeting/resolvePaneTarget.js +91 -0
- package/dist/lib/targeting/resolveWindowTarget.js +40 -0
- package/dist/lib/targeting/scope.js +58 -0
- package/dist/lib/tmux/capturePane.js +20 -0
- package/dist/lib/tmux/exec.js +66 -0
- package/dist/lib/tmux/paneOps.js +29 -0
- package/dist/lib/tmux/paste.js +23 -0
- package/dist/lib/tmux/sendKeys.js +47 -0
- package/dist/lib/tmux/session.js +29 -0
- package/dist/lib/tmux/snapshotPanes.js +46 -0
- package/dist/lib/tmux/snapshotWindows.js +24 -0
- package/dist/lib/tmux/windowOps.js +32 -0
- package/dist/lib/ui/popupSelect.js +432 -0
- package/dist/lib/ui/popupSupport.js +76 -0
- package/package.json +23 -0
- package/src/cli/commands/codex/forkHome.ts +141 -0
- package/src/cli/commands/codex/send.ts +83 -0
- package/src/cli/commands/codex/sessionInfo.ts +59 -0
- package/src/cli/commands/codex/spawn.ts +90 -0
- package/src/cli/commands/find.ts +40 -0
- package/src/cli/commands/paneKill.ts +49 -0
- package/src/cli/commands/paneSpawn.ts +53 -0
- package/src/cli/commands/paneTitle.ts +50 -0
- package/src/cli/commands/read.ts +48 -0
- package/src/cli/commands/send.ts +71 -0
- package/src/cli/commands/snapshot.ts +28 -0
- package/src/cli/commands/ui/select.ts +49 -0
- package/src/cli/commands/windowKill.ts +35 -0
- package/src/cli/commands/windowLs.ts +20 -0
- package/src/cli/commands/windowNew.ts +40 -0
- package/src/cli/commands/windowRename.ts +36 -0
- package/src/cli/index.ts +430 -0
- package/src/lib/codex/forkHome.ts +148 -0
- package/src/lib/codex/isCodexPane.ts +56 -0
- package/src/lib/codex/send.ts +84 -0
- package/src/lib/codex/sessionInfo.ts +521 -0
- package/src/lib/codex/spawn.ts +305 -0
- package/src/lib/contracts/types.ts +30 -0
- package/src/lib/fs/safeRm.ts +32 -0
- package/src/lib/io/readStdin.ts +11 -0
- package/src/lib/output/format.ts +105 -0
- package/src/lib/proc/lsof.ts +44 -0
- package/src/lib/proc/ps.ts +70 -0
- package/src/lib/targeting/errors.ts +25 -0
- package/src/lib/targeting/resolvePaneTarget.ts +106 -0
- package/src/lib/targeting/resolveWindowTarget.ts +45 -0
- package/src/lib/targeting/scope.ts +76 -0
- package/src/lib/tmux/capturePane.ts +21 -0
- package/src/lib/tmux/exec.ts +90 -0
- package/src/lib/tmux/paneOps.ts +35 -0
- package/src/lib/tmux/paste.ts +20 -0
- package/src/lib/tmux/sendKeys.ts +72 -0
- package/src/lib/tmux/session.ts +27 -0
- package/src/lib/tmux/snapshotPanes.ts +52 -0
- package/src/lib/tmux/snapshotWindows.ts +23 -0
- package/src/lib/tmux/windowOps.ts +43 -0
- package/src/lib/ui/popupSelect.ts +561 -0
- package/src/lib/ui/popupSupport.ts +84 -0
- package/tests/e2e/codexForkHome.test.ts +146 -0
- package/tests/e2e/codexSessionInfo.test.ts +112 -0
- package/tests/e2e/codexTuiSend.test.ts +68 -0
- package/tests/integration/codexSpawn.test.ts +113 -0
- package/tests/integration/paneOps.test.ts +60 -0
- package/tests/integration/sendRead.test.ts +52 -0
- package/tests/integration/snapshot.test.ts +39 -0
- package/tests/integration/tmuxHarness.ts +39 -0
- package/tests/integration/windowOps.test.ts +60 -0
- package/tests/unit/codexSend.test.ts +105 -0
- package/tests/unit/codexSessionInfo.test.ts +88 -0
- package/tests/unit/codexSpawn.test.ts +34 -0
- package/tests/unit/keys.test.ts +30 -0
- package/tests/unit/outputFormat.test.ts +52 -0
- package/tests/unit/popupSelect.test.ts +77 -0
- package/tests/unit/popupSupport.test.ts +109 -0
- package/tests/unit/resolvePaneTarget.test.ts +43 -0
- package/tests/unit/resolveWindowTarget.test.ts +36 -0
- package/tests/unit/safeRm.test.ts +41 -0
- package/tests/unit/scope.test.ts +57 -0
- package/tsconfig.json +14 -0
- package/vitest.config.ts +16 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paneKillCommand = paneKillCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const resolvePaneTarget_1 = require("../../lib/targeting/resolvePaneTarget");
|
|
7
|
+
const snapshotPanes_1 = require("../../lib/tmux/snapshotPanes");
|
|
8
|
+
const paneOps_1 = require("../../lib/tmux/paneOps");
|
|
9
|
+
function isPaneIdTarget(target) {
|
|
10
|
+
return target.startsWith("%") || /^@[^%]+%[^%]+$/.test(target);
|
|
11
|
+
}
|
|
12
|
+
async function paneKillCommand(target, options = {}) {
|
|
13
|
+
if (!target) {
|
|
14
|
+
throw new Error("pane kill requires <paneTarget>");
|
|
15
|
+
}
|
|
16
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
17
|
+
let windowId;
|
|
18
|
+
if (!isPaneIdTarget(target)) {
|
|
19
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
20
|
+
windowId = window.wid;
|
|
21
|
+
}
|
|
22
|
+
const panes = await (0, snapshotPanes_1.snapshotPanes)({ session: scope.session });
|
|
23
|
+
const resolved = (0, resolvePaneTarget_1.resolvePaneTarget)(panes, target, { windowId });
|
|
24
|
+
await (0, paneOps_1.paneKill)(resolved.id);
|
|
25
|
+
if (options.json) {
|
|
26
|
+
return (0, format_1.formatJson)({
|
|
27
|
+
requested: { target },
|
|
28
|
+
resolved: { id: resolved.id, ...(resolved.idx !== undefined ? { idx: resolved.idx } : {}) },
|
|
29
|
+
killed: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return resolved.id;
|
|
33
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paneSpawnCommand = paneSpawnCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const readStdin_1 = require("../../lib/io/readStdin");
|
|
6
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
7
|
+
const paneOps_1 = require("../../lib/tmux/paneOps");
|
|
8
|
+
const exec_1 = require("../../lib/tmux/exec");
|
|
9
|
+
const paste_1 = require("../../lib/tmux/paste");
|
|
10
|
+
async function paneSpawnCommand(commandArg, options = {}) {
|
|
11
|
+
if (!commandArg) {
|
|
12
|
+
throw new Error("pane spawn requires <command>");
|
|
13
|
+
}
|
|
14
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
15
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
16
|
+
let command = commandArg;
|
|
17
|
+
if (commandArg === "-") {
|
|
18
|
+
command = await (0, readStdin_1.readStdin)();
|
|
19
|
+
}
|
|
20
|
+
const created = await (0, paneOps_1.paneSpawn)(window.wid);
|
|
21
|
+
const title = options.title?.trim() || undefined;
|
|
22
|
+
if (command) {
|
|
23
|
+
await (0, paste_1.pasteText)(created.id, command);
|
|
24
|
+
await (0, exec_1.tmuxExec)(["send-keys", "-t", created.id, "Enter"]);
|
|
25
|
+
}
|
|
26
|
+
if (title) {
|
|
27
|
+
await (0, paneOps_1.paneTitle)(created.id, title);
|
|
28
|
+
}
|
|
29
|
+
if (options.json) {
|
|
30
|
+
return (0, format_1.formatJson)({
|
|
31
|
+
created: {
|
|
32
|
+
id: created.id,
|
|
33
|
+
idx: created.idx,
|
|
34
|
+
command,
|
|
35
|
+
title: title ?? ""
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return created.id;
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paneTitleCommand = paneTitleCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const resolvePaneTarget_1 = require("../../lib/targeting/resolvePaneTarget");
|
|
7
|
+
const snapshotPanes_1 = require("../../lib/tmux/snapshotPanes");
|
|
8
|
+
const paneOps_1 = require("../../lib/tmux/paneOps");
|
|
9
|
+
function isPaneIdTarget(target) {
|
|
10
|
+
return target.startsWith("%") || /^@[^%]+%[^%]+$/.test(target);
|
|
11
|
+
}
|
|
12
|
+
async function paneTitleCommand(target, title, options = {}) {
|
|
13
|
+
if (!target || !title) {
|
|
14
|
+
throw new Error("pane title requires <paneTarget> <title>");
|
|
15
|
+
}
|
|
16
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
17
|
+
let windowId;
|
|
18
|
+
if (!isPaneIdTarget(target)) {
|
|
19
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
20
|
+
windowId = window.wid;
|
|
21
|
+
}
|
|
22
|
+
const panes = await (0, snapshotPanes_1.snapshotPanes)({ session: scope.session });
|
|
23
|
+
const resolved = (0, resolvePaneTarget_1.resolvePaneTarget)(panes, target, { windowId });
|
|
24
|
+
await (0, paneOps_1.paneTitle)(resolved.id, title);
|
|
25
|
+
if (options.json) {
|
|
26
|
+
return (0, format_1.formatJson)({
|
|
27
|
+
requested: { target, title },
|
|
28
|
+
resolved: { id: resolved.id, ...(resolved.idx !== undefined ? { idx: resolved.idx } : {}) },
|
|
29
|
+
updated: { title }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return resolved.id;
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.read = read;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const resolvePaneTarget_1 = require("../../lib/targeting/resolvePaneTarget");
|
|
7
|
+
const snapshotPanes_1 = require("../../lib/tmux/snapshotPanes");
|
|
8
|
+
const capturePane_1 = require("../../lib/tmux/capturePane");
|
|
9
|
+
function isPaneIdTarget(target) {
|
|
10
|
+
return target.startsWith("%") || /^@[^%]+%[^%]+$/.test(target);
|
|
11
|
+
}
|
|
12
|
+
async function read(target, options = {}) {
|
|
13
|
+
if (!target) {
|
|
14
|
+
throw new Error("read requires <paneTarget>");
|
|
15
|
+
}
|
|
16
|
+
const lineCount = Math.max(1, Math.floor(options.lines ?? 20));
|
|
17
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
18
|
+
let windowId;
|
|
19
|
+
if (!isPaneIdTarget(target)) {
|
|
20
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
21
|
+
windowId = window.wid;
|
|
22
|
+
}
|
|
23
|
+
const panes = await (0, snapshotPanes_1.snapshotPanes)({ session: scope.session });
|
|
24
|
+
const resolved = (0, resolvePaneTarget_1.resolvePaneTarget)(panes, target, { windowId });
|
|
25
|
+
const text = await (0, capturePane_1.capturePane)(resolved.id, lineCount);
|
|
26
|
+
if (options.json) {
|
|
27
|
+
return (0, format_1.formatJson)({
|
|
28
|
+
requested: { target, lines: lineCount },
|
|
29
|
+
resolved: { id: resolved.id, ...(resolved.idx !== undefined ? { idx: resolved.idx } : {}) },
|
|
30
|
+
lines: (0, capturePane_1.splitLines)(text)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.send = send;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const readStdin_1 = require("../../lib/io/readStdin");
|
|
6
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
7
|
+
const resolvePaneTarget_1 = require("../../lib/targeting/resolvePaneTarget");
|
|
8
|
+
const snapshotPanes_1 = require("../../lib/tmux/snapshotPanes");
|
|
9
|
+
const sendKeys_1 = require("../../lib/tmux/sendKeys");
|
|
10
|
+
const isCodexPane_1 = require("../../lib/codex/isCodexPane");
|
|
11
|
+
function isPaneIdTarget(target) {
|
|
12
|
+
return target.startsWith("%") || /^@[^%]+%[^%]+$/.test(target);
|
|
13
|
+
}
|
|
14
|
+
async function send(target, textArg, options = {}) {
|
|
15
|
+
if (!target || !textArg) {
|
|
16
|
+
throw new Error("send requires <paneTarget> <text>");
|
|
17
|
+
}
|
|
18
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
19
|
+
let windowId;
|
|
20
|
+
if (!isPaneIdTarget(target)) {
|
|
21
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
22
|
+
windowId = window.wid;
|
|
23
|
+
}
|
|
24
|
+
const panes = await (0, snapshotPanes_1.snapshotPanes)({ session: scope.session });
|
|
25
|
+
const resolved = (0, resolvePaneTarget_1.resolvePaneTarget)(panes, target, { windowId });
|
|
26
|
+
const text = textArg === "-" ? await (0, readStdin_1.readStdin)() : textArg;
|
|
27
|
+
const noEnter = Boolean(options.noEnter);
|
|
28
|
+
const explicitEnterDelayMs = options.enterDelayMs !== undefined ? Math.max(0, Math.floor(options.enterDelayMs)) : undefined;
|
|
29
|
+
const resolvedPane = panes.find((pane) => pane.id === resolved.id);
|
|
30
|
+
let enterDelayMs = 0;
|
|
31
|
+
if (!noEnter) {
|
|
32
|
+
if (explicitEnterDelayMs !== undefined) {
|
|
33
|
+
enterDelayMs = explicitEnterDelayMs;
|
|
34
|
+
}
|
|
35
|
+
else if (resolvedPane) {
|
|
36
|
+
enterDelayMs = (await (0, isCodexPane_1.isCodexPane)(resolvedPane)) ? 250 : 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const sent = await (0, sendKeys_1.sendKeys)(resolved.id, text, {
|
|
40
|
+
noEnter,
|
|
41
|
+
enterDelayMs
|
|
42
|
+
});
|
|
43
|
+
if (options.json) {
|
|
44
|
+
return (0, format_1.formatJson)({
|
|
45
|
+
requested: { target },
|
|
46
|
+
resolved: { id: resolved.id, ...(resolved.idx !== undefined ? { idx: resolved.idx } : {}) },
|
|
47
|
+
sent
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return resolved.id;
|
|
51
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.snapshot = snapshot;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const snapshotPanes_1 = require("../../lib/tmux/snapshotPanes");
|
|
7
|
+
async function snapshot(options = {}) {
|
|
8
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
9
|
+
const window = await (0, scope_1.resolveWindowScope)(scope.session, options.window?.trim() || undefined);
|
|
10
|
+
const panes = await (0, snapshotPanes_1.snapshotPanes)({ windowId: window.wid });
|
|
11
|
+
if (options.json) {
|
|
12
|
+
return (0, format_1.formatJson)({
|
|
13
|
+
session: { name: scope.session },
|
|
14
|
+
window: { widx: window.widx, wid: window.wid, name: window.name },
|
|
15
|
+
panes
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return (0, format_1.formatPaneTable)(panes);
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uiSelectCommand = uiSelectCommand;
|
|
4
|
+
const format_1 = require("../../../lib/output/format");
|
|
5
|
+
const readStdin_1 = require("../../../lib/io/readStdin");
|
|
6
|
+
const popupSelect_1 = require("../../../lib/ui/popupSelect");
|
|
7
|
+
function parseJsonObject(raw) {
|
|
8
|
+
let parsed;
|
|
9
|
+
try {
|
|
10
|
+
parsed = JSON.parse(raw);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
throw new Error("spec must be valid JSON");
|
|
14
|
+
}
|
|
15
|
+
if (!parsed || typeof parsed !== "object") {
|
|
16
|
+
throw new Error("spec must be a JSON object");
|
|
17
|
+
}
|
|
18
|
+
return parsed;
|
|
19
|
+
}
|
|
20
|
+
async function uiSelectCommand(options) {
|
|
21
|
+
const specArg = String(options.spec || "").trim();
|
|
22
|
+
if (!specArg) {
|
|
23
|
+
throw new Error("ui select requires --spec -");
|
|
24
|
+
}
|
|
25
|
+
if (specArg !== "-") {
|
|
26
|
+
throw new Error("spec must be '-' to read from stdin");
|
|
27
|
+
}
|
|
28
|
+
const spec = parseJsonObject(await (0, readStdin_1.readStdin)());
|
|
29
|
+
const result = await (0, popupSelect_1.popupSelect)(spec);
|
|
30
|
+
const selectedValues = result.customInput && result.customInput.trim()
|
|
31
|
+
? [result.customInput.trim()]
|
|
32
|
+
: result.selectedValues;
|
|
33
|
+
if (options.json) {
|
|
34
|
+
return (0, format_1.formatJson)({
|
|
35
|
+
mode: result.mode,
|
|
36
|
+
selected: { values: selectedValues },
|
|
37
|
+
...(result.customInput ? { custom_input: result.customInput, custom_input_via: result.customInputVia } : {})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return selectedValues.join("\n");
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.windowKillCommand = windowKillCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const resolveWindowTarget_1 = require("../../lib/targeting/resolveWindowTarget");
|
|
7
|
+
const snapshotWindows_1 = require("../../lib/tmux/snapshotWindows");
|
|
8
|
+
const windowOps_1 = require("../../lib/tmux/windowOps");
|
|
9
|
+
async function windowKillCommand(target, options = {}) {
|
|
10
|
+
if (!target) {
|
|
11
|
+
throw new Error("window kill requires <windowTarget>");
|
|
12
|
+
}
|
|
13
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
14
|
+
const windows = await (0, snapshotWindows_1.snapshotWindows)(scope.session);
|
|
15
|
+
const resolved = (0, resolveWindowTarget_1.resolveWindowTarget)(windows, target);
|
|
16
|
+
await (0, windowOps_1.windowKill)(resolved.wid);
|
|
17
|
+
if (options.json) {
|
|
18
|
+
return (0, format_1.formatJson)({
|
|
19
|
+
requested: { target },
|
|
20
|
+
resolved: { wid: resolved.wid, widx: resolved.widx },
|
|
21
|
+
killed: true
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return resolved.wid;
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.windowLs = windowLs;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const snapshotWindows_1 = require("../../lib/tmux/snapshotWindows");
|
|
7
|
+
async function windowLs(options = {}) {
|
|
8
|
+
const session = String(options.session ?? "");
|
|
9
|
+
const scope = await (0, scope_1.resolveSessionScope)(session.trim() || undefined);
|
|
10
|
+
const windows = await (0, snapshotWindows_1.snapshotWindows)(scope.session);
|
|
11
|
+
if (options.json) {
|
|
12
|
+
return (0, format_1.formatJson)({ session: { name: scope.session }, windows });
|
|
13
|
+
}
|
|
14
|
+
return (0, format_1.formatWindowTable)(windows);
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.windowNewCommand = windowNewCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const readStdin_1 = require("../../lib/io/readStdin");
|
|
6
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
7
|
+
const exec_1 = require("../../lib/tmux/exec");
|
|
8
|
+
const paste_1 = require("../../lib/tmux/paste");
|
|
9
|
+
const windowOps_1 = require("../../lib/tmux/windowOps");
|
|
10
|
+
async function windowNewCommand(name, options = {}) {
|
|
11
|
+
if (!name) {
|
|
12
|
+
throw new Error("window new requires <name>");
|
|
13
|
+
}
|
|
14
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
15
|
+
let command = options.command?.trim() || undefined;
|
|
16
|
+
if (command === "-") {
|
|
17
|
+
command = await (0, readStdin_1.readStdin)();
|
|
18
|
+
}
|
|
19
|
+
const created = await (0, windowOps_1.windowNew)(scope.session, name);
|
|
20
|
+
if (command) {
|
|
21
|
+
await (0, paste_1.pasteText)(created.paneId, command);
|
|
22
|
+
await (0, exec_1.tmuxExec)(["send-keys", "-t", created.paneId, "Enter"]);
|
|
23
|
+
}
|
|
24
|
+
if (options.json) {
|
|
25
|
+
return (0, format_1.formatJson)({ created: { wid: created.wid, widx: created.widx, name: created.name } });
|
|
26
|
+
}
|
|
27
|
+
return created.wid;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.windowRenameCommand = windowRenameCommand;
|
|
4
|
+
const format_1 = require("../../lib/output/format");
|
|
5
|
+
const scope_1 = require("../../lib/targeting/scope");
|
|
6
|
+
const resolveWindowTarget_1 = require("../../lib/targeting/resolveWindowTarget");
|
|
7
|
+
const snapshotWindows_1 = require("../../lib/tmux/snapshotWindows");
|
|
8
|
+
const windowOps_1 = require("../../lib/tmux/windowOps");
|
|
9
|
+
async function windowRenameCommand(target, name, options = {}) {
|
|
10
|
+
if (!target || !name) {
|
|
11
|
+
throw new Error("window rename requires <windowTarget> <name>");
|
|
12
|
+
}
|
|
13
|
+
const scope = await (0, scope_1.resolveSessionScope)(options.session?.trim() || undefined);
|
|
14
|
+
const windows = await (0, snapshotWindows_1.snapshotWindows)(scope.session);
|
|
15
|
+
const resolved = (0, resolveWindowTarget_1.resolveWindowTarget)(windows, target);
|
|
16
|
+
await (0, windowOps_1.windowRename)(resolved.wid, name);
|
|
17
|
+
if (options.json) {
|
|
18
|
+
return (0, format_1.formatJson)({
|
|
19
|
+
requested: { target, name },
|
|
20
|
+
resolved: { wid: resolved.wid, widx: resolved.widx },
|
|
21
|
+
renamed: { name }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return resolved.wid;
|
|
25
|
+
}
|