Compare commits
2 Commits
090049c08c
...
0b2f73eafa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b2f73eafa | ||
|
|
d7dab69405 |
62
nose/CLAUDE.md
Normal file
62
nose/CLAUDE.md
Normal 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.
|
||||||
|
|
@ -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>"
|
||||||
|
try { gitSHA = (await $`git rev-parse --short HEAD`.text()).trim() } catch { }
|
||||||
|
export const GIT_SHA = gitSHA
|
||||||
; (globalThis as any).GIT_SHA = GIT_SHA
|
; (globalThis as any).GIT_SHA = GIT_SHA
|
||||||
|
|
||||||
|
export const BUN_BIN = untilde("~/.bun/bin/bun")
|
||||||
Loading…
Reference in New Issue
Block a user