---
name: fluent-mystique-diff
description: Compare Mystique manifest settings against CDN baselines. Shows which fragments are customized, which use CDN default, which are account-only, and structural diffs (routes, components, queries, plugins). Classifies OOTB vs custom components. All analysis runs locally to minimize token usage. Triggers on "manifest diff", "compare manifests", "cdn vs custom", "manifest baseline", "what's customized", "component inventory".
user-invocable: true
allowed-tools: Bash, Read, Write, Glob, Grep
argument-hint: --profile <PROFILE> [--app oms|store] [--deep] [--components] [--verbose] [--refresh-cdn]
cursor-tier: manual
---

# Mystique Manifest Diff — CDN vs Custom Settings

Compare Fluent Commerce Mystique manifest settings against their CDN baselines. Identifies which fragments are customized, which use the CDN default, which are purely custom (no baseline), and which exist but are not loaded by the root manifest (orphaned). Optionally classifies all components as OOTB vs custom (SDK plugin).

## No Planning Gate

This is a **read-only analysis skill**. It writes analysis artifacts to `accounts/<PROFILE>/analysis/manifests/` but does not modify any settings or manifests.

## Token Optimization Strategy

This skill is designed to minimize LLM token consumption:

1. **ONE MCP call** to download all custom manifest settings to local files
2. **CDN baselines downloaded via Node.js** (the comparison script handles this)
3. **ALL comparison done locally** by `fluent-ai-skills/tools/manifest-diff.mjs` (zero API calls)
4. **Output is a compact text report** (~50 lines for a typical account)

## Procedure

### Phase 1: Download Custom Settings (one-time)

Use MCP `setting.get` with `outputFile` to save each manifest setting to a local file. First, discover what exists:

```
setting.get({ name: "fc.mystique.manifest.%", first: 50 })
```

This returns metadata (names, IDs, valueType) for ALL manifest settings. Then for each setting, download the full content:

```
setting.get({
  name: "fc.mystique.manifest.oms.fragment.ordermanagement",
  outputFile: "accounts/<PROFILE>/manifests/settings/fc.mystique.manifest.oms.fragment.ordermanagement.json"
})
```

**Batch approach** — download ALL settings in parallel (one MCP call each). The outputFile option keeps large manifests (10-120KB) out of the LLM context.

For root manifests (small, <1KB), inline retrieval is fine:
```
setting.get({ name: "fc.mystique.manifest.oms" })
```

Save root manifest to file manually: `accounts/<PROFILE>/manifests/settings/fc.mystique.manifest.oms.json`

### Phase 2: Run Local Comparison

```bash
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE>
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE> --app oms --verbose      # single app, detailed
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE> --deep                    # per-route component diffs
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE> --components             # OOTB vs custom inventory
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE> --deep --components -v   # everything
node fluent-ai-skills/tools/manifest-diff.mjs --profile <PROFILE> --refresh-cdn            # re-download CDN baselines
```

The script:
1. Downloads CDN baselines to `accounts/<PROFILE>/manifests/cdn-baselines/` (cached, only first run)
2. Reads custom settings from `accounts/<PROFILE>/manifests/`, `accounts/<PROFILE>/manifests/settings/`, and `accounts/<PROFILE>/settings/`
3. Compares structurally: routes, components, queries, plugins, fragment references
4. Optionally classifies all components as OOTB vs custom (with `--components`)
5. Prints a summary report to console
6. Saves per-app report to `accounts/<PROFILE>/analysis/manifests/<app>-diff-report.json`
7. Saves combined report to `accounts/<PROFILE>/analysis/manifests/manifest-comparison.json`

### Phase 3: Present Results

**Fragment inventory table columns:**

| Column | Meaning |
|--------|---------|
| **Fragment** | Fragment name (e.g., `ordermanagement`) |
| **Status** | `CUSTOMIZED` / `IDENTICAL` / `BASELINE_ONLY` / `ACCOUNT_ONLY` |
| **Details** | Summary of changes (e.g., `+2 routes, ~3 modified, +1 plugins`) |

**Status values:**

| Status | Meaning |
|--------|---------|
| `CUSTOMIZED` | Setting exists AND structurally differs from CDN baseline |
| `IDENTICAL` | Setting exists but matches CDN baseline (no structural changes) |
| `BASELINE_ONLY` | No setting override exists — using CDN default |
| `ACCOUNT_ONLY` | Setting exists but no CDN baseline found (fully custom fragment) |

For `CUSTOMIZED` fragments, the summary shows:
- Routes added/removed/modified
- Plugin additions/removals
- Fragment reference changes

**Component inventory** (with `--components`):

| Column | Meaning |
|--------|---------|
| **Component** | Mystique component alias (e.g., `fc.list`, `myapp.custom.card`) |
| **Type** | `OOTB` (platform-provided) or `CUSTOM` (from SDK plugin) |
| **Uses** | How many times it appears across all fragments |
| **Found In** | Which fragments contain it (up to 3 samples) |

Custom components (marked with `!`) are shown first since they're the most interesting for customization audits.

### Phase 4: Recommendations

Based on the analysis, provide actionable recommendations:

| Finding | Recommendation |
|---------|---------------|
| ACCOUNT_ONLY + not referenced by root | Orphaned setting — safe to delete or archive |
| CUSTOMIZED + localhost plugin | Dev artifact — remove before production |
| CUSTOMIZED + many custom components | Review for Mystique version compatibility |
| BASELINE_ONLY + referenced | Using CDN fallback — confirm this is intentional |
| Large route delta (>50%) | Heavy customization — consider splitting into a separate fragment |
| IDENTICAL | Redundant setting — can delete to reduce maintenance burden |

## Output Files

| File | Purpose |
|------|---------|
| `accounts/<PROFILE>/manifests/settings/*.json` | Downloaded custom settings (Phase 1) |
| `accounts/<PROFILE>/manifests/cdn-baselines/*.json` | Cached CDN baselines |
| `accounts/<PROFILE>/analysis/manifests/<app>-diff-report.json` | Per-app diff report |
| `accounts/<PROFILE>/analysis/manifests/manifest-comparison.json` | Combined diff report |

## CDN Baseline URLs

Platform baseline manifests are hosted at:
```
https://fluent.apps.fluentcommerce.com/_plugins/{appName}/manifests/{settingName}.json
```

Known fragments tracked by the script:

**OMS App** (`/_plugins/oms/`): dashboard, ordermanagement, mixedbaskets, availability, products, inventory, unifiedinventory, stores, insights, admin

**Store App** (`/_plugins/store/`): dashboard, fulfilment, returns, inventory, waves

Additional account-only fragments (e.g., custom fragments like `appeasement`) are automatically discovered from the deployed settings.

## Example Output

```
=== Manifest CDN vs Setting Comparison ===
Profile: ACME

── OMS App ──
  Root manifest: CUSTOMIZED
    +1 plugins
    Custom plugins:
      + my-custom-bundle

  Fragment Inventory:
  ------------------------------------------------------------------------
  Fragment                     Status           Details
  ------------------------------------------------------------------------
  * admin                      CUSTOMIZED       +2 routes, ~3 modified
  + appeasement                ACCOUNT_ONLY     Custom setting with 5 rou
  - availability               BASELINE_ONLY    Using CDN baseline (8 rou
  - dashboard                  BASELINE_ONLY    Using CDN baseline (3 rou
  = insights                   IDENTICAL        Deployed setting matches
  - inventory                  BASELINE_ONLY    Using CDN baseline (4 rou
  - mixedbaskets               BASELINE_ONLY    Using CDN baseline (2 rou
  * ordermanagement            CUSTOMIZED       +3 routes, ~5 modified
  - products                   BASELINE_ONLY    Using CDN baseline (6 rou
  - stores                     BASELINE_ONLY    Using CDN baseline (4 rou
  - unifiedinventory           BASELINE_ONLY    Using CDN baseline (3 rou
  ------------------------------------------------------------------------
  Legend: * customized  = identical  - baseline only  + account only

  Component Inventory:                              (with --components)
  ------------------------------------------------------------------------
  Component                                Type       Uses   Found In
  ------------------------------------------------------------------------
  ! myapp.appeasement.form                 CUSTOM     2      appeasement
  ! myapp.custom.card                      CUSTOM     1      ordermanagement
    fc.page                                OOTB       15     ordermanagement, admin, appeasement
    fc.list                                OOTB       8      ordermanagement, admin
    fc.card.attribute                      OOTB       12     ordermanagement, admin
    ...
  ------------------------------------------------------------------------
  Total: 28 unique components (25 OOTB, 3 custom)
  Legend: ! = custom component (from SDK plugin)

── Summary ──
  Total manifest settings:  5
  Total fragments tracked:  12
  Customized:               2
  Identical to CDN:         1
  Using CDN default:        8
  Account-only (no CDN):    1
  Custom plugins added:     1
  Routes added:             5
  Routes modified:          8
  Routes removed:           0
  OOTB components:          25
  Custom components:        3

Reports:
  accounts/<PROFILE>/analysis/manifests/oms-diff-report.json
  accounts/<PROFILE>/analysis/manifests/manifest-comparison.json
```

## OOTB Component Registry

The script maintains a registry of ~80 known OOTB Mystique components across categories:

- **Layout & Container**: `fc.page`, `fc.conditional`, `fc.repeater`, `fc.provider.graphql`, `fc.tabs`, `fc.accordion`, `fc.filterPanel`
- **Content & Display**: `fc.list`, `fc.card.attribute`, `fc.card.image`, `fc.tile.metric`, `fc.json.viewer`
- **Charts**: `fc.chart.area`, `fc.chart.bar`, `fc.chart.line`, `fc.chart.gauge`
- **Actions & Buttons**: `fc.button.print`, `fc.modal.button`, `fc.drawer.button`
- **Fields**: `fc.field.daterange`, `fc.field.intrange`, `fc.field.select`, `fc.field.text`, `fc.barcode.scanner`
- **OMS-specific**: `fc.events.search`, `fc.event.detail`, `fc.order.itemDetails`
- **Analytics**: `fc.analytics.viz`

Any component alias not in this registry is classified as `CUSTOM` — meaning it comes from a custom SDK plugin bundle loaded via the root manifest's `plugins[]` array.

## Handoff

After running this skill:
- `-> NEXT: /fluent-mystique-analyze` — for deeper component-level analysis of customized fragments
- `-> NEXT: /fluent-mystique-validate` — to validate customized fragments against the v2.0 schema
- `-> NEXT: /fluent-mystique-builder` — to edit customized fragments
- `-> NEXT: /fluent-implementation-map` — to include manifest customization in the full implementation inventory
