@googlarz/agents-sync 1.4.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.
- package/LICENSE +21 -0
- package/README.md +507 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +267 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/loader.d.ts +9 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +55 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +69 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +33 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/derivers/aider.d.ts +19 -0
- package/dist/derivers/aider.d.ts.map +1 -0
- package/dist/derivers/aider.js +117 -0
- package/dist/derivers/aider.js.map +1 -0
- package/dist/derivers/claude.d.ts +19 -0
- package/dist/derivers/claude.d.ts.map +1 -0
- package/dist/derivers/claude.js +93 -0
- package/dist/derivers/claude.js.map +1 -0
- package/dist/derivers/cline.d.ts +17 -0
- package/dist/derivers/cline.d.ts.map +1 -0
- package/dist/derivers/cline.js +92 -0
- package/dist/derivers/cline.js.map +1 -0
- package/dist/derivers/copilot.d.ts +16 -0
- package/dist/derivers/copilot.d.ts.map +1 -0
- package/dist/derivers/copilot.js +162 -0
- package/dist/derivers/copilot.js.map +1 -0
- package/dist/derivers/cursor.d.ts +16 -0
- package/dist/derivers/cursor.d.ts.map +1 -0
- package/dist/derivers/cursor.js +121 -0
- package/dist/derivers/cursor.js.map +1 -0
- package/dist/derivers/gemini.d.ts +19 -0
- package/dist/derivers/gemini.d.ts.map +1 -0
- package/dist/derivers/gemini.js +33 -0
- package/dist/derivers/gemini.js.map +1 -0
- package/dist/derivers/index.d.ts +33 -0
- package/dist/derivers/index.d.ts.map +1 -0
- package/dist/derivers/index.js +134 -0
- package/dist/derivers/index.js.map +1 -0
- package/dist/derivers/merger.d.ts +36 -0
- package/dist/derivers/merger.d.ts.map +1 -0
- package/dist/derivers/merger.js +83 -0
- package/dist/derivers/merger.js.map +1 -0
- package/dist/derivers/roo.d.ts +18 -0
- package/dist/derivers/roo.d.ts.map +1 -0
- package/dist/derivers/roo.js +92 -0
- package/dist/derivers/roo.js.map +1 -0
- package/dist/derivers/windsurf.d.ts +16 -0
- package/dist/derivers/windsurf.d.ts.map +1 -0
- package/dist/derivers/windsurf.js +91 -0
- package/dist/derivers/windsurf.js.map +1 -0
- package/dist/extractor/extractor.d.ts +4 -0
- package/dist/extractor/extractor.d.ts.map +1 -0
- package/dist/extractor/extractor.js +125 -0
- package/dist/extractor/extractor.js.map +1 -0
- package/dist/extractor/schema.d.ts +187 -0
- package/dist/extractor/schema.d.ts.map +1 -0
- package/dist/extractor/schema.js +44 -0
- package/dist/extractor/schema.js.map +1 -0
- package/dist/generator/agents-md.d.ts +6 -0
- package/dist/generator/agents-md.d.ts.map +1 -0
- package/dist/generator/agents-md.js +135 -0
- package/dist/generator/agents-md.js.map +1 -0
- package/dist/generator/validator.d.ts +7 -0
- package/dist/generator/validator.d.ts.map +1 -0
- package/dist/generator/validator.js +67 -0
- package/dist/generator/validator.js.map +1 -0
- package/dist/lib/claude-client.d.ts +11 -0
- package/dist/lib/claude-client.d.ts.map +1 -0
- package/dist/lib/claude-client.js +74 -0
- package/dist/lib/claude-client.js.map +1 -0
- package/dist/lib/errors.d.ts +10 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +27 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-utils.d.ts +7 -0
- package/dist/lib/file-utils.d.ts.map +1 -0
- package/dist/lib/file-utils.js +56 -0
- package/dist/lib/file-utils.js.map +1 -0
- package/dist/lib/token-estimate.d.ts +7 -0
- package/dist/lib/token-estimate.d.ts.map +1 -0
- package/dist/lib/token-estimate.js +15 -0
- package/dist/lib/token-estimate.js.map +1 -0
- package/dist/scanner/codegraph.d.ts +13 -0
- package/dist/scanner/codegraph.d.ts.map +1 -0
- package/dist/scanner/codegraph.js +65 -0
- package/dist/scanner/codegraph.js.map +1 -0
- package/dist/scanner/docs.d.ts +13 -0
- package/dist/scanner/docs.d.ts.map +1 -0
- package/dist/scanner/docs.js +63 -0
- package/dist/scanner/docs.js.map +1 -0
- package/dist/scanner/gotchas.d.ts +8 -0
- package/dist/scanner/gotchas.d.ts.map +1 -0
- package/dist/scanner/gotchas.js +107 -0
- package/dist/scanner/gotchas.js.map +1 -0
- package/dist/scanner/index.d.ts +26 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +95 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/manifest.d.ts +13 -0
- package/dist/scanner/manifest.d.ts.map +1 -0
- package/dist/scanner/manifest.js +285 -0
- package/dist/scanner/manifest.js.map +1 -0
- package/dist/scanner/mcp.d.ts +12 -0
- package/dist/scanner/mcp.d.ts.map +1 -0
- package/dist/scanner/mcp.js +96 -0
- package/dist/scanner/mcp.js.map +1 -0
- package/dist/scanner/repomix.d.ts +11 -0
- package/dist/scanner/repomix.d.ts.map +1 -0
- package/dist/scanner/repomix.js +87 -0
- package/dist/scanner/repomix.js.map +1 -0
- package/dist/scanner/skills.d.ts +18 -0
- package/dist/scanner/skills.d.ts.map +1 -0
- package/dist/scanner/skills.js +100 -0
- package/dist/scanner/skills.js.map +1 -0
- package/dist/scanner/source.d.ts +13 -0
- package/dist/scanner/source.d.ts.map +1 -0
- package/dist/scanner/source.js +157 -0
- package/dist/scanner/source.js.map +1 -0
- package/dist/scanner/structure.d.ts +10 -0
- package/dist/scanner/structure.d.ts.map +1 -0
- package/dist/scanner/structure.js +168 -0
- package/dist/scanner/structure.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +245 -0
- package/dist/server.js.map +1 -0
- package/dist/snapshot/drift.d.ts +28 -0
- package/dist/snapshot/drift.d.ts.map +1 -0
- package/dist/snapshot/drift.js +205 -0
- package/dist/snapshot/drift.js.map +1 -0
- package/dist/snapshot/schema.d.ts +94 -0
- package/dist/snapshot/schema.d.ts.map +1 -0
- package/dist/snapshot/schema.js +24 -0
- package/dist/snapshot/schema.js.map +1 -0
- package/dist/snapshot/writer.d.ts +17 -0
- package/dist/snapshot/writer.d.ts.map +1 -0
- package/dist/snapshot/writer.js +44 -0
- package/dist/snapshot/writer.js.map +1 -0
- package/dist/tools/drift.d.ts +15 -0
- package/dist/tools/drift.d.ts.map +1 -0
- package/dist/tools/drift.js +51 -0
- package/dist/tools/drift.js.map +1 -0
- package/dist/tools/export.d.ts +14 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +53 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/init.d.ts +28 -0
- package/dist/tools/init.d.ts.map +1 -0
- package/dist/tools/init.js +103 -0
- package/dist/tools/init.js.map +1 -0
- package/dist/tools/lint.d.ts +24 -0
- package/dist/tools/lint.d.ts.map +1 -0
- package/dist/tools/lint.js +213 -0
- package/dist/tools/lint.js.map +1 -0
- package/dist/tools/scan-report.d.ts +14 -0
- package/dist/tools/scan-report.d.ts.map +1 -0
- package/dist/tools/scan-report.js +136 -0
- package/dist/tools/scan-report.js.map +1 -0
- package/dist/tools/status.d.ts +18 -0
- package/dist/tools/status.d.ts.map +1 -0
- package/dist/tools/status.js +38 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/tools/sync.d.ts +22 -0
- package/dist/tools/sync.d.ts.map +1 -0
- package/dist/tools/sync.js +123 -0
- package/dist/tools/sync.js.map +1 -0
- package/dist/tools/validate.d.ts +22 -0
- package/dist/tools/validate.d.ts.map +1 -0
- package/dist/tools/validate.js +97 -0
- package/dist/tools/validate.js.map +1 -0
- package/docs/agents-md-spec.md +233 -0
- package/docs/examples/.clinerules +29 -0
- package/docs/examples/.cursorrules +19 -0
- package/docs/examples/.windsurfrules +14 -0
- package/docs/examples/AGENTS.md +97 -0
- package/docs/examples/CLAUDE.md +88 -0
- package/docs/examples/GEMINI.md +61 -0
- package/docs/examples/copilot-instructions.md +24 -0
- package/docs/github-action.yml +89 -0
- package/package.json +63 -0
- package/scripts/demo.sh +138 -0
- package/skill/SKILL.md +158 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# AGENTS.md Specification
|
|
2
|
+
|
|
3
|
+
> Version 1.0 · Published by [agents-sync](https://github.com/googlarz/agents-sync)
|
|
4
|
+
|
|
5
|
+
AGENTS.md is a plain-text file at the root of a software project that describes the project's conventions, boundaries, and context for AI coding assistants. This document is the canonical format specification.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
AGENTS.md serves as the **single source of truth** for AI context in a project. Tool-specific files (CLAUDE.md, .cursorrules, copilot-instructions.md, GEMINI.md, .windsurfrules, .clinerules) are derived from it by agents-sync. Authors edit AGENTS.md; agents-sync keeps the derived files in sync.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
AGENTS.md ──► CLAUDE.md (Claude Code)
|
|
15
|
+
──► .cursorrules (Cursor)
|
|
16
|
+
──► copilot-instructions.md (GitHub Copilot)
|
|
17
|
+
──► GEMINI.md (Gemini CLI)
|
|
18
|
+
──► .windsurfrules (Windsurf)
|
|
19
|
+
──► .clinerules (Cline)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## File Location
|
|
25
|
+
|
|
26
|
+
Always at the **project root**: `<project-root>/AGENTS.md`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Canonical Structure
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
# AGENTS.md
|
|
34
|
+
|
|
35
|
+
## Project
|
|
36
|
+
<!-- Brief project description. One paragraph. -->
|
|
37
|
+
|
|
38
|
+
## Stack
|
|
39
|
+
<!-- Technology choices: language, framework, database, test runner, deploy target. -->
|
|
40
|
+
|
|
41
|
+
## Architecture
|
|
42
|
+
<!-- Key directories and what lives in them. Entry points. -->
|
|
43
|
+
|
|
44
|
+
## Conventions
|
|
45
|
+
<!-- Specific rules the AI must follow when writing code. -->
|
|
46
|
+
|
|
47
|
+
## Boundaries
|
|
48
|
+
### Always
|
|
49
|
+
<!-- Things the AI should always do. -->
|
|
50
|
+
### Ask first
|
|
51
|
+
<!-- Things the AI should confirm before doing. -->
|
|
52
|
+
### Never
|
|
53
|
+
<!-- Hard prohibitions. These are machine-checkable by agents-sync lint. -->
|
|
54
|
+
|
|
55
|
+
## Testing
|
|
56
|
+
<!-- How to run tests. Where tests live. Coverage expectations. -->
|
|
57
|
+
|
|
58
|
+
## Deployment
|
|
59
|
+
<!-- How to deploy. Environment variables. CI/CD details. -->
|
|
60
|
+
|
|
61
|
+
## Gotchas
|
|
62
|
+
<!-- Known pitfalls, surprising behavior, non-obvious constraints. -->
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Section Reference
|
|
68
|
+
|
|
69
|
+
### `## Project`
|
|
70
|
+
|
|
71
|
+
A short description of what the project does and who it's for. Include the project name.
|
|
72
|
+
|
|
73
|
+
```markdown
|
|
74
|
+
## Project
|
|
75
|
+
Acme Billing — a SaaS invoice management platform built for small businesses.
|
|
76
|
+
Backend: Node.js / Express. Frontend: React + TypeScript.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `## Stack`
|
|
80
|
+
|
|
81
|
+
List the concrete technology choices. Be specific — include package names and versions where relevant.
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
## Stack
|
|
85
|
+
- **Language**: TypeScript 5.4
|
|
86
|
+
- **Framework**: Next.js 14 (App Router)
|
|
87
|
+
- **Database**: PostgreSQL 16 via Prisma ORM
|
|
88
|
+
- **Auth**: NextAuth.js v5
|
|
89
|
+
- **Testing**: Vitest + React Testing Library
|
|
90
|
+
- **Deploy**: Vercel (preview + production)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### `## Architecture`
|
|
94
|
+
|
|
95
|
+
Describe how the codebase is organized. Focus on what the AI needs to know to place files correctly.
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## Architecture
|
|
99
|
+
- `app/` — Next.js App Router pages and layouts
|
|
100
|
+
- `app/api/` — API route handlers
|
|
101
|
+
- `src/lib/` — shared utilities (no framework dependencies)
|
|
102
|
+
- `src/components/` — reusable React components
|
|
103
|
+
- `src/db/` — Prisma client and query helpers
|
|
104
|
+
- `tests/` — unit and integration tests mirroring `src/`
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### `## Conventions`
|
|
108
|
+
|
|
109
|
+
Specific, observable rules for the AI to follow. Every convention must be **falsifiable** — it should be possible to look at a piece of code and determine whether the convention is followed.
|
|
110
|
+
|
|
111
|
+
**Good conventions:**
|
|
112
|
+
```markdown
|
|
113
|
+
- Use named exports only; no default exports except in `app/` pages
|
|
114
|
+
- File names: kebab-case (e.g., `user-profile.ts`, not `UserProfile.ts`)
|
|
115
|
+
- API routes return `{ data, error }` envelopes — never naked objects
|
|
116
|
+
- All DB queries go through `src/db/` helpers, never direct Prisma client calls
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Bad conventions (too vague):**
|
|
120
|
+
```markdown
|
|
121
|
+
- Follow best practices
|
|
122
|
+
- Write clean code
|
|
123
|
+
- Keep things simple
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### `## Boundaries`
|
|
127
|
+
|
|
128
|
+
Three tiers of constraint:
|
|
129
|
+
|
|
130
|
+
| Tier | Meaning | AI behavior |
|
|
131
|
+
|------|---------|-------------|
|
|
132
|
+
| **Always** | Must do by default | Do this in every relevant context |
|
|
133
|
+
| **Ask first** | Requires human approval | Propose and wait for a ✓ before acting |
|
|
134
|
+
| **Never** | Hard prohibitions | Refuse; explain the rule if asked |
|
|
135
|
+
|
|
136
|
+
```markdown
|
|
137
|
+
### Always
|
|
138
|
+
- Run `npm test` before considering a task complete
|
|
139
|
+
- Add a test for every new function in `src/lib/`
|
|
140
|
+
- Import from `@/lib/db` — never use PrismaClient directly
|
|
141
|
+
|
|
142
|
+
### Ask first
|
|
143
|
+
- Adding or removing npm dependencies
|
|
144
|
+
- Changing the database schema
|
|
145
|
+
- Modifying CI/CD pipeline files
|
|
146
|
+
|
|
147
|
+
### Never
|
|
148
|
+
- Commit `.env` files or any file containing secrets
|
|
149
|
+
- Use `console.log` in production code (use the `logger` utility instead)
|
|
150
|
+
- Use TypeScript `any` type (use `unknown` or proper types)
|
|
151
|
+
- Call `process.env` directly (use `src/lib/config.ts` instead)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
> **Note:** Rules in `### Never` are checked by `agents-sync lint`. Write them as specific, machine-checkable statements.
|
|
155
|
+
|
|
156
|
+
### `## Testing`
|
|
157
|
+
|
|
158
|
+
```markdown
|
|
159
|
+
## Testing
|
|
160
|
+
- **Framework**: Vitest
|
|
161
|
+
- **Run all**: `npm test`
|
|
162
|
+
- **Run unit**: `npm run test:unit`
|
|
163
|
+
- **Coverage**: `npm run test:coverage` (target: 80%)
|
|
164
|
+
- **Location**: `tests/` mirrors `src/` structure; test files named `*.test.ts`
|
|
165
|
+
- **Policy**: every new public function must have at least one test
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `## Deployment`
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## Deployment
|
|
172
|
+
- **Target**: Vercel (auto-deploy from `main`)
|
|
173
|
+
- **Preview**: every PR gets a preview URL
|
|
174
|
+
- **Env vars**: see `.env.example` — required: `DATABASE_URL`, `NEXTAUTH_SECRET`
|
|
175
|
+
- **Migrations**: `npx prisma migrate deploy` (runs automatically in CI)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `## Gotchas`
|
|
179
|
+
|
|
180
|
+
Surprising behavior, footguns, or non-obvious constraints that would catch a new contributor (or AI) off guard.
|
|
181
|
+
|
|
182
|
+
```markdown
|
|
183
|
+
## Gotchas
|
|
184
|
+
- `lib/auth.ts` wraps NextAuth — do not import `next-auth` directly elsewhere
|
|
185
|
+
- Prisma queries in API routes must be wrapped in try/catch; errors are not automatically forwarded
|
|
186
|
+
- `app/` directory uses React Server Components by default — add `"use client"` explicitly for interactive components
|
|
187
|
+
- The `tests/` directory uses a separate `tsconfig.test.json` — do not add test utilities to the main `tsconfig.json`
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Custom Sections
|
|
193
|
+
|
|
194
|
+
agents-sync preserves any content inside these markers across re-syncs:
|
|
195
|
+
|
|
196
|
+
```markdown
|
|
197
|
+
<!-- AGENTS-SYNC:CUSTOM:START -->
|
|
198
|
+
...your hand-written content here...
|
|
199
|
+
<!-- AGENTS-SYNC:CUSTOM:END -->
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Use custom sections for project-specific context that agents-sync cannot detect automatically (e.g., business logic rules, team preferences, domain-specific terminology).
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Machine-Checkable Rules
|
|
207
|
+
|
|
208
|
+
`agents-sync lint` parses the `### Never` section and checks for violations using pattern matching. To maximize automated coverage, write Never rules in one of these forms:
|
|
209
|
+
|
|
210
|
+
| Pattern | Example |
|
|
211
|
+
|---------|---------|
|
|
212
|
+
| `console.log` | "Never use `console.log`" |
|
|
213
|
+
| TypeScript `any` | "Never use TypeScript `any` type" |
|
|
214
|
+
| Default exports | "Never use default exports" |
|
|
215
|
+
| Direct import | "Never import `PrismaClient` directly" |
|
|
216
|
+
| `.env` in git | "Never commit `.env` files" |
|
|
217
|
+
| `process.env` access | "Never access `process.env` directly" |
|
|
218
|
+
|
|
219
|
+
Rules that don't match a known pattern are marked `skipped: No automated check available` in the lint report — they are still enforced by convention but not automatically verified.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Version History
|
|
224
|
+
|
|
225
|
+
| Version | Date | Changes |
|
|
226
|
+
|---------|------|---------|
|
|
227
|
+
| 1.0 | 2026-05-20 | Initial specification |
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Contributing
|
|
232
|
+
|
|
233
|
+
To propose changes to this specification, open an issue at [googlarz/agents-sync](https://github.com/googlarz/agents-sync/issues) with the label `spec`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# .clinerules — managed by agents-sync v1.0.0
|
|
2
|
+
# Language: TypeScript / Next.js 14
|
|
3
|
+
|
|
4
|
+
## Conventions
|
|
5
|
+
|
|
6
|
+
- kebab-case filenames throughout
|
|
7
|
+
- Named exports only (default exports for Next.js pages/layouts only)
|
|
8
|
+
- Zod for all external input validation
|
|
9
|
+
- Co-locate tests (Button.test.tsx next to Button.tsx)
|
|
10
|
+
- Server components by default; 'use client' only when needed
|
|
11
|
+
|
|
12
|
+
## Always
|
|
13
|
+
|
|
14
|
+
- Run npm test before committing
|
|
15
|
+
- Validate external API responses with Zod
|
|
16
|
+
- Check middleware.ts before adding /api/ routes
|
|
17
|
+
- Use src/lib/db.ts for all Prisma queries
|
|
18
|
+
|
|
19
|
+
## Never
|
|
20
|
+
|
|
21
|
+
- Commit .env or .env.local
|
|
22
|
+
- Import PrismaClient directly (use src/lib/db.ts — pool exhaustion risk)
|
|
23
|
+
- Use TypeScript any (use unknown and narrow)
|
|
24
|
+
- Push directly to main
|
|
25
|
+
- Use console.log in production
|
|
26
|
+
|
|
27
|
+
## Tests
|
|
28
|
+
|
|
29
|
+
`npm test`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# .cursorrules — managed by agents-sync v1.0.0
|
|
2
|
+
# Language: TypeScript / Next.js 14
|
|
3
|
+
# Run tests: npm test
|
|
4
|
+
|
|
5
|
+
- Always: use kebab-case filenames (user-profile.tsx not UserProfile.tsx)
|
|
6
|
+
- Always: named exports only (no default exports except Next.js page/layout components)
|
|
7
|
+
- Always: validate external API responses with Zod
|
|
8
|
+
- Always: co-locate tests (Button.test.tsx next to Button.tsx)
|
|
9
|
+
- Always: server components by default — add 'use client' only when needed
|
|
10
|
+
- Always: use cn() from lib/utils.ts for conditional classNames
|
|
11
|
+
- Never: import PrismaClient directly (use src/lib/db.ts — connection pool exhaustion)
|
|
12
|
+
- Never: add /api/ routes without checking middleware.ts auth coverage
|
|
13
|
+
- Never: use date-fns without /utc variants (multi-timezone dashboard)
|
|
14
|
+
- Never: commit .env or .env.local
|
|
15
|
+
- Never: use TypeScript any — use unknown and narrow
|
|
16
|
+
- Never: push directly to main
|
|
17
|
+
- Never: use console.log in production (use logger utility)
|
|
18
|
+
- Tests: npm test
|
|
19
|
+
- Build: npm run build
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# .windsurfrules — managed by agents-sync v1.0.0
|
|
2
|
+
# Language: TypeScript / Next.js 14
|
|
3
|
+
|
|
4
|
+
- Always: use kebab-case filenames
|
|
5
|
+
- Always: named exports only (default exports for Next.js pages/layouts only)
|
|
6
|
+
- Always: validate external input with Zod
|
|
7
|
+
- Always: co-locate tests (*.test.ts next to source)
|
|
8
|
+
- Always: server components by default; 'use client' only when required
|
|
9
|
+
- Never: DB connection is singleton — use src/lib/db.ts, not new PrismaClient()
|
|
10
|
+
- Never: add API routes without checking middleware.ts auth coverage
|
|
11
|
+
- Never: date comparisons without UTC — use date-fns/utc variants
|
|
12
|
+
- Never: commit .env or .env.local
|
|
13
|
+
- Never: TypeScript any
|
|
14
|
+
- Tests: npm test
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
<!-- Generated by agents-sync v1.0.0 on 2026-05-20 -->
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Acme Dashboard is an internal analytics and reporting platform for the sales team. Built with
|
|
8
|
+
Next.js 14 App Router, PostgreSQL via Prisma ORM, and NextAuth v4 for authentication. Deployed
|
|
9
|
+
on Vercel with a Neon managed Postgres instance.
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- **Language:** TypeScript
|
|
14
|
+
- **Framework:** Next.js 14 (App Router)
|
|
15
|
+
- **Database:** PostgreSQL via Prisma ORM
|
|
16
|
+
- **Auth:** NextAuth v4
|
|
17
|
+
- **UI:** shadcn/ui + Tailwind CSS
|
|
18
|
+
- **Testing:** Vitest (co-located)
|
|
19
|
+
- **Deployment:** Vercel + Neon
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
src/
|
|
25
|
+
app/ Next.js App Router pages and layouts
|
|
26
|
+
features/ Domain modules: dashboard, reports, users, billing
|
|
27
|
+
lib/ Shared utilities: db singleton, auth config, api client
|
|
28
|
+
components/ Shared UI (shadcn/ui based)
|
|
29
|
+
hooks/ Client-side React hooks
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Key directories
|
|
33
|
+
|
|
34
|
+
- `src/app/` — Next.js App Router pages and layouts (server components by default)
|
|
35
|
+
- `src/features/` — Feature modules, one directory per domain
|
|
36
|
+
- `src/lib/db.ts` — Prisma client singleton (do not instantiate PrismaClient elsewhere)
|
|
37
|
+
- `src/lib/auth.ts` — NextAuth configuration
|
|
38
|
+
- `src/components/` — Shared, reusable UI components
|
|
39
|
+
|
|
40
|
+
## Conventions
|
|
41
|
+
|
|
42
|
+
1. kebab-case filenames throughout (`user-profile.tsx`, not `UserProfile.tsx`)
|
|
43
|
+
2. Named exports only — no default exports except Next.js page/layout components
|
|
44
|
+
3. All external API responses validated with Zod before use
|
|
45
|
+
4. Co-locate tests: `Button.test.tsx` lives next to `Button.tsx`
|
|
46
|
+
5. Use `cn()` from `lib/utils.ts` for conditional className strings
|
|
47
|
+
6. Server components by default; add `'use client'` only when hooks or browser APIs are required
|
|
48
|
+
7. All database queries go through `src/lib/db.ts` — never instantiate PrismaClient directly
|
|
49
|
+
|
|
50
|
+
## Gotchas
|
|
51
|
+
|
|
52
|
+
1. **Never import `PrismaClient` directly** — Vercel's serverless runtime creates a new instance
|
|
53
|
+
per invocation, exhausting the Neon connection pool. Use `src/lib/db.ts` singleton only.
|
|
54
|
+
2. **All API routes require auth middleware** — the `middleware.ts` matcher protects `/api/**`.
|
|
55
|
+
Any new route outside that pattern must explicitly add auth checks.
|
|
56
|
+
3. **Date comparisons must use UTC** — the dashboard serves users across timezones. Use
|
|
57
|
+
`date-fns/utc` variants (`formatUTC`, `parseISO`, etc.) not the plain `date-fns` equivalents.
|
|
58
|
+
4. **`src/app/` is server-first** — avoid `useState`/`useEffect` in files under `src/app/`
|
|
59
|
+
unless they are explicitly `'use client'`. Data fetching belongs in server components.
|
|
60
|
+
|
|
61
|
+
## Boundaries
|
|
62
|
+
|
|
63
|
+
### Always do
|
|
64
|
+
|
|
65
|
+
- Run `npm test` before committing
|
|
66
|
+
- Validate external API responses with Zod
|
|
67
|
+
- Check `middleware.ts` before adding new `/api/` routes
|
|
68
|
+
- Use `src/lib/db.ts` for all Prisma queries
|
|
69
|
+
|
|
70
|
+
### Ask first
|
|
71
|
+
|
|
72
|
+
- Database schema changes (Prisma migrations affect production data)
|
|
73
|
+
- Adding new npm dependencies (bundle size matters)
|
|
74
|
+
- Changes to the authentication flow or session handling
|
|
75
|
+
- Modifying `middleware.ts`
|
|
76
|
+
|
|
77
|
+
### Never
|
|
78
|
+
|
|
79
|
+
- Commit `.env` or `.env.local`
|
|
80
|
+
- Instantiate `PrismaClient` outside of `src/lib/db.ts`
|
|
81
|
+
- Use TypeScript `any` — use `unknown` and narrow instead
|
|
82
|
+
- Push directly to `main` branch
|
|
83
|
+
- Use `console.log` in production code (use the `logger` utility instead)
|
|
84
|
+
|
|
85
|
+
## Testing
|
|
86
|
+
|
|
87
|
+
- **Framework:** Vitest
|
|
88
|
+
- **Run:** `npm test`
|
|
89
|
+
- **Coverage:** `npm run test:coverage`
|
|
90
|
+
- **Location:** Co-located with source (`*.test.ts` / `*.test.tsx`)
|
|
91
|
+
|
|
92
|
+
## Deployment
|
|
93
|
+
|
|
94
|
+
- **Target:** Vercel (automatic on push to `main`)
|
|
95
|
+
- **Database:** Neon PostgreSQL (`DATABASE_URL` in environment)
|
|
96
|
+
- **Migrations:** Run `npx prisma migrate deploy` after schema changes
|
|
97
|
+
- **Env:** `.env.local` for local dev; Vercel dashboard for production secrets
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
<!-- Derived from AGENTS.md by agents-sync v1.0.0 on 2026-05-20 -->
|
|
4
|
+
<!-- Source: AGENTS.md — edit that file, then run /agents-sync sync -->
|
|
5
|
+
|
|
6
|
+
## Project Overview
|
|
7
|
+
|
|
8
|
+
Acme Dashboard is an internal analytics and reporting platform for the sales team. Built with
|
|
9
|
+
Next.js 14 App Router, PostgreSQL via Prisma ORM, and NextAuth v4 for authentication. Deployed
|
|
10
|
+
on Vercel with a Neon managed Postgres instance.
|
|
11
|
+
|
|
12
|
+
## Tech Stack
|
|
13
|
+
|
|
14
|
+
- **Language:** TypeScript
|
|
15
|
+
- **Framework:** Next.js 14 (App Router)
|
|
16
|
+
- **Database:** PostgreSQL via Prisma ORM
|
|
17
|
+
- **Auth:** NextAuth v4
|
|
18
|
+
- **UI:** shadcn/ui + Tailwind CSS
|
|
19
|
+
- **Testing:** Vitest (co-located)
|
|
20
|
+
- **Deployment:** Vercel + Neon
|
|
21
|
+
|
|
22
|
+
## Architecture
|
|
23
|
+
|
|
24
|
+
- `src/app/` — Next.js App Router pages and layouts (server components by default)
|
|
25
|
+
- `src/features/` — Feature modules, one directory per domain
|
|
26
|
+
- `src/lib/db.ts` — Prisma client singleton (do not instantiate PrismaClient elsewhere)
|
|
27
|
+
- `src/lib/auth.ts` — NextAuth configuration
|
|
28
|
+
- `src/components/` — Shared, reusable UI components
|
|
29
|
+
|
|
30
|
+
## Conventions
|
|
31
|
+
|
|
32
|
+
1. kebab-case filenames throughout (`user-profile.tsx`, not `UserProfile.tsx`)
|
|
33
|
+
2. Named exports only — no default exports except Next.js page/layout components
|
|
34
|
+
3. All external API responses validated with Zod before use
|
|
35
|
+
4. Co-locate tests: `Button.test.tsx` lives next to `Button.tsx`
|
|
36
|
+
5. Use `cn()` from `lib/utils.ts` for conditional className strings
|
|
37
|
+
6. Server components by default; add `'use client'` only when hooks or browser APIs are required
|
|
38
|
+
7. All database queries go through `src/lib/db.ts`
|
|
39
|
+
|
|
40
|
+
## Gotchas
|
|
41
|
+
|
|
42
|
+
1. **Never import `PrismaClient` directly** — connection pool exhaustion. Use `src/lib/db.ts`.
|
|
43
|
+
2. **All API routes require auth middleware** — `middleware.ts` matcher covers `/api/**`.
|
|
44
|
+
3. **Date comparisons must use UTC** — use `date-fns/utc` variants throughout.
|
|
45
|
+
4. **`src/app/` is server-first** — no hooks/browser APIs unless `'use client'` is declared.
|
|
46
|
+
|
|
47
|
+
## Boundaries
|
|
48
|
+
|
|
49
|
+
### Always do
|
|
50
|
+
|
|
51
|
+
- Run `npm test` before committing
|
|
52
|
+
- Validate external API responses with Zod
|
|
53
|
+
- Check `middleware.ts` before adding new `/api/` routes
|
|
54
|
+
- Use `src/lib/db.ts` for all Prisma queries
|
|
55
|
+
|
|
56
|
+
### Ask first
|
|
57
|
+
|
|
58
|
+
- Database schema changes
|
|
59
|
+
- Adding new npm dependencies
|
|
60
|
+
- Changes to authentication flow
|
|
61
|
+
- Modifying `middleware.ts`
|
|
62
|
+
|
|
63
|
+
### Never
|
|
64
|
+
|
|
65
|
+
- Commit `.env` or `.env.local`
|
|
66
|
+
- Instantiate `PrismaClient` outside of `src/lib/db.ts`
|
|
67
|
+
- Use TypeScript `any`
|
|
68
|
+
- Push directly to `main`
|
|
69
|
+
- Use `console.log` in production
|
|
70
|
+
|
|
71
|
+
## Commands
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm run dev # local dev server
|
|
75
|
+
npm test # run tests
|
|
76
|
+
npm run test:watch # watch mode
|
|
77
|
+
npm run build # production build
|
|
78
|
+
npm run lint # lint
|
|
79
|
+
npx prisma studio # database GUI
|
|
80
|
+
npx prisma migrate dev # run migrations locally
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Claude Code notes
|
|
84
|
+
|
|
85
|
+
- When adding API routes, check `middleware.ts` first to understand auth coverage
|
|
86
|
+
- For UI work, use existing shadcn/ui components from `src/components/ui/`
|
|
87
|
+
- Feature work lives in `src/features/<name>/` — match the existing module structure
|
|
88
|
+
- The Prisma schema is in `prisma/schema.prisma`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
<!-- Derived for Gemini CLI by agents-sync v1.0.0 on 2026-05-20 -->
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Acme Dashboard is an internal analytics and reporting platform for the sales team. Built with
|
|
8
|
+
Next.js 14 App Router, PostgreSQL via Prisma ORM, and NextAuth v4 for authentication.
|
|
9
|
+
|
|
10
|
+
## Tech Stack
|
|
11
|
+
|
|
12
|
+
- TypeScript / Next.js 14 (App Router)
|
|
13
|
+
- PostgreSQL via Prisma ORM
|
|
14
|
+
- Auth: NextAuth v4
|
|
15
|
+
- UI: shadcn/ui + Tailwind CSS
|
|
16
|
+
- Testing: Vitest (co-located)
|
|
17
|
+
- Deployment: Vercel + Neon
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
- `src/app/` — App Router pages and layouts
|
|
22
|
+
- `src/features/` — Domain modules
|
|
23
|
+
- `src/lib/db.ts` — Prisma client singleton
|
|
24
|
+
- `src/components/` — Shared UI
|
|
25
|
+
|
|
26
|
+
## Conventions
|
|
27
|
+
|
|
28
|
+
1. kebab-case filenames throughout
|
|
29
|
+
2. Named exports only
|
|
30
|
+
3. Zod for all external input validation
|
|
31
|
+
4. Co-locate tests
|
|
32
|
+
5. Server components by default
|
|
33
|
+
|
|
34
|
+
## Gotchas
|
|
35
|
+
|
|
36
|
+
1. Never import PrismaClient directly — use src/lib/db.ts
|
|
37
|
+
2. All API routes protected by middleware.ts
|
|
38
|
+
3. Date comparisons must use UTC (date-fns/utc)
|
|
39
|
+
|
|
40
|
+
## Boundaries
|
|
41
|
+
|
|
42
|
+
### Never
|
|
43
|
+
- Commit .env or .env.local
|
|
44
|
+
- Instantiate PrismaClient outside src/lib/db.ts
|
|
45
|
+
- Use TypeScript any
|
|
46
|
+
- Push directly to main
|
|
47
|
+
|
|
48
|
+
### Always do
|
|
49
|
+
- Run npm test before committing
|
|
50
|
+
- Validate external responses with Zod
|
|
51
|
+
|
|
52
|
+
## Testing
|
|
53
|
+
|
|
54
|
+
`npm test`
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Gemini CLI Notes
|
|
59
|
+
|
|
60
|
+
This file is managed by [agents-sync](https://github.com/googlarz/agents-sync). Edit `AGENTS.md`
|
|
61
|
+
then run `agents-sync sync` to regenerate all tool context files.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Managed by agents-sync v1.0.0. Source: AGENTS.md -->
|
|
2
|
+
# GitHub Copilot Instructions — Acme Dashboard
|
|
3
|
+
|
|
4
|
+
**Stack:** TypeScript · Next.js 14 App Router · Prisma + Neon PostgreSQL · NextAuth v4 · shadcn/ui
|
|
5
|
+
|
|
6
|
+
## Code rules
|
|
7
|
+
|
|
8
|
+
- kebab-case filenames; named exports only (default exports for Next.js pages/layouts only)
|
|
9
|
+
- Validate external data with Zod before use
|
|
10
|
+
- Tests co-located: `Foo.test.tsx` next to `Foo.tsx`
|
|
11
|
+
- Server components by default; `'use client'` only for hooks/browser APIs
|
|
12
|
+
|
|
13
|
+
## Critical constraints
|
|
14
|
+
|
|
15
|
+
- Database: always use `src/lib/db.ts` singleton — never `new PrismaClient()`
|
|
16
|
+
- Auth: all `/api/` routes are protected by `middleware.ts`; check before adding routes
|
|
17
|
+
- Dates: use `date-fns/utc` variants — dashboard is multi-timezone
|
|
18
|
+
- No `console.log` in production; no TypeScript `any`; no `.env` commits
|
|
19
|
+
|
|
20
|
+
## Tests
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
npm test
|
|
24
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# agents-sync GitHub Action
|
|
2
|
+
#
|
|
3
|
+
# Checks for codebase drift weekly and when package.json/manifest changes.
|
|
4
|
+
# Opens a PR when drift is detected so the team can review and re-sync.
|
|
5
|
+
#
|
|
6
|
+
# Setup:
|
|
7
|
+
# 1. Copy this file to .github/workflows/agents-sync.yml in your repo
|
|
8
|
+
# 2. Add ANTHROPIC_API_KEY to your repository secrets
|
|
9
|
+
# (Settings → Secrets and variables → Actions → New repository secret)
|
|
10
|
+
# 3. Commit and push
|
|
11
|
+
|
|
12
|
+
name: agents-sync drift check
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
schedule:
|
|
16
|
+
# Run every Monday at 9am UTC
|
|
17
|
+
- cron: "0 9 * * 1"
|
|
18
|
+
push:
|
|
19
|
+
paths:
|
|
20
|
+
# Re-check whenever a manifest or major structure file changes
|
|
21
|
+
- "package.json"
|
|
22
|
+
- "pyproject.toml"
|
|
23
|
+
- "Cargo.toml"
|
|
24
|
+
- "go.mod"
|
|
25
|
+
- "composer.json"
|
|
26
|
+
workflow_dispatch:
|
|
27
|
+
inputs:
|
|
28
|
+
force_sync:
|
|
29
|
+
description: "Force a full re-sync even if drift is low"
|
|
30
|
+
type: boolean
|
|
31
|
+
default: false
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
drift-check:
|
|
35
|
+
name: Check AI context drift
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
permissions:
|
|
38
|
+
contents: write
|
|
39
|
+
pull-requests: write
|
|
40
|
+
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- uses: actions/setup-node@v4
|
|
45
|
+
with:
|
|
46
|
+
node-version: "20"
|
|
47
|
+
|
|
48
|
+
- name: Check drift
|
|
49
|
+
id: drift
|
|
50
|
+
run: npx @googlarz/agents-sync drift . --ci
|
|
51
|
+
env:
|
|
52
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
53
|
+
NO_COLOR: "1"
|
|
54
|
+
# --ci exits with code 1 when drift is HIGH; the step fails,
|
|
55
|
+
# which triggers the sync step below.
|
|
56
|
+
continue-on-error: true
|
|
57
|
+
|
|
58
|
+
- name: Re-sync context files
|
|
59
|
+
if: steps.drift.outcome == 'failure' || inputs.force_sync == true
|
|
60
|
+
run: npx @googlarz/agents-sync sync .
|
|
61
|
+
env:
|
|
62
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
63
|
+
NO_COLOR: "1"
|
|
64
|
+
|
|
65
|
+
- name: Open PR with updated files
|
|
66
|
+
if: steps.drift.outcome == 'failure' || inputs.force_sync == true
|
|
67
|
+
uses: peter-evans/create-pull-request@v6
|
|
68
|
+
with:
|
|
69
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
70
|
+
commit-message: "chore: re-sync AI context files"
|
|
71
|
+
title: "chore: re-sync AI context files (agents-sync)"
|
|
72
|
+
body: |
|
|
73
|
+
Codebase drift detected. agents-sync has re-generated the AI context files.
|
|
74
|
+
|
|
75
|
+
**Files updated:**
|
|
76
|
+
- `AGENTS.md` — canonical source
|
|
77
|
+
- `CLAUDE.md` — Claude Code
|
|
78
|
+
- `.cursorrules` — Cursor
|
|
79
|
+
- `.github/copilot-instructions.md` — GitHub Copilot
|
|
80
|
+
- `GEMINI.md` — Gemini CLI
|
|
81
|
+
- `.windsurfrules` — Windsurf
|
|
82
|
+
- `.clinerules` — Cline
|
|
83
|
+
|
|
84
|
+
Review the diff and merge to keep your AI tools in sync.
|
|
85
|
+
|
|
86
|
+
> Generated by [agents-sync](https://github.com/googlarz/agents-sync)
|
|
87
|
+
branch: "agents-sync/update"
|
|
88
|
+
delete-branch: true
|
|
89
|
+
labels: "ai-context,automated"
|