@agentrecon/cli 2.0.0-alpha.1

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.md ADDED
@@ -0,0 +1,14 @@
1
+ # AgentRecon — Proprietary Software
2
+
3
+ Copyright AgentRecon (https://agentrecon.dev). All rights reserved.
4
+
5
+ This software is proprietary and is licenced under the AgentRecon End User Licence Agreement (EULA). By downloading, installing, or using this software, you agree to the terms of the EULA.
6
+
7
+ The full EULA is available at: https://agentrecon.dev/eula
8
+
9
+ ## Summary
10
+
11
+ - You may use the software for any lawful purpose (personal, commercial, organisational)
12
+ - You may not reverse engineer, redistribute, or use it to build a competing product
13
+ - The software is provided "as is" without warranty
14
+ - See the EULA for full terms
package/bin/recon.js 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
+
7
+ const ext = process.platform === "win32" ? ".exe" : "";
8
+ const binary = path.join(__dirname, `recon${ext}`);
9
+
10
+ try {
11
+ execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
12
+ } catch (err) {
13
+ if (err.status !== null) {
14
+ process.exit(err.status);
15
+ }
16
+ console.error(`Failed to run AgentRecon: ${err.message}`);
17
+ console.error(`Expected binary at: ${binary}`);
18
+ console.error(`Try reinstalling: npm install -g @agentrecon/cli`);
19
+ process.exit(1);
20
+ }
package/install.js ADDED
@@ -0,0 +1,148 @@
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 path = require("path");
8
+ const os = require("os");
9
+ const { createHash } = require("crypto");
10
+
11
+ const REPO = "AgentRecon/agentrecon";
12
+ const BINARY_NAME = "recon";
13
+
14
+ const PLATFORM_MAP = {
15
+ "darwin-x64": "x86_64-apple-darwin",
16
+ "darwin-arm64": "aarch64-apple-darwin",
17
+ "linux-x64": "x86_64-unknown-linux-gnu",
18
+ "linux-arm64": "aarch64-unknown-linux-gnu",
19
+ "win32-x64": "x86_64-pc-windows-msvc",
20
+ "win32-arm64": "aarch64-pc-windows-msvc",
21
+ };
22
+
23
+ const ARCHIVE_EXT = {
24
+ darwin: "tar.gz",
25
+ linux: "tar.gz",
26
+ win32: "zip",
27
+ };
28
+
29
+ function getPlatformTarget() {
30
+ const key = `${process.platform}-${process.arch}`;
31
+ const target = PLATFORM_MAP[key];
32
+ if (!target) {
33
+ console.error(`Unsupported platform: ${key}`);
34
+ console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`);
35
+ process.exit(1);
36
+ }
37
+ return target;
38
+ }
39
+
40
+ function getVersion() {
41
+ const pkg = require("./package.json");
42
+ // npm version may be "2.0.0-alpha.1" — tag is "v2.0.0-alpha.1"
43
+ return `v${pkg.version}`;
44
+ }
45
+
46
+ function fetch(url) {
47
+ return new Promise((resolve, reject) => {
48
+ const get = (url, redirectCount) => {
49
+ if (redirectCount > 5) return reject(new Error("Too many redirects"));
50
+ https
51
+ .get(url, { headers: { "User-Agent": "agentrecon-npm-installer" } }, (res) => {
52
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
53
+ return get(res.headers.location, redirectCount + 1);
54
+ }
55
+ if (res.statusCode !== 200) {
56
+ return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
57
+ }
58
+ const chunks = [];
59
+ res.on("data", (chunk) => chunks.push(chunk));
60
+ res.on("end", () => resolve(Buffer.concat(chunks)));
61
+ res.on("error", reject);
62
+ })
63
+ .on("error", reject);
64
+ };
65
+ get(url, 0);
66
+ });
67
+ }
68
+
69
+ async function downloadAndVerify(version, target) {
70
+ const ext = ARCHIVE_EXT[process.platform];
71
+ const archiveName = `${BINARY_NAME}-${version}-${target}.${ext}`;
72
+ const baseUrl = `https://github.com/${REPO}/releases/download/${version}`;
73
+
74
+ console.log(`Downloading AgentRecon ${version} for ${target}...`);
75
+
76
+ const [archive, checksumFile] = await Promise.all([
77
+ fetch(`${baseUrl}/${archiveName}`),
78
+ fetch(`${baseUrl}/${archiveName}.sha256`),
79
+ ]);
80
+
81
+ // Verify checksum
82
+ const expectedHash = checksumFile.toString("utf8").trim().split(/\s+/)[0];
83
+ const actualHash = createHash("sha256").update(archive).digest("hex");
84
+
85
+ if (expectedHash !== actualHash) {
86
+ console.error(`Checksum mismatch!`);
87
+ console.error(` Expected: ${expectedHash}`);
88
+ console.error(` Actual: ${actualHash}`);
89
+ process.exit(1);
90
+ }
91
+
92
+ console.log("Checksum verified.");
93
+ return { archive, ext };
94
+ }
95
+
96
+ function extractBinary(archive, ext) {
97
+ const binDir = path.join(__dirname, "bin");
98
+ fs.mkdirSync(binDir, { recursive: true });
99
+
100
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "agentrecon-"));
101
+ const archivePath = path.join(tmpDir, `archive.${ext}`);
102
+ fs.writeFileSync(archivePath, archive);
103
+
104
+ try {
105
+ if (ext === "tar.gz") {
106
+ execSync(`tar xzf "${archivePath}" -C "${binDir}"`, { stdio: "pipe" });
107
+ } else if (ext === "zip") {
108
+ // Windows: use PowerShell to extract
109
+ execSync(
110
+ `powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${binDir}' -Force"`,
111
+ { stdio: "pipe" }
112
+ );
113
+ }
114
+ } finally {
115
+ fs.rmSync(tmpDir, { recursive: true, force: true });
116
+ }
117
+
118
+ const binaryPath = path.join(binDir, process.platform === "win32" ? `${BINARY_NAME}.exe` : BINARY_NAME);
119
+
120
+ if (!fs.existsSync(binaryPath)) {
121
+ console.error(`Binary not found at ${binaryPath} after extraction.`);
122
+ process.exit(1);
123
+ }
124
+
125
+ if (process.platform !== "win32") {
126
+ fs.chmodSync(binaryPath, 0o755);
127
+ }
128
+
129
+ console.log(`Installed: ${binaryPath}`);
130
+ }
131
+
132
+ async function main() {
133
+ // Skip install in CI if AGENTRECON_SKIP_INSTALL is set
134
+ if (process.env.AGENTRECON_SKIP_INSTALL) {
135
+ console.log("AGENTRECON_SKIP_INSTALL set, skipping binary download.");
136
+ return;
137
+ }
138
+
139
+ const target = getPlatformTarget();
140
+ const version = getVersion();
141
+ const { archive, ext } = await downloadAndVerify(version, target);
142
+ extractBinary(archive, ext);
143
+ }
144
+
145
+ main().catch((err) => {
146
+ console.error(`Failed to install AgentRecon: ${err.message}`);
147
+ process.exit(1);
148
+ });
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@agentrecon/cli",
3
+ "version": "2.0.0-alpha.1",
4
+ "description": "Code intelligence engine for AI coding assistants",
5
+ "license": "LicenseRef-Proprietary",
6
+ "homepage": "https://agentrecon.dev",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/AgentRecon/agentrecon.git"
10
+ },
11
+ "publishConfig": {
12
+ "provenance": true
13
+ },
14
+ "bin": {
15
+ "recon": "bin/recon.js"
16
+ },
17
+ "scripts": {
18
+ "postinstall": "node install.js"
19
+ },
20
+ "os": [
21
+ "darwin",
22
+ "linux",
23
+ "win32"
24
+ ],
25
+ "cpu": [
26
+ "x64",
27
+ "arm64"
28
+ ],
29
+ "keywords": [
30
+ "agentrecon",
31
+ "code-intelligence",
32
+ "mcp",
33
+ "ai-coding",
34
+ "static-analysis",
35
+ "security",
36
+ "blast-radius"
37
+ ],
38
+ "files": [
39
+ "install.js",
40
+ "bin/recon.js",
41
+ "LICENSE.md"
42
+ ]
43
+ }