ccoding 0.1.0__py3-none-any.whl → 0.2.0__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.
ccode/__init__.py CHANGED
@@ -1,7 +1,12 @@
1
1
  from __future__ import annotations
2
2
 
3
- from .cli import main
3
+ __version__ = "0.2.0"
4
+
5
+
6
+ def main() -> None:
7
+ from .cli import main as cli_main
8
+
9
+ cli_main()
4
10
 
5
- __version__ = "0.1.0"
6
11
 
7
12
  __all__ = ["main", "__version__"]
ccode/api.py CHANGED
@@ -125,6 +125,10 @@ def validate_launch_requirements(config: dict[str, Any]) -> str | None:
125
125
  return None
126
126
 
127
127
 
128
+ def build_claude_command(args: list[str]) -> list[str]:
129
+ return ["claude", *args]
130
+
131
+
128
132
  def launch_claude(config: dict[str, Any], args: list[str]) -> str | None:
129
133
  base_url = config.get("base_url", "").strip()
130
134
  api_key = config.get("api_key", "").strip()
@@ -132,7 +136,7 @@ def launch_claude(config: dict[str, Any], args: list[str]) -> str | None:
132
136
  return "Missing base URL or API key."
133
137
  env = build_env(config, masked=False)
134
138
  try:
135
- subprocess.run(["claude", *args], check=True, env=env)
139
+ subprocess.run(build_claude_command(args), check=True, env=env)
136
140
  except FileNotFoundError:
137
141
  return "Could not find 'claude' on PATH."
138
142
  except subprocess.CalledProcessError as exc:
ccode/config.py CHANGED
@@ -21,6 +21,15 @@ DEFAULT_TOGGLES: dict[str, str] = {
21
21
  "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
22
22
  }
23
23
 
24
+ DEFAULT_REMOTE: dict[str, Any] = {
25
+ "enabled": False,
26
+ "host": "127.0.0.1",
27
+ "port": 8765,
28
+ "token": "",
29
+ "session_name": "ccode-claude",
30
+ "reuse_session": True,
31
+ }
32
+
24
33
  _ENV_SCHEMA: dict[str, Any] = {}
25
34
  _SCHEMA_KEYS: list[str] = []
26
35
 
@@ -65,6 +74,7 @@ def default_config() -> dict[str, Any]:
65
74
  "haiku": {"owned_by": None, "id": None},
66
75
  },
67
76
  "toggles": DEFAULT_TOGGLES.copy(),
77
+ "remote": DEFAULT_REMOTE.copy(),
68
78
  }
69
79
 
70
80
 
@@ -114,6 +124,27 @@ def load_config() -> dict[str, Any]:
114
124
  if new_toggles:
115
125
  config["toggles"] = new_toggles
116
126
 
127
+ remote = data.get("remote")
128
+ if isinstance(remote, dict):
129
+ enabled = remote.get("enabled")
130
+ if isinstance(enabled, bool):
131
+ config["remote"]["enabled"] = enabled
132
+ host = remote.get("host")
133
+ if isinstance(host, str):
134
+ config["remote"]["host"] = host
135
+ port = remote.get("port")
136
+ if isinstance(port, int):
137
+ config["remote"]["port"] = port
138
+ token = remote.get("token")
139
+ if isinstance(token, str):
140
+ config["remote"]["token"] = token
141
+ session_name = remote.get("session_name")
142
+ if isinstance(session_name, str):
143
+ config["remote"]["session_name"] = session_name
144
+ reuse_session = remote.get("reuse_session")
145
+ if isinstance(reuse_session, bool):
146
+ config["remote"]["reuse_session"] = reuse_session
147
+
117
148
  return config
118
149
 
119
150