@symbo.ls/mcp 1.0.26 → 1.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbo.ls/mcp",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Symbols.app MCP — docs, code generation, publishing, CLI/SDK reference",
5
5
  "mcpName": "io.github.symbo-ls/symbols-mcp",
6
6
  "files": [
@@ -8,12 +8,9 @@ These are the **recommended default design system values** for all newly created
8
8
 
9
9
  ```js
10
10
  export default {
11
- '@default': {
12
- base: 16,
13
- ratio: 1.25,
14
- range: [-5, 12],
15
- subSequence: true,
16
- },
11
+ base: 16,
12
+ ratio: 1.25,
13
+ subSequence: true,
17
14
  }
18
15
  ```
19
16
 
@@ -25,16 +22,13 @@ export default {
25
22
 
26
23
  ```js
27
24
  export default {
28
- '@default': {
29
- base: 16,
30
- ratio: 1.25,
31
- range: [-5, 12],
32
- subSequence: true,
33
- },
25
+ base: 16,
26
+ ratio: 1.618,
27
+ subSequence: true,
34
28
  }
35
29
  ```
36
30
 
37
- Uses the same scale as typography. Tokens: `A` = 20px, `B` = 25px, `Z` = 16px, etc.
31
+ Golden ratio (1.618) for spacing. Tokens: `A` = 16px, `B` = 26px, `C` = 42px, etc.
38
32
 
39
33
  ---
40
34
 
@@ -402,7 +402,8 @@ npm i -g @symbo.ls/cli
402
402
 
403
403
  | Goal | Command |
404
404
  |------|---------|
405
- | Local-only (fastest) | `smbls create <project-name> && cd <project-name> && npm start` |
405
+ | Default (with `system/default` library) | `smbls create <project-name> && cd <project-name> && npm start` |
406
+ | Blank (no shared libraries) | `smbls create <project-name> --blank-shared-libraries && cd <project-name> && npm start` |
406
407
  | Platform-linked (collaboration + remote preview) | `smbls project create <project-name> --create-new && cd <project-name> && npm start` |
407
408
 
408
409
  ### Authentication
@@ -1230,6 +1230,24 @@ color: { blue50: '#eff6ff', blue100: '#dbeafe', blue200: '#bfdbfe', blue300: '#9
1230
1230
 
1231
1231
  ---
1232
1232
 
1233
+ ## Rule 46 — Fetched shared libraries are READONLY — override locally instead
1234
+
1235
+ When shared libraries are fetched from the platform (`smbls fetch`/`smbls sync`), both `sharedLibraries.js` and the `.symbols_local/libs/` folders are strictly **readonly** — they are overwritten on every fetch/sync. Never edit fetched library files. To override shared library components, define them in your local project files — the app always wins at runtime.
1236
+
1237
+ `sharedLibraries.js` can be manually edited when custom-linking to local folders (advanced use case). But fetched libraries must never be modified.
1238
+
1239
+ ```js
1240
+ // ❌ WRONG — editing fetched .symbols_local/libs/ files
1241
+ // These are overwritten on every fetch/sync
1242
+
1243
+ // ✅ CORRECT — override in local components/
1244
+ // If shared library has Button with theme: 'primary',
1245
+ // define your own Button in components/Button.js to override it
1246
+ export const Button = { theme: 'dialog', padding: 'Z A' }
1247
+ ```
1248
+
1249
+ ---
1250
+
1233
1251
  ## Rule 44 — Never chain CSS selectors — use nesting instead
1234
1252
 
1235
1253
  Media queries (`@dark`, `@mobileL`) and pseudo-classes (`:hover`, `:active`) must be nested as separate objects, never chained into a single key string.
@@ -1,6 +1,25 @@
1
1
  # sharedLibraries
2
2
 
3
- sharedLibraries is a mechanism in the Symbols framework that allows projects to inherit components, functions, methods, state, designSystem, pages, files, snippets, and dependencies from external library projects. Libraries are merged into the consuming app's context at runtime — no manual re-exports needed.
3
+ sharedLibraries allows projects to inherit components, functions, methods, state, designSystem, pages, files, snippets, and dependencies from external library projects. Libraries are merged into the consuming app's context at runtime — no manual re-exports needed.
4
+
5
+ **CRITICAL: When shared libraries are fetched from the platform, both `sharedLibraries.js` and `.symbols_local/libs/` folders are strictly READONLY — they are overwritten on every `smbls fetch`/`smbls sync`.** To override shared library components, define them in your local project files (app always wins).
6
+
7
+ `sharedLibraries.js` can be manually edited for custom linking to local folders (advanced use case), but fetched content must never be modified.
8
+
9
+ ---
10
+
11
+ ## Key Format: `owner/key`
12
+
13
+ All shared library identifiers use the `owner/key` format. Default owner is `system`.
14
+
15
+ | Input | Normalized |
16
+ |---|---|
17
+ | `system/default` | `system/default` |
18
+ | `default` | `system/default` |
19
+ | `default.symbo.ls` | `system/default` (deprecated) |
20
+ | `myorg/mylib` | `myorg/mylib` |
21
+
22
+ The `.symbo.ls` suffix is deprecated and stripped automatically.
4
23
 
5
24
  ---
6
25
 
@@ -11,41 +30,45 @@ sharedLibraries is a mechanism in the Symbols framework that allows projects to
11
30
  Three supported formats:
12
31
 
13
32
  ```json
14
- // Array of strings (library keys)
15
- "sharedLibraries": ["brand", "shared"]
33
+ // Array of strings (owner/key or bare key)
34
+ "sharedLibraries": ["system/default", "system/landing"]
16
35
 
17
36
  // Object with key:version
18
- "sharedLibraries": { "brand": "1.0.0", "shared": "latest" }
37
+ "sharedLibraries": { "system/default": "1.0.0" }
19
38
 
20
- // Object with key:config (used in editor)
21
- "sharedLibraries": {
22
- "brand": { "version": "1.0.0", "destDir": "../brand" },
23
- "shared": { "destDir": "../shared" }
24
- }
39
+ // Object with key:config
40
+ "sharedLibraries": { "system/default": { "version": "1.0.0", "destDir": "./custom" } }
25
41
  ```
26
42
 
27
- All formats are normalized by the CLI (`cli/helpers/symbolsConfig.js:246-268`) to: `[{ key, version, destDir }]`
43
+ All formats normalize keys to `owner/key` via `normalizeLibraryKey()`.
28
44
 
29
- ### sharedLibraries.js
45
+ ### sharedLibraries.js (auto-generated on fetch/sync)
30
46
 
31
- Each package has a `sharedLibraries.js` that imports other packages' `context.js` and exports them as an array:
47
+ The CLI generates this file automatically after `smbls fetch`/`smbls sync`:
32
48
 
33
49
  ```js
34
- import brand from '../brand/context.js'
35
- import shared from '../shared/context.js'
50
+ import systemDefault from '../.symbols_local/libs/system--default/context.js'
36
51
 
37
- export default [brand, shared]
52
+ export default [systemDefault]
38
53
  ```
39
54
 
40
- For remote libraries fetched from the platform:
55
+ This file is overwritten on every fetch/sync. To customize behavior, override components/state/designSystem in your local project files instead.
41
56
 
42
- ```js
43
- import platformSymboLs from '../.symbols_local/libs/platform.symbo.ls/context.js'
44
- import docsSymboLs from '../.symbols_local/libs/docs.symbo.ls/context.js'
57
+ ### File Structure After Fetch
45
58
 
46
- export default [platformSymboLs, docsSymboLs]
59
+ Directory names use `owner--key` format (double dash separator):
60
+
61
+ ```
62
+ .symbols_local/libs/
63
+ system--default/ # owner--key directory convention
64
+ context.js
65
+ components/
66
+ designSystem/
67
+ ...
47
68
  ```
48
69
 
70
+ The `owner--key` directory convention matches mermaid hosting URLs (`key--owner.preview.symbols.app`).
71
+
49
72
  ### context.js
50
73
 
51
74
  The `sharedLibraries` array is included in the context export:
@@ -82,29 +105,31 @@ This runs early in context initialization, **before** designSystem, state, compo
82
105
 
83
106
  ### Merge Logic
84
107
 
85
- `smbls/src/prepare.js:240-251`:
108
+ `smbls/src/prepare.js`:
86
109
 
87
110
  ```js
88
111
  export const prepareSharedLibs = (context) => {
89
112
  const sharedLibraries = context.sharedLibraries
90
113
  for (let i = 0; i < sharedLibraries.length; i++) {
91
114
  const sharedLib = sharedLibraries[i]
92
- if (context.type === 'template') {
93
- overwriteShallow(context.designSystem, sharedLib.designSystem)
94
- deepMerge(context, sharedLib, ['designSystem'], 1)
95
- } else {
96
- deepMerge(context, sharedLib, [], 1)
115
+ for (const key in sharedLib) {
116
+ if (isObject(sharedLib[key]) && isObject(context[key])) {
117
+ if (key === 'designSystem') {
118
+ deepDefaults(context[key], sharedLib[key])
119
+ } else {
120
+ for (const k in sharedLib[key]) {
121
+ if (!(k in context[key])) context[key][k] = sharedLib[key][k]
122
+ }
123
+ }
124
+ } else if (!(key in context)) {
125
+ context[key] = sharedLib[key]
126
+ }
97
127
  }
98
128
  }
99
129
  }
100
130
  ```
101
131
 
102
- **Two strategies:**
103
-
104
- | App Type | designSystem | Everything Else |
105
- |----------|-------------|-----------------|
106
- | **template** | `overwriteShallow` — library completely replaces template's designSystem | `deepMerge` with designSystem excluded |
107
- | **regular** | `deepMerge` (app wins) | `deepMerge` (app wins) |
132
+ **The app ALWAYS wins.** Shared libraries only fill in missing keys (`!(k in context[key])`). designSystem uses `deepDefaults` which fills nested gaps while preserving all local values.
108
133
 
109
134
  ### deepMerge Behavior
110
135
 
@@ -184,56 +209,36 @@ So the final component resolution is: **App > Shared Libraries > UIKit**
184
209
 
185
210
  ## CLI Integration
186
211
 
187
- ### Scaffolding (`cli/bin/fs.js:231-345`)
212
+ ### Project Creation
188
213
 
189
- `scaffoldSharedLibraries()`:
190
- 1. Reads `sharedLibraries` from project JSON
191
- 2. Creates each library as a full project folder via frank's `toFS()`
192
- 3. Default location: `.symbols_local/libs/`
193
- 4. Generates `sharedLibraries.js` with import statements
194
-
195
- ### Fetch (`cli/bin/fetch.js`)
196
-
197
- When fetching from the platform:
198
- - Pulls full project data including `sharedLibraries` array
199
- - Each library is a complete Symbols project object
200
- - Extracts version info and stores in lock file
214
+ ```bash
215
+ smbls create my-app # Default: adds system/default + fetches
216
+ smbls create my-app --blank-shared-libraries # Blank: no shared libraries, skips fetch
217
+ ```
201
218
 
202
- ### toJSON (`frank/toJSON.js:170-183`)
219
+ When creating with default libraries:
220
+ 1. Project is created on the platform
221
+ 2. `system/default` library is attached via API
222
+ 3. Local files are scaffolded
223
+ 4. `smbls fetch` runs to pull library data into `.symbols_local/libs/`
203
224
 
204
- Context modules list includes sharedLibraries:
225
+ ### Library Management
205
226
 
206
- ```js
207
- const CONTEXT_MODULES = [
208
- { name: 'state', path: './state.js', style: 'default' },
209
- { name: 'dependencies', path: './dependencies.js', style: 'default' },
210
- { name: 'sharedLibraries', path: './sharedLibraries.js', style: 'default' },
211
- { name: 'components', path: './components/index.js', style: 'namespace' },
212
- { name: 'snippets', path: './snippets/index.js', style: 'namespace' },
213
- { name: 'pages', path: './pages/index.js', style: 'default' },
214
- { name: 'functions', path: './functions/index.js', style: 'namespace' },
215
- { name: 'methods', path: './methods/index.js', style: 'namespace' },
216
- { name: 'designSystem', path: './designSystem/index.js', style: 'default' },
217
- { name: 'files', path: './files/index.js', style: 'default' },
218
- { name: 'config', path: './config.js', style: 'default' }
219
- ]
227
+ ```bash
228
+ smbls project libs available # List all available libraries (shows owner/key)
229
+ smbls project libs list # List libraries linked to current project
230
+ smbls project libs add system/default # Add by owner/key
231
+ smbls project libs add default # Bare key → system/default
232
+ smbls project libs remove default # Remove library
220
233
  ```
221
234
 
222
- ### Validation (`cli/bin/validate-domql-runner.js:323-342`)
223
-
224
- `mergeSharedLibraries()` merges all library exports for DOMQL validation:
235
+ ### Scaffolding
225
236
 
226
- ```js
227
- function mergeSharedLibraries(sharedLibraries) {
228
- const merged = { pages: {}, components: {}, functions: {}, methods: {}, snippets: {} }
229
- for (const lib of libs) {
230
- if (isPlainObject(lib?.pages)) Object.assign(merged.pages, lib.pages)
231
- if (isPlainObject(lib?.components)) Object.assign(merged.components, lib.components)
232
- // ...
233
- }
234
- return merged
235
- }
236
- ```
237
+ `scaffoldSharedLibraries()` in `cli/bin/fs.js`:
238
+ 1. Reads `sharedLibraries` from project JSON
239
+ 2. Creates each library as a full project folder via frank's `toFS()`
240
+ 3. Default location: `.symbols_local/libs/`
241
+ 4. Auto-generates `sharedLibraries.js` with import statements (overwritten every time)
237
242
 
238
243
  ---
239
244
 
@@ -289,12 +294,13 @@ prepareContext() {
289
294
 
290
295
  ## Key Takeaways
291
296
 
292
- 1. **No re-exports needed** — components/functions from a shared library are automatically available in the consuming app's context
293
- 2. **App always wins** — app's own definitions take precedence over shared libraries
294
- 3. **Order matters** — first library in the array has priority over later ones for filling undefined slots
295
- 4. **Templates are special** — designSystem is fully overwritten (shallow) rather than deep-merged
296
- 5. **Methods are protected**METHODS_EXL prevents shared libraries from overwriting element methods and internal references
297
- 6. **No circular detection** JavaScript's ESM module system prevents infinite loops naturally; circular deps resolve as undefined values
297
+ 1. **Fetched shared libraries are readonly** — `sharedLibraries.js` and `.symbols_local/libs/` are overwritten on fetch/sync. Manual editing only for custom local linking.
298
+ 2. **App always wins** — local project definitions take precedence over shared libraries
299
+ 3. **Override by defining locally** — to change a shared library component, define it in your local `components/` with the same name
300
+ 4. **Order matters** — first library in the array has priority over later ones for filling undefined slots
301
+ 5. **Key format is `owner/key`** bare keys default to `system/` owner
302
+ 6. **`smbls create` defaults to `system/default`** use `--blank-shared-libraries` for no libraries
303
+ 7. **Methods are protected** — METHODS_EXL prevents shared libraries from overwriting element methods and internal references
298
304
 
299
305
  ---
300
306
 
@@ -307,6 +313,7 @@ prepareContext() {
307
313
  | deepMerge | `smbls/packages/utils/object.js` | 61-76 |
308
314
  | overwriteShallow | `smbls/packages/utils/object.js` | 431-439 |
309
315
  | METHODS_EXL | `smbls/packages/utils/keys.js` | 147-152 |
316
+ | Key normalization | `smbls/packages/cli/helpers/libraryKeyUtils.js` | — |
310
317
  | Config normalization | `smbls/packages/cli/helpers/symbolsConfig.js` | 246-268 |
311
318
  | FS scaffolding | `smbls/packages/cli/bin/fs.js` | 231-345 |
312
319
  | Context modules | `smbls/packages/frank/toJSON.js` | 170-183 |