@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 +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +13 -4
- package/dist/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +13 -4
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.mjs +13 -4
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/workflow/index.cjs
CHANGED
|
@@ -6257,8 +6257,9 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
|
|
|
6257
6257
|
};
|
|
6258
6258
|
}
|
|
6259
6259
|
const slcMap = normalizeSlcContract(opts.sectionLanguageContract);
|
|
6260
|
-
const
|
|
6261
|
-
const
|
|
6260
|
+
const effectiveArtifactType = opts.artifactType || deriveArtifactTypeFromFileName(opts.fileName);
|
|
6261
|
+
const sections = parseMarkdownSections(source, slcMap, effectiveArtifactType);
|
|
6262
|
+
const metaBlock = buildMetaBlock(source, effectiveArtifactType);
|
|
6262
6263
|
if (sections.length === 0) {
|
|
6263
6264
|
issues.push("parse:no-sections");
|
|
6264
6265
|
const excerpt2 = truncateByBudget(source, budget);
|
|
@@ -6449,7 +6450,7 @@ function truncateByBudget(source, budget) {
|
|
|
6449
6450
|
if (fenceCount % 2 === 1) cut += "\n```";
|
|
6450
6451
|
return cut;
|
|
6451
6452
|
}
|
|
6452
|
-
function buildMetaBlock(source) {
|
|
6453
|
+
function buildMetaBlock(source, artifactType) {
|
|
6453
6454
|
const fm = source.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
|
|
6454
6455
|
const pick = (key) => {
|
|
6455
6456
|
if (!fm) return "";
|
|
@@ -6458,9 +6459,17 @@ function buildMetaBlock(source) {
|
|
|
6458
6459
|
};
|
|
6459
6460
|
const id = pick("id");
|
|
6460
6461
|
const title = pick("title");
|
|
6461
|
-
const type = pick("type");
|
|
6462
|
+
const type = pick("type") || artifactType || "";
|
|
6462
6463
|
return `<!-- SOURCE: ${type || "ARTIFACT"} | ${id || "unknown"}${title ? ` \u2014 ${title}` : ""} (section-aware excerpt; canonical knowledge, do not contradict) -->`;
|
|
6463
6464
|
}
|
|
6465
|
+
function deriveArtifactTypeFromFileName(fileName) {
|
|
6466
|
+
if (!fileName) return void 0;
|
|
6467
|
+
const base = fileName.replace(/\.md$/i, "");
|
|
6468
|
+
const multiWord = base.match(/^(KNOWLEDGE_EXPOSITION|SECTION_LANGUAGE_CONTRACT|CONTENT_STYLE_GUIDE|CURRICULUM_FRAMEWORK|LEARNER_PROFILE|PROJECT_BRIEF|REFERENCE_PACK|CURRICULUM_PLAN)/i);
|
|
6469
|
+
if (multiWord) return multiWord[1].toUpperCase();
|
|
6470
|
+
const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
|
|
6471
|
+
return token ? token[1] : void 0;
|
|
6472
|
+
}
|
|
6464
6473
|
init_errors();
|
|
6465
6474
|
|
|
6466
6475
|
// src/services/languageDirective.ts
|