@atolljs/cli 0.1.7 → 0.1.8
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/dist/cli.js +19 -3
- package/package.json +1 -1
- package/src/cli.ts +2 -1
- package/src/commands.ts +28 -2
- package/src/templates.ts +1 -1
package/dist/cli.js
CHANGED
|
@@ -333,7 +333,7 @@ ${memImport}import type { ${P}Worker } from './${name}.worker';
|
|
|
333
333
|
export const ${c} = connectWorker<${P}Worker>({
|
|
334
334
|
worker: () =>
|
|
335
335
|
new Worker(new URL('./${name}.worker.ts', import.meta.url), { type: 'module' }),
|
|
336
|
-
${memLine}
|
|
336
|
+
${memLine} workers: 'auto',
|
|
337
337
|
});
|
|
338
338
|
export type ${P}Client = typeof ${c};
|
|
339
339
|
|
|
@@ -2743,9 +2743,24 @@ async function runDevtools(ctx) {
|
|
|
2743
2743
|
return 1;
|
|
2744
2744
|
}
|
|
2745
2745
|
const port = Number(flag(ctx.args, "port") ?? 4780);
|
|
2746
|
-
const
|
|
2746
|
+
const otlpEndpoint = flag(ctx.args, "otlp");
|
|
2747
|
+
const headers = Object.fromEntries(
|
|
2748
|
+
(flag(ctx.args, "otlp-headers") ?? "").split(",").filter((h) => h.includes("=")).map((h) => [h.slice(0, h.indexOf("=")).trim(), h.slice(h.indexOf("=") + 1).trim()])
|
|
2749
|
+
);
|
|
2750
|
+
const server = await mod.createDevtoolsServer({
|
|
2751
|
+
port: Number.isFinite(port) ? port : 4780,
|
|
2752
|
+
...otlpEndpoint ? {
|
|
2753
|
+
otlp: {
|
|
2754
|
+
endpoint: otlpEndpoint,
|
|
2755
|
+
headers,
|
|
2756
|
+
serviceName: flag(ctx.args, "otlp-service"),
|
|
2757
|
+
onError: (e) => io.warn(`otlp: ${e.message}`)
|
|
2758
|
+
}
|
|
2759
|
+
} : {}
|
|
2760
|
+
});
|
|
2747
2761
|
io.print(`atoll devtools \u2192 ${io.fmt.accent(server.url)}`);
|
|
2748
2762
|
io.print(io.fmt.dim(" ingest endpoint: " + server.url.replace("http://", "ws://") + "/events"));
|
|
2763
|
+
if (otlpEndpoint) io.print(io.fmt.dim(" otlp export: " + otlpEndpoint));
|
|
2749
2764
|
io.print(io.fmt.dim(" in the app: connectDevtools() from '@atolljs/devtools'"));
|
|
2750
2765
|
io.warn("serving \u2014 Ctrl+C to stop");
|
|
2751
2766
|
return new Promise(() => {
|
|
@@ -2872,9 +2887,10 @@ var HELP = (fmt) => `${fmt.strong("atoll")} \u2014 bootstrap multithreading ${fm
|
|
|
2872
2887
|
Check the setup \u2014 deps, lockfile, .npmrc policy, bundler-detectable
|
|
2873
2888
|
worker entries, COOP/COEP headers. --fix writes a hardened .npmrc.
|
|
2874
2889
|
|
|
2875
|
-
${fmt.accent("atoll devtools")} [--port 4780]
|
|
2890
|
+
${fmt.accent("atoll devtools")} [--port 4780] [--otlp <url>] [--otlp-headers k=v,\u2026] [--otlp-service <name>]
|
|
2876
2891
|
Serve the local devtools dashboard \u2014 pools, task timings, shared-memory
|
|
2877
2892
|
writes, island traffic. Apps connect via connectDevtools().
|
|
2893
|
+
--otlp also forwards every session to an OpenTelemetry OTLP/HTTP endpoint.
|
|
2878
2894
|
|
|
2879
2895
|
${fmt.dim(`flags: --yes/-y accepts defaults, --force overwrites existing files,
|
|
2880
2896
|
--no-install skips dependency installation`)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atolljs/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "atoll — scaffold worker pools, shared-memory contracts, and framework islands (experimental)",
|
|
5
5
|
"homepage": "https://jwhenry3.github.io/atolljs/consumer/quickstart/",
|
|
6
6
|
"type": "module",
|
package/src/cli.ts
CHANGED
|
@@ -48,9 +48,10 @@ const HELP = (fmt: Fmt) => `${fmt.strong('atoll')} — bootstrap multithreading
|
|
|
48
48
|
Check the setup — deps, lockfile, .npmrc policy, bundler-detectable
|
|
49
49
|
worker entries, COOP/COEP headers. --fix writes a hardened .npmrc.
|
|
50
50
|
|
|
51
|
-
${fmt.accent('atoll devtools')} [--port 4780]
|
|
51
|
+
${fmt.accent('atoll devtools')} [--port 4780] [--otlp <url>] [--otlp-headers k=v,…] [--otlp-service <name>]
|
|
52
52
|
Serve the local devtools dashboard — pools, task timings, shared-memory
|
|
53
53
|
writes, island traffic. Apps connect via connectDevtools().
|
|
54
|
+
--otlp also forwards every session to an OpenTelemetry OTLP/HTTP endpoint.
|
|
54
55
|
|
|
55
56
|
${fmt.dim(`flags: --yes/-y accepts defaults, --force overwrites existing files,
|
|
56
57
|
--no-install skips dependency installation`)}
|
package/src/commands.ts
CHANGED
|
@@ -625,7 +625,12 @@ export async function runCreate(ctx: Ctx): Promise<number> {
|
|
|
625
625
|
export async function runDevtools(ctx: Ctx): Promise<number> {
|
|
626
626
|
const { io } = ctx;
|
|
627
627
|
const spec = '@atolljs/devtools/server';
|
|
628
|
-
const mod: {
|
|
628
|
+
const mod: {
|
|
629
|
+
createDevtoolsServer?: (o: {
|
|
630
|
+
port: number;
|
|
631
|
+
otlp?: { endpoint: string; headers: Record<string, string>; serviceName?: string; onError?: (e: Error) => void };
|
|
632
|
+
}) => Promise<{ url: string }>;
|
|
633
|
+
} | null =
|
|
629
634
|
await import(spec).catch(async () => {
|
|
630
635
|
// In-repo fallback: the workspace package's built dist (extensionless
|
|
631
636
|
// sources can't run under type stripping — `npm run build` there first).
|
|
@@ -637,9 +642,30 @@ export async function runDevtools(ctx: Ctx): Promise<number> {
|
|
|
637
642
|
return 1;
|
|
638
643
|
}
|
|
639
644
|
const port = Number(flag(ctx.args, 'port') ?? 4780);
|
|
640
|
-
const
|
|
645
|
+
const otlpEndpoint = flag(ctx.args, 'otlp');
|
|
646
|
+
// `k=v,k2=v2`: the OTEL_EXPORTER_OTLP_HEADERS format.
|
|
647
|
+
const headers = Object.fromEntries(
|
|
648
|
+
(flag(ctx.args, 'otlp-headers') ?? '')
|
|
649
|
+
.split(',')
|
|
650
|
+
.filter((h) => h.includes('='))
|
|
651
|
+
.map((h) => [h.slice(0, h.indexOf('=')).trim(), h.slice(h.indexOf('=') + 1).trim()]),
|
|
652
|
+
);
|
|
653
|
+
const server = await mod.createDevtoolsServer({
|
|
654
|
+
port: Number.isFinite(port) ? port : 4780,
|
|
655
|
+
...(otlpEndpoint
|
|
656
|
+
? {
|
|
657
|
+
otlp: {
|
|
658
|
+
endpoint: otlpEndpoint,
|
|
659
|
+
headers,
|
|
660
|
+
serviceName: flag(ctx.args, 'otlp-service'),
|
|
661
|
+
onError: (e: Error) => io.warn(`otlp: ${e.message}`),
|
|
662
|
+
},
|
|
663
|
+
}
|
|
664
|
+
: {}),
|
|
665
|
+
});
|
|
641
666
|
io.print(`atoll devtools → ${io.fmt.accent(server.url)}`);
|
|
642
667
|
io.print(io.fmt.dim(' ingest endpoint: ' + server.url.replace('http://', 'ws://') + '/events'));
|
|
668
|
+
if (otlpEndpoint) io.print(io.fmt.dim(' otlp export: ' + otlpEndpoint));
|
|
643
669
|
io.print(io.fmt.dim(" in the app: connectDevtools() from '@atolljs/devtools'"));
|
|
644
670
|
io.warn('serving — Ctrl+C to stop');
|
|
645
671
|
return new Promise<number>(() => {});
|
package/src/templates.ts
CHANGED
|
@@ -158,7 +158,7 @@ ${memImport}import type { ${P}Worker } from './${name}.worker';
|
|
|
158
158
|
export const ${c} = connectWorker<${P}Worker>({
|
|
159
159
|
worker: () =>
|
|
160
160
|
new Worker(new URL('./${name}.worker.ts', import.meta.url), { type: 'module' }),
|
|
161
|
-
${memLine}
|
|
161
|
+
${memLine} workers: 'auto',
|
|
162
162
|
});
|
|
163
163
|
export type ${P}Client = typeof ${c};
|
|
164
164
|
|