vde-layout
Version:
Terminal multiplexer layout management tool for VDE (Vibe Coding Development Environment)
58 lines • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RealExecutor = void 0;
const execa_1 = require("execa");
const errors_1 = require("../utils/errors");
const logger_1 = require("../utils/logger");
class RealExecutor {
verbose;
logger;
constructor(options = {}) {
this.verbose = options.verbose ?? false;
this.logger = new logger_1.Logger({
level: this.verbose ? logger_1.LogLevel.INFO : logger_1.LogLevel.WARN,
prefix: "[tmux]",
});
}
async execute(commandOrArgs) {
const args = this.parseCommand(commandOrArgs);
const commandString = this.getCommandString(args);
this.logCommand(commandString);
try {
const result = await (0, execa_1.execa)("tmux", args);
return result.stdout;
}
catch (error) {
const execaError = error;
throw new errors_1.TmuxError("Failed to execute tmux command", errors_1.ErrorCodes.TMUX_COMMAND_FAILED, {
command: commandString,
exitCode: execaError.exitCode,
stderr: execaError.stderr,
});
}
}
async executeMany(commandsList) {
for (const args of commandsList) {
await this.execute(args);
}
}
isDryRun() {
return false;
}
logCommand(command) {
this.logger.info(`Executing: ${command}`);
}
parseCommand(commandOrArgs) {
return typeof commandOrArgs === "string"
? commandOrArgs
.split(" ")
.filter((s) => s.length > 0)
.slice(1)
: commandOrArgs;
}
getCommandString(args) {
return ["tmux", ...args].join(" ");
}
}
exports.RealExecutor = RealExecutor;
//# sourceMappingURL=real-executor.js.map