@nekocode/agent-codemap 0.1.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/bin/agent-codemap.js +59 -0
- package/install.js +26 -0
- package/package.json +26 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync } = require("child_process");
|
|
4
|
+
const { join } = require("path");
|
|
5
|
+
|
|
6
|
+
// ============================================================
|
|
7
|
+
// Platform Detection
|
|
8
|
+
// ============================================================
|
|
9
|
+
|
|
10
|
+
const PLATFORMS = {
|
|
11
|
+
"darwin-arm64": "@nekocode/agent-codemap-darwin-arm64",
|
|
12
|
+
"darwin-x64": "@nekocode/agent-codemap-darwin-x64",
|
|
13
|
+
"linux-x64": "@nekocode/agent-codemap-linux-x64",
|
|
14
|
+
"win32-x64": "@nekocode/agent-codemap-win32-x64",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function getPlatformPackage() {
|
|
18
|
+
const key = `${process.platform}-${process.arch}`;
|
|
19
|
+
const pkg = PLATFORMS[key];
|
|
20
|
+
if (!pkg) {
|
|
21
|
+
console.error(`Unsupported platform: ${key}`);
|
|
22
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
return pkg;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ============================================================
|
|
29
|
+
// Binary Resolution
|
|
30
|
+
// ============================================================
|
|
31
|
+
|
|
32
|
+
function getBinaryPath() {
|
|
33
|
+
const pkg = getPlatformPackage();
|
|
34
|
+
const exe = process.platform === "win32" ? "agent-codemap.exe" : "agent-codemap";
|
|
35
|
+
try {
|
|
36
|
+
const pkgPath = require.resolve(`${pkg}/package.json`);
|
|
37
|
+
return join(pkgPath, "..", "bin", exe);
|
|
38
|
+
} catch {
|
|
39
|
+
console.error(`Platform package not found: ${pkg}`);
|
|
40
|
+
console.error("Try reinstalling: npm install @nekocode/agent-codemap");
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ============================================================
|
|
46
|
+
// Execute
|
|
47
|
+
// ============================================================
|
|
48
|
+
|
|
49
|
+
const binary = getBinaryPath();
|
|
50
|
+
const args = process.argv.slice(2);
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
execFileSync(binary, args, { stdio: "inherit" });
|
|
54
|
+
} catch (err) {
|
|
55
|
+
if (err.status !== undefined) {
|
|
56
|
+
process.exit(err.status);
|
|
57
|
+
}
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// Postinstall: Verify Platform Package
|
|
3
|
+
// ============================================================
|
|
4
|
+
|
|
5
|
+
const PLATFORMS = {
|
|
6
|
+
"darwin-arm64": "@nekocode/agent-codemap-darwin-arm64",
|
|
7
|
+
"darwin-x64": "@nekocode/agent-codemap-darwin-x64",
|
|
8
|
+
"linux-x64": "@nekocode/agent-codemap-linux-x64",
|
|
9
|
+
"win32-x64": "@nekocode/agent-codemap-win32-x64",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const key = `${process.platform}-${process.arch}`;
|
|
13
|
+
const pkg = PLATFORMS[key];
|
|
14
|
+
|
|
15
|
+
if (!pkg) {
|
|
16
|
+
console.warn(`[agent-codemap] Warning: Unsupported platform ${key}`);
|
|
17
|
+
console.warn(`[agent-codemap] Supported: ${Object.keys(PLATFORMS).join(", ")}`);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
require.resolve(`${pkg}/package.json`);
|
|
23
|
+
} catch {
|
|
24
|
+
console.warn(`[agent-codemap] Warning: Platform package ${pkg} not installed`);
|
|
25
|
+
console.warn(`[agent-codemap] This may happen if npm failed to install optional dependencies`);
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nekocode/agent-codemap",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AI-friendly source code index generator",
|
|
5
|
+
"keywords": ["cli", "code-index", "tree-sitter", "ai", "llm"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/user/agent-codemap"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"agent-codemap": "bin/agent-codemap.js"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"postinstall": "node install.js"
|
|
16
|
+
},
|
|
17
|
+
"optionalDependencies": {
|
|
18
|
+
"@nekocode/agent-codemap-darwin-arm64": "0.1.0",
|
|
19
|
+
"@nekocode/agent-codemap-darwin-x64": "0.1.0",
|
|
20
|
+
"@nekocode/agent-codemap-linux-x64": "0.1.0",
|
|
21
|
+
"@nekocode/agent-codemap-win32-x64": "0.1.0"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=14"
|
|
25
|
+
}
|
|
26
|
+
}
|