-
Notifications
You must be signed in to change notification settings - Fork 0
chore(excalidraw-skill): encode text-overlap + GitHub-SVG lessons; ad… #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| #!/usr/bin/env bash | ||
| # Rebuild diagram .png + .svg outputs from .excalidraw sources. | ||
| # | ||
| # Walks docs/*.excalidraw, regenerates the sibling .png + .svg for each file | ||
| # whose source is newer than its outputs (or whose outputs don't exist). | ||
| # Skips files that are already up-to-date. | ||
| # | ||
| # Usage: | ||
| # .claude/scripts/rebuild-diagrams.sh # incremental (only stale) | ||
| # .claude/scripts/rebuild-diagrams.sh --force # force-rebuild everything | ||
| # .claude/scripts/rebuild-diagrams.sh path.excalidraw # one file | ||
| # | ||
| # Requires the excalidraw-diagram skill's Playwright setup. If you've never | ||
| # rendered before: | ||
| # cd .claude/skills/excalidraw-diagram/references | ||
| # uv sync | ||
| # uv run playwright install chromium | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" | ||
| RENDER_SCRIPT="$REPO_ROOT/.claude/skills/excalidraw-diagram/references/render_excalidraw.py" | ||
| DOCS_DIR="$REPO_ROOT/docs" | ||
|
|
||
| if [ ! -f "$RENDER_SCRIPT" ]; then | ||
| echo "ERROR: render script not found at $RENDER_SCRIPT" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| FORCE=0 | ||
| TARGETS=() | ||
| for arg in "$@"; do | ||
| case "$arg" in | ||
| --force|-f) FORCE=1 ;; | ||
| *.excalidraw) TARGETS+=("$arg") ;; | ||
| *) echo "ignoring unknown arg: $arg" >&2 ;; | ||
| esac | ||
| done | ||
|
|
||
| # If no explicit targets, walk every .excalidraw under docs/. | ||
| if [ ${#TARGETS[@]} -eq 0 ]; then | ||
| while IFS= read -r -d '' f; do | ||
| TARGETS+=("$f") | ||
| done < <(find "$DOCS_DIR" -maxdepth 2 -name "*.excalidraw" -type f -print0 2>/dev/null) | ||
| fi | ||
|
|
||
| if [ ${#TARGETS[@]} -eq 0 ]; then | ||
| echo "No .excalidraw files found under $DOCS_DIR/" | ||
| exit 0 | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| # A file is stale if either output (.png or .svg) is older than the source, or | ||
| # either output doesn't exist. | ||
| is_stale() { | ||
| local src="$1" | ||
| local base="${src%.excalidraw}" | ||
| local png="${base}.png" | ||
| local svg="${base}.svg" | ||
| [ ! -f "$png" ] && return 0 | ||
| [ ! -f "$svg" ] && return 0 | ||
| [ "$src" -nt "$png" ] && return 0 | ||
| [ "$src" -nt "$svg" ] && return 0 | ||
| return 1 | ||
| } | ||
|
|
||
| rebuilt=0 | ||
| skipped=0 | ||
| failed=0 | ||
| cd "$REPO_ROOT/.claude/skills/excalidraw-diagram/references" | ||
| for src in "${TARGETS[@]}"; do | ||
| rel="${src#$REPO_ROOT/}" | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| if [ "$FORCE" -eq 0 ] && ! is_stale "$src"; then | ||
| echo " [skip] $rel (up-to-date)" | ||
| skipped=$((skipped + 1)) | ||
| continue | ||
| fi | ||
| echo " [build] $rel" | ||
| if uv run python "$RENDER_SCRIPT" "$src" >/dev/null 2>&1; then | ||
| rebuilt=$((rebuilt + 1)) | ||
| else | ||
| echo " FAILED — try running the command directly to see the error:" | ||
| echo " uv run python $RENDER_SCRIPT $src" | ||
| failed=$((failed + 1)) | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| done | ||
|
|
||
| echo | ||
| echo "Rebuilt: $rebuilt Skipped: $skipped Failed: $failed" | ||
|
|
||
| # Exit non-zero if anything failed so this script is CI-friendly. | ||
| [ "$failed" -eq 0 ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.