natureco-cli 5.43.1 → 5.44.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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/commands/doctor.js +55 -5
- package/src/commands/repl.js +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to NatureCo CLI will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [5.44.0] - 2026-07-08 — "MEMORY: otomatik regex-extraction artık agent'ın bilinçli kaydını ezmiyor"
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **"Yanlış hatırlamak, hiç hatırlamamaktan kötüdür."** Oturum sonu otomatik regex-extraction (`persistSessionToMemory`), agent'ın bilinçli `memory_write`/`memory_tree` kaydının ÜZERİNE yanlış fact yazabiliyordu (ör. "projemin kod adı ONYX-7" → agent doğru kaydeder ama regex ayrıca "Kullanici ad: onyx" ekler). Artık: agent bu oturumda memory'ye YAZDIYSA (disk'teki fact sayısı oturum başındakinden fazlaysa), otomatik regex-extraction **tamamen atlanır** — bilinçli kayıt her zaman kazanır. Modern modeller `memory_write`'ı güvenilir çağırdığından regex çoğu oturumda hiç devreye girmez (sıfır yanlış-pozitif); agent hiç kaydetmediyse (nadir) regex yalnızca çok-net kimlik kalıplarıyla bir güvenlik ağı olarak kalır. 571 test yeşil.
|
|
9
|
+
|
|
10
|
+
## [5.43.2] - 2026-07-08 — "FIX: `doctor --fix` artık gerçekten çalışıyor"
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **`natureco doctor --fix` çalışmıyordu**: `doctor()` fonksiyonu `--fix`'i hiç işlemiyordu → `Unknown doctor action: --fix` hatası veriyordu (README'de `--fix Auto-fix` olarak belgeli olmasına rağmen). Artık `--fix` (ve `fix` alt-komutu) düzeltilebilir sorunları otomatik onarır: eksik veri dizinlerini oluşturur (`memory`, `sessions`, `backups`, `audit`, …) ve hassas dosya izinlerini sıkılaştırır (`~/.natureco` → 0700, `config.json` → 0600, POSIX). Düzeltmelerden sonra normal sağlık kontrolleri çalışır. 3 regresyon testi eklendi. 571 test yeşil.
|
|
14
|
+
|
|
5
15
|
## [5.43.1] - 2026-07-08 — "SECURITY: config restore artık 0600 izniyle yazıyor"
|
|
6
16
|
|
|
7
17
|
### Security
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.44.0",
|
|
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"
|
package/src/commands/doctor.js
CHANGED
|
@@ -25,19 +25,51 @@ const CHECKS = [
|
|
|
25
25
|
|
|
26
26
|
function doctor(params) {
|
|
27
27
|
try {
|
|
28
|
-
const
|
|
28
|
+
const args = params || [];
|
|
29
|
+
const fix = args.includes('--fix') || args[0] === 'fix';
|
|
30
|
+
// --fix bir flag; action'lardan ayıkla (ör. "doctor --fix" → run+fix).
|
|
31
|
+
const positional = args.filter(a => a !== '--fix');
|
|
32
|
+
const [action, checkName] = positional;
|
|
29
33
|
|
|
30
|
-
if (!action || action === 'run') return cmdRun();
|
|
34
|
+
if (fix || !action || action === 'run') return cmdRun({ fix });
|
|
31
35
|
if (action === 'list') return cmdList();
|
|
32
36
|
if (action === 'check') return cmdCheck(checkName);
|
|
33
37
|
|
|
34
38
|
console.log(chalk.red(`\n Unknown doctor action: ${action}\n`));
|
|
35
|
-
console.log(chalk.gray(' Usage: natureco doctor [run|list|check <name
|
|
39
|
+
console.log(chalk.gray(' Usage: natureco doctor [run|list|check <name>|--fix]\n'));
|
|
36
40
|
} catch (err) {
|
|
37
41
|
console.log(chalk.red(`\n Doctor error: ${err.message}\n`));
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
|
|
45
|
+
// v5.43.2: --fix — düzeltilebilir sorunları otomatik onar. Eskiden --fix hiç
|
|
46
|
+
// işlenmiyordu ("Unknown doctor action: --fix"), README'de belgeli olmasına rağmen.
|
|
47
|
+
function applyFixes() {
|
|
48
|
+
const applied = [];
|
|
49
|
+
const failed = [];
|
|
50
|
+
// 1. Eksik veri dizinlerini oluştur
|
|
51
|
+
const REQUIRED = ['sources', 'concepts', 'cache', 'skills', 'memory', 'sessions', 'backups', 'hooks', 'audit'];
|
|
52
|
+
try { if (!fs.existsSync(BASE_DIR)) fs.mkdirSync(BASE_DIR, { recursive: true, mode: 0o700 }); } catch (e) { failed.push('~/.natureco: ' + e.message); }
|
|
53
|
+
for (const d of REQUIRED) {
|
|
54
|
+
const dir = path.join(BASE_DIR, d);
|
|
55
|
+
if (!fs.existsSync(dir)) {
|
|
56
|
+
try { fs.mkdirSync(dir, { recursive: true }); applied.push('created dir: ' + d); }
|
|
57
|
+
catch (e) { failed.push(d + ': ' + e.message); }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// 2. Hassas dosya/dizin izinlerini sıkılaştır (POSIX) — API key'li config gizli kalmalı
|
|
61
|
+
if (process.platform !== 'win32') {
|
|
62
|
+
try { fs.chmodSync(BASE_DIR, 0o700); applied.push('~/.natureco → 0700'); } catch {}
|
|
63
|
+
if (fs.existsSync(CONFIG_FILE)) {
|
|
64
|
+
try {
|
|
65
|
+
const cur = fs.statSync(CONFIG_FILE).mode & 0o777;
|
|
66
|
+
if (cur !== 0o600) { fs.chmodSync(CONFIG_FILE, 0o600); applied.push('config.json → 0600'); }
|
|
67
|
+
} catch {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { applied, failed };
|
|
71
|
+
}
|
|
72
|
+
|
|
41
73
|
function cmdList() {
|
|
42
74
|
F.list(CHECKS.map(c => ({ label: c.name, value: c.label })));
|
|
43
75
|
}
|
|
@@ -65,8 +97,24 @@ function cmdCheck(name) {
|
|
|
65
97
|
}
|
|
66
98
|
}
|
|
67
99
|
|
|
68
|
-
function cmdRun() {
|
|
69
|
-
F.header('System Doctor · Tüm Sistem Kontrolleri', { icon: '🩺' });
|
|
100
|
+
function cmdRun(opts = {}) {
|
|
101
|
+
F.header(opts.fix ? 'System Doctor · Otomatik Düzeltme (--fix)' : 'System Doctor · Tüm Sistem Kontrolleri', { icon: opts.fix ? '🔧' : '🩺' });
|
|
102
|
+
|
|
103
|
+
// v5.43.2: --fix modunda önce düzeltilebilir sorunları onar, sonra kontrolleri çalıştır.
|
|
104
|
+
if (opts.fix) {
|
|
105
|
+
const { applied, failed } = applyFixes();
|
|
106
|
+
if (applied.length) {
|
|
107
|
+
console.log('\n' + tui.C.green(' 🔧 Düzeltildi:'));
|
|
108
|
+
applied.forEach(a => console.log(' ' + tui.C.text('• ' + a)));
|
|
109
|
+
} else {
|
|
110
|
+
console.log('\n' + tui.C.muted(' 🔧 Düzeltilecek bir şey yok — sistem zaten düzgün.'));
|
|
111
|
+
}
|
|
112
|
+
if (failed.length) {
|
|
113
|
+
console.log('\n' + tui.C.amber(' ⚠️ Otomatik düzeltilemedi:'));
|
|
114
|
+
failed.forEach(f => console.log(' ' + tui.C.muted('• ' + f)));
|
|
115
|
+
}
|
|
116
|
+
console.log('');
|
|
117
|
+
}
|
|
70
118
|
|
|
71
119
|
const rows = [];
|
|
72
120
|
let passed = 0;
|
|
@@ -277,3 +325,5 @@ function runCheck(name) {
|
|
|
277
325
|
}
|
|
278
326
|
|
|
279
327
|
module.exports = doctor;
|
|
328
|
+
// v5.43.2: test için — --fix otomatik düzeltme regresyonu
|
|
329
|
+
module.exports.applyFixes = applyFixes;
|
package/src/commands/repl.js
CHANGED
|
@@ -1265,7 +1265,22 @@ async function startRepl(args) {
|
|
|
1265
1265
|
let preferencesAdded = 0;
|
|
1266
1266
|
|
|
1267
1267
|
try {
|
|
1268
|
-
//
|
|
1268
|
+
// v5.44 KRİTİK KARAR: "yanlış hatırlamak, hiç hatırlamamaktan kötüdür."
|
|
1269
|
+
// Otomatik regex-extraction, agent'ın BİLİNÇLİ memory_write/memory_tree kaydının
|
|
1270
|
+
// üzerine yanlış fact yazabiliyordu (ör. "kod adı ONYX-7" → "Kullanici ad: onyx").
|
|
1271
|
+
// Bu yüzden: agent bu oturumda memory'ye YAZDIYSA (disk'teki fact sayısı oturum
|
|
1272
|
+
// başındakinden fazlaysa), regex-extraction'ı TAMAMEN ATLA — bilinçli kayıt kazanır.
|
|
1273
|
+
// Modern modeller memory_write'ı güvenilir çağırır → regex hiç devreye girmez, sıfır
|
|
1274
|
+
// yanlış-pozitif. Agent hiç kaydetmediyse (nadir) regex bir güvenlik ağı olarak kalır.
|
|
1275
|
+
try {
|
|
1276
|
+
const memFile = path.join(MEMORY_DIR, (cfg.userName || 'default').toLowerCase() + '.json');
|
|
1277
|
+
const diskFacts = JSON.parse(fs.readFileSync(memFile, 'utf8')).facts || [];
|
|
1278
|
+
if (diskFacts.length > (memory.facts || []).length) {
|
|
1279
|
+
return { factsAdded: 0, preferencesAdded: 0, skippedAutoExtract: true };
|
|
1280
|
+
}
|
|
1281
|
+
} catch { /* dosya yok/okunamadı → aşağıdaki güvenlik ağı çalışsın */ }
|
|
1282
|
+
|
|
1283
|
+
// Pattern-based extraction (agent hiç bilinçli kayıt yapmadıysa güvenlik ağı)
|
|
1269
1284
|
const newFacts = extractFacts(messages, memory.facts || []);
|
|
1270
1285
|
|
|
1271
1286
|
// Bazi user message'lari da tara — genel kalıplarla fact çıkar
|