myaidev-method 0.2.18 → 0.2.19
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.
- package/CHANGELOG.md +27 -0
- package/package.json +1 -1
- package/src/lib/payloadcms-utils.js +139 -12
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to the MyAIDev Method package will be documented in this fil
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.19] - 2025-11-19
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **PayloadCMS Lexical Format**: Critical fixes for proper PayloadCMS Lexical editor compatibility
|
|
12
|
+
- **List Type Bug**: Changed list `type` from `'bullet'/'number'` to `'list'` (spec-compliant)
|
|
13
|
+
- **Inline Formatters**: Implemented markdown formatting support for bold (**text**), italic (*text*), and code (`text`)
|
|
14
|
+
- **Link Support**: Added proper link node generation for markdown links [text](url)
|
|
15
|
+
- **Space Token Filter**: Filter out space tokens to prevent incorrect paragraph generation between lists
|
|
16
|
+
- Format codes follow Lexical specification: Bold=1, Italic=2, Code=16, combinations via bitwise addition
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- **Health Check Endpoint**: Updated from `/api` to `/api/posts?limit=1` for better connectivity verification
|
|
20
|
+
- Now verifies both API accessibility AND database connectivity
|
|
21
|
+
- More meaningful health indicator for PayloadCMS instances
|
|
22
|
+
|
|
23
|
+
### Testing
|
|
24
|
+
- All existing tests pass (Gutenberg converter, installation)
|
|
25
|
+
- Added PayloadCMS Lexical format validation tests
|
|
26
|
+
- Verified list type, inline formatting, and link node generation
|
|
27
|
+
|
|
28
|
+
### Benefits
|
|
29
|
+
- ✅ Content published to PayloadCMS now displays correctly with proper formatting
|
|
30
|
+
- ✅ Lists render as actual ordered/unordered lists (not as numbered text)
|
|
31
|
+
- ✅ Bold, italic, and code markdown formatters work as expected
|
|
32
|
+
- ✅ Links are properly rendered as clickable hyperlinks
|
|
33
|
+
- ✅ Health checks provide more accurate connectivity status
|
|
34
|
+
|
|
8
35
|
## [0.2.18] - 2025-11-19
|
|
9
36
|
|
|
10
37
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myaidev-method",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Comprehensive development framework with SPARC methodology for AI-assisted software development, AI visual content generation (Gemini, Imagen, DALL-E, Veo, FLUX), multi-platform publishing (WordPress, PayloadCMS, Astro, Docusaurus, Mintlify), and Coolify deployment",
|
|
5
5
|
"mcpName": "io.github.myaione/myaidev-method",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -144,7 +144,7 @@ export class PayloadCMSUtils {
|
|
|
144
144
|
|
|
145
145
|
case 'list':
|
|
146
146
|
return {
|
|
147
|
-
type:
|
|
147
|
+
type: 'list',
|
|
148
148
|
listType: token.ordered ? 'number' : 'bullet',
|
|
149
149
|
start: token.start || 1,
|
|
150
150
|
tag: token.ordered ? 'ol' : 'ul',
|
|
@@ -213,7 +213,10 @@ export class PayloadCMSUtils {
|
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
// Filter out space tokens and convert remaining tokens
|
|
217
|
+
const children = tokens
|
|
218
|
+
.filter(token => token.type !== 'space')
|
|
219
|
+
.map(convertToken);
|
|
217
220
|
|
|
218
221
|
return {
|
|
219
222
|
root: {
|
|
@@ -229,24 +232,147 @@ export class PayloadCMSUtils {
|
|
|
229
232
|
|
|
230
233
|
/**
|
|
231
234
|
* Parse inline text with formatting (bold, italic, code, links)
|
|
235
|
+
* Supports markdown formatters and converts to Lexical format codes:
|
|
236
|
+
* - **bold** → format: 1
|
|
237
|
+
* - *italic* → format: 2
|
|
238
|
+
* - `code` → format: 16
|
|
239
|
+
* - ***bold+italic*** → format: 3
|
|
232
240
|
*/
|
|
233
241
|
parseInlineText(text) {
|
|
234
|
-
// Simple inline parser for bold, italic, code, links
|
|
235
242
|
const children = [];
|
|
236
243
|
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
244
|
+
// Strip HTML tags first
|
|
245
|
+
text = text.replace(/<[^>]+>/g, '');
|
|
246
|
+
|
|
247
|
+
// Parse markdown inline formatting using marked's inline lexer
|
|
248
|
+
try {
|
|
249
|
+
const tokens = marked.lexer(text);
|
|
250
|
+
|
|
251
|
+
// Extract inline tokens from paragraph if present
|
|
252
|
+
let inlineTokens = [];
|
|
253
|
+
if (tokens[0]?.type === 'paragraph' && tokens[0].tokens) {
|
|
254
|
+
inlineTokens = tokens[0].tokens;
|
|
255
|
+
} else if (tokens[0]?.tokens) {
|
|
256
|
+
inlineTokens = tokens[0].tokens;
|
|
257
|
+
} else {
|
|
258
|
+
// No inline tokens, return plain text
|
|
259
|
+
return [{
|
|
260
|
+
type: 'text',
|
|
261
|
+
text: text,
|
|
262
|
+
format: 0,
|
|
263
|
+
mode: 'normal',
|
|
264
|
+
style: '',
|
|
265
|
+
detail: 0,
|
|
266
|
+
version: 1
|
|
267
|
+
}];
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Convert each inline token to Lexical format
|
|
271
|
+
for (const token of inlineTokens) {
|
|
272
|
+
switch (token.type) {
|
|
273
|
+
case 'text':
|
|
274
|
+
children.push({
|
|
275
|
+
type: 'text',
|
|
276
|
+
text: token.text,
|
|
277
|
+
format: 0,
|
|
278
|
+
mode: 'normal',
|
|
279
|
+
style: '',
|
|
280
|
+
detail: 0,
|
|
281
|
+
version: 1
|
|
282
|
+
});
|
|
283
|
+
break;
|
|
284
|
+
|
|
285
|
+
case 'strong':
|
|
286
|
+
children.push({
|
|
287
|
+
type: 'text',
|
|
288
|
+
text: token.text,
|
|
289
|
+
format: 1, // IS_BOLD
|
|
290
|
+
mode: 'normal',
|
|
291
|
+
style: '',
|
|
292
|
+
detail: 0,
|
|
293
|
+
version: 1
|
|
294
|
+
});
|
|
295
|
+
break;
|
|
296
|
+
|
|
297
|
+
case 'em':
|
|
298
|
+
children.push({
|
|
299
|
+
type: 'text',
|
|
300
|
+
text: token.text,
|
|
301
|
+
format: 2, // IS_ITALIC
|
|
302
|
+
mode: 'normal',
|
|
303
|
+
style: '',
|
|
304
|
+
detail: 0,
|
|
305
|
+
version: 1
|
|
306
|
+
});
|
|
307
|
+
break;
|
|
308
|
+
|
|
309
|
+
case 'codespan':
|
|
310
|
+
children.push({
|
|
311
|
+
type: 'text',
|
|
312
|
+
text: token.text,
|
|
313
|
+
format: 16, // IS_CODE
|
|
314
|
+
mode: 'normal',
|
|
315
|
+
style: '',
|
|
316
|
+
detail: 0,
|
|
317
|
+
version: 1
|
|
318
|
+
});
|
|
319
|
+
break;
|
|
320
|
+
|
|
321
|
+
case 'link':
|
|
322
|
+
children.push({
|
|
323
|
+
type: 'link',
|
|
324
|
+
url: token.href,
|
|
325
|
+
children: [{
|
|
326
|
+
type: 'text',
|
|
327
|
+
text: token.text,
|
|
328
|
+
format: 0,
|
|
329
|
+
mode: 'normal',
|
|
330
|
+
style: '',
|
|
331
|
+
detail: 0,
|
|
332
|
+
version: 1
|
|
333
|
+
}],
|
|
334
|
+
direction: 'ltr',
|
|
335
|
+
format: '',
|
|
336
|
+
indent: 0,
|
|
337
|
+
version: 3
|
|
338
|
+
});
|
|
339
|
+
break;
|
|
340
|
+
|
|
341
|
+
default:
|
|
342
|
+
// Fallback for any unhandled token types
|
|
343
|
+
children.push({
|
|
344
|
+
type: 'text',
|
|
345
|
+
text: token.raw || token.text || '',
|
|
346
|
+
format: 0,
|
|
347
|
+
mode: 'normal',
|
|
348
|
+
style: '',
|
|
349
|
+
detail: 0,
|
|
350
|
+
version: 1
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
} catch (error) {
|
|
355
|
+
// If parsing fails, return plain text
|
|
356
|
+
children.push({
|
|
357
|
+
type: 'text',
|
|
358
|
+
text: text,
|
|
359
|
+
format: 0,
|
|
360
|
+
mode: 'normal',
|
|
361
|
+
style: '',
|
|
362
|
+
detail: 0,
|
|
363
|
+
version: 1
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return children.length > 0 ? children : [{
|
|
240
368
|
type: 'text',
|
|
241
|
-
text: text
|
|
369
|
+
text: text,
|
|
242
370
|
format: 0,
|
|
243
371
|
mode: 'normal',
|
|
244
372
|
style: '',
|
|
245
373
|
detail: 0,
|
|
246
374
|
version: 1
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return children;
|
|
375
|
+
}];
|
|
250
376
|
}
|
|
251
377
|
|
|
252
378
|
/**
|
|
@@ -372,11 +498,12 @@ export class PayloadCMSUtils {
|
|
|
372
498
|
}
|
|
373
499
|
|
|
374
500
|
/**
|
|
375
|
-
* Health check
|
|
501
|
+
* Health check - verifies PayloadCMS connectivity and database access
|
|
502
|
+
* Uses /api/posts endpoint to verify both API and database are accessible
|
|
376
503
|
*/
|
|
377
504
|
async healthCheck() {
|
|
378
505
|
try {
|
|
379
|
-
const response = await fetch(`${this.url}/api`);
|
|
506
|
+
const response = await fetch(`${this.url}/api/posts?limit=1`);
|
|
380
507
|
return response.ok;
|
|
381
508
|
} catch (error) {
|
|
382
509
|
return false;
|