@aurodesignsystem-dev/auro-cli 0.0.0-pr296.0 → 0.0.0-pr296.2

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{program as qe}from"commander";import zt from"figlet";import{mind as qt}from"gradient-string";var Ve=()=>qt(zt.textSync("Auro CLI"));import Je from"node:fs";import Ke from"node:path";import{fileURLToPath as Vt}from"node:url";function Y(r){process.env.DEBUG&&console.log(`[DEBUG] ${r}`)}function ye(){try{let r=Vt(import.meta.url),t=Ke.dirname(r);Y(`Current module path: ${t}`);let e=Ke.resolve(t,"..","package.json");return Y(`Checking package.json at: ${e}`),Je.existsSync(e)?(Y(`Found package.json at: ${e}`),JSON.parse(Je.readFileSync(e,"utf8")).version):(Y("Could not find package.json in the standard installed module location, using default version"),"0.0.0")}catch(r){return console.error("Error retrieving package version:",r),"0.0.0"}}import{program as zr}from"commander";import kt from"ora";function X(r){return r.option("-m, --module-paths [paths...]","Path(s) to node_modules folder").option("-w, --watch","Watches for changes").option("--skip-docs","Skip documentation generation",!1).option("-r, --readme-template <url>","URL to the README template file").option("--wca-input [files...]","Source file(s) to analyze for API documentation").option("--wca-output [files...]","Output file(s) for API documentation")}function Z(r){return r.option("-s, --serve","Starts a server").option("-p, --port <number>","Port for the server").option("-o, --open","Open the browser after starting the server")}import Lr from"@rollup/plugin-terser";import{watch as Hr}from"rollup";import{existsSync as dt,readFileSync as xr,rmSync as Dr,writeFileSync as Pr}from"node:fs";import{basename as Or,dirname as Nr,join as L,resolve as ae}from"node:path";import{pathToFileURL as pt}from"node:url";import{glob as jr}from"glob";import Re from"ora";import{rollup as Ie}from"rollup";import*as ft from"sass";import B from"ora";import{spawn as Jt}from"node:child_process";import Kt from"ora";var E=(r,t)=>{let e=`${r} ${t?t.join(" "):""}`,o=Kt(),n=r,s=t||[];if(!t&&typeof r=="string"){let m=r.split(" ");n=m[0],s=m.slice(1)}let i=e.includes("--watch")||e.includes(" -w"),l=Jt(n,s,{stdio:i?"inherit":["inherit","pipe","pipe"],shell:!0});if(!i){let m=[];l.stdout?.on("data",u=>{let c=u.toString();m.push(c),process.stdout.write(c)}),l.stderr?.on("data",u=>{let c=u.toString();m.push(c),process.stderr.write(c)})}return new Promise((m,u)=>{l.on("close",c=>{c!==0?i?(o.info(`Watch mode terminated with code ${c}`),m()):(o.fail(`${e} failed (code ${c})`),u(new Error(`Command failed with exit code ${c}`))):(o.succeed(`${e} completed successfully`),m())})})};import Q from"node:fs";import Yt from"node:path";import{markdownTable as Ye}from"markdown-table";var N=class r{static{this.manifest={schemaVersion:"1.0.0",readme:"",modules:[]}}static generate(t={}){let{outDir:e="./docs",outFile:o="api.md",manifestPath:n="./custom-elements.json"}=t,{getElements:s,renderAllElements:i}=r;if(n)try{let c=Q.readFileSync(n,"utf8");r.manifest=JSON.parse(c)}catch(c){throw console.error(`Error reading manifest file at ${n}:`,c),c}let a=s(),l=e;Q.existsSync(l)||Q.mkdirSync(l,{recursive:!0});let m=i(a),u=Yt.join(l,o);Q.writeFileSync(u,m),console.log(`Generated combined API documentation at ${u}`)}static getElements(){let t=r.manifest.modules.filter(r.isWcaModule);return r.manifest.modules.reduce((e,o)=>e.concat(o.declarations?.filter(n=>"customElement"in n&&n.customElement===!0&&"tagName"in n&&(t.length>0?r.isWcaModule(o):!0))??[]),[])}static isWcaModule(t){let{path:e}=t;return e?e.startsWith("scripts/wca/auro-")&&e.endsWith(".js"):!1}static renderAllElements(t){return`${t.sort((e,o)=>(e.tagName||"").localeCompare(o.tagName||"")).map(e=>r.renderElement(e,!0)).join(`
2
+ import{program as ze}from"commander";import qt from"figlet";import{mind as zt}from"gradient-string";var Ve=()=>zt(qt.textSync("Auro CLI"));import Je from"node:fs";import Ke from"node:path";import{fileURLToPath as Vt}from"node:url";function Y(r){process.env.DEBUG&&console.log(`[DEBUG] ${r}`)}function ye(){try{let r=Vt(import.meta.url),t=Ke.dirname(r);Y(`Current module path: ${t}`);let e=Ke.resolve(t,"..","package.json");return Y(`Checking package.json at: ${e}`),Je.existsSync(e)?(Y(`Found package.json at: ${e}`),JSON.parse(Je.readFileSync(e,"utf8")).version):(Y("Could not find package.json in the standard installed module location, using default version"),"0.0.0")}catch(r){return console.error("Error retrieving package version:",r),"0.0.0"}}import{program as qr}from"commander";import kt from"ora";function X(r){return r.option("-m, --module-paths [paths...]","Path(s) to node_modules folder").option("-w, --watch","Watches for changes").option("--skip-docs","Skip documentation generation",!1).option("-r, --readme-template <url>","URL to the README template file").option("--wca-input [files...]","Source file(s) to analyze for API documentation").option("--wca-output [files...]","Output file(s) for API documentation")}function Z(r){return r.option("-s, --serve","Starts a server").option("-p, --port <number>","Port for the server").option("-o, --open","Open the browser after starting the server")}import Lr from"@rollup/plugin-terser";import{watch as Hr}from"rollup";import{existsSync as dt,readFileSync as xr,rmSync as Dr,writeFileSync as Pr}from"node:fs";import{basename as Or,dirname as Nr,join as L,resolve as ae}from"node:path";import{pathToFileURL as pt}from"node:url";import{glob as jr}from"glob";import Re from"ora";import{rollup as Ie}from"rollup";import*as ft from"sass";import B from"ora";import{spawn as Jt}from"node:child_process";import Kt from"ora";var E=(r,t)=>{let e=`${r} ${t?t.join(" "):""}`,o=Kt(),n=r,s=t||[];if(!t&&typeof r=="string"){let m=r.split(" ");n=m[0],s=m.slice(1)}let i=e.includes("--watch")||e.includes(" -w"),l=Jt(n,s,{stdio:i?"inherit":["inherit","pipe","pipe"],shell:!0});if(!i){let m=[];l.stdout?.on("data",u=>{let c=u.toString();m.push(c),process.stdout.write(c)}),l.stderr?.on("data",u=>{let c=u.toString();m.push(c),process.stderr.write(c)})}return new Promise((m,u)=>{l.on("close",c=>{c!==0?i?(o.info(`Watch mode terminated with code ${c}`),m()):(o.fail(`${e} failed (code ${c})`),u(new Error(`Command failed with exit code ${c}`))):(o.succeed(`${e} completed successfully`),m())})})};import Q from"node:fs";import Yt from"node:path";import{markdownTable as Ye}from"markdown-table";var N=class r{static{this.manifest={schemaVersion:"1.0.0",readme:"",modules:[]}}static generate(t={}){let{outDir:e="./docs",outFile:o="api.md",manifestPath:n="./custom-elements.json"}=t,{getElements:s,renderAllElements:i}=r;if(n)try{let c=Q.readFileSync(n,"utf8");r.manifest=JSON.parse(c)}catch(c){throw console.error(`Error reading manifest file at ${n}:`,c),c}let a=s(),l=e;Q.existsSync(l)||Q.mkdirSync(l,{recursive:!0});let m=i(a),u=Yt.join(l,o);Q.writeFileSync(u,m),console.log(`Generated combined API documentation at ${u}`)}static getElements(){let t=r.manifest.modules.filter(r.isWcaModule);return r.manifest.modules.reduce((e,o)=>e.concat(o.declarations?.filter(n=>"customElement"in n&&n.customElement===!0&&"tagName"in n&&(t.length>0?r.isWcaModule(o):!0))??[]),[])}static isWcaModule(t){let{path:e}=t;return e?e.startsWith("scripts/wca/auro-")&&e.endsWith(".js"):!1}static renderAllElements(t){return`${t.sort((e,o)=>(e.tagName||"").localeCompare(o.tagName||"")).map(e=>r.renderElement(e,!0)).join(`
3
3
 
4
4
  `)}`}static renderElement(t,e=!0){let o=[],{renderTable:n,renderPropertiesAttributesTable:s,renderParameters:i,getType:a}=r;o.push(e?`# ${t.tagName}`:""),t.description&&o.push(t.description);let l=s(t);l&&o.push(l.trim());let m=n("Methods",["name","parameters","return","description"],(t.members||[]).filter(p=>p.kind==="method"&&("privacy"in p?p.privacy!=="private":!0)&&p.name[0]!=="_").map(p=>({...p,parameters:i("parameters"in p?p.parameters:void 0),return:"return"in p&&p.return?a(p.return):""})));m&&o.push(m.trim());let u=n("Events",["name","description"],t.events);u&&o.push(u.trim());let c=n("Slots",[["name","(default)"],"description"],t.slots);c&&o.push(c.trim());let d=n("CSS Shadow Parts",["name","description"],t.cssParts);d&&o.push(d.trim());let f=n("CSS Custom Properties",["name","description"],t.cssProperties);return f&&o.push(f.trim()),o.join(`
5
5
 
@@ -22,7 +22,7 @@ ${O.trimEnd()}
22
22
  `)+g});let u=o.split(`
23
23
  `),c=!1;for(let d=0;d<u.length;d++)/<pre[\s>]/i.test(u[d])&&(c=!0),c||(u[d]=u[d].replace(/^[ \t]+(?=<)/,"")),/<\/pre>/i.test(u[d])&&(c=!1);await T.promises.writeFile(r,u.join(`
24
24
  `))}async function _(r={}){let t=r.readmeTemplate,e=t&&!t.startsWith("http");await ur({...rt,...e?{localReadmePath:C.resolve(process.cwd(),t)}:{remoteReadmeUrl:t||"https://raw.githubusercontent.com/AlaskaAirlines/auro-templates/main/templates/default/README.md"}},r.skipReadme)}function tt(r){return T.existsSync(v(r))}import{existsSync as ot,readFileSync as dr}from"node:fs";import{builtinModules as pr}from"node:module";import{resolve as re}from"node:path";import{startDevServer as fr}from"@web/dev-server";import{hmrPlugin as gr}from"@web/dev-server-hmr";import*as nt from"esbuild";import hr from"ora";var S=["node_modules","../node_modules","../../node_modules","../../../node_modules"];var yr=/^\/__wds-outside-root__\/(\d+)\/(.+)$/;function wr(){return{name:"node-modules-css",serve(r){if(!r.path.endsWith(".css")||!r.path.startsWith("/@")&&!/^\/[a-z]/i.test(r.path))return;let t=r.path.slice(1),e=process.cwd();for(let o of S){let n=re(e,o,t);if(ot(n))return{body:dr(n,"utf-8"),type:"css"}}}}}function br(r,t){let e=r.match(yr);return e?re(t,"../".repeat(Number.parseInt(e[1],10)),e[2]):re(t,`.${r}`)}function kr(){let r=/\b(require\s*\(|module\.exports\b|exports\.\w)/,t=new Map,e;return{name:"cjs-to-esm",async serverStart({config:o}){e=re(o.rootDir)},async transform(o){if(!o.path.includes("node_modules")||!o.path.endsWith(".js")&&!o.path.endsWith(".cjs")||typeof o.body!="string"||!r.test(o.body))return;let n=br(o.path,e);if(t.has(n))return t.get(n);if(ot(n))try{let i={body:(await nt.build({entryPoints:[n],bundle:!0,format:"esm",platform:"browser",write:!1,logLevel:"silent",external:pr})).outputFiles[0].text};return t.set(n,i),i}catch(s){console.error(`CJS-to-ESM bundling failed for ${o.path}:`,s.message)}}}}var M={watch:!0,nodeResolve:!0,basePath:"/",rootDir:"./demo",hmrInclude:["src/**/*","demo/**/*","apiExamples/**/*","docs/**/*"]};async function oe(r={}){if(!r.serve)return;let t=hr(`Firing up dev server...
25
- `).start();try{let e={port:Number(r.port)||void 0,open:r.open?"/":void 0,watch:r.watch??M.watch,nodeResolve:r.nodeResolve??M.nodeResolve,basePath:r.basePath??M.basePath,rootDir:r.rootDir??M.rootDir,middleware:[function(s,i){return!s.url.endsWith("/")&&!s.url.includes(".")&&(s.url+=".html"),i()}],plugins:[wr(),kr(),gr({include:r.hmrInclude??M.hmrInclude})]},o=await fr({config:e,readCliArgs:!1,readFileConfig:!1});return t.stop(),o}catch(e){throw t.fail("Server snag! Couldn't start dev server."),console.error("Error starting development server:",e),new Error(`Development server failed to start: ${e.message}`)}}async function ne(){let r=B("Generating Custom Elements Manifest...").start();try{await E(`npx --package=@custom-elements-manifest/analyzer -y -- cem analyze --config '${Xe("custom-elements-manifest.config.mjs")}'`),r.succeed("Custom Elements Manifest generated successfully!")}catch(t){let e=t instanceof Error?t.message:String(t);r.warn("CEM analyzer completed with warnings: "+e)}}async function se(){let r=B("Generating API md file...").start();try{await N.generate(),r.succeed("API md file generated successfully!")}catch(t){let e=t instanceof Error?t.message:String(t);throw r.fail("Failed to generate API md file: "+e),t}}async function st(r={}){let t=B("Compiling documentation...").start();try{await _(r),t.succeed("Documentation compiled successfully!")}catch(e){let o=e instanceof Error?e.message:String(e);throw t.fail("Failed to compile MD documentation: "+o),e}j(),await I(),await Te(r)}async function it(r={}){await oe(r)}async function at(r={}){let t=await import("chokidar"),e=["./src/**/*","./docs/**/*","./docTemplates/**/*","./apiExamples/**/*","./demo/**/*.scss"],o=["**/demo/*.min.js","**/demo/*.min.css","**/demo/*.md","**/demo/readme.md","**/docs/api.md","**/custom-elements.json","**/node_modules/**","**/dist/**","**/.git/**"],n=t.watch(e,{ignoreInitial:!0,ignored:o,awaitWriteFinish:{stabilityThreshold:1e3,pollInterval:100}}),s=B("Waiting for changes...");s.spinner="bouncingBar",s.color="green",s.start();let i=null,a=!1,l=!1;async function m(u){if(a){l=!0;return}a=!0,n.unwatch(e);let c=B(`Change detected: ${u}`).start();try{await _(r),j(),await I(),await Te(r),c.succeed("Docs rebuilt!")}catch(d){let f=d instanceof Error?d.message:String(d);c.fail("Rebuild failed: "+f)}finally{setTimeout(()=>{n.add(e),a=!1,l&&(l=!1,m("queued changes"))},1e3)}}n.on("all",(u,c)=>{a||(i&&clearTimeout(i),i=setTimeout(()=>{m(c)},1e3))}),F(n),te()}async function ie(){await ne(),await se()}import{basename as Er,join as lt,resolve as $r}from"node:path";import Tr from"@rollup/plugin-commonjs";import{nodeResolve as Cr}from"@rollup/plugin-node-resolve";import{glob as Sr}from"glob";import{litScss as Ir}from"rollup-plugin-scss-lit";import Ar from"node:path";import{glob as vr}from"glob";function ct(r){return{name:"watch-globs",buildStart(){let t=Array.isArray(r)?r:[r];for(let e of t)try{for(let o of vr.sync(Ar.resolve(e)))this.addWatchFile(o)}catch(o){this.error(`Error watching glob pattern "${e}": ${o.message}`)}}}}var Ce={moduleDirectories:["node_modules"],modulePaths:["../../node_modules","../node_modules","node_modules"],watchPatterns:["./apiExamples/**/*","./docs/**/*"]};function ut(r=[],t={}){let{watchPatterns:e=Ce.watchPatterns,dedupe:o=["lit","lit-element","lit-html"],dev:n=!1}=t,s=[...Ce.modulePaths,...r],i=process.cwd(),a=S.map(l=>$r(i,l));return[Cr({dedupe:o,preferBuiltins:!1,moduleDirectories:Ce.moduleDirectories,modulePaths:a}),Tr(),Ir({minify:n?!1:{fast:!0},options:{loadPaths:[...s,lt(process.cwd(),"src","styles"),lt(process.cwd(),"src")]}}),ct(e)]}function Se(r={}){let{modulePaths:t=[],watch:e=!1,input:o=["./src/index.js","./src/registered.js"],outputDir:n="./dist",format:s="esm",dev:i=!1}=r;return{name:"Main",config:{input:o,output:{format:s,dir:n,entryFileNames:a=>i||["index","registered"].includes(a.name)?"[name].js":"[name]-[hash].js",chunkFileNames:i?"[name].js":"[name]-[hash].js",assetFileNames:i?"[name][extname]":"[name]-[hash][extname]"},external:Rr(),plugins:ut(t,{dev:i}),watch:mt(e)}}}function G(r={}){let{modulePaths:t=[],watch:e=!1,globPattern:o="./demo/*.js",ignorePattern:n=["./demo/*.min.js"],outputDir:s="./demo",dev:i=!1}=r,a=Sr.sync(o,{ignore:n}),l=ut(t,{dev:i}),m=mt(e);return{name:"Demo",configs:a.map(c=>({input:{[Er(c,".js")]:c},output:{format:"esm",dir:s,entryFileNames:"[name].min.js",chunkFileNames:"[name].min.js",assetFileNames:i?"[name][extname]":"[name]-[hash][extname]",inlineDynamicImports:!0},plugins:l,onwarn(f,p){if(f.code==="UNRESOLVED_IMPORT")throw new Error(`Unresolved import "${f.exporter??f.source}" in ${f.id??c}. Make sure workspace dependencies are built before bundling demos.`);p(f)},watch:m}))}}function mt(r){if(!r)return!1;let t=typeof r=="object"?r:{};return{clearScreen:t.clearScreen??!0,buildDelay:t.buildDelay??500,chokidar:{ignoreInitial:!0,ignored:t.ignored??["**/dist/**/*.d.ts","**/custom-elements.json","**/demo/*.md","**/demo/**/*.min.js","**/demo/**/*.min.css","**/docs/api.md","**/node_modules/**","**/.git/**"],awaitWriteFinish:t.awaitWriteFinish??{stabilityThreshold:1e3,pollInterval:100}},include:t.include??["./src/**/*.scss","./src/**/*.js","./src/**/*.ts","./demo/**/*.js","./apiExamples/**/*","./docs/**/*.md"],exclude:t.exclude??["./dist/**/*","./node_modules/**/*"]}}function Rr(r=[]){return[...[/node_modules\/lit/,/node_modules\/lit-element/,/node_modules\/lit-html/,/node_modules\/@lit/],...r]}function gt(){let r=L("./dist"),t=Re("Cleaning dist folder...").start();try{return Dr(r,{recursive:!0,force:!0}),t.succeed("All clean! Dist folder wiped."),!0}catch(e){return t.fail(`Oops! Couldn't clean dist/ folder: ${e.message}`),console.error(e),!1}}async function ce(r,t,e,o){let n=Re(r).start();try{let s=await t();return n.succeed(e),s}catch(s){throw n.fail(o),console.error(`Error: ${s.message}`),s}}async function ht(r,t){return ce(`Bundling ${r.name||"main"} and demo...`,async()=>{let e=await Ie(r);await e.write(r.output),await e.close();for(let o of t){let n=await Ie(o);await n.write(o.output),await n.close()}},`Bundles ready! ${r.name||"Main"} and demo built.`,"Bundle hiccup! Build failed.")}async function le(r){let{wcaInput:t,wcaOutput:e,skipDocs:o}=r;if(o){let n=Re("Skipping docs generation...").start();setTimeout(()=>{n.succeed("Docs generation skipped.")},0);return}return ce("Analyzing components and making docs...",async()=>{await ie(t,e),await _(r),j()},"Docs ready! Looking good.","Doc troubles!")}function Fr(){let r=process.cwd();function t(n){return[n,`${n}.scss`,`${n}.css`,L(Nr(n),`_${Or(n)}.scss`),L(n,"_index.scss"),L(n,"index.scss")].find(i=>dt(i))}function e(n){for(let i of S){let a=t(ae(r,i,n));if(a)return a}let s=o(n);return s||null}function o(n){let s,i;if(n.startsWith("@")){let a=n.split("/");if(a.length<3)return null;s=`${a[0]}/${a[1]}`,i=`./${a.slice(2).join("/")}`}else{let a=n.indexOf("/");if(a===-1)return null;s=n.slice(0,a),i=`./${n.slice(a+1)}`}for(let a of S){let l=ae(r,a,s,"package.json");if(dt(l))try{let u=JSON.parse(xr(l,"utf-8")).exports;if(!u||typeof u!="object")continue;let c=u[i];if(!c)continue;let d=typeof c=="string"?c:c.default||c.import;if(!d)continue;let f=t(ae(r,a,s,d));if(f)return f}catch{continue}}return null}return{findFileUrl(n){if(n.includes("/node_modules/")){let s=n.lastIndexOf("/node_modules/"),i=n.slice(s+14),a=e(i);if(a)return pt(a)}if(!n.startsWith(".")&&!n.startsWith("/")&&!n.startsWith("file:")){let s=e(n);if(s)return pt(s)}return null}}}async function I(r="./demo"){return ce("Compiling demo SCSS...",async()=>{let t=jr.sync(L(r,"**/*.scss")),e=Fr(),o=process.cwd(),n=S.map(s=>ae(o,s));for(let s of t){let i=ft.compile(s,{importers:[e],loadPaths:n,silenceDeprecations:["import"],style:"compressed"}),a=s.replace(/\.scss$/,".min.css");Pr(a,i.css)}return t.length},"Demo SCSS compiled.","SCSS compilation failed.")}async function Te(r={}){let{configs:t}=G(r);return ce("Bundling demo JS...",async()=>{for(let e of t){let o=await Ie(e);await o.write(e.output),await o.close()}},"Demo JS bundled.","Demo JS bundling failed.")}import yt from"node:path";import x from"ora";import"rollup";var H=!1,_r={analyze:{active:!1,lastTime:0},docs:{active:!1,lastTime:0},scss:{active:!1,lastTime:0}},Mr=5e3,ue=new Set,Br=["/dist/index.d.ts","/custom-elements.json","/demo/api.md","/docs/api.md","/demo/index.min.js"];function Gr(r){if(!r||typeof r!="string")return!1;try{let t=yt.normalize(r);return Br.some(e=>t.endsWith(e))||t.includes("/dist/")||t.endsWith(".min.js")||t.endsWith(".min.css")||t.endsWith(".d.ts")}catch(t){return console.error(`Error checking path (${typeof r}):`,t.message),!1}}async function xe(r,t){let e=_r[r];if(e.active||Date.now()-e.lastTime<Mr)return!1;try{return e.active=!0,e.lastTime=Date.now(),await t()}catch(o){return console.error(`Error in ${r} task:`,o),!1}finally{e.active=!1}}async function wt(r,t,e){let o=!0,n={analyze:!1,docs:!1,scss:!1},s=null,i,a=x("Activating watch mode...").start(),l={analyze:async()=>{let{wcaInput:c,wcaOutput:d,skipDocs:f}=t;if(f){let g=x("Skipping component analysis...").start();return setTimeout(()=>{g.succeed("Component analysis skipped.")},0),!0}let p=x("Detective work: analyzing components...").start();try{return await ie(c,d),p.succeed("Component analysis complete! API generated."),!0}catch(g){return p.fail("Analysis hiccup! Something went wrong."),console.error("Component analysis error:",g),!1}},docs:async()=>{if(H)return!1;if(t.skipDocs){let d=x("Skipping docs generation...").start();return setTimeout(()=>{d.succeed("Docs generation skipped.")},0),!0}let c=x("Refreshing docs...").start();try{return await le(t),c.succeed("Documentation refreshed!"),!0}catch(d){c.fail("Docs stumble! Couldn't refresh."),console.error("Documentation rebuild error:",d)}},scss:async()=>{if(H)return!1;try{return await I(),!0}catch(c){return console.error("Demo SCSS compilation error:",c),!1}}},m=()=>{o&&n.analyze&&n.docs&&n.scss&&typeof e=="function"&&(o=!1,e())};function u(c=1e3){s&&clearTimeout(s),s=setTimeout(async()=>{setTimeout(async()=>{n.analyze=await xe("analyze",l.analyze),setTimeout(async()=>{n.docs=await xe("docs",l.docs),setTimeout(async()=>{n.scss=await xe("scss",l.scss),m()},500)},1e3)},1e3)},c)}r.on("event",async c=>{switch(c.code){case"START":a.succeed("Watch mode active! Eyes peeled.");break;case"BUNDLE_START":if(ue.clear(),c.input)try{let d=Array.isArray(c.input)?c.input:typeof c.input=="string"?[c.input]:typeof c.input=="object"&&c.input!==null?Object.values(c.input):[];for(let f of d)typeof f=="string"&&!Gr(f)&&ue.add(yt.normalize(f))}catch(d){console.error("Error processing input paths:",d)}i=x("Weaving bundles...").start(),H=!0;break;case"BUNDLE_END":i&&i.succeed(`Bundle ${Array.isArray(c.input)?`of ${c.input.join("& ")} `:""}done in ${c.duration}ms! \u{1F680}`),H=!1,ue.size>0&&u();break;case"END":break;case"ERROR":H=!1,i?i.fail(`Oops! Bundle hit a snag: ${c.error.message}`):x().fail(`Watch mode hiccup: ${c.error.message}`),ue.clear();break}})}function bt(r,t){return F(r),t&&F(t),te(),r}async function Ur(r){let t=Se(r),e=G(r);r.dev||t.config.plugins.push(Lr()),await le(r),await I(),await ht(t.config,e.configs)}async function Wr(r){let{dev:t}=r,e=Se({...r,watch:!0}),o=G({...r,watch:!0}),n=Hr([e.config,...o.configs]);wt(n,r,t?async()=>oe(r):void 0);let s=await import("chokidar"),i=!1,a=!1,l=null,m=s.watch("./demo/**/*.scss",{ignoreInitial:!0,ignored:["**/demo/**/*.min.css"],awaitWriteFinish:{stabilityThreshold:500,pollInterval:100}});return m.on("all",()=>{l&&clearTimeout(l),l=setTimeout(async()=>{if(i){a=!0;return}i=!0;try{await I()}catch(u){console.error("Demo SCSS watch compilation error:",u)}finally{i=!1,a&&(a=!1,m.emit("all"))}},500)}),bt(n,m),n}async function me(r={}){try{let{watch:t}=r;return gt(),t?await Wr(r):await Ur(r)}catch(t){throw new Error(`Build failed: ${t.message}`)}}var U=zr.command("dev").description("Runs development server for auro components");U=X(U);U=Z(U);var Gs=U.action(async r=>{try{let t=kt("Initializing...");r.watch?(t.text="Waiting for changes...",t.spinner="bouncingBar",t.color="green"):t.text=r.docs===!1?"Building component (docs disabled)":"Building component",t.start(),r.watch||t.succeed("Build completed!"),await me({...r,dev:!0,watch:r.watch})}catch(t){kt().fail(`Build failed: ${t.message}`),console.error(t),process.exit(1)}});import{program as qr}from"commander";import At from"ora";var De=qr.command("build").description("Builds auro components");De=X(De);var qs=De.action(async r=>{try{let t=At("Initializing...");r.watch?(t.text="Waiting for changes...",t.spinner="bouncingBar",t.color="green"):t.text=r.docs===!1?"Building component (docs disabled)":"Building component",t.start(),await me(r),r.watch||t.succeed("Build completed!")}catch(t){At().fail(`Build failed: ${t.message}`),console.error(t),process.exit(1)}});import{exec as Vr}from"node:child_process";import vt from"node:path";import Jr from"node:process";import{fileURLToPath as Kr}from"node:url";import Yr from"node:util";import{program as Xr}from"commander";import Zr from"inquirer";var ri=Xr.command("migrate").description("Script runner to perform repetitive code change tasks").requiredOption("-i, --id <string>","Select the migration you would like to run by id").option("-m, --multi-gitter","Run the migration on all repositories in the multi-gitter config").action(async r=>{let t=Kr(import.meta.url),e=vt.dirname(t),o=vt.resolve(e,"migrations",r.id);if(r.multiGitter){let n=Yr.promisify(Vr);try{await n("command -v multi-gitter")}catch{console.error("multi-gitter is not installed."),Jr.exit(1)}(await Zr.prompt([{type:"confirm",name:"dryRun",message:"Run migration in dry-run mode? (no changes will be committed)",default:!0}])).dryRun?E(`multi-gitter run ${o}/script.sh --config "${o}/multi-gitter.yml" --dry-run`):E(`multi-gitter run ${o}/script.sh --config "${o}/multi-gitter.yml"`)}else E(`${o}/script.sh`)});import St from"node:process";import{program as oo}from"commander";import{readFile as no,writeFile as so}from"node:fs/promises";import{Logger as W}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import Pe from"node:fs/promises";import Oe from"node:path";import{Octokit as Qr}from"@octokit/rest";import $ from"ora";import{processContentForFile as eo,templateFiller as to}from"@aurodesignsystem/auro-library/scripts/utils/sharedFileProcessorUtils.mjs";async function Et(r,t){let e=new Qr({auth:process.env.GITHUB_TOKEN||""});try{let n=(await e.request("GET /repos/{owner}/{repo}/contents/{path}",{ref:t,owner:"AlaskaAirlines",repo:"auro-templates",path:r,headers:{"X-GitHub-Api-Version":"2022-11-28"}})).data;if(typeof n!="object"||!Array.isArray(n)){let s=`Unexpected response format: ${JSON.stringify(n)}`;throw $().start().fail(s),new Error("Failed to retrieve folder items")}return n}catch(o){let n=$().start();throw o.status===404?n.fail(`Template '${r.split("/")[1]}' not found`):n.fail(`Error accessing template: ${o.message}`),o}}async function $t({folderItems:r,templatePathToReplace:t,rootDir:e,ref:o}){let n=[];for(let s of r){if(s.type=="dir"){let m=$(`Processing directory: ${s.path}`).start(),u=await Et(s.path,o);m.succeed(`Found ${u.length} additional items in ${s.path}`);let c=await $t({folderItems:u,templatePathToReplace:t,rootDir:e,ref:o});n.push(...c);continue}let i=s.path.replace(`${t}/`,""),a=`${e}/.github/${i}`,l={identifier:s.name,input:{remoteUrl:s.download_url||"",fileName:a,overwrite:!0},output:a};n.push(l)}return n}async function ro(r){try{await Pe.rm(r,{recursive:!0,force:!0}),$().start().succeed(`Successfully removed directory: ${r}`)}catch(t){throw $().start().fail(`Error removing directory ${r}: ${t.message}`),t}}async function Tt(r,t="",e=!0){try{let o=await Pe.stat(r),n=Oe.basename(r);if(!o.isDirectory())return`${t}${e?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 "}${n}
25
+ `).start();try{let e={port:Number(r.port)||void 0,open:r.open?"/":void 0,watch:r.watch??M.watch,nodeResolve:r.nodeResolve??M.nodeResolve,basePath:r.basePath??M.basePath,rootDir:r.rootDir??M.rootDir,middleware:[function(s,i){return!s.url.endsWith("/")&&!s.url.includes(".")&&(s.url+=".html"),i()}],plugins:[wr(),kr(),gr({include:r.hmrInclude??M.hmrInclude})]},o=await fr({config:e,readCliArgs:!1,readFileConfig:!1});return t.stop(),o}catch(e){throw t.fail("Server snag! Couldn't start dev server."),console.error("Error starting development server:",e),new Error(`Development server failed to start: ${e.message}`)}}async function ne(){let r=B("Generating Custom Elements Manifest...").start();try{await E(`npx --package=@custom-elements-manifest/analyzer -y -- cem analyze --config '${Xe("custom-elements-manifest.config.mjs")}'`),r.succeed("Custom Elements Manifest generated successfully!")}catch(t){let e=t instanceof Error?t.message:String(t);r.warn("CEM analyzer completed with warnings: "+e)}}async function se(){let r=B("Generating API md file...").start();try{await N.generate(),r.succeed("API md file generated successfully!")}catch(t){let e=t instanceof Error?t.message:String(t);throw r.fail("Failed to generate API md file: "+e),t}}async function st(r={}){let t=B("Compiling documentation...").start();try{await _(r),t.succeed("Documentation compiled successfully!")}catch(e){let o=e instanceof Error?e.message:String(e);throw t.fail("Failed to compile MD documentation: "+o),e}j(),await I(),await Te(r)}async function it(r={}){await oe(r)}async function at(r={}){let t=await import("chokidar"),e=["./src/**/*","./docs/**/*","./docTemplates/**/*","./apiExamples/**/*","./demo/**/*.scss"],o=["**/demo/*.min.js","**/demo/*.min.css","**/demo/*.md","**/demo/readme.md","**/docs/api.md","**/custom-elements.json","**/node_modules/**","**/dist/**","**/.git/**"],n=t.watch(e,{ignoreInitial:!0,ignored:o,awaitWriteFinish:{stabilityThreshold:1e3,pollInterval:100}}),s=B("Waiting for changes...");s.spinner="bouncingBar",s.color="green",s.start();let i=null,a=!1,l=!1;async function m(u){if(a){l=!0;return}a=!0,n.unwatch(e);let c=B(`Change detected: ${u}`).start();try{await _(r),j(),await I(),await Te(r),c.succeed("Docs rebuilt!")}catch(d){let f=d instanceof Error?d.message:String(d);c.fail("Rebuild failed: "+f)}finally{setTimeout(()=>{n.add(e),a=!1,l&&(l=!1,m("queued changes"))},1e3)}}n.on("all",(u,c)=>{a||(i&&clearTimeout(i),i=setTimeout(()=>{m(c)},1e3))}),F(n),te()}async function ie(){await ne(),await se()}import{basename as Er,join as lt,resolve as $r}from"node:path";import Tr from"@rollup/plugin-commonjs";import{nodeResolve as Cr}from"@rollup/plugin-node-resolve";import{glob as Sr}from"glob";import{litScss as Ir}from"rollup-plugin-scss-lit";import Ar from"node:path";import{glob as vr}from"glob";function ct(r){return{name:"watch-globs",buildStart(){let t=Array.isArray(r)?r:[r];for(let e of t)try{for(let o of vr.sync(Ar.resolve(e)))this.addWatchFile(o)}catch(o){this.error(`Error watching glob pattern "${e}": ${o.message}`)}}}}var Ce={moduleDirectories:["node_modules"],modulePaths:["../../node_modules","../node_modules","node_modules"],watchPatterns:["./apiExamples/**/*","./docs/**/*"]};function ut(r=[],t={}){let{watchPatterns:e=Ce.watchPatterns,dedupe:o=["lit","lit-element","lit-html"],dev:n=!1}=t,s=[...Ce.modulePaths,...r],i=process.cwd(),a=S.map(l=>$r(i,l));return[Cr({dedupe:o,preferBuiltins:!1,moduleDirectories:Ce.moduleDirectories,modulePaths:a}),Tr(),Ir({minify:n?!1:{fast:!0},options:{loadPaths:[...s,lt(process.cwd(),"src","styles"),lt(process.cwd(),"src")]}}),ct(e)]}function Se(r={}){let{modulePaths:t=[],watch:e=!1,input:o=["./src/index.js","./src/registered.js"],outputDir:n="./dist",format:s="esm",dev:i=!1}=r;return{name:"Main",config:{input:o,output:{format:s,dir:n,entryFileNames:a=>i||["index","registered"].includes(a.name)?"[name].js":"[name]-[hash].js",chunkFileNames:i?"[name].js":"[name]-[hash].js",assetFileNames:i?"[name][extname]":"[name]-[hash][extname]"},external:Rr(),plugins:ut(t,{dev:i}),watch:mt(e)}}}function G(r={}){let{modulePaths:t=[],watch:e=!1,globPattern:o="./demo/*.js",ignorePattern:n=["./demo/*.min.js"],outputDir:s="./demo",dev:i=!1}=r,a=Sr.sync(o,{ignore:n}),l=ut(t,{dev:i}),m=mt(e);return{name:"Demo",configs:a.map(c=>({input:{[Er(c,".js")]:c},output:{format:"esm",dir:s,entryFileNames:"[name].min.js",chunkFileNames:"[name].min.js",assetFileNames:i?"[name][extname]":"[name]-[hash][extname]",inlineDynamicImports:!0},plugins:l,onwarn(f,p){if(f.code==="UNRESOLVED_IMPORT")throw new Error(`Unresolved import "${f.exporter??f.source}" in ${f.id??c}. Make sure workspace dependencies are built before bundling demos.`);p(f)},watch:m}))}}function mt(r){if(!r)return!1;let t=typeof r=="object"?r:{};return{clearScreen:t.clearScreen??!0,buildDelay:t.buildDelay??500,chokidar:{ignoreInitial:!0,ignored:t.ignored??["**/dist/**/*.d.ts","**/custom-elements.json","**/demo/*.md","**/demo/**/*.min.js","**/demo/**/*.min.css","**/docs/api.md","**/node_modules/**","**/.git/**"],awaitWriteFinish:t.awaitWriteFinish??{stabilityThreshold:1e3,pollInterval:100}},include:t.include??["./src/**/*.scss","./src/**/*.js","./src/**/*.ts","./demo/**/*.js","./apiExamples/**/*","./docs/**/*.md"],exclude:t.exclude??["./dist/**/*","./node_modules/**/*"]}}function Rr(r=[]){return[...[/node_modules\/lit/,/node_modules\/lit-element/,/node_modules\/lit-html/,/node_modules\/@lit/],...r]}function gt(){let r=L("./dist"),t=Re("Cleaning dist folder...").start();try{return Dr(r,{recursive:!0,force:!0}),t.succeed("All clean! Dist folder wiped."),!0}catch(e){return t.fail(`Oops! Couldn't clean dist/ folder: ${e.message}`),console.error(e),!1}}async function ce(r,t,e,o){let n=Re(r).start();try{let s=await t();return n.succeed(e),s}catch(s){throw n.fail(o),console.error(`Error: ${s.message}`),s}}async function ht(r,t){return ce(`Bundling ${r.name||"main"} and demo...`,async()=>{let e=await Ie(r);await e.write(r.output),await e.close();for(let o of t){let n=await Ie(o);await n.write(o.output),await n.close()}},`Bundles ready! ${r.name||"Main"} and demo built.`,"Bundle hiccup! Build failed.")}async function le(r){let{wcaInput:t,wcaOutput:e,skipDocs:o}=r;if(o){let n=Re("Skipping docs generation...").start();setTimeout(()=>{n.succeed("Docs generation skipped.")},0);return}return ce("Analyzing components and making docs...",async()=>{await ie(t,e),await _(r),j()},"Docs ready! Looking good.","Doc troubles!")}function Fr(){let r=process.cwd();function t(n){return[n,`${n}.scss`,`${n}.css`,L(Nr(n),`_${Or(n)}.scss`),L(n,"_index.scss"),L(n,"index.scss")].find(i=>dt(i))}function e(n){for(let i of S){let a=t(ae(r,i,n));if(a)return a}let s=o(n);return s||null}function o(n){let s,i;if(n.startsWith("@")){let a=n.split("/");if(a.length<3)return null;s=`${a[0]}/${a[1]}`,i=`./${a.slice(2).join("/")}`}else{let a=n.indexOf("/");if(a===-1)return null;s=n.slice(0,a),i=`./${n.slice(a+1)}`}for(let a of S){let l=ae(r,a,s,"package.json");if(dt(l))try{let u=JSON.parse(xr(l,"utf-8")).exports;if(!u||typeof u!="object")continue;let c=u[i];if(!c)continue;let d=typeof c=="string"?c:c.default||c.import;if(!d)continue;let f=t(ae(r,a,s,d));if(f)return f}catch{continue}}return null}return{findFileUrl(n){if(n.includes("/node_modules/")){let s=n.lastIndexOf("/node_modules/"),i=n.slice(s+14),a=e(i);if(a)return pt(a)}if(!n.startsWith(".")&&!n.startsWith("/")&&!n.startsWith("file:")){let s=e(n);if(s)return pt(s)}return null}}}async function I(r="./demo"){return ce("Compiling demo SCSS...",async()=>{let t=jr.sync(L(r,"**/*.scss")),e=Fr(),o=process.cwd(),n=S.map(s=>ae(o,s));for(let s of t){let i=ft.compile(s,{importers:[e],loadPaths:n,silenceDeprecations:["import"],style:"compressed"}),a=s.replace(/\.scss$/,".min.css");Pr(a,i.css)}return t.length},"Demo SCSS compiled.","SCSS compilation failed.")}async function Te(r={}){let{configs:t}=G(r);return ce("Bundling demo JS...",async()=>{for(let e of t){let o=await Ie(e);await o.write(e.output),await o.close()}},"Demo JS bundled.","Demo JS bundling failed.")}import yt from"node:path";import x from"ora";import"rollup";var H=!1,_r={analyze:{active:!1,lastTime:0},docs:{active:!1,lastTime:0},scss:{active:!1,lastTime:0}},Mr=5e3,ue=new Set,Br=["/dist/index.d.ts","/custom-elements.json","/demo/api.md","/docs/api.md","/demo/index.min.js"];function Gr(r){if(!r||typeof r!="string")return!1;try{let t=yt.normalize(r);return Br.some(e=>t.endsWith(e))||t.includes("/dist/")||t.endsWith(".min.js")||t.endsWith(".min.css")||t.endsWith(".d.ts")}catch(t){return console.error(`Error checking path (${typeof r}):`,t.message),!1}}async function xe(r,t){let e=_r[r];if(e.active||Date.now()-e.lastTime<Mr)return!1;try{return e.active=!0,e.lastTime=Date.now(),await t()}catch(o){return console.error(`Error in ${r} task:`,o),!1}finally{e.active=!1}}async function wt(r,t,e){let o=!0,n={analyze:!1,docs:!1,scss:!1},s=null,i,a=x("Activating watch mode...").start(),l={analyze:async()=>{let{wcaInput:c,wcaOutput:d,skipDocs:f}=t;if(f){let g=x("Skipping component analysis...").start();return setTimeout(()=>{g.succeed("Component analysis skipped.")},0),!0}let p=x("Detective work: analyzing components...").start();try{return await ie(c,d),p.succeed("Component analysis complete! API generated."),!0}catch(g){return p.fail("Analysis hiccup! Something went wrong."),console.error("Component analysis error:",g),!1}},docs:async()=>{if(H)return!1;if(t.skipDocs){let d=x("Skipping docs generation...").start();return setTimeout(()=>{d.succeed("Docs generation skipped.")},0),!0}let c=x("Refreshing docs...").start();try{return await le(t),c.succeed("Documentation refreshed!"),!0}catch(d){c.fail("Docs stumble! Couldn't refresh."),console.error("Documentation rebuild error:",d)}},scss:async()=>{if(H)return!1;try{return await I(),!0}catch(c){return console.error("Demo SCSS compilation error:",c),!1}}},m=()=>{o&&n.analyze&&n.docs&&n.scss&&typeof e=="function"&&(o=!1,e())};function u(c=1e3){s&&clearTimeout(s),s=setTimeout(async()=>{setTimeout(async()=>{n.analyze=await xe("analyze",l.analyze),setTimeout(async()=>{n.docs=await xe("docs",l.docs),setTimeout(async()=>{n.scss=await xe("scss",l.scss),m()},500)},1e3)},1e3)},c)}r.on("event",async c=>{switch(c.code){case"START":a.succeed("Watch mode active! Eyes peeled.");break;case"BUNDLE_START":if(ue.clear(),c.input)try{let d=Array.isArray(c.input)?c.input:typeof c.input=="string"?[c.input]:typeof c.input=="object"&&c.input!==null?Object.values(c.input):[];for(let f of d)typeof f=="string"&&!Gr(f)&&ue.add(yt.normalize(f))}catch(d){console.error("Error processing input paths:",d)}i=x("Weaving bundles...").start(),H=!0;break;case"BUNDLE_END":i&&i.succeed(`Bundle ${Array.isArray(c.input)?`of ${c.input.join("& ")} `:""}done in ${c.duration}ms! \u{1F680}`),H=!1,ue.size>0&&u();break;case"END":break;case"ERROR":H=!1,i?i.fail(`Oops! Bundle hit a snag: ${c.error.message}`):x().fail(`Watch mode hiccup: ${c.error.message}`),ue.clear();break}})}function bt(r,t){return F(r),t&&F(t),te(),r}async function Ur(r){let t=Se(r),e=G(r);r.dev||t.config.plugins.push(Lr()),await le(r),await I(),await ht(t.config,e.configs)}async function Wr(r){let{dev:t}=r,e=Se({...r,watch:!0}),o=G({...r,watch:!0}),n=Hr([e.config,...o.configs]);wt(n,r,t?async()=>oe(r):void 0);let s=await import("chokidar"),i=!1,a=!1,l=null,m=s.watch("./demo/**/*.scss",{ignoreInitial:!0,ignored:["**/demo/**/*.min.css"],awaitWriteFinish:{stabilityThreshold:500,pollInterval:100}});return m.on("all",()=>{l&&clearTimeout(l),l=setTimeout(async()=>{if(i){a=!0;return}i=!0;try{await I()}catch(u){console.error("Demo SCSS watch compilation error:",u)}finally{i=!1,a&&(a=!1,m.emit("all"))}},500)}),bt(n,m),n}async function me(r={}){try{let{watch:t}=r;return gt(),t?await Wr(r):await Ur(r)}catch(t){throw new Error(`Build failed: ${t.message}`)}}var U=qr.command("dev").description("Runs development server for auro components");U=X(U);U=Z(U);var Gs=U.action(async r=>{try{let t=kt("Initializing...");r.watch?(t.text="Waiting for changes...",t.spinner="bouncingBar",t.color="green"):t.text=r.docs===!1?"Building component (docs disabled)":"Building component",t.start(),r.watch||t.succeed("Build completed!"),await me({...r,dev:!0,watch:r.watch})}catch(t){kt().fail(`Build failed: ${t.message}`),console.error(t),process.exit(1)}});import{program as zr}from"commander";import At from"ora";var De=zr.command("build").description("Builds auro components");De=X(De);var zs=De.action(async r=>{try{let t=At("Initializing...");r.watch?(t.text="Waiting for changes...",t.spinner="bouncingBar",t.color="green"):t.text=r.docs===!1?"Building component (docs disabled)":"Building component",t.start(),await me(r),r.watch||t.succeed("Build completed!")}catch(t){At().fail(`Build failed: ${t.message}`),console.error(t),process.exit(1)}});import{exec as Vr}from"node:child_process";import vt from"node:path";import Jr from"node:process";import{fileURLToPath as Kr}from"node:url";import Yr from"node:util";import{program as Xr}from"commander";import Zr from"inquirer";var ri=Xr.command("migrate").description("Script runner to perform repetitive code change tasks").requiredOption("-i, --id <string>","Select the migration you would like to run by id").option("-m, --multi-gitter","Run the migration on all repositories in the multi-gitter config").action(async r=>{let t=Kr(import.meta.url),e=vt.dirname(t),o=vt.resolve(e,"migrations",r.id);if(r.multiGitter){let n=Yr.promisify(Vr);try{await n("command -v multi-gitter")}catch{console.error("multi-gitter is not installed."),Jr.exit(1)}(await Zr.prompt([{type:"confirm",name:"dryRun",message:"Run migration in dry-run mode? (no changes will be committed)",default:!0}])).dryRun?E(`multi-gitter run ${o}/script.sh --config "${o}/multi-gitter.yml" --dry-run`):E(`multi-gitter run ${o}/script.sh --config "${o}/multi-gitter.yml"`)}else E(`${o}/script.sh`)});import St from"node:process";import{program as oo}from"commander";import{readFile as no,writeFile as so}from"node:fs/promises";import{Logger as W}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import Pe from"node:fs/promises";import Oe from"node:path";import{Octokit as Qr}from"@octokit/rest";import $ from"ora";import{processContentForFile as eo,templateFiller as to}from"@aurodesignsystem/auro-library/scripts/utils/sharedFileProcessorUtils.mjs";async function Et(r,t){let e=new Qr({auth:process.env.GITHUB_TOKEN||""});try{let n=(await e.request("GET /repos/{owner}/{repo}/contents/{path}",{ref:t,owner:"AlaskaAirlines",repo:"auro-templates",path:r,headers:{"X-GitHub-Api-Version":"2022-11-28"}})).data;if(typeof n!="object"||!Array.isArray(n)){let s=`Unexpected response format: ${JSON.stringify(n)}`;throw $().start().fail(s),new Error("Failed to retrieve folder items")}return n}catch(o){let n=$().start();throw o.status===404?n.fail(`Template '${r.split("/")[1]}' not found`):n.fail(`Error accessing template: ${o.message}`),o}}async function $t({folderItems:r,templatePathToReplace:t,rootDir:e,ref:o}){let n=[];for(let s of r){if(s.type=="dir"){let m=$(`Processing directory: ${s.path}`).start(),u=await Et(s.path,o);m.succeed(`Found ${u.length} additional items in ${s.path}`);let c=await $t({folderItems:u,templatePathToReplace:t,rootDir:e,ref:o});n.push(...c);continue}let i=s.path.replace(`${t}/`,""),a=`${e}/.github/${i}`,l={identifier:s.name,input:{remoteUrl:s.download_url||"",fileName:a,overwrite:!0},output:a};n.push(l)}return n}async function ro(r){try{await Pe.rm(r,{recursive:!0,force:!0}),$().start().succeed(`Successfully removed directory: ${r}`)}catch(t){throw $().start().fail(`Error removing directory ${r}: ${t.message}`),t}}async function Tt(r,t="",e=!0){try{let o=await Pe.stat(r),n=Oe.basename(r);if(!o.isDirectory())return`${t}${e?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 "}${n}
26
26
  `;let s=`${t}${e?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 "}${n}/
27
27
  `;try{let a=(await Pe.readdir(r)).sort();for(let l=0;l<a.length;l++){let m=a[l],u=Oe.join(r,m),c=l===a.length-1,d=t+(e?" ":"\u2502 ");s+=await Tt(u,d,c)}}catch{s+=`${t}${e?" ":"\u2502 "}\u2514\u2500\u2500 [Permission denied or error reading directory]
28
28
  `}return s}catch(o){return`${t}${e?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 "}[Error: ${o}]
@@ -30,7 +30,7 @@ ${O.trimEnd()}
30
30
  `).replace(/\n\n/gu,`
31
31
  `);await so(e,n,{encoding:"utf-8"}),(n.includes("\r")||n.includes(`
32
32
 
33
- `))&&W.error("CODEOWNERS file still has Windows line endings.")}catch(e){throw W.error(`Error processing CODEOWNERS file: ${e.message}`),e}}catch(e){W.error(`Sync operation failed: ${e.message}`),St.exit(1)}});import de from"node:fs";import z from"node:path";import{Logger as Rt}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import{program as io}from"commander";import{glob as ao}from"glob";var It=(r,t)=>{let e=(r.match(/static register\(name \= (.+)\)/)||r.match(/customElements.get\((.+?)\)/))[1],o=r.match(/export class (.+) extends/)?.[1],n=r.match(/\/\*\*((.|\n)*?)(\*\n|\*\/|[@])/)?.[1]||"";return!e||!o?r:`
33
+ `))&&W.error("CODEOWNERS file still has Windows line endings.")}catch(e){throw W.error(`Error processing CODEOWNERS file: ${e.message}`),e}}catch(e){W.error(`Sync operation failed: ${e.message}`),St.exit(1)}});import de from"node:fs";import q from"node:path";import{Logger as Rt}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import{program as io}from"commander";import{glob as ao}from"glob";var It=(r,t)=>{let e=(r.match(/static register\(name \= (.+)\)/)||r.match(/customElements.get\((.+?)\)/))[1],o=r.match(/export class (.+) extends/)?.[1],n=r.match(/\/\*\*((.|\n)*?)(\*\n|\*\/|[@])/)?.[1]||"";return!e||!o?r:`
34
34
  import { ${o} } from '${t}';
35
35
 
36
36
  /**${n}*/
@@ -39,20 +39,20 @@ class ${o}WCA extends ${o} {}
39
39
  if (!customElements.get(${e})) {
40
40
  customElements.define(${e}, ${o}WCA);
41
41
  }
42
- `};var pe=z.resolve(process.cwd(),"./scripts/wca");async function co(r){try{return(await Promise.all(r.map(e=>ao(e)))).flat()}catch(t){throw console.error("Error processing glob patterns:",t),t}}async function lo(r){de.existsSync(pe)||await de.promises.mkdir(pe,{recursive:!0});for(let t of r){let e=z.resolve(process.cwd(),t),o=await de.promises.readFile(e,"utf-8"),n=z.resolve(pe,`${z.basename(t)}`),s=It(o,z.relative(pe,t));await de.promises.writeFile(n,s)}}async function uo(){let r=await co(["./src/auro-*.js"]);await lo(r)}var $i=io.command("wca-setup").description("Set up WCA (Web Component Analyzer) for the project").action(()=>{uo().then(()=>{Rt.success("WCA setup completed successfully.")}).catch(r=>{Rt.error(`WCA setup failed: ${r.message}`)})});import{program as bo}from"commander";import Ot from"chalk";import Nt from"ora";import{appendFile as mo,readFile as po}from"node:fs/promises";import{Logger as h}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import{simpleGit as fo}from"simple-git";var y;try{y=fo({baseDir:process.cwd(),binary:"git",maxConcurrentProcesses:1})}catch(r){h.error(`Failed to initialize git: ${r}`),y={}}var R=class r{static async checkGitignore(t){if(t==="")return!1;try{return(await po(".gitignore","utf-8")).includes(t)}catch(e){return h.error(`Error reading file: ${e}`),!1}}static async getCommitMessages(t=""){try{let e=t;e||(e=(await y.branchLocal()).current);let o="main",n="";if(!!process.env.GITHUB_ACTIONS){o=process.env.GITHUB_BASE_REF||"main";try{if(await y.fetch("origin",o),e!=="HEAD")try{await y.raw(["rev-parse","--verify",`origin/${e}`])}catch{await y.fetch("origin",e)}let i=e==="HEAD"?"HEAD":`origin/${e}`;n=`${(await y.raw(["merge-base",`origin/${o}`,i])).trim()}..${i}`}catch(i){h.warn(`Error setting up commit range in CI: ${i}`);let a=e==="HEAD"?"HEAD":`origin/${e}`;n=`origin/${o}..${a}`}}else try{try{await y.raw(["rev-parse","--verify",`origin/${o}`])}catch{h.info(`Fetching ${o} from origin`),await y.fetch("origin",o)}if(e!=="HEAD")try{await y.raw(["rev-parse","--verify",e])}catch{await y.fetch("origin",e)}n=`${(await y.raw(["merge-base",`origin/${o}`,e])).trim()}..${e}`}catch(i){h.warn(`Error determining commits locally: ${i}`),n=`${e}~10..${e}`}return await r.getFormattedCommits(n)}catch(e){return h.error(`Error getting commit messages: ${e}`),[]}}static async getRepoOwnerAndName(){try{let t=await y.getRemotes(!0);if(t.length===0)return h.warn("No remotes found"),null;let e=t.find(n=>n.name==="origin")||t[0],o=e.refs.fetch||e.refs.push;return r.parseGitUrl(o)}catch(t){return h.error(`Error getting repo owner and name: ${t}`),null}}static async getCurrentBranchName(){try{return(await y.branchLocal()).current||null}catch(t){return h.error(`Error getting current branch name: ${t}`),null}}static parseGitUrl(t){let e;return t.includes("@")&&t.includes(":")&&(e=t.match(/@([^:]+):([^/]+)\/(.+?)(?:\.git)?$/),e)?{owner:e[2],repo:e[3]}:(e=t.match(/https?:\/\/(?:[^@]+@)?[^/]+\/([^/]+)\/(.+?)(?:\.git)?$/),e?{owner:e[1],repo:e[2]}:(h.warn(`Could not parse git URL: ${t}`),null))}static async getFormattedCommits(t){let o=(await y.raw(["log","--pretty=format:COMMIT_START%n%H%n%ad%n%an%n%s%n%b%nCOMMIT_END","--date=short",t])).split(`COMMIT_START
42
+ `};var pe=q.resolve(process.cwd(),"./scripts/wca");async function co(r){try{return(await Promise.all(r.map(e=>ao(e)))).flat()}catch(t){throw console.error("Error processing glob patterns:",t),t}}async function lo(r){de.existsSync(pe)||await de.promises.mkdir(pe,{recursive:!0});for(let t of r){let e=q.resolve(process.cwd(),t),o=await de.promises.readFile(e,"utf-8"),n=q.resolve(pe,`${q.basename(t)}`),s=It(o,q.relative(pe,t));await de.promises.writeFile(n,s)}}async function uo(){let r=await co(["./src/auro-*.js"]);await lo(r)}var $i=io.command("wca-setup").description("Set up WCA (Web Component Analyzer) for the project").action(()=>{uo().then(()=>{Rt.success("WCA setup completed successfully.")}).catch(r=>{Rt.error(`WCA setup failed: ${r.message}`)})});import{program as bo}from"commander";import Ot from"chalk";import Nt from"ora";import{appendFile as mo,readFile as po}from"node:fs/promises";import{Logger as h}from"@aurodesignsystem/auro-library/scripts/utils/logger.mjs";import{simpleGit as fo}from"simple-git";var y;try{y=fo({baseDir:process.cwd(),binary:"git",maxConcurrentProcesses:1})}catch(r){h.error(`Failed to initialize git: ${r}`),y={}}var R=class r{static async checkGitignore(t){if(t==="")return!1;try{return(await po(".gitignore","utf-8")).includes(t)}catch(e){return h.error(`Error reading file: ${e}`),!1}}static async getCommitMessages(t=""){try{let e=t;e||(e=(await y.branchLocal()).current);let o="main",n="";if(!!process.env.GITHUB_ACTIONS){o=process.env.GITHUB_BASE_REF||"main";try{if(await y.fetch("origin",o),e!=="HEAD")try{await y.raw(["rev-parse","--verify",`origin/${e}`])}catch{await y.fetch("origin",e)}let i=e==="HEAD"?"HEAD":`origin/${e}`;n=`${(await y.raw(["merge-base",`origin/${o}`,i])).trim()}..${i}`}catch(i){h.warn(`Error setting up commit range in CI: ${i}`);let a=e==="HEAD"?"HEAD":`origin/${e}`;n=`origin/${o}..${a}`}}else try{try{await y.raw(["rev-parse","--verify",`origin/${o}`])}catch{h.info(`Fetching ${o} from origin`),await y.fetch("origin",o)}if(e!=="HEAD")try{await y.raw(["rev-parse","--verify",e])}catch{await y.fetch("origin",e)}n=`${(await y.raw(["merge-base",`origin/${o}`,e])).trim()}..${e}`}catch(i){h.warn(`Error determining commits locally: ${i}`),n=`${e}~10..${e}`}return await r.getFormattedCommits(n)}catch(e){return h.error(`Error getting commit messages: ${e}`),[]}}static async getRepoOwnerAndName(){try{let t=await y.getRemotes(!0);if(t.length===0)return h.warn("No remotes found"),null;let e=t.find(n=>n.name==="origin")||t[0],o=e.refs.fetch||e.refs.push;return r.parseGitUrl(o)}catch(t){return h.error(`Error getting repo owner and name: ${t}`),null}}static async getCurrentBranchName(){try{return(await y.branchLocal()).current||null}catch(t){return h.error(`Error getting current branch name: ${t}`),null}}static parseGitUrl(t){let e;return t.includes("@")&&t.includes(":")&&(e=t.match(/@([^:]+):([^/]+)\/(.+?)(?:\.git)?$/),e)?{owner:e[2],repo:e[3]}:(e=t.match(/https?:\/\/(?:[^@]+@)?[^/]+\/([^/]+)\/(.+?)(?:\.git)?$/),e?{owner:e[1],repo:e[2]}:(h.warn(`Could not parse git URL: ${t}`),null))}static async getFormattedCommits(t){let o=(await y.raw(["log","--pretty=format:COMMIT_START%n%H%n%ad%n%an%n%s%n%b%nCOMMIT_END","--date=short",t])).split(`COMMIT_START
43
43
  `).filter(s=>s.trim()!==""),n=[];for(let s of o){let i=s.split(`
44
44
  `);if(i.length>=4){let a=i[0],l=i[1],m=i[2],u=i[3],c=i.slice(4).filter(b=>b!=="COMMIT_END"),d=c.length>0?c.join(""):"",f=a.substring(0,7),p=u.match(/^(feat|fix|docs|style|refactor|perf|test|build|ci|chore)(\(.+\))?:/),g=p?p[1]:"unknown";d.includes("BREAKING CHANGE")&&(g="breaking"),n.push({type:g,hash:f,date:l,subject:u,body:d,message:`${u}${d?`
45
45
 
46
46
  ${d}`:""}`,author_name:m})}}return n}static async addToGitignore(t,e=!0){await r.checkGitignore(t).then(async o=>{if(o)h.warn(`${t} already exists`);else try{await mo(".gitignore",`
47
- ${t}`),e&&h.success(`${t} added to .gitignore`)}catch(n){h.error(n)}})}static async removeFromGitCache(t){try{await y.rmKeepLocal(t),h.success(`${t.join(", ")} are removed from git cache`)}catch(e){h.error(e)}}static async createBranch(t){try{await y.checkoutLocalBranch(t),h.success(`Created and switched to ${t} branch`)}catch(e){h.error(e)}}static async commitStagedFiles(t){try{await y.add("."),await y.commit(t),h.success(`Committed with message: ${t}`)}catch(e){h.error(e)}}};import w from"chalk";var go=60,ho=100;function q(r){switch(r){case"breaking":return w.bold.red(r);case"feat":return w.bold.green(r);case"fix":return w.bold.green(r);case"perf":return w.bold.green(r);case"docs":return w.bold.cyan(r);case"style":return w.bold.cyan(r);case"refactor":return w.bold.cyan(r);case"test":return w.bold.cyan(r);case"build":return w.bold.cyan(r);case"ci":return w.bold.cyan(r);case"chore":return w.bold.cyan(r);default:return w.bold.white(r)}}function xt(r,t){if(!r)return"";if(r.length<=t)return r;let e=r.split(" "),o="",n="";for(let s of e)(n+s).length>t&&n.length>0&&(o+=`${n.trim()}
48
- `,n=""),n=`${n}${s} `;return n.length>0&&(o+=n.trim()),o}function Dt(r){for(let t of r){console.log("\u2500".repeat(60));let e=xt(t.subject,go),o=xt(t.body,ho);console.log(w.bold(`${q(t.type)}`)),console.log(w.dim(`${t.hash} | ${t.date} | ${t.author_name}`)),console.log(w.bold(`${w.white(e)}`)),t.body&&console.log(w.dim(o))}console.log("\u2500".repeat(60)),console.log(`
47
+ ${t}`),e&&h.success(`${t} added to .gitignore`)}catch(n){h.error(n)}})}static async removeFromGitCache(t){try{await y.rmKeepLocal(t),h.success(`${t.join(", ")} are removed from git cache`)}catch(e){h.error(e)}}static async createBranch(t){try{await y.checkoutLocalBranch(t),h.success(`Created and switched to ${t} branch`)}catch(e){h.error(e)}}static async commitStagedFiles(t){try{await y.add("."),await y.commit(t),h.success(`Committed with message: ${t}`)}catch(e){h.error(e)}}};import w from"chalk";var go=60,ho=100;function z(r){switch(r){case"breaking":return w.bold.red(r);case"feat":return w.bold.green(r);case"fix":return w.bold.green(r);case"perf":return w.bold.green(r);case"docs":return w.bold.cyan(r);case"style":return w.bold.cyan(r);case"refactor":return w.bold.cyan(r);case"test":return w.bold.cyan(r);case"build":return w.bold.cyan(r);case"ci":return w.bold.cyan(r);case"chore":return w.bold.cyan(r);default:return w.bold.white(r)}}function xt(r,t){if(!r)return"";if(r.length<=t)return r;let e=r.split(" "),o="",n="";for(let s of e)(n+s).length>t&&n.length>0&&(o+=`${n.trim()}
48
+ `,n=""),n=`${n}${s} `;return n.length>0&&(o+=n.trim()),o}function Dt(r){for(let t of r){console.log("\u2500".repeat(60));let e=xt(t.subject,go),o=xt(t.body,ho);console.log(w.bold(`${z(t.type)}`)),console.log(w.dim(`${t.hash} | ${t.date} | ${t.author_name}`)),console.log(w.bold(`${w.white(e)}`)),t.body&&console.log(w.dim(o))}console.log("\u2500".repeat(60)),console.log(`
49
49
  `)}import*as V from"@actions/github";async function Ne(){try{let r=process.env.GITHUB_TOKEN;if(!r)throw new Error("GITHUB_TOKEN environment variable is not set");if(!process.env.GITHUB_REPOSITORY||!process.env.GITHUB_EVENT_PATH)throw new Error("This function can only be used in a GitHub Actions environment");let t=V.getOctokit(r),{context:e}=V;if(!e.payload.pull_request)throw new Error("No pull request found in the GitHub context");let[o,n]=process.env.GITHUB_REPOSITORY.split("/"),s=e.payload.pull_request.number,{data:i}=await t.rest.issues.listLabelsOnIssue({owner:o,repo:n,issue_number:s});return i.map(a=>a.name)}catch(r){throw r instanceof Error?new Error(`Failed to get existing labels: ${r.message}`):r}}async function Pt(r){try{let t=process.env.GITHUB_TOKEN;if(!t)throw new Error("GITHUB_TOKEN environment variable is not set");if(!process.env.GITHUB_REPOSITORY||!process.env.GITHUB_EVENT_PATH)throw new Error("This function can only be used in a GitHub Actions environment");let e=V.getOctokit(t),{context:o}=V;if(!o.payload.pull_request)throw new Error("No pull request found in the GitHub context");let[n,s]=process.env.GITHUB_REPOSITORY.split("/"),i=o.payload.pull_request.number,a=`semantic-status: ${r}`,l=await Ne();if(l.includes(a))return;let m=l.filter(u=>u.startsWith("semantic-status:")&&u!==a);for(let u of m)await e.rest.issues.removeLabel({owner:n,repo:s,issue_number:i,name:u});await e.rest.issues.addLabels({owner:n,repo:s,issue_number:i,labels:[a]});return}catch(t){throw t instanceof Error?new Error(`Failed to apply label: ${t.message}`):t}}var yo=["feat","fix","breaking","perf"];function je(r,t=!0){let e=`### In this release
50
50
  `;for(let o of r)if(e+=`- ${o.hash} ${o.subject}
51
51
  `,o.body?.trim()){let s=o.body.trim().split(/\n+/).map(i=>i.trim()).filter(i=>i.length>0);for(let i of s){let a=i;a=a.replace(/([^\s])(AlaskaAirlines\/[a-zA-Z0-9-]+#\d+)/g,"$1 $2"),a=a.replace(/(AlaskaAirlines\/[a-zA-Z0-9-]+#\d+)([^\s])/g,"$1 $2"),e+=` - ${a}`}}return r.length===0?"":(t&&console.log(Ot.green(`\u2713 Generating release notes for ${r.length} commits`)),e)}function Fe(r,t=!0){let e=r.filter(n=>yo.includes(n.type)),o;return t?o=e.length>0?e:r:o=e,o.length===0&&console.log(`No commits found to include in release notes.
52
52
  `),o}async function jt(r=!1,t=!1,e=!1){let o=Nt(`Checking commits...
53
- `).start();try{let n=await R.getCommitMessages();if(e){o.succeed(`Total commits analyzed: ${n.length}`);let s=Fe(n);console.log(je(s));return}if(r&&Dt(n),o.succeed(`Total commits analyzed: ${n.length}`),n.length!==0){let s=n.map(l=>l.type),a=Array.from(new Set(s)).map(l=>q(l)).join(", ");o.succeed(`Found commit types: ${a}`)}else o.info(`The list of commits is created by comparing the current branch
53
+ `).start();try{let n=await R.getCommitMessages();if(e){o.succeed(`Total commits analyzed: ${n.length}`);let s=Fe(n);console.log(je(s));return}if(r&&Dt(n),o.succeed(`Total commits analyzed: ${n.length}`),n.length!==0){let s=n.map(l=>l.type),a=Array.from(new Set(s)).map(l=>z(l)).join(", ");o.succeed(`Found commit types: ${a}`)}else o.info(`The list of commits is created by comparing the current branch
54
54
  with the main branch. If you are on a new branch, please
55
- make sure to commit some changes before running this command.`);t&&await wo(n,o)}catch(n){o.fail("Error getting commit messages"),console.error(n)}}async function wo(r,t){let e=["breaking","feat","fix","perf","docs","style","refactor","test","build","ci","chore"],o=r.map(i=>i.type).filter(i=>e.includes(i)),n=null,s=Number.POSITIVE_INFINITY;for(let i of o){let a=e.indexOf(i);a<s&&(s=a,n=i)}if(n){let i=Nt("Checking existing labels on pull request...").start();try{if((await Ne()).includes(`semantic-status: ${n}`)){i.info(`Label "semantic-status: ${q(n)}" already exists on the pull request.`);return}i.text="Applying label to pull request...",await Pt(n),i.succeed(`Label "semantic-status: ${q(n)}" applied to the pull request.`)}catch(a){let l=a instanceof Error?a.message:String(a);i.fail(l)}}else t.warn(Ot.yellow("No semantic commit type found to apply as label."))}var Li=bo.command("check-commits").alias("cc").option("-l, --set-label","Set label on the pull request based on the commit message type").option("-d, --debug","Display detailed commit information for debugging").option("-r, --release-notes","Generate release notes based on commit messages").description("Check commits in the local repository for the types of semantic commit messages made and return the results.").action(async r=>{await jt(r.debug,r.setLabel,r.releaseNotes)});import Ft from"node:fs";import{get as _t}from"node:https";import D from"chalk";import{program as ko}from"commander";import Ao from"ora";var Ji=ko.command("pr-release").option("-n, --namespace <package-namespace>","Set namespace of the package release","@aurodesignsystem-dev").option("-p, --pr-number <number>","Set pull request number for the release","0").description("Generate the package version based off of PR number then update the package.json file. Note: this does not publish the package.").action(async r=>{await vo(r)}),vo=async r=>{let{namespace:t,prNumber:e}=r,o=Ao("Updating package.json").start();try{let n="package.json",s=JSON.parse(Ft.readFileSync(n,"utf8"));o.text="Checking npm registry for version information...";let i=`0.0.0-pr${e}`,a=s.name.split("/")[1],l=`${t}/${a}`,m=await Eo(i,l,o),u=`${i}.${m}`;s.name=l,s.version=u,o.text="Writing updated package.json...",Ft.writeFileSync(n,`${JSON.stringify(s,null,2)}
55
+ make sure to commit some changes before running this command.`);t&&await wo(n,o)}catch(n){o.fail("Error getting commit messages"),console.error(n)}}async function wo(r,t){let e=["breaking","feat","fix","perf","docs","style","refactor","test","build","ci","chore"],o=r.map(i=>i.type).filter(i=>e.includes(i)),n=null,s=Number.POSITIVE_INFINITY;for(let i of o){let a=e.indexOf(i);a<s&&(s=a,n=i)}if(n){let i=Nt("Checking existing labels on pull request...").start();try{if((await Ne()).includes(`semantic-status: ${n}`)){i.info(`Label "semantic-status: ${z(n)}" already exists on the pull request.`);return}i.text="Applying label to pull request...",await Pt(n),i.succeed(`Label "semantic-status: ${z(n)}" applied to the pull request.`)}catch(a){let l=a instanceof Error?a.message:String(a);i.fail(l)}}else t.warn(Ot.yellow("No semantic commit type found to apply as label."))}var Li=bo.command("check-commits").alias("cc").option("-l, --set-label","Set label on the pull request based on the commit message type").option("-d, --debug","Display detailed commit information for debugging").option("-r, --release-notes","Generate release notes based on commit messages").description("Check commits in the local repository for the types of semantic commit messages made and return the results.").action(async r=>{await jt(r.debug,r.setLabel,r.releaseNotes)});import Ft from"node:fs";import{get as _t}from"node:https";import D from"chalk";import{program as ko}from"commander";import Ao from"ora";var Ji=ko.command("pr-release").option("-n, --namespace <package-namespace>","Set namespace of the package release","@aurodesignsystem-dev").option("-p, --pr-number <number>","Set pull request number for the release","0").description("Generate the package version based off of PR number then update the package.json file. Note: this does not publish the package.").action(async r=>{await vo(r)}),vo=async r=>{let{namespace:t,prNumber:e}=r,o=Ao("Updating package.json").start();try{let n="package.json",s=JSON.parse(Ft.readFileSync(n,"utf8"));o.text="Checking npm registry for version information...";let i=`0.0.0-pr${e}`,a=s.name.split("/")[1],l=`${t}/${a}`,m=await Eo(i,l,o),u=`${i}.${m}`;s.name=l,s.version=u,o.text="Writing updated package.json...",Ft.writeFileSync(n,`${JSON.stringify(s,null,2)}
56
56
  `,"utf8"),o.succeed(`Package.json updated to use ${D.green(u)} and ${D.green(l)}`),process.exit(0)}catch(n){o.fail(`Failed to update package.json: ${n}`),process.exit(1)}},Eo=(r,t,e)=>new Promise(o=>{try{let a=function(l){if(l.statusCode!==200){e.info(`Package not found. Status code: ${D.red(l.statusCode)}, defaulting to version 0`),o(0);return}e.text="Processing version information...";let m="";l.on("data",u=>{m+=u}),l.on("end",()=>{try{let u=JSON.parse(m),c=u.versions?Object.keys(u.versions):[];e.text="Calculating next version number...";let d=-1,f=new RegExp(`^${r}\\.(\\d+)$`);for(let p of c){let g=p.match(f);if(g){let b=Number.parseInt(g[1],10);d=Math.max(d,b)}}d>=0?e.info(`Found existing version ${D.green(`${r}.${d}`)}. Incrementing to ${D.green(`${r}.${d+1}`)}`):e.info(`No existing version found for ${D.green(r)}. Starting with ${D.green(`${r}.0`)}`),o(d+1)}catch(u){e.warn(`Failed to parse NPM registry response: ${u instanceof Error?u.message:"Unknown error"}, defaulting to version 0`),o(0)}})};var n=a;let s=`https://registry.npmjs.org/${t}`,i=_t(s,{headers:{Accept:"application/json"}},l=>{if((l.statusCode===301||l.statusCode===302)&&l.headers.location){e.info(`Following redirect to ${l.headers.location}...`);try{_t(l.headers.location,{headers:{Accept:"application/json"}},a).on("error",m=>{e.warn(`Error following redirect: ${m.message}, defaulting to version 0`),o(0)}).end()}catch(m){e.warn(`Redirect request failed: ${m instanceof Error?m.message:"Unknown error"}, defaulting to version 0`),o(0)}return}a(l)});i.on("error",l=>{e.warn(`Request error: ${l.message}, defaulting to version 0`),o(0)}),i.end()}catch{e.warn("Error checking version in npm registry, defaulting to version 0"),o(0)}});import _e from"node:path";import{fileURLToPath as $o}from"node:url";import{program as To}from"commander";import Co from"open";var So=$o(import.meta.url),Io=_e.resolve(_e.dirname(So),".."),ta=To.command("test").option("-w, --watch","Set watch number for the test").option("-c, --coverage-report","Generate coverage report").option("-o, --open","Open the coverage report in the browser").option("-f, --files <String|String[]>","Test files glob pattern").description("Run the web test runner to test the component library").action(async r=>{let e=`npx wtr --config "${_e.join(Io,"dist","configs","web-test-runner.config.mjs")}"`,o=`${process.cwd()}/coverage/index.html`;if(r.coverageReport&&(e+=" --coverage"),r.watch&&(e+=" --watch"),r.files){let n=Array.isArray(r.files)?r.files.join(" "):r.files;e+=` --files "${n}"`}E(e),r.open&&await Co(o)});import Le from"node:fs/promises";import Lt from"node:path";import{program as jo}from"commander";import Fo from"inquirer";import He from"ora";import Ro from"node:fs/promises";import xo from"node:path";import Do from"ora";var Po={"auth-type":"workspace-token","author-email":null,"author-name":null,"base-branch":"main","base-url":null,"clone-dir":".gitter-temp","code-search":null,concurrent:4,"conflict-strategy":"replace",draft:!1,"dry-run":!0,"fetch-depth":1,fork:!1,"fork-owner":null,"git-type":"go",group:null,"include-subgroups":!1,insecure:!1,interactive:!1,labels:null,"log-file":"'-'","log-format":"'text'","log-level":"'error'","max-reviewers":0,"max-team-reviewers":0,org:null,output:"'-'","plain-output":!1,platform:"github",project:null,"push-only":!1,repo:["AlaskaAirlines/auro-accordion","AlaskaAirlines/auro-alert","AlaskaAirlines/auro-avatar","AlaskaAirlines/auro-background","AlaskaAirlines/auro-backtotop","AlaskaAirlines/auro-button","AlaskaAirlines/auro-badge","AlaskaAirlines/auro-banner","AlaskaAirlines/auro-card","AlaskaAirlines/auro-carousel","AlaskaAirlines/auro-datetime","AlaskaAirlines/auro-dialog","AlaskaAirlines/auro-drawer","AlaskaAirlines/auro-flight","AlaskaAirlines/auro-flightline","AlaskaAirlines/auro-header","AlaskaAirlines/auro-hyperlink","AlaskaAirlines/auro-icon","AlaskaAirlines/auro-loader","AlaskaAirlines/auro-lockup","AlaskaAirlines/auro-nav","AlaskaAirlines/auro-pane","AlaskaAirlines/auro-popover","AlaskaAirlines/auro-sidenav","AlaskaAirlines/auro-skeleton","AlaskaAirlines/auro-slideshow","AlaskaAirlines/auro-table","AlaskaAirlines/auro-tabs","AlaskaAirlines/auro-toast"],"repo-exclude":null,"repo-include":null,"repo-search":null,reviewers:null,"skip-forks":!1,"skip-pr":!1,"skip-repo":null,"ssh-auth":!1,"team-reviewers":null};function Oo(r){return Object.entries(r).map(([t,e])=>Array.isArray(e)?`${t}:
57
57
  - ${e.join(`
58
58
  - `)}`:typeof e=="object"&&e!==null?`${t}:
@@ -62,8 +62,8 @@ ${Object.entries(e).map(([o,n])=>` ${o}: ${n}`).join(`
62
62
  ${i.map(l=>` - ${l.replace("@aurodesignsystem","AlaskaAirlines").replace("@alaskaairux/icons","AlaskaAirlines/Icons")}`).join(`
63
63
  `)}`).join(`
64
64
 
65
- `);console.log(s),e.text="Running migrations on dependency batches...",new Promise(i=>setTimeout(i,2e3)),e.succeed("Migration process completed successfully.");break}default:console.error("Unknown action selected.")}});import Bo from"node:fs/promises";import Go from"node:path";import{program as Lo}from"commander";import Ho from"ora";var Ue='# Auro Design System \u2014 AI Assistant Context\nAlaska Airlines open-source design system | https://auro.alaskaair.com\n\n## What is Auro?\nAuro is Alaska Airlines\' design system built on Web Components (Custom Elements v1) using the Lit library.\n- npm scope: `@aurodesignsystem/` (current), `@alaskaairux/` (legacy)\n- Framework-agnostic: works with React, Angular, Vue, Svelte, or plain HTML\n- Each component is a separate npm package\n- All components use the `<auro-*>` custom element tag\n\n## Rules for Writing Auro Code\n\n1. **Use `<auro-*>` custom element tags \u2014 never plain HTML equivalents**\n - \u2717 `<button>` \u2192 \u2713 `<auro-button>`\n - \u2717 `<a href="...">` \u2192 \u2713 `<auro-hyperlink href="...">`\n - \u2717 `<input>` \u2192 \u2713 `<auro-input>` (from auro-formkit)\n\n2. **Install and register each component before use**\n ```bash\n npm install @aurodesignsystem/auro-button\n ```\n ```js\n import "@aurodesignsystem/auro-button"; // registers <auro-button> globally\n ```\n\n3. **Props are HTML attributes in templates; camelCase properties in JS**\n ```html\n <auro-button disabled loading>Save</auro-button>\n ```\n ```js\n document.querySelector(\'auro-button\').loading = true;\n ```\n\n4. **Content goes in named slots, not innerHTML**\n ```html\n <auro-dialog>\n <span slot="header">Title</span>\n <div slot="content">Body content here</div>\n </auro-dialog>\n ```\n\n5. **Design tokens are CSS custom properties**\n ```bash\n npm install @aurodesignsystem/design-tokens\n ```\n ```css\n @import "@aurodesignsystem/design-tokens/dist/themes/CSSCustomProperties--bundled.css";\n ```\n Token naming: `--ds-color-*`, `--ds-size-*`, `--ds-font-*`, `--ds-border-*`\n\n## Component Reference\n\n| Element Tag | Package | Description |\n|---|---|---|\n| `<auro-accordion>` | `@aurodesignsystem/auro-accordion` | Expandable content sections |\n| `<auro-alert>` | `@aurodesignsystem/auro-alert` | Inline status messages: error, warning, success, information |\n| `<auro-avatar>` | `@aurodesignsystem/auro-avatar` | User or entity avatar |\n| `<auro-background>` | `@aurodesignsystem/auro-background` | Themed background wrapper |\n| `<auro-backtotop>` | `@aurodesignsystem/auro-backtotop` | Scroll-to-top button |\n| `<auro-badge>` | `@aurodesignsystem/auro-badge` | Status or count badge |\n| `<auro-banner>` | `@aurodesignsystem/auro-banner` | Full-width promotional banner |\n| `<auro-button>` | `@aurodesignsystem/auro-button` | Interactive button; supports `loading`, `disabled`, `shape` |\n| `<auro-card>` | `@aurodesignsystem/auro-card` | Content card container |\n| `<auro-carousel>` | `@aurodesignsystem/auro-carousel` | Horizontally scrollable carousel |\n| `<auro-datetime>` | `@aurodesignsystem/auro-datetime` | Localized date and time formatting |\n| `<auro-dialog>` | `@aurodesignsystem/auro-dialog` | Modal dialog; slots: header, content, footer |\n| `<auro-drawer>` | `@aurodesignsystem/auro-drawer` | Slide-in panel; slots: header, content, footer |\n| `<auro-flight>` | `@aurodesignsystem/auro-flight` | Flight segment display (origin, destination, stops) |\n| `<auro-flightline>` | `@aurodesignsystem/auro-flightline` | Visual flight path/stop indicator |\n| `<auro-input>` | `@aurodesignsystem/auro-formkit` | Text input field |\n| `<auro-select>` | `@aurodesignsystem/auro-formkit` | Select/dropdown |\n| `<auro-datepicker>` | `@aurodesignsystem/auro-formkit` | Date picker input |\n| `<auro-combobox>` | `@aurodesignsystem/auro-formkit` | Combobox with search |\n| `<auro-checkbox>` | `@aurodesignsystem/auro-formkit` | Checkbox input |\n| `<auro-radio>` | `@aurodesignsystem/auro-formkit` | Radio button input |\n| `<auro-header>` | `@aurodesignsystem/auro-header` | Page/section heading |\n| `<auro-hyperlink>` | `@aurodesignsystem/auro-hyperlink` | Accessible anchor link |\n| `<auro-icon>` | `@aurodesignsystem/auro-icon` | Alaska Airlines icon: `category` + `name` attributes |\n| `<auro-loader>` | `@aurodesignsystem/auro-loader` | Loading spinner |\n| `<auro-lockup>` | `@aurodesignsystem/auro-lockup` | Image + text layout lockup |\n| `<auro-nav>` | `@aurodesignsystem/auro-nav` | Breadcrumb / secondary navigation |\n| `<auro-pane>` | `@aurodesignsystem/auro-pane` | Selectable pricing or option pane |\n| `<auro-popover>` | `@aurodesignsystem/auro-popover` | Tooltip-style popover |\n| `<auro-sidenav>` | `@aurodesignsystem/auro-sidenav` | Vertical side navigation |\n| `<auro-skeleton>` | `@aurodesignsystem/auro-skeleton` | Loading placeholder skeleton |\n| `<auro-slideshow>` | `@aurodesignsystem/auro-slideshow` | Image/content slideshow |\n| `<auro-table>` | `@aurodesignsystem/auro-table` | Accessible data table |\n| `<auro-tabs>` | `@aurodesignsystem/auro-tabs` | Tabbed content panels |\n| `<auro-tail>` | `@aurodesignsystem/auro-tail` | Alaska, Hawaiian, and partner airline tail graphics |\n| `<auro-toast>` | `@aurodesignsystem/auro-toast` | Transient notification toast |\n\n## Common Patterns\n\n### Button (default, secondary, tertiary)\n```html\n<auro-button>Primary</auro-button>\n<auro-button variant="secondary">Secondary</auro-button>\n<auro-button variant="tertiary">Tertiary</auro-button>\n<auro-button loading>Saving...</auro-button>\n```\n\n### Alert\n```html\n<auro-alert type="success">Changes saved.</auro-alert>\n<auro-alert type="error">Something went wrong.</auro-alert>\n<auro-alert type="warning">Please review before continuing.</auro-alert>\n<auro-alert type="information">Your flight departs at 9am.</auro-alert>\n```\n\n### Form inputs (auro-formkit)\n```js\nimport "@aurodesignsystem/auro-formkit";\n```\n```html\n<auro-input label="First name" required></auro-input>\n<auro-input label="Email" type="email"></auro-input>\n<auro-select label="Seat preference">\n <auro-menu>\n <auro-menuoption value="window">Window</auro-menuoption>\n <auro-menuoption value="aisle">Aisle</auro-menuoption>\n </auro-menu>\n</auro-select>\n```\n\n### Icon\n```html\n<auro-icon category="interface" name="arrow-right"></auro-icon>\n<auro-icon category="terminal" name="plane-side" customSize style="width: 48px"></auro-icon>\n```\n\n### Hyperlink\n```html\n<auro-hyperlink href="/flights">View flights</auro-hyperlink>\n<auro-hyperlink href="https://example.com" target="_blank">External link</auro-hyperlink>\n```\n\n### Dialog (modal)\n```js\ndocument.querySelector(\'#confirmDialog\').show();\n```\n```html\n<auro-dialog id="confirmDialog">\n <span slot="header">Confirm booking</span>\n <div slot="content">Are you sure you want to book this flight?</div>\n <div slot="footer">\n <auro-button>Confirm</auro-button>\n <auro-button variant="secondary">Cancel</auro-button>\n </div>\n</auro-dialog>\n```\n\n## Accessibility Notes\n- Use the `ariaLabel` slot on `<auro-button>` for icon-only buttons\n- `<auro-hyperlink>` adds rel="noopener noreferrer" automatically for external links\n- All `auro-formkit` components handle aria-invalid and error messaging built-in\n- All components meet WCAG 2.1 AA\n\n## Documentation\n- Component docs: https://auro.alaskaair.com\n- Component status: https://auro.alaskaair.com/component-status\n- Design tokens: https://auro.alaskaair.com/getting-started/developers/token-usage\n- Contributing: https://auro.alaskaair.com/getting-started/developers/contributing\n- GitHub: https://github.com/AlaskaAirlines\n';var Sa=Lo.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)").action(async r=>{if(r.output){let t=Ho(`Writing context to ${r.output}...`).start();try{let e=Go.resolve(process.cwd(),r.output);await Bo.writeFile(e,Ue,"utf-8"),t.succeed(`Auro context written to ${r.output}`),console.log(`
66
- Paste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prime it on Auro components.`)}catch(e){let o=e instanceof Error?e.message:String(e);t.fail(`Failed to write context: ${o}`),process.exit(1)}}else process.stdout.write(Ue)});import{program as Uo}from"commander";var We=Uo.command("docs").description("Generate API documentation").option("-c, --cem","Generate Custom Elements Manifest (CEM) file",!1).option("-a, --api","Creates api md file from CEM",!1).option("-w, --watch","Watch for changes and rebuild docs",!1).option("-r, --readme-template <url>","URL to the README template file").option("--skip-readme","Skip README.md processing",!1);We=Z(We);var Pa=We.action(async r=>{r.cem&&await ne(),r.api&&await se(),await st(r),r.serve&&await it(r),r.watch&&await at(r)});import{program as Jo}from"commander";import{Octokit as ze}from"@octokit/rest";import*as ge from"azure-devops-node-api";import fe from"ora";var Wo=async r=>{let t=process.env.GH_TOKEN;if(!t)throw new Error("GH_TOKEN environment variable is required");let e=new ze({auth:t}),o,n,s;if(r.includes("github.com")){let a=r.match(/github\.com\/([^\/]+)\/([^\/]+)\/issues\/(\d+)/);if(!a)throw new Error("Invalid GitHub issue URL format");[,o,n,s]=a}else if(r.includes("#")){let a=r.match(/([^\/]+)\/([^#]+)#(\d+)/);if(!a)throw new Error("Invalid GitHub issue reference format");[,o,n,s]=a}else throw new Error("Issue must be provided as full URL or in format 'owner/repo#number'");let i=Number.parseInt(s,10);try{let{data:a}=await e.rest.issues.get({owner:o,repo:n,issue_number:i});return{title:a.title,body:a.body??null,html_url:a.html_url,number:a.number,repository:{owner:{login:o},name:n}}}catch(a){throw new Error(`Failed to fetch GitHub issue: ${a}`)}},zo=async r=>{let t=process.env.GH_TOKEN;if(!t)return null;let e=new ze({auth:t});try{let o=`
65
+ `);console.log(s),e.text="Running migrations on dependency batches...",new Promise(i=>setTimeout(i,2e3)),e.succeed("Migration process completed successfully.");break}default:console.error("Unknown action selected.")}});import Bo from"node:fs/promises";import Go from"node:path";import{program as Lo}from"commander";import Ho from"ora";var Ue='# Auro Design System \u2014 AI Assistant Context\nAlaska Airlines open-source design system | https://auro.alaskaair.com\n\n## What is Auro?\nAuro is Alaska Airlines\' design system built on Web Components (Custom Elements v1) using the Lit library.\n- npm scope: `@aurodesignsystem/` (current), `@alaskaairux/` (legacy)\n- Framework-agnostic: works with React, Angular, Vue, Svelte, or plain HTML\n- Each component is a separate npm package\n- All components use the `<auro-*>` custom element tag\n\n## Rules for Writing Auro Code\n\n1. **Use `<auro-*>` custom element tags \u2014 never plain HTML equivalents**\n - \u2717 `<button>` \u2192 \u2713 `<auro-button>`\n - \u2717 `<a href="...">` \u2192 \u2713 `<auro-hyperlink href="...">`\n - \u2717 `<input>` \u2192 \u2713 `<auro-input>` (from auro-formkit)\n\n2. **Install and register each component before use**\n ```bash\n npm install @aurodesignsystem/auro-button\n ```\n ```js\n import "@aurodesignsystem/auro-button"; // registers <auro-button> globally\n ```\n\n3. **Props are HTML attributes in templates; camelCase properties in JS**\n ```html\n <auro-button disabled loading>Save</auro-button>\n ```\n ```js\n document.querySelector(\'auro-button\').loading = true;\n ```\n\n4. **Content goes in named slots, not innerHTML**\n ```html\n <auro-dialog>\n <span slot="header">Title</span>\n <div slot="content">Body content here</div>\n </auro-dialog>\n ```\n\n5. **Design tokens are CSS custom properties**\n ```bash\n npm install @aurodesignsystem/design-tokens\n ```\n ```css\n @import "@aurodesignsystem/design-tokens/dist/themes/CSSCustomProperties--bundled.css";\n ```\n Token naming: `--ds-basic-*` and `--ds-advanced-*` (e.g. `--ds-advanced-color-*`, `--ds-basic-color-*`)\n\n## Component Reference\n\n| Element Tag | Package | Description |\n|---|---|---|\n| `<auro-accordion>` | `@aurodesignsystem/auro-accordion` | Expandable content sections |\n| `<auro-alert>` | `@aurodesignsystem/auro-alert` | Inline status messages: error, warning, success, information |\n| `<auro-avatar>` | `@aurodesignsystem/auro-avatar` | User or entity avatar |\n| `<auro-background>` | `@aurodesignsystem/auro-background` | Themed background wrapper |\n| `<auro-backtotop>` | `@aurodesignsystem/auro-backtotop` | Scroll-to-top button |\n| `<auro-badge>` | `@aurodesignsystem/auro-badge` | Status or count badge |\n| `<auro-banner>` | `@aurodesignsystem/auro-banner` | Full-width promotional banner |\n| `<auro-button>` | `@aurodesignsystem/auro-button` | Interactive button; supports `loading`, `disabled`, `shape` |\n| `<auro-card>` | `@aurodesignsystem/auro-card` | Content card container |\n| `<auro-carousel>` | `@aurodesignsystem/auro-carousel` | Horizontally scrollable carousel |\n| `<auro-datetime>` | `@aurodesignsystem/auro-datetime` | Localized date and time formatting |\n| `<auro-dialog>` | `@aurodesignsystem/auro-dialog` | Modal dialog; slots: header, content, footer |\n| `<auro-drawer>` | `@aurodesignsystem/auro-drawer` | Slide-in panel; slots: header, content, footer |\n| `<auro-flight>` | `@aurodesignsystem/auro-flight` | Flight segment display (origin, destination, stops) |\n| `<auro-flightline>` | `@aurodesignsystem/auro-flightline` | Visual flight path/stop indicator |\n| `<auro-input>` | `@aurodesignsystem/auro-formkit` | Text input field |\n| `<auro-select>` | `@aurodesignsystem/auro-formkit` | Select/dropdown |\n| `<auro-datepicker>` | `@aurodesignsystem/auro-formkit` | Date picker input |\n| `<auro-combobox>` | `@aurodesignsystem/auro-formkit` | Combobox with search |\n| `<auro-checkbox>` | `@aurodesignsystem/auro-formkit` | Checkbox input |\n| `<auro-radio>` | `@aurodesignsystem/auro-formkit` | Radio button input |\n| `<auro-header>` | `@aurodesignsystem/auro-header` | Page/section heading |\n| `<auro-hyperlink>` | `@aurodesignsystem/auro-hyperlink` | Accessible anchor link |\n| `<auro-icon>` | `@aurodesignsystem/auro-icon` | Alaska Airlines icon: `category` + `name` attributes |\n| `<auro-loader>` | `@aurodesignsystem/auro-loader` | Loading spinner |\n| `<auro-lockup>` | `@aurodesignsystem/auro-lockup` | Image + text layout lockup |\n| `<auro-nav>` | `@aurodesignsystem/auro-nav` | Secondary navigation aid (relation to higher-level pages) |\n| `<auro-pane>` | `@aurodesignsystem/auro-pane` | Selectable shoulder dates with associated prices |\n| `<auro-popover>` | `@aurodesignsystem/auro-popover` | Tooltip-style popover |\n| `<auro-sidenav>` | `@aurodesignsystem/auro-sidenav` | Vertical side navigation |\n| `<auro-skeleton>` | `@aurodesignsystem/auro-skeleton` | Loading placeholder skeleton |\n| `<auro-slideshow>` | `@aurodesignsystem/auro-slideshow` | Image/content slideshow |\n| `<auro-table>` | `@aurodesignsystem/auro-table` | Accessible data table |\n| `<auro-tabs>` | `@aurodesignsystem/auro-tabs` | Tabbed content panels |\n| `<auro-tail>` | `@aurodesignsystem/auro-tail` | Alaska, Hawaiian, and partner airline tail graphics |\n| `<auro-toast>` | `@aurodesignsystem/auro-toast` | Transient notification toast |\n| `<auro-tokenlist>` | `@aurodesignsystem/auro-tokenlist` | Design token display utilities |\n\n## Common Patterns\n\n### Button (default, secondary, tertiary)\n```html\n<auro-button>Primary</auro-button>\n<auro-button variant="secondary">Secondary</auro-button>\n<auro-button variant="tertiary">Tertiary</auro-button>\n<auro-button loading>Saving...</auro-button>\n```\n\n### Alert\n```html\n<auro-alert type="success">Changes saved.</auro-alert>\n<auro-alert type="error">Something went wrong.</auro-alert>\n<auro-alert type="warning">Please review before continuing.</auro-alert>\n<auro-alert type="information">Your flight departs at 9am.</auro-alert>\n```\n\n### Form inputs (auro-formkit)\nauro-formkit has no root export \u2014 always import the specific sub-component.\nThe field label is a **slot**, not an attribute.\n```js\nimport "@aurodesignsystem/auro-formkit/auro-input";\nimport "@aurodesignsystem/auro-formkit/auro-select";\n```\n```html\n<auro-input required>\n <span slot="label">First name</span>\n</auro-input>\n<auro-select>\n <span slot="label">Seat preference</span>\n <auro-menu>\n <auro-menuoption value="window">Window</auro-menuoption>\n <auro-menuoption value="aisle">Aisle</auro-menuoption>\n </auro-menu>\n</auro-select>\n```\n\n### Icon\nSet `category` and `name`. Icon names are exact \u2014 check the icon library for the correct name.\n```html\n<auro-icon category="interface" name="arrow-right"></auro-icon>\n<auro-icon category="terminal" name="plane-side-fill"></auro-icon>\n```\n\n### Hyperlink\n```html\n<auro-hyperlink href="/flights">View flights</auro-hyperlink>\n<auro-hyperlink href="https://example.com" target="_blank">External link</auro-hyperlink>\n```\n\n### Dialog (modal)\n```js\ndocument.querySelector(\'#confirmDialog\').show();\n```\n```html\n<auro-dialog id="confirmDialog">\n <span slot="header">Confirm booking</span>\n <div slot="content">Are you sure you want to book this flight?</div>\n <div slot="footer">\n <auro-button>Confirm</auro-button>\n <auro-button variant="secondary">Cancel</auro-button>\n </div>\n</auro-dialog>\n```\n\n## Accessibility Notes\n- Use the `ariaLabel` slot on `<auro-button>` for icon-only buttons\n- `<auro-hyperlink>` adds rel="noopener noreferrer" automatically for external links\n- All `auro-formkit` components handle aria-invalid and error messaging built-in\n- All components meet WCAG 2.1 AA\n\n## Documentation\n- Component docs: https://auro.alaskaair.com\n- Component status: https://auro.alaskaair.com/component-status\n- Design tokens: https://auro.alaskaair.com/getting-started/developers/token-usage\n- Contributing: https://auro.alaskaair.com/getting-started/developers/contributing\n- GitHub: https://github.com/AlaskaAirlines\n';var Sa=Lo.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)").action(async r=>{if(r.output){let t=Ho(`Writing context to ${r.output}...`).start();try{let e=Go.resolve(process.cwd(),r.output);await Bo.writeFile(e,Ue,"utf-8"),t.succeed(`Auro context written to ${r.output}`),console.log(`
66
+ Paste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prime it on Auro components.`)}catch(e){let o=e instanceof Error?e.message:String(e);t.fail(`Failed to write context: ${o}`),process.exit(1)}}else process.stdout.write(Ue)});import{program as Uo}from"commander";var We=Uo.command("docs").description("Generate API documentation").option("-c, --cem","Generate Custom Elements Manifest (CEM) file",!1).option("-a, --api","Creates api md file from CEM",!1).option("-w, --watch","Watch for changes and rebuild docs",!1).option("-r, --readme-template <url>","URL to the README template file").option("--skip-readme","Skip README.md processing",!1);We=Z(We);var Pa=We.action(async r=>{r.cem&&await ne(),r.api&&await se(),await st(r),r.serve&&await it(r),r.watch&&await at(r)});import{program as Jo}from"commander";import{Octokit as qe}from"@octokit/rest";import*as ge from"azure-devops-node-api";import fe from"ora";var Wo=async r=>{let t=process.env.GH_TOKEN;if(!t)throw new Error("GH_TOKEN environment variable is required");let e=new qe({auth:t}),o,n,s;if(r.includes("github.com")){let a=r.match(/github\.com\/([^\/]+)\/([^\/]+)\/issues\/(\d+)/);if(!a)throw new Error("Invalid GitHub issue URL format");[,o,n,s]=a}else if(r.includes("#")){let a=r.match(/([^\/]+)\/([^#]+)#(\d+)/);if(!a)throw new Error("Invalid GitHub issue reference format");[,o,n,s]=a}else throw new Error("Issue must be provided as full URL or in format 'owner/repo#number'");let i=Number.parseInt(s,10);try{let{data:a}=await e.rest.issues.get({owner:o,repo:n,issue_number:i});return{title:a.title,body:a.body??null,html_url:a.html_url,number:a.number,repository:{owner:{login:o},name:n}}}catch(a){throw new Error(`Failed to fetch GitHub issue: ${a}`)}},qo=async r=>{let t=process.env.GH_TOKEN;if(!t)return null;let e=new qe({auth:t});try{let o=`
67
67
  query($owner: String!, $repo: String!, $issueNumber: Int!) {
68
68
  repository(owner: $owner, name: $repo) {
69
69
  issue(number: $issueNumber) {
@@ -89,7 +89,7 @@ Paste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prim
89
89
  }
90
90
  }
91
91
  }
92
- `,n={owner:r.repository.owner.login,repo:r.repository.name,issueNumber:r.number},i=(await e.graphql(o,n)).repository.issue.projectItems.nodes.find(a=>a.project.number===19);if(i){let a=i.fieldValues.nodes.find(l=>l.field?.name?.toLowerCase()==="ado"&&l.text?.trim());if(a?.text?.trim())return a.text.trim()}return null}catch(o){return console.error(`Failed to check existing ADO link: ${o}`),null}},qo=async(r,t)=>{let e=process.env.GH_TOKEN;if(!e)throw new Error("GH_TOKEN environment variable is required");let o=new ze({auth:e}),n=19;try{let s=`
92
+ `,n={owner:r.repository.owner.login,repo:r.repository.name,issueNumber:r.number},i=(await e.graphql(o,n)).repository.issue.projectItems.nodes.find(a=>a.project.number===19);if(i){let a=i.fieldValues.nodes.find(l=>l.field?.name?.toLowerCase()==="ado"&&l.text?.trim());if(a?.text?.trim())return a.text.trim()}return null}catch(o){return console.error(`Failed to check existing ADO link: ${o}`),null}},zo=async(r,t)=>{let e=process.env.GH_TOKEN;if(!e)throw new Error("GH_TOKEN environment variable is required");let o=new qe({auth:e}),n=19;try{let s=`
93
93
  query($org: String!, $projectNumber: Int!, $owner: String!, $repo: String!, $issueNumber: Int!) {
94
94
  organization(login: $org) {
95
95
  projectV2(number: $projectNumber) {
@@ -156,4 +156,4 @@ Paste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prim
156
156
  }
157
157
  }
158
158
  }
159
- `,{projectId:l,itemId:c,fieldId:u.id,value:t});else if(!u)throw new Error("No 'ado' field found in GitHub project")}catch(s){console.error(`Failed to update GitHub project: ${s}`)}},Vo=async r=>{let t=process.env.ADO_TOKEN;if(!t)throw new Error("ADO_TOKEN environment variable is required");let e="https://dev.azure.com/itsals",o="E_Retain_Content",n="E_Retain_Content\\Auro Design System",s=ge.getPersonalAccessTokenHandler(t),a=await new ge.WebApi(e,s).getWorkItemTrackingApi();try{let l=[{op:"add",path:"/fields/System.Title",value:r.title},{op:"add",path:"/fields/System.Description",value:`GitHub Issue: <a href="${r.html_url}">${r.html_url}</a>`},{op:"add",path:"/fields/System.AreaPath",value:n}];return await a.createWorkItem(null,l,o,"User Story")}catch(l){throw new Error(`Failed to create ADO work item: ${l}`)}},Ut=async r=>{let t=fe(`Processing GitHub issue: ${r}`).start();try{if(!process.env.GH_TOKEN)throw new Error("GH_TOKEN environment variable is required");if(!process.env.ADO_TOKEN)throw new Error("ADO_TOKEN environment variable is required");t.text="Fetching GitHub issue details...";let e=await Wo(r);t.succeed(`Found issue: "${e.title}"`);let o=fe("Checking for existing ADO work item...").start(),n=await zo(e);if(n){o.succeed("ADO work item already exists for this issue!"),console.log(`${n}`);return}o.succeed("No existing ADO work item found");let s=fe("Creating new ADO work item...").start(),i=await Vo(e);if(s.succeed(`Successfully created ADO work item #${i.id}`),console.log(`Work item: ${i._links?.html?.href||"N/A"}`),i._links?.html?.href){let a=fe("Adding to GitHub project and updating ADO field...").start();await qo(e,i._links.html.href),a.succeed("Updated GitHub project with ADO link")}}catch(e){t.fail(`Error: ${e instanceof Error?e.message:e}`),process.exit(1)}};var Ba=Jo.command("ado").description("Generate ADO item from GitHub issue").option("-g, --gh-issue <issue>","What GitHub issue to use").action(async r=>{r.ghIssue&&await Ut(r.ghIssue)});import{program as Zo}from"commander";import{Octokit as Ko}from"@octokit/rest";import{simpleGit as Yo}from"simple-git";var Wt="Release Candidate",J="dev",Xo="main",he=class r{constructor(t,e,o){this.filteredCommits=null;this.repoInfo={owner:t,repo:e},this.octokit=o}static async create(){let t=process.env.GITHUB_TOKEN;if(!t)throw new Error("GITHUB_TOKEN is required to run RC workflow.");let e=await R.getRepoOwnerAndName(),o=new Ko({auth:t});if(!e)throw new Error("Failed to retrieve repository information. Ensure you're in a valid git repository.");let n=await r.getTriggerBranchName();return n&&n!==J&&(console.log(`Switching from ${n} to ${J} branch...`),await Yo().checkout(J)),new r(e.owner,e.repo,o)}get owner(){return this.repoInfo.owner}get repo(){return this.repoInfo.repo}get repoData(){return{...this.repoInfo}}async createReleaseCandidate(){await this.hasCommitsReadyInDev()||console.log("No filtered commits found. Continuing to update RC issue/branch/PR.");let e=await this.getLatestOpenRcIssue(),o=e?await this.getLinkedPrByHead(e.number):null;if(o?.multipleOpen)throw new Error("Multiple open RC PRs found for the same rc/<issueNumber> branch.");if(o?.state==="closed"&&(console.log("Linked RC PR is closed. Creating a new RC issue and PR."),e=await this.createRcIssue(),o=null),e?await this.updateRcIssue(e.number):e=await this.createRcIssue(),!e)throw new Error("Failed to resolve RC issue.");await this.createOrUpdateRcBranch(e.number),o?await this.updateRcPr(e.number,o.number):o=await this.createRcPr(e.number)}async getFilteredCommits(){if(this.filteredCommits===null){let t=await R.getCommitMessages(J);this.filteredCommits=Fe(t)}return this.filteredCommits}async hasCommitsReadyInDev(){return(await this.getFilteredCommits()).length>0}async getLatestOpenRcIssue(){let{data:t}=await this.octokit.rest.issues.listForRepo({owner:this.repoInfo.owner,repo:this.repoInfo.repo,labels:Wt,state:"open",sort:"updated",direction:"desc",per_page:30}),e=t.filter(n=>!n.pull_request);if(e.length===0)return console.log(`No open Release Candidate issues found in ${this.repoInfo.repo}`),null;let o=e[0];return console.log(`Using latest open Release Candidate issue: #${o.number}`),{number:o.number,title:o.title||""}}async updateRcIssue(t){let e=await this.getReleaseNotes(),o=`RC ${this.getCurrentDate()}`;await this.octokit.rest.issues.update({owner:this.repoInfo.owner,repo:this.repoInfo.repo,issue_number:t,title:o,body:e})}async createRcIssue(){let t=await this.getReleaseNotes(),{data:e}=await this.octokit.rest.issues.create({owner:this.repoInfo.owner,repo:this.repoInfo.repo,title:`RC ${this.getCurrentDate()}`,labels:[Wt],body:t});return console.log(`Created Release Candidate issue: #${e.number} (${e.html_url})`),{number:e.number,html_url:e.html_url}}async createOrUpdateRcBranch(t){let e=`heads/rc/${t}`,o=`rc/${t}`,{data:n}=await this.octokit.rest.repos.getBranch({owner:this.repoInfo.owner,repo:this.repoInfo.repo,branch:J}),{data:s}=await this.octokit.rest.git.listMatchingRefs({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:e}),i=s.length>0;try{i?(console.log(`Updating existing RC branch: ${o}`),await this.octokit.rest.git.updateRef({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:e,sha:n.commit.sha,force:!0})):(console.log(`Creating new RC branch: ${o}`),await this.octokit.rest.git.createRef({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:`refs/${e}`,sha:n.commit.sha}))}catch(a){throw new Error(`Failed to create or update ${o} branch: ${a}`)}}async getLinkedPrByHead(t){let e=`${this.repoInfo.owner}:rc/${t}`,{data:o}=await this.octokit.rest.pulls.list({owner:this.repoInfo.owner,repo:this.repoInfo.repo,state:"all",head:e,per_page:30}),n=o.filter(i=>i.state==="open");if(n.length>1)return{state:"open",multipleOpen:!0};if(n.length===1)return{state:"open",html_url:n[0].html_url,number:n[0].number};let s=o.filter(i=>i.state==="closed");return s.length>0?{state:"closed",html_url:s[0].html_url,number:s[0].number}:null}async fetchPrTemplate(t){try{let{data:e}=await this.octokit.rest.repos.getContent({owner:this.repoInfo.owner,repo:this.repoInfo.repo,path:".github/PULL_REQUEST_TEMPLATE.md"});if("content"in e&&e.type==="file"){let o=Buffer.from(e.content,"base64").toString("utf-8");return o=o.replace("Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.",`Release candidate pull request. See issue #${t} for details.`),o=o.replace(/<details>/g,"<details open>"),o}}catch(e){e&&typeof e=="object"&&"status"in e&&e.status===404?console.log("No PR template found in repo, using default message."):console.warn("Failed to fetch PR template:",e)}return`Release candidate pull request. See issue #${t} for details.`}async createRcPr(t){try{let e=await this.fetchPrTemplate(t),{data:o}=await this.octokit.request(`POST /repos/${this.repoInfo.owner}/${this.repoInfo.repo}/pulls`,{owner:this.repoInfo.owner,repo:this.repoInfo.repo,title:`RC #${t}`,body:e,head:`rc/${t}`,base:Xo,headers:{"X-GitHub-Api-Version":"2022-11-28"}});return console.log(`Created Release Candidate pull request: #${o.number} (${o.html_url})`),{state:"open",html_url:o.html_url,number:o.number}}catch(e){throw console.error("Failed to create RC PR:",e),e}}async updateRcPr(t,e){try{let o=await this.fetchPrTemplate(t);await this.octokit.rest.pulls.update({owner:this.repoInfo.owner,repo:this.repoInfo.repo,pull_number:e,body:o}),console.log(`Updated Release Candidate pull request: #${e}`)}catch(o){throw console.error("Failed to update RC PR:",o),o}}async getReleaseNotes(){let t=await this.getFilteredCommits();return je(t,!1)}static async getTriggerBranchName(){return process.env.GITHUB_REF_NAME?process.env.GITHUB_REF_NAME:process.env.GITHUB_REF?.startsWith("refs/heads/")?process.env.GITHUB_REF.replace("refs/heads/",""):R.getCurrentBranchName()}getCurrentDate(){return new Date().toISOString().split("T")[0]}};var Ja=Zo.command("rc-workflow").description("Generate RC issue and pull request").action(async()=>{await(await he.create()).createReleaseCandidate()});qe.name("auro").version(ye()).description("A cli tool to support the Auro Design System");qe.addHelpText("beforeAll",Ve());qe.parse();
159
+ `,{projectId:l,itemId:c,fieldId:u.id,value:t});else if(!u)throw new Error("No 'ado' field found in GitHub project")}catch(s){console.error(`Failed to update GitHub project: ${s}`)}},Vo=async r=>{let t=process.env.ADO_TOKEN;if(!t)throw new Error("ADO_TOKEN environment variable is required");let e="https://dev.azure.com/itsals",o="E_Retain_Content",n="E_Retain_Content\\Auro Design System",s=ge.getPersonalAccessTokenHandler(t),a=await new ge.WebApi(e,s).getWorkItemTrackingApi();try{let l=[{op:"add",path:"/fields/System.Title",value:r.title},{op:"add",path:"/fields/System.Description",value:`GitHub Issue: <a href="${r.html_url}">${r.html_url}</a>`},{op:"add",path:"/fields/System.AreaPath",value:n}];return await a.createWorkItem(null,l,o,"User Story")}catch(l){throw new Error(`Failed to create ADO work item: ${l}`)}},Ut=async r=>{let t=fe(`Processing GitHub issue: ${r}`).start();try{if(!process.env.GH_TOKEN)throw new Error("GH_TOKEN environment variable is required");if(!process.env.ADO_TOKEN)throw new Error("ADO_TOKEN environment variable is required");t.text="Fetching GitHub issue details...";let e=await Wo(r);t.succeed(`Found issue: "${e.title}"`);let o=fe("Checking for existing ADO work item...").start(),n=await qo(e);if(n){o.succeed("ADO work item already exists for this issue!"),console.log(`${n}`);return}o.succeed("No existing ADO work item found");let s=fe("Creating new ADO work item...").start(),i=await Vo(e);if(s.succeed(`Successfully created ADO work item #${i.id}`),console.log(`Work item: ${i._links?.html?.href||"N/A"}`),i._links?.html?.href){let a=fe("Adding to GitHub project and updating ADO field...").start();await zo(e,i._links.html.href),a.succeed("Updated GitHub project with ADO link")}}catch(e){t.fail(`Error: ${e instanceof Error?e.message:e}`),process.exit(1)}};var Ba=Jo.command("ado").description("Generate ADO item from GitHub issue").option("-g, --gh-issue <issue>","What GitHub issue to use").action(async r=>{r.ghIssue&&await Ut(r.ghIssue)});import{program as Zo}from"commander";import{Octokit as Ko}from"@octokit/rest";import{simpleGit as Yo}from"simple-git";var Wt="Release Candidate",J="dev",Xo="main",he=class r{constructor(t,e,o){this.filteredCommits=null;this.repoInfo={owner:t,repo:e},this.octokit=o}static async create(){let t=process.env.GITHUB_TOKEN;if(!t)throw new Error("GITHUB_TOKEN is required to run RC workflow.");let e=await R.getRepoOwnerAndName(),o=new Ko({auth:t});if(!e)throw new Error("Failed to retrieve repository information. Ensure you're in a valid git repository.");let n=await r.getTriggerBranchName();return n&&n!==J&&(console.log(`Switching from ${n} to ${J} branch...`),await Yo().checkout(J)),new r(e.owner,e.repo,o)}get owner(){return this.repoInfo.owner}get repo(){return this.repoInfo.repo}get repoData(){return{...this.repoInfo}}async createReleaseCandidate(){await this.hasCommitsReadyInDev()||console.log("No filtered commits found. Continuing to update RC issue/branch/PR.");let e=await this.getLatestOpenRcIssue(),o=e?await this.getLinkedPrByHead(e.number):null;if(o?.multipleOpen)throw new Error("Multiple open RC PRs found for the same rc/<issueNumber> branch.");if(o?.state==="closed"&&(console.log("Linked RC PR is closed. Creating a new RC issue and PR."),e=await this.createRcIssue(),o=null),e?await this.updateRcIssue(e.number):e=await this.createRcIssue(),!e)throw new Error("Failed to resolve RC issue.");await this.createOrUpdateRcBranch(e.number),o?await this.updateRcPr(e.number,o.number):o=await this.createRcPr(e.number)}async getFilteredCommits(){if(this.filteredCommits===null){let t=await R.getCommitMessages(J);this.filteredCommits=Fe(t)}return this.filteredCommits}async hasCommitsReadyInDev(){return(await this.getFilteredCommits()).length>0}async getLatestOpenRcIssue(){let{data:t}=await this.octokit.rest.issues.listForRepo({owner:this.repoInfo.owner,repo:this.repoInfo.repo,labels:Wt,state:"open",sort:"updated",direction:"desc",per_page:30}),e=t.filter(n=>!n.pull_request);if(e.length===0)return console.log(`No open Release Candidate issues found in ${this.repoInfo.repo}`),null;let o=e[0];return console.log(`Using latest open Release Candidate issue: #${o.number}`),{number:o.number,title:o.title||""}}async updateRcIssue(t){let e=await this.getReleaseNotes(),o=`RC ${this.getCurrentDate()}`;await this.octokit.rest.issues.update({owner:this.repoInfo.owner,repo:this.repoInfo.repo,issue_number:t,title:o,body:e})}async createRcIssue(){let t=await this.getReleaseNotes(),{data:e}=await this.octokit.rest.issues.create({owner:this.repoInfo.owner,repo:this.repoInfo.repo,title:`RC ${this.getCurrentDate()}`,labels:[Wt],body:t});return console.log(`Created Release Candidate issue: #${e.number} (${e.html_url})`),{number:e.number,html_url:e.html_url}}async createOrUpdateRcBranch(t){let e=`heads/rc/${t}`,o=`rc/${t}`,{data:n}=await this.octokit.rest.repos.getBranch({owner:this.repoInfo.owner,repo:this.repoInfo.repo,branch:J}),{data:s}=await this.octokit.rest.git.listMatchingRefs({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:e}),i=s.length>0;try{i?(console.log(`Updating existing RC branch: ${o}`),await this.octokit.rest.git.updateRef({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:e,sha:n.commit.sha,force:!0})):(console.log(`Creating new RC branch: ${o}`),await this.octokit.rest.git.createRef({owner:this.repoInfo.owner,repo:this.repoInfo.repo,ref:`refs/${e}`,sha:n.commit.sha}))}catch(a){throw new Error(`Failed to create or update ${o} branch: ${a}`)}}async getLinkedPrByHead(t){let e=`${this.repoInfo.owner}:rc/${t}`,{data:o}=await this.octokit.rest.pulls.list({owner:this.repoInfo.owner,repo:this.repoInfo.repo,state:"all",head:e,per_page:30}),n=o.filter(i=>i.state==="open");if(n.length>1)return{state:"open",multipleOpen:!0};if(n.length===1)return{state:"open",html_url:n[0].html_url,number:n[0].number};let s=o.filter(i=>i.state==="closed");return s.length>0?{state:"closed",html_url:s[0].html_url,number:s[0].number}:null}async fetchPrTemplate(t){try{let{data:e}=await this.octokit.rest.repos.getContent({owner:this.repoInfo.owner,repo:this.repoInfo.repo,path:".github/PULL_REQUEST_TEMPLATE.md"});if("content"in e&&e.type==="file"){let o=Buffer.from(e.content,"base64").toString("utf-8");return o=o.replace("Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.",`Release candidate pull request. See issue #${t} for details.`),o=o.replace(/<details>/g,"<details open>"),o}}catch(e){e&&typeof e=="object"&&"status"in e&&e.status===404?console.log("No PR template found in repo, using default message."):console.warn("Failed to fetch PR template:",e)}return`Release candidate pull request. See issue #${t} for details.`}async createRcPr(t){try{let e=await this.fetchPrTemplate(t),{data:o}=await this.octokit.request(`POST /repos/${this.repoInfo.owner}/${this.repoInfo.repo}/pulls`,{owner:this.repoInfo.owner,repo:this.repoInfo.repo,title:`RC #${t}`,body:e,head:`rc/${t}`,base:Xo,headers:{"X-GitHub-Api-Version":"2022-11-28"}});return console.log(`Created Release Candidate pull request: #${o.number} (${o.html_url})`),{state:"open",html_url:o.html_url,number:o.number}}catch(e){throw console.error("Failed to create RC PR:",e),e}}async updateRcPr(t,e){try{let o=await this.fetchPrTemplate(t);await this.octokit.rest.pulls.update({owner:this.repoInfo.owner,repo:this.repoInfo.repo,pull_number:e,body:o}),console.log(`Updated Release Candidate pull request: #${e}`)}catch(o){throw console.error("Failed to update RC PR:",o),o}}async getReleaseNotes(){let t=await this.getFilteredCommits();return je(t,!1)}static async getTriggerBranchName(){return process.env.GITHUB_REF_NAME?process.env.GITHUB_REF_NAME:process.env.GITHUB_REF?.startsWith("refs/heads/")?process.env.GITHUB_REF.replace("refs/heads/",""):R.getCurrentBranchName()}getCurrentDate(){return new Date().toISOString().split("T")[0]}};var Ja=Zo.command("rc-workflow").description("Generate RC issue and pull request").action(async()=>{await(await he.create()).createReleaseCandidate()});ze.name("auro").version(ye()).description("A cli tool to support the Auro Design System");ze.addHelpText("beforeAll",Ve());ze.parse();