ccproxy.plugins.command_replay.formatter¶
ccproxy.plugins.command_replay.formatter
¶
File formatter for command replay output.
CommandFileFormatter
¶
CommandFileFormatter(
log_dir="/tmp/ccproxy/command_replay",
enabled=True,
separate_files_per_command=False,
)
Formats and writes command replay data to files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
log_dir
|
str
|
Directory for command replay files |
'/tmp/ccproxy/command_replay'
|
enabled
|
bool
|
Enable file writing |
True
|
separate_files_per_command
|
bool
|
Create separate files for curl/xh vs combined |
False
|
Source code in ccproxy/plugins/command_replay/formatter.py
should_write_files
¶
write_commands
async
¶
write_commands(
request_id,
curl_command,
xh_command,
provider=None,
timestamp_prefix=None,
method=None,
url=None,
headers=None,
body=None,
is_json=False,
)
Write command replay data to files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_id
|
str
|
Request ID for correlation |
required |
curl_command
|
str
|
Generated curl command |
required |
xh_command
|
str
|
Generated xh command |
required |
provider
|
str | None
|
Provider name (anthropic, openai, etc.) |
None
|
timestamp_prefix
|
str | None
|
Optional timestamp prefix from RequestContext |
None
|
method
|
str | None
|
HTTP method for shell script generation |
None
|
url
|
str | None
|
Request URL for shell script generation |
None
|
headers
|
dict[str, str] | None
|
HTTP headers for shell script generation |
None
|
body
|
Any
|
Request body for shell script generation |
None
|
is_json
|
bool
|
Whether body is JSON for shell script generation |
False
|
Returns:
| Type | Description |
|---|---|
list[str]
|
List of file paths that were written |
Source code in ccproxy/plugins/command_replay/formatter.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |