workspai 0.72.0 → 0.73.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.
Files changed (83) hide show
  1. package/README.md +5 -2
  2. package/dist/analyze-WC2TY5AT.js +1 -0
  3. package/dist/autopilot-release-LJDRECFW.js +1 -0
  4. package/dist/{chunk-7LKCWDX6.js → chunk-2BCECNIW.js} +1 -1
  5. package/dist/{chunk-LDNX2R6V.js → chunk-3GO7BJ5J.js} +1 -1
  6. package/dist/{chunk-QVUVJU56.js → chunk-3SNP6M4M.js} +1 -1
  7. package/dist/chunk-4HQU2GQM.js +1 -0
  8. package/dist/{chunk-T6KHOIEY.js → chunk-4JAURS76.js} +1 -1
  9. package/dist/chunk-7O7P4MRD.js +1 -0
  10. package/dist/{chunk-5TKRCE6F.js → chunk-AQNU5RXV.js} +1 -1
  11. package/dist/{chunk-TDQ2PRHV.js → chunk-D3N2WFDV.js} +1 -1
  12. package/dist/{chunk-SG3QRCMM.js → chunk-DNKELRK6.js} +1 -1
  13. package/dist/{chunk-T6LCDLJ7.js → chunk-EDDGQ6LM.js} +1 -1
  14. package/dist/{chunk-LLEKVSMX.js → chunk-F6CTGVJA.js} +1 -1
  15. package/dist/{chunk-D5RUGSBC.js → chunk-FRH7AIGY.js} +2 -2
  16. package/dist/{chunk-KVPTZMEV.js → chunk-HAZGSAKP.js} +1 -1
  17. package/dist/{chunk-COBU44T5.js → chunk-IPZT6WKM.js} +1 -1
  18. package/dist/{chunk-TQQEZQLC.js → chunk-J44PN2FX.js} +1 -1
  19. package/dist/{chunk-EDPUQXP6.js → chunk-K3O3HENC.js} +1 -1
  20. package/dist/{chunk-SS7X2YF5.js → chunk-LDJAUIAG.js} +1 -1
  21. package/dist/{chunk-SATPH22S.js → chunk-LGC4CRUF.js} +1 -1
  22. package/dist/{chunk-IX5Z6EK6.js → chunk-ND5YAC4T.js} +1 -1
  23. package/dist/{chunk-WPZUKU2B.js → chunk-NNQE4DS2.js} +1 -1
  24. package/dist/chunk-NSMRQOWP.js +157 -0
  25. package/dist/{chunk-WMC2H7MJ.js → chunk-OIGI7MP6.js} +1 -1
  26. package/dist/{chunk-S66NO5BX.js → chunk-R5OJD5K2.js} +1 -1
  27. package/dist/{chunk-ONV6WW7A.js → chunk-SO4CGS35.js} +1 -1
  28. package/dist/{chunk-5OLNT6YD.js → chunk-T5NBSCVX.js} +65 -65
  29. package/dist/{chunk-2RF75G5T.js → chunk-TIZCESKY.js} +1 -1
  30. package/dist/{chunk-62YBFWHY.js → chunk-TSYDTKXO.js} +1 -1
  31. package/dist/{chunk-N2PAAQKI.js → chunk-TZK2R6RD.js} +1 -1
  32. package/dist/{chunk-JQINCVK5.js → chunk-UCNIXOTL.js} +1 -1
  33. package/dist/{chunk-UHAPXPGW.js → chunk-VBMWFT7Q.js} +1 -1
  34. package/dist/chunk-YYELANJO.js +7 -0
  35. package/dist/{chunk-QYXX6G5O.js → chunk-ZZWGD3X3.js} +1 -1
  36. package/dist/{create-7CWWGDXQ.js → create-XYKXS3JB.js} +1 -1
  37. package/dist/{doctor-WYBSI3GC.js → doctor-LQ7FT6AZ.js} +1 -1
  38. package/dist/{goal-lifecycle-PSPYQ4TR.js → goal-lifecycle-BIX2JVNO.js} +1 -1
  39. package/dist/{goal-pack-G7SAYDIC.js → goal-pack-SUWH6K7U.js} +1 -1
  40. package/dist/index.js +22 -22
  41. package/dist/{pipeline-NDV7DBB7.js → pipeline-NSPPWD7U.js} +1 -1
  42. package/dist/{project-agent-entry-HEBGPLMX.js → project-agent-entry-Y3NEHZED.js} +1 -1
  43. package/dist/{project-intelligence-lens-QTQEZXUY.js → project-intelligence-lens-6Q6XSUDJ.js} +1 -1
  44. package/dist/{project-test-coverage-4BGDDBBL.js → project-test-coverage-5PXAHBYQ.js} +1 -1
  45. package/dist/{proof-carrying-change-SHO2E3DX.js → proof-carrying-change-456TYEDW.js} +1 -1
  46. package/dist/{verified-goal-BSREU6R7.js → verified-goal-GRH5UOJR.js} +1 -1
  47. package/dist/{workspace-E3MM3AIE.js → workspace-ROUEA3RT.js} +1 -1
  48. package/dist/{workspace-agent-sync-NBIOSXCG.js → workspace-agent-sync-6UYG33EQ.js} +1 -1
  49. package/dist/{workspace-context-ZDXF6S7S.js → workspace-context-H7ZXR6VI.js} +1 -1
  50. package/dist/{workspace-contract-E7GVWM7W.js → workspace-contract-2V2BI6A3.js} +1 -1
  51. package/dist/{workspace-explain-YB66UFAS.js → workspace-explain-IBMTRUSF.js} +1 -1
  52. package/dist/{workspace-foundation-LRLYPR36.js → workspace-foundation-H5B3TTZD.js} +1 -1
  53. package/dist/{workspace-graph-stream-SJUCBPS4.js → workspace-graph-stream-YDEET5LK.js} +1 -1
  54. package/dist/workspace-graph-token-efficiency-XM3LYFUC.js +1 -0
  55. package/dist/{workspace-intelligence-3IAAM3H3.js → workspace-intelligence-DXKQXTTM.js} +1 -1
  56. package/dist/{workspace-intelligence-benchmark-UCGDKMDF.js → workspace-intelligence-benchmark-L46EGZZM.js} +1 -1
  57. package/dist/{workspace-intelligence-runner-FPPKTSNK.js → workspace-intelligence-runner-SCB44IXU.js} +1 -1
  58. package/dist/{workspace-knowledge-graph-WNQMNAVL.js → workspace-knowledge-graph-BNEVFEOW.js} +1 -1
  59. package/dist/{workspace-knowledge-graph-query-3GPXGWYN.js → workspace-knowledge-graph-query-GOC365ZR.js} +1 -1
  60. package/dist/workspace-knowledge-graph-snapshot-2NMV7LEJ.js +1 -0
  61. package/dist/{workspace-mcp-serve-KSZ2O66S.js → workspace-mcp-serve-JLZTTEVG.js} +1 -1
  62. package/dist/{workspace-model-5FA2636K.js → workspace-model-XSNLDUI2.js} +1 -1
  63. package/dist/{workspace-onboarding-RJMTHN7Z.js → workspace-onboarding-IRBVZTT4.js} +1 -1
  64. package/dist/{workspace-registry-summary-WKENOFEA.js → workspace-registry-summary-CBZDSG6I.js} +1 -1
  65. package/dist/{workspace-repair-engine-4JTNNDZL.js → workspace-repair-engine-TDUNQSFJ.js} +1 -1
  66. package/dist/workspace-run-I2W5PIPK.js +1 -0
  67. package/dist/{workspace-verify-37QL2JYE.js → workspace-verify-QTRY7WW3.js} +1 -1
  68. package/dist/{workspace-watch-P5X6TAFK.js → workspace-watch-PDQKYBYQ.js} +1 -1
  69. package/docs/SECURITY.md +16 -59
  70. package/docs/ci-workflows.md +43 -11
  71. package/docs/doctor-command.md +7 -0
  72. package/package.json +2 -5
  73. package/scripts/enterprise-package-smoke.mjs +14 -2
  74. package/dist/analyze-5ENZTHOT.js +0 -1
  75. package/dist/autopilot-release-PNSWAVZG.js +0 -1
  76. package/dist/chunk-5PFFR5S7.js +0 -157
  77. package/dist/chunk-6WOFOOM7.js +0 -7
  78. package/dist/chunk-BVWDG66W.js +0 -1
  79. package/dist/chunk-X5ZNFXFI.js +0 -1
  80. package/dist/workspace-graph-token-efficiency-BTIS6JXL.js +0 -1
  81. package/dist/workspace-knowledge-graph-snapshot-MTFTCVFF.js +0 -1
  82. package/dist/workspace-run-HFOY2UYT.js +0 -1
  83. package/scripts/check-cli-resolution.cjs +0 -72
@@ -6,17 +6,46 @@ Map of GitHub Actions workflows in this repository. Use this when editing CI to
6
6
 
7
7
  | Workflow | Path | Purpose |
8
8
  | ------------------------ | ---------------------------------------------------- | ------------------------------------------------------------------------- |
9
- | Build / test matrix | `.github/workflows/ci.yml` | Build, lint, typecheck, tests, coverage, contract gates |
9
+ | Build / test matrix | `.github/workflows/ci.yml` | Path-aware docs or full matrix validation plus the required `CI Gate` |
10
10
  | Workspace E2E matrix | `.github/workflows/workspace-e2e-matrix.yml` | Cross-OS workspace lifecycle smoke; setup `--warm-deps`; cache/mirror ops |
11
11
  | Windows bridge E2E | `.github/workflows/windows-bridge-e2e.yml` | Native Windows bridge and lifecycle checks |
12
12
  | E2E smoke | `.github/workflows/e2e-smoke.yml` | Focused bridge regression smoke |
13
13
  | Official generator smoke | `.github/workflows/frontend-generator-smoke.yml` | Contract-driven official-generator drift gate |
14
- | Security | `.github/workflows/security.yml` | Security scanning and policy checks |
14
+ | Security | `.github/workflows/security.yml` | Path-aware scanning plus the always-resolved `Security Gate` |
15
15
  | Manual npm release | `.github/workflows/release-npm-manual.yml` | Maintainer-only release gate and publish workflow |
16
16
  | Discord announcement | `.github/workflows/discord-release-announcement.yml` | Preview and publish one idempotent product-aware release announcement |
17
17
  | Contributor onboarding | `.github/workflows/contributor-onboarding.yml` | Accepted-contributor onboarding automation |
18
+ | Contributor Hub | `.github/workflows/contributor-hub.yml` | Daily live issue-route freshness |
18
19
  | Welcome | `.github/workflows/welcome.yml` | First-issue and first-contribution messages |
19
20
 
21
+ ## Change-aware validation
22
+
23
+ `CI Gate` and `Security Gate` are the stable branch-protection checks. They
24
+ always resolve for pushes and pull requests, while expensive work is selected
25
+ from the changed paths:
26
+
27
+ | Change surface | Required validation |
28
+ | -------------------------------------- | ---------------------------------------------------------------------- |
29
+ | Markdown and contributor-route content | One Ubuntu docs build, text guard, link/drift checks, and README smoke |
30
+ | CLI source, contracts, or tooling | Full build/test matrix |
31
+ | Runtime adapter or core bridge | Full matrix plus focused Phase 4 lanes |
32
+ | Generator implementation or contract | Impact-selected official or native generator smoke |
33
+ | Workspace lifecycle surface | Cross-platform workspace E2E |
34
+ | Dependency or security surface | npm audit, SBOM, dependency review, and CodeQL |
35
+
36
+ Specialized workflows use identical `push` and `pull_request` path filters.
37
+ Manual and scheduled runs remain available for full qualification and upstream
38
+ drift detection. Workflow definitions and release-gate definitions trigger the
39
+ lanes they govern.
40
+
41
+ The `main` branch requires a pull request, one approving review, resolved
42
+ conversations, and successful `CI Gate` and `Security Gate` checks for normal
43
+ contributors. Repository administrators retain a bypass for release recovery
44
+ and CI bootstrap; routine changes should still use a pull request. Force pushes
45
+ and branch deletion remain disabled. Contributors can use GitHub's Update
46
+ branch action when strict checks require synchronization with the latest
47
+ `main`; merged head branches are deleted automatically.
48
+
20
49
  The release workflow requires the cost-bounded
21
50
  `Official Generator Smoke · primary` Linux run for the exact release SHA. A
22
51
  normal push that touches the contracted generator surface produces this gate;
@@ -32,18 +61,21 @@ parity checks from coupling product versions. Breaking contract removal or
32
61
  incompatible schema changes remain CLI release blockers through the canonical
33
62
  compatibility and schema-version gates.
34
63
 
35
- Pushes and pull requests run every contracted generator on the primary Linux
36
- lane. The weekly schedule and manual dispatch can run the complete Linux,
37
- macOS, and Windows matrix as a non-blocking compatibility and upstream-drift
38
- signal. npm and Composer download caches reduce repeated network work without
39
- caching generated projects; every smoke run still exercises the current
40
- upstream generator, generated artifacts, build surface, registry, and Doctor
41
- evidence.
64
+ Pushes and pull requests select the affected generator family from changed
65
+ paths. Frontend changes run the frontend generators, desktop/extension/Laravel
66
+ changes run that platform group, and native-only changes skip the unrelated
67
+ official network matrix while retaining native artifact verification. Shared
68
+ contracts, dependencies, smoke infrastructure, and release gates conservatively
69
+ run every official generator. The weekly schedule and manual dispatch still run
70
+ the complete Linux, macOS, and Windows matrix as a compatibility and
71
+ upstream-drift signal. npm and Composer download caches reduce repeated network
72
+ work without treating an earlier commit or calendar-day result as proof for a
73
+ new SHA.
42
74
 
43
75
  The Windows coverage lane intentionally uses bounded Vitest worker concurrency
44
76
  and platform-aware transaction timeouts. Filesystem-heavy workspace tests must
45
77
  finish their transaction before teardown; cleanup retries transient Windows
46
- `EBUSY` and `ENOTEMPTY` states instead of converting one slow operation into a
78
+ `EBUSY`, `ENOTEMPTY`, and `EPERM` states instead of converting one slow operation into a
47
79
  cascade of unrelated missing-file failures. These budgets remain finite and do
48
80
  not retry failed assertions or product operations.
49
81
 
@@ -63,7 +95,7 @@ Validate or preview the current CLI announcement locally:
63
95
  npm --workspace workspai run check:release-announcement
64
96
  npm --workspace workspai run release:announcement -- \
65
97
  --product workspai-cli \
66
- --tag v0.72.0 \
98
+ --tag v0.73.0 \
67
99
  --markdown-output /tmp/workspai-discord-announcement.md
68
100
  ```
69
101
 
@@ -21,6 +21,13 @@ Checks host prerequisites:
21
21
  - pipx (optional)
22
22
  - RapidKit Core availability
23
23
  - Go (optional)
24
+ - Windows `workspai` PATH resolution and npm-shim precedence
25
+
26
+ The PATH check is reported as typed Doctor evidence instead of running during
27
+ package installation. A normal `npm install -g workspai` therefore requires no
28
+ install-script authorization. On Windows, a shadowed npm shim is an advisory:
29
+ Doctor reports the active executable, the ordered matches, and the bounded
30
+ `npx --yes workspai <command>` fallback without mutating PATH.
24
31
 
25
32
  ### 2) Workspace Check
26
33
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.72.0",
3
+ "version": "0.73.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -60,7 +60,6 @@
60
60
  "rapidkit.config.example.cjs",
61
61
  "data/modules-embeddings.json",
62
62
  "scripts/enforce-package-manager.cjs",
63
- "scripts/check-cli-resolution.cjs",
64
63
  "scripts/check-agent-customization-drift.mjs",
65
64
  "scripts/enterprise-package-smoke.mjs",
66
65
  "scripts/prepack-enterprise.mjs"
@@ -70,7 +69,6 @@
70
69
  "access": "public"
71
70
  },
72
71
  "scripts": {
73
- "postinstall": "node scripts/check-cli-resolution.cjs",
74
72
  "check:package-manager": "node scripts/enforce-package-manager.cjs",
75
73
  "sync-kits": "bash scripts/sync-kits.sh",
76
74
  "sync:kits": "corepack npm run sync-kits",
@@ -80,7 +78,6 @@
80
78
  "dev:local": "corepack npm run build && corepack npm link",
81
79
  "install:local": "corepack npm unlink -g workspai || true && corepack npm run build && corepack npm link",
82
80
  "uninstall:local": "corepack npm unlink -g workspai || true",
83
- "prepare": "node scripts/prepare-husky.mjs",
84
81
  "test:e2e:first-install": "bash scripts/e2e-first-install.sh",
85
82
  "test:e2e:user-first-install": "bash scripts/e2e-user-first-install.sh",
86
83
  "test:prebuild": "tsup",
@@ -137,7 +134,7 @@
137
134
  "check:markdown-links": "node scripts/check-markdown-links.mjs",
138
135
  "check:docs-drift": "node scripts/docs-drift-guard.mjs",
139
136
  "smoke:readme": "node scripts/smoke-readme-commands.mjs",
140
- "validate:docs": "corepack npm run check:markdown-links && corepack npm run check:docs-drift && corepack npm run validate:docs-examples && corepack npm run check:github-release-notes && corepack npm run check:release-announcement && corepack npm run smoke:readme",
137
+ "validate:docs": "corepack npm run check:markdown-links && node ../../scripts/check-contributor-hub.mjs && corepack npm run check:docs-drift && corepack npm run validate:docs-examples && corepack npm run check:github-release-notes && corepack npm run check:release-announcement && corepack npm run smoke:readme",
141
138
  "smoke:frontend-generators": "tsup && node scripts/smoke-frontend-generators.mjs",
142
139
  "smoke:frontend-generators:network": "tsup && node scripts/smoke-frontend-generators.mjs --execute",
143
140
  "smoke:official-generators": "tsup && node scripts/smoke-official-generators.mjs",
@@ -214,11 +214,15 @@ const REQUIRED_PACKAGE_FILES = [
214
214
  'templates/kits/nestjs-standard/package.json.j2',
215
215
  'workspai.config.example.cjs',
216
216
  'rapidkit.config.example.cjs',
217
- 'scripts/check-cli-resolution.cjs',
218
217
  'scripts/enforce-package-manager.cjs',
219
218
  ];
220
219
 
221
- const FORBIDDEN_PACKAGE_FILES = ['workspai.config.example.js', 'rapidkit.config.example.js'];
220
+ const FORBIDDEN_PACKAGE_FILES = [
221
+ 'workspai.config.example.js',
222
+ 'rapidkit.config.example.js',
223
+ 'scripts/check-cli-resolution.cjs',
224
+ 'scripts/prepare-husky.mjs',
225
+ ];
222
226
 
223
227
  function isPublishedByFilesPolicy(packageJson, assetPath) {
224
228
  const files = packageJson.files ?? [];
@@ -238,6 +242,14 @@ function assertPackageFilesPolicy(requiredFiles) {
238
242
  if ('rapidkit' in (packageJson.bin ?? {})) {
239
243
  fail('package.json#bin.rapidkit must stay in the legacy rapidkit package, not workspai');
240
244
  }
245
+ const consumerLifecycleScripts = ['preinstall', 'install', 'postinstall', 'prepare'].filter(
246
+ (scriptName) => typeof packageJson.scripts?.[scriptName] === 'string'
247
+ );
248
+ if (consumerLifecycleScripts.length > 0) {
249
+ fail(
250
+ `package.json must not require consumer install-script authorization: ${consumerLifecycleScripts.join(', ')}`
251
+ );
252
+ }
241
253
  for (const required of requiredFiles) {
242
254
  if (!isPublishedByFilesPolicy(packageJson, required)) {
243
255
  fail(`package.json#files does not publish ${required}`);
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-LLEKVSMX.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-LDNX2R6V.js';
@@ -1,157 +0,0 @@
1
- import {g,b,i,d as d$1,e,f}from'./chunk-5TKRCE6F.js';import {c as c$1}from'./chunk-X7FYEKLI.js';import {d as d$2,b as b$1,a as a$1}from'./chunk-3RBUSW7H.js';import {c}from'./chunk-EBQS5T7Q.js';import {a}from'./chunk-AFIFZTOY.js';import {d}from'./chunk-EWZZUQBR.js';import {s,p,t}from'./chunk-ODK4LCEL.js';import {u,h,g as g$1}from'./chunk-VQZ5PI5J.js';import be from'crypto';import ne from'fs';import y from'fs/promises';import l from'path';import {execa}from'execa';import X from'fs-extra';async function Q(e,t){let[n,o]=await Promise.all([X.realpath(e).catch(()=>null),X.realpath(t).catch(()=>null)]);if(!n||!o)return null;let s=l.relative(n,o);return !s||l.isAbsolute(s)||s===".."||s.startsWith(`..${l.sep}`)?null:(await X.stat(o).catch(()=>null))?.isFile()?o:null}var Ne=s.projectContextAgent.schemaVersion,ft=["managed","local","off"],se="<!-- WORKSPAI:PROJECT-GROUNDING:START -->",ve="<!-- WORKSPAI:PROJECT-GROUNDING:END -->",ee="<!-- WORKSPAI:GENERATED-PROJECT-SKILL -->",B=".agents/skills/workspai-grounding/SKILL.md";function he(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}async function A(e){try{return JSON.parse(await y.readFile(e,"utf8"))}catch(t){return null}}function W(e){return e.replace(/\\/g,"/").replace(/^\.\/+/,"")}function _(e,t,n){let o=e.replace(/\\/g,"/"),s=/^[A-Za-z]:\//.test(o);if(!l.isAbsolute(e)&&!s)return W(o);if(s&&process.platform!=="win32")return null;let a=l.resolve(e),i=l.relative(n,a);if(i&&!i.startsWith("..")&&!l.isAbsolute(i))return W(i);let c=l.relative(t,a);return c&&!c.startsWith("..")&&!l.isAbsolute(c)?`workspace:${W(c)}`:null}function I(e,t,n){return [[n,"project:"],[n.replace(/\\/g,"/"),"project:"],[t,"workspace:"],[t.replace(/\\/g,"/"),"workspace:"]].reduce((s,[a,i])=>a.length>0?s.split(a).join(i):s,e)}function Ae(e,t){return he(e?.adoption)?.mode==="linked"?"adopted":he(e?.import)?"imported":t}function xe(e){if(!e.model)return null;let t=W(e.relativePath);return e.model.projects.find(n=>n.name===e.projectName||W(n.path)===t)??null}function U(e,t){e[t]=(e[t]??0)+1;}var fe=["project","language","service","api","endpoint","schema","protocol","runtime-unit","lifecycle-stage","database","queue","container","deployment","pipeline","environment","test-suite","owner","decision","document","package","file","module","symbol"],te=48,re=12*1024;function Le(e,t=te,n=re){let o={language:12,api:8,service:8,endpoint:8,schema:8,protocol:8,"runtime-unit":12,"lifecycle-stage":12,file:4,module:4,symbol:4},s=new Map,a={};for(let u of e)U(a,u.kind);for(let u of fe)s.set(u,e.filter(k=>k.kind===u).sort((k,f)=>k.label.localeCompare(f.label)||k.id.localeCompare(f.id)).slice(0,o[u]??6));let i=[],c={},h=0,p=0,d=true;for(;i.length<t&&d;){d=false;for(let u of fe){let k=s.get(u)?.[p];if(!k)continue;let f=Buffer.byteLength(JSON.stringify(k));if(!(h+f>n)&&(i.push(k),h+=f,U(c,u),d=true,i.length>=t))break}p+=1;}let m=Object.fromEntries(Object.entries(a).map(([u,k])=>[u,k-(c[u]??0)]).filter(([,u])=>u>0).sort(([u],[k])=>u.localeCompare(k)));return {entities:i,selectedBytes:h,selectedByKind:c,omittedByKind:m}}function $e(e,t){if(!e)return {entityCount:0,relationCount:0,proofCount:0,entitiesByKind:{},relationsByKind:{},languages:{},semantic:{protocolConceptCount:0,protocolImplementationBindings:0,equivalenceBindings:0,generationBindings:0,runtimeUnitCount:0,lifecycleStageCount:0,runtimeCoverage:[]},projection:{mode:"stratified-byte-bounded",maxEntities:te,byteBudget:re,selectedBytes:0,eligibleCount:0,selectedCount:0,omittedCount:0,selectedByKind:{},omittedByKind:{}},relatedProjects:[],proofArtifacts:[],entities:[],relations:[],proofs:[],topology:{status:"unavailable",dependencies:[],dependents:[]},diagnostics:[]};let n=e.entities.find(r=>r.kind==="project"&&(r.id===t||r.label===t||r.projectId===t)),o=new Set(e.entities.filter(r=>r.projectId===t||r.id===n?.id||r.kind==="project"&&r.label===t).map(r=>r.id));n&&o.add(n.id);let s=e.relations.filter(r=>o.has(r.from)||o.has(r.to)),a=new Set(o);for(let r of s)a.add(r.from),a.add(r.to);let i=e.entities.filter(r=>a.has(r.id)),c=new Set,h={},p={},d={},m=new Set(i.filter(r=>r.kind==="language").map(r=>r.attributes.language).filter(r=>typeof r=="string"));for(let r of i){U(h,r.kind);let w=typeof r.attributes.language=="string"?r.attributes.language:void 0;if(w&&r.kind==="language")d[w]={fileCount:typeof r.attributes.fileCount=="number"?r.attributes.fileCount:0,symbolCount:d[w]?.symbolCount??0,generatedFileCount:typeof r.attributes.generatedFileCount=="number"?r.attributes.generatedFileCount:0};else if(w&&(r.kind==="file"||r.kind==="symbol")){let b=d[w]??{fileCount:0,symbolCount:0,generatedFileCount:0};r.kind==="file"&&!m.has(w)?(b.fileCount+=1,r.attributes.generated===true&&(b.generatedFileCount+=1)):r.kind==="symbol"&&(b.symbolCount+=1),d[w]=b;}for(let b of r.proofIds)c.add(b);}for(let r of s){U(p,r.kind);for(let w of r.proofIds)c.add(w);}let u=e.proofs.filter(r=>c.has(r.id)),k=[...new Set(e.entities.filter(r=>a.has(r.id)&&r.projectId&&r.projectId!==t).map(r=>r.projectId))].sort(),f=e.diagnostics.filter(r=>(!r.entityIds||r.entityIds.length===0)&&(!r.relationIds||r.relationIds.length===0)||r.entityIds?.some(w=>a.has(w))||r.relationIds?.some(w=>s.some(b=>b.id===w))).map(r=>({code:r.code,severity:r.severity,message:r.message,...r.recommendation?{recommendation:r.recommendation}:{}})),j=(r,w)=>({project:w,kind:r.kind,source:r.source,confidence:r.confidence,evidence:[...new Set(r.evidence.map(b=>b.file.replace(/\\/g,"/")))].sort()}),P=e.projectTopology.edges.filter(r=>r.from===t).map(r=>j(r,r.to)).sort((r,w)=>`${r.project}:${r.kind}`.localeCompare(`${w.project}:${w.kind}`)),S=e.projectTopology.edges.filter(r=>r.to===t).map(r=>j(r,r.from)).sort((r,w)=>`${r.project}:${r.kind}`.localeCompare(`${w.project}:${w.kind}`)),N=Le(i),T=N.entities,L=i.filter(r=>r.kind==="runtime-unit"),E=new Set(T.map(r=>r.id)),$=[...s].sort((r,w)=>{let b=Number(E.has(r.from)||E.has(r.to));return Number(E.has(w.from)||E.has(w.to))-b||r.id.localeCompare(w.id)}).slice(0,16),D=new Set([...T.flatMap(r=>r.proofIds),...$.flatMap(r=>r.proofIds)]),g=u.filter(r=>D.has(r.id)).sort((r,w)=>r.id.localeCompare(w.id)).slice(0,16);return {entityCount:i.length,relationCount:s.length,proofCount:u.length,entitiesByKind:h,relationsByKind:p,languages:Object.fromEntries(Object.entries(d).sort(([r],[w])=>r.localeCompare(w))),semantic:{protocolConceptCount:h.protocol??0,protocolImplementationBindings:p["implements-protocol"]??0,equivalenceBindings:p["equivalent-to"]??0,generationBindings:(p["generated-from"]??0)+(p["generated-by"]??0),runtimeUnitCount:L.length,lifecycleStageCount:h["lifecycle-stage"]??0,runtimeCoverage:[...new Set(L.map(r=>r.attributes.runtime).filter(r=>typeof r=="string"))].sort()},projection:{mode:"stratified-byte-bounded",maxEntities:te,byteBudget:re,selectedBytes:N.selectedBytes,eligibleCount:i.length,selectedCount:T.length,omittedCount:Math.max(0,i.length-T.length),selectedByKind:Object.fromEntries(Object.entries(N.selectedByKind).sort(([r],[w])=>r.localeCompare(w))),omittedByKind:N.omittedByKind},relatedProjects:k,proofArtifacts:[...new Set(g.map(r=>r.artifact))].sort().slice(0,24),entities:T,relations:$,proofs:g,topology:{status:P.length>0||S.length>0?"proven":e.projectTopology.nodes.some(r=>r.id===t)?"unproven":"unavailable",dependencies:P,dependents:S},diagnostics:f}}function Ee(e,t,n){return Array.isArray(e)?e.map(o=>typeof o=="string"?I(o,t,n):o):typeof e=="string"?I(e,t,n):e}function Ge(e,t,n){return {id:e.id,kind:e.kind,label:I(e.label,t,n),attributes:Object.fromEntries(Object.entries(e.attributes).map(([o,s])=>[o,Ee(s,t,n)])),proofIds:[...e.proofIds].sort()}}function We(e,t,n){let o=(...a)=>e.filter(i=>a.includes(i.kind)).map(i=>Ge(i,t,n)).slice(0,4),s=[];for(let a of e){for(let[i,c]of Object.entries(a.attributes))if(/(?:^|[-_.])ports?(?:$|[-_.])/i.test(i)&&(s.push({entityId:a.id,label:I(a.label,t,n),attribute:i,value:Ee(c,t,n)}),s.length>=8))break;if(s.length>=8)break}return {services:o("service"),packages:o("package"),protocols:o("protocol"),runtimeUnits:o("runtime-unit"),lifecycleStages:o("lifecycle-stage"),apis:o("api"),endpoints:o("endpoint"),dataStores:o("database","queue"),deployments:o("container","deployment","environment"),pipelines:o("pipeline"),tests:o("test-suite"),owners:o("owner"),decisions:o("decision"),ports:s}}function Oe(e,t,n){let o=_(e.artifact,t,n);return o?{id:e.id,provider:e.provider,artifact:o,...e.pointer?{pointer:I(e.pointer,t,n)}:{},...e.line!==void 0?{line:e.line}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}:null}async function Ke(e,t,n){let o=[],s=await A(l.join(e,".workspai","reports","INDEX.json"));if(Array.isArray(s?.blockers))for(let d of s.blockers)typeof d=="string"&&(d.startsWith(`${n}:`)||d.includes(`project:${n}`)||d.includes(`project ${n}`))&&o.push({source:"workspace-report-index",severity:"error",message:I(d,e,t)});let a=await A(l.join(e,".workspai","reports","doctor-project-last-run.json")),i=await A(l.join(e,".workspai","reports","doctor-last-run.json")),c=i?.projects?.find(d=>d.name===n),p=[...a?.project&&(a.projectName===n||a.project.name===n)?[{generatedAt:a.generatedAt,project:a.project}]:[],...c?[{generatedAt:i?.generatedAt,project:c}]:[]].sort((d,m)=>{let u=typeof d.generatedAt=="string"&&Date.parse(d.generatedAt)||0;return (typeof m.generatedAt=="string"&&Date.parse(m.generatedAt)||0)-u})[0];if(p)for(let d of c$1({project:p.project}))o.push({source:"doctor-project",severity:d.status==="blocking"?"error":"warning",message:I(d.message,e,t),...d.id?{code:d.id}:{}});return [...new Map(o.map(d=>[`${d.source}:${d.code??""}:${d.message}`,d])).values()].slice(0,32)}function oe(e,t=[]){return typeof e=="string"?/^[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(e)||t.some(n=>n.length>0&&(e.includes(n)||e.includes(n.replace(/\\/g,"/")))):Array.isArray(e)?e.some(n=>oe(n,t)):e&&typeof e=="object"?Object.values(e).some(n=>oe(n,t)):false}function _e(e){return be.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Fe(e){let t$1=l.resolve(e.workspacePath),n=l.resolve(e.projectPath),o=u(n,"project.json").find(g=>ne.existsSync(g)),s=o?await A(o):null,a$1=await A(l.join(t$1,".workspai","workspace.contract.json")),i=l.resolve(n),c=a$1?.projects?.find(g=>g.externalPath?l.resolve(g.externalPath)===i:!g.relativePath||g.relativePath.startsWith("external/")?false:l.resolve(t$1,g.relativePath)===i)??a$1?.projects?.find(g=>g.slug===e.projectName||g.slug===l.basename(n)),h=e.projectName??(typeof s?.name=="string"?s.name:void 0)??c?.slug??l.basename(n),p$1=c?.relativePath??(()=>{let g=W(l.relative(t$1,n));return !g||g.startsWith("..")?`external/${h}`:g})(),d$1=await A(l.join(t$1,p.model)),m=await A(l.join(t$1,p.knowledgeGraph)),u$1=d$1?d(d$1):void 0,k=!!(u$1&&m?.source.hash===u$1),f=xe({model:d$1,projectName:h,relativePath:p$1}),j=$e(k?m:null,h),P=await Ke(t$1,n,h),S=j.proofs.map(g=>g.freshness),N=m?!k||S.includes("stale")?"stale":S.includes("unknown")?"unknown":"fresh":"missing",T=d$1?d$1.factFreshness?.status??"unknown":"missing",L=[...d$1?[]:[{code:"project.context.model-missing",severity:"warning",message:"The canonical Workspace Model has not been generated yet. Refresh workspace intelligence before relying on project topology."}],...d$1&&!f?[{code:"project.context.project-not-materialized",severity:"warning",message:"The project is registered in the workspace contract but is not present in the current Workspace Model."}]:[],...m?[]:[{code:"project.context.graph-missing",severity:"warning",message:"The Workspace Knowledge Graph has not been generated yet. Run the workspace intelligence loop to build proof-backed relationships."}],...m&&!k?[{code:"project.context.graph-model-mismatch",severity:"warning",message:"The persisted Knowledge Graph does not match the current Workspace Model and was excluded from this project lens."}]:[]],E=Ae(s,e.relationship??c?.relationship??"managed"),$={schemaVersion:Ne,generatedAt:(e.now??new Date).toISOString(),workspace:{name:a$1?.workspace?.name??d$1?.workspace.name??l.basename(t$1),...a$1?.workspace?.profile||d$1?.workspace.profile?{profile:a$1?.workspace?.profile??d$1?.workspace.profile}:{},relationship:E,contract:`workspace:${t.workspaceContract}`,projectKnowledgeGraph:t.projectKnowledgeGraphReference,model:`workspace:${p.model}`,knowledgeGraph:`workspace:${p.knowledgeGraph}`,index:`workspace:${p.agentIndex}`,context:`workspace:${p.agentContext}`,skillsIndex:`workspace:${p.skillsIndex}`,boundedGraphSearch:`workspai workspace graph search <task-query> --scope project:${h} --limit 12 --json`,access:{localBinding:t.projectWorkspaceLink,canonicalEvidenceAvailableAtGeneration:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"}},project:{name:h,relativePath:p$1,...f?.kind?{kind:f.kind}:{},...f?.runtime||c?.runtime?{runtime:f?.runtime??c?.runtime}:{},...f?.runtimeCandidates?.length?{runtimeCandidates:[...f.runtimeCandidates].sort()}:{},...f?.framework||c?.framework?{framework:f?.framework??c?.framework}:{},...f?.kit||c?.kit?{kit:f?.kit??c?.kit}:{},...f?.supportTier?{supportTier:f.supportTier}:{},...f?.governance?{governance:f.governance}:{},commands:{supported:[...f?.commands.supported??[]].sort(),unsupported:[...f?.commands.unsupported??[]].sort(),fleetStages:[...f?.commands.fleetStages??[]].sort()},importantFiles:[...new Set((f?.importantFiles??[]).map(g=>_(g,t$1,n)).filter(g=>g!==null))].sort()},intelligence:{...d$1?.generatedAt?{modelGeneratedAt:d$1.generatedAt}:{},...m?.generatedAt?{graphGeneratedAt:m.generatedAt}:{},...m?.source.hash?{graphModelHash:m.source.hash}:{},entityCount:j.entityCount,relationCount:j.relationCount,proofCount:j.proofCount,entitiesByKind:j.entitiesByKind,relationsByKind:j.relationsByKind,languages:j.languages,semantic:j.semantic,projection:{...j.projection,continuationCommand:`workspai workspace graph search <task-query> --scope project:${h} --limit 12 --json`},relatedProjects:j.relatedProjects,freshness:{model:T,graph:N,graphMatchesModel:k},topology:{...j.topology,dependencies:j.topology.dependencies.map(g=>({...g,evidence:g.evidence.map(r=>_(r,t$1,n)).filter(r=>r!==null)})),dependents:j.topology.dependents.map(g=>({...g,evidence:g.evidence.map(r=>_(r,t$1,n)).filter(r=>r!==null)}))},surfaces:We(j.entities,t$1,n),diagnostics:[...L,...j.diagnostics].map(g=>({...g,message:I(g.message,t$1,n),...g.recommendation?{recommendation:I(g.recommendation,t$1,n)}:{}}))},evidence:{readOrder:[b,".workspai/PROJECT-GROUNDING.md",t.projectContextAgent,"AGENTS.md","workspace:.workspai/goals/index.json",`workspace:${t.goalPackLastRun}`,"workspace:.workspai/reports/workspace-skills-index.json",`command:workspai workspace graph search <task-query> --scope project:${h} --limit 12 --json`],projectProofArtifacts:[...new Set(j.proofArtifacts.map(g=>_(g,t$1,n)).filter(g=>g!==null))],relations:j.relations.map(g=>({id:g.id,from:g.from,to:g.to,kind:g.kind,derivation:g.derivation,trust:g.trust,confidence:g.confidence,proofIds:[...g.proofIds].sort()})),proofs:j.proofs.map(g=>Oe(g,t$1,n)).filter(g=>g!==null)},blockers:P,agentRouting:{enforcement:"required",mandatoryPreflight:{command:"workspai agent bootstrap --for-agent generic --strict --json",successCondition:"ready"},workspaceLocator:{command:"workspai project workspace status --json",successCondition:"resolved",outputClassification:"machine-local",persistence:"forbidden",disclosure:"forbidden",portableUriScheme:"workspace:"},workspaceEvidenceRequiredFor:["repository-analysis","architecture-analysis","change-impact","cross-project-change","contract-change","infrastructure-change","release-readiness"],requiredReadOrder:[b,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",t.projectContextAgent,"workspace:.workspai/reports/workspace-skills-index.json",`command:workspai workspace graph search ${JSON.stringify(h)} --scope ${JSON.stringify(`project:${h}`)} --limit 12 --json`],degradedMode:{allowCompleteArchitectureClaims:false,requireDisclosure:true}},commands:{refresh:"workspai workspace intelligence run --for-agent generic --strict --json",verify:"workspai workspace verify --strict --json",graphSearch:`workspai workspace graph search ${JSON.stringify(h)} --scope ${JSON.stringify(`project:${h}`)} --limit 12 --json`,doctor:"workspai doctor project --json",workspaceStatus:"workspai project workspace status --json"}};if(oe($,[t$1,n]))throw new Error("Project context lens rejected a non-portable absolute path.");let D={...$,integrity:{algorithm:"sha256",...u$1?{modelHash:u$1}:{},payloadHash:_e($),portable:true,absolutePathsEmitted:false}};return a(D,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent"),D}function Be(e){let t=e.intelligence.relatedProjects.length>0?e.intelligence.relatedProjects.map(s=>`\`${s}\``).join(", "):"No proven cross-project relation is currently available.",n=e.intelligence.diagnostics.length>0?e.intelligence.diagnostics.slice(0,8).map(s=>`- **${s.severity} \xB7 ${s.code}:** ${s.message}`).join(`
2
- `):"- No project-scoped graph diagnostic is currently recorded.",o=e.blockers.length>0?e.blockers.slice(0,12).map(s=>`- **${s.severity}${s.code?` \xB7 ${s.code}`:""}:** ${s.message}`).join(`
3
- `):"- No current project-scoped blocker is recorded.";return `# Workspai project grounding
4
-
5
- This project is adopted into the **${e.workspace.name}** Workspai workspace.
6
- That value is the canonical workspace identity, not its filesystem path. Workspai
7
- commands launched here resolve the machine-local workspace automatically.
8
-
9
- ## Mandatory first contact
10
-
11
- Do not begin broad repository discovery, architecture claims, planning, or mutation
12
- until this sequence is complete:
13
-
14
- 1. Read \`${b}\` to discover the portable protocol.
15
- 2. Run \`workspai agent bootstrap --for-agent generic --strict --json\`.
16
- 3. Follow the receipt's \`requiredReadOrder\` exactly.
17
- 4. Read \`.workspai/reports/project-context-agent.json\`.
18
- 5. If the receipt reports an active Goal, read its immutable Goal Pack and agent
19
- handoff before choosing or expanding work.
20
- 6. Read the compact workspace Skills index and load only a matching playbook.
21
- 7. Query the bounded Workspace Graph with the user's actual task before opening broad
22
- source, then inspect only returned proof paths and targeted live files.
23
-
24
- Receipt policy:
25
-
26
- - \`ready\`: continue with bounded evidence and targeted source inspection.
27
- - \`degraded\`: disclose the limitation and do not claim complete architecture or verification.
28
- - \`blocked\`: stop governed claims, execute \`nextActions\`, and rerun bootstrap.
29
-
30
- ## Workspace location and portable paths
31
-
32
- - \`${e.workspace.name}\` is an identity, not a directory name to guess.
33
- - Project-local paths begin with \`.workspai/\`.
34
- - Canonical workspace paths begin with \`workspace:\`.
35
- - Resolve the exact local workspace root only when direct file access is necessary by
36
- running \`workspai project workspace status --json\` from this project.
37
- - The resolver's absolute paths are machine-local runtime data. Never persist or copy
38
- them into answers, shared logs, commits, prompts, telemetry, or portable artifacts.
39
-
40
- ## Authority boundary
41
-
42
- The Workspace Model owns canonical project identity and its compact \`projectTopology\`.
43
- The Workspace Knowledge Graph is a separate, proof-backed enrichment containing
44
- files, symbols, APIs, infrastructure, tests, owners, and decisions. Do not treat
45
- an unproven topology edge as proof that two projects are independent. Live source owns
46
- exact implementation. CLI evidence owns Goal, readiness, repair, and verification claims.
47
- Repository-authored instructions remain authoritative for source changes after this
48
- entry gate; Workspai preserves rather than replaces them.
49
-
50
- ## Knowledge Graph routing
51
-
52
- - Project graph reference: \`${e.workspace.projectKnowledgeGraph}\`. It integrity-binds
53
- this project to its exact canonical projection without duplicating the full graph.
54
- - Workspace aggregate: \`${e.workspace.knowledgeGraph}\`. Resolve it through the
55
- workspace binding only for cross-project or workspace-wide consumption.
56
- - Default agent path: use the bounded graph-search command below; resolve the canonical
57
- graph only when the task explicitly requires full graph interchange.
58
-
59
- ## Project
60
-
61
- - Name: \`${e.project.name}\`
62
- - Workspace-relative identity: \`${e.project.relativePath}\`
63
- - Runtime: \`${e.project.runtime??"unknown"}\`
64
- - Framework: \`${e.project.framework??"unknown"}\`
65
- - Relationship: \`${e.workspace.relationship}\`
66
- - Related projects: ${t}
67
- - Topology status: \`${e.intelligence.topology.status}\`
68
- - Model freshness: \`${e.intelligence.freshness.model}\`
69
- - Knowledge Graph freshness: \`${e.intelligence.freshness.graph}\`
70
-
71
- ## Current evidence coverage
72
-
73
- - Project-scoped entities: ${e.intelligence.entityCount}
74
- - Project-scoped relations: ${e.intelligence.relationCount}
75
- - Portable proofs: ${e.intelligence.proofCount}
76
-
77
- ${n}
78
-
79
- ## Current project blockers
80
-
81
- ${o}
82
-
83
- ## Safe commands from this project
84
-
85
- \`\`\`bash
86
- ${e.commands.workspaceStatus}
87
- ${e.commands.doctor}
88
- ${e.commands.graphSearch}
89
- ${e.commands.verify}
90
- \`\`\`
91
-
92
- The machine-local workspace binding lives only in
93
- \`.workspai/workspace-link.local.json\`, which is gitignored. Portable grounding files
94
- never publish its value.
95
- `}function Me(e){return `# Workspai agent entry gate (mandatory)
96
-
97
- - Project: \`${e.project.name}\`
98
- - Workspace identity: \`${e.workspace.name}\` (logical name, not a filesystem path)
99
- - Entry contract: \`${b}\`
100
-
101
- Before broad repository discovery, architecture claims, planning, or mutation:
102
-
103
- 1. Read \`${b}\`.
104
- 2. Run \`workspai agent bootstrap --for-agent generic --strict --json\`.
105
- 3. Follow the receipt's \`requiredReadOrder\` exactly.
106
- 4. If a Goal is active, read its immutable Goal Pack and handoff before acting.
107
- 5. Read the compact workspace Skills index and load only a matching playbook.
108
- 6. Query the bounded Workspace Graph with the user's task, then inspect only returned proofs and targeted live source.
109
-
110
- Receipt policy: \`ready\` may proceed; \`degraded\` must disclose limitations and may not claim complete architecture or verification; \`blocked\` must stop governed claims, execute \`nextActions\`, and rerun bootstrap.
111
-
112
- \`workspace:\` paths belong to the canonical workspace, not this project's \`.workspai\` directory. Resolve their machine-local root at runtime with \`workspai project workspace status --json\`. That output is machine-local: never copy it into answers, shared logs, commits, or portable artifacts.
113
-
114
- Authority: Workspai evidence owns identity, topology, goals, readiness, and verification. Live source and repository-authored rules own exact implementation and source conventions.`}function ke(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t){return new RegExp(`${ke(e)}[\\s\\S]*?${ke(t)}`,"m")}function Ce(e){let t=e.replace(q(se,ve),"");return d$2(t)?.includes("# Workspai project boundary")&&(t=t.replace(q(a$1,b$1),"")),t.replace(/\n{3,}/g,`
115
-
116
- `).trim()}function De(e,t){let n=Ce(e),o=`${se}
117
- ${t.trim()}
118
- ${ve}`;return n?`${o}
119
-
120
- ${n}
121
- `:`${o}
122
- `}async function x(e,t){await y.mkdir(l.dirname(e),{recursive:true});let n=`${e}.${process.pid}.${be.randomUUID()}.tmp`;try{await y.writeFile(n,t,"utf8");try{await y.rename(n,e);}catch(o){let s=o.code;if(s!=="EEXIST"&&s!=="EPERM")throw o;await X.move(n,e,{overwrite:true});}}finally{await y.rm(n,{force:true}).catch(()=>{});}}async function F(e,t){let n=l.resolve(e),o=await y.realpath(n).catch(()=>n),s=l.resolve(t),a=l.relative(n,s);if(!a||a===".."||a.startsWith(`..${l.sep}`)||l.isAbsolute(a))throw new Error("Project agent output path must remain inside the project.");let i=a.split(l.sep),c=n;for(let[h,p]of i.entries()){c=l.join(c,p);let d=await y.lstat(c).catch(u=>{if(u.code==="ENOENT")return null;throw u});if(!d)return l.join(c,...i.slice(h+1));let m=h===i.length-1;if(d.isSymbolicLink()){if(m)throw new Error(`Project agent output is blocked by authored state: ${a}`);let u=await y.realpath(c),k=l.relative(o,u),f=await y.stat(u);if(k===".."||k.startsWith(`..${l.sep}`)||l.isAbsolute(k)||!f.isDirectory())throw new Error(`Project agent output is blocked by authored state: ${a}`);c=u;continue}if(m?!d.isFile():!d.isDirectory())throw new Error(`Project agent output is blocked by authored state: ${a}`)}return c}async function kt(e){let t=l.join(e.projectPath,".agents","skills");try{await F(e.projectPath,l.join(t,"workspai-grounding","SKILL.md"));}catch{return []}let n=await A(l.join(e.workspacePath,p.skillsIndex)),o=new Set([B,...(n?.skills??[]).map(i=>`.agents/skills/${i.skillId}/SKILL.md`)]),s=await y.readdir(t,{withFileTypes:true}).catch(i=>{if(i.code==="ENOENT")return [];throw i});for(let i of s)i.isDirectory()&&i.name.startsWith("workspai-")&&o.add(`.agents/skills/${i.name}/SKILL.md`);let a=[];for(let i of o){let c=l.join(e.projectPath,i);a.push(await F(e.projectPath,c));}return a}function Je(e,t){let n=t?.skillId??"workspai-grounding",o=t?.title??"Workspai project grounding",s=t?`workspace:${t.path}`:null;return ["---",`name: ${n}`,`description: ${JSON.stringify(`${o} through the Workspai project intelligence contract`)}`,"---","",ee,"",`# ${o}`,"",`This is a portable project entry for \`${e.project.name}\`. It contains no machine-local workspace path.`,"","## Workflow","",`1. Read \`${b}\`.`,"2. Run `workspai agent bootstrap --for-agent generic --strict --json`.","3. Continue only when the receipt permits it and follow its bounded `requiredReadOrder`.",...s?[`4. Resolve and follow the canonical Skill \`${s}\` listed in \`workspace:.workspai/reports/workspace-skills-index.json\`.`,`5. Query the graph with \`workspai workspace graph search <task-query> --scope project:${e.project.name} --limit 12 --json\` before broad source inspection.`]:["4. Load only the matching canonical Skill from `workspace:.workspai/reports/workspace-skills-index.json`.",`5. Query the graph with \`workspai workspace graph search <task-query> --scope project:${e.project.name} --limit 12 --json\` before broad source inspection.`],"","Repository-authored instructions and live source remain authoritative for exact implementation.",""].join(`
123
- `)}async function we(e){let t=l.join(e.projectPath,".agents","skills"),n=await A(l.join(e.workspacePath,p.skillsIndex)),o=e.context?[{relativePath:B,skill:void 0},...(n?.skills??[]).map(p=>({relativePath:`.agents/skills/${p.skillId}/SKILL.md`,skill:p}))]:[],s=new Set(o.map(p=>p.relativePath)),a=[],i=[],c=[];try{await F(e.projectPath,l.join(t,"workspai-grounding","SKILL.md"));}catch(p){return {availableFiles:a,writtenFiles:i,authoredCollisions:c,reason:String(p)}}if(e.mode==="managed"&&e.context)for(let p of o){let d=l.join(e.projectPath,p.relativePath),m=await F(e.projectPath,d),u=await y.readFile(m,"utf8").catch(f=>{if(f.code==="ENOENT")return "";throw f});if(u&&!u.includes(ee)){a.push(p.relativePath),c.push(p.relativePath);continue}let k=Je(e.context,p.skill);k!==u&&await x(m,k),a.push(p.relativePath),i.push(p.relativePath);}let h=await y.readdir(t,{withFileTypes:true}).catch(p=>{if(p.code==="ENOENT")return [];throw p});for(let p of h){if(!p.isDirectory()||!p.name.startsWith("workspai-"))continue;let d=`.agents/skills/${p.name}/SKILL.md`;if(e.mode==="managed"&&s.has(d))continue;let m=l.join(e.projectPath,d),u=await F(e.projectPath,m);(await y.readFile(u,"utf8").catch(()=>"")).includes(ee)&&await y.rm(l.dirname(u),{recursive:true,force:true});}return {availableFiles:a,writtenFiles:i,authoredCollisions:c}}async function Re(e,t){let n;try{n=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,reject:false});}catch{return false}if(n?.exitCode!==0)return false;let o=n.stdout.trim();if(!o)return false;let s,a;try{[s,a]=await Promise.all([y.realpath(l.resolve(o)),y.realpath(e)]);}catch{return false}let i=l.resolve(a,t),c=l.relative(s,i).replace(/\\/g,"/");if(!c||l.isAbsolute(c)||c===".."||c.startsWith("../"))return false;let h;try{h=await execa("git",["cat-file","-e",`HEAD:${c}`],{cwd:s,reject:false});}catch{return false}if(h?.exitCode!==0)return false;let p;try{p=await execa("git",["ls-files","--deleted","--error-unmatch","--",`:(top)${c}`],{cwd:s,reject:false});}catch{return false}return p?.exitCode===0}async function ye(e,t){let n=l.join(e,".gitignore"),o=await y.readFile(n,"utf8").catch(c=>{if(c.code==="ENOENT")return "";throw c}),s=[g$1,h,b],a=o.split(/\r?\n/).filter(c=>c.trim()!=="# Workspai local project grounding"&&!s.includes(c.trim()));for(;a.length>0&&a[a.length-1]==="";)a.pop();t==="local"&&(a.length>0&&a.push(""),a.push("# Workspai local project grounding",...s));let i=a.length>0?`${a.join(`
124
- `)}
125
- `:"";i!==o&&await x(n,i);}var M=[{host:"claude",relativePath:"CLAUDE.md",importFromAgents:"@AGENTS.md",importFromGrounding:"@.workspai/PROJECT-GROUNDING.md"},{host:"gemini",relativePath:"GEMINI.md",importFromAgents:"@./AGENTS.md",importFromGrounding:"@./.workspai/PROJECT-GROUNDING.md"},{host:"qwen",relativePath:"QWEN.md",importFromAgents:"@AGENTS.md",importFromGrounding:"@.workspai/PROJECT-GROUNDING.md"},{host:"amazon-q",relativePath:".amazonq/rules/workspai-agent-entry.md",importFromAgents:"",importFromGrounding:""}];if(M.length!==g.length||M.some((e,t)=>e.relativePath!==g[t]))throw new Error("Project agent adapter paths must match the portable entry contract.");async function Ue(e,t){let n=t.split("/").slice(0,-1),o=e;for(let s of n){o=l.join(o,s);let a=await y.lstat(o).catch(i=>{if(i.code==="ENOENT")return null;throw i});if(!a)return null;if(a.isSymbolicLink()||!a.isDirectory())return l.relative(e,o).split(l.sep).join("/")}return null}function qe(e){let t=e.agentsAvailable?e.adapter.importFromAgents:e.adapter.importFromGrounding;return t?`${e.importAlreadyPresent?"":`${t}
126
-
127
- `}# Workspai host binding \xB7 ${e.adapter.host}
128
-
129
- The imported Workspai entry gate is mandatory. Validate this host with
130
- \`workspai agent bootstrap --for-agent ${e.adapter.host} --strict --json\`, then follow
131
- the receipt's \`requiredReadOrder\`, Goal handoff, bounded Graph queries, proof paths,
132
- status policy, workspace locator privacy policy, and authority boundary. Do not repeat
133
- the imported instructions or replace repository-authored source rules.`:`# Workspai entry for ${e.adapter.host}
134
-
135
- Before broad repository discovery, architecture claims, planning, or mutation:
136
-
137
- 1. Read \`${b}\`.
138
- 2. Run \`workspai agent bootstrap --for-agent ${e.adapter.host} --strict --json\`.
139
- 3. Follow \`requiredReadOrder\`, any active Goal handoff, bounded Graph queries, and returned proof paths.
140
-
141
- Receipt policy: \`ready\` may proceed; \`degraded\` must disclose limitations; \`blocked\` must execute \`nextActions\` and rerun bootstrap before governed claims.
142
-
143
- The workspace name is a logical identity, not a path. Resolve \`workspace:\` URIs at runtime with \`workspai project workspace status --json\`; its absolute paths are machine-local and must never be copied into shared output or portable artifacts. Live source owns exact implementation; Workspai evidence owns identity, topology, goals, readiness, and verification. Repository-authored rules remain authoritative for source changes after this entry gate.`}async function je(e$1){let t=await Ue(e$1.projectPath,e$1.adapter.relativePath);if(t)return {reason:`${e$1.adapter.relativePath} has an unsafe repository-authored parent at ${t}.`};let n=l.join(e$1.projectPath,e$1.adapter.relativePath),o=n,s=await y.lstat(n).catch(m=>{if(m.code==="ENOENT")return null;throw m});if(s?.isSymbolicLink()){let m=await Q(e$1.projectPath,n);if(!m)return {reason:`${e$1.adapter.relativePath} is a symbolic link without a safe repository-local file target.`};let u=await y.readFile(m,"utf8");if(e$1.agentsAvailable&&u.includes(se)){let f=`${u.replace(q(d$1,e),"").replace(/\n{3,}/g,`
144
-
145
- `).trimEnd()}
146
- `;return f!==u&&await x(m,f),{path:e$1.adapter.relativePath}}if(u.includes(d$1))return {path:e$1.adapter.relativePath};o=m;}let a=s?.isFile()===true,i=await y.readFile(o,"utf8").catch(m=>{if(m.code==="ENOENT")return "";throw m});if(e$1.mode==="managed"&&!a&&await Re(e$1.projectPath,e$1.adapter.relativePath))return {reason:`${e$1.adapter.relativePath} has an authored tracked deletion.`};let c=i.replace(q(d$1,e),"").replace(/\n{3,}/g,`
147
-
148
- `).trim(),h=!!(e$1.agentsAvailable&&e$1.adapter.importFromAgents&&c.split(/\r?\n/u).some(m=>m.trim()===e$1.adapter.importFromAgents)),p=e$1.mode==="managed"?[c,`${d$1}
149
- ${qe({...e$1,importAlreadyPresent:h}).trim()}
150
- ${e}`].filter(Boolean).join(`
151
-
152
- `):c;if(!p)return a&&!s?.isSymbolicLink()&&await y.rm(o,{force:true}),{};let d=`${p.trimEnd()}
153
- `;return d!==i&&await x(o,d),e$1.mode==="managed"?{path:e$1.adapter.relativePath}:{}}function He(e){let t={id:"generic",discovery:"portable-fallback",entryFiles:[g$1],status:"ready",managed:e.mode==="managed"},o=["codex","kimi","grok","copilot","cursor","windsurf"].map(i=>({id:i,discovery:"native",entryFiles:["AGENTS.md",...["codex","kimi","grok"].includes(i)&&e.portableSkillsAvailable?[B]:[]],status:e.agentsAvailable?["codex","kimi","grok"].includes(i)&&!e.portableSkillsAvailable?"blocked":["codex","kimi","grok"].includes(i)&&e.portableGroundingAuthoredCollision?"degraded":"ready":"blocked",managed:e.mode==="managed"&&e.agentsAvailable&&(!["codex","kimi","grok"].includes(i)||e.portableSkillsAvailable&&!e.portableGroundingAuthoredCollision),...e.agentsAvailable?["codex","kimi","grok"].includes(i)&&!e.portableSkillsAvailable?{reason:e.portableSkillsReason??"The provider-neutral project Skill projection could not be generated safely."}:["codex","kimi","grok"].includes(i)&&e.portableGroundingAuthoredCollision?{reason:"An authored Skill occupies the Workspai grounding path; it was preserved and AGENTS.md remains the fallback entry."}:{}:{reason:"AGENTS.md could not be managed without overriding authored repository state."}})),s=M.map(i=>{let c=e.adapters.get(i.host);return {id:i.host,discovery:"adapter",entryFiles:[i.relativePath],status:c?.path?"ready":e.mode==="managed"?"blocked":"degraded",managed:!!c?.path,...c?.path?{}:{reason:c?.reason??"Provider adapter generation is disabled by the project grounding policy."}}}),a=[t,...o,...s];return f.map(i=>a.find(c=>c.id===i))}async function Pe(e,t,n){let o=l.join(e,"AGENTS.md"),s=await y.lstat(o).catch(d=>{if(d.code==="ENOENT")return null;throw d}),a=s?.isSymbolicLink()?await Q(e,o):o;if(!a)return;let i=s?.isFile()===true||s?.isSymbolicLink()===true,c=await y.readFile(a,"utf8").catch(d=>{if(d.code==="ENOENT")return "";throw d});if(t==="managed"&&!n)throw new Error("Managed project grounding requires a project context.");if(t==="managed"&&!i&&await Re(e,"AGENTS.md"))return;let h=t==="managed"&&n?De(c,Me(n)):Ce(c);if(!h){i&&!s?.isSymbolicLink()&&await y.rm(a,{force:true});return}let p=`${h.trimEnd()}
154
- `;return p!==c&&await x(a,p),t==="managed"?o:void 0}async function ze(e){let t$1=e.mode??"managed",n=l.resolve(e.workspacePath),o=l.resolve(e.projectPath);if(t$1==="off"){let P=u(o,"project.json").find(E=>ne.existsSync(E)),S=P?await A(P):null,N=e.projectName??(typeof S?.name=="string"?S.name:void 0)??l.basename(o),T=Ae(S,e.relationship??"managed"),L=await c({workspacePath:n,projectPath:o,projectName:N,relationship:T,now:e.now});return await ye(o,t$1),await Pe(o,t$1),await we({workspacePath:n,projectPath:o,mode:t$1}),await Promise.all(M.map(E=>je({projectPath:o,adapter:E,mode:t$1,agentsAvailable:false}))),await Promise.all([y.rm(l.join(o,h),{force:true}),y.rm(l.join(o,g$1),{force:true}),y.rm(l.join(o,b),{force:true}),y.rm(l.join(o,t.projectKnowledgeGraphReference),{force:true})]),{mode:t$1,projectPath:o,linkPath:L.linkPath,writtenFiles:[t.projectWorkspaceLink]}}let s=await Fe(e),a=s.workspace.relationship,i$1=await c({workspacePath:n,projectPath:o,projectName:s.project.name,relationship:a,workspaceName:s.workspace.name,relativePath:s.project.relativePath,now:e.now});await ye(o,t$1);let c$1=await Pe(o,t$1,s),h$1=new Map;for(let P of M)h$1.set(P.host,await je({projectPath:o,adapter:P,mode:t$1,agentsAvailable:!!c$1}));let p=await we({workspacePath:n,projectPath:o,mode:t$1,context:s}),d=He({mode:t$1,agentsAvailable:!!c$1,portableSkillsAvailable:p.availableFiles.includes(B),portableGroundingAuthoredCollision:p.authoredCollisions.includes(B),...p.reason?{portableSkillsReason:p.reason}:{},adapters:h$1}),m=l.join(o,h),u$1=l.join(o,g$1),k=l.join(o,b),f=i({context:s,hosts:d});await x(m,`${JSON.stringify(s,null,2)}
155
- `),await x(u$1,`${Be(s).trimEnd()}
156
- `),await x(k,`${JSON.stringify(f,null,2)}
157
- `);let j=[t.projectWorkspaceLink,h,g$1,b];c$1&&j.push("AGENTS.md");for(let P of h$1.values())P.path&&j.push(P.path);return j.push(...p.writtenFiles),{mode:t$1,projectPath:o,linkPath:i$1.linkPath,groundingPath:u$1,contextPath:m,agentEntryPath:k,agentsPath:c$1,hostCoverage:d,writtenFiles:j}}async function wt(e){let t=l.resolve(e.workspacePath),n=e.mode??"managed",o=await Ve(t),s=[],a=[];for(let i of o.resolved)try{s.push(await ze({workspacePath:t,projectPath:i.projectPath,projectName:i.name,relationship:i.relationship,mode:n,now:e.now}));}catch(c){a.push({name:i.name,reason:c instanceof Error?c.message:String(c)});}return {workspacePath:t,mode:n,projects:s,skipped:[...o.skipped,...a]}}async function Ve(e){let t=l.resolve(e),n=await A(l.join(t,".workspai","workspace.contract.json")),o=[],s=[];for(let a of n?.projects??[]){let i=a.slug??a.relativePath??"unknown-project",c=typeof a.externalPath=="string"?l.resolve(a.externalPath):typeof a.relativePath=="string"&&!a.relativePath.startsWith("external/")?l.resolve(t,a.relativePath):null;if(!c||!ne.existsSync(c)){s.push({name:i,reason:"project path is unavailable on this machine"});continue}o.push({name:i,projectPath:c,relationship:a.relationship??"managed"});}return {resolved:o,skipped:s}}export{Q as a,Ne as b,ft as c,se as d,ve as e,ee as f,B as g,Le as h,Fe as i,kt as j,ze as k,wt as l,Ve as m};
@@ -1,7 +0,0 @@
1
- import {a as a$1}from'./chunk-GR6442P7.js';import a from'fs';import s from'path';var v={nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["next","nextjs","next.js"],dependencyHints:["next"],scriptHints:["next dev","next build","next start"],fileHints:["next.config.js","next.config.mjs","next.config.ts"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"],dependencyHints:["@remix-run/react","@remix-run/node","@remix-run/dev"],scriptHints:["remix dev","remix vite:dev"],fileHints:["remix.config.js","remix.config.mjs"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"],dependencyHints:["nuxt","nuxt3"],scriptHints:["nuxt dev","nuxt build","nuxi dev","nuxi build"],fileHints:["nuxt.config.js","nuxt.config.ts","nuxt.config.mjs"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"],dependencyHints:["react","react-dom"],scriptHints:["react-scripts start","react-scripts build"],fileHints:[]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"],dependencyHints:["vite"],scriptHints:["vite","vite dev","vite build"],fileHints:["vite.config.js","vite.config.ts","vite.config.mjs"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"],dependencyHints:["vue","@vue/cli-service"],scriptHints:["vue-cli-service serve","vue-cli-service build"],fileHints:["vue.config.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"],dependencyHints:["@sveltejs/kit"],scriptHints:["svelte-kit dev","svelte-kit build"],fileHints:["svelte.config.js"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"],dependencyHints:["svelte"],scriptHints:["svelte"],fileHints:[]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"],dependencyHints:["@angular/core","@angular/cli"],scriptHints:["ng serve","ng build"],fileHints:["angular.json"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"],dependencyHints:["astro"],scriptHints:["astro dev","astro build"],fileHints:["astro.config.js","astro.config.ts","astro.config.mjs"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"],dependencyHints:["solid-js"],scriptHints:[],fileHints:[]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown frontend",supportTier:"observed",importStack:"unknown",aliases:["unknown"],dependencyHints:[],scriptHints:[],fileHints:[]}},ie={nextjs:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},remix:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},nuxt:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},react:{dev:["dev","start"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vite:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vue:{dev:["dev","serve"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},sveltekit:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},svelte:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},angular:{dev:["start","serve"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},astro:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},solid:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function fe(e,n){let t=typeof e=="string"?_(e):e;return t==="unknown"?[]:ie[t]?.[n]??[]}function re(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}function se(e){let n=re(s.join(e,"package.json"));if(!n)return {dependencies:{},scriptText:""};let t=n.dependencies??{},m=n.private===true&&(Array.isArray(n.workspaces)||n.workspaces!==null&&typeof n.workspaces=="object"||a.existsSync(s.join(e,"pnpm-workspace.yaml")))?t:{...t,...n.devDependencies??{},...n.peerDependencies??{}},l=n.scripts??{},c=Object.values(l).filter(d=>typeof d=="string").join(" ").toLowerCase();return {dependencies:m,scriptText:c}}function oe(e,n){return n.some(t=>a.existsSync(s.join(e,t)))}function L(e){return e.vite?e.react||e["react-dom"]||e["@vitejs/plugin-react"]?"react":e.vue||e["@vitejs/plugin-vue"]?"vue":e.svelte||e["@sveltejs/vite-plugin-svelte"]?"svelte":e["solid-js"]||e["vite-plugin-solid"]?"solid":null:null}function y(e,n,t){let r=v[e]??v.unknown;return {key:r.key,runtime:r.runtime,displayName:r.displayName,supportTier:r.supportTier,importStack:r.importStack,confidence:n,source:t}}function ye(e){return v[e]??v.unknown}function _(e){let n=(e??"").trim().toLowerCase().replace(/[_\s]+/g,"-");if(!n)return "unknown";for(let t of Object.values(v))if(t.aliases.includes(n))return t.key;return "unknown"}function A(e,n){let t=_(typeof n?.framework=="string"?n.framework:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0);if(t!=="unknown")return y(t,"high","framework");let{dependencies:r,scriptText:m}=se(e);for(let l of ["nextjs","remix","nuxt","sveltekit","angular","astro","vue","solid","vite","react","svelte"]){let c=v[l];if(c.dependencyHints.some(d=>r[d])){if(l==="vite"){let d=L(r);if(d)return y(d,"high","manifest")}return y(l,"high","manifest")}if(c.fileHints.length>0&&oe(e,c.fileHints)){if(l==="vite"){let d=L(r);if(d)return y(d,"high","manifest")}return y(l,"high","manifest")}if(c.scriptHints.some(d=>m.includes(d)))return y(l,"medium","manifest")}return y("unknown","low","unknown")}var g={fastapi:{key:"fastapi",runtime:"python",displayName:"FastAPI",supportTier:"first-class",importStack:"fastapi",aliases:["fastapi"],kitPrefixes:["fastapi"]},django:{key:"django",runtime:"python",displayName:"Django",supportTier:"extended",importStack:"django",aliases:["django"]},flask:{key:"flask",runtime:"python",displayName:"Flask",supportTier:"extended",importStack:"flask",aliases:["flask"]},python:{key:"python",runtime:"python",displayName:"Python",supportTier:"observed",importStack:"unknown",aliases:["python"]},nestjs:{key:"nestjs",runtime:"node",displayName:"NestJS",supportTier:"first-class",importStack:"nestjs",aliases:["nestjs","nest"],kitPrefixes:["nestjs"]},nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["nextjs","next.js","next"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"]},express:{key:"express",runtime:"node",displayName:"Express",supportTier:"extended",importStack:"express",aliases:["express"]},fastify:{key:"fastify",runtime:"node",displayName:"Fastify",supportTier:"extended",importStack:"unknown",aliases:["fastify"]},koa:{key:"koa",runtime:"node",displayName:"Koa",supportTier:"extended",importStack:"koa",aliases:["koa"]},node:{key:"node",runtime:"node",displayName:"Node.js",supportTier:"observed",importStack:"unknown",aliases:["node","nodejs","typescript","javascript"]},gofiber:{key:"gofiber",runtime:"go",displayName:"Go/Fiber",supportTier:"extended",importStack:"go",aliases:["gofiber","fiber","go-fiber","go/fiber"],kitPrefixes:["gofiber"]},gogin:{key:"gogin",runtime:"go",displayName:"Go/Gin",supportTier:"extended",importStack:"go",aliases:["gogin","gin","go-gin","go/gin"],kitPrefixes:["gogin"]},echo:{key:"echo",runtime:"go",displayName:"Echo",supportTier:"extended",importStack:"go",aliases:["echo"]},go:{key:"go",runtime:"go",displayName:"Go",supportTier:"observed",importStack:"go",aliases:["go","golang"],kitPrefixes:["go"]},springboot:{key:"springboot",runtime:"java",displayName:"Spring Boot",supportTier:"extended",importStack:"springboot",aliases:["springboot","spring","spring-boot"],kitPrefixes:["springboot"]},java:{key:"java",runtime:"java",displayName:"Java",supportTier:"observed",importStack:"unknown",aliases:["java"]},laravel:{key:"laravel",runtime:"php",displayName:"Laravel",supportTier:"extended",importStack:"unknown",aliases:["laravel"]},symfony:{key:"symfony",runtime:"php",displayName:"Symfony",supportTier:"extended",importStack:"unknown",aliases:["symfony"]},php:{key:"php",runtime:"php",displayName:"PHP",supportTier:"observed",importStack:"unknown",aliases:["php"]},rails:{key:"rails",runtime:"ruby",displayName:"Ruby on Rails",supportTier:"extended",importStack:"rails",aliases:["rails","ruby-on-rails","ruby on rails"]},sinatra:{key:"sinatra",runtime:"ruby",displayName:"Sinatra",supportTier:"extended",importStack:"unknown",aliases:["sinatra"]},ruby:{key:"ruby",runtime:"ruby",displayName:"Ruby",supportTier:"observed",importStack:"unknown",aliases:["ruby"]},dotnet:{key:"dotnet",runtime:"dotnet",displayName:"ASP.NET Core",supportTier:"extended",importStack:"dotnet",aliases:["dotnet","asp.net","aspnet","asp.net core","csharp","c#"],kitPrefixes:["dotnet","aspnet","aspnetcore"]},actix:{key:"actix",runtime:"rust",displayName:"Actix-web",supportTier:"extended",importStack:"unknown",aliases:["actix","actix-web"]},axum:{key:"axum",runtime:"rust",displayName:"Axum",supportTier:"extended",importStack:"unknown",aliases:["axum"]},rocket:{key:"rocket",runtime:"rust",displayName:"Rocket",supportTier:"extended",importStack:"unknown",aliases:["rocket"]},rust:{key:"rust",runtime:"rust",displayName:"Rust",supportTier:"observed",importStack:"unknown",aliases:["rust"]},phoenix:{key:"phoenix",runtime:"elixir",displayName:"Phoenix",supportTier:"extended",importStack:"unknown",aliases:["phoenix"]},elixir:{key:"elixir",runtime:"elixir",displayName:"Elixir",supportTier:"observed",importStack:"unknown",aliases:["elixir"]},clojure:{key:"clojure",runtime:"clojure",displayName:"Clojure",supportTier:"extended",importStack:"unknown",aliases:["clojure"]},scala:{key:"scala",runtime:"scala",displayName:"Scala",supportTier:"extended",importStack:"unknown",aliases:["scala"]},kotlin:{key:"kotlin",runtime:"kotlin",displayName:"Kotlin",supportTier:"extended",importStack:"unknown",aliases:["kotlin"]},deno:{key:"deno",runtime:"deno",displayName:"Deno",supportTier:"extended",importStack:"unknown",aliases:["deno"]},bun:{key:"bun",runtime:"bun",displayName:"Bun",supportTier:"extended",importStack:"unknown",aliases:["bun"]},tauri:{key:"tauri",runtime:"node",displayName:"Tauri",supportTier:"extended",importStack:"unknown",aliases:["tauri","tauri-app"],kitPrefixes:["desktop.tauri"]},electron:{key:"electron",runtime:"node",displayName:"Electron",supportTier:"extended",importStack:"unknown",aliases:["electron","electron-forge"],kitPrefixes:["desktop.electron"]},"vscode-extension":{key:"vscode-extension",runtime:"node",displayName:"VS Code Extension",supportTier:"extended",importStack:"unknown",aliases:["vscode-extension","visual-studio-code-extension"],kitPrefixes:["extension.vscode"]},c:{key:"c",runtime:"c",displayName:"C",supportTier:"observed",importStack:"unknown",aliases:["c","clang","gcc"]},cpp:{key:"cpp",runtime:"cpp",displayName:"C++",supportTier:"observed",importStack:"unknown",aliases:["cpp","c++","cplusplus","cc","clang++","g++"]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown",supportTier:"observed",importStack:"unknown",aliases:["unknown"]}},Q=new Map;for(let e of Object.values(g))for(let n of e.aliases)Q.set(n,e.key);function i(e,n,t){let r=g[e]??g.unknown;return {key:r.key,runtime:r.runtime,displayName:r.displayName,supportTier:r.supportTier,importStack:r.importStack,confidence:n,source:t}}function X(e){return e.trim().toLowerCase().replace(/[_\s]+/g,"-")}function k(e){try{return a.existsSync(e)?a.readFileSync(e,"utf8").toLowerCase():""}catch{return ""}}function Z(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}var J=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","venv","node_modules","vendor","dist","build","target","coverage",".next",".cache","test","tests","spec","specs","testdata","fixtures","__fixtures__"]);function B(e,n){if(n<0||!a.existsSync(e))return [];let t=[],r=[];try{r=a.readdirSync(e,{withFileTypes:true});}catch{return []}for(let m of r){let l=s.join(e,m.name);m.isDirectory()?t.push(...B(l,n-1)):t.push(l);}return t}function P(e,n){if(n<0||!a.existsSync(e))return [];let t=[];try{t=a.readdirSync(e,{withFileTypes:true});}catch{return []}let r=[];for(let m of t){let l=s.join(e,m.name);if(m.isDirectory()){if(J.has(m.name)||a$1(m.name))continue;r.push(...P(l,n-1));}else r.push(l);}return r}function p(e,n,t=2){return B(e,t).some(r=>r.toLowerCase().endsWith(n.toLowerCase()))}function ae(e){let n;try{n=a.readdirSync(e,{withFileTypes:true});}catch{return false}let t=0;for(let r of n){if(!r.isDirectory()||J.has(r.name)||a$1(r.name))continue;let m=s.join(e,r.name);if((a.existsSync(s.join(m,"CMakeLists.txt"))||a.existsSync(s.join(m,"meson.build")))&&(t+=1,t>=3))return true}return false}function h(e,n,t=2){return B(e,t).filter(r=>r.toLowerCase().endsWith(n.toLowerCase()))}function ue(e){let n=X(e??"");if(!n)return "unknown";for(let t of Object.values(g))if(t.kitPrefixes?.some(r=>n.startsWith(r)))return t.key;return "unknown"}function b(e){return e?Q.get(X(e))??"unknown":"unknown"}function je(e){return b(e)}function Fe(e){let n=b(e);return n!=="unknown"?g[n].runtime:"unknown"}function Ne(e){let n=g[e]??g.unknown;return {key:n.key,runtime:n.runtime,displayName:n.displayName,supportTier:n.supportTier,importStack:n.importStack}}function I(e){let n=ue(e.kitName);if(n!=="unknown")return i(n,"high","kit");let t=b(e.framework);if(t!=="unknown")return i(t,"high","framework");let r=b(e.runtime);return r!=="unknown"?i(r,"medium","runtime"):i("unknown","low","unknown")}function de(e){let n=e?.adoption;if(n&&typeof n=="object"&&!Array.isArray(n)){let r=n;if(r.managed_by==="workspai"&&r.mode==="linked")return true}let t=e?.import;return t!==null&&typeof t=="object"&&!Array.isArray(t)&&t.managed_by==="workspai"}function O(e){let n=Z(s.join(e,"package.json"));if(!n)return i("unknown","low","unknown");let t=n.dependencies??{},r=n.devDependencies??{},l=n.private===true&&(Array.isArray(n.workspaces)||n.workspaces!==null&&typeof n.workspaces=="object"||a.existsSync(s.join(e,"pnpm-workspace.yaml")))?t:{...t,...r},c=n.scripts??{},d=Object.values(c).filter(f=>typeof f=="string").join(" ").toLowerCase();return l["@nestjs/core"]||d.includes("nest start")?i("nestjs","high","manifest"):l.express?i("express","high","manifest"):l.fastify?i("fastify","high","manifest"):l.koa?i("koa","high","manifest"):i("node","medium","marker")}function ce(e){let n=Z(s.join(e,"package.json"));if(!n)return i("unknown","low","unknown");let t={...n.dependencies??{},...n.devDependencies??{}},r=n.engines??{},m=n.scripts??{},l=Object.values(m).filter(c=>typeof c=="string").join(" ").toLowerCase();return t["@tauri-apps/api"]||t["@tauri-apps/cli"]||a.existsSync(s.join(e,"src-tauri","Cargo.toml"))?i("tauri","high","manifest"):t.electron||t["@electron-forge/cli"]||l.includes("electron-forge")||l.includes("electron ")?i("electron","high","manifest"):typeof r.vscode=="string"&&(n.activationEvents!==void 0||n.contributes!==void 0)?i("vscode-extension","high","manifest"):i("unknown","low","unknown")}function M(e){let n=[k(s.join(e,"pyproject.toml")),k(s.join(e,"requirements.txt")),k(s.join(e,"requirements.in"))].join(`
2
- `);return n.includes("fastapi")?i("fastapi","high","manifest"):n.includes("django")?i("django","high","manifest"):n.includes("flask")?i("flask","high","manifest"):n.trim()?i("python","medium","marker"):i("unknown","low","unknown")}function W(e){let n=k(s.join(e,"go.mod")),t=k(s.join(e,"main.go")),r=[n,t].join(`
3
- `);return r.includes("github.com/gofiber/fiber")?i("gofiber","high","manifest"):r.includes("github.com/gin-gonic/gin")?i("gogin","high","manifest"):r.includes("github.com/labstack/echo")?i("echo","high","manifest"):n.trim()?i("go","high","manifest"):t.trim()?i("go","medium","marker"):i("unknown","low","unknown")}function G(e){let n=[k(s.join(e,"pom.xml")),k(s.join(e,"build.gradle")),k(s.join(e,"build.gradle.kts"))].join(`
4
- `);return n.includes("spring-boot")||n.includes("org.springframework")?i("springboot","high","manifest"):n.trim()?i("java","medium","marker"):i("unknown","low","unknown")}function q(e){let n=k(s.join(e,"composer.json"));return n.includes("laravel/framework")?i("laravel","high","manifest"):n.includes("symfony/")?i("symfony","high","manifest"):n.trim()?i("php","medium","marker"):i("unknown","low","unknown")}function V(e){let n=k(s.join(e,"Gemfile")),t=h(e,".gemspec",0).map(r=>k(r)).join(`
5
- `);return n.includes("gem 'rails'")||n.includes('gem "rails"')?i("rails","high","manifest"):n.includes("gem 'sinatra'")||n.includes('gem "sinatra"')?i("sinatra","high","manifest"):n.trim()||t.trim()?i("ruby","medium","marker"):i("unknown","low","unknown")}function z(e){let t=[...h(e,".csproj",3),...h(e,".sln",2)].map(r=>k(r)).join(`
6
- `);return t.includes("microsoft.net.sdk.web")||t.includes("microsoft.aspnetcore")||t.includes("swashbuckle.aspnetcore")?i("dotnet","high","manifest"):t.trim()?i("dotnet","medium","marker"):i("unknown","low","unknown")}function U(e){let n=k(s.join(e,"Cargo.toml"));return n.includes("actix-web")?i("actix","high","manifest"):n.includes("axum")?i("axum","high","manifest"):n.includes("rocket")?i("rocket","high","manifest"):n.trim()?i("rust","medium","marker"):i("unknown","low","unknown")}function Y(e){let n=k(s.join(e,"mix.exs"));return n.includes("phoenix")?i("phoenix","high","manifest"):n.trim()?i("elixir","medium","marker"):i("unknown","low","unknown")}function le(e){let n=[],t=r=>{n.includes(r)||n.push(r);};return a.existsSync(s.join(e,"go.mod"))&&t("go"),(a.existsSync(s.join(e,"Cargo.toml"))||a.existsSync(s.join(e,"src-tauri","Cargo.toml")))&&t("rust"),(a.existsSync(s.join(e,"pom.xml"))||a.existsSync(s.join(e,"build.gradle"))||a.existsSync(s.join(e,"build.gradle.kts")))&&t("java"),a.existsSync(s.join(e,"mix.exs"))&&t("elixir"),a.existsSync(s.join(e,"composer.json"))&&t("php"),(p(e,".csproj")||p(e,".sln"))&&t("dotnet"),a.existsSync(s.join(e,"package.json"))&&t("node"),(a.existsSync(s.join(e,"Gemfile"))||p(e,".gemspec",0))&&t("ruby"),(a.existsSync(s.join(e,"pyproject.toml"))||a.existsSync(s.join(e,"setup.py"))||a.existsSync(s.join(e,"requirements.txt"))||a.existsSync(s.join(e,"requirements.in")))&&t("python"),(a.existsSync(s.join(e,"deps.edn"))||a.existsSync(s.join(e,"project.clj")))&&t("clojure"),a.existsSync(s.join(e,"build.sbt"))&&t("scala"),(a.existsSync(s.join(e,"deno.json"))||a.existsSync(s.join(e,"deno.jsonc")))&&t("deno"),(a.existsSync(s.join(e,"bun.lockb"))||a.existsSync(s.join(e,"bun.lock"))||a.existsSync(s.join(e,"bunfig.toml"))||a.existsSync(s.join(e,".bunfig.toml")))&&t("bun"),(a.existsSync(s.join(e,"CMakeLists.txt"))||a.existsSync(s.join(e,"meson.build"))||p(e,".cpp",3)||p(e,".cc",3)||p(e,".cxx",3)||p(e,".hpp",3)||p(e,".hh",3)||p(e,".hxx",3))&&t("cpp"),(p(e,".c",3)||p(e,".h",3))&&t("c"),(a.existsSync(s.join(e,"settings.gradle.kts"))||p(s.join(e,"src"),".kt",3)||k(s.join(e,"build.gradle.kts")).includes("kotlin"))&&t("kotlin"),n}function $(e,n=4){let t=P(e,Math.max(0,Math.min(12,n))),r=new Set(t.map(o=>s.basename(o))),m=t.map(o=>o.toLowerCase()),l=[],c=o=>{l.includes(o)||l.push(o);},d=(...o)=>o.some(x=>r.has(x)),f=(...o)=>m.some(x=>o.some(S=>x.endsWith(S)));return d("go.mod")&&c("go"),d("Cargo.toml")&&c("rust"),d("pom.xml","build.gradle","build.gradle.kts")&&c("java"),d("mix.exs")&&c("elixir"),d("composer.json")&&c("php"),f(".csproj",".sln")&&c("dotnet"),d("package.json")&&c("node"),(d("Gemfile")||f(".gemspec"))&&c("ruby"),d("pyproject.toml","setup.py","requirements.txt","requirements.in")&&c("python"),d("deps.edn","project.clj")&&c("clojure"),d("build.sbt")&&c("scala"),d("deno.json","deno.jsonc")&&c("deno"),d("bun.lockb","bun.lock","bunfig.toml",".bunfig.toml")&&c("bun"),(d("CMakeLists.txt","meson.build")||f(".cpp",".cc",".cxx",".hpp",".hh",".hxx"))&&c("cpp"),f(".c",".h")&&c("c"),(d("settings.gradle.kts")||f(".kt")||t.some(o=>s.basename(o)==="build.gradle.kts"&&k(o).includes("kotlin")))&&c("kotlin"),l}function Te(e,n){let t=de(n),r=(()=>{try{return a.readdirSync(e,{withFileTypes:true})}catch{return []}})(),m=new Set(["package.json","Gemfile","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","mix.exs","composer.json","pyproject.toml","setup.py","requirements.txt","requirements.in","deps.edn","project.clj","build.sbt","deno.json","deno.jsonc","CMakeLists.txt","meson.build"]),l=r.some(u=>u.isFile()&&(m.has(u.name)||/\.(?:csproj|slnx?|gemspec)$/iu.test(u.name))),c=t&&!l?I({framework:typeof n?.framework=="string"?n.framework:void 0,runtime:typeof n?.runtime=="string"?n.runtime:void 0,kitName:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0}):null;if(c?.runtime&&c.runtime!=="unknown"&&$(e).includes(c.runtime))return c;let d=t?null:n,f=I({framework:typeof d?.framework=="string"?d.framework:void 0,runtime:typeof d?.runtime=="string"?d.runtime:void 0,kitName:typeof d?.kit_name=="string"?d.kit_name:typeof d?.kit=="string"?d.kit:void 0});if(f.key!=="unknown")return f;let o=le(e),x=$(e);if(o.length===0&&x.length===1)return i(b(x[0]),"medium","runtime");let S=k(s.join(e,"CMakeLists.txt")),R=k(s.join(e,"meson.build")),C=k(s.join(e,"Cargo.toml")),H=S.trim().length>0||R.trim().length>0,ee=ae(e),F=p(e,".cpp",3)||p(e,".cc",3)||p(e,".cxx",3),D=p(e,".c",3),K=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/u.test(`${S}
7
- ${R}`);if((H||ee)&&o.includes("cpp")&&(F||K))return i("cpp","high","manifest");if(H&&o.includes("c")&&D&&!F&&!K)return i("c","high","manifest");if(o.includes("rust")&&/\[workspace\]/u.test(C)&&/^default-members\s*=/mu.test(C))return i("rust","high","manifest");if(o.includes("bun"))return i("bun","high","marker");if(o.includes("deno"))return i("deno","high","marker");if(o.includes("kotlin"))return i("kotlin","medium","marker");if(o.includes("node")){let u=ce(e);if(u.key!=="unknown")return u;let w=O(e);if(w.key!=="unknown"&&w.key!=="node")return w}let E=[o.includes("python")?M(e):null,o.includes("go")?W(e):null,o.includes("java")?G(e):null,o.includes("php")?q(e):null,o.includes("ruby")?V(e):null,o.includes("rust")?U(e):null,o.includes("elixir")?Y(e):null,o.includes("dotnet")?z(e):null].filter(u=>u!==null).find(u=>u.key!=="unknown"&&u.key!==u.runtime);if(E)return E;if(o.includes("node")){let u=A(e,d);if(u.key!=="unknown")return u;let w=O(e);if(w.key!=="unknown")return w}if(o.includes("python")){let u=M(e);if(u.key!=="unknown")return u}if(o.includes("go")){let u=W(e);if(u.key!=="unknown")return u}if(o.includes("java")){let u=G(e);if(u.key!=="unknown")return u}if(o.includes("php")){let u=q(e);if(u.key!=="unknown")return u}if(o.includes("ruby")){let u=V(e);if(u.key!=="unknown")return u}if(o.includes("rust")){let u=U(e);if(u.key!=="unknown")return u}if(o.includes("elixir")){let u=Y(e);if(u.key!=="unknown")return u}if(o.includes("dotnet")){let u=z(e);if(u.key!=="unknown")return u}return o.includes("clojure")?i("clojure","medium","marker"):o.includes("scala")?i("scala","medium","marker"):o.includes("c")&&D&&!F?i("c","medium","marker"):o.includes("cpp")?i("cpp","medium","marker"):o.includes("c")?i("c","medium","marker"):o.length>0?i(b(o[0]),"medium","runtime"):i("unknown","low","unknown")}export{fe as a,ye as b,_ as c,A as d,ae as e,je as f,Fe as g,Ne as h,I as i,de as j,le as k,$ as l,Te as m};