@agentrix/cli 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 +182 -0
- package/bin/agentrix.mjs +35 -0
- package/dist/index.cjs +16774 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +16754 -0
- package/dist/lib.cjs +19 -0
- package/dist/lib.d.cts +76 -0
- package/dist/lib.d.mts +76 -0
- package/dist/lib.mjs +11 -0
- package/dist/logger-CVOTByt5.cjs +497 -0
- package/dist/logger-f691UxTg.mjs +487 -0
- package/package.json +125 -0
- package/scripts/unpack-tools.cjs +163 -0
- package/tools/archives/difftastic-LICENSE +21 -0
- package/tools/archives/difftastic-arm64-darwin.tar.gz +0 -0
- package/tools/archives/difftastic-arm64-linux.tar.gz +0 -0
- package/tools/archives/difftastic-x64-darwin.tar.gz +0 -0
- package/tools/archives/difftastic-x64-linux.tar.gz +0 -0
- package/tools/archives/difftastic-x64-win32.tar.gz +0 -0
- package/tools/archives/ripgrep-LICENSE +3 -0
- package/tools/archives/ripgrep-arm64-darwin.tar.gz +0 -0
- package/tools/archives/ripgrep-arm64-linux.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-darwin.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-linux.tar.gz +0 -0
- package/tools/archives/ripgrep-x64-win32.tar.gz +0 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unpacked/difft +0 -0
- package/tools/unpacked/rg +0 -0
- package/tools/unpacked/ripgrep.node +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Agentrix CLI
|
|
2
|
+
|
|
3
|
+
A daemon-based CLI for managing AI agent workers (Claude Code and Codex) in isolated workspaces with git integration.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Agentrix CLI enables you to run AI agents (Claude or Codex) as background workers that operate in isolated workspaces. Each worker maintains its own git state and communicates with the Agentrix backend server via WebSocket.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
yarn install
|
|
13
|
+
yarn build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Start the daemon
|
|
20
|
+
agentrix start
|
|
21
|
+
|
|
22
|
+
# Check status
|
|
23
|
+
agentrix status
|
|
24
|
+
|
|
25
|
+
# List active sessions
|
|
26
|
+
agentrix ls
|
|
27
|
+
|
|
28
|
+
# Stop a session
|
|
29
|
+
agentrix kill <sessionId>
|
|
30
|
+
|
|
31
|
+
# Stop the daemon
|
|
32
|
+
agentrix stop
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
### Core Commands
|
|
38
|
+
|
|
39
|
+
- `agentrix start` - Start the daemon (if not running) and show status
|
|
40
|
+
- `agentrix stop` - Stop the daemon
|
|
41
|
+
- `agentrix status` - Show daemon and authentication status
|
|
42
|
+
- `agentrix ls` - List active worker sessions
|
|
43
|
+
- `agentrix kill <sessionId>` - Stop a specific worker session
|
|
44
|
+
- `agentrix killall` - Clean up all runaway agentrix processes
|
|
45
|
+
- `agentrix logout` - Logout from Agentrix
|
|
46
|
+
|
|
47
|
+
### Diagnostic Commands
|
|
48
|
+
|
|
49
|
+
- `agentrix doctor` - Run system diagnostics
|
|
50
|
+
|
|
51
|
+
## Architecture
|
|
52
|
+
|
|
53
|
+
### Process Model
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
CLI Entry (bin/agentrix.mjs)
|
|
57
|
+
↓
|
|
58
|
+
Daemon Process (src/daemon/run.ts)
|
|
59
|
+
↓
|
|
60
|
+
Worker Processes (src/worker/)
|
|
61
|
+
├── ClaudeWorker
|
|
62
|
+
└── CodexWorker
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- **Daemon**: Long-running background service that manages worker sessions
|
|
66
|
+
- **Workers**: Isolated agent execution environments that run in separate processes
|
|
67
|
+
- **Communication**: Workers connect to backend via WebSocket for real-time interaction
|
|
68
|
+
|
|
69
|
+
### Key Components
|
|
70
|
+
|
|
71
|
+
- **Machine** (`src/machine.ts`) - Manages machine identity, credentials, and state
|
|
72
|
+
- **Control Server** (`src/daemon/controlServer.ts`) - HTTP server for daemon management
|
|
73
|
+
- **TaskWorkerManager** (`src/daemon/sessions.ts`) - Manages worker process lifecycle
|
|
74
|
+
- **WorkerClient** (`src/worker/workerClient.ts`) - WebSocket client for backend communication
|
|
75
|
+
- **Git State Manager** (`src/worker/gitStateManager.ts`) - Handles git operations for workers
|
|
76
|
+
|
|
77
|
+
## Configuration
|
|
78
|
+
|
|
79
|
+
### Environment Variables
|
|
80
|
+
|
|
81
|
+
| Variable | Default | Description |
|
|
82
|
+
|----------|---------|-------------|
|
|
83
|
+
| `AGENTRIX_SERVER_URL` | `https://agentrix.xmz.ai` | Backend server URL |
|
|
84
|
+
| `AGENTRIX_WEBAPP_URL` | `https://agentrix.xmz.ai` | Web app URL |
|
|
85
|
+
| `AGENTRIX_HOME_DIR` | `~/.agentrix` | State directory |
|
|
86
|
+
| `AGENTRIX_WORKSPACE_HOME_DIR` | `~/.agentrix/workspaces` | Workspace directory |
|
|
87
|
+
| `AGENTRIX_AGENTS_HOME_DIR` | `~/.agentrix/agents` | Agent configs directory |
|
|
88
|
+
| `AGENTRIX_DISABLE_CAFFEINATE` | `false` | Disable sleep prevention |
|
|
89
|
+
| `DEBUG` | - | Enable debug logging |
|
|
90
|
+
|
|
91
|
+
### State Files
|
|
92
|
+
|
|
93
|
+
All state is stored in `~/.agentrix/` (configurable via `AGENTRIX_HOME_DIR`):
|
|
94
|
+
|
|
95
|
+
- `credentials.json` - Authentication token and machine credentials
|
|
96
|
+
- `daemon.state.json` - Daemon PID, port, version info
|
|
97
|
+
- `daemon.state.json.lock` - Lock file for daemon process
|
|
98
|
+
- `machine.key` / `machine.key.pub` - Machine keypair for encryption
|
|
99
|
+
- `settings.json` - User settings
|
|
100
|
+
- `logs/` - Daemon and worker log files
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
### Build Commands
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Type-check and build
|
|
108
|
+
yarn build
|
|
109
|
+
|
|
110
|
+
# Type-check only
|
|
111
|
+
yarn typecheck
|
|
112
|
+
|
|
113
|
+
# Run with development environment
|
|
114
|
+
yarn dev
|
|
115
|
+
|
|
116
|
+
# Run with production environment
|
|
117
|
+
yarn prod
|
|
118
|
+
|
|
119
|
+
# Run linter
|
|
120
|
+
yarn lint
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Testing
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Run all tests
|
|
127
|
+
yarn test
|
|
128
|
+
|
|
129
|
+
# Run a single test file
|
|
130
|
+
yarn build && npx vitest run src/utils/hmac_sha512.test.ts
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Note**: Tests require building first because daemon commands directly execute the binary.
|
|
134
|
+
|
|
135
|
+
### Path Aliases
|
|
136
|
+
|
|
137
|
+
TypeScript path alias `@/*` maps to `src/*`.
|
|
138
|
+
|
|
139
|
+
## Worker Types
|
|
140
|
+
|
|
141
|
+
### ClaudeWorker
|
|
142
|
+
- Uses `@anthropic-ai/claude-agent-sdk`
|
|
143
|
+
- Supports all Claude Code capabilities
|
|
144
|
+
- Auto-commits changes on completion
|
|
145
|
+
|
|
146
|
+
### CodexWorker
|
|
147
|
+
- Uses `@openai/codex-sdk`
|
|
148
|
+
- Supports special commands (merge-request)
|
|
149
|
+
- Auto-generates diffs and commits
|
|
150
|
+
|
|
151
|
+
Both workers:
|
|
152
|
+
- Setup workspace and handle git state on start
|
|
153
|
+
- Connect to backend via WebSocket
|
|
154
|
+
- Process user messages and stream responses
|
|
155
|
+
- Clean up git state on exit
|
|
156
|
+
|
|
157
|
+
## Monorepo Structure
|
|
158
|
+
|
|
159
|
+
This CLI is part of the Agentrix monorepo:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
agentrix/
|
|
163
|
+
├── api/ - Backend API server
|
|
164
|
+
├── app/ - Frontend web/mobile app
|
|
165
|
+
├── shared/ - Shared types and utilities
|
|
166
|
+
└── cli/ - This package
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Main development branch: `develop`
|
|
170
|
+
|
|
171
|
+
## Dependencies
|
|
172
|
+
|
|
173
|
+
- `@anthropic-ai/claude-agent-sdk` - Claude agent integration
|
|
174
|
+
- `@openai/codex-sdk` - Codex agent integration
|
|
175
|
+
- `@agentrix/shared` - Shared types and utilities (monorepo sibling)
|
|
176
|
+
- `ws` - WebSocket client
|
|
177
|
+
- `yargs` - CLI framework
|
|
178
|
+
- `effect` - Functional programming utilities
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
[License information to be added]
|
package/bin/agentrix.mjs
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { join, dirname } from 'path';
|
|
6
|
+
|
|
7
|
+
// Check if we're already running with the flags
|
|
8
|
+
const hasNoWarnings = process.execArgv.includes('--no-warnings');
|
|
9
|
+
const hasNoDeprecation = process.execArgv.includes('--no-deprecation');
|
|
10
|
+
|
|
11
|
+
if (!hasNoWarnings || !hasNoDeprecation) {
|
|
12
|
+
// Get path to the actual CLI entrypoint
|
|
13
|
+
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
14
|
+
const entrypoint = join(projectRoot, 'dist', 'index.mjs');
|
|
15
|
+
|
|
16
|
+
// Execute the actual CLI directly with the correct flags
|
|
17
|
+
try {
|
|
18
|
+
execFileSync(process.execPath, [
|
|
19
|
+
'--no-warnings',
|
|
20
|
+
'--no-deprecation',
|
|
21
|
+
entrypoint,
|
|
22
|
+
...process.argv.slice(2)
|
|
23
|
+
], {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
env: process.env
|
|
26
|
+
});
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// execFileSync throws if the process exits with non-zero
|
|
29
|
+
process.exit(error.status || 1);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
// We're running Node with the flags we wanted, import the CLI entrypoint
|
|
33
|
+
// module to avoid creating a new process.
|
|
34
|
+
await import("../dist/index.mjs");
|
|
35
|
+
}
|