Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Set the default line ending behavior for text, in case people don't have core.autocrlf set.
* text=auto
# Ensure all text files use LF line endings in the repo and working tree.
* text=auto eol=lf
*.pbxproj -text
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"module": "src/index.ts",
"types": "lib/index.d.ts",
"scripts": {
"build": "fluentui-scripts build",
"build": "tsgo -b",
"clean": "fluentui-scripts clean",
"depcheck": "fluentui-scripts depcheck",
"just": "fluentui-scripts",
Expand Down
46 changes: 46 additions & 0 deletions packages/agentic/PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Overview

We are working on a plan to modernize furn and enable authoring fluent themed react-native components with agents.

This work will result in the creation of new packages underneath this path.

Do the following:

1. Investigate the following topics with one dedicated sub-agent for each.
2. When they complete, look at the plans and see how they intersect.
3. Create a PLAN.md or README.md for each package in the new folder for that package then a STAGING.md file with an execution plan for this.

## Gather v1 concepts

- Create a concepts package that is used for common concepts, types, and instructions for understanding current components and building new components.
- Analyze the v1 components in the repo (those that use the packages in packages/framework), gather information about states, appearance, interactions, accessibility, and common token references.
- Create a plan to create pinning tests for the existing components to ensure that we don't break things as we refactor

## Agentic authoring

- Create a distributable agent and potentially MCP server to enable authoring new components using fluent themes
- Investigate the code in https://github.com/microsoft/fluentui referenced by AGENTS.md and the skills to mimic the new structure they are using to create a similar pattern for react-native.
- Read https://microsoft-my.sharepoint-df.com/:w:/p/popatudor/cQqZQwg00VNJRby4i2YVjIxJEgUCkrXkbKQophGWqlFA9ANc2Q for modern authoring concepts to apply those

## New common styles and tokens

- Instead of authoring the new controls directly against the theme, create a common tokens object with semantic slots.
- Look at https://github.com/x3-design/fluent-design/blob/main/plugins/tokens/skills/core/SKILL.md for latest thinking on how they are defined for web
- Pull together what components actually reference to map the old ideas to the new ones

## Analysis package

Create an analyzer package that can:

- Create a custom theme with unique values per entry so that resolved styles or tokens can be mapped back to their semantic names.
- Create tests that use the newer @testing-library/react-native and can do things like extract accessibility trees, styles, snapshots, etc.
- Pin token values and style values in v1 components such that we can safely refactor.
- Have a strategy for multiplexing jest tests for each platform when needed.

## New components

Create a single component package that creates equivalent components to the v1 components, but authored in the new style

- Don't use compose or customize
- Create a structure that more closely mirrors modern fluent ideas
- Have a flat structure where components don't depend on other components but instead reference common hooks, tokens, styles, helpers etc. (similar to fluent)
97 changes: 97 additions & 0 deletions packages/agentic/STAGING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Agentic Modernization — Staging & Execution Plan

This is the unified execution plan for the five new packages under `packages/agentic/`, derived from the per-package plans. Goal (from [`PLAN.md`](./PLAN.md)): modernize furn and enable authoring fluent-themed React Native components with agents.

## The five packages

| Package | Path | Role |
| ---------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| [`agentic-concepts`](./agentic-concepts/PLAN.md) | `packages/agentic/agentic-concepts/` | **Leaf vocabulary** — concept types, component catalog, agent skill docs, the pinning **spec** |
| [`agentic-tokens`](./agentic-tokens/PLAN.md) | `packages/agentic/agentic-tokens/` | **Fluent Modern token layer** — x3-design primitives→generics; `createTokens(theme)`, `useTokens()`, derived interaction |
| [`agentic-analyzer`](./agentic-analyzer/PLAN.md) | `packages/agentic/agentic-analyzer/` | **Refactor safety net** — sentinel theme + reverse-map, RNTL harness, pinning, per-platform jest |
| [`agentic-components`](./agentic-components/PLAN.md) | `packages/agentic/agentic-components/` | **Fluent Headless + Modern components** — three forms (`X`/`useX`/`renderX`), no compose/customize |
| [`agentic-authoring`](./agentic-authoring/PLAN.md) | `packages/agentic/agentic-authoring/` | **Distributable agent + skills (+ optional MCP)** — sits on top of all four |

✅ **Both previously-locked sources received & incorporated:** `Fluent Headless and Fluent Modern.docx` (repo root) defines the Headless→Modern strategy and the three-forms component model; the **x3-design token skills** (`~/dev/fluent-design/plugins/tokens/skills/{core,interaction,textstyle}`) define the primitives→generics token model now adopted by `agentic-tokens`.

## How they intersect (the seams)

- **State vocabulary** is defined once in `agentic-concepts`. In `agentic-tokens` interaction states (hover/pressed) are **derived from rest generics** (OKLCH deltas, precomputed for RN), _not_ enumerated as suffixed slots — components declare `interaction.applies-to` per category.
- **Pinning** splits: `agentic-concepts` = the **spec** (per-component scenario matrix + assertion contract); `agentic-analyzer` = the **mechanism** (sentinel theme, RNTL, per-platform jest); `agentic-components` = runs the same matrix to prove **v1→new parity**. Because interaction is derived, analyzer pins catch both rest-token and delta-formula regressions.
- **Token migration** is a chain: `agentic-concepts` catalogs _current_ usage → `agentic-tokens` maps it to the x3-design `--gnrc-*` generics → `agentic-analyzer`'s reverse-map _proves_ resolved values are preserved → `agentic-components` consumes via `useTokens()`.
- **Authoring** ships `agentic-concepts`' skill docs (in the x3-design `SKILL.md` format), generates the three-forms Headless component + Modern token styling, uses `agentic-tokens`' generic vocabulary, and drives `agentic-analyzer` for pin-tests.

## Dependency graph

```
agentic-concepts ──────────────┬───────────────┬──────────────┐
(leaf: types/catalog/skills) │ │ │
▼ ▼ ▼
agentic-tokens ──► agentic-analyzer ──► agentic-components ──► agentic-authoring
(semantic slots) (pin v1 + verify) (new flat comps) (skills/MCP; last)
└───────────────► (sentinel theme injection point) ◄──┘
```

Key principle: **pin v1 behavior BEFORE refactoring anything.** The analyzer + concepts pinning spec must exist and baseline the current components first, so every later change is guarded.

## Cross-cutting setup (applies to every package)

- Add each new package's `tsconfig.json` to the **root `tsconfig.json` `references`** so it joins the unified `tsgo -b` build (per `AGENTS.md`).
- Dev deps (tsgo/jest/eslint/prettier) come automatically via `scripts/dynamic.extensions.mts`.
- **`@testing-library/react-native` is new to the repo** — introduced by `agentic-analyzer`; thread it through align-deps / dynamic extensions and add a catalog entry.
- **Platform forks:** keep `.ios/.android/.win32/.macos/.windows` splits; never co-load multiple RN forks in one program (per `AGENTS.md` Compatibility Notes). `globalTokens` is a static JSON (not theme-injectable) → analyzer sentinelizes it via jest module mocking.
- Each package needs a changeset on first publish-relevant change (`yarn change`).

## Staged execution

### Stage 0 — Scaffolding & contracts (all packages, parallel)

Create all five package folders with `package.json` + `tsconfig.json`, add to root `references`, confirm they join `tsgo -b` as empty packages. Lock the shared contracts: the **state vocabulary** (`agentic-concepts`), the `CommonTokens` **interface** (`agentic-tokens`, provisional), the pinning **assertion contract** (concepts ↔ analyzer seam), and the component **file-template** (`agentic-components` ↔ `agentic-authoring` golden template).

### Stage 1 — Foundation: concepts + analyzer harness

- `agentic-concepts`: concept types, component catalog (7 families), skill docs, pinning spec.
- `agentic-analyzer`: sentinel theme + reverse-map (theme namespace), RNTL `renderWithTheme`, extraction helpers; then `globalTokens` sentinel via jest mock.
- **Milestone:** baseline-pin the existing v1 components (value + semantic snapshots) — the safety net is live _before_ any refactor.

### Stage 2 — Tokens (Fluent Modern layer)

- `agentic-tokens`: model `prmt-*` primitives + `--gnrc-*` generics (color `variant-role-modifier`, scalars, spacing, shadow, `textstyle-*` bundles) → `createTokens(theme)` producer (rest values, light/dark; HC/PlatformColor via `theme.host`) → JS port of the OKLCH **derived interaction** (deltas + lightness curve + inverse rule), precomputed for RN → `useTokens()` + the furn→generic crosswalk.
- Resolve the open decisions: primitives source-of-truth (port x3 vs project existing theme), interaction precompute mechanism, radius ramp (no x3 generic yet).
- **Milestone:** analyzer validates every generic resolves uniquely and every derived hover/pressed matches the algorithm; pin the v1 components' equivalent token references.

### Stage 3 — New components (pattern-setters)

- `agentic-components`: build **Button** end-to-end as the three forms (`Button`/`useButton`/`renderButton` + `useButtonStyles`) + the shared `hooks/`/`tokens/`/`styles/`/`helpers/`; gate on analyzer parity with `ButtonV1`. Then **Text** + **Switch/Checkbox**. Integrate the real `agentic-tokens` (swap the stub; rest + derived interaction); re-run pinning to confirm zero value drift.
- **Milestone:** Button/Text/Switch reach pinned parity with their v1 counterparts; the three-forms template is locked.

### Stage 4 — Long tail + authoring

- `agentic-components`: migrate Link, Checkbox, FAB, CompoundButton, ToggleButton, … each as the same file set + platform splits, gated by analyzer parity.
- `agentic-authoring`: ship `new-component`/`register-tester`/`changeset`/`lint-package` skills (in the x3-design `SKILL.md` format) + `.agents`+`.claude` transclusion stubs; then `token-lookup`/`pin-tests`/`e2e-scaffold`; then the optional MCP server; then distribution (`init`/`postinstall`, multi-runtime adapters).
- **Milestone:** an agent can scaffold a new flat component end-to-end, with pinning, from the skills/MCP.

## Watch items (no longer blocked)

- Per-platform pinning will surface **new** snapshots for previously-untested platforms (first-run churn).
- `agentic-components` `Text` flat-rule decision (render RN `Text` via shared `textStyles` vs a narrow exception) — recommend pure-flat.
- **RN has no runtime OKLCH** → interaction states are precomputed at theme-build time (RN = a "pre-compiled environment" per the x3-design interaction skill).

## Open decisions for you

Resolved:

- ✅ **Token source-of-truth** — adopt the x3 _structure_, map _values_ from the furn themes + v1 component mappings (project-first).
- ✅ **Interaction precompute** — ship precomputed values from `agentic-tokens`; the OKLCH algorithm lives in `agentic-analyzer` (validates them; reused by the tokens build-time generator).
- ✅ **Radius** — furn-local radius ramp derived from current v1 component usage.

Still open:

1. **Build the analyzer + pin v1 first** (recommended — guards everything), or build new components in parallel and backfill pins?
2. **Component scope for v1:** the catalog covers 7 families first (Button, Checkbox, Switch, Radio/RadioGroup, Tab/TabList, Link, Text) — confirm that first slice and the Button/Text/Switch pattern-setter order.
3. **`agentic-tokens` object shape** — nested (`color.background.neutral.subtle`) + flat alias, or flat-only.
4. **`agentic-authoring` distribution target & runtimes** (Claude only, or also Copilot/Cursor) and whether the **MCP server** is in-scope now or later.

## Provenance

Authored from five parallel investigation agents (one per workstream), each grounded in the current repo (framework/composition, v1 components, theming, jest/test setup). Token + authoring specifics are now grounded in the received sources: `Fluent Headless and Fluent Modern.docx` (repo root) and the x3-design token skills (`~/dev/fluent-design/plugins/tokens/skills/`).
Loading
Loading