@akiojin/gwt 6.30.3 → 9.0.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/.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 +79 -227
- 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,113 @@
|
|
|
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);
|
|
2
|
+
"use strict";
|
|
27
3
|
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
31
8
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
backoffFactor: 2,
|
|
36
|
-
maxDelayMs: 5000,
|
|
37
|
-
};
|
|
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";
|
|
38
12
|
|
|
39
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Detect the GitHub Release artifact name for the current platform/arch.
|
|
15
|
+
*/
|
|
16
|
+
function artifactName() {
|
|
17
|
+
const platform = os.platform();
|
|
18
|
+
const arch = os.arch();
|
|
40
19
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (!artifact) {
|
|
44
|
-
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
45
|
-
console.error(`Supported platforms: ${getSupportedPlatformKeys().join(', ')}`);
|
|
46
|
-
process.exit(1);
|
|
20
|
+
if (platform === "darwin" && arch === "arm64") {
|
|
21
|
+
return "gwt-tui-macos-aarch64";
|
|
47
22
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
function isRetryableError(error) {
|
|
61
|
-
if (error && typeof error.statusCode === 'number') {
|
|
62
|
-
return isRetryableStatus(error.statusCode);
|
|
23
|
+
if (platform === "darwin" && arch === "x64") {
|
|
24
|
+
return "gwt-tui-macos-x86_64";
|
|
25
|
+
}
|
|
26
|
+
if (platform === "linux" && arch === "x64") {
|
|
27
|
+
return "gwt-tui-linux-x86_64";
|
|
28
|
+
}
|
|
29
|
+
if (platform === "linux" && arch === "arm64") {
|
|
30
|
+
return "gwt-tui-linux-aarch64";
|
|
31
|
+
}
|
|
32
|
+
if (platform === "win32" && arch === "x64") {
|
|
33
|
+
return "gwt-tui-windows-x86_64";
|
|
63
34
|
}
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function formatFailureGuidance(version, artifact) {
|
|
68
|
-
const versionedUrl = version && version !== 'unknown'
|
|
69
|
-
? buildReleaseDownloadUrl(version, artifact)
|
|
70
|
-
: null;
|
|
71
|
-
return {
|
|
72
|
-
versionedUrl,
|
|
73
|
-
releasePageUrl: `https://github.com/${REPO}/releases`,
|
|
74
|
-
buildCommand: 'cargo build --release',
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async function getReleaseAssetUrl(version, artifact, httpGet = get) {
|
|
79
|
-
return new Promise((resolve) => {
|
|
80
|
-
const options = {
|
|
81
|
-
hostname: 'api.github.com',
|
|
82
|
-
path: `/repos/${REPO}/releases/tags/v${version}`,
|
|
83
|
-
headers: {
|
|
84
|
-
'User-Agent': 'gwt-postinstall',
|
|
85
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const req = httpGet(options, (res) => {
|
|
90
|
-
let data = '';
|
|
91
|
-
res.on('data', (chunk) => data += chunk);
|
|
92
|
-
res.on('end', () => {
|
|
93
|
-
if (res.statusCode !== 200) {
|
|
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
|
-
});
|
|
106
35
|
|
|
107
|
-
|
|
108
|
-
});
|
|
36
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
109
37
|
}
|
|
110
38
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Read the target version from package.json.
|
|
41
|
+
*/
|
|
42
|
+
function readVersion() {
|
|
43
|
+
const pkg = path.join(__dirname, "..", "package.json");
|
|
44
|
+
const data = JSON.parse(fs.readFileSync(pkg, "utf8"));
|
|
45
|
+
return data.version;
|
|
114
46
|
}
|
|
115
47
|
|
|
116
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Follow redirects and download a URL to a local path.
|
|
50
|
+
*/
|
|
51
|
+
function download(url, dest) {
|
|
117
52
|
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);
|
|
53
|
+
const file = fs.createWriteStream(dest);
|
|
54
|
+
const request = (u) => {
|
|
55
|
+
https
|
|
56
|
+
.get(u, { headers: { "User-Agent": "gwt-postinstall" } }, (res) => {
|
|
57
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
58
|
+
request(res.headers.location);
|
|
129
59
|
return;
|
|
130
60
|
}
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
reject(
|
|
61
|
+
if (res.statusCode !== 200) {
|
|
62
|
+
file.close();
|
|
63
|
+
fs.unlink(dest, () => {});
|
|
64
|
+
reject(new Error(`Download failed: HTTP ${res.statusCode} for ${u}`));
|
|
135
65
|
return;
|
|
136
66
|
}
|
|
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);
|
|
67
|
+
res.pipe(file);
|
|
68
|
+
file.on("finish", () => {
|
|
69
|
+
file.close(resolve);
|
|
157
70
|
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
req.on('error', (err) => {
|
|
166
|
-
if (existsSync(dest)) unlinkSync(dest);
|
|
167
|
-
reject(err);
|
|
168
|
-
});
|
|
71
|
+
})
|
|
72
|
+
.on("error", (err) => {
|
|
73
|
+
file.close();
|
|
74
|
+
fs.unlink(dest, () => {});
|
|
75
|
+
reject(err);
|
|
76
|
+
});
|
|
169
77
|
};
|
|
170
|
-
|
|
171
|
-
request(url, 0);
|
|
78
|
+
request(url);
|
|
172
79
|
});
|
|
173
80
|
}
|
|
174
81
|
|
|
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
82
|
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');
|
|
83
|
+
// Skip in CI or when running from source
|
|
84
|
+
if (process.env.CI) {
|
|
85
|
+
console.log("gwt: skipping binary download in CI");
|
|
204
86
|
return;
|
|
205
87
|
}
|
|
206
88
|
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
try {
|
|
212
|
-
version = getPackageVersion();
|
|
213
|
-
const url = await getDownloadUrl(version, artifact);
|
|
214
|
-
console.log(`Downloading from: ${url}`);
|
|
89
|
+
const version = readVersion();
|
|
90
|
+
const artifact = artifactName();
|
|
91
|
+
const tag = `v${version}`;
|
|
92
|
+
const binaryUrl = `https://github.com/${REPO}/releases/download/${tag}/${artifact}/${BINARY_NAME}`;
|
|
215
93
|
|
|
216
|
-
|
|
217
|
-
mkdirSync(BIN_DIR, { recursive: true });
|
|
218
|
-
}
|
|
94
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
219
95
|
|
|
220
|
-
|
|
96
|
+
const dest = path.join(BIN_DIR, BINARY_NAME);
|
|
221
97
|
|
|
222
|
-
|
|
223
|
-
if (process.platform !== 'win32') {
|
|
224
|
-
chmodSync(BIN_PATH, 0o755);
|
|
225
|
-
}
|
|
98
|
+
console.log(`gwt: downloading ${tag} for ${os.platform()}-${os.arch()}...`);
|
|
226
99
|
|
|
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);
|
|
100
|
+
try {
|
|
101
|
+
await download(binaryUrl, dest);
|
|
102
|
+
if (os.platform() !== "win32") {
|
|
103
|
+
fs.chmodSync(dest, 0o755);
|
|
235
104
|
}
|
|
236
|
-
console.
|
|
237
|
-
|
|
238
|
-
console.error(`
|
|
239
|
-
|
|
105
|
+
console.log(`gwt: installed to ${dest}`);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
console.error(`gwt: failed to download binary - ${err.message}`);
|
|
108
|
+
console.error("gwt: you can build from source with: cargo build --release -p gwt-tui");
|
|
109
|
+
process.exitCode = 0; // non-fatal so npm install does not fail
|
|
240
110
|
}
|
|
241
111
|
}
|
|
242
112
|
|
|
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
|
-
};
|
|
113
|
+
main();
|