Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ on:
required: true
type: string
publish:
description: Publish after all public download gates pass
description: Publish the catalog package after native source qualification
default: false
type: boolean
qualified_commit:
description: Exact native-tested source SHA (required to publish)
default: ''
type: string
qualification_url:
description: Immutable public native-qualification receipt URL (required to publish)
default: ''
type: string
permissions:
contents: read
concurrency:
Expand All @@ -21,10 +29,17 @@ jobs:
verify:
runs-on: ubuntu-24.04
timeout-minutes: 30
outputs:
artifact-id: ${{ steps.package-upload.outputs.artifact-id }}
env:
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
SOURCE_REPO: ${{ github.repository }}
CARGO_BUILD_BUILD_DIR: target/build
RELEASE_EVENT: ${{ github.event_name }}
RELEASE_REF: ${{ github.ref }}
PUBLISH_REQUESTED: ${{ inputs.publish && 'true' || 'false' }}
QUALIFIED_COMMIT: ${{ inputs.qualified_commit }}
QUALIFICATION_URL: ${{ inputs.qualification_url }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
Expand All @@ -33,23 +48,30 @@ jobs:
persist-credentials: false
- run: bash scripts/ci.sh
- name: Verify public source and every raw pinned LSP download
run: python3 scripts/marketplace.py --tag "$RELEASE_TAG" --repo "$SOURCE_REPO" --out public-preflight
run: >-
python3 scripts/marketplace.py --tag "$RELEASE_TAG" --repo "$SOURCE_REPO"
--extension-path catalog/terraphim-lsp --out public-preflight
--release-event "$RELEASE_EVENT" --release-ref "$RELEASE_REF"
--release-publish "$PUBLISH_REQUESTED" --qualified-commit "$QUALIFIED_COMMIT"
--qualification-url "$QUALIFICATION_URL"
- name: Package the tested WASI module for this tag
run: python3 scripts/package.py --tag "$RELEASE_TAG" --wasm target/wasm32-wasip2/release/zed_terraphim.wasm --out-dir release-dist
run: python3 scripts/catalog_package.py --tag "$RELEASE_TAG" --wasm catalog/terraphim-lsp/target/wasm32-wasip2/release/zed_terraphim_lsp.wasm --out release-dist
- name: Bind package bytes to the tested module and tagged source
run: python3 scripts/package_qualification.py --tag "$RELEASE_TAG" --wasm target/wasm32-wasip2/release/zed_terraphim.wasm
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
run: python3 scripts/package_qualification.py --tag "$RELEASE_TAG" --extension-path catalog/terraphim-lsp --wasm catalog/terraphim-lsp/target/wasm32-wasip2/release/zed_terraphim_lsp.wasm
- id: package-upload
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: zed-release-${{ inputs.tag || github.ref_name }}
path: |
release-dist/*.tar.gz
release-dist/SHA256SUMS
release-dist/package-qualification.json
public-preflight/preflight.json
public-preflight/native-qualification.json
if-no-files-found: error
publish:
needs: verify
if: github.event_name == 'push' || inputs.publish
if: github.event_name == 'workflow_dispatch' && inputs.publish
runs-on: ubuntu-24.04
environment: zed-release
permissions:
Expand All @@ -65,12 +87,13 @@ jobs:
fetch-depth: 0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: zed-release-${{ inputs.tag || github.ref_name }}
artifact-ids: ${{ needs.verify.outputs.artifact-id }}
merge-multiple: true
path: verified-release
- name: Publish verified assets without replacing existing bytes
env:
GH_TOKEN: ${{ github.token }}
run: python3 scripts/publish_github.py --tag "$RELEASE_TAG" --repo "$SOURCE_REPO" --artifacts verified-release
run: python3 scripts/publish_github.py --tag "$RELEASE_TAG" --repo "$SOURCE_REPO" --artifacts verified-release --extension-path catalog/terraphim-lsp
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: zed-publication-${{ inputs.tag || github.ref_name }}
Expand Down
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ no separate knowledge-graph engine and does not require a Zed application fork.

In stock Zed, code actions swap existing KG synonyms and alternatives already
saved in a Markdown annotation. Hover, diagnostics and writing actions use the
shared LSP. For arbitrary new alternatives, the LSP exposes
`terraphim.alternative.add`: a client must collect the selection and new text,
invoke the command, and apply its returned edit. The current adapter provides no
input UI for that authoring command or the browser editor's visual panels.
shared LSP. To create an alternative, use `terraphim.alternative.add_and_apply`
in Zed's built-in LSP command picker: supply a JSON object with the document URI,
selection range and new text. The server asks Zed to apply the annotation edit.
See the [command-picker walkthrough](docs/alternative-authoring.md).
The original `terraphim.alternative.add` still returns an edit for clients that
apply it themselves. The adapter does not infer the current selection or provide
the browser editor's visual panels.
Alternatives and authored `synonyms::` relationships use Terraphim's existing
Rust types and crates.

## Publication status

This is scoped extension source with public build/release CI. It is not yet an
installable Zed registry entry. The current pin requires a new public LSP release
with graph export and native qualification before marketplace submission.
The public release workflow packages **Terraphim LSP**, the catalog variant.
[Released-package installation](docs/released-package-install.md) explains how
to verify and load its compiled WASM without rebuilding it. Official Zed catalog
availability requires a separate upstream review and registry build.

[Qualification evidence](docs/qualification.md) distinguishes source tests,
released-package installation and saved editor outputs. Each native receipt
identifies the exact extension source, WASM and language-server binary used.

Automatic provisioning supports macOS and Linux on x86_64 and ARM64. Windows
automatic provisioning is not qualified; an explicit binary path remains possible.
Expand All @@ -43,8 +51,9 @@ bash scripts/ci.sh
```

CI checks locked native/WASI builds, warnings-denied Clippy, actual package bytes
and publication regressions. Reviewed immutable tags drive GitHub releases after
anonymous dependency-download checks and artifact/source binding.
and publication regressions. Immutable tags run verification. A manual dispatch at the exact tag publishes
the catalog package after native source qualification, anonymous dependency
checks and artifact/source binding; retries reuse the original CI artifact.

[Marketplace instructions](docs/marketplace.md) describe the gates and Zed's
human-authored catalog submission requirement. [Qualification](docs/qualification.md)
Expand Down
21 changes: 18 additions & 3 deletions catalog/terraphim-lsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@ for Markdown in stock Zed. This catalog package uses the same Rust adapter and
pinned language server as the existing Terraphim extension. The language server
uses Terraphim's shared crates for alternatives and `synonyms::` relationships.

JSON and JSONC are attached only to track open export destinations. Unsaved
changes cause graph export to refuse the write, preserving the buffer and disk.
They do not receive Markdown alternatives, Lab analysis or diagnostics.

This package supplies the language server only. It downloads verified release
assets from GitHub, or uses the user's explicit `lsp.terraphim-lsp.binary.path`.
assets from fixed, pinned GitHub URLs without a metadata API request or PATH
fallback, or uses the user's explicit `lsp.terraphim-lsp.binary.path`.
It does not provide the browser editor's panels or an MCP server.

The language-server version is pinned in the shared adapter source. Each release
binds that dependency, the extension source and compiled package bytes in its
qualification receipt. See the repository's
[qualification evidence](https://github.com/terraphim/zed-terraphim/blob/main/docs/qualification.md).

## Install and migrate

For local qualification, choose **Extensions → Install Dev Extension** and select
this `catalog/terraphim-lsp` directory. A catalog listing is available only after
For a precompiled GitHub release, verify its checksums and select the extracted
four-file directory in **Extensions → Install Dev Extension**. It contains the
released `extension.wasm` and no Cargo source; Zed loads those exact bytes.
Follow the [released-package instructions](https://github.com/terraphim/zed-terraphim/blob/main/docs/released-package-install.md).

For source development, select this `catalog/terraphim-lsp` source directory
instead; Zed compiles a dev build. A catalog listing is available only after
Zed maintainers accept the submission and the registry build completes.

Remove/disable the legacy **Terraphim** extension before enabling **Terraphim LSP**:
Expand Down
3 changes: 2 additions & 1 deletion catalog/terraphim-lsp/extension.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ repository = "https://github.com/terraphim/zed-terraphim"

[language_servers.terraphim-lsp]
name = "Terraphim LSP"
languages = ["Markdown"]
languages = ["Markdown", "JSON", "JSONC"]
language_ids = { JSON = "json", JSONC = "jsonc" }

43 changes: 43 additions & 0 deletions docs/alternative-authoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Author a new alternative with Zed's command picker

Zed's built-in **lsp command selector: toggle** action can pass JSON arguments
to a language server. Terraphim LSP advertises
`terraphim.alternative.add_and_apply`, which asks Zed to apply the annotation
and confirms that the document changed. This uses the stock application.

For a Markdown file beginning with `Risk is manageable.`, open the command
palette, run **lsp command selector: toggle**, and select
`terraphim.alternative.add_and_apply`. Press Tab to focus **Arguments** and
enter one JSON object, replacing the URI with your open file's absolute URI:

```json
{"uri":"file:///path/to/brief.md","range":{"start":{"line":0,"character":0},"end":{"line":0,"character":4}},"text":"Concern"}
```

Press Enter, then save the document. The original sentence keeps its wording, while the Markdown annotation records `Concern` as its
alternative. The URI and range are explicit input: the picker does not infer
your selection. LSP line and character positions start at zero; character
offsets use UTF-16. An optional `version` rejects a stale document version.

You can then select the word and use its alternative code action to swap the
wording. Save/reopen preserves the annotation; normal undo and redo apply to
the edit. Run `terraphim.export_knowledge_graph` through the same picker with:

```json
{"uri":"file:///path/to/brief.md"}
```

Save the generated `brief.knowledge-graph.json`. Its `risk` and `concern`
entries share a concept ID; released `terraphim-grep` can consume that graph.
The source document retains its annotation.

The original `terraphim.alternative.add` returns a WorkspaceEdit for clients
that apply it themselves. Zed's generic picker only logs a command's return
value, so use the explicit `add_and_apply` variant here. It requires versioned
edits and client apply support. A rejection or stale document is reported as a
failure. If acknowledgement or the matching document change times out, inspect
the document before retrying: the edit may still arrive. A successful command
returns an acknowledgement rather than a second edit to apply.

The pinned server is the public RC7 release. Versioned native and package-install
evidence is recorded in [qualification.md](qualification.md); the [RC7 checklist](rc7-install-qualification.md) describes the release gates.
Loading
Loading