builderguild 0.1.0__py3-none-any.whl
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.
- builderguild/__init__.py +1 -0
- builderguild/cli.py +76 -0
- builderguild/config.py +43 -0
- builderguild/errors.py +10 -0
- builderguild/graph.py +60 -0
- builderguild-0.1.0.dist-info/METADATA +13 -0
- builderguild-0.1.0.dist-info/RECORD +11 -0
- builderguild-0.1.0.dist-info/WHEEL +5 -0
- builderguild-0.1.0.dist-info/entry_points.txt +2 -0
- builderguild-0.1.0.dist-info/licenses/LICENSE +22 -0
- builderguild-0.1.0.dist-info/top_level.txt +1 -0
builderguild/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# paket builderguild
|
builderguild/cli.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from .config import Config
|
|
5
|
+
from .graph import FactGraph
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def cmd_setup(args) -> int:
|
|
9
|
+
cfg = Config.load()
|
|
10
|
+
fg = FactGraph(cfg.db_path)
|
|
11
|
+
fg.add("Setup awal", "Graph berhasil dibuat", {"path": cfg.db_path})
|
|
12
|
+
fg.close()
|
|
13
|
+
print(f"[setup] graph siap: {cfg.db_path}")
|
|
14
|
+
return 0
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def cmd_status(args) -> int:
|
|
18
|
+
cfg = Config.load()
|
|
19
|
+
fg = FactGraph(cfg.db_path)
|
|
20
|
+
for f in fg.list_titles():
|
|
21
|
+
if args.filter and f["status"] != args.filter:
|
|
22
|
+
continue
|
|
23
|
+
print(f"#{f['id']:>3} [{f['status']}] {f['title']}")
|
|
24
|
+
fg.close()
|
|
25
|
+
return 0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def cmd_add(args) -> int:
|
|
29
|
+
cfg = Config.load()
|
|
30
|
+
fg = FactGraph(cfg.db_path)
|
|
31
|
+
fg.add(args.title, args.detail, {})
|
|
32
|
+
fg.close()
|
|
33
|
+
print(f"[add] task ditambahkan: {args.title}")
|
|
34
|
+
return 0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def cmd_done(args) -> int:
|
|
38
|
+
cfg = Config.load()
|
|
39
|
+
fg = FactGraph(cfg.db_path)
|
|
40
|
+
ids = {f["id"] for f in fg.list_titles()}
|
|
41
|
+
if args.id not in ids:
|
|
42
|
+
fg.close()
|
|
43
|
+
print(f"[done] task #{args.id} tidak ditemukan", file=sys.stderr)
|
|
44
|
+
return 1
|
|
45
|
+
fg.update_status(args.id, "done")
|
|
46
|
+
fg.close()
|
|
47
|
+
print(f"[done] task #{args.id} selesai")
|
|
48
|
+
return 0
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main(argv: list[str] | None = None) -> int:
|
|
52
|
+
p = argparse.ArgumentParser(prog="builderguild")
|
|
53
|
+
sub = p.add_subparsers(dest="cmd", required=True)
|
|
54
|
+
|
|
55
|
+
s = sub.add_parser("setup", help="inisialisasi graph")
|
|
56
|
+
s.set_defaults(func=cmd_setup)
|
|
57
|
+
|
|
58
|
+
s = sub.add_parser("status", help="tampilkan board")
|
|
59
|
+
s.add_argument("--filter", default=None, help="hanya tampilkan status ini")
|
|
60
|
+
s.set_defaults(func=cmd_status)
|
|
61
|
+
|
|
62
|
+
s = sub.add_parser("add", help="tambah task baru")
|
|
63
|
+
s.add_argument("title")
|
|
64
|
+
s.add_argument("--detail", default="")
|
|
65
|
+
s.set_defaults(func=cmd_add)
|
|
66
|
+
|
|
67
|
+
s = sub.add_parser("done", help="tandai task selesai")
|
|
68
|
+
s.add_argument("id", type=int)
|
|
69
|
+
s.set_defaults(func=cmd_done)
|
|
70
|
+
|
|
71
|
+
args = p.parse_args(argv)
|
|
72
|
+
return args.func(args)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
sys.exit(main())
|
builderguild/config.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ConfigError(ValueError):
|
|
6
|
+
"""Dilempar saat nilai konfigurasi dari environment tidak valid."""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _env(key: str, default: str = "") -> str:
|
|
10
|
+
return os.environ.get(key, default)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _env_int(key: str, default: str, minimum: int | None = None) -> int:
|
|
14
|
+
raw = _env(key, default)
|
|
15
|
+
try:
|
|
16
|
+
value = int(raw)
|
|
17
|
+
except ValueError:
|
|
18
|
+
raise ConfigError(f"{key} harus berupa angka bulat, dapat: {raw!r}") from None
|
|
19
|
+
if minimum is not None and value < minimum:
|
|
20
|
+
raise ConfigError(f"{key} minimal {minimum}, dapat: {value}")
|
|
21
|
+
return value
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class Config:
|
|
26
|
+
commander_model: str = field(
|
|
27
|
+
default_factory=lambda: _env("BG_COMMANDER_MODEL", "claude-sonnet-4-5")
|
|
28
|
+
)
|
|
29
|
+
soldier_model: str = field(
|
|
30
|
+
default_factory=lambda: _env("BG_SOLDIER_MODEL", "claude-haiku-4-5")
|
|
31
|
+
)
|
|
32
|
+
max_tokens: int = field(
|
|
33
|
+
default_factory=lambda: _env_int("BG_MAX_TOKENS", "200000", minimum=1)
|
|
34
|
+
)
|
|
35
|
+
max_agents: int = field(
|
|
36
|
+
default_factory=lambda: _env_int("BG_MAX_AGENTS", "6", minimum=1)
|
|
37
|
+
)
|
|
38
|
+
db_path: str = field(default_factory=lambda: _env("BG_DB_PATH", "runs/graph.db"))
|
|
39
|
+
repo_path: str = field(default_factory=lambda: _env("BG_REPO_PATH", "."))
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def load(cls) -> "Config":
|
|
43
|
+
return cls()
|
builderguild/errors.py
ADDED
builderguild/graph.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import sqlite3
|
|
3
|
+
import os
|
|
4
|
+
import time
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
from .errors import GraphError
|
|
8
|
+
|
|
9
|
+
SCHEMA = """
|
|
10
|
+
CREATE TABLE IF NOT EXISTS facts (
|
|
11
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
12
|
+
title TEXT NOT NULL,
|
|
13
|
+
summary TEXT NOT NULL,
|
|
14
|
+
evidence TEXT NOT NULL,
|
|
15
|
+
kind TEXT DEFAULT 'fact',
|
|
16
|
+
status TEXT DEFAULT 'open',
|
|
17
|
+
owner TEXT DEFAULT '',
|
|
18
|
+
created REAL NOT NULL,
|
|
19
|
+
updated REAL NOT NULL
|
|
20
|
+
);
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class FactGraph:
|
|
25
|
+
def __init__(self, db_path: str):
|
|
26
|
+
os.makedirs(os.path.dirname(db_path) or ".", exist_ok=True)
|
|
27
|
+
self.conn = sqlite3.connect(db_path)
|
|
28
|
+
self.conn.row_factory = sqlite3.Row
|
|
29
|
+
self.conn.executescript(SCHEMA)
|
|
30
|
+
self.conn.commit()
|
|
31
|
+
|
|
32
|
+
def list_titles(self, status: str | None = None) -> list[dict]:
|
|
33
|
+
q = "SELECT id, title, status, owner FROM facts"
|
|
34
|
+
args: tuple = ()
|
|
35
|
+
if status:
|
|
36
|
+
q += " WHERE status = ?"
|
|
37
|
+
args = (status,)
|
|
38
|
+
q += " ORDER BY id"
|
|
39
|
+
return [dict(r) for r in self.conn.execute(q, args)]
|
|
40
|
+
|
|
41
|
+
def add(self, title: str, summary: str, evidence: dict, kind: str = "fact", owner: str = "") -> int:
|
|
42
|
+
now = time.time()
|
|
43
|
+
cur = self.conn.execute(
|
|
44
|
+
"INSERT INTO facts(title,summary,evidence,kind,status,owner,created,updated) VALUES (?,?,?,?,?,?,?,?)",
|
|
45
|
+
(title, summary, json.dumps(evidence), kind, "open", owner, now, now),
|
|
46
|
+
)
|
|
47
|
+
self.conn.commit()
|
|
48
|
+
if cur.lastrowid is None:
|
|
49
|
+
raise GraphError("INSERT gagal: tidak ada id baris baru")
|
|
50
|
+
return cur.lastrowid
|
|
51
|
+
|
|
52
|
+
def update_status(self, fact_id: int, status: str) -> None:
|
|
53
|
+
self.conn.execute(
|
|
54
|
+
"UPDATE facts SET status = ?, updated = ? WHERE id = ?",
|
|
55
|
+
(status, time.time(), fact_id),
|
|
56
|
+
)
|
|
57
|
+
self.conn.commit()
|
|
58
|
+
|
|
59
|
+
def close(self) -> None:
|
|
60
|
+
self.conn.close()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: builderguild
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous software engineering legion
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Provides-Extra: dev
|
|
8
|
+
Requires-Dist: pytest; extra == "dev"
|
|
9
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
10
|
+
Requires-Dist: ruff; extra == "dev"
|
|
11
|
+
Requires-Dist: pip-audit; extra == "dev"
|
|
12
|
+
Requires-Dist: mypy; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
builderguild/__init__.py,sha256=yEgJYagDiQqwn6moMUMFIHzKJgxrvqfVfBKw0rwAfwY,20
|
|
2
|
+
builderguild/cli.py,sha256=1m99M1i4cPbB-tB7xxcQtJ2ZEqiL56SOD_6d8OGWTqc,2006
|
|
3
|
+
builderguild/config.py,sha256=_ZXKWfH-FJXHpu3W_OuDMGv7didix9qCY9xdJiUK8D0,1345
|
|
4
|
+
builderguild/errors.py,sha256=1vj21THvYfvCxkZ5lkW0UwX6dvnLCK-i6_pkxPd8Z2Y,216
|
|
5
|
+
builderguild/graph.py,sha256=9s4yEnZv1IF3INftokm3rAPbYu6LiTciKoC_uizL_Fs,1920
|
|
6
|
+
builderguild-0.1.0.dist-info/licenses/LICENSE,sha256=QMOz2a8YzuH6WsUdD0NF5_Ydw4-aYbRoD4qzbeap6vc,1070
|
|
7
|
+
builderguild-0.1.0.dist-info/METADATA,sha256=Zgd9rjkJtmbnOpx2KDAg6l3SEw7qd33GcZioRhFYrvc,385
|
|
8
|
+
builderguild-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
9
|
+
builderguild-0.1.0.dist-info/entry_points.txt,sha256=6q7IF4jj03caSOr8A6sJSnJ7W75jRP7HRuYNDVgFf34,55
|
|
10
|
+
builderguild-0.1.0.dist-info/top_level.txt,sha256=dAp-oqRVJqpSyRGlB2UvHHOyYQHhtDjaRT4udqMgdIA,13
|
|
11
|
+
builderguild-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
```text
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 Nuzuli
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
builderguild
|