git-cli-scanner 1.1.6 → 1.2.1

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/cli.js +15 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -808,10 +808,11 @@ var Spinner = class {
808
808
  };
809
809
 
810
810
  // src/cli.ts
811
+ var import_child_process2 = require("child_process");
811
812
  var fs3 = __toESM(require("fs"));
812
813
  var path3 = __toESM(require("path"));
813
814
  var program = new import_commander.Command();
814
- program.name("git-cli-scanner").description("Interactive Git hooks vulnerability scanner").version("1.1.6");
815
+ program.name("git-cli-scanner").description("Interactive Git hooks vulnerability scanner").version("1.2.1");
815
816
  program.command("init").description("Install pre-commit hook for automatic scanning").action(() => {
816
817
  info("Setting up pre-commit hook...");
817
818
  try {
@@ -832,6 +833,10 @@ exec < /dev/tty
832
833
  npx git-cli-scanner scan --hook
833
834
  `;
834
835
  fs3.writeFileSync(hookPath, hookContent, { mode: 493 });
836
+ try {
837
+ (0, import_child_process2.execSync)("git config --unset core.hooksPath", { stdio: "ignore" });
838
+ } catch (e) {
839
+ }
835
840
  success("Pre-commit hook installed!");
836
841
  info("Every `git commit` will now automatically scan your staged files.");
837
842
  } catch (err) {
@@ -863,16 +868,22 @@ program.command("disable").description("Remove the pre-commit hook and disable a
863
868
  program.command("scan").description("Scan staged files for vulnerabilities").option("--show-sol", "Show solutions for vulnerabilities").option("--hook", "Internal flag used when running as a git hook").action(async (options) => {
864
869
  info("Git CLI Scanner running...");
865
870
  try {
866
- const spinner = new Spinner([
871
+ const spinnerMsgs = options.hook ? [
867
872
  "Scanning staged files for vulnerabilities...",
868
873
  "Analyzing code patterns...",
869
874
  "Checking for exposed API keys...",
875
+ "Thinking..."
876
+ ] : [
877
+ "Scanning entire repository for vulnerabilities...",
878
+ "Analyzing code patterns...",
879
+ "Checking for exposed API keys...",
870
880
  "Inspecting hidden files and directories...",
871
881
  "Thinking..."
872
- ]);
882
+ ];
883
+ const spinner = new Spinner(spinnerMsgs);
873
884
  spinner.start();
874
885
  await new Promise((resolve2) => setTimeout(resolve2, 3e3));
875
- const issues = await scanDiff();
886
+ const issues = options.hook ? await scanDiff() : await scanDirectory(process.cwd());
876
887
  if (issues.length > 0) {
877
888
  const blockerIssues = issues.filter((i) => i.severity !== "dummy");
878
889
  spinner.fail(`Found ${issues.length} potential vulnerabilities! (${blockerIssues.length} blockers)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-cli-scanner",
3
- "version": "1.1.6",
3
+ "version": "1.2.1",
4
4
  "description": "A powerful interactive CLI tool that scans your codebase for hardcoded secrets, API keys, passwords, and private keys before they reach your Git history.",
5
5
  "main": "dist/cli.js",
6
6
  "scripts": {