@sayknow-cli/coding-agent 0.5.11 → 0.5.14
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/CHANGELOG.md +35 -0
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/config/file-lock.d.ts +8 -0
- package/dist/types/config/model-registry.d.ts +1 -0
- package/dist/types/config/models-config-schema.d.ts +2 -0
- package/dist/types/defaults/skc-ui-skills.d.ts +12 -0
- package/dist/types/hooks/ui-skill-keywords.d.ts +84 -0
- package/dist/types/session-import/redact.d.ts +1 -1
- package/dist/types/setup/external-ui-skills.d.ts +37 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +13 -1
- package/dist/types/skc-runtime/ultragoal-succession.d.ts +251 -0
- package/dist/types/skc-runtime/workflow-placeholder.d.ts +6 -0
- package/package.json +7 -7
- package/src/cli/setup-cli.ts +22 -1
- package/src/cli/skills-cli.ts +29 -10
- package/src/commands/setup.ts +1 -0
- package/src/config/file-lock-gc.ts +39 -2
- package/src/config/file-lock.ts +22 -1
- package/src/config/model-registry.ts +116 -40
- package/src/config/models-config-schema.ts +1 -0
- package/src/defaults/skc/skills/ultragoal/SKILL.md +3 -0
- package/src/defaults/skc/ui-skills/LICENSE.appllama +21 -0
- package/src/defaults/skc/ui-skills/LICENSE.emilkowalski +21 -0
- package/src/defaults/skc/ui-skills/NOTICE.md +43 -0
- package/src/defaults/skc/ui-skills/animate/SKILL.md +536 -0
- package/src/defaults/skc/ui-skills/animation-vocabulary/SKILL.md +178 -0
- package/src/defaults/skc/ui-skills/apple-design/SKILL.md +285 -0
- package/src/defaults/skc/ui-skills/appllama-app-design-skill/SKILL.md +821 -0
- package/src/defaults/skc/ui-skills/ask-sonner/SKILL.md +157 -0
- package/src/defaults/skc/ui-skills/emil-design-eng/SKILL.md +671 -0
- package/src/defaults/skc/ui-skills/find-animation-opportunities/SKILL.md +137 -0
- package/src/defaults/skc/ui-skills/improve-animations/SKILL.md +305 -0
- package/src/defaults/skc/ui-skills/mobile-native/SKILL.md +308 -0
- package/src/defaults/skc/ui-skills/pick-ui-library/SKILL.md +82 -0
- package/src/defaults/skc/ui-skills/prototype/SKILL.md +300 -0
- package/src/defaults/skc/ui-skills/react-bits/SKILL.md +113 -0
- package/src/defaults/skc/ui-skills/review-animations/SKILL.md +312 -0
- package/src/defaults/skc-ui-skills.ts +108 -0
- package/src/extensibility/runtime-skill-discovery.ts +8 -2
- package/src/hooks/native-skill-hook.ts +14 -0
- package/src/hooks/ui-skill-keywords.ts +312 -0
- package/src/internal-urls/docs-index.generated.ts +1 -1
- package/src/prompts/agents/architect.md +1 -0
- package/src/prompts/agents/critic.md +1 -0
- package/src/prompts/agents/executor.md +1 -0
- package/src/prompts/agents/planner.md +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/skill.md +2 -2
- package/src/sdk/session.ts +7 -5
- package/src/session-import/redact.ts +11 -3
- package/src/setup/external-ui-skills.ts +132 -0
- package/src/skc-runtime/state-writer.ts +24 -27
- package/src/skc-runtime/ultragoal-runtime.ts +125 -45
- package/src/skc-runtime/ultragoal-succession.ts +1667 -0
- package/src/skc-runtime/workflow-placeholder.ts +33 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ask-sonner
|
|
3
|
+
description: Guide to Sonner, the React toast library — install and wire up the Toaster, pick the right toast() call, promise and loading toasts, updating, dismissing and persisting toasts, styling, theming and icons, positioning and multiple toasters. Use when working with Sonner or troubleshooting it — toasts that don't appear, appear twice, lose their styles, ignore Tailwind classes, sit behind a modal, or don't follow dark mode.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Working With Sonner
|
|
7
|
+
|
|
8
|
+
## SKC invocation
|
|
9
|
+
|
|
10
|
+
SKC loads this skill automatically for matching frontend UI/UX work.
|
|
11
|
+
Do not wait for a follow-up question. Apply the craft rules immediately
|
|
12
|
+
and keep going on the user's actual task.
|
|
13
|
+
|
|
14
|
+
This skill's companion reference files are appended inline at the end of
|
|
15
|
+
this document. Read them there; they are not separate files on disk.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
Two pieces, and only two:
|
|
21
|
+
|
|
22
|
+
1. **One `<Toaster />`, mounted once**, as close to the root as possible (in Next.js: `layout.tsx` — it works inside server components). Never render it per-page or conditionally; a second mounted Toaster duplicates every toast.
|
|
23
|
+
2. **`toast()` called from client code** — event handlers, effects, callbacks. It's a plain function, no hook or provider needed, but it does nothing on the server: in a server action, return the result and call `toast()` in the client code that receives it.
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
import { Toaster } from 'sonner'; // once, in layout
|
|
27
|
+
import { toast } from 'sonner'; // anywhere client-side
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Picking the right call
|
|
31
|
+
|
|
32
|
+
| You want | Call |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| Plain message | `toast('Title')` — add `{ description }` for a second line |
|
|
35
|
+
| Success / error / info / warning icon | `toast.success('…')`, `toast.error('…')`, etc. |
|
|
36
|
+
| Spinner while you manage state yourself | `toast.loading('…')`, then update it by id |
|
|
37
|
+
| Loading → success/error tied to a promise | `toast.promise(promise, { loading, success, error })` — success/error accept functions receiving the resolved value/error |
|
|
38
|
+
| Button that does something | `{ action: { label, onClick } }` — closes the toast unless `onClick` calls `event.preventDefault()`; `cancel` is the secondary variant |
|
|
39
|
+
| Custom JSX, default toast shell | `toast(<jsx />)` |
|
|
40
|
+
| Custom JSX, no styles at all | `toast.custom((t) => <jsx />)` — headless, `t` gives you the id to dismiss |
|
|
41
|
+
|
|
42
|
+
## Recipes
|
|
43
|
+
|
|
44
|
+
**Update a toast** — call `toast()` again with the same `id`; only the props you pass change. Switching to `toast.success(…, { id })` changes the type. This is how loading → success flows work without `toast.promise`:
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
const id = toast.loading('Uploading…');
|
|
48
|
+
toast.success('Uploaded', { id });
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Persist** — `{ duration: Infinity }`. **Dismiss** — `toast.dismiss(id)`, or `toast.dismiss()` for all. **Read active toasts** — `useSonner()` in React, `toast.getActiveToasts()` outside it.
|
|
52
|
+
|
|
53
|
+
**Links or components in the text** — pass a function for the title or description: `toast(() => <a href="…">View</a>)`.
|
|
54
|
+
|
|
55
|
+
**Multiple toasters** — give each an `id` and target with `toast('…', { toasterId: 'canvas' })`. Without `toasterId`, every toaster renders the toast.
|
|
56
|
+
|
|
57
|
+
**Close callbacks** — `onDismiss` fires on close button or swipe; `onAutoClose` fires on timeout. They are separate; there is no single "closed" callback.
|
|
58
|
+
|
|
59
|
+
## Styling — the escalation ladder
|
|
60
|
+
|
|
61
|
+
Climb only as far as the change requires; jumping to the top rung too early is fine (it's the recommended end state), lingering in the middle is not.
|
|
62
|
+
|
|
63
|
+
1. **Defaults** — plus `richColors` on the Toaster for colorful success/error, `invert` to flip against the theme.
|
|
64
|
+
2. **Inline tweaks** — `toastOptions={{ style: {…} }}` on the Toaster for all toasts, or `style` per `toast()` call.
|
|
65
|
+
3. **Classes on parts** — `toastOptions={{ classNames: { toast, title, description, actionButton, cancelButton, closeButton } }}`. Sonner's injected styles win the cascade, so every class needs `!important` (Tailwind: `!text-red-900`). If you're marking more than a few things important, stop — go headless.
|
|
66
|
+
4. **Headless** — `toast.custom()` with your own JSX, keeping Sonner's positioning, stacking, and swipe. The recommended approach for a design-system toast: wrap it in your own `toast()` abstraction. (`unstyled: true` exists as a halfway house, but headless gives more control for the same effort.)
|
|
67
|
+
|
|
68
|
+
**Icons** — swap defaults per-type with the Toaster's `icons` prop, per-toast with `icon`, remove with `null`.
|
|
69
|
+
|
|
70
|
+
**Theme** — `theme` defaults to `'light'` and does not track the OS. Pass `theme="system"`, or wire your theme provider: `<Toaster theme={resolvedTheme} />` from `next-themes`.
|
|
71
|
+
|
|
72
|
+
## Troubleshooting
|
|
73
|
+
|
|
74
|
+
| Symptom | Cause → fix |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| Toast never appears | No `<Toaster />` mounted, or it unmounted (conditional render, per-page placement). Mount one at the root. If calling from a server action: `toast()` is client-only — call it with the action's result on the client. |
|
|
77
|
+
| Same toast appears twice | Two Toasters mounted (layout **and** page) — keep one. Or `toast()` fired in an effect under React StrictMode's dev double-invoke — fire from the event handler instead, or pass a stable `id` so the second call updates rather than duplicates. |
|
|
78
|
+
| Tailwind/CSS classes have no effect | Default styles override them. Mark them `!important`, or use `unstyled` / headless (see the ladder above). |
|
|
79
|
+
| Toasts render completely unstyled (common in Astro, view transitions) | Sonner's injected stylesheet was lost — import it explicitly in a layout: `import 'sonner/dist/styles.css'`. |
|
|
80
|
+
| Unstyled inside Shadow DOM | Styles land in `document.head`, not the shadow root. Copy the style tag whose text includes `[data-sonner-toaster]` into the shadow root. |
|
|
81
|
+
| Toast behind a modal/overlay, or clipped | An ancestor creates a stacking context (`transform`, `filter`, `overflow`) or the overlay out-z-indexes the toaster. Move `<Toaster />` to the document root, outside any dialog/portal container. |
|
|
82
|
+
| Dark mode ignored | `theme` defaults to `'light'` — set `theme="system"` or pass the resolved theme (see Theme above). |
|
|
83
|
+
| Success/error look gray, not green/red | That's the default. Add `richColors` to the Toaster. |
|
|
84
|
+
| Toast never closes | `duration: Infinity`, `dismissible: false`, or a `toast.promise` whose promise never settles — the loading toast waits forever. |
|
|
85
|
+
| `toast.promise` stuck on loading | It needs a promise (or a function returning one) as its first argument, and the promise must actually resolve/reject. |
|
|
86
|
+
| Swipe-to-dismiss goes the wrong way / doesn't work | Directions derive from `position`. Override with `swipeDirections` on the Toaster. |
|
|
87
|
+
| Toast shows up in every toaster | Multiple toasters need targeting: give each Toaster an `id` and pass `toasterId` in the `toast()` call. |
|
|
88
|
+
| Toasts too close to the screen edge on mobile | `offset` (desktop, default 32px) and `mobileOffset` (<600px, default 16px) — numbers, CSS strings, or per-side objects. |
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Appendix: API.md
|
|
93
|
+
|
|
94
|
+
# Sonner API Reference
|
|
95
|
+
|
|
96
|
+
Exact props, types, and defaults. Options passed to `toast()` override the same options set via the Toaster's `toastOptions`.
|
|
97
|
+
|
|
98
|
+
## `<Toaster />`
|
|
99
|
+
|
|
100
|
+
| Prop | Type | Default | Description |
|
|
101
|
+
| --- | --- | --- | --- |
|
|
102
|
+
| `theme` | `string` | `'light'` | `'light'`, `'dark'`, or `'system'`. |
|
|
103
|
+
| `richColors` | `boolean` | `false` | Makes error and success states more colorful. |
|
|
104
|
+
| `expand` | `boolean` | `false` | Toasts expanded by default (otherwise they expand on hover). |
|
|
105
|
+
| `visibleToasts` | `number` | `3` | Amount of visible toasts. |
|
|
106
|
+
| `id` | `string` | – | Toaster id, targeted by `toast()`'s `toasterId` option. |
|
|
107
|
+
| `position` | `string` | `'bottom-right'` | `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right`. |
|
|
108
|
+
| `closeButton` | `boolean` | `false` | Adds a close button to all toasts. |
|
|
109
|
+
| `offset` | `string \| number \| object` | `'32px'` | Offset from screen edges. Object form is per-side: `{ bottom: '24px', right: '16px' }`. |
|
|
110
|
+
| `mobileOffset` | `string \| number \| object` | `'16px'` | Offset when screen width < 600px. |
|
|
111
|
+
| `swipeDirections` | `array` | based on position | Allowed swipe-to-dismiss directions. |
|
|
112
|
+
| `dir` | `string` | `'ltr'` | Text directionality. |
|
|
113
|
+
| `hotkey` | `string` | `⌥/alt + T` | Keyboard shortcut that focuses the toaster area. |
|
|
114
|
+
| `invert` | `boolean` | `false` | Dark toasts in light mode and vice versa. |
|
|
115
|
+
| `toastOptions` | `object` | – | Default options applied to every toast (any `toast()` option below). |
|
|
116
|
+
| `gap` | `number` | `14` | Gap between toasts when expanded. |
|
|
117
|
+
| `icons` | `object` | – | Replace default icons: `{ success, info, warning, error, loading }`; `null` removes one. |
|
|
118
|
+
|
|
119
|
+
## `toast()` options
|
|
120
|
+
|
|
121
|
+
`toast(message, options)` — message is a string, JSX, or a function returning JSX. Returns the toast's id.
|
|
122
|
+
|
|
123
|
+
| Option | Type | Default | Description |
|
|
124
|
+
| --- | --- | --- | --- |
|
|
125
|
+
| `description` | `ReactNode` | – | Renders underneath the title; also accepts a function returning JSX. |
|
|
126
|
+
| `closeButton` | `boolean` | `false` | Adds a close button. |
|
|
127
|
+
| `invert` | `boolean` | `false` | Dark toast in light mode and vice versa. |
|
|
128
|
+
| `duration` | `number` | `4000` | Milliseconds before auto-close. `Infinity` persists the toast. |
|
|
129
|
+
| `position` | `string` | `'bottom-right'` | Position of this toast. |
|
|
130
|
+
| `dismissible` | `boolean` | `true` | If `false`, the user cannot dismiss the toast. |
|
|
131
|
+
| `icon` | `ReactNode` | – | Icon in front of the text; `null` removes the default. |
|
|
132
|
+
| `action` | `ReactNode \| { label, onClick }` | – | Primary button; clicking closes the toast unless `onClick` calls `event.preventDefault()`. |
|
|
133
|
+
| `cancel` | `ReactNode \| { label, onClick }` | – | Secondary button; clicking closes the toast. |
|
|
134
|
+
| `actionButtonStyle` | `object` | `{}` | Styles for the action button. |
|
|
135
|
+
| `cancelButtonStyle` | `object` | `{}` | Styles for the cancel button. |
|
|
136
|
+
| `id` | `string` | – | Custom id; calling `toast()` again with the same id updates the existing toast. |
|
|
137
|
+
| `testId` | `string` | – | Rendered as `data-testid` for e2e tests. |
|
|
138
|
+
| `toasterId` | `string` | – | Id of the toaster to render this toast in. |
|
|
139
|
+
| `style` | `object` | – | Inline styles for the toast. |
|
|
140
|
+
| `classNames` | `object` | – | Classes per part: `{ toast, title, description, actionButton, cancelButton, closeButton }`. Needs `!important` unless `unstyled`. |
|
|
141
|
+
| `unstyled` | `boolean` | `false` | Removes all default styles. |
|
|
142
|
+
| `onDismiss` | `(toast) => void` | – | Fires when the close button is clicked or the toast is swiped away. |
|
|
143
|
+
| `onAutoClose` | `(toast) => void` | – | Fires when the toast closes automatically after `duration`. |
|
|
144
|
+
| `containerAriaLabel` | `string` | `'Notifications'` | ARIA label for the toast container. |
|
|
145
|
+
|
|
146
|
+
## Functions
|
|
147
|
+
|
|
148
|
+
| Function | Purpose |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `toast(message, opts?)` | Render a toast; returns its id. |
|
|
151
|
+
| `toast.success / .error / .info / .warning(message, opts?)` | Typed toast with matching icon. |
|
|
152
|
+
| `toast.loading(message, opts?)` | Toast with a spinner; update it by id. |
|
|
153
|
+
| `toast.promise(promise, { loading, success, error })` | Loading toast that resolves with the promise; `success`/`error` accept strings, JSX, functions of the result, or objects of toast options. |
|
|
154
|
+
| `toast.custom((t) => jsx, opts?)` | Headless toast — your JSX, Sonner's behavior. |
|
|
155
|
+
| `toast.dismiss(id?)` | Dismiss one toast, or all when called without an id. |
|
|
156
|
+
| `toast.getActiveToasts()` | All active toasts, usable outside React. |
|
|
157
|
+
| `useSonner()` | React hook returning `{ toasts }`. |
|