@serverkgg/bridge 0.1.2 → 0.1.4

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.
Files changed (94) hide show
  1. package/package.json +3 -2
  2. package/rules/package.md +65 -0
  3. package/src/blog/articleFrontmatter.test.ts +10 -10
  4. package/src/blog/compile.test.ts +9 -9
  5. package/src/bot/botDeploy.test.ts +16 -16
  6. package/src/bot/botEnvironment.test.ts +8 -8
  7. package/src/bot/botIdentity.test.ts +12 -12
  8. package/src/bot/botPanel.test.ts +13 -13
  9. package/src/bot/botPanel.ts +4 -4
  10. package/src/bot/botState.test.ts +3 -3
  11. package/src/bot/botTerminal.test.ts +5 -5
  12. package/src/bot/botVariables.test.ts +8 -8
  13. package/src/bot/detect/botToken.test.ts +6 -6
  14. package/src/bot/detect/detect.test.ts +21 -21
  15. package/src/bot/detect/detectTable.test.ts +5 -5
  16. package/src/bot/detect/envExample.test.ts +2 -2
  17. package/src/bot/detect/envScan.test.ts +4 -4
  18. package/src/bot/detect/inferBotPlatform.test.ts +4 -4
  19. package/src/bot/detect/keys.test.ts +3 -3
  20. package/src/bot/detect/sensitiveKey.test.ts +5 -5
  21. package/src/bot/detect/serverkJson.test.ts +5 -5
  22. package/src/catalogs/curseforge.test.ts +35 -35
  23. package/src/catalogs/thunderstore.test.ts +9 -9
  24. package/src/cli/detectTable.test.ts +3 -3
  25. package/src/cli/link.test.ts +11 -11
  26. package/src/cli/main.ts +8 -0
  27. package/src/cli/rules.test.ts +198 -0
  28. package/src/cli/rules.ts +188 -0
  29. package/src/cli/validate.test.ts +179 -31
  30. package/src/cli/validate.ts +44 -0
  31. package/src/codecs/ini.test.ts +13 -13
  32. package/src/codecs/javaProperties.test.ts +11 -11
  33. package/src/codecs/sourceCfg.test.ts +14 -14
  34. package/src/codecs/xmlProperties.test.ts +10 -10
  35. package/src/core/bridgePort.test.ts +6 -6
  36. package/src/core/bridgeUserError.test.ts +4 -4
  37. package/src/core/bridgeValue.test.ts +5 -5
  38. package/src/core/describeDownloadFailure.test.ts +12 -12
  39. package/src/core/describeDownloadFailure.ts +10 -10
  40. package/src/guides/markdown.test.ts +31 -31
  41. package/src/install/installStamp.test.ts +9 -9
  42. package/src/manifest/extension.ts +36 -0
  43. package/src/manifest/index.ts +1 -0
  44. package/src/manifest/manifest.test.ts +208 -90
  45. package/src/manifest/manifest.ts +34 -0
  46. package/src/net/loopback.test.ts +10 -10
  47. package/src/presence/rosterSync.test.ts +7 -7
  48. package/src/probes/a2s.test.ts +5 -5
  49. package/src/probes/minecraftPing.test.ts +17 -17
  50. package/src/probes/raknetPing.test.ts +13 -13
  51. package/src/protocol/bridgePreview.ts +1 -0
  52. package/src/rcon/rconAccess.test.ts +20 -20
  53. package/src/rcon/rconAccess.ts +14 -14
  54. package/src/rcon/rconClient.test.ts +49 -49
  55. package/src/rcon/rconFrame.test.ts +14 -14
  56. package/src/rcon/rconIds.test.ts +4 -4
  57. package/src/rcon/rconWriter.test.ts +6 -6
  58. package/src/runtime/bridgeActivity.test.ts +15 -15
  59. package/src/runtime/bridgeBackupLease.test.ts +9 -9
  60. package/src/runtime/bridgeConfigReader.test.ts +5 -5
  61. package/src/runtime/bridgeConsoleHandler.test.ts +8 -8
  62. package/src/runtime/bridgeContext.test.ts +5 -5
  63. package/src/runtime/bridgeDriver.test.ts +94 -94
  64. package/src/runtime/bridgeEvents.test.ts +15 -15
  65. package/src/runtime/bridgeFiles.test.ts +54 -54
  66. package/src/runtime/bridgeInstall.test.ts +10 -10
  67. package/src/runtime/bridgeLiveConfig.test.ts +6 -6
  68. package/src/runtime/bridgePending.test.ts +6 -6
  69. package/src/runtime/bridgeRedaction.test.ts +16 -16
  70. package/src/runtime/bridgeRegistry.test.ts +84 -52
  71. package/src/runtime/bridgeRegistry.ts +2 -2
  72. package/src/runtime/bridgeServer.test.ts +31 -31
  73. package/src/runtime/bridgeSetup.test.ts +27 -27
  74. package/src/runtime/bridgeSetup.ts +1 -1
  75. package/src/runtime/bridgeSetupHandlers.test.ts +13 -13
  76. package/src/runtime/bridgeSignal.test.ts +7 -7
  77. package/src/runtime/bridgeSupervisor.test.ts +42 -42
  78. package/src/runtime/serve.ts +4 -4
  79. package/src/steam/avatars.test.ts +13 -13
  80. package/src/steam/steamApp.test.ts +8 -8
  81. package/src/steam/steamcmd.test.ts +17 -17
  82. package/src/steam/steamcmd.ts +4 -4
  83. package/src/steam/steamcmdNarrator.test.ts +4 -4
  84. package/src/steam/workshop.test.ts +5 -5
  85. package/src/utils/changedSettingKeys.test.ts +5 -5
  86. package/src/utils/describeExecFailure.test.ts +4 -4
  87. package/src/utils/describeExecFailure.ts +1 -1
  88. package/src/utils/sameSettingValue.test.ts +7 -7
  89. package/src/utils/token.test.ts +7 -7
  90. package/src/wine/protonCommand.test.ts +5 -5
  91. package/src/wine/wineCommand.test.ts +6 -6
  92. package/src/wine/winePrefix.test.ts +6 -6
  93. package/src/wire/activity.test.ts +8 -8
  94. package/src/wire/panel.test.ts +28 -28
@@ -1,4 +1,4 @@
1
- import { afterEach, beforeEach, describe, expect, test } from "bun:test";
1
+ import { afterEach, beforeEach, describe, expect, it } from "bun:test";
2
2
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
@@ -45,7 +45,7 @@ afterEach(async () => {
45
45
  });
46
46
 
47
47
  describe("the bridge live config reader", () => {
48
- test("answers from the boot snapshot", async () => {
48
+ it("answers from the boot snapshot", async () => {
49
49
  const config = configWith({
50
50
  CURSEFORGE_API_KEY: "boot",
51
51
  });
@@ -58,7 +58,7 @@ describe("the bridge live config reader", () => {
58
58
  expect(secrets.secret("MODRINTH_API_KEY")).toBeNull();
59
59
  });
60
60
 
61
- test("sees a value the agent rewrote into the config", async () => {
61
+ it("sees a value the agent rewrote into the config", async () => {
62
62
  const config = configWith({
63
63
  CURSEFORGE_API_KEY: "boot",
64
64
  });
@@ -80,7 +80,7 @@ describe("the bridge live config reader", () => {
80
80
  expect(secrets.secret("MODRINTH_API_KEY")).toBe("added");
81
81
  });
82
82
 
83
- test("keeps the last good values while the config is mid-write", async () => {
83
+ it("keeps the last good values while the config is mid-write", async () => {
84
84
  const config = configWith({
85
85
  CURSEFORGE_API_KEY: "boot",
86
86
  });
@@ -100,7 +100,7 @@ describe("the bridge live config reader", () => {
100
100
  expect(secrets.secret("CURSEFORGE_API_KEY")).toBe("boot");
101
101
  });
102
102
 
103
- test("re-reads the file at most once per refresh window", async () => {
103
+ it("re-reads the file at most once per refresh window", async () => {
104
104
  const config = configWith({
105
105
  CURSEFORGE_API_KEY: "boot",
106
106
  });
@@ -120,7 +120,7 @@ describe("the bridge live config reader", () => {
120
120
  expect(secrets.secret("CURSEFORGE_API_KEY")).toBe("boot");
121
121
  });
122
122
 
123
- test("sees a variable the customer changed after boot, and the new plan resources", async () => {
123
+ it("sees a variable the customer changed after boot, and the new plan resources", async () => {
124
124
  const config = configWith({});
125
125
 
126
126
  await write(config);
@@ -1,4 +1,4 @@
1
- import { describe, expect, test } from "bun:test";
1
+ import { describe, expect, it } from "bun:test";
2
2
  import { BRIDGE_PENDING_FILES_LIMIT, type BridgePendingFile } from "../protocol";
3
3
  import type { BridgeLeveledLogger } from "./bridgeLog";
4
4
  import { pendingResult, rejectedPending, unsupportedPending } from "./bridgePending";
@@ -46,7 +46,7 @@ const recorder = () => {
46
46
  };
47
47
 
48
48
  describe("unsupportedPending", () => {
49
- test("answers the sentinel a driver without a pending module gets", () => {
49
+ it("answers the sentinel a driver without a pending module gets", () => {
50
50
  expect(unsupportedPending()).toEqual({
51
51
  supported: false,
52
52
  staging: "",
@@ -58,7 +58,7 @@ describe("unsupportedPending", () => {
58
58
  });
59
59
 
60
60
  describe("pendingResult", () => {
61
- test("carries the staging path, the extensions and the files the driver listed", () => {
61
+ it("carries the staging path, the extensions and the files the driver listed", () => {
62
62
  const { onLog, warnings } = recorder();
63
63
 
64
64
  expect(
@@ -83,7 +83,7 @@ describe("pendingResult", () => {
83
83
  expect(warnings).toEqual([]);
84
84
  });
85
85
 
86
- test("truncates a list longer than the platform takes and warns instead of throwing", () => {
86
+ it("truncates a list longer than the platform takes and warns instead of throwing", () => {
87
87
  const { onLog, warnings } = recorder();
88
88
 
89
89
  const result = pendingResult(
@@ -104,7 +104,7 @@ describe("pendingResult", () => {
104
104
  });
105
105
 
106
106
  describe("rejectedPending", () => {
107
- test("names every file still pending as what the upload was expected to be", () => {
107
+ it("names every file still pending as what the upload was expected to be", () => {
108
108
  const { onLog } = recorder();
109
109
 
110
110
  const result = rejectedPending(
@@ -127,7 +127,7 @@ describe("rejectedPending", () => {
127
127
  expect(result.files).toHaveLength(2);
128
128
  });
129
129
 
130
- test("leaves an empty expectation when the driver has nothing pending left", () => {
130
+ it("leaves an empty expectation when the driver has nothing pending left", () => {
131
131
  const { onLog } = recorder();
132
132
 
133
133
  expect(
@@ -1,4 +1,4 @@
1
- import { afterEach, beforeEach, describe, expect, test } from "bun:test";
1
+ import { afterEach, beforeEach, describe, expect, it } from "bun:test";
2
2
  import { mkdtemp, rm, writeFile } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
@@ -93,7 +93,7 @@ const sourceOf = (initial: Record<string, string>, secrets: Record<string, strin
93
93
  };
94
94
 
95
95
  describe("secretFieldKeys", () => {
96
- test("collects every secret form field once and nothing else", () => {
96
+ it("collects every secret form field once and nothing else", () => {
97
97
  expect(
98
98
  secretFieldKeys(
99
99
  driverWith([
@@ -106,13 +106,13 @@ describe("secretFieldKeys", () => {
106
106
  ]);
107
107
  });
108
108
 
109
- test("finds nothing in a driver with no secret fields", () => {
109
+ it("finds nothing in a driver with no secret fields", () => {
110
110
  expect(secretFieldKeys(driverWith([]))).toEqual([]);
111
111
  });
112
112
  });
113
113
 
114
114
  describe("createBridgeRedaction", () => {
115
- test("is built for every driver and leaves text alone until a secret exists", () => {
115
+ it("is built for every driver and leaves text alone until a secret exists", () => {
116
116
  const { source, seal } = sourceOf({});
117
117
  const redact = createBridgeRedaction([], source);
118
118
 
@@ -125,7 +125,7 @@ describe("createBridgeRedaction", () => {
125
125
  expect(redact(`token ${TOKEN}`)).toBe(`token ${REDACTED}`);
126
126
  });
127
127
 
128
- test("blanks the platform secrets the manifest declares, with the same length floor", () => {
128
+ it("blanks the platform secrets the manifest declares, with the same length floor", () => {
129
129
  const redact = createBridgeRedaction(
130
130
  [],
131
131
  sourceOf(
@@ -140,7 +140,7 @@ describe("createBridgeRedaction", () => {
140
140
  expect(redact("key cf-api-key-0123456789 and short")).toBe(`key ${REDACTED} and short`);
141
141
  });
142
142
 
143
- test("blanks secret fields and platform secrets together", () => {
143
+ it("blanks secret fields and platform secrets together", () => {
144
144
  const redact = createBridgeRedaction(
145
145
  [
146
146
  "BOT_TOKEN",
@@ -158,7 +158,7 @@ describe("createBridgeRedaction", () => {
158
158
  expect(redact(`${TOKEN} cf-api-key-0123456789`)).toBe(`${REDACTED} ${REDACTED}`);
159
159
  });
160
160
 
161
- test("replaces every occurrence of a secret value", () => {
161
+ it("replaces every occurrence of a secret value", () => {
162
162
  const redact = createBridgeRedaction(
163
163
  [
164
164
  "BOT_TOKEN",
@@ -173,7 +173,7 @@ describe("createBridgeRedaction", () => {
173
173
  );
174
174
  });
175
175
 
176
- test("blanks every line of a multi-line secret the process prints one line at a time", () => {
176
+ it("blanks every line of a multi-line secret the process prints one line at a time", () => {
177
177
  const key = [
178
178
  "-----BEGIN PRIVATE KEY-----",
179
179
  "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7",
@@ -198,7 +198,7 @@ describe("createBridgeRedaction", () => {
198
198
  expect(redact(`whole ${key}`)).toBe(`whole ${REDACTED}`);
199
199
  });
200
200
 
201
- test("leaves a value under eight characters alone", () => {
201
+ it("leaves a value under eight characters alone", () => {
202
202
  const redact = createBridgeRedaction(
203
203
  [
204
204
  "RCON_PASSWORD",
@@ -211,7 +211,7 @@ describe("createBridgeRedaction", () => {
211
211
  expect(redact("the password is hunter2")).toBe("the password is hunter2");
212
212
  });
213
213
 
214
- test("escapes values that look like patterns and prefers the longest overlapping value", () => {
214
+ it("escapes values that look like patterns and prefers the longest overlapping value", () => {
215
215
  const redact = createBridgeRedaction(
216
216
  [
217
217
  "SHORT",
@@ -226,7 +226,7 @@ describe("createBridgeRedaction", () => {
226
226
  expect(redact("x a.b+c*d?-and-more y a.b+c*d? z aXb+c*d?")).toBe(`x ${REDACTED} y ${REDACTED} z aXb+c*d?`);
227
227
  });
228
228
 
229
- test("follows a value saved after it was built and forgets the old one", () => {
229
+ it("follows a value saved after it was built and forgets the old one", () => {
230
230
  const { source, save } = sourceOf({
231
231
  BOT_TOKEN: "old-token-value",
232
232
  });
@@ -250,11 +250,11 @@ describe("createBridgeRedaction", () => {
250
250
  describe("redacting what the bridge reports", () => {
251
251
  const redact = (value: string) => value.split(TOKEN).join(REDACTED);
252
252
 
253
- test("covers both languages of a customer-facing message", () => {
253
+ it("covers both languages of a customer-facing message", () => {
254
254
  expect(redactLocalized(text(`bad ${TOKEN}`), redact)).toEqual(text(`bad ${REDACTED}`));
255
255
  });
256
256
 
257
- test("covers the message and every string field of a log line", () => {
257
+ it("covers the message and every string field of a log line", () => {
258
258
  const lines: unknown[] = [];
259
259
  const record = (level: string) => (message: string, fields?: Record<string, unknown>) => {
260
260
  lines.push({
@@ -345,7 +345,7 @@ describe("redaction over the live config", () => {
345
345
  });
346
346
  });
347
347
 
348
- test("reads the platform secrets from the config the agent wrote", async () => {
348
+ it("reads the platform secrets from the config the agent wrote", async () => {
349
349
  const boot = {
350
350
  ...configWith({}),
351
351
  secrets: {
@@ -360,7 +360,7 @@ describe("redaction over the live config", () => {
360
360
  expect(redact("cf-api-key-0123456789")).toBe(REDACTED);
361
361
  });
362
362
 
363
- test("starts as the identity with no secret anywhere and blanks a secret written after boot", async () => {
363
+ it("starts as the identity with no secret anywhere and blanks a secret written after boot", async () => {
364
364
  const boot = configWith({});
365
365
 
366
366
  await write(boot);
@@ -382,7 +382,7 @@ describe("redaction over the live config", () => {
382
382
  expect(redact(`key ${TOKEN}`)).toBe(`key ${REDACTED}`);
383
383
  });
384
384
 
385
- test("picks up a token the agent writes into the config after boot", async () => {
385
+ it("picks up a token the agent writes into the config after boot", async () => {
386
386
  const boot = configWith({});
387
387
 
388
388
  await write(boot);