Skip to content

feat(codeup) - add codeup supprot#299

Open
zevwings wants to merge 5 commits intomasterfrom
feature/add-codeup-support
Open

feat(codeup) - add codeup supprot#299
zevwings wants to merge 5 commits intomasterfrom
feature/add-codeup-support

Conversation

@zevwings
Copy link
Owner

PR Ready

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change which does not change functionality)
  • Hotfix (urgent fix for production issues)
  • Chore (maintenance tasks and non-functional changes)

Summary

在系统中新增对 Codeup 平台的完整支持,包括配置、HTTP 客户端、业务服务以及仓储层的实现,实现跨 crate 的依赖注入。

Key Changes

  • 新增 CodeupSettings 配置结构并在全局配置中暴露
  • 实现 Codeup HTTP 客户端并完成 DI 注册
  • 提供 CodeupRepository 实现,封装 mutation 与 query 服务
  • 在 bootstrap 中注册配置上下文、客户端和仓储,并新增获取函数
  • 新增一系列 Codeup 相关的实体、错误、类型定义

Changes

Features

  • Codeup 客户端实现
  • CodeupRepository 具体实现
  • Codeup 配置上下文

Refactors

  • 修改 bootstrap 相关文件以加入 Codeup 绑定和 getter
  • 更新全局配置模块以支持 CodeupSettings

Configuration

  • 新增 crates/domain/src/config/global/codeup/config.rs 中的 CodeupSettings
  • 在全局配置中加入 codeup 模块并重新导出

Impact Analysis

Affected Modules

Module Impact Severity
crates/domain/src/config/global/codeup 新增配置结构并在全局配置中暴露 low
crates/infra/src/codeup 提供 HTTP 客户端实现并注册到 DI 容器 low
crates/storage/src/codeup 实现仓储层并封装业务服务 medium
crates/app/src/bootstrap 新增 Codeup 相关的 DI 绑定和 getter low

Risk Assessment

Overall risk: medium

Risk factors:

  • 部分仓储方法返回占位 ApiError,可能导致运行时错误
  • 配置结构若缺失必填字段会在后续使用时触发错误

Mitigation:

  • 尽快实现占位方法的真实逻辑
  • 在 CodeupContextImpl 中加入配置完整性校验并在启动时报错

Testing Suggestions

  • 验证 CodeupSettings 的 TOML 序列化/反序列化行为
  • 测试 DI 容器能成功解析并返回 CodeupClient、CodeupRepository 实例
  • 为仓储的参数校验编写单元测试,确保错误路径被正确触发

Statistics

Metric Value
Total files 36
Additions +22
Deletions -0
Net change 22
Added files 22
Modified files 14
Deleted files 0
Renamed files 0

Review Info

  • Complexity: complex
  • Review priority: high
  • Estimated review time: 30 minutes
  • Tags: feature, codeup, integration

Introduce full Codeup platform support.

- New CLI subcommands `codeup check` and `codeup setup` for interactive configuration and verification.
- Added `CodeupStage` to the workflow pipeline, including form handling, configuration display, and verification integration.
- Implemented display formatter to render Codeup configuration and verification results as tables and messages.
- Extended domain layer with `CodeupConfigInfo`, `CodeupVerificationResult`, and related enums.
- Updated `VerificationService` to verify Codeup settings via the repository.
- Adjusted stage manager ordering to include Codeup and updated logger mapping.
- Exported new modules through `app::commands::codeup` and `domain::config::global`.

These changes enable users to manage Codeup credentials, validate them, and see clear feedback directly from the CLI workflow.
Add interactive confirmation steps when configuring platforms.

- Extend `platform/config.rs` to import `confirm` and ask the user whether to configure a detected platform after adding the account.
- Refactor `platforms/codeup.rs` to separate the logic for new vs. existing Codeup configurations, prompting the user to configure when none exists and to keep current values when one is already present.
- Improves user experience by preventing accidental overwrites and giving explicit control over configuration actions.

Closes #0
Improve the interactive SSH workflow by detecting SSH keys that exist on disk but are not loaded into the agent and by introducing a typed action enum for clearer option handling.

- Implement `has_unloaded_keys()` in `util/ssh/add.rs` to scan for keys not yet loaded.
- Refactor `platforms/ssh.rs` to use a new `SshAction` enum, simplifying the selection logic and making the flow more explicit.
- Update the interactive menu to present actions based on actual key state (add, generate, remove, continue/done).
- Clean up duplicate imports and re‑exports in `util/mod.rs` and `util/ssh/mod.rs`.
- Add documentation comments for SSH result formatting.
- Minor clean‑up in `stage.rs` and `codeup.rs` to remove redundant warning lines.

The changes provide a more robust user experience during `workflow ssh` commands, ensuring users are prompted only with relevant actions and that unloaded keys are surfaced automatically.
### Why
The SSH interactive stage showed the **RemoveKey** action even when the workflow was not in command mode, leading to a confusing UI. Additionally, the selection prompt did not provide a sensible default, forcing users to manually confirm the last option.

### What
- Refactored the conditional logic so the **RemoveKey** option is only added when `has_keys` is true **and** the workflow mode is `Command`.
- Introduced a `default_idx` variable and applied `.default(default_idx)` to the selection prompt, making the last option the default choice.

### How
- Merged the nested `if has_keys { if has_keys && ... }` into a single condition `if has_keys && context.mode() == WorkflowMode::Command`.
- Re‑used the existing options vector length to compute the default index and passed it to the `select!` macro via the `.default()` builder method.
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