Skip to content

Commit d797244

Browse files
authored
feat(plugins)!: 插件 API 单一基线(版本归 0),插件契约、文档与 SDK 并入 Core (#17)
* feat(plugins)!: 插件 API 收敛为单一基线,所有版本从 0 起步 插件契约 shared/contracts/plugins/v1 原地重写为只保留每个 API 最完整的形态: - pluginAPIVersion、清单 schemaVersion、全部能力版本、协议版本和文档版本都归 0; 版本字段和协商保留,以后从 0 往上迭代。requires 必填,宿主只提供 0。 - serverProcess 和 executableResolution 并入基础契约,声明它们会被拒绝为 plugin.api.unsupported。 - 删除宿主内置运行时(checkRuntimeVersion)和生成器 runtime 字段;工具一律经 requiresTools 声明,未声明时报 plugin.runtime.undeclared。tool 字段暴露 .version、.major、.executable。 - 语言服务器启动计划始终带 sessionPolicy;runtimeRequirements 统一为 kind tool。 - 构建文档(litheBuildModel、litheDependencies、litheTestResults、 litheTestDiscovery、litheBuildConfiguration、litheConfigurationEdit、 diagnostics、modelInputs)、索引、native-ui、bridge、VCS、editorActions、 后端计划版本都为 0。 - 删除旧格式插件清单测试和 fixture(tests/plugins.rs、official-v1、 language-support-v1、runtime-versions),fixture 去掉 -v2 后缀。 - invalid-manifests 的 expectedField 由测试校验。 * refactor: shared/ 只保留插件,Core 自己的契约、fixture 和日志目录移到 rust/ - shared/fixtures → rust/fixtures,shared/logging → rust/logging, shared/contracts 下的非插件契约 → rust/contracts;四个 crate 的 include_str!、测试路径和文档引用一起改。 - 插件契约 shared/contracts/plugins/v1 → shared/plugins/contract/v1。 - macos/Tests/LitheTests/Fixtures/GitGraph 的 issue410 对照数据移到 rust/fixtures/git/graph-issue410,删除 macos/ 目录。 - 拆仓时没跟过来的 Lithe-IDEA 文件(根 README、i18n README、Agent Note、 native-ui-lab)改为指向 Lithe-IDEA preview 的绝对链接。 * feat(plugins): 并入 lithe-plugin-docs,插件契约、开发资料与 SDK 只在 shared/plugins - shared/plugins/README.md 为插件开发入口;guides/、reference/(API 总表、能力与版本、协议更新记录、domains/ 领域参考)按基线 0 重写,去掉版本对照和宿主平台现状说法 - sdk/{node,java,rust} 三个官方后端 SDK 与示例并入;5 个用 Node/Java 启动的示例补上 requiresTools - sdk/e2e 经 lithe-core 的 plugin-sdk-e2e feature 编译;新增 runtime-tools.plugin.json 代替运行时插件,host_launch_arguments 按宿主流程调 toolchains.instantiateLaunch 与 toolchains.checkVersion,替换已删除的 checkRuntimeVersion - scripts/verify-docs.mjs(schema $id、相对链接、拒绝指向 lithe-plugin-docs 的文件链接)及测试,scripts/sdk-e2e.mjs - .github/workflows:plugins-verify 与按 sdk-*-v* 标签发布三个 SDK - 契约 README 删除 Windows 映射与宿主现状小节,修复失效锚点和死链,去掉不存在的 build-host-integration fixture;SDK README 的宿主服务缺口改为链接能力页的唯一清单 - 根目录 README 说明目录分工;.gitignore 忽略 SDK 构建产物;cargo fmt 处理路径缩短后的格式差异
1 parent 6522b8d commit d797244

757 files changed

Lines changed: 38075 additions & 7207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Releases the official Java plugin SDK (`shared/plugins/sdk/java`) through its own tag series
2+
# (`sdk-java-v<version>`). The release holds `lithe-plugin-sdk-java-<version>.jar`
3+
# and its `.sha256`; plugin repositories pin both and shade the JAR into their
4+
# backend at build time.
5+
name: Release Java Plugin SDK
6+
7+
on:
8+
push:
9+
tags:
10+
- "sdk-java-v*"
11+
12+
permissions:
13+
contents: read
14+
15+
concurrency:
16+
group: release-java-plugin-sdk-${{ github.ref }}
17+
cancel-in-progress: false
18+
19+
jobs:
20+
release:
21+
name: Release ${{ github.ref_name }}
22+
if: github.repository == 'Lithe-IDEA/Lithe-core-rust'
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 20
25+
permissions:
26+
contents: write
27+
28+
steps:
29+
- name: Check out source
30+
uses: actions/checkout@v7
31+
32+
# The SDK supports Java 8: the tests run on a Java 8 runtime, while
33+
# Maven builds with the newer JDK set up last.
34+
- name: Set up Java 8 runtime
35+
id: java8
36+
uses: actions/setup-java@v5
37+
with:
38+
distribution: temurin
39+
java-version: '8'
40+
41+
- name: Set up Java 21 for Maven
42+
uses: actions/setup-java@v5
43+
with:
44+
distribution: temurin
45+
java-version: '21'
46+
47+
- name: Require the tag to match the SDK version
48+
id: version
49+
env:
50+
TAG: ${{ github.ref_name }}
51+
run: |
52+
version=$(mvn -B -ntp -q -f shared/plugins/sdk/java/plugin-sdk/pom.xml help:evaluate -Dexpression=project.version -DforceStdout)
53+
test "$TAG" = "sdk-java-v$version" || { echo "Tag $TAG does not match shared/plugins/sdk/java version $version"; exit 1; }
54+
echo "version=$version" >> "$GITHUB_OUTPUT"
55+
56+
- name: Build and test on Java 8
57+
env:
58+
JAVA8: ${{ steps.java8.outputs.path }}/bin/java
59+
run: mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify -Djvm="$JAVA8"
60+
61+
- name: Collect the release assets
62+
env:
63+
VERSION: ${{ steps.version.outputs.version }}
64+
run: |
65+
mkdir -p dist
66+
asset="lithe-plugin-sdk-java-$VERSION.jar"
67+
cp "shared/plugins/sdk/java/plugin-sdk/target/$asset" "dist/$asset"
68+
(cd dist && sha256sum "$asset" | cut -d' ' -f1 > "$asset.sha256")
69+
70+
- name: Publish the SDK release
71+
env:
72+
GH_TOKEN: ${{ github.token }}
73+
TAG: ${{ github.ref_name }}
74+
VERSION: ${{ steps.version.outputs.version }}
75+
run: |
76+
asset="lithe-plugin-sdk-java-$VERSION.jar"
77+
gh release create "$TAG" "dist/$asset" "dist/$asset.sha256" \
78+
--title "Java plugin SDK $VERSION" \
79+
--notes "Official Java plugin SDK $VERSION for Lithe plugin backends. Requires Java 8 or newer and has no runtime dependencies. Pin the JAR by its SHA-256 (\`$asset.sha256\`) and shade it into the backend JAR; see shared/plugins/sdk/java/README.md."
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Releases the official Node.js plugin SDK (`shared/plugins/sdk/node`) through its own tag
2+
# series (`sdk-node-v<version>`). The release holds
3+
# `lithe-plugin-sdk-node-<version>.tgz` and its `.sha256`; plugin repositories
4+
# pin both and vendor the unpacked package into their backend at build time,
5+
# because an installed plugin has no `node_modules` install step.
6+
name: Release Node Plugin SDK
7+
8+
on:
9+
push:
10+
tags:
11+
- "sdk-node-v*"
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: release-node-plugin-sdk-${{ github.ref }}
18+
cancel-in-progress: false
19+
20+
jobs:
21+
release:
22+
name: Release ${{ github.ref_name }}
23+
if: github.repository == 'Lithe-IDEA/Lithe-core-rust'
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
permissions:
27+
contents: write
28+
29+
steps:
30+
- name: Check out source
31+
uses: actions/checkout@v7
32+
33+
# The SDK supports Node.js 20.3 and newer, so the release is tested on
34+
# the oldest supported major.
35+
- name: Set up Node.js
36+
uses: actions/setup-node@v6
37+
with:
38+
node-version: 20
39+
40+
- name: Require the tag to match the SDK version
41+
id: version
42+
env:
43+
TAG: ${{ github.ref_name }}
44+
run: |
45+
version=$(node -p "require('./shared/plugins/sdk/node/package.json').version")
46+
test "$TAG" = "sdk-node-v$version" || { echo "Tag $TAG does not match shared/plugins/sdk/node version $version"; exit 1; }
47+
echo "version=$version" >> "$GITHUB_OUTPUT"
48+
49+
- name: Test
50+
run: node --test shared/plugins/sdk/node/test/*.test.mjs
51+
52+
# `npm pack` only builds the archive; `private: true` still keeps the
53+
# SDK off the npm registry. The repository LICENSE is copied in so the
54+
# archive carries its own license text.
55+
- name: Collect the release assets
56+
env:
57+
VERSION: ${{ steps.version.outputs.version }}
58+
run: |
59+
mkdir -p dist
60+
cp shared/plugins/LICENSE shared/plugins/sdk/node/LICENSE
61+
(cd shared/plugins/sdk/node && npm pack --pack-destination ../../../../dist)
62+
asset="lithe-plugin-sdk-node-$VERSION.tgz"
63+
mv "dist/lithe-plugin-sdk-$VERSION.tgz" "dist/$asset"
64+
tar -tzf "dist/$asset" | sort
65+
(cd dist && sha256sum "$asset" | cut -d' ' -f1 > "$asset.sha256")
66+
67+
- name: Publish the SDK release
68+
env:
69+
GH_TOKEN: ${{ github.token }}
70+
TAG: ${{ github.ref_name }}
71+
VERSION: ${{ steps.version.outputs.version }}
72+
run: |
73+
asset="lithe-plugin-sdk-node-$VERSION.tgz"
74+
gh release create "$TAG" "dist/$asset" "dist/$asset.sha256" \
75+
--title "Node.js plugin SDK $VERSION" \
76+
--notes "Official Node.js plugin SDK $VERSION for Lithe plugin backends. Requires Node.js 20.3 or newer and has no dependencies. Pin the archive by its SHA-256 (\`$asset.sha256\`), unpack it, and vendor its \`package/\` directory into the plugin package; see shared/plugins/sdk/node/README.md."
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Releases the official Rust plugin SDK (`shared/plugins/sdk/rust/plugin-sdk`) through its
2+
# own tag series (`sdk-rust-v<version>`). Plugin repositories either depend
3+
# on the tag through Git, which their Cargo.lock pins to the commit, or pin
4+
# `lithe-plugin-sdk-rust-<version>.crate` by its `.sha256` and vendor the
5+
# unpacked crate; the SDK is not published to crates.io.
6+
name: Release Rust Plugin SDK
7+
8+
on:
9+
push:
10+
tags:
11+
- "sdk-rust-v*"
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: release-rust-plugin-sdk-${{ github.ref }}
18+
cancel-in-progress: false
19+
20+
jobs:
21+
release:
22+
name: Release ${{ github.ref_name }}
23+
if: github.repository == 'Lithe-IDEA/Lithe-core-rust'
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 20
26+
permissions:
27+
contents: write
28+
29+
steps:
30+
- name: Check out source
31+
uses: actions/checkout@v7
32+
33+
# The release is tested on the oldest supported Rust.
34+
- uses: dtolnay/rust-toolchain@1.87
35+
36+
- name: Require the tag to match the SDK version
37+
id: version
38+
env:
39+
TAG: ${{ github.ref_name }}
40+
run: |
41+
version=$(cargo +1.87 metadata --locked --no-deps --format-version 1 --manifest-path shared/plugins/sdk/rust/Cargo.toml \
42+
| jq -r '.packages[] | select(.name == "lithe-plugin-sdk") | .version')
43+
test "$TAG" = "sdk-rust-v$version" || { echo "Tag $TAG does not match shared/plugins/sdk/rust version $version"; exit 1; }
44+
echo "version=$version" >> "$GITHUB_OUTPUT"
45+
46+
- name: Test
47+
run: cargo +1.87 test --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml
48+
49+
# `cargo package` only builds the archive; `publish = false` keeps the
50+
# SDK off crates.io. The repository LICENSE is copied in so the archive
51+
# carries its own license text.
52+
- name: Collect the release assets
53+
env:
54+
VERSION: ${{ steps.version.outputs.version }}
55+
run: |
56+
cp shared/plugins/LICENSE shared/plugins/sdk/rust/plugin-sdk/LICENSE
57+
cargo +1.87 package --locked --allow-dirty --manifest-path shared/plugins/sdk/rust/Cargo.toml -p lithe-plugin-sdk
58+
mkdir -p dist
59+
asset="lithe-plugin-sdk-rust-$VERSION.crate"
60+
cp "shared/plugins/sdk/rust/target/package/lithe-plugin-sdk-$VERSION.crate" "dist/$asset"
61+
tar -tzf "dist/$asset" | sort
62+
(cd dist && sha256sum "$asset" | cut -d' ' -f1 > "$asset.sha256")
63+
64+
- name: Publish the SDK release
65+
env:
66+
GH_TOKEN: ${{ github.token }}
67+
TAG: ${{ github.ref_name }}
68+
VERSION: ${{ steps.version.outputs.version }}
69+
run: |
70+
asset="lithe-plugin-sdk-rust-$VERSION.crate"
71+
gh release create "$TAG" "dist/$asset" "dist/$asset.sha256" \
72+
--title "Rust plugin SDK $VERSION" \
73+
--notes "Official Rust plugin SDK $VERSION for Lithe plugin backends. Requires Rust 1.87 or newer and depends only on serde_json and base64. Depend on the tag through Git, or pin the archive by its SHA-256 (\`$asset.sha256\`) and vendor the unpacked crate; see shared/plugins/sdk/rust/README.md."
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Plugin SDKs
2+
3+
# The plugin contract, developer guides and official SDKs live in
4+
# shared/plugins next to the Rust Core that executes the contract, so every
5+
# change is tested against Core at the same commit. Only changes that can
6+
# affect them start this workflow.
7+
on:
8+
pull_request:
9+
paths:
10+
- 'shared/plugins/**'
11+
- 'rust/**'
12+
- '.github/workflows/plugins-verify.yml'
13+
push:
14+
branches: [main]
15+
paths:
16+
- 'shared/plugins/**'
17+
- 'rust/**'
18+
- '.github/workflows/plugins-verify.yml'
19+
workflow_dispatch:
20+
21+
permissions:
22+
contents: read
23+
24+
concurrency:
25+
group: plugins-verify-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
docs:
30+
name: Contract and docs
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 10
33+
steps:
34+
- uses: actions/checkout@v7
35+
- uses: actions/setup-node@v6
36+
with:
37+
node-version: 22
38+
39+
- name: Test the tooling
40+
run: node --test shared/plugins/scripts/*.test.mjs
41+
- name: Check schema IDs and links
42+
run: node shared/plugins/scripts/verify-docs.mjs
43+
44+
sdk-node:
45+
name: Node.js SDK
46+
runs-on: ubuntu-latest
47+
timeout-minutes: 10
48+
steps:
49+
- uses: actions/checkout@v7
50+
# The SDK supports Node.js 20.3 and newer, so it is tested on the oldest
51+
# supported major.
52+
- uses: actions/setup-node@v6
53+
with:
54+
node-version: 20
55+
56+
- name: Test
57+
run: node --test shared/plugins/sdk/node/test/*.test.mjs
58+
- name: Check TypeScript consumers
59+
run: |
60+
npm ci --prefix shared/plugins/sdk/node --ignore-scripts --no-audit --no-fund
61+
npm run --prefix shared/plugins/sdk/node test:types
62+
63+
sdk-java:
64+
name: Java SDK
65+
runs-on: ubuntu-latest
66+
timeout-minutes: 15
67+
steps:
68+
- uses: actions/checkout@v7
69+
# The SDK supports Java 8: the tests run on a Java 8 runtime, while
70+
# Maven builds with the newer JDK set up last.
71+
- name: Set up Java 8 runtime
72+
id: java8
73+
uses: actions/setup-java@v5
74+
with:
75+
distribution: temurin
76+
java-version: '8'
77+
- name: Set up Java 21 for Maven
78+
uses: actions/setup-java@v5
79+
with:
80+
distribution: temurin
81+
java-version: '21'
82+
83+
- name: Build and test on Java 8
84+
env:
85+
JAVA8: ${{ steps.java8.outputs.path }}/bin/java
86+
run: mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify -Djvm="$JAVA8"
87+
88+
sdk-rust:
89+
name: Rust SDK
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 15
92+
steps:
93+
- uses: actions/checkout@v7
94+
# The SDK supports Rust 1.87 and newer: the tests run on that release,
95+
# and formatting and lints on the current stable toolchain.
96+
- uses: dtolnay/rust-toolchain@1.87
97+
- name: Test on the oldest supported Rust
98+
run: cargo +1.87 test --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml
99+
- uses: dtolnay/rust-toolchain@stable
100+
with:
101+
components: clippy, rustfmt
102+
- name: Check formatting and lints
103+
run: |
104+
cargo fmt --manifest-path shared/plugins/sdk/rust/Cargo.toml --all -- --check
105+
cargo clippy --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml --all-targets -- -D warnings
106+
107+
sdk-e2e:
108+
name: SDK end-to-end with Rust Core
109+
runs-on: ubuntu-latest
110+
timeout-minutes: 40
111+
steps:
112+
- uses: actions/checkout@v7
113+
- uses: actions/setup-node@v6
114+
with:
115+
node-version: 20
116+
- name: Set up Java 8 runtime
117+
id: java8
118+
uses: actions/setup-java@v5
119+
with:
120+
distribution: temurin
121+
java-version: '8'
122+
- name: Set up Java 21 for Maven
123+
uses: actions/setup-java@v5
124+
with:
125+
distribution: temurin
126+
java-version: '21'
127+
- uses: dtolnay/rust-toolchain@stable
128+
129+
- uses: actions/cache@v6
130+
with:
131+
path: |
132+
~/.cargo/registry
133+
~/.cargo/git
134+
rust/target
135+
shared/plugins/sdk/rust/target
136+
key: sdk-e2e-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock', 'shared/plugins/sdk/rust/Cargo.lock') }}
137+
restore-keys: sdk-e2e-${{ runner.os }}-
138+
139+
- name: Run the SDK scenarios against this Core
140+
env:
141+
LITHE_PLUGIN_SDK_JAVA_RUNTIME: ${{ steps.java8.outputs.path }}/bin/java
142+
run: node shared/plugins/scripts/sdk-e2e.mjs

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
/.artifacts/
22
/rust/target/
33
/scripts/rust-core/comment-lexer/target/
4+
node_modules/
5+
/shared/plugins/sdk/java/**/target/
6+
/shared/plugins/sdk/rust/target/
7+
*.tmp
8+
.DS_Store

0 commit comments

Comments
 (0)