@taoeffects/crush 0.70.0-taoeffect.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.md ADDED
@@ -0,0 +1,134 @@
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2025-2026 Charmbracelet, Inc.
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
111
+
112
+ ---
113
+
114
+ MIT License
115
+
116
+ Copyright (c) 2025-03-21 - 2025-05-30 Kujtim Hoxha
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ of this software and associated documentation files (the "Software"), to deal
120
+ in the Software without restriction, including without limitation the rights
121
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ copies of the Software, and to permit persons to whom the Software is
123
+ furnished to do so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in all
126
+ copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
134
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,953 @@
1
+ # Crush
2
+
3
+ <p align="center">
4
+ <a href="https://stuff.charm.sh/crush/charm-crush.png"><img width="450" alt="Charm Crush Logo" src="https://github.com/user-attachments/assets/cf8ca3ce-8b02-43f0-9d0f-5a331488da4b" /></a><br />
5
+ <a href="https://github.com/charmbracelet/crush/releases"><img src="https://img.shields.io/github/release/charmbracelet/crush" alt="Latest Release"></a>
6
+ <a href="https://github.com/charmbracelet/crush/actions"><img src="https://github.com/charmbracelet/crush/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
7
+ </p>
8
+
9
+ <p align="center">Your new coding bestie, now available in your favourite terminal.<br />Your tools, your code, and your workflows, wired into your LLM of choice.</p>
10
+ <p align="center">终端里的编程新搭档,<br />无缝接入你的工具、代码与工作流,全面兼容主流 LLM 模型。</p>
11
+
12
+ <p align="center"><img width="800" alt="Crush Demo" src="https://github.com/user-attachments/assets/58280caf-851b-470a-b6f7-d5c4ea8a1968" /></p>
13
+
14
+ ## Features
15
+
16
+ - **Multi-Model:** choose from a wide range of LLMs or add your own via OpenAI- or Anthropic-compatible APIs
17
+ - **Flexible:** switch LLMs mid-session while preserving context
18
+ - **Session-Based:** maintain multiple work sessions and contexts per project
19
+ - **LSP-Enhanced:** Crush uses LSPs for additional context, just like you do
20
+ - **Extensible:** add capabilities via MCPs (`http`, `stdio`, and `sse`)
21
+ - **Works Everywhere:** first-class support in every terminal on macOS, Linux, Windows (PowerShell and WSL), Android, FreeBSD, OpenBSD, and NetBSD
22
+ - **Industrial Grade:** built on the Charm ecosystem, powering 25k+ applications, from leading open source projects to business-critical infrastructure
23
+
24
+ ## Installation
25
+
26
+ Use a package manager:
27
+
28
+ ```bash
29
+ # Homebrew
30
+ brew install charmbracelet/tap/crush
31
+
32
+ # NPM
33
+ npm install -g @charmland/crush
34
+
35
+ # Arch Linux (btw)
36
+ yay -S crush-bin
37
+
38
+ # Nix
39
+ nix run github:numtide/nix-ai-tools#crush
40
+
41
+ # FreeBSD
42
+ pkg install crush
43
+ ```
44
+
45
+ Windows users:
46
+
47
+ ```bash
48
+ # Winget
49
+ winget install charmbracelet.crush
50
+
51
+ # Scoop
52
+ scoop bucket add charm https://github.com/charmbracelet/scoop-bucket.git
53
+ scoop install crush
54
+ ```
55
+
56
+ <details>
57
+ <summary><strong>Nix (NUR)</strong></summary>
58
+
59
+ Crush is available via the official Charm [NUR](https://github.com/nix-community/NUR) in `nur.repos.charmbracelet.crush`, which is the most up-to-date way to get Crush in Nix.
60
+
61
+ You can also try out Crush via the NUR with `nix-shell`:
62
+
63
+ ```bash
64
+ # Add the NUR channel.
65
+ nix-channel --add https://github.com/nix-community/NUR/archive/main.tar.gz nur
66
+ nix-channel --update
67
+
68
+ # Get Crush in a Nix shell.
69
+ nix-shell -p '(import <nur> { pkgs = import <nixpkgs> {}; }).repos.charmbracelet.crush'
70
+ ```
71
+
72
+ ### NixOS & Home Manager Module Usage via NUR
73
+
74
+ Crush provides NixOS and Home Manager modules via NUR.
75
+ You can use these modules directly in your flake by importing them from NUR. Since it auto detects whether its a home manager or nixos context you can use the import the exact same way :)
76
+
77
+ ```nix
78
+ {
79
+ inputs = {
80
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
81
+ nur.url = "github:nix-community/NUR";
82
+ };
83
+
84
+ outputs = { self, nixpkgs, nur, ... }: {
85
+ nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
86
+ system = "x86_64-linux";
87
+ modules = [
88
+ nur.modules.nixos.default
89
+ nur.repos.charmbracelet.modules.crush
90
+ {
91
+ programs.crush = {
92
+ enable = true;
93
+ settings = {
94
+ providers = {
95
+ openai = {
96
+ id = "openai";
97
+ name = "OpenAI";
98
+ base_url = "https://api.openai.com/v1";
99
+ type = "openai";
100
+ api_key = "sk-fake123456789abcdef...";
101
+ models = [
102
+ {
103
+ id = "gpt-4";
104
+ name = "GPT-4";
105
+ }
106
+ ];
107
+ };
108
+ };
109
+ lsp = {
110
+ go = { command = "gopls"; enabled = true; };
111
+ nix = { command = "nil"; enabled = true; };
112
+ };
113
+ options = {
114
+ context_paths = [ "/etc/nixos/configuration.nix" ];
115
+ tui = { compact_mode = true; };
116
+ debug = false;
117
+ };
118
+ };
119
+ };
120
+ }
121
+ ];
122
+ };
123
+ };
124
+ }
125
+ ```
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><strong>Debian/Ubuntu</strong></summary>
131
+
132
+ ```bash
133
+ sudo mkdir -p /etc/apt/keyrings
134
+ curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
135
+ echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
136
+ sudo apt update && sudo apt install crush
137
+ ```
138
+
139
+ </details>
140
+
141
+ <details>
142
+ <summary><strong>Fedora/RHEL</strong></summary>
143
+
144
+ ```bash
145
+ echo '[charm]
146
+ name=Charm
147
+ baseurl=https://repo.charm.sh/yum/
148
+ enabled=1
149
+ gpgcheck=1
150
+ gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
151
+ sudo yum install crush
152
+ ```
153
+
154
+ </details>
155
+
156
+ Or, download it:
157
+
158
+ - [Packages][releases] are available in Debian and RPM formats
159
+ - [Binaries][releases] are available for Linux, macOS, Windows, FreeBSD, OpenBSD, and NetBSD
160
+
161
+ [releases]: https://github.com/charmbracelet/crush/releases
162
+
163
+ Or just install it with Go:
164
+
165
+ ```
166
+ go install github.com/charmbracelet/crush@latest
167
+ ```
168
+
169
+ > [!WARNING]
170
+ > Productivity may increase when using Crush and you may find yourself nerd
171
+ > sniped when first using the application. If the symptoms persist, join the
172
+ > [Slack][slack] or [Discord][discord] and nerd snipe the rest of us.
173
+
174
+ ## Getting Started
175
+
176
+ The quickest way to get started is to grab an API key for your preferred
177
+ provider such as Anthropic, OpenAI, Groq, OpenRouter, or Vercel AI Gateway and just start
178
+ Crush. You'll be prompted to enter your API key.
179
+
180
+ That said, you can also set environment variables for preferred providers.
181
+
182
+ | Environment Variable | Provider |
183
+ | --------------------------- | -------------------------------------------------- |
184
+ | `HYPER_API_KEY` | Charm Hyper |
185
+ | `ANTHROPIC_API_KEY` | Anthropic |
186
+ | `OPENAI_API_KEY` | OpenAI |
187
+ | `VERCEL_API_KEY` | Vercel AI Gateway |
188
+ | `GEMINI_API_KEY` | Google Gemini |
189
+ | `SYNTHETIC_API_KEY` | Synthetic |
190
+ | `ZAI_API_KEY` | Z.ai |
191
+ | `MINIMAX_API_KEY` | MiniMax |
192
+ | `HF_TOKEN` | Hugging Face Inference |
193
+ | `CEREBRAS_API_KEY` | Cerebras |
194
+ | `OPENROUTER_API_KEY` | OpenRouter |
195
+ | `IONET_API_KEY` | io.net |
196
+ | `ALIBABA_SINGAPORE_API_KEY` | Alibaba (Singapore) |
197
+ | `GROQ_API_KEY` | Groq |
198
+ | `AVIAN_API_KEY` | Avian |
199
+ | `OPENCODE_API_KEY` | OpenCode Zen & Go |
200
+ | `VERTEXAI_PROJECT` | Google Cloud VertexAI (Gemini) |
201
+ | `VERTEXAI_LOCATION` | Google Cloud VertexAI (Gemini) |
202
+ | `AWS_ACCESS_KEY_ID` | Amazon Bedrock (Claude) |
203
+ | `AWS_SECRET_ACCESS_KEY` | Amazon Bedrock (Claude) |
204
+ | `AWS_REGION` | Amazon Bedrock (Claude) |
205
+ | `AWS_PROFILE` | Amazon Bedrock (Custom Profile) |
206
+ | `AWS_BEARER_TOKEN_BEDROCK` | Amazon Bedrock |
207
+ | `AZURE_OPENAI_API_ENDPOINT` | Azure OpenAI models |
208
+ | `AZURE_OPENAI_API_KEY` | Azure OpenAI models (optional when using Entra ID) |
209
+ | `AZURE_OPENAI_API_VERSION` | Azure OpenAI models |
210
+
211
+ ### Subscriptions
212
+
213
+ If you prefer subscription-based usage, here are some plans that work well in
214
+ Crush:
215
+
216
+ - [Synthetic](https://synthetic.new/pricing)
217
+ - [GLM Coding Plan](https://z.ai/subscribe)
218
+ - [Kimi Code](https://www.kimi.com/membership/pricing)
219
+ - [MiniMax Coding Plan](https://platform.minimax.io/subscribe/coding-plan)
220
+
221
+ ### By the Way
222
+
223
+ Is there a provider you’d like to see in Crush? Is there an existing model that needs an update?
224
+
225
+ Crush’s default model listing is managed in [Catwalk](https://github.com/charmbracelet/catwalk), a community-supported, open source repository of Crush-compatible models, and you’re welcome to contribute.
226
+
227
+ <a href="https://github.com/charmbracelet/catwalk"><img width="174" height="174" alt="Catwalk Badge" src="https://github.com/user-attachments/assets/95b49515-fe82-4409-b10d-5beb0873787d" /></a>
228
+
229
+ ## Configuration
230
+
231
+ > [!TIP]
232
+ > Crush ships with a builtin `crush-config` skill for configuring itself. In
233
+ > many cases you can simply ask Crush to configure itself.
234
+
235
+ Crush runs great with no configuration. That said, if you do need or want to
236
+ customize Crush, configuration can be added either local to the project itself,
237
+ or globally, with the following priority:
238
+
239
+ 1. `.crush.json`
240
+ 2. `crush.json`
241
+ 3. `$HOME/.config/crush/crush.json`
242
+
243
+ Configuration itself is stored as a JSON object:
244
+
245
+ ```json
246
+ {
247
+ "this-setting": { "this": "that" },
248
+ "that-setting": ["ceci", "cela"]
249
+ }
250
+ ```
251
+
252
+ ### Web Search
253
+
254
+ Crush uses DuckDuckGo for web searches by default. You can select Kagi from the
255
+ command menu or configure `web_search` manually with a Kagi Search API key or an
256
+ environment variable reference:
257
+
258
+ ```json
259
+ {
260
+ "tools": {
261
+ "web_search": {
262
+ "search_engine": "kagi",
263
+ "kagi_api_key": "$KAGI_API_KEY"
264
+ }
265
+ }
266
+ }
267
+ ```
268
+
269
+ As an additional note, Crush also stores ephemeral data, such as application
270
+ state, in one additional location:
271
+
272
+ ```bash
273
+ # Unix
274
+ $HOME/.local/share/crush/crush.json
275
+
276
+ # Windows
277
+ %LOCALAPPDATA%\crush\crush.json
278
+ ```
279
+
280
+ > [!TIP]
281
+ > You can override the user and data config locations by setting:
282
+ >
283
+ > - `CRUSH_GLOBAL_CONFIG`
284
+ > - `CRUSH_GLOBAL_DATA`
285
+
286
+ ### System Prompt
287
+
288
+ Crush uses its built-in coder system prompt by default. To replace it for a
289
+ project or globally, set `options.system_prompt_path` to a Markdown file:
290
+
291
+ ```json
292
+ {
293
+ "$schema": "https://charm.land/crush.json",
294
+ "options": {
295
+ "system_prompt_path": ".crush/system-prompt.md"
296
+ }
297
+ }
298
+ ```
299
+
300
+ You can also override the configured prompt for a single run with
301
+ `--sys-prompt` or `-p`:
302
+
303
+ ```bash
304
+ crush --sys-prompt /path/to/system-prompt.md
305
+ crush -p /path/to/system-prompt.md run "review this change"
306
+ ```
307
+
308
+ ### LSPs
309
+
310
+ Crush can use LSPs for additional context to help inform its decisions, just
311
+ like you would. LSPs can be added manually like so:
312
+
313
+ ```json
314
+ {
315
+ "$schema": "https://charm.land/crush.json",
316
+ "lsp": {
317
+ "go": {
318
+ "command": "gopls",
319
+ "env": {
320
+ "GOTOOLCHAIN": "go1.24.5"
321
+ }
322
+ },
323
+ "typescript": {
324
+ "command": "typescript-language-server",
325
+ "args": ["--stdio"]
326
+ },
327
+ "nix": {
328
+ "command": "nil"
329
+ }
330
+ }
331
+ }
332
+ ```
333
+
334
+ ### MCPs
335
+
336
+ Crush also supports Model Context Protocol (MCP) servers through three transport
337
+ types: `stdio` for command-line servers, `http` for HTTP endpoints, and `sse`
338
+ for Server-Sent Events.
339
+
340
+ Shell-style value expansion (`$VAR`, `${VAR:-default}`, `$(command)`, quoting,
341
+ nesting) works in `command`, `args`, `env`, `headers`, and `url`, so
342
+ file-based secrets work out of the box. You can use values like `"$TOKEN"`
343
+ or `"$(cat /path/to/secret/token)"`. Expansion runs through Crush's embedded
344
+ shell, so the same syntax works on every supported system, Windows included.
345
+
346
+ Unset variables expand to the empty string by default, matching bash. For
347
+ required credentials, use `${VAR:?message}` so an unset variable fails loudly
348
+ at load time with `message` instead of silently resolving to empty:
349
+
350
+ ```json
351
+ { "api_key": "${CODEBERG_TOKEN:?set CODEBERG_TOKEN}" }
352
+ ```
353
+
354
+ Headers (both MCP `headers` and provider `extra_headers`) whose value
355
+ resolves to the empty string are dropped from the outgoing request rather
356
+ than sent as `Header:`. That keeps optional env-gated headers like
357
+ `"OpenAI-Organization": "$OPENAI_ORG_ID"` clean when the variable is unset.
358
+
359
+ Provider `extra_body` is a non-expanding JSON passthrough; put env-driven
360
+ values in `extra_headers` or the provider's `api_key` / `base_url`, all of
361
+ which do expand.
362
+
363
+ > **Security note:** `crush.json` is trusted code. Any `$(...)` in it runs at
364
+ > load time with your shell's privileges, before the UI appears. Don't launch
365
+ > Crush in a directory whose `crush.json` you haven't reviewed.
366
+
367
+ ```json
368
+ {
369
+ "$schema": "https://charm.land/crush.json",
370
+ "mcp": {
371
+ "filesystem": {
372
+ "type": "stdio",
373
+ "command": "node",
374
+ "args": ["/path/to/mcp-server.js"],
375
+ "timeout": 120,
376
+ "disabled": false,
377
+ "disabled_tools": ["some-tool-name"],
378
+ "env": {
379
+ "NODE_ENV": "production"
380
+ }
381
+ },
382
+ "github": {
383
+ "type": "http",
384
+ "url": "https://api.githubcopilot.com/mcp/",
385
+ "timeout": 120,
386
+ "disabled": false,
387
+ "disabled_tools": ["create_issue", "create_pull_request"],
388
+ "headers": {
389
+ "Authorization": "Bearer $GH_PAT"
390
+ }
391
+ },
392
+ "streaming-service": {
393
+ "type": "sse",
394
+ "url": "https://example.com/mcp/sse",
395
+ "timeout": 120,
396
+ "disabled": false,
397
+ "headers": {
398
+ "API-Key": "$(echo $API_KEY)"
399
+ }
400
+ }
401
+ }
402
+ }
403
+ ```
404
+
405
+ ### Hooks
406
+
407
+ Crush has preliminary support for hooks. For details, see
408
+ [the hook guide](./docs/hooks/).
409
+
410
+ ### Ignoring Files
411
+
412
+ Crush respects `.gitignore` files by default, but you can also create a
413
+ `.crushignore` file to specify additional files and directories that Crush
414
+ should ignore. This is useful for excluding files that you want in version
415
+ control but don't want Crush to consider when providing context.
416
+
417
+ The `.crushignore` file uses the same syntax as `.gitignore` and can be placed
418
+ in the root of your project or in subdirectories.
419
+
420
+ ### Allowing Tools
421
+
422
+ By default, Crush will ask you for permission before running tool calls. If
423
+ you'd like, you can allow tools to be executed without prompting you for
424
+ permissions. Use this with care.
425
+
426
+ ```json
427
+ {
428
+ "$schema": "https://charm.land/crush.json",
429
+ "permissions": {
430
+ "allowed_tools": [
431
+ "view",
432
+ "ls",
433
+ "grep",
434
+ "edit",
435
+ "mcp_context7_get-library-doc"
436
+ ]
437
+ }
438
+ }
439
+ ```
440
+
441
+ You can also skip all permission prompts entirely by running Crush with the
442
+ `--yolo` flag. Be very, very careful with this feature.
443
+
444
+ ### Disabling Built-In Tools
445
+
446
+ If you'd like to prevent Crush from using certain built-in tools entirely, you
447
+ can disable them via the `options.disabled_tools` list. Disabled tools are
448
+ completely hidden from the agent.
449
+
450
+ ```json
451
+ {
452
+ "$schema": "https://charm.land/crush.json",
453
+ "options": {
454
+ "disabled_tools": ["bash", "sourcegraph"]
455
+ }
456
+ }
457
+ ```
458
+
459
+ To disable tools from MCP servers, see the [MCP config section](#mcps).
460
+
461
+ ### Disabling Skills
462
+
463
+ If you'd like to prevent Crush from using certain skills entirely, you can
464
+ disable them via the `options.disabled_skills` list. Disabled skills are hidden
465
+ from the agent, including builtin skills and skills discovered from disk.
466
+
467
+ ```json
468
+ {
469
+ "$schema": "https://charm.land/crush.json",
470
+ "options": {
471
+ "disabled_skills": ["crush-config"]
472
+ }
473
+ }
474
+ ```
475
+
476
+ ### Agent Skills
477
+
478
+ Crush supports the [Agent Skills](https://agentskills.io) open standard for
479
+ extending agent capabilities with reusable skill packages. Skills are folders
480
+ containing a `SKILL.md` file with instructions that Crush can discover and
481
+ activate on demand.
482
+
483
+ The global paths we looks for skills are:
484
+
485
+ * `$CRUSH_SKILLS_DIR`
486
+ * `$XDG_CONFIG_HOME/agents/skills` or `~/.config/agents/skills/`
487
+ * `$XDG_CONFIG_HOME/crush/skills` or `~/.config/crush/skills/`
488
+ * `~/.agents/skills/`
489
+ * `~/.claude/skills/`
490
+ * On Windows, we _also_ look at
491
+ * `%LOCALAPPDATA%\agents\skills\` or `%USERPROFILE%\AppData\Local\agents\skills\`
492
+ * `%LOCALAPPDATA%\crush\skills\` or `%USERPROFILE%\AppData\Local\crush\skills\`
493
+ * Additional paths configured via `options.skills_paths`
494
+
495
+ On top of that, we _also_ load skills in your project from the following
496
+ relative paths:
497
+
498
+ * `.agents/skills`
499
+ * `.crush/skills`
500
+ * `.claude/skills`
501
+ * `.cursor/skills`
502
+
503
+ ```jsonc
504
+ {
505
+ "$schema": "https://charm.land/crush.json",
506
+ "options": {
507
+ "skills_paths": [
508
+ "~/.config/crush/skills", // Windows: "%LOCALAPPDATA%\\crush\\skills",
509
+ "./project-skills",
510
+ ],
511
+ },
512
+ }
513
+ ```
514
+
515
+ You can get started with example skills from [anthropics/skills](https://github.com/anthropics/skills):
516
+
517
+ ```bash
518
+ # Unix
519
+ mkdir -p ~/.config/crush/skills
520
+ cd ~/.config/crush/skills
521
+ git clone https://github.com/anthropics/skills.git _temp
522
+ mv _temp/skills/* . && rm -rf _temp
523
+ ```
524
+
525
+ ```powershell
526
+ # Windows (PowerShell)
527
+ mkdir -Force "$env:LOCALAPPDATA\crush\skills"
528
+ cd "$env:LOCALAPPDATA\crush\skills"
529
+ git clone https://github.com/anthropics/skills.git _temp
530
+ mv _temp/skills/* . ; rm -r -force _temp
531
+ ```
532
+
533
+ #### User-Invocable Skills
534
+
535
+ Skills can be made invocable as commands from the commands palette (Ctrl+P). Add `user-invocable: true` to the skill's YAML frontmatter:
536
+
537
+ ```yaml
538
+ ---
539
+ name: my-skill
540
+ description: A skill that can be invoked as a command.
541
+ user-invocable: true
542
+ ---
543
+ ```
544
+
545
+ User-invocable skills appear in the commands palette with a `user:` or `project:` prefix:
546
+ - Skills from global directories show as `user:skill-name`
547
+ - Skills from project directories show as `project:skill-name`
548
+
549
+ When invoked, the skill's instructions are loaded into the conversation context.
550
+
551
+ To prevent the model from auto-triggering a skill (while still allowing user invocation), add `disable-model-invocation: true`:
552
+
553
+ ```yaml
554
+ ---
555
+ name: my-skill
556
+ description: Only invocable by users, not the model.
557
+ user-invocable: true
558
+ disable-model-invocation: true
559
+ ---
560
+ ```
561
+
562
+ Skills with `disable-model-invocation` won't appear in the model's available skills list but can still be invoked manually by users.
563
+
564
+ ### Desktop notifications
565
+
566
+ Crush sends desktop notifications when a tool call requires permission and when
567
+ the agent finishes its turn. They're only sent when the terminal window isn't
568
+ focused _and_ your terminal supports reporting the focus state.
569
+
570
+ ```jsonc
571
+ {
572
+ "$schema": "https://charm.land/crush.json",
573
+ "options": {
574
+ "disable_notifications": false, // default
575
+ },
576
+ }
577
+ ```
578
+
579
+ To disable desktop notifications, set `disable_notifications` to `true` in your
580
+ configuration. On macOS, notifications currently lack icons due to platform
581
+ limitations.
582
+
583
+ ### Initialization
584
+
585
+ When you initialize a project, Crush analyzes your codebase and creates
586
+ a context file that helps it work more effectively in future sessions.
587
+ By default, this file is named `AGENTS.md`, but you can customize the
588
+ name and location with the `initialize_as` option:
589
+
590
+ ```json
591
+ {
592
+ "$schema": "https://charm.land/crush.json",
593
+ "options": {
594
+ "initialize_as": "AGENTS.md"
595
+ }
596
+ }
597
+ ```
598
+
599
+ This is useful if you prefer a different naming convention or want to
600
+ place the file in a specific directory (e.g., `CRUSH.md` or
601
+ `docs/LLMs.md`). Crush will fill the file with project-specific context
602
+ like build commands, code patterns, and conventions it discovered during
603
+ initialization.
604
+
605
+ ### Attribution Settings
606
+
607
+ By default, Crush adds attribution information to Git commits and pull requests
608
+ it creates. You can customize this behavior with the `attribution` option:
609
+
610
+ ```json
611
+ {
612
+ "$schema": "https://charm.land/crush.json",
613
+ "options": {
614
+ "attribution": {
615
+ "trailer_style": "co-authored-by",
616
+ "generated_with": true
617
+ }
618
+ }
619
+ }
620
+ ```
621
+
622
+ - `trailer_style`: Controls the attribution trailer added to commit messages
623
+ (default: `assisted-by`)
624
+ - `assisted-by`: Adds `Assisted-by: Crush:[ModelID]` as specified in [the convention](https://docs.kernel.org/process/coding-assistants.html#attribution)
625
+ - `co-authored-by`: Adds `Co-Authored-By: Crush <crush@charm.land>`
626
+ - `none`: No attribution trailer
627
+ - `generated_with`: When true (default), adds `💘 Generated with Crush` line to
628
+ commit messages and PR descriptions
629
+
630
+ ### Custom Providers
631
+
632
+ Crush supports custom provider configurations for both OpenAI-compatible and
633
+ Anthropic-compatible APIs.
634
+
635
+ > [!NOTE]
636
+ > Note that we support two "types" for OpenAI. Make sure to choose the right one
637
+ > to ensure the best experience!
638
+ >
639
+ > - `openai` should be used when proxying or routing requests through OpenAI.
640
+ > - `openai-compat` should be used when using non-OpenAI providers that have OpenAI-compatible APIs.
641
+
642
+ #### OpenAI-Compatible APIs
643
+
644
+ Here’s an example configuration for Deepseek, which uses an OpenAI-compatible
645
+ API. Don't forget to set `DEEPSEEK_API_KEY` in your environment.
646
+
647
+ ```json
648
+ {
649
+ "$schema": "https://charm.land/crush.json",
650
+ "providers": {
651
+ "deepseek": {
652
+ "type": "openai-compat",
653
+ "base_url": "https://api.deepseek.com/v1",
654
+ "api_key": "$DEEPSEEK_API_KEY",
655
+ "models": [
656
+ {
657
+ "id": "deepseek-chat",
658
+ "name": "Deepseek V3",
659
+ "cost_per_1m_in": 0.27,
660
+ "cost_per_1m_out": 1.1,
661
+ "cost_per_1m_in_cached": 0.07,
662
+ "cost_per_1m_out_cached": 1.1,
663
+ "context_window": 64000,
664
+ "default_max_tokens": 5000
665
+ }
666
+ ]
667
+ }
668
+ }
669
+ }
670
+ ```
671
+
672
+ #### Anthropic-Compatible APIs
673
+
674
+ Custom Anthropic-compatible providers follow this format:
675
+
676
+ ```json
677
+ {
678
+ "$schema": "https://charm.land/crush.json",
679
+ "providers": {
680
+ "custom-anthropic": {
681
+ "type": "anthropic",
682
+ "base_url": "https://api.anthropic.com/v1",
683
+ "api_key": "$ANTHROPIC_API_KEY",
684
+ "extra_headers": {
685
+ "anthropic-version": "2023-06-01"
686
+ },
687
+ "models": [
688
+ {
689
+ "id": "claude-sonnet-4-20250514",
690
+ "name": "Claude Sonnet 4",
691
+ "cost_per_1m_in": 3,
692
+ "cost_per_1m_out": 15,
693
+ "cost_per_1m_in_cached": 3.75,
694
+ "cost_per_1m_out_cached": 0.3,
695
+ "context_window": 200000,
696
+ "default_max_tokens": 50000,
697
+ "can_reason": true,
698
+ "supports_attachments": true
699
+ }
700
+ ]
701
+ }
702
+ }
703
+ }
704
+ ```
705
+
706
+ ### Amazon Bedrock
707
+
708
+ Crush currently supports running Anthropic models through Bedrock, with caching disabled.
709
+
710
+ - A Bedrock provider will appear once you have AWS configured, i.e. `aws configure`
711
+ - Crush also expects the `AWS_REGION` or `AWS_DEFAULT_REGION` to be set
712
+ - To use a specific AWS profile set `AWS_PROFILE` in your environment, i.e. `AWS_PROFILE=myprofile crush`
713
+ - Alternatively to `aws configure`, you can also just set `AWS_BEARER_TOKEN_BEDROCK`
714
+
715
+ ### Vertex AI Platform
716
+
717
+ Vertex AI will appear in the list of available providers when `VERTEXAI_PROJECT` and `VERTEXAI_LOCATION` are set. You will also need to be authenticated:
718
+
719
+ ```bash
720
+ gcloud auth application-default login
721
+ ```
722
+
723
+ To add specific models to the configuration, configure as such:
724
+
725
+ ```json
726
+ {
727
+ "$schema": "https://charm.land/crush.json",
728
+ "providers": {
729
+ "vertexai": {
730
+ "models": [
731
+ {
732
+ "id": "claude-sonnet-4@20250514",
733
+ "name": "VertexAI Sonnet 4",
734
+ "cost_per_1m_in": 3,
735
+ "cost_per_1m_out": 15,
736
+ "cost_per_1m_in_cached": 3.75,
737
+ "cost_per_1m_out_cached": 0.3,
738
+ "context_window": 200000,
739
+ "default_max_tokens": 50000,
740
+ "can_reason": true,
741
+ "supports_attachments": true
742
+ }
743
+ ]
744
+ }
745
+ }
746
+ }
747
+ ```
748
+
749
+ ### Local Models
750
+
751
+ Local models can also be configured via OpenAI-compatible API. Here are two common examples:
752
+
753
+ #### Ollama
754
+
755
+ ```json
756
+ {
757
+ "providers": {
758
+ "ollama": {
759
+ "name": "Ollama",
760
+ "base_url": "http://localhost:11434/v1/",
761
+ "type": "openai-compat",
762
+ "models": [
763
+ {
764
+ "name": "Qwen 3 30B",
765
+ "id": "qwen3:30b",
766
+ "context_window": 256000,
767
+ "default_max_tokens": 20000
768
+ }
769
+ ]
770
+ }
771
+ }
772
+ }
773
+ ```
774
+
775
+ #### LM Studio
776
+
777
+ ```json
778
+ {
779
+ "providers": {
780
+ "lmstudio": {
781
+ "name": "LM Studio",
782
+ "base_url": "http://localhost:1234/v1/",
783
+ "type": "openai-compat",
784
+ "models": [
785
+ {
786
+ "name": "Qwen 3 30B",
787
+ "id": "qwen/qwen3-30b-a3b-2507",
788
+ "context_window": 256000,
789
+ "default_max_tokens": 20000
790
+ }
791
+ ]
792
+ }
793
+ }
794
+ }
795
+ ```
796
+
797
+ ## Logging
798
+
799
+ Sometimes you need to look at logs. Luckily, Crush logs all sorts of
800
+ stuff. Logs are stored in `./.crush/logs/crush.log` relative to the project.
801
+
802
+ The CLI also contains some helper commands to make perusing recent logs easier:
803
+
804
+ ```bash
805
+ # Print the last 1000 lines
806
+ crush logs
807
+
808
+ # Print the last 500 lines
809
+ crush logs --tail 500
810
+
811
+ # Follow logs in real time
812
+ crush logs --follow
813
+ ```
814
+
815
+ Want more logging? Run `crush` with the `--debug` flag, or enable it in the
816
+ config:
817
+
818
+ ```json
819
+ {
820
+ "$schema": "https://charm.land/crush.json",
821
+ "options": {
822
+ "debug": true,
823
+ "debug_lsp": true
824
+ }
825
+ }
826
+ ```
827
+
828
+ ## Provider Auto-Updates
829
+
830
+ By default, Crush automatically checks for the latest and greatest list of
831
+ providers and models from [Catwalk](https://github.com/charmbracelet/catwalk),
832
+ the open source Crush provider database. This means that when new providers and
833
+ models are available, or when model metadata changes, Crush automatically
834
+ updates your local configuration.
835
+
836
+ ### Disabling automatic provider updates
837
+
838
+ For those with restricted internet access, or those who prefer to work in
839
+ air-gapped environments, this might not be want you want, and this feature can
840
+ be disabled.
841
+
842
+ To disable automatic provider updates, set `disable_provider_auto_update` into
843
+ your `crush.json` config:
844
+
845
+ ```json
846
+ {
847
+ "$schema": "https://charm.land/crush.json",
848
+ "options": {
849
+ "disable_provider_auto_update": true
850
+ }
851
+ }
852
+ ```
853
+
854
+ Or set the `CRUSH_DISABLE_PROVIDER_AUTO_UPDATE` environment variable:
855
+
856
+ ```bash
857
+ export CRUSH_DISABLE_PROVIDER_AUTO_UPDATE=1
858
+ ```
859
+
860
+ ### Manually updating providers
861
+
862
+ Manually updating providers is possible with the `crush update-providers`
863
+ command:
864
+
865
+ ```bash
866
+ # Update providers remotely from Catwalk.
867
+ crush update-providers
868
+
869
+ # Update providers from a custom Catwalk base URL.
870
+ crush update-providers https://example.com/
871
+
872
+ # Update providers from a local file.
873
+ crush update-providers /path/to/local-providers.json
874
+
875
+ # Reset providers to the embedded version, embedded at crush at build time.
876
+ crush update-providers embedded
877
+
878
+ # For more info:
879
+ crush update-providers --help
880
+ ```
881
+
882
+ ## Metrics
883
+
884
+ Crush records pseudonymous usage metrics (tied to a device-specific hash),
885
+ which maintainers rely on to inform development and support priorities. The
886
+ metrics include solely usage metadata; prompts and responses are NEVER
887
+ collected.
888
+
889
+ Details on exactly what’s collected are in the source code ([here](https://github.com/charmbracelet/crush/tree/main/internal/event)
890
+ and [here](https://github.com/charmbracelet/crush/blob/main/internal/llm/agent/event.go)).
891
+
892
+ You can opt out of metrics collection at any time by setting the environment
893
+ variable by setting the following in your environment:
894
+
895
+ ```bash
896
+ export CRUSH_DISABLE_METRICS=1
897
+ ```
898
+
899
+ Or by setting the following in your config:
900
+
901
+ ```json
902
+ {
903
+ "options": {
904
+ "disable_metrics": true
905
+ }
906
+ }
907
+ ```
908
+
909
+ Crush also respects the [`DO_NOT_TRACK`](https://donottrack.sh/) convention
910
+ which can be enabled via `export DO_NOT_TRACK=1`.
911
+
912
+ ## Q&A
913
+
914
+ ### Why is clipboard copy and paste not working?
915
+
916
+ Installing an extra tool might be needed on Unix-like environments.
917
+
918
+ | Environment | Tool |
919
+ | ------------------- | ------------------------ |
920
+ | Windows | Native support |
921
+ | macOS | Native support |
922
+ | Linux/BSD + Wayland | `wl-copy` and `wl-paste` |
923
+ | Linux/BSD + X11 | `xclip` or `xsel` |
924
+
925
+ ## Contributing
926
+
927
+ See the [contributing guide](https://github.com/charmbracelet/crush?tab=contributing-ov-file#contributing).
928
+
929
+ ## Whatcha think?
930
+
931
+ We’d love to hear your thoughts on this project. Need help? We gotchu. You can find us on:
932
+
933
+ - [Twitter](https://twitter.com/charmcli)
934
+ - [Slack][slack]
935
+ - [Discord][discord]
936
+ - [The Fediverse](https://mastodon.social/@charmcli)
937
+ - [Bluesky](https://bsky.app/profile/charm.land)
938
+
939
+ [slack]: https://charm.land/slack
940
+ [discord]: https://charm.land/discord
941
+
942
+ ## License
943
+
944
+ [FSL-1.1-MIT](https://github.com/charmbracelet/crush/raw/main/LICENSE.md)
945
+
946
+ ---
947
+
948
+ Part of [Charm](https://charm.land).
949
+
950
+ <a href="https://charm.land/"><img alt="The Charm logo" width="400" src="https://stuff.charm.sh/charm-banner-softy.jpg" /></a>
951
+
952
+ <!--prettier-ignore-->
953
+ Charm热爱开源 • Charm loves open source
package/install.js ADDED
@@ -0,0 +1,81 @@
1
+ import { createWriteStream } from "node:fs";
2
+ import { mkdtemp, rename, stat, rm } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { Readable } from "node:stream";
6
+ import { pipeline } from "node:stream/promises";
7
+
8
+ import { ProxyAgent } from "proxy-agent";
9
+ import tar from "tar";
10
+
11
+ import {
12
+ assertSafeArchivePath,
13
+ binaryPath,
14
+ makeBinaryExecutable,
15
+ prepareVendorDir,
16
+ readPackageMetadata,
17
+ sha256File,
18
+ validateArchiveMetadata,
19
+ vendorDir,
20
+ } from "./lib.js";
21
+
22
+ async function downloadArchive(url, destination) {
23
+ const response = await fetch(url, {
24
+ agent: new ProxyAgent(),
25
+ redirect: "follow",
26
+ });
27
+
28
+ if (!response.ok) {
29
+ throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
30
+ }
31
+ if (!response.body) {
32
+ throw new Error(`Failed to download ${url}: response body is empty`);
33
+ }
34
+
35
+ await pipeline(Readable.fromWeb(response.body), createWriteStream(destination, { mode: 0o600 }));
36
+ }
37
+
38
+ async function extractBinary(archivePath, archive) {
39
+ await tar.x({
40
+ cwd: vendorDir,
41
+ file: archivePath,
42
+ filter(path, entry) {
43
+ assertSafeArchivePath(path, archive);
44
+ return path === `${archive.wrappedIn}/${archive.bin}` && entry.type === "File";
45
+ },
46
+ strip: 1,
47
+ });
48
+
49
+ await rename(join(vendorDir, archive.bin), binaryPath);
50
+ await makeBinaryExecutable();
51
+ }
52
+
53
+ async function install() {
54
+ const { archive, key } = await readPackageMetadata();
55
+ validateArchiveMetadata(archive);
56
+
57
+ const tempDir = await mkdtemp(join(tmpdir(), "crush-npm-"));
58
+ const archivePath = join(tempDir, archive.name);
59
+
60
+ try {
61
+ console.log(`Downloading Crush for ${key}...`);
62
+ await downloadArchive(archive.url, archivePath);
63
+
64
+ const digest = await sha256File(archivePath);
65
+ if (digest.toLowerCase() !== archive.checksum.digest.toLowerCase()) {
66
+ throw new Error(`Checksum mismatch for ${archive.name}: expected ${archive.checksum.digest}, got ${digest}`);
67
+ }
68
+
69
+ await prepareVendorDir();
70
+ await extractBinary(archivePath, archive);
71
+ await stat(binaryPath);
72
+ console.log(`Installed Crush to ${binaryPath}`);
73
+ } finally {
74
+ await rm(tempDir, { force: true, recursive: true });
75
+ }
76
+ }
77
+
78
+ install().catch((error) => {
79
+ console.error(`Failed to install Crush: ${error.message}`);
80
+ process.exit(1);
81
+ });
package/lib.js ADDED
@@ -0,0 +1,84 @@
1
+ import { createHash } from "node:crypto";
2
+ import { createReadStream } from "node:fs";
3
+ import { chmod, mkdir, readFile, rm } from "node:fs/promises";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+
7
+ export const packageRoot = dirname(fileURLToPath(import.meta.url));
8
+ export const vendorDir = join(packageRoot, "vendor", "crush");
9
+ export const binaryName = process.platform === "win32" ? "crush.exe" : "crush";
10
+ export const binaryPath = join(vendorDir, binaryName);
11
+
12
+ const platformKeys = new Map([
13
+ ["linux:x64", "linux-x64"],
14
+ ["linux:arm64", "linux-arm64"],
15
+ ["darwin:x64", "darwin-x64"],
16
+ ["darwin:arm64", "darwin-arm64"],
17
+ ]);
18
+
19
+ export function platformKey(platform = process.platform, arch = process.arch) {
20
+ const key = platformKeys.get(`${platform}:${arch}`);
21
+ if (!key) {
22
+ throw new Error(`Unsupported platform: ${platform}/${arch}`);
23
+ }
24
+ return key;
25
+ }
26
+
27
+ export async function readPackageMetadata() {
28
+ const packageJSON = JSON.parse(await readFile(join(packageRoot, "package.json"), "utf8"));
29
+ const key = platformKey();
30
+ const archive = packageJSON.crush?.archives?.[key];
31
+ if (!archive) {
32
+ throw new Error(`No Crush archive metadata for platform ${key}`);
33
+ }
34
+ return { archive, key, packageJSON };
35
+ }
36
+
37
+ export async function prepareVendorDir() {
38
+ await rm(vendorDir, { force: true, recursive: true });
39
+ await mkdir(vendorDir, { recursive: true });
40
+ }
41
+
42
+ export async function makeBinaryExecutable(path = binaryPath) {
43
+ if (process.platform !== "win32") {
44
+ await chmod(path, 0o755);
45
+ }
46
+ }
47
+
48
+ export function validateArchiveMetadata(archive) {
49
+ if (!archive || typeof archive !== "object") {
50
+ throw new Error("Missing archive metadata");
51
+ }
52
+ for (const field of ["name", "url", "wrappedIn", "bin"]) {
53
+ if (typeof archive[field] !== "string" || archive[field] === "") {
54
+ throw new Error(`Archive metadata is missing ${field}`);
55
+ }
56
+ }
57
+ if (archive.checksum?.algorithm !== "sha256") {
58
+ throw new Error("Archive checksum algorithm must be sha256");
59
+ }
60
+ if (typeof archive.checksum.digest !== "string" || !/^[a-f0-9]{64}$/i.test(archive.checksum.digest)) {
61
+ throw new Error("Archive checksum digest must be a SHA-256 hex string");
62
+ }
63
+ }
64
+
65
+ export async function sha256File(path) {
66
+ const hash = createHash("sha256");
67
+ await new Promise((resolve, reject) => {
68
+ createReadStream(path)
69
+ .on("error", reject)
70
+ .on("data", (chunk) => hash.update(chunk))
71
+ .on("end", resolve);
72
+ });
73
+ return hash.digest("hex");
74
+ }
75
+
76
+ export function assertSafeArchivePath(path, archive) {
77
+ const expectedPath = `${archive.wrappedIn}/${archive.bin}`;
78
+ if (path === expectedPath) {
79
+ return;
80
+ }
81
+ if (path.startsWith("/") || path.includes("..")) {
82
+ throw new Error(`Unsafe archive entry path: ${path}`);
83
+ }
84
+ }
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@taoeffects/crush",
3
+ "type": "module",
4
+ "version": "0.70.0-taoeffect.1",
5
+ "description": "A terminal-based AI coding assistant forked from Charm Crush.",
6
+ "scripts": {
7
+ "postinstall": "node install.js",
8
+ "run": "node run-crush.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/taoeffect/crush.git"
13
+ },
14
+ "license": "FSL-1.1-MIT",
15
+ "bugs": {
16
+ "url": "https://github.com/taoeffect/crush/issues"
17
+ },
18
+ "bin": {
19
+ "crush": "run-crush.js"
20
+ },
21
+ "dependencies": {
22
+ "proxy-agent": "8.0.1",
23
+ "tar": "7.5.13"
24
+ },
25
+ "files": [
26
+ "install.js",
27
+ "run-crush.js",
28
+ "lib.js",
29
+ "README.md",
30
+ "LICENSE.md"
31
+ ],
32
+ "crush": {
33
+ "repo": "taoeffect/crush",
34
+ "archives": {
35
+ "linux-x64": {
36
+ "name": "crush_0.70.0-taoeffect.1_Linux_x86_64.tar.gz",
37
+ "url": "https://github.com/taoeffect/crush/releases/download/v0.70.0-taoeffect.1/crush_0.70.0-taoeffect.1_Linux_x86_64.tar.gz",
38
+ "checksum": {
39
+ "algorithm": "sha256",
40
+ "digest": "5cc75b9628166c0247a77d5213887598039e32c2a0daebbb09ce473ad5515d9f"
41
+ },
42
+ "wrappedIn": "crush_0.70.0-taoeffect.1_Linux_x86_64",
43
+ "bin": "crush"
44
+ },
45
+ "linux-arm64": {
46
+ "name": "crush_0.70.0-taoeffect.1_Linux_arm64.tar.gz",
47
+ "url": "https://github.com/taoeffect/crush/releases/download/v0.70.0-taoeffect.1/crush_0.70.0-taoeffect.1_Linux_arm64.tar.gz",
48
+ "checksum": {
49
+ "algorithm": "sha256",
50
+ "digest": "4db393c3b07f03e117ce09d3a36ccfd2951e1600f15363a632b008e59b3114ae"
51
+ },
52
+ "wrappedIn": "crush_0.70.0-taoeffect.1_Linux_arm64",
53
+ "bin": "crush"
54
+ },
55
+ "darwin-x64": {
56
+ "name": "crush_0.70.0-taoeffect.1_Darwin_x86_64.tar.gz",
57
+ "url": "https://github.com/taoeffect/crush/releases/download/v0.70.0-taoeffect.1/crush_0.70.0-taoeffect.1_Darwin_x86_64.tar.gz",
58
+ "checksum": {
59
+ "algorithm": "sha256",
60
+ "digest": "c63b4689d7b509335daf6ed80f542f0d342afaa21c0303ed766d1625fc31c717"
61
+ },
62
+ "wrappedIn": "crush_0.70.0-taoeffect.1_Darwin_x86_64",
63
+ "bin": "crush"
64
+ },
65
+ "darwin-arm64": {
66
+ "name": "crush_0.70.0-taoeffect.1_Darwin_arm64.tar.gz",
67
+ "url": "https://github.com/taoeffect/crush/releases/download/v0.70.0-taoeffect.1/crush_0.70.0-taoeffect.1_Darwin_arm64.tar.gz",
68
+ "checksum": {
69
+ "algorithm": "sha256",
70
+ "digest": "93690d7e33900fcf99278ce09531d87aa81cec8e577922a823c17c00d3a409d6"
71
+ },
72
+ "wrappedIn": "crush_0.70.0-taoeffect.1_Darwin_arm64",
73
+ "bin": "crush"
74
+ }
75
+ }
76
+ }
77
+ }
package/run-crush.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "node:child_process";
3
+ import { stat } from "node:fs/promises";
4
+
5
+ import { binaryPath } from "./lib.js";
6
+
7
+ async function run() {
8
+ try {
9
+ await stat(binaryPath);
10
+ } catch {
11
+ console.error(`Crush binary is not installed at ${binaryPath}. Try reinstalling @taoeffects/crush.`);
12
+ process.exit(1);
13
+ }
14
+
15
+ const child = spawn(binaryPath, process.argv.slice(2), {
16
+ stdio: "inherit",
17
+ });
18
+
19
+ child.on("error", (error) => {
20
+ console.error(`Failed to run Crush: ${error.message}`);
21
+ process.exit(1);
22
+ });
23
+
24
+ child.on("exit", (code, signal) => {
25
+ if (signal) {
26
+ process.kill(process.pid, signal);
27
+ return;
28
+ }
29
+ process.exit(code ?? 0);
30
+ });
31
+ }
32
+
33
+ run().catch((error) => {
34
+ console.error(`Failed to run Crush: ${error.message}`);
35
+ process.exit(1);
36
+ });