@commentkit/comment-kit 0.7.7 → 1.0.0-beta.2
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 +87 -0
- package/README.md +172 -732
- package/SECURITY.md +24 -14
- package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
- package/dist/npm/chunks/Guest-CKoV6pEK.js +157 -0
- package/dist/npm/chunks/MarkupEditor-DAo4qppg.js +199 -0
- package/dist/npm/chunks/Panel-BRBDHlGg.js +399 -0
- package/dist/npm/chunks/Shortcuts-CHMcrjAM.js +56 -0
- package/dist/npm/chunks/ThreadCard-D8FzIxbs.js +570 -0
- package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
- package/dist/npm/chunks/ar-D3SPpN1T.js +195 -0
- package/dist/npm/chunks/client-D1NizpDK.js +627 -0
- package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
- package/dist/npm/chunks/de-C8eC6c6f.js +187 -0
- package/dist/npm/chunks/es-Bczf42tm.js +187 -0
- package/dist/npm/chunks/extension--it1LAj-.js +54 -0
- package/dist/npm/chunks/extension-XfuRGu2o.js +26 -0
- package/dist/npm/chunks/format-Bw_tNOh9.js +524 -0
- package/dist/npm/chunks/fr-BaQw-v2e.js +187 -0
- package/dist/npm/chunks/hi-BamV-yXv.js +187 -0
- package/dist/npm/chunks/html2canvas-DfGb8yka.js +4024 -0
- package/dist/npm/chunks/it-DC14_EjN.js +187 -0
- package/dist/npm/chunks/ja-B1mmTN7Y.js +187 -0
- package/dist/npm/chunks/mount-5fFig0k6.js +1447 -0
- package/dist/npm/chunks/nl-BfhqUsmX.js +187 -0
- package/dist/npm/chunks/privacy-DLhezjyi.js +30 -0
- package/dist/npm/chunks/pt-BR-CEPu4W5U.js +187 -0
- package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-BSsQoE1K.js} +224 -222
- package/dist/npm/chunks/realtime-CBRW9BB3.js +34 -0
- package/dist/npm/chunks/report-Dh4fxd4J.js +27 -0
- package/dist/npm/chunks/rolldown-runtime-Y_bBpyJl.js +20 -0
- package/dist/npm/chunks/src-DujplxfI.js +517 -0
- package/dist/npm/chunks/zh-CN-kgqjYwHQ.js +187 -0
- package/dist/npm/element.js +41 -0
- package/dist/npm/headless.js +3 -0
- package/dist/npm/index.js +3 -0
- package/dist/npm/react.js +26 -0
- package/dist/npm/svelte.js +17 -0
- package/dist/npm/types/adapters/react.d.ts +11 -0
- package/dist/npm/types/adapters/svelte.d.ts +9 -0
- package/dist/npm/types/adapters/vue.d.ts +118 -0
- package/dist/npm/types/anchor/index.d.ts +49 -0
- package/dist/npm/types/core/api.d.ts +31 -0
- package/dist/npm/types/core/auth.d.ts +87 -0
- package/dist/npm/types/core/client.d.ts +114 -0
- package/dist/npm/types/core/store.d.ts +7 -0
- package/dist/npm/types/core/types.d.ts +303 -0
- package/dist/npm/types/element.d.ts +13 -0
- package/dist/npm/types/headless.d.ts +7 -0
- package/dist/npm/types/index.d.ts +32 -0
- package/dist/npm/vue.js +71 -0
- package/package.json +71 -173
- package/dist/THIRD_PARTY_NOTICES.txt +0 -284
- package/dist/angular.es.js +0 -321
- package/dist/comment-kit.es.js +0 -218
- package/dist/demo.es.js +0 -483
- package/dist/headless.es.js +0 -4
- package/dist/preact.es.js +0 -117
- package/dist/qwik.es.js +0 -1
- package/dist/qwik.qwik.mjs +0 -114
- package/dist/react.es.js +0 -98
- package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
- package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
- package/dist/shared/annotation-toolbar-zeiCmKIr.js +0 -1086
- package/dist/shared/attachment-refresh-DAacLaRu.js +0 -94
- package/dist/shared/bridge-CJoGYngu.js +0 -177
- package/dist/shared/button-D4GHW6oZ.js +0 -474
- package/dist/shared/button-group-BVR7iT-S.js +0 -91
- package/dist/shared/capture-privacy-CiOrcAlt.js +0 -101
- package/dist/shared/comment-drawing-canvas-Btc12IsS.js +0 -124
- package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
- package/dist/shared/comment-image-lightbox--QpbcAtH.js +0 -190
- package/dist/shared/comment-images-content-C_r4SHM-.js +0 -214
- package/dist/shared/comment-kit-core-CmLUFujd.js +0 -3682
- package/dist/shared/comment-kit-ui-BHwYuSIi.js +0 -19391
- package/dist/shared/comment-screenshot-annotator-zJZyO-XM.js +0 -151
- package/dist/shared/comment-screenshot-overlay-CoKTYB0J.js +0 -205
- package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
- package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
- package/dist/shared/dev-export-panel-Cnt6oCZU.js +0 -207
- package/dist/shared/dev-grab-B85jo9AS.js +0 -197
- package/dist/shared/dist-D9A5k-N4.js +0 -617
- package/dist/shared/dom-Bhf4WFtY.js +0 -223
- package/dist/shared/element-selector-Cng84xC7.js +0 -902
- package/dist/shared/error-boundary-D3PD74vI.js +0 -21
- package/dist/shared/errors-Bu5ajEmB.js +0 -22
- package/dist/shared/icons-nzMOLzrm.js +0 -266
- package/dist/shared/input-UPtAj0M6.js +0 -111
- package/dist/shared/mount-ui-Dz7FB_Ak.js +0 -208
- package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
- package/dist/shared/realtime-yGLX4wMK.js +0 -334
- package/dist/shared/request-activity-DQrAUwfA.js +0 -11
- package/dist/shared/screenshot-B5-hwpmt.js +0 -199
- package/dist/shared/separator-UhJb0Row.js +0 -3955
- package/dist/shared/shadow-root-B58ZI2yz.js +0 -133
- package/dist/shared/styles-CnYsLS2f.js +0 -2
- package/dist/shared/text-B4HHZNaa.js +0 -23
- package/dist/shared/token-session-D92MYbNu.js +0 -25
- package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
- package/dist/shared/useRender-Uxk1OPK-.js +0 -5
- package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
- package/dist/shared/validation-3wbbbuX0.js +0 -70
- package/dist/shared/websocket-manager-KhH4hL0Q.js +0 -381
- package/dist/solid.es.js +0 -98
- package/dist/svelte.es.js +0 -130
- package/dist/types/adapters/bridge.d.ts +0 -122
- package/dist/types/angular/index.d.ts +0 -145
- package/dist/types/core/agent-context.d.ts +0 -17
- package/dist/types/core/api-client.d.ts +0 -155
- package/dist/types/core/comment-kit-core.d.ts +0 -254
- package/dist/types/core/local-demo.d.ts +0 -60
- package/dist/types/core/types.d.ts +0 -770
- package/dist/types/core/websocket-manager.d.ts +0 -125
- package/dist/types/core/write-access.d.ts +0 -11
- package/dist/types/demo.d.ts +0 -17
- package/dist/types/headless.d.ts +0 -8
- package/dist/types/index.d.ts +0 -87
- package/dist/types/preact/index.d.ts +0 -25
- package/dist/types/qwik/index.d.ts +0 -73
- package/dist/types/react/client.d.ts +0 -31
- package/dist/types/react/index.d.ts +0 -4
- package/dist/types/solid/index.d.ts +0 -37
- package/dist/types/svelte/index.d.ts +0 -55
- package/dist/types/utils/dom.d.ts +0 -59
- package/dist/types/utils/event-emitter.d.ts +0 -11
- package/dist/types/vue/index.d.ts +0 -87
- package/dist/vue.es.js +0 -148
- package/docs/api-reference.md +0 -405
- package/docs/local-demo.md +0 -60
package/README.md
CHANGED
|
@@ -1,847 +1,287 @@
|
|
|
1
1
|
# CommentKit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Drop-in SDK for React, Vue, Svelte, Angular, Solid.js, Qwik, Preact, and vanilla JavaScript.
|
|
5
|
-
|
|
6
|
-
[npm version](https://www.npmjs.com/package/@commentkit/comment-kit)
|
|
7
|
-
[downloads](https://www.npmjs.com/package/@commentkit/comment-kit)
|
|
8
|
-
[license](./LICENSE)
|
|
9
|
-
[docs](https://commentkit.dev/developers)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Features
|
|
14
|
-
|
|
15
|
-
| Feature | Description |
|
|
16
|
-
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
-
| **Pin Comments** | Click anywhere on a page to leave a comment pin |
|
|
18
|
-
| **Element Comments** | Select a real DOM element, comment on it, and keep it marked until resolved |
|
|
19
|
-
| **Text Highlighting** | Select text to annotate with contextual feedback |
|
|
20
|
-
| **Drawing Tools** | Freehand draw, shapes, and arrows overlaid on the page |
|
|
21
|
-
| **Screenshots** | Capture annotated screenshots with one click |
|
|
22
|
-
| **Real-Time Collaboration** | See live cursors, presence indicators, and instant updates |
|
|
23
|
-
| **Offline Support** | Mutations queue automatically and retry when back online |
|
|
24
|
-
| **OTP Authentication** | Passwordless email authentication with authenticator/recovery-code support |
|
|
25
|
-
| **Member Invite Links** | Invite members by email — they verify via OTP to join |
|
|
26
|
-
| **Task Workflows** | Assign, prioritize, resolve, and track comments as tasks |
|
|
27
|
-
| **@Mentions** | Tag team members with autocomplete from your project roster |
|
|
28
|
-
| **Reactions** | Emoji reactions on comments and replies |
|
|
29
|
-
| **Deep Linking** | Link directly to any comment via URL hash |
|
|
30
|
-
| **Agent Handoff** | Copy unresolved comments + element source + screenshot to Claude Desktop, Cursor, Codex, Continue, Zed AI, or any clipboard-aware agent |
|
|
31
|
-
| **Source-Resolved Output** | When the `element-source` peer is installed, agent context includes `file:line:col` and the component stack for each element |
|
|
32
|
-
| **Dev Grab** | One-click capture: any element on your localhost site → clipboard with Markdown + `image/png` screenshot for direct paste into your agent |
|
|
33
|
-
| **Dev Export Panel** | On localhost, bulk-select stakeholder comments from production/staging and copy them as one bundled agent payload |
|
|
34
|
-
| **Multi-Select** | Shift+click or drag a marquee to grab multiple elements at once |
|
|
35
|
-
| **Context Menu** | Right-click any element while in select mode: grab, comment, copy selector, copy XPath, inspect |
|
|
36
|
-
| **Hold-to-Activate** | Configure select mode to be active only while a modifier key is held (`Alt`, `Meta`, `Control`, `Shift`) |
|
|
37
|
-
| **Animation Freeze** | While selecting, all host-page CSS animations, transitions, and Web Animations API tweens pause |
|
|
38
|
-
| **Touch Mode** | Long-press opens the context menu on touch devices |
|
|
39
|
-
| **MCP Companion** | Separate `comment-kit-mcp` package for authenticated, read-only agent access to feedback |
|
|
40
|
-
| **Keyboard Shortcuts** | Full keyboard navigation and tool shortcuts |
|
|
41
|
-
| **Shadow DOM Isolation** | UI is fully isolated from your app's styles |
|
|
42
|
-
| **Environment Scoping** | New comments are tagged to production, staging, preview, or dev |
|
|
43
|
-
| **Auto-Configuration** | SDK auto-detects projectId, WebSocket config, and invite tokens |
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
## Quick Start
|
|
48
|
-
|
|
49
|
-
### 1. Install
|
|
50
|
-
|
|
51
|
-
For an app that already has matching React and ReactDOM 18+ versions:
|
|
3
|
+
Figma-style comments for any website.
|
|
52
4
|
|
|
53
|
-
|
|
54
|
-
npm install @commentkit/comment-kit
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
For vanilla, Vue, Svelte, Angular, Solid, Qwik, or Preact apps using the built-in widget:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm install @commentkit/comment-kit react react-dom
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Every adapter renders the same React widget. React and ReactDOM are optional in package metadata so a headless installation can omit them; **all built-in UI integrations still need both**. Keep existing compatible React versions rather than upgrading them just to install CommentKit. Your adapter's framework is also a peer dependency.
|
|
64
|
-
|
|
65
|
-
The package is ESM-only; use `import`, not CommonJS `require()`. For default screenshots and image captures, also install `html2canvas`, or supply a custom `screenshotProvider`:
|
|
5
|
+
Your clients click the part of the page they mean and write what should change. CommentKit pins the comment to that exact spot, attaches a screenshot of what they saw, and records the page, browser and screen size. You see the feedback on your live site, your staging and preview links, and on `localhost` — and you can hand it straight to your AI coding agent.
|
|
66
6
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
7
|
+
- **One install, every stack.** A script tag works on any website (WordPress, Webflow, Shopify, plain HTML). npm users get `init()` plus tiny React, Vue and Svelte helpers. Nothing else to install: no React required on your side.
|
|
8
|
+
- **Built for people who have never used a feedback tool.** Clients open a client link, click, type, confirm their email once. No account, no password.
|
|
9
|
+
- **Built for developers.** Feedback per branch and environment, element selectors and source locations, console errors, a dashboard with list and board views, email notifications, and an MCP server for Claude Code, Cursor and other agents.
|
|
70
10
|
|
|
71
|
-
|
|
11
|
+
## Install
|
|
72
12
|
|
|
73
|
-
|
|
74
|
-
2. Create an organization
|
|
75
|
-
3. Create a project inside the organization
|
|
76
|
-
4. Add the website domains that may use this project to its **allowed domains**
|
|
77
|
-
5. Copy the **API key** from the project dashboard
|
|
13
|
+
### Any website
|
|
78
14
|
|
|
79
|
-
|
|
15
|
+
Paste before `</body>`:
|
|
80
16
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
On localhost the toolbar is visible. On production, staging and preview sites, press **Cmd/Ctrl + Shift + K** to open sign-in, then verify your email with OTP. Mount one instance for the app and clean it up when its host unmounts.
|
|
84
|
-
|
|
85
|
-
**Next.js (App Router)**
|
|
86
|
-
|
|
87
|
-
Import the client entry directly from your layout. The published React entry retains its `"use client"` boundary, and browser UI mounting happens after hydration. A `next/dynamic` wrapper with `ssr: false` is no longer required.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
// app/layout.tsx
|
|
91
|
-
import { CommentKit } from "@commentkit/comment-kit/react";
|
|
92
|
-
|
|
93
|
-
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
94
|
-
return (
|
|
95
|
-
<html lang="en">
|
|
96
|
-
<body>
|
|
97
|
-
{children}
|
|
98
|
-
<CommentKit apiKey="your-api-key" />
|
|
99
|
-
</body>
|
|
100
|
-
</html>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
17
|
+
```html
|
|
18
|
+
<script src="https://commentkit.dev/cdn/v1/loader.js" data-project="pk_live_your_key" defer></script>
|
|
103
19
|
```
|
|
104
20
|
|
|
105
|
-
|
|
21
|
+
### npm
|
|
106
22
|
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
import { CommentKit } from "@commentkit/comment-kit/react";
|
|
110
|
-
import type { AppProps } from "next/app";
|
|
111
|
-
|
|
112
|
-
export default function App({ Component, pageProps }: AppProps) {
|
|
113
|
-
return (
|
|
114
|
-
// Works with any CSS setup — Tailwind, CSS Modules, styled-components.
|
|
115
|
-
// CommentKit UI is fully isolated inside Shadow DOM.
|
|
116
|
-
<CommentKit
|
|
117
|
-
apiKey="your-api-key"
|
|
118
|
-
// onReady={() => console.log("CommentKit loaded")}
|
|
119
|
-
// onError={(err) => console.error(err)}
|
|
120
|
-
>
|
|
121
|
-
<Component {...pageProps} />
|
|
122
|
-
</CommentKit>
|
|
123
|
-
);
|
|
124
|
-
}
|
|
23
|
+
```bash
|
|
24
|
+
npm install @commentkit/comment-kit@beta
|
|
125
25
|
```
|
|
126
26
|
|
|
127
|
-
|
|
27
|
+
While 1.0 is in beta, install with `@beta` (plain `npm install` and `^1` start working with 1.0.0).
|
|
128
28
|
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
import { CommentKit } from "@commentkit/comment-kit/react";
|
|
29
|
+
```ts
|
|
30
|
+
import { init } from "@commentkit/comment-kit";
|
|
132
31
|
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<html lang="en">
|
|
136
|
-
<head>
|
|
137
|
-
<Meta />
|
|
138
|
-
<Links />
|
|
139
|
-
</head>
|
|
140
|
-
<body>
|
|
141
|
-
<Outlet />
|
|
142
|
-
{/* Same as Next.js — sits outside your providers, fully self-contained */}
|
|
143
|
-
<CommentKit apiKey="your-api-key" />
|
|
144
|
-
<Scripts />
|
|
145
|
-
</body>
|
|
146
|
-
</html>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
32
|
+
init({ project: "pk_live_your_key" });
|
|
149
33
|
```
|
|
150
34
|
|
|
151
|
-
|
|
35
|
+
### React / Next.js
|
|
152
36
|
|
|
153
37
|
```tsx
|
|
154
|
-
// main.tsx or App.tsx
|
|
155
38
|
import { CommentKit } from "@commentkit/comment-kit/react";
|
|
156
39
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// Drop-in: renders a floating toolbar with comment, draw,
|
|
160
|
-
// highlight, and screenshot tools. Tooltips built-in.
|
|
161
|
-
// Theme follows .dark/.light class or system preference.
|
|
162
|
-
<CommentKit apiKey="your-api-key">{/* Your app content */}</CommentKit>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Vue 3**
|
|
168
|
-
|
|
169
|
-
```vue
|
|
170
|
-
<script setup>
|
|
171
|
-
import { useCommentKit } from "@commentkit/comment-kit/vue";
|
|
172
|
-
|
|
173
|
-
// Reactive refs — auto-update when state changes.
|
|
174
|
-
// Theme auto-detects. Tooltips built into the toolbar.
|
|
175
|
-
const { isAuthenticated, comments, toggleOverlay } = useCommentKit({
|
|
176
|
-
apiKey: "your-api-key",
|
|
177
|
-
// ui: { theme: "dark", position: "bottom-left" },
|
|
178
|
-
});
|
|
179
|
-
</script>
|
|
40
|
+
// Root layout, next to {children}. Works in Next.js server layouts.
|
|
41
|
+
<CommentKit project="pk_live_your_key" branch={process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF} />
|
|
180
42
|
```
|
|
181
43
|
|
|
182
|
-
|
|
44
|
+
### Vue / Nuxt
|
|
183
45
|
|
|
184
46
|
```ts
|
|
185
|
-
// main.ts — registers the <CommentKit> component
|
|
186
47
|
import { CommentKitPlugin } from "@commentkit/comment-kit/vue";
|
|
187
48
|
|
|
188
|
-
app.use(CommentKitPlugin);
|
|
49
|
+
app.use(CommentKitPlugin, { project: "pk_live_your_key" });
|
|
189
50
|
```
|
|
190
51
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
**Nuxt 3 / Nuxt 4**
|
|
194
|
-
|
|
195
|
-
For a client-only Nuxt integration, use a component whose filename ends in `.client.vue`. Its setup registers the hook, and Nuxt handles client mounting.
|
|
196
|
-
|
|
197
|
-
```vue
|
|
198
|
-
<!-- components/CommentKitClient.client.vue -->
|
|
199
|
-
<script setup lang="ts">
|
|
200
|
-
import { useCommentKit } from "@commentkit/comment-kit/vue";
|
|
52
|
+
Nuxt: create `plugins/commentkit.client.ts`:
|
|
201
53
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</script>
|
|
205
|
-
|
|
206
|
-
<template><div /></template>
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
```vue
|
|
210
|
-
<!-- app.vue -->
|
|
211
|
-
<template>
|
|
212
|
-
<div>
|
|
213
|
-
<NuxtPage />
|
|
214
|
-
<CommentKitClient />
|
|
215
|
-
</div>
|
|
216
|
-
</template>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Svelte**
|
|
220
|
-
|
|
221
|
-
```svelte
|
|
222
|
-
<script>
|
|
223
|
-
import { useCommentKit } from "@commentkit/comment-kit/svelte";
|
|
224
|
-
|
|
225
|
-
// Svelte stores — use $store syntax for reactivity.
|
|
226
|
-
// Theme auto-detects. Tooltips built into the toolbar.
|
|
227
|
-
const { comments, isAuthenticated, toggleOverlay } = useCommentKit({
|
|
228
|
-
apiKey: "your-api-key",
|
|
229
|
-
// ui: { theme: "dark" },
|
|
230
|
-
});
|
|
231
|
-
</script>
|
|
54
|
+
```ts
|
|
55
|
+
import { CommentKitPlugin } from "@commentkit/comment-kit/vue";
|
|
232
56
|
|
|
233
|
-
|
|
234
|
-
|
|
57
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
58
|
+
nuxtApp.vueApp.use(CommentKitPlugin, { project: useRuntimeConfig().public.commentkitKey });
|
|
59
|
+
});
|
|
235
60
|
```
|
|
236
61
|
|
|
237
|
-
|
|
62
|
+
Or place `<CommentKit project="pk_live_your_key" />` from `@commentkit/comment-kit/vue` once in your root component; it accepts every option below as a prop.
|
|
238
63
|
|
|
239
|
-
|
|
64
|
+
### Svelte / SvelteKit
|
|
240
65
|
|
|
241
66
|
```svelte
|
|
242
67
|
<!-- src/routes/+layout.svelte -->
|
|
243
|
-
<script
|
|
244
|
-
import {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
onMount(() => {
|
|
248
|
-
let disposed = false;
|
|
249
|
-
let store: SvelteCommentKitStore | undefined;
|
|
250
|
-
|
|
251
|
-
void import("@commentkit/comment-kit/svelte")
|
|
252
|
-
.then(({ createCommentKitStore }) => {
|
|
253
|
-
if (!disposed) store = createCommentKitStore({ apiKey: "your-api-key" });
|
|
254
|
-
})
|
|
255
|
-
.catch((error) => console.error("CommentKit could not load", error));
|
|
256
|
-
|
|
257
|
-
return () => {
|
|
258
|
-
disposed = true;
|
|
259
|
-
store?.destroy();
|
|
260
|
-
};
|
|
261
|
-
});
|
|
68
|
+
<script>
|
|
69
|
+
import { commentkit } from "@commentkit/comment-kit/svelte";
|
|
70
|
+
let { children } = $props();
|
|
262
71
|
</script>
|
|
263
72
|
|
|
264
|
-
<
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
**Angular**
|
|
268
|
-
|
|
269
|
-
```typescript
|
|
270
|
-
// app.config.ts
|
|
271
|
-
import { provideCommentKit } from "@commentkit/comment-kit/angular";
|
|
272
|
-
|
|
273
|
-
export const appConfig = {
|
|
274
|
-
providers: [
|
|
275
|
-
// Registers CommentKitService with DI.
|
|
276
|
-
// Theme auto-detects. All UI isolated in Shadow DOM.
|
|
277
|
-
provideCommentKit({
|
|
278
|
-
apiKey: "your-api-key",
|
|
279
|
-
// ui: { theme: "dark", position: "bottom-left" },
|
|
280
|
-
}),
|
|
281
|
-
],
|
|
282
|
-
};
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
```typescript
|
|
286
|
-
// app.component.ts
|
|
287
|
-
import { Component, inject } from "@angular/core";
|
|
288
|
-
import { CommentKitService } from "@commentkit/comment-kit/angular";
|
|
289
|
-
|
|
290
|
-
@Component({ selector: "app-root", standalone: true, template: "<main>Your app</main>" })
|
|
291
|
-
export class AppComponent {
|
|
292
|
-
private readonly commentKit = inject(CommentKitService);
|
|
293
|
-
|
|
294
|
-
// RxJS observables — auto-emit on state changes
|
|
295
|
-
comments$ = this.commentKit.comments$;
|
|
296
|
-
}
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
**Solid.js / SolidStart**
|
|
300
|
-
|
|
301
|
-
```tsx
|
|
302
|
-
import { useCommentKit } from "@commentkit/comment-kit/solid";
|
|
303
|
-
|
|
304
|
-
function App() {
|
|
305
|
-
// Solid signals — auto-track dependencies, fine-grained reactivity.
|
|
306
|
-
// Full UI mounts in Shadow DOM automatically.
|
|
307
|
-
const { comments, isAuthenticated, toggleOverlay } = useCommentKit({
|
|
308
|
-
apiKey: "your-api-key",
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
return <p>Comments: {comments().length}</p>;
|
|
312
|
-
}
|
|
73
|
+
<svelte:body use:commentkit={{ project: "pk_live_your_key" }} />
|
|
74
|
+
{@render children()}
|
|
313
75
|
```
|
|
314
76
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
```tsx
|
|
318
|
-
import { component$ } from "@builder.io/qwik";
|
|
319
|
-
import { useCommentKit } from "@commentkit/comment-kit/qwik";
|
|
320
|
-
|
|
321
|
-
export default component$(() => {
|
|
322
|
-
// The hook uses useVisibleTask$ to mount only on the client.
|
|
323
|
-
// The Shadow DOM widget still requires React and ReactDOM.
|
|
324
|
-
const { core, isReady } = useCommentKit({
|
|
325
|
-
apiKey: "your-api-key",
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
<button disabled={!isReady.value} onClick$={() => core.value?.toggleOverlay()}>
|
|
330
|
-
Toggle comments
|
|
331
|
-
</button>
|
|
332
|
-
);
|
|
333
|
-
});
|
|
334
|
-
```
|
|
77
|
+
### Anything else
|
|
335
78
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
Use Qwik's optimizer and its supported Vite version to build the host app. Qwik 1.20.2 has an upstream declaration error that requires `skipLibCheck: true`; CommentKit's consumer API expressions are still checked. Client-only function options such as `screenshotProvider` cannot survive server serialization; Qwik callbacks that must resume should use `onReady$` and `onError$`.
|
|
339
|
-
|
|
340
|
-
**Preact**
|
|
341
|
-
|
|
342
|
-
```tsx
|
|
343
|
-
import { useCommentKit } from "@commentkit/comment-kit/preact";
|
|
79
|
+
Angular, Solid, Astro, Qwik, Remix, or a custom setup: call `init()` once in the browser. If you prefer markup, import the custom element once in your bundle and place the tag anywhere:
|
|
344
80
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
// Full UI mounts in Shadow DOM via React and ReactDOM (UI peers).
|
|
348
|
-
const { state, core } = useCommentKit({
|
|
349
|
-
apiKey: "your-api-key",
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
return <p>Comments: {state?.comments.length ?? 0}</p>;
|
|
353
|
-
}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
**Astro**
|
|
357
|
-
|
|
358
|
-
Astro needs the React integration installed (`npx astro add react`). Wrap the import in a tiny React component so `client:only="react"` keeps CommentKit out of the server bundle.
|
|
359
|
-
|
|
360
|
-
```tsx
|
|
361
|
-
// src/components/CommentKitClient.tsx
|
|
362
|
-
import { useEffect, useState } from "react";
|
|
363
|
-
|
|
364
|
-
export default function CommentKitClient({ apiKey }: { apiKey: string }) {
|
|
365
|
-
const [Cmp, setCmp] = useState<React.ComponentType<{ apiKey: string }> | null>(null);
|
|
366
|
-
useEffect(() => {
|
|
367
|
-
import("@commentkit/comment-kit/react").then((m) => setCmp(() => m.CommentKit));
|
|
368
|
-
}, []);
|
|
369
|
-
return Cmp ? <Cmp apiKey={apiKey} /> : null;
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
```astro
|
|
374
|
-
---
|
|
375
|
-
// src/layouts/Layout.astro
|
|
376
|
-
import CommentKitClient from "../components/CommentKitClient";
|
|
377
|
-
---
|
|
378
|
-
<html lang="en">
|
|
379
|
-
<body>
|
|
380
|
-
<slot />
|
|
381
|
-
<CommentKitClient client:only="react" apiKey="your-api-key" />
|
|
382
|
-
</body>
|
|
383
|
-
</html>
|
|
81
|
+
```ts
|
|
82
|
+
import "@commentkit/comment-kit/element";
|
|
384
83
|
```
|
|
385
84
|
|
|
386
|
-
Or use vanilla JS in any `.astro` page:
|
|
387
|
-
|
|
388
85
|
```html
|
|
389
|
-
<
|
|
390
|
-
import { CommentKit } from "@commentkit/comment-kit";
|
|
391
|
-
new CommentKit({ apiKey: "your-api-key" });
|
|
392
|
-
</script>
|
|
86
|
+
<comment-kit project="pk_live_your_key" branch="main"></comment-kit>
|
|
393
87
|
```
|
|
394
88
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
The following package import is resolved by a bundler such as Vite. A standalone HTML page needs a browser-ready bundle or an import map for the SDK and its peers; browsers do not resolve bare npm package names by themselves.
|
|
398
|
-
|
|
399
|
-
```html
|
|
400
|
-
<!-- In a bundler-managed HTML entry, CommentKit mounts its widget on demand.
|
|
401
|
-
Theme follows .dark class on <html> or system preference.
|
|
402
|
-
Tooltips, dialogs, and panels are built-in. -->
|
|
403
|
-
<script type="module">
|
|
404
|
-
import { CommentKit } from "@commentkit/comment-kit";
|
|
405
|
-
|
|
406
|
-
const ck = new CommentKit({
|
|
407
|
-
apiKey: "your-api-key",
|
|
408
|
-
// ui: { theme: "dark", position: "bottom-left" },
|
|
409
|
-
});
|
|
410
|
-
</script>
|
|
411
|
-
```
|
|
89
|
+
Attributes: `project` (required), `branch`, `commit`, `locale`, `theme`, `position`, `auth`, `endpoint`, `deployment-url`, `hide-on-production="false"`, `shortcuts="false"`. Changing `project` restarts the widget.
|
|
412
90
|
|
|
413
|
-
|
|
91
|
+
Find your key in the dashboard under **Project → Setup** (or run `npx @commentkit/cli login` and then `npx @commentkit/cli init`, or `npx @commentkit/cli init --key pk_live_…` without signing in), and add every website address there (live, staging, preview, e.g. `https://*.vercel.app`). Localhost always works for your team.
|
|
414
92
|
|
|
415
|
-
##
|
|
93
|
+
## How it behaves
|
|
416
94
|
|
|
417
|
-
|
|
95
|
+
| Where | Who sees the widget |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `localhost`, `*.localhost`, `*.test` | Always visible, for your team |
|
|
98
|
+
| Live, staging and preview sites | Hidden from visitors. Shown when someone opens a client link (`?ck=…`), an email link, presses **Cmd/Ctrl + Shift + K**, or is already signed in on that device |
|
|
418
99
|
|
|
419
|
-
|
|
420
|
-
import { CommentKitCore } from "@commentkit/comment-kit/headless";
|
|
100
|
+
People leave feedback with one tool:
|
|
421
101
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
console.log(state.comments);
|
|
426
|
-
});
|
|
102
|
+
- **Click** an element to comment on it.
|
|
103
|
+
- **Drag** to mark an area.
|
|
104
|
+
- **Select text first** to comment on exactly that text.
|
|
427
105
|
|
|
428
|
-
|
|
429
|
-
// unsubscribe();
|
|
430
|
-
// core.destroy();
|
|
431
|
-
```
|
|
106
|
+
A screenshot of the visible page is attached automatically with the pin drawn on it. Reviewers can draw on it (arrow, box, pen, blur to hide private details, text). Passwords, card fields, one-time codes and anything marked `data-commentkit-redact` are never captured.
|
|
432
107
|
|
|
433
|
-
|
|
108
|
+
Sign-in opens a small CommentKit window (or continues in the same tab inside in-app browsers like WhatsApp and Instagram). Credentials never touch your page.
|
|
434
109
|
|
|
435
|
-
|
|
110
|
+
## Options
|
|
436
111
|
|
|
437
112
|
```ts
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
113
|
+
init({
|
|
114
|
+
project: "pk_live_…", // required
|
|
115
|
+
branch: "feature/checkout", // filter feedback per branch
|
|
116
|
+
commit: "a1b2c3d",
|
|
117
|
+
deploymentUrl: "https://pr-12.example.vercel.app",
|
|
118
|
+
hideOnProduction: true, // default; false shows the launcher to everyone
|
|
119
|
+
theme: "auto", // "light" | "dark" — default from the dashboard
|
|
120
|
+
position: "bottom-right",
|
|
121
|
+
redact: [".customer-email"], // extra selectors never captured
|
|
122
|
+
locale: "fr", // default: <html lang>, then the browser (see Languages)
|
|
123
|
+
auth: "auto", // "popup" | "redirect"
|
|
124
|
+
shortcuts: true, // false turns off C, J / K, E and ? (Esc and Cmd/Ctrl+Shift+K stay)
|
|
125
|
+
});
|
|
442
126
|
```
|
|
443
127
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
## Member Invite Links
|
|
447
|
-
|
|
448
|
-
Invite external collaborators by email — they verify via OTP before they can comment:
|
|
449
|
-
|
|
450
|
-
1. **Dashboard:** Enter the member's email and create an invite link
|
|
451
|
-
2. **Share:** Send the link (e.g. `https://yoursite.com?ck_invite=token`) to the member
|
|
452
|
-
3. **Verify:** When they visit, the SDK detects the invite token and prompts for their email
|
|
453
|
-
4. **OTP:** If the email matches the invite, an OTP is sent for verification
|
|
454
|
-
5. **Collaborate:** After verification, they're a full member and can comment
|
|
455
|
-
|
|
456
|
-
The SDK auto-detects `?ck_invite=` from the URL — no code changes needed.
|
|
457
|
-
|
|
458
|
-
---
|
|
459
|
-
|
|
460
|
-
## Works With
|
|
461
|
-
|
|
462
|
-
Every framework and meta-framework gets the full CommentKit UI — identical toolbar, sidebar, login, and comments panel rendered in Shadow DOM.
|
|
463
|
-
|
|
464
|
-
**React family** — `@commentkit/comment-kit/react`
|
|
465
|
-
|
|
466
|
-
| Framework / Tool | Notes |
|
|
467
|
-
| ----------------------- | --------------------------------------------------------------------- |
|
|
468
|
-
| React | Vite, CRA, esbuild, Rollup, Parcel, plain webpack — same import |
|
|
469
|
-
| Next.js (App Router) | `<CommentKit>` is `"use client"` — works inside a server `layout.tsx` |
|
|
470
|
-
| Next.js (Pages Router) | Mount once in `_app.tsx` |
|
|
471
|
-
| Remix / React Router v7 | Mount in `root.tsx` |
|
|
472
|
-
| Gatsby | Mount in `gatsby-browser.js` or any page |
|
|
473
|
-
| RedwoodJS | Mount in `App.tsx` |
|
|
474
|
-
| TanStack Start | Mount in `app/client.tsx` |
|
|
475
|
-
| Vinxi | Same as TanStack Start |
|
|
476
|
-
| Million.js | React-compatible; same import |
|
|
477
|
-
| Blitz.js | Next.js underneath; same as Next |
|
|
478
|
-
| Modern.js | React-based; same import |
|
|
479
|
-
| Refine | React-based; mount alongside `<Refine>` |
|
|
480
|
-
| Docusaurus | Drop into `swizzled` `Root` component |
|
|
481
|
-
| Nextra | Drop into `theme.config.tsx` layout |
|
|
482
|
-
| Laravel Inertia (React) | Mount in `app.tsx` |
|
|
483
|
-
|
|
484
|
-
**Vue family** — `@commentkit/comment-kit/vue`
|
|
485
|
-
|
|
486
|
-
| Framework / Tool | Notes |
|
|
487
|
-
| --------------------- | ------------------------------------------------------------------ |
|
|
488
|
-
| Vue 3 | Vite, CLI, esbuild, Rollup — same import |
|
|
489
|
-
| Nuxt 3 / Nuxt 4 | Client-only — wrap in `<ClientOnly>` or check `import.meta.client` |
|
|
490
|
-
| Quasar | Mount in `boot/commentkit.ts` |
|
|
491
|
-
| VitePress / VuePress | Mount in `.vitepress/theme/index.ts` |
|
|
492
|
-
| Vike-Vue | Mount in `_default.page.client.ts` |
|
|
493
|
-
| Laravel Inertia (Vue) | Mount in `app.ts` |
|
|
494
|
-
|
|
495
|
-
**Svelte family** — `@commentkit/comment-kit/svelte`
|
|
496
|
-
|
|
497
|
-
| Framework / Tool | Notes |
|
|
498
|
-
| ------------------------ | --------------------------------------------------------------------- |
|
|
499
|
-
| Svelte 5 | Vite, esbuild — same import |
|
|
500
|
-
| SvelteKit | Create the store in `onMount` and destroy it on cleanup (see snippet) |
|
|
501
|
-
| Laravel Inertia (Svelte) | Mount in `app.ts` |
|
|
502
|
-
|
|
503
|
-
**Angular family** — `@commentkit/comment-kit/angular`
|
|
504
|
-
|
|
505
|
-
| Framework / Tool | Notes |
|
|
506
|
-
| ------------------------ | -------------------------------------------------- |
|
|
507
|
-
| Angular 17+ (standalone) | `provideCommentKit({ apiKey })` in `app.config.ts` |
|
|
508
|
-
| Analog | Angular-based meta-framework; same provider |
|
|
509
|
-
| Angular Universal | Provider is browser-only-safe (SSR-aware) |
|
|
510
|
-
|
|
511
|
-
**Solid family** — `@commentkit/comment-kit/solid`
|
|
512
|
-
|
|
513
|
-
| Framework / Tool | Notes |
|
|
514
|
-
| ---------------- | ------------------------------------ |
|
|
515
|
-
| Solid.js | Vite, esbuild — same import |
|
|
516
|
-
| SolidStart | Use inside a `<ClientOnly>` boundary |
|
|
517
|
-
| Vike-Solid | Same as SolidStart |
|
|
518
|
-
|
|
519
|
-
**Qwik family** — `@commentkit/comment-kit/qwik`
|
|
520
|
-
|
|
521
|
-
| Framework / Tool | Notes |
|
|
522
|
-
| ---------------- | ----------------------------------------------------------------------- |
|
|
523
|
-
| Qwik | Call `useCommentKit` inside `component$`; the hook owns client mounting |
|
|
524
|
-
| QwikCity | Same; use in the root component or a shared layout |
|
|
525
|
-
|
|
526
|
-
**Preact family** — `@commentkit/comment-kit/preact`
|
|
527
|
-
|
|
528
|
-
| Framework / Tool | Notes |
|
|
529
|
-
| ---------------- | ------------------------------ |
|
|
530
|
-
| Preact | Vite, esbuild — same import |
|
|
531
|
-
| Fresh (Deno) | Use in an `islands/` component |
|
|
128
|
+
Most behaviour is set in the dashboard and applies instantly without a deploy: pausing feedback on all sites, theme, position, accent colour, privacy selectors, and console/network capture.
|
|
532
129
|
|
|
533
|
-
|
|
130
|
+
### Script-tag attributes
|
|
534
131
|
|
|
535
|
-
|
|
536
|
-
| ---------------------- | ------------------------------------------------------- |
|
|
537
|
-
| Astro | Use any adapter under `client:only` matching the island |
|
|
538
|
-
| Vike (multi-framework) | Pick adapter matching your selected framework |
|
|
132
|
+
`data-project` (required), `data-branch`, `data-commit`, `data-locale`, `data-auth`, `data-endpoint` (another CommentKit server), `data-hide-on-production="false"`, `data-shortcuts="false"`. `theme`, `position`, `redact` and `deploymentUrl` are `init()` options; theme, position and privacy selectors can also be set in the dashboard.
|
|
539
133
|
|
|
540
|
-
|
|
134
|
+
## Languages
|
|
541
135
|
|
|
542
|
-
|
|
543
|
-
| -------------------------- | --------------------------------------------------------------------- |
|
|
544
|
-
| Plain HTML (no framework) | Browser-ready bundle or import map, then `new CommentKit({ apiKey })` |
|
|
545
|
-
| Web Components / Lit | Mount in `connectedCallback` of a host component |
|
|
546
|
-
| Stencil | Mount in `componentDidLoad` |
|
|
547
|
-
| Marko (eBay) | Mount in client init |
|
|
548
|
-
| Alpine.js / Petite-Vue | `<script>` tag at end of `<body>` |
|
|
549
|
-
| htmx | Same as plain HTML |
|
|
550
|
-
| Stimulus / Hotwire (Rails) | Mount in a Stimulus controller's `connect()` |
|
|
551
|
-
| Phoenix LiveView | Mount in a `hook.mounted()` |
|
|
552
|
-
| Laravel Livewire | Mount in Livewire hook |
|
|
553
|
-
| Laravel Filament | Drop the `<script>` into a custom page layout |
|
|
554
|
-
| Mitosis | Mount in the compiled framework's init |
|
|
555
|
-
|
|
556
|
-
**WebView / hybrid shells** — `@commentkit/comment-kit` (vanilla), works the same as a normal page
|
|
557
|
-
|
|
558
|
-
| Shell | Notes |
|
|
559
|
-
| ----------------- | ---------------------------------------------- |
|
|
560
|
-
| Electron | Renderer process — like a normal Chromium page |
|
|
561
|
-
| Tauri | Like a normal WebView |
|
|
562
|
-
| Capacitor (Ionic) | Use inside the WebView; `html2canvas` works |
|
|
563
|
-
| Cordova | Same as Capacitor |
|
|
564
|
-
| Neutralinojs | Same |
|
|
565
|
-
|
|
566
|
-
**Not supported** — these runtimes have no DOM, and CommentKit's UI is a Shadow DOM widget. Hosting it elsewhere is not on the roadmap.
|
|
567
|
-
|
|
568
|
-
| Runtime | Why |
|
|
569
|
-
| ------------------------ | ---------------------------------------------- |
|
|
570
|
-
| React Native / Expo | No DOM; needs a separate native commenting SDK |
|
|
571
|
-
| NativeScript | No DOM |
|
|
572
|
-
| Ink (terminal UIs) | No DOM |
|
|
573
|
-
| Server-only (Hono, etc.) | Server framework, not a client target |
|
|
574
|
-
|
|
575
|
-
---
|
|
576
|
-
|
|
577
|
-
## Keyboard Shortcuts
|
|
578
|
-
|
|
579
|
-
| Shortcut | Action |
|
|
580
|
-
| -------------------- | --------------------------------------------------------------------------------------------- |
|
|
581
|
-
| Cmd/Ctrl + Shift + K | Toggle overlay |
|
|
582
|
-
| C | Comment (pin) mode |
|
|
583
|
-
| E | Element selector mode |
|
|
584
|
-
| D | Drawing mode |
|
|
585
|
-
| H | Highlight mode |
|
|
586
|
-
| S | Screenshot mode |
|
|
587
|
-
| Cmd/Ctrl + C | While in select mode: grab the hovered (or selected) element to the clipboard with screenshot |
|
|
588
|
-
| Shift + click | While in select mode: add an element to the multi-select bucket |
|
|
589
|
-
| Right-click | While in select mode: open context menu (grab, comment, copy selector, copy XPath, inspect) |
|
|
590
|
-
| Long-press (touch) | While in select mode: open context menu on touch devices |
|
|
591
|
-
| ? | Show shortcuts overlay |
|
|
592
|
-
| Esc | Close / deselect / exit mode |
|
|
136
|
+
The widget speaks English, Spanish (`es`), French (`fr`), German (`de`), Portuguese for Brazil (`pt-BR`), Italian (`it`), Dutch (`nl`), Japanese (`ja`), Chinese, Simplified (`zh-CN`), Hindi (`hi`) and Arabic (`ar`, right to left).
|
|
593
137
|
|
|
594
|
-
|
|
138
|
+
It picks the first match from `init({ locale })` (or `data-locale` / `<comment-kit locale>`), then the page's `<html lang>`, then the reader's browser languages, and falls back to English. Regions fall back to the language: `es-MX` gets Spanish, `pt` and `pt-PT` get Brazilian Portuguese, `zh` gets Simplified Chinese. Times ("5 minutes ago") and counts use the browser's `Intl` formatting for that language.
|
|
595
139
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
## Peer Dependencies
|
|
140
|
+
English is built in. Each other language is a separate ~2.5–3 KB (gzip) file, loaded only for readers who need it, while the widget starts. The widget is right to left when its language is Arabic, and otherwise follows the page's `dir` or `<html lang>`.
|
|
599
141
|
|
|
600
|
-
|
|
601
|
-
| ----------------------------------- | ----------------------------------------------------------------------------- | ----------- |
|
|
602
|
-
| `react` + `react-dom` | Built-in UI, including vanilla and non-React adapters | `>=18.0.0` |
|
|
603
|
-
| `vue` | Only for Vue apps | `>=3.0.0` |
|
|
604
|
-
| `svelte` | Only for Svelte apps | `>=4.0.0` |
|
|
605
|
-
| `@angular/core` + `@angular/common` | Only for Angular apps | `>=17.0.0` |
|
|
606
|
-
| `rxjs` | Only for Angular apps | `>=7.0.0` |
|
|
607
|
-
| `solid-js` | Only for Solid.js apps | `>=1.0.0` |
|
|
608
|
-
| `@builder.io/qwik` | Only for Qwik apps | `>=1.0.0` |
|
|
609
|
-
| `preact` | Only for Preact apps | `>=10.0.0` |
|
|
610
|
-
| `html2canvas` | For default screenshots; not needed with a custom `screenshotProvider` | `>=1.4.0` |
|
|
611
|
-
| `pusher-js` | Bundled — no install needed (inlined into the SDK for real-time) | — |
|
|
612
|
-
| `element-source` | Optional — enables file:line + component stack in agent context and dev grabs | `>=0.0.5` |
|
|
613
|
-
|
|
614
|
-
**Migration note:** React and ReactDOM are now optional npm peers, so npm will not install them automatically for a new headless-only consumer. UI consumers must declare compatible versions of both explicitly. Headless imports from `@commentkit/comment-kit/headless` do not require either. The minimum UI peer version remains React 18; using a non-React adapter does not remove this UI runtime requirement.
|
|
142
|
+
Only the widget is translated; the dashboard and emails are in English for now.
|
|
615
143
|
|
|
616
|
-
##
|
|
144
|
+
## API
|
|
617
145
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
There are three integration paths.
|
|
621
|
-
|
|
622
|
-
### 1. Element selector (toolbar)
|
|
623
|
-
|
|
624
|
-
The toolbar's **Element** tool (`E`) lets anyone — stakeholder or developer — click a page element, write a short comment, and save. CommentKit persists a viewport position plus `position.element` and `position.xpath`. Anchored comments render a persistent outline that re-resolves on scroll, resize, and DOM mutations.
|
|
625
|
-
|
|
626
|
-
### 2. Dev grab (developer, local)
|
|
627
|
-
|
|
628
|
-
In the same Element-tool composer, a **Grab for agent** button copies the selected element directly to the clipboard — no backend save. ⌘C / Ctrl+C on the hovered element does the same. The clipboard payload includes:
|
|
629
|
-
|
|
630
|
-
- A Markdown summary with tag name, component name (when resolved), source file location (`file:line:col`), component stack, a bounded and redacted structural HTML snapshot, and the page URL.
|
|
631
|
-
- An `image/png` clipboard MIME carrying the rendered element screenshot. Agents that accept image pastes (Claude Desktop, Cursor, Codex) drop both the text and the image in one paste.
|
|
146
|
+
`init()` returns an instance:
|
|
632
147
|
|
|
633
148
|
```ts
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
//
|
|
637
|
-
|
|
149
|
+
const kit = init({ project: "pk_live_…" });
|
|
150
|
+
|
|
151
|
+
kit.show(); // same as Cmd/Ctrl + Shift + K
|
|
152
|
+
kit.hide();
|
|
153
|
+
kit.open("CK-12"); // show the widget and open one conversation (id or reference)
|
|
154
|
+
await kit.signIn(); // call from a click
|
|
155
|
+
await kit.signOut();
|
|
156
|
+
kit.session(); // { person, role, project, environment, capabilities } | null
|
|
157
|
+
kit.on("thread:created", ({ thread }) => {});
|
|
158
|
+
kit.destroy(); // removes every trace from the page
|
|
638
159
|
```
|
|
639
160
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
```ts
|
|
643
|
-
const bundle = await commentKit.grabElements([el1, el2, el3]);
|
|
644
|
-
// bundle.markdown — single bundled payload, each entry with its own screenshot inlined as a data URL
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
Source resolution kicks in when the optional `element-source` peer dep is installed. Without it, the output falls back to `selector` + `xpath`.
|
|
648
|
-
|
|
649
|
-
### 3. Bulk export of stakeholder comments (developer, local)
|
|
161
|
+
Events: `ready`, `session:change`, `thread:created`, `thread:updated`, `message:created`, and `error` (the widget could not start; `error.code` is listed at https://commentkit.dev/docs/errors).
|
|
650
162
|
|
|
651
|
-
|
|
163
|
+
### Script tag API: `window.CommentKit`
|
|
652
164
|
|
|
653
|
-
|
|
654
|
-
await commentKit.copyAgentContext({
|
|
655
|
-
includeResolved: false,
|
|
656
|
-
currentPageOnly: true,
|
|
657
|
-
});
|
|
165
|
+
On sites that use the script-tag loader, the loader sets one global once the widget is ready, `window.CommentKit`, and `destroy()` removes it again. It is the only global CommentKit adds; npm installs use the `init()` instance instead.
|
|
658
166
|
|
|
659
|
-
|
|
167
|
+
```js
|
|
168
|
+
CommentKit.version; // "1.0.0"
|
|
169
|
+
CommentKit.show(); // Promise
|
|
170
|
+
CommentKit.hide();
|
|
171
|
+
CommentKit.open("CK-12"); // or a thread id
|
|
172
|
+
const onNew = ({ thread }) => console.log(thread.reference);
|
|
173
|
+
CommentKit.on("thread:created", onNew);
|
|
174
|
+
CommentKit.off("thread:created", onNew);
|
|
175
|
+
CommentKit.destroy(); // removes the widget, its listeners and window.CommentKit
|
|
660
176
|
```
|
|
661
177
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
The separate `comment-kit-mcp` companion implements `list_comments`, `get_comment`, and `search_comments` for MCP clients. It is installed independently from this browser SDK and requires a numeric project ID and dedicated 30-day read-only agent token from Project → Installation; public project keys and SDK login tokens are not accepted. See its [package guide](https://www.npmjs.com/package/comment-kit-mcp) for installation and local stdio configuration.
|
|
178
|
+
`window.CommentKit` only exists while the widget is shown on that page (local development, a share or email link, a signed-in person, or after Cmd/Ctrl + Shift + K). Check for it before calling: `window.CommentKit?.open("CK-12")`.
|
|
665
179
|
|
|
666
|
-
|
|
180
|
+
Nothing CommentKit does can break your page: a failed download, a setup error or a crash inside the widget logs one console warning and the widget removes itself.
|
|
667
181
|
|
|
668
|
-
|
|
182
|
+
`@commentkit/comment-kit/headless` exports `CommentKitClient`, `createAnchor` and `resolveAnchor` for custom interfaces and browser extensions.
|
|
669
183
|
|
|
670
|
-
##
|
|
184
|
+
## AI agents
|
|
671
185
|
|
|
672
|
-
|
|
186
|
+
The easiest way: add `https://commentkit.dev/mcp` as a remote MCP server in Claude, Cursor or VS Code and sign in. You choose the project and what the agent may do.
|
|
673
187
|
|
|
674
|
-
```
|
|
675
|
-
|
|
676
|
-
apiKey: "your-api-key", // required — from dashboard
|
|
677
|
-
branch: "main", // optional — tag new feedback and filter this branch
|
|
678
|
-
enabled: true, // optional — set false to disable completely
|
|
679
|
-
screenshotProvider: async (el) => {...}, // optional — replaces html2canvas
|
|
680
|
-
ui: {
|
|
681
|
-
theme: "auto", // "light" | "dark" | "auto"
|
|
682
|
-
position: "bottom-right", // "bottom-right" | "bottom-left" | "top-right" | "top-left"
|
|
683
|
-
activation: {
|
|
684
|
-
mode: "toggle", // "toggle" (default) | "hold"
|
|
685
|
-
key: "Alt", // "Alt" | "Meta" | "Control" | "Shift" — used by hold mode
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
realtime: { // optional — collaboration tuning
|
|
689
|
-
cursors: true, // live peer cursors (default true; set false on high-concurrency projects)
|
|
690
|
-
presence: true, // online-users list (default true)
|
|
691
|
-
maxRenderedCursors: 24, // cap on distinct remote cursors rendered at once
|
|
692
|
-
},
|
|
693
|
-
}
|
|
188
|
+
```sh
|
|
189
|
+
claude mcp add --transport http commentkit https://commentkit.dev/mcp
|
|
694
190
|
```
|
|
695
191
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
After authentication, the SDK retrieves the actual team members, roles, storage usage and saved branches from the backend. The panel's **All** tab spans project pages; **Page** filters loaded threads to the current path. Use **Load more comments** to retrieve additional records. Shared links retrieve their target even when it is not in the first page.
|
|
699
|
-
|
|
700
|
-
`core.setBranch("preview")` filters that branch and tags new comments. `core.setBranch(null)` shows all branches. `core.reloadProjectContext()` refreshes members and usage. These APIs require the backend upgrade described below; old untagged records stay visible under All branches. `core.reloadComments()` refreshes the first page of the active branch, while `loadMoreComments()` appends the next page.
|
|
701
|
-
|
|
702
|
-
The production composer uploads files before saving, reuses completed uploads when a save is retried, and sends description, checklist, assignee, mention and device context with the record. Reply quotes and reactions persist on the corresponding message. `ReplyOptions`, `ReplyTarget`, `CommentCreateOptions`, `CommentDeviceInfo` and `ProjectContext` are available from the headless entry.
|
|
703
|
-
|
|
704
|
-
### Realtime at scale
|
|
192
|
+
Or run the server on your computer: create an agent token in **Project → Developers**, then add it to your agent:
|
|
705
193
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
To disable in production:
|
|
717
|
-
|
|
718
|
-
```tsx
|
|
719
|
-
<CommentKit apiKey="your-api-key" enabled={process.env.NODE_ENV !== "production"} />
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"mcpServers": {
|
|
197
|
+
"commentkit": {
|
|
198
|
+
"command": "npx",
|
|
199
|
+
"args": ["-y", "comment-kit-mcp"],
|
|
200
|
+
"env": { "COMMENT_KIT_PROJECT_ID": "123", "COMMENT_KIT_ACCESS_TOKEN": "…" }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
720
204
|
```
|
|
721
205
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
## Privacy & Security
|
|
725
|
-
|
|
726
|
-
CommentKit is designed for production integration, but it runs with your page's JavaScript privileges. No embedded SDK can guarantee immunity from compromise. Review the [production host hardening guidance](./SECURITY.md#hardening-guidance-for-hosts), pin the reviewed package version, and verify your site's integration before enabling it for customers.
|
|
727
|
-
|
|
728
|
-
| Concern | How CommentKit handles it |
|
|
729
|
-
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
730
|
-
| **No telemetry** | The SDK sends no analytics or tracking events. Submitted feedback includes its author, page, content, attachments and optional browser/OS/viewport context. |
|
|
731
|
-
| **Network requests** | API calls use `api.commentkit.dev` by default or your configured `baseUrl`; realtime connects to the host returned by project configuration. Displayed attachments and avatars load their supplied URLs. Google Fonts is contacted only when you opt in via `ui.loadRemoteFonts: true`. |
|
|
732
|
-
| **No install scripts** | This package declares no `preinstall`, `install` or `postinstall` hooks. Build and publication checks are separate maintainer scripts. |
|
|
733
|
-
| **No dynamic code execution** | Zero `eval()`, `new Function()`, `innerHTML`, or `document.write`. |
|
|
734
|
-
| **Shadow DOM isolation** | Widget styles are scoped inside Shadow DOM. Annotation, element capture and screenshots intentionally inspect the host page to attach feedback; host permissions and browser restrictions still apply. |
|
|
735
|
-
| **Source maps disabled** | No `.map` files ship. No `sourceMappingURL` in built files. |
|
|
736
|
-
| **OTP authentication** | All commenters verify via email OTP; accounts with two-factor authentication also confirm an authenticator or recovery code before a session is issued. No passwords stored. |
|
|
737
|
-
| **Session persistence** | Sanctum Bearer token is kept in **sessionStorage** (tab-scoped) so in-tab refresh keeps auth and the offline queue can drain. Closing the tab clears the session; logout / auth-expiry also clear the offline queue. Prefer Bearer over `X-User-Email` (spoofable). |
|
|
738
|
-
| **Origin allowlist** | Browser requests must match the project's `allowed_domains` (wildcards like `*.example.com` supported). Empty allowlists deny browser traffic unless the backend enables `COMMENTKIT_ALLOW_EMPTY_ALLOWED_DOMAINS`. Server/MCP clients may omit `Origin`. |
|
|
739
|
-
| **Stored data** | Authenticated comments store author identity, feedback and submitted context. The SDK uses tab-scoped session storage and a bounded local retry queue; the private demo uses a separate expiring browser store. |
|
|
740
|
-
|
|
741
|
-
The retry queue uses project-scoped `localStorage` and binds each mutation to its authenticated user. It can outlive a tab; replay requires the same user to sign in again. Logout and expired sessions clear it. Browser storage is best-effort, and raw file uploads are not persisted for offline replay. Observe offline events to distinguish queued feedback from feedback saved on the server.
|
|
206
|
+
Agents can list, search and read feedback and dashboard tasks (including the screenshot, by id or `CK-12`). With the permissions you choose, they can reply, link the commit and mark a task **ready for review**; by default a person approves each of these first (Agent requests). The reviewer then checks and resolves it. Agents never resolve, assign or delete. See [`mcp/README.md`](mcp/README.md).
|
|
742
207
|
|
|
743
|
-
|
|
208
|
+
## Terminal and build tools
|
|
744
209
|
|
|
745
|
-
|
|
210
|
+
- [`@commentkit/cli`](cli/README.md): `commentkit login` (a short code confirmed in the browser), `init` (adds the key, the build plugin and `.gitignore` entry), `pull` (open feedback to `.commentkit/feedback.md` for any agent), `open CK-12`, and tokens for CI.
|
|
211
|
+
- [`@commentkit/build`](build/README.md): Vite, Next.js, webpack and Astro plugins that tag elements with their source file and line in development, and record the branch and commit. On localhost the widget then shows this branch's feedback first, with "All branches" one click away.
|
|
746
212
|
|
|
747
|
-
|
|
748
|
-
- Auth: `X-API-Key` on every route; user identity via `Authorization: Bearer` (Sanctum ability `sdk`). Prefer Bearer over `X-User-Email` (only honored when `COMMENTKIT_ALLOW_EMAIL_AUTH=true`).
|
|
749
|
-
- Attachments: upload drafts to `POST .../files`, then pass `attachment_ids` on comment/reply create or update. Direct uploads may target an authorized `comment_id` or `reply_id`. Unlinked drafts do not appear on comments.
|
|
750
|
-
- MCP comment reads may use API key only when `COMMENTKIT_MACHINE_READ_ENABLED` is on; mutations still need Bearer.
|
|
751
|
-
- Realtime: bind `comment_completed` separately from `comment_updated`.
|
|
213
|
+
## Privacy and security
|
|
752
214
|
|
|
753
|
-
|
|
215
|
+
- The project key (`pk_…`) only identifies a project. Everything is authorised on the server: the widget only works on the websites you list, sessions are bound to that website, and reviewers only see projects they were invited to.
|
|
216
|
+
- The widget runs in a Shadow DOM, adds one element to your page, needs no `unsafe-eval`, and removes itself completely on `destroy()`.
|
|
217
|
+
- Trusted Types: the widget works under `require-trusted-types-for 'script'`. The screenshot engine writes two fixed strings through one narrowly named policy, `commentkit-capture`, that accepts nothing else; no default policy is created. If your CSP limits policy names with `trusted-types`, add `commentkit-capture` (without it, screenshots are skipped and everything else works).
|
|
218
|
+
- Console and network capture are off unless the project turns them on, and then each reviewer chooses per comment ("Include browser errors to help the developer"). Only metadata is kept (message; or method, URL, status, timing for `fetch` and `XMLHttpRequest`), never bodies or headers, and credential-looking values are removed from URLs and text by name and by value. "Copy for AI agent" removes them too.
|
|
219
|
+
- Feedback text is rendered as plain text with safe links only. Agent output marks feedback as untrusted.
|
|
220
|
+
- See [SECURITY.md](SECURITY.md) for hardening guidance and how to report a vulnerability.
|
|
754
221
|
|
|
755
|
-
|
|
222
|
+
## Size
|
|
756
223
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
224
|
+
| Loaded | Gzip |
|
|
225
|
+
| --- | --- |
|
|
226
|
+
| Script-tag loader (every page) | ~0.6 KB |
|
|
227
|
+
| Widget when activated (incl. Preact) | ~31 KB |
|
|
228
|
+
| Screenshot engine (only while commenting) | ~51 KB |
|
|
229
|
+
| Realtime (signed-in people only) | ~21 KB |
|
|
761
230
|
|
|
762
|
-
|
|
231
|
+
## Versioning and support
|
|
763
232
|
|
|
764
|
-
|
|
233
|
+
CommentKit follows [semantic versioning](https://semver.org): a patch fixes bugs, a minor adds options or features without breaking anything, and only a new major version may remove or change behaviour. `init()` options, the instance API, events, `data-*` attributes, the custom element and the adapters are the public API. The look of the widget and its wording can improve in any release.
|
|
765
234
|
|
|
766
|
-
|
|
235
|
+
**Script tag channels**
|
|
767
236
|
|
|
768
|
-
|
|
237
|
+
| Address | What you get |
|
|
238
|
+
| --- | --- |
|
|
239
|
+
| `https://commentkit.dev/cdn/v1/loader.js` | Moving channel: always the latest 1.x release, with fixes and new features as soon as they ship. Recommended for most sites. |
|
|
240
|
+
| `https://commentkit.dev/cdn/<version>/loader.js` (for example `/cdn/1.2.3/`) | Pinned: that exact release, never changed after it is published. |
|
|
769
241
|
|
|
770
|
-
|
|
242
|
+
To pin, use the exact version and its Subresource Integrity hash, so the browser refuses the file if it ever differs. The hashes for every published version are in `https://commentkit.dev/cdn/integrity.json` (served from `public/cdn/integrity.json` in the backend):
|
|
771
243
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
The widget runs in the host page's JavaScript context. Shadow DOM isolates **styles**, not JS — an XSS vulnerability on the host page can access the widget's session, and a compromised trusted dependency can affect its host. Use a reviewed, pinned release, a strict script CSP, and SRI where applicable to external scripts. Test CSP compatibility in staging: the widget uses inline style elements and attributes, so a nonce-only style policy is not currently a verified integration. Never enable `unsafe-eval` or weaken script policy to fix widget styling.
|
|
777
|
-
|
|
778
|
-
### Reporting vulnerabilities
|
|
779
|
-
|
|
780
|
-
See [SECURITY.md](./SECURITY.md) for how to report security issues and our supported-versions policy.
|
|
781
|
-
|
|
782
|
-
---
|
|
783
|
-
|
|
784
|
-
## Bundle Size
|
|
785
|
-
|
|
786
|
-
The shared ESM build stores common engine, UI, and styles once across all framework adapters. A small activation shell loads first; the full widget and its styles load when a visible surface is requested. Drawing, screenshot selection/annotation, element grabs, developer export, and the image lightbox load when used. Access rules, restored sessions, invites, and explicit tool requests still determine when the UI appears.
|
|
787
|
-
|
|
788
|
-
Measured from the current development build on 2026-10-16; KB below means 1,000 bytes:
|
|
789
|
-
|
|
790
|
-
| Measurement | Before | Current |
|
|
791
|
-
| ----------------------------------------------------- | -------: | -------: |
|
|
792
|
-
| React initial SDK code, gzip | 262.8 KB | 42.2 KB |
|
|
793
|
-
| React through first widget open, cumulative gzip | — | 306.3 KB |
|
|
794
|
-
| React with every reachable optional chunk, gzip | 289.3 KB | 368.1 KB |
|
|
795
|
-
| Compressed npm archive, all adapters and declarations | 2.33 MB | 432.9 KB |
|
|
796
|
-
|
|
797
|
-
These are different measurements. Browser estimates sum each SDK chunk compressed with gzip level 9 and exclude React, ReactDOM, framework peers, `html2canvas`, and `element-source`. First-open size includes the initial code; it is not an additional 306.3 KB. The npm archive includes every adapter and is not a browser download. Host bundling, caching, and enabled realtime features affect actual requests. Archive size is approximate and changes with included documentation.
|
|
798
|
-
|
|
799
|
-
The initial React load is smaller because work is deferred; the complete optional feature set has not been removed. All 46 retained primitive families remain available; the main product screens now use their audited compositions. Contributors with repository access can read the [full port audit](https://github.com/commentkit/comment-kit/blob/main/docs/ui-full-port-audit.md) and [performance baseline](https://github.com/commentkit/comment-kit/blob/main/docs/package-performance-audit.md) for verification, limitations and reproduction commands. `npm run build` enforces the package and load-stage size budgets.
|
|
244
|
+
```html
|
|
245
|
+
<script src="https://commentkit.dev/cdn/1.2.3/loader.js" integrity="sha384-…" crossorigin="anonymous" data-project="pk_live_your_key" defer></script>
|
|
246
|
+
```
|
|
800
247
|
|
|
801
|
-
|
|
248
|
+
The loader then loads the rest of the widget from the same pinned folder, which is immutable. A pinned version gets no fixes: move to a newer one on purpose, and check its changelog first.
|
|
802
249
|
|
|
803
|
-
|
|
250
|
+
**npm**: from 1.0.0, `npm install @commentkit/comment-kit@^1` follows 1.x the same way as `/cdn/v1`; use an exact version (`--save-exact`) and your lockfile to pin. Prereleases are published under the `beta` tag and are never installed by `^1`; until 1.0.0 ships, use `@beta`.
|
|
804
251
|
|
|
805
|
-
|
|
806
|
-
| ------------- | --------------------------------------------------------------------------- |
|
|
807
|
-
| Language | TypeScript (strict mode) |
|
|
808
|
-
| UI Framework | React 18+ peers; developed with React 19 and Base UI 1.9 primitives |
|
|
809
|
-
| CSS Isolation | Shadow DOM with scoped CSS custom properties |
|
|
810
|
-
| Real-Time | Pusher.js / Laravel Reverb (WebSocket) |
|
|
811
|
-
| Bundler | Vite+ (Rolldown) |
|
|
812
|
-
| Testing | Vitest 5 with standard V8 coverage + Playwright browser and consumer checks |
|
|
813
|
-
| Linting | OXC (oxlint) |
|
|
814
|
-
| Formatting | OXC (oxfmt) |
|
|
252
|
+
**Support window**: each major version gets security fixes for 24 months after the next major version is released, and bug fixes until then. The end date of each major is announced in the [changelog](CHANGELOG.md) when its successor ships. Security fixes land in the latest minor of every supported major, so the moving channel and `^` ranges receive them automatically; pinned versions do not. See [SECURITY.md](SECURITY.md) to report a vulnerability.
|
|
815
253
|
|
|
816
|
-
|
|
254
|
+
## Development
|
|
817
255
|
|
|
818
|
-
|
|
256
|
+
```bash
|
|
257
|
+
npm ci
|
|
258
|
+
npm run typecheck
|
|
259
|
+
npm test # unit tests (Vitest)
|
|
260
|
+
npm run build # npm + CDN bundles, public types, size budgets
|
|
261
|
+
npm run test:e2e # Playwright: Chromium, Firefox, WebKit
|
|
262
|
+
npm run test:visual # screenshot tests of the main widget states (Chromium; baselines recorded on macOS)
|
|
263
|
+
npm run test:host-matrix # packed SDK in Next.js, Nuxt, SvelteKit, Angular, Astro, React Router, HTML, WordPress (slow)
|
|
264
|
+
semgrep scan --config .semgrep.yml --error src # security rules for the widget (brew install semgrep)
|
|
265
|
+
npm run ci # every gate; HOST_MATRIX=1 npm run ci adds the host matrix
|
|
266
|
+
```
|
|
819
267
|
|
|
820
|
-
|
|
268
|
+
Locally Playwright reuses an e2e server already running on port 5190; when several checkouts (git worktrees) test at once, give each its own with `CK_E2E_PORT=5291 npm run test:e2e`. Screenshot baselines live in `e2e/specs/visual.spec.ts-snapshots/`. After an intended visual change, update them with `npx playwright test e2e/specs/visual.spec.ts --project=chromium --update-snapshots` and review the new images before committing. The host matrix (`scripts/host-matrix.mjs`) installs the `npm pack` tarball into each app in `e2e/host-matrix/`, builds it for production and checks that the widget mounts once on localhost with no console errors, and that single-page apps destroy it on a route without it. Pass app names to run some of them (`npm run test:host-matrix -- next astro`); WordPress needs `php` on the PATH and is skipped without it.
|
|
821
269
|
|
|
822
|
-
The
|
|
270
|
+
The architecture and roadmap live in [ARCHITECTURE-BLUEPRINT.md](ARCHITECTURE-BLUEPRINT.md) and [TASKS.md](TASKS.md).
|
|
823
271
|
|
|
824
|
-
|
|
272
|
+
## Releasing
|
|
825
273
|
|
|
826
|
-
|
|
274
|
+
Versions and changelogs are managed with [Changesets](https://github.com/changesets/changesets) for the four published packages: `@commentkit/comment-kit` (this folder), `comment-kit-mcp` (`mcp/`), `@commentkit/cli` (`cli/`) and `@commentkit/build` (`build/`). The browser extension, the Zapier app and the Make app are private and never versioned this way. There are no npm workspaces: each package keeps its own lockfile, and `lerna.json` only tells Changesets where the packages are.
|
|
827
275
|
|
|
828
|
-
|
|
276
|
+
1. With every change that people using a package will notice, add a changeset: `npm run changeset`. Pick the packages, the bump (patch, minor or major, see Versioning above) and write one plain sentence for the changelog. Commit the file in `.changeset/` with the change.
|
|
277
|
+
2. To prepare a release, run `npm run release:status` to see what will be bumped, then `npm run version`. It applies the bumps to each `package.json` and writes the changelogs. Review the diff, update each package's lockfile (`npm install --package-lock-only` in that folder), and commit.
|
|
278
|
+
3. While 1.x is in beta, run `npx changeset pre enter beta` once first, so versions come out as `1.0.0-beta.N` instead of jumping to `1.0.0`; `npx changeset pre exit` before the stable release.
|
|
279
|
+
4. Publishing stays manual and needs the owner's go-ahead each time: in each package folder, `npm run check` (or that package's gates) and `node scripts/check-pack.mjs`, then `npm publish`. Do not run `changeset publish`.
|
|
829
280
|
|
|
830
|
-
The
|
|
281
|
+
5. The CDN widget rolls out gradually. In the backend, `scripts/sync-sdk.sh` writes the pinned `public/cdn/<version>/` folder (with SRI hashes); deploy it, then `php artisan cdn:canary <version> --percent=1`, later `10` and `100`. The `/cdn/v1/` loader asks `/api/v1/widget/channel` which version to load, so a change takes effect within a minute. Widget crashes are counted per version, and the canary is rolled back automatically when it crashes in more than 1% of loads or three times as often as stable (`cdn:canary --status`, `--rollback` by hand). When it has held at 100%, sync it into `/cdn/v1/` (the stable files), deploy, and `cdn:canary --clear`.
|
|
831
282
|
|
|
832
|
-
|
|
283
|
+
`npm run version` is also npm's lifecycle hook for `npm version`, so `npm version` in this folder runs Changesets too; use the steps above instead of `npm version`.
|
|
833
284
|
|
|
834
285
|
## License
|
|
835
286
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
---
|
|
839
|
-
|
|
840
|
-
## Links
|
|
841
|
-
|
|
842
|
-
- [Developer guide](https://commentkit.dev/developers)
|
|
843
|
-
- [Sign in](https://commentkit.dev/auth/otp)
|
|
844
|
-
- [Changelog](./CHANGELOG.md)
|
|
845
|
-
- [GitHub (private contributor repository)](https://github.com/commentkit/comment-kit)
|
|
846
|
-
- [npm](https://www.npmjs.com/package/@commentkit/comment-kit)
|
|
847
|
-
- [Twitter / X](https://x.com/commentkit)
|
|
287
|
+
Proprietary. See [LICENSE](LICENSE).
|