跳到正文
cccskills
免费在 GitHub 公开

formax-tool-ui-blocks-workflow

Implement or refactor Formax tool transcript UI using the Tool UI Blocks (C-lite) pattern (ToolUiBlocks renderer + blocks presenters) to avoid touching many tool presenter files; use when adjusting ⏺/⎿ spacing, indent rules, or migrating additional tools to blocks presenters with targeted Ink/Vitest tests and Codex review before commit.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md5.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Formax Tool UI Blocks (C-lite) Workflow

Goal

Stabilize and evolve the tool transcript UI with minimal churn:

  • Centralize common formatting (⏺ spacing, ⎿/indent rules) in one renderer.
  • Keep per-tool custom UI possible, but avoid “change one space → edit 20 files”.
  • Migrate tools incrementally (dual-track: legacy React presenter + blocks presenter).

Scope / non-goals

  • Do not redesign tool semantics (e.g. “Read+Edit => Update”) unless explicitly requested.
  • Do not run bun run test:coverage for this workflow; only run tests for touched files.

Current building blocks

  • Renderer: packages/core/src/components/tool/ToolUiBlocks.tsx
  • Block types: packages/core/src/components/tool/toolUiBlocksTypes.ts
  • Dispatch: packages/core/src/components/tool/ToolRouter.tsx
  • Presenter typing helpers: packages/core/src/shared/toolPresenterContracts.ts
  • Shared primitives:
    • packages/core/src/components/ui/PulsingDot.tsx
    • packages/core/src/components/tool/ToolHeaderLine.tsx
    • packages/core/src/components/tool/ToolSubline.tsx
    • packages/core/src/components/tool/toolUi.ts

Workflow (repeatable loop)

Migration prioritization template

When deciding which tools to migrate next, use this ordering to minimize risk and maximize payoff:

  1. Simple + high frequency: pure renderers with stable output and no React hooks (e.g. read, grep, glob).
  2. Simple + formatting sensitive: tools whose transcript format is often tweaked (indent/spacing), and currently cause multi-file churn.
  3. Moderate complexity: presenters that assemble multiple lines but still have no hooks (e.g. webSearch, webFetch), migrate only after 1–2 is stable.
  4. Do not migrate yet: anything that needs hooks/interaction or complex previews (e.g. approval/policy overlays, edit/write patch previews). Keep as React presenters until they’re explicitly refactored into “data shaping” + “rendering”.

Rule of thumb: migrate 2–4 tools per commit and keep each commit testable with 1–3 focused test files.

1) Lock the behavior with tests first

Add or update targeted tests before refactoring:

  • For spacing/indent rules: packages/core/src/components/tool/ToolUiBlocks.test.tsx
  • For dispatch rules (legacy vs blocks): packages/core/src/components/tool/ToolRouter.test.tsx
  • For a migrated tool: its packages/core/src/tools/modules/<name>/presenter.test.tsx

Prefer assertions on plain-text frames (via ink-testing-library) that verify:

  • ⏺ has exactly one trailing space (⏺ Read, not ⏺Read or ⏺ Read)
  • Subline uses the Claude-style prefix and indent rules (e.g. ⎿ + following content)
  • No “double indent” artifacts for sublines

2) Apply changes in the centralized layer

If the change is “global formatting”, change it in one of:

  • PulsingDot.tsx for bullet spacing
  • ToolHeaderLine.tsx for header composition (dot + label + params)
  • ToolSubline.tsx / packages/core/src/components/tool/toolUi.ts for subline prefix + indentation
  • ToolUiBlocks.tsx for block-to-UI mapping and composition

Do not change dozens of tool presenters for global spacing changes.

3) Migrate a tool to blocks presenter (optional, incremental)

Only migrate tools that are “simple UI” (no hooks, no interactive UI) first.

Steps:

  1. In packages/core/src/tools/modules/<name>/presenter.tsx, switch to blocks presenter:
    • Return { blocks: ToolUiBlock[] }
    • Wrap with createToolBlocksPresenter(...)
  2. Keep legacy presenters untouched for other tools.
  3. Update that tool’s presenter.test.tsx to render the blocks output through <ToolUiBlocks />.

4) Run only the relevant tests

Run Vitest for the touched files only. Example:

bun run test -- packages/core/src/components/tool/ToolUiBlocks.test.tsx
bun run test -- packages/core/src/components/tool/ToolRouter.test.tsx
bun run test -- packages/core/src/tools/modules/<name>/presenter.test.tsx

5) Run Codex review before committing

Follow AGENTS.md -> Review Profile (Single Source of Truth). Fix high/medium findings; only take low-risk low findings when low-churn.

6) Commit

Use a conventional message, e.g.:

  • refactor(tool-ui): migrate grep to blocks presenter
  • fix(tool-ui): keep single space after bullet

Gotchas / guardrails

  • Case-insensitive filesystem collisions (macOS):
    • Avoid having both ToolUiBlocks.* and toolUiBlocks.* with similar names that can be confused by tooling.
    • Prefer a distinct type filename like toolUiBlocksTypes.ts.
  • Avoid hidden whitespace from JSX formatting:
    • For spacing-sensitive UI, prefer composing the full string ({⏺ }) rather than placing newlines/indentation inside <Text>...</Text>.
  • Hooks rule:
    • Blocks presenters are plain functions; they must not call React hooks.
    • If a tool presenter needs hooks, keep it as a React presenter and consider a later refactor to split “data shaping” from “rendering”.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use when a Formax repository task is non-trivial and you should analyze goals, non-goals, boundaries, data/type/interface impact, contract impact, test strategy, and whether an xhigh subagent is actually needed before writing a todo or code.

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

Use when adding or changing any Approval prompt/presenter.

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

Use when implementing or extending /config (storage, prompt injection, request params, UI-only toggles) with tests and strict UI parity.

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

Use when working on Formax code changes and you need a disciplined dev loop: keep a single mainline task, avoid scope drift, run only targeted tests (no coverage), avoid partial staging (MM), run mandatory review before commit, include an incremental optimization check, and keep commits small and reviewable.

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

Use when implementing/debugging Ctrl+O Expanded Transcript (second view) and thinking persistence in the REPL.

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

Use when implementing or debugging Formax permissions/policy/approval behavior and UI (allow/ask/deny rules, workspace boundaries, approval prompts, and /permissions overlay parity with Claude Code).

中文简介正在准备中。当前显示原文说明。

yusifeng/formax1942026年7月25日 更新

查看 yusifeng 的全部技能

报告此技能的问题