Skip to content

Commit 9916485

Browse files
authored
Merge pull request #15 from narumiruna/feat/pi-biome-lsp
feat: add Biome LSP extension
2 parents d01dee9 + eed4b3a commit 9916485

9 files changed

Lines changed: 1201 additions & 2 deletions

File tree

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
[![npm scope](https://img.shields.io/badge/npm-@narumitw-blue)](https://www.npmjs.com/org/narumitw) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
44

5-
Production-ready, independently installable [Pi](https://pi.dev) extension packages for the Pi coding agent. This monorepo provides native Pi tools and commands for Chrome DevTools automation, Firecrawl web scraping, Python LSP diagnostics with ty and Ruff, goal-driven task completion, retry handling, terminal statuslines, and keep-awake automation.
5+
Production-ready, independently installable [Pi](https://pi.dev) extension packages for the Pi coding agent. This monorepo provides native Pi tools and commands for Biome LSP diagnostics, Chrome DevTools automation, Firecrawl web scraping, Python LSP diagnostics with ty and Ruff, goal-driven task completion, retry handling, terminal statuslines, and keep-awake automation.
66

77
## 📦 Pi extension packages
88

99
Install only the Pi extensions you need. Each package is published under the `@narumitw` npm scope and can be installed directly with `pi install npm:<package>`.
1010

1111
| Pi extension | What it adds | Install |
1212
| --- | --- | --- |
13+
| [`@narumitw/pi-biome-lsp`](./extensions/pi-biome-lsp) | 🧬 Biome language-server tools for diagnostics, formatting, import organization, and source fixes. | `pi install npm:@narumitw/pi-biome-lsp` |
1314
| [`@narumitw/pi-btw`](./extensions/pi-btw) | 💬 `/btw` side-question command for asking quick questions without polluting the main conversation. | `pi install npm:@narumitw/pi-btw` |
1415
| [`@narumitw/pi-caffeinate`](./extensions/pi-caffeinate) | ☕ Cross-platform sleep prevention while the Pi agent is processing long-running prompts. | `pi install npm:@narumitw/pi-caffeinate` |
1516
| [`@narumitw/pi-chrome-devtools`](./extensions/pi-chrome-devtools) | 🌐 Native Chrome DevTools Protocol tools for listing tabs, navigating pages, evaluating JavaScript, and taking screenshots. | `pi install npm:@narumitw/pi-chrome-devtools` |
@@ -37,11 +38,15 @@ pi -e npm:@narumitw/pi-statusline
3738
Use multiple Pi extensions together:
3839

3940
```bash
40-
pi -e npm:@narumitw/pi-goal -e npm:@narumitw/pi-statusline -e npm:@narumitw/pi-python-lsp
41+
pi -e npm:@narumitw/pi-goal -e npm:@narumitw/pi-statusline -e npm:@narumitw/pi-python-lsp -e npm:@narumitw/pi-biome-lsp
4142
```
4243

4344
## 🛠️ Extension use cases
4445

46+
### 🧬 JavaScript and TypeScript coding with Biome
47+
48+
Use [`@narumitw/pi-biome-lsp`](./extensions/pi-biome-lsp) to let Pi run Biome diagnostics through `biome lsp-proxy`, format supported files, organize imports, and apply safe Biome source fixes.
49+
4550
### 🌐 Browser automation and debugging
4651

4752
Use [`@narumitw/pi-chrome-devtools`](./extensions/pi-chrome-devtools) when you want the Pi agent to inspect browser tabs, navigate web apps, run JavaScript in Chrome, or capture screenshots through the Chrome DevTools Protocol.
@@ -83,6 +88,7 @@ npm run check
8388
Try a package locally:
8489

8590
```bash
91+
pi -e ./extensions/pi-biome-lsp
8692
pi -e ./extensions/pi-btw
8793
pi -e ./extensions/pi-caffeinate
8894
pi -e ./extensions/pi-chrome-devtools
@@ -97,6 +103,7 @@ pi -e ./extensions/pi-subagents
97103
Preview npm package contents before publishing:
98104

99105
```bash
106+
npm run pack:biome-lsp
100107
npm run pack:btw
101108
npm run pack:caffeinate
102109
npm run pack:chrome-devtools
@@ -112,6 +119,7 @@ npm run pack:subagents
112119

113120
```txt
114121
extensions/
122+
├── pi-biome-lsp/
115123
├── pi-btw/
116124
├── pi-caffeinate/
117125
├── pi-chrome-devtools/

extensions/pi-biome-lsp/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 narumiruna
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

extensions/pi-biome-lsp/README.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# 🧬 pi-biome-lsp — Biome Language Server Tools for Pi
2+
3+
[![npm](https://img.shields.io/npm/v/@narumitw/pi-biome-lsp)](https://www.npmjs.com/package/@narumitw/pi-biome-lsp) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4+
5+
`@narumitw/pi-biome-lsp` is a native [Pi coding agent](https://pi.dev) extension that exposes [Biome](https://biomejs.dev/) language-server tools.
6+
7+
Use it to give Pi Biome diagnostics, formatting, import organization, and safe source fixes through Language Server Protocol (LSP) workflows.
8+
9+
## ✨ Features
10+
11+
- Runs `biome lsp-proxy` on demand for diagnostics.
12+
- Computes or writes formatting edits for Biome-supported files.
13+
- Computes or writes Biome source actions such as `source.fixAll.biome` and `source.organizeImports.biome`.
14+
- Supports workspace roots, file limits, and recursive file discovery.
15+
- Starts the language server only for tool calls, then shuts it down.
16+
- Provides clear setup errors when Biome is missing.
17+
18+
## 📦 Install
19+
20+
```bash
21+
pi install npm:@narumitw/pi-biome-lsp
22+
```
23+
24+
Try without installing permanently:
25+
26+
```bash
27+
pi -e npm:@narumitw/pi-biome-lsp
28+
```
29+
30+
Try this package locally from the repository root:
31+
32+
```bash
33+
pi -e ./extensions/pi-biome-lsp
34+
```
35+
36+
## ✅ Requirements
37+
38+
Install Biome somewhere on `PATH`, for example:
39+
40+
```bash
41+
npm install -D @biomejs/biome
42+
```
43+
44+
Or provide a custom server command:
45+
46+
```bash
47+
PI_BIOME_LSP_COMMAND="npx biome lsp-proxy" pi -e ./extensions/pi-biome-lsp
48+
```
49+
50+
Optional timeout override:
51+
52+
```bash
53+
PI_BIOME_LSP_TIMEOUT_MS=30000 pi -e ./extensions/pi-biome-lsp
54+
```
55+
56+
## 🛠️ Pi tools
57+
58+
- `biome_lsp_diagnostics` — start `biome lsp-proxy`, open supported files, and return diagnostics.
59+
- `biome_lsp_format` — compute or write formatting edits for one file.
60+
- `biome_lsp_fix` — compute or write source actions such as `source.fixAll.biome` or `source.organizeImports.biome`.
61+
62+
## 🚀 Examples
63+
64+
Check a project subset with Biome diagnostics:
65+
66+
```json
67+
{
68+
"paths": ["src", "extensions/pi-biome-lsp/src"],
69+
"limit": 100
70+
}
71+
```
72+
73+
Format a TypeScript file with Biome:
74+
75+
```json
76+
{
77+
"path": "src/index.ts",
78+
"write": true
79+
}
80+
```
81+
82+
Organize imports with Biome:
83+
84+
```json
85+
{
86+
"path": "src/index.ts",
87+
"kind": "source.organizeImports.biome",
88+
"write": true
89+
}
90+
```
91+
92+
If `paths` is omitted for diagnostics, the tool recursively discovers Biome-supported files under the workspace root, skipping common generated and dependency directories.
93+
94+
## 💬 Command
95+
96+
```text
97+
/biome-lsp
98+
```
99+
100+
Shows the configured Biome LSP command and whether it is available on `PATH`.
101+
102+
## 🗂️ Package layout
103+
104+
```txt
105+
extensions/pi-biome-lsp/
106+
├── src/
107+
│ └── biome-lsp.ts
108+
├── README.md
109+
├── LICENSE
110+
├── tsconfig.json
111+
└── package.json
112+
```
113+
114+
## 🔎 Keywords
115+
116+
Pi extension, Pi coding agent, Biome LSP, Biome formatter, Biome linter, import organization, Language Server Protocol, AI coding tools.
117+
118+
## 📄 License
119+
120+
MIT. See [`LICENSE`](./LICENSE).
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "@narumitw/pi-biome-lsp",
3+
"version": "0.1.9",
4+
"description": "Pi extension that exposes Biome language-server tools for diagnostics, formatting, and fixes.",
5+
"type": "module",
6+
"license": "MIT",
7+
"private": false,
8+
"keywords": [
9+
"pi-package",
10+
"pi-extension",
11+
"pi",
12+
"biome",
13+
"lsp",
14+
"lint",
15+
"format"
16+
],
17+
"files": [
18+
"src",
19+
"README.md",
20+
"LICENSE"
21+
],
22+
"pi": {
23+
"extensions": [
24+
"./src/biome-lsp.ts"
25+
]
26+
},
27+
"scripts": {
28+
"check": "biome check . && npm run typecheck",
29+
"format": "biome check --write .",
30+
"typecheck": "tsc --noEmit"
31+
},
32+
"dependencies": {
33+
"typebox": "^1.1.37"
34+
},
35+
"devDependencies": {
36+
"@biomejs/biome": "2.4.14",
37+
"@mariozechner/pi-coding-agent": "0.73.0",
38+
"@types/node": "25.6.0",
39+
"typescript": "6.0.3"
40+
},
41+
"repository": {
42+
"type": "git",
43+
"url": "https://github.com/narumiruna/pi-extensions",
44+
"directory": "extensions/pi-biome-lsp"
45+
}
46+
}

0 commit comments

Comments
 (0)