diff --git a/nose/bin/ls.ts b/nose/bin/ls.ts
new file mode 100644
index 0000000..66e7929
--- /dev/null
+++ b/nose/bin/ls.ts
@@ -0,0 +1,27 @@
+import { readdirSync } from "fs"
+import { NOSE_USR, NOSE_USR_WWW } from "@/config"
+import { Thread } from "@/shell"
+import { appPath } from "@/webapp"
+
+export default function () {
+ const state = Thread.getStore()
+ if (!state) return "error: no state"
+
+ const project = state.project
+ if (!project) return "no project loaded"
+
+ const root = appPath(project)
+ if (!root) return "error loading project"
+
+ let files: string[] = []
+
+ for (const file of readdirSync(root, { withFileTypes: true })) {
+ files.push(file.name)
+ }
+
+ if (root === NOSE_USR_WWW) {
+ files = files.filter(file => file.endsWith(`${project}.ts`) || file.endsWith(`${project}.tsx`))
+ }
+
+ return `* project: ${project}\n` + files.join(" ")
+}
\ No newline at end of file
diff --git a/src/css/terminal.css b/src/css/terminal.css
index 824ff14..a3d378a 100644
--- a/src/css/terminal.css
+++ b/src/css/terminal.css
@@ -97,4 +97,8 @@
#scrollback .input .content {
margin-left: var(--cli-status-width);
+}
+
+#scrollback .output {
+ white-space: pre-wrap;
}
\ No newline at end of file
diff --git a/src/server.tsx b/src/server.tsx
index 7ec2900..ec796fa 100644
--- a/src/server.tsx
+++ b/src/server.tsx
@@ -119,7 +119,7 @@ app.get("/apps", c => {
app.get("/", c => c.html())
//
-// hot mode cleanup
+// hot reload mode cleanup
//
if (process.env.BUN_HOT) {
@@ -143,7 +143,6 @@ if (process.env.BUN_HOT) {
}
-
//
// server start
//
diff --git a/src/webapp.ts b/src/webapp.ts
index 22e3cd8..3967cff 100644
--- a/src/webapp.ts
+++ b/src/webapp.ts
@@ -1,10 +1,10 @@
import { type Context, Hono } from "hono"
import type { Child } from "hono/jsx"
import { renderToString } from "hono/jsx/dom/server"
-import { join } from "path"
+import { join, dirname } from "path"
import { readdirSync, watch } from "fs"
import { NOSE_USR_WWW, NOSE_SYS_WWW } from "./config"
-import { expectDir } from "./utils"
+import { expectDir, isFile } from "./utils"
export type Handler = (r: Context) => string | Child | Response | Promise
export type App = Hono | Handler
@@ -32,6 +32,22 @@ export function apps(): string[] {
return apps.sort()
}
+export function appPath(name: string): string | undefined {
+ const path = [
+ `${name}.ts`,
+ `${name}.tsx`,
+ join(name, "index.ts"),
+ join(name, "index.tsx")
+ ]
+ .map(path => [join(NOSE_SYS_WWW, path), join(NOSE_USR_WWW, path)])
+ .flat()
+ .filter(path => isFile(path))[0]
+
+ if (!path) return
+
+ return dirname(path)
+}
+
async function findApp(name: string): Promise {
const paths = [
`${name}.ts`,