heraspec 0.1.15 → 0.1.16

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 (69) hide show
  1. package/README.md +46 -12
  2. package/bin/heraspec.js +1296 -75
  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 +11 -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 +97 -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 +55 -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 +50 -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/perfex-module/code-quality-guidelines/skill.md +130 -0
  46. package/dist/core/templates/skills/perfex-module/envato-review-guidelines/skill.md +132 -0
  47. package/dist/core/templates/skills/perfex-module/module-codebase/scripts/scaffold-module.js +151 -0
  48. package/dist/core/templates/skills/perfex-module/module-codebase/skill.md +204 -110
  49. package/dist/core/templates/skills/perfex-module/module-codebase/templates/Test_Module.php +79 -0
  50. package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-admin.php +71 -0
  51. package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-api.php +58 -0
  52. package/dist/core/templates/skills/perfex-module/module-codebase/templates/deploy.ps1 +97 -0
  53. package/dist/core/templates/skills/perfex-module/module-codebase/templates/helper.php +97 -0
  54. package/dist/core/templates/skills/perfex-module/module-codebase/templates/install.php +30 -0
  55. package/dist/core/templates/skills/perfex-module/module-codebase/templates/model-main.php +94 -0
  56. package/dist/core/templates/skills/perfex-module/module-codebase/templates/module-main.php +91 -0
  57. package/dist/core/templates/skills/perfex-module/module-codebase/templates/package.json +30 -0
  58. package/dist/core/templates/skills/perfex-module/module-codebase/templates/uninstall.php +11 -0
  59. package/dist/core/templates/skills/perfex-module/module-codebase/templates/webpack.config.js +163 -0
  60. package/dist/core/templates/skills/perfex-module/skill.md +50 -0
  61. package/dist/core/templates/skills-template-map.d.ts +29 -0
  62. package/dist/core/validation/validator.d.ts +26 -0
  63. package/dist/core/view.d.ts +4 -0
  64. package/dist/index.d.ts +11 -0
  65. package/dist/index.js +155 -35
  66. package/dist/utils/file-system.d.ts +19 -0
  67. package/dist/utils/index.d.ts +6 -0
  68. package/dist/utils/task-parser.d.ts +26 -0
  69. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -63,6 +63,8 @@ var init_config = __esm({
63
63
  ],
64
64
  "perfex-module": [
65
65
  "module-codebase",
66
+ "code-quality-guidelines",
67
+ "envato-review-guidelines",
66
68
  "module-registration",
67
69
  "permission-group",
68
70
  "admin-menu-item",
@@ -398,9 +400,32 @@ var init_skills_template_map = __esm({
398
400
  isCrossCutting: true
399
401
  },
400
402
  // Perfex module skills
403
+ "perfex-module": {
404
+ templateFileName: "perfex-module/skill.md",
405
+ isCrossCutting: true,
406
+ resourceDirs: [
407
+ "perfex-module/module-codebase",
408
+ "perfex-module/code-quality-guidelines",
409
+ "perfex-module/envato-review-guidelines"
410
+ ]
411
+ },
401
412
  "perfex-module:module-codebase": {
402
413
  templateFileName: "perfex-module/module-codebase/skill.md",
403
414
  isCrossCutting: false,
415
+ projectType: "perfex-module",
416
+ resourceDirs: [
417
+ "perfex-module/module-codebase/templates",
418
+ "perfex-module/module-codebase/scripts"
419
+ ]
420
+ },
421
+ "perfex-module:code-quality-guidelines": {
422
+ templateFileName: "perfex-module/code-quality-guidelines/skill.md",
423
+ isCrossCutting: false,
424
+ projectType: "perfex-module"
425
+ },
426
+ "perfex-module:envato-review-guidelines": {
427
+ templateFileName: "perfex-module/envato-review-guidelines/skill.md",
428
+ isCrossCutting: false,
404
429
  projectType: "perfex-module"
405
430
  },
406
431
  "wordpress:ux-element": {
@@ -2643,8 +2668,12 @@ var init_skill_parser = __esm({
2643
2668
  const sectionName = line.replace(/^##+\s+/, "").toLowerCase();
2644
2669
  currentSection = sectionName;
2645
2670
  if (sectionName.includes("m\u1EE5c \u0111\xEDch") || sectionName.includes("purpose")) {
2646
- if (i + 1 < lines.length && lines[i + 1].trim()) {
2647
- skill.purpose = lines[i + 1].trim();
2671
+ for (let j = i + 1; j < lines.length && !lines[j].startsWith("##"); j++) {
2672
+ const nextLine = lines[j].trim();
2673
+ if (nextLine) {
2674
+ skill.purpose = nextLine;
2675
+ break;
2676
+ }
2648
2677
  }
2649
2678
  }
2650
2679
  continue;
@@ -2751,7 +2780,7 @@ var init_skill_manager = __esm({
2751
2780
  projectType,
2752
2781
  skillName
2753
2782
  );
2754
- if (await FileSystemUtils.fileExists(path6.join(projectSkillPath, "skill.md"))) {
2783
+ if (await FileSystemUtils.fileExists(path6.join(projectSkillPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(projectSkillPath, "SKILL.md"))) {
2755
2784
  return projectSkillPath;
2756
2785
  }
2757
2786
  const crossCuttingPath = path6.join(
@@ -2760,7 +2789,7 @@ var init_skill_manager = __esm({
2760
2789
  SKILLS_DIR_NAME,
2761
2790
  skillName
2762
2791
  );
2763
- if (await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "skill.md"))) {
2792
+ if (await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "SKILL.md"))) {
2764
2793
  return crossCuttingPath;
2765
2794
  }
2766
2795
  return null;
@@ -2798,9 +2827,15 @@ var init_skill_manager = __esm({
2798
2827
  if (isProjectType) {
2799
2828
  const projectSkills = await this.listSkillsInDirectory(entryPath, entry);
2800
2829
  skills.push(...projectSkills);
2830
+ if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
2831
+ skills.push({
2832
+ projectType: entry,
2833
+ skillName: entry,
2834
+ path: entryPath
2835
+ });
2836
+ }
2801
2837
  } else {
2802
- const skillMdPath = path6.join(entryPath, "skill.md");
2803
- if (await FileSystemUtils.fileExists(skillMdPath)) {
2838
+ if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
2804
2839
  skills.push({
2805
2840
  skillName: entry,
2806
2841
  path: entryPath
@@ -2837,8 +2872,7 @@ var init_skill_manager = __esm({
2837
2872
  const entryPath = path6.join(dir, entry);
2838
2873
  const stats = await FileSystemUtils.stat(entryPath);
2839
2874
  if (stats.isDirectory()) {
2840
- const skillMdPath = path6.join(entryPath, "skill.md");
2841
- if (await FileSystemUtils.fileExists(skillMdPath)) {
2875
+ if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
2842
2876
  skills.push({
2843
2877
  projectType,
2844
2878
  skillName: entry,
@@ -3171,17 +3205,7 @@ var init_skill = __esm({
3171
3205
  }
3172
3206
  const isUpdate = await FileSystemUtils.fileExists(destPath);
3173
3207
  if (isUpdate) {
3174
- spinner.info(`Skill "${skillName}" already exists at ${destPath}`);
3175
- spinner.start(`Removing old version to update with latest...`);
3176
- try {
3177
- await FileSystemUtils.removeDirectory(destPath, true);
3178
- spinner.succeed(`Removed old skill "${skillName}"`);
3179
- } catch (error) {
3180
- spinner.fail(`Failed to remove old skill: ${error instanceof Error ? error.message : "Unknown error"}`);
3181
- process.exitCode = 1;
3182
- return;
3183
- }
3184
- spinner.start(`Adding updated skill "${skillName}"...`);
3208
+ spinner.info(`Skill "${skillName}" already exists at ${destPath} - updating template files (custom files preserved)...`);
3185
3209
  }
3186
3210
  await FileSystemUtils.createDirectory(destPath);
3187
3211
  const coreTemplatesDir = await getCoreTemplatesDir();
@@ -3197,6 +3221,10 @@ var init_skill = __esm({
3197
3221
  return;
3198
3222
  }
3199
3223
  await FileSystemUtils.copyFile(templateFile, path7.join(destPath, "skill.md"));
3224
+ const upperTemplateFile = path7.join(path7.dirname(templateFile), "SKILL.md");
3225
+ if (await FileSystemUtils.fileExists(upperTemplateFile)) {
3226
+ await FileSystemUtils.copyFile(upperTemplateFile, path7.join(destPath, "SKILL.md"));
3227
+ }
3200
3228
  if (templateInfo.viFileName) {
3201
3229
  const viFile = path7.join(coreTemplatesDir, templateInfo.viFileName);
3202
3230
  if (await FileSystemUtils.fileExists(viFile)) {
@@ -3530,6 +3558,24 @@ The following commands are classified by risk level. You **MUST NOT** execute th
3530
3558
  - **CRITICAL**: Agent MUST present full report and **wait for user confirmation** before making changes
3531
3559
  - Reference guideline numbers (e.g., "Guideline 7: User Tracking Consent")
3532
3560
 
3561
+ **Special case - Perfex Module Engineering skills:**
3562
+ - Tasks: \`(projectType: perfex-module, skill: module-codebase)\` or \`(projectType: perfex-module, skill: code-quality-guidelines)\` or \`(skill: perfex-module)\`
3563
+ - Install: \`heraspec skill add perfex-module\` or \`heraspec skill add module-codebase --project-type perfex-module\` or \`heraspec skill add code-quality-guidelines --project-type perfex-module\`
3564
+ - Agent reads: \`heraspec/skills/perfex-module/skill.md\`, \`heraspec/skills/perfex-module/module-codebase/skill.md\`, and \`heraspec/skills/perfex-module/code-quality-guidelines/skill.md\`
3565
+ - Agent MUST adhere to **10 Enterprise Code Quality & Clean Code Standards**:
3566
+ 1. **Separation of Concerns (Zero Inline Code)**: 0 inline <script> or <style> blocks in views and documentation HTML.
3567
+ 2. **Static Analysis Neutrality**: 0 occurrences of high-risk scanner triggers (inject, seeder, bypass, eval, unserialize).
3568
+ 3. **Safe Stylesheet Loading**: Use editor.dom.loadCSS() for TinyMCE/iframes; never inject raw CSS string arrays.
3569
+ 4. **Scoped Admin JS**: Enclose scripts in window.addEventListener('load') + strict IIFE.
3570
+ 5. **Concurrency & Performance**: Always call session_write_close() at the start of read/search AJAX endpoints.
3571
+ 6. **Clean Release Packaging**: Exclude package.json, webpack.config.js, tests/, scratch/, .git in deploy.ps1.
3572
+ 7. **Defensive PHP Security & Guards**: 100% PHP files start with defined('BASEPATH') or exit('No direct script access allowed');. Use CI Query Builder with auto-escaping.
3573
+ 8. **DOM XSS Prevention (CWE-79)**: Use .textContent, .innerText, or strict HTML escaping helper; purify rich text.
3574
+ 9. **100% Multilingual Parity**: 100% labels and messages use _l('key') with zero missing keys across languages.
3575
+ 10. **Zero Emojis**: 0 Unicode emojis across custom code, comments, views, documentation, and UI.
3576
+ - Use templates from \`heraspec/skills/perfex-module/module-codebase/templates/\` (module-main.php, install.php, uninstall.php, controller-admin.php, controller-api.php, model-main.php, helper.php, deploy.ps1, webpack.config.js).
3577
+
3578
+
3533
3579
 
3534
3580
  - Follow tasks.md
3535
3581
  - Mark tasks completed: \`- [x]\`
@@ -4187,36 +4233,78 @@ ${section.content.trimEnd()}`);
4187
4233
  }
4188
4234
  return null;
4189
4235
  }
4236
+ /**
4237
+ * Refactor legacy installed skills if new standards or companion skills were added to HeraSpec.
4238
+ * Ensures backward compatibility and non-destructive enhancement for existing projects.
4239
+ */
4240
+ async refactorLegacySkills(skillsDir, coreTemplatesDir) {
4241
+ const perfexSkillDir = path8.join(skillsDir, "perfex-module");
4242
+ if (await FileSystemUtils.fileExists(perfexSkillDir)) {
4243
+ const rootSkillMd = path8.join(perfexSkillDir, "skill.md");
4244
+ const rootSkillUpperMd = path8.join(perfexSkillDir, "SKILL.md");
4245
+ const templateRootSkill = path8.join(coreTemplatesDir, "perfex-module", "skill.md");
4246
+ const templateRootUpper = path8.join(coreTemplatesDir, "perfex-module", "SKILL.md");
4247
+ if (!await FileSystemUtils.fileExists(rootSkillMd) && await FileSystemUtils.fileExists(templateRootSkill)) {
4248
+ await FileSystemUtils.copyFile(templateRootSkill, rootSkillMd);
4249
+ }
4250
+ if (!await FileSystemUtils.fileExists(rootSkillUpperMd) && await FileSystemUtils.fileExists(templateRootUpper)) {
4251
+ await FileSystemUtils.copyFile(templateRootUpper, rootSkillUpperMd);
4252
+ }
4253
+ const qualityGuidelinesDir = path8.join(perfexSkillDir, "code-quality-guidelines");
4254
+ const templateQualityDir = path8.join(coreTemplatesDir, "perfex-module", "code-quality-guidelines");
4255
+ if (!await FileSystemUtils.fileExists(qualityGuidelinesDir) && await FileSystemUtils.fileExists(templateQualityDir)) {
4256
+ console.log(chalk2.cyan(" \u2713 Refactored perfex-module: added code-quality-guidelines skill"));
4257
+ await FileSystemUtils.copyDirectory(templateQualityDir, qualityGuidelinesDir);
4258
+ }
4259
+ const codebaseDir = path8.join(perfexSkillDir, "module-codebase");
4260
+ const templateCodebaseDir = path8.join(coreTemplatesDir, "perfex-module", "module-codebase");
4261
+ if (await FileSystemUtils.fileExists(codebaseDir) && await FileSystemUtils.fileExists(templateCodebaseDir)) {
4262
+ await FileSystemUtils.copyDirectory(templateCodebaseDir, codebaseDir);
4263
+ }
4264
+ }
4265
+ }
4190
4266
  /**
4191
4267
  * Update installed built-in skills on re-init.
4192
4268
  *
4193
4269
  * Rules:
4194
4270
  * - Only update skills that exist in SKILL_TEMPLATE_MAP (built-in / known skills)
4195
4271
  * - Skip skills NOT in the template map (custom skills added by the project)
4272
+ * - Strictly preserve custom project skills: NEVER delete or overwrite them
4196
4273
  * - For each matching skill: update skill.md + re-copy resourceDirs from template
4197
- * but PRESERVE templates/, scripts/, examples/ sub-folders added by user
4274
+ * safely preserving any user files in templates/, scripts/, examples/ sub-folders
4198
4275
  */
4199
4276
  async updateInstalledSkills(heraspecPath) {
4200
4277
  const skillsDir = path8.join(heraspecPath, SKILLS_DIR_NAME);
4201
4278
  if (!await FileSystemUtils.fileExists(skillsDir)) return;
4202
4279
  const coreTemplatesDir = await this.getCoreTemplatesDir();
4203
4280
  if (!coreTemplatesDir) return;
4281
+ await this.refactorLegacySkills(skillsDir, coreTemplatesDir);
4204
4282
  const allTemplates = getAllSkillTemplates();
4205
4283
  let updatedCount = 0;
4206
- let skippedCount = 0;
4284
+ const preservedSkills = [];
4207
4285
  const installedSkillPaths = await this.collectInstalledSkillPaths(skillsDir);
4208
4286
  for (const { skillPath, skillName, projectType } of installedSkillPaths) {
4209
4287
  const templateInfo = getSkillTemplateInfo(skillName, projectType);
4210
4288
  if (!templateInfo) {
4211
- skippedCount++;
4289
+ const displayName = projectType ? `${projectType}/${skillName}` : skillName;
4290
+ if (!preservedSkills.includes(displayName)) {
4291
+ preservedSkills.push(displayName);
4292
+ }
4212
4293
  continue;
4213
4294
  }
4214
4295
  const templateFile = path8.join(coreTemplatesDir, templateInfo.templateFileName);
4215
4296
  if (!await FileSystemUtils.fileExists(templateFile)) {
4216
- skippedCount++;
4297
+ const displayName = projectType ? `${projectType}/${skillName}` : skillName;
4298
+ if (!preservedSkills.includes(displayName)) {
4299
+ preservedSkills.push(displayName);
4300
+ }
4217
4301
  continue;
4218
4302
  }
4219
4303
  await FileSystemUtils.copyFile(templateFile, path8.join(skillPath, "skill.md"));
4304
+ const upperTemplateFile = path8.join(path8.dirname(templateFile), "SKILL.md");
4305
+ if (await FileSystemUtils.fileExists(upperTemplateFile)) {
4306
+ await FileSystemUtils.copyFile(upperTemplateFile, path8.join(skillPath, "SKILL.md"));
4307
+ }
4220
4308
  if (templateInfo.viFileName) {
4221
4309
  const viFile = path8.join(coreTemplatesDir, templateInfo.viFileName);
4222
4310
  if (await FileSystemUtils.fileExists(viFile)) {
@@ -4228,9 +4316,6 @@ ${section.content.trimEnd()}`);
4228
4316
  const srcResourceDir = path8.join(coreTemplatesDir, resourceDir);
4229
4317
  const destResourceDir = path8.join(skillPath, path8.basename(resourceDir));
4230
4318
  if (await FileSystemUtils.fileExists(srcResourceDir)) {
4231
- if (await FileSystemUtils.fileExists(destResourceDir)) {
4232
- await FileSystemUtils.removeDirectory(destResourceDir, true);
4233
- }
4234
4319
  await FileSystemUtils.copyDirectory(srcResourceDir, destResourceDir);
4235
4320
  }
4236
4321
  }
@@ -4241,7 +4326,13 @@ ${section.content.trimEnd()}`);
4241
4326
  updatedCount++;
4242
4327
  }
4243
4328
  if (updatedCount > 0) {
4244
- console.log(chalk2.gray(` \u2713 Updated ${updatedCount} built-in skill(s)${skippedCount > 0 ? `, skipped ${skippedCount} custom skill(s)` : ""}`));
4329
+ console.log(chalk2.gray(` \u2713 Updated ${updatedCount} built-in skill(s)`));
4330
+ }
4331
+ if (preservedSkills.length > 0) {
4332
+ console.log(chalk2.green(` \u2713 Preserved ${preservedSkills.length} custom project skill(s) (never deleted or overwritten):`));
4333
+ for (const skill of preservedSkills) {
4334
+ console.log(chalk2.gray(` \u2022 ${skill}`));
4335
+ }
4245
4336
  }
4246
4337
  }
4247
4338
  /**
@@ -4263,20 +4354,25 @@ ${section.content.trimEnd()}`);
4263
4354
  "multi-stack"
4264
4355
  ];
4265
4356
  for (const entry of entries) {
4357
+ if (entry === "README.md" || entry === "UI_UX_SKILL_QUICK_REFERENCE.md") continue;
4266
4358
  const entryPath = path8.join(skillsDir, entry);
4267
4359
  const stats = await FileSystemUtils.stat(entryPath);
4268
4360
  if (!stats.isDirectory()) continue;
4269
4361
  if (knownProjectTypes.includes(entry)) {
4270
4362
  const subEntries = await FileSystemUtils.readDirectory(entryPath);
4271
4363
  for (const sub of subEntries) {
4364
+ if (["templates", "scripts", "examples", "data", "knowledge", "tests", "docs"].includes(sub)) continue;
4272
4365
  const subPath = path8.join(entryPath, sub);
4273
4366
  const subStats = await FileSystemUtils.stat(subPath);
4274
- if (subStats.isDirectory() && await FileSystemUtils.fileExists(path8.join(subPath, "skill.md"))) {
4367
+ if (subStats.isDirectory()) {
4275
4368
  result.push({ skillPath: subPath, skillName: sub, projectType: entry });
4276
4369
  }
4277
4370
  }
4371
+ if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path8.join(entryPath, "SKILL.md"))) {
4372
+ result.push({ skillPath: entryPath, skillName: entry, projectType: entry });
4373
+ }
4278
4374
  } else {
4279
- if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md"))) {
4375
+ if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path8.join(entryPath, "SKILL.md"))) {
4280
4376
  result.push({ skillPath: entryPath, skillName: entry });
4281
4377
  }
4282
4378
  }
@@ -5476,19 +5572,31 @@ var Validator = class {
5476
5572
  const spec = parser.parseSpec(specName);
5477
5573
  const result = SpecSchema.safeParse(spec);
5478
5574
  if (!result.success) {
5479
- result.error.errors.forEach((err) => {
5480
- errors.push(`${err.path.join(".")}: ${err.message}`);
5575
+ result.error.issues.forEach((err) => {
5576
+ errors.push({
5577
+ message: `${err.path.join(".")}: ${err.message}`,
5578
+ autoFixable: false
5579
+ });
5481
5580
  });
5482
5581
  }
5483
5582
  if (spec.requirements.length === 0) {
5484
- errors.push("Spec must have at least one requirement");
5583
+ errors.push({
5584
+ message: "Spec must have at least one requirement",
5585
+ autoFixable: false
5586
+ });
5485
5587
  }
5486
5588
  for (const req of spec.requirements) {
5487
5589
  if (!req.description || req.description.trim().length === 0) {
5488
- errors.push(`Requirement "${req.name}" must have a description`);
5590
+ errors.push({
5591
+ message: `Requirement "${req.name}" must have a description`,
5592
+ autoFixable: false
5593
+ });
5489
5594
  }
5490
5595
  if (!req.scenarios || req.scenarios.length === 0) {
5491
- warnings.push(`Requirement "${req.name}" has no scenarios`);
5596
+ warnings.push({
5597
+ message: `Requirement "${req.name}" has no scenarios`,
5598
+ autoFixable: false
5599
+ });
5492
5600
  }
5493
5601
  }
5494
5602
  return {
@@ -5499,7 +5607,10 @@ var Validator = class {
5499
5607
  } catch (error) {
5500
5608
  return {
5501
5609
  valid: false,
5502
- errors: [error instanceof Error ? error.message : "Unknown error"],
5610
+ errors: [{
5611
+ message: error instanceof Error ? error.message : "Unknown error",
5612
+ autoFixable: false
5613
+ }],
5503
5614
  warnings: []
5504
5615
  };
5505
5616
  }
@@ -5666,6 +5777,15 @@ var Validator = class {
5666
5777
  const match = content.match(reqRegex);
5667
5778
  return match ? match[0].trim() : null;
5668
5779
  }
5780
+ getParseErrorSuggestion(errorMessage) {
5781
+ if (errorMessage.includes("YAML") || errorMessage.includes("frontmatter")) {
5782
+ return "Check the YAML frontmatter syntax at the top of the file.";
5783
+ }
5784
+ if (errorMessage.includes("header") || errorMessage.includes("heading")) {
5785
+ return "Ensure headers follow markdown format (# Title, ## Section).";
5786
+ }
5787
+ return void 0;
5788
+ }
5669
5789
  };
5670
5790
  export {
5671
5791
  ARCHIVES_DIR_NAME,
@@ -0,0 +1,19 @@
1
+ export declare class FileSystemUtils {
2
+ static createDirectory(dirPath: string): Promise<void>;
3
+ static fileExists(filePath: string): Promise<boolean>;
4
+ static readFile(filePath: string): Promise<string>;
5
+ static writeFile(filePath: string, content: string): Promise<void>;
6
+ static readDirectory(dirPath: string): Promise<string[]>;
7
+ static stat(filePath: string): Promise<import("fs").Stats>;
8
+ static copyFile(src: string, dest: string): Promise<void>;
9
+ static copyDirectory(src: string, dest: string): Promise<void>;
10
+ static removeFile(filePath: string): Promise<void>;
11
+ static removeDirectory(dirPath: string, recursive?: boolean): Promise<void>;
12
+ static moveFile(src: string, dest: string): Promise<void>;
13
+ static joinPath(...segments: string[]): string;
14
+ static resolvePath(...segments: string[]): string;
15
+ static getDirectoryName(filePath: string): string;
16
+ static getBaseName(filePath: string): string;
17
+ static generateTree(dirPath: string, maxDepth?: number, ignoreDirs?: string[], currentDepth?: number, prefix?: string): Promise<string>;
18
+ }
19
+ //# sourceMappingURL=file-system.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Utility exports
3
+ */
4
+ export * from './file-system.js';
5
+ export * from './task-parser.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
1
+ export interface TaskGroup {
2
+ title: string;
3
+ projectType?: string;
4
+ skill?: string;
5
+ tasks: Array<{
6
+ id: string;
7
+ description: string;
8
+ completed: boolean;
9
+ }>;
10
+ }
11
+ export interface ParsedTasks {
12
+ groups: TaskGroup[];
13
+ skillsUsed: Array<{
14
+ projectType?: string;
15
+ skill: string;
16
+ }>;
17
+ }
18
+ export declare class TaskParser {
19
+ static parseTasks(filePath: string): ParsedTasks;
20
+ static getSkillsForTasks(filePath: string): Promise<Array<{
21
+ projectType?: string;
22
+ skill: string;
23
+ path: string;
24
+ }>>;
25
+ }
26
+ //# sourceMappingURL=task-parser.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heraspec",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Universal spec-first development framework + CLI for all project types and AI tools",
5
5
  "keywords": [
6
6
  "heraspec",
@@ -47,7 +47,7 @@
47
47
  "!dist/**/*.map"
48
48
  ],
49
49
  "scripts": {
50
- "build": "node build.js",
50
+ "build": "node build.js && tsc --emitDeclarationOnly",
51
51
  "dev": "tsc --watch",
52
52
  "dev:cli": "npm run build && node bin/heraspec.js",
53
53
  "test": "echo \"Error: no test specified\" && exit 1",