claude-dev-cli 0.16.0__py3-none-any.whl → 0.16.2__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.

Potentially problematic release.


This version of claude-dev-cli might be problematic. Click here for more details.

@@ -9,7 +9,7 @@ Features:
9
9
  - Interactive and single-shot modes
10
10
  """
11
11
 
12
- __version__ = "0.16.0"
12
+ __version__ = "0.16.2"
13
13
  __author__ = "Julio"
14
14
  __license__ = "MIT"
15
15
 
@@ -130,6 +130,7 @@ class WorkflowEngine:
130
130
  generate_tests, code_review, debug_code,
131
131
  generate_docs, refactor_code, git_commit_message
132
132
  )
133
+ from claude_dev_cli.core import ClaudeClient
133
134
 
134
135
  # Map commands to functions
135
136
  command_map = {
@@ -141,11 +142,23 @@ class WorkflowEngine:
141
142
  'git commit': git_commit_message,
142
143
  }
143
144
 
145
+ # Handle special commands that need different execution
146
+ if command == 'ask':
147
+ return self._execute_ask_command(interpolated_args)
148
+ elif command in ['generate code', 'generate feature']:
149
+ # These are CLI-only commands that would need file generation logic
150
+ # For now, redirect to shell equivalent
151
+ return StepResult(
152
+ success=False,
153
+ output="",
154
+ error=f"Command '{command}' not yet supported in workflows. Use shell step with 'cdc {command}' instead."
155
+ )
156
+
144
157
  if command not in command_map:
145
158
  return StepResult(
146
159
  success=False,
147
160
  output="",
148
- error=f"Unknown command: {command}"
161
+ error=f"Unknown command: {command}. Supported: {', '.join(command_map.keys())}, ask"
149
162
  )
150
163
 
151
164
  try:
@@ -159,6 +172,8 @@ class WorkflowEngine:
159
172
  func_args['error_message'] = interpolated_args['error']
160
173
  if 'api' in interpolated_args:
161
174
  func_args['api_config_name'] = interpolated_args['api']
175
+ if 'model' in interpolated_args:
176
+ func_args['model'] = interpolated_args['model']
162
177
 
163
178
  # Execute
164
179
  result = func(**func_args)
@@ -180,6 +195,39 @@ class WorkflowEngine:
180
195
  error=str(e)
181
196
  )
182
197
 
198
+ def _execute_ask_command(self, args: Dict[str, Any]) -> StepResult:
199
+ """Execute an ask command step."""
200
+ try:
201
+ from claude_dev_cli.core import ClaudeClient
202
+
203
+ prompt = args.get('prompt', args.get('question', ''))
204
+ if not prompt:
205
+ return StepResult(
206
+ success=False,
207
+ output="",
208
+ error="ask command requires 'prompt' or 'question' argument"
209
+ )
210
+
211
+ api = args.get('api')
212
+ model = args.get('model')
213
+ system = args.get('system')
214
+
215
+ client = ClaudeClient(api_config_name=api)
216
+ result = client.call(prompt, system_prompt=system, model=model)
217
+
218
+ return StepResult(
219
+ success=True,
220
+ output=result,
221
+ metadata={'command': 'ask'}
222
+ )
223
+
224
+ except Exception as e:
225
+ return StepResult(
226
+ success=False,
227
+ output="",
228
+ error=str(e)
229
+ )
230
+
183
231
  def _execute_shell_step(self, step: Dict[str, Any], context: WorkflowContext) -> StepResult:
184
232
  """Execute a shell command step."""
185
233
  command = step['shell']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: claude-dev-cli
3
- Version: 0.16.0
3
+ Version: 0.16.2
4
4
  Summary: A powerful CLI tool for developers using Claude AI with multi-API routing, test generation, code review, and usage tracking
5
5
  Author-email: Julio <thinmanj@users.noreply.github.com>
6
6
  License: MIT
@@ -175,6 +175,17 @@ A powerful command-line tool for developers using Claude AI with multi-API routi
175
175
  - **Project Memory**: Remember preferences per project
176
176
  - **Global Config**: Set context defaults in `~/.claude-dev-cli/config.json`
177
177
 
178
+ ### 🔄 Workflows (v0.7.0+, Enhanced v0.16.1)
179
+ - **Multi-Step Automation**: Chain AI operations and shell commands with YAML
180
+ - **AI Decision Making**: Use `ask` command to make intelligent workflow decisions (v0.16.1)
181
+ - **Variable Interpolation**: Pass data between steps with `{{variable}}` syntax
182
+ - **Conditional Execution**: Skip steps based on conditions with `if` clauses
183
+ - **Approval Gates**: Human-in-the-loop with `approval_required: true`
184
+ - **Model Selection**: Use different AI models per step for cost optimization (v0.16.1)
185
+ - **Error Handling**: Continue on failure with `continue_on_error: true`
186
+ - **Three Step Types**: command (cdc), shell (bash/zsh), set (variables)
187
+ - **Cost Optimization**: Mix free local AI with paid cloud AI strategically
188
+
178
189
  ### 🎒 TOON Format Support (Optional)
179
190
  - **Token Reduction**: 30-60% fewer tokens than JSON
180
191
  - **Cost Savings**: Reduce API costs significantly
@@ -770,7 +781,208 @@ cdc history delete 20240109_143022
770
781
  - Reduces API costs by ~30-50% in long conversations
771
782
  - Shows token savings after summarization
772
783
 
773
- ### 7. Usage Tracking
784
+ ### 7. Workflows - AI-Powered Automation (v0.7.0+, Enhanced v0.16.1)
785
+
786
+ Chain multiple AI operations into automated sequences with YAML workflows.
787
+
788
+ #### Basic Workflow Usage
789
+
790
+ ```bash
791
+ # Run a workflow
792
+ cdc workflow run my-workflow.yaml
793
+
794
+ # Pass variables
795
+ cdc workflow run workflow.yaml --var file=main.py --var api=local
796
+
797
+ # List available workflows
798
+ cdc workflow list
799
+
800
+ # Show workflow details
801
+ cdc workflow show workflow.yaml
802
+ ```
803
+
804
+ #### Example: Simple Review & Test Workflow
805
+
806
+ ```yaml
807
+ name: "Review and Test"
808
+ description: "Review code and generate tests"
809
+
810
+ steps:
811
+ - name: code-review
812
+ command: review
813
+ args:
814
+ file: "{{target_file}}"
815
+ api: "local" # Use FREE local AI
816
+ model: "smart-local"
817
+ output_var: review_result
818
+
819
+ - name: generate-tests
820
+ command: generate tests
821
+ args:
822
+ file: "{{target_file}}"
823
+ api: "local"
824
+ model: "code-local"
825
+ output_var: tests
826
+
827
+ - name: run-tests
828
+ shell: "pytest tests/"
829
+ continue_on_error: true
830
+ ```
831
+
832
+ **Run it:**
833
+ ```bash
834
+ cdc workflow run review-test.yaml --var target_file=app.py
835
+ ```
836
+
837
+ #### Example: AI Decision Making (NEW in v0.16.1)
838
+
839
+ Use the `ask` command to make intelligent workflow decisions:
840
+
841
+ ```yaml
842
+ name: "Adaptive Code Analysis"
843
+ description: "AI analyzes code complexity and adapts workflow"
844
+
845
+ steps:
846
+ # AI rates complexity
847
+ - name: check-complexity
848
+ command: ask
849
+ args:
850
+ prompt: "Rate this code complexity 1-10, respond with number only: {{code}}"
851
+ api: "local" # FREE
852
+ model: "fast-local"
853
+ output_var: complexity
854
+
855
+ # Conditional deep review for complex code
856
+ - name: deep-review
857
+ command: review
858
+ args:
859
+ file: "{{file}}"
860
+ api: "personal" # Use paid API for complex code
861
+ model: "powerful"
862
+ if: "{{complexity}} > 7"
863
+ approval_required: true # Ask before using paid API
864
+
865
+ # Simple refactor for medium complexity
866
+ - name: simple-refactor
867
+ command: refactor
868
+ args:
869
+ file: "{{file}}"
870
+ api: "local" # FREE
871
+ if: "{{complexity}} >= 5 and {{complexity}} <= 7"
872
+ ```
873
+
874
+ **Key Features:**
875
+ - ✨ `ask` command for AI queries
876
+ - 💰 Mix free local and paid cloud AI
877
+ - 🎯 Conditional execution based on AI responses
878
+ - ✋ Approval gates before expensive operations
879
+
880
+ #### Example: Cost-Optimized Workflow
881
+
882
+ ```yaml
883
+ name: "Smart Cost Optimization"
884
+ description: "Use local AI first, cloud only when critical"
885
+
886
+ steps:
887
+ # Quick scan with FREE local AI
888
+ - name: quick-scan
889
+ command: ask
890
+ args:
891
+ prompt: "Quick scan for obvious issues: {{code}}"
892
+ api: "local" # FREE
893
+ model: "fast-local"
894
+ output_var: issues
895
+
896
+ # Only use expensive cloud AI if critical issues found
897
+ - name: deep-security-analysis
898
+ command: ask
899
+ args:
900
+ prompt: "Deep security analysis: {{code}}"
901
+ api: "personal" # PAID
902
+ model: "powerful" # Claude Opus - expensive
903
+ system: "You are a security expert"
904
+ if: "{{issues}} contains 'critical' or {{issues}} contains 'security'"
905
+ approval_required: true
906
+
907
+ # Tests with local code-specialized model (FREE)
908
+ - name: generate-tests
909
+ command: generate tests
910
+ args:
911
+ file: "{{file}}"
912
+ api: "local" # FREE
913
+ model: "code-local"
914
+ ```
915
+
916
+ **Cost Savings:**
917
+ - Local AI for initial scans: $0
918
+ - Cloud AI only when needed: saves 70-90%
919
+ - Approval gates prevent accidental costs
920
+
921
+ #### Workflow Step Types
922
+
923
+ **1. Command Steps (cdc commands)**
924
+ ```yaml
925
+ - name: review-code
926
+ command: review # or: generate tests, debug, refactor, etc.
927
+ args:
928
+ file: "{{file}}"
929
+ api: "local"
930
+ model: "smart-local"
931
+ output_var: result
932
+ ```
933
+
934
+ **Supported commands:** `review`, `generate tests`, `generate docs`, `refactor`, `debug`, `git commit`, `ask` (v0.16.1)
935
+
936
+ **2. Shell Steps (any command)**
937
+ ```yaml
938
+ - name: run-tests
939
+ shell: "pytest tests/ -v"
940
+ output_var: test_output
941
+ continue_on_error: true
942
+ ```
943
+
944
+ **3. Set Steps (variables)**
945
+ ```yaml
946
+ - name: set-config
947
+ set: api_endpoint
948
+ value: "https://api.example.com"
949
+ ```
950
+
951
+ #### Advanced Features
952
+
953
+ **Conditional Execution:**
954
+ ```yaml
955
+ if: "{{score}} > 7" # Simple comparison
956
+ if: "{{result}} contains 'error'" # String matching
957
+ if: "{{tests.success}}" # Access step results
958
+ ```
959
+
960
+ **Approval Gates:**
961
+ ```yaml
962
+ approval_required: true # Pause for user confirmation
963
+ ```
964
+
965
+ **Error Handling:**
966
+ ```yaml
967
+ continue_on_error: true # Don't stop workflow on failure
968
+ ```
969
+
970
+ **Variable Interpolation:**
971
+ ```yaml
972
+ {{variable}} # Simple variable
973
+ {{step_name.output}} # Step output
974
+ {{step_name.success}} # Step success status
975
+ ```
976
+
977
+ #### Example Workflows Included
978
+
979
+ **Location:** `examples/workflows/`
980
+
981
+ 1. **review-and-refactor.yaml** - Basic review workflow
982
+ 2. **ai-decision-workflow.yaml** - AI-powered decisions (v0.16.1)
983
+ 3. **multi-model-workflow.yaml** - Cost optimization (v0.16.1)
984
+
985
+ ### 8. Usage Tracking
774
986
 
775
987
  ```bash
776
988
  # View all usage
@@ -783,7 +995,7 @@ cdc usage --days 7
783
995
  cdc usage --api client
784
996
  ```
785
997
 
786
- ### 7. TOON Format (Optional - Reduces Tokens by 30-60%)
998
+ ### 9. TOON Format (Optional - Reduces Tokens by 30-60%)
787
999
 
788
1000
  ```bash
789
1001
  # Check if TOON is installed
@@ -952,6 +1164,31 @@ When using a client's Enterprise API:
952
1164
  |---------|-------------|
953
1165
  | `cdc git commit` | Generate commit message |
954
1166
 
1167
+ ### Workflows (v0.7.0+)
1168
+
1169
+ | Command | Description |
1170
+ |---------|-------------|
1171
+ | `cdc workflow run <file>` | Execute workflow from YAML |
1172
+ | `cdc workflow list` | List available workflows |
1173
+ | `cdc workflow show <file>` | Show workflow details |
1174
+
1175
+ ### Ollama (Local AI) (v0.16.0+)
1176
+
1177
+ | Command | Description |
1178
+ |---------|-------------|
1179
+ | `cdc ollama list` | List local models |
1180
+ | `cdc ollama pull <model>` | Download model |
1181
+ | `cdc ollama show <model>` | Show model details |
1182
+
1183
+ ### Model Profiles (v0.10.0+)
1184
+
1185
+ | Command | Description |
1186
+ |---------|-------------|
1187
+ | `cdc model list` | List all model profiles |
1188
+ | `cdc model show <name>` | Show profile details |
1189
+ | `cdc model add <name> <model_id>` | Add custom profile |
1190
+ | `cdc model set-default <name>` | Set default profile |
1191
+
955
1192
  ## Options
956
1193
 
957
1194
  ### Common Options
@@ -962,11 +1199,33 @@ When using a client's Enterprise API:
962
1199
  - `-f, --file <path>`: Include file in prompt
963
1200
  - `-o, --output <path>`: Save output to file
964
1201
 
965
- ### Models
1202
+ ### Model Profiles
1203
+
1204
+ **Anthropic (Claude):**
1205
+ - `fast` / `claude-3-5-haiku-20241022` - Fast & economical ($0.80/$4 per Mtok)
1206
+ - `smart` / `claude-sonnet-4-5-20250929` - Balanced (default) ($3/$15 per Mtok)
1207
+ - `powerful` / `claude-opus-4-20250514` - Most capable ($15/$75 per Mtok)
1208
+
1209
+ **OpenAI (GPT):** (requires `pip install 'claude-dev-cli[openai]'`)
1210
+ - `fast-openai` / `gpt-3.5-turbo` - Fast & cheap ($0.50/$1.50 per Mtok)
1211
+ - `smart-openai` / `gpt-4-turbo` - Balanced ($10/$30 per Mtok)
1212
+ - `powerful-openai` / `gpt-4` - High capability ($30/$60 per Mtok)
1213
+
1214
+ **Ollama (Local - FREE):** (requires `pip install 'claude-dev-cli[ollama]'`)
1215
+ - `fast-local` / `mistral` - Fast inference (8k context, FREE)
1216
+ - `smart-local` / `mixtral` - Powerful reasoning (32k context, FREE)
1217
+ - `code-local` / `codellama` - Code specialist (16k context, FREE)
966
1218
 
967
- - `claude-3-5-sonnet-20241022` (default)
968
- - `claude-3-opus-20240229`
969
- - `claude-3-haiku-20240307`
1219
+ **Usage:**
1220
+ ```bash
1221
+ # Use model profile
1222
+ cdc ask -m fast "quick question" # Uses Haiku
1223
+ cdc ask -m fast-local "question" # Uses Mistral (FREE)
1224
+
1225
+ # Use specific model ID
1226
+ cdc ask -m claude-opus-4-20250514 "complex task"
1227
+ cdc ask -m gpt-4-turbo "openai task"
1228
+ ```
970
1229
 
971
1230
  ## Examples
972
1231
 
@@ -1,4 +1,4 @@
1
- claude_dev_cli/__init__.py,sha256=kYIzIW-2GfcMEdRmvAB0S6560l0r5X11CNH1UhDs3bw,470
1
+ claude_dev_cli/__init__.py,sha256=UX6d3t4T9Y3Ju9Ip1rBlnMGEx89aGVZDtqX6Gof6jV4,470
2
2
  claude_dev_cli/cli.py,sha256=wy3IOb4qvCM64hQ8PKMuAvouY4ln95U2DeyeWbe0I4E,108673
3
3
  claude_dev_cli/commands.py,sha256=RKGx2rv56PM6eErvA2uoQ20hY8babuI5jav8nCUyUOk,3964
4
4
  claude_dev_cli/config.py,sha256=1pycr6LSEKc8yKA4CTavL7mH_JfZYszX9YvAE5Fx9gE,23719
@@ -14,7 +14,7 @@ claude_dev_cli/templates.py,sha256=lKxH943ySfUKgyHaWa4W3LVv91SgznKgajRtSRp_4UY,2
14
14
  claude_dev_cli/toon_utils.py,sha256=S3px2UvmNEaltmTa5K-h21n2c0CPvYjZc9mc7kHGqNQ,2828
15
15
  claude_dev_cli/usage.py,sha256=7F92mVUenSsONZxmug3ZLbd-8l1qcbqCAzzLbsrJF5Y,7700
16
16
  claude_dev_cli/warp_integration.py,sha256=PDufAJecl7uN0DGz6XW4uDSEeu7Ssg53DOIFKm-AXVg,6909
17
- claude_dev_cli/workflows.py,sha256=WpLq9I_0MmDsJIbCi9-f662JVyn8iKTs1KZ50w-GlZU,12202
17
+ claude_dev_cli/workflows.py,sha256=tAo45rsY-GW6cKMAvb6r4IuTnQcepgbAyAbJzxw1QyU,14099
18
18
  claude_dev_cli/plugins/__init__.py,sha256=BdiZlylBzEgnwK2tuEdn8cITxhAZRVbTnDbWhdDhgqs,1340
19
19
  claude_dev_cli/plugins/base.py,sha256=H4HQet1I-a3WLCfE9F06Lp8NuFvVoIlou7sIgyJFK-c,1417
20
20
  claude_dev_cli/plugins/diff_editor/__init__.py,sha256=gqR5S2TyIVuq-sK107fegsutQ7Z-sgAIEbtc71FhXIM,101
@@ -26,9 +26,9 @@ claude_dev_cli/providers/base.py,sha256=KC2KQKGbR5_Oz_Xf5bjrGoEI-b3nfikRP5FXSy-4
26
26
  claude_dev_cli/providers/factory.py,sha256=w9LXY1U7HZcDoYcGcRpFTcjl0IpzvO_7QaIl7yo1p5M,3978
27
27
  claude_dev_cli/providers/ollama.py,sha256=DeetIbBmVifT2E5EIz7leZwsCWvP4kHwBkYfKCaCOjk,9642
28
28
  claude_dev_cli/providers/openai.py,sha256=UV8XAYTzhcAaX9KgV4Dkm5UAt1EsEUQ2RFsJkg0x3CY,9405
29
- claude_dev_cli-0.16.0.dist-info/licenses/LICENSE,sha256=DGueuJwMJtMwgLO5mWlS0TaeBrFwQuNpNZ22PU9J2bw,1062
30
- claude_dev_cli-0.16.0.dist-info/METADATA,sha256=6ZC56-5QQCvCeZkAfPnQZ_7rDhMTCVf7TNWWfqhZymQ,33374
31
- claude_dev_cli-0.16.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
32
- claude_dev_cli-0.16.0.dist-info/entry_points.txt,sha256=zymgUIIVpFTARkFmxAuW2A4BQsNITh_L0uU-XunytHg,85
33
- claude_dev_cli-0.16.0.dist-info/top_level.txt,sha256=m7MF6LOIuTe41IT5Fgt0lc-DK1EgM4gUU_IZwWxK0pg,15
34
- claude_dev_cli-0.16.0.dist-info/RECORD,,
29
+ claude_dev_cli-0.16.2.dist-info/licenses/LICENSE,sha256=DGueuJwMJtMwgLO5mWlS0TaeBrFwQuNpNZ22PU9J2bw,1062
30
+ claude_dev_cli-0.16.2.dist-info/METADATA,sha256=cpT5DmhijqCsJ-rYsYi7KromYkkd-_ifQjgP8oN-fXQ,40616
31
+ claude_dev_cli-0.16.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
32
+ claude_dev_cli-0.16.2.dist-info/entry_points.txt,sha256=zymgUIIVpFTARkFmxAuW2A4BQsNITh_L0uU-XunytHg,85
33
+ claude_dev_cli-0.16.2.dist-info/top_level.txt,sha256=m7MF6LOIuTe41IT5Fgt0lc-DK1EgM4gUU_IZwWxK0pg,15
34
+ claude_dev_cli-0.16.2.dist-info/RECORD,,