@commentkit/comment-kit 1.6.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +281 -597
  2. package/README.md +334 -154
  3. package/SECURITY.md +47 -46
  4. package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
  5. package/dist/node/browser.js +17 -0
  6. package/dist/node/cli/api.js +226 -0
  7. package/dist/node/cli/bin.js +18 -0
  8. package/dist/node/cli/credentials.js +268 -0
  9. package/dist/node/cli/doctor.js +725 -0
  10. package/dist/node/cli/format.js +54 -0
  11. package/dist/node/cli/init.js +372 -0
  12. package/dist/node/cli/main.js +519 -0
  13. package/dist/node/cli/mcp.js +114 -0
  14. package/dist/node/cli/open.js +20 -0
  15. package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
  16. package/dist/node/plugins/astro.js +26 -0
  17. package/dist/node/plugins/git-BIXLbL3f.js +92 -0
  18. package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
  19. package/dist/node/plugins/next.js +48 -0
  20. package/dist/node/plugins/options-THop1K92.js +71 -0
  21. package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
  22. package/dist/node/plugins/vite-BdAYUW10.js +74 -0
  23. package/dist/node/plugins/vite.js +1 -0
  24. package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
  25. package/dist/node/plugins/webpack-loader.cjs +21 -0
  26. package/dist/node/plugins/webpack-loader.js +18 -0
  27. package/dist/node/plugins/webpack.js +1 -0
  28. package/dist/node/shared/endpoint.js +26 -0
  29. package/dist/node/shared/format.js +63 -0
  30. package/dist/node/types/astro.d.ts +11 -0
  31. package/dist/node/types/next.d.ts +34 -0
  32. package/dist/node/types/options.d.ts +59 -0
  33. package/dist/node/types/vite.d.ts +11 -0
  34. package/dist/node/types/webpack-loader.d.ts +22 -0
  35. package/dist/node/types/webpack.d.ts +27 -0
  36. package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
  37. package/dist/npm/chunks/AgentSend-DxRJIYiz.js +68 -0
  38. package/dist/npm/chunks/Checklist-CnlfeSbc.js +282 -0
  39. package/dist/npm/chunks/Composer-B1bBVszY.js +725 -0
  40. package/dist/npm/chunks/Guest-vvNPz8h-.js +267 -0
  41. package/dist/npm/chunks/MarkupEditor-VCOXh9d2.js +338 -0
  42. package/dist/npm/chunks/Panel-F37vIL1K.js +1206 -0
  43. package/dist/npm/chunks/Settings-BGoZS2iV.js +231 -0
  44. package/dist/npm/chunks/Shortcuts-B2OMvczr.js +62 -0
  45. package/dist/npm/chunks/StyleEditor-CJ_d8Huf.js +46 -0
  46. package/dist/npm/chunks/StylePanel-yQzHHlY7.js +199 -0
  47. package/dist/npm/chunks/TaskFields-fmy6_HtK.js +289 -0
  48. package/dist/npm/chunks/ThreadCard-D51slKST.js +1113 -0
  49. package/dist/npm/chunks/Viewer-BOBadqmC.js +111 -0
  50. package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-C1OQzBAm.js} +9 -9
  51. package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
  52. package/dist/npm/chunks/{ar-8tPch6W4.js → ar-CAJ3XT8e.js} +69 -19
  53. package/dist/npm/chunks/card-bits-CAnzrqx3.js +53 -0
  54. package/dist/npm/chunks/{client-EFTWxHbJ.js → client-kNAo2TTG.js} +282 -290
  55. package/dist/npm/chunks/confetti-CkBdSu19.js +49 -0
  56. package/dist/npm/chunks/context-B8UAzve0.js +20 -0
  57. package/dist/npm/chunks/context-BuMl7A07.js +48 -0
  58. package/dist/npm/chunks/{de-C63897uD.js → de-Dl18G48t.js} +60 -18
  59. package/dist/npm/chunks/dialog-GO04oC3D.js +3 -0
  60. package/dist/npm/chunks/dpop-U48QIQd7.js +96 -0
  61. package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
  62. package/dist/npm/chunks/{es-CI2bSpvB.js → es-Dxk79lS9.js} +60 -18
  63. package/dist/npm/chunks/extension-CKFpPWmi.js +62 -0
  64. package/dist/npm/chunks/{extension-BST6LH1q.js → extension-E81hWyiT.js} +20 -12
  65. package/dist/npm/chunks/files-DyD5BZgp.js +114 -0
  66. package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-8BebGKYD.js} +118 -76
  67. package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-BIN6Yy_p.js} +61 -19
  68. package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-DOBt8e9U.js} +91 -56
  69. package/dist/npm/chunks/identify-CN-3xzqL.js +106 -0
  70. package/dist/npm/chunks/{it-C8tnV0BF.js → it-Cr6EwpPQ.js} +79 -37
  71. package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-Iy3s5aur.js} +58 -16
  72. package/dist/npm/chunks/late-words-B2bmZceJ.js +12 -0
  73. package/dist/npm/chunks/live-CelVeZfP.js +85 -0
  74. package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
  75. package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-B84WHqqe.js} +61 -19
  76. package/dist/npm/chunks/page-key-DepmJzC1.js +62 -0
  77. package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-yTyqtxN0.js} +45 -44
  78. package/dist/npm/chunks/pkce-ChKGSW_4.js +8 -0
  79. package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
  80. package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
  81. package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-DOkdlfoe.js} +60 -18
  82. package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
  83. package/dist/npm/chunks/report-CrIqQZDI.js +44 -0
  84. package/dist/npm/chunks/show-BgVC8gWY.js +97 -0
  85. package/dist/npm/chunks/signin-Dd1rb2BP.js +75 -0
  86. package/dist/npm/chunks/{source-CS7C6wJA.js → source-pXVve2Cx.js} +1 -1
  87. package/dist/npm/chunks/src-BTMy4Gyc.js +208 -0
  88. package/dist/npm/chunks/start-DtVlpt7p.js +1878 -0
  89. package/dist/npm/chunks/states-sfTbjZz8.js +3 -0
  90. package/dist/npm/chunks/upload-MgPYqPyE.js +42 -0
  91. package/dist/npm/chunks/uploads-D49mywwz.js +1146 -0
  92. package/dist/npm/chunks/wrap-Bl0gbnFa.js +69 -0
  93. package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-Z5fQCb7G.js} +59 -17
  94. package/dist/npm/element.js +58 -21
  95. package/dist/npm/headless.js +7 -3
  96. package/dist/npm/index.js +3 -3
  97. package/dist/npm/react.js +18 -11
  98. package/dist/npm/svelte.js +28 -12
  99. package/dist/npm/types/adapters/react.d.ts +4 -1
  100. package/dist/npm/types/adapters/svelte.d.ts +4 -1
  101. package/dist/npm/types/adapters/vue.d.ts +35 -2
  102. package/dist/npm/types/anchor/index.d.ts +19 -0
  103. package/dist/npm/types/capture/privacy.d.ts +14 -0
  104. package/dist/npm/types/core/api.d.ts +20 -1
  105. package/dist/npm/types/core/auth.d.ts +40 -21
  106. package/dist/npm/types/core/client.d.ts +60 -4
  107. package/dist/npm/types/core/page-key.d.ts +42 -0
  108. package/dist/npm/types/core/types.d.ts +87 -4
  109. package/dist/npm/types/element.d.ts +17 -7
  110. package/dist/npm/types/headless.d.ts +2 -1
  111. package/dist/npm/types/index.d.ts +16 -6
  112. package/dist/npm/vue.js +44 -9
  113. package/package.json +88 -14
  114. package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
  115. package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
  116. package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
  117. package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
  118. package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
  119. package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
  120. package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
  121. package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
  122. package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
  123. package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
  124. package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
  125. package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
  126. package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
  127. package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
  128. package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
  129. package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
  130. package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
  131. package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
  132. package/dist/npm/chunks/report-BBrT3r89.js +0 -27
  133. package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
  134. package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
  135. package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
  136. package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
@@ -0,0 +1,74 @@
1
+ import { n as e, t } from "./git-BIXLbL3f.js";
2
+ import { a as n, c as r, r as i } from "./options-THop1K92.js";
3
+ import { t as a } from "./transform-CKiAuSbk.js";
4
+ import { resolve as o } from "node:path";
5
+ var s = /^pk_(live|test)_[a-z0-9]{20,40}$/;
6
+ function c(e, t) {
7
+ if (!e) return null;
8
+ if (!e.project || !s.test(e.project)) return console.warn("[CommentKit] inject.project must be your publishable key (pk_test_… or pk_live_…). The widget was not added."), null;
9
+ let n = e.src ?? "https://commentkit.dev/cdn/v1/loader.js";
10
+ if (!/^https?:\/\//.test(n)) return console.warn("[CommentKit] inject.src must be an http(s) URL. The widget was not added."), null;
11
+ let r = { "data-project": e.project };
12
+ return e.endpoint && (r["data-endpoint"] = e.endpoint), t.branch && (r["data-branch"] = t.branch), t.commit && (r["data-commit"] = t.commit), {
13
+ src: n,
14
+ attrs: r
15
+ };
16
+ }
17
+ function l(e) {
18
+ return [
19
+ "if (!document.querySelector(\"script[data-commentkit-loader]\")) {",
20
+ " const s = document.createElement(\"script\");",
21
+ ` s.src = ${JSON.stringify(e.src)};`,
22
+ " s.defer = true;",
23
+ " s.setAttribute(\"data-commentkit-loader\", \"\");",
24
+ ...Object.entries(e.attrs).map(([e, t]) => ` s.setAttribute(${JSON.stringify(e)}, ${JSON.stringify(t)});`),
25
+ " document.head.appendChild(s);",
26
+ "}"
27
+ ].join("\n");
28
+ }
29
+ // plugins/vite.ts
30
+ function u(e) {
31
+ let t = e.indexOf("?");
32
+ return t === -1 || /^(?:[tv]=[\w.-]*&?)+$/.test(e.slice(t + 1));
33
+ }
34
+ function d(s = {}) {
35
+ let l = process.cwd(), d = !1, f = !1, p = () => !1, m = {
36
+ branch: null,
37
+ commit: null
38
+ };
39
+ return {
40
+ name: "commentkit",
41
+ enforce: "pre",
42
+ config(r, i) {
43
+ if (!n(s.buildInfo, i.command === "serve" || i.mode !== "production")) return;
44
+ let a = o(r.root ?? process.cwd(), s.root ?? ".");
45
+ return m = e({ cwd: a }), { define: t(m) };
46
+ },
47
+ configResolved(e) {
48
+ l = s.root ? o(e.root, s.root) : e.root, f = e.command === "serve", d = r(s.source, f || e.mode !== "production"), p = i(l, s.include, s.exclude);
49
+ },
50
+ transform: {
51
+ order: "pre",
52
+ async handler(e, t) {
53
+ return !d || !u(t) || !p(t) ? null : a(e, t, { root: l });
54
+ }
55
+ },
56
+ transformIndexHtml: {
57
+ order: "pre",
58
+ handler() {
59
+ if (!f || !s.inject) return;
60
+ let e = c(s.inject, m);
61
+ if (e) return [{
62
+ tag: "script",
63
+ attrs: {
64
+ src: e.src,
65
+ ...e.attrs,
66
+ defer: !0
67
+ },
68
+ injectTo: "head"
69
+ }];
70
+ }
71
+ }
72
+ };
73
+ }
74
+ export { l as n, c as r, d as t };
@@ -0,0 +1 @@
1
+ export { t as commentkit, t as default } from "./vite-BdAYUW10.js";
@@ -0,0 +1,35 @@
1
+ import { n as e, t } from "./git-BIXLbL3f.js";
2
+ import { a as n, c as r, s as i, t as a } from "./options-THop1K92.js";
3
+ import { resolve as o } from "node:path";
4
+ import { fileURLToPath as s } from "node:url";
5
+ // plugins/loader-path.ts
6
+ function c() {
7
+ return s(new URL("./webpack-loader.cjs", import.meta.url));
8
+ }
9
+ // plugins/webpack.ts
10
+ function l(e, t = {}) {
11
+ let n = { root: e }, r = i(t.include), a = i(t.exclude);
12
+ return r && (n.include = r), a && (n.exclude = a), n;
13
+ }
14
+ function u(e, t = {}) {
15
+ return {
16
+ test: a,
17
+ exclude: /[\\/]node_modules[\\/]/,
18
+ enforce: "pre",
19
+ use: [{
20
+ loader: c(),
21
+ options: l(e, t)
22
+ }]
23
+ };
24
+ }
25
+ var d = class {
26
+ options;
27
+ constructor(e = {}) {
28
+ this.options = e;
29
+ }
30
+ apply(i) {
31
+ let a = i.options.context ?? process.cwd(), s = this.options.root ? o(a, this.options.root) : a, c = i.options.mode === "development";
32
+ n(this.options.buildInfo, c) && new i.webpack.DefinePlugin(t(e({ cwd: s }))).apply(i), r(this.options.source, c) && (i.options.module ??= {}, i.options.module.rules ??= [], i.options.module.rules.unshift(u(s, this.options)));
33
+ }
34
+ };
35
+ export { c as i, l as n, u as r, d as t };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // CommonJS entry for webpack and Turbopack. The implementation is ESM (webpack-loader.js next to this file).
3
+ let impl;
4
+ let warned = false;
5
+ module.exports = function commentkitLoader(source, map, meta) {
6
+ const callback = this.async();
7
+ (impl ??= import("./webpack-loader.js")).then(
8
+ (mod) => mod.default.call(this, source, map, meta, callback),
9
+ (error) => {
10
+ if (!warned) {
11
+ warned = true;
12
+ console.warn(
13
+ `[CommentKit] Could not load the source loader (${String((error && error.message) || error).split("\n", 1)[0]}), ` +
14
+ "so elements have no data-ck-src. Reinstall @commentkit/comment-kit (its dist/node/plugins/webpack-loader.js may be missing) " +
15
+ "and check that Node is 22.18 or 24.11 or newer. The build itself is not affected.",
16
+ );
17
+ }
18
+ callback(null, source, map, meta);
19
+ },
20
+ );
21
+ };
@@ -0,0 +1,18 @@
1
+ import { i as e, n as t, o as n, r } from "./options-THop1K92.js";
2
+ import { t as i } from "./transform-CKiAuSbk.js";
3
+ // plugins/webpack-loader.ts
4
+ function a(a, o, s, c) {
5
+ let l = () => c(null, a, o, s);
6
+ try {
7
+ let o = (typeof this.getOptions == "function" ? this.getOptions() : this.query) ?? {}, u = o.root ?? this.rootContext ?? process.cwd();
8
+ if (this.resourceQuery || !r(u, e(o.include), e(o.exclude))(this.resourcePath)) return l();
9
+ i(String(a), this.resourcePath, { root: u }).then((e) => {
10
+ if (!e) return l();
11
+ let r = JSON.parse(e.map.toString()), i = n(u, t(this.resourcePath));
12
+ i && (r.sources = [i]), c(null, e.code, r, s);
13
+ }, l);
14
+ } catch {
15
+ l();
16
+ }
17
+ }
18
+ export { a as default };
@@ -0,0 +1 @@
1
+ export { t as CommentKitWebpackPlugin, t as default, n as loaderOptions, r as sourceRule } from "./webpack-R2U2DLlY.js";
@@ -0,0 +1,26 @@
1
+ // Shared by the CLI (cli/api.ts: endpointFrom) and the MCP server (mcp/src/api-client.ts: validateBaseUrl,
2
+ // copied into comment-kit-mcp at build time): which CommentKit server addresses are accepted. Both test
3
+ // suites check mcp/test/fixtures/endpoints.json. Each package words its own errors. No imports.
4
+ /** This computer only. `.test` names can resolve anywhere, so they need https like any other host. */
5
+ export function isLoopback(hostname) {
6
+ const name = hostname.toLowerCase();
7
+ return ["localhost", "127.0.0.1", "::1", "[::1]"].includes(name) || name.endsWith(".localhost");
8
+ }
9
+ /**
10
+ * https only (http for this computer), no credentials, query or fragment. A trailing /api or /api/v1 is
11
+ * dropped, so the result is the server's base address.
12
+ */
13
+ export function checkEndpoint(raw) {
14
+ let url;
15
+ try {
16
+ url = new URL(raw);
17
+ }
18
+ catch {
19
+ return { problem: "invalid" };
20
+ }
21
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && isLoopback(url.hostname)))
22
+ return { problem: "insecure" };
23
+ if (url.username || url.password || url.search || url.hash)
24
+ return { problem: "extras" };
25
+ return { url: `${url.origin}${url.pathname}`.replace(/\/+$/, "").replace(/\/api(\/v1)?$/i, "").replace(/\/+$/, "") };
26
+ }
@@ -0,0 +1,63 @@
1
+ // Shared by the CLI (cli/format.ts, built into @commentkit/comment-kit) and the MCP server (mcp/src/format.ts,
2
+ // copied into comment-kit-mcp at build time by mcp/scripts/copy-shared.mjs): how text other people wrote is
3
+ // fenced, shortened and redacted before a coding agent reads it. Both test suites check
4
+ // mcp/test/fixtures/format-golden.json. No imports: this file must build on its own in either package.
5
+ const SECRET_PARAM = /(token|key|secret|password|passwd|auth|session|code|otp|signature|sig|ck_)/i;
6
+ /** Zero-width and bidi control characters, which could hide or disguise a fence tag. */
7
+ const INVISIBLE = /[​-‏‪-‮⁠-⁤]/g;
8
+ /** Any spelling of the fence tag: spaces, case, extra text inside the brackets. */
9
+ const FENCE_TAG = /<\s*\/?\s*untrusted[^>]*>/gi;
10
+ const OPEN = "<untrusted-user-content>";
11
+ const CLOSE = "</untrusted-user-content>";
12
+ /** Text someone else wrote, made unable to open or close a fence (look-alikes folded by NFKC). */
13
+ export function neutralize(text) {
14
+ return text.normalize("NFKC").replace(INVISIBLE, "").replace(FENCE_TAG, "[fence]");
15
+ }
16
+ /** Keep fences intact even if someone types them into a comment. */
17
+ export function fence(text, max = 4000) {
18
+ return `${OPEN}\n${neutralize(text).slice(0, max)}\n${CLOSE}`;
19
+ }
20
+ /** A one-line value someone else wrote (page title, selector, a name): it can never start a new line or close a fence. */
21
+ export function field(text, max = 160) {
22
+ const t = neutralize(String(text ?? "")).replace(/\s+/g, " ").trim();
23
+ return t.length > max ? `${t.slice(0, max - 1)}…` : t;
24
+ }
25
+ /**
26
+ * A source location as the file is named on disk. The build plugin percent-encodes characters outside
27
+ * a plain set (spaces, %, :, ;, quotes, non-ASCII) in data-ck-src; an agent must look for the real name.
28
+ * The widget's "copy for agent" decodes the same way (src/ui/agent.ts).
29
+ */
30
+ export function sourcePath(raw) {
31
+ const text = typeof raw === "string" ? raw : "";
32
+ try {
33
+ return decodeURIComponent(text);
34
+ }
35
+ catch {
36
+ return text;
37
+ }
38
+ }
39
+ /** Status and priority are short words from a fixed list; anything else is shown as "?". */
40
+ export function word(value) {
41
+ return typeof value === "string" && /^[a-z_]{1,20}$/.test(value) ? value.replace(/_/g, " ") : "?";
42
+ }
43
+ /** Page URL with credential-like query values removed; hash routes (#/path) kept. */
44
+ export function safeUrl(raw) {
45
+ if (!raw)
46
+ return "";
47
+ try {
48
+ const url = new URL(raw);
49
+ if (!["http:", "https:"].includes(url.protocol))
50
+ return "";
51
+ url.username = "";
52
+ url.password = "";
53
+ for (const key of [...url.searchParams.keys()])
54
+ if (SECRET_PARAM.test(key))
55
+ url.searchParams.set(key, "[redacted]");
56
+ if (url.hash && !url.hash.startsWith("#/") && !url.hash.startsWith("#!/"))
57
+ url.hash = "";
58
+ return url.toString();
59
+ }
60
+ catch {
61
+ return "";
62
+ }
63
+ }
@@ -0,0 +1,11 @@
1
+ import type { AstroIntegration } from "astro";
2
+ import { type CommentKitBuildOptions } from "./options.js";
3
+ export type { CommentKitBuildOptions, InjectOptions } from "./options.js";
4
+ /**
5
+ * Astro: tags `.astro` markup and framework islands (React, Preact, Solid, Vue, Svelte) in dev.
6
+ *
7
+ * import commentkit from "@commentkit/comment-kit/astro";
8
+ * export default defineConfig({ integrations: [commentkit()] });
9
+ */
10
+ export declare function commentkit(options?: CommentKitBuildOptions): AstroIntegration;
11
+ export default commentkit;
@@ -0,0 +1,34 @@
1
+ import { type CommentKitBuildOptions } from "./options.js";
2
+ export type NextCommentKitOptions = Omit<CommentKitBuildOptions, "inject">;
3
+ type AnyRecord = Record<string, any>;
4
+ export interface NextConfigLike extends AnyRecord {
5
+ env?: Record<string, string | undefined>;
6
+ compiler?: AnyRecord & {
7
+ define?: Record<string, string | number | boolean>;
8
+ };
9
+ turbopack?: AnyRecord & {
10
+ rules?: Record<string, unknown>;
11
+ };
12
+ webpack?: ((config: AnyRecord, context: AnyRecord) => AnyRecord) | null;
13
+ }
14
+ export type NextConfigFunction = (phase: string, context: {
15
+ defaultConfig: AnyRecord;
16
+ }) => NextConfigLike | Promise<NextConfigLike>;
17
+ export type NextConfigInput = NextConfigLike | NextConfigFunction;
18
+ /**
19
+ * Applies CommentKit to a resolved Next.js config for one phase. Exported for tests and custom setups.
20
+ * - Unless `buildInfo` turns it off: NEXT_PUBLIC_COMMENTKIT_BRANCH / _COMMIT in `env` (when not set already),
21
+ * and `__COMMENTKIT_BUILD__` (a JSON string) in `compiler.define`, read automatically by the SDK with
22
+ * webpack and Turbopack.
23
+ * - Dev server only (or COMMENTKIT_SOURCE=1): the source loader for webpack and for Turbopack.
24
+ */
25
+ export declare function applyCommentKit(config: NextConfigLike, phase: string, options?: NextCommentKitOptions, env?: NodeJS.ProcessEnv): NextConfigLike;
26
+ /**
27
+ * Next.js: wrap your config.
28
+ *
29
+ * // next.config.mjs
30
+ * import { withCommentKit } from "@commentkit/comment-kit/next";
31
+ * export default withCommentKit({ reactStrictMode: true });
32
+ */
33
+ export declare function withCommentKit(nextConfig?: NextConfigInput, options?: NextCommentKitOptions): NextConfigFunction;
34
+ export default withCommentKit;
@@ -0,0 +1,59 @@
1
+ /** A filter entry: a RegExp tested against the absolute file path, or a path prefix relative to the project root. */
2
+ export type FilterPattern = RegExp | string | ReadonlyArray<RegExp | string>;
3
+ export interface InjectOptions {
4
+ /** Publishable project key, pk_test_… or pk_live_… */
5
+ project: string;
6
+ /** Override the CommentKit server (self-hosting, staging). */
7
+ endpoint?: string;
8
+ /** Override the loader URL. Default https://commentkit.dev/cdn/v1/loader.js */
9
+ src?: string;
10
+ }
11
+ export interface CommentKitBuildOptions {
12
+ /**
13
+ * Tag elements with `data-ck-src="file:line:col"`.
14
+ * - `'dev'` (default): dev servers and non-production builds only; set COMMENTKIT_SOURCE=1 to tag a preview build.
15
+ * - `true`: always (also production builds; not recommended).
16
+ * - `false`: never.
17
+ */
18
+ source?: boolean | "dev";
19
+ /** Only tag files matching these patterns. */
20
+ include?: FilterPattern;
21
+ /** Never tag files matching these patterns. node_modules is always excluded. */
22
+ exclude?: FilterPattern;
23
+ /** Project root that `data-ck-src` paths are relative to. Defaults to the bundler root. */
24
+ root?: string;
25
+ /** Add the CommentKit loader script in dev (Vite and Astro). */
26
+ inject?: InjectOptions;
27
+ /**
28
+ * Put the git branch and commit into the bundle as `__COMMENTKIT_BUILD__`, so new comments record
29
+ * which build they were left on. Anyone who can load the site can read these values.
30
+ * - `true` (default): every build, production included.
31
+ * - `"development"`: dev servers and non-production builds only (the same rule as `source: "dev"`).
32
+ * - `false`: never; git is not run and nothing is added to the bundle.
33
+ */
34
+ buildInfo?: boolean | "development";
35
+ }
36
+ /** Extensions the transformer understands. `.ts` files cannot contain JSX and are skipped. */
37
+ export declare const SUPPORTED: RegExp;
38
+ /** Reads COMMENTKIT_SOURCE: true forces tagging on, false forces it off, null means "not set". */
39
+ export declare function sourceEnv(env?: NodeJS.ProcessEnv): boolean | null;
40
+ /** Decides whether to tag, given whether the bundler is in a development-like mode. */
41
+ export declare function shouldTag(option: CommentKitBuildOptions["source"], isDev: boolean, env?: NodeJS.ProcessEnv): boolean;
42
+ /** Decides whether branch and commit go into the bundle, given whether the bundler is in a development-like mode. */
43
+ export declare function includeBuildInfo(option: CommentKitBuildOptions["buildInfo"], isDev: boolean): boolean;
44
+ /** Removes `?query` and `#hash` and normalises separators. */
45
+ export declare function cleanId(id: string): string;
46
+ /** Root-relative path with forward slashes. Never absolute (privacy). Null when it cannot be made relative. */
47
+ export declare function relativePath(root: string, file: string): string | null;
48
+ export interface FileFilter {
49
+ (id: string): boolean;
50
+ }
51
+ /** Builds the include/exclude filter. node_modules and virtual modules are never transformed. */
52
+ export declare function createFilter(root: string, include?: FilterPattern, exclude?: FilterPattern): FileFilter;
53
+ /** JSON-safe form of a filter, for loaders whose options must be serialisable (Turbopack). */
54
+ export type SerializedPattern = string | {
55
+ regexp: string;
56
+ flags: string;
57
+ };
58
+ export declare function serializeFilter(p: FilterPattern | undefined): SerializedPattern[] | undefined;
59
+ export declare function deserializeFilter(p: SerializedPattern[] | undefined): Array<RegExp | string> | undefined;
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from "vite";
2
+ import { type CommentKitBuildOptions } from "./options.js";
3
+ export type { CommentKitBuildOptions, InjectOptions } from "./options.js";
4
+ /**
5
+ * CommentKit for Vite (and everything built on it: SvelteKit, Nuxt, Astro, Remix, Solid Start).
6
+ *
7
+ * import commentkit from "@commentkit/comment-kit/vite";
8
+ * export default defineConfig({ plugins: [commentkit(), react()] });
9
+ */
10
+ export declare function commentkit(options?: CommentKitBuildOptions): Plugin;
11
+ export default commentkit;
@@ -0,0 +1,22 @@
1
+ import { type SerializedPattern } from "./options.js";
2
+ /** Options the plugin passes to the loader. JSON only, so Turbopack can use the same loader. */
3
+ export interface LoaderOptions {
4
+ root?: string;
5
+ include?: SerializedPattern[];
6
+ exclude?: SerializedPattern[];
7
+ }
8
+ /** The subset of webpack's LoaderContext that webpack and Turbopack both provide. */
9
+ export interface MinimalLoaderContext {
10
+ resourcePath: string;
11
+ resourceQuery?: string;
12
+ rootContext?: string;
13
+ getOptions?: () => unknown;
14
+ query?: unknown;
15
+ }
16
+ type Callback = (error: Error | null, code?: string | Buffer, map?: unknown, meta?: unknown) => void;
17
+ /**
18
+ * Implementation behind dist/node/plugins/webpack-loader.cjs. Tags elements with data-ck-src and returns a source map.
19
+ * Leaves the file untouched on any problem.
20
+ */
21
+ export default function commentkitLoader(this: MinimalLoaderContext, source: string | Buffer, map: unknown, meta: unknown, callback: Callback): void;
22
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { Compiler, RuleSetRule } from "webpack";
2
+ import { type CommentKitBuildOptions } from "./options.js";
3
+ import type { LoaderOptions } from "./webpack-loader.js";
4
+ export type { CommentKitBuildOptions } from "./options.js";
5
+ /** JSON-only loader options (Turbopack validates them), without undefined keys. */
6
+ export declare function loaderOptions(root: string, options?: CommentKitBuildOptions): LoaderOptions;
7
+ /** The pre-loader rule that tags source files. Exported for wrappers (Next.js) and hand-written configs. */
8
+ export declare function sourceRule(root: string, options?: CommentKitBuildOptions): RuleSetRule;
9
+ /**
10
+ * CommentKit for webpack 5.
11
+ *
12
+ * // webpack.config.mjs
13
+ * import { CommentKitWebpackPlugin } from "@commentkit/comment-kit/webpack";
14
+ * plugins: [new CommentKitWebpackPlugin()]
15
+ *
16
+ * The package is ESM only. A CommonJS webpack.config.js can use
17
+ * `const { CommentKitWebpackPlugin } = require("@commentkit/comment-kit/webpack")` on Node 20.19+ and 22.12+,
18
+ * which load ES modules through require().
19
+ *
20
+ * Tags elements only when `mode` is "development" (or COMMENTKIT_SOURCE=1).
21
+ */
22
+ export declare class CommentKitWebpackPlugin {
23
+ private readonly options;
24
+ constructor(options?: CommentKitBuildOptions);
25
+ apply(compiler: Compiler): void;
26
+ }
27
+ export default CommentKitWebpackPlugin;
@@ -1,9 +1,9 @@
1
1
  CommentKit bundles the following open-source software.
2
2
 
3
- preact@11.1.0 (MIT)
4
- The MIT License (MIT)
3
+ html2canvas-pro@2.6.0 (MIT)
4
+ MIT License
5
5
 
6
- Copyright (c) 2015-present Jason Miller
6
+ Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
@@ -25,10 +25,10 @@ SOFTWARE.
25
25
 
26
26
  ---
27
27
 
28
- html2canvas-pro@2.6.0 (MIT)
29
- MIT License
28
+ preact@11.1.0 (MIT)
29
+ The MIT License (MIT)
30
30
 
31
- Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
31
+ Copyright (c) 2015-present Jason Miller
32
32
 
33
33
  Permission is hereby granted, free of charge, to any person obtaining a copy
34
34
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,68 @@
1
+ import { a as e, c as t, d as n, f as r, g as i, p as a, u as o } from "./i18n-DOBt8e9U.js";
2
+ import { n as s, t as c } from "./agent-C1OQzBAm.js";
3
+ import { A as l, h as u } from "./start-DtVlpt7p.js";
4
+ // src/ui/AgentSend.tsx
5
+ var d = {
6
+ cursor: "Cursor",
7
+ claude: "Claude Code",
8
+ codex: "Codex"
9
+ }, f = "commentkit:agent";
10
+ function p({ client: p, threads: m, onDone: h, onError: g, onClose: _ }) {
11
+ let [v, y] = i(null), b = a(null), x = a((e) => (b.current = e, l(e))).current, S = m.slice(0, 25);
12
+ n(() => {
13
+ let e = !0;
14
+ return Promise.all(S.map((e) => p.allMessages(e.id).then((t) => ({
15
+ thread: e,
16
+ messages: t
17
+ })))).then((t) => e && y(t), (t) => e && (g(t), _())), () => void (e = !1);
18
+ }, []), r(() => {
19
+ v && b.current?.querySelector("[role=menuitem]")?.focus({ preventScroll: !0 });
20
+ }, [!v]);
21
+ let C = "copy";
22
+ try {
23
+ C = localStorage.getItem(f) ?? "copy";
24
+ } catch {}
25
+ let w = [
26
+ "cursor",
27
+ "claude",
28
+ "codex",
29
+ "copy"
30
+ ], T = [C, ...w.filter((e) => e !== C)].filter((e) => w.includes(e)), E = (n) => {
31
+ if (!v) return;
32
+ let r = s(v);
33
+ navigator.clipboard?.writeText(r).catch(() => void 0);
34
+ try {
35
+ localStorage.setItem(f, n);
36
+ } catch {}
37
+ if (n === "copy") return h(e("agentCopied", v.length));
38
+ let { url: i, complete: a } = c(n, v, r, p.state.get().session?.repository ?? null), o = document.createElement("a");
39
+ o.href = i, o.rel = "noopener noreferrer", o.click(), h(t(a ? "agentOpened" : "agentOpenedShort", { agent: d[n] }));
40
+ };
41
+ return /* @__PURE__ */ o("div", {
42
+ class: "ck-menu ck-agent-menu",
43
+ role: "menu",
44
+ "aria-label": t("sendToAgent"),
45
+ "aria-busy": !v,
46
+ ref: x,
47
+ onKeyDown: (e) => {
48
+ e.key === "Escape" ? (e.stopPropagation(), _()) : u(e, "[role=menuitem]", !0);
49
+ },
50
+ children: [
51
+ /* @__PURE__ */ o("div", {
52
+ class: "ck-menu-head",
53
+ children: v ? e("agentReady", v.length) : t("agentPreparing")
54
+ }),
55
+ T.map((e) => /* @__PURE__ */ o("button", {
56
+ role: "menuitem",
57
+ "aria-disabled": !v || void 0,
58
+ onClick: () => E(e),
59
+ children: e === "copy" ? t("copyPrompt") : t("openIn", { agent: d[e] })
60
+ })),
61
+ m.length > 25 ? /* @__PURE__ */ o("p", {
62
+ class: "ck-muted ck-agent-note",
63
+ children: t("agentFirstOnly", { max: 25 })
64
+ }) : null
65
+ ]
66
+ });
67
+ }
68
+ export { p as AgentSend };