Commit Graph

10 Commits

Author SHA1 Message Date
SuYao
6b9daa749e feat: add plugin package installation from ZIP,directory, remote (#12426)
* feat: add plugin install

* fix: some bug

* fix: i18n

* refactor: rename 'active-directory' to 'resource'

* feat(plugin): support remote fetch plugin

* refactor: improve error display

* feat: add cache protocol

* fix(plugin): address code review issues for PR #12426

- Fix command injection vulnerability by adding -- separator before
  positional arguments in git clone and ls-remote commands
- Extract duplicate file helpers (directoryExists, fileExists, pathExists)
  to shared @main/utils/file utility
- Add depth limit (MAX_PLUGIN_ROOT_DEPTH=10) to findPluginRoots to
  prevent infinite recursion from symlink cycles
- Rename InstallFromZipResult to InstallFromSourceResult with type alias
  for backward compatibility
- Extract duplicate loadFirstPage logic in useMarketplaceBrowser hook
- Add documentation for intentionally disabled readContent and
  invalidateCache methods explaining API compatibility reasons

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs(plugin): add documentation for marketplace API and telemetry

- Document MARKETPLACE_API_BASE_URL with API endpoints and usage
- Add TODO for China mainland accessibility testing
- Document reportSkillInstall telemetry behavior and data transmitted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): fix skill installation and improve UI

- Fix skill installation using v2 resolve API endpoint
- Extract base repo URL from GitHub tree/blob URLs
- Fix skill card type label (skill -> skills key mapping)
- Split plugin settings into "Available Plugins" and "Installed Plugins" tabs
- Fix refresh button styling with aspect-square
- Add card vertical spacing with pb-4
- Add unit tests for extractBaseRepoUrl and extractResolvedSkill

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): use useTimer for search debounce

Replace manual setTimeout/clearTimeout with useTimer hook for better
timer management and automatic cleanup on component unmount.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* style(plugin): use explicit unknown type in catch blocks

Change all catch blocks from `catch (error)` to `catch (error: unknown)`
for better type safety and code clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): only show content section for installed plugins

- Skip content fetching for marketplace plugins since readContent
  always fails for remote plugins
- Only display the Content section when viewing installed plugins
- Change catch (error) to catch (error: unknown) for type safety

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): use Zod schemas for marketplace API responses

- Add PluginResolveResponseSchema for plugin resolution API
- Add ResolvedSkillSchema and SkillsResolveResponseSchema for v2 skills API
- Refactor extractRepositoryUrl to use Zod safeParse instead of manual type checking
- Refactor resolveSkillV2 to validate response with Zod and return typed array
- Update extractResolvedSkill to accept typed array directly
- Update tests to match new function signatures

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): simplify code and reduce duplication

- Merge runCommand and captureCommand into executeCommand in PluginService
- Combine URL regex patterns and use constant map for plugin directories
- Create generic response parser factory in MarketplaceService
- Extract buildSkillSourceKey helper in useMarketplaceBrowser
- Remove unused displayedEntries variable in PluginBrowser
- Consolidate category config into single object in useResourcePanel
- Extract ensureCacheData helper method in PluginCacheStore

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(plugin): remove dead readContent and invalidateCache methods

Remove methods that were non-functional (always throwing or no-op):
- Remove invalidateCache() no-op method from PluginService
- Remove readContent() method that always throws
- Remove corresponding IPC handlers and preload bindings
- Remove IpcChannel enum entries for both methods
- Remove content section from PluginDetailModal (relied on readContent)
- Remove agentId prop from PluginBrowser (no longer needed)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(plugin): update plugin settings and UI components

- Change default page size in useMarketplaceBrowser from 100 to 40 for improved performance.
- Add titles to the installed plugins section in multiple language files for better clarity.
- Refactor AgentSettings components to improve structure and readability, including the introduction of a new PluginsSettings component.
- Update modal widths in AgentSettingsPopup and SessionSettingsPopup for better UI consistency.
- Integrate Scrollbar component in SettingsContainer for enhanced scrolling experience.

* refactor(settings): improve Scrollbar import and enhance type safety

- Change Scrollbar import to use type-only import for ScrollbarProps.
- Update handleVirtualChange function to handle null scrollOffset for better type safety.

* fix(plugin): install only selected plugin and fix uninstall lookup

Bug fixes:
- Install only the specific requested plugin from marketplace repo
  instead of installing all plugins found in the repository
- Use actual installed filename for uninstall instead of marketplace
  metadata filename (which differs due to sanitization)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(plugin): support skill upload via drag-and-drop

Extended installFromSourceDir to detect and install skills:
- Check for plugin roots first (with .claude-plugin/plugin.json)
- If none found, search for skill directories (with SKILL.md)
- Install whichever type is detected

Added new methods:
- installSkillRoots: Install multiple skill directories
- installSkillFromDirectory: Install a single skill folder

Now users can drag-and-drop skill folders or ZIPs containing
skills to install them, not just plugin packages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* test(browser): add beforeEach to reset mock state

Add vi.clearAllMocks() in beforeEach to prevent state leakage
between tests, which could cause flaky test failures in CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-02-04 14:26:37 +08:00
亢奋猫
bd4f4db572 fix(build): add Linux musl native dependencies for Alpine support (#12412)
* fix(build): add Linux musl native dependencies for Alpine support

Add missing native dependencies for Linux musl (Alpine Linux) platform:
- @img/sharp-linuxmusl-arm64 and @img/sharp-linuxmusl-x64
- @img/sharp-libvips-linuxmusl-arm64 and @img/sharp-libvips-linuxmusl-x64
- @libsql/linux-arm64-musl and @libsql/linux-x64-musl

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(build): add support for Linux musl architecture in before-pack script

Updated the before-pack.js script to include 'linuxmusl' in the platformToArch mapping, enhancing compatibility for Alpine Linux builds.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-21 10:06:27 +08:00
beyondkmp
153c1024f6 refactor: use pnpm install instead of manual download for prebuild packages (#12358)
* refactor: use pnpm install instead of manual download for prebuild packages

Replace manual tgz download with pnpm install for architecture-specific
prebuild binaries, simplifying the build process.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* delete utils

* update after pack

* udpate before pack

* use optional deps

* refactor: use js-yaml to modify pnpm-workspace.yaml for cross-platform builds

- Add all prebuild packages to optionalDependencies in package.json
- Use js-yaml to parse and modify pnpm-workspace.yaml
- Add target platform to supportedArchitectures.os and cpu
- Restore original config after pnpm install

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix version

* refactor: streamline package management and filtering logic in before… (#12370)

refactor: streamline package management and filtering logic in before-pack.js

- Consolidated architecture-specific package definitions into a single array for better maintainability.
- Simplified the logic for determining target platform and architecture.
- Enhanced the filtering process for excluding and including packages based on architecture and platform.
- Improved console logging for clarity during package installation.

This refactor aims to improve the readability and efficiency of the prebuild package handling process.

* refactor: update package filtering logic in before-pack.js to read from electron-builder.yml

- Modified the package filtering process to load configuration directly from electron-builder.yml, reducing potential errors from multiple overrides.
- Enhanced maintainability by centralizing the file configuration management.

This change aims to streamline the prebuild package handling and improve configuration clarity.

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: 亢奋猫 <kangfenmao@qq.com>
2026-01-08 17:07:41 +08:00
kangfenmao
0cb3bd8311 fix: add claude code sdk support for arm version windows
- Enhanced the logic to determine included Claude code vendors based on architecture and platform.
- Adjusted filters for excluding and including Claude code vendors to improve compatibility, particularly for Windows ARM64.
- Removed unnecessary variables and streamlined the filter application process.
2026-01-08 00:05:35 +08:00
George·Dong
2a31fa2ad5 refactor: switch yarn to pnpm (#12260)
* refactor: switch workflows from yarn to pnpm

Replace Yarn usage with pnpm in CI workflows to standardize package
management and leverage pnpm's store/cache behavior.

- Use pnpm/action-setup to install pnpm (v) instead of enabling corepack
  and preparing Yarn.
- Retrieve pnpm store path and update cache actions to cache the pnpm
  store and use pnpm-lock.yaml for cache keys and restores.
- Replace yarn commands with pnpm equivalents across workflows:
  install, i18n:sync/translate, format, build:* and tsx invocation.
- Avoid committing lockfile changes by resetting pnpm-lock.yaml instead
  of yarn.lock when checking for changes.
- Update install flags: use pnpm install --frozen-lockfile / --install
  semantics where appropriate.

These changes unify dependency tooling, improve caching correctness,
and ensure CI uses pnpm-specific lockfile and cache paths.

* build: switch pre-commit hook to pnpm lint-staged

Update .husky/pre-commit to run pnpm lint-staged instead of yarn.
This aligns the pre-commit hook with the project's package manager
and ensures lint-staged runs using pnpm's environment and caching.

* chore(ci): remove pinned pnpm version from GH Action steps

Remove the explicit `with: version: 9` lines from multiple GitHub Actions workflows
(auto-i18n.yml, nightly-build.yml, pr-ci.yml, update-app-upgrade-config.yml,
sync-to-gitcode.yml, release.yml). The workflows still call `pnpm/action-setup@v4`
but no longer hardcode a pnpm version.

This simplifies maintenance and allows the action to resolve an appropriate pnpm
version (or use its default) without needing updates whenever the pinned
version becomes outdated. It reduces churn when bumping pnpm across CI configs
and prevents accidental pin drift between workflow files.

* build: Update pnpm to 10.27.0 and add onlyBuiltDependencies config

* Update @cherrystudio/openai to 6.15.0 and consolidate overrides

* Add @langchain/core to overrides

* Add override for openai-compatible 1.0.27

* build: optimize pnpm config and add missing dependencies

- Comment out shamefully-hoist in .npmrc for better pnpm compatibility
- Add React-related packages to optimizeDeps in electron.vite.config.ts
- Add missing peer dependencies and packages that were previously hoisted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* build: refine pnpm configuration and dependency management

- Simplify .npmrc to only essential electron mirror config
- Move platform-specific dependencies to devDependencies
- Pin sharp version to 0.34.3 for consistency
- Update sharp-libvips versions to 1.2.4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* reduce app size

* format

* build: remove unnecessary disableOxcRecommendation option from react plugin configuration

* docs: Replace yarn commands with pnpm in documentation and scripts

* Revert "build: optimize pnpm config and add missing dependencies"

This reverts commit acffad31f8.

* build: import dependencies from yarn.lock

* build: Add some phantom dependencies and reorganize dependencies

* build: Keep consistent by removing types of semver

It's not in the previous package.json

* build: Add some phantom dependencies

Keep same version with yarn.lock

* build: Add form-data dependency version 4.0.4

* Add chalk dependency

* build: downgrade some dependencies

Reference: .yarn-state-copy.yml. These phantom dependencies should use top-level package of that version in node_modules

* build: Add phantom dependencies

* build: pin tiptap dependencies to exact versions

Ensure consistent dependency resolution by removing caret ranges and pinning all @tiptap packages to exact version 3.2.0

* chore: pin embedjs dependencies to exact versions

* build: pin @modelcontextprotocol/sdk to exact version 1.23.0

Remove caret from version specifier to prevent automatic upgrades and ensure consistent dependencies

* chore: update @types/node dependency to 22.17.2

Update package.json and pnpm-lock.yaml to use @types/node version 22.17.2 instead of 22.19.3 to maintain consistency across dependencies

* build: move some dependencies to dev deps and pin dependency versions to exact numbers

Remove caret (^) from version ranges to ensure consistent dependency resolution across environments

* chore: move dependencies from prod to dev and update lockfile

Move @ant-design/icons, chalk, form-data, and open from dependencies to devDependencies
Update pnpm-lock.yaml to reflect dependency changes

* build: update package dependencies

- Add new dependencies: md5, @libsql/win32-x64-msvc, @strongtz/win32-arm64-msvc, bonjour-service, emoji-picker-element-data, gray-matter, js-yaml
- Remove redundant dependencies from devDependencies

* build: add cors, katex and pako dependencies

add new dependencies to support cross-origin requests, mathematical notation rendering and data compression

* move some js deps to dev deps

* test: update snapshot tests for Spinner and InputEmbeddingDimension

* chore: exclude .zed directory from biome formatting

* Update @ai-sdk/openai-compatible patch hash

* chore: update @kangfenmao/keyv-storage to version 0.1.3 in package.json and pnpm-lock.yaml

---------

Co-authored-by: icarus <eurfelux@gmail.com>
Co-authored-by: beyondkmp <beyondkmp@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: kangfenmao <kangfenmao@qq.com>
2026-01-05 22:16:34 +08:00
Vaayne
422ba52093 ⬆️ chore: migrate from Claude Code SDK to Claude Agent SDK v0.1.1
- Replace @anthropic-ai/claude-code with @anthropic-ai/claude-agent-sdk@0.1.1
- Update all import statements across 4 files
- Migrate patch for Electron compatibility (fork vs spawn)
- Handle breaking changes: replace appendSystemPrompt with systemPrompt preset
- Add settingSources configuration for filesystem settings
- Update vendor path in build scripts
- Update package name mapping in CodeToolsService
2025-09-30 17:54:02 +08:00
Vaayne
d8c3f601df ♻️ refactor: correct include filter path for Claude code ripgrep 2025-09-29 16:18:12 +08:00
beyondkmp
b131f0c48c pack optimization 2025-09-18 15:25:16 +08:00
beyondkmp
5ce7261678 refactor: Improve linux build for system-ocr (#9775)
* refactor(ocr): streamline OCR service registration and improve image preprocessing

- Simplified the registration of the system OCR service by removing the conditional check for Linux.
- Updated SystemOcrService to directly import necessary modules, enhancing clarity.
- Refactored image preprocessing to use a static import of the 'sharp' library for better performance.

* add patch for system-ocr

* add patch

* add patch again

* add patch

* delete setting

* delete i18n

* lint error

* add isLinux

* Revert "delete i18n"

This reverts commit 173e65bbd0.

* Revert "delete setting"

This reverts commit de39c76f83.

* fix: add system check for error message

---------

Co-authored-by: icarus <eurfelux@gmail.com>
2025-09-02 12:59:14 +08:00
beyondkmp
86d8e10dcb refactor: fix asar integration (#9753)
* refactor: replace afterPack script with beforePack and remove after-pack.js file

- Updated electron-builder configuration to use beforePack instead of afterPack.
- Removed the after-pack.js script as its functionality is no longer needed.

* refactor: streamline filter logic for architecture-specific packages in before-pack script

- Consolidated platform-specific filter conditions for arm64 and x64 architectures.
- Improved readability and maintainability by using arrays to manage filters for different architectures.
- Ensured that the correct filters are applied based on the architecture during the packaging process.

* chore: remove npm build commands from CI workflows

- Eliminated unnecessary `yarn build:npm` commands from the nightly build and release workflows for Linux, macOS, and Windows.
- Streamlined the build process by focusing on platform-specific build commands.

* delete build npm

* refactor: enhance architecture-specific package management in before-pack script

- Updated the before-pack script to include additional architecture-specific packages for arm64 and x64.
- Improved the organization of package filters and streamlined the logic for handling different architectures during the packaging process.
- Ensured that the correct filters are applied based on the architecture, enhancing the build process for various platforms.

* docs: clarify comment on prebuild binaries in before-pack script

* format code

* chore: add afterPack script to electron-builder configuration

- Included afterPack script in electron-builder.yml to enhance the packaging process.
- This addition allows for post-packaging tasks to be executed, improving build automation.

* chore: update macOS entitlements to disable library validation

- Added the key `com.apple.security.cs.disable-library-validation` to the entitlements file to enhance security settings for macOS builds.

* chore: remove unused package for win32 arm64 architecture

- Deleted the `@strongtz/win32-arm64-msvc` package from `package.json` and `yarn.lock` as it is no longer needed.
- Updated the `before-pack.js` script to improve architecture-specific package management by refining filter logic and ensuring correct package downloads based on architecture.
- Enhanced the `downloadNpmPackage` function to use Node.js streams for downloading and extracting packages, improving efficiency and error handling.
2025-09-01 19:48:24 +08:00