@flashdsm/genome 0.2.0 → 0.3.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/README.md CHANGED
@@ -34,6 +34,8 @@ npx @flashdsm/genome@latest connect
34
34
 
35
35
  `connect` scans the folder (stylesheets, CSS inside JS/TS, Tailwind config, theme modules, tokens files; nothing else is read) and opens Flash in your browser, showing what it found and a short code that matches the one in your terminal. Click **Connect** there: Flash creates the system in your account, and the command links the repo (`genome.config.json`), writes the system into it (`pull --confirm`) and stores a token bound to that system under `~/.config/flash-dsm/`. Inside Claude Code it also adds Genome as the project's MCP server; elsewhere it prints the line to add. `--name` overrides the name, which otherwise comes from `package.json`; `--no-open` prints the link instead of opening it.
36
36
 
37
+ When your app's dev server is running, `connect` also leaves a live preview in the background (localhost:4747): Flash's editor shows your real app and recolours it as you edit tokens, through its CSS variables. Nothing is written to your code. `npx @flashdsm/genome@latest preview` starts it again; `preview --stop` ends it.
38
+
37
39
  The link works once and expires after 15 minutes. `init --code` does the same with a setup code instead of the browser.
38
40
 
39
41
  ## Quick start
@@ -112,13 +114,27 @@ diff behind.
112
114
  | Tool | What it does |
113
115
  | -------------- | ----------------------------------------------------------------------------------------------------- |
114
116
  | `detect_drift` | Read-only. Whether the repo's pulled files moved, whether Flash moved, and which token values changed |
115
- | `push_to_web` | Proposes the changed token values to Flash as one change set, reviewed on the Sync page |
117
+ | `push_to_web` | Proposes what the code changed to Flash as one change set, reviewed on the Sync page |
118
+
119
+ `push_to_web` reads the code two ways and sends both in one change set:
120
+
121
+ - **The app's own stylesheets.** A file layered on Flash's `tokens.css`
122
+ counts: a light block, `--danger: var(--danger-400)`, new `--text-*`
123
+ sizes. The files the pull wrote (listed in `genome/genome.lock`) are
124
+ never read as code.
125
+ - **The pulled `design-tokens.json`.** Value edits, aliases re-pointed
126
+ (`{color.danger-400}`), tokens added, and a light or dark value for a
127
+ colour Flash holds in the other theme only.
128
+
129
+ Flash merges them with one set of rules. A `var(--step)` re-points the
130
+ alias. A colour equal to a ramp step points at that step; a colour no step
131
+ holds gets a step of its own (`neutral-150`) in both themes, so nothing in
132
+ Semantic becomes a bare hex. New names are added, a value Flash has no
133
+ theme for is added and said so, and nothing is deleted. The plan says why
134
+ for every row that is more than a new value.
116
135
 
117
- `push_to_web` reads the `design-tokens.json` the pull wrote, compares it
118
- with the design system as it is now, and proposes value changes to tokens
119
- Flash already has. Nothing is applied until someone with edit rights says
120
- yes. A token added, deleted or re-aliased in the file is flagged rather than
121
- sent: create, remove and re-point tokens in Flash, then pull.
136
+ Nothing is applied until someone with edit rights says yes. A token deleted
137
+ from the file is flagged, never sent as a delete.
122
138
 
123
139
  It is a dry run without `confirm: true`, and it refuses to push while Flash
124
140
  is ahead of `genome/genome.lock`, because a value left over from the last
@@ -221,7 +237,7 @@ Scripts and CI need no MCP client. These run the same code as the MCP tools
221
237
  ```bash
222
238
  flash-genome pull # print what would be written; writes nothing
223
239
  flash-genome pull --confirm # write the token files, the mirror and genome.lock
224
- flash-genome push # print the token edits that would be proposed
240
+ flash-genome push # print what the code changed, as Flash would propose it
225
241
  flash-genome push --confirm # open the change set for review in Flash
226
242
  flash-genome drift # has the repo moved, has Flash, which tokens
227
243
  flash-genome drift --json # the same, as one JSON object (for watchers)
@@ -498,6 +498,7 @@ export {
498
498
  parseFlashAtomicDocument,
499
499
  GENOME_CONFIG_FILENAME,
500
500
  LEGACY_CONFIG_FILENAME,
501
+ GenomeOutputsSchema,
501
502
  GenomeConfigSchema,
502
503
  normalizeTokenDocument,
503
504
  configCandidates,
package/dist/index.d.ts CHANGED
@@ -2,7 +2,15 @@
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { WorkspaceScanResult } from '@flash-ds/core';
4
4
 
5
- declare function scanWorkspace(workspaceRoot: string): Promise<WorkspaceScanResult>;
5
+ /**
6
+ * `skip` leaves files out by their path from the root. A push passes the
7
+ * files its lock lists: the core rulebook finds them through
8
+ * `genome.config.json`, which a repo linked with `--config elsewhere` does
9
+ * not keep at the root.
10
+ */
11
+ declare function scanWorkspace(workspaceRoot: string, opts?: {
12
+ skip?: (rel: string) => boolean;
13
+ }): Promise<WorkspaceScanResult>;
6
14
 
7
15
  type ApiClient = {
8
16
  health(): Promise<{
@@ -75,6 +83,14 @@ declare function parseCliArgs(argv: string[]): {
75
83
  name?: string;
76
84
  /** connect: print the link instead of opening the browser. */
77
85
  noOpen: boolean;
86
+ /** preview: run the proxy in this process (what the background child runs). */
87
+ serve: boolean;
88
+ /** preview: stop the background proxy. */
89
+ stop: boolean;
90
+ /** preview --serve: the app's dev server, the system, Flash's origin. */
91
+ devUrl?: string;
92
+ system?: number;
93
+ origin?: string;
78
94
  /** pull / push: write, rather than print the plan. */
79
95
  confirm: boolean;
80
96
  /** pull / push / drift: one JSON object on stdout. */