workspai 0.43.1 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -10
- package/contracts/agent-customization-pack.v1.json +1 -1
- package/contracts/autopilot-release.v1.json +204 -0
- package/contracts/cli-operation-result.v1.json +119 -0
- package/contracts/command-capabilities.v1.json +138 -0
- package/contracts/compatibility-matrix.v1.json +37 -0
- package/contracts/create-planner-capabilities.v1.json +156 -65
- package/contracts/doctor-project-scan.v2.json +60 -0
- package/contracts/doctor-remediation-plan.v1.json +19 -4
- package/contracts/doctor-remediation-plan.v2.json +7 -0
- package/contracts/doctor-workspace-cache.v2.json +82 -0
- package/contracts/extension-cli-compatibility.v1.json +47 -3
- package/contracts/infra-plan.v1.json +189 -0
- package/contracts/private-product-manifest.v1.json +155 -0
- package/contracts/product-factory-plan.v1.json +200 -0
- package/contracts/project-archive.v1.json +40 -0
- package/contracts/project-entry-capability.v1.json +127 -0
- package/contracts/published-contract-catalog.v1.json +334 -0
- package/contracts/runtime-command-surface.v1.json +239 -10
- package/contracts/version.v1.json +48 -0
- package/contracts/workspace-archive-capabilities.v1.json +90 -0
- package/contracts/workspace-archive-manifest.v1.json +107 -0
- package/contracts/workspace-archive-operation-result.v1.json +565 -0
- package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
- package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
- package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
- package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
- package/contracts/workspace-intelligence-architecture.v1.json +723 -0
- package/contracts/workspace-intelligence-chain.v1.json +1194 -0
- package/contracts/workspace-list.v1.json +56 -0
- package/contracts/workspace-model-cache.v1.json +55 -0
- package/contracts/workspace-snapshot.v1.json +58 -0
- package/contracts/workspace-snapshot.v2.json +97 -0
- package/contracts/workspace-sync.v1.json +30 -0
- package/contracts/workspace-watch-event.v1.json +112 -0
- package/dist/analyze-6OCBM4ID.js +1 -0
- package/dist/{artifact-remediation-plan-244S5K6I.js → artifact-remediation-plan-Z7OCSME3.js} +2 -2
- package/dist/autopilot-release-LI2WJCEW.js +1 -0
- package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
- package/dist/chunk-2QN6BMM7.js +2 -0
- package/dist/chunk-2QOWRBQD.js +1 -0
- package/dist/chunk-5AKYMAIL.js +1 -0
- package/dist/{chunk-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
- package/dist/{chunk-DOCPUNWS.js → chunk-7EIMPQR3.js} +1 -1
- package/dist/{chunk-U6AXYUQY.js → chunk-7IHLTPZ6.js} +1 -1
- package/dist/chunk-7RIWU5TZ.js +1 -0
- package/dist/chunk-B66A4TVP.js +1 -0
- package/dist/chunk-CL6TGI4Q.js +8 -0
- package/dist/chunk-FWJV7CCI.js +2 -0
- package/dist/chunk-J4AICQFB.js +1 -0
- package/dist/chunk-JICOD2GI.js +1 -0
- package/dist/{chunk-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
- package/dist/chunk-L2Q7B2OJ.js +1 -0
- package/dist/chunk-L3E6IRUQ.js +8 -0
- package/dist/chunk-LG6RFLPZ.js +1 -0
- package/dist/chunk-LGP6WXS2.js +4 -0
- package/dist/{chunk-ONU457VN.js → chunk-M4VITK6X.js} +52 -50
- package/dist/chunk-NTXO7BMH.js +4 -0
- package/dist/{chunk-PPHTYJ7G.js → chunk-OW4UNG27.js} +36 -37
- package/dist/chunk-P4SWTY5X.js +33 -0
- package/dist/chunk-TRMDODFM.js +13 -0
- package/dist/chunk-UNF72FTB.js +1 -0
- package/dist/chunk-V5JN4TDX.js +2 -0
- package/dist/chunk-VA5MRHKM.js +2 -0
- package/dist/chunk-XIVFLY6G.js +1 -0
- package/dist/chunk-YUX4YFGL.js +78 -0
- package/dist/{create-42RTNLH2.js → create-DFAWAS5C.js} +1 -1
- package/dist/doctor-PVSWDBJL.js +1 -0
- package/dist/index.d.ts +250 -24
- package/dist/index.js +194 -195
- package/dist/pipeline-ND734AJM.js +5 -0
- package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
- package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
- package/dist/{workspace-DZHWB7BV.js → workspace-FQT3QIRS.js} +1 -1
- package/dist/workspace-agent-sync-ZYCPXTU3.js +1 -0
- package/dist/workspace-archive-EEGLHZDW.js +10 -0
- package/dist/workspace-context-WAGGJCDL.js +1 -0
- package/dist/{workspace-contract-2TA27LGT.js → workspace-contract-SEI4SNSG.js} +1 -1
- package/dist/workspace-explain-MVGGRCDN.js +1 -0
- package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
- package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-RCB25NFO.js} +1 -1
- package/dist/{workspace-foundation-FQWHPQGX.js → workspace-foundation-KXDL6P6X.js} +1 -1
- package/dist/{workspace-history-CGCK2DJI.js → workspace-history-M4QQBIPB.js} +1 -1
- package/dist/workspace-intelligence-QOGD2TZS.js +1 -0
- package/dist/workspace-mcp-serve-CEFKEMYG.js +3 -0
- package/dist/{workspace-model-F3B75TYT.js → workspace-model-GMSRBICO.js} +1 -1
- package/dist/workspace-registry-summary-S52SEJAG.js +1 -0
- package/dist/workspace-run-VC4OUPRF.js +1 -0
- package/dist/{workspace-verify-OAATQV5T.js → workspace-verify-NP4GMFSV.js} +1 -1
- package/dist/workspace-watch-IIBH3Y25.js +1 -0
- package/docs/AI_FEATURES.md +67 -34
- package/docs/README.md +2 -1
- package/docs/commands-reference.md +26 -14
- package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
- package/docs/contracts/README.md +3 -2
- package/docs/create-planner-capabilities.md +36 -18
- package/docs/workspace-operations.md +25 -0
- package/package.json +26 -14
- package/scripts/enterprise-package-smoke.mjs +40 -8
- package/scripts/prepack-enterprise.mjs +8 -0
- package/dist/analyze-5BU4QIPK.js +0 -1
- package/dist/autopilot-release-45YVOBQO.js +0 -1
- package/dist/chunk-3QVTWKUI.js +0 -4
- package/dist/chunk-753LOKFZ.js +0 -2
- package/dist/chunk-AMDKXXLP.js +0 -1
- package/dist/chunk-AQ4XZZC6.js +0 -1
- package/dist/chunk-CDE4Q77U.js +0 -2
- package/dist/chunk-DNAY5ALC.js +0 -1
- package/dist/chunk-FHSMY75W.js +0 -1
- package/dist/chunk-FM7GMFZA.js +0 -2
- package/dist/chunk-HV5ZFXAZ.js +0 -13
- package/dist/chunk-LRW2SAGL.js +0 -4
- package/dist/chunk-LTWYYP6E.js +0 -7
- package/dist/chunk-NAAQMSO3.js +0 -1
- package/dist/chunk-NFUXULIF.js +0 -1
- package/dist/chunk-OL64GWQC.js +0 -9
- package/dist/chunk-SI3AQKIP.js +0 -1
- package/dist/chunk-TH5Y3EMA.js +0 -33
- package/dist/chunk-UQKCCWUL.js +0 -78
- package/dist/chunk-XNGANEXM.js +0 -2
- package/dist/doctor-DK4BON3N.js +0 -1
- package/dist/pipeline-HQ57V6OZ.js +0 -5
- package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
- package/dist/workspace-archive-GCZNI44O.js +0 -3
- package/dist/workspace-context-GEXDHA7A.js +0 -1
- package/dist/workspace-explain-D5NNL3NG.js +0 -1
- package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
- package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
- package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
- package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
- package/dist/workspace-run-3WJXIQKR.js +0 -1
- package/dist/workspace-watch-HU2OTQ52.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {n,d as d$1,e}from'./chunk-JICOD2GI.js';import {a as a$1}from'./chunk-2QN6BMM7.js';import {g}from'./chunk-FWJV7CCI.js';import {b,a,f,c}from'./chunk-5AKYMAIL.js';import $ from'path';var M="workspai-workspace-intelligence-chain-v1",L="contracts/workspace-intelligence-chain.v1.json";function j(){let e=a,t=f,n=[{id:"model",ordinal:1,phase:"understand",label:"Model",command:[...t.model.command],consumes:["workspace markers","project metadata","registry","contract","policies"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules","existing-evidence"],consumesArtifacts:[],produces:[...t.model.produces],dependsOn:[],exitPolicy:"stop-on-error",purpose:"Build the canonical current model of the software system."},{id:"diff",ordinal:2,phase:"change",label:"Diff",command:[...t.diff.command],consumes:[e.model,e.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e.model,e.snapshot],produces:[...t.diff.produces],dependsOn:["model"],exitPolicy:"stop-on-error",purpose:"Describe structural change against the selected baseline."},{id:"impact",ordinal:3,phase:"change",label:"Impact",command:[...t.impact.command],consumes:[e.model,e.diff],inputRefs:[],consumesArtifacts:[e.model,e.diff],produces:[...t.impact.produces],dependsOn:["diff"],exitPolicy:"stop-on-error",purpose:"Calculate transitive blast radius over the workspace graph."},{id:"doctor-evidence",ordinal:4,phase:"evidence",label:"Doctor Evidence",command:[...t["doctor-evidence"].command],consumes:["workspace runtime and project health signals"],inputRefs:["projects-repositories","runtime-dependencies","existing-evidence"],consumesArtifacts:[],produces:[...t["doctor-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh health evidence after the impact artifact exists."},{id:"contract-evidence",ordinal:5,phase:"evidence",label:"Contract Evidence",command:[...t["contract-evidence"].command],consumes:[".workspai/workspace.contract.json"],inputRefs:["workspace-rules"],consumesArtifacts:[],produces:[...t["contract-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh structural contract evidence without hiding failed verdicts."},{id:"analyze-evidence",ordinal:6,phase:"evidence",label:"Analyze Evidence",command:[...t["analyze-evidence"].command],consumes:[e.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e.model],produces:[...t["analyze-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh analysis evidence required by the release-readiness gate."},{id:"readiness-evidence",ordinal:7,phase:"evidence",label:"Readiness Evidence",command:[...t["readiness-evidence"].command],consumes:["doctor, analysis, runtime, and release signals"],inputRefs:["runtime-dependencies","existing-evidence"],consumesArtifacts:[e.doctor,e.contractVerify,e.analyze],produces:[...t["readiness-evidence"].produces],dependsOn:["doctor-evidence","contract-evidence","analyze-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh release-readiness evidence before the definitive gate."},{id:"verify",ordinal:8,phase:"gate",label:"Verify",command:[...t.verify.command],consumes:[e.impact,e.doctor,e.contractVerify,e.readiness],inputRefs:[],consumesArtifacts:[e.impact,e.doctor,e.contractVerify,e.readiness],produces:[...t.verify.produces],dependsOn:["impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Emit the definitive evidence-backed workspace gate."},{id:"context",ordinal:9,phase:"ground",label:"Agent Context",command:[...t.context.command],consumes:[e.model,e.impact,e.verify],inputRefs:[],consumesArtifacts:[e.model,e.impact,e.verify],produces:[...t.context.produces],dependsOn:["verify"],exitPolicy:"stop-on-error",purpose:"Build compact agent context from the same verified evidence."},{id:"agent-sync",ordinal:10,phase:"distribute",label:"Agent Grounding",command:[...t["agent-sync"].command],consumerArgs:{vscode:["--target","vscode"]},consumes:[e.agentContext],inputRefs:[],consumesArtifacts:[e.agentContext],produces:[...t["agent-sync"].produces],dependsOn:["context"],exitPolicy:"stop-on-error",purpose:"Distribute one context into portable agent and IDE surfaces."},{id:"explain",ordinal:11,phase:"explain",label:"Explain",command:[...t.explain.command],consumes:[e.verify,e.impact],inputRefs:[],consumesArtifacts:[e.verify,e.impact],produces:[...t.explain.produces],dependsOn:["verify"],exitPolicy:"continue-on-structured-verdict",purpose:"Translate evidence and blockers into a human and agent-readable narrative."}];return {schemaVersion:M,name:"Workspace Intelligence Chain",contractPath:L,invariant:"Every consumer must preserve step identity, dependencies, artifact flow, and verdict semantics; presentation may change, chain meaning may not.",invariants:["Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.","Freshness and provenance travel with evidence and must not be discarded by projections.","The current graph is a workspace dependency graph, not a complete cross-language symbol or call graph.","Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.","Conditional provider outputs must be resolved through their dedicated inventory contract.","Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.","Canonical step commands are stage-pure: they must not implicitly execute a downstream chain step or regenerate an upstream artifact.","Canonical JSON artifacts must satisfy their registered schema both when produced and when consumed across CLI, MCP, IDE, and CI trust boundaries.","Schema validity is necessary but not sufficient: hashes, embedded models, summaries, counts, graph statistics, and artifact references must remain semantically coherent.","Persisted impact evidence must be rejected as stale when the current workspace model or Git observation no longer matches its embedded diff.","Canonical artifact replacement must be atomic and workspace-contained; an interrupted or denied write must preserve the last valid artifact.","Concurrent history updates must be serialized without silently dropping entries, and invalid history must never be overwritten as if it were absent.","The canonical global registry is ~/.workspai/workspaces.json; ~/.rapidkit/workspaces.json is a non-authoritative compatibility mirror for legacy consumers and must not diverge after a CLI registry mutation."],semantics:{workspace:"The governed operating boundary that relates one or more projects and repositories to shared metadata, policies, contracts, evidence, and consumers.",repository:"A source-control boundary that may contain one or more projects and may live inside or outside the workspace root.",project:"A discoverable build or runtime unit with its own path, metadata or observable manifests, command capabilities, and evidence.",evidence:"A sourced observation or generated verification result with provenance and freshness; evidence may be consumed by a later run.",artifact:"A durable generated file that another command or consumer can read without parsing terminal prose.",gate:"A structured verdict with reasons and exit semantics derived from current evidence."},workspaceLifecycle:{ingestionRoutes:[{id:"create",label:"Create",commands:["create workspace","create project"],result:"Create a workspace or supported project and write canonical Workspai metadata."},{id:"adopt",label:"Adopt",commands:["adopt"],result:"Register an existing project in place without requiring source relocation."},{id:"import",label:"Import",commands:["import","workspace import"],result:"Attach an existing project or repository path to the workspace inventory."}],durableState:[{id:"workspace-identity",paths:[".workspai-workspace",".workspai/workspace.json"],purpose:"Identify the workspace boundary, profile, and canonical root."},{id:"project-inventory",paths:[".workspai/project.json",".workspai/context.json",".workspai/adopt.json","~/.workspai/workspaces.json","~/.rapidkit/workspaces.json (legacy compatibility mirror)"],purpose:"Record native, adopted, imported, and globally registered project locations while preserving a non-authoritative mirror for legacy extension discovery."},{id:"governance",paths:[".workspai/policies.yml",".workspai/workspace.contract.json"],purpose:"Define workspace policy and explicit structural relationships."},{id:"graph-overrides",paths:[".workspai/workspace-graph.overrides.json"],purpose:"Provide explicit dependency edges that override inferred relationships."}],rule:"Create, adopt, and import are ingestion routes, not intelligence facts. Their durable state becomes observable input to Model."},runtimeRegistry:{authority:"contracts/workspace-intelligence-runtime-registry.ts",artifacts:Object.entries(a).map(([r,a])=>({id:r,path:a,schemaVersion:b[r],schemaContract:c[r]}))},boundaries:{inputs:[{id:"projects-repositories",label:"Projects and repositories",sources:["projects","repositories","services","modules","imported paths"],entersAt:"model"},{id:"runtime-dependencies",label:"Runtime and dependencies",sources:["runtime manifests","lockfiles","scripts","framework markers","package dependencies","supported source imports (currently bounded JavaScript and TypeScript scanning)"],entersAt:"model"},{id:"workspace-rules",label:"Workspace rules",sources:["workspace markers","registry","project metadata","contracts","policies","ownership","graph overrides"],entersAt:"model"},{id:"changes",label:"Changes",sources:["repository state","git state","model baseline","workspace diff"],entersAt:"diff"},{id:"model-baseline",label:"Explicit model baseline",sources:[e.snapshot],entersAt:"diff"},{id:"existing-evidence",label:"Existing evidence",sources:["doctor reports","analysis reports","contract verification","release readiness","pipeline results","tests and runtime evidence","previous intelligence artifacts"],entersAt:"doctor-evidence"}],outputs:[{id:"understanding",label:"System understanding",artifacts:[e.model,e.diff,e.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e.doctor,e.contractVerify,e.analyze,e.readiness,e.verify,e.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e.agentContext,e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e.explain],producedBy:["explain"],inventory:"complete-for-chain"}],consumers:[{id:"developers",label:"Developers",channels:["CLI","reports","AGENTS.md"]},{id:"ci",label:"CI",channels:["JSON artifacts","exit codes","release gates"]},{id:"ides",label:"IDEs",channels:["synced contracts","extension","agent context"]},{id:"ai-agents",label:"AI agents",channels:["INDEX.json","context","skills","MCP"]}]},deliveryChannels:[{id:"artifacts",carries:["reports","models","context","grounding","skills"],authority:"canonical"},{id:"json-stdout",carries:["structured command results"],authority:"projection"},{id:"human-cli",carries:["summaries","diagnostics","next actions"],authority:"projection"},{id:"exit-codes",carries:["gate and command status"],authority:"projection"},{id:"watch-events",carries:["incremental workspace change events"],authority:"projection"},{id:"mcp",carries:["read-mostly access to current workspace artifacts"],authority:"projection"}],feedback:{from:["developers","ci","ides","ai-agents"],signals:["source commits","dependency updates","policy and contract edits","repairs","test and runtime results","agent action outcomes"],reentersThrough:["projects-repositories","runtime-dependencies","workspace-rules","changes","existing-evidence"],rule:"Consumer actions are not silently treated as truth. They re-enter as observable changes or evidence and must be modeled and verified again."},auxiliaryCapabilities:[{id:"graph",commands:["workspace graph emit","workspace graph explain","workspace graph dot","workspace graph mermaid"],reads:[`${e.model}#graph`],role:"Inspect or render the graph already embedded in the workspace model.",chainStep:false},{id:"watch",commands:["workspace watch"],reads:["workspace inputs",e.model],role:"Refresh the model incrementally and emit deterministic change events.",chainStep:false},{id:"mcp",commands:["workspace mcp serve"],reads:["workspace evidence artifacts"],role:"Expose read-mostly workspace evidence to compatible clients.",chainStep:false}],presentations:{simple:{layers:["inputs","intelligence","outputs","consumers"],nodes:[{id:"input-layer",kind:"inputs",label:"Input Layer",summary:"Projects \xB7 Repositories \xB7 Dependencies \xB7 Changes",contractRefs:["projects-repositories","runtime-dependencies","workspace-rules","changes","model-baseline","existing-evidence"]},{id:"workspace-intelligence",kind:"intelligence",label:"Workspace Intelligence",summary:"Model \xB7 Graph \xB7 Impact \xB7 Verify",contractRefs:n.map(r=>r.id)},{id:"agent-grounding",kind:"outputs",label:"Agent Grounding",summary:"AGENTS.md \xB7 Skills \xB7 Context",contractRefs:["agent-grounding"]},{id:"evidence-and-decisions",kind:"outputs",label:"Evidence Contracts",summary:"Reports \xB7 Artifacts \xB7 Gates",contractRefs:["understanding","governance-evidence","explanations"]},{id:"shared-consumers",kind:"consumers",label:"Shared Consumers",summary:"Developers \xB7 CI \xB7 IDEs \xB7 AI agents",contractRefs:["developers","ci","ides","ai-agents"]}],rule:"Use concrete user-facing language for first-contact explanations. Every input, output, consumer, and chain step must remain traceable through contractRefs even when details are summarized."},standard:{phases:["understand","change","evidence","gate","ground","distribute","explain"],nodes:[{id:"understand",label:"Understand",question:"What exists in the current workspace?",stepRefs:["model"]},{id:"change",label:"Change",question:"What changed, and what can it affect?",stepRefs:["diff","impact"]},{id:"evidence",label:"Evidence",question:"What health, contract, and readiness facts were observed?",stepRefs:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"]},{id:"gate",label:"Gate",question:"Is the current state acceptable and trustworthy?",stepRefs:["verify"]},{id:"ground",label:"Ground",question:"What should an agent know before acting?",stepRefs:["context"]},{id:"distribute",label:"Distribute",question:"Which durable agent and IDE surfaces receive that context?",stepRefs:["agent-sync"]},{id:"explain",label:"Explain",question:"Why did the system reach this result or verdict?",stepRefs:["explain"]}],rule:"Use for architecture education and product surfaces. Every phase must appear once and in order."},advanced:{steps:n.map(r=>r.id),requiredFields:["command","inputRefs","consumesArtifacts","produces","dependsOn","exitPolicy","purpose"],rule:"Use for implementers, adapters, IDEs, and CI. Preserve every step and its artifact and verdict semantics."}},steps:n,diagram:{direction:"TB",nodes:n.map(({id:r,label:a,phase:o})=>({id:r,label:a,phase:o})),edges:n.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e.agentIndex,e.agentContext,e.verify,e.impact,e.explain,e.model,e.agentCustomizationPack,e.skillsIndex],entrypoints:[e.agents,".workspai/AGENT-GROUNDING.md"],rule:"Agents must cite current artifacts, preserve verified versus inferred status, and re-run the producing step when evidence is missing or stale."},ideAndCi:{requiredArtifacts:[e.model,e.impact,e.verify],rule:"IDEs and CI must consume structured artifacts and verdict exit semantics rather than parse human help or terminal prose."},docsAndDiagrams:{rule:"Documentation and diagrams must derive labels, ordering, and edges from this contract and must not invent implemented steps."}}}}var F=b.agentContext,D=a.agentContext;function G(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function R(e){return `npx --yes --package workspai workspai ${e}`.trim()}function S(e){return `npx workspai ${e}`.trim()}function d(e){return {id:e.id,scope:e.scope,display:S(e.args),execute:R(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:d$1({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:S(e.args),execute:R(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:a.model,sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function I(e,t){return `workspace run ${t} --scope project:${e.name}`}function V(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function z(e){return [e.name,e.path,$.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function q(e,t,n){let r={generatedAt:e.generatedAt,now:n},a=[d({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),d({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),d({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),d({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),d({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],o=t?[t]:e.projects;for(let i of o)i.commands.fleetStages.includes("test")&&a.push(d({id:`project.${i.name}.test`,scope:"project",project:i.name,args:I(i,"test"),description:`Run tests for ${i.name} through workspace orchestration.`,...r})),i.commands.fleetStages.includes("build")&&a.push(d({id:`project.${i.name}.build`,scope:"project",project:i.name,args:I(i,"build"),description:`Build ${i.name} through workspace orchestration.`,...r}));return a}function H(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function K(e,t){if(!t?.startsWith("project:"))return;let n=V(t);if(n)return e.projects.find(r=>z(r).includes(n))}function B(e,t,n){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!n&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(i=>i.severity==="error").length,o=r.filter(i=>i.severity==="warning").length;return {status:a>0?"failed":o>0?"warning":"passed",errors:a,warnings:o,issues:r}}function U(e){let t=[],n=[];for(let[r,a]of Object.entries(e.evidence))a?.exists?t.push(`${r}: ${a.path}`):n.push(r);return {available:t.sort(),missing:n.sort()}}function J(e){let t=e.summary.projectCount,n=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${n}, and ${r}.`}function X(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function ce(e$1){let t=e$1.model??await n({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),n$1=G(e$1.agent),r=K(t,e$1.scope),a$1=B(t,e$1.scope,r);if(e$1.strict===true&&a$1.status!=="passed"){let s=a$1.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${s}`)}let o=e$1.now??new Date,i=t.facts??[],W=new Set((r?[r]:t.projects).map(s=>s.name)),h=i.filter(s=>s.project?W.has(s.project):true),P=(r?[r]:t.projects).map(s=>{let p=h.filter(O=>O.project===s.name);return {name:s.name,path:s.path,kind:s.kind,runtime:s.runtime,framework:s.frameworkDisplayName,...s.generator?{generator:s.generator}:{},createCapability:s.createCapability,supportTier:s.supportTier,safeCommands:H(s),importantFiles:s.importantFiles,facts:p}}),m=U(t),y=J(t),v=q(t,r,o),T=v.map(s=>d$1({id:`context.command.${s.id}`,label:`${s.id} safe command`,scope:"command",value:{display:s.display,execute:s.execute,scope:s.scope},...s.project?{project:s.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:o,sourceArtifact:a.agentContext,sourcePath:`safeCommands.${s.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),k=[...h,...T],u=e({facts:k,generatedAt:o.toISOString(),now:o}),g=j();return {schemaVersion:F,generatedAt:o.toISOString(),agent:n$1,workspaceSummary:y,modelRef:a.model,intelligenceChain:{schemaVersion:g.schemaVersion,contractPath:g.contractPath,currentStep:"context",canonicalReadOrder:[...g.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...r?{activeProject:r.name}:{}},projects:P,safeCommands:v,facts:k,factFreshness:u,evidence:m,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a$1,agentInstructions:[`Read \`${a.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...X(t),...u.verifyBeforeUseFacts>0?[`${u.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[y,`Evidence available: ${m.available.length}. Missing evidence groups: ${m.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
|
|
2
|
+
`)}}async function de(e,t){return g(t,D,a$1(e))}export{M as a,j as b,F as c,D as d,ce as e,de as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {n,k,j}from'./chunk-JICOD2GI.js';import {a as a$2}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {a as a$1}from'./chunk-2QN6BMM7.js';import {g as g$1}from'./chunk-FWJV7CCI.js';import {a as a$3}from'./chunk-LG6RFLPZ.js';import {b,a}from'./chunk-5AKYMAIL.js';import ke from'crypto';import k$1 from'path';import L from'fs-extra';import {spawnSync}from'child_process';function fe(){let e={...process.env};return delete e.GIT_DIR,delete e.GIT_WORK_TREE,delete e.GIT_INDEX_FILE,delete e.GIT_PREFIX,e}function F(e,t){let o=spawnSync("git",t,{cwd:e,env:fe(),encoding:"utf8",stdio:["ignore","pipe","ignore"]});return o.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(o.stdout??"").trim()}}function ue(e){let t=e.replace(/\\/g,"/").replace(/^\.\//,"");return [".workspai/reports/",".workspai/cache/",".rapidkit/reports/",".rapidkit/cache/"].some(o=>t.startsWith(o))}function ge(e){let t=[],o=[],r=[];for(let l of e.split(`
|
|
2
|
+
`)){if(!l.trim())continue;let a=l.slice(0,2),i=l.slice(3).trim();if(i&&!ue(i)){if(a==="??"){o.push(i);continue}a.includes("D")&&r.push(i),t.push(i);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(o)].sort(),deletedFiles:[...new Set(r)].sort()}}function Y(e,t){let o={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},r=F(e,["rev-parse","--is-inside-work-tree"]);if(!r.ok||r.stdout!=="true")return o;let l=F(e,["rev-parse","--abbrev-ref","HEAD"]),a=F(e,["rev-parse","HEAD"]),i=F(e,["status","--porcelain=v1","--untracked-files=all"]),c=ge(i.stdout),m=c.changedFiles.length>0||c.untrackedFiles.length>0||c.deletedFiles.length>0;return {available:true,branch:l.ok?l.stdout:void 0,commit:a.ok?a.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:c.changedFiles,untrackedFiles:c.untrackedFiles,deletedFiles:c.deletedFiles}}var re=b.snapshot,K=b.diff,T=a.snapshot,oe=a.diff,he=b.impact,we=a.impact;function ne(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function ye(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function V(e){if(Array.isArray(e))return e.map(t=>V(t));if(e&&typeof e=="object"){let t={};for(let o of Object.keys(e).sort())t[o]=V(e[o]);return t}return e}function g(e){return JSON.stringify(V(e))}function I(e){let{runId:t,evidence:o,facts:r,factFreshness:l,projects:a,...i}=e,c=a.map(p=>{let{evidence:f,...h}=p;return h}),m={...i,generatedAt:"<ignored>",projects:c,graph:e.graph?{...e.graph,generatedAt:"<ignored>"}:void 0,validation:e.validation?{...e.validation,issues:e.validation.issues.map(p=>({...p})).sort((p,f)=>{let h=`${p.severity}:${p.code}:${p.target}:${p.message}`,b=`${f.severity}:${f.code}:${f.target}:${f.message}`;return h.localeCompare(b)})}:void 0};return ke.createHash("sha256").update(g(m)).digest("hex")}function Xe(e){return I(e)}function ae(e,t){return k$1.isAbsolute(t)?t:k$1.join(e,t)}async function We(e){let t=await L.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let o=t;if(o.schemaVersion===re){a$3(t,"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",`Workspace model snapshot ${e}`);let r=o;if(!r.model||r.model.schemaVersion!==j)throw new Error(`Invalid workspace model snapshot: ${e}`);let l=I(r.model);if(r.modelHash!==l)throw new Error(`Workspace model snapshot hash mismatch: ${e}`);return {model:r.model,hash:r.modelHash}}if(o.schemaVersion===j){a$3(t,"contracts/workspace-intelligence/workspace-model.v1.json",`Workspace model ${e}`);let r=o;return {model:r,hash:I(r)}}throw o.schemaVersion===K?new Error(`workspace diff --from received a diff report (${k$1.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${T}. To analyze an existing diff report, run: npx workspai workspace impact --from ${k$1.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(o.schemaVersion)}`)}async function ve(e){let t=await L.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let o=t;if(o.schemaVersion!==K)return null;a$3(t,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Workspace model diff ${e}`);let r=o;if(!r.currentModel||r.currentModel.schemaVersion!==j||!r.summary||!Array.isArray(r.changes))throw new Error(`Invalid workspace model diff report: ${e}`);if(r.toHash!==I(r.currentModel))throw new Error(`Workspace model diff current-model hash mismatch: ${e}`);return r}async function Ye(e){let t=e.model??await n({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:re,generatedAt:(e.now??new Date).toISOString(),modelHash:I(t),modelRef:k,model:t}}async function Qe(e,t){return g$1(t,T,a$1(e))}function x(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function w(e,t){e.push(t);}function be(e,t){let o=[],r=["name","profile","type"],l=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let a of r){let i=e.workspace[a],c=t.workspace[a];g(i)!==g(c)&&w(o,{type:"workspace.changed",severity:"info",target:`workspace.${a}`,message:`Workspace metadata field changed: ${String(a)}`,before:i,after:c});}for(let a of l){let i=e.identity[a],c=t.identity[a];g(i)!==g(c)&&w(o,{type:"workspace.changed",severity:"info",target:`identity.${a}`,message:`Workspace identity field changed: ${String(a)}`,before:i,after:c});}return g(e.policies)!==g(t.policies)&&w(o,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),g(e.evidence)!==g(t.evidence)&&w(o,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),g(e.discovery)!==g(t.discovery)&&w(o,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&w(o,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),o}function je(e,t){let o=e.validation??null,r=t.validation??null;return g(o)===g(r)?[]:[{type:"validation.changed",severity:r?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:o,after:r}]}function Me(e,t){let o=[],r=new Map(e.projects.map(a=>[a.path,a])),l=new Map(t.projects.map(a=>[a.path,a]));for(let[a,i]of l.entries()){let c=r.get(a);if(!c){w(o,{type:"project.added",severity:"info",target:a,message:`Project added: ${i.name}`,after:x(i)});continue}let m=x(c),p=x(i);if(g(m)!==g(p)){let f=c.runtime!==i.runtime||c.framework!==i.framework;w(o,{type:"project.changed",severity:f?"warning":"info",target:a,message:`Project changed: ${i.name}`,before:m,after:p});}}for(let[a,i]of r.entries())l.has(a)||w(o,{type:"project.removed",severity:"warning",target:a,message:`Project removed: ${i.name}`,before:x(i)});return o.sort((a,i)=>`${a.type}:${a.target}`.localeCompare(`${i.type}:${i.target}`))}async function Ie(e){let t=k$1.resolve(e.workspacePath),o=ne(e.fromPath),r=o?ye(e.fromPath):void 0,l=e.fromPath;if(o){let u=k$1.join(t,T);if(!await L.pathExists(u))throw new Error("Git-aware workspace diff requires an existing snapshot at .workspai/reports/workspace-model-snapshot.json. Run: npx workspai workspace snapshot --json");l=T;}let a=ae(t,l),i=await We(a),c=e.model??await n({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),m=I(c),p=[...be(i.model,c),...Me(i.model,c),...je(i.model,c)],f;e.includeGitObservation!==false&&(f=e.gitObservation??Y(t,{ref:r}),f.available&&Ee(p,f,c));let h=p.filter(u=>u.type.startsWith("git.")).length,b=i.hash!==m,W=o?`git:${r??"HEAD"}`:k$1.relative(t,a).split(k$1.sep).join("/");return {schemaVersion:K,generatedAt:(e.now??new Date).toISOString(),fromRef:W,toRef:k,fromHash:i.hash,toHash:m,summary:{changed:b||h>0,addedProjects:p.filter(u=>u.type==="project.added").length,removedProjects:p.filter(u=>u.type==="project.removed").length,changedProjects:p.filter(u=>u.type==="project.changed").length,workspaceChanges:p.filter(u=>u.type==="workspace.changed").length,validationChanges:p.filter(u=>u.type==="validation.changed").length,gitChangedFiles:h},git:f?.available?Se(f,r):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:p,currentModel:c}}async function Ze(e,t){return g$1(t,oe,a$1(e))}function P(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function Q(e){return e.reduce((t,o)=>P(o)>P(t)?o:t,"none")}var N=["none","low","medium","high","critical"];function Pe(e){let t=Math.max(1,P(e)-1);return N[t]}function Re(e){let t=Math.min(N.length-1,P(e)+1);return N[t]}function Z(e){return e.join(" ")}function y(e,t,o,r){return {id:e,label:t,scope:r.scope,project:r.project,display:Z(["npx","workspai",...o]),execute:Z(["npx","--yes","--package","workspai","workspai",...o]),required:r.required!==false}}function ee(e){let t=`project:${e.name}`,o=e.commands.fleetStages;return [y(`project.${e.name}.init`,`Run init for ${e.name}`,["workspace","run","init","--scope",t,"--json"],{scope:"project",project:e.name,required:o.includes("init")}),y(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:o.includes("test")}),y(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:o.includes("build")}),y(`project.${e.name}.start`,`Run start for ${e.name}`,["workspace","run","start","--scope",t,"--json"],{scope:"project",project:e.name,required:o.includes("start")})]}function _(){return [y("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),y("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),y("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),y("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),y("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),y("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function Ce(e,t){let o=t.split(k$1.sep).join("/");return e.projects.filter(l=>{let a=l.path.split(k$1.sep).join("/");return o===a||o.startsWith(`${a}/`)}).sort((l,a)=>a.path.length-l.path.length)[0]}function Ee(e,t,o){let r=new Set(e.map(a=>a.target)),l=(a,i)=>{let c=i.split(k$1.sep).join("/"),m=`git:${c}`;if(r.has(m))return;let p=Ce(o,c),f=p?`${p.name} (${p.path})`:"workspace";w(e,{type:a,severity:a==="git.deleted"?"warning":"info",target:m,message:`Git ${a==="git.untracked"?"untracked":a==="git.deleted"?"deleted":"changed"} file affects ${f}: ${c}`,after:{path:c,project:p?.name,projectPath:p?.path}}),r.add(m);};for(let a of t.changedFiles)l("git.file.changed",a);for(let a of t.untrackedFiles)l("git.untracked",a);for(let a of t.deletedFiles)l("git.deleted",a);}function Se(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Oe(e){let t=new Set,o=[];for(let r of e){let l=`${r.scope}:${r.project??""}:${r.display}`;t.has(l)||(t.add(l),o.push(r));}return o}function Ae(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function $e(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function De(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(o=>o.severity==="critical"?false:o.type.startsWith("git.")||o.type==="validation.changed")?e.risk:P(e.risk)>=P("high")||e.risk==="medium"?"low":e.risk}function te(e,t){if(!e||e==="workspace")return true;let o=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,k$1.basename(t.path),t.absolutePath].filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim().toLowerCase()).includes(o)}function Fe(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(o=>o.project?.name??o.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function et(e){let t=k$1.resolve(e.workspacePath),o=ne(e.fromPath),r=e.diff;if(!r&&!o){let n=ae(t,e.fromPath);r=await ve(n)??void 0;}r||(r=await Ie({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let l=new Map(r.currentModel.projects.map(n=>[n.path,n])),a=new Map(r.currentModel.projects.map(n=>[n.name,n])),i=r.changes.filter(n=>n.type.startsWith("project.")),c$1=new Map;for(let n of i){let d=(l.get(n.target)??(typeof n.before?.name=="string"?a.get(n.before.name):void 0))?.path??n.target,v=c$1.get(d)??[];v.push(n),c$1.set(d,v);}let m=[];for(let[n,s]of c$1.entries()){let d=l.get(n);if(d&&!te(e.scope,d))continue;let v=Q(s.map(Ae)),C=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):n);m.push({id:`project:${C}`,scope:"project",target:n,title:`Project impact: ${C}`,summary:s.map(j=>j.message).join(" "),risk:v,reasons:s.map(j=>`${j.type}: ${j.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?ee(d):_()});}let p=r.currentModel.graph,f=p?a$2(p):void 0,h=new Set(m.map(n=>n.project?.name).filter(n=>typeof n=="string")),b=new Map;for(let n of m)if(n.project?.name){let s=f?.byId.get(n.project.name);s&&(n.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(n.risk=Re(n.risk),n.reasons=[...n.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),n.origin="direct",n.distance=0,b.set(n.project.name,n.risk);}let W=[],u=0;if(p&&h.size>0){let n=c(p,h);for(let s of n.values()){if(s.distance===0||h.has(s.id))continue;let d=a.get(s.id);if(d&&!te(e.scope,d))continue;let v=s.path[0],C=s.path[s.path.length-2]??v,j=b.get(v)??"medium",pe=Pe(j),M=f?.byId.get(s.id);u=Math.max(u,s.distance),W.push({id:`transitive:${s.id}`,scope:"project",target:d?.path??s.id,title:`Transitive impact: ${s.id}`,summary:`Depends on changed project ${v}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:pe,reasons:[`graph.dependent: depends on ${C}${s.via?` via ${s.via}`:""} (path ${s.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?ee(d):_(),origin:"transitive",distance:s.distance,path:s.path,via:s.via,...M?{centrality:{fanIn:M.fanIn,fanOut:M.fanOut,reach:M.reach,betweenness:M.betweenness,isHotspot:M.isHotspot}}:{}});}}W.sort((n,s)=>n.target.localeCompare(s.target));let se=f?f.hotspots.flatMap(n=>{let s=f.byId.get(n);return s?[{project:n,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}]:[]}):[],ie=r.changes.filter(n=>!n.type.startsWith("project.")),B=r.currentModel.summary?.projectCount??r.currentModel.projects.length,R=ie.map(n=>({id:`workspace:${n.target}`,scope:"workspace",target:n.target,title:`Workspace impact: ${n.target}`,summary:n.message,risk:$e(n,{projectCount:B}),reasons:[`${n.type}: ${n.message}`],verification:_()})),q=Oe([...m.flatMap(n=>n.verification),...W.flatMap(n=>n.verification),...R.flatMap(n=>n.verification),...r.summary.changed?_():[]]).filter(n=>n.required),ce=Q([...m.map(n=>n.risk),...W.map(n=>n.risk),...R.map(n=>n.risk)]),z=De({risk:ce,affectedProjects:m.length,projectCount:B,changes:r.changes}),J={changed:r.summary.changed,risk:z,affectedProjects:m.length,workspaceItems:R.length,recommendedCommands:q.length,blastRadius:{directlyAffected:m.length,transitivelyAffected:W.length,maxDistance:u,graphEdges:p?.edges.length??0}};return {schemaVersion:he,generatedAt:(e.now??new Date).toISOString(),fromRef:r.fromRef,diffRef:oe,workspace:{name:r.currentModel.workspace.name,profile:r.currentModel.workspace.profile,type:r.currentModel.workspace.type},summary:J,affectedProjects:m.sort((n,s)=>n.target.localeCompare(s.target)),transitiveImpact:W,criticalPathHotspots:se,workspaceImpact:R.sort((n,s)=>n.target.localeCompare(s.target)),verificationPlan:q,agentBrief:Fe({changed:J.changed,risk:z,affectedProjects:m,workspaceImpact:R}),diff:r}}async function tt(e,t){return g$1(t,we,a$1(e))}export{Y as a,re as b,K as c,T as d,oe as e,he as f,we as g,ne as h,ye as i,Xe as j,Ye as k,Qe as l,Ie as m,Ze as n,_ as o,et as p,tt as q};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-5AKYMAIL.js';var r=".workspai/skills";var e=a$1.skillsIndex,a=a$1.explain,_=".workspai/reports/workspace-why-last-run.json",c=".workspai/reports/workspace-trace-last-run.json",O=".workspai/AGENT-GROUNDING.md",P=".rapidkit/AGENT-GROUNDING.md",I=".cursor/rules/workspai-grounding.mdc",A=".cursor/rules/rapidkit-grounding.mdc",T=".claude/rules/workspai-evidence.md",E=".claude/rules/rapidkit-evidence.md",R=".github/instructions/workspai-workspace.instructions.md",L=".github/instructions/rapidkit-workspace.instructions.md",d=".github/instructions/workspai-evidence.instructions.md",S=".github/instructions/rapidkit-evidence.instructions.md",C=".github/prompts/workspai-diagnose.prompt.md",k=".github/prompts/rapidkit-diagnose.prompt.md",l=".github/prompts/workspai-repair.prompt.md",m=".github/prompts/rapidkit-repair.prompt.md",N=".github/prompts/workspai-release-readiness.prompt.md",u=".github/prompts/rapidkit-release-readiness.prompt.md",g=".github/prompts/workspai-project-onboard.prompt.md",K=".github/prompts/rapidkit-project-onboard.prompt.md",G=".github/prompts/workspai-adopt-project.prompt.md",w=".github/prompts/rapidkit-adopt-project.prompt.md",x=".github/skills/workspai-grounding/SKILL.md",H=".github/skills/rapidkit-grounding/SKILL.md",D=".github/skills/workspai-workspace-intelligence/SKILL.md",W=".github/skills/rapidkit-workspace-intelligence/SKILL.md",h=".workspai/reports/workspai-mcp-design.json",U=".workspai/reports/rapidkit-mcp-design.json",b=".vscode/workspai-agent-hooks.json",Y=".vscode/rapidkit-agent-hooks.json";function M(t){let s=t.trim();if(!s||s.includes("..")||s.includes("/"))throw new Error(`Invalid operational skill id: ${t}`);return `${r}/${s}.md`}var f={"workspai-diagnose-api-failure":"workspai-diagnose","workspai-release-readiness":"workspai-release-readiness","workspai-safe-schema-migration":"workspai-safe-schema-migration","workspai-dependency-upgrade":"workspai-dependency-upgrade","workspai-rename-contract":"workspai-rename-contract"};export{H as A,D as B,W as C,h as D,U as E,b as F,Y as G,M as H,f as I,r as a,e as b,a as c,_ as d,c as e,O as f,P as g,I as h,A as i,T as j,E as k,R as l,L as m,d as n,S as o,C as p,k as q,l as r,m as s,N as t,u,g as v,K as w,G as x,w as y,x as z};
|