kungfu-ai 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 ADDED
@@ -0,0 +1,55 @@
1
+ # kungfu-ai
2
+
3
+ Context retrieval and distillation engine for coding agents. Saves tokens, speeds up agent workflows.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g kungfu-ai
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Initialize in your project
15
+ kungfu init
16
+ kungfu index
17
+
18
+ # Search and explore
19
+ kungfu find-symbol MyClass
20
+ kungfu explore-symbol Router
21
+ kungfu ask-context "how does auth work"
22
+ kungfu semantic-search "database connection"
23
+ kungfu callers handleRequest
24
+
25
+ # Start MCP server (for AI agents)
26
+ kungfu mcp
27
+ ```
28
+
29
+ ## What is Kungfu?
30
+
31
+ Kungfu is an MCP server that gives coding agents (Claude Code, Cursor, etc.) fast, focused access to your codebase — without reading entire files.
32
+
33
+ **21 MCP tools** including:
34
+ - Symbol search (exact + fuzzy + semantic)
35
+ - Composite tools (explore-symbol, investigate)
36
+ - Call graph (callers/callees)
37
+ - Git history (blame, file log)
38
+ - Context assembly with intent detection
39
+
40
+ **Supports:** Rust, TypeScript, JavaScript, Python, Go
41
+
42
+ ## Alternative Install
43
+
44
+ ```bash
45
+ # macOS / Linux
46
+ curl -fsSL https://raw.githubusercontent.com/denyzhirkov/kungfu/master/install.sh | sh
47
+
48
+ # Windows (PowerShell)
49
+ irm https://raw.githubusercontent.com/denyzhirkov/kungfu/master/install.ps1 | iex
50
+ ```
51
+
52
+ ## Links
53
+
54
+ - [GitHub](https://github.com/denyzhirkov/kungfu)
55
+ - [Benchmarks](https://github.com/denyzhirkov/kungfu/blob/master/BENCHMARKS.md)
package/bin/kungfu ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+ const os = require("os");
7
+
8
+ const ext = os.platform() === "win32" ? ".exe" : "";
9
+ const bin = path.join(__dirname, `kungfu${ext}`);
10
+
11
+ try {
12
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
13
+ } catch (err) {
14
+ if (err.status !== undefined) {
15
+ process.exit(err.status);
16
+ }
17
+ console.error(`kungfu: binary not found at ${bin}`);
18
+ console.error(" Run 'npm rebuild kungfu-ai' to download it.");
19
+ process.exit(1);
20
+ }
package/install.js ADDED
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execSync } = require("child_process");
5
+ const fs = require("fs");
6
+ const https = require("https");
7
+ const http = require("http");
8
+ const path = require("path");
9
+ const os = require("os");
10
+
11
+ const REPO = "denyzhirkov/kungfu";
12
+ const VERSION = require("./package.json").version;
13
+
14
+ function getPlatform() {
15
+ const platform = os.platform();
16
+ const arch = os.arch();
17
+
18
+ const platformMap = {
19
+ darwin: "darwin",
20
+ linux: "linux",
21
+ win32: "windows",
22
+ };
23
+
24
+ const archMap = {
25
+ x64: "x86_64",
26
+ arm64: "aarch64",
27
+ };
28
+
29
+ const p = platformMap[platform];
30
+ const a = archMap[arch];
31
+
32
+ if (!p || !a) {
33
+ console.error(`Unsupported platform: ${platform}-${arch}`);
34
+ process.exit(1);
35
+ }
36
+
37
+ const ext = platform === "win32" ? ".exe" : "";
38
+ return { name: `kungfu-${p}-${a}${ext}`, ext };
39
+ }
40
+
41
+ function download(url) {
42
+ return new Promise((resolve, reject) => {
43
+ const client = url.startsWith("https") ? https : http;
44
+ client
45
+ .get(url, { headers: { "User-Agent": "kungfu-ai-npm" } }, (res) => {
46
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
47
+ return download(res.headers.location).then(resolve).catch(reject);
48
+ }
49
+ if (res.statusCode !== 200) {
50
+ return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
51
+ }
52
+ const chunks = [];
53
+ res.on("data", (chunk) => chunks.push(chunk));
54
+ res.on("end", () => resolve(Buffer.concat(chunks)));
55
+ res.on("error", reject);
56
+ })
57
+ .on("error", reject);
58
+ });
59
+ }
60
+
61
+ async function main() {
62
+ const { name, ext } = getPlatform();
63
+ const tag = `v${VERSION}`;
64
+ const url = `https://github.com/${REPO}/releases/download/${tag}/${name}`;
65
+
66
+ const binDir = path.join(__dirname, "bin");
67
+ const binPath = path.join(binDir, `kungfu${ext}`);
68
+
69
+ // Skip if binary already exists (e.g., in CI cache)
70
+ if (fs.existsSync(binPath)) {
71
+ const stat = fs.statSync(binPath);
72
+ if (stat.size > 1000) {
73
+ return;
74
+ }
75
+ }
76
+
77
+ console.log(`kungfu: downloading ${name}...`);
78
+
79
+ try {
80
+ const data = await download(url);
81
+
82
+ if (!fs.existsSync(binDir)) {
83
+ fs.mkdirSync(binDir, { recursive: true });
84
+ }
85
+
86
+ fs.writeFileSync(binPath, data);
87
+ fs.chmodSync(binPath, 0o755);
88
+
89
+ console.log(`kungfu: installed to ${binPath}`);
90
+ } catch (err) {
91
+ console.error(`kungfu: failed to download binary from ${url}`);
92
+ console.error(` ${err.message}`);
93
+ console.error(` Check releases: https://github.com/${REPO}/releases`);
94
+ process.exit(1);
95
+ }
96
+ }
97
+
98
+ main();
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "kungfu-ai",
3
+ "version": "1.0.0",
4
+ "description": "Context retrieval and distillation engine for coding agents. Saves tokens, speeds up agent workflows.",
5
+ "keywords": [
6
+ "ai",
7
+ "agent",
8
+ "context",
9
+ "mcp",
10
+ "coding-assistant",
11
+ "token-optimization"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/denyzhirkov/kungfu"
17
+ },
18
+ "homepage": "https://github.com/denyzhirkov/kungfu",
19
+ "bin": {
20
+ "kungfu": "bin/kungfu"
21
+ },
22
+ "scripts": {
23
+ "postinstall": "node install.js"
24
+ },
25
+ "files": [
26
+ "bin/",
27
+ "install.js",
28
+ "README.md"
29
+ ],
30
+ "os": [
31
+ "darwin",
32
+ "linux",
33
+ "win32"
34
+ ],
35
+ "cpu": [
36
+ "x64",
37
+ "arm64"
38
+ ],
39
+ "engines": {
40
+ "node": ">=16"
41
+ }
42
+ }