Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
Cargo.lock
.knock/
*.local.toml
docs/.DS_Store
.DS_Store
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/knock-core", "crates/knock-cli", "apps/knock-app/src-tauri"]
members = ["crates/knock-core", "crates/knock-cli", "crates/knock-mock", "crates/knock-mock-adapter", "apps/knock-app/src-tauri"]

[workspace.package]
version = "0.0.11"
Expand Down
163 changes: 56 additions & 107 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,146 +5,97 @@

HTTP client + workspace toolkit. Ships as a CLI (`knock`) and a Tauri desktop app (`Knock`).

Workspace layout:

```
apps/knock-app Tauri 2 desktop app (React + Vite frontend)
crates/knock-cli knock CLI binary
crates/knock-core Shared core library
```
https://github.com/user-attachments/assets/040faf8b-1b0e-4e9a-8083-8d787347ab30

## Install

### Quick install (Linux / macOS — CLI)
Pick your target and OS. Installers fetch the latest release, verify SHA256, and (on macOS) strip the Gatekeeper quarantine attribute.

One-liner. Downloads the latest release for your OS/arch, places `knock` in `~/.local/bin`, and (after confirming) strips the macOS Gatekeeper quarantine attribute so the unsigned binary can run.
| Target | OS | Command |
|---------|-----------------|--------------------------------------------------------------------------------------------------------|
| CLI | macOS / Linux | `curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.sh \| bash` |
| CLI | Windows | `iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.ps1 \| iex` |
| Desktop | macOS / Linux | `curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.sh \| bash` |
| Desktop | Windows | `iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.ps1 \| iex` |

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.sh | bash
```
Install locations: CLI → `~/.local/bin` (unix) or `%LOCALAPPDATA%\Knock\bin` (Windows). Desktop → `/Applications`, `~/Applications`, or system path per OS.

Pin a version:
If `~/.local/bin` is not in `PATH`: `export PATH="$HOME/.local/bin:$PATH"`. On Windows, open a new terminal for PATH to refresh.

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.sh | bash -s -- --version v0.1.0
```
<details>
<summary><strong>Advanced options</strong> — pin version, custom prefix, Linux format, silent install, SHA override</summary>

Custom prefix:
**Pin a version**

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.sh | KNOCK_PREFIX=/usr/local/bin bash
```
| Platform | Command |
|------------|----------------------------------------------------------------------------------------------------------------------------------|
| Unix | `curl -fsSL .../install.sh \| bash -s -- --version v0.1.0` |
| PowerShell | `$env:KNOCK_VERSION = "v0.1.0"; iwr .../install.ps1 \| iex` |

If `~/.local/bin` is not in your `PATH`, add it:
**Other knobs**

```bash
export PATH="$HOME/.local/bin:$PATH"
```
| Knob | Where | Example |
|----------------------------|-----------------|----------------------------------------------------------------------------------------|
| Custom CLI prefix | Unix env | `KNOCK_PREFIX=/usr/local/bin` |
| Linux desktop format | Unix env | `KNOCK_APP_FORMAT=deb` (also `rpm`; default `AppImage`) |
| Windows silent install | PowerShell env | `$env:KNOCK_SILENT = "1"` |
| Pin SHA256 manually | Unix env | `KNOCK_SHA256=<expected_sha256>` |
| Skip verification (unsafe) | Unix env | `KNOCK_SKIP_VERIFY=1` |

### Quick install (Windows — CLI)
</details>

PowerShell. Installs to `%LOCALAPPDATA%\Knock\bin` and adds it to user PATH.

```powershell
iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.ps1 | iex
```

Pin a version:

```powershell
$env:KNOCK_VERSION = "v0.1.0"
iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.ps1 | iex
```

Open a new terminal after install for the PATH update to apply.

The installer verifies the asset's SHA256 against the `.sha256` sidecar published by the release workflow. If the file is missing or the hash does not match, installation aborts. Pin manually:

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install.sh \
| KNOCK_SHA256=<expected_sha256> bash -s -- --version v0.1.0
```

Override (not recommended): `KNOCK_SKIP_VERIFY=1`.

### Manual download
<details>
<summary><strong>Manual download</strong> — verify SHA256, bypass Gatekeeper</summary>

Grab assets from [Releases](https://github.com/jairoFernandez/knock/releases). Naming:

```
knock-<version>-<os>-<arch>.<ext>
knock-<version>-<os>-<arch>.<ext>.sha256
knock-<version>-<os>-<arch>.<ext> # CLI
Knock_<version>_<arch>.<ext> # Desktop

os: macos | linux | windows
arch: x86_64 | aarch64
ext: tar.gz (unix) | zip (windows)
ext: tar.gz (unix) | zip (windows) | dmg | AppImage | deb | rpm | msi
```

Verify before extracting:
Verify:

```bash
# Linux
sha256sum -c knock-0.1.0-linux-x86_64.tar.gz.sha256
# macOS
shasum -a 256 -c knock-0.1.0-macos-aarch64.tar.gz.sha256
sha256sum -c knock-0.1.0-linux-x86_64.tar.gz.sha256 # Linux
shasum -a 256 -c knock-0.1.0-macos-aarch64.tar.gz.sha256 # macOS
```

On macOS, after extracting:
macOS unsigned binary/bundle — strip quarantine:

```bash
xattr -dr com.apple.quarantine ./knock
xattr -dr com.apple.quarantine ./knock # CLI
xattr -dr com.apple.quarantine "/Applications/Knock.app" # Desktop
```

### Desktop app — Quick install (Linux / macOS)
</details>

One-liner. Resolves latest release, downloads the right asset for your OS/arch, installs it, and (after confirming) strips macOS Gatekeeper quarantine.

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.sh | bash
```

Pin a version:

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.sh | bash -s -- --version v0.1.0
```
## Sponsor

Linux: defaults to `.AppImage`. Switch to `.deb` or `.rpm` (require sudo):
Knock is built in spare time. If it saves you some, consider chipping in:

```bash
curl -fsSL https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.sh | KNOCK_APP_FORMAT=deb bash
```
- ☕ [Buy Me A Coffee](https://buymeacoffee.com/jairofernandez)
- 💖 [GitHub Sponsors](https://github.com/sponsors/jairoFernandez)

### Desktop app — Quick install (Windows)
## Development

PowerShell. Downloads `.msi` and runs it.
<details>
<summary><strong>Workspace layout</strong></summary>

```powershell
iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.ps1 | iex
```

Silent install:

```powershell
$env:KNOCK_SILENT = "1"
iwr https://raw.githubusercontent.com/jairoFernandez/knock/main/scripts/install-app.ps1 | iex
apps/knock-app Tauri 2 desktop app (React + Vite frontend)
crates/knock-cli knock CLI binary
crates/knock-core Shared core library
```

### Desktop app — Manual download

Download the installer for your platform from [Releases](https://github.com/jairoFernandez/knock/releases):

- macOS: `Knock_<version>_aarch64.dmg` / `Knock_<version>_x64.dmg`
- Linux: `.AppImage` / `.deb` / `.rpm` (x86_64)
- Windows: `.msi` / `setup.exe` (x86_64)

macOS unsigned bundle — bypass Gatekeeper:

```bash
xattr -dr com.apple.quarantine "/Applications/Knock.app"
```
</details>

## Build from source
<details>
<summary><strong>Build from source</strong></summary>

Prereqs: Rust (stable), Node 20+, pnpm 9+. Linux desktop build also needs `libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev`.

Expand All @@ -165,7 +116,10 @@ make cross TARGET=aarch64-apple-darwin
make package-cross TARGET=aarch64-apple-darwin OS=macos ARCH=aarch64
```

## Release
</details>

<details>
<summary><strong>Release</strong></summary>

Tag-driven. Pushing a `v*` tag triggers `.github/workflows/release.yml`, which:

Expand All @@ -190,9 +144,4 @@ git push origin v0.2.0

Manual trigger is also available via the workflow's `workflow_dispatch` input.

## Sponsor

Knock is built in spare time. If it saves you some, consider chipping in:

- ☕ [Buy Me A Coffee](https://buymeacoffee.com/jairofernandez)
- 💖 [GitHub Sponsors](https://github.com/sponsors/jairoFernandez)
</details>
2 changes: 2 additions & 0 deletions apps/knock-app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ tauri-build = { version = "2", features = [] }

[dependencies]
knock-core = { path = "../../../crates/knock-core" }
knock-mock = { path = "../../../crates/knock-mock" }
knock-mock-adapter = { path = "../../../crates/knock-mock-adapter" }
tauri = { version = "2", features = [] }
tauri-plugin-dialog = "2"
serde = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions apps/knock-app/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod commands;
mod kubeconfig_cmd;
mod mock_cmd;
mod openapi_cmd;
mod recents;
mod terminal_cmd;
Expand All @@ -9,6 +10,7 @@ use std::time::{Duration, SystemTime};
use tauri::{Manager, RunEvent};

use kubeconfig_cmd::TempCache;
use mock_cmd::MockState;
use terminal_cmd::TerminalSessions;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
Expand All @@ -17,6 +19,7 @@ pub fn run() {
.plugin(tauri_plugin_dialog::init())
.manage(TempCache::default())
.manage(TerminalSessions::default())
.manage(MockState::default())
.setup(|app| {
sweep_stale_tmp_files();
#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -106,6 +109,13 @@ pub fn run() {
updates_cmd::download_app_update,
updates_cmd::install_app_update,
updates_cmd::run_app_installer,
mock_cmd::mock_status,
mock_cmd::mock_preview,
mock_cmd::mock_start,
mock_cmd::mock_stop,
mock_cmd::mock_read_response,
mock_cmd::mock_save_response,
mock_cmd::mock_clear_response,
])
.build(tauri::generate_context!())
.expect("error while building tauri application");
Expand Down
Loading
Loading