# Machine Context Custom Fields — Frontend Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. > **Parallel plan:** This is the frontend half. The backend plan is at `2026-04-02-machine-context-fields-backend.md`. Both can run in parallel on separate worktrees — they share no files. Frontend tests requiring the API will need the backend done first. **Goal:** Add `machineContextOnly` toggle in structure editors, filter context fields from standalone pages, and display/edit them in the machine detail view. **Architecture:** Structure editors get a checkbox per field. The machine-detail transform propagates `contextCustomFields`/`contextCustomFieldValues` from the API link response onto the component/piece objects. Standalone entity views filter these out. Machine view displays them in a separate "Champs contextuels" section using the existing `CustomFieldDisplay` component, saving via upsert with the link ID. **Tech Stack:** Nuxt 4, Vue 3 Composition API, TypeScript, DaisyUI 5 **Spec:** `docs/superpowers/specs/2026-04-02-machine-context-custom-fields-design.md` --- ## File Map ### Modify - `frontend/app/shared/types/inventory.ts` — add `machineContextOnly` to custom field types - `frontend/app/components/PieceModelStructureEditor.vue` — add checkbox toggle - `frontend/app/composables/usePieceStructureEditorLogic.ts` — add default in `createEmptyField()` - `frontend/app/components/StructureNodeEditor.vue` — add checkbox toggle - `frontend/app/composables/useStructureNodeCrud.ts` — add default in `addCustomField()` - `frontend/app/composables/useEntityCustomFields.ts` — filter out `machineContextOnly` fields - `frontend/app/composables/useMachineDetailCustomFields.ts` — propagate context fields, filter from normal merge - `frontend/app/components/ComponentItem.vue` — display context custom fields section - `frontend/app/components/PieceItem.vue` — display context custom fields section --- ## Task 1: Types — add `machineContextOnly` **Files:** - Modify: `frontend/app/shared/types/inventory.ts` - [ ] **Step 1: Add `machineContextOnly` to `ComponentModelCustomField`** In the `ComponentModelCustomField` interface (around line 14), add: ```typescript machineContextOnly?: boolean ``` - [ ] **Step 2: Add `machineContextOnly` to `PieceModelCustomField`** In the `PieceModelCustomField` interface (around line 65), add: ```typescript machineContextOnly?: boolean ``` - [ ] **Step 3: Commit** ```bash cd frontend && git add app/shared/types/inventory.ts git commit -m "feat(custom-fields) : add machineContextOnly to custom field types" ``` --- ## Task 2: Structure editors — add toggle **Files:** - Modify: `frontend/app/components/PieceModelStructureEditor.vue:122-125` - Modify: `frontend/app/composables/usePieceStructureEditorLogic.ts:283-290` - Modify: `frontend/app/components/StructureNodeEditor.vue:121-125` - Modify: `frontend/app/composables/useStructureNodeCrud.ts:49-62` - [ ] **Step 1: Add toggle in `PieceModelStructureEditor.vue`** After the "Obligatoire" checkbox block (line 125, after `` closing the required checkbox), add: ```vue