Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

876 B
Raw Blame
import { execa } from 'execa'
import type { PackageManager } from './types.js'
import { runCommand } from './utils.js'

/**
 * Set the project up for AI coding agents by delegating to the project-local
 * CLI: `spree add ai` installs the Spree agent skills and connects each agent
 * to the Spree docs MCP server — the same command existing projects run.
 *
 * @param projectDir absolute path to the generated project
 * @param opts which halves to set up, and the scaffold's package manager
 */
export async function setupAgents(
  projectDir: string,
  opts: { skills: boolean; mcp: boolean; packageManager: PackageManager },
): Promise<void> {
  const args = ['spree', 'add', 'ai', '--quiet']
  if (!opts.skills) args.push('--no-skills')
  if (!opts.mcp) args.push('--no-mcp')
  await execa(runCommand(opts.packageManager), args, { cwd: projectDir, stdio: 'inherit' })
}