wormclaude 1.0.0 → 1.0.2
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/dist/auth.js +40 -0
- package/dist/cli.js +8 -1
- package/dist/theme.js +1 -1
- package/package.json +2 -2
package/dist/auth.js
CHANGED
|
@@ -53,6 +53,46 @@ function openBrowser(url) {
|
|
|
53
53
|
catch { /* sessiz geç */ }
|
|
54
54
|
}
|
|
55
55
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
56
|
+
// "1.2.0" > "1.1.9" gibi basit semver karşılaştırması
|
|
57
|
+
function isNewer(latest, current) {
|
|
58
|
+
const a = latest.split('.').map((n) => parseInt(n, 10) || 0);
|
|
59
|
+
const b = current.split('.').map((n) => parseInt(n, 10) || 0);
|
|
60
|
+
for (let i = 0; i < 3; i++) {
|
|
61
|
+
if ((a[i] || 0) > (b[i] || 0))
|
|
62
|
+
return true;
|
|
63
|
+
if ((a[i] || 0) < (b[i] || 0))
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
// npm registry'den son sürümü sorar (1.5s timeout, asla hata fırlatmaz).
|
|
69
|
+
// Yeni sürüm varsa onu döner, yoksa null.
|
|
70
|
+
export async function checkForUpdate(current) {
|
|
71
|
+
try {
|
|
72
|
+
const ctrl = new AbortController();
|
|
73
|
+
const t = setTimeout(() => ctrl.abort(), 1500);
|
|
74
|
+
const r = await fetch('https://registry.npmjs.org/wormclaude/latest', { signal: ctrl.signal });
|
|
75
|
+
clearTimeout(t);
|
|
76
|
+
if (!r.ok)
|
|
77
|
+
return null;
|
|
78
|
+
const d = await r.json();
|
|
79
|
+
const latest = d && d.version;
|
|
80
|
+
return latest && isNewer(latest, current) ? latest : null;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// `wormclaude update` → en son sürümü global kurar.
|
|
87
|
+
export function runUpdate() {
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
process.stdout.write('WormClaude güncelleniyor...\n');
|
|
90
|
+
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
91
|
+
const child = spawn(npm, ['install', '-g', 'wormclaude@latest'], { stdio: 'inherit' });
|
|
92
|
+
child.on('error', (e) => { process.stderr.write('Güncellenemedi: ' + (e?.message || e) + '\n'); resolve(); });
|
|
93
|
+
child.on('exit', () => resolve());
|
|
94
|
+
});
|
|
95
|
+
}
|
|
56
96
|
export async function deviceLogin() {
|
|
57
97
|
const base = process.env.WORMCLAUDE_BASE_URL || loadStored().baseUrl || DEFAULT_BASE_URL;
|
|
58
98
|
const origin = apiOrigin(base);
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ import { shouldAutoCompact, runCompact, isContextError } from './compact.js';
|
|
|
19
19
|
import { shouldExtract, triggerMemory } from './memory.js';
|
|
20
20
|
// --- WORMCLAUDE SUBCOMMANDS (TUI oncesi) ---
|
|
21
21
|
const _arg = (process.argv[2] || '').toLowerCase();
|
|
22
|
-
if (_arg === 'login' || _arg === 'logout' || _arg === 'whoami' || _arg === '--version' || _arg === '-v') {
|
|
22
|
+
if (_arg === 'login' || _arg === 'logout' || _arg === 'whoami' || _arg === '--version' || _arg === '-v' || _arg === 'update') {
|
|
23
23
|
const auth = await import('./auth.js');
|
|
24
24
|
if (_arg === 'login')
|
|
25
25
|
await auth.deviceLogin();
|
|
@@ -31,6 +31,9 @@ if (_arg === 'login' || _arg === 'logout' || _arg === 'whoami' || _arg === '--ve
|
|
|
31
31
|
const c = auth.loadStored();
|
|
32
32
|
console.log(c.apiKey ? ('Giris yapildi (' + (c.baseUrl || '') + ')') : 'Giris yapilmadi - wormclaude login');
|
|
33
33
|
}
|
|
34
|
+
else if (_arg === 'update') {
|
|
35
|
+
await auth.runUpdate();
|
|
36
|
+
}
|
|
34
37
|
else
|
|
35
38
|
console.log('wormclaude ' + VERSION);
|
|
36
39
|
process.exit(0);
|
|
@@ -40,6 +43,10 @@ if (!config.apiKey) {
|
|
|
40
43
|
process.stdout.write('\nWormClaude\'a hos geldiniz!\n\nKullanmadan once giris yapin:\n wormclaude login\n\n');
|
|
41
44
|
process.exit(0);
|
|
42
45
|
}
|
|
46
|
+
let _updateLatest = null;
|
|
47
|
+
import('./auth.js').then((a) => a.checkForUpdate(VERSION)).then((v) => { _updateLatest = v; }).catch(() => { });
|
|
48
|
+
process.on('exit', () => { if (_updateLatest)
|
|
49
|
+
process.stdout.write('\n Yeni surum var: ' + VERSION + ' -> ' + _updateLatest + '. Guncelle: wormclaude update\n'); });
|
|
43
50
|
setToolConfig(config); // Agent/alt-agent araçları aynı config'i kullanır
|
|
44
51
|
const MAX_TURNS = Number(process.env.WORMCLAUDE_MAX_TURNS) || 25; // tur limiti
|
|
45
52
|
setLang(loadLang() ?? 'tr'); // kayıtlı dili yükle (yoksa tr)
|
package/dist/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wormclaude",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
"agent",
|
|
42
42
|
"terminal"
|
|
43
43
|
]
|
|
44
|
-
}
|
|
44
|
+
}
|