Skip to content

Commit d340734

Browse files
committed
🔧 Refresh kettle-jem templates
1 parent 2e58732 commit d340734

173 files changed

Lines changed: 5181 additions & 1856 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.

.aiignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# An .aiignore file follows the same syntax as a .gitignore file.
2+
# .gitignore documentation: https://git-scm.com/docs/gitignore
3+
4+
# you can ignore files
5+
.DS_Store
6+
*.log
7+
*.tmp
8+
9+
# or folders
10+
.devcontainer/
11+
.qlty/
12+
.yardoc/
13+
dist/
14+
build/
15+
out/
16+
coverage/
17+
docs/
18+
pkg/
19+
results/

.config/mise/env.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# shellcheck shell=bash
2+
3+
prepend_unique_path_value() {
4+
local value="$1"
5+
local current="$2"
6+
7+
if [[ -z "$current" ]]; then
8+
printf '%s' "$value"
9+
elif [[ ":$current:" == *":$value:"* ]]; then
10+
printf '%s' "$current"
11+
else
12+
printf '%s:%s' "$value" "$current"
13+
fi
14+
}
15+
16+
# Preserve existing values while prepending the project defaults needed by TreeHaver.
17+
_tree_sitter_runtime_lib="${TREE_SITTER_RUNTIME_LIB:-/home/linuxbrew/.linuxbrew/Cellar/tree-sitter/0.26.6/lib/libtree-sitter.so}"
18+
_tree_sitter_runtime_dir="$(dirname "${_tree_sitter_runtime_lib}")"
19+
_tree_sitter_java_jars_dir="${TREE_SITTER_JAVA_JARS_DIR:-}"
20+
21+
if [[ -n "${_tree_sitter_java_jars_dir}" ]]; then
22+
_tree_sitter_java_jar="${_tree_sitter_java_jars_dir}/jtreesitter-0.26.0.jar"
23+
export CLASSPATH="$(prepend_unique_path_value "${_tree_sitter_java_jar}" "${CLASSPATH:-}")"
24+
fi
25+
26+
export LD_LIBRARY_PATH="$(prepend_unique_path_value "${_tree_sitter_runtime_dir}" "${LD_LIBRARY_PATH:-}")"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "Apt Install Packages",
3+
"id": "apt-install",
4+
"version": "1.0.0",
5+
"description": "More packages are needed",
6+
"install": {
7+
"script": "install.sh"
8+
}
9+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
set -e # Exit on error
3+
4+
# Install basic development dependencies for Ruby & JRuby projects
5+
apt-get update -y
6+
apt-get install -y direnv default-jdk git zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
7+
8+
# Support for PostgreSQL (commented out by default)
9+
# apt-get install -y postgresql libpq-dev
10+
11+
# NOTE: Tree-sitter setup is NOT done here because the workspace is not mounted yet
12+
# during the devcontainer build phase. Tree-sitter setup happens in postCreateCommand
13+
# after the workspace is mounted. See devcontainer.json for details.
14+
# This gem needs ALL grammars for top-level merging tool (handled by setup-tree-sitter.sh).
15+
16+
echo "Basic apt packages installed. Tree-sitter will be set up after workspace mount."
17+
18+
# Adds the direnv setup script to ~/.bashrc file (at the end)
19+
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc

.devcontainer/devcontainer.json

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
22
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
33
{
4-
"name": "Ruby",
4+
"name": "Ruby",
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6-
"image": "mcr.microsoft.com/devcontainers/ruby:1-3-bookworm",
6+
"image": "mcr.microsoft.com/devcontainers/ruby:1-3-bookworm",
7+
// Features to add to the dev container. More info: https://containers.dev/features.
8+
"features": {
9+
"./apt-install": {}
10+
},
11+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
12+
// "forwardPorts": [],
13+
14+
// Use 'postCreateCommand' to run commands after the container is created.
15+
// First setup tree-sitter (auto-detects sudo requirement), then run bundle as the regular user
16+
// Use ${containerWorkspaceFolder} to get the actual workspace path in the container
17+
"postCreateCommand": "bash ${containerWorkspaceFolder}/.devcontainer/scripts/setup-tree-sitter.sh --workspace=${containerWorkspaceFolder} && bundle update --bundler",
718

819
// Features to add to the dev container. More info: https://containers.dev/features.
920
// "features": {},
@@ -15,11 +26,11 @@
1526
// "postCreateCommand": "ruby --version",
1627

1728
// Configure tool-specific properties.
18-
"customizations" : {
19-
"jetbrains" : {
20-
"backend" : "RubyMine"
29+
"customizations": {
30+
"jetbrains": {
31+
"backend": "RubyMine"
2132
}
22-
},
33+
}
2334

2435
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
2536
// "remoteUser": "root"
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Setup script for tree-sitter dependencies (Ubuntu/Debian)
5+
# Works for both GitHub Actions and devcontainer environments
6+
#
7+
# Dual-Environment Design:
8+
# - GitHub Actions: Runs as non-root user, auto-detects need for sudo
9+
# - Devcontainer: Can run as root (apt-install feature) or non-root (postCreateCommand)
10+
# - Auto-detection: Checks if running as root (id -u = 0), uses sudo if non-root
11+
#
12+
# Grammar building is delegated to tsdl (https://github.com/stackmystack/tsdl).
13+
# Configure grammars and versions in parsers.toml at the project root.
14+
#
15+
# Options:
16+
# --sudo: Force use of sudo (optional, auto-detected by default)
17+
# --cli: Install tree-sitter-cli via npm (optional)
18+
# --build: Build and install the tree-sitter C runtime from source when distro packages are missing (optional)
19+
# --tsdl-version VERSION: Pin tsdl release version (default: v2.0.0)
20+
# --workspace PATH: Workspace root path for informational/debugging purposes only
21+
22+
SUDO=""
23+
INSTALL_CLI=false
24+
BUILD_FROM_SOURCE=false
25+
TSDL_VERSION="v2.0.0"
26+
WORKSPACE_ROOT="/workspaces/${PWD##*/}"
27+
28+
while [[ $# -gt 0 ]]; do
29+
case $1 in
30+
--sudo) SUDO="sudo"; shift ;;
31+
--cli) INSTALL_CLI=true; shift ;;
32+
--build) BUILD_FROM_SOURCE=true; shift ;;
33+
--tsdl-version) TSDL_VERSION="$2"; shift 2 ;;
34+
--tsdl-version=*) TSDL_VERSION="${1#*=}"; shift ;;
35+
--workspace) WORKSPACE_ROOT="$2"; shift 2 ;;
36+
--workspace=*) WORKSPACE_ROOT="${1#*=}"; shift ;;
37+
*) echo "Unknown option: $1" >&2; shift ;;
38+
esac
39+
done
40+
41+
# Auto-detect if we need sudo (running as non-root)
42+
if [ -z "$SUDO" ] && [ "$(id -u)" -ne 0 ]; then
43+
SUDO="sudo"
44+
fi
45+
46+
echo "Configuration:"
47+
echo " Workspace root: $WORKSPACE_ROOT (informational only)"
48+
echo " Using sudo: $([ -n "$SUDO" ] && echo "yes" || echo "no")"
49+
echo " Install CLI: $INSTALL_CLI"
50+
echo " Build from source: $BUILD_FROM_SOURCE"
51+
echo " tsdl version: $TSDL_VERSION"
52+
echo ""
53+
54+
have_cmd() { command -v "$1" >/dev/null 2>&1; }
55+
56+
have_tree_sitter() {
57+
[ -f /usr/include/tree-sitter/api.h ] && return 0
58+
[ -f /usr/local/include/tree-sitter/api.h ] && return 0
59+
[ -f /usr/local/include/tree-sitter/lib/include/api.h ] && return 0
60+
ldconfig -p 2>/dev/null | grep -q libtree-sitter && return 0 || return 1
61+
}
62+
63+
install_tree_sitter_from_source() {
64+
echo "[tree-sitter] Building runtime from source..."
65+
tmpdir=$(mktemp -d /tmp/tree-sitter-src-XXXX)
66+
trap 'rm -rf "$tmpdir"' EXIT
67+
git clone --depth 1 https://github.com/tree-sitter/tree-sitter.git "$tmpdir" || return 1
68+
pushd "$tmpdir" >/dev/null || return 1
69+
if ! make; then
70+
echo "[tree-sitter] ERROR: 'make' failed" >&2
71+
popd >/dev/null
72+
return 1
73+
fi
74+
$SUDO mkdir -p /usr/local/include/tree-sitter
75+
$SUDO cp -r lib/include/* /usr/local/include/tree-sitter/ || true
76+
$SUDO cp -a lib/libtree-sitter.* /usr/local/lib/ 2>/dev/null || true
77+
have_cmd ldconfig && $SUDO ldconfig || true
78+
popd >/dev/null
79+
echo "[tree-sitter] Runtime installed to /usr/local."
80+
return 0
81+
}
82+
83+
install_tsdl() {
84+
if have_cmd tsdl; then
85+
echo "[tsdl] Already installed: $(tsdl --version)"
86+
return 0
87+
fi
88+
89+
echo "[tsdl] Installing tsdl ${TSDL_VERSION}..."
90+
local arch
91+
arch="$(uname -m)"
92+
case "$arch" in
93+
x86_64) arch="x64" ;;
94+
aarch64) arch="arm64" ;;
95+
armv7l) arch="arm" ;;
96+
i686) arch="x86" ;;
97+
*) echo "[tsdl] ERROR: Unsupported architecture: $arch" >&2; return 1 ;;
98+
esac
99+
100+
local os
101+
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
102+
case "$os" in
103+
linux) os="linux" ;;
104+
darwin) os="macos" ;;
105+
*) echo "[tsdl] ERROR: Unsupported OS: $os" >&2; return 1 ;;
106+
esac
107+
108+
local url="https://github.com/stackmystack/tsdl/releases/download/${TSDL_VERSION}/tsdl-${os}-${arch}.gz"
109+
local tmpbin
110+
tmpbin=$(mktemp /tmp/tsdl-XXXX)
111+
112+
if ! wget -q "$url" -O "${tmpbin}.gz"; then
113+
echo "[tsdl] ERROR: Failed to download from $url" >&2
114+
return 1
115+
fi
116+
gunzip -f "${tmpbin}.gz"
117+
chmod +x "$tmpbin"
118+
$SUDO mv "$tmpbin" /usr/local/bin/tsdl
119+
echo "[tsdl] Installed: $(tsdl --version)"
120+
}
121+
122+
# --- 1. System dependencies ---
123+
echo "Installing system dependencies..."
124+
$SUDO apt-get update -y
125+
if ! $SUDO apt-get install -y \
126+
build-essential \
127+
pkg-config \
128+
$( [ "$BUILD_FROM_SOURCE" = false ] && echo "libtree-sitter-dev" ) \
129+
wget \
130+
gcc \
131+
g++ \
132+
make \
133+
zlib1g-dev \
134+
libssl-dev \
135+
libreadline-dev \
136+
libyaml-dev \
137+
libxml2-dev \
138+
libxslt1-dev \
139+
libcurl4-openssl-dev \
140+
software-properties-common \
141+
libffi-dev; then
142+
echo "ERROR: apt-get failed to install required packages." >&2
143+
exit 1
144+
fi
145+
146+
# --- 2. Tree-sitter runtime ---
147+
if [ "$BUILD_FROM_SOURCE" = true ]; then
148+
echo "[tree-sitter] --build specified; building runtime from source."
149+
fi
150+
151+
if ! have_tree_sitter; then
152+
if [ "$BUILD_FROM_SOURCE" = true ]; then
153+
if ! install_tree_sitter_from_source; then
154+
echo "[tree-sitter] ERROR: Failed to build runtime. Aborting." >&2
155+
exit 1
156+
fi
157+
else
158+
echo "[tree-sitter] ERROR: Runtime (headers/libs) not found." >&2
159+
echo "Install libtree-sitter-dev or re-run with --build." >&2
160+
exit 1
161+
fi
162+
fi
163+
164+
# --- 3. tree-sitter-cli (optional) ---
165+
if [ "$INSTALL_CLI" = true ]; then
166+
echo "Installing tree-sitter-cli via npm..."
167+
$SUDO npm install -g tree-sitter-cli
168+
else
169+
echo "Skipping tree-sitter-cli (use --cli to install)"
170+
fi
171+
172+
# --- 4. Install tsdl and build grammars ---
173+
install_tsdl
174+
175+
echo ""
176+
echo "Building tree-sitter grammars via tsdl..."
177+
# Use parsers.toml from the project root if it exists, otherwise build defaults.
178+
# tsdl automatically reads parsers.toml in the current directory.
179+
if [ -f parsers.toml ]; then
180+
echo "[tsdl] Using parsers.toml config"
181+
$SUDO tsdl build --out-dir /usr/local/lib --progress plain
182+
else
183+
echo "[tsdl] No parsers.toml found; building default grammars: toml json bash rbs"
184+
$SUDO tsdl build toml json bash rbs --out-dir /usr/local/lib --progress plain
185+
fi
186+
187+
$SUDO ldconfig || echo "WARNING: ldconfig failed" >&2
188+
189+
echo ""
190+
echo "tree-sitter setup complete!"
191+
echo ""
192+
echo "Detected library paths:"
193+
194+
if [ -f /usr/lib/x86_64-linux-gnu/libtree-sitter.so.0 ]; then
195+
echo " TREE_SITTER_RUNTIME_LIB=/usr/lib/x86_64-linux-gnu/libtree-sitter.so.0"
196+
elif [ -f /usr/lib/x86_64-linux-gnu/libtree-sitter.so ]; then
197+
echo " TREE_SITTER_RUNTIME_LIB=/usr/lib/x86_64-linux-gnu/libtree-sitter.so"
198+
elif [ -f /usr/lib/libtree-sitter.so.0 ]; then
199+
echo " TREE_SITTER_RUNTIME_LIB=/usr/lib/libtree-sitter.so.0"
200+
elif [ -f /usr/lib/libtree-sitter.so ]; then
201+
echo " TREE_SITTER_RUNTIME_LIB=/usr/lib/libtree-sitter.so"
202+
else
203+
echo " WARNING: Could not find libtree-sitter runtime library!"
204+
fi
205+
206+
echo ""
207+
echo "Grammar libraries:"
208+
for lib in /usr/local/lib/libtree-sitter-*.so; do
209+
[ -f "$lib" ] && echo " $lib"
210+
done

.env.local.example

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#
2+
# DO NOT EDIT THIS FILE
3+
#
4+
# COPY THIS FILE TO .env.local
5+
#
6+
# That file is ignored by .gitignore. This file is not.
7+
# mise loads .env.local via dotenvy, so use KEY=value lines (not shell `export` statements).
8+
#
9+
DEBUG=false # do not allow byebug statements (override in .env.local)
10+
FLOSS_FUNDING_DEBUG=false # extra logging to help diagnose issues (override in .env.local)
11+
AUTOGEN_FIXTURE_CLEANUP=false # autogenerated gem fixture cleanup after every RSpec run
12+
GIT_HOOK_FOOTER_APPEND=false
13+
GIT_HOOK_FOOTER_APPEND_DEBUG=false
14+
GIT_HOOK_FOOTER_SENTINEL="⚡️ A message from a fellow meat-based-AI"
15+
16+
# Tokens used by ci:act and CI helpers for reading workflow/pipeline status via APIs
17+
# GitHub (either GITHUB_TOKEN or GH_TOKEN will be used; fine-grained recommended)
18+
# - Scope/permissions: For fine-grained tokens, grant repository access (Read) and Actions: Read
19+
# - For classic tokens, public repos need no scopes; private repos typically require repo
20+
GITHUB_TOKEN="<your GH token for GHA status; NEVER COMMIT>"
21+
# Alternatively:
22+
# GH_TOKEN="<your GH token>"
23+
24+
# GitLab (either GITLAB_TOKEN or GL_TOKEN will be used)
25+
# - Scope: read_api is sufficient to read pipelines
26+
GITLAB_TOKEN="<your GitLab token for pipeline status; NEVER COMMIT>"
27+
# Alternatively:
28+
# GL_TOKEN="<your GitLab token>"
29+
30+
# If this gem does not have an open source collective uncomment and set these to false.
31+
# OPENCOLLECTIVE_HANDLE=false
32+
# FUNDING_ORG=false
33+
34+
# ── Kettle-Jem Token Replacements ──────────────────────────────────────────────
35+
# Used by `apply_common_replacements` during templating.
36+
# Set these to your own values. Blank/unset values leave the token unresolved.
37+
38+
# ── Forge Users ────────────────────────────────────────────────────────────────
39+
# KJ_GH_USER=<your GitHub username>
40+
# KJ_GL_USER=<your GitLab username>
41+
# KJ_CB_USER=<your CodeBerg username>
42+
# KJ_SH_USER=<your SourceHut username>
43+
44+
# ── Author Identity ───────────────────────────────────────────────────────────
45+
# KJ_AUTHOR_NAME=<your full name>
46+
# KJ_AUTHOR_GIVEN_NAMES=<your given/first names>
47+
# KJ_AUTHOR_FAMILY_NAMES=<your family/last name>
48+
# KJ_AUTHOR_EMAIL=<your email>
49+
# KJ_AUTHOR_ORCID=<your ORCID identifier>
50+
# KJ_AUTHOR_DOMAIN=<your domain, e.g. example.com>
51+
52+
# ── Funding Platforms ─────────────────────────────────────────────────────────
53+
# KJ_FUNDING_PATREON=<your Patreon username>
54+
# KJ_FUNDING_KOFI=<your Ko-fi ID>
55+
# KJ_FUNDING_PAYPAL=<your PayPal.me username>
56+
# KJ_FUNDING_BUYMEACOFFEE=<your Buy Me a Coffee username>
57+
# KJ_FUNDING_POLAR=<your Polar username>
58+
# KJ_FUNDING_LIBERAPAY=<your Liberapay username>
59+
# KJ_FUNDING_ISSUEHUNT=<your IssueHunt username>
60+
61+
# ── Social / Community ────────────────────────────────────────────────────────
62+
# KJ_SOCIAL_MASTODON=<your Mastodon username>
63+
# KJ_SOCIAL_BLUESKY=<your Bluesky handle>
64+
# KJ_SOCIAL_LINKTREE=<your Linktree username>
65+
# KJ_SOCIAL_DEVTO=<your dev.to username>

.gemrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gem: --no-document

0 commit comments

Comments
 (0)