Skip to content

Commit f83cbb3

Browse files
committed
Initial commit
0 parents  commit f83cbb3

File tree

10 files changed

+319
-0
lines changed

10 files changed

+319
-0
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Temporary files
2+
*.tmp
3+
*.temp
4+
.DS_Store
5+
Thumbs.db
6+
7+
# Test artifacts
8+
test/tmp/
9+
test/output/
10+
11+
# IDE/editor files
12+
.vscode/
13+
.idea/
14+
*.swp
15+
*.swo
16+
17+
# OS files
18+
*.log

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-09-25
9+
10+
### Added
11+
- Initial release of mise-eca-plugin
12+
- Support for all ECA platforms (Linux x64/ARM64, macOS Intel/Apple Silicon, Windows x64)
13+
- Automatic version detection from GitHub releases API
14+
- SHA256 checksum verification when available
15+
- Cross-platform installation with proper permissions
16+
- Installation verification to ensure binary works
17+
- Comprehensive test suite
18+
19+
### Features
20+
- Downloads ECA binaries from official GitHub releases
21+
- Uses static Linux builds for better compatibility
22+
- Sets executable permissions on Unix systems
23+
- Configures PATH environment variable
24+
- Supports all ECA release versions

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# mise-eca-plugin
2+
3+
A [mise](https://mise.jdx.dev) tool plugin for [ECA (Editor Code Assistant)](https://eca.dev).
4+
5+
## About ECA
6+
7+
ECA (Editor Code Assistant) is an AI-powered pair-programming tool that works with any editor. It provides:
8+
9+
- 📄 **Editor-agnostic**: protocol for any editor to integrate
10+
- ⚙️ **Single configuration**: Configure ECA making it work the same in any editor
11+
-**Chat interface**: ask questions, review code, work together to code
12+
-**Agentic**: let LLM work as an agent with its native tools and MCPs
13+
- 💉 **Context support**: giving more details about your code to the LLM
14+
- 🚀 **Multi models**: Login to OpenAI, Anthropic, Copilot, Ollama local models and many more
15+
16+
## Installation
17+
18+
```bash
19+
# Install the plugin
20+
mise plugin install eca https://github.com/USERNAME/mise-eca-plugin
21+
22+
# Install ECA
23+
mise install eca@latest
24+
mise use eca@latest
25+
26+
# Verify installation
27+
eca --version
28+
```
29+
30+
## Usage
31+
32+
After installation, you can use ECA with your preferred editor:
33+
34+
```bash
35+
# Start ECA server
36+
eca server
37+
38+
# Or use with editor plugins (Emacs, VSCode, Vim, IntelliJ)
39+
```
40+
41+
## Configuration
42+
43+
ECA can be configured globally or per project. See the [ECA documentation](https://eca.dev) for detailed configuration options.
44+
45+
## Supported Platforms
46+
47+
- Linux (x64, ARM64)
48+
- macOS (Intel, Apple Silicon)
49+
- Windows (x64)
50+
51+
## Testing
52+
53+
Run the test script to verify the plugin works:
54+
55+
```bash
56+
./test/test.sh
57+
```
58+
59+
## Publishing Releases
60+
61+
1. Update version in `metadata.lua`
62+
2. Create annotated git tag:
63+
```bash
64+
git tag -a v1.0.1 -m "Release v1.0.1"
65+
git push origin v1.0.1
66+
git push origin main
67+
```
68+
3. Create GitHub release with release notes
69+
70+
## Contributing
71+
72+
Pull requests welcome! Please run `./test/test.sh` before submitting.
73+
74+
## License
75+
76+
Apache-2.0 (same as ECA)

hooks/available.lua

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- hooks/available.lua
2+
function PLUGIN:Available(ctx)
3+
local http = require("http")
4+
local json = require("json")
5+
6+
-- Fetch releases from GitHub API
7+
local resp, err = http.get({
8+
url = "https://api.github.com/repos/editor-code-assistant/eca/releases"
9+
})
10+
11+
if err ~= nil then
12+
error("Failed to fetch releases from GitHub API: " .. err)
13+
end
14+
15+
if resp.status_code ~= 200 then
16+
error("GitHub API returned status " .. resp.status_code .. ": " .. resp.body)
17+
end
18+
19+
local releases = json.decode(resp.body)
20+
local result = {}
21+
22+
for i, release in ipairs(releases) do
23+
local version = release.tag_name
24+
-- Remove 'v' prefix if present
25+
version = version:gsub("^v", "")
26+
27+
local note = nil
28+
if release.prerelease then
29+
note = "Pre-release"
30+
elseif i == 1 then
31+
note = "Latest"
32+
end
33+
34+
table.insert(result, {
35+
version = version,
36+
note = note
37+
})
38+
end
39+
40+
return result
41+
end

hooks/env_keys.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- hooks/env_keys.lua
2+
function PLUGIN:EnvKeys(ctx)
3+
local mainPath = ctx.path
4+
5+
return {
6+
{
7+
key = "PATH",
8+
value = mainPath
9+
}
10+
}
11+
end

hooks/post_install.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- hooks/post_install.lua
2+
function PLUGIN:PostInstall(ctx)
3+
local sdkInfo = ctx.sdkInfo['eca']
4+
local path = sdkInfo.path
5+
6+
-- Set executable permissions on Unix systems
7+
if RUNTIME.osType ~= "Windows" then
8+
local result = os.execute("chmod +x " .. path .. "/eca")
9+
if result ~= 0 then
10+
error("Failed to set executable permissions on eca binary")
11+
end
12+
end
13+
14+
-- Verify installation by checking if binary exists and is executable
15+
local binary_path
16+
if RUNTIME.osType == "Windows" then
17+
binary_path = path .. "/eca.exe"
18+
else
19+
binary_path = path .. "/eca"
20+
end
21+
22+
-- Test that the binary works
23+
local test_cmd = binary_path .. " --version"
24+
local test_result = os.execute(test_cmd .. " > /dev/null 2>&1")
25+
if test_result ~= 0 then
26+
error("ECA binary installation verification failed")
27+
end
28+
end

hooks/pre_install.lua

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
-- hooks/pre_install.lua
2+
function PLUGIN:PreInstall(ctx)
3+
local version = ctx.version
4+
local http = require("http")
5+
6+
-- Determine platform using RUNTIME object
7+
local arch_token
8+
if RUNTIME.archType == "amd64" then
9+
arch_token = "amd64"
10+
elseif RUNTIME.archType == "arm64" then
11+
arch_token = "aarch64"
12+
else
13+
error("Unsupported architecture: " .. RUNTIME.archType)
14+
end
15+
16+
local os_token
17+
if RUNTIME.osType == "Windows" then
18+
os_token = "windows"
19+
elseif RUNTIME.osType == "Darwin" then
20+
os_token = "macos"
21+
elseif RUNTIME.osType == "Linux" then
22+
os_token = "linux"
23+
else
24+
error("Unsupported operating system: " .. RUNTIME.osType)
25+
end
26+
27+
-- Build filename based on platform
28+
local filename
29+
if os_token == "linux" then
30+
-- Use static build for better compatibility
31+
if arch_token == "amd64" then
32+
filename = "eca-native-static-linux-amd64.zip"
33+
else
34+
filename = "eca-native-linux-" .. arch_token .. ".zip"
35+
end
36+
else
37+
filename = "eca-native-" .. os_token .. "-" .. arch_token .. ".zip"
38+
end
39+
40+
-- Build download URL
41+
local url = "https://github.com/editor-code-assistant/eca/releases/download/v" .. version .. "/" .. filename
42+
43+
-- Fetch SHA256 checksum
44+
local sha256 = nil
45+
local checksum_url = url .. ".sha256"
46+
local checksum_resp, checksum_err = http.get({ url = checksum_url })
47+
48+
if checksum_err == nil and checksum_resp.status_code == 200 then
49+
-- Extract SHA256 from checksum file
50+
sha256 = checksum_resp.body:match("^(%w+)")
51+
end
52+
53+
return {
54+
version = version,
55+
url = url,
56+
sha256 = sha256,
57+
note = "Installing ECA " .. version .. " (" .. os_token .. "-" .. arch_token .. ")"
58+
}
59+
end

lib/helper.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- lib/helper.lua
2+
local M = {}
3+
4+
function M.get_arch()
5+
local arch = RUNTIME.archType
6+
if arch == "amd64" then
7+
return "amd64"
8+
elseif arch == "arm64" then
9+
return "aarch64"
10+
else
11+
return arch
12+
end
13+
end
14+
15+
function M.get_os()
16+
local os = RUNTIME.osType
17+
if os == "Windows" then
18+
return "windows"
19+
elseif os == "Darwin" then
20+
return "macos"
21+
else
22+
return "linux"
23+
end
24+
end
25+
26+
function M.get_platform()
27+
return M.get_os() .. "-" .. M.get_arch()
28+
end
29+
30+
return M

metadata.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- metadata.lua
2+
PLUGIN = {
3+
name = "eca",
4+
version = "1.0.0",
5+
description = "Editor Code Assistant (ECA) mise tool plugin",
6+
author = "YOUR_NAME",
7+
homepage = "https://eca.dev",
8+
repository = "https://github.com/editor-code-assistant/eca",
9+
}

test/test.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# test/test.sh
3+
set -e
4+
5+
echo "Testing ECA mise tool plugin..."
6+
7+
# Install the plugin locally
8+
mise plugin link eca . || true
9+
10+
# Test basic functionality
11+
mise install eca@latest
12+
mise use eca@latest
13+
14+
# Verify installation
15+
eca --version
16+
17+
# Test that eca server can start (basic check)
18+
timeout 5s eca server --help || echo "Server help command works"
19+
20+
echo "All tests passed!"
21+
22+
# Clean up
23+
mise plugin remove eca

0 commit comments

Comments
 (0)