@jay-framework/jay-stack-cli 0.12.0 → 0.13.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/agent-kit-template/INSTRUCTIONS.md +9 -5
- package/agent-kit-template/cli-commands.md +1 -1
- package/agent-kit-template/contracts-and-plugins.md +68 -4
- package/dist/index.d.ts +74 -2
- package/dist/index.js +1973 -530
- package/lib/vendors/README.md +510 -0
- package/lib/vendors/figma/README.md +396 -0
- package/package.json +10 -10
- package/test/vendors/figma/fixtures/README.md +164 -0
|
@@ -26,11 +26,11 @@ There is no standalone "interactive" phase. Any tag with `type: interactive` (re
|
|
|
26
26
|
## Workflow
|
|
27
27
|
|
|
28
28
|
1. **Read this file** for overview and workflow
|
|
29
|
-
2. **Discover plugins** — read `materialized-contracts/plugins-index.yaml` to see available plugins and
|
|
30
|
-
3. **Read
|
|
31
|
-
4. **Read
|
|
29
|
+
2. **Discover plugins** — read `materialized-contracts/plugins-index.yaml` to see available plugins, contracts, and actions. Read `materialized-contracts/contracts-index.yaml` for the full contract list.
|
|
30
|
+
3. **Read contracts** — read the `.jay-contract` files (paths from plugins-index) to understand data shapes, tag types, phases, and props.
|
|
31
|
+
4. **Read actions** — read `.jay-action` files (paths from plugins-index) to see action descriptions, input schemas, and output schemas. This tells you what data each action accepts and returns.
|
|
32
32
|
5. **Read references** — check `references/<plugin>/` for pre-generated discovery data (product catalogs, collection schemas, etc.). These are generated by `jay-stack agent-kit` and contain real data from the site.
|
|
33
|
-
6. **Discover data** — run `jay-stack params <plugin>/<contract>` for SSG route params, `jay-stack action <plugin>/<action>` for data discovery
|
|
33
|
+
6. **Discover data** — run `jay-stack params <plugin>/<contract>` for SSG route params, `jay-stack action <plugin>/<action>` for data discovery. Use reference files (step 5) first when available — they're faster than running CLI commands.
|
|
34
34
|
7. **Create pages** — write `.jay-html` files under `src/pages/` following directory-based routing.
|
|
35
35
|
8. **Validate** — run `jay-stack validate` to check for errors.
|
|
36
36
|
9. **Test** — run `jay-stack dev --test-mode` and verify pages render.
|
|
@@ -42,7 +42,7 @@ There is no standalone "interactive" phase. Any tag with `type: interactive` (re
|
|
|
42
42
|
| [project-structure.md](project-structure.md) | Project layout, styling patterns (CSS themes, design tokens), configuration files |
|
|
43
43
|
| [jay-html-syntax.md](jay-html-syntax.md) | Jay-HTML template syntax: data binding, conditions, loops, headless components |
|
|
44
44
|
| [routing.md](routing.md) | Directory-based routing: page structure, dynamic routes, route priority |
|
|
45
|
-
| [contracts-and-plugins.md](contracts-and-plugins.md) | Reading contracts, plugin.yaml, and the materialized indexes
|
|
45
|
+
| [contracts-and-plugins.md](contracts-and-plugins.md) | Reading contracts, plugin.yaml, .jay-action files, and the materialized indexes |
|
|
46
46
|
| [cli-commands.md](cli-commands.md) | CLI commands: setup, validate, params, action, dev server |
|
|
47
47
|
| `references/<plugin>/` | Pre-generated discovery data: product catalogs, collection schemas (from `jay-stack agent-kit`) |
|
|
48
48
|
|
|
@@ -60,6 +60,10 @@ plugins:
|
|
|
60
60
|
- name: product-page
|
|
61
61
|
type: static
|
|
62
62
|
path: ./node_modules/@wix/stores/lib/contracts/product-page.jay-contract
|
|
63
|
+
actions:
|
|
64
|
+
- name: searchProducts
|
|
65
|
+
description: Search products with text/filter/sort/pagination
|
|
66
|
+
path: ./node_modules/@wix/stores/lib/actions/search-products.jay-action
|
|
63
67
|
```
|
|
64
68
|
|
|
65
69
|
### 2. Read a contract
|
|
@@ -147,7 +147,7 @@ jay-stack action wix-stores/getProductBySlug --input '{"slug": "blue-shirt"}' -v
|
|
|
147
147
|
|
|
148
148
|
Format: `<plugin-name>/<action-name>`
|
|
149
149
|
|
|
150
|
-
Action names are listed in
|
|
150
|
+
Action names are listed in `plugins-index.yaml` under each plugin's `actions:` array. Each action entry includes a `description` and a `path` to the `.jay-action` file. Read the `.jay-action` file to see the full input/output schemas before calling an action.
|
|
151
151
|
|
|
152
152
|
Example output:
|
|
153
153
|
|
|
@@ -17,6 +17,13 @@ plugins:
|
|
|
17
17
|
- name: product-search
|
|
18
18
|
type: static
|
|
19
19
|
path: ./node_modules/@wix/stores/lib/contracts/product-search.jay-contract
|
|
20
|
+
actions:
|
|
21
|
+
- name: searchProducts
|
|
22
|
+
description: Search products with text/filter/sort/pagination
|
|
23
|
+
path: ./node_modules/@wix/stores/lib/actions/search-products.jay-action
|
|
24
|
+
- name: getProductBySlug
|
|
25
|
+
description: Get a single product by URL slug
|
|
26
|
+
path: ./node_modules/@wix/stores/lib/actions/get-product-by-slug.jay-action
|
|
20
27
|
```
|
|
21
28
|
|
|
22
29
|
Fields:
|
|
@@ -26,6 +33,9 @@ Fields:
|
|
|
26
33
|
- `contracts[].name` — contract name (use in `contract="..."` attributes)
|
|
27
34
|
- `contracts[].type` — `static` (defined in source) or `dynamic` (generated at runtime)
|
|
28
35
|
- `contracts[].path` — path to the `.jay-contract` file you can read
|
|
36
|
+
- `actions[].name` — action name (use with `jay-stack action <plugin>/<action>`)
|
|
37
|
+
- `actions[].description` — short description of what the action does
|
|
38
|
+
- `actions[].path` — path to the `.jay-action` file with full input/output schemas
|
|
29
39
|
|
|
30
40
|
## Discovery: Contracts Index
|
|
31
41
|
|
|
@@ -55,16 +65,20 @@ contracts:
|
|
|
55
65
|
component: productSearch
|
|
56
66
|
description: Headless product search page
|
|
57
67
|
actions:
|
|
58
|
-
- searchProducts
|
|
59
|
-
|
|
60
|
-
-
|
|
68
|
+
- name: searchProducts
|
|
69
|
+
action: search-products.jay-action
|
|
70
|
+
- name: getProductBySlug
|
|
71
|
+
action: get-product-by-slug.jay-action
|
|
72
|
+
- name: getCategories
|
|
73
|
+
action: get-categories.jay-action
|
|
61
74
|
```
|
|
62
75
|
|
|
63
76
|
Key fields:
|
|
64
77
|
|
|
65
78
|
- `contracts[].name` — use in `contract="..."` in jay-html
|
|
66
79
|
- `contracts[].description` — what the component does (helps you decide which to use)
|
|
67
|
-
- `actions[]` — action
|
|
80
|
+
- `actions[].name` — action name (use with `jay-stack action <plugin>/<action>`)
|
|
81
|
+
- `actions[].action` — path to `.jay-action` file with full metadata (description, input/output schemas)
|
|
68
82
|
|
|
69
83
|
## Reading .jay-contract Files
|
|
70
84
|
|
|
@@ -202,6 +216,56 @@ tags:
|
|
|
202
216
|
elementType: HTMLButtonElement
|
|
203
217
|
```
|
|
204
218
|
|
|
219
|
+
## Reading .jay-action Files
|
|
220
|
+
|
|
221
|
+
Actions with `.jay-action` files have rich metadata: name, description, and typed input/output schemas. Read the file at the `path` from `plugins-index.yaml` (or from `plugin.yaml`'s `actions[].action` field).
|
|
222
|
+
|
|
223
|
+
### .jay-action Format
|
|
224
|
+
|
|
225
|
+
```yaml
|
|
226
|
+
name: searchProducts
|
|
227
|
+
description: Search products with text/filter/sort/pagination
|
|
228
|
+
|
|
229
|
+
import:
|
|
230
|
+
productCard: product-card.jay-contract
|
|
231
|
+
|
|
232
|
+
inputSchema:
|
|
233
|
+
query: string
|
|
234
|
+
filters?:
|
|
235
|
+
inStockOnly?: boolean
|
|
236
|
+
minPrice?: number
|
|
237
|
+
maxPrice?: number
|
|
238
|
+
sortBy?: enum(relevance | price_asc | price_desc)
|
|
239
|
+
pageSize?: number
|
|
240
|
+
|
|
241
|
+
outputSchema:
|
|
242
|
+
products:
|
|
243
|
+
- productCard
|
|
244
|
+
totalCount: number
|
|
245
|
+
hasMore: boolean
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Jay-Type Notation
|
|
249
|
+
|
|
250
|
+
Schemas use a compact type notation:
|
|
251
|
+
|
|
252
|
+
| Notation | Meaning |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| `propName: string` | Required string property |
|
|
255
|
+
| `propName?: number` | Optional number property |
|
|
256
|
+
| `propName: boolean` | Required boolean |
|
|
257
|
+
| `propName: enum(a \| b \| c)` | Required enum |
|
|
258
|
+
| `propName:` + nested block | Nested object |
|
|
259
|
+
| `propName:` + `- childProp: type` | Array of objects (YAML list) |
|
|
260
|
+
| `propName: importedName` | Type from `import:` block (references a `.jay-contract`) |
|
|
261
|
+
| `- importedName` | Array of imported type |
|
|
262
|
+
|
|
263
|
+
### Using Action Metadata
|
|
264
|
+
|
|
265
|
+
1. **Discovery** — read `plugins-index.yaml` for action names and descriptions
|
|
266
|
+
2. **Details** — read the `.jay-action` file at the path for full input/output schemas
|
|
267
|
+
3. **Run** — use `jay-stack action <plugin>/<action> --input '{...}'` with a JSON body matching the inputSchema
|
|
268
|
+
|
|
205
269
|
## From Contract to Jay-HTML
|
|
206
270
|
|
|
207
271
|
### Step by step
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevel } from '@jay-framework/logger';
|
|
2
|
-
import { PublishMessage, PublishResponse, SaveImageMessage, SaveImageResponse, HasImageMessage, HasImageResponse, GetProjectInfoMessage, GetProjectInfoResponse } from '@jay-framework/editor-protocol';
|
|
2
|
+
import { PublishMessage, PublishResponse, SaveImageMessage, SaveImageResponse, HasImageMessage, HasImageResponse, GetProjectInfoMessage, GetProjectInfoResponse, ExportMessage, ExportResponse, ImportMessage, ImportResponse, ProjectPage, Plugin } from '@jay-framework/editor-protocol';
|
|
3
3
|
export { ContractIndexEntry, ContractsIndex, MaterializeContractsOptions, MaterializeResult, listContracts, materializeContracts } from '@jay-framework/stack-server-runtime';
|
|
4
4
|
|
|
5
5
|
interface StartDevServerOptions {
|
|
@@ -35,6 +35,78 @@ declare function createEditorHandlers(config: Required<JayConfig>, tsConfigPath:
|
|
|
35
35
|
onSaveImage: (params: SaveImageMessage) => Promise<SaveImageResponse>;
|
|
36
36
|
onHasImage: (params: HasImageMessage) => Promise<HasImageResponse>;
|
|
37
37
|
onGetProjectInfo: (params: GetProjectInfoMessage) => Promise<GetProjectInfoResponse>;
|
|
38
|
+
onExport: <TVendorDoc>(params: ExportMessage<TVendorDoc>) => Promise<ExportResponse>;
|
|
39
|
+
onImport: <TVendorDoc_1>(params: ImportMessage<TVendorDoc_1>) => Promise<ImportResponse<TVendorDoc_1>>;
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Vendor Interface
|
|
44
|
+
*
|
|
45
|
+
* Each vendor (e.g., Figma, Sketch, Adobe XD) implements this interface
|
|
46
|
+
* to provide conversion from their native format to Jay HTML format.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Result of vendor conversion containing body HTML, fonts, and contract data
|
|
51
|
+
*/
|
|
52
|
+
interface VendorConversionResult {
|
|
53
|
+
/**
|
|
54
|
+
* The body HTML content (without <html>, <head>, or <body> tags)
|
|
55
|
+
*/
|
|
56
|
+
bodyHtml: string;
|
|
57
|
+
/**
|
|
58
|
+
* Set of font family names used in the document
|
|
59
|
+
*/
|
|
60
|
+
fontFamilies: Set<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Optional contract data for the page
|
|
63
|
+
* If provided, will be used to generate the jay-data script tag
|
|
64
|
+
*/
|
|
65
|
+
contractData?: {
|
|
66
|
+
/**
|
|
67
|
+
* Contract name
|
|
68
|
+
*/
|
|
69
|
+
name: string;
|
|
70
|
+
/**
|
|
71
|
+
* Contract tags in YAML format
|
|
72
|
+
*/
|
|
73
|
+
tagsYaml: string;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
interface Vendor<TVendorDoc = any> {
|
|
77
|
+
/**
|
|
78
|
+
* The unique identifier for this vendor (e.g., 'figma', 'sketch', 'xd')
|
|
79
|
+
*/
|
|
80
|
+
vendorId: string;
|
|
81
|
+
/**
|
|
82
|
+
* Convert vendor document to body HTML with metadata
|
|
83
|
+
*
|
|
84
|
+
* @param vendorDoc - The vendor's native document format (e.g., Figma SectionNode)
|
|
85
|
+
* @param pageUrl - The page URL/route (e.g., '/home', '/products')
|
|
86
|
+
* @returns Conversion result with body HTML, fonts, and contract data
|
|
87
|
+
*/
|
|
88
|
+
convertToBodyHtml(vendorDoc: TVendorDoc, pageUrl: string, projectPage: ProjectPage, plugins: Plugin[]): Promise<VendorConversionResult>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get a vendor by ID
|
|
93
|
+
*
|
|
94
|
+
* @param vendorId - The vendor ID
|
|
95
|
+
* @returns The vendor or undefined if not found
|
|
96
|
+
*/
|
|
97
|
+
declare function getVendor(vendorId: string): Vendor | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Check if a vendor exists
|
|
100
|
+
*
|
|
101
|
+
* @param vendorId - The vendor ID
|
|
102
|
+
* @returns True if vendor exists
|
|
103
|
+
*/
|
|
104
|
+
declare function hasVendor(vendorId: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Get all registered vendor IDs
|
|
107
|
+
*
|
|
108
|
+
* @returns Array of vendor IDs
|
|
109
|
+
*/
|
|
110
|
+
declare function getRegisteredVendors(): string[];
|
|
111
|
+
|
|
112
|
+
export { type JayConfig, type StartDevServerOptions, type Vendor, createEditorHandlers, getConfigWithDefaults, getRegisteredVendors, getVendor, hasVendor, loadConfig, startDevServer, updateConfig };
|