metamafia-cli
v1.1.0
Published
Metamafia CLI to add AI-generated metadata and files to Next.js projects
Maintainers
Readme
🚀 Metamafia CLI
Metamafia CLI automates the addition of AI-generated metadata, manifest.json, and robots.txt to Next.js 15 apps.
Easily optimize SEO and improve performance with zero hassle.
🎯 Features
✅ Fetches metadata automatically from Metamafia API using documentId.
✅ Inserts AI-generated metadata into app/layout.js or src/app/layout.js.
✅ Generates manifest.json and robots.txt in the public/ directory.
✅ Compatible with Next.js 15 and modern web apps.
📦 Installation
You don't need to install it globally. Simply run the command using npx:
npx metamafia <documentId>Note:
documentIdis the ID returned after generating metadata from Metamafia.- Your Next.js project should be open in the terminal where the command is run.
📝 Usage
Basic Command:
npx metamafia <documentId>Example:
npx metamafia 67e8f17694a073819a301914What Happens After Running the Command:
- 🎯 Metadata: Adds
export const metadata = {...}toapp/layout.jsorsrc/app/layout.js. - 📄 manifest.json: Creates
public/manifest.jsonwith app name, icons, and display settings. - 🤖 robots.txt: Generates
public/robots.txtwith crawl directives and sitemap.
📚 Folder Structure After Execution
/my-nextjs-app
├── /app
│ └── /layout.js (Updated with metadata)
├── /public
│ ├── manifest.json (Created/Updated)
│ └── robots.txt (Created/Updated)
└── /src
└── /app
└── /layout.js (Updated with metadata if layout found here)⚡️ How It Works
🎯 Fetch Metadata
Retrieves metadata from the Metamafia API using thedocumentIdprovided.📄 Add Metadata to Layout
Insertsexport const metadataat the top oflayout.jsin theapp/orsrc/app/directory.🤖 Generate Manifest & Robots
manifest.jsonis created with basic PWA information.robots.txtis configured with appropriate crawl settings.
📚 Advanced Options
Re-run with a New documentId
To update the metadata, manifest, and robots with a new document:
npx metamafia 67e8f17694a073819a301914🚩 Troubleshooting
1. Error: No layout.js found
- Ensure that
layout.jsexists in either/appor/src/appdirectory.
2. Error: Failed to fetch metadata
- Check if the API URL in
api.jsis correct and that the API server is running.
3. Permission Denied
- Ensure you have write access to the project directory.
📜 License
MIT © 2025 Webrizen