chore(migration): repoint every published link off GitHub
The canonical repo is git.zacharyzhang.com now, so every URL a user can actually reach had to move with it. Self-updater: `PRODUCTION_ENDPOINTS.update_base_url` targets Gitea's `/api/v1/repos/.../releases`, which serves the same wire format GitHub's releases API did — `Release`/asset deserialisation is unchanged. The alpha channel requests `?per_page=30&limit=30` because GitHub reads the page size from `per_page` and Gitea from `limit`, and each ignores the other's, so one URL stays correct on either. Installers: same API base, and the documented one-liners become `https://kigicli.dev/install.{sh,ps1}`. That domain's Worker proxies both files from Gitea raw `main`, so the published install command survives any future forge move without being reprinted everywhere. install.ps1 also drops the GitHub-specific `Accept: application/vnd.github+json`. Everything else user-facing: `/feedback` and the shell's feedback fallback point at the Gitea issue tracker, `/docs` at the Gitea-rendered README, and web_fetch's User-Agent at kigicli.dev. SECURITY.md now routes reports to the issue tracker with a warning to withhold exploitable detail, because Gitea has no equivalent of GitHub's private vulnerability reporting. Comments naming `.github/workflows/release.yml` name `.gitea/` now. Tests assert against these constants rather than literal URLs, so they follow automatically; the one URL-shape assertion (production endpoints are https) still holds. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8bdfb551b6
commit
9fb82291b2
12 files changed
+68
-56
No files matched your search
@@ -36,12 +36,12 @@ key? OpenAI, Anthropic, Google, DeepSeek, Groq, Moonshot and
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# macOS / Linux
|
# macOS / Linux
|
||||||
curl -fsSL https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.sh | bash
|
curl -fsSL https://kigicli.dev/install.sh | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Windows PowerShell
|
# Windows PowerShell
|
||||||
irm https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.ps1 | iex
|
irm https://kigicli.dev/install.ps1 | iex
|
||||||
```
|
```
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -176,8 +176,8 @@ keyring entry, and its own `KIGI_*` env vars, and never touches what the
|
|||||||
official `kimi` CLI installed. `kigi import-kimi` copies your old config over
|
official `kimi` CLI installed. `kigi import-kimi` copies your old config over
|
||||||
once, read-only.
|
once, read-only.
|
||||||
|
|
||||||
**Zero telemetry.** It talks to the APIs you configured, GitHub Releases, and
|
**Zero telemetry.** It talks to the APIs you configured, the Kigi release
|
||||||
your own MCP servers. Nothing else.
|
server, and your own MCP servers. Nothing else.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,8 +1,10 @@
|
|||||||
# Security Policy
|
# Security Policy
|
||||||
|
|
||||||
Kigi is a community build; report vulnerabilities via
|
Kigi is a community build; report vulnerabilities on the
|
||||||
[GitHub private vulnerability reporting](https://github.com/ZacharyZhang-NY/Kigi-CLI/security/advisories/new)
|
[Kigi issue tracker](https://git.zacharyzhang.com/ZacharyZhang-NY/Kigi-CLI/issues).
|
||||||
on this repository. Please do not open public issues for security reports.
|
Issues there are public, so please leave out any detail that would make a
|
||||||
|
report directly exploitable — open with the affected area and impact, and a
|
||||||
|
maintainer will follow up for the rest.
|
||||||
|
|
||||||
Dependency advisories are gated in CI with `cargo deny check advisories`;
|
Dependency advisories are gated in CI with `cargo deny check advisories`;
|
||||||
documented exceptions live in `deny.toml`.
|
documented exceptions live in `deny.toml`.
|
||||||
@@ -11,7 +11,8 @@ pub struct KigiEndpoints {
|
|||||||
pub coding_api_base_url: &'static str,
|
pub coding_api_base_url: &'static str,
|
||||||
/// OAuth device-flow host for Kimi Code subscription login.
|
/// OAuth device-flow host for Kimi Code subscription login.
|
||||||
pub oauth_host: &'static str,
|
pub oauth_host: &'static str,
|
||||||
/// GitHub Releases API endpoint the self-updater polls.
|
/// Releases API endpoint the self-updater polls (GitHub-Releases-shaped;
|
||||||
|
/// Gitea's `/api/v1` serves the same wire format).
|
||||||
pub update_base_url: &'static str,
|
pub update_base_url: &'static str,
|
||||||
/// Human-facing page for subscription upgrade guidance.
|
/// Human-facing page for subscription upgrade guidance.
|
||||||
pub upgrade_page_url: &'static str,
|
pub upgrade_page_url: &'static str,
|
||||||
@@ -20,7 +21,7 @@ pub struct KigiEndpoints {
|
|||||||
pub const PRODUCTION_ENDPOINTS: KigiEndpoints = KigiEndpoints {
|
pub const PRODUCTION_ENDPOINTS: KigiEndpoints = KigiEndpoints {
|
||||||
coding_api_base_url: "https://api.kimi.com/coding/v1",
|
coding_api_base_url: "https://api.kimi.com/coding/v1",
|
||||||
oauth_host: "https://auth.kimi.com",
|
oauth_host: "https://auth.kimi.com",
|
||||||
update_base_url: "https://api.github.com/repos/ZacharyZhang-NY/Kigi-CLI/releases",
|
update_base_url: "https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/Kigi-CLI/releases",
|
||||||
upgrade_page_url: "https://www.kimi.com/code/",
|
upgrade_page_url: "https://www.kimi.com/code/",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ pub const CODE_BASE_URL_ENV: &str = "KIGI_CODE_BASE_URL";
|
|||||||
/// Env var overriding [`oauth_host`] (PRD F1).
|
/// Env var overriding [`oauth_host`] (PRD F1).
|
||||||
pub const OAUTH_HOST_ENV: &str = "KIGI_OAUTH_HOST";
|
pub const OAUTH_HOST_ENV: &str = "KIGI_OAUTH_HOST";
|
||||||
/// Env var overriding [`update_base_url`] (PRD F8). Points the self-updater
|
/// Env var overriding [`update_base_url`] (PRD F8). Points the self-updater
|
||||||
/// at an alternate GitHub-Releases-shaped API (mirrors, tests).
|
/// at an alternate GitHub/Gitea-Releases-shaped API (mirrors, tests).
|
||||||
pub const UPDATE_BASE_URL_ENV: &str = "KIGI_UPDATE_BASE_URL";
|
pub const UPDATE_BASE_URL_ENV: &str = "KIGI_UPDATE_BASE_URL";
|
||||||
|
|
||||||
fn resolve(var: &str, compiled: &'static str) -> String {
|
fn resolve(var: &str, compiled: &'static str) -> String {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//! Port of kimi-cli's `/feedback` slash command (kimi-cli
|
//! Port of kimi-cli's `/feedback` slash command (kimi-cli
|
||||||
//! `src/kimi_cli/ui/shell/slash.py`, `feedback()`): subscription (OAuth)
|
//! `src/kimi_cli/ui/shell/slash.py`, `feedback()`): subscription (OAuth)
|
||||||
//! sessions POST the user's feedback text to `{coding_api_base_url}/feedback`
|
//! sessions POST the user's feedback text to `{coding_api_base_url}/feedback`
|
||||||
//! with a Bearer token; everyone else is pointed at the GitHub issue tracker.
|
//! with a Bearer token; everyone else is pointed at the project issue tracker.
|
||||||
//! The request body carries exactly the fields kimi-cli sends:
|
//! The request body carries exactly the fields kimi-cli sends:
|
||||||
//! `session_id`, `content`, `version`, `os`, `model`.
|
//! `session_id`, `content`, `version`, `os`, `model`.
|
||||||
|
|
||||||
@@ -12,7 +12,8 @@ use std::sync::Arc;
|
|||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
/// Where non-subscription users (no OAuth session) submit feedback instead.
|
/// Where non-subscription users (no OAuth session) submit feedback instead.
|
||||||
pub const FEEDBACK_ISSUES_URL: &str = "https://github.com/ZacharyZhang-NY/Kigi-CLI/issues";
|
pub const FEEDBACK_ISSUES_URL: &str =
|
||||||
|
"https://git.zacharyzhang.com/ZacharyZhang-NY/Kigi-CLI/issues";
|
||||||
|
|
||||||
/// HTTP error from the feedback endpoint with a preserved status code, so
|
/// HTTP error from the feedback endpoint with a preserved status code, so
|
||||||
/// callers can distinguish auth failures (401) without string matching.
|
/// callers can distinguish auth failures (401) without string matching.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ use crate::register_resource;
|
|||||||
pub const MAX_URL_LENGTH: usize = 2_000;
|
pub const MAX_URL_LENGTH: usize = 2_000;
|
||||||
pub const MAX_REDIRECTS: usize = 10;
|
pub const MAX_REDIRECTS: usize = 10;
|
||||||
pub const USER_AGENT_STRING: &str =
|
pub const USER_AGENT_STRING: &str =
|
||||||
"Mozilla/5.0 (compatible; kigi-agent/1.0; +https://github.com/ZacharyZhang-NY/Kigi-CLI)";
|
"Mozilla/5.0 (compatible; kigi-agent/1.0; +https://kigicli.dev)";
|
||||||
|
|
||||||
/// Runtime-configurable parameters for the `web_fetch` tool.
|
/// Runtime-configurable parameters for the `web_fetch` tool.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ use crate::docs::{all_titles, find_doc};
|
|||||||
use crate::slash::command::{AppCtx, ArgItem, CommandExecCtx, CommandResult, SlashCommand};
|
use crate::slash::command::{AppCtx, ArgItem, CommandExecCtx, CommandResult, SlashCommand};
|
||||||
|
|
||||||
/// Online docs landing page (hardcoded like other TUI deep-links; the
|
/// Online docs landing page (hardcoded like other TUI deep-links; the
|
||||||
/// project README is the docs entry point for the GitHub-hosted docs).
|
/// project README is the docs entry point for the repo-hosted docs).
|
||||||
pub const BUILD_DOCS_URL: &str = "https://github.com/ZacharyZhang-NY/Kigi-CLI#readme";
|
pub const BUILD_DOCS_URL: &str =
|
||||||
|
"https://git.zacharyzhang.com/ZacharyZhang-NY/Kigi-CLI/src/branch/main/README.md";
|
||||||
|
|
||||||
/// Open How-to Guides or online Build docs.
|
/// Open How-to Guides or online Build docs.
|
||||||
pub struct DocsCommand;
|
pub struct DocsCommand;
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
//! `/feedback` -- open the Kigi GitHub issues page.
|
//! `/feedback` -- open the Kigi issues page.
|
||||||
|
|
||||||
use crate::app::actions::Action;
|
use crate::app::actions::Action;
|
||||||
use crate::slash::command::{CommandExecCtx, CommandResult, SlashCommand};
|
use crate::slash::command::{CommandExecCtx, CommandResult, SlashCommand};
|
||||||
|
|
||||||
/// Where feedback goes: the project's own issue tracker. Kigi is a community
|
/// Where feedback goes: the project's own issue tracker. Kigi is a community
|
||||||
/// build, so its feedback belongs on its GitHub repo — mirroring the official
|
/// build, so its feedback belongs on its own repo — mirroring the official
|
||||||
/// kimi-cli, whose `/feedback` opens its repo's issues page.
|
/// kimi-cli, whose `/feedback` opens its repo's issues page.
|
||||||
pub const FEEDBACK_ISSUES_URL: &str = "https://github.com/ZacharyZhang-NY/Kigi-CLI/issues";
|
pub const FEEDBACK_ISSUES_URL: &str =
|
||||||
|
"https://git.zacharyzhang.com/ZacharyZhang-NY/Kigi-CLI/issues";
|
||||||
|
|
||||||
/// Open the Kigi issue tracker in the browser.
|
/// Open the Kigi issue tracker in the browser.
|
||||||
pub struct FeedbackCommand;
|
pub struct FeedbackCommand;
|
||||||
@@ -17,7 +18,7 @@ impl SlashCommand for FeedbackCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
"Report feedback on the Kigi GitHub issues page"
|
"Report feedback on the Kigi issues page"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
|
|||||||
@@ -29,17 +29,18 @@ const MSG_AUTO_UPDATE_BACKGROUND: &str = "Auto-update running in background.";
|
|||||||
const MSG_RUN_UPDATE_MANUAL: &str = "Run `kigi update` to get the latest version.";
|
const MSG_RUN_UPDATE_MANUAL: &str = "Run `kigi update` to get the latest version.";
|
||||||
|
|
||||||
/// Manual-install one-liner for this platform's bootstrap installer
|
/// Manual-install one-liner for this platform's bootstrap installer
|
||||||
/// (install.sh / install.ps1 hosted at the repo root, PRD F8).
|
/// (install.sh / install.ps1, PRD F8). Served from kigicli.dev rather than the
|
||||||
|
/// repo host directly, so the published command survives a forge migration.
|
||||||
fn manual_install_cmd() -> &'static str {
|
fn manual_install_cmd() -> &'static str {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
"irm https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.ps1 | iex"
|
"irm https://kigicli.dev/install.ps1 | iex"
|
||||||
} else {
|
} else {
|
||||||
"curl -fsSL https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.sh | sh"
|
"curl -fsSL https://kigicli.dev/install.sh | sh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Build a reinstall hint for a known installer type. Every installer is
|
/// Build a reinstall hint for a known installer type. Every installer is
|
||||||
/// "internal" (GitHub Releases) today; the parameter survives so the hint
|
/// "internal" (the repo's Releases) today; the parameter survives so the hint
|
||||||
/// stays correct if another backend ever returns.
|
/// stays correct if another backend ever returns.
|
||||||
fn reinstall_hint(_installer: &str) -> String {
|
fn reinstall_hint(_installer: &str) -> String {
|
||||||
format!("Please reinstall via:\n {}", manual_install_cmd())
|
format!("Please reinstall via:\n {}", manual_install_cmd())
|
||||||
@@ -694,7 +695,7 @@ pub(crate) fn detect_platform() -> Result<(&'static str, &'static str)> {
|
|||||||
|
|
||||||
/// Rust target triple for this build — the key that maps a platform to its
|
/// Rust target triple for this build — the key that maps a platform to its
|
||||||
/// release-asset name. Must stay in lockstep with the five targets built by
|
/// release-asset name. Must stay in lockstep with the five targets built by
|
||||||
/// `.github/workflows/release.yml` and the tables in install.sh/install.ps1.
|
/// `.gitea/workflows/release.yml` and the tables in install.sh/install.ps1.
|
||||||
pub(crate) fn target_triple() -> Result<&'static str> {
|
pub(crate) fn target_triple() -> Result<&'static str> {
|
||||||
let triple = if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
|
let triple = if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
|
||||||
"aarch64-apple-darwin"
|
"aarch64-apple-darwin"
|
||||||
@@ -2604,19 +2605,19 @@ mod tests {
|
|||||||
// reinstall_hint / manual_install_cmd
|
// reinstall_hint / manual_install_cmd
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_reinstall_hint_points_at_repo_install_script() {
|
fn test_reinstall_hint_points_at_published_install_script() {
|
||||||
let hint = reinstall_hint("internal");
|
let hint = reinstall_hint("internal");
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert!(hint.contains("irm"), "should suggest irm install: {hint}");
|
assert!(hint.contains("irm"), "should suggest irm install: {hint}");
|
||||||
assert!(
|
assert!(
|
||||||
hint.contains("ZacharyZhang-NY/Kigi-CLI/main/install.ps1"),
|
hint.contains("kigicli.dev/install.ps1"),
|
||||||
"should reference the repo's install.ps1: {hint}"
|
"should reference the published install.ps1: {hint}"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
assert!(hint.contains("curl"), "should suggest curl install: {hint}");
|
assert!(hint.contains("curl"), "should suggest curl install: {hint}");
|
||||||
assert!(
|
assert!(
|
||||||
hint.contains("ZacharyZhang-NY/Kigi-CLI/main/install.sh"),
|
hint.contains("kigicli.dev/install.sh"),
|
||||||
"should reference the repo's install.sh: {hint}"
|
"should reference the published install.sh: {hint}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Unknown installers fall back to the same hint.
|
// Unknown installers fall back to the same hint.
|
||||||
@@ -2652,7 +2653,7 @@ mod tests {
|
|||||||
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_release_asset_name_matches_release_workflow_naming() {
|
fn test_release_asset_name_matches_release_workflow_naming() {
|
||||||
// Must stay in lockstep with .github/workflows/release.yml, which
|
// Must stay in lockstep with .gitea/workflows/release.yml, which
|
||||||
// publishes kigi-<version>-<target-triple>.{tar.gz|zip}.
|
// publishes kigi-<version>-<target-triple>.{tar.gz|zip}.
|
||||||
let triple = target_triple().unwrap();
|
let triple = target_triple().unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ use kigi_shell::util::kigi_home::kigi_home;
|
|||||||
|
|
||||||
const TTL_SECONDS_BEFORE_AUTO_UPDATE: Duration = Duration::from_secs(60 * 30);
|
const TTL_SECONDS_BEFORE_AUTO_UPDATE: Duration = Duration::from_secs(60 * 30);
|
||||||
|
|
||||||
/// Release channel: this repo's GitHub Releases (PRD F8). The API base is
|
/// Release channel: this repo's Releases (PRD F8). The API base is resolved
|
||||||
/// resolved through [`kigi_env::update_base_url`] — production default
|
/// through [`kigi_env::update_base_url`] — production default
|
||||||
/// `https://api.github.com/repos/ZacharyZhang-NY/Kigi-CLI/releases`,
|
/// `https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/Kigi-CLI/releases`,
|
||||||
/// overridable via `KIGI_UPDATE_BASE_URL` for mirrors and tests.
|
/// overridable via `KIGI_UPDATE_BASE_URL` for mirrors and tests.
|
||||||
pub(crate) fn update_base_url() -> String {
|
pub(crate) fn update_base_url() -> String {
|
||||||
kigi_env::update_base_url()
|
kigi_env::update_base_url()
|
||||||
@@ -167,16 +167,19 @@ async fn fetch_github_json<T: serde::de::DeserializeOwned>(url: &str) -> Result<
|
|||||||
|
|
||||||
/// Latest release for `channel` from a GitHub-Releases-shaped API at `base`.
|
/// Latest release for `channel` from a GitHub-Releases-shaped API at `base`.
|
||||||
///
|
///
|
||||||
/// - `stable` / `enterprise`: `GET {base}/latest` — GitHub's "latest" already
|
/// - `stable` / `enterprise`: `GET {base}/latest` — "latest" already excludes
|
||||||
/// excludes drafts and pre-releases.
|
/// drafts and pre-releases on both GitHub and Gitea.
|
||||||
/// - `alpha`: `GET {base}?per_page=30` (newest first) and take the semver-max
|
/// - `alpha`: `GET {base}?per_page=30&limit=30` (newest first) and take the
|
||||||
/// non-draft entry. The list includes both pre-releases and stable
|
/// semver-max non-draft entry. The list includes both pre-releases and
|
||||||
/// releases, so this preserves the max(alpha, stable) channel semantics —
|
/// stable releases, so this preserves the max(alpha, stable) channel
|
||||||
/// alpha users are never stuck behind a newer stable.
|
/// semantics — alpha users are never stuck behind a newer stable. GitHub
|
||||||
|
/// reads the page size from `per_page` and Gitea from `limit`; each ignores
|
||||||
|
/// the other's parameter, so sending both keeps one URL valid on either.
|
||||||
pub async fn fetch_latest_release_from_base(channel: &str, base: &str) -> Result<Release> {
|
pub async fn fetch_latest_release_from_base(channel: &str, base: &str) -> Result<Release> {
|
||||||
let base = base.trim_end_matches('/');
|
let base = base.trim_end_matches('/');
|
||||||
if channel == "alpha" {
|
if channel == "alpha" {
|
||||||
let releases: Vec<Release> = fetch_github_json(&format!("{base}?per_page=30")).await?;
|
let releases: Vec<Release> =
|
||||||
|
fetch_github_json(&format!("{base}?per_page=30&limit=30")).await?;
|
||||||
return releases
|
return releases
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|r| !r.draft)
|
.filter(|r| !r.draft)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ pub fn host_platform() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Host Rust target triple, matching `auto_update::target_triple()` and the
|
/// Host Rust target triple, matching `auto_update::target_triple()` and the
|
||||||
/// release-asset naming in `.github/workflows/release.yml`.
|
/// release-asset naming in `.gitea/workflows/release.yml`.
|
||||||
pub fn host_triple() -> &'static str {
|
pub fn host_triple() -> &'static str {
|
||||||
if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
|
if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
|
||||||
"aarch64-apple-darwin"
|
"aarch64-apple-darwin"
|
||||||
|
|||||||
+9
-8
@@ -1,17 +1,17 @@
|
|||||||
# Kigi installer (Windows x86_64) — PRD F8.
|
# Kigi installer (Windows x86_64) — PRD F8.
|
||||||
#
|
#
|
||||||
# Downloads the x86_64-pc-windows-msvc artifact from this repo's GitHub
|
# Downloads the x86_64-pc-windows-msvc artifact from this repo's Releases,
|
||||||
# Releases, verifies its SHA-256 against the release's SHA256SUMS manifest,
|
# verifies its SHA-256 against the release's SHA256SUMS manifest, and
|
||||||
# and installs the binary as %USERPROFILE%\.kigi\bin\kigi.exe.
|
# installs the binary as %USERPROFILE%\.kigi\bin\kigi.exe.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# irm https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.ps1 | iex
|
# irm https://kigicli.dev/install.ps1 | iex
|
||||||
# powershell -ExecutionPolicy Bypass -File install.ps1 -Version v0.1.0
|
# powershell -ExecutionPolicy Bypass -File install.ps1 -Version v0.1.0
|
||||||
#
|
#
|
||||||
# Environment:
|
# Environment:
|
||||||
# KIGI_SHARE_DIR install root (default: %USERPROFILE%\.kigi)
|
# KIGI_SHARE_DIR install root (default: %USERPROFILE%\.kigi)
|
||||||
# KIGI_UPDATE_BASE_URL GitHub-Releases-shaped API base (default:
|
# KIGI_UPDATE_BASE_URL releases API base, GitHub/Gitea-shaped (default:
|
||||||
# https://api.github.com/repos/ZacharyZhang-NY/Kigi-CLI/releases)
|
# https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/Kigi-CLI/releases)
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
@@ -27,7 +27,8 @@ function Fail([string]$Message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Repo = "ZacharyZhang-NY/Kigi-CLI"
|
$Repo = "ZacharyZhang-NY/Kigi-CLI"
|
||||||
$ApiBase = if ($env:KIGI_UPDATE_BASE_URL) { $env:KIGI_UPDATE_BASE_URL } else { "https://api.github.com/repos/$Repo/releases" }
|
$Forge = "https://git.zacharyzhang.com"
|
||||||
|
$ApiBase = if ($env:KIGI_UPDATE_BASE_URL) { $env:KIGI_UPDATE_BASE_URL } else { "$Forge/api/v1/repos/$Repo/releases" }
|
||||||
$KigiHome = if ($env:KIGI_SHARE_DIR) { $env:KIGI_SHARE_DIR } else { Join-Path $env:USERPROFILE ".kigi" }
|
$KigiHome = if ($env:KIGI_SHARE_DIR) { $env:KIGI_SHARE_DIR } else { Join-Path $env:USERPROFILE ".kigi" }
|
||||||
$Triple = "x86_64-pc-windows-msvc"
|
$Triple = "x86_64-pc-windows-msvc"
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ if ($Version -and $Version -notmatch '^\d+\.\d+\.\d+([-.][0-9A-Za-z.-]+)?$') {
|
|||||||
# TLS 1.2 for older PowerShell 5.1 defaults.
|
# TLS 1.2 for older PowerShell 5.1 defaults.
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
$Headers = @{ "User-Agent" = "kigi-install"; "Accept" = "application/vnd.github+json" }
|
$Headers = @{ "User-Agent" = "kigi-install"; "Accept" = "application/json" }
|
||||||
|
|
||||||
# ── Resolve the release ──────────────────────────────────────────────────────
|
# ── Resolve the release ──────────────────────────────────────────────────────
|
||||||
$ReleaseUrl = if ($Version) { "$ApiBase/tags/v$Version" } else { "$ApiBase/latest" }
|
$ReleaseUrl = if ($Version) { "$ApiBase/tags/v$Version" } else { "$ApiBase/latest" }
|
||||||
|
|||||||
+8
-7
@@ -2,26 +2,27 @@
|
|||||||
#
|
#
|
||||||
# Kigi installer (macOS / Linux) — PRD F8.
|
# Kigi installer (macOS / Linux) — PRD F8.
|
||||||
#
|
#
|
||||||
# Downloads the matching platform artifact from this repo's GitHub Releases,
|
# Downloads the matching platform artifact from this repo's Releases, verifies
|
||||||
# verifies its SHA-256 against the release's SHA256SUMS manifest, and installs
|
# its SHA-256 against the release's SHA256SUMS manifest, and installs the
|
||||||
# the binary as ~/.kigi/bin/kigi (the same managed layout the self-updater
|
# binary as ~/.kigi/bin/kigi (the same managed layout the self-updater
|
||||||
# maintains: versioned binary in ~/.kigi/downloads/, atomic symlink in bin/).
|
# maintains: versioned binary in ~/.kigi/downloads/, atomic symlink in bin/).
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# curl -fsSL https://raw.githubusercontent.com/ZacharyZhang-NY/Kigi-CLI/main/install.sh | sh
|
# curl -fsSL https://kigicli.dev/install.sh | sh
|
||||||
# sh install.sh --version v0.1.0 # pin a specific release
|
# sh install.sh --version v0.1.0 # pin a specific release
|
||||||
#
|
#
|
||||||
# Environment:
|
# Environment:
|
||||||
# KIGI_SHARE_DIR install root (default: ~/.kigi)
|
# KIGI_SHARE_DIR install root (default: ~/.kigi)
|
||||||
# KIGI_UPDATE_BASE_URL GitHub-Releases-shaped API base (default:
|
# KIGI_UPDATE_BASE_URL releases API base, GitHub/Gitea-shaped (default:
|
||||||
# https://api.github.com/repos/ZacharyZhang-NY/Kigi-CLI/releases)
|
# https://git.zacharyzhang.com/api/v1/repos/ZacharyZhang-NY/Kigi-CLI/releases)
|
||||||
#
|
#
|
||||||
# Fails fast on any error; never leaves a partial binary as the active kigi.
|
# Fails fast on any error; never leaves a partial binary as the active kigi.
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
REPO="ZacharyZhang-NY/Kigi-CLI"
|
REPO="ZacharyZhang-NY/Kigi-CLI"
|
||||||
API_BASE="${KIGI_UPDATE_BASE_URL:-https://api.github.com/repos/${REPO}/releases}"
|
FORGE="https://git.zacharyzhang.com"
|
||||||
|
API_BASE="${KIGI_UPDATE_BASE_URL:-${FORGE}/api/v1/repos/${REPO}/releases}"
|
||||||
KIGI_HOME="${KIGI_SHARE_DIR:-$HOME/.kigi}"
|
KIGI_HOME="${KIGI_SHARE_DIR:-$HOME/.kigi}"
|
||||||
|
|
||||||
err() {
|
err() {
|
||||||
|
|||||||
Reference in new issue
Block a user