Chuyển tới nội dung

Pro đang mở bán trước. Cài đặt mở từ tháng 1/2027. Xem Pro

Tài liệu

CLI

CLI có trên npm với tên werewolf-ui; trang này mô tả bản 0.1.0-alpha.1. Chạy mọi lệnh trong app dưới dạng npx werewolf-ui <lệnh>. Đừng dùng npx wolf: lệnh đó chạy một package không liên quan.

Các lệnh

LệnhLàm gìGhi file
initSeed, stylesheet token, CSS import và luật cho agentCó
add <name...>Mã nguồn component và dependencyCó, và chạy package manager
themeĐổi lựa chọn trong seed và tạo lại stylesheetSeed và stylesheet
lint [paths...]Kiểm tra style tĩnh, có thể tự sửa an toànChỉ khi có --fix
mcpMCP server chạy local với năm công cụ chỉ đọcKhông bao giờ
tokens buildXuất token cho một nền tảngTrong --out
docs [component]In URL tài liệu và mở nó trong terminalKhông bao giờ

init

npx werewolf-ui init
npx werewolf-ui init --cwd ./apps/web --package-manager pnpm
npx werewolf-ui init --agent claude,copilot

Thiết lập app một lần. Chỉ tạo werewolf.json và seed nếu chưa có, ghi stylesheet token, thêm một dòng import sau import Tailwind, và cài luật cho agent. Chạy lại khi không có gì đổi thì không ghi gì.

Tùy chọnGiá trị
--cssStylesheet của app có import Tailwind
--seedĐường dẫn seed. Mặc định tokens/seed.json
--outputStylesheet được tạo. Mặc định styles/werewolf.css
--package-managernpm, pnpm, yarn hoặc bun, khi không có lockfile hoặc thông tin không khớp
--agentclaude, copilot, windsurf, gemini, cline, cursor, codex, jules, amp, other hoặc all, phân cách bằng dấu phẩy

add

npx werewolf-ui add button input dialog
npx werewolf-ui add button --overwrite src/components/ui/button.tsx

Cần init trước. Giải quyết dependency trong registry, cài package npm còn thiếu trước, ánh xạ import theo alias, rồi mới ghi file. File giống hệt được bỏ qua; file khác nội dung báo xung đột cho tới khi bạn truyền đường dẫn của nó vào --overwrite.

theme

npx werewolf-ui theme --accent "<hex>" --gray-tint 0.25 --radius-base round

Chỉ đổi những lựa chọn bạn truyền vào và tạo lại stylesheet. Cả hai chế độ phải qua mọi kiểm tra tương phản trước khi ghi.

Tùy chọnGiá trị
--accentMàu hex 3 hoặc 6 ký tự
--gray-tintSố từ 0 đến 1
--radius-basesharp, default, round, pill, hoặc giá trị px như 6px

lint

npx werewolf-ui lint
npx werewolf-ui lint src --fix

Kiểm tra file .js, .jsx, .ts, .tsx, .mjs và .css, tối đa 500 file và 1 MiB mỗi file. Đường dẫn là file hoặc thư mục tính từ dự án, không dùng glob. Lint không cài gì và chạy được cả trước init. --fix chỉ áp dụng chỉnh sửa chính xác và phân tích lại trước khi ghi.

mcp

npx werewolf-ui mcp --cwd ./my-app

Khởi động MCP server local qua stdio để client gọi. Thư mục nào đã tồn tại cũng được. Xem AI agent và MCP để cài client.

tokens build

npx werewolf-ui tokens build --out exported-tokens
npx werewolf-ui tokens build --platform android --out exported-tokens

Cần init trước. Xuất json/dark.json và json/light.json cùng file của một nền tảng, không thay đổi seed.

Tùy chọnGiá trị
--platformweb (mặc định), ios hoặc android
--outBắt buộc. Một thư mục bên trong dự án

docs

npx werewolf-ui docs
npx werewolf-ui docs date-picker

In URL trang của component, hoặc trang cài đặt nếu không truyền tên. Lệnh chỉ mở trình duyệt trong terminal tương tác và khi không có --json. Site mô tả phiên bản mới nhất, có thể khác bản CLI bạn đang cài.

Tùy chọn cho mọi lệnh

  • --help in mọi lệnh; <lệnh> --help chỉ in lệnh đó.
  • --yes dùng được ở mọi lệnh. Không lệnh nào hỏi lại, và --yes không bao giờ cho phép ghi đè.
  • --json in đúng một bản kết quả ra stdout và không gì khác: schemaVersion, command, ok, data và diagnostics.
  • --cwd <path> chọn app. Mỗi tùy chọn nhận một giá trị, viết --cwd ./apps/web, không viết --cwd=./apps/web.
  • --overwrite <path> thay một file được tạo cụ thể sau khi bạn đã xem. Đây là tùy chọn duy nhất được lặp lại.

Mã thoát

MãÝ nghĩa
0Thành công. Lint không thấy lỗi, có thể còn cảnh báo.
1Lỗi khi chạy: xung đột, ghi file hoặc cài package thất bại. Lint tìm thấy lỗi.
2Tham số sai, component không tồn tại, seed không hợp lệ, hoặc dự án không được hỗ trợ hay chưa rõ ràng.
130Đã hủy.

Xung đột và ghi đè

  • CLI ghi lại những gì nó tạo trong .werewolf/managed.json. File được tạo chưa bị sửa sẽ được cập nhật; file bạn đã sửa trả về WW_CONFLICT kèm đường dẫn chính xác, và không có gì được ghi.
  • --overwrite chỉ chọn được file do CLI tạo, component trong lệnh hiện tại hoặc file được xuất. Nó không bao giờ chọn được seed, werewolf.json, stylesheet của app hay AGENTS.md.
  • Ghi file thất bại thì được hoàn tác. Việc cài package thì không.

Mã chẩn đoán

Thông báo bằng tiếng Anh và có thể đổi; mã thì cố định. Trang Xử lý sự cố giải thích các mã hay gặp.

CodeExitMeaning
WW_ARGUMENT2Unknown, missing, repeated or malformed option or value.
WW_ASSETS1The packaged catalog is missing, unreadable or invalid. Reinstall the package.
WW_CANCELLED130Lint or a file transaction was cancelled. No clean result is available.
WW_CLASS_REMOVEDlint errorA palette utility that the system does not generate.
WW_COLOR_LITERALlint errorA hardcoded color where a semantic color token is required.
WW_COMMAND2Unknown command or unsupported top-level arguments.
WW_COMPONENT2Unknown component name.
WW_CONFLICT1A file differs from what the CLI expects, or changed during the command.
WW_CSS_IMPORT2The app stylesheet is missing or malformed, or its styling and theme imports are missing, duplicated or misplaced.
WW_CURSOR2A pagination cursor is invalid, stale or from different filters (MCP).
WW_DARK_VARIANTlint errorA dark: variant; tokens switch with data-theme.
WW_DEPENDENCY2Invalid dependency spec or unsupported package manager.
WW_DEPENDENCY_CONFLICT2Requested and declared dependency versions disagree.
WW_DYNAMIClint warningA style expression that cannot be resolved statically.
WW_ENCODINGlint error, or 1A source file is not valid UTF-8; fixes are not applied in that run. An ignore file that is not valid UTF-8 stops lint with exit 1.
WW_FIX_INVALID1Proposed fixes are invalid or cannot be fully reanalyzed. Nothing was written.
WW_FIX_OVERLAP1Proposed fixes overlap. Nothing was written.
WW_FIX_PARSE1A fix would introduce a parse failure. Nothing was written.
WW_IMPORT2Component source imports cannot be parsed or mapped to the app's aliases.
WW_INSTALL1The package manager failed or its launcher cannot be resolved. No component files were committed.
WW_INTERNALnoneAn MCP tool could not complete or produced an invalid result.
WW_IO1An unexpected filesystem or runtime error.
WW_LIMITlint error, or 1A file, file count or traversal limit was exceeded. An ignore file over 1 MiB stops lint with exit 1. MCP returns it for oversized input.
WW_NOT_INITIALIZED1The app has no werewolf.json, seed or ownership record. Run npx werewolf-ui init --yes.
WW_OPACITYlint errorA color with alpha, or an opacity outside the role tokens.
WW_OPEN0 (warning)The docs URL could not be opened in a browser. Open it yourself.
WW_PARSElint errorA source file cannot be parsed. Its styles were not checked.
WW_PATH2A path is absolute, escapes the project, crosses a symlink or changed its target.
WW_PLATFORM2--platform is not web, ios or android.
WW_PROJECT_ALIAS2Compiler aliases are missing, ambiguous or disagree with werewolf.json.
WW_PROJECT_AMBIGUOUS2A workspace root, several frameworks, stylesheets or lockfiles, or a lockfile that disagrees with packageManager. Select explicitly.
WW_PROJECT_CONFIG2werewolf.json or a compatible registry config is invalid.
WW_PROJECT_ROOT2No app package.json at the selected directory.
WW_PROJECT_VERSION2Node, React or the styling framework version is unsupported or undeclared.
WW_PROTOCOL1MCP input or output failed; the connection is closed.
WW_SEED2The seed is malformed or a choice is out of range.
WW_SIZElint errorA control height outside the element size tokens, or a per-breakpoint size.
WW_SOLID_PAIRlint errorAn on-solid text or icon token paired with a different fill.
WW_SPACINGlint errorNumeric or arbitrary spacing where a spacing token is required.
WW_SYMLINKlint warningA symbolic link was skipped during traversal.
WW_TOKEN_PROPERTYlint errorA real token used for a property it does not supply.
WW_TOKEN_UNKNOWNlint errorA token name that does not exist.
WW_TRUNCATED1 (lint)The diagnostic limit was reached; rerun on fewer files.
WW_WRITE1A file transaction failed. Retained backup paths are listed if rollback was incomplete.
WW_WRITE_PLAN2--overwrite names a path this command does not manage, or an internal write plan is invalid.