@cnwenf/occ 2.1.259 → 2.1.261

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 (4) hide show
  1. package/README.md +129 -53
  2. package/README.zh-CN.md +3 -3
  3. package/dist/cli.js +106282 -27066
  4. package/package.json +5 -1
package/README.md CHANGED
@@ -1,14 +1,19 @@
1
1
  # Open C Code (OCC)
2
2
 
3
- > A safe, open-source coding agent — capabilities fully aligned with Claude Code.
3
+ > A safe, open-source coding agent — capabilities aligned with Claude Code.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@cnwenf/occ.svg)](https://www.npmjs.com/package/@cnwenf/occ)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
7
+ [![Runtime: Bun](https://img.shields.io/badge/Runtime-Bun-%23000000.svg)](https://bun.sh/)
8
+ [![Tracks: Claude Code 2.1.204](https://img.shields.io/badge/Tracks-Claude%20Code%202.1.204-blueviolet.svg)](https://docs.anthropic.com/en/docs/claude-code)
4
9
 
5
10
  [简体中文](./README.zh-CN.md) · **English**
6
11
 
7
12
  ---
8
13
 
9
- ## What is this
14
+ ## What is OCC
10
15
 
11
- **Open C Code (OCC)** is an open-source coding agent. Its capabilities are aligned with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (currently tracking `2.1.200`). The code is fully open, auditable, backdoor-free, and your data stays under your control.
16
+ **Open C Code (OCC)** is an open-source coding agent. Its capabilities are aligned with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (currently tracking `2.1.204`). The code is fully open, auditable, backdoor-free, and your data stays under your control.
12
17
 
13
18
  If you worry that a closed-source CLI might hide backdoors, or that your code and credentials are uploaded to unauditable services, OCC is for you: all source is open and unobfuscated, the build is reproducible from source, and API credentials are sent only to endpoints you configure.
14
19
 
@@ -18,22 +23,49 @@ If you worry that a closed-source CLI might hide backdoors, or that your code an
18
23
  - 🛡️ **Transparent & safe** — no telemetry black boxes, no hidden reporting; behavior you can supervise.
19
24
  - 🎯 **Capability-aligned** — REPL, tool system, permission model, MCP, sub-agents, slash commands — on par with Claude Code.
20
25
  - 🔧 **Data sovereignty** — API Key / Bedrock / Vertex / Azure credentials stay on your machine; requests go only to endpoints you specify.
26
+ - 🧩 **Hackable** — trim, extend, or fork subsystems; feature flags and a workspace stub layer make the boundary between live and trimmed code explicit.
21
27
 
22
- ## Status
23
-
24
- - Tracks Claude Code **`2.1.200`**.
25
- - The codebase carries ~1300 non-blocking `tsc` type errors (loose `unknown`/`never`/`{}` types throughout). They do **not** affect Bun runtime execution. Lint (Biome) is the gate, not `tsc`.
26
- - All internal feature flags (`feature(...)`) are polyfilled to `false` — internal-only features (COORDINATOR_MODE, KAIROS, PROACTIVE, etc.) are disabled.
27
- - Published to npm as [`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ).
28
-
29
- ## Install
28
+ ## Quick install
30
29
 
31
30
  ```bash
32
- npm i -g @cnwenf/occ
33
- occ
31
+ npm i -g @cnwenf/occ # install
32
+ occ # launch the interactive REPL
34
33
  ```
35
34
 
36
- Requires a valid Anthropic API Key (or Bedrock / Vertex / Azure Foundry credentials).
35
+ Requires a valid Anthropic API Key (or AWS Bedrock / Google Vertex / Azure Foundry credentials).
36
+
37
+ ## Feature highlights
38
+
39
+ - 🖥️ **Interactive REPL** — Ink terminal renderer with full UI: vim mode, themes, scroll, search highlight, virtual lists.
40
+ - 🔧 **Full tool suite** — Bash, Read, Edit, Write, NotebookEdit, Grep, Glob, Agent, WebFetch, WebSearch, WebBrowser (real Chrome via CDP), Todo, Skills, and more.
41
+ - 🤖 **Sub-agents** — spawn fork / async / background / remote agents; team swarms (`TeamCreate`/`TeamDelete`) and worktree isolation.
42
+ - 🔀 **Workflow engine** — vm-sandboxed multi-agent workflow scripts; `/workflows` browse + async launch (`remote: true`) + progress tracking. _(live via `WORKFLOW_SCRIPTS`)_
43
+ - 📊 **Monitor tool** — self-contained monitoring. _(live via `MONITOR_TOOL`)_
44
+ - 🌐 **WebBrowser** — navigate, read page text, screenshot, and batch actions through a real Chrome instance (CDP).
45
+ - 🛡️ **Permission model** — `default` / `acceptEdits` / `plan` / `bypassPermissions` modes, auto-approval, destructive-command blocking, path validation, rule matching.
46
+ - 🪝 **Hooks** — `PreToolUse`, `PostToolUse`, `PermissionDenied`, `Stop`, and more, configurable via `settings.json`.
47
+ - 🧩 **MCP support** — connect external tools via Model Context Protocol servers (`--mcp-config`, `.mcp.json`); list/read MCP resources.
48
+ - 🎯 **Skills system** — frontmatter-driven skills, `/skills` discovery + cache, attribution, MCP-delivered skills. _(live via `EXPERIMENTAL_SKILL_SEARCH` + `MCP_SKILLS`)_
49
+ - 📝 **`/goal` tracking** — set a session goal with a Stop hook that keeps the agent on-target.
50
+ - ⚡ **`/effort ultracode`** — max-reasoning effort level with badge + keyword trigger; also `low`/`medium`/`high`/`max`/`auto`.
51
+ - 🎨 **Custom themes** — `/color` and `/theme` for live theming and custom theme creation.
52
+ - ⌨️ **Keybindings** — vim mode, `Ctrl+L` clear, `Ctrl+J` newline, scroll, configurable via `/keybindings`.
53
+ - 🌍 **Language setting** — instruct OCC to respond in your preferred language.
54
+ - 🔄 **Session management** — `/resume`, auto-compaction, `/doctor`, `/status`, `/cost`.
55
+ - 🧠 **Smart classifiers** — transcript + bash command classification. _(live via `TRANSCRIPT_CLASSIFIER` + `BASH_CLASSIFIER`)_
56
+
57
+ ## OCC vs Claude Code
58
+
59
+ | | OCC | Claude Code |
60
+ |---|---|---|
61
+ | **Source** | Fully open, unobfuscated | Closed binary |
62
+ | **Auditability** | Line-by-line reviewable | No |
63
+ | **Telemetry** | Minimal (analytics stubbed) | Standard |
64
+ | **Data sovereignty** | Credentials stay on your machine; requests only to endpoints you configure | Anthropic endpoints |
65
+ | **Capability parity** | Tracks CC `2.1.204` | Reference implementation |
66
+ | **Providers** | Anthropic Direct, Bedrock, Vertex, Azure | Anthropic, Bedrock, Vertex |
67
+ | **Cost** | Free & open-source (MIT) | Subscription |
68
+ | **Build** | Reproducible from source | N/A |
37
69
 
38
70
  ## Quick start
39
71
 
@@ -41,66 +73,110 @@ Requires a valid Anthropic API Key (or Bedrock / Vertex / Azure Foundry credenti
41
73
  # interactive REPL
42
74
  occ
43
75
 
44
- # pipe mode (-p)
76
+ # pipe mode (-p) — non-interactive
45
77
  echo "say hello" | occ -p
78
+
79
+ # run from source (dev)
80
+ bun run dev
46
81
  ```
47
82
 
48
- ## Capabilities
83
+ ## Slash commands
84
+
85
+ OCC ships dozens of slash commands. Highlights:
49
86
 
50
- ### Core systems
51
- - **REPL** — Ink terminal renderer, full interactive UI.
52
- - **API layer** — Anthropic Direct, AWS Bedrock, Google Vertex, Azure Foundry (API Key + OAuth / credential refresh).
53
- - **Query loop** — streaming conversation, tool-call loop, auto-compaction, token tracking (`query.ts`).
54
- - **Conversation engine** — state, attribution, file-history snapshots (`QueryEngine.ts`).
55
- - **Context** — git status, CLAUDE.md hierarchy, memory files.
56
- - **Permissions** — plan / auto / manual modes, YOLO classifier, path validation, rule matching.
57
- - **Hooks** — pre/post tool use, configurable via `settings.json`.
58
- - **Session resume** (`/resume`), **doctor** (`/doctor`), **auto-compaction**.
87
+ | Category | Commands |
88
+ |---|---|
89
+ | **Session** | `/clear` `/compact` `/autocompact` `/resume` `/status` `/cost` `/doctor` `/export` `/context` |
90
+ | **Model & effort** | `/model` `/effort` `/fast` `/usage` |
91
+ | **Configuration** | `/config` `/permissions` `/keybindings` `/color` `/theme` `/memory` `/init` `/login` `/logout` |
92
+ | **Agents & tasks** | `/agents` `/background` `/daemon` `/stop` `/tasks` `/goal` `/skills` `/hooks` `/plugin` |
93
+ | **MCP** | `/mcp` |
94
+ | **Review & git** | `/review` `/commit` `/commit-push-pr` `/diff` `/branch` `/pr_comments` |
95
+ | **Help** | `/help` `/update` `/onboarding` |
59
96
 
60
- ### Tools (always available)
61
- Bash, FileRead, FileEdit, FileWrite, NotebookEdit, Agent (sub-agent spawn: fork / async / background / remote), WebFetch, WebSearch, AskUserQuestion, SendMessage, Skill, EnterPlanMode, ExitPlanMode, TodoWrite (v1), Brief, TaskOutput, TaskStop, ListMcpResources, ReadMcpResource, SyntheticOutput.
97
+ ## Tools
62
98
 
63
- ### Tools (conditional)
64
- Glob, Grep (default on); TaskCreate/Get/Update/List (Todo v2), EnterWorktree/ExitWorktree, TeamCreate/Delete (agent swarms), ToolSearch, PowerShell (Windows), LSP (`ENABLE_LSP_TOOL`).
99
+ **Always available:** `Bash`, `FileRead`, `FileEdit`, `FileWrite`, `NotebookEdit`, `Grep`, `Glob`, `Agent`, `TaskOutput`, `TaskStop`, `WebFetch`, `WebSearch`, `WebBrowser` (Navigate / GetPageText / Screenshot / Batch), `TodoWrite`, `AskUserQuestion`, `Skill`, `EnterPlanMode`, `ExitPlanMode`, `Cron` (Create / Delete / List), `Brief`, `ListMcpResources`, `ReadMcpResource`, `ReadMcpResourceDir`.
65
100
 
66
- ### Disabled / stubbed
67
- - Feature-flagged off (all `feature()` return false): Sleep, Cron, RemoteTrigger, Monitor, WebBrowser, Workflow, PushNotification, etc.
68
- - ANT-only stubs: Tungsten, REPL, SuggestBackgroundPR.
69
- - Removed/simplified: Computer Use (`@ant/*`), most `*-napi` packages (audio/image/url/modifiers — `color-diff-napi` is fully implemented), Analytics / GrowthBook / Sentry (empty), Magic Docs / Voice Mode / LSP server, Plugins / Marketplace, MCP OAuth (simplified).
101
+ **Live (feature-allowlisted):** `Workflow` (`WORKFLOW_SCRIPTS`), `Monitor` (`MONITOR_TOOL`).
70
102
 
71
- ### Slash commands
72
- Dozens implemented: `/add-dir`, `/agents`, `/branch`, `/clear`, `/compact`, `/config`, `/context`, `/cost`, `/doctor`, `/effort`, `/export`, `/fast`, `/goal`, `/help`, `/init`, `/login`, `/mcp`, `/memory`, `/model`, `/permissions`, `/resume`, `/review`, `/status`, `/todo`, and more.
103
+ **Conditional:** `TaskCreate`/`Get`/`Update`/`List` (Todo v2), `EnterWorktree`/`ExitWorktree` (worktree mode), `ToolSearch` (deferred tool loading), `PowerShell` (Windows), `LSP` (`ENABLE_LSP_TOOL`).
73
104
 
74
- ### MCP
75
- Connect external tools via Model Context Protocol servers (`--mcp-config`, `.mcp.json`). OAuth flow simplified.
105
+ **Disabled / stubbed:** subsystems behind non-allowlisted feature flags — `Sleep`, `RemoteTrigger`, `SendUserFile`, `PushNotification`, `SubscribePR`, `ListPeers`, `Snip`, coordinator/bridge/voice modes, and ANT-only stubs (`Tungsten`, `REPL`, `SuggestBackgroundPR`). Computer Use (`@ant/*`) and most `*-napi` packages are stubs (`color-diff-napi` is fully implemented). Analytics / GrowthBook / Sentry are empty implementations.
106
+
107
+ ## Configuration
108
+
109
+ OCC reads settings from (later files override earlier):
110
+
111
+ - `~/.claude/settings.json` — user-global
112
+ - `.claude/settings.json` — project-shared (checked in)
113
+ - `.claude/settings.local.json` — project-local (gitignored)
114
+
115
+ Configure permissions, hooks, model, theme, MCP servers, and keybindings there. Provider credentials live in env vars (`ANTHROPIC_API_KEY`, `AWS_*`, `CLAUDE_CODE_USE_VERTEX`, etc.) — never in source.
116
+
117
+ For the full settings reference, environment variables, and permission modes, see [CLAUDE.md](./CLAUDE.md).
118
+
119
+ ## Architecture overview
120
+
121
+ ```
122
+ src/entrypoints/cli.tsx true entrypoint (runtime polyfills, macros)
123
+ src/main.tsx Commander.js CLI definition
124
+ src/query.ts main API query loop (streaming + tool-call loop)
125
+ src/QueryEngine.ts conversation orchestrator (state, compaction, attribution)
126
+ src/screens/REPL.tsx interactive REPL screen (React/Ink)
127
+ src/services/api/ API clients (Anthropic / Bedrock / Vertex / Azure)
128
+ src/tools/<Name>/ one directory per tool
129
+ src/ink/ custom Ink framework (reconciler, hooks, virtual list)
130
+ src/commands/<Name>/ one directory per slash command
131
+ packages/ workspace stubs (@ant/*, *-napi)
132
+ ```
133
+
134
+ **Runtime & build:** Bun (not Node). ESM + TSX with `react-jsx`. Single-file bundle via `bun build`. Bun workspaces resolve internal `packages/*`.
135
+
136
+ **Core loop:** `query.ts` sends messages to the Claude API, handles streaming, processes tool calls, and manages the conversation turn loop. `QueryEngine.ts` wraps it with state, compaction, and file-history snapshots.
137
+
138
+ **Feature flags:** `feature(name)` returns `true` for an allowlist — `WORKFLOW_SCRIPTS`, `MONITOR_TOOL`, `TRANSCRIPT_CLASSIFIER`, `BASH_CLASSIFIER`, `EXPERIMENTAL_SKILL_SEARCH`, `MCP_SKILLS` — and `false` for everything else. This reactivates the workflow engine, Monitor tool, skill discovery, MCP skills, and the transcript/bash classifiers at runtime; most other internal subsystems (COORDINATOR_MODE, KAIROS, PROACTIVE, BRIDGE_MODE, VOICE_MODE, etc.) stay disabled.
76
139
 
77
140
  ## Build from source
78
141
 
79
- Requires [Bun](https://bun.sh/) >= 1.3.11.
142
+ Requires [Bun](https://bun.sh/) >= 1.3.11 (use `bun upgrade` — older Bun causes spurious errors).
80
143
 
81
144
  ```bash
82
145
  bun install
83
- bun run dev # run from source; version prints 2.1.200 when working
84
- bun run build # output: dist/cli.js (~26 MB, 5300+ modules, single-file bundle)
85
- bun test # test suite
146
+ bun run dev # run from source; version prints 2.1.204 when working
147
+ bun run build # output: dist/cli.js (~26 MB, single-file bundle)
148
+ bun test # test suite (Bun test runner)
86
149
  bun run lint # Biome lint (formatter disabled to avoid large diffs)
150
+ bun run check:unused # knip — detect unused exports/dependencies
151
+ bun run health # code health check
87
152
  ```
88
153
 
154
+ > **Note on type errors:** the codebase carries ~1300 non-blocking `tsc` type errors (loose `unknown`/`never`/`{}` types throughout). They do **not** affect Bun runtime execution. Lint (Biome) is the gate, not `tsc`.
155
+
89
156
  For architecture, entry/bootstrap, tool system, UI layer, and module-status details, see [CLAUDE.md](./CLAUDE.md).
90
157
 
91
- ## Project layout
158
+ ## Status
92
159
 
93
- ```
94
- src/entrypoints/cli.tsx # true entrypoint (runtime polyfills, macros)
95
- src/main.tsx # Commander CLI definition
96
- src/query.ts # main API query loop
97
- src/QueryEngine.ts # conversation orchestrator
98
- src/screens/REPL.tsx # interactive REPL screen
99
- src/services/api/ # API clients (Anthropic / Bedrock / Vertex / Azure)
100
- src/tools/<Name>/ # one directory per tool
101
- src/ink/ # custom Ink framework
102
- packages/ # workspace stubs (@ant/*, *-napi)
103
- ```
160
+ - Tracks Claude Code **`2.1.204`**.
161
+ - Published to npm as [`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ).
162
+ - Many modules are intentionally stubbed or feature-flagged off — see "Disabled / stubbed" above.
163
+
164
+ ## Docs
165
+
166
+ - [CLAUDE.md](./CLAUDE.md) — engineering guide: commands, architecture, working with the codebase.
167
+ - [docs/](./docs/) — architecture whitepaper (Mintlify `.mdx`): [introduction](./docs/introduction/what-is-claude-code.mdx), [the loop](./docs/conversation/the-loop.mdx), [tools](./docs/tools/what-are-tools.mdx), [permission model](./docs/safety/permission-model.mdx), [hooks](./docs/extensibility/hooks.mdx), [skills](./docs/extensibility/skills.mdx), [MCP](./docs/extensibility/mcp-protocol.mdx), [sub-agents](./docs/agent/sub-agents.mdx).
168
+
169
+ ## Contributing
170
+
171
+ Contributions are welcome. Please:
172
+
173
+ 1. Open an issue to discuss the change first for non-trivial work.
174
+ 2. Keep code under 800 lines/file, functions under 50 lines, no deep nesting.
175
+ 3. Run `bun run lint` and `bun test` before submitting — Biome lint is the gate.
176
+ 4. Follow [conventional commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`).
177
+ 5. Don't try to fix all `tsc` type errors — they don't affect the Bun runtime and `tsc` is not in CI.
178
+
179
+ A `pre-commit` hook (`.githooks/`, wired via `bun run prepare`) runs `biome lint` on staged `src/*.{ts,tsx,js,jsx}` files. Bypass with `--no-verify` when lint errors are from pre-existing noise.
104
180
 
105
181
  ## License
106
182
 
package/README.zh-CN.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 这是什么
10
10
 
11
- **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.200`)。代码全开放、可审计、无暗门,数据由你掌控。
11
+ **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.204`)。代码全开放、可审计、无暗门,数据由你掌控。
12
12
 
13
13
  如果你担心闭源 CLI 可能植入后门、担心代码与凭据被上传到不可审计的服务,OCC 就是为你准备的:全部源码开放、无混淆,构建产物可由源码复现,API 凭据只发往你自己配置的端点。
14
14
 
@@ -21,7 +21,7 @@
21
21
 
22
22
  ## 现状
23
23
 
24
- - 跟踪 Claude Code **`2.1.200`**。
24
+ - 跟踪 Claude Code **`2.1.204`**。
25
25
  - 代码库有约 1300 个不阻塞的 `tsc` 类型错误(大量松散的 `unknown`/`never`/`{}` 类型),**不影响 Bun 运行时执行**。门槛是 Biome lint,不是 `tsc`。
26
26
  - 所有内部 feature flag(`feature(...)`)已被 polyfill 为 `false` —— 内部功能(COORDINATOR_MODE、KAIROS、PROACTIVE 等)全部关闭。
27
27
  - 已发布到 npm:[`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ)。
@@ -80,7 +80,7 @@ Glob、Grep(默认启用);TaskCreate/Get/Update/List(Todo v2)、EnterW
80
80
 
81
81
  ```bash
82
82
  bun install
83
- bun run dev # 从源码运行;版本号显示 2.1.200 即正常
83
+ bun run dev # 从源码运行;版本号显示 2.1.204 即正常
84
84
  bun run build # 产物:dist/cli.js(~26MB,5300+ 模块,单文件 bundle)
85
85
  bun test # 测试套件
86
86
  bun run lint # Biome lint(禁用格式化以避免大 diff)