Community程式設計與開發github.com

測試本地端 Twoliter 變更

在發布前建置並測試 twoliter 的本機變更。

測試本地端 Twoliter 變更 是什麼?

此技能旨在讓開發者在發布前,能從本機原始碼建置 twoliter,並設定 kit 儲存庫使用本機建置的二進位檔進行測試。其流程包含:對 twoliter 原始碼進行修改、使用 `cargo build --release` 進行建置、透過 `TWOLITER_DIR` 環境變數覆寫路徑以便 kit 建置時使用本機二進位檔,以及反覆迭代修改與驗證。此技能支援在具備 Rust 工具鏈且已複製 twoliter 儲存庫的環境中使用,適用於變更 twoliter 原始碼、測試修改、除錯或驗證修正等場景。最後,也可透過省略 `TWOLITER_DIR` 覆寫,輕鬆還原回已發布版本。

相容平台~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,並設定 kits 使用本地端建置的二進位檔,以便在發布前測試變更。

使用時機

  • 對 twoliter 原始碼進行修改時
  • 在建立 PR 前測試 twoliter 的修改
  • 除錯 twoliter 的行為
  • 驗證對 twoliter 的修正

先決條件

  • 在 forest 中已複製 twoliter 儲存庫
  • 已安裝 Rust 工具鏈
  • 至少一個 kit 儲存庫可供測試

步驟

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 時 kit 建置失敗:

  • 檢查 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

相關技能