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/xp.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
const chalk = require('chalk');
|
|
20
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
21
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
20
22
|
const tui = require('../utils/tui');
|
|
21
23
|
const fs = require('fs');
|
|
22
24
|
const path = require('path');
|
|
@@ -24,14 +26,14 @@ const os = require('os');
|
|
|
24
26
|
|
|
25
27
|
const XP_FILE = path.join(os.homedir(), '.natureco', 'xp.json');
|
|
26
28
|
const LEVELS = [
|
|
27
|
-
{ level: 1, minXP: 0, title: '🌱 Tohum', color: chalk.green },
|
|
28
|
-
{ level: 2, minXP: 100, title: '🌿 Filiz', color: chalk.green },
|
|
29
|
-
{ level: 3, minXP: 300, title: '🍃 Yaprak', color: chalk.cyan },
|
|
30
|
-
{ level: 4, minXP: 700, title: '🌳 Ağaç', color: chalk.blue },
|
|
31
|
-
{ level: 5, minXP: 1500, title: '🌲 Orman', color: chalk.yellow },
|
|
32
|
-
{ level: 6, minXP: 3000, title: '🏔️ Dağ', color: chalk.magenta },
|
|
33
|
-
{ level: 7, minXP: 6000, title: '⭐ Yıldız', color: chalk.red.bold },
|
|
34
|
-
{ level: 8, minXP: 12000,title: '🌌 Galaksi', color: chalk.hex('#a78bfa').bold },
|
|
29
|
+
{ level: 1, minXP: 0, title: L('🌱 Tohum', '🌱 Seed'), color: chalk.green },
|
|
30
|
+
{ level: 2, minXP: 100, title: L('🌿 Filiz', '🌿 Sprout'), color: chalk.green },
|
|
31
|
+
{ level: 3, minXP: 300, title: L('🍃 Yaprak', '🍃 Leaf'), color: chalk.cyan },
|
|
32
|
+
{ level: 4, minXP: 700, title: L('🌳 Ağaç', '🌳 Tree'), color: chalk.blue },
|
|
33
|
+
{ level: 5, minXP: 1500, title: L('🌲 Orman', '🌲 Forest'), color: chalk.yellow },
|
|
34
|
+
{ level: 6, minXP: 3000, title: L('🏔️ Dağ', '🏔️ Mountain'), color: chalk.magenta },
|
|
35
|
+
{ level: 7, minXP: 6000, title: L('⭐ Yıldız', '⭐ Star'), color: chalk.red.bold },
|
|
36
|
+
{ level: 8, minXP: 12000,title: L('🌌 Galaksi', '🌌 Galaxy'), color: chalk.hex('#a78bfa').bold },
|
|
35
37
|
];
|
|
36
38
|
|
|
37
39
|
function loadXP() {
|
|
@@ -77,16 +79,16 @@ function cmdStatus() {
|
|
|
77
79
|
const current = getLevel(data.xp);
|
|
78
80
|
const next = getNextLevel(data.xp);
|
|
79
81
|
|
|
80
|
-
console.log('\n' + tui.styled(' ⭐ NatureCo XP Sistemi', { color: tui.PALETTE.accent, bold: true }));
|
|
82
|
+
console.log('\n' + tui.styled(L(' ⭐ NatureCo XP Sistemi', ' ⭐ NatureCo XP System'), { color: tui.PALETTE.accent, bold: true }));
|
|
81
83
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
82
84
|
|
|
83
85
|
// Üst metrik kartı
|
|
84
86
|
const w = 50;
|
|
85
87
|
const lines = [];
|
|
86
88
|
lines.push(tui.styled(' ╭' + '─'.repeat(w) + '╮', { color: tui.PALETTE.border }));
|
|
87
|
-
lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Kullanıcı ') + tui.styled(data.username.padEnd(20), { color: tui.PALETTE.text, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
89
|
+
lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Kullanıcı ', 'User ')) + tui.styled(data.username.padEnd(20), { color: tui.PALETTE.text, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
88
90
|
lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('XP ') + tui.styled(data.xp.toLocaleString().padStart(8), { color: tui.PALETTE.primary, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
89
|
-
lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Seviye ') + current.color(`Lv.${current.level} ${current.title}`.padEnd(20)) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
91
|
+
lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Seviye ', 'Level ')) + current.color(`Lv.${current.level} ${current.title}`.padEnd(20)) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
|
|
90
92
|
lines.push(tui.styled(' ╰' + '─'.repeat(w) + '╯', { color: tui.PALETTE.border }));
|
|
91
93
|
console.log(lines.join('\n'));
|
|
92
94
|
|
|
@@ -97,15 +99,15 @@ function cmdStatus() {
|
|
|
97
99
|
const bar = tui.progressBar(data.xp - current.minXP, next.minXP - current.minXP, {
|
|
98
100
|
width: 40, showPercent: true,
|
|
99
101
|
});
|
|
100
|
-
console.log('\n ' + tui.C.muted('Sonraki: ') + next.color(`${next.title}`) + tui.C.muted(` (${needed} XP kaldı)`));
|
|
102
|
+
console.log('\n ' + tui.C.muted(L('Sonraki: ', 'Next: ')) + next.color(`${next.title}`) + tui.C.muted(` (${needed} XP ${L('kaldı', 'left')})`));
|
|
101
103
|
console.log(' ' + bar);
|
|
102
104
|
} else {
|
|
103
|
-
console.log('\n ' + tui.styled(' 🌟 Maksimum seviye!', { color: tui.PALETTE.success, bold: true }));
|
|
105
|
+
console.log('\n ' + tui.styled(L(' 🌟 Maksimum seviye!', ' 🌟 Max level!'), { color: tui.PALETTE.success, bold: true }));
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
// Son kazanımlar — TUI tablo
|
|
107
109
|
if (data.history.length > 0) {
|
|
108
|
-
console.log('\n' + tui.styled(' 📜 Son XP Kazanımları', { color: tui.PALETTE.secondary, bold: true }));
|
|
110
|
+
console.log('\n' + tui.styled(L(' 📜 Son XP Kazanımları', ' 📜 Recent XP Gains'), { color: tui.PALETTE.secondary, bold: true }));
|
|
109
111
|
const rows = data.history.slice(-5).reverse().map(h => ({
|
|
110
112
|
amount: (h.amount > 0 ? '+' : '') + h.amount,
|
|
111
113
|
ts: new Date(h.ts).toLocaleString(),
|
|
@@ -113,8 +115,8 @@ function cmdStatus() {
|
|
|
113
115
|
}));
|
|
114
116
|
console.log('\n' + tui.table(rows, [
|
|
115
117
|
{ key: 'amount', label: 'XP', minWidth: 8, render: r => tui.styled(r.amount, { color: r.amount.startsWith('+') ? tui.PALETTE.success : tui.PALETTE.danger, bold: true }) },
|
|
116
|
-
{ key: 'ts', label: 'Zaman', minWidth: 22, render: r => tui.C.muted(r.ts) },
|
|
117
|
-
{ key: 'reason', label: 'Sebep', minWidth: 30, render: r => tui.C.text(r.reason) },
|
|
118
|
+
{ key: 'ts', label: L('Zaman', 'Time'), minWidth: 22, render: r => tui.C.muted(r.ts) },
|
|
119
|
+
{ key: 'reason', label: L('Sebep', 'Reason'), minWidth: 30, render: r => tui.C.text(r.reason) },
|
|
118
120
|
], { borderStyle: 'round', zebra: true }));
|
|
119
121
|
}
|
|
120
122
|
console.log('');
|
|
@@ -122,9 +124,9 @@ function cmdStatus() {
|
|
|
122
124
|
|
|
123
125
|
function cmdStats() {
|
|
124
126
|
const data = loadXP();
|
|
125
|
-
console.log(chalk.bold('\n 📊 XP İstatistikleri\n'));
|
|
126
|
-
console.log(chalk.gray(' Toplam XP: ') + chalk.cyan(data.xp.toLocaleString()));
|
|
127
|
-
console.log(chalk.gray(' Toplam kayıt: ') + chalk.cyan(data.history.length));
|
|
127
|
+
console.log(chalk.bold(L('\n 📊 XP İstatistikleri\n', '\n 📊 XP Statistics\n')));
|
|
128
|
+
console.log(chalk.gray(L(' Toplam XP: ', ' Total XP: ')) + chalk.cyan(data.xp.toLocaleString()));
|
|
129
|
+
console.log(chalk.gray(L(' Toplam kayıt: ', ' Total records: ')) + chalk.cyan(data.history.length));
|
|
128
130
|
|
|
129
131
|
// Reason bazlı
|
|
130
132
|
const byReason = {};
|
|
@@ -132,7 +134,7 @@ function cmdStats() {
|
|
|
132
134
|
byReason[h.reason] = (byReason[h.reason] || 0) + h.amount;
|
|
133
135
|
}
|
|
134
136
|
if (Object.keys(byReason).length > 0) {
|
|
135
|
-
console.log(chalk.bold('\n 🏷️ Kaynak Bazlı XP:\n'));
|
|
137
|
+
console.log(chalk.bold(L('\n 🏷️ Kaynak Bazlı XP:\n', '\n 🏷️ XP by Source:\n')));
|
|
136
138
|
for (const [reason, amount] of Object.entries(byReason).sort((a, b) => b[1] - a[1])) {
|
|
137
139
|
console.log(` ${reason.padEnd(30)} ${chalk.cyan((amount > 0 ? '+' : '') + amount)} XP`);
|
|
138
140
|
}
|
|
@@ -141,30 +143,30 @@ function cmdStats() {
|
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
function cmdLeaderboard() {
|
|
144
|
-
console.log(chalk.cyan('\n 🏆 Liderlik Tablosu\n'));
|
|
145
|
-
console.log(chalk.gray(' Bu özellik api.natureco.me hazır olunca tam çalışacak.\n'));
|
|
146
|
-
console.log(chalk.gray(' Şimdilik senin sıralaman local XP dosyanda.\n'));
|
|
146
|
+
console.log(chalk.cyan(L('\n 🏆 Liderlik Tablosu\n', '\n 🏆 Leaderboard\n')));
|
|
147
|
+
console.log(chalk.gray(L(' Bu özellik api.natureco.me hazır olunca tam çalışacak.\n', ' This feature will fully work once api.natureco.me is ready.\n')));
|
|
148
|
+
console.log(chalk.gray(L(' Şimdilik senin sıralaman local XP dosyanda.\n', ' For now your ranking is in your local XP file.\n')));
|
|
147
149
|
cmdStatus();
|
|
148
150
|
}
|
|
149
151
|
|
|
150
152
|
function cmdRewards() {
|
|
151
|
-
console.log('\n' + tui.styled(' 🎁 Aktif Ödüller', { color: tui.PALETTE.accent, bold: true }));
|
|
153
|
+
console.log('\n' + tui.styled(L(' 🎁 Aktif Ödüller', ' 🎁 Active Rewards'), { color: tui.PALETTE.accent, bold: true }));
|
|
152
154
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
153
155
|
|
|
154
156
|
const rows = [
|
|
155
|
-
{ level: 'Lv.2', xp: '100 XP', reward: 'NatureCo sticker paketi', color: tui.PALETTE.success },
|
|
156
|
-
{ level: 'Lv.3', xp: '300 XP', reward: 'NatureBot\'ta özel bot erişimi', color: tui.PALETTE.success },
|
|
157
|
-
{ level: 'Lv.4', xp: '700 XP', reward: 'Medium\'da otomatik yayınlama', color: tui.PALETTE.secondary },
|
|
158
|
-
{ level: 'Lv.5', xp: '1500 XP', reward: 'NatureCo Pro ayda 1 ay ücretsiz', color: tui.PALETTE.secondary },
|
|
159
|
-
{ level: 'Lv.6', xp: '3000 XP', reward: 'Özel NatureCo rozeti', color: tui.PALETTE.accent },
|
|
160
|
-
{ level: 'Lv.7', xp: '6000 XP', reward: '@Naturecofficial\'dan mention', color: tui.PALETTE.warning },
|
|
161
|
-
{ level: 'Lv.8', xp: '12000 XP', reward: 'Founder statüsü (sınırlı)', color: tui.PALETTE.danger },
|
|
157
|
+
{ level: 'Lv.2', xp: '100 XP', reward: L('NatureCo sticker paketi', 'NatureCo sticker pack'), color: tui.PALETTE.success },
|
|
158
|
+
{ level: 'Lv.3', xp: '300 XP', reward: L('NatureBot\'ta özel bot erişimi', 'Special bot access on NatureBot'), color: tui.PALETTE.success },
|
|
159
|
+
{ level: 'Lv.4', xp: '700 XP', reward: L('Medium\'da otomatik yayınlama', 'Auto-publishing on Medium'), color: tui.PALETTE.secondary },
|
|
160
|
+
{ level: 'Lv.5', xp: '1500 XP', reward: L('NatureCo Pro ayda 1 ay ücretsiz', '1 free month of NatureCo Pro'), color: tui.PALETTE.secondary },
|
|
161
|
+
{ level: 'Lv.6', xp: '3000 XP', reward: L('Özel NatureCo rozeti', 'Special NatureCo badge'), color: tui.PALETTE.accent },
|
|
162
|
+
{ level: 'Lv.7', xp: '6000 XP', reward: L('@Naturecofficial\'dan mention', 'Mention from @Naturecofficial'), color: tui.PALETTE.warning },
|
|
163
|
+
{ level: 'Lv.8', xp: '12000 XP', reward: L('Founder statüsü (sınırlı)', 'Founder status (limited)'), color: tui.PALETTE.danger },
|
|
162
164
|
];
|
|
163
165
|
|
|
164
166
|
console.log('\n' + tui.table(rows, [
|
|
165
|
-
{ key: 'level', label: 'Seviye', minWidth: 8, render: r => tui.styled(r.level, { color: r.color, bold: true }) },
|
|
166
|
-
{ key: 'xp', label: 'Eşik', minWidth: 10, render: r => tui.C.brand(r.xp) },
|
|
167
|
-
{ key: 'reward', label: 'Ödül', minWidth: 35, render: r => tui.C.text(r.reward) },
|
|
167
|
+
{ key: 'level', label: L('Seviye', 'Level'), minWidth: 8, render: r => tui.styled(r.level, { color: r.color, bold: true }) },
|
|
168
|
+
{ key: 'xp', label: L('Eşik', 'Threshold'), minWidth: 10, render: r => tui.C.brand(r.xp) },
|
|
169
|
+
{ key: 'reward', label: L('Ödül', 'Reward'), minWidth: 35, render: r => tui.C.text(r.reward) },
|
|
168
170
|
], { borderStyle: 'round', zebra: true }));
|
|
169
171
|
console.log('');
|
|
170
172
|
}
|
|
@@ -176,15 +178,15 @@ function xp(args) {
|
|
|
176
178
|
if (action === 'leaderboard') return cmdLeaderboard();
|
|
177
179
|
if (action === 'rewards') return cmdRewards();
|
|
178
180
|
if (action === 'help') {
|
|
179
|
-
console.log(chalk.yellow('\n Kullanım:'));
|
|
180
|
-
console.log(chalk.gray(' natureco xp Mevcut durum'));
|
|
181
|
-
console.log(chalk.gray(' natureco xp stats İstatistikler'));
|
|
182
|
-
console.log(chalk.gray(' natureco xp leaderboard Liderlik'));
|
|
183
|
-
console.log(chalk.gray(' natureco xp rewards Aktif ödüller'));
|
|
181
|
+
console.log(chalk.yellow(L('\n Kullanım:', '\n Usage:')));
|
|
182
|
+
console.log(chalk.gray(L(' natureco xp Mevcut durum', ' natureco xp Current status')));
|
|
183
|
+
console.log(chalk.gray(L(' natureco xp stats İstatistikler', ' natureco xp stats Statistics')));
|
|
184
|
+
console.log(chalk.gray(L(' natureco xp leaderboard Liderlik', ' natureco xp leaderboard Leaderboard')));
|
|
185
|
+
console.log(chalk.gray(L(' natureco xp rewards Aktif ödüller', ' natureco xp rewards Active rewards')));
|
|
184
186
|
console.log('');
|
|
185
187
|
return;
|
|
186
188
|
}
|
|
187
|
-
console.log(chalk.red(`\n Bilinmeyen: ${action}\n`));
|
|
189
|
+
console.log(chalk.red(`\n ${L('Bilinmeyen', 'Unknown')}: ${action}\n`));
|
|
188
190
|
}
|
|
189
191
|
|
|
190
192
|
// Export addXP — diğer modüller XP kazandırabilsin
|