censoride 0.0.0-stage → 1.4.1

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.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Cline Bot Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,385 @@
1
- # Temporary Holding Version
1
+ # Censor CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <img src="https://github.com/user-attachments/assets/7123f9d1-afeb-48d5-93fa-e750dec0ebba" width="70%" />
5
+ </p>
6
+
7
+ <div align="center">
8
+ <table>
9
+ <tbody>
10
+ <td align="center">
11
+ <a href="https://www.npmjs.com/package/censor" target="_blank">NPM</a>
12
+ </td>
13
+ <td align="center">
14
+ <a href="https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev" target="_blank">VS Code Extension</a>
15
+ </td>
16
+ <td align="center">
17
+ <a href="https://discord.gg/cline" target="_blank">Discord</a>
18
+ </td>
19
+ <td align="center">
20
+ <a href="https://www.reddit.com/r/cline/" target="_blank">r/cline</a>
21
+ </td>
22
+ <td align="center">
23
+ <a href="https://github.com/cline/cline/discussions/categories/feature-requests?discussions_q=is%3Aopen+category%3A%22Feature+Requests%22+sort%3Atop" target="_blank">Feature Requests</a>
24
+ </td>
25
+ <td align="center">
26
+ <a href="https://censor-ai.web.app" target="_blank">Censor</a>
27
+ </td>
28
+ </tbody>
29
+ </table>
30
+ </div>
31
+
32
+ Run Censor in your terminal. Interactive chat for paired sessions, or fully headless for CI/CD and scripting. The CLI shares its agent core with the [Censor VS Code extension](https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev), JetBrains plugin, and SDK, so plan/act modes, MCP servers, checkpoints, rules, skills, and provider configuration all behave the same across surfaces.
33
+
34
+ ## Install
35
+
36
+ ```sh
37
+ npm install -g censoride
38
+ ```
39
+
40
+ For nightly builds:
41
+
42
+ ```sh
43
+ npm install -g censoride@nightly
44
+ ```
45
+
46
+ Platform binaries are published for macOS, Linux, and Windows on `arm64` and `x64`. The `censor` package resolves the correct binary for your platform via optional dependencies, so no Node, Bun, or Zig runtime is required at install time.
47
+
48
+ ## Quick start
49
+
50
+ Run interactively:
51
+
52
+ ```sh
53
+ censor
54
+ ```
55
+
56
+ Run a single prompt:
57
+
58
+ ```sh
59
+ censor "Audit this package and propose fixes"
60
+ ```
61
+
62
+ Pipe input:
63
+
64
+ ```sh
65
+ cat file.txt | censor "Summarize this"
66
+ ```
67
+
68
+ See `censor --help` for the full flag reference.
69
+
70
+ ### Workspace & configuration commands
71
+
72
+ ```sh
73
+ censor init # initialize an isolated Censor config for this workspace
74
+ censor models # list real models from the configured provider (or -P <id>)
75
+ censor sessions # list saved sessions (same store as `censor history`)
76
+ ```
77
+
78
+ `censor init` writes its workspace config under the Censor data directory (`~/.cline` by default, override with `CENSOR_DIR`) — it never writes into your project or into an unrelated Cline configuration. All three support `--json` for scripting.
79
+
80
+ ## Use any provider
81
+
82
+ Censor supports the same providers as the VS Code extension. You can sign in to Censor directly, use your ChatGPT Subscription through `openai-codex`, or bring an API key from Anthropic, OpenAI, Google Gemini, OpenRouter, AWS Bedrock, GCP Vertex, Cerebras, Groq, and any OpenAI-compatible endpoint.
83
+
84
+ ```sh
85
+ censor auth # interactive sign-in
86
+ censor auth cline # OAuth sign-in
87
+ censor auth --provider anthropic --apikey sk-... --modelid claude-sonnet-4-6
88
+ ```
89
+
90
+ `censor auth` without a provider opens the interactive auth setup TUI with the same options as the old CLI flow (Sign in with Censor, Sign in with ChatGPT Subscription, Sign in with OCA, or use your own API key).
91
+
92
+ OAuth-supported providers (`cline`, `openai-codex`, `oca`) do not auto-launch a browser on normal startup. Authenticate explicitly first with `censor auth <provider>`. For non-interactive runs, if an OAuth provider is selected and no saved credentials are available, `censor` fails fast with an authentication message instead of launching a hidden browser flow.
93
+
94
+ ## Modes
95
+
96
+ Censor CLI runs in a few different shapes depending on what you need:
97
+
98
+ - Interactive TUI: `censor` or `censor -i` opens a full terminal UI with plan/act toggle, slash commands, file mentions, and live tool approvals
99
+ - One-shot: `censor "your prompt"` runs a single turn and exits
100
+ - JSON: `censor --json "..."` streams NDJSON events for piping into other tools
101
+ - Yolo: `censor --yolo "..."` skips approval prompts and exits when the turn finishes
102
+ - Zen: `censor --zen "..."` fires the task to the background hub daemon and exits immediately (see below)
103
+
104
+ ## Headless mode for CI/CD
105
+
106
+ Run Censor with zero interaction for scripting and automation. Pipe input, get JSON output, chain commands, integrate into CI/CD pipelines.
107
+
108
+ ```sh
109
+ # One-shot prompt, auto-approve all tools
110
+ censor --yolo "Run tests and fix any failures"
111
+
112
+ # Pipe a diff in for review
113
+ git diff origin/main | censor "Review these changes for issues"
114
+
115
+ # NDJSON output for downstream tooling
116
+ censor --json "List all TODO comments" | jq -r 'select(.type == "agent_event" and .event.text) | .event.text'
117
+ ```
118
+
119
+ ## Features
120
+
121
+ - Streaming TUI built on [OpenTUI](https://github.com/sst/opentui) with markdown rendering, syntax-highlighted diffs, scrollable chat, and mouse support
122
+ - Plan/Act mode toggle for switching between planning and execution
123
+ - Native MCP support for connecting custom tools
124
+ - Checkpoints with `/undo` to rewind workspace state
125
+ - Sub-agent spawning and agent teams for parallel work
126
+ - OAuth login for Censor, ChatGPT Subscription (`openai-codex`), and OCA
127
+ - Configurable thinking budgets per run
128
+ - Cron and event-driven schedules for recurring agent work
129
+ - Chat connectors for Telegram, Google Chat, and WhatsApp
130
+
131
+ ## Usage
132
+
133
+ ```sh
134
+ # Start Censor CLI without a prompt to enter interactive mode
135
+ censor
136
+
137
+ # Single prompt (one-shot) - includes tools, spawn, and teams
138
+ censor "Audit this package and propose fixes"
139
+
140
+ # Interactive mode with a starting prompt
141
+ censor -i "Let's work on this together. First, analyze the current state."
142
+
143
+ # With a custom system prompt
144
+ censor -i -s "You are a pirate" "Tell me about the sea"
145
+
146
+ # Require approval before each tool call
147
+ censor --auto-approve false "Inspect and modify this repository"
148
+
149
+ # Explicit yolo: enables submit_and_exit and disables spawn/team tools by default
150
+ censor --yolo --retries 5 "Refactor this package"
151
+
152
+ # Override consecutive internal mistake (retry) limit (default: 3)
153
+ censor --retries 5 "Fix failing tests"
154
+
155
+ # Team workflow with persistent name
156
+ censor --team-name my-team "Plan, implement, and verify release checklist"
157
+ censor --team-name my-team "Continue yesterday's team workflow"
158
+
159
+ # Show verbose run stats (elapsed time, tokens, estimated cost when available)
160
+ censor -v "Explain quantum computing"
161
+
162
+ # Use a specific provider, model, and access token for a single prompt
163
+ censor -P openrouter -m google/gemini-3-pro -k sk-... "Set up a storybook"
164
+
165
+ # Use a different model with the last used provider
166
+ censor -m anthropic/claude-opus-4-6 "Explain string theory"
167
+
168
+ # Stream structured NDJSON output
169
+ censor --json "Summarize this repository"
170
+
171
+ # Quick provider setup
172
+ censor auth --provider anthropic --apikey sk-... --modelid claude-sonnet-4-6
173
+ censor auth --provider openai-native --apikey sk-... --modelid gpt-5 --baseurl https://api.example.com/v1
174
+ ```
175
+
176
+ ### MCP servers
177
+
178
+ Manage MCP servers with the interactive wizard:
179
+
180
+ ```sh
181
+ censor mcp
182
+ censor config mcp
183
+ ```
184
+
185
+ Open the add-server wizard with the name, transport, and command or URL already filled in with `censor mcp install` (`censor mcp add` also works). Stdio servers use everything after `--` as the command and arguments:
186
+
187
+ ```sh
188
+ censor mcp install fs -- npx -y @modelcontextprotocol/server-filesystem /tmp
189
+ ```
190
+
191
+ Remote HTTP and SSE servers take a name, transport, and URL. The wizard still asks for auth details before saving:
192
+
193
+ ```sh
194
+ censor mcp install ctx7 --transport http https://mcp.context7.com/mcp
195
+ censor mcp install events --transport sse https://example.com/sse
196
+ ```
197
+
198
+ Because this command opens the wizard, it requires a TTY.
199
+
200
+ ### Connectors
201
+
202
+ Bridge a chat surface into RPC-backed Censor sessions. Each conversation thread maps to a session with full context. Supported platforms: Telegram, Slack, Google Chat, WhatsApp, and Linear.
203
+
204
+ ```sh
205
+ # Telegram (polling mode)
206
+ censor connect telegram -k 123456:ABCDEF...
207
+
208
+ # Slack (webhook mode)
209
+ censor connect slack --bot-token $SLACK_BOT_TOKEN --signing-secret $SLACK_SIGNING_SECRET --base-url https://your-domain.com
210
+
211
+ # Slack (socket mode)
212
+ censor connect slack --bot-token $SLACK_BOT_TOKEN --app-token $SLACK_APP_TOKEN
213
+
214
+ # Google Chat (webhook mode)
215
+ censor connect gchat --base-url https://your-domain.com
216
+
217
+ # WhatsApp (webhook mode)
218
+ censor connect whatsapp --base-url https://your-domain.com
219
+
220
+ # Linear (webhook mode)
221
+ censor connect linear --api-key $LINEAR_API_KEY --base-url https://your-domain.com
222
+
223
+ # Stop connector bridges and delete their sessions
224
+ censor connect --stop
225
+ censor connect --stop telegram
226
+ ```
227
+
228
+ In chat surfaces, connector slash commands include `/help`, `/start`, `/new`, `/clear`, `/whereami`, `/tools`, `/yolo`, `/cwd <path>`, `/schedule`, `/abort`, and `/exit`. Run `censor connect <adapter> --help` to see the full flag list for any adapter.
229
+
230
+ ### Schedules
231
+
232
+ Schedule agents on cron-like intervals or external events.
233
+
234
+ If `--provider` and `--model` are omitted, schedules use the last configured
235
+ provider and model. If only `--provider` is given, the schedule uses that
236
+ provider's saved model.
237
+
238
+ ```sh
239
+ censor schedule create "Daily code review" \
240
+ --cron "0 9 * * MON-FRI" \
241
+ --prompt "Review PRs opened yesterday and summarize issues." \
242
+ --workspace /path/to/repo \
243
+ --timeout 3600 \
244
+ --tags automation,review
245
+
246
+ censor schedule list
247
+ censor schedule get <schedule-id>
248
+ censor schedule trigger <schedule-id>
249
+ censor schedule history <schedule-id> --limit 20
250
+ censor schedule export <schedule-id> > daily-review.yaml
251
+ censor schedule import ./daily-review.yaml
252
+ ```
253
+
254
+ Schedules can route results back to chat surfaces with `--delivery-adapter`, `--delivery-bot`, and `--delivery-thread`.
255
+
256
+ ## Options
257
+
258
+ | Flag | Description |
259
+ |------|-------------|
260
+ | `-s, --system <prompt>` | Override the system prompt |
261
+ | `-P, --provider <id>` | Provider id (default: `cline`) |
262
+ | `-m, --model <id>` | Model id (default: `anthropic/claude-sonnet-4.6`) |
263
+ | `-k, --key <api-key>` | API key override for this run |
264
+ | `-p, --plan` | Run in plan mode (default is act mode) |
265
+ | `-i, --tui` | Interactive TUI multi-turn mode |
266
+ | `-t, --timeout <seconds>` | Optional run timeout in seconds |
267
+ | `-c, --cwd <path>` | Working directory for tools |
268
+ | `--config <path>` | Configuration directory (used for CLI home resolution) |
269
+ | `--hooks-dir <path>` | Additional hooks directory hint for runtime hook injection |
270
+ | `--acp` | ACP (Agent Client Protocol) mode |
271
+ | `--thinking [none\|low\|medium\|high\|xhigh]` | Model thinking level when supported. Defaults to `medium` when the flag is provided without a level; thinking is off when the flag is omitted. |
272
+ | `--compaction <agentic\|basic\|off>` | Context compaction mode. Defaults to `agentic`; use `basic` for local truncation or `off` to disable. |
273
+ | `--retries <count>` | Maximum consecutive mistakes (retries) before halting (default: `3`) |
274
+ | `--json` | Output NDJSON instead of styled text |
275
+ | `--data-dir <path>` | Use isolated local state at `<path>` instead of `~/.cline/data` (enables sandbox mode automatically) |
276
+ | `--auto-approve [true\|false]` | Set tool auto-approval for all tools |
277
+ | `--kanban` | Run the external `kanban` app |
278
+ | `-y, --yolo` | Skip tool approval prompts, enable `submit_and_exit`, and disable spawn/team tools by default |
279
+ | `-z, --zen` | Dispatch the task to the background hub and exit the CLI immediately |
280
+ | `--team-name <name>` | Override the runtime team state name |
281
+ | `-h, --help` | Show help and exit |
282
+ | `-v, --verbose` | Show verbose runtime diagnostics |
283
+ | `-V, --version` | Show version and exit |
284
+
285
+ `--json` is non-interactive and requires either a prompt argument or piped stdin. `--key` takes precedence over environment variables.
286
+
287
+ ## Top-level commands
288
+
289
+ - `censor config` - Open the interactive config view
290
+ - `censor history|h [options]` - List session history or manage saved sessions
291
+ - `censor version` - Show CLI version
292
+ - `censor update [options]` - Check for CLI and kanban updates
293
+ - `censor auth <provider>` - Authenticate or seed provider credentials
294
+ - `censor connect <adapter>` - Run a chat connector bridge (`telegram`, `gchat`, `whatsapp`)
295
+ - `censor connect --stop [adapter]` - Stop connector bridge processes and their sessions
296
+ - `censor schedule <command>` - Create and manage scheduled runs
297
+ - `censor doctor` - Inspect local CLI health and stale processes
298
+ - `censor doctor fix` - Kill stale local RPC listeners and old CLI processes
299
+ - `censor doctor log` - Open the CLI runtime log file
300
+ - `censor hook` - Handle a hook payload from stdin
301
+ - `censor hub` - Manage the local hub daemon
302
+ - `censor kanban` - Run the external `kanban` app, installing it first when needed
303
+
304
+ ## Zen mode
305
+
306
+ `--zen` (alias `-z`) runs a task in the background hub daemon and exits the CLI immediately. It is intended for long-running tasks you want to fire off and walk away from.
307
+
308
+ ```sh
309
+ censor --zen "Refactor the authentication module and add unit tests"
310
+ ```
311
+
312
+ Behavior:
313
+
314
+ - The CLI starts (or reuses) the local hub daemon, submits the task, then exits. It does not stream output or stay attached to the session.
315
+ - Because there is no human in the loop once the CLI exits, zen sessions run with full tool auto-approval (same semantics as `--yolo`). `spawn`/`team` tools are disabled by default for safety, consistent with yolo-mode defaults.
316
+ - If the Censor menubar app is running, it subscribes to hub `ui.notify` events and will surface a system notification when the task completes.
317
+ - If the menubar app is not running, there is no live UI for the task. Use `censor history` later to find the session and inspect the result.
318
+ - `--zen` is incompatible with `--data-dir` (the implicit sandbox requires a local backend that exits with the CLI) and with `--tui` (there is no terminal UI to render into).
319
+
320
+ ## Tool approval
321
+
322
+ Tool calls are auto-approved by default. Use `--auto-approve false` to require review before tool execution.
323
+
324
+ ```sh
325
+ censor --auto-approve false "Inspect and modify this repository"
326
+ ```
327
+
328
+ When approval is required, the CLI prompts in TTY mode:
329
+
330
+ ```text
331
+ Approve tool "<tool_name>" with input <preview>? [y/N]
332
+ ```
333
+
334
+ - Enter `y` or `yes` to approve.
335
+ - Enter anything else (or press Enter) to reject.
336
+ - If stdin/stdout is not a TTY, required-approval calls are denied in terminal mode.
337
+
338
+ Desktop-integrated approval mode is also supported via env wiring (`CENSOR_TOOL_APPROVAL_MODE=desktop` and `CENSOR_TOOL_APPROVAL_DIR=<path>`). In desktop mode, CLI writes a request JSON file and waits for a matching decision JSON file.
339
+
340
+ ## Environment variables
341
+
342
+ - `ANTHROPIC_API_KEY` - API key for Anthropic
343
+ - `CENSOR_API_KEY` - API key for Censor (when using `-P cline`)
344
+ - `OPENAI_API_KEY` - API key for OpenAI (when using `-P openai`)
345
+ - `OPENROUTER_API_KEY` - API key for OpenRouter (when using `-P openrouter`)
346
+ - `AI_GATEWAY_API_KEY` - API key for Vercel AI Gateway (when using `-P vercel-ai-gateway`)
347
+ - `V0_API_KEY` - API key for v0 (when using `-P v0`)
348
+ - `CENSOR_DATA_DIR` - Base data directory for sessions/settings/teams/hooks
349
+ - `CENSOR_SANDBOX` - Set to `1` to force sandbox mode
350
+ - `CENSOR_SANDBOX_DATA_DIR` - Override sandbox state directory
351
+ - `CENSOR_TEAM_DATA_DIR` - Override team persistence directory
352
+ - `CENSOR_BUILD_ENV` - Runtime build mode for SDK-owned subprocess launches
353
+ - `CENSOR_DEBUG_HOST` - Host for development inspector listeners (default `127.0.0.1`)
354
+ - `CENSOR_DEBUG_PORT_BASE` - Base inspector port for development child processes
355
+ - `CENSOR_TOOL_APPROVAL_MODE` - Approval mode (`desktop` uses file IPC; unset uses terminal prompt)
356
+ - `CENSOR_TOOL_APPROVAL_DIR` - Directory for desktop approval request/decision files
357
+ - `CENSOR_LOG_ENABLED` - Set to `0`/`false` to disable runtime file logging
358
+ - `CENSOR_LOG_LEVEL` - Runtime log level (`trace|debug|info|warn|error|fatal|silent`, default `info`)
359
+ - `CENSOR_LOG_PATH` - Runtime log file path (default `<CENSOR_DATA_DIR>/logs/censor.log`)
360
+ - `CENSOR_LOG_NAME` - Logger name embedded in runtime log records
361
+ - `CENSOR_DEBUG` - Set to `1`/`true` to print wrapper diagnostics (e.g. the CA bundle summary)
362
+
363
+ `--key` takes precedence over environment variables.
364
+
365
+ ## Certificate trust
366
+
367
+ The CLI automatically trusts your operating system's certificate store, so it
368
+ works behind corporate TLS-inspecting proxies and with self-signed/internal
369
+ endpoints without any setup. On launch the `censor` wrapper harvests the OS trust
370
+ anchors and writes them to `~/.cline/cli-node-extra-ca-certs.pem`, then points
371
+ the runtime's `NODE_EXTRA_CA_CERTS` at that bundle. The file is regenerated when
372
+ it changes and is safe to delete (it is rebuilt on the next run).
373
+
374
+ If you set `NODE_EXTRA_CA_CERTS` yourself, your certificates are **merged** into
375
+ that bundle alongside the system store rather than replacing it. Run with
376
+ `CENSOR_DEBUG=1` to see how many OS and user CAs were loaded and where the bundle
377
+ was written.
378
+
379
+ ## Contributing
380
+
381
+ See [DEVELOPMENT.md](./DEVELOPMENT.md) for local development setup, monorepo structure, and TUI architecture. See [DISTRIBUTION.md](./DISTRIBUTION.md) for how the CLI is packaged and distributed.
382
+
383
+ ## License
384
+
385
+ [Apache 2.0 © Censor Bot Inc.](https://github.com/cline/cline/blob/main/LICENSE)
@@ -0,0 +1,281 @@
1
+ // Auto-discovery of OS trust anchors for the Censor CLI.
2
+ //
3
+ // Bun does not read the OS trust store, so the 3.x CLI cannot see corporate
4
+ // MITM / self-signed CAs out of the box. This runs in the Node `bin/censor`
5
+ // wrapper (not Bun), reads the full OS store via tls.getCACertificates("system")
6
+ // (Node >= 22, no --use-system-ca flag), and hands the certs to the Bun child
7
+ // via NODE_EXTRA_CA_CERTS, which both runtimes honor. Mirrors the JetBrains
8
+ // plugin's configureCertificates(), sourcing from the OS instead of the IDE.
9
+ //
10
+ // Dependency-free CommonJS with injectable modules so it is unit-testable and
11
+ // ships verbatim in the published wrapper package.
12
+
13
+ const PEM_MARKER = "-----BEGIN CERTIFICATE-----";
14
+ const CERT_BLOCK =
15
+ /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
16
+
17
+ /**
18
+ * Returns only the complete certificate blocks from PEM text, or null when
19
+ * there are none. User files may also hold private keys (combined cert+key
20
+ * PEMs) or other sections, which must never be copied into the managed
21
+ * bundle. Files that contain nothing but certificates pass through verbatim
22
+ * so unchanged bundles keep hash-skipping the rewrite.
23
+ */
24
+ function sanitizePem(text) {
25
+ const blocks = text.match(CERT_BLOCK) ?? [];
26
+ if (blocks.length === 0) {
27
+ return null;
28
+ }
29
+ const rest = text.replace(CERT_BLOCK, "");
30
+ if (/^\s*$/.test(rest)) {
31
+ return text;
32
+ }
33
+ return `${blocks.join("\n")}\n`;
34
+ }
35
+
36
+ /**
37
+ * Returns OS-trusted certificates as PEM strings, or [] when unavailable.
38
+ * tls.getCACertificates("system") requires Node >= 22.
39
+ */
40
+ function harvestSystemCerts(tlsModule) {
41
+ try {
42
+ const tls = tlsModule || require("node:tls");
43
+ if (typeof tls.getCACertificates !== "function") {
44
+ return [];
45
+ }
46
+ const certs = tls.getCACertificates("system");
47
+ if (!Array.isArray(certs)) {
48
+ return [];
49
+ }
50
+ return certs.filter(
51
+ (cert) => typeof cert === "string" && cert.includes(PEM_MARKER),
52
+ );
53
+ } catch {
54
+ return [];
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Returns the file's certificate blocks as PEM text, or null when missing,
60
+ * unreadable, or holding no complete certificate block.
61
+ */
62
+ function readUserBundle(fsModule, userPath) {
63
+ if (!userPath) {
64
+ return null;
65
+ }
66
+ try {
67
+ const fs = fsModule || require("node:fs");
68
+ const stat = fs.statSync(userPath, { throwIfNoEntry: false });
69
+ if (!stat || !stat.isFile()) {
70
+ return null;
71
+ }
72
+ // Binary DER would not have loaded in the runtime either; require PEM.
73
+ return sanitizePem(fs.readFileSync(userPath, "utf8"));
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Reads the user's NODE_EXTRA_CA_CERTS value into PEM strings. Node treats the
81
+ * value as a single file, but some users set an OS-path-delimited list; the
82
+ * whole value is tried as one file first, then split.
83
+ * The managed bundle is excluded so reading it back never re-appends its certs.
84
+ */
85
+ function readUserCerts(fsModule, pathModule, value, managedPath) {
86
+ if (!value) {
87
+ return [];
88
+ }
89
+ const fs = fsModule || require("node:fs");
90
+ const path = pathModule || require("node:path");
91
+ const candidates = [];
92
+ const whole = readUserBundle(fs, value);
93
+ if (whole) {
94
+ candidates.push({ filePath: value, pem: whole });
95
+ } else if (value.includes(path.delimiter)) {
96
+ for (const segment of value.split(path.delimiter)) {
97
+ const trimmed = segment.trim();
98
+ if (!trimmed) {
99
+ continue;
100
+ }
101
+ const pem = readUserBundle(fs, trimmed);
102
+ if (pem) {
103
+ candidates.push({ filePath: trimmed, pem });
104
+ }
105
+ }
106
+ }
107
+ const pems = [];
108
+ for (const candidate of candidates) {
109
+ const isManaged =
110
+ managedPath &&
111
+ path.resolve(candidate.filePath) === path.resolve(managedPath);
112
+ if (!isManaged) {
113
+ pems.push(candidate.pem);
114
+ }
115
+ }
116
+ return pems;
117
+ }
118
+
119
+ /**
120
+ * Concatenates the user PEMs (if any) and the system certificates into one
121
+ * bundle. A separating newline is inserted between parts so adjacent END/BEGIN
122
+ * markers cannot fuse into one invalid line.
123
+ */
124
+ function buildBundle({ systemCerts, userPems }) {
125
+ const parts = [...(userPems ?? []), ...systemCerts];
126
+ return parts
127
+ .map((part) => (part.endsWith("\n") ? part : `${part}\n`))
128
+ .join("");
129
+ }
130
+
131
+ /** Counts individual PEM certificates across the given bundle strings. */
132
+ function countCerts(pems) {
133
+ let count = 0;
134
+ for (const pem of pems) {
135
+ count += pem.split(PEM_MARKER).length - 1;
136
+ }
137
+ return count;
138
+ }
139
+
140
+ function readFileIfExists(fs, filePath) {
141
+ try {
142
+ return fs.readFileSync(filePath, "utf8");
143
+ } catch {
144
+ return null;
145
+ }
146
+ }
147
+
148
+ function resolveCensorDir(env, os, path) {
149
+ return env.CENSOR_DIR?.trim() || path.join(os.homedir(), ".cline");
150
+ }
151
+
152
+ /**
153
+ * True when the api-unavailable warning should print. Stamped per Node version
154
+ * in the censor dir so the nudge shows once rather than on every command; a
155
+ * version change (upgrade that still falls short, or downgrade) re-arms it.
156
+ * When the stamp cannot be read or written, warn — bookkeeping failures must
157
+ * never suppress a real diagnostic.
158
+ */
159
+ function shouldWarnApiUnavailable(env, deps = {}) {
160
+ const fs = deps.fs || require("node:fs");
161
+ const os = deps.os || require("node:os");
162
+ const path = deps.path || require("node:path");
163
+ const version = deps.nodeVersion || process.versions.node;
164
+ const dir = resolveCensorDir(env, os, path);
165
+ const stamp = path.join(dir, `.ca-api-warned-${version}`);
166
+ try {
167
+ if (fs.existsSync(stamp)) {
168
+ return false;
169
+ }
170
+ fs.mkdirSync(dir, { recursive: true });
171
+ fs.writeFileSync(stamp, "", { mode: 0o600 });
172
+ return true;
173
+ } catch {
174
+ return true;
175
+ }
176
+ }
177
+
178
+ /** Atomically writes [content] to [target]; returns true on success. */
179
+ function writeBundle(fs, dir, target, content) {
180
+ const tmp = `${target}.${process.pid}.${Date.now()}.tmp`;
181
+ try {
182
+ fs.mkdirSync(dir, { recursive: true });
183
+ // Owner read/write: the bundle holds public CA material, not secrets,
184
+ // but there is no reason to make it world-writable.
185
+ fs.writeFileSync(tmp, content, { mode: 0o600 });
186
+ try {
187
+ fs.renameSync(tmp, target);
188
+ } catch {
189
+ // Windows can reject rename over a file a concurrent child holds open.
190
+ fs.rmSync(target, { force: true });
191
+ fs.renameSync(tmp, target);
192
+ }
193
+ return true;
194
+ } catch {
195
+ // Never leave a partial temp file behind (e.g. ENOSPC mid-write).
196
+ try {
197
+ fs.rmSync(tmp, { force: true });
198
+ } catch {
199
+ // Ignore: best-effort cleanup.
200
+ }
201
+ return false;
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Harvests OS trust anchors, merges them with any user NODE_EXTRA_CA_CERTS, and
207
+ * points env.NODE_EXTRA_CA_CERTS at a single managed PEM bundle. Mutates `env`
208
+ * in place. Returns an outcome the caller can log; `action` is one of
209
+ * "unchanged" | "written" | "write-failed-reused" | "write-failed" |
210
+ * "no-system-certs" | "api-unavailable".
211
+ */
212
+ function configureNodeExtraCaCerts(env, deps = {}) {
213
+ const fs = deps.fs || require("node:fs");
214
+ const os = deps.os || require("node:os");
215
+ const path = deps.path || require("node:path");
216
+ const tls = deps.tls || require("node:tls");
217
+
218
+ // tls.getCACertificates("system") needs Node >= 22.15; on older Nodes the
219
+ // harvest cannot run at all, which the caller should surface to the user.
220
+ if (typeof tls.getCACertificates !== "function") {
221
+ return {
222
+ action: "api-unavailable",
223
+ path: null,
224
+ systemCertCount: 0,
225
+ userCertCount: 0,
226
+ };
227
+ }
228
+
229
+ const systemCerts = harvestSystemCerts(tls);
230
+ if (systemCerts.length === 0) {
231
+ // Nothing to add: leave any user-provided NODE_EXTRA_CA_CERTS untouched
232
+ // and let the runtime fall back to its bundled CAs.
233
+ return {
234
+ action: "no-system-certs",
235
+ path: null,
236
+ systemCertCount: 0,
237
+ userCertCount: 0,
238
+ };
239
+ }
240
+
241
+ const managedDir = resolveCensorDir(env, os, path);
242
+ const managedPath = path.join(managedDir, "cli-node-extra-ca-certs.pem");
243
+ const userValue = (env.NODE_EXTRA_CA_CERTS || "").trim() || null;
244
+ const userPems = readUserCerts(fs, path, userValue, managedPath);
245
+ const bundle = buildBundle({ systemCerts, userPems });
246
+ const base = {
247
+ path: managedPath,
248
+ systemCertCount: systemCerts.length,
249
+ userCertCount: countCerts(userPems),
250
+ };
251
+
252
+ // Skip the rewrite when the bundle is already current. Avoids per-launch I/O
253
+ // and the concurrent-rename race in the steady state.
254
+ if (readFileIfExists(fs, managedPath) === bundle) {
255
+ env.NODE_EXTRA_CA_CERTS = managedPath;
256
+ return { ...base, action: "unchanged" };
257
+ }
258
+
259
+ if (writeBundle(fs, managedDir, managedPath, bundle)) {
260
+ env.NODE_EXTRA_CA_CERTS = managedPath;
261
+ return { ...base, action: "written" };
262
+ }
263
+
264
+ // Write failed: fall back to a previously-written bundle if one exists.
265
+ if (readFileIfExists(fs, managedPath)) {
266
+ env.NODE_EXTRA_CA_CERTS = managedPath;
267
+ return { ...base, action: "write-failed-reused" };
268
+ }
269
+ return { ...base, path: null, action: "write-failed" };
270
+ }
271
+
272
+ module.exports = {
273
+ harvestSystemCerts,
274
+ sanitizePem,
275
+ readUserBundle,
276
+ readUserCerts,
277
+ buildBundle,
278
+ countCerts,
279
+ configureNodeExtraCaCerts,
280
+ shouldWarnApiUnavailable,
281
+ };
package/bin/censor ADDED
@@ -0,0 +1,187 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Binary resolver for Censor CLI.
4
+ //
5
+ // This script runs with Node.js (available everywhere npm is) and finds the
6
+ // correct platform-specific compiled binary to execute. The compiled binary
7
+ // has Bun embedded, so users don't need Bun installed.
8
+ //
9
+ // Resolution order:
10
+ // 1. CENSOR_BIN_PATH env var override
11
+ // 2. Cached binary at bin/.censor (created by postinstall)
12
+ // 3. Walk up node_modules to find the platform-specific package
13
+
14
+ const childProcess = require("child_process");
15
+ const fs = require("fs");
16
+ const path = require("path");
17
+ const os = require("os");
18
+
19
+ const scriptPath = fs.realpathSync(__filename);
20
+ const scriptDir = path.dirname(scriptPath);
21
+ const childEnv = {
22
+ ...process.env,
23
+ CENSOR_WRAPPER_PATH: scriptPath,
24
+ };
25
+
26
+ // Auto-discover OS trust anchors and pass them to the Bun child via
27
+ // NODE_EXTRA_CA_CERTS. The Bun runtime does not read the OS store on its own,
28
+ // so corporate/self-signed CAs would otherwise fail. This wrapper runs on
29
+ // Node, which can read the full store here.
30
+ try {
31
+ const caCerts = require("./ca-certs.cjs");
32
+ const outcome = caCerts.configureNodeExtraCaCerts(childEnv);
33
+ const debug =
34
+ process.env.CENSOR_DEBUG === "1" || process.env.CENSOR_DEBUG === "true";
35
+ // Not debug-gated: on old Nodes the harvest silently doing nothing is
36
+ // indistinguishable from a broken corporate proxy. Stamped per Node
37
+ // version so the nudge shows once, not on every command.
38
+ if (
39
+ outcome &&
40
+ outcome.action === "api-unavailable" &&
41
+ !childEnv.NODE_EXTRA_CA_CERTS &&
42
+ caCerts.shouldWarnApiUnavailable(childEnv)
43
+ ) {
44
+ console.warn(
45
+ `[censor] Node ${process.versions.node} cannot read the OS trust store (needs >= 22.15); ` +
46
+ "corporate or self-signed CAs may fail TLS. Upgrade Node or set NODE_EXTRA_CA_CERTS.",
47
+ );
48
+ }
49
+ if (debug && outcome) {
50
+ if (outcome.action === "no-system-certs") {
51
+ console.warn(
52
+ "[censor] No OS trust anchors found; relying on the runtime's bundled CAs.",
53
+ );
54
+ } else if (outcome.action === "write-failed") {
55
+ console.warn(
56
+ "[censor] Could not write the managed CA bundle; relying on the runtime's bundled CAs.",
57
+ );
58
+ } else {
59
+ console.warn(
60
+ `[censor] Trust: ${outcome.systemCertCount} OS + ${outcome.userCertCount} user CAs (${outcome.action}) -> ${outcome.path}`,
61
+ );
62
+ }
63
+ }
64
+ } catch {
65
+ // Best effort: fall back to the runtime's default trust on any failure.
66
+ }
67
+
68
+ function run(target) {
69
+ const result = childProcess.spawnSync(target, process.argv.slice(2), {
70
+ stdio: "inherit",
71
+ env: childEnv,
72
+ });
73
+ if (result.error) {
74
+ console.error(result.error.message);
75
+ // Windows application control (Smart App Control, WDAC, AppLocker)
76
+ // blocks the child exe at launch, which Node surfaces only as an
77
+ // opaque "spawnSync ... UNKNOWN" error. Point users at the real cause.
78
+ const code = result.error.code;
79
+ if (
80
+ os.platform() === "win32" &&
81
+ (code === "UNKNOWN" || code === "EACCES" || code === "EPERM")
82
+ ) {
83
+ console.error(
84
+ "\nWindows refused to start the Censor binary:\n " +
85
+ target +
86
+ "\n\n" +
87
+ "This usually means an application control policy (Smart App Control,\n" +
88
+ "WDAC, or AppLocker) or antivirus blocked the executable. To confirm,\n" +
89
+ "run the path above directly in a terminal and check the error Windows\n" +
90
+ "reports, or inspect its signature with:\n\n" +
91
+ ' Get-AuthenticodeSignature "' +
92
+ target +
93
+ '"\n\n' +
94
+ "If it was blocked by policy, allow the file or ask your administrator\n" +
95
+ "to trust it. See https://github.com/cline/cline/issues for known issues.",
96
+ );
97
+ }
98
+ process.exit(1);
99
+ }
100
+ if (typeof result.status === "number") {
101
+ process.exit(result.status);
102
+ }
103
+ if (result.signal) {
104
+ process.kill(process.pid, result.signal);
105
+ process.exit(128);
106
+ }
107
+ process.exit(1);
108
+ }
109
+
110
+ // 1. Check env var override
111
+ const envPath = process.env.CENSOR_BIN_PATH;
112
+ if (envPath) {
113
+ run(envPath);
114
+ }
115
+
116
+ // 2. Check cached binary
117
+ const cached = path.join(scriptDir, ".censor");
118
+ if (fs.existsSync(cached)) {
119
+ run(cached);
120
+ }
121
+
122
+ // 3. Detect platform and architecture
123
+ const platformMap = {
124
+ darwin: "darwin",
125
+ linux: "linux",
126
+ win32: "windows",
127
+ };
128
+ const archMap = {
129
+ x64: "x64",
130
+ arm64: "arm64",
131
+ };
132
+
133
+ let platform = platformMap[os.platform()];
134
+ if (!platform) {
135
+ platform = os.platform();
136
+ }
137
+ let arch = archMap[os.arch()];
138
+ if (!arch) {
139
+ arch = os.arch();
140
+ }
141
+
142
+ const base = "censoride-" + platform + "-" + arch;
143
+ const binary = platform === "windows" ? "censor.exe" : "censor";
144
+
145
+ // Build fallback chain of package names to try
146
+ const names = [base];
147
+
148
+ function findBinary(startDir) {
149
+ let current = startDir;
150
+ for (;;) {
151
+ const modules = path.join(current, "node_modules");
152
+ if (fs.existsSync(modules)) {
153
+ for (const name of names) {
154
+ // Scoped package: @censor/cli-darwin-arm64 lives at
155
+ // node_modules/@censor/cli-darwin-arm64
156
+ const candidate = path.join(modules, name, "bin", binary);
157
+ if (fs.existsSync(candidate)) return candidate;
158
+ }
159
+ }
160
+ const parent = path.dirname(current);
161
+ if (parent === current) {
162
+ return undefined;
163
+ }
164
+ current = parent;
165
+ }
166
+ }
167
+
168
+ const resolved = findBinary(scriptDir);
169
+ if (!resolved) {
170
+ console.error(
171
+ "Could not find the Censor CLI binary for your platform.\n" +
172
+ "Your platform: " +
173
+ os.platform() +
174
+ " " +
175
+ os.arch() +
176
+ "\n" +
177
+ "Looked for: " +
178
+ names.map(function (n) {
179
+ return '"' + n + '"';
180
+ }).join(" or ") +
181
+ "\n\n" +
182
+ "Try reinstalling: npm install -g censoride",
183
+ );
184
+ process.exit(1);
185
+ }
186
+
187
+ run(resolved);
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "censoride",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.4.1",
4
+ "description": "Autonomous coding agent CLI - capable of creating/editing files, running commands, using the browser, and more",
5
+ "license": "Apache-2.0",
6
+ "keywords": [
7
+ "censor",
8
+ "claude",
9
+ "dev",
10
+ "mcp",
11
+ "openrouter",
12
+ "coding",
13
+ "agent",
14
+ "autonomous",
15
+ "chatgpt",
16
+ "sonnet",
17
+ "ai",
18
+ "llama",
19
+ "cli"
20
+ ],
21
+ "author": {
22
+ "name": "Censor Bot Inc."
23
+ },
24
+ "homepage": "https://censor-ai.web.app",
25
+ "bugs": {
26
+ "url": "https://github.com/cline/cline/issues"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/cline/cline.git",
31
+ "directory": "apps/cli"
32
+ },
33
+ "bin": {
34
+ "censor": "./bin/censor"
35
+ },
36
+ "scripts": {
37
+ "postinstall": "node ./postinstall.mjs || true"
38
+ },
39
+ "dependencies": {
40
+ "@cline/sdk": "0.0.85",
41
+ "@cline/core": "0.0.85",
42
+ "@cline/agents": "0.0.85",
43
+ "@cline/llms": "0.0.85",
44
+ "@cline/shared": "0.0.85"
45
+ },
46
+ "optionalDependencies": {
47
+ "censoride-windows-x64": "1.4.1",
48
+ "censoride-windows-arm64": "1.4.1",
49
+ "censoride-linux-x64": "1.4.1",
50
+ "censoride-linux-arm64": "1.4.1",
51
+ "censoride-darwin-x64": "1.4.1",
52
+ "censoride-darwin-arm64": "1.4.1"
53
+ }
54
+ }
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Post-install script for Censor CLI.
4
+ //
5
+ // Creates a hard link (or copy fallback) from the platform-specific binary
6
+ // to bin/.censor for fast startup on subsequent runs.
7
+ //
8
+ // This script must use only Node.js APIs (no Bun) since it runs via
9
+ // "node script/postinstall.mjs" in the npm lifecycle.
10
+
11
+ import fs from "node:fs";
12
+ import { createRequire } from "node:module";
13
+ import os from "node:os";
14
+ import path from "node:path";
15
+ import { fileURLToPath } from "node:url";
16
+
17
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
18
+ const require = createRequire(import.meta.url);
19
+
20
+ // CLI versions <= 3.0.54 restart the hub daemon after a background
21
+ // auto-update even while it is serving live sessions, killing those sessions
22
+ // mid-turn — and their build-fingerprint check then rejects every replacement
23
+ // hub, bricking the running TUI. That restart code is the *old* version's, so
24
+ // it cannot be patched here; but it bails out harmlessly when no hub
25
+ // discovery record exists, and it runs only after this install (and this
26
+ // script) completes. Setting the record aside protects any attached clients:
27
+ // a running hub keeps serving its established connections, clients that share
28
+ // its build fingerprint rebuild the record from a port probe, and the next
29
+ // fresh launch retires stale hubs regardless of the record.
30
+ function shieldRunningHubDiscovery() {
31
+ const explicitPath = process.env.CENSOR_HUB_DISCOVERY_PATH?.trim();
32
+ const dataDir =
33
+ process.env.CENSOR_DATA_DIR?.trim() ||
34
+ path.join(
35
+ process.env.CENSOR_DIR?.trim() || path.join(os.homedir(), ".cline"),
36
+ "data",
37
+ );
38
+ const recordPath =
39
+ explicitPath || path.join(dataDir, "locks", "hub", "production.json");
40
+ if (!fs.existsSync(recordPath)) {
41
+ return;
42
+ }
43
+ const asidePath = `${recordPath}.superseded`;
44
+ fs.rmSync(asidePath, { force: true });
45
+ fs.renameSync(recordPath, asidePath);
46
+ console.log("Set aside hub discovery record for the updated CLI");
47
+ }
48
+
49
+ function main() {
50
+ if (os.platform() === "win32") {
51
+ // On Windows, npm creates .cmd shims from the bin field.
52
+ // The resolver script handles binary lookup at runtime.
53
+ console.log("Windows detected: skipping binary cache setup");
54
+ return;
55
+ }
56
+
57
+ const platformMap = {
58
+ darwin: "darwin",
59
+ linux: "linux",
60
+ };
61
+ const platform = platformMap[os.platform()] || os.platform();
62
+ const arch = os.arch();
63
+ const packageName = `@censor/cli-${platform}-${arch}`;
64
+ const binaryName = "censor";
65
+
66
+ let binaryPath;
67
+ try {
68
+ const packageJsonPath = require.resolve(`${packageName}/package.json`);
69
+ const packageDir = path.dirname(packageJsonPath);
70
+ binaryPath = path.join(packageDir, "bin", binaryName);
71
+
72
+ if (!fs.existsSync(binaryPath)) {
73
+ throw new Error(`Binary not found at ${binaryPath}`);
74
+ }
75
+ } catch (_error) {
76
+ // Platform package not available. The resolver script will find
77
+ // it at runtime by walking node_modules. This is expected on
78
+ // platforms we don't ship binaries for.
79
+ console.log(`Note: ${packageName} not found, skipping binary cache`);
80
+ return;
81
+ }
82
+
83
+ const binDir =
84
+ path.basename(__dirname) === "script"
85
+ ? path.join(__dirname, "..", "bin")
86
+ : path.join(__dirname, "bin");
87
+ const target = path.join(binDir, ".censor");
88
+
89
+ // Ensure bin directory exists
90
+ if (!fs.existsSync(binDir)) {
91
+ fs.mkdirSync(binDir, { recursive: true });
92
+ }
93
+
94
+ // Remove existing cached binary
95
+ if (fs.existsSync(target)) {
96
+ fs.unlinkSync(target);
97
+ }
98
+
99
+ // Hard link preferred (shares disk space), copy as fallback
100
+ // (hard links fail on some filesystems like NFS or cross-device)
101
+ try {
102
+ fs.linkSync(binaryPath, target);
103
+ } catch {
104
+ fs.copyFileSync(binaryPath, target);
105
+ }
106
+
107
+ fs.chmodSync(target, 0o755);
108
+ console.log(`Cached censor binary at ${target}`);
109
+ }
110
+
111
+ try {
112
+ shieldRunningHubDiscovery();
113
+ } catch (error) {
114
+ // Best-effort: without the shield the worst case is the pre-3.0.55
115
+ // restart-while-busy behavior, never a broken install.
116
+ console.error(`postinstall: hub discovery shield skipped: ${error.message}`);
117
+ }
118
+
119
+ try {
120
+ main();
121
+ } catch (error) {
122
+ // postinstall failures should never block npm install.
123
+ // The resolver script will find the binary at runtime.
124
+ console.error(`postinstall: ${error.message}`);
125
+ process.exit(0);
126
+ }