myaidev-method 0.2.19 → 0.2.23

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 (57) hide show
  1. package/CHANGELOG.md +123 -5
  2. package/README.md +205 -13
  3. package/TECHNICAL_ARCHITECTURE.md +64 -2
  4. package/USER_GUIDE.md +453 -48
  5. package/bin/cli.js +187 -2
  6. package/content-rules.example.md +80 -0
  7. package/dist/mcp/mcp-config.json +138 -1
  8. package/dist/mcp/mcp-launcher.js +237 -0
  9. package/dist/mcp/openstack-server.js +1607 -0
  10. package/dist/server/.tsbuildinfo +1 -1
  11. package/dist/server/auth/layers.d.ts +1 -1
  12. package/dist/server/auth/services/AuthService.d.ts +1 -1
  13. package/dist/server/auth/services/TokenService.js.map +1 -1
  14. package/dist/server/auth/services/example.d.ts +5 -5
  15. package/package.json +17 -17
  16. package/src/config/workflows.js +532 -0
  17. package/src/index.js +21 -8
  18. package/src/lib/payloadcms-utils.js +206 -0
  19. package/src/lib/update-manager.js +2 -1
  20. package/src/lib/visual-config-utils.js +321 -295
  21. package/src/lib/visual-generation-utils.js +1080 -740
  22. package/src/lib/workflow-installer.js +512 -0
  23. package/src/libs/security/authorization-checker.js +606 -0
  24. package/src/mcp/openstack-server.js +1607 -0
  25. package/src/scripts/configure-wordpress-mcp.js +8 -3
  26. package/src/scripts/generate-visual-cli.js +365 -235
  27. package/src/scripts/openstack-setup.sh +110 -0
  28. package/src/scripts/ping.js +250 -0
  29. package/src/scripts/security/environment-detect.js +425 -0
  30. package/src/scripts/wordpress/publish-to-wordpress.js +165 -0
  31. package/src/server/auth/services/TokenService.ts +1 -1
  32. package/src/templates/claude/agents/content-rules-setup.md +657 -0
  33. package/src/templates/claude/agents/content-writer.md +328 -1
  34. package/src/templates/claude/agents/openstack-vm-manager.md +281 -0
  35. package/src/templates/claude/agents/osint-researcher.md +1075 -0
  36. package/src/templates/claude/agents/penetration-tester.md +908 -0
  37. package/src/templates/claude/agents/security-auditor.md +244 -0
  38. package/src/templates/claude/agents/security-setup.md +1094 -0
  39. package/src/templates/claude/agents/visual-content-generator.md +182 -4
  40. package/src/templates/claude/agents/webapp-security-tester.md +581 -0
  41. package/src/templates/claude/commands/myai-configure.md +85 -1
  42. package/src/templates/claude/commands/myai-content-rules-setup.md +204 -0
  43. package/src/templates/claude/commands/myai-openstack.md +229 -0
  44. package/src/templates/claude/commands/sc:security-exploit.md +464 -0
  45. package/src/templates/claude/commands/sc:security-recon.md +281 -0
  46. package/src/templates/claude/commands/sc:security-report.md +756 -0
  47. package/src/templates/claude/commands/sc:security-scan.md +441 -0
  48. package/src/templates/claude/commands/sc:security-setup.md +501 -0
  49. package/src/templates/codex/commands/myai-content-rules-setup.md +85 -0
  50. package/src/templates/gemini/commands/myai-content-rules-setup.toml +57 -0
  51. package/.claude/mcp/sparc-orchestrator-server.js +0 -607
  52. package/.claude/mcp/wordpress-server.js +0 -1277
  53. package/src/agents/content-writer-prompt.md +0 -164
  54. package/src/agents/content-writer.json +0 -70
  55. package/src/templates/claude/mcp_config.json +0 -30
  56. package/src/templates/claude/slash_commands.json +0 -166
  57. package/src/templates/scripts/configure-wordpress-mcp.js +0 -181
package/src/index.js CHANGED
@@ -2,19 +2,32 @@ export { WordPressMCP } from './mcp/wordpress-integration.js';
2
2
 
3
3
  export const MyAIDevMethod = {
4
4
  version: '1.0.0',
5
- agents: {
6
- 'content-writer': {
7
- config: './agents/content-writer.json',
8
- prompt: './agents/content-writer-prompt.md'
5
+ templates: {
6
+ claude: {
7
+ agents: './templates/claude/agents/',
8
+ commands: './templates/claude/commands/'
9
+ },
10
+ gemini: {
11
+ commands: './templates/gemini/commands/'
12
+ },
13
+ codex: {
14
+ commands: './templates/codex/commands/'
9
15
  }
10
16
  },
17
+ agents: {
18
+ // Agent templates are now in src/templates/claude/agents/
19
+ 'content-writer': './templates/claude/agents/content-writer.md',
20
+ 'content-rules-setup': './templates/claude/agents/content-rules-setup.md',
21
+ 'visual-content-generator': './templates/claude/agents/visual-content-generator.md',
22
+ 'content-production-coordinator': './templates/claude/agents/content-production-coordinator.md'
23
+ },
11
24
  mcp: {
12
25
  wordpress: './mcp/wordpress-mcp.json'
13
26
  },
14
- commands: {
15
- claude: './templates/claude/slash_commands.json',
16
- gemini: './templates/gemini/commands.json',
17
- codex: './templates/codex/commands.json'
27
+ lib: {
28
+ visualGeneration: './lib/visual-generation-utils.js',
29
+ assetManagement: './lib/asset-management.js',
30
+ visualConfig: './lib/visual-config-utils.js'
18
31
  }
19
32
  };
20
33
 
@@ -375,6 +375,212 @@ export class PayloadCMSUtils {
375
375
  }];
376
376
  }
377
377
 
378
+ /**
379
+ * Validate Lexical JSON structure
380
+ * Ensures output matches PayloadCMS Lexical editor format
381
+ * @param {Object} lexicalJSON - The Lexical JSON to validate
382
+ * @param {Object} options - Validation options
383
+ * @returns {Object} Validation result with errors array
384
+ */
385
+ validateLexicalStructure(lexicalJSON, options = {}) {
386
+ const errors = [];
387
+ const warnings = [];
388
+
389
+ // Check root structure
390
+ if (!lexicalJSON || typeof lexicalJSON !== 'object') {
391
+ errors.push('Lexical JSON must be an object');
392
+ return { valid: false, errors, warnings };
393
+ }
394
+
395
+ if (!lexicalJSON.root) {
396
+ errors.push('Missing root node');
397
+ return { valid: false, errors, warnings };
398
+ }
399
+
400
+ const root = lexicalJSON.root;
401
+
402
+ // Validate root node
403
+ if (root.type !== 'root') {
404
+ errors.push(`Root type must be 'root', got '${root.type}'`);
405
+ }
406
+
407
+ if (!Array.isArray(root.children)) {
408
+ errors.push('Root must have children array');
409
+ return { valid: false, errors, warnings };
410
+ }
411
+
412
+ // Validate each child node
413
+ const validateNode = (node, path = 'root') => {
414
+ if (!node || typeof node !== 'object') {
415
+ errors.push(`${path}: Node must be an object`);
416
+ return;
417
+ }
418
+
419
+ if (!node.type) {
420
+ errors.push(`${path}: Node missing type property`);
421
+ return;
422
+ }
423
+
424
+ // Validate based on node type
425
+ switch (node.type) {
426
+ case 'heading':
427
+ if (!node.tag || !/^h[1-6]$/.test(node.tag)) {
428
+ errors.push(`${path}: Heading must have tag h1-h6, got '${node.tag}'`);
429
+ }
430
+ if (!Array.isArray(node.children)) {
431
+ errors.push(`${path}: Heading must have children array`);
432
+ }
433
+ break;
434
+
435
+ case 'paragraph':
436
+ if (!Array.isArray(node.children)) {
437
+ errors.push(`${path}: Paragraph must have children array`);
438
+ }
439
+ break;
440
+
441
+ case 'list':
442
+ if (!['bullet', 'number', 'check'].includes(node.listType)) {
443
+ errors.push(`${path}: List listType must be bullet/number/check, got '${node.listType}'`);
444
+ }
445
+ if (!['ul', 'ol'].includes(node.tag)) {
446
+ errors.push(`${path}: List tag must be ul/ol, got '${node.tag}'`);
447
+ }
448
+ if (!Array.isArray(node.children)) {
449
+ errors.push(`${path}: List must have children array`);
450
+ }
451
+ // Validate list items
452
+ node.children?.forEach((item, i) => {
453
+ if (item.type !== 'listitem') {
454
+ errors.push(`${path}.children[${i}]: List child must be listitem, got '${item.type}'`);
455
+ }
456
+ });
457
+ break;
458
+
459
+ case 'listitem':
460
+ if (!Array.isArray(node.children)) {
461
+ errors.push(`${path}: Listitem must have children array`);
462
+ }
463
+ break;
464
+
465
+ case 'text':
466
+ if (typeof node.text !== 'string') {
467
+ errors.push(`${path}: Text node must have string text property`);
468
+ }
469
+ if (typeof node.format !== 'number') {
470
+ errors.push(`${path}: Text node format must be number, got ${typeof node.format}`);
471
+ }
472
+ // Validate format is valid bitwise combination
473
+ if (node.format !== 0 && options.strictFormat) {
474
+ const validFormats = [1, 2, 3, 4, 8, 16, 32, 64, 128];
475
+ const isValidCombination = (format) => {
476
+ // Check if format is valid bitwise combination of base values
477
+ return format <= 255 && (format & ~255) === 0;
478
+ };
479
+ if (!isValidCombination(node.format)) {
480
+ warnings.push(`${path}: Unusual format value ${node.format}, expected bitwise combination`);
481
+ }
482
+ }
483
+ break;
484
+
485
+ case 'link':
486
+ if (typeof node.url !== 'string') {
487
+ errors.push(`${path}: Link must have string url property`);
488
+ }
489
+ if (!Array.isArray(node.children)) {
490
+ errors.push(`${path}: Link must have children array`);
491
+ }
492
+ break;
493
+
494
+ case 'code':
495
+ if (!Array.isArray(node.children)) {
496
+ errors.push(`${path}: Code must have children array`);
497
+ }
498
+ break;
499
+
500
+ case 'quote':
501
+ if (!Array.isArray(node.children)) {
502
+ errors.push(`${path}: Quote must have children array`);
503
+ }
504
+ break;
505
+
506
+ case 'horizontalrule':
507
+ // HR nodes don't have children
508
+ break;
509
+
510
+ default:
511
+ if (options.strict) {
512
+ warnings.push(`${path}: Unknown node type '${node.type}'`);
513
+ }
514
+ }
515
+
516
+ // Recursively validate children
517
+ if (Array.isArray(node.children)) {
518
+ node.children.forEach((child, i) => {
519
+ validateNode(child, `${path}.children[${i}]`);
520
+ });
521
+ }
522
+ };
523
+
524
+ // Validate all root children
525
+ root.children.forEach((child, i) => {
526
+ validateNode(child, `root.children[${i}]`);
527
+ });
528
+
529
+ return {
530
+ valid: errors.length === 0,
531
+ errors,
532
+ warnings
533
+ };
534
+ }
535
+
536
+ /**
537
+ * Validate and optionally fix Lexical format codes
538
+ * Ensures format codes follow Lexical bitwise specification
539
+ * @param {number} format - The format code to validate
540
+ * @returns {Object} Validation result
541
+ */
542
+ validateFormatCode(format) {
543
+ const VALID_FORMATS = {
544
+ BOLD: 1, // 1 << 0
545
+ ITALIC: 2, // 1 << 1
546
+ STRIKETHROUGH: 4, // 1 << 2
547
+ UNDERLINE: 8, // 1 << 3
548
+ CODE: 16, // 1 << 4
549
+ SUBSCRIPT: 32, // 1 << 5
550
+ SUPERSCRIPT: 64, // 1 << 6
551
+ HIGHLIGHT: 128 // 1 << 7
552
+ };
553
+
554
+ if (typeof format !== 'number') {
555
+ return {
556
+ valid: false,
557
+ error: `Format must be number, got ${typeof format}`
558
+ };
559
+ }
560
+
561
+ if (format < 0 || format > 255) {
562
+ return {
563
+ valid: false,
564
+ error: `Format must be between 0 and 255, got ${format}`
565
+ };
566
+ }
567
+
568
+ // Decompose format into individual flags
569
+ const flags = [];
570
+ Object.entries(VALID_FORMATS).forEach(([name, value]) => {
571
+ if ((format & value) === value) {
572
+ flags.push(name);
573
+ }
574
+ });
575
+
576
+ return {
577
+ valid: true,
578
+ format,
579
+ flags,
580
+ description: flags.length > 0 ? flags.join(' + ') : 'Plain text'
581
+ };
582
+ }
583
+
378
584
  /**
379
585
  * List all collections
380
586
  */
@@ -234,7 +234,8 @@ export async function updateComponent(componentType, projectDir, cliType, source
234
234
 
235
235
  const files = componentType === 'docs'
236
236
  ? ['USER_GUIDE.md', 'PUBLISHING_GUIDE.md', 'COOLIFY_DEPLOYMENT.md', 'DEV_WORKFLOW_GUIDE.md',
237
- 'MCP_INTEGRATION.md', 'WORDPRESS_ADMIN_SCRIPTS.md', 'TECHNICAL_ARCHITECTURE.md']
237
+ 'MCP_INTEGRATION.md', 'WORDPRESS_ADMIN_SCRIPTS.md', 'TECHNICAL_ARCHITECTURE.md',
238
+ 'WORDPRESS_INTEGRATION.md', 'wordpress-api-examples.md']
238
239
  : await fs.readdir(sourceSubDir);
239
240
 
240
241
  for (const file of files) {