Skip to content

Commit 28fb7d9

Browse files
avivturcursoragent
andauthored
Add backend expert knowledge base from forklift Go codebase analysis (#2408)
* Add backend expert knowledge base from forklift Go codebase analysis Systematically analyzed the kubev2v/forklift backend codebase (~126K lines of Go) and produced 24 structured knowledge files covering all domain areas: providers (7 types + common controller), plan/migration pipeline, network/storage mappings, webhooks, REST API, virt-v2v, shared libraries, monitoring, and the Ansible operator. Added a routing table to forklift-expert.mdc so the agent loads the right backend knowledge file per topic. Included a reusable scraper skill (backend-analyzer) for refreshing the knowledge when the backend changes. Resolves: None Signed-off-by: Aviv Turgeman <aturgema@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> * Document Conversion CRD and react-hook-form validation pattern Added Conversion CRD documentation to project-context.mdc (types, phases, stages, selectors). Added getValues vs useWatch validation pattern to AGENTS.md for cross-field form dependencies. Resolves: None Signed-off-by: Aviv Turgeman <aturgema@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com> --------- Signed-off-by: Aviv Turgeman <aturgema@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ce4a4d4 commit 28fb7d9

29 files changed

Lines changed: 6947 additions & 3 deletions

.cursor/rules/agents/forklift-expert.mdc

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ alwaysApply: false
88
Invoke with: *"as forklift expert"*, *"as migration expert"*, *"domain review"*, *"migration review"*
99

1010
> **Canonical source:** For the list of CRDs and provider types, see `project-context.mdc`. This agent expands on that with implementation details, status handling, and common pitfalls.
11+
>
12+
> **Backend deep-dive:** Detailed Go backend knowledge is available in `.cursor/rules/backend/`. Use the routing table below to load the relevant file when answering backend questions.
1113

1214
## Your Role
1315

@@ -219,7 +221,38 @@ Your approach:
219221

220222
---
221223

222-
### 9. Kubernetes Fundamentals
224+
### 9. Conversions & Deep Inspection
225+
226+
**V1beta1Conversion**
227+
- Represents a conversion or deep-inspection operation on a VM
228+
- Group: `forklift.konveyor.io`, Version: `v1beta1`, Kind: `Conversion`
229+
- Types defined locally in `src/utils/crds/conversion/` (pending upstream `@forklift-ui/types`)
230+
231+
**Conversion Types**
232+
- `DeepInspection` - Pre-migration VM analysis (detects compatibility issues, OS info, filesystem details)
233+
- `Inspection` - Basic inspection
234+
- `InPlace` - In-place conversion
235+
- `Remote` - Remote conversion
236+
237+
**Phases**: `Pending` → `Running` → `Succeeded` / `Failed` / `Canceled`
238+
239+
**Deep Inspection Feature (vSphere only)**
240+
- Entry points: Provider Details header button, Plan Details header button, Plan VM list kebab action
241+
- Guard hooks: `useCanInspectProvider`, `useCanInspectPlan` — check provider type is vSphere and provider is Ready
242+
- Modal: `InspectVirtualMachinesModal` — select VMs, configure disk encryption, set XFS v4 compatibility
243+
- Results stored in `status.inspectionResult` with OS info, filesystems, mountpoints, and concerns
244+
- Status flow: `getInspectionStatus(phase, inspectionPassed)` maps phase + results to UI status labels
245+
246+
**Key Patterns**
247+
- Backend returns `all_checks_passed` in snake_case — always use the `hasInspectionPassed` selector which handles both casings
248+
- Inspection concerns use the same `ConcernsTable` as inventory concerns but with different categories
249+
- Conversion CRs are label-filtered: `CONVERSION_LABELS.PLAN_NAME`, `CONVERSION_LABELS.VM_ID`, etc.
250+
- XFS v4 compatibility: plan-level setting with per-VM override (Inherit/Enable/Disable)
251+
- Concurrency limit: `CONCURRENCY_LIMIT = 10` parallel inspections
252+
253+
---
254+
255+
### 10. Kubernetes Fundamentals
223256

224257
**Resource Model**
225258
- Group: `forklift.konveyor.io`, Version: `v1beta1`
@@ -245,7 +278,7 @@ Your approach:
245278

246279
---
247280

248-
### 10. Console SDK Integration
281+
### 11. Console SDK Integration
249282

250283
**useK8sWatchResource Hook**
251284
- Proper GVK configuration
@@ -261,7 +294,7 @@ Your approach:
261294

262295
---
263296

264-
### 11. Common Patterns & Pitfalls
297+
### 12. Common Patterns & Pitfalls
265298

266299
**Resource Fetching**
267300
- Always handle loading and error states
@@ -289,6 +322,39 @@ Your approach:
289322

290323
---
291324

325+
## Backend Knowledge Routing Table
326+
327+
When answering questions about backend behavior, read the relevant `.mdc` file from `.cursor/rules/backend/`:
328+
329+
| Topic | Load file |
330+
|-------|-----------|
331+
| Architecture, entry points, deployment roles | `backend/architecture.mdc` |
332+
| CRD types, phase constants, conditions framework | `backend/api-types.mdc` |
333+
| Provider reconciliation, credentials, inventory lifecycle | `backend/providers/provider-controller.mdc` |
334+
| vSphere inventory, VDDK, ESXi, vCenter API | `backend/providers/vsphere.mdc` |
335+
| oVirt Engine API, storage domains | `backend/providers/ovirt.mdc` |
336+
| OpenStack Keystone/Nova/Glance/Neutron | `backend/providers/openstack.mdc` |
337+
| OVA file parsing, NFS, OVAProviderServer | `backend/providers/ova.mdc` |
338+
| Hyper-V SMB/PowerShell, HyperVProviderServer | `backend/providers/hyperv.mdc` |
339+
| EC2 AWS SDK, AMI, platform gating | `backend/providers/ec2.mdc` |
340+
| OpenShift target provider, namespaces, StorageClass | `backend/providers/ocp.mdc` |
341+
| Plan validation, conditions, lifecycle | `backend/plans/plan-controller.mdc` |
342+
| Provider adapters, Builder/Client interfaces | `backend/plans/plan-adapters.mdc` |
343+
| Migration phases, itineraries, disk transfer, KubeVirt | `backend/plans/migration-pipeline.mdc` |
344+
| VM scheduling, concurrency, MaxInFlight | `backend/plans/scheduler.mdc` |
345+
| NetworkMap validation, source/target mapping | `backend/mappings/network-map.mdc` |
346+
| StorageMap, offload plugins, vendor integrations | `backend/mappings/storage-map.mdc` |
347+
| Admission webhooks (validating + mutating) | `backend/infrastructure/webhooks.mdc` |
348+
| Inventory REST API endpoints, per-provider routes | `backend/infrastructure/rest-api.mdc` |
349+
| virt-v2v conversion, inspection, customization | `backend/infrastructure/virt-v2v.mdc` |
350+
| Condition framework, inventory containers, lib/ | `backend/infrastructure/shared-libraries.mdc` |
351+
| Prometheus metrics, monitoring | `backend/infrastructure/monitoring.mdc` |
352+
| ESXi host controller | `backend/infrastructure/host-controller.mdc` |
353+
| Pre/post migration hooks | `backend/infrastructure/hook-controller.mdc` |
354+
| Operator deployment, feature flags, images | `backend/operator/operator.mdc` |
355+
356+
---
357+
292358
## Review Checklist
293359

294360
- [ ] Correct GVK used for resources

0 commit comments

Comments
 (0)