project-context-ai 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 (93) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +313 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/context/hasher.d.ts +7 -0
  6. package/dist/context/hasher.d.ts.map +1 -0
  7. package/dist/context/hasher.js +44 -0
  8. package/dist/context/hasher.js.map +1 -0
  9. package/dist/context/store.d.ts +7 -0
  10. package/dist/context/store.d.ts.map +1 -0
  11. package/dist/context/store.js +62 -0
  12. package/dist/context/store.js.map +1 -0
  13. package/dist/detect-ide.d.ts +9 -0
  14. package/dist/detect-ide.d.ts.map +1 -0
  15. package/dist/detect-ide.js +83 -0
  16. package/dist/detect-ide.js.map +1 -0
  17. package/dist/generators/claude.d.ts +3 -0
  18. package/dist/generators/claude.d.ts.map +1 -0
  19. package/dist/generators/claude.js +32 -0
  20. package/dist/generators/claude.js.map +1 -0
  21. package/dist/generators/codex.d.ts +3 -0
  22. package/dist/generators/codex.d.ts.map +1 -0
  23. package/dist/generators/codex.js +39 -0
  24. package/dist/generators/codex.js.map +1 -0
  25. package/dist/generators/copilot.d.ts +3 -0
  26. package/dist/generators/copilot.d.ts.map +1 -0
  27. package/dist/generators/copilot.js +32 -0
  28. package/dist/generators/copilot.js.map +1 -0
  29. package/dist/generators/cursor.d.ts +3 -0
  30. package/dist/generators/cursor.d.ts.map +1 -0
  31. package/dist/generators/cursor.js +39 -0
  32. package/dist/generators/cursor.js.map +1 -0
  33. package/dist/generators/gemini.d.ts +3 -0
  34. package/dist/generators/gemini.d.ts.map +1 -0
  35. package/dist/generators/gemini.js +32 -0
  36. package/dist/generators/gemini.js.map +1 -0
  37. package/dist/generators/index.d.ts +5 -0
  38. package/dist/generators/index.d.ts.map +1 -0
  39. package/dist/generators/index.js +40 -0
  40. package/dist/generators/index.js.map +1 -0
  41. package/dist/generators/template.d.ts +9 -0
  42. package/dist/generators/template.d.ts.map +1 -0
  43. package/dist/generators/template.js +128 -0
  44. package/dist/generators/template.js.map +1 -0
  45. package/dist/generators/windsurf.d.ts +3 -0
  46. package/dist/generators/windsurf.d.ts.map +1 -0
  47. package/dist/generators/windsurf.js +32 -0
  48. package/dist/generators/windsurf.js.map +1 -0
  49. package/dist/git/diff.d.ts +6 -0
  50. package/dist/git/diff.d.ts.map +1 -0
  51. package/dist/git/diff.js +73 -0
  52. package/dist/git/diff.js.map +1 -0
  53. package/dist/git/hooks.d.ts +9 -0
  54. package/dist/git/hooks.d.ts.map +1 -0
  55. package/dist/git/hooks.js +70 -0
  56. package/dist/git/hooks.js.map +1 -0
  57. package/dist/index.d.ts +9 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +8 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/scanner/conventions.d.ts +3 -0
  62. package/dist/scanner/conventions.d.ts.map +1 -0
  63. package/dist/scanner/conventions.js +132 -0
  64. package/dist/scanner/conventions.js.map +1 -0
  65. package/dist/scanner/dependencies.d.ts +3 -0
  66. package/dist/scanner/dependencies.d.ts.map +1 -0
  67. package/dist/scanner/dependencies.js +219 -0
  68. package/dist/scanner/dependencies.js.map +1 -0
  69. package/dist/scanner/frameworks.d.ts +3 -0
  70. package/dist/scanner/frameworks.d.ts.map +1 -0
  71. package/dist/scanner/frameworks.js +86 -0
  72. package/dist/scanner/frameworks.js.map +1 -0
  73. package/dist/scanner/index.d.ts +3 -0
  74. package/dist/scanner/index.d.ts.map +1 -0
  75. package/dist/scanner/index.js +126 -0
  76. package/dist/scanner/index.js.map +1 -0
  77. package/dist/scanner/structure.d.ts +7 -0
  78. package/dist/scanner/structure.d.ts.map +1 -0
  79. package/dist/scanner/structure.js +153 -0
  80. package/dist/scanner/structure.js.map +1 -0
  81. package/dist/types.d.ts +72 -0
  82. package/dist/types.d.ts.map +1 -0
  83. package/dist/types.js +2 -0
  84. package/dist/types.js.map +1 -0
  85. package/dist/utils/files.d.ts +12 -0
  86. package/dist/utils/files.d.ts.map +1 -0
  87. package/dist/utils/files.js +107 -0
  88. package/dist/utils/files.js.map +1 -0
  89. package/dist/utils/logger.d.ts +9 -0
  90. package/dist/utils/logger.d.ts.map +1 -0
  91. package/dist/utils/logger.js +10 -0
  92. package/dist/utils/logger.js.map +1 -0
  93. package/package.json +48 -0
@@ -0,0 +1,126 @@
1
+ import { join } from "node:path";
2
+ import { readJsonFile } from "../utils/files.js";
3
+ import { scanStructure } from "./structure.js";
4
+ import { scanDependencies } from "./dependencies.js";
5
+ import { detectFrameworks } from "./frameworks.js";
6
+ import { detectConventions } from "./conventions.js";
7
+ import { computeFileHashes } from "../context/hasher.js";
8
+ export async function scanProject(rootPath, filesToScan) {
9
+ // 1. Scan directory structure
10
+ const { directories, keyFiles, allFiles } = await scanStructure(rootPath);
11
+ const targetFiles = filesToScan || allFiles;
12
+ // 2. Scan dependencies
13
+ const dependencies = await scanDependencies(rootPath, allFiles);
14
+ const allDeps = [...dependencies.runtime, ...dependencies.dev];
15
+ // 3. Detect frameworks
16
+ const frameworks = detectFrameworks(allDeps, allFiles);
17
+ // 4. Detect conventions
18
+ const conventions = detectConventions(allFiles, frameworks, allDeps);
19
+ // 5. Read scripts
20
+ const pkgJson = await readJsonFile(join(rootPath, "package.json"));
21
+ const scripts = pkgJson?.scripts || {};
22
+ // 6. Detect project meta
23
+ const meta = detectProjectMeta(rootPath, pkgJson, allFiles, frameworks);
24
+ // 7. Detect entry points
25
+ const entryPoints = detectEntryPoints(allFiles, frameworks);
26
+ // 8. Compute file hashes
27
+ const fileHashes = await computeFileHashes(rootPath, targetFiles);
28
+ const context = {
29
+ meta,
30
+ structure: directories,
31
+ dependencies,
32
+ frameworks,
33
+ scripts,
34
+ conventions,
35
+ entryPoints,
36
+ keyFiles,
37
+ };
38
+ return { context, fileHashes };
39
+ }
40
+ function detectProjectMeta(rootPath, pkgJson, allFiles, frameworks) {
41
+ const name = pkgJson?.name || rootPath.split(/[/\\]/).pop() || "unknown";
42
+ const version = pkgJson?.version || "0.0.0";
43
+ const description = pkgJson?.description || "";
44
+ const languages = detectLanguages(allFiles);
45
+ const type = detectProjectType(allFiles, frameworks);
46
+ return { name, version, description, languages, type, rootPath };
47
+ }
48
+ function detectLanguages(files) {
49
+ const extMap = {
50
+ ts: "TypeScript", tsx: "TypeScript",
51
+ js: "JavaScript", jsx: "JavaScript", mjs: "JavaScript",
52
+ py: "Python",
53
+ go: "Go",
54
+ rs: "Rust",
55
+ java: "Java",
56
+ kt: "Kotlin",
57
+ rb: "Ruby",
58
+ php: "PHP",
59
+ cs: "C#",
60
+ cpp: "C++", cc: "C++",
61
+ c: "C",
62
+ swift: "Swift",
63
+ dart: "Dart",
64
+ ex: "Elixir", exs: "Elixir",
65
+ lua: "Lua",
66
+ zig: "Zig",
67
+ };
68
+ const langCounts = {};
69
+ for (const file of files) {
70
+ const ext = file.split(".").pop()?.toLowerCase() || "";
71
+ const lang = extMap[ext];
72
+ if (lang) {
73
+ langCounts[lang] = (langCounts[lang] || 0) + 1;
74
+ }
75
+ }
76
+ return Object.entries(langCounts)
77
+ .sort((a, b) => b[1] - a[1])
78
+ .map(([lang]) => lang);
79
+ }
80
+ function detectProjectType(files, frameworks) {
81
+ const fwNames = frameworks.map((f) => f.name);
82
+ const hasPackages = files.some((f) => f.startsWith("packages/"));
83
+ const hasApps = files.some((f) => f.startsWith("apps/"));
84
+ const hasApi = files.some((f) => f.includes("api/")) || fwNames.some((n) => ["Express", "Fastify", "NestJS", "Hono", "Koa"].includes(n));
85
+ const hasFrontend = fwNames.some((n) => ["React", "Vue.js", "Angular", "Svelte"].includes(n));
86
+ const hasFullstack = fwNames.some((n) => ["Next.js", "Nuxt", "Remix", "SvelteKit"].includes(n));
87
+ const hasBin = files.some((f) => f.includes("bin/") || f.includes("cli"));
88
+ if (hasPackages || hasApps)
89
+ return "monorepo";
90
+ if (hasFullstack)
91
+ return "fullstack";
92
+ if (hasFrontend && hasApi)
93
+ return "fullstack";
94
+ if (hasFrontend)
95
+ return "web-app";
96
+ if (hasApi)
97
+ return "api";
98
+ if (hasBin)
99
+ return "cli";
100
+ if (files.some((f) => f.includes("index.d.ts") || f.includes("lib/")))
101
+ return "library";
102
+ return "unknown";
103
+ }
104
+ function detectEntryPoints(files, frameworks) {
105
+ const entries = [];
106
+ const fwNames = frameworks.map((f) => f.name);
107
+ const commonEntries = [
108
+ "src/index.ts", "src/index.tsx", "src/index.js",
109
+ "src/main.ts", "src/main.tsx", "src/main.js",
110
+ "src/app.ts", "src/app.tsx", "src/app.js",
111
+ "src/server.ts", "src/server.js",
112
+ "app/layout.tsx", "app/layout.ts",
113
+ "app/page.tsx", "app/page.ts",
114
+ "pages/_app.tsx", "pages/_app.ts",
115
+ "pages/index.tsx", "pages/index.ts",
116
+ "main.py", "app.py", "manage.py",
117
+ "main.go", "cmd/main.go",
118
+ "src/main.rs", "src/lib.rs",
119
+ ];
120
+ for (const entry of commonEntries) {
121
+ if (files.includes(entry))
122
+ entries.push(entry);
123
+ }
124
+ return entries;
125
+ }
126
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scanner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,WAAsB;IAEtB,8BAA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G;QACpB,cAAc,EAAE,eAAe,EAAE,cAAc;QAC/C,aAAa,EAAE,cAAc,EAAE,aAAa;QAC5C,YAAY,EAAE,aAAa,EAAE,YAAY;QACzC,eAAe,EAAE,eAAe;QAChC,gBAAgB,EAAE,eAAe;QACjC,cAAc,EAAE,aAAa;QAC7B,gBAAgB,EAAE,eAAe;QACjC,iBAAiB,EAAE,gBAAgB;QACnC,SAAS,EAAE,QAAQ,EAAE,WAAW;QAChC,SAAS,EAAE,aAAa;QACxB,aAAa,EAAE,YAAY;KAC5B,CAAC;IAEF,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;QAClC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DirectoryEntry, KeyFile } from "../types.js";
2
+ export declare function scanStructure(rootPath: string): Promise<{
3
+ directories: DirectoryEntry[];
4
+ keyFiles: KeyFile[];
5
+ allFiles: string[];
6
+ }>;
7
+ //# sourceMappingURL=structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/scanner/structure.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgH3D,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoCrF"}
@@ -0,0 +1,153 @@
1
+ import { walkDirectory, countFilesByExtension } from "../utils/files.js";
2
+ const DIR_DESCRIPTIONS = {
3
+ src: "Main source code",
4
+ lib: "Library/shared code",
5
+ app: "Application entry (Next.js App Router / similar)",
6
+ pages: "Page components / routes",
7
+ components: "UI components",
8
+ hooks: "Custom React hooks",
9
+ utils: "Utility functions",
10
+ helpers: "Helper functions",
11
+ services: "Service layer / API clients",
12
+ api: "API routes / endpoints",
13
+ routes: "Route definitions",
14
+ controllers: "Request controllers",
15
+ middleware: "Middleware functions",
16
+ models: "Data models / schemas",
17
+ entities: "Database entities",
18
+ repositories: "Data access layer",
19
+ types: "Type definitions",
20
+ interfaces: "Interface definitions",
21
+ config: "Configuration files",
22
+ constants: "Constant values",
23
+ assets: "Static assets (images, fonts, etc.)",
24
+ public: "Public static files",
25
+ static: "Static files",
26
+ styles: "Stylesheets",
27
+ css: "CSS files",
28
+ tests: "Test files",
29
+ test: "Test files",
30
+ __tests__: "Test files",
31
+ spec: "Test specifications",
32
+ e2e: "End-to-end tests",
33
+ fixtures: "Test fixtures / mock data",
34
+ mocks: "Mock implementations",
35
+ scripts: "Build/automation scripts",
36
+ tools: "Development tools",
37
+ docs: "Documentation",
38
+ migrations: "Database migrations",
39
+ seeds: "Database seed data",
40
+ prisma: "Prisma ORM schema and migrations",
41
+ graphql: "GraphQL schema and resolvers",
42
+ proto: "Protocol Buffer definitions",
43
+ i18n: "Internationalization / translations",
44
+ locales: "Locale files",
45
+ store: "State management store",
46
+ stores: "State management stores",
47
+ context: "Context / state providers",
48
+ providers: "Provider components / DI",
49
+ layouts: "Layout components",
50
+ views: "View components / pages",
51
+ features: "Feature modules",
52
+ modules: "Application modules",
53
+ domain: "Domain logic",
54
+ core: "Core business logic",
55
+ shared: "Shared code across modules",
56
+ common: "Common utilities / types",
57
+ packages: "Monorepo packages",
58
+ apps: "Monorepo applications",
59
+ containers: "Docker / container configs",
60
+ deploy: "Deployment configurations",
61
+ infra: "Infrastructure as code",
62
+ terraform: "Terraform configurations",
63
+ k8s: "Kubernetes manifests",
64
+ };
65
+ const KEY_FILE_ROLES = {
66
+ "package.json": "Node.js project manifest",
67
+ "tsconfig.json": "TypeScript configuration",
68
+ "next.config.js": "Next.js configuration",
69
+ "next.config.ts": "Next.js configuration",
70
+ "next.config.mjs": "Next.js configuration",
71
+ "vite.config.ts": "Vite build configuration",
72
+ "vite.config.js": "Vite build configuration",
73
+ "webpack.config.js": "Webpack build configuration",
74
+ "tailwind.config.js": "Tailwind CSS configuration",
75
+ "tailwind.config.ts": "Tailwind CSS configuration",
76
+ "postcss.config.js": "PostCSS configuration",
77
+ "eslint.config.js": "ESLint configuration",
78
+ ".eslintrc.json": "ESLint configuration",
79
+ ".eslintrc.js": "ESLint configuration",
80
+ "prettier.config.js": "Prettier configuration",
81
+ ".prettierrc": "Prettier configuration",
82
+ "jest.config.ts": "Jest test configuration",
83
+ "jest.config.js": "Jest test configuration",
84
+ "vitest.config.ts": "Vitest test configuration",
85
+ "docker-compose.yml": "Docker Compose services",
86
+ "docker-compose.yaml": "Docker Compose services",
87
+ "Dockerfile": "Docker container definition",
88
+ ".dockerignore": "Docker ignore patterns",
89
+ "Makefile": "Build automation",
90
+ "Cargo.toml": "Rust project manifest",
91
+ "go.mod": "Go module definition",
92
+ "requirements.txt": "Python dependencies",
93
+ "pyproject.toml": "Python project configuration",
94
+ "setup.py": "Python package setup",
95
+ "Gemfile": "Ruby dependencies",
96
+ "pom.xml": "Maven project definition",
97
+ "build.gradle": "Gradle build configuration",
98
+ "composer.json": "PHP project manifest",
99
+ ".env.example": "Environment variables template",
100
+ "prisma/schema.prisma": "Prisma database schema",
101
+ "drizzle.config.ts": "Drizzle ORM configuration",
102
+ "knexfile.js": "Knex.js database configuration",
103
+ ".github/workflows": "GitHub Actions CI/CD",
104
+ "turbo.json": "Turborepo configuration",
105
+ "lerna.json": "Lerna monorepo configuration",
106
+ "nx.json": "Nx monorepo configuration",
107
+ "pnpm-workspace.yaml": "pnpm workspace configuration",
108
+ };
109
+ export async function scanStructure(rootPath) {
110
+ const { dirs, files } = await walkDirectory(rootPath);
111
+ const directories = [];
112
+ for (const dir of dirs) {
113
+ const dirName = dir.split("/").pop() || dir;
114
+ const depth = dir.split("/").length;
115
+ if (depth <= 3) {
116
+ const filesInDir = files.filter((f) => f.startsWith(dir + "/") && !f.slice(dir.length + 1).includes("/"));
117
+ const description = DIR_DESCRIPTIONS[dirName] || inferDirectoryPurpose(dirName, filesInDir);
118
+ directories.push({
119
+ path: dir,
120
+ description,
121
+ fileCount: filesInDir.length,
122
+ });
123
+ }
124
+ }
125
+ const keyFiles = [];
126
+ for (const file of files) {
127
+ const fileName = file.split("/").pop() || file;
128
+ if (KEY_FILE_ROLES[fileName]) {
129
+ keyFiles.push({ path: file, role: KEY_FILE_ROLES[fileName] });
130
+ }
131
+ else if (KEY_FILE_ROLES[file]) {
132
+ keyFiles.push({ path: file, role: KEY_FILE_ROLES[file] });
133
+ }
134
+ }
135
+ return { directories, keyFiles, allFiles: files };
136
+ }
137
+ function inferDirectoryPurpose(name, files) {
138
+ const extensions = countFilesByExtension(files);
139
+ if (extensions["test"] || extensions["spec"])
140
+ return "Test files";
141
+ if (extensions["css"] || extensions["scss"] || extensions["less"])
142
+ return "Stylesheets";
143
+ if (extensions["sql"])
144
+ return "SQL files";
145
+ if (extensions["json"] && files.length > 5)
146
+ return "JSON data files";
147
+ if (extensions["md"])
148
+ return "Documentation";
149
+ if (extensions["png"] || extensions["jpg"] || extensions["svg"])
150
+ return "Image assets";
151
+ return `${name} directory`;
152
+ }
153
+ //# sourceMappingURL=structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/scanner/structure.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAc,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAErF,MAAM,gBAAgB,GAA2B;IAC/C,GAAG,EAAE,kBAAkB;IACvB,GAAG,EAAE,qBAAqB;IAC1B,GAAG,EAAE,kDAAkD;IACvD,KAAK,EAAE,0BAA0B;IACjC,UAAU,EAAE,eAAe;IAC3B,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,mBAAmB;IAC1B,OAAO,EA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AAC7B,CAAC"}
@@ -0,0 +1,72 @@
1
+ export interface ProjectContext {
2
+ meta: ProjectMeta;
3
+ structure: DirectoryEntry[];
4
+ dependencies: DependencyInfo;
5
+ frameworks: FrameworkInfo[];
6
+ scripts: Record<string, string>;
7
+ conventions: ConventionInfo;
8
+ entryPoints: string[];
9
+ keyFiles: KeyFile[];
10
+ }
11
+ export interface ProjectMeta {
12
+ name: string;
13
+ version: string;
14
+ description: string;
15
+ languages: string[];
16
+ type: ProjectType;
17
+ rootPath: string;
18
+ }
19
+ export type ProjectType = "web-app" | "api" | "library" | "cli" | "monorepo" | "mobile" | "desktop" | "fullstack" | "unknown";
20
+ export interface DirectoryEntry {
21
+ path: string;
22
+ description: string;
23
+ fileCount: number;
24
+ }
25
+ export interface DependencyInfo {
26
+ runtime: DependencyEntry[];
27
+ dev: DependencyEntry[];
28
+ packageManager: string;
29
+ lockFile: string | null;
30
+ }
31
+ export interface DependencyEntry {
32
+ name: string;
33
+ version: string;
34
+ purpose?: string;
35
+ }
36
+ export interface FrameworkInfo {
37
+ name: string;
38
+ version: string;
39
+ category: FrameworkCategory;
40
+ }
41
+ export type FrameworkCategory = "frontend" | "backend" | "testing" | "build" | "styling" | "orm" | "state" | "auth" | "docs" | "linting" | "other";
42
+ export interface ConventionInfo {
43
+ language: string;
44
+ styling: string;
45
+ testing: string;
46
+ stateManagement: string;
47
+ api: string;
48
+ architecture: string;
49
+ }
50
+ export interface KeyFile {
51
+ path: string;
52
+ role: string;
53
+ }
54
+ export interface ContextCache {
55
+ version: string;
56
+ lastUpdated: string;
57
+ commitHash: string | null;
58
+ target: GeneratorTarget | null;
59
+ projectContext: ProjectContext;
60
+ fileHashes: Record<string, string>;
61
+ }
62
+ export interface ScanResult {
63
+ context: ProjectContext;
64
+ fileHashes: Record<string, string>;
65
+ }
66
+ export type GeneratorTarget = "claude" | "cursor" | "copilot" | "codex" | "gemini" | "windsurf";
67
+ export interface GeneratorOutput {
68
+ target: GeneratorTarget;
69
+ filePath: string;
70
+ content: string;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,YAAY,EAAE,cAAc,CAAC;IAC7B,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,cAAc,CAAC;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,KAAK,GACL,SAAS,GACT,KAAK,GACL,UAAU,GACV,QAAQ,GACR,SAAS,GACT,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,GAAG,EAAE,eAAe,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACl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};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export declare function walkDirectory(rootPath: string, options?: {
2
+ maxDepth?: number;
3
+ maxFiles?: number;
4
+ }): Promise<{
5
+ dirs: string[];
6
+ files: string[];
7
+ }>;
8
+ export declare function readJsonFile<T>(filePath: string): Promise<T | null>;
9
+ export declare function readTextFile(filePath: string): Promise<string | null>;
10
+ export declare function fileExists(filePath: string): Promise<boolean>;
11
+ export declare function countFilesByExtension(files: string[]): Record<string, number>;
12
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/utils/files.ts"],"names":[],"mappings":"AAwCA,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAkC9C;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAOzE;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAM3E;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EAAE,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB"}
@@ -0,0 +1,107 @@
1
+ import { readdir, stat, readFile } from "node:fs/promises";
2
+ import { join, relative } from "node:path";
3
+ const IGNORE_DIRS = new Set([
4
+ "node_modules",
5
+ ".git",
6
+ "dist",
7
+ "build",
8
+ "out",
9
+ ".next",
10
+ ".nuxt",
11
+ ".output",
12
+ ".vercel",
13
+ ".netlify",
14
+ ".turbo",
15
+ ".cache",
16
+ ".parcel-cache",
17
+ "coverage",
18
+ "__pycache__",
19
+ ".pytest_cache",
20
+ "venv",
21
+ ".venv",
22
+ "env",
23
+ ".env",
24
+ "target",
25
+ "vendor",
26
+ ".context-ai",
27
+ ".idea",
28
+ ".vscode",
29
+ ".DS_Store",
30
+ ]);
31
+ const IGNORE_FILES = new Set([
32
+ ".DS_Store",
33
+ "Thumbs.db",
34
+ ".env",
35
+ ".env.local",
36
+ ".env.production",
37
+ ]);
38
+ export async function walkDirectory(rootPath, options = {}) {
39
+ const { maxDepth = 10, maxFiles = 5000 } = options;
40
+ const dirs = [];
41
+ const files = [];
42
+ async function walk(dir, depth) {
43
+ if (depth > maxDepth || files.length >= maxFiles)
44
+ return;
45
+ let entries;
46
+ try {
47
+ entries = await readdir(dir, { withFileTypes: true });
48
+ }
49
+ catch {
50
+ return;
51
+ }
52
+ for (const entry of entries) {
53
+ if (files.length >= maxFiles)
54
+ break;
55
+ const fullPath = join(dir, entry.name);
56
+ const relPath = relative(rootPath, fullPath).replace(/\\/g, "/");
57
+ if (entry.isDirectory()) {
58
+ if (IGNORE_DIRS.has(entry.name) || entry.name.startsWith("."))
59
+ continue;
60
+ dirs.push(relPath);
61
+ await walk(fullPath, depth + 1);
62
+ }
63
+ else if (entry.isFile()) {
64
+ if (IGNORE_FILES.has(entry.name))
65
+ continue;
66
+ files.push(relPath);
67
+ }
68
+ }
69
+ }
70
+ await walk(rootPath, 0);
71
+ return { dirs: dirs.sort(), files: files.sort() };
72
+ }
73
+ export async function readJsonFile(filePath) {
74
+ try {
75
+ const content = await readFile(filePath, "utf-8");
76
+ return JSON.parse(content);
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ }
82
+ export async function readTextFile(filePath) {
83
+ try {
84
+ return await readFile(filePath, "utf-8");
85
+ }
86
+ catch {
87
+ return null;
88
+ }
89
+ }
90
+ export async function fileExists(filePath) {
91
+ try {
92
+ await stat(filePath);
93
+ return true;
94
+ }
95
+ catch {
96
+ return false;
97
+ }
98
+ }
99
+ export function countFilesByExtension(files) {
100
+ const counts = {};
101
+ for (const file of files) {
102
+ const ext = file.split(".").pop() || "other";
103
+ counts[ext] = (counts[ext] || 0) + 1;
104
+ }
105
+ return counts;
106
+ }
107
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/utils/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,cAAc;IACd,MAAM;IACN,MAAM;IACN,OAAO;IACP,KAAK;IACL,OAAO;IACP,OAAO;IACP,SAAS;IACT,SAAS;IACT,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,eAAe;IACf,UAAU;IACV,aAAa;IACb,eAAe;IACf,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,OAAO;IACP,SAAS;IACT,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,WAAW;IACX,WAAW;IACX,MAAM;IACN,YAAY;IACZ,iBAAiB;CAClB,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,UAAoD,EAAE;IAEtD,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,MAAM,KA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string) => void;
5
+ error: (msg: string) => void;
6
+ dim: (msg: string) => void;
7
+ heading: (msg: string) => void;
8
+ };
9
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;gBACL,MAAM;mBACH,MAAM;gBACT,MAAM;iBACL,MAAM;eACR,MAAM;mBACF,MAAM;CACtB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import chalk from "chalk";
2
+ export const logger = {
3
+ info: (msg) => console.log(chalk.blue("ℹ"), msg),
4
+ success: (msg) => console.log(chalk.green("✔"), msg),
5
+ warn: (msg) => console.log(chalk.yellow("⚠"), msg),
6
+ error: (msg) => console.log(chalk.red("✖"), msg),
7
+ dim: (msg) => console.log(chalk.dim(msg)),
8
+ heading: (msg) => console.log(chalk.bold.cyan(`\n${msg}`)),
9
+ };
10
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IACxD,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IAC5D,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IAC1D,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;IACxD,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;CACnE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "project-context-ai",
3
+ "version": "1.0.0",
4
+ "description": "Automatically maps your project and generates AI context files for Claude, Cursor, Copilot, Codex, Gemini, and Windsurf",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "project-context-ai": "dist/cli.js",
10
+ "pca": "dist/cli.js"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc --watch",
15
+ "start": "node dist/cli.js",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "keywords": [
19
+ "ai",
20
+ "context",
21
+ "claude",
22
+ "cursor",
23
+ "copilot",
24
+ "codex",
25
+ "gemini",
26
+ "windsurf",
27
+ "project-mapping",
28
+ "developer-tools"
29
+ ],
30
+ "author": "Thaydeveloper",
31
+ "license": "MIT",
32
+ "dependencies": {
33
+ "commander": "^12.1.0",
34
+ "chalk": "^5.3.0",
35
+ "glob": "^11.0.0",
36
+ "ora": "^8.1.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.0.0",
40
+ "typescript": "^5.6.0"
41
+ },
42
+ "engines": {
43
+ "node": ">=18.0.0"
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ]
48
+ }