```
├── .cursor/
   ├── rules/
      ├── architecture.mdc (omitted)
      ├── examples.mdc (omitted)
      ├── yo.mdc (omitted)
├── .cursorindexingignore (omitted)
├── .github/
   ├── instructions/
      ├── examples-test.instructions.md (omitted)
   ├── workflows/
      ├── ci.yml (omitted)
      ├── claude.yaml (omitted)
├── .gitignore (omitted)
├── .npmignore (omitted)
├── .prettierrc (omitted)
├── .repomixignore (omitted)
├── ARCHITECTURE.md (omitted)
├── LICENSE (omitted)
├── README.md (omitted)
├── TODO.md (omitted)
├── UNIFIED_RULES_CONVENTION.md (omitted)
├── bun.lock (omitted)
├── context.json (omitted)
├── examples/
   ├── README.md (omitted)
   ├── end-user-cjs-package/
      ├── .gitignore (omitted)
      ├── install.test.ts (omitted)
      ├── metadata-integration.test.ts (omitted)
      ├── package.json (omitted)
      ├── single-rule-claude.md (omitted)
      ├── uninstall.test.ts (omitted)
   ├── end-user-esm-package/
      ├── .gitignore (omitted)
      ├── install.test.ts (omitted)
      ├── package.json (omitted)
   ├── library-cjs-package/
      ├── package.json (omitted)
      ├── src/
         ├── llms.ts (omitted)
      ├── tsconfig.json (omitted)
   ├── library-esm-package/
      ├── README.md (omitted)
      ├── package.json (omitted)
      ├── src/
         ├── llms.ts (omitted)
      ├── tsconfig.json (omitted)
├── package.json (omitted)
├── reference/
   ├── README.md (omitted)
   ├── amp-rules-directory/
      ├── AGENT.md (omitted)
   ├── claude-code-directory/
      ├── CLAUDE.md (omitted)
   ├── cline-rules-directory/
      ├── .clinerules/
         ├── always-on.md (omitted)
         ├── glob.md (omitted)
         ├── manual.md (omitted)
         ├── model-decision.md (omitted)
   ├── codex-rules-directory/
      ├── AGENTS.md (omitted)
   ├── cursor-rules-directory/
      ├── .cursor/
         ├── always-on.mdc (omitted)
         ├── glob.mdc (omitted)
         ├── manual.mdc (omitted)
         ├── model-decision.mdc (omitted)
   ├── windsurf-rules-directory/
      ├── .windsurf/
         ├── rules/
            ├── always-on.md (omitted)
            ├── glob.md (omitted)
            ├── manual.md (omitted)
            ├── model-decision.md (omitted)
   ├── zed-rules-directory/
      ├── .rules (omitted)
├── scripts/
   ├── build-examples.ts (omitted)
   ├── test-examples.ts (omitted)
├── src/
   ├── cli.ts (omitted)
   ├── commands/
      ├── convert.ts (omitted)
      ├── install.ts (omitted)
      ├── list.ts (omitted)
      ├── load.ts (omitted)
      ├── save.ts (omitted)
      ├── uninstall.ts (omitted)
   ├── index.ts (omitted)
   ├── llms/
      ├── index.ts (omitted)
      ├── internal.ts (omitted)
      ├── llms.txt (omitted)
   ├── providers/
      ├── amp-provider.ts (omitted)
      ├── claude-code-provider.ts (omitted)
      ├── clinerules-provider.ts (omitted)
      ├── codex-provider.ts (omitted)
      ├── cursor-provider.ts (omitted)
      ├── gemini-provider.ts (omitted)
      ├── index.ts (omitted)
      ├── metadata-application.test.ts (omitted)
      ├── unified-provider.ts (omitted)
      ├── vscode-provider.ts (omitted)
      ├── windsurf-provider.ts (omitted)
      ├── zed-provider.ts (omitted)
   ├── schemas.ts (omitted)
   ├── text.d.ts (omitted)
   ├── types.ts (omitted)
   ├── utils/
      ├── debug.ts (omitted)
      ├── frontmatter.test.ts (omitted)
      ├── frontmatter.ts (omitted)
      ├── path.ts (omitted)
      ├── rule-change-detector.ts (omitted)
      ├── rule-formatter.ts (400 tokens)
      ├── rule-storage.test.ts (omitted)
      ├── rule-storage.ts (omitted)
      ├── similarity.ts (omitted)
      ├── single-file-helpers.ts (omitted)
      ├── single-file-removal.ts (omitted)
├── tsconfig.json (omitted)
├── vibe-tools.config.json (omitted)
├── web/
   ├── .env.example (omitted)
   ├── .gitignore (omitted)
   ├── DEPLOYMENT.md (omitted)
   ├── README.md (omitted)
   ├── alchemy.run.ts (omitted)
   ├── app/
      ├── app.vue (omitted)
      ├── composables/
         ├── useDarkMode.ts (omitted)
         ├── useGitHubStars.ts (omitted)
      ├── layouts/
         ├── default.vue (omitted)
      ├── pages/
         ├── index.vue (omitted)
         ├── local-usage.vue (omitted)
         ├── maintainers.vue (omitted)
   ├── nuxt.config.ts (omitted)
   ├── package.json (omitted)
   ├── public/
      ├── logos/
         ├── amp.svg (omitted)
         ├── claude-code.svg (omitted)
         ├── cline.svg (omitted)
         ├── codex.svg (omitted)
         ├── cursor.svg (omitted)
         ├── vscode.svg (omitted)
         ├── windsurf.svg (omitted)
         ├── zed.svg (omitted)
   ├── tailwind.config.js (omitted)
   ├── types/
      ├── env.d.ts (omitted)
   ├── wrangler.jsonc (omitted)
```


## /src/utils/rule-formatter.ts

```ts path="/src/utils/rule-formatter.ts" 
import { RuleConfig, RuleGeneratorOptions } from "../types.js";

/**
 * Formats rule content for non-cursor providers that use XML-like tags.
 * Includes additional metadata like alwaysApply and globs in a human-readable format
 * within the rule content.
 */
export function formatRuleWithMetadata(config: RuleConfig, options?: RuleGeneratorOptions): string {
  let formattedContent = config.content;

  // Add metadata lines at the beginning of content if they exist
  const metadataLines = [];

  // Add alwaysApply information if provided
  if (options?.alwaysApply !== undefined) {
    metadataLines.push(
      `Always Apply: ${options.alwaysApply ? "true" : "false"} - ${
        options.alwaysApply
          ? "This rule should ALWAYS be applied by the AI"
          : "This rule should only be applied when relevant files are open"
      }`
    );
  }

  // Add globs information if provided
  if (options?.globs && options.globs.length > 0) {
    const globsStr = Array.isArray(options.globs) ? options.globs.join(", ") : options.globs;

    // Skip adding the glob info if it's just a generic catch-all pattern
    const isCatchAllPattern =
      globsStr === "**/*" ||
      (Array.isArray(options.globs) && options.globs.length === 1 && options.globs[0] === "**/*");

    if (!isCatchAllPattern) {
      metadataLines.push(`Always apply this rule in these files: ${globsStr}`);
    }
  }

  // If we have metadata, add it to the beginning of the content
  if (metadataLines.length > 0) {
    formattedContent = `${metadataLines.join("\n")}\n\n${config.content}`;
  }

  return formattedContent;
}

/**
 * Creates a complete XML-like block for a rule, including start/end tags
 * and formatted content with metadata
 */
export function createTaggedRuleBlock(config: RuleConfig, options?: RuleGeneratorOptions): string {
  const formattedContent = formatRuleWithMetadata(config, options);
  const startTag = `<${config.name}>`;
  const endTag = `</${config.name}>`;
  return `${startTag}\n${formattedContent}\n${endTag}`;
}

```


The better and more specific the context, the better the LLM can follow instructions. If the context seems verbose, the user can refine the filter using uithub. Thank you for using https://uithub.com - Perfect LLM context for any GitHub repo.