Skip to content

Commit 5aebe96

Browse files
committed
feat: add frontend dev controls and safer github writes
1 parent f6c1593 commit 5aebe96

30 files changed

Lines changed: 2128 additions & 194 deletions

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WORKSPACE_ROOT=.
1212
CODEX_WORKDIR=.
1313
CODEX_SDK_CONFIG={}
1414
CODEX_SDK_SKIP_GIT_REPO_CHECK=true
15-
CODEX_SDK_SANDBOX_MODE=
15+
CODEX_SDK_SANDBOX_MODE=workspace-write
1616
CODEX_SDK_APPROVAL_POLICY=
1717
CODEX_SDK_REASONING_EFFORT=
1818
CODEX_SDK_NETWORK_ACCESS_ENABLED=

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
env:
1919
BOT_TOKEN: "ci-bot-token"
2020
ALLOWED_USER_IDS: "1"
21-
CODEX_BACKEND: "sdk"
2221
CODEX_COMMAND: "node"
2322
CODEX_WORKDIR: "."
2423
WORKSPACE_ROOT: "."

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
env:
1818
BOT_TOKEN: "ci-bot-token"
1919
ALLOWED_USER_IDS: "1"
20-
CODEX_BACKEND: "sdk"
2120
CODEX_COMMAND: "node"
2221
CODEX_WORKDIR: "."
2322
WORKSPACE_ROOT: "."

README.md

Lines changed: 99 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,57 @@
1-
# Codex Telegram Claws
1+
# CodexClaw
22

33
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
44
[![Node.js 20+](https://img.shields.io/badge/node-20%2B-green.svg)](https://nodejs.org/en/download/current)
55

66
A Telegram bot that gives you remote access to `@openai/codex` through a Node.js runtime with two Codex backends: the Codex SDK and the legacy CLI/PTy path.
7-
It is strictly inspired by `RichardAtCT/claude-code-telegram`, but this project is implemented for Codex SDK/CLI + MCP + Subagent routing.
7+
It is strictly inspired by `RichardAtCT/claude-code-telegram`, but this project is implemented for Claude Code SDK/CLI + MCP + Subagent routing.
8+
9+
## Use This Like A Skill
10+
11+
### What It Does
12+
13+
- installs a Telegram-facing Codex runtime
14+
- keeps Codex live sessions scoped to `chat + repo`
15+
- manages bot-side MCP and GitHub subagents
16+
- exposes repo switching, status, and minimal frontend dev-server control from Telegram
17+
18+
### Install
19+
20+
```bash
21+
git clone https://github.com/MackDing/CodexClaw.git
22+
cd CodexClaw
23+
npm install
24+
cp .env.example .env
25+
```
26+
27+
### Configure The Minimum
28+
29+
```bash
30+
BOT_TOKEN=123456789:telegram-token
31+
ALLOWED_USER_IDS=123456789
32+
STATE_FILE=.codex-telegram-claws-state.json
33+
WORKSPACE_ROOT=.
34+
CODEX_WORKDIR=.
35+
CODEX_BACKEND=sdk
36+
```
37+
38+
### Start The Skill
39+
40+
```bash
41+
npm run start
42+
```
43+
44+
### Telegram Quick Use
45+
46+
```text
47+
/status
48+
/repo
49+
/skill
50+
/dev status
51+
/gh create repo my-new-app
52+
```
53+
54+
For agent-oriented setup, see [SKILL.md](/Users/ding/Documents/Code/Github/CodexClaw/SKILL.md).
855

956
## What Is This?
1057

@@ -32,8 +79,8 @@ Key design goals:
3279
### Install
3380

3481
```bash
35-
git clone https://github.com/MackDing/codex-telegram-claws.git
36-
cd codex-telegram-claws
82+
git clone https://github.com/MackDing/CodexClaw.git
83+
cd CodexClaw
3784
npm install
3885
```
3986

@@ -129,8 +176,8 @@ Core modules:
129176
- `src/runner/ptyManager.ts`: Codex runner abstraction for SDK threads, CLI/PTy sessions, and CLI exec fallback
130177
- `src/cron/scheduler.ts`: proactive scheduled push
131178

132-
Enterprise target architecture: [docs/enterprise-architecture.md](/Users/ding/Documents/Code/Github/codex-telegram-claws/docs/enterprise-architecture.md)
133-
Enterprise Phase 1 roadmap: [docs/phase-1-roadmap.md](/Users/ding/Documents/Code/Github/codex-telegram-claws/docs/phase-1-roadmap.md)
179+
Enterprise target architecture: [docs/enterprise-architecture.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/enterprise-architecture.md)
180+
Enterprise Phase 1 roadmap: [docs/phase-1-roadmap.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/phase-1-roadmap.md)
134181

135182
## Routing and MCP Boundary
136183

@@ -164,9 +211,9 @@ How they are triggered:
164211

165212
Where this happens:
166213

167-
- Router decision order: [router.ts](/Users/ding/Documents/Code/Github/codex-telegram-claws/src/orchestrator/router.ts)
168-
- Skill toggles per chat: [skillRegistry.ts](/Users/ding/Documents/Code/Github/codex-telegram-claws/src/orchestrator/skillRegistry.ts)
169-
- Telegram command entrypoints: [handlers.ts](/Users/ding/Documents/Code/Github/codex-telegram-claws/src/bot/handlers.ts)
214+
- Router decision order: [router.ts](/Users/ding/Documents/Code/Github/CodexClaw/src/orchestrator/router.ts)
215+
- Skill toggles per chat: [skillRegistry.ts](/Users/ding/Documents/Code/Github/CodexClaw/src/orchestrator/skillRegistry.ts)
216+
- Telegram command entrypoints: [handlers.ts](/Users/ding/Documents/Code/Github/CodexClaw/src/bot/handlers.ts)
170217

171218
Operationally, subagents are the bot's control plane. Codex remains the coding execution plane.
172219

@@ -176,7 +223,7 @@ General:
176223

177224
- `/start` - bootstrap message
178225
- `/help` - command summary
179-
- `/status` - show current chat status, active runner mode, workdir, model override, MCP servers
226+
- `/status` - show current chat status, active runner mode, workdir, model override, MCP servers, and the internal superpowers workflow phase
180227
- `/pwd` - show the current project directory for this chat
181228
- `/repo` - list switchable git projects under `WORKSPACE_ROOT`
182229
- `/repo <name>` - switch the current chat to another project
@@ -196,6 +243,11 @@ General:
196243
- `/skill status` - alias of `/skill list`
197244
- `/skill on <name>` - enable a skill for the current chat
198245
- `/skill off <name>` - disable a skill for the current chat
246+
- `/dev start` - start the current repo frontend server (`dev`, then `start`)
247+
- `/dev stop` - stop the current repo frontend server
248+
- `/dev status` - show the current repo frontend server status
249+
- `/dev logs` - show the current repo frontend server log tail
250+
- `/dev url` - show the detected local frontend URL
199251
- `/sh <command>` - run a safe allowlisted Linux command in the current project (disabled by default)
200252
- `/sh --confirm <command>` - confirm a dangerous command when writable mode is enabled
201253
- `/restart` - restart the bot process explicitly from Telegram
@@ -215,9 +267,11 @@ MCP skill:
215267

216268
GitHub skill:
217269

218-
- `/gh commit "feat: message"` -> `git add .` + commit + push
219-
- `/gh push` -> push current branch
220-
- `/gh create repo my-new-repo` -> create repo and bind origin
270+
- `/gh commit "feat: message"` -> explicit GitHub write action
271+
- `/gh push` -> explicit push for the current branch
272+
- `/gh create repo my-new-repo` -> explicit sibling repo creation under `WORKSPACE_ROOT`
273+
- `/gh confirm` -> confirm the pending GitHub write action and execute it
274+
- plain-text write requests such as `create repo ...`, `commit`, or `push` are intercepted and converted into guidance; they no longer execute GitHub writes directly
221275
- `/gh run tests` -> launch test job
222276
- `/gh test status <jobId>` -> read test status/output tail
223277

@@ -229,8 +283,12 @@ Telegram adaptation notes:
229283
- `/new` is implemented by the bot and resets the current chat session
230284
- `/new` only clears the current project's saved Codex conversation slot
231285
- `/status` is implemented by the bot and reports local runtime state
286+
- `/status` also surfaces the internal `superpowers` workflow system and the last detected workflow phase for the current chat/project session
232287
- `/repo` is implemented by the bot and switches the per-chat working directory inside `WORKSPACE_ROOT`
233288
- `/skill` is implemented by the bot and keeps per-chat skill switches in runtime state
289+
- `/skill` only lists toggleable bot skills; `superpowers` is shown as an internal workflow, not a toggleable skill
290+
- `/dev` is implemented by the bot and manages one frontend server per repo workdir, shared across chats
291+
- `/dev start` prefers `package.json` script `dev` and falls back to `start`
234292
- `/sh` is implemented by the bot, never invokes a shell interpreter, and only accepts configured command prefixes
235293
- `/sh` is read-only by default; dangerous prefixes can be configured and require `--confirm` when writable mode is enabled
236294
- `/plan` translates to a planning-only prompt instead of passing a raw `/plan` slash command to Codex
@@ -273,6 +331,23 @@ The bot now blocks a second Codex run when another bot-managed chat already has
273331
- switching projects clears the pending blocked request
274332
- this guard only sees bot-managed chats in this process; if you also use Codex directly in a terminal, use a separate git worktree to avoid conflicts
275333

334+
## Frontend Debugging Layer
335+
336+
The bot includes a minimal repo-scoped frontend runtime layer:
337+
338+
- `/dev start` starts the current repo's frontend command
339+
- `/dev stop` stops it
340+
- `/dev status` shows whether it is running
341+
- `/dev logs` returns the recent output tail
342+
- `/dev url` returns the first detected local URL from logs
343+
344+
Selection rules:
345+
346+
- prefer `package.json` script `dev`
347+
- if `dev` is missing, fall back to `start`
348+
- keep only one active frontend server per repo workdir
349+
- do not expose arbitrary shell execution through `/dev`
350+
276351
## Backend Selection
277352

278353
Choose the execution backend with `CODEX_BACKEND`:
@@ -294,6 +369,8 @@ CODEX_SDK_WEB_SEARCH_MODE=live
294369
CODEX_SDK_ADDITIONAL_DIRECTORIES=["/abs/path/extra-worktree"]
295370
```
296371

372+
If `CODEX_SDK_SANDBOX_MODE` is unset, the bot now defaults SDK threads to `workspace-write` so normal coding tasks can modify files inside the active repo. Set it explicitly to `read-only` only if you want analysis-only behavior.
373+
297374
CLI-related options:
298375

299376
```bash
@@ -391,13 +468,16 @@ Recommended local release gate:
391468
```bash
392469
BOT_TOKEN=dummy-token ALLOWED_USER_IDS=1 npm run release:check
393470
npm run healthcheck:live
471+
npm run telegram:smoke
394472
```
395473

474+
`v1.0.0` should only be tagged after the full release gate, Telegram smoke checks, and repository metadata sync are complete. The detailed checklist and topic sync command live in [release.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/release.md).
475+
396476
Release references:
397477

398-
- [operations.md](/Users/ding/Documents/Code/Github/codex-telegram-claws/docs/operations.md)
399-
- [release.md](/Users/ding/Documents/Code/Github/codex-telegram-claws/docs/release.md)
400-
- [ecosystem.config.cjs](/Users/ding/Documents/Code/Github/codex-telegram-claws/ecosystem.config.cjs) - PM2 compatibility shim
478+
- [operations.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/operations.md)
479+
- [release.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/release.md)
480+
- [ecosystem.config.cjs](/Users/ding/Documents/Code/Github/CodexClaw/ecosystem.config.cjs) - PM2 compatibility shim
401481

402482
## Security Baseline
403483

@@ -422,9 +502,9 @@ Basic flow:
422502

423503
```bash
424504
pm2 start ecosystem.config.cjs
425-
pm2 status codex-telegram-claws
426-
pm2 logs codex-telegram-claws
427-
pm2 restart codex-telegram-claws
505+
pm2 status CodexClaw
506+
pm2 logs CodexClaw
507+
pm2 restart CodexClaw
428508
```
429509

430510
Run exactly one polling process per bot token.

SKILL.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: CodexClaw
3+
description: Install and operate a Telegram bot that exposes Codex, MCP, GitHub subagents, repo switching, and minimal frontend dev-server control.
4+
---
5+
6+
# CodexClaw
7+
8+
## What This Skill Does
9+
10+
- runs Codex through Telegram
11+
- keeps coding sessions scoped to `chat + repo`
12+
- exposes `/repo`, `/status`, `/skill`, `/gh`, `/mcp`, and `/dev`
13+
- supports frontend repo debugging with `/dev start|stop|status|logs|url`
14+
15+
## Install
16+
17+
```bash
18+
git clone https://github.com/MackDing/CodexClaw.git
19+
cd CodexClaw
20+
npm install
21+
cp .env.example .env
22+
```
23+
24+
## Required Env
25+
26+
Set at least:
27+
28+
```bash
29+
BOT_TOKEN=123456789:telegram-token
30+
ALLOWED_USER_IDS=123456789
31+
STATE_FILE=.codex-telegram-claws-state.json
32+
WORKSPACE_ROOT=.
33+
CODEX_WORKDIR=.
34+
CODEX_BACKEND=sdk
35+
```
36+
37+
## Start
38+
39+
```bash
40+
npm run start
41+
```
42+
43+
## Verify
44+
45+
```bash
46+
npm run check
47+
npm run lint
48+
npm run format:check
49+
npm test
50+
npm run healthcheck
51+
```
52+
53+
## Telegram Quick Use
54+
55+
```text
56+
/status
57+
/repo
58+
/skill
59+
/repo my-project
60+
/dev status
61+
/gh create repo my-new-repo
62+
/gh confirm
63+
```
64+
65+
## Frontend Debugging
66+
67+
Use these commands inside the current repo selected by `/repo`:
68+
69+
- `/dev start`
70+
- `/dev stop`
71+
- `/dev status`
72+
- `/dev logs`
73+
- `/dev url`
74+
- `/gh create repo ...`, `/gh push`, and `/gh commit "..."` are explicit write paths
75+
- `/gh confirm` executes the pending GitHub write action
76+
- plain-text `create repo`, `commit`, and `push` requests are blocked and turned into guidance
77+
78+
Rules:
79+
80+
- `dev` script is preferred
81+
- `start` script is used as fallback
82+
- frontend runtime is shared per repo, not per chat
83+
- `/dev` is not a general-purpose shell
84+
85+
## Notes
86+
87+
- `superpowers` is an internal workflow and shows up in `/status`, not as a toggleable `/skill`
88+
- `/sh` remains a restricted operator channel and is separate from `/dev`

docs/enterprise-architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Purpose
44

5-
This document defines the target architecture when `codex-telegram-claws` is deployed as a financial enterprise engineering assistant for multiple subsidiary CTO teams. The current repository is a strong single-host beta. The enterprise target is a controlled multi-host platform.
5+
This document defines the target architecture when `CodexClaw` is deployed as a financial enterprise engineering assistant for multiple subsidiary CTO teams. The current repository is a strong single-host beta. The enterprise target is a controlled multi-host platform.
66

77
## Target Operating Model
88

@@ -82,7 +82,7 @@ Subagents should be triggered only after:
8282

8383
## Recommended Deployment Phases
8484

85-
Implementation roadmap: [phase-1-roadmap.md](/Users/ding/Documents/Code/Github/codex-telegram-claws/docs/phase-1-roadmap.md)
85+
Implementation roadmap: [phase-1-roadmap.md](/Users/ding/Documents/Code/Github/CodexClaw/docs/phase-1-roadmap.md)
8686

8787
### Phase 1: Harden Current Single-Host Beta
8888

docs/operations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ pm2 start ecosystem.config.cjs
1717
Common PM2 commands:
1818

1919
```bash
20-
pm2 status codex-telegram-claws
21-
pm2 logs codex-telegram-claws
22-
pm2 restart codex-telegram-claws
23-
pm2 stop codex-telegram-claws
20+
pm2 status CodexClaw
21+
pm2 logs CodexClaw
22+
pm2 restart CodexClaw
23+
pm2 stop CodexClaw
2424
pm2 save
2525
```
2626

0 commit comments

Comments
 (0)