adapt-materal-enums
Materal Framework Enum Adapter
Specialized workflow for Materal framework enum adaptation with semantic naming.
Prerequisites
pnpm add -D @aptx/frontend-tk-cli
Strict Workflow
- Fetch enum patch from provider API
- LLM fills
suggested_namebased oncommentfield (noValue1/Value2style allowed) - Apply patch only after all
suggested_namefields are filled - Cleanup intermediate files in production
Commands
# 1) Fetch Materal enum patch (disable auto-naming, delegate to LLM)
pnpm exec aptx-ft -i <spec-file> materal enum-patch \
--base-url <base-url> \
--output ./tmp/enum-patch.json \
--naming-strategy none
# 2) LLM fills suggested_name in patch
# Rule: Translate comment to semantic PascalCase name, preserve value/comment
# 3) Apply translated patch (requires non-empty suggested_name)
pnpm exec aptx-ft -i <spec-file> model enum-apply \
--patch ./tmp/enum-patch.translated.json \
--output ./generated/models \
--style module \
--conflict-policy patch-first
# 4) Cleanup intermediate files (required in production)
rm -f ./tmp/enum-patch.json ./tmp/enum-patch.translated.json
Alternative (without pnpm):
npx aptx-ft -i <spec-file> materal enum-patch --base-url <base-url> --output ./tmp/enum-patch.json --naming-strategy none
npx aptx-ft -i <spec-file> model enum-apply --patch ./tmp/enum-patch.translated.json --output ./generated/models --style module --conflict-policy patch-first
Advanced Options
| Option | Default | Description |
|---|---|---|
--max-retries <n> |
3 | Max retry attempts on network failure |
--timeout-ms <ms> |
10000 | Request timeout in milliseconds |
pnpm exec aptx-ft -i <spec-file> materal enum-patch \
--base-url <base-url> \
--output ./tmp/enum-patch.json \
--naming-strategy none \
--max-retries 5 \
--timeout-ms 30000
Output Files
| File | Description |
|---|---|
enum-patch.json |
Raw patch from API (value/suggested_name/comment) |
enum-patch.translated.json |
LLM-filled patch |
./generated/models/ |
Final TypeScript models with adapted enums |
Cleanup required: Delete enum-patch.json and enum-patch.translated.json after successful apply.
Boundaries
This skill is ONLY for Materal framework adaptation:
- Generic OpenAPI projects → use
generate-artifactsorgenerate-models - Requires access to Materal enum provider API
- Does not validate Materal API availability
Related Skills
- generate-models: Generic model generation
- generate-artifacts: Full artifact generation
More from haibaraaiaptx/frontend-openapi-skills
download-openapi
Download remote OpenAPI/Swagger JSON specification from a URL to local file using aptx-ft CLI. TRIGGER when user mentions: (1) fetch/pull/download swagger or openapi from URL, (2) save API spec to openapi.json locally, (3) get API documentation from server, or (4) prepare local input for code generation. DO NOT TRIGGER when: generating code/types from local file, reading existing openapi.json, downloading non-OpenAPI files, or authentication is required.
25generate-artifacts
Generate frontend artifacts from OpenAPI via aptx-ft, including models and request clients. Use when user wants: (1) to generate API code from OpenAPI/Swagger, (2) React Query hooks from API spec, (3) Vue Query composables from API spec, (4) function-based API clients, (5) a standard flow for frontend projects without framework-specific business adaptation, (6) track generated files with manifest, (7) preview changes before generation, or (8) update barrel files automatically.
24generate-models
Generate TypeScript interfaces and enums from OpenAPI schemas using aptx-ft CLI. Use when user asks to: (1) generate types/models from OpenAPI/Swagger, (2) create TypeScript interfaces from API schema, (3) extract type definitions from openapi.json, (4) generate selective models with --name filter, (5) preserve translated enum values, (6) track generated files with manifest, (7) preview changes before generation, or (8) update barrel files automatically. Do NOT use for full artifact generation with request layer or Material UI enum adaptation.
23generate-barrels
Generate barrel index.ts files for TypeScript projects. Use when user mentions: (1) barrel files, (2) index.ts exports, (3) re-export files, (4) simplify import paths, (5) create index files for directory, or (6) generate export aggregators.
18download-swagger-file
从 URL 下载 OpenAPI 3.x JSON 规范文件。用于:(1)从远程服务器获取 API 规范,(2)将 OpenAPI JSON 保存到本地,(3)为 TypeScript 模型生成准备规范。
6write-plugin
Write custom JS plugins for the aptx-ft CLI to add commands, generate code, or analyze OpenAPI specs. Use when: (1) writing or loading a plugin file (.js/.ts), (2) using --plugin/-p CLI flag, (3) creating custom CLI subcommands, (4) accessing parsed OpenAPI data via ctx.getIr/PluginContext/GeneratorInput, (5) building custom code generators (e.g. Axios clients), (6) producing reports from OpenAPI specs, (7) questions about PluginDescriptor/CommandDescriptor/OptionDescriptor. Do NOT use for standard generation (models, react-query, vue-query, barrel files) — use generate-artifacts or generate-models instead.
5