Skip to content

Commit b633a70

Browse files
authored
Merge pull request #32 from CaddyGlow/dev/v0.2
Dev/v0.2
2 parents a3107c2 + 5174b1a commit b633a70

File tree

789 files changed

+129579
-50566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

789 files changed

+129579
-50566
lines changed

.env.example

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ ANTHROPIC_API_KEY=your_anthropic_api_key_here
66
# Optional: Server Configuration
77
HOST=0.0.0.0
88
PORT=8000
9-
LOG_LEVEL=INFO
9+
10+
# Optional: Logging Configuration (centralized)
11+
LOGGING__LEVEL=INFO
12+
LOGGING__FORMAT=auto
13+
LOGGING__FILE=/tmp/ccproxy/ccproxy.log
14+
LOGGING__VERBOSE_API=false
15+
LOGGING__PLUGIN_LOG_BASE_DIR=/tmp/ccproxy
1016

1117
# Optional: Security Configuration
1218
CLAUDE_USER=claude
@@ -27,5 +33,6 @@ RATE_LIMIT_WINDOW=60
2733
# Optional: Request Timeout
2834
REQUEST_TIMEOUT=300
2935

30-
# Optional: CORS Origins (comma-separated)
31-
CORS_ORIGINS=*
36+
# Optional: CORS Origins (comma-separated, avoid using '*' for security)
37+
# Examples: http://localhost:3000,https://app.example.com
38+
CORS_ORIGINS=http://localhost:3000,http://localhost:8080,http://127.0.0.1:3000,http://127.0.0.1:8080

.github/workflows/backend.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- "tests/**"
99
- "pyproject.toml"
1010
- "uv.lock"
11-
- "Makefile"
11+
- "Taskfile"
1212
- ".github/workflows/backend.yml"
1313
pull_request:
1414
branches: [main, dev]
@@ -17,7 +17,7 @@ on:
1717
- "tests/**"
1818
- "pyproject.toml"
1919
- "uv.lock"
20-
- "Makefile"
20+
- "Taskfile"
2121
- ".github/workflows/backend.yml"
2222
workflow_dispatch:
2323

@@ -39,7 +39,7 @@ jobs:
3939
run: uv python install
4040

4141
- name: Install dependencies
42-
run: make dev-install
42+
run: ./Taskfile dev-install
4343

4444
- name: Cache mypy
4545
uses: actions/cache@v4
@@ -50,7 +50,7 @@ jobs:
5050
mypy-${{ runner.os }}-
5151
5252
- name: Run quality checks
53-
run: make check
53+
run: ./Taskfile check
5454

5555
tests:
5656
runs-on: ubuntu-latest
@@ -74,10 +74,10 @@ jobs:
7474
run: uv python install ${{ matrix.python-version }}
7575

7676
- name: Install dependencies
77-
run: make dev-install
77+
run: ./Taskfile dev-install
7878

7979
- name: Run unit tests
80-
run: make test-unit
80+
run: ./Taskfile test-unit
8181

8282
- name: Upload coverage reports
8383
if: matrix.python-version == '3.11'
@@ -106,10 +106,10 @@ jobs:
106106
run: uv python install
107107

108108
- name: Install dependencies
109-
run: make dev-install
109+
run: ./Taskfile dev-install
110110

111111
- name: Test package build
112-
run: make build-backend
112+
run: ./Taskfile build-backend
113113

114114
- name: Verify CLI installation
115115
run: |

.github/workflows/ci.yml

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,53 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, develop]
5+
branches: [main, dev]
66
pull_request:
7-
branches: [main, develop]
7+
branches: [main, dev]
88

99
jobs:
10-
test:
10+
lint:
11+
name: Lint (ruff)
1112
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
python-version: ["3.11", "3.12", "3.13"]
15-
1613
steps:
1714
- uses: actions/checkout@v4
18-
19-
- uses: oven-sh/setup-bun@v2
20-
21-
- name: Install uv
22-
uses: astral-sh/setup-uv@v3
15+
- uses: astral-sh/setup-uv@v4
2316
with:
2417
enable-cache: true
25-
26-
- name: Set up Python ${{ matrix.python-version }}
27-
run: uv python install ${{ matrix.python-version }}
28-
29-
- name: Install dependencies
30-
run: make dev-install
31-
32-
- name: Run CI pipeline
33-
run: make ci
34-
35-
- name: Build documentation
36-
run: make docs-build
37-
38-
- name: Upload coverage reports
39-
uses: codecov/codecov-action@v4
18+
- name: Set up Python
19+
run: uv python install
20+
- name: Install deps
21+
run: ./Taskfile dev-install
22+
- name: Ruff check
23+
run: ./Taskfile lint
24+
25+
typecheck:
26+
name: Typecheck (mypy)
27+
runs-on: ubuntu-latest
28+
continue-on-error: true
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: astral-sh/setup-uv@v4
32+
with:
33+
enable-cache: true
34+
- name: Set up Python
35+
run: uv python install
36+
- name: Install deps
37+
run: ./Taskfile dev-install
38+
- name: mypy
39+
run: ./Taskfile typecheck
40+
41+
tests:
42+
name: Unit Tests
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- uses: astral-sh/setup-uv@v4
4047
with:
41-
file: ./coverage.xml
42-
flags: unittests
43-
name: codecov-umbrella
44-
fail_ci_if_error: false
48+
enable-cache: true
49+
- name: Set up Python
50+
run: uv python install
51+
- name: Install deps
52+
run: ./Taskfile dev-install
53+
- name: Run unit tests (no network)
54+
run: ./Taskfile test-unit

.github/workflows/packages.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build Distribution Packages
2+
3+
on:
4+
# Trigger after Python CI workflow completes successfully and releases are created
5+
workflow_run:
6+
workflows: ["Python CI"]
7+
types:
8+
- completed
9+
branches:
10+
- main
11+
12+
# Allow manual triggering
13+
workflow_dispatch:
14+
inputs:
15+
version:
16+
description: 'Version to build (without v prefix, e.g., 0.1.4)'
17+
required: true
18+
type: string
19+
20+
permissions:
21+
contents: write
22+
23+
jobs:
24+
# Build Alpine Linux packages (.apk for x86_64 and aarch64)
25+
alpine:
26+
# Only run if CI completed successfully and was triggered by a tag push
27+
if: |
28+
github.event_name == 'workflow_dispatch' ||
29+
(github.event.workflow_run.conclusion == 'success' &&
30+
startsWith(github.event.workflow_run.head_branch, 'v'))
31+
uses: CaddyGlow/homebrew-packages/.github/workflows/package-alpine.yml@main
32+
permissions:
33+
contents: write
34+
with:
35+
tool: ccproxy
36+
version: ${{ github.event.inputs.version || github.event.workflow_run.head_branch }}
37+
repository: ${{ github.repository }}
38+
release_tag: ${{ github.event.inputs.version && format('v{0}', github.event.inputs.version) || github.event.workflow_run.head_branch }}
39+
40+
# Build Debian/Ubuntu packages (.deb for amd64 and arm64)
41+
debian:
42+
if: |
43+
github.event_name == 'workflow_dispatch' ||
44+
(github.event.workflow_run.conclusion == 'success' &&
45+
startsWith(github.event.workflow_run.head_branch, 'v'))
46+
uses: CaddyGlow/homebrew-packages/.github/workflows/package-debian.yml@main
47+
permissions:
48+
contents: write
49+
with:
50+
tool: ccproxy
51+
version: ${{ github.event.inputs.version || github.event.workflow_run.head_branch }}
52+
repository: ${{ github.repository }}
53+
release_tag: ${{ github.event.inputs.version && format('v{0}', github.event.inputs.version) || github.event.workflow_run.head_branch }}
54+
55+
# Build Termux/Android packages (.deb for android-aarch64)
56+
termux:
57+
if: |
58+
github.event_name == 'workflow_dispatch' ||
59+
(github.event.workflow_run.conclusion == 'success' &&
60+
startsWith(github.event.workflow_run.head_branch, 'v'))
61+
uses: CaddyGlow/homebrew-packages/.github/workflows/package-termux.yml@main
62+
permissions:
63+
contents: write
64+
with:
65+
tool: ccproxy
66+
version: ${{ github.event.inputs.version || github.event.workflow_run.head_branch }}
67+
repository: ${{ github.repository }}
68+
release_tag: ${{ github.event.inputs.version && format('v{0}', github.event.inputs.version) || github.event.workflow_run.head_branch }}

.github/workflows/python-ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "dev", "dev/**" ]
6+
tags: [ "v*" ]
7+
pull_request:
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
description: 'Git ref (branch, tag, or SHA) to build'
12+
required: false
13+
type: string
14+
default: ''
15+
target_preset:
16+
description: 'Target preset to build'
17+
required: false
18+
type: choice
19+
options:
20+
- all
21+
- windows
22+
- linux
23+
- macos
24+
default: 'all'
25+
skip_tests:
26+
description: 'Skip tests'
27+
required: false
28+
type: boolean
29+
default: false
30+
31+
permissions:
32+
contents: write
33+
34+
jobs:
35+
test:
36+
if: ${{ !inputs.skip_tests && github.event_name != 'push' || github.ref_type != 'tag' }}
37+
uses: CaddyGlow/homebrew-packages/.github/workflows/python-test.yml@main
38+
with:
39+
ref: ${{ inputs.ref || '' }}
40+
python_version: '3.11'
41+
42+
build:
43+
needs: [test]
44+
if: |
45+
always() &&
46+
!cancelled() &&
47+
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
48+
(startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch')
49+
uses: CaddyGlow/homebrew-packages/.github/workflows/python-build.yml@main
50+
with:
51+
ref: ${{ inputs.ref || '' }}
52+
binary_name: ccproxy
53+
entry_point: 'ccproxy.cli.main:main'
54+
assets: '["README.md", "LICENSE"]'
55+
target_preset: ${{ inputs.target_preset || 'all' }}
56+
python_version: '3.11'
57+
58+
release:
59+
needs: [build]
60+
if: |
61+
always() &&
62+
!cancelled() &&
63+
needs.build.result == 'success' &&
64+
(startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && startsWith(inputs.ref, 'v')))
65+
uses: CaddyGlow/homebrew-packages/.github/workflows/python-release.yml@main
66+
with:
67+
ref: ${{ inputs.ref || '' }}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Create Release from Workflow Run
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
run_id:
7+
description: 'Workflow run ID to get artifacts from (check Actions tab)'
8+
required: true
9+
type: string
10+
tag:
11+
description: 'Tag name for the release (e.g., v0.1.3)'
12+
required: true
13+
type: string
14+
draft:
15+
description: 'Create as draft release'
16+
required: false
17+
type: boolean
18+
default: false
19+
prerelease:
20+
description: 'Mark as pre-release'
21+
required: false
22+
type: boolean
23+
default: false
24+
25+
permissions:
26+
contents: write
27+
28+
jobs:
29+
release:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Download artifacts from run
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
echo "Downloading artifacts from run ${{ inputs.run_id }}..."
37+
gh run download ${{ inputs.run_id }} --repo ${{ github.repository }} --dir artifacts
38+
39+
echo "Downloaded artifacts:"
40+
ls -R artifacts/
41+
42+
- name: Create GitHub release
43+
uses: softprops/action-gh-release@v2
44+
with:
45+
tag_name: ${{ inputs.tag }}
46+
files: artifacts/**/*
47+
draft: ${{ inputs.draft }}
48+
prerelease: ${{ inputs.prerelease }}
49+
generate_release_notes: true
50+
make_latest: true
51+
fail_on_unmatched_files: false
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
55+
- name: Summary
56+
run: |
57+
echo "Release created/updated for tag: ${{ inputs.tag }}"
58+
echo "Artifacts from run: ${{ inputs.run_id }}"
59+
echo "View release: https://github.com/${{ github.repository }}/releases/tag/${{ inputs.tag }}"

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: uv python install 3.12
3131

3232
- name: Install dependencies
33-
run: make dev-install
33+
run: make dev_install
3434

3535
- name: Run tests
3636
run: make ci

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,8 @@ ccproxy/static/dashboard/
163163

164164
*.wal
165165
*.duckdb
166+
.lazy.lua
167+
.ccproxy.toml
168+
169+
make
170+
run

0 commit comments

Comments
 (0)