coban 0.2.2 → 0.3.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/README.md +3 -2
- package/dist/cli.js +26 -1
- package/dist/config.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,8 +61,9 @@ cd ~/your-project && coban
|
|
|
61
61
|
|
|
62
62
|
On first start coban writes `~/.config/coban/config.json` and only offers what it finds: `claude`, `codex`,
|
|
63
63
|
`opencode` and `cursor-agent` that are on your `PATH`. A plain `claude` login (`~/.claude`) becomes profile `h1`.
|
|
64
|
-
|
|
65
|
-
`
|
|
64
|
+
Add more Claude accounts with `coban account add` (run it while the app is closed): it opens `claude` for the next
|
|
65
|
+
free profile (`h2`, `h3`...) in its own `~/.claude-hesapN` dir, you log in in the browser and type `/exit`, and the
|
|
66
|
+
profile is written to the config. Restart coban to see it. Edit the file any time, see Config below.
|
|
66
67
|
|
|
67
68
|
Note: the prompts coban gives the orchestrator and workers, and `coban --help`, are currently in Turkish.
|
|
68
69
|
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import net from 'node:net';
|
|
2
|
-
import
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
import { appendProfile, CONFIG_PATH, loadConfig, nextAccount, SOCK } from './config.js';
|
|
3
5
|
import { repoMap, snippets } from './context.js';
|
|
4
6
|
import { allUsage } from './usage.js';
|
|
5
7
|
const HELP = `coban — çok hesaplı agent orkestratörü
|
|
@@ -24,6 +26,7 @@ Agent'ların içinden (veya başka bir terminalden):
|
|
|
24
26
|
coban board [--limit n] ortak kutunun son notları
|
|
25
27
|
coban usage hesap kullanımı (5s %, 7g token, reset), en az harcayan başta
|
|
26
28
|
coban log [--limit n]
|
|
29
|
+
coban account add yeni Claude hesabı ekle: giriş yaptırır, profili config'e yazar (arayüz kapalıyken)
|
|
27
30
|
|
|
28
31
|
Her komut --json ile ham çıktı verir.`;
|
|
29
32
|
function call(method, params) {
|
|
@@ -74,6 +77,28 @@ async function main() {
|
|
|
74
77
|
const [cmd, ...rest] = process.argv.slice(2);
|
|
75
78
|
const { pos, flags, ctx } = parse(rest);
|
|
76
79
|
const num = (v) => (v === undefined || v === true ? undefined : Number(v));
|
|
80
|
+
if (cmd === 'account') {
|
|
81
|
+
if (pos[0] !== 'add') {
|
|
82
|
+
console.log('kullanım: coban account add');
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
const cfg = loadConfig();
|
|
86
|
+
const { profile, dir } = nextAccount(cfg);
|
|
87
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
88
|
+
console.log(`Yeni hesap: ${profile.id} (${dir})\nClaude açılıyor: tarayıcıdan giriş yap, sonra /exit yaz.\n`);
|
|
89
|
+
const r = spawnSync('claude', [], { stdio: 'inherit', env: { ...process.env, CLAUDE_CONFIG_DIR: dir } });
|
|
90
|
+
if (r.error) {
|
|
91
|
+
console.error('claude bulunamadı: önce Claude Code kur (https://claude.com/claude-code)');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
if (!fs.readdirSync(dir).length) {
|
|
95
|
+
console.error('Giriş yapılmamış görünüyor, profil eklenmedi. Tekrar dene: coban account add');
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
appendProfile(profile);
|
|
99
|
+
console.log(`\n${profile.id} eklendi (${CONFIG_PATH}). Arayüzü yeniden aç: coban`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
77
102
|
if (!cmd || cmd === '--cwd') {
|
|
78
103
|
if (cmd === '--cwd')
|
|
79
104
|
process.chdir(rest[0]);
|
package/dist/config.js
CHANGED
|
@@ -20,6 +20,20 @@ const claude = (n, model, color) => ({
|
|
|
20
20
|
env: { CLAUDE_CONFIG_DIR: `~/.claude-hesap${n}` },
|
|
21
21
|
color,
|
|
22
22
|
});
|
|
23
|
+
const COLORS = ['#F6D5C8', '#FFD9A0', '#C8E6C9', '#FFC8DD', '#BDE0FE', '#E2CFEA'];
|
|
24
|
+
// `coban account add`: the next free hN, its config dir, and a profile ready to append to the config file.
|
|
25
|
+
export function nextAccount(cfg) {
|
|
26
|
+
const used = new Set(cfg.profiles.map((p) => p.id));
|
|
27
|
+
let n = 1;
|
|
28
|
+
while (used.has(`h${n}`))
|
|
29
|
+
n++;
|
|
30
|
+
return { profile: claude(n, SONNET, COLORS[(n - 1) % COLORS.length]), dir: path.join(os.homedir(), `.claude-hesap${n}`) };
|
|
31
|
+
}
|
|
32
|
+
export function appendProfile(p) {
|
|
33
|
+
const raw = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8')); // raw file: keep `~` paths unexpanded
|
|
34
|
+
raw.profiles.push(p);
|
|
35
|
+
fs.writeFileSync(CONFIG_PATH, JSON.stringify(raw, null, 2) + '\n');
|
|
36
|
+
}
|
|
23
37
|
const onPath = (bin) => (process.env.PATH ?? '').split(path.delimiter).some((d) => d && fs.existsSync(path.join(d, bin)));
|
|
24
38
|
// First run on a fresh machine: only offer what is actually installed. A single `claude` login (~/.claude) becomes
|
|
25
39
|
// h1; extra accounts (h2, h3) appear only when their own config dir (~/.claude-hesapN) already exists.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coban",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A terminal app where one orchestrator agent dispatches work to many AI coding agents — several Claude Code accounts, Codex, OpenCode, Cursor — that message each other over a shared board.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"postinstall": "node -e \"for(const a of ['darwin-arm64','darwin-x64','linux-x64','linux-arm64']){try{require('fs').chmodSync(require.resolve('node-pty/package.json').replace('package.json','prebuilds/'+a+'/spawn-helper'),0o755)}catch{}}\"",
|