-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
198 lines (168 loc) · 4.65 KB
/
Taskfile.yaml
File metadata and controls
198 lines (168 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
version: '3'
vars:
BINARY_NAME: anthropic-proxy
INSTALL_DIR: '{{.HOME}}/.cargo/bin'
BUILD_DIR: target/release
tasks:
default:
desc: Show available tasks
cmds:
- task --list
build:
desc: Build release binary
cmds:
- cargo build --release
sources:
- src/**/*.rs
- Cargo.toml
- Cargo.lock
generates:
- '{{.BUILD_DIR}}/{{.BINARY_NAME}}'
build-dev:
desc: Build debug binary
cmds:
- cargo build
install:
desc: Build and install to ~/.cargo/bin
deps: [build]
cmds:
- cp {{.BUILD_DIR}}/{{.BINARY_NAME}} {{.INSTALL_DIR}}/{{.BINARY_NAME}}
- chmod +x {{.INSTALL_DIR}}/{{.BINARY_NAME}}
- echo "✅ Installed to {{.INSTALL_DIR}}/{{.BINARY_NAME}}"
local-install:
desc: Build and install to ~/.cargo/bin (alias for install)
cmds:
- task: install
uninstall:
desc: Remove installed binary
cmds:
- rm -f {{.INSTALL_DIR}}/{{.BINARY_NAME}}
- echo "✅ Uninstalled {{.BINARY_NAME}}"
run:
desc: Run in development mode
cmds:
- cargo run
run-release:
desc: Run release build
deps: [build]
cmds:
- ./{{.BUILD_DIR}}/{{.BINARY_NAME}}
test:
desc: Run all tests
cmds:
- cargo test
test-verbose:
desc: Run tests with verbose output
cmds:
- cargo test -- --nocapture --test-threads=1
fmt:
desc: Format code
cmds:
- cargo fmt
fmt-check:
desc: Check code formatting
cmds:
- cargo fmt -- --check
lint:
desc: Run clippy linter
cmds:
- cargo clippy -- -D warnings
lint-fix:
desc: Run clippy with auto-fix
cmds:
- cargo clippy --fix --allow-dirty --allow-staged
check:
desc: Run all checks (fmt, lint, test)
cmds:
- task: fmt-check
- task: lint
- task: test
clean:
desc: Clean build artifacts
cmds:
- cargo clean
- echo "✅ Cleaned build artifacts"
watch:
desc: Watch and auto-reload on changes
cmds:
- cargo watch -x run
watch-test:
desc: Watch and run tests on changes
cmds:
- cargo watch -x test
audit:
desc: Check for security vulnerabilities
cmds:
- cargo audit
update:
desc: Update dependencies
cmds:
- cargo update
size:
desc: Show binary size
deps: [build]
cmds:
- ls -lh {{.BUILD_DIR}}/{{.BINARY_NAME}} | awk '{print "Binary size:", $5}'
- file {{.BUILD_DIR}}/{{.BINARY_NAME}}
bench:
desc: Run benchmarks (if any)
cmds:
- cargo bench
doc:
desc: Generate and open documentation
cmds:
- cargo doc --open --no-deps
tree:
desc: Show dependency tree
cmds:
- cargo tree
outdated:
desc: Check for outdated dependencies
cmds:
- cargo outdated
release:
desc: Prepare for release (check, build, test)
cmds:
- task: clean
- task: check
- task: build
- task: size
- echo "✅ Release build ready at {{.BUILD_DIR}}/{{.BINARY_NAME}}"
dev:
desc: Start development server with auto-reload
cmds:
- task: watch
start:
desc: Start the proxy server (release mode)
deps: [build]
cmds:
- |
if [ -z "$UPSTREAM_BASE_URL" ]; then
echo "⚠️ Error: UPSTREAM_BASE_URL is required"
echo "Set it with: export UPSTREAM_BASE_URL=https://openrouter.ai/api"
echo "Or OpenAI: export UPSTREAM_BASE_URL=https://api.openai.com"
echo "Or local: export UPSTREAM_BASE_URL=http://localhost:11434"
exit 1
fi
./{{.BUILD_DIR}}/{{.BINARY_NAME}}
help:
desc: Show help information
cmds:
- echo "anthropic-proxy-rs - Anthropic API to OpenAI proxy"
- echo ""
- echo "Common tasks:"
- echo " task build - Build release binary"
- echo " task install - Build and install to ~/.cargo/bin"
- echo " task run - Run in development mode"
- echo " task dev - Start with auto-reload"
- echo " task test - Run tests"
- echo " task check - Run all checks"
- echo " task clean - Clean build artifacts"
- echo ""
- echo "Environment variables:"
- echo " UPSTREAM_BASE_URL - Upstream endpoint URL (required)"
- echo " UPSTREAM_API_KEY - API key for upstream service"
- echo " PORT - Server port (default 3000)"
- echo " REASONING_MODEL - Override model for thinking mode"
- echo " COMPLETION_MODEL - Override model for standard mode"
- echo " DEBUG - Enable debug logging (1 or true)"