god-code 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 (80) hide show
  1. god_code-0.1.0/.gitignore +12 -0
  2. god_code-0.1.0/CHANGELOG.md +34 -0
  3. god_code-0.1.0/CONTRIBUTING.md +54 -0
  4. god_code-0.1.0/LICENSE +674 -0
  5. god_code-0.1.0/PKG-INFO +18 -0
  6. god_code-0.1.0/README.md +199 -0
  7. god_code-0.1.0/godot_agent/__init__.py +0 -0
  8. god_code-0.1.0/godot_agent/cli.py +352 -0
  9. god_code-0.1.0/godot_agent/godot/__init__.py +0 -0
  10. god_code-0.1.0/godot_agent/godot/collision_planner.py +166 -0
  11. god_code-0.1.0/godot_agent/godot/consistency_checker.py +168 -0
  12. god_code-0.1.0/godot_agent/godot/dependency_graph.py +153 -0
  13. god_code-0.1.0/godot_agent/godot/gdscript_linter.py +189 -0
  14. god_code-0.1.0/godot_agent/godot/pattern_advisor.py +161 -0
  15. god_code-0.1.0/godot_agent/godot/project.py +58 -0
  16. god_code-0.1.0/godot_agent/godot/resource_validator.py +27 -0
  17. god_code-0.1.0/godot_agent/godot/scene_parser.py +114 -0
  18. god_code-0.1.0/godot_agent/godot/scene_writer.py +77 -0
  19. god_code-0.1.0/godot_agent/godot/tscn_validator.py +185 -0
  20. god_code-0.1.0/godot_agent/llm/__init__.py +0 -0
  21. god_code-0.1.0/godot_agent/llm/client.py +148 -0
  22. god_code-0.1.0/godot_agent/llm/streaming.py +26 -0
  23. god_code-0.1.0/godot_agent/llm/vision.py +11 -0
  24. god_code-0.1.0/godot_agent/prompts/__init__.py +0 -0
  25. god_code-0.1.0/godot_agent/prompts/build_discipline.py +57 -0
  26. god_code-0.1.0/godot_agent/prompts/godot_playbook.py +267 -0
  27. god_code-0.1.0/godot_agent/prompts/knowledge_selector.py +112 -0
  28. god_code-0.1.0/godot_agent/prompts/system.py +89 -0
  29. god_code-0.1.0/godot_agent/py.typed +0 -0
  30. god_code-0.1.0/godot_agent/runtime/__init__.py +0 -0
  31. god_code-0.1.0/godot_agent/runtime/auth.py +22 -0
  32. god_code-0.1.0/godot_agent/runtime/config.py +53 -0
  33. god_code-0.1.0/godot_agent/runtime/context_manager.py +135 -0
  34. god_code-0.1.0/godot_agent/runtime/engine.py +104 -0
  35. god_code-0.1.0/godot_agent/runtime/error_loop.py +175 -0
  36. god_code-0.1.0/godot_agent/runtime/oauth.py +128 -0
  37. god_code-0.1.0/godot_agent/runtime/session.py +37 -0
  38. god_code-0.1.0/godot_agent/tools/__init__.py +0 -0
  39. god_code-0.1.0/godot_agent/tools/base.py +30 -0
  40. god_code-0.1.0/godot_agent/tools/file_ops.py +112 -0
  41. god_code-0.1.0/godot_agent/tools/git.py +49 -0
  42. god_code-0.1.0/godot_agent/tools/godot_cli.py +152 -0
  43. god_code-0.1.0/godot_agent/tools/list_dir.py +45 -0
  44. god_code-0.1.0/godot_agent/tools/registry.py +29 -0
  45. god_code-0.1.0/godot_agent/tools/screenshot.py +72 -0
  46. god_code-0.1.0/godot_agent/tools/search.py +72 -0
  47. god_code-0.1.0/godot_agent/tools/shell.py +79 -0
  48. god_code-0.1.0/pyproject.toml +34 -0
  49. god_code-0.1.0/tests/__init__.py +0 -0
  50. god_code-0.1.0/tests/godot/__init__.py +0 -0
  51. god_code-0.1.0/tests/godot/test_collision_planner.py +33 -0
  52. god_code-0.1.0/tests/godot/test_consistency.py +31 -0
  53. god_code-0.1.0/tests/godot/test_dependency_graph.py +36 -0
  54. god_code-0.1.0/tests/godot/test_linter.py +35 -0
  55. god_code-0.1.0/tests/godot/test_pattern_advisor.py +53 -0
  56. god_code-0.1.0/tests/godot/test_project.py +51 -0
  57. god_code-0.1.0/tests/godot/test_resource_validator.py +54 -0
  58. god_code-0.1.0/tests/godot/test_scene_parser.py +63 -0
  59. god_code-0.1.0/tests/godot/test_scene_writer.py +56 -0
  60. god_code-0.1.0/tests/godot/test_tscn_validator.py +46 -0
  61. god_code-0.1.0/tests/llm/__init__.py +0 -0
  62. god_code-0.1.0/tests/llm/test_client.py +84 -0
  63. god_code-0.1.0/tests/llm/test_vision.py +20 -0
  64. god_code-0.1.0/tests/prompts/__init__.py +0 -0
  65. god_code-0.1.0/tests/prompts/test_knowledge_selector.py +35 -0
  66. god_code-0.1.0/tests/prompts/test_system_prompt.py +35 -0
  67. god_code-0.1.0/tests/runtime/__init__.py +0 -0
  68. god_code-0.1.0/tests/runtime/test_config.py +39 -0
  69. god_code-0.1.0/tests/runtime/test_context_manager.py +61 -0
  70. god_code-0.1.0/tests/runtime/test_engine.py +138 -0
  71. god_code-0.1.0/tests/runtime/test_error_loop.py +46 -0
  72. god_code-0.1.0/tests/test_e2e.py +206 -0
  73. god_code-0.1.0/tests/tools/__init__.py +0 -0
  74. god_code-0.1.0/tests/tools/test_file_ops.py +79 -0
  75. god_code-0.1.0/tests/tools/test_git.py +70 -0
  76. god_code-0.1.0/tests/tools/test_godot_cli.py +127 -0
  77. god_code-0.1.0/tests/tools/test_list_dir.py +42 -0
  78. god_code-0.1.0/tests/tools/test_registry.py +58 -0
  79. god_code-0.1.0/tests/tools/test_search.py +70 -0
  80. god_code-0.1.0/tests/tools/test_shell.py +27 -0
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ *.egg-info/
6
+ .agent_sessions/
7
+ .pytest_cache/
8
+ auth.json
9
+ .env
10
+ *.pem
11
+ .idea/
12
+ .vscode/
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to God Code will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-04-02
6
+
7
+ ### Added
8
+ - CLI with `ask`, `chat`, `info`, `login`, `logout`, `status` commands
9
+ - 10 tools: read_file, write_file, edit_file, list_dir, grep, glob, git, run_shell, run_godot, screenshot_scene
10
+ - OpenAI-compatible API client with streaming and vision support
11
+ - OAuth login via Codex CLI refresh token
12
+ - Godot project parser (project.godot, autoloads, resolution)
13
+ - .tscn scene parser, writer, and format validator with auto-fix
14
+ - GDScript linter (naming, ordering, type annotations, anti-patterns)
15
+ - Collision layer planner (standard 8-layer scheme)
16
+ - Cross-file consistency checker (collision, signals, resource paths, groups)
17
+ - Project dependency graph builder
18
+ - Design pattern advisor (object pool, component, state machine)
19
+ - Godot Playbook knowledge system (17 sections, context-aware injection)
20
+ - Build discipline rules (incremental build-and-verify)
21
+ - Error detection loop with Godot output parsing and fix suggestions
22
+ - Conversation context compaction for long sessions
23
+ - Path containment security (file ops restricted to project root)
24
+ - Shell command sandboxing (dangerous pattern blocking)
25
+ - API retry with exponential backoff (429 rate limits)
26
+ - Content filter graceful handling (400 errors)
27
+ - Session persistence to JSON
28
+
29
+ ### Security
30
+ - File operations restricted to project root directory
31
+ - Shell commands blocked for dangerous patterns (rm -rf /, sudo, etc.)
32
+ - Git argument parsing via shlex.split()
33
+ - OAuth tokens stored with 600 permissions
34
+ - API key/token masked in status output
@@ -0,0 +1,54 @@
1
+ # Contributing to God Code
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## Getting Started
6
+
7
+ ```bash
8
+ git clone https://github.com/888wing/god-code.git
9
+ cd god-code
10
+ python3 -m venv .venv
11
+ source .venv/bin/activate
12
+ pip install -e ".[dev]"
13
+ python -m pytest tests/ -v
14
+ ```
15
+
16
+ ## Development Workflow
17
+
18
+ 1. Create a feature branch: `git checkout -b feature/your-feature`
19
+ 2. Write tests first (TDD encouraged)
20
+ 3. Implement the feature
21
+ 4. Run tests: `python -m pytest tests/ -v`
22
+ 5. Commit with descriptive messages
23
+ 6. Open a Pull Request
24
+
25
+ ## Code Style
26
+
27
+ - Python 3.12+ with type annotations
28
+ - Follow existing patterns in the codebase
29
+ - Use `pydantic` for tool input/output models
30
+ - New tools inherit from `BaseTool` in `godot_agent/tools/base.py`
31
+
32
+ ## Adding a New Tool
33
+
34
+ 1. Create `godot_agent/tools/your_tool.py`
35
+ 2. Implement a class inheriting `BaseTool` with `Input`, `Output`, and `execute()`
36
+ 3. Register it in `godot_agent/cli.py:build_registry()`
37
+ 4. Add tests in `tests/tools/test_your_tool.py`
38
+
39
+ ## Adding Godot Knowledge
40
+
41
+ Edit `godot_agent/prompts/godot_playbook.py` to add new sections. Each section has:
42
+ - Title
43
+ - Keywords (for auto-selection)
44
+ - Content (injected into system prompt when relevant)
45
+
46
+ ## Reporting Issues
47
+
48
+ - Use GitHub Issues
49
+ - Include: Python version, Godot version, god-code version, error output
50
+ - For API errors: include the status code and error message (not your API key)
51
+
52
+ ## License
53
+
54
+ By contributing, you agree that your contributions will be licensed under GPL-3.0.