Skip to content

Commit ae0bc77

Browse files
feat: add WebSocket support for logging and service status and chrome extension
- Implemented a WebSocket server in the daemon to handle real-time log and status updates. - Created a new composable `useWebSocket` in the Vue panel for managing WebSocket connections. - Added HTML and main entry point for the Vue application. - Integrated Tailwind CSS for styling the panel. - Updated TypeScript configuration for Vue and WebSocket types. - Enhanced the runner to manage service states and commands via WebSocket. - Added commands for starting, stopping, and restarting services through WebSocket. - Improved error handling and race condition prevention in service management.
1 parent 36ad1b4 commit ae0bc77

File tree

25 files changed

+1288
-38
lines changed

25 files changed

+1288
-38
lines changed

.claude/settings.local.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
"Bash(go list:*)",
1717
"Bash(make test:*)",
1818
"Bash(make lint:*)",
19-
"WebSearch"
19+
"WebSearch",
20+
"Bash(go get:*)",
21+
"WebFetch(domain:golangci-lint.run)",
22+
"Bash(pnpm build:*)",
23+
"Bash(cat:*)"
2024
]
2125
},
2226
"enableAllProjectMcpServers": true,

.github/workflows/ci.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
if: "!startsWith(github.event.head_commit.message, 'chore: release')"
1616
steps:
17-
- uses: actions/checkout@v5
17+
- uses: actions/checkout@v6
1818

1919
- name: Set up Go
2020
uses: actions/setup-go@v6
@@ -32,7 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
if: "!startsWith(github.event.head_commit.message, 'chore: release')"
3434
steps:
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636

3737
- name: Set up Go
3838
uses: actions/setup-go@v6
@@ -63,7 +63,7 @@ jobs:
6363
goarch: amd64
6464

6565
steps:
66-
- uses: actions/checkout@v5
66+
- uses: actions/checkout@v6
6767

6868
- name: Set up Go
6969
uses: actions/setup-go@v6
@@ -80,3 +80,37 @@ jobs:
8080
else
8181
go build -o devir ./cmd/devir
8282
fi
83+
84+
extension:
85+
name: Build Extension
86+
runs-on: ubuntu-latest
87+
if: "!startsWith(github.event.head_commit.message, 'chore: release')"
88+
steps:
89+
- uses: actions/checkout@v6
90+
91+
- name: Setup Node.js
92+
uses: actions/setup-node@v6
93+
with:
94+
node-version: "22"
95+
96+
- name: Setup pnpm
97+
uses: pnpm/action-setup@v4
98+
with:
99+
version: 10
100+
101+
- name: Install dependencies
102+
run: cd extension && pnpm install
103+
104+
- name: Build extension
105+
run: cd extension && pnpm build
106+
107+
- name: Create extension zip
108+
run: |
109+
cd extension/dist
110+
zip -r ../../devir-extension.zip .
111+
112+
- name: Upload extension artifact
113+
uses: actions/upload-artifact@v6
114+
with:
115+
name: devir-extension
116+
path: devir-extension.zip

.github/workflows/release.yml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
name: devir-windows-amd64
3333

3434
steps:
35-
- uses: actions/checkout@v5
35+
- uses: actions/checkout@v6
3636

3737
- name: Set up Go
3838
uses: actions/setup-go@v6
@@ -74,12 +74,45 @@ jobs:
7474
*.tar.gz
7575
*.zip
7676
77+
extension:
78+
name: Build Extension
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v6
82+
83+
- name: Setup Node.js
84+
uses: actions/setup-node@v6
85+
with:
86+
node-version: "22"
87+
88+
- name: Setup pnpm
89+
uses: pnpm/action-setup@v4
90+
with:
91+
version: 10
92+
93+
- name: Install dependencies
94+
run: cd extension && pnpm install
95+
96+
- name: Build extension
97+
run: cd extension && pnpm build
98+
99+
- name: Create extension zip
100+
run: |
101+
cd extension/dist
102+
zip -r ../../devir-extension.zip .
103+
104+
- name: Upload extension artifact
105+
uses: actions/upload-artifact@v6
106+
with:
107+
name: devir-extension
108+
path: devir-extension.zip
109+
77110
release:
78111
name: Release
79-
needs: build
112+
needs: [build, extension]
80113
runs-on: ubuntu-latest
81114
steps:
82-
- uses: actions/checkout@v5
115+
- uses: actions/checkout@v6
83116
with:
84117
fetch-depth: 0
85118

@@ -175,7 +208,7 @@ jobs:
175208
echo "LINUX_AMD64=$LINUX_AMD64" >> $GITHUB_OUTPUT
176209
177210
- name: Checkout homebrew-tap
178-
uses: actions/checkout@v5
211+
uses: actions/checkout@v6
179212
with:
180213
repository: productdevbook/homebrew-tap
181214
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}

cmd/devir/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var (
2727
showHelp bool
2828
showVersion bool
2929
mcpMode bool
30+
wsPort int
3031
)
3132

3233
func init() {
@@ -36,6 +37,7 @@ func init() {
3637
flag.BoolVar(&showHelp, "h", false, "Show help")
3738
flag.BoolVar(&showVersion, "v", false, "Show version")
3839
flag.BoolVar(&mcpMode, "mcp", false, "Run as MCP server")
40+
flag.IntVar(&wsPort, "ws-port", daemon.DefaultWSPort, "WebSocket server port (0 to disable)")
3941
}
4042

4143
func main() {
@@ -98,7 +100,7 @@ func runMCPMode(cfg *config.Config, socketPath string) {
98100
}
99101

100102
// Start new daemon + MCP
101-
d := daemon.New(cfg, socketPath)
103+
d := daemon.NewWithWSPort(cfg, socketPath, wsPort)
102104
if err := d.Start(); err != nil {
103105
fmt.Fprintf(os.Stderr, "Failed to start daemon: %v\n", err)
104106
os.Exit(1)
@@ -164,7 +166,7 @@ func runTUIMode(cfg *config.Config, socketPath string) {
164166
}
165167

166168
// No existing daemon - start new daemon + TUI
167-
d := daemon.New(cfg, socketPath)
169+
d := daemon.NewWithWSPort(cfg, socketPath, wsPort)
168170
if err := d.Start(); err != nil {
169171
fmt.Fprintf(os.Stderr, "Failed to start daemon: %v\n", err)
170172
os.Exit(1)
@@ -234,6 +236,7 @@ Options:
234236
-filter <p> Show only logs matching pattern
235237
-exclude <p> Hide logs matching pattern
236238
-mcp Run as MCP server (daemon mode)
239+
-ws-port <n> WebSocket server port (default: 9222, 0 to disable)
237240
-v Show version
238241
-h Show this help
239242

extension/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "devir-extension",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"scripts": {
6+
"dev": "vite",
7+
"build": "vite build",
8+
"preview": "vite preview"
9+
},
10+
"dependencies": {
11+
"vue": "^3.5.26"
12+
},
13+
"devDependencies": {
14+
"@tailwindcss/vite": "^4.1.18",
15+
"@vitejs/plugin-vue": "^6.0.3",
16+
"tailwindcss": "^4.1.18",
17+
"typescript": "^5.9.3",
18+
"vite": "8.0.0-beta.7",
19+
"vue-tsc": "^3.2.2"
20+
}
21+
}

extension/public/icons/icon.svg

Lines changed: 4 additions & 0 deletions
Loading

extension/public/icons/icon128.png

2.1 KB
Loading

extension/public/icons/icon16.png

334 Bytes
Loading

extension/public/icons/icon48.png

823 Bytes
Loading

extension/public/manifest.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "Devir Logs",
4+
"version": "1.0.0",
5+
"description": "View devir service logs in Chrome DevTools",
6+
"devtools_page": "devtools.html",
7+
"web_accessible_resources": [{
8+
"resources": ["panel.html"],
9+
"matches": ["<all_urls>"]
10+
}],
11+
"permissions": [],
12+
"host_permissions": [
13+
"ws://localhost:9222/*",
14+
"ws://127.0.0.1:9222/*"
15+
],
16+
"icons": {
17+
"16": "icons/icon16.png",
18+
"48": "icons/icon48.png",
19+
"128": "icons/icon128.png"
20+
}
21+
}

0 commit comments

Comments
 (0)