@acp-protocol/cli 0.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 (2) hide show
  1. package/bin/acp.js +60 -0
  2. package/package.json +23 -0
package/bin/acp.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ const { execFileSync } = require('child_process');
3
+ const path = require('path');
4
+ const fs = require('fs');
5
+
6
+ const PLATFORMS = {
7
+ 'darwin-arm64': '@acp-protocol/cli-darwin-arm64',
8
+ 'darwin-x64': '@acp-protocol/cli-darwin-x64',
9
+ 'linux-x64': '@acp-protocol/cli-linux-x64-gnu',
10
+ 'linux-arm64': '@acp-protocol/cli-linux-arm64-gnu',
11
+ 'win32-x64': '@acp-protocol/cli-win32-x64',
12
+ };
13
+
14
+ // Try musl variants for Linux if glibc not available
15
+ const MUSL_FALLBACKS = {
16
+ 'linux-x64': '@acp-protocol/cli-linux-x64-musl',
17
+ 'linux-arm64': '@acp-protocol/cli-linux-arm64-musl',
18
+ };
19
+
20
+ const platformKey = `${process.platform}-${process.arch}`;
21
+ let pkg = PLATFORMS[platformKey];
22
+
23
+ if (!pkg) {
24
+ console.error(`Unsupported platform: ${platformKey}`);
25
+ process.exit(1);
26
+ }
27
+
28
+ function tryResolve(packageName) {
29
+ try {
30
+ const pkgPath = require.resolve(`${packageName}/package.json`);
31
+ const pkgDir = path.dirname(pkgPath);
32
+ const pkgJson = require(pkgPath);
33
+ const binName = process.platform === 'win32' ? 'acp.exe' : 'acp';
34
+ return path.join(pkgDir, 'bin', binName);
35
+ } catch {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ let binaryPath = tryResolve(pkg);
41
+
42
+ // Try musl fallback for Linux
43
+ if (!binaryPath && MUSL_FALLBACKS[platformKey]) {
44
+ binaryPath = tryResolve(MUSL_FALLBACKS[platformKey]);
45
+ }
46
+
47
+ if (!binaryPath) {
48
+ console.error(`Could not find ACP binary for ${platformKey}`);
49
+ console.error('Try reinstalling: npm install -g @acp-protocol/cli');
50
+ process.exit(1);
51
+ }
52
+
53
+ try {
54
+ execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
55
+ } catch (error) {
56
+ if (error.status !== undefined) {
57
+ process.exit(error.status);
58
+ }
59
+ throw error;
60
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@acp-protocol/cli",
3
+ "version": "0.3.0",
4
+ "description": "AI Context Protocol CLI - Token-efficient code documentation for AI systems",
5
+ "bin": {
6
+ "acp": "bin/acp.js"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/acp-protocol/acp-cli.git"
11
+ },
12
+ "keywords": ["ai", "documentation", "code-analysis", "context", "llm", "cli"],
13
+ "license": "MIT",
14
+ "optionalDependencies": {
15
+ "@acp-protocol/cli-darwin-arm64": "0.3.0",
16
+ "@acp-protocol/cli-darwin-x64": "0.3.0",
17
+ "@acp-protocol/cli-linux-x64-gnu": "0.3.0",
18
+ "@acp-protocol/cli-linux-x64-musl": "0.3.0",
19
+ "@acp-protocol/cli-linux-arm64-gnu": "0.3.0",
20
+ "@acp-protocol/cli-linux-arm64-musl": "0.3.0",
21
+ "@acp-protocol/cli-win32-x64": "0.3.0"
22
+ }
23
+ }