captify 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +283 -613
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,759 +1,429 @@
1
- # @captify/captify-core
1
+ # captify-core
2
2
 
3
- A comprehensive shared library providing reusable UI/UX components, utilities, hooks, and services for Captify applications. Built with Next.js 15, React 19, TypeScript, and Tailwind CSS using shadcn/ui components.
3
+ A comprehensive shared library providing reusable UI/UX components, utilities, hooks, and services for Captify applications. Built with Next.js 16, React 19, TypeScript, and Tailwind CSS using shadcn/ui components.
4
4
 
5
5
  ## Features
6
6
 
7
- - 🎨 **Modern UI Components** - Built on shadcn/ui with Radix UI primitives
8
- - 🔐 **Authentication** - NextAuth.js integration with AWS Cognito
9
- - 📱 **Responsive Layouts** - ConsoleLayout with sidebar, toolbar, and navigation
10
- - 🎯 **Type-Safe** - Full TypeScript support
11
- - 🧩 **Modular Exports** - Import only what you need
12
- - 📚 **Storybook** - Interactive component documentation
13
- - **Testing** - Playwright for end-to-end testing
14
- - 🎭 **Dark Mode** - Theme support with next-themes
7
+ - **Modern UI Components** - Built on shadcn/ui with Radix UI primitives
8
+ - **Authentication** - NextAuth.js 5 integration with AWS Cognito
9
+ - **AI/Chat Integration** - AI SDK with multi-provider support (Bedrock, Anthropic, OpenAI)
10
+ - **Feature-Based Architecture** - Modular, domain-driven organization
11
+ - **Type-Safe** - Full TypeScript support with Zod validation
12
+ - **Real-time Collaboration** - Yjs integration for collaborative editing
13
+ - **Dark Mode** - Theme support with next-themes
15
14
 
16
15
  ## Table of Contents
17
16
 
18
17
  - [Installation](#installation)
19
18
  - [Quick Start](#quick-start)
20
- - [Migration Guide](#migration-guide)
21
- - [Project Structure](#project-structure)
19
+ - [Architecture](#architecture)
20
+ - [Module Reference](#module-reference)
21
+ - [Import Patterns](#import-patterns)
22
22
  - [Development](#development)
23
- - [Testing the Library](#testing-the-library)
24
- - [Available Components](#available-components)
25
- - [Module Exports](#module-exports)
26
- - [Usage Examples](#usage-examples)
27
23
  - [Scripts](#scripts)
28
- - [Changelog](#changelog)
29
24
  - [Contributing](#contributing)
30
25
 
31
26
  ## Installation
32
27
 
33
- Install from npm:
28
+ This is a private package. Install via npm link or file reference:
34
29
 
35
30
  ```bash
36
- npm install @captify/captify-core
31
+ npm install captify@file:../captify-core
37
32
  ```
38
33
 
39
- Or using pnpm:
40
-
41
- ```bash
42
- pnpm add @captify/captify-core
43
- ```
34
+ ### Peer Dependencies
44
35
 
45
- Or using yarn:
36
+ Ensure your project has these peer dependencies:
46
37
 
47
38
  ```bash
48
- yarn add @captify/captify-core
39
+ npm install next@^16.0.0 react@^19.0.0 react-dom@^19.0.0
49
40
  ```
50
41
 
51
- ### For Local Development
42
+ ### Requirements
52
43
 
53
- If you're working on the library locally, you can link it:
44
+ - Node.js >= 20.0.0
54
45
 
55
- ```bash
56
- npm install @captify/captify-core@file:../captify-core
57
- ```
46
+ ## Quick Start
58
47
 
59
- ### Peer Dependencies
48
+ ### Importing from Feature Modules
60
49
 
61
- Ensure your project has these peer dependencies installed:
50
+ The library uses a feature-based module structure. Import from specific module paths:
62
51
 
63
- ```bash
64
- npm install next@^14.0.0 || ^15.0.0 react@^18.0.0 || ^19.0.0 react-dom@^18.0.0 || ^19.0.0
65
- ```
52
+ ```typescript
53
+ // Shell components (layouts, toolbars, sidebar)
54
+ import { ConsoleLayout } from 'captify/shell/components';
55
+ import { ThemeProvider } from 'captify/shell/theme-provider';
66
56
 
67
- ## Quick Start
57
+ // Authentication
58
+ import { auth, signIn, signOut } from 'captify/auth';
59
+ import { AuthSessionProvider } from 'captify/auth/components';
68
60
 
69
- ### Importing Components
61
+ // Chat components and services
62
+ import { ChatInterface, ChatMessages } from 'captify/chat/components';
63
+ import { useChatSession } from 'captify/chat/hooks';
64
+ import { ChatService } from 'captify/chat/services';
70
65
 
71
- **Important:** As of v0.2.0, you must import from specific module paths to avoid naming conflicts. As of v0.3.0, granular exports are available for even more precise imports.
66
+ // Shared utilities and components
67
+ import { cn } from 'captify/shared/utilities/cn';
68
+ import { Button, Card, Dialog } from 'captify/shared/components';
72
69
 
73
- ```typescript
74
- // Import from category modules (REQUIRED as of v0.2.0)
75
- import { ConsoleLayout, Button } from "@captify/captify-core/components";
76
- import { useBookmarkContext } from "@captify/captify-core/hooks";
77
- import { cn } from "@captify/captify-core/utils";
78
- import { ServiceItem } from "@captify/captify-core/types";
79
- import { CognitoAdminService } from "@captify/captify-core/services";
80
- import { acceptTermsAndConditions } from "@captify/captify-core/actions";
81
-
82
- // ✅ Import from granular paths for tree-shaking (NEW in v0.3.0)
83
- import { AppLauncher } from "@captify/captify-core/components/app-launcher";
84
- import { useMobile } from "@captify/captify-core/hooks/use-mobile";
85
- import { cn } from "@captify/captify-core/utils/cn";
86
- import { CognitoAdminService } from "@captify/captify-core/services/cognito/services";
87
-
88
- // ❌ Main entry point no longer exports everything (v0.2.0+)
89
- // import { ConsoleLayout, Button } from "@captify/captify-core"; // This won't work
70
+ // File management
71
+ import { FileUploader } from 'captify/files/components';
72
+ import { useFileUpload } from 'captify/files/hooks';
73
+
74
+ // User management
75
+ import { UserProfile } from 'captify/users/components';
90
76
  ```
91
77
 
92
- ### Basic Setup
78
+ ### Basic Layout Setup
93
79
 
94
80
  ```tsx
95
- import { ConsoleLayout } from "@captify/captify-core/components";
96
- import { BookmarkProvider } from "@captify/captify-core/context";
81
+ import { ConsoleLayout } from 'captify/shell/components';
82
+ import { ThemeProvider } from 'captify/shell/theme-provider';
83
+ import { AuthSessionProvider } from 'captify/auth/components';
97
84
 
98
- export default function App() {
85
+ export default function RootLayout({ children }) {
99
86
  return (
100
- <BookmarkProvider>
101
- <ConsoleLayout appName="My Application">{/* Your app content */}</ConsoleLayout>
102
- </BookmarkProvider>
87
+ <AuthSessionProvider>
88
+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem>
89
+ <ConsoleLayout appName="My Application">
90
+ {children}
91
+ </ConsoleLayout>
92
+ </ThemeProvider>
93
+ </AuthSessionProvider>
103
94
  );
104
95
  }
105
96
  ```
106
97
 
107
- ## Migration Guide
108
-
109
- ### Migrating from v0.1.x to v0.2.0
98
+ ## Architecture
110
99
 
111
- **Breaking Change:** The main entry point (`@captify/captify-core`) no longer re-exports all modules. You must use specific import paths.
112
-
113
- #### Step 1: Update Your Imports
114
-
115
- Search your codebase for imports from `@captify/captify-core` and update them:
116
-
117
- ```typescript
118
- // ❌ OLD (v0.1.x) - Will not work in v0.2.0+
119
- import {
120
- Button,
121
- ConsoleLayout,
122
- useBookmarkContext,
123
- cn
124
- } from "@captify/captify-core";
125
-
126
- // ✅ NEW (v0.2.0+) - Use specific module paths
127
- import { Button, ConsoleLayout } from "@captify/captify-core/components";
128
- import { useBookmarkContext } from "@captify/captify-core/hooks";
129
- import { cn } from "@captify/captify-core/utils";
130
- ```
100
+ ### Feature-Based Module Structure
131
101
 
132
- #### Step 2: Update Import Statements by Category
102
+ The `lib/` directory uses a domain-driven, feature-based organization. Each feature module contains:
133
103
 
134
- **Components:**
135
- ```typescript
136
- // Before
137
- import { Button, TopToolbar } from "@captify/captify-core";
138
- // After
139
- import { Button, TopToolbar } from "@captify/captify-core/components";
140
104
  ```
141
-
142
- **Hooks:**
143
- ```typescript
144
- // Before
145
- import { useBookmarkContext } from "@captify/captify-core";
146
- // After
147
- import { useBookmarkContext } from "@captify/captify-core/hooks";
105
+ lib/<feature>/
106
+ ├── <feature>.interfaces.ts # TypeScript interfaces
107
+ ├── <feature>.schemas.ts # Zod validation schemas
108
+ ├── <feature>.constants.ts # Constants and configuration
109
+ ├── <feature>.utilities.ts # Helper functions
110
+ ├── <feature>.errors.ts # Error classes
111
+ ├── api/ # API client and route handlers
112
+ ├── components/ # React components
113
+ ├── context/ # React context providers
114
+ ├── hooks/ # Custom React hooks
115
+ └── services/ # Business logic and integrations
148
116
  ```
149
117
 
150
- **Services:**
151
- ```typescript
152
- // Before
153
- import { CognitoAdminService } from "@captify/captify-core";
154
- // After
155
- import { CognitoAdminService } from "@captify/captify-core/services";
156
- ```
118
+ ### Core Feature Modules
157
119
 
158
- **Utilities:**
159
- ```typescript
160
- // Before
161
- import { cn } from "@captify/captify-core";
162
- // After
163
- import { cn } from "@captify/captify-core/utils";
164
- ```
120
+ | Module | Description |
121
+ |--------|-------------|
122
+ | `agents/` | AI agent components, interfaces, and chat functionality |
123
+ | `auth/` | NextAuth.js 5 + AWS Cognito authentication |
124
+ | `bookmarks/` | Bookmark management for services and resources |
125
+ | `breadcrumb/` | Navigation breadcrumb components |
126
+ | `chat/` | Chat interface, messaging, and AI conversation |
127
+ | `feedback/` | User feedback collection and management |
128
+ | `files/` | File management, upload, and S3 integration |
129
+ | `groups/` | User group management |
130
+ | `llm-providers/` | LLM provider configuration (Bedrock, Anthropic, OpenAI) |
131
+ | `ontology/` | Ontology/knowledge graph support |
132
+ | `shared/` | Shared utilities, UI components, providers |
133
+ | `shell/` | Application shell (layouts, toolbar, sidebar, theme) |
134
+ | `tables/` | Data table components and utilities |
135
+ | `users/` | User management and profiles |
165
136
 
166
- #### Step 3: Verify Your Build
137
+ ## Module Reference
167
138
 
168
- After updating imports, run your build to ensure everything works:
139
+ ### Shell Module
169
140
 
170
- ```bash
171
- npm run build
172
- # or
173
- pnpm build
174
- # or
175
- yarn build
176
- ```
141
+ Application shell components for layout and navigation:
177
142
 
178
- ### Why This Change?
143
+ ```typescript
144
+ // Components
145
+ import {
146
+ ConsoleLayout,
147
+ AppLauncher,
148
+ AppSidebar,
149
+ TopToolbar
150
+ } from 'captify/shell/components';
179
151
 
180
- This breaking change was introduced to:
181
- - Prevent naming conflicts between modules
182
- - ✅ Enable better tree-shaking and smaller bundle sizes
183
- - ✅ Make dependencies more explicit and easier to understand
184
- - ✅ Improve IDE autocomplete and IntelliSense
152
+ // Theme
153
+ import { ThemeProvider } from 'captify/shell/theme-provider';
185
154
 
186
- ## Project Structure
155
+ // Hooks
156
+ import { useSidebar } from 'captify/shell/hooks';
187
157
 
158
+ // Types
159
+ import type { MenuItem, ServiceItem } from 'captify/shell/shell.interfaces';
188
160
  ```
189
- captify-core/
190
- ├── app/ # Next.js app directory (for testing only)
191
- │ ├── (authenticated)/ # Protected routes (dashboard, profile)
192
- │ └── (unauthenticated)/ # Public routes (terms, login)
193
- ├── lib/ # Library source code
194
- │ ├── components/ # UI components
195
- │ │ ├── ui/ # shadcn/ui components
196
- │ │ ├── layouts/ # Layout components
197
- │ │ ├── toolbars/ # Toolbar components
198
- │ │ └── ...
199
- │ ├── context/ # React Context providers
200
- │ ├── hooks/ # Custom React hooks
201
- │ ├── utils/ # Utility functions
202
- │ ├── types/ # TypeScript types
203
- │ ├── interfaces/ # TypeScript interfaces
204
- │ ├── constants/ # Constants
205
- │ ├── config/ # Configuration
206
- │ ├── services/ # Service modules
207
- │ ├── actions/ # Server actions
208
- │ └── auth/ # Authentication config
209
- ├── stories/ # Storybook stories
210
- ├── tests/ # Playwright tests
211
- └── dist/ # Build output (generated)
212
- ```
213
-
214
- ## Development
215
161
 
216
- ### Prerequisites
217
-
218
- - Node.js 18+
219
- - npm/pnpm/yarn
220
-
221
- ### Setup
162
+ ### Auth Module
222
163
 
223
- 1. Clone the repository
224
- 2. Install dependencies:
164
+ Authentication with NextAuth.js 5 and AWS Cognito:
225
165
 
226
- ```bash
227
- npm install
228
- ```
229
-
230
- 3. Copy the environment template:
231
-
232
- ```bash
233
- cp .env.example .env
234
- ```
235
-
236
- 4. Configure your environment variables (see `.env.example`)
237
-
238
- ### Available Scripts
166
+ ```typescript
167
+ // Core auth
168
+ import { auth, signIn, signOut } from 'captify/auth';
239
169
 
240
- ```bash
241
- # Development
242
- npm run dev # Start Next.js dev server with Turbopack
243
- npm run storybook # Start Storybook on port 6006
170
+ // Components
171
+ import { AuthSessionProvider, LoginButton } from 'captify/auth/components';
244
172
 
245
- # Building
246
- npm run build # Build library (TypeScript → dist/)
247
- npm run build:next # Build Next.js app
248
- npm run type-check # TypeScript check without emit
249
- npm run validate # Run lint + type-check
173
+ // Hooks
174
+ import { useSession } from 'captify/auth/hooks';
250
175
 
251
- # Linting & Formatting
252
- npm run lint # Run ESLint
253
- npm run lint:fix # ESLint with auto-fix
254
- npm run prettify # Check Prettier formatting
255
- npm run prettify:fix # Auto-format with Prettier
176
+ // Services
177
+ import { CognitoService } from 'captify/auth/services';
256
178
 
257
- # Testing
258
- npm test # Run Playwright tests
259
- npm run test:ui # Playwright UI mode
260
- npm run test:headed # Playwright headed mode
261
- npm run test:debug # Playwright debug mode
179
+ // Actions
180
+ import { signOutAction } from 'captify/auth/actions';
262
181
  ```
263
182
 
264
- ## Testing the Library
265
-
266
- The `app/` directory contains a test application to demonstrate and test library components:
267
-
268
- ### Running the Test App
269
-
270
- 1. Set up your environment variables in `.env` (see `.env.example`)
271
- 2. Start the development server:
272
- ```bash
273
- npm run dev
274
- ```
275
- 3. Open [http://localhost:3000](http://localhost:3000)
276
-
277
- ### Test Pages
183
+ ### Chat Module
278
184
 
279
- - **Terms & Conditions** (`/`) - Landing page with terms acceptance modal
280
- - **Profile** (`/profile`) - User profile page (requires auth)
185
+ AI-powered chat interface with multi-provider support:
281
186
 
282
- These pages demonstrate:
187
+ ```typescript
188
+ // Components
189
+ import {
190
+ ChatInterface,
191
+ ChatMessages,
192
+ ChatInput,
193
+ ChatHistory,
194
+ ChatModelSelector
195
+ } from 'captify/chat/components';
283
196
 
284
- - Authentication flow with AWS Cognito
285
- - Terms and conditions acceptance
286
- - Protected routes with middleware
287
- - Layout components (ConsoleLayout, AppSidebar, TopToolbar)
288
- - Theme switching
197
+ // Hooks
198
+ import { useChatSession, useChat } from 'captify/chat/hooks';
289
199
 
290
- ### Using Storybook
200
+ // Context
201
+ import { ChatProvider, useChatContext } from 'captify/chat/context';
291
202
 
292
- Storybook provides interactive documentation for all components:
203
+ // Services
204
+ import { ChatService } from 'captify/chat/services';
293
205
 
294
- ```bash
295
- npm run storybook
206
+ // Types
207
+ import type { ChatMessage, ChatSession } from 'captify/chat/chat.interfaces';
208
+ import { chatMessageSchema } from 'captify/chat/chat.schemas';
296
209
  ```
297
210
 
298
- Open [http://localhost:6006](http://localhost:6006) to explore components.
299
-
300
- ## Available Components
301
-
302
- ### Layout Components
303
-
304
- - **ConsoleLayout** - Main application layout wrapper
305
- - **AppHeader** - Application header
306
- - **AppSidebar** - Collapsible sidebar with navigation
307
- - **AppServicesBar** - Quick access services bar
308
- - **TopToolbar** - Top toolbar with search, notifications, profile
309
-
310
- ### UI Components (shadcn/ui)
311
-
312
- - **Avatar** - User avatar display
313
- - **Badge** - Status and notification badges
314
- - **Button** - Various button variants
315
- - **Card** - Content cards
316
- - **Checkbox** - Form checkbox input
317
- - **Dialog** - Modal dialogs
318
- - **Dropdown Menu** - Context menus
319
- - **Input** - Text input fields
320
- - **Separator** - Visual dividers
321
- - **Sheet** - Slide-out panels
322
- - **Skeleton** - Loading placeholders
323
- - **Table** - Data tables
324
- - **Tooltip** - Hover tooltips
211
+ ### Files Module
325
212
 
326
- ### Feature Components
213
+ File management with S3 integration:
327
214
 
328
- - **Breadcrumb** - Navigation breadcrumbs
329
- - **Notifications** - Notification center
330
- - **AppLauncher** - Application launcher grid
331
- - **TermsAndConditionsModal** - Terms acceptance modal
332
- - **GenericNotFoundUI** - 404 error page
333
-
334
- ### Context Providers
335
-
336
- - **BookmarkProvider** - Bookmark management
337
- - **ThemeProvider** - Dark/light theme switching
338
-
339
- ### Hooks
340
-
341
- - **useBookmarkContext** - Access bookmark state
342
- - **useIsMobile** - Responsive breakpoint detection
343
-
344
- ### Services
215
+ ```typescript
216
+ // Components
217
+ import { FileUploader, FileList, FileViewer } from 'captify/files/components';
345
218
 
346
- - **AWS Services** - S3, DynamoDB, Cognito integrations
219
+ // Hooks
220
+ import { useFileUpload, useFiles } from 'captify/files/hooks';
347
221
 
348
- ## Usage Examples
222
+ // Services
223
+ import { FileService, S3Service } from 'captify/files/services';
349
224
 
350
- ### Using ConsoleLayout
225
+ // Types
226
+ import type { FileMetadata } from 'captify/files/files.interfaces';
227
+ ```
351
228
 
352
- ```tsx
353
- import { ConsoleLayout } from "@captify/captify-core/components";
354
- import { MenuItem } from "@captify/captify-core/types";
229
+ ### Shared Module
355
230
 
356
- const menuItems: MenuItem[] = [
357
- { title: "Dashboard", url: "/dashboard", icon: "Home" },
358
- { title: "Settings", url: "/settings", icon: "Settings" },
359
- ];
231
+ Common utilities, UI components, and providers:
360
232
 
361
- export default function MyApp() {
362
- return (
363
- <ConsoleLayout appName="My Application" menuItems={menuItems}>
364
- <main>{/* Your content */}</main>
365
- </ConsoleLayout>
366
- );
367
- }
233
+ ```typescript
234
+ // UI Components (shadcn/ui)
235
+ import {
236
+ Button,
237
+ Card,
238
+ Dialog,
239
+ Input,
240
+ Select,
241
+ Tabs,
242
+ Toast,
243
+ Tooltip
244
+ } from 'captify/shared/components';
245
+
246
+ // Utilities
247
+ import { cn } from 'captify/shared/utilities/cn';
248
+ import { formatDate } from 'captify/shared/utilities/date-utilities';
249
+ import { invariant } from 'captify/shared/utilities/invariant';
250
+
251
+ // Providers
252
+ import { QueryProvider } from 'captify/shared/providers';
253
+
254
+ // Hooks
255
+ import { useMobile, useDebounce } from 'captify/shared/hooks';
368
256
  ```
369
257
 
370
- ### Using Bookmark Context
258
+ ### LLM Providers Module
371
259
 
372
- ```tsx
373
- import { useBookmarkContext } from '@captify/captify-core/hooks';
374
-
375
- function MyComponent() {
376
- const {
377
- bookmarkedServices,
378
- addBookmark,
379
- removeBookmark
380
- } = useBookmarkContext();
381
-
382
- const handleBookmark = (service: ServiceItem) => {
383
- if (bookmarkedServices.find(s => s.id === service.id)) {
384
- removeBookmark(service.id);
385
- } else {
386
- addBookmark(service);
387
- }
388
- };
260
+ Multi-provider LLM configuration:
389
261
 
390
- return (
391
- // Your component JSX
392
- );
393
- }
394
- ```
262
+ ```typescript
263
+ // Components
264
+ import { ModelSelector, ProviderConfig } from 'captify/llm-providers/components';
395
265
 
396
- ### Using Utility Functions
266
+ // Hooks
267
+ import { useModelSelection } from 'captify/llm-providers/hooks';
397
268
 
398
- ```tsx
399
- import { cn } from "@captify/captify-core/utils";
269
+ // Services
270
+ import { LLMProviderService } from 'captify/llm-providers/services';
400
271
 
401
- function MyComponent() {
402
- return (
403
- <div className={cn("base-styles", condition && "conditional-styles", className)}>Content</div>
404
- );
405
- }
272
+ // Types
273
+ import type { LLMProvider, ModelConfig } from 'captify/llm-providers/llm-providers.interfaces';
406
274
  ```
407
275
 
408
- ## Module Exports
276
+ ## Import Patterns
409
277
 
410
- **v0.2.0+**: The library uses granular exports to prevent naming conflicts and enable better tree-shaking. You **must** import from specific module paths.
278
+ ### Module-Level Imports (Recommended)
411
279
 
412
- **v0.3.0+**: Enhanced with even more granular exports for maximum flexibility and optimal tree-shaking.
413
-
414
- ### Available Module Paths
415
-
416
- #### Category-Level Exports (v0.2.0+)
280
+ Import from the module's category exports:
417
281
 
418
282
  ```typescript
419
- // Components - All UI/UX components
420
- import { Button, ConsoleLayout, AppSidebar, TopToolbar } from '@captify/captify-core/components';
283
+ import { ChatInterface } from 'captify/chat/components';
284
+ import { useChat } from 'captify/chat/hooks';
285
+ import { ChatService } from 'captify/chat/services';
286
+ ```
421
287
 
422
- // Hooks - Custom React hooks
423
- import { useBookmarkContext, useMobile } from '@captify/captify-core/hooks';
288
+ ### Granular Imports
424
289
 
425
- // Utils - Utility functions
426
- import { cn, formatDate } from '@captify/captify-core/utils';
290
+ For maximum tree-shaking, import from specific files:
427
291
 
428
- // Types - TypeScript type definitions
429
- import { ServiceItem, MenuItem } from '@captify/captify-core/types';
292
+ ```typescript
293
+ import { cn } from 'captify/shared/utilities/cn';
294
+ import { formatDate } from 'captify/shared/utilities/date-utilities';
295
+ import { invariant } from 'captify/shared/utilities/invariant';
296
+ ```
430
297
 
431
- // Interfaces - TypeScript interfaces
432
- import { NotificationProps, LayoutProps } from '@captify/captify-core/interfaces';
298
+ ### Type Imports
433
299
 
434
- // Services - AWS service integrations
435
- import { CognitoAdminService, DynamoDBService, S3Service } from '@captify/captify-core/services';
300
+ Import interfaces and schemas directly:
436
301
 
437
- // Actions - Server actions
438
- import { acceptTermsAndConditions, cognitoSignOut } from '@captify/captify-core/actions';
302
+ ```typescript
303
+ import type { ChatMessage } from 'captify/chat/chat.interfaces';
304
+ import { chatMessageSchema } from 'captify/chat/chat.schemas';
305
+ import { CHAT_CONSTANTS } from 'captify/chat/chat.constants';
306
+ ```
439
307
 
440
- // Auth - NextAuth configuration
441
- import { auth, signIn, signOut } from '@captify/captify-core/auth';
308
+ ## Development
442
309
 
443
- // Context - React Context providers
444
- import { BookmarkProvider, ThemeProvider } from '@captify/captify-core/context';
310
+ ### Prerequisites
445
311
 
446
- // Providers - React providers
447
- import { AuthSessionProvider } from '@captify/captify-core/providers';
312
+ - Node.js >= 20.0.0
313
+ - npm/pnpm/yarn
448
314
 
449
- // Config - Configuration files
450
- import { routeConfig } from '@captify/captify-core/config';
315
+ ### Setup
451
316
 
452
- // Constants - Application constants
453
- import { APP_LAUNCHER_CONSTANTS } from '@captify/captify-core/constants';
454
- ```
317
+ 1. Clone the repository
318
+ 2. Install dependencies:
319
+ ```bash
320
+ npm install
321
+ ```
322
+ 3. Copy the environment template:
323
+ ```bash
324
+ cp .env.example .env
325
+ ```
326
+ 4. Configure your environment variables
455
327
 
456
- #### Granular Exports (v0.3.0+)
328
+ ### Running the Test Application
457
329
 
458
- For even better tree-shaking and more precise imports:
330
+ The `app/` directory contains a test application for developing and testing library components:
459
331
 
460
- ```typescript
461
- // ===== COMPONENTS =====
462
- // Specific component groups
463
- import { AppLauncher } from '@captify/captify-core/components/app-launcher';
464
- import { BreadcrumbComponent } from '@captify/captify-core/components/breadcrumb';
465
- import { ConsoleLayout } from '@captify/captify-core/components/console-layout';
466
- import { ErrorBoundary } from '@captify/captify-core/components/error-boundary';
467
- import { AppLayout, AppHeader, AppSidebar } from '@captify/captify-core/components/layouts';
468
- import { LoadingSkeleton } from '@captify/captify-core/components/loading-skeleton';
469
- import { GenericNotFoundUI } from '@captify/captify-core/components/not-found';
470
- import { Notifications } from '@captify/captify-core/components/notifications';
471
- import { FeaturedServiceNavItem } from '@captify/captify-core/components/services';
472
- import { TermsAndConditionsModal } from '@captify/captify-core/components/terms-and-agreements';
473
- import { TopToolbar, TopRightToolbar } from '@captify/captify-core/components/toolbars';
474
- import { Button, Card, Dialog, Input } from '@captify/captify-core/components/ui';
475
-
476
- // ===== HOOKS =====
477
- import { useMobile } from '@captify/captify-core/hooks/use-mobile';
478
- import { useNotifications } from '@captify/captify-core/hooks/use-notifications';
479
-
480
- // ===== UTILS =====
481
- import { cn } from '@captify/captify-core/utils/cn';
482
- import { formatDate } from '@captify/captify-core/utils/date';
483
- import { invariant } from '@captify/captify-core/utils/invariant';
484
- import { capitalize } from '@captify/captify-core/utils/string';
485
-
486
- // ===== CONTEXT =====
487
- import { BookmarkProvider } from '@captify/captify-core/context/bookmark';
488
- import { ThemeProvider } from '@captify/captify-core/context/theme';
489
-
490
- // ===== ACTIONS =====
491
- import { cognitoSignOut } from '@captify/captify-core/actions/auth';
492
- import { acceptTermsAndConditions } from '@captify/captify-core/actions/terms-and-conditions';
493
-
494
- // ===== AUTH =====
495
- import { refreshCognitoTokens } from '@captify/captify-core/auth/refresh-token';
496
-
497
- // ===== CONFIG =====
498
- import { routeConfig } from '@captify/captify-core/config/route-config';
499
-
500
- // ===== CONSTANTS =====
501
- import { APP_LAUNCHER_CONSTANTS } from '@captify/captify-core/constants/app-launcher';
502
- import { PROFILE_DROPDOWN_ITEMS } from '@captify/captify-core/constants/profile-dropdown';
503
- import { TABLES } from '@captify/captify-core/constants/tables';
504
-
505
- // ===== INTERFACES =====
506
- import { AppLauncherProps } from '@captify/captify-core/interfaces/app-launcher';
507
- import { BreadcrumbProps } from '@captify/captify-core/interfaces/breadcrumb';
508
- import { LayoutProps } from '@captify/captify-core/interfaces/layout-props';
509
- import { NavConfigProps } from '@captify/captify-core/interfaces/nav-config-props';
510
- import { NotificationProps } from '@captify/captify-core/interfaces/notification-props';
511
- import { RouteItem } from '@captify/captify-core/interfaces/route-item';
512
- import { SearchProps } from '@captify/captify-core/interfaces/search';
513
- import { ServiceItem } from '@captify/captify-core/interfaces/service';
514
- import { SidebarProps } from '@captify/captify-core/interfaces/sidebar-props';
515
- import { ToolbarProps } from '@captify/captify-core/interfaces/toolbar-props';
516
-
517
- // ===== PROVIDERS =====
518
- import { AuthSessionProvider } from '@captify/captify-core/providers/auth-session';
519
-
520
- // ===== SERVICES =====
521
- // Chat Service
522
- import { ChatService } from '@captify/captify-core/services/chat';
523
- import { CHAT_CONSTANTS } from '@captify/captify-core/services/chat/constants';
524
- import { ChatError } from '@captify/captify-core/services/chat/errors';
525
- import { ChatMessage } from '@captify/captify-core/services/chat/interfaces';
526
- import { ChatService as ChatServiceClass } from '@captify/captify-core/services/chat/services';
527
- import { validateChatMessage } from '@captify/captify-core/services/chat/utilities';
528
-
529
- // Cognito Service
530
- import { CognitoAdminService } from '@captify/captify-core/services/cognito';
531
- import { COGNITO_CONSTANTS } from '@captify/captify-core/services/cognito/constants';
532
- import { CognitoError } from '@captify/captify-core/services/cognito/errors';
533
- import { CognitoUser } from '@captify/captify-core/services/cognito/interfaces';
534
- import { CognitoAdminService as CognitoAdmin } from '@captify/captify-core/services/cognito/services';
535
-
536
- // DynamoDB Service
537
- import { DynamoDBService } from '@captify/captify-core/services/dynamodb';
538
- import { DYNAMODB_CONSTANTS } from '@captify/captify-core/services/dynamodb/constants';
539
- import { DynamoDBError } from '@captify/captify-core/services/dynamodb/errors';
540
- import { DynamoDBConfig } from '@captify/captify-core/services/dynamodb/interfaces';
541
- import { DynamoDBService as DynamoDBClient } from '@captify/captify-core/services/dynamodb/services';
542
-
543
- // S3 Service
544
- import { S3Service } from '@captify/captify-core/services/s3';
545
- import { S3_CONSTANTS } from '@captify/captify-core/services/s3/constants';
546
- import { S3Error } from '@captify/captify-core/services/s3/errors';
547
- import { S3Config } from '@captify/captify-core/services/s3/interfaces';
548
- import { S3Service as S3Client } from '@captify/captify-core/services/s3/services';
549
-
550
- // Shared Service Utilities
551
- import { BaseAwsService } from '@captify/captify-core/services/shared';
552
- import { AWS_ERROR_KIND } from '@captify/captify-core/services/shared/constants';
553
- import { BaseAwsError } from '@captify/captify-core/services/shared/errors';
554
- import { Logger, ConsoleLogger } from '@captify/captify-core/services/logger';
555
- import { BaseAwsService as AwsService } from '@captify/captify-core/services/shared/services';
332
+ ```bash
333
+ npm run dev
556
334
  ```
557
335
 
558
- ### Why Granular Exports?
336
+ Open [http://localhost:3000](http://localhost:3000)
559
337
 
560
- **No naming conflicts** - Isolated modules prevent name collisions
561
- ✅ **Better tree-shaking** - Only bundle what you actually use
562
- ✅ **Clearer dependencies** - Explicit about what you're importing
563
- ✅ **Improved IDE autocomplete** - More precise suggestions
564
- ✅ **Optimal bundle size** - Import exactly what you need (v0.3.0)
565
- ✅ **Flexible imports** - Choose between category or granular imports (v0.3.0)
338
+ ### Storybook
566
339
 
567
- ## Authentication
340
+ Interactive component documentation:
568
341
 
569
- The library includes NextAuth.js integration with AWS Cognito:
342
+ ```bash
343
+ npm run storybook
344
+ ```
570
345
 
571
- ### Setup
346
+ Open [http://localhost:6006](http://localhost:6006)
572
347
 
573
- 1. Configure environment variables (see `.env.example`)
574
- 2. The auth config is in `lib/auth/index.ts`
575
- 3. Middleware protects routes automatically
348
+ ## Scripts
576
349
 
577
- ### Usage in Your App
350
+ ```bash
351
+ # Development
352
+ npm run dev # Start Next.js dev server with Turbopack (port 3000)
353
+ npm run storybook # Start Storybook on port 6006
578
354
 
579
- ```tsx
580
- import { auth } from "@captify/captify-core/auth";
355
+ # Building
356
+ npm run build # Build library (TypeScript to dist/)
357
+ npm run build:next # Build Next.js app
581
358
 
582
- // Server component
583
- export default async function Page() {
584
- const session = await auth();
359
+ # Validation
360
+ npm run validate # Run lint + type-check
361
+ npm run lint # Run ESLint
362
+ npm run lint:fix # ESLint with auto-fix
363
+ npm run type-check # TypeScript check without emit
585
364
 
586
- if (!session) {
587
- return <div>Not authenticated</div>;
588
- }
365
+ # Formatting
366
+ npm run prettify # Check Prettier formatting
367
+ npm run prettify:fix # Auto-format with Prettier
589
368
 
590
- return <div>Hello {session.user.name}</div>;
591
- }
369
+ # Testing
370
+ npm test # Run Playwright e2e tests
371
+ npm run test:ui # Playwright UI mode
372
+ npm run test:headed # Playwright headed mode
373
+ npm run test:debug # Playwright debug mode
374
+ npm run test:unit # Run Vitest unit tests
592
375
  ```
593
376
 
594
- ## Adding New Components
377
+ ## TypeScript Configuration
595
378
 
596
- 1. Create component in appropriate `lib/` subdirectory:
379
+ - `tsconfig.json` - Development config for Next.js
380
+ - `tsconfig.build.json` - Library build config (compiles `lib/` to `dist/`)
597
381
 
598
- ```bash
599
- lib/components/my-component/
600
- ├── my-component.tsx
601
- └── index.ts
602
- ```
382
+ ### Path Aliases
603
383
 
604
- 2. Export from directory's `index.ts`:
384
+ - `@/*` maps to project root
385
+ - `captify/*` maps to `lib/*`
605
386
 
606
- ```typescript
607
- export * from "./my-component";
608
- ```
387
+ ## Code Quality
609
388
 
610
- 3. Export from parent module:
389
+ ### ESLint Rules
611
390
 
612
- ```typescript
613
- // lib/components/index.ts
614
- export * from "./my-component";
615
- ```
391
+ - `no-console: error` - Use `// eslint-disable-next-line no-console` for intentional logs
392
+ - `no-undef: error` - All variables must be defined
393
+ - Unused variables with `_` prefix are allowed
394
+ - `lib/shared/components/ui/**` is ignored (shadcn/ui components)
616
395
 
617
- 4. Create Storybook story (optional):
618
- ```bash
619
- stories/components/MyComponent.stories.tsx
620
- ```
396
+ ### Pre-commit Hooks
621
397
 
622
- ## Code Quality
398
+ Husky runs lint-staged on commit for:
399
+ - ESLint fixes
400
+ - Prettier formatting
623
401
 
624
- ### ESLint Rules
402
+ ## AWS Services Integration
625
403
 
626
- - Strict mode enabled
627
- - `no-console: error` (use `// eslint-disable-next-line no-console` for intentional logs)
628
- - `no-undef: error`
629
- - Unused vars allowed with `_` prefix
630
- - `lib/components/ui/**` ignored (external shadcn components)
404
+ The library integrates with multiple AWS services:
631
405
 
632
- ### Pre-commit Hooks
406
+ - **Cognito** - User authentication and management
407
+ - **S3** - File storage and presigned URLs
408
+ - **DynamoDB** - Database operations
409
+ - **Bedrock** - AI/LLM inference
633
410
 
634
- Husky runs lint-staged on commit to auto-fix:
411
+ ## AI SDK Integration
635
412
 
636
- - ESLint issues
637
- - Prettier formatting
413
+ Multi-provider AI support via Vercel AI SDK:
638
414
 
639
- ## TypeScript
640
-
641
- Two TypeScript configurations:
642
-
643
- - `tsconfig.json` - Next.js development
644
- - `tsconfig.build.json` - Library build (targets `lib/`, outputs `dist/`)
645
-
646
- Path aliases:
647
-
648
- - `@/*` → project root
649
- - `@captify/captify-core` → `lib/`
650
-
651
- ## Styling
652
-
653
- - **Tailwind CSS** with custom configuration
654
- - **CSS Variables** for theming
655
- - **Dark Mode** support via next-themes
656
- - **shadcn/ui** style: "new-york", base color: "neutral"
657
-
658
- ## Browser Support
659
-
660
- - Modern browsers (Chrome, Firefox, Safari, Edge)
661
- - ES2020+ features
662
-
663
- ## Changelog
664
-
665
- ### v0.3.0 (2025-01-26)
666
-
667
- **New Features:**
668
- - ✨ **100+ Granular Export Paths** - Ultra-precise imports for optimal tree-shaking
669
- - ✨ **Component-Level Exports** - Import specific components directly
670
- - `@captify/captify-core/components/app-launcher`
671
- - `@captify/captify-core/components/console-layout`
672
- - `@captify/captify-core/components/breadcrumb`
673
- - And many more!
674
- - ✨ **Hook-Level Exports** - Direct hook imports
675
- - `@captify/captify-core/hooks/use-mobile`
676
- - `@captify/captify-core/hooks/use-notifications`
677
- - ✨ **Utility-Level Exports** - Import individual utilities
678
- - `@captify/captify-core/utils/cn`
679
- - `@captify/captify-core/utils/date`
680
- - `@captify/captify-core/utils/string`
681
- - ✨ **Service Submodule Exports** - Granular service imports
682
- - `@captify/captify-core/services/cognito/services`
683
- - `@captify/captify-core/services/cognito/constants`
684
- - `@captify/captify-core/services/cognito/errors`
685
- - Similar structure for S3, DynamoDB, and Chat services
686
- - ✨ **Interface-Level Exports** - Import specific interfaces
687
- - `@captify/captify-core/interfaces/app-launcher`
688
- - `@captify/captify-core/interfaces/breadcrumb`
689
- - And all other interfaces
690
- - ✨ **Constant-Level Exports** - Direct constant imports
691
- - `@captify/captify-core/constants/app-launcher`
692
- - `@captify/captify-core/constants/profile-dropdown`
693
- - `@captify/captify-core/constants/tables`
694
-
695
- **Improvements:**
696
- - 🎯 **Maximum Tree-Shaking** - Import exactly what you need, nothing more
697
- - 🎯 **Smaller Bundle Sizes** - Granular imports reduce final bundle size
698
- - 🎯 **Better Developer Experience** - More intuitive import paths
699
- - 🎯 **Flexible Import Strategy** - Choose between category or granular imports
700
- - 📝 **Comprehensive Documentation** - Full list of all 100+ export paths
701
- - 🔧 **UI Components Index** - Added index.ts for all shadcn/ui components
702
- - 🔧 **Constants Export** - Added missing tables constants export
703
-
704
- **Technical:**
705
- - 📦 Published to npm registry as public package
706
- - ✅ All validation and build checks pass
707
- - ✅ Path aliases properly converted to relative imports
708
-
709
- ### v0.2.0 (2025-01-26)
710
-
711
- **Breaking Changes:**
712
- - 🚨 Main entry point (`@captify/captify-core`) no longer re-exports all modules
713
- - All imports must now use specific module paths (e.g., `@captify/captify-core/components`)
714
- - See [Migration Guide](#migration-guide) for upgrade instructions
715
-
716
- **New Features:**
717
- - ✨ Granular exports to prevent naming conflicts
718
- - ✨ Added complete exports for all services (Cognito, DynamoDB, S3, Chat)
719
- - ✨ Added terms-and-conditions actions export
720
- - ✨ Added utilities exports for all service modules
721
-
722
- **Improvements:**
723
- - 🎯 Better tree-shaking support - only bundle what you use
724
- - 🎯 Clearer dependency management
725
- - 🎯 Improved IDE autocomplete and IntelliSense
726
- - 📝 Updated documentation with comprehensive import examples
727
-
728
- **Bug Fixes:**
729
- - 🐛 Fixed missing exports in lib/actions/index.ts
730
- - 🐛 Fixed missing exports in lib/services/cognito/index.ts
731
- - 🐛 Fixed missing exports in lib/services/dynamodb/index.ts
732
-
733
- ### v0.1.20 (Previous)
734
-
735
- - Initial stable release with all core components and services
415
+ - **Amazon Bedrock** - Claude, Titan models
416
+ - **Anthropic** - Direct Claude API
417
+ - **OpenAI** - GPT models
736
418
 
737
419
  ## Contributing
738
420
 
739
- 1. Create a feature branch
740
- 2. Make your changes
421
+ 1. Create a feature branch from `dev`
422
+ 2. Make your changes following the feature-based module structure
741
423
  3. Run `npm run validate` to ensure quality
742
424
  4. Commit your changes (pre-commit hooks will run)
743
- 5. Submit a pull request
425
+ 5. Submit a pull request to `dev`
744
426
 
745
427
  ## License
746
428
 
747
- MIT
748
-
749
- ## Support
750
-
751
- For issues and questions, please use the GitHub issue tracker.
752
-
753
- ## Related Projects
754
-
755
- - [Next.js](https://nextjs.org/)
756
- - [React](https://react.dev/)
757
- - [shadcn/ui](https://ui.shadcn.com/)
758
- - [Tailwind CSS](https://tailwindcss.com/)
759
- - [NextAuth.js](https://next-auth.js.org/)
429
+ Anautics Inc. All rights reserved.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "captify",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "description": "Core shared library for Captify applications",
5
5
  "license": "Anautics Inc. All rights reserved.",
6
6
  "engines": {
@@ -460,7 +460,6 @@
460
460
  },
461
461
  "peerDependencies": {
462
462
  "next": "^16.0.0",
463
- "next-auth": "5.0.0-beta.30",
464
463
  "react": "^19.0.0",
465
464
  "react-dom": "^19.0.0"
466
465
  },
@@ -617,6 +616,7 @@
617
616
  "motion": "^12.23.24",
618
617
  "nanoid": "^5.1.6",
619
618
  "next": "^16.0.0",
619
+ "next-auth": "5.0.0-beta.30",
620
620
  "next-themes": "^0.4.6",
621
621
  "pdf2json": "^4.0.0",
622
622
  "prosemirror-commands": "^1.7.1",