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.

docs: update AGENTS.md template and remove job support

- Update AGENTS.md to reflect server/ directory, $hatk alias, SvelteKit
integration, and vp commands
- Remove generate job command, template, and directory mapping
- Remove jobs from all description strings

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

+55 -20
+55 -20
packages/hatk/src/cli.ts
··· 92 92 generate xrpc <nsid> Generate an XRPC handler 93 93 generate label <name> Generate a label definition 94 94 generate og <name> Generate an OpenGraph route 95 - generate job <name> Generate a periodic job 96 95 generate hook <name> Generate a lifecycle hook 97 96 generate setup <name> Generate a setup script 98 97 generate types Regenerate TypeScript types from lexicons ··· 192 191 }, 193 192 }, 194 193 } 195 - }, 196 - } 197 - `, 198 - job: (_name) => `export default { 199 - interval: 300, // seconds 200 - async run(_ctx: any) { 201 - // Periodic task logic here 202 194 }, 203 195 } 204 196 `, ··· 330 322 xrpc: 'server', 331 323 label: 'server', 332 324 og: 'server', 333 - job: 'server', 334 325 hook: 'server', 335 326 setup: 'server', 336 327 } ··· 1343 1334 ) 1344 1335 } 1345 1336 1346 - writeFileSync( 1347 - join(dir, 'AGENTS.md'), 1348 - `# hatk project 1337 + let agentsMd = `# hatk project 1349 1338 1350 1339 This is an AT Protocol application built with [hatk](https://github.com/hatk-dev/hatk). 1351 1340 Read the project's lexicons in \`lexicons/\` to understand the data model. ··· 1356 1345 | Directory | Purpose | 1357 1346 |-------------|------------------------------------------------------| 1358 1347 | \`lexicons/\` | AT Protocol lexicon schemas (JSON). Defines collections and XRPC methods | 1359 - | \`server/\` | All server-side code: feeds, XRPC handlers, hooks, labels, OG routes, jobs, setup scripts | 1348 + | \`server/\` | All server-side code: feeds, XRPC handlers, hooks, labels, OG routes, setup scripts | 1360 1349 | \`seeds/\` | Test data seeding scripts for local development | 1361 - | \`test/\` | Test files (vitest). Run with \`hatk test\` | 1350 + | \`test/\` | Test files (vitest). Run with \`vp test\` | 1362 1351 | \`public/\` | Static files served at the root | 1352 + ` 1353 + if (withSvelte) { 1354 + agentsMd += `| \`src/\` | SvelteKit frontend (routes, components, styles) | 1355 + 1356 + ` 1357 + } else { 1358 + agentsMd += ` 1359 + ` 1360 + } 1363 1361 1364 - ## Key files 1362 + agentsMd += `## Key files 1365 1363 1366 1364 - \`hatk.config.ts\` — project configuration (see \`defineConfig\` for type info) 1367 - - \`hatk.generated.ts\` — auto-generated types and typed helpers. Regenerate with \`hatk generate types\` 1365 + - \`hatk.generated.ts\` — auto-generated server types and helpers. Regenerate with \`hatk generate types\` 1366 + - \`hatk.generated.client.ts\` — auto-generated client-safe types and \`callXrpc\`. Never import \`hatk.generated.ts\` from frontend code 1368 1367 1368 + ## The \`$hatk\` alias 1369 + 1370 + Server files in \`server/\` import from \`$hatk\`: 1371 + \`\`\`ts 1372 + import { defineFeed, views, type Status } from "$hatk" 1373 + \`\`\` 1374 + ` 1375 + if (withSvelte) { 1376 + agentsMd += ` 1377 + SvelteKit routes and components import from \`$hatk/client\`: 1378 + \`\`\`ts 1379 + import { callXrpc, getViewer } from "$hatk/client" 1380 + \`\`\` 1381 + 1382 + \`$hatk\` resolves to \`hatk.generated.ts\` and \`$hatk/client\` to \`hatk.generated.client.ts\`. 1383 + The Vite plugin handles this in dev/build. In tests and production, a Node.js module resolve hook handles it. 1384 + ` 1385 + } else { 1386 + agentsMd += ` 1387 + \`$hatk\` resolves to \`hatk.generated.ts\`. The Vite plugin handles this in dev/build. 1388 + In tests and production, a Node.js module resolve hook handles it. 1389 + ` 1390 + } 1391 + 1392 + agentsMd += ` 1369 1393 ## Commands 1370 1394 1371 1395 Run \`npx hatk --help\` for the full list of commands. 1372 1396 1373 1397 Use \`npx hatk generate\` to scaffold new feeds, xrpc handlers, labels, and lexicons 1374 - rather than creating files manually. These generate files with the correct imports 1375 - from \`hatk.generated.ts\`. 1398 + rather than creating files manually. These generate files with the correct imports. 1376 1399 1377 1400 After modifying lexicons, always run \`npx hatk generate types\` to update the generated types. 1378 - `, 1401 + ` 1402 + if (withSvelte) { 1403 + agentsMd += ` 1404 + ## Running 1405 + 1406 + - \`vp dev\` — start dev server (hatk + SvelteKit + PDS) 1407 + - \`vp build\` — build for production (SvelteKit outputs to \`build/\`) 1408 + - \`hatk start\` — start production server (hatk + SvelteKit via \`build/handler.js\`) 1409 + - \`vp test\` — run tests 1410 + ` 1411 + } 1412 + 1413 + writeFileSync(join(dir, 'AGENTS.md'), agentsMd, 1379 1414 ) 1380 1415 1381 1416 console.log(`Created ${name}/`) 1382 1417 console.log(` hatk.config.ts`) 1383 1418 console.log(` lexicons/ — lexicon JSON files (core + your own)`) 1384 - console.log(` server/ — feeds, XRPC handlers, hooks, labels, OG routes, jobs, setup`) 1419 + console.log(` server/ — feeds, XRPC handlers, hooks, labels, OG routes, setup`) 1385 1420 console.log(` seeds/ — seed fixture data (hatk seed)`) 1386 1421 console.log(` test/ — test files (hatk test)`) 1387 1422 console.log(` public/ — static files`)