Skip to content

Commit 070c746

Browse files
Initial extensions repo setup
Extension manifests, highlight queries, tooling configs, and scripts. WASM grammar binaries are stored on CDN, not in git.
1 parent fe961d0 commit 070c746

95 files changed

Lines changed: 13777 additions & 0 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.

.github/workflows/build-index.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build Extensions Index
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-index:
13+
if: github.repository == 'athasdev/extensions'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Build extensions index
24+
run: bun scripts/build-extensions-index.ts
25+
26+
- name: Generate manifests
27+
run: bun scripts/generate-manifests.ts
28+
29+
- name: Commit changes
30+
run: |
31+
if git diff --quiet; then
32+
echo "No changes to commit"
33+
exit 0
34+
fi
35+
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
git add registry.json index.json manifests.json
40+
git commit -m "Update extensions catalog"
41+
git push

.github/workflows/deploy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy Extensions CDN
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
if: github.repository == 'athasdev/extensions'
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Deploy via SSH
14+
uses: appleboy/ssh-action@v1.0.3
15+
with:
16+
host: ${{ secrets.VPS_HOST }}
17+
username: ${{ secrets.VPS_USER }}
18+
key: ${{ secrets.VPS_SSH_KEY }}
19+
port: ${{ secrets.VPS_PORT || 22 }}
20+
envs: EXTENSIONS_CDN_ROOT
21+
script: |
22+
set -e
23+
git config --global --add safe.directory /srv/extensions
24+
cd /srv/extensions
25+
git stash push --include-untracked --message "auto-deploy-$(date +%s)" || true
26+
git pull --ff-only
27+
/root/.bun/bin/bun scripts/build-extensions-index.ts
28+
/root/.bun/bin/bun scripts/generate-manifests.ts
29+
if [ -n "${EXTENSIONS_CDN_ROOT:-}" ]; then
30+
/root/.bun/bin/bun scripts/deploy-extensions-cdn.ts
31+
else
32+
echo "EXTENSIONS_CDN_ROOT not set, skipping extensions CDN sync."
33+
fi
34+
env:
35+
EXTENSIONS_CDN_ROOT: ${{ secrets.EXTENSIONS_CDN_ROOT }}

.github/workflows/validate.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validate Extensions
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: oven-sh/setup-bun@v2
16+
with:
17+
bun-version: latest
18+
19+
- name: Validate extension manifests
20+
run: bun run scripts/validate.ts
21+
22+
- name: Check manifests.json is up to date
23+
run: |
24+
bun run scripts/generate-manifests.ts
25+
git diff --exit-code manifests.json || (echo "manifests.json is out of date. Run: bun run scripts/generate-manifests.ts" && exit 1)
26+
27+
- name: Check registry.json and index.json are up to date
28+
run: bun run scripts/build-extensions-index.ts --check

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# OS files
2+
.DS_Store
3+
Thumbs.db
4+
5+
# Node
6+
node_modules/
7+
8+
# Build artifacts
9+
dist/
10+
*.tgz
11+
12+
# WASM binaries (stored on CDN, not in git)
13+
*.wasm
14+
15+
# Editor files
16+
.idea/
17+
.vscode/
18+
*.sublime*
19+
20+
# Logs
21+
*.log

CONTRIBUTING.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Contributing Extensions
2+
3+
This repository contains extensions for the [Athas](https://athas.dev) editor. Extensions can provide language support (syntax highlighting, LSP, formatting, linting), themes, icon themes, snippets, keymaps, and more.
4+
5+
## Repository Structure
6+
7+
```
8+
extensions/
9+
bash/
10+
extension.json # Extension manifest
11+
parser.wasm # Tree-sitter WASM grammar
12+
highlights.scm # Tree-sitter highlight queries
13+
lua/
14+
extension.json # Extension manifest
15+
parser.wasm
16+
highlights.scm
17+
tooling.json # Platform-specific tooling (pre-built LSP, formatter, linter binaries)
18+
build.sh # Build script for tooling archives
19+
web-core/
20+
tooling.json # Shared LSP servers for HTML/CSS/JSON/YAML
21+
build.sh
22+
BUILD.md
23+
...
24+
registry.json # Extension registry
25+
index.json # Extension index (for marketplace)
26+
manifests.json # Combined manifests (auto-generated, do not edit manually)
27+
scripts/ # Validation and generation scripts
28+
```
29+
30+
- `extension.json` defines the extension manifest (category, capabilities, tool references)
31+
- `tooling.json` (optional) defines pre-built platform-specific binaries distributed as tarballs
32+
- Not every extension has a `tooling.json`. Extensions without one rely on runtime-installed tools
33+
34+
## Adding a New Extension
35+
36+
1. Create a folder under `extensions/` (lowercase, use underscores for multi-word names like `c_sharp`).
37+
38+
2. Add an `extension.json` manifest:
39+
40+
```json
41+
{
42+
"$schema": "https://athas.dev/schemas/extension.json",
43+
"id": "athas.mylang",
44+
"name": "MyLang",
45+
"displayName": "MyLang",
46+
"version": "1.0.0",
47+
"description": "MyLang language support with syntax highlighting",
48+
"publisher": "Athas",
49+
"categories": ["Language"],
50+
"languages": [
51+
{
52+
"id": "mylang",
53+
"extensions": [".ml"],
54+
"aliases": ["MyLang"]
55+
}
56+
],
57+
"capabilities": {
58+
"grammar": {
59+
"wasmPath": "parser.wasm",
60+
"highlightQuery": "highlights.scm"
61+
}
62+
}
63+
}
64+
```
65+
66+
3. Add the required files for your extension type (e.g., `parser.wasm` and `highlights.scm` for language extensions).
67+
68+
4. Update `registry.json` and `index.json` to include your extension.
69+
70+
5. Regenerate `manifests.json`:
71+
```bash
72+
bun run scripts/generate-manifests.ts
73+
```
74+
75+
6. Validate your extension:
76+
```bash
77+
bun run scripts/validate.ts
78+
```
79+
80+
## Extension Manifest Format
81+
82+
### Required Fields
83+
84+
| Field | Type | Description |
85+
|-------|------|-------------|
86+
| `id` | string | Unique identifier (format: `publisher.name`) |
87+
| `name` | string | Short name |
88+
| `version` | string | Semver version |
89+
| `categories` | string[] | Extension categories (`Language`, `Theme`, `Snippets`, `Keymaps`, etc.) |
90+
91+
### Categories
92+
93+
- `Language` - Language support (grammar, LSP, formatter, linter)
94+
- `Theme` - Editor themes
95+
- `Snippets` - Code snippets
96+
- `Keymaps` - Keyboard shortcut presets
97+
- `Formatter` - Code formatters
98+
- `Linter` - Code linters
99+
- `Other` - Everything else
100+
101+
### Language Capabilities
102+
103+
#### Grammar
104+
105+
```json
106+
"grammar": {
107+
"wasmPath": "parser.wasm",
108+
"highlightQuery": "highlights.scm"
109+
}
110+
```
111+
112+
#### LSP
113+
114+
```json
115+
"lsp": {
116+
"name": "pyright",
117+
"runtime": "bun",
118+
"package": "pyright",
119+
"args": ["--stdio"]
120+
}
121+
```
122+
123+
Supported runtimes: `bun`, `python`, `go`, `binary`
124+
125+
#### Formatter
126+
127+
```json
128+
"formatter": {
129+
"name": "black",
130+
"runtime": "python",
131+
"package": "black",
132+
"args": ["--stdin-filename", "${file}", "-"]
133+
}
134+
```
135+
136+
#### Linter
137+
138+
```json
139+
"linter": {
140+
"name": "ruff",
141+
"runtime": "python",
142+
"package": "ruff",
143+
"args": ["check", "--stdin-filename", "${file}", "--output-format", "json", "-"]
144+
}
145+
```
146+
147+
## Testing Locally
148+
149+
1. Clone this repository alongside the main Athas repo:
150+
```
151+
athasdev/
152+
athas/ # Main editor repo
153+
extensions/ # This repo
154+
```
155+
156+
2. Serve the extensions directory locally:
157+
```bash
158+
bunx serve .
159+
```
160+
161+
3. Point the editor to your local server:
162+
```bash
163+
VITE_PARSER_CDN_URL=http://localhost:3000/extensions bun run dev
164+
```
165+
166+
## Validation
167+
168+
```bash
169+
bun run scripts/validate.ts
170+
```
171+
172+
CI runs this automatically on pull requests.

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Athas Extensions
2+
3+
Extensions for the [Athas](https://athas.dev) editor.
4+
5+
## Structure
6+
7+
Each extension lives under `extensions/{name}/`:
8+
9+
```
10+
extensions/
11+
lua/
12+
extension.json # Extension manifest
13+
parser.wasm # Tree-sitter WASM grammar
14+
highlights.scm # Tree-sitter highlight queries
15+
tooling.json # Platform-specific tooling (LSP, formatter, linter binaries)
16+
build.sh # Build script for tooling archives
17+
```
18+
19+
Root-level files:
20+
21+
- `registry.json` / `index.json` - Extension registry for the marketplace
22+
- `manifests.json` - Combined manifests (auto-generated, do not edit manually)
23+
24+
## Scripts
25+
26+
```bash
27+
bun run scripts/validate.ts
28+
bun run scripts/generate-manifests.ts
29+
```
30+
31+
## Contributing
32+
33+
See [CONTRIBUTING.md](CONTRIBUTING.md).
34+
35+
## License
36+
37+
[GPL-3.0](LICENSE)

extensions/bash/extension.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://athas.dev/schemas/extension.json",
3+
"id": "athas.bash",
4+
"name": "Bash",
5+
"displayName": "Bash",
6+
"version": "1.0.0",
7+
"description": "Bash/Shell script support with syntax highlighting and LSP",
8+
"publisher": "Athas",
9+
"categories": ["Language"],
10+
"languages": [
11+
{
12+
"id": "bash",
13+
"extensions": [".sh", ".bash", ".zsh"],
14+
"aliases": ["Bash", "Shell", "sh"],
15+
"filenames": [".bashrc", ".zshrc", ".bash_profile", ".profile"]
16+
}
17+
],
18+
"capabilities": {
19+
"grammar": {
20+
"wasmPath": "parser.wasm",
21+
"highlightQuery": "highlights.scm"
22+
},
23+
"lsp": {
24+
"name": "bash-language-server",
25+
"runtime": "bun",
26+
"package": "bash-language-server",
27+
"args": ["start"]
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)