chore: update formatting script#101
Open
christianalfoni wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces repo-wide, CI-enforced formatting via a single format.sh script, and applies the resulting mass-formatting changes across the TypeScript, Python, CLI, docs, and OpenAPI spec files.
Changes:
- Add
format.shplus Prettier/Ruff configuration and update CI to block PRs on formatting drift. - Add root Prettier devDependency and ignore rules; add Ruff formatting config to Python
pyproject.toml. - Apply Prettier/Ruff formatting across existing TS/Python/JSON/MD/YAML files.
Reviewed changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| together-sandbox-typescript/tests/utils.test.ts | Prettier reflow in test expectations. |
| together-sandbox-typescript/src/utils.ts | Prettier reflow in utility functions/types. |
| together-sandbox-typescript/src/utils.test.ts | Prettier reflow across retry/callApi tests. |
| together-sandbox-typescript/src/types.ts | Prettier reflow in shared types. |
| together-sandbox-typescript/src/TogetherSandbox.ts | Prettier reflow in constructor logic. |
| together-sandbox-typescript/src/Snapshots.ts | Prettier reflow in imports/types/logic. |
| together-sandbox-typescript/src/Sandboxes.ts | Prettier reflow in imports/expressions/ctor call. |
| together-sandbox-typescript/src/Sandbox.ts | Prettier reflow in imports/method signatures/expressions. |
| together-sandbox-typescript/src/RemoteImageBuilder.ts | Prettier reflow in request and stream handling. |
| together-sandbox-typescript/src/lifecycle.ts | Prettier reflow in hint map and helpers. |
| together-sandbox-typescript/src/index.ts | Prettier reflow of exports. |
| together-sandbox-typescript/src/errors.ts | Prettier reflow of type guard signature. |
| together-sandbox-typescript/src/docker.ts | Prettier reflow in docker helper functions/errors. |
| together-sandbox-typescript/CLAUDE.md | Prettier reflow in docs snippet. |
| together-sandbox-python/together_sandbox/docker.py | Ruff format reflow in subprocess invocations/errors. |
| together-sandbox-python/together_sandbox/_utils.py | Ruff format reflow in retry utilities and hints. |
| together-sandbox-python/together_sandbox/_together_sandbox.py | Ruff format reflow in config validation error. |
| together-sandbox-python/together_sandbox/_streaming.py | Ruff format reflow in SSEEvent constructor. |
| together-sandbox-python/together_sandbox/_snapshots.py | Ruff format reflow in snapshot build/push logic. |
| together-sandbox-python/together_sandbox/_sandboxes.py | Ruff format reflow in request body construction. |
| together-sandbox-python/together_sandbox/_sandbox.py | Ruff format reflow in API call lambda. |
| together-sandbox-python/together_sandbox/_remote_image_builder.py | Ruff format reflow in SSE and client requests. |
| together-sandbox-python/together_sandbox/_lifecycle.py | Ruff format reflow in stop-reason hint map. |
| together-sandbox-python/tests/test_with_retry.py | Ruff format reflow in test call sites. |
| together-sandbox-python/tests/test_utils.py | Ruff format whitespace normalization. |
| together-sandbox-python/tests/test_call_api.py | Ruff format reflow in helpers/tests. |
| together-sandbox-python/tests/e2e/test_sandbox_execs.py | Ruff format reflow in e2e tests. |
| together-sandbox-python/tests/e2e/helpers.py | Ruff format reflow in timeout exception. |
| together-sandbox-python/pyproject.toml | Add Ruff formatting configuration. |
| together-sandbox-cli/src/utils/misc.ts | Prettier adds trailing comma / reflow. |
| together-sandbox-cli/src/commands/snapshots.ts | Prettier reflow in yargs command and error printing. |
| together-sandbox-cli/esbuild.cjs | Prettier reflow in alias path. |
| sandbox-openapi.json | Prettier reflow/minification of arrays. |
| api-openapi.json | Prettier reflow/minification of arrays/types. |
| docs/typescript-sdk.md | Prettier reflow in code examples/imports. |
| package.json | Add root Prettier devDependency. |
| package-lock.json | Lockfile updates to include Prettier and workspace metadata. |
| format.sh | New unified formatter (Prettier + Ruff) with venv bootstrap. |
| .prettierrc.json | New repo-wide Prettier configuration. |
| .prettierignore | New ignore rules for generated/large paths. |
| .gitignore | Ignore .venv-format/ bootstrap venv. |
| CLAUDE.md | Document formatting workflow and exclusions. |
| .github/workflows/pr-checks.yml | Add new blocking formatting CI job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mode="${1:-write}" | ||
| case "$mode" in | ||
| write) | ||
| npx prettier --write . |
| "$RUFF" format together-sandbox-python | ||
| ;; | ||
| check) | ||
| npx prettier --check . |
Comment on lines
+1
to
+2
| node_modules | ||
| **/dist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repo-wide formatting enforced by CI, with a single script for contributors
❌ Current behavior
No formatter is configured. TS/JS/Python files drift in style PR-to-PR and there's no automated check.
✅ New behavior
A single
format.shscript formats the whole repo. A blocking CI job runs the same script incheckmode on every PR.🤔 Assumptions
python3available (macOS ships it; CI provisions it viasetup-python)formatonly (no lint-fixing) for Python, double-quote style, line length 100src/api-clients/,together_sandbox/api/,together_sandbox/sandbox/, and SDK doc output directories must never be touched🧠 Decisions
pipx/brew install pre-commitrequiredformat.shfor Ruff — first run creates.venv-format/and pinsruff==0.15.15; nobrew install ruffor other manual setupnpm installat the repo root (already a workspace).prettierrc.json/.prettierignoreat repo root,[tool.ruff]block intogether-sandbox-python/pyproject.toml🔄 Discussions
Considered several approaches before landing on the current one:
.pre-commit-config.yaml) — initially drafted; rejected because it requires every contributor to installpipx/pre-commit, which is exactly the DX friction we wanted to avoidpre-commit.cihosted bot — best DX (auto-pushes fix commits to PRs) but felt like too much magic for v1brew install ruff— rejected after CI failure surfaced the same friction locally; replaced with the venv-bootstrap version offormat.shso neither CI nor contributors need to install Ruff out-of-band🧪 Testing
bash format.shran cleanly locally and produced the mass-format commit (958e80c)bash format.sh checkreturns 0 on the formatted treeformattingjob passes afterformat.shwas rewritten to bootstrap Ruff into.venv-format/(earlier revision failed withruff: command not found).venv-format/is gitignoredformat.shis committed with mode100755(executable, likegenerate.sh)📁 References