@neat.is/core 0.4.7 → 0.4.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.d.cts CHANGED
@@ -41,6 +41,7 @@ interface ParsedArgs {
41
41
  declare function parseArgs(rest: string[]): ParsedArgs;
42
42
 
43
43
  declare function readPackageVersion(): string;
44
+ declare function printBanner(): void;
44
45
  declare function runInit(opts: InitOptions): Promise<InitResult>;
45
46
  declare const CLAUDE_SKILL_CONFIG: {
46
47
  mcpServers: {
@@ -64,4 +65,4 @@ declare function runSkill(opts: SkillOptions): Promise<{
64
65
  declare const QUERY_VERBS: Set<string>;
65
66
  declare function runQueryVerb(cmd: string, parsed: ParsedArgs): Promise<number>;
66
67
 
67
- export { CLAUDE_SKILL_CONFIG, type InitOptions, type InitResult, QUERY_VERBS, type SkillOptions, parseArgs, readPackageVersion, runInit, runQueryVerb, runSkill };
68
+ export { CLAUDE_SKILL_CONFIG, type InitOptions, type InitResult, QUERY_VERBS, type SkillOptions, parseArgs, printBanner, readPackageVersion, runInit, runQueryVerb, runSkill };
package/dist/cli.d.ts CHANGED
@@ -41,6 +41,7 @@ interface ParsedArgs {
41
41
  declare function parseArgs(rest: string[]): ParsedArgs;
42
42
 
43
43
  declare function readPackageVersion(): string;
44
+ declare function printBanner(): void;
44
45
  declare function runInit(opts: InitOptions): Promise<InitResult>;
45
46
  declare const CLAUDE_SKILL_CONFIG: {
46
47
  mcpServers: {
@@ -64,4 +65,4 @@ declare function runSkill(opts: SkillOptions): Promise<{
64
65
  declare const QUERY_VERBS: Set<string>;
65
66
  declare function runQueryVerb(cmd: string, parsed: ParsedArgs): Promise<number>;
66
67
 
67
- export { CLAUDE_SKILL_CONFIG, type InitOptions, type InitResult, QUERY_VERBS, type SkillOptions, parseArgs, readPackageVersion, runInit, runQueryVerb, runSkill };
68
+ export { CLAUDE_SKILL_CONFIG, type InitOptions, type InitResult, QUERY_VERBS, type SkillOptions, parseArgs, printBanner, readPackageVersion, runInit, runQueryVerb, runSkill };
package/dist/cli.js CHANGED
@@ -41,14 +41,16 @@ import {
41
41
  setStatus,
42
42
  startPersistLoop,
43
43
  startStalenessLoop
44
- } from "./chunk-7FTK47JQ.js";
44
+ } from "./chunk-J5CEKCTR.js";
45
45
  import {
46
46
  startOtelGrpcReceiver
47
47
  } from "./chunk-3QCRUEQD.js";
48
48
  import {
49
49
  __dirname,
50
50
  __require,
51
- buildOtelReceiver
51
+ assertBindAuthority,
52
+ buildOtelReceiver,
53
+ readAuthEnv
52
54
  } from "./chunk-HVF4S7J3.js";
53
55
 
54
56
  // src/cli.ts
@@ -383,7 +385,9 @@ async function startWatch(graph, opts) {
383
385
  project: projectName,
384
386
  onPolicyTrigger
385
387
  });
386
- const host = opts.host ?? "0.0.0.0";
388
+ const auth = readAuthEnv();
389
+ const host = opts.host ?? (auth.authToken ? "0.0.0.0" : "127.0.0.1");
390
+ assertBindAuthority(host, auth.authToken);
387
391
  const port = opts.port ?? 8080;
388
392
  const otelPort = opts.otelPort ?? 4318;
389
393
  const cachePath = opts.embeddingsCachePath ?? path2.join(path2.dirname(opts.outPath), "embeddings.json");
@@ -693,7 +697,8 @@ import path4 from "path";
693
697
 
694
698
  // src/installers/templates.ts
695
699
  var OTEL_INIT_HEADER = "// Generated by `neat init --apply` (ADR-069). OpenTelemetry auto-instrumentation hook.";
696
- var OTEL_INIT_STAMP = "// neat-template-version: 2 \u2014 file-first call-site capture (ADR-089).";
700
+ var OTEL_INIT_STAMP = "// neat-template-version: 3 \u2014 file-first call-site capture (ADR-089) + OTLP bearer auth (#410).";
701
+ var OTEL_OTLP_HEADERS_JS = "if (process.env.NEAT_OTEL_TOKEN) process.env.OTEL_EXPORTER_OTLP_HEADERS ||= 'Authorization=Bearer ' + process.env.NEAT_OTEL_TOKEN";
697
702
  function neatCallsiteProcessorSource(ts) {
698
703
  const stackT = ts ? ": string" : "";
699
704
  const spanT = ts ? ": any" : "";
@@ -760,6 +765,7 @@ var OTEL_INIT_CJS = `${OTEL_INIT_HEADER}
760
765
  ${OTEL_INIT_STAMP}
761
766
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
762
767
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
768
+ ${OTEL_OTLP_HEADERS_JS}
763
769
 
764
770
  const { NodeSDK } = require('@opentelemetry/sdk-node')
765
771
  const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
@@ -777,6 +783,7 @@ var OTEL_INIT_ESM = `${OTEL_INIT_HEADER}
777
783
  ${OTEL_INIT_STAMP}
778
784
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
779
785
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
786
+ ${OTEL_OTLP_HEADERS_JS}
780
787
 
781
788
  import { NodeSDK } from '@opentelemetry/sdk-node'
782
789
  import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
@@ -794,6 +801,7 @@ var OTEL_INIT_TS = `${OTEL_INIT_HEADER}
794
801
  ${OTEL_INIT_STAMP}
795
802
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
796
803
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
804
+ ${OTEL_OTLP_HEADERS_JS}
797
805
 
798
806
  import { NodeSDK } from '@opentelemetry/sdk-node'
799
807
  import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
@@ -818,6 +826,8 @@ function renderEnvNeat(serviceName, projectName) {
818
826
  "# Generated by `neat init --apply` (ADR-069).",
819
827
  `OTEL_SERVICE_NAME=${serviceName}`,
820
828
  `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/projects/${projectName}/v1/traces`,
829
+ "# Set NEAT_OTEL_TOKEN to the daemon's OTLP secret to authenticate exported spans (#410).",
830
+ "# NEAT_OTEL_TOKEN=",
821
831
  ""
822
832
  ].join("\n");
823
833
  }
@@ -839,6 +849,7 @@ export async function register() {
839
849
  var NEXT_INSTRUMENTATION_NODE_TS = `${NEXT_INSTRUMENTATION_HEADER}
840
850
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
841
851
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
852
+ ${OTEL_OTLP_HEADERS_JS}
842
853
 
843
854
  import { NodeSDK } from '@opentelemetry/sdk-node'
844
855
  import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
@@ -850,6 +861,7 @@ new NodeSDK({ instrumentations }).start()
850
861
  var NEXT_INSTRUMENTATION_NODE_JS = `${NEXT_INSTRUMENTATION_HEADER}
851
862
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
852
863
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
864
+ ${OTEL_OTLP_HEADERS_JS}
853
865
 
854
866
  const { NodeSDK } = require('@opentelemetry/sdk-node')
855
867
  const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
@@ -868,6 +880,7 @@ var FRAMEWORK_OTEL_INIT_HEADER = "// Generated by `neat init --apply` (ADR-074).
868
880
  var FRAMEWORK_OTEL_INIT_TS_BODY = `${FRAMEWORK_OTEL_INIT_HEADER}
869
881
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
870
882
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
883
+ ${OTEL_OTLP_HEADERS_JS}
871
884
 
872
885
  import { NodeSDK } from '@opentelemetry/sdk-node'
873
886
  import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
@@ -881,6 +894,7 @@ sdk.start()
881
894
  var FRAMEWORK_OTEL_INIT_JS_BODY = `${FRAMEWORK_OTEL_INIT_HEADER}
882
895
  process.env.OTEL_SERVICE_NAME ||= '__SERVICE_NAME__'
883
896
  process.env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT ||= 'http://localhost:4318/projects/__PROJECT__/v1/traces'
897
+ ${OTEL_OTLP_HEADERS_JS}
884
898
 
885
899
  const { NodeSDK } = require('@opentelemetry/sdk-node')
886
900
  const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node')
@@ -3728,7 +3742,7 @@ function printBanner() {
3728
3742
  console.log("\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D ");
3729
3743
  console.log("");
3730
3744
  console.log(" Network Expressive Architecting Tool");
3731
- console.log(" neat.is \xB7 v0.4.0 \xB7 Apache 2.0");
3745
+ console.log(` neat.is \xB7 v${readPackageVersion()} \xB7 Apache 2.0`);
3732
3746
  console.log("");
3733
3747
  }
3734
3748
  function printDiscoveryReport(opts, services) {
@@ -4372,6 +4386,7 @@ export {
4372
4386
  CLAUDE_SKILL_CONFIG,
4373
4387
  QUERY_VERBS,
4374
4388
  parseArgs,
4389
+ printBanner,
4375
4390
  readPackageVersion,
4376
4391
  runInit,
4377
4392
  runQueryVerb,