How Shire Reimagines AI‑Powered Programming with a New DSL
This article introduces Shire, a domain‑specific language and framework that orchestrates AI agents across IDEs and DevOps toolchains, explaining its motivations, core features, practical code examples, and architectural components to boost software development efficiency.
Motivation
AI‑assisted coding tools have become fragmented: many agents are built for isolated tasks such as requirement generation, code generation, or code review, but they cannot cooperate with each other or with commercial assistants. Shire is designed to orchestrate these agents across platforms and embed them directly into software‑development workflows.
Shire Overview
Shire is a domain‑specific language (DSL) and runtime that abstracts IDE interactions, tool functions, and AI model calls. It enables developers to write declarative scripts that invoke local or remote agents, process their output, and integrate the results with version‑control, testing, or deployment pipelines.
Key Features
Custom team assistants – Prompts are expressed as code and can be stored globally (e.g., ~/.shire) or version‑controlled alongside source code.
Rich tool ecosystem – Built‑in support for Git, database access, PlantUML, WireMock, and other common development utilities, exposed as variables and functions.
AI upstream/downstream orchestration – Combines AI agents, local files, and knowledge bases to enrich context for model generation and to feed results back into DevOps pipelines.
Rapid prototyping – One‑click prompts in the IDE generate functional prototypes or code snippets without leaving the editor.
IDE Interaction Example
The script below defines a context‑menu agent that receives a SonarLint issue, asks the model to suggest a refactor, parses the returned code, and shows a diff against the original file.
---
name: "重构代码"
actionLocation: ContextMenu
onStreamingEnd: { parseCode | diff($filePath, $output) }
---
请你这段代码建议适当的重构。提高代码的可读性、质量,使代码更加有组织和易懂。你的回答应包含重构描述和一个代码片段,展示重构后的结果。
以下是静态代码分析的问题: $sonarIssue
待重构的代码: $selectionWhen the model finishes, parseCode extracts the code block and diff displays the changes in the IDE.
Orchestration Example – Designing a RESTful API
This script demonstrates a multi‑step workflow: fetch a user story from a remote agent, feed it to the CodeGeex‑4 model, parse the generated Swagger definition, save it to docs/api.yml, and open the file in the IDE.
---
name: "设计 RESTful API"
variables:
"story": /any/ { thread(".shire/shell/dify-epic-story.curl.sh") | jsonpath("$.answer", true) }
onStreamingEnd: { parseCode | saveFile("docs/api.yml") | openFile }
model: "codegeex-4"
---
你是一个资深的开发人员,根据用户故事设计 RESTful API。请使用 Swagger 格式返回设计的 API。The thread function can invoke remote agents (e.g., a curl‑based story generator) or local agents such as thread("generate-story.shire").
Architecture
IDE interface abstraction – Normalizes communication with IDE APIs, UI extensions, and tool‑function bindings.
Plugin & tool ecosystem – Provides language‑specific plugins (Java, Python, etc.) and integrates external tools like Git, Database, PlantUML, WireMock.
Tool & framework functions – Exposes development utilities as reusable functions and variables for scripts.
Shire Runtime – Includes the DSL interpreter, large‑model manager, task orchestrator, and environment‑variable manager.
IDE base layer – Leverages the underlying IDE platform for AST handling, UI actions, and file operations.
Installation & Resources
Shire is distributed as an IntelliJ IDEA plugin. Install it from the IDEA plugin marketplace, then write Shire scripts directly in the IDE. The source code, releases, and issue tracker are hosted on GitHub:
https://github.com/phodal/shire
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
phodal
A prolific open-source contributor who constantly starts new projects. Passionate about sharing software development insights to help developers improve their KPIs. Currently active in IDEs, graphics engines, and compiler technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
