Compare commits

...
11 Commits
Author SHA1 Message Date
手瓜一十雪 d09a82b1b8 Add Windows packaging workflow and NapCat entry files
AI RELEASE NapCat / Build-LiteLoader (push) Canceled after 0s
AI RELEASE NapCat / Build-Shell (push) Canceled after 0s
AI RELEASE NapCat / Download-QNX64 (push) Canceled after 0s
AI RELEASE NapCat / release-napcat (push) Canceled after 0s
Introduces a new GitHub Actions job to automate packaging NapCat for Windows, including downloading dependencies and assembling artifacts. Adds napcat.bat and index.js entry files for Windows distribution in packages/napcat-develop.
2025-11-13 19:48:15 +08:00
手瓜一十雪 85b5c881ba Add napcat-develop package and update scripts
Introduces the napcat-develop package with its own package.json and tsconfig.json. Updates build and dev scripts in the root package.json, modifies loadNapCat.cjs to adjust paths and output directories, and updates nodeTest.ps1 to use the correct script path.
2025-11-13 19:30:33 +08:00
手瓜一十雪 eebce222cf Update release note prompt formatting and examples
Changed the commit id placement in update items for clarity and added more example update entries to guide contributors in writing release notes.
2025-11-13 19:20:13 +08:00
手瓜一十雪 ec5ca5d89a Improve tag handling in auto-release workflow
AI RELEASE NapCat / Build-LiteLoader (push) Canceled after 0s
AI RELEASE NapCat / Build-Shell (push) Canceled after 0s
AI RELEASE NapCat / release-napcat (push) Canceled after 0s
Switches tag retrieval to use the GitHub API and sorts tags with jq for more reliable ordering. Adds explicit GITHUB_OWNER and GITHUB_REPO variables, improves previous tag selection logic, and ensures tags are fetched before generating release notes. Also adds more informative logging for debugging.
2025-11-13 19:16:12 +08:00
手瓜一十雪 31a7767ae4 Improve previous tag detection in auto-release workflow
AI RELEASE NapCat / Build-LiteLoader (push) Canceled after 0s
AI RELEASE NapCat / Build-Shell (push) Canceled after 0s
AI RELEASE NapCat / release-napcat (push) Canceled after 0s
Replaces 'git describe' with logic to find the previous tag by sorting all tags by creation date. This ensures accurate detection of the previous tag for release note generation and adds error handling if no previous tag is found.
2025-11-13 19:06:06 +08:00
手瓜一十雪 fec024334a Update release note prompt formatting instructions
Clarified that output must strictly follow the NapCat release note format and example. Updated constraints and replaced the example section with a real example for better guidance.
2025-11-13 19:03:28 +08:00
手瓜一十雪 2ad2af4d7c Trigger release workflow on tag push
AI RELEASE NapCat / Build-LiteLoader (push) Canceled after 0s
AI RELEASE NapCat / Build-Shell (push) Canceled after 0s
AI RELEASE NapCat / release-napcat (push) Canceled after 0s
Changed the workflow trigger from pushes to the main branch to pushes of any tag. This enables releases to be automatically created when a new tag is pushed.
2025-11-13 18:57:37 +08:00
手瓜一十雪 2a160d296f Remove tag trigger from auto-release workflow
The workflow will no longer be triggered by tag pushes, only by pushes to the main branch.
2025-11-13 18:57:20 +08:00
手瓜一十雪 e43f229e04 Update import paths to use direct module references
Changed import statements from alias-based paths (e.g., '@/napcat-common/store') to direct module references (e.g., 'napcat-common/src/store') in Proxy.ts, Status.ts, Data.ts, and SignToken.ts for improved compatibility and clarity.
2025-11-13 18:56:51 +08:00
手瓜一十雪 9158ebc136 Update workflow name to AI RELEASE NapCat
Renamed the GitHub Actions workflow from 'Build Action' to 'AI RELEASE NapCat' for improved clarity and identification.
2025-11-13 18:55:01 +08:00
手瓜一十雪 d758fe3a2b Improve release note generation in workflow
Build Action / Build-LiteLoader (push) Canceled after 0s
Build Action / Build-Shell (push) Canceled after 0s
Build Action / release-napcat (push) Canceled after 0s
Enhances the release note generation step to compare commits between the previous and current tags, includes commit bodies and authors, and formats output for better readability. Also adds more robust extraction and output handling for the generated release notes.
2025-11-13 18:53:19 +08:00
14 changed files with 251 additions and 26 deletions

No files matched your search

+6 -7
View File
@@ -1,4 +1,4 @@
注意:输出必须严格使用 NapCat 的发布说明格式,并用简体中文。
注意:输出必须严格使用 NapCat 的发布说明格式,严格保证示例格式,并用简体中文。
格式规则:
1. 第一行:# V{TAG}
@@ -17,7 +17,7 @@
## 更新
按数字序列列出主要变更项,每条尽量一句话
- 前缀短 commit id,例如:1. a1b2c3d 修复 get_essence_msg_list 崩溃
- 前缀短 commit id,例如:1. 修复 get_essence_msg_list 崩溃 (a1b2c3d)
- 保持 4-18 条要点
## 开发者注意
@@ -25,11 +25,8 @@
额外约束:
- 语言简体中文,面向最终用户
- 不输出 stack trace、密钥、敏感信息
- 只列文件名作为 assets,不写链接
- 若提交为空,输出简短默认说明
下面为示例
下面为真实示例,请完全参考
# V?.?.?
[使用文档](https://napneko.github.io/)
@@ -58,4 +55,6 @@ NapCat.Shell.Windows.OneKey.zip (无头)
[安装运行库](https://aka.ms/vs/17/release/vc_redist.x64.exe)
## 更新
1. xxxx
1. 修改了XXXXX
2. 新增了XXXX
3. 重构了XXXX
+143 -9
View File
@@ -1,12 +1,10 @@
name: "Build Action"
name: AI RELEASE NapCat
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*' # 任意 tag push 时触发
- '*'
permissions: write-all
@@ -65,6 +63,98 @@ jobs:
with:
name: NapCat.Shell
path: shell-dist
Download-QNX64:
needs: Build-Shell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Setup tools
run: |
sudo apt update
sudo apt install -y aria2 unzip zip p7zip-full curl jq
- name: Download QQ x64, Node.js and Assemble NapCat.Shell.Windows.Node.zip
run: |
set -euo pipefail
TMPDIR=$(mktemp -d)
cd "$TMPDIR"
# -----------------------------
# 1) 下载 QQ x64
# -----------------------------
JS_URL="https://cdn-go.cn/qq-web/im.qq.com_new/latest/rainbow/windowsConfig.js"
NT_URL=$(curl -fsSL "$JS_URL" | grep -oP '"ntDownloadX64Url"\s*:\s*"\K[^"]+')
QQ_ZIP="$(basename "$NT_URL")"
aria2c -x16 -s16 -k1M -o "$QQ_ZIP" "$NT_URL"
QQ_EXTRACT="$TMPDIR/qq_extracted"
mkdir -p "$QQ_EXTRACT"
7z x -y -o"$QQ_EXTRACT" "$QQ_ZIP" >/dev/null
# -----------------------------
# 2) 下载 Node.js Windows x64 zip 22.11.0
# -----------------------------
NODE_VER="22.11.0"
NODE_URL="https://nodejs.org/dist/v$NODE_VER/node-v$NODE_VER-win-x64.zip"
NODE_ZIP="node-v$NODE_VER-win-x64.zip"
aria2c -x16 -s16 -k1M -o "$NODE_ZIP" "$NODE_URL"
NODE_EXTRACT="$TMPDIR/node_extracted"
mkdir -p "$NODE_EXTRACT"
unzip -q "$NODE_ZIP" -d "$NODE_EXTRACT"
# -----------------------------
# 3) 创建输出目录
# -----------------------------
OUT_DIR="$GITHUB_WORKSPACE/napcat"
mkdir -p "$OUT_DIR/napcat"
# -----------------------------
# 4) 解压 NapCat.Shell.zip 到 napcat
# -----------------------------
unzip -q "$GITHUB_WORKSPACE/artifacts/NapCat.Shell.zip" -d "$OUT_DIR/napcat"
# -----------------------------
# 5) 拷贝 QQ 文件到 napcat
# -----------------------------
QQ_TARGETS=("avif_convert.dll" "broadcast_ipc.dll" "config.json" "libglib-2.0-0.dll" "libgobject-2.0-0.dll" "libvips-42.dll" "ncnn.dll" "opencv.dll" "package.json" "QBar.dll" "wrapper.node")
for name in "${QQ_TARGETS[@]}"; do
find "$QQ_EXTRACT" -iname "$name" -exec cp -a {} "$OUT_DIR/napcat" \; || true
done
# -----------------------------
# 6) 拷贝仓库文件 napcat.bat 和 index.js
# -----------------------------
cp -a "$GITHUB_WORKSPACE/packages/napcat-develop/napcat.bat" "$OUT_DIR/napcat/" || true
cp -a "$GITHUB_WORKSPACE/packages/napcat-develop/index.js" "$OUT_DIR/napcat/" || true
# -----------------------------
# 7) 拷贝 Node.exe 到 napcat
# -----------------------------
cp -a "$NODE_EXTRACT/node-v$NODE_VER-win-x64/node.exe" "$OUT_DIR/napcat/" || true
# -----------------------------
# 8) 生成 index.txt
# -----------------------------
echo "NapCat Files Collected on $(date)" > "$GITHUB_WORKSPACE/index.txt"
# -----------------------------
# 9) 打包 napcat,命名为 NapCat.Shell.Windows.Node.zip
# -----------------------------
cd "$OUT_DIR"
zip -qr "$GITHUB_WORKSPACE/NapCat.Shell.Windows.Node.zip" napcat
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: NapCat.Shell.Windows.Node
path: NapCat.Shell.Windows.Node.zip
release-napcat:
needs: [Build-LiteLoader, Build-Shell]
@@ -84,25 +174,67 @@ jobs:
[ -d NapCat.Framework ] && zip -qr ../NapCat.Framework.zip -r NapCat.Framework
[ -d NapCat.Shell ] && zip -qr ../NapCat.Shell.zip -r NapCat.Shell
cd ..
- name: Generate release note via OpenRouter
env:
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENROUTER_API_URL: ${{ env.OPENROUTER_API_URL }}
OPENROUTER_MODEL: ${{ env.OPENROUTER_MODEL }}
GITHUB_OWNER: "NapNeKo" # 替换成你的 repo owner
GITHUB_REPO: "NapCatQQ" # 替换成你的 repo 名
run: |
set -euo pipefail
TAG="${GITHUB_REF#refs/tags/}"
COMMITS=$(git log --pretty=format:'%h %s (%an)' -n 30)
# 当前 tag
CURRENT_TAG="${GITHUB_REF#refs/tags/}"
echo "Current tag: $CURRENT_TAG"
# 从 GitHub API 获取 tag 列表
TAGS_JSON=$(curl -s "https://api.github.com/repos/${GITHUB_OWNER}/${GITHUB_REPO}/tags?per_page=100")
TAGS=( $(echo "$TAGS_JSON" | jq -r '.[].name' | sort -V) )
# 找到上一个 tag
PREV_TAG=""
for i in "${!TAGS[@]}"; do
if [ "${TAGS[$i]}" = "$CURRENT_TAG" ]; then
if [ $i -gt 0 ]; then
PREV_TAG="${TAGS[$((i-1))]}"
fi
break
fi
done
if [ -z "$PREV_TAG" ]; then
echo "❌ Could not find previous tag for $CURRENT_TAG, aborting."
exit 1
fi
echo "Previous tag: $PREV_TAG"
# 强制拉取上一个 tag 和当前 tag
git fetch origin "refs/tags/$PREV_TAG:refs/tags/$PREV_TAG" --force
git fetch origin "refs/tags/$CURRENT_TAG:refs/tags/$CURRENT_TAG" --force
# 获取 commit title + body + 作者,保留换行
COMMITS=$(git log --pretty=format:'%h %B (%an)' "$PREV_TAG".."$CURRENT_TAG" | sed 's/$/\\n/')
echo "Commit list from $PREV_TAG to $CURRENT_TAG:"
echo -e "$COMMITS"
# 读取 prompt
PROMPT_FILE=".github/prompt/release_note_prompt.txt"
SYSTEM_PROMPT=$(<"$PROMPT_FILE")
USER_CONTENT="TAG: $TAG\n提交列表:\n$COMMITS"
# 构建用户内容
USER_CONTENT="TAG: $CURRENT_TAG\n提交列表:\n$COMMITS"
# 构建请求 JSON
BODY=$(jq -n \
--arg system "$SYSTEM_PROMPT" \
--arg user "$USER_CONTENT" \
'{model: env.OPENROUTER_MODEL, messages:[{role:"system", content:$system},{role:"user", content:$user}], temperature:0.2, max_tokens:800}')
# 调用 OpenRouter
RESPONSE=$(curl -s -X POST "$OPENROUTER_API_URL" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
@@ -111,6 +243,7 @@ jobs:
echo "=== OpenRouter raw response ==="
echo "$RESPONSE" | jq .
# 提取生成内容
RELEASE_BODY=$(echo "$RESPONSE" | jq -r '.choices[0].message.content // .choices[0].text // ""')
if [ -z "$RELEASE_BODY" ]; then
@@ -118,7 +251,8 @@ jobs:
exit 1
fi
echo "$RELEASE_BODY" > CHANGELOG.md
# 输出到 CHANGELOG.md
echo -e "$RELEASE_BODY" > CHANGELOG.md
echo "=== generated release note ==="
cat CHANGELOG.md
+1 -1
View File
@@ -16,4 +16,4 @@ checkVersion.sh
bun.lockb
tests/run/
guild1.db-wal
guild1.db-shm
guild1.db-shm
+2 -1
View File
@@ -6,7 +6,8 @@
"scripts": {
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1"
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1",
"dev:shell": "pnpm --filter napcat-develop run dev || exit 1"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^16.0.3",
+14
View File
@@ -0,0 +1,14 @@
const path = require('path');
const { pathToFileURL } = require('url');
// 公共目录变量
const BASE_DIR = __dirname;
const WRAPPER_NODE_PATH = path.join(BASE_DIR, 'wrapper.node');
const PACKAGE_JSON_PATH = path.join(BASE_DIR, 'package.json');
const CONFIG_JSON_PATH = path.join(BASE_DIR, 'config.json');
const NAPCAT_MJS_PATH = path.join(BASE_DIR, 'napcat', 'napcat.mjs');
process.env.NAPCAT_WRAPPER_PATH = WRAPPER_NODE_PATH;
process.env.NAPCAT_QQ_PACKAGE_INFO_PATH = PACKAGE_JSON_PATH;
process.env.NAPCAT_QQ_VERSION_CONFIG_PATH = CONFIG_JSON_PATH;
process.env.NAPCAT_DISABLE_PIPE = '1';
import(pathToFileURL(NAPCAT_MJS_PATH).href);
+3 -3
View File
@@ -18,9 +18,9 @@ if (versionFolders.length !== 1) {
}
const BASE_DIR = path.join(versionsDir, versionFolders[0], 'resources', 'app');
const TARGET_DIR = path.join(__dirname, 'run');
const TARGET_DIR = path.join(__dirname, 'dist');
const QQNT_FILE = path.join(__dirname, 'QQNT.dll');
const NAPCAT_MJS_PATH = path.join(__dirname, '..', 'dist', 'napcat.mjs');
const NAPCAT_MJS_PATH = path.join(__dirname, '..', 'napcat-shell','dist', 'napcat.mjs');
const itemsToCopy = [
'avif_convert.dll',
@@ -60,7 +60,7 @@ async function copyAll () {
process.env.NAPCAT_QQ_PACKAGE_INFO_PATH = path.join(TARGET_DIR, 'package.json');
process.env.NAPCAT_QQ_VERSION_CONFIG_PATH = path.join(TARGET_DIR, 'config.json');
process.env.NAPCAT_DISABLE_PIPE = '1';
process.env.NAPCAT_WORKDIR = path.join(__dirname, 'run');
process.env.NAPCAT_WORKDIR = TARGET_DIR;
console.log('Loading NapCat module...');
await import(pathToFileURL(NAPCAT_MJS_PATH).href);
+1
View File
@@ -0,0 +1 @@
node.exe ./index.js
+1 -1
View File
@@ -5,4 +5,4 @@ $uninstall = $uninstall.Trim('"')
$qqPath = Split-Path $uninstall -Parent
Write-Host "QQPath: $qqPath"
node.exe "tests/loadNapCat.cjs" "$qqPath"
node.exe "./loadNapCat.cjs" "$qqPath"
+27
View File
@@ -0,0 +1,27 @@
{
"name": "napcat-develop",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "index.cjs",
"scripts": {
"dev": "powershell ./nodeTest.ps1"
},
"exports": {
".": {
"require": "./index.cjs"
},
"./*": {
"require": "./*"
}
},
"dependencies": {
"fs-extra": "^11.3.2"
},
"devDependencies": {
"@types/node": "^22.0.1"
},
"engines": {
"node": ">=18.0.0"
}
}
+49
View File
@@ -0,0 +1,49 @@
{
"compilerOptions": {
"target": "ES2021",
"module": "ESNext",
"moduleResolution": "Node",
"lib": [
"ES2021"
],
"typeRoots": [
"./node_modules/@types"
],
"esModuleInterop": true,
"outDir": "dist",
"rootDir": "./",
"noEmit": false,
"sourceMap": true,
"strict": true,
"noImplicitAny": false,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"alwaysStrict": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": false,
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useDefineForClassFields": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"baseUrl": "./",
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"allowJs": true
},
"include": [
"**/*.cjs"
],
"exclude": [
"node_modules",
"dist"
]
}
@@ -1,5 +1,5 @@
import { RequestHandler } from 'express';
import { RequestUtil } from '@/napcat-common/request';
import { RequestUtil } from 'napcat-common/src/request';
import { sendError, sendSuccess } from '../utils/response';
export const GetProxyHandler: RequestHandler = async (req, res) => {
@@ -1,5 +1,5 @@
import { RequestHandler } from 'express';
import { SystemStatus, statusHelperSubscription } from '@/napcat-core/helper/status';
import { SystemStatus, statusHelperSubscription } from 'napcat-core/helper/status';
export const StatusRealTimeHandler: RequestHandler = async (req, res) => {
res.setHeader('Content-Type', 'text/event-stream');
@@ -1,6 +1,6 @@
import type { LoginRuntimeType } from '../types/data';
import packageJson from '../../../../package.json';
import store from '@/napcat-common/store';
import store from 'napcat-common/src/store';
const LoginRuntime: LoginRuntimeType = {
LoginCurrentTime: Date.now(),
@@ -1,5 +1,5 @@
import crypto from 'crypto';
import store from '@/napcat-common/store';
import store from 'napcat-common/src/store';
export class AuthHelper {
private static readonly secretKey = Math.random().toString(36).slice(2);