Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
docs: add project agent guidance
Tw93aceb23f03799
diff --git a/.agents/skills/code-review/SKILL.md b/.agents/skills/code-review/SKILL.mdnew file mode 100644index 00000000..c2f9491b--- /dev/null+++ b/.agents/skills/code-review/SKILL.md@@ -0,0 +1,48 @@+---+name: code-review+description: Pake project adapter for Waza check/code-review. Use for TypeScript CLI, Rust/Tauri, release artifact, and CI review.+version: 1.1.0+allowed-tools:+ - Bash+ - Read+ - Grep+ - Glob+disable-model-invocation: true+---++# Pake Code Review Adapter++Use Waza `/check` for the generic review method. This adapter adds Pake-specific commands, hard stops, and artifact rules.++## Pake-Specific Hard Stops++- [ ] Changes under `bin/` rebuild and commit `dist/cli.js` with `pnpm run cli:build`.+- [ ] Release version bumps keep `package.json`, `src-tauri/Cargo.toml`, and `src-tauri/tauri.conf.json` in sync.+- [ ] No new `tauriConf: any` or other untyped config objects; use `PakeTauriConfig`.+- [ ] No user-reachable `panic!` or `.unwrap()` on config, CLI, or event paths.+- [ ] Silent `catch {}` blocks surface the real error through `logger.warn`.+- [ ] New helper in `bin/utils/` or `bin/helpers/` has a matching `tests/unit/<basename>.test.ts`.+- [ ] Binary parsers have a round-trip test, not only builder assertions.++## Quick Review Commands++```bash+# Get PR diff+gh pr diff++# Format check+pnpm run format:check++# Run unit tests (fast, sub-second)+npx vitest run++# Full suite without the slow real build+pnpm test -- --no-build++# Build CLI and catch TypeScript errors+pnpm run cli:build+```++## Review Output Format++Follow Waza `/check`: findings first, ordered by severity, with tight file/line references. Keep summaries brief.diff --git a/.agents/skills/github-ops/SKILL.md b/.agents/skills/github-ops/SKILL.mdnew file mode 100644index 00000000..0f610371--- /dev/null+++ b/.agents/skills/github-ops/SKILL.md@@ -0,0 +1,100 @@+---+name: github-ops+description: GitHub issue, PR, and release operations via gh CLI. Not for code review or release builds.+version: 1.0.0+allowed-tools:+ - Bash+ - Read+---++# GitHub Operations Skill++Use this skill when working with GitHub issues, PRs, and releases for Pake.++## Golden Rule++**ALWAYS use `gh` CLI** for GitHub operations. Never use the web UI or make assumptions about state — always query first.++## Issue Operations++```bash+# View a specific issue+gh issue view 123++# List open issues+gh issue list --state open++# List issues with a label+gh issue list --label bug++# Add a comment (only with explicit user request)+gh issue comment 123 --body "..."++# Close an issue+gh issue close 123+```++## PR Operations++```bash+# List open PRs+gh pr list++# View a PR+gh pr view 456++# Check PR status and CI checks+gh pr checks 456++# View PR diff+gh pr diff 456++# Read inline review comments on a PR+gh api repos/tw93/Pake/pulls/456/comments++# Merge a PR (only with explicit user request)+gh pr merge 456 --squash++# Create a PR+gh pr create --title "..." --body "..."+```++## Release Operations++```bash+# List releases+gh release list++# View a specific release+gh release view V3.10.0++# Check CI runs for a tag+gh run list --workflow=release.yml++# Watch a running CI job+gh run watch++# View CI run logs+gh run view <run-id> --log+```++## CI / Workflow Operations++```bash+# List recent workflow runs+gh run list++# Filter by workflow+gh run list --workflow=release.yml+gh run list --workflow=quality-and-test.yml++# Re-run failed jobs+gh run rerun <run-id> --failed-only+```++## Safety Rules++1. **ALWAYS** draft the reply first and show it to the user for approval before calling any write operation (`gh issue comment`, `gh pr comment`, `gh pr merge`, `gh issue close`, `gh release create`, etc.). Approval of one draft does not extend to future comments.+2. **NEVER** merge, close, or modify without explicit user request.+3. **ALWAYS** query current state before taking action — never assume.+4. Before replying to an issue or PR, read the body to confirm the author's language; match their language in the reply. This applies to the author, not to arbitrary thread commenters.diff --git a/.agents/skills/release/SKILL.md b/.agents/skills/release/SKILL.mdnew file mode 100644index 00000000..b184b3ad--- /dev/null+++ b/.agents/skills/release/SKILL.md@@ -0,0 +1,69 @@+---+name: release+description: Prepare, validate, and publish a Pake release. Not for version bumps without release intent.+version: 1.0.0+allowed-tools:+ - Bash+ - Read+ - Grep+ - Glob+disable-model-invocation: true+---++# Release Skill++Use this skill when preparing or executing a Pake release.++## Version Files++Three files must be updated in sync — never update one without the others:++- `package.json` → `"version"`+- `src-tauri/Cargo.toml` → `version` under `[package]`+- `src-tauri/tauri.conf.json` → `"version"`++## Release Checklist++### Pre-Release++1. [ ] Confirm the new version number (check current: `cat package.json | jq .version`)+2. [ ] Update all three version files above+3. [ ] Run `pnpm run format` — must pass cleanly+4. [ ] Run `pnpm test` — must pass cleanly. If the release workflow step fails with `pnpm install ... exit code 1` against the CN mirror, re-run once; a single transient flake is acceptable, two consecutive failures is not.+5. [ ] Run `pnpm run cli:build` — Rollup + TS must pass (catches type errors that `format` misses).+6. [ ] No uncommitted changes: `git status`+7. [ ] Commit version bump with message: `chore: bump version to VX.X.X`++### Tagging (triggers CI)++```bash+git tag -a VX.X.X -m "Release VX.X.X"+git push origin VX.X.X+```++Tag format: uppercase `V` prefix (e.g. `V3.11.0`), not `v3.11.0`.++### Post-Tag Verification++1. [ ] Confirm CI triggered: `gh run list --workflow=release.yml`+2. [ ] Watch CI status: `gh run watch`+3. [ ] Verify GitHub Release was created: `gh release view VX.X.X`+4. [ ] Publish to npm (manual): `npm publish`++## Build Commands (local only)++```bash+# Current platform+pnpm build++# macOS universal binary+pnpm build:mac+```++Cross-platform builds (Windows/Linux) are handled by CI, not locally.++## Safety Rules++1. **NEVER** auto-commit or auto-push without explicit user request+2. **NEVER** tag before all checks pass+3. **ALWAYS** verify the three version files are in sync before taggingdiff --git a/.claude/skills/code-review/SKILL.md b/.claude/skills/code-review/SKILL.mdnew file mode 100644index 00000000..c2f9491b--- /dev/null+++ b/.claude/skills/code-review/SKILL.md@@ -0,0 +1,48 @@+---+name: code-review+description: Pake project adapter for Waza check/code-review. Use for TypeScript CLI, Rust/Tauri, release artifact, and CI review.+version: 1.1.0+allowed-tools:+ - Bash+ - Read+ - Grep+ - Glob+disable-model-invocation: true+---++# Pake Code Review Adapter++Use Waza `/check` for the generic review method. This adapter adds Pake-specific commands, hard stops, and artifact rules.++## Pake-Specific Hard Stops++- [ ] Changes under `bin/` rebuild and commit `dist/cli.js` with `pnpm run cli:build`.+- [ ] Release version bumps keep `package.json`, `src-tauri/Cargo.toml`, and `src-tauri/tauri.conf.json` in sync.+- [ ] No new `tauriConf: any` or other untyped config objects; use `PakeTauriConfig`.+- [ ] No user-reachable `panic!` or `.unwrap()` on config, CLI, or event paths.+- [ ] Silent `catch {}` blocks surface the real error through `logger.warn`.+- [ ] New helper in `bin/utils/` or `bin/helpers/` has a matching `tests/unit/<basename>.test.ts`.+- [ ] Binary parsers have a round-trip test, not only builder assertions.++## Quick Review Commands++```bash+# Get PR diff+gh pr diff++# Format check+pnpm run format:check++# Run unit tests (fast, sub-second)+npx vitest run++# Full suite without the slow real build+pnpm test -- --no-build++# Build CLI and catch TypeScript errors+pnpm run cli:build+```++## Review Output Format++Follow Waza `/check`: findings first, ordered by severity, with tight file/line references. Keep summaries brief.diff --git a/.claude/skills/github-ops/SKILL.md b/.claude/skills/github-ops/SKILL.mdnew file mode 100644index 00000000..0f610371--- /dev/null+++ b/.claude/skills/github-ops/SKILL.md@@ -0,0 +1,100 @@+---+name: github-ops+description: GitHub issue, PR, and release operations via gh CLI. Not for code review or release builds.+version: 1.0.0+allowed-tools:+ - Bash+ - Read+---++# GitHub Operations Skill++Use this skill when working with GitHub issues, PRs, and releases for Pake.++## Golden Rule++**ALWAYS use `gh` CLI** for GitHub operations. Never use the web UI or make assumptions about state — always query first.++## Issue Operations++```bash+# View a specific issue+gh issue view 123++# List open issues+gh issue list --state open++# List issues with a label+gh issue list --label bug++# Add a comment (only with explicit user request)+gh issue comment 123 --body "..."++# Close an issue+gh issue close 123+```++## PR Operations++```bash+# List open PRs+gh pr list++# View a PR+gh pr view 456++# Check PR status and CI checks+gh pr checks 456++# View PR diff+gh pr diff 456++# Read inline review comments on a PR+gh api repos/tw93/Pake/pulls/456/comments++# Merge a PR (only with explicit user request)+gh pr merge 456 --squash++# Create a PR+gh pr create --title "..." --body "..."+```++## Release Operations++```bash+# List releases+gh release list++# View a specific release+gh release view V3.10.0++# Check CI runs for a tag+gh run list --workflow=release.yml++# Watch a running CI job+gh run watch++# View CI run logs+gh run view <run-id> --log+```++## CI / Workflow Operations++```bash+# List recent workflow runs+gh run list++# Filter by workflow+gh run list --workflow=release.yml+gh run list --workflow=quality-and-test.yml++# Re-run failed jobs+gh run rerun <run-id> --failed-only+```++## Safety Rules++1. **ALWAYS** draft the reply first and show it to the user for approval before calling any write operation (`gh issue comment`, `gh pr comment`, `gh pr merge`, `gh issue close`, `gh release create`, etc.). Approval of one draft does not extend to future comments.+2. **NEVER** merge, close, or modify without explicit user request.+3. **ALWAYS** query current state before taking action — never assume.+4. Before replying to an issue or PR, read the body to confirm the author's language; match their language in the reply. This applies to the author, not to arbitrary thread commenters.diff --git a/.claude/skills/release/SKILL.md b/.claude/skills/release/SKILL.mdnew file mode 100644index 00000000..b184b3ad--- /dev/null+++ b/.claude/skills/release/SKILL.md@@ -0,0 +1,69 @@+---+name: release+description: Prepare, validate, and publish a Pake release. Not for version bumps without release intent.+version: 1.0.0+allowed-tools:+ - Bash+ - Read+ - Grep+ - Glob+disable-model-invocation: true+---++# Release Skill++Use this skill when preparing or executing a Pake release.++## Version Files++Three files must be updated in sync — never update one without the others:++- `package.json` → `"version"`+- `src-tauri/Cargo.toml` → `version` under `[package]`+- `src-tauri/tauri.conf.json` → `"version"`++## Release Checklist++### Pre-Release++1. [ ] Confirm the new version number (check current: `cat package.json | jq .version`)+2. [ ] Update all three version files above+3. [ ] Run `pnpm run format` — must pass cleanly+4. [ ] Run `pnpm test` — must pass cleanly. If the release workflow step fails with `pnpm install ... exit code 1` against the CN mirror, re-run once; a single transient flake is acceptable, two consecutive failures is not.+5. [ ] Run `pnpm run cli:build` — Rollup + TS must pass (catches type errors that `format` misses).+6. [ ] No uncommitted changes: `git status`+7. [ ] Commit version bump with message: `chore: bump version to VX.X.X`++### Tagging (triggers CI)++```bash+git tag -a VX.X.X -m "Release VX.X.X"+git push origin VX.X.X+```++Tag format: uppercase `V` prefix (e.g. `V3.11.0`), not `v3.11.0`.++### Post-Tag Verification++1. [ ] Confirm CI triggered: `gh run list --workflow=release.yml`+2. [ ] Watch CI status: `gh run watch`+3. [ ] Verify GitHub Release was created: `gh release view VX.X.X`+4. [ ] Publish to npm (manual): `npm publish`++## Build Commands (local only)++```bash+# Current platform+pnpm build++# macOS universal binary+pnpm build:mac+```++Cross-platform builds (Windows/Linux) are handled by CI, not locally.++## Safety Rules++1. **NEVER** auto-commit or auto-push without explicit user request+2. **NEVER** tag before all checks pass+3. **ALWAYS** verify the three version files are in sync before taggingdiff --git a/.gitignore b/.gitignoreindex 65c93cac..f3ef36fd 100644--- a/.gitignore+++ b/.gitignore@@ -20,15 +20,14 @@*.suo*.sw?*.tmp-# AI assistant docs (do not commit)-# AI Assistant files-.agents/+# Local AI assistant docs+AGENTS.override.md+CLAUDE.local.md+.agents/settings.local.json# Editor directories and files# Logs-.claude/+.claude/settings.local.jsonAGENT.md-AGENTS.md-CLAUDE.mddistdist-ssrjournal/diff --git a/AGENTS.md b/AGENTS.mdnew file mode 100644index 00000000..642913ed--- /dev/null+++ b/AGENTS.md@@ -0,0 +1,175 @@+# AGENTS.md - Pake Project Knowledge Base++## Project Identity++**Pake** - Turn any webpage into a lightweight desktop app with one command.++- **Purpose**: Package any website into a ~5MB desktop app (20x smaller than Electron)+- **Stack**: Tauri v2 (Rust) + TypeScript CLI+- **Platforms**: macOS, Windows, Linux+- **Mechanism**: Uses system webview (WebKit on macOS/Linux, WebView2 on Windows)++## Repository Structure++```+Pake/+├── bin/ # CLI source code (TypeScript)+│ └── cli.ts # Main CLI entry (Commander.js)+├── src-tauri/ # Tauri Rust application+│ ├── src/ # Rust source code+│ ├── src/app/ # window creation, setup, menu, config, and invokes+│ ├── src/inject/ # injected JS/CSS behavior+│ ├── Cargo.toml # Rust dependencies and version+│ ├── tauri.conf.json # Tauri configuration and version+│ └── .cargo/ # Cargo configuration (gitignored)+├── dist/ # Compiled CLI output+├── docs/ # Documentation+│ ├── cli-usage.md # CLI parameters+│ ├── advanced-usage.md # Customization guide+│ └── faq.md # Troubleshooting+├── scripts/ # Utility scripts+├── tests/ # Unit, integration, and release-flow tests+├── .github/workflows/ # quality/test and release automation+├── default_app_list.json # Popular apps config for release builds+├── package.json # Node.js dependencies and version+└── rollup.config.js # CLI build configuration+```++## Development Commands++| Command | Purpose |+|---------|---------|+| `pnpm install` | Install dependencies |+| `pnpm run dev` | Tauri development mode |+| `pnpm run cli:dev -- <url>` | CLI wrapper + Tauri (recommended) |+| `pnpm run cli:dev --iterative-build` | Faster dev (skip checks) |+| `pnpm run cli:build` | Rollup + TypeScript check (catches type errors Prettier misses) |+| `pnpm run build` | Build for current platform |+| `pnpm run build:mac` | macOS universal binary |+| `pnpm run format` | Format code (prettier + cargo fmt) |+| `npx vitest run` | Unit and integration tests only (sub-second) |+| `pnpm test -- --no-build` | Full suite minus the multi-arch real build |+| `pnpm test` | Full suite including release workflow |++Keep shared project facts in this file so Codex, Claude Code, and other agents use the same public source of truth. Tool-specific local skills or overrides must remain optional and ignored.++## Task Intake And Investigation++Prefer requests with:++- `Goal`: exact bug, feature, refactor, or review target+- `Scope`: files, directories, or subsystem boundaries to inspect first+- `Repro`: command, input, fixture, or failing test+- `Expected`: expected behavior+- `Actual`: current behavior, error text, or regression note+- `Constraints`: what must not change+- `Verify`: minimum command or test that proves the result++When task scope is incomplete, inspect in this order:++1. CLI entry and option parsing under `bin/cli.ts`, `bin/options/`, and `bin/helpers/`+2. Target TypeScript module under `bin/`+3. Tauri runtime or packaging files under `src-tauri/src/` and `src-tauri/tauri*.conf.json`+4. Narrow tests under `tests/unit/` or `tests/integration/`+5. Release workflow files under `.github/workflows/` only for CI or release issues+6. Docs only if behavior, ownership, or expected usage is still unclear++Execution rules:++- Start with the smallest plausible file set+- Prefer targeted search (`rg <symbol|string> <paths>`) over repository-wide scans+- Ignore generated or output-heavy areas unless the task directly targets them, especially `dist/`, `node_modules/`, `src-tauri/target/`, `.app/`, `src-tauri/icons/`, and `src-tauri/png/`. Exception: `dist/cli.js` is the shipped CLI build artifact (see `package.json` `files`); when you change anything under `bin/`, rebuild it via `pnpm run cli:build` and commit the regenerated `dist/cli.js` alongside the source change+- Keep changes local to one subsystem when possible+- Run the narrowest relevant verification first, expand only if needed+- If key context is missing, make one reasonable assumption and proceed++## Current Risk Areas++- CLI options are user-facing and must stay synchronized across `bin/helpers/cli-program.ts`, `bin/types.ts`, `bin/defaults.ts`, `bin/helpers/merge.ts`, generated `dist/cli.js`, and `docs/cli-usage*.md`.+- Recent window/runtime options include `--incognito`, `--new-window`, `--min-width`, `--min-height`, `--maximize`, multi-window behavior, notification click handling, and Linux/Wayland WebKit compositing defaults.+- `--incognito` intentionally trades persistence for clean private sessions; be careful around login, cookies, local storage, and WeChat-style WebView detection.+- `--new-window` and `--multi-window` do not bypass every provider policy. Google OAuth and similar embedded-WebView restrictions may still require a normal browser or native client.+- Notification flows cross injected JS, Tauri invokes, capabilities, and native notification plugins. Verify the Rust capability and JS caller together.+- WebKit compositing behavior is platform-sensitive on Linux/Wayland. Do not change defaults without testing the affected platform path or documenting the risk.++## Code Quality Standards++- Chinese comments are forbidden.++## Branch Strategy++- `main` - Only branch. All development and releases happen here directly.++## Version Management++Three files must be updated in sync for every release:++| File | Field |+|------|-------|+| `package.json` | `"version"` |+| `src-tauri/Cargo.toml` | `version` under `[package]` |+| `src-tauri/tauri.conf.json` | `"version"` |++Tag format: `V0.x.x` (uppercase V). Current version: check `package.json`.++## Release Workflow (CI)++Pushing a `V*` tag triggers `.github/workflows/release.yml`:++1. **release-apps** - reads `default_app_list.json` for app list+2. **create-release** - creates the GitHub Release placeholder+3. **build-cli** - builds and uploads the `dist/` CLI artifact+4. **build-popular-apps** - builds all apps in parallel across macOS/Windows/Linux+5. **publish-docker** - builds and pushes Docker image to GHCR++The workflow can also be triggered manually via `workflow_dispatch` with options to build popular apps or publish Docker independently.++After tagging, npm publish is done manually: `npm publish`.++`.github/workflows/quality-and-test.yml` runs auto-format on push, Rust quality checks, and CLI/build validation across Linux, Windows, and macOS.++### Network Mirror Behavior++Pake uses official npm and Rust sources by default. CN mirrors are explicit opt-in only:++- Set `PAKE_USE_CN_MIRROR=1` only when the user or CI environment intentionally wants npmmirror/rsProxy.+- Do not reintroduce automatic China-domain mirror switching.+- If an install fails against a CN mirror, retry the same install command to separate network availability from a product regression.+- `bin/utils/mirror.ts` and `bin/builders/BaseBuilder.ts` own this behavior; keep docs and tests aligned when changing it.++## CLI Usage Example++```bash+# Install CLI+pnpm install -g pake-cli++# Basic usage+pake https://github.com --name GitHub++# Advanced usage+pake https://weekly.tw93.fun --name Weekly --width 1200 --height 800+```++## Troubleshooting++See `docs/faq.md` for common issues and solutions.++### macOS SDK / Compile Errors++If compilation errors occur (e.g. on macOS beta), create `src-tauri/.cargo/config.toml`:++```toml+[env]+MACOSX_DEPLOYMENT_TARGET = "15.0"+SDKROOT = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"+```++This file is already in `.gitignore`.++### `dist/cli.js` out of sync with `bin/`++Symptom: tests or release builds use stale CLI behavior after a `bin/` edit. Fix with `pnpm run cli:build` and commit the regenerated `dist/cli.js`.++### First Tauri build is slow++The first `cargo build` on a fresh clone takes 10+ minutes as Cargo compiles every Tauri dependency from source. Subsequent builds reuse the `src-tauri/target/` cache. This is expected, not a bug.diff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 00000000..f326ea10--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,6 @@++## Claude Code++- Treat `AGENTS.md` as the shared source of truth for this repository.+- Keep personal notes and machine-specific workflow in `CLAUDE.local.md`.