@aurodesignsystem-dev/auro-cli 0.0.0-pr302.12 → 0.0.0-pr302.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.
package/dist/auro-cli.js CHANGED
@@ -146,8 +146,8 @@ document.querySelector('#confirmDialog').show();
146
146
  `;function nt(r){return`${vo}${Ao}
147
147
  ${r}
148
148
 
149
- ${xo}`}var Mc=nt(Eo);function b(r){return(r??"").replace(/\s+/gu," ").trim()}import P from"chalk";var To=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/u;function lr(r){let t=To.exec(r.trim());return t?{main:[Number(t[1]),Number(t[2]),Number(t[3])],pre:t[4]?t[4].split("."):[]}:null}function So(r,t){let e=lr(r),n=lr(t);if(!e||!n)return null;for(let s=0;s<3;s+=1)if(e.main[s]!==n.main[s])return e.main[s]<n.main[s]?-1:1;if(e.pre.length===0&&n.pre.length===0)return 0;if(e.pre.length===0)return 1;if(n.pre.length===0)return-1;let o=Math.max(e.pre.length,n.pre.length);for(let s=0;s<o;s+=1){let i=e.pre[s],a=n.pre[s];if(i===void 0)return-1;if(a===void 0)return 1;let c=/^\d+$/u.test(i),m=/^\d+$/u.test(a);if(c&&m){let p=Number(i)-Number(a);if(p!==0)return p<0?-1:1}else{if(c!==m)return c?-1:1;if(i!==a)return i<a?-1:1}}return 0}async function $e(r){let t=[...r.entries()],e=await Promise.all(t.map(([o])=>ir(o))),n=[];return t.forEach(([o,s],i)=>{let a=e[i];if(!a)return;let c=So(s,a);c!==null&&c<0&&n.push({pkg:o,installed:s,latest:a})}),n}function Ce(r){if(r.length===0)return"";let t=`\u26A0 ${r.length} Auro component(s) are NOT on the latest release`,e=Math.max(...r.map(m=>m.pkg.length)),n=Math.max(...r.map(m=>m.installed.length)),o=r.map(m=>` ${P.bold(m.pkg.padEnd(e))} ${P.dim(m.installed.padStart(n))} ${P.dim("\u2192")} ${P.green.bold(m.latest)}`),s=`npm install ${r.map(m=>`${m.pkg}@latest`).join(" ")}`,i=[t.length,...r.map(m=>2+e+2+n+3+m.latest.length)],a=Math.min(Math.max(...i),78),c="\u2500".repeat(a);return["",P.yellow.bold(`\u250C${c}\u2510`),P.yellow.bold(t),P.yellow.bold(`\u2514${c}\u2518`),...o,"",P.dim(" Update all with:"),` ${P.cyan(s)}`,""].join(`
150
- `)}async function Do(r){let t=new Map;for(let i of tt)t.set(i.tag,{...i});let e=await Promise.all(S.map(i=>_(i,{allowNetwork:r}))),n=new Map,o=0,s=0;for(let i of e){if(!i.manifest)continue;o+=1,i.source==="local"&&i.version&&n.set(i.target,i.version);let a=(i.manifest.modules??[]).flatMap(c=>c.declarations??[]).filter(c=>c.customElement&&c.tagName);for(let c of a){let m=c.tagName,p=b(c.summary||c.description),l=t.get(m);t.set(m,{tag:m,pkg:i.target,description:p||l?.description||""}),p&&(s+=1)}}return{rows:rt([...t.values()]),resolved:o,enriched:s,local:n}}async function Oo(r){let t=ot("Checking for newer component releases...").start(),e=await $e(r);if(e.length===0){t.succeed("All installed Auro components are on the latest release.");return}t.stop(),console.error(Ce(e))}async function No(r){let t=!r.offline,e=ot(t?"Resolving component manifests...":"Reading installed component manifests...").start(),{rows:n,resolved:o,enriched:s,local:i}=await Do(t),a=nt(n);if(t?s>0?e.succeed(`Enriched ${s} component description(s); ${i.size} package(s) resolved from local node_modules.`):o>0?e.succeed(`Resolved ${o} component manifest(s); none documented a description, using the built-in table.`):e.warn("No manifests available; using the built-in component table."):i.size>0?e.succeed(s>0?`Read ${i.size} installed component manifest(s) from local node_modules; enriched ${s} description(s).`:`Read ${i.size} installed component manifest(s) from local node_modules; none documented a description, using the built-in table.`):e.warn("No installed component manifests found; using the built-in component table."),r.output){let c=ot(`Writing context to ${r.output}...`).start();try{let m=Ro.resolve(process.cwd(),r.output);await Po.writeFile(m,a,"utf-8"),c.succeed(`Auro context written to ${r.output}`),console.error(`
149
+ ${xo}`}var Mc=nt(Eo);function b(r){return(r??"").replace(/\s+/gu," ").trim()}import P from"chalk";var To=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/u;function lr(r){let t=To.exec(r.trim());return t?{main:[Number(t[1]),Number(t[2]),Number(t[3])],pre:t[4]?t[4].split("."):[]}:null}function So(r,t){let e=lr(r),n=lr(t);if(!e||!n)return null;for(let s=0;s<3;s+=1)if(e.main[s]!==n.main[s])return e.main[s]<n.main[s]?-1:1;if(e.pre.length===0&&n.pre.length===0)return 0;if(e.pre.length===0)return 1;if(n.pre.length===0)return-1;let o=Math.max(e.pre.length,n.pre.length);for(let s=0;s<o;s+=1){let i=e.pre[s],a=n.pre[s];if(i===void 0)return-1;if(a===void 0)return 1;let c=/^\d+$/u.test(i),m=/^\d+$/u.test(a);if(c&&m){let p=Number(i)-Number(a);if(p!==0)return p<0?-1:1}else{if(c!==m)return c?-1:1;if(i!==a)return i<a?-1:1}}return 0}async function $e(r){let t=[...r.entries()],e=await Promise.all(t.map(([o])=>ir(o))),n=[];return t.forEach(([o,s],i)=>{let a=e[i];if(!a)return;let c=So(s,a);c!==null&&c<0&&n.push({pkg:o,installed:s,latest:a})}),n}function Ce(r){if(r.length===0)return"";let t=`\u26A0 ${r.length} Auro component(s) are NOT on the latest release`,e=Math.max(...r.map(m=>m.pkg.length)),n=Math.max(...r.map(m=>m.installed.length)),o=r.map(m=>` ${P.bold(m.pkg.padEnd(e))} ${P.dim(m.installed.padStart(n))} ${P.dim("\u2192")} ${P.green.bold(m.latest)}`),s=`npm install ${r.map(m=>`${m.pkg}@latest`).join(" ")}`,i=[t.length+1,...r.map(m=>2+e+2+n+3+m.latest.length)],a=Math.min(Math.max(...i),78),c="\u2500".repeat(a);return["",P.yellow.bold(`\u250C${c}\u2510`),P.yellow.bold(t),P.yellow.bold(`\u2514${c}\u2518`),...o,"",P.dim(" Update all with:"),` ${P.cyan(s)}`,""].join(`
150
+ `)}async function Do(r){let t=new Map;for(let i of tt)t.set(i.tag,{...i});let e=await Promise.all(S.map(i=>_(i,{allowNetwork:r}))),n=new Map,o=0,s=0;for(let i of e){if(!i.manifest)continue;o+=1,i.source==="local"&&i.version&&n.set(i.target,i.version);let a=(i.manifest.modules??[]).flatMap(c=>c.declarations??[]).filter(c=>c.customElement&&c.tagName);for(let c of a){let m=c.tagName,p=b(c.summary||c.description),l=t.get(m);t.set(m,{tag:m,pkg:i.target,description:p||l?.description||""}),p&&(s+=1)}}return{rows:rt([...t.values()]),resolved:o,enriched:s,local:n}}async function Oo(r){let t=ot("Checking for newer component releases...").start(),e=await $e(r);if(e.length===0){t.succeed("All installed Auro components are on the latest release.");return}t.stop(),console.error(Ce(e))}async function No(r){let t=!r.offline,e=ot(t?"Resolving component manifests...":"Reading installed component manifests...").start(),{rows:n,resolved:o,enriched:s,local:i}=await Do(t),a=nt(n);if(t?s>0?e.succeed(i.size>0?`Enriched ${s} component description(s); ${i.size} package(s) resolved from local node_modules.`:`Enriched ${s} component description(s) from unpkg.`):o>0?e.succeed(`Resolved ${o} component manifest(s); none documented a description, using the built-in table.`):e.warn("No manifests available; using the built-in component table."):i.size>0?e.succeed(s>0?`Read ${i.size} installed component manifest(s) from local node_modules; enriched ${s} description(s).`:`Read ${i.size} installed component manifest(s) from local node_modules; none documented a description, using the built-in table.`):e.warn("No installed component manifests found; using the built-in component table."),r.output){let c=ot(`Writing context to ${r.output}...`).start();try{let m=Ro.resolve(process.cwd(),r.output);await Po.writeFile(m,a,"utf-8"),c.succeed(`Auro context written to ${r.output}`),console.error(`
151
151
  Paste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prime it on Auro components.`)}catch(m){let p=m instanceof Error?m.message:String(m);c.fail(`Failed to write context: ${p}`),process.exit(1)}}else process.stdout.write(a);t&&i.size>0&&await Oo(i)}var Yc=Io.command("context").description("Generate an AI assistant context document for the Auro Design System").option("-o, --output <path>","Write context to a file instead of stdout (e.g. AURO_CONTEXT.md)").option("--offline","Skip network fetches; use locally installed manifests and the built-in table",!1).action(No);import ve from"node:process";import{Logger as jo}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import{program as _o}from"commander";import fr from"ora";var ur="@aurodesignsystem";function pr(r){let t=r.trim();if(t.startsWith("@"))return t;let e=t.toLowerCase();return e.startsWith("auro-")?`${ur}/${e}`:`${ur}/auro-${e}`}function Mo(r){return r.replace(/-([a-z])/gu,(t,e)=>e.toUpperCase())}function mr(r){return r?typeof r=="string"?` [deprecated: ${b(r)}]`:" [deprecated]":""}function F(r){if(r.length===0)return" (none)";let t=Math.max(...r.map(([e])=>(e??"").length));return r.map(([e,n])=>` ${(e??"").padEnd(t)} ${n??""}`.trimEnd()).join(`
152
152
  `)}function dr(r,t){let e=[];e.push(`${t.tagName} (${r})`);let n=t.summary||t.description;n&&e.push(b(n));let o=t.superclass?.name?`${t.name} extends ${t.superclass.name}`:t.name;e.push(`Class: ${o}`),e.push(""),e.push("Install:"),e.push(` npm i ${r}`),e.push(` import "${r}";`);let s=t.attributes??[];e.push(""),e.push(`Attributes (${s.length}):`),e.push(F(s.map(u=>{let d=u.type?.text?` {${b(u.type.text)}}`:"",f=u.default?` = ${b(u.default)}`:"";return[u.name,`${b(u.description)}${d}${f}${mr(u.deprecated)}`.trim()]})));let i=new Set(s.flatMap(u=>u.fieldName?[u.fieldName]:[u.name,Mo(u.name)])),a=(t.members??[]).filter(u=>u.name&&(u.privacy===void 0||u.privacy==="public")&&!u.static&&!(u.kind==="field"&&i.has(u.name)));e.push(""),e.push(`Properties & Methods (${a.length}):`),e.push(F(a.map(u=>{let d=u.kind==="method",f=d?`${u.name}()`:u.name,g=d?u.return?.type?.text:u.type?.text,k=g?` {${b(g)}}`:"",O=!d&&u.default?` = ${b(u.default)}`:"";return[f,`${b(u.description)}${k}${O}${mr(u.deprecated)}`.trim()]})));let c=t.slots??[];e.push(""),e.push(`Slots (${c.length}):`),e.push(F(c.map(u=>[u.name||"(default)",b(u.description)])));let m=t.events??[];e.push(""),e.push(`Events (${m.length}):`),e.push(F(m.map(u=>{let d=u.type?.text?` {${b(u.type.text)}}`:"";return[u.name,`${b(u.description)}${d}`.trim()]})));let p=t.cssParts??[];p.length>0&&(e.push(""),e.push(`CSS Parts (${p.length}):`),e.push(F(p.map(u=>[u.name,b(u.description)]))));let l=t.cssProperties??[];return l.length>0&&(e.push(""),e.push(`CSS Custom Properties (${l.length}):`),e.push(F(l.map(u=>[u.name,b(u.description)])))),e.join(`
153
153
  `)}async function Fo(r,t){let e=pr(r),n=t.tag?`${e}@${t.tag}`:e,o=fr(`Fetching ${n}...`).start(),s=await _(n);s.manifest||(o.fail(s.transient?`Failed to fetch ${n}: ${s.reason}.`:`No custom-elements.json published for ${n}. It may not exist or may not publish a manifest yet.`),ve.exit(1));let a=(s.manifest.modules??[]).flatMap(p=>p.declarations??[]).filter(p=>p.customElement&&p.tagName);a.length===0&&(o.fail(`No registered custom elements found for ${n}.`),ve.exit(1));let c=s.source==="local"?` (local${s.version?` v${s.version}`:""})`:" (unpkg)";o.succeed(`${n} \u2014 ${a.length} custom element${a.length===1?"":"s"}${c}`);let m=null;if(s.source==="local"&&s.version){let p=fr("Checking for a newer release...").start(),l=await $e(new Map([[e,s.version]]));p.stop(),l.length>0&&(m=Ce(l))}if(t.json){ve.stdout.write(`${JSON.stringify(a,null,2)}