import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
import {
  trace,
  TraceContext,
  Trace,
  TraceClass,
  TraceCritical
} from "./debug-trace.js";
import {
  wrapCommand,
  wrapProgram,
  traceStep,
  traceQuery,
  traceAPI
} from "./cli-trace-wrapper.js";
import {
  createTracedDatabase,
  wrapDatabase,
  getQueryStatistics,
  createTracedTransaction
} from "./db-trace-wrapper.js";
import {
  TraceLinearAPI,
  createTracedFetch,
  wrapGraphQLClient
} from "./linear-api-wrapper.js";
function initializeTracing() {
}
function withTracing(fn, options) {
  const originalEnv = process.env["DEBUG_TRACE"];
  try {
    process.env["DEBUG_TRACE"] = "true";
    if (options) {
      if (options.output) process.env["TRACE_OUTPUT"] = options.output;
      if (options.verbosity) process.env["TRACE_VERBOSITY"] = options.verbosity;
      if (options.includeParams !== void 0) {
        process.env["TRACE_PARAMS"] = String(options.includeParams);
      }
      if (options.includeResults !== void 0) {
        process.env["TRACE_RESULTS"] = String(options.includeResults);
      }
      if (options.performanceThreshold !== void 0) {
        process.env["TRACE_PERF_THRESHOLD"] = String(
          options.performanceThreshold
        );
      }
    }
    return fn();
  } finally {
    if (originalEnv === void 0) {
      delete process.env["DEBUG_TRACE"];
    } else {
      process.env["DEBUG_TRACE"] = originalEnv;
    }
  }
}
const enableTracing = () => {
  process.env["DEBUG_TRACE"] = "true";
  console.log("Tracing enabled");
};
const disableTracing = () => {
  delete process.env["DEBUG_TRACE"];
  console.log("Tracing disabled");
};
const enableVerboseTracing = () => {
  process.env["DEBUG_TRACE"] = "true";
  process.env["TRACE_VERBOSITY"] = "full";
  process.env["TRACE_PARAMS"] = "true";
  process.env["TRACE_RESULTS"] = "true";
  process.env["TRACE_MEMORY"] = "true";
  console.log("Verbose tracing enabled");
};
const enableMinimalTracing = () => {
  process.env["DEBUG_TRACE"] = "true";
  process.env["TRACE_VERBOSITY"] = "summary";
  process.env["TRACE_PARAMS"] = "false";
  process.env["TRACE_RESULTS"] = "false";
  process.env["TRACE_MEMORY"] = "false";
  console.log("\u2705 Minimal tracing enabled");
};
export {
  Trace,
  TraceClass,
  TraceContext,
  TraceCritical,
  TraceLinearAPI,
  createTracedDatabase,
  createTracedFetch,
  createTracedTransaction,
  disableTracing,
  enableMinimalTracing,
  enableTracing,
  enableVerboseTracing,
  getQueryStatistics,
  initializeTracing,
  trace,
  traceAPI,
  traceQuery,
  traceStep,
  withTracing,
  wrapCommand,
  wrapDatabase,
  wrapGraphQLClient,
  wrapProgram
};
//# sourceMappingURL=index.js.map
