|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for helping improve the Qoder Agent SDK samples. This repository is a set |
| 4 | +of focused, runnable examples, so contributions are judged first on clarity: a |
| 5 | +reader should be able to open one sample and understand a single SDK concept. |
| 6 | + |
| 7 | +## Ways to contribute |
| 8 | + |
| 9 | +- **Report a problem.** Open an issue if a sample fails to run, is unclear, or |
| 10 | + drifts from current SDK behavior. Include the sample, language, SDK version, |
| 11 | + and the exact command and output. |
| 12 | +- **Improve docs.** Fix or clarify READMEs, comments, and diagrams. |
| 13 | +- **Add a new sample.** New samples are welcome. Please open an issue first to |
| 14 | + agree on the concept and scope before writing code, so your effort lands. |
| 15 | + |
| 16 | +Issues about the SDK itself (rather than these samples) belong in the |
| 17 | +[Qoder Agent SDK documentation](https://docs.qoder.com/en/cli/sdk) channels, not |
| 18 | +this repository. |
| 19 | + |
| 20 | +## Development setup |
| 21 | + |
| 22 | +- TypeScript: Node.js 18 or later. From `typescript/`, run `npm install` to |
| 23 | + install every sample workspace, then `npm start` inside a sample directory. |
| 24 | +- Python: Python 3.10 or later. Each sample runs from its own virtual |
| 25 | + environment (see the sample README). Maintainer checks use |
| 26 | + [`uv`](https://docs.astral.sh/uv/); contributors do not need `uv` to run a |
| 27 | + sample. |
| 28 | + |
| 29 | +## Sample requirements |
| 30 | + |
| 31 | +Every sample must: |
| 32 | + |
| 33 | +- Demonstrate one primary SDK concept. |
| 34 | +- Ship in both TypeScript and Python with equivalent behavior. |
| 35 | +- Use only public exports from the released SDK package. |
| 36 | +- Use a documented SDK authentication helper and never hard-code credentials. |
| 37 | +- Never log credentials or accept them as command-line arguments. |
| 38 | +- Default to the smallest practical tool set and permission scope. |
| 39 | +- Include a README with prerequisites, setup, run commands, and safety notes. |
| 40 | +- Avoid shared source modules that hide the SDK calls being demonstrated. |
| 41 | +- Keep generated files and expected model output out of the sample directory. |
| 42 | + |
| 43 | +## Adding a new sample |
| 44 | + |
| 45 | +Use an existing sample (for example, `quickstart`) as a template, then register |
| 46 | +the new sample everywhere it needs to appear. Replace `<sample>` with your |
| 47 | +kebab-case sample name. |
| 48 | + |
| 49 | +1. **Create the TypeScript sample** at `typescript/<sample>/` with `index.ts`, |
| 50 | + `README.md`, and `package.json`. Copy `package.json` from an existing sample |
| 51 | + and update the `name` field to `@qoder-samples/typescript-<sample>`. |
| 52 | +2. **Create the Python sample** at `python/<sample>/` with `main.py`, |
| 53 | + `README.md`, and `requirements.txt`. |
| 54 | +3. **Register the TypeScript workspace:** add `<sample>` to the `workspaces` |
| 55 | + array in `typescript/package.json`. |
| 56 | +4. **Register the Python type check:** add `<sample>` to the `for sample in ...` |
| 57 | + loop in `.github/workflows/ci.yml` and to the matching loop in this file. |
| 58 | +5. **List it in both READMEs:** add a row to the sample table in `README.md` and |
| 59 | + in `README.zh-CN.md`. |
| 60 | + |
| 61 | +Keep the TypeScript and Python versions behaviorally equivalent so readers can |
| 62 | +switch between languages. |
| 63 | + |
| 64 | +## Running the checks |
| 65 | + |
| 66 | +Run the same checks CI runs, and make sure they pass before opening a pull |
| 67 | +request: |
| 68 | + |
| 69 | +```bash |
| 70 | +cd typescript && npm ci && npm run check --workspaces |
| 71 | +cd ../python && uv sync && uv run ruff check . && uv run ruff format --check . |
| 72 | +for sample in quickstart multi-turn-conversation streaming-chat code-review tool-permissions ask-user-question model-selection hooks custom-tools subagents; do |
| 73 | + uv run mypy "$sample/main.py" |
| 74 | +done |
| 75 | +``` |
| 76 | + |
| 77 | +If `ruff format --check` reports changes, run `uv run ruff format .` to apply |
| 78 | +them. |
| 79 | + |
| 80 | +## Pull requests |
| 81 | + |
| 82 | +- Keep each pull request focused on one sample or one concern. |
| 83 | +- Explain what the sample demonstrates and how you verified it. |
| 84 | +- Ensure CI is green; pull requests are not merged with failing checks. |
| 85 | + |
| 86 | +## Contributor terms |
| 87 | + |
| 88 | +By submitting a pull request, you agree that your contribution is provided under |
| 89 | +the repository's [MIT License](LICENSE) and that you have the right to submit it. |
0 commit comments