depfix-ai 0.2.10 → 0.2.11
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/README.md +8 -5
- package/bin/run-latest.js +13 -0
- package/dist/lib/env/scan.d.ts.map +1 -1
- package/dist/lib/env/scan.js +4 -1
- package/dist/lib/env/write.js +4 -4
- package/dist/ui/interactive.d.ts.map +1 -1
- package/dist/ui/interactive.js +54 -13
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -22,16 +22,18 @@ pnpm add -g depfix-ai
|
|
|
22
22
|
**Run without installing (npx / pnpm dlx):**
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
+
npx depfix-ai@latest # Recommended: always runs latest (bypasses cache)
|
|
26
|
+
npx depfix-ai-latest # Same as above (alias)
|
|
27
|
+
npx depfix-ai # May use cached version
|
|
25
28
|
npx depfix-ai --help
|
|
26
|
-
|
|
27
|
-
pnpm dlx depfix-ai --help
|
|
29
|
+
pnpm dlx depfix-ai@latest
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
---
|
|
31
33
|
|
|
32
34
|
## Quick start
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
Running `npx depfix-ai` or `depfix-ai` with no args launches the **interactive menu**. Or run commands directly:
|
|
35
37
|
|
|
36
38
|
```bash
|
|
37
39
|
depfix-ai audit # Security audit + human summary
|
|
@@ -43,8 +45,9 @@ depfix-ai fix # Preview fixes (dry-run); use --apply to apply
|
|
|
43
45
|
One-off (no install):
|
|
44
46
|
|
|
45
47
|
```bash
|
|
48
|
+
npx depfix-ai@latest # Interactive menu (recommended – always latest)
|
|
46
49
|
npx depfix-ai audit
|
|
47
|
-
pnpm dlx depfix-ai env generate
|
|
50
|
+
pnpm dlx depfix-ai@latest env generate
|
|
48
51
|
```
|
|
49
52
|
|
|
50
53
|
---
|
|
@@ -53,7 +56,7 @@ pnpm dlx depfix-ai env generate
|
|
|
53
56
|
|
|
54
57
|
### `depfix-ai audit`
|
|
55
58
|
|
|
56
|
-
Run a security audit and get a human-readable summary (npm
|
|
59
|
+
Run a security audit and get a human-readable summary (npm and pnpm).
|
|
57
60
|
|
|
58
61
|
| Flag | Description |
|
|
59
62
|
|------|-------------|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Always run the latest depfix-ai (bypasses npx cache).
|
|
4
|
+
* Usage: npx depfix-ai-latest or npx depfix-ai@latest
|
|
5
|
+
*/
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const result = spawnSync("npx", ["depfix-ai@latest", ...args], {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
shell: true,
|
|
12
|
+
});
|
|
13
|
+
process.exit(result.status ?? 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/lib/env/scan.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/lib/env/scan.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAiBD,wBAAsB,OAAO,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CA6BzE"}
|
package/dist/lib/env/scan.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
const INCLUDE_GLOBS = [
|
|
4
|
-
"src/**/*.{js,jsx,ts,tsx}",
|
|
4
|
+
"src/**/*.{js,jsx,ts,tsx,mjs,cjs}",
|
|
5
|
+
"lib/**/*.{js,jsx,ts,tsx,mjs,cjs}",
|
|
5
6
|
"app/**/*.{js,jsx,ts,tsx}",
|
|
6
7
|
"server/**/*.{js,jsx,ts,tsx}",
|
|
7
8
|
"pages/**/*.{js,jsx,ts,tsx}",
|
|
9
|
+
"scripts/**/*.{js,ts,mjs}",
|
|
10
|
+
"*.{js,ts,mjs}",
|
|
8
11
|
];
|
|
9
12
|
const EXCLUDE_GLOBS = ["**/node_modules/**", "**/dist/**", "**/.next/**", "**/build/**", "**/coverage/**"];
|
|
10
13
|
const PROCESS_ENV_REGEX = /process\.env\.([A-Z0-9_]+)/g;
|
package/dist/lib/env/write.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { scanEnv } from "./scan.js";
|
|
4
4
|
import { renderEnv } from "./render.js";
|
|
5
|
-
import { logInfo, logError } from "../ui/log.js";
|
|
5
|
+
import { logInfo, logError, logSuccess } from "../ui/log.js";
|
|
6
6
|
const defaultEnvFlags = {
|
|
7
7
|
out: ".env.example",
|
|
8
8
|
create: false,
|
|
@@ -54,13 +54,13 @@ export async function runEnvGenerate(opts = {}) {
|
|
|
54
54
|
process.exitCode = 1;
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
logSuccess(`${flags.out} contains all required environment variables.`);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
// Always (re)write the template example file.
|
|
61
61
|
const exampleContent = renderEnv(scanResult);
|
|
62
62
|
await fs.writeFile(outPath, exampleContent, "utf8");
|
|
63
|
-
|
|
63
|
+
logSuccess(`Wrote environment template to ${outPath}`);
|
|
64
64
|
if (flags.create) {
|
|
65
65
|
const envExists = await fileExists(envPath);
|
|
66
66
|
if (envExists && !flags.force) {
|
|
@@ -69,7 +69,7 @@ export async function runEnvGenerate(opts = {}) {
|
|
|
69
69
|
else {
|
|
70
70
|
const envContent = scanResult.keys.map((k) => `${k}=`).join("\n") + "\n";
|
|
71
71
|
await fs.writeFile(envPath, envContent, "utf8");
|
|
72
|
-
|
|
72
|
+
logSuccess(`Wrote ${envExists ? "updated" : "new"} .env file to ${envPath}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/ui/interactive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../src/ui/interactive.ts"],"names":[],"mappings":"AA2LA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA6DpD"}
|
package/dist/ui/interactive.js
CHANGED
|
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
-
import { intro, select, confirm,
|
|
5
|
+
import { intro, select, confirm, password, isCancel, cancel } from "@clack/prompts";
|
|
6
6
|
import pc from "picocolors";
|
|
7
7
|
import { execute } from "@oclif/core";
|
|
8
8
|
import { config as dotenvConfig } from "dotenv";
|
|
@@ -103,23 +103,64 @@ async function runEnvGenerateFlow() {
|
|
|
103
103
|
{ value: "ai", label: "AI-assisted" },
|
|
104
104
|
],
|
|
105
105
|
});
|
|
106
|
+
if (isCancel(mode)) {
|
|
107
|
+
cancel("Cancelled.");
|
|
108
|
+
process.exit(0);
|
|
109
|
+
}
|
|
106
110
|
if (mode === "ai") {
|
|
107
|
-
await select({
|
|
108
|
-
message: "🤖 Select AI
|
|
111
|
+
const provider = await select({
|
|
112
|
+
message: "🤖 Select AI provider",
|
|
109
113
|
options: [
|
|
110
|
-
{ value: "
|
|
111
|
-
{ value: "
|
|
112
|
-
{ value: "gpt-3.5-turbo", label: "GPT-3.5 Turbo" },
|
|
114
|
+
{ value: "openai", label: "OpenAI (GPT-4o, GPT-3.5)" },
|
|
115
|
+
{ value: "google", label: "Google AI (Gemini)" },
|
|
113
116
|
],
|
|
114
117
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
if (
|
|
120
|
-
|
|
118
|
+
if (isCancel(provider)) {
|
|
119
|
+
cancel("Cancelled.");
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
if (provider === "openai") {
|
|
123
|
+
await select({
|
|
124
|
+
message: "🤖 Select model",
|
|
125
|
+
options: [
|
|
126
|
+
{ value: "gpt-4o", label: "GPT-4o" },
|
|
127
|
+
{ value: "gpt-4o-mini", label: "GPT-4o Mini" },
|
|
128
|
+
{ value: "gpt-3.5-turbo", label: "GPT-3.5 Turbo" },
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
const apiKey = await password({
|
|
132
|
+
message: "🔑 OpenAI API key (or leave blank to use OPENAI_API_KEY from env)",
|
|
133
|
+
validate: () => undefined,
|
|
134
|
+
});
|
|
135
|
+
if (isCancel(apiKey)) {
|
|
136
|
+
cancel("Cancelled.");
|
|
137
|
+
process.exit(0);
|
|
138
|
+
}
|
|
139
|
+
if (apiKey && typeof apiKey === "string") {
|
|
140
|
+
process.env.OPENAI_API_KEY = apiKey;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (provider === "google") {
|
|
144
|
+
await select({
|
|
145
|
+
message: "🤖 Select model",
|
|
146
|
+
options: [
|
|
147
|
+
{ value: "gemini-1.5-pro", label: "Gemini 1.5 Pro" },
|
|
148
|
+
{ value: "gemini-1.5-flash", label: "Gemini 1.5 Flash" },
|
|
149
|
+
{ value: "gemini-1.0-pro", label: "Gemini 1.0 Pro" },
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
const apiKey = await password({
|
|
153
|
+
message: "🔑 Google AI API key (or leave blank to use GOOGLE_API_KEY from env)",
|
|
154
|
+
validate: () => undefined,
|
|
155
|
+
});
|
|
156
|
+
if (isCancel(apiKey)) {
|
|
157
|
+
cancel("Cancelled.");
|
|
158
|
+
process.exit(0);
|
|
159
|
+
}
|
|
160
|
+
if (apiKey && typeof apiKey === "string") {
|
|
161
|
+
process.env.GOOGLE_API_KEY = apiKey;
|
|
162
|
+
}
|
|
121
163
|
}
|
|
122
|
-
// Load .env if present
|
|
123
164
|
dotenvConfig({ path: join(getProjectCwd(), ".env") });
|
|
124
165
|
}
|
|
125
166
|
await runEnvGenerate({ out: ".env.example" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "depfix-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"dist/**"
|
|
23
23
|
],
|
|
24
24
|
"bin": {
|
|
25
|
-
"depfix-ai": "bin/run.js"
|
|
25
|
+
"depfix-ai": "bin/run.js",
|
|
26
|
+
"depfix-ai-latest": "bin/run-latest.js"
|
|
26
27
|
},
|
|
27
28
|
"repository": {
|
|
28
29
|
"type": "git",
|