sockethub 5.0.0-alpha.12 → 5.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/sockethub CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bun
1
+ #!/usr/bin/env node
2
2
  import("@sockethub/server").then((sockethub) => {
3
3
  sockethub.server();
4
4
  });
@@ -1,16 +1,17 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
3
  * Sockethub launcher with split logging:
4
- * - Console: filtered via DEBUG pattern
4
+ * - Console: filtered via namespace patterns
5
5
  * - File: full debug output to sockethub.log
6
6
  */
7
7
  import { spawn } from "node:child_process";
8
8
  import { createWriteStream } from "node:fs";
9
9
  import { dirname, join } from "node:path";
10
- import debug from "debug";
11
10
 
12
- // Console filter using DEBUG syntax
13
- const CONSOLE_DEBUG = [
11
+ // Console namespace filter. Include patterns show a namespace; a leading "-"
12
+ // excludes it; "*" matches any run of characters. (Self-contained matcher so we
13
+ // don't depend on the legacy `debug` package — Sockethub logs via winston.)
14
+ const CONSOLE_FILTER = [
14
15
  "sockethub:init",
15
16
  "sockethub:server:bootstrap:*",
16
17
  "sockethub:server:core",
@@ -18,14 +19,29 @@ const CONSOLE_DEBUG = [
18
19
  "sockethub:server:listener",
19
20
  "sockethub:server:janitor",
20
21
  "sockethub:server:rate-limiter",
21
- ].join(",");
22
+ ];
22
23
 
23
- // Create a filter function using debug's enable/disable logic
24
- debug.enable(CONSOLE_DEBUG);
25
- const shouldShow = (namespace: string) => debug.enabled(namespace);
24
+ function patternToRegExp(pattern: string): RegExp {
25
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
26
+ return new RegExp(`^${escaped.replace(/\*/g, ".*?")}$`);
27
+ }
28
+
29
+ const includes = CONSOLE_FILTER.filter((p) => !p.startsWith("-")).map(
30
+ patternToRegExp,
31
+ );
32
+ const excludes = CONSOLE_FILTER.filter((p) => p.startsWith("-")).map((p) =>
33
+ patternToRegExp(p.slice(1)),
34
+ );
35
+
36
+ const shouldShow = (namespace: string): boolean => {
37
+ if (excludes.some((re) => re.test(namespace))) {
38
+ return false;
39
+ }
40
+ return includes.some((re) => re.test(namespace));
41
+ };
26
42
 
27
- // Extract namespace from debug output line
28
- // Format: " sockethub:namespace message +0ms" (with optional ANSI colors)
43
+ // Extract the sockethub namespace from a winston log line
44
+ // (e.g. "2026-… debug: sockethub:server:core message", with optional ANSI colors)
29
45
  const namespaceRegex = /sockethub:[^\s\x1b]+/;
30
46
  function getNamespace(line: string): string | null {
31
47
  const match = line.match(namespaceRegex);
@@ -38,7 +54,7 @@ const timestamp = () => new Date().toISOString();
38
54
  logFile.write(`\n--- Sockethub started at ${timestamp()} ---\n`);
39
55
 
40
56
  const child = spawn("bun", ["run", join(dirname(import.meta.path), "sockethub")], {
41
- env: { ...process.env, DEBUG: "sockethub:*", DEBUG_COLORS: "true" },
57
+ env: { ...process.env, LOG_LEVEL: "debug" },
42
58
  stdio: ["inherit", "pipe", "pipe"],
43
59
  });
44
60
 
@@ -46,7 +62,7 @@ function processLine(line: string, stream: "stdout" | "stderr") {
46
62
  // Always write to file
47
63
  logFile.write(`${line}\n`);
48
64
 
49
- // Check if namespace passes DEBUG filter
65
+ // Check if namespace passes the console filter
50
66
  // Non-debug lines (console.log from init, errors) are always shown
51
67
  const namespace = getNamespace(line);
52
68
  const show = namespace
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sockethub",
3
3
  "description": "A polyglot messaging service",
4
- "version": "5.0.0-alpha.12",
4
+ "version": "5.0.0-alpha.13",
5
5
  "private": false,
6
6
  "author": "Nick Jennings <nick@silverbucket.net>",
7
7
  "license": "LGPL-3.0+",
@@ -9,7 +9,7 @@
9
9
  "bin": "bin/sockethub",
10
10
  "preferGlobal": true,
11
11
  "engines": {
12
- "bun": ">=1.2.4"
12
+ "node": ">=20"
13
13
  },
14
14
  "keywords": [
15
15
  "sockethub",
@@ -33,24 +33,23 @@
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "git+https://github.com/sockethub/sockethub.git",
36
- "directory": "apps/sockethub"
36
+ "directory": "packages/sockethub"
37
37
  },
38
38
  "homepage": "https://sockethub.org",
39
39
  "dependencies": {
40
- "@sockethub/platform-dummy": "^3.0.0-alpha.12",
41
- "@sockethub/platform-feeds": "^4.0.0-alpha.12",
42
- "@sockethub/platform-irc": "^4.0.0-alpha.12",
43
- "@sockethub/platform-xmpp": "^5.0.0-alpha.12",
44
- "@sockethub/server": "^5.0.0-alpha.12"
40
+ "@sockethub/platform-dummy": "^3.0.0-alpha.13",
41
+ "@sockethub/platform-feeds": "^4.0.0-alpha.13",
42
+ "@sockethub/platform-irc": "^4.0.0-alpha.13",
43
+ "@sockethub/platform-xmpp": "^5.0.0-alpha.13",
44
+ "@sockethub/server": "^5.0.0-alpha.13"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "bun build.js",
48
48
  "clean:deps": "rm -rf node_modules",
49
49
  "dev": "bun run --hot ./bin/sockethub --examples",
50
- "info": "bun run ./bin/sockethub --info",
51
- "start": "bun run ./bin/sockethub-logged",
52
- "start:verbose": "bun run ./bin/sockethub",
53
- "start:quiet": "bun run ./bin/sockethub"
50
+ "info": "node ./bin/sockethub --info",
51
+ "start": "node ./bin/sockethub",
52
+ "start:logged": "bun ./bin/sockethub-logged"
54
53
  },
55
- "gitHead": "f039dab3c3f67cbbf204476fc397532e973f82a8"
54
+ "gitHead": "864733e5b34449ef39542eceb4ff11aa308081bc"
56
55
  }