natureco-cli 5.59.0 → 5.61.0
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/package.json +1 -1
- package/src/commands/audit.js +26 -24
- package/src/commands/code.js +95 -87
- package/src/commands/code_v5.js +58 -56
- package/src/commands/medium.js +32 -30
- package/src/commands/migrate.js +54 -52
- package/src/commands/naturehub.js +32 -30
- package/src/commands/policy.js +32 -30
- package/src/commands/security.js +24 -22
- package/src/commands/seo.js +43 -41
- package/src/commands/xp.js +42 -40
package/src/commands/policy.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
3
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
2
4
|
const fs = require('fs');
|
|
3
5
|
const path = require('path');
|
|
4
6
|
const os = require('os');
|
|
@@ -12,35 +14,35 @@ function policy(args) {
|
|
|
12
14
|
if (action === 'list') return listPolicies();
|
|
13
15
|
if (action === 'remove') return removePolicy(params[0]);
|
|
14
16
|
|
|
15
|
-
console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
|
|
16
|
-
console.log(chalk.gray(' Kullanım: natureco policy [check|set|list|remove]\n'));
|
|
17
|
+
console.log(chalk.red(`\n ❌ ${L('Bilinmeyen komut', 'Unknown command')}: ${action}\n`));
|
|
18
|
+
console.log(chalk.gray(L(' Kullanım: natureco policy [check|set|list|remove]\n', ' Usage: natureco policy [check|set|list|remove]\n')));
|
|
17
19
|
process.exit(1);
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
const POLICY_CHECKS = [
|
|
21
23
|
{
|
|
22
24
|
id: 'node-version',
|
|
23
|
-
name: 'Node.js Versiyonu',
|
|
25
|
+
name: L('Node.js Versiyonu', 'Node.js Version'),
|
|
24
26
|
check: () => {
|
|
25
27
|
const v = process.version.slice(1).split('.')[0];
|
|
26
28
|
return parseInt(v) >= 18
|
|
27
29
|
? { status: 'pass', message: `Node.js ${process.version}` }
|
|
28
|
-
: { status: 'fail', message: `Node.js ${process.version} (18+ gerekli)`, fix: 'Node.js güncelleyin' };
|
|
30
|
+
: { status: 'fail', message: `Node.js ${process.version} (18+ ${L('gerekli', 'required')})`, fix: L('Node.js güncelleyin', 'Update Node.js') };
|
|
29
31
|
}
|
|
30
32
|
},
|
|
31
33
|
{
|
|
32
34
|
id: 'config-exists',
|
|
33
|
-
name: 'Config Dosyası',
|
|
35
|
+
name: L('Config Dosyası', 'Config File'),
|
|
34
36
|
check: () => {
|
|
35
37
|
const configFile = path.join(os.homedir(), '.natureco', 'config.json');
|
|
36
38
|
if (!fs.existsSync(configFile)) {
|
|
37
|
-
return { status: 'fail', message: 'config.json bulunamadı', fix: 'natureco setup çalıştırın' };
|
|
39
|
+
return { status: 'fail', message: L('config.json bulunamadı', 'config.json not found'), fix: L('natureco setup çalıştırın', 'run natureco setup') };
|
|
38
40
|
}
|
|
39
41
|
try {
|
|
40
42
|
JSON.parse(fs.readFileSync(configFile, 'utf-8'));
|
|
41
|
-
return { status: 'pass', message: 'Config geçerli JSON' };
|
|
43
|
+
return { status: 'pass', message: L('Config geçerli JSON', 'Config valid JSON') };
|
|
42
44
|
} catch {
|
|
43
|
-
return { status: 'fail', message: 'Config bozuk JSON', fix: '~/.natureco/config.json düzeltin' };
|
|
45
|
+
return { status: 'fail', message: L('Config bozuk JSON', 'Config broken JSON'), fix: L('~/.natureco/config.json düzeltin', 'fix ~/.natureco/config.json') };
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
},
|
|
@@ -50,9 +52,9 @@ const POLICY_CHECKS = [
|
|
|
50
52
|
check: () => {
|
|
51
53
|
const config = getConfig();
|
|
52
54
|
if (config.providerApiKey || config.apiKey || process.env.GROQ_API_KEY) {
|
|
53
|
-
return { status: 'pass', message: 'API key mevcut' };
|
|
55
|
+
return { status: 'pass', message: L('API key mevcut', 'API key present') };
|
|
54
56
|
}
|
|
55
|
-
return { status: 'warn', message: 'API key eksik', fix: 'natureco login veya GROQ_API_KEY env' };
|
|
57
|
+
return { status: 'warn', message: L('API key eksik', 'API key missing'), fix: L('natureco login veya GROQ_API_KEY env', 'natureco login or GROQ_API_KEY env') };
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
{
|
|
@@ -63,46 +65,46 @@ const POLICY_CHECKS = [
|
|
|
63
65
|
if (config.providerUrl) {
|
|
64
66
|
return { status: 'pass', message: config.providerUrl };
|
|
65
67
|
}
|
|
66
|
-
return { status: 'warn', message: 'Provider ayarlanmamış', fix: 'natureco setup' };
|
|
68
|
+
return { status: 'warn', message: L('Provider ayarlanmamış', 'Provider not set'), fix: 'natureco setup' };
|
|
67
69
|
}
|
|
68
70
|
},
|
|
69
71
|
{
|
|
70
72
|
id: 'git-config',
|
|
71
|
-
name: 'Git Yapılandırması',
|
|
73
|
+
name: L('Git Yapılandırması', 'Git Configuration'),
|
|
72
74
|
check: () => {
|
|
73
75
|
try {
|
|
74
76
|
const { execSync } = require('child_process');
|
|
75
77
|
const name = execSync('git config user.name', { encoding: 'utf-8', stdio: 'pipe' }).trim();
|
|
76
78
|
const email = execSync('git config user.email', { encoding: 'utf-8', stdio: 'pipe' }).trim();
|
|
77
79
|
if (name && email) return { status: 'pass', message: `${name} <${email}>` };
|
|
78
|
-
return { status: 'warn', message: 'Git user.name/email eksik', fix: 'git config --global user.name "Adınız"' };
|
|
80
|
+
return { status: 'warn', message: L('Git user.name/email eksik', 'Git user.name/email missing'), fix: L('git config --global user.name "Adınız"', 'git config --global user.name "Your Name"') };
|
|
79
81
|
} catch {
|
|
80
|
-
return { status: 'warn', message: 'Git repo değil', fix: 'git init' };
|
|
82
|
+
return { status: 'warn', message: L('Git repo değil', 'Not a git repo'), fix: 'git init' };
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
},
|
|
84
86
|
{
|
|
85
87
|
id: 'disk-space',
|
|
86
|
-
name: 'Disk Alanı',
|
|
88
|
+
name: L('Disk Alanı', 'Disk Space'),
|
|
87
89
|
check: () => {
|
|
88
90
|
try {
|
|
89
91
|
const drive = path.parse(os.homedir()).root.replace(':', '');
|
|
90
92
|
const { execSync } = require('child_process');
|
|
91
93
|
const output = execSync(`powershell -Command "Get-PSDrive -Name ${drive} | Select-Object -ExpandProperty Free"`, { encoding: 'utf-8' }).trim();
|
|
92
94
|
const free = parseInt(output);
|
|
93
|
-
if (isNaN(free)) return { status: 'pass', message: 'Kontrol edilemedi' };
|
|
95
|
+
if (isNaN(free)) return { status: 'pass', message: L('Kontrol edilemedi', 'Could not check') };
|
|
94
96
|
const freeGB = free / 1e9;
|
|
95
|
-
if (freeGB < 0.5) return { status: 'fail', message:
|
|
96
|
-
return { status: 'pass', message: `${freeGB.toFixed(1)}GB boş alan` };
|
|
97
|
+
if (freeGB < 0.5) return { status: 'fail', message: `${L('Sadece', 'Only')} ${freeGB.toFixed(1)}GB ${L('boş', 'free')}`, fix: L('Disk temizliği yapın', 'Free up disk space') };
|
|
98
|
+
return { status: 'pass', message: `${freeGB.toFixed(1)}GB ${L('boş alan', 'free')}` };
|
|
97
99
|
} catch {
|
|
98
|
-
return { status: 'pass', message: 'Kontrol edilemedi' };
|
|
100
|
+
return { status: 'pass', message: L('Kontrol edilemedi', 'Could not check') };
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
];
|
|
103
105
|
|
|
104
106
|
function checkPolicy() {
|
|
105
|
-
console.log(chalk.cyan.bold('\n Workspace Uyumluluk Politikası\n'));
|
|
107
|
+
console.log(chalk.cyan.bold(L('\n Workspace Uyumluluk Politikası\n', '\n Workspace Compliance Policy\n')));
|
|
106
108
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
107
109
|
|
|
108
110
|
let passed = 0;
|
|
@@ -116,29 +118,29 @@ function checkPolicy() {
|
|
|
116
118
|
passed++;
|
|
117
119
|
} else if (result.status === 'fail') {
|
|
118
120
|
console.log(` ${chalk.red('✗')} ${check.name}: ${chalk.white(result.message)}`);
|
|
119
|
-
console.log(chalk.gray(` Düzeltme: ${result.fix}`));
|
|
121
|
+
console.log(chalk.gray(` ${L('Düzeltme', 'Fix')}: ${result.fix}`));
|
|
120
122
|
failed++;
|
|
121
123
|
} else {
|
|
122
124
|
console.log(` ${chalk.yellow('⚠')} ${check.name}: ${chalk.white(result.message)}`);
|
|
123
|
-
if (result.fix) console.log(chalk.gray(` Öneri: ${result.fix}`));
|
|
125
|
+
if (result.fix) console.log(chalk.gray(` ${L('Öneri', 'Tip')}: ${result.fix}`));
|
|
124
126
|
warnings++;
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
129
|
-
console.log(chalk.gray(` Geçti: ${passed} |
|
|
131
|
+
console.log(chalk.gray(` ${L('Geçti', 'Passed')}: ${passed} | ${L('Uyarı', 'Warnings')}: ${warnings} | ${L('Hata', 'Errors')}: ${failed}\n`));
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
function setPolicy(key, value) {
|
|
133
135
|
if (!key) {
|
|
134
|
-
console.log(chalk.red('\n ❌ Politika adı gerekli\n'));
|
|
136
|
+
console.log(chalk.red(L('\n ❌ Politika adı gerekli\n', '\n ❌ Policy name required\n')));
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
const config = getConfig();
|
|
138
140
|
if (!config.policies) config.policies = {};
|
|
139
141
|
config.policies[key] = value;
|
|
140
142
|
saveConfig(config);
|
|
141
|
-
console.log(chalk.green(`\n ✓ Politika
|
|
143
|
+
console.log(chalk.green(`\n ✓ ${L('Politika ayarlandı', 'Policy set')}: ${key} = ${value}\n`));
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
function listPolicies() {
|
|
@@ -146,11 +148,11 @@ function listPolicies() {
|
|
|
146
148
|
const policies = config.policies || {};
|
|
147
149
|
|
|
148
150
|
if (Object.keys(policies).length === 0) {
|
|
149
|
-
console.log(chalk.gray('\n Tanımlı politika yok.\n'));
|
|
151
|
+
console.log(chalk.gray(L('\n Tanımlı politika yok.\n', '\n No policies defined.\n')));
|
|
150
152
|
return;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
console.log(chalk.cyan.bold('\n Tanımlı Politikalar\n'));
|
|
155
|
+
console.log(chalk.cyan.bold(L('\n Tanımlı Politikalar\n', '\n Defined Policies\n')));
|
|
154
156
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
155
157
|
for (const [key, value] of Object.entries(policies)) {
|
|
156
158
|
console.log(` ${chalk.white(key)}: ${chalk.cyan(value)}`);
|
|
@@ -160,16 +162,16 @@ function listPolicies() {
|
|
|
160
162
|
|
|
161
163
|
function removePolicy(key) {
|
|
162
164
|
if (!key) {
|
|
163
|
-
console.log(chalk.red('\n ❌ Politika adı gerekli\n'));
|
|
165
|
+
console.log(chalk.red(L('\n ❌ Politika adı gerekli\n', '\n ❌ Policy name required\n')));
|
|
164
166
|
return;
|
|
165
167
|
}
|
|
166
168
|
const config = getConfig();
|
|
167
169
|
if (config.policies?.[key]) {
|
|
168
170
|
delete config.policies[key];
|
|
169
171
|
saveConfig(config);
|
|
170
|
-
console.log(chalk.green(`\n ✓ Politika silindi: ${key}\n`));
|
|
172
|
+
console.log(chalk.green(`\n ✓ ${L('Politika silindi', 'Policy deleted')}: ${key}\n`));
|
|
171
173
|
} else {
|
|
172
|
-
console.log(chalk.yellow(`\n ⚠ Politika
|
|
174
|
+
console.log(chalk.yellow(`\n ⚠ ${L('Politika bulunamadı', 'Policy not found')}: ${key}\n`));
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
|
package/src/commands/security.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
3
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
2
4
|
const fs = require('fs');
|
|
3
5
|
const path = require('path');
|
|
4
6
|
const os = require('os');
|
|
@@ -17,8 +19,8 @@ async function security(args) {
|
|
|
17
19
|
|
|
18
20
|
if (action === 'secrets') return scanSecrets(args);
|
|
19
21
|
|
|
20
|
-
console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
|
|
21
|
-
console.log(chalk.gray(' Kullanım: natureco security [audit|allowlist|policy|secrets]\n'));
|
|
22
|
+
console.log(chalk.red(`\n ❌ ${L('Bilinmeyen komut', 'Unknown command')}: ${action}\n`));
|
|
23
|
+
console.log(chalk.gray(L(' Kullanım: natureco security [audit|allowlist|policy|secrets]\n', ' Usage: natureco security [audit|allowlist|policy|secrets]\n')));
|
|
22
24
|
process.exit(1);
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -58,7 +60,7 @@ async function allowlistAction(args) {
|
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
console.log(chalk.gray('\n Kullanım:'));
|
|
63
|
+
console.log(chalk.gray(L('\n Kullanım:', '\n Usage:')));
|
|
62
64
|
console.log(chalk.gray(' natureco security allowlist list'));
|
|
63
65
|
console.log(chalk.gray(' natureco security allowlist add "<command>"'));
|
|
64
66
|
console.log(chalk.gray(' natureco security allowlist remove <id>\n'));
|
|
@@ -79,7 +81,7 @@ async function policyAction(args) {
|
|
|
79
81
|
return;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
console.log(chalk.gray('\n Kullanım:'));
|
|
84
|
+
console.log(chalk.gray(L('\n Kullanım:', '\n Usage:')));
|
|
83
85
|
console.log(chalk.gray(' natureco security policy set deny|allowlist|full'));
|
|
84
86
|
console.log(chalk.gray('\n Policy levels:'));
|
|
85
87
|
console.log(chalk.gray(' deny - Block all command execution'));
|
|
@@ -140,11 +142,11 @@ async function audit(args) {
|
|
|
140
142
|
if (process.platform !== 'win32' && mode !== '600' && mode !== '644') {
|
|
141
143
|
issues.push({
|
|
142
144
|
id: 'config-permissions',
|
|
143
|
-
msg:
|
|
145
|
+
msg: `${L('Config dosyası izinleri geniş', 'Config file permissions too broad')}: ${mode} ${L('(önerilen: 600)', '(recommended: 600)')}`,
|
|
144
146
|
fix: () => fs.chmodSync(CONFIG_FILE, 0o600),
|
|
145
147
|
});
|
|
146
148
|
} else {
|
|
147
|
-
ok.push('Config dosyası izinleri');
|
|
149
|
+
ok.push(L('Config dosyası izinleri', 'Config file permissions'));
|
|
148
150
|
}
|
|
149
151
|
} catch {}
|
|
150
152
|
}
|
|
@@ -153,7 +155,7 @@ async function audit(args) {
|
|
|
153
155
|
const config = getConfig();
|
|
154
156
|
if (config.providerApiKey) {
|
|
155
157
|
if (config.providerApiKey.length < 10) {
|
|
156
|
-
issues.push({ id: 'weak-api-key', msg: 'API key çok kısa görünüyor' });
|
|
158
|
+
issues.push({ id: 'weak-api-key', msg: L('API key çok kısa görünüyor', 'API key looks too short') });
|
|
157
159
|
} else {
|
|
158
160
|
ok.push('API key formatı');
|
|
159
161
|
}
|
|
@@ -161,9 +163,9 @@ async function audit(args) {
|
|
|
161
163
|
|
|
162
164
|
// 3. Debug mode
|
|
163
165
|
if (config.debug === true) {
|
|
164
|
-
warnings.push({ id: 'debug-mode', msg: 'Debug modu açık — API key\'ler loglara yazılabilir' });
|
|
166
|
+
warnings.push({ id: 'debug-mode', msg: L('Debug modu açık — API key\'ler loglara yazılabilir', 'Debug mode on — API keys may be written to logs') });
|
|
165
167
|
} else {
|
|
166
|
-
ok.push('Debug modu kapalı');
|
|
168
|
+
ok.push(L('Debug modu kapalı', 'Debug mode off'));
|
|
167
169
|
}
|
|
168
170
|
|
|
169
171
|
// 4. WhatsApp session dosyaları
|
|
@@ -171,9 +173,9 @@ async function audit(args) {
|
|
|
171
173
|
if (fs.existsSync(waDir)) {
|
|
172
174
|
const sessions = fs.readdirSync(waDir);
|
|
173
175
|
if (sessions.length > 3) {
|
|
174
|
-
warnings.push({ id: 'old-wa-sessions', msg: `${sessions.length} WhatsApp session var — eskiler temizlenebilir` });
|
|
176
|
+
warnings.push({ id: 'old-wa-sessions', msg: `${sessions.length} WhatsApp ${L('session var — eskiler temizlenebilir', 'sessions — old ones can be cleaned')}` });
|
|
175
177
|
} else {
|
|
176
|
-
ok.push('WhatsApp session sayısı');
|
|
178
|
+
ok.push(L('WhatsApp session sayısı', 'WhatsApp session count'));
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
|
|
@@ -183,9 +185,9 @@ async function audit(args) {
|
|
|
183
185
|
const stat = fs.statSync(logFile);
|
|
184
186
|
const sizeMB = stat.size / (1024 * 1024);
|
|
185
187
|
if (sizeMB > 50) {
|
|
186
|
-
warnings.push({ id: 'large-log', msg:
|
|
188
|
+
warnings.push({ id: 'large-log', msg: `${L('Gateway log dosyası büyük', 'Gateway log file large')}: ${sizeMB.toFixed(1)}MB` });
|
|
187
189
|
} else {
|
|
188
|
-
ok.push('Gateway log boyutu');
|
|
190
|
+
ok.push(L('Gateway log boyutu', 'Gateway log size'));
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
|
|
@@ -194,9 +196,9 @@ async function audit(args) {
|
|
|
194
196
|
if (fs.existsSync(convDir)) {
|
|
195
197
|
const convFiles = fs.readdirSync(convDir).filter(f => f.endsWith('.json'));
|
|
196
198
|
if (convFiles.length > 20) {
|
|
197
|
-
warnings.push({ id: 'old-conversations', msg: `${convFiles.length} konuşma dosyası var — eskiler temizlenebilir` });
|
|
199
|
+
warnings.push({ id: 'old-conversations', msg: `${convFiles.length} ${L('konuşma dosyası var — eskiler temizlenebilir', 'conversation files — old ones can be cleaned')}` });
|
|
198
200
|
} else {
|
|
199
|
-
ok.push('Konuşma dosyası sayısı');
|
|
201
|
+
ok.push(L('Konuşma dosyası sayısı', 'Conversation file count'));
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
|
|
@@ -245,7 +247,7 @@ async function audit(args) {
|
|
|
245
247
|
|
|
246
248
|
console.log('');
|
|
247
249
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
248
|
-
console.log(chalk.cyan.bold('\n Güvenlik Denetimi\n'));
|
|
250
|
+
console.log(chalk.cyan.bold(L('\n Güvenlik Denetimi\n', '\n Security Audit\n')));
|
|
249
251
|
|
|
250
252
|
ok.forEach(msg => console.log(chalk.green(' ✓ ') + chalk.gray(msg)));
|
|
251
253
|
|
|
@@ -263,11 +265,11 @@ async function audit(args) {
|
|
|
263
265
|
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
264
266
|
|
|
265
267
|
if (issues.length === 0 && warnings.length === 0) {
|
|
266
|
-
console.log(chalk.green(' ✓ Güvenlik sorunu bulunamadı\n'));
|
|
268
|
+
console.log(chalk.green(L(' ✓ Güvenlik sorunu bulunamadı\n', ' ✓ No security issues found\n')));
|
|
267
269
|
return;
|
|
268
270
|
}
|
|
269
271
|
|
|
270
|
-
console.log(chalk.gray(` ${ok.length} geçti · ${warnings.length} uyarı · ${issues.length} sorun`));
|
|
272
|
+
console.log(chalk.gray(` ${ok.length} ${L('geçti', 'passed')} · ${warnings.length} ${L('uyarı', 'warnings')} · ${issues.length} ${L('sorun', 'issues')}`));
|
|
271
273
|
|
|
272
274
|
if (fix && issues.length > 0) {
|
|
273
275
|
console.log('');
|
|
@@ -275,14 +277,14 @@ async function audit(args) {
|
|
|
275
277
|
if (i.fix) {
|
|
276
278
|
try {
|
|
277
279
|
i.fix();
|
|
278
|
-
console.log(chalk.green(` ✓ Düzeltildi: ${i.id}`));
|
|
280
|
+
console.log(chalk.green(` ✓ ${L('Düzeltildi', 'Fixed')}: ${i.id}`));
|
|
279
281
|
} catch (e) {
|
|
280
|
-
console.log(chalk.red(` ❌ Düzeltilemedi: ${i.id} — ${e.message}`));
|
|
282
|
+
console.log(chalk.red(` ❌ ${L('Düzeltilemedi', 'Could not fix')}: ${i.id} — ${e.message}`));
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
});
|
|
284
286
|
} else if (issues.length > 0) {
|
|
285
|
-
console.log(chalk.gray('\n Otomatik düzeltmek için: ') + chalk.cyan('natureco security audit --fix'));
|
|
287
|
+
console.log(chalk.gray(L('\n Otomatik düzeltmek için: ', '\n To auto-fix: ')) + chalk.cyan('natureco security audit --fix'));
|
|
286
288
|
}
|
|
287
289
|
console.log('');
|
|
288
290
|
}
|
package/src/commands/seo.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const chalk = require('chalk');
|
|
15
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
16
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
15
17
|
const tui = require('../utils/tui');
|
|
16
18
|
const https = require('https');
|
|
17
19
|
const http = require('http');
|
|
@@ -111,28 +113,28 @@ function extractMeta(html) {
|
|
|
111
113
|
async function cmdAudit(args) {
|
|
112
114
|
const targetUrl = args[0];
|
|
113
115
|
if (!targetUrl) {
|
|
114
|
-
console.log(tui.C.red('\n Kullanım: natureco seo audit <url>\n'));
|
|
116
|
+
console.log(tui.C.red(L('\n Kullanım: natureco seo audit <url>\n', '\n Usage: natureco seo audit <url>\n')));
|
|
115
117
|
return;
|
|
116
118
|
}
|
|
117
119
|
|
|
118
|
-
console.log('\n' + tui.styled(` 🔍 SEO Denetimi: ${targetUrl}`, { color: tui.PALETTE.primary, bold: true }));
|
|
120
|
+
console.log('\n' + tui.styled(` 🔍 ${L('SEO Denetimi', 'SEO Audit')}: ${targetUrl}`, { color: tui.PALETTE.primary, bold: true }));
|
|
119
121
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
120
122
|
|
|
121
123
|
// Spinner göster
|
|
122
|
-
const spinner = new tui.Spinner('Sayfa yükleniyor', { style: 'dots' }).start();
|
|
124
|
+
const spinner = new tui.Spinner(L('Sayfa yükleniyor', 'Loading page'), { style: 'dots' }).start();
|
|
123
125
|
let response;
|
|
124
126
|
try {
|
|
125
127
|
response = await fetchUrl(targetUrl);
|
|
126
128
|
} catch (e) {
|
|
127
|
-
spinner.stop(tui.C.red('✗ Hata: ' + e.message));
|
|
129
|
+
spinner.stop(tui.C.red(L('✗ Hata: ', '✗ Error: ') + e.message));
|
|
128
130
|
console.log('');
|
|
129
131
|
return;
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
if (response.statusCode !== 200) {
|
|
133
|
-
spinner.stop(tui.C.yellow(`⚠ HTTP ${response.statusCode} yanıtı
|
|
135
|
+
spinner.stop(tui.C.yellow(`⚠ HTTP ${response.statusCode} ${L('yanıtı alındı', 'response received')}`));
|
|
134
136
|
} else {
|
|
135
|
-
spinner.stop(tui.C.green('✓ Sayfa yüklendi'));
|
|
137
|
+
spinner.stop(tui.C.green(L('✓ Sayfa yüklendi', '✓ Page loaded')));
|
|
136
138
|
}
|
|
137
139
|
console.log('');
|
|
138
140
|
|
|
@@ -142,80 +144,80 @@ async function cmdAudit(args) {
|
|
|
142
144
|
|
|
143
145
|
// Title
|
|
144
146
|
if (!meta.title) {
|
|
145
|
-
issues.push({ severity: 'high', msg: 'Title tag eksik' });
|
|
147
|
+
issues.push({ severity: 'high', msg: L('Title tag eksik', 'Title tag missing') });
|
|
146
148
|
} else if (meta.title.length < 30) {
|
|
147
|
-
issues.push({ severity: 'medium', msg:
|
|
149
|
+
issues.push({ severity: 'medium', msg: `${L('Title çok kısa', 'Title too short')} (${meta.title.length} ${L('karakter', 'chars')}, ideal: 50-60)` });
|
|
148
150
|
} else if (meta.title.length > 60) {
|
|
149
|
-
issues.push({ severity: 'medium', msg:
|
|
151
|
+
issues.push({ severity: 'medium', msg: `${L('Title çok uzun', 'Title too long')} (${meta.title.length} ${L('karakter', 'chars')}, ideal: 50-60)` });
|
|
150
152
|
} else {
|
|
151
|
-
passes.push(`Title (${meta.title.length} karakter)`);
|
|
153
|
+
passes.push(`Title (${meta.title.length} ${L('karakter', 'chars')})`);
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
// Description
|
|
155
157
|
if (!meta.description) {
|
|
156
|
-
issues.push({ severity: 'high', msg: 'Meta description eksik' });
|
|
158
|
+
issues.push({ severity: 'high', msg: L('Meta description eksik', 'Meta description missing') });
|
|
157
159
|
} else if (meta.description.length < 120) {
|
|
158
|
-
issues.push({ severity: 'low', msg:
|
|
160
|
+
issues.push({ severity: 'low', msg: `${L('Description kısa', 'Description short')} (${meta.description.length} ${L('karakter', 'chars')}, ideal: 150-160)` });
|
|
159
161
|
} else if (meta.description.length > 160) {
|
|
160
|
-
issues.push({ severity: 'low', msg:
|
|
162
|
+
issues.push({ severity: 'low', msg: `${L('Description uzun', 'Description long')} (${meta.description.length} ${L('karakter', 'chars')}, ideal: 150-160)` });
|
|
161
163
|
} else {
|
|
162
|
-
passes.push(`Description (${meta.description.length} karakter)`);
|
|
164
|
+
passes.push(`Description (${meta.description.length} ${L('karakter', 'chars')})`);
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
// Canonical
|
|
166
|
-
if (meta.canonical) passes.push('Canonical URL var');
|
|
167
|
-
else issues.push({ severity: 'medium', msg: 'Canonical URL tanımlı değil' });
|
|
168
|
+
if (meta.canonical) passes.push(L('Canonical URL var', 'Canonical URL present'));
|
|
169
|
+
else issues.push({ severity: 'medium', msg: L('Canonical URL tanımlı değil', 'Canonical URL not set') });
|
|
168
170
|
|
|
169
171
|
// OG
|
|
170
172
|
if (Object.keys(meta.og).length > 0) passes.push(`Open Graph (${Object.keys(meta.og).length} tag)`);
|
|
171
|
-
else issues.push({ severity: 'low', msg: 'Open Graph tag yok (sosyal medya paylaşımı için)' });
|
|
173
|
+
else issues.push({ severity: 'low', msg: L('Open Graph tag yok (sosyal medya paylaşımı için)', 'No Open Graph tags (for social sharing)') });
|
|
172
174
|
|
|
173
175
|
// Twitter
|
|
174
176
|
if (Object.keys(meta.twitter).length > 0) passes.push(`Twitter Card (${Object.keys(meta.twitter).length} tag)`);
|
|
175
|
-
else issues.push({ severity: 'low', msg: 'Twitter Card tag yok' });
|
|
177
|
+
else issues.push({ severity: 'low', msg: L('Twitter Card tag yok', 'No Twitter Card tags') });
|
|
176
178
|
|
|
177
179
|
// H1
|
|
178
|
-
if (meta.headings.h1.length === 0) issues.push({ severity: 'high', msg: 'H1 tag eksik' });
|
|
179
|
-
else if (meta.headings.h1.length > 1) issues.push({ severity: 'medium', msg:
|
|
180
|
-
else passes.push(
|
|
180
|
+
if (meta.headings.h1.length === 0) issues.push({ severity: 'high', msg: L('H1 tag eksik', 'H1 tag missing') });
|
|
181
|
+
else if (meta.headings.h1.length > 1) issues.push({ severity: 'medium', msg: `${L('Birden fazla H1 var', 'Multiple H1 tags')} (${meta.headings.h1.length}, ideal: 1)` });
|
|
182
|
+
else passes.push(`${L('H1 var', 'H1 present')}: "${meta.headings.h1[0].slice(0, 50)}"`);
|
|
181
183
|
|
|
182
184
|
// Images
|
|
183
185
|
if (meta.totalImages > 0) {
|
|
184
186
|
if (meta.imagesWithoutAlt > 0) {
|
|
185
|
-
issues.push({ severity: 'medium', msg: `${meta.imagesWithoutAlt}/${meta.totalImages} image alt tag eksik` });
|
|
187
|
+
issues.push({ severity: 'medium', msg: `${meta.imagesWithoutAlt}/${meta.totalImages} ${L('image alt tag eksik', 'images missing alt tags')}` });
|
|
186
188
|
} else {
|
|
187
|
-
passes.push(
|
|
189
|
+
passes.push(`${L("Tüm image'larda alt var", 'All images have alt')} (${meta.totalImages})`);
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
// Schema
|
|
192
|
-
if (meta.hasSchema) passes.push('Schema.org markup var');
|
|
193
|
-
else issues.push({ severity: 'low', msg: 'Schema.org markup yok (rich snippets için)' });
|
|
194
|
+
if (meta.hasSchema) passes.push(L('Schema.org markup var', 'Schema.org markup present'));
|
|
195
|
+
else issues.push({ severity: 'low', msg: L('Schema.org markup yok (rich snippets için)', 'No Schema.org markup (for rich snippets)') });
|
|
194
196
|
|
|
195
197
|
// Content
|
|
196
|
-
if (meta.wordCount < 300) issues.push({ severity: 'medium', msg:
|
|
197
|
-
else passes.push(
|
|
198
|
+
if (meta.wordCount < 300) issues.push({ severity: 'medium', msg: `${L('İçerik kısa', 'Content short')} (${meta.wordCount} ${L('kelime', 'words')}, ideal: 600+)` });
|
|
199
|
+
else passes.push(`${L('İçerik uzunluğu', 'Content length')} (${meta.wordCount} ${L('kelime', 'words')})`);
|
|
198
200
|
|
|
199
201
|
// Sonuçları tablo halinde göster
|
|
200
|
-
console.log(tui.styled(' 📊 Sonuçlar', { color: tui.PALETTE.primary, bold: true }));
|
|
202
|
+
console.log(tui.styled(L(' 📊 Sonuçlar', ' 📊 Results'), { color: tui.PALETTE.primary, bold: true }));
|
|
201
203
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
202
204
|
|
|
203
205
|
// Geçenler
|
|
204
206
|
if (passes.length > 0) {
|
|
205
|
-
console.log('\n' + tui.styled(' ✅ Geçenler', { color: tui.PALETTE.success, bold: true }));
|
|
207
|
+
console.log('\n' + tui.styled(L(' ✅ Geçenler', ' ✅ Passed'), { color: tui.PALETTE.success, bold: true }));
|
|
206
208
|
const passRows = passes.map((p, i) => ({
|
|
207
209
|
icon: tui.styled(' ✓ ', { bg: tui.PALETTE.success, color: '#000', bold: true }),
|
|
208
210
|
msg: p,
|
|
209
211
|
}));
|
|
210
212
|
console.log(tui.table(passRows, [
|
|
211
213
|
{ key: 'icon', label: ' ', minWidth: 5 },
|
|
212
|
-
{ key: 'msg', label: 'Kontrol', minWidth: 40, render: r => tui.C.text(r.msg) },
|
|
214
|
+
{ key: 'msg', label: L('Kontrol', 'Check'), minWidth: 40, render: r => tui.C.text(r.msg) },
|
|
213
215
|
], { borderStyle: 'round', zebra: true }));
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
// İyileştirme alanları
|
|
217
219
|
if (issues.length > 0) {
|
|
218
|
-
console.log('\n' + tui.styled(' ⚠️ İyileştirme Alanları', { color: tui.PALETTE.warning, bold: true }));
|
|
220
|
+
console.log('\n' + tui.styled(L(' ⚠️ İyileştirme Alanları', ' ⚠️ Improvement Areas'), { color: tui.PALETTE.warning, bold: true }));
|
|
219
221
|
const issueRows = issues.map(i => ({
|
|
220
222
|
icon: i.severity === 'high' ? tui.styled(' ✗ ', { bg: tui.PALETTE.danger, color: '#000', bold: true })
|
|
221
223
|
: i.severity === 'medium' ? tui.styled(' ⚠ ', { bg: tui.PALETTE.warning, color: '#000', bold: true })
|
|
@@ -224,17 +226,17 @@ async function cmdAudit(args) {
|
|
|
224
226
|
}));
|
|
225
227
|
console.log(tui.table(issueRows, [
|
|
226
228
|
{ key: 'icon', label: ' ', minWidth: 5 },
|
|
227
|
-
{ key: 'msg', label: 'Sorun', minWidth: 40, render: r => tui.C.text(r.msg) },
|
|
229
|
+
{ key: 'msg', label: L('Sorun', 'Issue'), minWidth: 40, render: r => tui.C.text(r.msg) },
|
|
228
230
|
], { borderStyle: 'round', zebra: true }));
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
// Skor (büyük, prominent)
|
|
232
234
|
const score = Math.max(0, Math.min(100, 100 - (issues.filter(i => i.severity === 'high').length * 15 + issues.filter(i => i.severity === 'medium').length * 7 + issues.filter(i => i.severity === 'low').length * 3)));
|
|
233
235
|
const scoreColor = score >= 80 ? tui.PALETTE.success : score >= 50 ? tui.PALETTE.warning : tui.PALETTE.danger;
|
|
234
|
-
const scoreGrade = score >= 80 ? '🟢 Mükemmel' : score >= 50 ? '🟡 İyi' : '🔴 Geliştirilmeli';
|
|
236
|
+
const scoreGrade = score >= 80 ? L('🟢 Mükemmel', '🟢 Excellent') : score >= 50 ? L('🟡 İyi', '🟡 Good') : L('🔴 Geliştirilmeli', '🔴 Needs work');
|
|
235
237
|
|
|
236
238
|
console.log('\n' + tui.styled(' ╭────────────────────────────────────────────────────╮', { color: tui.PALETTE.border }));
|
|
237
|
-
console.log(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('SEO Skoru:') + ' ' +
|
|
239
|
+
console.log(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('SEO Skoru:', 'SEO Score:')) + ' ' +
|
|
238
240
|
tui.styled(String(score).padStart(3), { color: scoreColor, bold: true }) + tui.C.muted('/100 ') +
|
|
239
241
|
tui.styled(scoreGrade, { color: scoreColor }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
240
242
|
console.log(tui.styled(' ╰────────────────────────────────────────────────────╯', { color: tui.PALETTE.border }));
|
|
@@ -246,23 +248,23 @@ async function cmdAudit(args) {
|
|
|
246
248
|
async function seo(args) {
|
|
247
249
|
const [action, ...params] = args || [];
|
|
248
250
|
if (!action || action === 'help') {
|
|
249
|
-
console.log(chalk.yellow('\n Kullanım:'));
|
|
250
|
-
console.log(chalk.gray(' natureco seo audit <url> Tam SEO denetimi'));
|
|
251
|
-
console.log(chalk.gray(' natureco seo meta <url> Meta tag analizi'));
|
|
252
|
-
console.log(chalk.gray(' natureco seo speed <url> Hız ipuçları'));
|
|
251
|
+
console.log(chalk.yellow(L('\n Kullanım:', '\n Usage:')));
|
|
252
|
+
console.log(chalk.gray(L(' natureco seo audit <url> Tam SEO denetimi', ' natureco seo audit <url> Full SEO audit')));
|
|
253
|
+
console.log(chalk.gray(L(' natureco seo meta <url> Meta tag analizi', ' natureco seo meta <url> Meta tag analysis')));
|
|
254
|
+
console.log(chalk.gray(L(' natureco seo speed <url> Hız ipuçları', ' natureco seo speed <url> Speed tips')));
|
|
253
255
|
console.log('');
|
|
254
256
|
return;
|
|
255
257
|
}
|
|
256
258
|
if (action === 'audit') return cmdAudit(params);
|
|
257
259
|
if (action === 'meta') {
|
|
258
|
-
console.log(chalk.gray('\n Meta analizi audit\'in bir parçası olarak geliyor.\n'));
|
|
260
|
+
console.log(chalk.gray(L('\n Meta analizi audit\'in bir parçası olarak geliyor.\n', '\n Meta analysis comes as part of the audit.\n')));
|
|
259
261
|
return cmdAudit(params);
|
|
260
262
|
}
|
|
261
263
|
if (action === 'speed') {
|
|
262
|
-
console.log(chalk.gray('\n Hız analizi: PageSpeed Insights API entegrasyonu eklenecek (Phase 7).\n'));
|
|
264
|
+
console.log(chalk.gray(L('\n Hız analizi: PageSpeed Insights API entegrasyonu eklenecek (Phase 7).\n', '\n Speed analysis: PageSpeed Insights API integration coming (Phase 7).\n')));
|
|
263
265
|
return;
|
|
264
266
|
}
|
|
265
|
-
console.log(chalk.red(`\n Bilinmeyen: ${action}\n`));
|
|
267
|
+
console.log(chalk.red(`\n ${L('Bilinmeyen', 'Unknown')}: ${action}\n`));
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
module.exports = seo;
|