@qodfy/core 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yassine Ifguisse
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.
@@ -0,0 +1,22 @@
1
+ type IssueSeverity = "critical" | "warning" | "info";
2
+ type Issue = {
3
+ severity: IssueSeverity;
4
+ title: string;
5
+ message: string;
6
+ file?: string;
7
+ };
8
+ type ScanReport = {
9
+ projectPath: string;
10
+ isNextProject: boolean;
11
+ score: number;
12
+ issues: Issue[];
13
+ stats: {
14
+ totalFiles: number;
15
+ apiRoutes: number;
16
+ aiFiles: number;
17
+ largeFiles: number;
18
+ };
19
+ };
20
+ declare function scanProject(projectPath: string): Promise<ScanReport>;
21
+
22
+ export { type Issue, type IssueSeverity, type ScanReport, scanProject };
package/dist/index.js ADDED
@@ -0,0 +1,139 @@
1
+ // src/index.ts
2
+ import path from "path";
3
+ import fs from "fs/promises";
4
+ import fg from "fast-glob";
5
+ async function fileExists(filePath) {
6
+ try {
7
+ await fs.access(filePath);
8
+ return true;
9
+ } catch {
10
+ return false;
11
+ }
12
+ }
13
+ async function readJson(filePath) {
14
+ const content = await fs.readFile(filePath, "utf-8");
15
+ return JSON.parse(content);
16
+ }
17
+ async function scanProject(projectPath) {
18
+ const issues = [];
19
+ const packageJsonPath = path.join(projectPath, "package.json");
20
+ const hasPackageJson = await fileExists(packageJsonPath);
21
+ if (!hasPackageJson) {
22
+ issues.push({
23
+ severity: "critical",
24
+ title: "Missing package.json",
25
+ message: "Qodfy could not find a package.json file in this project."
26
+ });
27
+ }
28
+ let isNextProject = false;
29
+ if (hasPackageJson) {
30
+ const packageJson = await readJson(packageJsonPath);
31
+ const deps = {
32
+ ...packageJson.dependencies,
33
+ ...packageJson.devDependencies
34
+ };
35
+ isNextProject = Boolean(deps.next);
36
+ if (!isNextProject) {
37
+ issues.push({
38
+ severity: "warning",
39
+ title: "Next.js not detected",
40
+ message: "This first version of Qodfy is optimized for Next.js projects."
41
+ });
42
+ }
43
+ }
44
+ const envExamplePath = path.join(projectPath, ".env.example");
45
+ const hasEnvExample = await fileExists(envExamplePath);
46
+ if (!hasEnvExample) {
47
+ issues.push({
48
+ severity: "warning",
49
+ title: "Missing .env.example",
50
+ message: "Add a .env.example file so future developers know which environment variables are required."
51
+ });
52
+ }
53
+ const hasReadme = await fileExists(path.join(projectPath, "README.md"));
54
+ if (!hasReadme) {
55
+ issues.push({
56
+ severity: "info",
57
+ title: "Missing README.md",
58
+ message: "A README helps other developers understand how to run and maintain the project."
59
+ });
60
+ }
61
+ const files = await fg(["**/*.{ts,tsx,js,jsx}"], {
62
+ cwd: projectPath,
63
+ ignore: ["node_modules/**", ".next/**", "dist/**", "build/**"],
64
+ absolute: true
65
+ });
66
+ const apiRoutes = files.filter((file) => {
67
+ return file.includes(`${path.sep}app${path.sep}api${path.sep}`) || file.includes(`${path.sep}pages${path.sep}api${path.sep}`);
68
+ });
69
+ const aiKeywords = [
70
+ "openai",
71
+ "@ai-sdk",
72
+ "ai/react",
73
+ "anthropic",
74
+ "gemini",
75
+ "generateText",
76
+ "streamText"
77
+ ];
78
+ let aiFiles = 0;
79
+ let largeFiles = 0;
80
+ for (const file of files) {
81
+ const content = await fs.readFile(file, "utf-8");
82
+ const relativeFile = path.relative(projectPath, file);
83
+ if (content.length > 15e3) {
84
+ largeFiles++;
85
+ issues.push({
86
+ severity: "info",
87
+ title: "Large file detected",
88
+ message: "Large files are harder to maintain and often appear in AI-generated codebases.",
89
+ file: relativeFile
90
+ });
91
+ }
92
+ const usesAI = aiKeywords.some(
93
+ (keyword) => content.toLowerCase().includes(keyword.toLowerCase())
94
+ );
95
+ if (usesAI) {
96
+ aiFiles++;
97
+ const hasRateLimit = content.includes("rateLimit") || content.includes("ratelimit") || content.includes("upstash") || content.includes("limiter");
98
+ if (!hasRateLimit) {
99
+ issues.push({
100
+ severity: "critical",
101
+ title: "AI route may be missing rate limiting",
102
+ message: "AI routes can create real API costs. Add rate limiting or usage limits before launch.",
103
+ file: relativeFile
104
+ });
105
+ }
106
+ }
107
+ }
108
+ for (const route of apiRoutes) {
109
+ const content = await fs.readFile(route, "utf-8");
110
+ const relativeFile = path.relative(projectPath, route);
111
+ const hasAuth = content.includes("auth(") || content.includes("getServerSession") || content.includes("currentUser") || content.includes("clerkClient") || content.includes("session");
112
+ if (!hasAuth) {
113
+ issues.push({
114
+ severity: "warning",
115
+ title: "API route may be missing authentication",
116
+ message: "This API route does not appear to contain an auth/session check.",
117
+ file: relativeFile
118
+ });
119
+ }
120
+ }
121
+ const criticalCount = issues.filter((issue) => issue.severity === "critical").length;
122
+ const warningCount = issues.filter((issue) => issue.severity === "warning").length;
123
+ const score = Math.max(0, 100 - criticalCount * 20 - warningCount * 8);
124
+ return {
125
+ projectPath,
126
+ isNextProject,
127
+ score,
128
+ issues,
129
+ stats: {
130
+ totalFiles: files.length,
131
+ apiRoutes: apiRoutes.length,
132
+ aiFiles,
133
+ largeFiles
134
+ }
135
+ };
136
+ }
137
+ export {
138
+ scanProject
139
+ };
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@qodfy/core",
3
+ "version": "0.1.0",
4
+ "description": "Scanner engine for Qodfy, an open-source launch readiness scanner for AI-built apps.",
5
+ "keywords": [
6
+ "qodfy",
7
+ "nextjs",
8
+ "ai",
9
+ "launch-readiness",
10
+ "scanner",
11
+ "code-quality",
12
+ "developer-tools",
13
+ "typescript",
14
+ "static-analysis"
15
+ ],
16
+ "homepage": "https://github.com/yassinifguisse1/qodfy#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/yassinifguisse1/qodfy/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/yassinifguisse1/qodfy.git",
23
+ "directory": "packages/core"
24
+ },
25
+ "author": "Yassine Ifguisse",
26
+ "type": "module",
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "import": "./dist/index.js"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "license": "MIT",
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "dependencies": {
46
+ "fast-glob": "^3.3.3"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^25.7.0",
50
+ "tsup": "^8.5.1",
51
+ "tsx": "^4.21.0",
52
+ "typescript": "^6.0.3"
53
+ },
54
+ "scripts": {
55
+ "build": "tsup src/index.ts --format esm --dts --clean --tsconfig tsconfig.json",
56
+ "dev": "tsx src/index.ts"
57
+ }
58
+ }