openagere 0.0.1 → 0.0.2

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 CHANGED
@@ -1,34 +1,14 @@
1
- # OpenAgere
1
+ # openagere
2
2
 
3
- > Multi-agent framework for building intelligent, collaborative AI agents.
3
+ AI coding assistant. A Rust reimplementation forked from OpenAI's Codex CLI.
4
4
 
5
- ## Status
6
-
7
- This is a **demo placeholder** package (`v0.0.1`). The full version is under active development.
8
-
9
- ## Quick Start
10
-
11
- ```bash
12
- npx openagere hello
13
- ```
14
-
15
- Or install globally:
5
+ ## Installation
16
6
 
17
7
  ```bash
18
- npm install -g openagere
19
- openagere --version
20
- openagere hello
21
- openagere --help
8
+ npm i -g openagere
9
+ openagere
22
10
  ```
23
11
 
24
- ## Commands
25
-
26
- | Command | Description |
27
- |---------------|-----------------------|
28
- | `hello` | Show welcome message |
29
- | `--version` | Show version number |
30
- | `--help` | Show help |
31
-
32
- ## License
12
+ ## Documentation
33
13
 
34
- Apache-2.0
14
+ See the [GitHub repository](https://github.com/openagere/openagere) for full documentation.
@@ -0,0 +1,201 @@
1
+ #!/usr/bin/env node
2
+ // Unified entry point for the Openagere CLI.
3
+
4
+ import { spawn } from "node:child_process";
5
+ import { existsSync } from "fs";
6
+ import { createRequire } from "node:module";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const require = createRequire(import.meta.url);
13
+
14
+ const PLATFORM_PACKAGE_BY_TARGET = {
15
+ "x86_64-unknown-linux-musl": "openagere-linux-x64",
16
+ "aarch64-unknown-linux-musl": "openagere-linux-arm64",
17
+ "x86_64-apple-darwin": "openagere-darwin-x64",
18
+ "aarch64-apple-darwin": "openagere-darwin-arm64",
19
+ "x86_64-pc-windows-msvc": "openagere-win32-x64",
20
+ "aarch64-pc-windows-msvc": "openagere-win32-arm64",
21
+ };
22
+
23
+ const { platform, arch } = process;
24
+
25
+ let targetTriple = null;
26
+ switch (platform) {
27
+ case "linux":
28
+ case "android":
29
+ switch (arch) {
30
+ case "x64":
31
+ targetTriple = "x86_64-unknown-linux-musl";
32
+ break;
33
+ case "arm64":
34
+ targetTriple = "aarch64-unknown-linux-musl";
35
+ break;
36
+ default:
37
+ break;
38
+ }
39
+ break;
40
+ case "darwin":
41
+ switch (arch) {
42
+ case "x64":
43
+ targetTriple = "x86_64-apple-darwin";
44
+ break;
45
+ case "arm64":
46
+ targetTriple = "aarch64-apple-darwin";
47
+ break;
48
+ default:
49
+ break;
50
+ }
51
+ break;
52
+ case "win32":
53
+ switch (arch) {
54
+ case "x64":
55
+ targetTriple = "x86_64-pc-windows-msvc";
56
+ break;
57
+ case "arm64":
58
+ targetTriple = "aarch64-pc-windows-msvc";
59
+ break;
60
+ default:
61
+ break;
62
+ }
63
+ break;
64
+ default:
65
+ break;
66
+ }
67
+
68
+ if (!targetTriple) {
69
+ throw new Error(`Unsupported platform: ${platform} (${arch})`);
70
+ }
71
+
72
+ const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
73
+ if (!platformPackage) {
74
+ throw new Error(`Unsupported target triple: ${targetTriple}`);
75
+ }
76
+
77
+ const binaryName = process.platform === "win32" ? "openagere.exe" : "openagere";
78
+ const localVendorRoot = path.join(__dirname, "..", "vendor");
79
+ const localBinaryPath = path.join(
80
+ localVendorRoot,
81
+ targetTriple,
82
+ "bin",
83
+ binaryName,
84
+ );
85
+
86
+ let vendorRoot;
87
+ try {
88
+ const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
89
+ vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
90
+ } catch {
91
+ if (existsSync(localBinaryPath)) {
92
+ vendorRoot = localVendorRoot;
93
+ } else {
94
+ const packageManager = detectPackageManager();
95
+ const updateCommand =
96
+ packageManager === "bun"
97
+ ? "bun install -g openagere@latest"
98
+ : "npm install -g openagere@latest";
99
+ throw new Error(
100
+ `Missing optional dependency ${platformPackage}. Reinstall Openagere: ${updateCommand}`,
101
+ );
102
+ }
103
+ }
104
+
105
+ if (!vendorRoot) {
106
+ const packageManager = detectPackageManager();
107
+ const updateCommand =
108
+ packageManager === "bun"
109
+ ? "bun install -g openagere@latest"
110
+ : "npm install -g openagere@latest";
111
+ throw new Error(
112
+ `Missing optional dependency ${platformPackage}. Reinstall Openagere: ${updateCommand}`,
113
+ );
114
+ }
115
+
116
+ const archRoot = path.join(vendorRoot, targetTriple);
117
+ const binaryPath = path.join(archRoot, "bin", binaryName);
118
+
119
+ function getUpdatedPath(newDirs) {
120
+ const pathSep = process.platform === "win32" ? ";" : ":";
121
+ const existingPath = process.env.PATH || "";
122
+ const updatedPath = [
123
+ ...newDirs,
124
+ ...existingPath.split(pathSep).filter(Boolean),
125
+ ].join(pathSep);
126
+ return updatedPath;
127
+ }
128
+
129
+ function detectPackageManager() {
130
+ const userAgent = process.env.npm_config_user_agent || "";
131
+ if (/\bbun\//.test(userAgent)) {
132
+ return "bun";
133
+ }
134
+
135
+ const execPath = process.env.npm_execpath || "";
136
+ if (execPath.includes("bun")) {
137
+ return "bun";
138
+ }
139
+
140
+ if (
141
+ __dirname.includes(".bun/install/global") ||
142
+ __dirname.includes(".bun\\install\\global")
143
+ ) {
144
+ return "bun";
145
+ }
146
+
147
+ return userAgent ? "npm" : null;
148
+ }
149
+
150
+ const additionalDirs = [];
151
+ const pathDir = path.join(archRoot, "path");
152
+ if (existsSync(pathDir)) {
153
+ additionalDirs.push(pathDir);
154
+ }
155
+ const updatedPath = getUpdatedPath(additionalDirs);
156
+
157
+ const env = { ...process.env, PATH: updatedPath };
158
+ const packageManagerEnvVar =
159
+ detectPackageManager() === "bun"
160
+ ? "OPENAGERE_MANAGED_BY_BUN"
161
+ : "OPENAGERE_MANAGED_BY_NPM";
162
+ env[packageManagerEnvVar] = "1";
163
+
164
+ const child = spawn(binaryPath, process.argv.slice(2), {
165
+ stdio: "inherit",
166
+ env,
167
+ });
168
+
169
+ child.on("error", (err) => {
170
+ console.error(err);
171
+ process.exit(1);
172
+ });
173
+
174
+ const forwardSignal = (signal) => {
175
+ if (child.killed) return;
176
+ try {
177
+ child.kill(signal);
178
+ } catch {
179
+ /* ignore */
180
+ }
181
+ };
182
+
183
+ ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
184
+ process.on(sig, () => forwardSignal(sig));
185
+ });
186
+
187
+ const childResult = await new Promise((resolve) => {
188
+ child.on("exit", (code, signal) => {
189
+ if (signal) {
190
+ resolve({ type: "signal", signal });
191
+ } else {
192
+ resolve({ type: "code", exitCode: code ?? 1 });
193
+ }
194
+ });
195
+ });
196
+
197
+ if (childResult.type === "signal") {
198
+ process.kill(process.pid, childResult.signal);
199
+ } else {
200
+ process.exit(childResult.exitCode);
201
+ }
package/package.json CHANGED
@@ -1,33 +1,26 @@
1
1
  {
2
2
  "name": "openagere",
3
- "version": "0.0.1",
4
- "description": "OpenAgere - Multi-agent framework. This is a demo placeholder package.",
5
- "main": "bin/cli.js",
3
+ "version": "0.0.2",
4
+ "description": "Openagere CLI - AI coding assistant",
5
+ "type": "module",
6
6
  "bin": {
7
- "openagere": "./bin/cli.js"
7
+ "openagere": "bin/openagere.js"
8
8
  },
9
- "scripts": {
10
- "start": "node bin/cli.js",
11
- "test": "echo \"No tests specified\" && exit 0"
9
+ "preferUnplugged": true,
10
+ "optionalDependencies": {
11
+ "@openagere/darwin-arm64": "0.0.2",
12
+ "@openagere/darwin-x64": "0.0.2",
13
+ "@openagere/linux-arm64": "0.0.2",
14
+ "@openagere/linux-x64": "0.0.2",
15
+ "@openagere/win32-arm64": "0.0.2",
16
+ "@openagere/win32-x64": "0.0.2"
12
17
  },
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/openagere/openagere"
16
- },
17
- "keywords": [
18
- "openagere",
19
- "agent",
20
- "multi-agent",
21
- "ai",
22
- "framework"
18
+ "files": [
19
+ "bin/openagere.js",
20
+ "README.md"
23
21
  ],
24
- "author": "openagere",
25
- "license": "Apache-2.0",
26
- "bugs": {
27
- "url": "https://github.com/openagere/openagere/issues"
28
- },
29
- "homepage": "https://github.com/openagere/openagere#readme",
30
22
  "engines": {
31
- "node": ">=14.0.0"
32
- }
23
+ "node": ">=18"
24
+ },
25
+ "license": "Apache-2.0"
33
26
  }
package/bin/cli.js DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const pkg = require('../package.json');
4
-
5
- const commands = {
6
- '--version': () => {
7
- console.log(`openagere v${pkg.version}`);
8
- },
9
- '--help': () => {
10
- console.log(`
11
- OpenAgere - Multi-agent framework (demo placeholder)
12
-
13
- Usage:
14
- openagere [command] [options]
15
-
16
- Commands:
17
- hello Show a welcome message
18
- --version Show version number
19
- --help Show help
20
-
21
- This is a demo placeholder package. Full version coming soon.
22
- `);
23
- },
24
- hello: () => {
25
- console.log(`
26
- ╔══════════════════════════════════════════╗
27
- ║ ║
28
- ║ Welcome to OpenAgere v${pkg.version} ║
29
- ║ ║
30
- ║ Multi-agent framework for building ║
31
- ║ intelligent, collaborative AI agents. ║
32
- ║ ║
33
- ║ 🚧 This is a demo placeholder. ║
34
- ║ Full version coming soon. ║
35
- ║ ║
36
- ║ GitHub: github.com/openagere/openagere ║
37
- ║ ║
38
- ╚══════════════════════════════════════════╝
39
- `);
40
- }
41
- };
42
-
43
- function main() {
44
- const args = process.argv.slice(2);
45
- const command = args[0];
46
-
47
- if (!command || command === '--version') {
48
- commands['--version']();
49
- return;
50
- }
51
-
52
- if (commands[command]) {
53
- commands[command]();
54
- return;
55
- }
56
-
57
- console.error(`Unknown command: ${command}`);
58
- console.error('Run "openagere --help" for usage information.');
59
- process.exit(1);
60
- }
61
-
62
- main();