@akiojin/gwt 6.30.3 → 9.0.2
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/.cargo/config.toml +2 -0
- package/.claude-plugin/marketplace.json +18 -0
- package/.coderabbit.yaml +8 -0
- package/.codex/skills/gwt-fix-issue/scripts/inspect_issue.py +833 -0
- package/.dockerignore +63 -0
- package/.gitattributes +27 -0
- package/.husky/commit-msg +2 -0
- package/.husky/pre-commit +9 -0
- package/.husky/pre-push +12 -0
- package/.markdownlint.json +18 -0
- package/.markdownlintignore +2 -0
- package/Dockerfile +58 -0
- package/README.ja.md +161 -484
- package/README.md +164 -444
- package/cliff.toml +56 -0
- package/clippy.toml +2 -0
- package/cmake/ci-disable-native.cmake +16 -0
- package/codecov.yml +16 -0
- package/commitlint.config.cjs +107 -0
- package/deny.toml +35 -0
- package/docker-compose.yml +59 -0
- package/messages/errors.toml +52 -0
- package/package.json +12 -22
- package/rustfmt.toml +8 -0
- package/scripts/check-e2e-coverage-threshold.mjs +238 -0
- package/scripts/entrypoint.sh +36 -25
- package/scripts/install-linux-deps.sh +46 -0
- package/scripts/postinstall.js +73 -229
- package/scripts/release_issue_refs.py +317 -0
- package/scripts/run-local-backend-tests-on-commit.sh +15 -0
- package/scripts/run-local-e2e-coverage-on-commit.sh +69 -0
- package/scripts/run-local-e2e-on-commit.sh +60 -0
- package/scripts/test-all.sh +13 -0
- package/scripts/test_release_issue_refs.py +257 -0
- package/scripts/validate-skill-frontmatter.sh +108 -0
- package/scripts/verify-ci-node-toolchain.sh +76 -0
- package/scripts/verify-husky-hooks.sh +6 -0
- package/scripts/voice-eval.sh +48 -0
- package/tests/voice_eval/README.md +53 -0
- package/tests/voice_eval/manifest.template.json +55 -0
- package/tests/voice_eval/samples/.gitkeep +1 -0
- package/tests/voice_eval/script-ja.txt +10 -0
- package/vendor/ratatui-core/src/backend/test.rs +1077 -0
- package/vendor/ratatui-core/src/backend.rs +405 -0
- package/vendor/ratatui-core/src/buffer/assert.rs +71 -0
- package/vendor/ratatui-core/src/buffer/buffer.rs +1388 -0
- package/vendor/ratatui-core/src/buffer/cell.rs +377 -0
- package/vendor/ratatui-core/src/buffer.rs +9 -0
- package/vendor/ratatui-core/src/layout/alignment.rs +89 -0
- package/vendor/ratatui-core/src/layout/constraint.rs +526 -0
- package/vendor/ratatui-core/src/layout/direction.rs +63 -0
- package/vendor/ratatui-core/src/layout/flex.rs +212 -0
- package/vendor/ratatui-core/src/layout/layout.rs +2838 -0
- package/vendor/ratatui-core/src/layout/margin.rs +79 -0
- package/vendor/ratatui-core/src/layout/offset.rs +66 -0
- package/vendor/ratatui-core/src/layout/position.rs +253 -0
- package/vendor/ratatui-core/src/layout/rect/iter.rs +356 -0
- package/vendor/ratatui-core/src/layout/rect/ops.rs +136 -0
- package/vendor/ratatui-core/src/layout/rect.rs +1114 -0
- package/vendor/ratatui-core/src/layout/size.rs +147 -0
- package/vendor/ratatui-core/src/layout.rs +333 -0
- package/vendor/ratatui-core/src/lib.rs +82 -0
- package/vendor/ratatui-core/src/style/anstyle.rs +348 -0
- package/vendor/ratatui-core/src/style/color.rs +788 -0
- package/vendor/ratatui-core/src/style/palette/material.rs +608 -0
- package/vendor/ratatui-core/src/style/palette/tailwind.rs +653 -0
- package/vendor/ratatui-core/src/style/palette.rs +6 -0
- package/vendor/ratatui-core/src/style/palette_conversion.rs +82 -0
- package/vendor/ratatui-core/src/style/stylize.rs +668 -0
- package/vendor/ratatui-core/src/style.rs +1069 -0
- package/vendor/ratatui-core/src/symbols/bar.rs +51 -0
- package/vendor/ratatui-core/src/symbols/block.rs +51 -0
- package/vendor/ratatui-core/src/symbols/border.rs +709 -0
- package/vendor/ratatui-core/src/symbols/braille.rs +21 -0
- package/vendor/ratatui-core/src/symbols/half_block.rs +3 -0
- package/vendor/ratatui-core/src/symbols/line.rs +259 -0
- package/vendor/ratatui-core/src/symbols/marker.rs +82 -0
- package/vendor/ratatui-core/src/symbols/merge.rs +748 -0
- package/vendor/ratatui-core/src/symbols/pixel.rs +30 -0
- package/vendor/ratatui-core/src/symbols/scrollbar.rs +46 -0
- package/vendor/ratatui-core/src/symbols/shade.rs +5 -0
- package/vendor/ratatui-core/src/symbols.rs +15 -0
- package/vendor/ratatui-core/src/terminal/frame.rs +192 -0
- package/vendor/ratatui-core/src/terminal/terminal.rs +926 -0
- package/vendor/ratatui-core/src/terminal/viewport.rs +58 -0
- package/vendor/ratatui-core/src/terminal.rs +40 -0
- package/vendor/ratatui-core/src/text/grapheme.rs +84 -0
- package/vendor/ratatui-core/src/text/line.rs +1678 -0
- package/vendor/ratatui-core/src/text/masked.rs +149 -0
- package/vendor/ratatui-core/src/text/span.rs +904 -0
- package/vendor/ratatui-core/src/text/text.rs +1434 -0
- package/vendor/ratatui-core/src/text.rs +64 -0
- package/vendor/ratatui-core/src/widgets/stateful_widget.rs +193 -0
- package/vendor/ratatui-core/src/widgets/widget.rs +174 -0
- package/vendor/ratatui-core/src/widgets.rs +9 -0
- package/bin/gwt.js +0 -131
- package/scripts/postinstall.test.js +0 -71
- package/scripts/release-download.js +0 -66
package/scripts/entrypoint.sh
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
+
|
|
2
3
|
set -euo pipefail
|
|
3
4
|
|
|
4
5
|
# Git設定(node:22-bookwormにはGitが含まれている)
|
|
@@ -8,49 +9,59 @@ git -C / config --global --add safe.directory /gwt
|
|
|
8
9
|
|
|
9
10
|
# ユーザー名とメールの設定(環境変数から)
|
|
10
11
|
if [ -n "${GITHUB_USERNAME:-}" ]; then
|
|
11
|
-
|
|
12
|
+
git -C / config --global user.name "$GITHUB_USERNAME"
|
|
12
13
|
fi
|
|
13
14
|
|
|
14
15
|
if [ -n "${GIT_USER_EMAIL:-}" ]; then
|
|
15
|
-
|
|
16
|
+
git -C / config --global user.email "$GIT_USER_EMAIL"
|
|
16
17
|
fi
|
|
17
18
|
|
|
18
19
|
# Git認証ファイルを環境変数から作成
|
|
19
20
|
if [ -n "${GITHUB_USERNAME:-}" ] && [ -n "${GITHUB_PERSONAL_ACCESS_TOKEN:-}" ]; then
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
printf '%s\n' "https://${GITHUB_USERNAME}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com" > /root/.git-credentials
|
|
22
|
+
chmod 600 /root/.git-credentials
|
|
23
|
+
git -C / config --global credential.helper store
|
|
23
24
|
fi
|
|
24
25
|
|
|
25
26
|
# GitHub CLIの認証(GITHUB_TOKENが設定されている場合)
|
|
26
27
|
if [ -n "${GITHUB_TOKEN:-}" ] && command -v gh &> /dev/null; then
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
if echo "$GITHUB_TOKEN" | gh auth login --with-token; then
|
|
29
|
+
echo "✅ GitHub CLI authenticated"
|
|
30
|
+
else
|
|
31
|
+
echo "⚠️ GitHub CLI authentication failed (non-fatal)" >&2
|
|
32
|
+
fi
|
|
32
33
|
fi
|
|
33
34
|
|
|
34
35
|
# .codexディレクトリのセットアップ
|
|
35
36
|
# auth.jsonをホストと同期(クロスプラットフォーム対応)
|
|
36
37
|
mkdir -p /root/.codex
|
|
37
38
|
if [ -f /root/.codex-host/auth.json ]; then
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
# auth.jsonが誤ってディレクトリとして作成されている場合は削除
|
|
40
|
+
if [ -d /root/.codex/auth.json ]; then
|
|
41
|
+
echo "⚠️ Removing incorrectly created auth.json directory"
|
|
42
|
+
rm -rf /root/.codex/auth.json
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# ホストのauth.jsonが存在しない、または空、またはホスト側が新しい場合はコピー
|
|
46
|
+
if [ ! -f /root/.codex/auth.json ] || [ ! -s /root/.codex/auth.json ] || [ /root/.codex-host/auth.json -nt /root/.codex/auth.json ]; then
|
|
47
|
+
cp /root/.codex-host/auth.json /root/.codex/auth.json
|
|
48
|
+
chmod 600 /root/.codex/auth.json
|
|
49
|
+
echo "✅ Codex auth.json synced from host"
|
|
50
|
+
else
|
|
51
|
+
echo "✅ Codex auth.json is up to date"
|
|
52
|
+
fi
|
|
53
|
+
else
|
|
54
|
+
echo "ℹ️ INFO: Codex auth.json not found on host (optional)"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# .claudeディレクトリのセットアップ
|
|
58
|
+
# 認証・設定をホストと同期(クロスプラットフォーム対応)
|
|
59
|
+
mkdir -p /root/.claude
|
|
60
|
+
if [ -d /root/.claude-host ] && [ -n "$(find /root/.claude-host -mindepth 1 -maxdepth 1 2>/dev/null)" ]; then
|
|
61
|
+
cp -R /root/.claude-host/. /root/.claude/
|
|
62
|
+
echo "✅ Claude config synced from host"
|
|
52
63
|
else
|
|
53
|
-
|
|
64
|
+
echo "ℹ️ INFO: Claude config not found on host (optional)"
|
|
54
65
|
fi
|
|
55
66
|
|
|
56
67
|
echo "🚀 Docker development environment is ready!"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
run_as_root() {
|
|
5
|
+
if [[ "$(id -u)" -eq 0 ]]; then
|
|
6
|
+
"$@"
|
|
7
|
+
elif command -v sudo >/dev/null 2>&1; then
|
|
8
|
+
sudo "$@"
|
|
9
|
+
else
|
|
10
|
+
echo "error: sudo is required when not running as root" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
install_args=(-y)
|
|
16
|
+
if [[ "${NO_INSTALL_RECOMMENDS:-0}" == "1" ]]; then
|
|
17
|
+
install_args+=(--no-install-recommends)
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [[ "${SKIP_APT_UPDATE:-0}" != "1" ]]; then
|
|
21
|
+
run_as_root apt-get update
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
appindicator_pkg=""
|
|
25
|
+
if apt-cache show libappindicator3-dev >/dev/null 2>&1; then
|
|
26
|
+
appindicator_pkg="libappindicator3-dev"
|
|
27
|
+
elif apt-cache show libayatana-appindicator3-dev >/dev/null 2>&1; then
|
|
28
|
+
appindicator_pkg="libayatana-appindicator3-dev"
|
|
29
|
+
else
|
|
30
|
+
echo "error: neither libappindicator3-dev nor libayatana-appindicator3-dev is available" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
packages=(
|
|
35
|
+
libwebkit2gtk-4.1-dev
|
|
36
|
+
"${appindicator_pkg}"
|
|
37
|
+
librsvg2-dev
|
|
38
|
+
patchelf
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
run_as_root apt-get install "${install_args[@]}" "${packages[@]}"
|
|
42
|
+
|
|
43
|
+
if [[ "${CLEAN_APT_CACHE:-0}" == "1" ]]; then
|
|
44
|
+
run_as_root apt-get clean
|
|
45
|
+
run_as_root rm -rf /var/lib/apt/lists/*
|
|
46
|
+
fi
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,261 +1,105 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* Postinstall script to download the appropriate gwt binary
|
|
4
|
-
* for the current platform from GitHub Releases.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
createWriteStream,
|
|
9
|
-
existsSync,
|
|
10
|
-
mkdirSync,
|
|
11
|
-
chmodSync,
|
|
12
|
-
unlinkSync,
|
|
13
|
-
} from 'fs';
|
|
14
|
-
import { dirname, join } from 'path';
|
|
15
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
16
|
-
import { get } from 'https';
|
|
17
|
-
import {
|
|
18
|
-
REPO,
|
|
19
|
-
buildReleaseDownloadUrl,
|
|
20
|
-
getPackageVersion,
|
|
21
|
-
getPlatformArtifact,
|
|
22
|
-
getSupportedPlatformKeys,
|
|
23
|
-
} from './release-download.js';
|
|
24
|
-
|
|
25
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
-
const __dirname = dirname(__filename);
|
|
27
|
-
|
|
28
|
-
const BIN_DIR = join(__dirname, '..', 'bin');
|
|
29
|
-
const BIN_NAME = process.platform === 'win32' ? 'gwt.exe' : 'gwt';
|
|
30
|
-
const BIN_PATH = join(BIN_DIR, BIN_NAME);
|
|
31
|
-
|
|
32
|
-
const RETRY_CONFIG = {
|
|
33
|
-
maxAttempts: 5,
|
|
34
|
-
initialDelayMs: 500,
|
|
35
|
-
backoffFactor: 2,
|
|
36
|
-
maxDelayMs: 5000,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const MAX_REDIRECTS = 5;
|
|
40
|
-
|
|
41
|
-
function requirePlatformArtifact() {
|
|
42
|
-
const artifact = getPlatformArtifact();
|
|
43
|
-
if (!artifact) {
|
|
44
|
-
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
45
|
-
console.error(`Supported platforms: ${getSupportedPlatformKeys().join(', ')}`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
return artifact;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function getRetryDelayMs(attempt, config = RETRY_CONFIG) {
|
|
52
|
-
const delay = config.initialDelayMs * Math.pow(config.backoffFactor, Math.max(0, attempt - 1));
|
|
53
|
-
return Math.min(delay, config.maxDelayMs);
|
|
54
|
-
}
|
|
2
|
+
"use strict";
|
|
55
3
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function isRetryableError(error) {
|
|
61
|
-
if (error && typeof error.statusCode === 'number') {
|
|
62
|
-
return isRetryableStatus(error.statusCode);
|
|
63
|
-
}
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
66
8
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
: null;
|
|
71
|
-
return {
|
|
72
|
-
versionedUrl,
|
|
73
|
-
releasePageUrl: `https://github.com/${REPO}/releases`,
|
|
74
|
-
buildCommand: 'cargo build --release',
|
|
75
|
-
};
|
|
76
|
-
}
|
|
9
|
+
const REPO = "akiojin/gwt";
|
|
10
|
+
const BIN_DIR = path.join(__dirname, "..", "bin");
|
|
11
|
+
const BINARY_NAME = os.platform() === "win32" ? "gwt-tui.exe" : "gwt-tui";
|
|
77
12
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
86
|
-
},
|
|
87
|
-
};
|
|
13
|
+
/**
|
|
14
|
+
* Detect the GitHub Release asset name for the current platform/arch.
|
|
15
|
+
* Matches the naming convention: gwt-{os}-{arch}[.exe]
|
|
16
|
+
*/
|
|
17
|
+
function releaseAssetName() {
|
|
18
|
+
const platform = os.platform();
|
|
19
|
+
const arch = os.arch();
|
|
88
20
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
resolve(null);
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
const release = JSON.parse(data);
|
|
99
|
-
const asset = release.assets?.find((entry) => entry.name === artifact);
|
|
100
|
-
resolve(asset?.browser_download_url ?? null);
|
|
101
|
-
} catch {
|
|
102
|
-
resolve(null);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
21
|
+
if (platform === "darwin" && arch === "arm64") return "gwt-macos-aarch64";
|
|
22
|
+
if (platform === "darwin" && arch === "x64") return "gwt-macos-x86_64";
|
|
23
|
+
if (platform === "linux" && arch === "x64") return "gwt-linux-x86_64";
|
|
24
|
+
if (platform === "linux" && arch === "arm64") return "gwt-linux-aarch64";
|
|
25
|
+
if (platform === "win32" && arch === "x64") return "gwt-windows-x86_64.exe";
|
|
106
26
|
|
|
107
|
-
|
|
108
|
-
});
|
|
27
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
109
28
|
}
|
|
110
29
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Read the target version from package.json.
|
|
32
|
+
*/
|
|
33
|
+
function readVersion() {
|
|
34
|
+
const pkg = path.join(__dirname, "..", "package.json");
|
|
35
|
+
const data = JSON.parse(fs.readFileSync(pkg, "utf8"));
|
|
36
|
+
return data.version;
|
|
114
37
|
}
|
|
115
38
|
|
|
116
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Follow redirects and download a URL to a local path.
|
|
41
|
+
*/
|
|
42
|
+
function download(url, dest) {
|
|
117
43
|
return new Promise((resolve, reject) => {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
res.resume();
|
|
125
|
-
if (!location) {
|
|
126
|
-
const error = new Error(`Redirect without location (HTTP ${statusCode})`);
|
|
127
|
-
error.statusCode = statusCode;
|
|
128
|
-
reject(error);
|
|
44
|
+
const file = fs.createWriteStream(dest);
|
|
45
|
+
const request = (u) => {
|
|
46
|
+
https
|
|
47
|
+
.get(u, { headers: { "User-Agent": "gwt-postinstall" } }, (res) => {
|
|
48
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
49
|
+
request(res.headers.location);
|
|
129
50
|
return;
|
|
130
51
|
}
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
reject(
|
|
52
|
+
if (res.statusCode !== 200) {
|
|
53
|
+
file.close();
|
|
54
|
+
fs.unlink(dest, () => {});
|
|
55
|
+
reject(new Error(`Download failed: HTTP ${res.statusCode} for ${u}`));
|
|
135
56
|
return;
|
|
136
57
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (statusCode !== 200) {
|
|
143
|
-
res.resume();
|
|
144
|
-
const error = new Error(`Failed to download: HTTP ${statusCode}`);
|
|
145
|
-
error.statusCode = statusCode;
|
|
146
|
-
reject(error);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const file = createWriteStream(dest);
|
|
151
|
-
res.pipe(file);
|
|
152
|
-
|
|
153
|
-
const cleanup = (err) => {
|
|
154
|
-
file.close(() => {
|
|
155
|
-
if (existsSync(dest)) unlinkSync(dest);
|
|
156
|
-
reject(err);
|
|
58
|
+
res.pipe(file);
|
|
59
|
+
file.on("finish", () => {
|
|
60
|
+
file.close(resolve);
|
|
157
61
|
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
req.on('error', (err) => {
|
|
166
|
-
if (existsSync(dest)) unlinkSync(dest);
|
|
167
|
-
reject(err);
|
|
168
|
-
});
|
|
62
|
+
})
|
|
63
|
+
.on("error", (err) => {
|
|
64
|
+
file.close();
|
|
65
|
+
fs.unlink(dest, () => {});
|
|
66
|
+
reject(err);
|
|
67
|
+
});
|
|
169
68
|
};
|
|
170
|
-
|
|
171
|
-
request(url, 0);
|
|
69
|
+
request(url);
|
|
172
70
|
});
|
|
173
71
|
}
|
|
174
72
|
|
|
175
|
-
async function downloadWithRetry(url, dest, config = RETRY_CONFIG) {
|
|
176
|
-
let attempt = 0;
|
|
177
|
-
|
|
178
|
-
while (attempt < config.maxAttempts) {
|
|
179
|
-
attempt += 1;
|
|
180
|
-
try {
|
|
181
|
-
await downloadFile(url, dest);
|
|
182
|
-
return;
|
|
183
|
-
} catch (error) {
|
|
184
|
-
if (!isRetryableError(error) || attempt >= config.maxAttempts) {
|
|
185
|
-
throw error;
|
|
186
|
-
}
|
|
187
|
-
const delayMs = getRetryDelayMs(attempt, config);
|
|
188
|
-
console.log(`Retrying download in ${delayMs}ms (attempt ${attempt}/${config.maxAttempts})...`);
|
|
189
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
73
|
async function main() {
|
|
195
|
-
// Skip in CI
|
|
196
|
-
if (process.env.CI
|
|
197
|
-
console.log(
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Skip if binary already exists (e.g., local development)
|
|
202
|
-
if (existsSync(BIN_PATH)) {
|
|
203
|
-
console.log('Binary already exists, skipping download');
|
|
74
|
+
// Skip in CI or when running from source
|
|
75
|
+
if (process.env.CI) {
|
|
76
|
+
console.log("gwt: skipping binary download in CI");
|
|
204
77
|
return;
|
|
205
78
|
}
|
|
206
79
|
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
try {
|
|
212
|
-
version = getPackageVersion();
|
|
213
|
-
const url = await getDownloadUrl(version, artifact);
|
|
214
|
-
console.log(`Downloading from: ${url}`);
|
|
80
|
+
const version = readVersion();
|
|
81
|
+
const asset = releaseAssetName();
|
|
82
|
+
const tag = `v${version}`;
|
|
83
|
+
const binaryUrl = `https://github.com/${REPO}/releases/download/${tag}/${asset}`;
|
|
215
84
|
|
|
216
|
-
|
|
217
|
-
mkdirSync(BIN_DIR, { recursive: true });
|
|
218
|
-
}
|
|
85
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
219
86
|
|
|
220
|
-
|
|
87
|
+
const dest = path.join(BIN_DIR, BINARY_NAME);
|
|
221
88
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
chmodSync(BIN_PATH, 0o755);
|
|
225
|
-
}
|
|
89
|
+
console.log(`Downloading gwt binary for ${os.platform()}-${os.arch()}...`);
|
|
90
|
+
console.log(`Downloading from: ${binaryUrl}`);
|
|
226
91
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
console.error('');
|
|
232
|
-
console.error('You can manually download the binary from:');
|
|
233
|
-
if (guidance.versionedUrl) {
|
|
234
|
-
console.error(guidance.versionedUrl);
|
|
92
|
+
try {
|
|
93
|
+
await download(binaryUrl, dest);
|
|
94
|
+
if (os.platform() !== "win32") {
|
|
95
|
+
fs.chmodSync(dest, 0o755);
|
|
235
96
|
}
|
|
236
|
-
console.
|
|
237
|
-
|
|
238
|
-
console.error(`
|
|
239
|
-
|
|
97
|
+
console.log(`gwt binary installed successfully!`);
|
|
98
|
+
} catch (err) {
|
|
99
|
+
console.error(`gwt: failed to download binary - ${err.message}`);
|
|
100
|
+
console.error("gwt: you can build from source with: cargo build --release -p gwt-tui");
|
|
101
|
+
process.exitCode = 0; // non-fatal so npm install does not fail
|
|
240
102
|
}
|
|
241
103
|
}
|
|
242
104
|
|
|
243
|
-
|
|
244
|
-
&& pathToFileURL(process.argv[1]).href === import.meta.url;
|
|
245
|
-
|
|
246
|
-
if (isDirectRun) {
|
|
247
|
-
main();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export {
|
|
251
|
-
RETRY_CONFIG,
|
|
252
|
-
buildReleaseDownloadUrl,
|
|
253
|
-
formatFailureGuidance,
|
|
254
|
-
getRetryDelayMs,
|
|
255
|
-
getReleaseAssetUrl,
|
|
256
|
-
getDownloadUrl,
|
|
257
|
-
getPackageVersion,
|
|
258
|
-
getPlatformArtifact,
|
|
259
|
-
isRetryableError,
|
|
260
|
-
isRetryableStatus,
|
|
261
|
-
};
|
|
105
|
+
main();
|