@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/index.d.cts
CHANGED
|
@@ -665,6 +665,12 @@ interface ExcerptOptions {
|
|
|
665
665
|
sectionLanguageContract?: Record<string, Record<string, string>> | string;
|
|
666
666
|
/** File name or artifact type hint (e.g. 'LESSON', 'KNOWLEDGE_EXPOSITION'). */
|
|
667
667
|
artifactType?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Source file name (e.g. `LESSON_U03_M01_L06.md`) — artifact type derived
|
|
670
|
+
* from it when `artifactType` is not given. Matches the web app's builder
|
|
671
|
+
* option so both call-sites share one contract.
|
|
672
|
+
*/
|
|
673
|
+
fileName?: string;
|
|
668
674
|
/** Min chars below which the excerpt is flagged as insufficient (default 400). */
|
|
669
675
|
minContentChars?: number;
|
|
670
676
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -665,6 +665,12 @@ interface ExcerptOptions {
|
|
|
665
665
|
sectionLanguageContract?: Record<string, Record<string, string>> | string;
|
|
666
666
|
/** File name or artifact type hint (e.g. 'LESSON', 'KNOWLEDGE_EXPOSITION'). */
|
|
667
667
|
artifactType?: string;
|
|
668
|
+
/**
|
|
669
|
+
* Source file name (e.g. `LESSON_U03_M01_L06.md`) — artifact type derived
|
|
670
|
+
* from it when `artifactType` is not given. Matches the web app's builder
|
|
671
|
+
* option so both call-sites share one contract.
|
|
672
|
+
*/
|
|
673
|
+
fileName?: string;
|
|
668
674
|
/** Min chars below which the excerpt is flagged as insufficient (default 400). */
|
|
669
675
|
minContentChars?: number;
|
|
670
676
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -9830,8 +9830,9 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
|
|
|
9830
9830
|
};
|
|
9831
9831
|
}
|
|
9832
9832
|
const slcMap = normalizeSlcContract(opts.sectionLanguageContract);
|
|
9833
|
-
const
|
|
9834
|
-
const
|
|
9833
|
+
const effectiveArtifactType = opts.artifactType || deriveArtifactTypeFromFileName(opts.fileName);
|
|
9834
|
+
const sections = parseMarkdownSections(source, slcMap, effectiveArtifactType);
|
|
9835
|
+
const metaBlock = buildMetaBlock(source, effectiveArtifactType);
|
|
9835
9836
|
if (sections.length === 0) {
|
|
9836
9837
|
issues.push("parse:no-sections");
|
|
9837
9838
|
const excerpt2 = truncateByBudget(source, budget);
|
|
@@ -10022,7 +10023,7 @@ function truncateByBudget(source, budget) {
|
|
|
10022
10023
|
if (fenceCount % 2 === 1) cut += "\n```";
|
|
10023
10024
|
return cut;
|
|
10024
10025
|
}
|
|
10025
|
-
function buildMetaBlock(source) {
|
|
10026
|
+
function buildMetaBlock(source, artifactType) {
|
|
10026
10027
|
const fm = source.match(/^---\s*\r?\n([\s\S]*?)\r?\n---/);
|
|
10027
10028
|
const pick = (key) => {
|
|
10028
10029
|
if (!fm) return "";
|
|
@@ -10031,9 +10032,17 @@ function buildMetaBlock(source) {
|
|
|
10031
10032
|
};
|
|
10032
10033
|
const id = pick("id");
|
|
10033
10034
|
const title = pick("title");
|
|
10034
|
-
const type = pick("type");
|
|
10035
|
+
const type = pick("type") || artifactType || "";
|
|
10035
10036
|
return `<!-- SOURCE: ${type || "ARTIFACT"} | ${id || "unknown"}${title ? ` \u2014 ${title}` : ""} (section-aware excerpt; canonical knowledge, do not contradict) -->`;
|
|
10036
10037
|
}
|
|
10038
|
+
function deriveArtifactTypeFromFileName(fileName) {
|
|
10039
|
+
if (!fileName) return void 0;
|
|
10040
|
+
const base = fileName.replace(/\.md$/i, "");
|
|
10041
|
+
const multiWord = base.match(/^(KNOWLEDGE_EXPOSITION|SECTION_LANGUAGE_CONTRACT|CONTENT_STYLE_GUIDE|CURRICULUM_FRAMEWORK|LEARNER_PROFILE|PROJECT_BRIEF|REFERENCE_PACK|CURRICULUM_PLAN)/i);
|
|
10042
|
+
if (multiWord) return multiWord[1].toUpperCase();
|
|
10043
|
+
const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
|
|
10044
|
+
return token ? token[1] : void 0;
|
|
10045
|
+
}
|
|
10037
10046
|
|
|
10038
10047
|
// src/services/knowledgeExpositionService.ts
|
|
10039
10048
|
var EXPOSITION_REL = (lessonCode) => "_sot/expositions/" + lessonCode + ".md";
|