heraspec 0.1.4 → 0.1.5
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/bin/heraspec.js +183 -194
- package/bin/heraspec.js.map +2 -2
- package/dist/core/templates/skills/documents/templates/documentation-landing-page.html +6 -0
- package/dist/core/templates/skills/documents/templates/documentation.html +8 -0
- package/dist/core/templates/skills/documents-skill.md +66 -38
- package/dist/index.js +148 -182
- package/package.json +1 -1
package/bin/heraspec.js
CHANGED
|
@@ -81,7 +81,9 @@ var FileSystemUtils = class {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// src/core/templates/index.ts
|
|
84
|
-
var
|
|
84
|
+
var TemplateManager = class {
|
|
85
|
+
static getProjectTemplate() {
|
|
86
|
+
return `# HeraSpec Project
|
|
85
87
|
|
|
86
88
|
## Overview
|
|
87
89
|
Describe your project here.
|
|
@@ -102,12 +104,22 @@ List your technologies here (e.g., PHP 8.1, WordPress 6.0, Laravel 10, etc.)
|
|
|
102
104
|
|
|
103
105
|
## Conventions
|
|
104
106
|
Define coding standards, architectural patterns, and conventions to follow.
|
|
105
|
-
|
|
106
107
|
`;
|
|
107
|
-
|
|
108
|
+
}
|
|
109
|
+
static getAgentsTemplate() {
|
|
110
|
+
return `# HeraSpec \u2014 AI Agent Instructions
|
|
108
111
|
|
|
109
112
|
This document defines the workflow for AI agents working with HeraSpec.
|
|
110
113
|
|
|
114
|
+
## Universal Safety Rules
|
|
115
|
+
|
|
116
|
+
- **NO AUTO-COMMIT**: Agent MUST NOT perform \`git commit\` or \`git push\` autonomously. This task is reserved for the User unless explicitly ordered.
|
|
117
|
+
- **NO AUTO-PUBLISH**: Agent MUST NOT perform \`npm publish\` or trigger automated releases/deployments autonomously.
|
|
118
|
+
- **SKILL PREREQUISITE**: If a task maps to a skill (e.g., "Generate documentation"), you **MUST** verify the skill folder exists in \`heraspec/skills/\`. If missing:
|
|
119
|
+
- **Preferred**: Proactively install it via \`heraspec skill add <name>\` (e.g., \`heraspec skill add documents\`) if you have terminal access.
|
|
120
|
+
- **Fallback**: If you cannot install it, **STOP** and ask the user to add it. **DO NOT** attempt manual generation without the skill.
|
|
121
|
+
- **USER CONFIRMATION**: For destructive actions or public releases, always request explicit User approval first.
|
|
122
|
+
|
|
111
123
|
## Core Workflow
|
|
112
124
|
|
|
113
125
|
### Step 1 \u2014 Create a Change
|
|
@@ -176,11 +188,11 @@ This document defines the workflow for AI agents working with HeraSpec.
|
|
|
176
188
|
- Task: \`(skill: ui-ux)\`
|
|
177
189
|
- Agent reads: \`heraspec/skills/ui-ux/skill.md\`
|
|
178
190
|
- Agent MUST use search scripts before implementing:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
191
|
+
\`\`\`bash
|
|
192
|
+
# Search for design intelligence
|
|
193
|
+
python3 heraspec/skills/ui-ux/scripts/search.py "<keyword>" --domain <domain>
|
|
194
|
+
python3 heraspec/skills/ui-ux/scripts/search.py "<keyword>" --stack <stack>
|
|
195
|
+
\`\`\`
|
|
184
196
|
- Agent synthesizes search results
|
|
185
197
|
- Agent implements with proper colors, fonts, styles from search results
|
|
186
198
|
- Agent verifies with pre-delivery checklist
|
|
@@ -225,23 +237,39 @@ Tasks grouped by project type and skill:
|
|
|
225
237
|
|
|
226
238
|
## Skills System
|
|
227
239
|
|
|
228
|
-
**CRITICAL:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
**CRITICAL: Mandatory Prerequisite Check**
|
|
241
|
+
|
|
242
|
+
1. **Stop & Verify**: If you are asked to implement a task requiring a skill (e.g., "Generate documentation...", "Create UI/UX...", etc.), you MUST first check if the skill folder exists in \`heraspec/skills/\`.
|
|
243
|
+
2. **Missing Skill = AUTO-INSTALL OR STOP**: If the skill folder does NOT exist:
|
|
244
|
+
- **Option A (Preferred)**: If you can run commands, execute \`heraspec skill add <skill-name>\` immediately.
|
|
245
|
+
- **Option B (Fallback)**: If you cannot run commands, **STOP** and ask the user to run it.
|
|
246
|
+
> "Tip: Add the 'documents' skill for premium HTML & Landing Page support:
|
|
247
|
+
> heraspec skill add documents"
|
|
248
|
+
- **DO NOT** create a task plan or attempt manual generation without the skill language.
|
|
249
|
+
3. **Execute After Install**: Only after the skill folder is created (or installed), read the \`skill.md\` and proceed with the task.
|
|
250
|
+
|
|
251
|
+
**Example prompt for Documents skill:**
|
|
252
|
+
If you need to generate multi-format documentation, use this prompt:
|
|
253
|
+
> "Generate documentation with skill documents for [project-name]. Include:
|
|
254
|
+
> - Concise overview (documentations/documentation.txt)
|
|
255
|
+
> - Technical Markdown (documentations/documentation.md)
|
|
256
|
+
> - Interactive HTML (documentations/documentation.html)
|
|
257
|
+
> - Premium Documentation Landing Page (documentations/documentation-landing-page.html)
|
|
258
|
+
> - CRITICAL: Save all files in the /documentations directory (create it if missing)."
|
|
259
|
+
|
|
260
|
+
**Dynamic Documentation Generation**:
|
|
261
|
+
When generating documentation, do NOT simply fill a template. The Agent MUST:
|
|
262
|
+
1. **Create** the \`/documentations\` directory if it does not exist.
|
|
263
|
+
2. **Design** a custom layout and content structure suitable for the project type.
|
|
264
|
+
3. **Synchronize** with the \`ui-ux\` skill for premium visual design (colors, typography, animations).
|
|
265
|
+
4. **Scan All Specs**: If project-wide, read \`heraspec/project.md\` and all files in \`heraspec/specs/\` to synthesize the content.
|
|
266
|
+
|
|
267
|
+
### Skill Discovery & Usage
|
|
241
268
|
|
|
242
269
|
- List all skills: Check \`heraspec/skills/\` directory
|
|
243
270
|
- Project-specific skills: \`heraspec/skills/<project-type>/\`
|
|
244
271
|
- Cross-cutting skills: \`heraspec/skills/<skill-name>/\` (root level)
|
|
272
|
+
- **Consistency**: Follow the step-by-step process in the skill's \`skill.md\`.
|
|
245
273
|
|
|
246
274
|
### When Change Has Multiple Skills
|
|
247
275
|
|
|
@@ -249,7 +277,7 @@ Tasks grouped by project type and skill:
|
|
|
249
277
|
|
|
250
278
|
Example with multiple skills in one change:
|
|
251
279
|
\`\`\`
|
|
252
|
-
## 1.
|
|
280
|
+
## 1. WordPress module \u2013 Feature (skill: admin-settings-page)
|
|
253
281
|
- [ ] Task 1.1 Create module structure
|
|
254
282
|
- [ ] Task 1.2 Configure registration
|
|
255
283
|
|
|
@@ -261,89 +289,45 @@ Example with multiple skills in one change:
|
|
|
261
289
|
- [ ] Task 3.1 Write technical docs
|
|
262
290
|
\`\`\`
|
|
263
291
|
|
|
264
|
-
**Agent workflow:**
|
|
265
|
-
1. **For task group 1** (module-codebase):
|
|
266
|
-
- Read: \`heraspec/skills/perfex-module/module-codebase/skill.md\`
|
|
267
|
-
- Follow: Module codebase process
|
|
268
|
-
- Use: Module codebase templates/scripts
|
|
269
|
-
- Implement: Tasks 1.1, 1.2
|
|
270
|
-
|
|
271
|
-
2. **For task group 2** (ui-ux):
|
|
272
|
-
- Read: \`heraspec/skills/ui-ux/skill.md\`
|
|
273
|
-
- Follow: UI/UX process
|
|
274
|
-
- Use: UI/UX templates/scripts
|
|
275
|
-
- Implement: Tasks 2.1, 2.2
|
|
276
|
-
|
|
277
|
-
3. **For task group 3** (documents):
|
|
278
|
-
- Read: \`heraspec/skills/documents/skill.md\`
|
|
279
|
-
- Follow: Documents process
|
|
280
|
-
- Use: Documents templates/scripts
|
|
281
|
-
- Implement: Task 3.1
|
|
282
|
-
|
|
283
292
|
**Key rule**: Switch skill.md when switching task groups!
|
|
284
|
-
|
|
285
|
-
## Rules
|
|
286
|
-
|
|
287
|
-
1. **Specs first, tasks second, implementation last.**
|
|
288
|
-
2. **Always use Skills**: When task has skill tag, MUST read and follow skill.md
|
|
289
|
-
3. Never modify source-of-truth specs directly.
|
|
290
|
-
4. Delta specs go in \`heraspec/specs/<slug>/\` (NOT in changes folder).
|
|
291
|
-
5. Always wait for approval before implementation.
|
|
292
|
-
6. **One skill per task group**: Each task group should use one skill consistently.
|
|
293
|
-
|
|
294
293
|
`;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
- Agent reads: \`heraspec/skills/perfex-module/module-codebase/skill.md\`
|
|
328
|
-
- Agent follows: Steps, uses templates, runs scripts
|
|
329
|
-
- Agent implements: According to skill.md guidelines
|
|
330
|
-
|
|
331
|
-
- Agent implements with proper colors, fonts, styles from search results
|
|
332
|
-
- Agent verifies with pre-delivery checklist
|
|
333
|
-
|
|
334
|
-
**Special case - Flatsome UX Element skill:**
|
|
335
|
-
- Task: \`(projectType: wordpress, skill: ux-element)\`
|
|
336
|
-
- Agent reads: \`heraspec/skills/wordpress/ux-element/skill.md\`
|
|
337
|
-
- Agent MUST follow the **Wrapping Rule**: Use \`<span>\` with \`id="{{:: shortcode.$id }}"\`
|
|
338
|
-
- Agent uses templates from \`heraspec/skills/wordpress/ux-element/templates/\` (Controller, Shortcode, HTML Template, SVG Thumbnail)
|
|
339
|
-
- Agent ensures real-time preview support in AngularJS template.
|
|
340
|
-
- **Variable Translation**: Variables with underscores in PHP (e.g., \`bg_color\`) MUST be accessed via camelCase in AngularJS (e.g., \`shortcode.options.bgColor\`).
|
|
341
|
-
|
|
342
|
-
### Skill Discovery
|
|
294
|
+
}
|
|
295
|
+
static getSkillsSection() {
|
|
296
|
+
return `## Skills System
|
|
297
|
+
|
|
298
|
+
**CRITICAL: Mandatory Prerequisite Check**
|
|
299
|
+
|
|
300
|
+
1. **Stop & Verify**: If you are asked to implement a task requiring a skill (e.g., "Generate documentation...", "Create UI/UX...", etc.), you MUST first check if the skill folder exists in \`heraspec/skills/\`.
|
|
301
|
+
2. **Missing Skill = AUTO-INSTALL OR STOP**: If the skill folder does NOT exist:
|
|
302
|
+
- **Option A (Preferred)**: If you can run commands, execute \`heraspec skill add <skill-name>\` immediately.
|
|
303
|
+
- **Option B (Fallback)**: If you cannot run commands, **STOP** and ask the user to run it.
|
|
304
|
+
> "Tip: Add the 'documents' skill for premium HTML & Landing Page support:
|
|
305
|
+
> heraspec skill add documents"
|
|
306
|
+
- **DO NOT** create a task plan or attempt manual generation without the skill language.
|
|
307
|
+
3. **Execute After Install**: Only after the skill folder is created (or installed), read the \`skill.md\` and proceed with the task.
|
|
308
|
+
|
|
309
|
+
**Example prompt for Documents skill:**
|
|
310
|
+
If you need to generate multi-format documentation, use this prompt:
|
|
311
|
+
> "Generate documentation with skill documents for [project-name]. Include:
|
|
312
|
+
> - Concise overview (documentations/documentation.txt)
|
|
313
|
+
> - Technical Markdown (documentations/documentation.md)
|
|
314
|
+
> - Interactive HTML (documentations/documentation.html)
|
|
315
|
+
> - Premium Documentation Landing Page (documentations/documentation-landing-page.html)
|
|
316
|
+
> - CRITICAL: Save all files in the /documentations directory (create it if missing)."
|
|
317
|
+
|
|
318
|
+
**Dynamic Documentation Generation**:
|
|
319
|
+
When generating documentation, do NOT simply fill a template. The Agent MUST:
|
|
320
|
+
1. **Create** the \`/documentations\` directory if it does not exist.
|
|
321
|
+
2. **Design** a custom layout and content structure suitable for the project type.
|
|
322
|
+
3. **Synchronize** with the \`ui-ux\` skill for premium visual design (colors, typography, animations).
|
|
323
|
+
4. **Scan All Specs**: If project-wide, read \`heraspec/project.md\` and all files in \`heraspec/specs/\` to synthesize the content.
|
|
324
|
+
|
|
325
|
+
### Skill Discovery & Usage
|
|
343
326
|
|
|
344
327
|
- List all skills: Check \`heraspec/skills/\` directory
|
|
345
328
|
- Project-specific skills: \`heraspec/skills/<project-type>/\`
|
|
346
329
|
- Cross-cutting skills: \`heraspec/skills/<skill-name>/\` (root level)
|
|
330
|
+
- **Consistency**: Follow the step-by-step process in the skill's \`skill.md\`.
|
|
347
331
|
|
|
348
332
|
### When Change Has Multiple Skills
|
|
349
333
|
|
|
@@ -351,7 +335,7 @@ var SKILLS_SECTION_TEMPLATE = `## Skills System
|
|
|
351
335
|
|
|
352
336
|
Example with multiple skills in one change:
|
|
353
337
|
\`\`\`
|
|
354
|
-
## 1.
|
|
338
|
+
## 1. WordPress module \u2013 Feature (skill: admin-settings-page)
|
|
355
339
|
- [ ] Task 1.1 Create module structure
|
|
356
340
|
- [ ] Task 1.2 Configure registration
|
|
357
341
|
|
|
@@ -363,80 +347,15 @@ Example with multiple skills in one change:
|
|
|
363
347
|
- [ ] Task 3.1 Write technical docs
|
|
364
348
|
\`\`\`
|
|
365
349
|
|
|
366
|
-
**Agent workflow:**
|
|
367
|
-
1. **For task group 1** (module-codebase):
|
|
368
|
-
- Read: \`heraspec/skills/perfex-module/module-codebase/skill.md\`
|
|
369
|
-
- Follow: Module codebase process
|
|
370
|
-
- Use: Module codebase templates/scripts
|
|
371
|
-
- Implement: Tasks 1.1, 1.2
|
|
372
|
-
|
|
373
|
-
2. **For task group 2** (ui-ux):
|
|
374
|
-
- Read: \`heraspec/skills/ui-ux/skill.md\`
|
|
375
|
-
- Follow: UI/UX process
|
|
376
|
-
- Use: UI/UX templates/scripts
|
|
377
|
-
- Implement: Tasks 2.1, 2.2
|
|
378
|
-
|
|
379
|
-
3. **For task group 3** (documents):
|
|
380
|
-
- Read: \`heraspec/skills/documents/skill.md\`
|
|
381
|
-
- Follow: Documents process
|
|
382
|
-
- Use: Documents templates/scripts
|
|
383
|
-
- Implement: Task 3.1
|
|
384
|
-
|
|
385
350
|
**Key rule**: Switch skill.md when switching task groups!
|
|
386
351
|
`;
|
|
387
|
-
var CONFIG_TEMPLATE = `# HeraSpec Configuration
|
|
388
|
-
|
|
389
|
-
projectTypes:
|
|
390
|
-
- wordpress-plugin
|
|
391
|
-
# Add other project types as needed
|
|
392
|
-
|
|
393
|
-
defaultDomain: global
|
|
394
|
-
|
|
395
|
-
`;
|
|
396
|
-
var PROPOSAL_TEMPLATE = `# Change Proposal: <slug>
|
|
397
|
-
|
|
398
|
-
## Purpose
|
|
399
|
-
Describe why this change is needed.
|
|
400
|
-
|
|
401
|
-
## Scope
|
|
402
|
-
What will be changed?
|
|
403
|
-
|
|
404
|
-
## Project Types
|
|
405
|
-
- wordpress-plugin
|
|
406
|
-
- perfex-module
|
|
407
|
-
|
|
408
|
-
## Impact
|
|
409
|
-
What parts of the system will be affected?
|
|
410
|
-
|
|
411
|
-
`;
|
|
412
|
-
var TASKS_TEMPLATE = `# Tasks
|
|
413
|
-
|
|
414
|
-
## 1. WordPress plugin \u2013 feature name (projectType: wordpress-plugin, skill: admin-settings-page)
|
|
415
|
-
- [ ] Task 1.1
|
|
416
|
-
- [ ] Task 1.2
|
|
417
|
-
|
|
418
|
-
## 2. Perfex module \u2013 feature name (projectType: perfex-module, skill: module-registration)
|
|
419
|
-
- [ ] Task 2.1
|
|
420
|
-
|
|
421
|
-
`;
|
|
422
|
-
var TemplateManager = class {
|
|
423
|
-
static getProjectTemplate() {
|
|
424
|
-
return PROJECT_TEMPLATE;
|
|
425
|
-
}
|
|
426
|
-
static getAgentsTemplate() {
|
|
427
|
-
return AGENTS_TEMPLATE;
|
|
428
352
|
}
|
|
429
353
|
static getConfigTemplate() {
|
|
430
|
-
return
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
static getTasksTemplate() {
|
|
436
|
-
return TASKS_TEMPLATE;
|
|
437
|
-
}
|
|
438
|
-
static getSkillsSection() {
|
|
439
|
-
return SKILLS_SECTION_TEMPLATE;
|
|
354
|
+
return `projectType: generic-webapp
|
|
355
|
+
projectName: "HeraSpec Project"
|
|
356
|
+
description: "A new project using HeraSpec"
|
|
357
|
+
skills: []
|
|
358
|
+
`;
|
|
440
359
|
}
|
|
441
360
|
};
|
|
442
361
|
|
|
@@ -495,8 +414,12 @@ var InitCommand = class {
|
|
|
495
414
|
await FileSystemUtils.writeFile(uiuxGuidePath, uiuxGuide);
|
|
496
415
|
}
|
|
497
416
|
await this.createTemplateFiles(heraspecPath, alreadyInitialized);
|
|
498
|
-
const
|
|
499
|
-
|
|
417
|
+
const legacyAgentsPath = path2.join(resolvedPath, "AGENTS.md");
|
|
418
|
+
const newAgentsPath = path2.join(resolvedPath, HERASPEC_MARKERS.AGENTS_MD);
|
|
419
|
+
if (await FileSystemUtils.fileExists(legacyAgentsPath) && !await FileSystemUtils.fileExists(newAgentsPath)) {
|
|
420
|
+
await FileSystemUtils.moveFile(legacyAgentsPath, newAgentsPath);
|
|
421
|
+
}
|
|
422
|
+
await this.updateAgentsFile(newAgentsPath, alreadyInitialized);
|
|
500
423
|
await this.updateRelatedMarkdownFiles(resolvedPath);
|
|
501
424
|
spinner.succeed(
|
|
502
425
|
chalk.green(
|
|
@@ -537,7 +460,6 @@ var InitCommand = class {
|
|
|
537
460
|
}
|
|
538
461
|
async updateAgentsFile(agentsPath, alreadyInitialized) {
|
|
539
462
|
const skillsSectionMarker = "## Skills System";
|
|
540
|
-
const skillsSectionEndMarker = "**Key rule**: Switch skill.md when switching task groups!";
|
|
541
463
|
if (!alreadyInitialized) {
|
|
542
464
|
await FileSystemUtils.writeFile(
|
|
543
465
|
agentsPath,
|
|
@@ -548,24 +470,56 @@ var InitCommand = class {
|
|
|
548
470
|
let existingContent = "";
|
|
549
471
|
if (await FileSystemUtils.fileExists(agentsPath)) {
|
|
550
472
|
existingContent = await FileSystemUtils.readFile(agentsPath);
|
|
473
|
+
} else {
|
|
474
|
+
await FileSystemUtils.writeFile(
|
|
475
|
+
agentsPath,
|
|
476
|
+
TemplateManager.getAgentsTemplate()
|
|
477
|
+
);
|
|
478
|
+
return;
|
|
551
479
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
480
|
+
const latestSkillsSection = await this.getSkillsSection();
|
|
481
|
+
const safetyMarker = "## Universal Safety Rules";
|
|
482
|
+
const fullTemplate = TemplateManager.getAgentsTemplate();
|
|
483
|
+
const safetyEndIndex = fullTemplate.indexOf("## Core Workflow");
|
|
484
|
+
const safetySection = fullTemplate.substring(fullTemplate.indexOf(safetyMarker), safetyEndIndex).trim();
|
|
485
|
+
if (existingContent.includes(safetyMarker)) {
|
|
486
|
+
existingContent = this.replaceSafetyRules(existingContent, safetySection);
|
|
487
|
+
} else {
|
|
488
|
+
if (existingContent.startsWith("# ")) {
|
|
489
|
+
const firstLineEnd = existingContent.indexOf("\n") + 1;
|
|
490
|
+
existingContent = existingContent.substring(0, firstLineEnd) + "\n" + safetySection + "\n\n" + existingContent.substring(firstLineEnd);
|
|
491
|
+
} else {
|
|
492
|
+
existingContent = safetySection + "\n\n" + existingContent;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
let updatedContent = existingContent;
|
|
496
|
+
if (existingContent.includes(skillsSectionMarker) || existingContent.includes("## Skills system")) {
|
|
497
|
+
updatedContent = this.replaceSkillsSection(existingContent, latestSkillsSection);
|
|
556
498
|
} else {
|
|
557
|
-
|
|
558
|
-
|
|
499
|
+
updatedContent = this.appendSkillsSection(existingContent, latestSkillsSection);
|
|
500
|
+
}
|
|
501
|
+
if (updatedContent !== existingContent) {
|
|
559
502
|
await FileSystemUtils.writeFile(agentsPath, updatedContent);
|
|
560
503
|
}
|
|
561
504
|
}
|
|
562
505
|
replaceSkillsSection(existingContent, newSkillsSection) {
|
|
563
|
-
const
|
|
564
|
-
|
|
506
|
+
const startMarkers = ["## Skills System", "## Skills system", "### Skills System", "### Skills system"];
|
|
507
|
+
let startIndex = -1;
|
|
508
|
+
let foundMarker = "";
|
|
509
|
+
for (const marker of startMarkers) {
|
|
510
|
+
startIndex = existingContent.indexOf(marker);
|
|
511
|
+
if (startIndex !== -1) {
|
|
512
|
+
foundMarker = marker;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
565
516
|
if (startIndex === -1) {
|
|
566
517
|
return this.appendSkillsSection(existingContent, newSkillsSection);
|
|
567
518
|
}
|
|
568
|
-
let endIndex = existingContent.indexOf("\n## ", startIndex +
|
|
519
|
+
let endIndex = existingContent.indexOf("\n## ", startIndex + foundMarker.length);
|
|
520
|
+
if (endIndex === -1) {
|
|
521
|
+
endIndex = existingContent.indexOf("\n### ", startIndex + foundMarker.length);
|
|
522
|
+
}
|
|
569
523
|
if (endIndex === -1) {
|
|
570
524
|
endIndex = existingContent.length;
|
|
571
525
|
}
|
|
@@ -573,6 +527,18 @@ var InitCommand = class {
|
|
|
573
527
|
const after = existingContent.substring(endIndex);
|
|
574
528
|
return before + "\n\n" + newSkillsSection + (after.trimStart().startsWith("\n") ? "" : "\n\n") + after;
|
|
575
529
|
}
|
|
530
|
+
replaceSafetyRules(existingContent, newSafetySection) {
|
|
531
|
+
const marker = "## Universal Safety Rules";
|
|
532
|
+
const startIndex = existingContent.indexOf(marker);
|
|
533
|
+
if (startIndex === -1) return existingContent;
|
|
534
|
+
let endIndex = existingContent.indexOf("\n## ", startIndex + marker.length);
|
|
535
|
+
if (endIndex === -1) {
|
|
536
|
+
endIndex = existingContent.length;
|
|
537
|
+
}
|
|
538
|
+
const before = existingContent.substring(0, startIndex).trimEnd();
|
|
539
|
+
const after = existingContent.substring(endIndex);
|
|
540
|
+
return before + "\n\n" + newSafetySection + (after.trimStart().startsWith("\n") ? "" : "\n\n") + after;
|
|
541
|
+
}
|
|
576
542
|
appendSkillsSection(existingContent, skillsSection) {
|
|
577
543
|
const rulesMarker = "\n## Rules\n";
|
|
578
544
|
const rulesIndex = existingContent.indexOf(rulesMarker);
|
|
@@ -2825,11 +2791,12 @@ var HelperCommand = class {
|
|
|
2825
2791
|
console.log(chalk6.gray(" heraspec make docs --agent chatgpt\n"));
|
|
2826
2792
|
console.log(chalk6.gray(" heraspec make docs --agent claude\n"));
|
|
2827
2793
|
console.log(chalk6.white.bold("8. Multi-Format Documentation (Skill: Documents):\n"));
|
|
2828
|
-
console.log(chalk6.gray(' "Generate documentation with skill documents. Include:\n'));
|
|
2829
|
-
console.log(chalk6.gray(" -
|
|
2830
|
-
console.log(chalk6.gray(" -
|
|
2831
|
-
console.log(chalk6.gray(
|
|
2832
|
-
console.log(chalk6.gray('
|
|
2794
|
+
console.log(chalk6.gray(' "Generate documentation with skill documents for [project-name]. Include:\n'));
|
|
2795
|
+
console.log(chalk6.gray(" - Concise overview (documentation.txt)\n"));
|
|
2796
|
+
console.log(chalk6.gray(" - Technical Markdown (documentation.md)\n"));
|
|
2797
|
+
console.log(chalk6.gray(" - Interactive HTML Documentation (documentation.html)\n"));
|
|
2798
|
+
console.log(chalk6.gray(' - Premium Documentation Landing Page (documentation-landing-page.html)"\n'));
|
|
2799
|
+
console.log(chalk6.gray(' "Use documents skill to create dynamic, project-specific docs"\n'));
|
|
2833
2800
|
console.log("\u2500".repeat(70) + "\n");
|
|
2834
2801
|
}
|
|
2835
2802
|
showWorkflow() {
|
|
@@ -2880,11 +2847,12 @@ var HelperCommand = class {
|
|
|
2880
2847
|
{
|
|
2881
2848
|
step: "6. Generate Documentation",
|
|
2882
2849
|
actions: [
|
|
2883
|
-
"Generate
|
|
2884
|
-
|
|
2885
|
-
"
|
|
2850
|
+
"Generate basic docs: heraspec make docs",
|
|
2851
|
+
'Use Skill Documents: "Generate documentation with skill documents"',
|
|
2852
|
+
"Outputs: documentation.txt, .md, .html, and landing-page.html",
|
|
2853
|
+
"Agent uses ui-ux skill for premium dynamic design"
|
|
2886
2854
|
],
|
|
2887
|
-
prompt: "
|
|
2855
|
+
prompt: '"Generate documentation with skill documents for polyutilities"'
|
|
2888
2856
|
}
|
|
2889
2857
|
];
|
|
2890
2858
|
steps.forEach(({ step, actions, prompt }) => {
|
|
@@ -2910,6 +2878,8 @@ var HelperCommand = class {
|
|
|
2910
2878
|
"Archive change after completion to merge specs",
|
|
2911
2879
|
"Use heraspec skill list to view available skills",
|
|
2912
2880
|
"UI/UX tasks: Use search scripts in skill ui-ux",
|
|
2881
|
+
'Premium Documentation: Use "skill documents" for txt, md, html, and landing page',
|
|
2882
|
+
"Dynamic Docs: Documents skill generates custom layouts based on your project specs",
|
|
2913
2883
|
"Generate product docs: heraspec make docs (default agent: chatgpt)",
|
|
2914
2884
|
"Specify AI agent: heraspec make docs --agent <name> (chatgpt, claude, etc.)",
|
|
2915
2885
|
"Generate tests: heraspec make test (default: unit)",
|
|
@@ -2936,7 +2906,7 @@ var MakeDocsCommand = class {
|
|
|
2936
2906
|
try {
|
|
2937
2907
|
const resolvedPath = path12.resolve(projectPath);
|
|
2938
2908
|
const specsDir = path12.join(resolvedPath, HERASPEC_DIR_NAME, SPECS_DIR_NAME);
|
|
2939
|
-
const docsDir = path12.join(resolvedPath, "
|
|
2909
|
+
const docsDir = path12.join(resolvedPath, "documentations");
|
|
2940
2910
|
const projectMdPath = path12.join(resolvedPath, HERASPEC_DIR_NAME, HERASPEC_MARKERS.PROJECT_MD);
|
|
2941
2911
|
if (!await FileSystemUtils.fileExists(specsDir)) {
|
|
2942
2912
|
spinner.fail('Specs directory not found. Run "heraspec init" first.');
|
|
@@ -2949,6 +2919,8 @@ var MakeDocsCommand = class {
|
|
|
2949
2919
|
const projectContent = await FileSystemUtils.readFile(projectMdPath);
|
|
2950
2920
|
projectInfo = this.extractProjectInfo(projectContent);
|
|
2951
2921
|
}
|
|
2922
|
+
const hasDocumentsSkill = await FileSystemUtils.fileExists(path12.join(resolvedPath, HERASPEC_DIR_NAME, "skills", "documents"));
|
|
2923
|
+
const hasUIUXSkill = await FileSystemUtils.fileExists(path12.join(resolvedPath, HERASPEC_DIR_NAME, "skills", "ui-ux"));
|
|
2952
2924
|
const specFiles = await this.findSpecFiles(specsDir);
|
|
2953
2925
|
if (specFiles.length === 0) {
|
|
2954
2926
|
spinner.warn('No specs found. Create specs first using "heraspec list --specs".');
|
|
@@ -2956,9 +2928,26 @@ var MakeDocsCommand = class {
|
|
|
2956
2928
|
}
|
|
2957
2929
|
const specs = await this.readSpecs(specFiles);
|
|
2958
2930
|
const docContent = this.generateProductDocumentation(specs, projectInfo, agent);
|
|
2959
|
-
const docFilePath = path12.join(docsDir, "
|
|
2931
|
+
const docFilePath = path12.join(docsDir, "documentation.txt");
|
|
2960
2932
|
await FileSystemUtils.writeFile(docFilePath, docContent);
|
|
2961
|
-
spinner.succeed(`
|
|
2933
|
+
spinner.succeed(`Basic documentation generated: ${docFilePath}`);
|
|
2934
|
+
if (hasDocumentsSkill) {
|
|
2935
|
+
console.log(chalk7.green.bold("\n\u2728 Documents Skill Detected!"));
|
|
2936
|
+
console.log(chalk7.white("AI Agent Instruction:"));
|
|
2937
|
+
console.log(chalk7.gray(' "Now use the documents skill to generate the full multi-format package:'));
|
|
2938
|
+
console.log(chalk7.gray(" - Use documentation.txt as context"));
|
|
2939
|
+
console.log(chalk7.gray(" - Create documentation.md, documentation.html, and landing page"));
|
|
2940
|
+
console.log(chalk7.gray(" - CRITICAL: Save all files in the /documentations directory (create it if missing)"));
|
|
2941
|
+
if (hasUIUXSkill) {
|
|
2942
|
+
console.log(chalk7.gray(' - Apply premium design from the ui-ux skill standards"'));
|
|
2943
|
+
} else {
|
|
2944
|
+
console.log(chalk7.yellow(' - WARNING: "ui-ux" skill is MISSING but required for HTML/Landing Page.'));
|
|
2945
|
+
console.log(chalk7.gray(' - Agent must install it first: heraspec skill add ui-ux"'));
|
|
2946
|
+
}
|
|
2947
|
+
} else {
|
|
2948
|
+
console.log(chalk7.yellow('\n\u{1F4A1} Tip: Add the "documents" skill for premium HTML & Landing Page support:'));
|
|
2949
|
+
console.log(chalk7.gray(" heraspec skill add documents"));
|
|
2950
|
+
}
|
|
2962
2951
|
console.log(chalk7.gray(`
|
|
2963
2952
|
Found ${specFiles.length} feature(s)`));
|
|
2964
2953
|
} catch (error) {
|