@googlarz/agents-sync 1.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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +366 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +237 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/loader.d.ts +9 -0
  8. package/dist/config/loader.d.ts.map +1 -0
  9. package/dist/config/loader.js +55 -0
  10. package/dist/config/loader.js.map +1 -0
  11. package/dist/config/schema.d.ts +69 -0
  12. package/dist/config/schema.d.ts.map +1 -0
  13. package/dist/config/schema.js +33 -0
  14. package/dist/config/schema.js.map +1 -0
  15. package/dist/derivers/aider.d.ts +19 -0
  16. package/dist/derivers/aider.d.ts.map +1 -0
  17. package/dist/derivers/aider.js +117 -0
  18. package/dist/derivers/aider.js.map +1 -0
  19. package/dist/derivers/claude.d.ts +19 -0
  20. package/dist/derivers/claude.d.ts.map +1 -0
  21. package/dist/derivers/claude.js +41 -0
  22. package/dist/derivers/claude.js.map +1 -0
  23. package/dist/derivers/cline.d.ts +17 -0
  24. package/dist/derivers/cline.d.ts.map +1 -0
  25. package/dist/derivers/cline.js +92 -0
  26. package/dist/derivers/cline.js.map +1 -0
  27. package/dist/derivers/copilot.d.ts +16 -0
  28. package/dist/derivers/copilot.d.ts.map +1 -0
  29. package/dist/derivers/copilot.js +162 -0
  30. package/dist/derivers/copilot.js.map +1 -0
  31. package/dist/derivers/cursor.d.ts +16 -0
  32. package/dist/derivers/cursor.d.ts.map +1 -0
  33. package/dist/derivers/cursor.js +121 -0
  34. package/dist/derivers/cursor.js.map +1 -0
  35. package/dist/derivers/gemini.d.ts +19 -0
  36. package/dist/derivers/gemini.d.ts.map +1 -0
  37. package/dist/derivers/gemini.js +33 -0
  38. package/dist/derivers/gemini.js.map +1 -0
  39. package/dist/derivers/index.d.ts +33 -0
  40. package/dist/derivers/index.d.ts.map +1 -0
  41. package/dist/derivers/index.js +124 -0
  42. package/dist/derivers/index.js.map +1 -0
  43. package/dist/derivers/merger.d.ts +36 -0
  44. package/dist/derivers/merger.d.ts.map +1 -0
  45. package/dist/derivers/merger.js +83 -0
  46. package/dist/derivers/merger.js.map +1 -0
  47. package/dist/derivers/roo.d.ts +18 -0
  48. package/dist/derivers/roo.d.ts.map +1 -0
  49. package/dist/derivers/roo.js +92 -0
  50. package/dist/derivers/roo.js.map +1 -0
  51. package/dist/derivers/windsurf.d.ts +16 -0
  52. package/dist/derivers/windsurf.d.ts.map +1 -0
  53. package/dist/derivers/windsurf.js +91 -0
  54. package/dist/derivers/windsurf.js.map +1 -0
  55. package/dist/extractor/extractor.d.ts +4 -0
  56. package/dist/extractor/extractor.d.ts.map +1 -0
  57. package/dist/extractor/extractor.js +117 -0
  58. package/dist/extractor/extractor.js.map +1 -0
  59. package/dist/extractor/schema.d.ts +187 -0
  60. package/dist/extractor/schema.d.ts.map +1 -0
  61. package/dist/extractor/schema.js +44 -0
  62. package/dist/extractor/schema.js.map +1 -0
  63. package/dist/generator/agents-md.d.ts +3 -0
  64. package/dist/generator/agents-md.d.ts.map +1 -0
  65. package/dist/generator/agents-md.js +127 -0
  66. package/dist/generator/agents-md.js.map +1 -0
  67. package/dist/generator/validator.d.ts +7 -0
  68. package/dist/generator/validator.d.ts.map +1 -0
  69. package/dist/generator/validator.js +67 -0
  70. package/dist/generator/validator.js.map +1 -0
  71. package/dist/lib/claude-client.d.ts +11 -0
  72. package/dist/lib/claude-client.d.ts.map +1 -0
  73. package/dist/lib/claude-client.js +74 -0
  74. package/dist/lib/claude-client.js.map +1 -0
  75. package/dist/lib/errors.d.ts +10 -0
  76. package/dist/lib/errors.d.ts.map +1 -0
  77. package/dist/lib/errors.js +27 -0
  78. package/dist/lib/errors.js.map +1 -0
  79. package/dist/lib/file-utils.d.ts +7 -0
  80. package/dist/lib/file-utils.d.ts.map +1 -0
  81. package/dist/lib/file-utils.js +56 -0
  82. package/dist/lib/file-utils.js.map +1 -0
  83. package/dist/lib/token-estimate.d.ts +7 -0
  84. package/dist/lib/token-estimate.d.ts.map +1 -0
  85. package/dist/lib/token-estimate.js +15 -0
  86. package/dist/lib/token-estimate.js.map +1 -0
  87. package/dist/scanner/codegraph.d.ts +13 -0
  88. package/dist/scanner/codegraph.d.ts.map +1 -0
  89. package/dist/scanner/codegraph.js +65 -0
  90. package/dist/scanner/codegraph.js.map +1 -0
  91. package/dist/scanner/docs.d.ts +13 -0
  92. package/dist/scanner/docs.d.ts.map +1 -0
  93. package/dist/scanner/docs.js +63 -0
  94. package/dist/scanner/docs.js.map +1 -0
  95. package/dist/scanner/gotchas.d.ts +8 -0
  96. package/dist/scanner/gotchas.d.ts.map +1 -0
  97. package/dist/scanner/gotchas.js +107 -0
  98. package/dist/scanner/gotchas.js.map +1 -0
  99. package/dist/scanner/index.d.ts +21 -0
  100. package/dist/scanner/index.d.ts.map +1 -0
  101. package/dist/scanner/index.js +87 -0
  102. package/dist/scanner/index.js.map +1 -0
  103. package/dist/scanner/manifest.d.ts +13 -0
  104. package/dist/scanner/manifest.d.ts.map +1 -0
  105. package/dist/scanner/manifest.js +285 -0
  106. package/dist/scanner/manifest.js.map +1 -0
  107. package/dist/scanner/mcp.d.ts +12 -0
  108. package/dist/scanner/mcp.d.ts.map +1 -0
  109. package/dist/scanner/mcp.js +96 -0
  110. package/dist/scanner/mcp.js.map +1 -0
  111. package/dist/scanner/repomix.d.ts +11 -0
  112. package/dist/scanner/repomix.d.ts.map +1 -0
  113. package/dist/scanner/repomix.js +87 -0
  114. package/dist/scanner/repomix.js.map +1 -0
  115. package/dist/scanner/skills.d.ts +18 -0
  116. package/dist/scanner/skills.d.ts.map +1 -0
  117. package/dist/scanner/skills.js +100 -0
  118. package/dist/scanner/skills.js.map +1 -0
  119. package/dist/scanner/source.d.ts +13 -0
  120. package/dist/scanner/source.d.ts.map +1 -0
  121. package/dist/scanner/source.js +157 -0
  122. package/dist/scanner/source.js.map +1 -0
  123. package/dist/scanner/structure.d.ts +10 -0
  124. package/dist/scanner/structure.d.ts.map +1 -0
  125. package/dist/scanner/structure.js +168 -0
  126. package/dist/scanner/structure.js.map +1 -0
  127. package/dist/server.d.ts +2 -0
  128. package/dist/server.d.ts.map +1 -0
  129. package/dist/server.js +212 -0
  130. package/dist/server.js.map +1 -0
  131. package/dist/snapshot/drift.d.ts +22 -0
  132. package/dist/snapshot/drift.d.ts.map +1 -0
  133. package/dist/snapshot/drift.js +105 -0
  134. package/dist/snapshot/drift.js.map +1 -0
  135. package/dist/snapshot/schema.d.ts +94 -0
  136. package/dist/snapshot/schema.d.ts.map +1 -0
  137. package/dist/snapshot/schema.js +24 -0
  138. package/dist/snapshot/schema.js.map +1 -0
  139. package/dist/snapshot/writer.d.ts +17 -0
  140. package/dist/snapshot/writer.d.ts.map +1 -0
  141. package/dist/snapshot/writer.js +44 -0
  142. package/dist/snapshot/writer.js.map +1 -0
  143. package/dist/tools/drift.d.ts +15 -0
  144. package/dist/tools/drift.d.ts.map +1 -0
  145. package/dist/tools/drift.js +31 -0
  146. package/dist/tools/drift.js.map +1 -0
  147. package/dist/tools/export.d.ts +14 -0
  148. package/dist/tools/export.d.ts.map +1 -0
  149. package/dist/tools/export.js +53 -0
  150. package/dist/tools/export.js.map +1 -0
  151. package/dist/tools/init.d.ts +28 -0
  152. package/dist/tools/init.d.ts.map +1 -0
  153. package/dist/tools/init.js +103 -0
  154. package/dist/tools/init.js.map +1 -0
  155. package/dist/tools/install-hook.d.ts +15 -0
  156. package/dist/tools/install-hook.d.ts.map +1 -0
  157. package/dist/tools/install-hook.js +169 -0
  158. package/dist/tools/install-hook.js.map +1 -0
  159. package/dist/tools/lint.d.ts +24 -0
  160. package/dist/tools/lint.d.ts.map +1 -0
  161. package/dist/tools/lint.js +213 -0
  162. package/dist/tools/lint.js.map +1 -0
  163. package/dist/tools/scan-report.d.ts +14 -0
  164. package/dist/tools/scan-report.d.ts.map +1 -0
  165. package/dist/tools/scan-report.js +136 -0
  166. package/dist/tools/scan-report.js.map +1 -0
  167. package/dist/tools/status.d.ts +18 -0
  168. package/dist/tools/status.d.ts.map +1 -0
  169. package/dist/tools/status.js +38 -0
  170. package/dist/tools/status.js.map +1 -0
  171. package/dist/tools/sync.d.ts +22 -0
  172. package/dist/tools/sync.d.ts.map +1 -0
  173. package/dist/tools/sync.js +123 -0
  174. package/dist/tools/sync.js.map +1 -0
  175. package/dist/tools/validate.d.ts +22 -0
  176. package/dist/tools/validate.d.ts.map +1 -0
  177. package/dist/tools/validate.js +97 -0
  178. package/dist/tools/validate.js.map +1 -0
  179. package/docs/examples/.clinerules +29 -0
  180. package/docs/examples/.cursorrules +19 -0
  181. package/docs/examples/.windsurfrules +14 -0
  182. package/docs/examples/AGENTS.md +97 -0
  183. package/docs/examples/CLAUDE.md +88 -0
  184. package/docs/examples/GEMINI.md +61 -0
  185. package/docs/examples/copilot-instructions.md +24 -0
  186. package/docs/github-action.yml +89 -0
  187. package/package.json +63 -0
  188. package/scripts/demo.sh +138 -0
  189. package/skill/SKILL.md +158 -0
@@ -0,0 +1,22 @@
1
+ export interface ValidateOptions {
2
+ projectPath: string;
3
+ }
4
+ export type FileStatus = "in-sync" | "drifted" | "missing";
5
+ export interface FileValidation {
6
+ tool: string;
7
+ path: string;
8
+ status: FileStatus;
9
+ details?: string;
10
+ }
11
+ export interface ValidateResult {
12
+ canonical: {
13
+ path: string;
14
+ exists: boolean;
15
+ };
16
+ toolFiles: FileValidation[];
17
+ allInSync: boolean;
18
+ hasSnapshot: boolean;
19
+ report: string;
20
+ }
21
+ export declare function runValidate(options: ValidateOptions): Promise<ValidateResult>;
22
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/tools/validate.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7C,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAqCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAkEnF"}
@@ -0,0 +1,97 @@
1
+ import path from "node:path";
2
+ import crypto from "node:crypto";
3
+ import { assertProjectDir, readFileSafe, fileExists } from "../lib/file-utils.js";
4
+ import { loadSnapshot } from "../snapshot/writer.js";
5
+ function sha256File(content) {
6
+ return crypto.createHash("sha256").update(content).digest("hex");
7
+ }
8
+ const TOOL_PATHS = {
9
+ "agents-md": "AGENTS.md",
10
+ claude: "CLAUDE.md",
11
+ cursor: ".cursorrules",
12
+ copilot: ".github/copilot-instructions.md",
13
+ gemini: "GEMINI.md",
14
+ windsurf: ".windsurfrules",
15
+ cline: ".clinerules",
16
+ };
17
+ function buildReport(canonical, toolFiles, hasSnapshot) {
18
+ const lines = [];
19
+ lines.push(`AGENTS.md (canonical) ${canonical.exists ? "✓" : "✗ MISSING"}`);
20
+ lines.push("");
21
+ for (const f of toolFiles) {
22
+ const icon = f.status === "in-sync" ? "✓" : f.status === "drifted" ? "⚠" : "✗";
23
+ const label = f.status === "in-sync" ? "in sync" : f.status;
24
+ lines.push(`${icon} ${f.tool.padEnd(10)} ${label.padEnd(10)} ${f.path}`);
25
+ if (f.details)
26
+ lines.push(` ${f.details}`);
27
+ }
28
+ if (!hasSnapshot) {
29
+ lines.push("");
30
+ lines.push("No snapshot found. Run init to establish a baseline.");
31
+ }
32
+ return lines.join("\n");
33
+ }
34
+ export async function runValidate(options) {
35
+ await assertProjectDir(options.projectPath);
36
+ const snapshot = await loadSnapshot(options.projectPath);
37
+ const agentsMdPath = path.join(options.projectPath, "AGENTS.md");
38
+ const canonicalExists = await fileExists(agentsMdPath);
39
+ if (!snapshot) {
40
+ // No snapshot: just check which files exist
41
+ const toolFiles = [];
42
+ for (const [tool, relPath] of Object.entries(TOOL_PATHS)) {
43
+ if (tool === "agents-md")
44
+ continue;
45
+ const absPath = path.join(options.projectPath, relPath);
46
+ const exists = await fileExists(absPath);
47
+ toolFiles.push({
48
+ tool,
49
+ path: absPath,
50
+ status: exists ? "drifted" : "missing",
51
+ details: exists ? "No snapshot to compare against" : undefined,
52
+ });
53
+ }
54
+ const result = {
55
+ canonical: { path: agentsMdPath, exists: canonicalExists },
56
+ toolFiles,
57
+ allInSync: false,
58
+ hasSnapshot: false,
59
+ };
60
+ return { ...result, report: buildReport(result.canonical, toolFiles, false) };
61
+ }
62
+ // Compare current file hashes against snapshot
63
+ const toolFiles = [];
64
+ let allInSync = true;
65
+ for (const managed of snapshot.filesManaged) {
66
+ if (managed.tool === "agents-md")
67
+ continue;
68
+ const currentContent = await readFileSafe(managed.path);
69
+ if (!currentContent) {
70
+ toolFiles.push({ tool: managed.tool, path: managed.path, status: "missing" });
71
+ allInSync = false;
72
+ continue;
73
+ }
74
+ const currentHash = sha256File(currentContent);
75
+ if (currentHash !== managed.sha256 && managed.sha256 !== "") {
76
+ toolFiles.push({
77
+ tool: managed.tool,
78
+ path: managed.path,
79
+ status: "drifted",
80
+ details: "File was modified after last sync",
81
+ });
82
+ allInSync = false;
83
+ }
84
+ else {
85
+ toolFiles.push({ tool: managed.tool, path: managed.path, status: "in-sync" });
86
+ }
87
+ }
88
+ const canonical = { path: agentsMdPath, exists: canonicalExists };
89
+ return {
90
+ canonical,
91
+ toolFiles,
92
+ allInSync,
93
+ hasSnapshot: true,
94
+ report: buildReport(canonical, toolFiles, true),
95
+ };
96
+ }
97
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/tools/validate.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAuBrD,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,GAA2B;IACzC,WAAW,EAAE,WAAW;IACxB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,cAAc;IACtB,OAAO,EAAE,iCAAiC;IAC1C,MAAM,EAAE,WAAW;IACnB,QAAQ,EAAE,gBAAgB;IAC1B,KAAK,EAAE,aAAa;CACrB,CAAC;AAEF,SAAS,WAAW,CAClB,SAA4C,EAC5C,SAA2B,EAC3B,WAAoB;IAEpB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,0BAA0B,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,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AED,MAAM,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;QAC/C,IAAI,WAAW,KAAK,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YAC5D,SAAS,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,SAAS;gBACjB,OAAO,EAAE,mCAAmC;aAC7C,CAAC,CAAC;YACH,SAAS,GAAG,KAAK,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IAClE,OAAO;QACL,SAAS;QACT,SAAS;QACT,SAAS;QACT,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,WAAW,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;KAChD,CAAC;AACJ,CAAC"}
@@ -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"
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@googlarz/agents-sync",
3
+ "version": "1.0.0",
4
+ "description": "Write your AI context once. One canonical AGENTS.md auto-derived into CLAUDE.md, .cursorrules, copilot-instructions.md, GEMINI.md, .windsurfrules, and .clinerules.",
5
+ "keywords": ["claude", "cursor", "mcp", "agents", "ai", "codegen", "context", "agentsmd", "cursorrules", "windsurf", "cline", "gemini", "agents-sync"],
6
+ "homepage": "https://github.com/googlarz/agents-sync#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/googlarz/agents-sync.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/googlarz/agents-sync/issues"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "registry": "https://registry.npmjs.org/"
17
+ },
18
+ "author": "googlarz",
19
+ "license": "MIT",
20
+ "type": "module",
21
+ "main": "dist/server.js",
22
+ "bin": {
23
+ "agents-sync": "dist/cli.js"
24
+ },
25
+ "files": [
26
+ "dist/",
27
+ "skill/",
28
+ "docs/",
29
+ "scripts/",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "dev": "tsc --watch",
39
+ "typecheck": "tsc --noEmit",
40
+ "lint": "eslint src --ext .ts",
41
+ "lint:fix": "eslint src --ext .ts --fix",
42
+ "test": "vitest run --reporter verbose",
43
+ "test:watch": "vitest",
44
+ "test:integration": "INTEGRATION=1 vitest run tests/integration --reporter verbose",
45
+ "test:coverage": "vitest run --coverage",
46
+ "prepublishOnly": "npm run build && npm test"
47
+ },
48
+ "dependencies": {
49
+ "@anthropic-ai/sdk": "^0.39.0",
50
+ "@modelcontextprotocol/sdk": "^1.12.0",
51
+ "fast-glob": "^3.3.3",
52
+ "zod": "^3.24.4"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^22.15.21",
56
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
57
+ "@typescript-eslint/parser": "^8.32.1",
58
+ "@vitest/coverage-v8": "^3.1.4",
59
+ "eslint": "^9.27.0",
60
+ "typescript": "^5.8.3",
61
+ "vitest": "^3.1.4"
62
+ }
63
+ }