natureco-cli 5.51.5 → 5.52.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/bin/natureco.js +8 -0
- package/package.json +1 -1
- package/src/commands/dna.js +89 -0
package/bin/natureco.js
CHANGED
|
@@ -13,6 +13,7 @@ try { require('../src/utils/builtin-links').ensureBuiltinLinks(); } catch { /* a
|
|
|
13
13
|
const login = require('../src/commands/login');
|
|
14
14
|
const logout = require('../src/commands/logout');
|
|
15
15
|
const account = require('../src/commands/account');
|
|
16
|
+
const dna = require('../src/commands/dna');
|
|
16
17
|
const bots = require('../src/commands/bots');
|
|
17
18
|
const chat = require('../src/commands/chat');
|
|
18
19
|
const help = require('../src/commands/help');
|
|
@@ -103,6 +104,7 @@ ${chalk.yellow('⚙️ Kurulum & Ayarlar')}
|
|
|
103
104
|
${chalk.cyan('configure')} Interaktif yapılandırma (gateway|auth|channels|plugins|skills)
|
|
104
105
|
${chalk.cyan('login')} API key ile giriş
|
|
105
106
|
${chalk.cyan('account')} NatureCo hesabı / SSO (login|logout|whoami)
|
|
107
|
+
${chalk.cyan('dna')} Kod şeffaflığı — CodeDNA ile YZ-DNA raporu
|
|
106
108
|
${chalk.cyan('logout')} Çıkış
|
|
107
109
|
${chalk.cyan('config')} Ayarlar (get|set|unset|list|file|schema|validate|backups|restore)
|
|
108
110
|
${chalk.cyan('doctor')} Sistem teşhis (run|list|check)
|
|
@@ -205,6 +207,12 @@ program
|
|
|
205
207
|
.description('NatureCo hesabı / SSO (login | logout | whoami)')
|
|
206
208
|
.action(account);
|
|
207
209
|
|
|
210
|
+
program
|
|
211
|
+
.command('dna [path]')
|
|
212
|
+
.description('Kod şeffaflığı — CodeDNA ile yazılan kodun YZ-DNA raporu')
|
|
213
|
+
.option('--max <n>', 'En fazla taranacak dosya sayısı')
|
|
214
|
+
.action(dna);
|
|
215
|
+
|
|
208
216
|
program
|
|
209
217
|
.command('setup [action]')
|
|
210
218
|
.description('Run initial setup wizard (wizard|config|workspace|dirs|status)')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.52.1",
|
|
4
4
|
"description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"natureco": "bin/natureco.js"
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { spawnSync } = require('child_process');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `natureco dna [path]` — CodeDNA ile kod şeffaflığı.
|
|
6
|
+
*
|
|
7
|
+
* Ekosistem entegrasyonu: NatureCo CLI, yazılan/incelenen kodun "DNA"sını
|
|
8
|
+
* (ne kadarı yapay zekâ olası, anlama skoru) CodeDNA aracıyla raporlar.
|
|
9
|
+
* CodeDNA'yı `codedna scan --json` ile çağırıp özetini gösterir.
|
|
10
|
+
*
|
|
11
|
+
* Gereksinim: CodeDNA kurulu olmalı → `pip install codedna` (veya `uv tool install codedna`).
|
|
12
|
+
*/
|
|
13
|
+
async function dna(pathArg, opts = {}) {
|
|
14
|
+
const target = pathArg || process.cwd();
|
|
15
|
+
|
|
16
|
+
// codedna'yı bul (PATH'te). Kurulu değilse yönlendir.
|
|
17
|
+
const args = ['scan', '--json', '--repo', target];
|
|
18
|
+
if (opts.max) args.push('--max', String(opts.max));
|
|
19
|
+
|
|
20
|
+
const res = spawnSync('codedna', args, { encoding: 'utf8' });
|
|
21
|
+
|
|
22
|
+
if (res.error && res.error.code === 'ENOENT') {
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log(chalk.yellow(' CodeDNA kurulu değil.'));
|
|
25
|
+
console.log(chalk.gray(' Kurmak için: ') + chalk.cyan('pip install codedna') + chalk.gray(' (veya ') + chalk.cyan('uv tool install codedna') + chalk.gray(')'));
|
|
26
|
+
console.log(chalk.gray(' CodeDNA, kodun ne kadarının yapay zekâ olduğunu ölçen NatureCo aracıdır.\n'));
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let data;
|
|
32
|
+
try {
|
|
33
|
+
data = JSON.parse(res.stdout);
|
|
34
|
+
} catch (_e) {
|
|
35
|
+
console.log(chalk.red(' CodeDNA çıktısı okunamadı.'));
|
|
36
|
+
if (res.stderr) console.log(chalk.gray(res.stderr.trim().split('\n').slice(0, 4).join('\n')));
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const pct = Math.round((data.avg_ai_probability || 0) * 100);
|
|
42
|
+
const maxPct = Math.round((data.max_ai_probability || 0) * 100);
|
|
43
|
+
const bar = (p) => {
|
|
44
|
+
const n = Math.round(p / 5);
|
|
45
|
+
return '█'.repeat(n) + '░'.repeat(20 - n);
|
|
46
|
+
};
|
|
47
|
+
const tone = (p) => (p >= 60 ? chalk.red : p >= 30 ? chalk.yellow : chalk.green);
|
|
48
|
+
|
|
49
|
+
console.log('');
|
|
50
|
+
console.log(' ' + chalk.bold.cyan('🧬 CodeDNA') + chalk.gray(' · ' + (data.repo || target)));
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log(' ' + chalk.gray('Ortalama YZ olasılığı ') + tone(pct)(bar(pct)) + ' ' + tone(pct).bold(`%${pct}`));
|
|
53
|
+
console.log(' ' + chalk.gray('En yüksek dosya ') + tone(maxPct)(bar(maxPct)) + ' ' + tone(maxPct).bold(`%${maxPct}`));
|
|
54
|
+
console.log(' ' + chalk.gray(`Taranan dosya: ${data.file_count || 0}`));
|
|
55
|
+
console.log('');
|
|
56
|
+
|
|
57
|
+
// Anlama skoru (1-5): anket varsa onu, yoksa otomatik tahmini kullan
|
|
58
|
+
const uScore = (f) => (f.understanding != null ? f.understanding : f.understanding_estimate);
|
|
59
|
+
const uCol = (v) => (v >= 4 ? chalk.green : v >= 2.5 ? chalk.yellow : chalk.red);
|
|
60
|
+
|
|
61
|
+
// En yüksek YZ olasılıklı 5 dosya
|
|
62
|
+
const top = (data.files || []).slice(0, 5);
|
|
63
|
+
if (top.length) {
|
|
64
|
+
console.log(' ' + chalk.gray('En yüksek YZ olasılıklı dosyalar:'));
|
|
65
|
+
for (const f of top) {
|
|
66
|
+
const fp = Math.round((f.ai_probability || 0) * 100);
|
|
67
|
+
const uv = uScore(f);
|
|
68
|
+
const u = uv == null ? '' : ' ' + uCol(uv)(`anlama ${uv.toFixed(1)}/5`);
|
|
69
|
+
console.log(' ' + tone(fp).bold(`%${String(fp).padStart(3)}`) + ' ' + chalk.white(f.file) + u);
|
|
70
|
+
}
|
|
71
|
+
console.log('');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 🧠 Anlama borcu — AI-yoğun ama az-anlaşılan dosyalar (farklılaştırıcı)
|
|
75
|
+
const debt = (data.files || [])
|
|
76
|
+
.filter((f) => { const v = uScore(f); return v != null && v < 3 && (f.ai_probability || 0) >= 0.3; })
|
|
77
|
+
.sort((a, b) => uScore(a) - uScore(b))
|
|
78
|
+
.slice(0, 5);
|
|
79
|
+
if (debt.length) {
|
|
80
|
+
console.log(' ' + chalk.bold('🧠 Anlama borcu') + chalk.gray(' (AI yazdı ama ekip muhtemelen anlamıyor):'));
|
|
81
|
+
for (const f of debt) {
|
|
82
|
+
console.log(' ' + chalk.red(`${uScore(f).toFixed(1)}/5`) + ' ' + chalk.white(f.file) + chalk.gray(` (YZ %${Math.round(f.ai_probability * 100)})`));
|
|
83
|
+
}
|
|
84
|
+
console.log('');
|
|
85
|
+
}
|
|
86
|
+
console.log(chalk.gray(' Ayrıntı için: ') + chalk.cyan('codedna scan') + chalk.gray(' · Ekosistem: ') + chalk.cyan('natureco.me/ekosistem') + '\n');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = dna;
|