# 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.
