@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 googlarz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# agents-sync
|
|
4
|
+
|
|
5
|
+
**Write your AI context once. Every tool stays in sync — automatically.**
|
|
6
|
+
|
|
7
|
+
**9 AI tools · drifts detected in milliseconds · 100% local · ~$0.05–0.10 per sync**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@googlarz/agents-sync)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://nodejs.org)
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
[](https://claude.ai/code)
|
|
18
|
+
[](https://cursor.com)
|
|
19
|
+
[](https://github.com/openai/codex)
|
|
20
|
+
[](https://opencode.ai)
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## The Problem
|
|
27
|
+
|
|
28
|
+
You migrated from Prisma to Drizzle three weeks ago. You updated `CLAUDE.md`. Last Thursday, your colleague opened the project in Cursor — `.cursorrules` still said "use Prisma ORM". They wrote a new migration using Prisma. The PR landed on Friday. You found it Monday morning.
|
|
29
|
+
|
|
30
|
+
That's the problem. Every AI coding tool expects its own context file:
|
|
31
|
+
|
|
32
|
+
| Tool | File |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Claude Code | `CLAUDE.md` |
|
|
35
|
+
| Cursor | `.cursorrules` |
|
|
36
|
+
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
37
|
+
| Codex / opencode / Amp | `AGENTS.md` |
|
|
38
|
+
| Gemini CLI | `GEMINI.md` |
|
|
39
|
+
| Windsurf | `.windsurfrules` |
|
|
40
|
+
| Cline | `.clinerules` |
|
|
41
|
+
| Roo Code | `.roomodes` |
|
|
42
|
+
| Aider | `CONVENTIONS.md` |
|
|
43
|
+
|
|
44
|
+
Maintain them manually and they drift. `agents-sync` generates all of them from a single canonical `AGENTS.md` — derived from your actual codebase, updated whenever your stack changes.
|
|
45
|
+
|
|
46
|
+
This is [GitHub issue #6235](https://github.com/anthropics/claude-code/issues/6235) — **AGENTS.md portability**, **3,914 upvotes**, the most demanded feature in the Claude Code repo.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
**Step 1 — scan your project (no API key, no cost):**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx @googlarz/agents-sync scan .
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
agents-sync scan — my-app
|
|
60
|
+
|
|
61
|
+
▸ Project
|
|
62
|
+
Language: typescript
|
|
63
|
+
Framework: next.js
|
|
64
|
+
Runtime: node
|
|
65
|
+
Pkg manager: npm
|
|
66
|
+
|
|
67
|
+
▸ Dependencies
|
|
68
|
+
31 production, 22 dev
|
|
69
|
+
Notable: next, react, drizzle-orm, @auth/core, zod, tailwindcss +25 more
|
|
70
|
+
|
|
71
|
+
▸ Structure
|
|
72
|
+
Top-level dirs: src, public, drizzle
|
|
73
|
+
Total files: ~412
|
|
74
|
+
Entry points: src/app/page.tsx
|
|
75
|
+
Test dirs: src
|
|
76
|
+
|
|
77
|
+
▸ MCP Servers (.claude/settings.json)
|
|
78
|
+
✓ postgres — PostgreSQL database access
|
|
79
|
+
✓ github — GitHub API integration
|
|
80
|
+
|
|
81
|
+
▸ Local Skills & Commands
|
|
82
|
+
✓ /deploy — Production deployment checklist
|
|
83
|
+
✓ /db-migrate — Database migration workflow
|
|
84
|
+
|
|
85
|
+
▸ Gotchas found in source
|
|
86
|
+
FIXME src/lib/auth.ts:42 — token refresh race condition, needs mutex
|
|
87
|
+
HACK src/db/client.ts:17 — direct pool access bypasses connection limit
|
|
88
|
+
TODO src/api/webhooks.ts:91 — validate Stripe signature before processing
|
|
89
|
+
|
|
90
|
+
Scanned in 287ms · ~21,400 tokens of context
|
|
91
|
+
|
|
92
|
+
→ Ready to init. Run:
|
|
93
|
+
ANTHROPIC_API_KEY=<key> npx @googlarz/agents-sync init .
|
|
94
|
+
Get a key: https://console.anthropic.com/
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Step 2 — generate all context files (~$0.05–0.10, runs once):**
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
ANTHROPIC_API_KEY=sk-ant-... npx @googlarz/agents-sync init .
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
✓ AGENTS.md → /your/project/AGENTS.md
|
|
105
|
+
✓ claude → /your/project/CLAUDE.md
|
|
106
|
+
✓ cursor → /your/project/.cursorrules
|
|
107
|
+
✓ copilot → /your/project/.github/copilot-instructions.md
|
|
108
|
+
✓ gemini → /your/project/GEMINI.md
|
|
109
|
+
✓ windsurf → /your/project/.windsurfrules
|
|
110
|
+
✓ cline → /your/project/.clinerules
|
|
111
|
+
✓ roo → /your/project/.roomodes
|
|
112
|
+
✓ aider → /your/project/CONVENTIONS.md
|
|
113
|
+
|
|
114
|
+
✓ Snapshot saved to .agents-sync/
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Add `AGENTS.md` to git. Add `.agents-sync/` to `.gitignore`.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## What Gets Generated
|
|
122
|
+
|
|
123
|
+
<details>
|
|
124
|
+
<summary><strong>Sample AGENTS.md</strong></summary>
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
# AGENTS.md
|
|
128
|
+
|
|
129
|
+
<!-- Generated by agents-sync v1.4.0 on 2026-05-20 -->
|
|
130
|
+
|
|
131
|
+
## Project Overview
|
|
132
|
+
my-app is a SaaS dashboard built with Next.js 15 App Router, PostgreSQL
|
|
133
|
+
via Drizzle ORM, and Auth.js v5 for authentication.
|
|
134
|
+
|
|
135
|
+
## Tech Stack
|
|
136
|
+
- TypeScript / Next.js 15 (App Router)
|
|
137
|
+
- PostgreSQL via Drizzle ORM
|
|
138
|
+
- Authentication: Auth.js v5
|
|
139
|
+
- Testing: Vitest (co-located)
|
|
140
|
+
- Deploy: Vercel
|
|
141
|
+
|
|
142
|
+
## Architecture
|
|
143
|
+
- `src/app/` — Next.js pages and layouts (App Router)
|
|
144
|
+
- `src/features/` — feature modules (billing, users, dashboard)
|
|
145
|
+
- `src/lib/` — shared utilities: db singleton, auth config, api client
|
|
146
|
+
- `src/components/` — shared UI components (shadcn/ui)
|
|
147
|
+
|
|
148
|
+
## Conventions
|
|
149
|
+
1. kebab-case filenames throughout
|
|
150
|
+
2. Named exports only — no default exports except Next.js page/layout components
|
|
151
|
+
3. All external input validated with Zod before use
|
|
152
|
+
4. Co-locate tests: `Button.test.tsx` next to `Button.tsx`
|
|
153
|
+
5. Server components by default; `"use client"` only when required
|
|
154
|
+
|
|
155
|
+
## Gotchas
|
|
156
|
+
1. Never import the db client directly — use `lib/db.ts` singleton.
|
|
157
|
+
Direct imports cause connection pool exhaustion in serverless.
|
|
158
|
+
2. All API routes require auth middleware — check `middleware.ts` first.
|
|
159
|
+
3. `src/lib/auth.ts:42` has a known token refresh race condition.
|
|
160
|
+
Workaround in place; do not remove the mutex.
|
|
161
|
+
|
|
162
|
+
## Boundaries
|
|
163
|
+
|
|
164
|
+
### Never
|
|
165
|
+
- Commit `.env` or `.env.local`
|
|
166
|
+
- Import `db` outside of `lib/db.ts`
|
|
167
|
+
- Use `any` type — use `unknown` and narrow
|
|
168
|
+
- Bypass auth middleware on new API routes
|
|
169
|
+
|
|
170
|
+
## MCP Servers
|
|
171
|
+
- **postgres** — PostgreSQL database access (read/write)
|
|
172
|
+
- **github** — GitHub API: issues, PRs, code search
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
</details>
|
|
176
|
+
|
|
177
|
+
<details>
|
|
178
|
+
<summary><strong>What CLAUDE.md adds on top of AGENTS.md</strong></summary>
|
|
179
|
+
|
|
180
|
+
- **MCP server documentation** — each detected server with its purpose and key operations
|
|
181
|
+
- **Skill recommendations** — stack-aware suggestions (e.g. `test-driven-development` for Vitest projects, `debugging-and-error-recovery` for Express APIs)
|
|
182
|
+
- **Local commands** — your project's `.claude/commands/` and `.claude/skills/` documented for Claude
|
|
183
|
+
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Custom Sections
|
|
189
|
+
|
|
190
|
+
Manual additions you make to any managed file survive every resync:
|
|
191
|
+
|
|
192
|
+
```markdown
|
|
193
|
+
<!-- AGENTS-SYNC:CUSTOM:START -->
|
|
194
|
+
## Team Notes
|
|
195
|
+
- Payments work: check with @alice before shipping anything in src/billing/
|
|
196
|
+
- Use staging Stripe keys (in .env.staging) for all local testing
|
|
197
|
+
- The `/api/webhooks/stripe` endpoint must stay idempotent — see ADR-007
|
|
198
|
+
<!-- AGENTS-SYNC:CUSTOM:END -->
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Run `/agents-sync sync` next week after adding three new dependencies. Your team notes are untouched. The stack section is updated.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Setup
|
|
206
|
+
|
|
207
|
+
### Claude Code
|
|
208
|
+
|
|
209
|
+
Add to `~/.claude/claude_desktop_config.json` or your project's `.claude/settings.json`:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"mcpServers": {
|
|
214
|
+
"agents-sync": {
|
|
215
|
+
"command": "npx",
|
|
216
|
+
"args": ["@googlarz/agents-sync"],
|
|
217
|
+
"env": { "ANTHROPIC_API_KEY": "sk-ant-..." }
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Restart Claude Code. Then: `/agents-sync init` in any project.
|
|
224
|
+
|
|
225
|
+
### Cursor
|
|
226
|
+
|
|
227
|
+
Add to `.cursor/mcp.json` in your project:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"mcpServers": {
|
|
232
|
+
"agents-sync": {
|
|
233
|
+
"command": "npx",
|
|
234
|
+
"args": ["@googlarz/agents-sync"],
|
|
235
|
+
"env": { "ANTHROPIC_API_KEY": "sk-ant-..." }
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Codex CLI
|
|
242
|
+
|
|
243
|
+
Add to `~/.codex/config.toml`:
|
|
244
|
+
|
|
245
|
+
```toml
|
|
246
|
+
[mcp_servers.agents-sync]
|
|
247
|
+
command = "npx"
|
|
248
|
+
args = ["@googlarz/agents-sync"]
|
|
249
|
+
env = { ANTHROPIC_API_KEY = "sk-ant-..." }
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### opencode
|
|
253
|
+
|
|
254
|
+
Add to `~/.config/opencode/config.json`:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"mcpServers": {
|
|
259
|
+
"agents-sync": {
|
|
260
|
+
"type": "local",
|
|
261
|
+
"command": ["npx", "@googlarz/agents-sync"],
|
|
262
|
+
"environment": { "ANTHROPIC_API_KEY": "sk-ant-..." }
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
> **Codex / opencode users:** agents-sync uses the Anthropic API only for `init` and `sync`. All read commands (`scan`, `drift`, `lint`, `validate`, `status`, `export`) make zero API calls. The free tier at [console.anthropic.com](https://console.anthropic.com/) covers occasional syncs.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Usage
|
|
273
|
+
|
|
274
|
+
### Keep context fresh — check for drift
|
|
275
|
+
|
|
276
|
+
After any significant change (new dependency, new directory, architecture shift):
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npx @googlarz/agents-sync drift .
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
agents-sync drift report (2026-05-20)
|
|
284
|
+
Last sync: 12 days ago
|
|
285
|
+
|
|
286
|
+
HIGH New dependency detected: drizzle-orm
|
|
287
|
+
(package.json changed — possible architecture shift)
|
|
288
|
+
HIGH New top-level directory: src/workers/
|
|
289
|
+
|
|
290
|
+
MED 3 new files with new naming pattern
|
|
291
|
+
|
|
292
|
+
→ Re-sync recommended. Run: agents-sync sync .
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Re-sync
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
ANTHROPIC_API_KEY=sk-ant-... npx @googlarz/agents-sync sync .
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
✓ claude → /your/project/CLAUDE.md
|
|
303
|
+
✓ cursor → /your/project/.cursorrules
|
|
304
|
+
✓ copilot → /your/project/.github/copilot-instructions.md
|
|
305
|
+
|
|
306
|
+
2 custom section(s) preserved
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Lint — enforce your own rules
|
|
310
|
+
|
|
311
|
+
`agents-sync lint` checks your codebase against every mechanically-verifiable `Never` rule in `AGENTS.md`. Zero setup — the rules come from what Claude extracted about your project.
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
npx @googlarz/agents-sync lint .
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
⚠ 2 violation(s) found
|
|
319
|
+
|
|
320
|
+
any-type src/api/webhook.ts:34 parameter typed as 'any' — use 'unknown'
|
|
321
|
+
direct-db src/jobs/cleanup.ts:12 direct db import outside lib/db.ts
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Use `--ci` to exit 1 in CI pipelines.
|
|
325
|
+
|
|
326
|
+
### Validate — check files are in sync
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
npx @googlarz/agents-sync validate .
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
```
|
|
333
|
+
AGENTS.md (canonical) ✓
|
|
334
|
+
|
|
335
|
+
✓ claude in sync CLAUDE.md
|
|
336
|
+
⚠ cursor DRIFTED .cursorrules (modified after last sync)
|
|
337
|
+
✓ copilot in sync .github/copilot-instructions.md
|
|
338
|
+
|
|
339
|
+
→ Run agents-sync sync to fix.
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
<details>
|
|
343
|
+
<summary><strong>Full CLI reference</strong></summary>
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
npx @googlarz/agents-sync scan . # No API key — see what scanner detects
|
|
347
|
+
npx @googlarz/agents-sync init . # Generate all context files
|
|
348
|
+
npx @googlarz/agents-sync sync . # Re-sync after codebase changes
|
|
349
|
+
npx @googlarz/agents-sync drift . # Check what changed
|
|
350
|
+
npx @googlarz/agents-sync lint . # Verify codebase against Never rules
|
|
351
|
+
npx @googlarz/agents-sync validate . # Check files match AGENTS.md
|
|
352
|
+
npx @googlarz/agents-sync export cursor . # Re-derive one file (no API call)
|
|
353
|
+
npx @googlarz/agents-sync status . # Show sync status
|
|
354
|
+
|
|
355
|
+
npx @googlarz/agents-sync drift . --ci # Exit 1 on HIGH drift (CI)
|
|
356
|
+
npx @googlarz/agents-sync lint . --ci # Exit 1 on any violation (CI)
|
|
357
|
+
npx @googlarz/agents-sync init . --dry-run # Preview without writing
|
|
358
|
+
npx @googlarz/agents-sync init . --tools claude,cursor,roo # Specific tools only
|
|
359
|
+
npx @googlarz/agents-sync sync . --fast # Skip API call if drift is minor
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
</details>
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## GitHub Action
|
|
367
|
+
|
|
368
|
+
Automatically open a PR when drift goes HIGH. Copy [`docs/github-action.yml`](docs/github-action.yml) to `.github/workflows/agents-sync.yml`, add `ANTHROPIC_API_KEY` to repository secrets.
|
|
369
|
+
|
|
370
|
+
The workflow triggers on `package.json` / `pyproject.toml` / `Cargo.toml` / `go.mod` changes and runs weekly. When drift is HIGH it re-syncs and opens a PR for review.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## How It Works
|
|
375
|
+
|
|
376
|
+
<details>
|
|
377
|
+
<summary><strong>Pipeline details</strong></summary>
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
Your codebase
|
|
381
|
+
│
|
|
382
|
+
▼
|
|
383
|
+
[scan] package manifests · directory tree · source samples
|
|
384
|
+
README · FIXME/HACK/TODO comments · MCP servers · local skills
|
|
385
|
+
│
|
|
386
|
+
▼
|
|
387
|
+
[extract] Claude API (claude-sonnet-4-6) → structured project metadata
|
|
388
|
+
stack · conventions · gotchas · architecture · boundaries
|
|
389
|
+
│
|
|
390
|
+
▼
|
|
391
|
+
[generate] canonical AGENTS.md ←── one source of truth
|
|
392
|
+
│
|
|
393
|
+
├──▶ AGENTS.md (read directly by Codex CLI and opencode)
|
|
394
|
+
├──▶ CLAUDE.md (superset + MCP docs + skill recommendations)
|
|
395
|
+
├──▶ .cursorrules (directive-style, < 400 words)
|
|
396
|
+
├──▶ .github/copilot-instructions.md (code-level focus, < 300 words)
|
|
397
|
+
├──▶ GEMINI.md (full AGENTS.md + Gemini CLI section)
|
|
398
|
+
├──▶ .windsurfrules (directive-style, < 400 words)
|
|
399
|
+
├──▶ .clinerules (Always/Never sections, < 400 words)
|
|
400
|
+
├──▶ .roomodes (Roo Code custom modes)
|
|
401
|
+
└──▶ CONVENTIONS.md (Aider conventions file)
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The scanner runs entirely locally. Only the extract step calls the API. Drift detection, validation, lint, and export are all local.
|
|
405
|
+
|
|
406
|
+
</details>
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Troubleshooting
|
|
411
|
+
|
|
412
|
+
**"ANTHROPIC_API_KEY not set"**
|
|
413
|
+
Only `init` and `sync` need the key. Run `scan` first — it shows what was detected and prints the exact command to run once you have a key.
|
|
414
|
+
|
|
415
|
+
**"My AGENTS.md looks wrong / missed something important"**
|
|
416
|
+
Run `agents-sync sync .` to regenerate from the current codebase state. If the scanner missed something structural, check that your project has a recognizable manifest file (`package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`).
|
|
417
|
+
|
|
418
|
+
**"I edited CLAUDE.md manually and sync overwrites my changes"**
|
|
419
|
+
Wrap your additions in a custom section:
|
|
420
|
+
```markdown
|
|
421
|
+
<!-- AGENTS-SYNC:CUSTOM:START -->
|
|
422
|
+
your content here
|
|
423
|
+
<!-- AGENTS-SYNC:CUSTOM:END -->
|
|
424
|
+
```
|
|
425
|
+
Everything inside those markers survives every sync.
|
|
426
|
+
|
|
427
|
+
**"Drift says HIGH but I only changed one file"**
|
|
428
|
+
Drift scores are based on structural signals (new dependencies, new directories, naming pattern changes). A single `package.json` change that adds a major dependency triggers HIGH. That's intentional — architecture assumptions may need updating.
|
|
429
|
+
|
|
430
|
+
**"How much does each sync cost?"**
|
|
431
|
+
Typically $0.05–0.10 using `claude-sonnet-4-6`. Syncs on previously-indexed projects are cheaper due to prompt caching. Use `--fast` to skip the API call entirely when drift is minor.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Environment Variables
|
|
436
|
+
|
|
437
|
+
| Variable | Required | Description |
|
|
438
|
+
|---|---|---|
|
|
439
|
+
| `ANTHROPIC_API_KEY` | For `init` and `sync` only | Your Anthropic API key |
|
|
440
|
+
| `AGENTS_SYNC_DEBUG=1` | No | Verbose debug output to stderr |
|
|
441
|
+
| `NO_COLOR=1` | No | Disable ANSI color |
|
|
442
|
+
|
|
443
|
+
`scan`, `drift`, `validate`, `status`, `export`, and `lint` never call the API.
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
<details>
|
|
448
|
+
<summary><strong>MCP Tools Reference</strong></summary>
|
|
449
|
+
|
|
450
|
+
| Tool | Description |
|
|
451
|
+
|---|---|
|
|
452
|
+
| `agents_sync_scan` | Show what scanner detected — no API key needed |
|
|
453
|
+
| `agents_sync_init` | Full init: scan, extract, generate, derive, snapshot |
|
|
454
|
+
| `agents_sync_sync` | Re-sync from current codebase state |
|
|
455
|
+
| `agents_sync_drift` | Check what changed since last sync (read-only) |
|
|
456
|
+
| `agents_sync_export` | Re-derive a single tool file (no API call) |
|
|
457
|
+
| `agents_sync_validate` | Check if all tool files match AGENTS.md |
|
|
458
|
+
| `agents_sync_status` | Show sync status and managed files |
|
|
459
|
+
| `agents_sync_lint` | Verify codebase against Never rules in AGENTS.md |
|
|
460
|
+
|
|
461
|
+
</details>
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Supported Stacks
|
|
466
|
+
|
|
467
|
+
- **TypeScript/JavaScript**: Next.js, Express, Fastify, Remix, SvelteKit, Vite
|
|
468
|
+
- **Python**: Django, FastAPI, Flask
|
|
469
|
+
- **Rust**: Cargo workspaces, Axum, Actix
|
|
470
|
+
- **Go**: standard modules, Gin, Echo
|
|
471
|
+
- **PHP**: Composer projects, Laravel
|
|
472
|
+
|
|
473
|
+
Language-agnostic — works on any codebase with a manifest file.
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Contributing
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
git clone https://github.com/googlarz/agents-sync
|
|
481
|
+
cd agents-sync
|
|
482
|
+
npm install
|
|
483
|
+
npm run dev # watch mode
|
|
484
|
+
npm test # 116 unit tests, no API key needed
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Integration tests (require `ANTHROPIC_API_KEY`, run against real fixtures):
|
|
488
|
+
|
|
489
|
+
```bash
|
|
490
|
+
npm run test:integration
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## License
|
|
496
|
+
|
|
497
|
+
MIT
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
<div align="center">
|
|
502
|
+
|
|
503
|
+
**Built for the vibe coding era — when your AI tools should know your codebase as well as you do.**
|
|
504
|
+
|
|
505
|
+
[Report a bug](https://github.com/googlarz/agents-sync/issues) · [Request a feature](https://github.com/googlarz/agents-sync/issues) · [Roadmap](ROADMAP.md)
|
|
506
|
+
|
|
507
|
+
</div>
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|