svamp-cli 0.2.57 → 0.2.58

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: artifact
3
- version: 1.0.0
3
+ version: 1.2.0
4
4
  description: Embed a rendered HTML file or live URL inline in chat via a single self-closing `<artifact src="..." />` tag — the Svamp client renders it as a sandboxed iframe with modes for inline, card, bare, and immersive.
5
5
  tags:
6
6
  - svamp
@@ -216,16 +216,153 @@ if (req.method === 'OPTIONS') return res.end();
216
216
 
217
217
  If the iframe console shows `CORS error`, your server is missing one of these headers.
218
218
 
219
- ## Style philosophy
219
+ ## Style & design system
220
220
 
221
- Lean on what HTML does well flow layout, typography, animation without overengineering.
221
+ These are **recommendations, not rules**. They produce coherent, polished output by default; deviate when the content calls for it (artistic visualizations, branded posters, deliberately moody experiences).
222
222
 
223
- - **Restrained palette.** 1–2 accent colors, lots of neutrals. Slate / zinc / stone ramps work well.
224
- - **Type first.** 14–16px base, 1.5 line-height, system-ui font.
225
- - **Spacing rhythm.** 4 / 8 / 12 / 16 / 24 / 32 / 48 (Tailwind's scale).
226
- - **Borders or shadows, not both.**
227
- - **Animation conveys, not decorates.** 200400 ms ease-out on entry; longer is noise.
228
- - **Mobile-first.** Single column by default; widen at `md:` only when columns add information.
223
+ ### Philosophy
224
+
225
+ - **Seamless** the artifact should feel like it belongs in the chat, not a foreign embed. Use `var(--svamp-bg)` / `var(--svamp-text)` so the visual flips with the host theme.
226
+ - **Flat** solid fills only by default. Skip gradients, shadows, glow, neon unless the content explicitly calls for them. Use **borders OR shadows, not both**.
227
+ - **Warm minimal** clean geometric layouts with soft rounded corners (812 px). Indigo or sky as primary accent. Slate / zinc / stone for structural neutrals.
228
+ - **Diverse** pick the visualization type that fits the content: flowchart, timeline, hierarchy, cycle, comparison, chart, calculator. Don't default to one.
229
+ - **Text outside, visuals inside** — prose explanation goes in markdown *around* the artifact, not inside it.
230
+
231
+ ### Typography
232
+
233
+ - Base 14–16 px, line-height ~1.5, system-ui font stack (`system-ui, -apple-system, "Segoe UI", Roboto, sans-serif`).
234
+ - Font weights **400 / 500 / 600** only. Skip 700+ unless it's deliberately punchy.
235
+ - Sentence case for titles. No ALL CAPS labels unless they're tiny (10–11 px) UI labels with letter-spacing.
236
+ - Never set font-size below 11 px — unreadable on mobile.
237
+ - Round every displayed number (`$4.2M`, not `$4218354.97`).
238
+
239
+ ### Spacing
240
+
241
+ Use a 4-px rhythm: 4 / 8 / 12 / 16 / 24 / 32 / 48 px. Pick one scale and stick to it — sloppy spacing reads as noise even when individual elements look fine.
242
+
243
+ ### Color palette (when you need accents)
244
+
245
+ A handy ramp library — five shades per ramp. Use 2–3 ramps per artifact max. Indigo / sky for the primary accent, slate / zinc as structural neutrals.
246
+
247
+ | Ramp | 50 (fill) | 200 (stroke) | 400 (accent) | 600 (subtitle) | 800 (title) |
248
+ |------|-----------|-------------|-------------|----------------|-------------|
249
+ | Indigo | `#EEF2FF` | `#C7D2FE` | `#818CF8` | `#4F46E5` | `#3730A3` |
250
+ | Sky | `#F0F9FF` | `#BAE6FD` | `#38BDF8` | `#0284C7` | `#075985` |
251
+ | Emerald | `#ECFDF5` | `#A7F3D0` | `#34D399` | `#059669` | `#065F46` |
252
+ | Amber | `#FFFBEB` | `#FDE68A` | `#FBBF24` | `#D97706` | `#92400E` |
253
+ | Rose | `#FFF1F2` | `#FECDD3` | `#FB7185` | `#E11D48` | `#9F1239` |
254
+ | Slate | `#F8FAFC` | `#E2E8F0` | `#94A3B8` | `#64748B` | `#334155` |
255
+
256
+ - Text on a 50-fill: use 800 from the same ramp. Never pure black.
257
+ - SVG defaults: 50 fill + 200 stroke + 800 title + 600 subtitle.
258
+ - Chart.js: 400 for `borderColor`, 400 with 0.1 alpha for `backgroundColor`.
259
+
260
+ For inline widgets, you can still reference `var(--svamp-accent)` etc. and skip the ramps — both approaches are fine.
261
+
262
+ ### Animation
263
+
264
+ Animation should *convey* state change, not decorate. Entry animations: 200–400 ms ease-out, stagger child elements by 60–100 ms. Anything longer feels slow.
265
+
266
+ ### Streaming-friendly write order
267
+
268
+ If you're emitting an inline artifact body that the agent generates token-by-token (the user will see streaming progress in the placeholder, but if they ever see partial HTML rendered, this order minimizes flashing):
269
+
270
+ - **SVG**: open `<svg>`, emit `<defs>` (markers, gradients) first, then visual elements top-to-bottom.
271
+ - **HTML**: `<style>` block first, then content, then `<script>` last. Solid fills work even mid-stream; gradients can flash during DOM diffs.
272
+
273
+ ### Mobile-first
274
+
275
+ Single column by default. Widen at media queries (`@media (min-width: 768px)`) only when there's information that benefits from columns. Test by mentally resizing to 320 px wide.
276
+
277
+ ## Chart.js patterns
278
+
279
+ Chart.js is the go-to for data viz. Recommended setup:
280
+
281
+ ```html
282
+ <div style="position:relative;width:100%;height:300px">
283
+ <canvas id="c"></canvas>
284
+ </div>
285
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
286
+ <script>
287
+ const chart = new Chart(document.getElementById('c'), {
288
+ type: 'line',
289
+ data: {
290
+ labels: ['Jan','Feb','Mar','Apr','May'],
291
+ datasets: [{
292
+ data: [30, 45, 28, 50, 42],
293
+ borderColor: '#818CF8',
294
+ backgroundColor: 'rgba(129,140,248,0.1)',
295
+ fill: true,
296
+ tension: 0.3,
297
+ }],
298
+ },
299
+ options: {
300
+ responsive: true,
301
+ maintainAspectRatio: false,
302
+ plugins: { legend: { display: false } },
303
+ scales: {
304
+ y: { grid: { color: 'rgba(0,0,0,0.06)' } },
305
+ x: { grid: { display: false } },
306
+ },
307
+ },
308
+ });
309
+ </script>
310
+ ```
311
+
312
+ Rules of thumb:
313
+ - Wrapper `<div>` owns the height (Chart.js can't size to a parent that has `auto` height). `width: 100%; height: <N>px`.
314
+ - `responsive: true` + `maintainAspectRatio: false` so the canvas fills the wrapper.
315
+ - Hide the legend by default (`legend: { display: false }`) — adds noise more often than information. Show it only when there are 2+ datasets.
316
+ - Bars: `borderRadius: 6`. Lines: `tension: 0.3` for smooth, `0` for stepped.
317
+ - Multiple charts on one artifact: unique `canvas` IDs.
318
+ - Interactive controls **must** call `chart.update()` after mutating `chart.data`.
319
+
320
+ ```js
321
+ function refresh() {
322
+ const v = +document.getElementById('slider').value;
323
+ chart.data.datasets[0].data = base.map(d => Math.round(d * v / 50));
324
+ chart.update();
325
+ }
326
+ ```
327
+
328
+ ## SVG patterns
329
+
330
+ For flowcharts, timelines, hierarchy diagrams, comparisons:
331
+
332
+ ```html
333
+ <svg width="100%" viewBox="0 0 680 H" style="display:block">
334
+ <defs>
335
+ <marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5"
336
+ markerWidth="6" markerHeight="6" orient="auto">
337
+ <path d="M0,0 L10,5 L0,10 z" fill="#94A3B8"/>
338
+ </marker>
339
+ </defs>
340
+ <!-- nodes & connectors here -->
341
+ </svg>
342
+ ```
343
+
344
+ ViewBox sizing:
345
+ - Fix width at **680** for a comfortable column. Adjust `H` to fit content + 40 px bottom buffer.
346
+ - Keep all content within `x = 0..680`. `text-anchor="end"` extends left from the x coord.
347
+ - `width="100%"` on the `<svg>` element so it scales to bubble width on mobile.
348
+
349
+ Recommended defaults for diagram shapes:
350
+ - Node fill: ramp **50** (light), stroke: ramp **200**, stroke-width 1 or 1.5.
351
+ - Node title text: ramp **800**, weight 500, size 14 px.
352
+ - Node subtitle: ramp **600**, weight 400, size 11–12 px.
353
+ - Connector lines: `#94A3B8` (slate-400) with an arrow marker.
354
+
355
+ ## Common UI patterns
356
+
357
+ A short catalog. Pick the one that fits, don't force a single template.
358
+
359
+ - **Metric dashboard** — grid of small stat cards (label / number / delta). 4-col on desktop, 2-col on tablet, 1-col on mobile. See the "Quarterly metrics" template below.
360
+ - **Comparison** — side-by-side panels, the recommended option bordered in the accent color with a small label badge.
361
+ - **Calculator** — labeled `<input type="range">` sliders + live result display. Slider inputs must call `chart.update()` (or update the DOM directly) on every `input` event.
362
+ - **Timeline** — vertical or horizontal sequence with dates, dots, and connector lines.
363
+ - **Flowchart** — boxes + arrows in SVG; arrow markers via `<defs>`. Use a `viewBox` for crisp scaling.
364
+ - **Bar comparison** — horizontal bars with labels left, value right, bar fills indigo-200, value text indigo-800.
365
+ - **Toggle / select** — segmented buttons or a `<select>` to flip between dataset views.
229
366
 
230
367
  ## Templates
231
368
 
package/dist/cli.mjs CHANGED
@@ -314,7 +314,7 @@ async function main() {
314
314
  } else if (!subcommand || subcommand === "start") {
315
315
  await handleInteractiveCommand();
316
316
  } else if (subcommand === "--version" || subcommand === "-v") {
317
- const pkg = await import('./package-DUJlW79s.mjs').catch(() => ({ default: { version: "unknown" } }));
317
+ const pkg = await import('./package-GG73qTsa.mjs').catch(() => ({ default: { version: "unknown" } }));
318
318
  console.log(`svamp version: ${pkg.default.version}`);
319
319
  } else {
320
320
  console.error(`Unknown command: ${subcommand}`);
@@ -1,5 +1,5 @@
1
1
  var name = "svamp-cli";
2
- var version = "0.2.57";
2
+ var version = "0.2.58";
3
3
  var description = "Svamp CLI — AI workspace daemon on Hypha Cloud";
4
4
  var author = "Amun AI AB";
5
5
  var license = "SEE LICENSE IN LICENSE";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svamp-cli",
3
- "version": "0.2.57",
3
+ "version": "0.2.58",
4
4
  "description": "Svamp CLI — AI workspace daemon on Hypha Cloud",
5
5
  "author": "Amun AI AB",
6
6
  "license": "SEE LICENSE IN LICENSE",