@synap-core/cli 1.2.0 → 1.5.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.
Files changed (74) hide show
  1. package/README.md +26 -0
  2. package/dist/commands/agents.d.ts +31 -0
  3. package/dist/commands/agents.js +478 -0
  4. package/dist/commands/agents.js.map +1 -0
  5. package/dist/commands/connect.d.ts +18 -1
  6. package/dist/commands/connect.js +154 -74
  7. package/dist/commands/connect.js.map +1 -1
  8. package/dist/commands/connections.d.ts +9 -0
  9. package/dist/commands/connections.js +161 -0
  10. package/dist/commands/connections.js.map +1 -0
  11. package/dist/commands/data.d.ts +43 -0
  12. package/dist/commands/data.js +387 -0
  13. package/dist/commands/data.js.map +1 -0
  14. package/dist/commands/finish.js +41 -8
  15. package/dist/commands/finish.js.map +1 -1
  16. package/dist/commands/infra.d.ts +21 -0
  17. package/dist/commands/infra.js +262 -0
  18. package/dist/commands/infra.js.map +1 -0
  19. package/dist/commands/init.js +188 -10
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/commands/knowledge.d.ts +36 -0
  22. package/dist/commands/knowledge.js +123 -0
  23. package/dist/commands/knowledge.js.map +1 -0
  24. package/dist/commands/openclaw.d.ts +2 -0
  25. package/dist/commands/openclaw.js +300 -23
  26. package/dist/commands/openclaw.js.map +1 -1
  27. package/dist/commands/pods.d.ts +17 -0
  28. package/dist/commands/pods.js +371 -0
  29. package/dist/commands/pods.js.map +1 -0
  30. package/dist/commands/status.d.ts +14 -1
  31. package/dist/commands/status.js +78 -220
  32. package/dist/commands/status.js.map +1 -1
  33. package/dist/commands/update.d.ts +11 -2
  34. package/dist/commands/update.js +116 -5
  35. package/dist/commands/update.js.map +1 -1
  36. package/dist/index.js +370 -3
  37. package/dist/index.js.map +1 -1
  38. package/dist/lib/agents-config.d.ts +20 -0
  39. package/dist/lib/agents-config.js +45 -0
  40. package/dist/lib/agents-config.js.map +1 -0
  41. package/dist/lib/auth.d.ts +4 -0
  42. package/dist/lib/auth.js +4 -0
  43. package/dist/lib/auth.js.map +1 -1
  44. package/dist/lib/browser-auth.d.ts +35 -0
  45. package/dist/lib/browser-auth.js +170 -0
  46. package/dist/lib/browser-auth.js.map +1 -0
  47. package/dist/lib/hub-client.d.ts +17 -0
  48. package/dist/lib/hub-client.js +115 -0
  49. package/dist/lib/hub-client.js.map +1 -0
  50. package/dist/lib/openclaw.js +30 -19
  51. package/dist/lib/openclaw.js.map +1 -1
  52. package/dist/lib/pod.d.ts +32 -1
  53. package/dist/lib/pod.js +121 -9
  54. package/dist/lib/pod.js.map +1 -1
  55. package/dist/lib/skills-installer.d.ts +18 -0
  56. package/dist/lib/skills-installer.js +97 -0
  57. package/dist/lib/skills-installer.js.map +1 -0
  58. package/dist/lib/targets.d.ts +65 -0
  59. package/dist/lib/targets.js +673 -0
  60. package/dist/lib/targets.js.map +1 -0
  61. package/package.json +5 -3
  62. package/skills/README.md +91 -0
  63. package/skills/synap/README.md +76 -0
  64. package/skills/synap/SKILL.md +882 -0
  65. package/skills/synap/capture.md +170 -0
  66. package/skills/synap/governance.md +206 -0
  67. package/skills/synap/linking.md +128 -0
  68. package/skills/synap/scripts/orient.sh +28 -0
  69. package/skills/synap-schema/SKILL.md +231 -0
  70. package/skills/synap-schema/property-types.md +228 -0
  71. package/skills/synap-ui/SKILL.md +295 -0
  72. package/skills/synap-ui/bento-recipes.md +608 -0
  73. package/skills/synap-ui/view-types.md +259 -0
  74. package/skills/synap-ui/widget-catalog.md +305 -0
@@ -0,0 +1,295 @@
1
+ ---
2
+ name: synap-ui
3
+ description: >
4
+ Use this skill when the user wants to BUILD interface in Synap — creating views,
5
+ dashboards, bento layouts, or whole workspaces over their data. Triggers:
6
+ "build me a dashboard for tracking X", "create a kanban for my projects",
7
+ "make a CRM workspace", "I want a feed view of my articles", "design a home
8
+ dashboard", "show my reading list as a gallery", "turn this into a
9
+ timeline/calendar/matrix", "generate a workspace for content creation /
10
+ sales / research / project management / fitness tracking", "arrange widgets
11
+ on my bento", "create a command / automation trigger". This skill PRESENTS
12
+ data — the underlying entities must already exist (use core `synap`) and
13
+ schema extensions happen via `synap-schema`. Always propose workspace creation
14
+ to the user before committing — workspaces are lenses on data, not silos,
15
+ and the user decides when a new lens is warranted.
16
+ metadata:
17
+ openclaw:
18
+ requires:
19
+ env: [SYNAP_HUB_API_KEY, SYNAP_POD_URL]
20
+ primaryEnv: SYNAP_HUB_API_KEY
21
+ homepage: https://synap.live
22
+ capabilities: [views, bento, workspaces, widgets]
23
+ os: [macos, linux, windows]
24
+ userInvocable: false
25
+ ---
26
+
27
+ # Synap — UI generation
28
+
29
+ You build the surfaces the user sees: views over their data, bento dashboards, full workspaces tuned for a domain. The core rule: **emergent complexity.** A workspace is a lens; a view is a lens; a bento is a composition of lenses. Everything renders through the cell system, nothing is hardcoded.
30
+
31
+ ## Before you build anything
32
+
33
+ Always inventory. Never hallucinate view types, widget kinds, or profiles.
34
+
35
+ ```
36
+ GET /api/hub/manifest
37
+ → static capability map: view types, bento block kinds, inline patterns, browser-native cells
38
+ (call once per session — no DB queries, safe to cache)
39
+
40
+ GET /api/hub/profiles?userId={userId}&workspaceId={workspaceId}
41
+ → what data exists
42
+
43
+ GET /api/hub/widget-definitions?workspaceId={workspaceId}
44
+ → [{ kind, category, label, description, configSchema, supportedContexts }]
45
+
46
+ GET /api/hub/views?userId={userId}&workspaceId={workspaceId}
47
+ → [{ id, name, type, profileSlug, config }]
48
+ ```
49
+
50
+ Widget definitions are the source of truth for which cells are installed and how to configure them. **Never guess cell kinds.** If a cell doesn't appear in the registry, don't reference it (unless it's a browser-native cell from the manifest).
51
+
52
+ ## Four things you can build
53
+
54
+ 1. **Views** — named queries + rendering config over entities of a given profile. Kanban of tasks, gallery of articles, calendar of events.
55
+ 2. **Bento dashboards** — 12-col grid compositions of cells (view-cards, entity-cards, widgets). The Home dashboard is a bento. Workspace landing pages are bentos.
56
+ 3. **Workspaces** — full lenses with profiles, views, a bento, and seed entities. The biggest building block.
57
+ 4. **New cell types** (Capability B) — AI can define entirely new rendering cells when no existing widget covers the need. Cells run in an iframe sandbox and are always proposal-gated — the user reviews before they appear in the registry.
58
+
59
+ ```json
60
+ POST /api/hub/cells/define
61
+ {
62
+ "userId": "{userId}",
63
+ "workspaceId": "{workspaceId}",
64
+ "kind": "burndown-chart",
65
+ "displayName": "Burndown Chart",
66
+ "description": "Sprint burndown over task completions",
67
+ "configSchema": { "sprintId": { "type": "string" } },
68
+ "sandboxCode": "<!-- self-contained HTML/JS -->"
69
+ }
70
+ ```
71
+
72
+ Always `GET /api/hub/widget-definitions` first — if a cell already covers the need, use it. New cell definitions are permanent; only create when genuinely novel.
73
+
74
+ ## View types (16 total, 12 implemented)
75
+
76
+ Pick one that matches the data's shape AND the user's intent:
77
+
78
+ | Type | Implemented | When it fits |
79
+ | ---------------- | ----------- | ---------------------------------------------------------- |
80
+ | `table` | yes | Dense data, many columns, sort/filter heavy |
81
+ | `list` | yes | Scan-friendly, compact rows (tasks, notes) |
82
+ | `grid` | yes | Card grid, medium density |
83
+ | `gallery` | yes | Image-forward cards (articles, bookmarks, products) |
84
+ | `kanban` | yes | Status pipelines (tasks by status, deals by stage) |
85
+ | `matrix` | yes | 2-axis grid (priority × urgency, effort × impact) |
86
+ | `masonry`/`feed` | yes | Pinterest-style, mixed-size cards; default for Library |
87
+ | `calendar` | yes | Date-indexed data (events, tasks by dueDate) |
88
+ | `flow` | yes | Node-edge diagrams (automations, mind maps) |
89
+ | `bento` | yes | Mixed composition (a dashboard-in-view) |
90
+ | `branch_tree` | yes | Hierarchical data (project → subtasks, threads → branches) |
91
+ | `whiteboard` | yes | Free-form canvas |
92
+ | `timeline` | no | (Defer) |
93
+ | `graph` | no | (Defer) |
94
+ | `gantt` | no | (Defer) |
95
+ | `mindmap` | no | (Defer) |
96
+
97
+ Decision: the data has statuses → `kanban`. Dates → `calendar`. Many columns → `table`. Mixed types → `masonry` or `bento`. Full reference in **`view-types.md`**.
98
+
99
+ ## Creating a view
100
+
101
+ ```json
102
+ POST /api/hub/views
103
+ {
104
+ "userId": "{userId}",
105
+ "workspaceId": "{workspaceId}",
106
+ "name": "Active Tasks by Project",
107
+ "type": "kanban",
108
+ "profileSlug": "task",
109
+ "config": {
110
+ "groupBy": { "property": "projectId" },
111
+ "columns": [
112
+ { "slug": "title" },
113
+ { "slug": "priority" },
114
+ { "slug": "dueDate" }
115
+ ],
116
+ "filters": [
117
+ { "property": "status", "op": "in", "value": ["todo", "in-progress"] }
118
+ ],
119
+ "sort": [{ "property": "priority", "direction": "desc" }]
120
+ }
121
+ }
122
+ ```
123
+
124
+ The `config` shape varies by view type — kanban needs `groupBy`, calendar needs a date property, gallery needs an image property. When in doubt, fetch an existing view of the same type first and mirror its structure.
125
+
126
+ ## Bento layouts
127
+
128
+ A bento is a 12-column react-grid-layout. Blocks reference **cells** by kind.
129
+
130
+ ```json
131
+ POST /api/hub/views // a bento is just a view with type="bento"
132
+ {
133
+ "userId": "{userId}",
134
+ "workspaceId": "{workspaceId}",
135
+ "name": "Content Creation Home",
136
+ "type": "bento",
137
+ "config": {
138
+ "blocks": [
139
+ { "id": "b1", "kind": "view", "viewId": "<kanbanId>",
140
+ "layout": { "x": 0, "y": 0, "w": 8, "h": 4 } },
141
+ { "id": "b2", "kind": "entity", "entityId": "ent_current_project",
142
+ "layout": { "x": 8, "y": 0, "w": 4, "h": 4 } },
143
+ { "id": "b3", "kind": "widget", "widgetKind": "quick-access",
144
+ "layout": { "x": 0, "y": 4, "w": 6, "h": 2 },
145
+ "config": { "items": [ … ] } },
146
+ { "id": "b4", "kind": "widget", "widgetKind": "stat-card",
147
+ "layout": { "x": 6, "y": 4, "w": 6, "h": 2 },
148
+ "config": { "metric": "entities_created_this_week" } }
149
+ ]
150
+ }
151
+ }
152
+ ```
153
+
154
+ Block kinds:
155
+
156
+ - `view` — embeds a saved view by `viewId`
157
+ - `entity` — renders an entity card for a specific `entityId`
158
+ - `widget` — renders a registered cell by `widgetKind` with `config`
159
+
160
+ Full widget catalog in **`widget-catalog.md`**. Layout patterns in **`bento-recipes.md`**.
161
+
162
+ ## Creating or proposing a workspace
163
+
164
+ **Always ask before creating.** Workspaces are big objects with profiles, views, members, bento, and seed data. Commit only after user confirms.
165
+
166
+ The canonical flow:
167
+
168
+ 1. **Assemble a proposal** (no API call yet):
169
+
170
+ ```js
171
+ const proposal = {
172
+ name: "Content Creation",
173
+ description: "Draft, review, and publish articles",
174
+ icon: "pen-tool",
175
+ color: "purple",
176
+ profiles: [ // reuse system profiles by slug OR include custom ones
177
+ { slug: "article", reuse: true },
178
+ { slug: "draft", displayName: "Draft", parentSlug: "article",
179
+ properties: [
180
+ { slug: "status", valueType: "string", constraints: { enum: ["idea","writing","review","published"] }, uiHints: { displayAs: "status" } },
181
+ { slug: "wordCount", valueType: "number" },
182
+ { slug: "publishDate", valueType: "date" }
183
+ ]
184
+ }
185
+ ],
186
+ views: [
187
+ { name: "Pipeline", type: "kanban", profileSlug: "draft",
188
+ config: { groupBy: { property: "status" } } },
189
+ { name: "Published", type: "gallery", profileSlug: "article",
190
+ config: { filters: [{ property: "status", op: "eq", value: "published" }] } }
191
+ ],
192
+ bento: { blocks: [ … ] },
193
+ seedEntities: [] // optional
194
+ }
195
+ ```
196
+
197
+ 2. **Show it to the user**. Compact, readable. "Here's what I'd create — 2 profiles, 2 views, a bento. Ship it?"
198
+
199
+ 3. **On yes**, commit through `/api/hub/workspaces`:
200
+
201
+ ```json
202
+ POST /api/hub/workspaces
203
+ { "userId": "{userId}", "proposal": { /* the object above */ } }
204
+ ```
205
+
206
+ This goes through governance — `workspace.create` is **always** proposal-gated even for agents (see `../synap/governance.md`). Expect `status: "proposed"` and tell the user they'll see it in Proposals.
207
+
208
+ 4. **On no**, don't commit. Offer to adjust.
209
+
210
+ ## Proposing vs. extending
211
+
212
+ Before proposing a new workspace, ask: does one of the user's existing workspaces fit? A "Content" workspace and a "Writing" workspace are the same lens. Adding a view to the existing workspace is almost always better than creating a new one.
213
+
214
+ Create new when:
215
+
216
+ - The user explicitly asks for it ("new workspace for…")
217
+ - The data and access patterns are genuinely orthogonal to existing workspaces
218
+ - A different team/collaborator set makes sense
219
+
220
+ Otherwise: add a view, add a bento block, add properties — don't multiply workspaces.
221
+
222
+ ## Worked example — "Make me a CRM"
223
+
224
+ 1. Inventory. User already has `person`, `contact`, `company`, `deal`, `event` profiles (all system).
225
+ 2. No new profiles needed. The CRM is a **lens**, not new data.
226
+ 3. Propose (before committing):
227
+ - Workspace name: "CRM"
228
+ - Views:
229
+ - `Deals Pipeline` — kanban on `deal`, groupBy `stage`
230
+ - `Contacts` — table on `contact`, columns: name, role, company, lastInteraction
231
+ - `Companies` — gallery on `company` (logo-forward)
232
+ - `Upcoming Meetings` — calendar on `event`, filter `relatedToContact`
233
+ - Bento:
234
+ - Top: `deals pipeline` view (8 cols × 4 rows)
235
+ - Side: `stat-card` — "Deals in pipeline: $X" (4 cols × 2 rows)
236
+ - Side: `stat-card` — "Meetings this week: N" (4 cols × 2 rows)
237
+ - Bottom: `recent-activity` widget (12 cols × 3 rows)
238
+ 4. Show to user. Confirm.
239
+ 5. Commit via `POST /workspaces`.
240
+
241
+ ## Arranging a bento after creation
242
+
243
+ ```json
244
+ POST /api/hub/views/{bentoViewId}/arrange
245
+ { "userId": "{userId}", "blocks": [ /* full new blocks array */ ] }
246
+ ```
247
+
248
+ `bento.arrange` is auto-approved by default. Safe to run without hesitation when the user rearranges or adds widgets.
249
+
250
+ ## Common mistakes
251
+
252
+ 1. **Creating a workspace without asking.** Always propose + confirm. Workspaces are too big to auto-commit.
253
+ 2. **Guessing widget kinds.** Always `GET /widget-definitions` first. A `kind` that isn't in the registry won't render.
254
+ 3. **Reinventing views.** Check existing views first — a kanban for tasks probably exists.
255
+ 4. **Creating a new profile when UI is the real need.** Don't create `client` profile for a "contacts who are clients" view — just create a filtered view on `contact`.
256
+ 5. **Putting unrelated data in one bento.** A bento tells a story ("my week", "this project", "content pipeline"). Kitchen-sink bentos overwhelm the user.
257
+ 6. **Ignoring color/icon.** Profiles and workspaces both take `uiHints.icon` and `uiHints.color` — set them. Untitled gray workspaces feel like a bug.
258
+ 7. **Hardcoding config for view types you haven't checked.** Each view type's `config` shape is different. Get an example from `/views` first.
259
+ 8. **Forgetting entityScope implications.** A view on a pod-scope profile (`note`) will show entities from every workspace the user can access — filter appropriately if you want workspace-local results.
260
+
261
+ ## AI Companion integration
262
+
263
+ When you create views or entities for the user inside the AI Companion, **always emit inline pattern chips** at the end of your reply so the user can jump directly to what you built.
264
+
265
+ ```
266
+ // After creating a kanban view with ID "abc123":
267
+ "Created your tasks pipeline → [[view:abc123|Active Tasks]] · [[open:side|view:abc123]]"
268
+
269
+ // After creating a workspace (home bento view ID "def456"):
270
+ "Workspace ready — [[open:main|view:def456|Home Dashboard]]"
271
+
272
+ // After creating an entity (e.g. a new project):
273
+ "Project created → [[entity:proj_789|Q3 Launch]]"
274
+ ```
275
+
276
+ ### Special cell keys (browser-native)
277
+
278
+ These cell keys are registered in the browser app but may not appear in `GET /api/hub/widget-definitions` (they are Electron-native, not server-seeded):
279
+
280
+ | Cell key | Where | Notes |
281
+ | --------------- | ------------------ | ------------------------------------------------------------ |
282
+ | `ai-companion` | Browser sidebar | The Companion chat panel itself — don't embed in bentos |
283
+ | `iframe-widget` | Bento blocks | Sandboxed iframe for custom embeds; requires `src` in config |
284
+ | `entity-detail` | Side panel / modal | Generic entity detail renderer — always available |
285
+ | `entity-list` | Bento / views | List of entities for a given profile |
286
+
287
+ **Rule:** If a cell key is not in `GET /api/hub/widget-definitions`, do NOT reference it in bento config unless it is one of the four browser-native keys above. Unknown keys will silently fail to render.
288
+
289
+ ## When you need more
290
+
291
+ - Full per-view-type `config` shapes → **`view-types.md`**
292
+ - Complete widget/cell catalog + configSchemas → **`widget-catalog.md`**
293
+ - Ready-to-reuse bento layouts for common use cases → **`bento-recipes.md`**
294
+ - Creating the underlying data → use core **`synap`** skill
295
+ - Extending profiles with new fields before building views → use **`synap-schema`** skill