This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Raycast extension for converting dates between Hijri (Islamic) and Gregorian calendars. It's built with TypeScript, React, and the Raycast API for macOS integration.
npm run dev # Start development mode with hot reload
npm run build # Build the extension for production
npm run lint # Run ESLint
npm run fix-lint # Auto-fix linting issues
npm run publish # Publish to Raycast Store- Indentation: 2 spaces
- Quotes: Double quotes (configured in
.prettierrc) - Naming Conventions:
- Components:
PascalCase - Functions/Variables:
camelCase - Constants:
UPPER_SNAKE_CASE - Interfaces:
PascalCase
- Components:
- Key Libraries:
@raycast/api,@raycast/utils,hijri-converter
Each command in the extension is a separate React component located in src/:
convert-date.tsx- Hijri to Gregorian convertergregorian-to-hijri.tsx- Gregorian to Hijri convertershow-today.tsx- Today's date in both calendarshijri-calendar.tsx- 14-day calendar viewmenu-bar.tsx- Menu bar integration
Commands are registered in package.json under the commands array with a mode field (view or menu-bar).
All date conversion logic is centralized in utils.ts:
- Conversions:
convertHijriToGregorian(),convertGregorianToHijri()- wrapper functions around thehijri-converternpm package - Formatting:
formatHijriDate(),formatGregorianDate(),formatGregorianDateShort(),formatHijriDateShort() - Validation:
isValidHijriDay(),isValidHijriMonth(),isValidHijriYear() - Helpers:
getTodayHijri(),getTodayGregorian(),getDayName(),getHijriMonthName() - Constants:
HIJRI_MONTHS,GREGORIAN_MONTHS,DAY_NAMES
Note: Hijri months alternate between 30 days (odd months) and 29 days (even months). Dhu al-Hijjah (month 12) can have 30 days in leap years.
- Forms with Live Preview: Conversion forms update the result in real-time as the user types using
useStateanduseEffecthooks - Auto-Copy on Submit: Results are automatically copied to clipboard when the user submits
- Defaults to Today: All date inputs default to the current date for convenience
- Inter-Command Navigation: Uses
launchCommandfrom@raycast/apito navigate between commands (e.g., from menu bar to full converter) - Error Handling: Wrap conversion calls in try/catch and show user-friendly error messages
- Forms: Use
Form.Dropdownfor month selection,Form.TextFieldfor numeric input - Lists: Use
ListandList.Itemfor calendar views - Detail View: Use
Detailcomponent for displaying today's date with keyboard shortcuts - Menu Bar: Use
MenuBarExtrafor always-visible menu bar integration
@raycast/api- Core Raycast API for UI components and utilities@raycast/utils- Additional utilitieshijri-converter- Core date conversion library (the only non-Raycast dependency)
- All commands must be exported as default from their files
- Use
launchCommandfrom@raycast/apiwithname: "<command-name>"to navigate between commands (names match thenamefield in package.json) - Menu bar commands use
mode: "menu-bar"and render aMenuBarExtracomponent - The
ray developcommand watches for file changes and hot-reloads