initial commit

This commit is contained in:
Amrit Subramanian 2025-10-02 12:56:00 -04:00
commit bfc088fd9c
6 changed files with 3815 additions and 0 deletions

141
.gitignore vendored Normal file
View file

@ -0,0 +1,141 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.*
!.env.example
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
.output
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Sveltekit cache directory
.svelte-kit/
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# Firebase cache directory
.firebase/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Vite files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/

24
index.html Normal file
View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>FleetCode Terminal</title>
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
<style>
body {
margin: 0;
padding: 0;
background-color: #000;
font-family: monospace;
}
#terminal {
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<div id="terminal"></div>
<script src="renderer.js"></script>
</body>
</html>

59
main.js Normal file
View file

@ -0,0 +1,59 @@
const { app, BrowserWindow, ipcMain } = require("electron/main");
const pty = require("node-pty");
const os = require("os");
let ptyProcess;
const createWindow = () => {
const win = new BrowserWindow({
width: 1200,
height: 800,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});
win.loadFile("index.html");
// Create a new PTY process for the terminal
const shell = os.platform() === "darwin" ? "zsh" : "bash";
ptyProcess = pty.spawn(shell, [], {
name: "xterm-color",
cols: 80,
rows: 30,
cwd: process.env.HOME,
env: process.env,
});
// Send terminal output to the renderer
ptyProcess.onData((data) => {
win.webContents.send("terminal-output", data);
});
// Receive input from the renderer
ipcMain.on("terminal-input", (event, data) => {
ptyProcess.write(data);
});
// Handle terminal resize
ipcMain.on("terminal-resize", (event, cols, rows) => {
ptyProcess.resize(cols, rows);
});
};
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});

3525
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

22
package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "fleetcode",
"version": "1.0.0",
"description": "Run multiple CLI coding agents at once",
"main": "main.js",
"scripts": {
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "built-by-as",
"license": "ISC",
"devDependencies": {
"@electron/rebuild": "^4.0.1",
"electron": "^38.2.0",
"electron-rebuild": "^3.2.9"
},
"dependencies": {
"node-pty": "^1.0.0",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0"
}
}

44
renderer.js Normal file
View file

@ -0,0 +1,44 @@
const { ipcRenderer } = require("electron");
const { Terminal } = require("xterm");
const { FitAddon } = require("xterm-addon-fit");
// Create terminal instance
const term = new Terminal({
cursorBlink: true,
fontSize: 14,
fontFamily: 'Menlo, Monaco, "Courier New", monospace',
theme: {
background: "#000000",
foreground: "#ffffff",
},
});
// Create fit addon to make terminal fill the window
const fitAddon = new FitAddon();
term.loadAddon(fitAddon);
// Open terminal in the DOM
term.open(document.getElementById("terminal"));
fitAddon.fit();
// Handle terminal input
term.onData((data) => {
ipcRenderer.send("terminal-input", data);
});
// Handle terminal output from main process
ipcRenderer.on("terminal-output", (event, data) => {
term.write(data);
});
// Handle window resize
window.addEventListener("resize", () => {
fitAddon.fit();
ipcRenderer.send("terminal-resize", term.cols, term.rows);
});
// Initial resize
setTimeout(() => {
fitAddon.fit();
ipcRenderer.send("terminal-resize", term.cols, term.rows);
}, 100);