codegate-ai 0.1.5 → 0.1.7
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/cli.d.ts +3 -0
- package/dist/cli.js +19 -3
- package/package.json +3 -2
package/dist/cli.d.ts
CHANGED
|
@@ -60,5 +60,8 @@ export interface CliDeps {
|
|
|
60
60
|
requestWarningProceed?: (report: CodeGateReport) => Promise<boolean> | boolean;
|
|
61
61
|
}) => Promise<void>;
|
|
62
62
|
}
|
|
63
|
+
export declare function isDirectCliInvocation(importMetaUrl: string, argv1: string | undefined, deps?: {
|
|
64
|
+
realpath?: (path: string) => string;
|
|
65
|
+
}): boolean;
|
|
63
66
|
export declare function createCli(version?: string, deps?: CliDeps): Command;
|
|
64
67
|
export declare function runCli(argv?: string[], version?: string, deps?: CliDeps): Promise<void>;
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, realpathSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
@@ -27,6 +27,23 @@ const packageJson = require("../package.json");
|
|
|
27
27
|
function isNoTuiEnabled(options) {
|
|
28
28
|
return options.noTui === true || options.tui === false;
|
|
29
29
|
}
|
|
30
|
+
export function isDirectCliInvocation(importMetaUrl, argv1, deps = {}) {
|
|
31
|
+
if (!argv1) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const argvUrl = pathToFileURL(argv1).href;
|
|
35
|
+
if (argvUrl === importMetaUrl) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const resolveRealpath = deps.realpath ?? ((path) => realpathSync(path));
|
|
39
|
+
try {
|
|
40
|
+
const resolvedArgvUrl = pathToFileURL(resolveRealpath(argv1)).href;
|
|
41
|
+
return resolvedArgvUrl === importMetaUrl;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
30
47
|
function mapAcquisitionFailure(status, error) {
|
|
31
48
|
if (status === "auth_failure" ||
|
|
32
49
|
status === "timeout" ||
|
|
@@ -437,7 +454,6 @@ export async function runCli(argv = process.argv, version = packageJson.version
|
|
|
437
454
|
cleanupSignals();
|
|
438
455
|
}
|
|
439
456
|
}
|
|
440
|
-
|
|
441
|
-
if (invokedPath && import.meta.url === invokedPath) {
|
|
457
|
+
if (isDirectCliInvocation(import.meta.url, process.argv[1])) {
|
|
442
458
|
await runCli();
|
|
443
459
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codegate-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Pre-flight security scanner for AI coding tool configurations.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"security"
|
|
24
24
|
],
|
|
25
25
|
"bin": {
|
|
26
|
-
"codegate": "dist/cli.js"
|
|
26
|
+
"codegate": "dist/cli.js",
|
|
27
|
+
"codegate-ai": "dist/cli.js"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"build": "tsc -p tsconfig.json && node scripts/copy-assets.mjs",
|