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
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,37 @@
1
+ export interface AuditIssue {
2
+ type: 'error' | 'warning' | 'info';
3
+ rule: string;
4
+ file: string;
5
+ line?: number;
6
+ message: string;
7
+ suggestion?: string;
8
+ fixable?: boolean;
9
+ }
10
+ export interface AuditReport {
11
+ passed: number;
12
+ warnings: number;
13
+ errors: number;
14
+ issues: AuditIssue[];
15
+ projectType: string;
16
+ durationMs: number;
17
+ }
18
+ export declare class AuditCommand {
19
+ private issues;
20
+ private passedCount;
21
+ execute(targetPath?: string, options?: {
22
+ fix?: boolean;
23
+ type?: string;
24
+ }): Promise<void>;
25
+ private detectProjectType;
26
+ private collectFiles;
27
+ private auditPhpGuards;
28
+ private auditZeroInlineCode;
29
+ private auditTriggerWords;
30
+ private auditSessionConcurrency;
31
+ private auditLanguageParity;
32
+ private extractLangKeys;
33
+ private auditEmojis;
34
+ private auditPackagingRules;
35
+ private printReport;
36
+ }
37
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1,11 @@
1
+ export declare class CreateCommand {
2
+ execute(name: string, options: {
3
+ type?: string;
4
+ title?: string;
5
+ description?: string;
6
+ out?: string;
7
+ }): Promise<void>;
8
+ private scaffoldPerfexModule;
9
+ private scaffoldWordPressPlugin;
10
+ }
11
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1,17 @@
1
+ export declare class ExploreCommand {
2
+ /**
3
+ * heraspec explore outline <file> - Show structural skeleton
4
+ */
5
+ outline(filePath: string): Promise<void>;
6
+ /**
7
+ * heraspec explore search <query> [path] - Search symbols across codebase
8
+ */
9
+ search(query: string, searchPath?: string, options?: {
10
+ limit?: number;
11
+ }): Promise<void>;
12
+ /**
13
+ * heraspec explore unfold <file> <symbol> - Show full implementation of a symbol
14
+ */
15
+ unfold(filePath: string, symbolName: string): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=explore.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * HeraSpec Helper Command
3
+ * Displays usage guides, example prompts, and workflow instructions
4
+ */
5
+ export declare class HelperCommand {
6
+ execute(): Promise<void>;
7
+ private showQuickStart;
8
+ private showCommands;
9
+ private showExamplePrompts;
10
+ private showWorkflow;
11
+ private showTips;
12
+ }
13
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1,9 @@
1
+ export declare class HotfixCommand {
2
+ /**
3
+ * Execute the hotfix command
4
+ */
5
+ execute(title: string, options: {
6
+ narrative?: string;
7
+ }, projectPath?: string): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=hotfix.d.ts.map
@@ -0,0 +1,14 @@
1
+ export declare class MakeCodeCommand {
2
+ execute(projectPath?: string, specName?: string): Promise<void>;
3
+ private extractProjectInfo;
4
+ private findSpecPath;
5
+ private findSpecFiles;
6
+ private findSpecFilesRecursive;
7
+ private readSpecs;
8
+ private generateCodeFiles;
9
+ private getOutputPath;
10
+ private generateCodeContent;
11
+ private toPascalCase;
12
+ private toCamelCase;
13
+ }
14
+ //# sourceMappingURL=make-code.d.ts.map
@@ -0,0 +1,36 @@
1
+ export declare class MakeDocsCommand {
2
+ execute(projectPath?: string, agent?: string): Promise<void>;
3
+ /**
4
+ * Extract project information from project.md
5
+ */
6
+ private extractProjectInfo;
7
+ /**
8
+ * Find all spec files recursively
9
+ */
10
+ private findSpecFiles;
11
+ /**
12
+ * Recursively find spec files
13
+ */
14
+ private findSpecFilesRecursive;
15
+ /**
16
+ * Read all spec files
17
+ */
18
+ private readSpecs;
19
+ /**
20
+ * Extract feature name from spec file
21
+ */
22
+ private extractFeatureName;
23
+ /**
24
+ * Generate product documentation from specs
25
+ */
26
+ private generateProductDocumentation;
27
+ /**
28
+ * Extract user-friendly information from spec content
29
+ */
30
+ private extractFeatureInfo;
31
+ /**
32
+ * Make technical text more user-friendly
33
+ */
34
+ private makeUserFriendly;
35
+ }
36
+ //# sourceMappingURL=make-docs.d.ts.map
@@ -0,0 +1,60 @@
1
+ export declare class MakeTestCommand {
2
+ execute(projectPath?: string, testType?: string): Promise<void>;
3
+ /**
4
+ * Get test directory path based on project type and test type
5
+ */
6
+ private getTestDirectory;
7
+ /**
8
+ * Extract project information from project.md
9
+ */
10
+ private extractProjectInfo;
11
+ /**
12
+ * Find all spec files recursively
13
+ */
14
+ private findSpecFiles;
15
+ /**
16
+ * Recursively find spec files
17
+ */
18
+ private findSpecFilesRecursive;
19
+ /**
20
+ * Read all spec files
21
+ */
22
+ private readSpecs;
23
+ /**
24
+ * Extract feature name from spec file
25
+ */
26
+ private extractFeatureName;
27
+ /**
28
+ * Generate test files from specs
29
+ */
30
+ private generateTestFiles;
31
+ /**
32
+ * Generate test file content
33
+ */
34
+ private generateTestContent;
35
+ /**
36
+ * Determine test framework based on project info
37
+ */
38
+ private determineTestFramework;
39
+ /**
40
+ * Get test file name
41
+ */
42
+ private getTestFileName;
43
+ /**
44
+ * Extract feature info from spec content
45
+ */
46
+ private extractFeatureInfo;
47
+ /**
48
+ * Convert to kebab-case
49
+ */
50
+ private toKebabCase;
51
+ /**
52
+ * Convert to PascalCase
53
+ */
54
+ private toPascalCase;
55
+ /**
56
+ * Convert to snake_case
57
+ */
58
+ private toSnakeCase;
59
+ }
60
+ //# sourceMappingURL=make-test.d.ts.map
@@ -0,0 +1,101 @@
1
+ export declare class MemoryCommand {
2
+ /**
3
+ * heraspec memory log - Record an observation
4
+ */
5
+ log(options: {
6
+ type: string;
7
+ title: string;
8
+ narrative?: string;
9
+ concepts?: string;
10
+ filesModified?: string;
11
+ filesRead?: string;
12
+ discoveryTokens?: string;
13
+ sessionId?: string;
14
+ project?: string;
15
+ }, projectPath?: string): Promise<void>;
16
+ /**
17
+ * heraspec memory query - Semantic search using Vector embeddings
18
+ */
19
+ query(question: string, options?: {
20
+ limit?: number;
21
+ project?: string;
22
+ }, projectPath?: string): Promise<void>;
23
+ /**
24
+ * heraspec memory search - Search observations
25
+ */
26
+ search(query: string, options?: {
27
+ type?: string;
28
+ concepts?: string;
29
+ files?: string;
30
+ limit?: number;
31
+ id?: number;
32
+ project?: string;
33
+ }, projectPath?: string): Promise<void>;
34
+ /**
35
+ * heraspec memory context - Generate context for AI agent
36
+ */
37
+ context(options?: {
38
+ output?: string;
39
+ maxTokens?: number;
40
+ }, projectPath?: string): Promise<void>;
41
+ /**
42
+ * heraspec memory summarize - Create a session summary
43
+ */
44
+ summarize(options: {
45
+ request: string;
46
+ investigated?: string;
47
+ learned?: string;
48
+ completed?: string;
49
+ nextSteps?: string;
50
+ filesRead?: string;
51
+ filesEdited?: string;
52
+ sessionId?: string;
53
+ project?: string;
54
+ }, projectPath?: string): Promise<void>;
55
+ /**
56
+ * heraspec memory status - Show memory statistics
57
+ */
58
+ status(projectPath?: string): Promise<void>;
59
+ /**
60
+ * heraspec memory timeline - Show observation timeline
61
+ */
62
+ timeline(options?: {
63
+ limit?: number;
64
+ project?: string;
65
+ }, projectPath?: string): Promise<void>;
66
+ /**
67
+ * heraspec memory prune - Delete old observations
68
+ */
69
+ prune(days: number, options?: {
70
+ project?: string;
71
+ }, projectPath?: string): Promise<void>;
72
+ private formatBytes;
73
+ /**
74
+ * heraspec memory optimize - Auto-detect and apply optimal config
75
+ */
76
+ optimize(options?: {
77
+ yes?: boolean;
78
+ silent?: boolean;
79
+ }, projectPath?: string): Promise<void>;
80
+ /**
81
+ * heraspec memory bootstrap - Import historical specs and archives into memory
82
+ */
83
+ bootstrap(options?: {
84
+ yes?: boolean;
85
+ }, projectPath?: string): Promise<void>;
86
+ /**
87
+ * heraspec memory analytics - Show token usage and economic savings metrics
88
+ */
89
+ analytics(options?: {
90
+ history?: boolean;
91
+ }, projectPath?: string): Promise<void>;
92
+ /**
93
+ * heraspec memory index - Scan project and generate architecture map observation
94
+ */
95
+ index(options?: {
96
+ depth?: string;
97
+ yes?: boolean;
98
+ }, projectPath?: string): Promise<void>;
99
+ private formatNumber;
100
+ }
101
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1,17 @@
1
+ export interface PackOptions {
2
+ out?: string;
3
+ name?: string;
4
+ version?: string;
5
+ build?: boolean;
6
+ }
7
+ export declare class PackCommand {
8
+ private readonly defaultExcludeDirs;
9
+ private readonly defaultExcludeFiles;
10
+ execute(targetPath?: string, options?: PackOptions): Promise<void>;
11
+ private detectProjectName;
12
+ private detectProjectVersion;
13
+ private buildAssetsIfConfigured;
14
+ private stageProductionFiles;
15
+ private createZipArchive;
16
+ }
17
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class ShowCommand {
2
+ execute(itemName?: string): Promise<void>;
3
+ private showChange;
4
+ private showSpec;
5
+ private findSpecPath;
6
+ private findDeltaSpecs;
7
+ }
8
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class SkillCommand {
2
+ list(projectPath?: string): Promise<void>;
3
+ show(skillName: string, projectType?: string, projectPath?: string): Promise<void>;
4
+ repair(projectPath?: string): Promise<void>;
5
+ add(skillName: string, projectType?: string, projectPath?: string): Promise<void>;
6
+ update(skillName: string, projectType?: string, projectPath?: string): Promise<void>;
7
+ }
8
+ //# sourceMappingURL=skill.d.ts.map
@@ -0,0 +1,32 @@
1
+ export declare class SuggestCommand {
2
+ execute(projectPath?: string): Promise<void>;
3
+ /**
4
+ * Extract project information from project.md
5
+ */
6
+ private extractProjectInfo;
7
+ /**
8
+ * Find all spec files recursively
9
+ */
10
+ private findSpecFiles;
11
+ /**
12
+ * Recursively find spec files
13
+ */
14
+ private findSpecFilesRecursive;
15
+ /**
16
+ * Read all spec files
17
+ */
18
+ private readSpecs;
19
+ /**
20
+ * Extract feature name from spec file
21
+ */
22
+ private extractFeatureName;
23
+ /**
24
+ * Generate feature suggestions based on existing specs
25
+ */
26
+ private generateSuggestions;
27
+ /**
28
+ * Format suggestions as markdown
29
+ */
30
+ private formatSuggestions;
31
+ }
32
+ //# sourceMappingURL=suggest.d.ts.map
@@ -0,0 +1,8 @@
1
+ export declare class ValidateCommand {
2
+ execute(itemName?: string, options?: {
3
+ strict?: boolean;
4
+ }): Promise<void>;
5
+ private findSpecPath;
6
+ private printReport;
7
+ }
8
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1,14 @@
1
+ export declare class ArchiveCommand {
2
+ execute(changeName?: string, options?: {
3
+ yes?: boolean;
4
+ }): Promise<void>;
5
+ private mergeDeltaSpecs;
6
+ private mergeDeltaIntoSpec;
7
+ private modifyRequirementBlock;
8
+ private extractRequirementBlock;
9
+ private stringifyRequirement;
10
+ private moveChangeToArchive;
11
+ private findDeltaSpecFiles;
12
+ private autoLogToMemory;
13
+ }
14
+ //# sourceMappingURL=archive.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * HeraSpec Core Configuration
3
+ */
4
+ export declare const HERASPEC_DIR_NAME = "heraspec";
5
+ export declare const SPECS_DIR_NAME = "specs";
6
+ export declare const CHANGES_DIR_NAME = "changes";
7
+ export declare const ARCHIVES_DIR_NAME = "archives";
8
+ export declare const SKILLS_DIR_NAME = "skills";
9
+ export declare const KNOWLEDGE_DIR_NAME = "knowledge";
10
+ export declare const MEMORY_DIR_NAME = "memory";
11
+ export declare const PROJECT_TYPES: readonly ["wordpress-plugin", "wordpress-theme", "perfex-module", "laravel-package", "node-service", "generic-webapp", "backend-api", "frontend-app", "multi-stack"];
12
+ export type ProjectType = (typeof PROJECT_TYPES)[number];
13
+ export declare const SKILLS: Record<ProjectType, string[]>;
14
+ export type Skill = typeof SKILLS[ProjectType][number];
15
+ export interface HeraSpecConfig {
16
+ projectType?: ProjectType | ProjectType[];
17
+ domains?: string[];
18
+ stack?: string[];
19
+ }
20
+ export interface SpecMeta {
21
+ projectType?: ProjectType | ProjectType[];
22
+ domain?: string;
23
+ stack?: string | string[];
24
+ }
25
+ export declare const HERASPEC_MARKERS: {
26
+ readonly PROJECT_MD: "project.md";
27
+ readonly AGENTS_MD: "AGENTS.heraspec.md";
28
+ readonly CONFIG_YAML: "config.yaml";
29
+ readonly PROPOSAL_MD: "proposal.md";
30
+ readonly TASKS_MD: "tasks.md";
31
+ readonly DESIGN_MD: "design.md";
32
+ };
33
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,97 @@
1
+ export declare class InitCommand {
2
+ execute(targetPath?: string): Promise<void>;
3
+ private createTemplateFiles;
4
+ /**
5
+ * Migrate legacy project.md (extract technical configs to config.yaml)
6
+ */
7
+ private migrateLegacyProjectMd;
8
+ /**
9
+ * Detect if the new template has sections that the existing file lacks
10
+ */
11
+ private detectTemplateChanges;
12
+ /**
13
+ * Create numbered backup: project.back1.md, project.back2.md, etc.
14
+ */
15
+ private createNumberedBackup;
16
+ /**
17
+ * Build merged project.md:
18
+ * - Keeps all existing user content (descriptions, tech stack, conventions)
19
+ * - Adds any NEW sections from the template that don't exist yet
20
+ * - Adds a merge note at the top referencing the backup
21
+ */
22
+ private buildMergedProjectMd;
23
+ /**
24
+ * Parse markdown sections (## headers) from content
25
+ */
26
+ private parseSections;
27
+ private updateAgentsFile;
28
+ /**
29
+ * Find the index of the next top-level H2 section in the markdown content.
30
+ * Tracks fenced code blocks to ignore H2 headers inside code blocks.
31
+ */
32
+ private findSectionEndIndex;
33
+ /**
34
+ * Finds the start index of the next standard section in the sequence.
35
+ * This is used to replace the entire section cleanly, even if there are internal H2s or duplicates.
36
+ */
37
+ private findNextSectionIndex;
38
+ /**
39
+ * Generic section replacer: replace content from marker to next H2 header or endMarker
40
+ */
41
+ private replaceSection;
42
+ private replaceSkillsSection;
43
+ private replaceSafetyRules;
44
+ private appendSkillsSection;
45
+ private getSkillsSection;
46
+ /**
47
+ * Resolve core templates directory (same logic as skill.ts)
48
+ */
49
+ private getCoreTemplatesDir;
50
+ /**
51
+ * Refactor legacy installed skills if new standards or companion skills were added to HeraSpec.
52
+ * Ensures backward compatibility and non-destructive enhancement for existing projects.
53
+ */
54
+ private refactorLegacySkills;
55
+ /**
56
+ * Update installed built-in skills on re-init.
57
+ *
58
+ * Rules:
59
+ * - Only update skills that exist in SKILL_TEMPLATE_MAP (built-in / known skills)
60
+ * - Skip skills NOT in the template map (custom skills added by the project)
61
+ * - Strictly preserve custom project skills: NEVER delete or overwrite them
62
+ * - For each matching skill: update skill.md + re-copy resourceDirs from template
63
+ * safely preserving any user files in templates/, scripts/, examples/ sub-folders
64
+ */
65
+ private updateInstalledSkills;
66
+ /**
67
+ * Walk heraspec/skills/ and return all installed skill paths with metadata
68
+ */
69
+ private collectInstalledSkillPaths;
70
+ /**
71
+ * Prompt user to bootstrap memory if historical specs are found
72
+ */
73
+ private checkAndBootstrapMemory;
74
+ /**
75
+ * Get the knowledge source directory from CLI package
76
+ */
77
+ private getKnowledgeSourceDir;
78
+ /**
79
+ * Deploy/update built-in knowledge base, preserving custom/ directory
80
+ */
81
+ private deployKnowledge;
82
+ private getSkillsReadmeTemplate;
83
+ private getUIUXQuickReference;
84
+ /**
85
+ * Update related markdown files in the project (README.md, etc.)
86
+ */
87
+ private updateRelatedMarkdownFiles;
88
+ /**
89
+ * Update README.md with HeraSpec information
90
+ */
91
+ private updateReadmeFile;
92
+ /**
93
+ * Get HeraSpec section content for README.md
94
+ */
95
+ private getHeraSpecReadmeSection;
96
+ }
97
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1,7 @@
1
+ export declare class ListCommand {
2
+ execute(targetPath?: string, mode?: 'changes' | 'specs'): Promise<void>;
3
+ private listChanges;
4
+ private listSpecs;
5
+ private findSpecFiles;
6
+ }
7
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1,30 @@
1
+ /**
2
+ * HeraSpec Memory Config Advisor
3
+ * Auto-detects project scale and recommends optimal config adjustments
4
+ */
5
+ import type { ContextConfig, MemoryStatus } from './memory-types.js';
6
+ export interface ConfigRecommendation {
7
+ setting: string;
8
+ currentValue: number | boolean;
9
+ recommendedValue: number | boolean;
10
+ reason: string;
11
+ impact: string;
12
+ }
13
+ export interface ConfigAdvice {
14
+ projectScale: 'small' | 'medium' | 'large' | 'enterprise';
15
+ recommendations: ConfigRecommendation[];
16
+ hasChanges: boolean;
17
+ summary: string;
18
+ }
19
+ /**
20
+ * Analyze memory status and recommend config changes
21
+ */
22
+ export declare function analyzeAndRecommend(status: MemoryStatus, projectPath?: string): ConfigAdvice;
23
+ /**
24
+ * Generate the new config JSON to write
25
+ */
26
+ export declare function buildOptimizedConfig(status: MemoryStatus, projectPath?: string): {
27
+ config: ContextConfig;
28
+ advice: ConfigAdvice;
29
+ };
30
+ //# sourceMappingURL=config-advisor.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { ContextConfig } from './memory-types.js';
2
+ /**
3
+ * Default context configuration
4
+ */
5
+ export declare const DEFAULT_CONTEXT_CONFIG: ContextConfig;
6
+ /**
7
+ * Load context configuration from file or return defaults
8
+ */
9
+ export declare function loadContextConfig(projectPath?: string): ContextConfig;
10
+ /**
11
+ * Save context configuration to file
12
+ */
13
+ export declare function saveContextConfig(config: ContextConfig, projectPath?: string): void;
14
+ //# sourceMappingURL=context-config.d.ts.map
@@ -0,0 +1,19 @@
1
+ export declare class ContextGenerator {
2
+ private store;
3
+ private search;
4
+ constructor(projectPath?: string);
5
+ /**
6
+ * Generate context markdown for AI agent consumption
7
+ * Writes to heraspec/memory/context.md for on-demand reading
8
+ */
9
+ generateContext(projectPath?: string): string;
10
+ /**
11
+ * Write context to file for agent to read on-demand
12
+ */
13
+ writeContextFile(projectPath?: string): string;
14
+ private renderEmptyState;
15
+ private buildContextOutput;
16
+ private renderSummary;
17
+ private renderFullObservation;
18
+ }
19
+ //# sourceMappingURL=context-generator.d.ts.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * HeraSpec Memory Module
3
+ * Re-exports all memory components
4
+ */
5
+ export { MemoryStore } from './memory-store.js';
6
+ export { MemorySearch } from './memory-search.js';
7
+ export { ContextGenerator } from './context-generator.js';
8
+ export { loadContextConfig, saveContextConfig } from './context-config.js';
9
+ export { analyzeAndRecommend, buildOptimizedConfig } from './config-advisor.js';
10
+ export { initializeSchema, needsMigration, runMigrations } from './memory-schema.js';
11
+ export * from './memory-types.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * HeraSpec Memory Schema
3
+ * SQLite schema definitions, FTS5 indexes, and migration system
4
+ */
5
+ export declare const SCHEMA_VERSION = 3;
6
+ /**
7
+ * Core table definitions
8
+ */
9
+ export declare const CREATE_TABLES = "\n -- Sessions tracking\n CREATE TABLE IF NOT EXISTS sessions (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n session_id TEXT NOT NULL UNIQUE,\n project TEXT NOT NULL,\n started_at TEXT NOT NULL DEFAULT (datetime('now')),\n started_at_epoch INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000),\n completed_at TEXT,\n completed_at_epoch INTEGER,\n status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'completed'))\n );\n\n -- Observation records\n CREATE TABLE IF NOT EXISTS observations (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n session_id TEXT NOT NULL DEFAULT '',\n project TEXT NOT NULL DEFAULT '',\n type TEXT NOT NULL DEFAULT 'change' CHECK(type IN ('decision', 'bugfix', 'feature', 'refactor', 'discovery', 'change')),\n title TEXT NOT NULL DEFAULT '',\n narrative TEXT DEFAULT '',\n concepts TEXT DEFAULT '[]',\n files_read TEXT DEFAULT '[]',\n files_modified TEXT DEFAULT '[]',\n discovery_tokens INTEGER DEFAULT 0,\n embedding TEXT,\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n created_at_epoch INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)\n );\n\n -- Session summaries\n CREATE TABLE IF NOT EXISTS session_summaries (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n session_id TEXT NOT NULL DEFAULT '',\n project TEXT NOT NULL DEFAULT '',\n request TEXT DEFAULT '',\n investigated TEXT DEFAULT '',\n learned TEXT DEFAULT '',\n completed TEXT DEFAULT '',\n next_steps TEXT DEFAULT '',\n files_read TEXT DEFAULT '[]',\n files_edited TEXT DEFAULT '[]',\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n created_at_epoch INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)\n );\n\n -- Database size history tracking\n CREATE TABLE IF NOT EXISTS db_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n project TEXT NOT NULL,\n db_size_bytes INTEGER NOT NULL,\n created_at TEXT NOT NULL DEFAULT (datetime('now')),\n created_at_epoch INTEGER NOT NULL DEFAULT (strftime('%s','now') * 1000)\n );\n";
10
+ /**
11
+ * Index definitions for query optimization
12
+ */
13
+ export declare const CREATE_INDEXES = "\n CREATE INDEX IF NOT EXISTS idx_obs_project ON observations(project);\n CREATE INDEX IF NOT EXISTS idx_obs_type ON observations(type);\n CREATE INDEX IF NOT EXISTS idx_obs_created ON observations(created_at_epoch DESC);\n CREATE INDEX IF NOT EXISTS idx_obs_session ON observations(session_id);\n CREATE INDEX IF NOT EXISTS idx_sum_project ON session_summaries(project);\n CREATE INDEX IF NOT EXISTS idx_sum_created ON session_summaries(created_at_epoch DESC);\n CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project);\n CREATE INDEX IF NOT EXISTS idx_sessions_status ON sessions(status);\n CREATE INDEX IF NOT EXISTS idx_history_project ON db_history(project);\n";
14
+ /**
15
+ * FTS5 virtual tables for full-text search
16
+ */
17
+ export declare const CREATE_FTS5 = "\n CREATE VIRTUAL TABLE IF NOT EXISTS observations_fts USING fts5(\n title,\n narrative,\n concepts,\n content='observations',\n content_rowid='id',\n tokenize='porter unicode61'\n );\n\n CREATE VIRTUAL TABLE IF NOT EXISTS summaries_fts USING fts5(\n request,\n learned,\n completed,\n content='session_summaries',\n content_rowid='id',\n tokenize='porter unicode61'\n );\n";
18
+ /**
19
+ * FTS5 sync triggers - keep FTS index in sync with main tables
20
+ */
21
+ export declare const CREATE_FTS_TRIGGERS = "\n -- Observations FTS triggers\n CREATE TRIGGER IF NOT EXISTS observations_ai AFTER INSERT ON observations BEGIN\n INSERT INTO observations_fts(rowid, title, narrative, concepts)\n VALUES (new.id, new.title, new.narrative, new.concepts);\n END;\n\n CREATE TRIGGER IF NOT EXISTS observations_ad AFTER DELETE ON observations BEGIN\n INSERT INTO observations_fts(observations_fts, rowid, title, narrative, concepts)\n VALUES ('delete', old.id, old.title, old.narrative, old.concepts);\n END;\n\n CREATE TRIGGER IF NOT EXISTS observations_au AFTER UPDATE ON observations BEGIN\n INSERT INTO observations_fts(observations_fts, rowid, title, narrative, concepts)\n VALUES ('delete', old.id, old.title, old.narrative, old.concepts);\n INSERT INTO observations_fts(rowid, title, narrative, concepts)\n VALUES (new.id, new.title, new.narrative, new.concepts);\n END;\n\n -- Summaries FTS triggers\n CREATE TRIGGER IF NOT EXISTS summaries_ai AFTER INSERT ON session_summaries BEGIN\n INSERT INTO summaries_fts(rowid, request, learned, completed)\n VALUES (new.id, new.request, new.learned, new.completed);\n END;\n\n CREATE TRIGGER IF NOT EXISTS summaries_ad AFTER DELETE ON session_summaries BEGIN\n INSERT INTO summaries_fts(summaries_fts, rowid, request, learned, completed)\n VALUES ('delete', old.id, old.request, old.learned, old.completed);\n END;\n\n CREATE TRIGGER IF NOT EXISTS summaries_au AFTER UPDATE ON session_summaries BEGIN\n INSERT INTO summaries_fts(summaries_fts, rowid, request, learned, completed)\n VALUES ('delete', old.id, old.request, old.learned, old.completed);\n INSERT INTO summaries_fts(rowid, request, learned, completed)\n VALUES (new.id, new.request, new.learned, new.completed);\n END;\n";
22
+ /**
23
+ * Initialize database with schema
24
+ */
25
+ export declare function initializeSchema(db: any): void;
26
+ /**
27
+ * Check if migration is needed
28
+ */
29
+ export declare function needsMigration(db: any): boolean;
30
+ /**
31
+ * Run migrations from current version to latest
32
+ */
33
+ export declare function runMigrations(db: any): void;
34
+ //# sourceMappingURL=memory-schema.d.ts.map