@ciandt-flow/cli 2.14.0-beta.71 → 2.14.0-beta.72
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/index.js +15 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -603,7 +603,9 @@ ${yh}
|
|
|
603
603
|
`);}let n=t,o=false;if(r.length>0&&(await X(` Remove the ${r.length} invalid entr${r.length===1?"y":"ies"} listed above? [y/N] `)?o=true:n=e),await X(" Add more repos to repos.yaml? [y/N] "))for(process.stdout.write(C.bold(`
|
|
604
604
|
Add repos (leave the URL empty to finish):
|
|
605
605
|
`));;){let i=await Ch();if(!i)break;n=[...n,i],o=true,process.stdout.write(C.green(` \u2713 added ${i.name}
|
|
606
|
-
`));}return {repos:n,changed:o}}R();var Rh=x("workspace:repos"),$h=6e4;async function uT(e){try{return (await simpleGit(e).status()).current}catch{return null}}function _h(){let{HOME:e,PATH:t,USER:r,SSH_AUTH_SOCK:n}=process.env;return {HOME:e,PATH:t,USER:r,SSH_AUTH_SOCK:n,GIT_TERMINAL_PROMPT:"0"}}var Mh=["GIT_TERMINAL_PROMPT"];function Lh(e){return e?{progress:({progress:t})=>e(t)}:{}}async function dT(e,t){await simpleGit(e,{timeout:{block:$h},allowEnvironment:Mh,...Lh(t)}).env(_h()).pull(["--ff-only"]);}async function pT(e,t,r){await simpleGit({timeout:{block:$h},allowEnvironment:Mh,...Lh(r)}).env(_h()).clone(e,t);}
|
|
606
|
+
`));}return {repos:n,changed:o}}R();var Rh=x("workspace:repos"),$h=6e4;async function uT(e){try{return (await simpleGit(e).status()).current}catch{return null}}function _h(){let{HOME:e,PATH:t,USER:r,SSH_AUTH_SOCK:n}=process.env;return {HOME:e,PATH:t,USER:r,SSH_AUTH_SOCK:n,GIT_TERMINAL_PROMPT:"0"}}var Mh=["GIT_TERMINAL_PROMPT"];function Lh(e){return e?{progress:({progress:t})=>e(t)}:{}}async function dT(e,t){await simpleGit(e,{timeout:{block:$h},allowEnvironment:Mh,...Lh(t)}).env(_h()).pull(["--ff-only"]);}async function pT(e,t,r){await simpleGit({timeout:{block:$h},allowEnvironment:Mh,...Lh(r)}).env(_h()).clone(e,t);}var mT=["Authentication failed","could not read Username","Permission denied","Repository not found","Could not read from remote repository"],fT='This usually means the wrong default SSH identity is being used for this host, not a real access problem. Add a dedicated Host alias to ~/.ssh/config (e.g. "Host github.com-<org>" with IdentityFile pointing at the key that has access to this org), then point this repo\'s `remote:` in repos.yaml at that alias and retry.';function gT(e){return mT.some(r=>e.includes(r))?`${e}
|
|
607
|
+
|
|
608
|
+
${fT}`:e}async function Dh(e,t,r){let n=join(t,e.name),o=join(n,".git");if(existsSync(o)){let s=await uT(n);if(s==="main"||s==="master")try{return await dT(n,r),{name:e.name,outcome:"updated",path:n}}catch(i){return Rh.warn(`[${e.name}] pull failed (branch diverged?): ${String(i)}`),{name:e.name,outcome:"skipped",path:n}}return {name:e.name,outcome:"skipped",path:n}}try{return mkdirSync(t,{recursive:!0}),await pT(e.remote,n,r),{name:e.name,outcome:"cloned",path:n}}catch(s){let i=s instanceof Error?s.message:String(s);return Rh.error(`[${e.name}] clone failed: ${i}`),{name:e.name,outcome:"failed",error:gT(i)}}}function xa(e,t){return !existsSync(join(t,e.name,".git"))}var hT="general";function Oh(e){return e.group??hT}function Nh(e){return [...new Set(e.map(Oh))].sort()}function Uh(e,t,r){return r===null?e:e.filter(n=>!xa(n,t)||r.has(Oh(n)))}function Bh(e,t){return existsSync(e)?readdirSync(e,{withFileTypes:true}).filter(r=>r.isDirectory()&&!t.has(r.name)).map(r=>r.name):[]}var ST=promisify(execFile),Fh=5e3;async function jh(){try{let{stdout:e,stderr:t}=await ST("ssh",["-T","git@github.com","-o","BatchMode=yes","-o",`ConnectTimeout=${Fh/1e3}`],{timeout:Fh+2e3});return `${e}${t}`.includes("successfully authenticated")}catch(e){return `${e.stdout??""}${e.stderr??""}`.includes("successfully authenticated")}}function Kh(e){let t=Math.max(1,cpus().length);return Math.max(1,Math.min(t,4,e))}async function Hh(e,t,r){let n=new Array(e.length),o=0;async function s(){for(;;){let a=o++;if(a>=e.length)return;n[a]=await r(e[a],a);}}let i=Math.max(1,Math.min(t,e.length));return await Promise.all(Array.from({length:i},()=>s())),n}var Zc="All";async function IT(e,t){let r=e.filter(s=>xa(s,t)),n=Nh(r);if(n.length<=1)return null;let o=await Hl("Some repos are not cloned yet \u2014 which groups do you want to clone?",[{value:Zc,label:Zc},...n.map(s=>({value:s,label:s}))]);return o.length===0||o.includes(Zc)?null:new Set(o)}function Qc(e={}){return {repos:[],orphans:[],prunedCount:0,skippedNoManifest:true,manifestWarnings:[],sshBlocked:false,...e}}async function Gh(e={}){let t=e.targetDir??process.cwd(),r=e.isInteractive??!!process.stdin.isTTY,n=bh(t);if(n){if(r){let I=await Ah(n.repos);I.changed?(n={...n,repos:I.repos},Sa(t,n)):n={...n,repos:I.repos};}}else {if(!r)return Qc();let I=await kh();if(!I)return Qc();Sa(t,I),Ih(t),n=I;}let{repos:o,converted:s}=xh(n.repos);s.length>0&&(n={...n,repos:o},Sa(t,n)),Eh(t,n.workspace);let i=join(t,n.workspace.repos_dir),{valid:a,invalid:l}=wa(n.repos),u=[...n.warnings,...l.map(I=>`${I.entry.name||"(unnamed)"}: ${I.reason} \u2014 skipped`),...s.map(I=>`${I.before.name}: remote is HTTPS \u2014 converted to SSH (${I.after.remote}) and saved to repos.yaml`)],c=r?await IT(a,i):null,d=Uh(a,i,c);if(d.some(I=>xa(I,i))&&!await jh())return Qc({skippedNoManifest:false,manifestWarnings:u,workspaceDirs:n.workspace,sshBlocked:true});let p=Kh(d.length),f=await Hh(d,p,async(I,L)=>{e.onRepoProgress?.({name:I.name,index:L,total:d.length,status:"start"});let M=await Dh(I,i,T=>{e.onRepoProgress?.({name:I.name,index:L,total:d.length,status:"start",progress:T});});return e.onRepoProgress?.({name:I.name,index:L,total:d.length,status:M.outcome,path:M.path}),M}),g=new Set(a.map(I=>I.name)),h=Bh(i,g),w=0;if(e.prune&&h.length>0)for(let I of h)rmSync(join(i,I),{recursive:true,force:true}),w++;return vh(t,n.workspace.repos_dir),{repos:f,orphans:e.prune?[]:h,prunedCount:w,skippedNoManifest:false,manifestWarnings:u,workspaceDirs:n.workspace,sshBlocked:false}}var CT=promisify(execFile),kT=`#!/usr/bin/env bash
|
|
607
609
|
# .githooks/pre-commit \u2014 blocks a commit if trufflehog finds a secret in the
|
|
608
610
|
# staged diff, with extra attention to .claude/settings*.json.
|
|
609
611
|
#
|
|
@@ -688,13 +690,13 @@ fi
|
|
|
688
690
|
|
|
689
691
|
echo -e "\${GREEN}\u2713\${RESET} No secrets found in staged changes."
|
|
690
692
|
exit 0
|
|
691
|
-
`;async function Wh(e){let t=join(e,".githooks");mkdirSync(t,{recursive:true}),writeFileSync(join(t,"pre-commit"),
|
|
692
|
-
`)}function
|
|
693
|
-
`);})):(process.stdout.write(
|
|
694
|
-
`);}}var
|
|
695
|
-
`);}async function
|
|
696
|
-
`),130;throw i}let n=e.force??false,o={scope:r,silent:e.silent,isInteractive:t,force:n},s=[];try{for(let a=0;a<mo.length;a++){let l=mo[a],u=`[${a+1}/${mo.length}] `,c=await qh(l,u,o);c!==gs&&s.push(c);}let i=e.extraPlugins?tu.filter(a=>e.extraPlugins.includes(a)):await
|
|
697
|
-
`),130;throw i}return s.some(i=>i!==0)?1:0}var
|
|
693
|
+
`;async function Wh(e){let t=join(e,".githooks");mkdirSync(t,{recursive:true}),writeFileSync(join(t,"pre-commit"),kT,{mode:493}),await CT("git",["config","core.hooksPath",".githooks"],{cwd:e});}R();function eu(e){switch(e){case "cloned":return "cloned";case "updated":return "updated";case "skipped":return "skipped (diverged or another branch)";case "failed":return "failed"}}function zh(e,t,r){let n=`[${t+1}/${r}]`;if(!e||e.status==="start"){if(e?.progress===void 0)return C.dim(` ${n} ${e?.name??"waiting..."}`);let{bar:s}=Nn(e.progress,100);return C.yellow(` ${n} ${e.name} ${s} ${e.progress}%`)}let o=eu(e.status);if(e.status==="cloned"||e.status==="updated"){let s=e.path?` \u2192 ${e.path}`:"";return C.green(` ${n} ${e.name}: ${o}${s}`)}return e.status==="failed"?C.red(` ${n} ${e.name}: ${o}`):C.dim(` ${n} ${e.name}: ${o}`)}function AT(e){return e.map((t,r)=>zh(t,r,e.length)).join(`
|
|
694
|
+
`)}function RT(e){return e!==void 0&&e.status!=="start"}function Xh(){let e=[],t=false;return r=>{e.length===0&&(e=new Array(r.total).fill(void 0)),e[r.index]=r,t?(process.stdout.write(`\x1B[${e.length-1}A`),e.forEach((n,o)=>{process.stdout.write(`\r\x1B[2K${zh(n,o,e.length)}`),o<e.length-1&&process.stdout.write(`
|
|
695
|
+
`);})):(process.stdout.write(AT(e)),t=true),e.every(RT)&&process.stdout.write(`
|
|
696
|
+
`);}}var $T=["local","project","user"],Yh=[{name:"cit-tools",description:"CI&T-branded content tools (deck-architect agent, ciandt-pptx, ciandt-clay-render, pptx-builder, refiner skills)"},{name:"commons-claude",description:"Claude Code machine-setup skills (setup-claude-defaults, setup-session-recap, setup-statusline) \u2014 not product tooling, personal environment config"}],tu=Yh.map(e=>e.name);function _T(e){return e.filter(t=>!tu.includes(t))}function MT(){b(`The following ${mo.length} runbook bundles will be installed:`);for(let e of mo)process.stdout.write(` - ${e}
|
|
697
|
+
`);}async function LT(e,t){if(t||!e)return [];let r=[];for(let{name:n,description:o}of Yh)await X(` Also install ${n}? (${o}) [y/N] `)&&r.push(n);return r}async function DT(){return wi(" Install scope:",$T.map(e=>({value:e,label:Xe[e].actionLabel,description:Xe[e].description})))}var gs=Symbol("skip");async function qh(e,t,r){let{scope:n,silent:o,isInteractive:s,force:i}=r;if(!i){let a=oa(e);if(a){if(a.scope===n)return o||b(`${t}${e} is already installed ${qt(a)}. Use --force to reinstall.`),gs;if(o||!s)return o||b(`${t}Skipping ${e} \u2014 already installed ${qt(a)}. Re-run with --force to install here too.`),gs;if(!await sa(e,n,a))return b(`${t}Skipped ${e}.`),gs;let u=await us(e,{force:true,scope:a.scope});if(u!==0)return b(`${t}Could not remove ${e} from ${qt(a)} \u2014 skipping rather than leaving it in an inconsistent state.`),u}}return o||b(`${t}Installing ${e}...`),uo([e],{scope:n,silent:o,force:i})}async function ru(e={}){if(!await Y())return 1;let t=e.isInteractive??!!process.stdin.isTTY;if(e.extraPlugins){let i=_T(e.extraPlugins);if(i.length>0){let a=`--extra-plugins: unknown bundle(s) ${i.join(", ")} \u2014 valid values are ${tu.join(", ")}`;return e.silent?oe({error:a}):v(a),1}}e.silent||MT();let r=e.scope;if(!r&&!e.silent&&t)try{r=await DT();}catch(i){if(i instanceof Error&&i.message==="SIGINT")return process.stdout.write(`
|
|
698
|
+
`),130;throw i}let n=e.force??false,o={scope:r,silent:e.silent,isInteractive:t,force:n},s=[];try{for(let a=0;a<mo.length;a++){let l=mo[a],u=`[${a+1}/${mo.length}] `,c=await qh(l,u,o);c!==gs&&s.push(c);}let i=e.extraPlugins?tu.filter(a=>e.extraPlugins.includes(a)):await LT(t,e.silent);for(let a=0;a<i.length;a++){let l=i[a],u=`[extra ${a+1}/${i.length}] `,c=await qh(l,u,o);c!==gs&&s.push(c);}}catch(i){if(i instanceof Error&&i.message==="SIGINT")return process.stdout.write(`
|
|
699
|
+
`),130;throw i}return s.some(i=>i!==0)?1:0}var OT=x("cli:setup-workspace");function NT(){b("SSH key not configured for GitHub (or not added to your account)."),process.stdout.write(` Stopping before cloning \u2014 configure SSH and run this command again:
|
|
698
700
|
`),process.stdout.write(` 1. Check for an existing key: ls -la ~/.ssh/id_ed25519.pub
|
|
699
701
|
`),process.stdout.write(` 2. If none, generate one: ssh-keygen -t ed25519 -C "your_email@example.com"
|
|
700
702
|
`),process.stdout.write(` 3. Start the agent: eval "$(ssh-agent -s)"
|
|
@@ -702,10 +704,10 @@ exit 0
|
|
|
702
704
|
`),process.stdout.write(` 5. Copy the public key: pbcopy < ~/.ssh/id_ed25519.pub (macOS)
|
|
703
705
|
`),process.stdout.write(` 6. Add it on GitHub: https://github.com/settings/ssh/new
|
|
704
706
|
`),process.stdout.write(` 7. Test the connection: ssh -T git@github.com
|
|
705
|
-
`);}function
|
|
707
|
+
`);}function UT(e){if(e.length===0)return;let t=e.map(r=>[r.outcome==="cloned"||r.outcome==="updated"?"\u2713":r.outcome==="skipped"?"\u25CB":"\u2717",r.name,eu(r.outcome),r.error??""]);br(["","Repo","Outcome","Detail"],t);}async function BT(e,t,r,n){if(r||!n||t.skippedNoManifest||!t.workspaceDirs)return;let{repos_dir:o}=t.workspaceDirs,s=await X(` Add an off-limits note to CLAUDE.md for '${o}/'? [y/N] `),i=Ph(e,t.workspaceDirs,s);i==="appended"?b(`CLAUDE.md updated with an off-limits note for '${o}/'.`):i==="already-present"?b("CLAUDE.md already has the off-limits note \u2014 skipped."):i==="no-claude-md"&&b("No CLAUDE.md found in this repo \u2014 skipped the off-limits note.");}async function FT(e,t,r){if(!(t||!r||e.length===0||!await X(" Install a pre-commit secret-scan hook (trufflehog-based) in the newly cloned repo(s)? Blocks a commit if trufflehog finds a secret in the staged diff (skips with a warning if trufflehog isn't on PATH). Bypass: git commit --no-verify. [y/N] ")))for(let o of e)o.path&&(await Wh(o.path),b(`Pre-commit secret-scan hook installed in ${o.name}.`));}async function nu(e={}){if(OT.debug(`Running flow setup workspace: ${JSON.stringify(e)}`),!await Y())return 1;let t=e.isInteractive??!!process.stdin.isTTY,r=await Gh({targetDir:e.path,prune:e.prune,isInteractive:t,onRepoProgress:e.json?void 0:Xh()});if(e.json)return oe({repos:r.repos,orphans:r.orphans,prunedCount:r.prunedCount,skippedNoManifest:r.skippedNoManifest,manifestWarnings:r.manifestWarnings,sshBlocked:r.sshBlocked}),r.sshBlocked||r.repos.some(l=>l.outcome==="failed")?1:0;for(let l of r.manifestWarnings)b(`repos.yaml: ${l}`);if(r.sshBlocked)return NT(),1;if(r.skippedNoManifest)return b("No repos.yaml and no interactive terminal \u2014 nothing to do."),0;UT(r.repos);let n=r.repos.filter(l=>l.outcome==="cloned").length,o=r.repos.filter(l=>l.outcome==="updated").length,s=r.repos.filter(l=>l.outcome==="skipped").length,i=r.repos.filter(l=>l.outcome==="failed").length;q(`${n} cloned, ${o} updated, ${s} skipped`+(i>0?`, ${i} failed`:"")+(r.prunedCount>0?`, ${r.prunedCount} pruned`:"")),r.orphans.length>0&&b(`Orphan director${r.orphans.length===1?"y":"ies"} not in repos.yaml: ${r.orphans.join(", ")}. Re-run with --prune to remove.`);let a=r.repos.filter(l=>l.outcome==="cloned");return await FT(a,e.json,t),await BT(e.path??process.cwd(),r,e.json,t),i>0?1:0}var jT=[{key:"strategy",label:"strategy (scaffold the numbered documentation structure)",run:e=>ha({path:e})},{key:"harness",label:"harness (install the fixed set of Flow runbook bundles)",run:()=>ru({})},{key:"workspace",label:"workspace (clone/update repos declared in repos.yaml)",run:e=>nu({path:e})}];async function KT(e){return X(` Run ${e}? [y/N] `)}async function Zh(e={}){if(!await Y())return 1;let t=e.isInteractive??!!process.stdin.isTTY,r=e.confirmStep??KT,n=!!e.yes||!t;!e.yes&&!t&&b("No interactive terminal and --yes not set \u2014 running all steps without prompting.");let o=[];for(let s of jT){if(!(n||await r(s.label))){b(` \u2192 ${s.key} skipped.`);continue}o.push(await s.run(e.path));}return o.some(s=>s!==0)?1:0}var HT=">=2.9.0-beta.28 <2.10.2-beta.49";function VT(e){return nc.valid(e)?nc.satisfies(e,HT,{includePrerelease:true}):false}function ey(e=ye){return VT(e)?{blocked:true,message:`@ciandt-flow/cli@${e} is a known-affected version (FLWP-72469): it embeds internal flow-harness documentation in the published package.
|
|
706
708
|
Run: npm install -g @ciandt-flow/cli@latest
|
|
707
|
-
Then re-run this command.`}:{blocked:false}}function
|
|
708
|
-
`)}function ty(e){let t=new Command;t.enablePositionalOptions(),t.configureHelp({styleTitle:c=>C.bold(c),styleCommandText:c=>C.cyan.bold(c),styleSubcommandText:c=>C.cyan(c),styleOptionTerm:c=>C.yellow(c),styleArgumentTerm:c=>C.green(c),styleDescriptionText:c=>C.dim(c)}),t.name("flow").description("FlowSetup CLI \u2014 Manage Flow plugins in your Claude Code").version(`@ciandt-flow/cli v${ye}`,"-V, --version","Display the CLI version").addHelpText("after",()=>
|
|
709
|
+
Then re-run this command.`}:{blocked:false}}function GT(e){let t=["",C.bold("All commands:"),""];function r(n,o,s){if(n.name()==="help")return;let i=`${o} ${n.name()}`,a=" ".repeat(s),l=n.description()?C.dim(` \u2014 ${n.description()}`):"";t.push(`${a}${C.cyan(`flow${i}`)}${l}`);for(let u of n.commands)r(u,i,s+1);}for(let n of e.commands)r(n,"",1);return t.push("",C.dim("Without arguments, opens the interactive interface (TUI)."),C.dim("Use 'flow <command> --help' for details and examples on each command.")),t.join(`
|
|
710
|
+
`)}function ty(e){let t=new Command;t.enablePositionalOptions(),t.configureHelp({styleTitle:c=>C.bold(c),styleCommandText:c=>C.cyan.bold(c),styleSubcommandText:c=>C.cyan(c),styleOptionTerm:c=>C.yellow(c),styleArgumentTerm:c=>C.green(c),styleDescriptionText:c=>C.dim(c)}),t.name("flow").description("FlowSetup CLI \u2014 Manage Flow plugins in your Claude Code").version(`@ciandt-flow/cli v${ye}`,"-V, --version","Display the CLI version").addHelpText("after",()=>GT(t)).action(async()=>{await e();});let r=new Command("setup").description("Configure the CLI and provision Flow structure in the current repository");r.command("init").description("Initialize the Flow CLI configuration").addHelpText("after",`
|
|
709
711
|
Examples:
|
|
710
712
|
$ flow setup init`).action(async()=>{let c=await Rc();D(c);}),r.command("strategy").description("Scaffold the numbered strategy documentation structure (0-current-state, 1-strategy, 2-plan, 3-delivery, 4-learn)").option("--dry-run","Preview changes without writing files or prompting",false).option("--json","Output machine-readable JSON",false).option("--force","Skip confirmation before overwriting an up-to-date file, and overwrite customized files too",false).option("--path <dir>","Target repository root (defaults to the current directory)").addOption(new Option("--assistant <name>","Also scaffold a config file for this coding assistant (e.g. CLAUDE.md). Interactive: asks for confirmation before creating it. Non-interactive: never creates it, even with this flag set.").choices(["claude-code"])).addHelpText("after",`
|
|
711
713
|
Examples:
|
|
@@ -865,8 +867,8 @@ Examples:
|
|
|
865
867
|
$ flow modules install dashboard`).action(async c=>{let d=await ph(c);D(d);}),u.command("update").description("Update an installed module, or all installed modules").argument("[alias]","Module alias to update (omit to update all installed)").addHelpText("after",`
|
|
866
868
|
Examples:
|
|
867
869
|
$ flow modules update
|
|
868
|
-
$ flow modules update metrics`).action(async c=>{let d=await mh(c??null);D(d);}),t.addCommand(u);for(let c of me)t.command(c.alias).description(c.description).helpOption(false).allowUnknownOption().passThroughOptions().argument("[passthrough...]","Arguments forwarded to the module binary").action(async d=>{await ch(c.alias,d);});return t.hook("preAction",(c,d)=>{if(d.name()==="help")return;let{blocked:m,message:p}=ey();if(m)throw new Error(p)}),t.hook("preAction",()=>{Xi();}),t}R();function
|
|
870
|
+
$ flow modules update metrics`).action(async c=>{let d=await mh(c??null);D(d);}),t.addCommand(u);for(let c of me)t.command(c.alias).description(c.description).helpOption(false).allowUnknownOption().passThroughOptions().argument("[passthrough...]","Arguments forwarded to the module binary").action(async d=>{await ch(c.alias,d);});return t.hook("preAction",(c,d)=>{if(d.name()==="help")return;let{blocked:m,message:p}=ey();if(m)throw new Error(p)}),t.hook("preAction",()=>{Xi();}),t}R();function zT(){return W__default.join(Se__default.homedir(),".claude","settings.json")}function ny(){let e=zT();try{if(!ue__default.existsSync(e))return !0;let r=JSON.parse(ue__default.readFileSync(e,"utf-8")).flowCli?.autoUpdate;return r===!1?!1:r==="modules-only"?"modules-only":!0}catch{return true}}R();var eC=x("updateChecker"),tC=promisify(execFile),rC=1440*60*1e3,oy=3e4;function nC(){let e=process.env.FLOW_HOME??W__default.join(Se__default.homedir(),".flow");return W__default.join(e,"update.lock")}async function sy(e){try{let{stdout:t}=await tC(tr(),["view",e,"version"],{timeout:oy,shell:process.platform==="win32"});return String(t).trim()||null}catch{return null}}async function oC(e){let t=new AbortController,r=setTimeout(()=>t.abort(),oy);try{let n=await fetch(`https://api.github.com/repos/${e}/releases/latest`,{signal:t.signal});return n.ok?(await n.json()).tag_name?.replace(/^v/,"")??null:null}catch{return null}finally{clearTimeout(r);}}async function sC(e){return e.versionCheck.type==="npm-registry"?sy(e.versionCheck.package):oC(e.versionCheck.repo)}async function iC(){let e=await sy("@ciandt-flow/cli");return e&&Ge(ye,e)?(ta({currentVersion:ye,latestVersion:e,isOutdated:true,packageName:"@ciandt-flow/cli"}).catch(()=>{}),e):null}async function aC(){let e=sn().filter(t=>t.installMethod!==null);await Promise.all(e.map(async t=>{let r=me.find(i=>i.alias===t.alias);if(!r||r.hasOwnUpdateCheck)return;let n=Date.now(),o=t.lastChecked?new Date(t.lastChecked).getTime():0;if(n-o<rC)return;let s=await sC(r);try{await bt({...t,lastChecked:new Date().toISOString()});}catch(i){eC.warn(`Failed to update lastChecked for ${t.alias}: ${String(i)}`);}s&&t.installedVersion&&Ge(t.installedVersion,s)&&Qs(r,"background").catch(()=>{});}));}async function su(){let e=ny();if(e===false)return;let t=nC();ue__default.mkdirSync(W__default.dirname(t),{recursive:true});let r;try{r=await _w.lock(t,{realpath:!1,retries:0});}catch{return}try{if(e!=="modules-only"){let n=await iC().catch(()=>null);n&&process.stdout.write(`
|
|
869
871
|
\u26A0 @ciandt-flow/cli v${n} installing in background.
|
|
870
872
|
Restart flow to apply the update.
|
|
871
873
|
|
|
872
|
-
`);}await
|
|
874
|
+
`);}await aC().catch(()=>{});}finally{await r().catch(()=>{});}}N();var cC=x("cli"),iu=ty(async()=>{Be("tui"),Hu("tui"),Vu(),process.on("SIGINT",()=>{let{activeTab:t,screen:r}=S.getState();vo("sigint",t,r).finally(()=>process.exit(130));}),process.on("SIGTERM",()=>{let{activeTab:t,screen:r}=S.getState();vo("sigterm",t,r).finally(()=>process.exit(143));}),await su().catch(()=>{}),await pp().catch(t=>{cC.error(`Failed to init catalog registry: ${String(t)}`);}),await rg();let{waitUntilExit:e}=render(jsx(ng,{}),{alternateScreen:true,exitOnCtrlC:false});await e(),process.exit(0);});iu.hook("preAction",async(e,t)=>{t!==iu&&await su().catch(()=>{});});try{await iu.parseAsync();}catch(e){v(e instanceof Error?e.message:String(e)),D(1);}
|