@cnwenf/occ 2.1.222

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 (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/README.zh-CN.md +107 -0
  4. package/dist/cli.js +742796 -0
  5. package/package.json +138 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cnwenf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # Open C Code (OCC)
2
+
3
+ > A safe, open-source coding agent — capabilities fully aligned with Claude Code.
4
+
5
+ [简体中文](./README.zh-CN.md) · **English**
6
+
7
+ ---
8
+
9
+ ## What is this
10
+
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.
12
+
13
+ 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
+
15
+ ## Positioning
16
+
17
+ - 🔓 **Open & auditable** — full source, no obfuscation, line-by-line reviewable.
18
+ - 🛡️ **Transparent & safe** — no telemetry black boxes, no hidden reporting; behavior you can supervise.
19
+ - 🎯 **Capability-aligned** — REPL, tool system, permission model, MCP, sub-agents, slash commands — on par with Claude Code.
20
+ - 🔧 **Data sovereignty** — API Key / Bedrock / Vertex / Azure credentials stay on your machine; requests go only to endpoints you specify.
21
+
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
30
+
31
+ ```bash
32
+ npm i -g @cnwenf/occ
33
+ occ
34
+ ```
35
+
36
+ Requires a valid Anthropic API Key (or Bedrock / Vertex / Azure Foundry credentials).
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ # interactive REPL
42
+ occ
43
+
44
+ # pipe mode (-p)
45
+ echo "say hello" | occ -p
46
+ ```
47
+
48
+ ## Capabilities
49
+
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**.
59
+
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.
62
+
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`).
65
+
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).
70
+
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.
73
+
74
+ ### MCP
75
+ Connect external tools via Model Context Protocol servers (`--mcp-config`, `.mcp.json`). OAuth flow simplified.
76
+
77
+ ## Build from source
78
+
79
+ Requires [Bun](https://bun.sh/) >= 1.3.11.
80
+
81
+ ```bash
82
+ 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
86
+ bun run lint # Biome lint (formatter disabled to avoid large diffs)
87
+ ```
88
+
89
+ For architecture, entry/bootstrap, tool system, UI layer, and module-status details, see [CLAUDE.md](./CLAUDE.md).
90
+
91
+ ## Project layout
92
+
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
+ ```
104
+
105
+ ## License
106
+
107
+ MIT License — see [LICENSE](./LICENSE).
@@ -0,0 +1,107 @@
1
+ # Open C Code (OCC)
2
+
3
+ > 安全、开源的编码智能体 —— 能力完全对齐 Claude Code。
4
+
5
+ **[English](./README.md)** · 简体中文
6
+
7
+ ---
8
+
9
+ ## 这是什么
10
+
11
+ **Open C Code(OCC)** 是一个开源的编码智能体。能力与 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 对齐(当前跟踪 `2.1.200`)。代码全开放、可审计、无暗门,数据由你掌控。
12
+
13
+ 如果你担心闭源 CLI 可能植入后门、担心代码与凭据被上传到不可审计的服务,OCC 就是为你准备的:全部源码开放、无混淆,构建产物可由源码复现,API 凭据只发往你自己配置的端点。
14
+
15
+ ## 定位
16
+
17
+ - 🔓 **开源可审计** —— 全部源码开放,无混淆,可逐行审查。
18
+ - 🛡️ **安全透明** —— 无遥测黑盒、无隐藏上报;行为由你监督。
19
+ - 🎯 **能力对齐** —— REPL、工具系统、权限模型、MCP、子代理、斜杠命令……与 Claude Code 一致。
20
+ - 🔧 **数据自主** —— API Key / Bedrock / Vertex / Azure 凭据留在本机,请求只发往你指定的端点。
21
+
22
+ ## 现状
23
+
24
+ - 跟踪 Claude Code **`2.1.200`**。
25
+ - 代码库有约 1300 个不阻塞的 `tsc` 类型错误(大量松散的 `unknown`/`never`/`{}` 类型),**不影响 Bun 运行时执行**。门槛是 Biome lint,不是 `tsc`。
26
+ - 所有内部 feature flag(`feature(...)`)已被 polyfill 为 `false` —— 内部功能(COORDINATOR_MODE、KAIROS、PROACTIVE 等)全部关闭。
27
+ - 已发布到 npm:[`@cnwenf/occ`](https://www.npmjs.com/package/@cnwenf/occ)。
28
+
29
+ ## 安装
30
+
31
+ ```bash
32
+ npm i -g @cnwenf/occ
33
+ occ
34
+ ```
35
+
36
+ 需要有效的 Anthropic API Key(或 Bedrock / Vertex / Azure Foundry 凭据)。
37
+
38
+ ## 快速开始
39
+
40
+ ```bash
41
+ # 交互式 REPL
42
+ occ
43
+
44
+ # 管道模式(-p)
45
+ echo "say hello" | occ -p
46
+ ```
47
+
48
+ ## 能力
49
+
50
+ ### 核心系统
51
+ - **REPL** —— Ink 终端渲染,完整交互界面。
52
+ - **API 层** —— Anthropic Direct、AWS Bedrock、Google Vertex、Azure Foundry(API Key + OAuth / 凭据刷新)。
53
+ - **查询循环** —— 流式对话、工具调用循环、自动压缩、token 追踪(`query.ts`)。
54
+ - **会话引擎** —— 对话状态、归因、文件历史快照(`QueryEngine.ts`)。
55
+ - **上下文** —— git status、CLAUDE.md 层级、memory 文件。
56
+ - **权限系统** —— plan / auto / manual 模式,YOLO 分类器、路径校验、规则匹配。
57
+ - **Hook** —— pre/post tool use,通过 `settings.json` 配置。
58
+ - **会话恢复**(`/resume`)、**诊断**(`/doctor`)、**自动压缩**。
59
+
60
+ ### 工具 —— 始终可用
61
+ Bash、FileRead、FileEdit、FileWrite、NotebookEdit、Agent(子代理派生:fork / async / background / remote)、WebFetch、WebSearch、AskUserQuestion、SendMessage、Skill、EnterPlanMode、ExitPlanMode、TodoWrite(v1)、Brief、TaskOutput、TaskStop、ListMcpResources、ReadMcpResource、SyntheticOutput。
62
+
63
+ ### 工具 —— 条件启用
64
+ Glob、Grep(默认启用);TaskCreate/Get/Update/List(Todo v2)、EnterWorktree/ExitWorktree、TeamCreate/Delete(agent swarms)、ToolSearch、PowerShell(Windows)、LSP(`ENABLE_LSP_TOOL`)。
65
+
66
+ ### 关闭 / Stub
67
+ - Feature flag 关闭(所有 `feature()` 返回 false):Sleep、Cron、RemoteTrigger、Monitor、WebBrowser、Workflow、PushNotification 等。
68
+ - ANT-only stub:Tungsten、REPL、SuggestBackgroundPR。
69
+ - 移除 / 简化:Computer Use(`@ant/*`)、多数 `*-napi` 包(audio/image/url/modifiers —— 仅 `color-diff-napi` 完整实现)、Analytics / GrowthBook / Sentry(空实现)、Magic Docs / Voice Mode / LSP server、Plugins / Marketplace、MCP OAuth(简化)。
70
+
71
+ ### 斜杠命令
72
+ 已实现数十个:`/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` 等。
73
+
74
+ ### MCP
75
+ 通过 Model Context Protocol 接入外部工具(`--mcp-config`、`.mcp.json`)。OAuth 流程已简化。
76
+
77
+ ## 从源码构建
78
+
79
+ 需要 [Bun](https://bun.sh/) >= 1.3.11。
80
+
81
+ ```bash
82
+ bun install
83
+ bun run dev # 从源码运行;版本号显示 2.1.200 即正常
84
+ bun run build # 产物:dist/cli.js(~26MB,5300+ 模块,单文件 bundle)
85
+ bun test # 测试套件
86
+ bun run lint # Biome lint(禁用格式化以避免大 diff)
87
+ ```
88
+
89
+ 更详细的架构、入口/启动、工具系统、UI 层、模块状态说明见 [CLAUDE.md](./CLAUDE.md)。
90
+
91
+ ## 项目结构
92
+
93
+ ```
94
+ src/entrypoints/cli.tsx # 真正的入口(运行时 polyfill、宏)
95
+ src/main.tsx # Commander CLI 定义
96
+ src/query.ts # 主 API 查询循环
97
+ src/QueryEngine.ts # 会话编排
98
+ src/screens/REPL.tsx # 交互式 REPL 屏幕
99
+ src/services/api/ # API 客户端(Anthropic / Bedrock / Vertex / Azure)
100
+ src/tools/<Name>/ # 每个工具一个目录
101
+ src/ink/ # 自研 Ink 框架
102
+ packages/ # workspace stub(@ant/*、*-napi)
103
+ ```
104
+
105
+ ## 许可证
106
+
107
+ MIT 许可证 — 详见 [LICENSE](./LICENSE)。