From 47454fdeb6134f315300e83dbc9fe6cb0b9c76f5 Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:20:14 +0800 Subject: [PATCH] chore: clean up structure; fix ai-motion warning --- .markdownlint.json | 3 --- .prettierrc | 16 ------------- .vscode/settings.json | 16 ++++++++++++- CODE_OF_CONDUCT.md | 56 +++++++++++++++++++++++++++++++++++++++++++ CODE_OF_CONDUCT_zh.md | 50 -------------------------------------- CONTRIBUTING.md | 20 ++++++++++------ NOTICE | 23 ------------------ README-zh.md | 17 ++++++++++++- README.md | 18 +++++++++++++- package-lock.json | 23 ++++-------------- package.json | 20 +++++++++++++++- tsconfig.json | 6 +---- tsconfig.lib.json | 15 ------------ vite.lib.config.ts | 9 +------ vite.umd.config.ts | 11 --------- 15 files changed, 142 insertions(+), 161 deletions(-) delete mode 100644 .markdownlint.json delete mode 100644 .prettierrc delete mode 100644 CODE_OF_CONDUCT_zh.md delete mode 100644 NOTICE delete mode 100644 tsconfig.lib.json diff --git a/.markdownlint.json b/.markdownlint.json deleted file mode 100644 index 99ec3be..0000000 --- a/.markdownlint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "markdownlint/style/relaxed" -} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 0590a00..0000000 --- a/.prettierrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "singleQuote": true, - "semi": false, - "useTabs": true, - "printWidth": 100, - "trailingComma": "es5", - "plugins": ["@trivago/prettier-plugin-sort-imports"], - "importOrder": [ - "", - "^(@/).*(? Chinese Version +> 《阿里巴巴开源行为准则》 + +## 我们的保证 + +为了促进一个开放透明且友好的环境,我们作为贡献者和维护者保证:无论年龄、种族、民族、性别认同和表达(方式)、体型、身体健全与否、经验水平、国籍、个人表现、宗教或性别取向,参与者在我们项目和社区中都免于骚扰。 + +## 我们的标准 + +有助于创造正面环境的行为包括但不限于: + +* 使用友好和包容性语言 +* 尊重不同的观点和经历 +* 耐心地接受建设性批评 +* 关注对社区最有利的事情 +* 友善对待其他社区成员 + +身为参与者不能接受的行为包括但不限于: + +* 使用与性有关的言语或是图像,以及不受欢迎的性骚扰 +* 捣乱/煽动/造谣的行为或进行侮辱/贬损的评论,人身攻击及政治攻击 +* 公开或私下的骚扰 +* 未经许可地发布他人的个人资料,例如住址或是电子地址 +* 其他可以被合理地认定为不恰当或者违反职业操守的行为 + +## 我们的责任 + +项目维护者有责任为「可接受的行为」标准做出诠释,以及对已发生的不被接受的行为采取恰当且公平的纠正措施。 + +项目维护者有权利及责任去删除、编辑、拒绝与本行为标准有所违背的评论 (comments)、提交 (commits)、代码、wiki 编辑、问题 (issues) 和其他贡献,以及项目维护者可暂时或永久性的禁止任何他们认为有不适当、威胁、冒犯、有害行为的贡献者。 + +## 使用范围 + +当一个人代表该项目或是其社区时,本行为标准适用于其项目平台和公共平台。 + +代表项目或是社区的情况,举例来说包括使用官方项目的电子邮件地址、通过官方的社区媒体账号发布或线上或线下事件中担任指定代表。 + +该项目的呈现方式可由其项目维护者进行进一步的定义及解释。 + +## 强制执行 + +可以通过 opensource@alibaba-inc.com 来联系项目团队来举报滥用、骚扰或其他不被接受的行为。 + +任何维护团队认为有必要且适合的所有投诉都将进行审查及调查,并做出相对应的回应。项目小组有对事件回报者有保密的义务。具体执行的方针近一步细节可能会单独公布。 + +没有切实地遵守或是执行本行为标准的项目维护人员,可能会因项目领导人或是其他成员的决定,暂时或是永久地取消其参与资格。 + +## 来源 + +本行为标准改编自[贡献者公约](https://www.contributor-covenant.org),版本 1.4 +可在此查看[https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html) diff --git a/CODE_OF_CONDUCT_zh.md b/CODE_OF_CONDUCT_zh.md deleted file mode 100644 index 2850139..0000000 --- a/CODE_OF_CONDUCT_zh.md +++ /dev/null @@ -1,50 +0,0 @@ -# 阿里巴巴开源行为准则 - -## 我们的保证 - -为了促进一个开放透明且友好的环境,我们作为贡献者和维护者保证:无论年龄、种族、民族、性别认同和表达(方式)、体型、身体健全与否、经验水平、国籍、个人表现、宗教或性别取向,参与者在我们项目和社区中都免于骚扰。 - -## 我们的标准 - -有助于创造正面环境的行为包括但不限于: - -* 使用友好和包容性语言 -* 尊重不同的观点和经历 -* 耐心地接受建设性批评 -* 关注对社区最有利的事情 -* 友善对待其他社区成员 - -身为参与者不能接受的行为包括但不限于: - -* 使用与性有关的言语或是图像,以及不受欢迎的性骚扰 -* 捣乱/煽动/造谣的行为或进行侮辱/贬损的评论,人身攻击及政治攻击 -* 公开或私下的骚扰 -* 未经许可地发布他人的个人资料,例如住址或是电子地址 -* 其他可以被合理地认定为不恰当或者违反职业操守的行为 - -## 我们的责任 - -项目维护者有责任为「可接受的行为」标准做出诠释,以及对已发生的不被接受的行为采取恰当且公平的纠正措施。 - -项目维护者有权利及责任去删除、编辑、拒绝与本行为标准有所违背的评论 (comments)、提交 (commits)、代码、wiki 编辑、问题 (issues) 和其他贡献,以及项目维护者可暂时或永久性的禁止任何他们认为有不适当、威胁、冒犯、有害行为的贡献者。 - -## 使用范围 - -当一个人代表该项目或是其社区时,本行为标准适用于其项目平台和公共平台。 - -代表项目或是社区的情况,举例来说包括使用官方项目的电子邮件地址、通过官方的社区媒体账号发布或线上或线下事件中担任指定代表。 - -该项目的呈现方式可由其项目维护者进行进一步的定义及解释。 - -## 强制执行 - -可以通过 opensource@alibaba-inc.com 来联系项目团队来举报滥用、骚扰或其他不被接受的行为。 - -任何维护团队认为有必要且适合的所有投诉都将进行审查及调查,并做出相对应的回应。项目小组有对事件回报者有保密的义务。具体执行的方针近一步细节可能会单独公布。 - -没有切实地遵守或是执行本行为标准的项目维护人员,可能会因项目领导人或是其他成员的决定,暂时或是永久地取消其参与资格。 - -## 来源 - -本行为标准改编自[贡献者公约](https://www.contributor-covenant.org),版本 1.4 -可在此查看[https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html](https://www.contributor-covenant.org/zh-cn/version/1/4/code-of-conduct.html) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 60c7901..303cad6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,7 @@ Thank you for your interest in contributing to Page-Agent! We welcome contributi - make sure `eslint`, `auto-format` and `commit-lint` all work 2. **Setup** + ```bash npm install npm start # Start demo and documentation site @@ -38,12 +39,14 @@ This project has **two separate parts**: ### Code Contributions 1. **Fork and Clone** + ```bash git clone https://github.com/your-username/page-agent.git cd page-agent ``` 2. **Create Feature Branch** + ```bash git checkout -b feat/your-feature-name ``` @@ -54,11 +57,13 @@ This project has **two separate parts**: - Update documentation as needed 4. **Test Your Changes** + ```bash # TODO ``` 5. **Commit and Push** + ```bash git add . git commit -m "feat: add awesome feature" @@ -80,12 +85,12 @@ This project has **two separate parts**: - Keep functions small and focused - Add JSDoc for public APIs -### ✨ AI coder/copilot +### Vibe coding with AI -- It's **recommended** to heavily rely on AI when maintaining **the webpages and tests**. -- BUT **NOT the core lib!!!** Be very careful if AI touched any code in the core lib. +- It's **recommended** to heavily rely on AI (aka "vibe coding") when maintaining **demo pages and tests**. +- BUT **NOT the core lib!!!** Be very careful if AI ever touched the core lib!!! - Review anything AI wrote before make a commit. You are the author of anything you commit. NOT AI. -- Update the AI instructions. +- Update the AI instructions when structure changed. - Cursor and Cline: `./.cursor/rules` - Github Copilot: `./.github/copilot-instructions.md` - Claude Code: `./CLAUDE.md` @@ -96,7 +101,7 @@ This project has **two separate parts**: - Use event bus for component communication - Follow browser-use patterns for DOM operations -### Documentation Site (`pages/`) +### Doc&demo Site (`pages/`) - Use React 19 + TypeScript - Follow hash routing patterns (`useHashLocation`) @@ -115,16 +120,17 @@ npm start # React development server - Config your LLM API - Start a local script + ```bash npm run build:lib:watch # Auto-rebuild on changes ``` + - Add a new bookmark enable it on other website + ``` javascript:(function(){var s=document.createElement('script');s.src=`http://localhost:5173/dist/lib/page-agent.umd.cjs?t=${Math.random()}`;s.onload=()=>console.log(%27PageAgent ready!%27);document.head.appendChild(s);})(); ``` - - ### Adding Documentation 1. Create `pages/docs/section/page-name/page.tsx` diff --git a/NOTICE b/NOTICE deleted file mode 100644 index 30bf0af..0000000 --- a/NOTICE +++ /dev/null @@ -1,23 +0,0 @@ -Page-Agent -Copyright (c) 2025 Alibaba Group Holding Limited -Author: Simon - -This project incorporates work covered by the following copyright and permission notices: - -================================================================================ - -Browser Use -Copyright (c) 2024 Gregor Zunic -Licensed under the MIT License - -Original browser-use project: -License: MIT License - -We gratefully acknowledge the browser-use project and its contributors for their -excellent work on web automation and DOM interaction patterns that helped make -this project possible. - -================================================================================ - -Third-party dependencies and their licenses can be found in the package.json -file and in the node_modules directory after installation. diff --git a/README-zh.md b/README-zh.md index 3338790..9340837 100644 --- a/README-zh.md +++ b/README-zh.md @@ -99,7 +99,22 @@ PageAgent 专为**客户端网页增强**设计,不是服务端自动化工具 MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。 -DOM 处理与提示词参考了 [browser-use](https://github.com/browser-use/browser-use)(MIT 许可证)。完整归属请见 [NOTICE](NOTICE)。 +``` +DOM processing components and prompt are derived from browser-use: + +Browser Use +Copyright (c) 2024 Gregor Zunic +Licensed under the MIT License + +Original browser-use project: + +We gratefully acknowledge the browser-use project and its contributors for their +excellent work on web automation and DOM interaction patterns that helped make +this project possible. + +Third-party dependencies and their licenses can be found in the package.json +file and in the node_modules directory after installation. +``` --- diff --git a/README.md b/README.md index 9a2fe32..3b5577e 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,23 @@ PageAgent is designed for **client-side web enhancement**, not server-side autom MIT License - see the [LICENSE](LICENSE) file for details. -DOM processing components and prompt are derived from [browser-use](https://github.com/browser-use/browser-use) (MIT License). See [NOTICE](NOTICE) for full attribution. + +``` +DOM processing components and prompt are derived from browser-use: + +Browser Use +Copyright (c) 2024 Gregor Zunic +Licensed under the MIT License + +Original browser-use project: + +We gratefully acknowledge the browser-use project and its contributors for their +excellent work on web automation and DOM interaction patterns that helped make +this project possible. + +Third-party dependencies and their licenses can be found in the package.json +file and in the node_modules directory after installation. +``` --- diff --git a/package-lock.json b/package-lock.json index 594a59e..bb3dbbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@ai-sdk/openai": "^2.0.22", "ai": "^5.0.26", - "ai-motion": "^0.4.6", + "ai-motion": "^0.4.7", "chalk": "^5.6.0", "zod": "^4.1.3" }, @@ -2538,7 +2538,6 @@ "integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.12.0" } @@ -2549,7 +2548,6 @@ "integrity": "sha512-WBM/nDbEZmDUORKnh5i1bTnAz6vTohUf9b8esSMu+b24+srbaxa04UbJgWx78CVfNXA20sNu0odEIluZDFdCog==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -2610,7 +2608,6 @@ "integrity": "sha512-TGf22kon8KW+DeKaUmOibKWktRY8b2NSAZNdtWh798COm1NWx8+xJ6iFBtk3IvLdv6+LGLJLRlyhrhEDZWargQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.45.0", "@typescript-eslint/types": "8.45.0", @@ -2875,7 +2872,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2912,9 +2908,9 @@ } }, "node_modules/ai-motion": { - "version": "0.4.6", - "resolved": "https://registry.npmjs.org/ai-motion/-/ai-motion-0.4.6.tgz", - "integrity": "sha512-F2CGMXsXen20gynyAZjsYcCanIexwa85qpEnY6Zw+dRds9AvPmU4wqE0tQfoAdpOchmOVB+tRR4phgbaB8o/gQ==", + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/ai-motion/-/ai-motion-0.4.7.tgz", + "integrity": "sha512-yuFtVgWeaxKyvfSFocA01Mr4UbRvwwy7HWZ6Mq9NM/yccAkqp3UCGdWX6AflNB8cU27PgwTBiMRfx6C9di7xkQ==", "license": "MIT" }, "node_modules/ajv": { @@ -3343,7 +3339,6 @@ "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", @@ -3540,7 +3535,6 @@ "dev": true, "hasInstallScript": true, "license": "MIT", - "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -3605,7 +3599,6 @@ "integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -5754,7 +5747,6 @@ "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", "dev": true, "license": "MIT", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -5819,7 +5811,6 @@ "integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -5939,7 +5930,6 @@ "integrity": "sha512-RIDh866U8agLgiIcdpB+COKnlCreHJLfIhWC3LVflku5YHfpnsIKigRZeFfMfCc4dVcqNVfQQ5gO/afOck064A==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -6305,7 +6295,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -6401,7 +6390,6 @@ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", "dev": true, "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6580,7 +6568,6 @@ "integrity": "sha512-VbA8ScMvAISJNJVbRDTJdCwqQoAareR/wutevKanhR2/1EkoXVZVkkORaYm/tNVCjP/UDTKtcw3bAkwOUdedmA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -6684,7 +6671,6 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -6918,7 +6904,6 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-4.1.11.tgz", "integrity": "sha512-WPsqwxITS2tzx1bzhIKsEs19ABD5vmCVa4xBo2tq/SrV4RNZtfws1EnCWQXM6yh8bD08a1idvkB5MZSBiZsjwg==", "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index b2f49d3..bfc6c87 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "dependencies": { "@ai-sdk/openai": "^2.0.22", "ai": "^5.0.26", - "ai-motion": "^0.4.6", + "ai-motion": "^0.4.7", "chalk": "^5.6.0", "zod": "^4.1.3" }, @@ -113,5 +113,23 @@ "never" ] } + }, + "prettier": { + "singleQuote": true, + "semi": false, + "useTabs": true, + "printWidth": 100, + "trailingComma": "es5", + "plugins": [ + "@trivago/prettier-plugin-sort-imports" + ], + "importOrder": [ + "", + "^(@/).*(?