@jpoindexter/agent-smith 1.0.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/LICENSE +21 -0
- package/README.md +323 -0
- package/dist/chunk-U7GYFEDR.js +2819 -0
- package/dist/chunk-ZK7LS36I.js +2817 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +982 -0
- package/dist/mcp-server-JWMUXOC3.js +304 -0
- package/dist/mcp-server-YERMBTNH.js +304 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jason Poindexter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
```
|
|
2
|
+
┏━┓┏━╸┏━╸┏┓╻╺┳╸ ┏━┓┏┳┓╻╺┳╸╻ ╻
|
|
3
|
+
┣━┫┃╺┓┣╸ ┃┗┫ ┃ ┗━┓┃┃┃┃ ┃ ┣━┫
|
|
4
|
+
╹ ╹┗━┛┗━╸╹ ╹ ╹ ┗━┛╹ ╹╹ ╹ ╹ ╹
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
# agentsmith
|
|
8
|
+
|
|
9
|
+
> Auto-generate AGENTS.md from your codebase
|
|
10
|
+
|
|
11
|
+
Stop writing AGENTS.md by hand. Run agentsmith and it scans your codebase to generate a comprehensive context file that AI coding tools read automatically.
|
|
12
|
+
|
|
13
|
+
## What is AGENTS.md?
|
|
14
|
+
|
|
15
|
+
[AGENTS.md](https://agents.md) is an open standard for giving AI coding assistants context about your project. It's adopted by 60,000+ projects and supported by:
|
|
16
|
+
|
|
17
|
+
- Cursor
|
|
18
|
+
- GitHub Copilot
|
|
19
|
+
- Claude Code
|
|
20
|
+
- VS Code
|
|
21
|
+
- Gemini CLI
|
|
22
|
+
- And 20+ more tools
|
|
23
|
+
|
|
24
|
+
AI tools automatically discover and read `AGENTS.md` files - no configuration needed.
|
|
25
|
+
|
|
26
|
+
## What agentsmith does
|
|
27
|
+
|
|
28
|
+
Instead of writing AGENTS.md manually, agentsmith **scans your codebase** and generates it:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx agentsmith
|
|
32
|
+
|
|
33
|
+
agentsmith
|
|
34
|
+
|
|
35
|
+
Scanning /Users/you/my-project...
|
|
36
|
+
|
|
37
|
+
✓ Found 279 components
|
|
38
|
+
✓ Found 5 components with CVA variants
|
|
39
|
+
✓ Found 37 color tokens
|
|
40
|
+
✓ Found 14 custom hooks
|
|
41
|
+
✓ Found 46 API routes
|
|
42
|
+
✓ Found 87 environment variables
|
|
43
|
+
✓ Detected Next.js (App Router)
|
|
44
|
+
✓ Detected shadcn/ui (26 Radix packages)
|
|
45
|
+
✓ Found cn() utility
|
|
46
|
+
✓ Found mode/design-system
|
|
47
|
+
✓ Detected 6 code patterns
|
|
48
|
+
✓ Found existing CLAUDE.md
|
|
49
|
+
✓ Found .ai/ folder (12 files)
|
|
50
|
+
✓ Found prisma schema (28 models)
|
|
51
|
+
✓ Scanned 1572 files (11.0 MB, 365,599 lines)
|
|
52
|
+
✓ Found 17 barrel exports
|
|
53
|
+
✓ Found 15 hub files (most imported)
|
|
54
|
+
✓ Found 20 Props types
|
|
55
|
+
✓ Found 40 test files (12% component coverage)
|
|
56
|
+
|
|
57
|
+
✓ Generated AGENTS.md
|
|
58
|
+
~11K tokens (9% of 128K context)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Run directly (no install needed)
|
|
65
|
+
npx agentsmith
|
|
66
|
+
|
|
67
|
+
# Or install globally
|
|
68
|
+
npm install -g agentsmith
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Generate AGENTS.md in current directory
|
|
75
|
+
agentsmith
|
|
76
|
+
|
|
77
|
+
# Generate for a specific directory
|
|
78
|
+
agentsmith ./my-project
|
|
79
|
+
|
|
80
|
+
# Preview without writing (dry run)
|
|
81
|
+
agentsmith --dry-run
|
|
82
|
+
|
|
83
|
+
# Custom output file
|
|
84
|
+
agentsmith --output CONTEXT.md
|
|
85
|
+
|
|
86
|
+
# Force overwrite existing file
|
|
87
|
+
agentsmith --force
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Output Modes
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Default - comprehensive output (~11K tokens)
|
|
94
|
+
agentsmith
|
|
95
|
+
|
|
96
|
+
# Compact - fewer details (~20% smaller)
|
|
97
|
+
agentsmith --compact
|
|
98
|
+
|
|
99
|
+
# Compress - signatures only (~40% smaller)
|
|
100
|
+
agentsmith --compress
|
|
101
|
+
|
|
102
|
+
# Minimal - ultra-compact (~3K tokens)
|
|
103
|
+
agentsmith --minimal
|
|
104
|
+
|
|
105
|
+
# XML format (industry standard, matches Repomix)
|
|
106
|
+
agentsmith --xml
|
|
107
|
+
|
|
108
|
+
# Include file tree visualization
|
|
109
|
+
agentsmith --tree
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## New in v1.0.0
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Copy output to clipboard
|
|
116
|
+
agentsmith --copy
|
|
117
|
+
|
|
118
|
+
# Include uncommitted git changes
|
|
119
|
+
agentsmith --include-diffs
|
|
120
|
+
|
|
121
|
+
# Split large repos into chunks
|
|
122
|
+
agentsmith --split-output 100kb # Creates AGENTS-001.md, AGENTS-002.md, etc.
|
|
123
|
+
|
|
124
|
+
# Include security audit (npm audit)
|
|
125
|
+
agentsmith --security
|
|
126
|
+
|
|
127
|
+
# Monorepo support - generate for each package
|
|
128
|
+
agentsmith --monorepo
|
|
129
|
+
|
|
130
|
+
# Start as MCP server for AI tool integration
|
|
131
|
+
agentsmith --mcp
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## All Options
|
|
135
|
+
|
|
136
|
+
| Flag | Description |
|
|
137
|
+
|------|-------------|
|
|
138
|
+
| `-o, --output <file>` | Output file path (default: AGENTS.md) |
|
|
139
|
+
| `--dry-run` | Preview without writing file |
|
|
140
|
+
| `--force` | Overwrite existing AGENTS.md |
|
|
141
|
+
| `--compact` | Fewer details, ~20% smaller |
|
|
142
|
+
| `--compress` | Signatures only, ~40% smaller |
|
|
143
|
+
| `--minimal` | Ultra-compact, ~3K tokens |
|
|
144
|
+
| `--xml` | XML format output |
|
|
145
|
+
| `--tree` | Include file tree |
|
|
146
|
+
| `--json` | Also generate AGENTS.index.json |
|
|
147
|
+
| `--copy` | Copy output to clipboard |
|
|
148
|
+
| `--include-diffs` | Include uncommitted git changes |
|
|
149
|
+
| `--include-git-log` | Include recent commits |
|
|
150
|
+
| `--split-output <size>` | Split into chunks (e.g., 100kb) |
|
|
151
|
+
| `--security` | Include npm audit results |
|
|
152
|
+
| `--monorepo` | Generate for each workspace package |
|
|
153
|
+
| `--mcp` | Start as MCP server |
|
|
154
|
+
| `--remote <url>` | Analyze a GitHub repository |
|
|
155
|
+
| `--watch` | Auto-regenerate on file changes |
|
|
156
|
+
| `--check-secrets` | Scan for secrets before output |
|
|
157
|
+
|
|
158
|
+
## MCP Server Mode
|
|
159
|
+
|
|
160
|
+
agentsmith can run as an MCP (Model Context Protocol) server for AI tool integration:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
agentsmith --mcp
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Exposes these tools to AI assistants:
|
|
167
|
+
- `pack_codebase` - Generate AGENTS.md for a directory
|
|
168
|
+
- `read_agents` - Read existing AGENTS.md
|
|
169
|
+
- `search_components` - Search components by name
|
|
170
|
+
- `get_component_info` - Get detailed component info with source
|
|
171
|
+
|
|
172
|
+
## Configuration
|
|
173
|
+
|
|
174
|
+
Create `agentsmith.config.json` in your project root:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"output": "AGENTS.md",
|
|
179
|
+
"exclude": [
|
|
180
|
+
"**/test/**",
|
|
181
|
+
"**/stories/**",
|
|
182
|
+
"**/fixtures/**"
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## What it scans
|
|
188
|
+
|
|
189
|
+
| Scanner | What it finds |
|
|
190
|
+
|---------|---------------|
|
|
191
|
+
| **Components** | React components with exports, props, JSDoc, complexity metrics |
|
|
192
|
+
| **Variants** | CVA variant options (Button: default, destructive, etc.) |
|
|
193
|
+
| **Dependencies** | Component imports (radix, design system, utilities) |
|
|
194
|
+
| **Barrels** | Index.ts re-exports for suggested import paths |
|
|
195
|
+
| **Tokens** | CSS variables and Tailwind config |
|
|
196
|
+
| **Hooks** | Custom hooks with client-only detection |
|
|
197
|
+
| **API Routes** | Next.js routes with methods and auth status |
|
|
198
|
+
| **Database** | Prisma and Drizzle models with fields and relations |
|
|
199
|
+
| **Environment** | Required/optional env vars from .env.example |
|
|
200
|
+
| **Patterns** | react-hook-form, Zod, Zustand, tRPC, testing libs |
|
|
201
|
+
| **Utilities** | cn(), mode/design-system detection |
|
|
202
|
+
| **Framework** | Next.js, Remix, Vite with version and router type |
|
|
203
|
+
| **Statistics** | Total files, lines, size, largest files |
|
|
204
|
+
| **Existing docs** | CLAUDE.md, .ai/ folder, .cursorrules |
|
|
205
|
+
| **File Tree** | Project structure visualization |
|
|
206
|
+
| **Import Graph** | Hub files, circular deps, unused components |
|
|
207
|
+
| **TypeScript** | Props interfaces, API types, model types |
|
|
208
|
+
| **Tests** | Test framework detection, coverage mapping |
|
|
209
|
+
| **Security** | npm audit vulnerabilities, outdated packages |
|
|
210
|
+
|
|
211
|
+
## Output
|
|
212
|
+
|
|
213
|
+
The generated AGENTS.md includes:
|
|
214
|
+
|
|
215
|
+
- **TL;DR** - Stack, component count, key imports, high-impact files
|
|
216
|
+
- **Getting Started** - Auto-generated setup instructions
|
|
217
|
+
- **Project Overview** - Framework, language, styling, statistics
|
|
218
|
+
- **Critical Rules** - With WRONG/RIGHT code examples
|
|
219
|
+
- **Components** - Full inventory grouped by category
|
|
220
|
+
- **Hub Files** - Most imported files (changes have wide impact)
|
|
221
|
+
- **Unused Components** - Potentially dead code warnings
|
|
222
|
+
- **Preferred Imports** - Barrel imports for cleaner code
|
|
223
|
+
- **Custom Hooks** - With client-only markers
|
|
224
|
+
- **API Routes** - Grouped by path with methods and auth
|
|
225
|
+
- **Database Models** - Fields and relations
|
|
226
|
+
- **Environment Variables** - Required vs optional
|
|
227
|
+
- **Code Patterns** - Detected patterns with examples
|
|
228
|
+
- **Design Tokens** - Color tokens with usage guidance
|
|
229
|
+
- **Commands** - npm scripts
|
|
230
|
+
- **Security** - Vulnerabilities and outdated packages (with --security)
|
|
231
|
+
|
|
232
|
+
## Example output
|
|
233
|
+
|
|
234
|
+
```markdown
|
|
235
|
+
# AGENTS.md
|
|
236
|
+
|
|
237
|
+
> Auto-generated by agentsmith
|
|
238
|
+
|
|
239
|
+
## TL;DR
|
|
240
|
+
|
|
241
|
+
- **Stack**: Next.js 16.0.10 + TypeScript 5 + Tailwind 4.0.9 + shadcn/ui
|
|
242
|
+
- **Components**: 279 total — USE EXISTING, don't create new
|
|
243
|
+
- **Key imports**: `cn()` from `@/lib/utils`, `mode` from `@/design-system`
|
|
244
|
+
- **High-impact files**: design-system/index, utils, button, card
|
|
245
|
+
- **Database**: prisma with 28 models
|
|
246
|
+
- **API**: 46 routes (31 protected)
|
|
247
|
+
|
|
248
|
+
## Getting Started
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm install
|
|
252
|
+
|
|
253
|
+
# Set up environment
|
|
254
|
+
cp .env.example .env.local
|
|
255
|
+
|
|
256
|
+
# Database setup
|
|
257
|
+
npm run db:push
|
|
258
|
+
npm run db:seed
|
|
259
|
+
|
|
260
|
+
# Start development
|
|
261
|
+
npm run dev
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Critical Rules
|
|
265
|
+
|
|
266
|
+
### 1. USE EXISTING COMPONENTS
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
// WRONG
|
|
270
|
+
<div className="rounded border p-4">...</div>
|
|
271
|
+
|
|
272
|
+
// RIGHT
|
|
273
|
+
<Card><CardContent>...</CardContent></Card>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### 2. USE DESIGN TOKENS
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
// WRONG
|
|
280
|
+
className="bg-blue-500 text-white"
|
|
281
|
+
|
|
282
|
+
// RIGHT
|
|
283
|
+
className="bg-primary text-primary-foreground"
|
|
284
|
+
```
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Why?
|
|
288
|
+
|
|
289
|
+
AI coding tools work better when they understand your codebase:
|
|
290
|
+
|
|
291
|
+
- ❌ AI generates `bg-blue-500` instead of your `bg-primary` token
|
|
292
|
+
- ❌ AI creates a new Button when you already have one with 9 variants
|
|
293
|
+
- ❌ AI ignores your patterns and conventions
|
|
294
|
+
|
|
295
|
+
With AGENTS.md:
|
|
296
|
+
|
|
297
|
+
- ✅ AI knows your components and uses them
|
|
298
|
+
- ✅ AI follows your design tokens
|
|
299
|
+
- ✅ AI matches your patterns
|
|
300
|
+
|
|
301
|
+
## Comparison
|
|
302
|
+
|
|
303
|
+
| Tool | Focus | Approach |
|
|
304
|
+
|------|-------|----------|
|
|
305
|
+
| **agentsmith** | AGENTS.md generation | Scans codebase, generates context |
|
|
306
|
+
| Repomix | Code packing | Packs files into single XML |
|
|
307
|
+
| Code2Prompt | Prompt building | Builds prompts from code |
|
|
308
|
+
|
|
309
|
+
agentsmith is specifically designed for the AGENTS.md standard with opinionated rules about component reuse and design tokens.
|
|
310
|
+
|
|
311
|
+
## Works great in
|
|
312
|
+
|
|
313
|
+
- Next.js + Tailwind + shadcn/ui projects
|
|
314
|
+
- React apps with component libraries
|
|
315
|
+
- Any TypeScript codebase with reusable components
|
|
316
|
+
|
|
317
|
+
## License
|
|
318
|
+
|
|
319
|
+
MIT
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
A [theft.studio](https://theft.studio) project
|