rapidkit 0.41.3 → 0.41.4
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 +5 -0
- package/contracts/agent-customization-pack.v1.json +5 -0
- package/contracts/artifact-remediation-plan.v1.json +163 -0
- package/contracts/extension-cli-compatibility.v1.json +2 -1
- package/contracts/runtime-command-surface.v1.json +2 -0
- package/dist/artifact-remediation-plan-HRR3WH7T.js +3 -0
- package/dist/autopilot-release-MSK4ELKR.js +1 -0
- package/dist/chunk-2E6WGUN6.js +1 -0
- package/dist/{chunk-XRGBKUJO.js → chunk-4RJESJ23.js} +1 -1
- package/dist/{chunk-GD6VML5K.js → chunk-56GL3GG7.js} +2 -2
- package/dist/{chunk-3CYEVV6H.js → chunk-ALCH4JAS.js} +1 -1
- package/dist/{chunk-C4ASE2DV.js → chunk-FI4VMG2I.js} +1 -1
- package/dist/{chunk-O74N26AD.js → chunk-L3R2AS2W.js} +1 -1
- package/dist/chunk-LRF6PQOZ.js +1 -0
- package/dist/{chunk-XY3SGMAJ.js → chunk-T5GS4BUP.js} +1 -1
- package/dist/{chunk-6UBWN4EE.js → chunk-THSTNVE3.js} +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +105 -105
- package/dist/{pipeline-ZCJ6NVRC.js → pipeline-UOGPOG7S.js} +1 -1
- package/dist/{workspace-agent-sync-QJWXK3RT.js → workspace-agent-sync-RWDOTSWV.js} +1 -1
- package/dist/{workspace-context-I5OXR6XB.js → workspace-context-R3XWWLFP.js} +1 -1
- package/dist/workspace-explain-JIAM63TE.js +1 -0
- package/dist/{workspace-intelligence-4SGJDZ6H.js → workspace-intelligence-5BBKUJAG.js} +1 -1
- package/dist/{workspace-mcp-serve-4QN7ZU6C.js → workspace-mcp-serve-GPSSYKZK.js} +1 -1
- package/dist/{workspace-model-R6XYEQZO.js → workspace-model-YAC5BKLL.js} +1 -1
- package/dist/workspace-run-MNVPNDUK.js +1 -0
- package/dist/{workspace-verify-TEQWZOXM.js → workspace-verify-YDPCHWGQ.js} +1 -1
- package/dist/{workspace-watch-WERGZE5P.js → workspace-watch-P2PGSYDD.js} +1 -1
- package/docs/commands-reference.md +1 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +11 -0
- package/docs/contracts/README.md +1 -0
- package/package.json +1 -1
- package/dist/autopilot-release-GBH7PIIZ.js +0 -1
- package/dist/chunk-TSUQQTHI.js +0 -1
- package/dist/workspace-explain-YFKDZRVX.js +0 -1
- package/dist/workspace-run-QRT3JJDB.js +0 -1
- /package/dist/{chunk-GH674HP5.js → chunk-WHQWVQJH.js} +0 -0
package/README.md
CHANGED
|
@@ -170,6 +170,7 @@ For the visual experience, install the [Workspai VS Code extension](https://mark
|
|
|
170
170
|
| What breaks if I change this? | `workspace impact --from <snapshot>` |
|
|
171
171
|
| Why is release blocked? | `workspace explain release-blocked --json --write` |
|
|
172
172
|
| Trace a diff through blast radius and gates? | `workspace trace --from .rapidkit/reports/workspace-model-diff-last-run.json --json --write` |
|
|
173
|
+
| What should Studio do for blocked artifacts? | `workspace remediation-plan --ci --json --write` |
|
|
173
174
|
| Can I safely release? | `pipeline --json --strict` |
|
|
174
175
|
| How do I align AI tools and CI? | `workspace agent-sync --write` |
|
|
175
176
|
| Expose workspace evidence to MCP clients? | `workspace mcp serve` |
|
|
@@ -317,6 +318,7 @@ Workspace Intelligence provides a shared understanding of projects, dependencies
|
|
|
317
318
|
| `workspace diff --from <file\|git[:ref]> --json` | Diff against snapshot or git |
|
|
318
319
|
| `workspace impact --from <file> --json` | Graph-aware transitive blast-radius evidence |
|
|
319
320
|
| `workspace verify [--strict] --json` | Definitive verification gate (subgraph + freshness + policy + fleet evidence) |
|
|
321
|
+
| `workspace remediation-plan [--ci] --json --write` | Cross-artifact Studio repair plan for blocked governance cards |
|
|
320
322
|
| `workspace explain <target> [--write] --json` | Human narrative for release blockers, projects, or trace slices |
|
|
321
323
|
| `workspace why <target>` | Alias of `workspace explain` |
|
|
322
324
|
| `workspace trace --from <diff> [--write] --json` | Diff → impact → gates narrative for agents and IDE handoff |
|
|
@@ -414,6 +416,9 @@ npm run check:agent-customization-drift -- --workspace <workspace-root>
|
|
|
414
416
|
| `.rapidkit/reports/rapidkit-mcp-design.json` | Read-mostly MCP-ready tool design manifest |
|
|
415
417
|
| `.rapidkit/reports/INDEX.json` | Read order, blockers, report timestamps |
|
|
416
418
|
| `.rapidkit/reports/workspace-context-agent.json` | Canonical agent context pack |
|
|
419
|
+
| `.rapidkit/reports/artifact-remediation-plan-last-run.json` | Cross-artifact Studio repair plan |
|
|
420
|
+
| `.rapidkit/reports/doctor-remediation-plan-last-run.json` | Doctor-specific ordered repair plan |
|
|
421
|
+
| `.rapidkit/reports/doctor-fix-result-last-run.json` | Doctor fix/apply execution result |
|
|
417
422
|
| `.rapidkit/AGENT-GROUNDING.md` | Tool-agnostic grounding doc |
|
|
418
423
|
| `AGENTS.md` | Open standard for all agents (managed RapidKit section) |
|
|
419
424
|
| `.github/copilot-instructions.md` | GitHub Copilot / VS Code Chat always-on rules |
|
|
@@ -125,6 +125,11 @@
|
|
|
125
125
|
"label": "Doctor remediation plan",
|
|
126
126
|
"required": false
|
|
127
127
|
},
|
|
128
|
+
{
|
|
129
|
+
"path": ".rapidkit/reports/artifact-remediation-plan-last-run.json",
|
|
130
|
+
"label": "Artifact remediation plan",
|
|
131
|
+
"required": false
|
|
132
|
+
},
|
|
128
133
|
{
|
|
129
134
|
"path": ".rapidkit/reports/doctor-fix-result-last-run.json",
|
|
130
135
|
"label": "Doctor fix result",
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://rapidkit.dev/contracts/artifact-remediation-plan.v1.json",
|
|
4
|
+
"title": "RapidKit Artifact Remediation Plan",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["schemaVersion", "generatedAt", "workspace", "source", "summary", "actions"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"schemaVersion": {
|
|
10
|
+
"const": "artifact-remediation-plan-v1"
|
|
11
|
+
},
|
|
12
|
+
"generatedAt": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"workspace": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["name"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"name": { "type": "string" },
|
|
21
|
+
"path": { "type": "string" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"source": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["command", "reportsDir", "includeAbsolutePaths", "ciMode"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"command": { "const": "workspace remediation-plan" },
|
|
30
|
+
"reportsDir": { "type": "string" },
|
|
31
|
+
"includeAbsolutePaths": { "type": "boolean" },
|
|
32
|
+
"ciMode": { "type": "boolean" }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"summary": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": [
|
|
39
|
+
"artifactsScanned",
|
|
40
|
+
"cardsCovered",
|
|
41
|
+
"totalActions",
|
|
42
|
+
"executableActions",
|
|
43
|
+
"risk"
|
|
44
|
+
],
|
|
45
|
+
"properties": {
|
|
46
|
+
"artifactsScanned": { "type": "integer", "minimum": 0 },
|
|
47
|
+
"cardsCovered": { "type": "integer", "minimum": 0 },
|
|
48
|
+
"totalActions": { "type": "integer", "minimum": 0 },
|
|
49
|
+
"executableActions": { "type": "integer", "minimum": 0 },
|
|
50
|
+
"risk": { "$ref": "#/$defs/riskSummary" }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"actions": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": { "$ref": "#/$defs/action" }
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"$defs": {
|
|
59
|
+
"riskSummary": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"additionalProperties": false,
|
|
62
|
+
"required": ["safe", "guarded", "invasive"],
|
|
63
|
+
"properties": {
|
|
64
|
+
"safe": { "type": "integer", "minimum": 0 },
|
|
65
|
+
"guarded": { "type": "integer", "minimum": 0 },
|
|
66
|
+
"invasive": { "type": "integer", "minimum": 0 }
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"operation": {
|
|
70
|
+
"oneOf": [
|
|
71
|
+
{
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": ["type", "path", "content", "overwrite"],
|
|
75
|
+
"properties": {
|
|
76
|
+
"type": { "const": "file-create" },
|
|
77
|
+
"path": { "type": "string" },
|
|
78
|
+
"content": { "type": "string" },
|
|
79
|
+
"overwrite": { "const": false }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"required": ["type", "command", "cwd"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"type": { "const": "run-command" },
|
|
88
|
+
"command": { "type": "string" },
|
|
89
|
+
"cwd": { "enum": ["workspace", "project"] }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"action": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"additionalProperties": false,
|
|
97
|
+
"required": [
|
|
98
|
+
"id",
|
|
99
|
+
"artifactKind",
|
|
100
|
+
"cardId",
|
|
101
|
+
"title",
|
|
102
|
+
"order",
|
|
103
|
+
"phase",
|
|
104
|
+
"scope",
|
|
105
|
+
"status",
|
|
106
|
+
"mode",
|
|
107
|
+
"risk",
|
|
108
|
+
"requiresApproval",
|
|
109
|
+
"blocker",
|
|
110
|
+
"summary",
|
|
111
|
+
"verifyCommand",
|
|
112
|
+
"cwd",
|
|
113
|
+
"files",
|
|
114
|
+
"rollback",
|
|
115
|
+
"notes"
|
|
116
|
+
],
|
|
117
|
+
"properties": {
|
|
118
|
+
"id": { "type": "string" },
|
|
119
|
+
"artifactKind": { "type": "string" },
|
|
120
|
+
"cardId": { "type": "string" },
|
|
121
|
+
"title": { "type": "string" },
|
|
122
|
+
"order": { "type": "integer", "minimum": 0 },
|
|
123
|
+
"phase": { "type": "string" },
|
|
124
|
+
"scope": { "enum": ["workspace", "project"] },
|
|
125
|
+
"status": { "enum": ["ready", "review-required", "blocked", "guidance-only"] },
|
|
126
|
+
"mode": {
|
|
127
|
+
"enum": [
|
|
128
|
+
"edit-file",
|
|
129
|
+
"run-command",
|
|
130
|
+
"refresh-evidence",
|
|
131
|
+
"verify-before-fix",
|
|
132
|
+
"manual-guidance"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"risk": { "enum": ["safe", "guarded", "invasive"] },
|
|
136
|
+
"requiresApproval": { "type": "boolean" },
|
|
137
|
+
"blocker": { "type": "string" },
|
|
138
|
+
"summary": { "type": "string" },
|
|
139
|
+
"command": { "type": "string" },
|
|
140
|
+
"verifyCommand": { "type": "string" },
|
|
141
|
+
"cwd": { "enum": ["workspace", "project"] },
|
|
142
|
+
"files": {
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": { "type": "string" }
|
|
145
|
+
},
|
|
146
|
+
"operation": { "$ref": "#/$defs/operation" },
|
|
147
|
+
"rollback": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"additionalProperties": false,
|
|
150
|
+
"required": ["available", "strategy"],
|
|
151
|
+
"properties": {
|
|
152
|
+
"available": { "type": "boolean" },
|
|
153
|
+
"strategy": { "enum": ["idempotent", "manual", "none"] }
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"notes": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": { "type": "string" }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "rapidkit-extension-cli-compatibility.v1",
|
|
3
3
|
"cli": "rapidkit-npm",
|
|
4
|
-
"minimumVerifiedCliVersion": "0.41.
|
|
4
|
+
"minimumVerifiedCliVersion": "0.41.4",
|
|
5
5
|
"publishedContractSchemas": {
|
|
6
6
|
"runtimeCommandSurface": "rapidkit-runtime-command-surface-v1",
|
|
7
7
|
"cliLogEvent": "cli-log-event-v1",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"workspaceExplain": "workspace-explain.v1",
|
|
21
21
|
"agentActionOutcome": "agent-action-outcome.v1",
|
|
22
22
|
"doctorRemediationPlan": "doctor-remediation-plan-v2",
|
|
23
|
+
"artifactRemediationPlan": "artifact-remediation-plan-v1",
|
|
23
24
|
"doctorFixResult": "rapidkit-doctor-fix-result-v1"
|
|
24
25
|
}
|
|
25
26
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a}from'./chunk-2E6WGUN6.js';import p from'path';import b from'fs-extra';var w=[{artifactKind:"bootstrap-compliance",cardId:"bootstrap",fileNames:["bootstrap-compliance.latest.json"]},{artifactKind:"doctor-workspace",cardId:"doctor",fileNames:["doctor-remediation-plan-last-run.json"]},{artifactKind:"analyze",cardId:"analyze",fileNames:["analyze-last-run.json"]},{artifactKind:"readiness",cardId:"readiness",fileNames:["release-readiness-last-run.json"]},{artifactKind:"pipeline",cardId:"pipeline",fileNames:["pipeline-last-run.json"]},{artifactKind:"workspace-run",cardId:"workspaceRun",fileNames:["workspace-run-last.json"]},{artifactKind:"workspace-verify",cardId:"workspaceVerify",fileNames:["workspace-verify-last-run.json"]}];function f(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function m(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}function k(e){return [...new Set(e.map(r=>r.trim()).filter(Boolean))]}function v(e,r,t){return t?r:p.relative(e,r)}function j(e){let r=e?.trim()||"npx rapidkit bootstrap";if(!/(?:^|\s)--ci(?:\s|$)/.test(r)&&/(?:^|\s)--json(?:\s|$)/.test(r))return r.replace(/(?:^|\s)--json(?:\s|$)/,i=>{let s=i.startsWith(" ")?" ":"",c=i.endsWith(" ")?" ":"";return `${s}--ci --json${c}`}).trim();let t=/(?:^|\s)--ci(?:\s|$)/.test(r)?r:`${r} --ci`;return /(?:^|\s)--json(?:\s|$)/.test(t)?t:`${t} --json`}function x(e){return `${JSON.stringify({schemaVersion:"rapidkit.compatibility-matrix.v1",generatedAt:e,source:"rapidkit workspace remediation-plan",runtimes:{},notes:["Minimal enterprise baseline. Add runtime and toolchain entries as governance matures."]},null,2)}
|
|
2
|
+
`}function I(e){return `${JSON.stringify({schema_version:"1.0",enabled:false,strategy:"on-demand",artifacts:[],created_at:e,note:"Minimal enterprise baseline. Set enabled: true and add artifact entries to activate mirroring."},null,2)}
|
|
3
|
+
`}function K(e){let r=e.payload,t=m(r.blockers),i=m(r.blockingReasons),s=m(r.failures),c=m(r.reasons),l=m(r.policyViolations),o=f(r.summary),g=m(o?.blockers);if(e.artifactKind==="analyze"){let a=(Array.isArray(r.findings)?r.findings:[]).map(n=>f(n)).filter(n=>!!n).map(n=>String(n.message??n.title??n.id??"").trim()).filter(Boolean);return k([...t,...a,...i])}if(e.artifactKind==="workspace-run"){let u=f(r.stages),a=Object.entries(u??{}).flatMap(([n,h])=>{let R=f(h);return (Array.isArray(R?.projects)?R.projects:[]).map(d=>f(d)).filter(d=>!!d).filter(d=>d.status==="failed"||d.ok===false).map(d=>`${n}: ${String(d.project??d.name??"project")} failed`)});return k([...t,...a,...i])}return k([...t,...i,...s,...c,...l,...g])}function y(e){return {id:e.id,artifactKind:e.artifactKind,cardId:e.cardId,title:e.title,order:e.order,phase:e.phase,scope:"workspace",status:e.status??"ready",mode:e.mode,risk:e.risk,requiresApproval:true,blocker:e.blocker,summary:e.summary,...e.command?{command:e.command}:{},verifyCommand:e.verifyCommand,cwd:"workspace",files:e.files??[],...e.operation?{operation:e.operation}:{},rollback:{available:!!e.operation,strategy:e.operation?"idempotent":"none"},notes:e.notes??[]}}function C(e){let r=[],t=j("npx rapidkit bootstrap --json");for(let i of e.blockers)i.includes("profile.enterprise.ci")&&r.push(y({id:"bootstrap.enterprise-ci",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Run bootstrap in deterministic CI mode",order:10,phase:"bootstrap-preflight",blocker:i,summary:"Enterprise bootstrap compliance requires --ci for deterministic execution.",mode:"run-command",risk:"safe",command:t,verifyCommand:t})),i.includes("profile.enterprise.compatibility-matrix")&&r.push(y({id:"bootstrap.compatibility-matrix",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise compatibility matrix baseline",order:20,phase:"bootstrap-config",blocker:i,summary:"Create the missing compatibility matrix baseline without overwriting user data.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".rapidkit/compatibility-matrix.json"],operation:{type:"file-create",path:".rapidkit/compatibility-matrix.json",content:x(e.generatedAt),overwrite:false}})),i.includes("profile.enterprise.mirror-config")&&r.push(y({id:"bootstrap.mirror-config",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise mirror config baseline",order:30,phase:"bootstrap-config",blocker:i,summary:"Create the missing mirror configuration baseline without enabling mirroring.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".rapidkit/mirror-config.json"],operation:{type:"file-create",path:".rapidkit/mirror-config.json",content:I(e.generatedAt),overwrite:false}}));return r}function M(e){let t={analyze:{title:"Refresh analyze evidence",phase:"analysis",command:"npx rapidkit analyze --strict --json",verify:"npx rapidkit analyze --strict --json"},readiness:{title:"Refresh release readiness",phase:"release-readiness",command:e.ciMode?"npx rapidkit readiness --strict --json":"npx rapidkit readiness --json",verify:e.ciMode?"npx rapidkit readiness --strict --json":"npx rapidkit readiness --json"},pipeline:{title:"Rerun governance pipeline",phase:"governance-pipeline",command:"npx rapidkit pipeline --json --strict",verify:"npx rapidkit pipeline --json --strict"},"workspace-run":{title:"Rerun failed workspace stage",phase:"fleet-run",command:e.ciMode?"npx rapidkit workspace run test --strict --json":"npx rapidkit workspace run test --json",verify:e.ciMode?"npx rapidkit workspace run test --strict --json":"npx rapidkit workspace run test --json"},"workspace-verify":{title:"Refresh workspace verify gate",phase:"verification",command:e.ciMode?"npx rapidkit workspace verify --strict --json":"npx rapidkit workspace verify --json",verify:e.ciMode?"npx rapidkit workspace verify --strict --json":"npx rapidkit workspace verify --json"},"doctor-workspace":{title:"Use Doctor remediation plan",phase:"doctor-remediation",command:"npx rapidkit doctor workspace --plan --json",verify:"npx rapidkit doctor workspace --json"}}[e.report.artifactKind]??{title:"Refresh artifact evidence",phase:"evidence-refresh",command:"npx rapidkit pipeline --json --strict",verify:"npx rapidkit pipeline --json --strict"};return y({id:`${e.report.cardId}.refresh.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:t.title,order:e.order,phase:t.phase,blocker:e.blocker,summary:"No deterministic file operation is available for this artifact yet; refresh the evidence and continue with the card-specific plan.",mode:e.report.artifactKind==="doctor-workspace"?"verify-before-fix":"run-command",risk:"guarded",status:e.report.artifactKind==="doctor-workspace"?"review-required":"ready",command:t.command,verifyCommand:t.verify,notes:e.report.artifactKind==="doctor-workspace"?["Read doctor-remediation-plan-last-run.json for ordered file-level steps."]:[]})}async function N(e){let r=p.join(e,".rapidkit","reports"),t=[];for(let i of w)for(let s of i.fileNames){let c=p.join(r,s);if(await b.pathExists(c))try{let l=await b.readJSON(c),o=f(l);if(!o)continue;t.push({artifactKind:i.artifactKind,cardId:i.cardId,fileName:s,absolutePath:c,payload:o});}catch{t.push({artifactKind:i.artifactKind,cardId:i.cardId,fileName:s,absolutePath:c,payload:{blockers:[`${i.artifactKind}: report exists but could not be parsed.`]}});}}return t}async function _(e){let r=p.resolve(e.workspacePath),t=e.includeAbsolutePaths===true,i=e.ciMode===true,s=new Date().toISOString(),c=p.join(r,".rapidkit","reports"),l=await N(r),o=[],g=1;for(let a of l){let n=K(a);if(n.length!==0){if(a.artifactKind==="bootstrap-compliance"){o.push(...C({blockers:n,generatedAt:s})),g=o.length+1;continue}for(let h of n.slice(0,8))o.push(M({report:a,blocker:h,order:g,ciMode:i})),g+=1;}}let u={safe:o.filter(a=>a.risk==="safe").length,guarded:o.filter(a=>a.risk==="guarded").length,invasive:o.filter(a=>a.risk==="invasive").length};return {schemaVersion:a,generatedAt:s,workspace:{name:p.basename(r),...t?{path:r}:{}},source:{command:"workspace remediation-plan",reportsDir:v(r,c,t),includeAbsolutePaths:t,ciMode:i},summary:{artifactsScanned:l.length,cardsCovered:k(o.map(a=>a.cardId)).length,totalActions:o.length,executableActions:o.filter(a=>a.status==="ready").length,risk:u},actions:o}}async function z(e,r){let t=p.join(r,".rapidkit","reports","artifact-remediation-plan-last-run.json");return await b.ensureDir(p.dirname(t)),await b.writeJSON(t,e,{spaces:2}),t}export{_ as buildArtifactRemediationPlan,z as writeArtifactRemediationPlan};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-ALCH4JAS.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var A="artifact-remediation-plan-v1";export{A as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-L3R2AS2W.js';import {f}from'./chunk-THSTNVE3.js';import {a}from'./chunk-AQ4XZZC6.js';import {c,e,d}from'./chunk-GBJBQ43T.js';import {n}from'./chunk-LRF6PQOZ.js';import {j,a as a$2}from'./chunk-3PTJID76.js';import y from'path';import $ from'fs-extra';function B(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function C(e){try{return await $.pathExists(e)?await $.readJson(e):null}catch{return null}}function M(e,o){if(!e)return null;let s=o.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===s||r.relativePath.toLowerCase()===s)??null}function F(e,o,s){let r=s.trim().toLowerCase(),t=(e.graph?.nodes.map(i=>i.id)??e.projects.map(i=>i.name)).find(i=>i.toLowerCase()===r);if(t)return t;let d=e.projects.find(i=>[i.name,i.path,y.basename(i.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let p=M(o,s);if(p){let i=e.projects.find(u=>u.path===p.relativePath||u.path.endsWith(`/${p.relativePath}`));if(i)return i.name}return s}function z(e,o){if(!e)return [];let s=o.trim().toLowerCase(),r=new Set;for(let a of e.projects){a.contracts.dependsOn?.some(t=>t.toLowerCase()===s)&&r.add(a.slug);for(let t of a.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===s&&r.add(a.slug);}return [...r].sort()}function G(e,o){if(!e)return [];let s=o.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===s&&r.command?.display).map(r=>r.command.display).slice(0,8)}function l(e,o,s){return {id:e,title:o,body:s.trim()}}async function ae(e){let o=y.resolve(e.workspacePath),s=(e.now??new Date).toISOString(),r=e.model??await n({workspacePath:o,includeEvidence:true}),a$2=e.contract;if(a$2===void 0)try{a$2=(await j({workspacePath:o})).contract;}catch{a$2=null;}let t=e.verify;t===void 0&&(t=await C(y.join(o,d$1)));let d=e.impact;if(d===void 0&&(d=await C(y.join(o,f))),e.target.kind==="release-blocked"){let n=t?.blockingReasons??[],c=(r.summary?.projectCount??r.projects.length)===0,g=[l("verdict",c?"Workspace scaffold posture":"Release verdict",t?c?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx rapidkit workspace verify --json --write` first."),l("blockers",c?"Pre-project signals":"Blocking reasons",n.length?n.map(k=>`- ${k}`).join(`
|
|
2
2
|
`):c?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(l("resolution","Resolution hints",t.resolutionHints.map(k=>`- **${k.blockerId}** (${k.resolutionClass}): ${k.commandRetryHint??k.fixHints[0]?.detail??"See fix hints"}`).join(`
|
|
3
3
|
`))),{schemaVersion:a,generatedAt:s,workspacePath:o,target:e.target,summary:t?c?b(n.length,t.summary.verdict):`Release blocked: ${t.summary.verdict} with ${n.length} blocking reason(s).`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseRisk:t?.impact.risk,blockingReasons:n,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let n=e.target,m=t?.resolutionHints?.find(g=>g.blockerId===n.blockerId),c=t?.blockingReasons.find(g=>g.includes(n.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:s,workspacePath:o,target:n,summary:m?`Blocker ${n.blockerId}: ${m.resolutionClass}`:`Blocker ${n.blockerId} (no structured hint)`,sections:[l("reason","Blocking signal",c??"No matching blocking reason in verify."),l("hint","Resolution class",m?`${m.resolutionClass}
|
|
4
4
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {b,c,d}from'./chunk-
|
|
1
|
+
import {b,c,d}from'./chunk-T5GS4BUP.js';import {d as d$1}from'./chunk-L3R2AS2W.js';import {b as b$1,f,a,g as g$1}from'./chunk-GBJBQ43T.js';import {n,k as k$1,b as b$2,j as j$1}from'./chunk-LRF6PQOZ.js';import {j}from'./chunk-3PTJID76.js';import s from'path';import g from'fs-extra';var _=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Se="workspace-operational-skill.v1";function je(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function pe(e){let t=je(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Se,skillId:t,canonicalPath:f(t),title:e.title,triggers:[...e.triggers].sort((r,i)=>r.localeCompare(i)),requiredReports:[...e.requiredReports].sort((r,i)=>r.localeCompare(i)),scopedProjects:[...e.scopedProjects??[]].sort((r,i)=>r.localeCompare(i)),verificationCommands:[...e.verificationCommands],answerContractSections:[..._],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var ve="workspace-skills-index.v1";function de(e){let t=[...e.skills].sort((i,o)=>i.skillId.localeCompare(o.skillId)),r=e.inputsHash??b$2({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath)});return {schemaVersion:ve,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title}))}}var le=[".rapidkit/reports/INDEX.json",b,d$1],Pe=[{skillId:"rapidkit-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using RapidKit evidence before editing application code.",steps:["Read `.rapidkit/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.rapidkit/reports/doctor-last-run.json`, `doctor-project-last-run.json`, and project-scoped run evidence if present.","If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"rapidkit-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed RapidKit gates.",steps:["Read `.rapidkit/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.rapidkit/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","Read `.rapidkit/reports/artifact-remediation-plan-last-run.json` when a Studio or agent repair path is needed.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"rapidkit-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"rapidkit-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"rapidkit-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.rapidkit/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function D(e){return `npx rapidkit ${e}`.trim()}function Ce(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...le.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,i)=>`${i+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
2
2
|
`)}function Ee(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[D("workspace verify --json"),D("doctor workspace --json")]}function Ie(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let i=r.contracts.owns.join(", ")||"none",o=r.contracts.publishes.join(", ")||"none",p=r.contracts.consumes.join(", ")||"none";return `- **${r.slug}**: owns \`${i}\`; publishes \`${o}\`; consumes \`${p}\``}).join(`
|
|
3
3
|
`):void 0}function ue(e){let t=e.model.workspace.name,r=e.model.projects.map(p=>p.name).sort(),i=Ee(e.context??null),o=Ie(e.contract??null);return Pe.map(p=>{let c=Ce({template:p,workspaceName:t,scopedProjects:r,verificationCommands:i,contractSummary:o});return pe({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...le],scopedProjects:r,verificationCommands:i,promptStem:g$1[p.skillId],markdown:c})})}async function ge(e){let t=s.resolve(e.workspacePath),r=[],i=b$2({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:b$2({markdown:p.markdown})}))}),o=de({generatedAt:e.generatedAt,skills:e.skills,inputsHash:i});if(e.write){for(let c of e.skills){let n=s.join(t,c.canonicalPath);await g.ensureDir(s.dirname(n)),await g.writeFile(n,c.markdown,"utf8"),r.push(c.canonicalPath);}let p=s.join(t,b$1);await g.ensureDir(s.dirname(p)),await g.writeJson(p,o,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:o,writtenPaths:r}}function me(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.rapidkit/skills/` before generic repo scans:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
4
|
`)}var Oe={"rapidkit-diagnose-api-failure":".github/prompts/rapidkit-diagnose.prompt.md","rapidkit-release-readiness":".github/prompts/rapidkit-release-readiness.prompt.md"},B="## Workspace verification (hydrated)";function Te(e){let t=[B,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx rapidkit workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
|
|
5
5
|
`)}async function ke(e){let t=s.resolve(e.workspacePath),r=[];for(let i of e.skills){let o=Oe[i.skillId];if(!o)continue;let p=s.join(t,o);if(!await g.pathExists(p))continue;let c=await g.readFile(p,"utf8"),n=Te(i),m=c.includes(B)?c.replace(new RegExp(`${B}[\\s\\S]*$`),n.trimEnd()):`${c.trimEnd()}
|
|
6
6
|
|
|
7
7
|
${n}`;e.write&&await g.writeFile(p,`${m.trimEnd()}
|
|
8
|
-
`,"utf8"),r.push(o);}return r}var We="rapidkit-agent-customization-pack.v1";function fe(){return {schemaVersion:We,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md",".github/instructions/rapidkit-workspace.instructions.md",".github/prompts/rapidkit-diagnose.prompt.md",".github/skills/rapidkit-workspace-intelligence/SKILL.md",".github/agents/workspai-advisor.agent.md",".rapidkit/reports/rapidkit-mcp-design.json",b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[..._],requiredReports:O.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".rapidkit/reports/",`${a}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var Ne="rapidkit-agent-reports-index.v1",_e="rapidkit-agent-customization-pack.v1",J=".rapidkit/reports/INDEX.json",he=".rapidkit/AGENT-GROUNDING.md",G=".rapidkit/reports/agent-customization-pack.json",O=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:".rapidkit/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".rapidkit/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".rapidkit/reports/doctor-project-last-run.json",label:"Project doctor",required:false},{relativePath:".rapidkit/reports/doctor-remediation-plan-last-run.json",label:"Doctor remediation plan",required:false},{relativePath:".rapidkit/reports/doctor-fix-result-last-run.json",label:"Doctor fix result",required:false},{relativePath:".rapidkit/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".rapidkit/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".rapidkit/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".rapidkit/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".rapidkit/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false},{relativePath:".rapidkit/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".rapidkit/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".rapidkit/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".rapidkit/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".rapidkit/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function k(e){return `npx rapidkit ${e}`.trim()}function be(e){return e&&typeof e=="object"?e:null}function Z(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function De(e){let t=Z(e.blockers,12);if(t.length>0)return t;let r=Z(e.blockingReasons,12);if(r.length>0)return r;let i=be(e.summary);return i&&Array.isArray(i.blockingReasons)?Z(i.blockingReasons,12):[]}function Ge(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function Ke(e,t,r){if(!e)return true;let i=Date.parse(e);return Number.isFinite(i)?r.getTime()-i>t*60*60*1e3:true}function Le(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function w(e,t){return e.has("all")||e.has(t)}function Me(e){return w(e,"copilot")||w(e,"vscode")}function qe(e){return e??"enterprise"}function $e(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":e.startsWith(".rapidkit/skills/")&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e.endsWith("rapidkit-agent-hooks.json")?"hook":e.includes("mcp")||e.endsWith("rapidkit-mcp-design.json")?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function He(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Ve(e,t){return fe().presets[t].requiredOutputs.includes(e)}function ze(e){return e.schemaVersion===j$1&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function Fe(e,t){if(t)return t;let r=s.join(e,k$1);if(await g.pathExists(r))try{let i=await g.readJson(r);if(ze(i))return i}catch{}return n({workspacePath:e,includeEvidence:true})}function Ue(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Xe(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(i=>i.targets.includes(r)).map(i=>i.path).sort()}]))}async function Be(e){try{if(!await g.pathExists(e))return null;let t=await g.readJson(e);return be(t)}catch{return null}}async function we(e){let t=e.now??new Date,r=e.staleAfterHours??24,i=[],o=[];for(let c of O){let n=s.join(e.workspacePath,c.relativePath),m=await Be(n),j=m!==null;j&&m&&o.push(...De(m)),i.push({path:c.relativePath,label:c.label,required:c.required,exists:j,generatedAt:m?Ge(m):void 0,commandId:typeof m?.commandId=="string"?m.commandId:void 0,exitCode:typeof m?.exitCode=="number"?m.exitCode:void 0});}let p=[...new Set(o.map(c=>c.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:Ne,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:O.map(c=>c.relativePath),blockers:p,staleAfterHours:r,reports:i,refreshCommand:k("workspace agent-sync --write --refresh-context")}}function Ae(e){let t=["# RapidKit agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","","1. `.rapidkit/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.rapidkit/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",k("workspace agent-sync --write --refresh-context"),k("workspace context --for-agent --json --write"),k("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.rapidkit/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic RapidKit CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
|
|
8
|
+
`,"utf8"),r.push(o);}return r}var We="rapidkit-agent-customization-pack.v1";function fe(){return {schemaVersion:We,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md",".github/instructions/rapidkit-workspace.instructions.md",".github/prompts/rapidkit-diagnose.prompt.md",".github/skills/rapidkit-workspace-intelligence/SKILL.md",".github/agents/workspai-advisor.agent.md",".rapidkit/reports/rapidkit-mcp-design.json",b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[..._],requiredReports:O.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".rapidkit/reports/",`${a}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var Ne="rapidkit-agent-reports-index.v1",_e="rapidkit-agent-customization-pack.v1",J=".rapidkit/reports/INDEX.json",he=".rapidkit/AGENT-GROUNDING.md",G=".rapidkit/reports/agent-customization-pack.json",O=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:".rapidkit/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".rapidkit/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".rapidkit/reports/doctor-project-last-run.json",label:"Project doctor",required:false},{relativePath:".rapidkit/reports/doctor-remediation-plan-last-run.json",label:"Doctor remediation plan",required:false},{relativePath:".rapidkit/reports/artifact-remediation-plan-last-run.json",label:"Artifact remediation plan",required:false},{relativePath:".rapidkit/reports/doctor-fix-result-last-run.json",label:"Doctor fix result",required:false},{relativePath:".rapidkit/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".rapidkit/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".rapidkit/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".rapidkit/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".rapidkit/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false},{relativePath:".rapidkit/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".rapidkit/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".rapidkit/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".rapidkit/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".rapidkit/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function k(e){return `npx rapidkit ${e}`.trim()}function be(e){return e&&typeof e=="object"?e:null}function Z(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function De(e){let t=Z(e.blockers,12);if(t.length>0)return t;let r=Z(e.blockingReasons,12);if(r.length>0)return r;let i=be(e.summary);return i&&Array.isArray(i.blockingReasons)?Z(i.blockingReasons,12):[]}function Ge(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function Ke(e,t,r){if(!e)return true;let i=Date.parse(e);return Number.isFinite(i)?r.getTime()-i>t*60*60*1e3:true}function Le(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function w(e,t){return e.has("all")||e.has(t)}function Me(e){return w(e,"copilot")||w(e,"vscode")}function qe(e){return e??"enterprise"}function $e(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":e.startsWith(".rapidkit/skills/")&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e.endsWith("rapidkit-agent-hooks.json")?"hook":e.includes("mcp")||e.endsWith("rapidkit-mcp-design.json")?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function He(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Ve(e,t){return fe().presets[t].requiredOutputs.includes(e)}function ze(e){return e.schemaVersion===j$1&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function Fe(e,t){if(t)return t;let r=s.join(e,k$1);if(await g.pathExists(r))try{let i=await g.readJson(r);if(ze(i))return i}catch{}return n({workspacePath:e,includeEvidence:true})}function Ue(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Xe(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(i=>i.targets.includes(r)).map(i=>i.path).sort()}]))}async function Be(e){try{if(!await g.pathExists(e))return null;let t=await g.readJson(e);return be(t)}catch{return null}}async function we(e){let t=e.now??new Date,r=e.staleAfterHours??24,i=[],o=[];for(let c of O){let n=s.join(e.workspacePath,c.relativePath),m=await Be(n),j=m!==null;j&&m&&o.push(...De(m)),i.push({path:c.relativePath,label:c.label,required:c.required,exists:j,generatedAt:m?Ge(m):void 0,commandId:typeof m?.commandId=="string"?m.commandId:void 0,exitCode:typeof m?.exitCode=="number"?m.exitCode:void 0});}let p=[...new Set(o.map(c=>c.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:Ne,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:O.map(c=>c.relativePath),blockers:p,staleAfterHours:r,reports:i,refreshCommand:k("workspace agent-sync --write --refresh-context")}}function Ae(e){let t=["# RapidKit agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","","1. `.rapidkit/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.rapidkit/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",k("workspace agent-sync --write --refresh-context"),k("workspace context --for-agent --json --write"),k("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.rapidkit/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic RapidKit CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
|
|
9
9
|
`)}function Je(e){return ["# RapidKit agent grounding","",`Generated: ${e.generatedAt}`,"","This file is tool-agnostic. Synced agents should read it together with `.rapidkit/reports/INDEX.json`.","","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
|
|
10
10
|
`)}function Ze(){return ["# RapidKit workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed RapidKit section).","2. Read `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
11
11
|
`)}function Ye(){return ["## Claude Code","","- Load `.rapidkit/reports/INDEX.json` before diagnosing blockers.","- Use `.claude/rules/rapidkit-evidence.md` when editing files under `.rapidkit/`.","- Refresh grounding with `npx rapidkit workspace agent-sync --write`.",""].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-WHQWVQJH.js';import {a as a$2}from'./chunk-KMUWWZRT.js';import {a as a$1,e}from'./chunk-64RTZBHU.js';import l from'chalk';import Y from'fs';import y from'path';import {execa}from'execa';var Z="autopilot-release-last-run.json",ee="autopilot-release.json";function $(s){try{return JSON.parse(s)}catch{return null}}function ge(s){let t=y.resolve(s),o=a$2(t);if(!o)throw new Error("No RapidKit workspace found in current directory or parents");return o}async function b(s,t){let o=process.argv[1];if(!o)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let a=await execa(process.execPath,[o,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(a.exitCode??1),stdout:a.stdout,stderr:a.stderr,crashed:false}}catch(a){return {exitCode:1,stdout:"",stderr:a instanceof Error?a.message:String(a),crashed:true}}}function te(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function se(s){return s.summary.failed>0||s.gates.results.some(t=>t.status==="fail")?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function we(s){let t=s.filter(a=>a.status!=="skipped");if(t.length===0)return 100;let o=t.reduce((a,e)=>e.status==="pass"?a+1:e.status==="warn"?a+.6:a,0);return Math.round(o/t.length*100)}function he(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function U(s,t){await Y.promises.mkdir(y.dirname(s),{recursive:true}),await Y.promises.writeFile(s,`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,"utf-8");}async function je(s){let t=ge(s.workspacePath),o=s.mode,a$2=[],e$1=[],F,B,C,O,J,G=0,f=false,I=0,T=0,D=-1,N=-1,c="skipped",p="skipped",re=o==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(s.skipPipelineStages)a$2.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let r=Date.now(),i=await b([...re],t),m=Date.now()-r;if(c="pass",i.crashed)c="fail",f=true,e$1.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e$1.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e$1.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e$1.push("doctor workspace command failed");else {let d=$(i.stdout),j=d&&d.healthScore&&typeof d.healthScore=="object"?d.healthScore:{},k=Number(j.errors??0),E=Number(j.warnings??0);Number.isFinite(k)&&k>0?(c="fail",e$1.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(E)&&E>0&&(c="warn");}D=a$2.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,o==="enforce"&&c==="warn"&&e$1.push("doctor workspace reported warnings under enforce mode");let g=Date.now(),w=await b(["analyze","--json"],t),v=Date.now()-g;B=y.join(t,".rapidkit","reports","analyze-last-run.json");let n="pass";if(w.crashed)n="fail",f=true,e$1.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e$1.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let d=$(w.stdout),j=d&&d.summary&&typeof d.summary=="object"?d.summary:{},k=String(j.verdict??"ready");k==="blocked"?(n="fail",e$1.push("analyze reported blocked verdict")):k==="needs-attention"&&(n="warn");}a$2.push({name:"analyze",status:n,durationMs:v,summary:n==="pass"?"analyze passed":n==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),o==="enforce"&&n==="warn"&&e$1.push("analyze reported warnings under enforce mode");let P=Date.now(),h=await b(["readiness","--json"],t),R=Date.now()-P;if(p="fail",h.crashed)p="fail",f=true,e$1.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)p="fail",e$1.push("readiness command failed");else {let d=$(h.stdout),j=String(d?.overallStatus??"fail");if(p=te(j),typeof d?.evidencePath=="string"&&d.evidencePath.trim().length>0&&(F=d.evidencePath),p==="fail"){let k=Array.isArray(d?.blockingReasons)?d?.blockingReasons.filter(E=>typeof E=="string"):[];k.length>0?e$1.push(...k.map(E=>`readiness: ${E}`)):e$1.push("readiness overall status is fail");}}N=a$2.push({name:"readiness",status:p,durationMs:R,summary:`readiness overall status is ${p}`})-1,o==="enforce"&&p==="warn"&&e$1.push("readiness reported warnings under enforce mode");}let ae=Date.now(),M=await b(["doctor","workspace","--plan","--json"],t),oe=Date.now()-ae,S="warn";if(M.crashed)S="fail",f=true,e$1.push(`doctor remediation plan execution error: ${M.stderr||"unknown error"}`);else if(M.exitCode!==0)S="fail",e$1.push("doctor remediation plan command failed");else {let r=$(M.stdout),i=r&&r.remediationPlan&&typeof r.remediationPlan=="object"?r.remediationPlan:null,m=Number(i?.totalSteps??0),g=Number(i?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(T=g),Number.isFinite(m)&&m===0?S="pass":S="warn";}if(a$2.push({name:"remediation-plan",status:S,durationMs:oe,summary:S==="pass"?"no remediation steps required":"remediation steps available"}),o==="enforce"&&S==="warn"&&e$1.push("remediation plan has pending steps under enforce mode"),o==="safe-fix"){let r=Date.now(),i=await b(["doctor","workspace","--apply"],t),m=Date.now()-r,g=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)f=true,e$1.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e$1.push("doctor remediation apply failed");else {G=T>0?T:I>0?I:1;let w=await b(["doctor","workspace","--json"],t);if(w.crashed)c="fail",f=true,e$1.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e$1.push("post-apply doctor workspace command failed");else {let n=$(w.stdout),P=n&&n.healthScore&&typeof n.healthScore=="object"?n.healthScore:{},h=Number(P.errors??0),R=Number(P.warnings??0);Number.isFinite(h)&&h>0?(c="fail",e$1.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(R)&&R>0?c="warn":c="pass";}D>=0&&(a$2[D].status=c,a$2[D].summary=`doctor workspace post-apply status is ${c}`);let v=await b(["readiness","--json"],t);if(v.crashed)p="fail",f=true,e$1.push(`post-apply readiness execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)p="fail",e$1.push("post-apply readiness command failed");else {let n=$(v.stdout),P=String(n?.overallStatus??"fail");if(p=te(P),typeof n?.evidencePath=="string"&&n.evidencePath.trim().length>0&&(F=n.evidencePath),p==="fail"){let h=Array.isArray(n?.blockingReasons)?n?.blockingReasons.filter(R=>typeof R=="string"):[];h.length>0?e$1.push(...h.map(R=>`post-apply readiness: ${R}`)):e$1.push("post-apply readiness overall status is fail");}}N>=0&&(a$2[N].status=p,a$2[N].summary=`readiness post-apply overall status is ${p}`);}a$2.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else a$2.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ne=Date.now(),x="pass",A="workspace test/build completed for selected projects";try{let r=await a({workspacePath:t,stage:"test",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});C=y.join(t,".rapidkit","reports",a$1),await e(t,r),O=C;let i=se(r);if(i==="fail")x="fail",A="workspace test stage failed for selected projects",e$1.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",A="workspace test stage completed with warnings",o==="enforce"&&e$1.push("workspace run test reported warnings under enforce mode"));let m=await a({workspacePath:t,stage:"build",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});await e(t,m),J=C;let g=se(m);g==="fail"?(x="fail",A="workspace build stage failed for selected projects",e$1.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",A="workspace test/build completed with warnings",o==="enforce"&&e$1.push("workspace run test/build reported warnings under enforce mode"));}}catch(r){x="fail",A="workspace test/build orchestration failed",f=true,e$1.push(`workspace run orchestration error: ${r instanceof Error?r.message:String(r)}`);}let ie=Date.now()-ne;a$2.push({name:"workspace-run-test-build",status:x,durationMs:ie,summary:A});let z=a$2.filter(r=>r.status==="warn").length,le=a$2.filter(r=>r.status==="fail").length,L=o==="enforce"?a$2.some(r=>r.status==="warn"||r.status==="fail"):le>0,W=[...new Set(e$1)],ce=f||L?Math.max(1,W.length):0,de=we(a$2),pe=f||L?"blocked":z>0?"partial":"approved",ue=f?3:L?1:z>0?2:0,fe=he({mode:o,executionError:f,blockers:W,hasWarnings:z>0}),V=y.join(t,".rapidkit","reports"),H=y.join(V,Z),q=y.join(V,ee),u={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:t,mode:o,summary:{releaseScore:de,verdict:pe,blockers:ce,warnings:z,safeFixesApplied:G,manualActions:W.length,exitCode:ue},stages:a$2,blockingReasons:W,nextActions:fe,artifacts:{reportPath:H,aliasEvidencePath:q,analyzeEvidencePath:B,readinessEvidencePath:F,workspaceRunEvidencePath:C,workspaceRunTestPath:O,workspaceRunBuildPath:J},enterpriseControls:{jsonReady:true,evidencePath:`.rapidkit/reports/${Z}`,aliasEvidencePath:`.rapidkit/reports/${ee}`}};if(await U(H,u),await U(q,u),s.output&&await U(y.resolve(s.output),u),!s.json){console.log(l.bold.cyan(`
|
|
3
3
|
\u{1F680} RapidKit Autopilot Release
|
|
4
4
|
`)),console.log(l.bold(`Workspace: ${l.cyan(y.basename(t))}`)),console.log(l.gray(`Path: ${t}`)),console.log(l.white(`Mode: ${o}`)),console.log(l.white(`Verdict: ${u.summary.verdict==="approved"?l.green("approved"):u.summary.verdict==="partial"?l.yellow("partial"):l.red("blocked")}`)),console.log(l.white(`Release score: ${u.summary.releaseScore}`));for(let r of u.stages){let i=r.status==="pass"?l.green("PASS"):r.status==="warn"?l.yellow("WARN"):r.status==="skipped"?l.gray("SKIP"):l.red("FAIL");console.log(` - ${r.name}: ${i} ${r.summary} (${r.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(l.bold.red(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-LRF6PQOZ.js';import {a,b as b$1}from'./chunk-S5KTATOU.js';function f(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,b(n));return s}function j(r){let s=f(r),n=r.graph??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n),o=new Map;for(let t of n.nodes){let e=s.get(t.id)??b({missing:t.id}),g=[...b$1(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,l)=>c.localeCompare(l)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:b({own:e,dependencies:g})});}return o}function v(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function w(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{f as a,j as b,v as c,w as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b as b$2}from'./chunk-PYCJWW4B.js';import {b as b$1,c,d}from'./chunk-C4ASE2DV.js';import {m,f,c as c$1,n,e}from'./chunk-6UBWN4EE.js';import {c as c$2}from'./chunk-64RTZBHU.js';import {n as n$1,b as b$3}from'./chunk-TSUQQTHI.js';import {a as a$1}from'./chunk-3PTJID76.js';import u from'path';import y from'fs-extra';var K="rapidkit-blocker-resolution-v1";function J(e){let t=e.blockers.map(r=>r.trim()).filter(Boolean).slice(0,12),s=e.stderrTail?.trim().slice(-400)??"";return b$3({blockers:t,exitCode:e.exitCode??null,stderrTail:s})}function te(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function se(e){let t=te(e.reason),s=J({blockers:[e.reason]}),r=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",studioActionId:"run-analyze"}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:K,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:s,commandRetryHint:t==="artifact-missing"?"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:r,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function U(e){return Array.from(new Set(e.blockingReasons.map(s=>s.trim()).filter(Boolean))).slice(0,12).map((s,r)=>se({reason:s,blockerId:`blocker-${r+1}`,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}))}function re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function ne(e){return e.length===0||e.every(t=>re(t))}function G(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&ne(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function Be(e,t){let s=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${s} \u2014 add your first project to continue.`:`Workspace scaffold${s}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var X="workspace-verify.v1",I=".rapidkit/reports/workspace-verify-last-run.json";function ie(e,t){return u.isAbsolute(t)?t:u.join(e,t)}async function Y(e$1){let t=await y.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let s=t;if(s.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(s.schemaVersion)}`);return s}function oe(e){let t=new Set,s=[];for(let r of e){let n=`${r.scope}:${r.project??""}:${r.display}`;t.has(n)||(t.add(n),s.push(r));}return s}function ae(e,t){if(!e||e==="workspace")return true;let s=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===s}function ce(e,t){if(e.id==="workspace.doctor")return u.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return u.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return u.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return u.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return u.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return u.join(t,".rapidkit","reports","doctor-fix-result-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return u.join(t,".rapidkit","reports","workspace-run-last.json")}function b(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function le(e){let t=b(e.healthScore),s=typeof t?.errors=="number"?t.errors:0,r=typeof t?.percent=="number"?t.percent:void 0;return s>0?{status:"fail",message:`Doctor evidence reports ${s} error(s).`}:typeof r=="number"&&r<70?{status:"warn",message:`Doctor health score is ${r}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function de(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function ue(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function pe(e){let t=b(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let r=typeof t?.status=="string"?t.status:void 0;return r==="warn"||r==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function fe(e){let t=e.schemaVersion==="rapidkit-doctor-fix-result-v1"?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let s=t,r=Array.isArray(s.remainingBlockers)?s.remainingBlockers:[];if(r.length>0)return {status:"fail",message:`Doctor fix result reports ${r.length} remaining blocker(s).`};let n=Array.isArray(s.appliedFixes)?s.appliedFixes:[];return n.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${n.length} applied fix(es) with no remaining blockers.`}}async function ge(e,t){let s=u.join(e,".rapidkit","reports","doctor-remediation-plan-last-run.json");try{let r=b(await y.readJson(s));if(!r||(Array.isArray(r.steps)?r.steps:[]).length>0)return false;let i=typeof r.generatedAt=="string"?r.generatedAt:void 0;if(!i||!t)return true;let d=Date.parse(i),o=Date.parse(t);return !Number.isFinite(d)||!Number.isFinite(o)?true:d>=o}catch{return false}}function me(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function ke(e){let t=b(e.summary),s=typeof t?.verdict=="string"?t.verdict:void 0;return s==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:s==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:s==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function ye(e,t,s){let r=me(t),n=c$2(e,r??void 0);if(!n)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let i=n.stage;if(r&&i!==r)return {status:"missing",message:`Workspace run evidence is for stage "${i}", expected "${r}".`};let d=Array.isArray(n.projects)?n.projects:[],o=t.project?.toLowerCase();if(!o)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let a=d.find(f=>{let g=b(f);if(!g)return false;let c=typeof g.projectName=="string"?g.projectName.toLowerCase():"",l=["projectPath","relativePath","path"].map(p=>g[p]).filter(p=>typeof p=="string"&&p.trim().length>0).map(p=>p.replace(/\\/g,"/").toLowerCase());return c===o||l.some(p=>p.endsWith(`/${o}`)||p===o)});if(a){let f=v(n.generatedAt,s,`Workspace run evidence for ${t.project??t.id}`);if(f)return {status:"fail",message:f};let g=b(a),c=typeof g?.status=="string"?g.status:"unknown";return c==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:c==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:c==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${c} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function v(e,t,s){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${s} is stale: missing generatedAt timestamp (required after impact ${t}).`;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)?Number.isFinite(n)&&r<n?`${s} is stale: generated at ${e}, before impact ${t}.`:null:`${s} is stale: invalid generatedAt timestamp (required after impact ${t}).`}async function he(e,t,s,r){let n=ce(e,t),i=n?u.relative(t,n).split(u.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!s)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!n||!await y.pathExists(n))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let d=b(await y.readJson(n));if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let o;if(e.id==="workspace.doctor"){let a=v(d.generatedAt,r,"Doctor evidence");a?o={status:"fail",message:a}:o=le(d);}else if(e.id==="workspace.readiness"){let a=v(d.generatedAt,r,"Release readiness evidence");a?o={status:"fail",message:a}:o=de(d);}else if(e.id==="workspace.contract.verify"){let a=v(d.generatedAt,r,"Workspace contract verify evidence");a?o={status:"fail",message:a}:o=ue(d);}else if(e.id==="workspace.analyze"){let a=v(d.generatedAt,r,"Analyze evidence");a?o={status:"fail",message:a}:o=pe(d);}else if(e.id==="workspace.pipeline"){let a=v(d.generatedAt,r,"Pipeline evidence");a?o={status:"fail",message:a}:o=ke(d);}else if(e.id==="workspace.doctor-fix"){let a=d.schemaVersion==="rapidkit-doctor-fix-result-v1"?d:d.fixResult,f=b(a),g=typeof f?.generatedAt=="string"?f.generatedAt:void 0,c=v(g,r,"Doctor fix result");c?o={status:"fail",message:c}:await ge(t,g)?o={status:"skipped",message:"No current doctor remediation steps are pending."}:o=fe(d);}else if(e.id.startsWith("project."))o=ye(d,e,r);else {let a=v(d.generatedAt,r,"Evidence report");a?o={status:"fail",message:a}:o={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:o.status,required:e.required,evidencePath:i,message:o.message}}function ve(e,t={blockingReasons:[],needsAttention:false}){let s=e.filter(c=>c.status==="pass").length,r=e.filter(c=>c.status==="warn").length,n=e.filter(c=>c.status==="fail").length,i=e.filter(c=>c.status==="missing").length,d=e.filter(c=>c.status==="skipped").length,o=e.filter(c=>c.required&&(c.status==="fail"||c.status==="missing")).map(c=>`${c.id}: ${c.message}`),a=e.filter(c=>c.required&&c.status==="missing").length,f="ready",g=0;return o.length>0||t.blockingReasons.length>0?(f="blocked",g=2):(r>0||a>0||t.needsAttention)&&(f="needs-attention",g=1),{verdict:f,exitCode:g,stepsPassed:s,stepsWarn:r,stepsFailed:n,stepsMissing:i,stepsSkipped:d}}function be(e,t){let s=x(e.affectedProjects.map(l=>l.project?.name).filter(l=>typeof l=="string")),r=new Set(s.map(l=>l.toLowerCase())),n=x(e.transitiveImpact.map(l=>l.project?.name).filter(l=>typeof l=="string").filter(l=>!r.has(l.toLowerCase()))),i=new Map;for(let l of t){if(l.scope!=="project"||!l.project)continue;let p=l.project.toLowerCase(),h=i.get(p)??[];h.push(l),i.set(p,h);}let d=[],o=[],a=[],f=[],g=false,c=(l,p)=>{let h=i.get(l.toLowerCase())??[];if(h.length===0){a.push(l);return}let R=h.filter(m=>m.status==="fail"),C=h.filter(m=>m.status==="missing"),w=C.filter(m=>m.required),j=h.some(m=>m.status==="pass"||m.status==="warn");if(R.length>0){o.push(l),f.push(`graph.subgraph.${l}: ${p} has failed verification evidence (${R.map(m=>m.id).join(", ")}).`);return}if(w.length>0){o.push(l),f.push(`graph.subgraph.${l}: ${p} has missing required verification evidence (${w.map(m=>m.id).join(", ")}).`);return}if(C.length>0){o.push(l),g=true;return}if(j){d.push(l);return}a.push(l);};for(let l of s)c(l,"directly-changed");for(let l of n)c(l,"transitive dependent");return {subgraph:{totalProjects:s.length+n.length,directlyChanged:s,transitiveDependents:n,covered:x(d),uncovered:x(o),unverifiable:x(a)},blockingReasons:f,needsAttention:g}}function x(e){return [...new Set(e)].sort((t,s)=>t.localeCompare(s))}async function we(e$1){let t=u.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let i=ie(t,e$1.fromImpactPath);return {impact:await Y(i),fromImpactRef:u.relative(t,i).split(u.sep).join("/"),impactFromDisk:true}}let s=u.join(t,f);if(await y.pathExists(s))return {impact:await Y(s),fromImpactRef:f,impactFromDisk:true};let r=u.join(t,c$1);if(await y.pathExists(r))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1,impactFromDisk:false};let n$2=await n$1({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:n$2.workspace.name,profile:n$2.workspace.profile,type:n$2.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:n$2.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:n$2}},impactFromDisk:false}}function Re(e,t){if(t)return e.generatedAt}async function Je(e){let t=u.resolve(e.workspacePath),{impact:s,fromImpactRef:r,impactFromDisk:n}=await we(e),i=s.diff.currentModel,d$1=Re(s,n),o=oe([...m(),...s.verificationPlan]).filter(k=>ae(e.scope,k)),a$1=[];for(let k of o)a$1.push(await he(k,t,i.contracts.exists===true,d$1));let f=be(s,a$1),g=a(i.graph??{nodes:[],edges:[]}),c$1=b$1(i),l=await xe(t),p=c(c$1,l?.freshness?.projectHashes),h={verdict:p.verdict,baseline:p.baseline,changed:p.changed,added:p.added,removed:p.removed,projectHashes:d(c$1)},R=b$2(g),C=i.policies?.mode??"warn",w=await Ce(i,t),j=je(C,w),m$1=ve(a$1,{blockingReasons:[...f.blockingReasons,...R,...j.blockingReasons],needsAttention:f.needsAttention||j.needsAttention}),Q=a$1.filter(k=>k.status==="missing"&&k.evidencePath).map(k=>k.evidencePath),W=[...a$1.filter(k=>k.required&&(k.status==="fail"||k.status==="missing")).map(k=>`${k.id}: ${k.message}`),...f.blockingReasons,...R,...j.blockingReasons],Z=w.filter(k=>k.severity==="error").length,ee=i.summary?.projectCount??i.projects.length,$=G({projectCount:ee,verdict:m$1.verdict,exitCode:m$1.exitCode,blockingReasons:W,policyErrorCount:Z});m$1.verdict=$.verdict,m$1.exitCode=$.exitCode;let B=W.length>0?U({blockingReasons:W,verifyCommand:"npx rapidkit workspace verify --from-impact .rapidkit/reports/workspace-impact-last-run.json --json",verifyArtifact:I}):[];return {schemaVersion:X,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:r,scope:e.scope,impact:{changed:s.summary.changed,risk:s.summary.risk,affectedProjects:s.summary.affectedProjects,recommendedCommands:s.summary.recommendedCommands},summary:m$1,steps:a$1,missingEvidence:Q,blockingReasons:W,...B.length>0?{resolutionHints:B}:{},verificationPlan:o,affectedSubgraph:f.subgraph,graphIntegrity:g,freshness:h,policyMode:C,policyViolations:w}}async function Ce(e,t){let s=[];for(let n of e.validation?.issues??[])s.push({source:"model",severity:n.severity,code:n.code,message:n.message,target:n.target});let r=u.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");try{if(await y.pathExists(r)){let n=await y.readJson(r);if(Array.isArray(n.violations))for(let i of n.violations)typeof i=="string"&&i.trim().length>0&&s.push({source:"contract",severity:"error",code:"contract.violation",message:i});}}catch{}return s.sort((n,i)=>n.source!==i.source?n.source.localeCompare(i.source):n.code!==i.code?n.code.localeCompare(i.code):n.message.localeCompare(i.message))}function je(e,t){let s=t.filter(r=>r.severity==="error");return e==="enforce"&&s.length>0?{blockingReasons:s.map(r=>`policy.${r.code}: ${r.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:s.length>0}}async function xe(e){let t=u.join(e,I);try{if(!await y.pathExists(t))return null;let s=await y.readJson(t);return s&&s.schemaVersion===X?s:null}catch{return null}}async function Ue(e,t){let s=u.join(t,I);return await y.ensureDir(u.dirname(s)),await y.writeJson(s,a$1(e),{spaces:2}),s}function We(e,t){let s=t?.strict?"strict":"default",r=[];if(e.summary.verdict==="blocked")return r.push(...e.blockingReasons),r.length===0&&r.push("verify verdict is blocked."),{passed:false,mode:s,exitCode:2,reasons:r};if(s==="strict"){if(e.summary.verdict!=="ready"&&r.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let n=[...e.freshness.changed,...e.freshness.added].slice(0,5);r.push(`freshness is stale${n.length>0?`: ${n.join(", ")}`:""} (strict requires fresh).`);}if(r.length>0)return {passed:false,mode:s,exitCode:1,reasons:r}}return {passed:true,mode:s,exitCode:e.summary.exitCode===2?0:e.summary.exitCode,reasons:r}}function Ge(e,t){let s=We(e,t);return s.passed?e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode:s.exitCode}export{K as a,Be as b,X as c,I as d,be as e,Je as f,Ue as g,We as h,Ge as i};
|
|
1
|
+
import {a,b as b$2}from'./chunk-PYCJWW4B.js';import {b as b$1,c,d}from'./chunk-FI4VMG2I.js';import {m,f,c as c$1,n,e}from'./chunk-THSTNVE3.js';import {c as c$2}from'./chunk-64RTZBHU.js';import {n as n$1,b as b$3}from'./chunk-LRF6PQOZ.js';import {a as a$1}from'./chunk-3PTJID76.js';import u from'path';import y from'fs-extra';var K="rapidkit-blocker-resolution-v1";function J(e){let t=e.blockers.map(r=>r.trim()).filter(Boolean).slice(0,12),s=e.stderrTail?.trim().slice(-400)??"";return b$3({blockers:t,exitCode:e.exitCode??null,stderrTail:s})}function te(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function se(e){let t=te(e.reason),s=J({blockers:[e.reason]}),r=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",studioActionId:"run-analyze"}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:K,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:s,commandRetryHint:t==="artifact-missing"?"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:r,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function U(e){return Array.from(new Set(e.blockingReasons.map(s=>s.trim()).filter(Boolean))).slice(0,12).map((s,r)=>se({reason:s,blockerId:`blocker-${r+1}`,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}))}function re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function ne(e){return e.length===0||e.every(t=>re(t))}function G(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&ne(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function Be(e,t){let s=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${s} \u2014 add your first project to continue.`:`Workspace scaffold${s}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var X="workspace-verify.v1",I=".rapidkit/reports/workspace-verify-last-run.json";function ie(e,t){return u.isAbsolute(t)?t:u.join(e,t)}async function Y(e$1){let t=await y.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let s=t;if(s.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(s.schemaVersion)}`);return s}function oe(e){let t=new Set,s=[];for(let r of e){let n=`${r.scope}:${r.project??""}:${r.display}`;t.has(n)||(t.add(n),s.push(r));}return s}function ae(e,t){if(!e||e==="workspace")return true;let s=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===s}function ce(e,t){if(e.id==="workspace.doctor")return u.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return u.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return u.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return u.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return u.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return u.join(t,".rapidkit","reports","doctor-fix-result-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return u.join(t,".rapidkit","reports","workspace-run-last.json")}function b(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function le(e){let t=b(e.healthScore),s=typeof t?.errors=="number"?t.errors:0,r=typeof t?.percent=="number"?t.percent:void 0;return s>0?{status:"fail",message:`Doctor evidence reports ${s} error(s).`}:typeof r=="number"&&r<70?{status:"warn",message:`Doctor health score is ${r}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function de(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function ue(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function pe(e){let t=b(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let r=typeof t?.status=="string"?t.status:void 0;return r==="warn"||r==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function fe(e){let t=e.schemaVersion==="rapidkit-doctor-fix-result-v1"?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let s=t,r=Array.isArray(s.remainingBlockers)?s.remainingBlockers:[];if(r.length>0)return {status:"fail",message:`Doctor fix result reports ${r.length} remaining blocker(s).`};let n=Array.isArray(s.appliedFixes)?s.appliedFixes:[];return n.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${n.length} applied fix(es) with no remaining blockers.`}}async function ge(e,t){let s=u.join(e,".rapidkit","reports","doctor-remediation-plan-last-run.json");try{let r=b(await y.readJson(s));if(!r||(Array.isArray(r.steps)?r.steps:[]).length>0)return false;let i=typeof r.generatedAt=="string"?r.generatedAt:void 0;if(!i||!t)return true;let d=Date.parse(i),o=Date.parse(t);return !Number.isFinite(d)||!Number.isFinite(o)?true:d>=o}catch{return false}}function me(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function ke(e){let t=b(e.summary),s=typeof t?.verdict=="string"?t.verdict:void 0;return s==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:s==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:s==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function ye(e,t,s){let r=me(t),n=c$2(e,r??void 0);if(!n)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let i=n.stage;if(r&&i!==r)return {status:"missing",message:`Workspace run evidence is for stage "${i}", expected "${r}".`};let d=Array.isArray(n.projects)?n.projects:[],o=t.project?.toLowerCase();if(!o)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let a=d.find(f=>{let g=b(f);if(!g)return false;let c=typeof g.projectName=="string"?g.projectName.toLowerCase():"",l=["projectPath","relativePath","path"].map(p=>g[p]).filter(p=>typeof p=="string"&&p.trim().length>0).map(p=>p.replace(/\\/g,"/").toLowerCase());return c===o||l.some(p=>p.endsWith(`/${o}`)||p===o)});if(a){let f=v(n.generatedAt,s,`Workspace run evidence for ${t.project??t.id}`);if(f)return {status:"fail",message:f};let g=b(a),c=typeof g?.status=="string"?g.status:"unknown";return c==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:c==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:c==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${c} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function v(e,t,s){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${s} is stale: missing generatedAt timestamp (required after impact ${t}).`;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)?Number.isFinite(n)&&r<n?`${s} is stale: generated at ${e}, before impact ${t}.`:null:`${s} is stale: invalid generatedAt timestamp (required after impact ${t}).`}async function he(e,t,s,r){let n=ce(e,t),i=n?u.relative(t,n).split(u.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!s)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!n||!await y.pathExists(n))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let d=b(await y.readJson(n));if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let o;if(e.id==="workspace.doctor"){let a=v(d.generatedAt,r,"Doctor evidence");a?o={status:"fail",message:a}:o=le(d);}else if(e.id==="workspace.readiness"){let a=v(d.generatedAt,r,"Release readiness evidence");a?o={status:"fail",message:a}:o=de(d);}else if(e.id==="workspace.contract.verify"){let a=v(d.generatedAt,r,"Workspace contract verify evidence");a?o={status:"fail",message:a}:o=ue(d);}else if(e.id==="workspace.analyze"){let a=v(d.generatedAt,r,"Analyze evidence");a?o={status:"fail",message:a}:o=pe(d);}else if(e.id==="workspace.pipeline"){let a=v(d.generatedAt,r,"Pipeline evidence");a?o={status:"fail",message:a}:o=ke(d);}else if(e.id==="workspace.doctor-fix"){let a=d.schemaVersion==="rapidkit-doctor-fix-result-v1"?d:d.fixResult,f=b(a),g=typeof f?.generatedAt=="string"?f.generatedAt:void 0,c=v(g,r,"Doctor fix result");c?o={status:"fail",message:c}:await ge(t,g)?o={status:"skipped",message:"No current doctor remediation steps are pending."}:o=fe(d);}else if(e.id.startsWith("project."))o=ye(d,e,r);else {let a=v(d.generatedAt,r,"Evidence report");a?o={status:"fail",message:a}:o={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:o.status,required:e.required,evidencePath:i,message:o.message}}function ve(e,t={blockingReasons:[],needsAttention:false}){let s=e.filter(c=>c.status==="pass").length,r=e.filter(c=>c.status==="warn").length,n=e.filter(c=>c.status==="fail").length,i=e.filter(c=>c.status==="missing").length,d=e.filter(c=>c.status==="skipped").length,o=e.filter(c=>c.required&&(c.status==="fail"||c.status==="missing")).map(c=>`${c.id}: ${c.message}`),a=e.filter(c=>c.required&&c.status==="missing").length,f="ready",g=0;return o.length>0||t.blockingReasons.length>0?(f="blocked",g=2):(r>0||a>0||t.needsAttention)&&(f="needs-attention",g=1),{verdict:f,exitCode:g,stepsPassed:s,stepsWarn:r,stepsFailed:n,stepsMissing:i,stepsSkipped:d}}function be(e,t){let s=x(e.affectedProjects.map(l=>l.project?.name).filter(l=>typeof l=="string")),r=new Set(s.map(l=>l.toLowerCase())),n=x(e.transitiveImpact.map(l=>l.project?.name).filter(l=>typeof l=="string").filter(l=>!r.has(l.toLowerCase()))),i=new Map;for(let l of t){if(l.scope!=="project"||!l.project)continue;let p=l.project.toLowerCase(),h=i.get(p)??[];h.push(l),i.set(p,h);}let d=[],o=[],a=[],f=[],g=false,c=(l,p)=>{let h=i.get(l.toLowerCase())??[];if(h.length===0){a.push(l);return}let R=h.filter(m=>m.status==="fail"),C=h.filter(m=>m.status==="missing"),w=C.filter(m=>m.required),j=h.some(m=>m.status==="pass"||m.status==="warn");if(R.length>0){o.push(l),f.push(`graph.subgraph.${l}: ${p} has failed verification evidence (${R.map(m=>m.id).join(", ")}).`);return}if(w.length>0){o.push(l),f.push(`graph.subgraph.${l}: ${p} has missing required verification evidence (${w.map(m=>m.id).join(", ")}).`);return}if(C.length>0){o.push(l),g=true;return}if(j){d.push(l);return}a.push(l);};for(let l of s)c(l,"directly-changed");for(let l of n)c(l,"transitive dependent");return {subgraph:{totalProjects:s.length+n.length,directlyChanged:s,transitiveDependents:n,covered:x(d),uncovered:x(o),unverifiable:x(a)},blockingReasons:f,needsAttention:g}}function x(e){return [...new Set(e)].sort((t,s)=>t.localeCompare(s))}async function we(e$1){let t=u.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let i=ie(t,e$1.fromImpactPath);return {impact:await Y(i),fromImpactRef:u.relative(t,i).split(u.sep).join("/"),impactFromDisk:true}}let s=u.join(t,f);if(await y.pathExists(s))return {impact:await Y(s),fromImpactRef:f,impactFromDisk:true};let r=u.join(t,c$1);if(await y.pathExists(r))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1,impactFromDisk:false};let n$2=await n$1({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:n$2.workspace.name,profile:n$2.workspace.profile,type:n$2.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:n$2.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:n$2}},impactFromDisk:false}}function Re(e,t){if(t)return e.generatedAt}async function Je(e){let t=u.resolve(e.workspacePath),{impact:s,fromImpactRef:r,impactFromDisk:n}=await we(e),i=s.diff.currentModel,d$1=Re(s,n),o=oe([...m(),...s.verificationPlan]).filter(k=>ae(e.scope,k)),a$1=[];for(let k of o)a$1.push(await he(k,t,i.contracts.exists===true,d$1));let f=be(s,a$1),g=a(i.graph??{nodes:[],edges:[]}),c$1=b$1(i),l=await xe(t),p=c(c$1,l?.freshness?.projectHashes),h={verdict:p.verdict,baseline:p.baseline,changed:p.changed,added:p.added,removed:p.removed,projectHashes:d(c$1)},R=b$2(g),C=i.policies?.mode??"warn",w=await Ce(i,t),j=je(C,w),m$1=ve(a$1,{blockingReasons:[...f.blockingReasons,...R,...j.blockingReasons],needsAttention:f.needsAttention||j.needsAttention}),Q=a$1.filter(k=>k.status==="missing"&&k.evidencePath).map(k=>k.evidencePath),W=[...a$1.filter(k=>k.required&&(k.status==="fail"||k.status==="missing")).map(k=>`${k.id}: ${k.message}`),...f.blockingReasons,...R,...j.blockingReasons],Z=w.filter(k=>k.severity==="error").length,ee=i.summary?.projectCount??i.projects.length,$=G({projectCount:ee,verdict:m$1.verdict,exitCode:m$1.exitCode,blockingReasons:W,policyErrorCount:Z});m$1.verdict=$.verdict,m$1.exitCode=$.exitCode;let B=W.length>0?U({blockingReasons:W,verifyCommand:"npx rapidkit workspace verify --from-impact .rapidkit/reports/workspace-impact-last-run.json --json",verifyArtifact:I}):[];return {schemaVersion:X,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:r,scope:e.scope,impact:{changed:s.summary.changed,risk:s.summary.risk,affectedProjects:s.summary.affectedProjects,recommendedCommands:s.summary.recommendedCommands},summary:m$1,steps:a$1,missingEvidence:Q,blockingReasons:W,...B.length>0?{resolutionHints:B}:{},verificationPlan:o,affectedSubgraph:f.subgraph,graphIntegrity:g,freshness:h,policyMode:C,policyViolations:w}}async function Ce(e,t){let s=[];for(let n of e.validation?.issues??[])s.push({source:"model",severity:n.severity,code:n.code,message:n.message,target:n.target});let r=u.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");try{if(await y.pathExists(r)){let n=await y.readJson(r);if(Array.isArray(n.violations))for(let i of n.violations)typeof i=="string"&&i.trim().length>0&&s.push({source:"contract",severity:"error",code:"contract.violation",message:i});}}catch{}return s.sort((n,i)=>n.source!==i.source?n.source.localeCompare(i.source):n.code!==i.code?n.code.localeCompare(i.code):n.message.localeCompare(i.message))}function je(e,t){let s=t.filter(r=>r.severity==="error");return e==="enforce"&&s.length>0?{blockingReasons:s.map(r=>`policy.${r.code}: ${r.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:s.length>0}}async function xe(e){let t=u.join(e,I);try{if(!await y.pathExists(t))return null;let s=await y.readJson(t);return s&&s.schemaVersion===X?s:null}catch{return null}}async function Ue(e,t){let s=u.join(t,I);return await y.ensureDir(u.dirname(s)),await y.writeJson(s,a$1(e),{spaces:2}),s}function We(e,t){let s=t?.strict?"strict":"default",r=[];if(e.summary.verdict==="blocked")return r.push(...e.blockingReasons),r.length===0&&r.push("verify verdict is blocked."),{passed:false,mode:s,exitCode:2,reasons:r};if(s==="strict"){if(e.summary.verdict!=="ready"&&r.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let n=[...e.freshness.changed,...e.freshness.added].slice(0,5);r.push(`freshness is stale${n.length>0?`: ${n.join(", ")}`:""} (strict requires fresh).`);}if(r.length>0)return {passed:false,mode:s,exitCode:1,reasons:r}}return {passed:true,mode:s,exitCode:e.summary.exitCode===2?0:e.summary.exitCode,reasons:r}}function Ge(e,t){let s=We(e,t);return s.passed?e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode:s.exitCode}export{K as a,Be as b,X as c,I as d,be as e,Je as f,Ue as g,We as h,Ge as i};
|