@leadcms/sdk 2.1.5 → 2.2.2

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 (73) hide show
  1. package/README.md +246 -126
  2. package/dist/cli/index.js +97 -68
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +22 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/lib/auth.d.ts +55 -0
  9. package/dist/lib/auth.d.ts.map +1 -0
  10. package/dist/lib/auth.js +204 -0
  11. package/dist/lib/auth.js.map +1 -0
  12. package/dist/lib/cms-config-types.d.ts +57 -0
  13. package/dist/lib/cms-config-types.d.ts.map +1 -0
  14. package/dist/lib/cms-config-types.js +64 -0
  15. package/dist/lib/cms-config-types.js.map +1 -0
  16. package/dist/lib/cms.d.ts +52 -0
  17. package/dist/lib/cms.d.ts.map +1 -1
  18. package/dist/lib/cms.js +113 -0
  19. package/dist/lib/cms.js.map +1 -1
  20. package/dist/lib/comment-types.d.ts +73 -0
  21. package/dist/lib/comment-types.d.ts.map +1 -0
  22. package/dist/lib/comment-types.js +6 -0
  23. package/dist/lib/comment-types.js.map +1 -0
  24. package/dist/lib/comment-utils.d.ts +173 -0
  25. package/dist/lib/comment-utils.d.ts.map +1 -0
  26. package/dist/lib/comment-utils.js +338 -0
  27. package/dist/lib/comment-utils.js.map +1 -0
  28. package/dist/lib/config.d.ts +4 -2
  29. package/dist/lib/config.d.ts.map +1 -1
  30. package/dist/lib/config.js +10 -4
  31. package/dist/lib/config.js.map +1 -1
  32. package/dist/lib/data-service.d.ts.map +1 -1
  33. package/dist/lib/data-service.js +22 -6
  34. package/dist/lib/data-service.js.map +1 -1
  35. package/dist/scripts/fetch-leadcms-comments.d.ts +26 -0
  36. package/dist/scripts/fetch-leadcms-comments.d.ts.map +1 -0
  37. package/dist/scripts/fetch-leadcms-comments.js +352 -0
  38. package/dist/scripts/fetch-leadcms-comments.js.map +1 -0
  39. package/dist/scripts/fetch-leadcms-content.d.ts.map +1 -1
  40. package/dist/scripts/fetch-leadcms-content.js +86 -39
  41. package/dist/scripts/fetch-leadcms-content.js.map +1 -1
  42. package/dist/scripts/init-leadcms.d.ts +7 -0
  43. package/dist/scripts/init-leadcms.d.ts.map +1 -0
  44. package/dist/scripts/init-leadcms.js +397 -0
  45. package/dist/scripts/init-leadcms.js.map +1 -0
  46. package/dist/scripts/leadcms-helpers.d.ts +2 -2
  47. package/dist/scripts/leadcms-helpers.d.ts.map +1 -1
  48. package/dist/scripts/leadcms-helpers.js +12 -7
  49. package/dist/scripts/leadcms-helpers.js.map +1 -1
  50. package/dist/scripts/login-leadcms.d.ts +10 -0
  51. package/dist/scripts/login-leadcms.d.ts.map +1 -0
  52. package/dist/scripts/login-leadcms.js +90 -0
  53. package/dist/scripts/login-leadcms.js.map +1 -0
  54. package/dist/scripts/pull-all.d.ts +12 -0
  55. package/dist/scripts/pull-all.d.ts.map +1 -0
  56. package/dist/scripts/pull-all.js +81 -0
  57. package/dist/scripts/pull-all.js.map +1 -0
  58. package/dist/scripts/pull-comments.d.ts +11 -0
  59. package/dist/scripts/pull-comments.d.ts.map +1 -0
  60. package/dist/scripts/pull-comments.js +45 -0
  61. package/dist/scripts/pull-comments.js.map +1 -0
  62. package/dist/scripts/pull-content.d.ts +11 -0
  63. package/dist/scripts/pull-content.d.ts.map +1 -0
  64. package/dist/scripts/pull-content.js +45 -0
  65. package/dist/scripts/pull-content.js.map +1 -0
  66. package/dist/scripts/pull-media.d.ts +12 -0
  67. package/dist/scripts/pull-media.d.ts.map +1 -0
  68. package/dist/scripts/pull-media.js +46 -0
  69. package/dist/scripts/pull-media.js.map +1 -0
  70. package/dist/scripts/push-leadcms-content.d.ts.map +1 -1
  71. package/dist/scripts/push-leadcms-content.js +12 -0
  72. package/dist/scripts/push-leadcms-content.js.map +1 -1
  73. package/package.json +1 -1
package/README.md CHANGED
@@ -44,9 +44,40 @@ npm install -g @leadcms/sdk
44
44
  - 🛠️ Project initialization and setup
45
45
  - 🛠️ Content fetching and Docker template generation
46
46
 
47
+ ## Quick Start
48
+
49
+ Get started with LeadCMS in 3 simple steps:
50
+
51
+ ### 1. Initialize Your Project
52
+ ```bash
53
+ npx leadcms init
54
+ ```
55
+ This will:
56
+ - Connect to your LeadCMS instance
57
+ - Detect available entity types (content, media, comments)
58
+ - Create configuration files (`.env` and optionally `leadcms.config.json`)
59
+
60
+ ### 2. Authenticate (for write access)
61
+ ```bash
62
+ npx leadcms login
63
+ ```
64
+ - **LeadCMS v1.2.88+**: Automatic device authentication via browser
65
+ - **Older versions**: Guided manual token extraction
66
+ - Saves your API token securely to `.env`
67
+
68
+ **Skip this step** if you only need read-only access to public content.
69
+
70
+ ### 3. Download Your Content
71
+ ```bash
72
+ npx leadcms pull
73
+ ```
74
+ Downloads all content, media, and comments to your local project.
75
+
76
+ **That's it!** You're ready to use LeadCMS content in your application. See [Usage Examples](#usage-examples) below.
77
+
47
78
  ## CI/CD Integration
48
79
 
49
- [![CI](https://github.com/LeadCMS/leadcms-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/LeadCMS/leadcms-sdk/actions/workflows/ci.yml)
80
+ [![Build & Test](https://github.com/LeadCMS/leadcms.sdk/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/LeadCMS/leadcms.sdk/actions/workflows/build-and-test.yml)
50
81
 
51
82
  The LeadCMS SDK includes comprehensive CI/CD workflows for GitHub Actions that provide:
52
83
 
@@ -101,15 +132,6 @@ npm run test:coverage
101
132
 
102
133
  # Run tests in watch mode
103
134
  npm run test:watch
104
-
105
- # Run tests with mock server (includes CLI integration tests)
106
- ./tests/run-tests.sh
107
-
108
- # Run only unit tests
109
- npm run test:unit
110
-
111
- # Run only CLI integration tests
112
- npm run test:integration
113
135
  ```
114
136
 
115
137
  ### Test Coverage
@@ -134,23 +156,19 @@ LEADCMS_USE_MOCK=true LEADCMS_CONTENT_DIR=./test-content npx leadcms status
134
156
  # Test with different mock scenarios
135
157
  LEADCMS_USE_MOCK=true LEADCMS_MOCK_SCENARIO=hasConflicts npx leadcms status
136
158
  LEADCMS_USE_MOCK=true LEADCMS_MOCK_SCENARIO=mixedOperations npx leadcms push --dry-run
137
-
138
- # Test in development with localhost (automatically uses mock)
139
- LEADCMS_URL=http://localhost:3001 npx leadcms status
140
159
  ```
141
160
 
142
161
  **Available Mock Scenarios:**
143
162
  - `allNew` - Local content that doesn't exist remotely (default)
144
163
  - `noChanges` - All content is in sync
145
164
  - `hasConflicts` - Remote content is newer than local
146
- - `hasUpdates` - Local content is newer than remote
165
+ - `hasUpdates` - Local content is newer than remote
147
166
  - `mixedOperations` - Mix of new, updated, and conflicted content
148
167
  - `missingContentTypes` - Content with unknown types
149
168
 
150
- **Mock Mode Auto-Detection:**
169
+ **Mock Mode Activation:**
151
170
  - `NODE_ENV=test` - Automatically uses mock mode
152
171
  - `LEADCMS_USE_MOCK=true` - Force mock mode
153
- - `LEADCMS_URL` contains `localhost` - Automatically uses mock mode
154
172
 
155
173
  The data service abstraction automatically handles switching between real API calls and mock data based on your environment, providing seamless testing without external dependencies.
156
174
 
@@ -158,13 +176,18 @@ The data service abstraction automatically handles switching between real API ca
158
176
 
159
177
  LeadCMS SDK supports multiple configuration methods in order of priority:
160
178
 
179
+ > **🚀 Quick Start:** Run `npx leadcms init` for an interactive setup wizard that handles everything!
180
+
161
181
  ### 1. Environment Variables (Recommended for API credentials)
162
182
 
163
183
  For security reasons, it's best to keep sensitive credentials as environment variables:
164
184
 
165
185
  ```bash
166
- # Required - keep these as environment variables for security
186
+ # Required
167
187
  LEADCMS_URL=your-leadcms-instance-url
188
+
189
+ # Optional - API key for authenticated access
190
+ # Omit this for public-only mode (published content only)
168
191
  LEADCMS_API_KEY=your-api-key
169
192
 
170
193
  # Optional - can also be set via environment variables
@@ -178,6 +201,8 @@ NEXT_PUBLIC_LEADCMS_URL=your-leadcms-instance-url
178
201
  NEXT_PUBLIC_LEADCMS_DEFAULT_LANGUAGE=en
179
202
  ```
180
203
 
204
+ > **� Security Note:** The SDK uses a **security-first approach** - all read operations (content, comments, media sync) are performed WITHOUT authentication, ensuring only public data is retrieved. API keys are only used for write operations. See [Public API Mode Guide](./docs/PUBLIC_API_MODE.md) for details.
205
+
181
206
  ### 2. Configuration File (For project-specific settings)
182
207
 
183
208
  Create a `leadcms.config.json` file **only if you need to override default settings** like `contentDir`, `mediaDir`, or `defaultLanguage`:
@@ -220,33 +245,141 @@ configure({
220
245
  ### Configuration Options
221
246
 
222
247
  - `url` - Your LeadCMS instance URL (**required**, best as env var)
223
- - `apiKey` - Your LeadCMS API key (**required**, best as env var)
248
+ - `apiKey` - Your LeadCMS API key (**optional**, omit for public-only mode, best as env var when used)
224
249
  - `defaultLanguage` - Default language code (default: "en")
225
250
  - `contentDir` - Directory for downloaded content (default: ".leadcms/content")
226
251
  - `mediaDir` - Directory for media files (default: "public/media")
227
- - `enableDrafts` - Enable draft content support (default: false)
252
+ - `enableDrafts` - Enable draft content support (default: false, requires API key)
228
253
 
229
254
  ## CLI Usage
230
255
 
256
+ ### Check SDK version
257
+ ```bash
258
+ npx leadcms version
259
+ # or
260
+ npx leadcms -v
261
+ # or
262
+ npx leadcms --version
263
+ ```
264
+
231
265
  ### Initialize configuration
232
266
  ```bash
233
267
  npx leadcms init
234
- # Creates leadcms.config.json with sample configuration
235
268
  ```
236
269
 
270
+ Interactive setup wizard that:
271
+ 1. **Connects to your LeadCMS instance** - Validates URL and checks for existing authentication
272
+ 2. **Fetches configuration** - Retrieves default language and available languages from public `/api/config` endpoint
273
+ 3. **Configures directories** - Sets content and media directories (defaults: `.leadcms/content`, `public/media`)
274
+ 4. **Creates environment file** - Saves configuration to `.env`
275
+ 5. **Creates config file** - Only if you use non-default directories (keeps your project clean!)
276
+
277
+ **Note:** The `/api/config` endpoint is public and works without authentication. For write operations and private content, run `leadcms login` after initialization.
278
+
279
+ ### Login to LeadCMS
280
+ ```bash
281
+ npx leadcms login
282
+ ```
283
+
284
+ Authenticates with your LeadCMS instance:
285
+ - **Device Authentication** (LeadCMS v1.2.88+) - Opens a browser link for secure authentication
286
+ - **Manual Token** (older versions) - Guides you through extracting an API token
287
+ - **Saves token** - Automatically stores the token in your `.env` file
288
+
289
+ **When to use:**
290
+ - After running `leadcms init` if you need write access
291
+ - To update an expired or invalid token
292
+ - When switching between LeadCMS instances
293
+
294
+ Example session:
295
+
296
+ ```
297
+ 🚀 LeadCMS SDK Initialization
298
+
299
+ Enter your LeadCMS URL: https://your-instance.leadcms.ai
300
+
301
+ 🔐 Authentication Setup
302
+ Authentication is optional and can be skipped for most use cases.
303
+ • Without authentication: You can pull content and build your site (read-only access)
304
+ • With authentication: You can also push content changes back to LeadCMS
305
+ • You can always authenticate later by running: leadcms login
306
+
307
+ Would you like to authenticate now? (Y/n): n
308
+ ℹ️ Skipping authentication. Continuing in read-only mode.
309
+ You can run "leadcms login" later to authenticate.
310
+
311
+ 🔍 Connecting to LeadCMS...
312
+ ✅ Connected successfully!
313
+
314
+ 📋 Available languages:
315
+ 1. English (United States) [en-US] (default)
316
+ 2. Russian (Russia) [ru-RU]
317
+
318
+ Default language code [en-US]:
319
+ ✓ Using default language: en-US
320
+
321
+ 📦 Supported entity types:
322
+ ✓ Content
323
+ ✓ Media
324
+ ✓ Comments
325
+
326
+ Content directory [.leadcms/content]:
327
+ Media directory [public/media]:
328
+ Comments directory [.leadcms/comments]:
329
+
330
+ 📝 Creating configuration files...
331
+
332
+ ✅ Updated .env
333
+ ℹ️ Using default directories, no leadcms.config.json needed.
334
+
335
+ ✨ Configuration complete!
336
+
337
+ Next steps:
338
+ 1. Run: npx leadcms login (for write access and private content)
339
+ 2. Run: npx leadcms pull (to download content)
340
+ 3. Start using LeadCMS content in your project
341
+ ```
342
+
343
+ The wizard creates:
344
+ - **`.env`** (or `.env` if exists) with `LEADCMS_URL`, `LEADCMS_DEFAULT_LANGUAGE`, and optionally `LEADCMS_API_KEY`
345
+ - **`leadcms.config.json`** only if custom directories are specified
346
+
347
+ **Anonymous Mode:** Perfect for static sites that only need public content. Omit the API key to skip authentication entirely.
348
+
237
349
  ### Generate Docker deployment templates
238
350
  ```bash
239
351
  npx leadcms docker
240
352
  # Creates Docker files for production and preview deployments
241
353
  ```
242
354
 
243
- ### Pull content from LeadCMS
355
+ ### Pull content, media and comments from LeadCMS
356
+
357
+ The CLI supports several focused pull commands so you can sync exactly what you need.
358
+
244
359
  ```bash
360
+ # Pull everything (content, media, comments)
245
361
  npx leadcms pull
362
+
363
+ # Pull only content (no media or comments)
364
+ npx leadcms pull-content
365
+
366
+ # Pull only media files
367
+ npx leadcms pull-media
368
+
369
+ # Pull only comments
370
+ npx leadcms pull-comments
246
371
  ```
247
372
 
248
373
  > **Note:** `npx leadcms fetch` is still supported as an alias for backward compatibility.
249
374
 
375
+ What each command does:
376
+ - `npx leadcms pull` - Syncs content, media and comments into your project using the configured directories. Updates incremental sync tokens so subsequent runs are faster.
377
+ - `npx leadcms pull-content` - Downloads only content entities (MDX/JSON files) and updates local metadata.
378
+ - `npx leadcms pull-media` - Downloads media files to your `mediaDir` (e.g., `public/media`). Use this when you changed media or want to refresh assets separately from content.
379
+ - `npx leadcms pull-comments` - Downloads comments to the comments directory (e.g., `.leadcms/comments/`). Useful when you only need comment updates.
380
+
381
+ > **Note:** The CLI uses incremental sync tokens to avoid re-downloading unchanged items where supported by the LeadCMS API.
382
+
250
383
  ### Push local content to LeadCMS
251
384
  ```bash
252
385
  npx leadcms push [options]
@@ -263,37 +396,36 @@ Push your local content changes to LeadCMS. This command will:
263
396
  - `--force` - Override remote changes (skip conflict check)
264
397
 
265
398
 
266
- **Required Metadata Fields:**
399
+ **Content frontmatter / metadata (required and optional fields):**
267
400
  ```yaml
268
401
  ---
269
- type: "article" # Content type (must exist in LeadCMS)
270
- title: "Article Title" # Content title
271
- slug: "article-slug" # URL slug
272
- language: "en" # Content language
273
- publishedAt: "2024-10-29T10:00:00Z" # Publication date
274
- updatedAt: "2024-10-29T10:00:00Z" # Last update (used for conflict detection)
402
+ type: "article" # required: Content type (must exist in LeadCMS)
403
+ title: "Article Title" # required: Content title
404
+ slug: "article-slug" # required: URL slug (unique per locale)
405
+ language: "en" # required: Content language
406
+ publishedAt: "2024-10-29T10:00:00Z" # optional: Publication date (omit to create a draft or schedule a future publish)
407
+ # updatedAt: "2024-10-29T10:00:00Z" # optional: maintained by the server; do not set for new content
275
408
  ---
276
409
  ```
277
410
 
411
+ Notes:
412
+ - `publishedAt` is optional. Omitting it is a valid way to create draft or scheduled content depending on your LeadCMS workflow.
413
+ - `updatedAt` is typically set and maintained by the LeadCMS server after content is created or updated. The SDK will use `updatedAt` when present for conflict detection, but you should not rely on it being set for brand-new local files.
414
+
278
415
  ### Check sync status
279
416
  ```bash
280
417
  npx leadcms status
281
418
  ```
282
419
 
283
- Shows the current sync status between local and remote content without making any changes.
420
+ Shows the current sync status between local and remote **content** without making any changes.
421
+
422
+ **Note:** The `status` command currently only supports content. Media and comments do not have sync status checking yet.
284
423
 
285
424
  ### Watch for real-time updates
286
425
  ```bash
287
426
  npx leadcms watch
288
427
  ```
289
428
 
290
- ### Generate environment variables file
291
- ```bash
292
- npx leadcms generate-env
293
- ```
294
-
295
-
296
-
297
429
  ## Framework Integration
298
430
 
299
431
  The SDK provides framework-agnostic data access. Most frameworks use it as a **development dependency** for build-time static generation:
@@ -354,63 +486,73 @@ app.get('/api/content/:slug', (req, res) => {
354
486
 
355
487
  ## API Reference
356
488
 
357
- ### Core Functions
489
+ ### Content API
490
+
491
+ Get content from your LeadCMS instance:
358
492
 
359
493
  ```typescript
360
- import {
494
+ import {
361
495
  getCMSContentBySlugForLocale,
362
496
  getAllContentSlugsForLocale,
363
- getAllContentRoutes,
364
- getAvailableLanguages,
365
- configure
497
+ getAllContentRoutes
366
498
  } from '@leadcms/sdk';
367
499
 
368
- // Get content by slug and locale
500
+ // Get single content item
369
501
  const content = getCMSContentBySlugForLocale('about-us', 'en');
370
502
 
371
- // Get all content slugs for a locale
503
+ // Get all content slugs
372
504
  const slugs = getAllContentSlugsForLocale('en');
373
505
 
374
- // Get all routes (framework-agnostic)
506
+ // Get all routes for static generation
375
507
  const routes = getAllContentRoutes();
376
- // Returns: [{ locale: 'en', slug: 'about-us', path: '/about-us', ... }]
508
+ ```
509
+
510
+ **📖 See [Content Management Guide](./docs/CONTENT_MANAGEMENT.md)** for complete API documentation, framework integration examples, and advanced features.
377
511
 
378
- // Get available languages (uses configured contentDir)
379
- const languages = getAvailableLanguages();
512
+ ### Media API
380
513
 
381
- // Get content with draft support (userUid must be a valid GUID)
382
- const draftContent = getCMSContentBySlugForLocaleWithDraftSupport(
383
- 'about-us',
384
- 'en',
385
- '550e8400-e29b-41d4-a716-446655440000' // Valid GUID format
386
- );
514
+ Media files are automatically synced during content pull:
387
515
 
388
- // Load configuration objects (header, footer, etc.)
389
- const headerConfig = getHeaderConfig('en');
390
- const footerConfig = getFooterConfig('en');
516
+ ```bash
517
+ # Sync all media files
518
+ npx leadcms pull
519
+
520
+ # Sync only media
521
+ npx leadcms pull-media
391
522
  ```
392
523
 
393
- ### Advanced Configuration Loading
524
+ **📖 See [Media Management Guide](./docs/MEDIA_MANAGEMENT.md)** for media handling, optimization, and deployment strategies.
525
+
526
+ ### Comments API
527
+
528
+ Work with comments on your content:
529
+
530
+ ```bash
531
+ # Sync comments
532
+ npx leadcms pull
533
+
534
+ # Sync only comments
535
+ npx leadcms pull-comments
536
+ ```
394
537
 
395
538
  ```typescript
396
- import {
397
- loadContentConfig,
398
- loadContentConfigStrict
539
+ import {
540
+ getCommentsForContent,
541
+ getCommentsTreeForContent
399
542
  } from '@leadcms/sdk';
400
543
 
401
- // Generic config loading with auto contentDir resolution (userUid must be valid GUID)
402
- const menuConfig = loadContentConfig('menu', 'en', '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
544
+ // Get flat list of comments
545
+ const comments = getCommentsForContent(contentId);
403
546
 
404
- // Strict config loading with detailed error information (throws on missing files)
405
- try {
406
- const requiredConfig = loadContentConfigStrict('layout', 'en');
407
- } catch (error) {
408
- console.log('Missing config:', error.configName);
409
- console.log('Expected locale:', error.locale);
410
- console.log('Expected path:', error.message);
411
- }
547
+ // Get comments as tree for threading
548
+ const tree = getCommentsTreeForContent(contentId, undefined, {
549
+ sortOrder: 'newest',
550
+ replySortOrder: 'oldest'
551
+ });
412
552
  ```
413
553
 
554
+ **📖 See [Comment Tree Guide](./docs/COMMENT_TREE.md)** for complete documentation on threaded comments, sorting, filtering, and advanced features.
555
+
414
556
  ## Docker Deployment
415
557
 
416
558
  LeadCMS SDK includes framework-agnostic Docker templates for easy deployment:
@@ -471,39 +613,7 @@ docker run -p 80:80 \
471
613
  my-leadcms-site-preview
472
614
  ```
473
615
 
474
- ### Template Features
475
-
476
- ✅ **Framework-agnostic** - Works with any static site generator
477
- ✅ **Production optimized** - Nginx with proper caching headers
478
- ✅ **Live preview** - Development mode with hot reload support
479
- ✅ **Multi-service** - Nginx proxy + dev server + LeadCMS watcher
480
- ✅ **Runtime configuration** - Environment variables injected at startup
481
- ✅ **Health checks** - Built-in container health monitoring
482
-
483
- ### Customizing Templates
484
-
485
- After generating templates with `npx leadcms docker`, you can customize:
486
-
487
- 1. **Source directory** in `Dockerfile`:
488
- ```dockerfile
489
- # Change 'out' to your framework's build output:
490
- COPY dist /usr/share/nginx/html # Astro
491
- COPY public /usr/share/nginx/html # Gatsby
492
- COPY .output/public /usr/share/nginx/html # Nuxt
493
- ```
494
-
495
- 2. **Nginx configuration** in `nginx.conf` for custom routing rules
496
-
497
- 3. **Development command** in `preview/supervisord.conf`:
498
- ```ini
499
- [program:dev-server]
500
- command=npm run livepreview # Your development command
501
- ```
502
-
503
- ## Performance & Debugging
504
-
505
- ### Configuration Caching
506
- The SDK automatically caches configuration files for 60 seconds and content files for 30 seconds to improve build performance. Multiple calls to the same configuration functions will use cached results.
616
+ ## Debugging
507
617
 
508
618
  ### Debug Logging
509
619
  Control SDK logging verbosity with environment variables:
@@ -551,42 +661,52 @@ try {
551
661
  - ✅ Configuration is cached across multiple function calls within the same process
552
662
  - ✅ Use `loadContentConfig()` for optional configs, `loadContentConfigStrict()` for required configs
553
663
 
664
+ ## Features & Documentation
665
+
666
+ ### 📚 Complete Guides
667
+
668
+ - **[Documentation Index](./docs/README)** - Central hub for all documentation
669
+
670
+ #### Content & Media
671
+ - **[Content Management](./docs/CONTENT_MANAGEMENT.md)** - Retrieving, organizing, and working with content
672
+ - **[Media Management](./docs/MEDIA_MANAGEMENT.md)** - Handling media files and optimization
673
+ - **[Draft Handling](./docs/DRAFT_HANDLING.md)** - Working with draft content and user-specific drafts
674
+
675
+ #### Comments
676
+ - **[Comment Tree Guide](./docs/COMMENT_TREE.md)** - Building threaded comment interfaces with sorting and filtering
677
+
678
+ #### Setup & Configuration
679
+ - **[Interactive Init](./docs/INTERACTIVE_INIT.md)** - Setup wizard and authentication
680
+ - **[Public API Mode](./docs/PUBLIC_API_MODE.md)** - Security-first approach and operation modes
681
+
682
+ #### Development
683
+ - **[Development Guide](./docs/DEVELOPMENT.md)** - Local development, testing, and debugging
684
+ - **[GitHub Actions](./docs/GITHUB_ACTIONS.md)** - CI/CD setup and automated publishing
685
+
554
686
  ## Development
555
687
 
556
- For SDK development and contributions:
688
+ For SDK development and contributions, see [Development Guide](./docs/DEVELOPMENT.md).
689
+
690
+ **Quick Start:**
557
691
 
558
692
  ```bash
559
693
  # Clone and setup
560
694
  git clone https://github.com/LeadCMS/leadcms.sdk.git
561
- cd leadcms-sdk
695
+ cd leadcms.sdk
562
696
  npm install
697
+ npm run build
563
698
 
564
- # Development workflow
565
- npm run build # Build the SDK
566
- npm run dev # Watch mode for development
567
- npm run test # Run tests
568
- npm run clean # Clean build artifacts
569
-
570
- # Local testing with npm link
571
- npm link
572
- cd ../your-test-project
573
- npm link @leadcms/sdk
574
- ```
575
-
576
- ### Debug Mode
577
-
578
- Enable detailed logging during development:
699
+ # Run tests
700
+ npm test
579
701
 
580
- ```bash
581
- LEADCMS_DEBUG=true npm run build
702
+ # Development mode
703
+ npm run dev
582
704
  ```
583
705
 
584
- ### Contributing
706
+ **Contributing:**
585
707
 
586
708
  1. Fork the repository
587
709
  2. Create a feature branch
588
710
  3. Make your changes
589
- 4. Run tests: `npm run test`
711
+ 4. Run tests: `npm test`
590
712
  5. Submit a pull request
591
-
592
- For detailed development setup, see [DEVELOPMENT.md](./docs/DEVELOPMENT.md).