diff --git a/.changeset/clippy-stable-lints.md b/.changeset/clippy-stable-lints.md new file mode 100644 index 0000000000..8a6f82ab00 --- /dev/null +++ b/.changeset/clippy-stable-lints.md @@ -0,0 +1,5 @@ +--- +"@googleworkspace/cli": patch +--- + +Fix stable Clippy warnings in the token provider and Apps Script file matching diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 0000000000..02b5999ea1 --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1,4 @@ +{ + "name": "gws", + "install": "rustup toolchain install stable --profile minimal --component rustfmt,clippy\nrustup default stable\ncargo fetch --locked\npnpm install --frozen-lockfile --ignore-scripts" +} diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..8e15b24286 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,98 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +# Displaying a sponsor button in your repository + +You can add a sponsor button in your repository to increase the visibility of funding options for your open source project. + +## About FUNDING files + +You can configure your sponsor button by editing a `FUNDING.yml` file in your repository's `.github` folder, on the default branch. You can configure the button to include sponsored developers in GitHub Sponsors, external funding platforms, or a custom funding URL. For more information about GitHub Sponsors, see [About GitHub Sponsors](/en/sponsors/getting-started-with-github-sponsors/about-github-sponsors). + +You can add one username, package name, or project name per external funding platform and up to four custom URLs. You can add one organization and up to four sponsored developers in GitHub Sponsors. Add each platform on a new line, using the following syntax. + +| Platform | Syntax | +| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | +| [LFX Mentorship (formerly CommunityBridge)](https://lfx.linuxfoundation.org/tools/mentorship) | `community_bridge: PROJECT-NAME` | +| [GitHub Sponsors](https://github.com/sponsors) | `github: USERNAME` or `github: [USERNAME, USERNAME, USERNAME, USERNAME]` | +| [IssueHunt](https://issuehunt.io/) | `issuehunt: USERNAME` | +| [Ko-fi](https://ko-fi.com/) | `ko_fi: USERNAME` | +| [Liberapay](https://en.liberapay.com/) | `liberapay: USERNAME` | +| [Open Collective](https://opencollective.com/) | `open_collective: USERNAME` | +| [Patreon](https://www.patreon.com/) | `patreon: USERNAME` | +| [Tidelift](https://tidelift.com/) | `tidelift: PLATFORM-NAME/PACKAGE-NAME` | +| [Polar](https://www.polar.sh/) | `polar: USERNAME` | +| [Buy Me a Coffee](https://www.buymeacoffee.com/) | `buy_me_a_coffee: USERNAME` | +| [thanks.dev](https://thanks.dev/) | `thanks_dev: u/gh/USERNAME` | +| Custom URL | `custom: LINK1` or `custom: [LINK1, LINK2, LINK3, LINK4]` | + +For Tidelift, use the `platform-name/package-name` syntax with the following platform names. + +| Language | Platform name | +| ---------- | ------------- | +| JavaScript | `npm` | +| Python | `pypi` | +| Ruby | `rubygems` | +| Java | `maven` | +| PHP | `packagist` | +| C# | `nuget` | + +Here's an example `FUNDING.yml` file: + +```yaml +github: [octocat, surftocat] +patreon: octocat +tidelift: npm/octo-package +custom: ["https://www.paypal.me/octocat", octocat.com] +``` + +> \[!NOTE] +> If a custom URL in an array includes `:`, you must wrap the URL in quotes. For example, `"https://www.paypal.me/octocat"`. + +You can create a default sponsor button for your organization or personal account. For more information, see [Creating a default community health file](/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file). + +> \[!NOTE] +> Funding links provide a way for open source projects to receive direct financial support from their community. We don’t support the use of funding links for other purposes, such as for advertising, or supporting political, community, or charity groups. If you have questions about whether your intended use is supported, please visit [GitHub Support](https://support.github.com). + +## Displaying a sponsor button in your repository + +Anyone with admin permissions can enable a sponsor button in a repository. + +1. On GitHub, navigate to the main page of the repository. + +2. Under your repository name, click ** Settings**. If you cannot see the "Settings" tab, select the **** dropdown menu, then click **Settings**. + + ![Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.](/assets/images/help/repository/repo-actions-settings.png) + +3. On the "General" settings page, in the "Features" section, select **Sponsorships**. + +4. In the "Sponsorships" box, click **Set up sponsor button** or **Override funding links**. + +5. In the file editor, follow the instructions in the `FUNDING.yml` file to add links to your funding locations. + +6. Click **Commit changes...** + +7. In the "Commit message" field, type a short, meaningful commit message that describes the change you made to the file. You can attribute the commit to more than one author in the commit message. For more information, see [Creating a commit with multiple authors or on behalf of an organization](/en/pull-requests/how-tos/commit-changes/creating-a-commit-with-multiple-authors). + +8. Below the commit message fields, decide whether to add your commit to the current branch or to a new branch. If your current branch is the default branch, you should choose to create a new branch for your commit and then create a pull request. For more information, see [Creating a pull request](/en/pull-requests/how-tos/create-pull-requests/creating-a-pull-request). + + ![Screenshot of a GitHub pull request showing a radio button to commit directly to the main branch or to create a new branch. New branch is selected.](/assets/images/help/repository/choose-commit-branch.png) + +9. Click **Commit changes** or **Propose changes**. + +## Further reading + +* [About GitHub Sponsors for open source contributors](/en/sponsors/receiving-sponsorships-through-github-sponsors/about-github-sponsors-for-open-source-contributors) +* [FAQ with the GitHub Sponsors team](https://github.blog/2019-06-12-faq-with-the-github-sponsors-team/) on the GitHub Blog diff --git a/AGENTS.md b/AGENTS.md index 722112264b..e9e6d17dcc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -237,3 +237,20 @@ See [`src/helpers/README.md`](crates/google-workspace-cli/src/helpers/README.md) | `GOOGLE_WORKSPACE_CLI_LOG_FILE` | Directory for JSON-line log files with daily rotation. Off by default. | All variables can also live in a `.env` file (loaded via `dotenvy`). + +## Cursor Cloud specific instructions + +Cloud Agent install is defined in `.cursor/environment.json`. The default Cloud Agent image ships Rust 1.83. This repository's lockfile includes Edition 2024 crates, which need stable Rust (1.85 or newer). Before `cargo fetch`, `cargo test`, or `cargo clippy`, install and select stable: + +```bash +rustup toolchain install stable --profile minimal --component rustfmt,clippy +rustup default stable +``` + +`pnpm install` runs `lefthook install` through the `prepare` script. That command fails while Cursor sets `core.hooksPath`. Install Node dependencies with: + +```bash +pnpm install --frozen-lockfile --ignore-scripts +``` + +`gws schema ` and `gws --help` fetch Discovery documents from `www.googleapis.com` and do not need Google credentials. Calling a live API method needs OAuth (`gws auth login`) or `GOOGLE_WORKSPACE_CLI_TOKEN`. diff --git a/crates/google-workspace-cli/src/auth.rs b/crates/google-workspace-cli/src/auth.rs index 9d8847e4be..a64888ba5b 100644 --- a/crates/google-workspace-cli/src/auth.rs +++ b/crates/google-workspace-cli/src/auth.rs @@ -137,6 +137,9 @@ enum Credential { /// /// Long-running helpers use this trait so they can request a fresh token before /// each API call instead of holding a single token string until it expires. +// async-trait adds `#[must_use]` with no reason on the boxed future. That +// future is already must-use, so stable Clippy rejects the attribute. +#[allow(clippy::double_must_use)] #[async_trait::async_trait] pub trait AccessTokenProvider: Send + Sync { async fn access_token(&self) -> anyhow::Result; diff --git a/crates/google-workspace-cli/src/helpers/script.rs b/crates/google-workspace-cli/src/helpers/script.rs index 11bcdebec1..4b31db62da 100644 --- a/crates/google-workspace-cli/src/helpers/script.rs +++ b/crates/google-workspace-cli/src/helpers/script.rs @@ -169,13 +169,7 @@ fn process_file(path: &Path) -> Result, GwsError> { filename.trim_end_matches(".js").trim_end_matches(".gs"), ), "html" => ("HTML", filename.trim_end_matches(".html")), - "json" => { - if filename == "appsscript.json" { - ("JSON", "appsscript") - } else { - return Ok(None); - } - } + "json" if filename == "appsscript.json" => ("JSON", "appsscript"), _ => return Ok(None), };