agentleFS
SrivarsanKSrivarsanK/Glide/skills/glide-component-segregator/SKILL.md

glide-component-segregator

Skill209 starsChanged 2 months agoApache-2.0View on GitHub

How to read `glide-components.json`, the component index that the Glide visual editor writes, to find a component or element by name without searching the file tree. Use this skill whenever a project has `glide-components.json` and the user asks to change, find, restyle or inspect a component ("make the Card background darker", "where is the Header defined", "which components use this button"), and whenever you need the file, line and column of a UI element. Use it also when the registry looks wrong, empty or out of date.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After you add or rename a component, wait a moment and read the file again.

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Glide component registry

Glide scans the project and writes glide-components.json in the project root. Each component is one entry with its file and the elements it renders. Reading this file is faster and more exact than a search through the source tree, because each element already has its line and column.

Glide writes the file when the editor server starts (the dev server with the Glide plugin, or the glide command) and again within 300 ms of a source change. Treat it as read-only: Glide overwrites manual changes.

The file

interface ComponentRegistry {
  projectRoot: string;
  generatedAt: string;                 // ISO time of the last scan
  framework: 'react' | 'vue' | 'svelte' | 'astro' | 'html' | 'unknown';
  buckets: ComponentBucket[];          // one per component
}

interface ComponentBucket {
  name: string;                        // "Card", "Header"; "Anonymous" for an unnamed default export
  file: string;                        // absolute path
  exportType: 'default' | 'named' | 'anonymous' | 'sfc' | 'html';
  line: number;                        // where the component is declared
  column: number;
  elements: RegistryElement[];
  cssFiles: string[];                  // stylesheets next to the file with the same name
}

interface RegistryElement {
  id: string;                          // "file:line:col", the same value as the element's data-gl-source
  tagName: string;                     // "div", "button", or a component such as "Card.Header"
  line: number;
  column: number;
  isRoot: boolean;                     // the outer element that the component returns
  classNames: string[];                // static classes only; empty when the class is computed
  text?: string;                       // the first 25 characters of direct text
}

How to use it

A script in the glide skill prints the parts you need, so you do not have to load the whole file:

node <glide skill folder>/scripts/query-components.mjs --list
node <glide skill folder>/scripts/query-components.mjs --name Card

Or read the JSON directly. Then:

  1. Find the component by name. Go to bucket.file at bucket.line.
  2. Pick the element.
    • For background, outer padding or size, use the element with isRoot: true.
    • For a part inside, match on tagName, classNames or text.
  3. Edit at element.line and element.column in bucket.file. That position is the < of the opening tag.
  4. For a CSS Modules component, the styles are in bucket.cssFiles[0], not in the markup.
  5. For a capitalized tagName (<Button>), the element is another component. To change what it renders, find the entry with that name. To change only this one use of it, edit here.

After you add or rename a component, wait a moment and read the file again; the scan runs 300 ms after the change.

Limits to keep in mind

  • Static classes only. classNames is empty for a computed class (cn(...), :class). Empty does not mean the element has no classes; read the source.
  • Several components can share a name in different files. Check file before you edit.
  • Template files (.vue, .svelte, .astro) have one entry per file, with exportType: 'sfc'.
  • Folders that are skipped: node_modules, dist, build, .next, .nuxt, coverage, and test folders.

When the file is missing or wrong

ProblemCauseWhat to do
No glide-components.jsonGlide has not run in this projectStart the dev server (with the Glide plugin) or run npx @srivarsank/glide. Until then, read the source files
A new component is not listedThe scan runs 300 ms after a change, and only while Glide runsRead the file again; check generatedAt
A component has no elementsThe file did not parse, or it returns no markupOpen the file and check it for a syntax error
The user's canvas edit was refused after your changeYou changed a file they had selectedNormal. Tell them to select the element again

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.