@armanage/clarmanage 0.1.1 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +19 -147
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,173 +1,45 @@
1
- # Clarmanage — Local AI Agent Runner
1
+ # Clarmanage
2
2
 
3
- Clarmanage is a lightweight TypeScript CLI that runs on your machine and acts as a bridge between the [Armanage](../README.md) server and AI SDKs. It continuously polls the server for queued tasks, routes each task to the appropriate AI agent (Codex, Claude, Copilot, etc.), streams execution logs back in real time, and reports final results — all without exposing your local environment to the internet.
3
+ Clarmanage is the local runner for Armanage. It connects a machine you control to your Armanage workspace so assigned AI agents can pick up tasks, work inside your environment, and send progress back to the dashboard.
4
4
 
5
- > Implements the architecture described in [`client_prd.md`](./client_prd.md).
5
+ Tasks live in Armanage. Execution happens on your machine. The dashboard gets progress, not your codebase.
6
6
 
7
- ## What is implemented
7
+ ## User Flow
8
8
 
9
- - Generic `Agent` interface.
10
- - `AgentRegistry` for modular agent registration.
11
- - `ClientCore` loop: authenticate -> poll -> execute -> stream logs -> mark completed/failed.
12
- - `CodexAgent` implementation (Phase 1 target) using real `@openai/codex-sdk`.
13
- - HTTP integration with Rails-style endpoints from the PRD.
14
- - Built-in MCP stdio server for `/api/v1/client/*`, exposed via `clarmanage mcp` and auto-attached to Codex runs.
15
- - Exponential backoff when no tasks are available.
16
- - Parallel task processing across configured agents.
17
-
18
- ## Install from npm
19
-
20
- Install globally to get the `clarmanage` executable on your `PATH`:
9
+ 1. Create an agent in Armanage and copy its token.
10
+ 2. Install the runner:
21
11
 
22
12
  ```bash
23
13
  npm install -g @armanage/clarmanage
24
14
  ```
25
15
 
26
- Or run it without a global install:
27
-
28
- ```bash
29
- npx @armanage/clarmanage
30
- ```
31
-
32
- Agent tokens are stored in `~/.clarmanage/agents.json`.
33
-
34
- If `SERVER_BASE_URL` is omitted, the client falls back to `https://armanage.com`. Other runtime env vars also have built-in defaults, so you only need to override what you actually use.
35
-
36
- ## Local development
37
-
38
- 1. Install dependencies:
39
-
40
- ```bash
41
- npm install
42
- ```
43
-
44
- 2. Configure environment variables (or put them in `.env`):
45
-
46
- ```bash
47
- export SERVER_BASE_URL="http://localhost:3000"
48
- export CODEX_API_KEY="your-codex-or-openai-api-key"
49
- export CODEX_YOLO_MODE="true"
50
- # Optional when CODEX_YOLO_MODE=false:
51
- # export CODEX_SANDBOX_MODE="workspace-write"
52
- # export CODEX_APPROVAL_POLICY="on-request"
53
- export CODEX_SKIP_GIT_REPO_CHECK="true"
54
- export USE_MOCK_CODEX_EXECUTOR="false"
55
- export POLL_INTERVAL_MS="2000"
56
- export MAX_BACKOFF_MS="30000"
57
- export REQUEST_TIMEOUT_MS="15000"
58
- ```
59
-
60
- If you skip these variables entirely, the client uses defaults such as `SERVER_BASE_URL=https://armanage.com`, `CODEX_YOLO_MODE=true`, `GEMINI_MODEL=gemini-2.5-flash`, `POLL_INTERVAL_MS=2000`, `MAX_BACKOFF_MS=30000`, and `REQUEST_TIMEOUT_MS=15000`.
61
-
62
- 3. Add one or more agents:
63
-
64
- ```bash
65
- npm run dev -- agent add
66
- ```
67
-
68
- 4. Run in development mode:
69
-
70
- ```bash
71
- npm run dev
72
- ```
73
-
74
- 5. Or build and run:
75
-
76
- ```bash
77
- npm run build
78
- npm start
79
- ```
80
-
81
- ## Run as MCP server
82
-
83
- When you run `clarmanage`, Codex sessions automatically get a built-in `clarmanage` MCP server using the same agent token that the client already uses for API calls.
84
-
85
- For manual testing or standalone MCP registration, Clarmanage can also expose the authenticated client API over MCP stdio:
86
-
87
- ```bash
88
- export SERVER_BASE_URL="http://localhost:3000"
89
- npm run mcp -- your-agent-token
90
- ```
91
-
92
- Or with the built CLI:
93
-
94
- ```bash
95
- clarmanage mcp --token your-agent-token
96
- ```
97
-
98
- This server exposes tools for:
99
-
100
- - `get_agent_profile`
101
- - `send_agent_heartbeat`
102
- - `list_projects`
103
- - `list_tasks`
104
- - `get_task_board`
105
- - `move_task`
106
-
107
- Example Codex registration:
108
-
109
- ```bash
110
- codex mcp add clarmanage \
111
- --env SERVER_BASE_URL=http://localhost:3000 \
112
- -- clarmanage mcp your-agent-token
113
- ```
114
-
115
- ## Run with Mock Server
116
-
117
- 1. Start mock server in terminal 1:
16
+ 3. If you use a self-hosted Armanage instance, point the runner to it:
118
17
 
119
18
  ```bash
120
- npm run dev:server
19
+ export SERVER_BASE_URL="https://your-armanage.example.com"
121
20
  ```
122
21
 
123
- 2. Set client env in terminal 2:
22
+ 4. Connect the runner to your agent:
124
23
 
125
24
  ```bash
126
- export SERVER_BASE_URL="http://localhost:3000"
127
- export CODEX_API_KEY="your-codex-or-openai-api-key"
128
- export USE_MOCK_CODEX_EXECUTOR="false"
25
+ clarmanage agent add YOUR_AGENT_TOKEN
129
26
  ```
130
27
 
131
- If `MOCK_SERVER_PORT` is set to a different value in `.env`, use that same port in `SERVER_BASE_URL`.
132
-
133
- 3. Add mock token as an agent:
28
+ 5. Start the runner:
134
29
 
135
30
  ```bash
136
- npm run dev -- agent add
31
+ clarmanage
137
32
  ```
138
33
 
139
- 4. Run client:
140
-
141
- ```bash
142
- npm run dev
143
- ```
34
+ 6. Create or assign tasks in Armanage. The runner picks them up, works locally, and keeps the dashboard updated with status and progress.
35
+ 7. Review the result in Armanage and stop the runner with `Ctrl+C` when you're done.
144
36
 
145
- 5. Inspect mock state:
37
+ ## Useful Commands
146
38
 
147
39
  ```bash
148
- curl http://localhost:3000/api/v1/debug/state
40
+ clarmanage
41
+ clarmanage agent list
42
+ clarmanage agent remove
149
43
  ```
150
44
 
151
- ## Expected task payload for CodexAgent
152
-
153
- `CodexAgent` expects this minimal payload shape:
154
-
155
- ```json
156
- {
157
- "prompt": "Write a concise summary of this ticket",
158
- "context": "Optional extra context"
159
- }
160
- ```
161
-
162
- ## Notes
163
-
164
- - `RealCodexExecutor` (in `src/codexExecutor.ts`) streams Codex SDK events and reports them as task logs.
165
- - By default the client runs Codex in YOLO mode (`CODEX_YOLO_MODE=true`), which maps to `sandbox=danger-full-access` and `approval_policy=never`.
166
- - Set `CODEX_YOLO_MODE=false` to use explicit `CODEX_SANDBOX_MODE` / `CODEX_APPROVAL_POLICY` values.
167
- - Runtime emits compact task info logs to `stdout` (including reasoning/todo summaries from streamed Codex events).
168
- - Set `USE_MOCK_CODEX_EXECUTOR=true` if you want a fully local run without calling the real Codex API.
169
- - `src/mockServer.ts` seeds one simple codex agent and one queued codex task in memory.
170
- - `.env` and `.env.local` are auto-loaded by both client and mock server entrypoints.
171
- - Agent tokens are stored in `~/.clarmanage/agents.json`.
172
- - CLI commands: `clarmanage`, `clarmanage agent add`, `clarmanage agent remove`, `clarmanage agent list`, `clarmanage mcp`.
173
- - Task completion now prefers moving to the next board column after development (for example `review`/`qa`) instead of jumping directly to `done`; if agent output includes `NEXT_STATUS`, that value is used.
45
+ Repeat `clarmanage agent add` if you want the same machine to serve more than one agent profile.
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@armanage/clarmanage",
3
- "version": "0.1.1",
4
- "description": "Local AI agent runner for Armanage",
3
+ "version": "0.1.2",
4
+ "description": "Local runner for Armanage AI agents",
5
5
  "type": "module",
6
6
  "bin": {
7
- "clarmanage": "./dist/clarmanage.js"
7
+ "clarmanage": "dist/clarmanage.js"
8
8
  },
9
9
  "files": [
10
10
  "dist",