From 6e58be07061b6434c64e5bbb8a640914cf97d65f Mon Sep 17 00:00:00 2001 From: Mayankverma210405 Date: Wed, 5 Aug 2026 17:17:13 +0530 Subject: [PATCH 1/9] feat: add ChangeGraph release intelligence kit --- .../.env.example | 6 + .../.gitignore | 4 + .../README.md | 369 + .../changegraph-release-intelligence/agent.md | 3 + .../apps/.env.example | 6 + .../apps/.gitignore | 43 + .../apps/README.md | 113 + .../apps/actions/orchestrate.ts | 714 ++ .../apps/app/api/analyze/route.ts | 420 + .../apps/app/favicon.ico | Bin 0 -> 25931 bytes .../apps/app/globals.css | 1119 +++ .../apps/app/layout.tsx | 23 + .../apps/app/page.tsx | 5 + .../apps/components/changegraph-dashboard.tsx | 1153 +++ .../apps/eslint.config.mjs | 18 + .../apps/lib/archive-reader.ts | 296 + .../apps/lib/blast-radius.ts | 685 ++ .../apps/lib/change-package.ts | 209 + .../apps/lib/flow-parser.ts | 649 ++ .../apps/lib/lamatic-client.ts | 189 + .../apps/lib/risk-score.ts | 810 ++ .../apps/lib/schemas.ts | 548 ++ .../apps/lib/secret-redactor.ts | 158 + .../apps/lib/structural-diff.ts | 841 ++ .../apps/next.config.ts | 13 + .../apps/package-lock.json | 6898 +++++++++++++++++ .../apps/package.json | 30 + .../apps/postcss.config.mjs | 7 + .../apps/tsconfig.json | 34 + .../apps/types/changegraph.ts | 243 + .../constitutions/default.md | 17 + .../flows/analyze-change-impact.ts | 144 + .../flows/generate-release-plan.ts | 143 + .../lamatic.config.ts | 44 + ...node-356-copy-979_generative-model-name.ts | 19 + ...uctor-llmnode-863_generative-model-name.ts | 19 + ...nstructor-llmnode-356-copy-979_system_0.md | 28 + ..._instructor-llmnode-356-copy-979_user_1.md | 93 + ...se-plan_instructor-llmnode-863_system_0.md | 48 + ...ease-plan_instructor-llmnode-863_user_1.md | 33 + 40 files changed, 16194 insertions(+) create mode 100644 kits/changegraph-release-intelligence/.env.example create mode 100644 kits/changegraph-release-intelligence/.gitignore create mode 100644 kits/changegraph-release-intelligence/README.md create mode 100644 kits/changegraph-release-intelligence/agent.md create mode 100644 kits/changegraph-release-intelligence/apps/.env.example create mode 100644 kits/changegraph-release-intelligence/apps/.gitignore create mode 100644 kits/changegraph-release-intelligence/apps/README.md create mode 100644 kits/changegraph-release-intelligence/apps/actions/orchestrate.ts create mode 100644 kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts create mode 100644 kits/changegraph-release-intelligence/apps/app/favicon.ico create mode 100644 kits/changegraph-release-intelligence/apps/app/globals.css create mode 100644 kits/changegraph-release-intelligence/apps/app/layout.tsx create mode 100644 kits/changegraph-release-intelligence/apps/app/page.tsx create mode 100644 kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx create mode 100644 kits/changegraph-release-intelligence/apps/eslint.config.mjs create mode 100644 kits/changegraph-release-intelligence/apps/lib/archive-reader.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/blast-radius.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/change-package.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/flow-parser.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/lamatic-client.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/risk-score.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/schemas.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/secret-redactor.ts create mode 100644 kits/changegraph-release-intelligence/apps/lib/structural-diff.ts create mode 100644 kits/changegraph-release-intelligence/apps/next.config.ts create mode 100644 kits/changegraph-release-intelligence/apps/package-lock.json create mode 100644 kits/changegraph-release-intelligence/apps/package.json create mode 100644 kits/changegraph-release-intelligence/apps/postcss.config.mjs create mode 100644 kits/changegraph-release-intelligence/apps/tsconfig.json create mode 100644 kits/changegraph-release-intelligence/apps/types/changegraph.ts create mode 100644 kits/changegraph-release-intelligence/constitutions/default.md create mode 100644 kits/changegraph-release-intelligence/flows/analyze-change-impact.ts create mode 100644 kits/changegraph-release-intelligence/flows/generate-release-plan.ts create mode 100644 kits/changegraph-release-intelligence/lamatic.config.ts create mode 100644 kits/changegraph-release-intelligence/model-configs/analyze-change-impact_instructor-llmnode-356-copy-979_generative-model-name.ts create mode 100644 kits/changegraph-release-intelligence/model-configs/generate-release-plan_instructor-llmnode-863_generative-model-name.ts create mode 100644 kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_system_0.md create mode 100644 kits/changegraph-release-intelligence/prompts/analyze-change-impact_instructor-llmnode-356-copy-979_user_1.md create mode 100644 kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_system_0.md create mode 100644 kits/changegraph-release-intelligence/prompts/generate-release-plan_instructor-llmnode-863_user_1.md diff --git a/kits/changegraph-release-intelligence/.env.example b/kits/changegraph-release-intelligence/.env.example new file mode 100644 index 000000000..e34d97c33 --- /dev/null +++ b/kits/changegraph-release-intelligence/.env.example @@ -0,0 +1,6 @@ +LAMATIC_API_KEY=your_lamatic_api_key +LAMATIC_PROJECT_ID=your_lamatic_project_id +LAMATIC_API_URL=your_lamatic_api_url + +ANALYZE_CHANGE_IMPACT_FLOW_ID=your_analyze_change_impact_flow_id +GENERATE_RELEASE_PLAN_FLOW_ID=your_generate_release_plan_flow_id diff --git a/kits/changegraph-release-intelligence/.gitignore b/kits/changegraph-release-intelligence/.gitignore new file mode 100644 index 000000000..5d996efe4 --- /dev/null +++ b/kits/changegraph-release-intelligence/.gitignore @@ -0,0 +1,4 @@ +.lamatic/ +node_modules/ +.env +.env.local diff --git a/kits/changegraph-release-intelligence/README.md b/kits/changegraph-release-intelligence/README.md new file mode 100644 index 000000000..8cad242dd --- /dev/null +++ b/kits/changegraph-release-intelligence/README.md @@ -0,0 +1,369 @@ +# ChangeGraph + +ChangeGraph is a pre-deployment release-intelligence kit for Lamatic workflows. + +It compares baseline and candidate workflow exports, identifies structural and semantic changes, calculates downstream blast radius, assigns a deterministic risk score, and generates a safe-promotion decision with targeted tests and rollback guidance. + +## Why ChangeGraph + +AI workflow releases can introduce risk through seemingly small modifications: + +- Prompt changes +- Model or temperature changes +- Input and output schema changes +- Permission expansion +- External write tools +- Retry removal +- Fallback removal +- Graph-edge changes +- Safety-instruction changes + +ChangeGraph provides a structured review layer before a candidate workflow is promoted. + +It answers: + +- What changed? +- Which components are directly affected? +- Which downstream paths may be affected? +- How risky is the release? +- Should it be promoted, manually reviewed, or blocked? +- What tests should be executed? +- What should be restored during rollback? + +## Features + +- Baseline and candidate ZIP comparison +- Browser-side archive reading +- Lamatic workflow parsing +- Prompt and model-configuration comparison +- Structural graph diffing +- Downstream blast-radius analysis +- Deterministic risk scoring +- Lamatic-powered semantic impact analysis +- Targeted test generation +- Deployment-checklist generation +- Rollback-manifest generation +- Secret redaction before server transmission +- Safe deterministic fallbacks for invalid AI output +- Responsive Next.js dashboard + +## Architecture + +```text +Baseline ZIP Candidate ZIP + │ │ + └──────── Browser processing ┘ + │ + Secret redaction + │ + Flow parsing + │ + Structural diff + │ + Blast-radius analysis + │ + Deterministic risk scoring + │ + Sanitized change package only + │ + Next.js API route + │ + ┌────────────┴─────────────┐ + │ │ +Semantic impact flow Release-plan flow + │ │ + └────────────┬─────────────┘ + │ + Validated release report +``` + +The uploaded TypeScript files are parsed but never executed. + +## Lamatic flows + +### `analyze-change-impact` + +Analyzes the operational and semantic meaning of the detected changes. + +Inputs: + +- `flowPurpose` +- `baselineVersion` +- `candidateVersion` +- `changePackage` +- `releaseContext` + +Expected output: + +- Analysis summary +- Overall impact level +- Human-review requirement +- Findings +- Cross-cutting risks +- Assumptions +- Unknowns +- Recommended checks + +### `generate-release-plan` + +Transforms the change analysis and deterministic risk result into an actionable release plan. + +Inputs: + +- `flowPurpose` +- `baselineVersion` +- `candidateVersion` +- `releaseContext` +- `changePackage` +- `semanticAnalysis` +- `riskScore` +- `promotionDecision` + +Expected output: + +- Decision summary +- Promotion decision +- Risk score +- Release blockers +- Targeted tests +- Deployment checklist +- Rollback manifest +- Release notes +- Assumptions +- Unknowns + +## Deterministic risk model + +The Lamatic model does not determine the authoritative risk score. + +ChangeGraph calculates the score using deterministic rules: + +| Change | Score | +|---|---:| +| Breaking schema change | +30 | +| Fallback removed | +25 | +| Permission scope expanded | +25 | +| Safety instruction removed | +25 | +| External write tool introduced | +20 | +| Graph edge removed | +15 | +| Retry protection removed | +15 | +| Model changed | +10 | +| Temperature increased | +10 | +| Prompt wording changed | +5 | +| Low blast radius | +3 | +| Medium blast radius | +7 | +| High blast radius | +12 | + +The final score is capped at `100`. + +## Promotion policy + +| Risk score | Decision | +|---:|---| +| `0–29` | `safe_to_promote` | +| `30–69` | `manual_review_required` | +| `70–100` | `block_release` | + +The deterministic score and decision remain authoritative throughout the pipeline. + +## AI reliability and fallbacks + +Lamatic enriches the report with semantic explanations, tests, and release planning. + +Because language-model output may occasionally be incomplete, every Lamatic response is validated. + +```text +Valid Lamatic response +→ Use the validated semantic analysis or release plan + +Invalid Lamatic response +→ Generate a conservative deterministic fallback + +Risk score and promotion decision +→ Remain deterministic and authoritative +``` + +Fallback behavior ensures that malformed AI output cannot: + +- Crash the analysis +- Reduce the deterministic risk score +- Remove a release blocker +- Convert `block_release` into a weaker decision +- Prevent test or rollback guidance from being generated + +## Privacy and security + +- ZIP archives are initially processed in the browser. +- Uploaded TypeScript is parsed and never executed. +- Secrets are redacted before the structured change package is sent. +- Lamatic credentials are used only by the server-side API route. +- `.env.local` is excluded from Git. +- Only placeholder values are provided in `.env.example`. +- Incoming API requests are schema-validated. +- The API route applies a request-size limit. + +## Project structure + +```text +changegraph-release-intelligence/ +├── lamatic.config.ts +├── README.md +├── agent.md +├── .env.example +├── flows/ +├── prompts/ +├── model-configs/ +├── constitutions/ +└── apps/ + ├── actions/ + ├── app/ + ├── components/ + ├── lib/ + ├── types/ + ├── package.json + └── .env.example +``` + +## Requirements + +- Node.js 18 or later +- npm 9 or later +- A Lamatic account +- Two deployed Lamatic flows +- Lamatic API credentials + +## Local setup + +Move into the application: + +```bash +cd kits/changegraph-release-intelligence/apps +``` + +Install dependencies: + +```bash +npm install +``` + +Create the local environment file: + +```bash +cp .env.example .env.local +``` + +Windows PowerShell: + +```powershell +Copy-Item .env.example .env.local +``` + +Add real values to `.env.local`: + +```env +LAMATIC_API_KEY=your_real_api_key +LAMATIC_PROJECT_ID=your_real_project_id +LAMATIC_API_URL=your_real_api_url + +ANALYZE_CHANGE_IMPACT_FLOW_ID=your_real_flow_id +GENERATE_RELEASE_PLAN_FLOW_ID=your_real_flow_id +``` + +Run the application: + +```bash +npm run dev +``` + +Open: + +```text +http://localhost:3000 +``` + +## Usage + +1. Export a baseline Lamatic workflow. +2. Export the candidate workflow. +3. Upload both ZIP files. +4. Enter the workflow purpose. +5. Enter the baseline and candidate versions. +6. Describe the release context. +7. Run the analysis. +8. Review the structural changes, blast radius, risk score, semantic findings, tests, checklist, and rollback manifest. + +## Validation commands + +Run from `apps/`: + +```bash +npm exec tsc -- --noEmit +npm run lint +npm run build +npm audit --omit=dev +``` + +## Demonstration scenarios + +### No change + +```text +Expected risk: 0 +Expected decision: safe_to_promote +``` + +### Moderate-risk release + +Example changes: + +- Prompt wording update +- Temperature increase +- Permission expansion + +Expected decision: + +```text +manual_review_required +``` + +### High-risk release + +Example changes: + +- Breaking schema change +- Permission expansion +- Safety-instruction removal +- External write capability +- Fallback or retry removal + +Expected decision: + +```text +block_release +``` + +## Limitations + +- The parser targets exported Lamatic workflow structures and JSON-compatible TypeScript constants. +- Uploaded TypeScript files are parsed but never executed. +- Semantic explanations depend on the configured Lamatic model. +- Deterministic fallbacks may be less descriptive than valid model-generated output. +- Risk weights are intentionally conservative and may require calibration for different organizations. +- ChangeGraph provides release guidance; it does not directly deploy or roll back workflows. + +## Technology + +- Next.js +- React +- TypeScript +- Tailwind CSS +- Zod +- JSZip +- Lamatic SDK +- Lucide React + +## Author + +**Mayank Verma** + +GitHub username: `Mayankverma210405` \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/agent.md b/kits/changegraph-release-intelligence/agent.md new file mode 100644 index 000000000..3cf20af4b --- /dev/null +++ b/kits/changegraph-release-intelligence/agent.md @@ -0,0 +1,3 @@ +# analyze-change-impact + + diff --git a/kits/changegraph-release-intelligence/apps/.env.example b/kits/changegraph-release-intelligence/apps/.env.example new file mode 100644 index 000000000..e34d97c33 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/.env.example @@ -0,0 +1,6 @@ +LAMATIC_API_KEY=your_lamatic_api_key +LAMATIC_PROJECT_ID=your_lamatic_project_id +LAMATIC_API_URL=your_lamatic_api_url + +ANALYZE_CHANGE_IMPACT_FLOW_ID=your_analyze_change_impact_flow_id +GENERATE_RELEASE_PLAN_FLOW_ID=your_generate_release_plan_flow_id diff --git a/kits/changegraph-release-intelligence/apps/.gitignore b/kits/changegraph-release-intelligence/apps/.gitignore new file mode 100644 index 000000000..c8e7737a8 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/.gitignore @@ -0,0 +1,43 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/versions + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# env files (can opt-in for committing if needed) +.env* + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts + +!.env.example diff --git a/kits/changegraph-release-intelligence/apps/README.md b/kits/changegraph-release-intelligence/apps/README.md new file mode 100644 index 000000000..a2df90e23 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/README.md @@ -0,0 +1,113 @@ +# ChangeGraph Web Application + +This directory contains the runnable Next.js application for the ChangeGraph AgentKit contribution. + +The application compares baseline and candidate Lamatic workflow exports, calculates deterministic release risk, invokes the ChangeGraph Lamatic flows, and displays a release-readiness report. + +## Requirements + +- Node.js 18 or later +- npm 9 or later +- Lamatic API credentials +- Deployed `analyze-change-impact` flow +- Deployed `generate-release-plan` flow + +## Installation + +```bash +npm install +``` + +## Environment configuration + +Create a local environment file: + +```bash +cp .env.example .env.local +``` + +Windows PowerShell: + +```powershell +Copy-Item .env.example .env.local +``` + +Configure the following values: + +```env +LAMATIC_API_KEY=your_real_api_key +LAMATIC_PROJECT_ID=your_real_project_id +LAMATIC_API_URL=your_real_api_url + +ANALYZE_CHANGE_IMPACT_FLOW_ID=your_real_flow_id +GENERATE_RELEASE_PLAN_FLOW_ID=your_real_flow_id +``` + +Never commit `.env.local`. + +## Development + +```bash +npm run dev +``` + +Open: + +```text +http://localhost:3000 +``` + +## Validation + +```bash +npm exec tsc -- --noEmit +npm run lint +npm run build +npm audit --omit=dev +``` + +## Production start + +```bash +npm run build +npm start +``` + +## Application pipeline + +```text +ZIP upload +→ browser-side archive reading +→ secret redaction +→ workflow parsing +→ structural comparison +→ blast-radius analysis +→ deterministic risk scoring +→ sanitized API request +→ Lamatic semantic analysis +→ Lamatic release planning +→ validated response or deterministic fallback +``` + +## Authoritative decision + +The deterministic risk score and promotion decision are authoritative. + +The Lamatic flows provide semantic explanations, targeted tests, and release-planning guidance. When either flow returns invalid structured output, the application uses a conservative deterministic fallback instead of failing the request. + +## Routes + +```text +/ ChangeGraph dashboard +/api/analyze Server-side orchestration route +``` + +## Deployment root + +Deploy this exact directory as the project root: + +```text +kits/changegraph-release-intelligence/apps +``` + +Add all five environment variables to the deployment platform before running a production analysis. \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/actions/orchestrate.ts b/kits/changegraph-release-intelligence/apps/actions/orchestrate.ts new file mode 100644 index 000000000..d0d27180a --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/actions/orchestrate.ts @@ -0,0 +1,714 @@ +"use server"; + +import "server-only"; + +import { executeLamaticFlow } from "@/lib/lamatic-client"; +import { + parseReleasePlanPayload, + parseSemanticAnalysisPayload, +} from "@/lib/schemas"; +import { serializeChangePackage } from "@/lib/change-package"; + + +import type { + ChangeCategory, + ChangePackage, + PromotionDecision, + ReleasePlan, + SemanticAnalysis, + SemanticFinding, + TargetedTest, +} from "@/types/changegraph"; + +export interface OrchestrateChangeGraphInput { + flowPurpose: string; + baselineVersion: string; + candidateVersion: string; + releaseContext: string; + changePackage: ChangePackage; +} + +export interface OrchestrateChangeGraphResult { + semanticAnalysis: SemanticAnalysis; + releasePlan: ReleasePlan; + warnings: string[]; +} + +interface LamaticResponseLike { + status?: unknown; + result?: unknown; + message?: unknown; + statusCode?: unknown; +} + +function isRecord( + value: unknown, +): value is Record { + return ( + typeof value === "object" && + value !== null && + !Array.isArray(value) + ); +} + +function requireText( + value: string, + fieldName: string, +): string { + const normalized = value.trim(); + + if (!normalized) { + throw new Error(`${fieldName} is required.`); + } + + return normalized; +} + +function requireEnvironmentVariable( + name: string, +): string { + const value = process.env[name]?.trim(); + + if ( + !value || + value.toLowerCase().startsWith("your_") || + value.toLowerCase().startsWith("replace_") + ) { + throw new Error( + `Missing required server environment variable: ${name}`, + ); + } + + return value; +} + +/** + * Lamatic SDK responses normally have: + * + * { + * status: "success" | "error", + * result: unknown, + * message?: string, + * statusCode?: number + * } + * + * This function also accepts an already-unwrapped payload. + */ +function unwrapLamaticResult( + response: unknown, + flowLabel: string, +): unknown { + if (!isRecord(response)) { + return response; + } + + const candidate = + response as LamaticResponseLike; + + if ( + typeof candidate.status === "string" && + candidate.status.toLowerCase() === "error" + ) { + const message = + typeof candidate.message === "string" + ? candidate.message + : `${flowLabel} returned an error.`; + + throw new Error(message); + } + + if ( + "result" in candidate && + candidate.result !== undefined && + candidate.result !== null + ) { + return candidate.result; + } + + return response; +} + +function normalizeDecision( + value: PromotionDecision, +): PromotionDecision { + return value; +} + +function uniqueSorted( + values: string[], +): string[] { + return [...new Set(values)].sort((left, right) => + left.localeCompare(right), + ); +} + +function testTypeForCategory( + category: ChangeCategory, +): TargetedTest["testType"] { + switch (category) { + case "schema": + return "schema"; + + case "prompt": + return "prompt"; + + case "model": + return "model"; + + case "fallback": + return "fallback"; + + case "permission": + return "permission"; + + case "tool": + return "integration"; + + default: + return "regression"; + } +} + +/** + * Produces a conservative release plan when the AI-generated + * release-plan response is missing or malformed. + * + * The deterministic score and promotion decision remain authoritative. + */ +function buildDeterministicFallbackReleasePlan( + input: OrchestrateChangeGraphInput, + semanticAnalysis: SemanticAnalysis, + failureReason: string, +): ReleasePlan { + const risk = + input.changePackage.riskAssessment; + + const changes = + input.changePackage.changes; + + const findingsByChangeId = new Map( + semanticAnalysis.findings.map( + (finding) => [ + finding.changeId, + finding, + ], + ), + ); + + const blockers = + risk.decision === "safe_to_promote" + ? [] + : risk.contributions.map( + (contribution, index) => ({ + blockerId: + `deterministic-blocker-${String( + index + 1, + ).padStart(2, "0")}`, + + relatedChangeIds: + contribution.relatedChangeIds, + + reason: + `${contribution.label} contributed +${contribution.points} deterministic risk points.`, + + resolutionRequired: + "Provide mitigation evidence, complete the related targeted tests, and rerun ChangeGraph before promotion.", + }), + ); + + const targetedTests: TargetedTest[] = + changes.slice(0, 12).map( + (change, index) => { + const finding = + findingsByChangeId.get( + change.changeId, + ); + + return { + testId: + `deterministic-test-${String( + index + 1, + ).padStart(2, "0")}`, + + name: + `Validate ${change.category} change`, + + objective: + finding + ?.recommendedValidation[0] ?? + `Verify that the change to ${change.component} does not introduce unintended behavior.`, + + relatedChangeIds: [ + change.changeId, + ], + + testType: + testTypeForCategory( + change.category, + ), + + priority: + finding?.severity ?? + risk.level, + + expectedEvidence: + finding?.evidence[0] ?? + `Passing regression evidence for ${change.component}.`, + }; + }, + ); + + const changedComponents = + uniqueSorted( + changes.map( + (change) => + change.component, + ), + ); + + const environmentChanges = + uniqueSorted( + changes + .filter( + (change) => + change.category === + "environment", + ) + .map( + (change) => + change.component, + ), + ); + + const deploymentChecklist = + risk.decision === "safe_to_promote" + ? [ + "Review all semantic findings.", + "Execute every targeted test.", + "Confirm rollback readiness.", + "Promote the candidate using normal release controls.", + ] + : [ + "Do not promote the candidate release.", + "Resolve every deterministic blocker.", + "Execute every targeted test and capture evidence.", + "Confirm the baseline rollback package is available.", + "Rerun ChangeGraph after mitigation.", + ]; + + const safeFailureReason = + failureReason.length > 400 + ? `${failureReason.slice(0, 400)}…` + : failureReason; + + return { + decisionSummary: + risk.decision === + "block_release" + ? `Release blocked by the deterministic engine with a risk score of ${risk.score}/100.` + : risk.decision === + "manual_review_required" + ? `Manual review is required before promotion. Deterministic risk score: ${risk.score}/100.` + : `The deterministic engine classified the candidate as safe to promote with a score of ${risk.score}/100.`, + + promotionDecision: + risk.decision, + + riskScore: + risk.score, + + blockers, + + targetedTests, + + deploymentChecklist, + + rollbackManifest: { + rollbackTarget: + input.baselineVersion, + + componentsToRestore: + changedComponents, + + environmentChangesToRevert: + environmentChanges, + + postRollbackChecks: [ + `Confirm baseline version ${input.baselineVersion} is restored.`, + "Verify the deployed flow responds successfully.", + "Verify output schemas and downstream integrations.", + "Run an identical baseline comparison in ChangeGraph.", + ], + }, + + releaseNotes: [ + `${changes.length} structural change(s) were detected.`, + `Deterministic decision: ${risk.decision}.`, + `Deterministic risk score: ${risk.score}/100.`, + "A deterministic fallback release plan was generated because the AI release-plan response could not be validated.", + ], + + assumptions: + semanticAnalysis.assumptions, + + unknowns: uniqueSorted([ + ...semanticAnalysis.unknowns, + `Release-plan flow validation failure: ${safeFailureReason}`, + ]), + }; +} +function summarizeEvidence( + value: unknown, + maximumLength = 350, +): string { + let text: string; + + if (typeof value === "string") { + text = value; + } else { + try { + text = JSON.stringify(value); + } catch { + text = String(value); + } + } + + if (!text) { + return "No value present."; + } + + return text.length > maximumLength + ? `${text.slice(0, maximumLength)}…` + : text; +} + +function impactForCategory( + category: ChangeCategory, +): string { + switch (category) { + case "schema": + return "The change may break downstream consumers or alter the response contract."; + + case "permission": + return "The change may expand access or allow operations that were previously restricted."; + + case "tool": + return "The change may introduce new external side effects or integration behavior."; + + case "fallback": + return "The change may reduce workflow resilience when the primary execution path fails."; + + case "retry": + return "The change may reduce recovery from temporary provider or network failures."; + + case "edge": + return "The change may alter execution order, remove a processing path, or redirect downstream data."; + + case "prompt": + return "The change may alter model instructions and generated behavior."; + + case "model": + return "The change may alter output consistency, latency, cost, or model behavior."; + + case "environment": + return "The change may affect deployment configuration or runtime behavior."; + + default: + return "The change may alter workflow behavior and requires regression validation."; + } +} + +/** + * Conservative semantic analysis used when the Lamatic analysis flow + * returns malformed or incomplete structured output. + */ +function buildDeterministicFallbackSemanticAnalysis( + input: OrchestrateChangeGraphInput, + failureReason: string, +): SemanticAnalysis { + const risk = + input.changePackage.riskAssessment; + + const findings: SemanticFinding[] = + input.changePackage.changes + .slice(0, 20) + .map((change) => ({ + changeId: change.changeId, + category: change.category, + + observedFact: + `A ${change.category} change was detected in ${change.component}.`, + + possibleImpact: + impactForCategory(change.category), + + severity: risk.level, + + confidence: 1, + + evidence: [ + `Before: ${summarizeEvidence(change.before)}`, + `After: ${summarizeEvidence(change.after)}`, + ], + + affectedComponents: [ + change.component, + ...change.affectedPaths, + ], + + recommendedValidation: [ + `Validate ${change.component} against the baseline behavior.`, + "Capture passing regression evidence before promotion.", + ], + })); + + const safeFailureReason = + failureReason.length > 400 + ? `${failureReason.slice(0, 400)}…` + : failureReason; + + return { + analysisSummary: + `${input.changePackage.changes.length} deterministic change(s) were detected. ` + + `The calculated risk score is ${risk.score}/100 with decision "${risk.decision}". ` + + "A deterministic semantic fallback was used because the Lamatic analysis response could not be validated.", + + overallImpactLevel: + risk.level, + + requiresHumanReview: + risk.decision !== "safe_to_promote", + + findings, + + crossCuttingRisks: + risk.contributions.map( + (contribution) => + `${contribution.label} (+${contribution.points})`, + ), + + assumptions: [ + "The submitted ZIP exports accurately represent the baseline and candidate workflows.", + "Uploaded content was redacted before analysis.", + ], + + unknowns: [ + `Semantic-analysis flow validation failure: ${safeFailureReason}`, + "Runtime execution evidence was not provided unless explicitly listed in the change package.", + ], + + recommendedNextChecks: [ + "Resolve all deterministic risk contributions.", + "Run the generated targeted tests.", + "Verify output schemas and downstream integrations.", + "Rerun ChangeGraph after mitigation.", + ], + }; +} +/** + * Runs ChangeGraph's two deployed Lamatic flows: + * + * 1. analyze-change-impact + * 2. generate-release-plan + * + * The deterministic risk score and promotion decision always remain + * authoritative. The AI-generated release plan cannot override them. + */ +export async function orchestrateChangeGraph( + input: OrchestrateChangeGraphInput, +): Promise { + const flowPurpose = requireText( + input.flowPurpose, + "Flow purpose", + ); + + const baselineVersion = requireText( + input.baselineVersion, + "Baseline version", + ); + + const candidateVersion = requireText( + input.candidateVersion, + "Candidate version", + ); + + const releaseContext = requireText( + input.releaseContext, + "Release context", + ); + + const analyzeFlowId = + requireEnvironmentVariable( + "ANALYZE_CHANGE_IMPACT_FLOW_ID", + ); + + const releasePlanFlowId = + requireEnvironmentVariable( + "GENERATE_RELEASE_PLAN_FLOW_ID", + ); + + const serializedChangePackage = + serializeChangePackage( + input.changePackage, + ); + + /* + * Flow 1: semantic impact analysis + */ + const analysisResponse = + await executeLamaticFlow( + analyzeFlowId, + { + flowPurpose, + baselineVersion, + candidateVersion, + changePackage: + serializedChangePackage, + releaseContext, + }, + ); + + const analysisPayload = + unwrapLamaticResult( + analysisResponse, + "Semantic analysis flow", + ); + +const warnings: string[] = []; + +let semanticAnalysis: SemanticAnalysis; + +try { + semanticAnalysis = + parseSemanticAnalysisPayload( + analysisPayload, + ); +} catch (error) { + const reason = + error instanceof Error + ? error.message + : "Unknown semantic-analysis validation error."; + + console.warn( + "Semantic-analysis flow returned invalid structured output. Using deterministic fallback.", + reason, + ); + + warnings.push( + "The Lamatic semantic-analysis response was incomplete, so ChangeGraph generated a conservative deterministic fallback analysis.", + ); + + semanticAnalysis = + buildDeterministicFallbackSemanticAnalysis( + input, + reason, + ); +} + + + + /* + * Flow 2: release-plan generation + */ + const deterministicRisk = + input.changePackage.riskAssessment; + + const releasePlanResponse = + await executeLamaticFlow( + releasePlanFlowId, + { + flowPurpose, + baselineVersion, + candidateVersion, + releaseContext, + + changePackage: + serializedChangePackage, + + semanticAnalysis: JSON.stringify( + semanticAnalysis, + null, + 2, + ), + + riskScore: + deterministicRisk.score, + + promotionDecision: + deterministicRisk.decision, + }, + ); + + const releasePlanPayload = + unwrapLamaticResult( + releasePlanResponse, + "Release-plan flow", + ); + + + +let generatedReleasePlan: ReleasePlan; + +try { + generatedReleasePlan = + parseReleasePlanPayload( + releasePlanPayload, + ); +} catch (error) { + const reason = + error instanceof Error + ? error.message + : "Unknown release-plan validation error."; + + console.warn( + "Release-plan flow returned invalid structured output. Using deterministic fallback.", + reason, + ); + + warnings.push( + "The Lamatic release-plan response was incomplete, so ChangeGraph generated a conservative deterministic fallback plan.", + ); + + generatedReleasePlan = + buildDeterministicFallbackReleasePlan( + input, + semanticAnalysis, + reason, + ); +} + + if ( + generatedReleasePlan.riskScore !== + deterministicRisk.score + ) { + warnings.push( + `The release-plan flow returned risk score ${generatedReleasePlan.riskScore}, but the deterministic engine calculated ${deterministicRisk.score}. The deterministic score was preserved.`, + ); + } + + if ( + generatedReleasePlan.promotionDecision !== + deterministicRisk.decision + ) { + warnings.push( + `The release-plan flow returned "${generatedReleasePlan.promotionDecision}", but the deterministic engine decided "${deterministicRisk.decision}". The deterministic decision was preserved.`, + ); + } + + const releasePlan: ReleasePlan = { + ...generatedReleasePlan, + + // AI output must not override deterministic safety controls. + riskScore: deterministicRisk.score, + + promotionDecision: normalizeDecision( + deterministicRisk.decision, + ), + }; + + return { + semanticAnalysis, + releasePlan, + warnings, + }; +} \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts b/kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts new file mode 100644 index 000000000..5ff77c2ad --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/app/api/analyze/route.ts @@ -0,0 +1,420 @@ +import * as z from "zod"; + +import { orchestrateChangeGraph } from "@/actions/orchestrate"; +import { calculateRiskAssessment } from "@/lib/risk-score"; +import { + AnalyzeChangeGraphRequestSchema, +} from "@/lib/schemas"; + +import type { + ChangeCategory, + ChangeGraphReport, + ChangePackage, + StructuralDiff, +} from "@/types/changegraph"; + +export const runtime = "nodejs"; +export const dynamic = "force-dynamic"; + +const MAX_REQUEST_BYTES = 3_500_000; + +const CHANGE_CATEGORIES: ChangeCategory[] = [ + "prompt", + "model", + "schema", + "tool", + "permission", + "node", + "edge", + "fallback", + "retry", + "branching", + "environment", + "other", +]; + +function uniqueSorted( + values: string[], +): string[] { + return [...new Set(values)].sort( + (left, right) => + left.localeCompare(right), + ); +} + +function calculateCategoryCounts( + changePackage: ChangePackage, +): Record { + const counts = Object.fromEntries( + CHANGE_CATEGORIES.map( + (category) => [category, 0], + ), + ) as Record; + + for ( + const change of changePackage.changes + ) { + counts[change.category] += 1; + } + + return counts; +} + +function reconstructStructuralDiff( + changePackage: ChangePackage, +): StructuralDiff { + return { + changes: changePackage.changes, + + addedFiles: + changePackage.summary.addedFiles, + + removedFiles: + changePackage.summary.removedFiles, + + modifiedFiles: + changePackage.summary.modifiedFiles, + + affectedPaths: uniqueSorted( + changePackage.changes.flatMap( + (change) => + change.affectedPaths, + ), + ), + + runtimeEvidence: + changePackage.evidence + .runtimeEvidence, + + testsExecuted: + changePackage.evidence + .testsExecuted, + }; +} + +function determineErrorStatus( + error: Error, +): number { + const message = + error.message.toLowerCase(); + + if ( + message.includes("lamatic") || + message.includes("flow was not found") || + message.includes( + "authentication failed", + ) || + message.includes( + "could not connect", + ) + ) { + return 502; + } + + if ( + message.includes( + "missing required server environment variable", + ) + ) { + return 500; + } + + return 500; +} + +function safeErrorMessage( + error: unknown, +): string { + if (!(error instanceof Error)) { + return "The analysis request failed."; + } + + const message = error.message; + + // Avoid returning unexpectedly long SDK or + // provider messages to the browser. + if (message.length > 1_000) { + return `${message.slice(0, 1_000)}…`; + } + + return message; +} + +export async function POST( + request: Request, +): Promise { + const contentType = + request.headers.get( + "content-type", + ) ?? ""; + + if ( + !contentType + .toLowerCase() + .includes("application/json") + ) { + return Response.json( + { + error: + "Content-Type must be application/json.", + }, + { + status: 415, + }, + ); + } + + const declaredLength = Number( + request.headers.get( + "content-length", + ), + ); + + if ( + Number.isFinite(declaredLength) && + declaredLength > + MAX_REQUEST_BYTES + ) { + return Response.json( + { + error: + "The analysis request is too large.", + }, + { + status: 413, + }, + ); + } + + let rawBody: string; + + try { + rawBody = await request.text(); + } catch { + return Response.json( + { + error: + "The request body could not be read.", + }, + { + status: 400, + }, + ); + } + + const actualBytes = + new TextEncoder().encode( + rawBody, + ).byteLength; + + if ( + actualBytes > MAX_REQUEST_BYTES + ) { + return Response.json( + { + error: + "The analysis request is too large.", + }, + { + status: 413, + }, + ); + } + + let rawPayload: unknown; + + try { + rawPayload = JSON.parse(rawBody); + } catch { + return Response.json( + { + error: + "The request body must contain valid JSON.", + }, + { + status: 400, + }, + ); + } + + const validation = + AnalyzeChangeGraphRequestSchema.safeParse( + rawPayload, + ); + + if (!validation.success) { + return Response.json( + { + error: + "The analysis request is invalid.", + + details: z.prettifyError( + validation.error, + ), + }, + { + status: 400, + }, + ); + } + + try { + const submittedPackage = + validation.data.changePackage as ChangePackage; + + const structuralDiff = + reconstructStructuralDiff( + submittedPackage, + ); + + /* + * The browser calculates the initial score, + * but the server calculates it again. + * + * This prevents a modified browser request + * from directly overriding the submitted + * risk score or promotion decision. + */ + const riskAssessment = + calculateRiskAssessment( + structuralDiff, + submittedPackage.blastRadius, + ); + + const normalizedChangePackage: + ChangePackage = { + ...submittedPackage, + + summary: { + ...submittedPackage.summary, + + totalChanges: + structuralDiff.changes.length, + + categoryCounts: + calculateCategoryCounts( + submittedPackage, + ), + + directlyAffectedNodes: + submittedPackage + .blastRadius + .directlyAffectedNodeIds + .length, + + downstreamAffectedNodes: + submittedPackage + .blastRadius + .indirectlyAffectedNodeIds + .length, + }, + + riskAssessment, + }; + + const orchestration = + await orchestrateChangeGraph({ + flowPurpose: + validation.data.flowPurpose, + + baselineVersion: + validation.data + .baselineVersion, + + candidateVersion: + validation.data + .candidateVersion, + + releaseContext: + validation.data + .releaseContext, + + changePackage: + normalizedChangePackage, + }); + + const report: ChangeGraphReport = { + baselineVersion: + validation.data + .baselineVersion, + + candidateVersion: + validation.data + .candidateVersion, + + structuralDiff, + + blastRadius: + normalizedChangePackage + .blastRadius, + + riskAssessment, + + semanticAnalysis: + orchestration + .semanticAnalysis, + + releasePlan: + orchestration.releasePlan, + }; + + const warnings = uniqueSorted([ + ...normalizedChangePackage + .baseline.warnings, + + ...normalizedChangePackage + .candidate.warnings, + + ...normalizedChangePackage + .blastRadius.warnings, + + ...orchestration.warnings, + ]); + + return Response.json( + { + report, + warnings, + }, + { + status: 200, + headers: { + "Cache-Control": + "no-store", + }, + }, + ); + } catch (error) { + console.error( + "ChangeGraph analysis failed:", + error, + ); + + const normalizedError = + error instanceof Error + ? error + : new Error( + "The analysis request failed.", + ); + + return Response.json( + { + error: + safeErrorMessage( + normalizedError, + ), + }, + { + status: + determineErrorStatus( + normalizedError, + ), + + headers: { + "Cache-Control": + "no-store", + }, + }, + ); + } +} \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/app/favicon.ico b/kits/changegraph-release-intelligence/apps/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..718d6fea4835ec2d246af9800eddb7ffb276240c GIT binary patch literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lSJnR?-2UN%hJ){&rlvg`CDTj z)Bzo!3v7Ou#83zEDEFcKt(f1E0~=rqeEbTnMvWR#{+9pg%7G8y>u1OVRUSoox-ovF z2Ydma(;=Y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WFihx%^vQ@Do(sOy7yR2@WNv7Y9I^yL=nZr3mb zXKV5t@=?-Sk|b{XMhA7ZGB@2hqsx}4xwCW!in#C zI@}scZlr3-NFJ@NFaJlhyfcw{k^vvtGl`N9xSo**rDW4S}i zM9{fMPWo%4wYDG~BZ18BD+}h|GQKc-g^{++3MY>}W_uq7jGHx{mwE9fZiPCoxN$+7 zrODGGJrOkcPQUB(FD5aoS4g~7#6NR^ma7-!>mHuJfY5kTe6PpNNKC9GGRiu^L31uG z$7v`*JknQHsYB!Tm_W{a32TM099djW%5e+j0Ve_ct}IM>XLF1Ap+YvcrLV=|CKo6S zb+9Nl3_YdKP6%Cxy@6TxZ>;4&nTneadr z_ES90ydCev)LV!dN=#(*f}|ZORFdvkYBni^aLbUk>BajeWIOcmHP#8S)*2U~QKI%S zyrLmtPqb&TphJ;>yAxri#;{uyk`JJqODDw%(Z=2`1uc}br^V%>j!gS)D*q*f_-qf8&D;W1dJgQMlaH5er zN2U<%Smb7==vE}dDI8K7cKz!vs^73o9f>2sgiTzWcwY|BMYHH5%Vn7#kiw&eItCqa zIkR2~Q}>X=Ar8W|^Ms41Fm8o6IB2_j60eOeBB1Br!boW7JnoeX6Gs)?7rW0^5psc- zjS16yb>dFn>KPOF;imD}e!enuIniFzv}n$m2#gCCv4jM#ArwlzZ$7@9&XkFxZ4n!V zj3dyiwW4Ki2QG{@i>yuZXQizw_OkZI^-3otXC{!(lUpJF33gI60ak;Uqitp74|B6I zgg{b=Iz}WkhCGj1M=hu4#Aw173YxIVbISaoc z-nLZC*6Tgivd5V`K%GxhBsp@SUU60-rfc$=wb>zdJzXS&-5(NRRodFk;Kxk!S(O(a0e7oY=E( zAyS;Ow?6Q&XA+cnkCb{28_1N8H#?J!*$MmIwLq^*T_9-z^&UE@A(z9oGYtFy6EZef LrJugUA?W`A8`#=m literal 0 HcmV?d00001 diff --git a/kits/changegraph-release-intelligence/apps/app/globals.css b/kits/changegraph-release-intelligence/apps/app/globals.css new file mode 100644 index 000000000..94d202a2c --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/app/globals.css @@ -0,0 +1,1119 @@ +:root { + color-scheme: dark; + --background: #07090d; + --surface: rgba(18, 22, 30, 0.86); + --surface-strong: #141923; + --surface-soft: #0d1118; + --border: rgba(255, 255, 255, 0.09); + --border-strong: rgba(255, 255, 255, 0.16); + --text: #f4f7fb; + --muted: #9ba6b5; + --faint: #6f7b8c; + --accent: #8b7cff; + --accent-soft: rgba(139, 124, 255, 0.15); + --cyan: #51d6e8; + --green: #5fe1a2; + --yellow: #f7c65c; + --red: #ff717d; + --shadow: 0 28px 80px rgba(0, 0, 0, 0.34); +} + +* { + box-sizing: border-box; +} + +html { + scroll-behavior: smooth; +} + +body { + margin: 0; + min-height: 100vh; + background: + radial-gradient( + circle at 20% -5%, + rgba(108, 90, 255, 0.18), + transparent 34% + ), + radial-gradient( + circle at 85% 15%, + rgba(60, 211, 224, 0.1), + transparent 30% + ), + var(--background); + color: var(--text); + font-family: + Inter, ui-sans-serif, system-ui, + -apple-system, BlinkMacSystemFont, + "Segoe UI", sans-serif; +} + +button, +input, +textarea { + font: inherit; +} + +button { + color: inherit; +} + +a { + color: inherit; + text-decoration: none; +} + +pre { + font-family: + "SFMono-Regular", Consolas, + "Liberation Mono", monospace; +} + +.app-shell { + width: min(1220px, calc(100% - 40px)); + margin: 0 auto; +} + +.topbar { + min-height: 82px; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid var(--border); +} + +.brand { + display: flex; + align-items: center; + gap: 12px; +} + +.brand-mark { + width: 42px; + height: 42px; + display: grid; + place-items: center; + border: 1px solid rgba(139, 124, 255, 0.35); + border-radius: 13px; + color: #b9b0ff; + background: var(--accent-soft); + box-shadow: + inset 0 1px rgba(255, 255, 255, 0.08); +} + +.brand > span:last-child { + display: flex; + flex-direction: column; + gap: 2px; +} + +.brand strong { + font-size: 16px; +} + +.brand small { + color: var(--muted); + font-size: 12px; +} + +.topbar-status { + display: flex; + align-items: center; + gap: 9px; + color: var(--muted); + font-size: 13px; +} + +.status-dot { + width: 8px; + height: 8px; + border-radius: 999px; + background: var(--green); + box-shadow: 0 0 16px var(--green); +} + +.hero { + min-height: 480px; + display: grid; + grid-template-columns: 1.15fr 0.85fr; + align-items: center; + gap: 70px; + padding: 70px 0 58px; +} + +.hero-copy { + max-width: 710px; +} + +.eyebrow, +.section-kicker { + display: inline-flex; + align-items: center; + gap: 7px; + color: #b9b0ff; + font-size: 12px; + font-weight: 700; + letter-spacing: 0.09em; + text-transform: uppercase; +} + +.hero h1 { + margin: 22px 0 20px; + font-size: clamp(43px, 5.4vw, 74px); + line-height: 1.02; + letter-spacing: -0.055em; +} + +.hero p { + max-width: 680px; + margin: 0; + color: var(--muted); + font-size: 18px; + line-height: 1.7; +} + +.hero-visual { + position: relative; + min-height: 330px; + border: 1px solid var(--border); + border-radius: 28px; + background: + linear-gradient( + rgba(255, 255, 255, 0.025) 1px, + transparent 1px + ), + linear-gradient( + 90deg, + rgba(255, 255, 255, 0.025) 1px, + transparent 1px + ), + rgba(12, 15, 22, 0.74); + background-size: 28px 28px; + box-shadow: var(--shadow); + overflow: hidden; +} + +.hero-visual::after { + position: absolute; + content: ""; + inset: 18% 20%; + border-radius: 999px; + background: rgba(115, 91, 255, 0.2); + filter: blur(55px); +} + +.graph-node { + position: absolute; + z-index: 2; + padding: 12px 17px; + border: 1px solid var(--border-strong); + border-radius: 12px; + color: #dce2eb; + background: rgba(17, 22, 31, 0.96); + box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28); + font-size: 12px; + font-weight: 700; +} + +.graph-node-main { + top: 42px; + left: 38px; +} + +.graph-node-small { + padding: 10px 15px; +} + +.graph-node-one { + top: 128px; + left: 126px; +} + +.graph-node-two { + top: 203px; + left: 202px; +} + +.graph-node-result { + right: 27px; + bottom: 34px; + border-color: rgba(95, 225, 162, 0.36); + background: rgba(20, 53, 42, 0.88); + color: #a7f2cc; +} + +.graph-line { + position: absolute; + z-index: 1; + height: 1px; + transform-origin: left; + background: + linear-gradient( + 90deg, + var(--accent), + var(--cyan) + ); +} + +.graph-line-one { + width: 113px; + top: 98px; + left: 92px; + transform: rotate(45deg); +} + +.graph-line-two { + width: 105px; + top: 174px; + left: 168px; + transform: rotate(41deg); +} + +.graph-line-three { + width: 146px; + top: 240px; + left: 250px; + transform: rotate(19deg); +} + +.workspace, +.report { + margin-bottom: 34px; + padding: 32px; + border: 1px solid var(--border); + border-radius: 26px; + background: rgba(12, 15, 21, 0.82); + box-shadow: var(--shadow); + backdrop-filter: blur(16px); +} + +.section-heading, +.report-header { + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; + margin-bottom: 27px; +} + +.section-heading h2, +.report-header h2 { + display: flex; + align-items: center; + gap: 10px; + margin: 7px 0 0; + font-size: 27px; + letter-spacing: -0.025em; +} + +.secondary-button, +.primary-button { + border: 0; + cursor: pointer; + transition: + transform 160ms ease, + opacity 160ms ease, + border-color 160ms ease; +} + +.secondary-button { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 10px 14px; + border: 1px solid var(--border); + border-radius: 11px; + background: var(--surface-soft); + color: var(--muted); +} + +.secondary-button:hover { + border-color: var(--border-strong); + color: var(--text); +} + +.upload-grid { + display: grid; + grid-template-columns: + minmax(0, 1fr) + auto + minmax(0, 1fr); + align-items: center; + gap: 16px; +} + +.upload-panel { + min-height: 128px; + display: flex; + align-items: center; + gap: 16px; + padding: 22px; + border: 1px dashed var(--border-strong); + border-radius: 18px; + background: var(--surface-soft); + cursor: pointer; + transition: + border-color 160ms ease, + background 160ms ease, + transform 160ms ease; +} + +.upload-panel:hover { + transform: translateY(-2px); + border-color: rgba(139, 124, 255, 0.6); + background: rgba(139, 124, 255, 0.06); +} + +.upload-panel-ready { + border-style: solid; + border-color: rgba(95, 225, 162, 0.35); + background: rgba(95, 225, 162, 0.05); +} + +.file-input { + position: absolute; + width: 1px; + height: 1px; + opacity: 0; + pointer-events: none; +} + +.upload-icon { + flex: 0 0 auto; + width: 49px; + height: 49px; + display: grid; + place-items: center; + border-radius: 14px; + color: #bdb6ff; + background: var(--accent-soft); +} + +.upload-copy { + min-width: 0; + display: flex; + flex: 1; + flex-direction: column; + gap: 7px; +} + +.upload-copy strong { + overflow: hidden; + font-size: 15px; + text-overflow: ellipsis; + white-space: nowrap; +} + +.upload-copy span { + color: var(--muted); + font-size: 12px; + line-height: 1.5; +} + +.upload-action { + color: #b9b0ff; + font-size: 12px; + font-weight: 700; +} + +.comparison-arrow { + width: 36px; + height: 36px; + display: grid; + place-items: center; + border: 1px solid var(--border); + border-radius: 999px; + color: var(--faint); + background: var(--surface-soft); +} + +.release-form { + display: grid; + grid-template-columns: + minmax(0, 1fr) + minmax(170px, 0.35fr) + minmax(170px, 0.35fr); + gap: 17px; + margin-top: 24px; +} + +.field { + display: flex; + flex-direction: column; + gap: 9px; +} + +.field-wide { + grid-column: span 1; +} + +.field:last-child { + grid-column: 1 / -1; +} + +.field span { + color: var(--muted); + font-size: 12px; + font-weight: 650; +} + +.field input, +.field textarea { + width: 100%; + border: 1px solid var(--border); + border-radius: 12px; + outline: none; + background: var(--surface-soft); + color: var(--text); + transition: + border-color 160ms ease, + box-shadow 160ms ease; +} + +.field input { + min-height: 46px; + padding: 0 14px; +} + +.field textarea { + min-height: 92px; + padding: 13px 14px; + resize: vertical; +} + +.field input:focus, +.field textarea:focus { + border-color: rgba(139, 124, 255, 0.65); + box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.11); +} + +.primary-button { + width: 100%; + min-height: 52px; + display: flex; + align-items: center; + justify-content: center; + gap: 9px; + margin-top: 22px; + border-radius: 14px; + background: + linear-gradient( + 135deg, + #7867ff, + #9a7dff + ); + color: white; + font-weight: 800; + box-shadow: + 0 15px 36px rgba(115, 91, 255, 0.22); +} + +.primary-button:hover:not(:disabled) { + transform: translateY(-2px); +} + +.primary-button:disabled, +.secondary-button:disabled { + cursor: not-allowed; + opacity: 0.42; +} + +.privacy-note { + margin: 12px 0 0; + text-align: center; + color: var(--faint); + font-size: 11px; +} + +.message { + display: flex; + align-items: flex-start; + gap: 13px; + margin-top: 21px; + padding: 17px; + border: 1px solid; + border-radius: 14px; +} + +.message strong { + display: block; + margin-bottom: 6px; +} + +.message pre { + margin: 0; + color: inherit; + font-size: 12px; + line-height: 1.55; + white-space: pre-wrap; +} + +.message ul { + margin: 8px 0 0; + padding-left: 19px; + color: var(--muted); +} + +.message-error { + border-color: rgba(255, 113, 125, 0.28); + background: rgba(255, 113, 125, 0.08); + color: #ffadb5; +} + +.message-warning { + border-color: rgba(247, 198, 92, 0.26); + background: rgba(247, 198, 92, 0.07); + color: #ffe09a; +} + +.capabilities { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 18px; + margin: 34px 0 70px; +} + +.capability-card, +.report-card, +.metric-card { + border: 1px solid var(--border); + background: var(--surface); +} + +.capability-card { + padding: 24px; + border-radius: 18px; +} + +.capability-icon, +.card-icon { + display: grid; + place-items: center; + color: #b9b0ff; + background: var(--accent-soft); +} + +.capability-icon { + width: 43px; + height: 43px; + margin-bottom: 18px; + border-radius: 12px; +} + +.capability-card h3 { + margin: 0 0 9px; + font-size: 17px; +} + +.capability-card p { + margin: 0; + color: var(--muted); + font-size: 13px; + line-height: 1.65; +} + +.report { + margin-top: 34px; +} + +.decision-pill { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 11px 14px; + border: 1px solid; + border-radius: 999px; + font-size: 12px; + font-weight: 800; + text-transform: capitalize; +} + +.decision-safe_to_promote { + border-color: rgba(95, 225, 162, 0.35); + background: rgba(95, 225, 162, 0.1); + color: #9df0c5; +} + +.decision-manual_review_required { + border-color: rgba(247, 198, 92, 0.34); + background: rgba(247, 198, 92, 0.1); + color: #ffdc88; +} + +.decision-block_release { + border-color: rgba(255, 113, 125, 0.34); + background: rgba(255, 113, 125, 0.1); + color: #ffa7b0; +} + +.metric-grid { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 15px; + margin-bottom: 18px; +} + +.metric-card { + min-height: 150px; + padding: 20px; + border-radius: 17px; +} + +.metric-primary { + border-color: rgba(139, 124, 255, 0.32); + background: + linear-gradient( + 145deg, + rgba(139, 124, 255, 0.17), + rgba(17, 21, 29, 0.88) + ); +} + +.metric-card > span { + color: var(--muted); + font-size: 12px; +} + +.metric-card strong { + display: block; + margin: 15px 0 4px; + font-size: 38px; + line-height: 1; +} + +.metric-card strong small { + margin-left: 3px; + color: var(--faint); + font-size: 15px; +} + +.metric-card p { + margin: 9px 0 0; + color: var(--muted); + font-size: 12px; +} + +.report-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 18px; +} + +.report-card { + min-width: 0; + padding: 22px; + border-radius: 18px; +} + +.report-card-wide { + grid-column: 1 / -1; +} + +.card-heading { + display: flex; + justify-content: space-between; + gap: 16px; + margin-bottom: 19px; +} + +.card-heading > div:first-child { + display: flex; + align-items: center; + gap: 12px; +} + +.card-icon { + flex: 0 0 auto; + width: 38px; + height: 38px; + border-radius: 11px; +} + +.card-heading h3 { + margin: 0 0 4px; + font-size: 16px; +} + +.card-heading p { + margin: 0; + color: var(--muted); + font-size: 11px; +} + +.severity-badge, +.category-badge { + display: inline-flex; + align-items: center; + width: fit-content; + border: 1px solid var(--border); + border-radius: 999px; + color: #c4bdff; + background: var(--accent-soft); + font-size: 10px; + font-weight: 800; + text-transform: uppercase; +} + +.severity-badge { + height: fit-content; + padding: 6px 9px; +} + +.category-badge { + padding: 4px 7px; +} + +.analysis-summary { + margin: 0 0 20px; + color: #d8dde6; + line-height: 1.7; +} + +.finding-list, +.risk-list, +.node-list, +.test-list, +.change-list { + display: flex; + flex-direction: column; + gap: 10px; +} + +.finding, +.test-item, +.risk-row, +.node-row, +.change-row { + border: 1px solid var(--border); + border-radius: 13px; + background: var(--surface-soft); +} + +.finding { + padding: 16px; +} + +.finding-topline { + display: flex; + justify-content: space-between; + gap: 12px; + margin-bottom: 11px; + color: var(--faint); + font-size: 10px; +} + +.finding h4, +.test-item h4 { + margin: 0 0 7px; + font-size: 14px; +} + +.finding p, +.test-item p { + margin: 0; + color: var(--muted); + font-size: 12px; + line-height: 1.6; +} + +.risk-row { + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + padding: 13px; +} + +.risk-row > div, +.node-row > div { + display: flex; + flex-direction: column; + gap: 4px; +} + +.risk-row strong, +.node-row strong { + font-size: 12px; +} + +.risk-row span, +.node-row span { + color: var(--faint); + font-size: 10px; +} + +.risk-row b { + flex: 0 0 auto; + color: #ffcf6f; + font-size: 13px; +} + +.node-row { + display: flex; + align-items: center; + gap: 11px; + padding: 13px; +} + +.impact-dot { + flex: 0 0 auto; + width: 8px; + height: 8px; + border-radius: 999px; +} + +.impact-direct { + background: var(--accent); + box-shadow: 0 0 10px var(--accent); +} + +.impact-downstream { + background: var(--cyan); + box-shadow: 0 0 10px var(--cyan); +} + +.change-row { + overflow: hidden; +} + +.change-row summary { + display: flex; + align-items: center; + gap: 10px; + padding: 14px; + cursor: pointer; + list-style: none; +} + +.change-row summary::-webkit-details-marker { + display: none; +} + +.change-row summary strong { + min-width: 0; + overflow: hidden; + font-size: 12px; + text-overflow: ellipsis; + white-space: nowrap; +} + +.change-id { + color: var(--faint); + font-family: monospace; + font-size: 10px; +} + +.change-comparison { + display: grid; + grid-template-columns: 1fr 1fr; + border-top: 1px solid var(--border); +} + +.change-comparison > div { + min-width: 0; + padding: 14px; +} + +.change-comparison > div:first-child { + border-right: 1px solid var(--border); +} + +.change-comparison span { + display: block; + margin-bottom: 8px; + color: var(--faint); + font-size: 10px; + font-weight: 800; + text-transform: uppercase; +} + +.change-comparison pre { + max-height: 270px; + margin: 0; + overflow: auto; + color: #bdc6d3; + font-size: 10px; + line-height: 1.55; + white-space: pre-wrap; + word-break: break-word; +} + +.test-item { + padding: 15px; +} + +.test-item > span { + display: inline-block; + margin-bottom: 9px; + color: #bdb6ff; + font-size: 9px; + font-weight: 800; + text-transform: uppercase; +} + +.test-item small { + display: block; + margin-top: 10px; + color: var(--faint); + line-height: 1.5; +} + +.rollback-target { + display: flex; + flex-direction: column; + gap: 7px; + margin-bottom: 16px; + padding: 15px; + border: 1px solid var(--border); + border-radius: 13px; + background: var(--surface-soft); +} + +.rollback-target span { + color: var(--faint); + font-size: 10px; + text-transform: uppercase; +} + +.rollback-target strong { + font-size: 14px; +} + +.check-list { + display: flex; + flex-direction: column; + gap: 10px; + margin: 0; + padding: 0; + list-style: none; +} + +.check-list li { + display: flex; + align-items: flex-start; + gap: 8px; + color: var(--muted); + font-size: 12px; + line-height: 1.5; +} + +.check-list svg { + flex: 0 0 auto; + margin-top: 2px; + color: var(--green); +} + +.empty-state { + padding: 21px; + border: 1px dashed var(--border); + border-radius: 12px; + color: var(--faint); + text-align: center; + font-size: 12px; +} + +.footer { + min-height: 90px; + display: flex; + align-items: center; + justify-content: space-between; + border-top: 1px solid var(--border); + color: var(--faint); + font-size: 11px; +} + +.spin { + animation: spin 900ms linear infinite; +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +@media (max-width: 900px) { + .hero { + grid-template-columns: 1fr; + } + + .hero-visual { + min-height: 300px; + } + + .metric-grid, + .capabilities { + grid-template-columns: repeat(2, 1fr); + } + + .release-form { + grid-template-columns: 1fr 1fr; + } + + .release-form .field:first-child, + .release-form .field:last-child { + grid-column: 1 / -1; + } +} + +@media (max-width: 680px) { + .app-shell { + width: min(100% - 24px, 1220px); + } + + .topbar-status { + display: none; + } + + .hero { + min-height: auto; + padding-top: 52px; + } + + .hero h1 { + font-size: 42px; + } + + .workspace, + .report { + padding: 20px; + border-radius: 20px; + } + + .upload-grid { + grid-template-columns: 1fr; + } + + .comparison-arrow { + margin: -3px auto; + transform: rotate(90deg); + } + + .release-form, + .metric-grid, + .report-grid, + .capabilities, + .change-comparison { + grid-template-columns: 1fr; + } + + .change-comparison > div:first-child { + border-right: 0; + border-bottom: 1px solid var(--border); + } + + .report-card-wide { + grid-column: auto; + } + + .section-heading, + .report-header, + .footer { + align-items: flex-start; + flex-direction: column; + } + + .decision-pill { + align-self: flex-start; + } +} \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/app/layout.tsx b/kits/changegraph-release-intelligence/apps/app/layout.tsx new file mode 100644 index 000000000..d8e216ee0 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/app/layout.tsx @@ -0,0 +1,23 @@ +import type { Metadata } from "next"; +import type { ReactNode } from "react"; + +import "./globals.css"; + +export const metadata: Metadata = { + title: + "ChangeGraph — Semantic Release Intelligence", + description: + "Compare Lamatic workflow exports, calculate release risk, and generate safe promotion plans.", +}; + +export default function RootLayout({ + children, +}: Readonly<{ + children: ReactNode; +}>) { + return ( + + {children} + + ); +} \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/app/page.tsx b/kits/changegraph-release-intelligence/apps/app/page.tsx new file mode 100644 index 000000000..cb6390ea2 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/app/page.tsx @@ -0,0 +1,5 @@ +import { ChangeGraphDashboard } from "@/components/changegraph-dashboard"; + +export default function Home() { + return ; +} \ No newline at end of file diff --git a/kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx b/kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx new file mode 100644 index 000000000..1bdadfe52 --- /dev/null +++ b/kits/changegraph-release-intelligence/apps/components/changegraph-dashboard.tsx @@ -0,0 +1,1153 @@ +"use client"; + +import { useMemo, useState } from "react"; +import { + Activity, + AlertTriangle, + ArrowRight, + CheckCircle2, + FileArchive, + LoaderCircle, + Network, + RotateCcw, + ShieldCheck, + Sparkles, + TestTube2, + UploadCloud, + Workflow, +} from "lucide-react"; + +import { readWorkflowArchive } from "@/lib/archive-reader"; +import { calculateBlastRadius } from "@/lib/blast-radius"; +import { buildChangePackage } from "@/lib/change-package"; +import { parseWorkflowExport } from "@/lib/flow-parser"; +import { calculateRiskAssessment } from "@/lib/risk-score"; +import { compareWorkflowExports } from "@/lib/structural-diff"; + +import type { + ChangeGraphReport, + PromotionDecision, +} from "@/types/changegraph"; + +interface AnalysisResponse { + report?: ChangeGraphReport; + warnings?: string[]; + error?: string; + details?: string; +} + +interface UploadPanelProps { + id: string; + title: string; + description: string; + file: File | null; + onChange: (file: File | null) => void; +} + +function formatFileSize(bytes: number): string { + if (bytes < 1024) { + return `${bytes} B`; + } + + if (bytes < 1024 * 1024) { + return `${(bytes / 1024).toFixed(1)} KB`; + } + + return `${(bytes / 1024 / 1024).toFixed(1)} MB`; +} + +function decisionLabel( + decision: PromotionDecision, +): string { + switch (decision) { + case "safe_to_promote": + return "Safe to promote"; + + case "manual_review_required": + return "Manual review required"; + + case "block_release": + return "Release blocked"; + } +} + +function summarizeValue(value: unknown): string { + if (value === null) { + return "Not present"; + } + + if (typeof value === "string") { + return value.length > 400 + ? `${value.slice(0, 400)}…` + : value; + } + + try { + const serialized = JSON.stringify( + value, + null, + 2, + ); + + return serialized.length > 700 + ? `${serialized.slice(0, 700)}…` + : serialized; + } catch { + return String(value); + } +} + +function UploadPanel({ + id, + title, + description, + file, + onChange, +}: UploadPanelProps) { + return ( + + ); +} + +export function ChangeGraphDashboard() { + const [baselineFile, setBaselineFile] = + useState(null); + + const [candidateFile, setCandidateFile] = + useState(null); + + const [flowPurpose, setFlowPurpose] = + useState( + "Evaluate a Lamatic workflow release before production promotion.", + ); + + const [baselineVersion, setBaselineVersion] = + useState("v1.0.0"); + + const [candidateVersion, setCandidateVersion] = + useState("v1.1.0"); + + const [releaseContext, setReleaseContext] = + useState( + "Pre-deployment production release review.", + ); + + const [report, setReport] = + useState(null); + + const [warnings, setWarnings] = + useState([]); + + const [error, setError] = + useState(null); + + const [loading, setLoading] = + useState(false); + + const canAnalyze = useMemo( + () => + Boolean( + baselineFile && + candidateFile && + flowPurpose.trim() && + baselineVersion.trim() && + candidateVersion.trim() && + releaseContext.trim(), + ), + [ + baselineFile, + candidateFile, + flowPurpose, + baselineVersion, + candidateVersion, + releaseContext, + ], + ); + + async function handleAnalyze(): Promise { + if ( + !baselineFile || + !candidateFile || + !canAnalyze + ) { + setError( + "Select both ZIP exports and complete the release information.", + ); + return; + } + + setLoading(true); + setError(null); + setReport(null); + setWarnings([]); + + try { + const [ + baselineArchive, + candidateArchive, + ] = await Promise.all([ + readWorkflowArchive(baselineFile), + readWorkflowArchive(candidateFile), + ]); + + const baseline = + parseWorkflowExport(baselineArchive); + + const candidate = + parseWorkflowExport(candidateArchive); + + const structuralDiff = + compareWorkflowExports( + baseline, + candidate, + ); + + const blastRadius = + calculateBlastRadius( + baseline, + candidate, + structuralDiff, + ); + + const riskAssessment = + calculateRiskAssessment( + structuralDiff, + blastRadius, + ); + + const changePackage = + buildChangePackage({ + flowPurpose, + baselineVersion, + candidateVersion, + baseline, + candidate, + structuralDiff, + blastRadius, + riskAssessment, + }); + + const response = await fetch( + "/api/analyze", + { + method: "POST", + headers: { + "Content-Type": + "application/json", + }, + body: JSON.stringify({ + flowPurpose, + baselineVersion, + candidateVersion, + releaseContext, + changePackage, + }), + }, + ); + + const payload = + (await response.json()) as AnalysisResponse; + + if (!response.ok || !payload.report) { + const message = [ + payload.error, + payload.details, + ] + .filter(Boolean) + .join("\n\n"); + + throw new Error( + message || + "ChangeGraph could not complete the analysis.", + ); + } + + const localWarnings: string[] = [ + ...(payload.warnings ?? []), + ]; + + if ( + baselineArchive.totalRedactions > 0 + ) { + localWarnings.push( + `${baselineArchive.totalRedactions} potential secret value(s) were redacted from the baseline archive.`, + ); + } + + if ( + candidateArchive.totalRedactions > 0 + ) { + localWarnings.push( + `${candidateArchive.totalRedactions} potential secret value(s) were redacted from the candidate archive.`, + ); + } + + if ( + baselineArchive.skippedFiles.length > 0 + ) { + localWarnings.push( + `${baselineArchive.skippedFiles.length} unsupported or ignored baseline file(s) were skipped.`, + ); + } + + if ( + candidateArchive.skippedFiles.length > 0 + ) { + localWarnings.push( + `${candidateArchive.skippedFiles.length} unsupported or ignored candidate file(s) were skipped.`, + ); + } + + setWarnings([ + ...new Set(localWarnings), + ]); + + setReport(payload.report); + } catch (caughtError) { + setError( + caughtError instanceof Error + ? caughtError.message + : "ChangeGraph analysis failed.", + ); + } finally { + setLoading(false); + } + } + + function resetAnalysis(): void { + setBaselineFile(null); + setCandidateFile(null); + setReport(null); + setWarnings([]); + setError(null); + } + + const decision = + report?.riskAssessment.decision; + + return ( +
+
+ + + + + + + ChangeGraph + + Semantic release intelligence + + + + +
+ + Deterministic analysis + Lamatic AI +
+
+ +
+
+
+ + Safe workflow promotion +
+ +

+ Understand every workflow change + before it reaches production. +

+ +

+ Compare two Lamatic exports, + calculate their structural impact, + trace the downstream blast radius, + and generate a targeted release + and rollback plan. +

+
+ +
+
+ Candidate flow +
+ +
+ +
+ Diff +
+ +
+ +
+ Risk +
+ +
+ +
+ Promotion decision +
+
+
+ +
+
+
+ + Release comparison + + +

+ Upload workflow versions +

+
+ + {(baselineFile || + candidateFile || + report) && ( + + )} +
+ +
+ + +
+ +
+ + +
+ +
+ + + + + + +