/** * The CDK context flag that, when set, makes `cdk synth` capture per-construct * creation stack traces. cdk-insights's aspect uses these for high-confidence * source-location attribution. Setting this in `cdk.json`'s `context` block is * durable across invocations — preferable to the per-shell `CDK_DEBUG=true` * env var. */ export declare const STACK_TRACE_CONTEXT_KEY = "@aws-cdk/core:stackTrace"; export type PatchResult = { status: 'added'; updated: string; } | { status: 'already-set'; updated: string; } | { status: 'invalid-json'; }; /** * Pure: takes the contents of a `cdk.json` file and returns the same contents * with `context['@aws-cdk/core:stackTrace'] = true` ensured. Preserves trailing * newline if the original had one. Returns 'invalid-json' for files we can't * safely round-trip (anything other than a JSON object at the root). * * Note: round-trips through JSON.parse / JSON.stringify, so any non-standard * formatting (extra blank lines, comments — `cdk.json` is JSON not JSONC) will * be normalised. cdk init emits 2-space indent; we match that. */ export declare const patchCdkJsonForStackTrace: (source: string) => PatchResult; export type EnsureResult = { status: 'added'; cdkJsonPath: string; } | { status: 'already-set'; cdkJsonPath: string; } | { status: 'invalid-json'; cdkJsonPath: string; } | { status: 'missing'; cdkJsonPath: string; }; /** * Side-effecting wrapper: locate `cdk.json` in `projectDir`, patch it if * needed, and report what happened. Soft-fails with `missing` when no * `cdk.json` exists (the project may use a non-standard layout). */ export declare const ensureStackTraceInCdkJson: (projectDir: string) => EnsureResult; /** * Best-effort read of `@aws-cdk/core:stackTrace` from `cdk.json` in `cwd`. * Used by the aspect to suppress its "set CDK_DEBUG" tip when the user has * already set the context durably. */ export declare const isStackTraceContextEnabledInCdkJson: (cwd: string) => boolean;