Compare commits

...

2 Commits

Author SHA1 Message Date
Chris Wanstrath
0b2f73eafa git might not be available 2025-10-10 14:57:34 -07:00
Chris Wanstrath
d7dab69405 maybe 2025-10-08 14:04:51 -07:00
2 changed files with 68 additions and 2 deletions

62
nose/CLAUDE.md Normal file
View File

@ -0,0 +1,62 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
This is a NOSE_DIR (user directory for NOSE - a browser-based terminal and server-based shell written in TypeScript). It contains multiple projects that can be accessed as subdomains.
## Project Structure
Each top-level directory represents a **project**. Projects are accessed via subdomains (e.g., `chris.nose-pluto.local` for the `chris` project).
### Project Anatomy
A project can contain:
- **`bin/`** - Commands executable from the NOSE terminal. Each `.ts` or `.tsx` file in `bin/` exports a default function that becomes a command.
- **`index.ts` or `index.tsx`** - Web application entry point. When present, the project serves as a webapp at its subdomain.
- **`pub/`** - Static files (HTML, CSS, images, etc.) served publicly by the web server.
- **`test/`** - Test files for the project.
### The Root Project
The **`root/`** project is special:
- Cannot be deleted
- Cannot host webapps or static files (no `index.ts/tsx` or `pub/` directory)
- Commands in `root/bin/` are globally available in all other projects
## Technology Stack
- **Runtime**: Bun (TypeScript runtime)
- **Web Framework**: Hono (lightweight web framework)
- **JSX Runtime**: Hono JSX (`jsxImportSource: "hono/jsx"`)
- **Language**: TypeScript with strict mode
## Type System
- `global.d.ts` defines a global `Context` type that aliases `HonoContext` from Hono
- TSConfig uses path aliases pointing to central NOSE installation at `/home/nose/.nose/src/`:
- `@utils``/home/nose/.nose/src/utils.tsx`
- `@/*``/home/nose/.nose/src/*`
## Creating New Projects
To create a new project, use the `mkproject` command in your NOSE terminal.
## Web Application Patterns
Web apps export default functions that:
- Receive a Hono `Context` parameter (typed globally as `Context`)
- Return strings, JSX, or Response objects
- Can use Hono JSX for rendering HTML
Example:
```tsx
export default (c: Context) =>
<html><body>Hello World</body></html>
```
## Commands
Commands in `bin/` directories export default functions that return strings or JSX to be displayed in the NOSE terminal.

View File

@ -13,5 +13,9 @@ export const NOSE_ROOT_BIN = join(NOSE_DIR, DEFAULT_PROJECT, "bin")
export const NOSE_STARTED = Date.now() export const NOSE_STARTED = Date.now()
export const GIT_SHA = (await $`git rev-parse --short HEAD`.text()).trim() let gitSHA = "<development>"
; (globalThis as any).GIT_SHA = GIT_SHA try { gitSHA = (await $`git rev-parse --short HEAD`.text()).trim() } catch { }
export const GIT_SHA = gitSHA
; (globalThis as any).GIT_SHA = GIT_SHA
export const BUN_BIN = untilde("~/.bun/bin/bun")