synthesisui 0.1.15 → 0.1.16

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.
@@ -64,6 +64,22 @@ export async function add(slug, opts) {
64
64
  .join("\n")}\n`;
65
65
  await writeFile(join(slugDir, "rules.md"), body, "utf8");
66
66
  }
67
+ // 5c. structured philosophy (personal DS) → philosophy.md at the slug root.
68
+ // Narrative guidance (mission, principles, voice, motion doctrine…); the
69
+ // GUIDE points the agent here right after rules.md.
70
+ const philosophy = payload.document.philosophy;
71
+ const sections = philosophy?.sections ?? [];
72
+ if (sections.length > 0 || philosophy?.context) {
73
+ const parts = [`# ${payload.name} - Philosophy`, ""];
74
+ parts.push("> The voice and principles behind this system. Read after rules.md;", "> let it shape every screen. Managed by synthesisui (edit in the studio).", "");
75
+ if (philosophy?.context) {
76
+ parts.push("## What this product is", "", philosophy.context, "");
77
+ }
78
+ for (const s of sections) {
79
+ parts.push(`## ${s.title}`, "", s.body, "");
80
+ }
81
+ await writeFile(join(slugDir, "philosophy.md"), `${parts.join("\n")}\n`, "utf8");
82
+ }
67
83
  // 6. discovery by the agent
68
84
  const claudeMd = await syncClaudeMd(projectRoot);
69
85
  // outcome line
@@ -89,6 +105,9 @@ export async function add(slug, opts) {
89
105
  if (rules.length > 0) {
90
106
  console.log(` rules.md → ${rules.length} rule(s) (read these first)`);
91
107
  }
108
+ if (sections.length > 0 || philosophy?.context) {
109
+ console.log(` philosophy.md → ${sections.length} section(s) (read after rules)`);
110
+ }
92
111
  console.log(` CLAUDE.md ${claudeMd.created ? "created" : "updated"} (${claudeMd.count} system(s) installed)`);
93
112
  console.log("");
94
113
  console.log("Next steps:");
@@ -1,7 +1,11 @@
1
1
  import { DEFAULT_CONFIG, writeProjectConfig } from "../config.js";
2
+ import { add } from "./add.js";
2
3
  /**
3
- * Writes `_synthesisui/config.json` - where `synthesisui page` materializes
4
- * pages and which framework to target. Committable; safe to re-run.
4
+ * Bootstraps a project for SynthesisUI: writes `_synthesisui/config.json`
5
+ * (where `page` materializes pages, where components live, which framework to
6
+ * target) and - with `--ds <slug>` - immediately brings that system in, so the
7
+ * project lands with tokens, philosophy, rules and a CLAUDE.md in one step.
8
+ * Committable; safe to re-run.
5
9
  */
6
10
  export async function init(opts) {
7
11
  const root = opts.dir ?? process.cwd();
@@ -9,13 +13,22 @@ export async function init(opts) {
9
13
  const config = {
10
14
  target,
11
15
  pagesDir: opts.pagesDir ?? (target === "next" ? "app" : DEFAULT_CONFIG.pagesDir),
16
+ componentsDir: opts.componentsDir ?? DEFAULT_CONFIG.componentsDir,
12
17
  };
13
18
  await writeProjectConfig(root, config);
14
19
  console.log("✓ wrote _synthesisui/config.json");
15
- console.log(` target: ${config.target}`);
16
- console.log(` pagesDir: ${config.pagesDir}`);
20
+ console.log(` target: ${config.target}`);
21
+ console.log(` pagesDir: ${config.pagesDir}`);
22
+ console.log(` componentsDir: ${config.componentsDir}`);
23
+ // --ds bootstraps the project with a system in one step (tokens + philosophy
24
+ // + rules + CLAUDE.md all arrive via `add`).
25
+ if (opts.ds) {
26
+ console.log("");
27
+ await add(opts.ds, { registry: opts.registry, dir: root });
28
+ return;
29
+ }
17
30
  console.log("");
18
31
  console.log("Next steps:");
19
- console.log(" • synthesisui add <slug> bring a design system in");
32
+ console.log(" • synthesisui add <slug> bring a design system in");
20
33
  console.log(" • synthesisui page <slug> <template> materialize a full page");
21
34
  }
package/dist/config.js CHANGED
@@ -39,6 +39,7 @@ export async function writeToken(token, registry) {
39
39
  export const DEFAULT_CONFIG = {
40
40
  target: "next",
41
41
  pagesDir: "app",
42
+ componentsDir: "components",
42
43
  };
43
44
  const projectConfigPath = (root) => join(root, "_synthesisui", "config.json");
44
45
  /** Reads the project config, falling back to defaults when absent/invalid. */
@@ -51,6 +52,9 @@ export async function readProjectConfig(root) {
51
52
  pagesDir: typeof parsed.pagesDir === "string" && parsed.pagesDir
52
53
  ? parsed.pagesDir
53
54
  : DEFAULT_CONFIG.pagesDir,
55
+ componentsDir: typeof parsed.componentsDir === "string" && parsed.componentsDir
56
+ ? parsed.componentsDir
57
+ : DEFAULT_CONFIG.componentsDir,
54
58
  };
55
59
  }
56
60
  catch {
package/dist/guide.js CHANGED
@@ -123,13 +123,21 @@ place** - wire real data, split into components, swap the chart/icon/media place
123
123
  `
124
124
  : "";
125
125
  const hasRules = (payload.rules?.length ?? 0) > 0;
126
- const rulesNote = hasRules
126
+ const philosophy = payload.document.philosophy;
127
+ const hasPhilosophy = (philosophy?.sections?.length ?? 0) > 0 || !!philosophy?.context;
128
+ const readFirst = [
129
+ hasRules
130
+ ? `**Read \`_synthesisui/ds/${slug}/rules.md\` FIRST and obey it above everything else** - it carries this system's accumulated, project-specific rules; on any conflict they win.`
131
+ : "",
132
+ hasPhilosophy
133
+ ? `**Then read \`_synthesisui/ds/${slug}/philosophy.md\`** - the mission, principles, voice and motion doctrine. Let it shape every screen you build.`
134
+ : "",
135
+ ].filter(Boolean);
136
+ const rulesNote = readFirst.length > 0
127
137
  ? `
128
- ## Rules - highest authority
138
+ ## Read first - highest authority
129
139
 
130
- **Read \`_synthesisui/ds/${slug}/rules.md\` FIRST and obey it above everything else in this guide.**
131
- It carries this system's accumulated, project-specific rules; on any conflict they win over the
132
- generic guidance below.
140
+ ${readFirst.map((l) => `- ${l}`).join("\n")}
133
141
 
134
142
  ---
135
143
  `
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ const HELP = `synthesisui - bring SynthesisUI design systems into your project
11
11
 
12
12
  Usage:
13
13
  synthesisui login [options] connect the CLI to your account (device-flow)
14
- synthesisui init [options] write _synthesisui/config.json (target + pages dir)
14
+ synthesisui init [options] write _synthesisui/config.json (target, dirs); --ds to bring one in
15
15
  synthesisui list [options] list the published design systems
16
16
  synthesisui add <slug> [options] materialize a DS into _synthesisui/ds/<slug>/
17
17
  synthesisui page <slug> <template> materialize a whole page from a DS template
@@ -22,15 +22,18 @@ Options:
22
22
  --registry <url> registry URL (or env SYNTHESISUI_REGISTRY_URL)
23
23
  --dir <path> consumer project root (default: current directory)
24
24
  --version <n> install a specific version (default: latest)
25
- --ds <slug> target design system for generate (default: the installed one)
25
+ --ds <slug> init: bring this DS in right away · generate: target DS (default: installed)
26
26
  --name <name> preferred component name for generate
27
27
  --target <t> page/init target: next | general (default: next)
28
+ --pages-dir <dir> init: folder for generated pages (default: app)
29
+ --components-dir <dir> init: folder where components live (default: components)
28
30
  --out <path> output path for the generated page (default: <pagesDir>/<file>)
29
31
  -h, --help this help
30
32
 
31
33
  Examples:
32
34
  synthesisui login
33
35
  synthesisui init --target next
36
+ synthesisui init --target next --ds halogen bootstrap + bring a system in
34
37
  synthesisui list
35
38
  synthesisui add halogen
36
39
  synthesisui add halogen --version 3
@@ -102,7 +105,12 @@ async function main() {
102
105
  break;
103
106
  case "init": {
104
107
  const target = typeof flags.target === "string" ? flags.target : undefined;
105
- await init({ dir, target });
108
+ const pagesDir = typeof flags["pages-dir"] === "string" ? flags["pages-dir"] : undefined;
109
+ const componentsDir = typeof flags["components-dir"] === "string"
110
+ ? flags["components-dir"]
111
+ : undefined;
112
+ const ds = typeof flags.ds === "string" ? flags.ds : undefined;
113
+ await init({ dir, registry, target, pagesDir, componentsDir, ds });
106
114
  break;
107
115
  }
108
116
  case "page": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Traz design systems do SynthesisUI para qualquer projeto (materializa em _local/ds/).",
5
5
  "type": "module",
6
6
  "bin": {