-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
docs: add pre-commit setup guide to AGENTS.md #7838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,26 @@ pnpm dev | |
|
|
||
| Runs on `http://localhost:3000` by default. | ||
|
|
||
| ## Pre-commit setup | ||
|
|
||
| AstrBot uses [pre-commit](https://pre-commit.com/) hooks to automatically format and lint Python code before each commit. The hooks run `ruff check`, `ruff format`, and `pyupgrade` (see [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for details). | ||
|
|
||
| To set it up: | ||
|
|
||
| ```bash | ||
| pip install pre-commit | ||
| pre-commit install | ||
| ``` | ||
|
|
||
| After installation, the hooks will run automatically on `git commit`. You can also run them manually at any time: | ||
|
|
||
| ```bash | ||
| ruff format . | ||
| ruff check . | ||
|
Comment on lines
+36
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ``` | ||
|
|
||
| > **Note:** If you use VSCode, install the `Ruff` extension for real-time formatting and linting in the editor. | ||
|
|
||
| ## Dev environment tips | ||
|
|
||
| 1. When modifying the WebUI, be sure to maintain componentization and clean code. Avoid duplicate code. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,7 +141,7 @@ const getRowProps = ({ item }: { item: CommandItem }) => { | |
| </template> | ||
|
|
||
| <template v-slot:item.description="{ item }"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="item.description"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vuetify provides a utility class References
|
||
| {{ item.description || '-' }} | ||
| </div> | ||
| </template> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -121,7 +121,7 @@ const enabledConfigTags = (tool: ToolItem): BuiltinToolConfigTag[] => { | |
| </template> | ||
|
|
||
| <template #item.description="{ item }"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="item.description"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using the Vuetify utility class References
|
||
| {{ item.description || '-' }} | ||
| </div> | ||
| </template> | ||
|
|
@@ -133,7 +133,7 @@ const enabledConfigTags = (tool: ToolItem): BuiltinToolConfigTag[] => { | |
| </template> | ||
|
|
||
| <template #item.origin_name="{ item }"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | ||
| <div class="text-body-2 text-medium-emphasis" style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="item.origin_name"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using the Vuetify utility class References
|
||
| {{ item.origin_name || '-' }} | ||
| </div> | ||
| </template> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the project uses
uvfor environment management (as seen in the Setup commands section), it is more consistent to useuvfor tool installation. This ensures that tools are managed in a way that's compatible with the rest of the setup and avoids potential conflicts with system-widepipinstallations.