rapidkit 0.33.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -649
- package/contracts/backend-import-stack-parity.snapshot.json +36 -36
- package/contracts/infra-stack.v1.json +190 -47
- package/contracts/module-layout.v1.json +12 -3
- package/contracts/module-support.v1.json +20 -0
- package/contracts/pipeline-last-run.v1.json +80 -0
- package/contracts/runtime-command-surface.v1.json +139 -22
- package/contracts/workspace-intelligence/workspace-context.v1.json +59 -0
- package/contracts/workspace-intelligence/workspace-impact.v1.json +84 -0
- package/contracts/workspace-intelligence/workspace-model-diff.v1.json +105 -0
- package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +36 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +50 -0
- package/contracts/workspace-intelligence/workspace-verify.v1.json +111 -0
- package/dist/analyze-IIPDLLM2.js +1 -0
- package/dist/autopilot-release-EO7GQS4P.js +1 -0
- package/dist/chunk-5LLGW5TP.js +9 -0
- package/dist/{chunk-GAHPNUQJ.js → chunk-752X3YI3.js} +84 -84
- package/dist/chunk-A5FBGRJA.js +1 -0
- package/dist/chunk-B7NCBH5B.js +2 -0
- package/dist/chunk-DKVWFHZO.js +4 -0
- package/dist/{workspace-F56NUNVG.js → chunk-FNL34DKD.js} +15 -15
- package/dist/chunk-HHJAANUC.js +1 -0
- package/dist/{chunk-7OGOVP5U.js → chunk-IATULVMR.js} +1 -1
- package/dist/chunk-KDUAZXEQ.js +3 -0
- package/dist/chunk-KMUWWZRT.js +1 -0
- package/dist/chunk-MCLLP6MW.js +2 -0
- package/dist/chunk-OCGZNSOE.js +1 -0
- package/dist/chunk-R4RPUW7I.js +7 -0
- package/dist/chunk-TC2PSHT6.js +50 -0
- package/dist/chunk-UZW5QFRW.js +5 -0
- package/dist/chunk-VPNHGQIV.js +1 -0
- package/dist/chunk-YBS2HGO3.js +2 -0
- package/dist/chunk-YJ24EV3P.js +1 -0
- package/dist/create-LUXJGSNL.js +1 -0
- package/dist/doctor-DG3TBPZN.js +1 -0
- package/dist/imported-projects-registry-ZOCHFWMK.js +1 -0
- package/dist/index.d.ts +29 -2
- package/dist/index.js +135 -132
- package/dist/module-layout-NZ43RSC5.js +1 -0
- package/dist/pipeline-7OTUIB6D.js +5 -0
- package/dist/workspace-ZXWYIZOR.js +1 -0
- package/dist/workspace-context-YFQQROOZ.js +2 -0
- package/dist/{workspace-contract-Z5VYUF3T.js → workspace-contract-A6QP7FPA.js} +1 -1
- package/dist/{workspace-foundation-FJC2TO3N.js → workspace-foundation-TYLH5SAU.js} +1 -1
- package/dist/workspace-intelligence-NXIO55GJ.js +1 -0
- package/dist/workspace-model-OO4WOBJS.js +1 -0
- package/dist/workspace-run-AZ63D75J.js +1 -0
- package/dist/workspace-verify-K56NI3AI.js +1 -0
- package/package.json +17 -6
- package/dist/analyze-Q2XAYVUQ.js +0 -9
- package/dist/autopilot-release-OTGKHLH7.js +0 -7
- package/dist/chunk-4E6ZGX6V.js +0 -1
- package/dist/chunk-F5CNV47O.js +0 -3
- package/dist/chunk-KXTXQODI.js +0 -5
- package/dist/chunk-QCZGNOTH.js +0 -2
- package/dist/chunk-Y3UKTEZO.js +0 -2
- package/dist/create-ZUS2NTVR.js +0 -1
- package/dist/doctor-T6F2I6VO.js +0 -50
- package/dist/module-layout-J56LHEGH.js +0 -1
- package/dist/workspace-run-QATZ6ED2.js +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://getrapidkit.com/schemas/workspace-verify.v1.json",
|
|
4
|
+
"title": "RapidKit Workspace Verify Last Run",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"schemaVersion",
|
|
8
|
+
"generatedAt",
|
|
9
|
+
"workspacePath",
|
|
10
|
+
"mode",
|
|
11
|
+
"impact",
|
|
12
|
+
"summary",
|
|
13
|
+
"steps",
|
|
14
|
+
"missingEvidence",
|
|
15
|
+
"blockingReasons",
|
|
16
|
+
"verificationPlan"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"schemaVersion": {
|
|
20
|
+
"const": "workspace-verify.v1"
|
|
21
|
+
},
|
|
22
|
+
"generatedAt": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"format": "date-time"
|
|
25
|
+
},
|
|
26
|
+
"workspacePath": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"minLength": 1
|
|
29
|
+
},
|
|
30
|
+
"mode": {
|
|
31
|
+
"const": "evidence"
|
|
32
|
+
},
|
|
33
|
+
"fromImpactRef": { "type": "string" },
|
|
34
|
+
"scope": { "type": "string" },
|
|
35
|
+
"impact": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"required": ["changed", "risk", "affectedProjects", "recommendedCommands"],
|
|
38
|
+
"properties": {
|
|
39
|
+
"changed": { "type": "boolean" },
|
|
40
|
+
"risk": {
|
|
41
|
+
"enum": ["none", "low", "medium", "high", "critical"]
|
|
42
|
+
},
|
|
43
|
+
"affectedProjects": { "type": "integer", "minimum": 0 },
|
|
44
|
+
"recommendedCommands": { "type": "integer", "minimum": 0 }
|
|
45
|
+
},
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
},
|
|
48
|
+
"summary": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"required": [
|
|
51
|
+
"verdict",
|
|
52
|
+
"exitCode",
|
|
53
|
+
"stepsPassed",
|
|
54
|
+
"stepsWarn",
|
|
55
|
+
"stepsFailed",
|
|
56
|
+
"stepsMissing",
|
|
57
|
+
"stepsSkipped"
|
|
58
|
+
],
|
|
59
|
+
"properties": {
|
|
60
|
+
"verdict": {
|
|
61
|
+
"enum": ["ready", "needs-attention", "blocked"]
|
|
62
|
+
},
|
|
63
|
+
"exitCode": {
|
|
64
|
+
"enum": [0, 1, 2]
|
|
65
|
+
},
|
|
66
|
+
"stepsPassed": { "type": "integer", "minimum": 0 },
|
|
67
|
+
"stepsWarn": { "type": "integer", "minimum": 0 },
|
|
68
|
+
"stepsFailed": { "type": "integer", "minimum": 0 },
|
|
69
|
+
"stepsMissing": { "type": "integer", "minimum": 0 },
|
|
70
|
+
"stepsSkipped": { "type": "integer", "minimum": 0 }
|
|
71
|
+
},
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
},
|
|
74
|
+
"steps": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["id", "label", "scope", "command", "status", "required", "message"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"id": { "type": "string" },
|
|
81
|
+
"label": { "type": "string" },
|
|
82
|
+
"scope": {
|
|
83
|
+
"enum": ["workspace", "project"]
|
|
84
|
+
},
|
|
85
|
+
"project": { "type": "string" },
|
|
86
|
+
"status": {
|
|
87
|
+
"enum": ["pass", "warn", "fail", "missing", "skipped"]
|
|
88
|
+
},
|
|
89
|
+
"required": { "type": "boolean" },
|
|
90
|
+
"evidencePath": { "type": "string" },
|
|
91
|
+
"message": { "type": "string" },
|
|
92
|
+
"command": { "type": "object", "additionalProperties": true }
|
|
93
|
+
},
|
|
94
|
+
"additionalProperties": true
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"missingEvidence": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": { "type": "string" }
|
|
100
|
+
},
|
|
101
|
+
"blockingReasons": {
|
|
102
|
+
"type": "array",
|
|
103
|
+
"items": { "type": "string" }
|
|
104
|
+
},
|
|
105
|
+
"verificationPlan": {
|
|
106
|
+
"type": "array",
|
|
107
|
+
"items": { "type": "object", "additionalProperties": true }
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"additionalProperties": true
|
|
111
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-5LLGW5TP.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runAutopilotRelease}from'./chunk-R4RPUW7I.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {a,b as b$1}from'./chunk-KMUWWZRT.js';import {h as h$1,i}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-VKLL63TL.js';import h from'fs';import o from'path';import s from'chalk';var I=new Set([".git",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function y(e){try{return await h.promises.access(e,h.constants.F_OK),true}catch{return false}}async function v(e){try{let n=JSON.parse(await h.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function G(e){try{return await h.promises.readFile(e,"utf-8")}catch{return ""}}function E(e){return a(e)}async function S(e,n){return await y(o.join(e,".rapidkit","project.json"))||await y(o.join(e,".rapidkit","context.json"))?true:b$1(e)?false:o.resolve(e)===o.resolve(n)?h$1(e).length>0:h$1(e).length>0}async function T(e){let n=await a$1(e,{skipDirs:I,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:S});return n.length>0?n:b$1(e)?[]:h$1(e).length>0?[e]:[]}function N(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function b(e,n){for(let t of n)if(await y(o.join(e,t)))return true;return false}async function K(e){return b(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function O(e){if(await b(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await v(o.join(e,"package.json")),i=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return typeof i.test=="string"&&i.test.trim().length>0}async function _(e){let n=await v(o.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function f(e,n,t,i,r,c){return {id:e,severity:n,target:t,title:i,detail:r,remediation:c}}function J(e){let n=e.reduce((t,i)=>i.severity==="fail"?t+28:i.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function M(e,n){let t=await v(o.join(n,".rapidkit","project.json")),i$1=i(n,t),r=h$1(n),c=i$1.runtime==="unknown"?r[0]||"unknown":i$1.runtime,a=N(e,n),d=a,u=await _(n),m=await y(o.join(n,".rapidkit","project.json"))||await y(o.join(n,".rapidkit","context.json")),g=await O(n),k=await b(n,["Dockerfile","dockerfile"]),w=await b(n,[".env.example","env.example","config/env.example"]),A=await b(n,[".github/workflows/ci.yml",".github/workflows/ci.yaml",".github/workflows/main.yml",".github/workflows/build.yml",".github/workflows/test.yml",".github/workflows/deploy.yml",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]),z=await K(n),l=[];return i$1.key==="unknown"&&l.push(f("project.stack.unknown","fail",d,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),m||l.push(f("project.marker.missing","warn",d,"RapidKit marker is missing","The project can be detected by files, but it is not registered with RapidKit metadata.","Run `rapidkit import <path>` from a workspace or create the project through RapidKit.")),g||l.push(f("project.tests.missing","warn",d,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `rapidkit workspace run test --affected` can gate changes.")),w||l.push(f("project.env.example.missing","info",d,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),A||l.push(f("project.ci.missing","warn",d,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),z||l.push(f("project.health.missing","info",d,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),k||l.push(f("project.container.missing","info",d,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:o.basename(n),path:n,relativePath:a,runtime:c,framework:i$1.key,confidence:i$1.confidence,supportTier:i$1.supportTier,hasRapidKitMarker:m,hasTests:g,hasDockerfile:k,hasEnvExample:w,hasCiConfig:A,hasHealthEndpoint:z,scripts:u,findings:l,score:J(l)}}function W(e){return e.name.toLowerCase()}async function H(e){let n=new Map(e.map(r=>[W(r),r])),t=[];for(let r of e){let c=await v(o.join(r.path,"package.json")),a={...c?.dependencies??{},...c?.devDependencies??{},...c?.peerDependencies??{}};for(let u of Object.keys(a)){let m=u.replace(/^@[^/]+\//,"").toLowerCase(),g=n.get(m);g&&g.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:g.relativePath,kind:"package"});}let d=await G(o.join(r.path,"pyproject.toml"));for(let u of e)u.relativePath!==r.relativePath&&d.includes(u.name)&&t.push({from:r.relativePath,to:u.relativePath,kind:"workspace-reference"});}let i=new Set;return t.filter(r=>{let c=`${r.from}\0${r.to}\0${r.kind}`;return i.has(c)?false:(i.add(c),true)})}function B(e,n){let t=new Map;for(let i of e)t.set(i.relativePath,{project:i.relativePath,directDependents:0,directDependencies:0});for(let i of n){let r=t.get(i.from),c=t.get(i.to);r&&(r.directDependencies+=1),c&&(c.directDependents+=1);}return Array.from(t.values()).sort((i,r)=>r.directDependents-i.directDependents||r.directDependencies-i.directDependencies)}async function U(e){let n=await v(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function V(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function L(e){if(e.projectCount===0)return ["Create a RapidKit workspace: npx rapidkit create workspace my-workspace --profile polyglot","Import an existing service: npx rapidkit import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `rapidkit bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `rapidkit import <path>` or recreate them via `rapidkit create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `rapidkit workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||n.push("Create `.rapidkit/workspace-dependency-graph.json` or use analyze output as the first graph seed."),n.push("Run `rapidkit autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function ie(e={}){let n=o.resolve(e.workspacePath||process.cwd());if(!await y(n))throw new Error(`Workspace path does not exist: ${n}`);let t=E(n)??n,i=await y(o.join(t,".rapidkit-workspace"))||await y(o.join(t,".rapidkit","workspace.json")),r=await U(t),c=await T(t),a=await Promise.all(c.map(p=>M(t,p))),d=await H(a),u=B(a,d),m=[];i||m.push(f("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered RapidKit workspace.","Run `rapidkit create workspace` or `rapidkit bootstrap --profile polyglot` in a workspace root.")),a.length===0&&m.push(f("workspace.projects.missing","fail",".","No backend projects detected","RapidKit did not find runtime markers or project metadata under this root.","Create a project with `rapidkit create project` or import one with `rapidkit import <path>`."));let g=[...m,...a.flatMap(p=>p.findings)],k=V(g),w={};for(let p of a)w[p.runtime]=(w[p.runtime]||0)+1;let A=a.length>0?Math.round(a.reduce((p,P)=>p+P.score,0)/a.length):0,z=m.reduce((p,P)=>p+(P.severity==="fail"?20:P.severity==="warn"?8:2),0),l=Math.max(0,A-z),F=k.fail>0||e.strict&&k.warn>0?"blocked":k.warn>0?"needs-attention":"ready",C={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:l,verdict:F,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:k},runtimes:w,projects:a,dependencyGraph:{status:d.length>0?"generated":"empty",edges:d,topImpactedProjects:u.slice(0,5)},findings:g,nextActions:L({findings:g,projectCount:a.length,hasGraph:d.length>0}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e.output&&(await h.promises.mkdir(o.dirname(o.resolve(e.output)),{recursive:true}),await h.promises.writeFile(o.resolve(e.output),`${JSON.stringify(C,null,2)}
|
|
2
|
+
`)),!e.output&&i){let p=o.join(t,".rapidkit","reports","analyze-last-run.json");await h.promises.mkdir(o.dirname(p),{recursive:true}),await h.promises.writeFile(p,`${JSON.stringify(C,null,2)}
|
|
3
|
+
`);}return C}function re(e){let n=e.summary.verdict==="ready"?s.green:e.summary.verdict==="needs-attention"?s.yellow:s.red;if(console.log(s.bold(`
|
|
4
|
+
RapidKit Workspace Analysis
|
|
5
|
+
`)),console.log(s.cyan("Workspace:"),e.workspacePath),console.log(s.cyan("Profile:"),e.profile||"not configured"),console.log(s.cyan("Score:"),`${e.summary.score}/100`),console.log(s.cyan("Verdict:"),n(e.summary.verdict)),console.log(s.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(s.bold(`
|
|
6
|
+
Projects`));for(let t of e.projects){let i=t.score>=85?s.green("pass"):t.score>=65?s.yellow("watch"):s.red("risk");console.log(` ${t.relativePath} ${s.gray(`${t.runtime}/${t.framework}`)} ${i} ${t.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(s.bold(`
|
|
7
|
+
Dependency Graph`)),console.log(s.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(s.gray(" Top impacted projects:"));for(let t of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${t.project} (${t.directDependents} dependents, ${t.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(s.bold(`
|
|
8
|
+
Top Findings`));for(let t of e.findings.slice(0,8)){let i=t.severity==="fail"?s.red:t.severity==="warn"?s.yellow:s.gray;console.log(` ${i(t.severity.toUpperCase())} ${t.target}: ${t.title}`),console.log(s.gray(` ${t.remediation}`));}}console.log(s.bold(`
|
|
9
|
+
Next Actions`));for(let t of e.nextActions.slice(0,5))console.log(s.gray(` - ${t}`));console.log();}export{ie as a,re as b};
|