heraspec 0.1.18 → 0.1.19

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.
@@ -0,0 +1,12 @@
1
+ import { type IdeSelectorOption } from '../core/config.js';
2
+ export declare const VALID_IDE_OPTIONS: readonly IdeSelectorOption[];
3
+ export interface IdeSyncCommandOptions {
4
+ check?: boolean;
5
+ ide?: string;
6
+ force?: boolean;
7
+ }
8
+ export declare function parseIdeSelectorOption(raw?: string): IdeSelectorOption;
9
+ export declare class IdeCommand {
10
+ sync(projectPath?: string, options?: IdeSyncCommandOptions): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=ide.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { IdeSelectorOption } from './config.js';
2
+ import { type AgentsTemplateContext } from './templates/index.js';
3
+ export declare const HERASPEC_MIGRATION_MARKER = "<!-- HERASPEC:MIGRATED_FROM_LEGACY -->";
4
+ export interface HeraspecState {
5
+ schemaVersion: number;
6
+ cliVersion: string;
7
+ updatedAt: string;
8
+ agentsHeraspecSha256?: string;
9
+ mirroredSkills?: Record<string, string>;
10
+ }
11
+ export interface ProjectYamlMetadata {
12
+ projectName?: string;
13
+ projectTypes: string[];
14
+ skills: string[];
15
+ }
16
+ export interface LegacyExtractionResult {
17
+ customSections: string[];
18
+ migratedAdditions: Array<{
19
+ heading: string;
20
+ lines: string[];
21
+ }>;
22
+ hasCustomContent: boolean;
23
+ }
24
+ export interface AgentsComposePlan {
25
+ agentsPath: string;
26
+ customAgentsPath: string;
27
+ statePath: string;
28
+ backupPath: string | null;
29
+ agentsAction: 'create' | 'upgrade-clean' | 'migrate-and-regenerate' | 'up-to-date';
30
+ customAction: 'create-starter' | 'create-from-migration' | 'append-migration' | 'preserve';
31
+ extraction: LegacyExtractionResult;
32
+ renderedAgents: string;
33
+ nextCustomContent: string | null;
34
+ renderedSha256: string;
35
+ context: AgentsTemplateContext;
36
+ }
37
+ export declare function extractCustomRulesFromLegacyAgents(existingContent: string): LegacyExtractionResult;
38
+ export declare function formatMigratedCustomContent(extraction: LegacyExtractionResult, projectName?: string): string;
39
+ export declare function appendMigratedCustomContent(existingCustom: string, extraction: LegacyExtractionResult): string | null;
40
+ export declare function parseConfigYamlContent(yamlContent: string): ProjectYamlMetadata;
41
+ export declare function readProjectMetadata(heraspecPath: string): Promise<ProjectYamlMetadata>;
42
+ export declare function readHeraspecState(heraspecPath: string): Promise<HeraspecState | null>;
43
+ export declare function writeHeraspecState(heraspecPath: string, state: HeraspecState): Promise<void>;
44
+ export declare function resolveBackupFilePath(projectPath: string): Promise<string>;
45
+ export declare function buildAgentsComposePlan(options: {
46
+ projectPath: string;
47
+ heraspecPath: string;
48
+ ideOption?: IdeSelectorOption;
49
+ force?: boolean;
50
+ }): Promise<AgentsComposePlan>;
51
+ //# sourceMappingURL=agents-composer.d.ts.map
@@ -22,9 +22,13 @@ export interface SpecMeta {
22
22
  domain?: string;
23
23
  stack?: string | string[];
24
24
  }
25
+ export type IdeProfileName = 'gemini' | 'claude' | 'codex' | 'cursor' | 'windsurf' | 'copilot';
26
+ export type IdeSelectorOption = 'auto' | 'all' | 'none' | IdeProfileName;
25
27
  export declare const HERASPEC_MARKERS: {
26
28
  readonly PROJECT_MD: "project.md";
27
29
  readonly AGENTS_MD: "AGENTS.heraspec.md";
30
+ readonly AGENTS_CUSTOM_MD: "AGENTS.custom.md";
31
+ readonly STATE_JSON: ".heraspec-state.json";
28
32
  readonly CONFIG_YAML: "config.yaml";
29
33
  readonly PROPOSAL_MD: "proposal.md";
30
34
  readonly TASKS_MD: "tasks.md";
@@ -0,0 +1,92 @@
1
+ import { IdeProfileName, IdeSelectorOption } from './config.js';
2
+ import type { DetectedIdeFileSummary, DetectedIdeSkillRootSummary, InstalledSkillSummary } from './templates/index.js';
3
+ export declare const HERASPEC_ADAPTER_START = "<!-- HERASPEC:ADAPTER_START -->";
4
+ export declare const HERASPEC_ADAPTER_END = "<!-- HERASPEC:ADAPTER_END -->";
5
+ interface IdeProfileSpec {
6
+ name: IdeProfileName;
7
+ label: string;
8
+ primaryRuleFile: string;
9
+ ruleCandidates: string[];
10
+ skillRootDir?: string;
11
+ }
12
+ export declare const IDE_PROFILES: readonly IdeProfileSpec[];
13
+ export interface DiscoveredRuleTarget {
14
+ profile: IdeProfileName;
15
+ label: string;
16
+ absolutePath: string;
17
+ relativeFromProject: string;
18
+ scope: 'project' | 'parent';
19
+ exists: boolean;
20
+ }
21
+ export interface DiscoveredSkillRoot {
22
+ profile: IdeProfileName;
23
+ absolutePath: string;
24
+ relativeFromProject: string;
25
+ scope: 'project' | 'parent';
26
+ exists: boolean;
27
+ }
28
+ export interface IdeDiscoveryResult {
29
+ projectPath: string;
30
+ parentPath: string | null;
31
+ ideOption: IdeSelectorOption;
32
+ detectedFiles: DetectedIdeFileSummary[];
33
+ detectedSkillRoots: DetectedIdeSkillRootSummary[];
34
+ targetRuleFiles: DiscoveredRuleTarget[];
35
+ targetSkillRoots: DiscoveredSkillRoot[];
36
+ }
37
+ export interface CanonicalSkillEntry {
38
+ name: string;
39
+ projectType?: string;
40
+ sourceDir: string;
41
+ sourceSkillFile: string;
42
+ relativeSkillFile: string;
43
+ description?: string;
44
+ content: string;
45
+ sha256: string;
46
+ }
47
+ export type SyncItemStatus = 'in-sync' | 'updated' | 'created' | 'missing' | 'drifted' | 'preserved';
48
+ export interface SyncFileReport {
49
+ kind: 'adapter' | 'skill';
50
+ targetPath: string;
51
+ relativePath: string;
52
+ status: SyncItemStatus;
53
+ detail?: string;
54
+ sha256?: string;
55
+ }
56
+ export interface IdeSyncSummary {
57
+ discovery: IdeDiscoveryResult;
58
+ reports: SyncFileReport[];
59
+ updatedMirrors: Record<string, string>;
60
+ hasDrift: boolean;
61
+ }
62
+ export declare function normalizeLineEndings(content: string): string;
63
+ export declare function computeNormalizedSha256(content: string): string;
64
+ export declare function toPosixRelative(fromDir: string, targetPath: string): string;
65
+ export declare function parseSkillFrontmatter(content: string): {
66
+ name?: string;
67
+ description?: string;
68
+ };
69
+ export declare class IdeAdapterManager {
70
+ static discoverWorkspace(projectPath: string, ideOption?: IdeSelectorOption): Promise<IdeDiscoveryResult>;
71
+ static buildAdapterBlock(targetFilePath: string, projectPath: string, hasCustomFile: boolean): string;
72
+ static upsertAdapterBlock(existingContent: string | null, adapterBlock: string): string;
73
+ static collectCanonicalSkills(projectPath: string): Promise<{
74
+ canonical: CanonicalSkillEntry[];
75
+ summaries: InstalledSkillSummary[];
76
+ }>;
77
+ static syncAdaptersAndSkills(options: {
78
+ projectPath: string;
79
+ ideOption?: IdeSelectorOption;
80
+ hasCustomFile: boolean;
81
+ checkOnly?: boolean;
82
+ dryRun?: boolean;
83
+ force?: boolean;
84
+ preserveModifiedSkillTargets?: boolean;
85
+ recordedMirrors?: Record<string, string>;
86
+ skipAdapters?: boolean;
87
+ skillNames?: string[];
88
+ }): Promise<IdeSyncSummary>;
89
+ private static copySkillResourceSubdirs;
90
+ }
91
+ export {};
92
+ //# sourceMappingURL=ide-adapter.d.ts.map
@@ -1,48 +1,17 @@
1
+ import { type IdeSelectorOption } from './config.js';
2
+ export interface InitOptions {
3
+ dryRun?: boolean;
4
+ force?: boolean;
5
+ ide?: IdeSelectorOption;
6
+ }
1
7
  export declare class InitCommand {
2
- execute(targetPath?: string): Promise<void>;
8
+ execute(targetPath?: string, options?: InitOptions): Promise<void>;
9
+ private runDryRunPreview;
3
10
  private createTemplateFiles;
4
11
  /**
5
- * Migrate legacy project.md (extract technical configs to config.yaml)
12
+ * Migrate legacy project.md (extract technical configs to config.yaml without altering user prose)
6
13
  */
7
14
  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
15
  /**
47
16
  * Resolve core templates directory (same logic as skill.ts)
48
17
  */
@@ -1,10 +1,40 @@
1
1
  /**
2
2
  * HeraSpec Templates
3
3
  */
4
+ export interface DetectedIdeFileSummary {
5
+ profile: string;
6
+ label: string;
7
+ relativePath: string;
8
+ scope: 'project' | 'parent';
9
+ }
10
+ export interface DetectedIdeSkillRootSummary {
11
+ profile: string;
12
+ relativePath: string;
13
+ scope: 'project' | 'parent';
14
+ }
15
+ export interface InstalledSkillSummary {
16
+ name: string;
17
+ projectType?: string;
18
+ relativePath: string;
19
+ description?: string;
20
+ }
21
+ export interface AgentsTemplateContext {
22
+ projectName?: string;
23
+ projectTypes?: string[];
24
+ hasCustomFile?: boolean;
25
+ customFileName?: string;
26
+ detectedIdeFiles?: DetectedIdeFileSummary[];
27
+ detectedSkillRoots?: DetectedIdeSkillRootSummary[];
28
+ installedSkills?: InstalledSkillSummary[];
29
+ includeAllStacks?: boolean;
30
+ }
4
31
  export declare class TemplateManager {
5
32
  static getProjectTemplate(): string;
6
- static getAgentsTemplate(): string;
7
- static getSkillsSection(): string;
33
+ static getCustomAgentsTemplate(projectName?: string): string;
34
+ private static resolveActiveDomains;
35
+ private static buildIdeDiscoverySection;
36
+ static getAgentsTemplate(ctx?: AgentsTemplateContext): string;
37
+ static getSkillsSection(ctx?: AgentsTemplateContext): string;
8
38
  static getConfigTemplate(): string;
9
39
  }
10
40
  //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -8,4 +8,8 @@ export * from './core/list.js';
8
8
  export * from './core/archive.js';
9
9
  export * from './core/sync.js';
10
10
  export * from './core/validation/validator.js';
11
+ export * from './core/parsers/markdown-parser.js';
12
+ export * from './core/templates/index.js';
13
+ export * from './core/ide-adapter.js';
14
+ export * from './core/agents-composer.js';
11
15
  //# sourceMappingURL=index.d.ts.map