Skip to content

feat(config): 定义 Terminal Profile 配置契约 - #275

Draft
Eric-Song-Nop wants to merge 1 commit into
nowledge-co:mainfrom
Eric-Song-Nop:feature/terminal-profiles-config
Draft

feat(config): 定义 Terminal Profile 配置契约#275
Eric-Song-Nop wants to merge 1 commit into
nowledge-co:mainfrom
Eric-Song-Nop:feature/terminal-profiles-config

Conversation

@Eric-Song-Nop

Copy link
Copy Markdown
Contributor

背景

这是 #274 的第一阶段:先定义 Terminal Profile 的配置契约,后续再接入设置界面、终端创建流程和各平台运行时。

本 PR 做了什么

  • 新增顶层 profiles 配置:
    • default:新建终端时使用的 Profile ID
    • list:按菜单顺序保存 Profile
  • 新增 TerminalProfileConfig
    • idname
    • kind = "shell" | "wsl"
    • programargs
    • starting_directory
    • startup_command
    • distribution(WSL)
    • theme
  • 使用结构化的 program + args,避免把平台相关的命令行转义提前固化进配置格式。
  • 空配置不会序列化出 [profiles],旧配置仍保持当前的平台 Shell 自动发现行为。
  • 增加旧配置兼容、默认值、Shell/WSL 解析及 TOML round-trip 单元测试。

配置示例

[profiles]
default = "ubuntu"

[[profiles.list]]
id = "pwsh"
name = "PowerShell"
program = "pwsh.exe"
args = ["-NoLogo"]
starting_directory = "%USERPROFILE%"
startup_command = "Invoke-ConBootstrap"
theme = "flexoki-light"

[[profiles.list]]
id = "ubuntu"
name = "Ubuntu 24.04"
kind = "wsl"
distribution = "Ubuntu-24.04"
program = "/bin/zsh"
args = ["-l"]
theme = "flexoki-dark"

明确不在本 PR 范围内

  • 不读取或应用 Profile 启动终端
  • 不实现 WSL Distribution 发现与启动参数转换
  • 不增加 Settings UI 的 Profile CRUD
  • 不应用每个 Profile 的终端主题
  • 不改动 Workspace Layout Profile;两者仍是不同概念

验证

  • cargo fmt -p con-core -- --check
  • cargo test -p con-core(93 passed)
  • ⚠️ cargo check -p con 在构建 con-ghostty 前置步骤被本机 Zig 版本拦截:当前为 0.16.0,仓库要求 0.15.2
  • ⚠️ cargo fmt --all -- --check 仍会命中本分支未修改的既有格式差异:crates/con-app/src/workspace/render.rs

Part of #274

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f3b908f-696e-463d-89e7-9983220debbd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant