codewhale 0.8.41

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/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # codewhale
2
+
3
+ Install and run the `codewhale` and `codewhale-tui` binaries from GitHub release artifacts.
4
+
5
+ > Previously published as `deepseek-tui`. See `docs/REBRAND.md` in the upstream
6
+ > repository for the migration notes; the legacy `deepseek-tui` npm package
7
+ > still exists as a deprecation shim for one release cycle.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install -g codewhale
13
+ # or
14
+ pnpm add -g codewhale
15
+ ```
16
+
17
+ For project-local usage:
18
+
19
+ ```bash
20
+ npm install codewhale
21
+ npx codewhale --help
22
+ ```
23
+
24
+ `postinstall` tries to download platform binaries into `bin/downloads/` and
25
+ exposes `codewhale` and `codewhale-tui` commands. If GitHub release assets are
26
+ temporarily unreachable, install continues and the wrapper retries the download
27
+ on first run.
28
+
29
+ ## First run
30
+
31
+ ```bash
32
+ codewhale login --api-key "YOUR_DEEPSEEK_API_KEY"
33
+ codewhale doctor
34
+ codewhale
35
+ ```
36
+
37
+ The `codewhale` facade and `codewhale-tui` binary share `~/.deepseek/config.toml`
38
+ for DeepSeek auth and default model settings. Common TUI commands are available
39
+ directly through the facade, including `codewhale doctor`, `codewhale models`,
40
+ `codewhale sessions`, and `codewhale resume --last`.
41
+
42
+ The app talks to DeepSeek's documented OpenAI-compatible Chat Completions API.
43
+ Set `DEEPSEEK_BASE_URL` only if you need the China endpoint or DeepSeek beta
44
+ features such as strict tool mode, chat prefix completion, or FIM completion.
45
+
46
+ NVIDIA NIM-hosted DeepSeek V4 Pro is also supported:
47
+
48
+ ```bash
49
+ codewhale auth set --provider nvidia-nim --api-key "YOUR_NVIDIA_API_KEY"
50
+ codewhale --provider nvidia-nim
51
+ ```
52
+
53
+ For a single process, set `DEEPSEEK_PROVIDER=nvidia-nim` and `NVIDIA_API_KEY`
54
+ or `NVIDIA_NIM_API_KEY` (with `DEEPSEEK_API_KEY` as a compatibility fallback).
55
+ The NIM default model is `deepseek-ai/deepseek-v4-pro` and the default base URL
56
+ is `https://integrate.api.nvidia.com/v1`. With `--provider nvidia-nim`,
57
+ `--model deepseek-v4-flash` maps to `deepseek-ai/deepseek-v4-flash`.
58
+
59
+ ## Supported platforms
60
+
61
+ Prebuilt binaries for the GitHub release are downloaded automatically:
62
+
63
+ - Linux x64
64
+ - Linux arm64 (v0.8.8+)
65
+ - macOS x64 / arm64
66
+ - Windows x64
67
+
68
+ Other platform/architecture combinations (musl, riscv64, FreeBSD, …) aren't
69
+ shipped as prebuilts. Unsupported platforms, checksum failures, and glibc
70
+ compatibility problems still fail with a clear error pointing you at
71
+ `cargo install codewhale-cli codewhale-tui --locked` and the full
72
+ [docs/INSTALL.md](https://github.com/Hmbown/CodeWhale/blob/main/docs/INSTALL.md)
73
+ build-from-source guide.
74
+
75
+ ## Configuration
76
+
77
+ - Default binary version comes from `codewhaleBinaryVersion` in `package.json`
78
+ (with `deepseekBinaryVersion` as a backward-compat fallback).
79
+ - Set `DEEPSEEK_TUI_VERSION` or `DEEPSEEK_VERSION` to override the release version.
80
+ - Set `DEEPSEEK_TUI_GITHUB_REPO` or `DEEPSEEK_GITHUB_REPO` to override the source repo (defaults to `Hmbown/CodeWhale`).
81
+ - Set `DEEPSEEK_TUI_RELEASE_BASE_URL` to use an internal or mirrored
82
+ release-asset directory when GitHub Releases is unavailable. The directory
83
+ must contain `codewhale-artifacts-sha256.txt` and the platform binaries.
84
+ - Set `DEEPSEEK_TUI_FORCE_DOWNLOAD=1` to force download even when the cached binary is already present.
85
+ - Set `DEEPSEEK_TUI_DISABLE_INSTALL=1` to skip install-time download.
86
+ - Set `DEEPSEEK_TUI_OPTIONAL_INSTALL=1` to make install-time retryable download
87
+ failures warn and exit `0` instead of failing `npm install`.
88
+
89
+ ## Release integrity
90
+
91
+ - `npm publish` runs a release-asset check to ensure all required binary assets
92
+ exist for the target GitHub release before publishing.
93
+ - Install-time downloads are verified against the release checksum manifest before
94
+ the wrapper marks them executable.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { runCodeWhaleTui } = require("../scripts/run");
4
+
5
+ runCodeWhaleTui().catch((error) => {
6
+ console.error("Failed to start codewhale-tui:", error.message);
7
+ process.exit(1);
8
+ });
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { runCodeWhale } = require("../scripts/run");
4
+
5
+ runCodeWhale().catch((error) => {
6
+ console.error("Failed to start codewhale:", error.message);
7
+ process.exit(1);
8
+ });
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "codewhale",
3
+ "version": "0.8.41",
4
+ "codewhaleBinaryVersion": "0.8.41",
5
+ "description": "Install and run the codewhale CLI dispatcher and codewhale-tui terminal UI from GitHub release artifacts.",
6
+ "author": "Hmbown",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/Hmbown/CodeWhale",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Hmbown/CodeWhale.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Hmbown/CodeWhale/issues"
15
+ },
16
+ "keywords": [
17
+ "codewhale",
18
+ "deepseek",
19
+ "cli",
20
+ "tui",
21
+ "rust",
22
+ "binary",
23
+ "terminal"
24
+ ],
25
+ "type": "commonjs",
26
+ "bin": {
27
+ "codewhale": "bin/codewhale.js",
28
+ "codewhale-tui": "bin/codewhale-tui.js"
29
+ },
30
+ "scripts": {
31
+ "release:check": "node scripts/verify-release-assets.js",
32
+ "postinstall": "node scripts/install.js --optional",
33
+ "prepublishOnly": "node scripts/verify-release-assets.js",
34
+ "prepack": "node scripts/install.js",
35
+ "test": "node --test test/*.test.js"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "preferGlobal": true,
44
+ "files": [
45
+ "bin/*.js",
46
+ "scripts/*.js",
47
+ "test/*.js",
48
+ "README.md",
49
+ "package.json"
50
+ ]
51
+ }
@@ -0,0 +1,126 @@
1
+ const path = require("path");
2
+ const os = require("os");
3
+
4
+ const CHECKSUM_MANIFEST = "codewhale-artifacts-sha256.txt";
5
+
6
+ const ASSET_MATRIX = {
7
+ linux: {
8
+ x64: ["codewhale-linux-x64", "codewhale-tui-linux-x64"],
9
+ arm64: ["codewhale-linux-arm64", "codewhale-tui-linux-arm64"],
10
+ },
11
+ darwin: {
12
+ x64: ["codewhale-macos-x64", "codewhale-tui-macos-x64"],
13
+ arm64: ["codewhale-macos-arm64", "codewhale-tui-macos-arm64"],
14
+ },
15
+ win32: {
16
+ x64: ["codewhale-windows-x64.exe", "codewhale-tui-windows-x64.exe"],
17
+ },
18
+ };
19
+
20
+ // HarmonyPC (openharmony) is an x86_64 Linux-compatible environment; map it to
21
+ // the linux binary family so npm install succeeds without a separate build target.
22
+ const PLATFORM_ALIASES = {
23
+ openharmony: "linux",
24
+ };
25
+
26
+ function detectBinaryNames() {
27
+ const rawPlatform = os.platform();
28
+ const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
29
+ const arch = os.arch();
30
+ const defaults = ASSET_MATRIX[platform];
31
+ if (!defaults) {
32
+ const supported = Object.keys(ASSET_MATRIX).map(p => `'${p}'`).join(', ');
33
+ throw new Error(
34
+ `Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.\n\n` +
35
+ unsupportedBuildHint(),
36
+ );
37
+ }
38
+ const pair = defaults[arch];
39
+ if (!pair) {
40
+ const supported = Object.keys(defaults).map(a => `'${a}'`).join(', ');
41
+ throw new Error(
42
+ `Unsupported architecture: ${arch} on platform ${platform}. ` +
43
+ `Supported architectures: ${supported}.\n\n` +
44
+ unsupportedBuildHint(),
45
+ );
46
+ }
47
+ return {
48
+ platform,
49
+ arch,
50
+ codewhale: pair[0],
51
+ tui: pair[1],
52
+ };
53
+ }
54
+
55
+ function unsupportedBuildHint() {
56
+ return [
57
+ "No prebuilt binary is available for this platform/architecture combo.",
58
+ "You can still run codewhale by building from source with Cargo:",
59
+ "",
60
+ " # Requires Rust 1.88+ (https://rustup.rs)",
61
+ " cargo install codewhale-cli --locked # provides `codewhale`",
62
+ " cargo install codewhale-tui --locked # provides `codewhale-tui`",
63
+ "",
64
+ "Or build from a checkout:",
65
+ "",
66
+ " git clone https://github.com/Hmbown/CodeWhale.git",
67
+ " cd CodeWhale",
68
+ " cargo install --path crates/cli --locked",
69
+ " cargo install --path crates/tui --locked",
70
+ "",
71
+ "See https://github.com/Hmbown/CodeWhale/blob/main/docs/INSTALL.md",
72
+ "for cross-compilation, mirror, and Linux ARM64 specifics.",
73
+ ].join("\n");
74
+ }
75
+
76
+ function executableName(base, platform) {
77
+ return platform === "win32" ? `${base}.exe` : base;
78
+ }
79
+
80
+ function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
81
+ const override =
82
+ process.env.DEEPSEEK_TUI_RELEASE_BASE_URL || process.env.DEEPSEEK_RELEASE_BASE_URL;
83
+ if (override) {
84
+ const trimmed = String(override).trim();
85
+ return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
86
+ }
87
+ return `https://github.com/${repo}/releases/download/v${version}/`;
88
+ }
89
+
90
+ function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
91
+ return new URL(baseName, releaseBaseUrl(version, repo)).toString();
92
+ }
93
+
94
+ function checksumManifestUrl(version, repo = "Hmbown/CodeWhale") {
95
+ return releaseAssetUrl(CHECKSUM_MANIFEST, version, repo);
96
+ }
97
+
98
+ function releaseBinaryDirectory() {
99
+ return path.join(__dirname, "..", "bin", "downloads");
100
+ }
101
+
102
+ function allAssetNames() {
103
+ const names = [];
104
+ for (const platformAssets of Object.values(ASSET_MATRIX)) {
105
+ for (const pair of Object.values(platformAssets)) {
106
+ names.push(pair[0], pair[1]);
107
+ }
108
+ }
109
+ return Array.from(new Set(names));
110
+ }
111
+
112
+ function allReleaseAssetNames() {
113
+ return [...allAssetNames(), CHECKSUM_MANIFEST];
114
+ }
115
+
116
+ module.exports = {
117
+ allAssetNames,
118
+ allReleaseAssetNames,
119
+ CHECKSUM_MANIFEST,
120
+ checksumManifestUrl,
121
+ detectBinaryNames,
122
+ executableName,
123
+ releaseAssetUrl,
124
+ releaseBaseUrl,
125
+ releaseBinaryDirectory,
126
+ };