@ciandt-flow/cli 2.9.0-beta.23 → 2.9.0-beta.24

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 (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -530,7 +530,7 @@ entirely (e.g. \`prototypes/\`).
530
530
  `,"utf8");}B();function wv(e){return createHash("sha256").update(e,"utf8").digest("hex")}function Sv(){return {new:0,unchanged:0,clean:0,divergent:0,declined:0}}async function og(e={}){let t=e.targetDir??process.cwd(),r=e.dryRun??false,n=e.force??false,o=e.isInteractive??!!process.stdin.isTTY,s=e.confirmOverwrite??bv,i=join(t,Qf),a=eg(i),l=[],u=Sv(),c={};for(let m of Zf){let p=join(t,m.path),f=await xv({dstPath:p,template:m,existingLockHash:tg(a,m.path),force:n,isInteractive:o,confirmOverwrite:y=>s(y)});l.push({path:m.path,status:f.status}),u[f.status]++,f.write&&!r&&(mkdirSync(dirname(p),{recursive:true}),writeFileSync(p,m.content,"utf8")),f.recordHash&&!r&&(c[m.path]=f.recordHash);}!r&&Object.keys(c).length>0&&rg(i,a,c,Yf);let d=u.divergent>0||u.declined>0;return {files:l,counts:u,hasUnresolved:d}}async function xv(e){let{dstPath:t,template:r,existingLockHash:n,force:o,isInteractive:s,confirmOverwrite:i}=e;if(!existsSync(t))return {status:"new",write:true,recordHash:r.sha256};let a=wv(readFileSync(t,"utf8"));return a===r.sha256?{status:"unchanged",write:false,recordHash:r.sha256}:n!==void 0&&a===n?o?{status:"clean",write:true,recordHash:r.sha256}:s?await i(r.path)?{status:"clean",write:true,recordHash:r.sha256}:{status:"declined",write:false,recordHash:void 0}:{status:"declined",write:false,recordHash:void 0}:o?{status:"divergent",write:true,recordHash:r.sha256}:(I(`divergent, kept local (customized): ${r.path}`),{status:"divergent",write:false,recordHash:a})}async function bv(e){return Ue(` Overwrite ${e} with the updated template? [y/N] `)}B();$();Ie();Kr();$();var rc=x("lib:otelMetrics"),vv="flow-plugins-cli",Ev="1.0.0",Pv=5e3;function Tv(){return At("FLOW_OTEL_ENDPOINT_URL","https://flow.ciandt.com/otel")}function Cv(e,t){return typeof t=="number"?{key:e,value:{intValue:String(t)}}:typeof t=="boolean"?{key:e,value:{boolValue:t}}:{key:e,value:{stringValue:t}}}function kv(e,t){let r=String(Date.now()*1e6);return {resourceMetrics:[{resource:{attributes:[]},scopeMetrics:[{scope:{name:vv,version:Ev},metrics:[{name:e,sum:{dataPoints:[{asInt:"1",startTimeUnixNano:r,timeUnixNano:r,attributes:Object.entries(t).map(([n,o])=>Cv(n,o))}],aggregationTemporality:1,isMonotonic:true}}]}]}]}}async function nc(e,t={}){try{let[r,n]=await Promise.all([xn(),Y()]),o=r?.email,s=n?.tenant;if(!o||!s){rc.debug(`Skipping OTel metric "${e}": no cached identity available`);return}let i=kv(e,t);await nd.post(Tv(),{json:i,timeout:Pv,headers:{"Content-Type":"application/json","x-flow-user":o,flowtenant:s}}),rc.debug(`OTel metric sent: ${e}`);}catch(r){rc.warn(`Failed to send OTel metric "${e}": ${String(r)}`);}}var oc=x("cli:init");function Av(e){switch(e){case "new":return "new";case "unchanged":return "unchanged";case "clean":return "updated";case "divergent":return "kept (customized)";case "declined":return "pending (declined)"}}function $v(e,t,r,n){v(b.CLI_STRATEGY_INIT_COMPLETED,{files_new:e.new,files_unchanged:e.unchanged,files_updated:e.clean,files_divergent:e.divergent,files_declined:e.declined,dry_run:t,duration_ms:n,exit_code:r}).catch(o=>{oc.warn(`Failed to emit strategy init completed event: ${String(o)}`);}),nc("flow_cli.strategy_init",{dry_run:t,files_new:e.new,files_updated:e.clean,exit_code:r}).catch(()=>{});}function Rv(e,t){v(b.CLI_STRATEGY_INIT_FAILED,{error_message:e.slice(0,500),duration_ms:t}).catch(r=>{oc.warn(`Failed to emit strategy init failed event: ${String(r)}`);}),nc("flow_cli.strategy_init_failed",{duration_ms:t}).catch(()=>{});}async function sg(e){oc.debug(`Running flow setup strategy: ${JSON.stringify(e)}`);let t=Date.now(),r;try{r=await og({targetDir:e.path,dryRun:e.dryRun,force:e.force});}catch(c){throw Rv(c instanceof Error?c.message:String(c),Date.now()-t),c}let n=r.hasUnresolved?2:0;if($v(r.counts,!!e.dryRun,n,Date.now()-t),e.json)return Te({dryRun:!!e.dryRun,counts:r.counts,files:r.files,exitCode:n}),n;let o=e.dryRun?"[dry-run] ":"";process.stdout.write(`
531
531
  `);for(let c of r.files)process.stdout.write(` ${o}${Av(c.status)}: ${c.path}
532
532
  `);process.stdout.write(`
533
- `);let{new:s,unchanged:i,clean:a,divergent:l,declined:u}=r.counts;return te(`${s} new, ${i} unchanged, ${a} updated, ${l} kept (customized)`+(u>0?`, ${u} pending confirmation`:"")),l>0&&I("Some files were kept as-is because they differ from what this command last wrote. Re-run with --force to overwrite them."),u>0&&I("Some updates were declined or skipped (no TTY). Re-run with --force to apply them."),n!==0&&P("flow setup strategy finished with unresolved files \u2014 see above."),n}B();j();var ro=["cit-tools","commons-claude","langfuse-common","runbook-common","runbook-design","runbook-ops","runbook-product","runbook-quality","runbook-security","runbook-tech","runbook-tech-common"];var Lv=["local","project","user"];function Mv(){I(`The following ${ro.length} runbook bundles will be installed:`);for(let e of ro)process.stdout.write(` - ${e}
533
+ `);let{new:s,unchanged:i,clean:a,divergent:l,declined:u}=r.counts;return te(`${s} new, ${i} unchanged, ${a} updated, ${l} kept (customized)`+(u>0?`, ${u} pending confirmation`:"")),l>0&&I("Some files were kept as-is because they differ from what this command last wrote. Re-run with --force to overwrite them."),u>0&&I("Some updates were declined or skipped (no TTY). Re-run with --force to apply them."),n!==0&&P("flow setup strategy finished with unresolved files \u2014 see above."),n}B();j();var ro=["runbook-common","runbook-design","runbook-ops","runbook-product","runbook-quality","runbook-security","runbook-tech"];var Lv=["local","project","user"];function Mv(){I(`The following ${ro.length} runbook bundles will be installed:`);for(let e of ro)process.stdout.write(` - ${e}
534
534
  `);}function _v(e){let t=De().plugins;for(let[r,n]of Object.entries(t))if((r===e||r.startsWith(`${e}@`))&&n[0])return n[0]}function ig(e){return e.scope==="user"?"globally (~/.claude/)":`at ${e.scope} scope in ${e.projectPath??"(unknown project)"}`}async function Dv(e,t){return I(`${e} is already installed ${ig(t)}.`),Ue(" Install here too? This won't duplicate any files, but the plugin will end up enabled in both places, and the central install record will only remember this newest one. [y/N] ")}async function Ov(){return Td(" Install scope:",Lv.map(e=>({value:e,label:dr[e].actionLabel,description:dr[e].description})))}async function ag(e={}){let t=e.isInteractive??!!process.stdin.isTTY;e.silent||Mv();let r=e.scope;if(!r&&!e.silent&&t)try{r=await Ov();}catch(o){if(o instanceof Error&&o.message==="SIGINT")return process.stdout.write(`
535
535
  `),130;throw o}let n=[];for(let o=0;o<ro.length;o++){let s=ro[o],i=`[${o+1}/${ro.length}] `,a=e.force??false;if(!a){let l=_v(s);if(l){if(e.silent||!t){e.silent||I(`${i}Skipping ${s} \u2014 already installed ${ig(l)}. Re-run with --force to install here too.`);continue}try{if(!await Dv(s,l)){I(`${i}Skipped ${s}.`);continue}a=!0;}catch(u){if(u instanceof Error&&u.message==="SIGINT")return process.stdout.write(`
536
536
  `),130;throw u}}}e.silent||I(`${i}Installing ${s}...`),n.push(await eo([s],{scope:r,silent:e.silent,force:a}));}return n.some(o=>o!==0)?1:0}function lg(e){let t=new Command;t.enablePositionalOptions(),t.name("flow").description("FlowSetup CLI \u2014 Manage Flow plugins in your Claude Code").version(`@ciandt-flow/cli v${ue}`,"-V, --version","Display the CLI version").addHelpText("after",`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciandt-flow/cli",
3
- "version": "2.9.0-beta.23",
3
+ "version": "2.9.0-beta.24",
4
4
  "description": "TUI for browsing and installing Claude Code plugins from the Flow ecosystem",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",