Skip to content

Commit b985d0d

Browse files
Luliguclaude
andcommitted
Upgrade package
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 650fd15 commit b985d0d

18 files changed

Lines changed: 478 additions & 900 deletions

.codex/config.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Codex config v.1.0.3
1+
# Codex config.toml v.1.0.4
22

33
approval_policy = "on-request"
4+
45
approvals_reviewer = "user"
56

67
web_search = "live"
78

8-
default_permissions = ":workspace"
9+
default_permissions = "matterbridge_safe"
910

1011
[shell_environment_policy]
1112
inherit = "core"
13+
ignore_default_excludes = false
1214

1315
[windows]
1416
sandbox = "elevated"
@@ -21,7 +23,7 @@ extends = ":workspace"
2123
enabled = false
2224

2325
[permissions.matterbridge_safe.filesystem]
24-
glob_scan_max_depth = 4
26+
glob_scan_max_depth = 5
2527

2628
[permissions.matterbridge_safe.filesystem.":workspace_roots"]
2729
".env" = "deny"

.devcontainer/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# .devcontainer/Dockerfile v.1.2.0
2+
3+
# This Dockerfile is used to build a development container for Node.js applications.
4+
# It is based on the official Node.js Docker image and includes additional tools and configurations for a better development experience.
5+
# Bun is installed.
6+
# Bash history is configured to be synced across terminals.
7+
8+
FROM node:24-trixie-slim
9+
10+
ENV BUN_INSTALL=/home/node/.bun
11+
ENV PATH=${BUN_INSTALL}/bin:${PATH}
12+
ENV HISTFILE=/home/node/.bash-cache/.bash_history
13+
ENV HISTSIZE=100000
14+
ENV HISTFILESIZE=200000
15+
16+
RUN apt-get update \
17+
&& apt-get install --yes --no-install-recommends ca-certificates curl git procps ripgrep sudo unzip bubblewrap \
18+
&& curl --fail --location --silent --show-error https://bun.sh/install | bash \
19+
&& mkdir -p /home/node/.bash-cache \
20+
&& { \
21+
echo ''; \
22+
echo '# Keep Bash history synced across terminals.'; \
23+
echo 'shopt -s histappend'; \
24+
echo '__sync_history() {'; \
25+
echo ' history -a'; \
26+
echo ' history -n'; \
27+
echo '}'; \
28+
echo 'PROMPT_COMMAND="__sync_history${PROMPT_COMMAND:+;$PROMPT_COMMAND}"'; \
29+
} >> /home/node/.bashrc \
30+
&& chown -R node:node "$BUN_INSTALL" \
31+
&& chown -R node:node /home/node/.bash-cache /home/node/.bashrc \
32+
&& echo "node ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/node \
33+
&& chmod 0440 /etc/sudoers.d/node \
34+
&& rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.json

Lines changed: 28 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// .devcontainer/devcontainer.json v. 1.0.5
1+
// .devcontainer/devcontainer.json v.1.2.0
22

33
// This file defines the development container configuration for a Matterbridge Plugin.
44

@@ -32,43 +32,59 @@ Dev containers have networking limitations depending on the host OS and Docker s
3232
{
3333
// Name of the dev container
3434
"name": "Matterbridge Plugin Dev Container",
35-
// Use the Microsoft pre-built image with Debian (Trixie) and Node.js 24 for a consistent and optimized development environment
36-
"image": "mcr.microsoft.com/devcontainers/javascript-node:24-trixie",
35+
"build": {
36+
"dockerfile": "Dockerfile"
37+
},
3738
// Inherit timezone from the host environment (set TZ on the host, e.g. Europe/Paris)
3839
"containerEnv": {
3940
"TZ": "${localEnv:TZ}"
4041
},
4142
// Use the non-root node user (passwordless sudo in this image)
4243
"remoteUser": "node",
43-
// Mount the local matterbridge and node_modules workspace folder to the container's workspace volumes to improve performance
4444
"mounts": [
45+
// Package specific volumes for node_modules, .cache, Matterbridge .matterbridge, .mattercert to improve performance
4546
"source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
4647
"source=${localWorkspaceFolderBasename}-cache,target=${containerWorkspaceFolder}/.cache,type=volume",
4748
"source=${localWorkspaceFolderBasename}-plugins,target=/home/node/Matterbridge,type=volume",
4849
"source=${localWorkspaceFolderBasename}-storage,target=/home/node/.matterbridge,type=volume",
4950
"source=${localWorkspaceFolderBasename}-cert,target=/home/node/.mattercert,type=volume",
51+
// Dev container shared volumes for matterbridge, npm cache, bun cache, bash history, claude, codex and agents to improve performance
5052
"source=matterbridge,target=/matterbridge,type=volume",
53+
"source=npm-cache,target=/home/node/.npm,type=volume",
54+
"source=bun-cache,target=/home/node/.bun/install/cache,type=volume",
55+
"source=bash-cache,target=/home/node/.bash-cache,type=volume",
5156
"source=claude,target=/home/node/.claude,type=volume",
5257
"source=codex,target=/home/node/.codex,type=volume",
5358
"source=agents,target=/home/node/.agents,type=volume"
5459
],
55-
// Create the matterbridge Docker network if it doesn't exist, then pull the base image (runs on the HOST before the container starts).
56-
"initializeCommand": "(docker network inspect matterbridge || docker network create matterbridge) && docker pull mcr.microsoft.com/devcontainers/javascript-node:24-trixie",
57-
// On create, update npm, install and link the dev of matterbridge and install and build the plugin (runs inside the container)
58-
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
59-
// On start, run the plugin in watch mode (runs inside the container)
60-
"postStartCommand": "bash .devcontainer/postStartCommand.sh",
60+
// Set up the Docker environment (runs on the host before the container starts)
61+
"initializeCommand": "bash .devcontainer/initialize.sh",
62+
// On create, prepare the directories, install and link the dev of matterbridge and install and build the plugin (runs inside the container)
63+
"postCreateCommand": "bash .devcontainer/post-create.sh",
64+
// On start, install and build the plugin (runs inside the container)
65+
"postStartCommand": "bash .devcontainer/post-start.sh",
6166
"runArgs": [
6267
// Give the Docker container the same name as the repository (must be unique on host)
6368
"--name",
6469
"${localWorkspaceFolderBasename}",
70+
// OpenAI sandbox requisites (https://learn.chatgpt.com/docs/sandboxing?surface=cli)
71+
"--security-opt",
72+
"seccomp=unconfined",
6573
// Use network host mode if on Docker Engine on Linux or WSL 2 to allow full local network access and mDNS support
6674
// "--network=host"
6775
// Use a shared bridge network to allow to access other containers with their names (dns resolution). With the default bridge, dns resolution does not work (only ip:port).
6876
"--network=matterbridge"
6977
],
7078
// Publish the Matterbridge UI port on the Docker host (so http://localhost:8283 works even without VS Code port forwarding)
71-
"appPort": [8283],
79+
"forwardPorts": [8283],
80+
"portsAttributes": {
81+
"8283": {
82+
"label": "Matterbridge frontend"
83+
}
84+
},
85+
"otherPortsAttributes": {
86+
"onAutoForward": "ignore"
87+
},
7288
"customizations": {
7389
"vscode": {
7490
// Extensions to install in the dev container
@@ -83,75 +99,8 @@ Dev containers have networking limitations depending on the host OS and Docker s
8399
"github.vscode-pull-request-github",
84100
"openai.chatgpt"
85101
],
86-
// Settings for the VS Code environment
102+
// Settings for the VS Code environment specific to the dev container (overrides user and workspace settings)
87103
"settings": {
88-
// Default .vscode/settings.json
89-
"eslint.enable": false,
90-
"prettier.enable": false,
91-
"oxc.enable": true,
92-
"js/ts.experimental.useTsgo": true,
93-
"js/ts.tsdk.promptToUseWorkspaceVersion": false,
94-
"terminal.integrated.scrollback": 1000,
95-
"editor.tabSize": 2,
96-
"editor.rulers": [180],
97-
"editor.formatOnSave": false,
98-
"editor.defaultFormatter": "oxc.oxc-vscode",
99-
"[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
100-
"[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
101-
"[json]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
102-
"[jsonc]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
103-
"[markdown]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
104-
"editor.formatOnSaveMode": "file",
105-
"editor.codeActionsOnSave": {
106-
"source.format.oxc": "always",
107-
"source.fixAll.oxc": "always"
108-
},
109-
"diffEditor.ignoreTrimWhitespace": false,
110-
"files.eol": "\n",
111-
"files.insertFinalNewline": true,
112-
"files.trimFinalNewlines": true,
113-
"files.trimTrailingWhitespace": true,
114-
"files.watcherExclude": {
115-
"**/build/**": true,
116-
"**/.cache/**": true,
117-
"**/coverage/**": true
118-
},
119-
"search.exclude": {
120-
"**/node_modules": true,
121-
"**/dist": true,
122-
"**/build": true,
123-
"**/.cache": true,
124-
"**/coverage": true
125-
},
126-
"git.autofetch": true,
127-
"git.autoRepositoryDetection": false,
128-
// VS Code's Copilot Chat extension settings
129-
"chat.useCustomizationsInParentRepositories": true, // Default false.
130-
"chat.tools.terminal.autoApprove": {
131-
"npx tsc": true,
132-
"npx oxlint": true,
133-
"npx oxfmt": true,
134-
"npx vitest": true,
135-
"npm run": true,
136-
"npm run build": true,
137-
"npm run typecheck": true,
138-
"npm run lint": true,
139-
"npm run format:check": true,
140-
"npm run test": true,
141-
"npm run test:coverage": true,
142-
"npm run update-htmls": true,
143-
"git status": true,
144-
"git diff": true,
145-
"git diff --check": true,
146-
"git diff --stat": true,
147-
"git log": true,
148-
"git show": true,
149-
"git branch -vv": true,
150-
"git ls-files": true,
151-
"git --no-pager diff --stat": true,
152-
"git --no-pager diff --check": true
153-
},
154-
// Dev Container specific settings
155104
"terminal.integrated.defaultProfile.linux": "bash",
156105
"js/ts.tsserver.watchOptions": {
157106
"watchFile": "dynamicPriorityPolling",

.devcontainer/initialize.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# .devcontainer/initialize.sh v.1.2.0
4+
5+
# This script runs on the host before the Dev Container is created to set up the Docker environment.
6+
7+
set -euo pipefail
8+
9+
echo "Welcome to Matterbridge Plugin Dev Container (initialize.sh)"
10+
echo ""
11+
12+
echo "1.initialize - Creating the Matterbridge Docker network..."
13+
docker network inspect matterbridge >/dev/null 2>&1 || docker network create matterbridge
14+
15+
echo "2.initialize - Pulling the base image..."
16+
docker pull node:24-trixie-slim
17+
18+
echo "3.initialize - Initialization completed!"
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
# install-matterbridge-dev.sh
3+
# .devcontainer/install-matterbridge-dev.sh v.1.2.0
44

55
# This script globally installs Matterbridge from the dev branch.
66
# To be used only inside the Dev Container with the mounted matterbridge volume.
77

8-
echo "Installing Matterbridge from the dev branch..."
9-
set -e
8+
set -euo pipefail
9+
10+
echo "1.install-matterbridge-dev - Installing Matterbridge from the dev branch..."
1011
cd /
1112
if [ ! -d "/workspaces" ]; then
1213
echo "Directory /workspaces does not exist. Exiting."
1314
exit 1
1415
fi
16+
17+
echo "2.install-matterbridge-dev - Preparing Matterbridge directory..."
1518
sudo chown -R node:node matterbridge
1619
sudo chmod g+s matterbridge
1720
sudo rm -rf matterbridge/* matterbridge/.[!.]* matterbridge/..?*
21+
22+
echo "3.install-matterbridge-dev - Cloning Matterbridge from the dev branch..."
1823
# Shallow clone for speed (history not needed inside dev container). Remove --depth if full history required.
1924
git clone --depth 1 --single-branch --no-tags -b dev https://github.com/Luligu/matterbridge.git matterbridge
2025
cd matterbridge
26+
27+
echo "4.install-matterbridge-dev - Setting Matterbridge version..."
2128
SHA7=$(git rev-parse --short=7 HEAD) && BASE_VERSION=$(node -p "require('./package.json').version.split('-')[0]") && npm pkg set version="${BASE_VERSION}-git-${SHA7}"
29+
30+
echo "5.install-matterbridge-dev - Installing Matterbridge dependencies and building..."
2231
npm ci --no-fund --no-audit && npm run build
32+
# bun install --no-fund --no-audit && bun run build
33+
34+
echo "6.install-matterbridge-dev - Building Matterbridge frontend..."
2335
cd apps/frontend && npm ci --no-fund --no-audit && npm run build && cd ../..
24-
npm install . --global --no-fund --no-audit
25-
rm -rf .cache .devcontainer .git .github .vscode docker docs reflector screenshots systemd
26-
echo "Matterbridge has been installed from the dev branch."
36+
# cd apps/frontend && bun install --no-fund --no-audit && bun run build && cd ../..
37+
38+
echo "7.install-matterbridge-dev - Installing Matterbridge globally..."
39+
sudo npm install . --global --no-fund --no-audit
40+
# bun link
41+
sudo rm -rf .agents .cache .claude .codex .devcontainer .git .github .vscode docker docs reflector screenshots scripts systemd
42+
43+
echo "8.install-matterbridge-dev - Matterbridge has been installed from the dev branch."
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,43 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
# install-matterbridge-dev.sh
3+
# .devcontainer/install-matterbridge-main.sh v.1.2.0
44

55
# This script globally installs Matterbridge from the main branch.
66
# To be used only inside the Dev Container with the mounted matterbridge volume.
77

8-
echo "Installing Matterbridge from the main branch..."
9-
set -e
8+
set -euo pipefail
9+
10+
echo "1.install-matterbridge-main - Installing Matterbridge from the main branch..."
1011
cd /
1112
if [ ! -d "/workspaces" ]; then
1213
echo "Directory /workspaces does not exist. Exiting."
1314
exit 1
1415
fi
16+
17+
echo "2.install-matterbridge-main - Preparing Matterbridge directory..."
1518
sudo chown -R node:node matterbridge
1619
sudo chmod g+s matterbridge
1720
sudo rm -rf matterbridge/* matterbridge/.[!.]* matterbridge/..?*
21+
22+
echo "3.install-matterbridge-main - Cloning Matterbridge from the main branch..."
1823
# Shallow clone for speed (history not needed inside dev container). Remove --depth if full history required.
1924
git clone --depth 1 --single-branch --no-tags https://github.com/Luligu/matterbridge.git matterbridge
2025
cd matterbridge
26+
27+
echo "4.install-matterbridge-main - Setting Matterbridge version..."
2128
SHA7=$(git rev-parse --short=7 HEAD) && BASE_VERSION=$(node -p "require('./package.json').version.split('-')[0]") && npm pkg set version="${BASE_VERSION}-git-${SHA7}"
29+
30+
echo "5.install-matterbridge-main - Installing Matterbridge dependencies and building..."
2231
npm ci --no-fund --no-audit && npm run build
32+
# bun install --no-fund --no-audit && bun run build
33+
34+
echo "6.install-matterbridge-main - Building Matterbridge frontend..."
2335
cd apps/frontend && npm ci --no-fund --no-audit && npm run build && cd ../..
24-
npm install . --global --no-fund --no-audit
25-
rm -rf .cache .devcontainer .git .github .vscode docker docs reflector screenshots systemd
26-
echo "Matterbridge has been installed from the main branch."
36+
# cd apps/frontend && bun install --no-fund --no-audit && bun run build && cd ../..
37+
38+
echo "7.install-matterbridge-main - Installing Matterbridge globally..."
39+
sudo npm install . --global --no-fund --no-audit
40+
# bun link
41+
sudo rm -rf .agents .cache .claude .codex .devcontainer .git .github .vscode docker docs reflector screenshots scripts systemd
42+
43+
echo "8.install-matterbridge-main - Matterbridge has been installed from the main branch."

.devcontainer/post-create.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
# .devcontainer/post-create.sh v.1.2.0
4+
5+
# This script runs after the Dev Container is created to set up the dev container environment.
6+
7+
set -euo pipefail
8+
9+
echo "Welcome to Matterbridge Plugin Dev Container (post-create.sh)"
10+
DISTRO=$(awk -F= '/^PRETTY_NAME=/{gsub(/"/, "", $2); print $2}' /etc/os-release)
11+
CODENAME=$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release)
12+
echo "Distro: $DISTRO ($CODENAME)"
13+
echo "User: $(whoami)"
14+
echo "Hostname: $(hostname)"
15+
echo "Architecture: $(uname -m)"
16+
echo "Kernel Version: $(uname -r)"
17+
echo "Uptime: $(uptime -p || echo 'unavailable')"
18+
echo "Date: $(date)"
19+
echo "Node.js version: $(node -v)"
20+
echo "Npm version: $(npm -v)"
21+
echo "Npm cache: $(npm config get cache)"
22+
echo "Bun version: $(bun -v)"
23+
echo "Bun global cache: ${HOME}/.bun/install/cache"
24+
echo ""
25+
26+
echo "1.post-create - Creating directories..."
27+
sudo mkdir -p /home/node/Matterbridge /home/node/.matterbridge /home/node/.mattercert
28+
sudo mkdir -p /home/node/.claude /home/node/.codex /home/node/.agents /home/node/.npm /home/node/.bash-cache /home/node/.bun/install/cache
29+
30+
echo "2.post-create - Setting permissions..."
31+
sudo chown -R node:node . /home/node/Matterbridge /home/node/.matterbridge /home/node/.mattercert
32+
sudo chown -R node:node /home/node/.claude /home/node/.codex /home/node/.agents /home/node/.npm /home/node/.bash-cache /home/node/.bun
33+
34+
echo "3.post-create - Building Matterbridge..."
35+
sudo chmod +x .devcontainer/install-matterbridge-*.sh
36+
# Use this for the main branch:
37+
# .devcontainer/install-matterbridge-main.sh
38+
# Use this for the dev branch:
39+
.devcontainer/install-matterbridge-dev.sh
40+
41+
echo "4.post-create - Installing the plugin dependencies..."
42+
npm install --no-fund --no-audit
43+
44+
echo "5.post-create - Linking Matterbridge..."
45+
if ! npm link matterbridge --no-fund --no-audit; then
46+
echo "Retrying link with elevated permissions..."
47+
sudo npm link matterbridge --no-fund --no-audit
48+
sudo chown -R node:node ./node_modules
49+
fi
50+
51+
echo "6.post-create - Building the plugin..."
52+
npm run build
53+
54+
echo "7.post-create - Adding the plugin to Matterbridge..."
55+
npm run add
56+
57+
echo "8.post-create - Checking for outdated packages..."
58+
npm outdated || true
59+
60+
echo "9.post-create - Post create setup completed!"

0 commit comments

Comments
 (0)