vanguard-cli 3.1.7 → 3.1.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/bin/vanguard.js CHANGED
@@ -59,6 +59,22 @@ program
59
59
  program.command('config').description('Configure AI providers').action(runConfigWizard);
60
60
  program.command('integrate').description('Install "Invisible Protection" shell wrapper').action(runIntegrate);
61
61
 
62
+ program
63
+ .command('status')
64
+ .description('Check firewall protection status')
65
+ .action(() => {
66
+ showBanner();
67
+ const isInternal = process.env.VANGUARD_INTERNAL === '1';
68
+ console.log(chalk.bold('🔥 Firewall Status:'));
69
+ if (isInternal) {
70
+ console.log(chalk.green(' ✅ ACTIVE (Intercepted Session)'));
71
+ } else {
72
+ console.log(chalk.yellow(' ⚠️ OFFLINE (Direct CLI Access)'));
73
+ console.log(chalk.dim('\nTo activate Invisible Protection, run: vanguard integrate'));
74
+ }
75
+ showFooter();
76
+ });
77
+
62
78
 
63
79
  program
64
80
  .command('pull')
@@ -4,120 +4,134 @@ import os from 'os';
4
4
  import chalk from 'chalk';
5
5
  import { createSpinner } from '../utils/spinner.js';
6
6
 
7
- const SCRIPTS = {
8
- bash: {
9
- file: '.bashrc',
10
- template: `
11
- # --- VANGUARD PROTECTION START ---
12
- git() {
13
- if [ "$1" = "clone" ]; then
14
- vanguard clone "$@"
15
- else
16
- command git "$@"
17
- fi
18
- }
19
- # --- VANGUARD PROTECTION END ---
20
- `
21
- },
22
- zsh: {
23
- file: '.zshrc',
24
- template: `
25
- # --- VANGUARD PROTECTION START ---
26
- git() {
27
- if [ "$1" = "clone" ]; then
28
- vanguard clone "$@"
29
- else
30
- command git "$@"
31
- fi
32
- }
33
- # --- VANGUARD PROTECTION END ---
34
- `
35
- },
36
- fish: {
37
- file: '.config/fish/config.fish',
38
- template: `
39
- # --- VANGUARD PROTECTION START ---
40
- function git
41
- if test "$argv[1]" = "clone"
42
- vanguard clone $argv[2..-1]
43
- else
44
- command git $argv
45
- end
46
- end
47
- # --- VANGUARD PROTECTION END ---
48
- `
49
- },
50
- powershell: {
51
- file: 'Documents/PowerShell/Microsoft.PowerShell_profile.ps1',
52
- template: `
53
- # --- VANGUARD PROTECTION START ---
54
- function git {
55
- if ($args[0] -eq "clone") {
56
- vanguard clone @(if ($args.Length -gt 1) { $args[1..($args.Length-1)] })
57
- } else {
58
- & (Get-Command git -CommandType Application) @args
59
- }
60
- }
61
- # --- VANGUARD PROTECTION END ---
62
- `
63
- }
64
- };
7
+ // We use raw strings for templates to avoid JS interpolation issues
8
+ const BASH_ZSH_TEMPLATE = [
9
+ '# --- VANGUARD PROTECTION START ---',
10
+ '# Universal Interceptor for Bash/Zsh',
11
+ 'git() {',
12
+ ' if [ "$1" = "clone" ] && [ -z "$VANGUARD_INTERNAL" ]; then',
13
+ ' export VANGUARD_INTERNAL=1',
14
+ ' vanguard clone "${@:2}"',
15
+ ' unset VANGUARD_INTERNAL',
16
+ ' else',
17
+ ' command git "$@"',
18
+ ' fi',
19
+ '}',
20
+ '# --- VANGUARD PROTECTION END ---'
21
+ ].join('\n');
22
+
23
+ const POWERSHELL_TEMPLATE = [
24
+ '# --- VANGUARD PROTECTION START ---',
25
+ '# Universal Interceptor for PowerShell',
26
+ 'function git {',
27
+ ' if ($args[0] -eq "clone" -and !$env:VANGUARD_INTERNAL) {',
28
+ ' $env:VANGUARD_INTERNAL = "1"',
29
+ ' try {',
30
+ ' vanguard clone @(if ($args.Length -gt 1) { $args[1..($args.Length-1)] })',
31
+ ' } finally {',
32
+ ' $env:VANGUARD_INTERNAL = $null',
33
+ ' }',
34
+ ' } else {',
35
+ ' & (Get-Command git -CommandType Application) @args',
36
+ ' }',
37
+ '}',
38
+ '# --- VANGUARD PROTECTION END ---'
39
+ ].join('\n');
40
+
41
+ const FISH_TEMPLATE = [
42
+ '# --- VANGUARD PROTECTION START ---',
43
+ '# Universal Interceptor for Fish',
44
+ 'function git',
45
+ ' if test "$argv[1]" = "clone"; and test -z "$VANGUARD_INTERNAL"',
46
+ ' set -gx VANGUARD_INTERNAL 1',
47
+ ' vanguard clone $argv[2..-1]',
48
+ ' set -e VANGUARD_INTERNAL',
49
+ ' else',
50
+ ' command git $argv',
51
+ ' end',
52
+ 'end',
53
+ '# --- VANGUARD PROTECTION END ---'
54
+ ].join('\n');
65
55
 
66
56
  export async function runIntegrate() {
67
- console.log(chalk.bold('🐚 Vanguard Shell Integrator\n'));
68
- const spinner = createSpinner('🔍 Detecting shells and profiles...').start();
57
+ console.log(chalk.bold('🐚 Vanguard Shell Integrator (Universal Edition)\n'));
58
+ const spinner = createSpinner('🔍 Probing environment for shell profiles...').start();
69
59
 
70
60
  const home = os.homedir();
61
+ const isWin = os.platform() === 'win32';
71
62
  let detected = [];
72
63
 
73
- // Check Unix shells
74
- for (const [shell, info] of Object.entries(SCRIPTS)) {
75
- if (shell === 'powershell') continue;
76
- const profilePath = path.join(home, info.file);
77
- if (await fs.pathExists(profilePath)) {
78
- detected.push({ name: shell, path: profilePath, info });
64
+ // 1. Detect Unix-based Shells (Linux/macOS)
65
+ const unixShells = [
66
+ { name: 'zsh', file: '.zshrc', template: BASH_ZSH_TEMPLATE },
67
+ { name: 'bash', file: '.bashrc', template: BASH_ZSH_TEMPLATE },
68
+ { name: 'bash_profile', file: '.bash_profile', template: BASH_ZSH_TEMPLATE },
69
+ { name: 'fish', file: '.config/fish/config.fish', template: FISH_TEMPLATE }
70
+ ];
71
+
72
+ for (const shell of unixShells) {
73
+ const p = path.join(home, shell.file);
74
+ if (await fs.pathExists(p)) {
75
+ detected.push({ ...shell, path: p });
79
76
  }
80
77
  }
81
78
 
82
- // Check PowerShell
83
- const psProfile = path.join(home, SCRIPTS.powershell.file);
84
- if (await fs.pathExists(psProfile) || os.platform() === 'win32') {
85
- detected.push({ name: 'powershell', path: psProfile, info: SCRIPTS.powershell });
79
+ // 2. Detect PowerShell Profiles
80
+ const psFolders = [
81
+ path.join(home, 'Documents', 'PowerShell'),
82
+ path.join(home, 'Documents', 'WindowsPowerShell'),
83
+ path.join(home, 'OneDrive', 'Documents', 'PowerShell'),
84
+ path.join(home, 'OneDrive', 'Documents', 'WindowsPowerShell'),
85
+ path.join(home, 'OneDrive', 'Belgeler', 'PowerShell'),
86
+ path.join(home, 'OneDrive', 'Belgeler', 'WindowsPowerShell'),
87
+ path.join(home, '.config', 'powershell')
88
+ ];
89
+
90
+ for (const folder of psFolders) {
91
+ const p = path.join(folder, 'Microsoft.PowerShell_profile.ps1');
92
+ if (await fs.pathExists(p)) {
93
+ detected.push({ name: 'powershell', path: p, template: POWERSHELL_TEMPLATE });
94
+ }
95
+ }
96
+
97
+ if (isWin && !detected.some(sh => sh.name === 'powershell')) {
98
+ const p = path.join(home, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1');
99
+ detected.push({ name: 'powershell', path: p, template: POWERSHELL_TEMPLATE });
86
100
  }
87
101
 
88
102
  if (detected.length === 0) {
89
- spinner.fail('No supported shell profiles detected.');
103
+ spinner.fail('No shell profiles found.');
90
104
  return;
91
105
  }
92
106
 
93
- spinner.succeed(`Detected ${detected.length} shell profiles.`);
107
+ spinner.succeed(`Identified ${detected.length} active Shell targets.`);
94
108
 
95
109
  for (const shell of detected) {
96
- const profilePath = shell.path;
97
- const backupPath = `${profilePath}.backup`;
98
-
99
110
  try {
100
- // Backup
101
- if (await fs.pathExists(profilePath)) {
102
- await fs.copy(profilePath, backupPath);
103
- console.log(chalk.dim(`💾 Backup created: ${backupPath}`));
111
+ const profileContent = await fs.readFile(shell.path, 'utf-8').catch(() => '');
112
+
113
+ if (profileContent) {
114
+ await fs.copy(shell.path, `${shell.path}.vanguard_backup`);
104
115
  } else {
105
- await fs.ensureDir(path.dirname(profilePath));
106
- await fs.writeFile(profilePath, '');
116
+ await fs.ensureDir(path.dirname(shell.path));
107
117
  }
108
118
 
109
- const content = await fs.readFile(profilePath, 'utf-8');
110
- if (content.includes('VANGUARD PROTECTION START')) {
111
- console.log(chalk.yellow(`⏩ ${shell.name} already integrated. Skipping.`));
112
- continue;
119
+ if (profileContent.includes('VANGUARD PROTECTION START')) {
120
+ console.log(chalk.dim(` ⏩ ${shell.name} already protected. Synchronizing logic...`));
121
+ const newContent = profileContent.replace(
122
+ /# --- VANGUARD PROTECTION START ---[\s\S]*?# --- VANGUARD PROTECTION END ---/g,
123
+ shell.template.trim()
124
+ );
125
+ await fs.writeFile(shell.path, newContent);
126
+ } else {
127
+ await fs.appendFile(shell.path, `\n${shell.template}\n`);
128
+ console.log(chalk.green(` ✅ ${shell.name} protection INJECTED!`));
113
129
  }
114
-
115
- await fs.appendFile(profilePath, shell.info.template);
116
- console.log(chalk.green(`✅ Integrated with ${shell.name} (${profilePath})`));
117
- } catch (err) {
118
- console.log(chalk.red(`❌ Failed to integrate with ${shell.name}: ${err.message}`));
130
+ } catch (e) {
131
+ console.log(chalk.red(` ❌ Error securing ${shell.name}: ${e.message}`));
119
132
  }
120
133
  }
121
134
 
122
- console.log(chalk.bold('\nInvisible Protection Active! Restart your terminal to apply. 🛡️'));
135
+ console.log(chalk.bold('\n🛡️ Invisible Protection is now armed across your system.'));
136
+ console.log(chalk.cyan('👉 ACTION REQUIRED: Fully restart your terminal application to activate the shield.\n'));
123
137
  }
@@ -32,7 +32,7 @@ export class IntelligenceEngine {
32
32
  )
33
33
  );
34
34
  } catch {
35
- console.log(chalk.yellow(' ⚠️ Using Local Rules Only (Offline Fallback)'));
35
+ console.log(chalk.yellow(' ⚠️ Using Local Rules Only (Offline Fallback)'));
36
36
  }
37
37
  }
38
38
 
package/lib/utils/ui.js CHANGED
@@ -53,13 +53,13 @@ export function showFooter() {
53
53
  chalk.dim('\n----------------------------------------------------------------------')
54
54
  );
55
55
  console.log(
56
- chalk.yellow('⭐ Star on GitHub: ') + chalk.underline('https://github.com/bazob/vanguard')
56
+ chalk.yellow('⭐ Star on GitHub: ') + chalk.underline('https://github.com/bazobehram/vanguard')
57
57
  );
58
58
  console.log(
59
- chalk.green('🤝 Contribute: ') + chalk.underline('https://github.com/bazob/vanguard/pulls')
59
+ chalk.green('🤝 Contribute: ') + chalk.underline('https://github.com/bazobehram/vanguard/pulls')
60
60
  );
61
61
  console.log(
62
- chalk.cyan('☕ Support the project: ') +
62
+ chalk.cyan('☕ Support the project: ') +
63
63
  chalk.underline('https://www.buymeacoffee.com/bazobehram')
64
64
  );
65
65
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vanguard-cli",
3
- "version": "3.1.7",
3
+ "version": "3.1.11",
4
4
  "description": "AI-Powered Supply Chain Firewall for Git",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "git+https://github.com/bazob/vanguard.git"
22
+ "url": "git+https://github.com/bazobehram/vanguard.git"
23
23
  },
24
24
  "dependencies": {
25
25
  "@google/generative-ai": "^0.21.0",
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 🚨 THREAT VECTOR: PROJECT_OMEGA (MOCK)
3
+ * This file contains the mock threat signature we added to lib/threats.json.
4
+ */
5
+
6
+ function initializeSystem() {
7
+ console.log("System initializing...");
8
+ }
9
+
10
+ // ALERT: PROJECT_OMEGA sequence initiated
11
+ const secretKey = "SG0uLi4uIHRoaXMgaXMgYSBzZWNyZXQ=";
12
+ initializeSystem();
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "vanguard-malware-lab",
3
+ "version": "1.0.0",
4
+ "description": "Educational test repository for supply chain security auditing.",
5
+ "scripts": {
6
+ "postinstall": "node ./scripts/postinstall.js"
7
+ },
8
+ "dependencies": {
9
+ "axios": "^1.6.0"
10
+ }
11
+ }