qodfy 0.1.1 → 0.1.2

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 (2) hide show
  1. package/dist/index.js +77 -5
  2. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -1,17 +1,65 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
+ import fs from "fs/promises";
5
+ import path from "path";
4
6
  import { Command } from "commander";
5
7
  import pc from "picocolors";
6
8
  import { scanProject } from "@qodfy/core";
7
9
  var program = new Command();
8
- program.name("qodfy").description("Launch readiness scanner for AI-built apps.").version("0.1.1");
10
+ program.name("qodfy").description("Launch readiness scanner for AI-built apps.").version("0.1.2");
9
11
  program.command("scan").description("Scan a project for launch readiness issues.").option("-p, --path <path>", "Project path to scan", process.cwd()).action(async (options) => {
10
- console.log(pc.cyan("Qodfy is scanning your project...\n"));
11
- const report = await scanProject(options.path);
12
- printReport(report);
12
+ const pathResult = await resolveProjectPath(options.path);
13
+ if (!pathResult.ok) {
14
+ printScanError(pathResult.reason);
15
+ process.exitCode = 1;
16
+ return;
17
+ }
18
+ try {
19
+ console.log(pc.cyan("Qodfy is scanning your project...\n"));
20
+ const report = await scanProject(pathResult.projectPath);
21
+ printReport(report);
22
+ } catch (error) {
23
+ printScanError(getErrorMessage(error));
24
+ process.exitCode = 1;
25
+ }
13
26
  });
14
- program.parse();
27
+ await program.parseAsync();
28
+ async function resolveProjectPath(projectPath) {
29
+ const inputPath = projectPath.trim() || process.cwd();
30
+ const resolvedPath = path.resolve(inputPath);
31
+ try {
32
+ const stats = await fs.stat(resolvedPath);
33
+ if (!stats.isDirectory()) {
34
+ return {
35
+ ok: false,
36
+ reason: `The path "${inputPath}" is not a directory.`
37
+ };
38
+ }
39
+ return {
40
+ ok: true,
41
+ projectPath: resolvedPath
42
+ };
43
+ } catch (error) {
44
+ const code = getErrorCode(error);
45
+ if (code === "ENOENT") {
46
+ return {
47
+ ok: false,
48
+ reason: `The path "${inputPath}" does not exist.`
49
+ };
50
+ }
51
+ if (code === "ENOTDIR") {
52
+ return {
53
+ ok: false,
54
+ reason: `The path "${inputPath}" is not a directory.`
55
+ };
56
+ }
57
+ return {
58
+ ok: false,
59
+ reason: `Qodfy could not access the path "${inputPath}".`
60
+ };
61
+ }
62
+ }
15
63
  function printReport(report) {
16
64
  console.log(pc.bold("Qodfy Report"));
17
65
  console.log("");
@@ -37,8 +85,32 @@ ${label} ${pc.bold(issue.title)}`);
37
85
  if (issue.file) {
38
86
  console.log(pc.dim(`File: ${issue.file}`));
39
87
  }
88
+ if (issue.suggestion) {
89
+ console.log(pc.dim(`Suggestion: ${issue.suggestion}`));
90
+ }
40
91
  }
41
92
  console.log("");
42
93
  console.log(pc.bold("Recommended next step:"));
43
94
  console.log("Fix critical issues first, then warnings, then cleanup items.");
44
95
  }
96
+ function printScanError(reason) {
97
+ console.error(pc.red("Qodfy could not scan this project."));
98
+ console.error("");
99
+ console.error(pc.bold("Reason:"));
100
+ console.error(reason);
101
+ console.error("");
102
+ console.error(pc.bold("Try:"));
103
+ console.error("qodfy scan --path ./my-next-app");
104
+ }
105
+ function getErrorMessage(error) {
106
+ if (error instanceof Error && error.message) {
107
+ return error.message;
108
+ }
109
+ return "An unexpected error occurred while scanning the project.";
110
+ }
111
+ function getErrorCode(error) {
112
+ if (error && typeof error === "object" && "code" in error && typeof error.code === "string") {
113
+ return error.code;
114
+ }
115
+ return void 0;
116
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qodfy",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Open-source launch readiness scanner for AI-built apps.",
5
5
  "keywords": [
6
6
  "qodfy",
@@ -38,7 +38,8 @@
38
38
  }
39
39
  },
40
40
  "files": [
41
- "dist"
41
+ "dist",
42
+ "README.md"
42
43
  ],
43
44
  "license": "MIT",
44
45
  "engines": {
@@ -50,7 +51,7 @@
50
51
  "dependencies": {
51
52
  "commander": "^14.0.3",
52
53
  "picocolors": "^1.1.1",
53
- "@qodfy/core": "^0.1.1"
54
+ "@qodfy/core": "^0.1.2"
54
55
  },
55
56
  "devDependencies": {
56
57
  "@types/node": "^25.7.0",