@syncline-design/cli 0.1.0-sandbox.42 → 0.1.0-sandbox.45

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/README.md CHANGED
@@ -84,6 +84,10 @@ Every key is optional; this is the full shape with its defaults. The Figma plugi
84
84
  "llm": false, // paid: let the bridge resolve what a 3-way merge can't
85
85
  "sendSource": false, // required with llm: the conflicting files' source is sent to the bridge
86
86
  },
87
+ "enrichStories": {
88
+ "enabled": false, // paid: AI-proposed stories with play() tests, for components with no stories file yet
89
+ "verify": true, // run each proposed story (jsdom, your Vitest) and write only the ones that pass
90
+ },
87
91
  "theme": {
88
92
  "cssReset": false, // global page state, so opt-in
89
93
  "backgroundToken": "Background/Default/Default",
@@ -149,6 +153,14 @@ masks the token and writes `token`, `name` and `email` to `$GITHUB_OUTPUT`;
149
153
  without one (no bridge, no credentials, app not installed) it says why and exits
150
154
  0, and the workflow pushes with its own token instead.
151
155
 
156
+ ## Preview access (for the seeded workflow)
157
+
158
+ `syncline ci preview-access` asks the bridge whether the Storybook preview is
159
+ available to the repository's account and writes `enabled=true|false` to
160
+ `$GITHUB_OUTPUT` (printed elsewhere). The workflow's `preview` job runs its build
161
+ only on `true`. Anything but a clear yes (no bridge, no credentials, an older
162
+ bridge, an outage) is `false`, and it always exits 0.
163
+
152
164
  ## TypeScript and Storybook defaults
153
165
 
154
166
  - **`tsconfig.json`:** the generated components, ThemeProvider and Storybook decorator
@@ -204,6 +216,29 @@ keep every export, and contain no conflict markers); anything else leaves the
204
216
  conflict to you. `--check` never calls the bridge, and a run without a bridge,
205
217
  credentials or the paid plan just reports the conflicts.
206
218
 
219
+ ## AI-proposed stories (`enrichStories`)
220
+
221
+ With `enrichStories.enabled` (a paid feature) the CLI asks the bridge for extra
222
+ stories with `play()` interaction tests, for every component that has no stories
223
+ file yet. **Only facts leave the repo**: prop names and closed option lists, and
224
+ the roles and texts a story can act on; no source code. The model's answer is
225
+ data that the CLI validates against the real component (props, options and
226
+ targets must exist) before it renders the `play()` with `storybook/test`, so
227
+ whatever the model gets wrong is dropped, not written. Answers are cached in
228
+ `.figma/stories.enriched.json` (commit it), `--check` and `--no-enrich` never
229
+ call the bridge, and a run without a bridge, credentials or the paid plan just
230
+ writes the plain stories. An existing stories file is never rewritten.
231
+
232
+ **Every proposed story is run before it is written** (`enrichStories.verify`, on
233
+ by default). The model cannot know what a component really does, and in a first
234
+ trial 44% of the proposals failed when run. The CLI renders the proposals into
235
+ the project, runs them headless with the project's own Vitest (jsdom, your
236
+ `vite.config.*` and `.storybook/preview`, Storybook's portable stories), keeps
237
+ the ones that pass and records the rest, with the reason, under `rejected` in the
238
+ cache, so a re-run does not ask again. It needs `vitest`, `jsdom` and
239
+ `@storybook/react` in the project; without them nothing is written and the run
240
+ says why. Set `verify` to `false` to write the proposals unchecked.
241
+
207
242
  ## Dependencies
208
243
 
209
244
  The generated code imports `react`, `react-dom`, `styled-components` and, with
package/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { r as e } from "./run-BkY-ZvBm.js";
2
+ import { r as e } from "./run-jiOpeOqI.js";
3
3
  //#region src/bin.ts
4
4
  e(process.argv.slice(2), {
5
5
  out: (e) => process.stdout.write(e),
package/index.js CHANGED
@@ -1,2 +1,51 @@
1
- import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./run-BkY-ZvBm.js";
2
- export { r as BridgeError, m as CLI_NAME, i as CLI_VERSION, c as CliConfigSchema, a as DEFAULT_CONFIG_FILE, t as bridgeClientProvider, d as createBridgeClient, s as enrichDesign, u as formatFiles, e as generate, n as getBridgeToken, h as hashFacts, l as helpText, o as loadCliConfig, f as run, p as runEnrichStep };
1
+ import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, k as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as w, u as T, v as E, w as D, x as O, y as k } from "./run-jiOpeOqI.js";
2
+ import { join as A } from "node:path";
3
+ //#region src/stories/project-step.ts
4
+ async function j(n) {
5
+ let { cwd: r, config: i, io: o } = n;
6
+ if (!i.enrichStories.enabled) return { status: "disabled" };
7
+ let s = a({
8
+ root: r,
9
+ designPath: i.inputs.design,
10
+ enrichedPath: i.inputs.enriched,
11
+ assetsPath: i.inputs.assets,
12
+ annotationsPath: i.inputs.annotations,
13
+ brandImage: i.theme.brand?.image
14
+ });
15
+ if (s.ok === !1) return {
16
+ status: "no-design",
17
+ reason: s.error
18
+ };
19
+ let l = A(r, i.inputs.stories), u = n.env ?? process.env, d = await f({
20
+ input: {
21
+ ...s.input,
22
+ existing: O(r)
23
+ },
24
+ config: i,
25
+ cachePath: l,
26
+ bridgeUrl: t({
27
+ env: u,
28
+ configured: i.enrich.bridgeUrl ?? n.bridgeUrl,
29
+ baked: e
30
+ }),
31
+ audience: n.audience ?? i.enrich.audience,
32
+ provider: n.provider,
33
+ io: o,
34
+ env: u,
35
+ fetch: n.fetch,
36
+ sleep: n.sleep
37
+ });
38
+ if (!d) return { status: "skipped" };
39
+ let p = i.enrichStories.verify ? await b({
40
+ ...n,
41
+ cachePath: l,
42
+ generate: c
43
+ }) : void 0;
44
+ return {
45
+ status: "done",
46
+ proposals: d.size,
47
+ ...p && { verified: p }
48
+ };
49
+ }
50
+ //#endregion
51
+ export { o as BridgeError, w as CLI_NAME, g as CLI_VERSION, n as CliConfigSchema, i as DEFAULT_CONFIG_FILE, C as applyVerification, E as bridgeClientProvider, T as cachedStoryEnrichment, r as createBridgeClient, k as enrichDesign, v as enrichStories, p as formatFiles, c as generate, D as getBridgeToken, l as hashFacts, m as hashStoryFacts, y as helpText, h as loadCliConfig, u as proposalKeys, d as readStoriesCache, S as run, s as runEnrichStep, j as runProjectStoriesStep, f as runStoriesStep, _ as runVitestHarness, x as selectProposals, b as verifyProposals };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncline-design/cli",
3
- "version": "0.1.0-sandbox.42",
3
+ "version": "0.1.0-sandbox.45",
4
4
  "description": "Generates a React component library from a Figma export (Syncline).",
5
5
  "license": "MIT",
6
6
  "repository": {