@symbo.ls/mcp 1.0.9 → 1.0.11

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.
@@ -0,0 +1,400 @@
1
+ # Symbols Project Structure & Setup
2
+
3
+ Environment-agnostic folder structure for the Symbols platform. Generates independent files without JS module preloading, enabling seamless rendering across VSCode, file structure, Symbols platform, server rendering, and browsers.
4
+
5
+ ---
6
+
7
+ ## Core Principle
8
+
9
+ **NO JavaScript imports/exports for component usage.** Components are registered once in their folders and reused through a declarative object tree. No build step required.
10
+
11
+ ---
12
+
13
+ ## Full Project Layout
14
+
15
+ ```
16
+ smbls/
17
+ ├── index.js # Root entry: exports components, pages, state, designSystem, functions
18
+ ├── state.js # export default { key: initialValue, ... }
19
+ ├── dependencies.js # export default { 'pkg': 'exact-version' }
20
+ ├── config.js # export default { useReset: true, useVariable: true, ... }
21
+ ├── vars.js # export default { APP_VERSION: '1.0.0', ... }
22
+
23
+ ├── components/
24
+ │ ├── index.js # export * from './Foo.js' ← FLAT re-exports only
25
+ │ └── Navbar.js # export const Navbar = { ... }
26
+
27
+ ├── pages/
28
+ │ ├── index.js # import-based registry — ONLY file with imports allowed
29
+ │ └── main.js # export const main = { extends: 'Page', ... }
30
+
31
+ ├── functions/
32
+ │ ├── index.js # export * from './switchView.js'
33
+ │ └── switchView.js # export const switchView = function(...) {}
34
+
35
+ ├── methods/
36
+ │ ├── index.js # export * from './formatDate.js'
37
+ │ └── formatDate.js # export const formatDate = function(date) { ... }
38
+
39
+ ├── designSystem/
40
+ │ ├── index.js # export default { COLOR, THEME, FONT, ... }
41
+ │ ├── COLOR.js # export default { blue: '#0474f2', ... }
42
+ │ ├── THEME.js # export default { dialog: { ... }, ... }
43
+ │ └── TYPOGRAPHY.js # export default { base: 16, ratio: 1.25, ... }
44
+
45
+ └── state/ # (alternative to state.js)
46
+ ├── index.js # export default { user: {}, metrics: [], ... }
47
+ └── metrics.js # export default [{ title: 'Status', ... }]
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 1. Components (`components/`)
53
+
54
+ ```js
55
+ // components/Header.js
56
+ export const Header = {
57
+ extends: 'Flex',
58
+ minWidth: 'G2',
59
+ padding: 'A',
60
+
61
+ Search: { extends: 'Input', flex: 1 },
62
+ Avatar: { extends: 'Image', boxSize: 'B' },
63
+ }
64
+ ```
65
+
66
+ Rules:
67
+ - Named export matching filename (PascalCase)
68
+ - Component name MUST match filename
69
+ - No imports from other project files — reference by key name in tree
70
+ - Props use design system tokens (`minWidth: 'G2'`, `padding: 'A'`)
71
+
72
+ ```js
73
+ // components/index.js — use export * ONLY, never export * as
74
+ export * from './Header.js'
75
+ export * from './Navbar.js'
76
+ // ❌ NEVER: export * as Header from './Header.js'
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 2. Pages (`pages/`)
82
+
83
+ ```js
84
+ // pages/dashboard.js — dash-case filename, camelCase export
85
+ export const dashboard = {
86
+ extends: 'Page',
87
+ width: '100%',
88
+ padding: 'A',
89
+
90
+ onRender: async (el, state) => {
91
+ await el.call('auth')
92
+ },
93
+
94
+ Form: {
95
+ Input: { extends: 'Input', placeholder: 'Search...' }
96
+ }
97
+ }
98
+ ```
99
+
100
+ Rules:
101
+ - Filenames: **dash-case** (`add-network.js`, `edit-node.js`)
102
+ - Exports: **camelCase** (`export const addNetwork`)
103
+ - Always extend from `'Page'`
104
+
105
+ ```js
106
+ // pages/index.js — only file where imports are allowed
107
+ import { main } from './main.js'
108
+ import { dashboard } from './dashboard.js'
109
+
110
+ export default {
111
+ '/': main,
112
+ '/dashboard': dashboard,
113
+ }
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 3. Functions (`functions/`)
119
+
120
+ ```js
121
+ // functions/parseNetworkRow.js
122
+ export const parseNetworkRow = function parseNetworkRow(data) {
123
+ return processedData
124
+ }
125
+ ```
126
+
127
+ Rules:
128
+ - Named export matching filename (camelCase)
129
+ - Pure, standalone utilities — no imports of other project files
130
+ - Called via `el.call('functionName', ...args)` from event handlers
131
+
132
+ ```js
133
+ // In component
134
+ Button: { onClick: (e, el) => el.call('parseNetworkRow', data) }
135
+ ```
136
+
137
+ `el.call()` binds the DOMQL element as `this` inside the function.
138
+
139
+ ---
140
+
141
+ ## 4. Methods (`methods/`)
142
+
143
+ ```js
144
+ // methods/formatDate.js
145
+ export const formatDate = function(date) {
146
+ return new Intl.DateTimeFormat().format(date)
147
+ }
148
+ ```
149
+
150
+ Rules:
151
+ - Utility methods that extend element behavior
152
+ - Registered once, reused across all components
153
+
154
+ ---
155
+
156
+ ## 5. Design System (`designSystem/`)
157
+
158
+ ```js
159
+ // designSystem/COLOR.js
160
+ export default {
161
+ black: '#000',
162
+ white: '#fff',
163
+ primary: '#0066cc',
164
+ }
165
+
166
+ // designSystem/SPACING.js
167
+ export default { base: 16, ratio: 1.618 }
168
+
169
+ // designSystem/index.js
170
+ import COLOR from './COLOR.js'
171
+ import THEME from './THEME.js'
172
+ export default { COLOR, THEME }
173
+ ```
174
+
175
+ See `DESIGN_SYSTEM.md` for full token reference.
176
+
177
+ ---
178
+
179
+ ## 6. State (`state.js` or `state/index.js`)
180
+
181
+ ```js
182
+ // state.js
183
+ export default {
184
+ user: {},
185
+ activeModal: false,
186
+ currentPage: '/',
187
+ metrics: [],
188
+ }
189
+ ```
190
+
191
+ Rules:
192
+ - Pure data structures only — no logic, no methods
193
+ - All initial state inline in a single file (no cross-imports)
194
+ - Accessed and updated via `state.propertyName` or `state.update({})`
195
+
196
+ ---
197
+
198
+ ## 7. Dependencies (`dependencies.js`)
199
+
200
+ ```js
201
+ export default {
202
+ 'chart.js': '4.4.9',
203
+ 'fuse.js': '7.1.0',
204
+ 'lit': '3.1.0',
205
+ }
206
+ ```
207
+
208
+ Rules:
209
+ - Maps npm package names to **exact** version numbers (no `^` or `~`)
210
+ - No module preloading — packages imported on-demand via dynamic `import()`
211
+ - Keeps structure resolvable without a build step
212
+
213
+ Dynamic import pattern:
214
+ ```js
215
+ onClick: async (e, el) => {
216
+ const { Chart } = await import('chart.js')
217
+ const chart = new Chart(el.node, { /* config */ })
218
+ }
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 8. Config (`config.js`)
224
+
225
+ ```js
226
+ export default {
227
+ useReset: true,
228
+ useVariable: true,
229
+ useFontImport: true,
230
+ useIconSprite: true,
231
+ useSvgSprite: true,
232
+ useDefaultConfig: true,
233
+ useDocumentTheme: true,
234
+ verbose: false,
235
+ }
236
+ ```
237
+
238
+ Controls runtime behavior and rendering flags.
239
+
240
+ ---
241
+
242
+ ## Root `index.js`
243
+
244
+ The root entry file wires everything together:
245
+
246
+ ```js
247
+ export * as components from './components/index.js'
248
+ export { default as designSystem } from './designSystem/index.js'
249
+ export { default as state } from './state.js'
250
+ export { default as pages } from './pages/index.js'
251
+ export * as functions from './functions/index.js'
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Monorepo Package Layout
257
+
258
+ ```
259
+ next/
260
+ ├── smbls/ # monorepo submodule
261
+ │ ├── packages/
262
+ │ │ ├── element/ # @domql/element — core renderer
263
+ │ │ ├── utils/ # @domql/utils — shared utilities
264
+ │ │ ├── state/ # @domql/state
265
+ │ │ └── uikit/ # @symbo.ls/uikit
266
+ │ └── plugins/
267
+ │ └── router/ # @domql/router
268
+ ├── platform/ # internal platform app
269
+ └── rita/, bazaar/, ... # consumer apps
270
+ ```
271
+
272
+ All packages version-locked at the same version across the monorepo. Consumer apps depend on `"smbls": "3.x.x"` (workspace-resolved).
273
+
274
+ ---
275
+
276
+ ## CLI Setup
277
+
278
+ ### Installation
279
+
280
+ ```bash
281
+ npm i -g @symbo.ls/cli
282
+ ```
283
+
284
+ ### Create a new project
285
+
286
+ ```bash
287
+ # Local-only (fastest)
288
+ smbls create <project-name>
289
+ cd <project-name>
290
+ npm start
291
+
292
+ # Platform-linked (collaboration + remote preview)
293
+ smbls project create <project-name> --create-new
294
+ cd <project-name>
295
+ npm start
296
+ ```
297
+
298
+ ### Authentication
299
+
300
+ ```bash
301
+ smbls login --check # check login status
302
+ smbls login # sign in
303
+ smbls servers # list servers
304
+ smbls servers --select # switch server
305
+ ```
306
+
307
+ ### Sync & Collaboration
308
+
309
+ ```bash
310
+ smbls push # upload local → platform
311
+ smbls fetch --update # download platform → local
312
+ smbls sync # two-way sync (interactive conflict handling)
313
+ smbls collab # live collaboration watch mode (separate terminal)
314
+ ```
315
+
316
+ ### File Management
317
+
318
+ ```bash
319
+ smbls files list
320
+ smbls files upload
321
+ smbls files download
322
+ smbls files rm
323
+ ```
324
+
325
+ ### Linking an Existing Platform Project
326
+
327
+ ```bash
328
+ smbls project link . # interactive picker
329
+ smbls project link . --key <key>.symbo.ls # non-interactive
330
+ smbls project link . --id <projectId>
331
+ ```
332
+
333
+ ### Shell Auto-completion
334
+
335
+ ```bash
336
+ smbls completion zsh --install
337
+ smbls completion bash --install
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Remote Preview URLs
343
+
344
+ After linking and pushing a project, the preview URLs follow this pattern:
345
+
346
+ ```
347
+ Preview: https://<app>.<user>.preview.symbo.ls/
348
+ Dev env: https://dev.<app>.<user>.preview.symbo.ls/
349
+ With path: https://<app>.<user>.preview.symbo.ls/<subpath>
350
+ ```
351
+
352
+ Where:
353
+ - `<user>` — Symbols username or org
354
+ - `<app>` — project identifier
355
+ - `<env>` — optional environment (`dev`, `stage`, etc.)
356
+
357
+ Example for user `nikoloza`, project `my-app`:
358
+ ```
359
+ https://my-app.nikoloza.preview.symbo.ls/
360
+ https://dev.my-app.nikoloza.preview.symbo.ls/
361
+ ```
362
+
363
+ ---
364
+
365
+ ## AI Integration
366
+
367
+ To instruct an AI coding assistant to follow project conventions:
368
+
369
+ ```
370
+ Use instructions from all .md files in the /docs folder
371
+ ```
372
+
373
+ Best tools for Symbols development: Claude Code > Cursor > Copilot
374
+
375
+ Workflows that work best with AI assistance:
376
+ - Extending existing Symbols apps
377
+ - Migrating existing projects to Symbols
378
+ - Scaffolding new projects from screenshots or Figma
379
+
380
+ ---
381
+
382
+ ## Troubleshooting
383
+
384
+ | Problem | Fix |
385
+ | ----------------------------- | -------------------------------------------- |
386
+ | Auth required / access denied | `smbls login` |
387
+ | Missing project key | Check `symbols.json` or `smbls project link .` |
388
+ | Need verbose output | Add `--verbose` to any command |
389
+ | CLI not found | `npm i -g @symbo.ls/cli` |
390
+ | Build fails on new pkg method | Add method to `METHODS` in `keys.js` AND `set.js` |
391
+
392
+ ### Build order for monorepo changes
393
+
394
+ When changing smbls source, rebuild in dependency order:
395
+
396
+ ```bash
397
+ cd smbls/packages/utils && npm run build:esm # utils first
398
+ cd smbls/packages/element && npm run build:esm # then element
399
+ # consumer apps pick up via parcel --watch-dir=../smbls/packages
400
+ ```