@jay-framework/jay-stack-cli 0.12.0 → 0.14.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.
@@ -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 their contracts. Read `materialized-contracts/contracts-index.yaml` for the full contract list.
30
- 3. **Read plugin.yaml** — for each plugin, read its `plugin.yaml` (at the path from plugins-index) to see contract descriptions and available **actions** (e.g., `searchProducts`, `getCategories`).
31
- 4. **Read contracts** — read the `.jay-contract` files to understand data shapes, tag types, phases, and props.
29
+ 2. **Discover plugins** — read `plugins-index.yaml` to see available plugins, contracts, and actions.
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 (action names come from plugin.yaml). Use reference files (step 5) first when available — they're faster than running CLI commands.
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
 
@@ -50,7 +50,7 @@ There is no standalone "interactive" phase. Any tag with `type: interactive` (re
50
50
 
51
51
  ### 1. Discover plugins and contracts
52
52
 
53
- Read `materialized-contracts/plugins-index.yaml`:
53
+ Read `plugins-index.yaml`:
54
54
 
55
55
  ```yaml
56
56
  plugins:
@@ -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
@@ -50,8 +50,7 @@ jay-stack agent-kit --no-references
50
50
 
51
51
  Outputs:
52
52
 
53
- - `materialized-contracts/contracts-index.yaml`
54
- - `materialized-contracts/plugins-index.yaml`
53
+ - `plugins-index.yaml`
55
54
  - `materialized-contracts/<plugin>/*.jay-contract` (dynamic contracts)
56
55
  - `references/<plugin>/` — plugin reference data (product catalogs, collection schemas, etc.)
57
56
  - Documentation files (INSTRUCTIONS.md and reference docs)
@@ -147,7 +146,7 @@ jay-stack action wix-stores/getProductBySlug --input '{"slug": "blue-shirt"}' -v
147
146
 
148
147
  Format: `<plugin-name>/<action-name>`
149
148
 
150
- Action names are listed in the plugin's `plugin.yaml` under `actions:`.
149
+ 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
150
 
152
151
  Example output:
153
152
 
@@ -2,10 +2,9 @@
2
2
 
3
3
  ## Discovery: Plugins Index
4
4
 
5
- After running `jay-stack agent-kit`, read `materialized-contracts/plugins-index.yaml`:
5
+ After running `jay-stack agent-kit`, read `plugins-index.yaml`:
6
6
 
7
7
  ```yaml
8
- materialized_at: '2026-02-09T...'
9
8
  jay_stack_version: '1.0.0'
10
9
  plugins:
11
10
  - name: wix-stores
@@ -17,6 +16,13 @@ plugins:
17
16
  - name: product-search
18
17
  type: static
19
18
  path: ./node_modules/@wix/stores/lib/contracts/product-search.jay-contract
19
+ actions:
20
+ - name: searchProducts
21
+ description: Search products with text/filter/sort/pagination
22
+ path: ./node_modules/@wix/stores/lib/actions/search-products.jay-action
23
+ - name: getProductBySlug
24
+ description: Get a single product by URL slug
25
+ path: ./node_modules/@wix/stores/lib/actions/get-product-by-slug.jay-action
20
26
  ```
21
27
 
22
28
  Fields:
@@ -26,18 +32,9 @@ Fields:
26
32
  - `contracts[].name` — contract name (use in `contract="..."` attributes)
27
33
  - `contracts[].type` — `static` (defined in source) or `dynamic` (generated at runtime)
28
34
  - `contracts[].path` — path to the `.jay-contract` file you can read
29
-
30
- ## Discovery: Contracts Index
31
-
32
- `materialized-contracts/contracts-index.yaml` lists all contracts across all plugins:
33
-
34
- ```yaml
35
- contracts:
36
- - plugin: wix-stores
37
- name: product-page
38
- type: static
39
- path: ./node_modules/@wix/stores/lib/contracts/product-page.jay-contract
40
- ```
35
+ - `actions[].name` — action name (use with `jay-stack action <plugin>/<action>`)
36
+ - `actions[].description` short description of what the action does
37
+ - `actions[].path` — path to the `.jay-action` file with full input/output schemas
41
38
 
42
39
  ## Reading plugin.yaml
43
40
 
@@ -55,16 +52,20 @@ contracts:
55
52
  component: productSearch
56
53
  description: Headless product search page
57
54
  actions:
58
- - searchProducts
59
- - getProductBySlug
60
- - getCategories
55
+ - name: searchProducts
56
+ action: search-products.jay-action
57
+ - name: getProductBySlug
58
+ action: get-product-by-slug.jay-action
59
+ - name: getCategories
60
+ action: get-categories.jay-action
61
61
  ```
62
62
 
63
63
  Key fields:
64
64
 
65
65
  - `contracts[].name` — use in `contract="..."` in jay-html
66
66
  - `contracts[].description` — what the component does (helps you decide which to use)
67
- - `actions[]` — action names you can run with `jay-stack action <plugin>/<action>`
67
+ - `actions[].name` — action name (use with `jay-stack action <plugin>/<action>`)
68
+ - `actions[].action` — path to `.jay-action` file with full metadata (description, input/output schemas)
68
69
 
69
70
  ## Reading .jay-contract Files
70
71
 
@@ -202,6 +203,56 @@ tags:
202
203
  elementType: HTMLButtonElement
203
204
  ```
204
205
 
206
+ ## Reading .jay-action Files
207
+
208
+ 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).
209
+
210
+ ### .jay-action Format
211
+
212
+ ```yaml
213
+ name: searchProducts
214
+ description: Search products with text/filter/sort/pagination
215
+
216
+ import:
217
+ productCard: product-card.jay-contract
218
+
219
+ inputSchema:
220
+ query: string
221
+ filters?:
222
+ inStockOnly?: boolean
223
+ minPrice?: number
224
+ maxPrice?: number
225
+ sortBy?: enum(relevance | price_asc | price_desc)
226
+ pageSize?: number
227
+
228
+ outputSchema:
229
+ products:
230
+ - productCard
231
+ totalCount: number
232
+ hasMore: boolean
233
+ ```
234
+
235
+ ### Jay-Type Notation
236
+
237
+ Schemas use a compact type notation:
238
+
239
+ | Notation | Meaning |
240
+ | --------------------------------- | -------------------------------------------------------- |
241
+ | `propName: string` | Required string property |
242
+ | `propName?: number` | Optional number property |
243
+ | `propName: boolean` | Required boolean |
244
+ | `propName: enum(a \| b \| c)` | Required enum |
245
+ | `propName:` + nested block | Nested object |
246
+ | `propName:` + `- childProp: type` | Array of objects (YAML list) |
247
+ | `propName: importedName` | Type from `import:` block (references a `.jay-contract`) |
248
+ | `- importedName` | Array of imported type |
249
+
250
+ ### Using Action Metadata
251
+
252
+ 1. **Discovery** — read `plugins-index.yaml` for action names and descriptions
253
+ 2. **Details** — read the `.jay-action` file at the path for full input/output schemas
254
+ 3. **Run** — use `jay-stack action <plugin>/<action> --input '{...}'` with a JSON body matching the inputSchema
255
+
205
256
  ## From Contract to Jay-HTML
206
257
 
207
258
  ### Step by step
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { LogLevel } from '@jay-framework/logger';
2
- import { PublishMessage, PublishResponse, SaveImageMessage, SaveImageResponse, HasImageMessage, HasImageResponse, GetProjectInfoMessage, GetProjectInfoResponse } from '@jay-framework/editor-protocol';
3
- export { ContractIndexEntry, ContractsIndex, MaterializeContractsOptions, MaterializeResult, listContracts, materializeContracts } from '@jay-framework/stack-server-runtime';
2
+ import { PublishMessage, PublishResponse, SaveImageMessage, SaveImageResponse, HasImageMessage, HasImageResponse, GetProjectInfoMessage, GetProjectInfoResponse, ExportMessage, ExportResponse, ImportMessage, ImportResponse, ProjectPage, Plugin } from '@jay-framework/editor-protocol';
3
+ export { MaterializeContractsOptions, MaterializeResult, PluginContractEntry, PluginsIndex, PluginsIndexEntry, listContracts, materializeContracts } from '@jay-framework/stack-server-runtime';
4
4
 
5
5
  interface StartDevServerOptions {
6
6
  projectPath?: string;
@@ -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
- export { type JayConfig, type StartDevServerOptions, createEditorHandlers, getConfigWithDefaults, loadConfig, startDevServer, updateConfig };
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 };