diff --git a/README.md b/README.md index 5d64713..143f6ca 100644 --- a/README.md +++ b/README.md @@ -105,10 +105,9 @@ clix **Shortcuts:** - `/help` - Show all available commands +- `/install` - Comprehensive SDK installation (orchestrates all setup tasks) +- `/doctor` - SDK health check and completeness verification - `/debug` - Interactive debugging assistant -- `/install` - Autonomous SDK installation -- `/doctor` - SDK health check -- `/integration` - Interactive SDK integration guide - `/agent` - Switch AI agents - `/transfer` - Transfer session to native CLI - `/exit` - Exit chat @@ -132,7 +131,13 @@ Detects available agents (Claude, Codex, Gemini, OpenCode, Cursor, GitHub Copilo ### `clix install` -Autonomous SDK installation with automatic file modifications. The AI agent will detect your platform, install dependencies, create initialization files, and integrate the SDK without manual intervention. +Comprehensive SDK installation orchestrator with visual progress tracking. The AI agent will: + +1. **Analyze** your project (platform, entry point, Firebase status) +2. **Plan** the installation tasks +3. **Execute** automatable tasks (install dependency, initialize SDK, create entitlements) +4. **Guide** you through manual steps (Xcode capabilities, Firebase config download) +5. **Summarize** what was done and what remains ```bash clix install @@ -152,14 +157,32 @@ The install command automatically detects and supports both Swift Package Manage - **SPM (Recommended)**: Detected via `Package.swift` or Xcode project with SPM packages - **CocoaPods**: Detected via `Podfile` +**iOS NSE Setup:** + +For iOS projects, `/install` also handles Notification Service Extension (NSE) setup: +- Creates entitlements files for main app and extension +- Creates `NotificationService.swift` with Clix implementation +- Updates Podfile for extension target (CocoaPods projects) +- Provides step-by-step Xcode instructions for manual steps + ### `clix doctor` -Analyze SDK integration status in your project. +Analyze SDK integration status and completeness in your project. ```bash clix doctor ``` +**What it checks:** + +- SDK dependency and initialization +- iOS: Entitlements, capabilities, NSE configuration +- Android: Manifest permissions, FCM setup +- Firebase: Config files, package/bundle ID matches +- Installation completeness percentage + +**Output:** JSON diagnostic report with issues categorized by severity (error/warning/info) and actionable recommendations. + ### `clix ios-setup` Configure iOS capabilities and Notification Service Extension (NSE) for the Clix SDK. @@ -201,52 +224,37 @@ clix update --force - `--dry-run` - Preview update without executing - `--force` - Skip confirmation prompt -### Interactive Skills (Chat Mode Only) +### Advanced Skills (Hidden from Menu) -The following skills require step-by-step guidance and are only available in chat mode. Run `clix` to start interactive chat, then use `/` commands. +These skills are hidden from the slash command menu but still accessible by typing them directly. They're intended for advanced use cases or overlap with `/install`. #### `integration` -SDK integration guide with step-by-step instructions. Unlike `clix install`, this provides interactive guidance for manual integration. +Interactive SDK integration guide. Unlike `clix install` (autonomous), this provides step-by-step interactive guidance. Hidden because `/install` handles most integration tasks. ``` > clix > /integration ``` -#### `event-tracking` +#### `ios-setup` -Event tracking setup with `Clix.trackEvent()`. +Configure iOS capabilities and NSE. Hidden because `/install` handles iOS setup as part of the orchestrated installation. ``` > clix -> /event-tracking +> /ios-setup ``` -#### `user-management` +#### `event-tracking`, `user-management`, `personalization`, `api-triggered-campaigns` -User management and identification setup. +Advanced skills for post-installation tasks. Hidden because they're not needed for initial SDK setup. ``` > clix +> /event-tracking > /user-management -``` - -#### `personalization` - -Personalization templates setup. - -``` -> clix > /personalization -``` - -#### `api-triggered-campaigns` - -API-triggered campaign setup. - -``` -> clix > /api-triggered-campaigns ``` @@ -275,20 +283,22 @@ clix install-mcp codex Use these commands within the interactive chat (`clix`): -### Autonomous Commands +### Primary Commands (Visible in Menu) -| Command | Aliases | Description | -|---------|---------|-------------| -| `/install` | | Autonomous SDK installation | -| `/doctor` | | Check SDK integration status | -| `/debug` | | Interactive debugging assistant | -| `/ios-setup` | `/capabilities`, `/ios-capabilities` | Configure iOS capabilities and NSE | +| Command | Description | +|---------|-------------| +| `/install` | Comprehensive SDK installation orchestrator | +| `/doctor` | Check SDK integration status and completeness | +| `/debug` | Interactive debugging assistant | + +### Advanced Commands (Hidden from Menu) -### Interactive Skills +These commands are still accessible by typing them directly: | Command | Aliases | Description | |---------|---------|-------------| -| `/integration` | | SDK integration guide | +| `/ios-setup` | `/capabilities`, `/ios-capabilities` | Configure iOS capabilities and NSE | +| `/integration` | | Interactive SDK integration guide | | `/event-tracking` | | Event tracking setup | | `/user-management` | | User management setup | | `/personalization` | | Personalization templates | @@ -354,8 +364,8 @@ Switching to Gemini... Pre-built workflows for common SDK tasks. Skills automatically detect your platform (iOS, Android, React Native, Flutter) and follow Clix SDK best practices. -- **Autonomous Commands** (`/install`, `/doctor`, `/debug`): Can be run from command-line (`clix install`) or chat mode -- **Interactive Skills** (`/integration`, `/event-tracking`, `/user-management`, `/personalization`, `/api-triggered-campaigns`): Require step-by-step guidance, available only in chat mode +- **Primary Commands** (`/install`, `/doctor`, `/debug`): Visible in menu, can be run from command-line or chat mode +- **Advanced Skills** (`/ios-setup`, `/integration`, `/event-tracking`, etc.): Hidden from menu but accessible by typing directly ## Development diff --git a/llms.txt b/llms.txt index eeb5edc..d44bc3b 100644 --- a/llms.txt +++ b/llms.txt @@ -232,26 +232,26 @@ The interactive chat (`clix` command) is the primary way to interact with Clix C ### Slash Commands -Type `/` in the chat to see the autocomplete menu. All 19 slash commands are organized into three categories: +Type `/` in the chat to see the autocomplete menu. Commands are organized into categories: -#### Autonomous Commands (4 commands) +#### Primary Commands (Visible in Menu - 3 commands) -These can be run from command-line (`clix `) or chat mode: +These are the main commands visible in the slash command menu: -- `/install` - Autonomous SDK installation with automatic file modifications -- `/doctor` - Analyze SDK integration status (automatic scan, JSON output) +- `/install` - Comprehensive SDK installation orchestrator (detects platform, installs SDK, creates entitlements, guides through Xcode steps) +- `/doctor` - SDK integration analysis with completeness assessment (checks SDK, iOS NSE/capabilities, Firebase config) - `/debug` - Interactive debugging assistant (asks for problem description) -- `/ios-setup` (aliases: `/capabilities`, `/ios-capabilities`) - Configure iOS capabilities and Notification Service Extension (NSE) -#### Interactive Skills (5 commands) +#### Advanced Commands (Hidden from Menu - 6 commands) -These execute pre-built workflows from the `@clix-so/clix-agent-skills` package and require step-by-step guidance (available only in chat mode): +These are hidden from the menu but still accessible by typing them directly. Hidden because they overlap with `/install` or are for advanced post-installation use cases: -- `/integration` - SDK integration guide with platform detection -- `/event-tracking` - Event tracking setup for analytics -- `/user-management` - User management and identification setup -- `/personalization` - Personalization template creation and debugging -- `/api-triggered-campaigns` - API-triggered campaign setup +- `/ios-setup` (aliases: `/capabilities`, `/ios-capabilities`) - Configure iOS capabilities and NSE (invoked by `/install` for iOS projects) +- `/integration` - Interactive SDK integration guide (overlaps with `/install`) +- `/event-tracking` - Event tracking setup for analytics (advanced, post-installation) +- `/user-management` - User management and identification setup (advanced, post-installation) +- `/personalization` - Personalization template creation and debugging (advanced, campaign feature) +- `/api-triggered-campaigns` - API-triggered campaign setup (advanced, backend feature) #### System Commands (10 commands) @@ -272,24 +272,22 @@ These are built-in commands for chat management and tools: **How it works:** - Type `/` to enter slash command mode -- Autocomplete menu appears showing matching commands +- Autocomplete menu appears showing matching commands (only visible commands) - Type letters to filter (e.g., `/d` shows debug, doctor) - Use ↑/↓ arrows to navigate menu - Press Tab to autocomplete selected command - Press Enter to execute selected command - Press Escape to cancel +- Hidden commands (like `/integration`, `/ios-setup`) won't appear in menu but work when typed directly -**Menu display:** +**Menu display (only shows 3 primary commands + system commands):** ``` -/install - Autonomous SDK installation [autonomous] +/install - Comprehensive SDK installation [autonomous] /doctor - Check SDK integration status [autonomous] /debug - Interactive debugging assistant [autonomous] -/integration - SDK integration guide [skill] -/event-tracking - Event tracking setup [skill] -/user-management - User management setup [skill] -/personalization - Personalization templates [skill] -/api-triggered-campaigns - API-triggered campaign setup [skill] /help - Show available commands +/new - Start a new session +/agent - List or switch agents ... ``` @@ -297,14 +295,20 @@ These are built-in commands for chat management and tools: ### Autonomous Commands -#### `/install` - Autonomous SDK Installation +#### `/install` - Comprehensive SDK Installation Orchestrator -**Category:** Autonomous Command +**Category:** Primary Command (Visible in Menu) -**What it does:** Automatically installs and integrates the Clix SDK into your mobile project with file modifications. Unlike `/integration`, this command makes changes autonomously without manual steps. +**What it does:** Orchestrates complete SDK installation with visual progress tracking. This is the main entry point for SDK setup, handling everything from dependency installation to iOS NSE configuration. **Platforms:** iOS, Android, React Native, Flutter +**Phases:** +1. **Project Analysis** - Detects platform, entry point, Firebase config status +2. **Task Plan** - Shows numbered checklist of tasks to complete +3. **Execution** - Performs automatable tasks, guides through manual steps +4. **Summary** - Lists completed tasks, manual steps remaining, files modified + **Usage:** ```bash # From command line @@ -315,41 +319,70 @@ clix install --platform react-native > /install ``` -**Example:** +**Example output:** ``` -> /install -Detecting platform... -✓ React Native project detected -✓ Added @clix-so/react-native-sdk to package.json -✓ Running npm install... -✓ Created initialization module -✓ Updated app/_layout.tsx with SDK initialization +PHASE 1: PROJECT ANALYSIS + [Done] Platform: React Native + [Done] Entry point: app/_layout.tsx + [Warning] google-services.json missing + +PHASE 3: EXECUTION + [1/5] Installing SDK dependency... + [Done] Added @clix-so/react-native-sdk + + [4/5] iOS Setup... + [Action Required] Create NSE target in Xcode + [Done] Created NotificationService.swift + [Done] Updated entitlements files + +PHASE 4: SUMMARY + Completed: 4/5 tasks + Manual steps: Create NSE target, Download Firebase config ``` -#### `/doctor` - SDK Integration Analysis +#### `/doctor` - SDK Integration Analysis & Completeness Check -**Category:** Autonomous Command +**Category:** Primary Command (Visible in Menu) -**What it does:** Automatically scans your project to check SDK integration status. Outputs structured JSON report. +**What it does:** Comprehensive analysis of SDK integration status with installation completeness assessment. Outputs structured JSON diagnostic followed by actionable recommendations. **Checks:** - Platform detection (iOS/Android/React Native/Flutter) -- SDK installation verification -- Push notification configuration -- Common integration issues +- SDK installation and initialization verification +- iOS: Entitlements, capabilities, NSE configuration, App Groups +- Android: Manifest permissions, FCM setup +- Firebase: Config files present, package/bundle ID matches +- Installation completeness percentage -**Output:** JSON format with findings and recommendations +**Output:** JSON diagnostic with checklist + brief summary with issues by severity **Example:** ``` > /doctor -Scanning project for SDK integration... { - "platform": "ios", - "sdk_installed": true, - "push_configured": false, - "issues": [{"type": "push", "description": "APNs entitlement missing"}] + "platform": "react-native", + "sdkInstalled": true, + "sdkInitialized": true, + "checklist": { + "iosNseConfigured": false, + "iosAppGroupsConfigured": false, + "firebaseIos": false + }, + "installCompleteness": { + "percentage": 67, + "missingSteps": ["iOS NSE", "Firebase iOS config"] + } } + +DOCTOR SUMMARY +Platform: React Native +Installation Completeness: 67% (6/9 steps) + +Issues Found: 2 + [Error] iOS NSE not configured + [Warning] Firebase iOS config missing + +Run /install to complete missing setup steps. ``` #### `/debug` - Interactive Debugging Assistant @@ -380,12 +413,16 @@ Describe the problem: Events not appearing in Clix dashboard [Provides fix with exact file location] ``` -#### `/ios-setup` - iOS Setup, Capabilities & NSE Configuration +### Advanced Commands (Hidden from Menu) -**Category:** Autonomous Command +#### `/ios-setup` - iOS Capabilities & NSE Configuration + +**Category:** Advanced Command (Hidden from Menu) **Aliases:** `/capabilities`, `/ios-capabilities` +**Why hidden:** Invoked automatically by `/install` for iOS projects. Use directly only if you need standalone iOS setup. + **What it does:** Configures iOS capabilities and Notification Service Extension (NSE) required for the Clix SDK. **Capabilities configured:** @@ -393,130 +430,62 @@ Describe the problem: Events not appearing in Clix dashboard - **App Groups** - Enables data sharing between app and NSE (entitlement: `com.apple.security.application-groups`, format: `group.clix.{BUNDLE_ID}`) **Notification Service Extension (NSE) setup:** -- **Target name:** `{AppName}NotificationServiceExtension` (consistent across all steps) -- **NotificationService.swift:** Uses `ClixNotificationServiceExtension` base class with `register(projectId:)` call -- **Dependency setup:** CocoaPods (`pod 'Clix'` in extension target) or SPM (add Clix package to extension) +- **Target name:** `{AppName}NotificationServiceExtension` +- **NotificationService.swift:** Uses `ClixNotificationServiceExtension` base class +- **Dependency setup:** CocoaPods or SPM - **Build settings:** `ENABLE_USER_SCRIPT_SANDBOXING = No` for Xcode 15+ -- **React Native + Firebase:** Move "Embed Foundation Extensions" above "[RNFB] Core Configuration" - -**Workflow:** -1. Analyzes iOS project structure (finds .xcodeproj/.xcworkspace) -2. Detects Bundle ID and checks current capabilities status -3. Creates/modifies entitlements files for main app and extension -4. Guides NSE target creation and NotificationService.swift implementation -5. Provides CocoaPods/SPM setup instructions for extension target -6. Provides step-by-step instructions for Xcode configuration -7. Guides through Apple Developer Portal setup -8. Outputs verification report **What can be automated:** -- Creating/modifying entitlements files -- Reading project configuration +- Creating entitlements files +- Creating NotificationService.swift +- Updating Podfile for extension target **What requires manual action:** -- Creating NSE target in Xcode (File > New > Target > Notification Service Extension) -- Adding capabilities in Xcode UI (Signing & Capabilities) -- Adding Clix SDK to extension target (Podfile or SPM) -- Configuring build settings for Xcode 15+ -- Enabling capabilities in Apple Developer Portal -- Registering App Group IDs -- Regenerating provisioning profiles +- Creating NSE target in Xcode +- Adding capabilities in Xcode UI +- Apple Developer Portal configuration -**Example:** -``` -> /ios-setup -Analyzing iOS project... -Bundle ID: com.example.myapp -Push Notifications: not configured -App Groups: not configured - -Creating entitlements files... -✓ Created MyApp.entitlements -✓ Created MyAppNotificationServiceExtension.entitlements - -Manual steps required: -1. Create NSE target: MyAppNotificationServiceExtension -2. Implement NotificationService.swift with ClixNotificationServiceExtension -3. Add Clix SDK to extension (Podfile or SPM) -4. Add Push Notifications and App Groups capabilities -5. Set ENABLE_USER_SCRIPT_SANDBOXING to No (Xcode 15+) - -{verification report JSON} -``` +### Advanced Interactive Skills (Hidden from Menu) -### Interactive Skills +#### `/integration` - Interactive SDK Integration Guide -#### `/integration` - SDK Integration Guide +**Category:** Advanced Skill (Hidden from Menu) -**Category:** Interactive Skill (Chat Mode Only) +**Why hidden:** Overlaps with `/install`. Use `/install` for autonomous installation; use `/integration` only if you prefer step-by-step interactive guidance. -**What it does:** Provides step-by-step guidance for manually integrating the Clix SDK. Unlike `/install`, this provides interactive guidance rather than making changes autonomously. - -**Platforms:** iOS, Android, React Native, Flutter - -**Example:** -``` -> /integration -[Agent detects iOS project] -[Provides step-by-step Podfile updates, SDK initialization guidance] -``` +**What it does:** Provides interactive step-by-step guidance for SDK integration. Unlike `/install` (autonomous), this asks questions and waits for confirmation. #### `/event-tracking` - Event Tracking Setup -**Category:** Interactive Skill (Chat Mode Only) +**Category:** Advanced Skill (Hidden from Menu) -**What it does:** Sets up event tracking with `Clix.trackEvent()` for analytics and user behavior monitoring with guided workflow. +**Why hidden:** Post-installation feature, not needed for initial SDK setup. -**Platforms:** iOS, Android, React Native, Flutter - -**Example:** -``` -> /event-tracking -[Agent helps implement event tracking] -[Shows code examples for custom events] -[Creates event plan and validation] -``` +**What it does:** Sets up event tracking with `Clix.trackEvent()` for analytics. Creates event plan, validates schema, provides platform-specific code. #### `/user-management` - User Management Setup -**Category:** Interactive Skill (Chat Mode Only) +**Category:** Advanced Skill (Hidden from Menu) -**What it does:** Configures user identification and properties management with Clix SDK through guided steps. +**Why hidden:** Post-installation feature, not needed for initial SDK setup. -**Example:** -``` -> /user-management -[Agent guides through setUserId(), setUserProperties()] -[Explains best practices for user identification and logout handling] -``` +**What it does:** Configures user identification (`setUserId`, `setUserProperties`) with best practices for login/logout handling. #### `/personalization` - Personalization Templates -**Category:** Interactive Skill (Chat Mode Only) +**Category:** Advanced Skill (Hidden from Menu) -**What it does:** Creates and debugs personalization templates for push notifications and in-app messages using Liquid-style templates. +**Why hidden:** Advanced campaign feature, not needed for initial SDK setup. -**Example:** -``` -> /personalization -[Agent helps create templates with variables] -[Debugs template rendering issues] -[Validates template syntax] -``` +**What it does:** Creates and debugs Liquid-style personalization templates for messages and deep links. #### `/api-triggered-campaigns` - API-Triggered Campaign Setup -**Category:** Interactive Skill (Chat Mode Only) +**Category:** Advanced Skill (Hidden from Menu) -**What it does:** Helps configure API-triggered campaigns in the Clix console and implement backend trigger code. +**Why hidden:** Advanced backend feature, not needed for initial SDK setup. -**Example:** -``` -> /api-triggered-campaigns -[Agent guides through campaign configuration] -[Provides backend integration patterns] -[Creates API trigger plan] -``` +**What it does:** Helps configure API-triggered campaigns and implement backend trigger code. ### System Commands @@ -1249,30 +1218,32 @@ When helping users with Clix CLI, keep these points in mind: 1. **Primary command is `clix`** - This launches interactive chat, not just a welcome screen 2. **Interactive > Commands** - The tool is primarily interactive, not command-based 3. **6 supported agents** - Gemini, Copilot, OpenCode, Cursor, Claude, Codex (recommend starting with Gemini or Copilot for free tiers) -4. **19 slash commands** - 4 autonomous commands + 5 interactive skills + 10 system commands -5. **Autonomous vs Interactive** - Autonomous commands (`/install`, `/doctor`, `/debug`, `/ios-setup`) can run from CLI, Interactive skills (`/integration`, `/event-tracking`, etc.) require chat mode -6. **Skills from package** - Interactive skills from @clix-so/clix-agent-skills package, Autonomous commands are local -7. **/install vs /integration** - `/install` makes changes autonomously, `/integration` provides guided steps -8. **Session transfer** - Saves to `~/.local/state/clix/sessions/`, provides command for native CLI -9. **Agent switching** - Preserves history when switching between any agents -10. **Context management** - 200K tokens (Claude), auto-compact at 90% -11. **MCP integration** - Built-in installer for Clix MCP Server supporting all agents -12. **XDG paths** - Config in `~/.config/clix/`, sessions in `~/.local/state/clix/sessions/` +4. **3 visible commands in menu** - `/install`, `/doctor`, `/debug` - these are the primary entry points +5. **6 hidden commands** - `/ios-setup`, `/integration`, `/event-tracking`, `/user-management`, `/personalization`, `/api-triggered-campaigns` - accessible by typing directly +6. **/install is the main entry point** - Comprehensive orchestrator that handles SDK installation, iOS NSE setup, and Firebase guidance +7. **/doctor checks completeness** - Not just "is SDK installed" but "what percentage of setup is complete" +8. **Hidden commands still work** - Type `/integration` directly to use it, just won't appear in autocomplete menu +9. **Session transfer** - Saves to `~/.local/state/clix/sessions/`, provides command for native CLI +10. **Agent switching** - Preserves history when switching between any agents +11. **Context management** - 200K tokens (Claude), auto-compact at 90% +12. **MCP integration** - Built-in installer for Clix MCP Server supporting all agents +13. **XDG paths** - Config in `~/.config/clix/`, sessions in `~/.local/state/clix/sessions/` **When users ask about:** - "How to use" → Emphasize `clix` command starts chat, use `/help` for commands - "Which agents" → 6 agents supported: Gemini (free, 1000/day), Copilot (free, 50/mo), OpenCode, Cursor, Claude, Codex - configure with `clix agent` - "Free tier" → Recommend Gemini (1000 requests/day) or GitHub Copilot (50 premium/month) -- "Installation" → `/install` for autonomous, `/integration` for guided steps +- "Installation" → Use `/install` - it's the comprehensive orchestrator that handles everything - "Debugging" → Recommend `/debug` for interactive diagnosis -- "SDK integration" → Use `/install` for autonomous installation or `/integration` skill for guided steps -- "iOS installation" → Detect: Package.swift (SPM, preferred), Podfile (CocoaPods), or suggest SPM for bare Xcode projects. SPM is the modern, recommended approach. -- "SPM/Swift Package Manager" → Guide through Package.swift modification or Xcode UI (File > Add Package Dependencies) for adding packages -- "iOS capabilities" → Use `/ios-setup` to configure Push Notifications, App Groups, and Notification Service Extension (NSE) -- "Event tracking" → Use `/event-tracking` skill (interactive, creates event plans) -- "User management" → Use `/user-management` skill (setUserId, properties, logout handling) -- "Personalization" → Use `/personalization` skill (Liquid templates for messages) -- "API campaigns" → Use `/api-triggered-campaigns` skill (backend integration) +- "SDK integration" → Use `/install` for comprehensive setup; `/integration` is hidden but still accessible for interactive guidance +- "iOS installation" → `/install` handles iOS setup including NSE, entitlements, and capabilities guidance +- "iOS capabilities" → `/install` handles this; `/ios-setup` is hidden but accessible for standalone iOS setup +- "Check SDK status" → Use `/doctor` - it shows installation completeness percentage and issues +- "Event tracking" → Type `/event-tracking` directly (hidden from menu, post-installation feature) +- "User management" → Type `/user-management` directly (hidden from menu, post-installation feature) +- "Personalization" → Type `/personalization` directly (hidden from menu, campaign feature) +- "API campaigns" → Type `/api-triggered-campaigns` directly (hidden from menu, backend feature) +- "Why can't I find X command" → Some commands are hidden from menu but still accessible by typing them directly - "Context full" → Suggest `/compact` or `/c` to compress history - "Transfer session" → Use `/transfer` or `/t` to continue in native CLI - "Start fresh" → Use `/new` to start a new session (not `/clear`, which is legacy alias) diff --git a/src/lib/commands/__tests__/registry.test.ts b/src/lib/commands/__tests__/registry.test.ts index e823367..2624dc3 100644 --- a/src/lib/commands/__tests__/registry.test.ts +++ b/src/lib/commands/__tests__/registry.test.ts @@ -97,8 +97,12 @@ describe('Command Registry', () => { test('should include skill commands', () => { const helpText = generateHelpText(); expect(helpText).toContain('Skills:'); - expect(helpText).toContain('/integration'); - expect(helpText).toContain('/event-tracking'); + // Check for visible skills (install, doctor are not hidden) + expect(helpText).toContain('/install'); + expect(helpText).toContain('/doctor'); + // Hidden skills should NOT appear in help text + expect(helpText).not.toContain('/integration'); + expect(helpText).not.toContain('/event-tracking'); }); test('should include system commands', () => { diff --git a/src/lib/commands/skills.ts b/src/lib/commands/skills.ts index e239983..4f52eee 100644 --- a/src/lib/commands/skills.ts +++ b/src/lib/commands/skills.ts @@ -11,6 +11,27 @@ import { EMBEDDED_SKILL_METADATA, type SkillMetadata } from '../embedded-skills' import type { SkillType } from '../skills'; import type { Command } from './types'; +/** + * Package skills to hide from the slash command menu. + * These are still accessible by typing the full command directly. + * Hidden because they overlap with /install or are advanced features not needed for initial setup. + */ +const HIDDEN_PACKAGE_SKILLS = new Set([ + 'integration', // Overlaps with /install + 'event-tracking', // Advanced, not needed for initial install + 'user-management', // Advanced, not needed for initial install + 'personalization', // Campaign feature, advanced + 'api-triggered-campaigns', // Backend feature, advanced +]); + +/** + * Local skills to hide from the slash command menu. + * These are still accessible by typing the full command directly. + */ +const HIDDEN_LOCAL_SKILLS = new Set([ + 'ios-setup', // Sub-skill invoked by /install +]); + /** * Create a skill command from metadata. */ @@ -20,7 +41,7 @@ function createSkillCommand(meta: SkillMetadata): Command { name: meta.commandName, description: meta.shortDescription || meta.displayName, isEnabled: true, - isHidden: false, + isHidden: HIDDEN_PACKAGE_SKILLS.has(meta.commandName), userFacingName() { return `/${meta.commandName}`; @@ -48,7 +69,7 @@ function createLocalSkillCommand( name, description: displayName, isEnabled: true, - isHidden: false, + isHidden: HIDDEN_LOCAL_SKILLS.has(name), aliases, userFacingName() { diff --git a/src/lib/skills/doctor/SKILL.md b/src/lib/skills/doctor/SKILL.md index 85108d7..c7216c8 100644 --- a/src/lib/skills/doctor/SKILL.md +++ b/src/lib/skills/doctor/SKILL.md @@ -1,10 +1,12 @@ # Clix SDK Doctor -You are analyzing a mobile project for Clix SDK integration status. +You are analyzing a mobile project for Clix SDK integration status and completeness. ## Task -Analyze the project and output a diagnostic JSON report: +Analyze the project and output a comprehensive diagnostic JSON report followed by actionable recommendations. + +## Diagnostic JSON Schema ```json { @@ -12,10 +14,11 @@ Analyze the project and output a diagnostic JSON report: "installationMethod": "spm-package-swift" | "spm-xcode" | "cocoapods" | "npm" | "gradle" | "pubspec" | "none", "sdkInstalled": true | false, "sdkVersion": "version string or null", + "sdkInitialized": true | false, "pushConfigured": true | false, "issues": [ { - "type": "sdk" | "push" | "config" | "general", + "type": "sdk" | "push" | "config" | "ios" | "android" | "firebase" | "general", "severity": "error" | "warning" | "info", "file": "File name or path", "description": "Problem explanation", @@ -24,15 +27,25 @@ Analyze the project and output a diagnostic JSON report: ], "checklist": { "sdkDependency": true | false, + "sdkInitialization": true | false, "apiKeyConfigured": true | false, "pushPermissions": true | false, "entitlements": true | false, + "iosNseConfigured": true | false, + "iosAppGroupsConfigured": true | false, + "iosPushCapability": true | false, + "androidManifestComplete": true | false, "firebaseConfig": true | false, "firebaseAndroid": true | false, "firebaseIos": true | false, "firebasePackageMatch": true | false, "firebaseBundleMatch": true | false }, + "installCompleteness": { + "percentage": 0-100, + "completedSteps": ["step1", "step2"], + "missingSteps": ["step3", "step4"] + }, "nextSteps": ["Step 1", "Step 2"] } ``` @@ -40,24 +53,108 @@ Analyze the project and output a diagnostic JSON report: ## Analysis Checklist ### Platform Detection -1. Check for package.json (React Native/Expo) -2. Check for pubspec.yaml (Flutter) -3. Check for *.xcodeproj or *.xcworkspace (iOS) -4. Check for build.gradle or AndroidManifest.xml (Android) + +1. Check for `package.json` (React Native/Expo) +2. Check for `pubspec.yaml` (Flutter) +3. Check for `*.xcodeproj` or `*.xcworkspace` (iOS) +4. Check for `build.gradle` or `AndroidManifest.xml` (Android) ### SDK Installation Check -- **iOS**: Check in order of priority: - 1. `Package.swift` with iOS platform target (contains `.iOS` or `platforms: [.iOS`) for package dependency containing `clix-ios-sdk` or `clix` → `installationMethod: "spm-package-swift"` - 2. `Podfile` for 'ClixSDK' or 'Clix' pod → `installationMethod: "cocoapods"` - 3. `*.xcodeproj/project.pbxproj` for `XCRemoteSwiftPackageReference` containing `clix` → `installationMethod: "spm-xcode"` -- Android: Check build.gradle for clix dependency → `installationMethod: "gradle"` -- React Native: Check package.json for '@clix-so/react-native-sdk' → `installationMethod: "npm"` -- Flutter: Check pubspec.yaml for 'clix_flutter_sdk' → `installationMethod: "pubspec"` + +**iOS** - Check in order of priority: +1. `Package.swift` with iOS platform target (contains `.iOS` or `platforms: [.iOS`) for package dependency containing `clix-ios-sdk` or `clix` → `installationMethod: "spm-package-swift"` +2. `Podfile` for 'ClixSDK' or 'Clix' pod → `installationMethod: "cocoapods"` +3. `*.xcodeproj/project.pbxproj` for `XCRemoteSwiftPackageReference` containing `clix` → `installationMethod: "spm-xcode"` + +**Android:** +- Check `build.gradle` for clix dependency → `installationMethod: "gradle"` + +**React Native:** +- Check `package.json` for `@clix-so/react-native-sdk` → `installationMethod: "npm"` + +**Flutter:** +- Check `pubspec.yaml` for `clix_flutter_sdk` or `clix_flutter` → `installationMethod: "pubspec"` + +### SDK Initialization Check + +Verify SDK is initialized in the correct entry point: + +**React Native:** +- Look for `Clix.initialize` in `app/_layout.tsx`, `index.js`, or `App.tsx` +- Check for import statement: `import { Clix } from '@clix-so/react-native-sdk'` + +**iOS:** +- Look for `Clix.initialize` in `AppDelegate.swift` or main app file +- Check for import statement: `import Clix` + +**Android:** +- Look for `Clix.initialize` in `Application.kt` or `Application.java` +- Check for import statement: `import so.clix.core.Clix` + +**Flutter:** +- Look for `Clix.initialize` in `main.dart` +- Check for import statement: `import 'package:clix_flutter/clix_flutter.dart'` ### Push Configuration Check -- iOS: Check entitlements for 'aps-environment' -- Android: Check AndroidManifest.xml for FCM service -- Check for google-services.json (Android) or GoogleService-Info.plist (iOS) + +**iOS:** +- Check entitlements for `aps-environment` key +- Check for Push Notifications capability in `project.pbxproj` +- Check for Background Modes with `remote-notification` + +**Android:** +- Check `AndroidManifest.xml` for FCM service declaration +- Check for required permissions + +### iOS Notification Service Extension (NSE) Check + +**Verify NSE target exists:** +- Search for `*NotificationServiceExtension` directory +- Look for `NotificationService.swift` file +- Check for `ClixNotificationServiceExtension` base class usage +- Verify `register(projectId:)` is called + +**Verify NSE dependencies:** +- CocoaPods: Check `Podfile` for extension target with Clix pod +- SPM: Check `project.pbxproj` for Clix package in extension target + +**NSE Issues to Detect:** +- NSE target missing +- NSE target exists but doesn't use `ClixNotificationServiceExtension` +- NSE target missing Clix SDK dependency +- NSE missing `register(projectId:)` call + +### iOS Capabilities Check + +**Push Notifications Capability:** +- Check `project.pbxproj` for `com.apple.Push` in SystemCapabilities +- Check entitlements file for `aps-environment` + +**App Groups Capability:** +- Check `project.pbxproj` for `com.apple.ApplicationGroups.iOS` in SystemCapabilities +- Check entitlements for `com.apple.security.application-groups` +- Verify format: `group.clix.{BUNDLE_ID}` +- Verify SAME App Group ID in both main app and NSE entitlements + +**Background Modes:** +- Check for `remote-notification` in UIBackgroundModes (Info.plist or project.pbxproj) + +**Capability Issues to Detect:** +- Push Notifications capability missing +- App Groups capability missing +- App Group ID mismatch between main app and NSE +- App Group ID format incorrect (should be `group.clix.{BUNDLE_ID}`) +- Background Modes missing or remote-notification not enabled + +### Android Manifest Check + +**Required permissions:** +- `android.permission.INTERNET` +- `android.permission.POST_NOTIFICATIONS` (Android 13+) + +**Required services/receivers:** +- FCM messaging service +- Broadcast receivers for push handling ### Firebase Configuration Check (Detailed) @@ -83,19 +180,110 @@ Analyze the project and output a diagnostic JSON report: - For React Native/Flutter projects, verify both Android and iOS configs exist - Verify PROJECT_ID matches between platforms +### Installation Completeness Assessment + +Based on platform, calculate completeness percentage: + +**React Native Checklist:** +1. SDK dependency in package.json +2. SDK initialized in entry point +3. iOS: Entitlements configured +4. iOS: NSE target configured +5. iOS: Push Notifications capability +6. iOS: App Groups capability +7. Android: Manifest permissions +8. Firebase: google-services.json present +9. Firebase: GoogleService-Info.plist present + +**iOS Native Checklist:** +1. SDK dependency (CocoaPods/SPM) +2. SDK initialized in AppDelegate +3. Entitlements configured +4. NSE target configured +5. Push Notifications capability +6. App Groups capability +7. Firebase: GoogleService-Info.plist present + +**Android Native Checklist:** +1. SDK dependency in build.gradle +2. SDK initialized in Application class +3. Manifest permissions +4. Firebase: google-services.json present + +**Flutter Checklist:** +1. SDK dependency in pubspec.yaml +2. SDK initialized in main.dart +3. iOS: Entitlements configured +4. iOS: NSE target configured +5. iOS: Push Notifications capability +6. iOS: App Groups capability +7. Android: Manifest permissions +8. Firebase: google-services.json present +9. Firebase: GoogleService-Info.plist present + ### Common Issues to Detect + +**SDK Issues:** - Missing SDK dependency +- SDK not initialized +- SDK initialized in wrong location +- API key placeholders not replaced +- Outdated SDK version + +**iOS Issues:** - Missing or invalid API key - Missing push notification permissions - Missing capabilities/entitlements -- Outdated SDK version -- Incomplete Firebase/APNs setup +- NSE not configured +- NSE using wrong base class +- NSE missing SDK dependency +- App Group ID mismatch +- App Group ID format incorrect + +**Android Issues:** +- Missing manifest permissions +- FCM service not configured +- Application class not registered in manifest + +**Firebase Issues:** - Firebase config file missing - Firebase config file in wrong location - Firebase config file invalid (malformed JSON/plist) - Firebase package name / bundle ID mismatch - Firebase project ID mismatch between platforms -Output the JSON diagnostic, then provide a brief summary with actionable recommendations. +## Output Format + +1. **Output the JSON diagnostic** with all checks completed + +2. **Provide a brief summary:** + ``` + DOCTOR SUMMARY + ============== + Platform: React Native + SDK Status: Installed (npm) + Initialization: Configured + Push Ready: Partial (iOS NSE missing) + + Installation Completeness: 67% (6/9 steps) + + Issues Found: 3 + [Error] iOS NSE not configured - rich push notifications won't work + [Warning] Firebase iOS config missing - push notifications won't work + [Info] API key placeholders need replacement + + Run /install to complete missing setup steps. + ``` + +3. **Provide actionable recommendations** for each issue found + +## Cross-Reference with Install + +When issues are found, reference what `/install` would have done: + +- "NSE not configured" → `/install` creates NotificationService.swift and entitlements +- "Entitlements missing" → `/install` creates entitlements files +- "SDK not initialized" → `/install` adds initialization code to entry point +- "Firebase config missing" → `/install` provides download instructions -Use `/firebase` command to interactively check and configure Firebase credentials. +Recommend running `/install` to fix automatable issues. diff --git a/src/lib/skills/install/SKILL.md b/src/lib/skills/install/SKILL.md index 810806a..3268561 100644 --- a/src/lib/skills/install/SKILL.md +++ b/src/lib/skills/install/SKILL.md @@ -1,11 +1,62 @@ -# Clix SDK Autonomous Installation +# Clix SDK Installation Orchestrator -You are an autonomous AI agent that installs and integrates the Clix mobile push notification SDK. +You are an autonomous AI agent that orchestrates complete Clix SDK installation with visual progress tracking. ## Core Directive **MODIFY FILES DIRECTLY** - You have full permission to create, edit, and delete files. Use Write and Edit tools immediately without asking for permission or confirmation. +## Visual Progress Format + +Display progress using this format throughout the installation: + +``` +PHASE 1: PROJECT ANALYSIS + [Scanning] Detecting project platform... + [Done] Platform: React Native + [Scanning] Checking project structure... + [Done] Entry point: app/_layout.tsx + [Scanning] Checking Firebase configuration... + [Warning] google-services.json missing + +PHASE 2: TASK PLAN + Tasks to complete: + 1. [ ] Install SDK dependency + 2. [ ] Initialize SDK in entry point + 3. [ ] Configure Firebase + 4. [ ] iOS: Setup capabilities and NSE + 5. [ ] Verify installation + +PHASE 3: EXECUTION + [1/5] Installing SDK dependency... + [Done] Added @clix-so/react-native-sdk to package.json + + [2/5] Initializing SDK... + [Done] Added Clix.initialize() to app/_layout.tsx + + [3/5] Configuring Firebase... + [Action Required] Download google-services.json from Firebase Console + + [4/5] iOS Setup... + [Action Required] Follow these steps in Xcode: + 1. File > New > Target > Notification Service Extension + 2. Name it "MyAppNotificationServiceExtension" + 3. Add Push Notifications capability to main app + 4. Add App Groups to main app and extension + [Done] Created NotificationService.swift + [Done] Updated entitlements files + + [5/5] Verifying installation... + [Done] SDK dependency installed + [Warning] Firebase config incomplete + +PHASE 4: SUMMARY + Completed: 4/5 tasks + Manual steps required: + - Download google-services.json from Firebase Console + - Create Notification Service Extension in Xcode +``` + ## Supported Platforms & Documentation - iOS: https://docs.clix.so/sdk-quickstart-ios @@ -13,7 +64,9 @@ You are an autonomous AI agent that installs and integrates the Clix mobile push - React Native: https://docs.clix.so/sdk-quickstart-react-native - Flutter: https://docs.clix.so/sdk-quickstart-flutter -## Platform Detection Priority +## Phase 1: Project Analysis + +### Platform Detection Priority 1. Check for cross-platform frameworks first: - `package.json` with React Native/Expo dependencies @@ -28,127 +81,324 @@ You are an autonomous AI agent that installs and integrates the Clix mobile push - Note: `Package.swift` without iOS platform is likely a server-side Swift or CLI project, not iOS - `build.gradle` or `AndroidManifest.xml` for Android -## Installation Steps - -### 1. Detect Platform -Analyze project files to identify the platform. - -### 2. Install SDK Package - -**React Native:** -- Add `@clix-so/react-native-sdk` to package.json -- Run npm/yarn install - -**iOS (Dependency Manager Detection):** - -First, detect the dependency manager being used: - -1. **Pure SPM iOS Project** (has `Package.swift` with iOS platform target): - - First verify Package.swift contains iOS platform (`.iOS`, `.iOS(.v13)`, `platforms: [.iOS]`, etc.) - - If no iOS platform found, this is likely a server-side Swift project - skip iOS installation - - Read Package.swift and add to dependencies array: - ```swift - .package(url: "https://github.com/clix-so/clix-ios-sdk.git", from: "1.0.0") - ``` - - Add to target dependencies: - ```swift - .product(name: "Clix", package: "clix-ios-sdk") - ``` - - Run `swift package resolve` - -2. **CocoaPods Project** (has `Podfile`): - - Add to Podfile: - ```ruby - pod 'Clix', :git => 'https://github.com/clix-so/clix-ios-sdk.git' - ``` - - Run: `cd ios && pod install` - -3. **Xcode Project with SPM** (has `project.pbxproj` with `XCRemoteSwiftPackageReference`): - - Inform user to add via Xcode: File > Add Package Dependencies - - URL: `https://github.com/clix-so/clix-ios-sdk` - - Note: Direct .pbxproj modification is complex; prefer Xcode UI - -4. **Bare Xcode Project** (only `*.xcodeproj` or `*.xcworkspace`): - - Recommend SPM: Guide user to add via Xcode (File > Add Package Dependencies) - - Alternative: Create Podfile and use CocoaPods - -**Android:** -- Add to build.gradle - -**Flutter:** -- Add to pubspec.yaml -- Run flutter pub get - -### 3. Create/Modify Files Directly - -**React Native:** -- Create initialization module or add to existing entry file -- Update constants file with CLIX_PROJECT_ID and CLIX_PUBLIC_API_KEY exports -- Add initialization call in app entry point (app/_layout.tsx or index.js) -- Add configuration to environment files with placeholders - -**iOS:** -- Modify AppDelegate to initialize SDK -- Add Info.plist entries -- Note: Xcode capabilities (Push Notifications, Background Modes) require manual IDE steps - -**Android:** -- Modify MainActivity or Application class -- Update AndroidManifest.xml with permissions -- Verify Firebase configuration (see step 6) - -**Flutter:** -- Modify main.dart to initialize SDK -- Update platform-specific files as needed -- Verify Firebase configuration (see step 6) - -### 4. Use Placeholders for Secrets - -Use `YOUR_CLIX_PROJECT_ID` and `YOUR_CLIX_PUBLIC_API_KEY` as placeholders. Inform user to replace with actual credentials from https://console.clix.so/ - -### 5. Run Post-Installation Commands - -Execute necessary commands: -- `npm install` or `yarn install` after package.json changes -- `cd ios && pod install` for iOS dependencies -- `flutter pub get` for Flutter +### Project Structure Analysis -### 6. Verify Firebase Configuration +Identify: +- Entry point file (e.g., `app/_layout.tsx`, `index.js`, `AppDelegate.swift`, `main.dart`) +- Dependency manager (npm/yarn/bun, CocoaPods/SPM, Gradle, pubspec) +- Existing SDK presence (check for Clix imports) +- Firebase configuration status -For push notifications to work, Firebase must be properly configured: +### Firebase Configuration Check **Android (google-services.json):** - Expected locations: - Standard Android: `app/google-services.json` - React Native/Flutter: `android/app/google-services.json` -- Download from Firebase Console > Project Settings > Your apps > Android app -- Verify package name matches your AndroidManifest.xml **iOS (GoogleService-Info.plist):** - Expected locations: - React Native: `ios/GoogleService-Info.plist` - Flutter: `ios/Runner/GoogleService-Info.plist` - Native iOS: `/GoogleService-Info.plist` -- Download from Firebase Console > Project Settings > Your apps > iOS app -- Verify bundle ID matches your Xcode project -**Validation:** -- Check if files exist in correct locations -- Verify JSON/plist structure is valid -- Confirm project IDs match between platforms (for cross-platform apps) +## Phase 2: Task Plan -Use `/firebase` command in interactive mode to check and configure Firebase credentials. +After analysis, output a numbered task list: + +``` +Tasks to complete: +1. [ ] Install SDK dependency +2. [ ] Initialize SDK in entry point +3. [ ] Configure Firebase (if missing) +4. [ ] iOS: Setup capabilities and NSE (if iOS/cross-platform) +5. [ ] Android: Update manifest (if Android/cross-platform) +6. [ ] Verify installation +``` + +## Phase 3: Execution + +### Task: Install SDK Package + +**React Native:** +```bash +# Add to package.json dependencies +npm install @clix-so/react-native-sdk +# or yarn add @clix-so/react-native-sdk +``` + +**iOS (CocoaPods):** +```ruby +# Add to Podfile +pod 'Clix', :git => 'https://github.com/clix-so/clix-ios-sdk.git' +``` +Then run: `cd ios && pod install` + +**iOS (SPM - Package.swift):** +```swift +// Add to dependencies array +.package(url: "https://github.com/clix-so/clix-ios-sdk.git", from: "1.0.0") +// Add to target dependencies +.product(name: "Clix", package: "clix-ios-sdk") +``` +Then run: `swift package resolve` + +**iOS (Xcode SPM):** +Provide instructions: +``` +[Action Required] Add package via Xcode: + 1. File > Add Package Dependencies + 2. URL: https://github.com/clix-so/clix-ios-sdk + 3. Click "Add Package" +``` + +**Android:** +```kotlin +// Add to build.gradle dependencies +implementation("so.clix:clix-android-sdk:latest") +``` + +**Flutter:** +```yaml +# Add to pubspec.yaml dependencies +dependencies: + clix_flutter: ^0.0.1 + firebase_core: ^3.6.0 + firebase_messaging: ^15.1.3 +``` +Then run: `flutter pub get` + +### Task: Initialize SDK + +**React Native (app/_layout.tsx or index.js):** +```typescript +import { Clix } from '@clix-so/react-native-sdk'; + +// Initialize at app startup +Clix.initialize({ + projectId: 'YOUR_CLIX_PROJECT_ID', + apiKey: 'YOUR_CLIX_PUBLIC_API_KEY', +}); +``` + +**iOS (AppDelegate.swift):** +```swift +import Clix + +func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + let config = ClixConfig( + projectId: "YOUR_CLIX_PROJECT_ID", + apiKey: "YOUR_CLIX_PUBLIC_API_KEY" + ) + Clix.initialize(config: config) + return true +} +``` + +**Android (Application.kt):** +```kotlin +import so.clix.core.Clix +import so.clix.core.ClixConfig + +class MyApplication : Application() { + override fun onCreate() { + super.onCreate() + val config = ClixConfig.Builder() + .projectId("YOUR_CLIX_PROJECT_ID") + .apiKey("YOUR_CLIX_PUBLIC_API_KEY") + .build() + Clix.initialize(this, config) + } +} +``` + +**Flutter (main.dart):** +```dart +import 'package:clix_flutter/clix_flutter.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp(); + + await Clix.initialize( + ClixConfig( + projectId: 'YOUR_CLIX_PROJECT_ID', + apiKey: 'YOUR_CLIX_PUBLIC_API_KEY', + ), + ); + + runApp(const MyApp()); +} +``` + +### Task: iOS Capabilities and NSE Setup + +For iOS and cross-platform projects, include iOS-specific setup: + +**Step 1: Create entitlements files** + +Create `{AppName}.entitlements`: +```xml + + + + + aps-environment + development + com.apple.security.application-groups + + group.clix.{BUNDLE_ID} + + + +``` + +**Step 2: Notification Service Extension (NSE)** + +Provide clear instructions for Xcode: +``` +[Action Required] Create Notification Service Extension in Xcode: + 1. File > New > Target + 2. Select "Notification Service Extension" + 3. Name it "{AppName}NotificationServiceExtension" + 4. Click "Finish" (Cancel the "Activate scheme" dialog) +``` + +Then create/modify the NotificationService.swift: +```swift +import UserNotifications +import Clix + +class NotificationService: ClixNotificationServiceExtension { + override func didReceive( + _ request: UNNotificationRequest, + withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void + ) { + register(projectId: "YOUR_CLIX_PROJECT_ID") + super.didReceive(request, withContentHandler: contentHandler) + } +} +``` + +Create extension entitlements `{AppName}NotificationServiceExtension.entitlements`: +```xml + + + + + com.apple.security.application-groups + + group.clix.{BUNDLE_ID} + + + +``` + +**For CocoaPods projects, add to Podfile:** +```ruby +target '{AppName}NotificationServiceExtension' do + pod 'Clix', :git => 'https://github.com/clix-so/clix-ios-sdk.git' +end +``` +Then run: `cd ios && pod install` + +**Step 3: Xcode Capabilities Instructions** +``` +[Action Required] Add capabilities in Xcode: + 1. Select your main app target + 2. Go to "Signing & Capabilities" tab + 3. Click "+ Capability" + 4. Add "Push Notifications" + 5. Add "Background Modes" and enable "Remote notifications" + 6. Add "App Groups" and create: group.clix.{BUNDLE_ID} + 7. Repeat App Groups for the NSE target with SAME group ID + +[Action Required] For Xcode 15+, set build settings: + 1. Select extension target + 2. Build Settings > ENABLE_USER_SCRIPT_SANDBOXING = No +``` + +### Task: Firebase Configuration + +If Firebase config is missing: +``` +[Action Required] Download Firebase configuration: + + Android: + 1. Go to Firebase Console > Project Settings > Your apps + 2. Select your Android app + 3. Download google-services.json + 4. Place in: android/app/google-services.json + + iOS: + 1. Go to Firebase Console > Project Settings > Your apps + 2. Select your iOS app + 3. Download GoogleService-Info.plist + 4. Place in: ios/GoogleService-Info.plist (React Native) + ios/Runner/GoogleService-Info.plist (Flutter) +``` + +### Task: Verify Installation + +Run checks and report: +- SDK dependency in lock file +- Initialization code present +- Firebase config files (report status) +- Entitlements files created (iOS) + +## Phase 4: Summary + +Output a completion summary: + +``` +INSTALLATION SUMMARY +==================== + +Platform: React Native +SDK Version: @clix-so/react-native-sdk@latest + +Completed Tasks: + [Done] SDK dependency installed + [Done] SDK initialized in app/_layout.tsx + [Done] iOS entitlements configured + [Done] NotificationService.swift created + +Manual Steps Required: + - Replace YOUR_CLIX_PROJECT_ID with your project ID from https://console.clix.so/ + - Replace YOUR_CLIX_PUBLIC_API_KEY with your API key + - Download google-services.json from Firebase Console + - Download GoogleService-Info.plist from Firebase Console + - Create Notification Service Extension target in Xcode + - Add Push Notifications capability in Xcode + - Add App Groups capability in Xcode + +Files Modified: + - package.json (added dependency) + - app/_layout.tsx (added initialization) + - ios/{AppName}.entitlements (created) + - ios/{AppName}NotificationServiceExtension/{AppName}NotificationServiceExtension.entitlements (created) + - ios/{AppName}NotificationServiceExtension/NotificationService.swift (created) + - ios/Podfile (added extension target) + +Next Steps: + 1. Run: npm install && cd ios && pod install + 2. Complete manual steps listed above + 3. Build and run your app + 4. Run /doctor to verify installation +``` ## Automation Rules -✅ **DO:** +**DO:** - Use Write tool to create new files immediately - Use Edit tool to modify existing files immediately - Use Bash tool to run installation commands - Proceed autonomously through all steps -- Report what was done after completion +- Report progress using visual format +- Complete all automatable tasks -❌ **DO NOT:** +**DO NOT:** - Ask for permission or confirmation - Say "you should" or "please add" - just do it - Provide manual steps for code changes - make the changes @@ -156,43 +406,18 @@ Use `/firebase` command in interactive mode to check and configure Firebase cred ## IDE-Only Manual Steps -Only these require user action: -- Xcode: Adding capabilities, configuring entitlements -- Android Studio: Firebase setup UI, capability configuration -- Building and running the project - -For these, provide brief instructions but don't wait for confirmation. - -### iOS Notification Service Extension (Recommended) - -For rich push notifications (images, buttons), create a Notification Service Extension: - -1. In Xcode: File > New > Target > Notification Service Extension -2. Add Clix SDK to the extension target: - - **CocoaPods**: Add `target 'YourExtension' do pod 'Clix' end` to Podfile, then `pod install` - - **SPM**: Add Clix package to extension target in Xcode (General > Frameworks) -3. Implement NotificationService.swift: - ```swift - import UserNotifications - import Clix - - class NotificationService: ClixNotificationServiceExtension { - override func didReceive(_ request: UNNotificationRequest, - withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { - register(projectId: "YOUR_PROJECT_ID") - super.didReceive(request, withContentHandler: contentHandler) - } - } - ``` -4. Add App Groups capability to both main app and extension (same group ID: `group.clix.{BUNDLE_ID}`) -5. For Xcode 15+: Set `ENABLE_USER_SCRIPT_SANDBOXING` to "No" in extension's Build Settings - -For detailed setup, run `clix ios-setup` or `/ios-setup` in interactive mode. - -## Output Format - -After completion, report: -✓ Files created/modified (with paths) -✓ Commands executed -✓ Placeholders that need replacement -✓ Any IDE-only steps required +Only these require user action in Xcode: +- Creating NSE target (File > New > Target) +- Adding capabilities (Signing & Capabilities tab) +- Build settings changes (ENABLE_USER_SCRIPT_SANDBOXING) + +For Apple Developer Portal: +- Enabling Push Notifications on App ID +- Registering App Group ID +- Regenerating provisioning profiles + +For Firebase Console: +- Downloading google-services.json +- Downloading GoogleService-Info.plist + +Provide brief, numbered instructions but don't wait for confirmation. diff --git a/src/lib/skills/ios-setup/SKILL.md b/src/lib/skills/ios-setup/SKILL.md index f42786f..76d5604 100644 --- a/src/lib/skills/ios-setup/SKILL.md +++ b/src/lib/skills/ios-setup/SKILL.md @@ -1,11 +1,42 @@ # iOS Capabilities Configuration -You are an AI agent that configures iOS capabilities required for the Clix SDK. +You are an AI agent that configures iOS capabilities required for the Clix SDK. This skill can run standalone or as a sub-skill invoked by `/install`. ## Core Directive **GUIDE USERS** through iOS capability configuration for push notifications and data sharing. For file modifications, use Edit/Write tools when possible. For Xcode-only steps, provide clear step-by-step instructions. +## Structured Output Format + +When invoked as a sub-skill (by `/install`), output structured progress: + +``` +IOS SETUP PROGRESS +================== + [Scanning] Detecting iOS project... + [Done] Found: MyApp.xcodeproj + [Done] Bundle ID: com.example.myapp + + [Scanning] Checking capabilities status... + [Done] Push Notifications: not configured + [Done] App Groups: not configured + [Done] NSE target: not found + + [Creating] Main app entitlements... + [Done] Created: ios/MyApp/MyApp.entitlements + + [Creating] NSE entitlements... + [Done] Created: ios/MyAppNotificationServiceExtension/MyAppNotificationServiceExtension.entitlements + + [Creating] NotificationService.swift... + [Done] Created: ios/MyAppNotificationServiceExtension/NotificationService.swift + + [Action Required] Complete in Xcode: + 1. Create NSE target (File > New > Target > Notification Service Extension) + 2. Add Push Notifications capability + 3. Add App Groups capability to main app and NSE +``` + ## Required Capabilities for Clix iOS SDK ### 1. Push Notifications @@ -23,6 +54,12 @@ You are an AI agent that configures iOS capabilities required for the Clix SDK. - **Xcode Capability:** App Groups - **Important:** Must be configured for BOTH main app AND Notification Service Extension targets +### 3. Background Modes (Recommended) + +- **Purpose:** Process push notifications in the background +- **Key:** `UIBackgroundModes` with `remote-notification` +- **Xcode Capability:** Background Modes > Remote notifications + ## Workflow ### Phase 1: Project Analysis @@ -41,60 +78,23 @@ You are an AI agent that configures iOS capabilities required for the Clix SDK. - Check for `aps-environment` entitlement (Push Notifications configured) - Check for `com.apple.security.application-groups` (App Groups configured) - Check `project.pbxproj` for `SystemCapabilities` section + - Check for existing NSE target 4. **Report Current State** - Output findings: - ```text + ``` Project: {project_name} Bundle ID: {bundle_id} Push Notifications: {configured/not configured} App Groups: {configured/not configured} + NSE Target: {found/not found} Existing entitlements files: {list} ``` -### Phase 2: Xcode Configuration (Manual Steps) - -Provide clear instructions for adding capabilities in Xcode. These steps CANNOT be automated and require user action in Xcode IDE. - -**Add Push Notifications:** -```text -1. Open your project in Xcode -2. Select your main app target in the Navigator (left sidebar) -3. Go to the "Signing & Capabilities" tab -4. Click the "+ Capability" button -5. Search for and select "Push Notifications" -6. Xcode will automatically create an entitlements file if one doesn't exist -``` - -**Add Background Modes (Recommended):** -```text -1. In "Signing & Capabilities", click "+ Capability" -2. Select "Background Modes" -3. Enable "Remote notifications" checkbox - - This allows the app to process push notifications in the background -``` - -**Add App Groups:** -```text -1. Click "+ Capability" -2. Select "App Groups" -3. Click the "+" button under App Groups -4. Enter the App Group ID: group.clix.{BUNDLE_ID} - Example: group.clix.com.example.myapp -5. Click OK to create the group - -IMPORTANT: Repeat steps 1-5 for the Notification Service Extension target: -1. Select the extension target (usually named "{AppName}NotificationServiceExtension") -2. Go to "Signing & Capabilities" -3. Add "App Groups" capability -4. Select the SAME App Group ID you created above -``` - -### Phase 3: Entitlements Files +### Phase 2: Automated File Creation -Create or modify entitlements files. Use Write/Edit tools for these operations. +Create entitlements files and NSE implementation. Use Write/Edit tools for these operations. -**Main App Entitlements** (`{AppName}.entitlements` or `{AppName}/{AppName}.entitlements`): +**Main App Entitlements** (`{AppName}.entitlements` or `ios/{AppName}/{AppName}.entitlements`): ```xml @@ -128,20 +128,7 @@ Create or modify entitlements files. Use Write/Edit tools for these operations. **Note:** Replace `{BUNDLE_ID}` with the actual bundle identifier (e.g., `com.example.myapp`). -### Phase 3.5: Notification Service Extension Setup - -Create a Notification Service Extension for rich push notifications (images, buttons, etc.). - -**Create Extension Target in Xcode:** -```text -1. File > New > Target -2. Select "Notification Service Extension" -3. Name it "{AppName}NotificationServiceExtension" (e.g., "MyAppNotificationServiceExtension") -4. Click "Finish" (Cancel the "Activate scheme" dialog) -5. Note: Use this exact name consistently in Podfile, entitlements path, and SPM setup -``` - -**Implement NotificationService.swift:** +**NotificationService.swift:** ```swift import UserNotifications @@ -158,121 +145,173 @@ class NotificationService: ClixNotificationServiceExtension { } ``` -**Note:** Replace `YOUR_PROJECT_ID` with your actual Clix project ID from +**Note:** Replace `YOUR_PROJECT_ID` with actual Clix project ID from https://console.clix.so/ + +### Phase 3: Xcode Configuration (Manual Steps) + +Provide clear instructions for adding capabilities in Xcode. These steps CANNOT be automated and require user action. + +**Create Notification Service Extension:** +``` +[Action Required] Create NSE target in Xcode: +1. File > New > Target +2. Select "Notification Service Extension" +3. Name it "{AppName}NotificationServiceExtension" +4. Click "Finish" (Cancel the "Activate scheme" dialog) +5. Replace generated NotificationService.swift with Clix implementation +``` + +**Add Push Notifications:** +``` +[Action Required] Add Push Notifications capability: +1. Select your main app target +2. Go to "Signing & Capabilities" tab +3. Click "+ Capability" +4. Select "Push Notifications" +``` + +**Add Background Modes (Recommended):** +``` +[Action Required] Add Background Modes: +1. In "Signing & Capabilities", click "+ Capability" +2. Select "Background Modes" +3. Enable "Remote notifications" checkbox +``` + +**Add App Groups:** +``` +[Action Required] Add App Groups capability: +1. Click "+ Capability" +2. Select "App Groups" +3. Click the "+" button +4. Enter: group.clix.{BUNDLE_ID} +5. Click OK + +IMPORTANT: Repeat for NSE target: +1. Select the extension target +2. Go to "Signing & Capabilities" +3. Add "App Groups" capability +4. Select the SAME App Group ID +``` -**Add Clix SDK to Extension Target:** +**Add Clix SDK to Extension:** For CocoaPods projects, add to Podfile: ```ruby target '{AppName}NotificationServiceExtension' do - pod 'Clix' + pod 'Clix', :git => 'https://github.com/clix-so/clix-ios-sdk.git' end ``` Then run: `cd ios && pod install` -For SPM projects in Xcode: +For SPM projects: +``` +[Action Required] Add Clix to extension target: 1. Select the extension target 2. Go to General > Frameworks, Libraries, and Embedded Content 3. Click + and add the Clix package +``` **Configure Build Settings (Xcode 15+):** +``` +[Action Required] For Xcode 15+: +1. Select extension target +2. Go to Build Settings +3. Search for "ENABLE_USER_SCRIPT_SANDBOXING" +4. Set to "No" -For the extension target: -- Set `ENABLE_USER_SCRIPT_SANDBOXING` to "No" in Build Settings - -For React Native projects with Firebase: +For React Native with Firebase: - In Build Phases, move "Embed Foundation Extensions" above "[RNFB] Core Configuration" +``` ### Phase 4: Apple Developer Portal Configuration Guide user through manual portal configuration. These steps CANNOT be automated. **Enable Capabilities on App ID:** -```text +``` +[Action Required] Enable capabilities in Apple Developer Portal: 1. Go to https://developer.apple.com/account 2. Navigate to "Certificates, Identifiers & Profiles" -3. Select "Identifiers" from the sidebar -4. Find and click your App ID (Bundle ID) -5. Scroll down to "Capabilities" section -6. Enable "Push Notifications" - - You may need to configure certificates (Development/Production) -7. Enable "App Groups" -8. Click "Save" +3. Select "Identifiers" +4. Find your App ID (Bundle ID) +5. Enable "Push Notifications" +6. Enable "App Groups" +7. Click "Save" ``` **Register App Group ID:** -```text -1. In the sidebar, select "Identifiers" -2. Click the "+" button -3. Select "App Groups" and click "Continue" -4. Enter: +``` +[Action Required] Register App Group: +1. In Identifiers, click "+" +2. Select "App Groups" and click "Continue" +3. Enter: - Description: Clix SDK App Group for {App Name} - Identifier: group.clix.{BUNDLE_ID} -5. Click "Continue" then "Register" -6. Go back to your App ID and associate the App Group: +4. Click "Continue" then "Register" +5. Associate with your App ID: - Edit your App ID - Under "App Groups", click "Configure" - - Select the App Group you just created + - Select the App Group - Click "Save" ``` **Regenerate Provisioning Profile:** -```text -After enabling capabilities, your provisioning profiles become invalid. - -1. Navigate to "Profiles" in the sidebar -2. Find your Development and/or Distribution profile -3. Click on the profile -4. Click "Edit" or delete and recreate the profile -5. Ensure the updated App ID is selected -6. Download the new profile +``` +[Action Required] Regenerate profiles: +1. Navigate to "Profiles" +2. Delete old Development/Distribution profiles +3. Create new profiles with updated App ID +4. Download and install In Xcode: -1. Go to Xcode > Settings (or Preferences) > Accounts -2. Select your Apple ID -3. Click "Download Manual Profiles" - Or: Delete old profiles and let Xcode auto-manage +- Go to Xcode > Settings > Accounts +- Select your Apple ID +- Click "Download Manual Profiles" +- Or enable "Automatically manage signing" ``` ### Phase 5: Verification -After configuration, verify the setup and output a report. - -**Check Entitlements Files:** -- Main app entitlements contains `aps-environment` -- Main app entitlements contains `com.apple.security.application-groups` -- Extension entitlements contains matching App Group ID - -**Check project.pbxproj (if accessible):** -- Look for `SystemCapabilities` dictionary -- Verify `com.apple.Push` is enabled -- Verify `com.apple.ApplicationGroups.iOS` is enabled +After configuration, output a verification report. -**Output Verification Report:** +**JSON Report:** ```json { "project": "{project_name}", "bundleId": "{bundle_id}", + "filesCreated": [ + "{path_to_main_entitlements}", + "{path_to_nse_entitlements}", + "{path_to_notification_service_swift}" + ], "capabilities": { "pushNotifications": { "entitlementFile": true, "environment": "development", - "xcodeCapability": "verify manually in Xcode", - "developerPortal": "verify manually at developer.apple.com" + "xcodeCapability": "verify manually", + "developerPortal": "verify manually" }, "appGroups": { "groupId": "group.clix.{bundle_id}", "mainAppEntitlement": true, "extensionEntitlement": true, - "developerPortal": "verify manually at developer.apple.com" + "developerPortal": "verify manually" + }, + "nseTarget": { + "notificationServiceSwift": true, + "sdkDependency": "verify manually" } }, - "nextSteps": [ - "Verify capabilities are added in Xcode Signing & Capabilities", - "Confirm App Group ID is registered in Apple Developer Portal", - "Regenerate provisioning profiles if needed", - "Build and run to verify no signing errors" + "manualStepsRequired": [ + "Create NSE target in Xcode", + "Add Push Notifications capability", + "Add App Groups capability to both targets", + "Add Clix SDK to extension target", + "Set ENABLE_USER_SCRIPT_SANDBOXING = No", + "Enable capabilities in Apple Developer Portal", + "Regenerate provisioning profiles" ] } ``` @@ -281,90 +320,91 @@ After configuration, verify the setup and output a report. ### Missing Entitlements File -**Symptom:** No `.entitlements` file exists in the project. +**Symptom:** No `.entitlements` file exists. **Solution:** -- Xcode automatically creates one when you add your first capability -- Or create manually and link in Build Settings: - 1. Create `{AppName}.entitlements` file - 2. In Xcode, select target > Build Settings - 3. Search for "Code Signing Entitlements" - 4. Set the path to your entitlements file +- Xcode creates one when adding first capability +- Or create manually and link in Build Settings > Code Signing Entitlements ### App Group ID Mismatch **Symptom:** Data not shared between app and extension. **Solution:** -- Verify the App Group ID is EXACTLY the same in both targets -- Format must be: `group.clix.{BUNDLE_ID}` -- Check both entitlements files have identical values +- Verify App Group ID is EXACTLY the same in both targets +- Format: `group.clix.{BUNDLE_ID}` +- Check both entitlements files ### Provisioning Profile Invalid -**Symptom:** "Provisioning profile doesn't include the X capability" error. +**Symptom:** "Provisioning profile doesn't include the X capability" **Solution:** -1. Go to Apple Developer Portal -2. Delete the old provisioning profile -3. Create a new one with the updated App ID -4. Download and install in Xcode -5. Or enable "Automatically manage signing" in Xcode - -### Push Notifications Not Working - -**Symptom:** Push notifications not received. - -**Checklist:** -- [ ] Push Notifications capability added in Xcode -- [ ] `aps-environment` in entitlements (check value matches build config) -- [ ] Push Notifications enabled on App ID in Developer Portal -- [ ] APNs certificate or key configured in Clix console -- [ ] Provisioning profile regenerated after enabling capability -- [ ] Physical device used (simulator doesn't receive push) +1. Delete old profile in Developer Portal +2. Create new profile with updated App ID +3. Download and install +4. Or use automatic signing -### App Group Data Not Shared +### NSE Not Working -**Symptom:** MMKV data not accessible from extension. +**Symptom:** Rich push notifications don't display. **Checklist:** -- [ ] App Groups capability added to BOTH main app AND extension -- [ ] Same App Group ID in both targets' entitlements -- [ ] App Group ID registered in Developer Portal -- [ ] App Group associated with App ID in Developer Portal +- [ ] NSE target created in Xcode +- [ ] NotificationService.swift uses `ClixNotificationServiceExtension` +- [ ] `register(projectId:)` called with correct project ID +- [ ] Clix SDK added to extension target +- [ ] App Groups configured on both targets +- [ ] `ENABLE_USER_SCRIPT_SANDBOXING` = No (Xcode 15+) ## Automation Rules **CAN automate (use Write/Edit tools):** - Creating entitlements files +- Creating NotificationService.swift - Modifying existing entitlements files -- Reading project configuration files -- Detecting current capabilities status +- Adding extension target to Podfile -**CANNOT automate (provide instructions only):** -- Adding capabilities in Xcode UI (Signing & Capabilities tab) -- Enabling capabilities in Apple Developer Portal -- Registering App Group IDs in Developer Portal -- Generating/downloading provisioning profiles -- Associating App Groups with App IDs +**CANNOT automate (provide instructions):** +- Creating NSE target in Xcode +- Adding capabilities in Xcode UI +- Adding SDK to extension via SPM +- Configuring build settings +- Apple Developer Portal configuration +- Provisioning profile regeneration -For manual steps, provide clear instructions and proceed without waiting for confirmation. +For manual steps, provide clear numbered instructions and proceed without waiting for confirmation. -## Output Format +## Output Summary -After completing the workflow, summarize: +After completing the workflow: -1. **Files Created/Modified** - - List all entitlements files with full paths - - Show what was added or changed - -2. **Manual Steps Required** - - Xcode capability additions - - Developer Portal configurations - -3. **Verification Checklist** - - JSON report with status of each component - - Next steps for user to complete - -4. **Troubleshooting Tips** - - Common issues to watch for based on project state +``` +IOS SETUP COMPLETE +================== + +Files Created: + - ios/{AppName}/{AppName}.entitlements + - ios/{AppName}NotificationServiceExtension/{AppName}NotificationServiceExtension.entitlements + - ios/{AppName}NotificationServiceExtension/NotificationService.swift + +Podfile Updated: + - Added extension target with Clix pod + +Manual Steps Required: + 1. Create NSE target in Xcode + 2. Add Push Notifications capability + 3. Add Background Modes capability (Remote notifications) + 4. Add App Groups capability to main app + 5. Add App Groups capability to NSE (same group ID) + 6. Add Clix SDK to extension target (if using SPM) + 7. Set ENABLE_USER_SCRIPT_SANDBOXING = No + 8. Enable capabilities in Apple Developer Portal + 9. Regenerate provisioning profiles + +Next Steps: + 1. Run: cd ios && pod install + 2. Complete manual steps in Xcode + 3. Build and run to verify no signing errors + 4. Run /doctor to verify setup +``` diff --git a/src/ui/chat/components/__tests__/slash-command-menu.test.ts b/src/ui/chat/components/__tests__/slash-command-menu.test.ts index 4799644..cc94367 100644 --- a/src/ui/chat/components/__tests__/slash-command-menu.test.ts +++ b/src/ui/chat/components/__tests__/slash-command-menu.test.ts @@ -28,20 +28,25 @@ describe('SlashCommandMenu command list', () => { expect(menuNames).not.toContain('clear'); }); - test('marks embedded skills as skill category', () => { + test('embedded skills are hidden from menu (advanced features)', () => { + // All embedded skills (from @clix-so/clix-agent-skills) are hidden from the menu + // because they overlap with /install or are advanced features. + // They're still accessible by typing them directly. const nonLocalSkill = getAvailableSkills().find((s) => !s.isLocal); if (!nonLocalSkill) return; const cmd = getSlashCommands().find((c) => c.command === nonLocalSkill.type); - expect(cmd).toBeDefined(); - expect(cmd?.category).toBe('skill'); + // Embedded skills should NOT appear in the menu (they are hidden) + expect(cmd).toBeUndefined(); }); - test('marks local skills as system category', () => { - const localSkill = getAvailableSkills().find((s) => s.isLocal); - if (!localSkill) return; + test('visible local skills are marked as system category', () => { + // Find a visible local skill (install, doctor are visible; ios-setup is hidden) + const localSkills = getAvailableSkills().filter((s) => s.isLocal); + const visibleLocalSkill = localSkills.find((s) => s.type === 'install' || s.type === 'doctor'); + if (!visibleLocalSkill) return; - const cmd = getSlashCommands().find((c) => c.command === localSkill.type); + const cmd = getSlashCommands().find((c) => c.command === visibleLocalSkill.type); expect(cmd).toBeDefined(); expect(cmd?.category).toBe('system'); });