# Initialization: Parameter Detection & Extraction

> Referenced from `steps/step-00-init.md` — Parameter parsing and MCP validation.

---

## Navigation Level Detection

From user request, identify the level:

| Hint in Request | → Level | Parent Required |
|-----------------|---------|-----------------|
| "application", "app", "nouvelle application" | application | No |
| "module", "feature", "nouveau module" | module | Yes (application) |
| "section", "tab", "nouvelle section" | section | Yes (application.module) |
| "resource", "sous-section" | resource | Yes (application.module.section) |

---

## Parameter Extraction

Required parameters to extract:

```yaml
# Required
level: application | module | section | resource
code: kebab-case (e.g., "products", "order-management")
labels:
  fr: "Label français"
  en: "English label"
  it: "Etichetta italiana"
  de: "Deutsche Bezeichnung"
icon: Lucide icon name (e.g., "Package", "ShoppingCart")
displayOrder: number

# Conditional (required for module and section levels)
parentPath: "application.module" or "application.module.section" (dot-separated)
```

---

## Project Type & Seeding Strategy

Read `.smartstack/config.json` at the project root:

| projectType | dbContext | Seeding Strategy |
|-------------|----------|-----------------|
| `core` | `core` | HasData() in Configuration files (existing pattern) |
| `client` | `extensions` | IClientSeedDataProvider (runtime seeding) |

**If file not found or projectType missing:** Default to `core` / `hasdata`.

Store:
```
{project_type} = "core" or "client"
{db_context} = "core" or "extensions"
{seeding_strategy} = "hasdata" or "provider"
```

---

## Feature.json Context (Optional Enrichment)

Search for a Business Analysis feature.json for the target module:

```
Glob: docs/business/*/{code}/business-analyse/v*/feature.json
      .business-analyse/business/*/modules/{code}/features/*/feature.json
```

**If found (status = "handed-off" or "consolidated"):**

Extract context for subsequent steps:

| feature.json Section | Used In Step | Extracted Data |
|----------------------|-------------|----------------|
| `analysis.entities[]` | step-04 (backend) | Entity names, attributes, relationships, validations |
| `specification.useCases[]` | step-04 (backend) | API endpoint definitions beyond basic CRUD |
| `specification.permissionMatrix` | step-02 (permissions) | Custom permission paths and role assignments |
| `specification.apiEndpoints[]` | step-04 (backend) | Exact HTTP methods, routes, DTOs |
| `specification.navigation` | step-01 (navigation) | Navigation hierarchy with labels and icons |
| `specification.i18nKeys` | step-05 (frontend) | Pre-defined translation keys |
| `specification.validations[]` | step-04 (backend) | Field-level validation rules |
| `specification.uiWireframes[]` | step-05 (frontend) | UI layout guidance |
| `specification.seedDataCore` | step-01, step-02, step-03 | Pre-computed seeds |
| `analysis.businessRules[]` | step-04, step-07 | Business rules for service logic and tests |
| `specification.lifeCycles[]` | step-04 (backend) | Entity state machines |
| `specification.dashboards` | step-05 (frontend) | Dashboard KPIs and chart specs |
| `documentation` | step-08 | userDocRequired / techDocRequired flags |

Store:
```
{feature_json_path} = "path/to/feature.json" or null
{has_feature_context} = true or false
{feature_data} = parsed feature.json object (if found)
```

**If NOT found or status not in ["handed-off", "consolidated"]:**
```
{has_feature_context} = false
```

Continue normally. All subsequent steps use their standard generation logic (generic CRUD).

> **When `{has_feature_context} = true`**, subsequent steps SHOULD use the feature.json data
> to generate more accurate code: entities with correct attributes and relationships, custom
> permissions beyond basic CRUD, specific API routes, validation rules, and business logic
> in services. This reduces post-generation manual corrections significantly.

---

## MCP Prerequisite Check (BLOCKING)

**CRITICAL:** This check is **BLOCKING** - the skill cannot proceed without MCP.

Call: `mcp__smartstack__validate_conventions`
Args: `{ checks: ["tables"] }`

**On success:** Set `mcp_available = true`, continue.

**On failure (STOP):** Display MCP installation instructions and halt.
