Guide: Publishing a UI Library with Source Files for AutonomyAI Agents

Last updated: May 11, 2025

At AutonomyAI, our agents read every single file in your project to deeply understand your system — including internal UI libraries. While staying strictly limited to the scope of the current project, they analyze both local components and npm-installed packages inside node_modules.

If you publish a UI component library to npm and want our agents to recognize and use your custom components intelligently, please include the original .tsx / .jsx source files in the published package.


How to Set Up Your Library for AutonomyAI

1. Organize Components in src/

Structure your source files like this (this is just an example — any structure under src/ is fine):

src/
├── Button.tsx
├── Card.tsx

2. Include Source in package.json

Use the files field to ensure src/ is included in the npm package:

"files": ["dist", "src", "types", "package.json"]

Or, make sure .npmignore does not exclude the src/ folder.

3. Build and Publish

Run your build process and publish the package:

npm run build
npm publish

4. Verify Contents

Run this to verify what will be included:

npm pack

Inspect the .tgz archive to confirm the presence of .tsx / .jsx files.


🔧 Add .autonomyignore in the Consuming Project

After the package is published and installed, go to the project where you are using the library and:

  1. Create a .autonomyignore file in the root of that project.

  2. Add the following two lines to allow Autonomy agents to model the library code:

!node_modules/PATH_TO_LIBRARY
!node_modules/PATH_TO_LIBRARY/**

Replace PATH_TO_LIBRARY with your package’s name, e.g.:

!node_modules/@your-org/ui-library
!node_modules/@your-org/ui-library/**

This tells Autonomy to look into the installed library inside node_modules and understand its components.


🎯 Why This Matters

By including your source files and explicitly allowing access via .autonomyignore:

  • Our agents can accurately detect, model, and use your custom components.

  • This enables better automation, smarter refactoring, and clearer UI modeling.

  • It ensures components don’t become opaque “black boxes” in your project’s architecture.

Thank you for helping AutonomyAI build smarter, faster software — together!