@codecademy/gamut 68.6.1-alpha.e6c390.0 → 68.6.1-alpha.f6b2ce.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/agent-tools/.cursor-plugin/plugin.json +1 -1
  2. package/agent-tools/DESIGN.Codecademy.md +239 -191
  3. package/agent-tools/DESIGN.LXStudio.md +236 -184
  4. package/agent-tools/DESIGN.Percipio.md +232 -182
  5. package/agent-tools/DESIGN.md +1 -1
  6. package/agent-tools/commands/gamut-review.md +176 -87
  7. package/agent-tools/guidelines/components/animations.md +74 -0
  8. package/agent-tools/guidelines/components/buttons.md +74 -23
  9. package/agent-tools/guidelines/components/card.md +19 -0
  10. package/agent-tools/guidelines/components/coachmark.md +21 -0
  11. package/agent-tools/guidelines/components/data-table.md +79 -0
  12. package/agent-tools/guidelines/components/forms.md +106 -0
  13. package/agent-tools/guidelines/components/loading-states.md +17 -0
  14. package/agent-tools/guidelines/components/menu.md +58 -0
  15. package/agent-tools/guidelines/components/overview.md +97 -17
  16. package/agent-tools/guidelines/components/radial-progress.md +13 -0
  17. package/agent-tools/guidelines/components/select.md +23 -0
  18. package/agent-tools/guidelines/components/tooltips.md +22 -0
  19. package/agent-tools/guidelines/components/video.md +29 -0
  20. package/agent-tools/guidelines/foundations/color.md +140 -58
  21. package/agent-tools/guidelines/foundations/modes.md +39 -17
  22. package/agent-tools/guidelines/foundations/spacing.md +78 -37
  23. package/agent-tools/guidelines/foundations/typography.md +69 -37
  24. package/agent-tools/guidelines/overview-icons.md +19 -0
  25. package/agent-tools/guidelines/overview-illustrations.md +7 -0
  26. package/agent-tools/guidelines/overview-patterns.md +7 -0
  27. package/agent-tools/guidelines/overview.md +69 -23
  28. package/agent-tools/guidelines/setup.md +59 -18
  29. package/agent-tools/rules/accessibility.mdc +22 -13
  30. package/agent-tools/skills/gamut-accessibility/SKILL.md +97 -112
  31. package/agent-tools/skills/gamut-color-mode/SKILL.md +79 -29
  32. package/agent-tools/skills/gamut-components/SKILL.md +46 -0
  33. package/agent-tools/skills/gamut-forms/SKILL.md +101 -0
  34. package/agent-tools/skills/gamut-style-utilities/SKILL.md +111 -0
  35. package/agent-tools/skills/gamut-system-props/SKILL.md +70 -26
  36. package/agent-tools/skills/gamut-testing/SKILL.md +106 -62
  37. package/agent-tools/skills/gamut-theming/SKILL.md +34 -86
  38. package/agent-tools/skills/gamut-typography/SKILL.md +36 -80
  39. package/bin/commands/plugin/install.mjs +96 -56
  40. package/bin/commands/plugin/list.mjs +11 -43
  41. package/bin/commands/plugin/remove.mjs +30 -38
  42. package/bin/commands/plugin/update.mjs +15 -5
  43. package/bin/gamut.mjs +17 -13
  44. package/bin/lib/design.mjs +71 -0
  45. package/bin/lib/io.mjs +14 -0
  46. package/package.json +6 -6
  47. package/bin/lib/figma.mjs +0 -49
@@ -0,0 +1,71 @@
1
+ import { copyFile, stat } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+
4
+ /** @type {Record<string, { sourceFile: string, label: string }>} */
5
+ const THEME_ALIASES = {
6
+ core: { sourceFile: 'DESIGN.Codecademy.md', label: 'Codecademy (Core)' },
7
+ codecademy: {
8
+ sourceFile: 'DESIGN.Codecademy.md',
9
+ label: 'Codecademy (Core)',
10
+ },
11
+ cc: { sourceFile: 'DESIGN.Codecademy.md', label: 'Codecademy (Core)' },
12
+ admin: { sourceFile: 'DESIGN.Codecademy.md', label: 'Codecademy (Admin)' },
13
+ platform: {
14
+ sourceFile: 'DESIGN.Codecademy.md',
15
+ label: 'Codecademy (Platform)',
16
+ },
17
+ percipio: { sourceFile: 'DESIGN.Percipio.md', label: 'Percipio' },
18
+ lxstudio: { sourceFile: 'DESIGN.LXStudio.md', label: 'LX Studio' },
19
+ 'lx-studio': { sourceFile: 'DESIGN.LXStudio.md', label: 'LX Studio' },
20
+ };
21
+
22
+ const CANONICAL_THEMES = ['core', 'admin', 'platform', 'percipio', 'lxstudio'];
23
+
24
+ /**
25
+ * @param {string} name
26
+ * @returns {{ sourceFile: string, label: string, alias: string }}
27
+ */
28
+ export function resolveTheme(name) {
29
+ const alias = name.trim().toLowerCase();
30
+ const entry = THEME_ALIASES[alias];
31
+ if (!entry) {
32
+ throw new Error(
33
+ `Unknown theme: "${name}". Choose from: ${CANONICAL_THEMES.join(', ')} ` +
34
+ `(aliases: codecademy, cc, lx-studio, …).`
35
+ );
36
+ }
37
+ return { ...entry, alias };
38
+ }
39
+
40
+ /** @returns {string[]} */
41
+ export function listCanonicalThemes() {
42
+ return [...CANONICAL_THEMES];
43
+ }
44
+
45
+ /**
46
+ * @param {string} sourceRoot agent-tools directory
47
+ * @param {string} cwd destination directory (app repo root)
48
+ * @param {string} theme
49
+ * @param {{ force?: boolean }} [options]
50
+ * @returns {Promise<{ dest: string, label: string }>}
51
+ */
52
+ export async function installDesignMd(sourceRoot, cwd, theme, options = {}) {
53
+ const { sourceFile, label } = resolveTheme(theme);
54
+ const src = join(sourceRoot, sourceFile);
55
+ const dest = join(cwd, 'DESIGN.md');
56
+
57
+ const srcStat = await stat(src).catch(() => null);
58
+ if (!srcStat?.isFile()) {
59
+ throw new Error(`DESIGN source not found: ${src}`);
60
+ }
61
+
62
+ const destStat = await stat(dest).catch(() => null);
63
+ if (destStat?.isFile() && !options.force) {
64
+ throw new Error(
65
+ `DESIGN.md already exists at ${dest}. Use --force to overwrite, or remove it first.`
66
+ );
67
+ }
68
+
69
+ await copyFile(src, dest);
70
+ return { dest, label };
71
+ }
package/bin/lib/io.mjs ADDED
@@ -0,0 +1,14 @@
1
+ /** @param {string} message */
2
+ export function log(message) {
3
+ process.stdout.write(message.endsWith('\n') ? message : `${message}\n`);
4
+ }
5
+
6
+ /** @param {string} message */
7
+ export function warn(message) {
8
+ process.stderr.write(message.endsWith('\n') ? message : `${message}\n`);
9
+ }
10
+
11
+ /** @param {string} message */
12
+ export function error(message) {
13
+ process.stderr.write(message.endsWith('\n') ? message : `${message}\n`);
14
+ }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@codecademy/gamut",
3
3
  "description": "Styleguide & Component library for Codecademy",
4
- "version": "68.6.1-alpha.e6c390.0",
4
+ "version": "68.6.1-alpha.f6b2ce.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "bin": "./bin/gamut.mjs",
7
7
  "dependencies": {
8
- "@codecademy/gamut-icons": "9.57.6-alpha.e6c390.0",
9
- "@codecademy/gamut-illustrations": "0.58.12-alpha.e6c390.0",
10
- "@codecademy/gamut-patterns": "0.10.31-alpha.e6c390.0",
11
- "@codecademy/gamut-styles": "18.0.1-alpha.e6c390.0",
12
- "@codecademy/variance": "0.26.2-alpha.e6c390.0",
8
+ "@codecademy/gamut-icons": "9.57.6-alpha.f6b2ce.0",
9
+ "@codecademy/gamut-illustrations": "0.58.12-alpha.f6b2ce.0",
10
+ "@codecademy/gamut-patterns": "0.10.31-alpha.f6b2ce.0",
11
+ "@codecademy/gamut-styles": "18.0.1-alpha.f6b2ce.0",
12
+ "@codecademy/variance": "0.26.2-alpha.f6b2ce.0",
13
13
  "@formatjs/intl-locale": "5.3.1",
14
14
  "@react-aria/interactions": "3.25.0",
15
15
  "@types/marked": "^4.0.8",
package/bin/lib/figma.mjs DELETED
@@ -1,49 +0,0 @@
1
- import { stat } from 'node:fs/promises';
2
- import { dirname, join, resolve } from 'node:path';
3
-
4
- /**
5
- * Walk up from `startDir` looking for a `figma.config.json` file.
6
- * Returns the directory containing it, or null if not found before the filesystem root.
7
- *
8
- * @param {string} startDir
9
- * @returns {Promise<string | null>}
10
- */
11
- export async function findFigmaConfigDir(startDir) {
12
- let dir = startDir;
13
- while (true) {
14
- const st = await stat(join(dir, 'figma.config.json')).catch(() => null);
15
- if (st?.isFile()) return dir;
16
- const parent = dirname(dir);
17
- if (parent === dir) return null;
18
- dir = parent;
19
- }
20
- }
21
-
22
- /**
23
- * Resolves the destination directory for the guidelines/ folder.
24
- *
25
- * Priority:
26
- * 1. --output <path> if provided (treated as the parent directory)
27
- * 2. Directory containing the nearest figma.config.json (walking up from cwd)
28
- *
29
- * Throws with actionable guidance if neither resolves.
30
- *
31
- * @param {string | undefined} outputArg
32
- * @returns {Promise<{ path: string; discovered: boolean }>}
33
- */
34
- export async function resolveFigmaOutput(outputArg) {
35
- if (outputArg) {
36
- return { path: resolve(outputArg), discovered: false };
37
- }
38
-
39
- const dir = await findFigmaConfigDir(process.cwd());
40
- if (dir) {
41
- return { path: join(dir, 'guidelines'), discovered: true };
42
- }
43
-
44
- throw new Error(
45
- `Could not find figma.config.json in ${process.cwd()} or any parent directory.\n` +
46
- `Provide the destination explicitly with --output:\n` +
47
- ` gamut plugin install figma --output /path/to/your/project/guidelines`,
48
- );
49
- }