Compare commits

..

4 Commits

Author SHA1 Message Date
Chris Wanstrath
7aa64cfdaa that too 2025-09-26 12:16:54 -07:00
Chris Wanstrath
489e023494 new deploy 2025-09-26 12:16:27 -07:00
Chris Wanstrath
7635dfc124 bun runner 2025-09-26 12:16:02 -07:00
Chris Wanstrath
75fca493e5 names 2025-09-26 12:15:45 -07:00
4 changed files with 36 additions and 3 deletions

View File

@ -4,6 +4,7 @@
"type": "module",
"private": true,
"scripts": {
"runner": "bun run src/runner.ts",
"start": "bun src/server.tsx",
"prod": "env NODE_ENV=production bun src/server.tsx",
"dev": "env BUN_HOT=1 bun --hot src/server.tsx",

View File

@ -8,5 +8,9 @@ ROOT_DIR="$SCRIPT_DIR/../.."
# Run deploy + config with absolute paths
source "$ROOT_DIR/app/scripts/config.sh"
# Make sure we're up-to-date
git push origin main
git push gitea main
# Run remote install on the target
ssh $HOST "cd $DEST && git pull && bun install && sudo systemctl restart nose-pluto.service"
ssh $HOST "cd $DEST && bun runner update"

28
app/src/runner.ts Normal file
View File

@ -0,0 +1,28 @@
////
// Runs a NOSE command in the NOSE environment
// Ex:
// $ bun runner greet Bob
// Hi, Bob!
import { runCommand } from "./shell"
const args = Bun.argv.slice(2)
if (!args.length) {
console.error("usage: runner <command> [args]")
process.exit(1)
}
const sessionId = ""
const taskId = ""
const result = await runCommand(sessionId, taskId, args.join(" "))
if (result.status === "ok")
console.log(result.output)
else if (result.status === "error")
console.error(result.output)
else
console.error("Unknown command result:", result)

View File

@ -11,7 +11,7 @@ import { ALS } from "./session"
const sessions: Map<string, Session> = new Map()
export async function runCommand(session: string, id: string, input: string): Promise<CommandResult> {
export async function runCommand(sessionId: string, taskId: string, input: string): Promise<CommandResult> {
const [cmd = "", ...args] = input.split(" ")
if (!commandExists(cmd)) {
@ -20,7 +20,7 @@ export async function runCommand(session: string, id: string, input: string): Pr
let status: "ok" | "error" = "ok"
let output: CommandOutput = ""
const state = getState(session, id)
const state = getState(sessionId, taskId)
try {
[status, output] = await ALS.run(state, async () => await exec(cmd, args))