Skip to content

feat: macOS 构建支持 — agents/skills 预置 + 文档完善 - #6

Closed
000x7b-stack wants to merge 1 commit into
OpenAisec:mainfrom
000x7b-stack:feat/macos-build-support
Closed

feat: macOS 构建支持 — agents/skills 预置 + 文档完善#6
000x7b-stack wants to merge 1 commit into
OpenAisec:mainfrom
000x7b-stack:feat/macos-build-support

Conversation

@000x7b-stack

@000x7b-stack 000x7b-stack commented Jul 25, 2026

Copy link
Copy Markdown

概述

为 macOS 构建流程添加 agents/skills/tools 预置逻辑,使 macOS DMG 产物开箱即用,与 Windows 便携版体验对齐。

改动内容

1. desktop/scripts/build-macos-arm64.sh — 添加预置逻辑

新增 preseed_portable_data() 函数,在 .app 签名后注入到 canonical copy:

  • Contents/MacOS/CLAUDE_CONFIG_DIR/ 下创建便携数据骨架
  • 写入 app-mode.json ({"mode":"portable"}),启动时 determine_startup_portable_dir() 自动命中便携模式
  • 预置 8 个内置 agents(与 Windows 脚本白名单一致)
  • 预置全部 skills(排除 workspace 产物目录,校验 SKILL.md 存在性)
  • 预置 tools 目录(YAML 配置 + bin/darwin),排除 bin/win/ 和 bin/linux/ 避免 codesign 失败
  • 去除数据文件执行权限,防止 codesign --deep 将其当作未签名代码组件

2. BUILD.md — 添加 macOS 构建指南

  • 前提条件(Bun / Rust / Xcode CLT)
  • 编译步骤、产物位置、应用包结构说明
  • 安装方式(DMG / 直接运行)
  • 环境变量(SKIP_INSTALL / SIGN_BUILD / PRESERVE_TAURI_TARGET / OPEN_OUTPUT)
  • 5 个常见问题排查

3. README.md — 更新下载与构建说明

  • 新增 macOS DMG 下载徽章
  • 快速开始新增 macOS DMG 安装说明
  • 源码构建新增 macOS 编译步骤

背景

macOS 构建脚本 (build-macos-arm64.sh) 已存在于仓库,但缺少 agents/skills 预置步骤——打出的 .app 内没有数据,用户首次启动后需要手动复制。本 PR 对齐 Windows 便携版的预置逻辑,实现开箱即用。

影响范围

模块 是否改动 说明
desktop scripts/build-macos-arm64.sh 新增预置函数 + 修复 codesign/命名问题
docs BUILD.md 新增 macOS 构建指南,README.md 更新下载/构建说明
server 无改动
adapter 无改动
native 无改动(未修改 Rust 代码或 Tauri 配置)
provider/runtime 无改动
agent-loop 无改动

测试说明

自动化测试

  • bun run lint(desktop TypeScript 类型检查)✅ 通过
  • bun test(15 个单元测试)✅ 全部通过,0 失败
  • bash -n desktop/scripts/build-macos-arm64.sh(语法校验)✅ 通过

完整构建验证(真机 macOS Apple Silicon)

  • ./scripts/build-macos-arm64.sh 完整执行 ✅ 成功
  • Rust 编译 (Tauri 2.10) ✅ 通过
  • Frontend build (tsc + vite) ✅ 通过
  • Sidecar build (bun compile) ✅ 通过
  • Tauri bundle (.app + .dmg) ✅ 通过
  • codesign --force --sign - ✅ 通过
  • codesign --verify --deep --strict ✅ 通过 ("valid on disk" + "satisfies Designated Requirement")
  • 预置验证:46 skills, 8 agents, tools (darwin only) ✅
  • app-mode.json = {"mode":"portable"}
  • DMG 产物 129MB ✅

手工功能测试(真机 macOS)

  • macOS dev 模式运行验证:Server (:3456) + Desktop Vite (:1420) 正常启动,UI 渲染正常
  • 代码审计功能验证:在 Miko 中对 ~/Workspace/lab/Hello-Java-Sec 项目执行 quick 模式代码审计,4 个并行 Agent 正常工作,成功生成完整审计报告

门禁说明

CONTRIBUTING.md 中提到的 bun run verify / bun run check:desktop 等门禁脚本在当前仓库的 package.json 中不存在(仅有 check:nativekimostart),已用等效的 bun run lint + bun test + 完整构建替代。

剩余风险

  • macOS Intel (x64) 未覆盖:本地脚本仅支持 Apple Silicon,Intel 版本依赖 CI 构建
  • darwin 二进制缺失data/tools/bin/darwin/ 目录为空(.gitignore 排除),macOS 便携版的安全工具探测会回退到系统 PATH 查找
  • 未签名 .app 运行限制--no-sign 构建的 .app 首次打开需要用户手动在系统设置中允许。正式发布需要 Apple Developer 证书 (SIGN_BUILD=1)

- Add preseed_portable_data() to build-macos-arm64.sh: injects builtin
  agents, skills, and tools into the .app bundle's CLAUDE_CONFIG_DIR,
  mirroring the Windows portable build (build-portable-win.ps1)
- Update BUILD.md with comprehensive macOS build guide: prerequisites,
  build steps, output structure, env vars, and troubleshooting
- Update README.md: add macOS DMG download badge, macOS quick start,
  and macOS source build instructions

The preseeding step runs before code signing so the entire bundle
(including injected data) gets sealed. On first launch,
determine_startup_portable_dir() detects app-mode.json and enters
portable mode automatically — users get agents/skills/tools out of
the box without manual setup.
@github-actions

Copy link
Copy Markdown

PR quality triage

Changed areas: area:desktop, area:docs

CLI core policy: No CLI-core policy block detected.

Missing-test policy: No missing-test policy block detected.

Coverage baseline policy: No coverage-baseline policy block detected.

CLI core files:

  • none

Coverage policy files:

  • none

Expected checks:

  • change-policy
  • desktop-checks
  • desktop-native-checks
  • docs-checks

Test coverage signals:

  • No obvious missing-test signal from changed paths.

Risk notes:

  • No special risk notes from changed paths.

Hard merge gates still come from GitHub Actions, not AI review.

Dosu handoff: Dosu can be used as the AI reviewer for risk explanation, missing-test prompts, and maintainer Q&A. If it does not comment automatically from the PR template, ask:

@dosubot review this PR for changed-area risk, missing tests, docs impact, desktop startup risk, and CLI core impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants