workspai 0.74.0 → 0.75.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/contracts/agent-framework-capabilities.v1.json +454 -0
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +166 -0
- package/contracts/create-planner-capabilities.v1.json +24 -0
- package/contracts/extension-cli-compatibility.v1.json +6 -0
- package/contracts/published-contract-catalog.v1.json +30 -0
- package/contracts/runtime-command-surface.v1.json +71 -1
- package/contracts/workspace-intelligence/agent-framework-adapter-manifest.v1.json +2127 -0
- package/contracts/workspace-intelligence/agent-framework-admission-candidate.v1.json +193 -0
- package/contracts/workspace-intelligence/agent-framework-change-plan.v1.json +280 -0
- package/contracts/workspace-intelligence/agent-framework-conformance-report.v1.json +269 -0
- package/contracts/workspace-intelligence/agent-framework-ownership-receipt.v1.json +147 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +4 -0
- package/contracts/workspace-intelligence-architecture.v1.json +28 -2
- package/dist/analyze-FRQVJ3VJ.js +1 -0
- package/dist/{artifact-remediation-plan-OVTQM7HN.js → artifact-remediation-plan-HD5K52UJ.js} +1 -1
- package/dist/autopilot-release-D3UES53H.js +1 -0
- package/dist/capabilities-command-VK3LQLP2.js +1 -0
- package/dist/{chunk-TBOIXIQA.js → chunk-36VNERGC.js} +1 -1
- package/dist/{chunk-ZNKZ2KXR.js → chunk-4DX4HBG3.js} +1 -1
- package/dist/chunk-4KEZQLBU.js +2 -0
- package/dist/{chunk-PKKSRXUS.js → chunk-6B7L4NZE.js} +1 -1
- package/dist/chunk-7NKM6EHE.js +7 -0
- package/dist/{chunk-FE5R6EUV.js → chunk-BLEIUQL6.js} +1 -1
- package/dist/{chunk-37SWTS2B.js → chunk-BR6QIYQS.js} +1 -1
- package/dist/chunk-CGNMS32W.js +97 -0
- package/dist/{chunk-4JJDDL3X.js → chunk-CK73SQFF.js} +1 -1
- package/dist/chunk-CMLLERGG.js +418 -0
- package/dist/{chunk-MGL6DBOR.js → chunk-COOVCORC.js} +1 -1
- package/dist/chunk-D4AMCZJU.js +7 -0
- package/dist/chunk-DFREJHG7.js +1 -0
- package/dist/{chunk-C43NXRRE.js → chunk-DJH2CH42.js} +1 -1
- package/dist/chunk-DT3LRKZQ.js +1 -0
- package/dist/{chunk-UHT2SW7O.js → chunk-FS3WLRQ4.js} +1 -1
- package/dist/chunk-G3ZC5W4U.js +1 -0
- package/dist/{chunk-KCIET26G.js → chunk-GE46XKD2.js} +1 -1
- package/dist/{chunk-DPC5DKH6.js → chunk-GIFAGOMK.js} +1 -1
- package/dist/{chunk-BTJPTJLT.js → chunk-HLSOZOL3.js} +3 -3
- package/dist/chunk-J4J3RYCL.js +4 -0
- package/dist/{chunk-JK6XEF7K.js → chunk-JKAAKE4Z.js} +1 -1
- package/dist/{chunk-G6ADWA2B.js → chunk-LMOTDLJF.js} +1 -1
- package/dist/{chunk-IQFXLJIM.js → chunk-MXI2DWLL.js} +1 -1
- package/dist/{chunk-5Y4YRYZI.js → chunk-NFWUAEVQ.js} +1 -1
- package/dist/chunk-NGU7RYXA.js +9 -0
- package/dist/{chunk-3WHE7V4M.js → chunk-NLRZFIC6.js} +1 -1
- package/dist/chunk-O2CFT2A3.js +1 -0
- package/dist/{chunk-EBQS5T7Q.js → chunk-OA2YJN22.js} +1 -1
- package/dist/chunk-OH6LV5JP.js +6 -0
- package/dist/{chunk-773WUMFU.js → chunk-P5RZO5BY.js} +13 -13
- package/dist/{chunk-XVTN5DDV.js → chunk-RU3UT7GJ.js} +1 -1
- package/dist/{chunk-TVSMNF5G.js → chunk-RX3U7JKF.js} +4 -4
- package/dist/chunk-SRCZX2KC.js +13 -0
- package/dist/chunk-TXVMHEJS.js +1 -0
- package/dist/chunk-V5WVGPOP.js +1 -0
- package/dist/{chunk-FY4X2VOE.js → chunk-VHMDWRDG.js} +2 -2
- package/dist/{chunk-H333GKL4.js → chunk-W7I65IXY.js} +1 -1
- package/dist/chunk-WOPZX56J.js +2 -0
- package/dist/chunk-YP436V7Q.js +2 -0
- package/dist/{chunk-HAZGSAKP.js → chunk-ZI54C2AO.js} +1 -1
- package/dist/{chunk-SAZXL36B.js → chunk-ZW4QV6SB.js} +1 -1
- package/dist/{create-EKA2QG5R.js → create-7UENFCJK.js} +1 -1
- package/dist/{demo-kit-RKTHTXHJ.js → demo-kit-ALW6OSQV.js} +1 -1
- package/dist/{doctor-BXSNADVR.js → doctor-KGADT4PI.js} +1 -1
- package/dist/{dotnet-webapi-clean-VJX6SGGP.js → dotnet-webapi-clean-6Z4EXEJY.js} +1 -1
- package/dist/{goal-lifecycle-XXWNMIAD.js → goal-lifecycle-HIQGDEEP.js} +1 -1
- package/dist/goal-pack-63PEP2ND.js +1 -0
- package/dist/{gofiber-standard-I6ASLOEE.js → gofiber-standard-TDJQIVQZ.js} +1 -1
- package/dist/{gogin-standard-U2LSRLIP.js → gogin-standard-UEF3IHSJ.js} +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +267 -249
- package/dist/{pipeline-JLOC2SUT.js → pipeline-VFI35PR4.js} +1 -1
- package/dist/{project-agent-entry-ZNUHGCVC.js → project-agent-entry-Z3OY3S7T.js} +1 -1
- package/dist/{project-intelligence-lens-W72OUEDW.js → project-intelligence-lens-YWICXW6P.js} +1 -1
- package/dist/{project-test-coverage-5PXAHBYQ.js → project-test-coverage-3P5FH6E5.js} +1 -1
- package/dist/proof-carrying-change-BAP2C3KV.js +1 -0
- package/dist/{pythonRapidkitExec-44ORGQ4R.js → pythonRapidkitExec-UMFLDIYR.js} +1 -1
- package/dist/{rust-axum-JMV7UPO7.js → rust-axum-4TRVPFMB.js} +1 -1
- package/dist/{springboot-standard-OC2RS3KC.js → springboot-standard-COWL75GT.js} +1 -1
- package/dist/verified-goal-A6WOMNTU.js +1 -0
- package/dist/{workspace-XTIGVLGH.js → workspace-PAXTJCMH.js} +1 -1
- package/dist/{workspace-agent-sync-TN6QDNBR.js → workspace-agent-sync-MGCEF4ON.js} +1 -1
- package/dist/{workspace-archive-OSMU3CK6.js → workspace-archive-3AURTMYA.js} +1 -1
- package/dist/{workspace-context-Y3TNY2XZ.js → workspace-context-2G6QZ6D3.js} +1 -1
- package/dist/{workspace-contract-GRZY7WRD.js → workspace-contract-VWPOIYHJ.js} +1 -1
- package/dist/{workspace-explain-KUYHJFLY.js → workspace-explain-HLEBUK4K.js} +1 -1
- package/dist/{workspace-feedback-D6HJLKBQ.js → workspace-feedback-FF34CSJE.js} +1 -1
- package/dist/{workspace-foundation-ZBUJTR56.js → workspace-foundation-X7LOGTS3.js} +1 -1
- package/dist/{workspace-graph-stream-KC2XUAE4.js → workspace-graph-stream-XGSRDRLI.js} +1 -1
- package/dist/{workspace-history-WWPS4U7H.js → workspace-history-EQG5UBKW.js} +1 -1
- package/dist/{workspace-intelligence-26YT6KMN.js → workspace-intelligence-GFJKIWBX.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-QFVTUBDO.js → workspace-intelligence-benchmark-R5MEGJQS.js} +1 -1
- package/dist/{workspace-intelligence-runner-HVYKHCTX.js → workspace-intelligence-runner-BU6JKNUD.js} +1 -1
- package/dist/{workspace-knowledge-graph-RL3I2FHY.js → workspace-knowledge-graph-OUTCLYS2.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-XWJRUMAC.js +1 -0
- package/dist/workspace-mcp-serve-JYUKX3YS.js +3 -0
- package/dist/workspace-model-DUGPW5IB.js +1 -0
- package/dist/{workspace-onboarding-BY6RUBBH.js → workspace-onboarding-C4CKWTJ3.js} +1 -1
- package/dist/{workspace-readme-HA6XLDME.js → workspace-readme-4FCKAQME.js} +1 -1
- package/dist/{workspace-registry-summary-VKTJ7PHV.js → workspace-registry-summary-4KX4QD55.js} +1 -1
- package/dist/{workspace-repair-engine-RBM7NCGI.js → workspace-repair-engine-OVW4J3DI.js} +1 -1
- package/dist/workspace-run-NVQGRZYO.js +1 -0
- package/dist/{workspace-verify-NFJ7RKKT.js → workspace-verify-B7HEFYO6.js} +1 -1
- package/dist/workspace-watch-TQYAMLIV.js +1 -0
- package/docs/README.md +4 -1
- package/docs/agent-framework-adapters.md +279 -0
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +16 -0
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +5 -0
- package/docs/creating-workspaces-and-projects.md +18 -4
- package/package.json +7 -1
- package/scripts/enterprise-package-smoke.mjs +98 -0
- package/dist/analyze-IA33T6MY.js +0 -1
- package/dist/autopilot-release-T327V7QK.js +0 -1
- package/dist/capabilities-command-NFGX42CH.js +0 -1
- package/dist/chunk-46QH3ZVI.js +0 -105
- package/dist/chunk-5EVBOUYW.js +0 -3
- package/dist/chunk-D6BL7ARI.js +0 -2
- package/dist/chunk-DLLHUG2Q.js +0 -9
- package/dist/chunk-DTLLIA2C.js +0 -1
- package/dist/chunk-FYR4FD7K.js +0 -1
- package/dist/chunk-H5DRKXXC.js +0 -2
- package/dist/chunk-IUOMBLRR.js +0 -2
- package/dist/chunk-K3FXRBER.js +0 -4
- package/dist/chunk-LEEOZRWR.js +0 -7
- package/dist/chunk-NCZJUPG5.js +0 -97
- package/dist/chunk-ND5YAC4T.js +0 -1
- package/dist/chunk-SVGUAVMG.js +0 -1
- package/dist/chunk-TGDXD4CD.js +0 -1
- package/dist/chunk-VLKX5U4H.js +0 -13
- package/dist/chunk-YYELANJO.js +0 -7
- package/dist/goal-pack-NTHYLISY.js +0 -1
- package/dist/proof-carrying-change-WLUPMUO7.js +0 -1
- package/dist/verified-goal-6O2JZOOR.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-JEJMRQZL.js +0 -1
- package/dist/workspace-mcp-serve-2FGRXJG4.js +0 -3
- package/dist/workspace-model-2ODVOWDQ.js +0 -1
- package/dist/workspace-run-JCA5WPCR.js +0 -1
- package/dist/workspace-watch-3DBBB6IP.js +0 -1
- /package/dist/{chunk-K33JJVQZ.js → chunk-VN2MKTQO.js} +0 -0
package/dist/chunk-46QH3ZVI.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {h}from'./chunk-PKKSRXUS.js';import {b,a}from'./chunk-TQEMLBAG.js';import {e,h as h$1,c}from'./chunk-RGNCL5OB.js';import {v}from'./chunk-VQZ5PI5J.js';import ae from'validate-npm-package-name';import x from'path';import {spawn}from'child_process';import d from'chalk';import u from'fs-extra';function oe(e,t){return t==="win32"?`Install Python ${e}+ with Windows Package Manager:
|
|
2
|
-
winget install --exact --id Python.Python.${e}
|
|
3
|
-
|
|
4
|
-
Or use the official installer and enable "Add Python to PATH":
|
|
5
|
-
https://www.python.org/downloads/windows/`:t==="darwin"?`Install Python ${e}+ with Homebrew:
|
|
6
|
-
brew install python@${e}
|
|
7
|
-
|
|
8
|
-
Official installers:
|
|
9
|
-
https://www.python.org/downloads/macos/`:`Install Python and its environment tooling for your Linux distribution:
|
|
10
|
-
Debian/Ubuntu: sudo apt update && sudo apt install python3 python3-venv python3-pip
|
|
11
|
-
Fedora/RHEL: sudo dnf install python3 python3-pip
|
|
12
|
-
Arch: sudo pacman -S python python-pip
|
|
13
|
-
Alpine: sudo apk add python3 py3-pip py3-virtualenv
|
|
14
|
-
|
|
15
|
-
Official installers:
|
|
16
|
-
https://www.python.org/downloads/`}function re(e){return e==="win32"?`Option 1 - install Poetry with pipx:
|
|
17
|
-
py -m pip install --user pipx
|
|
18
|
-
py -m pipx ensurepath
|
|
19
|
-
py -m pipx install poetry
|
|
20
|
-
|
|
21
|
-
Option 2 - use the official Poetry installer in PowerShell:
|
|
22
|
-
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
|
|
23
|
-
|
|
24
|
-
Official installation guide:
|
|
25
|
-
https://python-poetry.org/docs/#installation`:e==="darwin"?`Option 1 - install Poetry with Homebrew:
|
|
26
|
-
brew install poetry
|
|
27
|
-
|
|
28
|
-
Option 2 - install Poetry with pipx:
|
|
29
|
-
brew install pipx
|
|
30
|
-
pipx ensurepath
|
|
31
|
-
pipx install poetry
|
|
32
|
-
|
|
33
|
-
Official installation guide:
|
|
34
|
-
https://python-poetry.org/docs/#installation`:`Option 1 - install Poetry with pipx:
|
|
35
|
-
Debian/Ubuntu: sudo apt update && sudo apt install pipx
|
|
36
|
-
Fedora/RHEL: sudo dnf install pipx
|
|
37
|
-
Arch: sudo pacman -S python-pipx
|
|
38
|
-
Alpine: sudo apk add pipx
|
|
39
|
-
Then run: pipx ensurepath
|
|
40
|
-
pipx install poetry
|
|
41
|
-
|
|
42
|
-
Option 2 - use the official Poetry installer:
|
|
43
|
-
curl -sSL https://install.python-poetry.org | python3 -
|
|
44
|
-
|
|
45
|
-
Official installation guide:
|
|
46
|
-
https://python-poetry.org/docs/#installation`}function B(e){return e==="win32"?`Install pipx:
|
|
47
|
-
py -m pip install --user pipx
|
|
48
|
-
py -m pipx ensurepath
|
|
49
|
-
|
|
50
|
-
Official installation guide:
|
|
51
|
-
https://pipx.pypa.io/stable/installation/`:e==="darwin"?`Install pipx with Homebrew:
|
|
52
|
-
brew install pipx
|
|
53
|
-
pipx ensurepath
|
|
54
|
-
|
|
55
|
-
Official installation guide:
|
|
56
|
-
https://pipx.pypa.io/stable/installation/`:`Install pipx for your Linux distribution:
|
|
57
|
-
Debian/Ubuntu: sudo apt update && sudo apt install pipx
|
|
58
|
-
Fedora/RHEL: sudo dnf install pipx
|
|
59
|
-
Arch: sudo pacman -S python-pipx
|
|
60
|
-
Alpine: sudo apk add pipx
|
|
61
|
-
Then run: pipx ensurepath
|
|
62
|
-
|
|
63
|
-
Official installation guide:
|
|
64
|
-
https://pipx.pypa.io/stable/installation/`}function ie(e,t){let n=e.match(/(\d+\.\d+)/)?.[1]||"3.13";return t==="win32"?`Repair or reinstall Python and ensure pip is selected:
|
|
65
|
-
winget install --exact --id Python.Python.${n}
|
|
66
|
-
|
|
67
|
-
Then verify:
|
|
68
|
-
py -m venv --help`:t==="darwin"?`Reinstall the Homebrew Python runtime:
|
|
69
|
-
brew reinstall python
|
|
70
|
-
|
|
71
|
-
Then verify:
|
|
72
|
-
python3 -m venv --help`:`Install virtual-environment support for your Linux distribution:
|
|
73
|
-
Debian/Ubuntu: sudo apt update && sudo apt install ${e}
|
|
74
|
-
Fedora/RHEL: sudo dnf install python3 python3-pip
|
|
75
|
-
Arch: sudo pacman -S python python-pip
|
|
76
|
-
Alpine: sudo apk add python3 py3-pip py3-virtualenv
|
|
77
|
-
|
|
78
|
-
Then verify:
|
|
79
|
-
python3 -m venv --help`}var f=class extends Error{constructor(n,o,i){super(n);this.code=o;this.details=i;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}code;details},L=class extends f{constructor(t,n,o=process.platform){let i=n?`Python ${t}+ required, found ${n}`:`Python ${t}+ not found`;super(i,"PYTHON_NOT_FOUND",oe(t,o));}},q=class extends f{constructor(t=process.platform){super("Poetry is not installed","POETRY_NOT_FOUND",re(t));}},J=class extends f{constructor(t=process.platform){super("pipx is not installed","PIPX_NOT_FOUND",B(t));}},V=class extends f{constructor(t){super(`Directory "${t}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},g=class extends f{constructor(t,n){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",n);}},M=class extends f{constructor(t,n){let o=`Installation failed at: ${t}`,i=`${n.message}
|
|
80
|
-
|
|
81
|
-
Troubleshooting:
|
|
82
|
-
- Check your internet connection
|
|
83
|
-
- Verify Python/Poetry installation
|
|
84
|
-
- Try running with --debug flag for more details`;super(o,"INSTALLATION_ERROR",i);}},U=class extends f{constructor(t,n,o=process.platform){super("Python virtual environment support is not installed","PYTHON_VENV_UNAVAILABLE",`${ie(t,o)}
|
|
85
|
-
|
|
86
|
-
Or create the workspace without the optional Python engine:
|
|
87
|
-
npx workspai create workspace ${n} --skip-python-engine`);}},W=class extends f{constructor(t=process.platform){super("Python package installation support is not available","PYTHON_PIP_UNAVAILABLE",`pipx cannot be installed through the selected Python because pip is unavailable.
|
|
88
|
-
|
|
89
|
-
`+B(t)+`
|
|
90
|
-
|
|
91
|
-
Alternatively, restore pip and retry:
|
|
92
|
-
`+(t==="win32"?" py -m ensurepip --upgrade":t==="darwin"?" brew reinstall python":` Debian/Ubuntu: sudo apt install python3-pip
|
|
93
|
-
Fedora/RHEL: sudo dnf install python3-pip
|
|
94
|
-
Arch: sudo pacman -S python-pip
|
|
95
|
-
Alpine: sudo apk add py3-pip`));}},H=class extends f{constructor(){super("RapidKit Python package is not yet available on PyPI","RAPIDKIT_NOT_AVAILABLE",`Available options:
|
|
96
|
-
1. Install Python 3.10+ and retry the same command
|
|
97
|
-
2. Use the core workflow: npx workspai create workspace <name>
|
|
98
|
-
3. Offline fallback (limited): npx workspai create project fastapi.standard <name> --output .
|
|
99
|
-
|
|
100
|
-
Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function R(e){let t=ae(e);if(!t.validForNewPackages){let o=t.errors||[],i=t.warnings||[],r=[...o,...i];throw new g(e,`NPM validation failed: ${r.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new g(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new g(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new g(e,"Name must be at least 2 characters long");if(e.length>214)throw new g(e,"Name must be less than 214 characters");return true}async function O(e,t){let n={},o={};return await se(e,n,o),await ce(e,n,o),{policy:"latest-stable",requested_channel:t,host:{node:process.versions.node,platform:process.platform,arch:process.arch},declared:K(n),resolved:K(o)}}async function se(e,t,n){let o=x.join(e,"package.json");if(!await u.pathExists(o))return;let i=await u.readJson(o);for(let l of ["dependencies","devDependencies","peerDependencies"]){let s=S(i[l]);for(let[m,v]of Object.entries(s))t[`npm:${m}`]=v;}for(let[l,s]of Object.entries(S(i.engines)))t[`engine:${l}`]=s;let r=x.join(e,"package-lock.json");if(!await u.pathExists(r))return;let a=await u.readJson(r),c=T(a.packages);for(let l of Object.keys(t).filter(s=>s.startsWith("npm:")).map(s=>s.slice(4))){let s=T(c[`node_modules/${l}`]);typeof s.version=="string"&&(n[`npm:${l}`]=s.version);}}async function ce(e,t,n){let o=x.join(e,"composer.json");if(!await u.pathExists(o))return;let i=await u.readJson(o);for(let c of ["require","require-dev"])for(let[l,s]of Object.entries(S(i[c])))t[`composer:${l}`]=s;let r=x.join(e,"composer.lock");if(!await u.pathExists(r))return;let a=await u.readJson(r);for(let c of ["packages","packages-dev"]){let l=Array.isArray(a[c])?a[c]:[];for(let s of l){let m=T(s);typeof m.name=="string"&&typeof m.version=="string"&&(n[`composer:${m.name}`]=m.version);}}}function S(e){return !e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="string"))}function T(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function K(e){return Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))}var Y=[{id:"nextjs",kitId:"frontend.nextjs",aliases:["frontend.nextjs","next","nextjs","next.js"],displayName:"Next.js",framework:"nextjs",defaultPort:3e3,versionPolicy:"latest-stable",commandDisplay:e=>`npx create-next-app@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-next-app@latest",e,"--yes",...t.skipGit?["--disable-git"]:[],...t.skipInstall?["--skip-install"]:[]]})},{id:"remix",kitId:"frontend.remix",aliases:["frontend.remix","remix","remix-run","react-router"],displayName:"React Router",framework:"remix",defaultPort:5173,versionPolicy:"latest-stable",minNodeVersion:"22.22.0",minNodeMessage:"The latest stable React Router generator requires Node.js 22.22.0 or newer. Upgrade Node.js, then retry.",commandDisplay:e=>`npx create-react-router@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-react-router@latest",e,"--yes",...t.skipInstall?["--no-install"]:["--install"],"--no-git-init"]})},{id:"vite-react",kitId:"frontend.vite-react",aliases:["frontend.vite-react","vite-react","react","vite.react"],displayName:"React + Vite",framework:"react",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npm create vite@latest ${e} -- --template react-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","react-ts","--no-interactive"]})},{id:"vite-vue",kitId:"frontend.vite-vue",aliases:["frontend.vite-vue","vite-vue","vue","vite.vue"],displayName:"Vue + Vite",framework:"vue",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npm create vite@latest ${e} -- --template vue-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vue-ts","--no-interactive"]})},{id:"vite-svelte",kitId:"frontend.vite-svelte",aliases:["frontend.vite-svelte","vite-svelte","svelte","vite.svelte"],displayName:"Svelte + Vite",framework:"svelte",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npm create vite@latest ${e} -- --template svelte-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","svelte-ts","--no-interactive"]})},{id:"vite-solid",kitId:"frontend.vite-solid",aliases:["frontend.vite-solid","vite-solid","solid","solidjs","vite.solid"],displayName:"Solid + Vite",framework:"solid",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npm create vite@latest ${e} -- --template solid-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","solid-ts","--no-interactive"]})},{id:"vite-vanilla",kitId:"frontend.vite-vanilla",aliases:["frontend.vite-vanilla","vite","vanilla","vite-vanilla"],displayName:"Vite",framework:"vite",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npm create vite@latest ${e} -- --template vanilla-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vanilla-ts","--no-interactive"]})},{id:"nuxt",kitId:"frontend.nuxt",aliases:["frontend.nuxt","nuxt","nuxtjs","nuxt.js"],displayName:"Nuxt",framework:"nuxt",defaultPort:3e3,versionPolicy:"latest-stable",commandDisplay:(e,t)=>`npx create-nuxt@latest ${e} --template minimal --packageManager npm --gitInit ${t?.skipGit?"false":"true"}${t?.skipInstall?" --no-install":""}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-nuxt@latest",e,"--template","minimal","--packageManager","npm","--gitInit",t.skipGit?"false":"true",...t.skipInstall?["--no-install"]:[]]})},{id:"angular",kitId:"frontend.angular",aliases:["frontend.angular","angular","ng"],displayName:"Angular",framework:"angular",defaultPort:4200,versionPolicy:"latest-stable",minNodeMajor:20,minNodeMessage:"The latest stable Angular CLI requires a modern Node.js runtime. Upgrade to Node.js 20.19+ (or a newer supported LTS), then retry.",commandDisplay:e=>`npx @angular/cli@latest new ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","@angular/cli@latest","new",e,"--defaults","--skip-git",...t.skipInstall?["--skip-install"]:[]]})},{id:"astro",kitId:"frontend.astro",aliases:["frontend.astro","astro"],displayName:"Astro",framework:"astro",defaultPort:4321,versionPolicy:"latest-stable",commandDisplay:e=>`npm create astro@latest ${e}`,commandExec:(e,t)=>({command:"npm",args:["create","astro@latest",e,"--","--yes",...t.skipInstall?["--no-install"]:[],...t.skipGit?["--no-git"]:[]]})},{id:"sveltekit",kitId:"frontend.sveltekit",aliases:["frontend.sveltekit","sveltekit","svelte-kit"],displayName:"SvelteKit",framework:"sveltekit",defaultPort:5173,versionPolicy:"latest-stable",commandDisplay:e=>`npx sv@latest create ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","sv@latest","create",e,"--template","minimal","--types","ts","--no-add-ons",...t.skipInstall?["--no-install"]:["--install","npm"]]})}],D=new Map;for(let e of Y){D.set(e.id,e),D.set(e.kitId,e);for(let t of e.aliases)D.set(t.toLowerCase(),e);}function Ke(){return [...Y]}function j(e){return e?D.get(e.trim().toLowerCase())??null:null}function Ye(e){return !!j(e)}function ze(e){if(e[0]!=="create"||e[1]!=="frontend")return null;let t=e[2],n=e[3],o=e.slice(4),i=j(t);return i?["create","project",i.kitId,n??"",...o].filter(Boolean):["create","project",`frontend.${t??""}`,n??"",...o].filter(Boolean)}function z(e,t){return `workspai create project ${j(e)?.id??e.replace(/^frontend\./,"")} ${t}`}function X(e,t){return `npx ${z(e,t)}`}function de(e){let t=j(e);return t?`${z(t.id,"<name>")} [--output <dir>] [--skip-install] [--dry-run]`:"workspai create project <nextjs|remix|vite-react|vite-vue|vite-svelte|vite-solid|vite-vanilla|nuxt|angular|astro|sveltekit> <name> [--output <dir>] [--skip-install] [--dry-run]"}async function Xe(e){let t=e.args;if(t[0]!=="create"||t[1]!=="project")throw new Error("Frontend create expects normalized args: create project <frontend.kit> <name>");let n=j(t[2]);if(!n)throw new Error(`Unknown frontend generator: ${t[2]??"(missing)"}`);let o=t[3];if(!o)throw new Error(`Usage: ${de(n.id)}`);R(o);let i=ve(t,"--output")||process.cwd(),r=x.resolve(i,o),a=e.dryRun===true||t.includes("--dry-run"),c=t.includes("--skip-install"),l=t.includes("--skip-git")||t.includes("--no-git"),s=n.commandExec(o,{skipGit:l,skipInstall:c}),m=n.commandDisplay(o,{skipGit:l,skipInstall:c});if(await u.pathExists(r))throw new Error(`Directory "${r}" already exists`);if(a)return me({definition:n,projectName:o,projectPath:r,commandPlan:s}),{definition:n,projectName:o,projectPath:r,dryRun:a,commandDisplay:m,commandExec:[s.command,...s.args]};ue(n),await u.ensureDir(x.dirname(r));try{let v=await Q(s.command,s.args,x.dirname(r)),ne=await ye(r);if(v!==0)throw new Error(`Official ${n.displayName} generator failed with exit code ${v}`);if(!ne)throw new Error(`Official ${n.displayName} generator did not produce a valid package.json`);l||await ke(r),await pe({definition:n,projectName:o,projectPath:r,commandDisplay:m,commandExec:[s.command,...s.args],skipGit:l,skipInstall:c});}catch(v){throw await u.remove(r),v}return console.log(d.green(`\u2705 ${n.displayName} project created at ${r}`)),console.log(d.gray(` Display command: ${X(n.id,o)}`)),console.log(d.gray(" Next: cd "+o+" && npx workspai dev")),{definition:n,projectName:o,projectPath:r,dryRun:a,commandDisplay:m,commandExec:[s.command,...s.args]}}async function pe(e){let t=new Date().toISOString(),n=await h(),o=await O(e.projectPath,"latest"),i={schema_version:"1.0",name:e.projectName,slug:e.projectName,kind:"frontend",project_type:"frontend",category:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId,kit:e.definition.kitId,engine:"npm",support_tier:"extended",module_support:false,modules:[],workspai_version:n,rapidkit_version:n,generated_by:"workspai",generated_at:t,frontend:{generator:e.definition.id,official_generator:true,version_policy:e.definition.versionPolicy,version_evidence:o,default_port:e.definition.defaultPort,command_display:e.commandDisplay,command_exec:e.commandExec,skip_install:e.skipInstall,skip_git:e.skipGit},contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}},r={project:e.projectName,runtime:"node",framework:e.definition.framework,kind:"frontend",category:"frontend",source:"official-generator"},a={kind:"workspai.frontend_create",schema_version:"1.0",generated_at:t,project:{name:e.projectName,path:e.projectPath,kind:"frontend",category:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId},generator:{id:e.definition.id,version_policy:e.definition.versionPolicy,version_evidence:o,command_display:e.commandDisplay,command_exec:e.commandExec}};for(let[c,l]of [["project.json",i],["context.json",r],["frontend-create.json",a]]){let s=v(e.projectPath,c);await u.ensureDir(x.dirname(s)),await u.writeJson(s,l,{spaces:2});}}function me(e){console.log(d.bold(`
|
|
101
|
-
Workspai frontend create plan: ${e.definition.displayName}`)),console.log(d.gray(`Project: ${e.projectName}`)),console.log(d.gray(`Target: ${e.projectPath}`)),console.log(d.gray(`Show: ${X(e.definition.id,e.projectName)}`)),console.log(d.gray(`Run: ${[e.commandPlan.command,...e.commandPlan.args].join(" ")}`)),console.log(d.gray(`Default: http://localhost:${e.definition.defaultPort}`));}function fe(){let e=Number.parseInt(process.versions.node.split(".")[0]??"",10);return Number.isFinite(e)?e:0}function ue(e){if(!e.minNodeVersion&&!e.minNodeMajor||(e.minNodeVersion?ge(process.versions.node,e.minNodeVersion)>=0:fe()>=(e.minNodeMajor??0)))return;let n=e.minNodeVersion??`${e.minNodeMajor}+`;throw new Error(e.minNodeMessage??`${e.displayName} requires Node.js ${n} (current: ${process.versions.node}).`)}function ge(e,t){let n=e.split(".").map(r=>Number.parseInt(r,10)||0),o=t.split(".").map(r=>Number.parseInt(r,10)||0),i=Math.max(n.length,o.length);for(let r=0;r<i;r+=1){let a=(n[r]??0)-(o[r]??0);if(a!==0)return a}return 0}async function ye(e){if(!await u.pathExists(e))return false;let t=x.join(e,"package.json");if(!await u.pathExists(t))return false;try{let n=await u.readJson(t);return n!==null&&typeof n=="object"&&!Array.isArray(n)}catch{return false}}async function ke(e){let t=x.join(e,".git");if(await u.pathExists(t))return;if(await b(e)){console.log(d.gray(" Git initialization skipped; target is inside an existing git worktree."));return}if(await Q("git",["init"],e)===0){console.log(d.gray(" Git repository initialized."));return}console.log(d.yellow("\u26A0\uFE0F Git initialization was skipped or failed. You can run `git init` manually inside the project."));}async function Q(e$1,t,n){let o=e(e$1);return await new Promise(i=>{let r=spawn(o.command,[...o.prefixArgs,...t],{cwd:n,stdio:"inherit",shell:false,env:e$1==="git"?a(h$1()):h$1()});r.on("close",a=>i(a??1)),r.on("error",()=>i(1));})}function ve(e,t){let n=e.indexOf(t);if(n>=0&&n+1<e.length)return e[n+1];let o=e.find(i=>i.startsWith(`${t}=`));return o?o.slice(t.length+1):void 0}var te=[{id:"tauri",kitId:"desktop.tauri",aliases:["desktop.tauri","tauri","tauri-app"],displayName:"Tauri",category:"desktop",kind:"desktop",runtime:"node",runtimeCandidates:["node","rust"],framework:"tauri",supportTier:"extended",versionPolicy:"latest-stable",defaultPort:1420,officialSource:"create-tauri-app",supportsSkipInstall:true,requiredTools:[{command:"rustc",args:["--version"],label:"Rust toolchain",guidance:"Install the current stable Rust toolchain from https://rustup.rs/ and retry."},{command:"cargo",args:["--version"],label:"Cargo",guidance:"Install Cargo through the current stable Rust toolchain and retry."}],commandDisplay:e=>`npm create tauri-app@latest ${e} -- --manager npm --template vanilla-ts --yes`,commandExec:e=>({command:"npm",args:["create","tauri-app@latest",e,"--","--manager","npm","--template","vanilla-ts","--yes"]}),requiredArtifacts:["package.json","src-tauri/Cargo.toml","src-tauri/tauri.conf.json"]},{id:"electron",kitId:"desktop.electron",aliases:["desktop.electron","electron","electron-forge"],displayName:"Electron Forge",category:"desktop",kind:"desktop",runtime:"node",runtimeCandidates:["node"],framework:"electron",supportTier:"extended",versionPolicy:"latest-stable",officialSource:"create-electron-app",supportsSkipInstall:false,requiredTools:[{command:"git",args:["--version"],label:"Git",guidance:"Install Git and make it available on PATH, then retry."}],commandDisplay:e=>`npx create-electron-app@latest ${e} --template=vite-typescript`,commandExec:e=>({command:"npx",args:["--yes","create-electron-app@latest",e,"--template=vite-typescript"]}),requiredArtifacts:["package.json"]},{id:"vscode-extension",kitId:"extension.vscode",aliases:["extension.vscode","vscode","vscode-extension","visual-studio-code-extension"],displayName:"VS Code Extension",category:"extension",kind:"extension",runtime:"node",runtimeCandidates:["node"],framework:"vscode-extension",supportTier:"extended",versionPolicy:"latest-stable",officialSource:"generator-code",supportsSkipInstall:false,nodeSupport:{requirement:"^22.22.2 || ^24.15.0 || >=26.0.0",ranges:[{major:22,minVersion:"22.22.2"},{major:24,minVersion:"24.15.0"},{minVersion:"26.0.0"}],guidance:"Install Node.js 22.22.2+, 24.15.0+, or 26+ before running the latest stable VS Code Extension generator."},requiredTools:[{command:"git",args:["--version"],label:"Git",guidance:"Install Git to initialize source control, or create the project with --skip-git."}],commandDisplay:e=>`npx --package yo@latest --package generator-code@latest -- yo code ${e} --quick --extensionType ts --pkgManager npm --bundle esbuild`,commandExec:(e,t)=>({command:"npx",args:["--yes","--package","yo@latest","--package","generator-code@latest","--","yo","code",e,"--quick","--extensionType","ts","--extensionId",e,"--pkgManager","npm","--bundle","esbuild",`--gitInit=${t.skipGit?"false":"true"}`]}),requiredArtifacts:["package.json","src/extension.ts"]},{id:"laravel",kitId:"php.laravel",aliases:["php.laravel","laravel","php-laravel"],displayName:"Laravel",category:"backend",kind:"backend",runtime:"php",runtimeCandidates:["php","node"],framework:"laravel",supportTier:"extended",versionPolicy:"latest-stable",defaultPort:8e3,officialSource:"composer-create-project",supportsSkipInstall:false,requiredTools:[{command:"php",args:["--version"],label:"PHP",guidance:"Install a PHP version supported by the latest stable Laravel release and retry."},{command:"composer",args:["--version"],label:"Composer",guidance:"Install the latest stable Composer release and retry."}],recommendedTools:[{command:"npm",args:["--version"],label:"npm",guidance:"Install a supported Node.js LTS runtime when you want to build Laravel frontend assets."}],commandDisplay:e=>`composer create-project --no-interaction --prefer-dist --stability=stable laravel/laravel ${e}`,commandExec:e=>({command:"composer",args:["create-project","--no-interaction","--prefer-dist","--stability=stable","laravel/laravel",e]}),requiredArtifacts:["composer.json","artisan"]}],G=new Map;for(let e of te){G.set(e.id,e),G.set(e.kitId,e);for(let t of e.aliases)G.set(t.toLowerCase(),e);}function dt(){return [...te]}function C(e){return e?G.get(e.trim().toLowerCase())??null:null}function pt(e){return C(e)!==null}function he(e){return `workspai create project ${C(e)?.kitId??"<desktop.tauri|desktop.electron|extension.vscode|php.laravel>"} <name> [--output <dir>] [--skip-git] [--skip-install] [--dry-run]`}async function mt(e){if(e[0]!=="create"||e[1]!=="project")throw new Error("Official project create expects: create project <official.kit> <project-name>");let t=C(e[2]);if(!t)throw new Error(`Unknown official project generator: ${e[2]??"(missing)"}`);let n=e[3];if(!n)throw new Error(`Usage: ${he(t.kitId)}`);R(n);let o=Ee(e,"--output")||process.cwd(),i=x.resolve(o,n),r=e.includes("--dry-run"),a={skipGit:e.includes("--skip-git")||e.includes("--no-git"),skipInstall:e.includes("--skip-install")};if(a.skipInstall&&!t.supportsSkipInstall)throw new Error(`${t.displayName}'s official generator does not support --skip-install. Remove the flag so Workspai can verify the official scaffold.`);let c=t.commandExec(n,a),l=t.commandDisplay(n,a);if(await u.pathExists(i))throw new Error(`Directory "${i}" already exists`);if(r)return Ie(t,i,l,c),{definition:t,projectName:n,projectPath:i,dryRun:r,commandDisplay:l,commandExec:[c.command,...c.args]};be(t),await je(t,a),await u.ensureDir(x.dirname(i));try{let s=await Pe(c,x.dirname(i));if(s!==0)throw new Error(`Official ${t.displayName} generator failed with exit code ${s}`);await xe(t,i),a.skipGit&&await u.remove(x.join(i,".git")),await we({definition:t,projectName:n,projectPath:i,commandDisplay:l,commandExec:[c.command,...c.args],flags:a});}catch(s){throw await u.remove(i).catch(()=>{}),s}return console.log(d.green(`
|
|
102
|
-
\u2713 ${t.displayName} scaffold ready`)),console.log(d.gray(` Location ${i}`)),console.log(d.gray(` Generator ${t.officialSource} \xB7 ${t.versionPolicy}`)),console.log(d.green(" \u2713 Required scaffold files verified")),console.log(d.green(" \u2713 Generator and version evidence recorded in .workspai/")),t.id==="vscode-extension"&&console.log(d.yellow(" Note Dependency warnings above come from the official generated project; Workspai keeps them visible for Doctor and CI.")),console.log(d.gray(` Next cd ${n} && npx workspai doctor project`)),{definition:t,projectName:n,projectPath:i,dryRun:r,commandDisplay:l,commandExec:[c.command,...c.args]}}async function xe(e,t){let n=[];for(let o of e.requiredArtifacts)await u.pathExists(x.join(t,o))||n.push(o);if(n.length>0)throw new Error(`Official ${e.displayName} generator did not produce required artifacts: ${n.join(", ")}`)}async function we(e){let t=new Date().toISOString(),n=h(),o=await O(e.projectPath,e.definition.id==="laravel"?"stable":"latest"),i={schema_version:"1.0",name:e.projectName,slug:e.projectName,kind:e.definition.kind,project_type:e.definition.category,category:e.definition.category,runtime:e.definition.runtime,runtime_candidates:e.definition.runtimeCandidates,framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId,kit:e.definition.kitId,engine:"npm",support_tier:e.definition.supportTier,version_policy:e.definition.versionPolicy,module_support:false,modules:[],workspai_version:n,rapidkit_version:n,generated_by:"workspai",generated_at:t,generator:{id:e.definition.id,source:e.definition.officialSource,official:true,version_policy:e.definition.versionPolicy,version_evidence:o,command_display:e.commandDisplay,command_exec:e.commandExec,skip_install:e.flags.skipInstall,skip_git:e.flags.skipGit},...e.definition.defaultPort?{ports:[{name:"http",port:e.definition.defaultPort,protocol:"http"}]}:{},contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}},r={engine:"npm",project:e.projectName,kind:e.definition.kind,category:e.definition.category,runtime:e.definition.runtime,runtimeCandidates:e.definition.runtimeCandidates,framework:e.definition.framework,source:"official-generator",versionPolicy:e.definition.versionPolicy},a={schema_version:"1.0",kind:"workspai.official_project_create",generated_at:t,project:{name:e.projectName,path:e.projectPath,kind:e.definition.kind,category:e.definition.category,runtime:e.definition.runtime,runtime_candidates:e.definition.runtimeCandidates,framework:e.definition.framework,kit_name:e.definition.kitId},generator:i.generator,verified_artifacts:e.definition.requiredArtifacts};for(let[c,l]of [["project.json",i],["context.json",r],["official-create.json",a]]){let s=v(e.projectPath,c);await u.ensureDir(x.dirname(s)),await u.writeJson(s,l,{spaces:2});}}async function Pe(e$1,t){let n=e(e$1.command);return await new Promise(o=>{let i=h$1(),r=spawn(n.command,[...n.prefixArgs,...e$1.args],{cwd:t,stdio:"inherit",shell:c()&&n.command===e$1.command&&n.prefixArgs.length===0,env:e$1.command==="git"?a({...i,...e$1.env}):{...i,...e$1.env}});r.on("close",a=>o(a??1)),r.on("error",()=>o(1));})}async function je(e,t){let n=e.id==="vscode-extension"&&t.skipGit?[]:[...e.requiredTools],o=e.id==="vscode-extension"&&t.skipGit?[]:e.recommendedTools??[],i=[],r=[];for(let a of n)await Z(a)||i.push(a);for(let a of o)await Z(a)||r.push(a);if(i.length>0){let a=i.map(c=>`- ${c.label}: ${c.guidance}`).join(`
|
|
103
|
-
`);throw new Error(`${e.displayName} cannot use its latest stable official generator because required local tools are unavailable:
|
|
104
|
-
${a}`)}for(let a of r)console.warn(d.yellow(`\u26A0 ${a.label} was not found. ${a.guidance}`));}function be(e,t=process.versions.node){let n=e.nodeSupport;if(!n)return;let o=Number.parseInt(t.split(".")[0]??"",10);if(!n.ranges.some(r=>(r.major===void 0||r.major===o)&&Ne(t,r.minVersion)>=0))throw new Error(`${e.displayName} requires Node.js ${n.requirement} (current: ${t}). ${n.guidance}`)}function Ne(e,t){let n=e.split(".").map(r=>Number.parseInt(r,10)||0),o=t.split(".").map(r=>Number.parseInt(r,10)||0),i=Math.max(n.length,o.length);for(let r=0;r<i;r+=1){let a=(n[r]??0)-(o[r]??0);if(a!==0)return a}return 0}async function Z(e$1){let t=e(e$1.command);return await new Promise(n=>{let o=spawn(t.command,[...t.prefixArgs,...e$1.args],{stdio:"ignore",shell:c()&&t.command===e$1.command&&t.prefixArgs.length===0,env:h$1()}),i=false,r=setTimeout(()=>{i||(i=true,o.kill(),n(false));},5e3);o.on("close",a=>{i||(i=true,clearTimeout(r),n(a===0));}),o.on("error",()=>{i||(i=true,clearTimeout(r),n(false));});})}function Ie(e,t,n,o){console.log(d.bold(`
|
|
105
|
-
Workspai ${e.category} create plan: ${e.displayName}`)),console.log(d.gray(`Category: ${e.category}`)),console.log(d.gray(`Runtime: ${e.runtimeCandidates.join(" + ")}`)),console.log(d.gray(`Version: ${e.versionPolicy}`)),console.log(d.gray(`Target: ${t}`)),console.log(d.gray(`Official: ${n}`)),console.log(d.gray(`Execute: ${[o.command,...o.args].join(" ")}`)),console.log(d.gray("Dry run: no files or workspace state will be changed."));}function Ee(e,t){let n=e.indexOf(t);if(n>=0&&n+1<e.length)return e[n+1];let o=e.find(i=>i.startsWith(`${t}=`));return o?o.slice(t.length+1):void 0}export{f as a,L as b,q as c,J as d,V as e,M as f,U as g,W as h,H as i,R as j,Ke as k,j as l,Ye as m,ze as n,de as o,Xe as p,dt as q,C as r,pt as s,he as t,mt as u};
|
package/dist/chunk-5EVBOUYW.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {h as h$1,j,i,m,a as a$1,c,l,k}from'./chunk-YYELANJO.js';import {u,v as v$1}from'./chunk-VQZ5PI5J.js';import f from'fs';import u$1 from'path';import N from'fs-extra';var ge=[{id:"fastapi.standard",aliases:["fastapi","fastapi.standard"],label:"fastapi \u2014 FastAPI Standard Kit",description:"Core-backed FastAPI service scaffold.",owner:"core",runtime:"python",framework:"fastapi",category:"backend",moduleSupport:true,workspacePythonEngine:"required",stability:"stable",versionPolicy:"tested-baseline"},{id:"fastapi.ddd",aliases:["fastapi.ddd","fastapi-ddd"],label:"fastapi \u2014 FastAPI DDD Kit",description:"Core-backed FastAPI DDD service scaffold.",owner:"core",runtime:"python",framework:"fastapi",category:"backend",moduleSupport:true,workspacePythonEngine:"required",stability:"stable",versionPolicy:"tested-baseline"},{id:"nestjs.standard",aliases:["nestjs","nest","nestjs.standard"],label:"nestjs \u2014 NestJS Standard Kit",description:"Core-backed NestJS service scaffold.",owner:"core",runtime:"node",framework:"nestjs",category:"backend",moduleSupport:true,workspacePythonEngine:"optional",stability:"stable",versionPolicy:"tested-baseline"},{id:"springboot.standard",aliases:["spring","springboot","springboot.standard","java"],label:"spring \u2014 Spring Boot Standard Kit",description:"npm-backed Spring Boot service scaffold.",owner:"npm",runtime:"java",framework:"springboot",category:"backend",moduleSupport:false,workspacePythonEngine:"none",stability:"stable",versionPolicy:"tested-baseline",generator:"springboot",createUsage:"workspai create project springboot.standard <name> [--java-version <major>] [--spring-boot-version <semver>] [--group-id <com.example>] [--package-name <com.example.app>] [--port <number>]"},{id:"gofiber.standard",aliases:["go","go.standard","fiber","gofiber","gofiber.standard","go/fiber"],label:"go/fiber \u2014 Go Fiber Standard Kit",description:"npm-backed Go Fiber service scaffold.",owner:"npm",runtime:"go",framework:"gofiber",category:"backend",moduleSupport:false,workspacePythonEngine:"none",stability:"stable",versionPolicy:"tested-baseline",generator:"gofiber",createUsage:"workspai create project gofiber.standard <name> [--output <dir>]"},{id:"gogin.standard",aliases:["gin","gogin","gogin.standard","go/gin"],label:"go/gin \u2014 Go Gin Standard Kit",description:"npm-backed Go Gin service scaffold.",owner:"npm",runtime:"go",framework:"gogin",category:"backend",moduleSupport:false,workspacePythonEngine:"none",stability:"stable",versionPolicy:"tested-baseline",generator:"gogin",createUsage:"workspai create project gogin.standard <name> [--output <dir>]"},{id:"dotnet.webapi.clean",aliases:["dotnet","dotnet.webapi","dotnet.webapi.clean","aspnet","aspnetcore","asp.net","asp.net-core","csharp","c#"],label:"dotnet \u2014 ASP.NET Core Clean Web API",description:"npm-backed ASP.NET Core Web API with clean architecture boundaries.",owner:"npm",runtime:"dotnet",framework:"dotnet",category:"backend",moduleSupport:false,workspacePythonEngine:"none",stability:"preview",versionPolicy:"tested-baseline",generator:"dotnet-webapi-clean",createUsage:"workspai create project dotnet.webapi.clean <name> [--target-framework net8.0] [--root-namespace <Company.Product>] [--port <number>]"},{id:"rust.axum",aliases:["rust.axum","axum","rust-axum"],label:"rust/axum \u2014 Rust Axum API",description:"Workspai-owned Axum service with health, tests, CI, and container baseline.",owner:"npm",runtime:"rust",framework:"axum",category:"backend",moduleSupport:false,workspacePythonEngine:"none",stability:"preview",versionPolicy:"tested-baseline",generator:"rust-axum",createUsage:"workspai create project rust.axum <name> [--port <number>] [--output <dir>] [--skip-git]"}],Q=new Map;for(let t of ge){Q.set(t.id.toLowerCase(),t);for(let e of t.aliases)Q.set(e.toLowerCase(),t);}function G(t){return t?Q.get(t.trim().toLowerCase())??null:null}function Dt(t){return G(t)?.id??t}function Ot(){return ge.filter(t=>t.owner==="core"||t.generator)}function Tt(t){return G(t)?.owner==="npm"}async function It(t,e){if(!t.generator)throw new Error(`Kit is not backed by an npm generator: ${t.id}`);if(t.generator==="gofiber"){let{generateGoFiberKit:n}=await import('./gofiber-standard-I6ASLOEE.js');await n(e.projectPath,{project_name:e.projectName,module_path:e.projectName,skipGit:e.skipGit,skipInstall:e.skipInstall});return}if(t.generator==="gogin"){let{generateGoGinKit:n}=await import('./gogin-standard-U2LSRLIP.js');await n(e.projectPath,{project_name:e.projectName,module_path:e.projectName,skipGit:e.skipGit,skipInstall:e.skipInstall});return}if(t.generator==="springboot"){let{generateSpringBootKit:n}=await import('./springboot-standard-OC2RS3KC.js');await n(e.projectPath,{project_name:e.projectName,artifact_id:e.projectName,java_version:h(e.args,"--java-version")?.trim(),spring_boot_version:h(e.args,"--spring-boot-version")?.trim(),springdoc_version:h(e.args,"--springdoc-version")?.trim(),group_id:h(e.args,"--group-id")?.trim(),package_name:h(e.args,"--package-name")?.trim(),description:h(e.args,"--description")?.trim(),port:h(e.args,"--port")?.trim(),skipGit:e.skipGit,skipInstall:e.skipInstall});return}if(t.generator==="dotnet-webapi-clean"){let{generateDotnetWebApiCleanKit:n}=await import('./dotnet-webapi-clean-VJX6SGGP.js');await n(e.projectPath,{project_name:e.projectName,target_framework:h(e.args,"--target-framework")?.trim(),root_namespace:h(e.args,"--root-namespace")?.trim(),description:h(e.args,"--description")?.trim(),port:h(e.args,"--port")?.trim(),skipGit:e.skipGit,skipInstall:e.skipInstall});return}if(t.generator==="rust-axum"){let{generateRustAxumKit:n}=await import('./rust-axum-JMV7UPO7.js');await n(e.projectPath,{project_name:e.projectName,description:h(e.args,"--description")?.trim(),port:h(e.args,"--port")?.trim(),skipGit:e.skipGit,skipInstall:e.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${t.generator}`)}function h(t,e){let n=t.indexOf(e);if(n>=0&&n+1<t.length)return t[n+1];let r=t.find(o=>o.startsWith(`${e}=`));return r?r.slice(e.length+1):void 0}var P=["init","dev","start","build","test","lint","format","help"],ye={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:true,doctorSupport:"full",notes:["Core-backed Python projects support RapidKit Core modules and lifecycle commands."]},node:{runtime:"node",displayName:"Node.js",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:true,doctorSupport:"full",notes:["Node projects support npm-owned lifecycle commands; NestJS is the first-class Node framework."]},go:{runtime:"go",displayName:"Go",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:false,doctorSupport:"readiness",notes:["Go projects support workspace governance and lifecycle commands via Go tooling."]},java:{runtime:"java",displayName:"Java / Spring Boot",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:false,doctorSupport:"readiness",notes:["Java projects support Maven/Gradle lifecycle commands and workspace governance."]},dotnet:{runtime:"dotnet",displayName:".NET / ASP.NET Core",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:false,doctorSupport:"readiness",notes:[".NET projects support dotnet CLI lifecycle commands and workspace governance."]},php:{runtime:"php",displayName:"PHP",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:false,doctorSupport:"readiness",notes:["Laravel projects use the official Composer generator and PHP/Composer lifecycle adapter."]},ruby:{runtime:"ruby",displayName:"Ruby",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Ruby projects are importable and governed as observed projects until a kit exists."]},rust:{runtime:"rust",displayName:"Rust",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:P,moduleCommands:false,doctorSupport:"readiness",notes:["Rust projects support Axum and Tauri scaffolding plus Cargo lifecycle commands."]},elixir:{runtime:"elixir",displayName:"Elixir",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Elixir projects are importable and governed as observed projects until a kit exists."]},clojure:{runtime:"clojure",displayName:"Clojure",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Clojure projects are importable and governed as observed projects until a kit exists."]},scala:{runtime:"scala",displayName:"Scala",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Scala projects are importable and governed as observed projects until a kit exists."]},kotlin:{runtime:"kotlin",displayName:"Kotlin",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Kotlin projects are importable and governed as observed projects until a kit exists."]},deno:{runtime:"deno",displayName:"Deno",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Deno projects are importable and governed as observed projects until a kit exists."]},bun:{runtime:"bun",displayName:"Bun",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["init","dev","start","build","test","lint","format","help"],moduleCommands:false,doctorSupport:"observed",notes:["Bun projects are importable and governed as observed projects until a kit exists.","Declared package scripts execute through the Bun-aware npm wrapper; undeclared lifecycle commands remain unavailable."]},c:{runtime:"c",displayName:"C",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["C projects are importable and receive manifest, test, quality, security, and coverage evidence without assuming a package manager."]},cpp:{runtime:"cpp",displayName:"C++",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["C++ projects are importable and receive manifest, test, quality, security, and coverage evidence without assuming a package manager."]},unknown:{runtime:"unknown",displayName:"Unknown",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Unknown projects are tracked safely but require manual command configuration."]}};function L(t){return ye[t||"unknown"]??ye.unknown}function be(t){return h$1(t).supportTier}function ke(t){let e=L(t.runtime);return {lifecycleCommands:e.lifecycleCommands,moduleCommands:t.moduleSupport&&e.moduleCommands,unsupportedLifecycleCommands:P.filter(n=>!e.lifecycleCommands.includes(n))}}var Ke=["python","node","bun","go","java","dotnet","rust","php"];function A(t){return !!t&&Ke.includes(t)}function U(t,e){return e!=="lint"&&e!=="format"&&e!=="docs"?false:t==="python"}function Ce(t){let e=L(t),n=A(e.runtime),r=Ge[e.runtime]??[],o=Ue[e.runtime]??[];return {runtime:e.runtime,displayName:e.displayName,lifecycleCommands:e.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:o,notes:e.notes}}var Ge={python:["poetry","pip","uv"],node:["npm","pnpm","yarn","bun"],go:["go"],java:["maven","gradle"],dotnet:["dotnet"],php:["composer"],ruby:["bundle"],rust:["cargo"],elixir:["mix"],kotlin:["gradle"],deno:["deno"],bun:["bun"]},Ue={python:["pyproject.toml","requirements.txt","requirements.in"],node:["package.json"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],dotnet:["*.csproj","*.sln"],php:["composer.json"],ruby:["Gemfile"],rust:["Cargo.toml"],elixir:["mix.exs"],kotlin:["settings.gradle.kts"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml",".bunfig.toml"]};function F(t,e){let n=j(t)?null:t,r=i({runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0});return r.runtime!=="unknown"?r.runtime:m(e,n).runtime}function he(t,e={}){let n=t;for(;;){for(let o of u(n,"project.json"))if(f.existsSync(o))try{return JSON.parse(f.readFileSync(o,"utf8"))}catch{return null}if(e.searchParents===false)break;let r=u$1.dirname(n);if(r===n)break;n=r;}return null}function Xt(t,e){return F(t,e)==="go"}function Qt(t,e){return F(t,e)==="node"}function Zt(t,e){return F(t,e)==="java"}function en(t,e){return F(t,e)==="dotnet"}function tn(t,e){return F(t,e)==="python"}var Je=["project.json","context.json","file-hashes.json"];async function mn(t){let e=u$1.resolve(t),n=[];for(let r of Je){let o=v$1(e,r);if(await N.pathExists(o))continue;let i=u$1.join(e,".rapidkit",r);if(!await N.pathExists(i))continue;let p=await N.readJson(i);await N.ensureDir(u$1.dirname(o));let g=`${o}.${process.pid}.${Date.now()}.tmp`;try{await N.writeJson(g,p,{spaces:2}),await N.move(g,o,{overwrite:false}),n.push(o);}finally{await N.remove(g).catch(()=>{});}}return n}function qe(t){for(let e of u(t,"context.json"))if(f.existsSync(e))try{return JSON.parse(f.readFileSync(e,"utf8"))}catch{return null}return null}function Ye(t){let e=t?.engine;return e==="npm"||e==="pip"||e==="python"||e==="poetry"||e==="venv"||e==="pipx"||e==="uv"?e:"unknown"}function He(t,e){if(t?.module_support===false||e?.module_support===false||!t&&e)return false;let n=typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:typeof e?.kit=="string"?e.kit:void 0,r=n?G(n):void 0;return r?.owner==="core"&&r.moduleSupport===true}function Ve(t,e,n){let r=j(e)?null:e,o=i({runtime:typeof r?.runtime=="string"?r.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof r?.framework=="string"?r.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof r?.kit_name=="string"?r.kit_name:typeof r?.kit=="string"?r.kit:typeof n?.kit=="string"?n.kit:void 0});return o.key!=="unknown"?o:m(t,r)}function je(t){let e=u$1.resolve(t);if(![...u(e,"project.json"),...u(e,"context.json")].some(p=>f.existsSync(p)))return null;let r=he(e),o=qe(e),i=Ve(e,r,o);return {projectRoot:e,projectJson:r,contextJson:o,detection:i,moduleSupport:He(r,o),engine:Ye(o)}}var ze=["build","dev","start","test","lint","format"],ee=["init","test","build","start"],gn=["lint","format","docs"];function yn(t){return !!t&&ze.includes(t)}var Xe={dev:["dev","start:dev","watch"],start:["start","start:prod","preview"],build:["build","compile"],test:["test","test:unit","test:ci"],lint:["lint","eslint"],format:["format","prettier"]},we={nestjs:{dev:["dev","start:dev"],start:["start","start:prod"],build:["build"],test:["test","test:e2e"],lint:["lint"],format:["format"]},express:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},fastify:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},koa:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function Qe(t){let e=u$1.join(t,"package.json");if(!f.existsSync(e))return {};try{let r=JSON.parse(f.readFileSync(e,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(o=>typeof o[1]=="string"))}catch{return {}}}function Ze(t,e){let n=e?c(e):"unknown",r=n!=="unknown"?a$1(n,t):[],o=e?we[e]?.[t]??[]:[],i=Xe[t]??[],p=[...r,...o,...i];return [...new Set(p)]}function Pe(t,e,n){let r=Qe(t),o=new Set(Object.keys(r));if(o.has(e))return {scriptName:e,source:"package.json"};for(let i of Ze(e,n?.framework))if(o.has(i))return {scriptName:i,source:a$1(c(n?.framework??"unknown"),e).includes(i)||we[n?.framework??""]?.[e]?.includes(i)?"framework-candidate":"generic-candidate"};return null}function ne(t){return f.existsSync(u$1.join(t,"package.json"))}function et(t){try{let e=JSON.parse(f.readFileSync(u$1.join(t,"package.json"),"utf8"));return typeof e.packageManager!="string"?null:e.packageManager.trim().match(/^(npm|pnpm|yarn|bun)(?:@|$)/)?.[1]??null}catch{return null}}function J(t){let e=et(t);return e||(f.existsSync(u$1.join(t,"bun.lock"))||f.existsSync(u$1.join(t,"bunfig.toml"))?"bun":f.existsSync(u$1.join(t,"pnpm-lock.yaml"))?"pnpm":f.existsSync(u$1.join(t,"yarn.lock"))?"yarn":f.existsSync(u$1.join(t,"package-lock.json"))?"npm":f.existsSync(u$1.join(t,"pnpm-workspace.yaml"))?"pnpm":"npm")}function vn(t,e,n=J(t)){return n==="npm"?`npm run ${e}`:`${n} run ${e}`}function Nn(t,e=J(t)){return `${e} install`}var tt="polyglot-lifecycle-plan.v1",Me=new Set([".git",".workspai",".rapidkit",".venv","bin","build","dist","node_modules","obj","target","third_party","vendor","fixture","fixtures","__fixtures__","testdata"]);function D(t,e){return u$1.relative(t,e).split(u$1.sep).join("/")||"."}function nt(t){let e=new Set,n=(r,o)=>{if(o>4)return;let i=[];try{i=f.readdirSync(r,{withFileTypes:true});}catch{return}for(let p of i){if(p.isDirectory()){Me.has(p.name)||n(u$1.join(r,p.name),o+1);continue}if(!p.isFile()||!p.name.endsWith(".go")||p.name.endsWith("_test.go"))continue;let g=u$1.join(r,p.name);try{let c=f.readFileSync(g,"utf8");/^\s*package\s+main\b/m.test(c)&&/^\s*func\s+main\s*\(/m.test(c)&&e.add(D(t,r));}catch{}}};return n(t,0),e.size===1?[...e][0]:null}function ve(t,e,n){let r=false;for(let o of t.split(/\r?\n/)){let i=o.match(/^\s*\[([^\]]+)\]\s*(?:#.*)?$/)?.[1]?.trim();if(i!==void 0){r=i===e;continue}if(r&&new RegExp(`^\\s*${n}\\s*=`).test(o))return true}return false}function rt(t,e){let n=[],r=(o,i)=>{if(i>e)return;let p=[];try{p=f.readdirSync(o,{withFileTypes:true});}catch{return}for(let g of p.sort((c,y)=>c.name.localeCompare(y.name))){let c=u$1.join(o,g.name);if(g.isDirectory()){Me.has(g.name)||r(c,i+1);continue}g.isFile()&&(["package.json","deno.json","deno.jsonc","pyproject.toml","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","build.sbt","deps.edn","composer.json","Gemfile","mix.exs","CMakeLists.txt","meson.build"].includes(g.name)||/\.(?:cs|fs|vb)proj$/i.test(g.name))&&n.push(c);}};return r(t,0),n}function ot(t,e){let n=D(t,e).toLowerCase().split("/"),r=n.findIndex(o=>["test","tests","spec","specs","e2e","integration","integration-tests","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(o));return r<0?false:n.length-r>2}function it(t){if(u$1.basename(t)!=="package.json")return true;try{let e=u$1.dirname(t),n=JSON.parse(f.readFileSync(t,"utf8")),r=i=>{let p=n[i];return !!(p&&typeof p=="object"&&Object.keys(p).length>0)},o=n.scripts&&typeof n.scripts=="object"?n.scripts:{};return ["dependencies","devDependencies","optionalDependencies","peerDependencies"].some(r)||["preinstall","install","postinstall","prepare","init","test","build","start"].some(i=>typeof o[i]=="string")||["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"].some(i=>f.existsSync(u$1.join(e,i)))||Ae(t).length>0||f.existsSync(u$1.join(e,"pnpm-workspace.yaml"))}catch{return true}}function st(t,e){let n=u$1.basename(e);return n!=="build.gradle"&&n!=="build.gradle.kts"||u$1.dirname(e)===t?false:f.existsSync(u$1.join(t,"settings.gradle"))||f.existsSync(u$1.join(t,"settings.gradle.kts"))}function at(t,e){if(u$1.basename(e)!=="CMakeLists.txt")return false;let n=u$1.dirname(e),r=u$1.dirname(n);for(;r.startsWith(`${t}${u$1.sep}`)||r===t;){let o=u$1.join(r,"CMakeLists.txt");if(f.existsSync(o))try{let i=f.readFileSync(o,"utf8");for(let p of i.matchAll(/add_subdirectory\s*\(\s*["']?([^\s)"']+)/giu)){let g=p[1];if(g&&u$1.resolve(r,g)===n)return true}}catch{}if(r===t)break;r=u$1.dirname(r);}return false}function Ne(t,e){let n=t.match(new RegExp(`^\\s*${e}\\s*=\\s*\\[([\\s\\S]*?)\\]`,"m"));return n?.[1]?[...n[1].matchAll(/["']([^"']+)["']/g)].map(r=>r[1]??""):[]}function Ae(t){try{let e=JSON.parse(f.readFileSync(t,"utf8"));if(Array.isArray(e.workspaces))return e.workspaces.filter(n=>typeof n=="string");if(e.workspaces&&typeof e.workspaces=="object"&&!Array.isArray(e.workspaces)){let n=e.workspaces.packages;return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}}catch{}return []}function ct(t){if(!f.existsSync(t))return [];try{let e=f.readFileSync(t,"utf8"),n=e.match(/^packages\s*:\s*\[([^\]]*)\]/m)?.[1];return n!==void 0?[...n.matchAll(/["']([^"']+)["']/g)].map(o=>o[1]??""):[...(e.match(/^packages\s*:\s*\n((?:^[ \t]+-.*\n?)*)/m)?.[1]??"").matchAll(/^[ \t]+-[ \t]+["']?([^"'#\n]+?)["']?[ \t]*$/gm)].map(o=>(o[1]??"").trim())}catch{return []}}function Re(t,e){let n=e.replace(/^\.\//,"").replace(/\/$/,""),r="^";for(let o=0;o<n.length;o+=1){let i=n[o]??"";i==="*"&&n[o+1]==="*"?(r+=".*",o+=1):i==="*"?r+="[^/]*":i==="?"?r+="[^/]":r+=i.replace(/[|\\{}()[\]^$+?.]/g,"\\$&");}return new RegExp(`${r}$`).test(t)}function lt(t,e){let n=D(t.root,e);return n==="."||n.startsWith("../")||!t.patterns.some(o=>!o.startsWith("!")&&Re(n,o))?false:!t.exclusions.some(o=>Re(n,o))}function ut(t){return t.filter(e=>u$1.basename(e)==="package.json").map(e=>{let n=u$1.dirname(e),r=[...Ae(e),...ct(u$1.join(n,"pnpm-workspace.yaml"))];return {root:n,patterns:r.filter(o=>!o.startsWith("!")),exclusions:r.filter(o=>o.startsWith("!")).map(o=>o.slice(1))}}).filter(e=>e.patterns.length>0)}function pt(t){return t.filter(e=>u$1.basename(e)==="Cargo.toml").map(e=>{try{let n=f.readFileSync(e,"utf8");return /^\s*\[workspace\]\s*$/m.test(n)?{root:u$1.dirname(e),patterns:Ne(n,"members"),exclusions:Ne(n,"exclude")}:null}catch{return null}}).filter(e=>!!e?.patterns.length)}function Ee(t,e,n){if(u$1.basename(t)!==n)return false;let r=u$1.dirname(t);return e.some(o=>o.root!==r&<(o,r))}function a(t,e,n="high"){return {stage:t,command:e,confidence:n,preflight:"executable-and-inputs"}}function mt(t,e){let n={};try{let i=JSON.parse(e);i.scripts&&typeof i.scripts=="object"&&!Array.isArray(i.scripts)&&(n=i.scripts);}catch{}let r=J(t),o=i=>`${r} run ${i}`;return [a("init",r==="yarn"?"yarn install":`${r} install`),...typeof n.test=="string"?[a("test",o("test"))]:[],...typeof n.build=="string"?[a("build",o("build"))]:[],...typeof n.start=="string"?[a("start",o("start"))]:[]]}function dt(t,e){let n=u$1.basename(e),r=u$1.dirname(e),o=D(t,r),i=D(t,e),p=i.toLowerCase().split("/"),g=p.some(l=>["example","examples","sample","samples","worked","eval","evals","bench","benchmark","benchmarks","benchmark-app","benchmark-apps"].includes(l))?"example":p.some(l=>["test","tests","e2e","integration","integration-tests"].includes(l))?"test":p.some(l=>["script","scripts","tool","tools","tooling"].includes(l))?"tooling":"production",c="";try{c=f.readFileSync(e,"utf8");}catch{return null}let y,b,k;if(n==="package.json"){let l=f.existsSync(u$1.join(r,"bun.lock"))||f.existsSync(u$1.join(r,"bun.lockb"))||f.existsSync(u$1.join(r,"bunfig.toml"))||f.existsSync(u$1.join(r,".bunfig.toml"));y=l?"bun":"node",b=l?"bun":"npm",k=mt(r,c);}else if(n==="deno.json"||n==="deno.jsonc"){y="deno",b="deno";let l={};try{let C=JSON.parse(c);C.tasks&&typeof C.tasks=="object"&&!Array.isArray(C.tasks)&&(l=C.tasks);}catch{}k=[...typeof l.test=="string"?[a("test","deno task test")]:[a("test","deno test","medium")],...typeof l.build=="string"?[a("build","deno task build")]:[],...typeof l.start=="string"?[a("start","deno task start")]:typeof l.dev=="string"?[a("start","deno task dev","medium")]:[]];}else if(n==="pyproject.toml"){y="python",b="python";let l=/^\s*\[tool\.poetry\]\s*$/m.test(c),C=ve(c,"tool.poetry.scripts","start")||ve(c,"project.scripts","start");k=[a("init",l?"poetry install":"python -m pip install -e ."),...f.existsSync(u$1.join(r,"tests"))||/\[tool\.pytest/i.test(c)?[a("test",l?"poetry run pytest":"python -m pytest")]:[],.../\[build-system\]/.test(c)?[a("build",l?"poetry build":"python -m build","medium")]:[],...C?[a("start",l?"poetry run start":"start","medium")]:[]];}else if(n==="go.mod"){y="go",b="go";let l=nt(r);k=[a("init","go mod download"),a("test","go test ./..."),a("build","go build ./..."),...l?[a("start",l==="."?"go run .":`go run ./${l}`)]:[]];}else if(n==="Cargo.toml")y="rust",b="cargo",k=[a("init","cargo fetch"),a("test","cargo test"),a("build","cargo build"),...f.existsSync(u$1.join(r,"src","main.rs"))?[a("start","cargo run")]:[]];else if(n==="pom.xml"){y="java",b="maven";let l=f.existsSync(u$1.join(r,"mvnw"))?"./mvnw":"mvn";k=[a("init",`${l} dependency:go-offline`),a("test",`${l} test`),a("build",`${l} package`)];}else if(n==="build.gradle"||n==="build.gradle.kts"){y=/(?:kotlin|org\.jetbrains\.kotlin)/i.test(c)?"kotlin":"java",b="gradle";let l=f.existsSync(u$1.join(r,"gradlew"))?"./gradlew":"gradle";k=[a("init",`${l} dependencies`),a("test",`${l} test`),a("build",`${l} build`)];}else if(n==="build.sbt")y="scala",b="sbt",k=[a("init","sbt update"),a("test","sbt test"),a("build","sbt compile")];else if(n==="deps.edn")y="clojure",b="clojure-cli",k=[a("init","clojure -P"),.../:test\b/.test(c)?[a("test","clojure -X:test","medium")]:[]];else if(/\.(?:cs|fs|vb)proj$/i.test(n)){y="dotnet",b="nuget";let l=g==="test"||/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(c)||/PackageReference\s+Include=["']Microsoft\.NET\.Test\.Sdk["']/i.test(c);k=[a("init",`dotnet restore ${n}`),...l?[a("test",`dotnet test ${n}`)]:[],a("build",`dotnet build ${n}`),...!l&&/<Project\s+Sdk=["']Microsoft\.NET\.Sdk\.Web["']/i.test(c)?[a("start",`dotnet run --project ${n}`)]:[]];}else if(n==="composer.json"){y="php",b="composer";let l={};try{let C=JSON.parse(c);C.scripts&&typeof C.scripts=="object"&&!Array.isArray(C.scripts)&&(l=C.scripts);}catch{}k=[a("init","composer install"),...typeof l.test<"u"?[a("test","composer test")]:f.existsSync(u$1.join(r,"vendor","bin","phpunit"))||f.existsSync(u$1.join(r,"phpunit.xml"))||f.existsSync(u$1.join(r,"phpunit.xml.dist"))?[a("test","vendor/bin/phpunit","medium")]:[],...typeof l.build<"u"?[a("build","composer build")]:[],...typeof l.start<"u"?[a("start","composer start")]:[]];}else if(n==="Gemfile"){y="ruby",b="bundler";let l=f.existsSync(u$1.join(r,"bin","rails")),C=l||/\bgem\s+['\"]rails['\"]/.test(c),I=f.existsSync(u$1.join(r,"spec"))||/\bgem\s+['\"]rspec(?:-rails)?['\"]/.test(c),H=f.existsSync(u$1.join(r,"test"));k=[a("init","bundle install"),...H&&C?[a("test","bundle exec rails test")]:I?[a("test","bundle exec rspec")]:f.existsSync(u$1.join(r,"Rakefile"))?[a("test","bundle exec rake test","medium")]:[],...l?[a("start","bundle exec rails server")]:[]];}else if(n==="mix.exs")y="elixir",b="mix",k=[a("init","mix deps.get"),a("test","mix test"),a("build","mix compile"),.../(?:phoenix|phx\.server)/i.test(c)?[a("start","mix phx.server")]:[]];else if(n==="CMakeLists.txt")y=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/iu.test(c)?"cpp":"c",b="cmake",k=[a("init","cmake -S . -B build"),a("test","ctest --test-dir build --output-on-failure","medium"),a("build","cmake --build build")];else if(n==="meson.build")y=/(?:cpp|c\+\+)/iu.test(c)?"cpp":"c",b="meson",k=[a("init","meson setup build"),a("test","meson test -C build","medium"),a("build","meson compile -C build")];else return null;return {id:`${y}:${o}:${u$1.basename(i)}`,runtime:y,ecosystem:b,role:g,root:o,manifest:i,stages:k}}function _e(t,e={}){let n=u$1.resolve(t),r=rt(n,Math.max(0,Math.min(e.maxDepth??4,12))),o=ut(r),i=pt(r),p=r.filter(c=>!ot(n,c)).filter(c=>!st(n,c)).filter(c=>!at(n,c)).filter(c=>it(c)).filter(c=>!Ee(c,o,"package.json")).filter(c=>!Ee(c,i,"Cargo.toml")).map(c=>dt(n,c)).filter(c=>!!c).filter(c=>e.includeExamples===true||c.role!=="example").sort((c,y)=>c.runtime.localeCompare(y.runtime)||c.root.localeCompare(y.root)||c.manifest.localeCompare(y.manifest)),g=[...new Set(p.map(c=>c.runtime))].sort();return {schemaVersion:tt,projectRoot:".",polyglot:g.length>1,runtimes:g,units:p}}function Le(t){let e=Ce(t);return e.runtime==="unknown"&&t!=="unknown"?null:{runtime:e.runtime,displayName:e.displayName,supportedCommands:e.lifecycleCommands,packageManagers:e.packageManagers,primaryFiles:e.primaryFiles,notes:e.notes,hasExecutor:e.hasExecutor}}function re(t){try{let e=f.readFileSync(t,"utf8");return /^\s*package\s+main\b/m.test(e)&&/\bfunc\s+main\s*\(/m.test(e)}catch{return false}}function ie(t){let e=u$1.join(t,"main.go");if(re(e))return "./.";try{if(f.readdirSync(t,{withFileTypes:true}).filter(o=>o.isFile()&&o.name.endsWith(".go")).map(o=>u$1.join(t,o.name)).filter(re).length>0)return "./."}catch{}let n=u$1.join(t,"cmd");try{let r=f.readdirSync(n,{withFileTypes:true}).filter(o=>o.isDirectory()).map(o=>({name:o.name,mainPath:u$1.join(n,o.name,"main.go")})).filter(o=>re(o.mainPath)).map(o=>`./cmd/${o.name}`).sort();return r.length===1?r[0]:null}catch{return null}}function gt(t){try{let e=u$1.join(t,"Makefile");return f.existsSync(e)?f.readFileSync(e,"utf8"):""}catch{return ""}}function v(t,e){let n=gt(t);return n?new RegExp(`^${e}\\s*:`,"m").test(n):false}function d(t){try{return f.existsSync(t)}catch{return false}}function _(t){try{return d(t)?f.readFileSync(t,"utf8"):""}catch{return ""}}function yt(t){let e=[t];for(;e.length>0;){let n=e.shift();if(!n)break;let r=[];try{r=f.readdirSync(n,{withFileTypes:true});}catch{continue}for(let o of r){if(o.name==="node_modules"||o.name===".git"||o.name==="dist")continue;let i=u$1.join(n,o.name);if(o.isFile()&&o.name.endsWith(".csproj"))return true;o.isDirectory()&&e.push(i);}}return false}function De(t,e){let n=d(u$1.join(t,"pyproject.toml")),r=d(u$1.join(t,"requirements.txt"))||d(u$1.join(t,"requirements.in")),o=d(u$1.join(t,"manage.py"));switch(e){case "init":return n||r;case "dev":case "start":return n||o||r;case "test":return n||r||d(u$1.join(t,"tests"));case "build":return n||r;case "lint":case "format":return n||r||o||d(u$1.join(t,"setup.py"))||d(u$1.join(t,"setup.cfg"));default:return false}}function bt(t,e){if(!d(u$1.join(t,"go.mod")))return false;switch(e){case "init":return true;case "dev":return v(t,"run")||ie(t)!==null;case "test":return true;case "build":return true;case "start":return v(t,"run")||ie(t)!==null;case "lint":return d(u$1.join(t,".golangci.yml"))||d(u$1.join(t,".golangci.yaml"))||v(t,"lint");case "format":return true;default:return false}}function kt(t,e,n){let r=d(u$1.join(t,"pom.xml")),o=d(u$1.join(t,"build.gradle"))||d(u$1.join(t,"build.gradle.kts"));if(!r&&!o)return false;let i=_(u$1.join(t,"pom.xml")),p=[_(u$1.join(t,"build.gradle")),_(u$1.join(t,"build.gradle.kts"))].join(`
|
|
2
|
-
`),g=n==="springboot"||i.includes("spring-boot-maven-plugin")||/org\.springframework\.boot|id\s*\(?\s*['"]org\.springframework\.boot['"]/u.test(p),c=g||/<mainClass>\s*[^<]+\s*<\/mainClass>/iu.test(i)||/\bmainClass(?:Name)?\s*(?:=|\.)/u.test(p);switch(e){case "init":case "test":case "build":return true;case "dev":return g;case "start":return c;case "lint":return v(t,"lint")||i.includes("checkstyle")||i.includes("spotless-maven-plugin")||p.includes("checkstyle")||p.includes("spotless");case "format":return v(t,"format")||i.includes("spotless-maven-plugin")||p.includes("spotless");default:return false}}function Ct(t,e){if(!yt(t))return false;switch(e){case "init":case "dev":case "test":case "build":case "start":return true;case "lint":return v(t,"lint")||_(u$1.join(t,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return v(t,"format")||d(u$1.join(t,".editorconfig"));default:return false}}function Oe(t,e,n){return e==="init"?ne(t):Pe(t,e,{framework:n})!==null}function St(t,e,n){switch(e){case "php":return n==="init"&&d(u$1.join(t,"composer.json"));case "ruby":return n==="init"&&d(u$1.join(t,"Gemfile"));case "rust":return d(u$1.join(t,"Cargo.toml"))?n==="init"||n==="test"||n==="build"||n==="start":false;case "elixir":return n==="init"&&d(u$1.join(t,"mix.exs"));case "deno":return d(u$1.join(t,"deno.json"))||d(u$1.join(t,"deno.jsonc"))?n==="init"||n==="dev"||n==="test"||n==="start":n==="init"&&d(u$1.join(t,"package.json"));case "bun":return d(u$1.join(t,"bunfig.toml"))||d(u$1.join(t,".bunfig.toml"))||d(u$1.join(t,"bun.lock"))?n==="init"||n==="dev"||n==="test"||n==="build"||n==="start":n==="init"&&d(u$1.join(t,"package.json"));default:return false}}function ht(t){try{let e=JSON.parse(_(u$1.join(t,"composer.json")));return new Set(Object.keys(e.scripts??{}))}catch{return new Set}}function jt(t,e){if(!d(u$1.join(t,"composer.json")))return false;let n=ht(t),r=d(u$1.join(t,"artisan"));switch(e){case "init":return true;case "dev":return r||n.has("dev");case "start":return r||n.has("start");case "test":return r||n.has("test");case "build":return n.has("build");case "lint":return n.has("lint")||n.has("analyse")||n.has("analyze");case "format":return n.has("format")||n.has("fmt")||d(u$1.join(t,"pint.json"))||d(u$1.join(t,"vendor","bin","pint"));default:return false}}function xt(t,e){let n=u$1.join(t,"Cargo.toml");if(!d(n))return false;if(e==="dev"||e==="start"){let r=_(n);if(!/^\s*\[package\]\s*$/m.test(r))return false;let i=/^\s*\[\[bin\]\]\s*$/m.test(r),g=!/^\s*autobins\s*=\s*false\s*(?:#.*)?$/m.test(r)&&d(u$1.join(t,"src","main.rs"));return i||g}return e==="init"||e==="build"||e==="test"||e==="lint"||e==="format"}function Y(t,e,n,r){if(U(e,n))return De(t,n);if(!A(e))return St(t,e,n);switch(e){case "node":return Oe(t,n,r);case "bun":return Oe(t,n,r);case "python":return De(t,n);case "go":return bt(t,n);case "java":return kt(t,n,r);case "dotnet":return Ct(t,n);case "rust":return xt(t,n);case "php":return jt(t,n);default:return false}}function wt(t,e,n){return ["init","dev","start","build","test","lint","format"].filter(o=>Y(t,e,o,n))}function Te(t){let e=ke({runtime:t.runtime,moduleSupport:t.moduleSupport});if(!t.projectPath)return e;let n=wt(t.projectPath,t.runtime,t.framework),r=new Set(["help"]);for(let i of n)e.lifecycleCommands.includes(i)&&r.add(i);t.runtime==="node"&&ne(t.projectPath)&&r.add("init");let o=[...r].sort();return {lifecycleCommands:o,moduleCommands:e.moduleCommands,unsupportedLifecycleCommands:e.lifecycleCommands.filter(i=>!o.includes(i)).sort()}}var ce=["version","commands","doctor","project","help"],T=["init","dev","start","build","test","lint","format"],le=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],ue=["create","list","info","frameworks","license"];ce.filter(t=>t!=="help");function vt(t){let e=u$1.resolve(t);for(;;){if([...u(e,"project.json"),...u(e,"context.json")].some(o=>f.existsSync(o)))return e;let r=u$1.dirname(e);if(r===e)break;e=r;}return null}function O(t,e){return {command:t,...e}}var Nt=new Set(["dev","lint","format"]),Rt=new Set(ee);function Et(t,e){return e?Rt.has(t)?{executionScope:"fleet",fleetEligible:true}:Nt.has(t)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function Mt(t,e){return U(e.runtime,t)?"core":"runtime"}function At(t,e,n,r){return !t||!r.lifecycleCommands.includes(e)?false:Y(t,n.runtime,e,n.key)}function _t(t,e){let n=!!t&&(e.runtime==="python"||A(e.runtime)&&Y(t,e.runtime,"build",e.key));return O("docs",{owner:e.runtime==="python"?"core":"runtime",status:n?"supported":"unsupported",reason:n?e.runtime==="python"?"Documentation generation is delegated to Python Core for this project.":"Project documentation commands are available through the npm wrapper for this runtime.":"Documentation commands require a supported Python or npm-executor project manifest."})}function Lt(t){let e=u$1.resolve(t),n=vt(t);return n||(k(e).length>0?e:null)}function Ft(t=process.cwd()){let e=Lt(t),n=e?je(e):null,r=n?.detection??m(t,n?.projectJson??null),o=n?.moduleSupport??false,i=n?.engine??"unknown",p=Le(r.runtime),g=L(r.runtime),c=e?l(e):[],y=[r.runtime,...c.filter(s=>s!==r.runtime)].filter((s,S,B)=>s!=="unknown"&&B.indexOf(s)===S);y.length===0&&y.push("unknown");let b=y.filter(s=>s!=="unknown").length>1,k=Te({runtime:r.runtime,moduleSupport:o,projectPath:e??void 0,framework:r.key}),l$1={};for(let s of ce)l$1[s]=O(s,{owner:"npm",status:"supported",reason:s==="project"?"The npm CLI owns the project command surface and delegates only Core-specific detection operations.":s==="help"?"Help is available for every Workspai project through the npm CLI.":"Universal command available across Workspai project types."});for(let s of T){let S=At(e,s,r,k),B=Mt(s,r),V=Et(s,S);l$1[s]=O(s,{owner:B,status:S?"supported":"unsupported",executionScope:V.executionScope,fleetEligible:V.fleetEligible,reason:S?B==="core"?`Delegated to Python Core for ${r.displayName} projects.`:V.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${s}).`:s==="dev"?"Local development command only; workspace fleet excludes dev by design.":r.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${s} script in package.json.`:`Handled by the ${p?.displayName??r.displayName} runtime adapter for local project execution.`:e?r.runtime==="node"?`No ${s} script was found in package.json for this ${r.displayName} project.`:A(r.runtime)?`The ${r.displayName} runtime is tracked, but ${s} is not available from detected project manifests.`:`${r.displayName} is tracked as an observed runtime; ${s} requires project manifests or explicit scripts.`:"No Workspai project was detected."});}if(b)for(let s of T){let S=l$1[s];S&&(S.reason=`Composite runtime boundary detected (${y.join(", ")}). The project-local shortcut describes only the primary ${r.runtime} adapter; workspace fleet planning covers detected nested runtime units separately through \`workspace run <stage> --plan\`. ${S.reason??""}`.trim());}l$1.docs=_t(e,r);for(let s of le)l$1[s]=O(s,{owner:o?"core":"none",status:o?"supported":"unsupported",reason:o?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let s of ue)l$1[s]=O(s,{owner:s==="create"?"npm":"core",status:"global",reason:s==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let C=Object.values(l$1),I=C.filter(s=>T.includes(s.command)).filter(s=>s.status==="supported"),H=e?new Set(_e(e).units.flatMap(s=>s.stages.map(S=>S.stage))):new Set,Be=ee.filter(s=>I.some(S=>S.fleetEligible===true&&S.command===s)||H.has(s)),$e=I.filter(s=>s.executionScope==="local-only").map(s=>s.command).sort();return {schemaVersion:1,scope:"project",projectRoot:e,engine:i,runtime:r.runtime,runtimeCandidates:y,compositeRuntime:b,lifecycleCoverage:b?"primary-runtime-only":"complete",framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:be(r.key),runtimeSupportTier:g.tier,runtimeDoctorSupport:g.doctorSupport,moduleSupport:o,fleetStages:Be,localOnlyCommands:$e,commandMap:l$1,supportedCommands:C.filter(s=>s.status==="supported").map(s=>s.command).sort(),unsupportedCommands:C.filter(s=>s.status==="unsupported").map(s=>s.command).sort(),globalCommands:C.filter(s=>s.status==="global").map(s=>s.command).sort()}}function kr(t,e=process.cwd()){let n=t[0];return n?Ft(e).commandMap[n]??null:null}function Cr(t){if(t[0]==="project"&&t[1]==="commands")return true;if(t[0]==="commands"&&t.includes("--scope")){let e=t.indexOf("--scope");return t[e+1]==="project"}return t.some(e=>e==="--scope=project")&&t[0]==="commands"}function Sr(t,e){return [`Workspai command not supported for this project: ${t.command}`,"",`Project: ${e.projectRoot??"not detected"}`,`Runtime: ${e.runtime}`,`Framework: ${e.frameworkDisplayName}`,`Reason: ${t.reason??"Unsupported for this project type."}`,"","Run `workspai project commands` to inspect supported commands for this project."].join(`
|
|
3
|
-
`)}export{Nn as A,_e as B,vt as C,Ft as D,kr as E,Cr as F,Sr as G,G as a,Dt as b,Ot as c,Tt as d,It as e,L as f,be as g,A as h,F as i,he as j,Xt as k,Qt as l,Zt as m,en as n,tn as o,mn as p,je as q,ze as r,gn as s,yn as t,Pe as u,ie as v,v as w,Te as x,J as y,vn as z};
|
package/dist/chunk-D6BL7ARI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {q as q$1,l,m,k as k$1}from'./chunk-TGDXD4CD.js';import {a}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {d as d$1}from'./chunk-G6ADWA2B.js';import {h as h$1}from'./chunk-FE5R6EUV.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {e,d,b as b$1}from'./chunk-EWZZUQBR.js';import {q,p}from'./chunk-ODK4LCEL.js';import k from'path';import V from'fs-extra';import {spawnSync}from'child_process';function ue(){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 x(e,t,a){let r=spawnSync("git",t,{cwd:e,env:ue(),encoding:"utf8",stdio:["ignore","pipe","ignore"]});if(r.status!==0)return {ok:false,stdout:""};let i=r.stdout??"";return {ok:true,stdout:a?.preserveWhitespace?i:i.trim()}}function ge(e){let t=e.replace(/\\/g,"/").replace(/^\.\//,"");return t===".workspai/AGENT-GROUNDING.md"?true:[".workspai/reports/",".workspai/cache/",".rapidkit/reports/",".rapidkit/cache/"].some(a=>t.startsWith(a))}function ke(e){let t=[],a=[],r=[];for(let i of e.split(`
|
|
2
|
-
`)){if(!i.trim())continue;let n=i.slice(0,2),c=i.slice(3).trim();if(c&&!ge(c)){if(n==="??"){a.push(c);continue}n.includes("D")&&r.push(c),t.push(c);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(a)].sort(),deletedFiles:[...new Set(r)].sort()}}function Q(e,t){let a={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},r=x(e,["rev-parse","--is-inside-work-tree"]);if(!r.ok||r.stdout!=="true")return a;let i=x(e,["rev-parse","--abbrev-ref","HEAD"]),n=x(e,["rev-parse","HEAD"]),c=x(e,["status","--porcelain=v1","--untracked-files=all"],{preserveWhitespace:true}),p=ke(c.stdout),m=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:i.ok?i.stdout:void 0,commit:n.ok?n.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var oe=q.snapshot,L=q.diff,T=p.snapshot,ae=p.diff,he=q.impact,we=p.impact;function ye(e$1){if(e$1.model.projectTopology||!e$1.model.graph||e$1.modelHash!==e(e$1.model))return null;let t={...e$1.model,projectTopology:e$1.model.graph,graph:e$1.model.graph};return {...e$1,modelHash:d(t),model:t}}function ne(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function We(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function se(e,t){return k.isAbsolute(t)?t:k.join(e,t)}async function be(e){let t=await V.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let a=t;if(a.schemaVersion===oe){a$1(t,"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",`Workspace model snapshot ${e}`);let r=a;if(!r.model||r.model.schemaVersion!==k$1)throw new Error(`Invalid workspace model snapshot: ${e}`);let i=d(r.model);if(r.modelHash!==i){let n=ye(r);if(!n)throw new Error(`Workspace model snapshot hash mismatch: ${e}`);return {model:n.model,hash:n.modelHash}}return {model:r.model,hash:r.modelHash}}if(a.schemaVersion===k$1){a$1(t,"contracts/workspace-intelligence/workspace-model.v1.json",`Workspace model ${e}`);let r=a;return {model:r,hash:d(r)}}throw a.schemaVersion===L?new Error(`workspace diff --from received a diff report (${k.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.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(a.schemaVersion)}`)}async function ve(e){let t=await V.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let a=t;if(a.schemaVersion!==L)return null;a$1(t,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Workspace model diff ${e}`);let r=a;if(!r.currentModel||r.currentModel.schemaVersion!==k$1||!r.summary||!Array.isArray(r.changes))throw new Error(`Invalid workspace model diff report: ${e}`);if(r.toHash!==d(r.currentModel))throw new Error(`Workspace model diff current-model hash mismatch: ${e}`);return r}async function Ye(e){let t=e.model??await q$1({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:oe,generatedAt:(e.now??new Date).toISOString(),modelHash:d(t),modelRef:l,model:t}}async function Qe(e,t){return h$1(t,T,d$1(e))}function F(e){let{evidence:t,...a}=e;return a}function h(e,t){e.push(t);}function je(e,t){let a=[],r=["name","profile","type"],i=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let n of r){let c=e.workspace[n],p=t.workspace[n];b$1(c)!==b$1(p)&&h(a,{type:"workspace.changed",severity:"info",target:`workspace.${n}`,message:`Workspace metadata field changed: ${String(n)}`,before:c,after:p});}for(let n of i){let c=e.identity[n],p=t.identity[n];b$1(c)!==b$1(p)&&h(a,{type:"workspace.changed",severity:"info",target:`identity.${n}`,message:`Workspace identity field changed: ${String(n)}`,before:c,after:p});}return b$1(e.policies)!==b$1(t.policies)&&h(a,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),b$1(e.discovery)!==b$1(t.discovery)&&h(a,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(a,{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}),a}function Me(e,t){let a=e.validation??null,r=t.validation??null;return b$1(a)===b$1(r)?[]:[{type:"validation.changed",severity:r?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:a,after:r}]}function Ie(e,t){let a=[],r=new Map(e.projects.map(n=>[n.path,n])),i=new Map(t.projects.map(n=>[n.path,n]));for(let[n,c]of i.entries()){let p=r.get(n);if(!p){h(a,{type:"project.added",severity:"info",target:n,message:`Project added: ${c.name}`,after:F(c)});continue}let m=F(p),l=F(c);if(b$1(m)!==b$1(l)){let u=p.runtime!==c.runtime||p.framework!==c.framework;h(a,{type:"project.changed",severity:u?"warning":"info",target:n,message:`Project changed: ${c.name}`,before:m,after:l});}}for(let[n,c]of r.entries())i.has(n)||h(a,{type:"project.removed",severity:"warning",target:n,message:`Project removed: ${c.name}`,before:F(c)});return a.sort((n,c)=>`${n.type}:${n.target}`.localeCompare(`${c.type}:${c.target}`))}async function Pe(e){let t=k.resolve(e.workspacePath),a=ne(e.fromPath),r=a?We(e.fromPath):void 0,i=e.fromPath;if(a){let f=k.join(t,T);if(!await V.pathExists(f))throw new Error("Git-aware workspace diff requires an existing snapshot at .workspai/reports/workspace-model-snapshot.json. Run: npx workspai workspace snapshot --json");i=T;}let n=se(t,i),c=await be(n),p=e.model??await q$1({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),m=d(p),l$1=[...je(c.model,p),...Ie(c.model,p),...Me(c.model,p)],u;e.includeGitObservation!==false&&(u=e.gitObservation??Q(t,{ref:r}),u.available&&Se(l$1,u,p));let v=c.hash!==m;v&&!l$1.some(f=>!f.type.startsWith("git."))&&h(l$1,{type:"workspace.changed",severity:"warning",target:"model.structural-hash",message:"Workspace structural identity changed outside the currently classified diff fields.",before:c.hash,after:m});let P=l$1.filter(f=>f.type.startsWith("git.")).length,w=a?`git:${r??"HEAD"}`:k.relative(t,n).split(k.sep).join("/");return {schemaVersion:L,generatedAt:(e.now??new Date).toISOString(),fromRef:w,toRef:l,fromHash:c.hash,toHash:m,summary:{changed:v||P>0,addedProjects:l$1.filter(f=>f.type==="project.added").length,removedProjects:l$1.filter(f=>f.type==="project.removed").length,changedProjects:l$1.filter(f=>f.type==="project.changed").length,workspaceChanges:l$1.filter(f=>f.type==="workspace.changed").length,validationChanges:l$1.filter(f=>f.type==="validation.changed").length,gitChangedFiles:P},git:u?.available?Oe(u,r):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l$1,currentModel:p}}async function Ze(e,t){return h$1(t,ae,d$1(e))}function I(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function Z(e){return e.reduce((t,a)=>I(a)>I(t)?a:t,"none")}var N=["none","low","medium","high","critical"];function Re(e){let t=Math.max(1,I(e)-1);return N[t]}function Ce(e){let t=Math.min(N.length-1,I(e)+1);return N[t]}function ee(e){return e.join(" ")}function b(e,t,a,r){return {id:e,label:t,scope:r.scope,project:r.project,display:ee(["npx","workspai",...a]),execute:ee(["npx","--yes","--package","workspai","workspai",...a]),required:r.required!==false}}function te(e){let t=`project:${e.name}`,a=e.commands.fleetStages,r={init:`Run init for ${e.name}`,test:`Run tests for ${e.name}`,build:`Run build for ${e.name}`,start:`Run start for ${e.name}`};return ["init","test","build","start"].filter(i=>a.includes(i)).map(i=>b(`project.${e.name}.${i}`,r[i],["workspace","run",i,"--scope",t,"--json"],{scope:"project",project:e.name}))}function _(){return [b("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),b("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),b("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),b("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),b("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),b("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function Ee(e,t){let a=t.split(k.sep).join("/");return e.projects.filter(i=>{let n=i.path.split(k.sep).join("/");return a===n||a.startsWith(`${n}/`)}).sort((i,n)=>n.path.length-i.path.length)[0]}function Se(e,t,a){let r=new Set(e.map(n=>n.target)),i=(n,c)=>{let p=c.split(k.sep).join("/"),m=`git:${p}`;if(r.has(m))return;let l=Ee(a,p),u=l?`${l.name} (${l.path})`:"workspace";h(e,{type:n,severity:n==="git.deleted"?"warning":"info",target:m,message:`Git ${n==="git.untracked"?"untracked":n==="git.deleted"?"deleted":"changed"} file affects ${u}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),r.add(m);};for(let n of t.changedFiles)i("git.file.changed",n);for(let n of t.untrackedFiles)i("git.untracked",n);for(let n of t.deletedFiles)i("git.deleted",n);}function Oe(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 Ae(e){let t=new Set,a=[];for(let r of e){let i=`${r.scope}:${r.project??""}:${r.display}`;t.has(i)||(t.add(i),a.push(r));}return a}function De(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 xe(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(a=>a.severity==="critical"?false:a.type.startsWith("git.")||a.type==="validation.changed")?e.risk:I(e.risk)>=I("high")||e.risk==="medium"?"low":e.risk}function re(e,t){if(!e||e==="workspace")return true;let a=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,k.basename(t.path),t.absolutePath].filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim().toLowerCase()).includes(a)}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(a=>a.project?.name??a.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.resolve(e.workspacePath),a$1=ne(e.fromPath),r=e.diff;if(!r&&!a$1){let o=se(t,e.fromPath);r=await ve(o)??void 0;}r||(r=await Pe({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let i=new Map(r.currentModel.projects.map(o=>[o.path,o])),n=new Map(r.currentModel.projects.map(o=>[o.name,o])),c$1=r.changes.filter(o=>o.type.startsWith("project.")),p=new Map;for(let o of c$1){let d=(i.get(o.target)??(typeof o.before?.name=="string"?n.get(o.before.name):void 0))?.path??o.target,y=p.get(d)??[];y.push(o),p.set(d,y);}let m$1=[];for(let[o,s]of p.entries()){let d=i.get(o);if(d&&!re(e.scope,d))continue;let y=Z(s.map(De)),C=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):o);m$1.push({id:`project:${C}`,scope:"project",target:o,title:`Project impact: ${C}`,summary:s.map(j=>j.message).join(" "),risk:y,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?te(d):_()});}let l=m(r.currentModel),u=l?a(l):void 0,v=new Set(m$1.map(o=>o.project?.name).filter(o=>typeof o=="string")),P=new Map;for(let o of m$1)if(o.project?.name){let s=u?.byId.get(o.project.name);s&&(o.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(o.risk=Ce(o.risk),o.reasons=[...o.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),o.origin="direct",o.distance=0,P.set(o.project.name,o.risk);}let w=[],f=0;if(l&&v.size>0){let o=c(l,v);for(let s of o.values()){if(s.distance===0||v.has(s.id))continue;let d=n.get(s.id);if(d&&!re(e.scope,d))continue;let y=s.path[0],C=s.path[s.path.length-2]??y,j=P.get(y)??"medium",de=Re(j),M=u?.byId.get(s.id);f=Math.max(f,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 ${y}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:de,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?te(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((o,s)=>o.target.localeCompare(s.target));let ie=u?u.hotspots.flatMap(o=>{let s=u.byId.get(o);return s?[{project:o,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}]:[]}):[],ce=r.changes.filter(o=>!o.type.startsWith("project.")),K=r.currentModel.summary?.projectCount??r.currentModel.projects.length,R=ce.map(o=>({id:`workspace:${o.target}`,scope:"workspace",target:o.target,title:`Workspace impact: ${o.target}`,summary:o.message,risk:$e(o,{projectCount:K}),reasons:[`${o.type}: ${o.message}`],verification:_()})),B=Ae([...m$1.flatMap(o=>o.verification),...w.flatMap(o=>o.verification),...R.flatMap(o=>o.verification),...r.summary.changed?_():[]]).filter(o=>o.required),pe=Z([...m$1.map(o=>o.risk),...w.map(o=>o.risk),...R.map(o=>o.risk)]),z=xe({risk:pe,affectedProjects:m$1.length,projectCount:K,changes:r.changes}),q={changed:r.summary.changed,risk:z,affectedProjects:m$1.length,workspaceItems:R.length,recommendedCommands:B.length,blastRadius:{directlyAffected:m$1.length,transitivelyAffected:w.length,maxDistance:f,graphEdges:l?.edges.length??0}};return {schemaVersion:he,generatedAt:(e.now??new Date).toISOString(),fromRef:r.fromRef,diffRef:ae,workspace:{name:r.currentModel.workspace.name,profile:r.currentModel.workspace.profile,type:r.currentModel.workspace.type},summary:q,affectedProjects:m$1.sort((o,s)=>o.target.localeCompare(s.target)),transitiveImpact:w,criticalPathHotspots:ie,workspaceImpact:R.sort((o,s)=>o.target.localeCompare(s.target)),verificationPlan:B,agentBrief:Fe({changed:q.changed,risk:z,affectedProjects:m$1,workspaceImpact:R}),diff:r}}async function tt(e,t){return h$1(t,we,d$1(e))}export{Q as a,oe as b,L as c,T as d,ae as e,he as f,we as g,ye as h,ne as i,We as j,Ye as k,Qe as l,Pe as m,Ze as n,_ as o,et as p,tt as q};
|
package/dist/chunk-DLLHUG2Q.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {f,e,h as h$1,g}from'./chunk-XF65LQ6M.js';import {a as a$1,b as b$1}from'./chunk-MGL6DBOR.js';import {b as b$2,c}from'./chunk-ND5YAC4T.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {p,a as a$3}from'./chunk-G6ADWA2B.js';import {k as k$1,m,l}from'./chunk-YYELANJO.js';import {h}from'./chunk-FE5R6EUV.js';import {p as p$1,q}from'./chunk-ODK4LCEL.js';import {k,t,u}from'./chunk-VQZ5PI5J.js';import v from'fs';import s from'path';import a from'chalk';var ne=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function S(e){try{return await v.promises.access(e,v.constants.F_OK),true}catch{return false}}async function E(e){try{let n=JSON.parse(await v.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function b(e){try{return await v.promises.readFile(e,"utf-8")}catch{return ""}}function te(e){return a$1(e)}async function re(e,n){return await Z([...u(e,"project.json"),...u(e,"context.json")])?true:b$1(e)?false:s.resolve(e)===s.resolve(n)?k$1(e).length>0:k$1(e).length>0}async function oe(e){let n=await a$2(e,{skipDirs:ne,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:re}),o=(await a$3(e)).filter(i=>i.relationship==="adopted"||i.source==="adopted-local").map(i=>s.resolve(i.path)).filter(i=>v.existsSync(i)),r=[...new Set([...n.map(i=>s.resolve(i)),...o])];return r.length>0?r:b$1(e)?[]:k$1(e).length>0?[e]:[]}function ie(e,n){return s.relative(e,n).replace(/\\/g,"/")||"."}async function W(e,n){for(let t of n)if(await S(s.join(e,t)))return true;return false}async function Z(e){for(let n of e)if(await S(n))return true;return false}async function ee(e){for(let n of e){let t=await E(n);if(t)return t}return null}async function ae(e,n){if(await W(e,[".env",".env.local"]))return true;let t=n?.contracts&&typeof n.contracts=="object"?n.contracts:null;if(Array.isArray(t?.env)&&t.env.length>0)return true;let o=await E(s.join(e,"package.json")),r={...o?.dependencies??{},...o?.devDependencies??{}};if(Object.keys(r).some(d=>/^(?:dotenv|dotenv-flow|env-cmd)$/iu.test(d)))return true;let i=await b(s.join(e,"pyproject.toml"));if(/\b(?:python-dotenv|pydantic-settings)\b/iu.test(i))return true;let l=[await b(s.join(e,"compose.yaml")),await b(s.join(e,"compose.yml")),await b(s.join(e,"docker-compose.yml")),await b(s.join(e,"docker-compose.yaml"))].join(`
|
|
2
|
-
`);return /^\s*(?:env_file|environment)\s*:/imu.test(l)}async function se(e){return (await g(e)).detected}async function ce(e){let n=await E(s.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function y(e,n,t,o,r,i,l){return {id:e,severity:n,target:t,title:o,detail:r,remediation:i,...l&&l.length>0?{files:[...l]}:{}}}function de(e){let n=e.reduce((t,o)=>o.severity==="fail"?t+28:o.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function le(e,n,t){let o=await ee(u(n,"project.json")),r=m(n,o),i=l(n),l$1=r.runtime==="unknown"?i[0]||"unknown":r.runtime,d=[l$1,...i.filter($=>$!==l$1)],p=r.key==="unknown"&&new Set(d.filter($=>$!=="unknown")).size>1,A=await b$2(n,o,{runtime:l$1,framework:r.key}),f=["backend","service","worker"].includes(A),h=f&&/^(?:fastapi|django|flask|nestjs|express|fastify|springboot|gofiber|gogin|dotnet-webapi|laravel|rails|phoenix|axum|actix|rocket)$/u.test(r.key),k=ie(e,n),m$1=k,F=await ce(n),P=await Z([...u(n,"project.json"),...u(n,"context.json")]),x=await se(n),R=await W(n,["Dockerfile","dockerfile"]),z=await W(n,[".env.example","env.example","config/env.example"]),w=await ae(n,o),c$1=await c({projectPath:n,declaration:t?.governance}),u$1=c$1.ci.status==="repository",C=await h$1(n),g=[];return r.key==="unknown"&&g.push(y(p?"project.stack.aggregate":"project.stack.unknown",p?"info":"fail",m$1,p?"Multi-runtime aggregate boundary detected":"Project stack is unknown",p?`Workspai detected multiple runtimes (${d.join(", ")}) and intentionally did not promote one nested framework as the aggregate project identity.`:"Workspai cannot confidently classify this backend project.",p?"Adopt independently operated nested projects when they need separate lifecycle, ownership, or release evidence.":"Add .workspai/project.json metadata or import the project with `workspai import`.")),P||g.push(y("project.marker.missing","warn",m$1,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),x||g.push(y("project.tests.missing","warn",m$1,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),f&&w&&!z&&g.push(y("project.env.example.missing","info",m$1,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.",[".env.example"])),c$1.ci.status==="unknown"?g.push(y("project.ci.missing","warn",m$1,"CI governance is not proven","No repository CI surface or canonical external CI declaration was found for this project.","Add repository CI configuration or declare the external CI authority in the workspace contract.",[".github/workflows/ci.yml"])):c$1.ci.status==="external-observed"&&g.push(y("project.ci.external-observed","info",m$1,"Continuous integration appears externally managed",`Repository documentation references an external CI control plane (${c$1.ci.evidence.join(", ")}).`,"Declare the external CI provider in the canonical workspace contract when authoritative release gating depends on it.")),h&&!C&&g.push(y("project.health.missing","info",m$1,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),f&&!R&&g.push(y("project.container.missing","info",m$1,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.",["Dockerfile"])),{name:typeof o?.name=="string"&&o.name.trim()?o.name.trim():s.basename(n),path:n,relativePath:k,runtime:l$1,runtimeCandidates:d,framework:r.key,confidence:r.confidence,supportTier:r.supportTier,hasRapidKitMarker:P,hasTests:x,hasDockerfile:R,hasEnvExample:z,hasCiConfig:u$1,governance:c$1,hasHealthEndpoint:C,scripts:F,findings:g,score:de(g)}}function pe(e){return e.name.toLowerCase()}async function ue(e){let n=new Map(e.map(r=>[pe(r),r])),t=[];for(let r of e){let i=await E(s.join(r.path,"package.json")),l={...i?.dependencies??{},...i?.devDependencies??{},...i?.peerDependencies??{}};for(let p of Object.keys(l)){let A=p.replace(/^@[^/]+\//,"").toLowerCase(),f=n.get(A);f&&f.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:f.relativePath,kind:"package"});}let d=await b(s.join(r.path,"pyproject.toml"));for(let p of e)p.relativePath!==r.relativePath&&d.includes(p.name)&&t.push({from:r.relativePath,to:p.relativePath,kind:"workspace-reference"});}let o=new Set;return t.filter(r=>{let i=`${r.from}\0${r.to}\0${r.kind}`;return o.has(i)?false:(o.add(i),true)})}function me(e,n){let t=new Map;for(let o of e)t.set(o.relativePath,{project:o.relativePath,directDependents:0,directDependencies:0});for(let o of n){let r=t.get(o.from),i=t.get(o.to);r&&(r.directDependencies+=1),i&&(i.directDependents+=1);}return Array.from(t.values()).sort((o,r)=>r.directDependents-o.directDependents||r.directDependencies-o.directDependencies)}async function fe(e){let n=await ee(t(e,"workspace.json"));return typeof n?.profile=="string"?n.profile:null}function ge(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function ye(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasCanonicalGraph||n.push("Generate canonical topology with `workspai workspace model --write --include-evidence`."),n.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function Ge(e$1={}){let n=s.resolve(e$1.workspacePath||process.cwd());if(!await S(n))throw new Error(`Workspace path does not exist: ${n}`);let t=te(n)??n,o=k(t),r=await fe(t),i=await oe(t),l;try{l=(await p({workspacePath:t})).contract;}catch{}let d=await Promise.all(i.map(c=>{let u=l?.projects.find(C=>{let g=C.externalPath??C.relativePath;return s.resolve(t,g)===s.resolve(c)});return le(t,c,u)})),p$2=await ue(d),A=me(d,p$2),f$1=[];o||f$1.push(y("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),d.length===0&&f$1.push(y("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let h$1=[...f$1,...d.flatMap(c=>c.findings)],k$1=ge(h$1),m={};for(let c of d)for(let u of c.runtimeCandidates)m[u]=(m[u]||0)+1;let F=d.length>0?Math.round(d.reduce((c,u)=>c+u.score,0)/d.length):0,P=f$1.reduce((c,u)=>c+(u.severity==="fail"?20:u.severity==="warn"?8:2),0),x=Math.max(0,F-P),R=d.length===0&&k$1.fail===0&&h$1.length>0&&h$1.every(c=>c.id==="workspace.projects.missing"&&c.severity==="warn"),z=k$1.fail>0||e$1.strict&&k$1.warn>0&&!R?"blocked":k$1.warn>0?"needs-attention":"ready",w={schemaVersion:q.analyze,generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:o,profile:r,summary:{statusScope:"source-structure",releaseReadiness:"not-evaluated",score:x,verdict:z,projectCount:d.length,runtimeCount:Object.keys(m).length,findings:k$1},runtimes:m,projects:d,dependencyGraph:{status:p$2.length>0?"generated":"empty",edges:p$2,topImpactedProjects:A.slice(0,5)},findings:h$1,nextActions:ye({findings:h$1,projectCount:d.length,hasCanonicalGraph:await S(s.join(t,p$1.knowledgeGraph)),workspaceDetected:o}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:p$1.analyze}};if(e$1.output&&(await v.promises.mkdir(s.dirname(s.resolve(e$1.output)),{recursive:true}),await v.promises.writeFile(s.resolve(e$1.output),`${JSON.stringify(w,null,2)}
|
|
3
|
-
`)),!e$1.output&&o){let c=f(w,{commandId:"workspaceAnalyze",exitCode:w.summary.verdict==="blocked"?2:w.summary.verdict==="needs-attention"?1:0,generatedAt:w.generatedAt,blockers:w.findings.filter(u=>u.severity==="fail").map(u=>u.title).slice(0,12),runId:e()});await h(t,p$1.analyze,c);}return w}function We(e){let n=e.summary.verdict==="ready"?a.green:e.summary.verdict==="needs-attention"?a.yellow:a.red;if(console.log(a.bold(`
|
|
4
|
-
Workspai Workspace Analysis
|
|
5
|
-
`)),console.log(a.cyan("Workspace:"),e.workspacePath),console.log(a.cyan("Profile:"),e.profile||"not configured"),console.log(a.cyan("Source score:"),`${e.summary.score}/100`),console.log(a.cyan("Source verdict:"),n(e.summary.verdict)),console.log(a.cyan("Release readiness:"),e.summary.releaseReadiness),console.log(a.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(a.bold(`
|
|
6
|
-
Projects`));for(let t of e.projects){let o=t.score>=85?a.green("pass"):t.score>=65?a.yellow("watch"):a.red("risk");console.log(` ${t.relativePath} ${a.gray(`${t.runtime}/${t.framework}`)} ${o} ${t.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(a.bold(`
|
|
7
|
-
Dependency Graph`)),console.log(a.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(a.gray(" Top impacted projects:"));for(let t of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${t.project} (${t.directDependents} dependents, ${t.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(a.bold(`
|
|
8
|
-
Top Findings`));for(let t of e.findings.slice(0,8)){let o=t.severity==="fail"?a.red:t.severity==="warn"?a.yellow:a.gray;console.log(` ${o(t.severity.toUpperCase())} ${t.target}: ${t.title}`),console.log(a.gray(` ${t.remediation}`));}}console.log(a.bold(`
|
|
9
|
-
Next Actions`));for(let t of e.nextActions.slice(0,5))console.log(a.gray(` - ${t}`));console.log();}export{Ge as a,We as b};
|
package/dist/chunk-DTLLIA2C.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,c,d as d$1}from'./chunk-FYR4FD7K.js';import {a as a$3}from'./chunk-X7FYEKLI.js';import {c as c$2}from'./chunk-37SWTS2B.js';import {c as c$1,d as d$4}from'./chunk-N4B2M44I.js';import {a as a$1,b as b$1}from'./chunk-PYCJWW4B.js';import {p as p$1,a,o,g as g$1,d as d$3,f}from'./chunk-D6BL7ARI.js';import {q as q$1,m as m$1,d as d$5}from'./chunk-TGDXD4CD.js';import {d as d$2}from'./chunk-G6ADWA2B.js';import {g,h}from'./chunk-FE5R6EUV.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import {d}from'./chunk-EWZZUQBR.js';import {q,p,t,r,s}from'./chunk-ODK4LCEL.js';import m from'path';import v from'fs-extra';var fe="rapidkit-blocker-resolution-v1";function pe(e){let t=e.blockers.map(s=>s.trim()).filter(Boolean).slice(0,12),r=e.stderrTail?.trim().slice(-400)??"";return d$5({blockers:t,exitCode:e.exitCode??null,stderrTail:r})}function we(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 me(e){let t=we(e.reason),r=pe({blockers:[e.reason]}),s=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.",...e.sourceCommand?{}:{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:fe,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:r,commandRetryHint:t==="artifact-missing"?e.sourceCommand?`Run the source command once: ${e.sourceCommand}, then verify.`:"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:s,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 Ce(e){return e.length===0||e.every(t=>Re(t))}function ge(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&Ce(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function tt(e,t){let r=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${r} \u2014 add your first project to continue.`:`Workspace scaffold${r}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var ye=q.verify,G=p.verify;function Ae(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ke(e){let t=await v.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==f)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);a$2(t,"contracts/workspace-intelligence/workspace-impact.v1.json",`Workspace impact ${e}`);let s=r;a$2(s.diff,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Embedded workspace diff in ${e}`);let i=[];s.summary.affectedProjects!==s.affectedProjects.length&&i.push("summary.affectedProjects does not match affectedProjects.length"),s.summary.workspaceItems!==s.workspaceImpact.length&&i.push("summary.workspaceItems does not match workspaceImpact.length"),s.summary.recommendedCommands!==s.verificationPlan.length&&i.push("summary.recommendedCommands does not match verificationPlan.length"),s.summary.blastRadius.directlyAffected!==s.affectedProjects.length&&i.push("blastRadius.directlyAffected does not match affectedProjects.length"),s.summary.blastRadius.transitivelyAffected!==s.transitiveImpact.length&&i.push("blastRadius.transitivelyAffected does not match transitiveImpact.length");let o=s.transitiveImpact.reduce((u,d)=>Math.max(u,d.distance??0),0);s.summary.blastRadius.maxDistance!==o&&i.push("blastRadius.maxDistance does not match transitive impact distances");let k=m$1(s.diff.currentModel)?.edges.length??0;if(s.summary.blastRadius.graphEdges!==k&&i.push("blastRadius.graphEdges does not match the embedded model graph"),s.summary.changed!==s.diff.summary.changed&&i.push("summary.changed does not match embedded diff summary"),s.fromRef!==s.diff.fromRef&&i.push("fromRef does not match embedded diff fromRef"),s.workspace.name!==s.diff.currentModel.workspace.name&&i.push("workspace.name does not match the embedded model"),s.diff.toHash!==d(s.diff.currentModel)&&i.push("embedded diff current-model hash does not match toHash"),i.length>0)throw new Error(`Workspace impact semantic integrity failed: ${i.join("; ")} (${e})`);return s}function Ee(e){let t=new Set,r=[];for(let s of e){let i=`${s.scope}:${s.project??""}:${s.display}`;t.has(i)||(t.add(i),r.push(s));}return r}function Se(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function We(e,t){if(e.id==="workspace.doctor")return m.join(t,p.doctor);if(e.id==="workspace.contract.verify")return m.join(t,p.contractVerify);if(e.id==="workspace.readiness")return m.join(t,p.readiness);if(e.id==="workspace.analyze")return m.join(t,".workspai","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return m.join(t,".workspai","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return m.join(t,".workspai","reports","doctor-fix-result-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return m.join(t,".workspai","reports","workspace-run-last.json")}function C(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function je(e){if(!c$1(e,"workspace"))return {status:"fail",message:"Doctor evidence contract is missing or unsupported."};try{d$4(e);}catch(s){return {status:"fail",message:`Doctor evidence semantic validation failed: ${s instanceof Error?s.message:String(s)}`}}let t=a$3(e);return t.hasSystemErrors||t.blockingFindings>0?{status:"fail",message:`Doctor evidence reports ${t.blockingFindings} canonical blocking finding(s).`}:t.advisoryFindings+t.unknownFindings+t.contradictionCount+t.missingDiagnosisProjects>0||t.staleEvidence||t.unknownFreshness||t.minimumDiagnosisCompleteness<100?{status:"warn",message:`Doctor evidence needs attention (${t.advisoryFindings} advisory, ${t.unknownFindings} unknown, ${t.contradictionCount} contradictory; ${t.minimumDiagnosisCompleteness}% complete).`}:{status:"pass",message:"Canonical Doctor evidence is complete, fresh, and healthy."}}function xe(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 Pe(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 Ie(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Analyze evidence reports blocking findings."}:r==="needs-attention"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is ready."}}function Ve(e){let t=e.schemaVersion===s.doctorFixResult.schemaVersion?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 r=t,s$1=Array.isArray(r.remainingBlockers)?r.remainingBlockers:[];if(s$1.length>0)return {status:"fail",message:`Doctor fix result reports ${s$1.length} remaining blocker(s).`};let i=Array.isArray(r.appliedFixes)?r.appliedFixes:[];return i.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${i.length} applied fix(es) with no remaining blockers.`}}async function Fe(e,t$1){let r=await g(e,t.doctorRemediationPlan);if(!r)return false;try{let s=C(await v.readJson(r));if(!s||(Array.isArray(s.steps)?s.steps:[]).length>0)return false;let o=typeof s.generatedAt=="string"?s.generatedAt:void 0;if(!o||!t$1)return true;let k=Date.parse(o),u=Date.parse(t$1);return !Number.isFinite(k)||!Number.isFinite(u)?true:k>=u}catch{return false}}function $e(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function Oe(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function De(e,t,r){let s=$e(t),i=c$2(e,s??void 0);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let o=i.stage;if(s&&o!==s)return {status:"missing",message:`Workspace run evidence is for stage "${o}", expected "${s}".`};let k=Array.isArray(i.projects)?i.projects:[],u=t.project?.toLowerCase();if(!u)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let d=k.find(g=>{let c=C(g);if(!c)return false;let n=typeof c.projectName=="string"?c.projectName.toLowerCase():"",a=["projectPath","relativePath","path"].map(f=>c[f]).filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.replace(/\\/g,"/").toLowerCase());return n===u||a.some(f=>f.endsWith(`/${u}`)||f===u)});if(d){let g=R(i.generatedAt,r,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let c=C(d),n=typeof c?.status=="string"?c.status:"unknown";return n==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:n==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:n==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${n} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function R(e,t,r){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${r} is stale: missing generatedAt timestamp (required after impact ${t}).`;let s=Date.parse(e),i=Date.parse(t);return Number.isFinite(s)?Number.isFinite(i)&&s<i?`${r} is stale: generated at ${e}, before impact ${t}.`:null:`${r} is stale: invalid generatedAt timestamp (required after impact ${t}).`}function Be(e){if(e.id==="workspace.doctor")return r.doctor;if(e.id==="workspace.readiness")return r.readiness;if(e.id==="workspace.contract.verify")return r.contractVerify;if(e.id==="workspace.analyze")return r.analyze;if(e.id==="workspace.pipeline")return "contracts/pipeline-last-run.v1.json"}async function _e(e,t,r,s$1){let i=We(e,t),o=i?m.relative(t,i).split(m.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)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."};let k=i?await g(t,o??""):null;if(!i||!k)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:o,message:o?`Missing evidence report: ${o}`:"No evidence mapping exists for this command."};let u;try{u=await v.readJson(k);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is unreadable JSON: ${n instanceof Error?n.message:String(n)}`}}let d=C(u);if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:"Evidence report is not a JSON object."};let g$1=Be(e);if(g$1)try{a$2(d,g$1,`${e.label} evidence`);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is invalid: ${n instanceof Error?n.message:String(n)}`}}let c;if(e.id==="workspace.doctor"){let n=R(d.generatedAt,s$1,"Doctor evidence");n?c={status:"fail",message:n}:c=je(d);}else if(e.id==="workspace.readiness"){let n=R(d.generatedAt,s$1,"Release readiness evidence");n?c={status:"fail",message:n}:c=xe(d);}else if(e.id==="workspace.contract.verify"){let n=R(d.generatedAt,s$1,"Workspace contract verify evidence");n?c={status:"fail",message:n}:c=Pe(d);}else if(e.id==="workspace.analyze"){let n=R(d.generatedAt,s$1,"Analyze evidence");n?c={status:"fail",message:n}:c=Ie(d);}else if(e.id==="workspace.pipeline"){let n=R(d.generatedAt,s$1,"Pipeline evidence");n?c={status:"fail",message:n}:c=Oe(d);}else if(e.id==="workspace.doctor-fix"){let n=d.schemaVersion===s.doctorFixResult.schemaVersion?d:d.fixResult,a=C(n),f=typeof a?.generatedAt=="string"?a.generatedAt:void 0,y=R(f,s$1,"Doctor fix result");y?c={status:"fail",message:y}:await Fe(t,f)?c={status:"skipped",message:"No current doctor remediation steps are pending."}:c=Ve(d);}else if(e.id.startsWith("project."))c=De(d,e,s$1);else {let n=R(d.generatedAt,s$1,"Evidence report");n?c={status:"fail",message:n}:c={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:c.status,required:e.required,evidencePath:o,message:c.message}}function Ne(e,t={blockingReasons:[],needsAttention:false}){let r=e.filter(n=>n.status==="pass").length,s=e.filter(n=>n.status==="warn").length,i=e.filter(n=>n.status==="fail").length,o=e.filter(n=>n.status==="missing").length,k=e.filter(n=>n.status==="skipped").length,u=e.filter(n=>n.required&&(n.status==="fail"||n.status==="missing")).map(n=>`${n.id}: ${n.message}`),d=e.filter(n=>n.required&&n.status==="missing").length,g="ready",c=0;return u.length>0||t.blockingReasons.length>0?(g="blocked",c=2):(s>0||e.some(n=>!n.required&&n.status==="fail")||d>0||t.needsAttention)&&(g="needs-attention",c=1),{verdict:g,exitCode:c,stepsPassed:r,stepsWarn:s,stepsFailed:i,stepsMissing:o,stepsSkipped:k}}function He(e,t){let r=x(e.affectedProjects.map(a=>a.project?.name).filter(a=>typeof a=="string")),s=new Set(r.map(a=>a.toLowerCase())),i=x(e.transitiveImpact.map(a=>a.project?.name).filter(a=>typeof a=="string").filter(a=>!s.has(a.toLowerCase()))),o=new Map;for(let a of t){if(a.scope!=="project"||!a.project)continue;let f=a.project.toLowerCase(),y=o.get(f)??[];y.push(a),o.set(f,y);}let k=[],u=[],d=[],g=[],c=false,n=(a,f)=>{let y=o.get(a.toLowerCase())??[];if(y.length===0){d.push(a);return}let P=y.filter(p=>p.status==="fail"),b=P.filter(p=>p.required),I=y.filter(p=>p.status==="missing"),E=I.filter(p=>p.required),V=y.some(p=>p.status==="pass"||p.status==="warn");if(b.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has failed verification evidence (${b.map(p=>p.id).join(", ")}).`);return}if(P.length>0){u.push(a),c=true;return}if(E.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has missing required verification evidence (${E.map(p=>p.id).join(", ")}).`);return}if(I.length>0){u.push(a),c=true;return}if(V){k.push(a);return}d.push(a);};for(let a of r)n(a,"directly-changed");for(let a of i)n(a,"transitive dependent");return {subgraph:{totalProjects:r.length+i.length,directlyChanged:r,transitiveDependents:i,covered:x(k),uncovered:x(u),unverifiable:x(d)},blockingReasons:g,needsAttention:c}}function x(e){return [...new Set(e)].sort((t,r)=>t.localeCompare(r))}async function Me(e){let t=m.resolve(e.workspacePath);if(e.fromImpactPath){let o=Ae(t,e.fromImpactPath);return {impact:await ke(o),fromImpactRef:m.relative(t,o).split(m.sep).join("/"),impactFromDisk:true}}let r=m.join(t,g$1);if(await v.pathExists(r))return {impact:await ke(r),fromImpactRef:g$1,impactFromDisk:true};let s=m.join(t,d$3);if(await v.pathExists(s))return {impact:await p$1({workspacePath:t,fromPath:d$3,scope:e.scope,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),fromImpactRef:d$3,impactFromDisk:false};let i=await q$1({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {impact:{schemaVersion:f,generatedAt:(e.now??new Date).toISOString(),fromRef:"baseline",diffRef:p.diff,workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:m$1(i)?.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:q.diff,generatedAt:(e.now??new Date).toISOString(),fromRef:"baseline",toRef:p.model,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:i}},impactFromDisk:false}}function Te(e,t){if(t)return e.generatedAt}async function bt(e){let t=m.resolve(e.workspacePath),{impact:r,fromImpactRef:s,impactFromDisk:i}=await Me(e),o$1=r.diff.currentModel,k=i?await q$1({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}):o$1,u=[];if(i){let l=await p$1({workspacePath:t,fromPath:r.diff.fromRef,diff:r.diff,scope:e.scope,now:e.now}),W=[r.affectedProjects,r.transitiveImpact,r.verificationPlan],A=[l.affectedProjects,l.transitiveImpact,l.verificationPlan];JSON.stringify(W)!==JSON.stringify(A)&&u.push("workspace.impact: Persisted impact semantics do not match the impact re-derived from the embedded diff. Regenerate diff and impact.");}i&&d(k)!==r.diff.toHash&&u.push("workspace.impact: Impact evidence is stale because the current workspace model no longer matches the embedded model. Regenerate diff and impact.");let d$2=r.diff.git;if(i&&d$2?.available){let l=a(t,{ref:d$2.ref}),W=r.diff.changes.filter(h=>h.type.startsWith("git.")).map(h=>`${h.type}:${h.target.replace(/^git:/,"")}`).sort(),A=[...l.changedFiles.map(h=>`git.file.changed:${h}`),...l.untrackedFiles.map(h=>`git.untracked:${h}`),...l.deletedFiles.map(h=>`git.deleted:${h}`)].sort();(!l.available||l.commit!==d$2.commit||JSON.stringify(A)!==JSON.stringify(W))&&u.push("workspace.impact: Impact evidence is stale because Git changes no longer match the diff observation. Regenerate diff and impact.");}let g=Te(r,i),c$1=Ee([...o(),...r.verificationPlan]).filter(l=>Se(e.scope,l)),n=[];for(let l of c$1)n.push(await _e(l,t,o$1.contracts.exists===true,g));let a$2=He(r,n),f=a$1(m$1(o$1)??{nodes:[],edges:[]}),y=b(o$1),P=await Ke(t),b$2=c(y,P?.freshness?.projectHashes),I={verdict:b$2.verdict,baseline:b$2.baseline,changed:b$2.changed,added:b$2.added,removed:b$2.removed,projectHashes:d$1(y)},E=b$1(f),V=o$1.policies?.mode??"warn",p=await Le(o$1,t),B=qe(V,p),S=Ne(n,{blockingReasons:[...a$2.blockingReasons,...E,...B.blockingReasons,...u],needsAttention:a$2.needsAttention||B.needsAttention}),he=n.filter(l=>l.status==="missing"&&l.evidencePath).map(l=>l.evidencePath),_=[...n.filter(l=>l.required&&(l.status==="fail"||l.status==="missing")).map(l=>`${l.id}: ${l.message}`),...a$2.blockingReasons,...E,...B.blockingReasons,...u],ve=p.filter(l=>l.severity==="error").length,be=o$1.summary?.projectCount??o$1.projects.length,U=ge({projectCount:be,verdict:S.verdict,exitCode:S.exitCode,blockingReasons:_,policyErrorCount:ve});S.verdict=U.verdict,S.exitCode=U.exitCode;let Y=Array.from(new Set(_.map(l=>l.trim()).filter(Boolean))).slice(0,12).map((l,W)=>{let A=n.find(h=>l.startsWith(`${h.id}:`));return me({reason:l,blockerId:`blocker-${W+1}`,sourceCommand:A?.command.display,sourceArtifact:A?.evidencePath,verifyCommand:"npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json",verifyArtifact:G})});return {schemaVersion:ye,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:s,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:S,steps:n,missingEvidence:he,blockingReasons:_,...Y.length>0?{resolutionHints:Y}:{},verificationPlan:c$1,affectedSubgraph:a$2.subgraph,graphIntegrity:f,freshness:I,policyMode:V,policyViolations:p}}async function Le(e,t){let r=[];for(let i of e.validation?.issues??[])r.push({source:"model",severity:i.severity,code:i.code,message:i.message,target:i.target});let s=await g(t,p.contractVerify);try{if(s&&await v.pathExists(s)){let i=await v.readJson(s);if(Array.isArray(i.violations))for(let o of i.violations)typeof o=="string"&&o.trim().length>0&&r.push({source:"contract",severity:"error",code:"contract.violation",message:o});}}catch{}return r.sort((i,o)=>i.source!==o.source?i.source.localeCompare(o.source):i.code!==o.code?i.code.localeCompare(o.code):i.message.localeCompare(o.message))}function qe(e,t){let r=t.filter(s=>s.severity==="error");return e==="enforce"&&r.length>0?{blockingReasons:r.map(s=>`policy.${s.code}: ${s.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:r.length>0}}async function Ke(e){let t=m.join(e,G);try{if(!await v.pathExists(t))return null;let r=await v.readJson(t);return r&&r.schemaVersion===ye?r:null}catch{return null}}async function wt(e,t){return h(t,G,d$2(e))}function ze(e,t){let r=t?.strict?"strict":"default",s=[];if(e.summary.verdict==="blocked")return s.push(...e.blockingReasons),s.length===0&&s.push("verify verdict is blocked."),{passed:false,mode:r,exitCode:2,reasons:s};if(r==="strict"){if(e.summary.verdict!=="ready"&&s.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let i=[...e.freshness.changed,...e.freshness.added].slice(0,5);s.push(`freshness is stale${i.length>0?`: ${i.join(", ")}`:""} (strict requires fresh).`);}if(s.length>0)return {passed:false,mode:r,exitCode:1,reasons:s}}return {passed:true,mode:r,exitCode:0,reasons:s}}function Rt(e,t){return ze(e,t).exitCode}export{fe as a,tt as b,ye as c,G as d,He as e,bt as f,wt as g,ze as h,Rt as i};
|
package/dist/chunk-FYR4FD7K.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {d,m}from'./chunk-TGDXD4CD.js';import {a,b}from'./chunk-S5KTATOU.js';function u(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function w(r){let s=u(r),n=m(r)??{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)??d({missing:t.id}),l=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,f)=>c.localeCompare(f)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:l})});}return o}function y(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 M(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{u as a,w as b,y as c,M as d};
|
package/dist/chunk-H5DRKXXC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k,q as q$1}from'./chunk-46QH3ZVI.js';import {a}from'./chunk-G6ADWA2B.js';import {c,j as j$1}from'./chunk-5EVBOUYW.js';import {m as m$2}from'./chunk-YYELANJO.js';import {e,f}from'./chunk-PKKSRXUS.js';import {b}from'./chunk-UJXE4UAX.js';import {m as m$1,t,k as k$2,u,l}from'./chunk-VQZ5PI5J.js';import le,{promises}from'fs';import c$1 from'path';import U,{homedir}from'os';import {pathToFileURL}from'url';import m from'process';import k$1 from'fs-extra';function Q(o){let t=o.label.indexOf(" \u2014 ");return t>=0?o.label.slice(t+3).trim():o.label.trim()}function X(){let o=c().map(n=>({value:n.id,label:`${D(n.category)} \xB7 ${Q(n)}`,hint:`${n.runtime} \xB7 tested baseline`,name:n.label})),e=k().map(n=>({value:n.kitId,label:`Frontend \xB7 ${n.displayName}`,hint:"official \xB7 latest stable",name:`${n.displayName} \u2014 ${n.framework}`})),t=q$1().map(n=>({value:n.kitId,label:`${D(n.category)} \xB7 ${n.displayName}`,hint:`${n.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${n.displayName} \u2014 ${n.category}`})),r=[...o,...e,...t].sort((n,i)=>{let s=["Backend","Frontend","Desktop","Extension"],a=n.label?.split(" \xB7 ")[0]??"",l=i.label?.split(" \xB7 ")[0]??"";return s.indexOf(a)-s.indexOf(l)||(n.label??"").localeCompare(i.label??"")});return T(r),r}function D(o){return o.charAt(0).toUpperCase()+o.slice(1)}function T(o){let e=new Set,t=new Set;for(let r of o){let n=r.label??r.name??String(r.value),i=String(r.value);if(e.has(n))throw new Error(`Duplicate kit picker label: ${n}`);if(t.has(i))throw new Error(`Duplicate kit picker value: ${i}`);e.add(n),t.add(i);}}var ee=".workspairc.json",oe=".rapidkitrc.json",te=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],ne=["workspai.config.json","rapidkit.config.json"];function B(o){return typeof o=="object"&&o!==null&&"code"in o&&o.code==="ENOENT"}function C(o,e){let t=e instanceof Error?e.message:String(e),r=o.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${o}.${r} Cause: ${t}`}async function Qe(){for(let o of [c$1.join(U.homedir(),ee),c$1.join(U.homedir(),oe)])try{let e$1=await promises.readFile(o,"utf-8"),t=JSON.parse(e$1);return e.debug(`Loaded config from ${o}`),t}catch{}return e.debug("No user config found, using defaults"),{}}async function Xe(o=process.cwd(),e$1={}){let t=o,r=c$1.parse(t).root;for(;t!==r;){for(let n of ne){let i=c$1.join(t,n);try{let s=await promises.readFile(i,"utf-8"),a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${n}`),a}catch(s){if(B(s))continue;throw new Error(C(i,s))}}for(let n of te){let i=c$1.join(t,n);try{await promises.access(i);}catch(s){if(B(s))continue;throw new Error(C(i,s))}if(e.debug(`Found config file: ${i}`),!e$1.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${i} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let a=await import(pathToFileURL(i).href),l=a.default||a;return e.debug(`Loaded Workspai config from ${n}`),l}catch(s){throw new Error(C(i,s))}}t=c$1.dirname(t);}return e.debug("No Workspai config file found, using defaults"),{}}function Ze(o,e,t){return {author:t.author||e.workspace?.defaultAuthor||o.author,pythonVersion:t.pythonVersion||e.workspace?.pythonVersion||o.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||e.workspace?.installMethod||o.defaultInstallMethod,defaultKit:t.defaultKit||e.projects?.defaultKit||o.defaultKit,skipGit:t.skipGit??e.projects?.skipGit??o.skipGit,license:t.license||o.license,testRapidKitPath:t.testRapidKitPath||o.testRapidKitPath}}function eo(o){return f("DEV_PATH")||o.testRapidKitPath||void 0}var j=class extends Error{constructor(t,r){super(["Workspai workspaces cannot be nested.",`Target: ${t}`,`Containing workspace: ${r}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
|
|
2
|
-
`));this.targetPath=t;this.containingWorkspacePath=r;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function ie(o){try{return !!await k$1.stat(o)}catch{return false}}function se(o,e){let t=o.indexOf(e);if(t>=0&&t+1<o.length)return o[t+1];let r=o.find(n=>n.startsWith(`${e}=`));if(r)return r.slice(e.length+1)}function ae(o){return o.includes("--here")}async function J(o){let e=c$1.resolve(o);for(;;){let t=[c$1.join(e,".workspai-workspace"),c$1.join(e,".rapidkit-workspace"),c$1.join(e,".workspai","workspace.json"),c$1.join(e,".rapidkit","workspace.json")];if((await Promise.all(t.map(ie))).some(Boolean))return e;let r=c$1.dirname(e);if(r===e)return;e=r;}}async function po(o){let e=c$1.resolve(o),t=await J(c$1.dirname(e));if(t)throw new j(e,t)}async function ce(o,e=homedir()){let r=[{value:"managed",label:"Managed home",hint:l(e)}];return await J(o)||r.push({value:"here",label:"Current directory",hint:o}),r}function V(o,e=m.cwd()){if(ae(o))return c$1.resolve(e);let t=se(o,"--output");if(t)return c$1.resolve(t)}function uo(o,e=m.cwd()){let t=c$1.resolve(o),r=c$1.resolve(e),n=c$1.relative(r,t);return n.length>0&&!n.startsWith("..")&&!c$1.isAbsolute(n)?`cd ${n}`:`cd ${t}`}function mo(o,e={}){let t=e.argv??[],r=e.outputParent??V(t,m.cwd());return m$1(o.trim(),{homeDir:e.homeDir,outputDir:r})}function fo(o,e,t={}){return o?c$1.resolve(o)===c$1.resolve(e)?true:t.outputParent===void 0:false}async function go(o,e={}){let t=e.cwd??m.cwd(),r=e.homeDir??homedir(),n=V(o,t);if(n!==void 0)return n;let i=e.hasYes??(o.includes("--yes")||o.includes("-y"));if(!(e.interactive??(!i&&!!m.stdin.isTTY&&!b())))return;let a=await ce(t,r);if(a.length===1)return;let{location:l}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:a,default:0}]);if(l==="here")return c$1.resolve(t)}var pe=["minimal","python-only","node-only","go-only","java-only","dotnet-only","polyglot","enterprise"],de=new Set(["minimal","node-only","go-only","java-only","dotnet-only"]),xo=new Set(["python-only","polyglot","enterprise"]);function ue(o){return typeof o=="string"&&pe.includes(o)}function jo(o){return ue(o)&&de.has(o)}var q={"python-only":"python","node-only":"node","go-only":"go","java-only":"java","dotnet-only":"dotnet"},me={python:"Python",node:"Node",go:"Go",java:"Java",dotnet:".NET",php:"PHP",ruby:"Ruby",rust:"Rust",elixir:"Elixir",clojure:"Clojure",scala:"Scala",kotlin:"Kotlin",deno:"Deno",bun:"Bun",c:"C",cpp:"C++",unknown:"Unknown"},fe={python:"python-only",node:"node-only",go:"go-only",java:"java-only",dotnet:"dotnet-only"},H=["node","deno","bun","python","go","java","kotlin","scala","dotnet","php","ruby","rust","elixir","clojure","c","cpp","unknown"];function E(o){return o==="bun"||o==="deno"?"node":o==="kotlin"||o==="scala"?"java":o}function v(o){return typeof o!="string"||o.trim().length===0?"minimal":o.trim().toLowerCase()}function g(o){if(typeof o!="string")return "unknown";let e=o.trim().toLowerCase();return e==="python"||e==="node"||e==="go"||e==="java"||e==="dotnet"||e==="php"||e==="ruby"||e==="rust"||e==="elixir"||e==="clojure"||e==="scala"||e==="kotlin"||e==="deno"||e==="bun"||e==="c"||e==="cpp"?e:e==="c++"||e==="cplusplus"||e==="cc"||e==="clang++"||e==="g++"?"cpp":e==="clang"||e==="gcc"?"c":"unknown"}function w(o){let e=new Set;for(let t of o)e.add(g(t));return [...e].sort((t,r)=>H.indexOf(t)-H.indexOf(r))}function ge(o){let e=w(o).filter(t=>t!=="unknown");if(e.length!==0)return e.length===1?fe[e[0]]:"polyglot"}function Y(o,e={}){return `npx workspai bootstrap --profile ${o}${e.ci?" --ci --json":""}`}function he(o,e){return o?"none":e==="strict"?"error":"warning"}function h(o){let e=o.ok?void 0:ge(o.runtimes)??"polyglot";return {ok:o.ok,checkId:o.checkId,status:o.ok?"passed":"failed",profile:o.profile,runtimes:o.runtimes,message:o.message,recommendedProfile:e,recommendedCommand:e?Y(e):void 0,ciRecommendedCommand:e?Y(e,{ci:true}):void 0,severity:he(o.ok,o.mode)}}function Eo(o){let e=v(o.profile),t=w(o.runtimes),r=o.mode??"warn",n=q[e];if(n){let i=t.length===0||t.every(s=>E(s)===n);return h({ok:i,checkId:`profile.${e}`,profile:e,runtimes:t,message:i?`${e} profile validated for discovered projects.`:`${e} profile mismatch: detected runtimes [${t.join(", ")}].`,mode:r})}if(e==="minimal"){let i=t.filter(l=>l!=="unknown"),a=new Set(i.map(l=>E(l))).size<=1;return h({ok:a,checkId:"profile.minimal",profile:e,runtimes:t,message:a?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${i.join(", ")}].`,mode:r})}return h({ok:true,checkId:`profile.${e}`,profile:e,runtimes:t,message:`${e} profile accepts the detected runtime mix.`,mode:r})}function vo(o){let e=v(o.profile),t=g(o.runtime),r=o.mode??"warn",n=q[e];if(!n||t==="unknown")return h({ok:true,checkId:`profile.${e}`,profile:e,runtimes:[t],message:t==="unknown"?`Project "${o.subjectLabel}" runtime is unknown; profile compatibility will be checked by workspace doctor.`:`${e} profile accepts project "${o.subjectLabel}".`,mode:r});let i=E(t)===n;return h({ok:i,checkId:`profile.${e}`,profile:e,runtimes:i?[t]:w([n,t]),message:i?`Project "${o.subjectLabel}" is compatible with workspace profile "${e}".`:`Project "${o.subjectLabel}" is ${me[t]}, but workspace profile is "${e}".`,mode:r})}async function Fo(o){let e=(await Promise.all(t(o,"policies.yml").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "warn";try{return (await k$1.readFile(e,"utf-8")).match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}catch{return "warn"}}async function Io(o){let e=(await Promise.all(t(o,"workspace.json").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "minimal";try{let t=await k$1.readJson(e);return v(t.profile)}catch{return "minimal"}}async function $o(o,e={}){let t=new Set,r=[],n=new Set,i=[o];for(;i.length>0;){let s=i.pop();if(!s||n.has(s))continue;n.add(s);let a=[];try{a=await le.promises.readdir(s,{withFileTypes:true});}catch{continue}for(let l of a){if(!l.isDirectory()||l.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(l.name))continue;let p=c$1.join(s,l.name);if(p!==o&&k$2(p))continue;if((await Promise.all([...u(p,"context.json"),...u(p,"project.json")].map(async z=>k$1.pathExists(z)))).some(Boolean)){r.push(p);continue}i.push(p);}}for(let s of r){if(e.excludeProjectPath&&c$1.resolve(s)===c$1.resolve(e.excludeProjectPath))continue;let a=j$1(s);t.add(g(m$2(s,a).runtime));}for(let s of await a(o))e.excludeProjectPath&&c$1.resolve(s.path)===c$1.resolve(e.excludeProjectPath)||t.add(g(s.runtime));for(let s of e.additionalRuntimes??[])t.add(g(s));return w(t)}function Ao(o,e={}){let t=e.ci?o.ciRecommendedCommand:o.recommendedCommand;return t?`Recommended: ${t}`:null}export{X as a,Qe as b,Xe as c,Ze as d,eo as e,po as f,uo as g,mo as h,fo as i,go as j,xo as k,jo as l,Eo as m,vo as n,Fo as o,Io as p,$o as q,Ao as r};
|
package/dist/chunk-IUOMBLRR.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-COICGD62.js';import {b}from'./chunk-5Y4YRYZI.js';import {q as q$1,f,g}from'./chunk-TGDXD4CD.js';import {d}from'./chunk-G6ADWA2B.js';import {h,g as g$1}from'./chunk-FE5R6EUV.js';import {q,p}from'./chunk-ODK4LCEL.js';import E from'path';import A from'fs-extra';var re=q.agentContext,se=p.agentContext;function ne(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="gemini"||t==="qwen"||t==="kimi"||t==="grok"||t==="copilot"||t==="windsurf"||t==="amazon-q"||t==="orca"?t:"generic"}function G(e){return `npx --yes --package workspai workspai ${e}`.trim()}function x(e){return `npx workspai ${e}`.trim()}async function C(e,t,i){let s=E.join(e,t);if(!await A.pathExists(s))return null;try{let n=await A.readJson(s);return typeof n!="object"||n===null||!("schemaVersion"in n)||n.schemaVersion!==i?null:n}catch{return null}}function m(e){return {id:e.id,scope:e.scope,display:x(e.args),execute:G(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:f({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:x(e.args),execute:G(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:p.model,sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function L(e,t){return `workspace run ${t} --scope project:${e.name}`}function ae(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function oe(e){return [e.name,e.path,E.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function ie(e,t,i){let s={generatedAt:e.generatedAt,now:i},n=[m({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...s}),m({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...s}),m({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...s}),m({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...s}),m({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...s}),m({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...s}),m({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...s}),m({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...s})],c=t?[t]:e.projects;for(let a of c)a.commands.fleetStages.includes("test")&&n.push(m({id:`project.${a.name}.test`,scope:"project",project:a.name,args:L(a,"test"),description:`Run tests for ${a.name} through workspace orchestration.`,...s})),a.commands.fleetStages.includes("build")&&n.push(m({id:`project.${a.name}.build`,scope:"project",project:a.name,args:L(a,"build"),description:`Build ${a.name} through workspace orchestration.`,...s}));return n}function ce(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function pe(e,t){if(!t?.startsWith("project:"))return;let i=ae(t);if(i)return e.projects.find(s=>oe(s).includes(i))}function de(e,t,i){let s=[...e.validation?.issues??[]];t?.startsWith("project:")&&!i&&s.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let n=s.filter(a=>a.severity==="error").length,c=s.filter(a=>a.severity==="warning").length;return {status:n>0?"failed":c>0?"warning":"passed",errors:n,warnings:c,issues:s}}async function me(e,t){let i=[],s=[];for(let[n,c]of Object.entries(e.evidence))c&&await g$1(t,c.path)!==null?i.push(`${n}: ${c.path}`):s.push(n);return {available:i.sort(),missing:s.sort()}}function le(e){let t=e.summary.projectCount,i=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",s=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"}, ${i}, and ${s}.`}function ge(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.extendedProjects??0)>0||e.summary.observedProjects>0)&&t.push("Some projects use extended or observed support tiers; command coverage may be partial."),t}async function We(e){let t=e.model??await q$1({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),i=ne(e.agent),s=pe(t,e.scope),n=de(t,e.scope,s);if(e.strict===true&&n.status!=="passed"){let r=n.issues.map(g=>`${g.severity}:${g.code}:${g.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${r}`)}let c=e.now??new Date,a=t.facts??[],K=new Set((s?[s]:t.projects).map(r=>r.name)),R=a.filter(r=>r.project?K.has(r.project):true),H=(s?[s]:t.projects).map(r=>{let g=R.filter(p=>p.project===r.name);return {name:r.name,path:r.path,kind:r.kind,category:r.category,runtime:r.runtime,framework:r.frameworkDisplayName,...r.generator?{generator:r.generator}:{},createCapability:r.createCapability,supportTier:r.supportTier,...r.governance?{governance:r.governance}:{},safeCommands:ce(r),importantFiles:r.importantFiles,facts:g}}),S=await me(t,e.workspacePath),F=E.join(e.workspacePath,p.knowledgeGraph),u=await A.pathExists(F)?await A.readJson(F).catch(()=>null):null,N=false;if(u?.schemaVersion===q.knowledgeGraph)try{b(u,t),N=true;}catch{}let $=le(t),M=ie(t,s,c),b$2=await C(e.workspacePath,p.impact,q.impact),l=await C(e.workspacePath,p.doctor,q.doctor),v=await C(e.workspacePath,p.analyze,q.analyze),k=await C(e.workspacePath,p.readiness,q.readiness),h=await C(e.workspacePath,p.verify,q.verify),w=await C(e.workspacePath,p.explain,q.explain),f$1=await C(e.workspacePath,p.diff,q.diff),B=b$2?.summary?{changed:b$2.summary.changed,risk:b$2.summary.risk,affectedProjects:b$2.summary.affectedProjects,blastRadius:b$2.summary.blastRadius,recommendedCommands:b$2.summary.recommendedCommands}:void 0,U=l?.summary?{verdict:l.summary.verdict,totalIssues:l.summary.totalIssues,advisoryFindings:l.summary.advisoryFindings,blockingFindings:l.summary.blockingFindings,unknownFindings:l.summary.unknownFindings,hasSystemErrors:l.summary.hasSystemErrors,topSignals:(()=>{let r=Array.isArray(l.projects)?l.projects:[],g=[];for(let p of r.slice(0,6)){let te=Array.isArray(p.probes)?p.probes:[];for(let y of te.slice(0,10))(y?.status==="fail"||y?.severity==="error")&&g.push({label:y.label,scope:y.scope,issueClass:y.issueClass,status:y.status,severity:y.severity,recommendation:y.recommendation});}return g.slice(0,8)})()}:void 0,J=v?.summary?{score:v.summary.score,verdict:v.summary.verdict,findingCounts:v.summary.findings,topFindings:(Array.isArray(v.findings)?v.findings:[]).filter(p=>p?.severity==="fail"||p?.severity==="warn").slice(0,8).map(p=>({severity:p.severity,title:p.title,target:p.target,remediation:p.remediation}))}:void 0,X=k?{overallStatus:k.overallStatus,blocking:k.blocking,blockingReasons:k.blockingReasons,evidencePath:k.evidencePath,gates:Array.isArray(k.gates)?k.gates.slice(0,6).map(r=>({gate:r.gate,status:r.status,summary:r.summary})):void 0}:void 0,Q=h?.summary?{verdict:h.summary.verdict,exitCode:h.summary.exitCode,stepsFailed:h.summary.stepsFailed,stepsMissing:h.summary.stepsMissing,blockingReasons:h.blockingReasons,missingEvidence:h.missingEvidence}:void 0,Y=w?{summary:w.summary,blockingReasons:w.blockingReasons,releaseVerdict:w.releaseVerdict,evidenceFreshness:w.evidenceFreshness,sections:Array.isArray(w.sections)?w.sections.slice(0,4).map(r=>({id:r.id,title:r.title,body:r.body})):void 0}:void 0,Z=f$1?.summary?{changed:f$1.summary.changed,addedProjects:f$1.summary.addedProjects,removedProjects:f$1.summary.removedProjects,changedProjects:f$1.summary.changedProjects,workspaceChanges:f$1.summary.workspaceChanges,validationChanges:f$1.summary.validationChanges,gitChangedFiles:f$1.summary.gitChangedFiles}:void 0,ee=M.map(r=>f({id:`context.command.${r.id}`,label:`${r.id} safe command`,scope:"command",value:{display:r.display,execute:r.execute,scope:r.scope},...r.project?{project:r.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:c,sourceArtifact:p.agentContext,sourcePath:`safeCommands.${r.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),I=[...R,...ee],W=g({facts:I,generatedAt:c.toISOString(),now:c}),j=b$1();return {schemaVersion:re,generatedAt:c.toISOString(),agent:i,workspaceSummary:$,modelRef:p.model,knowledgeGraph:{artifact:p.knowledgeGraph,schemaVersion:q.knowledgeGraph,available:N,...typeof u?.quality?.entityCount=="number"?{entityCount:u.quality.entityCount}:{},...typeof u?.quality?.relationCount=="number"?{relationCount:u.quality.relationCount}:{},...typeof u?.quality?.proofCount=="number"?{proofCount:u.quality.proofCount}:{},queryCommands:[x("workspace graph search <query> --limit 12 --json"),x("workspace graph entities [kind] --json"),x("workspace graph evidence <entity-or-relation> --json"),x("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:j.schemaVersion,contractPath:j.contractPath,currentStep:"context",canonicalReadOrder:[...j.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:`workspace:${t.workspace.name}`,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...s?{activeProject:s.name}:{}},projects:H,safeCommands:M,facts:I,factFreshness:W,evidence:S,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:n,agentInstructions:[`Read \`${p.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${p.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"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:[...ge(t),...W.verifyBeforeUseFacts>0?[`${W.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[$,`Evidence available: ${S.available.length}. Missing evidence groups: ${S.missing.join(", ")||"none"}.`,s?`Active project scope: ${s.name} (${s.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
|
|
2
|
-
`),impactSummary:B,doctorSummary:U,analyzeSummary:J,readinessSummary:X,verifySummary:Q,explainSummary:Y,diffSummary:Z}}async function je(e,t){return h(t,se,d(e))}export{re as a,se as b,We as c,je as d};
|