@visulima/vis 1.0.0-alpha.13 → 1.0.0-alpha.14

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 (100) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE.md +7242 -385
  3. package/dist/bin.js +1 -1
  4. package/dist/config/index.d.ts +493 -1
  5. package/dist/config/index.js +1 -1
  6. package/dist/packem_chunks/applyDefaults.js +2 -2
  7. package/dist/packem_chunks/bin.js +1134 -199
  8. package/dist/packem_chunks/doctor-probe.js +2 -2
  9. package/dist/packem_chunks/fix.js +11 -11
  10. package/dist/packem_chunks/handler.js +1 -1
  11. package/dist/packem_chunks/handler10.js +1 -1
  12. package/dist/packem_chunks/handler11.js +1 -1
  13. package/dist/packem_chunks/handler12.js +5 -5
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +20 -18
  16. package/dist/packem_chunks/handler15.js +1 -20
  17. package/dist/packem_chunks/handler16.js +1 -1
  18. package/dist/packem_chunks/handler17.js +1 -1
  19. package/dist/packem_chunks/handler18.js +1 -1
  20. package/dist/packem_chunks/handler19.js +5 -1
  21. package/dist/packem_chunks/handler2.js +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -5
  23. package/dist/packem_chunks/handler21.js +1 -1
  24. package/dist/packem_chunks/handler22.js +5 -1
  25. package/dist/packem_chunks/handler23.js +1 -5
  26. package/dist/packem_chunks/handler24.js +3 -1
  27. package/dist/packem_chunks/handler25.js +1 -3
  28. package/dist/packem_chunks/handler26.js +1 -1
  29. package/dist/packem_chunks/handler27.js +7 -1
  30. package/dist/packem_chunks/handler28.js +22 -6
  31. package/dist/packem_chunks/handler29.js +3 -23
  32. package/dist/packem_chunks/handler3.js +4 -4
  33. package/dist/packem_chunks/handler30.js +18 -3
  34. package/dist/packem_chunks/handler31.js +1 -1
  35. package/dist/packem_chunks/handler32.js +2 -2
  36. package/dist/packem_chunks/handler33.js +24 -24
  37. package/dist/packem_chunks/handler34.js +2 -2
  38. package/dist/packem_chunks/handler35.js +2 -2
  39. package/dist/packem_chunks/handler36.js +20 -20
  40. package/dist/packem_chunks/handler37.js +2 -2
  41. package/dist/packem_chunks/handler38.js +6 -22
  42. package/dist/packem_chunks/handler39.js +11 -11
  43. package/dist/packem_chunks/handler4.js +1 -1
  44. package/dist/packem_chunks/handler40.js +5 -22
  45. package/dist/packem_chunks/handler41.js +24 -6
  46. package/dist/packem_chunks/handler42.js +10 -5
  47. package/dist/packem_chunks/handler43.js +153 -10
  48. package/dist/packem_chunks/handler44.js +25 -153
  49. package/dist/packem_chunks/handler45.js +3 -25
  50. package/dist/packem_chunks/handler46.js +27 -3
  51. package/dist/packem_chunks/handler47.js +41 -26
  52. package/dist/packem_chunks/handler48.js +32 -40
  53. package/dist/packem_chunks/handler5.js +7 -7
  54. package/dist/packem_chunks/handler6.js +1 -1
  55. package/dist/packem_chunks/handler7.js +1 -1
  56. package/dist/packem_chunks/handler8.js +1 -1
  57. package/dist/packem_chunks/handler9.js +1 -1
  58. package/dist/packem_chunks/heal-accept.js +4 -4
  59. package/dist/packem_chunks/heal.js +3 -3
  60. package/dist/packem_chunks/help-command.js +18 -0
  61. package/dist/packem_chunks/index.js +4 -4
  62. package/dist/packem_chunks/loader.js +1 -1
  63. package/dist/packem_chunks/tar.js +1 -1
  64. package/dist/packem_shared/ai-analysis-Dzs_nUwM.js +68 -0
  65. package/dist/packem_shared/ai-cache-Dtvmbsru.js +1 -0
  66. package/dist/packem_shared/{ai-fix-nn4zOE95.js → ai-fix-BmLM72GS.js} +4 -4
  67. package/dist/packem_shared/cache-directory-xASJia6M.js +1 -0
  68. package/dist/packem_shared/dependency-scan-DmwPKwLy.js +2 -0
  69. package/dist/packem_shared/docker-CA-scYu0.js +2 -0
  70. package/dist/packem_shared/failure-log-fD4DiFb1.js +2 -0
  71. package/dist/packem_shared/flakiness-BIg1rwvp.js +1 -0
  72. package/dist/packem_shared/{giget-CcEy_Elm.js → giget-BX2ixMoa.js} +2 -2
  73. package/dist/packem_shared/index-OlP7U_t5.js +6 -0
  74. package/dist/packem_shared/lockfile-BXylopgH.js +1 -0
  75. package/dist/packem_shared/otelPlugin-y5hoCw4b.js +1 -0
  76. package/dist/packem_shared/registry-BHqKXiLb.js +2 -0
  77. package/dist/packem_shared/run-summary-utils-D39XBHWW.js +1 -0
  78. package/dist/packem_shared/runtime-check-BaKni2y1.js +1 -0
  79. package/dist/packem_shared/selectors-BvtUXWGY.js +3 -0
  80. package/dist/packem_shared/toolchain-B7sIiJxK.js +5 -0
  81. package/dist/packem_shared/typosquats-XkC1CnOa.js +1 -0
  82. package/dist/packem_shared/verify-BVTcVfoW.js +1 -0
  83. package/dist/packem_shared/{vis-update-app-D1jl0UZZ.js → vis-update-app-DR8c4OfG.js} +1 -1
  84. package/package.json +15 -30
  85. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +0 -67
  86. package/dist/packem_shared/ai-cache-DoiF80AR.js +0 -1
  87. package/dist/packem_shared/cache-directory-CwHlJhgx.js +0 -1
  88. package/dist/packem_shared/dependency-scan-COr5n63B.js +0 -2
  89. package/dist/packem_shared/docker-D6OGr5_S.js +0 -2
  90. package/dist/packem_shared/failure-log-iUVLf6ts.js +0 -2
  91. package/dist/packem_shared/flakiness-D9wf0t56.js +0 -1
  92. package/dist/packem_shared/otel-DxDUPJJH.js +0 -6
  93. package/dist/packem_shared/otelPlugin-CQq6poq8.js +0 -1
  94. package/dist/packem_shared/registry-CkubDdiY.js +0 -2
  95. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +0 -1
  96. package/dist/packem_shared/runtime-check-BXZ43CBW.js +0 -1
  97. package/dist/packem_shared/selectors-BylODRiM.js +0 -3
  98. package/dist/packem_shared/toolchain-BgBOUHII.js +0 -5
  99. package/dist/packem_shared/typosquats-CcZl99B1.js +0 -1
  100. package/dist/packem_shared/verify-Baj5mFJ7.js +0 -1
@@ -1,25 +1,3 @@
1
- var he=Object.defineProperty;var D=(e,s)=>he(e,"name",{value:s,configurable:!0});import{createRequire as ke}from"node:module";import{green as w,bold as v,dim as u,cyan as R,yellow as x,red as b}from"@visulima/colorize";import{isAccessibleSync as I,readJsonSync as j,readFileSync as Pe,writeFileSync as ve,writeJsonSync as E,walkSync as U}from"@visulima/fs";import{join as W,resolve as K,relative as P}from"@visulima/path";import{o as re}from"../packem_shared/index-DH-5hsrC.js";import{aA as pe,aB as te,z as C,al as we,ak as L,aC as De,E as oe,aF as se,K as be,g as xe,aG as Ne,aH as Je,aI as Se,aJ as Te}from"./bin.js";const ye=ke(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$e=D(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[s,o]=z.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return z.getBuiltinModule(e)}return ye(e)},"__cjs_getBuiltinModule"),{readFileSync:ie,writeFileSync:ee}=$e("node:fs");var Re=Object.defineProperty,O=D((e,s)=>Re(e,"name",{value:s,configurable:!0}),"r$3");const We=O(e=>/[*?[\]{}!]/.test(e),"isGlob"),je=O(e=>typeof e=="string"?e:e.reason,"ruleReason"),Me=O(e=>typeof e=="string"?void 0:e.replacement,"ruleReplacement"),ae=O((e,s)=>e.some(o=>re(o,s)),"matchesAnyGlob"),ne=O((e,s)=>{if(typeof e=="string")return!0;const o=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!o&&!t||o&&s.packageName!==void 0&&ae(e.packages,s.packageName)||t&&ae(e.paths,s.packageDir))},"ruleAppliesToInstance"),Fe=O((e,s)=>{const o=s[e.depName];if(o!==void 0&&ne(o,e))return{pattern:e.depName,rule:o};for(const[t,r]of Object.entries(s))if(We(t)&&re(t,e.depName)&&ne(r,e))return{pattern:t,rule:r}},"findMatchingRule"),Ie=O((e,s)=>{if(Object.keys(s).length===0)return[];const o=[];for(const t of e){if(t.isInternal)continue;const r=Fe(t,s);r&&o.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:je(r.rule),replacement:Me(r.rule),specifier:t.specifier})}return o},"lintBannedDeps");var Ee=Object.defineProperty,_=D((e,s)=>Ee(e,"name",{value:s,configurable:!0}),"m");const Ce=new Set(["dependencies","devDependencies","peerDependencies"]),Ae=_(e=>e.startsWith("catalog:"),"isCatalogReference"),Ve=_(e=>e.startsWith("workspace:"),"isWorkspaceReference"),Oe=_((e,s)=>{if(!e)return!1;for(const o of e.values())if(o.has(s))return!0;return!1},"isPinnedInAnyCatalog"),He=_((e,s={})=>{const o=s.min??3,t=new Set(s.ignoreDeps),r=e.filter(i=>i.isInternal||!Ce.has(i.depType)||Ve(i.specifier)||s.dep!==void 0&&i.depName!==s.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const p=n.get(i.depName);p?p.push(i):n.set(i.depName,[i])}const a=[];for(const[i,p]of n){if(Oe(s.catalogs,i)||p.some(m=>Ae(m.specifier)))continue;const c=new Map;for(const m of p){let d=c.get(m.specifier);d||(d=new Set,c.set(m.specifier,d)),d.add(m.packageJsonPath)}const f=[...c.entries()].sort((m,d)=>m[1].size!==d[1].size?d[1].size-m[1].size:m[0].localeCompare(d[0]))[0];!f||f[1].size<o||a.push({catalogName:"default",depName:i,instanceCount:f[1].size,specifier:f[0]})}return a.sort((i,p)=>i.depName.localeCompare(p.depName))},"proposeCatalogAdditions"),_e=_((e,s)=>{if(s.length===0)return;const o=W(e,"pnpm-workspace.yaml"),t=I(o)?ie(o,"utf8"):"",r=t.includes(`\r
2
- `)?`\r
3
- `:`
4
- `,n=s.filter(d=>d.catalogName==="default").sort((d,g)=>d.depName.localeCompare(g.depName));if(n.length===0)return;const a=t.length>0?t.split(r):[],i=a.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(i===-1){const d=["catalog:"];for(const $ of n)d.push(` ${$.depName}: "${$.specifier}"`);let g=0;for(;g<a.length&&(a[g]??"").trim().length===0;)g+=1;const h=[...a.slice(0,g),...d,"",...a.slice(g)].join(r);return ee(o,h.endsWith(r)?h:`${h}${r}`),o}let p=a.length;const c=new Set;for(let d=i+1;d<a.length;d+=1){const g=a[d]??"",h=g.trimStart();if(g.length===0)continue;if(g.length-h.length===0&&h.length>0&&!h.startsWith("#")){p=d;break}const $=/^([\w./@-]+)\s*:/.exec(h);$?.[1]&&c.add($[1])}const f=[];for(const d of n)c.has(d.depName)||f.push(` ${d.depName}: "${d.specifier}"`);if(f.length===0)return;const m=[...a.slice(0,p),...f,...a.slice(p)].join(r);return ee(o,m.endsWith(r)?m:`${m}${r}`),o},"applyCatalogProposals"),ze=_((e,s)=>{if(s.length===0)return"";const o=W(e,"pnpm-workspace.yaml"),t=I(o)?ie(o,"utf8"):"",r=[...s].sort((i,p)=>i.depName.localeCompare(p.depName)),n=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],a=t.includes(`\r
5
- `)?`\r
6
- `:`
7
- `;if((t.length>0?t.split(a):[]).findIndex(i=>/^catalog\s*:\s*$/.test(i))===-1){n.push("@@ +1 @@","+catalog:");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}else{n.push("@@ catalog: @@");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}return n.join(a)},"renderCatalogProposalsDiff");var Be=Object.defineProperty,ce=D((e,s)=>Be(e,"name",{value:s,configurable:!0}),"l");const Le=ce(e=>{const s=[],o=pe(e);if(o){const r=W(e,"pnpm-workspace.yaml");for(const n of o)n.startsWith("!")||te(e,[n]).length===0&&s.push({pattern:n,source:"pnpm-workspace.yaml",sourcePath:r})}const t=W(e,"package.json");if(I(t)){const r=j(t).workspaces,n=Array.isArray(r)?r:r?.packages;if(n)for(const a of n)typeof a!="string"||a.startsWith("!")||te(e,[a]).length===0&&s.push({pattern:a,source:"package.json",sourcePath:t})}return s},"lintDeadWorkspacePatterns"),qe=ce((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.sourcePath);a?a.push(n):t.set(n.sourcePath,[n])}const r=[];for(const[n,a]of t){const i=new Set(a.map(f=>f.pattern));if(n.endsWith(".yaml")||n.endsWith(".yml")){const f=Pe(n).split(`
8
- `).filter(m=>{const d=m.trim();if(!d.startsWith("- "))return!0;const g=d.slice(2).replaceAll(/^['"]|['"]$/g,"");return!i.has(g)}).join(`
9
- `);ve(n,f,{overwrite:!0}),r.push(n);continue}const p=j(n),c=p.workspaces;Array.isArray(c)?p.workspaces=c.filter(f=>typeof f!="string"||!i.has(f)):c&&Array.isArray(c.packages)&&(c.packages=c.packages.filter(f=>typeof f!="string"||!i.has(f))),E(n,p,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyDeadWorkspacePatternFixes");var Ge=Object.defineProperty,fe=D((e,s)=>Ge(e,"name",{value:s,configurable:!0}),"f$2");const Ue=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Ke=fe((e,s={})=>{const o=new Set(s.ignoreBlocks),t=we(e),r=[];for(const n of t){const a=W(e,n,"package.json"),i=L(a);if(!i)continue;const p=typeof i.name=="string"?i.name:void 0;for(const c of Ue){if(o.has(c))continue;const f=i[c];typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length===0&&r.push({depType:c,packageDir:n,packageJsonPath:a,packageName:p})}}return r},"lintEmptyDeps"),Qe=fe((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&!Array.isArray(c)&&Object.keys(c).length===0&&Reflect.deleteProperty(i,p.depType)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyEmptyDepsFixes");var Xe=Object.defineProperty,le=D((e,s)=>Xe(e,"name",{value:s,configurable:!0}),"o");const Ye=/\/+$/,Q=/node_modules/,X=/\.git/,Ze=/[$()+.?[\\\]^{|}]/g,et=/\/\*\*$|\/\*\/\*$/,tt=le((e,s)=>{const o=s.replace(Ye,"");if(o.startsWith("!"))return[];const t=[];if(o.endsWith("/*")){const n=o.slice(0,-2),a=K(e,n);if(!I(a))return[];for(const i of U(a,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path===a||i.name.startsWith(".")||t.push(W(n,i.name));return t}if(o.endsWith("/**")||o.endsWith("/*/*")){const n=o.replace(et,""),a=K(e,n);if(!I(a))return[];for(const i of U(a,{includeFiles:!1,includeSymlinks:!1,skip:[Q,X]})){if(i.path===a)continue;const p=i.path.slice(a.length+1);t.push(`${n}/${p}`)}return t}if(!o.includes("/")&&o.includes("*")){const n=o.replaceAll(Ze,"\\$&").replaceAll("*",".*"),a=new RegExp(`^${n}$`);for(const i of U(e,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path!==e&&a.test(i.name)&&t.push(i.name);return t}const r=K(e,o);return I(r)&&t.push(o),t},"collectPatternMatches"),ot=le(e=>{const s=pe(e)??De(e)??[],o=new Set,t=[];for(const r of s)for(const n of tt(e,r))n==="."||o.has(n)||(o.add(n),I(W(e,n,"package.json"))||t.push({packageDir:n}));return t},"lintMissingPackageJson");var st=Object.defineProperty,at=D((e,s)=>st(e,"name",{value:s,configurable:!0}),"r$2");const nt=["dependencies","devDependencies","optionalDependencies","peerDependencies"],rt=at((e,s={})=>{const o=new Set(s.depTypes??nt),t=new Set(s.ignoreDeps),r=new Map;for(const a of e)a.packageDir!=="."||!o.has(a.depType)||r.set(a.depName,{depType:a.depType,specifier:a.specifier});if(r.size===0)return[];const n=[];for(const a of e){if(a.packageDir==="."||!o.has(a.depType)||t.has(a.depName))continue;const i=r.get(a.depName);i&&n.push({childSpecifier:a.specifier,depName:a.depName,depType:a.depType,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName,rootDepType:i.depType,rootSpecifier:i.specifier})}return n},"lintRedefineRoot");var it=Object.defineProperty,ge=D((e,s)=>it(e,"name",{value:s,configurable:!0}),"a$1");const pt=ge((e,s)=>{if(!s)return[];const o=W(e,"package.json"),t=L(o);if(!t)return[];if(t.private!==!0)return[];const r=t.dependencies;if(typeof r!="object"||r===null||Array.isArray(r))return[];const n=Object.keys(r);return n.length===0?[]:[{depNames:n,packageJsonPath:o}]},"lintRootDeps"),ct=ge((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=j(r.packageJsonPath),a=n.dependencies;if(typeof a!="object"||a===null)continue;const i=a;n.devDependencies??={};const p=n.devDependencies;for(const c of r.depNames){const f=i[c];typeof f=="string"&&(c in p||(p[c]=f),Reflect.deleteProperty(i,c))}Object.keys(i).length===0&&Reflect.deleteProperty(n,"dependencies"),E(r.packageJsonPath,n,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootDepsFixes");var ft=Object.defineProperty,de=D((e,s)=>ft(e,"name",{value:s,configurable:!0}),"r$1");const lt=/^[a-z][\w-]*@\S+$/i,gt=de((e,s,o={})=>{if(!s)return[];const t=W(e,"package.json"),r=L(t);if(!r)return[];const n=r.packageManager;return typeof n=="string"&&lt.test(n)?[]:[{packageJsonPath:t,suggested:o.suggested}]},"lintRootPackageManager"),dt=de((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){if(!r.suggested)continue;const n=j(r.packageJsonPath);n.packageManager=r.suggested,E(r.packageJsonPath,n,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPackageManagerFixes");var ut=Object.defineProperty,ue=D((e,s)=>ut(e,"name",{value:s,configurable:!0}),"a");const mt=ue((e,s)=>{if(!s)return[];const o=W(e,"package.json"),t=L(o);return t?t.private===!0?[]:[{packageJsonPath:o,rawValue:t.private}]:[]},"lintRootPrivate"),ht=ue((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=j(r.packageJsonPath);let a=n;if("private"in n)n.private=!0;else{const{name:i,version:p,...c}=n,f={};i!==void 0&&(f.name=i),p!==void 0&&(f.version=p),f.private=!0;for(const[m,d]of Object.entries(c))f[m]=d;a=f}E(r.packageJsonPath,a,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPrivateFixes");var kt=Object.defineProperty,Z=D((e,s)=>kt(e,"name",{value:s,configurable:!0}),"p$1");const yt=[{id:"react",label:"React",members:["react","react-dom","react-test-renderer"]},{id:"next",label:"Next.js",members:["next","@next/font","@next/bundle-analyzer","@next/mdx","@next/third-parties","@next/eslint-plugin-next","eslint-config-next"]},{id:"babel",label:"Babel",prefixes:["@babel/"]},{id:"storybook",label:"Storybook",members:["storybook","sb"],prefixes:["@storybook/"]},{id:"vitest",label:"Vitest",members:["vitest"],prefixes:["@vitest/"]},{id:"playwright",label:"Playwright",members:["playwright","@playwright/test"]},{id:"trpc",label:"tRPC",prefixes:["@trpc/"]},{id:"prisma",label:"Prisma",members:["prisma"],prefixes:["@prisma/"]},{id:"turborepo",label:"Turborepo",members:["turbo","turbo-ignore","@turbo/gen","eslint-config-turbo","eslint-plugin-turbo"]},{id:"typescript-eslint",label:"typescript-eslint",members:["typescript-eslint"],prefixes:["@typescript-eslint/"]},{id:"eslint-stylistic",label:"ESLint Stylistic",prefixes:["@stylistic/"]},{id:"lexical",label:"Lexical",members:["lexical"],prefixes:["@lexical/"]},{id:"nx",label:"Nx",prefixes:["@nx/","@nrwl/"]}],$t=new Set(["dependencies","devDependencies","peerDependencies"]),Pt=Z((e,s)=>{for(const o of e)if(o.members?.includes(s)||o.prefixes?.some(t=>s.startsWith(t)))return o},"familyForDep"),vt=Z(e=>e.startsWith("workspace:")||e.startsWith("catalog:"),"isWorkspaceOrCatalogReference"),wt=Z((e,s={})=>{const o=new Set(s.ignoreFamilies),t=new Map;for(const i of yt)t.set(i.id,i);for(const i of s.extraFamilies??[])t.set(i.id,i);const r=[...t.values()],n=new Map;for(const i of e){if(i.isInternal||!$t.has(i.depType)||vt(i.specifier))continue;const p=Pt(r,i.depName);if(!p||o.has(p.id))continue;const c=n.get(p.id),f={depName:i.depName,depType:i.depType,packageDir:i.packageDir,packageJsonPath:i.packageJsonPath,packageName:i.packageName,specifier:i.specifier};c?c.push(f):n.set(p.id,[f])}const a=[];for(const[i,p]of n){const c=[...new Set(p.map(m=>m.specifier))];if(c.length<2)continue;const f=t.get(i);f&&a.push({family:i,familyLabel:f.label??i,members:p,specifiers:c})}return a},"lintSimilarDeps");var Dt=Object.defineProperty,B=D((e,s)=>Dt(e,"name",{value:s,configurable:!0}),"r");const bt=B(e=>e.startsWith("@types/"),"isTypesPackage"),xt=B((e,s={})=>{const o=new Set(s.ignoreDeps),t=new Map,r=B(a=>{const i=t.get(a);if(i!==void 0)return i;try{const p=j(a).private===!0;return t.set(a,p),p}catch{return t.set(a,!1),!1}},"isPrivate"),n=[];for(const a of e)a.depType==="dependencies"&&bt(a.depName)&&(o.has(a.depName)||r(a.packageJsonPath)&&n.push({childSpecifier:a.specifier,depName:a.depName,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName}));return n},"lintTypesInDeps"),Nt=B((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n),p=i.dependencies;if(typeof p!="object"||p===null)continue;const c=p;i.devDependencies??={};const f=i.devDependencies;for(const m of a){const d=c[m.depName];typeof d=="string"&&(m.depName in f||(f[m.depName]=d),Reflect.deleteProperty(c,m.depName))}Object.keys(c).length===0&&Reflect.deleteProperty(i,"dependencies"),E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyTypesInDepsFixes");var Jt=Object.defineProperty,q=D((e,s)=>Jt(e,"name",{value:s,configurable:!0}),"f");const St=q(e=>e.startsWith("workspace:"),"isWorkspaceSpecifier"),Tt=q((e,s={})=>{const o=s.fixSpecifier??"workspace:*",t=[];for(const r of e)r.isInternal&&(St(r.specifier)||t.push({depName:r.depName,depType:r.depType,fix:o,packageDir:r.packageDir,packageJsonPath:r.packageJsonPath,packageName:r.packageName,specifier:r.specifier}));return t},"lintWorkspaceProtocol"),Rt=q((e,s,o,t)=>{const r=s.split(".");let n=e;for(let p=0;p<r.length-1;p+=1){const c=r[p],f=n[c];(typeof f!="object"||f===null)&&(n[c]={}),n=n[c]}const a=r.at(-1);let i=n[a];(typeof i!="object"||i===null)&&(i={},n[a]=i),i[o]=t},"setNestedField"),Wt=q((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a)if(p.depType.includes("."))Rt(i,p.depType,p.depName,p.fix);else{const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceProtocolFixes");var jt=Object.defineProperty,A=D((e,s)=>jt(e,"name",{value:s,configurable:!0}),"p");const Mt=new Set(["dependencies","devDependencies","peerDependencies"]),Ft=A(e=>e.startsWith("catalog:"),"isCatalogReference"),It=A(e=>e.startsWith("workspace:"),"isWorkspaceReference"),Et=A(e=>{if(!e.startsWith("catalog:"))return;const s=e.slice(8);return s===""?"default":s},"catalogNameOf"),Ct=A((e,s)=>{if(e.get("default")?.has(s))return"default";const o=[...e.keys()].filter(t=>t!=="default").sort();for(const t of o)if(e.get(t)?.has(s))return t},"findCatalogPinning"),At=A(e=>e==="default"?"catalog:":`catalog:${e}`,"buildCatalogSpecifier"),Vt=A((e,s)=>{const o=[...e].sort((r,n)=>(r.packageName??r.packageDir).localeCompare(n.packageName??n.packageDir));let t;for(const r of o){const n=oe(r.specifier);if(!n)continue;if(!t){t=r;continue}const a=oe(t.specifier);if(!a){t=r;continue}const i=se(a,n),p=se(n,a);(s==="highest"&&i||s==="lowest"&&p)&&(t=r)}if(t)return{canonical:t,canonicalSource:t.packageName??t.packageDir}},"pickCanonicalBySemver"),Ot=A((e,s={})=>{const o=s.resolve??"highest",t=new Set(s.ignoreDeps),r=[],n=e.filter(i=>i.isInternal||!Mt.has(i.depType)||It(i.specifier)||s.dep!==void 0&&i.depName!==s.dep?!1:!t.has(i.depName)),a=new Map;for(const i of n){const p=a.get(i.depName);p?p.push(i):a.set(i.depName,[i])}for(const[i,p]of a){const c=s.pinned?.get(i);if(c!==void 0){for(const g of p)g.specifier!==c&&r.push({canonicalSource:"cli:--pin",depName:i,depType:g.depType,fix:c,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier});continue}if(o==="catalog"){const{catalogs:g}=s;if(!g)continue;const h=Ct(g,i);if(!h)continue;const $=At(h);for(const S of p)Et(S.specifier)!==h&&r.push({canonicalSource:`catalog:${h}`,depName:i,depType:S.depType,fix:$,packageDir:S.packageDir,packageJsonPath:S.packageJsonPath,packageName:S.packageName,specifier:S.specifier});continue}const f=p.filter(g=>!Ft(g.specifier));if(f.length<2||new Set(f.map(g=>g.specifier)).size<=1)continue;const m=Vt(f,o);if(!m)continue;const d=m.canonical.specifier;for(const g of f)g.specifier!==d&&r.push({canonicalSource:m.canonicalSource,depName:i,depType:g.depType,fix:d,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier})}return r},"lintWorkspaceVersions"),Ht=A((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceVersionsFixes");var _t=Object.defineProperty,y=D((e,s)=>_t(e,"name",{value:s,configurable:!0}),"u");const zt=y(e=>{if(I(W(e,"pnpm-workspace.yaml")))return!0;const s=W(e,"package.json");if(!I(s))return!1;try{return j(s).workspaces!==void 0}catch{return!1}},"detectWorkspaceConfig"),V=y((e,s)=>{const o=new Map;for(const t of e){const r=s(t),n=o.get(r);n?n.push(t):o.set(r,[t])}return o},"groupBy"),Bt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-protocol: no violations"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-protocol violation${e.length===1?"":"s"}`)));for(const[a,i]of V(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i){const f=o?R("→"):x("→");t.info(` ${u(c.depType)} ${c.depName}: ${b(c.specifier)} ${f} ${w(c.fix)}`)}}o||t.info(u(" Run with --fix to rewrite specifiers in place."))},"printWorkspaceProtocolHuman"),Lt=y((e,s,o)=>{if(e.length===0){o.info(w("✓ redefine-root: no violations"));return}o.info(x(v(`Found ${String(e.length)} dep${e.length===1?"":"s"} re-declared from root`)));for(const[t,r]of V(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r)o.info(` ${u(a.depType)} ${a.depName}: ${b(a.childSpecifier)} ${u(`(root ${a.rootDepType}: ${a.rootSpecifier})`)}`)}o.info(u(" Remove these from child package.json files — root pin will resolve."))},"printRedefineRootHuman"),qt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-versions: no drift"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-version drift${e.length===1?"":"s"}`)));for(const[a,i]of V(e,p=>p.depName)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${v(a)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=P(s,f.packageJsonPath),d=f.packageName??m,g=o?R("→"):x("→");t.info(` ${d} ${u(`(${m})`)} ${u(f.depType)}: ${b(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align drifting specifiers."))},"printWorkspaceVersionsHuman"),Gt=y((e,s,o)=>{if(e.length===0){o.info(w("✓ banned-deps: no violations"));return}o.info(b(v(`Found ${String(e.length)} banned dep${e.length===1?"":"s"}`)));for(const[t,r]of V(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r){const i=a.replacement?` ${u("→")} ${w(a.replacement)}`:"";o.info(` ${u(a.depType)} ${b(a.depName)}${i}`),o.info(` ${u(a.reason)}`)}}},"printBannedDepsHuman"),Ut=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ catalog-proposals: nothing worth promoting"));return}const r=o?"Added":"Would add",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} catalog entr${e.length===1?"y":"ies"}`)));for(const a of e)t.info(` ${v(a.depName)}: ${w(a.specifier)} ${u(`(${String(a.instanceCount)} packages agree)`)}`);if(!o){const a=ze(s,e);if(a){t.info(""),t.info(u("Proposed pnpm-workspace.yaml changes:"));for(const i of a.split(`
10
- `))i.startsWith("+")?t.info(w(i)):i.startsWith("-")?t.info(b(i)):t.info(u(i))}t.info(u(" Run with --fix to write these entries to pnpm-workspace.yaml."))}},"printCatalogProposalsHuman"),Kt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ custom-types: no engines / packageManager / volta drift"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} custom-type drift${e.length===1?"":"s"}`)));for(const[a,i]of V(e,p=>`${p.customType} ${p.depName}`)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${v(a)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=P(s,f.packageJsonPath),d=f.packageName??m,g=o?R("→"):x("→");t.info(` ${d} ${u(`(${m})`)}: ${b(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align engines/packageManager/volta versions."))},"printCustomTypesHuman"),Qt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ empty-deps: no empty dependency blocks"));return}const r=o?"Removed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} empty dependency block${e.length===1?"":"s"}`)));for(const[a,i]of V(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${u(c.depType)}: ${b("{}")}`)}o||t.info(u(" Run with --fix to drop empty blocks."))},"printEmptyDepsHuman"),Xt=y((e,s,o,t)=>{if(e.length===0){t.info(w('✓ root-private: root package.json is "private": true'));return}const r=o?"Set":"Missing",n=o?R:b;for(const a of e){const i=P(s,a.packageJsonPath);if(t.info(n(v(`${r} "private": true on root ${u(`(${i})`)}`))),!o){const p=a.rawValue===void 0?"absent":JSON.stringify(a.rawValue);t.info(` ${u("current:")} ${b(p)}`)}}o||t.info(u(' Run with --fix to set "private": true.'))},"printRootPrivateHuman"),Yt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ root-package-manager: packageManager field present"));return}const r=o?"Set":"Missing",n=o?R:b;for(const a of e){const i=P(s,a.packageJsonPath);t.info(n(v(`${r} packageManager on root ${u(`(${i})`)}`))),!o&&!a.suggested&&t.info(u(" no canonical specifier configured (set policy.rootPackageManager.suggested to enable --fix)"))}o||t.info(u(' e.g. "packageManager": "pnpm@10.32.1"'))},"printRootPackageManagerHuman"),Zt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ root-deps: no runtime dependencies on private root"));return}const r=o?"Moved":"Found",n=o?R:x;for(const a of e){const i=P(s,a.packageJsonPath);t.info(n(v(`${r} ${String(a.depNames.length)} runtime dep${a.depNames.length===1?"":"s"} on private root ${u(`(${i})`)}`)));for(const p of a.depNames)t.info(` ${b(p)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},"printRootDepsHuman"),eo=y((e,s)=>{if(e.length===0){s.info(w("✓ missing-package-json: every workspace dir has a package.json"));return}s.info(x(v(`Found ${String(e.length)} workspace dir${e.length===1?"":"s"} without a package.json`)));for(const o of e)s.info(` ${b(o.packageDir)}`);s.info(u(" Either delete the directory or scaffold a package.json (vis create)."))},"printMissingPackageJsonHuman"),to=y((e,s,o)=>{if(e.length===0){o.info(w("✓ dead-workspace-pattern: every workspace pattern matches at least one package"));return}const t=s?"Removed":"Found",r=s?R:x;o.info(r(v(`${t} ${String(e.length)} unmatched workspace pattern${e.length===1?"":"s"}`)));for(const[n,a]of V(e,i=>i.source)){o.info(` ${v(n)}`);for(const i of a)o.info(` ${b(i.pattern)}`)}s||o.info(u(" Run with --fix to drop dead patterns."))},"printDeadWorkspacePatternsHuman"),oo=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ types-in-deps: no @types/* in dependencies of private packages"));return}const r=o?"Moved":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} @types/* dep${e.length===1?"":"s"} in dependencies`)));for(const[a,i]of V(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${b(c.depName)} ${u(c.childSpecifier)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},"printTypesInDepsHuman"),so=y((e,s,o)=>{if(e.length===0){o.info(w("✓ similar-deps: every related dep family is in sync"));return}o.info(x(v(`Found ${String(e.length)} family${e.length===1?"":" families"} with version drift`)));for(const t of e){o.info(` ${v(t.familyLabel)} ${u(`(${t.specifiers.join(", ")})`)}`);for(const r of t.members){const n=P(s,r.packageJsonPath),a=r.packageName??n;o.info(` ${a} ${u(`(${n})`)} ${u(r.depType)}: ${b(r.depName)}@${x(r.specifier)}`)}}o.info(u(" Pick a single specifier per family and align by hand — auto-fix is unsafe across name boundaries."))},"printSimilarDepsHuman"),ao=y((e,s,o,t,r)=>{let n=!0;const a=y(i=>{n||r.info(""),n=!1,i()},"section");t.workspaceProtocol&&a(()=>{Bt(e.workspaceProtocol??[],s,o.workspaceProtocol,r)}),t.redefineRoot&&a(()=>{Lt(e.redefineRoot??[],s,r)}),t.workspaceVersions&&a(()=>{qt(e.workspaceVersions??[],s,o.workspaceVersions,r)}),t.customTypes&&a(()=>{Kt(e.customTypes??[],s,o.customTypes,r)}),e.catalogProposals!==void 0&&a(()=>{Ut(e.catalogProposals??[],s,o.catalogProposals,r)}),t.bannedDeps&&a(()=>{Gt(e.bannedDeps??[],s,r)}),t.emptyDeps&&a(()=>{Qt(e.emptyDeps??[],s,o.emptyDeps,r)}),t.rootPrivate&&a(()=>{Xt(e.rootPrivate??[],s,o.rootPrivate,r)}),t.rootPackageManager&&a(()=>{Yt(e.rootPackageManager??[],s,o.rootPackageManager,r)}),t.rootDeps&&a(()=>{Zt(e.rootDeps??[],s,o.rootDeps,r)}),t.missingPackageJson&&a(()=>{eo(e.missingPackageJson??[],r)}),t.deadWorkspacePatterns&&a(()=>{to(e.deadWorkspacePatterns??[],o.deadWorkspacePatterns,r)}),t.typesInDeps&&a(()=>{oo(e.typesInDeps??[],s,o.typesInDeps,r)}),t.similarDeps&&a(()=>{so(e.similarDeps??[],s,r)})},"printHuman"),no=y((e,s)=>{for(const o of e.workspaceProtocol??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`workspace-protocol ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
11
- `)}for(const o of e.redefineRoot??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`redefine-root ${t} ${o.depType} ${o.depName} ${o.childSpecifier}
12
- `)}for(const o of e.workspaceVersions??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`workspace-versions ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
13
- `)}for(const o of e.customTypes??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`custom-types ${t} ${o.customType} ${o.depName} ${o.specifier} → ${o.fix}
14
- `)}for(const o of e.bannedDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`banned-deps ${t} ${o.depType} ${o.depName} ${o.reason}
15
- `)}for(const o of e.catalogProposals??[])process.stdout.write(`catalog-proposal ${o.catalogName} ${o.depName} ${o.specifier} ${String(o.instanceCount)}
16
- `);for(const o of e.emptyDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`empty-deps ${t} ${o.depType}
17
- `)}for(const o of e.rootPrivate??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`root-private ${t}
18
- `)}for(const o of e.rootPackageManager??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`root-package-manager ${t} ${o.suggested??""}
19
- `)}for(const o of e.rootDeps??[]){const t=P(s,o.packageJsonPath);for(const r of o.depNames)process.stdout.write(`root-deps ${t} ${r}
20
- `)}for(const o of e.missingPackageJson??[])process.stdout.write(`missing-package-json ${o.packageDir}
21
- `);for(const o of e.deadWorkspacePatterns??[])process.stdout.write(`dead-workspace-pattern ${o.source} ${o.pattern}
22
- `);for(const o of e.typesInDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`types-in-deps ${t} ${o.depName} ${o.childSpecifier}
23
- `)}for(const o of e.similarDeps??[])for(const t of o.members){const r=P(s,t.packageJsonPath);process.stdout.write(`similar-deps ${o.family} ${r} ${t.depType} ${t.depName} ${t.specifier}
24
- `)}},"printMinimal"),ro=y((e,s,o,t)=>{const r=y(a=>({...a,packageJsonPath:P(s,a.packageJsonPath)}),"relativize"),n={fixed:o};if(t.workspaceProtocol){const a=(e.workspaceProtocol??[]).map(i=>r(i));n.workspaceProtocol={issues:a,total:a.length}}if(t.redefineRoot){const a=(e.redefineRoot??[]).map(i=>r(i));n.redefineRoot={issues:a,total:a.length}}if(t.workspaceVersions){const a=(e.workspaceVersions??[]).map(i=>r(i));n.workspaceVersions={issues:a,total:a.length}}if(t.customTypes){const a=(e.customTypes??[]).map(i=>r(i));n.customTypes={issues:a,total:a.length}}if(t.bannedDeps){const a=(e.bannedDeps??[]).map(i=>r(i));n.bannedDeps={issues:a,total:a.length}}if(e.catalogProposals!==void 0){const a=e.catalogProposals;n.catalogProposals={proposals:a,total:a.length}}if(t.emptyDeps){const a=(e.emptyDeps??[]).map(i=>r(i));n.emptyDeps={issues:a,total:a.length}}if(t.rootPrivate){const a=(e.rootPrivate??[]).map(i=>r(i));n.rootPrivate={issues:a,total:a.length}}if(t.rootPackageManager){const a=(e.rootPackageManager??[]).map(i=>r(i));n.rootPackageManager={issues:a,total:a.length}}if(t.rootDeps){const a=(e.rootDeps??[]).map(i=>r(i));n.rootDeps={issues:a,total:a.length}}if(t.missingPackageJson){const a=e.missingPackageJson??[];n.missingPackageJson={issues:a,total:a.length}}if(t.deadWorkspacePatterns){const a=e.deadWorkspacePatterns??[];n.deadWorkspacePatterns={issues:a,total:a.length}}if(t.typesInDeps){const a=(e.typesInDeps??[]).map(i=>r(i));n.typesInDeps={issues:a,total:a.length}}if(t.similarDeps){const a=(e.similarDeps??[]).map(i=>({...i,members:i.members.map(p=>({...p,packageJsonPath:P(s,p.packageJsonPath)}))}));n.similarDeps={issues:a,total:a.length}}process.stdout.write(`${JSON.stringify(n,void 0,2)}
25
- `)},"printJson"),T=y((e,s,o)=>{const t=e[s];return typeof t=="boolean"?t:e[o]===!0},"flag"),io=y(e=>{const s=e,o=(e.ban?.length??0)>0,t=(e.pin?.length??0)>0,r=T(s,"workspaceProtocol","workspace-protocol"),n=T(s,"redefineRoot","redefine-root"),a=T(s,"bannedDeps","banned-deps"),i=T(s,"workspaceVersions","workspace-versions"),p=T(s,"customTypes","custom-types"),c=T(s,"emptyDeps","empty-deps"),f=T(s,"rootPrivate","root-private"),m=T(s,"rootPackageManager","root-package-manager"),d=T(s,"rootDeps","root-deps"),g=T(s,"missingPackageJson","missing-package-json"),h=T(s,"deadWorkspacePatterns","dead-workspace-patterns"),$=T(s,"typesInDeps","types-in-deps"),S=T(s,"similarDeps","similar-deps");return r||n||a||i||p||c||f||m||d||g||h||$||S||o||t?{bannedDeps:a||o,customTypes:p,deadWorkspacePatterns:h,emptyDeps:c,missingPackageJson:g,redefineRoot:n,rootDeps:d,rootPackageManager:m,rootPrivate:f,similarDeps:S,typesInDeps:$,workspaceProtocol:r,workspaceVersions:i||t}:{bannedDeps:!0,customTypes:!0,deadWorkspacePatterns:!0,emptyDeps:!0,missingPackageJson:!0,redefineRoot:!0,rootDeps:!0,rootPackageManager:!0,rootPrivate:!0,similarDeps:!0,typesInDeps:!0,workspaceProtocol:!0,workspaceVersions:!0}},"resolveSelection"),po=y(e=>{const s=new Map;for(const o of e??[]){const t=o.lastIndexOf("@");if(t<=0||t===o.length-1)throw new Error(`Invalid --pin "${o}". Use: name@<specifier> (e.g. react@^18.2.0).`);const r=o.slice(0,t),n=o.slice(t+1);s.set(r,n)}return s},"parsePinFlags"),co=new Set(["catalog","highest","lowest"]),fo=y(e=>{if(e===void 0)return"highest";if(!co.has(e))throw new Error(`Invalid --resolve "${e}". Use: highest, lowest, or catalog.`);return e},"parseResolveStrategy"),F=y((e,s)=>e?s===void 0||s===!0:!1,"isAutofixAllowed"),lo={"custom-types":"policy.customTypes.autofix","workspace-protocol":"policy.workspaceProtocol.autofix","workspace-versions":"policy.workspaceVersions.autofix"},Y=y((e,s,o,t)=>{const r=lo[s],n=o==="prompt"?`${r} = "prompt" (interactive mode not yet implemented; report-only)`:`${r} = false`,a=`Set "${r}": true (or remove it) to enable rewrites.`;e.warn(`${s}: ${String(t)} issue${t===1?"":"s"} not rewritten — ${n}. ${a}`)},"warnAutofixDenied"),Po=y(async({logger:e,options:s,visConfig:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const r=t,n=s.fix??!1,a=s.format??"human",i=s.quiet??!1;if(!["human","json","minimal"].includes(a))throw new Error(`Invalid --format "${a}". Use: human, json, or minimal.`);const p=io(s),c=o?.policy??{},f=o?.editorconfig??!0,m=po(s.pin),d=s.ban??[];(s.dep!==void 0||s.resolve!==void 0)&&!p.workspaceVersions&&!i&&e.warn("--dep / --resolve only apply to --workspace-versions; ignored.");const g=be(r),h={},$={catalogProposals:!1,customTypes:!1,deadWorkspacePatterns:!1,emptyDeps:!1,rootDeps:!1,rootPackageManager:!1,rootPrivate:!1,typesInDeps:!1,workspaceProtocol:!1,workspaceVersions:!1},S=zt(r);let N=0;if(p.workspaceProtocol){const l=Tt(g,{fixSpecifier:s.fixSpecifier}),k=F(n,c.workspaceProtocol?.autofix);k&&l.length>0&&(Wt(l,{useEditorconfig:f}),$.workspaceProtocol=!0),h.workspaceProtocol=l,k||(N+=l.length),n&&!k&&l.length>0&&!i&&Y(e,"workspace-protocol",c.workspaceProtocol?.autofix,l.length)}if(p.redefineRoot){const l=rt(g,{ignoreDeps:c.redefineRoot?.ignore});h.redefineRoot=l,N+=l.length}if(p.workspaceVersions){const l=fo(s.resolve??c.workspaceVersions?.resolve),k=l==="catalog"?xe(r):void 0;l==="catalog"&&(!k||k.size===0)&&!i&&e.warn("--resolve catalog: no catalog found in pnpm-workspace.yaml or root package.json — nothing to align.");const J=Ot(g,{catalogs:k,dep:s.dep,ignoreDeps:c.workspaceVersions?.ignore,pinned:m.size>0?m:void 0,resolve:l}),H=F(n,c.workspaceVersions?.autofix);if(H&&J.length>0&&(Ht(J,{useEditorconfig:f}),$.workspaceVersions=!0),h.workspaceVersions=J,H||(N+=J.length),n&&!H&&J.length>0&&!i&&Y(e,"workspace-versions",c.workspaceVersions?.autofix,J.length),s.proposeMin!==void 0){if(l!=="catalog"&&!i)e.warn("--propose-min only runs under --resolve catalog; ignored.");else if(l==="catalog"){const M=He(g,{catalogs:k,ignoreDeps:c.workspaceVersions?.ignore,min:s.proposeMin});H&&M.length>0&&(_e(r,M),$.catalogProposals=!0),h.catalogProposals=M}}}if(p.customTypes){const l=c.customTypes?.extraTypes,k=Ne(l);if(k.length>0){for(const me of k)e.error(`policy.customTypes.${me}`);process.exitCode=1;return}const J=Je(r,l),H=(s.resolve??c.customTypes?.resolve)==="lowest"?"lowest":"highest",M=Se(J,{dep:s.dep,ignoreDeps:c.customTypes?.ignore,resolve:H}),G=F(n,c.customTypes?.autofix);G&&M.length>0&&(Te(M,{useEditorconfig:f}),$.customTypes=!0),h.customTypes=M,G||(N+=M.length),n&&!G&&M.length>0&&!i&&Y(e,"custom-types",c.customTypes?.autofix,M.length)}if(p.bannedDeps){const l={...c.bannedDeps};for(const J of d)l[J]={reason:"banned via --ban CLI flag"};Object.keys(l).length===0&&s.bannedDeps&&!i&&e.warn("--banned-deps: no policy.bannedDeps in vis config, nothing to check.");const k=Ie(g,l);h.bannedDeps=k,N+=k.length}if(p.emptyDeps){const l=Ke(r,{ignoreBlocks:c.emptyDeps?.ignoreBlocks}),k=F(n,c.emptyDeps?.autofix);k&&l.length>0&&(Qe(l,{useEditorconfig:f}),$.emptyDeps=!0),h.emptyDeps=l,k||(N+=l.length)}if(p.rootPrivate){const l=mt(r,S),k=F(n,c.rootPrivate?.autofix);k&&l.length>0&&(ht(l,{useEditorconfig:f}),$.rootPrivate=!0),h.rootPrivate=l,k||(N+=l.length)}if(p.rootPackageManager){const l=gt(r,S,{suggested:c.rootPackageManager?.suggested}),k=F(n,c.rootPackageManager?.autofix);k&&l.some(J=>J.suggested!==void 0)&&(dt(l,{useEditorconfig:f}),$.rootPackageManager=!0),h.rootPackageManager=l,(!k||!$.rootPackageManager)&&(N+=l.filter(J=>J.suggested===void 0||!$.rootPackageManager).length)}if(p.rootDeps){const l=pt(r,S),k=F(n,c.rootDeps?.autofix);k&&l.length>0&&(ct(l,{useEditorconfig:f}),$.rootDeps=!0),h.rootDeps=l,k||(N+=l.length)}if(p.missingPackageJson){const l=ot(r);h.missingPackageJson=l,N+=l.length}if(p.deadWorkspacePatterns){const l=Le(r),k=F(n,c.deadWorkspacePatterns?.autofix);k&&l.length>0&&(qe(l,{useEditorconfig:f}),$.deadWorkspacePatterns=!0),h.deadWorkspacePatterns=l,k||(N+=l.length)}if(p.typesInDeps){const l=xt(g,{ignoreDeps:c.typesInDeps?.ignore}),k=F(n,c.typesInDeps?.autofix);k&&l.length>0&&(Nt(l,{useEditorconfig:f}),$.typesInDeps=!0),h.typesInDeps=l,k||(N+=l.length)}if(p.similarDeps){const l=wt(g,{extraFamilies:c.similarDeps?.extraFamilies,ignoreFamilies:c.similarDeps?.ignoreFamilies});h.similarDeps=l,N+=l.length}i||(a==="json"?ro(h,r,$,p):a==="minimal"?no(h,r):ao(h,r,$,p,e)),N>0&&(process.exitCode=1)},"execute");export{Po as default};
1
+ var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{Box as c,Text as r,TextInput as he,ScrollBar as Oe,ScrollView as Ye,useApp as Ke,useWindowSize as Qe,useInput as H,Dialog as Ze,Tabs as et,Tab as tt,render as rt}from"@visulima/tui";import{aA as ot,A as nt,s as it}from"./bin.js";import ct,{useMemo as q,useSyncExternalStore as st,useState as C,useRef as Z,useEffect as le,useCallback as lt}from"react";import{isAccessibleSync as dt,readFileSync as ut,ensureDirSync as ht}from"@visulima/fs";import{stripJsonComments as mt}from"@visulima/fs/utils";import{M as de,K as gt}from"../packem_shared/index-OlP7U_t5.js";import{jsxs as i,jsx as t}from"react/jsx-runtime";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:at}=qe("node:fs"),z=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var ft=Object.defineProperty,Fe=y((n,e)=>ft(n,"name",{value:e,configurable:!0}),"s$5");const pt=Fe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!dt(e))return null;const s=ut(e),a=mt(s),l=a!==s;let o;try{o=JSON.parse(a)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:l}},"readDevcontainerJson"),vt=Fe((n,e,s)=>{const a=s?gt(s):de(n,".devcontainer"),l=s??de(a,"devcontainer.json");ht(a),at(l,`${JSON.stringify(e,null,2)}
2
+ `,"utf8")},"writeDevcontainerJson");var yt=Object.defineProperty,bt=y((n,e)=>yt(n,"name",{value:e,configurable:!0}),"s$4");const wt={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},xt=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],xe=bt((n,e,s)=>{const a=[],l=new Set(s.map(d=>typeof d=="string"?d:d.target));if(n)for(const d of wt[n])l.has(d.target)||a.push(d);const o=Object.keys(e);for(const{featureMatch:d,mounts:g}of xt)if(o.some(f=>f.includes(d)))for(const f of g)l.has(f.target)||a.push(f);return a},"getSuggestedMounts"),A=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Ct=Object.defineProperty,ee=y((n,e)=>Ct(n,"name",{value:e,configurable:!0}),"c$1");const J=ee(n=>structuredClone(n),"deepClone");class kt{static{y(this,"DevcontainerStore")}static{ee(this,"DevcontainerStore")}#o=new Set;#e;constructor(e,s,a=null){const l=e===null,o=e??{name:""},d=J(o);this.#e={config:d,detectedPm:a,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:s,isDirty:!1,mode:l?"create":"edit",originalConfig:l?null:J(o),section:"general",showTemplateSelector:l,suggestedMounts:xe(a,d.features??{},d.mounts??[]),templateIndex:0}}getSnapshot=ee(()=>this.#e,"getSnapshot");subscribe=ee(e=>(this.#o.add(e),()=>{this.#o.delete(e)}),"subscribe");setSection(e){e!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:e})}nextSection(){const e=(A.indexOf(this.#e.section)+1)%A.length;this.setSection(A[e])}previousSection(){const e=(A.indexOf(this.#e.section)-1+A.length)%A.length;this.setSection(A[e])}setFieldIndex(e){e!==this.#e.fieldIndex&&this.#t({...this.#e,fieldIndex:Math.max(0,e)})}setFieldEditing(e){e!==this.#e.fieldEditing&&this.#t({...this.#e,fieldEditing:e})}setTemplateIndex(e){const s=Math.max(0,Math.min(e,z.length-1));s!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:s})}applyTemplate(e){const s=z.find(a=>a.id===e);s&&this.#t(this.#r({...this.#e,config:J(s.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#t({...this.#e,showTemplateSelector:!1})}updateConfig(e){this.#t({...this.#e,config:{...this.#e.config,...e},isDirty:!0})}toggleFeature(e){const s={...this.#e.config.features};s[e]===void 0?s[e]={}:delete s[e],this.#t(this.#r({...this.#e,config:{...this.#e.config,features:s},isDirty:!0}))}setFeatureSearch(e){this.#t({...this.#e,featureSearch:e,fieldIndex:0})}addPort(e){const s=this.#e.config.forwardPorts??[];if(s.includes(e))return;const a=[...s,e];this.#t({...this.#e,config:{...this.#e.config,forwardPorts:a},isDirty:!0})}removePort(e){const s=[...this.#e.config.forwardPorts??[]];s.splice(e,1),this.#t({...this.#e,config:{...this.#e.config,forwardPorts:s.length>0?s:void 0},isDirty:!0})}toggleExtension(e){const s={...this.#e.config.customizations},a={...s.vscode},l=[...a.extensions??[]],o=l.indexOf(e);o===-1?l.push(e):l.splice(o,1),a.extensions=l.length>0?l:void 0,s.vscode=a.extensions||a.settings?a:void 0,this.#t({...this.#e,config:{...this.#e.config,customizations:s.vscode||s.jetbrains?s:void 0},isDirty:!0})}setExtensionSearch(e){this.#t({...this.#e,extensionSearch:e,fieldIndex:0})}addEnvVar(e,s,a){const l=e==="container"?"containerEnv":"remoteEnv",o={...this.#e.config[l],[s]:a};this.#t({...this.#e,config:{...this.#e.config,[l]:o},isDirty:!0})}removeEnvVar(e,s){const a=e==="container"?"containerEnv":"remoteEnv",l={...this.#e.config[a]};delete l[s],this.#t({...this.#e,config:{...this.#e.config,[a]:Object.keys(l).length>0?l:void 0},isDirty:!0})}addMount(e){const s=[...this.#e.config.mounts??[],e];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:s},isDirty:!0}))}removeMount(e){const s=[...this.#e.config.mounts??[]];s.splice(e,1),this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:s.length>0?s:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const e=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:e},isDirty:!0}))}setLifecycleCommand(e,s){this.#t({...this.#e,config:{...this.#e.config,[e]:s||void 0},isDirty:!0})}markClean(){this.#t({...this.#e,isDirty:!1,originalConfig:J(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const e=J(this.#e.config);for(const[s,a]of Object.entries(e))(a===""||a===void 0)&&delete e[s];return e.build&&(e.build.dockerfile===""&&delete e.build.dockerfile,e.build.context===""&&delete e.build.context,e.build.args&&Object.keys(e.build.args).length===0&&delete e.build.args,Object.keys(e.build).length===0&&delete e.build),e.forwardPorts?.length===0&&delete e.forwardPorts,e.mounts?.length===0&&delete e.mounts,e.runServices?.length===0&&delete e.runServices,e.capAdd?.length===0&&delete e.capAdd,e.securityOpt?.length===0&&delete e.securityOpt,e.features&&Object.keys(e.features).length===0&&delete e.features,e.customizations?.vscode?.extensions?.length===0&&delete e.customizations.vscode.extensions,e.customizations?.vscode&&Object.keys(e.customizations.vscode).length===0&&delete e.customizations.vscode,e.customizations&&Object.keys(e.customizations).length===0&&delete e.customizations,e.containerEnv&&Object.keys(e.containerEnv).length===0&&delete e.containerEnv,e.remoteEnv&&Object.keys(e.remoteEnv).length===0&&delete e.remoteEnv,e}#r(e){return{...e,suggestedMounts:xe(e.detectedPm,e.config.features??{},e.config.mounts??[])}}#t(e){this.#e=e;for(const s of this.#o)try{s()}catch{}}}const Ce=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ke=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var St=Object.defineProperty,Ae=y((n,e)=>St(n,"name",{value:e,configurable:!0}),"r$1");const me=Ae(n=>{if(!n)return ke;const e=n.toLowerCase();return ke.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterFeatures"),ge=Ae(n=>{if(!n)return Ce;const e=n.toLowerCase();return Ce.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterExtensions");var Et=Object.defineProperty,It=y((n,e)=>Et(n,"name",{value:e,configurable:!0}),"l$1");const Le=["dockerComposeFile","service"],Tt={dockerComposeFile:"Compose File",service:"Service"},Se={dockerComposeFile:"docker-compose.yml",service:"app"},Dt={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Pt=It(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:a})=>{const l=!!n.dockerComposeFile,o=!!(n.image||n.build);return i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&l&&t(c,{marginBottom:1,children:t(r,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Le.map((d,g)=>{const f=g===s,p=n[d]??"",x=Array.isArray(n[d])?n[d].join(", "):p;return i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{children:[t(c,{width:20,children:i(r,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",Tt[d],":"]})}),t(c,{flexGrow:1,children:f&&e?t(he,{defaultValue:x,onChange:y(v=>{a({[d]:v||void 0})},"onChange"),placeholder:Se[d]}):t(r,{color:x?"white":"gray",children:x||Se[d]})})]}),t(c,{paddingLeft:4,children:t(r,{dimColor:!0,children:Dt[d]})})]},d)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),jt=Le.length;var Ot=Object.defineProperty,Me=y((n,e)=>Ot(n,"name",{value:e,configurable:!0}),"h$3");const Ft=Me(({config:n,fieldIndex:e})=>{const s=n.containerEnv??{},a=n.remoteEnv??{},l=Object.keys(s),o=Object.keys(a),d=l.length,g=l.length+1,f=g+o.length,p=e<=d,x=e>d;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{borderColor:p?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:l.length>0?1:0,children:[t(r,{bold:!0,color:p?"cyan":"white",children:"containerEnv"}),t(r,{dimColor:!0,children:" — baked into the container image"})]}),l.map((v,w)=>{const k=w===e;return t(c,{flexShrink:0,children:i(r,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",t(r,{bold:!0,children:v}),t(r,{dimColor:!0,children:" = "}),t(r,{children:s[v]})]})},v)}),t(c,{flexShrink:0,marginTop:l.length>0?1:0,children:i(r,{color:e===d?"cyan":"gray",inverse:e===d,children:[" ","+ Add variable..."]})})]}),i(c,{borderColor:x?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:o.length>0?1:0,children:[t(r,{bold:!0,color:x?"cyan":"white",children:"remoteEnv"}),t(r,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((v,w)=>{const k=g+w===e;return t(c,{flexShrink:0,children:i(r,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",t(r,{bold:!0,children:v}),t(r,{dimColor:!0,children:" = "}),t(r,{children:a[v]})]})},v)}),t(c,{flexShrink:0,marginTop:o.length>0?1:0,children:i(r,{color:e===f?"cyan":"gray",inverse:e===f,children:[" ","+ Add variable..."]})})]}),t(c,{flexShrink:0,marginTop:1,children:i(r,{dimColor:!0,wrap:"truncate",children:[t(r,{bold:!0,color:"white",children:"a"}),"/",t(r,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",t(r,{bold:!0,color:"white",children:"d"})," ","remove"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),At=Me(n=>{const e=Object.keys(n.containerEnv??{}).length,s=Object.keys(n.remoteEnv??{}).length;return e+1+s+1},"getEnvFieldCount");var Lt=Object.defineProperty,Mt=y((n,e)=>Lt(n,"name",{value:e,configurable:!0}),"h$2");const Bt=Mt(({config:n,fieldIndex:e,scrollOffset:s,searchText:a,viewportHeight:l})=>{const o=q(()=>new Set(n.customizations?.vscode?.extensions),[n.customizations?.vscode?.extensions]),d=q(()=>ge(a),[a]),g=d.length,f=g>l&&l>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),a&&i(r,{dimColor:!0,children:["— filter:"," ",t(r,{color:"yellow",children:a})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[t(r,{children:v?">":" "}),i(r,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),t(c,{flexGrow:1,children:i(r,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(r,{dimColor:!0,children:[" ","-",p.id]})]})})]},p.id)})})}),f&&t(c,{flexShrink:0,marginLeft:1,marginRight:1,children:t(Oe,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:l})})]}),d.length===0&&t(c,{paddingX:1,children:t(r,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var Nt=Object.defineProperty,zt=y((n,e)=>Nt(n,"name",{value:e,configurable:!0}),"p$1");const Gt=zt(({config:n,fieldIndex:e,scrollOffset:s,searchText:a,viewportHeight:l})=>{const o=q(()=>new Set(Object.keys(n.features??{})),[n.features]),d=q(()=>me(a),[a]),g=d.length,f=g>l&&l>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),a&&i(r,{dimColor:!0,children:["— filter:"," ",t(r,{color:"yellow",children:a})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[t(r,{children:v?">":" "}),i(r,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),t(c,{flexGrow:1,children:i(r,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(r,{dimColor:!0,children:[" ","-",p.description]})]})})]},p.id)})})}),f&&t(c,{flexShrink:0,marginLeft:1,marginRight:1,children:t(Oe,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:l})})]}),d.length===0&&t(c,{paddingX:1,children:t(r,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var Rt=Object.defineProperty,_t=y((n,e)=>Rt(n,"name",{value:e,configurable:!0}),"u$1");const ue=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],$t={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ee={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},te=["privileged","overrideCommand"],Ut={overrideCommand:"Override Command",privileged:"Privileged"},Wt=ue.length+te.length,Xt=_t(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:a})=>i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"General Configuration"})}),ue.map((l,o)=>{const d=o===s,g=n[l]??"";return i(c,{marginBottom:1,children:[t(c,{width:20,children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",$t[l],":"]})}),t(c,{flexGrow:1,children:d&&e?t(he,{defaultValue:g,onChange:y(f=>{a({[l]:f})},"onChange"),placeholder:Ee[l]}):t(r,{color:g?"white":"gray",children:g||Ee[l]})})]},l)}),te.map((l,o)=>{const d=ue.length+o===s,g=n[l]??!1;return i(c,{marginBottom:o<te.length-1?1:0,children:[t(c,{width:20,children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Ut[l],":"]})}),t(c,{flexGrow:1,children:i(r,{color:g?"green":"gray",children:[g?"yes":"no",d&&t(r,{dimColor:!0,children:" (Space to toggle)"})]})})]},l)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",t(r,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Be=Wt,ae=te;var Vt=Object.defineProperty,Ht=y((n,e)=>Vt(n,"name",{value:e,configurable:!0}),"s$2");const Ne=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],Jt={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},qt={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},Yt=Ht(({config:n,fieldEditing:e,fieldIndex:s,onSetCommand:a})=>i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Ne.map((l,o)=>{const d=o===s,g=n[l],f=Array.isArray(g)?g.join(" && "):g??"";return i(c,{flexDirection:"column",marginBottom:1,children:[t(c,{children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Jt[l]]})}),t(c,{paddingLeft:4,children:t(r,{dimColor:!0,children:qt[l]})}),t(c,{paddingLeft:4,children:d&&e?t(he,{defaultValue:f,onChange:y(p=>{a(l,p)},"onChange"),placeholder:"e.g. npm install"}):t(r,{color:f?"green":"gray",children:f||"(not set)"})})]},l)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),Kt=Ne.length;var Qt=Object.defineProperty,ze=y((n,e)=>Qt(n,"name",{value:e,configurable:!0}),"s$1");const Ie=ze(n=>typeof n=="string"?n:`[${n.type}] ${n.source} → ${n.target}`,"formatMount"),Zt=ze(({addingMount:n,config:e,detectedPm:s,fieldIndex:a,mountPhase:l,mountSource:o,mountTarget:d,mountType:g,suggestedMounts:f})=>{const p=e.mounts??[];return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[p.length," ","mounts"]}),s&&i(r,{dimColor:!0,children:["— detected:"," ",t(r,{color:"white",children:s})]})]}),f.length>0&&!n&&i(c,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[i(c,{flexShrink:0,children:[t(r,{bold:!0,color:"yellow",children:"Suggested mounts"}),i(r,{dimColor:!0,children:[" ","— press"," ",t(r,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((x,v)=>t(c,{flexShrink:0,children:i(r,{dimColor:!0,wrap:"truncate",children:[" + ",Ie(x)]})},`suggestion-${String(v)}`))]}),p.length>0&&t(c,{flexDirection:"column",marginBottom:1,children:p.map((x,v)=>{const w=v===a;return i(c,{flexShrink:0,height:1,children:[t(r,{children:w?">":" "}),t(c,{flexGrow:1,children:i(r,{bold:w,inverse:w,wrap:"truncate",children:[" ",Ie(x)]})})]},`mount-${String(v)}`)})}),!n&&t(c,{flexShrink:0,children:i(r,{color:a===p.length?"cyan":"gray",inverse:a===p.length,children:[" ","+ Add mount..."]})}),n&&i(c,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[t(c,{flexShrink:0,marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"New Mount"})}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="source",color:l==="source"?"cyan":"white",children:[l==="source"?"❯ ":" ","Source:"]})}),t(r,{color:o?"yellow":"gray",children:o||(l==="source"?"_":"(type source, Enter to continue)")})]}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="target",color:l==="target"?"cyan":"white",children:[l==="target"?"❯ ":" ","Target:"]})}),t(r,{color:d?"yellow":"gray",children:d||(l==="target"?"_":"/container/path")})]}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="type",color:l==="type"?"cyan":"white",children:[l==="type"?"❯ ":" ","Type:"]})}),l==="type"?i(r,{children:[t(r,{bold:g==="volume",color:g==="volume"?"cyan":"gray",children:"[1] volume"})," ",t(r,{bold:g==="bind",color:g==="bind"?"cyan":"gray",children:"[2] bind"})," ",t(r,{bold:g==="tmpfs",color:g==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):t(r,{color:"gray",children:g})]}),t(c,{flexShrink:0,marginTop:1,children:t(r,{dimColor:!0,wrap:"truncate",children:l==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),p.length===0&&!n&&f.length===0&&t(c,{marginTop:1,children:t(r,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var er=Object.defineProperty,tr=y((n,e)=>er(n,"name",{value:e,configurable:!0}),"m$1");const rr=tr(({addingPort:n,addPortValue:e,config:s,fieldIndex:a})=>{const l=s.forwardPorts??[],o=a===l.length;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{marginBottom:1,children:[t(r,{bold:!0,color:"cyan",children:"Forwarded Ports"}),i(r,{dimColor:!0,children:[" ","(",l.length," ","ports)"]})]}),l.map((d,g)=>{const f=g===a;return t(c,{children:i(r,{color:f?"cyan":void 0,inverse:f,children:[" ",String(d)]})},`port-${String(d)}`)}),t(c,{marginTop:l.length>0?1:0,children:i(r,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&n?i(r,{children:["Enter port:"," ",t(r,{color:"yellow",children:e||"_"})]}):"+ Add port..."]})}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",t(r,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var or=Object.defineProperty,nr=y((n,e)=>or(n,"name",{value:e,configurable:!0}),"a");const ir=nr(({focused:n,hadComments:e,jsonPreview:s,mode:a,scrollRef:l})=>i(c,{borderColor:n?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,paddingX:1,children:[t(r,{bold:!0,color:n?"cyan":"white",children:"Preview"}),i(r,{dimColor:!0,children:[" ","(",a==="create"?"new":"edit",")"]})]}),e&&a==="edit"&&t(c,{flexShrink:0,paddingX:1,children:t(r,{color:"yellow",children:"Comments will not be preserved."})}),t(Ye,{flexGrow:1,ref:l,scrollbar:!0,scrollbarColor:"gray",children:s.split(`
3
+ `).map((o,d)=>t(r,{color:"green",children:o},`line-${String(d)}`))})]}),"PreviewPanel");var cr=Object.defineProperty,sr=y((n,e)=>cr(n,"name",{value:e,configurable:!0}),"r");const lr=sr(n=>{const e=[],s=[],a=[];if(!n.image&&!n.build&&!n.dockerComposeFile&&e.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),n.build&&(n.image&&s.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),n.build.dockerfile||e.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),n.dockerComposeFile&&!n.service&&e.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),n.features!==void 0&&(typeof n.features!="object"||Array.isArray(n.features))&&e.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),n.forwardPorts)if(Array.isArray(n.forwardPorts))for(const[l,o]of n.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&e.push({field:"forwardPorts",message:`Invalid port ${String(o)} at index ${String(l)}`});else e.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return n.customizations?.vscode?.extensions&&!Array.isArray(n.customizations.vscode.extensions)&&e.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),n.customizations?.vscode?.settings&&typeof n.customizations.vscode.settings!="object"&&e.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),n.name||a.push({field:"name",message:"Consider adding a name for better identification"}),(!n.features||Object.keys(n.features).length===0)&&a.push({field:"features",message:"Consider adding features for common tools"}),(!n.customizations?.vscode?.extensions||n.customizations.vscode.extensions.length===0)&&a.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),n.privileged&&s.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:e,suggestions:a,valid:e.length===0,warnings:s}},"validateConfig");var ar=Object.defineProperty,Ge=y((n,e)=>ar(n,"name",{value:e,configurable:!0}),"$");const Te=80,De=15,dr=120,Pe=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],ur=Ge((n,e,s,a)=>{switch(n){case"compose":return jt;case"environment":return At(e);case"extensions":return ge(a).length;case"features":return me(s).length;case"general":return Be;case"lifecycle":return Kt;case"mounts":return(e.mounts?.length??0)+1;case"ports":return(e.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),hr=Ge(({onSave:n,store:e})=>{const{exit:s}=Ke(),{columns:a,rows:l}=Qe(),o=st(e.subscribe,e.getSnapshot),[d,g]=C(!1),[f,p]=C(!1),[x,v]=C(!1),[w,k]=C(null),[S,P]=C("editor"),[Y,fe]=C(0),[re,oe]=C(!1),[pe,G]=C(""),[R,_]=C(null),[$,j]=C(""),[ve,O]=C(""),[U,L]=C("key"),[ne,K]=C(!1),[ie,M]=C(""),[ce,B]=C(""),[ye,W]=C("volume"),[I,N]=C("source"),se=Z(null),F=Z(null),D=Z(null),Q=Z(!0);le(()=>(Q.current=!0,()=>{Q.current=!1,D.current&&clearTimeout(D.current)}),[]);const be=ur(o.section,o.config,o.featureSearch,o.extensionSearch),X=Math.max(1,l-9);le(()=>{o.section!=="features"&&o.section!=="extensions"||fe(h=>o.fieldIndex>=h+X?o.fieldIndex-X+1:o.fieldIndex<h?o.fieldIndex:h)},[o.fieldIndex,o.section,X]),le(()=>{fe(0)},[o.section,o.featureSearch,o.extensionSearch]);const Re=lt(()=>{const h=e.cleanConfig(),m=lr(h);if(!m.valid){const b=m.errors[0];k(b?`Error: ${b.message}`:"Validation failed"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Q.current&&k(null)},3e3);return}n(h),e.markClean();const u=m.warnings.length;k(u>0?`Saved! (${String(u)} warning${u>1?"s":""})`:"Saved!"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Q.current&&k(null)},2e3)},[n,e]);H((h,m)=>{if(m.downArrow||h==="j")e.setTemplateIndex(o.templateIndex+1);else if(m.upArrow||h==="k")e.setTemplateIndex(o.templateIndex-1);else if(m.return){const u=z[o.templateIndex];u&&e.applyTemplate(u.id)}else m.escape&&e.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),H((h,m)=>{if(m.escape){oe(!1),G("");return}if(m.return){const u=Number.parseInt(pe,10);!Number.isNaN(u)&&u>0&&u<=65535&&e.addPort(u),oe(!1),G("");return}if(m.backspace){G(u=>u.slice(0,-1));return}h&&/^\d$/u.test(h)&&G(u=>u+h)},{isActive:re}),H((h,m)=>{if(m.escape){_(null),j(""),O(""),L("key");return}if(m.return){if(U==="key"&&$){L("value");return}if(U==="value"&&$){e.addEnvVar(R,$,ve),_(null),j(""),O(""),L("key");return}}if(m.backspace){U==="key"?j(u=>u.slice(0,-1)):O(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(U==="key"?j(u=>u+h):O(u=>u+h))},{isActive:R!==null}),H((h,m)=>{if(m.escape){K(!1),M(""),B(""),N("source");return}if(m.return){if(I==="source"&&ie){N("target");return}if(I==="target"&&ce){N("type");return}if(I==="type"){e.addMount({source:ie,target:ce,type:ye}),K(!1),M(""),B(""),N("source");return}}if(I==="type"){switch(h){case"1":{W("volume");break}case"2":{W("bind");break}case"3":{W("tmpfs");break}}return}if(m.backspace){I==="source"?M(u=>u.slice(0,-1)):I==="target"&&B(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(I==="source"?M(u=>u+h):I==="target"&&B(u=>u+h))},{isActive:ne}),H((h,m)=>{if(h==="c"&&m.ctrl){s();return}if(!f){if(d){m.escape||h==="?"?g(!1):m.downArrow||h==="j"?se.current?.scrollBy(1):m.upArrow||h==="k"?se.current?.scrollBy(-1):h==="q"&&(g(!1),p(!0));return}if(x){if(m.escape){v(!1),o.section==="features"?e.setFeatureSearch(""):e.setExtensionSearch("");return}if(m.return){v(!1);return}if(m.backspace){o.section==="features"?e.setFeatureSearch(o.featureSearch.slice(0,-1)):e.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(h&&!m.ctrl&&!m.meta){o.section==="features"?e.setFeatureSearch(o.featureSearch+h):e.setExtensionSearch(o.extensionSearch+h);return}return}if(o.fieldEditing){if(m.escape){e.setFieldEditing(!1);return}if(m.return){e.setFieldEditing(!1);return}return}if(h==="?"){g(!0);return}if(h==="q"){o.isDirty?p(!0):s();return}if(h==="s"){Re();return}if(m.tab){P(u=>u==="editor"?"preview":"editor");return}if(S==="preview"){if(m.downArrow||h==="j"){F.current?.scrollBy(1);return}if(m.upArrow||h==="k"){F.current?.scrollBy(-1);return}if(m.pageDown){F.current?.scrollBy(10);return}if(m.pageUp){F.current?.scrollBy(-10);return}if(m.home){F.current?.scrollToTop();return}if(m.end){F.current?.scrollToBottom();return}m.escape&&P("editor");return}if(m.downArrow||h==="j"){be>0&&e.setFieldIndex(Math.min(o.fieldIndex+1,be-1));return}if(m.upArrow||h==="k"){e.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(m.return){switch(o.section){case"compose":case"general":case"lifecycle":{e.setFieldEditing(!0);break}case"environment":{const u=Object.keys(o.config.containerEnv??{}).length,b=u,T=u+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===b?(_("container"),j(""),O(""),L("key")):o.fieldIndex===T&&(_("remote"),j(""),O(""),L("key"));break}case"mounts":{const u=o.config.mounts??[];o.fieldIndex===u.length&&(K(!0),M(""),B(""),W("volume"),N("source"));break}case"ports":{const u=o.config.forwardPorts??[];o.fieldIndex===u.length&&(oe(!0),G(""));break}}return}if(h===" "){switch(o.section){case"extensions":{const u=ge(o.extensionSearch)[o.fieldIndex];u&&e.toggleExtension(u.id);break}case"features":{const u=me(o.featureSearch)[o.fieldIndex];u&&e.toggleFeature(u.id);break}case"general":{const u=Be-ae.length,b=o.fieldIndex-u;if(b>=0&&b<ae.length){const T=ae[b];e.updateConfig({[T]:!o.config[T]})}break}}return}if(h==="/"){(o.section==="features"||o.section==="extensions")&&v(!0);return}if(h==="A"&&o.section==="mounts"){e.applySuggestedMounts();return}if(h==="a"){if(o.section==="environment"){const u=Object.keys(o.config.containerEnv??{}).length,b=o.fieldIndex<=u?"container":"remote";_(b),j(""),O(""),L("key")}else o.section==="mounts"&&(K(!0),M(""),B(""),W("volume"),N("source"));return}if(h==="d")switch(o.section){case"environment":{const u=Object.keys(o.config.containerEnv??{}),b=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<u.length)e.removeEnvVar("container",u[o.fieldIndex]),u.length===1||o.fieldIndex>=u.length-1&&e.setFieldIndex(u.length-2);else{const T=o.fieldIndex-u.length-1;T>=0&&T<b.length&&(e.removeEnvVar("remote",b[T]),b.length===1||T>=b.length-1&&e.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const u=o.config.mounts??[];if(o.fieldIndex<u.length){e.removeMount(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}case"ports":{const u=o.config.forwardPorts??[];if(o.fieldIndex<u.length){e.removePort(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}}}},{isActive:!o.showTemplateSelector&&!re&&R===null&&!ne});const _e=q(()=>e.getJsonPreview(),[o.config]);if(a<Te||l<De)return t(c,{alignItems:"center",height:l,justifyContent:"center",width:a,children:i(r,{color:"yellow",children:["Terminal too small (",a,"x",l,"), need"," ",Te,"x",De]})});if(o.showTemplateSelector)return t(c,{alignItems:"center",flexDirection:"column",height:l,justifyContent:"center",width:a,children:i(c,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[t(c,{justifyContent:"center",marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Select a Template"})}),z.map((h,m)=>{const u=m===o.templateIndex;return t(c,{children:i(r,{color:u?"cyan":void 0,inverse:u,children:[u?" ❯ ":" ",t(r,{bold:u,children:h.name}),i(r,{dimColor:!0,children:[" ","-",h.description]})]})},h.id)}),t(c,{justifyContent:"center",marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Enter"})," ","select"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let E;switch(o.section){case"compose":{E=t(Pt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"environment":{E=i(c,{flexDirection:"column",children:[t(Ft,{config:o.config,fieldIndex:o.fieldIndex}),R!==null&&t(c,{marginTop:1,paddingX:1,children:i(r,{color:"cyan",children:["Add"," ",R," ","env:"," ",U==="key"?i(r,{children:["key=",t(r,{color:"yellow",children:$||"_"})," ","(Enter to set value)"]}):i(r,{children:[$,"=",t(r,{color:"yellow",children:ve||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{E=t(Bt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.extensionSearch,viewportHeight:X});break}case"features":{E=t(Gt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.featureSearch,viewportHeight:X});break}case"general":{E=t(Xt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"lifecycle":{E=t(Yt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:y((h,m)=>{e.setLifecycleCommand(h,m)},"onSetCommand")});break}case"mounts":{E=t(Zt,{addingMount:ne,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:I,mountSource:ie,mountTarget:ce,mountType:ye,suggestedMounts:o.suggestedMounts});break}case"ports":{E=t(rr,{addingPort:re,addPortValue:pe,config:o.config,fieldIndex:o.fieldIndex});break}default:E=t(r,{children:"Unknown section"})}const $e=i(c,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[i(c,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"q"}),t(r,{dimColor:!0,children:"QUIT"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"?"}),t(r,{dimColor:!0,children:"HELP"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"↑↓"}),t(r,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"Space"}),t(r,{dimColor:!0,children:"CHECK"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"←→"}),t(r,{dimColor:!0,children:"TABS"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"Tab"}),t(r,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"/"}),t(r,{dimColor:!0,children:"FILTER"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"s"}),t(r,{dimColor:!0,children:"SAVE"})]})]}),i(c,{paddingX:1,children:[w&&i(r,{color:w.startsWith("Error")?"red":"green",children:[w," "]}),o.isDirty&&t(r,{color:"yellow",children:"[modified]"}),!o.isDirty&&!w&&t(r,{dimColor:!0,children:"[saved]"})]})]}),Ue=i(Ze,{footer:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",t(r,{bold:!0,color:"white",children:"?"}),"/",t(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:se,title:"KEYBOARD SHORTCUTS",visible:d,width:56,children:[i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"←→"}),t(r,{dimColor:!0,children:" Switch tabs"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"↑↓"}),"/",t(r,{bold:!0,color:"white",children:"j/k"}),t(r,{dimColor:!0,children:" Navigate within section"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Tab"}),t(r,{dimColor:!0,children:" Switch editor/preview panel"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Enter"}),t(r,{dimColor:!0,children:" Edit selected field"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Esc"}),t(r,{dimColor:!0,children:" Stop editing / cancel"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Space"}),t(r,{dimColor:!0,children:" Toggle selection"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"/"}),t(r,{dimColor:!0,children:" Search / filter"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"a"}),t(r,{dimColor:!0,children:" Add new entry"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"d"}),t(r,{dimColor:!0,children:" Delete selected entry"})]})]}),i(c,{flexDirection:"column",children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"ACTIONS"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"s"}),t(r,{dimColor:!0,children:" Save configuration"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"q"}),t(r,{dimColor:!0,children:" Quit"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"?"}),t(r,{dimColor:!0,children:" Toggle help"})]})]})]}),We=t(ir,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:_e,mode:o.mode,scrollRef:F}),we=a>=dr,Xe=we?Math.floor(a*.38):0;return i(c,{flexDirection:"column",height:l,width:a,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[t(r,{bold:!0,inverse:!0,children:" VIS "}),i(r,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),t(c,{flexShrink:0,paddingX:1,paddingY:1,children:t(et,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:y(h=>{e.setSection(h),P("editor")},"onChange"),showIndex:!1,children:Pe.map(({id:h,label:m})=>t(tt,{name:h,children:m},h))})}),t(c,{flexShrink:0,paddingRight:2,children:t(r,{dimColor:!0,wrap:"truncate",children:Pe.find(h=>h.id===o.section)?.description??""})}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:E}),we&&t(c,{flexShrink:0,width:Xe,children:We})]}),$e,t(ot,{autoExitSeconds:3,onCancel:y(()=>{p(!1)},"onCancel"),visible:f}),Ue]})},"VisDevcontainerApp");var mr=Object.defineProperty,je=y((n,e)=>mr(n,"name",{value:e,configurable:!0}),"c");const kr=je(async({logger:n,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const a=s,l=e.template,o=e.output,d=!!process.stdout.isTTY&&!it;let g=null;try{g=nt(a).name}catch{}const f=pt(a);let p=f?.config??null;const x=f?.hadComments??!1;if(l&&!f){const S=z.find(P=>P.id===l);if(!S){const P=z.map(Y=>Y.id).join(", ");throw new Error(`Unknown template "${l}". Valid templates: ${P}`)}p=S.config}if(!d){p?n.info(JSON.stringify(p,null,2)):(n.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const v=setInterval(()=>{},1e3),w=new kt(p,x,g);l&&!f&&w.dismissTemplateSelector();let k=null;if(await rt(ct.createElement(hr,{onSave:je(S=>{vt(a,S,o),k=S},"onSave"),store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(v),k){const S=o??".devcontainer/devcontainer.json";n.info(`DevContainer config saved to ${S}`)}},"execute");export{kr as default};
@@ -1,3 +1,27 @@
1
- var Ve=Object.defineProperty;var y=(n,e)=>Ve(n,"name",{value:e,configurable:!0});import{createRequire as He}from"node:module";import{Box as c,Text as r,TextInput as he,ScrollBar as Oe,ScrollView as Ye,useApp as Ke,useWindowSize as Qe,useInput as H,Dialog as Ze,Tabs as et,Tab as tt,render as rt}from"@visulima/tui";import{an as ot,A as nt,s as it}from"./bin.js";import ct,{useMemo as q,useSyncExternalStore as st,useState as C,useRef as Z,useEffect as le,useCallback as lt}from"react";import{isAccessibleSync as dt,readFileSync as ut,ensureDirSync as ht}from"@visulima/fs";import{stripJsonComments as mt}from"@visulima/fs/utils";import{join as de,dirname as gt}from"@visulima/path";import{jsxs as i,jsx as t}from"react/jsx-runtime";const Je=He(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=y(n=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[e,s]=V.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return V.getBuiltinModule(n)}return Je(n)},"__cjs_getBuiltinModule"),{writeFileSync:at}=qe("node:fs"),z=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var ft=Object.defineProperty,Fe=y((n,e)=>ft(n,"name",{value:e,configurable:!0}),"s$5");const pt=Fe(n=>{const e=de(n,".devcontainer","devcontainer.json");if(!dt(e))return null;const s=ut(e),a=mt(s),l=a!==s;let o;try{o=JSON.parse(a)}catch(d){const g=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse ${e}: ${g}`,{cause:d})}return{config:o,hadComments:l}},"readDevcontainerJson"),vt=Fe((n,e,s)=>{const a=s?gt(s):de(n,".devcontainer"),l=s??de(a,"devcontainer.json");ht(a),at(l,`${JSON.stringify(e,null,2)}
2
- `,"utf8")},"writeDevcontainerJson");var yt=Object.defineProperty,bt=y((n,e)=>yt(n,"name",{value:e,configurable:!0}),"s$4");const wt={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},xt=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],xe=bt((n,e,s)=>{const a=[],l=new Set(s.map(d=>typeof d=="string"?d:d.target));if(n)for(const d of wt[n])l.has(d.target)||a.push(d);const o=Object.keys(e);for(const{featureMatch:d,mounts:g}of xt)if(o.some(f=>f.includes(d)))for(const f of g)l.has(f.target)||a.push(f);return a},"getSuggestedMounts"),A=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var Ct=Object.defineProperty,ee=y((n,e)=>Ct(n,"name",{value:e,configurable:!0}),"c$1");const J=ee(n=>structuredClone(n),"deepClone");class kt{static{y(this,"DevcontainerStore")}static{ee(this,"DevcontainerStore")}#o=new Set;#e;constructor(e,s,a=null){const l=e===null,o=e??{name:""},d=J(o);this.#e={config:d,detectedPm:a,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:s,isDirty:!1,mode:l?"create":"edit",originalConfig:l?null:J(o),section:"general",showTemplateSelector:l,suggestedMounts:xe(a,d.features??{},d.mounts??[]),templateIndex:0}}getSnapshot=ee(()=>this.#e,"getSnapshot");subscribe=ee(e=>(this.#o.add(e),()=>{this.#o.delete(e)}),"subscribe");setSection(e){e!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:e})}nextSection(){const e=(A.indexOf(this.#e.section)+1)%A.length;this.setSection(A[e])}previousSection(){const e=(A.indexOf(this.#e.section)-1+A.length)%A.length;this.setSection(A[e])}setFieldIndex(e){e!==this.#e.fieldIndex&&this.#t({...this.#e,fieldIndex:Math.max(0,e)})}setFieldEditing(e){e!==this.#e.fieldEditing&&this.#t({...this.#e,fieldEditing:e})}setTemplateIndex(e){const s=Math.max(0,Math.min(e,z.length-1));s!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:s})}applyTemplate(e){const s=z.find(a=>a.id===e);s&&this.#t(this.#r({...this.#e,config:J(s.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#t({...this.#e,showTemplateSelector:!1})}updateConfig(e){this.#t({...this.#e,config:{...this.#e.config,...e},isDirty:!0})}toggleFeature(e){const s={...this.#e.config.features};s[e]===void 0?s[e]={}:delete s[e],this.#t(this.#r({...this.#e,config:{...this.#e.config,features:s},isDirty:!0}))}setFeatureSearch(e){this.#t({...this.#e,featureSearch:e,fieldIndex:0})}addPort(e){const s=this.#e.config.forwardPorts??[];if(s.includes(e))return;const a=[...s,e];this.#t({...this.#e,config:{...this.#e.config,forwardPorts:a},isDirty:!0})}removePort(e){const s=[...this.#e.config.forwardPorts??[]];s.splice(e,1),this.#t({...this.#e,config:{...this.#e.config,forwardPorts:s.length>0?s:void 0},isDirty:!0})}toggleExtension(e){const s={...this.#e.config.customizations},a={...s.vscode},l=[...a.extensions??[]],o=l.indexOf(e);o===-1?l.push(e):l.splice(o,1),a.extensions=l.length>0?l:void 0,s.vscode=a.extensions||a.settings?a:void 0,this.#t({...this.#e,config:{...this.#e.config,customizations:s.vscode||s.jetbrains?s:void 0},isDirty:!0})}setExtensionSearch(e){this.#t({...this.#e,extensionSearch:e,fieldIndex:0})}addEnvVar(e,s,a){const l=e==="container"?"containerEnv":"remoteEnv",o={...this.#e.config[l],[s]:a};this.#t({...this.#e,config:{...this.#e.config,[l]:o},isDirty:!0})}removeEnvVar(e,s){const a=e==="container"?"containerEnv":"remoteEnv",l={...this.#e.config[a]};delete l[s],this.#t({...this.#e,config:{...this.#e.config,[a]:Object.keys(l).length>0?l:void 0},isDirty:!0})}addMount(e){const s=[...this.#e.config.mounts??[],e];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:s},isDirty:!0}))}removeMount(e){const s=[...this.#e.config.mounts??[]];s.splice(e,1),this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:s.length>0?s:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const e=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:e},isDirty:!0}))}setLifecycleCommand(e,s){this.#t({...this.#e,config:{...this.#e.config,[e]:s||void 0},isDirty:!0})}markClean(){this.#t({...this.#e,isDirty:!1,originalConfig:J(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const e=J(this.#e.config);for(const[s,a]of Object.entries(e))(a===""||a===void 0)&&delete e[s];return e.build&&(e.build.dockerfile===""&&delete e.build.dockerfile,e.build.context===""&&delete e.build.context,e.build.args&&Object.keys(e.build.args).length===0&&delete e.build.args,Object.keys(e.build).length===0&&delete e.build),e.forwardPorts?.length===0&&delete e.forwardPorts,e.mounts?.length===0&&delete e.mounts,e.runServices?.length===0&&delete e.runServices,e.capAdd?.length===0&&delete e.capAdd,e.securityOpt?.length===0&&delete e.securityOpt,e.features&&Object.keys(e.features).length===0&&delete e.features,e.customizations?.vscode?.extensions?.length===0&&delete e.customizations.vscode.extensions,e.customizations?.vscode&&Object.keys(e.customizations.vscode).length===0&&delete e.customizations.vscode,e.customizations&&Object.keys(e.customizations).length===0&&delete e.customizations,e.containerEnv&&Object.keys(e.containerEnv).length===0&&delete e.containerEnv,e.remoteEnv&&Object.keys(e.remoteEnv).length===0&&delete e.remoteEnv,e}#r(e){return{...e,suggestedMounts:xe(e.detectedPm,e.config.features??{},e.config.mounts??[])}}#t(e){this.#e=e;for(const s of this.#o)try{s()}catch{}}}const Ce=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ke=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var St=Object.defineProperty,Ae=y((n,e)=>St(n,"name",{value:e,configurable:!0}),"r$1");const me=Ae(n=>{if(!n)return ke;const e=n.toLowerCase();return ke.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterFeatures"),ge=Ae(n=>{if(!n)return Ce;const e=n.toLowerCase();return Ce.filter(s=>s.name.toLowerCase().includes(e)||s.id.toLowerCase().includes(e)||s.description.toLowerCase().includes(e))},"filterExtensions");var Et=Object.defineProperty,It=y((n,e)=>Et(n,"name",{value:e,configurable:!0}),"l$1");const Le=["dockerComposeFile","service"],Tt={dockerComposeFile:"Compose File",service:"Service"},Se={dockerComposeFile:"docker-compose.yml",service:"app"},Dt={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Pt=It(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:a})=>{const l=!!n.dockerComposeFile,o=!!(n.image||n.build);return i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),o&&l&&t(c,{marginBottom:1,children:t(r,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),Le.map((d,g)=>{const f=g===s,p=n[d]??"",x=Array.isArray(n[d])?n[d].join(", "):p;return i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{children:[t(c,{width:20,children:i(r,{bold:f,color:f?"cyan":"white",children:[f?"❯ ":" ",Tt[d],":"]})}),t(c,{flexGrow:1,children:f&&e?t(he,{defaultValue:x,onChange:y(v=>{a({[d]:v||void 0})},"onChange"),placeholder:Se[d]}):t(r,{color:x?"white":"gray",children:x||Se[d]})})]}),t(c,{paddingLeft:4,children:t(r,{dimColor:!0,children:Dt[d]})})]},d)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),jt=Le.length;var Ot=Object.defineProperty,Me=y((n,e)=>Ot(n,"name",{value:e,configurable:!0}),"h$3");const Ft=Me(({config:n,fieldIndex:e})=>{const s=n.containerEnv??{},a=n.remoteEnv??{},l=Object.keys(s),o=Object.keys(a),d=l.length,g=l.length+1,f=g+o.length,p=e<=d,x=e>d;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{borderColor:p?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:l.length>0?1:0,children:[t(r,{bold:!0,color:p?"cyan":"white",children:"containerEnv"}),t(r,{dimColor:!0,children:" — baked into the container image"})]}),l.map((v,w)=>{const k=w===e;return t(c,{flexShrink:0,children:i(r,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",t(r,{bold:!0,children:v}),t(r,{dimColor:!0,children:" = "}),t(r,{children:s[v]})]})},v)}),t(c,{flexShrink:0,marginTop:l.length>0?1:0,children:i(r,{color:e===d?"cyan":"gray",inverse:e===d,children:[" ","+ Add variable..."]})})]}),i(c,{borderColor:x?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[i(c,{flexShrink:0,marginBottom:o.length>0?1:0,children:[t(r,{bold:!0,color:x?"cyan":"white",children:"remoteEnv"}),t(r,{dimColor:!0,children:" — set at runtime by the IDE"})]}),o.map((v,w)=>{const k=g+w===e;return t(c,{flexShrink:0,children:i(r,{color:k?"cyan":void 0,inverse:k,wrap:"truncate",children:[k?" ❯ ":" ",t(r,{bold:!0,children:v}),t(r,{dimColor:!0,children:" = "}),t(r,{children:a[v]})]})},v)}),t(c,{flexShrink:0,marginTop:o.length>0?1:0,children:i(r,{color:e===f?"cyan":"gray",inverse:e===f,children:[" ","+ Add variable..."]})})]}),t(c,{flexShrink:0,marginTop:1,children:i(r,{dimColor:!0,wrap:"truncate",children:[t(r,{bold:!0,color:"white",children:"a"}),"/",t(r,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",t(r,{bold:!0,color:"white",children:"d"})," ","remove"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),At=Me(n=>{const e=Object.keys(n.containerEnv??{}).length,s=Object.keys(n.remoteEnv??{}).length;return e+1+s+1},"getEnvFieldCount");var Lt=Object.defineProperty,Mt=y((n,e)=>Lt(n,"name",{value:e,configurable:!0}),"h$2");const Bt=Mt(({config:n,fieldIndex:e,scrollOffset:s,searchText:a,viewportHeight:l})=>{const o=q(()=>new Set(n.customizations?.vscode?.extensions),[n.customizations?.vscode?.extensions]),d=q(()=>ge(a),[a]),g=d.length,f=g>l&&l>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),a&&i(r,{dimColor:!0,children:["— filter:"," ",t(r,{color:"yellow",children:a})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[t(r,{children:v?">":" "}),i(r,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),t(c,{flexGrow:1,children:i(r,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(r,{dimColor:!0,children:[" ","-",p.id]})]})})]},p.id)})})}),f&&t(c,{flexShrink:0,marginLeft:1,marginRight:1,children:t(Oe,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:l})})]}),d.length===0&&t(c,{paddingX:1,children:t(r,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var Nt=Object.defineProperty,zt=y((n,e)=>Nt(n,"name",{value:e,configurable:!0}),"p$1");const Gt=zt(({config:n,fieldIndex:e,scrollOffset:s,searchText:a,viewportHeight:l})=>{const o=q(()=>new Set(Object.keys(n.features??{})),[n.features]),d=q(()=>me(a),[a]),g=d.length,f=g>l&&l>0;return i(c,{flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[o.size," ","selected"]}),a&&i(r,{dimColor:!0,children:["— filter:"," ",t(r,{color:"yellow",children:a})," ","(",d.length," ","results)"]})]}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t(c,{flexDirection:"column",marginTop:-s,children:d.map((p,x)=>{const v=x===e,w=o.has(p.id);return i(c,{flexShrink:0,height:1,children:[t(r,{children:v?">":" "}),i(r,{color:w?"white":"gray",children:[" ",w?"☑":"☐"," "]}),t(c,{flexGrow:1,children:i(r,{bold:v,inverse:v,wrap:"truncate",children:[p.name,i(r,{dimColor:!0,children:[" ","-",p.description]})]})})]},p.id)})})}),f&&t(c,{flexShrink:0,marginLeft:1,marginRight:1,children:t(Oe,{contentHeight:g,placement:"inset",scrollOffset:s,style:"block",viewportHeight:l})})]}),d.length===0&&t(c,{paddingX:1,children:t(r,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var Rt=Object.defineProperty,_t=y((n,e)=>Rt(n,"name",{value:e,configurable:!0}),"u$1");const ue=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],$t={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ee={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},te=["privileged","overrideCommand"],Ut={overrideCommand:"Override Command",privileged:"Privileged"},Wt=ue.length+te.length,Xt=_t(({config:n,fieldEditing:e,fieldIndex:s,onUpdate:a})=>i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"General Configuration"})}),ue.map((l,o)=>{const d=o===s,g=n[l]??"";return i(c,{marginBottom:1,children:[t(c,{width:20,children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",$t[l],":"]})}),t(c,{flexGrow:1,children:d&&e?t(he,{defaultValue:g,onChange:y(f=>{a({[l]:f})},"onChange"),placeholder:Ee[l]}):t(r,{color:g?"white":"gray",children:g||Ee[l]})})]},l)}),te.map((l,o)=>{const d=ue.length+o===s,g=n[l]??!1;return i(c,{marginBottom:o<te.length-1?1:0,children:[t(c,{width:20,children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Ut[l],":"]})}),t(c,{flexGrow:1,children:i(r,{color:g?"green":"gray",children:[g?"yes":"no",d&&t(r,{dimColor:!0,children:" (Space to toggle)"})]})})]},l)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",t(r,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Be=Wt,ae=te;var Vt=Object.defineProperty,Ht=y((n,e)=>Vt(n,"name",{value:e,configurable:!0}),"s$2");const Ne=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],Jt={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},qt={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},Yt=Ht(({config:n,fieldEditing:e,fieldIndex:s,onSetCommand:a})=>i(c,{flexDirection:"column",paddingX:1,children:[t(c,{marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Ne.map((l,o)=>{const d=o===s,g=n[l],f=Array.isArray(g)?g.join(" && "):g??"";return i(c,{flexDirection:"column",marginBottom:1,children:[t(c,{children:i(r,{bold:d,color:d?"cyan":"white",children:[d?"❯ ":" ",Jt[l]]})}),t(c,{paddingLeft:4,children:t(r,{dimColor:!0,children:qt[l]})}),t(c,{paddingLeft:4,children:d&&e?t(he,{defaultValue:f,onChange:y(p=>{a(l,p)},"onChange"),placeholder:"e.g. npm install"}):t(r,{color:f?"green":"gray",children:f||"(not set)"})})]},l)}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),Kt=Ne.length;var Qt=Object.defineProperty,ze=y((n,e)=>Qt(n,"name",{value:e,configurable:!0}),"s$1");const Ie=ze(n=>typeof n=="string"?n:`[${n.type}] ${n.source} → ${n.target}`,"formatMount"),Zt=ze(({addingMount:n,config:e,detectedPm:s,fieldIndex:a,mountPhase:l,mountSource:o,mountTarget:d,mountType:g,suggestedMounts:f})=>{const p=e.mounts??[];return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[i(r,{bold:!0,color:"cyan",children:[p.length," ","mounts"]}),s&&i(r,{dimColor:!0,children:["— detected:"," ",t(r,{color:"white",children:s})]})]}),f.length>0&&!n&&i(c,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[i(c,{flexShrink:0,children:[t(r,{bold:!0,color:"yellow",children:"Suggested mounts"}),i(r,{dimColor:!0,children:[" ","— press"," ",t(r,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),f.map((x,v)=>t(c,{flexShrink:0,children:i(r,{dimColor:!0,wrap:"truncate",children:[" + ",Ie(x)]})},`suggestion-${String(v)}`))]}),p.length>0&&t(c,{flexDirection:"column",marginBottom:1,children:p.map((x,v)=>{const w=v===a;return i(c,{flexShrink:0,height:1,children:[t(r,{children:w?">":" "}),t(c,{flexGrow:1,children:i(r,{bold:w,inverse:w,wrap:"truncate",children:[" ",Ie(x)]})})]},`mount-${String(v)}`)})}),!n&&t(c,{flexShrink:0,children:i(r,{color:a===p.length?"cyan":"gray",inverse:a===p.length,children:[" ","+ Add mount..."]})}),n&&i(c,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[t(c,{flexShrink:0,marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"New Mount"})}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="source",color:l==="source"?"cyan":"white",children:[l==="source"?"❯ ":" ","Source:"]})}),t(r,{color:o?"yellow":"gray",children:o||(l==="source"?"_":"(type source, Enter to continue)")})]}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="target",color:l==="target"?"cyan":"white",children:[l==="target"?"❯ ":" ","Target:"]})}),t(r,{color:d?"yellow":"gray",children:d||(l==="target"?"_":"/container/path")})]}),i(c,{flexShrink:0,children:[t(c,{width:12,children:i(r,{bold:l==="type",color:l==="type"?"cyan":"white",children:[l==="type"?"❯ ":" ","Type:"]})}),l==="type"?i(r,{children:[t(r,{bold:g==="volume",color:g==="volume"?"cyan":"gray",children:"[1] volume"})," ",t(r,{bold:g==="bind",color:g==="bind"?"cyan":"gray",children:"[2] bind"})," ",t(r,{bold:g==="tmpfs",color:g==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):t(r,{color:"gray",children:g})]}),t(c,{flexShrink:0,marginTop:1,children:t(r,{dimColor:!0,wrap:"truncate",children:l==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),p.length===0&&!n&&f.length===0&&t(c,{marginTop:1,children:t(r,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var er=Object.defineProperty,tr=y((n,e)=>er(n,"name",{value:e,configurable:!0}),"m$1");const rr=tr(({addingPort:n,addPortValue:e,config:s,fieldIndex:a})=>{const l=s.forwardPorts??[],o=a===l.length;return i(c,{flexDirection:"column",paddingX:1,children:[i(c,{marginBottom:1,children:[t(r,{bold:!0,color:"cyan",children:"Forwarded Ports"}),i(r,{dimColor:!0,children:[" ","(",l.length," ","ports)"]})]}),l.map((d,g)=>{const f=g===a;return t(c,{children:i(r,{color:f?"cyan":void 0,inverse:f,children:[" ",String(d)]})},`port-${String(d)}`)}),t(c,{marginTop:l.length>0?1:0,children:i(r,{color:o?"cyan":"gray",inverse:o,children:[" ",o&&n?i(r,{children:["Enter port:"," ",t(r,{color:"yellow",children:e||"_"})]}):"+ Add port..."]})}),t(c,{marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"Enter"})," ",o?"type port number, Enter to confirm":"select"," ",t(r,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var or=Object.defineProperty,nr=y((n,e)=>or(n,"name",{value:e,configurable:!0}),"a");const ir=nr(({focused:n,hadComments:e,jsonPreview:s,mode:a,scrollRef:l})=>i(c,{borderColor:n?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[i(c,{flexShrink:0,paddingX:1,children:[t(r,{bold:!0,color:n?"cyan":"white",children:"Preview"}),i(r,{dimColor:!0,children:[" ","(",a==="create"?"new":"edit",")"]})]}),e&&a==="edit"&&t(c,{flexShrink:0,paddingX:1,children:t(r,{color:"yellow",children:"Comments will not be preserved."})}),t(Ye,{flexGrow:1,ref:l,scrollbar:!0,scrollbarColor:"gray",children:s.split(`
3
- `).map((o,d)=>t(r,{color:"green",children:o},`line-${String(d)}`))})]}),"PreviewPanel");var cr=Object.defineProperty,sr=y((n,e)=>cr(n,"name",{value:e,configurable:!0}),"r");const lr=sr(n=>{const e=[],s=[],a=[];if(!n.image&&!n.build&&!n.dockerComposeFile&&e.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),n.build&&(n.image&&s.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),n.build.dockerfile||e.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),n.dockerComposeFile&&!n.service&&e.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),n.features!==void 0&&(typeof n.features!="object"||Array.isArray(n.features))&&e.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),n.forwardPorts)if(Array.isArray(n.forwardPorts))for(const[l,o]of n.forwardPorts.entries())typeof o=="number"&&(o<1||o>65535)&&e.push({field:"forwardPorts",message:`Invalid port ${String(o)} at index ${String(l)}`});else e.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return n.customizations?.vscode?.extensions&&!Array.isArray(n.customizations.vscode.extensions)&&e.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),n.customizations?.vscode?.settings&&typeof n.customizations.vscode.settings!="object"&&e.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),n.name||a.push({field:"name",message:"Consider adding a name for better identification"}),(!n.features||Object.keys(n.features).length===0)&&a.push({field:"features",message:"Consider adding features for common tools"}),(!n.customizations?.vscode?.extensions||n.customizations.vscode.extensions.length===0)&&a.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),n.privileged&&s.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:e,suggestions:a,valid:e.length===0,warnings:s}},"validateConfig");var ar=Object.defineProperty,Ge=y((n,e)=>ar(n,"name",{value:e,configurable:!0}),"$");const Te=80,De=15,dr=120,Pe=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],ur=Ge((n,e,s,a)=>{switch(n){case"compose":return jt;case"environment":return At(e);case"extensions":return ge(a).length;case"features":return me(s).length;case"general":return Be;case"lifecycle":return Kt;case"mounts":return(e.mounts?.length??0)+1;case"ports":return(e.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),hr=Ge(({onSave:n,store:e})=>{const{exit:s}=Ke(),{columns:a,rows:l}=Qe(),o=st(e.subscribe,e.getSnapshot),[d,g]=C(!1),[f,p]=C(!1),[x,v]=C(!1),[w,k]=C(null),[S,P]=C("editor"),[Y,fe]=C(0),[re,oe]=C(!1),[pe,G]=C(""),[R,_]=C(null),[$,j]=C(""),[ve,O]=C(""),[U,L]=C("key"),[ne,K]=C(!1),[ie,M]=C(""),[ce,B]=C(""),[ye,W]=C("volume"),[I,N]=C("source"),se=Z(null),F=Z(null),D=Z(null),Q=Z(!0);le(()=>(Q.current=!0,()=>{Q.current=!1,D.current&&clearTimeout(D.current)}),[]);const be=ur(o.section,o.config,o.featureSearch,o.extensionSearch),X=Math.max(1,l-9);le(()=>{o.section!=="features"&&o.section!=="extensions"||fe(h=>o.fieldIndex>=h+X?o.fieldIndex-X+1:o.fieldIndex<h?o.fieldIndex:h)},[o.fieldIndex,o.section,X]),le(()=>{fe(0)},[o.section,o.featureSearch,o.extensionSearch]);const Re=lt(()=>{const h=e.cleanConfig(),m=lr(h);if(!m.valid){const b=m.errors[0];k(b?`Error: ${b.message}`:"Validation failed"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Q.current&&k(null)},3e3);return}n(h),e.markClean();const u=m.warnings.length;k(u>0?`Saved! (${String(u)} warning${u>1?"s":""})`:"Saved!"),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{Q.current&&k(null)},2e3)},[n,e]);H((h,m)=>{if(m.downArrow||h==="j")e.setTemplateIndex(o.templateIndex+1);else if(m.upArrow||h==="k")e.setTemplateIndex(o.templateIndex-1);else if(m.return){const u=z[o.templateIndex];u&&e.applyTemplate(u.id)}else m.escape&&e.dismissTemplateSelector()},{isActive:o.showTemplateSelector}),H((h,m)=>{if(m.escape){oe(!1),G("");return}if(m.return){const u=Number.parseInt(pe,10);!Number.isNaN(u)&&u>0&&u<=65535&&e.addPort(u),oe(!1),G("");return}if(m.backspace){G(u=>u.slice(0,-1));return}h&&/^\d$/u.test(h)&&G(u=>u+h)},{isActive:re}),H((h,m)=>{if(m.escape){_(null),j(""),O(""),L("key");return}if(m.return){if(U==="key"&&$){L("value");return}if(U==="value"&&$){e.addEnvVar(R,$,ve),_(null),j(""),O(""),L("key");return}}if(m.backspace){U==="key"?j(u=>u.slice(0,-1)):O(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(U==="key"?j(u=>u+h):O(u=>u+h))},{isActive:R!==null}),H((h,m)=>{if(m.escape){K(!1),M(""),B(""),N("source");return}if(m.return){if(I==="source"&&ie){N("target");return}if(I==="target"&&ce){N("type");return}if(I==="type"){e.addMount({source:ie,target:ce,type:ye}),K(!1),M(""),B(""),N("source");return}}if(I==="type"){switch(h){case"1":{W("volume");break}case"2":{W("bind");break}case"3":{W("tmpfs");break}}return}if(m.backspace){I==="source"?M(u=>u.slice(0,-1)):I==="target"&&B(u=>u.slice(0,-1));return}h&&!m.ctrl&&!m.meta&&(I==="source"?M(u=>u+h):I==="target"&&B(u=>u+h))},{isActive:ne}),H((h,m)=>{if(h==="c"&&m.ctrl){s();return}if(!f){if(d){m.escape||h==="?"?g(!1):m.downArrow||h==="j"?se.current?.scrollBy(1):m.upArrow||h==="k"?se.current?.scrollBy(-1):h==="q"&&(g(!1),p(!0));return}if(x){if(m.escape){v(!1),o.section==="features"?e.setFeatureSearch(""):e.setExtensionSearch("");return}if(m.return){v(!1);return}if(m.backspace){o.section==="features"?e.setFeatureSearch(o.featureSearch.slice(0,-1)):e.setExtensionSearch(o.extensionSearch.slice(0,-1));return}if(h&&!m.ctrl&&!m.meta){o.section==="features"?e.setFeatureSearch(o.featureSearch+h):e.setExtensionSearch(o.extensionSearch+h);return}return}if(o.fieldEditing){if(m.escape){e.setFieldEditing(!1);return}if(m.return){e.setFieldEditing(!1);return}return}if(h==="?"){g(!0);return}if(h==="q"){o.isDirty?p(!0):s();return}if(h==="s"){Re();return}if(m.tab){P(u=>u==="editor"?"preview":"editor");return}if(S==="preview"){if(m.downArrow||h==="j"){F.current?.scrollBy(1);return}if(m.upArrow||h==="k"){F.current?.scrollBy(-1);return}if(m.pageDown){F.current?.scrollBy(10);return}if(m.pageUp){F.current?.scrollBy(-10);return}if(m.home){F.current?.scrollToTop();return}if(m.end){F.current?.scrollToBottom();return}m.escape&&P("editor");return}if(m.downArrow||h==="j"){be>0&&e.setFieldIndex(Math.min(o.fieldIndex+1,be-1));return}if(m.upArrow||h==="k"){e.setFieldIndex(Math.max(o.fieldIndex-1,0));return}if(m.return){switch(o.section){case"compose":case"general":case"lifecycle":{e.setFieldEditing(!0);break}case"environment":{const u=Object.keys(o.config.containerEnv??{}).length,b=u,T=u+1+Object.keys(o.config.remoteEnv??{}).length;o.fieldIndex===b?(_("container"),j(""),O(""),L("key")):o.fieldIndex===T&&(_("remote"),j(""),O(""),L("key"));break}case"mounts":{const u=o.config.mounts??[];o.fieldIndex===u.length&&(K(!0),M(""),B(""),W("volume"),N("source"));break}case"ports":{const u=o.config.forwardPorts??[];o.fieldIndex===u.length&&(oe(!0),G(""));break}}return}if(h===" "){switch(o.section){case"extensions":{const u=ge(o.extensionSearch)[o.fieldIndex];u&&e.toggleExtension(u.id);break}case"features":{const u=me(o.featureSearch)[o.fieldIndex];u&&e.toggleFeature(u.id);break}case"general":{const u=Be-ae.length,b=o.fieldIndex-u;if(b>=0&&b<ae.length){const T=ae[b];e.updateConfig({[T]:!o.config[T]})}break}}return}if(h==="/"){(o.section==="features"||o.section==="extensions")&&v(!0);return}if(h==="A"&&o.section==="mounts"){e.applySuggestedMounts();return}if(h==="a"){if(o.section==="environment"){const u=Object.keys(o.config.containerEnv??{}).length,b=o.fieldIndex<=u?"container":"remote";_(b),j(""),O(""),L("key")}else o.section==="mounts"&&(K(!0),M(""),B(""),W("volume"),N("source"));return}if(h==="d")switch(o.section){case"environment":{const u=Object.keys(o.config.containerEnv??{}),b=Object.keys(o.config.remoteEnv??{});if(o.fieldIndex<u.length)e.removeEnvVar("container",u[o.fieldIndex]),u.length===1||o.fieldIndex>=u.length-1&&e.setFieldIndex(u.length-2);else{const T=o.fieldIndex-u.length-1;T>=0&&T<b.length&&(e.removeEnvVar("remote",b[T]),b.length===1||T>=b.length-1&&e.setFieldIndex(o.fieldIndex-1))}break}case"mounts":{const u=o.config.mounts??[];if(o.fieldIndex<u.length){e.removeMount(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}case"ports":{const u=o.config.forwardPorts??[];if(o.fieldIndex<u.length){e.removePort(o.fieldIndex);const b=u.length-1;o.fieldIndex>=b&&b>0&&e.setFieldIndex(b-1)}break}}}},{isActive:!o.showTemplateSelector&&!re&&R===null&&!ne});const _e=q(()=>e.getJsonPreview(),[o.config]);if(a<Te||l<De)return t(c,{alignItems:"center",height:l,justifyContent:"center",width:a,children:i(r,{color:"yellow",children:["Terminal too small (",a,"x",l,"), need"," ",Te,"x",De]})});if(o.showTemplateSelector)return t(c,{alignItems:"center",flexDirection:"column",height:l,justifyContent:"center",width:a,children:i(c,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[t(c,{justifyContent:"center",marginBottom:1,children:t(r,{bold:!0,color:"cyan",children:"Select a Template"})}),z.map((h,m)=>{const u=m===o.templateIndex;return t(c,{children:i(r,{color:u?"cyan":void 0,inverse:u,children:[u?" ❯ ":" ",t(r,{bold:u,children:h.name}),i(r,{dimColor:!0,children:[" ","-",h.description]})]})},h.id)}),t(c,{justifyContent:"center",marginTop:1,children:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",t(r,{bold:!0,color:"white",children:"Enter"})," ","select"," ",t(r,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let E;switch(o.section){case"compose":{E=t(Pt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"environment":{E=i(c,{flexDirection:"column",children:[t(Ft,{config:o.config,fieldIndex:o.fieldIndex}),R!==null&&t(c,{marginTop:1,paddingX:1,children:i(r,{color:"cyan",children:["Add"," ",R," ","env:"," ",U==="key"?i(r,{children:["key=",t(r,{color:"yellow",children:$||"_"})," ","(Enter to set value)"]}):i(r,{children:[$,"=",t(r,{color:"yellow",children:ve||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{E=t(Bt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.extensionSearch,viewportHeight:X});break}case"features":{E=t(Gt,{config:o.config,fieldIndex:o.fieldIndex,scrollOffset:Y,searchText:o.featureSearch,viewportHeight:X});break}case"general":{E=t(Xt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onUpdate:y(h=>{e.updateConfig(h)},"onUpdate")});break}case"lifecycle":{E=t(Yt,{config:o.config,fieldEditing:o.fieldEditing,fieldIndex:o.fieldIndex,onSetCommand:y((h,m)=>{e.setLifecycleCommand(h,m)},"onSetCommand")});break}case"mounts":{E=t(Zt,{addingMount:ne,config:o.config,detectedPm:o.detectedPm,fieldIndex:o.fieldIndex,mountPhase:I,mountSource:ie,mountTarget:ce,mountType:ye,suggestedMounts:o.suggestedMounts});break}case"ports":{E=t(rr,{addingPort:re,addPortValue:pe,config:o.config,fieldIndex:o.fieldIndex});break}default:E=t(r,{children:"Unknown section"})}const $e=i(c,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[i(c,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"q"}),t(r,{dimColor:!0,children:"QUIT"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"?"}),t(r,{dimColor:!0,children:"HELP"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"↑↓"}),t(r,{dimColor:!0,children:"NAV"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"Space"}),t(r,{dimColor:!0,children:"CHECK"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"←→"}),t(r,{dimColor:!0,children:"TABS"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"Tab"}),t(r,{dimColor:!0,children:"PANEL"})]}),(o.section==="features"||o.section==="extensions")&&i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"/"}),t(r,{dimColor:!0,children:"FILTER"})]}),i(c,{gap:1,children:[t(r,{bold:!0,color:"white",children:"s"}),t(r,{dimColor:!0,children:"SAVE"})]})]}),i(c,{paddingX:1,children:[w&&i(r,{color:w.startsWith("Error")?"red":"green",children:[w," "]}),o.isDirty&&t(r,{color:"yellow",children:"[modified]"}),!o.isDirty&&!w&&t(r,{dimColor:!0,children:"[saved]"})]})]}),Ue=i(Ze,{footer:i(r,{dimColor:!0,children:[t(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",t(r,{bold:!0,color:"white",children:"?"}),"/",t(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:se,title:"KEYBOARD SHORTCUTS",visible:d,width:56,children:[i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"←→"}),t(r,{dimColor:!0,children:" Switch tabs"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"↑↓"}),"/",t(r,{bold:!0,color:"white",children:"j/k"}),t(r,{dimColor:!0,children:" Navigate within section"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Tab"}),t(r,{dimColor:!0,children:" Switch editor/preview panel"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Enter"}),t(r,{dimColor:!0,children:" Edit selected field"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Esc"}),t(r,{dimColor:!0,children:" Stop editing / cancel"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"Space"}),t(r,{dimColor:!0,children:" Toggle selection"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"/"}),t(r,{dimColor:!0,children:" Search / filter"})]})]}),i(c,{flexDirection:"column",marginBottom:1,children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"a"}),t(r,{dimColor:!0,children:" Add new entry"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"d"}),t(r,{dimColor:!0,children:" Delete selected entry"})]})]}),i(c,{flexDirection:"column",children:[i(c,{marginBottom:1,children:[t(r,{dimColor:!0,children:"── "}),t(r,{bold:!0,color:"white",children:"ACTIONS"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"s"}),t(r,{dimColor:!0,children:" Save configuration"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"q"}),t(r,{dimColor:!0,children:" Quit"})]}),i(r,{children:[" ",t(r,{bold:!0,color:"white",children:"?"}),t(r,{dimColor:!0,children:" Toggle help"})]})]})]}),We=t(ir,{focused:S==="preview",hadComments:o.hadComments,jsonPreview:_e,mode:o.mode,scrollRef:F}),we=a>=dr,Xe=we?Math.floor(a*.38):0;return i(c,{flexDirection:"column",height:l,width:a,children:[i(c,{flexShrink:0,gap:1,paddingX:1,children:[t(r,{bold:!0,inverse:!0,children:" VIS "}),i(r,{wrap:"truncate",children:[o.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),t(c,{flexShrink:0,paddingX:1,paddingY:1,children:t(et,{defaultValue:o.section,keyMap:{useNumbers:!1,useTab:!1},onChange:y(h=>{e.setSection(h),P("editor")},"onChange"),showIndex:!1,children:Pe.map(({id:h,label:m})=>t(tt,{name:h,children:m},h))})}),t(c,{flexShrink:0,paddingRight:2,children:t(r,{dimColor:!0,wrap:"truncate",children:Pe.find(h=>h.id===o.section)?.description??""})}),i(c,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t(c,{borderColor:S==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:E}),we&&t(c,{flexShrink:0,width:Xe,children:We})]}),$e,t(ot,{autoExitSeconds:3,onCancel:y(()=>{p(!1)},"onCancel"),visible:f}),Ue]})},"VisDevcontainerApp");var mr=Object.defineProperty,je=y((n,e)=>mr(n,"name",{value:e,configurable:!0}),"c");const kr=je(async({logger:n,options:e,workspaceRoot:s})=>{if(!s)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const a=s,l=e.template,o=e.output,d=!!process.stdout.isTTY&&!it;let g=null;try{g=nt(a).name}catch{}const f=pt(a);let p=f?.config??null;const x=f?.hadComments??!1;if(l&&!f){const S=z.find(P=>P.id===l);if(!S){const P=z.map(Y=>Y.id).join(", ");throw new Error(`Unknown template "${l}". Valid templates: ${P}`)}p=S.config}if(!d){p?n.info(JSON.stringify(p,null,2)):(n.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const v=setInterval(()=>{},1e3),w=new kt(p,x,g);l&&!f&&w.dismissTemplateSelector();let k=null;if(await rt(ct.createElement(hr,{onSave:je(S=>{vt(a,S,o),k=S},"onSave"),store:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(v),k){const S=o??".devcontainer/devcontainer.json";n.info(`DevContainer config saved to ${S}`)}},"execute");export{kr as default};
1
+ var Ee=Object.defineProperty;var f=(e,t)=>Ee(e,"name",{value:t,configurable:!0});import{createRequire as Me}from"node:module";import{isAccessibleSync as se,isFsCaseSensitive as Oe}from"@visulima/fs";import{O as Fe,M as X,z as D,Q as ve}from"../packem_shared/index-OlP7U_t5.js";import{execa as ye}from"execa";import{o as ke}from"../packem_shared/index-DH-5hsrC.js";import{jsx as b,jsxs as C}from"react/jsx-runtime";import{Spinner as Ge,Text as $,Box as M,render as _e}from"@visulima/tui";import{C as be,D as B,T as Te}from"../packem_shared/symbols-CQmER5MT.js";import{E as I,c as De,e as ne,q as K,d as Y}from"./bin.js";const Ae=Me(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ee=f(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[t,r]=F.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return F.getBuiltinModule(e)}return Ae(e)},"__cjs_getBuiltinModule"),{readFileSync:je,writeFileSync:Pe,unlinkSync:Re}=ee("node:fs"),{randomBytes:Ne}=ee("node:crypto"),{availableParallelism:ae}=ee("node:os");var He=Object.defineProperty,Le=f((e,t)=>He(e,"name",{value:t,configurable:!0}),"s$4");class j extends Error{static{f(this,"StagedError")}static{Le(this,"StagedError")}constructor(t,r){super(t,r),this.name=this.constructor.name}}var Be=Object.defineProperty,qe=f((e,t)=>Be(e,"name",{value:t,configurable:!0}),"o$6");class Ue extends j{static{f(this,"ApplyEmptyCommitError")}static{qe(this,"ApplyEmptyCommitError")}}var ze=Object.defineProperty,Ve=f((e,t)=>ze(e,"name",{value:t,configurable:!0}),"o$5");class T extends j{static{f(this,"ConfigError")}static{Ve(this,"ConfigError")}}var We=Object.defineProperty,Ke=f((e,t)=>We(e,"name",{value:t,configurable:!0}),"t$1");class ie extends j{static{f(this,"GetBackupStashError")}static{Ke(this,"GetBackupStashError")}}var Ye=Object.defineProperty,Qe=f((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"s$3");class _ extends j{static{f(this,"GitError")}static{Qe(this,"GitError")}stderr;constructor(t,r,n){super(t,n),this.stderr=r}}var Je=Object.defineProperty,Xe=f((e,t)=>Je(e,"name",{value:t,configurable:!0}),"e");class oe extends j{static{f(this,"RestoreOriginalStateError")}static{Xe(this,"RestoreOriginalStateError")}}var Ze=Object.defineProperty,et=f((e,t)=>Ze(e,"name",{value:t,configurable:!0}),"o$2");class A extends j{static{f(this,"TaskError")}static{et(this,"TaskError")}commandTitle;constructor(t,r,n){super(r,n),this.commandTitle=t}}var tt=Object.defineProperty,U=f((e,t)=>tt(e,"name",{value:t,configurable:!0}),"i");const rt=U(async e=>{if(e.config!==void 0)return e.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
2
+
3
+ import { defineConfig } from "@visulima/vis/config";
4
+
5
+ export default defineConfig({
6
+ staged: { "*.ts": "eslint --fix" },
7
+ });
8
+
9
+ Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},"resolveConfig"),ce=U(e=>{if(typeof e!="object"||e===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const t=Object.entries(e);if(t.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[r,n]of t){if(!r||r.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");Se(r,n)}return e},"validateConfig"),Se=U((e,t)=>{if(typeof t=="string"){if(t.trim()==="")throw new T(`Task for "${e}" is an empty string.`);return}if(Array.isArray(t)){if(t.length===0)throw new T(`Task array for "${e}" is empty.`);for(const r of t)Se(e,r);return}if(typeof t!="function"&&!st(t))throw new T(`Invalid task for "${e}" — expected string, string[], function, or { title, task } object.`)},"validateTask"),st=U(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask");var nt=Object.defineProperty,x=f((e,t)=>nt(e,"name",{value:t,configurable:!0}),"n$1");const de=2048,g=x(async(e,t)=>{const r=await ye("git",[...e],{cwd:t.cwd,env:t.env?{...process.env,...t.env}:void 0,input:t.input,reject:!1,stderr:"pipe",stdin:t.input===void 0?"ignore":"pipe",stdout:"pipe"}),n=typeof r.exitCode=="number"?r.exitCode:1;if(n!==0&&!t.lenient){const s=typeof r.stderr=="string"?r.stderr:"",i=s.length>de?`${s.slice(0,de)}…`:s;throw new _(`git ${e.join(" ")} failed with exit code ${n}: ${i.trim()}`,s)}return{exitCode:n,stderr:typeof r.stderr=="string"?r.stderr:"",stdout:typeof r.stdout=="string"?r.stdout:""}},"git"),R=x(async(e,t)=>{const{stdout:r}=await g(e,t);return r.trim()},"gitOut"),at=x(async e=>{const t=await g(["rev-parse","--is-inside-work-tree"],{cwd:e,lenient:!0});return t.exitCode===0&&t.stdout.trim()==="true"},"isGitRepo"),it=x(async e=>R(["rev-parse","--absolute-git-dir"],{cwd:e}),"getGitDirectory"),$e=x(async e=>R(["rev-parse","--show-toplevel"],{cwd:e}),"getWorkTree"),le=x(async e=>R(["write-tree"],{cwd:e}),"writeIndexTree"),ot=x(async e=>{const t=await g(["rev-parse","HEAD^{tree}"],{cwd:e,lenient:!0});return t.exitCode===0?t.stdout.trim():""},"headTreeSha"),N={major:2,minor:32},ct=x(e=>{const t=/git version (\d+)\.(\d+)/.exec(e);if(!t)return null;const r=Number.parseInt(t[1]??"",10),n=Number.parseInt(t[2]??"",10);return Number.isNaN(r)||Number.isNaN(n)?null:{major:r,minor:n}},"parseGitVersion"),dt=x(async e=>{const t=ct(await R(["--version"],{cwd:e}));if(t!==null&&(t.major<N.major||t.major===N.major&&t.minor<N.minor))throw new _(`Git ${N.major}.${N.minor} or newer is required; found ${t.major}.${t.minor}.`)},"assertGitVersion");var lt=Object.defineProperty,E=f((e,t)=>lt(e,"name",{value:t,configurable:!0}),"a$2");const ut="ACMR",ue=500,ft=E(async e=>{const{stdout:t}=await g(["diff-files","--raw","-z"],{cwd:e}),r=t.split("\0").filter(s=>s.length>0),n=[];for(let s=0;s<r.length;s+=1){const i=r[s];if(!i?.startsWith(":"))continue;const o=i.slice(1).split(" "),a=o[3],c=o[4],l=r[s+1];s+=1,c==="A"&&a!==void 0&&/^0+$/.test(a)&&l!==void 0&&n.push(l)}return n},"getIntentToAddPaths"),fe=E(async e=>{const{stdout:t}=await g(["ls-files","--others","--exclude-standard","-z"],{cwd:e});return t.split("\0").filter(r=>r.length>0)},"getUntrackedFiles"),ht=E(async(e,t)=>{if(e.length===0)return;const r=`${e.join("\0")}\0`;await g(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"removeFromIndex"),pt=E(async e=>{const t=e.diffFilter??ut,r=e.diff===void 0?["diff","--name-only","-z",`--diff-filter=${t}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${t}`,...e.diff.split(/\s+/).filter(Boolean)],{stdout:n}=await g(r,{cwd:e.cwd}),s=n.split("\0").filter(o=>o.length>0);if(s.length===0)return[];const i=e.workTree??await $e(e.cwd);return s.map(o=>Fe(o)?o:X(i,o))},"getFiles"),gt=E(async(e,t)=>{if(e.length===0)return null;const r=[];for(let i=0;i<e.length;i+=ue){const o=e.slice(i,i+ue),{stdout:a}=await g(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...o],{cwd:t.cwd});a.length>0&&r.push(a)}if(r.length===0)return null;const n=r.join(""),s=n.endsWith(`
10
+ `)?n:`${n}
11
+ `;return Buffer.from(s,"utf8")},"capturePatch"),mt=E(async e=>{const{stdout:t}=await g(["status","--porcelain=v1","-z"],{cwd:e}),r=t.split("\0"),n=[];for(let s=0;s<r.length;s+=1){const i=r[s];if(i===void 0||i.length<4)continue;const o=i.charAt(0),a=i.charAt(1),c=i.slice(3),l=o==="R"||o==="C"||a==="R"||a==="C";o!==" "&&o!=="?"&&a!==" "&&a!=="?"&&n.push(c),l&&(s+=1)}return n},"getPartiallyStagedFiles"),wt=E(async(e,t)=>{if(e.length===0)return;const r=`${e.join("\0")}\0`;await g(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"checkoutPaths"),vt=E(async(e,t)=>{if(await g(["update-index","--again"],{cwd:t.cwd,lenient:!0}),e.length===0)return;const r=`${e.join("\0")}\0`;await g(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:r})},"updateIndexAgain");var yt=Object.defineProperty,P=f((e,t)=>yt(e,"name",{value:t,configurable:!0}),"r$1");const kt="vis_staged_automatic_backup",xe=P(()=>`${kt}-${process.pid}-${Date.now()}-${Ne(3).toString("hex")}`,"buildMessage"),bt=P(async e=>{const t=await R(["stash","create"],{cwd:e});return t.length===0?null:(await g(["stash","store","-m",xe(),t],{cwd:e}),t)},"createBackupStash"),Tt=P(async e=>{const t=xe(),{exitCode:r,stdout:n}=await g(["stash","push","--keep-index","--include-untracked","--quiet","-m",t],{cwd:e,lenient:!0});if(r!==0)return null;const s=n.trim();return s.length>0&&/no local changes/i.test(s)?null:R(["rev-parse","stash@{0}"],{cwd:e})},"createHideAllStash"),te=P(async(e,t)=>{const{exitCode:r,stdout:n}=await g(["reflog","--format=%H %gd","refs/stash"],{cwd:e,lenient:!0});if(r!==0)return null;for(const s of n.split(/\r?\n/)){const[i,o]=s.split(/\s+/,2);if(i===t&&o!==void 0)return o}return null},"findStashRefBySha"),he=P(async(e,t)=>{if(t===null)return;const r=await te(e,t);r!==null&&await g(["stash","drop","--quiet",r],{cwd:e})},"dropBackupStash"),St=P(async(e,t)=>{if(t===null)throw new ie("Backup stash was not found — can't revert working tree.");const r=await te(e,t);if(r===null)throw new ie(`Backup stash ${t} is no longer reachable — can't revert working tree.`);await g(["reset","--hard","HEAD"],{cwd:e}),await g(["stash","apply","--index","--quiet",r],{cwd:e})},"applyBackupStash"),$t=P(async(e,t)=>{if(t===null)return;const r=await te(e,t);r!==null&&await g(["stash","pop","--quiet",r],{cwd:e})},"popHideAllStash");var xt=Object.defineProperty,Ct=f((e,t)=>xt(e,"name",{value:t,configurable:!0}),"l");class It{static{f(this,"GitWorkflow")}static{Ct(this,"GitWorkflow")}stagedFiles=[];partiallyStaged=[];workTree="";gitDir="";preTaskIndexTree="";postTaskIndexTree="";headTree="";revertApplied=!1;warnings=[];cwd;options;patch=null;backupStashSha=null;merge=[];shouldStash;shouldHidePartial;shouldHideUnstaged;shouldHideAll;hideAllStashSha=null;intentToAddPaths=[];preTaskUntracked=new Set;constructor(t){this.cwd=t.cwd??process.cwd(),this.options=t,this.shouldStash=t.stash!==!1&&t.diff===void 0,this.shouldHidePartial=t.hidePartiallyStaged!==!1,this.shouldHideUnstaged=t.hideUnstaged===!0,this.shouldHideAll=t.hideAll===!0}async prepare(){if(!await at(this.cwd))throw new _(`Not a git repository: ${this.cwd}`);await dt(this.cwd),this.workTree=await $e(this.cwd),this.gitDir=await it(this.cwd),this.stagedFiles=await pt({cwd:this.cwd,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await mt(this.cwd),this.snapshotMergeState(),this.intentToAddPaths=await ft(this.workTree),this.intentToAddPaths.length>0&&await ht(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await bt(this.workTree):this.partiallyStaged.length>0&&this.warnings.push("Running with --no-stash on partially-staged files — unstaged deltas will be captured to a patch, but if re-applying the patch fails after tasks run the changes cannot be recovered."),this.shouldHideAll?this.hideAllStashSha=await Tt(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await le(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await ot(this.workTree),this.preTaskUntracked=new Set(await fe(this.workTree))}async applyModifications({autoStage:t=!1}={}){if(this.stagedFiles.length===0)return;const r=this.stagedFiles.map(n=>D(this.workTree,n));if(await vt(r,{cwd:this.workTree}),t){const n=(await fe(this.workTree)).filter(s=>!this.preTaskUntracked.has(s));if(n.length>0){const s=`${n.join("\0")}\0`;await g(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:s})}}if(this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await le(this.workTree)}indexTreeChanged(){return this.preTaskIndexTree.length>0&&this.postTaskIndexTree.length>0&&this.preTaskIndexTree!==this.postTaskIndexTree}postTaskIndexMatchesHead(){return this.postTaskIndexTree.length>0&&this.headTree.length>0&&this.postTaskIndexTree===this.headTree}async restoreUnstagedChanges(){if(this.revertApplied||this.patch===null||this.shouldHideAll)return;const t=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let r;try{await g(t,{cwd:this.workTree,input:this.patch});return}catch(n){r=n instanceof _?n.stderr:String(n)}try{await g([...t,"--3way"],{cwd:this.workTree,input:this.patch})}catch(n){const s=n instanceof _&&n.stderr?n.stderr:String(n);throw new oe(`Failed to re-apply unstaged changes after running tasks. Original changes remain in the backup stash — recover with \`git stash list\` and \`git stash apply\`.
12
+ First attempt: ${r??"(no stderr)"}
13
+ Second attempt: ${s}`,{cause:n})}}async revert(){if(this.backupStashSha!==null){try{await St(this.workTree,this.backupStashSha)}catch(t){throw new oe("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:t})}if(await he(this.workTree,this.backupStashSha),this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(t){if(this.restoreMergeState(),this.hideAllStashSha!==null)try{await $t(this.workTree,this.hideAllStashSha)}catch{}t&&this.backupStashSha!==null&&!this.revertApplied&&await he(this.workTree,this.backupStashSha)}recoveryHint(){return this.backupStashSha===null?null:`Backup stash is preserved (sha ${this.backupStashSha.slice(0,7)}) — restore with: git stash apply --index ${this.backupStashSha}`}async hideUnstagedChanges(){const t=new Set(this.stagedFiles.map(n=>D(this.workTree,n))),r=this.shouldHideUnstaged?[...t]:this.shouldHidePartial?this.partiallyStaged.filter(n=>t.has(n)):[];r.length!==0&&(this.patch=await gt(r,{cwd:this.workTree}),this.patch!==null&&await wt(r,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(t=>{const r=X(this.gitDir,t);return se(r)?{body:je(r),existed:!0,name:t}:{body:null,existed:!1,name:t}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const t of this.merge){const r=X(this.gitDir,t.name);try{t.existed&&t.body!==null?Pe(r,t.body):se(r)&&Re(r)}catch{}}}}var Et=Object.defineProperty,z=f((e,t)=>Et(e,"name",{value:t,configurable:!0}),"r");const Ce=z(e=>e.includes("/"),"isPathStyle"),q=z((e,t)=>t?e.toLowerCase():e,"normalizeForMatch"),Mt=z((e,t,r,n={})=>{const s=Ce(e),i=n.caseInsensitive===!0,o=q(e,i),a=[];for(const c of t){const l=s?D(r,c):ve(c);ke(o,q(l,i))&&a.push(c)}return a},"matchFiles"),At=z((e,t,r,n={})=>{if(!t||t.length===0)return[...e];const s=n.caseInsensitive===!0;return e.filter(i=>{for(const o of t){const a=Ce(o)?D(r,i):ve(i),c=q(o,s);if(ke(c,q(a,s)))return!1}return!0})},"applyIgnore");var Ot=Object.defineProperty,H=f((e,t)=>Ot(e,"name",{value:t,configurable:!0}),"g");const jt=H(e=>{switch(e){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},"colorForStatus"),pe=H(e=>{if(e==="running")return b(Ge,{type:"dots"});const t=e==="failed"?be:e==="skipped"?B:e==="success"?Te:B;return b($,{color:jt(e),children:t})},"iconForStatus"),ge=H(({state:e,tick:t,verbose:r})=>C(M,{flexDirection:"column",children:[[...e.patterns.values()].map(n=>C(M,{flexDirection:"column",children:[C(M,{children:[pe(n.status),C($,{children:[" ",n.title]})]}),[...n.commands.values()].map(s=>C(M,{flexDirection:"column",marginLeft:2,children:[C(M,{children:[pe(s.status),C($,{children:[" ",s.title," "]}),s.status!=="pending"&&s.status!=="running"?C($,{color:"gray",children:["(",s.durationMs,"ms)"]}):null]}),r&&s.output?b(M,{flexDirection:"column",marginLeft:2,children:s.output.split(/\r?\n/).slice(0,20).map((i,o)=>b($,{color:"gray",children:i},`${s.id}-line-${o}`))}):null,s.status==="failed"&&s.error?b(M,{marginLeft:2,children:b($,{color:"red",children:s.error.message})}):null]},s.id))]},n.id)),e.infoMessages.map((n,s)=>b($,{color:"gray",children:n},`info-${s}`)),e.warnMessages.map((n,s)=>b($,{color:"yellow",children:n},`warn-${s}`)),e.errorMessages.map(({message:n},s)=>b($,{color:"red",children:n},`err-${s}`))]}),"App"),Pt=H((e={})=>{const t=e.verbose===!0,r={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let n=0;const s=_e(b(ge,{state:r,tick:n,verbose:t}),{exitOnCtrlC:!1,stdout:process.stderr}),i=H(()=>{n+=1,s.rerender(b(ge,{state:r,tick:n,verbose:t}))},"refresh");return{commandEnd({commandId:o,durationMs:a,error:c,output:l,patternId:u,status:d}){const p=r.patterns.get(u)?.commands.get(o);p&&(p.status=d,p.durationMs=a,p.output=l,p.error=c,i())},commandStart({commandId:o,patternId:a}){const c=r.patterns.get(a)?.commands.get(o);c&&(c.status="running",i())},error({error:o,message:a}){r.errorMessages.push({error:o,message:a}),i()},info({message:o}){r.infoMessages.push(o),i()},patternEnd({patternId:o,status:a}){const c=r.patterns.get(o);c&&(c.status=a,i())},patternStart({patternId:o}){const a=r.patterns.get(o);a&&(a.status="running",i())},start({patterns:o}){r.started=!0;for(const a of o){const c=new Map;for(const l of a.commands)c.set(l.id,{durationMs:0,id:l.id,status:"pending",title:l.title});r.patterns.set(a.id,{commands:c,id:a.id,status:"pending",title:a.title})}i()},async stop(){s.unmount(),await s.waitUntilExit()},warn({message:o}){r.warnMessages.push(o),i()}}},"createInkRenderer");var Rt=Object.defineProperty,Q=f((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"a$1");const me=Q((e={})=>{const{quiet:t=!1,verbose:r=!1}=e,n=new Map,s=new Map,i=Q(a=>{t||process.stderr.write(`${a}
14
+ `)},"print"),o=Q(a=>{switch(a){case"failed":return Y(be);case"running":return K(">");case"skipped":return ne(B);case"success":return De(Te);default:return I(B)}},"iconFor");return{commandEnd({commandId:a,durationMs:c,error:l,output:u,status:d}){const p=s.get(a)??a,v=I(`(${c}ms)`);if(i(` ${o(d)} ${p} ${v}`),d==="failed"&&l&&i(I(l.message)),(d==="failed"||r)&&u&&u.trim().length>0)for(const h of u.split(/\r?\n/))i(` ${I(h)}`)},commandStart({commandId:a}){if(!r)return;const c=s.get(a)??a;i(` ${I("…")} ${c}`)},error({error:a,message:c}){t?process.stderr.write(`${Y(c)}
15
+ `):i(Y(c)),a?.stack&&(r||!t)&&process.stderr.write(`${I(a.stack)}
16
+ `)},info({message:a}){i(I(a))},patternEnd({patternId:a,status:c}){const l=n.get(a)??a;i(`${o(c)} ${l}`)},patternStart({patternId:a}){const c=n.get(a)??a;i(`${K(">")} ${c}`)},start({patterns:a}){if(a.length===0){i(I("No staged files matched any pattern."));return}const c=new Set(a.flatMap(l=>l.files)).size;i(`${K(">")} Running staged tasks on ${c} file${c===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const l of a){n.set(l.id,l.title);for(const u of l.commands)s.set(u.id,u.title)}},stop(){},warn({message:a}){i(ne(a))}}},"createPlainRenderer");var Ft=Object.defineProperty,Nt=f((e,t)=>Ft(e,"name",{value:t,configurable:!0}),"t");const Gt=Nt(async e=>{const{env:t}=process;if(e.debug===!0||e.quiet===!0||t.NODE_ENV==="test"||t.TERM==="dumb"||t.CI!==void 0||!process.stderr.isTTY)return me({quiet:e.quiet,verbose:e.verbose});try{return Pt({verbose:e.verbose})}catch{return me({quiet:e.quiet,verbose:e.verbose})}},"pickRenderer");var _t=Object.defineProperty,G=f((e,t)=>_t(e,"name",{value:t,configurable:!0}),"a");const J=G(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask"),Dt=G(async e=>{let t=0,r=0;const n=G(()=>(t+=1,`pattern-${t}`),"nextPatternId"),s=G(()=>(r+=1,`cmd-${r}`),"nextCommandId"),i=G(async(a,c,l)=>{if(typeof a=="string"){l.push({command:a,files:c,id:s(),source:"string",title:a});return}if(Array.isArray(a)){for(const u of a)await i(u,c,l);return}if(typeof a=="function"){const u=await a([...c]);if(typeof u=="string"){l.push({command:u,files:c,id:s(),source:"function",title:u});return}if(Array.isArray(u)){for(const d of u)if(typeof d=="string")l.push({command:d,files:c,id:s(),source:"function",title:d});else if(J(d))l.push({files:c,id:s(),run:d.task,source:"custom",title:d.title});else throw new T("Task function returned an array with an unsupported entry — expected strings or { title, task }.");return}if(J(u)){l.push({files:c,id:s(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], or { title, task }.")}if(J(a)){l.push({files:c,id:s(),run:a.task,source:"custom",title:a.title});return}throw new T("Unsupported task value — expected string, string[], function, or { title, task }.")},"expandTask"),o=[];for(const[a,c]of Object.entries(e.config)){const l=Mt(a,e.files,e.cwd,{caseInsensitive:e.caseInsensitive===!0});if(l.length===0)continue;const u=e.relative?l.map(p=>D(e.cwd,p)):l,d=[];await i(c,u,d),d.length!==0&&o.push({commands:d,files:u,id:n(),pattern:a,title:`${a} — ${l.length} file${l.length===1?"":"s"}`})}return o},"buildTaskGraph");var Ht=Object.defineProperty,V=f((e,t)=>Ht(e,"name",{value:t,configurable:!0}),"d$1");const Lt=V(e=>{const t=[];let r="",n=!1,s=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(o===void 0)break;if(o==="\\"&&!n&&i+1<e.length){const a=e[i+1];if(a!==void 0){s&&a!=='"'&&a!=="\\"&&(r+=o),r+=a,i+=1;continue}}if(o==='"'&&!n){s=!s;continue}if(o==="'"&&!s){n=!n;continue}if(!n&&!s&&/\s/.test(o)){r.length>0&&(t.push(r),r="");continue}r+=o}if(n||s)throw new T(`Unterminated ${n?"single":"double"} quote in command: ${e}`);return r.length>0&&t.push(r),t},"parseCommandString"),Ie=process.platform==="win32"?28e3:131072,Bt=V((e,t,r)=>{const n=[];let s=[],i=t;const o=r<=0?Ie:r;for(const a of e){const c=Buffer.byteLength(a)+1;s.length>0&&i+c>o&&(n.push(s),s=[],i=t),s.push(a),i+=c}return s.length>0&&n.push(s),n},"chunkFiles"),qt=V(async(e,t,r)=>{const n=Lt(e);if(n.length===0)throw new A(e,"Empty command for staged task.");const[s,...i]=n;if(s===void 0)throw new A(e,"Empty command for staged task.");const o=Buffer.byteLength(s)+i.reduce((u,d)=>u+Buffer.byteLength(d)+1,0),a=Bt(t,o,r.maxArgLength??Ie),c=Date.now(),l=[];for(const u of a){if(r.signal?.aborted===!0)throw new A(e,"Task aborted by earlier failure.");const d=await ye(s,[...i,...u],{cancelSignal:r.signal,cwd:r.cwd,env:Ut(r.env),killSignal:r.killSignal??"SIGTERM",reject:!1,stderr:"pipe",stdout:"pipe"}),p=typeof d.stdout=="string"?d.stdout:"",v=typeof d.stderr=="string"?d.stderr:"",h=[p,v].filter(m=>m.length>0).join(`
17
+ `);if(h.length>0&&l.push(h),d.isCanceled||d.isTerminated||typeof d.exitCode!="number"){const m=d.isCanceled?"Task aborted by earlier failure.":d.isTerminated?`Task killed by signal ${d.signal??"(unknown)"}.`:h.trim()||"Task exited without a numeric status code.";throw new A(e,m)}if(d.exitCode!==0)throw new A(e,h.trim()||`Exit code ${d.exitCode} from ${s}`)}return{durationMs:Date.now()-c,output:l.join(`
18
+ `)}},"execCommand"),Ut=V(e=>{const t={...process.env};return process.stderr.isTTY&&t.FORCE_COLOR===void 0&&t.NO_COLOR===void 0&&(t.FORCE_COLOR="1"),e?{...t,...e}:t},"buildTaskEnv");var zt=Object.defineProperty,O=f((e,t)=>zt(e,"name",{value:t,configurable:!0}),"o");const Vt=O(async(e,t,r)=>{const n=Kt(r.concurrent,e.length),s=[],i=new AbortController;let o=!1,a=0;const c=O(()=>{o||(o=!0,r.continueOnError||i.abort())},"cancel");r.externalSignal&&(r.externalSignal.aborted?c():r.externalSignal.addEventListener("abort",()=>{c()},{once:!0}));const l=O(h=>{for(const m of h.commands)t.commandEnd({commandId:m.id,durationMs:0,patternId:h.id,status:"skipped"})},"emitSkippedCommands"),u=O(async h=>{if(o){l(h),t.patternEnd({patternId:h.id,status:"skipped"});return}t.patternStart({patternId:h.id});let m="success";for(const y of h.commands){if(o){t.commandEnd({commandId:y.id,durationMs:0,patternId:h.id,status:"skipped"}),m=m==="success"?"skipped":m;continue}t.commandStart({commandId:y.id,patternId:h.id});const k=await Wt(y,r,i.signal),S=k.status==="failed"&&i.signal.aborted?{...k,status:"skipped"}:k;if(t.commandEnd({commandId:y.id,durationMs:S.durationMs,error:S.error,output:S.output,patternId:h.id,status:S.status}),S.status==="failed"){s.push(y.title),m="failed",c();break}if(S.status==="skipped"){m=m==="success"?"skipped":m;break}}t.patternEnd({patternId:h.id,status:m})},"runOne"),d=O(async()=>{for(;a<e.length;){const h=e[a];a+=1,h&&await u(h)}},"pickNext"),p=[];for(let h=0;h<Math.min(n,e.length);h+=1)p.push(d());await Promise.all(p);const v=r.externalSignal?.aborted===!0;return{failedCommands:s,success:s.length===0&&!v}},"runTasks"),Wt=O(async(e,t,r)=>{const n=Date.now();try{if(e.source==="custom"&&e.run)return await e.run([...e.files]),{durationMs:Date.now()-n,status:"success"};if(e.command){const s=await qt(e.command,e.files,{cwd:t.cwd,killSignal:t.killSignal,maxArgLength:t.maxArgLength,signal:r});return{durationMs:s.durationMs,output:t.verbose?s.output:void 0,status:"success"}}return{durationMs:Date.now()-n,error:new A(e.title,"Command has no invocation target."),status:"failed"}}catch(s){const i=s instanceof Error?s:new Error(String(s));return{durationMs:Date.now()-n,error:i,output:i instanceof A?i.message:void 0,status:"failed"}}},"runCommand"),Kt=O((e,t)=>{if(e===!1)return 1;if(e===!0){const n=Math.max(1,typeof ae=="function"?ae():4);return Math.min(Math.max(1,t),n)}const r=Math.floor(e);return r>0?r:1},"concurrencyLimit");var Yt=Object.defineProperty,Z=f((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"u");const Qt=!0,Jt=Z(e=>{try{return!Oe(e)}catch{return!1}},"detectCaseInsensitive"),Xt=Z(async(e={})=>{const t=e.cwd??process.cwd(),r=await Gt(e),n=await rt(e);typeof n!="function"&&ce(n);const s=new It({...e,cwd:t}),i=new AbortController;let o=!1;const a=Z(d=>{if(o){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,d);return}o=!0,r.warn({message:`Received ${d} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()},"onInterrupt");process.on("SIGINT",a),process.on("SIGTERM",a);let c={failedCommands:[],ranTasks:!1,success:!0},l=!1,u=!1;try{await s.prepare(),l=!0;for(const k of s.warnings)r.warn({message:k});if(s.stagedFiles.length===0)return e.allowEmpty!==!0&&r.info({message:"No staged files found."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const d=Jt(t),p=At(s.stagedFiles,e.ignore,t,{caseInsensitive:d});if(p.length===0&&s.stagedFiles.length>0)return r.info({message:"Every staged file was excluded by the `ignore` list."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const v=typeof n=="function"?ce(await n([...p])):n,h=await Dt({caseInsensitive:d,config:v,cwd:t,files:p,relative:e.relative});if(r.start({patterns:h}),h.length===0)return r.info({message:"No staged files matched any pattern."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:m,success:y}=await Vt(h,r,{concurrent:e.concurrent??Qt,continueOnError:e.continueOnError===!0,cwd:t,externalSignal:i.signal,killSignal:e.killSignal,maxArgLength:e.maxArgLength,verbose:e.verbose});if(c={failedCommands:m,ranTasks:!0,success:y},y){if(e.diff===void 0&&(await s.applyModifications({autoStage:e.autoStage===!0}),e.failOnChanges===!0&&s.indexTreeChanged()&&(r.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),c={failedCommands:[...m],ranTasks:!0,success:!1}),e.allowEmpty!==!0&&s.postTaskIndexMatchesHead()))throw new Ue("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else if(e.revert===!0)r.info({message:"Reverting working tree from backup stash."}),await s.revert();else{const k=s.recoveryHint();k&&r.warn({message:k})}return await s.restoreUnstagedChanges(),u=c.success,c}catch(d){const p=d instanceof Error?d.message:String(d),v=d instanceof Error?d:new Error(p);if(r.error({error:v,message:p}),d instanceof j)return{failedCommands:c.failedCommands,ranTasks:c.ranTasks,success:!1};throw d}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),l)try{await s.cleanup(u)}catch(d){r.error({error:d,message:"Cleanup failed."})}await r.stop()}},"runStaged");var Zt=Object.defineProperty,er=f((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"n");const tr="VIS_STAGED_CONCURRENT",we=er(e=>{const t=e.trim();if(t==="true"||t==="")return!0;if(t==="false")return!1;const r=Number(t);return Number.isNaN(r)?!0:r},"parseConcurrent");var rr=Object.defineProperty,L=f((e,t)=>rr(e,"name",{value:t,configurable:!0}),"d");const sr=L((e,t)=>{const r={};t!==void 0&&(r.config=t);const n=L(w=>e[w]===void 0?void 0:!!e[w],"readBool"),s=L(w=>{const W=e[w];return typeof W=="string"&&W.length>0?W:void 0},"readString"),i=n("allow-empty");i!==void 0&&(r.allowEmpty=i);const o=n("auto-stage");o!==void 0&&(r.autoStage=o);const a=n("continue-on-error");a!==void 0&&(r.continueOnError=a);const c=n("debug");c!==void 0&&(r.debug=c);const l=n("fail-on-changes");l!==void 0&&(r.failOnChanges=l);const u=n("hide-partially-staged");u!==void 0&&(r.hidePartiallyStaged=u);const d=n("hide-unstaged");d!==void 0&&(r.hideUnstaged=d);const p=n("quiet");p!==void 0&&(r.quiet=p);const v=n("relative");v!==void 0&&(r.relative=v);const h=n("revert");h!==void 0&&(r.revert=h);const m=n("stash");m!==void 0&&(r.stash=m);const y=n("verbose");y!==void 0&&(r.verbose=y);const k=s("cwd");k!==void 0&&(r.cwd=k);const S=s("diff");S!==void 0&&(r.diff=S);const re=s("diff-filter");if(re!==void 0&&(r.diffFilter=re),n("force-kill")===!0&&(r.killSignal="SIGKILL"),e.concurrent===void 0){const w=process.env[tr];w!==void 0&&(r.concurrent=we(w.trim()))}else{const{concurrent:w}=e;r.concurrent=we(typeof w=="string"?w:typeof w=="number"||typeof w=="boolean"?String(w):"")}return r},"buildRunOptions"),pr=L(async({options:e,visConfig:t})=>{const r=(t??{}).staged;if(!r)throw new Error(`No "staged" config found in vis.config.ts. Add one:
19
+
20
+ // vis.config.ts
21
+ import { defineConfig } from "@visulima/vis/config";
22
+
23
+ export default defineConfig({
24
+ staged: { '*': 'vis check --fix' },
25
+ });
26
+
27
+ Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await Xt(sr(e,r))).success||(process.exitCode=1)},"execute");export{sr as buildRunOptions,pr as default};