Skip to content

Commit d7ca183

Browse files
committed
doc site
1 parent 599163a commit d7ca183

72 files changed

Lines changed: 13457 additions & 10128 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# AGENTS
2+
3+
## Scope
4+
5+
These instructions apply to the entire repository rooted at this directory.
6+
7+
## Working Directory
8+
9+
- Repository root: `/Users/cblanquera/server/projects/stackpress/ingest`
10+
- Package workspace: `ingest/`
11+
- Example workspaces: `examples/*`
12+
13+
## Package Manager
14+
15+
- This project uses `yarn`, not `npm`.
16+
- Use `yarn` for installs, tests, builds, and workspace commands unless the user explicitly asks for something else.
17+
- Do not replace documented `yarn` commands with `npm` equivalents.
18+
19+
## Node.js Requirement
20+
21+
- Use Node.js `22` or newer for all installs, builds, tests, and scripts.
22+
- Prefer the newest available Node.js version when multiple `22.x` or newer versions are installed.
23+
- If the resolved Node.js version is lower than `22`, stop and switch to a compatible binary before continuing.
24+
25+
## Node.js Resolution Order
26+
27+
When you need a Node.js binary, resolve it in this order and stop at the first successful result:
28+
29+
1. Check whether `nvm` is installed.
30+
2. If `nvm` is installed, try to locate the `nvm` directory that contains installed Node.js versions.
31+
3. If the `nvm` directory cannot be located directly, try to use `nvm` itself to resolve a `22+` Node.js version.
32+
4. If `nvm` is not available or cannot produce a usable binary, check common OS-specific Node.js install paths.
33+
5. If common paths do not contain Node.js `22+`, inspect environment variables for a Node.js binary path.
34+
6. If no compatible Node.js binary is found after all checks, stop the task and ask the user for the Node.js location.
35+
36+
## Detailed Node.js Lookup Instructions
37+
38+
### 1. Check for `nvm`
39+
40+
- First check whether `nvm` is available in the shell.
41+
- If it is available, prefer Node.js binaries managed by `nvm`.
42+
43+
### 2. If `nvm` is available, locate the `nvm` directory
44+
45+
Check these locations and hints first:
46+
47+
- `NVM_DIR`
48+
- `$HOME/.nvm`
49+
- `$XDG_CONFIG_HOME/nvm`
50+
- `$HOME/.config/nvm`
51+
- Any shell profile entry that exports `NVM_DIR`
52+
53+
Once the directory is found, look for installed Node.js binaries under:
54+
55+
- `<nvm-dir>/versions/node/`
56+
57+
Choose the highest installed version that is `>= 22`.
58+
59+
### 3. If the `nvm` directory cannot be located, use `nvm` directly
60+
61+
Try to resolve Node.js through `nvm` commands instead of hard-coded paths. Prefer flows equivalent to:
62+
63+
- listing installed versions
64+
- selecting the newest installed `22+` version
65+
- using `nvm which` for that version
66+
67+
Do not install a new Node.js version unless the user explicitly asks for that.
68+
69+
### 4. If `nvm` is unavailable, check common OS paths
70+
71+
Check common Node.js binary locations for the current OS.
72+
73+
macOS and Linux common paths:
74+
75+
- `/usr/local/bin/node`
76+
- `/opt/homebrew/bin/node`
77+
- `/opt/local/bin/node`
78+
- `/usr/bin/node`
79+
80+
Windows common paths:
81+
82+
- `C:\Program Files\nodejs\node.exe`
83+
- `C:\Program Files (x86)\nodejs\node.exe`
84+
85+
Version-check any discovered binary and only use it if it is `>= 22`.
86+
87+
### 5. If common paths fail, inspect environment variables
88+
89+
Check environment variables that may expose a Node.js binary or installation root, including:
90+
91+
- `PATH`
92+
- `NODE_HOME`
93+
- `NODE_BIN`
94+
- `NVM_BIN`
95+
- other obvious project or shell variables that directly point to a Node.js executable
96+
97+
Only accept the result if the resolved binary reports version `22` or newer.
98+
99+
### 6. If still unresolved
100+
101+
- Stop the task.
102+
- Ask the user to provide the absolute path to a Node.js `22+` binary.
103+
104+
## Execution Rules
105+
106+
- Before running project scripts, confirm that `node --version` is `>= 22`.
107+
- When a command must use a specific Node.js binary, prefer invoking that binary directly instead of relying on an ambiguous shell `PATH`.
108+
- Do not downgrade Node.js for compatibility guesses.
109+
- Do not continue with a lower Node.js version just because commands appear to work.
110+
111+
## Repository Commands
112+
113+
From the repository root:
114+
115+
- Install dependencies: `yarn install`
116+
- Run tests: `yarn test`
117+
- Build package: `yarn build`
118+
119+
From the package workspace:
120+
121+
- Install dependencies: `yarn --cwd ingest install`
122+
- Run tests: `yarn --cwd ingest test`
123+
- Build package: `yarn --cwd ingest build`

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Ingest is a lightweight, flexible server framework that brings the familiar Expr
1717
- **🚀 Serverless-First**: Designed specifically for serverless environments while maintaining compatibility with traditional servers
1818
- **🔄 Event-Driven**: Built on a robust event system that enables reactive programming patterns
1919
- **🛣️ Multi-Routing Interface**: Four different routing approaches in one framework
20-
- **🔌 Plugin System**: Highly extensible with a simple plugin architecture
21-
- **📦 Build Support**: Exposes routing information for bundlers and build tools
20+
- **🔌 Plugin System**: Optional automatic wiring for routes, hooks, and shared services
21+
- **📦 Build Support**: Exposes routing information for build and deployment tooling
2222
- **🌐 Cross-Platform**: Works with Node.js HTTP, WHATWG Fetch, and various serverless platforms
2323

2424
## Installation
@@ -91,7 +91,7 @@ app.entry.get('/users', './routes/users.js');
9191
```
9292

9393
### 3. Import Router (Lazy Loading)
94-
Dynamic imports for code splitting:
94+
Dynamic imports for lazy loading and tooling-aware route boundaries:
9595

9696
```typescript
9797
app.import.get('/users', () => import('./routes/users.js'));
@@ -110,7 +110,7 @@ Ingest can automatically determine which router to use based on your input:
110110

111111
```typescript
112112
// Automatically uses action router
113-
app.get('/users', (req, res) => { /* handler */ });
113+
app.get('/users', ({ req, res }) => { /* handler */ });
114114

115115
// Automatically uses import router
116116
app.get('/users', () => import('./routes/users.js'));
@@ -121,14 +121,14 @@ app.get('/users', './views/users.hbs');
121121

122122
## Plugin System
123123

124-
Ingest features a powerful plugin system that allows you to modularize your application:
124+
Ingest includes an optional plugin system that can automate application wiring. You can still wire routes, handlers, and services manually in a main file if you prefer:
125125

126126
### Creating a Plugin
127127

128128
```typescript
129129
// src/plugins/auth.ts
130130
export default function authPlugin(server) {
131-
server.on('request', (req, res) => {
131+
server.on('request', ({ req, res }) => {
132132
// Add authentication logic
133133
if (!req.headers.get('authorization')) {
134134
res.setError('Unauthorized', {}, [], 401);
@@ -171,12 +171,12 @@ Ingest is built on a powerful event system that allows for reactive programming:
171171

172172
```typescript
173173
// Listen to all requests
174-
app.on('request', (req, res) => {
174+
app.on('request', ({ req, res }) => {
175175
console.log(`${req.method} ${req.url.pathname}`);
176176
});
177177

178178
// Listen to specific routes
179-
app.on('GET /api/users', (req, res) => {
179+
app.on('GET /api/users', ({ req, res }) => {
180180
// This runs for GET /api/users
181181
});
182182

@@ -238,7 +238,7 @@ export const handler = async (event, context) => {
238238

239239
## Build Support
240240

241-
Ingest exposes routing information that can be used by bundlers and build tools:
241+
Ingest exposes routing information that can be used by build and deployment tooling:
242242

243243
```typescript
244244
const app = server();
@@ -252,17 +252,20 @@ console.log(app.entries); // File entries
252252
console.log(app.views); // View templates
253253
```
254254

255-
This information can be used by bundlers to:
255+
This information can be used by tooling to:
256256
- Pre-bundle route modules
257257
- Generate static route manifests
258-
- Optimize code splitting
258+
- Discover import, entry, and view boundaries
259259
- Create deployment artifacts
260260

261261
## Documentation
262262

263-
- [API Reference](./docs/api/README.md) - Complete API documentation
264-
- [Examples](./docs/examples.md) - Comprehensive usage examples
265-
- [Plugin Development](./docs/plugin-development.md) - Guide to creating plugins
263+
- [Specifications](./specs/README.md) - Documentation index
264+
- [Overview](./specs/overview.md) - What Ingest is optimizing for
265+
- [Concepts](./specs/concepts/README.md) - How the system works
266+
- [Guides](./specs/guides/README.md) - Task-oriented documentation
267+
- [API Reference](./specs/api/README.md) - Exact class and method lookup
268+
- [Examples](./specs/examples.md) - Example workspace guide
266269

267270
## Examples
268271

context7.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)