AppView in a box as a Vite plugin thing hatk.dev
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: scaffold AGENTS.md in hatk new projects

Adds an AGENTS.md file to new projects created with `hatk new`, providing
AI coding assistants with project structure and CLI usage context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+41
+41
packages/hatk/src/cli.ts
··· 1336 1336 ) 1337 1337 } 1338 1338 1339 + writeFileSync( 1340 + join(dir, 'AGENTS.md'), 1341 + `# hatk project 1342 + 1343 + This is an AT Protocol application built with [hatk](https://github.com/hatk-dev/hatk). 1344 + Read the project's lexicons in \`lexicons/\` to understand the data model. 1345 + Types are generated from lexicons into \`hatk.generated.ts\` — never edit this file directly. 1346 + 1347 + ## Project structure 1348 + 1349 + | Directory | Purpose | 1350 + |-------------|------------------------------------------------------| 1351 + | \`lexicons/\` | AT Protocol lexicon schemas (JSON). Defines collections and XRPC methods | 1352 + | \`feeds/\` | Feed generators — each file exports a feed via \`defineFeed\` | 1353 + | \`xrpc/\` | XRPC method handlers — directory nesting maps to NSID segments | 1354 + | \`labels/\` | Label definitions and rules for moderation | 1355 + | \`setup/\` | Boot-time scripts (run before server starts). Prefix with numbers for ordering | 1356 + | \`seeds/\` | Test data seeding scripts for local development | 1357 + | \`hooks/\` | Lifecycle hooks (e.g. \`on-login.ts\`) | 1358 + | \`og/\` | OpenGraph image routes | 1359 + | \`jobs/\` | Periodic background tasks | 1360 + | \`test/\` | Test files (vitest). Run with \`hatk test\` | 1361 + | \`public/\` | Static files served at the root | 1362 + 1363 + ## Key files 1364 + 1365 + - \`hatk.config.ts\` — project configuration (see \`defineConfig\` for type info) 1366 + - \`hatk.generated.ts\` — auto-generated types and typed helpers. Regenerate with \`hatk generate types\` 1367 + 1368 + ## Commands 1369 + 1370 + Run \`npx hatk --help\` for the full list of commands. 1371 + 1372 + Use \`npx hatk generate\` to scaffold new feeds, xrpc handlers, labels, and lexicons 1373 + rather than creating files manually. These generate files with the correct imports 1374 + from \`hatk.generated.ts\`. 1375 + 1376 + After modifying lexicons, always run \`npx hatk generate types\` to update the generated types. 1377 + `, 1378 + ) 1379 + 1339 1380 console.log(`Created ${name}/`) 1340 1381 console.log(` hatk.config.ts`) 1341 1382 console.log(` lexicons/ — lexicon JSON files (core + your own)`)