ai-secret-scout 2.3.0 β 2.3.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.
- package/ai_secret_scout.py +1 -1
- package/bin/aiscout.js +5 -1
- package/bin/check-environment.js +180 -0
- package/package.json +2 -1
package/ai_secret_scout.py
CHANGED
package/bin/aiscout.js
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { runCheck } = require('./check-environment');
|
|
6
|
+
|
|
7
|
+
// Valide la prΓ©sence et la version de Node (>=16) et Python (>=3.10)
|
|
8
|
+
const pyCmd = runCheck(false);
|
|
5
9
|
|
|
6
10
|
const pyScript = path.join(__dirname, '..', 'ai_secret_scout.py');
|
|
7
11
|
|
|
8
|
-
const child = spawn(
|
|
12
|
+
const child = spawn(pyCmd, [pyScript, ...process.argv.slice(2)], {
|
|
9
13
|
stdio: 'inherit',
|
|
10
14
|
env: process.env
|
|
11
15
|
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
function isFrenchLocale() {
|
|
7
|
+
const envLang = (process.env.LANG || process.env.LC_ALL || process.env.LC_MESSAGES || '').toLowerCase();
|
|
8
|
+
return envLang.includes('fr');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function checkNodeVersion() {
|
|
12
|
+
const nodeVer = process.version;
|
|
13
|
+
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
14
|
+
return {
|
|
15
|
+
ok: major >= 16,
|
|
16
|
+
version: nodeVer,
|
|
17
|
+
major
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function checkPythonVersion() {
|
|
22
|
+
const candidates = ['python3', 'python'];
|
|
23
|
+
|
|
24
|
+
for (const cmd of candidates) {
|
|
25
|
+
try {
|
|
26
|
+
const output = execSync(`${cmd} -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')"`, {
|
|
27
|
+
encoding: 'utf-8',
|
|
28
|
+
stdio: ['pipe', 'pipe', 'ignore'],
|
|
29
|
+
timeout: 3000
|
|
30
|
+
}).trim();
|
|
31
|
+
|
|
32
|
+
const parts = output.split('.').map(n => parseInt(n, 10));
|
|
33
|
+
const major = parts[0];
|
|
34
|
+
const minor = parts[1];
|
|
35
|
+
|
|
36
|
+
if (major === 3 && minor >= 10) {
|
|
37
|
+
return {
|
|
38
|
+
ok: true,
|
|
39
|
+
cmd,
|
|
40
|
+
version: output,
|
|
41
|
+
tooOld: false
|
|
42
|
+
};
|
|
43
|
+
} else if (major === 3 || major === 2) {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
cmd,
|
|
47
|
+
version: output,
|
|
48
|
+
tooOld: true
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
} catch {
|
|
52
|
+
// Ignore and try next candidate
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
cmd: null,
|
|
59
|
+
version: null,
|
|
60
|
+
tooOld: false
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getInstallSuggestion(isFr) {
|
|
65
|
+
let pkgManager = 'apt';
|
|
66
|
+
try {
|
|
67
|
+
if (fs.existsSync('/etc/os-release')) {
|
|
68
|
+
const osRelease = fs.readFileSync('/etc/os-release', 'utf-8');
|
|
69
|
+
if (/ID(_LIKE)?=.*(fedora|rhel|centos|nobara)/i.test(osRelease)) {
|
|
70
|
+
pkgManager = 'dnf';
|
|
71
|
+
} else if (/ID(_LIKE)?=.*(arch|manjaro)/i.test(osRelease)) {
|
|
72
|
+
pkgManager = 'pacman';
|
|
73
|
+
} else if (/ID(_LIKE)?=.*(suse)/i.test(osRelease)) {
|
|
74
|
+
pkgManager = 'zypper';
|
|
75
|
+
} else if (/ID(_LIKE)?=.*(alpine)/i.test(osRelease)) {
|
|
76
|
+
pkgManager = 'apk';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} catch {
|
|
80
|
+
// Standard fallback
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const commands = {
|
|
84
|
+
dnf: 'sudo dnf install -y python3',
|
|
85
|
+
apt: 'sudo apt update && sudo apt install -y python3',
|
|
86
|
+
pacman: 'sudo pacman -S python',
|
|
87
|
+
zypper: 'sudo zypper install python3',
|
|
88
|
+
apk: 'apk add python3'
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const cmd = commands[pkgManager] || 'sudo apt install python3';
|
|
92
|
+
|
|
93
|
+
if (isFr) {
|
|
94
|
+
return `π Commande d'installation recommandΓ©e pour votre distribution :\n ${cmd}`;
|
|
95
|
+
}
|
|
96
|
+
return `π Recommended installation command for your distribution:\n ${cmd}`;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function runCheck(isPostinstall = false) {
|
|
100
|
+
const isFr = isFrenchLocale();
|
|
101
|
+
const nodeStatus = checkNodeVersion();
|
|
102
|
+
const pyStatus = checkPythonVersion();
|
|
103
|
+
|
|
104
|
+
if (isPostinstall) {
|
|
105
|
+
// Mode postinstall lors du npm install -g
|
|
106
|
+
if (nodeStatus.ok && pyStatus.ok) {
|
|
107
|
+
console.log('\x1b[32mβ AI Secret Scout - Environment check passed:\x1b[0m');
|
|
108
|
+
console.log(` β’ Node.js : ${nodeStatus.version} (OK)`);
|
|
109
|
+
console.log(` β’ Python : ${pyStatus.version} (${pyStatus.cmd} - OK)`);
|
|
110
|
+
console.log('\x1b[36mπ AI Secret Scout is ready to run! Type: aiscout\x1b[0m\n');
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!nodeStatus.ok) {
|
|
115
|
+
console.warn(`\x1b[33mβ οΈ Warning: Node.js version ${nodeStatus.version} detected. AI Secret Scout recommends Node.js >= 16.0.0.\x1b[0m`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (!pyStatus.ok) {
|
|
119
|
+
console.warn('\x1b[33mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m');
|
|
120
|
+
if (pyStatus.tooOld) {
|
|
121
|
+
console.warn(`\x1b[33mβ οΈ Warning: Python ${pyStatus.version} found via '${pyStatus.cmd}', but AI Secret Scout requires Python >= 3.10.\x1b[0m`);
|
|
122
|
+
} else {
|
|
123
|
+
console.warn('\x1b[33mβ οΈ Warning: Python 3 was not detected on your system.\x1b[0m');
|
|
124
|
+
}
|
|
125
|
+
console.warn(isFr
|
|
126
|
+
? 'AI Secret Scout nΓ©cessite Python 3.10+ pour exΓ©cuter le moteur d\'analyse TUI.'
|
|
127
|
+
: 'AI Secret Scout requires Python 3.10+ to run the core TUI security engine.'
|
|
128
|
+
);
|
|
129
|
+
console.warn(getInstallSuggestion(isFr));
|
|
130
|
+
console.warn('\x1b[33mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m\n');
|
|
131
|
+
}
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Mode runtime direct (aiscout execution)
|
|
136
|
+
if (!nodeStatus.ok) {
|
|
137
|
+
console.error(isFr
|
|
138
|
+
? `β Erreur : Version de Node.js obsolΓ¨te (${nodeStatus.version}). Node.js >= 16.0.0 est requis.`
|
|
139
|
+
: `β Error: Outdated Node.js version (${nodeStatus.version}). Node.js >= 16.0.0 is required.`
|
|
140
|
+
);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!pyStatus.ok) {
|
|
145
|
+
console.error('\x1b[31mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m');
|
|
146
|
+
if (pyStatus.tooOld) {
|
|
147
|
+
console.error(isFr
|
|
148
|
+
? `β Version de Python trop ancienne : ${pyStatus.version} dΓ©tectΓ© (${pyStatus.cmd}).\n AI Secret Scout requiert Python 3.10 ou supΓ©rieur.`
|
|
149
|
+
: `β Python version too old: ${pyStatus.version} detected (${pyStatus.cmd}).\n AI Secret Scout requires Python 3.10 or higher.`
|
|
150
|
+
);
|
|
151
|
+
} else {
|
|
152
|
+
console.error(isFr
|
|
153
|
+
? 'β Python 3 (python3) est introuvable sur votre systΓ¨me.'
|
|
154
|
+
: 'β Python 3 (python3) could not be found on your system.'
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
console.error('');
|
|
158
|
+
console.error(getInstallSuggestion(isFr));
|
|
159
|
+
console.error(isFr
|
|
160
|
+
? 'π‘ Note : Aucun paquet pip externe n\'est requis (seule la bibliothΓ¨que standard Python est utilisΓ©e).'
|
|
161
|
+
: 'π‘ Note: No pip packages required (uses Python standard library only).'
|
|
162
|
+
);
|
|
163
|
+
console.error('\x1b[31mββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m');
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return pyStatus.cmd;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (require.main === module) {
|
|
171
|
+
const isPostinstall = process.argv.includes('--postinstall');
|
|
172
|
+
runCheck(isPostinstall);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
module.exports = {
|
|
176
|
+
checkNodeVersion,
|
|
177
|
+
checkPythonVersion,
|
|
178
|
+
getInstallSuggestion,
|
|
179
|
+
runCheck
|
|
180
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-secret-scout",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Zero-dependency heuristic secret scanner & redaction tool for AI coding assistants (Claude Code, Antigravity, Codex, Copilot, Cursor)",
|
|
5
5
|
"main": "bin/aiscout.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"README.fr.md"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
+
"postinstall": "node ./bin/check-environment.js --postinstall",
|
|
17
18
|
"start": "node ./bin/aiscout.js"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|