kodingo-cli 1.1.6 → 1.1.8
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/dist/commands/init.js +3 -5
- package/dist/commands/security-scan.js +21 -11
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -41,16 +41,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
43
|
})();
|
|
44
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
-
};
|
|
47
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
45
|
exports.registerInitCommand = registerInitCommand;
|
|
49
46
|
const readline = __importStar(require("node:readline"));
|
|
50
47
|
const fs = __importStar(require("fs"));
|
|
51
48
|
const path = __importStar(require("path"));
|
|
52
49
|
const os = __importStar(require("os"));
|
|
53
|
-
|
|
50
|
+
// open is imported dynamically to avoid ESM/CJS compatibility issues on Windows
|
|
54
51
|
const persistence_config_1 = require("../utils/persistence-config");
|
|
55
52
|
const API_BASE = "https://kodingo-api.onrender.com";
|
|
56
53
|
const APP_URL = "https://kodingo.xyz";
|
|
@@ -140,7 +137,8 @@ async function browserLogin(rl) {
|
|
|
140
137
|
});
|
|
141
138
|
// Open browser
|
|
142
139
|
try {
|
|
143
|
-
await (
|
|
140
|
+
const { default: open } = await Promise.resolve().then(() => __importStar(require("open")));
|
|
141
|
+
await open(loginUrl);
|
|
144
142
|
}
|
|
145
143
|
catch { }
|
|
146
144
|
console.log("Waiting for login...");
|
|
@@ -136,19 +136,29 @@ async function securityScanCommand(options = {}) {
|
|
|
136
136
|
console.log(" ✔ No suspicious patterns detected.");
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
const BATCH_SIZE = 20;
|
|
140
|
+
let totalScanned = 0, totalFindings = 0, totalDismissed = 0;
|
|
141
|
+
for (let i = 0; i < candidates.length; i += BATCH_SIZE) {
|
|
142
|
+
const batch = candidates.slice(i, i + BATCH_SIZE);
|
|
143
|
+
const codeScanRes = await fetch(`${apiUrl}/security/scan-code`, {
|
|
144
|
+
method: "POST",
|
|
145
|
+
headers: { "Content-Type": "application/json", "X-Kodingo-Token": token },
|
|
146
|
+
body: JSON.stringify({ repo: repoName, candidates: batch }),
|
|
147
|
+
});
|
|
148
|
+
if (codeScanRes.ok) {
|
|
149
|
+
const codeResult = await codeScanRes.json();
|
|
150
|
+
totalScanned += codeResult.scanned;
|
|
151
|
+
totalFindings += codeResult.findingsCreated;
|
|
152
|
+
totalDismissed += codeResult.dismissed;
|
|
153
|
+
}
|
|
154
|
+
else if (!options.silent) {
|
|
155
|
+
console.error(` ✖ Code analysis batch failed: ${codeScanRes.status}`);
|
|
156
|
+
break;
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
|
-
|
|
151
|
-
console.
|
|
159
|
+
if (!options.silent && totalScanned > 0) {
|
|
160
|
+
console.log(` Checked ${totalScanned} candidates — ${totalFindings} confirmed, ${totalDismissed} dismissed after review
|
|
161
|
+
`);
|
|
152
162
|
}
|
|
153
163
|
}
|
|
154
164
|
}
|