Skip to content

Commit ebe1878

Browse files
committed
Jetpack Search AI Answers - add dashboard and front end ui.
This is a squashed commit from developing the feature and multiple experiments with the interface. It also includes the original plan for building the feature.
1 parent 9edf1d1 commit ebe1878

45 files changed

Lines changed: 4615 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/packages/search/AGENTS.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Jetpack Search
2+
3+
## UI Components
4+
5+
**Always use existing design system components instead of writing custom ones.**
6+
7+
The Jetpack Search dashboard is actively migrating to standard WordPress components. When building UI, follow this priority order:
8+
9+
### Priority 1: `@wordpress/ui`
10+
The primary component library for new Jetpack work. Use for:
11+
- `Button`, `Link`
12+
- `Notice.Root` / `Notice.Title` / `Notice.Description`
13+
- Tabs, dialogs, and layout primitives
14+
15+
### Priority 2: `@wordpress/components`
16+
Fallback for anything not yet in `@wordpress/ui`:
17+
- `ToggleControl`, `TextareaControl`, `SelectControl`
18+
- `Tabs`, `TabPanel`
19+
- `Notice` (legacy)
20+
21+
### Priority 3: `@automattic/jetpack-components`
22+
Jetpack-specific components (upsell cards, plan badges, etc.).
23+
24+
### Never reinvent
25+
Do **not** create custom implementations of:
26+
- Tab bars → use `@wordpress/components` `Tabs` or `@wordpress/ui`
27+
- Buttons → use `@wordpress/ui` `Button`
28+
- Notices/alerts → use `@wordpress/ui` `Notice`
29+
- Toggles/checkboxes → use `@wordpress/components` `ToggleControl`
30+
31+
When unsure which component to use, the `@wordpress/design-system-mcp` MCP is configured for this project — use it to look up the right component before building a custom one.
32+
33+
## Data access
34+
35+
- `@automattic/jetpack-shared-extension-utils``getSiteFragment()` for site domain
36+
- `@automattic/jetpack-script-data``isWpcomPlatformSite()` for WP.com detection
37+
- Store selectors via `useSelect( select => select( STORE_ID ).selectorName(), [] )` — always include `[]` dependency array
38+
39+
## Testing
40+
41+
Always run all three suites when changing search code:
42+
43+
```bash
44+
# JS tests (from projects/packages/search/)
45+
pnpm test-scripts
46+
47+
# Search PHP tests
48+
jetpack test php packages/search -v
49+
50+
# Sync PHP tests — search changes often affect the sync whitelist
51+
jetpack test php packages/sync -v
52+
```
53+
54+
- Mock external packages in tests; mock custom hooks (`hooks/use-*`) rather than their internals
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: added
3+
4+
Search: AI Answers — topic-based customization CPTs, HMAC auth token, dashboard tabs, and streaming answers panel in the instant-search overlay.

0 commit comments

Comments
 (0)