mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-14 17:53:05 +08:00
Compare commits
28 Commits
0ea8dfc7d9
...
buildable/
| Author | SHA1 | Date | |
|---|---|---|---|
| 8bb266a1c3 | |||
| 9054a9b4ad | |||
|
|
c8d5f577a1 | ||
| 7c82c4aea5 | |||
| 5491ad1747 | |||
| 1be6ed0198 | |||
| 01bfc3ee18 | |||
| 2d45adf8c3 | |||
| 707fddda79 | |||
| 68589a21fc | |||
| e8228d0cc1 | |||
| cc99e565f0 | |||
|
|
718271417d | ||
| 04ee38726b | |||
|
|
4a00e65868 | ||
| 6c3c08b5d5 | |||
| ef5a332f17 | |||
|
|
9acabca40e | ||
| b654090a6e | |||
|
|
c9a7343b30 | ||
| 6250b480e0 | |||
|
|
63e8cc314a | ||
| 451f83e14d | |||
| 2b7e6718d9 | |||
| ed806c668a | |||
| da381c3adf | |||
| 1cbff98b36 | |||
| 95a30f147c |
137
.github/workflows/release-core.yml
vendored
Normal file
137
.github/workflows/release-core.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
name: Release Partner Core
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Core release tag, for example release-core/0.5.0"
|
||||
required: true
|
||||
type: string
|
||||
push:
|
||||
tags:
|
||||
- "release-core/*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release-core:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Resolve release metadata
|
||||
id: release
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
TAG="${{ inputs.tag }}"
|
||||
else
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
fi
|
||||
|
||||
VERSION="${TAG#release-core/}"
|
||||
VERSION="${VERSION#v}"
|
||||
ENCODED_TAG="${TAG//\//%2F}"
|
||||
ASSET_NAME="partner-core-${VERSION}.jar"
|
||||
ASSET_URL="https://github.com/slhaf/Partner/releases/download/${ENCODED_TAG}/${ASSET_NAME}"
|
||||
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "asset_url=${ASSET_URL}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo "Core release tag: ${TAG}"
|
||||
echo "Core release version: ${VERSION}"
|
||||
echo "Core release asset: ${ASSET_NAME}"
|
||||
|
||||
- name: Checkout release source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.release.outputs.tag }}
|
||||
|
||||
- name: Set up Java 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "21"
|
||||
|
||||
- name: Build Partner Core
|
||||
run: |
|
||||
mvn -B -DskipTests=true -pl Partner-Core -am package
|
||||
|
||||
- name: Prepare release artifact
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p dist
|
||||
|
||||
SOURCE_JAR="Partner-Core/target/partner-core-${{ steps.release.outputs.version }}.jar"
|
||||
|
||||
if [ ! -f "$SOURCE_JAR" ]; then
|
||||
echo "Expected artifact not found: $SOURCE_JAR"
|
||||
echo "Available Partner-Core target files:"
|
||||
find Partner-Core/target -maxdepth 1 -type f -name "*.jar" -print
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$SOURCE_JAR" "dist/${{ steps.release.outputs.asset_name }}"
|
||||
ls -lh dist
|
||||
|
||||
- name: Create GitHub Release
|
||||
shell: bash
|
||||
run: |
|
||||
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
||||
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gh release create "${{ steps.release.outputs.tag }}" \
|
||||
"dist/${{ steps.release.outputs.asset_name }}" \
|
||||
--title "Partner Core ${{ steps.release.outputs.version }}" \
|
||||
--notes "Partner Core ${{ steps.release.outputs.version }}"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Checkout master for registry update
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
path: registry-worktree
|
||||
|
||||
- name: Update latestRelease
|
||||
working-directory: registry-worktree
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
version = "${{ steps.release.outputs.version }}"
|
||||
url = "${{ steps.release.outputs.asset_url }}"
|
||||
|
||||
index_path = Path("registry/index.json")
|
||||
index = json.loads(index_path.read_text(encoding="utf-8"))
|
||||
|
||||
index["partner"]["latestRelease"] = {
|
||||
"url": url,
|
||||
"version": version
|
||||
}
|
||||
|
||||
index_path.write_text(
|
||||
json.dumps(index, ensure_ascii=False, indent=2) + "\n",
|
||||
encoding="utf-8"
|
||||
)
|
||||
PY
|
||||
|
||||
- name: Commit registry update
|
||||
working-directory: registry-worktree
|
||||
run: |
|
||||
if git diff --quiet registry/index.json; then
|
||||
echo "No latestRelease changes."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add registry/index.json
|
||||
git commit -m "chore(registry): update latest core release to ${{ steps.release.outputs.tag }}"
|
||||
git push origin HEAD:master
|
||||
161
.github/workflows/release-ctl.yml
vendored
Normal file
161
.github/workflows/release-ctl.yml
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
name: Release PartnerCtl
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Ctl release tag, for example release-ctl/0.5.0"
|
||||
required: true
|
||||
type: string
|
||||
push:
|
||||
tags:
|
||||
- "release-ctl/*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.platform }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux-x64
|
||||
runner: ubuntu-latest
|
||||
binaryPath: PartnerCtl/target/partnerctl
|
||||
assetSuffix: linux-x64
|
||||
- platform: linux-arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
binaryPath: PartnerCtl/target/partnerctl
|
||||
assetSuffix: linux-arm64
|
||||
- platform: windows-x64
|
||||
runner: windows-latest
|
||||
binaryPath: PartnerCtl/target/partnerctl.exe
|
||||
assetSuffix: windows-x64.exe
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
steps:
|
||||
- name: Resolve release metadata
|
||||
id: release
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
TAG="${{ inputs.tag }}"
|
||||
else
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
fi
|
||||
|
||||
VERSION="${TAG#release-ctl/}"
|
||||
VERSION="${VERSION#v}"
|
||||
ASSET_NAME="partnerctl-${VERSION}-${{ matrix.assetSuffix }}"
|
||||
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
echo "asset_name=${ASSET_NAME}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo "Ctl release tag: ${TAG}"
|
||||
echo "Ctl release version: ${VERSION}"
|
||||
echo "Ctl release asset: ${ASSET_NAME}"
|
||||
|
||||
- name: Checkout release source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.release.outputs.tag }}
|
||||
|
||||
- name: Set up GraalVM 21
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
distribution: graalvm-community
|
||||
java-version: "21"
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Build partnerctl native image
|
||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||
|
||||
- name: Prepare release artifact
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p dist
|
||||
|
||||
BINARY_PATH="${{ matrix.binaryPath }}"
|
||||
ASSET_PATH="dist/${{ steps.release.outputs.asset_name }}"
|
||||
|
||||
if [ ! -f "$BINARY_PATH" ]; then
|
||||
echo "Expected native binary not found: $BINARY_PATH"
|
||||
echo "Available PartnerCtl target files:"
|
||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp "$BINARY_PATH" "$ASSET_PATH"
|
||||
|
||||
if [[ "${{ matrix.platform }}" == linux-* ]]; then
|
||||
chmod +x "$ASSET_PATH"
|
||||
fi
|
||||
|
||||
ls -lh dist
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.release.outputs.asset_name }}
|
||||
path: dist/${{ steps.release.outputs.asset_name }}
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
release:
|
||||
name: Create GitHub Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Resolve release metadata
|
||||
id: release
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
TAG="${{ inputs.tag }}"
|
||||
else
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
fi
|
||||
|
||||
VERSION="${TAG#release-ctl/}"
|
||||
VERSION="${VERSION#v}"
|
||||
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo "Ctl release tag: ${TAG}"
|
||||
echo "Ctl release version: ${VERSION}"
|
||||
|
||||
- name: Checkout release source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.release.outputs.tag }}
|
||||
|
||||
- name: Download release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Show release artifacts
|
||||
run: |
|
||||
ls -lh dist
|
||||
|
||||
- name: Create GitHub Release
|
||||
shell: bash
|
||||
run: |
|
||||
if gh release view "${{ steps.release.outputs.tag }}" >/dev/null 2>&1; then
|
||||
echo "Release ${{ steps.release.outputs.tag }} already exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gh release create "${{ steps.release.outputs.tag }}" \
|
||||
dist/* \
|
||||
--title "PartnerCtl ${{ steps.release.outputs.version }}" \
|
||||
--notes "PartnerCtl ${{ steps.release.outputs.version }}"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
36
.github/workflows/sync-from-gitea.yml
vendored
36
.github/workflows/sync-from-gitea.yml
vendored
@@ -1,36 +0,0 @@
|
||||
name: Sync from Gitea
|
||||
|
||||
# 1. 给 GITHUB_TOKEN 开写权限
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '*/30 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 配置 Git 用户
|
||||
run: |
|
||||
git config --global user.name "Gitea Sync Bot"
|
||||
git config --global user.email "slhafzjw@slhaf.work"
|
||||
|
||||
- name: 关闭全局 SSL 校验
|
||||
run: git config --global http.sslVerify false
|
||||
|
||||
- name: Clone from Gitea (mirror)
|
||||
run: |
|
||||
git clone --mirror \
|
||||
https://${{ secrets.GITEA_USER }}:${{ secrets.GITEA_TOKEN }}@${{ secrets.GITEA_URL }} \
|
||||
gitea-mirror
|
||||
|
||||
- name: Push to GitHub
|
||||
run: |
|
||||
cd gitea-mirror
|
||||
# 明确推到名为 "github" 的 remote
|
||||
git remote add github \
|
||||
https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
|
||||
git push --mirror github
|
||||
137
.github/workflows/test-partnerctl-native.yml
vendored
Normal file
137
.github/workflows/test-partnerctl-native.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
name: Test PartnerCtl Native Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
platform:
|
||||
description: "Target platform to test"
|
||||
required: true
|
||||
default: "windows-x64"
|
||||
type: choice
|
||||
options:
|
||||
- windows-x64
|
||||
- linux-x64
|
||||
- linux-arm64
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-linux-x64:
|
||||
name: Test linux-x64
|
||||
if: ${{ inputs.platform == 'linux-x64' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM 21
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
distribution: graalvm-community
|
||||
java-version: "21"
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Build partnerctl native image
|
||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||
|
||||
- name: Check Linux output
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
||||
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
||||
echo "Available PartnerCtl target files:"
|
||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x PartnerCtl/target/partnerctl
|
||||
./PartnerCtl/target/partnerctl --help
|
||||
|
||||
- name: Upload test artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: partnerctl-linux-x64-test
|
||||
path: PartnerCtl/target/partnerctl
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
test-linux-arm64:
|
||||
name: Test linux-arm64
|
||||
if: ${{ inputs.platform == 'linux-arm64' }}
|
||||
runs-on: ubuntu-24.04-arm
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM 21
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
distribution: graalvm-community
|
||||
java-version: "21"
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Build partnerctl native image
|
||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||
|
||||
- name: Check Linux output
|
||||
shell: bash
|
||||
run: |
|
||||
if [ ! -f "PartnerCtl/target/partnerctl" ]; then
|
||||
echo "Expected native binary not found: PartnerCtl/target/partnerctl"
|
||||
echo "Available PartnerCtl target files:"
|
||||
find PartnerCtl/target -maxdepth 2 -type f -print
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x PartnerCtl/target/partnerctl
|
||||
./PartnerCtl/target/partnerctl --help
|
||||
|
||||
- name: Upload test artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: partnerctl-linux-arm64-test
|
||||
path: PartnerCtl/target/partnerctl
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
test-windows-x64:
|
||||
name: Test windows-x64
|
||||
if: ${{ inputs.platform == 'windows-x64' }}
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM 21
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
distribution: graalvm-community
|
||||
java-version: "21"
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Build partnerctl native image
|
||||
run: mvn -B -DskipTests=true -pl PartnerCtl -am package native:compile
|
||||
|
||||
- name: Check Windows output
|
||||
shell: pwsh
|
||||
run: |
|
||||
if (!(Test-Path "PartnerCtl/target/partnerctl.exe")) {
|
||||
Write-Host "Expected native binary not found: PartnerCtl/target/partnerctl.exe"
|
||||
Write-Host "Available PartnerCtl target files:"
|
||||
Get-ChildItem -Recurse PartnerCtl/target | Select-Object FullName
|
||||
throw "partnerctl.exe not found"
|
||||
}
|
||||
|
||||
.\PartnerCtl\target\partnerctl.exe --help
|
||||
|
||||
- name: Upload test artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: partnerctl-windows-x64-test
|
||||
path: PartnerCtl/target/partnerctl.exe
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
70
.github/workflows/update-latest-buildable.yml
vendored
Normal file
70
.github/workflows/update-latest-buildable.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: Update Latest Buildable
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: "Buildable ref, for example buildable/v0.5.0"
|
||||
required: true
|
||||
type: string
|
||||
push:
|
||||
tags:
|
||||
- "buildable/*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update-latest-buildable:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Resolve buildable ref
|
||||
id: buildable
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "ref=${{ inputs.ref }}" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "ref=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Checkout master
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Update latestBuildable
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ref = "${{ steps.buildable.outputs.ref }}"
|
||||
index_path = Path("registry/index.json")
|
||||
|
||||
index = json.loads(index_path.read_text(encoding="utf-8"))
|
||||
|
||||
index["partner"]["latestBuildable"] = {
|
||||
"url": "https://github.com/slhaf/Partner.git",
|
||||
"ref": ref
|
||||
}
|
||||
|
||||
index_path.write_text(
|
||||
json.dumps(index, ensure_ascii=False, indent=2) + "\n",
|
||||
encoding="utf-8"
|
||||
)
|
||||
PY
|
||||
|
||||
- name: Commit registry update
|
||||
run: |
|
||||
if git diff --quiet registry/index.json; then
|
||||
echo "No latestBuildable changes."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add registry/index.json
|
||||
git commit -m "chore(registry): update latest buildable to ${{ steps.buildable.outputs.ref }}"
|
||||
git push
|
||||
38
.github/workflows/update-module-index.yml
vendored
Normal file
38
.github/workflows/update-module-index.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Update Module Index
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "registry/modules/*.json"
|
||||
- "registry/index.json"
|
||||
- "scripts/update_module_index.py"
|
||||
- "update-module-index.yml"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update-registry-index:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Update module index
|
||||
run: python3 scripts/update_module_index.py
|
||||
|
||||
- name: Commit updated index
|
||||
run: |
|
||||
if git diff --quiet registry/index.json; then
|
||||
echo "No module index changes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add registry/index.json
|
||||
git commit -m "chore: update registry index"
|
||||
git push
|
||||
37
.idea/misc.xml
generated
37
.idea/misc.xml
generated
@@ -1,28 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<list size="21">
|
||||
<list size="22">
|
||||
<item index="0" class="java.lang.String" itemvalue="lombok.Data" />
|
||||
<item index="1" class="java.lang.String" itemvalue="net.bytebuddy.implementation.bind.annotation.RuntimeType" />
|
||||
<item index="2" class="java.lang.String" itemvalue="picocli.CommandLine.Command" />
|
||||
<item index="3" class="java.lang.String" itemvalue="picocli.CommandLine.Mixin" />
|
||||
<item index="4" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.Capability" />
|
||||
<item index="5" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore" />
|
||||
<item index="6" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod" />
|
||||
<item index="7" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CoordinateManager" />
|
||||
<item index="8" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.Coordinated" />
|
||||
<item index="9" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.component.annotation.Init" />
|
||||
<item index="10" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AfterExecute" />
|
||||
<item index="11" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AgentRunningModule" />
|
||||
<item index="12" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule" />
|
||||
<item index="13" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.BeforeExecute" />
|
||||
<item index="14" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.Init" />
|
||||
<item index="15" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CapabilityMethod" />
|
||||
<item index="16" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CoordinateManager" />
|
||||
<item index="17" class="java.lang.String" itemvalue="work.slhaf.partner.api.register.capability.annotation.Capability" />
|
||||
<item index="18" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.capability.annotation.CapabilityCore" />
|
||||
<item index="19" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.capability.annotation.CapabilityMethod" />
|
||||
<item index="20" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.component.annotation.AgentComponent" />
|
||||
<item index="4" class="java.lang.String" itemvalue="picocli.CommandLine.Option" />
|
||||
<item index="5" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.Capability" />
|
||||
<item index="6" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityCore" />
|
||||
<item index="7" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CapabilityMethod" />
|
||||
<item index="8" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.CoordinateManager" />
|
||||
<item index="9" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.capability.annotation.Coordinated" />
|
||||
<item index="10" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.component.annotation.Init" />
|
||||
<item index="11" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AfterExecute" />
|
||||
<item index="12" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AgentRunningModule" />
|
||||
<item index="13" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule" />
|
||||
<item index="14" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.BeforeExecute" />
|
||||
<item index="15" class="java.lang.String" itemvalue="work.slhaf.partner.api.agent.factory.module.annotation.Init" />
|
||||
<item index="16" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CapabilityMethod" />
|
||||
<item index="17" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CoordinateManager" />
|
||||
<item index="18" class="java.lang.String" itemvalue="work.slhaf.partner.api.register.capability.annotation.Capability" />
|
||||
<item index="19" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.capability.annotation.CapabilityCore" />
|
||||
<item index="20" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.capability.annotation.CapabilityMethod" />
|
||||
<item index="21" class="java.lang.String" itemvalue="work.slhaf.partner.framework.agent.factory.component.annotation.AgentComponent" />
|
||||
</list>
|
||||
<writeAnnotations>
|
||||
<writeAnnotation name="work.slhaf.partner.api.agent.factory.capability.annotation.InjectCapability" />
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partner-core</artifactId>
|
||||
<version>0.9.0-preview</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -20,7 +21,7 @@
|
||||
<dependency>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-framework</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>${partner.runtime.version}</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-api -->
|
||||
<dependency>
|
||||
|
||||
@@ -6,22 +6,23 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-external-modules</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partner-onebot-adapter</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<version>${partner.runtime.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-framework</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<version>${partner.runtime.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partner-external-modules</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partner-framework</artifactId>
|
||||
<version>0.9.0-preview</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -86,7 +87,7 @@
|
||||
<dependency>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-interaction-api</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>${partner.interaction-api.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partner-interaction-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<parent>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>partnerctl</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
@@ -44,7 +45,7 @@
|
||||
<dependency>
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner-interaction-api</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>${partner.interaction-api.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -64,7 +64,8 @@ fun configureExternalGateway(home: Path, prompt: Prompt, manifest: ModuleManifes
|
||||
text("configure.gateway.external.details.buildCommand") to manifest.source.buildCommand.joinToString(" "),
|
||||
text("configure.gateway.external.details.artifact") to "${manifest.source.artifactDirectory}/${manifest.source.artifactPattern}",
|
||||
text("configure.gateway.external.details.installTarget") to manifest.install.target,
|
||||
text("configure.gateway.external.details.configTarget") to (manifest.config?.target ?: text("configure.gateway.external.details.noConfig")),
|
||||
text("configure.gateway.external.details.configTarget") to (manifest.config?.target
|
||||
?: text("configure.gateway.external.details.noConfig")),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -138,18 +139,43 @@ private fun askField(prompt: Prompt, field: Field): JsonElement? {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("KotlinConstantConditions")
|
||||
private fun validateFieldValue(field: Field, value: String): String? {
|
||||
if (value.isBlank() && !field.required) return null
|
||||
|
||||
return when (field.type) {
|
||||
FieldType.STRING -> null
|
||||
FieldType.INT -> value.toIntOrNull()?.let { null } ?: text("configure.field.error.int", field.label)
|
||||
FieldType.NUMBER -> value.toDoubleOrNull()?.let { null } ?: text("configure.field.error.number", field.label)
|
||||
FieldType.BOOLEAN -> value.toBooleanStrictOrNull()?.let { null } ?: text("configure.field.error.boolean", field.label)
|
||||
FieldType.RAW_JSON -> runCatching { Json.parseToJsonElement(value) }
|
||||
.exceptionOrNull()
|
||||
?.let { text("configure.field.error.rawJson", field.label) }
|
||||
FieldType.INT -> {
|
||||
if (value.toIntOrNull() == null) {
|
||||
text("configure.field.error.int", field.label)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
FieldType.NUMBER -> {
|
||||
if (value.toDoubleOrNull() == null) {
|
||||
text("configure.field.error.number", field.label)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
FieldType.BOOLEAN -> {
|
||||
if (value.toBooleanStrictOrNull() == null) {
|
||||
text("configure.field.error.boolean", field.label)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
FieldType.RAW_JSON -> {
|
||||
val result = runCatching { Json.parseToJsonElement(value) }.exceptionOrNull()
|
||||
if (result == null) {
|
||||
text("configure.field.error.rawJson", field.label)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.nio.file.Paths
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.name
|
||||
|
||||
private const val PARTNER_REPO_URL = "https://gitea.slhaf.work/slhaf/Partner.git"
|
||||
private const val PARTNER_REPO_URL = "https://github.com/slhaf/Partner.git"
|
||||
|
||||
fun buildFromSource(home: Path, prompt: Prompt) {
|
||||
buildAndInstallFromSource(
|
||||
|
||||
@@ -1,10 +1,20 @@
|
||||
package work.slhaf.partner.ctl.support
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
private const val registryUrl = "https://raw.githubusercontent.com/slhaf/Partner/refs/heads/master/registry"
|
||||
private const val indexUrl = "$registryUrl/index.json"
|
||||
|
||||
private val registryIndex = run {
|
||||
Json.decodeFromString<RegistryIndex>(fetchText(indexUrl))
|
||||
}
|
||||
|
||||
private fun loadModules(): Set<ModuleManifest> {
|
||||
// TODO: 待实现具体加载逻辑
|
||||
return emptySet()
|
||||
return registryIndex.externalModules.map { indexItem ->
|
||||
val manifestStr = fetchText("$registryUrl/${indexItem.registryRef}")
|
||||
return@map Json.decodeFromString<ModuleManifest>(manifestStr)
|
||||
}.toSet()
|
||||
}
|
||||
|
||||
fun loadAvailableGateway(): Set<ModuleManifest> {
|
||||
@@ -36,6 +46,7 @@ data class ModuleManifest(
|
||||
/** Human-readable module description shown before installation. */
|
||||
val description: String = "",
|
||||
|
||||
val version: String,
|
||||
val source: Source,
|
||||
val install: Install,
|
||||
val config: Config? = null,
|
||||
@@ -90,4 +101,36 @@ enum class FieldType {
|
||||
NUMBER,
|
||||
BOOLEAN,
|
||||
RAW_JSON,
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class RegistryIndex(
|
||||
val partner: PartnerIndex,
|
||||
val externalModules: List<ModulesIndexItem>
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PartnerIndex(
|
||||
val latestBuildable: Buildable,
|
||||
val latestRelease: Release
|
||||
) {
|
||||
@Serializable
|
||||
data class Buildable(
|
||||
val url: String,
|
||||
val ref: String
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Release(
|
||||
val url: String,
|
||||
val version: String
|
||||
)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class ModulesIndexItem(
|
||||
val name: String,
|
||||
val version: String,
|
||||
val withGateway: Boolean,
|
||||
val registryRef: String
|
||||
)
|
||||
@@ -0,0 +1,74 @@
|
||||
package work.slhaf.partner.ctl.support
|
||||
|
||||
import java.io.IOException
|
||||
import java.net.InetSocketAddress
|
||||
import java.net.ProxySelector
|
||||
import java.net.URI
|
||||
import java.net.http.*
|
||||
import java.time.Duration
|
||||
|
||||
private val httpClient: HttpClient = HttpClient.newBuilder()
|
||||
.connectTimeout(Duration.ofSeconds(20))
|
||||
.followRedirects(HttpClient.Redirect.NEVER)
|
||||
.apply {
|
||||
proxySelectorFromEnv()?.let(::proxy)
|
||||
}
|
||||
.build()
|
||||
|
||||
private fun proxySelectorFromEnv(): ProxySelector? {
|
||||
val proxyText = System.getenv("HTTPS_PROXY")
|
||||
?: System.getenv("https_proxy")
|
||||
?: return null
|
||||
|
||||
val proxyUri = URI.create(proxyText)
|
||||
val host = proxyUri.host
|
||||
?: throw IllegalArgumentException("Invalid HTTPS_PROXY host: $proxyText")
|
||||
|
||||
val port = proxyUri.port
|
||||
if (port == -1) {
|
||||
throw IllegalArgumentException("HTTPS_PROXY must include port: $proxyText")
|
||||
}
|
||||
|
||||
return ProxySelector.of(InetSocketAddress(host, port))
|
||||
}
|
||||
|
||||
fun fetchText(url: String): String {
|
||||
var lastError: Exception? = null
|
||||
|
||||
repeat(3) { attempt ->
|
||||
try {
|
||||
val request = HttpRequest.newBuilder()
|
||||
.uri(URI.create(url))
|
||||
.timeout(Duration.ofSeconds(60))
|
||||
.header("User-Agent", "partnerctl")
|
||||
.GET()
|
||||
.build()
|
||||
|
||||
val response = httpClient.send(
|
||||
request,
|
||||
HttpResponse.BodyHandlers.ofString()
|
||||
)
|
||||
|
||||
if (response.statusCode() !in 200..299) {
|
||||
throw IOException("Failed to fetch $url: HTTP ${response.statusCode()}")
|
||||
}
|
||||
|
||||
return response.body()
|
||||
} catch (e: HttpTimeoutException) {
|
||||
lastError = e
|
||||
} catch (e: HttpConnectTimeoutException) {
|
||||
lastError = e
|
||||
} catch (e: IOException) {
|
||||
lastError = e
|
||||
} catch (e: InterruptedException) {
|
||||
Thread.currentThread().interrupt()
|
||||
throw IOException("Interrupted while fetching $url", e)
|
||||
}
|
||||
|
||||
if (attempt < 2) {
|
||||
Thread.sleep(500L * (attempt + 1))
|
||||
}
|
||||
}
|
||||
|
||||
throw IOException("Failed to fetch $url after retries", lastError)
|
||||
}
|
||||
12
PartnerCtl/src/test/java/experimental/WebFetchTest.kt
Normal file
12
PartnerCtl/src/test/java/experimental/WebFetchTest.kt
Normal file
@@ -0,0 +1,12 @@
|
||||
package experimental
|
||||
|
||||
import kotlinx.serialization.json.Json
|
||||
import work.slhaf.partner.ctl.support.RegistryIndex
|
||||
import work.slhaf.partner.ctl.support.fetchText
|
||||
|
||||
|
||||
fun main() {
|
||||
val str = fetchText("https://raw.githubusercontent.com/slhaf/Partner/refs/heads/master/registry/index.json")
|
||||
val index = Json.decodeFromString<RegistryIndex>(str)
|
||||
println(index)
|
||||
}
|
||||
5
pom.xml
5
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>work.slhaf.partner</groupId>
|
||||
<artifactId>partner</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
<!-- 推荐仓库默认不跳测试;本地需要时再 -DskipTests=true -->
|
||||
<skipTests>false</skipTests>
|
||||
|
||||
<partner.runtime.version>0.9.0-preview</partner.runtime.version>
|
||||
<partner.interaction-api.version>1.0.0</partner.interaction-api.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
20
registry/index.json
Normal file
20
registry/index.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"partner": {
|
||||
"latestBuildable": {
|
||||
"url": "https://github.com/slhaf/Partner.git",
|
||||
"ref": "buildable/0.5.0"
|
||||
},
|
||||
"latestRelease": {
|
||||
"url": "https://github.com/slhaf/Partner/releases/download/release-core%2F0.5.0/partner-core-0.5.0.jar",
|
||||
"version": "0.5.0"
|
||||
}
|
||||
},
|
||||
"externalModules": [
|
||||
{
|
||||
"name": "OneBot Adapter",
|
||||
"version": "1.0.0",
|
||||
"withGateway": true,
|
||||
"registryRef": "modules/onebot-adapter.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
0
registry/modules/.gitkeep
Normal file
0
registry/modules/.gitkeep
Normal file
58
registry/modules/onebot-adapter.json
Normal file
58
registry/modules/onebot-adapter.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"id": "onebot_channel",
|
||||
"name": "OneBot Adapter",
|
||||
"version": "1.0.0",
|
||||
"withGateway": true,
|
||||
"description": "OneBot v11 reverse WebSocket gateway adapter for Partner. It accepts reverse WebSocket connections from a OneBot implementation and converts private message events into Partner input events.",
|
||||
"source": {
|
||||
"url": "https://github.com/slhaf/Partner.git",
|
||||
"sourceDirName": "Partner",
|
||||
"buildCommand": [
|
||||
"mvn",
|
||||
"-B",
|
||||
"-DskipTests=true",
|
||||
"-pl",
|
||||
"Partner-External-Modules/Partner-Onebot-Adapter",
|
||||
"-am",
|
||||
"package"
|
||||
],
|
||||
"artifactDirectory": "Partner-External-Modules/Partner-Onebot-Adapter/target",
|
||||
"artifactPattern": "partner-onebot-adapter-*.jar"
|
||||
},
|
||||
"install": {
|
||||
"target": "resources/module/partner-onebot-adapter.jar"
|
||||
},
|
||||
"config": {
|
||||
"target": "config/gateway.json",
|
||||
"fields": [
|
||||
{
|
||||
"name": "port",
|
||||
"label": "OneBot reverse WebSocket server port",
|
||||
"type": "INT",
|
||||
"default": "29700",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "hostname",
|
||||
"label": "OneBot reverse WebSocket server hostname",
|
||||
"type": "STRING",
|
||||
"default": "127.0.0.1",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"label": "OneBot reverse WebSocket path",
|
||||
"type": "STRING",
|
||||
"default": "/onebot/v11/ws",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "token",
|
||||
"label": "OneBot access token",
|
||||
"type": "STRING",
|
||||
"default": "",
|
||||
"required": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
59
scripts/update_module_index.py
Normal file
59
scripts/update_module_index.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
INDEX_PATH = ROOT / "registry" / "index.json"
|
||||
MODULES_DIR = ROOT / "registry" / "modules"
|
||||
|
||||
|
||||
def load_json(path: Path) -> dict:
|
||||
with path.open("r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def write_json(path: Path, data: dict) -> None:
|
||||
path.write_text(
|
||||
json.dumps(data, ensure_ascii=False, indent=2) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def build_external_modules() -> list[dict]:
|
||||
entries = []
|
||||
|
||||
if not MODULES_DIR.exists():
|
||||
return entries
|
||||
|
||||
for manifest_path in sorted(MODULES_DIR.glob("*.json")):
|
||||
manifest = load_json(manifest_path)
|
||||
|
||||
# 这里按你当前 ModuleManifest 的完整文件结构取字段。
|
||||
# version 如果 manifest 里暂时没有,可以先默认取 "0.5.0" 或直接要求 manifest 必须有。
|
||||
name = manifest["name"]
|
||||
version = manifest["version"]
|
||||
with_gateway = manifest.get("withGateway", False)
|
||||
|
||||
rel_path = manifest_path.relative_to(ROOT / "registry").as_posix()
|
||||
|
||||
entries.append(
|
||||
{
|
||||
"name": name,
|
||||
"version": version,
|
||||
"withGateway": with_gateway,
|
||||
"registryRef": rel_path,
|
||||
}
|
||||
)
|
||||
|
||||
return entries
|
||||
|
||||
|
||||
def main() -> None:
|
||||
index = load_json(INDEX_PATH)
|
||||
index["externalModules"] = build_external_modules()
|
||||
write_json(INDEX_PATH, index)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user