@wix/agent-skills 1.22.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +12 -4
- package/skills/wix-app/references/APP_VALIDATION.md +16 -10
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +64 -50
- package/skills/wix-app/references/SDK_MODULE_MAP.md +2 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +1 -1
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +4 -3
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +28 -25
- package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +8 -2
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONTRACT.md +12 -14
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +4 -3
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +66 -9
- package/skills/wix-app/references/editor-react-component/EDITOR-EXTENSION-CONFIGURATION.md +25 -0
- package/skills/wix-app/references/editor-react-component/OVERFLOW.md +146 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +6 -0
- package/skills/wix-app/scripts/scan-a11y-eslint.cjs +25 -1
- package/skills/{wix-headless-fast → wix-headless-kit}/SKILL.md +96 -50
- package/skills/{wix-headless-fast → wix-headless-kit}/cold-start/bootstrap.mjs +2 -2
- package/skills/{wix-headless-fast → wix-headless-kit}/cold-start/cold-start.md +26 -31
- package/skills/wix-headless-kit/guides/capabilities.md +76 -0
- package/skills/{wix-headless-fast → wix-headless-kit}/guides/existing-site.md +3 -1
- package/skills/wix-headless-kit/guides/feedback.md +98 -0
- package/skills/wix-headless-kit/guides/migration.md +54 -0
- package/skills/{wix-headless-fast → wix-headless-kit}/guides/reference-mode.md +4 -1
- package/skills/{wix-headless-fast → wix-headless-kit}/install/AGENTS.md +6 -1
- package/skills/{wix-headless-fast → wix-headless-kit}/install/agents-md.mjs +5 -1
- package/skills/{wix-headless-fast → wix-headless-kit}/install/attach.mjs +14 -1
- package/skills/wix-headless-kit/install/check.mjs +87 -0
- package/skills/wix-headless-kit/install/context.mjs +169 -0
- package/skills/{wix-headless-fast → wix-headless-kit}/install/deploy.mjs +101 -23
- package/skills/{wix-headless-fast → wix-headless-kit}/install/setup.mjs +115 -41
- package/skills/{wix-headless-fast → wix-headless-kit}/install/templates.mjs +1 -1
- package/skills/wix-manage/SKILL.md +3 -3
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +68 -2
- package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +2 -2
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +16 -16
- package/skills/wix-manage/references/cms/cms-publishing-flow.md +15 -15
- package/skills/wix-manage/references/cms/cms-schema-management.md +6 -6
- package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +37 -4
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +29 -3
- package/skills/wix-manage/references/sites/query-sites.md +1 -8
- package/skills/wix-manage/references/sites/site-import.md +101 -37
- package/skills/wix-auth/SKILL.md +0 -12
- package/skills/wix-auth/references/device-flow.md +0 -140
- /package/skills/{wix-headless-fast → wix-headless-kit}/install/lock.mjs +0 -0
|
@@ -24,11 +24,11 @@ const WIX = [bin('npx'), '-y', '@wix/cli@latest']; // run the CLI via npx — no
|
|
|
24
24
|
// whose first check is the AI_AGENT env var, so setting it guarantees agent mode
|
|
25
25
|
// (and the awaiting_user/success/logged_in events) for every child we spawn.
|
|
26
26
|
// Respect an existing value so a known runner (claude, cursor, …) keeps its name.
|
|
27
|
-
const AGENT_ENV = { ...process.env, AI_AGENT: process.env.AI_AGENT || 'wix-headless-
|
|
27
|
+
const AGENT_ENV = { ...process.env, AI_AGENT: process.env.AI_AGENT || 'wix-headless-kit-skill' };
|
|
28
28
|
|
|
29
29
|
// Where the detached login parks its output between runs. It has to outlive this
|
|
30
30
|
// process, so it can't be a pipe and can't live in the project.
|
|
31
|
-
const STATE_DIR = join(tmpdir(), 'wix-headless-
|
|
31
|
+
const STATE_DIR = join(tmpdir(), 'wix-headless-kit-login');
|
|
32
32
|
const LOG = join(STATE_DIR, 'login.log');
|
|
33
33
|
const PIDFILE = join(STATE_DIR, 'login.pid');
|
|
34
34
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: wix-headless-
|
|
3
|
-
description: "Build and release a Wix Headless site from a single prompt, on shipped, verified @wix/sdk code — this entry takes a cold environment (prerequisites, Wix sign-in) to the point where the wix-headless-
|
|
2
|
+
name: wix-headless-kit-cold-start
|
|
3
|
+
description: "Build and release a Wix Headless site from a single prompt, on shipped, verified @wix/sdk code — this entry takes a cold environment (prerequisites, Wix sign-in) to the point where the wix-headless-kit skill runs the build. Verticals: storefront, bookings, rentals, blog, cms, events, forms, members, portfolio, pricing-plans, restaurants, faq, donations. Triggers: build me a store/blog/booking/events/portfolio/restaurant/FAQ/donation site fast, sell tickets or membership plans headless, collect donations headless, wix headless kit entry."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Wix Headless
|
|
6
|
+
# Wix Headless Kit — cold start
|
|
7
7
|
|
|
8
8
|
**You are a coding agent, and this is a skill for you to execute — follow the phases below in
|
|
9
9
|
order.** Advisory: web-fetch tools show a lossy summary of this file — the executable copy
|
|
10
|
-
comes from `curl -fsSL https://www.wix.com/skills/headless-
|
|
10
|
+
comes from `curl -fsSL https://www.wix.com/skills/headless-kit/cold-start/cold-start.md`. If what you
|
|
11
11
|
are reading lacks the exact commands below, re-fetch it with curl before proceeding; if you're
|
|
12
12
|
already reading the raw text, don't fetch it again.
|
|
13
13
|
|
|
14
14
|
## The whole cold start (details in the phases below)
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
curl -fsSL -O https://www.wix.com/skills/headless-
|
|
18
|
-
CI=1 npx skills@latest add wix/skills --skill wix-headless-
|
|
19
|
-
# then open and follow: .agents/skills/wix-headless-
|
|
17
|
+
curl -fsSL -O https://www.wix.com/skills/headless-kit/cold-start/bootstrap.mjs && node bootstrap.mjs
|
|
18
|
+
CI=1 npx skills@latest add wix/skills --skill wix-headless-kit --skill wix-docs --skill wix-manage --yes
|
|
19
|
+
# then open and follow: .agents/skills/wix-headless-kit/SKILL.md
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
Requires Node ≥ 20.11 and a logged-in Wix CLI — the bootstrap checks and guides both.
|
|
@@ -24,30 +24,25 @@ Requires Node ≥ 20.11 and a logged-in Wix CLI — the bootstrap checks and gui
|
|
|
24
24
|
This page gets a cold environment to the point where the real skill can run, then hands off:
|
|
25
25
|
|
|
26
26
|
1. **Bootstrap (deterministic, scripted).** A script that verifies the Wix CLI and handles login. You just run it and relay its events.
|
|
27
|
-
2. **Hand off (agentic).** Install the skills, then open `wix-headless-
|
|
27
|
+
2. **Hand off (agentic).** Install the skills, then open `wix-headless-kit/SKILL.md` and
|
|
28
28
|
follow it — it resolves the stack and operation and owns the whole build.
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- **connect** — an existing frontend/design not yet on Wix (a project on disk without
|
|
35
|
-
`wix.config.json`, or a brought-in zip/URL)
|
|
36
|
-
- **iterate** — a project already connected to Wix (`.wix/` or `wix.config.json` present)
|
|
37
|
-
- **existing site** — the prompt names a Wix site that already exists (by its site id) and asks
|
|
38
|
-
for a new frontend for it; the site keeps its content, the frontend is built here
|
|
39
|
-
|
|
40
|
-
The bootstrap only verifies the CLI and logs you in, so it's fine to run in every case (an
|
|
41
|
-
existing session just reports `logged_in`).
|
|
30
|
+
Every starting point comes through here the same way — run the bootstrap, then hand off. What
|
|
31
|
+
the folder holds and what the brief hands over decide the rest, and SKILL.md step 3 owns that
|
|
32
|
+
decision; this page does not interpret either. The bootstrap only verifies the CLI and logs you
|
|
33
|
+
in, so it's fine to run in every case (an existing session just reports `logged_in`).
|
|
42
34
|
|
|
43
35
|
## Phase 0 — The project's folder, and Node
|
|
44
36
|
|
|
45
|
-
**Work from the folder that holds the project, or that will.**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
**Work from the folder that holds the project, or that will.** An empty folder is the project for
|
|
38
|
+
a new build; if the current folder holds unrelated things, make one named for the business and `cd`
|
|
39
|
+
into it. A project already on disk is its own folder — its root, where the `package.json`,
|
|
40
|
+
`index.html` or `wix.config.json` is. **Whatever the brief hands over as files goes into that folder
|
|
41
|
+
first**, before Phase 1: a zip is extracted there, a URL is downloaded and extracted there, so that
|
|
42
|
+
anything it carries — a `wix.config.json` included — sits at the root. Do not interpret what is
|
|
43
|
+
there: the skill reads the folder and knows what it is. Everything below — the bootstrap, the
|
|
44
|
+
skills, the scaffold — lands in this folder too, so a later session opened in the project finds all
|
|
45
|
+
of it.
|
|
51
46
|
|
|
52
47
|
The Wix CLI requires **Node ≥ 20.11**. Check `node -v`; if it errors or prints a lower
|
|
53
48
|
version, install or upgrade Node first — do **not** work around it:
|
|
@@ -69,9 +64,9 @@ externally-downloaded code.
|
|
|
69
64
|
|
|
70
65
|
```bash
|
|
71
66
|
# macOS/Linux:
|
|
72
|
-
curl -fsSL -O https://www.wix.com/skills/headless-
|
|
67
|
+
curl -fsSL -O https://www.wix.com/skills/headless-kit/cold-start/bootstrap.mjs
|
|
73
68
|
# Windows PowerShell:
|
|
74
|
-
iwr https://www.wix.com/skills/headless-
|
|
69
|
+
iwr https://www.wix.com/skills/headless-kit/cold-start/bootstrap.mjs -OutFile bootstrap.mjs
|
|
75
70
|
|
|
76
71
|
node bootstrap.mjs
|
|
77
72
|
```
|
|
@@ -97,15 +92,15 @@ parsed:
|
|
|
97
92
|
|
|
98
93
|
```bash
|
|
99
94
|
CI=1 npx skills@latest add wix/skills \
|
|
100
|
-
--skill wix-headless-
|
|
95
|
+
--skill wix-headless-kit --skill wix-docs --skill wix-manage --yes
|
|
101
96
|
```
|
|
102
97
|
|
|
103
|
-
- **`wix-headless-
|
|
98
|
+
- **`wix-headless-kit`** — the build itself.
|
|
104
99
|
- **`wix-docs`** — the API reference the playbooks defer to for any contract they don't cover.
|
|
105
100
|
- **`wix-manage`** — management recipes, for admin work on the site after it exists.
|
|
106
101
|
|
|
107
102
|
They land under `.agents/skills/`. Then **open
|
|
108
|
-
`.agents/skills/wix-headless-
|
|
103
|
+
`.agents/skills/wix-headless-kit/SKILL.md` and follow it** — it owns the rest of the run:
|
|
109
104
|
resolve the stack, scaffold, deploy the shipped code, seed, build the brand layer, release.
|
|
110
105
|
(A request outside the shipped verticals — see its SKILL.md § Verticals — is built from the Wix
|
|
111
106
|
API reference through `wix-docs`, on the same project; SKILL.md says how.)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Capability map: which Wix product owns what, and what this skill ships for it
|
|
2
|
+
|
|
3
|
+
Read this when the Verticals table in SKILL.md does not settle the match: the brief names a Wix
|
|
4
|
+
product or a feature the table does not mention, two rows could fit, or the request sounds like a
|
|
5
|
+
vertical this skill does not ship. Every Wix product, its docs path (relative to
|
|
6
|
+
`https://dev.wix.com/docs/api-reference/`), the features its introduction page lists, and the
|
|
7
|
+
column that matters here: what this skill ships for it. Features come from the introduction pages;
|
|
8
|
+
when a product looks wrong or missing, re-derive from `<path>/introduction.md` through `wix-docs`.
|
|
9
|
+
|
|
10
|
+
"Shipped" means the vertical's data layer, stores, hooks, components and seed cover it; "read only"
|
|
11
|
+
means the DTO carries it but nothing acts on it; "not shipped" means the feature is built from the
|
|
12
|
+
API reference through `wix-docs` on the same project, with the same rules as every other call.
|
|
13
|
+
|
|
14
|
+
## Business solutions
|
|
15
|
+
|
|
16
|
+
| Product | Path | Features (from the introduction page) | This skill |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| Stores | `business-solutions/stores` | Products, categories, options and variants, inventory, brands, ribbons, info sections, customizations (modifiers), promotions, store locations, site currency, currency conversion | **storefront**: products, categories, options and variants, inventory and low stock, pre-order, ribbons, info sections, modifiers, discount names, subscriptions, back in stock, site currency (set by the seed). Not shipped: brands, store locations, currency conversion |
|
|
19
|
+
| eCommerce | `business-solutions/e-commerce` | Cart, checkout, abandoned checkout, orders, transactions, fulfillment, discount rules, recommendations, shipping rates, additional fees, payments, catalog | **storefront**, **restaurants**, **bookings**, **events**, **donations** use it for the cart line, totals (discounts, fees, taxes), coupon code, buyer note and the checkout redirect session; order read on the events and donations thank-you pages. Not shipped: abandoned checkout, fulfillment, shipping rates, recommendations |
|
|
20
|
+
| Coupons | `business-solutions/coupons` | Coupons, percentage and fixed discounts, free shipping, buy X get Y, scopes, usage limits, expiry | Applied at the cart by **storefront**; created through a `wix-manage` recipe when the brief asks (no coupon seed) |
|
|
21
|
+
| Bookings | `business-solutions/bookings` | Services, appointments, classes, courses, staff, resources, pricing, policies, time slots, bookings, waitlists, external calendar, checkout and orders | **bookings**: appointments, classes and courses, staff, time slots and sessions, rate types, deposits, policies as the call to action, locations, categories, booking to checkout or direct placement. Read only: waitlist flag on a slot, add-ons. Not shipped: non-staff resources, external calendar |
|
|
22
|
+
| Rentals | `business-solutions/rentals` | Rental services, hourly and daily durations, customer-selected length, bookable resources, resource attributes, per-hour and per-day pricing, availability, consecutive multi-day bookings | **rentals**: the catalog (Bookings services carrying the Rentals app id), hourly starts then end options, daily starts then the consecutive-day walk, the server-priced quote, the Rentals booking form, booking with the start's resource and the customer's end, checkout-or-place; the seed creates resource types, resources (bookable around the clock) and rental services one at a time. Not shipped: resource attributes and attribute filters, per-resource working hours (which split a multi-day rental into one booking per day), multi-service bookings |
|
|
23
|
+
| Meetings | `business-solutions/meetings` | Scheduling links, shareable booking page, duration and location, video or phone or in person, hosts, calendar sync, intake forms, paid meetings, rescheduling | **Not shipped.** Also Bookings underneath; a scheduling-link brief is built through `wix-docs` |
|
|
24
|
+
| Restaurants | `business-solutions/restaurants` | Menus, sections, items, variants, modifiers, labels, online orders, operations, fulfillment methods, availability exceptions, service fees, reservations, time slots, experiences | **restaurants**: menus, sections, items, variants, modifier rules, labels, ordering (operations, fulfillment methods, windows), reservations with the location's form and time slots, money from the eCommerce settings. Not shipped: service fees in the menu totals, experiences |
|
|
25
|
+
| Events | `business-solutions/events` | Events, ticket definitions, tickets, RSVP, orders and checkout, check-in, guests, guest list, schedule, policies | **events**: listing and event pages, occurrences, RSVP with the organizer's form and guest control, ticket tiers to checkout, order read on the confirmation page, categories. Not shipped: check-in, guest list, schedule |
|
|
26
|
+
| Blog | `business-solutions/blog` | Posts, draft posts, categories, tags, post stats, blog roles, paid post subscriptions | **blog**: feed, post pages, categories and tags, authors, metrics, likes, related posts, comments through Community. Seed writes draft posts and publishes them. Not shipped: paid post subscriptions, roles |
|
|
27
|
+
| CMS | `business-solutions/cms` | Data items, collections, collection permissions, aggregations, indexes, external databases, backups, background tasks | **cms**: collections and items with filters, sort, distinct values, paging, references, permissions set by the seed. Not shipped: indexes, external databases, backups |
|
|
28
|
+
| Pricing Plans | `business-solutions/pricing-plans` | Plans, orders, recurring, single payment, free plans, free trials, cancellation, credits | **pricing-plans**: plans with trials and fees, the plan gate on the member's orders, purchase through the native checkout redirect. Not shipped: cancellation, credits |
|
|
29
|
+
| Portfolio | `business-solutions/portfolio` | Projects, project items, collections, settings, gallery layouts, cover media | **portfolio**: collections, projects, galleries with images and video. Not shipped: settings |
|
|
30
|
+
| Donations | `business-solutions/donations` | Campaigns, goals, one-time and recurring, predefined and custom amounts, cover fees, progress | **donations**: all of it, through the eCommerce checkout |
|
|
31
|
+
| Gift Cards | `business-solutions/gift-cards` | Gift cards, gift card products, redemption codes, balances, denominations, expiry, transactions | Not shipped |
|
|
32
|
+
| Benefit Programs | `business-solutions/benefit-programs` | Programs, templates, tiers, credits, redemption, enrollment, balances, eligibility | Not shipped; program activation is dashboard-only |
|
|
33
|
+
| Suppliers Hub | `business-solutions/suppliers-hub` | Marketplace products, suppliers, dropshipping, wholesale tiers | Not shipped; partner-only |
|
|
34
|
+
| Forum | `business-solutions/forum` | Deprecated (discontinued March 2026) | Not shipped; do not build on it. Discussion is blog comments or Community groups |
|
|
35
|
+
|
|
36
|
+
## Site-wide products
|
|
37
|
+
|
|
38
|
+
| Product | Path | Features | This skill |
|
|
39
|
+
|---|---|---|---|
|
|
40
|
+
| Members & Contacts | `crm/members-contacts` | Contacts, labels, extended fields, notes, members, profiles, authentication, privacy, badges, followers | **members**: sign-up, login, verification, logout, the current member's profile, gated pages. Not shipped: contacts, labels, badges, followers, profile editing |
|
|
41
|
+
| Forms | `crm/forms` | Form schemas, submissions, templates, intake forms, interactive sessions, chat settings | **forms**: the schema rendered live, every field kind, rules, steps, submissions with files (paid plans) or through the media-upload capability. Not shipped: templates, interactive sessions, chat |
|
|
42
|
+
| FAQ | `business-management/faq-app` | Categories, question entries | **faq**: all of it |
|
|
43
|
+
| Site Search | `business-management/site-search` | Search, search schemas | the **site-search** capability: federated search and suggestions over the deployed verticals |
|
|
44
|
+
| Media Manager | `assets/media` | Files, folders, upload URLs | the **media-upload** capability (a validated Astro endpoint and a client helper); images in every seed |
|
|
45
|
+
| SEO | `business-management/seo` | Site tags, patterns, item tags, resolved tags, redirects | owner-editable item SEO on every Astro item page that has a Wix SEO item type (products, posts, services, events, categories) |
|
|
46
|
+
| Community | `crm/community` | Groups, membership, comments, reviews, moderation | Comments only, inside **blog**. Not shipped: groups, reviews |
|
|
47
|
+
| Loyalty Program | `crm/loyalty-program` | Points, earning rules, tiers, accounts, rewards, loyalty coupons | Not shipped |
|
|
48
|
+
| Online Programs | `business-management/online-programs` | Programs, sections, steps, enrollment, payment | Not shipped (a paid course a member enrolls in is pricing-plans plus gated pages, or this) |
|
|
49
|
+
| Locations | `business-management/locations` | Locations, default location, business schedule, special hours | Read by **bookings** and **restaurants** for their locations; not managed |
|
|
50
|
+
| Communication, CRM, Automations, Marketing, Payments, Get Paid, Multilingual, Notifications, Branches, Analytics, Calendar | `crm/…`, `business-management/…` | see each introduction page | Not shipped; back-office or infrastructure, driven from `wix-manage` recipes or `wix-docs` when a brief needs one |
|
|
51
|
+
|
|
52
|
+
## Where things actually live
|
|
53
|
+
|
|
54
|
+
- Meetings and Rentals ship no APIs of their own: both are Bookings with restricted field values,
|
|
55
|
+
so their contracts are the Bookings ones. A rentals site also needs the Wix Bookings app installed
|
|
56
|
+
(the rentals seed does it): with Rentals alone, availability for an hourly rental with several
|
|
57
|
+
units answers 401 "Booking app not installed".
|
|
58
|
+
- Loyalty coupons (`crm/loyalty-program/rewards/coupons`) are a different resource from eCommerce
|
|
59
|
+
Coupons (`business-solutions/coupons`).
|
|
60
|
+
- Stores categories are called Collections in Catalog V1 and Categories in Catalog V3; the shipped
|
|
61
|
+
code is V3.
|
|
62
|
+
- SEO spans two products: the tag model is `business-management/seo`; Ads.txt and keyword
|
|
63
|
+
suggestions are under `business-management/marketing/seo`.
|
|
64
|
+
- Badges and Followers live under `crm/members-contacts/members/activity/`, profiles under
|
|
65
|
+
`members/member-management/members-about-v2`, privacy under `member-management/privacy`.
|
|
66
|
+
- There is no roles API and no segments API; contact labels serve segmentation.
|
|
67
|
+
- Stores, Coupons and Suppliers Hub have no usable introduction page; start from the menu page and
|
|
68
|
+
the sub-section introductions.
|
|
69
|
+
|
|
70
|
+
## When the brief lands on "not shipped"
|
|
71
|
+
|
|
72
|
+
Say so plainly in one line, then build it on the same project and stack from the API reference
|
|
73
|
+
through `wix-docs` (search, then the method page), with every other rule unchanged: nothing from
|
|
74
|
+
memory, live data or an honest empty state, purchases through Wix. Choose the closest shipped
|
|
75
|
+
vertical as the base when one exists (a meetings brief starts from bookings, a loyalty brief from
|
|
76
|
+
members), and name the gap in the closing message.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# An existing site: a new frontend for a site that already has its content
|
|
2
2
|
|
|
3
3
|
Read when the brief names a Wix site by its id. Nothing here is seeded: the site owns its content
|
|
4
|
-
and the frontend reads it live.
|
|
4
|
+
and the frontend reads it live. (A project downloaded from Wix whose `.env.local` declares a
|
|
5
|
+
migration is the other way to arrive at an existing site: `guides/migration.md`; the reading
|
|
6
|
+
part below applies there too, against the migrated site.) `<SKILL_ROOT>` is the installed skill folder; the shipped code is
|
|
5
7
|
under `<SKILL_ROOT>/templates/` (SKILL.md, "The run").
|
|
6
8
|
|
|
7
9
|
**Read the site, then run attach.** First, one call tells you what
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Feedback: relay the user's building-with-Wix experience to Wix
|
|
2
|
+
|
|
3
|
+
A small, optional step: send the user's feedback about the experience of building with Wix to Wix,
|
|
4
|
+
attributed to the authenticated user. It closes the loop when this skill, the shipped code, the
|
|
5
|
+
APIs, the docs or the tooling got in the way. It is not support and not about the user's site
|
|
6
|
+
content; it is feedback about building with Wix.
|
|
7
|
+
|
|
8
|
+
## When to offer it
|
|
9
|
+
|
|
10
|
+
Sending is always the user's call. Offering is not: default to offering, in plain prose, once per
|
|
11
|
+
issue, in any of these cases, and send only after an explicit yes.
|
|
12
|
+
|
|
13
|
+
- The user asks to send feedback or report something to Wix. Confirm the wording and send.
|
|
14
|
+
- The user complains, is frustrated, or reports a Wix bug while you work. Acknowledge, then offer.
|
|
15
|
+
- The run hit friction, even once. Friction is anything that cost more turns than it should have,
|
|
16
|
+
whether or not it ended in an error: a confusing error, a doc that was wrong or missing, a seed
|
|
17
|
+
step that failed and had to be re-run, a shipped file that did not cover what the brief needed, a
|
|
18
|
+
playbook line you had to read the source to understand, a contract you had to discover by trial,
|
|
19
|
+
a slow install or a flaky call you retried, a workaround you had to invent, a platform gate the
|
|
20
|
+
brief did not anticipate (a plan restriction, a missing payment method), a step where you were
|
|
21
|
+
unsure what the skill wanted. Offer in the moment: "That tripped us up; want me to send it to Wix
|
|
22
|
+
as feedback?"
|
|
23
|
+
- At the close of every run, before the live URL and the dashboard link, run a self-check over the
|
|
24
|
+
whole session. Friction you shrugged off or silently retried past is still signal. If anything
|
|
25
|
+
qualifies, offer before you sign off. Skip the offer only when the run was clean end to end.
|
|
26
|
+
|
|
27
|
+
When you offer, invite the user to add anything in their own words; it goes into the message
|
|
28
|
+
verbatim under "In the user's words". Never send on a single transient error, never without a yes,
|
|
29
|
+
never twice for the same issue. When unsure, ask.
|
|
30
|
+
|
|
31
|
+
## Compose the message
|
|
32
|
+
|
|
33
|
+
Wix receives free text, so a bare sentence is low signal. Send a summary of the whole run in three
|
|
34
|
+
layers, so Wix can triage without chasing you.
|
|
35
|
+
|
|
36
|
+
**Provenance**, as labelled lines; drop what does not apply, add what helps:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Agent / model: <Claude Code / Opus, Cursor, Codex, ...>
|
|
40
|
+
Skill: wix-headless-kit <version from .agents/skills/wix-headless-kit/SKILL.md or skills-lock.json> · run kind: <create | connect | attach | iterate | reference mode | migration preview>
|
|
41
|
+
Stack: <astro | react | lib | static | port> · verticals: <storefront, blog, ...> · capabilities: <media-upload, site-search, none>
|
|
42
|
+
Wix tooling used: <Wix CLI, wix-manage recipes, wix-docs, REST via curl>
|
|
43
|
+
Wix products: <Stores, Bookings, Events, Blog, Forms, ...>
|
|
44
|
+
Site: <siteId> · public clientId: <appId> · dashboard: <url> · live: <url>
|
|
45
|
+
Skill files involved: <templates/<vertical>/seed/seed-<v>.mjs, templates/<vertical>/INSTRUCTIONS.md, install/setup.mjs, ...>
|
|
46
|
+
Other ids: <product / service / form / event ids created this run, as relevant>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Narrative:**
|
|
50
|
+
|
|
51
|
+
- In the user's words: what they added when you offered, verbatim, secrets redacted. Skip when empty.
|
|
52
|
+
- User intent and run summary: what they set out to build and the arc of the session in a few
|
|
53
|
+
sentences, what worked and what fought back.
|
|
54
|
+
- Conversation and agent flow: a condensed play-by-play, the key exchanges, the scripts and calls
|
|
55
|
+
you ran, what came back, the decisions and course corrections. Distilled, not a transcript.
|
|
56
|
+
- Friction points: the heart of it. Every place something got in the way, each with the step or
|
|
57
|
+
endpoint, the status and message, the gap, the workaround and what you expected instead, with a
|
|
58
|
+
minimal repro where there is one. Include the ones you recovered from.
|
|
59
|
+
|
|
60
|
+
**Attribution**, per significant friction point, your best diagnosis tagged with one of: API
|
|
61
|
+
behavior, API schema, API reference docs, docs articles or examples, Wix harness (CLI, auth, hosting),
|
|
62
|
+
this skill's shipped code, this skill's playbook, other or unsure; and whether you confirmed it or
|
|
63
|
+
are assuming. A wrong route is worse than "unsure".
|
|
64
|
+
|
|
65
|
+
**Bottom line**: one or two sentences naming the single most important problem and its impact,
|
|
66
|
+
worst first, plainly, in a professional register.
|
|
67
|
+
|
|
68
|
+
Confirm the final wording with the user before sending. Never include secrets (no bearer tokens,
|
|
69
|
+
refresh tokens, API keys, credentials) and no personal data beyond what the feedback needs.
|
|
70
|
+
|
|
71
|
+
## Send it
|
|
72
|
+
|
|
73
|
+
The call identifies the human account, so it needs a user-scoped bearer from the bare token
|
|
74
|
+
command, not the site-scoped one the seeds use (`token --site` carries a metaSiteId and the service
|
|
75
|
+
rejects it as anonymous).
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
TOKEN=$(npx @wix/cli@latest token)
|
|
79
|
+
curl -sS -w "\nHTTP_STATUS:%{http_code}" \
|
|
80
|
+
-X POST "https://www.wixapis.com/mcp-serverless/v1/headless-feedback" \
|
|
81
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
82
|
+
-H "Content-Type: application/json" \
|
|
83
|
+
-d '{"message":"<composed feedback>"}'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- `HTTP_STATUS:200` with `{}`: sent. Tell the user.
|
|
87
|
+
- `500` "Unable to determine target user id, anonymous messages are not allowed": the token was
|
|
88
|
+
site-scoped. Re-mint with the bare command and retry once.
|
|
89
|
+
- `401` or `403`: the CLI session expired. `npx @wix/cli@latest login` (surface the URL and code to
|
|
90
|
+
the user), re-mint, retry once. If it still fails, show the response and stop.
|
|
91
|
+
|
|
92
|
+
## Rules
|
|
93
|
+
|
|
94
|
+
- Offer whenever the run warrants it; send only after an explicit yes.
|
|
95
|
+
- One submission per issue; no retries beyond the one named above, no duplicates.
|
|
96
|
+
- Specific and factual; wording confirmed first.
|
|
97
|
+
- No tokens, secrets, credentials or unnecessary personal data in the message.
|
|
98
|
+
- Not for the user's site content and not a support channel.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# A migration preview: a site being moved to headless
|
|
2
|
+
|
|
3
|
+
Read when setup reports `mode: "migrate"`, or when a folder holds a `wix.config.json` and
|
|
4
|
+
`node <SKILL_ROOT>/install/context.mjs` prints `migration.active: true`. The brief is the prompt
|
|
5
|
+
the Wix dashboard's Headless settings hand the owner after "Go Headless": download the project from
|
|
6
|
+
`https://manage.wix.com/download-headless-business/<siteId>/download.zip`, the names of the apps
|
|
7
|
+
the site already has, and the instruction not to probe, install or seed anything. The zip holds
|
|
8
|
+
`wix.config.json` (the deploy site and its app) beside the CLI's blank Astro starter.
|
|
9
|
+
|
|
10
|
+
**What `.env.local` says.** `wix env pull` copies the project's `prod` environment: the parent's
|
|
11
|
+
`WIX_CLIENT_ID`, and the migration's own variables, `EDITOR_MIGRATION_STATUS` (`ACTIVE` while the
|
|
12
|
+
migration is under way, `COMPLETED` once the parent serves this frontend), `EDITOR_MIGRATION_PARENT_SITE_ID`,
|
|
13
|
+
`EDITOR_MIGRATION_CHILD_SITE_ID` and `EDITOR_MIGRATION_CHILD_APP_ID`. `context.mjs` reads the first
|
|
14
|
+
two; the shape is `migration` whenever the status is active, whatever else the folder holds.
|
|
15
|
+
|
|
16
|
+
**Two sites, one project.** `wix.config.json` names a site created only to host the deployment:
|
|
17
|
+
`wix release` goes there and nowhere else. `.env.local` (what `wix env pull` writes; setup and
|
|
18
|
+
`context.mjs` pull it when it is missing) carries the credentials of the site being migrated, the
|
|
19
|
+
**parent**, and says so. The parent owns everything the pages show and everything the business
|
|
20
|
+
manages. So:
|
|
21
|
+
|
|
22
|
+
- **The SDK client is the parent's.** The Astro integration reads `WIX_CLIENT_ID` from the env and
|
|
23
|
+
never the config; `deploy.mjs` copies the same value into `src/wix/config.ts` (react, lib) and
|
|
24
|
+
`js/wix/config.js` (static). Nothing in the data layer is told about the migration; it reads the
|
|
25
|
+
parent because its client is the parent's app.
|
|
26
|
+
- **Admin, discovery and seed calls target the parent.** `read-site.mjs` and the seeds resolve the
|
|
27
|
+
site through `templates/shared/seed/site-context.mjs`; `wix-manage` recipes and any raw call take
|
|
28
|
+
`--site <parentSiteId>` (the `siteId` of the `ready_for_brand_layer` event). The dashboard link
|
|
29
|
+
is the parent's.
|
|
30
|
+
- **Nothing is seeded, nothing installed.** The parent is a live site with its content; a seed
|
|
31
|
+
would write into the original. The seeds refuse on a preview unless run with `--allow-parent`,
|
|
32
|
+
which is the user's explicit decision, never a default. Apps are not installed: the brief names
|
|
33
|
+
what the site has, and the verticals follow from that list (Wix Stores → storefront, Wix
|
|
34
|
+
Bookings → bookings, Wix Forms → forms, and so on per the Verticals table; Wix Pro Gallery and
|
|
35
|
+
Wix Members Area map to portfolio and members). When the brief allows reading, the vertical's
|
|
36
|
+
`read-site.mjs` sizes the content as in `guides/existing-site.md`; when it says not to probe,
|
|
37
|
+
design from the brief.
|
|
38
|
+
|
|
39
|
+
**The run.** `setup.mjs --vertical <vertical>[,<vertical>…] [--stack <stack>]` in the folder (every vertical the brief needs, in one call): it keeps the
|
|
40
|
+
starter the download carries and deploys the vertical's code and dependencies into it (a bare config
|
|
41
|
+
gets the composed template copied in around it), starts the install, writes the project's AGENTS.md
|
|
42
|
+
with the migration recorded, and skips the seed. Then
|
|
43
|
+
SKILL.md steps 4 and 5 as for any run. `attach.mjs` refuses a migration folder on purpose: the
|
|
44
|
+
app, hosting and credentials came with the download; nothing is provisioned or re-pointed.
|
|
45
|
+
|
|
46
|
+
**The close.** The release is a **preview** on the deploy site. Close with the preview URL (copied
|
|
47
|
+
from the `wix release` output), the parent's dashboard link, and the two facts: the original site
|
|
48
|
+
is unchanged, and completing the migration, which makes the parent serve this frontend and retires
|
|
49
|
+
the deploy site, is the user's next step once they approve the preview: the dashboard hands them
|
|
50
|
+
a second prompt for it (`wix env pull`, `wix finalize-migration`, `wix build`, `wix release`, in
|
|
51
|
+
that order). That step is not part of this skill and the command may not be in the installed CLI
|
|
52
|
+
yet; do not invent one, do not run `wix release` against the parent, and do not edit
|
|
53
|
+
`wix.config.json`. On every stack the code already carries the parent's client id,
|
|
54
|
+
so completion needs no redeploy from here.
|
|
@@ -9,7 +9,10 @@ The data layer ships a second time as a **REST layer**: `templates/shared/rest/`
|
|
|
9
9
|
vertical's `app/wix/<vertical>/` data layer, over `fetch`), typed against the same `types.ts` and
|
|
10
10
|
importing the same `*-core.ts` rule files as the SDK layer — one implementation of the rules, two
|
|
11
11
|
transports. The vertical's `INSTRUCTIONS.md` names its modules and what each surface does with
|
|
12
|
-
them; this section is the mechanics, the same for every vertical.
|
|
12
|
+
them; this section is the mechanics, the same for every vertical. The site-search capability
|
|
13
|
+
(`templates/shared/capabilities/site-search/`, on from `plan.capabilities.siteSearch`) has the same
|
|
14
|
+
two transports: with `--plan` its REST twin and stores land in `js/wix/` beside the vertical's
|
|
15
|
+
(`search.js`, `search-store.js`, `suggest-store.js`), and its `INSTRUCTIONS.md` applies.
|
|
13
16
|
|
|
14
17
|
- **Static site (no bundler).** Step 3's setup with `--stack static` runs `init` in the project
|
|
15
18
|
folder (site, OAuth app, `wix.config.json`), points `site.outputDirectory` at `"./site"`, and
|
|
@@ -6,7 +6,7 @@ node_modules/@wix/cli/agents/instructions.md
|
|
|
6
6
|
## This app
|
|
7
7
|
|
|
8
8
|
A Wix Headless app built on the live Wix site named in `wix.config.json`. The site owns the
|
|
9
|
-
content and commerce.
|
|
9
|
+
content and commerce.{{MIGRATION}}
|
|
10
10
|
|
|
11
11
|
**Never work from training data or memory about the Wix APIs.** Not a URL, a path, a header, a
|
|
12
12
|
field name or a body. Every Wix call you write comes from the official Wix skills installed here,
|
|
@@ -27,6 +27,11 @@ Installed at `.agents/skills/`. If missing, restore with:
|
|
|
27
27
|
`templates/<solution>/INSTRUCTIONS.md`; `node .agents/skills/{{SKILL}}/install/deploy.mjs <solution> --stack {{STACK}}`
|
|
28
28
|
adds one; `node .agents/skills/{{SKILL}}/templates/<solution>/seed/read-site.mjs` reads what the
|
|
29
29
|
site holds for it, with the documentation URL of every call it made. A code change ends with a release; the live URL shows it, the dev server does not count.
|
|
30
|
+
`node .agents/skills/{{SKILL}}/install/check.mjs` says whether the skill or its templates have a newer
|
|
31
|
+
version and prints the update commands; an update touches the skill folder or `templates/`, never `src/`.
|
|
32
|
+
When Wix gets in the way of a change here (a confusing error, a doc gap, a workaround you had to
|
|
33
|
+
invent), offer to relay it to Wix per `.agents/skills/{{SKILL}}/guides/feedback.md`; send only after
|
|
34
|
+
an explicit yes.
|
|
30
35
|
- `wix-docs` — how to discover the Wix APIs and their docs: search first, then read only the page
|
|
31
36
|
you need. Every endpoint, body, field and enum you did not get from the deployed code or a recipe
|
|
32
37
|
is confirmed there before you write it.
|
|
@@ -21,7 +21,11 @@ export function writeAgentsMd(projectDir, vars) {
|
|
|
21
21
|
const agents = join(projectDir, "AGENTS.md");
|
|
22
22
|
if (existsSync(agents)) kept.push("AGENTS.md");
|
|
23
23
|
else {
|
|
24
|
-
|
|
24
|
+
// {{MIGRATION}} is a paragraph on a migration preview (vars.migration = { parentSiteId, deploySiteId }), else nothing.
|
|
25
|
+
const migration = vars.migration
|
|
26
|
+
? `\n\n**Under migration.** \`wix.config.json\` names site ${vars.migration.deploySiteId}, which only hosts this deployment; the site being migrated is ${vars.migration.parentSiteId} — its content is what the pages show and its dashboard (\`https://manage.wix.com/dashboard/${vars.migration.parentSiteId}\`) is where the business is managed. \`.env.local\` (\`wix env pull\`) carries that site's app: the SDK client and every admin, discovery and seed call run against it; only \`wix release\` goes to the deploy site. Completing the migration is a separate Wix CLI step, run by the user after approving the preview.`
|
|
27
|
+
: "";
|
|
28
|
+
const text = readFileSync(TEMPLATE, "utf8").replace(/\{\{(\w+)\}\}/g, (_, k) => (k === "MIGRATION" ? migration : (vars[k.toLowerCase()] ?? "")));
|
|
25
29
|
writeFileSync(agents, text); written.push("AGENTS.md");
|
|
26
30
|
}
|
|
27
31
|
const claude = join(projectDir, "CLAUDE.md");
|
|
@@ -45,6 +45,7 @@ import { cpSync, existsSync, mkdirSync, openSync, readFileSync, writeFileSync }
|
|
|
45
45
|
import { basename, dirname, join, resolve } from "node:path";
|
|
46
46
|
import { fileURLToPath } from "node:url";
|
|
47
47
|
import { writeAgentsMd } from "./agents-md.mjs";
|
|
48
|
+
import { frontendPresent, siteContext } from "./context.mjs";
|
|
48
49
|
import { listVerticals, templatesDir } from "./templates.mjs";
|
|
49
50
|
|
|
50
51
|
const SKILL_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
@@ -75,7 +76,19 @@ const subfolder = argv.includes("--subfolder");
|
|
|
75
76
|
const cwd = process.cwd();
|
|
76
77
|
const has = (p) => existsSync(join(cwd, p));
|
|
77
78
|
const cwdConfig = has("wix.config.json") ? JSON.parse(readFileSync(join(cwd, "wix.config.json"), "utf8")) : null;
|
|
78
|
-
|
|
79
|
+
// A frontend here: a package.json, an index.html at the root, or an index.html in the folder the
|
|
80
|
+
// config's site.outputDirectory names (a static site laid out for release) — install/context.mjs.
|
|
81
|
+
const fp = frontendPresent(cwd);
|
|
82
|
+
const hasProject = fp.packageJson || fp.rootIndex || fp.outputIndex;
|
|
83
|
+
// A migration preview (wix.config.json names a deploy-only site, .env.local names the site being
|
|
84
|
+
// migrated) is already provisioned: its app, hosting and credentials came with the folder. Nothing
|
|
85
|
+
// here applies — setup.mjs takes it (SKILL.md step 3).
|
|
86
|
+
if (cwdConfig) {
|
|
87
|
+
const ctx = siteContext({ cwd });
|
|
88
|
+
if (ctx.migration.active) {
|
|
89
|
+
fail("place", `this folder deploys a migration preview of site ${ctx.migration.parentSiteId} (deploy site ${ctx.deploy.siteId}): the app and hosting are provisioned already — run setup.mjs --vertical <vertical> [--stack <stack>] here instead; nothing is attached or re-pointed`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
79
92
|
const siteId = flag("site") ?? cwdConfig?.siteId ?? cwdConfig?.projectId ?? null;
|
|
80
93
|
const stack = stackFlag ?? "astro";
|
|
81
94
|
const knownVerticals = listVerticals(TEMPLATES);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Is there a newer version? Read-only: compares this installed skill and its templates with the
|
|
2
|
+
// repository they came from and prints one JSON. It changes nothing and runs no update; the
|
|
3
|
+
// commands that would are in the output.
|
|
4
|
+
//
|
|
5
|
+
// node <SKILL_ROOT>/install/check.mjs
|
|
6
|
+
//
|
|
7
|
+
// Two layers, two answers:
|
|
8
|
+
// skill the installed skill folder (SKILL.md, guides/, install/, cold-start/) against the
|
|
9
|
+
// repository head: `current`, `behind` (with the files that differ), or `unknown`.
|
|
10
|
+
// templates `templates/.source` commit against the head: `current` or `behind`, with the
|
|
11
|
+
// verticals touched and the commit messages in between.
|
|
12
|
+
// Updating the skill changes how the agent works, not the project. Refreshing the templates changes
|
|
13
|
+
// what future deploys copy and what the agent reads, not `src/`. Nothing here touches `src/`.
|
|
14
|
+
import { mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
15
|
+
import { tmpdir } from "node:os";
|
|
16
|
+
import { join, relative } from "node:path";
|
|
17
|
+
import { spawnSync } from "node:child_process";
|
|
18
|
+
import { SKILL_ROOT, installSource, templatesDir, templatesSource } from "./templates.mjs";
|
|
19
|
+
|
|
20
|
+
const git = (args, opts = {}) => spawnSync("git", args, { encoding: "utf8", timeout: 120_000, ...opts });
|
|
21
|
+
const skillName = SKILL_ROOT.split("/").pop();
|
|
22
|
+
const { repo } = installSource();
|
|
23
|
+
|
|
24
|
+
const out = { skill: {}, templates: {}, update: {} };
|
|
25
|
+
|
|
26
|
+
// ---- the repository: one clone of its history without file contents (small), read for both layers
|
|
27
|
+
const tmp = mkdtempSync(join(tmpdir(), "wix-headless-kit-check-"));
|
|
28
|
+
const clone = git(["clone", "--quiet", "--filter=blob:none", "--no-checkout", "--single-branch", repo, tmp]);
|
|
29
|
+
if (clone.status !== 0) {
|
|
30
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
31
|
+
console.log(JSON.stringify({ error: `could not reach ${repo}: ${(clone.stderr || "").trim().slice(-200)}` }));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const head = git(["-C", tmp, "rev-parse", "HEAD"]).stdout.trim();
|
|
35
|
+
|
|
36
|
+
// ---- skill folder: every installed file's blob hash against the head's tree -------------------
|
|
37
|
+
{
|
|
38
|
+
const tree = git(["-C", tmp, "ls-tree", "-r", head, "--", `skills/${skillName}`]).stdout;
|
|
39
|
+
const remote = new Map(tree.split("\n").filter(Boolean).map((l) => { const [meta, path] = l.split("\t"); return [path.slice(`skills/${skillName}/`.length), meta.split(" ")[2]]; }));
|
|
40
|
+
const local = [];
|
|
41
|
+
const walk = (dir) => {
|
|
42
|
+
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
43
|
+
const p = join(dir, e.name);
|
|
44
|
+
if (e.name === "templates" && dir === SKILL_ROOT) continue; // the templates are the other layer
|
|
45
|
+
if (e.isDirectory()) walk(p); else local.push(relative(SKILL_ROOT, p));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
walk(SKILL_ROOT);
|
|
49
|
+
const differs = [], missingHere = [];
|
|
50
|
+
for (const f of local) if (remote.get(f) !== git(["hash-object", join(SKILL_ROOT, f)]).stdout.trim()) differs.push(f);
|
|
51
|
+
for (const f of remote.keys()) if (!local.includes(f)) missingHere.push(f);
|
|
52
|
+
out.skill = differs.length || missingHere.length
|
|
53
|
+
? { status: "behind", differs, ...(missingHere.length ? { missingHere } : {}), note: "a file that differs may also be one edited here; the update reinstalls the skill folder" }
|
|
54
|
+
: { status: "current" };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ---- templates: the recorded commit against the head ------------------------------------------
|
|
58
|
+
let dir = null;
|
|
59
|
+
try { dir = templatesDir(); } catch (e) { out.templates = { status: "unknown", detail: e.message }; }
|
|
60
|
+
if (dir) {
|
|
61
|
+
const src = templatesSource(dir);
|
|
62
|
+
if (src.checkout) out.templates = { status: "checkout", dir };
|
|
63
|
+
else if (!src.commit) out.templates = { status: "unknown", detail: "no commit recorded in templates/.source" };
|
|
64
|
+
else if (src.commit === head) out.templates = { status: "current", commit: src.commit };
|
|
65
|
+
else {
|
|
66
|
+
out.templates = { status: "behind", commit: src.commit, head };
|
|
67
|
+
const files = git(["-C", tmp, "diff", "--name-only", `${src.commit}..${head}`, "--", "templates"]).stdout.split("\n").filter(Boolean);
|
|
68
|
+
const log = git(["-C", tmp, "log", "--format=%s", `${src.commit}..${head}`, "--", "templates"]).stdout.split("\n").filter(Boolean);
|
|
69
|
+
if (files.length || log.length) {
|
|
70
|
+
out.templates.commitsBehind = log.length;
|
|
71
|
+
out.templates.verticals = [...new Set(files.map((f) => f.split("/")[1]).filter((v) => v && !v.endsWith(".mjs")))].sort();
|
|
72
|
+
out.templates.commits = log.slice(0, 20);
|
|
73
|
+
} else {
|
|
74
|
+
out.templates.detail = git(["-C", tmp, "cat-file", "-e", src.commit]).status === 0 ? "no template changes between the two commits" : "the recorded commit is not in the repository's history (a branch that was deleted?)";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
79
|
+
|
|
80
|
+
// ---- what would act on each ------------------------------------------------------------------
|
|
81
|
+
const rel = relative(process.cwd(), SKILL_ROOT) || ".";
|
|
82
|
+
out.update = {
|
|
83
|
+
skill: `CI=1 npx skills@latest update ${skillName} --yes (or: gh skill update ${skillName})`,
|
|
84
|
+
templates: `node ${rel}/install/templates.mjs --refresh (then commit the changed files under ${rel}/templates)`,
|
|
85
|
+
note: "neither touches src/; a shipped fix reaches the project by comparing its copy with the template",
|
|
86
|
+
};
|
|
87
|
+
console.log(JSON.stringify(out, null, 2));
|