AgentSkillsCN

ww-scaffold-view

为WibWob-DOS搭建新的TView窗口类型。生成C++头文件与实现文件,修改CMakeLists.txt,并可根据用户指定的并行范围,可选地对接菜单、命令注册表、IPC、REST以及MCP接口。当用户说“搭建视图”“新建视图”“添加窗口类型”“WW-搭建视图”,或描述希望在TUI应用中新增一个TView子类时使用此功能。

SKILL.md
--- frontmatter
name: ww-scaffold-view
description: Scaffold a new TView window type for WibWob-DOS. Generates C++ header/implementation, patches CMakeLists.txt, and optionally wires menu, command registry, IPC, REST, and MCP surfaces based on requested parity scope. Use when user says "scaffold view", "new view", "add window type", "ww-scaffold-view", or describes wanting a new TView subclass in the TUI app.

ww-scaffold-view

Scaffold a new TView window type across WibWob-DOS command surfaces.

Inputs

Ask for any not provided:

InputRequiredExampleNotes
view_nameyesparticle_fieldsnake_case, becomes TParticleFieldView
window_titleyes"Particle Field"Human-readable for TWindow
typeyesview-onlyview-only, window+view, browser-like, animation-like
parity_scopenoui+registryui-only, ui+registry, full-parity. Default: ui+registry
issue_idno#42Required for non-trivial work per repo canon
descriptionnoAnimated particle systemOne-line for comments and registry

Parity Scope

ScopeC++CMakeMenuRegistryIPCRESTMCPPy models
ui-onlyyesyesyes-----
ui+registryyesyesyesyes----
full-parityyesyesyesyesyesyesyesyes

Procedure

1. Find next command ID

Scan app/test_pattern_app.cpp for highest const ushort cm* = NNN;, use NNN+1.

2. Generate C++ files

Create app/{name}_view.h and app/{name}_view.cpp. See references/templates.md for exact templates by type.

3. Patch CMakeLists

Add {name}_view.cpp to test_pattern sources in app/CMakeLists.txt.

4. Patch test_pattern_app.cpp

  1. #include "{name}_view.h" near other view includes (~line 77)
  2. const ushort cm{PascalName} = {next_id}; with command constants
  3. Forward-declare factory: class TWindow; TWindow* create{PascalName}Window(const TRect &bounds);
  4. Menu item under View (Generative/Animated/Utility)
  5. handleEvent case dispatching to factory

5. Patch registry (if ui+registry or full-parity)

In app/command_registry.cpp:

  • Add capability: {"open_{name}", "Open {title} window", false}
  • Add dispatch case in exec_registry_command()

6. Patch Python surfaces (only full-parity)

  • tools/api_server/models.pyWindowType enum value
  • tools/api_server/controller.pycreate_window() case
  • tools/api_server/mcp_tools.py — update valid types in docstring

7. Build

bash
cmake --build ./build --target test_pattern 2>&1

8. Parity report

code
PARITY REPORT: {name}_view
============================
registry:  yes/no
menu:      yes/no
ipc:       yes/no
rest:      yes/no
mcp:       yes/no
schemas:   yes/no

Guardrails

  • Never raw ANSI in TDrawBuffer. browser-like types include parse boundary comments.
  • Files: snake_case.cpp/.h. Classes: T{PascalCase}View. Factory: create{PascalCase}Window.
  • gfGrowHiX | gfGrowHiY growMode. ofTileable on TWindow.
  • Animated types use TTimerId pattern from animated_blocks_view.

Acceptance

  • cmake --build ./build --target test_pattern passes
  • No unused command IDs
  • Parity report clean for requested scope