kartograph 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/README.md +94 -0
- package/bin/kartograph.js +36 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Kartograph
|
|
2
|
+
|
|
3
|
+
Kartograph scans your JS/TS codebase, generates a structured codemap, and exposes it via an MCP server so AI coding agents can understand your entire codebase structure in one query instead of crawling files.
|
|
4
|
+
|
|
5
|
+
## The Problem
|
|
6
|
+
|
|
7
|
+
You're using AI coding agents (Cursor, Claude Code, Copilot) daily. They work great—until they don't. Your agent keeps making wrong assumptions about your codebase because it has no structural context:
|
|
8
|
+
|
|
9
|
+
- **Hallucinations**: Agent invents function signatures that don't exist
|
|
10
|
+
- **Missed utilities**: Duplicates logic that already lives elsewhere in the codebase
|
|
11
|
+
- **Inefficient searches**: Makes 6+ file reads to find something that should take 1 query
|
|
12
|
+
- **Wasted iterations**: Wrong assumptions → wrong code → manual fixes → iterate again
|
|
13
|
+
|
|
14
|
+
## The Solution
|
|
15
|
+
|
|
16
|
+
Give your AI agent a **complete, structured map of your codebase** that it can query in a single call.
|
|
17
|
+
|
|
18
|
+
Instead of your agent blindly reading files, it calls `search_types("Order")` and instantly gets:
|
|
19
|
+
- The exact `Order` interface definition
|
|
20
|
+
- Its properties and types
|
|
21
|
+
- Which file it lives in
|
|
22
|
+
- Which endpoints/functions use it
|
|
23
|
+
|
|
24
|
+
**Result**: Fewer hallucinations, fewer agent iterations, more accurate code generation.
|
|
25
|
+
|
|
26
|
+
## When to Use Kartograph
|
|
27
|
+
|
|
28
|
+
- **Onboarding to a new codebase**: Index your project once, give your AI agent the full picture
|
|
29
|
+
- **In CI/CD**: Keep the codemap fresh on every commit, so your agent always has current context
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
33
|
+
- Node.js 18+
|
|
34
|
+
- Works with both JavaScript and TypeScript codebases
|
|
35
|
+
- TypeScript projects should use a project `tsconfig.json` for best results
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
1. **Compile**: `npx kartograph compile-for-ai` scans your JS/TS codebase and builds the codemap artifacts
|
|
40
|
+
2. **Write**: Outputs a structured `codemap.json` plus human-readable map files in `.codemap/`
|
|
41
|
+
3. **Serve**: `npx kartograph mcp` exposes the codemap through an MCP (Model Context Protocol) server
|
|
42
|
+
4. **Sync**: `npx kartograph watch` keeps the codemap fresh as files change (local dev or CI workflows)
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
Use one of these two options:
|
|
47
|
+
|
|
48
|
+
1. Run directly with `npx` (no install):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx kartograph compile-for-ai
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
2. Install globally for repeated local usage:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g kartograph
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx kartograph compile-for-ai
|
|
64
|
+
npx kartograph watch
|
|
65
|
+
npx kartograph mcp
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## What It Generates
|
|
69
|
+
|
|
70
|
+
Kartograph writes the following artifacts to your repository:
|
|
71
|
+
|
|
72
|
+
- `.codemap/overview.md` - High-level project summary (modules, major flows, and key entry points).
|
|
73
|
+
- `.codemap/types.md` - Consolidated type and interface index with links to source locations.
|
|
74
|
+
- `.codemap/endpoints.md` - HTTP/API endpoint inventory with handler mappings and related types.
|
|
75
|
+
- `.codemap/architecture.md` - Component-level architecture view and service/module relationships.
|
|
76
|
+
- `.codemap/codemap.json` - Machine-readable source of truth used by MCP tools.
|
|
77
|
+
- `.codemap/dashboard.html` - Human-friendly visual dashboard for browsing codemap insights.
|
|
78
|
+
- `.vscode/mcp.json` - MCP server configuration for local agent/editor integration.
|
|
79
|
+
|
|
80
|
+
## Integration with AI Agents
|
|
81
|
+
|
|
82
|
+
Once running, Kartograph exposes MCP tools that agents can call:
|
|
83
|
+
- `get_overview` - Returns a project-wide summary so agents can reason about structure before editing.
|
|
84
|
+
- `search_types` - Finds matching types/interfaces by name and returns where they are defined.
|
|
85
|
+
- `get_type_details` - Expands a specific type with fields, signatures, and related references.
|
|
86
|
+
- `get_endpoints` - Lists API endpoints, methods, routes, and linked handlers.
|
|
87
|
+
- `get_architecture` - Provides module/service dependency topology and high-level flow information.
|
|
88
|
+
- `get_file_context` - Returns focused structural context for one file without full-file crawling.
|
|
89
|
+
- `get_diagnostics` - Surfaces codemap/build diagnostics so agents can avoid broken assumptions.
|
|
90
|
+
- `get_dependencies` - Shows dependency relationships between files/modules/packages.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require("commander");
|
|
4
|
+
|
|
5
|
+
const program = new Command();
|
|
6
|
+
|
|
7
|
+
program
|
|
8
|
+
.name("kartograph")
|
|
9
|
+
.description(
|
|
10
|
+
"Generate codemaps and serve MCP tools for JS/TS repositories."
|
|
11
|
+
)
|
|
12
|
+
.version("1.0.0");
|
|
13
|
+
|
|
14
|
+
program
|
|
15
|
+
.command("compile-for-ai")
|
|
16
|
+
.description("Scan a JS/TS repo and generate codemap artifacts.")
|
|
17
|
+
.action(() => {
|
|
18
|
+
console.log("compile-for-ai is not implemented yet.");
|
|
19
|
+
console.log("Planned output: .codemap/codemap.json and markdown artifacts.");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
program
|
|
23
|
+
.command("watch")
|
|
24
|
+
.description("Watch repository files and refresh codemap artifacts.")
|
|
25
|
+
.action(() => {
|
|
26
|
+
console.log("watch is not implemented yet.");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
program
|
|
30
|
+
.command("mcp")
|
|
31
|
+
.description("Run the MCP server backed by generated codemap data.")
|
|
32
|
+
.action(() => {
|
|
33
|
+
console.log("mcp is not implemented yet.");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kartograph",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Kartograph scans your JS/TS codebase, generates a structured codemap, and exposes it via an MCP server.",
|
|
5
|
+
"main": "bin/kartograph.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kartograph": "bin/kartograph.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/wolf1729/Kartograph.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"codemap",
|
|
19
|
+
"typescript",
|
|
20
|
+
"javascript",
|
|
21
|
+
"ai-agent",
|
|
22
|
+
"developer-tools"
|
|
23
|
+
],
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"type": "commonjs",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/wolf1729/Kartograph/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/wolf1729/Kartograph#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.5.0",
|
|
33
|
+
"ts-node": "^10.9.2",
|
|
34
|
+
"typescript": "^6.0.2"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"chokidar": "^5.0.0",
|
|
38
|
+
"commander": "^14.0.3"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"bin",
|
|
42
|
+
"README.md",
|
|
43
|
+
"package.json"
|
|
44
|
+
]
|
|
45
|
+
}
|