Skip to content

Commit 7855289

Browse files
authored
Initial Commit (#1)
1 parent 290a098 commit 7855289

File tree

16 files changed

+2709
-1
lines changed

16 files changed

+2709
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-22",
3+
"updateContentCommand": {
4+
"matterbridge-install": "npm install -g matterbridge",
5+
"npm-install": "npm install"
6+
},
7+
"postStartCommand": {
8+
"npm-build": "npm run build",
9+
"npm-link": "npm link"
10+
}
11+
}

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: [ 20.x, 22.x, 24.x ]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm install -g matterbridge
21+
- run: npm ci
22+
- run: npm link matterbridge
23+
- run: npm run build

.github/workflows/codeql.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
analyze:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
actions: read
14+
contents: read
15+
security-events: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: github/codeql-action/init@v3
19+
with:
20+
languages: 'javascript'
21+
- uses: github/codeql-action/analyze@v3

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 24.x
18+
registry-url: https://registry.npmjs.org/
19+
- run: npm install -g matterbridge
20+
- run: npm ci
21+
- run: npm link matterbridge
22+
- run: npm publish --provenance --access public
23+
env:
24+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
bin
3+
node_modules

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": "always"
4+
},
5+
"eslint.format.enable": true,
6+
"[javascript]": {
7+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
8+
},
9+
"[typescript]": {
10+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
11+
}
12+
}

LICENSE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ISC License (ISC)
2+
Copyright (c) 2025 Michael Ahern
3+
4+
Permission to use, copy, modify, and/or distribute this software for any
5+
purpose with or without fee is hereby granted, provided that the above
6+
copyright notice and this permission notice appear in all copies.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14+
PERFORMANCE OF THIS SOFTWARE.

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# mb-service
1+
# Matterbridge Service Command
2+
3+
A service management command-line utility for [Matterbridge](https://github.com/Luligu/matterbridge/), inspired by the [Homebridge Service Command](https://github.com/homebridge/homebridge-config-ui-x/wiki/Homebridge-Service-Command) `hb-service`.
4+
5+
_This is currently experimental and only supports macOS with a default configuration at the moment!_
6+
7+
```
8+
% npm -g install matterbridge
9+
% git clone https://github.com/michaelahern/mb-service.git
10+
% cd mb-service
11+
% npm install
12+
% npm run build
13+
% npm link
14+
15+
% mb-service
16+
Usage: mb-service <command>
17+
Commands:
18+
install Install the Matterbridge service
19+
uninstall Uninstall the Matterbridge service
20+
start Start the Matterbridge service
21+
stop Stop the Matterbridge service
22+
restart Restart the Matterbridge service
23+
pid Get the process id of the Matterbridge service
24+
tail Tail the Matterbridge log file
25+
26+
% sudo mb-service install
27+
Matterbridge Service Installed!
28+
Starting Matterbridge Service...
29+
30+
Manage Matterbridge in your browser at:
31+
* http://localhost:8283
32+
* http://192.168.1.123:8283
33+
* http://[fd08:b744:dfe5::123]:8283
34+
```
35+
36+
## How This Project Uses `launchd` on macOS
37+
38+
On macOS, `mb-service` manages the Matterbridge service using the native `launchd` system. It creates a Launch Daemon configuration file at `/Library/LaunchDaemons/com.matterbridge.plist`. This file tells `launchd` how to start, stop, and manage the Matterbridge process as a background service.
39+
40+
You can inspect the service status and configuration using:
41+
42+
```
43+
% launchctl print system/com.matterbridge
44+
system/com.matterbridge = {
45+
active count = 1
46+
path = /Library/LaunchDaemons/com.matterbridge.plist
47+
type = LaunchDaemon
48+
state = running
49+
50+
  program = /opt/homebrew/bin/matterbridge
51+
  arguments = {
52+
    /opt/homebrew/bin/matterbridge
53+
    -service
54+
  }
55+
56+
  stdout path = /Users/me/.matterbridge/matterbridge.log
57+
  stderr path = /Users/me/.matterbridge/matterbridge.log
58+
  default environment = {
59+
    PATH => /usr/bin:/bin:/usr/sbin:/sbin
60+
  }
61+
62+
  environment = {
63+
    PATH => /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
64+
    HOME => /Users/me
65+
    XPC_SERVICE_NAME => com.matterbridge
66+
  }
67+
68+
...
69+
}
70+
```

eslint.config.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import eslint from '@eslint/js';
2+
import stylistic from '@stylistic/eslint-plugin';
3+
import tseslint from 'typescript-eslint';
4+
5+
export default tseslint.config(
6+
eslint.configs.recommended,
7+
stylistic.configs.customize({
8+
arrowParens: false,
9+
blockSpacing: true,
10+
braceStyle: 'stroustrup',
11+
commaDangle: 'never',
12+
flat: true,
13+
indent: 4,
14+
jsx: false,
15+
quoteProps: 'consistent-as-needed',
16+
quotes: 'single',
17+
semi: true
18+
}),
19+
...tseslint.configs.strict,
20+
...tseslint.configs.stylistic,
21+
{
22+
ignores: ['./bin']
23+
}
24+
);

0 commit comments

Comments
 (0)