### Install asimonim from source using go install Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/installation.md Installs the latest version of asimonim from source using Go's install command. Requires Go. ```bash go install bennypowers.dev/asimonim@latest ``` -------------------------------- ### Check Asimonim Installation and LSP Help Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Verify asimonim is installed and in PATH, and check LSP help. ```bash which asimonim asimonim lsp --help ``` -------------------------------- ### Check Asimonim Installation and MCP Help Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Check that asimonim is installed and view MCP help. ```bash which asimonim asimonim mcp --help ``` -------------------------------- ### Install Asimonim Plugin Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Install the Asimonim plugin in Claude Code. ```claude-code /plugin install asimonim ``` -------------------------------- ### Examples of asimonim list commands Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/list.md Four example invocations: list all tokens as a table, output as JSON, generate CSS custom properties, and show only color tokens with resolved values. ```bash # List all tokens as a table asimonim list tokens.json ``` ```bash # Output as JSON asimonim list tokens.json --format json ``` ```bash # Generate CSS custom properties asimonim list tokens.json --format css ``` ```bash # Show only color tokens with resolved values asimonim list tokens.json --type color --resolved ``` -------------------------------- ### Install asimonim on Gentoo Linux via bennypowers overlay Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/installation.md Enables the bennypowers overlay, syncs it, and installs the dev-util/asimonim package. Requires eselect and emaint. ```bash eselect repository enable bennypowers emaint sync -r bennypowers emerge dev-util/asimonim ``` -------------------------------- ### Verify Asimonim Installation Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Verify the Asimonim installation. ```bash asimonim version ``` -------------------------------- ### asimonim convert command examples Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Examples of the asimonim convert command covering flattening, schema conversion, in-place updates, combining files, and generating output in JS, SCSS, Android, Swift, CSS, and snippet formats. Each command uses the --format flag to select the output type and additional flags like --js-module, --js-types, --js-export, --prefix, --css-selector, --css-module, and --snippet-type to customize the result. ```bash asimonim convert --flatten tokens/*.yaml -o flat.json ``` ```bash asimonim convert --schema v2025.10 tokens.yaml -o stable.json ``` ```bash asimonim convert --in-place --schema v2025.10 tokens/*.yaml ``` ```bash asimonim convert colors.yaml spacing.yaml -o combined.json ``` ```bash asimonim convert --format js -o tokens.ts tokens/*.yaml ``` ```bash asimonim convert --format js --js-module cjs -o tokens.cts tokens/*.yaml ``` ```bash asimonim convert --format js --js-types jsdoc -o tokens.js tokens/*.yaml ``` ```bash asimonim convert --format js --js-export map -o tokens.ts tokens/*.yaml ``` ```bash asimonim convert --format scss --prefix rh -o _tokens.scss tokens/*.yaml ``` ```bash asimonim convert --format android -o values/tokens.xml tokens/*.yaml ``` ```bash asimonim convert --format swift -o DesignTokens.swift tokens/*.yaml ``` ```bash asimonim convert --format css -o tokens.css tokens/*.yaml ``` ```bash asimonim convert --format css --css-selector :host -o tokens.css tokens/*.yaml ``` ```bash asimonim convert --format css --css-module lit -o tokens.css.ts tokens/*.yaml ``` ```bash asimonim convert --format snippets -o tokens.code-snippets tokens/*.yaml ``` ```bash asimonim convert --format snippets --snippet-type textmate -o tokens.tmSnippet tokens/*.yaml ``` ```bash asimonim convert --format snippets --snippet-type zed -o css.json tokens/*.yaml ``` -------------------------------- ### asimonim search command examples Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/search.md Four example invocations of the asimonim search command. They demonstrate searching by name or value, using regex with --name, filtering by token type with --type dimension, and outputting only names with --format names. ```bash # Search by name or value asimonim search "blue" tokens.json ``` ```bash # Search names only with regex asimonim search "^color\." tokens.json --name --regex ``` ```bash # Find all dimension tokens containing "spacing" asimonim search "spacing" tokens.json --type dimension ``` ```bash # Output matching token names only asimonim search "primary" tokens.json --format names ``` -------------------------------- ### Install asimonim globally via npm Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/installation.md Installs the asimonim package globally using npm. Requires Node.js and npm. ```bash npm install -g @pwrs/asimonim ``` -------------------------------- ### FileSystem Interface Usage Example Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md Shows the correct and incorrect ways to define a function that reads a file. The correct version accepts a FileSystem parameter, while the incorrect version uses os.ReadFile directly, which is discouraged. ```go // Good - accepts FileSystem func ParseFile(fs FileSystem, path string, opts Options) ([]*Token, error) // Bad - uses os directly func ParseFile(path string, opts Options) ([]*Token, error) { data, _ := os.ReadFile(path) // Don't do this } ``` -------------------------------- ### Multi-Schema Workspace Configuration Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/schemas.md Configuration example for the Asimonim language server to load multiple token files with different schema versions simultaneously. The tokensFiles array lists the paths to the token files. ```json { "designTokensLanguageServer": { "tokensFiles": [ "legacy/draft-tokens.json", "design-system/tokens.json" ] } } ``` -------------------------------- ### asimonim lsp command usage Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/lsp.md Starts the language server that communicates over stdin/stdout using JSON-RPC for editor integration. Usually launched by an editor extension rather than manually. ```text Usage: asimonim lsp ``` -------------------------------- ### asimonim validate examples Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/validate.md Examples of validating design token files with asimonim validate. Shows validating multiple files, forcing a schema version with --schema, and using --quiet for CI environments. ```bash # Validate multiple files asimonim validate colors.json spacing.json typography.json # Force a specific schema version asimonim validate tokens.json --schema v2025.10 # Quiet mode for CI asimonim validate tokens.json --quiet ``` -------------------------------- ### Group markers example with underscore Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Example token file using `groupMarkers: ["_"]` to allow a token to act as a group. Creates tokens `--color-red` and `--color-red-darker`. Only used with Editor's Draft schema; ignored for v2025.10 stable. ```json { "color": { "red": { "_": { "$value": "#FF0000", "$description": "Red color" }, "darker": { "$value": "#AA0000", "$description": "Darker red color" } } } } ``` -------------------------------- ### Update GitHub Actions workflow Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md GitHub Actions workflow step to build tokens using asimonim. Installs asimonim globally (or uses binary release), then runs convert and validate --strict. ```yaml - name: Build tokens run: | npm install -g asimonim # or use binary release asimonim convert asimonim validate --strict ``` -------------------------------- ### CSS format with --css-selector and --css-module options Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Two examples of the `css` format with options: `--css-selector :host` for Shadow DOM components and `--css-module lit` for Lit CSS tagged template literals. The `--css-selector` flag defaults to `:root`; `--css-module` has no default. ```bash # Shadow DOM components asimonim convert --format css --css-selector :host -o tokens.css tokens/*.yaml ``` ```bash # Lit CSS tagged template literal asimonim convert --format css --css-module lit -o tokens.css.ts tokens/*.yaml ``` -------------------------------- ### Update package.json exports Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Example package.json exports configuration showing per-category TypeScript exports that should still work after migration. ```json { "exports": { ".": "./js/tokens.js", "./animation.js": "./js/animation.js", "./border.js": "./js/border.js", "./color.js": "./js/color.js", ... } } ``` -------------------------------- ### Assert specific token output with comment Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md Example of a test assertion with a comment input for maintainability. Use strict string equality for specific token outputs, not strings.Contains. ```go // spacing.small: {value: 4, unit: "px"} → 4px if result != "4px" { t.Errorf(...) } ``` -------------------------------- ### Claude Code settings.json MCP server configuration Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/mcp.md Example configuration for Claude Code's settings.json that registers the asimonim MCP server. Sets the command to `asimonim` with argument `mcp`. ```json { "mcpServers": { "asimonim": { "command": "asimonim", "args": ["mcp"] } } } ``` -------------------------------- ### Snippets format with --snippet-type options Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Three examples of the `snippets` format with different `--snippet-type` values: `vscode` (default), `textmate`, and `zed`. Each produces a different file extension: `.code-snippets`, `.tmSnippet`, and `.json` respectively. ```bash # VSCode snippets (default) asimonim convert --format snippets -o tokens.code-snippets tokens/*.yaml ``` ```bash # TextMate snippets asimonim convert --format snippets --snippet-type textmate -o tokens.tmSnippet tokens/*.yaml ``` ```bash # Zed editor snippets asimonim convert --format snippets --snippet-type zed -o css.json tokens/*.yaml ``` -------------------------------- ### CLAUDE.md guidelines for Go, testing, FileSystem, logging, and Git Source: https://github.com/bennypowers/asimonim/blob/main/plans/00-research.md Project guidelines covering Go naming and idioms, testing with fixtures and goldens, FileSystem interface usage, logging, and Git commit conventions. Use this as a reference for contributing to the project. ```markdown ## Go Getter methods should be named `Foo()`, not `GetFoo()`. Use go 1.25+ features. Run `go vet` to surface gopls suggestions: - replace `interface{}` with `any` - replace `if/else` with `min` - replace `m[k]=v` loop with `maps.Copy` - use `slices.Contains` instead of manual loops ## Testing Practice TDD. Use fixture/golden patterns: - **Fixtures**: Input data in `testdata/` directories - **Goldens**: Expected output in `testdata/golden/` - Tests should support `--update` flag for golden regeneration **Always use `testutil.NewFixtureFS`** - never `NewOSFileSystem()` in tests. ### Fixture Structure Each test scenario is a subdirectory containing: - Input files (`.json`, `.yaml`) - `expected.json` for assertions ## FileSystem Interface Define `FileSystem` congruent with cem/mappa for duck typing: - Never use `os.ReadFile`, `os.Stat`, etc. directly - All disk-reading functions must accept FileSystem param - Use `NewOSFileSystem()` only at CLI entry point - Use `NewMapFileSystem()` in tests ## Logging Never pollute stdout. Use internal logging package for debug output. ## Git Always use `Assisted-By`, never `Co-Authored-By` for AI contributions. ``` -------------------------------- ### Configure Neovim LSP for Asimonim Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/editors.md Neovim LSP client configuration for the Asimonim language server. Place in a file like ~/.config/nvim/lsp/asimonim.lua. Uses root_markers { '.git', 'package.json' } to prefer .git over nested package.json files, which is important when tokens are in node_modules. ```lua ---@type vim.lsp.ClientConfig return { cmd = { 'asimonim', 'lsp' }, root_markers = { '.git', 'package.json' }, filetypes = { 'css', 'html', 'twig', 'php', 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'json', 'yaml' }, settings = { dtls = { tokensFiles = { { path = "~/path/to/tokens.json", prefix = "my-ds", }, }, groupMarkers = { '_', '@', 'DEFAULT' }, } }, on_attach = function(client, bufnr) if vim.lsp.document_color then vim.lsp.document_color.enable(true, bufnr, { style = 'virtual' }) end end, } ``` -------------------------------- ### Create MapFileSystem with testutil.NewFixtureFS Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md For lower-level tests that need a MapFileSystem directly, use testutil.NewFixtureFS to create an in-memory filesystem and parse a fixture file. This provides isolation, speed, reproducibility, parallelism, and integration with cem's testing infrastructure. ```go mfs := testutil.NewFixtureFS(t, "fixtures/draft/simple", "/test") tokens, err := parser.ParseFile(mfs, "/test/tokens.json", parser.Options{ SchemaVersion: schema.Draft, SkipPositions: true, }) if err != nil { t.Fatalf("failed to parse: %v", err) } ``` -------------------------------- ### asimonim convert command usage Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Shows the command-line usage and available flags for the convert command. Use this to understand the options for converting token files, including output format, prefix, flattening, delimiter, schema version, and in-place conversion. ```text Usage: asimonim convert [files...] Flags: -o, --output string Output file (default: stdout) -f, --format string Output format (default "dtcg") -p, --prefix string Prefix for output variable names --flatten Flatten to shallow structure (dtcg/json formats only) -d, --delimiter string Delimiter for flattened keys (default "-") -s, --schema string Force output schema version (draft, v2025.10) -i, --in-place Overwrite input files with converted output ``` -------------------------------- ### Asimonim commands using config files Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Commands that use files from the configuration file when no file arguments are provided. ```bash asimonim list # Uses files from config asimonim validate # Uses files from config ``` -------------------------------- ### Build and validate asimonim CLI Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md Build the project and run the asimonim validate command against a test fixture. Use this to check the CLI against the draft simple tokens fixture. ```shell $ make $ dist/bin/asimonim validate testdata/fixtures/draft/simple/tokens.json ``` -------------------------------- ### Usage and flags for asimonim list Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/list.md Shows the command usage and available flags: -s/--schema, --type, --resolved, --format, and --css. The default output format is "table". ```text Usage: asimonim list [files...] Flags: -s, --schema string Force schema version (draft, v2025.10) --type string Filter by token type --resolved Show resolved values (follow aliases) --format string Output format: table, json, css (default "table") --css Shorthand for --format css ``` -------------------------------- ### Display version information with asimonim version Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/version.md Shows the CLI version. The --format flag accepts text or json, with text as the default. ```text Usage: asimonim version Flags: --format string Output format: text, json (default "text") ``` -------------------------------- ### Load shared fixture and select tokens Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md Shows the recommended pattern for loading shared fixtures and selecting tokens by dot-path in tests. Use testutil.ParseFixtureTokens and testutil.TokenByPath to avoid inline test data. ```go func TestSomething(t *testing.T) { // Parse tokens from shared fixture allTokens := testutil.ParseFixtureTokens(t, "fixtures/v2025_10/all-color-spaces", schema.V2025_10) // Select tokens by dot-path tokens := []*token.Token{ testutil.TokenByPath(t, allTokens, "color.oklch"), // oklch [0.988281, 0.0046875, 20] testutil.TokenByPath(t, allTokens, "spacing.small"), // {value: 4, unit: "px"} } // Format and assert f := css.New() result, err := f.Format(tokens, formatter.Options{}) } ``` -------------------------------- ### Language server configuration in package.json Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Configuration for the language server in `package.json`, specifying prefix and token files with optional per-file prefix and group markers. ```json { "designTokensLanguageServer": { "prefix": "my-ds", "tokensFiles": [ "npm:@my-design-system/tokens/tokens.json", { "path": "npm:@his-design-system/tokens/tokens.json", "prefix": "his-ds", "groupMarkers": ["GROUP"] }, { "path": "./docs/docs-site-tokens.json", "prefix": "docs-site" } ] } } ``` -------------------------------- ### asimonim list CLI command Source: https://github.com/bennypowers/asimonim/blob/main/plans/00-research.md Lists tokens from files. Use --type to filter by token type, --resolved to show resolved values, --css to output as CSS custom properties, --swatch to show terminal color swatches, and --format to choose json, table, or css output. ```text asimonim list [files...] Flags: --type Filter by token type --resolved Show resolved values --css Output as CSS custom properties --swatch Show terminal color swatches --format json|table|css ``` -------------------------------- ### Validate and query design tokens with asimonim CLI Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/quick-start.md Shows the primary CLI commands for validating, listing, formatting, and searching design tokens in a tokens.json file. Use `--format css` to output CSS custom properties and `--type color` to filter search results by token type. ```bash # Validate token files asimonim validate tokens.json # List all tokens asimonim list tokens.json # Output as CSS custom properties asimonim list tokens.json --format css # Search for color tokens asimonim search "primary" tokens.json --type color ``` -------------------------------- ### Create .config/design-tokens.yaml Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Configuration file for asimonim. Defines token file patterns, schema version, header, CSS lightDark patterns, and multiple output formats including CSS, SCSS, JSON, TypeScript, and editor-specific formats. ```yaml prefix: rh files: - tokens/**/*.yml - tokens/**/*.yaml schema: v2025.10 header: | @license Copyright 2024 Red Hat, Inc. SPDX-License-Identifier: MIT formats: css: lightDark: enabled: true patterns: - ["on-light", "on-dark"] outputs: # Monolithic CSS - format: css path: css/global.css # Monolithic CSS for web components (:host) - format: css path: css/shared.css # TODO: needs host flavor support # Lit CSS wrapper - format: lit-css path: css/reset.css.ts # Theme CSS with light-dark() - format: css path: css/default-theme.css # lightDark patterns applied # SCSS variables - format: scss path: scss/_variables.scss # Flat JSON - format: json path: json/rhds.tokens.flat.json flatten: true # Nested DTCG JSON - format: dtcg path: json/rhds.tokens.json # TypeScript Map (monolithic) - format: typescript-map path: js/tokens.ts # TypeScript per-category (split) - format: typescript path: js/{group}.ts splitBy: topLevel # VSCode snippets - format: vscode-snippets path: editor/vscode/snippets.json # Sketch palette - format: sketch path: editor/sketch/rhds.sketchpalette # Figma-compatible DTCG with modes - format: dtcg path: json/figma-tokens.json figmaModes: patterns: - ["on-light", "on-dark"] ``` -------------------------------- ### asimonim mcp Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/mcp.md Command-line interface to launch the MCP server for AI-assisted development with design tokens. ```APIDOC ## asimonim mcp ### Description Launches a Model Context Protocol (MCP) server for AI-assisted development with design tokens. The server communicates over stdin/stdout using JSON-RPC. ### Usage ```text asimonim mcp ``` ### Token Discovery The MCP server discovers tokens from: - Local token files specified in `.config/design-tokens.yaml` - npm/jsr dependencies with `designTokens` field or export condition - Resolver documents referenced in config ### Tools | Tool | Description | | ---- | ----------- | | `validate_tokens` | Validate token files for correctness, detect circular references, report deprecated tokens | | `search_tokens` | Search tokens by name, value, description, or type with regex support | | `convert_tokens` | Convert tokens to CSS, SCSS, JavaScript, Swift, Android XML, or other formats | ### Resources | URI | Description | | --- | ----------- | | `asimonim://tokens` | List available token sources with counts | | `asimonim://tokens/{source}` | All tokens from a specific source | | `asimonim://token/{source}/{path}` | Individual token detail | | `asimonim://config` | Workspace configuration | ### Example Configuration (Claude Code `settings.json`) ```json { "mcpServers": { "asimonim": { "command": "asimonim", "args": ["mcp"] } } } ``` ``` -------------------------------- ### asimonim validate usage and flags Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/validate.md Shows the command-line usage and flags for the asimonim validate command. Use -s or --schema to force a schema version, --strict to fail on warnings, and --quiet to output only errors. ```text Usage: asimonim validate [files...] Flags: -s, --schema string Force schema version (draft, v2025.10) --strict Fail on warnings --quiet Only output errors ``` -------------------------------- ### Usage: asimonim mcp Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/mcp.md Launches the MCP server over stdin/stdout using JSON-RPC. Token discovery sources include local token files in `.config/design-tokens.yaml`, npm/jsr dependencies with a `designTokens` field or export condition, and resolver documents referenced in config. ```text Usage: asimonim mcp ``` -------------------------------- ### Verify outputs with asimonim and diff Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Commands to generate tokens with asimonim and diff the output against previous style-dictionary output. Expected differences include header comments, light-dark() function, and Figma $extensions. ```bash # Generate with asimonim asimonim convert # Diff against previous style-dictionary output diff -r css/ css.old/ diff -r js/ js.old/ diff -r json/ json.old/ ``` -------------------------------- ### Custom Configuration for Asimonim Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Custom configuration for Asimonim, specifying a prefix, token files, resolvers, and schema version. ```yaml prefix: "my-ds" files: - ./tokens.json - npm:@my-design-system/tokens/tokens.json resolvers: - npm:@my-design-system/tokens/tokens.resolver.json schema: v2025.10 ``` -------------------------------- ### Asimonim configuration file Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Configuration file for Asimonim, read from `.config/design-tokens.{yaml,yml,json}`. Defines prefix, resolvers, files, group markers, schema, and CDN options. ```yaml # .config/design-tokens.yaml prefix: "rh" resolvers: - ./tokens.resolver.json - npm:@acme/tokens/tokens.resolver.json files: - ./tokens.json - ./tokens/**/*.yaml - path: npm:@rhds/tokens/json/rhds.tokens.json prefix: rh groupMarkers: ["_", "@", "DEFAULT"] schema: draft cdn: unpkg # CDN for network fallback (unpkg, esm.sh, esm.run, jspm, jsdelivr) ``` -------------------------------- ### asimonim search CLI command Source: https://github.com/bennypowers/asimonim/blob/main/plans/00-research.md Searches tokens by query. Use --name to search names only, --value to search values only, --type to filter by type, --regex to treat the query as regex, and --format to choose json, table, or names output. ```text asimonim search [files...] Flags: --name Search names only --value Search values only --type Filter by type --regex Query is regex --format json|table|names ``` -------------------------------- ### asimonim search usage and flags Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/search.md Shows the command syntax and available flags for the asimonim search command. The --schema flag forces a schema version, --name and --value restrict the search scope, --type filters by token type, --regex enables regular expression matching, and --format controls the output format (default is table). ```text Usage: asimonim search [files...] Flags: -s, --schema string Force schema version (draft, v2025.10) --name Search names only --value Search values only --type string Filter by token type --regex Treat query as a regular expression --format string Output format: table, json, names (default "table") ``` -------------------------------- ### asimonim validate CLI command Source: https://github.com/bennypowers/asimonim/blob/main/plans/00-research.md Validates token files against the schema. Use --schema to force a schema version, --strict to fail on warnings, and --quiet to only output errors. ```text asimonim validate [files...] Flags: --schema Force schema version (draft, v2025_10) --strict Fail on warnings --quiet Only output errors ``` -------------------------------- ### Add Asimonim Marketplace Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Add the Asimonim marketplace to Claude Code. ```claude-code /plugin marketplace add bennypowers/asimonim ``` -------------------------------- ### Avoid inline test data, use shared fixture Source: https://github.com/bennypowers/asimonim/blob/main/CLAUDE.md Contrasts the discouraged inline token data approach with the recommended shared fixture approach. Avoid inline token data in tests; load from fixture files instead. ```go // Bad - inline source json := []byte(`{"color": {"$value": "#fff"}}`) tokens, _ := parser.ParseBytes(json, opts) // Good - use shared fixture allTokens := testutil.ParseFixtureTokens(t, "fixtures/v2025_10/all-color-spaces", schema.V2025_10) tok := testutil.TokenByPath(t, allTokens, "color.srgb-hex") ``` -------------------------------- ### Enable network fallback in package.json Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Enables network fallback in `package.json` for the language server, with configurable timeout and CDN provider. Opt-in and disabled by default. ```json { "designTokensLanguageServer": { "networkFallback": true, "networkTimeout": 30, "cdn": "unpkg", "tokensFiles": [ "npm:@my-design-system/tokens/tokens.json" ] } } ``` -------------------------------- ### Remove array-based theme values (before/after) Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Shows the before (style-dictionary pattern) and after (asimonim pattern) for removing array-based theme values. The after pattern uses a default light value and sibling tokens for on-light/on-dark, which asimonim uses to generate light-dark() and Figma modes. ```yaml color: brand: red: $value: ['{color.brand.red.on-light}', '{color.brand.red.on-dark}'] ``` ```yaml color: brand: red: $value: '{color.brand.red.on-light}' # Default to light # asimonim detects on-light/on-dark siblings and generates light-dark() red-on-light: $value: '#ee0000' red-on-dark: $value: '#ff3333' ``` -------------------------------- ### Custom root_dir for Neovim LSP Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/editors.md Custom root_dir for non-git projects or monorepos that explicitly skips node_modules. Use this when the default root_markers may find the wrong package.json, such as when tokens are in node_modules. ```lua root_dir = function(bufnr, on_dir) local root = vim.fs.root(bufnr, function(name, path) if name == 'package.json' and not path:match('node_modules') then return true end return name == '.git' end) if root then on_dir(root) end end, ``` -------------------------------- ### Verify MCP Server Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Verify the MCP server is loaded. ```claude-code /mcp ``` -------------------------------- ### Update Makefile with asimonim commands Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Makefile targets for asimonim conversion and validation. The tokens target runs asimonim convert, optionally with explicit file patterns; the validate target runs asimonim validate --strict. ```makefile .PHONY: tokens tokens: asimonim convert # Or with explicit files: tokens: asimonim convert tokens/**/*.yml # Validate tokens validate: asimonim validate --strict tokens/**/*.yml ``` -------------------------------- ### Remove style-dictionary dependencies Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Removes style-dictionary and @tokens-studio/sd-transforms dependencies from the project. ```bash npm uninstall style-dictionary @tokens-studio/sd-transforms ``` -------------------------------- ### Restart LSP Server Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Restart the LSP server. ```claude-code /lsp restart ``` -------------------------------- ### Validate Token Files Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Validate token files for correctness. ```bash asimonim validate tokens.json ``` -------------------------------- ### Design token interfaces Source: https://github.com/bennypowers/asimonim/blob/main/plans/00-research.md Defines the core interfaces for design token access. TokenResult provides value, description, and syntax methods, while DesignTokens allows retrieval by name with a boolean indicating existence. ```go type TokenResult interface { Value() any Description() string Syntax() string } type DesignTokens interface { Get(name string) (TokenResult, bool) } ``` -------------------------------- ### Convert tokens to CSS custom properties Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Generates CSS custom properties from design tokens using the `css` format. The output is written to the file specified by `-o`. ```bash asimonim convert --format css -o tokens.css tokens/*.yaml ``` -------------------------------- ### Replace _ group markers with $root (before/after) Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Shows the before and after for replacing the '_' group marker with '$root' in token structure. ```yaml color: _: $value: '{color.default}' ``` ```yaml color: $root: $value: '{color.default}' ``` -------------------------------- ### Add root-level Figma modes declaration Source: https://github.com/bennypowers/asimonim/blob/main/docs/rhdt-migration-prompt.md Adds root-level Figma modes declaration to the main tokens file or a dedicated $metadata.json. Enables Figma mode support for the token set. ```json { "$extensions": { "com.figma": { "modes": ["on-light", "on-dark"] } } } ``` -------------------------------- ### Check Claude Code Logs Source: https://github.com/bennypowers/asimonim/blob/main/extensions/claude-code/README.md Check Claude Code logs for errors. ```claude-code /logs ``` -------------------------------- ### Resolver declaration via designTokens field Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Recommended way to declare a resolver in a dependency's `package.json` using the `designTokens` field. Checked first during auto-discovery. ```json { "name": "@acme/tokens", "designTokens": { "resolver": "tokens.resolver.json" } } ``` -------------------------------- ### Generate editor snippets with default VSCode type Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/commands/convert.md Generates editor snippets for autocompleting CSS custom properties using the `snippets` format. The default snippet type is `vscode`. ```bash asimonim convert --format snippets -o tokens.code-snippets tokens/*.yaml ``` -------------------------------- ### Resolver declaration via designTokens export condition Source: https://github.com/bennypowers/asimonim/blob/main/docs/content/docs/reference/configuration.md Fallback method to declare a resolver using the `designTokens` export condition. Used when the `designTokens` field is absent. ```json { "name": "@acme/tokens", "exports": { ".": { "designTokens": "./tokens.resolver.json", "import": "./dist/index.js" } } } ```