#!/usr/bin/env node
import'./chunk-5TAVYPOV.js';import o from'chalk';async function g(i,l){let t=i||process.cwd(),r=parseInt(l.port||"3838",10),a=l.open!==false;console.log(o.cyan(`
Starting Sentinel...
`));try{let{startServer:n}=await import('./server-4YNUIK4W.js');console.log(o.gray(`Project: ${t}`)),console.log(o.gray(`Port: ${r}`)),console.log(),await n({port:r,projectDir:t,open:a}),console.log(o.green(`
Sentinel is running at http://localhost:${r}`)),console.log(o.gray(`
Press Ctrl+C to stop
`)),await new Promise(()=>{});}catch(n){let e=n.code,s=n.message||"";e==="ERR_MODULE_NOT_FOUND"||e==="MODULE_NOT_FOUND"?(console.error(o.red(`
@a-company/sentinel is not installed.`)),console.log(o.gray(`Install it with: npm install @a-company/sentinel
`))):e==="EADDRINUSE"?(console.error(o.red(`
Error: Port ${r} is already in use.`)),console.log(o.gray(`Try a different port with: paradigm sentinel --port ${r+1}
`))):e==="EACCES"?(console.error(o.red(`
Error: Permission denied on port ${r}.`)),console.log(o.gray(`Ports below 1024 require elevated privileges. Try: paradigm sentinel --port 3838
`))):e==="ENOENT"?(console.error(o.red(`
Error: Project directory not found: ${t}`)),console.log(o.gray(`Verify the path exists and try again.
`))):s.includes("ECONNREFUSED")||s.includes("ETIMEDOUT")?(console.error(o.red(`
Error: Network connection failed.`)),console.log(o.gray(`Check your network configuration and try again.
`))):(console.error(o.red(`
Failed to start Sentinel.`)),console.error(o.gray(`  Error: ${s||"Unknown error"}`)),e&&console.error(o.gray(`  Code:  ${e}`)),console.log(o.gray(`
If this persists, try:`)),console.log(o.gray("  1. Ensure @a-company/sentinel is up to date")),console.log(o.gray("  2. Check that no other process is using the port")),console.log(o.gray("  3. Run `paradigm doctor` to check your setup\n"))),process.exit(1);}}export{g as sentinelCommand};