@powerhousedao/ph-clint-observability 0.1.0-dev.71 → 0.1.0-dev.72

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ph-telemetry-dev — bin entry.
4
+ *
5
+ * Imports the library and runs the receiver unconditionally. Splitting bin
6
+ * from library means the library has no side effects on import (so tests
7
+ * can pull in startDevServer/parseCliArgs/envPrefix without booting a
8
+ * server), and the bin file doesn't need a fragile
9
+ * `import.meta.url === <path>` guard.
10
+ */
11
+ import { parseCliArgs, startDevServer } from '../dev-server.js';
12
+ async function main() {
13
+ const args = parseCliArgs(process.argv);
14
+ const handle = await startDevServer(args);
15
+ process.once('SIGINT', () => { void handle.close().then(() => process.exit(0)); });
16
+ process.once('SIGTERM', () => { void handle.close().then(() => process.exit(0)); });
17
+ }
18
+ main().catch((err) => {
19
+ process.stderr.write(`ph-telemetry-dev: ${err instanceof Error ? err.message : String(err)}\n`);
20
+ process.exit(1);
21
+ });
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env node
2
1
  interface CliArgs {
3
2
  cliName: string;
4
3
  port: number;
@@ -1,6 +1,5 @@
1
- #!/usr/bin/env node
2
1
  /**
3
- * ph-telemetry-dev — local OTLP HTTP receiver for dev work.
2
+ * Local OTLP HTTP receiver for dev work.
4
3
  *
5
4
  * Inspired by the deleted service-announcer pattern: prints the endpoint to
6
5
  * stdout so the dev knows what env var to set in another terminal before
@@ -9,6 +8,9 @@
9
8
  * Receives OTel OTLP HTTP at /v1/traces and /v1/metrics. JSON payloads
10
9
  * (OTEL_EXPORTER_OTLP_PROTOCOL=http/json on the sender side) are
11
10
  * pretty-printed; protobuf payloads show byte length only.
11
+ *
12
+ * This module is library-only — pure exports, no side effects. The bin
13
+ * entry that actually invokes the server lives at `src/bin/ph-telemetry-dev.ts`.
12
14
  */
13
15
  import http from 'node:http';
14
16
  import { parseArgs } from 'node:util';
@@ -77,18 +79,3 @@ export async function startDevServer(opts) {
77
79
  close: () => new Promise((resolve, reject) => server.close((err) => err ? reject(err) : resolve())),
78
80
  };
79
81
  }
80
- /* istanbul ignore next -- entry-point bootstrap; exercised by manual `pnpm telemetry:dev` */
81
- async function main() {
82
- const args = parseCliArgs(process.argv);
83
- const handle = await startDevServer(args);
84
- process.once('SIGINT', () => { void handle.close().then(() => process.exit(0)); });
85
- process.once('SIGTERM', () => { void handle.close().then(() => process.exit(0)); });
86
- }
87
- // Only run main when invoked as a script (not when imported by tests).
88
- /* istanbul ignore next */
89
- if (import.meta.url === `file://${process.argv[1]}`) {
90
- main().catch((err) => {
91
- process.stderr.write(`ph-telemetry-dev: ${err instanceof Error ? err.message : String(err)}\n`);
92
- process.exit(1);
93
- });
94
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-clint-observability",
3
- "version": "0.1.0-dev.71",
3
+ "version": "0.1.0-dev.72",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,7 +14,7 @@
14
14
  }
15
15
  },
16
16
  "bin": {
17
- "ph-telemetry-dev": "./dist/dev-server.js"
17
+ "ph-telemetry-dev": "./dist/bin/ph-telemetry-dev.js"
18
18
  },
19
19
  "files": [
20
20
  "dist"
@@ -39,7 +39,7 @@
39
39
  "zod": "^4.3.6"
40
40
  },
41
41
  "peerDependencies": {
42
- "@powerhousedao/ph-clint": "^0.1.0-dev.71"
42
+ "@powerhousedao/ph-clint": "^0.1.0-dev.72"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@jest/globals": "^30.3.0",