agents-chatgroup 0.1.1-main.9

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 (3) hide show
  1. package/README.md +135 -0
  2. package/bin/cli.js +496 -0
  3. package/package.json +44 -0
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # agents-chatgroup
2
+
3
+ AI Coding Agents Chatgroup - A cross-platform installer and runner for the agents-chatgroup application.
4
+
5
+ ## Quick Start
6
+
7
+ Run directly with npx (no pre-installation required):
8
+
9
+ ```bash
10
+ npx agents-chatgroup
11
+ ```
12
+
13
+ This will automatically:
14
+ 1. Check system dependencies
15
+ 2. Clone the source code from GitHub
16
+ 3. Install dependencies
17
+ 4. Build the project
18
+ 5. Start the application
19
+
20
+ ## Commands
21
+
22
+ | Command | Description |
23
+ |---------|-------------|
24
+ | `npx agents-chatgroup` | Install (if needed) and start |
25
+ | `npx agents-chatgroup install` | Install/update only |
26
+ | `npx agents-chatgroup start` | Start the application |
27
+ | `npx agents-chatgroup update` | Update to latest version |
28
+ | `npx agents-chatgroup status` | Show installation status |
29
+ | `npx agents-chatgroup uninstall` | Remove installation |
30
+ | `npx agents-chatgroup --help` | Show help message |
31
+
32
+ ## Supported Platforms
33
+
34
+ | Platform | Architecture | Status |
35
+ |----------|--------------|--------|
36
+ | macOS | Intel (x64) | ✅ |
37
+ | macOS | Apple Silicon (ARM64) | ✅ |
38
+ | Linux | x64 | ✅ |
39
+ | Linux | ARM64 | ✅ |
40
+ | Windows | x64 | ✅ |
41
+ | Windows | ARM64 | ✅ |
42
+
43
+ ## Requirements
44
+
45
+ ### Required
46
+ - **Node.js** 18 or higher
47
+ - **npm** (comes with Node.js)
48
+ - **Git** for cloning the source code
49
+
50
+ ### Optional
51
+ - **Rust** (if building Rust components)
52
+
53
+ ## How It Works
54
+
55
+ 1. **First Run**: The CLI clones the source code from GitHub to `~/.agents-chatgroup/source/`
56
+ 2. **Dependencies**: Automatically runs `npm install` for frontend and server
57
+ 3. **Build**: Builds the frontend and any Rust components (if Rust is installed)
58
+ 4. **Run**: Starts the application using the appropriate entry point
59
+
60
+ ## Installation Directory
61
+
62
+ All files are stored in `~/.agents-chatgroup/`:
63
+
64
+ ```
65
+ ~/.agents-chatgroup/
66
+ ├── source/ # Cloned source code
67
+ └── config/ # Configuration files
68
+ ```
69
+
70
+ ## User Experience
71
+
72
+ ```
73
+ $ npx agents-chatgroup
74
+
75
+ ╔═══════════════════════════════════════════════╗
76
+ ║ 🤖 Agents Chatgroup Installer ║
77
+ ╚═══════════════════════════════════════════════╝
78
+
79
+ 📍 Platform: macOS arm64
80
+ 📦 Version: v1.0.0
81
+ 📂 Install: /Users/you/.agents-chatgroup
82
+
83
+ First time setup - installing agents-chatgroup...
84
+
85
+ [1/4] Checking dependencies...
86
+
87
+ Dependency Version Status
88
+ ─────────────────────────────────────────
89
+ Node.js v20.10.0 ✓
90
+ npm v10.2.3 ✓
91
+ Git 2.42.0 ✓
92
+ Rust 1.75.0 ✓
93
+
94
+ [2/4] Getting source code...
95
+ Cloning repository...
96
+
97
+ [3/4] Installing dependencies...
98
+ Installing frontend dependencies...
99
+
100
+ [4/4] Building project...
101
+ Building frontend...
102
+
103
+ ✅ Installation complete!
104
+
105
+ 🚀 Starting agents-chatgroup...
106
+ ```
107
+
108
+ ## Environment Variables
109
+
110
+ | Variable | Description |
111
+ |----------|-------------|
112
+ | `AGENTS_CHATGROUP_DEBUG=1` | Enable debug output |
113
+
114
+ ## Troubleshooting
115
+
116
+ ### Git not found
117
+ Install Git from https://git-scm.com/downloads
118
+
119
+ ### Node.js version too old
120
+ Update Node.js to version 18 or higher from https://nodejs.org/
121
+
122
+ ### Build errors
123
+ - Ensure you have the required build tools installed
124
+ - On macOS: `xcode-select --install`
125
+ - On Linux: `sudo apt install build-essential`
126
+ - On Windows: Install Visual Studio Build Tools
127
+
128
+ ## License
129
+
130
+ MIT
131
+
132
+ ## Links
133
+
134
+ - [GitHub Repository](https://github.com/anthropics/agents-chatgroup)
135
+ - [Report Issues](https://github.com/anthropics/agents-chatgroup/issues)
package/bin/cli.js ADDED
@@ -0,0 +1,496 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync, spawn } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+ const os = require("os");
7
+ const https = require("https");
8
+ const readline = require("readline");
9
+
10
+ const CLI_VERSION = require("../package.json").version;
11
+
12
+ // ================================
13
+ // Configuration
14
+ // ================================
15
+
16
+ const REPO_URL = "https://github.com/StarterraAI/AgentsChatGroup";
17
+ const INSTALL_DIR = path.join(os.homedir(), ".agents-chatgroup");
18
+ const SOURCE_DIR = path.join(INSTALL_DIR, "source");
19
+ const CONFIG_DIR = path.join(INSTALL_DIR, "config");
20
+
21
+ // ================================
22
+ // Platform Detection
23
+ // ================================
24
+
25
+ function getPlatformInfo() {
26
+ const platform = process.platform;
27
+ const arch = process.arch;
28
+
29
+ const osNames = {
30
+ darwin: "macOS",
31
+ linux: "Linux",
32
+ win32: "Windows"
33
+ };
34
+
35
+ return {
36
+ platform,
37
+ arch,
38
+ osName: osNames[platform] || platform,
39
+ isWindows: platform === "win32",
40
+ isMac: platform === "darwin",
41
+ isLinux: platform === "linux"
42
+ };
43
+ }
44
+
45
+ const platformInfo = getPlatformInfo();
46
+
47
+ // ================================
48
+ // UI Helpers
49
+ // ================================
50
+
51
+ function printBanner() {
52
+ console.log("");
53
+ console.log(" ╔═══════════════════════════════════════════════╗");
54
+ console.log(" ║ 🤖 Agents Chatgroup Installer ║");
55
+ console.log(" ╚═══════════════════════════════════════════════╝");
56
+ console.log("");
57
+ }
58
+
59
+ function printSystemInfo() {
60
+ console.log(` 📍 Platform: ${platformInfo.osName} ${platformInfo.arch}`);
61
+ console.log(` 📦 Version: v${CLI_VERSION}`);
62
+ console.log(` 📂 Install: ${INSTALL_DIR}`);
63
+ console.log("");
64
+ }
65
+
66
+ function printStep(step, message) {
67
+ console.log(` [${step}] ${message}`);
68
+ }
69
+
70
+ function printSuccess(message) {
71
+ console.log(` ✅ ${message}`);
72
+ }
73
+
74
+ function printError(message) {
75
+ console.error(` ❌ ${message}`);
76
+ }
77
+
78
+ function printWarning(message) {
79
+ console.log(` ⚠️ ${message}`);
80
+ }
81
+
82
+ // ================================
83
+ // Command Execution
84
+ // ================================
85
+
86
+ function execCommand(command, options = {}) {
87
+ const defaultOptions = {
88
+ encoding: "utf8",
89
+ stdio: options.silent ? "pipe" : "inherit",
90
+ shell: true,
91
+ ...options
92
+ };
93
+
94
+ try {
95
+ return execSync(command, defaultOptions);
96
+ } catch (error) {
97
+ if (!options.ignoreError) {
98
+ throw error;
99
+ }
100
+ return null;
101
+ }
102
+ }
103
+
104
+ function commandExists(command) {
105
+ try {
106
+ const checkCmd = platformInfo.isWindows
107
+ ? `where ${command}`
108
+ : `command -v ${command}`;
109
+ execSync(checkCmd, { stdio: "pipe", encoding: "utf8" });
110
+ return true;
111
+ } catch {
112
+ return false;
113
+ }
114
+ }
115
+
116
+ // ================================
117
+ // Dependency Checking
118
+ // ================================
119
+
120
+ function checkDependencies() {
121
+ printStep("1/4", "Checking dependencies...");
122
+
123
+ const dependencies = [];
124
+
125
+ // Check Node.js version
126
+ const nodeVersion = process.version;
127
+ const nodeMajor = parseInt(nodeVersion.slice(1).split(".")[0], 10);
128
+ if (nodeMajor < 18) {
129
+ printError(`Node.js 18+ required (found ${nodeVersion})`);
130
+ process.exit(1);
131
+ }
132
+ dependencies.push({ name: "Node.js", version: nodeVersion, status: "✓" });
133
+
134
+ // Check npm
135
+ if (!commandExists("npm")) {
136
+ printError("npm is required but not found");
137
+ process.exit(1);
138
+ }
139
+ const npmVersion = execSync("npm --version", { encoding: "utf8" }).trim();
140
+ dependencies.push({ name: "npm", version: `v${npmVersion}`, status: "✓" });
141
+
142
+ // Check Git
143
+ if (!commandExists("git")) {
144
+ printError("Git is required but not found");
145
+ printError("Please install Git: https://git-scm.com/downloads");
146
+ process.exit(1);
147
+ }
148
+ const gitVersion = execSync("git --version", { encoding: "utf8" })
149
+ .trim()
150
+ .replace("git version ", "");
151
+ dependencies.push({ name: "Git", version: gitVersion, status: "✓" });
152
+
153
+ // Check Rust (optional for build)
154
+ let rustStatus = "○ (optional)";
155
+ if (commandExists("rustc")) {
156
+ const rustVersion = execSync("rustc --version", { encoding: "utf8" })
157
+ .trim()
158
+ .replace("rustc ", "");
159
+ rustStatus = "✓";
160
+ dependencies.push({ name: "Rust", version: rustVersion, status: rustStatus });
161
+ } else {
162
+ dependencies.push({ name: "Rust", version: "not installed", status: rustStatus });
163
+ }
164
+
165
+ // Print dependency table
166
+ console.log("");
167
+ console.log(" Dependency Version Status");
168
+ console.log(" ─────────────────────────────────────────");
169
+ for (const dep of dependencies) {
170
+ const name = dep.name.padEnd(11);
171
+ const version = dep.version.padEnd(20);
172
+ console.log(` ${name} ${version} ${dep.status}`);
173
+ }
174
+ console.log("");
175
+
176
+ return dependencies;
177
+ }
178
+
179
+ // ================================
180
+ // Installation
181
+ // ================================
182
+
183
+ async function cloneOrUpdateRepo() {
184
+ printStep("2/4", "Getting source code...");
185
+
186
+ if (fs.existsSync(SOURCE_DIR)) {
187
+ // Update existing repo
188
+ console.log(" Updating existing installation...");
189
+ try {
190
+ execCommand(`git -C "${SOURCE_DIR}" fetch origin`, { silent: true });
191
+ execCommand(`git -C "${SOURCE_DIR}" reset --hard origin/main`, { silent: true });
192
+ execCommand(`git -C "${SOURCE_DIR}" pull origin main`, { silent: true });
193
+ console.log(" Source code updated.");
194
+ } catch (error) {
195
+ printWarning("Update failed, re-cloning...");
196
+ fs.rmSync(SOURCE_DIR, { recursive: true, force: true });
197
+ execCommand(`git clone --depth 1 ${REPO_URL} "${SOURCE_DIR}"`);
198
+ }
199
+ } else {
200
+ // Fresh clone
201
+ console.log(" Cloning repository...");
202
+ fs.mkdirSync(INSTALL_DIR, { recursive: true });
203
+ execCommand(`git clone --depth 1 ${REPO_URL} "${SOURCE_DIR}"`);
204
+ }
205
+
206
+ console.log("");
207
+ }
208
+
209
+ async function installDependencies() {
210
+ printStep("3/4", "Installing dependencies...");
211
+
212
+ const frontendDir = path.join(SOURCE_DIR, "frontend");
213
+
214
+ if (fs.existsSync(frontendDir)) {
215
+ console.log(" Installing frontend dependencies...");
216
+ execCommand(`npm install`, { cwd: frontendDir });
217
+ }
218
+
219
+ // Check for other package.json in subdirectories
220
+ const serverDir = path.join(SOURCE_DIR, "server");
221
+ if (fs.existsSync(path.join(serverDir, "package.json"))) {
222
+ console.log(" Installing server dependencies...");
223
+ execCommand(`npm install`, { cwd: serverDir });
224
+ }
225
+
226
+ console.log("");
227
+ }
228
+
229
+ async function buildProject() {
230
+ printStep("4/4", "Building project...");
231
+
232
+ // Build frontend
233
+ const frontendDir = path.join(SOURCE_DIR, "frontend");
234
+ if (fs.existsSync(frontendDir)) {
235
+ console.log(" Building frontend...");
236
+ execCommand(`npm run build`, { cwd: frontendDir, ignoreError: true });
237
+ }
238
+
239
+ // Build Rust backend if Cargo.toml exists and Rust is installed
240
+ const cargoToml = path.join(SOURCE_DIR, "Cargo.toml");
241
+ if (fs.existsSync(cargoToml) && commandExists("cargo")) {
242
+ console.log(" Building Rust backend...");
243
+ execCommand(`cargo build --release`, { cwd: SOURCE_DIR, ignoreError: true });
244
+ }
245
+
246
+ console.log("");
247
+ }
248
+
249
+ // ================================
250
+ // Running the Application
251
+ // ================================
252
+
253
+ function findExecutable() {
254
+ // Check for pre-built binary
255
+ const binaryName = platformInfo.isWindows ? "server.exe" : "server";
256
+ const binaryPaths = [
257
+ path.join(SOURCE_DIR, "target", "release", binaryName),
258
+ path.join(SOURCE_DIR, "target", "debug", binaryName),
259
+ path.join(SOURCE_DIR, "dist", binaryName)
260
+ ];
261
+
262
+ for (const binPath of binaryPaths) {
263
+ if (fs.existsSync(binPath)) {
264
+ return { type: "binary", path: binPath };
265
+ }
266
+ }
267
+
268
+ // Check for Node.js entry point
269
+ const nodeEntryPoints = [
270
+ path.join(SOURCE_DIR, "server", "index.js"),
271
+ path.join(SOURCE_DIR, "server", "src", "index.js"),
272
+ path.join(SOURCE_DIR, "dist", "index.js"),
273
+ path.join(SOURCE_DIR, "index.js")
274
+ ];
275
+
276
+ for (const entryPoint of nodeEntryPoints) {
277
+ if (fs.existsSync(entryPoint)) {
278
+ return { type: "node", path: entryPoint };
279
+ }
280
+ }
281
+
282
+ // Check package.json for start script
283
+ const pkgPath = path.join(SOURCE_DIR, "package.json");
284
+ if (fs.existsSync(pkgPath)) {
285
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
286
+ if (pkg.scripts && pkg.scripts.start) {
287
+ return { type: "npm", cwd: SOURCE_DIR };
288
+ }
289
+ }
290
+
291
+ return null;
292
+ }
293
+
294
+ async function runApplication(args = []) {
295
+ const executable = findExecutable();
296
+
297
+ if (!executable) {
298
+ printError("Could not find application entry point.");
299
+ printError("Please run the installer first: npx agents-chatgroup install");
300
+ process.exit(1);
301
+ }
302
+
303
+ console.log(` 🚀 Starting agents-chatgroup...\n`);
304
+
305
+ if (executable.type === "binary") {
306
+ const proc = spawn(executable.path, args, {
307
+ stdio: "inherit",
308
+ cwd: SOURCE_DIR
309
+ });
310
+ proc.on("exit", (code) => process.exit(code || 0));
311
+ proc.on("error", (err) => {
312
+ printError(`Failed to start: ${err.message}`);
313
+ process.exit(1);
314
+ });
315
+ } else if (executable.type === "node") {
316
+ const proc = spawn("node", [executable.path, ...args], {
317
+ stdio: "inherit",
318
+ cwd: SOURCE_DIR
319
+ });
320
+ proc.on("exit", (code) => process.exit(code || 0));
321
+ } else if (executable.type === "npm") {
322
+ execCommand(`npm start -- ${args.join(" ")}`, { cwd: SOURCE_DIR });
323
+ }
324
+ }
325
+
326
+ // ================================
327
+ // Commands
328
+ // ================================
329
+
330
+ function showHelp() {
331
+ console.log(`
332
+ Usage: npx agents-chatgroup [command] [options]
333
+
334
+ Commands:
335
+ install Install/update agents-chatgroup from source
336
+ start Start the application (default if installed)
337
+ update Update to the latest version
338
+ uninstall Remove agents-chatgroup
339
+ status Show installation status
340
+ --help, -h Show this help message
341
+ --version Show version information
342
+
343
+ Examples:
344
+ npx agents-chatgroup # Install and start
345
+ npx agents-chatgroup install # Install only
346
+ npx agents-chatgroup start # Start if installed
347
+ npx agents-chatgroup update # Update to latest
348
+
349
+ Supported Platforms:
350
+ - macOS (Intel & Apple Silicon)
351
+ - Linux (x64 & ARM64)
352
+ - Windows (x64 & ARM64)
353
+
354
+ For more information, visit: https://github.com/anthropics/agents-chatgroup
355
+ `);
356
+ }
357
+
358
+ function showStatus() {
359
+ printBanner();
360
+
361
+ console.log(" Installation Status\n");
362
+
363
+ if (fs.existsSync(SOURCE_DIR)) {
364
+ printSuccess("Installed");
365
+ console.log(` Location: ${SOURCE_DIR}`);
366
+
367
+ // Get current version from git
368
+ try {
369
+ const gitHash = execSync(`git -C "${SOURCE_DIR}" rev-parse --short HEAD`, {
370
+ encoding: "utf8"
371
+ }).trim();
372
+ console.log(` Version: ${gitHash}`);
373
+ } catch {}
374
+
375
+ // Get last update time
376
+ try {
377
+ const gitDate = execSync(
378
+ `git -C "${SOURCE_DIR}" log -1 --format=%ci`,
379
+ { encoding: "utf8" }
380
+ ).trim();
381
+ console.log(` Updated: ${gitDate}`);
382
+ } catch {}
383
+ } else {
384
+ printWarning("Not installed");
385
+ console.log(" Run: npx agents-chatgroup install");
386
+ }
387
+
388
+ console.log("");
389
+ }
390
+
391
+ async function uninstall() {
392
+ printBanner();
393
+ printStep("1/1", "Uninstalling agents-chatgroup...");
394
+
395
+ if (fs.existsSync(INSTALL_DIR)) {
396
+ fs.rmSync(INSTALL_DIR, { recursive: true, force: true });
397
+ printSuccess("Uninstalled successfully");
398
+ } else {
399
+ printWarning("agents-chatgroup is not installed");
400
+ }
401
+
402
+ console.log("");
403
+ }
404
+
405
+ // ================================
406
+ // Main Entry Point
407
+ // ================================
408
+
409
+ async function main() {
410
+ const args = process.argv.slice(2);
411
+ const command = args[0];
412
+
413
+ // Handle help
414
+ if (command === "--help" || command === "-h") {
415
+ printBanner();
416
+ showHelp();
417
+ return;
418
+ }
419
+
420
+ // Handle version
421
+ if (command === "--version" || command === "-v") {
422
+ console.log(`agents-chatgroup CLI v${CLI_VERSION}`);
423
+ return;
424
+ }
425
+
426
+ // Handle status
427
+ if (command === "status") {
428
+ showStatus();
429
+ return;
430
+ }
431
+
432
+ // Handle uninstall
433
+ if (command === "uninstall") {
434
+ await uninstall();
435
+ return;
436
+ }
437
+
438
+ // Handle install
439
+ if (command === "install" || command === "update") {
440
+ printBanner();
441
+ printSystemInfo();
442
+
443
+ checkDependencies();
444
+ await cloneOrUpdateRepo();
445
+ await installDependencies();
446
+ await buildProject();
447
+
448
+ printSuccess("Installation complete!");
449
+ console.log("");
450
+ console.log(" To start the application, run:");
451
+ console.log(" npx agents-chatgroup start");
452
+ console.log("");
453
+ return;
454
+ }
455
+
456
+ // Handle start (explicit)
457
+ if (command === "start") {
458
+ if (!fs.existsSync(SOURCE_DIR)) {
459
+ printBanner();
460
+ printSystemInfo();
461
+ printWarning("agents-chatgroup is not installed. Installing now...\n");
462
+ checkDependencies();
463
+ await cloneOrUpdateRepo();
464
+ await installDependencies();
465
+ await buildProject();
466
+ printSuccess("Installation complete!\n");
467
+ }
468
+ await runApplication(args.slice(1));
469
+ return;
470
+ }
471
+
472
+ // Default behavior: install if not installed, then start
473
+ printBanner();
474
+ printSystemInfo();
475
+
476
+ if (!fs.existsSync(SOURCE_DIR)) {
477
+ console.log(" First time setup - installing agents-chatgroup...\n");
478
+ checkDependencies();
479
+ await cloneOrUpdateRepo();
480
+ await installDependencies();
481
+ await buildProject();
482
+ printSuccess("Installation complete!\n");
483
+ }
484
+
485
+ await runApplication(args);
486
+ }
487
+
488
+ main().catch((err) => {
489
+ console.error("");
490
+ printError(`Fatal error: ${err.message}`);
491
+ if (process.env.AGENTS_CHATGROUP_DEBUG) {
492
+ console.error(err.stack);
493
+ }
494
+ console.error("");
495
+ process.exit(1);
496
+ });
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "agents-chatgroup",
3
+ "version": "0.1.1-main.9",
4
+ "description": "AI Coding Agents Chatgroup - Cross-platform installer and runner",
5
+ "author": "starterra.ai",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/StarterraAI/AgentsChatGroup"
10
+ },
11
+ "homepage": "https://github.com/StarterraAI/AgentsChatGroup",
12
+ "bugs": {
13
+ "url": "https://github.com/StarterraAI/AgentsChatGroup/issues"
14
+ },
15
+ "keywords": [
16
+ "ai",
17
+ "agents",
18
+ "chatgroup",
19
+ "coding",
20
+ "assistant",
21
+ "installer",
22
+ "cli",
23
+ "cross-platform"
24
+ ],
25
+ "bin": {
26
+ "agents-chatgroup": "bin/cli.js"
27
+ },
28
+ "main": "bin/cli.js",
29
+ "files": [
30
+ "bin"
31
+ ],
32
+ "engines": {
33
+ "node": ">=18"
34
+ },
35
+ "os": [
36
+ "darwin",
37
+ "linux",
38
+ "win32"
39
+ ],
40
+ "cpu": [
41
+ "x64",
42
+ "arm64"
43
+ ]
44
+ }