aboutsummaryrefslogtreecommitdiff
path: root/Zig.novaextension
diff options
context:
space:
mode:
authorDavid Czihak <git@dcz.at>2026-05-10 19:29:00 +0200
committerDavid Czihak <git@dcz.at>2026-05-10 19:29:00 +0200
commit5c1e8d1d8f47f1bf8c679198c26d31275da2b558 (patch)
tree6fb4b6efc1615cde243de5543e7c16a331bc4617 /Zig.novaextension
parent82901bb223b3592b847099d245495decfa0474c3 (diff)
Chore: Move build scripts to repo root scripts/
The dylib build scripts are development tools, not extension bundle assets. Moves them from Zig.novaextension/Scripts/ to scripts/ and updates paths so the dylib lands in Zig.novaextension/Syntaxes/. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'Zig.novaextension')
-rw-r--r--Zig.novaextension/README.md8
-rwxr-xr-xZig.novaextension/Scripts/build-parser.sh53
-rwxr-xr-xZig.novaextension/Scripts/update-parser.sh64
3 files changed, 4 insertions, 121 deletions
diff --git a/Zig.novaextension/README.md b/Zig.novaextension/README.md
index f4516ef..72865ee 100644
--- a/Zig.novaextension/README.md
+++ b/Zig.novaextension/README.md
@@ -85,20 +85,20 @@ The Tree-sitter parser is built from the vendored grammar snapshot under `vendor
Rebuild the parser dylib:
```sh
-./Scripts/build-parser.sh
+./scripts/build-parser.sh
```
Bump the vendored snapshot (and rebuild):
```sh
-./Scripts/update-parser.sh # upstream HEAD
-./Scripts/update-parser.sh <ref> # specific tag, branch, or SHA
+./scripts/update-parser.sh # upstream HEAD
+./scripts/update-parser.sh <ref> # specific tag, branch, or SHA
```
Validate the extension bundle:
```sh
-/Applications/Nova.app/Contents/SharedSupport/nova extension validate .
+/Applications/Nova.app/Contents/SharedSupport/nova extension validate Zig.novaextension/
```
## License
diff --git a/Zig.novaextension/Scripts/build-parser.sh b/Zig.novaextension/Scripts/build-parser.sh
deleted file mode 100755
index 5cd7039..0000000
--- a/Zig.novaextension/Scripts/build-parser.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-#
-# build-parser.sh — Compile the Nova-compatible tree-sitter-zig parser.
-#
-# Purpose:
-# Build vendor/tree-sitter-zig/src/parser.c into a universal macOS dylib
-# that Nova loads via its private SyntaxKit framework.
-#
-# What it does:
-# - clang -dynamiclib for arm64 + x86_64
-# - links against Nova’s SyntaxKit framework (from /Applications/Nova.app)
-# - sets rpath @loader_path/../Frameworks so the dylib finds SyntaxKit
-# when Nova loads it from the bundled extension
-# - ad-hoc codesigns the dylib (Gatekeeper requirement)
-# - writes the result to Syntaxes/libtree-sitter-zig.dylib
-#
-# Usage:
-# ./Scripts/build-parser.sh
-#
-# Environment overrides:
-# NOVA_APP Path to Nova.app (default: /Applications/Nova.app)
-# SDKROOT macOS SDK path (default: `xcrun --show-sdk-path`)
-#
-# Requirements:
-# macOS, Xcode Command Line Tools (clang + xcrun), Nova installed.
-
-set -eu
-
-ROOT="$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)"
-VENDOR_DIR="$ROOT/vendor/tree-sitter-zig"
-BUILD_DIR="$ROOT/build"
-OUTPUT="$ROOT/Syntaxes/libtree-sitter-zig.dylib"
-NOVA_APP="${NOVA_APP:-/Applications/Nova.app}"
-SDKROOT="${SDKROOT:-$(xcrun --show-sdk-path)}"
-
-mkdir -p "$BUILD_DIR"
-
-clang \
- -dynamiclib \
- -O2 \
- -fPIC \
- -arch arm64 \
- -arch x86_64 \
- -isysroot "$SDKROOT" \
- -I"$VENDOR_DIR/src" \
- -F"$NOVA_APP/Contents/Frameworks" \
- -framework SyntaxKit \
- -Wl,-rpath,@loader_path/../Frameworks \
- -o "$BUILD_DIR/libtree-sitter-zig.dylib" \
- "$VENDOR_DIR/src/parser.c"
-
-codesign --force --sign - "$BUILD_DIR/libtree-sitter-zig.dylib"
-cp "$BUILD_DIR/libtree-sitter-zig.dylib" "$OUTPUT"
diff --git a/Zig.novaextension/Scripts/update-parser.sh b/Zig.novaextension/Scripts/update-parser.sh
deleted file mode 100755
index 6e1fd63..0000000
--- a/Zig.novaextension/Scripts/update-parser.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-#
-# update-parser.sh — Bump vendored tree-sitter-zig and rebuild the dylib.
-#
-# Purpose:
-# Refresh the vendored snapshot under vendor/tree-sitter-zig/ to a newer
-# upstream commit, update VENDORING.md, and rebuild the parser dylib.
-#
-# What it does:
-# - clones tree-sitter-grammars/tree-sitter-zig into a temp dir
-# - checks out the requested ref (default: HEAD of the default branch)
-# - exits early if the upstream SHA matches the pinned SHA
-# - replaces src/, queries/, grammar.js, tree-sitter.json, LICENSE
-# with the upstream copies; leaves VENDORING.md and README.upstream.md
-# untouched
-# - rewrites the "Pinned commit:" line in VENDORING.md
-# - invokes build-parser.sh to rebuild Syntaxes/libtree-sitter-zig.dylib
-# - prints a GitHub compare link for the diff
-#
-# Usage:
-# ./Scripts/update-parser.sh # bump to upstream HEAD
-# ./Scripts/update-parser.sh <ref> # bump to a tag, branch, or SHA
-#
-# Caveats:
-# - any local edits inside the listed paths are overwritten — review
-# `git diff vendor/` afterwards before committing
-# - parses VENDORING.md by an exact "Pinned commit: <sha>" line prefix;
-# keep that line format intact
-#
-# Requirements:
-# git, plus everything build-parser.sh needs.
-
-set -eu
-
-ROOT="$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)"
-VENDOR_DIR="$ROOT/vendor/tree-sitter-zig"
-UPSTREAM="https://github.com/tree-sitter-grammars/tree-sitter-zig.git"
-REF="${1:-HEAD}"
-
-TMP="$(mktemp -d)"
-trap 'rm -rf "$TMP"' EXIT
-
-git clone --quiet "$UPSTREAM" "$TMP/repo"
-git -C "$TMP/repo" checkout --quiet "$REF"
-SHA="$(git -C "$TMP/repo" rev-parse HEAD)"
-
-OLD_SHA="$(awk '/^Pinned commit:/ {print $3}' "$VENDOR_DIR/VENDORING.md")"
-if [ "$SHA" = "$OLD_SHA" ]; then
- echo "Already at $SHA — nothing to do."
- exit 0
-fi
-
-for path in src queries grammar.js tree-sitter.json LICENSE; do
- rm -rf "$VENDOR_DIR/$path"
- cp -R "$TMP/repo/$path" "$VENDOR_DIR/$path"
-done
-
-sed -i.bak "s/^Pinned commit: .*/Pinned commit: $SHA/" "$VENDOR_DIR/VENDORING.md"
-rm "$VENDOR_DIR/VENDORING.md.bak"
-
-"$ROOT/Scripts/build-parser.sh"
-
-echo "Updated $OLD_SHA -> $SHA"
-echo "Compare: https://github.com/tree-sitter-grammars/tree-sitter-zig/compare/$OLD_SHA...$SHA"