Skip to content

Commit e2aa83c

Browse files
authored
Merge pull request #621 from Cai-Tang-www/feat/issue-586-web-ui-polish
fix: 修复飞书审批卡片回闪并完善 Web/README 体验
2 parents ea2079b + f5e1416 commit e2aa83c

16 files changed

Lines changed: 678 additions & 135 deletions

README.en.md

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

33
# <img src="docs/assert/readme/neo-code.svg" alt="neo-code" />
44

5-
> A local-first AI coding agent that helps you understand code, edit projects, call tools, and connect your workflow across terminal, desktop, and automation.
5+
> A local-first AI coding agent that helps you understand code, edit projects, call tools, and connect your development workflow across terminal, desktop, and automation.
66
77
<p align="center">
88
<a href="https://go.dev/">
@@ -35,9 +35,9 @@
3535

3636
## What Is NeoCode?
3737

38-
NeoCode is an AI coding agent running in your local development environment.
38+
NeoCode is an AI coding agent that runs in your local development environment.
3939

40-
It can read your workspace, understand code, call tools, run commands, manage sessions, and expose a unified local Gateway interface (JSON-RPC / SSE / WebSocket) for terminal, desktop, or third-party clients.
40+
It can read your workspace, understand code, call tools, execute commands, manage sessions, and expose a unified local Gateway interface via JSON-RPC / SSE / WebSocket for terminal, desktop, or third-party clients.
4141

4242
Core loop:
4343

@@ -47,25 +47,30 @@ Core loop:
4747

4848
## Features
4949

50-
- Local-first execution with real project context.
51-
- Terminal-native TUI experience.
52-
- Built-in tools for file access, project inspection, and command execution.
53-
- Multi-provider support: OpenAI, Gemini, ModelScope, Qiniu, OpenLL, plus custom providers.
54-
- Session persistence and recovery.
55-
- Memory for preferences and project facts across sessions.
56-
- Skills system for task-specific behaviors.
57-
- MCP integration via stdio servers.
58-
- Gateway mode with local JSON-RPC / SSE / WebSocket access.
59-
- Feishu Adapter: Webhook and SDK long-connection ingress with live status card updates.
60-
- Local Runner: execute tools on your local machine via WebSocket connection to a cloud Gateway — no inbound ports needed.
50+
- Local-first: runs in your workspace with real project context.
51+
- Terminal interaction: conversational coding-agent experience based on TUI.
52+
- Tool calls: supports file access, project inspection, command execution, and system tools.
53+
- Multi-provider support: OpenAI, Gemini, ModelScope, Qiniu, OpenLL, and custom providers.
54+
- Session persistence: save and restore historical sessions to reduce repeated context switching.
55+
- Memory: store preferences, project facts, and cross-session context.
56+
- Skills system: enable specialized behaviors and workflows for different tasks.
57+
- MCP integration: extend external tool capabilities through MCP stdio servers.
58+
- Gateway mode: connect desktop apps, scripts, and third-party clients via local JSON-RPC / SSE / WebSocket.
59+
- Web UI: launch browser-based interface with `neocode web` for visual chat and session management.
60+
- Feishu Adapter: supports both Webhook and SDK long-connection access, with continuous run status updates in a single status card.
61+
- Local Runner: `neocode runner` executes tools locally and actively connects to a cloud Gateway via WebSocket, with no inbound port required.
6162

6263
---
6364

6465
## Preview
6566

6667
![NeoCode TUI chat view](docs/assert/readme/preview-1.png)
67-
![NeoCode TUI execution view](docs/assert/readme/preview-4.png)
68-
![NeoCode Gateway interaction example](docs/assert/readme/preview-5.png)
68+
![NeoCode Web UI view](docs/assert/readme/preview-2.png)
69+
![NeoCode Feishu adapter view](docs/assert/readme/preview-3.png)
70+
71+
More screenshots and interaction details:
72+
- [Web UI Guide](https://neocode-docs.pages.dev/guide/web-ui)
73+
- [Feishu Remote Setup](https://neocode-docs.pages.dev/guide/feishu-remote-setup)
6974

7075
---
7176

@@ -95,7 +100,7 @@ go run ./cmd/neocode
95100

96101
### 3. Configure API key
97102

98-
Set environment variables for your provider, for example:
103+
Set the environment variable for your selected provider, for example:
99104

100105
```bash
101106
export OPENAI_API_KEY="your_key_here"
@@ -107,21 +112,41 @@ Windows PowerShell:
107112
$env:OPENAI_API_KEY = "your_key_here"
108113
```
109114

110-
Then start with your workspace:
115+
Then start in your project directory:
111116

112117
```bash
113118
neocode -w /path/to/your/project
114119
```
115120

116-
To launch the browser-based Web UI:
121+
If you want to use the browser-based Web UI, run:
117122

118123
```bash
119124
neocode web
120125
```
121126

122-
Tagged release builds already embed `web/dist` into the `neocode` binary, so the target machine does not need Node.js or npm. When running from source, missing `web/dist` still triggers the local frontend build path.
127+
Tagged release builds already embed Web UI assets (`web/dist`) into the `neocode` binary, so running `neocode web` does not require Node.js or npm on the target machine. If you run from source with `go run ./cmd/neocode web`, NeoCode will still automatically try to build the frontend when `web/dist` is missing.
128+
129+
### 4. Quick Web / Feishu Entry
130+
131+
```bash
132+
# Browser Web UI (default 127.0.0.1:8080)
133+
neocode web
134+
135+
# Specify Web UI listen address (for local debugging)
136+
neocode web --http-listen 127.0.0.1:8080 --skip-build
137+
138+
# Feishu SDK mode (recommended, no public ingress required)
139+
neocode feishu-adapter --ingress sdk --gateway-listen "127.0.0.1:8080"
140+
141+
# Feishu Webhook mode (requires callback-reachable address from Feishu)
142+
neocode feishu-adapter --ingress webhook --gateway-listen "127.0.0.1:8080" --listen "127.0.0.1:18080"
143+
```
123144

124-
### 4. Common commands
145+
Detailed guides:
146+
- [Web UI Guide](https://neocode-docs.pages.dev/guide/web-ui)
147+
- [Feishu Remote Setup (SDK / Webhook)](https://neocode-docs.pages.dev/guide/feishu-remote-setup)
148+
149+
### 5. Common commands
125150

126151
```text
127152
/help Show help
@@ -131,40 +156,181 @@ Tagged release builds already embed `web/dist` into the `neocode` binary, so the
131156
/memo Show memory
132157
/remember <text> Save memory
133158
/skills List available skills
134-
/skill use <id> Enable skill
135-
/skill off <id> Disable skill
159+
/skill use <id> Enable a skill
160+
/skill off <id> Disable a skill
136161
```
137162

138-
---
163+
### 6. CLI Routing Quick Reference
164+
165+
#### Provider management
166+
167+
Use these commands to add, list, and remove custom providers. Changes are stored under `~/.neocode/providers/`.
139168

140-
## Gateway / MCP / Skills / Runner
169+
```bash
170+
# Add a custom provider (ensure --api-key-env points to an existing environment variable)
171+
neocode provider add <name> --driver <driver> --url <url> --api-key-env <env> [--discovery-endpoint <path>]
172+
173+
# Example
174+
export MOCK_KEY="sk-xxx"
175+
neocode provider add my-openai --driver openaicompat --url https://api.openai.com/v1 --api-key-env MOCK_KEY --discovery-endpoint /v1/models
141176

142-
Detailed docs are intentionally split out. README keeps entry links:
177+
# List all providers
178+
neocode provider ls
179+
180+
# Remove a custom provider
181+
neocode provider rm my-openai
182+
```
143183

144-
- Gateway integration and protocol: `docs/guides/gateway-integration-guide.md`
145-
- MCP configuration: `docs/guides/mcp-configuration.md`
146-
- Skills design: `docs/skills-system-design.md`
147-
- Runtime event flow: `docs/runtime-provider-event-flow.md`
148-
- Feishu remote setup: `www/guide/feishu-remote-setup.md`
184+
#### Model selection
149185

150-
### CLI Quick Reference
186+
Use these commands to list model candidates for the current provider and switch to a specific model.
151187

152188
```bash
153-
# Start local runner daemon (connects to cloud Gateway for remote tool execution)
189+
# List available models for the current provider (prefer local snapshot; trigger one sync discovery only when needed)
190+
neocode model ls
191+
192+
# Set current model (validates model ownership against the current provider)
193+
neocode model set <model-id>
194+
195+
# Example
196+
neocode model set gpt-4.1
197+
```
198+
199+
#### One-step provider + model switch
200+
201+
Use this flow to switch provider, and optionally override the auto-selected model via `--model`.
202+
203+
```bash
204+
# Switch provider only (auto-corrects to an available model)
205+
neocode use <provider>
206+
207+
# Switch provider and set model (with provider-model ownership validation)
208+
neocode use <provider> --model <model-id>
209+
210+
# Example
211+
neocode use openai --model gpt-4.1
212+
```
213+
214+
#### Local Runner
215+
216+
Start a local execution daemon that actively connects to a cloud Gateway and receives tool-execution requests.
217+
218+
```bash
219+
# Start runner (connects to 127.0.0.1:8080 by default)
220+
neocode runner
221+
222+
# Set remote Gateway address and token
154223
neocode runner --gateway-address "your-gateway.com:8080" --token-file ~/.neocode/auth.json
155224

225+
# Set runner name and working directory
226+
neocode runner --runner-name "My Local Machine" --workdir /path/to/project
156227
# Start feishu adapter (SDK mode, no public network required)
157228
neocode adapter feishu --ingress sdk --gateway-listen "127.0.0.1:8080"
158229
```
159230

231+
### 7. Shell Diagnostic Agent
232+
233+
Use these commands to enter proxy shell mode, initialize shell integration, trigger manual diagnosis, and manage automatic diagnosis.
234+
235+
```bash
236+
# Enter proxy shell (currently Unix-like only)
237+
neocode shell
238+
239+
# Print shell integration script (also supports --init <shell>)
240+
neocode shell --init bash
241+
neocode shell --init zsh
242+
243+
# Trigger one manual diagnosis (both forms are equivalent)
244+
neocode diag
245+
neocode diag diagnose
246+
247+
# Enter IDM interactive diagnostic sandbox (exit with "exit" or Ctrl+C when idle)
248+
neocode diag -i
249+
250+
# Automatic diagnosis switch and status
251+
neocode diag auto on
252+
neocode diag auto off
253+
neocode diag auto status
254+
```
255+
256+
### 8. URL Scheme Usage
257+
258+
Detailed guide: [HTTP URL Wake-up Guide (User Story Version)](https://neocode-docs.pages.dev/guide/http-daemon-wake-user-guide)
259+
260+
```bash
261+
# Start local HTTP daemon (default: 127.0.0.1:18921)
262+
go run ./cmd/neocode daemon serve
263+
264+
# Install user-level autostart + best-effort hosts alias write (127.0.0.1 neocode)
265+
go run ./cmd/neocode daemon install
266+
267+
# Check running and installation status
268+
go run ./cmd/neocode daemon status
269+
270+
# Uninstall autostart configuration
271+
go run ./cmd/neocode daemon uninstall
272+
```
273+
274+
Clickable URL examples:
275+
276+
```text
277+
http://neocode:18921/review?path=README.md
278+
http://neocode:18921/run?prompt=Write%20a%20simple%20HTTP%20server
279+
```
280+
281+
> Currently supported actions:
282+
> - `review`: requires the `path` parameter.
283+
> - `run`: requires the `prompt` parameter. Gateway returns `session_id` and triggers terminal handoff.
284+
285+
Session handoff startup:
286+
287+
```bash
288+
go run ./cmd/neocode --session <session_id>
289+
```
290+
291+
> When `--session` is provided, TUI first attempts context handoff using the `workdir` saved in session history. If that path is no longer valid locally, NeoCode keeps the current workspace and displays a warning.
292+
>
293+
> On Linux (and other non-Windows/macOS platforms), automatic terminal popup is not yet integrated. `wake.run` returns `not_supported`, and you can manually run `neocode --session <session_id>` for handoff.
294+
>
295+
> `daemon serve` does not provide `--token-file`, listens only on `127.0.0.1`, and limits Host allowlist to `neocode` / `localhost` / `127.0.0.1`.
296+
>
297+
> Linux autostart strategy: prefer `systemd --user`; fall back to `~/.config/autostart/neocode-daemon.desktop` when unavailable.
298+
>
299+
> If NeoCode was not installed via install script (for example, built from source or using a bare binary), run `neocode daemon install` manually once.
300+
160301
---
161302

162-
## Documentation
303+
## Documentation Map (By Scenario)
304+
305+
Official docs site (English): [https://neocode-docs.pages.dev/en/](https://neocode-docs.pages.dev/en/)
306+
307+
Recommended reading path:
308+
309+
1. First-time setup
310+
- [Installation Guide](https://neocode-docs.pages.dev/guide/install)
311+
- [Daily Use Guide](https://neocode-docs.pages.dev/guide/daily-use)
312+
- [Configuration Guide](https://neocode-docs.pages.dev/guide/configuration)
313+
314+
2. Entry surfaces (Web / Feishu)
315+
- [Web UI Guide](https://neocode-docs.pages.dev/guide/web-ui)
316+
- [Feishu Remote Setup (SDK / Webhook)](https://neocode-docs.pages.dev/guide/feishu-remote-setup)
317+
- [HTTP URL Wake-up Guide](https://neocode-docs.pages.dev/guide/http-daemon-wake-user-guide)
318+
319+
3. Extensibility (MCP / Skills / Hooks)
320+
- [MCP Integration](https://neocode-docs.pages.dev/guide/mcp)
321+
- [Skills Guide](https://neocode-docs.pages.dev/guide/skills)
322+
- [Hooks Guide](https://neocode-docs.pages.dev/guide/hooks)
323+
- [Tools and Permissions](https://neocode-docs.pages.dev/guide/tools-permissions)
324+
325+
4. Protocol and internals
326+
- [Gateway Integration & Protocol (Reference)](https://neocode-docs.pages.dev/reference/gateway)
327+
- [Runtime / Provider Event Flow (Repo Doc)](docs/runtime-provider-event-flow.md)
163328

164-
- Official docs site: [https://neocode-docs.pages.dev/en/](https://neocode-docs.pages.dev/en/)
165-
- English guide index: [www/en/guide/index.md](www/en/guide/index.md)
329+
5. Maintenance and troubleshooting
330+
- [Update Guide](https://neocode-docs.pages.dev/guide/update)
331+
- [Troubleshooting](https://neocode-docs.pages.dev/guide/troubleshooting)
166332

167-
Docs site source lives in `www/`. Local preview:
333+
Docs site source is under `www/`. Local preview:
168334

169335
```bash
170336
cd www
@@ -176,14 +342,14 @@ pnpm docs:dev
176342

177343
## Contributing
178344

179-
Contributions are welcome via Issues, Discussions, and Pull Requests.
345+
Contributions via Issues, Discussions, and Pull Requests are welcome.
180346

181-
Suggested flow:
347+
Suggested workflow:
182348

183-
1. Open an issue for problems, requirements, or design proposals.
184-
2. Fork and create a focused feature branch.
185-
3. Keep changes scoped and explain impact clearly.
186-
4. Run checks before submitting:
349+
1. Describe your problem, requirement, or design idea in an Issue first.
350+
2. Fork the repository and create a feature branch.
351+
3. Keep your changes focused and explain motivation and impact clearly.
352+
4. Run baseline checks before submitting:
187353

188354
```bash
189355
gofmt -w ./cmd ./internal

0 commit comments

Comments
 (0)