@skillbase/compiler 0.2.4 → 0.2.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/dist/index.cjs CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  canonicalToParsedSoul: () => canonicalToParsedSoul,
38
38
  compile: () => compile,
39
39
  convertVercelToSpm: () => convertVercelToSpm,
40
+ denormalizeCanonical: () => denormalizeCanonical,
40
41
  detectFormat: () => detectFormat,
41
42
  getCompiler: () => getCompiler,
42
43
  getImporter: () => getImporter,
@@ -158,16 +159,15 @@ function splitBodyIntoSections(body) {
158
159
  return { sections };
159
160
  }
160
161
  function normalizeCanonical(canonical) {
161
- const { content, sections } = canonical.instructions;
162
- if (sections && sections.length > 0) return canonical;
162
+ const { content } = canonical.instructions;
163
163
  if (!content) return canonical;
164
- const { sections: parsed } = splitBodyIntoSections(content);
165
- if (parsed.length === 0) return canonical;
164
+ const { sections } = splitBodyIntoSections(content);
165
+ if (sections.length === 0) return canonical;
166
166
  return {
167
167
  ...canonical,
168
168
  instructions: {
169
169
  content: "",
170
- sections: parsed.map((s) => ({
170
+ sections: sections.map((s) => ({
171
171
  type: "custom",
172
172
  label: s.label,
173
173
  content: s.content
@@ -175,9 +175,26 @@ function normalizeCanonical(canonical) {
175
175
  }
176
176
  };
177
177
  }
178
+ function denormalizeCanonical(canonical) {
179
+ const sections = canonical.instructions.sections ?? [];
180
+ if (sections.length === 0) return canonical;
181
+ const parts = [];
182
+ for (const s of sections) {
183
+ if (s.label) {
184
+ parts.push(`## ${s.label}
185
+
186
+ ${s.content}`);
187
+ } else if (s.content) {
188
+ parts.push(s.content);
189
+ }
190
+ }
191
+ return {
192
+ ...canonical,
193
+ instructions: { content: parts.join("\n\n") }
194
+ };
195
+ }
178
196
  function parsedSkillToCanonical(skill) {
179
197
  const fm = skill.frontmatter;
180
- const { sections } = splitBodyIntoSections(skill.body);
181
198
  const canonical = {
182
199
  meta: {
183
200
  name: fm.name,
@@ -191,12 +208,7 @@ function parsedSkillToCanonical(skill) {
191
208
  confidence: 1
192
209
  },
193
210
  instructions: {
194
- content: "",
195
- sections: sections.map((s) => ({
196
- type: "custom",
197
- label: s.label,
198
- content: s.content
199
- }))
211
+ content: skill.body
200
212
  },
201
213
  rawBody: skill.body,
202
214
  sourceFormat: "skill-md"
@@ -1774,6 +1786,7 @@ function getCompiler(target) {
1774
1786
  canonicalToParsedSoul,
1775
1787
  compile,
1776
1788
  convertVercelToSpm,
1789
+ denormalizeCanonical,
1777
1790
  detectFormat,
1778
1791
  getCompiler,
1779
1792
  getImporter,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/frontmatter.ts","../src/parse/skill-parser.ts","../src/parse/soul-parser.ts","../src/schema/skill-schema.ts","../src/schema/soul-schema.ts","../src/convert/vercel-to-spm.ts","../src/convert/legacy.ts","../src/utils/slugify.ts","../src/parse/importers/cursor-rules.ts","../src/parse/importers/cursor-mdc.ts","../src/parse/importers/claude-md.ts","../src/parse/importers/agents-md.ts","../src/parse/importers/windsurf-rules.ts","../src/parse/importers/copilot.ts","../src/parse/importers/cline.ts","../src/parse/importers/index.ts","../src/compile/utils.ts","../src/compile/skill-md.ts","../src/compile/soul-md.ts","../src/compile/cursor-mdc.ts","../src/compile/cursor-rules.ts","../src/compile/claude-md.ts","../src/compile/agents-md.ts","../src/compile/windsurf.ts","../src/compile/copilot.ts","../src/compile/cline.ts","../src/compile/index.ts"],"sourcesContent":["// Parsers\nexport {\n parseSkill,\n serializeSkill,\n SkillParseError,\n parsedSkillToCanonical,\n canonicalToParsedSkill,\n normalizeCanonical,\n} from \"./parse/skill-parser.js\";\n\nexport {\n parseSoul,\n serializeSoul,\n resolveContextSlots,\n SoulParseError,\n parsedSoulToCanonical,\n canonicalToParsedSoul,\n} from \"./parse/soul-parser.js\";\n\n// Schema validation\nexport { validateSkillFrontmatter } from \"./schema/skill-schema.js\";\nexport { validateSoulFrontmatter } from \"./schema/soul-schema.js\";\n\n// Converters\nexport {\n convertVercelToSpm,\n inferTags,\n isVercelFormat,\n} from \"./convert/vercel-to-spm.js\";\nexport type { VercelFrontmatter } from \"./convert/vercel-to-spm.js\";\n\nexport {\n legacyPersonaToSoul,\n buildLegacyBody,\n} from \"./convert/legacy.js\";\n\n// Importers\nexport {\n detectFormat,\n getImporter,\n importFromFormat,\n listImporters,\n} from \"./parse/importers/index.js\";\nexport type {\n Importer,\n ImportOptions,\n ImportResult,\n} from \"./parse/importers/types.js\";\n\n// Compilers\nexport { compile, listTargets, getCompiler } from \"./compile/index.js\";\nexport type {\n CompileTarget,\n CompileOptions,\n CompileFile,\n CompileResult,\n Compiler,\n} from \"./compile/types.js\";\n\n// Types\nexport type {\n SkillTrigger,\n SkillDependencies,\n SkillCompatibility,\n SkillWorksWithEntry,\n SkillSecurity,\n DocSource,\n SkillDocs,\n SkillFrontmatter,\n ParsedSkill,\n} from \"./types/skill.js\";\n\nexport type {\n SoulIdentityBlock,\n SoulSkillbaseBlock,\n SoulFrontmatter,\n ParsedSoul,\n} from \"./types/soul.js\";\n\nexport type {\n LegacySkillManifest,\n PersonaCharacter,\n LegacyPersonaManifest,\n} from \"./types/legacy.js\";\n\nexport type { ValidationResult } from \"./types/common.js\";\n\nexport type {\n SourceFormat,\n CanonicalMeta,\n CanonicalIdentity,\n InstructionSection,\n CanonicalInstructions,\n CanonicalConstraints,\n CanonicalScoping,\n CanonicalDependencies,\n CanonicalKnowledge,\n CanonicalSettings,\n CanonicalFormat,\n} from \"./types/canonical.js\";\n","import yaml from \"js-yaml\";\n\nconst DELIMITER = \"---\";\n\nexport function parseFrontmatter(raw: string): {\n data: Record<string, any>;\n content: string;\n} {\n const trimmed = raw.trimStart();\n if (!trimmed.startsWith(DELIMITER)) {\n return { data: {}, content: raw };\n }\n\n const end = trimmed.indexOf(`\\n${DELIMITER}`, DELIMITER.length);\n if (end === -1) {\n return { data: {}, content: raw };\n }\n\n const yamlStr = trimmed.slice(DELIMITER.length, end).trim();\n const data = yamlStr ? (yaml.load(yamlStr) as Record<string, unknown>) : {};\n const content = trimmed.slice(end + DELIMITER.length + 1).replace(/^\\n/, \"\");\n\n return { data: data ?? {}, content };\n}\n\nexport function stringifyFrontmatter(\n content: string,\n data: Record<string, unknown>,\n): string {\n const yamlStr = yaml.dump(data, { lineWidth: -1, noRefs: true }).trimEnd();\n return `---\\n${yamlStr}\\n---\\n${content}`;\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"schema_version\",\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nconst TRIGGER_REQUIRED = [\"description\", \"tags\", \"priority\"] as const;\n\nexport class SkillParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SkillParseError\";\n }\n}\n\n/**\n * Parse a SKILL.md string into frontmatter + body.\n */\nexport function parseSkill(content: string): ParsedSkill {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SkillParseError(\n `SKILL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n if (data.trigger) {\n const triggerMissing = TRIGGER_REQUIRED.filter(\n (f) => data.trigger[f] === undefined || data.trigger[f] === \"\",\n );\n if (triggerMissing.length > 0) {\n throw new SkillParseError(\n `trigger missing required fields: ${triggerMissing.join(\", \")}`,\n triggerMissing.map((f) => `trigger.${f}`),\n );\n }\n }\n\n return {\n frontmatter: data as SkillFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSkill back to SKILL.md string.\n */\nexport function serializeSkill(skill: ParsedSkill): string {\n return stringifyFrontmatter(skill.body, skill.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Split markdown body into preamble + H2 sections.\n */\nexport function splitBodyIntoSections(body: string): {\n sections: { label: string; content: string }[];\n} {\n const lines = body.split(\"\\n\");\n const sections: { label: string; content: string }[] = [];\n let currentLabel: string | null = null;\n let currentLines: string[] = [];\n\n for (const line of lines) {\n const h2Match = line.match(/^## (.+)$/);\n if (h2Match) {\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n currentLabel = h2Match[1].trim();\n currentLines = [];\n } else {\n currentLines.push(line);\n }\n }\n\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n\n return { sections };\n}\n\n/**\n * Normalize a CanonicalFormat: split instructions.content by H2 headers\n * into sections if sections are not already populated.\n */\nexport function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const { content, sections } = canonical.instructions;\n if (sections && sections.length > 0) return canonical;\n if (!content) return canonical;\n\n const { sections: parsed } = splitBodyIntoSections(content);\n if (parsed.length === 0) return canonical;\n\n return {\n ...canonical,\n instructions: {\n content: \"\",\n sections: parsed.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n };\n}\n\n/**\n * Convert a ParsedSkill to CanonicalFormat.\n */\nexport function parsedSkillToCanonical(skill: ParsedSkill): CanonicalFormat {\n const fm = skill.frontmatter;\n\n const { sections } = splitBodyIntoSections(skill.body);\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: fm.schema_version,\n language: fm.language,\n repository: fm.repository,\n confidence: 1.0,\n },\n instructions: {\n content: \"\",\n sections: sections.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n rawBody: skill.body,\n sourceFormat: \"skill-md\",\n };\n\n if (fm.trigger) {\n canonical.scoping = {\n trigger: {\n description: fm.trigger.description,\n tags: fm.trigger.tags,\n priority: fm.trigger.priority,\n },\n filePatterns: fm.trigger.file_patterns,\n };\n }\n\n if (fm.security || fm.dependencies || fm.compatibility || fm.works_with) {\n canonical.dependencies = {};\n if (fm.dependencies) {\n canonical.dependencies.skills = fm.dependencies;\n }\n if (fm.security) {\n canonical.dependencies.security = {\n permissions: fm.security.permissions,\n fileScope: fm.security.file_scope,\n };\n }\n if (fm.compatibility) {\n canonical.dependencies.compatibility = {\n minContextTokens: fm.compatibility.min_context_tokens,\n requires: fm.compatibility.requires,\n models: fm.compatibility.models,\n };\n }\n if (fm.works_with) {\n canonical.dependencies.worksWith = fm.works_with;\n }\n }\n\n if (fm.docs) {\n canonical.knowledge = {\n docSources: fm.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: fm.docs.delivery,\n priorityPages: fm.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSkill.\n */\nexport function canonicalToParsedSkill(canonical: CanonicalFormat): ParsedSkill {\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) {\n fm.language = canonical.meta.language;\n }\n if (canonical.meta.repository) {\n fm.repository = canonical.meta.repository;\n }\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSoul, SoulFrontmatter } from \"../types/soul.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nexport class SoulParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SoulParseError\";\n }\n}\n\n/**\n * Parse a SOUL.md string into frontmatter + body.\n */\nexport function parseSoul(content: string): ParsedSoul {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SoulParseError(\n `SOUL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n return {\n frontmatter: data as SoulFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSoul back to SOUL.md string.\n */\nexport function serializeSoul(soul: ParsedSoul): string {\n return stringifyFrontmatter(soul.body, soul.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Replace {{PLACEHOLDER}} tokens in body with provided values.\n */\nexport function resolveContextSlots(\n body: string,\n values: Record<string, string>,\n): string {\n return body.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) => {\n return values[key] ?? match;\n });\n}\n\n/**\n * Convert a ParsedSoul to CanonicalFormat.\n */\nexport function parsedSoulToCanonical(soul: ParsedSoul): CanonicalFormat {\n const fm = soul.frontmatter;\n const sb = fm.skillbase;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: sb?.schema_version ?? 3,\n confidence: 1.0,\n },\n instructions: {\n content: soul.body,\n },\n rawBody: soul.body,\n sourceFormat: \"soul-md\",\n };\n\n if (sb?.trigger) {\n canonical.scoping = {\n trigger: {\n description: sb.trigger.description,\n tags: sb.trigger.tags,\n priority: sb.trigger.priority,\n },\n filePatterns: sb.trigger.file_patterns,\n };\n }\n\n if (sb?.skills) {\n canonical.dependencies = {\n ...canonical.dependencies,\n skills: sb.skills,\n };\n }\n\n if (sb?.constraints) {\n canonical.constraints = {\n always: sb.constraints.always,\n never: sb.constraints.never,\n };\n }\n\n if (sb?.identity) {\n canonical.identity = {\n role: sb.identity.role,\n tone: sb.identity.tone,\n expertise: sb.identity.expertise,\n };\n }\n\n if (sb?.settings) {\n canonical.settings = { ...sb.settings };\n }\n\n if (sb?.docs) {\n canonical.knowledge = {\n docSources: sb.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: sb.docs.delivery,\n priorityPages: sb.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSoul.\n */\nexport function canonicalToParsedSoul(canonical: CanonicalFormat): ParsedSoul {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst skillFrontmatterSchema = {\n type: \"object\" as const,\n required: [\n \"schema_version\",\n \"name\",\n \"version\",\n \"description\",\n \"author\",\n \"license\",\n ],\n additionalProperties: false,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n language: { type: \"string\" as const, enum: [\"en\"], nullable: true },\n description: { type: \"string\" as const, minLength: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n additionalProperties: false,\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n file_patterns: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n dependencies: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n compatibility: {\n type: \"object\" as const,\n nullable: true,\n required: [\"min_context_tokens\", \"requires\", \"models\"],\n additionalProperties: false,\n properties: {\n min_context_tokens: { type: \"integer\" as const, minimum: 0 },\n requires: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n models: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n },\n },\n works_with: {\n type: \"array\" as const,\n nullable: true,\n items: {\n type: \"object\" as const,\n required: [\"skill\", \"relationship\", \"description\"],\n additionalProperties: false,\n properties: {\n skill: { type: \"string\" as const },\n relationship: {\n type: \"string\" as const,\n enum: [\"input\", \"output\", \"parallel\"],\n },\n description: { type: \"string\" as const },\n },\n },\n },\n security: {\n type: \"object\" as const,\n nullable: true,\n required: [\"permissions\"],\n additionalProperties: false,\n properties: {\n permissions: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n file_scope: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n integrity: { type: \"string\" as const, nullable: true },\n },\n },\n docs: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: false,\n properties: {\n sources: {\n type: \"array\" as const,\n items: {\n type: \"object\" as const,\n required: [\"type\", \"url\"],\n additionalProperties: false,\n properties: {\n type: {\n type: \"string\" as const,\n enum: [\"url\", \"llms-txt\", \"github\"],\n },\n url: { type: \"string\" as const, minLength: 1 },\n scope: {\n type: \"string\" as const,\n enum: [\"crawl\", \"page\", \"sitemap\"],\n nullable: true,\n },\n depth: {\n type: \"integer\" as const,\n minimum: 0,\n maximum: 5,\n nullable: true,\n },\n include: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n exclude: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n label: { type: \"string\" as const, nullable: true },\n blocks: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n snapshot_version: { type: \"string\" as const, nullable: true },\n max_tokens: {\n type: \"integer\" as const,\n minimum: 0,\n nullable: true,\n },\n },\n },\n },\n delivery: {\n type: \"string\" as const,\n enum: [\"local\", \"remote\", \"auto\"],\n nullable: true,\n },\n priority_pages: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n },\n },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n repository: { type: \"string\" as const, nullable: true },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(skillFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSkillFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst soulFrontmatterSchema = {\n type: \"object\" as const,\n required: [\"name\", \"version\", \"author\", \"license\", \"description\"],\n additionalProperties: true,\n properties: {\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n description: { type: \"string\" as const, minLength: 1 },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n skillbase: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: true,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n skills: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n settings: {\n type: \"object\" as const,\n nullable: true,\n properties: {\n temperature: { type: \"number\" as const, minimum: 0, maximum: 2 },\n top_p: { type: \"number\" as const, minimum: 0, maximum: 1 },\n },\n },\n },\n },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(soulFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSoulFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\n\nexport interface VercelFrontmatter {\n name: string;\n description: string;\n license?: string;\n metadata?: Record<string, unknown>;\n \"allowed-tools\"?: string[];\n \"user-invocable\"?: boolean;\n [key: string]: unknown;\n}\n\nconst STOP_WORDS = new Set([\n \"a\", \"an\", \"the\", \"and\", \"or\", \"for\", \"to\", \"in\", \"on\", \"of\", \"is\", \"it\",\n \"with\", \"that\", \"this\", \"use\", \"when\", \"how\", \"what\", \"your\", \"you\",\n]);\n\nexport function inferTags(name: string, description: string): string[] {\n const tags = new Set<string>();\n\n for (const token of name.split(\"-\")) {\n if (token.length > 1 && !STOP_WORDS.has(token)) {\n tags.add(token);\n }\n }\n\n const words = description\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .split(/\\s+/)\n .filter((w) => w.length > 2 && !STOP_WORDS.has(w));\n\n for (const word of words.slice(0, 10)) {\n if (tags.size >= 8) break;\n tags.add(word);\n }\n\n if (tags.size === 0) {\n tags.add(name);\n }\n\n return [...tags].slice(0, 8);\n}\n\nconst TOOL_TO_PERMISSION: Record<string, string> = {\n bash: \"bash:execute\",\n file_read: \"file:read\",\n file_write: \"file:write\",\n web_fetch: \"network:allowlist\",\n terminal: \"bash:execute\",\n shell: \"bash:execute\",\n};\n\nfunction mapPermissions(allowedTools?: string[]): string[] {\n if (!allowedTools || allowedTools.length === 0) return [];\n\n const permissions: string[] = [];\n for (const tool of allowedTools) {\n const normalized = tool.toLowerCase().replace(/-/g, \"_\");\n const mapped = TOOL_TO_PERMISSION[normalized];\n if (mapped && !permissions.includes(mapped)) {\n permissions.push(mapped);\n }\n }\n return permissions;\n}\n\nexport function isVercelFormat(data: Record<string, unknown>): boolean {\n return (\n !data.schema_version &&\n typeof data.name === \"string\" &&\n typeof data.description === \"string\"\n );\n}\n\nexport function convertVercelToSpm(\n vercel: VercelFrontmatter,\n body: string,\n options: { author: string; license?: string; repository?: string },\n): ParsedSkill {\n const name = vercel.name\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n\n const frontmatter: SkillFrontmatter = {\n schema_version: 3,\n name,\n version: \"1.0.0\",\n author: options.author,\n license: vercel.license || options.license || \"MIT\",\n description: vercel.description,\n language: \"en\",\n trigger: {\n description: vercel.description,\n tags: inferTags(name, vercel.description),\n priority: 50,\n },\n security: {\n permissions: mapPermissions(vercel[\"allowed-tools\"]),\n },\n };\n\n if (options.repository) {\n frontmatter.repository = options.repository;\n }\n\n return { frontmatter, body: body.trim() };\n}\n","import type { SoulFrontmatter, SoulSkillbaseBlock } from \"../types/soul.js\";\nimport type { LegacyPersonaManifest } from \"../types/legacy.js\";\n\n/**\n * Convert a legacy PersonaManifest to SoulFrontmatter.\n */\nexport function legacyPersonaToSoul(\n manifest: LegacyPersonaManifest,\n): SoulFrontmatter {\n const soul: SoulFrontmatter = {\n name: manifest.name,\n version: manifest.version,\n author: manifest.author,\n license: manifest.license,\n description: manifest.description,\n };\n\n const skillbase: SoulSkillbaseBlock = {\n schema_version: 3,\n };\n\n if (manifest.skills && Object.keys(manifest.skills).length > 0) {\n skillbase.skills = manifest.skills;\n }\n\n if (manifest.settings) {\n skillbase.settings = manifest.settings;\n }\n\n soul.skillbase = skillbase;\n return soul;\n}\n\n/**\n * Build markdown body from legacy persona character fields.\n */\nexport function buildLegacyBody(manifest: LegacyPersonaManifest): string {\n const parts: string[] = [];\n\n parts.push(`## Role\\n\\n${manifest.character.role}`);\n\n if (manifest.character.tone) {\n parts.push(`## Tone\\n\\n${manifest.character.tone}`);\n }\n\n if (\n manifest.character.guidelines &&\n manifest.character.guidelines.length > 0\n ) {\n const items = manifest.character.guidelines.map((g) => `- ${g}`).join(\"\\n\");\n parts.push(`## Guidelines\\n\\n${items}`);\n }\n\n if (manifest.character.instructions) {\n parts.push(`## Instructions\\n\\n${manifest.character.instructions}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n","/**\n * Convert a string to a valid skill name slug.\n */\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n || \"unnamed\";\n}\n\n/**\n * Extract a meaningful name from a filename.\n * \"CLAUDE.md\" → \"claude\", \".cursorrules\" → \"cursorrules\", \"api-rules.mdc\" → \"api-rules\"\n */\nexport function extractName(filename: string): string {\n const base = filename.split(\"/\").pop() ?? filename;\n return base\n .replace(/^\\./, \"\")\n .replace(/\\.(md|mdc|txt|instructions\\.md)$/i, \"\")\n .replace(/^(CLAUDE|AGENTS|copilot-instructions)$/i, (m) =>\n m.toLowerCase(),\n );\n}\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for legacy .cursorrules files.\n * Plain markdown, no frontmatter. Everything is instructions.\n */\nexport const cursorRulesImporter: Importer = {\n id: \"cursor-rules\",\n name: \"Cursor Rules (legacy)\",\n filePatterns: [\".cursorrules\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n if (!trimmed) {\n warnings.push(\"Empty .cursorrules file\");\n }\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cursor-rules\";\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from .cursorrules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-rules\",\n };\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface MdcFrontmatter {\n description?: string;\n globs?: string;\n alwaysApply?: boolean;\n}\n\n/**\n * Importer for Cursor MDC (.mdc) rule files.\n * YAML frontmatter with description, globs, alwaysApply + markdown body.\n */\nexport const cursorMdcImporter: Importer = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC Rules\",\n filePatterns: [\".cursor/rules/*.mdc\", \"*.mdc\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as MdcFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-mdc-rule\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cursor MDC\",\n schemaVersion: 3,\n confidence: 0.6,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-mdc\",\n };\n\n // Map globs to scoping\n if (fm.globs || fm.alwaysApply !== undefined) {\n canonical.scoping = {};\n if (fm.globs) {\n canonical.scoping.globs = fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean);\n }\n if (fm.description) {\n canonical.scoping.trigger = {\n description: fm.description,\n tags: [],\n priority: fm.alwaysApply ? 90 : 50,\n };\n }\n }\n\n if (!fm.description) {\n reviewNeeded.push(\"meta.description\");\n }\n reviewNeeded.push(\"meta.name\", \"identity\", \"constraints\");\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClaudeMdFrontmatter {\n paths?: string[];\n}\n\n/**\n * Importer for CLAUDE.md files.\n * Plain markdown, optionally with paths frontmatter (for .claude/rules/*.md).\n */\nexport const claudeMdImporter: Importer = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n filePatterns: [\"CLAUDE.md\", \".claude/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClaudeMdFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-claude-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from CLAUDE.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"claude-md\",\n };\n\n // Map paths to scoping\n if (fm.paths && fm.paths.length > 0) {\n canonical.scoping = {\n globs: fm.paths,\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for AGENTS.md files (GitHub Copilot coding agents).\n * Plain markdown, no frontmatter.\n */\nexport const agentsMdImporter: Importer = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n filePatterns: [\"AGENTS.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-agents-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from AGENTS.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"agents-md\",\n };\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface WindsurfFrontmatter {\n trigger?: \"always_on\" | \"model_decision\" | \"manual\" | \"glob\";\n globs?: string;\n description?: string;\n}\n\n/**\n * Importer for Windsurf rules.\n * .windsurfrules (legacy, plain text) or .windsurf/rules/*.md (with frontmatter).\n */\nexport const windsurfRulesImporter: Importer = {\n id: \"windsurf-rules\",\n name: \"Windsurf Rules\",\n filePatterns: [\".windsurfrules\", \".windsurf/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as WindsurfFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-windsurf-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Windsurf rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"windsurf-rules\",\n };\n\n if (fm.trigger === \"glob\" && fm.globs) {\n canonical.scoping = {\n globs: fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface CopilotFrontmatter {\n applyTo?: string;\n}\n\n/**\n * Importer for GitHub Copilot instructions.\n * copilot-instructions.md (no frontmatter) or *.instructions.md (with applyTo frontmatter).\n */\nexport const copilotImporter: Importer = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n filePatterns: [\n \".github/copilot-instructions.md\",\n \".github/instructions/*.instructions.md\",\n ],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as CopilotFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-copilot\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from Copilot instructions\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"copilot\",\n };\n\n if (fm.applyTo) {\n canonical.scoping = {\n globs: [fm.applyTo],\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClineFrontmatter {\n description?: string;\n globs?: string;\n paths?: string[];\n}\n\n/**\n * Importer for Cline rules.\n * Single .clinerules file (plain text) or .clinerules/*.md (with optional frontmatter).\n */\nexport const clineImporter: Importer = {\n id: \"cline\",\n name: \"Cline Rules\",\n filePatterns: [\".clinerules\", \".clinerules/*.md\", \".clinerules/*.txt\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClineFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cline-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cline rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cline\",\n };\n\n // Map glob patterns to scoping\n const globs: string[] = [];\n if (fm.globs) {\n globs.push(\n ...fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n );\n }\n if (fm.paths) {\n globs.push(...fm.paths);\n }\n if (globs.length > 0) {\n canonical.scoping = { globs };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { SourceFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { cursorRulesImporter } from \"./cursor-rules.js\";\nimport { cursorMdcImporter } from \"./cursor-mdc.js\";\nimport { claudeMdImporter } from \"./claude-md.js\";\nimport { agentsMdImporter } from \"./agents-md.js\";\nimport { windsurfRulesImporter } from \"./windsurf-rules.js\";\nimport { copilotImporter } from \"./copilot.js\";\nimport { clineImporter } from \"./cline.js\";\n\nconst importers: Importer[] = [\n cursorRulesImporter,\n cursorMdcImporter,\n claudeMdImporter,\n agentsMdImporter,\n windsurfRulesImporter,\n copilotImporter,\n clineImporter,\n];\n\n/**\n * Detect format from filename.\n */\nexport function detectFormat(filename: string): SourceFormat | null {\n const lower = filename.toLowerCase();\n const base = lower.split(\"/\").pop() ?? lower;\n\n if (base === \".cursorrules\") return \"cursor-rules\";\n if (base.endsWith(\".mdc\")) return \"cursor-mdc\";\n if (base === \"claude.md\") return \"claude-md\";\n if (base === \"agents.md\") return \"agents-md\";\n if (base === \".windsurfrules\") return \"windsurf-rules\";\n if (lower.includes(\".windsurf/rules/\")) return \"windsurf-rules\";\n if (base === \"copilot-instructions.md\") return \"copilot\";\n if (base.endsWith(\".instructions.md\")) return \"copilot\";\n if (base === \".clinerules\") return \"cline\";\n if (lower.includes(\".clinerules/\")) return \"cline\";\n if (lower.includes(\".claude/rules/\")) return \"claude-md\";\n\n return null;\n}\n\n/**\n * Get importer by format ID.\n */\nexport function getImporter(format: SourceFormat): Importer | null {\n return importers.find((i) => i.id === format) ?? null;\n}\n\n/**\n * Import content from a foreign format.\n */\nexport function importFromFormat(\n content: string,\n format: SourceFormat,\n options?: ImportOptions,\n): ImportResult {\n const importer = getImporter(format);\n if (!importer) {\n throw new Error(`No importer for format: ${format}`);\n }\n return importer.import(content, options);\n}\n\n/**\n * List all available importers.\n */\nexport function listImporters(): Importer[] {\n return [...importers];\n}\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { CompileOptions } from \"./types.js\";\n\n/**\n * Build inline knowledge section from knowledge blocks.\n */\nexport function buildKnowledgeSection(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string | null {\n const blocks = options?.knowledgeBlocks ?? canonical.knowledge?.inlineBlocks;\n if (!blocks || blocks.length === 0 || !options?.inlineKnowledge) {\n return null;\n }\n\n const parts = [\"## Reference Documentation\", \"\"];\n for (const block of blocks) {\n parts.push(`### ${block.label}`, \"\", block.content, \"\");\n }\n\n return parts.join(\"\\n\").trimEnd();\n}\n\n/**\n * Build a flat markdown body from canonical format for targets\n * that don't support structured frontmatter.\n */\nexport function buildFlatBody(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string {\n const parts: string[] = [];\n\n // Identity preamble\n if (canonical.identity) {\n if (canonical.identity.role) {\n parts.push(canonical.identity.role, \"\");\n }\n if (canonical.identity.tone) {\n parts.push(`Tone: ${canonical.identity.tone}`, \"\");\n }\n }\n\n // Main instructions\n parts.push(canonical.rawBody ?? canonical.instructions.content);\n\n // Constraints\n if (canonical.constraints) {\n if (\n canonical.constraints.always &&\n canonical.constraints.always.length > 0\n ) {\n parts.push(\n \"\",\n \"## Always\",\n \"\",\n ...canonical.constraints.always.map((c) => `- ${c}`),\n );\n }\n if (canonical.constraints.never && canonical.constraints.never.length > 0) {\n parts.push(\n \"\",\n \"## Never\",\n \"\",\n ...canonical.constraints.never.map((c) => `- ${c}`),\n );\n }\n }\n\n // Inline knowledge\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n parts.push(\"\", knowledgeSection);\n }\n\n return parts.join(\"\\n\").trim();\n}\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SkillFrontmatter } from \"../types/skill.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nfunction buildBody(canonical: CanonicalFormat): string {\n const parts: string[] = [];\n\n // Identity block\n if (canonical.identity) {\n const id = canonical.identity;\n const lines: string[] = [];\n if (id.role) lines.push(id.role);\n if (id.expertise?.length) lines.push(`**Expertise:** ${id.expertise.join(\", \")}`);\n if (id.tone) lines.push(`**Tone:** ${id.tone}`);\n if (lines.length) parts.push(lines.join(\"\\n\"));\n }\n\n // Instructions content (fallback for canonicals without sections)\n if (canonical.instructions.content) {\n parts.push(canonical.instructions.content);\n }\n\n // Instruction sections\n const sections = canonical.instructions.sections ?? [];\n for (const s of sections) {\n if (s.label || s.content) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else {\n parts.push(s.content);\n }\n }\n }\n\n // Constraints\n if (canonical.constraints) {\n const lines: string[] = [];\n if (canonical.constraints.always?.length) {\n lines.push(\"**Always:**\");\n for (const r of canonical.constraints.always) lines.push(`- ${r}`);\n }\n if (canonical.constraints.never?.length) {\n if (lines.length) lines.push(\"\");\n lines.push(\"**Never:**\");\n for (const r of canonical.constraints.never) lines.push(`- ${r}`);\n }\n if (lines.length) parts.push(`## Constraints\\n\\n${lines.join(\"\\n\")}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n\nexport const skillMdCompiler: Compiler = {\n id: \"skill-md\",\n name: \"SKILL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const warnings: string[] = [];\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) fm.language = canonical.meta.language;\n if (canonical.meta.repository) fm.repository = canonical.meta.repository;\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n let body = buildBody(canonical);\n\n // Append inline knowledge if requested\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SKILL.md\", content }],\n droppedFeatures: [],\n warnings,\n };\n },\n};\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SoulFrontmatter } from \"../types/soul.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nexport const soulMdCompiler: Compiler = {\n id: \"soul-md\",\n name: \"SOUL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n let body = canonical.rawBody ?? canonical.instructions.content;\n\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SOUL.md\", content }],\n droppedFeatures: [],\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorMdcCompiler: Compiler = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC (.mdc)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n\n // Build MDC frontmatter\n const description =\n canonical.scoping?.trigger?.description ?? canonical.meta.description;\n const globs =\n canonical.scoping?.globs ??\n canonical.scoping?.filePatterns ??\n [];\n const alwaysApply = globs.length === 0;\n\n const fmLines = [\n \"---\",\n `description: ${description}`,\n `globs: ${globs.join(\", \") || \"\"}`,\n `alwaysApply: ${alwaysApply}`,\n \"---\",\n ];\n\n const body = buildFlatBody(canonical, options);\n const content = fmLines.join(\"\\n\") + \"\\n\\n\" + body;\n\n const filename = canonical.meta.name + \".mdc\";\n const path = options?.basePath\n ? `${options.basePath}/${filename}`\n : `.cursor/rules/${filename}`;\n\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorRulesCompiler: Compiler = {\n id: \"cursor-rules\",\n name: \".cursorrules (legacy)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger || canonical.scoping?.filePatterns) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".cursorrules\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const claudeMdCompiler: Compiler = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"CLAUDE.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const agentsMdCompiler: Compiler = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"AGENTS.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nconst MAX_CHARS = 6000;\n\nexport const windsurfCompiler: Compiler = {\n id: \"windsurf\",\n name: \"Windsurf Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const warnings: string[] = [];\n let content = buildFlatBody(canonical, options);\n\n if (content.length > MAX_CHARS) {\n warnings.push(\n `Content truncated from ${content.length} to ${MAX_CHARS} characters (.windsurfrules limit)`,\n );\n content = content.slice(0, MAX_CHARS);\n }\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".windsurfrules\", content }],\n droppedFeatures,\n warnings,\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const copilotCompiler: Compiler = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [\n { path: \".github/copilot-instructions.md\", content },\n ],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const clineCompiler: Compiler = {\n id: \"cline\",\n name: \"Cline Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n const filename = canonical.meta.name + \".md\";\n\n return {\n files: [{ path: `.clinerules/${filename}`, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type {\n Compiler,\n CompileTarget,\n CompileResult,\n CompileOptions,\n} from \"./types.js\";\n\nimport { skillMdCompiler } from \"./skill-md.js\";\nimport { soulMdCompiler } from \"./soul-md.js\";\nimport { cursorMdcCompiler } from \"./cursor-mdc.js\";\nimport { cursorRulesCompiler } from \"./cursor-rules.js\";\nimport { claudeMdCompiler } from \"./claude-md.js\";\nimport { agentsMdCompiler } from \"./agents-md.js\";\nimport { windsurfCompiler } from \"./windsurf.js\";\nimport { copilotCompiler } from \"./copilot.js\";\nimport { clineCompiler } from \"./cline.js\";\n\nconst compilers: Compiler[] = [\n skillMdCompiler,\n soulMdCompiler,\n cursorMdcCompiler,\n cursorRulesCompiler,\n claudeMdCompiler,\n agentsMdCompiler,\n windsurfCompiler,\n copilotCompiler,\n clineCompiler,\n];\n\n/**\n * Compile a CanonicalFormat to a target format.\n */\nexport function compile(\n canonical: CanonicalFormat,\n target: CompileTarget,\n options?: CompileOptions,\n): CompileResult {\n const compiler = compilers.find((c) => c.id === target);\n if (!compiler) {\n throw new Error(`No compiler for target: ${target}`);\n }\n return compiler.compile(canonical, options);\n}\n\n/**\n * List all available compile targets.\n */\nexport function listTargets(): Compiler[] {\n return [...compilers];\n}\n\n/**\n * Get a compiler by target ID.\n */\nexport function getCompiler(target: CompileTarget): Compiler | null {\n return compilers.find((c) => c.id === target) ?? null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,qBAAiB;AAEjB,IAAM,YAAY;AAEX,SAAS,iBAAiB,KAG/B;AACA,QAAM,UAAU,IAAI,UAAU;AAC9B,MAAI,CAAC,QAAQ,WAAW,SAAS,GAAG;AAClC,WAAO,EAAE,MAAM,CAAC,GAAG,SAAS,IAAI;AAAA,EAClC;AAEA,QAAM,MAAM,QAAQ,QAAQ;AAAA,EAAK,SAAS,IAAI,UAAU,MAAM;AAC9D,MAA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AM,WAAW,UAAU,KAAK,OAAO;AAEvC,WAAO;AAAA,MACL,OAAO,CAAC,EAAE,MAAM,eAAe,QAAQ,IAAI,QAAQ,CAAC;AAAA,MACpD;AAAA,MACA,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AACF;;;ACrBA,IAAM,YAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,SAAS,QACd,WACA,QACA,SACe;AACf,QAAM,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM;AACtD,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,2BAA2B,MAAM,EAAE;AAAA,EACrD;AACA,SAAO,SAAS,QAAQ,WAAW,OAAO;AAC5C;AAKO,SAAS,cAA0B;AACxC,SAAO,CAAC,GAAG,SAAS;AACtB;AAKO,SAAS,YAAY,QAAwC;AAClE,SAAO,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,KAAK;AACnD;","names":["yaml","text","REQUIRED_FIELDS","Ajv","import_ajv","ajv","Ajv","validateFn","validateFn"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/frontmatter.ts","../src/parse/skill-parser.ts","../src/parse/soul-parser.ts","../src/schema/skill-schema.ts","../src/schema/soul-schema.ts","../src/convert/vercel-to-spm.ts","../src/convert/legacy.ts","../src/utils/slugify.ts","../src/parse/importers/cursor-rules.ts","../src/parse/importers/cursor-mdc.ts","../src/parse/importers/claude-md.ts","../src/parse/importers/agents-md.ts","../src/parse/importers/windsurf-rules.ts","../src/parse/importers/copilot.ts","../src/parse/importers/cline.ts","../src/parse/importers/index.ts","../src/compile/utils.ts","../src/compile/skill-md.ts","../src/compile/soul-md.ts","../src/compile/cursor-mdc.ts","../src/compile/cursor-rules.ts","../src/compile/claude-md.ts","../src/compile/agents-md.ts","../src/compile/windsurf.ts","../src/compile/copilot.ts","../src/compile/cline.ts","../src/compile/index.ts"],"sourcesContent":["// Parsers\nexport {\n parseSkill,\n serializeSkill,\n SkillParseError,\n parsedSkillToCanonical,\n canonicalToParsedSkill,\n normalizeCanonical,\n denormalizeCanonical,\n} from \"./parse/skill-parser.js\";\n\nexport {\n parseSoul,\n serializeSoul,\n resolveContextSlots,\n SoulParseError,\n parsedSoulToCanonical,\n canonicalToParsedSoul,\n} from \"./parse/soul-parser.js\";\n\n// Schema validation\nexport { validateSkillFrontmatter } from \"./schema/skill-schema.js\";\nexport { validateSoulFrontmatter } from \"./schema/soul-schema.js\";\n\n// Converters\nexport {\n convertVercelToSpm,\n inferTags,\n isVercelFormat,\n} from \"./convert/vercel-to-spm.js\";\nexport type { VercelFrontmatter } from \"./convert/vercel-to-spm.js\";\n\nexport {\n legacyPersonaToSoul,\n buildLegacyBody,\n} from \"./convert/legacy.js\";\n\n// Importers\nexport {\n detectFormat,\n getImporter,\n importFromFormat,\n listImporters,\n} from \"./parse/importers/index.js\";\nexport type {\n Importer,\n ImportOptions,\n ImportResult,\n} from \"./parse/importers/types.js\";\n\n// Compilers\nexport { compile, listTargets, getCompiler } from \"./compile/index.js\";\nexport type {\n CompileTarget,\n CompileOptions,\n CompileFile,\n CompileResult,\n Compiler,\n} from \"./compile/types.js\";\n\n// Types\nexport type {\n SkillTrigger,\n SkillDependencies,\n SkillCompatibility,\n SkillWorksWithEntry,\n SkillSecurity,\n DocSource,\n SkillDocs,\n SkillFrontmatter,\n ParsedSkill,\n} from \"./types/skill.js\";\n\nexport type {\n SoulIdentityBlock,\n SoulSkillbaseBlock,\n SoulFrontmatter,\n ParsedSoul,\n} from \"./types/soul.js\";\n\nexport type {\n LegacySkillManifest,\n PersonaCharacter,\n LegacyPersonaManifest,\n} from \"./types/legacy.js\";\n\nexport type { ValidationResult } from \"./types/common.js\";\n\nexport type {\n SourceFormat,\n CanonicalMeta,\n CanonicalIdentity,\n InstructionSection,\n CanonicalInstructions,\n CanonicalConstraints,\n CanonicalScoping,\n CanonicalDependencies,\n CanonicalKnowledge,\n CanonicalSettings,\n CanonicalFormat,\n} from \"./types/canonical.js\";\n","import yaml from \"js-yaml\";\n\nconst DELIMITER = \"---\";\n\nexport function parseFrontmatter(raw: string): {\n data: Record<string, any>;\n content: string;\n} {\n const trimmed = raw.trimStart();\n if (!trimmed.startsWith(DELIMITER)) {\n return { data: {}, content: raw };\n }\n\n const end = trimmed.indexOf(`\\n${DELIMITER}`, DELIMITER.length);\n if (end === -1) {\n return { data: {}, content: raw };\n }\n\n const yamlStr = trimmed.slice(DELIMITER.length, end).trim();\n const data = yamlStr ? (yaml.load(yamlStr) as Record<string, unknown>) : {};\n const content = trimmed.slice(end + DELIMITER.length + 1).replace(/^\\n/, \"\");\n\n return { data: data ?? {}, content };\n}\n\nexport function stringifyFrontmatter(\n content: string,\n data: Record<string, unknown>,\n): string {\n const yamlStr = yaml.dump(data, { lineWidth: -1, noRefs: true }).trimEnd();\n return `---\\n${yamlStr}\\n---\\n${content}`;\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"schema_version\",\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nconst TRIGGER_REQUIRED = [\"description\", \"tags\", \"priority\"] as const;\n\nexport class SkillParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SkillParseError\";\n }\n}\n\n/**\n * Parse a SKILL.md string into frontmatter + body.\n */\nexport function parseSkill(content: string): ParsedSkill {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SkillParseError(\n `SKILL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n if (data.trigger) {\n const triggerMissing = TRIGGER_REQUIRED.filter(\n (f) => data.trigger[f] === undefined || data.trigger[f] === \"\",\n );\n if (triggerMissing.length > 0) {\n throw new SkillParseError(\n `trigger missing required fields: ${triggerMissing.join(\", \")}`,\n triggerMissing.map((f) => `trigger.${f}`),\n );\n }\n }\n\n return {\n frontmatter: data as SkillFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSkill back to SKILL.md string.\n */\nexport function serializeSkill(skill: ParsedSkill): string {\n return stringifyFrontmatter(skill.body, skill.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Split markdown body into preamble + H2 sections.\n */\nexport function splitBodyIntoSections(body: string): {\n sections: { label: string; content: string }[];\n} {\n const lines = body.split(\"\\n\");\n const sections: { label: string; content: string }[] = [];\n let currentLabel: string | null = null;\n let currentLines: string[] = [];\n\n for (const line of lines) {\n const h2Match = line.match(/^## (.+)$/);\n if (h2Match) {\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n currentLabel = h2Match[1].trim();\n currentLines = [];\n } else {\n currentLines.push(line);\n }\n }\n\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n\n return { sections };\n}\n\n/**\n * Normalize a CanonicalFormat: split instructions.content by H2 headers\n * into sections if sections are not already populated.\n */\n/**\n * Normalize: always parse instructions.content into sections for UI.\n * Sections are never stored — they are derived from content.\n */\nexport function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const { content } = canonical.instructions;\n if (!content) return canonical;\n\n const { sections } = splitBodyIntoSections(content);\n if (sections.length === 0) return canonical;\n\n return {\n ...canonical,\n instructions: {\n content: \"\",\n sections: sections.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n };\n}\n\n/**\n * Denormalize: merge sections back into flat content for storage.\n */\nexport function denormalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const sections = canonical.instructions.sections ?? [];\n if (sections.length === 0) return canonical;\n\n const parts: string[] = [];\n for (const s of sections) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else if (s.content) {\n parts.push(s.content);\n }\n }\n\n return {\n ...canonical,\n instructions: { content: parts.join(\"\\n\\n\") },\n };\n}\n\n/**\n * Convert a ParsedSkill to CanonicalFormat.\n */\nexport function parsedSkillToCanonical(skill: ParsedSkill): CanonicalFormat {\n const fm = skill.frontmatter;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: fm.schema_version,\n language: fm.language,\n repository: fm.repository,\n confidence: 1.0,\n },\n instructions: {\n content: skill.body,\n },\n rawBody: skill.body,\n sourceFormat: \"skill-md\",\n };\n\n if (fm.trigger) {\n canonical.scoping = {\n trigger: {\n description: fm.trigger.description,\n tags: fm.trigger.tags,\n priority: fm.trigger.priority,\n },\n filePatterns: fm.trigger.file_patterns,\n };\n }\n\n if (fm.security || fm.dependencies || fm.compatibility || fm.works_with) {\n canonical.dependencies = {};\n if (fm.dependencies) {\n canonical.dependencies.skills = fm.dependencies;\n }\n if (fm.security) {\n canonical.dependencies.security = {\n permissions: fm.security.permissions,\n fileScope: fm.security.file_scope,\n };\n }\n if (fm.compatibility) {\n canonical.dependencies.compatibility = {\n minContextTokens: fm.compatibility.min_context_tokens,\n requires: fm.compatibility.requires,\n models: fm.compatibility.models,\n };\n }\n if (fm.works_with) {\n canonical.dependencies.worksWith = fm.works_with;\n }\n }\n\n if (fm.docs) {\n canonical.knowledge = {\n docSources: fm.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: fm.docs.delivery,\n priorityPages: fm.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSkill.\n */\nexport function canonicalToParsedSkill(canonical: CanonicalFormat): ParsedSkill {\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) {\n fm.language = canonical.meta.language;\n }\n if (canonical.meta.repository) {\n fm.repository = canonical.meta.repository;\n }\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSoul, SoulFrontmatter } from \"../types/soul.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nexport class SoulParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SoulParseError\";\n }\n}\n\n/**\n * Parse a SOUL.md string into frontmatter + body.\n */\nexport function parseSoul(content: string): ParsedSoul {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SoulParseError(\n `SOUL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n return {\n frontmatter: data as SoulFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSoul back to SOUL.md string.\n */\nexport function serializeSoul(soul: ParsedSoul): string {\n return stringifyFrontmatter(soul.body, soul.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Replace {{PLACEHOLDER}} tokens in body with provided values.\n */\nexport function resolveContextSlots(\n body: string,\n values: Record<string, string>,\n): string {\n return body.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) => {\n return values[key] ?? match;\n });\n}\n\n/**\n * Convert a ParsedSoul to CanonicalFormat.\n */\nexport function parsedSoulToCanonical(soul: ParsedSoul): CanonicalFormat {\n const fm = soul.frontmatter;\n const sb = fm.skillbase;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: sb?.schema_version ?? 3,\n confidence: 1.0,\n },\n instructions: {\n content: soul.body,\n },\n rawBody: soul.body,\n sourceFormat: \"soul-md\",\n };\n\n if (sb?.trigger) {\n canonical.scoping = {\n trigger: {\n description: sb.trigger.description,\n tags: sb.trigger.tags,\n priority: sb.trigger.priority,\n },\n filePatterns: sb.trigger.file_patterns,\n };\n }\n\n if (sb?.skills) {\n canonical.dependencies = {\n ...canonical.dependencies,\n skills: sb.skills,\n };\n }\n\n if (sb?.constraints) {\n canonical.constraints = {\n always: sb.constraints.always,\n never: sb.constraints.never,\n };\n }\n\n if (sb?.identity) {\n canonical.identity = {\n role: sb.identity.role,\n tone: sb.identity.tone,\n expertise: sb.identity.expertise,\n };\n }\n\n if (sb?.settings) {\n canonical.settings = { ...sb.settings };\n }\n\n if (sb?.docs) {\n canonical.knowledge = {\n docSources: sb.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: sb.docs.delivery,\n priorityPages: sb.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSoul.\n */\nexport function canonicalToParsedSoul(canonical: CanonicalFormat): ParsedSoul {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst skillFrontmatterSchema = {\n type: \"object\" as const,\n required: [\n \"schema_version\",\n \"name\",\n \"version\",\n \"description\",\n \"author\",\n \"license\",\n ],\n additionalProperties: false,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n language: { type: \"string\" as const, enum: [\"en\"], nullable: true },\n description: { type: \"string\" as const, minLength: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n additionalProperties: false,\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n file_patterns: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n dependencies: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n compatibility: {\n type: \"object\" as const,\n nullable: true,\n required: [\"min_context_tokens\", \"requires\", \"models\"],\n additionalProperties: false,\n properties: {\n min_context_tokens: { type: \"integer\" as const, minimum: 0 },\n requires: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n models: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n },\n },\n works_with: {\n type: \"array\" as const,\n nullable: true,\n items: {\n type: \"object\" as const,\n required: [\"skill\", \"relationship\", \"description\"],\n additionalProperties: false,\n properties: {\n skill: { type: \"string\" as const },\n relationship: {\n type: \"string\" as const,\n enum: [\"input\", \"output\", \"parallel\"],\n },\n description: { type: \"string\" as const },\n },\n },\n },\n security: {\n type: \"object\" as const,\n nullable: true,\n required: [\"permissions\"],\n additionalProperties: false,\n properties: {\n permissions: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n file_scope: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n integrity: { type: \"string\" as const, nullable: true },\n },\n },\n docs: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: false,\n properties: {\n sources: {\n type: \"array\" as const,\n items: {\n type: \"object\" as const,\n required: [\"type\", \"url\"],\n additionalProperties: false,\n properties: {\n type: {\n type: \"string\" as const,\n enum: [\"url\", \"llms-txt\", \"github\"],\n },\n url: { type: \"string\" as const, minLength: 1 },\n scope: {\n type: \"string\" as const,\n enum: [\"crawl\", \"page\", \"sitemap\"],\n nullable: true,\n },\n depth: {\n type: \"integer\" as const,\n minimum: 0,\n maximum: 5,\n nullable: true,\n },\n include: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n exclude: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n label: { type: \"string\" as const, nullable: true },\n blocks: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n snapshot_version: { type: \"string\" as const, nullable: true },\n max_tokens: {\n type: \"integer\" as const,\n minimum: 0,\n nullable: true,\n },\n },\n },\n },\n delivery: {\n type: \"string\" as const,\n enum: [\"local\", \"remote\", \"auto\"],\n nullable: true,\n },\n priority_pages: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n },\n },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n repository: { type: \"string\" as const, nullable: true },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(skillFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSkillFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst soulFrontmatterSchema = {\n type: \"object\" as const,\n required: [\"name\", \"version\", \"author\", \"license\", \"description\"],\n additionalProperties: true,\n properties: {\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n description: { type: \"string\" as const, minLength: 1 },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n skillbase: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: true,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n skills: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n settings: {\n type: \"object\" as const,\n nullable: true,\n properties: {\n temperature: { type: \"number\" as const, minimum: 0, maximum: 2 },\n top_p: { type: \"number\" as const, minimum: 0, maximum: 1 },\n },\n },\n },\n },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(soulFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSoulFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\n\nexport interface VercelFrontmatter {\n name: string;\n description: string;\n license?: string;\n metadata?: Record<string, unknown>;\n \"allowed-tools\"?: string[];\n \"user-invocable\"?: boolean;\n [key: string]: unknown;\n}\n\nconst STOP_WORDS = new Set([\n \"a\", \"an\", \"the\", \"and\", \"or\", \"for\", \"to\", \"in\", \"on\", \"of\", \"is\", \"it\",\n \"with\", \"that\", \"this\", \"use\", \"when\", \"how\", \"what\", \"your\", \"you\",\n]);\n\nexport function inferTags(name: string, description: string): string[] {\n const tags = new Set<string>();\n\n for (const token of name.split(\"-\")) {\n if (token.length > 1 && !STOP_WORDS.has(token)) {\n tags.add(token);\n }\n }\n\n const words = description\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .split(/\\s+/)\n .filter((w) => w.length > 2 && !STOP_WORDS.has(w));\n\n for (const word of words.slice(0, 10)) {\n if (tags.size >= 8) break;\n tags.add(word);\n }\n\n if (tags.size === 0) {\n tags.add(name);\n }\n\n return [...tags].slice(0, 8);\n}\n\nconst TOOL_TO_PERMISSION: Record<string, string> = {\n bash: \"bash:execute\",\n file_read: \"file:read\",\n file_write: \"file:write\",\n web_fetch: \"network:allowlist\",\n terminal: \"bash:execute\",\n shell: \"bash:execute\",\n};\n\nfunction mapPermissions(allowedTools?: string[]): string[] {\n if (!allowedTools || allowedTools.length === 0) return [];\n\n const permissions: string[] = [];\n for (const tool of allowedTools) {\n const normalized = tool.toLowerCase().replace(/-/g, \"_\");\n const mapped = TOOL_TO_PERMISSION[normalized];\n if (mapped && !permissions.includes(mapped)) {\n permissions.push(mapped);\n }\n }\n return permissions;\n}\n\nexport function isVercelFormat(data: Record<string, unknown>): boolean {\n return (\n !data.schema_version &&\n typeof data.name === \"string\" &&\n typeof data.description === \"string\"\n );\n}\n\nexport function convertVercelToSpm(\n vercel: VercelFrontmatter,\n body: string,\n options: { author: string; license?: string; repository?: string },\n): ParsedSkill {\n const name = vercel.name\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n\n const frontmatter: SkillFrontmatter = {\n schema_version: 3,\n name,\n version: \"1.0.0\",\n author: options.author,\n license: vercel.license || options.license || \"MIT\",\n description: vercel.description,\n language: \"en\",\n trigger: {\n description: vercel.description,\n tags: inferTags(name, vercel.description),\n priority: 50,\n },\n security: {\n permissions: mapPermissions(vercel[\"allowed-tools\"]),\n },\n };\n\n if (options.repository) {\n frontmatter.repository = options.repository;\n }\n\n return { frontmatter, body: body.trim() };\n}\n","import type { SoulFrontmatter, SoulSkillbaseBlock } from \"../types/soul.js\";\nimport type { LegacyPersonaManifest } from \"../types/legacy.js\";\n\n/**\n * Convert a legacy PersonaManifest to SoulFrontmatter.\n */\nexport function legacyPersonaToSoul(\n manifest: LegacyPersonaManifest,\n): SoulFrontmatter {\n const soul: SoulFrontmatter = {\n name: manifest.name,\n version: manifest.version,\n author: manifest.author,\n license: manifest.license,\n description: manifest.description,\n };\n\n const skillbase: SoulSkillbaseBlock = {\n schema_version: 3,\n };\n\n if (manifest.skills && Object.keys(manifest.skills).length > 0) {\n skillbase.skills = manifest.skills;\n }\n\n if (manifest.settings) {\n skillbase.settings = manifest.settings;\n }\n\n soul.skillbase = skillbase;\n return soul;\n}\n\n/**\n * Build markdown body from legacy persona character fields.\n */\nexport function buildLegacyBody(manifest: LegacyPersonaManifest): string {\n const parts: string[] = [];\n\n parts.push(`## Role\\n\\n${manifest.character.role}`);\n\n if (manifest.character.tone) {\n parts.push(`## Tone\\n\\n${manifest.character.tone}`);\n }\n\n if (\n manifest.character.guidelines &&\n manifest.character.guidelines.length > 0\n ) {\n const items = manifest.character.guidelines.map((g) => `- ${g}`).join(\"\\n\");\n parts.push(`## Guidelines\\n\\n${items}`);\n }\n\n if (manifest.character.instructions) {\n parts.push(`## Instructions\\n\\n${manifest.character.instructions}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n","/**\n * Convert a string to a valid skill name slug.\n */\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n || \"unnamed\";\n}\n\n/**\n * Extract a meaningful name from a filename.\n * \"CLAUDE.md\" → \"claude\", \".cursorrules\" → \"cursorrules\", \"api-rules.mdc\" → \"api-rules\"\n */\nexport function extractName(filename: string): string {\n const base = filename.split(\"/\").pop() ?? filename;\n return base\n .replace(/^\\./, \"\")\n .replace(/\\.(md|mdc|txt|instructions\\.md)$/i, \"\")\n .replace(/^(CLAUDE|AGENTS|copilot-instructions)$/i, (m) =>\n m.toLowerCase(),\n );\n}\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for legacy .cursorrules files.\n * Plain markdown, no frontmatter. Everything is instructions.\n */\nexport const cursorRulesImporter: Importer = {\n id: \"cursor-rules\",\n name: \"Cursor Rules (legacy)\",\n filePatterns: [\".cursorrules\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n if (!trimmed) {\n warnings.push(\"Empty .cursorrules file\");\n }\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cursor-rules\";\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from .cursorrules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-rules\",\n };\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface MdcFrontmatter {\n description?: string;\n globs?: string;\n alwaysApply?: boolean;\n}\n\n/**\n * Importer for Cursor MDC (.mdc) rule files.\n * YAML frontmatter with description, globs, alwaysApply + markdown body.\n */\nexport const cursorMdcImporter: Importer = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC Rules\",\n filePatterns: [\".cursor/rules/*.mdc\", \"*.mdc\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as MdcFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-mdc-rule\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cursor MDC\",\n schemaVersion: 3,\n confidence: 0.6,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-mdc\",\n };\n\n // Map globs to scoping\n if (fm.globs || fm.alwaysApply !== undefined) {\n canonical.scoping = {};\n if (fm.globs) {\n canonical.scoping.globs = fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean);\n }\n if (fm.description) {\n canonical.scoping.trigger = {\n description: fm.description,\n tags: [],\n priority: fm.alwaysApply ? 90 : 50,\n };\n }\n }\n\n if (!fm.description) {\n reviewNeeded.push(\"meta.description\");\n }\n reviewNeeded.push(\"meta.name\", \"identity\", \"constraints\");\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClaudeMdFrontmatter {\n paths?: string[];\n}\n\n/**\n * Importer for CLAUDE.md files.\n * Plain markdown, optionally with paths frontmatter (for .claude/rules/*.md).\n */\nexport const claudeMdImporter: Importer = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n filePatterns: [\"CLAUDE.md\", \".claude/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClaudeMdFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-claude-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from CLAUDE.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"claude-md\",\n };\n\n // Map paths to scoping\n if (fm.paths && fm.paths.length > 0) {\n canonical.scoping = {\n globs: fm.paths,\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for AGENTS.md files (GitHub Copilot coding agents).\n * Plain markdown, no frontmatter.\n */\nexport const agentsMdImporter: Importer = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n filePatterns: [\"AGENTS.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-agents-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from AGENTS.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"agents-md\",\n };\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface WindsurfFrontmatter {\n trigger?: \"always_on\" | \"model_decision\" | \"manual\" | \"glob\";\n globs?: string;\n description?: string;\n}\n\n/**\n * Importer for Windsurf rules.\n * .windsurfrules (legacy, plain text) or .windsurf/rules/*.md (with frontmatter).\n */\nexport const windsurfRulesImporter: Importer = {\n id: \"windsurf-rules\",\n name: \"Windsurf Rules\",\n filePatterns: [\".windsurfrules\", \".windsurf/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as WindsurfFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-windsurf-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Windsurf rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"windsurf-rules\",\n };\n\n if (fm.trigger === \"glob\" && fm.globs) {\n canonical.scoping = {\n globs: fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface CopilotFrontmatter {\n applyTo?: string;\n}\n\n/**\n * Importer for GitHub Copilot instructions.\n * copilot-instructions.md (no frontmatter) or *.instructions.md (with applyTo frontmatter).\n */\nexport const copilotImporter: Importer = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n filePatterns: [\n \".github/copilot-instructions.md\",\n \".github/instructions/*.instructions.md\",\n ],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as CopilotFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-copilot\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from Copilot instructions\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"copilot\",\n };\n\n if (fm.applyTo) {\n canonical.scoping = {\n globs: [fm.applyTo],\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClineFrontmatter {\n description?: string;\n globs?: string;\n paths?: string[];\n}\n\n/**\n * Importer for Cline rules.\n * Single .clinerules file (plain text) or .clinerules/*.md (with optional frontmatter).\n */\nexport const clineImporter: Importer = {\n id: \"cline\",\n name: \"Cline Rules\",\n filePatterns: [\".clinerules\", \".clinerules/*.md\", \".clinerules/*.txt\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClineFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cline-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cline rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cline\",\n };\n\n // Map glob patterns to scoping\n const globs: string[] = [];\n if (fm.globs) {\n globs.push(\n ...fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n );\n }\n if (fm.paths) {\n globs.push(...fm.paths);\n }\n if (globs.length > 0) {\n canonical.scoping = { globs };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { SourceFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { cursorRulesImporter } from \"./cursor-rules.js\";\nimport { cursorMdcImporter } from \"./cursor-mdc.js\";\nimport { claudeMdImporter } from \"./claude-md.js\";\nimport { agentsMdImporter } from \"./agents-md.js\";\nimport { windsurfRulesImporter } from \"./windsurf-rules.js\";\nimport { copilotImporter } from \"./copilot.js\";\nimport { clineImporter } from \"./cline.js\";\n\nconst importers: Importer[] = [\n cursorRulesImporter,\n cursorMdcImporter,\n claudeMdImporter,\n agentsMdImporter,\n windsurfRulesImporter,\n copilotImporter,\n clineImporter,\n];\n\n/**\n * Detect format from filename.\n */\nexport function detectFormat(filename: string): SourceFormat | null {\n const lower = filename.toLowerCase();\n const base = lower.split(\"/\").pop() ?? lower;\n\n if (base === \".cursorrules\") return \"cursor-rules\";\n if (base.endsWith(\".mdc\")) return \"cursor-mdc\";\n if (base === \"claude.md\") return \"claude-md\";\n if (base === \"agents.md\") return \"agents-md\";\n if (base === \".windsurfrules\") return \"windsurf-rules\";\n if (lower.includes(\".windsurf/rules/\")) return \"windsurf-rules\";\n if (base === \"copilot-instructions.md\") return \"copilot\";\n if (base.endsWith(\".instructions.md\")) return \"copilot\";\n if (base === \".clinerules\") return \"cline\";\n if (lower.includes(\".clinerules/\")) return \"cline\";\n if (lower.includes(\".claude/rules/\")) return \"claude-md\";\n\n return null;\n}\n\n/**\n * Get importer by format ID.\n */\nexport function getImporter(format: SourceFormat): Importer | null {\n return importers.find((i) => i.id === format) ?? null;\n}\n\n/**\n * Import content from a foreign format.\n */\nexport function importFromFormat(\n content: string,\n format: SourceFormat,\n options?: ImportOptions,\n): ImportResult {\n const importer = getImporter(format);\n if (!importer) {\n throw new Error(`No importer for format: ${format}`);\n }\n return importer.import(content, options);\n}\n\n/**\n * List all available importers.\n */\nexport function listImporters(): Importer[] {\n return [...importers];\n}\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { CompileOptions } from \"./types.js\";\n\n/**\n * Build inline knowledge section from knowledge blocks.\n */\nexport function buildKnowledgeSection(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string | null {\n const blocks = options?.knowledgeBlocks ?? canonical.knowledge?.inlineBlocks;\n if (!blocks || blocks.length === 0 || !options?.inlineKnowledge) {\n return null;\n }\n\n const parts = [\"## Reference Documentation\", \"\"];\n for (const block of blocks) {\n parts.push(`### ${block.label}`, \"\", block.content, \"\");\n }\n\n return parts.join(\"\\n\").trimEnd();\n}\n\n/**\n * Build a flat markdown body from canonical format for targets\n * that don't support structured frontmatter.\n */\nexport function buildFlatBody(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string {\n const parts: string[] = [];\n\n // Identity preamble\n if (canonical.identity) {\n if (canonical.identity.role) {\n parts.push(canonical.identity.role, \"\");\n }\n if (canonical.identity.tone) {\n parts.push(`Tone: ${canonical.identity.tone}`, \"\");\n }\n }\n\n // Main instructions\n parts.push(canonical.rawBody ?? canonical.instructions.content);\n\n // Constraints\n if (canonical.constraints) {\n if (\n canonical.constraints.always &&\n canonical.constraints.always.length > 0\n ) {\n parts.push(\n \"\",\n \"## Always\",\n \"\",\n ...canonical.constraints.always.map((c) => `- ${c}`),\n );\n }\n if (canonical.constraints.never && canonical.constraints.never.length > 0) {\n parts.push(\n \"\",\n \"## Never\",\n \"\",\n ...canonical.constraints.never.map((c) => `- ${c}`),\n );\n }\n }\n\n // Inline knowledge\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n parts.push(\"\", knowledgeSection);\n }\n\n return parts.join(\"\\n\").trim();\n}\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SkillFrontmatter } from \"../types/skill.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nfunction buildBody(canonical: CanonicalFormat): string {\n const parts: string[] = [];\n\n // Identity block\n if (canonical.identity) {\n const id = canonical.identity;\n const lines: string[] = [];\n if (id.role) lines.push(id.role);\n if (id.expertise?.length) lines.push(`**Expertise:** ${id.expertise.join(\", \")}`);\n if (id.tone) lines.push(`**Tone:** ${id.tone}`);\n if (lines.length) parts.push(lines.join(\"\\n\"));\n }\n\n // Instructions content (fallback for canonicals without sections)\n if (canonical.instructions.content) {\n parts.push(canonical.instructions.content);\n }\n\n // Instruction sections\n const sections = canonical.instructions.sections ?? [];\n for (const s of sections) {\n if (s.label || s.content) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else {\n parts.push(s.content);\n }\n }\n }\n\n // Constraints\n if (canonical.constraints) {\n const lines: string[] = [];\n if (canonical.constraints.always?.length) {\n lines.push(\"**Always:**\");\n for (const r of canonical.constraints.always) lines.push(`- ${r}`);\n }\n if (canonical.constraints.never?.length) {\n if (lines.length) lines.push(\"\");\n lines.push(\"**Never:**\");\n for (const r of canonical.constraints.never) lines.push(`- ${r}`);\n }\n if (lines.length) parts.push(`## Constraints\\n\\n${lines.join(\"\\n\")}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n\nexport const skillMdCompiler: Compiler = {\n id: \"skill-md\",\n name: \"SKILL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const warnings: string[] = [];\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) fm.language = canonical.meta.language;\n if (canonical.meta.repository) fm.repository = canonical.meta.repository;\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n let body = buildBody(canonical);\n\n // Append inline knowledge if requested\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SKILL.md\", content }],\n droppedFeatures: [],\n warnings,\n };\n },\n};\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SoulFrontmatter } from \"../types/soul.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nexport const soulMdCompiler: Compiler = {\n id: \"soul-md\",\n name: \"SOUL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n let body = canonical.rawBody ?? canonical.instructions.content;\n\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SOUL.md\", content }],\n droppedFeatures: [],\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorMdcCompiler: Compiler = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC (.mdc)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n\n // Build MDC frontmatter\n const description =\n canonical.scoping?.trigger?.description ?? canonical.meta.description;\n const globs =\n canonical.scoping?.globs ??\n canonical.scoping?.filePatterns ??\n [];\n const alwaysApply = globs.length === 0;\n\n const fmLines = [\n \"---\",\n `description: ${description}`,\n `globs: ${globs.join(\", \") || \"\"}`,\n `alwaysApply: ${alwaysApply}`,\n \"---\",\n ];\n\n const body = buildFlatBody(canonical, options);\n const content = fmLines.join(\"\\n\") + \"\\n\\n\" + body;\n\n const filename = canonical.meta.name + \".mdc\";\n const path = options?.basePath\n ? `${options.basePath}/${filename}`\n : `.cursor/rules/${filename}`;\n\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorRulesCompiler: Compiler = {\n id: \"cursor-rules\",\n name: \".cursorrules (legacy)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger || canonical.scoping?.filePatterns) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".cursorrules\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const claudeMdCompiler: Compiler = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"CLAUDE.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const agentsMdCompiler: Compiler = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"AGENTS.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nconst MAX_CHARS = 6000;\n\nexport const windsurfCompiler: Compiler = {\n id: \"windsurf\",\n name: \"Windsurf Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const warnings: string[] = [];\n let content = buildFlatBody(canonical, options);\n\n if (content.length > MAX_CHARS) {\n warnings.push(\n `Content truncated from ${content.length} to ${MAX_CHARS} characters (.windsurfrules limit)`,\n );\n content = content.slice(0, MAX_CHARS);\n }\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".windsurfrules\", content }],\n droppedFeatures,\n warnings,\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const copilotCompiler: Compiler = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [\n { path: \".github/copilot-instructions.md\", content },\n ],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const clineCompiler: Compiler = {\n id: \"cline\",\n name: \"Cline Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n const filename = canonical.meta.name + \".md\";\n\n return {\n files: [{ path: `.clinerules/${filename}`, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type {\n Compiler,\n CompileTarget,\n CompileResult,\n CompileOptions,\n} from \"./types.js\";\n\nimport { skillMdCompiler } from \"./skill-md.js\";\nimport { soulMdCompiler } from \"./soul-md.js\";\nimport { cursorMdcCompiler } from \"./cursor-mdc.js\";\nimport { cursorRulesCompiler } from \"./cursor-rules.js\";\nimport { claudeMdCompiler } from \"./claude-md.js\";\nimport { agentsMdCompiler } from \"./agents-md.js\";\nimport { windsurfCompiler } from \"./windsurf.js\";\nimport { copilotCompiler } from \"./copilot.js\";\nimport { clineCompiler } from \"./cline.js\";\n\nconst compilers: Compiler[] = [\n skillMdCompiler,\n soulMdCompiler,\n cursorMdcCompiler,\n cursorRulesCompiler,\n claudeMdCompiler,\n agentsMdCompiler,\n windsurfCompiler,\n copilotCompiler,\n clineCompiler,\n];\n\n/**\n * Compile a CanonicalFormat to a target format.\n */\nexport function compile(\n canonical: CanonicalFormat,\n target: CompileTarget,\n options?: CompileOptions,\n): CompileResult {\n const compiler = compilers.find((c) => c.id === target);\n if (!compiler) {\n throw new Error(`No compiler for target: ${target}`);\n }\n return compiler.compile(canonical, options);\n}\n\n/**\n * List all available compile targets.\n */\nexport function listTargets(): Compiler[] {\n return [...compilers];\n}\n\n/**\n * Get a compiler by target ID.\n */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M,EAAE;AAAA,EACrD;AACA,SAAO,SAAS,QAAQ,WAAW,OAAO;AAC5C;AAKO,SAAS,cAA0B;AACxC,SAAO,CAAC,GAAG,SAAS;AACtB;AAKO,SAAS,YAAY,QAAwC;AAClE,SAAO,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,KAAK;AACnD;","names":["yaml","text","REQUIRED_FIELDS","Ajv","import_ajv","ajv","Ajv","validateFn","validateFn"]}
package/dist/index.d.cts CHANGED
@@ -181,7 +181,15 @@ declare function serializeSkill(skill: ParsedSkill): string;
181
181
  * Normalize a CanonicalFormat: split instructions.content by H2 headers
182
182
  * into sections if sections are not already populated.
183
183
  */
184
+ /**
185
+ * Normalize: always parse instructions.content into sections for UI.
186
+ * Sections are never stored — they are derived from content.
187
+ */
184
188
  declare function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat;
189
+ /**
190
+ * Denormalize: merge sections back into flat content for storage.
191
+ */
192
+ declare function denormalizeCanonical(canonical: CanonicalFormat): CanonicalFormat;
185
193
  /**
186
194
  * Convert a ParsedSkill to CanonicalFormat.
187
195
  */
@@ -468,4 +476,4 @@ declare function listTargets(): Compiler[];
468
476
  */
469
477
  declare function getCompiler(target: CompileTarget): Compiler | null;
470
478
 
471
- export { type CanonicalConstraints, type CanonicalDependencies, type CanonicalFormat, type CanonicalIdentity, type CanonicalInstructions, type CanonicalKnowledge, type CanonicalMeta, type CanonicalScoping, type CanonicalSettings, type CompileFile, type CompileOptions, type CompileResult, type CompileTarget, type Compiler, type DocSource, type ImportOptions, type ImportResult, type Importer, type InstructionSection, type LegacyPersonaManifest, type LegacySkillManifest, type ParsedSkill, type ParsedSoul, type PersonaCharacter, type SkillCompatibility, type SkillDependencies, type SkillDocs, type SkillFrontmatter, SkillParseError, type SkillSecurity, type SkillTrigger, type SkillWorksWithEntry, type SoulFrontmatter, type SoulIdentityBlock, SoulParseError, type SoulSkillbaseBlock, type SourceFormat, type ValidationResult, type VercelFrontmatter, buildLegacyBody, canonicalToParsedSkill, canonicalToParsedSoul, compile, convertVercelToSpm, detectFormat, getCompiler, getImporter, importFromFormat, inferTags, isVercelFormat, legacyPersonaToSoul, listImporters, listTargets, normalizeCanonical, parseSkill, parseSoul, parsedSkillToCanonical, parsedSoulToCanonical, resolveContextSlots, serializeSkill, serializeSoul, validateSkillFrontmatter, validateSoulFrontmatter };
479
+ export { type CanonicalConstraints, type CanonicalDependencies, type CanonicalFormat, type CanonicalIdentity, type CanonicalInstructions, type CanonicalKnowledge, type CanonicalMeta, type CanonicalScoping, type CanonicalSettings, type CompileFile, type CompileOptions, type CompileResult, type CompileTarget, type Compiler, type DocSource, type ImportOptions, type ImportResult, type Importer, type InstructionSection, type LegacyPersonaManifest, type LegacySkillManifest, type ParsedSkill, type ParsedSoul, type PersonaCharacter, type SkillCompatibility, type SkillDependencies, type SkillDocs, type SkillFrontmatter, SkillParseError, type SkillSecurity, type SkillTrigger, type SkillWorksWithEntry, type SoulFrontmatter, type SoulIdentityBlock, SoulParseError, type SoulSkillbaseBlock, type SourceFormat, type ValidationResult, type VercelFrontmatter, buildLegacyBody, canonicalToParsedSkill, canonicalToParsedSoul, compile, convertVercelToSpm, denormalizeCanonical, detectFormat, getCompiler, getImporter, importFromFormat, inferTags, isVercelFormat, legacyPersonaToSoul, listImporters, listTargets, normalizeCanonical, parseSkill, parseSoul, parsedSkillToCanonical, parsedSoulToCanonical, resolveContextSlots, serializeSkill, serializeSoul, validateSkillFrontmatter, validateSoulFrontmatter };
package/dist/index.d.ts CHANGED
@@ -181,7 +181,15 @@ declare function serializeSkill(skill: ParsedSkill): string;
181
181
  * Normalize a CanonicalFormat: split instructions.content by H2 headers
182
182
  * into sections if sections are not already populated.
183
183
  */
184
+ /**
185
+ * Normalize: always parse instructions.content into sections for UI.
186
+ * Sections are never stored — they are derived from content.
187
+ */
184
188
  declare function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat;
189
+ /**
190
+ * Denormalize: merge sections back into flat content for storage.
191
+ */
192
+ declare function denormalizeCanonical(canonical: CanonicalFormat): CanonicalFormat;
185
193
  /**
186
194
  * Convert a ParsedSkill to CanonicalFormat.
187
195
  */
@@ -468,4 +476,4 @@ declare function listTargets(): Compiler[];
468
476
  */
469
477
  declare function getCompiler(target: CompileTarget): Compiler | null;
470
478
 
471
- export { type CanonicalConstraints, type CanonicalDependencies, type CanonicalFormat, type CanonicalIdentity, type CanonicalInstructions, type CanonicalKnowledge, type CanonicalMeta, type CanonicalScoping, type CanonicalSettings, type CompileFile, type CompileOptions, type CompileResult, type CompileTarget, type Compiler, type DocSource, type ImportOptions, type ImportResult, type Importer, type InstructionSection, type LegacyPersonaManifest, type LegacySkillManifest, type ParsedSkill, type ParsedSoul, type PersonaCharacter, type SkillCompatibility, type SkillDependencies, type SkillDocs, type SkillFrontmatter, SkillParseError, type SkillSecurity, type SkillTrigger, type SkillWorksWithEntry, type SoulFrontmatter, type SoulIdentityBlock, SoulParseError, type SoulSkillbaseBlock, type SourceFormat, type ValidationResult, type VercelFrontmatter, buildLegacyBody, canonicalToParsedSkill, canonicalToParsedSoul, compile, convertVercelToSpm, detectFormat, getCompiler, getImporter, importFromFormat, inferTags, isVercelFormat, legacyPersonaToSoul, listImporters, listTargets, normalizeCanonical, parseSkill, parseSoul, parsedSkillToCanonical, parsedSoulToCanonical, resolveContextSlots, serializeSkill, serializeSoul, validateSkillFrontmatter, validateSoulFrontmatter };
479
+ export { type CanonicalConstraints, type CanonicalDependencies, type CanonicalFormat, type CanonicalIdentity, type CanonicalInstructions, type CanonicalKnowledge, type CanonicalMeta, type CanonicalScoping, type CanonicalSettings, type CompileFile, type CompileOptions, type CompileResult, type CompileTarget, type Compiler, type DocSource, type ImportOptions, type ImportResult, type Importer, type InstructionSection, type LegacyPersonaManifest, type LegacySkillManifest, type ParsedSkill, type ParsedSoul, type PersonaCharacter, type SkillCompatibility, type SkillDependencies, type SkillDocs, type SkillFrontmatter, SkillParseError, type SkillSecurity, type SkillTrigger, type SkillWorksWithEntry, type SoulFrontmatter, type SoulIdentityBlock, SoulParseError, type SoulSkillbaseBlock, type SourceFormat, type ValidationResult, type VercelFrontmatter, buildLegacyBody, canonicalToParsedSkill, canonicalToParsedSoul, compile, convertVercelToSpm, denormalizeCanonical, detectFormat, getCompiler, getImporter, importFromFormat, inferTags, isVercelFormat, legacyPersonaToSoul, listImporters, listTargets, normalizeCanonical, parseSkill, parseSoul, parsedSkillToCanonical, parsedSoulToCanonical, resolveContextSlots, serializeSkill, serializeSoul, validateSkillFrontmatter, validateSoulFrontmatter };
package/dist/index.js CHANGED
@@ -97,16 +97,15 @@ function splitBodyIntoSections(body) {
97
97
  return { sections };
98
98
  }
99
99
  function normalizeCanonical(canonical) {
100
- const { content, sections } = canonical.instructions;
101
- if (sections && sections.length > 0) return canonical;
100
+ const { content } = canonical.instructions;
102
101
  if (!content) return canonical;
103
- const { sections: parsed } = splitBodyIntoSections(content);
104
- if (parsed.length === 0) return canonical;
102
+ const { sections } = splitBodyIntoSections(content);
103
+ if (sections.length === 0) return canonical;
105
104
  return {
106
105
  ...canonical,
107
106
  instructions: {
108
107
  content: "",
109
- sections: parsed.map((s) => ({
108
+ sections: sections.map((s) => ({
110
109
  type: "custom",
111
110
  label: s.label,
112
111
  content: s.content
@@ -114,9 +113,26 @@ function normalizeCanonical(canonical) {
114
113
  }
115
114
  };
116
115
  }
116
+ function denormalizeCanonical(canonical) {
117
+ const sections = canonical.instructions.sections ?? [];
118
+ if (sections.length === 0) return canonical;
119
+ const parts = [];
120
+ for (const s of sections) {
121
+ if (s.label) {
122
+ parts.push(`## ${s.label}
123
+
124
+ ${s.content}`);
125
+ } else if (s.content) {
126
+ parts.push(s.content);
127
+ }
128
+ }
129
+ return {
130
+ ...canonical,
131
+ instructions: { content: parts.join("\n\n") }
132
+ };
133
+ }
117
134
  function parsedSkillToCanonical(skill) {
118
135
  const fm = skill.frontmatter;
119
- const { sections } = splitBodyIntoSections(skill.body);
120
136
  const canonical = {
121
137
  meta: {
122
138
  name: fm.name,
@@ -130,12 +146,7 @@ function parsedSkillToCanonical(skill) {
130
146
  confidence: 1
131
147
  },
132
148
  instructions: {
133
- content: "",
134
- sections: sections.map((s) => ({
135
- type: "custom",
136
- label: s.label,
137
- content: s.content
138
- }))
149
+ content: skill.body
139
150
  },
140
151
  rawBody: skill.body,
141
152
  sourceFormat: "skill-md"
@@ -1712,6 +1723,7 @@ export {
1712
1723
  canonicalToParsedSoul,
1713
1724
  compile,
1714
1725
  convertVercelToSpm,
1726
+ denormalizeCanonical,
1715
1727
  detectFormat,
1716
1728
  getCompiler,
1717
1729
  getImporter,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/frontmatter.ts","../src/parse/skill-parser.ts","../src/parse/soul-parser.ts","../src/schema/skill-schema.ts","../src/schema/soul-schema.ts","../src/convert/vercel-to-spm.ts","../src/convert/legacy.ts","../src/utils/slugify.ts","../src/parse/importers/cursor-rules.ts","../src/parse/importers/cursor-mdc.ts","../src/parse/importers/claude-md.ts","../src/parse/importers/agents-md.ts","../src/parse/importers/windsurf-rules.ts","../src/parse/importers/copilot.ts","../src/parse/importers/cline.ts","../src/parse/importers/index.ts","../src/compile/utils.ts","../src/compile/skill-md.ts","../src/compile/soul-md.ts","../src/compile/cursor-mdc.ts","../src/compile/cursor-rules.ts","../src/compile/claude-md.ts","../src/compile/agents-md.ts","../src/compile/windsurf.ts","../src/compile/copilot.ts","../src/compile/cline.ts","../src/compile/index.ts"],"sourcesContent":["import yaml from \"js-yaml\";\n\nconst DELIMITER = \"---\";\n\nexport function parseFrontmatter(raw: string): {\n data: Record<string, any>;\n content: string;\n} {\n const trimmed = raw.trimStart();\n if (!trimmed.startsWith(DELIMITER)) {\n return { data: {}, content: raw };\n }\n\n const end = trimmed.indexOf(`\\n${DELIMITER}`, DELIMITER.length);\n if (end === -1) {\n return { data: {}, content: raw };\n }\n\n const yamlStr = trimmed.slice(DELIMITER.length, end).trim();\n const data = yamlStr ? (yaml.load(yamlStr) as Record<string, unknown>) : {};\n const content = trimmed.slice(end + DELIMITER.length + 1).replace(/^\\n/, \"\");\n\n return { data: data ?? {}, content };\n}\n\nexport function stringifyFrontmatter(\n content: string,\n data: Record<string, unknown>,\n): string {\n const yamlStr = yaml.dump(data, { lineWidth: -1, noRefs: true }).trimEnd();\n return `---\\n${yamlStr}\\n---\\n${content}`;\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"schema_version\",\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nconst TRIGGER_REQUIRED = [\"description\", \"tags\", \"priority\"] as const;\n\nexport class SkillParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SkillParseError\";\n }\n}\n\n/**\n * Parse a SKILL.md string into frontmatter + body.\n */\nexport function parseSkill(content: string): ParsedSkill {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SkillParseError(\n `SKILL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n if (data.trigger) {\n const triggerMissing = TRIGGER_REQUIRED.filter(\n (f) => data.trigger[f] === undefined || data.trigger[f] === \"\",\n );\n if (triggerMissing.length > 0) {\n throw new SkillParseError(\n `trigger missing required fields: ${triggerMissing.join(\", \")}`,\n triggerMissing.map((f) => `trigger.${f}`),\n );\n }\n }\n\n return {\n frontmatter: data as SkillFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSkill back to SKILL.md string.\n */\nexport function serializeSkill(skill: ParsedSkill): string {\n return stringifyFrontmatter(skill.body, skill.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Split markdown body into preamble + H2 sections.\n */\nexport function splitBodyIntoSections(body: string): {\n sections: { label: string; content: string }[];\n} {\n const lines = body.split(\"\\n\");\n const sections: { label: string; content: string }[] = [];\n let currentLabel: string | null = null;\n let currentLines: string[] = [];\n\n for (const line of lines) {\n const h2Match = line.match(/^## (.+)$/);\n if (h2Match) {\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n currentLabel = h2Match[1].trim();\n currentLines = [];\n } else {\n currentLines.push(line);\n }\n }\n\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n\n return { sections };\n}\n\n/**\n * Normalize a CanonicalFormat: split instructions.content by H2 headers\n * into sections if sections are not already populated.\n */\nexport function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const { content, sections } = canonical.instructions;\n if (sections && sections.length > 0) return canonical;\n if (!content) return canonical;\n\n const { sections: parsed } = splitBodyIntoSections(content);\n if (parsed.length === 0) return canonical;\n\n return {\n ...canonical,\n instructions: {\n content: \"\",\n sections: parsed.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n };\n}\n\n/**\n * Convert a ParsedSkill to CanonicalFormat.\n */\nexport function parsedSkillToCanonical(skill: ParsedSkill): CanonicalFormat {\n const fm = skill.frontmatter;\n\n const { sections } = splitBodyIntoSections(skill.body);\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: fm.schema_version,\n language: fm.language,\n repository: fm.repository,\n confidence: 1.0,\n },\n instructions: {\n content: \"\",\n sections: sections.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n rawBody: skill.body,\n sourceFormat: \"skill-md\",\n };\n\n if (fm.trigger) {\n canonical.scoping = {\n trigger: {\n description: fm.trigger.description,\n tags: fm.trigger.tags,\n priority: fm.trigger.priority,\n },\n filePatterns: fm.trigger.file_patterns,\n };\n }\n\n if (fm.security || fm.dependencies || fm.compatibility || fm.works_with) {\n canonical.dependencies = {};\n if (fm.dependencies) {\n canonical.dependencies.skills = fm.dependencies;\n }\n if (fm.security) {\n canonical.dependencies.security = {\n permissions: fm.security.permissions,\n fileScope: fm.security.file_scope,\n };\n }\n if (fm.compatibility) {\n canonical.dependencies.compatibility = {\n minContextTokens: fm.compatibility.min_context_tokens,\n requires: fm.compatibility.requires,\n models: fm.compatibility.models,\n };\n }\n if (fm.works_with) {\n canonical.dependencies.worksWith = fm.works_with;\n }\n }\n\n if (fm.docs) {\n canonical.knowledge = {\n docSources: fm.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: fm.docs.delivery,\n priorityPages: fm.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSkill.\n */\nexport function canonicalToParsedSkill(canonical: CanonicalFormat): ParsedSkill {\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) {\n fm.language = canonical.meta.language;\n }\n if (canonical.meta.repository) {\n fm.repository = canonical.meta.repository;\n }\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSoul, SoulFrontmatter } from \"../types/soul.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nexport class SoulParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SoulParseError\";\n }\n}\n\n/**\n * Parse a SOUL.md string into frontmatter + body.\n */\nexport function parseSoul(content: string): ParsedSoul {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SoulParseError(\n `SOUL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n return {\n frontmatter: data as SoulFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSoul back to SOUL.md string.\n */\nexport function serializeSoul(soul: ParsedSoul): string {\n return stringifyFrontmatter(soul.body, soul.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Replace {{PLACEHOLDER}} tokens in body with provided values.\n */\nexport function resolveContextSlots(\n body: string,\n values: Record<string, string>,\n): string {\n return body.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) => {\n return values[key] ?? match;\n });\n}\n\n/**\n * Convert a ParsedSoul to CanonicalFormat.\n */\nexport function parsedSoulToCanonical(soul: ParsedSoul): CanonicalFormat {\n const fm = soul.frontmatter;\n const sb = fm.skillbase;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: sb?.schema_version ?? 3,\n confidence: 1.0,\n },\n instructions: {\n content: soul.body,\n },\n rawBody: soul.body,\n sourceFormat: \"soul-md\",\n };\n\n if (sb?.trigger) {\n canonical.scoping = {\n trigger: {\n description: sb.trigger.description,\n tags: sb.trigger.tags,\n priority: sb.trigger.priority,\n },\n filePatterns: sb.trigger.file_patterns,\n };\n }\n\n if (sb?.skills) {\n canonical.dependencies = {\n ...canonical.dependencies,\n skills: sb.skills,\n };\n }\n\n if (sb?.constraints) {\n canonical.constraints = {\n always: sb.constraints.always,\n never: sb.constraints.never,\n };\n }\n\n if (sb?.identity) {\n canonical.identity = {\n role: sb.identity.role,\n tone: sb.identity.tone,\n expertise: sb.identity.expertise,\n };\n }\n\n if (sb?.settings) {\n canonical.settings = { ...sb.settings };\n }\n\n if (sb?.docs) {\n canonical.knowledge = {\n docSources: sb.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: sb.docs.delivery,\n priorityPages: sb.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSoul.\n */\nexport function canonicalToParsedSoul(canonical: CanonicalFormat): ParsedSoul {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst skillFrontmatterSchema = {\n type: \"object\" as const,\n required: [\n \"schema_version\",\n \"name\",\n \"version\",\n \"description\",\n \"author\",\n \"license\",\n ],\n additionalProperties: false,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n language: { type: \"string\" as const, enum: [\"en\"], nullable: true },\n description: { type: \"string\" as const, minLength: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n additionalProperties: false,\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n file_patterns: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n dependencies: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n compatibility: {\n type: \"object\" as const,\n nullable: true,\n required: [\"min_context_tokens\", \"requires\", \"models\"],\n additionalProperties: false,\n properties: {\n min_context_tokens: { type: \"integer\" as const, minimum: 0 },\n requires: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n models: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n },\n },\n works_with: {\n type: \"array\" as const,\n nullable: true,\n items: {\n type: \"object\" as const,\n required: [\"skill\", \"relationship\", \"description\"],\n additionalProperties: false,\n properties: {\n skill: { type: \"string\" as const },\n relationship: {\n type: \"string\" as const,\n enum: [\"input\", \"output\", \"parallel\"],\n },\n description: { type: \"string\" as const },\n },\n },\n },\n security: {\n type: \"object\" as const,\n nullable: true,\n required: [\"permissions\"],\n additionalProperties: false,\n properties: {\n permissions: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n file_scope: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n integrity: { type: \"string\" as const, nullable: true },\n },\n },\n docs: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: false,\n properties: {\n sources: {\n type: \"array\" as const,\n items: {\n type: \"object\" as const,\n required: [\"type\", \"url\"],\n additionalProperties: false,\n properties: {\n type: {\n type: \"string\" as const,\n enum: [\"url\", \"llms-txt\", \"github\"],\n },\n url: { type: \"string\" as const, minLength: 1 },\n scope: {\n type: \"string\" as const,\n enum: [\"crawl\", \"page\", \"sitemap\"],\n nullable: true,\n },\n depth: {\n type: \"integer\" as const,\n minimum: 0,\n maximum: 5,\n nullable: true,\n },\n include: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n exclude: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n label: { type: \"string\" as const, nullable: true },\n blocks: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n snapshot_version: { type: \"string\" as const, nullable: true },\n max_tokens: {\n type: \"integer\" as const,\n minimum: 0,\n nullable: true,\n },\n },\n },\n },\n delivery: {\n type: \"string\" as const,\n enum: [\"local\", \"remote\", \"auto\"],\n nullable: true,\n },\n priority_pages: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n },\n },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n repository: { type: \"string\" as const, nullable: true },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(skillFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSkillFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst soulFrontmatterSchema = {\n type: \"object\" as const,\n required: [\"name\", \"version\", \"author\", \"license\", \"description\"],\n additionalProperties: true,\n properties: {\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n description: { type: \"string\" as const, minLength: 1 },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n skillbase: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: true,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n skills: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n settings: {\n type: \"object\" as const,\n nullable: true,\n properties: {\n temperature: { type: \"number\" as const, minimum: 0, maximum: 2 },\n top_p: { type: \"number\" as const, minimum: 0, maximum: 1 },\n },\n },\n },\n },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(soulFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSoulFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\n\nexport interface VercelFrontmatter {\n name: string;\n description: string;\n license?: string;\n metadata?: Record<string, unknown>;\n \"allowed-tools\"?: string[];\n \"user-invocable\"?: boolean;\n [key: string]: unknown;\n}\n\nconst STOP_WORDS = new Set([\n \"a\", \"an\", \"the\", \"and\", \"or\", \"for\", \"to\", \"in\", \"on\", \"of\", \"is\", \"it\",\n \"with\", \"that\", \"this\", \"use\", \"when\", \"how\", \"what\", \"your\", \"you\",\n]);\n\nexport function inferTags(name: string, description: string): string[] {\n const tags = new Set<string>();\n\n for (const token of name.split(\"-\")) {\n if (token.length > 1 && !STOP_WORDS.has(token)) {\n tags.add(token);\n }\n }\n\n const words = description\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .split(/\\s+/)\n .filter((w) => w.length > 2 && !STOP_WORDS.has(w));\n\n for (const word of words.slice(0, 10)) {\n if (tags.size >= 8) break;\n tags.add(word);\n }\n\n if (tags.size === 0) {\n tags.add(name);\n }\n\n return [...tags].slice(0, 8);\n}\n\nconst TOOL_TO_PERMISSION: Record<string, string> = {\n bash: \"bash:execute\",\n file_read: \"file:read\",\n file_write: \"file:write\",\n web_fetch: \"network:allowlist\",\n terminal: \"bash:execute\",\n shell: \"bash:execute\",\n};\n\nfunction mapPermissions(allowedTools?: string[]): string[] {\n if (!allowedTools || allowedTools.length === 0) return [];\n\n const permissions: string[] = [];\n for (const tool of allowedTools) {\n const normalized = tool.toLowerCase().replace(/-/g, \"_\");\n const mapped = TOOL_TO_PERMISSION[normalized];\n if (mapped && !permissions.includes(mapped)) {\n permissions.push(mapped);\n }\n }\n return permissions;\n}\n\nexport function isVercelFormat(data: Record<string, unknown>): boolean {\n return (\n !data.schema_version &&\n typeof data.name === \"string\" &&\n typeof data.description === \"string\"\n );\n}\n\nexport function convertVercelToSpm(\n vercel: VercelFrontmatter,\n body: string,\n options: { author: string; license?: string; repository?: string },\n): ParsedSkill {\n const name = vercel.name\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n\n const frontmatter: SkillFrontmatter = {\n schema_version: 3,\n name,\n version: \"1.0.0\",\n author: options.author,\n license: vercel.license || options.license || \"MIT\",\n description: vercel.description,\n language: \"en\",\n trigger: {\n description: vercel.description,\n tags: inferTags(name, vercel.description),\n priority: 50,\n },\n security: {\n permissions: mapPermissions(vercel[\"allowed-tools\"]),\n },\n };\n\n if (options.repository) {\n frontmatter.repository = options.repository;\n }\n\n return { frontmatter, body: body.trim() };\n}\n","import type { SoulFrontmatter, SoulSkillbaseBlock } from \"../types/soul.js\";\nimport type { LegacyPersonaManifest } from \"../types/legacy.js\";\n\n/**\n * Convert a legacy PersonaManifest to SoulFrontmatter.\n */\nexport function legacyPersonaToSoul(\n manifest: LegacyPersonaManifest,\n): SoulFrontmatter {\n const soul: SoulFrontmatter = {\n name: manifest.name,\n version: manifest.version,\n author: manifest.author,\n license: manifest.license,\n description: manifest.description,\n };\n\n const skillbase: SoulSkillbaseBlock = {\n schema_version: 3,\n };\n\n if (manifest.skills && Object.keys(manifest.skills).length > 0) {\n skillbase.skills = manifest.skills;\n }\n\n if (manifest.settings) {\n skillbase.settings = manifest.settings;\n }\n\n soul.skillbase = skillbase;\n return soul;\n}\n\n/**\n * Build markdown body from legacy persona character fields.\n */\nexport function buildLegacyBody(manifest: LegacyPersonaManifest): string {\n const parts: string[] = [];\n\n parts.push(`## Role\\n\\n${manifest.character.role}`);\n\n if (manifest.character.tone) {\n parts.push(`## Tone\\n\\n${manifest.character.tone}`);\n }\n\n if (\n manifest.character.guidelines &&\n manifest.character.guidelines.length > 0\n ) {\n const items = manifest.character.guidelines.map((g) => `- ${g}`).join(\"\\n\");\n parts.push(`## Guidelines\\n\\n${items}`);\n }\n\n if (manifest.character.instructions) {\n parts.push(`## Instructions\\n\\n${manifest.character.instructions}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n","/**\n * Convert a string to a valid skill name slug.\n */\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n || \"unnamed\";\n}\n\n/**\n * Extract a meaningful name from a filename.\n * \"CLAUDE.md\" → \"claude\", \".cursorrules\" → \"cursorrules\", \"api-rules.mdc\" → \"api-rules\"\n */\nexport function extractName(filename: string): string {\n const base = filename.split(\"/\").pop() ?? filename;\n return base\n .replace(/^\\./, \"\")\n .replace(/\\.(md|mdc|txt|instructions\\.md)$/i, \"\")\n .replace(/^(CLAUDE|AGENTS|copilot-instructions)$/i, (m) =>\n m.toLowerCase(),\n );\n}\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for legacy .cursorrules files.\n * Plain markdown, no frontmatter. Everything is instructions.\n */\nexport const cursorRulesImporter: Importer = {\n id: \"cursor-rules\",\n name: \"Cursor Rules (legacy)\",\n filePatterns: [\".cursorrules\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n if (!trimmed) {\n warnings.push(\"Empty .cursorrules file\");\n }\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cursor-rules\";\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from .cursorrules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-rules\",\n };\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface MdcFrontmatter {\n description?: string;\n globs?: string;\n alwaysApply?: boolean;\n}\n\n/**\n * Importer for Cursor MDC (.mdc) rule files.\n * YAML frontmatter with description, globs, alwaysApply + markdown body.\n */\nexport const cursorMdcImporter: Importer = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC Rules\",\n filePatterns: [\".cursor/rules/*.mdc\", \"*.mdc\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as MdcFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-mdc-rule\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cursor MDC\",\n schemaVersion: 3,\n confidence: 0.6,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-mdc\",\n };\n\n // Map globs to scoping\n if (fm.globs || fm.alwaysApply !== undefined) {\n canonical.scoping = {};\n if (fm.globs) {\n canonical.scoping.globs = fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean);\n }\n if (fm.description) {\n canonical.scoping.trigger = {\n description: fm.description,\n tags: [],\n priority: fm.alwaysApply ? 90 : 50,\n };\n }\n }\n\n if (!fm.description) {\n reviewNeeded.push(\"meta.description\");\n }\n reviewNeeded.push(\"meta.name\", \"identity\", \"constraints\");\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClaudeMdFrontmatter {\n paths?: string[];\n}\n\n/**\n * Importer for CLAUDE.md files.\n * Plain markdown, optionally with paths frontmatter (for .claude/rules/*.md).\n */\nexport const claudeMdImporter: Importer = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n filePatterns: [\"CLAUDE.md\", \".claude/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClaudeMdFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-claude-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from CLAUDE.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"claude-md\",\n };\n\n // Map paths to scoping\n if (fm.paths && fm.paths.length > 0) {\n canonical.scoping = {\n globs: fm.paths,\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for AGENTS.md files (GitHub Copilot coding agents).\n * Plain markdown, no frontmatter.\n */\nexport const agentsMdImporter: Importer = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n filePatterns: [\"AGENTS.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-agents-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from AGENTS.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"agents-md\",\n };\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface WindsurfFrontmatter {\n trigger?: \"always_on\" | \"model_decision\" | \"manual\" | \"glob\";\n globs?: string;\n description?: string;\n}\n\n/**\n * Importer for Windsurf rules.\n * .windsurfrules (legacy, plain text) or .windsurf/rules/*.md (with frontmatter).\n */\nexport const windsurfRulesImporter: Importer = {\n id: \"windsurf-rules\",\n name: \"Windsurf Rules\",\n filePatterns: [\".windsurfrules\", \".windsurf/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as WindsurfFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-windsurf-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Windsurf rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"windsurf-rules\",\n };\n\n if (fm.trigger === \"glob\" && fm.globs) {\n canonical.scoping = {\n globs: fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface CopilotFrontmatter {\n applyTo?: string;\n}\n\n/**\n * Importer for GitHub Copilot instructions.\n * copilot-instructions.md (no frontmatter) or *.instructions.md (with applyTo frontmatter).\n */\nexport const copilotImporter: Importer = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n filePatterns: [\n \".github/copilot-instructions.md\",\n \".github/instructions/*.instructions.md\",\n ],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as CopilotFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-copilot\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from Copilot instructions\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"copilot\",\n };\n\n if (fm.applyTo) {\n canonical.scoping = {\n globs: [fm.applyTo],\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClineFrontmatter {\n description?: string;\n globs?: string;\n paths?: string[];\n}\n\n/**\n * Importer for Cline rules.\n * Single .clinerules file (plain text) or .clinerules/*.md (with optional frontmatter).\n */\nexport const clineImporter: Importer = {\n id: \"cline\",\n name: \"Cline Rules\",\n filePatterns: [\".clinerules\", \".clinerules/*.md\", \".clinerules/*.txt\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClineFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cline-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cline rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cline\",\n };\n\n // Map glob patterns to scoping\n const globs: string[] = [];\n if (fm.globs) {\n globs.push(\n ...fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n );\n }\n if (fm.paths) {\n globs.push(...fm.paths);\n }\n if (globs.length > 0) {\n canonical.scoping = { globs };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { SourceFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { cursorRulesImporter } from \"./cursor-rules.js\";\nimport { cursorMdcImporter } from \"./cursor-mdc.js\";\nimport { claudeMdImporter } from \"./claude-md.js\";\nimport { agentsMdImporter } from \"./agents-md.js\";\nimport { windsurfRulesImporter } from \"./windsurf-rules.js\";\nimport { copilotImporter } from \"./copilot.js\";\nimport { clineImporter } from \"./cline.js\";\n\nconst importers: Importer[] = [\n cursorRulesImporter,\n cursorMdcImporter,\n claudeMdImporter,\n agentsMdImporter,\n windsurfRulesImporter,\n copilotImporter,\n clineImporter,\n];\n\n/**\n * Detect format from filename.\n */\nexport function detectFormat(filename: string): SourceFormat | null {\n const lower = filename.toLowerCase();\n const base = lower.split(\"/\").pop() ?? lower;\n\n if (base === \".cursorrules\") return \"cursor-rules\";\n if (base.endsWith(\".mdc\")) return \"cursor-mdc\";\n if (base === \"claude.md\") return \"claude-md\";\n if (base === \"agents.md\") return \"agents-md\";\n if (base === \".windsurfrules\") return \"windsurf-rules\";\n if (lower.includes(\".windsurf/rules/\")) return \"windsurf-rules\";\n if (base === \"copilot-instructions.md\") return \"copilot\";\n if (base.endsWith(\".instructions.md\")) return \"copilot\";\n if (base === \".clinerules\") return \"cline\";\n if (lower.includes(\".clinerules/\")) return \"cline\";\n if (lower.includes(\".claude/rules/\")) return \"claude-md\";\n\n return null;\n}\n\n/**\n * Get importer by format ID.\n */\nexport function getImporter(format: SourceFormat): Importer | null {\n return importers.find((i) => i.id === format) ?? null;\n}\n\n/**\n * Import content from a foreign format.\n */\nexport function importFromFormat(\n content: string,\n format: SourceFormat,\n options?: ImportOptions,\n): ImportResult {\n const importer = getImporter(format);\n if (!importer) {\n throw new Error(`No importer for format: ${format}`);\n }\n return importer.import(content, options);\n}\n\n/**\n * List all available importers.\n */\nexport function listImporters(): Importer[] {\n return [...importers];\n}\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { CompileOptions } from \"./types.js\";\n\n/**\n * Build inline knowledge section from knowledge blocks.\n */\nexport function buildKnowledgeSection(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string | null {\n const blocks = options?.knowledgeBlocks ?? canonical.knowledge?.inlineBlocks;\n if (!blocks || blocks.length === 0 || !options?.inlineKnowledge) {\n return null;\n }\n\n const parts = [\"## Reference Documentation\", \"\"];\n for (const block of blocks) {\n parts.push(`### ${block.label}`, \"\", block.content, \"\");\n }\n\n return parts.join(\"\\n\").trimEnd();\n}\n\n/**\n * Build a flat markdown body from canonical format for targets\n * that don't support structured frontmatter.\n */\nexport function buildFlatBody(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string {\n const parts: string[] = [];\n\n // Identity preamble\n if (canonical.identity) {\n if (canonical.identity.role) {\n parts.push(canonical.identity.role, \"\");\n }\n if (canonical.identity.tone) {\n parts.push(`Tone: ${canonical.identity.tone}`, \"\");\n }\n }\n\n // Main instructions\n parts.push(canonical.rawBody ?? canonical.instructions.content);\n\n // Constraints\n if (canonical.constraints) {\n if (\n canonical.constraints.always &&\n canonical.constraints.always.length > 0\n ) {\n parts.push(\n \"\",\n \"## Always\",\n \"\",\n ...canonical.constraints.always.map((c) => `- ${c}`),\n );\n }\n if (canonical.constraints.never && canonical.constraints.never.length > 0) {\n parts.push(\n \"\",\n \"## Never\",\n \"\",\n ...canonical.constraints.never.map((c) => `- ${c}`),\n );\n }\n }\n\n // Inline knowledge\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n parts.push(\"\", knowledgeSection);\n }\n\n return parts.join(\"\\n\").trim();\n}\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SkillFrontmatter } from \"../types/skill.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nfunction buildBody(canonical: CanonicalFormat): string {\n const parts: string[] = [];\n\n // Identity block\n if (canonical.identity) {\n const id = canonical.identity;\n const lines: string[] = [];\n if (id.role) lines.push(id.role);\n if (id.expertise?.length) lines.push(`**Expertise:** ${id.expertise.join(\", \")}`);\n if (id.tone) lines.push(`**Tone:** ${id.tone}`);\n if (lines.length) parts.push(lines.join(\"\\n\"));\n }\n\n // Instructions content (fallback for canonicals without sections)\n if (canonical.instructions.content) {\n parts.push(canonical.instructions.content);\n }\n\n // Instruction sections\n const sections = canonical.instructions.sections ?? [];\n for (const s of sections) {\n if (s.label || s.content) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else {\n parts.push(s.content);\n }\n }\n }\n\n // Constraints\n if (canonical.constraints) {\n const lines: string[] = [];\n if (canonical.constraints.always?.length) {\n lines.push(\"**Always:**\");\n for (const r of canonical.constraints.always) lines.push(`- ${r}`);\n }\n if (canonical.constraints.never?.length) {\n if (lines.length) lines.push(\"\");\n lines.push(\"**Never:**\");\n for (const r of canonical.constraints.never) lines.push(`- ${r}`);\n }\n if (lines.length) parts.push(`## Constraints\\n\\n${lines.join(\"\\n\")}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n\nexport const skillMdCompiler: Compiler = {\n id: \"skill-md\",\n name: \"SKILL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const warnings: string[] = [];\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) fm.language = canonical.meta.language;\n if (canonical.meta.repository) fm.repository = canonical.meta.repository;\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n let body = buildBody(canonical);\n\n // Append inline knowledge if requested\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SKILL.md\", content }],\n droppedFeatures: [],\n warnings,\n };\n },\n};\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SoulFrontmatter } from \"../types/soul.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nexport const soulMdCompiler: Compiler = {\n id: \"soul-md\",\n name: \"SOUL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n let body = canonical.rawBody ?? canonical.instructions.content;\n\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SOUL.md\", content }],\n droppedFeatures: [],\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorMdcCompiler: Compiler = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC (.mdc)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n\n // Build MDC frontmatter\n const description =\n canonical.scoping?.trigger?.description ?? canonical.meta.description;\n const globs =\n canonical.scoping?.globs ??\n canonical.scoping?.filePatterns ??\n [];\n const alwaysApply = globs.length === 0;\n\n const fmLines = [\n \"---\",\n `description: ${description}`,\n `globs: ${globs.join(\", \") || \"\"}`,\n `alwaysApply: ${alwaysApply}`,\n \"---\",\n ];\n\n const body = buildFlatBody(canonical, options);\n const content = fmLines.join(\"\\n\") + \"\\n\\n\" + body;\n\n const filename = canonical.meta.name + \".mdc\";\n const path = options?.basePath\n ? `${options.basePath}/${filename}`\n : `.cursor/rules/${filename}`;\n\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorRulesCompiler: Compiler = {\n id: \"cursor-rules\",\n name: \".cursorrules (legacy)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger || canonical.scoping?.filePatterns) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".cursorrules\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const claudeMdCompiler: Compiler = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"CLAUDE.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const agentsMdCompiler: Compiler = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"AGENTS.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nconst MAX_CHARS = 6000;\n\nexport const windsurfCompiler: Compiler = {\n id: \"windsurf\",\n name: \"Windsurf Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const warnings: string[] = [];\n let content = buildFlatBody(canonical, options);\n\n if (content.length > MAX_CHARS) {\n warnings.push(\n `Content truncated from ${content.length} to ${MAX_CHARS} characters (.windsurfrules limit)`,\n );\n content = content.slice(0, MAX_CHARS);\n }\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".windsurfrules\", content }],\n droppedFeatures,\n warnings,\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const copilotCompiler: Compiler = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [\n { path: \".github/copilot-instructions.md\", content },\n ],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const clineCompiler: Compiler = {\n id: \"cline\",\n name: \"Cline Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n const filename = canonical.meta.name + \".md\";\n\n return {\n files: [{ path: `.clinerules/${filename}`, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type {\n Compiler,\n CompileTarget,\n CompileResult,\n CompileOptions,\n} from \"./types.js\";\n\nimport { skillMdCompiler } from \"./skill-md.js\";\nimport { soulMdCompiler } from \"./soul-md.js\";\nimport { cursorMdcCompiler } from \"./cursor-mdc.js\";\nimport { cursorRulesCompiler } from \"./cursor-rules.js\";\nimport { claudeMdCompiler } from \"./claude-md.js\";\nimport { agentsMdCompiler } from \"./agents-md.js\";\nimport { windsurfCompiler } from \"./windsurf.js\";\nimport { copilotCompiler } from \"./copilot.js\";\nimport { clineCompiler } from \"./cline.js\";\n\nconst compilers: Compiler[] = [\n skillMdCompiler,\n soulMdCompiler,\n cursorMdcCompiler,\n cursorRulesCompiler,\n claudeMdCompiler,\n agentsMdCompiler,\n windsurfCompiler,\n copilotCompiler,\n clineCompiler,\n];\n\n/**\n * Compile a CanonicalFormat to a target format.\n */\nexport function compile(\n canonical: CanonicalFormat,\n target: CompileTarget,\n options?: CompileOptions,\n): CompileResult {\n const compiler = compilers.find((c) => c.id === target);\n if (!compiler) {\n throw new Error(`No compiler for target: ${target}`);\n }\n return compiler.compile(canonical, options);\n}\n\n/**\n * List all available compile targets.\n */\nexport function listTargets(): Compiler[] {\n return [...compilers];\n}\n\n/**\n * Get a compiler by target ID.\n */\nexport function getCompiler(target: CompileTarget): Compiler | null {\n return compilers.find((c) => c.id === target) ?? null;\n}\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,IAAM,YAAY;AAEX,SAAS,iBAAiB,KAG/B;AACA,QAAM,UAAU,IAAI,UAAU;AAC9B,MAAI,CAAC,QAAQ,WAAW,SAAS,GAAG;AAClC,WAAO,EAAE,MAAM,CAAC,GAAG,SAAS,IAAI;AAAA,EAClC;AAEA,QAAM,MAAM,QAAQ,QAAQ;AAAA,EAAK,SAAS,IAAI,UAAU,MAAM;AAC9D,MAAI,QAAQ,IAAI;AACd,WAAO,EAAE,MAAM,CAAC,GAAG,SAAS,IAAI;AAAA,EAClC;AAEA,QAAM,UAAU,QAAQ,MAAM,UAAU,QAAQ,GAAG,EAAE,KAAK;AAC1D,QAAM,OAAO,UAAW,KAAK,KAAK,OAAO,IAAgC,CAAC;AAC1E,QAAM,UAAU,QAAQ,MAAM,MAAM,UAAU,SAAS,CAA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,EACA;AAAA,EACA;AACF;AAKO,SAAS,QACd,WACA,QACA,SACe;AACf,QAAM,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM;AACtD,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,2BAA2B,MAAM,EAAE;AAAA,EACrD;AACA,SAAO,SAAS,QAAQ,WAAW,OAAO;AAC5C;AAKO,SAAS,cAA0B;AACxC,SAAO,CAAC,GAAG,SAAS;AACtB;AAKO,SAAS,YAAY,QAAwC;AAClE,SAAO,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,KAAK;AACnD;","names":["text","REQUIRED_FIELDS","Ajv","ajv","validateFn","validateFn"]}
1
+ {"version":3,"sources":["../src/frontmatter.ts","../src/parse/skill-parser.ts","../src/parse/soul-parser.ts","../src/schema/skill-schema.ts","../src/schema/soul-schema.ts","../src/convert/vercel-to-spm.ts","../src/convert/legacy.ts","../src/utils/slugify.ts","../src/parse/importers/cursor-rules.ts","../src/parse/importers/cursor-mdc.ts","../src/parse/importers/claude-md.ts","../src/parse/importers/agents-md.ts","../src/parse/importers/windsurf-rules.ts","../src/parse/importers/copilot.ts","../src/parse/importers/cline.ts","../src/parse/importers/index.ts","../src/compile/utils.ts","../src/compile/skill-md.ts","../src/compile/soul-md.ts","../src/compile/cursor-mdc.ts","../src/compile/cursor-rules.ts","../src/compile/claude-md.ts","../src/compile/agents-md.ts","../src/compile/windsurf.ts","../src/compile/copilot.ts","../src/compile/cline.ts","../src/compile/index.ts"],"sourcesContent":["import yaml from \"js-yaml\";\n\nconst DELIMITER = \"---\";\n\nexport function parseFrontmatter(raw: string): {\n data: Record<string, any>;\n content: string;\n} {\n const trimmed = raw.trimStart();\n if (!trimmed.startsWith(DELIMITER)) {\n return { data: {}, content: raw };\n }\n\n const end = trimmed.indexOf(`\\n${DELIMITER}`, DELIMITER.length);\n if (end === -1) {\n return { data: {}, content: raw };\n }\n\n const yamlStr = trimmed.slice(DELIMITER.length, end).trim();\n const data = yamlStr ? (yaml.load(yamlStr) as Record<string, unknown>) : {};\n const content = trimmed.slice(end + DELIMITER.length + 1).replace(/^\\n/, \"\");\n\n return { data: data ?? {}, content };\n}\n\nexport function stringifyFrontmatter(\n content: string,\n data: Record<string, unknown>,\n): string {\n const yamlStr = yaml.dump(data, { lineWidth: -1, noRefs: true }).trimEnd();\n return `---\\n${yamlStr}\\n---\\n${content}`;\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"schema_version\",\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nconst TRIGGER_REQUIRED = [\"description\", \"tags\", \"priority\"] as const;\n\nexport class SkillParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SkillParseError\";\n }\n}\n\n/**\n * Parse a SKILL.md string into frontmatter + body.\n */\nexport function parseSkill(content: string): ParsedSkill {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SkillParseError(\n `SKILL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n if (data.trigger) {\n const triggerMissing = TRIGGER_REQUIRED.filter(\n (f) => data.trigger[f] === undefined || data.trigger[f] === \"\",\n );\n if (triggerMissing.length > 0) {\n throw new SkillParseError(\n `trigger missing required fields: ${triggerMissing.join(\", \")}`,\n triggerMissing.map((f) => `trigger.${f}`),\n );\n }\n }\n\n return {\n frontmatter: data as SkillFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSkill back to SKILL.md string.\n */\nexport function serializeSkill(skill: ParsedSkill): string {\n return stringifyFrontmatter(skill.body, skill.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Split markdown body into preamble + H2 sections.\n */\nexport function splitBodyIntoSections(body: string): {\n sections: { label: string; content: string }[];\n} {\n const lines = body.split(\"\\n\");\n const sections: { label: string; content: string }[] = [];\n let currentLabel: string | null = null;\n let currentLines: string[] = [];\n\n for (const line of lines) {\n const h2Match = line.match(/^## (.+)$/);\n if (h2Match) {\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n currentLabel = h2Match[1].trim();\n currentLines = [];\n } else {\n currentLines.push(line);\n }\n }\n\n const text = currentLines.join(\"\\n\").trim();\n if (currentLabel !== null || text) {\n sections.push({ label: currentLabel ?? \"\", content: text });\n }\n\n return { sections };\n}\n\n/**\n * Normalize a CanonicalFormat: split instructions.content by H2 headers\n * into sections if sections are not already populated.\n */\n/**\n * Normalize: always parse instructions.content into sections for UI.\n * Sections are never stored — they are derived from content.\n */\nexport function normalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const { content } = canonical.instructions;\n if (!content) return canonical;\n\n const { sections } = splitBodyIntoSections(content);\n if (sections.length === 0) return canonical;\n\n return {\n ...canonical,\n instructions: {\n content: \"\",\n sections: sections.map((s) => ({\n type: \"custom\" as const,\n label: s.label,\n content: s.content,\n })),\n },\n };\n}\n\n/**\n * Denormalize: merge sections back into flat content for storage.\n */\nexport function denormalizeCanonical(canonical: CanonicalFormat): CanonicalFormat {\n const sections = canonical.instructions.sections ?? [];\n if (sections.length === 0) return canonical;\n\n const parts: string[] = [];\n for (const s of sections) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else if (s.content) {\n parts.push(s.content);\n }\n }\n\n return {\n ...canonical,\n instructions: { content: parts.join(\"\\n\\n\") },\n };\n}\n\n/**\n * Convert a ParsedSkill to CanonicalFormat.\n */\nexport function parsedSkillToCanonical(skill: ParsedSkill): CanonicalFormat {\n const fm = skill.frontmatter;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: fm.schema_version,\n language: fm.language,\n repository: fm.repository,\n confidence: 1.0,\n },\n instructions: {\n content: skill.body,\n },\n rawBody: skill.body,\n sourceFormat: \"skill-md\",\n };\n\n if (fm.trigger) {\n canonical.scoping = {\n trigger: {\n description: fm.trigger.description,\n tags: fm.trigger.tags,\n priority: fm.trigger.priority,\n },\n filePatterns: fm.trigger.file_patterns,\n };\n }\n\n if (fm.security || fm.dependencies || fm.compatibility || fm.works_with) {\n canonical.dependencies = {};\n if (fm.dependencies) {\n canonical.dependencies.skills = fm.dependencies;\n }\n if (fm.security) {\n canonical.dependencies.security = {\n permissions: fm.security.permissions,\n fileScope: fm.security.file_scope,\n };\n }\n if (fm.compatibility) {\n canonical.dependencies.compatibility = {\n minContextTokens: fm.compatibility.min_context_tokens,\n requires: fm.compatibility.requires,\n models: fm.compatibility.models,\n };\n }\n if (fm.works_with) {\n canonical.dependencies.worksWith = fm.works_with;\n }\n }\n\n if (fm.docs) {\n canonical.knowledge = {\n docSources: fm.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: fm.docs.delivery,\n priorityPages: fm.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSkill.\n */\nexport function canonicalToParsedSkill(canonical: CanonicalFormat): ParsedSkill {\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) {\n fm.language = canonical.meta.language;\n }\n if (canonical.meta.repository) {\n fm.repository = canonical.meta.repository;\n }\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import { parseFrontmatter, stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { ParsedSoul, SoulFrontmatter } from \"../types/soul.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\n\nconst REQUIRED_FIELDS = [\n \"name\",\n \"version\",\n \"author\",\n \"license\",\n \"description\",\n] as const;\n\nexport class SoulParseError extends Error {\n constructor(\n message: string,\n public readonly fields: string[] = [],\n ) {\n super(message);\n this.name = \"SoulParseError\";\n }\n}\n\n/**\n * Parse a SOUL.md string into frontmatter + body.\n */\nexport function parseSoul(content: string): ParsedSoul {\n const { data, content: body } = parseFrontmatter(content);\n\n const missing = REQUIRED_FIELDS.filter(\n (f) => data[f] === undefined || data[f] === \"\",\n );\n if (missing.length > 0) {\n throw new SoulParseError(\n `SOUL.md missing required fields: ${missing.join(\", \")}`,\n missing as unknown as string[],\n );\n }\n\n return {\n frontmatter: data as SoulFrontmatter,\n body: body.trim(),\n };\n}\n\n/**\n * Serialize a ParsedSoul back to SOUL.md string.\n */\nexport function serializeSoul(soul: ParsedSoul): string {\n return stringifyFrontmatter(soul.body, soul.frontmatter as unknown as Record<string, unknown>);\n}\n\n/**\n * Replace {{PLACEHOLDER}} tokens in body with provided values.\n */\nexport function resolveContextSlots(\n body: string,\n values: Record<string, string>,\n): string {\n return body.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key: string) => {\n return values[key] ?? match;\n });\n}\n\n/**\n * Convert a ParsedSoul to CanonicalFormat.\n */\nexport function parsedSoulToCanonical(soul: ParsedSoul): CanonicalFormat {\n const fm = soul.frontmatter;\n const sb = fm.skillbase;\n\n const canonical: CanonicalFormat = {\n meta: {\n name: fm.name,\n version: fm.version,\n author: fm.author,\n license: fm.license,\n description: fm.description,\n schemaVersion: sb?.schema_version ?? 3,\n confidence: 1.0,\n },\n instructions: {\n content: soul.body,\n },\n rawBody: soul.body,\n sourceFormat: \"soul-md\",\n };\n\n if (sb?.trigger) {\n canonical.scoping = {\n trigger: {\n description: sb.trigger.description,\n tags: sb.trigger.tags,\n priority: sb.trigger.priority,\n },\n filePatterns: sb.trigger.file_patterns,\n };\n }\n\n if (sb?.skills) {\n canonical.dependencies = {\n ...canonical.dependencies,\n skills: sb.skills,\n };\n }\n\n if (sb?.constraints) {\n canonical.constraints = {\n always: sb.constraints.always,\n never: sb.constraints.never,\n };\n }\n\n if (sb?.identity) {\n canonical.identity = {\n role: sb.identity.role,\n tone: sb.identity.tone,\n expertise: sb.identity.expertise,\n };\n }\n\n if (sb?.settings) {\n canonical.settings = { ...sb.settings };\n }\n\n if (sb?.docs) {\n canonical.knowledge = {\n docSources: sb.docs.sources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshotVersion: s.snapshot_version,\n maxTokens: s.max_tokens,\n })),\n delivery: sb.docs.delivery,\n priorityPages: sb.docs.priority_pages,\n };\n }\n\n return canonical;\n}\n\n/**\n * Convert a CanonicalFormat back to ParsedSoul.\n */\nexport function canonicalToParsedSoul(canonical: CanonicalFormat): ParsedSoul {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n const body = canonical.rawBody ?? canonical.instructions.content;\n\n return { frontmatter: fm, body };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst skillFrontmatterSchema = {\n type: \"object\" as const,\n required: [\n \"schema_version\",\n \"name\",\n \"version\",\n \"description\",\n \"author\",\n \"license\",\n ],\n additionalProperties: false,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n language: { type: \"string\" as const, enum: [\"en\"], nullable: true },\n description: { type: \"string\" as const, minLength: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n additionalProperties: false,\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n file_patterns: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n dependencies: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n compatibility: {\n type: \"object\" as const,\n nullable: true,\n required: [\"min_context_tokens\", \"requires\", \"models\"],\n additionalProperties: false,\n properties: {\n min_context_tokens: { type: \"integer\" as const, minimum: 0 },\n requires: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n models: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n },\n },\n works_with: {\n type: \"array\" as const,\n nullable: true,\n items: {\n type: \"object\" as const,\n required: [\"skill\", \"relationship\", \"description\"],\n additionalProperties: false,\n properties: {\n skill: { type: \"string\" as const },\n relationship: {\n type: \"string\" as const,\n enum: [\"input\", \"output\", \"parallel\"],\n },\n description: { type: \"string\" as const },\n },\n },\n },\n security: {\n type: \"object\" as const,\n nullable: true,\n required: [\"permissions\"],\n additionalProperties: false,\n properties: {\n permissions: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n },\n file_scope: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n integrity: { type: \"string\" as const, nullable: true },\n },\n },\n docs: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: false,\n properties: {\n sources: {\n type: \"array\" as const,\n items: {\n type: \"object\" as const,\n required: [\"type\", \"url\"],\n additionalProperties: false,\n properties: {\n type: {\n type: \"string\" as const,\n enum: [\"url\", \"llms-txt\", \"github\"],\n },\n url: { type: \"string\" as const, minLength: 1 },\n scope: {\n type: \"string\" as const,\n enum: [\"crawl\", \"page\", \"sitemap\"],\n nullable: true,\n },\n depth: {\n type: \"integer\" as const,\n minimum: 0,\n maximum: 5,\n nullable: true,\n },\n include: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n exclude: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n label: { type: \"string\" as const, nullable: true },\n blocks: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n snapshot_version: { type: \"string\" as const, nullable: true },\n max_tokens: {\n type: \"integer\" as const,\n minimum: 0,\n nullable: true,\n },\n },\n },\n },\n delivery: {\n type: \"string\" as const,\n enum: [\"local\", \"remote\", \"auto\"],\n nullable: true,\n },\n priority_pages: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n nullable: true,\n },\n },\n },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n repository: { type: \"string\" as const, nullable: true },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(skillFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSkillFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import Ajv from \"ajv\";\nimport type { ValidationResult } from \"../types/common.js\";\n\nconst soulFrontmatterSchema = {\n type: \"object\" as const,\n required: [\"name\", \"version\", \"author\", \"license\", \"description\"],\n additionalProperties: true,\n properties: {\n name: {\n type: \"string\" as const,\n pattern: \"^[a-z0-9][a-z0-9-]*$\",\n },\n version: {\n type: \"string\" as const,\n pattern: \"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+\",\n },\n description: { type: \"string\" as const, minLength: 1 },\n author: { type: \"string\" as const, minLength: 1 },\n license: { type: \"string\" as const, minLength: 1 },\n skillbase: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: true,\n properties: {\n schema_version: { type: \"integer\" as const, minimum: 1 },\n trigger: {\n type: \"object\" as const,\n nullable: true,\n required: [\"description\", \"tags\", \"priority\"],\n properties: {\n description: { type: \"string\" as const, minLength: 1 },\n tags: {\n type: \"array\" as const,\n items: { type: \"string\" as const },\n minItems: 1,\n },\n priority: { type: \"integer\" as const, minimum: 0, maximum: 100 },\n },\n },\n skills: {\n type: \"object\" as const,\n nullable: true,\n additionalProperties: { type: \"string\" as const },\n },\n settings: {\n type: \"object\" as const,\n nullable: true,\n properties: {\n temperature: { type: \"number\" as const, minimum: 0, maximum: 2 },\n top_p: { type: \"number\" as const, minimum: 0, maximum: 1 },\n },\n },\n },\n },\n },\n};\n\nconst ajv = new Ajv.default({ allErrors: true });\nconst validateFn = ajv.compile(soulFrontmatterSchema);\n\nexport { type ValidationResult };\n\nexport function validateSoulFrontmatter(data: unknown): ValidationResult {\n const valid = validateFn(data);\n if (valid) {\n return { valid: true, errors: [] };\n }\n const errors = (validateFn.errors ?? []).map(\n (e: { instancePath?: string; message?: string }) => {\n const path = e.instancePath || \"/\";\n return `${path}: ${e.message}`;\n },\n );\n return { valid: false, errors };\n}\n","import type { ParsedSkill, SkillFrontmatter } from \"../types/skill.js\";\n\nexport interface VercelFrontmatter {\n name: string;\n description: string;\n license?: string;\n metadata?: Record<string, unknown>;\n \"allowed-tools\"?: string[];\n \"user-invocable\"?: boolean;\n [key: string]: unknown;\n}\n\nconst STOP_WORDS = new Set([\n \"a\", \"an\", \"the\", \"and\", \"or\", \"for\", \"to\", \"in\", \"on\", \"of\", \"is\", \"it\",\n \"with\", \"that\", \"this\", \"use\", \"when\", \"how\", \"what\", \"your\", \"you\",\n]);\n\nexport function inferTags(name: string, description: string): string[] {\n const tags = new Set<string>();\n\n for (const token of name.split(\"-\")) {\n if (token.length > 1 && !STOP_WORDS.has(token)) {\n tags.add(token);\n }\n }\n\n const words = description\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .split(/\\s+/)\n .filter((w) => w.length > 2 && !STOP_WORDS.has(w));\n\n for (const word of words.slice(0, 10)) {\n if (tags.size >= 8) break;\n tags.add(word);\n }\n\n if (tags.size === 0) {\n tags.add(name);\n }\n\n return [...tags].slice(0, 8);\n}\n\nconst TOOL_TO_PERMISSION: Record<string, string> = {\n bash: \"bash:execute\",\n file_read: \"file:read\",\n file_write: \"file:write\",\n web_fetch: \"network:allowlist\",\n terminal: \"bash:execute\",\n shell: \"bash:execute\",\n};\n\nfunction mapPermissions(allowedTools?: string[]): string[] {\n if (!allowedTools || allowedTools.length === 0) return [];\n\n const permissions: string[] = [];\n for (const tool of allowedTools) {\n const normalized = tool.toLowerCase().replace(/-/g, \"_\");\n const mapped = TOOL_TO_PERMISSION[normalized];\n if (mapped && !permissions.includes(mapped)) {\n permissions.push(mapped);\n }\n }\n return permissions;\n}\n\nexport function isVercelFormat(data: Record<string, unknown>): boolean {\n return (\n !data.schema_version &&\n typeof data.name === \"string\" &&\n typeof data.description === \"string\"\n );\n}\n\nexport function convertVercelToSpm(\n vercel: VercelFrontmatter,\n body: string,\n options: { author: string; license?: string; repository?: string },\n): ParsedSkill {\n const name = vercel.name\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n\n const frontmatter: SkillFrontmatter = {\n schema_version: 3,\n name,\n version: \"1.0.0\",\n author: options.author,\n license: vercel.license || options.license || \"MIT\",\n description: vercel.description,\n language: \"en\",\n trigger: {\n description: vercel.description,\n tags: inferTags(name, vercel.description),\n priority: 50,\n },\n security: {\n permissions: mapPermissions(vercel[\"allowed-tools\"]),\n },\n };\n\n if (options.repository) {\n frontmatter.repository = options.repository;\n }\n\n return { frontmatter, body: body.trim() };\n}\n","import type { SoulFrontmatter, SoulSkillbaseBlock } from \"../types/soul.js\";\nimport type { LegacyPersonaManifest } from \"../types/legacy.js\";\n\n/**\n * Convert a legacy PersonaManifest to SoulFrontmatter.\n */\nexport function legacyPersonaToSoul(\n manifest: LegacyPersonaManifest,\n): SoulFrontmatter {\n const soul: SoulFrontmatter = {\n name: manifest.name,\n version: manifest.version,\n author: manifest.author,\n license: manifest.license,\n description: manifest.description,\n };\n\n const skillbase: SoulSkillbaseBlock = {\n schema_version: 3,\n };\n\n if (manifest.skills && Object.keys(manifest.skills).length > 0) {\n skillbase.skills = manifest.skills;\n }\n\n if (manifest.settings) {\n skillbase.settings = manifest.settings;\n }\n\n soul.skillbase = skillbase;\n return soul;\n}\n\n/**\n * Build markdown body from legacy persona character fields.\n */\nexport function buildLegacyBody(manifest: LegacyPersonaManifest): string {\n const parts: string[] = [];\n\n parts.push(`## Role\\n\\n${manifest.character.role}`);\n\n if (manifest.character.tone) {\n parts.push(`## Tone\\n\\n${manifest.character.tone}`);\n }\n\n if (\n manifest.character.guidelines &&\n manifest.character.guidelines.length > 0\n ) {\n const items = manifest.character.guidelines.map((g) => `- ${g}`).join(\"\\n\");\n parts.push(`## Guidelines\\n\\n${items}`);\n }\n\n if (manifest.character.instructions) {\n parts.push(`## Instructions\\n\\n${manifest.character.instructions}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n","/**\n * Convert a string to a valid skill name slug.\n */\nexport function slugify(input: string): string {\n return input\n .toLowerCase()\n .replace(/[^a-z0-9-]/g, \"-\")\n .replace(/-+/g, \"-\")\n .replace(/^-|-$/g, \"\")\n || \"unnamed\";\n}\n\n/**\n * Extract a meaningful name from a filename.\n * \"CLAUDE.md\" → \"claude\", \".cursorrules\" → \"cursorrules\", \"api-rules.mdc\" → \"api-rules\"\n */\nexport function extractName(filename: string): string {\n const base = filename.split(\"/\").pop() ?? filename;\n return base\n .replace(/^\\./, \"\")\n .replace(/\\.(md|mdc|txt|instructions\\.md)$/i, \"\")\n .replace(/^(CLAUDE|AGENTS|copilot-instructions)$/i, (m) =>\n m.toLowerCase(),\n );\n}\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for legacy .cursorrules files.\n * Plain markdown, no frontmatter. Everything is instructions.\n */\nexport const cursorRulesImporter: Importer = {\n id: \"cursor-rules\",\n name: \"Cursor Rules (legacy)\",\n filePatterns: [\".cursorrules\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n if (!trimmed) {\n warnings.push(\"Empty .cursorrules file\");\n }\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cursor-rules\";\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from .cursorrules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-rules\",\n };\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface MdcFrontmatter {\n description?: string;\n globs?: string;\n alwaysApply?: boolean;\n}\n\n/**\n * Importer for Cursor MDC (.mdc) rule files.\n * YAML frontmatter with description, globs, alwaysApply + markdown body.\n */\nexport const cursorMdcImporter: Importer = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC Rules\",\n filePatterns: [\".cursor/rules/*.mdc\", \"*.mdc\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as MdcFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-mdc-rule\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cursor MDC\",\n schemaVersion: 3,\n confidence: 0.6,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cursor-mdc\",\n };\n\n // Map globs to scoping\n if (fm.globs || fm.alwaysApply !== undefined) {\n canonical.scoping = {};\n if (fm.globs) {\n canonical.scoping.globs = fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean);\n }\n if (fm.description) {\n canonical.scoping.trigger = {\n description: fm.description,\n tags: [],\n priority: fm.alwaysApply ? 90 : 50,\n };\n }\n }\n\n if (!fm.description) {\n reviewNeeded.push(\"meta.description\");\n }\n reviewNeeded.push(\"meta.name\", \"identity\", \"constraints\");\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClaudeMdFrontmatter {\n paths?: string[];\n}\n\n/**\n * Importer for CLAUDE.md files.\n * Plain markdown, optionally with paths frontmatter (for .claude/rules/*.md).\n */\nexport const claudeMdImporter: Importer = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n filePatterns: [\"CLAUDE.md\", \".claude/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClaudeMdFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-claude-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from CLAUDE.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"claude-md\",\n };\n\n // Map paths to scoping\n if (fm.paths && fm.paths.length > 0) {\n canonical.scoping = {\n globs: fm.paths,\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\n/**\n * Importer for AGENTS.md files (GitHub Copilot coding agents).\n * Plain markdown, no frontmatter.\n */\nexport const agentsMdImporter: Importer = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n filePatterns: [\"AGENTS.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n const trimmed = content.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-agents-md\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from AGENTS.md\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"agents-md\",\n };\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface WindsurfFrontmatter {\n trigger?: \"always_on\" | \"model_decision\" | \"manual\" | \"glob\";\n globs?: string;\n description?: string;\n}\n\n/**\n * Importer for Windsurf rules.\n * .windsurfrules (legacy, plain text) or .windsurf/rules/*.md (with frontmatter).\n */\nexport const windsurfRulesImporter: Importer = {\n id: \"windsurf-rules\",\n name: \"Windsurf Rules\",\n filePatterns: [\".windsurfrules\", \".windsurf/rules/*.md\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as WindsurfFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-windsurf-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Windsurf rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"windsurf-rules\",\n };\n\n if (fm.trigger === \"glob\" && fm.globs) {\n canonical.scoping = {\n globs: fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface CopilotFrontmatter {\n applyTo?: string;\n}\n\n/**\n * Importer for GitHub Copilot instructions.\n * copilot-instructions.md (no frontmatter) or *.instructions.md (with applyTo frontmatter).\n */\nexport const copilotImporter: Importer = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n filePatterns: [\n \".github/copilot-instructions.md\",\n \".github/instructions/*.instructions.md\",\n ],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as CopilotFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-copilot\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: \"Imported from Copilot instructions\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"copilot\",\n };\n\n if (fm.applyTo) {\n canonical.scoping = {\n globs: [fm.applyTo],\n };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import { parseFrontmatter } from \"../../frontmatter.js\";\nimport type { CanonicalFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { slugify, extractName } from \"../../utils/slugify.js\";\n\ninterface ClineFrontmatter {\n description?: string;\n globs?: string;\n paths?: string[];\n}\n\n/**\n * Importer for Cline rules.\n * Single .clinerules file (plain text) or .clinerules/*.md (with optional frontmatter).\n */\nexport const clineImporter: Importer = {\n id: \"cline\",\n name: \"Cline Rules\",\n filePatterns: [\".clinerules\", \".clinerules/*.md\", \".clinerules/*.txt\"],\n\n import(content: string, options?: ImportOptions): ImportResult {\n const warnings: string[] = [];\n const reviewNeeded: string[] = [];\n\n const { data, content: body } = parseFrontmatter(content);\n const fm = data as ClineFrontmatter;\n const trimmed = body.trim();\n\n const name = options?.filename\n ? slugify(extractName(options.filename))\n : \"imported-cline-rules\";\n\n const canonical: CanonicalFormat = {\n meta: {\n name,\n version: \"1.0.0\",\n author: options?.defaultAuthor ?? \"unknown\",\n license: options?.defaultLicense ?? \"MIT\",\n description: fm.description || \"Imported from Cline rules\",\n schemaVersion: 3,\n confidence: 0.5,\n },\n instructions: {\n content: trimmed,\n },\n sourceFormat: \"cline\",\n };\n\n // Map glob patterns to scoping\n const globs: string[] = [];\n if (fm.globs) {\n globs.push(\n ...fm.globs\n .split(\",\")\n .map((g) => g.trim())\n .filter(Boolean),\n );\n }\n if (fm.paths) {\n globs.push(...fm.paths);\n }\n if (globs.length > 0) {\n canonical.scoping = { globs };\n }\n\n reviewNeeded.push(\n \"meta.name\",\n \"meta.description\",\n \"identity\",\n \"scoping\",\n \"constraints\",\n );\n\n return { canonical, warnings, reviewNeeded };\n },\n};\n","import type { SourceFormat } from \"../../types/canonical.js\";\nimport type { Importer, ImportOptions, ImportResult } from \"./types.js\";\nimport { cursorRulesImporter } from \"./cursor-rules.js\";\nimport { cursorMdcImporter } from \"./cursor-mdc.js\";\nimport { claudeMdImporter } from \"./claude-md.js\";\nimport { agentsMdImporter } from \"./agents-md.js\";\nimport { windsurfRulesImporter } from \"./windsurf-rules.js\";\nimport { copilotImporter } from \"./copilot.js\";\nimport { clineImporter } from \"./cline.js\";\n\nconst importers: Importer[] = [\n cursorRulesImporter,\n cursorMdcImporter,\n claudeMdImporter,\n agentsMdImporter,\n windsurfRulesImporter,\n copilotImporter,\n clineImporter,\n];\n\n/**\n * Detect format from filename.\n */\nexport function detectFormat(filename: string): SourceFormat | null {\n const lower = filename.toLowerCase();\n const base = lower.split(\"/\").pop() ?? lower;\n\n if (base === \".cursorrules\") return \"cursor-rules\";\n if (base.endsWith(\".mdc\")) return \"cursor-mdc\";\n if (base === \"claude.md\") return \"claude-md\";\n if (base === \"agents.md\") return \"agents-md\";\n if (base === \".windsurfrules\") return \"windsurf-rules\";\n if (lower.includes(\".windsurf/rules/\")) return \"windsurf-rules\";\n if (base === \"copilot-instructions.md\") return \"copilot\";\n if (base.endsWith(\".instructions.md\")) return \"copilot\";\n if (base === \".clinerules\") return \"cline\";\n if (lower.includes(\".clinerules/\")) return \"cline\";\n if (lower.includes(\".claude/rules/\")) return \"claude-md\";\n\n return null;\n}\n\n/**\n * Get importer by format ID.\n */\nexport function getImporter(format: SourceFormat): Importer | null {\n return importers.find((i) => i.id === format) ?? null;\n}\n\n/**\n * Import content from a foreign format.\n */\nexport function importFromFormat(\n content: string,\n format: SourceFormat,\n options?: ImportOptions,\n): ImportResult {\n const importer = getImporter(format);\n if (!importer) {\n throw new Error(`No importer for format: ${format}`);\n }\n return importer.import(content, options);\n}\n\n/**\n * List all available importers.\n */\nexport function listImporters(): Importer[] {\n return [...importers];\n}\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { CompileOptions } from \"./types.js\";\n\n/**\n * Build inline knowledge section from knowledge blocks.\n */\nexport function buildKnowledgeSection(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string | null {\n const blocks = options?.knowledgeBlocks ?? canonical.knowledge?.inlineBlocks;\n if (!blocks || blocks.length === 0 || !options?.inlineKnowledge) {\n return null;\n }\n\n const parts = [\"## Reference Documentation\", \"\"];\n for (const block of blocks) {\n parts.push(`### ${block.label}`, \"\", block.content, \"\");\n }\n\n return parts.join(\"\\n\").trimEnd();\n}\n\n/**\n * Build a flat markdown body from canonical format for targets\n * that don't support structured frontmatter.\n */\nexport function buildFlatBody(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n): string {\n const parts: string[] = [];\n\n // Identity preamble\n if (canonical.identity) {\n if (canonical.identity.role) {\n parts.push(canonical.identity.role, \"\");\n }\n if (canonical.identity.tone) {\n parts.push(`Tone: ${canonical.identity.tone}`, \"\");\n }\n }\n\n // Main instructions\n parts.push(canonical.rawBody ?? canonical.instructions.content);\n\n // Constraints\n if (canonical.constraints) {\n if (\n canonical.constraints.always &&\n canonical.constraints.always.length > 0\n ) {\n parts.push(\n \"\",\n \"## Always\",\n \"\",\n ...canonical.constraints.always.map((c) => `- ${c}`),\n );\n }\n if (canonical.constraints.never && canonical.constraints.never.length > 0) {\n parts.push(\n \"\",\n \"## Never\",\n \"\",\n ...canonical.constraints.never.map((c) => `- ${c}`),\n );\n }\n }\n\n // Inline knowledge\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n parts.push(\"\", knowledgeSection);\n }\n\n return parts.join(\"\\n\").trim();\n}\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SkillFrontmatter } from \"../types/skill.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nfunction buildBody(canonical: CanonicalFormat): string {\n const parts: string[] = [];\n\n // Identity block\n if (canonical.identity) {\n const id = canonical.identity;\n const lines: string[] = [];\n if (id.role) lines.push(id.role);\n if (id.expertise?.length) lines.push(`**Expertise:** ${id.expertise.join(\", \")}`);\n if (id.tone) lines.push(`**Tone:** ${id.tone}`);\n if (lines.length) parts.push(lines.join(\"\\n\"));\n }\n\n // Instructions content (fallback for canonicals without sections)\n if (canonical.instructions.content) {\n parts.push(canonical.instructions.content);\n }\n\n // Instruction sections\n const sections = canonical.instructions.sections ?? [];\n for (const s of sections) {\n if (s.label || s.content) {\n if (s.label) {\n parts.push(`## ${s.label}\\n\\n${s.content}`);\n } else {\n parts.push(s.content);\n }\n }\n }\n\n // Constraints\n if (canonical.constraints) {\n const lines: string[] = [];\n if (canonical.constraints.always?.length) {\n lines.push(\"**Always:**\");\n for (const r of canonical.constraints.always) lines.push(`- ${r}`);\n }\n if (canonical.constraints.never?.length) {\n if (lines.length) lines.push(\"\");\n lines.push(\"**Never:**\");\n for (const r of canonical.constraints.never) lines.push(`- ${r}`);\n }\n if (lines.length) parts.push(`## Constraints\\n\\n${lines.join(\"\\n\")}`);\n }\n\n return parts.join(\"\\n\\n\");\n}\n\nexport const skillMdCompiler: Compiler = {\n id: \"skill-md\",\n name: \"SKILL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const warnings: string[] = [];\n const fm: SkillFrontmatter = {\n schema_version: canonical.meta.schemaVersion,\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n if (canonical.meta.language) fm.language = canonical.meta.language;\n if (canonical.meta.repository) fm.repository = canonical.meta.repository;\n\n if (canonical.scoping?.trigger) {\n fm.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n\n if (canonical.dependencies?.skills) {\n fm.dependencies = canonical.dependencies.skills;\n }\n if (canonical.dependencies?.security) {\n fm.security = {\n permissions: canonical.dependencies.security.permissions,\n file_scope: canonical.dependencies.security.fileScope,\n };\n }\n if (canonical.dependencies?.compatibility) {\n fm.compatibility = {\n min_context_tokens:\n canonical.dependencies.compatibility.minContextTokens ?? 0,\n requires: canonical.dependencies.compatibility.requires ?? [],\n models: canonical.dependencies.compatibility.models ?? [],\n };\n }\n if (canonical.dependencies?.worksWith) {\n fm.works_with = canonical.dependencies.worksWith;\n }\n\n if (canonical.knowledge?.docSources) {\n fm.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n\n let body = buildBody(canonical);\n\n // Append inline knowledge if requested\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SKILL.md\", content }],\n droppedFeatures: [],\n warnings,\n };\n },\n};\n","import { stringifyFrontmatter } from \"../frontmatter.js\";\nimport type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { SoulFrontmatter } from \"../types/soul.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildKnowledgeSection } from \"./utils.js\";\n\nexport const soulMdCompiler: Compiler = {\n id: \"soul-md\",\n name: \"SOUL.md (Skillbase)\",\n multiFile: false,\n supports: {\n frontmatter: true,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: true,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const fm: SoulFrontmatter = {\n name: canonical.meta.name,\n version: canonical.meta.version,\n author: canonical.meta.author,\n license: canonical.meta.license,\n description: canonical.meta.description,\n };\n\n const hasSkillbase =\n canonical.scoping?.trigger ||\n canonical.dependencies?.skills ||\n canonical.constraints ||\n canonical.identity ||\n canonical.settings ||\n canonical.knowledge?.docSources;\n\n if (hasSkillbase) {\n fm.skillbase = {\n schema_version: canonical.meta.schemaVersion,\n };\n if (canonical.identity) {\n fm.skillbase.identity = {\n role: canonical.identity.role,\n tone: canonical.identity.tone,\n expertise: canonical.identity.expertise,\n };\n }\n if (canonical.scoping?.trigger) {\n fm.skillbase.trigger = {\n description: canonical.scoping.trigger.description,\n tags: canonical.scoping.trigger.tags,\n priority: canonical.scoping.trigger.priority,\n };\n if (canonical.scoping.filePatterns) {\n fm.skillbase.trigger.file_patterns = canonical.scoping.filePatterns;\n }\n }\n if (canonical.dependencies?.skills) {\n fm.skillbase.skills = canonical.dependencies.skills;\n }\n if (canonical.constraints) {\n fm.skillbase.constraints = {\n always: canonical.constraints.always,\n never: canonical.constraints.never,\n };\n }\n if (canonical.settings) {\n fm.skillbase.settings = { ...canonical.settings };\n }\n if (canonical.knowledge?.docSources) {\n fm.skillbase.docs = {\n sources: canonical.knowledge.docSources.map((s) => ({\n type: s.type,\n url: s.url,\n scope: s.scope,\n depth: s.depth,\n include: s.include,\n exclude: s.exclude,\n label: s.label,\n blocks: s.blocks,\n snapshot_version: s.snapshotVersion,\n max_tokens: s.maxTokens,\n })),\n delivery: canonical.knowledge.delivery,\n priority_pages: canonical.knowledge.priorityPages,\n };\n }\n }\n\n let body = canonical.rawBody ?? canonical.instructions.content;\n\n const knowledgeSection = buildKnowledgeSection(canonical, options);\n if (knowledgeSection) {\n body = body + \"\\n\\n\" + knowledgeSection;\n }\n\n const content = stringifyFrontmatter(body, fm as unknown as Record<string, unknown>);\n\n return {\n files: [{ path: \"SOUL.md\", content }],\n droppedFeatures: [],\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorMdcCompiler: Compiler = {\n id: \"cursor-mdc\",\n name: \"Cursor MDC (.mdc)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: true,\n filePatterns: true,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n\n // Build MDC frontmatter\n const description =\n canonical.scoping?.trigger?.description ?? canonical.meta.description;\n const globs =\n canonical.scoping?.globs ??\n canonical.scoping?.filePatterns ??\n [];\n const alwaysApply = globs.length === 0;\n\n const fmLines = [\n \"---\",\n `description: ${description}`,\n `globs: ${globs.join(\", \") || \"\"}`,\n `alwaysApply: ${alwaysApply}`,\n \"---\",\n ];\n\n const body = buildFlatBody(canonical, options);\n const content = fmLines.join(\"\\n\") + \"\\n\\n\" + body;\n\n const filename = canonical.meta.name + \".mdc\";\n const path = options?.basePath\n ? `${options.basePath}/${filename}`\n : `.cursor/rules/${filename}`;\n\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const cursorRulesCompiler: Compiler = {\n id: \"cursor-rules\",\n name: \".cursorrules (legacy)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger || canonical.scoping?.filePatterns) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".cursorrules\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const claudeMdCompiler: Compiler = {\n id: \"claude-md\",\n name: \"CLAUDE.md (Claude Code)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"CLAUDE.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const agentsMdCompiler: Compiler = {\n id: \"agents-md\",\n name: \"AGENTS.md (GitHub Copilot)\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \"AGENTS.md\", content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nconst MAX_CHARS = 6000;\n\nexport const windsurfCompiler: Compiler = {\n id: \"windsurf\",\n name: \"Windsurf Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const warnings: string[] = [];\n let content = buildFlatBody(canonical, options);\n\n if (content.length > MAX_CHARS) {\n warnings.push(\n `Content truncated from ${content.length} to ${MAX_CHARS} characters (.windsurfrules limit)`,\n );\n content = content.slice(0, MAX_CHARS);\n }\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [{ path: \".windsurfrules\", content }],\n droppedFeatures,\n warnings,\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const copilotCompiler: Compiler = {\n id: \"copilot\",\n name: \"GitHub Copilot Instructions\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n return {\n files: [\n { path: \".github/copilot-instructions.md\", content },\n ],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type { Compiler, CompileResult, CompileOptions } from \"./types.js\";\nimport { buildFlatBody } from \"./utils.js\";\n\nexport const clineCompiler: Compiler = {\n id: \"cline\",\n name: \"Cline Rules\",\n multiFile: false,\n supports: {\n frontmatter: false,\n scoping: false,\n filePatterns: false,\n constraints: true,\n dependencies: false,\n knowledge: true,\n },\n\n compile(\n canonical: CanonicalFormat,\n options?: CompileOptions,\n ): CompileResult {\n const droppedFeatures: string[] = [];\n const content = buildFlatBody(canonical, options);\n\n if (canonical.scoping?.trigger) {\n droppedFeatures.push(\"scoping\");\n }\n if (canonical.dependencies?.skills) {\n droppedFeatures.push(\"dependencies\");\n }\n\n const filename = canonical.meta.name + \".md\";\n\n return {\n files: [{ path: `.clinerules/${filename}`, content }],\n droppedFeatures,\n warnings: [],\n };\n },\n};\n","import type { CanonicalFormat } from \"../types/canonical.js\";\nimport type {\n Compiler,\n CompileTarget,\n CompileResult,\n CompileOptions,\n} from \"./types.js\";\n\nimport { skillMdCompiler } from \"./skill-md.js\";\nimport { soulMdCompiler } from \"./soul-md.js\";\nimport { cursorMdcCompiler } from \"./cursor-mdc.js\";\nimport { cursorRulesCompiler } from \"./cursor-rules.js\";\nimport { claudeMdCompiler } from \"./claude-md.js\";\nimport { agentsMdCompiler } from \"./agents-md.js\";\nimport { windsurfCompiler } from \"./windsurf.js\";\nimport { copilotCompiler } from \"./copilot.js\";\nimport { clineCompiler } from \"./cline.js\";\n\nconst compilers: Compiler[] = [\n skillMdCompiler,\n soulMdCompiler,\n cursorMdcCompiler,\n cursorRulesCompiler,\n claudeMdCompiler,\n agentsMdCompiler,\n windsurfCompiler,\n copilotCompiler,\n clineCompiler,\n];\n\n/**\n * Compile a CanonicalFormat to a target format.\n */\nexport function compile(\n canonical: CanonicalFormat,\n target: CompileTarget,\n options?: CompileOptions,\n): CompileResult {\n const compiler = compilers.find((c) => c.id === target);\n if (!compiler) {\n throw new Error(`No compiler for target: ${target}`);\n }\n return compiler.compile(canonical, options);\n}\n\n/**\n * List all available compile targets.\n */\nexport function listTargets(): Compiler[] {\n return [...compilers];\n}\n\n/**\n * Get a compiler by target ID.\n */\nexport function getCompiler(target: CompileTarget): Compiler | null {\n return compilers.find((c) => c.id === target) ?? null;\n}\n"],"mappings":";AAAA,OAAO,UAAU;AAEjB,IAAM,YAAY;AAEX,SAAS,iBAAiB,KAG/B;AACA,QAAM,UAAU,IAAI,UAAU;AAC9B,MAAI,CAAC,QAAQ,WAAW,SAAS,GAAG;AAClC,WAAO,EAAE,MAAM,CAAC,GAAG,SAAS,IAAI;AAAA,EAClC;AAEA,QAAM,MAAM,QAAQ,QAAQ;AAAA,EAAK,SAAS,IAAI,UAAU,MAAM;AAC9D,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AC;AACnC,UAAM,UAAU,cAAc,WAAW,OAAO;AAEhD,QAAI,UAAU,SAAS,SAAS;AAC9B,sBAAgB,KAAK,SAAS;AAAA,IAChC;AACA,QAAI,UAAU,cAAc,QAAQ;AAClC,sBAAgB,KAAK,cAAc;AAAA,IACrC;AAEA,UAAM,WAAW,UAAU,KAAK,OAAO;AAEvC,WAAO;AAAA,MACL,OAAO,CAAC,EAAE,MAAM,eAAe,QAAQ,IAAI,QAAQ,CAAC;AAAA,MACpD;AAAA,MACA,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AACF;;;ACrBA,IAAM,YAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,SAAS,QACd,WACA,QACA,SACe;AACf,QAAM,WAAW,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM;AACtD,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,2BAA2B,MAAM,EAAE;AAAA,EACrD;AACA,SAAO,SAAS,QAAQ,WAAW,OAAO;AAC5C;AAKO,SAAS,cAA0B;AACxC,SAAO,CAAC,GAAG,SAAS;AACtB;AAKO,SAAS,YAAY,QAAwC;AAClE,SAAO,UAAU,KAAK,CAAC,MAAM,EAAE,OAAO,MAAM,KAAK;AACnD;","names":["text","REQUIRED_FIELDS","Ajv","ajv","validateFn","validateFn"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillbase/compiler",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Parse, validate, compile, and convert SKILL.md / SOUL.md files",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",