cdk-insights 1.8.0 → 1.8.2

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/README.md CHANGED
@@ -171,7 +171,13 @@ Aspects.of(app).add(createCdkInsightsAspect());
171
171
  app.synth();
172
172
  ```
173
173
 
174
- Run synth with `CDK_DEBUG=true` so CDK records stack traces for each construct. On `aws-cdk-lib` ≥ 2.252.0, findings on deferred or post-construction property assignments (lifecycle rules, env vars, role policies, `Lazy.string`/`Lazy.any` values) point at the property setter line — not the construct constructor — automatically. Older CDKs continue to work; you'll just get construct-level attribution.
174
+ For accurate `file:line` source attribution, CDK needs to record per-construct stack traces during synth. Three ways to enable this, easiest first:
175
+
176
+ - **`npx cdk-insights setup`** writes `"@aws-cdk/core:stackTrace": true` into your `cdk.json` `context` block — durable across every `cdk synth` invocation, no env-var dance. Recommended.
177
+ - **`cdk synth --context @aws-cdk/core:stackTrace=true`** — one-off, scoped to that command.
178
+ - **`CDK_DEBUG=true cdk synth`** — one-off, env-var form.
179
+
180
+ `cdk-insights scan` already sets `CDK_DEBUG=true` on its spawned synth process, so users on the CLI path get high-confidence attribution out of the box. The above is for users who run `cdk synth` themselves with the aspect attached. On `aws-cdk-lib` ≥ 2.252.0, findings on deferred or post-construction property assignments (lifecycle rules, env vars, role policies, `Lazy.string`/`Lazy.any` values) point at the property setter line — not the construct constructor — automatically. Older CDKs continue to work; you'll just get construct-level attribution.
175
181
 
176
182
  #### Validations plugin — for synth-time enforcement
177
183
 
@@ -150,8 +150,13 @@ export interface CdkInsightsAspectOptions {
150
150
  }
151
151
  /**
152
152
  * Helper function to check if CDK stack traces are enabled.
153
- * Users should set CDK_DEBUG=true or add context @aws-cdk/core:stackTrace: true
154
- * for the most reliable source location capture.
153
+ * Three paths CDK honours, in order of how a user typically sets them:
154
+ * 1. `CDK_DEBUG=true` env var (per-shell, transient).
155
+ * 2. `CDK_CONTEXT_JSON` env containing the `@aws-cdk/core:stackTrace` flag
156
+ * (used by `cdk synth --context @aws-cdk/core:stackTrace=true`).
157
+ * 3. `cdk.json` `context['@aws-cdk/core:stackTrace'] = true` (durable, the
158
+ * path `cdk-insights setup` configures so users don't have to remember
159
+ * anything).
155
160
  */
156
161
  export declare const isCdkDebugEnabled: () => boolean;
157
162
  /**