···11+name: 🐛 Bug report
22+description: Something's not working
33+labels: [bug]
44+body:
55+ - type: textarea
66+ validations:
77+ required: true
88+ attributes:
99+ label: 🐛 The bug
1010+ description: What isn't working? Describe what the bug is.
1111+ - type: input
1212+ validations:
1313+ required: true
1414+ attributes:
1515+ label: 🛠️ To reproduce
1616+ description: A reproduction of the bug via https://stackblitz.com/github/danielroe/package-name/tree/main/playground
1717+ placeholder: https://stackblitz.com/[...]
1818+ - type: textarea
1919+ validations:
2020+ required: true
2121+ attributes:
2222+ label: 🌈 Expected behaviour
2323+ description: What did you expect to happen? Is there a section in the docs about this?
2424+ - type: textarea
2525+ attributes:
2626+ label: ℹ️ Additional context
2727+ description: Add any other context about the problem here.
+114
.github/workflows/agent-scan.yml
···11+name: agent-scan
22+33+on:
44+ # zizmor: ignore[dangerous-triggers] - DO NOT add action/checkout in this workflow as it uses pull_request_target
55+ pull_request_target:
66+ types:
77+ - opened
88+ - reopened
99+1010+concurrency:
1111+ group: agent-scan-${{ github.event.pull_request.number }}
1212+ cancel-in-progress: true
1313+1414+permissions:
1515+ issues: write
1616+ pull-requests: write
1717+1818+jobs:
1919+ agentscan:
2020+ runs-on: ubuntu-latest
2121+ steps:
2222+ - name: AgentScan
2323+ id: agentscan
2424+ uses: MatteoGabriele/agentscan-action@c7d61446e7aece6bdd3edcee4558bbfc0392615e # v2.0.1
2525+ with:
2626+ github-token: ${{ secrets.GITHUB_TOKEN }}
2727+ mode: silent
2828+ - name: Handle flagged PR
2929+ if: contains(fromJSON('["automation","mixed"]'), steps.agentscan.outputs.classification) || steps.agentscan.outputs.community-flagged == 'true'
3030+ env:
3131+ CLASSIFICATION: ${{ steps.agentscan.outputs.classification }}
3232+ COMMUNITY_FLAGGED: ${{ steps.agentscan.outputs.community-flagged }}
3333+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
3434+ with:
3535+ script: |
3636+ const prNumber = context.payload.pull_request.number;
3737+ const classification = process.env.CLASSIFICATION;
3838+ const communityFlagged = process.env.COMMUNITY_FLAGGED === 'true';
3939+ const shouldClose = classification === 'automation' || communityFlagged;
4040+4141+ const issue = context.payload.pull_request
4242+ const labels = issue.labels?.map(l => l.name) || []
4343+4444+ if (!labels.includes('possible bot')) {
4545+ await github.rest.issues.addLabels({
4646+ owner: context.repo.owner,
4747+ repo: context.repo.repo,
4848+ issue_number: prNumber,
4949+ labels: ['possible bot'],
5050+ })
5151+ }
5252+5353+ const comments = await github.paginate(github.rest.issues.listComments, {
5454+ owner: context.repo.owner,
5555+ repo: context.repo.repo,
5656+ issue_number: prNumber,
5757+ per_page: 100,
5858+ })
5959+6060+ const alreadyCommented = comments.some(
6161+ c => c.user.type === 'Bot' && c.body.includes('AI-assisted contribution guidelines')
6262+ )
6363+6464+ if (!alreadyCommented) {
6565+ const closingNote = shouldClose
6666+ ? "We're closing this for now as the account looks automated. If we got that wrong, please just reopen the PR and we'll take another look."
6767+ : 'If this was flagged in error, we apologise! 😳 Just let us know. 🙏'
6868+6969+ await github.rest.issues.createComment({
7070+ owner: context.repo.owner,
7171+ repo: context.repo.repo,
7272+ issue_number: prNumber,
7373+ body: [
7474+ "We've flagged this as a potential contribution without a human behind it. We welcome the thoughtful use of AI tools when contributing, but ask all contributors to follow [two core principles](https://roe.dev/blog/using-ai-in-open-source):",
7575+ '',
7676+ '1. **Never let an LLM speak for you** - all comments, issues, and PR descriptions should be written in your own words, reflecting your own understanding.',
7777+ '2. **Never let an LLM think for you** - only submit contributions you fully understand and can explain.',
7878+ '',
7979+ 'Please review these AI-assisted contribution guidelines and update this contribution if needed.',
8080+ '',
8181+ closingNote,
8282+ ].join('\n'),
8383+ })
8484+ } else {
8585+ core.info('Possible-bot comment already exists - skipping comment.')
8686+ }
8787+8888+ if (shouldClose && issue.state === 'open' && !alreadyCommented) {
8989+ await github.rest.pulls.update({
9090+ owner: context.repo.owner,
9191+ repo: context.repo.repo,
9292+ pull_number: prNumber,
9393+ state: 'closed',
9494+ title: '🚨 unwelcome pr from bot 🚨',
9595+ })
9696+ }
9797+9898+ const actionTaken = [
9999+ 'Added `possible bot` label',
100100+ alreadyCommented ? null : 'posted policy comment',
101101+ shouldClose && !alreadyCommented ? 'closed PR' : null,
102102+ ].filter(Boolean).join(', ')
103103+104104+ core.summary
105105+ .addHeading('AgentScan: Possible Bot Flag', 2)
106106+ .addTable([
107107+ [{ data: 'Property', header: true }, { data: 'Value', header: true }],
108108+ ['Pull Request', `#${prNumber}`],
109109+ ['Classification', classification],
110110+ ['Community flagged', String(communityFlagged)],
111111+ ['Action', actionTaken || 'No action (already handled)'],
112112+ ])
113113+114114+ await core.summary.write()
···11+# Contributor Covenant Code of Conduct
22+33+## Our pledge
44+55+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
66+77+## Our standards
88+99+Examples of behavior that contributes to creating a positive environment include:
1010+1111+- Using welcoming and inclusive language
1212+- Being respectful of differing viewpoints and experiences
1313+- Gracefully accepting constructive criticism
1414+- Focusing on what is best for the community
1515+- Showing empathy towards other community members
1616+1717+Examples of unacceptable behavior by participants include:
1818+1919+- The use of sexualized language or imagery and unwelcome sexual attention or advances
2020+- Trolling, insulting/derogatory comments, and personal or political attacks
2121+- Public or private harassment
2222+- Publishing others' private information, such as a physical or electronic address, without explicit permission
2323+- Other conduct which could reasonably be considered inappropriate in a professional setting
2424+2525+## Our responsibilities
2626+2727+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
2828+2929+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
3030+3131+## Scope
3232+3333+This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
3434+3535+## Enforcement
3636+3737+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [daniel@roe.dev](mailto:daniel@roe.dev). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
3838+3939+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
4040+4141+## Attribution
4242+4343+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
4444+4545+[homepage]: https://www.contributor-covenant.org
4646+4747+For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
+21
LICENCE
···11+MIT License
22+33+Copyright (c) 2024 Daniel Roe
44+55+Permission is hereby granted, free of charge, to any person obtaining a copy
66+of this software and associated documentation files (the "Software"), to deal
77+in the Software without restriction, including without limitation the rights
88+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99+copies of the Software, and to permit persons to whom the Software is
1010+furnished to do so, subject to the following conditions:
1111+1212+The above copyright notice and this permission notice shall be included in all
1313+copies or substantial portions of the Software.
1414+1515+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121+SOFTWARE.
+48
README.md
···11+# package-name
22+33+[![npm version][npm-version-src]][npm-version-href]
44+[![npm downloads][npm-downloads-src]][npm-downloads-href]
55+[![Github Actions][github-actions-src]][github-actions-href]
66+[![Codecov][codecov-src]][codecov-href]
77+88+> Package description
99+1010+## Usage
1111+1212+Install package:
1313+1414+```sh
1515+# npm
1616+npm install package-name
1717+1818+# pnpm
1919+pnpm install package-name
2020+```
2121+2222+```js
2323+import {} from 'package-name'
2424+```
2525+2626+## 💻 Development
2727+2828+- Clone this repository
2929+- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
3030+- Install dependencies using `pnpm install`
3131+- Run interactive tests using `pnpm dev`
3232+3333+## License
3434+3535+Made with ❤️
3636+3737+Published under [MIT License](./LICENCE).
3838+3939+<!-- Badges -->
4040+4141+[npm-version-src]: https://npmx.dev/api/registry/badge/version/package-name
4242+[npm-version-href]: https://npmx.dev/package/package-name
4343+[npm-downloads-src]: https://npmx.dev/api/registry/badge/downloads/package-name
4444+[npm-downloads-href]: https://npm.chart.dev/package-name
4545+[github-actions-src]: https://img.shields.io/github/actions/workflow/status/danielroe/package-name/ci.yml?branch=main&style=flat-square
4646+[github-actions-href]: https://github.com/danielroe/package-name/actions?query=workflow%3Aci
4747+[codecov-src]: https://img.shields.io/codecov/c/gh/danielroe/package-name/main?style=flat-square
4848+[codecov-href]: https://codecov.io/gh/danielroe/package-name
+3
eslint.config.js
···11+import antfu from '@antfu/eslint-config'
22+33+export default antfu()