autokeren 0.1.0__tar.gz

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.
Files changed (55) hide show
  1. autokeren-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +48 -0
  2. autokeren-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  3. autokeren-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  4. autokeren-0.1.0/.github/workflows/ci.yml +36 -0
  5. autokeren-0.1.0/.gitignore +71 -0
  6. autokeren-0.1.0/AGENTS.md +81 -0
  7. autokeren-0.1.0/CHANGELOG.md +37 -0
  8. autokeren-0.1.0/CONTRIBUTING.md +100 -0
  9. autokeren-0.1.0/LICENSE +21 -0
  10. autokeren-0.1.0/PKG-INFO +276 -0
  11. autokeren-0.1.0/README.md +235 -0
  12. autokeren-0.1.0/autokeren/__init__.py +2 -0
  13. autokeren-0.1.0/autokeren/__main__.py +5 -0
  14. autokeren-0.1.0/autokeren/agent.py +235 -0
  15. autokeren-0.1.0/autokeren/cli.py +350 -0
  16. autokeren-0.1.0/autokeren/config.py +123 -0
  17. autokeren-0.1.0/autokeren/context.py +71 -0
  18. autokeren-0.1.0/autokeren/diagram.py +469 -0
  19. autokeren-0.1.0/autokeren/memory.py +80 -0
  20. autokeren-0.1.0/autokeren/mermaid.py +304 -0
  21. autokeren-0.1.0/autokeren/models/__init__.py +0 -0
  22. autokeren-0.1.0/autokeren/models/base.py +41 -0
  23. autokeren-0.1.0/autokeren/models/cloudflare.py +421 -0
  24. autokeren-0.1.0/autokeren/models/retry.py +105 -0
  25. autokeren-0.1.0/autokeren/models/router.py +148 -0
  26. autokeren-0.1.0/autokeren/prompts.py +104 -0
  27. autokeren-0.1.0/autokeren/selector.py +56 -0
  28. autokeren-0.1.0/autokeren/session.py +85 -0
  29. autokeren-0.1.0/autokeren/tools/__init__.py +41 -0
  30. autokeren-0.1.0/autokeren/tools/base.py +96 -0
  31. autokeren-0.1.0/autokeren/tools/camofox.py +120 -0
  32. autokeren-0.1.0/autokeren/tools/cf_infra.py +194 -0
  33. autokeren-0.1.0/autokeren/tools/cloudflare.py +81 -0
  34. autokeren-0.1.0/autokeren/tools/file.py +187 -0
  35. autokeren-0.1.0/autokeren/tools/git.py +98 -0
  36. autokeren-0.1.0/autokeren/tools/project.py +159 -0
  37. autokeren-0.1.0/autokeren/tools/remember.py +40 -0
  38. autokeren-0.1.0/autokeren/tools/search.py +45 -0
  39. autokeren-0.1.0/autokeren/tools/shell.py +154 -0
  40. autokeren-0.1.0/autokeren/tools/tmux.py +70 -0
  41. autokeren-0.1.0/autokeren/tools/todo.py +72 -0
  42. autokeren-0.1.0/autokeren/tools/web.py +85 -0
  43. autokeren-0.1.0/autokeren/ui.py +367 -0
  44. autokeren-0.1.0/autokeren/utils.py +72 -0
  45. autokeren-0.1.0/config.example.yaml +41 -0
  46. autokeren-0.1.0/docs/ARCHITECTURE.md +155 -0
  47. autokeren-0.1.0/docs/DECISIONS.md +145 -0
  48. autokeren-0.1.0/docs/JOURNEY.md +122 -0
  49. autokeren-0.1.0/docs/ROADMAP.md +116 -0
  50. autokeren-0.1.0/pyproject.toml +73 -0
  51. autokeren-0.1.0/tests/test_mermaid.py +105 -0
  52. autokeren-0.1.0/tests/test_session.py +62 -0
  53. autokeren-0.1.0/tests/test_tools.py +335 -0
  54. autokeren-0.1.0/toko-sendal-modern-worker.js.bak-20260705-052811 +187 -0
  55. autokeren-0.1.0/toko-sendal-worker.js.bak-20260705-050514 +1 -0
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: Bug report
3
+ about: Laporkan bug untuk membantu kami memperbaikinya
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Deskripsi bug
10
+
11
+ Deskripsi singkat dan jelas mengenai bug tersebut.
12
+
13
+ ## Langkah reproduksi
14
+
15
+ 1. Jalankan '...'
16
+ 2. Masukkan '...'
17
+ 3. Lihat error
18
+
19
+ ## Perilaku yang diharapkan
20
+
21
+ Deskripsi perilaku yang seharusnya terjadi.
22
+
23
+ ## Perilaku aktual
24
+
25
+ Deskripsi perilaku yang terjadi.
26
+
27
+ ## Environment
28
+
29
+ - OS: [mis. Ubuntu 24.04]
30
+ - Python version: [mis. 3.12.4]
31
+ - autokeren version: [mis. 0.1.0]
32
+ - Cara install: [pip / dari source]
33
+
34
+ ## Konfigurasi
35
+
36
+ ```yaml
37
+ # Tempel config.yaml yang relevan (HAPUS api_token dan account_id sebelum mengirim)
38
+ ```
39
+
40
+ ## Log / Output
41
+
42
+ ```
43
+ Tempel output atau pesan error di sini
44
+ ```
45
+
46
+ ## Konteks tambahan
47
+
48
+ Informasi lain yang relevan.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: Usulkan fitur atau peningkatan untuk autokeren
4
+ title: "[FEAT] "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Ringkasan fitur
10
+
11
+ Deskripsi singkat fitur yang diusulkan.
12
+
13
+ ## Motivasi
14
+
15
+ Mengapa fitur ini dibutuhkan? Masalah apa yang dipecahkan atau diperbaiki?
16
+
17
+ ## Solusi yang diusulkan
18
+
19
+ Deskripsikan bagaimana fitur ini seharusnya bekerja.
20
+
21
+ ## Alternatif yang dipertimbangkan
22
+
23
+ Alternatif lain yang sudah dipertimbangkan dan alasannya.
24
+
25
+ ## Konteks tambahan
26
+
27
+ Screenshot, mockup, referensi, atau informasi lain yang relevan.
@@ -0,0 +1,28 @@
1
+ ## Deskripsi
2
+
3
+ Deskripsi singkat mengenai perubahan pada pull request ini.
4
+
5
+ ## Tipe perubahan
6
+
7
+ - [ ] Bug fix (non-breaking change yang memperbaiki issue)
8
+ - [ ] Fitur baru (non-breaking change yang menambah fitur)
9
+ - [ ] Breaking change (perubahan yang menyebabkan fitur eksisting tidak kompatibel)
10
+ - [ ] Dokumentasi
11
+ - [ ] Refactor / chore
12
+
13
+ ## Checklist
14
+
15
+ - [ ] Kode mengikuti style guide (`ruff check .` bersih)
16
+ - [ ] Type checking lolos (`mypy autokeren`)
17
+ - [ ] Test ditambahkan untuk perubahan baru
18
+ - [ ] Semua test lolos (`pytest`)
19
+ - [ ] Dokumentasi diperbarui bila perlu (README, CHANGELOG, AGENTS.md)
20
+ - [ ] Tidak ada credentials/token yang ter-commit
21
+
22
+ ## Testing
23
+
24
+ Deskripsikan bagaimana perubahan ini diuji.
25
+
26
+ ## Issue terkait
27
+
28
+ Closes #<issue-number>
@@ -0,0 +1,36 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Lint with ruff
30
+ run: ruff check .
31
+
32
+ - name: Type check with mypy
33
+ run: mypy autokeren
34
+
35
+ - name: Test with pytest
36
+ run: pytest -q
@@ -0,0 +1,71 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ env/
26
+ venv/
27
+ ENV/
28
+
29
+ # IDEs
30
+ .vscode/
31
+ .idea/
32
+ *.swp
33
+ *.swo
34
+ *~
35
+
36
+ # OS
37
+ .DS_Store
38
+ Thumbs.db
39
+
40
+ # Secrets / runtime config
41
+ *.secret
42
+ *.key
43
+ *.pem
44
+ .env
45
+ .env.*
46
+ *.env
47
+ config.yaml
48
+ !config.example.yaml
49
+
50
+ # Logs
51
+ *.log
52
+ logs/
53
+
54
+ # Coverage / test artifacts
55
+ .coverage
56
+ htmlcov/
57
+ .pytest_cache/
58
+ .mypy_cache/
59
+
60
+ # Private docs (internal only, jangan push ke public repo)
61
+ docs/private/
62
+
63
+ # Signing module (internal only, exclude dari open source)
64
+ autokeren/signing.py
65
+
66
+ # Test artifacts / generated workers
67
+ *.worker.js
68
+ *-worker.js
69
+ worker.js
70
+ worker.js.bak-*
71
+ toko-*/
@@ -0,0 +1,81 @@
1
+ # AGENTS.md
2
+
3
+ Panduan untuk AI agent yang bekerja di codebase autokeren.
4
+
5
+ ## Project Overview
6
+
7
+ autokeren adalah Cloudflare-first agentic coding CLI yang dibangun dengan Python. Agent loop membaca input user, memanggil model Cloudflare Workers AI (Kimi K2.7-Code primary, GLM 5.2 secondary), mengeksekusi tool calls, dan mengembalikan hasil sampai task selesai. Dirancang untuk stack Cloudflare-first dengan tools native untuk KV, D1, Pages/Workers deploy, Camofox e2e, dan tmux supervision.
8
+
9
+ ## Tech Stack
10
+
11
+ - Python 3.11+
12
+ - `httpx` untuk HTTP/2 streaming ke Cloudflare Workers AI
13
+ - `rich` untuk terminal UI
14
+ - `pydantic` untuk config dan tool schemas
15
+ - `pyyaml` / `strictyaml` untuk config YAML
16
+ - `pyfiglet` untuk banner
17
+ - standard library untuk core tools (pathlib, subprocess, re, hashlib)
18
+
19
+ ## Code Conventions
20
+
21
+ - **ruff** dengan `line-length = 120`.
22
+ - **mypy** strict. Semua code baru harus type-safe.
23
+ - **Tidak menambahkan komentar kode** kecuali diminta eksplisit.
24
+ - **UI text dalam Bahasa Indonesia** mengikuti konvensi yang sudah ada (pesan error, deskripsi tool, output command).
25
+ - Gunakan `from __future__ import annotations` di modul yang memakai type hints modern.
26
+ - Konvensi commit: Conventional Commits (`feat:`, `fix:`, `docs:`, `test:`, `chore:`).
27
+
28
+ ## Architecture
29
+
30
+ Modul inti dan tanggung jawabnya:
31
+
32
+ | Modul | Tanggung Jawab |
33
+ |---|---|
34
+ | `agent.py` | Core agentic loop: model call, tool dispatch, iterasi sampai selesai |
35
+ | `cli.py` | Entry point, argument parsing, slash-command dispatch, interactive REPL |
36
+ | `config.py` | Load + validasi `config.yaml` (pydantic) |
37
+ | `context.py` | Session memory: simpan pesan, track token usage vs context window |
38
+ | `memory.py` | Cross-session persistent memory per-project (`memory.md`) |
39
+ | `session.py` | Save/resume session state ke disk |
40
+ | `prompts.py` | Build system prompt (AGENTS.md, memory, tool schemas) |
41
+ | `ui.py` | Rich-based terminal UI: panel, streaming, status, banner |
42
+ | `utils.py` | Helper: redact, sanitize_filename, is_dangerous_command, human_size |
43
+ | `models/` | Cloudflare AI client (`cloudflare.py`), router/fallback (`router.py`), retry + circuit breaker (`retry.py`) |
44
+ | `tools/` | `base.py` (Tool ABC + ToolResult + ToolRegistry), 18 tool implementasi |
45
+
46
+ ### Tool System
47
+
48
+ Setiap tool mewarisi `Tool` (ABC) di `autokeren/tools/base.py` dengan atribut:
49
+
50
+ - `name`, `description`, `parameters` (JSON schema), `requires_permission`
51
+ - `run(**kwargs) -> ToolResult`
52
+ - `needs_permission(**kwargs)` dan `permission_desc(**kwargs)` untuk dynamic permission
53
+
54
+ `ToolRegistry` mengelola registrasi, lookup, schema generation, permission check, dan eksekusi dengan error handling.
55
+
56
+ ### Model Layer
57
+
58
+ `models/cloudflare.py` — HTTP client ke Workers AI dengan streaming.
59
+ `models/router.py` — pilih primary/secondary model, fallback otomatis.
60
+ `models/retry.py` — exponential backoff + circuit breaker.
61
+
62
+ ## Testing
63
+
64
+ - Framework: `pytest`.
65
+ - Tests harus cepat dan **tanpa external API call**. Mock network bila perlu.
66
+ - Gunakan `tmp_path` + `monkeypatch` untuk isolasi filesystem dan env var (mis. `AUTOKEREN_CONFIG_DIR` untuk `MemoryManager`).
67
+ - Sebelum commit, ketiga command berikut harus lolos:
68
+
69
+ ```bash
70
+ ruff check .
71
+ mypy autokeren
72
+ pytest
73
+ ```
74
+
75
+ ## Aturan Penting
76
+
77
+ - **Jangan pernah mengubah signature tool yang sudah ada** tanpa pertimbangan matang. Agent dan config bergantung pada `name`, `parameters`, dan `run` kwargs.
78
+ - **Selalu jalankan `ruff check .` dan `mypy autokeren`** setelah mengubah code. Keduanya harus bersih.
79
+ - Saat menambah tool baru, daftarkan di `autokeren/tools/__init__.py` dan tambahkan ke `__all__`.
80
+ - Jangan hardcode credentials. Baca dari config atau env var (`CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_API_TOKEN`).
81
+ - Gunakan `redact()` dari `autokeren.utils` saat mencetak token/API key.
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ Semua perubahan penting pada autokeren didokumentasikan di sini.
4
+
5
+ Format berdasarkan [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), dan project mengikuti [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.0] - 2026-07-04
8
+
9
+ ### Added
10
+
11
+ - Initial release.
12
+ - Core agentic loop (`agent.py`) dengan multi-iteration tool dispatch.
13
+ - Cloudflare Workers AI client dengan HTTP/2 streaming output.
14
+ - Multi-model fallback otomatis: Kimi K2.7-Code (primary) dan GLM 5.2 (secondary).
15
+ - Retry dengan exponential backoff, jitter, dan circuit breaker.
16
+ - Permission system dengan shell allowlist dan dangerous-command blocklist.
17
+ - Cross-session memory per-project (`MemoryManager` + `remember` tool).
18
+ - Session save/resume (`session.py`, perintah `/save` dan `/resume`).
19
+ - Context tracking dengan token usage dan perintah `/compact` (manual + auto-compact).
20
+ - AGENTS.md support: instruksi per-project dimuat otomatis ke system prompt.
21
+ - Indonesian localization untuk seluruh UI text.
22
+ - 18 tools bawaan:
23
+ - File: `read_file`, `write_file`, `patch_file`, `list_files`
24
+ - Shell: `run_shell`
25
+ - Search: `search_code`
26
+ - Web: `fetch_url`
27
+ - Git: `git_status`, `git_diff`, `git_commit`
28
+ - Cloudflare: `cf_deploy`, `cf_build_next`, `cf_kv`, `cf_d1`
29
+ - Camofox: `camofox` (browser e2e automation)
30
+ - Tmux: `tmux` (long-running supervisor)
31
+ - Productivity: `todo`, `remember`
32
+ - Slash commands: `/help`, `/q`, `/status`, `/compact`, `/reset`, `/memory`, `/save`, `/resume`, `/sessions`.
33
+ - Rich-based terminal UI dengan banner, panel, dan streaming.
34
+ - Transparent YAML config (`config.example.yaml`).
35
+ - PyPI packaging via hatchling.
36
+
37
+ [0.1.0]: https://github.com/autokeren/autokeren/releases/tag/v0.1.0
@@ -0,0 +1,100 @@
1
+ # Contributing to autokeren
2
+
3
+ Terima kasih sudah tertarik berkontribusi ke autokeren. Dokumen ini menjelaskan cara setup environment, code style, dan proses pull request.
4
+
5
+ ## Setup Development Environment
6
+
7
+ Prasyarat: Python 3.11+ dan git.
8
+
9
+ ```bash
10
+ git clone https://github.com/autokeren/autokeren.git
11
+ cd autokeren
12
+ python3 -m venv .venv
13
+ source .venv/bin/activate
14
+ pip install -e ".[dev]"
15
+ ```
16
+
17
+ Verifikasi instalasi:
18
+
19
+ ```bash
20
+ autokeren --help
21
+ ```
22
+
23
+ ## Code Style
24
+
25
+ - **ruff** untuk linting dan formatting, dengan `line-length = 120`.
26
+ - **mypy** untuk type checking (mode strict dianjurkan).
27
+ - Tidak menambahkan komentar kode kecuali diminta.
28
+ - UI text dalam Bahasa Indonesia mengikuti konvensi yang sudah ada.
29
+
30
+ ## Linting & Type Checking
31
+
32
+ Jalankan sebelum commit:
33
+
34
+ ```bash
35
+ ruff check .
36
+ mypy autokeren
37
+ ```
38
+
39
+ ## Menjalankan Tests
40
+
41
+ ```bash
42
+ pytest
43
+ ```
44
+
45
+ Tests harus cepat dan tidak memanggil external API. Gunakan `tmp_path` dan `monkeypatch` untuk isolasi filesystem dan environment.
46
+
47
+ ## Commit Message Convention
48
+
49
+ Gunakan [Conventional Commits](https://www.conventionalcommits.org/):
50
+
51
+ - `feat:` fitur baru
52
+ - `fix:` perbaikan bug
53
+ - `docs:` perubahan dokumentasi
54
+ - `test:` penambahan/perbaikan test
55
+ - `chore:` maintenance, dependency update, config
56
+ - `refactor:` refactor tanpa perubahan perilaku
57
+
58
+ Contoh:
59
+
60
+ ```
61
+ feat: tambah tool cf_kv untuk baca/tulis Cloudflare KV
62
+ fix: streaming text di dalam Panel bukan plain text
63
+ docs: perbarui README dengan commands reference
64
+ ```
65
+
66
+ ## Pull Request Process
67
+
68
+ 1. Fork repository dan buat branch dari `main` (`feat/nama-fitur` atau `fix/desc-bug`).
69
+ 2. Pastikan `ruff check .`, `mypy autokeren`, dan `pytest` lolos.
70
+ 3. Tulis test untuk perubahan baru bila memungkinkan.
71
+ 4. Update dokumentasi (README, CHANGELOG) bila perilaku pengguna berubah.
72
+ 5. Buat pull request dengan deskripsi jelas mengenai apa yang diubah dan mengapa.
73
+ 6. Pastikan CI hijau sebelum review.
74
+
75
+ ## Project Structure
76
+
77
+ ```
78
+ autokeren/
79
+ ├── autokeren/
80
+ │ ├── agent.py # core agentic loop
81
+ │ ├── cli.py # entry point + command parsing
82
+ │ ├── config.py # YAML config loader (pydantic)
83
+ │ ├── context.py # session memory + token tracking
84
+ │ ├── memory.py # cross-session persistent memory
85
+ │ ├── prompts.py # system prompt builder
86
+ │ ├── session.py # save/resume sessions
87
+ │ ├── ui.py # rich terminal UI
88
+ │ ├── utils.py # small helpers
89
+ │ ├── models/ # Cloudflare AI client + router + retry
90
+ │ └── tools/ # Tool base + registry + 18 tools
91
+ ├── tests/
92
+ ├── docs/
93
+ │ └── ARCHITECTURE.md
94
+ ├── pyproject.toml
95
+ └── README.md
96
+ ```
97
+
98
+ ## Pertanyaan?
99
+
100
+ Buka [issue](https://github.com/autokeren/autokeren/issues) untuk diskusi sebelum mengerjakan fitur besar.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Autokeren
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.