@thanh01.pmt/curriculum-kit 1.4.0 → 1.4.1

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
@@ -9841,8 +9841,9 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
9841
9841
  };
9842
9842
  }
9843
9843
  const slcMap = normalizeSlcContract(opts.sectionLanguageContract);
9844
- const sections = parseMarkdownSections(source, slcMap, opts.artifactType);
9845
- const metaBlock = buildMetaBlock(source);
9844
+ const effectiveArtifactType = opts.artifactType || deriveArtifactTypeFromFileName(opts.fileName);
9845
+ const sections = parseMarkdownSections(source, slcMap, effectiveArtifactType);
9846
+ const metaBlock = buildMetaBlock(source, effectiveArtifactType);
9846
9847
  if (sections.length === 0) {
9847
9848
  issues.push("parse:no-sections");
9848
9849
  const excerpt2 = truncateByBudget(source, budget);
@@ -10033,7 +10034,7 @@ function truncateByBudget(source, budget) {
10033
10034
  if (fenceCount % 2 === 1) cut += "\n```";
10034
10035
  return cut;
10035
10036
  }
10036
- function buildMetaBlock(source) {
10037
+ function buildMetaBlock(source, artifactType) {
10037
10038
  const fm = source.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
10038
10039
  const pick = (key) => {
10039
10040
  if (!fm) return "";
@@ -10042,9 +10043,17 @@ function buildMetaBlock(source) {
10042
10043
  };
10043
10044
  const id = pick("id");
10044
10045
  const title = pick("title");
10045
- const type = pick("type");
10046
+ const type = pick("type") || artifactType || "";
10046
10047
  return `<!-- SOURCE: ${type || "ARTIFACT"} | ${id || "unknown"}${title ? ` \u2014 ${title}` : ""} (section-aware excerpt; canonical knowledge, do not contradict) -->`;
10047
10048
  }
10049
+ function deriveArtifactTypeFromFileName(fileName) {
10050
+ if (!fileName) return void 0;
10051
+ const base = fileName.replace(/\.md$/i, "");
10052
+ const multiWord = base.match(/^(KNOWLEDGE_EXPOSITION|SECTION_LANGUAGE_CONTRACT|CONTENT_STYLE_GUIDE|CURRICULUM_FRAMEWORK|LEARNER_PROFILE|PROJECT_BRIEF|REFERENCE_PACK|CURRICULUM_PLAN)/i);
10053
+ if (multiWord) return multiWord[1].toUpperCase();
10054
+ const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
10055
+ return token ? token[1] : void 0;
10056
+ }
10048
10057
 
10049
10058
  // src/services/knowledgeExpositionService.ts
10050
10059
  var EXPOSITION_REL = (lessonCode) => "_sot/expositions/" + lessonCode + ".md";