diff --git a/README.md b/README.md index edbad6d..2aae1fc 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,24 @@ Open the server to a specific directory: ``` auro dev --open src/ ``` + +`auro context` +Prints an AI-ready context document describing the Auro Design System, its components, and usage patterns. Designed to be piped into or pasted into AI coding assistants (Claude, Cursor, Copilot, etc.) to prime them on Auro. + +#### Options + +- `-o, --output ` Write the context document to a file instead of stdout (e.g. `AURO_CONTEXT.md`). + +#### Examples + +Print the context to the terminal: + +``` +auro context +``` + +Write the context to a file for your AI tool: + +``` +auro context --output AURO_CONTEXT.md +``` diff --git a/build-scripts/build-config.js b/build-scripts/build-config.js index db5a0f6..12c63f8 100644 --- a/build-scripts/build-config.js +++ b/build-scripts/build-config.js @@ -46,6 +46,7 @@ export const aliases = { "#configs": resolve(projectRoot, "src/configs"), "#commands": resolve(projectRoot, "src/commands"), "#scripts": resolve(projectRoot, "src/scripts"), + "#static": resolve(projectRoot, "src/static"), "#utils": resolve(projectRoot, "src/utils"), }; diff --git a/package.json b/package.json index 9e8b9ca..ba10ff1 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "#configs/*": "./src/configs/*", "#commands/*": "./src/commands/*", "#scripts/*": "./src/scripts/*", + "#static/*": "./src/static/*", "#utils/*": "./src/utils/*" }, "publishConfig": { diff --git a/src/commands/context.ts b/src/commands/context.ts new file mode 100644 index 0000000..70bfd09 --- /dev/null +++ b/src/commands/context.ts @@ -0,0 +1,35 @@ +import fs from "node:fs/promises"; +import path from "node:path"; +import { program } from "commander"; +import ora from "ora"; +import { AURO_CONTEXT } from "#static/auroContext.js"; + +export default program + .command("context") + .description( + "Generate an AI assistant context document for the Auro Design System", + ) + .option( + "-o, --output ", + "Write context to a file instead of stdout (e.g. AURO_CONTEXT.md)", + ) + .action(async (options) => { + if (options.output) { + const spinner = ora(`Writing context to ${options.output}...`).start(); + try { + const outputPath = path.resolve(process.cwd(), options.output); + await fs.writeFile(outputPath, AURO_CONTEXT, "utf-8"); + spinner.succeed(`Auro context written to ${options.output}`); + console.log( + "\nPaste this file into your AI coding tool (Claude, Cursor, Copilot, etc.) to prime it on Auro components.", + ); + } catch (error) { + const message = + error instanceof Error ? error.message : String(error); + spinner.fail(`Failed to write context: ${message}`); + process.exit(1); + } + } else { + process.stdout.write(AURO_CONTEXT); + } + }); diff --git a/src/index.ts b/src/index.ts index cfe76e6..921c3a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,6 +12,7 @@ import "#commands/check-commits.ts"; import "#commands/pr-release.ts"; import "#commands/test.js"; import "#commands/agent.ts"; +import "#commands/context.ts"; import "#commands/docs.ts"; import "#commands/ado.ts"; import "#commands/rc-workflow.ts"; diff --git a/src/static/auroContext.ts b/src/static/auroContext.ts new file mode 100644 index 0000000..98a3008 --- /dev/null +++ b/src/static/auroContext.ts @@ -0,0 +1,171 @@ +export const AURO_CONTEXT = `# Auro Design System — AI Assistant Context +Alaska Airlines open-source design system | https://auro.alaskaair.com + +## What is Auro? +Auro is Alaska Airlines' design system built on Web Components (Custom Elements v1) using the Lit library. +- npm scope: \`@aurodesignsystem/\` (current), \`@alaskaairux/\` (legacy) +- Framework-agnostic: works with React, Angular, Vue, Svelte, or plain HTML +- Each component is a separate npm package +- All components use the \`\` custom element tag + +## Rules for Writing Auro Code + +1. **Use \`\` custom element tags — never plain HTML equivalents** + - ✗ \`