From cebabcef690361028fef92c9d7cff2e2dd4079f3 Mon Sep 17 00:00:00 2001 From: Yash Dhawan Date: Thu, 14 May 2026 01:44:36 +0530 Subject: [PATCH] Add community files and extract proxy port constants - Extract hardcoded proxy ports into named constants in config.go: DefaultForwardProxyPort (:8080) and DefaultTransparentProxyPort (:8081). Replace all hardcoded occurrences with these constants. - Add CONTRIBUTING.md covering dev setup, running tests, branch/PR conventions, and code style guidelines. - Add .github/PULL_REQUEST_TEMPLATE.md with description, linked issue, testing done, and a pre-submit checklist. - Add .github/ISSUE_TEMPLATE/feature_request.yml with structured fields for problem, proposed solution, alternatives, and context. Closes #433, #424, #425, #426 --- .github/ISSUE_TEMPLATE/feature_request.yml | 45 +++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 22 +++++++ CONTRIBUTING.md | 77 ++++++++++++++++++++++ src/backend/config/config.go | 10 ++- src/backend/server/server.go | 2 +- 5 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 CONTRIBUTING.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..06713d7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,45 @@ +name: Feature Request +description: Suggest a new feature or enhancement for kiji-proxy +title: "[Feature]: " +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to suggest an improvement! Please fill out the sections below as clearly as you can. + + - type: textarea + id: problem + attributes: + label: Problem + description: What problem or limitation are you running into? Why does it matter? + placeholder: "e.g. I often need to X, but currently the only way to do it is Y, which is tedious because..." + validations: + required: true + + - type: textarea + id: proposed-solution + attributes: + label: Proposed Solution + description: Describe the feature or change you'd like to see. + placeholder: "e.g. Add a config option that allows..." + validations: + required: true + + - type: textarea + id: alternatives + attributes: + label: Alternatives Considered + description: Have you tried any workarounds or considered other approaches? + placeholder: "e.g. I tried X but it doesn't work because..." + validations: + required: false + + - type: textarea + id: context + attributes: + label: Additional Context + description: Any other context, screenshots, or references that might help. + placeholder: "Links, related issues, example configs, etc." + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8bf73f3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,22 @@ +## Description + + + +## Linked Issue + +Closes # + +## Testing Done + + + +- [ ] Unit tests pass (`go test ./...` / `npm test`) +- [ ] Manually verified the change works as expected + +## Checklist + +- [ ] Code follows the project's style guidelines (`gofmt`, `go vet`, linting) +- [ ] New or updated tests cover the changes (if applicable) +- [ ] Documentation has been updated (if applicable) +- [ ] No unrelated changes are included in this PR +- [ ] PR title is descriptive and references the issue where relevant diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1a7d20c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contributing to kiji-proxy + +Thanks for your interest in contributing. This document covers how to get set up, run tests, and submit changes. + +## Dev Setup + +**Prerequisites:** Go 1.21+, Node.js 18+, make (optional but handy). + +```bash +# Clone your fork +git clone https://github.com//kiji-proxy.git +cd kiji-proxy + +# Install backend dependencies +cd src/backend && go mod download + +# Install frontend dependencies +cd ../../src/frontend && npm install +``` + +Copy and edit the development config before running: + +```bash +cp src/backend/config/config.development.json config.json +# Edit config.json with your API keys / settings +``` + +Start the backend: + +```bash +go run ./src/backend/cmd/... +``` + +Start the frontend (separate terminal): + +```bash +cd src/frontend && npm run dev +``` + +## Running Tests + +```bash +# Backend unit tests +cd src/backend && go test ./... + +# Backend tests with race detector +go test -race ./... + +# Frontend tests +cd src/frontend && npm test +``` + +## Branching & PR Conventions + +- Branch off `main`. Use short, descriptive names: + - `feat/` for new features + - `fix/` for bug fixes + - `docs/` for documentation-only changes +- Keep commits focused; one logical change per commit. +- Reference the issue your PR addresses with `Closes #` in the PR description. +- All CI checks must pass before a PR is merged. +- PRs require at least one approving review. + +## Code Style + +**Go:** +- Run `gofmt -w .` and `go vet ./...` before committing. +- Follow standard Go naming conventions. +- Add comments for exported types, functions, and constants. + +**TypeScript / Frontend:** +- Run `npm run lint` before committing. +- Prefer explicit types over `any`. + +## Reporting Issues + +Use the GitHub issue tracker. Please search for existing issues before opening a new one. Include reproduction steps, expected vs. actual behavior, and relevant logs. diff --git a/src/backend/config/config.go b/src/backend/config/config.go index 9115d17..bc4932e 100644 --- a/src/backend/config/config.go +++ b/src/backend/config/config.go @@ -73,6 +73,12 @@ type Config struct { Proxy ProxyConfig `json:"Proxy"` } +// DefaultForwardProxyPort is the default port for the forward (HTTP) proxy. +const DefaultForwardProxyPort = ":8080" + +// DefaultTransparentProxyPort is the default port for the transparent proxy. +const DefaultTransparentProxyPort = ":8081" + // ModelVariantTrained is the full-precision model variant. const ModelVariantTrained = "trained" @@ -242,7 +248,7 @@ func DefaultConfig() *Config { MistralProviderConfig: defaultMistralProviderConfig, CustomProviderConfig: defaultCustomProviderConfig, }, - ProxyPort: ":8080", + ProxyPort: DefaultForwardProxyPort, ONNXModelPath: "", TokenizerPath: "", ModelVariant: ModelVariantTrained, @@ -261,7 +267,7 @@ func DefaultConfig() *Config { }, Proxy: ProxyConfig{ TransparentEnabled: true, - ProxyPort: ":8081", + ProxyPort: DefaultTransparentProxyPort, CAPath: caPath, KeyPath: keyPath, EnablePAC: true, // Enable PAC by default for automatic proxy configuration diff --git a/src/backend/server/server.go b/src/backend/server/server.go index ba1cec0..25ba419 100644 --- a/src/backend/server/server.go +++ b/src/backend/server/server.go @@ -307,7 +307,7 @@ func (s *Server) Start() error { func (s *Server) startTransparentProxy() { proxyPort := s.config.Proxy.ProxyPort if proxyPort == "" { - proxyPort = ":8080" + proxyPort = config.DefaultForwardProxyPort } log.Printf("Starting transparent proxy on port %s", proxyPort)