# Eide

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-zhinkgit-embeddedskills-eide`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [zhinkgit](https://agentstack.voostack.com/s/zhinkgit)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [zhinkgit](https://github.com/zhinkgit)
- **Source:** https://github.com/zhinkgit/embeddedskills/tree/main/eide

## Install

```sh
agentstack add skill-zhinkgit-embeddedskills-eide
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# EIDE 嵌入式工程构建

本 skill 提供 EIDE (Embedded IDE) 工程的发现、构建配置枚举、增量编译、全量重建、清理和 ELF 大小分析能力，并返回可供 `jlink/openocd` 继续使用的固件产物路径。

EIDE 是 VS Code 下的嵌入式开发扩展，使用 ARM CC (AC5/AC6) 或 GCC 工具链，通过 `unify_builder` 统一构建后端驱动。

## 配置

### 环境级配置（skill/config.json）

skill 目录下的 `config.json` 包含环境级配置，首次使用前确认 `builder_dir` 路径正确：

```json
{
  "builder_dir": "C:\\Users\\\\.vscode\\extensions\\cl.eide-\\res\\tools\\win32\\unify_builder",
  "builder_exe": "unify_builder.exe",
  "code_exe": "code",
  "toolchain_prefix": "arm-none-eabi-",
  "operation_mode": 1
}
```

- `builder_dir`：EIDE unify_builder 所在目录（必填，位于 VS Code 扩展目录下）
- `builder_exe`：builder 可执行文件名，Windows 默认 `unify_builder.exe`
- `code_exe`：VS Code CLI 路径，默认从 PATH 查找 `code`
- `toolchain_prefix`：用于 size 分析的工具链前缀，默认 `arm-none-eabi-`
- `operation_mode`：`1` 直接执行 / `2` 输出风险摘要但不阻塞 / `3` 执行前确认

### 工程级配置（workspace/.embeddedskills/config.json）

工程级共享配置统一保存在工作区的 `.embeddedskills/config.json` 中：

```json
{
  "eide": {
    "project": "",
    "config": "",
    "log_dir": ".embeddedskills/build"
  }
}
```

- `project`：默认 EIDE 工程根目录（包含 `.eide/eide.yml` 的目录），构建成功后会自动更新
- `config`：默认构建配置名称（对应 eide.yml 中的 ConfigName），构建成功后会自动更新
- `log_dir`：构建日志输出目录，默认 `.embeddedskills/build`

### 参数解析优先级

参数解析顺序（从高到低）：
1. CLI 显式参数
2. 环境级配置（skill/config.json）
3. 工程级配置（.embeddedskills/config.json）
4. `.embeddedskills/state.json`（上次构建记录）
5. 搜索/询问

## 子命令

| 子命令 | 用途 | 风险 |
|--------|------|------|
| `scan` | 搜索当前目录下的 EIDE 工程（含 `.eide/eide.yml` 的目录） | 低 |
| `configs` | 枚举工程中的构建配置 | 低 |
| `build` | 增量编译 | 中 |
| `rebuild` | 全量重建 | 中 |
| `clean` | 清理构建产物 | 高 |
| `size` | 分析 ELF 文件大小（text/data/bss 和内存使用） | 低 |

## 执行流程

1. 读取 `config.json`，确认 `builder_dir` 路径有效
2. 未指定子命令时默认执行 `scan`
3. 未提供工程路径时先执行 `scan` 搜索工程
4. 同时发现多个工程或多个配置时，列出选项让用户选择，绝不自动猜测
5. `build/rebuild/clean` 按 `operation_mode` 决定是否需要确认
6. `build/rebuild` 成功后，从构建目录解析 `elf_file` / `hex_file` 等产物路径
7. 所有构建命令基于 `builder.params` 调用 `unify_builder`，输出到日志文件后解析
8. `size` 默认分析最近一次构建产物的 .elf 文件

## 脚本调用

skill 目录下有 Python 脚本，使用标准库 + PyYAML 实现。

### eide_project.py — 工程扫描与配置枚举

```bash
# 扫描工程
python /scripts/eide_project.py scan --root  --json

# 枚举构建配置
python /scripts/eide_project.py configs --project  --json
```

### eide_build.py — 构建 / 重建 / 清理

```bash
python /scripts/eide_build.py  \
  --builder-dir  \
  --project  \
  --config  \
  --log-dir  \
  --json
```

`rebuild` 额外支持 `--clean-first` 先清理再重建。

### eide_size.py — ELF 大小分析

```bash
# 基本分析
python /scripts/eide_size.py analyze \
  --elf  \
  --toolchain-prefix arm-none-eabi- \
  --json

# 对比分析
python /scripts/eide_size.py compare \
  --elf  \
  --compare  \
  --toolchain-prefix arm-none-eabi- \
  --json
```

## 输出格式

所有脚本以 JSON 格式返回，基础字段为 `status`（ok/error）、`action`、`summary`、`details`，并可能附带 `context`、`artifacts`、`metrics`、`state`、`next_actions`、`timing`。

成功示例：
```json
{
  "status": "ok",
  "action": "build",
  "summary": "build 成功，errors=0 warnings=2",
  "details": {
    "project": "Vendor/EIDE",
    "config": "W20_Mainboard",
    "build_dir": "build/W20_Mainboard",
    "elf_file": "build/W20_Mainboard/MDK-ARM_F403A.elf",
    "hex_file": "build/W20_Mainboard/MDK-ARM_F403A.hex",
    "log_file": ".embeddedskills/build/MDK-ARM_F403A-W20_Mainboard-build.log"
  },
  "artifacts": {
    "elf_file": "build/W20_Mainboard/MDK-ARM_F403A.elf",
    "hex_file": "build/W20_Mainboard/MDK-ARM_F403A.hex",
    "flash_file": "build/W20_Mainboard/MDK-ARM_F403A.hex",
    "debug_file": "build/W20_Mainboard/MDK-ARM_F403A.elf"
  },
  "metrics": { "errors": 0, "warnings": 2, "flash_bytes": 32768, "ram_bytes": 8192 }
}
```

错误示例：
```json
{
  "status": "error",
  "action": "build",
  "error": { "code": "builder_not_found", "message": "unify_builder.exe 不存在，请确认 EIDE 扩展已安装" }
}
```

## 核心规则

- 不修改 `.eide/eide.yml` 或任何 EIDE 工程配置文件
- 不自动猜测工程路径或构建配置，有歧义时必须询问用户
- 参数解析优先级详见上方"参数解析优先级"章节
- 构建成功后优先使用返回的 `flash_file` / `debug_file` 与 `jlink/openocd` 串联
- `clean` 不在自动流程中隐式执行
- 构建失败时优先展示首个错误和日志文件路径
- 结果回显中始终包含工程名、配置名、构建目录路径；构建成功时优先回显产物路径
- EIDE 工程以包含 `.eide/eide.yml` 的目录为根目录

## 与 Keil 工程的关系

本项目中的 EIDE 工程与 Keil MDK 工程共享相同的源码和 ARM CC 工具链（`D:\Keil_V543\ARM\ARMCLANG`）。EIDE 工程通过 `eide.yml` 描述工程结构，`builder.params` 由 EIDE 自动生成并供 `unify_builder` 使用。两者的构建产物（.axf/.hex/.elf）格式兼容，可互换使用。

## 参考

- EIDE 扩展：在 VS Code 中搜索 `cl.eide` 安装
- `eide.yml` 格式：见 EIDE 扩展文档
- `builder.params`：由 EIDE 自动生成，位于 `build//builder.params`

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [zhinkgit](https://github.com/zhinkgit)
- **Source:** [zhinkgit/embeddedskills](https://github.com/zhinkgit/embeddedskills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-zhinkgit-embeddedskills-eide
- Seller: https://agentstack.voostack.com/s/zhinkgit
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
