synthesisui 0.16.14 → 0.16.15
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/dist/claude-md.js +28 -2
- package/dist/commands/add.js +13 -1
- package/dist/commands/hook.js +40 -3
- package/package.json +1 -1
package/dist/claude-md.js
CHANGED
|
@@ -118,6 +118,32 @@ If it reports a value with no token, do NOT invent one. Say which value and what
|
|
|
118
118
|
you would call it, and let a person decide. An agent that quiets the report by
|
|
119
119
|
adding a token is growing the system unsupervised, which is worse than the
|
|
120
120
|
drift because it looks solved.`;
|
|
121
|
+
/**
|
|
122
|
+
* TWO THINGS AN AGENT GOT WRONG ON 28/07, BOTH CHEAP TO SAY OUT LOUD.
|
|
123
|
+
*
|
|
124
|
+
* It started a dev server to look at its work and left it running. The owner
|
|
125
|
+
* found it by trying to start his own and getting "Another next dev server is
|
|
126
|
+
* already running", with a PID to kill. Nothing in any contract had said to
|
|
127
|
+
* clean up, and a build proves the same thing without holding a port.
|
|
128
|
+
*
|
|
129
|
+
* And it offered to rebuild the create-next-app landing page by hand, on
|
|
130
|
+
* `ds-button` and `ds-card`, when a command already resets it in two seconds.
|
|
131
|
+
* It had found `clean` while exploring the CLI, so this is not a discovery
|
|
132
|
+
* problem - it is that nothing told it the command answers that situation.
|
|
133
|
+
*
|
|
134
|
+
* `--force` needs a person because it deletes. The dry run does not, so the
|
|
135
|
+
* agent is pointed at the harmless half and told to ask for the other.
|
|
136
|
+
*/
|
|
137
|
+
const VERIFY = `
|
|
138
|
+
|
|
139
|
+
**Verify with a build, not a running server.** If you do start a dev server, stop
|
|
140
|
+
it before you finish - one left running holds a port the next person needs.
|
|
141
|
+
|
|
142
|
+
If \`create-next-app\` boilerplate is in your way (the default page, the README,
|
|
143
|
+
the SVGs in \`public/\`), do not rebuild those files by hand. Run
|
|
144
|
+
\`npx synthesisui@latest clean\` to see what it would remove: it only touches files
|
|
145
|
+
nobody has edited. Ask the person before running it with \`--force\`, because that
|
|
146
|
+
one deletes.`;
|
|
121
147
|
const SELF_CHECK_MANUAL = `
|
|
122
148
|
|
|
123
149
|
**After writing or editing any UI file, check it before moving on:**
|
|
@@ -130,7 +156,7 @@ a component checked while you still have its context is a two-line fix; the same
|
|
|
130
156
|
component found in a repo-wide audit next week is an archaeology exercise.${REFUSAL}
|
|
131
157
|
|
|
132
158
|
Better than remembering: \`npx synthesisui@latest connect\` installs the check as
|
|
133
|
-
an editor hook, so it runs on its own and this paragraph stops being your job
|
|
159
|
+
an editor hook, so it runs on its own and this paragraph stops being your job.${VERIFY}`;
|
|
134
160
|
const SELF_CHECK_HOOKED = `
|
|
135
161
|
|
|
136
162
|
**The check runs by itself.** A hook reports on every file you write, naming the
|
|
@@ -138,7 +164,7 @@ token this project already has for anything hardcoded. You do not need to run
|
|
|
138
164
|
\`doctor\` by hand, and you should not wait for a final pass.
|
|
139
165
|
|
|
140
166
|
When it names something, fix it in that file before moving to the next one -
|
|
141
|
-
you still have the context, so it is a two-line change.${REFUSAL}`;
|
|
167
|
+
you still have the context, so it is a two-line change.${REFUSAL}${VERIFY}`;
|
|
142
168
|
/**
|
|
143
169
|
* THE INTERFACE LANGUAGE, READ FROM THE PROJECT RATHER THAN ASKED FOR.
|
|
144
170
|
*
|
package/dist/commands/add.js
CHANGED
|
@@ -150,7 +150,19 @@ export async function add(slug, opts) {
|
|
|
150
150
|
console.log("");
|
|
151
151
|
console.log(line(`2. Scope your app: add data-ds="${payload.slug}" to a ROOT element, e.g. ${appDir}/layout.tsx:`));
|
|
152
152
|
console.log("");
|
|
153
|
-
console.log(snippet([
|
|
153
|
+
console.log(snippet([
|
|
154
|
+
`<body data-ds="${payload.slug}" className="bg-canvas">{children}</body>`,
|
|
155
|
+
]));
|
|
156
|
+
// THE SCOPE DELIBERATELY DOES NOT PAINT A BACKGROUND, and every project hits
|
|
157
|
+
// it. `[data-ds]` sets ink and body family only, because scopes NEST: a dark
|
|
158
|
+
// contrast section over a photograph carries its own nested `data-ds` so its
|
|
159
|
+
// tokens remap, and a background on every scope would paint over the picture.
|
|
160
|
+
// So the page background is the root element's job, and saying so here is the
|
|
161
|
+
// fix - an agent found this by reading rendered CSS on 28/07 and had to
|
|
162
|
+
// deduce it.
|
|
163
|
+
console.log(line(` \`bg-canvas\` is not optional: the scope sets text colour and type, not the page`));
|
|
164
|
+
console.log(line(` background. Scopes nest (a dark section carries its own), so painting every one`));
|
|
165
|
+
console.log(line(` would cover whatever is behind it.`));
|
|
154
166
|
// 3. Load the type - the DS ships token NAMES, not the fonts themselves.
|
|
155
167
|
// Next apps get fonts.ts MATERIALIZED (deterministic does, not teaches):
|
|
156
168
|
// next/font = self-hosted + preloaded + adjusted fallback, no FOUT
|
package/dist/commands/hook.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { relative, resolve } from "node:path";
|
|
1
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join, relative, resolve } from "node:path";
|
|
3
3
|
import { diagnose, scanSource } from "../doctor/scan.js";
|
|
4
4
|
import { loadSystem } from "./doctor.js";
|
|
5
5
|
const pass = () => ({ continue: true });
|
|
@@ -13,6 +13,39 @@ const speak = (context) => ({
|
|
|
13
13
|
/** Files where a design value can even appear. A hook that parses a README on
|
|
14
14
|
* every edit is paying for nothing. */
|
|
15
15
|
const UI_FILE = /\.(tsx|jsx|ts|js|css|scss|vue|svelte)$/i;
|
|
16
|
+
/** Written after the hook's first report of any kind, and never read for anything
|
|
17
|
+
* else. Lives in our own directory, so removing the system removes the memory
|
|
18
|
+
* too. It is committed with `_synthesisui/`, which means the greeting is
|
|
19
|
+
* per-project and not per-teammate - a wart worth the simplicity, since the
|
|
20
|
+
* second person to clone a wired repo is not the one wondering if it installed. */
|
|
21
|
+
const GREETED = "_synthesisui/.hook-greeted";
|
|
22
|
+
const markGreeted = (root) => writeFile(join(root, GREETED), "", "utf8").catch(() => { });
|
|
23
|
+
/** One sentence, once per project. Addressed to the agent because the hook has
|
|
24
|
+
* no way to reach the person, and the person is who needs to know. */
|
|
25
|
+
async function greet(root, rel) {
|
|
26
|
+
const marker = join(root, GREETED);
|
|
27
|
+
try {
|
|
28
|
+
await readFile(marker, "utf8");
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Not greeted yet. Write first: a failed write must not produce a hook that
|
|
33
|
+
// greets on every single edit for the rest of the project's life.
|
|
34
|
+
try {
|
|
35
|
+
await writeFile(marker, "", "utf8");
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [
|
|
42
|
+
`${rel} - checked, nothing to name. Every value in it has a token.`,
|
|
43
|
+
"",
|
|
44
|
+
"That check now runs on every file you write, by itself. Tell the person once",
|
|
45
|
+
"that it is live, so they know it installed, and then stop mentioning it - from",
|
|
46
|
+
"here it only speaks when something needs a name.",
|
|
47
|
+
].join("\n");
|
|
48
|
+
}
|
|
16
49
|
async function report(root, filePath) {
|
|
17
50
|
const { table } = await loadSystem(root);
|
|
18
51
|
if (table.byName.size === 0)
|
|
@@ -28,7 +61,11 @@ async function report(root, filePath) {
|
|
|
28
61
|
// no token to move to, so the only honest advice is "ask a person" - and
|
|
29
62
|
// saying that after every edit trains the reader to skip the block.
|
|
30
63
|
if (named.length === 0 && phantoms.length === 0)
|
|
31
|
-
return
|
|
64
|
+
return greet(root, rel);
|
|
65
|
+
// A report IS the evidence the greeting exists to provide, so it counts as the
|
|
66
|
+
// introduction. Otherwise a project whose first file had drift would get the
|
|
67
|
+
// "it is live" sentence afterwards, telling somebody who just watched it work.
|
|
68
|
+
await markGreeted(root);
|
|
32
69
|
const lines = [`${rel} - checked against ${table.name ?? table.slug}.`];
|
|
33
70
|
if (named.length > 0) {
|
|
34
71
|
lines.push("", "Values written by hand that this system already has a name for:", ...named
|
package/package.json
CHANGED