@prism-d1/cli 1.0.77 → 1.0.80

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.
Files changed (43) hide show
  1. package/dist/assets/github-workflows/prism-ai-metrics.yml +83 -122
  2. package/dist/assets/github-workflows/prism-eval-gate-kiro.yml +66 -0
  3. package/dist/assets/github-workflows/prism-eval-gate.yml +1 -1
  4. package/dist/assets/gitlab-workflows/.gitlab-ci.yml +0 -3
  5. package/dist/assets/gitlab-workflows/prism-ai-metrics.yml +53 -56
  6. package/dist/assets/infra/bin/app.ts +2 -0
  7. package/dist/assets/infra/lib/constructs/otel-collector-construct.ts +62 -0
  8. package/dist/assets/infra/lib/dashboard-stack.ts +541 -1144
  9. package/dist/assets/infra/lib/lambda/attribution-metrics-publisher.ts +248 -0
  10. package/dist/assets/infra/lib/lambda/event-schema.ts +144 -0
  11. package/dist/assets/infra/lib/lambda/metrics-processor.ts +124 -36
  12. package/dist/assets/infra/lib/lambda/otel-receiver.ts +927 -16
  13. package/dist/assets/infra/lib/lambda/productivity-widget.ts +203 -0
  14. package/dist/assets/infra/lib/lambda/security-remediation-tracker.ts +17 -2
  15. package/dist/assets/infra/lib/lambda/velocity-widget.ts +1483 -0
  16. package/dist/assets/infra/lib/metrics-pipeline-stack.ts +191 -119
  17. package/dist/assets/infra/package.json +2 -1
  18. package/dist/assets/infra/tsconfig.json +9 -2
  19. package/dist/src/commands/bootstrapper/install-eval-harness.d.ts +8 -2
  20. package/dist/src/commands/bootstrapper/install-eval-harness.d.ts.map +1 -1
  21. package/dist/src/commands/bootstrapper/install-eval-harness.js +32 -32
  22. package/dist/src/commands/bootstrapper/install-eval-harness.js.map +1 -1
  23. package/dist/src/commands/bootstrapper/install-github-workflows.d.ts.map +1 -1
  24. package/dist/src/commands/bootstrapper/install-github-workflows.js +7 -2
  25. package/dist/src/commands/bootstrapper/install-github-workflows.js.map +1 -1
  26. package/dist/src/commands/bootstrapper/install-gitlab-workflows.d.ts.map +1 -1
  27. package/dist/src/commands/bootstrapper/install-gitlab-workflows.js +7 -1
  28. package/dist/src/commands/bootstrapper/install-gitlab-workflows.js.map +1 -1
  29. package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
  30. package/dist/src/commands/bootstrapper/setup-otel-sync.js +3 -2
  31. package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
  32. package/dist/src/utils/region.d.ts +50 -0
  33. package/dist/src/utils/region.d.ts.map +1 -0
  34. package/dist/src/utils/region.js +62 -0
  35. package/dist/src/utils/region.js.map +1 -0
  36. package/package.json +2 -2
  37. package/dist/assets/eval-harness/README.md +0 -144
  38. package/dist/assets/github-workflows/README.md +0 -110
  39. package/dist/assets/github-workflows/prism-dora-weekly.yml +0 -334
  40. package/dist/assets/gitlab-workflows/prism-dora-weekly.yml +0 -181
  41. package/dist/assets/infra/lib/lambda/defect-correlator.ts +0 -142
  42. package/dist/assets/infra/lib/lambda/spec-to-code-calculator.ts +0 -123
  43. package/dist/assets/metric-hooks/README.md +0 -107
@@ -54,6 +54,11 @@ export class OtelCollectorConstruct extends Construct {
54
54
  public readonly archiveBucket: s3.Bucket;
55
55
  public readonly userPool?: cognito.UserPool;
56
56
  public readonly userPoolClient?: cognito.UserPoolClient;
57
+ /** ARN of the CloudWatch custom-widget Lambda (Developer Productivity table). */
58
+ public productivityWidgetArn?: string;
59
+ /** The otel-receiver Lambda — other constructs may grant themselves invoke
60
+ * for direct aggregation queries (single implementation, no drift). */
61
+ public receiverFunction!: lambda.Function;
57
62
 
58
63
  constructor(scope: Construct, id: string, props: OtelCollectorConstructProps) {
59
64
  super(scope, id);
@@ -196,6 +201,63 @@ export class OtelCollectorConstruct extends Construct {
196
201
  props.aiUsageTable.grantReadWriteData(receiver);
197
202
  this.archiveBucket.grantPut(receiver);
198
203
  props.kmsKey.grantEncryptDecrypt(receiver);
204
+ this.receiverFunction = receiver;
205
+
206
+ // -------------------------------------------------------
207
+ // CloudWatch Custom Widget: Developer Productivity
208
+ // Invoked by CloudWatch dashboards with the VIEWING user's IAM creds
209
+ // (access = lambda:InvokeFunction on this function). Delegates
210
+ // aggregation to the receiver's /v1/productivity handler via direct
211
+ // invoke so there is a single aggregation implementation.
212
+ // -------------------------------------------------------
213
+ const productivityWidget = new lambda.Function(this, 'ProductivityWidget', {
214
+ functionName: 'prism-d1-productivity-widget',
215
+ runtime: lambda.Runtime.NODEJS_22_X,
216
+ handler: 'productivity-widget.handler',
217
+ code: lambda.Code.fromAsset(path.join(__dirname, '..', 'lambda'), {
218
+ bundling: {
219
+ image: lambda.Runtime.NODEJS_22_X.bundlingImage,
220
+ command: [
221
+ 'bash', '-c',
222
+ [
223
+ 'npm init -y > /dev/null 2>&1',
224
+ 'npm install --save @aws-sdk/client-lambda esbuild > /dev/null 2>&1',
225
+ 'npx esbuild productivity-widget.ts --bundle --platform=node --target=node22 --outfile=/asset-output/productivity-widget.js --external:@aws-sdk/*',
226
+ ].join(' && '),
227
+ ],
228
+ local: {
229
+ tryBundle(outputDir: string): boolean {
230
+ try {
231
+ const { execSync } = require('child_process');
232
+ execSync(
233
+ `npx esbuild ${path.join(__dirname, '..', 'lambda', 'productivity-widget.ts')} --bundle --platform=node --target=node22 --outfile=${path.join(outputDir, 'productivity-widget.js')} --external:@aws-sdk/*`,
234
+ { stdio: 'pipe' },
235
+ );
236
+ return true;
237
+ } catch {
238
+ return false;
239
+ }
240
+ },
241
+ },
242
+ },
243
+ }),
244
+ timeout: cdk.Duration.seconds(30),
245
+ memorySize: 256,
246
+ environment: {
247
+ RECEIVER_FUNCTION: receiver.functionName,
248
+ },
249
+ logRetention: logs.RetentionDays.ONE_MONTH,
250
+ description: 'CloudWatch custom widget: per-developer productivity table from the attribution store',
251
+ });
252
+ receiver.grantInvoke(productivityWidget);
253
+ NagSuppressions.addResourceSuppressions(productivityWidget, [
254
+ {
255
+ id: 'AwsSolutions-IAM5',
256
+ reason: 'lambda.grantInvoke scopes to the receiver function ARN plus its versions/aliases (<fn-arn>:*) — a single-function grant, not a broad wildcard.',
257
+ appliesTo: [{ regex: '/^Resource::<OtelCollectorReceiver.*\\.Arn>:\\*$/' }],
258
+ },
259
+ ], true);
260
+ this.productivityWidgetArn = productivityWidget.functionArn;
199
261
 
200
262
  // -------------------------------------------------------
201
263
  // HTTP API — discovery (public) + traces (JWT)