@musashishao/agent-kit 1.2.2 → 1.3.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.
Files changed (39) hide show
  1. package/.agent/mcp-gateway/README.md +121 -0
  2. package/.agent/mcp-gateway/dist/index.d.ts +11 -0
  3. package/.agent/mcp-gateway/dist/index.js +504 -0
  4. package/.agent/mcp-gateway/dist/sync/debouncer.d.ts +56 -0
  5. package/.agent/mcp-gateway/dist/sync/debouncer.js +112 -0
  6. package/.agent/mcp-gateway/dist/sync/incremental_syncer.d.ts +58 -0
  7. package/.agent/mcp-gateway/dist/sync/incremental_syncer.js +172 -0
  8. package/.agent/mcp-gateway/dist/sync/index.d.ts +6 -0
  9. package/.agent/mcp-gateway/dist/sync/index.js +6 -0
  10. package/.agent/mcp-gateway/dist/sync/timestamp_checker.d.ts +69 -0
  11. package/.agent/mcp-gateway/dist/sync/timestamp_checker.js +169 -0
  12. package/.agent/mcp-gateway/package.json +28 -0
  13. package/.agent/mcp-gateway/src/index.ts +608 -0
  14. package/.agent/mcp-gateway/src/sync/debouncer.ts +129 -0
  15. package/.agent/mcp-gateway/src/sync/incremental_syncer.ts +237 -0
  16. package/.agent/mcp-gateway/src/sync/index.ts +7 -0
  17. package/.agent/mcp-gateway/src/sync/timestamp_checker.ts +194 -0
  18. package/.agent/scripts/ak_cli.py +533 -0
  19. package/.agent/scripts/setup_host.py +557 -0
  20. package/.agent/scripts/verify_install.py +174 -0
  21. package/.agent/skills/app-builder/SKILL.md +51 -1
  22. package/.agent/skills/app-builder/scripts/generate_ai_infra.py +510 -0
  23. package/.agent/skills/documentation-templates/SKILL.md +9 -1
  24. package/.agent/skills/documentation-templates/agents-template.md +202 -0
  25. package/.agent/skills/graph-mapper/SKILL.md +211 -0
  26. package/.agent/skills/graph-mapper/scripts/generate_graph.py +503 -0
  27. package/.agent/skills/rag-engineering/SKILL.md +342 -0
  28. package/.agent/skills/rag-engineering/chunking-strategies.md +229 -0
  29. package/.agent/skills/rag-engineering/contextual-retrieval.md +261 -0
  30. package/.agent/skills/rag-engineering/hybrid-search.md +356 -0
  31. package/.agent/skills/rag-engineering/scripts/chunk_code.py +606 -0
  32. package/.agent/templates/mcp_configs/claude_desktop.json +14 -0
  33. package/.agent/templates/mcp_configs/cursor.json +13 -0
  34. package/.agent/templates/mcp_configs/vscode.json +13 -0
  35. package/.agent/workflows/create.md +70 -2
  36. package/bin/cli.js +91 -0
  37. package/docs/AI_DATA_INFRASTRUCTURE.md +288 -0
  38. package/docs/CHANGELOG_AI_INFRA.md +111 -0
  39. package/package.json +7 -2
@@ -0,0 +1,202 @@
1
+ # AGENTS.md Template
2
+
3
+ > Template for creating `AGENTS.md` - The AI Navigation Map for your project.
4
+
5
+ ---
6
+
7
+ ## What is AGENTS.md?
8
+
9
+ `AGENTS.md` is the **first file AI reads** when entering your codebase. It provides:
10
+ - Project overview and current state
11
+ - Directory structure explanation
12
+ - Coding conventions and rules
13
+ - Tool/MCP configuration hints
14
+
15
+ ---
16
+
17
+ ## Template
18
+
19
+ Copy and customize this template for your project:
20
+
21
+ ```markdown
22
+ # AGENTS.md
23
+
24
+ > AI Navigation Map for [PROJECT_NAME]
25
+
26
+ ---
27
+
28
+ ## 📊 Project Pulse
29
+
30
+ | Metric | Value |
31
+ |--------|-------|
32
+ | **Status** | 🟢 Active / 🟡 Maintenance / 🔴 Legacy |
33
+ | **Version** | 1.0.0 |
34
+ | **Last Updated** | YYYY-MM-DD |
35
+ | **Primary Language** | TypeScript / Python / Go |
36
+
37
+ ---
38
+
39
+ ## 🛠️ Tech Stack
40
+
41
+ | Layer | Technology | Notes |
42
+ |-------|------------|-------|
43
+ | **Frontend** | Next.js 15 + React 19 | App Router |
44
+ | **Styling** | Tailwind CSS v4 | CSS-first config |
45
+ | **Backend** | Node.js / FastAPI | REST API |
46
+ | **Database** | PostgreSQL + Prisma | Neon serverless |
47
+ | **Auth** | NextAuth.js v5 | OAuth + Credentials |
48
+ | **Testing** | Vitest + Playwright | Unit + E2E |
49
+
50
+ ---
51
+
52
+ ## 📁 Directory Map
53
+
54
+ ```
55
+ project-root/
56
+ ├── src/
57
+ │ ├── app/ # Next.js App Router pages
58
+ │ ├── components/ # React components
59
+ │ │ ├── ui/ # Base UI primitives
60
+ │ │ └── features/ # Feature-specific components
61
+ │ ├── lib/ # Utilities and helpers
62
+ │ ├── hooks/ # Custom React hooks
63
+ │ └── types/ # TypeScript type definitions
64
+ ├── prisma/ # Database schema & migrations
65
+ ├── public/ # Static assets
66
+ ├── tests/ # Test files (mirrors src/)
67
+ └── .agent/ # AI agent configuration
68
+ ```
69
+
70
+ ### Critical Paths
71
+
72
+ | Path | Purpose | ⚠️ Caution |
73
+ |------|---------|------------|
74
+ | `src/lib/auth.ts` | Auth configuration | Security-critical |
75
+ | `prisma/schema.prisma` | Database schema | Requires migration |
76
+ | `.env.local` | Environment secrets | Never commit |
77
+
78
+ ### Off-Limits (Do Not Modify)
79
+
80
+ - `node_modules/` - Dependencies
81
+ - `.next/` - Build artifacts
82
+ - `legacy/` - Deprecated code (reference only)
83
+
84
+ ---
85
+
86
+ ## 📜 Rules & Conventions
87
+
88
+ ### Naming Conventions
89
+
90
+ | Type | Convention | Example |
91
+ |------|------------|---------|
92
+ | Components | PascalCase | `UserProfile.tsx` |
93
+ | Hooks | camelCase with `use` prefix | `useAuth.ts` |
94
+ | Utils | camelCase | `formatDate.ts` |
95
+ | Types | PascalCase with suffix | `UserType.ts` |
96
+ | Constants | SCREAMING_SNAKE | `MAX_RETRY_COUNT` |
97
+
98
+ ### Code Style
99
+
100
+ - **TypeScript Strict Mode** - No `any` types allowed
101
+ - **Functional Components** - No class components
102
+ - **Server-First** - Prefer Server Components, use `'use client'` sparingly
103
+ - **Barrel Exports** - Use `index.ts` for clean imports
104
+
105
+ ### Git Commit Format
106
+
107
+ ```
108
+ type(scope): description
109
+
110
+ feat(auth): add OAuth login
111
+ fix(api): handle null response
112
+ docs(readme): update installation guide
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 🔧 Commands Reference
118
+
119
+ | Task | Command |
120
+ |------|---------|
121
+ | Dev server | `npm run dev` |
122
+ | Build | `npm run build` |
123
+ | Test | `npm run test` |
124
+ | Lint | `npm run lint` |
125
+ | DB migrate | `npx prisma migrate dev` |
126
+ | DB studio | `npx prisma studio` |
127
+
128
+ ---
129
+
130
+ ## 🤖 AI Agent Instructions
131
+
132
+ ### When Modifying Code
133
+
134
+ 1. **Check Dependencies First** - Before editing a file, trace its imports/exports
135
+ 2. **Run Tests After Changes** - Always verify with `npm run test`
136
+ 3. **Update Types** - If changing data structures, update `types/` accordingly
137
+
138
+ ### When Creating New Features
139
+
140
+ 1. Follow existing folder structure patterns
141
+ 2. Create component in appropriate directory
142
+ 3. Add types to `types/` folder
143
+ 4. Write tests in `tests/` mirroring source path
144
+
145
+ ### MCP Servers Available
146
+
147
+ | Server | Purpose | When to Use |
148
+ |--------|---------|-------------|
149
+ | `filesystem` | Read/write project files | File operations |
150
+ | `database` | Query PostgreSQL | Data operations |
151
+ | `github` | GitHub API access | PR/Issue management |
152
+
153
+ ---
154
+
155
+ ## 📈 Current Sprint Focus
156
+
157
+ > Update this section to guide AI on current priorities
158
+
159
+ - [ ] Feature: User dashboard redesign
160
+ - [ ] Bug: Fix mobile navigation
161
+ - [ ] Tech debt: Migrate to React 19
162
+
163
+ ---
164
+
165
+ ## 🔗 Related Documentation
166
+
167
+ - [API Documentation](./docs/api.md)
168
+ - [Component Storybook](./docs/components.md)
169
+ - [Database Schema](./docs/database.md)
170
+
171
+ ---
172
+
173
+ *Last generated: YYYY-MM-DD*
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Usage Guidelines
179
+
180
+ ### When to Create AGENTS.md
181
+
182
+ - ✅ New projects (create during `/create` workflow)
183
+ - ✅ Before major AI-assisted refactoring
184
+ - ✅ When onboarding new team members
185
+
186
+ ### Maintenance
187
+
188
+ - Update when directory structure changes
189
+ - Review monthly for accuracy
190
+ - Automate updates with `graph-mapper` skill (if available)
191
+
192
+ ### Placement
193
+
194
+ Always place `AGENTS.md` in the **project root** directory.
195
+
196
+ ---
197
+
198
+ ## Integration with Agent Kit
199
+
200
+ When using Agent Kit's `/create` workflow, this template will be automatically generated with project-specific values filled in.
201
+
202
+ The `explorer-agent` uses this file as its primary navigation source before diving into code analysis.
@@ -0,0 +1,211 @@
1
+ ---
2
+ name: graph-mapper
3
+ description: Lightweight Knowledge Graph generator for codebases. Analyzes imports/exports to create dependency maps without external databases. Helps AI understand code relationships and impact zones.
4
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep
5
+ skills:
6
+ - architecture
7
+ - systematic-debugging
8
+ ---
9
+
10
+ # Graph Mapper
11
+
12
+ > Build a **Lightweight Knowledge Graph** from your codebase - no Neo4j required.
13
+
14
+ ## 🎯 Purpose
15
+
16
+ This skill generates a **static dependency graph** that helps AI agents:
17
+ 1. **Understand Relationships:** Which files import/export what
18
+ 2. **Analyze Impact:** What breaks if I change this file?
19
+ 3. **Navigate Smartly:** Find related code without RAG guessing
20
+
21
+ ---
22
+
23
+ ## 🔧 Quick Reference
24
+
25
+ | File | Purpose |
26
+ |------|---------|
27
+ | [scripts/analyze_js.py](scripts/analyze_js.py) | JavaScript/TypeScript dependency analyzer |
28
+ | [scripts/analyze_py.py](scripts/analyze_py.py) | Python dependency analyzer |
29
+ | [scripts/generate_graph.py](scripts/generate_graph.py) | Main graph generator (orchestrates analyzers) |
30
+
31
+ ---
32
+
33
+ ## 📊 Output Formats
34
+
35
+ ### 1. DEPENDENCIES.md (Human + AI readable)
36
+
37
+ ```markdown
38
+ # Dependency Graph
39
+
40
+ ## src/components/Button.tsx
41
+ **Imports:**
42
+ - react
43
+ - ./styles.css
44
+ - ../hooks/useTheme
45
+
46
+ **Imported by:**
47
+ - src/components/Form.tsx
48
+ - src/pages/Home.tsx
49
+
50
+ **Impact Zone:** 3 files
51
+ ```
52
+
53
+ ### 2. graph.json (Machine readable)
54
+
55
+ ```json
56
+ {
57
+ "nodes": [
58
+ {"id": "src/components/Button.tsx", "type": "component"},
59
+ {"id": "src/hooks/useTheme.ts", "type": "hook"}
60
+ ],
61
+ "edges": [
62
+ {"from": "src/components/Button.tsx", "to": "src/hooks/useTheme.ts", "type": "imports"}
63
+ ]
64
+ }
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 🚀 Usage
70
+
71
+ ### Generate Graph for JavaScript/TypeScript Project
72
+
73
+ ```bash
74
+ python .agent/skills/graph-mapper/scripts/generate_graph.py \
75
+ --src ./src \
76
+ --output .agent/graph.json \
77
+ --format both \
78
+ --lang typescript
79
+ ```
80
+
81
+ ### Generate Graph for Python Project
82
+
83
+ ```bash
84
+ python .agent/skills/graph-mapper/scripts/generate_graph.py \
85
+ --src ./src \
86
+ --output .agent/graph.json \
87
+ --format both \
88
+ --lang python
89
+ ```
90
+
91
+ ### Options
92
+
93
+ | Flag | Description | Default |
94
+ |------|-------------|---------|
95
+ | `--src` | Source directory to analyze | `./src` |
96
+ | `--output` | Output file path | `.agent/graph.json` |
97
+ | `--format` | Output format: `json`, `markdown`, `both` | `both` |
98
+ | `--lang` | Language: `typescript`, `python`, `auto` | `auto` |
99
+ | `--depth` | Max depth for transitive dependencies | `3` |
100
+ | `--exclude` | Glob patterns to exclude | `node_modules,__pycache__` |
101
+
102
+ ---
103
+
104
+ ## 🧠 How It Works
105
+
106
+ ### 1. Static Analysis (No Runtime)
107
+
108
+ ```
109
+ Source Files → AST Parsing → Extract Imports/Exports → Build Graph
110
+ ```
111
+
112
+ - **TypeScript/JavaScript:** Regex + AST-like parsing for `import`/`export`/`require`
113
+ - **Python:** Parse `import`/`from...import` statements
114
+
115
+ ### 2. Graph Construction
116
+
117
+ ```
118
+ Nodes = Files (components, modules, utilities)
119
+ Edges = Dependencies (imports, exports, extends)
120
+ ```
121
+
122
+ ### 3. Impact Analysis
123
+
124
+ For any given file, calculate:
125
+ - **Direct dependents:** Files that import this file
126
+ - **Transitive dependents:** Files that depend on dependents
127
+ - **Impact score:** Number of files affected by changes
128
+
129
+ ---
130
+
131
+ ## 🔄 Integration with AI Agents
132
+
133
+ ### When Agent Modifies Code
134
+
135
+ 1. Agent reads `AGENTS.md` for project overview
136
+ 2. Agent queries `graph.json` for file dependencies
137
+ 3. Agent identifies impact zone before making changes
138
+ 4. Agent updates all affected files together
139
+
140
+ ### Example Query (Pseudo-code)
141
+
142
+ ```python
143
+ # AI Agent internal logic
144
+ file_to_modify = "src/utils/formatDate.ts"
145
+ graph = load_graph(".agent/graph.json")
146
+
147
+ # Find what depends on this file
148
+ dependents = graph.get_dependents(file_to_modify)
149
+ # Returns: ["src/components/DatePicker.tsx", "src/pages/Calendar.tsx"]
150
+
151
+ # Agent now knows to check these files too
152
+ ```
153
+
154
+ ---
155
+
156
+ ## ⚡ Best Practices
157
+
158
+ ### When to Regenerate Graph
159
+
160
+ | Trigger | Action |
161
+ |---------|--------|
162
+ | New files added | Run `generate_graph.py` |
163
+ | Major refactoring | Run `generate_graph.py` |
164
+ | Before AI-assisted changes | Ensure graph is fresh |
165
+
166
+ ### CI/CD Integration
167
+
168
+ ```yaml
169
+ # .github/workflows/update-graph.yml
170
+ on:
171
+ push:
172
+ paths:
173
+ - 'src/**'
174
+
175
+ jobs:
176
+ update-graph:
177
+ runs-on: ubuntu-latest
178
+ steps:
179
+ - uses: actions/checkout@v4
180
+ - run: python .agent/skills/graph-mapper/scripts/generate_graph.py
181
+ - uses: stefanzweifel/git-auto-commit-action@v5
182
+ with:
183
+ commit_message: "chore: update dependency graph"
184
+ ```
185
+
186
+ ---
187
+
188
+ ## 🆚 Comparison with Full Graph DB
189
+
190
+ | Feature | Graph Mapper (This) | Neo4j/Full Graph |
191
+ |---------|---------------------|------------------|
192
+ | **Setup** | Zero (just Python) | Docker + Config |
193
+ | **Query Speed** | Fast (file-based) | Faster (indexed) |
194
+ | **Complex Queries** | Limited | Full Cypher |
195
+ | **Storage** | JSON file (~KB) | Database (~MB/GB) |
196
+ | **Best For** | Small-Medium projects | Enterprise scale |
197
+
198
+ ---
199
+
200
+ ## 📋 Checklist
201
+
202
+ Before using graph data:
203
+
204
+ - [ ] Graph file exists (`.agent/graph.json`)
205
+ - [ ] Graph is recent (check timestamp)
206
+ - [ ] Excluded paths are correct (no node_modules)
207
+ - [ ] Language detection is accurate
208
+
209
+ ---
210
+
211
+ > **Remember:** The graph is a snapshot. Keep it updated when code structure changes significantly.