@flashdsm/genome 0.2.0 → 0.4.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
@@ -32,7 +32,15 @@ In your app's folder, in a terminal or in your AI editor's chat:
32
32
  npx @flashdsm/genome@latest connect
33
33
  ```
34
34
 
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.
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`), writes the files an agent reads (AGENTS.md, the skill, the Cursor rule) 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
+
37
+ Run `connect` again in a folder that is already connected and it updates that system instead of making another: no scan, no Connect click; it pulls, refreshes the agent files and the live preview. `connect --new` makes a new system anyway. If the linked system is gone or this machine can't open it, connect says why and connects the folder as a new system.
38
+
39
+ Your app keeps running on its own CSS: `tokens.css` is Flash's copy, and nothing imports it until you say so. `connect` ends with one question for you (or your agent to ask you): use Flash's colours, so a change in Flash shows up in the app? The steps it prints keep every variable name and leave the screen the same in light and dark. AGENTS.md carries the same steps, plus how changes move: while `genome watch` runs in the background, both ways happen by themselves. Change a token in Flash and Genome rewrites `tokens.css` within seconds, no Publish; save the app's CSS and Flash takes the change. Genome never writes over a hand edit to `tokens.css` that Flash doesn't hold. Without it, `pull --confirm` and `push --confirm` do the same once.
40
+
41
+ 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.
42
+
43
+ `connect` also leaves Genome watching the folder. Change a colour, a theme or a type size in your app's own stylesheets and, a couple of seconds after you save, Flash takes it and the editor says what changed, with Undo. Only what you changed comes in: a token edited in Flash since keeps Flash's value (the notice says so), nothing in Flash is deleted, and a comment or whitespace save does nothing. Genome's own files (`tokens.css`, `design-tokens.json`, `genome/`) are never read back. It rescans once an hour as a backup, and keeps running after the terminal closes; the watcher and the live preview are one background process. `npx @flashdsm/genome@latest watch` starts it again, `watch --stop` ends both, and `watch --once` sends one scan in the foreground and says what Flash did with it. The log is `~/.config/flash-dsm/genome-watch.log`.
36
44
 
37
45
  The link works once and expires after 15 minutes. `init --code` does the same with a setup code instead of the browser.
38
46
 
@@ -112,13 +120,27 @@ diff behind.
112
120
  | Tool | What it does |
113
121
  | -------------- | ----------------------------------------------------------------------------------------------------- |
114
122
  | `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 |
123
+ | `push_to_web` | Proposes what the code changed to Flash as one change set, reviewed on the Sync page |
124
+
125
+ `push_to_web` reads the code two ways and sends both in one change set:
126
+
127
+ - **The app's own stylesheets.** A file layered on Flash's `tokens.css`
128
+ counts: a light block, `--danger: var(--danger-400)`, new `--text-*`
129
+ sizes. The files the pull wrote (listed in `genome/genome.lock`) are
130
+ never read as code.
131
+ - **The pulled `design-tokens.json`.** Value edits, aliases re-pointed
132
+ (`{color.danger-400}`), tokens added, and a light or dark value for a
133
+ colour Flash holds in the other theme only.
134
+
135
+ Flash merges them with one set of rules. A `var(--step)` re-points the
136
+ alias. A colour equal to a ramp step points at that step; a colour no step
137
+ holds gets a step of its own (`neutral-150`) in both themes, so nothing in
138
+ Semantic becomes a bare hex. New names are added, a value Flash has no
139
+ theme for is added and said so, and nothing is deleted. The plan says why
140
+ for every row that is more than a new value.
116
141
 
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.
142
+ Nothing is applied until someone with edit rights says yes. A token deleted
143
+ from the file is flagged, never sent as a delete.
122
144
 
123
145
  It is a dry run without `confirm: true`, and it refuses to push while Flash
124
146
  is ahead of `genome/genome.lock`, because a value left over from the last
@@ -221,7 +243,7 @@ Scripts and CI need no MCP client. These run the same code as the MCP tools
221
243
  ```bash
222
244
  flash-genome pull # print what would be written; writes nothing
223
245
  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
246
+ flash-genome push # print what the code changed, as Flash would propose it
225
247
  flash-genome push --confirm # open the change set for review in Flash
226
248
  flash-genome drift # has the repo moved, has Flash, which tokens
227
249
  flash-genome drift --json # the same, as one JSON object (for watchers)
@@ -288,7 +310,8 @@ otherwise only added).
288
310
  }
289
311
  ```
290
312
 
291
- `state` is one of `in-step`, `flash-ahead` (Flash published since the pull),
313
+ `state` is one of `in-step`, `flash-ahead` (Flash changed since the pull: its
314
+ revision moved, published or not),
292
315
  `repo-dirty` (a pulled file changed or is missing), `both`, `never-pulled`.
293
316
  `flashAhead` and `dirty` are the booleans behind it; `changedTokens` lists
294
317
  the token values the repo changed (`code: "repo-edit"`, what `push` would
@@ -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,8 +83,22 @@ 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
+ /** connect: a new system even when this folder is already connected. */
87
+ fresh: boolean;
88
+ /** preview: run the proxy in this process (what the background child runs). */
89
+ serve: boolean;
90
+ /** preview / watch: stop the background process. */
91
+ stop: boolean;
92
+ /** watch: one scan, sent in the foreground, then exit. */
93
+ once: boolean;
94
+ /** preview --serve: the app's dev server, the system, Flash's origin. */
95
+ devUrl?: string;
96
+ system?: number;
97
+ origin?: string;
78
98
  /** pull / push: write, rather than print the plan. */
79
99
  confirm: boolean;
100
+ /** pull: write even when it renames variables the app reads. */
101
+ acceptRename: boolean;
80
102
  /** pull / push / drift: one JSON object on stdout. */
81
103
  json: boolean;
82
104
  };