<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[YCT_CLI 命令行 AGENT-SKILL]]></title><description><![CDATA[<p dir="auto">用此SKILL, 方便AI操作yct_cli，对工程进行校验，测试，代码生成。</p>
<pre><code>---
name: yct-cli
description: &gt;-
  Operate yct_cli to check, test, and generate code for YTMicro .yct projects
  (SDK, MCAL, MCAL_EB / EB Tresos). Use when the user mentions yct_cli, a .yct
  file, SDK, MCAL, MCAL_EB, EB Tresos, tresos_cmd, TRESOS_BASE, 校验, 测试, or 代码生成.
---

# yct_cli

用此SKILL, 方便AI操作yct_cli，对工程进行校验，测试，代码生成。

`yct_cli` reads an existing `.yct` and the installed SDK or MCAL package. It does not create the `.yct`. Prefer `yct_cli` on PATH. From this repo, after `npm run cli:build`, use `node cli/cli.min.js`.

## Pick a command

Read `project.type` from the `.yct`, then run that command.

| Project type | Command |
|---|---|
| sdk | `yct_cli sdk` |
| mcal | `yct_cli mcal` |
| mcal_eb | `yct_cli mcal_eb` (alias of `mcal`) |

Check with `-c`. Generate code with `-g`. Write the IDE project with `-P` (needs `-g` for MCAL and MCAL_EB). Compile a CMake project only after generate succeeds.

## Package root

Resolution order:

1. `-p` install root
2. YT Config Tool settings file: Windows `%APPDATA%/yt_config_tool/config.json`, macOS `~/Library/Application Support/yt_config_tool/config.json`, Linux `~/.config/yt_config_tool/config.json`. Keys: `sdkPath`, `mcalPath`, `mcalEbPath`
3. `userDataPath` plus the project type directory

Family folder under that root:

- `sdkVersion` is `dev`, or settings `withoutVer` is true: `root/family`
- otherwise: `root/family_sdkVersion`

`--sdkVer` or `--mcalVer` overwrites the version in the `.yct` before that lookup. The family folder must contain `sdk.json`, `mcal.json`, or `mcal_eb.json`.

CLI copies `env` entries from that config, including `TRESOS_BASE`, into the process environment when the variable is not already set.

## SDK

Check:

    yct_cli sdk -i app.yct -c

Generate the IDE project:

    yct_cli sdk -i app.yct -P --ide CMakeGCC

`-c` validates the project. `-P` writes IDE files. `--ide` is one of `EWARM`, `KEIL`, `CMakeGCC`, `CMakeEWARM`, `CMakeKEIL`, `CMakeGHS`.

| Flag | Required | Meaning |
|---|---|---|
| `-i, --input` | yes | `.yct` path |
| `--verbose` | no | Verbose log |
| `-c, --check` | no | Validate the `.yct` |
| `-p, --path` | no | SDK install root |
| `--ide` | no | IDE name, list above |
| `-O, --optimization` | no | CMake optimization. Must be legal for the toolchain |
| `--link` | no | Overwrite link file |
| `--sdkVer` | no | Overwrite `sdkVersion`, for example `1_0_3` |
| `-o, --output` | no | Output path. Default is the `.yct` directory |
| `-n, --name` | no | Overwrite project name |
| `-P, --project` | no | Also generate IDE files |

## MCAL

Check, including stub modules:

    yct_cli mcal -i app.yct -c -S

Generate code, copy MCAL sources, and write the IDE project:

    yct_cli mcal -i app.yct -g -P --copyMcal --ide CMakeGCC

`-c` validates loaded modules. Stub modules such as `EcuM` and `CanIf` are skipped unless `-S`. `-g` generates config code, including `Mcal.h`. `-gm Mcu Dio` limits generation to those modules. `--copyMcal` copies MCAL sources. `-P` needs `-g`.

## MCAL_EB

An MCAL_EB `.yct` has `type` `mcal_eb`. Module configuration lives in the EB Tresos project. `.yct` data is usually only `ytlink`.

Tresos project directory:

- `project.eb.projectPath` when set (absolute, or relative to the `.yct` directory)
- otherwise the `.yct` directory

That directory must contain `.prefs/pref_general.xdm`. Enabled modules and `GenerationPath` (often `output`) come from that file. `project.eb.stubModules` lists extra stub modules to pull in.

Generate, then the IDE project is ready to compile:

    yct_cli mcal_eb -i Dio_Demo.yct -g -P --copyMcal --ide CMakeGCC

- `-g` writes `board/Mcal.h`, or `project.generate.folder`
- `--copyMcal` copies driver sources from `plugin.json` move entries. Required before a link. Without it the build only has Tresos `output` and `Mcal.h`
- `-P` writes the IDE project. CMake toolchains also write `cmake/ebGenerate.cmake`
- `--ide` uses the same list as SDK. Omit it when the `.yct` toolchain is already correct
- `-c` does not run XDM validation on MCAL_EB

Compile a CMake project from the `.yct` directory:

    cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=../cmake/gcc.cmake -B build
    cmake --build build

Configure runs Tresos when `TRESOS_BASE` points at an install that contains `bin/tresos_cmd.bat` (Windows) or `bin/tresos_cmd.sh`. The YT Config Tool env value is written into `CMakeLists.txt`. Tresos C and H files stay in `GenerationPath`. CMake globs them together with the copied MCAL sources.

`mcal_eb` is an alias of `mcal`. The `.yct` `project.type` selects the flow. Shared flags:

| Flag | Required | Meaning |
|---|---|---|
| `-i, --input` | yes | `.yct` path |
| `--verbose` | no | Verbose log |
| `-c, --check` | no | Validate. MCAL_EB skips XDM validation |
| `-S, --stub` | no | Include stub modules such as `EcuM` and `CanIf` |
| `-p, --path` | no | MCAL or MCAL_EB install root |
| `-g, --generate` | no | Generate config code, including `Mcal.h` |
| `--copyMcal` | no | Copy MCAL sources from plugin move entries |
| `--ide` | no | Same IDE list as SDK |
| `-O, --optimization` | no | CMake optimization |
| `-gm, --generateModule` | no | Only these modules, for example `-gm Mcu Dio` |
| `--mcalVer` | no | Overwrite `sdkVersion`, for example `2_0_0` |
| `-P, --project` | no | IDE files. Needs `-g` |
| `-s, --save` | no | Write the loaded project back to the `.yct`, with a `.yct.bak` backup |

CMake optimization values:

- `CMakeEWARM`: `-On -Ol -Om -Oh -Ohs -Ohz`. Default `-Ol`.
- `CMakeKEIL`: `-O0 -O1 -O2 -O3 -Oz -Omin -Ofast -Omax -Os`. Default `-O1`.
- `CMakeGCC`: `-O0 -O1 -O2 -Os -Ofast`. Default `-O1`.
- `CMakeGHS`: `-Omaxdebug -Omoredebug -Odebug -Ogeneral -Osize -Ospeed -Onone`. Default `-Ogeneral`.


</code></pre>
]]></description><link>https://forum.ytmicro.com/topic/2308/yct_cli-命令行-agent-skill</link><generator>RSS for Node</generator><lastBuildDate>Wed, 21 Oct 2026 23:03:33 GMT</lastBuildDate><atom:link href="https://forum.ytmicro.com/topic/2308.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Oct 2026 07:05:04 GMT</pubDate><ttl>60</ttl></channel></rss>