klaude-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 (58) hide show
  1. klaude_code-0.1.0/PKG-INFO +235 -0
  2. klaude_code-0.1.0/README.md +210 -0
  3. klaude_code-0.1.0/pyproject.toml +49 -0
  4. klaude_code-0.1.0/setup.cfg +4 -0
  5. klaude_code-0.1.0/src/klaude_code.egg-info/PKG-INFO +235 -0
  6. klaude_code-0.1.0/src/klaude_code.egg-info/SOURCES.txt +56 -0
  7. klaude_code-0.1.0/src/klaude_code.egg-info/dependency_links.txt +1 -0
  8. klaude_code-0.1.0/src/klaude_code.egg-info/entry_points.txt +2 -0
  9. klaude_code-0.1.0/src/klaude_code.egg-info/requires.txt +10 -0
  10. klaude_code-0.1.0/src/klaude_code.egg-info/top_level.txt +1 -0
  11. klaude_code-0.1.0/src/klaudecode/__init__.py +3 -0
  12. klaude_code-0.1.0/src/klaudecode/agent.py +399 -0
  13. klaude_code-0.1.0/src/klaudecode/cli.py +191 -0
  14. klaude_code-0.1.0/src/klaudecode/command/__init__.py +47 -0
  15. klaude_code-0.1.0/src/klaudecode/command/bash_input_mode.py +173 -0
  16. klaude_code-0.1.0/src/klaudecode/command/clear_command.py +29 -0
  17. klaude_code-0.1.0/src/klaudecode/command/compact_command.py +29 -0
  18. klaude_code-0.1.0/src/klaudecode/command/continue_command.py +19 -0
  19. klaude_code-0.1.0/src/klaudecode/command/cost_command.py +9 -0
  20. klaude_code-0.1.0/src/klaudecode/command/init_command.py +19 -0
  21. klaude_code-0.1.0/src/klaudecode/command/mac_setup_command.py +131 -0
  22. klaude_code-0.1.0/src/klaudecode/command/memory_input_mode.py +98 -0
  23. klaude_code-0.1.0/src/klaudecode/command/plan_input_mode.py +33 -0
  24. klaude_code-0.1.0/src/klaudecode/command/recent_command.py +19 -0
  25. klaude_code-0.1.0/src/klaudecode/command/rewrite_query_command.py +21 -0
  26. klaude_code-0.1.0/src/klaudecode/command/status_command.py +35 -0
  27. klaude_code-0.1.0/src/klaudecode/command/theme_command.py +60 -0
  28. klaude_code-0.1.0/src/klaudecode/command/today_command.py +19 -0
  29. klaude_code-0.1.0/src/klaudecode/config.py +400 -0
  30. klaude_code-0.1.0/src/klaudecode/llm.py +574 -0
  31. klaude_code-0.1.0/src/klaudecode/mcp/__init__.py +0 -0
  32. klaude_code-0.1.0/src/klaudecode/mcp/mcp_client.py +124 -0
  33. klaude_code-0.1.0/src/klaudecode/mcp/mcp_config.py +114 -0
  34. klaude_code-0.1.0/src/klaudecode/mcp/mcp_tool.py +251 -0
  35. klaude_code-0.1.0/src/klaudecode/message.py +539 -0
  36. klaude_code-0.1.0/src/klaudecode/prompt/commands.py +231 -0
  37. klaude_code-0.1.0/src/klaudecode/prompt/plan_mode.py +17 -0
  38. klaude_code-0.1.0/src/klaudecode/prompt/reminder.py +66 -0
  39. klaude_code-0.1.0/src/klaudecode/prompt/system.py +272 -0
  40. klaude_code-0.1.0/src/klaudecode/prompt/tools.py +455 -0
  41. klaude_code-0.1.0/src/klaudecode/session.py +302 -0
  42. klaude_code-0.1.0/src/klaudecode/tool.py +318 -0
  43. klaude_code-0.1.0/src/klaudecode/tools/__init__.py +28 -0
  44. klaude_code-0.1.0/src/klaudecode/tools/bash.py +341 -0
  45. klaude_code-0.1.0/src/klaudecode/tools/edit.py +156 -0
  46. klaude_code-0.1.0/src/klaudecode/tools/exit_plan_mode.py +47 -0
  47. klaude_code-0.1.0/src/klaudecode/tools/file_utils.py +250 -0
  48. klaude_code-0.1.0/src/klaudecode/tools/glob.py +286 -0
  49. klaude_code-0.1.0/src/klaudecode/tools/grep.py +287 -0
  50. klaude_code-0.1.0/src/klaudecode/tools/ls.py +60 -0
  51. klaude_code-0.1.0/src/klaudecode/tools/multi_edit.py +337 -0
  52. klaude_code-0.1.0/src/klaudecode/tools/read.py +199 -0
  53. klaude_code-0.1.0/src/klaudecode/tools/todo.py +121 -0
  54. klaude_code-0.1.0/src/klaudecode/tools/write.py +137 -0
  55. klaude_code-0.1.0/src/klaudecode/tui.py +344 -0
  56. klaude_code-0.1.0/src/klaudecode/user_input.py +532 -0
  57. klaude_code-0.1.0/src/klaudecode/user_questionary.py +14 -0
  58. klaude_code-0.1.0/src/klaudecode/utils.py +233 -0
@@ -0,0 +1,235 @@
1
+ Metadata-Version: 2.4
2
+ Name: klaude-code
3
+ Version: 0.1.0
4
+ Summary: Coding Agent CLI
5
+ Author-email: Your Name <your.email@example.com>
6
+ License: MIT
7
+ Keywords: cli,ai,coding,assistant
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Python: >=3.13
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: anthropic>=0.54.0
16
+ Requires-Dist: inquirerpy>=0.3.4
17
+ Requires-Dist: openai>=1.86.0
18
+ Requires-Dist: prompt-toolkit>=3.0.51
19
+ Requires-Dist: pydantic>=2.11.7
20
+ Requires-Dist: questionary>=2.1.0
21
+ Requires-Dist: rich>=14.0.0
22
+ Requires-Dist: tiktoken>=0.9.0
23
+ Requires-Dist: typer>=0.9.0
24
+ Requires-Dist: mcp>=1.0.0
25
+
26
+ # Klaude Code
27
+
28
+ A powerful coding agent CLI that brings Claude AI's coding capabilities directly to your terminal. Klaude Code provides an interactive assistant for software development tasks with persistent sessions, tool integration, and both interactive and headless modes.
29
+
30
+ ## Features
31
+
32
+ - **Interactive Chat Mode**: Natural conversation interface for coding assistance
33
+ - **Headless Mode**: Direct command execution for automation and scripting
34
+ - **Persistent Sessions**: Resume conversations across multiple sessions
35
+ - **Rich Tool Integration**: File operations, code search, bash execution, and more
36
+ - **Todo Management**: Built-in task tracking and planning
37
+ - **Code-Aware**: Understands project structure and follows existing conventions
38
+
39
+ ## Installation
40
+
41
+ ### Requirements
42
+ - Python 3.13 or higher
43
+ - [uv](https://docs.astral.sh/uv/) (recommended) or pip
44
+
45
+ ### Install from Source
46
+
47
+ ```bash
48
+ # Clone the repository
49
+ git clone <repository-url>
50
+ cd klaude-code
51
+
52
+ # Install dependencies with uv (recommended)
53
+ uv sync
54
+
55
+ # Install in development mode
56
+ uv tool install -e .
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ ### Quick Start
62
+
63
+ ```bash
64
+ # Interactive mode
65
+ klaude
66
+
67
+ # Headless mode (run once and exit)
68
+ klaude --print "Fix the type errors in src/main.py"
69
+
70
+ # Continue previous session
71
+ klaude --continue
72
+
73
+ # Enable MCP (Model Context Protocol) support
74
+ klaude --mcp
75
+ ```
76
+
77
+ ### Interactive Mode
78
+
79
+ Start an interactive coding session:
80
+
81
+ ```bash
82
+ klaude
83
+ ```
84
+
85
+ This opens a chat interface where you can ask for help with coding tasks, request code changes, debug issues, and more.
86
+
87
+ #### Slash Commands
88
+
89
+ In interactive mode, use these slash commands for quick actions:
90
+
91
+ ```bash
92
+ /status # Show current configuration and model info
93
+ /clear # Clear current chat history
94
+ /compact # Compact conversation and freeup context window
95
+ /theme # Switch between light and dark themes
96
+ /init # Initialize project CLAUDE.md
97
+ ```
98
+
99
+ #### Input Modes
100
+
101
+ Prefix your input with special characters for different modes:
102
+
103
+ ```bash
104
+ ! # Bash mode - execute bash commands directly
105
+ # Example: ! ls -la
106
+ # Example: ! git status
107
+
108
+ * # Plan mode - enter planning interface
109
+ # Example: * plan the user authentication feature
110
+ # Example: * design the database schema
111
+
112
+ # # Memory mode - access session memory and context
113
+ # Example: # do not add comments
114
+ # Example: # do not use emoji
115
+
116
+ @filename # File reference with auto-completion
117
+ # Example: @src/main.py to reference a file
118
+ # Example: @package.json to reference package file
119
+ ```
120
+
121
+ ### Headless Mode
122
+
123
+ Execute a single prompt and exit:
124
+
125
+ ```bash
126
+ klaude --print "Fix the type errors in src/main.py"
127
+ ```
128
+
129
+ Useful for automation and scripting:
130
+
131
+ ```bash
132
+ # Run tests and fix errors
133
+ klaude --print "run tests and fix any failing tests"
134
+ ```
135
+
136
+ ### Continue Previous Session
137
+
138
+ Resume your latest session:
139
+
140
+ ```bash
141
+ klaude --continue
142
+ ```
143
+
144
+ ### Command Line Options
145
+
146
+ #### Main Options
147
+
148
+ - `-p, --print <prompt>`: Run in headless mode with the given prompt
149
+ - `-r, --resume`: Choose from previous sessions to resume
150
+ - `-c, --continue`: Continue the latest session
151
+ - `--mcp`: Enable Model Context Protocol support
152
+
153
+ #### Model Configuration
154
+
155
+ - `--api-key <key>`: Override API key from config
156
+ - `--model <name>`: Override model name from config
157
+ - `--base-url <url>`: Override base URL from config
158
+ - `--max-tokens <num>`: Override max tokens from config
159
+ - `--model-azure`: Use Azure OpenAI model
160
+ - `--extra-header <header>`: Add extra HTTP header
161
+ - `--thinking`: Enable Claude Extended Thinking capability (Anthropic API only)
162
+
163
+ #### Subcommands
164
+
165
+ ```bash
166
+ # Configuration management
167
+ klaude config show # Show current configuration
168
+ klaude config edit # Edit configuration file
169
+
170
+ # MCP (Model Context Protocol) management
171
+ klaude mcp show # Show MCP configuration and available tools
172
+ klaude mcp edit # Edit MCP configuration file
173
+ ```
174
+
175
+
176
+ ## Configuration
177
+
178
+ Klaude Code uses configuration files to manage settings like API keys and model preferences. Configuration is automatically loaded from global user settings: `~/.klaude/config.json`.
179
+
180
+ Init and edit your configuration via:
181
+
182
+
183
+ ```bash
184
+ klaude config edit
185
+ ```
186
+
187
+
188
+ ## Available Tools
189
+
190
+ Klaude Code comes with a comprehensive set of tools for software development:
191
+
192
+ - **File Operations**: Read, write, edit, and search files
193
+ - **Code Search**: Grep, glob patterns, and intelligent code search
194
+ - **System Integration**: Bash command execution with proper quoting
195
+ - **Project Management**: Todo lists and task tracking
196
+ - **Multi-file Operations**: Batch edits and operations
197
+
198
+ ## Development
199
+
200
+ ### Setup Development Environment
201
+
202
+ ```bash
203
+ # Install dependencies
204
+ uv sync
205
+
206
+ # Install in development mode
207
+ uv pip install -e .
208
+ ```
209
+
210
+ ### Code Quality
211
+
212
+ ```bash
213
+ # Format code
214
+ isort src/ && ruff format src/
215
+
216
+ # Lint code
217
+ ruff check src/
218
+ ```
219
+
220
+ ## Architecture
221
+
222
+ Klaude Code is built with a modular architecture:
223
+
224
+ - **CLI Entry Point** (`cli.py`): Typer-based command interface
225
+ - **Session Management** (`session.py`): Persistent conversation history
226
+ - **Agent System** (`agent.py`): Core AI agent orchestration
227
+ - **Tool System** (`tool.py`): Extensible tool framework
228
+ - **LLM Integration** (`llm.py`): Claude API integration
229
+
230
+ ### Tool Development
231
+
232
+ Tools inherit from the base `Tool` class and define:
233
+ - Input parameters via Pydantic models
234
+ - Execution logic in the `call()` method
235
+ - Automatic JSON schema generation for LLM function calling
@@ -0,0 +1,210 @@
1
+ # Klaude Code
2
+
3
+ A powerful coding agent CLI that brings Claude AI's coding capabilities directly to your terminal. Klaude Code provides an interactive assistant for software development tasks with persistent sessions, tool integration, and both interactive and headless modes.
4
+
5
+ ## Features
6
+
7
+ - **Interactive Chat Mode**: Natural conversation interface for coding assistance
8
+ - **Headless Mode**: Direct command execution for automation and scripting
9
+ - **Persistent Sessions**: Resume conversations across multiple sessions
10
+ - **Rich Tool Integration**: File operations, code search, bash execution, and more
11
+ - **Todo Management**: Built-in task tracking and planning
12
+ - **Code-Aware**: Understands project structure and follows existing conventions
13
+
14
+ ## Installation
15
+
16
+ ### Requirements
17
+ - Python 3.13 or higher
18
+ - [uv](https://docs.astral.sh/uv/) (recommended) or pip
19
+
20
+ ### Install from Source
21
+
22
+ ```bash
23
+ # Clone the repository
24
+ git clone <repository-url>
25
+ cd klaude-code
26
+
27
+ # Install dependencies with uv (recommended)
28
+ uv sync
29
+
30
+ # Install in development mode
31
+ uv tool install -e .
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### Quick Start
37
+
38
+ ```bash
39
+ # Interactive mode
40
+ klaude
41
+
42
+ # Headless mode (run once and exit)
43
+ klaude --print "Fix the type errors in src/main.py"
44
+
45
+ # Continue previous session
46
+ klaude --continue
47
+
48
+ # Enable MCP (Model Context Protocol) support
49
+ klaude --mcp
50
+ ```
51
+
52
+ ### Interactive Mode
53
+
54
+ Start an interactive coding session:
55
+
56
+ ```bash
57
+ klaude
58
+ ```
59
+
60
+ This opens a chat interface where you can ask for help with coding tasks, request code changes, debug issues, and more.
61
+
62
+ #### Slash Commands
63
+
64
+ In interactive mode, use these slash commands for quick actions:
65
+
66
+ ```bash
67
+ /status # Show current configuration and model info
68
+ /clear # Clear current chat history
69
+ /compact # Compact conversation and freeup context window
70
+ /theme # Switch between light and dark themes
71
+ /init # Initialize project CLAUDE.md
72
+ ```
73
+
74
+ #### Input Modes
75
+
76
+ Prefix your input with special characters for different modes:
77
+
78
+ ```bash
79
+ ! # Bash mode - execute bash commands directly
80
+ # Example: ! ls -la
81
+ # Example: ! git status
82
+
83
+ * # Plan mode - enter planning interface
84
+ # Example: * plan the user authentication feature
85
+ # Example: * design the database schema
86
+
87
+ # # Memory mode - access session memory and context
88
+ # Example: # do not add comments
89
+ # Example: # do not use emoji
90
+
91
+ @filename # File reference with auto-completion
92
+ # Example: @src/main.py to reference a file
93
+ # Example: @package.json to reference package file
94
+ ```
95
+
96
+ ### Headless Mode
97
+
98
+ Execute a single prompt and exit:
99
+
100
+ ```bash
101
+ klaude --print "Fix the type errors in src/main.py"
102
+ ```
103
+
104
+ Useful for automation and scripting:
105
+
106
+ ```bash
107
+ # Run tests and fix errors
108
+ klaude --print "run tests and fix any failing tests"
109
+ ```
110
+
111
+ ### Continue Previous Session
112
+
113
+ Resume your latest session:
114
+
115
+ ```bash
116
+ klaude --continue
117
+ ```
118
+
119
+ ### Command Line Options
120
+
121
+ #### Main Options
122
+
123
+ - `-p, --print <prompt>`: Run in headless mode with the given prompt
124
+ - `-r, --resume`: Choose from previous sessions to resume
125
+ - `-c, --continue`: Continue the latest session
126
+ - `--mcp`: Enable Model Context Protocol support
127
+
128
+ #### Model Configuration
129
+
130
+ - `--api-key <key>`: Override API key from config
131
+ - `--model <name>`: Override model name from config
132
+ - `--base-url <url>`: Override base URL from config
133
+ - `--max-tokens <num>`: Override max tokens from config
134
+ - `--model-azure`: Use Azure OpenAI model
135
+ - `--extra-header <header>`: Add extra HTTP header
136
+ - `--thinking`: Enable Claude Extended Thinking capability (Anthropic API only)
137
+
138
+ #### Subcommands
139
+
140
+ ```bash
141
+ # Configuration management
142
+ klaude config show # Show current configuration
143
+ klaude config edit # Edit configuration file
144
+
145
+ # MCP (Model Context Protocol) management
146
+ klaude mcp show # Show MCP configuration and available tools
147
+ klaude mcp edit # Edit MCP configuration file
148
+ ```
149
+
150
+
151
+ ## Configuration
152
+
153
+ Klaude Code uses configuration files to manage settings like API keys and model preferences. Configuration is automatically loaded from global user settings: `~/.klaude/config.json`.
154
+
155
+ Init and edit your configuration via:
156
+
157
+
158
+ ```bash
159
+ klaude config edit
160
+ ```
161
+
162
+
163
+ ## Available Tools
164
+
165
+ Klaude Code comes with a comprehensive set of tools for software development:
166
+
167
+ - **File Operations**: Read, write, edit, and search files
168
+ - **Code Search**: Grep, glob patterns, and intelligent code search
169
+ - **System Integration**: Bash command execution with proper quoting
170
+ - **Project Management**: Todo lists and task tracking
171
+ - **Multi-file Operations**: Batch edits and operations
172
+
173
+ ## Development
174
+
175
+ ### Setup Development Environment
176
+
177
+ ```bash
178
+ # Install dependencies
179
+ uv sync
180
+
181
+ # Install in development mode
182
+ uv pip install -e .
183
+ ```
184
+
185
+ ### Code Quality
186
+
187
+ ```bash
188
+ # Format code
189
+ isort src/ && ruff format src/
190
+
191
+ # Lint code
192
+ ruff check src/
193
+ ```
194
+
195
+ ## Architecture
196
+
197
+ Klaude Code is built with a modular architecture:
198
+
199
+ - **CLI Entry Point** (`cli.py`): Typer-based command interface
200
+ - **Session Management** (`session.py`): Persistent conversation history
201
+ - **Agent System** (`agent.py`): Core AI agent orchestration
202
+ - **Tool System** (`tool.py`): Extensible tool framework
203
+ - **LLM Integration** (`llm.py`): Claude API integration
204
+
205
+ ### Tool Development
206
+
207
+ Tools inherit from the base `Tool` class and define:
208
+ - Input parameters via Pydantic models
209
+ - Execution logic in the `call()` method
210
+ - Automatic JSON schema generation for LLM function calling
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "klaude-code"
3
+ version = "0.1.0"
4
+ description = "Coding Agent CLI"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = {text = "MIT"}
8
+ authors = [
9
+ {name = "Your Name", email = "your.email@example.com"}
10
+ ]
11
+ keywords = ["cli", "ai", "coding", "assistant"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.13",
18
+ ]
19
+ dependencies = [
20
+ "anthropic>=0.54.0",
21
+ "inquirerpy>=0.3.4",
22
+ "openai>=1.86.0",
23
+ "prompt-toolkit>=3.0.51",
24
+ "pydantic>=2.11.7",
25
+ "questionary>=2.1.0",
26
+ "rich>=14.0.0",
27
+ "tiktoken>=0.9.0",
28
+ "typer>=0.9.0",
29
+ "mcp>=1.0.0",
30
+ ]
31
+
32
+ [project.scripts]
33
+ klaude = "klaudecode.cli:app"
34
+
35
+ [dependency-groups]
36
+ dev = [
37
+ "build>=1.2.2.post1",
38
+ "isort>=6.0.1",
39
+ "twine>=6.1.0",
40
+ ]
41
+
42
+ [tool.ruff]
43
+ line-length = 180
44
+ target-version = "py313"
45
+ extend-exclude = ["build", "docs/_build"]
46
+
47
+ [tool.ruff.format]
48
+ quote-style = "single"
49
+ docstring-code-format = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+