cliops 1.0.1__py3-none-any.whl → 1.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cliops
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Advanced CLI tool for structured, pattern-based prompt optimization and state management
5
5
  Home-page: https://github.com/cliops/cliops
6
6
  Author: CliOps Development Team
@@ -1,13 +1,14 @@
1
1
  main.py,sha256=YwzFPWB6QDtjK7r9gKA9tixEgD_7_b7gXoj6Q2ETCqk,9255
2
- cliops-1.0.1.dist-info/licenses/LICENSE,sha256=2J5KKebeJ2AdMaxuYA1fX0ZuDs9MmWp3cpjZX-JqrZs,1079
2
+ presets.py,sha256=DKIfhwxtBZEC5fYHgXqhuBKou7KYQks_2M8cR3IeWao,3172
3
+ cliops-1.0.2.dist-info/licenses/LICENSE,sha256=2J5KKebeJ2AdMaxuYA1fX0ZuDs9MmWp3cpjZX-JqrZs,1079
3
4
  core/__init__.py,sha256=aWl7MZaubJNqrafNCM5VRYg4SZ7sdifrxTWrJC8d-_s,24
4
5
  core/analyzer.py,sha256=mwMmrlV-Pk31mMfKs0NPqBqY3cpNwCq_DWwGaurjPzI,4328
5
6
  core/config.py,sha256=aoYCLt-EFM7WiR3_QN049_cfz9_SODuqnErte07DTVM,1388
6
7
  core/optimizer.py,sha256=6hGdelQjWb71WAdXWr89EvYNinzb2gETQgaB3APuoV8,6196
7
8
  core/patterns.py,sha256=BWiwb5fjQbWHLsJ68p0QbtSddFqzhYx3AeLkSY-WKbU,6464
8
9
  core/state.py,sha256=dHdA9U0LNgGzyS_bSlcotjfpnwZGtMHfEz5JEbUqwf8,2055
9
- cliops-1.0.1.dist-info/METADATA,sha256=b9z7-AZyNEDvsjWnuBQPVlJJUIL5Hqn4Bb3HqmBx4FA,3818
10
- cliops-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- cliops-1.0.1.dist-info/entry_points.txt,sha256=F8ZncVlnk83ELj0TGXUYS-qYvmaP-owQyU20I7jRefg,37
12
- cliops-1.0.1.dist-info/top_level.txt,sha256=rZwDY0-fkfo1lSqHk5h706nubQ_SMktR8ke523WorM0,10
13
- cliops-1.0.1.dist-info/RECORD,,
10
+ cliops-1.0.2.dist-info/METADATA,sha256=2bxAK7TdiiqRIVCvBpIxgr2uGoQXPC5H14SFsiYmsRA,3818
11
+ cliops-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ cliops-1.0.2.dist-info/entry_points.txt,sha256=F8ZncVlnk83ELj0TGXUYS-qYvmaP-owQyU20I7jRefg,37
13
+ cliops-1.0.2.dist-info/top_level.txt,sha256=dV-NRp_bb_IkCFfEXDbA1mHA5SshVNbUsxaF809itG8,18
14
+ cliops-1.0.2.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  core
2
2
  main
3
+ presets
presets.py ADDED
@@ -0,0 +1,93 @@
1
+ # presets.py
2
+ import json
3
+ import re
4
+ from pathlib import Path
5
+
6
+ BUILTIN_PRESETS = {
7
+ "react-tailwind": {
8
+ "ARCHITECTURE": "React + Tailwind CSS",
9
+ "FOCUS": "UI layout",
10
+ "PATTERNS": "context_aware_generation, state_anchoring",
11
+ "DEFAULT_PATTERN": "context_aware_generation"
12
+ },
13
+ "django-api": {
14
+ "ARCHITECTURE": "Django REST Framework",
15
+ "FOCUS": "API endpoints and serializers",
16
+ "PATTERNS": "bug_fix_precision",
17
+ "DEFAULT_PATTERN": "bug_fix_precision"
18
+ },
19
+ "bash-script": {
20
+ "ARCHITECTURE": "Shell scripting",
21
+ "FOCUS": "Automation and CLI behavior",
22
+ "PATTERNS": "context_aware_generation",
23
+ "DEFAULT_PATTERN": "context_aware_generation"
24
+ }
25
+ }
26
+
27
+ CUSTOM_PRESET_FILE = Path.home() / ".cliops_presets.json"
28
+
29
+ def suggest_preset_from_prompt(prompt: str) -> str | None:
30
+ prompt = prompt.lower()
31
+ if "tailwind" in prompt or "jsx" in prompt:
32
+ return "react-tailwind"
33
+ if "endpoint" in prompt or "serializer" in prompt or "django" in prompt:
34
+ return "django-api"
35
+ if re.search(r'#!/bin/bash|\\.sh|chmod|\\bcron\\b', prompt):
36
+ return "bash-script"
37
+ return None
38
+
39
+ def save_custom_preset(name, preset_dict):
40
+ if CUSTOM_PRESET_FILE.exists():
41
+ with open(CUSTOM_PRESET_FILE, 'r') as f:
42
+ all_presets = json.load(f)
43
+ else:
44
+ all_presets = {}
45
+ all_presets[name] = preset_dict
46
+ with open(CUSTOM_PRESET_FILE, 'w') as f:
47
+ json.dump(all_presets, f, indent=2)
48
+ print(f"✅ Custom preset '{name}' saved.")
49
+
50
+ def apply_preset_interactive(suggested_name, state):
51
+ print(f"\n🤖 Suggested preset based on your prompt: {suggested_name}")
52
+ use = input("Would you like to use this preset? (y/n): ").strip().lower()
53
+ if use != 'y':
54
+ print("❌ Preset declined.")
55
+ return
56
+
57
+ fields = {}
58
+ for key in BUILTIN_PRESETS.get(suggested_name, {}):
59
+ default = BUILTIN_PRESETS[suggested_name][key]
60
+ user_val = input(f"{key} [{default}]: ").strip()
61
+ fields[key] = user_val or default
62
+ state.set(key, fields[key])
63
+
64
+ save = input("Save this as a custom preset? (y/n): ").strip().lower()
65
+ if save == 'y':
66
+ name = input("Enter a name for your preset: ").strip()
67
+ if name:
68
+ save_custom_preset(name, fields)
69
+
70
+ def list_all_presets():
71
+ print("\n📦 Available Presets:")
72
+ for name in BUILTIN_PRESETS:
73
+ print(f" - {name} (built-in)")
74
+ if CUSTOM_PRESET_FILE.exists():
75
+ with open(CUSTOM_PRESET_FILE, 'r') as f:
76
+ custom = json.load(f)
77
+ for name in custom:
78
+ print(f" - {name} (custom)")
79
+
80
+
81
+ def apply_named_preset(name, state):
82
+ preset = BUILTIN_PRESETS.get(name)
83
+ if not preset and CUSTOM_PRESET_FILE.exists():
84
+ with open(CUSTOM_PRESET_FILE, 'r') as f:
85
+ preset = json.load(f).get(name)
86
+
87
+ if not preset:
88
+ print(f"❌ Preset '{name}' not found.")
89
+ return
90
+
91
+ for key, value in preset.items():
92
+ state.set(key, value)
93
+ print(f"✅ Preset '{name}' applied.")
File without changes