@xwang152/claw-lark 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "parser": "@typescript-eslint/parser",
3
+ "extends": [
4
+ "eslint:recommended",
5
+ "plugin:@typescript-eslint/recommended",
6
+ "plugin:prettier/recommended"
7
+ ],
8
+ "plugins": ["@typescript-eslint", "prettier"],
9
+ "rules": {
10
+ "prettier/prettier": "error",
11
+ "@typescript-eslint/no-explicit-any": "warn",
12
+ "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
13
+ },
14
+ "env": {
15
+ "node": true,
16
+ "es2022": true
17
+ }
18
+ }
@@ -0,0 +1,39 @@
1
+ name: Node.js Package Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - uses: actions/setup-node@v4
15
+ with:
16
+ node-version: '20.x'
17
+ registry-url: 'https://registry.npmjs.org'
18
+
19
+ - name: Install dependencies
20
+ run: npm install
21
+
22
+ - name: Check if version exists on npm
23
+ id: check_version
24
+ run: |
25
+ VERSION=$(node -p "require('./package.json').version")
26
+ NAME=$(node -p "require('./package.json').name")
27
+ if npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
28
+ echo "Version $VERSION already exists on npm. Skipping publish."
29
+ echo "exists=true" >> $GITHUB_OUTPUT
30
+ else
31
+ echo "Version $VERSION is new. Proceeding to publish."
32
+ echo "exists=false" >> $GITHUB_OUTPUT
33
+ fi
34
+
35
+ - name: Publish to npm
36
+ if: steps.check_version.outputs.exists == 'false'
37
+ run: npm publish --access public
38
+ env:
39
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "es5",
4
+ "singleQuote": false,
5
+ "printWidth": 100,
6
+ "tabWidth": 2
7
+ }
package/README.md CHANGED
@@ -22,6 +22,18 @@ A channel plugin that enables OpenClaw to communicate via Lark (Larksuite) messa
22
22
 
23
23
  ## Installation
24
24
 
25
+ ### 1. Automatic Installation (Recommended)
26
+
27
+ Install directly via the OpenClaw CLI:
28
+
29
+ ```bash
30
+ openclaw plugins install @xwang152/claw-lark
31
+ ```
32
+
33
+ ### 2. Developer Installation (From Source)
34
+
35
+ If you want to contribute or modify the code:
36
+
25
37
  ```bash
26
38
  # Clone the repository
27
39
  git clone https://github.com/xwang152-jack/claw-lark.git
@@ -30,17 +42,15 @@ cd claw-lark
30
42
  # Install dependencies
31
43
  npm install
32
44
 
33
- # Install plugin into OpenClaw
45
+ # Install plugin in link mode
34
46
  openclaw plugins install --link .
35
47
  ```
36
48
 
37
- Or install directly via npm:
49
+ ### 3. Restart Gateway
38
50
 
39
- ```bash
40
- openclaw plugins install @xwang152/claw-lark
41
- ```
51
+ After installation, restart the Gateway to load the plugin:
42
52
 
43
- Verify installation:Restart Gateway to load the plugin
53
+ ```bash
44
54
  openclaw gateway restart
45
55
  ```
46
56
 
@@ -237,6 +247,15 @@ WebSocket mode requires enterprise Lark accounts. If you have an individual acco
237
247
 
238
248
  Issues and pull requests are welcome! If you encounter bugs or have feature requests, please open an issue at https://github.com/xwang152-jack/claw-lark/issues.
239
249
 
250
+ ## Automated Publishing (CI/CD)
251
+
252
+ The project is configured with GitHub Actions. When you push code to the `main` branch, if the version in `package.json` has changed, it will be automatically published to npm.
253
+
254
+ **Setup Steps:**
255
+ 1. Create an **Automation Token** on the npm website.
256
+ 2. In your GitHub repository, go to **Settings > Secrets and variables > Actions**.
257
+ 3. Add a new Repository secret named `NPM_TOKEN` with your npm token as the value.
258
+
240
259
  ## License
241
260
 
242
261
  MIT
package/README_zh.md CHANGED
@@ -20,6 +20,18 @@
20
20
 
21
21
  ## 安装步骤
22
22
 
23
+ ### 1. 自动安装(推荐)
24
+
25
+ 直接通过 OpenClaw 命令行工具安装:
26
+
27
+ ```bash
28
+ openclaw plugins install @xwang152/claw-lark
29
+ ```
30
+
31
+ ### 2. 开发者安装(从源码)
32
+
33
+ 如果你想进行二次开发或修改代码:
34
+
23
35
  ```bash
24
36
  # 克隆仓库
25
37
  git clone https://github.com/xwang152-jack/claw-lark.git
@@ -28,17 +40,15 @@ cd claw-lark
28
40
  # 安装依赖
29
41
  npm install
30
42
 
31
- # 将插件安装到 OpenClaw
43
+ # 以链接模式安装插件
32
44
  openclaw plugins install --link .
33
45
  ```
34
46
 
35
- 或者直接通过 npm 安装:
47
+ ### 3. 重启 Gateway
36
48
 
37
- ```bash
38
- openclaw plugins install @xwang152/claw-lark
39
- ```
49
+ 安装完成后,重启 Gateway 以加载插件:
40
50
 
41
- 验证安装:# 重启 Gateway 以加载插件
51
+ ```bash
42
52
  openclaw gateway restart
43
53
  ```
44
54
 
@@ -235,6 +245,15 @@ WebSocket 模式需要企业级飞书账号。如果是个人账号,请使用
235
245
 
236
246
  欢迎提交 Issue 和 Pull Request!如果您发现 Bug 或有功能建议,请在 https://github.com/xwang152-jack/claw-lark/issues 提交。
237
247
 
248
+ ## 自动化发布 (CI/CD)
249
+
250
+ 项目已配置 GitHub Actions。当你将代码推送到 `main` 分支时,如果 `package.json` 中的版本号发生了变化,系统会自动将其发布到 npm。
251
+
252
+ **配置步骤:**
253
+ 1. 在 npm 官网创建一个 **Automation Token**。
254
+ 2. 在 GitHub 仓库设置中,进入 **Settings > Secrets and variables > Actions**。
255
+ 3. 添加一个新的 Repository secret,名称为 `NPM_TOKEN`,值为你的 npm token。
256
+
238
257
  ## 开源协议
239
258
 
240
259
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwang152/claw-lark",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Lark/Feishu channel plugin for OpenClaw with WebSocket and Webhook support",
6
6
  "license": "MIT",
@@ -26,7 +26,12 @@
26
26
  ]
27
27
  },
28
28
  "scripts": {
29
- "typecheck": "tsc -p tsconfig.json"
29
+ "typecheck": "tsc -p tsconfig.json",
30
+ "lint": "eslint src/**/*.ts index.ts",
31
+ "format": "prettier --write src/**/*.ts index.ts",
32
+ "test": "vitest run",
33
+ "test:watch": "vitest",
34
+ "test:coverage": "vitest run --coverage"
30
35
  },
31
36
  "dependencies": {
32
37
  "@larksuiteoapi/node-sdk": "^1.37.0"
@@ -36,7 +41,15 @@
36
41
  },
37
42
  "devDependencies": {
38
43
  "@types/node": "^20.0.0",
44
+ "@typescript-eslint/eslint-plugin": "^8.54.0",
45
+ "@typescript-eslint/parser": "^8.54.0",
46
+ "@vitest/coverage-v8": "^4.0.18",
47
+ "eslint": "^9.39.2",
48
+ "eslint-config-prettier": "^10.1.8",
49
+ "eslint-plugin-prettier": "^5.5.5",
39
50
  "openclaw": "^2026.1.29",
40
- "typescript": "^5.0.0"
51
+ "prettier": "^3.8.1",
52
+ "typescript": "^5.0.0",
53
+ "vitest": "^4.0.18"
41
54
  }
42
55
  }
@@ -0,0 +1,7 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+
3
+ describe("Sample Test", () => {
4
+ it("should work", () => {
5
+ expect(1 + 1).toBe(2);
6
+ });
7
+ });