nuxt-agent-md 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/dist/cli.js +3 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,16 +18,14 @@ nuxt-agent-md
|
|
|
18
18
|
## What it does
|
|
19
19
|
|
|
20
20
|
1. Detects your Nuxt version from `package.json`
|
|
21
|
-
2. Downloads the corresponding `@nuxt/docs` documentation (~1.5 MB)
|
|
22
|
-
3. Generates a
|
|
23
|
-
4. Creates/updates `AGENTS.md` with the index
|
|
21
|
+
2. Downloads the corresponding `@nuxt/docs` documentation (~1.5 MB) to `.nuxt-docs/`
|
|
22
|
+
3. Generates a compact pipe-delimited index pointing to the downloaded docs
|
|
23
|
+
4. Creates/updates `AGENTS.md` with a directive instruction and the index
|
|
24
24
|
5. Creates `CLAUDE.md` that references `@AGENTS.md`
|
|
25
25
|
|
|
26
|
-
The index
|
|
26
|
+
The generated `AGENTS.md` is intentionally minimal — a short directive telling the agent to read the docs, followed by a file index. No inline API summaries or pattern guides are included, so the agent is forced to consult the actual documentation files rather than relying on stale training data.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
CATEGORY|path/to/file.md|keyword1,keyword2,keyword3
|
|
30
|
-
```
|
|
28
|
+
This follows [Vercel's finding](https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals) that passive context with retrieval-led reasoning outperforms both skills and inline knowledge.
|
|
31
29
|
|
|
32
30
|
## Options
|
|
33
31
|
|
|
@@ -65,13 +63,19 @@ The tool generates:
|
|
|
65
63
|
2. `AGENTS.md` - File with documentation index (wrapped in `<!-- BEGIN:nuxt-agent-rules -->` markers)
|
|
66
64
|
3. `CLAUDE.md` - File that references `@AGENTS.md` for Claude Code/Cursor compatibility
|
|
67
65
|
|
|
68
|
-
##
|
|
66
|
+
## How it works
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
The key insight from [Vercel's research](https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals) is that agents perform best when given a directive to read docs rather than inline knowledge they can use as a shortcut. The generated `AGENTS.md` contains:
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
```markdown
|
|
71
|
+
# Nuxt: ALWAYS read docs before coding
|
|
72
|
+
|
|
73
|
+
This project uses Nuxt v4.x.x. Before any Nuxt work, find and read
|
|
74
|
+
the relevant doc in `.nuxt-docs/`. Your training data may be outdated
|
|
75
|
+
— the docs are the source of truth.
|
|
76
|
+
```
|
|
73
77
|
|
|
74
|
-
|
|
78
|
+
Followed by a compact index mapping categories to doc file paths. The agent sees the index, knows where to find specific docs, and reads the actual files when needed.
|
|
75
79
|
|
|
76
80
|
## License
|
|
77
81
|
|
package/dist/cli.js
CHANGED
|
@@ -276,58 +276,20 @@ function generateClaudeMd(agentsMdPath) {
|
|
|
276
276
|
writeFileSync(claudeMdPath, claudeMdContent, "utf-8");
|
|
277
277
|
}
|
|
278
278
|
function generateNuxtSection(index, nuxtVersion, docsDir, minify) {
|
|
279
|
-
const majorVersion = nuxtVersion.split(".")[0];
|
|
280
279
|
return `${START_MARKER}
|
|
281
|
-
## Nuxt Documentation
|
|
282
280
|
|
|
283
|
-
|
|
281
|
+
# Nuxt: ALWAYS read docs before coding
|
|
284
282
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
### Quick Reference Index
|
|
283
|
+
This project uses Nuxt v${nuxtVersion}. Before any Nuxt work, find and read the relevant doc in \`${docsDir}/\`. Your training data may be outdated — the docs are the source of truth.
|
|
288
284
|
|
|
289
285
|
\`\`\`
|
|
290
286
|
${minify ? index.minified : index.full}
|
|
291
287
|
\`\`\`
|
|
292
288
|
|
|
293
|
-
### Key Nuxt ${majorVersion} Patterns
|
|
294
|
-
|
|
295
|
-
#### Data Fetching
|
|
296
|
-
- Use \`useFetch\` for component-level data fetching (auto-deduped, SSR-safe)
|
|
297
|
-
- Use \`useAsyncData\` when you need more control over the key/handler
|
|
298
|
-
- Use \`$fetch\` in event handlers and server routes (NOT in setup for SSR)
|
|
299
|
-
- Always handle \`pending\` and \`error\` states
|
|
300
|
-
|
|
301
|
-
#### Server Routes
|
|
302
|
-
- Files in \`server/api/\` become API endpoints
|
|
303
|
-
- Use \`defineEventHandler\` for all handlers
|
|
304
|
-
- Access body with \`readBody(event)\`
|
|
305
|
-
- Access query with \`getQuery(event)\`
|
|
306
|
-
- Access params with \`event.context.params\`
|
|
307
|
-
|
|
308
|
-
#### State Management
|
|
309
|
-
- Use \`useState\` for SSR-friendly reactive state
|
|
310
|
-
- Use \`useCookie\` for cookie-based state
|
|
311
|
-
- Use \`useRuntimeConfig\` for environment variables
|
|
312
|
-
|
|
313
|
-
#### Routing & Navigation
|
|
314
|
-
- Use \`definePageMeta\` for page-level config
|
|
315
|
-
- Use \`navigateTo\` for programmatic navigation
|
|
316
|
-
- Use \`useRoute\` and \`useRouter\` for route info
|
|
317
|
-
|
|
318
|
-
#### Configuration
|
|
319
|
-
- \`nuxt.config.ts\` for build-time config
|
|
320
|
-
- \`runtimeConfig\` for environment variables (private/public)
|
|
321
|
-
- \`app.config.ts\` for public runtime config
|
|
322
|
-
|
|
323
289
|
${END_MARKER}`;
|
|
324
290
|
}
|
|
325
291
|
function generateFullAgentsMd(nuxtSection) {
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
This file provides documentation references for AI coding agents.
|
|
329
|
-
|
|
330
|
-
${nuxtSection}
|
|
292
|
+
return `${nuxtSection}
|
|
331
293
|
`;
|
|
332
294
|
}
|
|
333
295
|
|