Skip to content

Commit a7ddcab

Browse files
royangerclaude
andcommitted
feat(react,vue): add Vite plugins that write Clerk agent rules
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ec37cf8 commit a7ddcab

7 files changed

Lines changed: 45 additions & 2 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@clerk/react': minor
3+
'@clerk/vue': minor
4+
---
5+
6+
Add Vite plugins that write a Clerk section to the project's `AGENTS.md` when the Vite dev server runs under an AI coding agent. Nothing is written during builds or in CI.
7+
8+
```ts
9+
import { clerkReactAgentRules } from '@clerk/react/vite';
10+
// or: import { clerkVueAgentRules } from '@clerk/vue/vite';
11+
12+
export default defineConfig({
13+
plugins: [react(), clerkReactAgentRules()],
14+
});
15+
```

‎packages/react/package.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@
8181
"types": "./dist/types.d.cts"
8282
}
8383
},
84+
"./vite": {
85+
"import": {
86+
"types": "./dist/vite.d.mts",
87+
"default": "./dist/vite.mjs"
88+
},
89+
"require": {
90+
"types": "./dist/vite.d.cts",
91+
"default": "./dist/vite.cjs"
92+
}
93+
},
8494
"./package.json": "./package.json"
8595
},
8696
"main": "./dist/index.cjs",

‎packages/react/src/vite.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { clerkAgentRulesVitePlugin } from '@clerk/shared/vite';
2+
3+
export const clerkReactAgentRules = () => clerkAgentRulesVitePlugin('react');

‎packages/react/tsdown.config.mts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default defineConfig((overrideOptions: Options) => {
6565
experimental: 'src/experimental.ts',
6666
legacy: 'src/legacy.ts',
6767
types: 'src/types/index.ts',
68+
vite: 'src/vite.ts',
6869
},
6970
dts: true,
7071
onSuccess: shouldPublish ? 'pkglab pub --ping' : undefined,

‎packages/vue/package.json‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242
"types": "./dist/errors.d.ts",
4343
"default": "./dist/errors.js"
4444
},
45-
"./types": "./dist/types/index.d.ts"
45+
"./types": "./dist/types/index.d.ts",
46+
"./vite": {
47+
"types": "./dist/vite.d.ts",
48+
"default": "./dist/vite.js"
49+
}
4650
},
4751
"main": "./dist/index.js",
4852
"types": "./dist/index.d.ts",

‎packages/vue/src/vite.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { clerkAgentRulesVitePlugin } from '@clerk/shared/vite';
2+
3+
export const clerkVueAgentRules = () => clerkAgentRulesVitePlugin('vue');

‎packages/vue/tsdown.config.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ export default defineConfig(overrideOptions => {
99

1010
return {
1111
clean: true,
12-
entry: ['./src/index.ts', './src/experimental.ts', './src/internal.ts', './src/errors.ts', './src/types/index.ts'],
12+
entry: [
13+
'./src/index.ts',
14+
'./src/experimental.ts',
15+
'./src/internal.ts',
16+
'./src/errors.ts',
17+
'./src/types/index.ts',
18+
'./src/vite.ts',
19+
],
1320
format: ['esm'],
1421
fixedExtension: false,
1522
sourcemap: true,

0 commit comments

Comments
 (0)