aura-ai
Version:
AI-powered marketing strategist CLI tool for developers
116 lines (96 loc) ⢠3.55 kB
JavaScript
import fs from 'fs/promises'
import path from 'path'
import os from 'os'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export async function addAuraAgentCommand(options) {
const { json, quiet } = options
try {
// Get user's home directory
const homeDir = os.homedir()
const claudeAgentsDir = path.join(homeDir, '.claude', 'agents')
if (!quiet && !json) {
console.log('š Checking Claude agents directory...')
}
// Check if .claude/agents directory exists
try {
await fs.access(claudeAgentsDir)
} catch {
// Create the directory if it doesn't exist
if (!quiet && !json) {
console.log('š Creating Claude agents directory...')
}
await fs.mkdir(claudeAgentsDir, { recursive: true })
}
// Read the aura agent file from our package
const auraAgentSource = `---
name: aura
description: Marketing AI agent that uses Aura CLI for product analysis, daily reports, and marketing insights
tools: Bash
model: sonnet
color: cyan
---
You are Aura, a marketing AI assistant that uses the Aura CLI tool via npx.
## Quick Command Reference
\`\`\`bash
# Daily sync report (saves file, prints, copies to clipboard)
npx aura-ai sync --json
# Marketing consultation
npx aura-ai chat "your question" --json
# Product analysis (one-time setup)
npx aura-ai init --answers "product|audience|value" --json
# View settings
npx aura-ai settings --list --json
\`\`\`
## How to Respond
1. **User says "sync"** ā Run: \`npx aura-ai sync --json\`
- Creates \`YYYY-M-D-update.md\` file automatically
- Prints full report to terminal
- Auto-copies to clipboard
- Tell user: "Report generated, saved to [filename], and copied to clipboard"
2. **User asks marketing question** ā Run: \`npx aura-ai chat "question" --json\`
3. **User wants product analysis** ā Check if aura.md exists, if not run: \`npx aura-ai init --answers "..." --json\`
## Important
- No installation needed! Uses npx to run directly
- Sync command creates dated markdown files (e.g., \`2025-8-8-update.md\`)
- All content is visible in terminal output
- Reports are automatically saved and copied
- Just run commands, don't read files`
// Write the agent file
const targetPath = path.join(claudeAgentsDir, 'aura.md')
await fs.writeFile(targetPath, auraAgentSource)
// Output result
if (json) {
console.log(JSON.stringify({
status: 'success',
data: {
installed_to: targetPath,
agent_name: 'aura',
message: 'Aura agent successfully installed to Claude'
}
}))
} else if (!quiet) {
console.log('\nā
Aura agent successfully installed!')
console.log(`š Location: ${targetPath}`)
console.log('\nā ļø IMPORTANT: Please restart Claude to load the new agent')
console.log('\nšÆ After restarting Claude, you can use:')
console.log(' 1. Type: @aura sync')
console.log(' 2. Type: @aura help me with marketing')
console.log(' 3. Type: @aura analyze my product')
console.log('\nš” The agent will automatically use Aura CLI commands')
}
} catch (error) {
if (json) {
console.log(JSON.stringify({
status: 'error',
error: error.message
}))
process.exit(1)
} else {
console.error(`ā Error: ${error.message}`)
process.exit(1)
}
}
}