Support downloading of blob scenes

This commit is contained in:
Tw93
2025-09-16 10:19:36 +08:00
parent e9e12f90ad
commit dd11c6dd7a
3 changed files with 137 additions and 184 deletions

179
CLAUDE.md
View File

@@ -9,6 +9,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- **Clear intent over clever code**: Prioritize readability and maintainability
- **Simple over complex**: Keep all implementations simple and straightforward - prioritize solving problems and ease of maintenance over complex solutions
## Claude Code Eight Honors and Eight Shames
- **Shame** in guessing APIs, **Honor** in careful research
- **Shame** in vague execution, **Honor** in seeking confirmation
- **Shame** in assuming business logic, **Honor** in human verification
- **Shame** in creating interfaces, **Honor** in reusing existing ones
- **Shame** in skipping validation, **Honor** in proactive testing
- **Shame** in breaking architecture, **Honor** in following specifications
- **Shame** in pretending to understand, **Honor** in honest ignorance
- **Shame** in blind modification, **Honor** in careful refactoring
## Project Overview
Pake transforms any webpage into a lightweight desktop app using Rust and Tauri. It's significantly lighter than Electron (~5M vs ~100M+) with better performance.
@@ -21,146 +32,42 @@ Pake transforms any webpage into a lightweight desktop app using Rust and Tauri.
## Development Workflow
### 1. Planning Phase
1. **Understand**: Study existing patterns in codebase
2. **Plan**: Break complex work into 3-5 stages
3. **Test**: Write tests first (when applicable)
4. **Implement**: Minimal working solution
5. **Refactor**: Optimize and clean up
Break complex work into 3-5 stages:
1. Understand existing patterns in codebase
2. Plan implementation approach
3. Write tests first (when applicable)
4. Implement minimal working solution
5. Refactor and optimize
### 2. Implementation Flow
**Understanding First:**
**Key Commands:**
```bash
# Explore codebase structure
find src-tauri/src -name "*.rs" | head -10
grep -r "window_config" src-tauri/src/
pnpm test # Run comprehensive test suite
pnpm run cli:build # Build CLI for testing
pnpm run dev # Development with hot reload
```
**Development Commands:**
```bash
# Install dependencies
pnpm i
# Development with hot reload (for testing app functionality)
pnpm run dev
# CLI development
pnpm run cli:dev
# Production build
pnpm run build
```
### 3. Testing and Validation
**Key Testing Commands:**
```bash
# Run comprehensive test suite (unit + integration + builder)
pnpm test
# Build CLI for testing
pnpm run cli:build
# Debug build for development
pnpm run build:debug
# Multi-platform testing
pnpm run build:mac # macOS universal build
```
**Testing Checklist:**
- [ ] Run `npm test` for comprehensive validation (35 tests)
- [ ] Test on target platforms
- [ ] Verify injection system works
- [ ] Check system tray integration
- [ ] Validate window behavior
- [ ] Test with weekly.tw93.fun URL
- [ ] Verify remote icon functionality (https://cdn.tw93.fun/pake/weekly.icns)
**Testing Notes:**
- Do NOT use `PAKE_NO_CONFIG_OVERWRITE=1` - this environment variable is not implemented
**Testing:**
- Always run `pnpm test` before committing
- For CLI testing: `node dist/cli.js https://example.com --name TestApp --debug`
- **For app functionality testing**: Use `pnpm run dev` to start development server with hot reload. This allows real-time testing of injected JavaScript changes without rebuilding the entire app.
- The dev server automatically reloads when you modify files in `src-tauri/src/inject/` directory
- For app functionality testing: Use `pnpm run dev` for hot reload
## Core Components
### CLI Tool (`bin/`)
- `bin/cli.ts` - Main entry point with Commander.js
- `bin/builders/` - Platform-specific builders (Mac, Windows, Linux)
- `bin/options/` - CLI option processing and validation
- `bin/helpers/merge.ts` - Configuration merging (name setting at line 55)
### Tauri Application (`src-tauri/`)
- `src/lib.rs` - Application entry point
- `src/app/` - Core modules (window, tray, shortcuts)
- `src/inject/` - Web page injection logic
- **CLI Tool** (`bin/`): Main entry point, builders, options processing
- **Tauri App** (`src-tauri/`): Rust application, window/tray management, injection logic
- **Config Files**: `pake.json`, `tauri.conf.json`, platform-specific configs
## Documentation Guidelines
- **Main README**: Only include common, frequently-used parameters to avoid clutter
- **CLI Documentation** (`docs/cli-usage.md`): Include ALL parameters with detailed usage examples
- **Rare/Advanced Parameters**: Should have full documentation in CLI docs but minimal/no mention in main README
- **Examples of rare parameters**: `--title`, `--incognito`, `--system-tray-icon`, etc.
- **Main README**: Common parameters only
- **CLI Documentation** (`docs/cli-usage.md`): ALL parameters with examples
- **Rare parameters**: Full docs in CLI usage, minimal in main README
### Key Configuration Files
## Platform Specifics
- `pake.json` - App configuration
- `tauri.conf.json` - Tauri settings
- Platform configs: `tauri.{macos,windows,linux}.conf.json`
## Problem-Solving Approach
**When stuck:**
1. **Limit attempts to 3** before stopping to reassess
2. **Document what doesn't work** and why
3. **Research alternative approaches** in similar projects
4. **Question assumptions** - is there a simpler way?
**Example debugging flow:**
```bash
# 1. Check logs
pnpm run dev 2>&1 | grep -i error
# 2. Verify dependencies
cargo check --manifest-path=src-tauri/Cargo.toml
# 3. Test minimal reproduction
# Create simple test case isolating the issue
```
## Platform-Specific Development
### macOS
- Universal builds: `--multi-arch` flag
- Uses `.icns` icons
- Title bar customization available
### Windows
- Requires Visual Studio Build Tools
- Uses `.ico` icons
- MSI installer support
### Linux
- Multiple formats: deb, AppImage, rpm
- Requires `libwebkit2gtk` and dependencies
- Uses `.png` icons
- **macOS**: `.icns` icons, universal builds with `--multi-arch`
- **Windows**: `.ico` icons, requires Visual Studio Build Tools
- **Linux**: `.png` icons, multiple formats (deb, AppImage, rpm)
## Quality Standards
@@ -170,15 +77,15 @@ cargo check --manifest-path=src-tauri/Cargo.toml
- Use explicit types over implicit
- Write self-documenting code
- Follow existing patterns consistently
- **NO Chinese comments** - Use English only
- **NO unnecessary comments** - For simple, obvious code, let the code speak for itself
**Git and Commit Guidelines:**
**Git Guidelines:**
- **NEVER commit code automatically** - User handles all git operations
- **NEVER generate commit messages** - User writes their own commit messages
- **NEVER run npm publish automatically** - Always remind user to run it manually
- **NEVER execute git tag or push operations** - User handles all tag creation and GitHub pushes
- Only make code changes, user decides when and how to commit
- Test before user commits
- **NEVER commit automatically** - User handles all git operations
- **NEVER generate commit messages** - User writes their own
- Only make code changes, user decides when/how to commit
- Always test before user commits
## Branch Strategy
@@ -187,6 +94,6 @@ cargo check --manifest-path=src-tauri/Cargo.toml
## Prerequisites
- Node.js ≥22.0.0 (recommended LTS, older versions ≥18.0.0 may work)
- Rust ≥1.89.0 (recommended stable, older versions ≥1.78.0 may work)
- Platform build tools (see CONTRIBUTING.md for details)
- Node.js ≥22.0.0 (≥18.0.0 may work)
- Rust ≥1.89.0 (≥1.78.0 may work)
- Platform build tools (see CONTRIBUTING.md)