From e23c847a11007445d46217ab34efadc0251b79c3 Mon Sep 17 00:00:00 2001 From: Lindsey O'Sullivan Date: Tue, 7 Jul 2026 15:26:05 -0700 Subject: [PATCH 1/5] feat(context): add auro context command for AI assistant onboarding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a new 'auro context' command that prints an AI-ready context document describing the Auro Design System — component list, package names, usage patterns, and rules — for priming AI coding assistants (Claude, Cursor, Copilot, etc.). - src/static/auroContext.ts: the context document, exposed via a new #static/* import alias - src/commands/context.ts: the command, supporting stdout and --output - Wires #static/* into package.json imports, tsconfig paths, and the esbuild build config - Documents the command in the README Inspired by prior art in Meta's Astryx design system (npx astryx init). --- README.md | 21 +++++ build-scripts/build-config.js | 1 + package.json | 1 + src/commands/context.ts | 35 ++++++++ src/index.ts | 1 + src/static/auroContext.ts | 164 ++++++++++++++++++++++++++++++++++ tsconfig.json | 1 + 7 files changed, 224 insertions(+) create mode 100644 src/commands/context.ts create mode 100644 src/static/auroContext.ts 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..20372a5 --- /dev/null +++ b/src/static/auroContext.ts @@ -0,0 +1,164 @@ +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** + - ✗ \`