@codions/portta 0.0.0-next.20261102175030.sha-b63e5a6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -748,9 +748,9 @@ t.push(` - hostname: ${$n(n.hostname)}`,` service: ${$n(n.service)}`)}return
748
748
  s=="string"?o.s:"";if(!s||!a||!c)throw new On("the token is missing the account, tunnel or secret field");if(!wm.test(a))throw new On("the tunnel id inside the token is not a UUID");return{AccountTag:s,TunnelID:a,TunnelSecret:c}}i(zP,"parseTunnelToken");function FP(e){return`${JSON.stringify(e)}
749
749
  `}i(FP,"renderTunnelCredentials");var KF=/(Unauthorized|failed to authenticate|invalid tunnel secret|token is invalid|401)/i,JF=/(Couldn't start tunnel|validation failed|error parsing YAML|unable to parse config)/i,YF=/Registered tunnel connection/i;function UP(e){return!e.tokenConfigured||!e.zoneConfigured?{state:"not-configured",detail:e.tokenConfigured?"no domain has been set":"no tunnel token has been set",hint:"Settings -> Cloudflare Tunnel"}:e.enabled?KF.test(e.logTail)?{state:"auth-error",detail:"Cloudflare rejected the t\
750
750
  unnel token",hint:"the tunnel may have been deleted, or the token belongs to another account. Replace the token."}:JF.test(e.logTail)?{state:"config-error",detail:"the connector refused its configuration",hint:"portta tunnel status --logs"}:e.containerState!=="running"?{state:"disconnected",detail:e.containerState?`the connector container is ${e.containerState}`:"the connector container does not exist",hint:"portta up"}:YF.test(e.logTail)?{state:"connected",detail:"holding registered connections\
751
- to the Cloudflare edge",hint:null}:e.containerHealth==="starting"||!e.logTail?{state:"starting",detail:"the connector is establishing its connections",hint:null}:{state:"disconnected",detail:"the connector is running but has registered no connection",hint:"check outbound network access; the connector dials Cloudflare on 7844/udp and 443/tcp"}:{state:"configured",detail:"set up, and not enabled",hint:"enable it to start the connector"}}i(UP,"tunnelStatusFrom");import{stderr as XF,stdin as BP}from"node:process";import{createInterface as QF}from"node:readline/promises";var ze={success:0,failure:1,usage:2,precondition:3,refused:4},Se=class extends Error{static{i(this,"CliError")}exitCode;hint;constructor(t,n=ze.failure,r){super(t),this.name="CliError",this.exitCode=n,this.hint=r}},L=class extends Se{static{i(this,"PreconditionError")}constructor(t,n){super(t,ze.precondition,n)}},U=class extends Se{static{i(this,"RefusedError")}constructor(t,n){super(t,ze.refused,n)}},T=class extends Se{static{i(this,"UsageError")}constructor(t,n){super(t,ze.usage,n)}};async function Ye(e,t){if(t)return;if(!BP.isTTY)throw new U(`${e}; confirmation is unavailable without a TTY`,"pass --yes to confirm non-interactively");let n=QF({input:BP,output:XF});try{let r=await n.question(`${e} [y/N] `);if(!/^y(es)?$/i.test(r.trim()))throw new U("operation cancelled")}finally{n.close()}}i(Ye,"confirm");import{existsSync as rr,readFileSync as HP}from"node:fs";import{dirname as tU,join as vt,resolve as lo}from"node:path";var qP={name:"@codions/portta",version:"0.0.0-next.20261102175030.sha-b63e5a6",description:"Machine-first CLI for a shared Docker development gateway",keywords:["docker","docker-compose","traefik","development","gateway","devcontainer","reverse-proxy"],license:"MIT",type:"module",bin:{portta:"dist/cli.js"},files:["dist"],publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{build:"node --import tsx scripts/build.mjs",typecheck:"tsc -p tsconfig.json --noEmit",test:"vites\
752
- t run",prepack:"npm run build",prepublishOnly:"npm run typecheck && npm test"},engines:{node:">=24"},repository:{type:"git",url:"git+https://github.com/codions-labs/portta.git",directory:"packages/cli"},homepage:"https://github.com/codions-labs/portta#readme",bugs:"https://github.com/codions-labs/portta/issues",dependencies:{"@clack/prompts":"^1.1.0",commander:"14.0.2",execa:"9.6.1",systeminformation:"^5.33.8",yaml:"^2.8.2",zod:"4.6.7"},devDependencies:{"@types/node":"24.13.3",esbuild:"0.28.2","\
753
- portta-contracts":"0.1.0","portta-core":"0.1.0",typescript:"7.0.2",vitest:"4.1.12",tsx:"4.23.13"}};var nr=qP.version,Sc="2026-11-02T17:52:57Z";function Gs(){return`portta ${nr}${Sc?` (built ${Sc})`:""}`}i(Gs,"cliVersionLine");var nU="0.0.0-local";function xm(e){return rr(vt(e,"docker","compose","compose.yaml"))?rr(vt(e,"VERSION"))||rr(vt(e,"packages","cli","package.json")):!1}i(xm,"isGatewayRoot");function km(e){let t=vt(e,"VERSION");if(rr(t))return HP(t,"utf8").trim();let n=vt(e,"packages","cli","package.json");if(rr(n))return nU;throw new L(`missing generated VERSION in ${e}`,"reinstall the @codions/portta npm package")}i(km,"versionForRoot");function rU(){let e=process.env.HOME;return[process.env.PORTTA_HOME,e?vt(
751
+ to the Cloudflare edge",hint:null}:e.containerHealth==="starting"||!e.logTail?{state:"starting",detail:"the connector is establishing its connections",hint:null}:{state:"disconnected",detail:"the connector is running but has registered no connection",hint:"check outbound network access; the connector dials Cloudflare on 7844/udp and 443/tcp"}:{state:"configured",detail:"set up, and not enabled",hint:"enable it to start the connector"}}i(UP,"tunnelStatusFrom");import{stderr as XF,stdin as BP}from"node:process";import{createInterface as QF}from"node:readline/promises";var ze={success:0,failure:1,usage:2,precondition:3,refused:4},Se=class extends Error{static{i(this,"CliError")}exitCode;hint;constructor(t,n=ze.failure,r){super(t),this.name="CliError",this.exitCode=n,this.hint=r}},L=class extends Se{static{i(this,"PreconditionError")}constructor(t,n){super(t,ze.precondition,n)}},U=class extends Se{static{i(this,"RefusedError")}constructor(t,n){super(t,ze.refused,n)}},T=class extends Se{static{i(this,"UsageError")}constructor(t,n){super(t,ze.usage,n)}};async function Ye(e,t){if(t)return;if(!BP.isTTY)throw new U(`${e}; confirmation is unavailable without a TTY`,"pass --yes to confirm non-interactively");let n=QF({input:BP,output:XF});try{let r=await n.question(`${e} [y/N] `);if(!/^y(es)?$/i.test(r.trim()))throw new U("operation cancelled")}finally{n.close()}}i(Ye,"confirm");import{existsSync as rr,readFileSync as HP}from"node:fs";import{dirname as tU,join as vt,resolve as lo}from"node:path";var qP={name:"@codions/portta",version:"0.2.0",description:"Machine-first CLI for a shared Docker development gateway",keywords:["docker","docker-compose","traefik","development","gateway","devcontainer","reverse-proxy"],license:"MIT",type:"module",bin:{portta:"dist/cli.js"},files:["dist"],publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{build:"node --import tsx scripts/build.mjs",typecheck:"tsc -p tsconfig.json --noEmit",test:"vitest run",prepack:"npm run build",prepublishOnly:"\
752
+ npm run typecheck && npm test"},engines:{node:">=24"},repository:{type:"git",url:"git+https://github.com/codions-labs/portta.git",directory:"packages/cli"},homepage:"https://github.com/codions-labs/portta#readme",bugs:"https://github.com/codions-labs/portta/issues",dependencies:{"@clack/prompts":"^1.1.0",commander:"14.0.2",execa:"9.6.1",systeminformation:"^5.33.8",yaml:"^2.8.2",zod:"4.6.7"},devDependencies:{"@types/node":"24.13.3",esbuild:"0.28.2","portta-contracts":"0.1.0","portta-core":"0.1.0",
753
+ typescript:"7.0.2",vitest:"4.1.12",tsx:"4.23.13"}};var nr=qP.version,Sc="2026-11-02T18:03:18Z";function Gs(){return`portta ${nr}${Sc?` (built ${Sc})`:""}`}i(Gs,"cliVersionLine");var nU="0.0.0-local";function xm(e){return rr(vt(e,"docker","compose","compose.yaml"))?rr(vt(e,"VERSION"))||rr(vt(e,"packages","cli","package.json")):!1}i(xm,"isGatewayRoot");function km(e){let t=vt(e,"VERSION");if(rr(t))return HP(t,"utf8").trim();let n=vt(e,"packages","cli","package.json");if(rr(n))return nU;throw new L(`missing generated VERSION in ${e}`,"reinstall the @codions/portta npm package")}i(km,"versionForRoot");function rU(){let e=process.env.HOME;return[process.env.PORTTA_HOME,e?vt(
754
754
  e,"portta"):void 0,"/opt/portta",e?vt(e,".portta"):void 0,"/var/lib/portta"].filter(t=>!!t)}i(rU,"wellKnownRoots");function _m(e=process.cwd()){let t=process.env.PORTTA_ROOT;if(t&&xm(lo(t)))return lo(t);let n=lo(e);for(;;){if(xm(n))return n;let r=tU(n);if(r===n)break;n=r}for(let r of rU())if(xm(lo(r)))return lo(r);return null}i(_m,"findGatewayRoot");function $(e={}){let t=e.root?lo(e.root):_m();if(!t){if(e.required===!1){let c={...process.env,PORTTA_PROFILE:e.profile??process.env.PORTTA_PROFILE},
755
755
  u=Jn(c);return{root:process.cwd(),env:c,config:u,composeFiles:[],version:nr}}throw new L("no Portta installation found","run `portta setup`, set PORTTA_HOME, or run this inside the gateway directory")}let n=rr(vt(t,".env"))?Pe(HP(vt(t,".env"),"utf8")):new Map,r=Hr(n,process.env);for(let[c,u]of Object.entries(e.overrides??{}))r[c]=u;e.profile&&(r.PORTTA_PROFILE=e.profile),r.PORTTA_ROOT=t,Ww(r);let o=Jn(r);r.PORTTA_DOMAIN=o.domain,r.PORTTA_BIND_ADDRESS=o.bindAddress;let s=Zw(o);for(let c of s)if(!rr(
756
756
  vt(t,c)))throw new L(`missing compose file: ${c}`);let a=km(t);return r.PORTTA_VERSION=a,{root:t,env:r,config:o,composeFiles:s,version:a}}i($,"gatewayContext");function be(e){return["--project-directory",e.root,...e.composeFiles.flatMap(t=>["-f",vt(e.root,t)])]}i(be,"composeArguments");import{spawn as OW}from"node:child_process";import{closeSync as TW,openSync as CW}from"node:fs";function ve(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}i(ve,"isPlainObject");import{fileURLToPath as oU}from"node:url";var uo=i((e,t)=>{let n=Em(sU(e));if(typeof n!="string")throw new TypeError(`${t} must be a string or a file URL: ${n}.`);return n},"safeNormalizeFileUrl"),sU=i(e=>Pm(e)?e.toString():e,"normalizeDenoExecPath"),Pm=i(e=>typeof e!="string"&&e&&Object.getPrototypeOf(e)===String.prototype,"isDenoExecPath"),Em=i(e=>e instanceof URL?oU(e):e,"normalizeFileUrl");var xc=i((e,t=[],n={})=>{let r=uo(e,"First argument"),[o,s]=ve(t)?[[],t]:[t,n];if(!Array.isArray(o))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${o}`);if(o.some(u=>typeof u=="object"&&u!==null))throw new TypeError(`Second argument must be an array of strings: ${o}`);let a=o.map(String),c=a.find(u=>u.includes("\0"));if(c!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${c}`);if(!ve(s))throw new TypeError(`Last argument\
Binary file
@@ -1 +1 @@
1
- 0.0.0-next.20261102175030.sha-b63e5a6
1
+ 0.2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codions/portta",
3
- "version": "0.0.0-next.20261102175030.sha-b63e5a6",
3
+ "version": "0.2.0",
4
4
  "description": "Machine-first CLI for a shared Docker development gateway",
5
5
  "keywords": [
6
6
  "docker",