Community编程与开发github.com

测试本地 Twoliter 变更

构建并测试本地对 twoliter 的修改,在发布前验证其功能。

测试本地 Twoliter 变更 是什么?

该技能指导开发者如何从本地源代码构建 twoliter,并配置相关工具包使用本地构建的二进制文件,以便在发布前测试变更。它适用于 twoliter 源码修改、调试、修复验证等场景。前提是需克隆 twoliter 仓库并安装 Rust 工具链。步骤包括修改源码、运行 `cargo build --release` 构建,然后通过设置 `TWOLITER_DIR` 环境变量指向本地构建目录,在工具包仓库(如 bottlerocket-core-kit)中执行 `make build`。验证时可通过检查命令输出确认本地 twoliter 被使用。常见问题包括变更未生效(需确认构建和路径正确)和构建错误(可使用 `cargo check`、`cargo clippy` 和 `cargo test` 调试)。要恢复使用发布版本,只需省略 `TWOLITER_DIR` 覆盖即可。该技能适用于任何支持 `TWOLITER_DIR` 环境变量的平台或 CI/CD 流程。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/cbgbt/bottlerocket-forest/tree/main/skills/test-local-twoliter

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

技能:测试本地 Twoliter 变更

目的

从本地源代码构建 twoliter,并配置工具包使用本地构建的二进制文件,以便在发布前测试修改。

何时使用

  • 对 twoliter 源代码进行修改时
  • 在创建 PR 前测试 twoliter 的改动
  • 调试 twoliter 的行为
  • 验证对 twoliter 的修复

前提条件

  • 在 forest 中克隆了 Twoliter 仓库
  • 已安装 Rust 工具链
  • 至少有一个用于测试的工具包仓库

操作步骤

1. 修改 twoliter 源代码

编辑 twoliter/twoliter/src/ 或 twoliter/twoliter/embedded/ 中的文件。

2. 构建 twoliter

cd twoliter
cargo build --release

二进制文件将位于 target/release/twoliter。

3. 测试变更

通过设置 TWOLITER_DIR 覆盖为本地构建目录:

cd kits/bottlerocket-core-kit
make build TWOLITER_DIR=./twoliter/target/release

4. 迭代修改

完成更多修改后:

# 重新构建 twoliter
cd ./twoliter
cargo build --release

# 再次测试
cd kits/bottlerocket-core-kit
make build TWOLITER_DIR=./twoliter/target/release

验证

通过检查路径来验证正在使用本地 twoliter:

cd kits/bottlerocket-core-kit
make build TWOLITER_DIR=./twoliter/target/release 2>&1 | head -5

您应该会看到修改后的 twoliter 正在被调用。

常见问题

变更未生效:

  • 确保在修改后运行了 cargo build --release
  • 验证 TWOLITER_DIR 中的路径是否正确
  • 检查二进制文件是否存在:ls -lh ./twoliter/target/release/twoliter

twoliter 构建错误:

  • 运行 cargo check 查看详细的错误信息
  • 运行 cargo clippy 捕获常见问题
  • 运行 cargo test 验证测试是否通过

工具包构建失败(使用本地 twoliter):

  • 检查 twoliter 输出中的错误信息
  • 通过临时修改 Makefile 或直接使用 twoliter 二进制文件,添加 --log-level debug

恢复到已发布版本

要恢复使用已发布版本,只需省略 TWOLITER_DIR 覆盖:

cd kits/bottlerocket-core-kit
make build

这将使用发布版本中的默认 tools/twoliter/twoliter。

相关技能

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

ad-hoc-implementation-plan

Transform a rough plan into implement-commit ready artifacts. Allows rigorous review while implementing.

build-kit-locally

Build a kit and publish it to a locally hosted registry for development testing

build-variant-from-local-kits

Build a variant using locally published kits for development validation

deep-research

Create educational documents that build understanding progressively with citations

edit-spec-file

Edit Bottlerocket RPM spec files following project style conventions

fact-find

Quick lookup of specific facts about Bottlerocket with citations

idea-honing

Clarify feature ideas through iterative Q&A, recording insights to guide concept development

implement-commit

Implement commits from an implementation plan using a TDD pipeline

local-registry

Start and manage a local OCI registry for Bottlerocket kit development

prepare-core-kit-release

Prepare bottlerocket-core-kit for release by bumping version and updating changelog

propose-feature-concept

Create a new feature concept document to pitch the idea and explain the problem/solution

propose-feature-design

Create or update feature technical design document with architecture and implementation guidance

propose-feature-requirements

Create or update feature requirements specification using EARS notation with examples and appendices

propose-feature-test-plan

Create a test plan mapping EARS requirements and Critical Constraints to specific tests

propose-implementation-plan

Create an implementation plan with atomic commits that build toward a complete feature

review-code

Deep code review generating PR comments via principled question-driven analysis

review-scope

Verify code changes match intended scope and requirements without exceeding boundaries

review-style

Verify code follows project style guides without providing improvement suggestions

update-twoliter

Update all Bottlerocket repositories to a new Twoliter version

相关技能