@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.
- package/dist/assets/github-workflows/prism-ai-metrics.yml +83 -122
- package/dist/assets/github-workflows/prism-eval-gate-kiro.yml +66 -0
- package/dist/assets/github-workflows/prism-eval-gate.yml +1 -1
- package/dist/assets/gitlab-workflows/.gitlab-ci.yml +0 -3
- package/dist/assets/gitlab-workflows/prism-ai-metrics.yml +53 -56
- package/dist/assets/infra/bin/app.ts +2 -0
- package/dist/assets/infra/lib/constructs/otel-collector-construct.ts +62 -0
- package/dist/assets/infra/lib/dashboard-stack.ts +541 -1144
- package/dist/assets/infra/lib/lambda/attribution-metrics-publisher.ts +248 -0
- package/dist/assets/infra/lib/lambda/event-schema.ts +144 -0
- package/dist/assets/infra/lib/lambda/metrics-processor.ts +124 -36
- package/dist/assets/infra/lib/lambda/otel-receiver.ts +927 -16
- package/dist/assets/infra/lib/lambda/productivity-widget.ts +203 -0
- package/dist/assets/infra/lib/lambda/security-remediation-tracker.ts +17 -2
- package/dist/assets/infra/lib/lambda/velocity-widget.ts +1483 -0
- package/dist/assets/infra/lib/metrics-pipeline-stack.ts +191 -119
- package/dist/assets/infra/package.json +2 -1
- package/dist/assets/infra/tsconfig.json +9 -2
- package/dist/src/commands/bootstrapper/install-eval-harness.d.ts +8 -2
- package/dist/src/commands/bootstrapper/install-eval-harness.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-eval-harness.js +32 -32
- package/dist/src/commands/bootstrapper/install-eval-harness.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-github-workflows.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-github-workflows.js +7 -2
- package/dist/src/commands/bootstrapper/install-github-workflows.js.map +1 -1
- package/dist/src/commands/bootstrapper/install-gitlab-workflows.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/install-gitlab-workflows.js +7 -1
- package/dist/src/commands/bootstrapper/install-gitlab-workflows.js.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.d.ts.map +1 -1
- package/dist/src/commands/bootstrapper/setup-otel-sync.js +3 -2
- package/dist/src/commands/bootstrapper/setup-otel-sync.js.map +1 -1
- package/dist/src/utils/region.d.ts +50 -0
- package/dist/src/utils/region.d.ts.map +1 -0
- package/dist/src/utils/region.js +62 -0
- package/dist/src/utils/region.js.map +1 -0
- package/package.json +2 -2
- package/dist/assets/eval-harness/README.md +0 -144
- package/dist/assets/github-workflows/README.md +0 -110
- package/dist/assets/github-workflows/prism-dora-weekly.yml +0 -334
- package/dist/assets/gitlab-workflows/prism-dora-weekly.yml +0 -181
- package/dist/assets/infra/lib/lambda/defect-correlator.ts +0 -142
- package/dist/assets/infra/lib/lambda/spec-to-code-calculator.ts +0 -123
- package/dist/assets/metric-hooks/README.md +0 -107
|
@@ -27,6 +27,8 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
27
27
|
public readonly guardrail: BedrockGuardrailConstruct;
|
|
28
28
|
public readonly securityAgent?: SecurityAgentConstruct;
|
|
29
29
|
public readonly otelCollector?: OtelCollectorConstruct;
|
|
30
|
+
/** ARN of the Team Velocity custom-widget Lambda (DDB-backed panels). */
|
|
31
|
+
public velocityWidgetArn!: string;
|
|
30
32
|
|
|
31
33
|
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
|
|
32
34
|
super(scope, id, props);
|
|
@@ -165,6 +167,10 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
165
167
|
['by-pr', 'gsi_pr', 'gsi_pr_sk'],
|
|
166
168
|
['by-commit', 'gsi_commit', 'gsi_commit_sk'],
|
|
167
169
|
['by-date', 'gsi_date', 'gsi_date_sk'],
|
|
170
|
+
// Sparse index over commit attribution items (only they carry gsi_user):
|
|
171
|
+
// pk USER#<email>, sk COMMIT#<iso-timestamp>. Powers per-developer
|
|
172
|
+
// commit queries for GET /v1/productivity without scanning.
|
|
173
|
+
['by-user', 'gsi_user', 'gsi_user_sk'],
|
|
168
174
|
] as const) {
|
|
169
175
|
this.aiUsageTable.addGlobalSecondaryIndex({
|
|
170
176
|
indexName,
|
|
@@ -243,6 +249,15 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
243
249
|
description: 'Processes PRISM D1 metric events from EventBridge into DynamoDB and CloudWatch',
|
|
244
250
|
});
|
|
245
251
|
|
|
252
|
+
// Cap Lambda's own async retry of function errors (default 2, up to 6h).
|
|
253
|
+
// EventBridge target retries are bounded separately below; together these
|
|
254
|
+
// prevent the unbounded retry amplification behind the July 2026 storm.
|
|
255
|
+
new lambda.EventInvokeConfig(this, 'MetricsProcessorInvokeConfig', {
|
|
256
|
+
function: metricsProcessor,
|
|
257
|
+
retryAttempts: 1,
|
|
258
|
+
maxEventAge: cdk.Duration.hours(1),
|
|
259
|
+
});
|
|
260
|
+
|
|
246
261
|
// -------------------------------------------------------
|
|
247
262
|
// IAM permissions for the processor
|
|
248
263
|
// -------------------------------------------------------
|
|
@@ -284,6 +299,26 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
284
299
|
'prism.d1.quality',
|
|
285
300
|
];
|
|
286
301
|
|
|
302
|
+
// DLQ for events the processor fails to handle. Combined with
|
|
303
|
+
// retryAttempts: 1 this caps the blast radius of a poison event or a
|
|
304
|
+
// downstream outage — the July 2026 retry storm (~108M invocations/day,
|
|
305
|
+
// 445 GB of logs) was driven by unbounded async retries against a
|
|
306
|
+
// throttling failure. Events land here for inspection instead of looping.
|
|
307
|
+
const processorDlq = new sqs.Queue(this, 'MetricsProcessorDlq', {
|
|
308
|
+
queueName: 'prism-d1-metrics-processor-dlq',
|
|
309
|
+
encryption: sqs.QueueEncryption.KMS,
|
|
310
|
+
encryptionMasterKey: prismKmsKey,
|
|
311
|
+
retentionPeriod: cdk.Duration.days(14),
|
|
312
|
+
enforceSSL: true,
|
|
313
|
+
});
|
|
314
|
+
// EventBridge needs KMS grants to write to the CMK-encrypted DLQ —
|
|
315
|
+
// without them messages are dropped silently (no error, no metric).
|
|
316
|
+
prismKmsKey.grant(
|
|
317
|
+
new iam.ServicePrincipal('events.amazonaws.com'),
|
|
318
|
+
'kms:GenerateDataKey',
|
|
319
|
+
'kms:Decrypt',
|
|
320
|
+
);
|
|
321
|
+
|
|
287
322
|
for (const detailType of detailTypes) {
|
|
288
323
|
const ruleName = detailType.replace(/\./g, '-');
|
|
289
324
|
new events.Rule(this, `Rule-${ruleName}`, {
|
|
@@ -293,7 +328,13 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
293
328
|
source: ['prism.d1.velocity'],
|
|
294
329
|
detailType: [detailType],
|
|
295
330
|
},
|
|
296
|
-
targets: [
|
|
331
|
+
targets: [
|
|
332
|
+
new targets.LambdaFunction(metricsProcessor, {
|
|
333
|
+
deadLetterQueue: processorDlq,
|
|
334
|
+
retryAttempts: 1,
|
|
335
|
+
maxEventAge: cdk.Duration.hours(1),
|
|
336
|
+
}),
|
|
337
|
+
],
|
|
297
338
|
description: `Routes ${detailType} events to the metrics processor`,
|
|
298
339
|
});
|
|
299
340
|
}
|
|
@@ -411,7 +452,141 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
411
452
|
],
|
|
412
453
|
}),
|
|
413
454
|
);
|
|
455
|
+
|
|
456
|
+
// Attribution metrics publisher — commit attribution → CloudWatch
|
|
457
|
+
const attrPublisherDlq = new sqs.Queue(this, 'AttrPublisherDlq', {
|
|
458
|
+
retentionPeriod: cdk.Duration.days(7),
|
|
459
|
+
encryption: sqs.QueueEncryption.KMS,
|
|
460
|
+
encryptionMasterKey: prismKmsKey,
|
|
461
|
+
enforceSSL: true,
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
const attrMetricsPublisher = new lambda.Function(this, 'AttributionMetricsPublisher', {
|
|
465
|
+
functionName: 'prism-d1-attribution-metrics-publisher',
|
|
466
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
467
|
+
handler: 'attribution-metrics-publisher.handler',
|
|
468
|
+
timeout: cdk.Duration.seconds(60),
|
|
469
|
+
memorySize: 256,
|
|
470
|
+
environment: {
|
|
471
|
+
METRIC_NAMESPACE: 'PRISM/D1/Velocity',
|
|
472
|
+
AI_USAGE_TABLE: this.aiUsageTable.tableName,
|
|
473
|
+
},
|
|
474
|
+
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda'), {
|
|
475
|
+
bundling: {
|
|
476
|
+
image: lambda.Runtime.NODEJS_22_X.bundlingImage,
|
|
477
|
+
command: [
|
|
478
|
+
'bash', '-c',
|
|
479
|
+
`npx esbuild attribution-metrics-publisher.ts --bundle --platform=node --target=node22 --outfile=/asset-output/attribution-metrics-publisher.js --external:@aws-sdk/*`,
|
|
480
|
+
],
|
|
481
|
+
local: {
|
|
482
|
+
tryBundle(outputDir: string): boolean {
|
|
483
|
+
try {
|
|
484
|
+
require('child_process').execSync(
|
|
485
|
+
`npx esbuild ${path.join(__dirname, 'lambda', 'attribution-metrics-publisher.ts')} --bundle --platform=node --target=node22 --outfile=${path.join(outputDir, 'attribution-metrics-publisher.js')} --external:@aws-sdk/*`,
|
|
486
|
+
{ stdio: 'pipe' },
|
|
487
|
+
);
|
|
488
|
+
return true;
|
|
489
|
+
} catch { return false; }
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
}),
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
// Grant permissions
|
|
497
|
+
this.aiUsageTable.grantReadWriteData(attrMetricsPublisher);
|
|
498
|
+
attrMetricsPublisher.addToRolePolicy(new iam.PolicyStatement({
|
|
499
|
+
actions: ['cloudwatch:PutMetricData'],
|
|
500
|
+
resources: ['*'],
|
|
501
|
+
conditions: { StringEquals: { 'cloudwatch:namespace': 'PRISM/D1/Velocity' } },
|
|
502
|
+
}));
|
|
503
|
+
|
|
504
|
+
// DDB stream trigger — only COMMIT# items (pk begins_with REPO#)
|
|
505
|
+
attrMetricsPublisher.addEventSource(
|
|
506
|
+
new eventsources.DynamoEventSource(this.aiUsageTable, {
|
|
507
|
+
startingPosition: lambda.StartingPosition.LATEST,
|
|
508
|
+
batchSize: 50,
|
|
509
|
+
maxBatchingWindow: cdk.Duration.seconds(15),
|
|
510
|
+
bisectBatchOnError: true,
|
|
511
|
+
retryAttempts: 3,
|
|
512
|
+
onFailure: new eventsources.SqsDlq(attrPublisherDlq),
|
|
513
|
+
filters: [
|
|
514
|
+
lambda.FilterCriteria.filter({
|
|
515
|
+
eventName: lambda.FilterRule.or('INSERT', 'MODIFY'),
|
|
516
|
+
dynamodb: {
|
|
517
|
+
Keys: {
|
|
518
|
+
pk: { S: lambda.FilterRule.beginsWith('REPO#') },
|
|
519
|
+
sk: { S: lambda.FilterRule.beginsWith('COMMIT#') },
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
}),
|
|
523
|
+
],
|
|
524
|
+
}),
|
|
525
|
+
);
|
|
526
|
+
|
|
527
|
+
NagSuppressions.addResourceSuppressions(
|
|
528
|
+
attrMetricsPublisher,
|
|
529
|
+
[{ id: 'AwsSolutions-IAM5', reason: 'CloudWatch PutMetricData requires * resource, scoped by namespace condition' }],
|
|
530
|
+
true,
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
// -------------------------------------------------------
|
|
535
|
+
// Velocity custom-widget Lambda — DDB-backed panels for the
|
|
536
|
+
// Team Velocity dashboard. Reads the events table via the
|
|
537
|
+
// by-detail-type GSI (full history, no metric-dimension matching).
|
|
538
|
+
// Invoked by CloudWatch dashboards with the viewing user's IAM creds.
|
|
539
|
+
// -------------------------------------------------------
|
|
540
|
+
const velocityWidget = new lambda.Function(this, 'VelocityWidget', {
|
|
541
|
+
functionName: 'prism-d1-velocity-widget',
|
|
542
|
+
runtime: lambda.Runtime.NODEJS_22_X,
|
|
543
|
+
handler: 'velocity-widget.handler',
|
|
544
|
+
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda'), {
|
|
545
|
+
bundling: {
|
|
546
|
+
image: lambda.Runtime.NODEJS_22_X.bundlingImage,
|
|
547
|
+
command: [
|
|
548
|
+
'bash', '-c',
|
|
549
|
+
[
|
|
550
|
+
'npm init -y > /dev/null 2>&1',
|
|
551
|
+
'npm install --save @aws-sdk/client-dynamodb @aws-sdk/client-lambda esbuild > /dev/null 2>&1',
|
|
552
|
+
'npx esbuild velocity-widget.ts --bundle --platform=node --target=node22 --outfile=/asset-output/velocity-widget.js --external:@aws-sdk/*',
|
|
553
|
+
].join(' && '),
|
|
554
|
+
],
|
|
555
|
+
local: {
|
|
556
|
+
tryBundle(outputDir: string): boolean {
|
|
557
|
+
try {
|
|
558
|
+
require('child_process').execSync(
|
|
559
|
+
`npx esbuild ${path.join(__dirname, 'lambda', 'velocity-widget.ts')} --bundle --platform=node --target=node22 --outfile=${path.join(outputDir, 'velocity-widget.js')} --external:@aws-sdk/*`,
|
|
560
|
+
{ stdio: 'pipe' },
|
|
561
|
+
);
|
|
562
|
+
return true;
|
|
563
|
+
} catch { return false; }
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
}),
|
|
568
|
+
timeout: cdk.Duration.seconds(30),
|
|
569
|
+
memorySize: 256,
|
|
570
|
+
environment: {
|
|
571
|
+
EVENTS_TABLE: this.eventsTable.tableName,
|
|
572
|
+
RECEIVER_FUNCTION: 'prism-d1-otel-receiver',
|
|
573
|
+
},
|
|
574
|
+
logRetention: logs.RetentionDays.ONE_MONTH,
|
|
575
|
+
description: 'CloudWatch custom widget: Team Velocity panels from the PRISM events table',
|
|
576
|
+
});
|
|
577
|
+
this.eventsTable.grantReadData(velocityWidget);
|
|
578
|
+
if (this.otelCollector) {
|
|
579
|
+
// aidora view delegates attribution KPIs to the receiver; without the
|
|
580
|
+
// collector the view degrades gracefully (eval KPI only).
|
|
581
|
+
this.otelCollector.receiverFunction.grantInvoke(velocityWidget);
|
|
414
582
|
}
|
|
583
|
+
this.velocityWidgetArn = velocityWidget.functionArn;
|
|
584
|
+
NagSuppressions.addResourceSuppressions(
|
|
585
|
+
velocityWidget,
|
|
586
|
+
[{ id: 'AwsSolutions-IAM4', reason: 'AWSLambdaBasicExecutionRole for CloudWatch Logs' },
|
|
587
|
+
{ id: 'AwsSolutions-IAM5', reason: 'Table read grant includes index ARNs (table/*/index/*)' }],
|
|
588
|
+
true,
|
|
589
|
+
);
|
|
415
590
|
|
|
416
591
|
// -------------------------------------------------------
|
|
417
592
|
// AWS Security Agent (opt-in — requires Security Agent access)
|
|
@@ -605,125 +780,22 @@ export class MetricsPipelineStack extends cdk.Stack {
|
|
|
605
780
|
});
|
|
606
781
|
|
|
607
782
|
// -------------------------------------------------------
|
|
608
|
-
// Defect Correlator
|
|
609
|
-
//
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
'npx esbuild defect-correlator.ts --bundle --platform=node --target=node22 --outfile=/asset-output/defect-correlator.js --external:@aws-sdk/*',
|
|
624
|
-
].join(' && '),
|
|
625
|
-
],
|
|
626
|
-
local: {
|
|
627
|
-
tryBundle(outputDir: string): boolean {
|
|
628
|
-
try {
|
|
629
|
-
const { execSync } = require('child_process');
|
|
630
|
-
execSync(
|
|
631
|
-
`npx esbuild ${path.join(__dirname, 'lambda', 'defect-correlator.ts')} --bundle --platform=node --target=node22 --outfile=${path.join(outputDir, 'defect-correlator.js')} --external:@aws-sdk/*`,
|
|
632
|
-
{ stdio: 'pipe' },
|
|
633
|
-
);
|
|
634
|
-
return true;
|
|
635
|
-
} catch {
|
|
636
|
-
return false;
|
|
637
|
-
}
|
|
638
|
-
},
|
|
639
|
-
},
|
|
640
|
-
},
|
|
641
|
-
}),
|
|
642
|
-
timeout: cdk.Duration.seconds(30),
|
|
643
|
-
memorySize: 256,
|
|
644
|
-
environment: {
|
|
645
|
-
EVENTS_TABLE: this.eventsTable.tableName,
|
|
646
|
-
EVENT_BUS_NAME: this.eventBus.eventBusName,
|
|
647
|
-
LOOKBACK_HOURS: '24',
|
|
648
|
-
},
|
|
649
|
-
logRetention: logs.RetentionDays.ONE_MONTH,
|
|
650
|
-
description: 'Correlates deployment failures with AI vs human commit origins',
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
this.eventsTable.grantReadData(defectCorrelator);
|
|
654
|
-
this.eventBus.grantPutEventsTo(defectCorrelator);
|
|
655
|
-
|
|
656
|
-
// Trigger defect correlator on failed deploy events
|
|
657
|
-
new events.Rule(this, 'DeployToDefectCorrelatorRule', {
|
|
658
|
-
ruleName: 'prism-d1-deploy-to-defect-correlator',
|
|
659
|
-
eventBus: this.eventBus,
|
|
660
|
-
eventPattern: {
|
|
661
|
-
source: ['prism.d1.velocity'],
|
|
662
|
-
detailType: ['prism.d1.deploy'],
|
|
663
|
-
},
|
|
664
|
-
targets: [new targets.LambdaFunction(defectCorrelator)],
|
|
665
|
-
description: 'Triggers defect correlation on deployment events',
|
|
666
|
-
});
|
|
667
|
-
|
|
783
|
+
// REMOVED: Defect Correlator + Spec-to-Code Calculator
|
|
784
|
+
//
|
|
785
|
+
// Both were permanent no-ops. Each keyed off `prism.d1.commit`, which no
|
|
786
|
+
// DEPLOYED producer emits — the only emitters are the demo-data generator
|
|
787
|
+
// and docs/reference/github-webhook-handler/, which CDK never deploys.
|
|
788
|
+
// defect-correlator skipped every event via `detailType !==
|
|
789
|
+
// 'prism.d1.commit'` and returned early; spec-to-code-calculator queried
|
|
790
|
+
// for the same type (with a Limit:1 + FilterExpression bug on top, so the
|
|
791
|
+
// filter never ran) and found nothing. They consumed IAM, VPC attachments,
|
|
792
|
+
// and log groups while implying capability the pipeline did not have.
|
|
793
|
+
//
|
|
794
|
+
// Their metrics (PostMergeDefectRate, SpecToCodeHours) and the
|
|
795
|
+
// prism.d1.quality event type went with them. The working equivalent of
|
|
796
|
+
// post-merge defect rate is RevertedAICommits / MergedAICommits from the
|
|
797
|
+
// attribution store, already on the dashboards.
|
|
668
798
|
// -------------------------------------------------------
|
|
669
|
-
// Spec-to-Code Calculator (Pillar 7)
|
|
670
|
-
// -------------------------------------------------------
|
|
671
|
-
const specToCodeCalc = new lambda.Function(this, 'SpecToCodeCalculator', {
|
|
672
|
-
functionName: 'prism-d1-spec-to-code-calculator',
|
|
673
|
-
runtime: lambda.Runtime.NODEJS_22_X,
|
|
674
|
-
handler: 'spec-to-code-calculator.handler',
|
|
675
|
-
...lambdaVpcProps,
|
|
676
|
-
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda'), {
|
|
677
|
-
bundling: {
|
|
678
|
-
image: lambda.Runtime.NODEJS_22_X.bundlingImage,
|
|
679
|
-
command: [
|
|
680
|
-
'bash', '-c',
|
|
681
|
-
[
|
|
682
|
-
'npm init -y > /dev/null 2>&1',
|
|
683
|
-
'npm install --save @aws-sdk/client-dynamodb @aws-sdk/client-eventbridge esbuild > /dev/null 2>&1',
|
|
684
|
-
'npx esbuild spec-to-code-calculator.ts --bundle --platform=node --target=node22 --outfile=/asset-output/spec-to-code-calculator.js --external:@aws-sdk/*',
|
|
685
|
-
].join(' && '),
|
|
686
|
-
],
|
|
687
|
-
local: {
|
|
688
|
-
tryBundle(outputDir: string): boolean {
|
|
689
|
-
try {
|
|
690
|
-
const { execSync } = require('child_process');
|
|
691
|
-
execSync(
|
|
692
|
-
`npx esbuild ${path.join(__dirname, 'lambda', 'spec-to-code-calculator.ts')} --bundle --platform=node --target=node22 --outfile=${path.join(outputDir, 'spec-to-code-calculator.js')} --external:@aws-sdk/*`,
|
|
693
|
-
{ stdio: 'pipe' },
|
|
694
|
-
);
|
|
695
|
-
return true;
|
|
696
|
-
} catch {
|
|
697
|
-
return false;
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
|
-
},
|
|
702
|
-
}),
|
|
703
|
-
timeout: cdk.Duration.seconds(30),
|
|
704
|
-
memorySize: 256,
|
|
705
|
-
environment: {
|
|
706
|
-
EVENTS_TABLE: this.eventsTable.tableName,
|
|
707
|
-
EVENT_BUS_NAME: this.eventBus.eventBusName,
|
|
708
|
-
},
|
|
709
|
-
logRetention: logs.RetentionDays.ONE_MONTH,
|
|
710
|
-
description: 'Calculates spec-to-code hours for merged PRs with spec references',
|
|
711
|
-
});
|
|
712
|
-
|
|
713
|
-
this.eventsTable.grantReadData(specToCodeCalc);
|
|
714
|
-
this.eventBus.grantPutEventsTo(specToCodeCalc);
|
|
715
|
-
|
|
716
|
-
// Trigger spec-to-code calculator on merged PR events
|
|
717
|
-
new events.Rule(this, 'PrToSpecCalcRule', {
|
|
718
|
-
ruleName: 'prism-d1-pr-to-spec-calc',
|
|
719
|
-
eventBus: this.eventBus,
|
|
720
|
-
eventPattern: {
|
|
721
|
-
source: ['prism.d1.velocity'],
|
|
722
|
-
detailType: ['prism.d1.pr'],
|
|
723
|
-
},
|
|
724
|
-
targets: [new targets.LambdaFunction(specToCodeCalc)],
|
|
725
|
-
description: 'Triggers spec-to-code calculation on merged PR events',
|
|
726
|
-
});
|
|
727
799
|
|
|
728
800
|
// -------------------------------------------------------
|
|
729
801
|
// AWS Security Agent Integration
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2022",
|
|
4
4
|
"module": "commonjs",
|
|
5
|
-
"lib": [
|
|
5
|
+
"lib": [
|
|
6
|
+
"es2022"
|
|
7
|
+
],
|
|
6
8
|
"declaration": true,
|
|
7
9
|
"strict": true,
|
|
8
10
|
"noImplicitAny": true,
|
|
@@ -20,5 +22,10 @@
|
|
|
20
22
|
"outDir": "./dist",
|
|
21
23
|
"rootDir": "."
|
|
22
24
|
},
|
|
23
|
-
"exclude": [
|
|
25
|
+
"exclude": [
|
|
26
|
+
"node_modules",
|
|
27
|
+
"dist",
|
|
28
|
+
"lib/lambda",
|
|
29
|
+
"scripts"
|
|
30
|
+
]
|
|
24
31
|
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
description: string;
|
|
3
|
-
options: {
|
|
3
|
+
options: ({
|
|
4
4
|
flags: string;
|
|
5
5
|
description: string;
|
|
6
|
-
|
|
6
|
+
default?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
flags: string;
|
|
9
|
+
description: string;
|
|
10
|
+
default: string;
|
|
11
|
+
})[];
|
|
7
12
|
action(opts: {
|
|
8
13
|
mode?: string;
|
|
9
14
|
withRubrics?: boolean;
|
|
10
15
|
model?: string;
|
|
11
16
|
threshold?: string;
|
|
17
|
+
region?: string;
|
|
12
18
|
uninstall?: boolean;
|
|
13
19
|
}): Promise<void>;
|
|
14
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-eval-harness.d.ts","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-eval-harness.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install-eval-harness.d.ts","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-eval-harness.ts"],"names":[],"mappings":";;;;;;;;;;;iBA2DqB;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;;AAVvI,wBAoCE"}
|
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync, copyFileSync, chmodSync, readdirSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, chmodSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { resolve, dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import { execSync } from 'node:child_process';
|
|
5
5
|
import { createInterface } from 'node:readline';
|
|
6
6
|
import { getAssetPath } from '../../utils/root.js';
|
|
7
|
+
import { applyRegion, findDefaultRegionRefs, DEFAULT_REGION } from '../../utils/region.js';
|
|
8
|
+
/**
|
|
9
|
+
* Copies a workflow asset into the repo with the region templated.
|
|
10
|
+
*
|
|
11
|
+
* Must not be a bare copyFileSync: these assets are authored against
|
|
12
|
+
* DEFAULT_REGION, and an unsubstituted copy sends the Continuum scan and
|
|
13
|
+
* event-emission calls to a region where the agent space and scan bucket do
|
|
14
|
+
* not exist -- which fails the gate closed and blocks merges.
|
|
15
|
+
*/
|
|
16
|
+
async function writeWorkflow(src, dest, region, label, ask) {
|
|
17
|
+
if (existsSync(dest)) {
|
|
18
|
+
const overwrite = await ask('Workflow already exists. Overwrite? [y/N]', 'n');
|
|
19
|
+
if (overwrite.toLowerCase() !== 'y') {
|
|
20
|
+
console.log(' Skipped workflow.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const content = applyRegion(readFileSync(src, 'utf-8'), region);
|
|
25
|
+
const stragglers = findDefaultRegionRefs(content, label);
|
|
26
|
+
if (stragglers.length > 0) {
|
|
27
|
+
console.warn(` ⚠ ${stragglers.length} unconverted region reference(s):`);
|
|
28
|
+
stragglers.forEach(s => console.warn(` ${s}`));
|
|
29
|
+
}
|
|
30
|
+
writeFileSync(dest, content);
|
|
31
|
+
console.log(`✓ Installed ${label} (region: ${region})`);
|
|
32
|
+
}
|
|
7
33
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
34
|
const EVAL_SOURCE = getAssetPath(import.meta.url, 'bootstrapper/eval-harness');
|
|
9
35
|
function prompt(question, defaultValue) {
|
|
@@ -18,6 +44,7 @@ export default {
|
|
|
18
44
|
{ flags: '--with-rubrics', description: 'Include production rubrics (bedrock mode only)' },
|
|
19
45
|
{ flags: '--model <id>', description: 'Bedrock model ID for evaluation (bedrock mode only)' },
|
|
20
46
|
{ flags: '--threshold <n>', description: 'Pass threshold (0-1)' },
|
|
47
|
+
{ flags: '--region <region>', description: 'AWS region for EventBridge/CloudWatch/Continuum', default: DEFAULT_REGION },
|
|
21
48
|
{ flags: '--uninstall', description: 'Remove eval-harness directory and steering files' },
|
|
22
49
|
],
|
|
23
50
|
async action(opts) {
|
|
@@ -46,6 +73,7 @@ export default {
|
|
|
46
73
|
},
|
|
47
74
|
};
|
|
48
75
|
async function installKiroMode(gitRoot, opts) {
|
|
76
|
+
const region = opts.region || DEFAULT_REGION;
|
|
49
77
|
// --- Install steering file ---
|
|
50
78
|
const steeringDir = resolve(gitRoot, '.kiro/steering');
|
|
51
79
|
mkdirSync(steeringDir, { recursive: true });
|
|
@@ -70,21 +98,7 @@ async function installKiroMode(gitRoot, opts) {
|
|
|
70
98
|
const workflowSrc = getAssetPath(import.meta.url, 'bootstrapper/github-workflows/prism-eval-gate-kiro.yml');
|
|
71
99
|
if (existsSync(workflowSrc)) {
|
|
72
100
|
mkdirSync(workflowsDir, { recursive: true });
|
|
73
|
-
|
|
74
|
-
if (existsSync(dest)) {
|
|
75
|
-
const overwrite = await prompt('Workflow already exists. Overwrite? [y/N]', 'n');
|
|
76
|
-
if (overwrite.toLowerCase() !== 'y') {
|
|
77
|
-
console.log(' Skipped workflow.');
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
copyFileSync(workflowSrc, dest);
|
|
81
|
-
console.log('✓ Updated .github/workflows/prism-eval-gate.yml');
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
copyFileSync(workflowSrc, dest);
|
|
86
|
-
console.log('✓ Installed .github/workflows/prism-eval-gate.yml');
|
|
87
|
-
}
|
|
101
|
+
await writeWorkflow(workflowSrc, resolve(workflowsDir, 'prism-eval-gate.yml'), region, '.github/workflows/prism-eval-gate.yml', prompt);
|
|
88
102
|
}
|
|
89
103
|
console.log('\n════════════════════════════════════════════════');
|
|
90
104
|
console.log(' ✅ Kiro eval gate installed!');
|
|
@@ -101,7 +115,7 @@ async function installBedrockMode(gitRoot, targetDir, opts) {
|
|
|
101
115
|
// --- Config ---
|
|
102
116
|
const model = opts.model || await prompt('Eval model ID', 'us.anthropic.claude-haiku-4-5-20251001-v1:0');
|
|
103
117
|
const threshold = opts.threshold || await prompt('Pass threshold', '0.82');
|
|
104
|
-
const region = await prompt('AWS region',
|
|
118
|
+
const region = opts.region || await prompt('AWS region', DEFAULT_REGION);
|
|
105
119
|
// --- Install script + config ---
|
|
106
120
|
mkdirSync(resolve(targetDir, 'rubrics'), { recursive: true });
|
|
107
121
|
// Copy run-eval.sh
|
|
@@ -134,21 +148,7 @@ async function installBedrockMode(gitRoot, targetDir, opts) {
|
|
|
134
148
|
const workflowSrc = getAssetPath(import.meta.url, 'bootstrapper/github-workflows/prism-eval-gate.yml');
|
|
135
149
|
if (existsSync(workflowSrc)) {
|
|
136
150
|
mkdirSync(workflowsDir, { recursive: true });
|
|
137
|
-
|
|
138
|
-
if (existsSync(dest)) {
|
|
139
|
-
const overwrite = await prompt('Workflow already exists. Overwrite? [y/N]', 'n');
|
|
140
|
-
if (overwrite.toLowerCase() !== 'y') {
|
|
141
|
-
console.log(' Skipped workflow.');
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
copyFileSync(workflowSrc, dest);
|
|
145
|
-
console.log('✓ Updated .github/workflows/prism-eval-gate.yml');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
copyFileSync(workflowSrc, dest);
|
|
150
|
-
console.log('✓ Installed .github/workflows/prism-eval-gate.yml');
|
|
151
|
-
}
|
|
151
|
+
await writeWorkflow(workflowSrc, resolve(workflowsDir, 'prism-eval-gate.yml'), region, '.github/workflows/prism-eval-gate.yml', prompt);
|
|
152
152
|
}
|
|
153
153
|
console.log('\n════════════════════════════════════════════════');
|
|
154
154
|
console.log(' ✅ Eval harness installed (legacy Bedrock mode)!');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-eval-harness.js","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-eval-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"install-eval-harness.js","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-eval-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACnH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE3F;;;;;;;GAOG;AACH,KAAK,UAAU,aAAa,CAC1B,GAAW,EACX,IAAY,EACZ,MAAc,EACd,KAAa,EACb,GAA+C;IAE/C,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;QAC9E,IAAI,SAAS,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACnC,OAAO;QACT,CAAC;IACH,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,I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workflows.ts"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"install-github-workflows.d.ts","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-github-workflows.ts"],"names":[],"mappings":";;;;;;;iBAWqB;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;;AAN3D,wBAsCE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { getAssetPath } from '../../utils/root.js';
|
|
4
|
+
import { applyRegion, findDefaultRegionRefs } from '../../utils/region.js';
|
|
4
5
|
export default {
|
|
5
6
|
description: 'Install GitHub Actions workflow templates into the current repo',
|
|
6
7
|
options: [
|
|
@@ -18,8 +19,12 @@ export default {
|
|
|
18
19
|
const files = readdirSync(assetDir).filter(f => f.endsWith('.yml'));
|
|
19
20
|
for (const file of files) {
|
|
20
21
|
let content = readFileSync(join(assetDir, file), 'utf-8');
|
|
21
|
-
content = content
|
|
22
|
-
|
|
22
|
+
content = applyRegion(content, region);
|
|
23
|
+
const stragglers = findDefaultRegionRefs(content, file);
|
|
24
|
+
if (stragglers.length > 0) {
|
|
25
|
+
console.warn(` ⚠ ${file}: ${stragglers.length} unconverted region reference(s):`);
|
|
26
|
+
stragglers.forEach(s => console.warn(` ${s}`));
|
|
27
|
+
}
|
|
23
28
|
writeFileSync(join(outputDir, file), content);
|
|
24
29
|
console.log(` ✓ ${file}`);
|
|
25
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-github-workflows.js","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-github-workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"install-github-workflows.js","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-github-workflows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,eAAe;IACb,WAAW,EAAE,iEAAiE;IAC9E,OAAO,EAAE;QACP,EAAE,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,uCAAuC,EAAE,OAAO,EAAE,WAAW,EAAE;QAC1G,EAAE,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,mBAAmB,EAAE;KAC/F;IACD,KAAK,CAAC,MAAM,CAAC,IAA4C;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,WAAW,CAAC;QAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAEjC,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,cAAc,SAAS,KAAK,CAAC,CAAC;QAE1C,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE1C,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,uCAAuC,CAAC,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;QAC7H,MAAM,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC,CAA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../../../../src/commands/bootstrapper/install-gitlab-workflows.ts"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"install-gitlab-workflows.d.ts","sourceRoot":"","sources":["../../../../src/commands/bootstrapper/install-gitlab-workflows.ts"],"names":[],"mappings":";;;;;;;iBAwBqB;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;;AAP/E,wBAoDE"}
|
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync } from
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { createInterface } from 'node:readline';
|
|
4
4
|
import { getAssetPath } from '../../utils/root.js';
|
|
5
|
+
import { applyRegion, findDefaultRegionRefs } from '../../utils/region.js';
|
|
5
6
|
function prompt(question, defaultValue) {
|
|
6
7
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
7
8
|
const suffix = defaultValue ? ` [${defaultValue}]` : '';
|
|
@@ -34,7 +35,12 @@ export default {
|
|
|
34
35
|
let content = readFileSync(join(assetDir, file), 'utf-8');
|
|
35
36
|
// Template the audience and region
|
|
36
37
|
content = content.replace(/aud: https:\/\/gitlab\.com/g, `aud: ${gitlabUrl}`);
|
|
37
|
-
content = content
|
|
38
|
+
content = applyRegion(content, region);
|
|
39
|
+
const stragglers = findDefaultRegionRefs(content, file);
|
|
40
|
+
if (stragglers.length > 0) {
|
|
41
|
+
console.warn(` ⚠ ${file}: ${stragglers.length} unconverted region reference(s):`);
|
|
42
|
+
stragglers.forEach(s => console.warn(` ${s}`));
|
|
43
|
+
}
|
|
38
44
|
writeFileSync(join(outputDir, file), content);
|
|
39
45
|
console.log(` ✓ ${file}`);
|
|
40
46
|
}
|