-
Notifications
You must be signed in to change notification settings - Fork 73
docs(agents): update agents with new features and more docs links #411
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
Draft
gabe565
wants to merge
1
commit into
main
Choose a base branch
from
update-agents
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,55 @@ | ||
| # AGENTS.md | ||
|
|
||
| ### 1. Creating a New App | ||
| - Use the command: | ||
| ```sh | ||
| pixlet create apps/<appname> | ||
| This repository contains Pixlet apps in the `apps/` directory. | ||
|
|
||
| ## 1. Creating a New App | ||
| Scaffold a new app: `pixlet create apps/<appname>` | ||
|
|
||
| ## 2. Code Quality | ||
| - `pixlet lint`: Checks for common issues and style problems. | ||
| - `pixlet check`: Validates correctness and best practices. | ||
| - `pixlet format`: Auto-formats code for consistency. | ||
|
|
||
| ## 3. Local Development Server | ||
| Run a live-reloading local server for rapid iteration: `pixlet serve apps/<appname>/<app_name>.star`. | ||
|
|
||
| ## 4. Previewing & Rendering | ||
| Generate a preview image before publishing: | ||
| ```sh | ||
| pixlet render --webp-level=9 apps/<appname>/<app_name>.star | ||
| # For 2x support preview: | ||
| pixlet render --2x --webp-level=9 apps/<appname>/<app_name>.star | ||
| ``` | ||
| Screenshot paths will be `apps/<appname>/<appname>.webp` and `apps/<appname>/<appname>@2x.webp`. | ||
|
|
||
| ## 5. Starlark Guidelines | ||
| - **No `try/catch`**: Starlark lacks exception handling. Use conditional checks instead. | ||
| - **Skipping Rendering**: Return an empty array (`return []`) in your main function to skip rendering for the current cycle (e.g., when data is unavailable). | ||
| - **Loading Local Files:** Load local assets directly into global variables using the `file` target. For example, this loads `apps/<appname>/images/example.png`: | ||
| ```starlark | ||
| load("images/example.png", EXAMPLE_IMAGE = "file") | ||
| ``` | ||
| This will scaffold a new app directly in the `apps` folder. Replace `<appname>` with your desired app name. | ||
|
|
||
| ### 2. Ensuring Code Quality | ||
| - Use the following commands to maintain high code quality: | ||
| - `pixlet lint` — Checks your app for common issues and style problems. | ||
| - `pixlet check` — Validates your app for correctness and best practices. | ||
| - `pixlet format` — Automatically formats your code for consistency. | ||
|
|
||
| ### 3. Previewing Your App | ||
| - Before publishing, generate a preview image: | ||
| ```sh | ||
| pixlet render apps/<appname>/<app_name>.star | ||
| ``` | ||
| This helps reviewers and users see what your app looks like. Replace `<appname>` and `<app_name>` as appropriate. | ||
|
|
||
| ### 4. Starlark Coding Guidelines | ||
| - **Do not use `try/catch`**: Starlark does not support exception handling with try/catch. Use conditional checks and error handling patterns supported by Starlark. | ||
|
|
||
| ### 5. Reference Documentation | ||
| - For available modules and APIs, consult: | ||
| - [Tidbyt Modules Reference](https://tidbyt.dev/docs/reference/modules) | ||
| - [Tidbyt Widgets Reference](https://tidbyt.dev/docs/reference/widgets) | ||
|
|
||
| These resources provide details on supported functions, widgets, and best practices for app development. | ||
|
|
||
|
|
||
| ### 6. Running a Local Server | ||
| - Use `pixlet serve` to run a local development server and preview your app live as you make changes. This is useful for rapid iteration and testing. | ||
| ```sh | ||
| pixlet serve apps/<appname>/<app_name>.star | ||
| ## 6. Configurations | ||
| Manage complex settings with a config file/schema. Pass configuration arguments via the CLI during development: | ||
| ```sh | ||
| pixlet render apps/<appname>/<app_name>.star key=value | ||
| ``` | ||
|
Comment on lines
+34
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. The 'Configurations' section is missing key guidelines from the repository style guide. Please expand this section to include the following points:
|
||
|
|
||
| ## 7. 2x Rendering Support | ||
| - 2x apps render at 128x64 instead of the standard 64x32. | ||
| - Check the `canvas` module: `canvas.size()` returns `(width, height)`; `canvas.width()`, `canvas.height()`, `canvas.is2x()`. | ||
| - **Common patterns:** | ||
| ```starlark | ||
| WIDTH, HEIGHT = canvas.size() | ||
| SCALE = 2 if canvas.is2x() else 1 | ||
| ``` | ||
| You can then view your app in a browser or compatible device. | ||
|
|
||
| ### 7. Using a Config File for Longer Configurations | ||
| - For apps with longer or more complex configurations, use a config file to manage settings. This keeps your code clean and makes it easier to update or share configurations. | ||
| - Reference your config file in your app as needed, following Pixlet and Starlark best practices. | ||
|
|
||
|
|
||
| ### 8. Skipping Rendering When Not Needed | ||
| - In your main app function, you can return an empty array (`return []`) to skip rendering for the current cycle. This is useful if your app should only display content when it's relevant or useful, such as hiding the screen when a device is offline or data is unavailable. | ||
|
|
||
| By following these steps, you can ensure your app is well-structured, high-quality, and ready for review or publication. Happy coding! | ||
| - Multiply/divide sizes by `SCALE` (use `//` or convert to `int`; floats are rejected). | ||
| - Default 1x font is `tb-8`; default 2x font is `terminus-16`. | ||
| - **Animations:** If using `render.Marquee`, halve the delay for 2x to maintain scroll speed. If halving the delay speeds up embedded `render.Image` animations, use the image's `hold_frames` parameter to slow it back down. | ||
|
|
||
| ## 8. Reference Documentation | ||
| - [Modules](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/modules.md) | [Widgets](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/widgets.md) | [Animation](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/animation.md) | [Schema](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/schema/schema.md) | [Filters](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/filters.md) | ||
| - **Fonts**: Run `pixlet community list-fonts` or view the [Fonts Reference](https://raw.githubusercontent.com/tronbyt/pixlet/refs/heads/main/docs/fonts.md). | ||
| - **Icons**: Run `pixlet community list-icons`. | ||
| ``` | ||
Oops, something went wrong.
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.
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.
The preview rendering commands use long-form flags (
--webp-level=9,--2x) which differ from the short-form flags (-z 9,-2) recommended in the repository style guide. For consistency, update the commands to use the short-form flags.References
pixlet render -z 9andpixlet render -z 9 -2. (link)