import { homedir } from 'node:os';
import { join } from 'node:path';

export const VERSION = '0.0.2';

export const DEFAULT_MOSAIC_HOME = join(homedir(), '.config', 'mosaic');

export const DEFAULTS = {
  agentName: 'Assistant',
  roleDescription: 'execution partner and visibility engine',
  communicationStyle: 'direct' as const,
  pronouns: 'They/Them',
  timezone: 'UTC',
  background: '(not configured)',
  accessibilitySection: '(No specific accommodations configured. Edit this section to add any.)',
  personalBoundaries: '(Edit this section to add any personal boundaries.)',
  projectsTable: `| Project | Stack | Registry |
|---------|-------|----------|
| (none configured) | | |`,
  credentialsLocation: 'none',
  customToolsSection: `## Custom Tools

(Add any machine-specific tools, scripts, or workflows here.)`,
  gitProvidersTable: `| Instance | URL | CLI | Purpose |
|----------|-----|-----|---------|
| (add your git providers here) | | | |`,
};

/** Preset intent categories with display labels and suggested agent names. */
export const INTENT_PRESETS: Record<
  string,
  { label: string; hint: string; suggestedName: string }
> = {
  general: {
    label: 'General purpose assistant',
    hint: 'Versatile helper for any task',
    suggestedName: 'Mosaic',
  },
  'software-dev': {
    label: 'Software development',
    hint: 'Coding, debugging, architecture',
    suggestedName: 'Forge',
  },
  devops: {
    label: 'DevOps & infrastructure',
    hint: 'CI/CD, containers, monitoring',
    suggestedName: 'Sentinel',
  },
  research: {
    label: 'Research & analysis',
    hint: 'Data analysis, literature review',
    suggestedName: 'Atlas',
  },
  content: {
    label: 'Content & writing',
    hint: 'Documentation, copywriting, editing',
    suggestedName: 'Muse',
  },
  custom: {
    label: 'Custom',
    hint: 'Describe your own use case',
    suggestedName: 'Mosaic',
  },
};

/**
 * Detect LLM provider type from an API key prefix.
 */
export function detectProviderType(key: string): 'anthropic' | 'openai' | 'none' {
  if (!key) return 'none';
  if (key.startsWith('sk-ant-')) return 'anthropic';
  if (key.startsWith('sk-')) return 'openai';
  return 'none';
}

export const RECOMMENDED_SKILLS = new Set([
  'brainstorming',
  'code-review-excellence',
  'lint',
  'systematic-debugging',
  'verification-before-completion',
  'writing-plans',
  'executing-plans',
  'architecture-patterns',
  'mosaic-board',
  'mosaic-forge',
  'mosaic-prdy',
  'mosaic-standards',
  'mosaic-macp',
]);
