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.
- package/README.md +109 -71
- package/bin/heraspec.js +1866 -89
- package/bin/heraspec.js.map +4 -4
- package/dist/cli/index.d.ts +2 -0
- package/dist/commands/audit.d.ts +37 -0
- package/dist/commands/create.d.ts +12 -0
- package/dist/commands/explore.d.ts +17 -0
- package/dist/commands/helper.d.ts +13 -0
- package/dist/commands/hotfix.d.ts +9 -0
- package/dist/commands/make-code.d.ts +14 -0
- package/dist/commands/make-docs.d.ts +36 -0
- package/dist/commands/make-test.d.ts +60 -0
- package/dist/commands/memory.d.ts +101 -0
- package/dist/commands/pack.d.ts +17 -0
- package/dist/commands/show.d.ts +8 -0
- package/dist/commands/skill.d.ts +8 -0
- package/dist/commands/suggest.d.ts +32 -0
- package/dist/commands/validate.d.ts +8 -0
- package/dist/core/archive.d.ts +14 -0
- package/dist/core/config.d.ts +33 -0
- package/dist/core/init.d.ts +101 -0
- package/dist/core/list.d.ts +7 -0
- package/dist/core/memory/config-advisor.d.ts +30 -0
- package/dist/core/memory/context-config.d.ts +14 -0
- package/dist/core/memory/context-generator.d.ts +19 -0
- package/dist/core/memory/index.d.ts +12 -0
- package/dist/core/memory/memory-schema.d.ts +34 -0
- package/dist/core/memory/memory-search.d.ts +45 -0
- package/dist/core/memory/memory-store.d.ts +71 -0
- package/dist/core/memory/memory-types.d.ts +159 -0
- package/dist/core/memory/memory-vector.d.ts +23 -0
- package/dist/core/parsers/code-parser.d.ts +53 -0
- package/dist/core/parsers/markdown-parser.d.ts +18 -0
- package/dist/core/restore.d.ts +9 -0
- package/dist/core/schemas/base.schema.d.ts +58 -0
- package/dist/core/schemas/change.schema.d.ts +35 -0
- package/dist/core/schemas/index.d.ts +7 -0
- package/dist/core/schemas/spec.schema.d.ts +52 -0
- package/dist/core/skills/index.d.ts +6 -0
- package/dist/core/skills/skill-manager.d.ts +28 -0
- package/dist/core/skills/skill-parser.d.ts +24 -0
- package/dist/core/sync.d.ts +6 -0
- package/dist/core/templates/index.d.ts +10 -0
- package/dist/core/templates/skills/README.md +4 -1
- package/dist/core/templates/skills/content-channel/content-compliance/skill.md +83 -0
- package/dist/core/templates/skills/content-channel/content-prompts/skill.md +74 -0
- package/dist/core/templates/skills/content-channel/content-scaffolding/skill.md +82 -0
- package/dist/core/templates/skills/content-channel/content-scripting/skill.md +147 -0
- package/dist/core/templates/skills/content-channel/content-strategy/skill.md +78 -0
- package/dist/core/templates/skills/content-channel/content-vault-sync/skill.md +74 -0
- package/dist/core/templates/skills/content-channel/content-voice-adapter/skill.md +143 -0
- package/dist/core/templates/skills/content-channel/skill.md +127 -0
- package/dist/core/templates/skills/perfex-module/code-quality-guidelines/skill.md +130 -0
- package/dist/core/templates/skills/perfex-module/envato-review-guidelines/skill.md +132 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/scripts/scaffold-module.js +151 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/skill.md +204 -110
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/Test_Module.php +79 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-admin.php +71 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/controller-api.php +58 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/deploy.ps1 +97 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/helper.php +97 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/install.php +30 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/model-main.php +94 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/module-main.php +91 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/package.json +30 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/uninstall.php +11 -0
- package/dist/core/templates/skills/perfex-module/module-codebase/templates/webpack.config.js +163 -0
- package/dist/core/templates/skills/perfex-module/skill.md +50 -0
- package/dist/core/templates/skills-template-map.d.ts +29 -0
- package/dist/core/validation/validator.d.ts +26 -0
- package/dist/core/view.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +383 -50
- package/dist/utils/file-system.d.ts +19 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/task-parser.d.ts +26 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require =
|
|
1
|
+
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -36,7 +36,8 @@ var init_config = __esm({
|
|
|
36
36
|
"generic-webapp",
|
|
37
37
|
"backend-api",
|
|
38
38
|
"frontend-app",
|
|
39
|
-
"multi-stack"
|
|
39
|
+
"multi-stack",
|
|
40
|
+
"content-channel"
|
|
40
41
|
];
|
|
41
42
|
SKILLS = {
|
|
42
43
|
"wordpress-plugin": [
|
|
@@ -63,6 +64,8 @@ var init_config = __esm({
|
|
|
63
64
|
],
|
|
64
65
|
"perfex-module": [
|
|
65
66
|
"module-codebase",
|
|
67
|
+
"code-quality-guidelines",
|
|
68
|
+
"envato-review-guidelines",
|
|
66
69
|
"module-registration",
|
|
67
70
|
"permission-group",
|
|
68
71
|
"admin-menu-item",
|
|
@@ -117,6 +120,15 @@ var init_config = __esm({
|
|
|
117
120
|
"api-contract",
|
|
118
121
|
"shared-type",
|
|
119
122
|
"integration-point"
|
|
123
|
+
],
|
|
124
|
+
"content-channel": [
|
|
125
|
+
"content-strategy",
|
|
126
|
+
"content-scaffolding",
|
|
127
|
+
"content-scripting",
|
|
128
|
+
"content-voice-adapter",
|
|
129
|
+
"content-prompts",
|
|
130
|
+
"content-compliance",
|
|
131
|
+
"content-vault-sync"
|
|
120
132
|
]
|
|
121
133
|
};
|
|
122
134
|
HERASPEC_MARKERS = {
|
|
@@ -398,9 +410,32 @@ var init_skills_template_map = __esm({
|
|
|
398
410
|
isCrossCutting: true
|
|
399
411
|
},
|
|
400
412
|
// Perfex module skills
|
|
413
|
+
"perfex-module": {
|
|
414
|
+
templateFileName: "perfex-module/skill.md",
|
|
415
|
+
isCrossCutting: true,
|
|
416
|
+
resourceDirs: [
|
|
417
|
+
"perfex-module/module-codebase",
|
|
418
|
+
"perfex-module/code-quality-guidelines",
|
|
419
|
+
"perfex-module/envato-review-guidelines"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
401
422
|
"perfex-module:module-codebase": {
|
|
402
423
|
templateFileName: "perfex-module/module-codebase/skill.md",
|
|
403
424
|
isCrossCutting: false,
|
|
425
|
+
projectType: "perfex-module",
|
|
426
|
+
resourceDirs: [
|
|
427
|
+
"perfex-module/module-codebase/templates",
|
|
428
|
+
"perfex-module/module-codebase/scripts"
|
|
429
|
+
]
|
|
430
|
+
},
|
|
431
|
+
"perfex-module:code-quality-guidelines": {
|
|
432
|
+
templateFileName: "perfex-module/code-quality-guidelines/skill.md",
|
|
433
|
+
isCrossCutting: false,
|
|
434
|
+
projectType: "perfex-module"
|
|
435
|
+
},
|
|
436
|
+
"perfex-module:envato-review-guidelines": {
|
|
437
|
+
templateFileName: "perfex-module/envato-review-guidelines/skill.md",
|
|
438
|
+
isCrossCutting: false,
|
|
404
439
|
projectType: "perfex-module"
|
|
405
440
|
},
|
|
406
441
|
"wordpress:ux-element": {
|
|
@@ -435,6 +470,84 @@ var init_skills_template_map = __esm({
|
|
|
435
470
|
templateFileName: "wordpress/plugin-directory/skill.md",
|
|
436
471
|
isCrossCutting: false,
|
|
437
472
|
projectType: "wordpress-plugin"
|
|
473
|
+
},
|
|
474
|
+
// Content Channel skills
|
|
475
|
+
"content-channel": {
|
|
476
|
+
templateFileName: "content-channel/skill.md",
|
|
477
|
+
isCrossCutting: true,
|
|
478
|
+
resourceDirs: [
|
|
479
|
+
"content-channel/content-strategy",
|
|
480
|
+
"content-channel/content-scaffolding",
|
|
481
|
+
"content-channel/content-scripting",
|
|
482
|
+
"content-channel/content-voice-adapter",
|
|
483
|
+
"content-channel/content-prompts",
|
|
484
|
+
"content-channel/content-compliance",
|
|
485
|
+
"content-channel/content-vault-sync"
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
"content-channel:content-strategy": {
|
|
489
|
+
templateFileName: "content-channel/content-strategy/skill.md",
|
|
490
|
+
isCrossCutting: false,
|
|
491
|
+
projectType: "content-channel"
|
|
492
|
+
},
|
|
493
|
+
"content-channel:content-scaffolding": {
|
|
494
|
+
templateFileName: "content-channel/content-scaffolding/skill.md",
|
|
495
|
+
isCrossCutting: false,
|
|
496
|
+
projectType: "content-channel"
|
|
497
|
+
},
|
|
498
|
+
"content-channel:content-scripting": {
|
|
499
|
+
templateFileName: "content-channel/content-scripting/skill.md",
|
|
500
|
+
isCrossCutting: false,
|
|
501
|
+
projectType: "content-channel"
|
|
502
|
+
},
|
|
503
|
+
"content-channel:content-voice-adapter": {
|
|
504
|
+
templateFileName: "content-channel/content-voice-adapter/skill.md",
|
|
505
|
+
isCrossCutting: false,
|
|
506
|
+
projectType: "content-channel"
|
|
507
|
+
},
|
|
508
|
+
"content-channel:content-prompts": {
|
|
509
|
+
templateFileName: "content-channel/content-prompts/skill.md",
|
|
510
|
+
isCrossCutting: false,
|
|
511
|
+
projectType: "content-channel"
|
|
512
|
+
},
|
|
513
|
+
"content-channel:content-compliance": {
|
|
514
|
+
templateFileName: "content-channel/content-compliance/skill.md",
|
|
515
|
+
isCrossCutting: false,
|
|
516
|
+
projectType: "content-channel"
|
|
517
|
+
},
|
|
518
|
+
"content-channel:content-vault-sync": {
|
|
519
|
+
templateFileName: "content-channel/content-vault-sync/skill.md",
|
|
520
|
+
isCrossCutting: false,
|
|
521
|
+
projectType: "content-channel"
|
|
522
|
+
},
|
|
523
|
+
// Direct aliases (cross-cutting)
|
|
524
|
+
"content-strategy": {
|
|
525
|
+
templateFileName: "content-channel/content-strategy/skill.md",
|
|
526
|
+
isCrossCutting: true
|
|
527
|
+
},
|
|
528
|
+
"content-scaffolding": {
|
|
529
|
+
templateFileName: "content-channel/content-scaffolding/skill.md",
|
|
530
|
+
isCrossCutting: true
|
|
531
|
+
},
|
|
532
|
+
"content-scripting": {
|
|
533
|
+
templateFileName: "content-channel/content-scripting/skill.md",
|
|
534
|
+
isCrossCutting: true
|
|
535
|
+
},
|
|
536
|
+
"content-voice-adapter": {
|
|
537
|
+
templateFileName: "content-channel/content-voice-adapter/skill.md",
|
|
538
|
+
isCrossCutting: true
|
|
539
|
+
},
|
|
540
|
+
"content-prompts": {
|
|
541
|
+
templateFileName: "content-channel/content-prompts/skill.md",
|
|
542
|
+
isCrossCutting: true
|
|
543
|
+
},
|
|
544
|
+
"content-compliance": {
|
|
545
|
+
templateFileName: "content-channel/content-compliance/skill.md",
|
|
546
|
+
isCrossCutting: true
|
|
547
|
+
},
|
|
548
|
+
"content-vault-sync": {
|
|
549
|
+
templateFileName: "content-channel/content-vault-sync/skill.md",
|
|
550
|
+
isCrossCutting: true
|
|
438
551
|
}
|
|
439
552
|
};
|
|
440
553
|
}
|
|
@@ -2643,8 +2756,12 @@ var init_skill_parser = __esm({
|
|
|
2643
2756
|
const sectionName = line.replace(/^##+\s+/, "").toLowerCase();
|
|
2644
2757
|
currentSection = sectionName;
|
|
2645
2758
|
if (sectionName.includes("m\u1EE5c \u0111\xEDch") || sectionName.includes("purpose")) {
|
|
2646
|
-
|
|
2647
|
-
|
|
2759
|
+
for (let j = i + 1; j < lines.length && !lines[j].startsWith("##"); j++) {
|
|
2760
|
+
const nextLine = lines[j].trim();
|
|
2761
|
+
if (nextLine) {
|
|
2762
|
+
skill.purpose = nextLine;
|
|
2763
|
+
break;
|
|
2764
|
+
}
|
|
2648
2765
|
}
|
|
2649
2766
|
}
|
|
2650
2767
|
continue;
|
|
@@ -2751,7 +2868,7 @@ var init_skill_manager = __esm({
|
|
|
2751
2868
|
projectType,
|
|
2752
2869
|
skillName
|
|
2753
2870
|
);
|
|
2754
|
-
if (await FileSystemUtils.fileExists(path6.join(projectSkillPath, "skill.md"))) {
|
|
2871
|
+
if (await FileSystemUtils.fileExists(path6.join(projectSkillPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(projectSkillPath, "SKILL.md"))) {
|
|
2755
2872
|
return projectSkillPath;
|
|
2756
2873
|
}
|
|
2757
2874
|
const crossCuttingPath = path6.join(
|
|
@@ -2760,7 +2877,7 @@ var init_skill_manager = __esm({
|
|
|
2760
2877
|
SKILLS_DIR_NAME,
|
|
2761
2878
|
skillName
|
|
2762
2879
|
);
|
|
2763
|
-
if (await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "skill.md"))) {
|
|
2880
|
+
if (await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(crossCuttingPath, "SKILL.md"))) {
|
|
2764
2881
|
return crossCuttingPath;
|
|
2765
2882
|
}
|
|
2766
2883
|
return null;
|
|
@@ -2798,9 +2915,15 @@ var init_skill_manager = __esm({
|
|
|
2798
2915
|
if (isProjectType) {
|
|
2799
2916
|
const projectSkills = await this.listSkillsInDirectory(entryPath, entry);
|
|
2800
2917
|
skills.push(...projectSkills);
|
|
2918
|
+
if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
|
|
2919
|
+
skills.push({
|
|
2920
|
+
projectType: entry,
|
|
2921
|
+
skillName: entry,
|
|
2922
|
+
path: entryPath
|
|
2923
|
+
});
|
|
2924
|
+
}
|
|
2801
2925
|
} else {
|
|
2802
|
-
|
|
2803
|
-
if (await FileSystemUtils.fileExists(skillMdPath)) {
|
|
2926
|
+
if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
|
|
2804
2927
|
skills.push({
|
|
2805
2928
|
skillName: entry,
|
|
2806
2929
|
path: entryPath
|
|
@@ -2837,8 +2960,7 @@ var init_skill_manager = __esm({
|
|
|
2837
2960
|
const entryPath = path6.join(dir, entry);
|
|
2838
2961
|
const stats = await FileSystemUtils.stat(entryPath);
|
|
2839
2962
|
if (stats.isDirectory()) {
|
|
2840
|
-
|
|
2841
|
-
if (await FileSystemUtils.fileExists(skillMdPath)) {
|
|
2963
|
+
if (await FileSystemUtils.fileExists(path6.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path6.join(entryPath, "SKILL.md"))) {
|
|
2842
2964
|
skills.push({
|
|
2843
2965
|
projectType,
|
|
2844
2966
|
skillName: entry,
|
|
@@ -3171,17 +3293,7 @@ var init_skill = __esm({
|
|
|
3171
3293
|
}
|
|
3172
3294
|
const isUpdate = await FileSystemUtils.fileExists(destPath);
|
|
3173
3295
|
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}"...`);
|
|
3296
|
+
spinner.info(`Skill "${skillName}" already exists at ${destPath} - updating template files (custom files preserved)...`);
|
|
3185
3297
|
}
|
|
3186
3298
|
await FileSystemUtils.createDirectory(destPath);
|
|
3187
3299
|
const coreTemplatesDir = await getCoreTemplatesDir();
|
|
@@ -3197,6 +3309,10 @@ var init_skill = __esm({
|
|
|
3197
3309
|
return;
|
|
3198
3310
|
}
|
|
3199
3311
|
await FileSystemUtils.copyFile(templateFile, path7.join(destPath, "skill.md"));
|
|
3312
|
+
const upperTemplateFile = path7.join(path7.dirname(templateFile), "SKILL.md");
|
|
3313
|
+
if (await FileSystemUtils.fileExists(upperTemplateFile)) {
|
|
3314
|
+
await FileSystemUtils.copyFile(upperTemplateFile, path7.join(destPath, "SKILL.md"));
|
|
3315
|
+
}
|
|
3200
3316
|
if (templateInfo.viFileName) {
|
|
3201
3317
|
const viFile = path7.join(coreTemplatesDir, templateInfo.viFileName);
|
|
3202
3318
|
if (await FileSystemUtils.fileExists(viFile)) {
|
|
@@ -3252,7 +3368,8 @@ var ProjectTypeSchema = z.enum([
|
|
|
3252
3368
|
"generic-webapp",
|
|
3253
3369
|
"backend-api",
|
|
3254
3370
|
"frontend-app",
|
|
3255
|
-
"multi-stack"
|
|
3371
|
+
"multi-stack",
|
|
3372
|
+
"content-channel"
|
|
3256
3373
|
]);
|
|
3257
3374
|
var SpecMetaSchema = z.object({
|
|
3258
3375
|
projectType: z.union([
|
|
@@ -3340,6 +3457,12 @@ When the user types messages starting with a slash (/), you MUST intercept them
|
|
|
3340
3457
|
## Overview
|
|
3341
3458
|
Describe your project here.
|
|
3342
3459
|
|
|
3460
|
+
## Project Types
|
|
3461
|
+
- List your project type(s) here (e.g., content-channel, node-service, wordpress-plugin, wordpress-theme, perfex-module, laravel-package, generic-webapp, backend-api, frontend-app, multi-stack)
|
|
3462
|
+
|
|
3463
|
+
## Tech Stack
|
|
3464
|
+
- List primary languages, frameworks, runtime, and key libraries
|
|
3465
|
+
|
|
3343
3466
|
## Architecture
|
|
3344
3467
|
Describe the high-level architecture: entry points, module structure, data flow.
|
|
3345
3468
|
|
|
@@ -3415,7 +3538,7 @@ The following commands are classified by risk level. You **MUST NOT** execute th
|
|
|
3415
3538
|
- Existing architecture patterns
|
|
3416
3539
|
- Coding standards
|
|
3417
3540
|
|
|
3418
|
-
> **IGNORE backup files**: Files like
|
|
3541
|
+
> **IGNORE backup files**: Files like \`project.back1.md\`, \`project.back2.md\`, etc. are automatic backups created during \`heraspec init\` updates. NEVER read or reference them unless explicitly asked by the user. Only \`project.md\` is the source of truth.
|
|
3419
3542
|
|
|
3420
3543
|
**Then scaffold:**
|
|
3421
3544
|
- \`heraspec/changes/<slug>/\` - Create proposal.md, tasks.md, design.md (optional)
|
|
@@ -3530,6 +3653,39 @@ The following commands are classified by risk level. You **MUST NOT** execute th
|
|
|
3530
3653
|
- **CRITICAL**: Agent MUST present full report and **wait for user confirmation** before making changes
|
|
3531
3654
|
- Reference guideline numbers (e.g., "Guideline 7: User Tracking Consent")
|
|
3532
3655
|
|
|
3656
|
+
**Special case - Perfex Module Engineering skills:**
|
|
3657
|
+
- Tasks: \`(projectType: perfex-module, skill: module-codebase)\` or \`(projectType: perfex-module, skill: code-quality-guidelines)\` or \`(skill: perfex-module)\`
|
|
3658
|
+
- 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\`
|
|
3659
|
+
- 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\`
|
|
3660
|
+
- Agent MUST adhere to **10 Enterprise Code Quality & Clean Code Standards**:
|
|
3661
|
+
1. **Separation of Concerns (Zero Inline Code)**: 0 inline <script> or <style> blocks in views and documentation HTML.
|
|
3662
|
+
2. **Static Analysis Neutrality**: 0 occurrences of high-risk scanner triggers (inject, seeder, bypass, eval, unserialize).
|
|
3663
|
+
3. **Safe Stylesheet Loading**: Use editor.dom.loadCSS() for TinyMCE/iframes; never inject raw CSS string arrays.
|
|
3664
|
+
4. **Scoped Admin JS**: Enclose scripts in window.addEventListener('load') + strict IIFE.
|
|
3665
|
+
5. **Concurrency & Performance**: Always call session_write_close() at the start of read/search AJAX endpoints.
|
|
3666
|
+
6. **Clean Release Packaging**: Exclude package.json, webpack.config.js, tests/, scratch/, .git in deploy.ps1.
|
|
3667
|
+
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.
|
|
3668
|
+
8. **DOM XSS Prevention (CWE-79)**: Use .textContent, .innerText, or strict HTML escaping helper; purify rich text.
|
|
3669
|
+
9. **100% Multilingual Parity**: 100% labels and messages use _l('key') with zero missing keys across languages.
|
|
3670
|
+
10. **Zero Emojis**: 0 Unicode emojis across custom code, comments, views, documentation, and UI.
|
|
3671
|
+
- 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).
|
|
3672
|
+
|
|
3673
|
+
**Special case - Content & Channel Development skills (projectType: content-channel):**
|
|
3674
|
+
- Tasks: \`(projectType: content-channel, skill: content-strategy)\`, \`(skill: content-scaffolding)\`, \`(skill: content-scripting)\`, \`(skill: content-voice-adapter)\`, \`(skill: content-prompts)\`, \`(skill: content-compliance)\`, \`(skill: content-vault-sync)\`, or \`(skill: content-channel)\`
|
|
3675
|
+
- Install: \`heraspec skill add content-channel\` or \`heraspec skill add <skill-name> --project-type content-channel\`
|
|
3676
|
+
- Agent reads corresponding skill instructions in \`heraspec/skills/<skill-name>/skill.md\` or \`heraspec/skills/content-channel/<skill-name>/skill.md\`.
|
|
3677
|
+
- Agent MUST adhere to **7 Core Content Production Standards**:
|
|
3678
|
+
1. **Golden Naming Rule**: ZERO \`[K\xEAnh]\`, \`[Channel]\`, or \`K\xEAnh:\` prefixes in channel/folder names. 100% pure brand names only.
|
|
3679
|
+
2. **MTxStudio 2-Level Tree Hierarchy**: Every channel must map to standard categories: \`_plan\` (\`type: "docs"\`), \`_posts\` (\`type: "article"\`), \`_prompts\` (\`type: "prompts"\`), \`_music\` (\`type: "music"\`), and optional \`_affiliate\` (\`type: "docs"\`).
|
|
3680
|
+
3. **Strict TTS Acoustic Rules (Natural Flow)**:
|
|
3681
|
+
- Short sentences: 12 - 20 words max per sentence (never exceed 25 words or 120 chars).
|
|
3682
|
+
- Comma clauses: 8 - 12 words max.
|
|
3683
|
+
- Repetition Bug Prevention: Never place 2 reduplicative words (t\u1EEB l\xE1y) adjacently; always separate with a natural comma \`,\`.
|
|
3684
|
+
- Clean text: Zero artificial bracket tags; rely entirely on natural punctuation (\`.\`, \`,\`, \`...\`, \`!\`) and sentence rhythm for voice pacing.
|
|
3685
|
+
4. **Strict Poetry & Verse Formatting**: Never use \`join(' ')\` or combine verses into a single line. EVERY verse line MUST preserve its \`\\n\` newline.
|
|
3686
|
+
5. **Mandatory 3-Position Disclaimer (Decree 15/2020/ND-CP)**: For horror, health, psychological healing, and finance niches, disclaimers are mandatory at: (1) Intro Warning Card 0:00-0:04, (2) Caption Footer / Pinned Comment, (3) Spoken Narration.
|
|
3687
|
+
6. **Safe Vault Sync (Zero SQLite Tampering)**: NEVER write directly to \`mtxstudio.db\`. All channel exports must go through \`Facebook/export_vault_json.py\` to generate sanitized JSON bundles (\`mtxstudio_vault_import.json\`, \`all_channels_bundle.json\`) with UTF-8 encoding and zero en-dash/em-dash characters.
|
|
3688
|
+
7. **Channel Voice Adaptation (Transmutation)**: When repurposing raw texts, always use \`content-voice-adapter\` to de-bias off-brand elements and reframe the message through the designated channel's core philosophy and natural voice style.
|
|
3533
3689
|
|
|
3534
3690
|
- Follow tasks.md
|
|
3535
3691
|
- Mark tasks completed: \`- [x]\`
|
|
@@ -3582,6 +3738,7 @@ Tasks grouped by project type and skill:
|
|
|
3582
3738
|
> heraspec skill add documents"
|
|
3583
3739
|
- **DO NOT** create a task plan or attempt manual generation without the skill language.
|
|
3584
3740
|
3. **Execute After Install**: Only after the skill folder is created (or installed), read the \`skill.md\` and proceed with the task.
|
|
3741
|
+
4. **Ignore Vietnamese Skill Files**: You MUST only read the English \`skill.md\` file inside the skill folder. Completely ignore all \`*.vi.md\` files (e.g., \`skill.vi.md\`), as they are strictly for reference purposes by human developers.
|
|
3585
3742
|
|
|
3586
3743
|
**Example prompt for Documents skill:**
|
|
3587
3744
|
If you need to generate multi-format documentation, use this prompt:
|
|
@@ -3592,6 +3749,42 @@ If you need to generate multi-format documentation, use this prompt:
|
|
|
3592
3749
|
> - Premium Documentation Landing Page (documentations/documentation-landing-page.html)
|
|
3593
3750
|
> - CRITICAL: Save all files in the /documentations directory (create it if missing)."
|
|
3594
3751
|
|
|
3752
|
+
**Example prompts for Content Channel Development (content-channel skills):**
|
|
3753
|
+
- **Channel Strategy (\`content-strategy\`)**:
|
|
3754
|
+
> "S\u1EED d\u1EE5ng skill content-strategy \u0111\u1EC3 l\u1EADp B\u1EA3n K\u1EBF Ho\u1EA1ch 30 Ng\xE0y (plan.md) cho k\xEAnh m\u1EDBi:
|
|
3755
|
+
> - T\xEAn k\xEAnh: [T\xEAn thu\u1EA7n t\xFAy, v\xED d\u1EE5: G\xF3c An Tr\xFA]
|
|
3756
|
+
> - Ng\xE1ch: [V\xED d\u1EE5: Thi\u1EC1n \u0111\u1ECBnh & L\u1ED1i s\u1ED1ng t\u1ED1i gi\u1EA3n]
|
|
3757
|
+
> - Kh\xE1n gi\u1EA3 m\u1EE5c ti\xEAu: [V\xED d\u1EE5: 25 - 40 tu\u1ED5i, nh\xE2n vi\xEAn v\u0103n ph\xF2ng stress]
|
|
3758
|
+
> - Y\xEAu c\u1EA7u: X\xE2y d\u1EF1ng 5 tr\u1EE5 c\u1ED9t n\u1ED9i dung, l\u1ED9 tr\xECnh Cold Start 14 ng\xE0y (70% Reels / 30% In-stream), khung gi\u1EDD v\xE0ng v\xE0 b\u1EA3ng ph\xE2n b\u1ED5 30 b\xE0i vi\u1EBFt chi ti\u1EBFt."
|
|
3759
|
+
|
|
3760
|
+
- **Channel Scaffolding (\`content-scaffolding\`)**:
|
|
3761
|
+
> "S\u1EED d\u1EE5ng skill content-scaffolding \u0111\u1EC3 kh\u1EDFi t\u1EA1o c\u1EA5u tr\xFAc th\u01B0 m\u1EE5c k\xEAnh m\u1EDBi:
|
|
3762
|
+
> - T\xEAn k\xEAnh: [V\xED d\u1EE5: Th\xE2n An T\xE2m L\u1EA1c] | Folder: [Than-An-Tam-Lac]
|
|
3763
|
+
> - Slogan: [V\xED d\u1EE5: Th\xE2n c\xF3 an, t\xE2m m\u1EDBi l\u1EA1c] | Icon Lucide: [Heart] | M\xE0u: [#10b981]
|
|
3764
|
+
> - Y\xEAu c\u1EA7u: Tu\xE2n th\u1EE7 quy t\u1EAFc c\u1EA5m ti\u1EC1n t\u1ED1 [K\xEAnh], t\u1EA1o posts/README.md v\xE0 \u0111\u0103ng k\xFD v\xE0o CHANNELS_CONFIG trong export_vault_json.py."
|
|
3765
|
+
|
|
3766
|
+
- **Raw Text Transmutation (\`content-voice-adapter\`)**:
|
|
3767
|
+
> "S\u1EED d\u1EE5ng skill content-voice-adapter \u0111\u1EC3 chuy\u1EC3n th\u1EC3 \u0111o\u1EA1n v\u0103n b\u1EA3n th\xF4 d\u01B0\u1EDBi \u0111\xE2y th\xE0nh K\u1ECBch b\u1EA3n Video chu\u1EA9n cho k\xEAnh [T\xEAn K\xEAnh] (Th\u1EC3 lo\u1EA1i: [Ch\u1EEFa l\xE0nh / Truy\u1EC7n ma / D\u01B0\u1EE1ng sinh / Chi\xEAm nghi\u1EC7m...]):
|
|
3768
|
+
> [D\xC1N \u0110O\u1EA0N V\u0102N B\u1EA2N TH\xD4 V\xC0O \u0110\xC2Y]
|
|
3769
|
+
> Y\xEAu c\u1EA7u qua 4 b\u01B0\u1EDBc: (1) L\u1ECDc l\u1EC7ch tone theo ma tr\u1EADn th\u1EC3 lo\u1EA1i (ch\u1EEFa l\xE0nh: l\u1ECDc m\xEA t\xEDn/\u0111\u1ED5 l\u1ED7i; truy\u1EC7n ma: l\u1ECDc m\xE1u me/vi ph\u1EA1m N\u0110 15 t\xEAn ng\u01B0\u1EDDi th\u1EADt/c\u1EE3t nh\u1EA3; d\u01B0\u1EE1ng sinh: l\u1ECDc ph\u1EA3n khoa h\u1ECDc/th\u1EA7n th\xE1nh h\xF3a; chi\xEAm nghi\u1EC7m: l\u1ECDc than th\u1EDF n\u1EA1n nh\xE2n), (2) T\xE1i c\u1EA5u tr\xFAc theo DNA tri\u1EBFt l\xFD v\xE0 \u0111\u1EA1i t\u1EEB nh\xE2n x\u01B0ng c\u1EE7a k\xEAnh, (3) T\u1ED1i \u01B0u \xE2m h\u1ECDc TTS 12-20 t\u1EEB/c\xE2u s\u1EA1ch th\u1EBB ngo\u1EB7c vu\xF4ng, (4) \u0110\xF3ng g\xF3i 6 ph\u1EA7n chu\u1EA9n MTxStudio k\xE8m Storyboard prompt, Caption v\xE0 Disclaimer ph\xE1p l\xFD ph\xF9 h\u1EE3p th\u1EC3 lo\u1EA1i."
|
|
3770
|
+
|
|
3771
|
+
- **Scriptwriting from Scratch (\`content-scripting\`)**:
|
|
3772
|
+
> "S\u1EED d\u1EE5ng skill content-scripting \u0111\u1EC3 vi\u1EBFt K\u1ECBch b\u1EA3n T\u1EADp [S\u1ED1 t\u1EADp]: '[Ti\xEAu \u0111\u1EC1]' cho k\xEAnh [T\xEAn K\xEAnh]:
|
|
3773
|
+
> - Tr\u1EE5 c\u1ED9t: [T\xEAn tr\u1EE5 c\u1ED9t n\u1ED9i dung] | \u0110\u1ECBnh d\u1EA1ng: [Video In-stream 16:9 ho\u1EB7c Reels 9:16]
|
|
3774
|
+
> - Y\xEAu c\u1EA7u \xE2m h\u1ECDc TTS: C\xE2u ng\u1EAFn 12-20 t\u1EEB, ng\u1EAFt nh\u1ECBp d\u1EA5u ph\u1EA9y r\xF5 r\xE0ng, kh\xF4ng \u0111i\u1EC7p \xE2m t\u1EEB l\xE1y, TUY\u1EC6T \u0110\u1ED0I KH\xD4NG ch\xE8n th\u1EBB ngo\u1EB7c vu\xF4ng ([l\u1EA5y h\u01A1i], [th\u1EDF d\xE0i]), b\u1EA3o to\xE0n th\u01A1 ca m\u1ED7i c\xE2u 1 d\xF2ng (\\n), xu\u1EA5t \u0111\u1EA7y \u0111\u1EE7 6 ph\u1EA7n k\xE8m Storyboard v\xE0 Caption Facebook."
|
|
3775
|
+
|
|
3776
|
+
- **AI Visual & Suno BGM Prompts (\`content-prompts\`)**:
|
|
3777
|
+
> "S\u1EED d\u1EE5ng skill content-prompts \u0111\u1EC3 t\u1EA1o b\u1ED9 Prompt Visual v\xE0 \xC2m nh\u1EA1c cho k\xEAnh [T\xEAn K\xEAnh]:
|
|
3778
|
+
> - C\u1EA7n t\u1EA1o: Prompt Avatar 1:1, Cover 16:9, B\u1EA3ng 5 Prompts Storyboard b\xE0i vi\u1EBFt '[T\xEAn b\xE0i vi\u1EBFt]', v\xE0 Prompt Suno AI BGM kh\xF4ng l\u1EDDi."
|
|
3779
|
+
|
|
3780
|
+
- **Legal Compliance & Disclaimer (\`content-compliance\`)**:
|
|
3781
|
+
> "S\u1EED d\u1EE5ng skill content-compliance \u0111\u1EC3 ki\u1EC3m duy\u1EC7t k\u1ECBch b\u1EA3n v\xE0 sinh Disclaimer cho video thu\u1ED9c th\u1EC3 lo\u1EA1i [Truy\u1EC7n Ma / D\u01B0\u1EE1ng Sinh / T\xE2m L\xFD / T\xE0i Ch\xEDnh]:
|
|
3782
|
+
> - Cung c\u1EA5p Disclaimer chu\u1EA9n ph\xE1p l\xFD (Ngh\u1ECB \u0111\u1ECBnh 15/2020/N\u0110-CP) \u0111\u1EB7t \u1EDF ch\xE2n Caption.
|
|
3783
|
+
> - Cung c\u1EA5p Prompt m\xE0n h\xECnh c\u1EA3nh b\xE1o Intro Warning Card (0:00 - 0:04, t\u1EF7 l\u1EC7 16:9)."
|
|
3784
|
+
|
|
3785
|
+
- **Vault Synchronization (\`content-vault-sync\`)**:
|
|
3786
|
+
> "S\u1EED d\u1EE5ng skill content-vault-sync \u0111\u1EC3 \u0111\u1ED3ng b\u1ED9 d\u1EEF li\u1EC7u: Ki\u1EC3m tra t\xEDnh to\xE0n v\u1EB9n c\xE1c k\xEAnh trong Facebook/, ch\u1EA1y export_vault_json.py \u0111\u1EC3 t\xE1i xu\u1EA5t mtxstudio_vault_import.json v\xE0 all_channels_bundle.json, b\xE1o c\xE1o s\u1ED1 l\u01B0\u1EE3ng k\xEAnh, danh m\u1EE5c v\xE0 k\u1ECBch b\u1EA3n \u0111\xE3 \u0111\xF3ng g\xF3i th\xE0nh c\xF4ng."
|
|
3787
|
+
|
|
3595
3788
|
**Dynamic Documentation Generation**:
|
|
3596
3789
|
When generating documentation, do NOT simply fill a template. The Agent MUST:
|
|
3597
3790
|
1. **Create** the \`/documentations\` directory if it does not exist.
|
|
@@ -3628,12 +3821,12 @@ Example with multiple skills in one change:
|
|
|
3628
3821
|
|
|
3629
3822
|
## Proactive Memory-Aware Development
|
|
3630
3823
|
|
|
3631
|
-
If
|
|
3824
|
+
If \`heraspec/skills/project-memory/\` exists, the agent MUST proactively use memory to maintain project context. DO NOT wait for the user to prompt you to use memory.
|
|
3632
3825
|
|
|
3633
3826
|
### CRITICAL RULES FOR AUTOMATIC MEMORY USAGE
|
|
3634
|
-
1. **Always Check Context First**: At the beginning of a complex task or when encountering an unfamiliar codebase area, you MUST autonomously run
|
|
3635
|
-
2. **Auto-Log via Archive**: You DO NOT need to run
|
|
3636
|
-
3. **Session Summary**: (Optional) When wrapping up a large session, you can run
|
|
3827
|
+
1. **Always Check Context First**: At the beginning of a complex task or when encountering an unfamiliar codebase area, you MUST autonomously run \`heraspec memory context\` or \`heraspec memory search "keywords"\` BEFORE writing any code.
|
|
3828
|
+
2. **Auto-Log via Archive**: You DO NOT need to run \`heraspec memory log\` manually. Every time you successfully implement a feature and run \`heraspec archive <change-name>\`, the system will automatically read your proposal and log the memory observation under the hood. Just use \`heraspec archive\` as normal!
|
|
3829
|
+
3. **Session Summary**: (Optional) When wrapping up a large session, you can run \`heraspec memory summarize --request "..." --completed "..."\` to compress knowledge, though \`archive\` already auto-logs completed features.
|
|
3637
3830
|
|
|
3638
3831
|
### When to SKIP Memory
|
|
3639
3832
|
- Simple bug fixes, typo corrections, formatting changes
|
|
@@ -3641,10 +3834,10 @@ If \\\`heraspec/skills/project-memory/\\\` exists, the agent MUST proactively us
|
|
|
3641
3834
|
- When doing what the agent's built-in context already covers
|
|
3642
3835
|
|
|
3643
3836
|
### Smart Code Exploration
|
|
3644
|
-
If
|
|
3645
|
-
-
|
|
3646
|
-
-
|
|
3647
|
-
-
|
|
3837
|
+
If \`heraspec/skills/smart-explore/\` exists, prefer token-efficient exploration:
|
|
3838
|
+
- \`heraspec explore outline <file>\` \u2192 View structure (~1K tokens vs ~12K full file)
|
|
3839
|
+
- \`heraspec explore search "<query>" <path>\` \u2192 Find symbols across codebase
|
|
3840
|
+
- \`heraspec explore unfold <file> <symbol>\` \u2192 Read just one function
|
|
3648
3841
|
`;
|
|
3649
3842
|
}
|
|
3650
3843
|
static getSkillsSection() {
|
|
@@ -3765,6 +3958,7 @@ var InitCommand = class {
|
|
|
3765
3958
|
await this.updateInstalledSkills(heraspecPath);
|
|
3766
3959
|
}
|
|
3767
3960
|
await this.checkAndBootstrapMemory(heraspecPath, resolvedPath, spinner);
|
|
3961
|
+
await this.checkAndBootstrapContentChannel(heraspecPath, resolvedPath, spinner);
|
|
3768
3962
|
await this.updateRelatedMarkdownFiles(resolvedPath);
|
|
3769
3963
|
spinner.stop();
|
|
3770
3964
|
try {
|
|
@@ -4187,36 +4381,78 @@ ${section.content.trimEnd()}`);
|
|
|
4187
4381
|
}
|
|
4188
4382
|
return null;
|
|
4189
4383
|
}
|
|
4384
|
+
/**
|
|
4385
|
+
* Refactor legacy installed skills if new standards or companion skills were added to HeraSpec.
|
|
4386
|
+
* Ensures backward compatibility and non-destructive enhancement for existing projects.
|
|
4387
|
+
*/
|
|
4388
|
+
async refactorLegacySkills(skillsDir, coreTemplatesDir) {
|
|
4389
|
+
const perfexSkillDir = path8.join(skillsDir, "perfex-module");
|
|
4390
|
+
if (await FileSystemUtils.fileExists(perfexSkillDir)) {
|
|
4391
|
+
const rootSkillMd = path8.join(perfexSkillDir, "skill.md");
|
|
4392
|
+
const rootSkillUpperMd = path8.join(perfexSkillDir, "SKILL.md");
|
|
4393
|
+
const templateRootSkill = path8.join(coreTemplatesDir, "perfex-module", "skill.md");
|
|
4394
|
+
const templateRootUpper = path8.join(coreTemplatesDir, "perfex-module", "SKILL.md");
|
|
4395
|
+
if (!await FileSystemUtils.fileExists(rootSkillMd) && await FileSystemUtils.fileExists(templateRootSkill)) {
|
|
4396
|
+
await FileSystemUtils.copyFile(templateRootSkill, rootSkillMd);
|
|
4397
|
+
}
|
|
4398
|
+
if (!await FileSystemUtils.fileExists(rootSkillUpperMd) && await FileSystemUtils.fileExists(templateRootUpper)) {
|
|
4399
|
+
await FileSystemUtils.copyFile(templateRootUpper, rootSkillUpperMd);
|
|
4400
|
+
}
|
|
4401
|
+
const qualityGuidelinesDir = path8.join(perfexSkillDir, "code-quality-guidelines");
|
|
4402
|
+
const templateQualityDir = path8.join(coreTemplatesDir, "perfex-module", "code-quality-guidelines");
|
|
4403
|
+
if (!await FileSystemUtils.fileExists(qualityGuidelinesDir) && await FileSystemUtils.fileExists(templateQualityDir)) {
|
|
4404
|
+
console.log(chalk2.cyan(" \u2713 Refactored perfex-module: added code-quality-guidelines skill"));
|
|
4405
|
+
await FileSystemUtils.copyDirectory(templateQualityDir, qualityGuidelinesDir);
|
|
4406
|
+
}
|
|
4407
|
+
const codebaseDir = path8.join(perfexSkillDir, "module-codebase");
|
|
4408
|
+
const templateCodebaseDir = path8.join(coreTemplatesDir, "perfex-module", "module-codebase");
|
|
4409
|
+
if (await FileSystemUtils.fileExists(codebaseDir) && await FileSystemUtils.fileExists(templateCodebaseDir)) {
|
|
4410
|
+
await FileSystemUtils.copyDirectory(templateCodebaseDir, codebaseDir);
|
|
4411
|
+
}
|
|
4412
|
+
}
|
|
4413
|
+
}
|
|
4190
4414
|
/**
|
|
4191
4415
|
* Update installed built-in skills on re-init.
|
|
4192
4416
|
*
|
|
4193
4417
|
* Rules:
|
|
4194
4418
|
* - Only update skills that exist in SKILL_TEMPLATE_MAP (built-in / known skills)
|
|
4195
4419
|
* - Skip skills NOT in the template map (custom skills added by the project)
|
|
4420
|
+
* - Strictly preserve custom project skills: NEVER delete or overwrite them
|
|
4196
4421
|
* - For each matching skill: update skill.md + re-copy resourceDirs from template
|
|
4197
|
-
*
|
|
4422
|
+
* safely preserving any user files in templates/, scripts/, examples/ sub-folders
|
|
4198
4423
|
*/
|
|
4199
4424
|
async updateInstalledSkills(heraspecPath) {
|
|
4200
4425
|
const skillsDir = path8.join(heraspecPath, SKILLS_DIR_NAME);
|
|
4201
4426
|
if (!await FileSystemUtils.fileExists(skillsDir)) return;
|
|
4202
4427
|
const coreTemplatesDir = await this.getCoreTemplatesDir();
|
|
4203
4428
|
if (!coreTemplatesDir) return;
|
|
4429
|
+
await this.refactorLegacySkills(skillsDir, coreTemplatesDir);
|
|
4204
4430
|
const allTemplates = getAllSkillTemplates();
|
|
4205
4431
|
let updatedCount = 0;
|
|
4206
|
-
|
|
4432
|
+
const preservedSkills = [];
|
|
4207
4433
|
const installedSkillPaths = await this.collectInstalledSkillPaths(skillsDir);
|
|
4208
4434
|
for (const { skillPath, skillName, projectType } of installedSkillPaths) {
|
|
4209
4435
|
const templateInfo = getSkillTemplateInfo(skillName, projectType);
|
|
4210
4436
|
if (!templateInfo) {
|
|
4211
|
-
|
|
4437
|
+
const displayName = projectType ? `${projectType}/${skillName}` : skillName;
|
|
4438
|
+
if (!preservedSkills.includes(displayName)) {
|
|
4439
|
+
preservedSkills.push(displayName);
|
|
4440
|
+
}
|
|
4212
4441
|
continue;
|
|
4213
4442
|
}
|
|
4214
4443
|
const templateFile = path8.join(coreTemplatesDir, templateInfo.templateFileName);
|
|
4215
4444
|
if (!await FileSystemUtils.fileExists(templateFile)) {
|
|
4216
|
-
|
|
4445
|
+
const displayName = projectType ? `${projectType}/${skillName}` : skillName;
|
|
4446
|
+
if (!preservedSkills.includes(displayName)) {
|
|
4447
|
+
preservedSkills.push(displayName);
|
|
4448
|
+
}
|
|
4217
4449
|
continue;
|
|
4218
4450
|
}
|
|
4219
4451
|
await FileSystemUtils.copyFile(templateFile, path8.join(skillPath, "skill.md"));
|
|
4452
|
+
const upperTemplateFile = path8.join(path8.dirname(templateFile), "SKILL.md");
|
|
4453
|
+
if (await FileSystemUtils.fileExists(upperTemplateFile)) {
|
|
4454
|
+
await FileSystemUtils.copyFile(upperTemplateFile, path8.join(skillPath, "SKILL.md"));
|
|
4455
|
+
}
|
|
4220
4456
|
if (templateInfo.viFileName) {
|
|
4221
4457
|
const viFile = path8.join(coreTemplatesDir, templateInfo.viFileName);
|
|
4222
4458
|
if (await FileSystemUtils.fileExists(viFile)) {
|
|
@@ -4228,9 +4464,6 @@ ${section.content.trimEnd()}`);
|
|
|
4228
4464
|
const srcResourceDir = path8.join(coreTemplatesDir, resourceDir);
|
|
4229
4465
|
const destResourceDir = path8.join(skillPath, path8.basename(resourceDir));
|
|
4230
4466
|
if (await FileSystemUtils.fileExists(srcResourceDir)) {
|
|
4231
|
-
if (await FileSystemUtils.fileExists(destResourceDir)) {
|
|
4232
|
-
await FileSystemUtils.removeDirectory(destResourceDir, true);
|
|
4233
|
-
}
|
|
4234
4467
|
await FileSystemUtils.copyDirectory(srcResourceDir, destResourceDir);
|
|
4235
4468
|
}
|
|
4236
4469
|
}
|
|
@@ -4241,7 +4474,13 @@ ${section.content.trimEnd()}`);
|
|
|
4241
4474
|
updatedCount++;
|
|
4242
4475
|
}
|
|
4243
4476
|
if (updatedCount > 0) {
|
|
4244
|
-
console.log(chalk2.gray(` \u2713 Updated ${updatedCount} built-in skill(s)
|
|
4477
|
+
console.log(chalk2.gray(` \u2713 Updated ${updatedCount} built-in skill(s)`));
|
|
4478
|
+
}
|
|
4479
|
+
if (preservedSkills.length > 0) {
|
|
4480
|
+
console.log(chalk2.green(` \u2713 Preserved ${preservedSkills.length} custom project skill(s) (never deleted or overwritten):`));
|
|
4481
|
+
for (const skill of preservedSkills) {
|
|
4482
|
+
console.log(chalk2.gray(` \u2022 ${skill}`));
|
|
4483
|
+
}
|
|
4245
4484
|
}
|
|
4246
4485
|
}
|
|
4247
4486
|
/**
|
|
@@ -4260,23 +4499,29 @@ ${section.content.trimEnd()}`);
|
|
|
4260
4499
|
"generic-webapp",
|
|
4261
4500
|
"backend-api",
|
|
4262
4501
|
"frontend-app",
|
|
4263
|
-
"multi-stack"
|
|
4502
|
+
"multi-stack",
|
|
4503
|
+
"content-channel"
|
|
4264
4504
|
];
|
|
4265
4505
|
for (const entry of entries) {
|
|
4506
|
+
if (entry === "README.md" || entry === "UI_UX_SKILL_QUICK_REFERENCE.md") continue;
|
|
4266
4507
|
const entryPath = path8.join(skillsDir, entry);
|
|
4267
4508
|
const stats = await FileSystemUtils.stat(entryPath);
|
|
4268
4509
|
if (!stats.isDirectory()) continue;
|
|
4269
4510
|
if (knownProjectTypes.includes(entry)) {
|
|
4270
4511
|
const subEntries = await FileSystemUtils.readDirectory(entryPath);
|
|
4271
4512
|
for (const sub of subEntries) {
|
|
4513
|
+
if (["templates", "scripts", "examples", "data", "knowledge", "tests", "docs"].includes(sub)) continue;
|
|
4272
4514
|
const subPath = path8.join(entryPath, sub);
|
|
4273
4515
|
const subStats = await FileSystemUtils.stat(subPath);
|
|
4274
|
-
if (subStats.isDirectory()
|
|
4516
|
+
if (subStats.isDirectory()) {
|
|
4275
4517
|
result.push({ skillPath: subPath, skillName: sub, projectType: entry });
|
|
4276
4518
|
}
|
|
4277
4519
|
}
|
|
4520
|
+
if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path8.join(entryPath, "SKILL.md"))) {
|
|
4521
|
+
result.push({ skillPath: entryPath, skillName: entry, projectType: entry });
|
|
4522
|
+
}
|
|
4278
4523
|
} else {
|
|
4279
|
-
if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md"))) {
|
|
4524
|
+
if (await FileSystemUtils.fileExists(path8.join(entryPath, "skill.md")) || await FileSystemUtils.fileExists(path8.join(entryPath, "SKILL.md"))) {
|
|
4280
4525
|
result.push({ skillPath: entryPath, skillName: entry });
|
|
4281
4526
|
}
|
|
4282
4527
|
}
|
|
@@ -4349,6 +4594,70 @@ ${section.content.trimEnd()}`);
|
|
|
4349
4594
|
}
|
|
4350
4595
|
spinner.start();
|
|
4351
4596
|
}
|
|
4597
|
+
/**
|
|
4598
|
+
* Automatically install content-channel skills if project type is content-channel
|
|
4599
|
+
*/
|
|
4600
|
+
async checkAndBootstrapContentChannel(heraspecPath, projectPath, spinner) {
|
|
4601
|
+
const configPath = path8.join(heraspecPath, HERASPEC_MARKERS.CONFIG_YAML);
|
|
4602
|
+
const projectMdPath = path8.join(heraspecPath, HERASPEC_MARKERS.PROJECT_MD);
|
|
4603
|
+
let isContentChannel = false;
|
|
4604
|
+
if (await FileSystemUtils.fileExists(configPath)) {
|
|
4605
|
+
const configContent = await FileSystemUtils.readFile(configPath);
|
|
4606
|
+
if (/\bprojectType:\s*["']?content-channel["']?/i.test(configContent)) {
|
|
4607
|
+
isContentChannel = true;
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4610
|
+
if (!isContentChannel && await FileSystemUtils.fileExists(projectMdPath)) {
|
|
4611
|
+
const projectContent = await FileSystemUtils.readFile(projectMdPath);
|
|
4612
|
+
if (/##\s*Project Types\s*\n\s*-\s*content-channel\b/i.test(projectContent)) {
|
|
4613
|
+
isContentChannel = true;
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4616
|
+
if (!isContentChannel) {
|
|
4617
|
+
const hasFacebook = await FileSystemUtils.fileExists(path8.join(projectPath, "Facebook"));
|
|
4618
|
+
const hasPosts = await FileSystemUtils.fileExists(path8.join(projectPath, "posts"));
|
|
4619
|
+
const hasPrompts = await FileSystemUtils.fileExists(path8.join(projectPath, "prompts"));
|
|
4620
|
+
if (hasFacebook || hasPosts && hasPrompts) {
|
|
4621
|
+
isContentChannel = true;
|
|
4622
|
+
}
|
|
4623
|
+
}
|
|
4624
|
+
if (isContentChannel) {
|
|
4625
|
+
const channelSkills = [
|
|
4626
|
+
"content-strategy",
|
|
4627
|
+
"content-scaffolding",
|
|
4628
|
+
"content-scripting",
|
|
4629
|
+
"content-voice-adapter",
|
|
4630
|
+
"content-prompts",
|
|
4631
|
+
"content-compliance",
|
|
4632
|
+
"content-vault-sync"
|
|
4633
|
+
];
|
|
4634
|
+
const skillsDir = path8.join(heraspecPath, SKILLS_DIR_NAME);
|
|
4635
|
+
const missingSkills = [];
|
|
4636
|
+
for (const skillName of channelSkills) {
|
|
4637
|
+
const flatPath = path8.join(skillsDir, skillName);
|
|
4638
|
+
const scopedPath = path8.join(skillsDir, "content-channel", skillName);
|
|
4639
|
+
if (!await FileSystemUtils.fileExists(flatPath) && !await FileSystemUtils.fileExists(scopedPath)) {
|
|
4640
|
+
missingSkills.push(skillName);
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
if (missingSkills.length > 0) {
|
|
4644
|
+
spinner.stop();
|
|
4645
|
+
console.log(chalk2.cyan(`
|
|
4646
|
+
\u{1F3AC} Detected content-channel project. Installing ${missingSkills.length} channel skill(s)...`));
|
|
4647
|
+
try {
|
|
4648
|
+
const { SkillCommand: SkillCommand2 } = await Promise.resolve().then(() => (init_skill(), skill_exports));
|
|
4649
|
+
const skillCommand = new SkillCommand2();
|
|
4650
|
+
for (const skillName of missingSkills) {
|
|
4651
|
+
await skillCommand.add(skillName, void 0, projectPath);
|
|
4652
|
+
}
|
|
4653
|
+
console.log(chalk2.green(`\u2713 Channel skills suite ready for production.
|
|
4654
|
+
`));
|
|
4655
|
+
} catch (err) {
|
|
4656
|
+
}
|
|
4657
|
+
spinner.start();
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4352
4661
|
/**
|
|
4353
4662
|
* Get the knowledge source directory from CLI package
|
|
4354
4663
|
*/
|
|
@@ -4801,7 +5110,7 @@ After copying UI/UX skill to your project, see:
|
|
|
4801
5110
|
return `<!-- HeraSpec Section -->
|
|
4802
5111
|
## HeraSpec Development
|
|
4803
5112
|
|
|
4804
|
-
This project uses [HeraSpec](https://github.com/
|
|
5113
|
+
This project uses [HeraSpec](https://github.com/PolyXGO/HeraSpec) for spec-driven development.
|
|
4805
5114
|
|
|
4806
5115
|
### Quick Start
|
|
4807
5116
|
|
|
@@ -4850,7 +5159,7 @@ heraspec skill add unit-test
|
|
|
4850
5159
|
heraspec skill show ui-ux
|
|
4851
5160
|
\`\`\`
|
|
4852
5161
|
|
|
4853
|
-
For more information, see the [HeraSpec documentation](https://github.com/
|
|
5162
|
+
For more information, see the [HeraSpec documentation](https://github.com/PolyXGO/HeraSpec#readme).
|
|
4854
5163
|
|
|
4855
5164
|
---
|
|
4856
5165
|
|
|
@@ -5476,19 +5785,31 @@ var Validator = class {
|
|
|
5476
5785
|
const spec = parser.parseSpec(specName);
|
|
5477
5786
|
const result = SpecSchema.safeParse(spec);
|
|
5478
5787
|
if (!result.success) {
|
|
5479
|
-
result.error.
|
|
5480
|
-
errors.push(
|
|
5788
|
+
result.error.issues.forEach((err) => {
|
|
5789
|
+
errors.push({
|
|
5790
|
+
message: `${err.path.join(".")}: ${err.message}`,
|
|
5791
|
+
autoFixable: false
|
|
5792
|
+
});
|
|
5481
5793
|
});
|
|
5482
5794
|
}
|
|
5483
5795
|
if (spec.requirements.length === 0) {
|
|
5484
|
-
errors.push(
|
|
5796
|
+
errors.push({
|
|
5797
|
+
message: "Spec must have at least one requirement",
|
|
5798
|
+
autoFixable: false
|
|
5799
|
+
});
|
|
5485
5800
|
}
|
|
5486
5801
|
for (const req of spec.requirements) {
|
|
5487
5802
|
if (!req.description || req.description.trim().length === 0) {
|
|
5488
|
-
errors.push(
|
|
5803
|
+
errors.push({
|
|
5804
|
+
message: `Requirement "${req.name}" must have a description`,
|
|
5805
|
+
autoFixable: false
|
|
5806
|
+
});
|
|
5489
5807
|
}
|
|
5490
5808
|
if (!req.scenarios || req.scenarios.length === 0) {
|
|
5491
|
-
warnings.push(
|
|
5809
|
+
warnings.push({
|
|
5810
|
+
message: `Requirement "${req.name}" has no scenarios`,
|
|
5811
|
+
autoFixable: false
|
|
5812
|
+
});
|
|
5492
5813
|
}
|
|
5493
5814
|
}
|
|
5494
5815
|
return {
|
|
@@ -5499,7 +5820,10 @@ var Validator = class {
|
|
|
5499
5820
|
} catch (error) {
|
|
5500
5821
|
return {
|
|
5501
5822
|
valid: false,
|
|
5502
|
-
errors: [
|
|
5823
|
+
errors: [{
|
|
5824
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
5825
|
+
autoFixable: false
|
|
5826
|
+
}],
|
|
5503
5827
|
warnings: []
|
|
5504
5828
|
};
|
|
5505
5829
|
}
|
|
@@ -5666,6 +5990,15 @@ var Validator = class {
|
|
|
5666
5990
|
const match = content.match(reqRegex);
|
|
5667
5991
|
return match ? match[0].trim() : null;
|
|
5668
5992
|
}
|
|
5993
|
+
getParseErrorSuggestion(errorMessage) {
|
|
5994
|
+
if (errorMessage.includes("YAML") || errorMessage.includes("frontmatter")) {
|
|
5995
|
+
return "Check the YAML frontmatter syntax at the top of the file.";
|
|
5996
|
+
}
|
|
5997
|
+
if (errorMessage.includes("header") || errorMessage.includes("heading")) {
|
|
5998
|
+
return "Ensure headers follow markdown format (# Title, ## Section).";
|
|
5999
|
+
}
|
|
6000
|
+
return void 0;
|
|
6001
|
+
}
|
|
5669
6002
|
};
|
|
5670
6003
|
export {
|
|
5671
6004
|
ARCHIVES_DIR_NAME,
|