From f5baa7ac156afb6eb1088d1157f909ec72a137cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:55:48 +0000 Subject: [PATCH 1/3] Initial plan From a8da52da8ce6f984dba5832ebec61c35a7cbb106 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:59:16 +0000 Subject: [PATCH 2/3] Create .github/copilot-instructions.md with repository context Co-authored-by: retog <110756+retog@users.noreply.github.com> --- .github/copilot-instructions.md | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..086fc4c --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,75 @@ +# Copilot Instructions + +## Project Overview + +Turtle-Hook is a service that updates a SPARQL endpoint to reflect changes to RDF-Turtle files in a GitHub repository. It provides a webhook and web/REST interface using the [ghact](https://deno.land/x/ghact) library. + +## Technology Stack + +- **Runtime**: [Deno](https://deno.land/) (TypeScript runtime) +- **Language**: TypeScript +- **HTTP Framework**: ghact (GitHub Action/Webhook framework for Deno) +- **Triple Store**: Blazegraph (SPARQL endpoint) +- **Container**: Docker + +## Project Structure + +- `src/` - Source code + - `main.ts` - Application entry point, creates GHActServer + - `worker.ts` - Worker that processes jobs (LOAD/DROP SPARQL operations) + - `deps.ts` - External dependencies (re-exports from ghact) +- `config/` - Configuration files + - `config.ts` - Application configuration (SPARQL endpoint, source repository) +- `Dockerfile` - Container definition +- `.devcontainer/` - VS Code dev container configuration + +## Code Style and Conventions + +- Use TypeScript with Deno +- Import external dependencies through `src/deps.ts` +- Use URL imports for Deno modules (e.g., `https://deno.land/x/...`) +- Follow Deno's built-in formatter and linter (`deno fmt`, `deno lint`) +- Prefer `const` over `let` where possible +- Use arrow functions for callbacks and short functions + +## Running the Application + +```bash +# Run the main server +deno run --allow-net --allow-read --allow-write --allow-run=git --allow-env src/main.ts + +# Format code +deno fmt + +# Lint code +deno lint + +# Cache dependencies +deno cache src/deps.ts +``` + +## Docker + +```bash +# Build the Docker image +docker build -t turtle-hook . + +# Run the container +docker run -p 4505:4505 turtle-hook +``` + +## Key Concepts + +- **SPARQL Operations**: The worker handles three types of operations on `.ttl` files: + - `LOAD` - For newly added files + - `DROP` - For removed files + - `UPDATE` (DROP + LOAD) - For modified files +- **Graph URIs**: Generated from the file name, prefixed with `https://treatment.plazi.org/id`. This prefix should not be changed as removing previous versions depends on it remaining consistent. +- **Jobs**: Processed asynchronously via Web Workers + +## Contribution Guidelines + +- Keep dependencies minimal and use Deno-compatible modules +- Test changes with Docker build to ensure compatibility +- Maintain backwards compatibility with the SPARQL endpoint interface +- Update `src/deps.ts` when adding new external dependencies From 4aa07c2799c1451b72dd77a75daba8c110da41d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Dec 2025 15:06:20 +0000 Subject: [PATCH 3/3] Make SPARQL endpoint reference generic instead of Blazegraph-specific Co-authored-by: retog <110756+retog@users.noreply.github.com> --- .github/copilot-instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 086fc4c..5f30705 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -9,7 +9,7 @@ Turtle-Hook is a service that updates a SPARQL endpoint to reflect changes to RD - **Runtime**: [Deno](https://deno.land/) (TypeScript runtime) - **Language**: TypeScript - **HTTP Framework**: ghact (GitHub Action/Webhook framework for Deno) -- **Triple Store**: Blazegraph (SPARQL endpoint) +- **Triple Store**: Any SPARQL 1.1 compliant endpoint - **Container**: Docker ## Project Structure