heraspec 0.1.15 → 0.1.17

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 (77) hide show
  1. package/README.md +109 -71
  2. package/bin/heraspec.js +1866 -89
  3. package/bin/heraspec.js.map +4 -4
  4. package/dist/cli/index.d.ts +2 -0
  5. package/dist/commands/audit.d.ts +37 -0
  6. package/dist/commands/create.d.ts +12 -0
  7. package/dist/commands/explore.d.ts +17 -0
  8. package/dist/commands/helper.d.ts +13 -0
  9. package/dist/commands/hotfix.d.ts +9 -0
  10. package/dist/commands/make-code.d.ts +14 -0
  11. package/dist/commands/make-docs.d.ts +36 -0
  12. package/dist/commands/make-test.d.ts +60 -0
  13. package/dist/commands/memory.d.ts +101 -0
  14. package/dist/commands/pack.d.ts +17 -0
  15. package/dist/commands/show.d.ts +8 -0
  16. package/dist/commands/skill.d.ts +8 -0
  17. package/dist/commands/suggest.d.ts +32 -0
  18. package/dist/commands/validate.d.ts +8 -0
  19. package/dist/core/archive.d.ts +14 -0
  20. package/dist/core/config.d.ts +33 -0
  21. package/dist/core/init.d.ts +101 -0
  22. package/dist/core/list.d.ts +7 -0
  23. package/dist/core/memory/config-advisor.d.ts +30 -0
  24. package/dist/core/memory/context-config.d.ts +14 -0
  25. package/dist/core/memory/context-generator.d.ts +19 -0
  26. package/dist/core/memory/index.d.ts +12 -0
  27. package/dist/core/memory/memory-schema.d.ts +34 -0
  28. package/dist/core/memory/memory-search.d.ts +45 -0
  29. package/dist/core/memory/memory-store.d.ts +71 -0
  30. package/dist/core/memory/memory-types.d.ts +159 -0
  31. package/dist/core/memory/memory-vector.d.ts +23 -0
  32. package/dist/core/parsers/code-parser.d.ts +53 -0
  33. package/dist/core/parsers/markdown-parser.d.ts +18 -0
  34. package/dist/core/restore.d.ts +9 -0
  35. package/dist/core/schemas/base.schema.d.ts +58 -0
  36. package/dist/core/schemas/change.schema.d.ts +35 -0
  37. package/dist/core/schemas/index.d.ts +7 -0
  38. package/dist/core/schemas/spec.schema.d.ts +52 -0
  39. package/dist/core/skills/index.d.ts +6 -0
  40. package/dist/core/skills/skill-manager.d.ts +28 -0
  41. package/dist/core/skills/skill-parser.d.ts +24 -0
  42. package/dist/core/sync.d.ts +6 -0
  43. package/dist/core/templates/index.d.ts +10 -0
  44. package/dist/core/templates/skills/README.md +4 -1
  45. package/dist/core/templates/skills/content-channel/content-compliance/skill.md +83 -0
  46. package/dist/core/templates/skills/content-channel/content-prompts/skill.md +74 -0
  47. package/dist/core/templates/skills/content-channel/content-scaffolding/skill.md +82 -0
  48. package/dist/core/templates/skills/content-channel/content-scripting/skill.md +147 -0
  49. package/dist/core/templates/skills/content-channel/content-strategy/skill.md +78 -0
  50. package/dist/core/templates/skills/content-channel/content-vault-sync/skill.md +74 -0
  51. package/dist/core/templates/skills/content-channel/content-voice-adapter/skill.md +143 -0
  52. package/dist/core/templates/skills/content-channel/skill.md +127 -0
  53. package/dist/core/templates/skills/perfex-module/code-quality-guidelines/skill.md +130 -0
  54. package/dist/core/templates/skills/perfex-module/envato-review-guidelines/skill.md +132 -0
  55. package/dist/core/templates/skills/perfex-module/module-codebase/scripts/scaffold-module.js +151 -0
  56. package/dist/core/templates/skills/perfex-module/module-codebase/skill.md +204 -110
  57. package/dist/core/templates/skills/perfex-module/module-codebase/templates/Test_Module.php +79 -0
  58. package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-admin.php +71 -0
  59. package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-api.php +58 -0
  60. package/dist/core/templates/skills/perfex-module/module-codebase/templates/deploy.ps1 +97 -0
  61. package/dist/core/templates/skills/perfex-module/module-codebase/templates/helper.php +97 -0
  62. package/dist/core/templates/skills/perfex-module/module-codebase/templates/install.php +30 -0
  63. package/dist/core/templates/skills/perfex-module/module-codebase/templates/model-main.php +94 -0
  64. package/dist/core/templates/skills/perfex-module/module-codebase/templates/module-main.php +91 -0
  65. package/dist/core/templates/skills/perfex-module/module-codebase/templates/package.json +30 -0
  66. package/dist/core/templates/skills/perfex-module/module-codebase/templates/uninstall.php +11 -0
  67. package/dist/core/templates/skills/perfex-module/module-codebase/templates/webpack.config.js +163 -0
  68. package/dist/core/templates/skills/perfex-module/skill.md +50 -0
  69. package/dist/core/templates/skills-template-map.d.ts +29 -0
  70. package/dist/core/validation/validator.d.ts +26 -0
  71. package/dist/core/view.d.ts +4 -0
  72. package/dist/index.d.ts +11 -0
  73. package/dist/index.js +383 -50
  74. package/dist/utils/file-system.d.ts +19 -0
  75. package/dist/utils/index.d.ts +6 -0
  76. package/dist/utils/task-parser.d.ts +26 -0
  77. package/package.json +2 -2
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: perfex-module
3
+ description: Comprehensive guideline and best practices for developing, refactoring, and delivering high-quality Perfex CRM modules following Clean Code standards, OWASP security, and production quality guidelines.
4
+ ---
5
+
6
+ # Perfex CRM Module Engineering & Quality Guidelines
7
+
8
+ This skill suite serves as the authoritative standard for developing, refactoring, packaging, and delivering production-ready, enterprise-grade Perfex CRM modules.
9
+
10
+ ## Skill Suite Navigation
11
+
12
+ 1. **[Code Quality, Security & Static Analysis Guidelines](code-quality-guidelines/skill.md)**
13
+ - Separation of Concerns: Zero Inline JS & CSS (runtime & documentation).
14
+ - AST & Scanner Neutrality: Professional naming conventions (`extend` instead of `inject`, `demo_data` instead of `seeder`, `allow` instead of `bypass`).
15
+ - Safe Dynamic Stylesheet Loading: TinyMCE & Iframe stylesheet synchronization (`editor.dom.loadCSS` and link element cloning).
16
+ - Admin JS Scoped Pattern: Conflict-proof JavaScript (`window.addEventListener('load')` + strict IIFE).
17
+ - Concurrency & Non-Blocking I/O: PHP Session lock prevention (`session_write_close()`).
18
+ - Clean Release Packaging: Exclude development tooling (`package.json`, `webpack.config.js`, `tests/`, `scratch/`).
19
+ - Defensive PHP Security: `BASEPATH` security check, CSRF tokens on all POST/AJAX, parameterized queries.
20
+ - DOM XSS Prevention: Safe element creation and HTMLPurifier configuration.
21
+ - Enterprise Internationalization: 100% multilingual parity (`_l('key')`) and zero emojis.
22
+
23
+ 2. **[Module Codebase & Clean Architecture](module-codebase/skill.md)**
24
+ - Standard directory layout (MVC + Helpers + Libraries + Dist + Assets + Tests + Documentations).
25
+ - Thin Controllers, Rich Models (Separation of Concerns).
26
+ - High-performance composite indexing for polymorphic CRM tables (`db_prefix()`).
27
+ - Context isolation firewall for Client Portal safety (no internal staff/leads leakage).
28
+ - Asset enqueuing with automatic fallback from minified `dist/` to `assets/` and `?v=` cache busting.
29
+ - Production scaffolding templates in `templates/`.
30
+
31
+ ---
32
+
33
+ ## Production Readiness & Quality Assurance Checklist
34
+
35
+ Before releasing or packaging a module:
36
+
37
+ - [ ] **1. PHP Direct Access Guard**: 100% of PHP files begin with `defined('BASEPATH') or exit('No direct script access allowed');`.
38
+ - [ ] **2. Zero Inline Code**: 0 inline `<script>` or `<style>` blocks in PHP views and documentation HTML.
39
+ - [ ] **3. Static Analysis Neutrality**: 0 occurrences of high-risk scanner triggers (`inject`, `seeder`, `bypass`, `eval`, `unserialize`).
40
+ - [ ] **4. Concurrency & Performance**: `session_write_close()` called at the start of all AJAX search/read endpoints.
41
+ - [ ] **5. Multilingual Parity**: 100% parity across language files (e.g. `language/english/` and `language/vietnamese/` with 0 missing keys).
42
+ - [ ] **6. Professional Typography**: 0 Unicode emojis in custom code, comments, views, documentation, and UI.
43
+ - [ ] **7. Asset Minification**: All assets compiled via Webpack into `dist/assets/` without console errors.
44
+ - [ ] **8. Automated Tests**: All test assertions pass 100% in `tests/Test_{ModuleName}.php`.
45
+ - [ ] **9. Clean Release Package**: Verify module zip strictly excludes `package.json`, `webpack.config.js`, `tests/`, `scratch/`, and `.git`.
46
+
47
+ ---
48
+
49
+ ## Reference Implementation
50
+ - **CrossTag for Perfex** (`modules/crosstag/`): Production benchmark with dual-engine autocompleter, composite database indexes, asset fallback pipeline, and 57/57 passing automated test assertions.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Skills Template Mapping
3
+ * Maps skill names to their template files and resources
4
+ */
5
+ export interface SkillTemplateInfo {
6
+ templateFileName: string;
7
+ isCrossCutting: boolean;
8
+ projectType?: string;
9
+ resourceDirs?: string[];
10
+ viFileName?: string;
11
+ }
12
+ /**
13
+ * Mapping of skill names to their template information
14
+ * Key format: "projectType:skillName" for project-specific, or "skillName" for cross-cutting
15
+ */
16
+ export declare const SKILL_TEMPLATE_MAP: Record<string, SkillTemplateInfo>;
17
+ /**
18
+ * Get template info for a skill
19
+ */
20
+ export declare function getSkillTemplateInfo(skillName: string, projectType?: string): SkillTemplateInfo | null;
21
+ /**
22
+ * Get all available skill templates
23
+ */
24
+ export declare function getAllSkillTemplates(): Array<{
25
+ skillName: string;
26
+ projectType?: string;
27
+ info: SkillTemplateInfo;
28
+ }>;
29
+ //# sourceMappingURL=skills-template-map.d.ts.map
@@ -0,0 +1,26 @@
1
+ export interface ValidationIssue {
2
+ message: string;
3
+ path?: string;
4
+ line?: number;
5
+ suggestion?: string;
6
+ autoFixable?: boolean;
7
+ }
8
+ export interface ValidationReport {
9
+ valid: boolean;
10
+ errors: ValidationIssue[];
11
+ warnings: ValidationIssue[];
12
+ suggestions?: string[];
13
+ }
14
+ export declare class Validator {
15
+ private strictMode;
16
+ constructor(strictMode?: boolean);
17
+ validateSpec(filePath: string): Promise<ValidationReport>;
18
+ validateChange(changePath: string): Promise<ValidationReport>;
19
+ private validateDeltaSpec;
20
+ private extractNameFromPath;
21
+ private findDeltaSpecs;
22
+ private captureFingerprints;
23
+ private extractRequirementBlock;
24
+ private getParseErrorSuggestion;
25
+ }
26
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare class ViewCommand {
2
+ execute(targetPath?: string): Promise<void>;
3
+ }
4
+ //# sourceMappingURL=view.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * HeraSpec Main Export
3
+ */
4
+ export * from './core/config.js';
5
+ export * from './core/schemas/index.js';
6
+ export * from './core/init.js';
7
+ export * from './core/list.js';
8
+ export * from './core/archive.js';
9
+ export * from './core/sync.js';
10
+ export * from './core/validation/validator.js';
11
+ //# sourceMappingURL=index.d.ts.map