@prism-d1/cli 1.0.75 → 1.0.77

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.
@@ -1,8 +1,38 @@
1
1
  # Eval Harness
2
2
 
3
- Evaluate AI-generated code against rubrics using Amazon Bedrock. Runs per-file, calculates weighted scores client-side, and integrates with the PRISM eval gate workflow.
3
+ Evaluate code quality in CI using either **kiro-cli headless mode** (recommended) or Amazon Bedrock rubrics.
4
4
 
5
- ## Install
5
+ ## Modes
6
+
7
+ | Mode | Install Command | How It Works |
8
+ |---|---|---|
9
+ | **Kiro** (recommended) | `prism-cli bootstrapper install-eval-harness --mode kiro` | kiro-cli reads files, follows `.kiro/steering/code-review.md`, outputs structured JSON findings |
10
+ | **Bedrock** (legacy) | `prism-cli bootstrapper install-eval-harness --with-rubrics` | Per-file rubric scoring via Bedrock API, weighted average client-side |
11
+
12
+ ## Kiro Mode
13
+
14
+ ```bash
15
+ prism-cli bootstrapper install-eval-harness --mode kiro
16
+ ```
17
+
18
+ This installs:
19
+ - `.kiro/steering/code-review.md` — review rules (plain English)
20
+ - `.github/workflows/prism-eval-gate.yml` — kiro-cli headless CI workflow
21
+
22
+ **Requirements:**
23
+ - `KIRO_API_KEY` repository secret (generate at https://app.kiro.dev → Settings → API Keys)
24
+ - (Optional) `PRISM_METRICS_ROLE_ARN` for EventBridge metrics + AWS Continuum security scanning
25
+
26
+ **How it works:**
27
+ 1. PR opened → workflow triggers
28
+ 2. kiro-cli reads changed files + the diff via `--trust-all-tools`
29
+ 3. Outputs structured JSON: findings with file/line, severity, score
30
+ 4. Gate fails if any high-severity finding or score < 0.82
31
+ 5. PR comment posted with findings table
32
+
33
+ ## Bedrock Mode (Legacy)
34
+
35
+ ## Bedrock Mode (Legacy) — Install
6
36
 
7
37
  ```bash
8
38
  # Workshop mode — empty rubrics, create your own
@@ -283,10 +283,43 @@ jobs:
283
283
  REPO_SLUG=$(echo "${REPO}" | tr '/' '-')
284
284
  CODE_REVIEW_ID=$(aws ssm get-parameter --name "/prism/continuum/code-review-id/${REPO_SLUG}" --query Parameter.Value --output text 2>/dev/null || echo "")
285
285
  if [ -z "$CODE_REVIEW_ID" ]; then
286
- echo "::warning::No Code Review resource for ${REPO_SLUG} -- run 'prism-cli securityagent setup' first. Skipping."
287
- echo "findings=0" >> "$GITHUB_OUTPUT"
288
- echo "skipped=true" >> "$GITHUB_OUTPUT"
289
- exit 0
286
+ echo "No Code Review found for ${REPO_SLUG} -- bootstrapping..."
287
+
288
+ # Get service role (SSM or convention fallback)
289
+ SERVICE_ROLE=$(aws ssm get-parameter --name /prism/continuum/service-role-arn --query Parameter.Value --output text 2>/dev/null || echo "")
290
+ if [ -z "$SERVICE_ROLE" ]; then
291
+ ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
292
+ SERVICE_ROLE="arn:aws:iam::${ACCOUNT_ID}:role/prism-d1-security-agent-prism-d1-security"
293
+ echo " Using convention role: ${SERVICE_ROLE}"
294
+ fi
295
+
296
+ # Upload repo ZIP as source context
297
+ git archive HEAD --format=zip -o /tmp/repo.zip
298
+ aws s3 cp /tmp/repo.zip "s3://${SCAN_BUCKET}/repo/${REPO_SLUG}/latest.zip" --quiet
299
+
300
+ # Create the Code Review resource
301
+ CR_OUTPUT=$(aws securityagent create-code-review \
302
+ --agent-space-id "$AGENT_SPACE_ID" \
303
+ --title "${REPO_SLUG}-ci-diff-scan" \
304
+ --service-role "$SERVICE_ROLE" \
305
+ --assets "{\"sourceCode\":[{\"s3Location\":\"s3://${SCAN_BUCKET}/repo/${REPO_SLUG}/latest.zip\"}]}" \
306
+ --output json 2>&1) || true
307
+ CODE_REVIEW_ID=$(echo "$CR_OUTPUT" | jq -r '.codeReviewId // empty' 2>/dev/null)
308
+
309
+ if [ -z "$CODE_REVIEW_ID" ]; then
310
+ echo "::warning::Bootstrap failed: ${CR_OUTPUT}"
311
+ echo " Run 'sudo prism-cli securityagent setup' from your DevBox to create manually."
312
+ echo "findings=0" >> "$GITHUB_OUTPUT"
313
+ echo "skipped=true" >> "$GITHUB_OUTPUT"
314
+ exit 0
315
+ fi
316
+
317
+ # Persist for future runs
318
+ aws ssm put-parameter \
319
+ --name "/prism/continuum/code-review-id/${REPO_SLUG}" \
320
+ --value "$CODE_REVIEW_ID" \
321
+ --type String --overwrite > /dev/null
322
+ echo " Code Review created: ${CODE_REVIEW_ID} (saved to SSM)"
290
323
  fi
291
324
 
292
325
  # Diff must be uploaded with .patch extension (API requirement)
@@ -306,13 +339,13 @@ jobs:
306
339
  echo "Continuum job started: ${JOB_ID}"
307
340
 
308
341
  STATUS="UNKNOWN"
309
- for i in $(seq 1 30); do
342
+ for i in $(seq 1 60); do
310
343
  sleep 30
311
344
  STATUS=$(aws securityagent batch-get-code-review-jobs \
312
345
  --agent-space-id "${AGENT_SPACE_ID}" \
313
346
  --code-review-job-ids "${JOB_ID}" \
314
347
  --query 'codeReviewJobs[0].status' --output text 2>/dev/null || echo "UNKNOWN")
315
- echo " Poll ${i}/30: ${STATUS}"
348
+ echo " Poll ${i}/60: ${STATUS}"
316
349
  case "$STATUS" in COMPLETED|FAILED|STOPPED) break ;; esac
317
350
  done
318
351
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prism-d1/cli",
3
- "version": "1.0.75",
3
+ "version": "1.0.77",
4
4
  "description": "PRISM D1 Velocity CLI — AI development lifecycle assessment tool",
5
5
  "author": "andklee",
6
6
  "engines": {