From 315579e8da06feaef8a98ae4e28244281cdcb193 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:53:23 +0000 Subject: [PATCH 001/109] Create sweep.yaml --- sweep.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 sweep.yaml diff --git a/sweep.yaml b/sweep.yaml new file mode 100644 index 0000000..ada0e25 --- /dev/null +++ b/sweep.yaml @@ -0,0 +1,42 @@ +# Sweep AI turns bugs & feature requests into code changes (https://sweep.dev) +# For details on our config file, check out our docs at https://docs.sweep.dev/usage/config + +# This setting contains a list of rules that Sweep will check for. If any of these rules are broken in a new commit, Sweep will create an pull request to fix the broken rule. +rules: + - "All docstrings and comments should be up to date." +['All new business logic should have corresponding unit tests.', 'Refactor large functions to be more modular.', 'Add docstrings to all functions and file headers.'] + +# This is the branch that Sweep will develop from and make pull requests to. Most people use 'main' or 'master' but some users also use 'dev' or 'staging'. +branch: 'main' + +# By default Sweep will read the logs and outputs from your existing Github Actions. To disable this, set this to false. +gha_enabled: True + +# This is the description of your project. It will be used by sweep when creating PRs. You can tell Sweep what's unique about your project, what frameworks you use, or anything else you want. +# +# Example: +# +# description: sweepai/sweep is a python project. The main api endpoints are in sweepai/api.py. Write code that adheres to PEP8. +description: '' + +# This sets whether to create pull requests as drafts. If this is set to True, then all pull requests will be created as drafts and GitHub Actions will not be triggered. +draft: False + +# This is a list of directories that Sweep will not be able to edit. +blocked_dirs: [] + +# This is a list of documentation links that Sweep will use to help it understand your code. You can add links to documentation for any packages you use here. +# +# Example: +# +# docs: +# - PyGitHub: ["https://pygithub.readthedocs.io/en/latest/", "We use pygithub to interact with the GitHub API"] +docs: [] + +# Sandbox executes commands in a sandboxed environment to validate code changes after every edit to guarantee pristine code. For more details, see the [Sandbox](./sandbox) page. +sandbox: + install: + - trunk init + check: + - trunk fmt {file_path} || return 0 + - trunk check --fix --print-failures {file_path} From 6e699c7f72bc47a8a0f33ed9a3d3118918ee254e Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Sat, 18 Nov 2023 20:53:24 +0000 Subject: [PATCH 002/109] Create sweep template --- .github/ISSUE_TEMPLATE/sweep-template.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/sweep-template.yml diff --git a/.github/ISSUE_TEMPLATE/sweep-template.yml b/.github/ISSUE_TEMPLATE/sweep-template.yml new file mode 100644 index 0000000..44116f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/sweep-template.yml @@ -0,0 +1,15 @@ +name: Sweep Issue +title: 'Sweep: ' +description: For small bugs, features, refactors, and tests to be handled by Sweep, an AI-powered junior developer. +labels: sweep +body: + - type: textarea + id: description + attributes: + label: Details + description: Tell Sweep where and what to edit and provide enough context for a new developer to the codebase + placeholder: | + Unit Tests: Write unit tests for . Test each function in the file. Make sure to test edge cases. + Bugs: The bug might be in . Here are the logs: ... + Features: the new endpoint should use the ... class from because it contains ... logic. + Refactors: We are migrating this function to ... version because ... \ No newline at end of file From 2b3b3f4d4429c7e4bdf48dbb098391c9a484cb9d Mon Sep 17 00:00:00 2001 From: samya123456 Date: Mon, 20 Nov 2023 18:31:00 +0530 Subject: [PATCH 003/109] adding some git ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 39aee32..1ea457d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ # Run logs backend/run_logs/* - +backend/backend/* +frontend/.env.local .env \ No newline at end of file From 9dfdc8683d114d09d69b84ae5b9a8e823ce0bd0e Mon Sep 17 00:00:00 2001 From: clean99 Date: Tue, 21 Nov 2023 09:23:07 +0800 Subject: [PATCH 004/109] fix: prevent flashing when updating code --- frontend/src/components/Preview.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Preview.tsx b/frontend/src/components/Preview.tsx index de0134f..3a603ff 100644 --- a/frontend/src/components/Preview.tsx +++ b/frontend/src/components/Preview.tsx @@ -1,3 +1,4 @@ +import { useEffect, useRef } from 'react'; import classNames from "classnames"; import useThrottle from "../hooks/useThrottle"; @@ -8,12 +9,22 @@ interface Props { function Preview({ code, device }: Props) { const throttledCode = useThrottle(code, 200); + const iframeRef = useRef(null); + + useEffect(() => { + const iframe = iframeRef.current; + if (iframe && iframe.contentDocument) { + iframe.contentDocument.open(); + iframe.contentDocument.write(throttledCode); + iframe.contentDocument.close(); + } + }, [throttledCode]); return (