Skip to content
Back to search

wren-engine

This repository has been merged into Canner/WrenAI under the core/ directory

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/canner--wren-engine/badge.svg)](/listings/canner--wren-engine)

HTML

<a href="/listings/canner--wren-engine"><img src="/api/listings/canner--wren-engine/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 269 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Wren Engine — Archived
  2. > **This repository has been merged into [Canner/WrenAI](https://github.com/Canner/WrenAI) under the `core/` directory and is now archived (read-only).**
  3. >
  4. > New issues and PRs → [Canner/WrenAI](https://github.com/Canner/WrenAI/issues)
  5. > Full migration details (path mapping, archived modules, rationale) → [discussion #1592](https://github.com/Canner/wren-engine/discussions/1592)
  6. ---
  7. <p align="center">
  8. <a href="https://getwren.ai">
  9. <picture>
  10. <source media="(prefers-color-scheme: light)" srcset="./misc/wrenai_logo.png">
  11. <img src="./misc/wrenai_logo.png" alt="Wren AI logo">
  12. </picture>
  13. <h1 align="center">Wren Engine</h1>
  14. </a>
  15. </p>
  16. <p align="center">
  17. The open context engine for AI agents
  18. </p>
  19. <p align="center">
  20. <a aria-label="Follow us" href="https://x.com/getwrenai">
  21. <img alt="" src="https://img.shields.io/badge/-@getwrenai-blue?style=for-the-badge&logo=x&logoColor=white&labelColor=gray&logoWidth=20">
  22. </a>
  23. <a aria-label="License" href="https://github.com/Canner/wren-engine/blob/main/LICENSE">
  24. <img alt="" src="https://img.shields.io/github/license/canner/wren-engine?color=blue&style=for-the-badge">
  25. </a>
  26. <a aria-label="Join the community on GitHub" href="https://discord.gg/5DvshJqG8Z">
  27. <img alt="" src="https://img.shields.io/badge/-JOIN%20THE%20COMMUNITY-blue?style=for-the-badge&logo=discord&logoColor=white&labelColor=grey&logoWidth=20">
  28. </a>
  29. <a aria-label="Canner" href="https://cannerdata.com/">
  30. <img src="https://img.shields.io/badge/%F0%9F%A7%A1-Made%20by%20Canner-blue?style=for-the-badge">
  31. </a>
  32. </p>
  33. > Wren Engine is the open foundation behind [Wren AI](https://github.com/Canner/WrenAI): a semantic, governed, agent-ready context layer for business data.
  34. https://github.com/user-attachments/assets/037f2317-d8e5-41f2-9563-1e0bce4ef50c
  35. ## Why Wren Engine
  36. AI agents can already call tools, browse docs, and write code. What they still struggle with is business context.
  37. Enterprise data is not just rows in a warehouse. It is definitions, metrics, relationships, permissions, lineage, and intent. An agent that can connect to PostgreSQL or Snowflake still does not know what "net revenue", "active customer", or "pipeline coverage" actually mean in your company.
  38. This is not just our thesis. In [Your Data Agents Need Context](https://a16z.com/your-data-agents-need-context/), a16z argues that data agents break down when they only have connectivity and SQL generation, but lack business definitions, source-of-truth context, and the operational knowledge that explains how a company actually runs.
  39. <p align="center">
  40. <img width="888" height="678" alt="before Wren Engine Challenge" src="https://github.com/user-attachments/assets/62e2cbe6-ee28-4417-ba69-805de35d3187" />
  41. </p>
  42. Wren Engine exists to solve that gap.
  43. It gives AI agents a context engine they can reason over, so they can:
  44. - understand models instead of raw tables
  45. - use trusted metrics instead of inventing SQL
  46. - follow relationships instead of guessing joins
  47. - respect governance instead of bypassing it
  48. - turn natural language into accurate, explainable data access
  49. This is the open source context engine for teams building the next generation of agent experiences.
  50. ## The Vision
  51. We believe the future of AI is not tool calling alone. It is context-rich systems where agents can reason, retrieve, plan, and act on top of a shared understanding of business reality.
  52. Wren Engine is our open source contribution to that future.
  53. <p align="center">
  54. <img width="1267" height="705" alt="with_wren_engine" src="https://github.com/user-attachments/assets/3a6531fe-4731-4f21-ae9a-786b219f3c0e" />
  55. </p>
  56. It is the semantic and execution foundation beneath Wren AI, and it is designed to be useful well beyond a single product:
  57. - embedded in MCP servers and agent workflows
  58. - connected to modern warehouses, databases, and file systems
  59. - expressive enough to model business meaning through MDL
  60. - robust enough to support governed enterprise use cases
  61. - open enough for the community to extend, integrate, and build on
  62. If Wren AI is the full vision, Wren Engine is the open core that makes that vision interoperable.
  63. ## What Wren Engine Does
  64. Wren Engine turns business data into agent-usable context.
  65. <p align="center">
  66. <img width="2199" height="1537" alt="engine-architecture" src="https://github.com/user-attachments/assets/302351e7-9ac3-4916-99f6-972d33aee076" />
  67. </p>
  68. At a high level:
  69. 1. You describe your business domain with Wren's semantic model and MDL.
  70. 2. Wren Engine captures the context agents need: models, metrics, relationships, and access rules.
  71. 3. It analyzes intent and plans correct queries across your underlying data sources.
  72. 4. MCP clients and AI agents interact with that context through a clean interface.
  73. 5. Teams keep refining the model as business logic and systems evolve.
  74. This is the practical open source path from text-to-SQL toward context-aware data agents.
  75. That means your agent is no longer asking, "Which raw table should I query?"
  76. It is asking, "Which business concept, metric, or governed slice of context do I need to answer this task correctly?"
  77. ## Built For Agent Builders
  78. Wren Engine is especially useful for the open source community building agent-native workflows in tools like:
  79. - OpenClaw
  80. - Claude Code
  81. - VS Code
  82. - Claude Desktop
  83. - Cline
  84. - Cursor
  85. If your environment can speak MCP, call HTTP APIs, or embed a semantic service, Wren Engine can become the context layer behind your agent.
  86. Use it to power experiences like:
  87. - natural-language analytics with trusted business definitions
  88. - AI copilots that can answer questions across governed enterprise data
  89. - agents that generate dashboards, reports, and workflow decisions
  90. - code assistants that need real business context, not just schema dumps
  91. - internal AI tools that should be grounded in semantic models instead of ad hoc SQL
  92. This is especially important in developer-facing agent environments, where the assistant may understand your codebase but still lacks the business context required to answer data questions correctly.
  93. ## Supported Data Sources
  94. Wren Engine is built to work across modern data stacks, including warehouses, databases, and file-based sources.
  95. Current open source support includes connectors such as:
  96. - Amazon S3
  97. - Apache Spark
  98. - Apache Doris
  99. - Athena
  100. - BigQuery
  101. - ClickHouse
  102. - Databricks
  103. - DuckDB
  104. - Google Cloud Storage
  105. - Local files
  106. - MinIO
  107. - MySQL
  108. - Oracle
  109. - PostgreSQL
  110. - Redshift
  111. - SQL Server
  112. - Snowflake
  113. - Trino
  114. See the connector API docs in the project documentation for the latest connection schemas and capabilities.
  115. ## Get Started
  116. ### Use Wren Engine through AI Agents
  117. If you want to use Wren Engine from a Claude Code or other AI Agents, start here:
  118. - [Installation](https://docs.getwren.ai/oss/engine/get_started/installation)
  119. - [Quick start: Chat with jaffle_shop using Wren Engine + Claude Code](https://docs.getwren.ai/oss/engine/get_started/quickstart)
  120. - [Understanding Wren AI project structure](https://docs.getwren.ai/oss/engine/guide/modeling/wren_project)
  121. The MCP server includes:
  122. - a local Web UI for connection and MDL setup
  123. - read-only mode for safer agent usage
  124. - manifest deployment and validation tools
  125. - metadata tools for remote schema discovery
  126. ### Learn the concepts
  127. - [What is context?](https://docs.getwren.ai/oss/engine/concept/what_is_context)
  128. - [What is Modeling Definition Language (MDL)?](https://docs.getwren.ai/oss/engine/concept/what_is_mdl)
  129. - [Benefits of Wren Engine with LLMs](https://docs.getwren.ai/oss/engine/concept/benefits_llm)
  130. - [Your Data Agents Need Context](https://a16z.com/your-data-agents-need-context/)
  131. - [Powering Semantic SQL for AI Agents with Apache DataFusion](https://getwren.ai/post/powering-semantic-sql-for-ai-agents-with-apache-datafusion)
  132. ## Wren Engine vs. Other Data Tools
  133. People often compare Wren Engine to catalog services like DataHub, raw database MCP servers, BI semantic tools, or text-to-SQL agents.
  134. The simple difference is:
  135. - those tools usually help an agent find data or generate SQL
  136. - Wren Engine helps an agent understand business meaning and produce the right query through a context engine
  137. | Tool type | What it gives the agent | What Wren Engine adds |
  138. | --- | --- | --- |
  139. | Data catalog services | Tables, columns, lineage, owners, descriptions | Business models, metrics, relationships, and governed query planning |
  140. | Raw database or schema access | Direct access to schemas and SQL execution | A business layer above raw tables so the agent does not have to guess intent |
  141. | BI or semantic tools | Curated metrics and entities for analytics workflows | An open context layer designed for MCP and agent workflows |
  142. | Text-to-SQL agents | Fast SQL generation from natural language | Better accuracy by grounding generation in explicit business definitions |
  143. Many teams will want both:
  144. - a catalog to inventory and document the data estate
  145. - Wren Engine to turn that data into agent-ready context
  146. Why that matters:
  147. - more accurate answers because joins and metrics are defined instead of guessed
  148. - more consistent answers because every agent uses the same business definitions
  149. - safer data access because governance can be carried into query planning
  150. - less prompt engineering because the context lives in the engine, not in the prompt
  151. Without Wren, an agent may know where the data is but still not know how to answer the question correctly.
  152. ## Repository Map
  153. This repository contains the core engine modules:
  154. | Module | What it does |
  155. | --- | --- |
  156. | [`wren-core`](./wren-core) | Rust context engine powered by Apache DataFusion for MDL analysis, planning, and optimization |
  157. | [`wren-core-base`](./wren-core-base) | Shared manifest and modeling types |
  158. | [`wren-core-py`](./wren-core-py) | PyO3 bindings that expose the engine to Python |
  159. | [`ibis-server`](./ibis-server/) | FastAPI server for query execution, validation, metadata, and connectors |
  160. | [`mcp-server`](./mcp-server/) | MCP server for AI agents and MCP-compatible clients |
  161. Supporting modules include `wren-core-legacy`, `example`, `mock-web-server`, and benchmarking utilities.
  162. ### Developer entry points
  163. - [`wren-core/README.md`](./wren-core/README.md)
  164. - [`wren-core-py/README.md`](./wren-core-py/README.md)
  165. - [`ibis-server/README.md`](./ibis-server/README.md)
  166. - [`mcp-server/README.md`](./mcp-server/README.md)
  167. ## Local Development
  168. Common workflows:
  169. ```bash
  170. # Rust context engine
  171. cd wren-core
  172. cargo check --all-targets
  173. # Python + connector server
  174. cd ibis-server
  175. just install
  176. just dev
  177. # MCP server
  178. cd mcp-server
  179. # see module README for uv-based setup
  180. ```
  181. ## Project Status
  182. Wren Engine is actively evolving in the open. The current focus is to make the context engine, execution path, and MCP integration stronger for real-world agent workflows.
  183. If you are building with agents today, this is a great time to get involved.
  184. ## Community
  185. - Join our [Discord community](https://discord.gg/5DvshJqG8Z)
  186. - Open a [GitHub issue](https://github.com/Canner/wren-engine/issues)
  187. - Explore [Wren AI](https://github.com/Canner/WrenAI) to see the broader product vision
  188. - Read the market thesis from a16z: [Your Data Agents Need Context](https://a16z.com/your-data-agents-need-context/)
  189. Wren Engine is for builders who believe AI needs better context, not just better prompts.
skills-archive/install.sh · Bundled script · 182 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # Install Wren Engine skills into your local AI agent skills directory.
  3. #
  4. # Usage:
  5. # ./install.sh # install all skills
  6. # ./install.sh wren-generate-mdl # install specific skills
  7. # ./install.sh --force wren-sql # overwrite without prompt
  8. # curl -fsSL https://raw.githubusercontent.com/Canner/wren-engine/main/skills-archive/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 8 on GitHub
  9. # curl -fsSL .../install.sh | bash -s -- wren-generate-mdl
  10. set -euo pipefail
  11. REPO="Canner/wren-engine"
  12. BRANCH="${WREN_SKILLS_BRANCH:-main}"
  13. DEST="${CLAUDE_SKILLS_DIR:-$HOME/.claude/skills}"
  14. ALL_SKILLS=(wren-generate-mdl wren-project wren-sql wren-mcp-setup wren-quickstart wren-connection-info wren-usage wren-http-api)
  15. # Parse --force flag and skill list from arguments
  16. FORCE=false
  17. SELECTED_SKILLS=()
  18. for arg in "$@"; do
  19. if [ "$arg" = "--force" ]; then
  20. FORCE=true
  21. else
  22. SELECTED_SKILLS+=("$arg")
  23. fi
  24. done
  25. if [ "${#SELECTED_SKILLS[@]}" -eq 0 ]; then
  26. SELECTED_SKILLS=("${ALL_SKILLS[@]}")
  27. fi
  28. # Validate requested skills
  29. for skill in "${SELECTED_SKILLS[@]}"; do
  30. valid=false
  31. for known in "${ALL_SKILLS[@]}"; do
  32. if [ "$skill" = "$known" ]; then valid=true; break; fi
  33. done
  34. if [ "$valid" = false ]; then
  35. echo "Unknown skill: $skill" >&2
  36. echo "Available: ${ALL_SKILLS[*]}" >&2
  37. exit 1
  38. fi
  39. done
  40. # Detect whether we are running from a local clone or piped via curl.
  41. # When piped, BASH_SOURCE[0] is empty or "/dev/stdin".
  42. SCRIPT_DIR=""
  43. if [ -n "${BASH_SOURCE[0]:-}" ] && [ "${BASH_SOURCE[0]}" != "/dev/stdin" ]; then
  44. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  45. fi
  46. # Locate index.json for dependency resolution (local or remote)
  47. INDEX_JSON=""
  48. if [ -n "$SCRIPT_DIR" ] && [ -f "$SCRIPT_DIR/index.json" ]; then
  49. INDEX_JSON="$SCRIPT_DIR/index.json"
  50. fi
  51. # Expand SELECTED_SKILLS to include dependencies declared in index.json.
  52. # Only runs when python3 is available and index.json is accessible.
  53. expand_with_deps() {
  54. local json_file="$1"
  55. shift
  56. local -a input=("$@")
  57. local -a result=()
  58. skill_in_result() {
  59. local s="$1"
  60. for r in "${result[@]:-}"; do [ "$r" = "$s" ] && return 0; done
  61. return 1
  62. }
  63. is_known_skill() {
  64. local s="$1"
  65. for known in "${ALL_SKILLS[@]}"; do [ "$s" = "$known" ] && return 0; done
  66. return 1
  67. }
  68. for skill in "${input[@]}"; do
  69. skill_in_result "$skill" || result+=("$skill")
  70. if [ -n "$json_file" ] && command -v python3 &>/dev/null; then
  71. while IFS= read -r dep; do
  72. [ -z "$dep" ] && continue
  73. is_known_skill "$dep" || continue
  74. if ! skill_in_result "$dep"; then
  75. echo " + $dep (dependency of $skill)" >&2
  76. result+=("$dep")
  77. fi
  78. done < <(python3 -c "
  79. import json, sys
  80. try:
  81. d = json.load(open(sys.argv[1]))
  82. s = next((x for x in d.get('skills', []) if x['name'] == sys.argv[2]), None)
  83. if s:
  84. for dep in s.get('dependencies', []):
  85. print(dep)
  86. except Exception:
  87. pass
  88. " "$json_file" "$skill" 2>/dev/null)
  89. fi
  90. done
  91. printf '%s\n' "${result[@]}"
  92. }
  93. # Only expand deps when installing specific skills (not the full set)
  94. if [ "${#SELECTED_SKILLS[@]}" -lt "${#ALL_SKILLS[@]}" ] && [ -n "$INDEX_JSON" ]; then
  95. EXPANDED=()
  96. while IFS= read -r line; do
  97. [ -n "$line" ] && EXPANDED+=("$line")
  98. done < <(expand_with_deps "$INDEX_JSON" "${SELECTED_SKILLS[@]}")
  99. SELECTED_SKILLS=("${EXPANDED[@]}")
  100. fi
  101. install_from_local() {
  102. local src="$1" skill="$2" dest_dir="$3"
  103. if [ "$FORCE" = false ] && [ -d "$dest_dir" ]; then
  104. echo " Skipping $skill (already exists). Use --force to overwrite."
  105. return
  106. fi
  107. rm -rf "$dest_dir"
  108. cp -r "$src/$skill" "$dest_dir"
  109. echo " Installed $skill"
  110. }
  111. install_from_archive() {
  112. local tmpdir="$1" skill="$2" dest_dir="$3"
  113. if [ "$FORCE" = false ] && [ -d "$dest_dir" ]; then
  114. echo " Skipping $skill (already exists). Use --force to overwrite."
  115. return
  116. fi
  117. if [ ! -d "$tmpdir/$skill" ]; then
  118. echo " Failed: $skill not found in archive" >&2
  119. return 1
  120. fi
  121. rm -rf "$dest_dir"
  122. cp -r "$tmpdir/$skill" "$dest_dir"
  123. echo " Installed $skill"
  124. }
  125. mkdir -p "$DEST"
  126. if [ -n "$SCRIPT_DIR" ] && [ -d "$SCRIPT_DIR/wren-generate-mdl" ]; then
  127. # ---- Local mode: copy directly from repo ----
  128. echo "Installing from local repo: $SCRIPT_DIR"
  129. echo "Destination: $DEST"
  130. echo ""
  131. for skill in "${SELECTED_SKILLS[@]}"; do
  132. install_from_local "$SCRIPT_DIR" "$skill" "$DEST/$skill"
  133. done
  134. else
  135. # ---- Remote mode: download GitHub archive ----
  136. echo "Downloading skills from GitHub ($REPO @ $BRANCH)..."
  137. echo "Destination: $DEST"
  138. echo ""
  139. tmpdir=$(mktemp -d)
  140. trap 'rm -rf "$tmpdir"' EXIT
  141. # Build the list of paths to extract from the tarball
  142. extract_paths=()
  143. for skill in "${SELECTED_SKILLS[@]}"; do
  144. extract_paths+=("wren-engine-${BRANCH}/skills-archive/${skill}")
  145. done
  146. curl -fsSL "https://github.com/$REPO/archive/refs/heads/$BRANCH.tar.gz" \
  147. | tar -xz -C "$tmpdir" --strip-components=2 "${extract_paths[@]}"
  148. for skill in "${SELECTED_SKILLS[@]}"; do
  149. install_from_archive "$tmpdir" "$skill" "$DEST/$skill"
  150. done
  151. fi
  152. echo ""
  153. echo "Done. Invoke skills in your AI client:"
  154. for skill in "${SELECTED_SKILLS[@]}"; do
  155. echo " /$skill"
  156. done
  157. echo ""
  158. echo "To update skills later, re-run with --force:"
  159. echo " curl -fsSL https://raw.githubusercontent.com/Canner/wren-engine/main/skills-archive/install.sh | bash -s -- --force"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 181 on GitHub
  160. echo "Or check for updates: each skill notifies you automatically when a newer version is available."
skills/install.sh · Bundled script · 187 lines · 2 findings marked
  1. #!/usr/bin/env bash
  2. # Install Wren Engine CLI skills into your local AI agent skills directory.
  3. #
  4. # Usage:
  5. # ./install.sh # install all skills
  6. # ./install.sh wren-usage # install specific skills
  7. # ./install.sh --force wren-usage # overwrite without prompt
  8. # curl -fsSL https://raw.githubusercontent.com/Canner/wren-engine/main/skills/install.sh | bash
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 8 on GitHub
  9. # curl -fsSL .../install.sh | bash -s -- wren-generate-mdl
  10. set -euo pipefail
  11. REPO="Canner/wren-engine"
  12. BRANCH="${WREN_SKILLS_BRANCH:-main}"
  13. DEST="${CLAUDE_SKILLS_DIR:-$HOME/.claude/skills}"
  14. ALL_SKILLS=(wren-dlt-connector wren-generate-mdl wren-onboarding wren-usage)
  15. # Parse --force flag and skill list from arguments
  16. FORCE=false
  17. SELECTED_SKILLS=()
  18. for arg in "$@"; do
  19. if [ "$arg" = "--force" ]; then
  20. FORCE=true
  21. else
  22. SELECTED_SKILLS+=("$arg")
  23. fi
  24. done
  25. if [ "${#SELECTED_SKILLS[@]}" -eq 0 ]; then
  26. SELECTED_SKILLS=("${ALL_SKILLS[@]}")
  27. fi
  28. # Validate requested skills
  29. for skill in "${SELECTED_SKILLS[@]}"; do
  30. valid=false
  31. for known in "${ALL_SKILLS[@]}"; do
  32. if [ "$skill" = "$known" ]; then valid=true; break; fi
  33. done
  34. if [ "$valid" = false ]; then
  35. echo "Unknown skill: $skill" >&2
  36. echo "Available: ${ALL_SKILLS[*]}" >&2
  37. exit 1
  38. fi
  39. done
  40. # Detect whether we are running from a local clone or piped via curl.
  41. SCRIPT_DIR=""
  42. if [ -n "${BASH_SOURCE[0]:-}" ] && [ "${BASH_SOURCE[0]}" != "/dev/stdin" ]; then
  43. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  44. fi
  45. # Locate index.json for dependency resolution (local or remote)
  46. INDEX_JSON=""
  47. INDEX_JSON_TMP=""
  48. if [ -n "$SCRIPT_DIR" ] && [ -f "$SCRIPT_DIR/index.json" ]; then
  49. INDEX_JSON="$SCRIPT_DIR/index.json"
  50. elif command -v curl &>/dev/null; then
  51. INDEX_JSON_TMP="$(mktemp)"
  52. if curl -fsSL "https://raw.githubusercontent.com/$REPO/$BRANCH/skills/index.json" -o "$INDEX_JSON_TMP" 2>/dev/null; then
  53. INDEX_JSON="$INDEX_JSON_TMP"
  54. else
  55. rm -f "$INDEX_JSON_TMP"
  56. INDEX_JSON_TMP=""
  57. fi
  58. fi
  59. # Expand SELECTED_SKILLS to include dependencies declared in index.json.
  60. expand_with_deps() {
  61. local json_file="$1"
  62. shift
  63. local -a input=("$@")
  64. local -a result=()
  65. skill_in_result() {
  66. local s="$1"
  67. for r in "${result[@]:-}"; do [ "$r" = "$s" ] && return 0; done
  68. return 1
  69. }
  70. is_known_skill() {
  71. local s="$1"
  72. for known in "${ALL_SKILLS[@]}"; do [ "$s" = "$known" ] && return 0; done
  73. return 1
  74. }
  75. for skill in "${input[@]}"; do
  76. skill_in_result "$skill" || result+=("$skill")
  77. if [ -n "$json_file" ] && command -v python3 &>/dev/null; then
  78. while IFS= read -r dep; do
  79. [ -z "$dep" ] && continue
  80. is_known_skill "$dep" || continue
  81. if ! skill_in_result "$dep"; then
  82. echo " + $dep (dependency of $skill)" >&2
  83. result+=("$dep")
  84. fi
  85. done < <(python3 -c "
  86. import json, sys
  87. try:
  88. d = json.load(open(sys.argv[1]))
  89. s = next((x for x in d.get('skills', []) if x['name'] == sys.argv[2]), None)
  90. if s:
  91. for dep in s.get('dependencies', []):
  92. print(dep)
  93. except Exception:
  94. pass
  95. " "$json_file" "$skill" 2>/dev/null)
  96. fi
  97. done
  98. printf '%s\n' "${result[@]}"
  99. }
  100. # Only expand deps when installing specific skills (not the full set)
  101. if [ "${#SELECTED_SKILLS[@]}" -lt "${#ALL_SKILLS[@]}" ] && [ -n "$INDEX_JSON" ]; then
  102. EXPANDED=()
  103. while IFS= read -r line; do
  104. [ -n "$line" ] && EXPANDED+=("$line")
  105. done < <(expand_with_deps "$INDEX_JSON" "${SELECTED_SKILLS[@]}")
  106. SELECTED_SKILLS=("${EXPANDED[@]}")
  107. fi
  108. install_from_local() {
  109. local src="$1" skill="$2" dest_dir="$3"
  110. if [ "$FORCE" = false ] && [ -d "$dest_dir" ]; then
  111. echo " Skipping $skill (already exists). Use --force to overwrite."
  112. return
  113. fi
  114. rm -rf "$dest_dir"
  115. cp -r "$src/$skill" "$dest_dir"
  116. echo " Installed $skill"
  117. }
  118. install_from_archive() {
  119. local tmpdir="$1" skill="$2" dest_dir="$3"
  120. if [ "$FORCE" = false ] && [ -d "$dest_dir" ]; then
  121. echo " Skipping $skill (already exists). Use --force to overwrite."
  122. return
  123. fi
  124. if [ ! -d "$tmpdir/$skill" ]; then
  125. echo " Failed: $skill not found in archive" >&2
  126. return 1
  127. fi
  128. rm -rf "$dest_dir"
  129. cp -r "$tmpdir/$skill" "$dest_dir"
  130. echo " Installed $skill"
  131. }
  132. mkdir -p "$DEST"
  133. if [ -n "$SCRIPT_DIR" ] && [ -d "$SCRIPT_DIR/wren-generate-mdl" ]; then
  134. # ---- Local mode: copy directly from repo ----
  135. echo "Installing from local repo: $SCRIPT_DIR"
  136. echo "Destination: $DEST"
  137. echo ""
  138. for skill in "${SELECTED_SKILLS[@]}"; do
  139. install_from_local "$SCRIPT_DIR" "$skill" "$DEST/$skill"
  140. done
  141. else
  142. # ---- Remote mode: download GitHub archive ----
  143. echo "Downloading skills from GitHub ($REPO @ $BRANCH)..."
  144. echo "Destination: $DEST"
  145. echo ""
  146. tmpdir=$(mktemp -d)
  147. trap 'rm -rf "$tmpdir"; [ -n "${INDEX_JSON_TMP:-}" ] && rm -f "$INDEX_JSON_TMP"' EXIT
  148. extract_paths=()
  149. for skill in "${SELECTED_SKILLS[@]}"; do
  150. extract_paths+=("wren-engine-${BRANCH}/skills/${skill}")
  151. done
  152. curl -fsSL "https://github.com/$REPO/archive/refs/heads/$BRANCH.tar.gz" \
  153. | tar -xz -C "$tmpdir" --strip-components=2 "${extract_paths[@]}"
  154. for skill in "${SELECTED_SKILLS[@]}"; do
  155. install_from_archive "$tmpdir" "$skill" "$DEST/$skill"
  156. done
  157. fi
  158. echo ""
  159. echo "Done. Invoke skills in your AI client:"
  160. for skill in "${SELECTED_SKILLS[@]}"; do
  161. echo " /$skill"
  162. done
  163. echo ""
  164. echo "To update skills later, re-run with --force:"
  165. echo " curl -fsSL https://raw.githubusercontent.com/Canner/wren-engine/main/skills/install.sh | bash -s -- --force"
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 187 on GitHub

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.