Skip to main content
The pnpm cone gen command uses AI (LLM) to generate or upgrade cone metadata for Entities. You can improve template cones created by stub entity with AI, or regenerate existing cones.

Basic Usage

pnpm cone gen <entityId> [options]
Requires ANTHROPIC_API_KEY. Set it in sonamu.secret.ts or as an environment variable.

Options

OptionDescriptionExample
(none)Generate only empty fixtureHints (preserves existing values)pnpm cone gen Product
--regenerateOverwrite existing cones and regenerate allpnpm cone gen Product --regenerate
--locale <ko|en|ja>Specify generation language (default: sonamu.config.ts i18n.defaultLocale or ko)pnpm cone gen Product --locale en
--allGenerate cones for all Entities at oncepnpm cone gen all

Examples

Generate cones for a single Entity

pnpm cone gen Product
# 🌟 Generating AI-powered cones for Product...
# ✅ Done! (1234 tokens used)
# 💰 Estimated cost: ~$0.0111

Regenerate existing cones

pnpm cone gen Product --regenerate
# 🌟 Regenerating AI-powered cones for Product...
# ✅ Done! (1567 tokens used)
# 💰 Estimated cost: ~$0.0141

Generate cones in English

pnpm cone gen Product --locale en

Batch generate for all Entities

pnpm cone gen all
# 🌟 Generating AI-powered cones for 5 entities...
#
# Processing User...
#   ✓ User (1234 tokens)
#
# Processing Product...
#   ✓ Product (1567 tokens)
#
# ...
#
# ✅ Done! Total: 5678 tokens used
# 💰 Estimated cost: ~$0.0511

How It Works

Default mode (onlyEmpty)

When run without options, only fields with empty fixtureHint are generated. Existing values are preserved.

Regenerate mode (--regenerate)

With --regenerate, all existing cone metadata is overwritten and regenerated from scratch. Be careful if you have manually adjusted values.

Workflow

A typical cone workflow:
# 1. Create Entity (includes template cones by default)
pnpm stub entity Product

# 2. Upgrade cones with AI
pnpm cone gen Product

# 3. Regenerate in a specific language if needed
pnpm cone gen Product --regenerate --locale en

Next Steps