Skip to content

Commit 73a93bd

Browse files
committed
expand out contributing doc
1 parent 66dbad6 commit 73a93bd

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

CONTRIBUTING.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to SwarmUI
22

3-
Please open an Issue or Discussion, or ask on [Discord](https://discord.gg/q2y38cqjNw) before opening a pull request, to make sure your work doesn't overlap with others.
3+
Please open an Issue or Discussion, or ask on [Discord](https://discord.gg/q2y38cqjNw) before opening a pull request, to make sure your work doesn't overlap with others, and to ensure you don't spend time working on an idea that doesn't make sense or can't be pulled.
44

55
(TODO: More general contributing info)
66

@@ -10,6 +10,44 @@ Want to make something out of scope for Swarm's core systems? Make an extension!
1010

1111
If your extension is ready to go, post it in the `#extensions` channel on Discord, and open a pull request adding it to the file `launchtools/extension_list.fds`
1212

13+
## Pull Requests
14+
15+
Pull Requests (PRs) on GitHub are how you submit changes to the core codebase.
16+
17+
When writing a pull request, you are expected:
18+
- To follow language-specific format guidelines (see below sections)
19+
- To fit the style and design of the project
20+
- To have discussed your PR in advance (GitHub issue, or Discord) before making it
21+
- To explain your PR when submitting it in the OP (doesn't have to be long, just has to be reasonably clear enough to figure out what's going on)
22+
- To be able and willing to answer questions regarding your code, or make changes if/when needed.
23+
- ie, you must actually understand your own work. If an LLM wrote it for you and you don't understand it, do not try to PR it.
24+
- To have tested your own work prior to submitting.
25+
26+
## C#
27+
28+
Contributing to the C# server code, or writing an extension? I recommend Visual Studio 2022 as the optimal IDE for this. Follow standard C# formatting rules. Look at existing code if in doubt. We use a modern C# Syntax.
29+
30+
All functions, fields, properties, should have `///` XML doc comments.
31+
32+
## JavaScript
33+
34+
Contributing to the JS webcode, or writing an extension that uses it? Use any editor of your choice, VS Code is sufficient. Follow mostly the standard JS formatting rules, but look at the existing code. Notable deviations from norm include:
35+
- always `let` never `const`
36+
- when all else is equal, stick to simpler syntax. For example use `==` unless `===` is logically required. Stick to standard `for (...)` instead of `arr.forEach`, etc.
37+
- `async` block usage is WIP, I want to transition Swarm to use those but there's a lot of callback-based code (sorry I just hadn't realized `async` was well-supported in browsers now when I started work on Swarm, this one's my fault - mcmonkey)
38+
39+
A lot of JS code was written as a quick in-file dump (I focused a lot more on C# quality than JS quality when the project was young). Work is progressing on moving it over to class-based systems. After it's all class based, I'd like to enable `'use strict'` and `import`. Possibly an upgrade to typescript after that.
40+
41+
All code under the class-based systems should have `/**` doc comments atop classes and functions.
42+
43+
For the most part, when contributing, simply match the style of the area you're in.
44+
45+
## Python
46+
47+
Contributing to the Python code? Use any editor of your choice, VS Code is sufficient. Follow standard python rules, and for any deviations generally follow comfy rules.
48+
49+
Writing an extension with custom python? If it's comfy nodes, consider writing it in a way that allows it to be imported to regular comfy installs too, and write according to comfy standards.
50+
1351
## Languages
1452

1553
Want to help translate Swarm into another language?
@@ -39,6 +77,18 @@ Want to add a new theme or change an existing one?
3977
- All new themes should use `modern.css` as the first stylesheet entry. Themes not built atop `modern.css` will not be accepted to the core.
4078
- Themes should ideally be added to Install page, but not strictly required.
4179

80+
## LLM-Written Code
81+
82+
This is an AI project, so obviously we don't hate AI here. However, we also understand its limitations well, so we ask that you are reasonable about using of AI language models:
83+
- "Intelligent autocomplete" tools (Copilot, Cursor, etc.) are completely fine.
84+
- Asking a chatbot for tips or methods to use is fine. Double-check the accuracy of anything it claims before doing it.
85+
- "Hey ChatGPT write this code for me" or similar, is not okay.
86+
- Broadly, make your own decisions about what to write and how to write it. The LLM can replace the keyboard clacking, and it can help you recall specific functions, but they tend to be quite bad at larger scale planning.
87+
- You are expected to understand every line of your own code submission. You may even be asked during PR review.
88+
- Especially double check that any LLM written code both (1) followed the usual formatting rules and (2) used relevant functions.
89+
- LLMs will often write to much older standards of the language, and will be unaware that there are 'proper' functions in the local context, eg an LLM writing JS might try to use `fetch` (JS API) instead of the proper `genericRequest` (Swarm site.js)
90+
- You are expected to have tested your own contribution, obviously. If you submit non-functional LLM-written code you may be barred permanently from further contributions, as a spammer.
91+
4292
# Legal
4393

4494
By submitting a contribution to this repo, you agree to grant a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license to Alex "mcmonkey" Goodwin to use, copy, modify, and distribute your contribution under the terms of the MIT License, view [LICENSE.txt](/LICENSE.txt) for details, and under any future license we may change to.

0 commit comments

Comments
 (0)